User defined output function to write decompressed pixels to the output device.
int out_func ( JDEC* jdec, /* Pointer to the decompression object */ void* bitmap, /* Bitmap to be output */ JRECT* rect /* Rectangular region to output */ );
Normally returns 1. It lets TJpgDec to continue the decompressing process. If a 0 is returned, jd_decomp function aborts with JDR_INTR. This is useful to interrupt the decompression process.
This function is the data output interface of the TJpgDec module. The corresponding decompression session can be identified by the session identifier jdec->device passed to the 5th argument of jd_prepare function.
The bitmap is sent to the frame buffer or display device in this function. The first pixel in the bitmap is the left-top of the rectangular, the second one is next right and last pixel is the bottom-right of the rectangular. Because the JPEG image is compressed and stored in unit of MCU, Minimum Coded Unit, TJpgDec outputs the image rectangular every decompression of MCU. The size of MCU depends on the sampling factor of JPEG compression, typically 8x8, 16x8 or 16x16, but the rectangulars on right or bottom end of the image will be clipped.
The output pixel format is defined by JD_FORMAT option in the tjpgdcnf.h as shown below.
JD_FORMAT | Pixel Format |
---|---|
0 (RGB888) | uint8_t bitmap[] = {R1, G1, B1, R2, G2, B2, .... |
1 (RGB565) | uint16_t bitmap[] = {rrrrrggggggbbbbb, .... |
2 (Grayscale) | uint8_t bitmap[] = {Y1, Y2, Y3, .... |