2003.11.17 20:04 "[Tiff] TIFF JPEG and Upsampling", by Antonio Scuri
I�m using LibTIFF 3.6.0 - tif_jpeg.c,v 1.15, in Visual C++ 7.0 (.NET). If I set JPEGCOLORMODE_RGB it works fine.
Since I do not want to auto convert to RGB, and I want an upsampled YCbCr data, I look at the function JPEGPreDecode in line 745 of "tif_jpeg.c" and noticed that what I want is not possible if the original data is downsampled with "sp->xxx_sampling != 1", it will assume that I want a downsampled output.
So I just comment lines 743-745 to avoid the "downsampled_output = TRUE;", and the decoding works fine because it changed the initialization of the decoder functions and libJPEG is upsampling the data for JPEGDecode.
In the today logic it seems that I can not have upsampled output for a downsampled data if not using JPEGCOLORMODE_RGB. Is that true? Did I miss something?
I noticed some "XXX" comments about upsampling in the code. Can a pseudo tag control upsampling? It could make the upsampling/downsampling logic easier.