Community
cancel
Showing results for 
Search instead for 
Did you mean: 
cath09
Beginner
55 Views

How to decode MJPEG with IJL_411 sampling format?

Hi there,
I'm decoding JPEG image with IJL_411 sampling format, my ijlRead() fails. The code is like:

jprops.JPGBytes = const_cast(Begin); //encoded MJPEG data buffer
jprops.JPGSizeBytes = len; // the length of encoded MJPEG data buffer

// Read the properties first to find out the color space of the JPEG.
if (ijlRead(&jprops, IJL_JBUFF_READPARAMS) != IJL_OK)
return false;

// Fail if the frame size changed.
if (jprops.JPGWidth!=m_width || jprops.JPGHeight!=m_height)
return false;

jprops.DIBWidth = m_width;
jprops.DIBHeight = m_height;

m_rgbbuffer.resize(m_width * m_height * 3);
jprops.DIBColor = IJL_BGR;
jprops.DIBChannels = 3;
jprops.DIBPadBytes = IJL_DIB_PAD_BYTES( jprops.DIBWidth, jprops.DIBChannels );
int size = (jprops.DIBWidth * jprops.DIBChannels + jprops.DIBPadBytes) * jprops.DIBHeight;
BYTE *data = new BYTE[ size ];
memset( data, 0, size );
jprops.DIBBytes = data;

if (ijlRead(&jprops, IJL_JBUFF_READWHOLEIMAGE) != IJL_OK)
return false; //fails here.

What I did wrong? Thanks for any help.

-cath

0 Kudos
4 Replies
cath09
Beginner
55 Views

Quoting - cath09
Hi there,
I'm decoding JPEG image with IJL_411 sampling format, my ijlRead() fails. The code is like:

jprops.JPGBytes = const_cast(Begin); //encoded MJPEG data buffer
jprops.JPGSizeBytes = len; // the length of encoded MJPEG data buffer

// Read the properties first to find out the color space of the JPEG.
if (ijlRead(&jprops, IJL_JBUFF_READPARAMS) != IJL_OK)
return false;

// Fail if the frame size changed.
if (jprops.JPGWidth!=m_width || jprops.JPGHeight!=m_height)
return false;

jprops.DIBWidth = m_width;
jprops.DIBHeight = m_height;

m_rgbbuffer.resize(m_width * m_height * 3);
jprops.DIBColor = IJL_BGR;
jprops.DIBChannels = 3;
jprops.DIBPadBytes = IJL_DIB_PAD_BYTES( jprops.DIBWidth, jprops.DIBChannels );
int size = (jprops.DIBWidth * jprops.DIBChannels + jprops.DIBPadBytes) * jprops.DIBHeight;
BYTE *data = new BYTE[ size ];
memset( data, 0, size );
jprops.DIBBytes = data;

if (ijlRead(&jprops, IJL_JBUFF_READWHOLEIMAGE) != IJL_OK)
return false; //fails here.

What I did wrong? Thanks for any help.

-cath


cath09
Beginner
55 Views

Quoting - cath09
I have fixed the problem. The problem is I got the data wrong. -cath

Vladimir_Dudnik
Employee
55 Views

Hi, I glad to hear that. What is your feeling on UMC MJPEG codec performance and functionality?

Regards,
Vladimir
cath09
Beginner
55 Views

Hi, I glad to hear that. What is your feeling on UMC MJPEG codec performance and functionality?

Regards,
Vladimir

So far, the UMC MJPEG codec runs good for our project.

-cath