summaryrefslogtreecommitdiff
path: root/libavcodec/ffv1enc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-08-08 00:00:46 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-08-08 00:32:09 +0200
commitce2217b25eccda9f5c14022bd69792e71b417b73 (patch)
tree7ea358b77eb60739b9ec153bcc74b0408e8ab575 /libavcodec/ffv1enc.c
parent74314f1f5f9ef69700eb18b85a8260e2754a31ef (diff)
avcodec/ffv1: add AV_PIX_FMT_GBRP16 support
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/ffv1enc.c')
-rw-r--r--libavcodec/ffv1enc.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 552f653846..d4f0577ab9 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -274,6 +274,9 @@ static inline void put_vlc_symbol(PutBitContext *pb, VlcState *const state,
#undef TYPE
#undef RENAME
+#define TYPE int32_t
+#define RENAME(name) name ## 32
+#include "ffv1enc_template.c"
static int encode_plane(FFV1Context *s, uint8_t *src, int w, int h,
int stride, int plane_index, int pixel_stride)
@@ -643,10 +646,20 @@ FF_ENABLE_DEPRECATION_WARNINGS
case AV_PIX_FMT_GBRP14:
if (!avctx->bits_per_raw_sample && !s->bits_per_raw_sample)
s->bits_per_raw_sample = 14;
+ case AV_PIX_FMT_GBRP16:
+ if (!avctx->bits_per_raw_sample && !s->bits_per_raw_sample)
+ s->bits_per_raw_sample = 16;
else if (!s->bits_per_raw_sample)
s->bits_per_raw_sample = avctx->bits_per_raw_sample;
s->colorspace = 1;
s->chroma_planes = 1;
+ if (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;
+ }
+ }
s->version = FFMAX(s->version, 1);
if (s->ac == AC_GOLOMB_RICE) {
av_log(avctx, AV_LOG_INFO,
@@ -1040,6 +1053,8 @@ retry:
} else if (c->pix_fmt == AV_PIX_FMT_YA8) {
ret = encode_plane(fs, p->data[0] + ps*x + y*p->linesize[0], width, height, p->linesize[0], 0, 2);
ret |= encode_plane(fs, p->data[0] + 1 + ps*x + y*p->linesize[0], width, height, p->linesize[0], 1, 2);
+ } else if (f->use32bit) {
+ ret = encode_rgb_frame32(fs, planes, width, height, p->linesize);
} else {
ret = encode_rgb_frame(fs, planes, width, height, p->linesize);
}
@@ -1071,7 +1086,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
uint8_t *buf_p;
int i, ret;
int64_t maxsize = AV_INPUT_BUFFER_MIN_SIZE
- + avctx->width*avctx->height*35LL*4;
+ + avctx->width*avctx->height*37LL*4;
if(!pict) {
if (avctx->flags & AV_CODEC_FLAG_PASS1) {
@@ -1275,6 +1290,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_NONE
},