From a102444c9098e8827bc68a895a6da6061543337c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Brzezi=C5=84ski?= Date: Wed, 13 Oct 2021 21:28:58 +0200 Subject: [PATCH] video-converter: Fix v210->I420 last line conversion Last line would not be converted correctly if height was an odd number. Fixed by accounting for data type (8bit vs. 16bit) differences between respective packing and unpacking functions. Part-of: --- .../gst-plugins-base/gst-libs/gst/video/video-converter.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/video/video-converter.c b/subprojects/gst-plugins-base/gst-libs/gst/video/video-converter.c index 9433415eb7..5feb6379a5 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/video/video-converter.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/video/video-converter.c @@ -3953,6 +3953,7 @@ convert_v210_I420 (GstVideoConverter * convert, const GstVideoFrame * src, FConvertTask **tasks_p; gint n_threads; gint lines_per_thread; + guint8 *tmpline_8; /* I420 has half as many chroma lines, as such we have to * always merge two into one. For non-interlaced these are @@ -3992,6 +3993,12 @@ convert_v210_I420 (GstVideoConverter * convert, const GstVideoFrame * src, if (h2 != height) { for (i = h2; i < height; i++) { UNPACK_FRAME (src, convert->tmpline[0], i, convert->in_x, width); + + tmpline_8 = (guint8 *) convert->tmpline[0]; + for (int j = 0; j < width * 4; j++) { + tmpline_8[j] = convert->tmpline[0][j] >> 8; + } + PACK_FRAME (dest, convert->tmpline[0], i, width); } }