Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
16 Views

How should I do to let the IJL decode as YCbCr?

Hi :

Iwould like let the IJL( embedded IPP) decode jpeg as YCbCr format,

the code is work for decode as RGB/BGR:

typedef struct _IJLDecoder
{
// create the JPEG structure on the stack
JPEG_CORE_PROPERTIES jcprops;

}IJLDecoderObject;


:
:
IJLDecoderObject *Decoder;
Decoder = (IJLDecoderObject*)malloc(1*sizeof(IJLDecoderObject));
if(NULL == decoder) return NULL;

// intialize the JPEG structure
ijlInit( &(Decoder->jcprops) );

/* set the IJL data source as the input buffer */
/* jpeg as src : pSrcBuf format is YCbCr411.
RGB/BGR as dst: pDstBuf
*/

Decoder->jcprops.JPGBytes = (unsigned char*)pSrcBuf;
Decoder->jcprops.JPGSizeBytes = (int)jpegSize;

/* read JPEG parameters from the input buffer*/
jerr = ijlRead(&(Decoder->jcprops), IJL_JBUFF_READPARAMS);
if(jerr < 0) return -1;

/* set up the DIB specification for the JPEG decoder */
Decoder->jcprops.DIBBytes = (unsigned char*)pDstBuf;
Decoder->jcprops.DIBWidth = Decoder->jcprops.JPGWidth;
Decoder->jcprops.DIBHeight = (int)(Decoder->jcprops.JPGHeight);
Decoder->jcprops.DIBColor = IJL_BGR;
Decoder->jcprops.DIBSubsampling = IJL_NONE;
Decoder->jcprops.DIBChannels = 3;
Decoder->jcprops.DIBPadBytes = IJL_DIB_PAD_BYTES( Decoder->jcprops.DIBWidth, Decoder->jcprops.DIBChannels);

/* read data from the JPEG image into the bitmap*/
jerr = ijlRead(&(Decoder->jcprops), IJL_JBUFF_READWHOLEIMAGE);


When I change the line for decode as YCbCr :

Decoder->jcprops.DIBColor = IJL_BGR;
as
Decoder->jcprops.DIBColor = IJL_YCBCR;

the jerr is not IJL_OK, but IJL_INVALID_JPEG_PROPERTIES !!


How should I do to let the IJL decode as YCbCr (411)?

thank you.

0 Kudos
2 Replies
Highlighted
16 Views

Hello,

IJL is able to output YCbCr422 (YUY2) only. Note, it does not implement resampling. That means that YUY2 output is only available for JPEG images which compressed with YCbCr422 format.

Regards,
Vladimir
0 Kudos
Highlighted
New Contributor I
16 Views

thank you lots.
0 Kudos