Re: [PATCH] libavcodec/dxv.c: handle widths not a multiple of 16

Emma Worley via ffmpeg-devel <[email protected]>
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <CAFQzNw5yJox-f=+kQpTWJwDSNh51+AibDbx4JuZKDs8Dzm=Faw@mail.gmail.com>
LGTM, will apply.

On Mon, Jun 22, 2026 at 3:11 AM Jonathan Harris via ffmpeg-devel <
[email protected]> wrote:

> 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 <[email protected]>
> ---
>   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);
> --
> 2.53.0
>
> _______________________________________________
> ffmpeg-devel mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
>


-- 
Best regards,
Emma Worley
_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.