How to optimize conversation from YUY2 to NV12 with MMX/SSE?

How to optimize conversation from YUY2 to NV12 with MMX/SSE?

Does someone know how to do this conversation as title with MMX/SSE? General speaking, I think the process is just unpack the interleaved Y,U,V data in each byte and rearrange them into one block of Y, UV block consisting of interleaved U,V. Here, I do not see any instructive could help to improve this data copy process. Maybe, it's just because, I am fresh new to MMX/SSE. Is there someone being so kind to give me hint? Thanks in advance.

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Look towards _mm_shuffle_epi8, _mm_unpacklo_epi8, _mm_unpackhi_epi8 instructions.


To do this with a MediaSDK surface, the VPP implementation is optimized to use CPU or GPU depending on what type of memory the surface resides.  For example, if your surface is in VIdeo Memory, it is more efficient to have the graphics processor provide this conversion.


Thank you so much, dj_alek. It sounds very helpful for me. I am learning and thinking how to take it to unpack YUYV to YY UV. 

Tony, Thanks for your tips as well. However, would you please elaberate with further details? I went through the SDK document, but did not see the relavant APIs about VPP for this. In the samples provided in by intel_media_sdk_tutorial_041813 from your web site, the conversion is done by C code. So, is there any other example for my reference?

I found the easiest to use.

Hi Bruno, thanks for your information. Unfortunately, that link is not accessbile for me for the time being. I will try it later. Is that a third party library to do color space conversion?

To Tony, I evetually managed to get VPP code snippet from media sdk developper guide document, about what you said. I will try it. However, to be honest, I do not like the asynchronous API style for this step. My usage scenario is that, I've already got the YUY2. For next, I want do conversion from YUY2 to NV12 and H264 compression in serial. That would make my life easier to maintain the code. Anyway, thanks for your warmhearted help! 

Leave a Comment

Please sign in to add a comment. Not a member? Join today