From patchwork Tue Jan 30 06:26:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Connor Worley X-Patchwork-Id: 45899 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:8786:b0:199:de12:6fa6 with SMTP id ph6csp1975534pzb; Mon, 29 Jan 2024 22:26:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IGgMDOwwlz2rYTfw3EeffrDb8zTdlWXX3kUpXwa6mhu1EJwsjusMcVn3qQnH/i/wTuWl6Lf X-Received: by 2002:a17:906:144b:b0:a30:abba:506e with SMTP id q11-20020a170906144b00b00a30abba506emr6333958ejc.56.1706596009253; Mon, 29 Jan 2024 22:26:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706596009; cv=none; d=google.com; s=arc-20160816; b=ySDp15QA5lsiOHOzt7LwqcUmOIxiPuw4xNgvQ/GVBGlu+k9CX/n6pYy4nfD6L/eNiT w6Klgsv8ZiTXWPJ9+j/t8jHllMjb3w1r14OGURqHY6RFnxf/hdWJl/tsXWbg3+EKAOyb 02y+UrjILc33/QZUyeBxXwcXgc9jIRoiuqgNzUVNTcpu9kSaLuuDT0NnenMfMXodeNCt WxDuZOFVMkWTrYD5x/VkFpzvAfefdhDv63NZQ49XmDOTEsLwJZdTZ4yaog5GzrQyPj1h eb72ilWTnF6e3PrCZO9861/Ji1Y8tHdOkoBnV3OW78GPcnYp2PgyXTEw9QklTTXhhiGE 4tyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=C7To6Fj7HxM+av8Y3Ry3xFt6kUTOfCK0HXQpZQg+tmY=; fh=4o9WedBEbOrq7GvNs0s+TOKeyzmDZRM3O7oe6ZP6vYM=; b=FHdnDUaUOOGKjtgnkpQqq8++derTS9WI3CR5Dtp5pkRr6mhKDJbYQyXhD4cuoxdZp/ bpAKRkt7XWIaKu/EzZqMhfJF7rc039X5SvFnbakFe8KYvCo2+GibWI+daLk60acaVfWy 79Ah6ja17gG2jDaDJHZ48xiBY0QPkXEvkuYa6s3tdIlQc8Q3rFtBeAdVFCyM1H3EKVL/ 0LAUaw3BVEvjZ93r1e1FmPuNc7W4lmdveTJPvfh7zJ8rZ+AOmn5c+AlDOcvke8R1TpOA cOQmLG0943zk9z70IY0udHoAWtQ60BOA8pNL9SB5aanBgrWqHqMq5Ls8tH8sCLKtRJSA d14g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=a5ydgoNi; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z25-20020a1709060ad900b00a34a0163f84si4146563ejf.762.2024.01.29.22.26.48; Mon, 29 Jan 2024 22:26:49 -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=a5ydgoNi; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C0E3B68D24B; Tue, 30 Jan 2024 08:26:46 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-vs1-f49.google.com (mail-vs1-f49.google.com [209.85.217.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9BBC068D1E1 for ; Tue, 30 Jan 2024 08:26:40 +0200 (EET) Received: by mail-vs1-f49.google.com with SMTP id ada2fe7eead31-46b1f0ff2ccso902749137.3 for ; Mon, 29 Jan 2024 22:26:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706595998; x=1707200798; 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=jKx+wLwDzHy8f5t7NY5ixaFhe79YmHxrQ/OTTG/OBl4=; b=a5ydgoNiyTIqR7eHsdTM0w/IA04C5rM8OooqUUPUeW1V/3WQ6lcUk6vQRU5DErRCgB On5NyZAUGwXOz4LfcGKiZ5xV3eXvQB9NFRi8PdAYa7ACmRnyK0aPLWi27wHMfw1RlFIq WvFuvAgCRtIl1tYtoUdQzrZu3h4hdGr2uGFzapQx7Gcus6XycMZv2EITIiO9+3RBdJrr A0hvk026oqgnp/RaPOESpd5+LuSARbj/0gyRAyJyb43QHT2c6SRr2qaFvFdibZRMqq9U MZFSc9pw0Eva32xe2FIJCgyYAmndaoHnv7VRfOoXX6UA4hHm2DAcqENQvmYzW9p0d6qC +hZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706595998; x=1707200798; 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=jKx+wLwDzHy8f5t7NY5ixaFhe79YmHxrQ/OTTG/OBl4=; b=bApqJ9fn/Hk0r/TlGn2KsuEfjzcLnjfhpJb2UiLKKzP9hxzi2NindBLvLn3Rer/sRZ FWlYWqJZi6vM4Zjb2odw1HZ4achUL6CnhfB2hGAHbTwnNnHZhdTuLH18RhsWxMXH3rG3 IQN0DY/hQ26yCg/LDqrh3CY4L6WwijgM9zhDlnRsrbuGPx+4/dVW/F6hdGvy8lGDYZk8 CmnEwOAWqwXLBoMt8at+keB2cAXrsjafUZzXIOQ+8gStbbF3vjXaFIcgUwRNjf42uAFS Ga1Yg1/8CT8lI5YD+fId1O5LQ/Lw2s/YjCG0XWVBC5Wir8lkQoYNu1qG9SFEW7bFAAkQ Ak2A== X-Gm-Message-State: AOJu0YyYo9uEqQmiX4IAnEB8XVwspI0p6Fkrzp8XB2vdzl7cEBPFcbcW D21/xV85pNse1BY6cqR6ckRbVMombgMayJk/qbbK5Kzb/DNWRgETqqqs65UMujI= X-Received: by 2002:a05:6102:41a0:b0:467:fb8c:6ee5 with SMTP id cd32-20020a05610241a000b00467fb8c6ee5mr4202609vsb.49.1706595998164; Mon, 29 Jan 2024 22:26:38 -0800 (PST) Received: from localhost ([2601:647:4600:84e0:cd8b:a23d:3457:1538]) by smtp.gmail.com with UTF8SMTPSA id pt3-20020a17090b3d0300b0028e023be116sm483152pjb.49.2024.01.29.22.26.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Jan 2024 22:26:37 -0800 (PST) From: Connor Worley To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Jan 2024 22:26:26 -0800 Message-Id: <20240130062626.98273-1-connorbworley@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc/dxv: fix incorrect back-reference index calculation in DXT5 decoding 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: Connor Worley Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: pIsN9dZ0s0Tk This bug causes the DXT5 decoder to produce incorrect block texture data. After the fix, textures are visually correct and match data decoded by Resolume Alley (extracted with Nvida Nsight for comparison). Current FATE DXT5 samples did not cover this case. Signed-off-by: Connor Worley --- libavcodec/dxv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c index b29adf8ad9..be1216da86 100644 --- a/libavcodec/dxv.c +++ b/libavcodec/dxv.c @@ -755,7 +755,7 @@ static int dxv_decompress_dxt5(AVCodecContext *avctx) break; case 2: /* Copy two dwords from a previous index */ - idx = 8 + bytestream2_get_le16(gbc); + idx = 8 + 4 * bytestream2_get_le16(gbc); if (idx > pos || (unsigned int)(pos - idx) + 2 > ctx->tex_size / 4) return AVERROR_INVALIDDATA; prev = AV_RL32(ctx->tex_data + 4 * (pos - idx));