Media (Intel® oneAPI Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools from Intel. This includes Intel® oneAPI Video Processing Library and Intel® Media SDK.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
2935 Discussions

NV12 to RGB24 color space conversion code in Media SDK software

Ramanand
Beginner
736 Views

Hi all,

Does anyone know how to convert Intel Media SDK (version: Media SDK 2010) H.264 video frame decoded output NV12 format to RGB888 (RGB24) bit conversion?

Basically Media SDK decoder output will be in NV12 color format and the render needs the RGB24 color bit format, so if any conversion code avaiable for converting NV12-->RGB24 would be great help for us.

Thanks in advance,

Ramanand

0 Kudos
3 Replies
Vassili_Yakovlev
Beginner
736 Views
Hi Ramanand,

If you use DirectX for rendering, you can easily convert NV12 to YUV12, and do converting from YUV12 to RGB by DirectX itself, by copying the surfaces.

Kind regards,
Vassili
Petter_L_Intel
Employee
736 Views
Hi,

Vassily, thanks for pointing out the DirectX color conversion capability.

Ramanand, if you are not using D3D surfaces you can instead explore the CPU based color conversion routines that are part of Intel Performance Primitives (IPP). I believe there is a primitive that supports this conversion.

Regards,
Petter
stevz
Beginner
736 Views
Hi

I think the DirectX conversion does only apply to DX9 as of now? As far as I know only DXVA supports this conversion and that would be connected to DX9. In DX10 and DX11 there is no build-in support.

This will change with Windows 8 where DX11 features direct support of various YUV format surfaces in hardware. But then this would be limited to Windows 8 and remains lacking on Windows 7.

But you can always move the NV12 data into a texture and write your own pixel shader to convert the color space. It might be easier to convert the NV12 to YUV444 beforehand, but then you could also do the RGB conversion on the CPU by hand.

If you are in for speed you would have to do the UV upsampling in the pixel shader as well. The conversion can be derived from here, for example:

http://en.wikipedia.org/wiki/YUV#Y.27UV422_to_RGB888_conversion

regards
Reply