diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-12-08 22:09:50 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-12-09 00:37:38 +0100 |
commit | 7854d2d2515dc2a54c5f309100aeecf83cd14e97 (patch) | |
tree | 5c5b403b90264c20b117e321e9cbaf390b263f3b /libavcodec/ffv1dec.c | |
parent | 1b264607883e7d52a3941cd9c192e3045096acc9 (diff) | |
download | ffmpeg-7854d2d2515dc2a54c5f309100aeecf83cd14e97.tar.gz |
avcodec/ffv1: support adjusting the g vs r + b coefficient in the RCT
about 1% better compression
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ffv1dec.c')
-rw-r--r-- | libavcodec/ffv1dec.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index 166bc259f0..6c01ebf15f 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -260,7 +260,7 @@ static void decode_rgb_frame(FFV1Context *s, uint8_t *src[3], int w, int h, int if (s->slice_coding_mode != 1) { b -= offset; r -= offset; - g -= (b + r) >> 2; + g -= ((b + r) * s->slice_rct_y_coef) >> 2; b += g; r += g; } @@ -333,6 +333,13 @@ static int decode_slice_header(FFV1Context *f, FFV1Context *fs) if (fs->version > 3) { fs->slice_reset_contexts = get_rac(c, state); fs->slice_coding_mode = get_symbol(c, state, 0); + if (fs->slice_coding_mode != 1) { + fs->slice_rct_y_coef = get_symbol(c, state, 0); + if (fs->slice_rct_y_coef > 2U) { + av_log(f->avctx, AV_LOG_ERROR, "slice_rct_y_coef out of range\n"); + return AVERROR_INVALIDDATA; + } + } } return 0; } @@ -381,6 +388,8 @@ static int decode_slice(AVCodecContext *c, void *arg) } } + fs->slice_rct_y_coef = 1; + if (f->version > 2) { if (ffv1_init_slice_state(f, fs) < 0) return AVERROR(ENOMEM); |