使用CPU在iOS上进行最快的YUV420P到RGBA转换 [英] Fastest YUV420P to RGBA conversion on iOS using the CPU

查看:1041
本文介绍了使用CPU在iOS上进行最快的YUV420P到RGBA转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以推荐一款真正快速的API,理想情况是NEON优化,可以在iPhone 上使用CPU 在运行时进行YUV到RGB转换吗?加速框架的vImage没有提供任何合适的东西,遗憾的是,使用vDSP,转换为浮点数和返回看起来不是最理想的,几乎和我自己编写NEON一样多。

Can anyone recommend a really fast API, ideally NEON-optimized for doing YUV to RGB conversion at runtime on the iPhone using the CPU? The accelerate framework's vImage doesn't provide anything suitable, sadly, and using vDSP, converting to floats and back seems suboptimal and almost as much work as writing NEON myself.

我知道如何通过着色器使用GPU,实际上已经这样做了,用于显示我的主视频平面。不幸的是,我还需要在运行时创建和保存显示的子区域的RGBA纹理。这个问题的大多数好的答案都涉及着色器,但我不想将GPU用于额外的工作,因为:

I know how to use the GPU for this via a shader, and in fact already do so for displaying my main video plane. Unfortunately, I also need to create and save RGBA textures of subregions of the display at runtime. Most of the good answers to this question involve shaders, but I don't want to use the GPU for that additional work, because:

(1)虽然我可以使用RenderTextures和我的YUV着色器转换和缓存区域,我不想再为应用添加任何同步/复杂性。 (我已经将纹理从CVTextureCache传递到Unity3D ......在许多情况下我已经在Unity3D的背后切换状态,并且不想再做任何调试......)

(1) Although I could use RenderTextures and my YUV shader to convert and cache the regions, I don't want to add any more synchronization/complexity to the app. (I already pass textures from a CVTextureCache to Unity3D... I'm switching state from OpenGL behind Unity3D's back in many cases already and don't want to do any more debugging...)

(2)更实际的是我正在编写游戏,并且没有任何GPU可供使用(因为游戏通常没有 - 我已经提供了更多关于如何在GPU中获取内容的演示文稿最近几年比如何把东西放在上面......)

(2) More practically I am writing a game, and don't have any GPU to spare (as games generally don't - I've given more presentations about how to get things off the GPU in the last few years than how to put things on it...)

(3)在iPad上,我有一个备用核心坐在那里什么都不做。

(3) On the iPad, I have a spare core sitting there doing nothing.

虽然有很多库可以做到YUV到RGBA,但我很乐意节省编写自己的NEON版本的时间。现在我正在使用这样的OpenCV实现:

Whilst there are many libraries out there that will do YUV to RGBA, I'd love to save the time of writing my own NEON version. Right now I'm using OpenCV's implementation like this:

cv::cvtColor(avFoundationYUVCaptureMat, BGRAInputImage, CV_YUV420sp2BGRA, 4);

这是正确的,但结束日期较慢。

which is correct, but end-of-days slow.

如果有人以前看过其他实现(CoreImage?FFMpeg?)并且可以推荐一个我会非常感激。

If anyone has previously looked at other implementations (CoreImage? FFMpeg?) and can recommend one I'd be hugely grateful.

谢谢,
Alex。

Thanks, Alex.

推荐答案

如果你有 Y U V 在不同的飞机上并且没有色度下采样,那么你应该可以使用 vImageMatrixMultiply_Planar8 进行转换。

If you have Y, U, V in separate planes and there is no chroma downsampling, then you should be able to use vImageMatrixMultiply_Planar8 to do the conversion.

这篇关于使用CPU在iOS上进行最快的YUV420P到RGBA转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆