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 78CF34D05C
	for <ffmpegdev@gitmailbox.com>; Mon, 17 Mar 2025 17:49:45 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A039C687BC1;
	Mon, 17 Mar 2025 19:49:29 +0200 (EET)
Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com
 [209.85.128.45])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8AB71687A05
 for <ffmpeg-devel@ffmpeg.org>; Mon, 17 Mar 2025 19:49:22 +0200 (EET)
Received: by mail-wm1-f45.google.com with SMTP id
 5b1f17b1804b1-43ce70f9afbso24168215e9.0
 for <ffmpeg-devel@ffmpeg.org>; Mon, 17 Mar 2025 10:49:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1742233762; x=1742838562; 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=ICiwxAKWuDIfQaAFSLnXXomUvaWSL5o/v6/gm9dvGuc=;
 b=ifB9c8gAwFIY3BbZit1BKIXS+kDHAVKe8ibK8FOUbzRH6jaq2q4cIqhJBuE6zEQjYG
 OsZkziff0JE7sWgmIF582ajgaWljTAqyDmpV8nfvq3fbBG8h5GeFBc0lHAnv7Rj8IKwm
 Vcal+h7KXl5keX1OqHZi25nXwRA5R5m6LJl42zSf/NAKfPNQR2mKVNfbVs9cAgy6RRCr
 HkOT4kSa97ek9w+nZ8ZpuvELQY7s8Oc+JBTlkIGuRV7FKXFjqTNDONkHZNKU34XQruku
 TLFrioO+zS3m/6kvHZydeDbUdSzPB0IQaU9lL+G2430YChvN2bjQz1La4By53V8OgCtN
 evPQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1742233762; x=1742838562;
 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=ICiwxAKWuDIfQaAFSLnXXomUvaWSL5o/v6/gm9dvGuc=;
 b=QIiE7wwmSVCCwmPylbhSyTKnNd+qlzQebuj142kLpwyzp/rWP96xI1kBhOfi5LdELJ
 w4mquIcvjO8ZV/uJVYYatu3MHUlm7wrnu6zp74vLiUqXGTrfFmPHvQlot2ARxwIQ0SKF
 3tR1IneuuLGPwvSO4uJ/ntUDGSAdUEVs5XBMqpuNrFuaDiKnQuhlqf1B05MUV53Ojo2p
 QjNyAj5ryl10YFJZuf+tQyRSaVwQLuJVnRJ+loRK2mvl7VMjYZtGR6NjETpzxDPvdg5J
 thfjSkS9jOqZA4aOM1jGq8Sq2cvnGuCw2GPAM6kFunYEWMVKkmjgeJPXnPq+5ao8Zc74
 OErQ==
X-Gm-Message-State: AOJu0YzSwlokEbjLhzkgJd9h71ncHlQsRrGLDQk2Dwv/MjhOUZV+3n7d
 IK+CPMmt5bpRzyJhnlZOEswGX00jRph3HNtPux7Fg4qV/YjizxehgzoK99NY
X-Gm-Gg: ASbGncua9ERN3PIyRNu2yISengr8QclTmNoLXIwp0g0pQXxCUJ7dxVKHpRnLg2slZ2f
 ktzlCCtde39BugQD8mFpOgUhp41IZ0dcQ8zGEhWVhevoOL3hygwjPcalHYSLkl2JB6qHc8KoJOZ
 oU1psjF02WZSTV8+Pxhufm7hPrGdXB40tXGsr9NmEXLo8qEKsF7wJtX/148j0fxQKcAa6Us8y6p
 HuTDr4ZDXZNGxvAgsvJBzBJbkG4gZ/bRfyxgNoTl2hTCW1HReZn+XTgCTzvgFeEjS6cD0vFkNDC
 vy6kRybCZ1yhzja2owvzfvSnsj9ChmElLwi5mFejFVbv43TaeOux6yLP2jEx9dtRQ0X2Y5fJJ7K
 JX7eTTljHv5zrUmUy2436q5O3yuocYw==
X-Google-Smtp-Source: AGHT+IGfPS84FQ1ICKa+vSKdWZdJsW+fqR1D0I7d8befHA1k6eA36lYQTqAQ/HiUJ843tRr4tHsYhA==
X-Received: by 2002:a05:6000:2c2:b0:391:4835:d8a8 with SMTP id
 ffacd0b85a97d-3971d234ddfmr13224535f8f.1.1742233761547; 
 Mon, 17 Mar 2025 10:49:21 -0700 (PDT)
Received: from flagship3.deu.mlau.at (p54bc8686.dip0.t-ipconnect.de.
 [84.188.134.134]) by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-395c7df35ecsm15809347f8f.16.2025.03.17.10.49.20
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 17 Mar 2025 10:49:21 -0700 (PDT)
From: Manuel Lauss <manuel.lauss@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Date: Mon, 17 Mar 2025 18:49:03 +0100
Message-ID: <20250317174917.6872-2-manuel.lauss@gmail.com>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <20250317174917.6872-1-manuel.lauss@gmail.com>
References: <20250317174917.6872-1-manuel.lauss@gmail.com>
MIME-Version: 1.0
Subject: [FFmpeg-devel] [PATCH v3 01/14] avcodec/sanm: disable left/top for
 fullscreen codecs
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/20250317174917.6872-2-manuel.lauss@gmail.com/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

The block-based codecs 37/47/48 work on the full frame, and there's no
existing LucasArts game video that uses left/top offsets for these,
as it doesn't make sense. Ignore the left/top parameters for these codecs.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
---
v2, v3: no changes

 libavcodec/sanm.c | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index a4f0a28c7c..49ac9bebfe 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -621,8 +621,7 @@ static inline void codec37_mv(uint8_t *dst, const uint8_t *src,
     }
 }
 
-static int old_codec37(SANMVideoContext *ctx, int top,
-                       int left, int width, int height)
+static int old_codec37(SANMVideoContext *ctx, int width, int height)
 {
     int i, j, k, l, t, run, len, code, skip, mx, my;
     ptrdiff_t stride = ctx->pitch;
@@ -638,8 +637,8 @@ static int old_codec37(SANMVideoContext *ctx, int top,
     flags = bytestream2_get_byte(&ctx->gb);
     bytestream2_skip(&ctx->gb, 3);
 
-    if (decoded_size > ctx->height * stride - left - top * stride) {
-        decoded_size = ctx->height * stride - left - top * stride;
+    if (decoded_size > ctx->height * stride) {
+        decoded_size = ctx->height * stride;
         av_log(ctx->avctx, AV_LOG_WARNING, "Decoded size is too large.\n");
     }
 
@@ -649,8 +648,8 @@ static int old_codec37(SANMVideoContext *ctx, int top,
         FFSWAP(uint16_t*, ctx->frm1, ctx->frm2);
     }
 
-    dst  = ((uint8_t*)ctx->frm1) + left + top * stride;
-    prev = ((uint8_t*)ctx->frm2) + left + top * stride;
+    dst  = ((uint8_t*)ctx->frm1);
+    prev = ((uint8_t*)ctx->frm2);
 
     if (mvoff > 2) {
         av_log(ctx->avctx, AV_LOG_ERROR, "Invalid motion base value %d.\n", mvoff);
@@ -925,15 +924,14 @@ static void codec47_comp1(SANMVideoContext *ctx, uint8_t *dst_in, int width,
     }
 }
 
-static int old_codec47(SANMVideoContext *ctx, int top,
-                       int left, int width, int height)
+static int old_codec47(SANMVideoContext *ctx, int width, int height)
 {
     uint32_t decoded_size;
     int i, j;
     ptrdiff_t stride = ctx->pitch;
-    uint8_t *dst   = (uint8_t *)ctx->frm0 + left + top * stride;
-    uint8_t *prev1 = (uint8_t *)ctx->frm1 + left + top * stride;
-    uint8_t *prev2 = (uint8_t *)ctx->frm2 + left + top * stride;
+    uint8_t *dst   = (uint8_t *)ctx->frm0;
+    uint8_t *prev1 = (uint8_t *)ctx->frm1;
+    uint8_t *prev2 = (uint8_t *)ctx->frm2;
     uint8_t auxcol[2];
     int tbl_pos = bytestream2_tell(&ctx->gb);
     int seq     = bytestream2_get_le16(&ctx->gb);
@@ -947,8 +945,8 @@ static int old_codec47(SANMVideoContext *ctx, int top,
     decoded_size = bytestream2_get_le32(&ctx->gb);
     bytestream2_skip(&ctx->gb, 8);
 
-    if (decoded_size > ctx->height * stride - left - top * stride) {
-        decoded_size = ctx->height * stride - left - top * stride;
+    if (decoded_size > ctx->height * stride) {
+        decoded_size = ctx->height * stride;
         av_log(ctx->avctx, AV_LOG_WARNING, "Decoded size is too large.\n");
     }
 
@@ -959,8 +957,8 @@ static int old_codec47(SANMVideoContext *ctx, int top,
     }
     if (!seq) {
         ctx->prev_seq = -1;
-        memset(prev1, auxcol[0], (ctx->height - top) * stride);
-        memset(prev2, auxcol[1], (ctx->height - top) * stride);
+        memset(prev1, auxcol[0], ctx->height * stride);
+        memset(prev2, auxcol[1], ctx->height * stride);
     }
 
     switch (compr) {
@@ -1267,9 +1265,9 @@ static int process_frame_obj(SANMVideoContext *ctx)
     case 3:
         return old_codec1(ctx, top, left, w, h);
     case 37:
-        return old_codec37(ctx, top, left, w, h);
+        return old_codec37(ctx, w, h);
     case 47:
-        return old_codec47(ctx, top, left, w, h);
+        return old_codec47(ctx, w, h);
     case 48:
         return old_codec48(ctx, w, h);
     default:
-- 
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".