2005.03.23 14:08 "RE: [Tiff] tif_jpeg.c and 12bit JPEG Files", by Jeff Mather
First question: why are you supporting 12 bit JPEG?
We have yet to see a 12 bit JPEG file "in the wild", and will not be supporting it in Photoshop.
We had numerous requests for supporting 12-bit JPEG in MATLAB. They were always in the context of DICOM medical image files, which allow 8-, 12-, and 16-bit JPEG compression (though I can't remember if I ever saw 16-bit images). Often these same 12-bit images were losslessly encoded as well. I have a modest collection of these 12-bit lossless JPEG images embedded in DICOM files and am pretty confident in saying that there are a decent number of them out there.
It was a while ago that we added support for these exotic JPEGs based on forked code bases and patches that I found on David Clunie's site (http://www.dclunie.com/), which also has some sample images. I've forgotten most of the minutiae, but I remember that it was much more complex than it should have been because of how function names were redefined to allow for multiple bit depths.
We now ship files that link against three different patched versions of the IJG library to support the three different bit depths in lossy and lossless modes. I would love to see an official version of the JPEG library that supports at least 8- and 12-bit lossy and lossless in the same library.
Image Processing Group
The MathWorks, Inc.