Conversation
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughAdds CMYK handling to JPEG decompression: after reading the JPEG header the code detects color space, sets output to CMYK for CMYK/YCCK or RGB otherwise, accepts 3 or 4 components, and implements a 4-component CMYK->RGB per-pixel conversion while keeping the existing 3-component RGB path. Changes
Sequence Diagram(s)sequenceDiagram
participant JPEG_Header as JPEG Header Reader
participant Decompress as Decompressor
participant Bitmap as Destination Bitmap
JPEG_Header->>Decompress: read_header()
Decompress->>Decompress: detect_color_space (RGB / CMYK/YCCK)
alt CMYK (4 components)
Decompress->>Decompress: allocate 4-byte row buffer
Decompress->>Decompress: read_scanline_4c()
Decompress->>Decompress: convert_CMYK_to_RGB_per_pixel()
Decompress->>Bitmap: write_RGB_row()
else RGB (3 components)
Decompress->>Decompress: read_scanline_3c()
Decompress->>Bitmap: write_RGB_row()
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@addons/image/jpg.c`:
- Line 256: The allocation for data->row using al_malloc(w * 4) lacks a NULL
check; after the call to al_malloc (where data->row is assigned) add a check if
data->row == NULL and handle the failure by performing appropriate cleanup (free
any previously allocated resources), log or propagate an error, and return an
error code or goto the existing error/cleanup label so the subsequent writes to
data->row (currently at the code that writes data->row[x * 4 + ...]) cannot
dereference a NULL pointer.
|
Thanks! This looks pretty good, I'll double check it later and we can merge it. |
Addresses #1720 by adding color space conversion for CMYK/YCCK. Also, add automatic color space conversion for other color spaces through libjpeg. Added a CMYK conversion of the Alex logo for testing.
Summary by CodeRabbit