diff options
author | Niklas Haas <git@haasn.dev> | 2023-10-19 17:53:30 +0200 |
---|---|---|
committer | Niklas Haas <github-daiK1o@haasn.dev> | 2023-10-19 18:26:05 +0200 |
commit | f369e6526186c38bb7d86669a3963b216d6fe0bc (patch) | |
tree | a24beb8ecc079c8fdc9a7f0d82a923e2c9c58234 /video/decode | |
parent | 50cd363c01efab0ced53cfdeed2e9169fcfad7ac (diff) | |
download | mpv-f369e6526186c38bb7d86669a3963b216d6fe0bc.tar.bz2 mpv-f369e6526186c38bb7d86669a3963b216d6fe0bc.tar.xz |
vd_lavc: align buffers to multiple of image size
Fixes: https://github.com/mpv-player/mpv/issues/12672
Diffstat (limited to 'video/decode')
-rw-r--r-- | video/decode/vd_lavc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 74d0b3c94d..31879d069a 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -1022,6 +1022,13 @@ static int get_buffer2_direct(AVCodecContext *avctx, AVFrame *pic, int flags) for (int n = 0; n < AV_NUM_DATA_POINTERS; n++) stride_align = MPMAX(stride_align, linesize_align[n]); + // Note: texel sizes may be NPOT, so use full lcm instead of max + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pic->format); + if (!(desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)) { + for (int n = 0; n < desc->nb_components; n++) + stride_align = mp_lcm(stride_align, desc->comp[n].step); + } + int imgfmt = pixfmt2imgfmt(pic->format); if (!imgfmt) goto fallback; |