aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ffv1dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-12-10 03:14:41 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-12-10 03:16:58 +0100
commit0e575c24d62a3d9f51bca04d22c234e3857b86a9 (patch)
treed47e6926167d98c821f685ef2111d745044f66d6 /libavcodec/ffv1dec.c
parent2bdda9a15c048a63630eec4918510c5fec05e437 (diff)
downloadffmpeg-0e575c24d62a3d9f51bca04d22c234e3857b86a9.tar.gz
ffv1.4: use 2 coefficients for calculating the Y plane in the RCT
0-0.7% improved compression Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ffv1dec.c')
-rw-r--r--libavcodec/ffv1dec.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 6c01ebf15f..d7dd110545 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) * s->slice_rct_y_coef) >> 2;
+ g -= (b * s->slice_rct_by_coef + r * s->slice_rct_ry_coef) >> 2;
b += g;
r += g;
}
@@ -334,8 +334,9 @@ static int decode_slice_header(FFV1Context *f, FFV1Context *fs)
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) {
+ fs->slice_rct_by_coef = get_symbol(c, state, 0);
+ fs->slice_rct_ry_coef = get_symbol(c, state, 0);
+ if ((uint64_t)fs->slice_rct_by_coef + (uint64_t)fs->slice_rct_ry_coef > 4) {
av_log(f->avctx, AV_LOG_ERROR, "slice_rct_y_coef out of range\n");
return AVERROR_INVALIDDATA;
}
@@ -388,7 +389,8 @@ static int decode_slice(AVCodecContext *c, void *arg)
}
}
- fs->slice_rct_y_coef = 1;
+ fs->slice_rct_by_coef = 1;
+ fs->slice_rct_ry_coef = 1;
if (f->version > 2) {
if (ffv1_init_slice_state(f, fs) < 0)