2022.05.11 16:37 "[Tiff] YCbCr Planar subsampled format support", by Carl Eric Codere

2022.05.11 16:37 "[Tiff] YCbCr Planar subsampled format support", by Carl Eric Codere

Greetings,

I wanted to know if libtiff supports YCbCr subsampled planar images? Is it planned, i think it would be good to support it, I tried to use an older version of the library 3.6.1 and it seems it is not supported.

Rationale: A common issue when doing video encoding is that we need to prepare the images in the YCbCr color space. Encoding is usually in planar format, such as 4:2:2 or 4:2:0 or event 4:1:0 subsampled with different matrixes with studio or full range. I do not know of any image format that permits to support different subsampling, planar data, custom matrixes and subsampling position information and compression except for the TIFF format. Hence I have my image encoder when doing YCbCr image space encodes directly in planar format, not in packed format with full LZW and predictor information which requires less processing. Furthermore, when decoding images from movies, we can dump the images in a TIFF file, with one image per frame, this is what my tool does currently.

Today, I have not seen any public support by any tool for planar 4:2:0/4:1:0/4:2:2 TIFF compressed formats, maybe i am wrong, and you now support it?

My current image i have generated here from TIFFInfo:

TIFF Directory at offset 0x112cec (1125612)
   Image Width: 1392 Image Length: 968
   Resolution: 73, 73 pixels/inch
   Bits/Sample: 8
   Compression Scheme: LZW
   Photometric Interpretation: YCbCr
   YCbCr Subsampling: 2, 2
   Samples/Pixel: 3
   Rows/Strip: 968
   Planar Configuration: separate image planes
   DateTime: 2022:05:04 00:11:44
   YCbCrCoefficients: 0.299000,0.587000,0.114000
   Reference Black/White:
      0: 0 255
      1: 128 255
      2: 128 255
   Predictor: horizontal differencing 2 (0x2)