Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] lavc/dxv: fix incorrect back-reference index calculation in DXT5 decoding
@ 2024-01-30  6:26 Connor Worley
  2024-01-30  6:29 ` Connor Worley
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Connor Worley @ 2024-01-30  6:26 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Connor Worley

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>
---
 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));
-- 
2.40.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".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH] lavc/dxv: fix incorrect back-reference index calculation in DXT5 decoding
  2024-01-30  6:26 [FFmpeg-devel] [PATCH] lavc/dxv: fix incorrect back-reference index calculation in DXT5 decoding Connor Worley
@ 2024-01-30  6:29 ` Connor Worley
  2024-02-01 20:41 ` Connor Worley
  2024-02-05  6:31 ` Connor Worley
  2 siblings, 0 replies; 5+ messages in thread
From: Connor Worley @ 2024-01-30  6:29 UTC (permalink / raw)
  To: ffmpeg-devel

[-- Attachment #1: Type: text/plain, Size: 1368 bytes --]

Attached are the input file used for comparison with Alley, and
before-and-after images generated with
`ffmpeg -i dice_dxt5.mov -f image2 out.png`

On Mon, Jan 29, 2024 at 10:26 PM Connor Worley <connorbworley@gmail.com>
wrote:

> 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>
> ---
>  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));
> --
> 2.40.1
>
>

-- 
Connor Worley

[-- Attachment #2: dice_dxt5.mov --]
[-- Type: video/quicktime, Size: 132318 bytes --]

[-- Attachment #3: bug.png --]
[-- Type: image/png, Size: 258957 bytes --]

[-- Attachment #4: fix.png --]
[-- Type: image/png, Size: 232816 bytes --]

[-- Attachment #5: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH] lavc/dxv: fix incorrect back-reference index calculation in DXT5 decoding
  2024-01-30  6:26 [FFmpeg-devel] [PATCH] lavc/dxv: fix incorrect back-reference index calculation in DXT5 decoding Connor Worley
  2024-01-30  6:29 ` Connor Worley
@ 2024-02-01 20:41 ` Connor Worley
  2024-02-01 21:15   ` Paul B Mahol
  2024-02-05  6:31 ` Connor Worley
  2 siblings, 1 reply; 5+ messages in thread
From: Connor Worley @ 2024-02-01 20:41 UTC (permalink / raw)
  To: ffmpeg-devel

Got some confirmation that this patch fixes
https://trac.ffmpeg.org/ticket/10264

-- 
Connor Worley
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH] lavc/dxv: fix incorrect back-reference index calculation in DXT5 decoding
  2024-02-01 20:41 ` Connor Worley
@ 2024-02-01 21:15   ` Paul B Mahol
  0 siblings, 0 replies; 5+ messages in thread
From: Paul B Mahol @ 2024-02-01 21:15 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Thu, Feb 1, 2024 at 9:41 PM Connor Worley <connorbworley@gmail.com>
wrote:

> Got some confirmation that this patch fixes
> https://trac.ffmpeg.org/ticket/10264
>
>
Thanks for the fix. I had encountered similar artifacts but failed to fix
it, and then removed files long ago, but i got them from the web so will
recheck if this indeed fixes it too.


> --
> Connor Worley
> _______________________________________________
> 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".
>
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH] lavc/dxv: fix incorrect back-reference index calculation in DXT5 decoding
  2024-01-30  6:26 [FFmpeg-devel] [PATCH] lavc/dxv: fix incorrect back-reference index calculation in DXT5 decoding Connor Worley
  2024-01-30  6:29 ` Connor Worley
  2024-02-01 20:41 ` Connor Worley
@ 2024-02-05  6:31 ` Connor Worley
  2 siblings, 0 replies; 5+ messages in thread
From: Connor Worley @ 2024-02-05  6:31 UTC (permalink / raw)
  To: ffmpeg-devel

Given that Paul is no longer a maintainer, can someone else please take a
look?

-- 
Connor Worley
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-05  6:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-30  6:26 [FFmpeg-devel] [PATCH] lavc/dxv: fix incorrect back-reference index calculation in DXT5 decoding Connor Worley
2024-01-30  6:29 ` Connor Worley
2024-02-01 20:41 ` Connor Worley
2024-02-01 21:15   ` Paul B Mahol
2024-02-05  6:31 ` Connor Worley

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git