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 E42024B223
	for <ffmpegdev@gitmailbox.com>; Tue, 25 Mar 2025 14:07:59 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 83329687BC5;
	Tue, 25 Mar 2025 16:07:09 +0200 (EET)
Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net
 [217.70.183.195])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B1018687BA5
 for <ffmpeg-devel@ffmpeg.org>; Tue, 25 Mar 2025 16:07:00 +0200 (EET)
Received: by mail.gandi.net (Postfix) with ESMTPSA id 10BF720577
 for <ffmpeg-devel@ffmpeg.org>; Tue, 25 Mar 2025 14:06:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc;
 s=gm1; t=1742911620;
 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=NvcJEP7X3+b/ba7xdwCxedoj1mwDx3z/DJ5B3OTS6lw=;
 b=K0zGOv8pDaLzmZLxOu2Fb1IKumHLrhK9bjGY2cpI57bFkmXIDDkbNgLluYtPHjuhIN2hH7
 vFeIXUsSMrtFcw2cIVBZn2zCoeHScF5JvK7GYJy7bEkvqMVvy35DdAofrMrGn2YqcydXUD
 +E0xILpf70/I94AMqSKQDt1+EYlVcgxXO7cadzNdrroccgmGprumSXWkT1b5y58PwNutC4
 KWLqK5SGTqdDKtZCfKU5AfngopasOBZw/Ge4I/Ag9VyYwWKJSuC3UFCZK8c3FnJgcmpV7q
 E4TBKojOqj6tyDPYwV95EmD7lbC7vP9DmTiX4Rmurv/qlHPvIK1W2WF8ktw3mw==
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Date: Tue, 25 Mar 2025 15:06:55 +0100
Message-ID: <20250325140655.612516-5-michael@niedermayer.cc>
X-Mailer: git-send-email 2.48.1
In-Reply-To: <20250325140655.612516-1-michael@niedermayer.cc>
References: <20250325140655.612516-1-michael@niedermayer.cc>
MIME-Version: 1.0
X-GND-State: clean
X-GND-Score: -70
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduiedvkeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdeftddmnecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpedvgfefudeijeetieejkefgfffhtdeludeuffdvfeelieevjeetvedufeetfeejfeenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg
X-GND-Sasl: michael@niedermayer.cc
Subject: [FFmpeg-devel] [PATCH 5/5] avcodec/ffv1enc: Store
 run1start_mul_index instead of computing
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/20250325140655.612516-5-michael@niedermayer.cc/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

Theres a special case I missed, its simpler to just store

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/ffv1enc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index d28cb8f5700..bc59f96746c 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -1268,6 +1268,7 @@ typedef struct RemapEncoderState {
     int run1final;
     int64_t run1start_i;
     int64_t run1start_last_val;
+    int run1start_mul_index;
 } RemapEncoderState;
 
 static inline void copy_state(RemapEncoderState *dst, const RemapEncoderState *src)
@@ -1287,6 +1288,7 @@ static inline void copy_state(RemapEncoderState *dst, const RemapEncoderState *s
     dst->run1final      = src->run1final;
     dst->run1start_i    = src->run1start_i;
     dst->run1start_last_val = src->run1start_last_val;
+    dst->run1start_mul_index = src->run1start_mul_index;
 }
 
 static int encode_float32_remap_segment(FFV1SliceContext *sc,
@@ -1337,6 +1339,7 @@ static int encode_float32_remap_segment(FFV1SliceContext *sc,
                 if (!s.run) {
                     s.run1start_i        = s.i - 1;
                     s.run1start_last_val = s.last_val;
+                    s.run1start_mul_index= s.current_mul_index;
                 }
                 if (step == 1) {
                     if (s.run1final) {
@@ -1355,9 +1358,7 @@ static int encode_float32_remap_segment(FFV1SliceContext *sc,
                         put_symbol_inline(&s.rc, s.state[s.lu][0], s.run, 0, NULL, NULL);
                         s.i                 = s.run1start_i;
                         s.last_val          = s.run1start_last_val; // we could compute this instead of storing
-                        av_assert2(s.last_val >= 0 && s.i >= 0); // first state is zero run so we cant have this in a one run and current_mul_index would be -1
-                        if (s.run)
-                            s.current_mul_index = ((s.last_val + 1) * s.mul_count) >> 32;
+                        s.current_mul_index = s.run1start_mul_index;
                     }
                     s.run1final ^= 1;
 
-- 
2.48.1

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