Consider aspect ratio when writing tiff dpi.

TIFFTAG_YRESOLUTION gets now adjusted to sample_aspect_ratio.
This commit is contained in:
Carl Eugen Hoyos 2014-04-06 02:42:31 +02:00
parent b978391ed5
commit 59c1023ef5
2 changed files with 8 additions and 1 deletions

View File

@ -436,6 +436,13 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
add_entry1(s, TIFF_ROWSPERSTRIP, TIFF_LONG, s->rps); 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_STRIP_SIZE, TIFF_LONG, strips, s->strip_sizes);
add_entry(s, TIFF_XRES, TIFF_RATIONAL, 1, res); 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_entry(s, TIFF_YRES, TIFF_RATIONAL, 1, res);
add_entry1(s, TIFF_RES_UNIT, TIFF_SHORT, 2); add_entry1(s, TIFF_RES_UNIT, TIFF_SHORT, 2);

View File

@ -30,7 +30,7 @@
#define LIBAVCODEC_VERSION_MAJOR 55 #define LIBAVCODEC_VERSION_MAJOR 55
#define LIBAVCODEC_VERSION_MINOR 57 #define LIBAVCODEC_VERSION_MINOR 57
#define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \ LIBAVCODEC_VERSION_MINOR, \