From 7587e1224ae9f93fbb3a6340afc8092bbc67a450 Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Mon, 22 Jun 2026 11:10:40 +0100 Subject: [PATCH] libavcodec/dxv.c: handle widths not a multiple of 16 The Resolume DXV codec is based on 4x4 pixel DXT1/DXT5/BC4/BC5 blocks, so it's natural to assume that files would be padded to multiples of 4 in width and height. But in practice .mov files produced by the Resolume software are always padded to multiples of 16 in width and height, so FFmpeg currently decodes them incorrectly. When encoding FFmpeg already pads both width and height to 16 so no change is required - see libavcodec/dxvenc.c:37-40 (commit d4556c98f02e4f2d3deb86efeb060ebe4659be96): /* * Resolume will refuse to display frames that are not padded to 16x16 pixels. */ #define DXV_ALIGN(x) FFALIGN(x, 16) Signed-off-by: Jonathan Harris --- libavcodec/dxv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c index 344c7b2f3c..bae46cdee0 100644 --- a/libavcodec/dxv.c +++ b/libavcodec/dxv.c @@ -1089,8 +1089,8 @@ static av_cold int dxv_init(AVCodecContext *avctx) return ret; } - /* Since codec is based on 4x4 blocks, size is aligned to 4 */ - avctx->coded_width = FFALIGN(avctx->width, TEXTURE_BLOCK_W); + /* Codec is based on 4x4 blocks, but in practice width is aligned to 16 */ + avctx->coded_width = FFALIGN(avctx->width, 16); avctx->coded_height = FFALIGN(avctx->height, TEXTURE_BLOCK_H); ff_texturedsp_init(&ctx->texdsp);