Color_FormatSurface implementation

心不动则不痛 提交于 2019-12-06 07:30:50

问题


Is there any available documentation about Color_FormatSurface (AndroidOpaque) color format? My video encoder currently does not support this format, and I am supposed to add that feature, but I cannot find anything about it.

Any help would be appreciated.


回答1:


There is no documentation on it, because it is opaque. That's "opaque" in the programming sense, not the alpha-blending sense.

The idea behind the "opaque" format is that it's whatever the device manufacturer decides is most appropriate for the device. YV12, NV21, RGBA, BGRA, whatever... on qcom devices it's probably one of their wacky formats. The video encoder and the GPU need to agree on what the format is, so that they can pass surfaces to each other, but applications are expected to use the GPU to read or write the data.

The surface's format is specified in the gralloc buffer meta-data. To read an "opaque" surface you might need to reverse-engineer a proprietary format. To write an "opaque" surface you can allocate a gralloc buffer and set the color format manually... since "opaque" just means "whatever the encoder feels like", you have some freedom of choice, but bear in mind that GPUs may not handle all formats, and some formats may be handled significantly more efficiently than others.




回答2:


In Android 5.0, the software encoders also became able to use surface for input. This commit shows how that was implemented: https://android.googlesource.com/platform/frameworks/av/+/2edda09a%5E%21/



来源:https://stackoverflow.com/questions/28027858/color-formatsurface-implementation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!