(IJL question) Jpeg Compressing a YUV buffer

(IJL question) Jpeg Compressing a YUV buffer

Hi, I'm having trouble using IJL 1.5.1 to compress a YUV buffer to a JPEG buffer. When I convert from YUV to RGB and compress the RGB buffer it works fine, but when I try to directly compress the YUV 422 format, it doubles in size and looks really strange when I decompress it (using Sun's Java JPEG decompressor).

Am I correct in assuming that the input (props.DIBBytes) to ijlWrite when using JBUFF (as opposed to JFILE) is an array of bytes in the format of:
Y0 U0 Y1 V0

props.JPGColor = IJL_YCBCR; //JPEG is stored as YUV 411?
props.JPGSubsampling = IJL_411;
props.JPGChannels = 3;
props.DIBColor = IJL_YCBCR; //My buffer is YUV 422
props.DIBSubsampling = IJL_422;
props.DIBChannels = 3;

(If you're wondering why, I'm writing code for a mobile robot to JPEG compress camera images that are obtained in PAL format which is YUV 422, send this data across the net, and then decompress the JPEG data inside a Java applet).

Thanks,
Shervin Emami

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

Hi Shervin,

quite interesting usage model for JPEG library, hope you will solve all possible throubles.

Regarding IJL, you are correct, the library is able to compress YUV422 buffer into JPEG with YUV422 sampling factors. Note, that IJL does not support resampling, for example, it is impossible to compress YUV422 buffer into YUV411 JPEG.

That's right, format of data is Y0 U0 Y1 V1... but you need to specify IJL_422 sampling on both ends, DIB and JPEG:

props.JPGColor = IJL_YCBCR;
props.JPGSubsampling = IJL_422;
props.JPGChannels = 3;
props.DIBColor = IJL_YCBCR; // My buffer is YUV 422
props.DIBSubsampling = IJL_422;
props.DIBChannels = 3;
You can find it useful to take a look on this old piece of code, in attachment, which still work:)

Regards,
Vladimir

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi