Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH 2/4] avcodec/ffv1enc: Remove 65536 pixel per slice limit for remap
Date: Thu,  3 Apr 2025 12:50:47 +0200
Message-ID: <20250403105049.883948-2-michael@niedermayer.cc> (raw)
In-Reply-To: <20250403105049.883948-1-michael@niedermayer.cc>

About 1% better compression with large slices

Signed-off-by: Michael Niedermayer <michael@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

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2025-04-03 10:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-03 10:50 [FFmpeg-devel] [PATCH 1/4] avcodec/ffv1dec: Limit size of fltmap* to pixel number Michael Niedermayer
2025-04-03 10:50 ` Michael Niedermayer [this message]
2025-04-03 10:50 ` [FFmpeg-devel] [PATCH 3/4] avcodec/ffv1enc: Consider 2s x s slice configurations Michael Niedermayer
2025-04-03 10:50 ` [FFmpeg-devel] [PATCH 4/4] avcodec/ffv1enc: avoid slices larger than 360x288 if no value is specified Michael Niedermayer
2025-04-06 23:29   ` James Almer
2025-04-06 23:44     ` Michael Niedermayer
2025-04-07  1:13       ` James Almer
2025-04-07 12:35         ` Michael Niedermayer
2025-04-06 18:43 ` [FFmpeg-devel] [PATCH 1/4] avcodec/ffv1dec: Limit size of fltmap* to pixel number Michael Niedermayer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250403105049.883948-2-michael@niedermayer.cc \
    --to=michael@niedermayer.cc \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git