[FFmpeg-devel] [PATCH 2/4] avcodec/ffv1enc: Remove 65536 pixel per slice limit for remap
Michael Niedermayer
michael at niedermayer.cc
Thu Apr 3 13:50:47 EEST 2025
About 1% better compression with large slices
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/ffv1.h | 4 ++--
libavcodec/ffv1enc.c | 6 ------
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/libavcodec/ffv1.h b/libavcodec/ffv1.h
index 664a48d1f0d..9472f9c9585 100644
--- a/libavcodec/ffv1.h
+++ b/libavcodec/ffv1.h
@@ -108,14 +108,14 @@ typedef struct FFV1SliceContext {
};
int remap_count[4];
- uint16_t *bitmap [4]; //float encode
+ uint32_t *bitmap [4]; //float encode
uint16_t *fltmap [4]; //halffloat encode & decode
uint32_t *fltmap32[4]; //float decode
unsigned int fltmap_size[4];
unsigned int fltmap32_size[4];
struct Unit {
uint32_t val; //this is unneeded if you accept a dereference on each access
- uint16_t ndx;
+ uint32_t ndx;
} *unit[4];
} FFV1SliceContext;
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 8f61b183eb0..70821a10159 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -577,9 +577,6 @@ int ff_ffv1_encode_determine_slices(AVCodecContext *avctx)
continue;
if (maxw * maxh * (int64_t)(s->bits_per_raw_sample+1) * plane_count > 8<<24)
continue;
- if (s->bits_per_raw_sample == 32)
- if (maxw * maxh > 65536)
- continue;
if (s->version < 4)
if ( ff_need_new_slices(avctx->width , s->num_h_slices, s->chroma_h_shift)
||ff_need_new_slices(avctx->height, s->num_v_slices, s->chroma_v_shift))
@@ -1382,7 +1379,6 @@ static int encode_float32_remap_segment(FFV1SliceContext *sc,
if (update) {
sc->c = rc;
- av_assert0(compact_index <= 65535);
sc->remap_count[p] = compact_index + 1;
}
return get_rac_count(&rc);
@@ -1400,8 +1396,6 @@ static void encode_float32_remap(FFV1Context *f, FFV1SliceContext *sc,
const int stair_mode = ((int[]){ 0, 0, 0, 1, 0, 0})[f->remap_optimizer];
const int magic_log2 = ((int[]){ 1, 1, 1, 1, 0, 0})[f->remap_optimizer];
- av_assert0 (pixel_num <= 65536);
-
for (int p= 0; p < 1 + 2*f->chroma_planes + f->transparency; p++) {
int best_log2_mul_count = 0;
float score_sum[11] = {0};
--
2.49.0
More information about the ffmpeg-devel
mailing list