]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/ffv1dec: Support gray 10/12/16 explicitly avoid shifts
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 17 Nov 2016 22:21:37 +0000 (23:21 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 18 Nov 2016 17:04:28 +0000 (18:04 +0100)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/ffv1dec.c

index 0719e2822d8ad645d5942f78a8529bcd62563ca7..b5fb82510293e004f3f1135e996ad468b38c682f 100644 (file)
@@ -575,8 +575,19 @@ static int read_header(FFV1Context *f)
         if (!f->transparency && !f->chroma_planes) {
             if (f->avctx->bits_per_raw_sample <= 8)
                 f->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
-            else
+            else if (f->avctx->bits_per_raw_sample == 10) {
+                f->packed_at_lsb = 1;
+                f->avctx->pix_fmt = AV_PIX_FMT_GRAY10;
+            } else if (f->avctx->bits_per_raw_sample == 12) {
+                f->packed_at_lsb = 1;
+                f->avctx->pix_fmt = AV_PIX_FMT_GRAY12;
+            } else if (f->avctx->bits_per_raw_sample == 16) {
+                f->packed_at_lsb = 1;
+                f->avctx->pix_fmt = AV_PIX_FMT_GRAY16;
+            } else if (f->avctx->bits_per_raw_sample < 16) {
                 f->avctx->pix_fmt = AV_PIX_FMT_GRAY16;
+            } else
+                return AVERROR(ENOSYS);
         } else if (f->transparency && !f->chroma_planes) {
             if (f->avctx->bits_per_raw_sample <= 8)
                 f->avctx->pix_fmt = AV_PIX_FMT_YA8;