summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2022-02-24 15:49:30 +0100
committerNiklas Haas <github-daiK1o@haasn.dev>2022-02-24 18:36:28 +0100
commite6c18641bd52375bc3429ec2771f4fdfede5dc1e (patch)
treec2017bbb4807248dbe29a71ceb7617a11b0b4517
parent57f42cee84aa5b48eb2db32e8b429796a3d7fb11 (diff)
downloadmpv-e6c18641bd52375bc3429ec2771f4fdfede5dc1e.tar.bz2
mpv-e6c18641bd52375bc3429ec2771f4fdfede5dc1e.tar.xz
mp_image: fix mp_image_plane_w/h
These helpers, for some reason, decided to round the returned values up to multiples of the nearest plane alignment. This logic makes no sense to me, and completely breaks any sort of oddly-sized mp_image. This logic was introduced, presumably in error and without real justification, as part of a major refactor commit (caee8748), As far as I can tell, removing it again doesn't regress anything. Fixes several serious bugs including buffer underflows and GPU crashes in vo_gpu and vo_gpu_next.
-rw-r--r--video/mp_image.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/video/mp_image.c b/video/mp_image.c
index 11539eb7c7..176497627e 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -218,15 +218,13 @@ int mp_chroma_div_up(int size, int shift)
// Return the storage width in pixels of the given plane.
int mp_image_plane_w(struct mp_image *mpi, int plane)
{
- return mp_chroma_div_up(MP_ALIGN_UP(mpi->w, mpi->fmt.align_x),
- mpi->fmt.xs[plane]);
+ return mp_chroma_div_up(mpi->w, mpi->fmt.xs[plane]);
}
// Return the storage height in pixels of the given plane.
int mp_image_plane_h(struct mp_image *mpi, int plane)
{
- return mp_chroma_div_up(MP_ALIGN_UP(mpi->h, mpi->fmt.align_y),
- mpi->fmt.ys[plane]);
+ return mp_chroma_div_up(mpi->h, mpi->fmt.ys[plane]);
}
// Caller has to make sure this doesn't exceed the allocated plane data/strides.