[FFmpeg-cvslog] avcodec/ffv1enc: remap table size is 1<<bits_per_raw_sample not fixed 65536
Michael Niedermayer
git at videolan.org
Tue Mar 25 12:50:37 EET 2025
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon Mar 24 15:55:09 2025 +0100| [3813559660557415820140d6f7687ad1db5d5708] | committer: Michael Niedermayer
avcodec/ffv1enc: remap table size is 1<<bits_per_raw_sample not fixed 65536
not a bugfix as this path was only used for float16 but it makes sense
to allow using this for integers too
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3813559660557415820140d6f7687ad1db5d5708
---
libavcodec/ffv1enc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 7e1dfd4b6f..80cf27bc11 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -1168,6 +1168,7 @@ static void choose_rct_params(const FFV1Context *f, FFV1SliceContext *sc,
static void encode_histogram_remap(FFV1Context *f, FFV1SliceContext *sc)
{
+ int len = 1 << f->bits_per_raw_sample;
int flip = sc->remap == 2 ? 0x7FFF : 0;
for (int p= 0; p < 1 + 2*f->chroma_planes + f->transparency; p++) {
@@ -1179,7 +1180,7 @@ static void encode_histogram_remap(FFV1Context *f, FFV1SliceContext *sc)
memset(state, 128, sizeof(state));
put_symbol(&sc->c, state[0], 0, 0);
memset(state, 128, sizeof(state));
- for (int i= 0; i<65536; i++) {
+ for (int i= 0; i<len; i++) {
int ri = i ^ ((i&0x8000) ? 0 : flip);
int u = sc->fltmap[p][ri];
sc->fltmap[p][ri] = j;
More information about the ffmpeg-cvslog
mailing list