From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTPS id BA4D74C337
	for <ffmpegdev@gitmailbox.com>; Thu,  3 Apr 2025 10:51:15 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 40A7368B32E;
	Thu,  3 Apr 2025 13:50:59 +0300 (EEST)
Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net
 [217.70.183.199])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C980D68A67E
 for <ffmpeg-devel@ffmpeg.org>; Thu,  3 Apr 2025 13:50:51 +0300 (EEST)
Received: by mail.gandi.net (Postfix) with ESMTPSA id 38CF1432BC
 for <ffmpeg-devel@ffmpeg.org>; Thu,  3 Apr 2025 10:50:51 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc;
 s=gm1; t=1743677451;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=Xgc1/Bv3LAhEQTfMg2GSepT/awZEKbw2sVkQR/0Gwv4=;
 b=AHjTR2ZK5HYgQn7Y8mkIWk5Kf/akbLKS03h8MJmyxA9DIXDZ7G7huRKbJzywkGR7koy84d
 ntumnHrW1VKrsHnG6h+QLsr2GDfdCDQFL/5YveIGFuIv6jEPXNQRTgBKA2W9m8yxh8l8ET
 3eLQMPldFs15WZzakG6P556LPXi6A63ORrraTt2/6GjXFRfydeWqi0EJwTHawzOBaPEa1q
 CgNPrPNjnh+5cVjqHqUVOHoq2/ih1xwMahMqd+qcJ6ilUJBok6avJDVrhhKXnLXXfXA8cN
 X6n6FQ710HofA05Xi45w0O5HPdl6rrZY4zkKdngvpuvXnBZ8gN4cKTcFpxUWqQ==
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Date: Thu,  3 Apr 2025 12:50:47 +0200
Message-ID: <20250403105049.883948-2-michael@niedermayer.cc>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <20250403105049.883948-1-michael@niedermayer.cc>
References: <20250403105049.883948-1-michael@niedermayer.cc>
MIME-Version: 1.0
X-GND-State: clean
X-GND-Score: -70
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddukeekfeeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdeftddmnecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpedvgfefudeijeetieejkefgfffhtdeludeuffdvfeelieevjeetvedufeetfeejfeenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg
X-GND-Sasl: michael@niedermayer.cc
Subject: [FFmpeg-devel] [PATCH 2/4] avcodec/ffv1enc: Remove 65536 pixel per
 slice limit for remap
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/20250403105049.883948-2-michael@niedermayer.cc/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

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".