mirror of https://github.com/mpv-player/mpv
vd_lavc: align buffers to multiple of image size
Fixes: https://github.com/mpv-player/mpv/issues/12672
This commit is contained in:
parent
50cd363c01
commit
f369e65261
|
@ -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++)
|
for (int n = 0; n < AV_NUM_DATA_POINTERS; n++)
|
||||||
stride_align = MPMAX(stride_align, linesize_align[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);
|
int imgfmt = pixfmt2imgfmt(pic->format);
|
||||||
if (!imgfmt)
|
if (!imgfmt)
|
||||||
goto fallback;
|
goto fallback;
|
||||||
|
|
|
@ -356,8 +356,8 @@ struct vo_driver {
|
||||||
* allocated image. It's even possible that only 1 plane uses the buffer
|
* allocated image. It's even possible that only 1 plane uses the buffer
|
||||||
* allocated by the get_image function. The VO has to check for this.
|
* allocated by the get_image function. The VO has to check for this.
|
||||||
*
|
*
|
||||||
* stride_align is always a value >=1 that is a power of 2. The stride
|
* stride_align is always a value >=1. The stride values of the returned
|
||||||
* values of the returned image must be divisible by this value.
|
* image must be divisible by this value. This may be a non power of two.
|
||||||
*
|
*
|
||||||
* flags is a combination of VO_DR_FLAG_* flags.
|
* flags is a combination of VO_DR_FLAG_* flags.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue