As the title states: Both the jpeg_compress_struct
and the jpeg_decompress_struct
in libjpeg have a field defined like this:
boolean CCIR601_sampling; /* TRUE=first samples are cosited */
I am having a hard time figuring out what this means, or how it's supposed to be used. If you try to set this flag to true
, either for compression or decompression, libjpeg will simply trigger a fatal error with this message:
JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet")
The "yet" is amusing because it's been this way for 20+ years now, at least back to libjpeg62.
So, what is CCIR601_sampling supposed to do? Is it meant as a user-settable parameter for compression, decompression, or both? Is it stored as part of the file format? And why has it never actually been implemented?
I have asked the
libjpeg-turbo
maintainer about this on the mailing list (https://groups.google.com/g/libjpeg-turbo-users/c/Aeacg_cq5ms). Here is part of the response:In conclusion:
CCIR601_sampling
was intended as a user-settable parameter to JPEG compression, which would have produced a JPEG file containing "co-sited" CbCr components (both components stored packed together as one "component", instead of remaining two separate Cb and Cr planes). On decompression,jpeg_read_header()
should set the field in the structure to indicate that this JPEG is CCIR601 formatted (it is not a user-settable decompression parameter, rather an indicator)Of course
libjpeg
did not support this mode, thus no JPEGs exist that use it, so there is no need to support this mode.