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 C97B34CE85
	for <ffmpegdev@gitmailbox.com>; Sat, 15 Mar 2025 09:35:18 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 376E268E2CA;
	Sat, 15 Mar 2025 11:32:56 +0200 (EET)
Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com
 [209.85.128.41])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 50D7468E277
 for <ffmpeg-devel@ffmpeg.org>; Sat, 15 Mar 2025 11:32:43 +0200 (EET)
Received: by mail-wm1-f41.google.com with SMTP id
 5b1f17b1804b1-4394036c0efso2734755e9.2
 for <ffmpeg-devel@ffmpeg.org>; Sat, 15 Mar 2025 02:32:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1742031162; x=1742635962; darn=ffmpeg.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=UbozCx6/5kyQwg5C56OdWPLT7s3weYU4+nE8su1JMuA=;
 b=QzPkrVSwGBGYc630ePjwlOttuYeR/6j4QlYKeFuptXE1yOBkYrSfOvPkHCr5Gv2U2n
 BoySPPNI1NM5o7kthO3nyxzGhWZp5T75LLJUfPmR7R9uXlgoriasIC1YdKIsSiAO1rOZ
 da+cHLH7bVpbv9Lqi1yuB/KsfgGrBpm2KiWdyATM7GkWFcwtgIV/6+iyVZoAZIIcnncu
 iUPqLeD47IFn8V48aoIHITGfo0BhZyDma9L1r773RJSIEBuo1AlfvQ79ex9QlFvACwVr
 lrAQIN4CCsQC0mVMBFZu6JN8IfC7Wfei52f7IT30bRC7CES5476n15lMhcU2UyceBa6L
 rwSw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1742031162; x=1742635962;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=UbozCx6/5kyQwg5C56OdWPLT7s3weYU4+nE8su1JMuA=;
 b=A7vm3ntH2JemUXjl+KpXCAOgp6imWEX/G2vjualFD4HyPBM002EFUozuDQnMAlqprV
 taRbeMrNZF/HfJn+RKMt1fsiZFCrzMG7HNmjpdK2lGi+1S5yB7RUn4Roic62thpkxkr/
 QeXYIu3wBfhaLsoDKx39Fm8EprTzFTSKe58oUXsRUikqWujafAWwBKgxPKPN7lX6S11w
 12XPukkW9Ur0smV4ZDLNfgLzx9NAJNKDn9aRfUw64wgDY3CE6VmQFoPwOpyD67kDwwpO
 8F91LD7e8FGZA02iN1y94oa/eAwNNqhqGlG77rFnEVX5gkD+YKW0/tBWJfozLcpx39SR
 aHtQ==
X-Gm-Message-State: AOJu0YwaKGhNrXChvjd4GnNGZgbKTgQZLoWwwP9IjNafvSU42PD4tq8q
 5Wftnt4J2R39W+tyt+RZz8OCylKcZeovFBgNfE/BWRBPc50s0BK7GLdNFQ==
X-Gm-Gg: ASbGnctgJa5jFPBI6UREQo/0sfMtir0cR9nGmTm9rDXwwyvJMKWxg/sFoIJo0j5wInY
 Mk1R8Z7MOWwBWXMZbWBzqYfGsaLSMj4QhGXwRqvymQF/Ysd0GHDsBzoUvIlPfHtRujCJkgQJNzX
 pNb0bBsOZNVJvcuTyRwa22JDRIoFx1YNoKv0OlMT9RL0s9gr8KWT5VyqL0NaR++s1+DhMHq5tbw
 dqTnchcv+GLs3EBPoCW0iBnCH/5pFfKubadrvHlZmdfg8P4RLi76PkWlFGatZyFezOq3RAdGwKw
 0zShgD/QW4H79+GmIxr3BTITIr8j4ltawZ3Sy3Tez90Bvb0nyVgtBhAPSIrfUcVZNERwxjbR/sm
 pyXJdHh2GsQEto8diDh+1W0omrS5Vs5j/KHuHn3L6a2WImrLq0S3J1yk=
X-Google-Smtp-Source: AGHT+IEYruU/q42p0DHhrRHJHGEx8+okL6v41fzwYivkGU1KZSUnTw9cVFSIxKCPL6QzJ4B421W3Xw==
X-Received: by 2002:a05:600c:b8b:b0:43c:fd72:f028 with SMTP id
 5b1f17b1804b1-43d2867e678mr10010805e9.29.1742031162466; 
 Sat, 15 Mar 2025 02:32:42 -0700 (PDT)
Received: from flagship3.deu.mlau.at
 (p200300c0271f29004c5623f045c27bca.dip0.t-ipconnect.de.
 [2003:c0:271f:2900:4c56:23f0:45c2:7bca])
 by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-43d1fe659b3sm43302905e9.34.2025.03.15.02.32.41
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 15 Mar 2025 02:32:42 -0700 (PDT)
From: Manuel Lauss <manuel.lauss@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Date: Sat, 15 Mar 2025 10:32:17 +0100
Message-ID: <20250315093220.2565-11-manuel.lauss@gmail.com>
X-Mailer: git-send-email 2.48.1
In-Reply-To: <20250315093220.2565-1-manuel.lauss@gmail.com>
References: <20250315093220.2565-1-manuel.lauss@gmail.com>
MIME-Version: 1.0
Subject: [FFmpeg-devel] [PATCH v2 10/13] avcodec/sanm: codec37: reimplement
 comp4
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>
Cc: Manuel Lauss <manuel.lauss@gmail.com>
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/20250315093220.2565-11-manuel.lauss@gmail.com/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

Compression 4 code 0 means copy from delta buffer without mv,
AND start of a skip run.  This gets rid of the extra case and column
index manipulation and implements this as it is implemented in the
original game exe, i.e. as a special case for after mv copy.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
---
 libavcodec/sanm.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index eecfefd43b..2d7a0eeb32 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -1106,16 +1106,14 @@ static int old_codec37(SANMVideoContext *ctx, int width, int height)
                     t = bytestream2_get_byteu(&ctx->gb);
                     for (k = 0; k < 4; k++)
                         memset(dst + i + k * stride, t, 4);
-               } else if ((compr == 4) && (code == 0)) {
-                    if (bytestream2_get_bytes_left(&ctx->gb) < 1)
-                        return AVERROR_INVALIDDATA;
-                    skip_run = bytestream2_get_byteu(&ctx->gb) + 1;
-                    i -= 4;
                } else {
                     mx = c37_mv[(mvoff * 255 + code) * 2];
                     my = c37_mv[(mvoff * 255 + code) * 2 + 1];
                     codec37_mv(dst + i, prev + i + mx + my * stride,
                                ctx->height, stride, i + mx, j + my);
+
+                    if ((compr == 4) && (code == 0))
+                        skip_run = bytestream2_get_byteu(&ctx->gb);
                 }
             }
             dst  += stride * 4;
-- 
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".