- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to decompress a JPEG directly to a YUV422 DIB, and ijlRead() fails with IJL_EXCEPTION_DETECTED. I looked at the source code for ijlRead() in the IJL sample, and I found that itis not calculating DIBLineBytes correctly for the case where DIBSubsampling is IJL_422. ijlWrite()takes into account that IJL_422 only has two bytes per pixel, but ijlRead() just uses the number of channels (3). Since it thinks that DIB lines are longer than they really are, it starts writing past the end of the DIB buffer.
This is using the IJL sample for IPP 4.0.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is not a bug. To decode YCbCr422 JPEG to YCbCr422 DIB you need to set DIBChannels member of JPEG_CORE_PROPERTIES structure to 2.
You should use something like this:
jcprops.DIBWidth = jcprops.JPGWidth;
jcprops.DIBHeight = -jcprops.JPGHeight;
jcprops.DIBChannels = 2; // NOTE: we must set nchannels = 2 to decode as YCBYCR
jcprops.DIBBytes = dib_buffer;
jcprops.DIBPadBytes = 0;
jcprops.DIBColor = IJL_YCBCR;
jcprops.DIBSubsampling = IJL_422;
jcprops.DIBHeight = -jcprops.JPGHeight;
jcprops.DIBChannels = 2; // NOTE: we must set nchannels = 2 to decode as YCBYCR
jcprops.DIBBytes = dib_buffer;
jcprops.DIBPadBytes = 0;
jcprops.DIBColor = IJL_YCBCR;
jcprops.DIBSubsampling = IJL_422;
jerr = ijlRead(&jcprops,IJL_JFILE_READWHOLEIMAGE);
See sample from previous version of IJL in attachment
Regards,
Vladimir
Vladimir
![](/skins/images/872293744008A34B36F8ABF94A46CC66/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page