From patchwork Thu Feb 8 19:07:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Connor Worley X-Patchwork-Id: 46115 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:a586:b0:19e:8a94:b663 with SMTP id gd6csp480151pzc; Thu, 8 Feb 2024 11:07:34 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXJurPeI42ATsmw+UJbhL+dpr0BDTPAFIelJKsaFQBhzLksX6O8N9JftnWSGxLcLbbhzVFwJvuxzyrrRNIK3mSTJoar/dgBA2Ozeg== X-Google-Smtp-Source: AGHT+IHMAvE4lj6aHKzldizkieZZ0Vf18EbNsCb6N6qHM1UfF8mKZN5ES1ihO8NGW3nFwEZMvIUO X-Received: by 2002:a17:906:4910:b0:a38:2fba:f6d1 with SMTP id b16-20020a170906491000b00a382fbaf6d1mr181560ejq.18.1707419253928; Thu, 08 Feb 2024 11:07:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707419253; cv=none; d=google.com; s=arc-20160816; b=jxpV2mwRtHobMJAsOHQ8yY4tAGoRNVSq+KlRaAi9xXY6+aaWI8i8qo/Xj8/Gf0/D/R n7IxuExU0xSKK/oNYjphWenvzZsM3MbRg1B0AM1UiXJ0ijzdXYmdsN39/EG9zRPL1s2N FPUc0MzN3vmrAdSHPhgKfvpZHaNH0/NahEGsch1czVOtTGVqQy7x1btfWD6JORzaa1Lg TGGYJbLiAzM9U8PoQwHB+W2FIBAmJljssCsRWwbGLIey7OlrECSixdQ0z7uPmhUaC/Zn w/oIryBAuduH5iBcnveP1kyxKOVC1rYDFWndUwU3OEQW3S0V8L4zZqTftMiD+d7pS4HE odXw== 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=jcheZ72RW7Mu1BzgmmmAcr2hmXZ0TB9+vGfIToxFRoY=; fh=TOwFuFP/bpvzKD6oEOhwkEFlgibVb7LMTMJTDLtDEI0=; b=jBHH7S6x3urFL0hXLHlBlUnTskC4QYGDvuaef79C7fcVhxwJzK1fHj3UNYbsuncw2D wf6VkGC4pQvRmvJpONICUuQ3jOnZ/k9KI4h0xpIcbyAbt+vDjug+lCzx9qtJn5FKgraZ 5/pF18P0C2yljzGTwlw4jbZrBUZEo+zVjJCyx9IBqpnsfCAxXpgY9IS0LfMYwmcT2Eo5 mlDM9uQh26NGBBb15pXdPnKUKkZ3HgVnfJ/Hc6j8cuPTmhOAa3TcIc5NeVGBdP2uUO+X R6AycjrSbQ2WlDyu3NfugrXS53Ewz52H9iyGj0GqP3nlMzFaeQ6JHGyRZI2z7qGTICdS uHGA==; 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=KZeW75CL; 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 X-Forwarded-Encrypted: i=1; AJvYcCWyv0tJTghEZ6Vng+0o59xhS34kukzSukThrGSezWnRee3+yCgYoAJJRlm8TGqQkdtBYcs9XzU9VohiU+FOFKipObva4+//3BPMpBwFCfErIiXITwe4MG6mqfJE0nuruLcJ6nqmHy7n88WMpcKbikhzK5YrAdbT+jUrRsupEW4ExAzJRKcvxxkzAC5qtXQQO2ASHX5oUYbFN9OPxoIn38O+2fwnSzTBnyoitVPbQedEZYNmm7xuB+C5A6m1N7FIGSoVHiMjCYpeW5TzILbIizQeqvIEeOTN0NqDrVQ7iUHZi94kg/E93OYy9XrkM52T73K3bHq3CHUIR/cFy+YhQ8MIXa/R1E74FvkIanyLmty+adqGHo2VhejX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bC/wW/RrIJaZKLviB1hVwv3HyyIL6KHwZOWGpYmKEU40sXuhyegY1VAlFB0HVDN3zfVte7LIF51j2AMPCWCsIIB9EIz02X9z39xJVCKyuyb4CEFMnVhRpZ3KWh16wT12fwsAheyd52tdcJbIePVdau5+buh1 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ci6-20020a170906c34600b00a37d4912630si305546ejb.1031.2024.02.08.11.07.33; Thu, 08 Feb 2024 11:07:33 -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=KZeW75CL; 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 A2F8468D169; Thu, 8 Feb 2024 21:07:30 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5B54B68CA4C for ; Thu, 8 Feb 2024 21:07:24 +0200 (EET) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1da0cd9c0e5so1547045ad.0 for ; Thu, 08 Feb 2024 11:07:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707419241; x=1708024041; 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=zHxe/mBEImWJqri+p9jKcsQv/sTpihCwgd2vLPldlfM=; b=KZeW75CLRtSpMkR3T0rPisBwzbe18o8cjrTrCzvOI+yWOMEfGJt4UhsNVEdhI5UCl7 XtBpecq4YyeTkLBZKOPGfCL5z8WNL69xhMqD12nDHbKUoUo3ttuA/47e60EbngDTb3ci 5QibMaEKyf/PrDHIefmu1+m2ch2W9Zd6FFUhaFdVvku9mGtwY0euuQoy5X2LiY5YoisG WrOW8n9IQtOzz/pBSEggKeMbEpGuR2Zy39BWNKdXeDUAXgV2qYnmXyrFmBiCIhRIFbGo 8c3UDrqt6z+ghsipTNWBHMOF8mBY8CVUKmnS1RbuaIcfxt1xbC+jxVslQjIsSkL15gW4 KTuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707419241; x=1708024041; 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=zHxe/mBEImWJqri+p9jKcsQv/sTpihCwgd2vLPldlfM=; b=LavSZCAiCDDi9uJjyG1koKgKZXMsl96Weau2mR9bdfvBEVJZwG6P+E0VetdoLzFrle jEaOarU8a2VYUsan+HbxVJZIMbnE3VqV4vK4dNpVq7hnIWY/UZo9D+LJVwyBSilySssv DEM3y0HrBhVP1xO2jBOPv9p5pI9G9UziZ/JG6f7br9kFH9DW8efFy5TQZW25VYj5blXv vwf0z2pGxMe9Yb2FHfkV2gZwwgnukHUxdG4ePTVUAioqIacc8w+OLxNLI4E8141weHOC qR4VzLWVhPX9qg1OQx7wMvMeTn9J9vcKbbCOxXXCPs/C+EsI68KyKZk12eiQPf1s/TxO 9Z8A== X-Gm-Message-State: AOJu0YzLPtVqtP2+ci752KFKpBaWqlZo7i7jH9o87VKUhihwvbBjQQSf opOqgEorrKIpe4w2q4Ku+CIlZ1pN+e8agV4N61pfRGrFwDeP86fi7tgTY+Sjyn8= X-Received: by 2002:a17:90a:77ca:b0:295:aaaa:74fe with SMTP id e10-20020a17090a77ca00b00295aaaa74femr745286pjs.14.1707419241239; Thu, 08 Feb 2024 11:07:21 -0800 (PST) Received: from localhost ([2601:647:4600:84e0:acc2:74e7:bab:f386]) by smtp.gmail.com with UTF8SMTPSA id ga3-20020a17090b038300b0028c89122f8asm126579pjb.6.2024.02.08.11.07.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Feb 2024 11:07:20 -0800 (PST) From: Connor Worley To: ffmpeg-devel@ffmpeg.org Date: Thu, 8 Feb 2024 11:07:08 -0800 Message-Id: <20240208190709.38110-1-connorbworley@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 1/2] lavc/texturedsp: fix premult2straight inversion 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: hI19CPWEueeA This function should convert premultiplied alpha to straight, but does the opposite. Signed-off-by: Connor Worley --- libavcodec/texturedsp.c | 9 ++++++--- tests/ref/fate/dds-dxt2 | 2 +- tests/ref/fate/dds-dxt4 | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libavcodec/texturedsp.c b/libavcodec/texturedsp.c index 5fb79937da..721bfc17f5 100644 --- a/libavcodec/texturedsp.c +++ b/libavcodec/texturedsp.c @@ -175,9 +175,12 @@ static av_always_inline void premult2straight(uint8_t *src) int b = src[2]; int a = src[3]; /* unchanged */ - src[0] = (uint8_t) r * a / 255; - src[1] = (uint8_t) g * a / 255; - src[2] = (uint8_t) b * a / 255; + if (a == 0) + return; + + src[0] = (uint8_t) FFMIN(r * 255 / a, 255); + src[1] = (uint8_t) FFMIN(g * 255 / a, 255); + src[2] = (uint8_t) FFMIN(b * 255 / a, 255); } /** diff --git a/tests/ref/fate/dds-dxt2 b/tests/ref/fate/dds-dxt2 index b5bdfbadc3..1744ef41f6 100644 --- a/tests/ref/fate/dds-dxt2 +++ b/tests/ref/fate/dds-dxt2 @@ -3,4 +3,4 @@ #codec_id 0: rawvideo #dimensions 0: 64x64 #sar 0: 0/1 -0, 0, 0, 1, 16384, 0x11cebeb0 +0, 0, 0, 1, 16384, 0xd7f7241b diff --git a/tests/ref/fate/dds-dxt4 b/tests/ref/fate/dds-dxt4 index 136dfd8006..f22878da56 100644 --- a/tests/ref/fate/dds-dxt4 +++ b/tests/ref/fate/dds-dxt4 @@ -3,4 +3,4 @@ #codec_id 0: rawvideo #dimensions 0: 64x64 #sar 0: 0/1 -0, 0, 0, 1, 16384, 0x31aaacd6 +0, 0, 0, 1, 16384, 0xf18d4216 From patchwork Thu Feb 8 19:07:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Connor Worley X-Patchwork-Id: 46116 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:a586:b0:19e:8a94:b663 with SMTP id gd6csp480246pzc; Thu, 8 Feb 2024 11:07:41 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVBOTiJhbnJZKd5YllI54I0otGFfYvxENbwMExG20KZLeYoOJp/DYMPRnTrglRktIn9nr83DAF+M5Usicg4x+JkyNWWe+kS7swODg== X-Google-Smtp-Source: AGHT+IGlB7dGLP+StquQcfgjh9CXHKJMBenmcXTqYTwrxF/O62D69cleWwVAFItksT55T8RioFjk X-Received: by 2002:aa7:da04:0:b0:55f:8bba:d0ae with SMTP id r4-20020aa7da04000000b0055f8bbad0aemr155946eds.23.1707419261492; Thu, 08 Feb 2024 11:07:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707419261; cv=none; d=google.com; s=arc-20160816; b=bnuoGnkJmfNmkFlad3W008ZaO4NsRg7Ra+Ki88jPsPH7NSJF7l5+U28j6begXF32JG uD9IdlDHP6DPPJ3qctBQBeTz1Yx6lNr0TKxSSSUpLIfcCTXiT+lyBi/6GUlHBlDJKhoI H3F4K4IxP3fjKam56QaMvwrc8/XyJvNL1mq9B7xtkJiWCH9cSSSX9BpMwEuGySSkguRc OXZtEmctdldM81DeUsRNIGokLDM7YldO8KbFF/OHhSqqJpyoUkgISSZEvfijWo5MoNXJ moOBhDV5BYqySCBjEagVhKr1PkgzlGJkdlU0d9sK4cs9YgdN5Tr7xRe/Belf3d051R1O betg== 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:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=OqqRz2r3HfO23VCylf71NE2KWNvd8T/16LBKDYi9m3M=; fh=UlCd7+nofNjw4ENWV2hqHjEAXqB2KsYJ2sOSVSWdV/E=; b=KozbHEPFDQQwbnvKriYwRp8AQyloFQJoqSV/fNo9M1RYU+ZksdRM2EGSw6/yIgfVpo 3BmA4Vq5Mkk3ZKp2zRkqsDBGyqtmZI7IsBv3IxmZSs7y3EuS/H0sR7qZ3K1uVoPkzD5N nff26pMJKJ0qKtmk17EAEXecgdGI8+TbaMETbgA+SN1nMfGWymOqgXk7Rcpn0fgS+aMq CsZeEv9jS5eOOY89xErqYm/pDVgemjuIYRHdb9Oy2QGbPUb0fP+ODqzjgsdq/PPiNtMq UIQr6W4c7CyQ9DMpK++alu3WHc6/1ABdYlBkQnv/7KRszB5TBLnfK1tQPwMNAIEcCN3a 5afA==; 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=L1TQlo0a; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-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ZtagnO+W05LCNvsYLCedXcepeDacJv/i8pqfVBlea0tF8vLXzC22xnf4MkaJlYnSr09GZqLoeIYQoTk1uhnyLjirJli7C3oSg6wWQM/H/oszJf9WDo1VSyePt05bYydGnjBn7b/UgtxKMVYC6dFrgz70QcrHWF/0zL+YvMLbOVXoixf+MhXrpbkL6wchloYH29Qc5GSvOQz21nqAKbpoZbRylO4FY2DrHUqsZ13nN2h2fCrGV3rxyDXOVCUIWT783oYxxVzdCzxWGYJZIUljOi/DCVq5zPqQAr5aFNX7P4qA1PGH96xRi2a8no7XmdnKKmIhDsnMTajwHYr5PI1XRrRM79tALsrYU4+n60navrFZZxCoJhZqkASo2epsTW+g9rBhJfDb5OQ03kOqhW0/mxqdM755dMogHB4obMbML9bWeI3URw8NBA+W93I1kYNDyUUR8az98F7dZyraLoCJjfIP7EFIzvv5mMnGuwrNtzjfo/XgJf2TRh9/mHgUmoKwjxX75ZFViZYWQQyKx07FFnkw+OWGZZPLw4FjvZILJfQx5vOH5hJ8UBGAb5ABu4c7ipSBys7z/cc7SubJBklyv8X/ZOjjI1qJDXn3zcyGbOdzN Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id bm28-20020a0564020b1c00b005605c7b1e98si23462edb.151.2024.02.08.11.07.41; Thu, 08 Feb 2024 11:07:41 -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=L1TQlo0a; 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 9AA8168D17F; Thu, 8 Feb 2024 21:07:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 93A6568C8B4 for ; Thu, 8 Feb 2024 21:07:30 +0200 (EET) Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-6e0311797c5so127725b3a.2 for ; Thu, 08 Feb 2024 11:07:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707419248; x=1708024048; 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=LZ9ZFzhpUw9VO+iQpXw3IxIuzgjNhi8NKuS+B14FuQc=; b=L1TQlo0aRRS7vPNCjs7TMio2hS91ZDvCm9cRx+4h6V7Hr1Rv1mZFmUV+ES7/QH2sQN fYZCBvkiVb/Vk+BvJLgHucDb4biypb7BCib63cWWhAWe6VD1fVOnutZQ6u4FAl7xQhuS KU4KEqMZM35rrg/NTkos1PDHSdqTcrA7QlLcSQ2UOgn7duhjXKWC2wm4Kr2TqsRrcXiH ZoLi4MayyjD/eq6P4pav7HoDRj8IWfS+I6XgvefzST86uJbdv8PhzTgAJHzwKfdweU5A 0GdaVTGDR/HiZ16zfQMs7zVzUHH0U0t2VK5mVVH9nOJtkJN5P44tqMu74iQDlU5lp/Kv fHow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707419248; x=1708024048; 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=LZ9ZFzhpUw9VO+iQpXw3IxIuzgjNhi8NKuS+B14FuQc=; b=YJhXmm/WBjppIS2IzN5xY+6FGF7jtXeGZfk3dBIclBeyoNDSe9leJ17CbTFDu6X0IO RsB6ZBMFfKTM6PKs467gUpe0NX88/S+gGtb4p8htIuHGYfo9s8wRakmRd/+LM73dMR3k Ecx1+2pUC4BrLusTNXibqtPRQ1VD6+d3Bs3zEoste39TyLHwaHg/Ax2pPxeHAZmEqzk+ rFB9MdYqNgxKNaiHuBof0Bl40bhdFc3kXZfCGV9EYTUckx5N2CYd2ohsqL0o+G2rImvv Iw0PgCnLT0fTW3lbEhdui211YI8qxTS6/P+9th4/jQ/UhYD2ZV1PxY6IaB/6RFOa+aD/ 1lLg== X-Gm-Message-State: AOJu0YzSTqmUJYPhrP7CiGjs1PTNZRV+Ly3kIp4HKT6Gxw9K/wRn39uj Fe7KWiOscPPMcxR6CO7y2RlGlzMCj3/IBTgepOewXFkmR34Jh+SD4TSeTpCP31c= X-Received: by 2002:a05:6a00:8e06:b0:6df:e229:8f16 with SMTP id io6-20020a056a008e0600b006dfe2298f16mr187202pfb.17.1707419247782; Thu, 08 Feb 2024 11:07:27 -0800 (PST) Received: from localhost ([2601:647:4600:84e0:acc2:74e7:bab:f386]) by smtp.gmail.com with UTF8SMTPSA id k16-20020aa788d0000000b006e0651ec05csm88491pff.43.2024.02.08.11.07.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Feb 2024 11:07:27 -0800 (PST) From: Connor Worley To: ffmpeg-devel@ffmpeg.org Date: Thu, 8 Feb 2024 11:07:09 -0800 Message-Id: <20240208190709.38110-2-connorbworley@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240208190709.38110-1-connorbworley@gmail.com> References: <20240208190709.38110-1-connorbworley@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 2/2] lavc/dxv: treat DXT5-tagged files as DXT4 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: bxIroNF2DTy7 DXV files seem to misnomer DXT5 and really encode DXT4 with premultiplied alpha. At least, this is what Resolume alley does. To check, encode some input with alpha as "Normal Quality, With Alpha" in Alley, then decode the output with this change -- results are true to the original input compared to git-master. Signed-off-by: Connor Worley --- libavcodec/dxv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c index 5923811b29..1e6791e63f 100644 --- a/libavcodec/dxv.c +++ b/libavcodec/dxv.c @@ -1074,7 +1074,8 @@ static int dxv_decode(AVCodecContext *avctx, AVFrame *frame, break; case MKBETAG('D', 'X', 'T', '5'): decompress_tex = dxv_decompress_dxt5; - ctx->tex_funct = ctx->texdsp.dxt5_block; + /* DXV misnomers DXT5, alpha is premultiplied so use DXT4 instead */ + ctx->tex_funct = ctx->texdsp.dxt4_block; ctx->tex_rat = 4; ctx->tex_step = 16; msgcomp = "DXTR5";