diff options
author | wm4 <wm4@nowhere> | 2013-08-06 20:09:31 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-08-06 21:46:47 +0200 |
commit | d40a91e804e19fb32430c5a80a984f5148324f52 (patch) | |
tree | 66bfaa43ac90eb94479ff9a3e4f36e7e1d3f8c8a /video/mp_image.c | |
parent | 57ec67a6cc1a641c8c46b428bd13050f2ebea305 (diff) | |
download | mpv-d40a91e804e19fb32430c5a80a984f5148324f52.tar.bz2 mpv-d40a91e804e19fb32430c5a80a984f5148324f52.tar.xz |
gl_video: handle non-mod-2 4:2:0 YUV video correctly
Allocate textures big enough to include the bottom/right borders (so the
chroma texture sizes are rounded up instead of down). Make the texture
large enough to include the additional luma border. Conceptually, we
pretend that the video frame is fully aligned, and then crop away the
unwanted borders. Filtering (even just bilinear) will access the
borders anyway, so it's possible that we might need to switch to
"harder" cropping instead, but at least pixels not close to the
border should be displayed correctly now.
Add a comment to mp_image.c about this luma border. These semantics are
kind of subtle, and the image allocation code handle this in a subtle
way too, so it's better to document this explicitly. The libavutil
image allocation code does similar things.
Diffstat (limited to 'video/mp_image.c')
-rw-r--r-- | video/mp_image.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/video/mp_image.c b/video/mp_image.c index 0013c132fa..4015f27d4a 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -125,6 +125,10 @@ static void mp_image_alloc_planes(struct mp_image *mpi) { assert(!mpi->planes[0]); + // Note: for non-mod-2 4:2:0 YUV frames, we have to allocate an additional + // top/right border. This is needed for correct handling of such + // images in filter and VO code (e.g. vo_vdpau or vo_opengl). + 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]; |