jpegdec_debug.zip
I use JPEGDEC to decode the jpeg file on a large 7 color e-ink screen(800x480), but I cannot show the whole and get a JPEG_DECODE_ERROR.
I try to add some debug code, and find the JPEGDecodeMCU function throw an error in the area of the code below.
// get the DC component
pucFast = &pJPEG->ucHuffDC[pJPEG->ucDCTable * DC_TABLE_SIZE];
ulCode = (ulBits >> (REGISTER_WIDTH - 12 - ulBitOff)) & 0xfff; // get as lower 12 bits
if (ulCode >= 0xf80) // it's a long code
ulCode = (ulCode & 0xff); // point to long table and trim to 7-bits + 0x80 offset into long table
else
ulCode >>= 6; // it's a short code, use first 6 bits only
ucHuff = pucFast[ulCode];
cCoeff = (signed char)pucFast[ulCode+512]; // get pre-calculated extra bits for "small" values
if (ucHuff == 0) {// invalid code
Serial.println("invalid code1");//【Where the error occurred】
return -1;
}
The same code works well with the 2.9 inch black and white epaper.The difference of the bw and 7 color screen maybe the display buffer(800x480 use more ram).Esp32 and rp2040 get the same result.
I try to use another lib, TJpg_Decoder, which can decode without error on my 7 clolor screen.
The same code works well with the 2.9 inch black and white epaper.The difference of the bw and 7 color screen maybe the display buffer(800x480 use more ram).Esp32 and rp2040 get the same result. I try to use another lib, TJpg_Decoder, which can decode without error on my 7 clolor screen.