From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 9135148739 for ; Thu, 16 May 2024 23:19:52 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3E1AF68D2A7; Fri, 17 May 2024 02:19:41 +0300 (EEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4D37668D283 for ; Fri, 17 May 2024 02:19:35 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 85D1A1C000C for ; Thu, 16 May 2024 23:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1715901574; 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=DpEw8bRF0GBEQZrethXespfeIZxb6XxVqJAh8/+whVg=; b=M0gtES0frME6FXKlax9FEa3E4zQ3K4EmLFhXB8CHCKdm5Zsv9j8Mz7ddcrNChgFWZUnOAJ afDu0LC2g3c4pe5EIy0IUAd9kB8eEQlCiElqBY2pwAIQulNxaV/7huacy8NMRjnl+A8mi5 Egh9SC7h4O6bsHyYlmQwoIpz7ZWhKuByFMjoQ7QhAufj/ie0korVvLNLZWhWnSrYdDY/eJ t0+1b1p3i4AoO3tnPB5oIFY2WUKtxXkdvhNk4CsJDI8dJheWPsHLQKtr/LxC0/aYkoI8gR XT3hG3DZWGOjt3qlbl4u2q0ef+eZZn1MzQkUDWfI1qKEWWkTMdRic7y1t8p3aQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 17 May 2024 01:19:29 +0200 Message-ID: <20240516231932.6950-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240516231932.6950-1-michael@niedermayer.cc> References: <20240516231932.6950-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/5] avcodec/scpr3: unify adding 127 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Untested, i have no testcase nor does fate Signed-off-by: Michael Niedermayer --- libavcodec/scpr3.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/scpr3.c b/libavcodec/scpr3.c index 5271717ac79..79106ddcff8 100644 --- a/libavcodec/scpr3.c +++ b/libavcodec/scpr3.c @@ -42,7 +42,7 @@ static void renew_table3(uint32_t nsym, uint32_t *cntsum, freqs[d] = b; freqs1[d] = a; cnts[d] = c; - for (int q = a + 128 - 1 >> 7, f = (a + b - 1 >> 7) + 1; q < f; q++) + for (int q = a + 127 >> 7, f = a + b + 127 >> 7; q < f; q++) dectab[q] = d; a += b; @@ -232,7 +232,7 @@ static int update_model6_to_7(PixelModel3 *m) cnts[j] = d; } p = (e + 127) >> 7; - k = ((f + e - 1) >> 7) + 1; + k = f + e + 127 >> 7; if (k > FF_ARRAY_ELEMS(n.dectab)) return AVERROR_INVALIDDATA; for (i = 0; i < k - p; i++) @@ -688,10 +688,10 @@ static int update_model3_to_7(PixelModel3 *m, uint8_t value) n.cntsum += n.cnts[e]; n.freqs1[e] = c; g = n.freqs[e]; - f = (c + g - 1 >> 7) + 1; + f = c + g + 127 >> 7; if (f > FF_ARRAY_ELEMS(n.dectab)) return AVERROR_INVALIDDATA; - for (q = c + 128 - 1 >> 7; q < f; q++) { + for (q = c + 127 >> 7; q < f; q++) { n.dectab[q] = e; } c += g; @@ -760,7 +760,7 @@ static int decode_value3(SCPRContext *s, uint32_t max, uint32_t *cntsum, freqs1[i] = e; g = (c + 127) >> 7; c += e; - q = ((c - 1) >> 7) + 1; + q = c + 127 >> 7; if (q > g) { for (int j = 0; j < q - g; j++) dectable[j + g] = i; -- 2.43.2 _______________________________________________ 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".