avcodec/ffv1: Support for GBRAP10 and GBRAP12

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
pull/279/head
Jérôme Martinez 7 years ago committed by Michael Niedermayer
parent aa6280805e
commit fb580731c1
  1. 4
      libavcodec/ffv1dec.c
  2. 4
      libavcodec/ffv1dec_template.c
  3. 3
      libavcodec/ffv1enc.c
  4. 2
      libavcodec/ffv1enc_template.c

@ -688,8 +688,12 @@ static int read_header(FFV1Context *f)
f->avctx->pix_fmt = AV_PIX_FMT_GBRP9; f->avctx->pix_fmt = AV_PIX_FMT_GBRP9;
else if (f->avctx->bits_per_raw_sample == 10 && !f->transparency) else if (f->avctx->bits_per_raw_sample == 10 && !f->transparency)
f->avctx->pix_fmt = AV_PIX_FMT_GBRP10; f->avctx->pix_fmt = AV_PIX_FMT_GBRP10;
else if (f->avctx->bits_per_raw_sample == 10 && f->transparency)
f->avctx->pix_fmt = AV_PIX_FMT_GBRAP10;
else if (f->avctx->bits_per_raw_sample == 12 && !f->transparency) else if (f->avctx->bits_per_raw_sample == 12 && !f->transparency)
f->avctx->pix_fmt = AV_PIX_FMT_GBRP12; f->avctx->pix_fmt = AV_PIX_FMT_GBRP12;
else if (f->avctx->bits_per_raw_sample == 12 && f->transparency)
f->avctx->pix_fmt = AV_PIX_FMT_GBRAP12;
else if (f->avctx->bits_per_raw_sample == 14 && !f->transparency) else if (f->avctx->bits_per_raw_sample == 14 && !f->transparency)
f->avctx->pix_fmt = AV_PIX_FMT_GBRP14; f->avctx->pix_fmt = AV_PIX_FMT_GBRP14;
else if (f->avctx->bits_per_raw_sample == 16 && !f->transparency) { else if (f->avctx->bits_per_raw_sample == 16 && !f->transparency) {

@ -155,7 +155,7 @@ static void RENAME(decode_rgb_frame)(FFV1Context *s, uint8_t *src[4], int w, int
if (lbd) if (lbd)
*((uint32_t*)(src[0] + x*4 + stride[0]*y)) = b + ((unsigned)g<<8) + ((unsigned)r<<16) + ((unsigned)a<<24); *((uint32_t*)(src[0] + x*4 + stride[0]*y)) = b + ((unsigned)g<<8) + ((unsigned)r<<16) + ((unsigned)a<<24);
else if (sizeof(TYPE) == 4) { else if (sizeof(TYPE) == 4 || transparency) {
*((uint16_t*)(src[0] + x*2 + stride[0]*y)) = g; *((uint16_t*)(src[0] + x*2 + stride[0]*y)) = g;
*((uint16_t*)(src[1] + x*2 + stride[1]*y)) = b; *((uint16_t*)(src[1] + x*2 + stride[1]*y)) = b;
*((uint16_t*)(src[2] + x*2 + stride[2]*y)) = r; *((uint16_t*)(src[2] + x*2 + stride[2]*y)) = r;
@ -165,8 +165,6 @@ static void RENAME(decode_rgb_frame)(FFV1Context *s, uint8_t *src[4], int w, int
*((uint16_t*)(src[0] + x*2 + stride[0]*y)) = b; *((uint16_t*)(src[0] + x*2 + stride[0]*y)) = b;
*((uint16_t*)(src[1] + x*2 + stride[1]*y)) = g; *((uint16_t*)(src[1] + x*2 + stride[1]*y)) = g;
*((uint16_t*)(src[2] + x*2 + stride[2]*y)) = r; *((uint16_t*)(src[2] + x*2 + stride[2]*y)) = r;
if (transparency)
*((uint16_t*)(src[3] + x*2 + stride[3]*y)) = a;
} }
} }
} }

@ -648,9 +648,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (!avctx->bits_per_raw_sample) if (!avctx->bits_per_raw_sample)
s->bits_per_raw_sample = 9; s->bits_per_raw_sample = 9;
case AV_PIX_FMT_GBRP10: case AV_PIX_FMT_GBRP10:
case AV_PIX_FMT_GBRAP10:
if (!avctx->bits_per_raw_sample && !s->bits_per_raw_sample) if (!avctx->bits_per_raw_sample && !s->bits_per_raw_sample)
s->bits_per_raw_sample = 10; s->bits_per_raw_sample = 10;
case AV_PIX_FMT_GBRP12: case AV_PIX_FMT_GBRP12:
case AV_PIX_FMT_GBRAP12:
if (!avctx->bits_per_raw_sample && !s->bits_per_raw_sample) if (!avctx->bits_per_raw_sample && !s->bits_per_raw_sample)
s->bits_per_raw_sample = 12; s->bits_per_raw_sample = 12;
case AV_PIX_FMT_GBRP14: case AV_PIX_FMT_GBRP14:
@ -1326,6 +1328,7 @@ AVCodec ff_ffv1_encoder = {
AV_PIX_FMT_YUVA444P9, AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA444P9, AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA420P9,
AV_PIX_FMT_GRAY16, AV_PIX_FMT_GRAY8, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GRAY16, AV_PIX_FMT_GRAY8, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10,
AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14,
AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12,
AV_PIX_FMT_YA8, AV_PIX_FMT_YA8,
AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12,
AV_PIX_FMT_GBRP16, AV_PIX_FMT_RGB48, AV_PIX_FMT_GBRP16, AV_PIX_FMT_RGB48,

@ -160,7 +160,7 @@ static int RENAME(encode_rgb_frame)(FFV1Context *s, const uint8_t *src[4],
b = p[2]; b = p[2];
if (transparency) if (transparency)
a = p[3]; a = p[3];
} else if (sizeof(TYPE) == 4) { } else if (sizeof(TYPE) == 4 || transparency) {
g = *((const uint16_t *)(src[0] + x*2 + stride[0]*y)); g = *((const uint16_t *)(src[0] + x*2 + stride[0]*y));
b = *((const uint16_t *)(src[1] + x*2 + stride[1]*y)); b = *((const uint16_t *)(src[1] + x*2 + stride[1]*y));
r = *((const uint16_t *)(src[2] + x*2 + stride[2]*y)); r = *((const uint16_t *)(src[2] + x*2 + stride[2]*y));

Loading…
Cancel
Save