-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add JPEG‑XL Support to libcupsfilters (WoC 4.0 Contribution) #82
base: master
Are you sure you want to change the base?
Add JPEG‑XL Support to libcupsfilters (WoC 4.0 Contribution) #82
Conversation
Added an inclusion of your new header for JPEG‑XL support.
In the block that checks the header for PNG, JPEG, and TIFF, added a new branch for JPEG‑XL. We add an #ifdef HAVE_LIBJXL branch that calls _cfImageReadJPEGXL() if is_jpegxl() returns true. Now, whether the user is converting to PDF (via imagetopdf.c) or to Raster (via imagetoraster.c), they call cfImageOpen() (and thus cfImageOpenFP()) which now supports JPEG‑XL.
Created a header file for your JPEG‑XL functions.
Implemented the JPEG‑XL–specific functions. In this the extra parameters (primary, secondary, saturation, hue, lut) are passed but not used because the JPEG‑XL decoder (via libjxl) handles the uncompression and preserves full quality.
Implementation for cfImageCreateFromJxlDecoder(). This function uses the libjxl API to extract the frame header, compute the required output buffer size (requesting 16‑bit output for full quality), allocate memory for the decoded pixels, and then fill in a cf_image_t structure with the image properties.
Reverted the changes made earlier in the file.
Reverted all the changes made earlier.
Updated file to handle the errors encountered while make.
Made changes to handle errors during make
Updated file to handle errors encountered while make
Also do not use |
cupsfilters/image-jpeg-xl.c
Outdated
@@ -28,12 +27,14 @@ is_jpegxl(const unsigned char *header, size_t len) | |||
} | |||
|
|||
/* | |||
* cf_image_create_from_jxl_decoder() - Create a cf_image_t from a libjxl decoder. | |||
* cfImageCreateFromJxlDecoder() - Create a cf_image_t from a libjxl decoder. |
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.
Why are you changing the name in the comment?
The scheme for the name, underscore-separated lowercase is correct, as the function is static.
@@ -38,12 +38,17 @@ | |||
|
|||
|
|||
#include "image-private.h" | |||
|
|||
|
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.
Now we have too many 2-line spacings. Do only 2-line spacings
- Between the implementations of 2 functions
- Once between header comment and first
#include
, between#include
s and macro definitions, between macro definitions and data types, between data types and functions - Do not do 2-line spacings withing functions or withing data types
Especially do not change the wihitespace in files which were already there before your PR.
|
||
// Process input until full image is decoded. | ||
/* Process input until full image is decoded. */ |
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.
For comments please use // ...
and not /* ... */
to align with the other files of libcupsfilters (and with OpenPrinting's code style).
Please check the file
In short:
|
@@ -1,4 +1,6 @@ | |||
ACLOCAL_AMFLAGS = -I m4 | |||
AM_CPPFLAGS = $(shell pkg-config --cflags libjxl) | |||
|
|||
|
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.
Please remove this. All needed variables are set in configure.ac
. Do not call pkg-config
in Makefile.am
.
* JPEG‑XL stream signature. | ||
*/ | ||
static int | ||
_cf_is_jpegxl(const unsigned char *header, size_t len) |
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.
This function is used in the file image.c
, therefore do not declare it as static
and also name it to _cfIsJPEGXL()
.
Please always test-build when doing any code changes!
What is now missing is:
Please always test-build after each code change!! |
Add JPEG‑XL Support to libcupsfilters
This pull request adds initial support for the JPEG‑XL image format to libcupsfilters. With these changes, cups‑filters can now detect, decode, and convert JPEG‑XL files into PDF and raster formats, thereby enabling printing via CUPS.
Overview
JPEG‑XL Detection
is_jpegxl()
inimage-jpeg-xl.c
. Checks for both standard JPEG‑XL signature (\x00\x00\x00\x0C\x4A\x58\x4C\x20
) and the JPEG‑XL stream signature (\xFF\x0A
).Decoding Implementation
_cfImageReadJPEGXL()
_cfImageOpenJPEGXL()
cf_image_create_from_jxl_decoder()
JxlPixelFormat
requesting 16‑bit per channel output.fprintf(stderr, ...)
to log file size, status codes, and key variable values for debugging.Build System Updates
pkg-config
to link against libjxl.Testing and Verification
djxl
tool and by testing conversions through cups‑filters.rasterview
to ensure correct color depth and page dimensions.Future Work
Background
This contribution was developed as part of the WoC 4.0 event organized by IIIT Kalyani. I have enjoyed working on integrating JPEG‑XL support into cups‑filters and am eager to continue contributing to this project even after the event concludes.
GitHub Repository: https://github.com/TitikshaBansal/libcupsfilters
Branch:
features/jpegxl-support
Thank you for reviewing my contribution. I look forward to your feedback and further improvements.
Best regards,
Titiksha Bansal