From patchwork Fri Nov 8 11:51:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Lauss X-Patchwork-Id: 52636 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:2fe5:b0:4a6:1c7:11b7 with SMTP id kw5csp2116835vqb; Fri, 8 Nov 2024 03:51:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVoG4c5o49xsdMIS9uCpHI7qX+nC+e3iqpYCANCe8qBFJdTJxiLAE3IB5BmSdMzIwRXG51FJE/mv8FgBNKw1egs@gmail.com X-Google-Smtp-Source: AGHT+IEdWGGh42m+qSnoZ753iHo9cc7ojqB4sd3vzWHYxMsgPpHH3riQCIFyBVlyXUdGnw6m27Nc X-Received: by 2002:a05:6512:2813:b0:539:e14b:309c with SMTP id 2adb3069b0e04-53d862bd496mr1346939e87.19.1731066692440; Fri, 08 Nov 2024 03:51:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731066692; cv=none; d=google.com; s=arc-20240605; b=YL0z4GQ9COb/IPSK8WsvMQAfoJVibGEJ05s2E2kJ4oKjQh9olIlitwkUdpxzYqXS8N CWFk8rrEon3RRRJcsLqXWQ28g00O/X78bUGD1L9PVzuUOHJ32/JOjnyoG5L0GHbhomyw t86dp1y/m3w1UaVkw+UQMjZoLnxTaFMvTbO7pPFHFZpvjr8+YDAQuFnbxZaDv5cuDY7q hFuad50G1xZ9cylipmiqrGEQzw5dTvPDwmz+EcIkdqjO2Z0LNtOVh2kp6EbwVRr9fczx X6CovYT3NA/xIT832rWa7D4cwy27nF8nxKYFwmvM/MMpwiVt7FR1dJFqEkSdJfB26PAU zgtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=8KUsL9eXYiNKIJRlrZY+ASr3F0B6uFyp+R6cmnWnXAg=; fh=ylA7vB/iA8muFUzvlzUImw+rp2ODCCq9hl3kedSTahY=; b=YtBL3PKulMzANesSlOgKEtDFTA4BlpCI652C6Pty9SVrRMdfwN1OPj1xYy5CkOH0S6 c+QiLzktlnRu+6e9w3b8syty7pvE7R7V9p5Ld4HDYVUNJU5QpYIuSbyQELZ6iNhBAUsr LAX47rGKJMNBqvM0ut7T2+uGAUxN83L9JLTpicPZoaK8k19nvZZnYzODflOIOo7mpm81 v+BTtpa662JIIL74NAmv7fH3dD8SWMjR7LbkQi5rGLcfHcEDp9Xy7TormAh9W4AjqVvz G5Xjb86FBa4BkEtbYX6x+zuKjMS140XX0osIXYy4UWv/lXN+L41XD0YvGNSgFX2ffVVp IkAg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=SeanHJZ1; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTPS id 2adb3069b0e04-53d826afa2fsi1422583e87.481.2024.11.08.03.51.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 03:51:32 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=SeanHJZ1; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 126EE68DDBC; Fri, 8 Nov 2024 13:51:26 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 672E468C613 for ; Fri, 8 Nov 2024 13:51:19 +0200 (EET) Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4315839a7c9so18815295e9.3 for ; Fri, 08 Nov 2024 03:51:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731066678; x=1731671478; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ieNI/1BXBFxeXJL8Bk6JagWz4shHZqu0rF0yq40v5i4=; b=SeanHJZ17bEZ5mO8/Z9EcdWZQe74bEu/+K7hp1dgHMowcuvdJgXNnOx2uqXO0DQpPN 3h4IxeU3IRJ1JIJqWUd6VUEQZ/pPvLdMJLrKGiEs5t97Wy50ytbgnLFafZSQx5unoHMK vwLyp4Ag2avJlco20qCp1cSfH4ufnm8R1iX+/vnxZCV+WuD8cNYQHlIIkQsEQQxPNXQO q45q2obxyqQMFlOk6x7t14gasptYn22hBZ/VDKI0kQ80Gw3/CHOHnKOTrLvwN4swYhEm EL4ZcWsShHQrTZ2jmSSO22Os3BuFjrsiXCQZtyJv4FKO9DcLp/mZni7agxhXNP5GHJ6M YXyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731066678; x=1731671478; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ieNI/1BXBFxeXJL8Bk6JagWz4shHZqu0rF0yq40v5i4=; b=vWwUPlg8DwhaFedgaDf0Xp+9GVCiiC5QQ7siPGL+C/ris+ElE1EZ3JdoafHx+NrLLG 9igrppxqEDhLQIxzz3lAx819aP3ckG0NaXy/96mQHcBOOU478X6asELwvCNkOW2o8nFh jgJzOMDZjpfptzFgyIRc2tuzEc3QvOTjeyUpWRHHdpmADtzxSUA3scAwSCzXtukjDn7z X6ePX+39Wdv296ED6OXu+zUHzosRWtJxBJihWpKcFouO0lwimFiAs5rYz0dDeiLwI1rg mQw2ojsSn6iA9am4h+/EgMWxYFnid33nAON8JT2EtQiLzV7drNxjSWy4kYbhQ2IwNaaH To0A== X-Gm-Message-State: AOJu0Yz37ni9YKut/TFvveVpC0Fzb57bTi3BSaB1Y9QcS8jbao6w+SP/ mT1Iyt7TDgXwRevsrJCBPrVOg/YpSYJw2ZgcP334d+5BbLZZsvEYFFWCrg== X-Received: by 2002:a05:600c:5124:b0:431:46fe:4cad with SMTP id 5b1f17b1804b1-432b7501d4emr21059095e9.9.1731066678330; Fri, 08 Nov 2024 03:51:18 -0800 (PST) Received: from flagship3.deu.mlau.at (p200300c0270310006fc1140db6601414.dip0.t-ipconnect.de. [2003:c0:2703:1000:6fc1:140d:b660:1414]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432aa70a1d8sm100585895e9.27.2024.11.08.03.51.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 03:51:17 -0800 (PST) From: Manuel Lauss To: ffmpeg-devel@ffmpeg.org Date: Fri, 8 Nov 2024 12:51:14 +0100 Message-ID: <20241108115115.134858-1-manuel.lauss@gmail.com> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] libavcodec/sanm: clear codec47 diff buffers with specific color 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: T0XfomSolSDk The codec47 header provides colors to use to clear the 2 difference buffers. This fixes artifacts (black hair, faces) in Curse of Monkey Island "CURSERNG.SAN" video. Signed-off-by: Manuel Lauss --- libavcodec/sanm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c index 936746ace4..fcf6234d8a 100644 --- a/libavcodec/sanm.c +++ b/libavcodec/sanm.c @@ -915,13 +915,16 @@ static int old_codec47(SANMVideoContext *ctx, int top, uint8_t *dst = (uint8_t *)ctx->frm0 + left + top * stride; 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); int compr = bytestream2_get_byte(&ctx->gb); int new_rot = bytestream2_get_byte(&ctx->gb); int skip = bytestream2_get_byte(&ctx->gb); - bytestream2_skip(&ctx->gb, 9); + bytestream2_skip(&ctx->gb, 7); + auxcol[0] = bytestream2_get_byteu(&ctx->gb); + auxcol[1] = bytestream2_get_byteu(&ctx->gb); decoded_size = bytestream2_get_le32(&ctx->gb); bytestream2_skip(&ctx->gb, 8); @@ -937,8 +940,8 @@ static int old_codec47(SANMVideoContext *ctx, int top, } if (!seq) { ctx->prev_seq = -1; - memset(prev1, 0, ctx->height * stride); - memset(prev2, 0, ctx->height * stride); + memset(prev1, auxcol[0], ctx->height * stride); + memset(prev2, auxcol[1], ctx->height * stride); } switch (compr) { From patchwork Fri Nov 8 11:51:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Lauss X-Patchwork-Id: 52637 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:2fe5:b0:4a6:1c7:11b7 with SMTP id kw5csp2122387vqb; Fri, 8 Nov 2024 04:01:40 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVaQjFo+tcWOJN2gPO7bSoDhoS3/e3fy2FwpA3b1hfE+Lnimuu5EBHljLmbBB2s28jZCDH99MmtSJlDjFQGnmXE@gmail.com X-Google-Smtp-Source: AGHT+IFgk3NwIOdbRobZeINjhsDC70e0iI0L7bTDRYH3X/cYu3znS4I3zYp2jeKklwakqBjBWy5f X-Received: by 2002:ac2:4c4f:0:b0:53a:16b:f14f with SMTP id 2adb3069b0e04-53d862c5a61mr1532312e87.19.1731067299738; Fri, 08 Nov 2024 04:01:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731067299; cv=none; d=google.com; s=arc-20240605; b=TaCAVlAJVONFoNCzIG3brWEfBqI6QeNef+cUE9xHcYp3KkgoxeKnSE7v1BV9RlaSmz UkDh/a8AS+VaJuShs5U6GOYa0P7wqXMNbyJ1LoIdYjsQI1vgHEFShTDka+hu4iQmLz9X z5bDoezb2fvzBPDuPJden6NJ3HNKuGsrAcDYEXj6VUyYmxl42KqY+Hpx+nn4NKhCCzrx wMoPydZjOW2vZEFJgu/8E62807YaHdfXKlp7TCxjNXewI9XQ/p5sS7I1xuCfBCRTsH7a RD0Gii1EoZiSlwmamFksB4NTXiQKcW9LjAy6Ccx2vIXooS05Sx5D5lLnke3wfgIFDHPe VAvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=z8bExwmAfugA4s49MUdXnIeCja2t/vI0XF6asKvprT8=; fh=ylA7vB/iA8muFUzvlzUImw+rp2ODCCq9hl3kedSTahY=; b=AY+axjlEUbZR2GgzOPWgnXyj7HqB1wLwfUD18ZG6taayAevv/obSYl7Po3EPz+gBpj dDmtKn89eXn1E5ZeExIKz6HN8N93ot5glHW8GjW746X3TlMnsOjJqWWbaZxmLUnyO8Ht PBWO9rTdSjhptcYroFUMIR0ctv9EGZEx93+1bqqj7r8tMUJnsGujLEb896Hg2lx9yn+/ w8/5bfPmOeEOFSyBklo5KcIlXKUfIdX8mYI4ZUBYxNynyr4B+KloJ/3QR/AtykT+lfOo KjbBkC6yju5rc9RrQbWRNq2alE+el1SAx5eFuBziVbiztQNCHAzARNAIgT+k3iYRauMp dK/g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=fRK8xxTv; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTPS id 2adb3069b0e04-53d826a8826si1404244e87.200.2024.11.08.04.01.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 04:01:39 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=fRK8xxTv; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5E02B68DDD2; Fri, 8 Nov 2024 13:51:27 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org 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 F245168C7E5 for ; Fri, 8 Nov 2024 13:51:19 +0200 (EET) Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4315df7b43fso17407285e9.0 for ; Fri, 08 Nov 2024 03:51:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731066679; x=1731671479; 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=0KLmDimOVcPefG/CcLLZ4re+huRHm118aOE/UWucttA=; b=fRK8xxTv1L1bNcEx69VfhZOebNIDBeHrPXZYBZbh+aM47eCE38CrJIcRQaO+mYnc7r RPYO4XNLRFO1j31kr6JJIFM2u26/bMhMnio2dhcUivSvA/lqPbyYXWNSiOFQNnZXmw2y UjfC6lMpahGe32IDQgFGMBrUsLIN42wYYEcVR8ajZrkxoD+92SxG8zcmpZhVrpVHzZSF IXANnpMjAEwlCuiEC6wJyFnljqqoo5ytaDMwV3B/h9Lnu4DVTAPgu13xI6S8cbkPJOmr OnesVCBepOADg/Se009GeO1gD2Z0nVjajHXaFEbkWr4Mfk36s3fyadmdYt8CxW7TDqfd C5NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731066679; x=1731671479; 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=0KLmDimOVcPefG/CcLLZ4re+huRHm118aOE/UWucttA=; b=KaAwspQIxUYNsaoljIFe0xulxWrQjXDhMX93afhVLn212ttsPzRfrWfNKLjO3YgFDJ C36woYR29HYfl8hL07wyLmDIU8wOhxxmZDC2kWEvVtTCcBtQ7JYtSldmQJ43cN5dpDud sUBadSsiUgVWbT7sHA5jb3dENvo2ysu9vl8X4Im2CH5zTC+chWW/B5RIkWgZAngBtwQn aUPNAQdLBVYkUbxbYCiz+j7cxIqWkudReAy7IUln4a4ZiQWsmySPR600YNIQpv2JJMdY YDI3l2YSPOw5nPE+NinvmYWjJLndSHxPcFgOC5CFb4m+gOP1t7ZtUg7vFJVBJtB4KQ7+ llNw== X-Gm-Message-State: AOJu0YzbIPTDVDei1zbsjnRO3Cohy4bCo2BwosMdUlr2+ACdgs1cg0Kg YcNIyrcKES0m+fB6LUY3KcG46k1m2J5Ukv9ym0bLwYk8lq1Av7g45nM5Tg== X-Received: by 2002:a05:600c:5251:b0:431:5a0e:fa2e with SMTP id 5b1f17b1804b1-432b7515a08mr18678625e9.21.1731066679049; Fri, 08 Nov 2024 03:51:19 -0800 (PST) Received: from flagship3.deu.mlau.at (p200300c0270310006fc1140db6601414.dip0.t-ipconnect.de. [2003:c0:2703:1000:6fc1:140d:b660:1414]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432aa70a1d8sm100585895e9.27.2024.11.08.03.51.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 03:51:18 -0800 (PST) From: Manuel Lauss To: ffmpeg-devel@ffmpeg.org Date: Fri, 8 Nov 2024 12:51:15 +0100 Message-ID: <20241108115115.134858-2-manuel.lauss@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241108115115.134858-1-manuel.lauss@gmail.com> References: <20241108115115.134858-1-manuel.lauss@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] libavcodec/sanm: codec47: apply top offset also to diff buffers 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: vHyCYFip8OBn SAN FRME objects specify width/height as well as offsets from top/left. These offsets need to be taken into account for the diff buffers as well. Fixes playback of all SAN videos of "Shadows of the Empire", which have a constant top offset of 60 (640x272 video on a 640x480 window) and show tons of ghosting and block artifacts. Signed-off-by: Manuel Lauss --- libavcodec/sanm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c index fcf6234d8a..8bcffb1e90 100644 --- a/libavcodec/sanm.c +++ b/libavcodec/sanm.c @@ -913,8 +913,8 @@ static int old_codec47(SANMVideoContext *ctx, int top, 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; - uint8_t *prev2 = (uint8_t *)ctx->frm2; + uint8_t *prev1 = (uint8_t *)ctx->frm1 + left + top * stride; + uint8_t *prev2 = (uint8_t *)ctx->frm2 + left + top * stride; uint8_t auxcol[2]; int tbl_pos = bytestream2_tell(&ctx->gb); int seq = bytestream2_get_le16(&ctx->gb); @@ -940,8 +940,8 @@ static int old_codec47(SANMVideoContext *ctx, int top, } if (!seq) { ctx->prev_seq = -1; - memset(prev1, auxcol[0], ctx->height * stride); - memset(prev2, auxcol[1], ctx->height * stride); + memset(prev1, auxcol[0], (ctx->height - top) * stride); + memset(prev2, auxcol[1], (ctx->height - top) * stride); } switch (compr) {