bitbank2 / JPEGDEC

An optimized JPEG decoder suitable for microcontrollers and PCs.
Apache License 2.0
389 stars 46 forks source link

What max resolution jpeg support? #36

Closed ChinaTizenRT closed 2 years ago

ChinaTizenRT commented 2 years ago

when i decoding 3840_2160 jpeg it will Segmentation fault

./jpegdec 3840_2160.jpg

JPEG decoder demo Run without parameters to test in-memory decoding Or pass a filename

Segmentation fault (core dumped)

bitbank2 commented 2 years ago

There is no size limit, but there are many ways you can make it crash. Are you checking all return codes? Are you using a callback function for the file I/O? Please provide a glimpse of the code you're using and I can probably tell you what's going wrong. It would help if you provided more info about where the crash is occurring. Since you're obviously running on a Linux system, use GDB to show you the function name / line of code where the segmentation fault happens.

ChinaTizenRT commented 2 years ago

@bitbank2 thanks for your replay. I am using the original code in the JPEGDEC/linux, and running in ubuntu system

cd JPEGDEC/linux sudo make /jpegdec 3840_2160.jpg

and add -g debug build info for debug crash, below is the key output

Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7e2ced8 in fread () at iofread.c:37 37 iofread.c: No such file or directory. (gdb)

bitbank2 commented 2 years ago

Found the problem - I changed the demo app to generate 4-bpp dithered output without allocating a buffer for it. Remove this line --> "jpg.ucPixelType = FOUR_BIT_DITHERED;" and it will work correctly.

ChinaTizenRT commented 2 years ago

thanks, I tested it works as your said.