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 0149A4E89F
	for <ffmpegdev@gitmailbox.com>; Mon, 17 Mar 2025 17:51:29 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 66EBA687C4D;
	Mon, 17 Mar 2025 19:49:41 +0200 (EET)
Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com
 [209.85.128.54])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F0A9D687BFD
 for <ffmpeg-devel@ffmpeg.org>; Mon, 17 Mar 2025 19:49:30 +0200 (EET)
Received: by mail-wm1-f54.google.com with SMTP id
 5b1f17b1804b1-43cef035a3bso17478315e9.1
 for <ffmpeg-devel@ffmpeg.org>; Mon, 17 Mar 2025 10:49:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1742233770; x=1742838570; 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=ilZBWYbQSmwe7+zUXVAIc3Y83GOpNmwJuy0rTAfiH2k=;
 b=JuHHwQKvnDh3rK1YS1VVZs1dpWLeY5cBUIc8AR1QVhXx86nlaeYac9TCvU+UtHSeIT
 udTCT10uuWuvjmRuS+G8pGoS1VXATpQ9QGx+NnZPoelhpxXQgqt1NDz4aHaKloQgFpPx
 rN+jSwWKkr945fkZho24EnAbtN7wHs18syIuP+tZcJTr4i+mQgqH9L9p/XfKJtbQLFqp
 Nmx6UJcu0e1FJnXSP7SCmKsXVQ0z5kc2RsS39GbURZNheFuGHX9LA8HmFBnueYXIiJSi
 iiONDAvplJsxuxMUu5LB8UVQz6NruVUzDedsgvxPVEmn8thldRqD3ADmbyIiV1sysEuO
 8MiQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1742233770; x=1742838570;
 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=ilZBWYbQSmwe7+zUXVAIc3Y83GOpNmwJuy0rTAfiH2k=;
 b=YT4RNW4pyP1g2z2znQfJyPzJGXWZKQLSdrd/O238DiDjTXXGEynFn9sNtIXznsD32S
 o1D+uPoX2v9Xlryrl+XedsJcN0MOmVs7plQoaPv3mgdnXnOkepVwa9JPj++sadsegd+7
 eTG2odnZ6B9pIoWgzi+FunzbRLyQxiyysxmsys0RkCrm200Cf0mct6y0OXWxhfX+cKcZ
 0j59p7RBUMXDwVqoG1SDUiWUCBVovaYUWAE21nk3rmoIaDmfi5H2ca3BlPDGN6oDzrC6
 Jx4bB+eSfMvPawuLz5bycmXQp6JxA2oQ6XDj/n1uydsPo2XSG4Vq5xUAwjfxOmCzh8ZD
 dv2A==
X-Gm-Message-State: AOJu0YxDwnwAx79ZRasA8BR0575ZXuD2KMECCG92Ih5eS1nhZ4A8LhLd
 1z/BUvKlThWVFxRotDreruTO7Za9lpuXDVVhtMrUIvR3T2++t29QF7N8mZKb
X-Gm-Gg: ASbGnct3DtOVrr/xTJg5FeaMDrlSNYGI5zFgyXsC8kF2cBAv3ZmzNoMrB3Co2BTQysN
 B+hrauztHfwpKkrDcko75M5gO4OdOkxFxxcOLsOnsabzCB9/vMIxrAQS0tqFHzKP8ReG0C0bVlI
 XNGiGVyFwZPUsvqwsOu72y/EvtVpVwPI6Y6Tinypygj92lXWktr55COJ1h+hRd3Ly/7PUo4/7OJ
 Fw452exRULcf/lrwJgaD9HOdbUa8xoVhBpsfJkvWnraI5rJBsdhSE2IgcoxLjpcxvZAlw3x4/fu
 Hq4Tz7oRot/EB31TnrebfHhk7gZruOSAdBlFkEq2eZ6r17x2rRfQtzNJn4kASv/aFIcp78coi3A
 ViOXKHYmUufnLE/2eAY9Zwvu94Gd5aQ==
X-Google-Smtp-Source: AGHT+IFGot6mgQ+CaAUQtvjpp5za8o75k5JQVdPTYlz2+/VPNCb0YktcP3pvKyzL6tcZ5Seq1e7Ufg==
X-Received: by 2002:a05:600c:1548:b0:43c:e2dd:98f3 with SMTP id
 5b1f17b1804b1-43d1ecff3d0mr113424265e9.21.1742233769953; 
 Mon, 17 Mar 2025 10:49:29 -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.29
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 17 Mar 2025 10:49:29 -0700 (PDT)
From: Manuel Lauss <manuel.lauss@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Date: Mon, 17 Mar 2025 18:49:15 +0100
Message-ID: <20250317174917.6872-14-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 13/14] avcodec/sanm: codec20 decoder
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-14-manuel.lauss@gmail.com/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

codec20 is raw uncompressed image data.

It is used internally in Rebel Assault 1 as a special format for STOR
(when parameter for STOR is set to 3), and is used again in
the "Full Throttle Remaster" from 2017.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
---
v3: newly added

 libavcodec/sanm.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index 730ec14b98..d8276f9d85 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -950,6 +950,24 @@ static int old_codec2(SANMVideoContext *ctx, GetByteContext *gb, int top,
     return 0;
 }
 
+static int old_codec20(SANMVideoContext *ctx, int w, int h)
+{
+    uint8_t *dst = (uint8_t *)ctx->frm0;
+
+    if (bytestream2_get_bytes_left(&ctx->gb) < w * h)
+        return AVERROR_INVALIDDATA;
+
+    if (w == ctx->pitch) {
+        bytestream2_get_bufferu(&ctx->gb, dst, w * h);
+    } else {
+        for (int i = 0; i < h; i++) {
+            bytestream2_get_bufferu(&ctx->gb, dst, w);
+            dst += ctx->pitch;
+        }
+    }
+    return 0;
+}
+
 static inline void codec37_mv(uint8_t *dst, const uint8_t *src,
                               int height, int stride, int x, int y)
 {
@@ -1673,6 +1691,8 @@ static int process_frame_obj(SANMVideoContext *ctx, GetByteContext *gb)
     case 33:
     case 34:
         return old_codec4(ctx, gb, top, left, w, h, param, parm2, codec);
+    case 20:
+        return old_codec20(ctx, w, h);
     case 21:
         return old_codec21(ctx, gb, top, left, w, h);
     case 23:
-- 
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".