[FFmpeg-devel] [PATCH 3/4] avcodec/ffv1enc: Fix >8bit context size
Michael Niedermayer
michael at niedermayer.cc
Wed Sep 25 01:24:10 EEST 2024
Fixes: Ticket5405
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/ffv1enc.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 1c37f61adaf..a6f405289eb 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -724,19 +724,21 @@ static av_cold int encode_init(AVCodecContext *avctx)
s->quant_tables[1][2][i]= 11*11*quant5 [i];
s->quant_tables[1][3][i]= 5*11*11*quant5 [i];
s->quant_tables[1][4][i]= 5*5*11*11*quant5 [i];
+ s->context_count[0] = (11 * 11 * 11 + 1) / 2;
+ s->context_count[1] = (11 * 11 * 5 * 5 * 5 + 1) / 2;
} else {
s->quant_tables[0][0][i]= quant9_10bit[i];
- s->quant_tables[0][1][i]= 11*quant9_10bit[i];
- s->quant_tables[0][2][i]= 11*11*quant9_10bit[i];
+ s->quant_tables[0][1][i]= 9*quant9_10bit[i];
+ s->quant_tables[0][2][i]= 9*9*quant9_10bit[i];
s->quant_tables[1][0][i]= quant9_10bit[i];
- s->quant_tables[1][1][i]= 11*quant9_10bit[i];
- s->quant_tables[1][2][i]= 11*11*quant5_10bit[i];
- s->quant_tables[1][3][i]= 5*11*11*quant5_10bit[i];
- s->quant_tables[1][4][i]= 5*5*11*11*quant5_10bit[i];
+ s->quant_tables[1][1][i]= 9*quant9_10bit[i];
+ s->quant_tables[1][2][i]= 9*9*quant5_10bit[i];
+ s->quant_tables[1][3][i]= 5*9*9*quant5_10bit[i];
+ s->quant_tables[1][4][i]= 5*5*9*9*quant5_10bit[i];
+ s->context_count[0] = (9 * 9 * 9 + 1) / 2;
+ s->context_count[1] = (9 * 9 * 5 * 5 * 5 + 1) / 2;
}
}
- s->context_count[0] = (11 * 11 * 11 + 1) / 2;
- s->context_count[1] = (11 * 11 * 5 * 5 * 5 + 1) / 2;
if ((ret = ff_ffv1_allocate_initial_states(s)) < 0)
return ret;
--
2.46.1
More information about the ffmpeg-devel
mailing list