简体   繁体   English

可以想象使用移动设备的GPU来加速运行时图像压缩吗?

[英]Is it conceivable to use a mobile device's GPU to accelerate runtime image compression?

I'm not necessarily looking for an immediate practical solution, but was curious as to whether the state of the art has been taken to practical limits. 我并不一定要寻求即时的实际解决方案,但对是否已将现有技术限制在实际范围内感到好奇。

I understand low level GPU programming is a black art only a few have mastered and was curious if a mobile device's GPU can be used for such general processing tasks, it's all way over my head. 我了解低级GPU编程是一门妖术,只有少数人已经掌握,并且很好奇是否可以将移动设备的GPU用于此类常规处理任务,这一切都让我感到头疼。 (I recall hearing that the export of 3D game consoles to some countries is forbidden, due to the possibility of employing them to do Supercomputer power computing) (我记得有消息说,由于有可能使用3D游戏机进行超级计算机功率计算,因此禁止向某些国家出口3D游戏机)

It would be great if there was a Flash native extension that could quickly compress dynamically generated images to GPU texture map formats. 如果有Flash本机扩展可以将动态生成的图像快速压缩为GPU纹理图格式,那就太好了。 I'm guessing some trickery, like using the GPU in the compression process may be needed to get it done in an acceptable time. 我猜测有些技巧,例如可能需要在压缩过程中使用GPU才能在可接受的时间内完成它。 My particular vector art project could tolerate simple color palette reduction techniques like PVRTC4 which might be? 我的特定矢量艺术项目可以忍受像PVRTC4这样的简单调色板减少技术,这可能是吗? doable in AS3. 在AS3中可行。

I'm working on a project that dynamically generates large background texture maps at runtime from Flash vectors, in a project using Starling (the tools that allows mortals to utilize the GPU via stage3D) It would be a big plus to be able to generate compressed textures that occupy less GPU memory, it seems that the only current solution for minimizing texture map memory size is using pre-compressed external images, like an Adobe ATF container. 我正在开发一个项目,该项目使用Starling(允许凡人通过stage3D使用GPU的工具)在运行时从Flash向量动态生成大型背景纹理贴图,这在项目中将是一大优势。占用较少GPU内存的贴图,似乎最小化贴图贴图内存大小的唯一当前解决方案是使用预压缩的外部图像,例如Adobe ATF容器。 Although Flash may already be beyond it's projected lifespan, I can still get distribution files 10X smaller using flash vectors instead of any of the alpha channel bitmap compression methods. 尽管Flash可能已经超出了其预期的使用寿命,但是我仍然可以使用Flash向量代替任何Alpha通道位图压缩方法来使分发文件小10倍。

Adobe had added the facility "Flash Player 11.4 and AIR 3.4 support runtime texture compression" (but it turns out to currently only work on desktop systems) Adobe已添加了“ Flash Player 11.4和AIR 3.4支持运行时纹理压缩”功能(但事实证明,该功能目前仅适用于台式机系统)

Mentioned as an aside in this article: http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d5b.html 在本文中提到了这一点: http : //help.adobe.com/zh_CN/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d5b.html

To access the functionality: "Create the texture object by calling the Context3D.createTexture() method, passing flash.display3D.Context3DTextureFormat.COMPRESSED" 要访问该功能,请执行以下操作:“通过调用Context3D.createTexture()方法并传递flash.display3D.Context3DTextureFormat.COMPRESSED创建纹理对象”

The subject was brought up here: stackoverflow.com/questions/18070813/how-to-implement-the-runtime-compression-of-texture 在这里提出了这个主题:stackoverflow.com/questions/18070813/how-to-implementation-the-runtime-compression-of-texture

The maker of starling worked on incorporating the Adobe runtime image compression facilities, only to learn from Adobe that it doesn't presently work on mobile devices. Starling的制造商致力于整合Adobe运行时图像压缩工具,只是从Adobe得知它目前不适用于移动设备。 https://github.com/PrimaryFeather/Starling-Framework/issues/153 https://github.com/PrimaryFeather/Starling-Framework/issues/153

I assume it would be a huge challenge for someone to create the code to compress either PVRTC, ETC1 or DXT5 format depending on the device, just to support the few generating bitmaps on the fly. 我认为对于某些人来说,创建代码以根据设备压缩PVRTC,ETC1或DXT5格式将是一个巨大的挑战,仅支持动态生成少量位图。

Here's a "real time trans-coding" C++ library that may be relevant: 这是一个可能相关的“实时转码” C ++库:

code.google.com/p/crunch/ code.google.com/p/crunch/

and a javascript translation: www-cs-students.stanford.edu/~eparker/files/crunch/more_info.html 和javascript翻译:www-cs-students.stanford.edu/~eparker/files/crunch/more_info.html

I was hoping somebody with actual experience would answer this .. oh well, here goes. 我希望有实际经验的人能回答这个问题。

"Low level GPU programming" isn't that much of a black art. “低级GPU编程”并不是一件黑手艺。 You're writing shaders in a dialect of C. You can do bit masking and integer shifts as well as floating point math. 您正在用C的方言编写着色器。您可以进行位掩码和整数移位以及浮点数学运算。 The hardest part is wrapping your head around how a GPU does parallel processing and how the data gets fed into your shaders. 最困难的部分是围绕GPU如何进行并行处理以及如何将数据输入到着色器中来。 The OpenGL SuperBible should be your starting point. OpenGL SuperBible应该是您的起点。

In my limited experience, GPU shaders are pretty good at decompressing images, eg I'v used shaders to convert from Bayer RGGB digital camera pixel form into RGB. 以我有限的经验,GPU着色器非常擅长解压缩图像,例如,我使用着色器将Bayer RGGB数码相机像素形式转换为RGB。 They're not so good at compressing images, because the output from compression is a variable length stream of data, not an image. 它们不擅长压缩图像,因为压缩的输出是可变长度的数据流,而不是图像。 If I were trying it, I'd write a vertex shader with the uncompressed image as a texture input and the output into a transform feedback buffer. 如果要尝试,我会编写一个顶点着色器,将未压缩的图像作为纹理输入,然后将输出输出到变换反馈缓冲区中。 But I'm not sure transform feedback is available on many mobile devices. 但是我不确定转换反馈在许多移动设备上是否可用。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM