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 37BA74CEA3
	for <ffmpegdev@gitmailbox.com>; Sat, 15 Mar 2025 09:32:54 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 90C0A68E239;
	Sat, 15 Mar 2025 11:32:38 +0200 (EET)
Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com
 [209.85.221.48])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2DF3068DFF4
 for <ffmpeg-devel@ffmpeg.org>; Sat, 15 Mar 2025 11:32:31 +0200 (EET)
Received: by mail-wr1-f48.google.com with SMTP id
 ffacd0b85a97d-39129fc51f8so2515201f8f.0
 for <ffmpeg-devel@ffmpeg.org>; Sat, 15 Mar 2025 02:32:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1742031150; x=1742635950; 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=IMmI+2Fpr2XPZWELu0aU+HaZlgFO3e+jXvoJhQuc8eg=;
 b=clnnO61BrzedKfLNKzixITLPW8f6v/IDNIsqq3HIq8BoXumGQ4xoK/05qQS9arPirL
 zKBeRHzEQOJaAT2RNw4v3aXhPpGQuyw+22Q8F+BtkSUyR31RDdKoXdpqFwDfIDePsqPU
 hZQeIY3zdXHtW/HlCPJ7dDHB/+vzQAj+jps42YB2AkSdNNtnJbIwZbnoxgpJUQd6nuXo
 CkNVCyF3fZLD2n+wzjtp9sAX6c153sztGwyvH2p9KzgCYDinIXFZY4nQ70b/nRg2Prh+
 yr19i/Hjx4kvkD2RoIccRxtidDRKFev7W2ZP3jjSp1CXU8vVDpHYyAAOjMamFbzuPN5D
 +/Bw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1742031150; x=1742635950;
 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=IMmI+2Fpr2XPZWELu0aU+HaZlgFO3e+jXvoJhQuc8eg=;
 b=vlridj+GPC6fSVoICu8n5oFOruRlX7XykvHV/3uU05IRAXSpLNujJnZCQ20SuMN7kv
 8JU56Kj4O0STucC08bZ6F4YuO3s1h9QoAk4Wer7Cz2EHPhPPx+v2YS81OOK/le/SKCKm
 vqymI0dVNmzmA8kp7w7uDdhVXkgKQsmMXWpkgisKjzQTviBH9dPcNqYHAVRrT6pDQTpy
 74b9/eiVsDC5+3CU4HnUOUHtGmemz4SggaNdhsegq9ypGJVTo01ELp0EFtXS2HCWNk+L
 Vv32QvYLLaHFQp7rOBokWQbRG/0lsUD5kjpTLFESvUvcFiSj17wnYcdQRmN7NIRC1VhZ
 Jbvg==
X-Gm-Message-State: AOJu0YziUuSakPD+vHDFlj51xtbOTbzZuGA9VypFeiQkLCv6u52Y/xaH
 cLn/AEDrZ4XLugbJAvOOXu51IuZIAvBDhPnQP06MDDig7ZbYyLOG7EcAlw==
X-Gm-Gg: ASbGncucXPy+gJrGQs57TRwgcpt8i778CMVD0BDQVc0YlNooU0jiOn/yfkrDz39caQY
 6hscGm5+VYaqUYltrsbTaZlxHVluzJpp/BDUtaMfhjGeOSKsuW1z2gF/38fMJXXDQlMEmWxkoFj
 pMb1tqOQt0LbK9lcb0aBTAhzj1aCMOJEAxjyf25oIzMidTTVE9S/r+kcYQLmqDnV41rNz+YoFkr
 5FGW2oi0P6xHcbDhiXEAIMpWw4ZOpskNGGpMnNXNXm8gYn6+2EHp4dmrQ0mJ0lPgEep5oKwEhtf
 /SfhfD7plO6DdQFbpoORs5n2GMzBJ9zztXVll9uXmFgXadgPNHBhRZ6ySjAxazK8yu9hzcPoWRu
 L8nlp/nYKtlU67M3WNrS8m1upYbC0gJBMty5mcZlJHEqG2MnIaEK+Hsg=
X-Google-Smtp-Source: AGHT+IHwsF6fsWS93qpHZ5FQjmWEJ6J/blv8RQbCR6LdGHafhlNVZIFQtsA2DP1S1ArR9HZtQmcZww==
X-Received: by 2002:a05:6000:1acc:b0:390:f987:26a1 with SMTP id
 ffacd0b85a97d-3971dbe7ea7mr8728270f8f.29.1742031150108; 
 Sat, 15 Mar 2025 02:32:30 -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.28
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 15 Mar 2025 02:32:29 -0700 (PDT)
From: Manuel Lauss <manuel.lauss@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Date: Sat, 15 Mar 2025 10:32:08 +0100
Message-ID: <20250315093220.2565-2-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 01/13] 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/20250315093220.2565-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>
---
 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.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".