summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Worley <connorbworley@gmail.com>2024-01-29 22:26:26 -0800
committerLynne <dev@lynne.ee>2024-02-08 20:36:15 +0100
commit1eeee68d8eb678665730bdd7862598be15867028 (patch)
tree20675e30d6e6c1972b7905e6a4a7fe5f3e01f156
parent3b6a515c5f8f97c9cc4e2cd7a99e12658813a512 (diff)
lavc/dxv: fix incorrect back-reference index calculation in DXT5 decoding
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 <connorbworley@gmail.com>
-rw-r--r--libavcodec/dxv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c
index 1e6791e63f..e1c7cee3e8 100644
--- a/libavcodec/dxv.c
+++ b/libavcodec/dxv.c
@@ -955,7 +955,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));