[MPlayer-cvslog] r38402 - trunk/libmpcodecs/mp_image.c
reimar
subversion at mplayerhq.hu
Thu Sep 1 21:12:17 EEST 2022
Author: reimar
Date: Thu Sep 1 21:12:17 2022
New Revision: 38402
Log:
mp_image.c: fix allocation size for formats with odd width.
At the very least chroma_width might be rounded up.
Just allocate for the next larger even width.
Modified:
trunk/libmpcodecs/mp_image.c
Modified: trunk/libmpcodecs/mp_image.c
==============================================================================
--- trunk/libmpcodecs/mp_image.c Thu Sep 1 15:21:18 2022 (r38401)
+++ trunk/libmpcodecs/mp_image.c Thu Sep 1 21:12:17 2022 (r38402)
@@ -51,8 +51,12 @@ void mp_image_alloc_planes(mp_image_t *m
}
mpi->planes[0]=av_malloc(mpi->bpp*mpi->width*(mpi->height+2)/8+
mpi->chroma_width*mpi->chroma_height);
- } else
- mpi->planes[0]=av_malloc(mpi->bpp*mpi->width*(mpi->height+2)/8);
+ } else {
+ // for odd width round up to be on the safe side,
+ // required in particular for planar formats
+ int alloc_w = mpi->width + (mpi->width & 1);
+ mpi->planes[0]=av_malloc(mpi->bpp*alloc_w*(mpi->height+2)/8);
+ }
if (mpi->flags&MP_IMGFLAG_PLANAR) {
int bpp = IMGFMT_IS_YUVP16(mpi->imgfmt)? 2 : 1;
// YV12/I420/YVU9/IF09. feel free to add other planar formats here...
More information about the MPlayer-cvslog
mailing list