Media (Intel® oneAPI Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK

Puzzles on mfxsurface plane pointers



I don't quite understand with the source codes that deal with mfxsurface plane pointers in the h264 encoder filter project:

        case MFX_FOURCC_NV12:

            pmfxSurface->Data.Y   = pBuffer;

            pmfxSurface->Data.UV  = pBuffer + pmfxSurface->Data.Pitch * lConnectionHeight;


        case MFX_FOURCC_YUY2:

            pmfxSurface->Data.Y = pBuffer;

            pmfxSurface->Data.U = pmfxSurface->Data.Y + 1;

            pmfxSurface->Data.V = pmfxSurface->Data.Y + 3;


        case MFX_FOURCC_RGB4:

           pmfxSurface->Data.R = pBuffer;                                                               

            pmfxSurface->Data.G = pBuffer + 4;

            pmfxSurface->Data.B = pBuffer + 8;            


The first 2 cases are easy to understand. But in the third case, I don’t know why Data.G = pBuffer + 4 and Data.B = pBuffer + 8.The byte format for RGB32 is like: r0 = rgb[0]; g0 = rgb[1]; b0 = rgb[2];

Alpha0 = rgb[3];r1 = rgb[4];g1 = rgb[5];b1 = rgb[6];alpha1=rgb[7].......So why shouldn’t be “Data.G = pBuffer+1,Data.B=pBuffer+2”?


My purpose is to modify the codes to support RGB24. Is this feasible? If so,how should I set the mfxsurface plane pointers to the color channels in RGB24 format?



Best regards!




0 Kudos
1 Reply
Hi Patrick, Media SDK only supports RGB4 (also conversely named RGB32). Media SDK VPP processing of RGB24 was deprecated quite some time back (does not work). If you for instance need to perform RGB24 to NV12 conversion you will have to look at alternative color conversion approach since it is not supported by Media SDK. RGB4 is a 32 bit per pixel format. This is why you see a 4 byte offset between R,G and B. Compare this to the NV12 Y plane which is stores a pixel in 8 bits. Regards, Petter
0 Kudos