From 67a4702b194c899e65fbabe11825759057538f74 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 4 Nov 2014 11:02:49 +0100 Subject: [PATCH] video-scaler: fix taps in interlaced mode --- gst-libs/gst/video/video-scaler.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/video/video-scaler.c b/gst-libs/gst/video/video-scaler.c index 121e6b6bc1..bfc4d6c6b7 100644 --- a/gst-libs/gst/video/video-scaler.c +++ b/gst-libs/gst/video/video-scaler.c @@ -283,7 +283,7 @@ resampler_convert_coeff (const gdouble * src, static void make_s16_taps (GstVideoScaler * scale, gint precision) { - gint i, j, max_taps, n_phases, out_size; + gint i, j, max_taps, n_phases, out_size, src_inc; gint16 *taps_s16, *taps_s16_4; gdouble *taps; guint32 *phase, *offset, *offset_n; @@ -291,6 +291,13 @@ make_s16_taps (GstVideoScaler * scale, gint precision) n_phases = scale->resampler.n_phases; max_taps = scale->resampler.max_taps; + if (scale->flags & GST_VIDEO_SCALER_FLAG_INTERLACED) + src_inc = 2; + else + src_inc = 1; + + max_taps /= src_inc; + taps = scale->resampler.taps; taps_s16 = scale->taps_s16 = g_malloc (sizeof (gint16) * n_phases * max_taps); @@ -312,11 +319,12 @@ make_s16_taps (GstVideoScaler * scale, gint precision) offset_n = scale->offset_n = g_malloc (sizeof (guint32) * out_size * max_taps); + for (j = 0; j < max_taps; j++) { for (i = 0; i < out_size; i++) { gint16 tap; - offset_n[j * out_size + i] = offset[i] + j; + offset_n[j * out_size + i] = offset[i] + j * src_inc; tap = taps_s16[phase[i] * max_taps + j]; taps_s16_4[(j * out_size + i) * 4 + 0] = tap; taps_s16_4[(j * out_size + i) * 4 + 1] = tap; -- 2.34.1