X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fffv1dec.c;h=31433e3782fc7c9ba52f54af4f33113f7eaa3401;hb=4fcdc9f3597289942de993f86caaf1d1b17057d9;hp=d8f35c34b99e379f3cc3731379abbc20a926d39a;hpb=bbd0ebfd835761d1abbe030a8a7866d88b2a8777;p=ffmpeg diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index d8f35c34b99..31433e3782f 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -142,7 +142,7 @@ static void decode_plane(FFV1Context *s, uint8_t *src, } } else { for (x = 0; x < w; x++) { - ((uint16_t*)(src + stride*y))[x*pixel_stride] = sample[1][x] << (16 - s->avctx->bits_per_raw_sample); + ((uint16_t*)(src + stride*y))[x*pixel_stride] = sample[1][x] << (16 - s->avctx->bits_per_raw_sample) | ((uint16_t **)sample)[1][x] >> (2 * s->avctx->bits_per_raw_sample - 16); } } } @@ -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; @@ -625,13 +636,22 @@ static int read_header(FFV1Context *f) case 0x10: f->avctx->pix_fmt = AV_PIX_FMT_YUVA422P10; break; case 0x11: f->avctx->pix_fmt = AV_PIX_FMT_YUVA420P10; break; } + } else if (f->avctx->bits_per_raw_sample == 12 && !f->transparency) { + f->packed_at_lsb = 1; + switch(16 * f->chroma_h_shift + f->chroma_v_shift) { + case 0x00: f->avctx->pix_fmt = AV_PIX_FMT_YUV444P12; break; + case 0x10: f->avctx->pix_fmt = AV_PIX_FMT_YUV422P12; break; + case 0x11: f->avctx->pix_fmt = AV_PIX_FMT_YUV420P12; break; + } } else if (f->avctx->bits_per_raw_sample == 16 && !f->transparency){ + f->packed_at_lsb = 1; switch(16 * f->chroma_h_shift + f->chroma_v_shift) { case 0x00: f->avctx->pix_fmt = AV_PIX_FMT_YUV444P16; break; case 0x10: f->avctx->pix_fmt = AV_PIX_FMT_YUV422P16; break; case 0x11: f->avctx->pix_fmt = AV_PIX_FMT_YUV420P16; break; } } else if (f->avctx->bits_per_raw_sample == 16 && f->transparency){ + f->packed_at_lsb = 1; switch(16 * f->chroma_h_shift + f->chroma_v_shift) { case 0x00: f->avctx->pix_fmt = AV_PIX_FMT_YUVA444P16; break; case 0x10: f->avctx->pix_fmt = AV_PIX_FMT_YUVA422P16; break;