Do anyone know what MFTransform should I use to convert a 'MJPG' MFSample to 'YUY2' or 'RGB24'?
Any tip will be very appreciated. Thanks
Do anyone know what MFTransform should I use to convert a 'MJPG' MFSample to 'YUY2' or 'RGB24'?
Any tip will be very appreciated. Thanks
Since the number of visits to this post was noticeable I'm going to answer my own question.
The trick is to enum all the transformations between MJPG and YUY2 since it seems there isn't direct transformation between MJPG and RGB32. To transform the image between YUY2 and RBG32 use the color converter DSP: http://msdn.microsoft.com/en-us/library/windows/desktop/ff819079%28v=vs.85%29.aspx
I use this method to fetch samples from a 1080p webcam and then decoding MJPG to YUY2 and then decoding YUY2 to RGB32 and then loading a OpenGL RGB32 texture, and then displaying it. It is done at 30fps with a core 2 duo, and a Radeon HD5650. When doing come computation with the images with OpenCL (several convolutions) it drops to 15 fps.
Code to create a MJPG to YUY2 transform:
The next part is to use the decoder to decode the compressed sample (first from MJPG to YUY2 and then from YUY2 to RGB32). It is explained in: http://msdn.microsoft.com/en-us/library/windows/desktop/aa965264%28v=vs.85%29.aspx
Or: