diff options
author | wm4 <wm4@nowhere> | 2013-05-17 23:45:55 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-05-17 23:45:55 +0200 |
commit | e40ae27a87b03fa559d6deffd16472c6452f2ebc (patch) | |
tree | bd2befb4d3b71ad564bd8caf077efae034ae5e77 /video | |
parent | 883d03fffd961bdb47ac8d256cb42a6c56cd5cda (diff) | |
download | mpv-e40ae27a87b03fa559d6deffd16472c6452f2ebc.tar.bz2 mpv-e40ae27a87b03fa559d6deffd16472c6452f2ebc.tar.xz |
mp_image: align image allocation height
vo_vdpau actually reads past the image allocation when displaying a
non-mod 2 420p image. The vdpau API specifies that VdpVideoSurfacePutBitsYCbCr()
requires a height that is a multiple of 4, and surface allocations are
automatically rounded.
So allocate video images with rounded height. libavutil does the same,
so images coming directly from the decoder or from libavfilter are no
problem. (libavutil does this alginment explicitly, not just because the
decoded image size is aligned to macroblocks.)
Diffstat (limited to 'video')
-rw-r--r-- | video/mp_image.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/video/mp_image.c b/video/mp_image.c index 5b443b5ccd..d0be9d4ded 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -102,9 +102,10 @@ static void mp_image_alloc_planes(struct mp_image *mpi) size_t plane_size[MP_MAX_PLANES]; for (int n = 0; n < MP_MAX_PLANES; n++) { + int alloc_h = MP_ALIGN_UP(mpi->h, 32) >> mpi->fmt.ys[n]; int line_bytes = (mpi->plane_w[n] * mpi->fmt.bpp[n] + 7) / 8; mpi->stride[n] = FFALIGN(line_bytes, SWS_MIN_BYTE_ALIGN); - plane_size[n] = mpi->stride[n] * mpi->plane_h[n]; + plane_size[n] = mpi->stride[n] * alloc_h; } if (mpi->imgfmt == IMGFMT_PAL8) plane_size[1] = MP_PALETTE_SIZE; |