Commit 62f5e601 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/ffv1enc: Add RGB48 support

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent a95fdac4
...@@ -624,6 +624,16 @@ FF_ENABLE_DEPRECATION_WARNINGS ...@@ -624,6 +624,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
s->chroma_planes = 1; s->chroma_planes = 1;
s->bits_per_raw_sample = 8; s->bits_per_raw_sample = 8;
break; 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: case AV_PIX_FMT_0RGB32:
s->colorspace = 1; s->colorspace = 1;
s->chroma_planes = 1; s->chroma_planes = 1;
...@@ -1287,7 +1297,7 @@ AVCodec ff_ffv1_encoder = { ...@@ -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_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_YA8, AV_PIX_FMT_YA8,
AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRP16, AV_PIX_FMT_RGB48,
AV_PIX_FMT_NONE AV_PIX_FMT_NONE
}, },
......
...@@ -129,6 +129,7 @@ static int RENAME(encode_rgb_frame)(FFV1Context *s, const uint8_t *src[3], ...@@ -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; const int ring_size = s->context_model ? 3 : 2;
TYPE *sample[4][3]; TYPE *sample[4][3];
int lbd = s->bits_per_raw_sample <= 8; 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 bits = s->bits_per_raw_sample > 0 ? s->bits_per_raw_sample : 8;
int offset = 1 << bits; int offset = 1 << bits;
...@@ -150,6 +151,11 @@ static int RENAME(encode_rgb_frame)(FFV1Context *s, const uint8_t *src[3], ...@@ -150,6 +151,11 @@ static int RENAME(encode_rgb_frame)(FFV1Context *s, const uint8_t *src[3],
g = (v >> 8) & 0xFF; g = (v >> 8) & 0xFF;
r = (v >> 16) & 0xFF; r = (v >> 16) & 0xFF;
a = v >> 24; 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) { } else if (sizeof(TYPE) == 4) {
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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment