diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-08-16 23:06:02 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-08-16 23:06:02 +0200 |
commit | 62f5e601aa4d42cf17f5f4331a2b7e2b533d4e69 (patch) | |
tree | 98f50ea46a04e8c0f6f6861387b5a139bf5017f8 | |
parent | a95fdac4c6203037a4690a4f7960223c8daad73e (diff) | |
download | ffmpeg-62f5e601aa4d42cf17f5f4331a2b7e2b533d4e69.tar.gz |
avcodec/ffv1enc: Add RGB48 support
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/ffv1enc.c | 12 | ||||
-rw-r--r-- | libavcodec/ffv1enc_template.c | 6 |
2 files changed, 17 insertions, 1 deletions
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c index dc9c499c70..dae68aee63 100644 --- a/libavcodec/ffv1enc.c +++ b/libavcodec/ffv1enc.c @@ -624,6 +624,16 @@ FF_ENABLE_DEPRECATION_WARNINGS s->chroma_planes = 1; s->bits_per_raw_sample = 8; break; + case AV_PIX_FMT_RGB48: + s->colorspace = 1; + s->chroma_planes = 1; + s->bits_per_raw_sample = 16; + s->use32bit = 1; + if (avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { + av_log(avctx, AV_LOG_ERROR, "16bit RGB is experimental and under development, only use it for experiments\n"); + return AVERROR_INVALIDDATA; + } + break; case AV_PIX_FMT_0RGB32: s->colorspace = 1; s->chroma_planes = 1; @@ -1287,7 +1297,7 @@ AVCodec ff_ffv1_encoder = { 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_YA8, - AV_PIX_FMT_GBRP16, + AV_PIX_FMT_GBRP16, AV_PIX_FMT_RGB48, AV_PIX_FMT_NONE }, diff --git a/libavcodec/ffv1enc_template.c b/libavcodec/ffv1enc_template.c index 01aee4935b..b7eea0dd70 100644 --- a/libavcodec/ffv1enc_template.c +++ b/libavcodec/ffv1enc_template.c @@ -129,6 +129,7 @@ static int RENAME(encode_rgb_frame)(FFV1Context *s, const uint8_t *src[3], const int ring_size = s->context_model ? 3 : 2; TYPE *sample[4][3]; int lbd = s->bits_per_raw_sample <= 8; + int packed = !src[1]; int bits = s->bits_per_raw_sample > 0 ? s->bits_per_raw_sample : 8; int offset = 1 << bits; @@ -150,6 +151,11 @@ static int RENAME(encode_rgb_frame)(FFV1Context *s, const uint8_t *src[3], g = (v >> 8) & 0xFF; r = (v >> 16) & 0xFF; a = v >> 24; + } else if (packed) { + const uint16_t *p = ((const uint16_t*)(src[0] + x*6 + stride[0]*y)); + r = p[0]; + g = p[1]; + b = p[2]; } else if (sizeof(TYPE) == 4) { g = *((const uint16_t *)(src[0] + x*2 + stride[0]*y)); b = *((const uint16_t *)(src[1] + x*2 + stride[1]*y)); |