[FFmpeg-devel] [PATCH]Support encoding AVCHROMA_LOC_TOPLEFT in tiff

Carl Eugen Hoyos cehoyos at ag.or.at
Sun Nov 4 17:18:56 CET 2012


Hi!

The way I understand the tiff specification, it only supports 
AVCHROMA_LOC_CENTER (default) and AVCHROMA_LOC_TOPLEFT, so write 
AVCHROMA_LOC_TOPLEFT if it was defined by the application.

Please review, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index dae9147..d440285 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -471,6 +471,8 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt,
         /** according to CCIR Recommendation 601.1 */
         uint32_t refbw[12] = {15, 1, 235, 1, 128, 1, 240, 1, 128, 1, 240, 1};
         add_entry(s, TIFF_YCBCR_SUBSAMPLING, TIFF_SHORT,    2, s->subsampling);
+        if (avctx->chroma_sample_location == AVCHROMA_LOC_TOPLEFT)
+            add_entry1(s, TIFF_YCBCR_POSITIONING, TIFF_SHORT, 2);
         add_entry(s, TIFF_REFERENCE_BW,      TIFF_RATIONAL, 6, refbw);
     }
     bytestream_put_le32(&offset, ptr - pkt->data);    // write offset to dir


More information about the ffmpeg-devel mailing list