IJL bug

IJL bug

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.

2 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione
Ritratto di Community Admin

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;
jerr = ijlRead(&jcprops,IJL_JFILE_READWHOLEIMAGE);
See sample from previous version of IJL in attachment


Accedere per lasciare un commento.