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 462C34E8B4
	for <ffmpegdev@gitmailbox.com>; Mon, 17 Mar 2025 17:50:50 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CA842687C2E;
	Mon, 17 Mar 2025 19:49:36 +0200 (EET)
Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com
 [209.85.128.46])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 355A3687B5B
 for <ffmpeg-devel@ffmpeg.org>; Mon, 17 Mar 2025 19:49:25 +0200 (EET)
Received: by mail-wm1-f46.google.com with SMTP id
 5b1f17b1804b1-43d0c18e84eso11283095e9.3
 for <ffmpeg-devel@ffmpeg.org>; Mon, 17 Mar 2025 10:49:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1742233764; x=1742838564; 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=enXUjZZrOKjl95Djca56RdgreMI+TDDPqKC0F+T8FqQ=;
 b=E6c8PHB80KveuiVvX03coCCQBZABvDkaUW9scPBhEKJBL+wyKJNln6HhVfnZX8NC5K
 z1xPbiebnhCSTbcr2vE0aijegIg1VEC3zPfd3sC2czSTJLLbsZC0MXVLPO7/B7Gma23V
 wPEfZ5QUNkZ7s6KOdZPpfFdXlnrCZ5FqjX5TZrSPjI+2qMHv4lR5qcmxfQF+x4CdyttH
 wcm9w31WdvtMCReaPjcqqxAYYxqK3Ih4B3dntdk6N4PPj1CyCUn3IMnCDQNsITeNdCB/
 zspP/9KTIWKTzdcrKfUfOgWQqjONhf8jE71GzLK+QupK7dE4JBoHrpfZhxBWkPrTCr6H
 n7Rg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1742233764; x=1742838564;
 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=enXUjZZrOKjl95Djca56RdgreMI+TDDPqKC0F+T8FqQ=;
 b=bLKdCGMwNXO5A2kitXpSUa9Px+UbrRiyK4frJ3qOlxyHJkywi4HFxqxFHZOSaLkDH+
 RIAzF0QhaK4wc/7r4apT7H+adlhmG6aBEcFExzlHyLIr6KgTZgabPV+A9Sx+Il693FLO
 7rNIUSD+em+fvo0IcmYrEyrQZFuCvI3Cl0b5jGhybndU34tqiDBKSKvQXUBr4tPVmjN+
 tvTsGRqEzyCT0UyQ7VCF+cbAg9Gko2BmeBVQok9e++Q7s0mVmHGbFI2hDb/RwT1yGqv6
 HjaY+bIEhgts5S6P86i2882OBhEZPcrejWADrQ1haAkcvzVqiGUZlw/0ElYJPqkQGGXZ
 7MOw==
X-Gm-Message-State: AOJu0YwcB9oSgHU4VCzIEILDAb92FV6v9xz4bBKPmK726bIZJ0Yd+p4T
 ehkDNiABXOBtuO6WY9g9MkSNd9bWG/X64eu17GqA4ZZgw4zZ7xtbzIWjQ5Yg
X-Gm-Gg: ASbGncsUruO0f4hOuJrt+g0fdtUIsSrOqwE8tO2T/fp/m6OOvAZUBiBl9MeaqcJHPH6
 B1/59dR7wCtF0arFc+0x6/XehvIwcsMl4DRqViF9hZQuoqL/bJF0kdkNcCi6/Yx4MoCbBxyggCZ
 duXzL5P9mChwIbLD6s2urea6v6XVIQXgbyEvqhg4Jigq9X+wGVCAK/aKZQOS5ZtkDv927itdRsn
 ynLANF2fiExgv6HbmpSA1OD35E/uspMecHG38CzIpIEUQo4+LGz7QWqq/rJsfrk+M8AHkV3nijB
 3GaZaW17S08b9yMSP0DtuQNFfPX0RQ8VnX0UcgXATJuecntdNOGsDMNMEhMYmgCO+Alw6cQCxkE
 amaaObDmOrOEsK0L/ahCJ+YKbFqoXDg==
X-Google-Smtp-Source: AGHT+IF3GMZq4wvDM7NJdJDqyUl3ZbJHk7F8gZWjE/ID46xPwSkgQ+GxNpQjE49wxFD2SKUO0Rn9Ng==
X-Received: by 2002:a5d:598c:0:b0:38f:503a:d93f with SMTP id
 ffacd0b85a97d-3971f12ce95mr17295774f8f.40.1742233764349; 
 Mon, 17 Mar 2025 10:49:24 -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.23
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 17 Mar 2025 10:49:23 -0700 (PDT)
From: Manuel Lauss <manuel.lauss@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Date: Mon, 17 Mar 2025 18:49:07 +0100
Message-ID: <20250317174917.6872-6-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 05/14] avcodec/sanm: fix codec3
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-6-manuel.lauss@gmail.com/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

codec3 is codec1 which writes zero values instead of skipping them.
This fixes a lot of RA1 videos.

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

 libavcodec/sanm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index 395548ee2d..e1471211d6 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -558,7 +558,7 @@ static int rle_decode(SANMVideoContext *ctx, uint8_t *dst, const int out_size)
 }
 
 static int old_codec1(SANMVideoContext *ctx, int top,
-                      int left, int width, int height)
+                      int left, int width, int height, int opaque)
 {
     int i, j, len, flag, code, val, end, pxoff;
     const int maxpxo = ctx->height * ctx->pitch;
@@ -581,7 +581,7 @@ static int old_codec1(SANMVideoContext *ctx, int top,
             code = (code >> 1) + 1;
             if (flag) {
                 val = bytestream2_get_byteu(&ctx->gb);
-                if (val) {
+                if (val || opaque) {
                     for (j = 0; j < code; j++) {
                         if (pxoff >= 0 && pxoff < maxpxo)
                             *(dst + pxoff) = val;
@@ -595,7 +595,7 @@ static int old_codec1(SANMVideoContext *ctx, int top,
                     return AVERROR_INVALIDDATA;
                 for (j = 0; j < code; j++) {
                     val = bytestream2_get_byteu(&ctx->gb);
-                    if ((pxoff >= 0) && (pxoff < maxpxo) && val)
+                    if ((pxoff >= 0) && (pxoff < maxpxo) && (val || opaque))
                         *(dst + pxoff) = val;
                     pxoff++;
                 }
@@ -1312,7 +1312,7 @@ static int process_frame_obj(SANMVideoContext *ctx)
     switch (codec) {
     case 1:
     case 3:
-        return old_codec1(ctx, top, left, w, h);
+        return old_codec1(ctx, top, left, w, h, codec == 3);
     case 37:
         return old_codec37(ctx, w, h);
     case 47:
-- 
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".