summaryrefslogtreecommitdiffstats
path: root/video/zimg.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/zimg.c')
-rw-r--r--video/zimg.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/video/zimg.c b/video/zimg.c
index c3560a0ff7..be2953c58c 100644
--- a/video/zimg.c
+++ b/video/zimg.c
@@ -268,7 +268,14 @@ static bool wrap_buffer(struct mp_zimg_state *st, struct mp_zimg_repack *r,
if (r->pack) {
mpi = &r->cropped_tmp;
*mpi = *a_mpi;
- mp_image_crop(mpi, 0, st->slice_y, mpi->w, st->slice_y + st->slice_h);
+ int y1 = st->slice_y + st->slice_h;
+ // Due to subsampling we may assume the image to be bigger than it
+ // actually is (see real_h in setup_format).
+ if (mpi->h < y1) {
+ assert(y1 - mpi->h < 4);
+ mp_image_set_size(mpi, mpi->w, y1);
+ }
+ mp_image_crop(mpi, 0, st->slice_y, mpi->w, y1);
}
bool direct[MP_MAX_PLANES] = {0};