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
This commit is contained in:
Wim Taymans 2013-09-03 15:42:44 +02:00
parent cfb7b51c08
commit 10b3b88e9c

View file

@ -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 =