-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
esp_jpeg: Add support for default Huffman tables #439
Conversation
af7de02
to
ebd2c7e
Compare
@suda-morris @igrr PTAL or please help me find someone for review, thank you FYI @espzav |
Test Results15 files 15 suites 1m 19s ⏱️ Results for commit e793c31. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, left a few minor comments.
f8ba29a
to
97e7937
Compare
Thank you for the review @igrr ! I implemented your comments and also tested on esp-idf examples that use esp_jpeg |
97e7937
to
1c57fcc
Compare
Some JPEG images, typically frames from cameras, do not contain Huffman tables. This commit adds an option to use default Huffman tables defined in JPEG specification.
1c57fcc
to
e793c31
Compare
Summary:
This PR introduces an enhancement to the JPEG decoder in the ESP-IDF library to enable decoding of JPEG images that do not include Huffman tables. Specifically, this update enables decoding of non-standard JPEG frames, such as those produced by certain USB cameras (e.g., Logitech C270), which omit Huffman tables to save space and instead rely on predefined quantization and color subsampling settings. This PR adds robustness to the JPEG decoder by expanding support for such non-standard formats.
Key Changes
JPEG Decoder Update:
Modified the JPEG decoder to support images without Huffman tables, allowing the library to apply default Huffman tables when none are found in the input data.
This change is essential for handling image data from specific USB cameras that omit Huffman tables.
Double Block Size Support (16x8):
Added handling for double-block size in images (16x8 pixels), a structure unique to frames from certain USB cameras, which diverge from the more common 8x8 block size.
Improved parsing logic to ensure accurate decompression for such formats while maintaining compatibility with standard JPEG images.
Test Case Addition:
Created a new test case for JPEG decompression without Huffman tables to validate decoding accuracy and RGB888 output correctness.
The test compares decompressed image data to reference RGB888 arrays, allowing a color tolerance of ±16 for minor discrepancies, as certain decoding processes (e.g., Windows-based decoders) might use slight variations in default tables.
The test validates the decompressed image dimensions and color data to ensure it falls within acceptable margins of error.
Testing and Validation
Motivation and Context
Some USB cameras, such as the Logitech C270, output JPEG frames without Huffman tables, which standard JPEG decoders often cannot process. By introducing support for these cases, this PR enables ESP-IDF to handle a broader range of JPEG image formats, improving its utility in applications that interface with USB cameras or other devices producing such non-standard JPEG frames.