AnsweredAssumed Answered

JPEG Encoding corruption

Question asked by Laz on Jun 16, 2011
Latest reply on Jul 6, 2011 by Laz

I am finally able to get a processed JPEG image out to my host PC, so I can compare the processed image to the raw image, and I am greatly disappointed.  I have attached the BMP file from the image viewer and the JPG file from the ADI JPEG Library.  My config code is here.  The image is 640x480 YUV422, quality is ~30.  It appears that there is a scaling error, as the JPG image resembles the upper left quadrant of the original image.  I'm running on a single core of the BF561.  Anyone have a suggestion?

 

Thanks.

 

 

// create and load the JPEG processing header structure

 

/* Configure JPEG struct: */

JPEG_Param_CONFIG(&lImageEncParam, JPEG_FRAME_WIDTH, rawBuffer->h_pixels);

JPEG_Param_CONFIG(&lImageEncParam, JPEG_FRAME_HEIGHT, rawBuffer->v_pixels);

JPEG_Param_CONFIG(&lImageEncParam, JPEG_IMAGE_WIDTH, rawBuffer->h_pixels);

JPEG_Param_CONFIG(&lImageEncParam, JPEG_IMAGE_HEIGHT, rawBuffer->v_pixels);

JPEG_Param_CONFIG(&lImageEncParam, JPEG_QUALITYFACTOR, qualityFactor);

JPEG_Param_CONFIG(&lImageEncParam, JPEG_ENCODINGMODE, SEQUENTIAL);

JPEG_Param_CONFIG(&lImageEncParam, JPEG_THRESHOLD, TRUE);

JPEG_Param_CONFIG(&lImageEncParam, JPEG_IMAGEFORMAT, YUV422);

 

rawBufferSize = 3 * rawBuffer->h_pixels * rawBuffer->v_pixels;

StreamBuffer_Obj = JPEG_MemAlloc_NEW(rawBufferSize,1,MEM_TYPE_DATA);

 

StreamBuffer = (BYTE *)scratchVideoBuffer;  // direct write to SDRAM_Bank3

 

JPEG_Param_CONFIG(&lImageEncParam, JPEG_POINTER_INPUT, (int)rawBuffer->rawBuffer);

JPEG_Param_CONFIG(&lImageEncParam, JPEG_POINTER_OUTPUT, (int)StreamBuffer);

 

lBaseJpegEnc = JPEG_Encoder_NEW(&lImageEncParam);

 

if(lBaseJpegEnc == NULL)

{

JPEG_MemAlloc_DELETE(StreamBuffer_Obj);

 

return (JPEG_ERROR);

}

 

encode_image_result = JPEG_EncodeSequentialImage(lBaseJpegEnc, &outBytes);

 

 

 

 

Attachments

Outcomes