From e40ae27a87b03fa559d6deffd16472c6452f2ebc Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 17 May 2013 23:45:55 +0200 Subject: 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.) --- video/mp_image.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'video') 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; -- cgit v1.2.3