summaryrefslogtreecommitdiff
path: root/libavcodec/tiff.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-04-27 18:44:58 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-04-27 18:44:58 +0200
commit1ca21e1b767a3ec77b02eec903a14b6bc658a485 (patch)
tree8827cfb2115de9fb3d4a08b6845855e8a5b990b2 /libavcodec/tiff.c
parent4930e529bfd3c679af4e6602b94560d33e8c3915 (diff)
avcodec/tiff: parse subsample factors
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r--libavcodec/tiff.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 02d50077ab..10c053a8fa 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -55,6 +55,7 @@ typedef struct TiffContext {
enum TiffCompr compr;
enum TiffPhotometric photometric;
int planar;
+ int subsampling[2];
int fax_opts;
int predictor;
int fill_order;
@@ -804,6 +805,14 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
case TIFF_PLANAR:
s->planar = value == 2;
break;
+ case TIFF_YCBCR_SUBSAMPLING:
+ if (count != 2) {
+ av_log(s->avctx, AV_LOG_ERROR, "subsample count invalid\n");
+ return AVERROR_INVALIDDATA;
+ }
+ for (i = 0; i < count; i++)
+ s->subsampling[i] = ff_tget(&s->gb, type, s->le);
+ break;
case TIFF_T4OPTIONS:
if (s->compr == TIFF_G3)
s->fax_opts = value;
@@ -1136,6 +1145,8 @@ static av_cold int tiff_init(AVCodecContext *avctx)
s->width = 0;
s->height = 0;
+ s->subsampling[0] =
+ s->subsampling[1] = 1;
s->avctx = avctx;
ff_lzw_decode_open(&s->lzw);
ff_ccitt_unpack_init();