Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Darrell_S_
Beginner
126 Views

MJPEG RGB Encoder

I am having troubles encoding RGB content with the MJPEG encoder.  I've set the 4CC to MFX_FOURCC_RGB4 and the ChromaFormat to MFX_CHROMAFORMAT_YUV444 but the colors are coming out wrong.  I can see the image, but the colors don't line up properly.  Swizzling the values around only changes the predominate color from red to green to blue.

I'm only creating space for the RGB surfaces as follows:

pEncSurface->Data.R = surfaceBuffer.GetData();

pEncSurface->Data.G = pEncSurface->Data.R + 1;

pEncSurface->Data.B = pEncSurface->Data.R + 2;

I don't believe I need to setup the Alpha channel since the doc's says that it is not encoded.

I'm able to encode YUV420 and YUV422 content without any problems so I know that the flow of my code works properly.  

For a quick test, I encoded all 0xFF for the RGB values and I would expect to see white, but I'm seeing pink.  When I encode 0x00 for the RGB values, I would expect to see black, but I'm seeing dark green instead.  

Is anyone else having the same problem?  

0 Kudos
3 Replies
Surbhi_M_Intel
Employee
126 Views

Hi Darrell,

Since you have set the FOURCC to MFX_FOUR_RGB4, it is a 4 channel color format(32bits) you don't need to explicitly set an alpha channel but have to consider 8bits for alpha to get the right stride.
Also to consider of is that the order of RGB4 is ARGB, where each channel is 8bits and A channel would be 8MSBs.

There is also a tutorial present in previous version of Intel Media SDK tutorial that showcases how to use IPP for RGB24 to NV12 conversion -  https://software.intel.com/en-us/articles/intel-media-sdk-tutorial-simple-6-encode-ipp-cc  ;

Thanks,
-Surbhi

Darrell_S_
Beginner
126 Views

Hi Surbhi,

Thanks for your suggestions. I guess the other question is in the jpeg encoded file.  If I pass in RGB values, does the encoder convert it to some flavor of YUV values or is the output still in the RGB color space?

Darrell

Surbhi_M_Intel
Employee
126 Views

Hi Darrell,

I assumed that you want to do color conversion as well that's why pointed to the tutorial. Sorry for the confusion. 
Considering Alpha channel should solve your problem and you can choose the chroma format to be MFX_CHROMAFORMAT_YUV420, which is used by default. It was vision to use other format also, but for now we support MFX_CHROMAFORMAT_YUV420. You can also use LoadRawRGBFrame function to read the input in RGB format(you can find this function in simple_encode tutorial over here). Hope it helps.

Thanks,
-Surbhi

Reply