From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 016014E43A for ; Tue, 11 Mar 2025 15:05:28 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 074E368E14C; Tue, 11 Mar 2025 17:04:05 +0200 (EET) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5FB6568E113 for ; Tue, 11 Mar 2025 17:03:53 +0200 (EET) Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-43cfecdd8b2so14924625e9.2 for ; Tue, 11 Mar 2025 08:03:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741705433; x=1742310233; 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=NxdKbDDQ8u3Nx3lxHHc8XxqT0PcuCxhoXecbqchcW+Y=; b=Q+idwmU7so0RvjeghjUv+GcSfHFF+3QBVG+QYv2ctfR47V6sdrxLtwe5UUUv3QGD43 Pqc6ZlengoLSEqSZDQcai5ldm/sQ8vip07iZU6Xlrgv2odl/oNpv5XQcSmbXWNS3Sou2 uykFTzj9XSkm46Kay2dbrJlW28nxro2NkOPy5+Qm67WVvVJTSwJ566MsojiSnKUxvXD8 9TOZCzA0Ihxu0JTCPjq8HUP4mw8U4CBoi9eGTJUWUIcRBhL2Ju7PA/q1FCIs9g3cvVRX ublEcwkHWIDytde/UJLeq2lLBIorUN1kobGYrYnDbvTI+Y5mVFm0J2pH76Y7qinuc4/k SM+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741705433; x=1742310233; 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=NxdKbDDQ8u3Nx3lxHHc8XxqT0PcuCxhoXecbqchcW+Y=; b=jZY0+L3BqoDd4N/SOQfoXr05/9fsUBJlqnCJ7+0ixBuRMs8z/cIA5Uk0TuZaUdDWaT 2z9EfCUx9oL5wyo6TZ6hviTZYXLj/oE9PQ+0T0BHizHpGqcd8mnjiEWpi4xeHBD26Iww 5wNzdOsU0y/W8b1nJfZGD2oL6wVodF0+s4oAu6Eieha2EuqKa2BG+LXsc9JXXtiy4PaI 8GnTO7LIiQcGI1/69Ow0boCdLyBme/XHR6/dtP5BpKp77ukRqt7RYHEiMSNE931twEtN LjqMmlmOIWa872gLKGgu8UZo5uYaAEu8kIuKLHDJSAVUSUOk6uESgiR8JbBOMHIJDugJ DxBg== X-Gm-Message-State: AOJu0Yxp9CvNOPv5GmBy5e1Uw4y/vS59MCGL0dD7yb2Gky0py3eUqttS vJLKEWh6TdaBkJwYwZuzD2ulCM6y9705h4EwMFgfqWykKAAkddxmsjLVyw== X-Gm-Gg: ASbGncvj3/22DHkp/Id6KNQOozCVrlUZybk6y7+9bGRyevoJhNOSO+1wydXGYUfGmcr +pBafX7C46Wn8/0bJo2OKas/0kF+tTqKAgAQKjHuo7IjxmtyTtGRK3d6a+F9iEdPmKynVHqGoW/ +F/64AhTBWgTo4jrQPM1uhGgC4wGbnHixnNJm/Fc4OlVe0WI0yslb+iHcgPoECJMLNlQQ1mhsuC dqcMQnysDuurPdlRwU1/mcwdAkVt/ZsJjZDGCLs0A/5CEtzFiEOrPoeSLYJ0IPe8XRhhibX1fz/ Kag2pEQuoxe84kXOuvy6EwRCUE3JJO4+SpBu3XpkrOAkUpmKuEH1G9C+t3TZy59sCOZWSp2FK2p or1Vmq7U8jeiaXbczjTPGRNl+2QV6DVzEpztOh3qS3qFCnNcCGTIGQhA= X-Google-Smtp-Source: AGHT+IEpNTQ8Bs0GtXrKDvteS05PHbA11Ae/VgImrVokvVpE+P40pJEzfJ13fLyYuKKTwhq+PkcvDA== X-Received: by 2002:a05:600c:444d:b0:43c:fe15:41cb with SMTP id 5b1f17b1804b1-43cfe154379mr77634105e9.15.1741705431910; Tue, 11 Mar 2025 08:03:51 -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-43ceaac390bsm115259215e9.35.2025.03.11.08.03.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 08:03:51 -0700 (PDT) From: Manuel Lauss To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Mar 2025 16:03:39 +0100 Message-ID: <20250311150341.348678-7-manuel.lauss@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250311150341.348678-1-manuel.lauss@gmail.com> References: <20250311150341.348678-1-manuel.lauss@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 7/9] avcodec/sanm: codec2 decoder X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Manuel Lauss Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: this codec consists of 4 byte packets: 2bytes delta-x, 1 byte delta-y and 1 byte color to put at that spot. Used in Rebel Assault 1 only. Signed-off-by: Manuel Lauss --- libavcodec/sanm.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c index efed31b70c..8c0b76aed6 100644 --- a/libavcodec/sanm.c +++ b/libavcodec/sanm.c @@ -604,6 +604,24 @@ static int old_codec1(SANMVideoContext *ctx, int top, return 0; } +static int old_codec2(SANMVideoContext *ctx, int top, + int left, int width, int height) +{ + uint8_t *dst = (uint8_t *)ctx->frm0, col; + int16_t xpos = left, ypos = top; + + while (bytestream2_get_bytes_left(&ctx->gb) > 3) { + xpos += bytestream2_get_le16u(&ctx->gb); + ypos += bytestream2_get_byteu(&ctx->gb); + col = bytestream2_get_byteu(&ctx->gb); + if (xpos >= 0 && ypos >= 0 && + xpos < ctx->width && ypos < ctx->height) { + *(dst + xpos + ypos * ctx->pitch) = col; + } + } + return 0; +} + static inline void codec37_mv(uint8_t *dst, const uint8_t *src, int height, int stride, int x, int y) { @@ -1303,6 +1321,8 @@ static int process_frame_obj(SANMVideoContext *ctx) case 1: case 3: return old_codec1(ctx, top, left, w, h, codec != 1); + case 2: + return old_codec2(ctx, top, left, w, h); case 37: return old_codec37(ctx, w, h); case 47: -- 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".