diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2014-04-06 02:42:31 +0200 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2014-04-06 02:42:31 +0200 |
commit | 59c1023ef544c215e5d4c6c0276f04230beb6fd8 (patch) | |
tree | 2b4c492474badd9bac09df4f0303cd9f1af8f9f2 /libavcodec/tiffenc.c | |
parent | b978391ed5fdbf361a03010db1a9f31a8b802985 (diff) | |
download | ffmpeg-59c1023ef544c215e5d4c6c0276f04230beb6fd8.tar.gz |
Consider aspect ratio when writing tiff dpi.
TIFFTAG_YRESOLUTION gets now adjusted to sample_aspect_ratio.
Diffstat (limited to 'libavcodec/tiffenc.c')
-rw-r--r-- | libavcodec/tiffenc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c index 7b1e5104bd..67229a93b1 100644 --- a/libavcodec/tiffenc.c +++ b/libavcodec/tiffenc.c @@ -436,6 +436,13 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, add_entry1(s, TIFF_ROWSPERSTRIP, TIFF_LONG, s->rps); add_entry(s, TIFF_STRIP_SIZE, TIFF_LONG, strips, s->strip_sizes); add_entry(s, TIFF_XRES, TIFF_RATIONAL, 1, res); + if (avctx->sample_aspect_ratio.num > 0 && + avctx->sample_aspect_ratio.den > 0) { + AVRational y = av_mul_q(av_make_q(s->dpi, 1), + avctx->sample_aspect_ratio); + res[0] = y.num; + res[1] = y.den; + } add_entry(s, TIFF_YRES, TIFF_RATIONAL, 1, res); add_entry1(s, TIFF_RES_UNIT, TIFF_SHORT, 2); |