From 10b3b88e9cc414fd8fce6f1545b55f43c28d0396 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 3 Sep 2013 15:42:44 +0200 Subject: [PATCH] videoconvert: fix handling of chroma resample Increase the number of temporary lines that we need, it is possible that the up and downsampling offsets are out of phase and that we need to keep some extra lines around. Also copy the unhandled output lines for the next round instead of overwriting them. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=706823 --- gst/videoconvert/videoconvert.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gst/videoconvert/videoconvert.c b/gst/videoconvert/videoconvert.c index a745e7c9bb..22be66513d 100644 --- a/gst/videoconvert/videoconvert.c +++ b/gst/videoconvert/videoconvert.c @@ -422,7 +422,7 @@ videoconvert_convert_compute_resample (VideoConvert * convert) convert->downsample, out_info->chroma_site, convert->down_offset, convert->down_n_lines); - lines = MAX (convert->down_n_lines, convert->up_n_lines); + lines = convert->down_n_lines + convert->up_n_lines; convert->n_tmplines = lines; convert->tmplines = g_malloc (lines * sizeof (gpointer)); @@ -499,7 +499,7 @@ videoconvert_convert_generic (VideoConvert * convert, GstVideoFrame * dest, up_offset = convert->up_offset; down_n_lines = convert->down_n_lines; down_offset = convert->down_offset; - max_lines = MAX (down_n_lines, up_n_lines); + max_lines = convert->n_tmplines; in_lines = 0; out_lines = 0; @@ -592,6 +592,12 @@ videoconvert_convert_generic (VideoConvert * convert, GstVideoFrame * dest, start += down_n_lines; out_lines -= down_n_lines; } + /* we didn't process these lines, move them up for the next round */ + for (j = 0; j < out_lines; j++) { + GST_DEBUG ("move line %d->%d", j + start, j); + out_tmplines[j] = out_tmplines[j + start]; + } + up_offset += up_n_lines; } if ((pal =