From 3bc1467e7b8f98426ecf95b95252c445e54eae2f Mon Sep 17 00:00:00 2001 From: Erich Seifert Date: Fri, 23 Oct 2026 04:08:52 +0200 Subject: [PATCH] Fix padding of planar 10 and 16 bit images in the resize filter The padding in resize_image() only handles packed formats, so only yuv420p was switched to yuv422 when the image needed padding. yuv420p10, yuv444p10 and yuv422p16 were padded as if they were packed, which garbled the whole frame, for example when rendering a portrait clip with pix_fmt=yuv420p10le in a landscape profile. Request rgba64 for these formats instead, which keeps the bit depth. --- src/modules/core/filter_resize.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/modules/core/filter_resize.c b/src/modules/core/filter_resize.c index 63fca69ff7..1fffebd8ae 100644 --- a/src/modules/core/filter_resize.c +++ b/src/modules/core/filter_resize.c @@ -1,6 +1,6 @@ /* * filter_resize.c -- resizing filter - * Copyright (C) 2003-2025 Meltytech, LLC + * Copyright (C) 2003-2026 Meltytech, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -276,8 +276,20 @@ static int filter_get_image(mlt_frame frame, mlt_properties_set_int(properties, "resize_height", *height); // If there will be padding, then we need packed image format. - if (*format == mlt_image_yuv420p && (owidth < *width || oheight < *height)) { - *format = mlt_image_yuv422; + if (owidth < *width || oheight < *height) { + switch (*format) { + case mlt_image_yuv420p: + *format = mlt_image_yuv422; + break; + case mlt_image_yuv420p10: + case mlt_image_yuv444p10: + case mlt_image_yuv422p16: + // Keep the bit depth + *format = mlt_image_rgba64; + break; + default: + break; + } } // Now get the image