From b2a7ac27668dd572ab881b768bd3237a4875f8cf Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 2 Mar 2015 16:33:09 +0100 Subject: [PATCH] video-converter: v-resample enough pixels When we are using the fast linear resampler, use the ->inc to calculate the first and last pixel we need so that we can do vertical resampling on the right amount of pixels. --- gst-libs/gst/video/video-converter.c | 2 +- gst-libs/gst/video/video-scaler.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gst-libs/gst/video/video-converter.c b/gst-libs/gst/video/video-converter.c index dc8b6a7..c1c9f3b 100644 --- a/gst-libs/gst/video/video-converter.c +++ b/gst-libs/gst/video/video-converter.c @@ -1849,7 +1849,7 @@ setup_borderline (GstVideoConverter * convert) } w_sub = 0; if (out_finfo->n_planes == 1) { - /* for packet formats, convert based on subsampling so that we + /* for packed formats, convert based on subsampling so that we * get a complete group of pixels */ for (i = 0; i < out_finfo->n_components; i++) { w_sub = MAX (w_sub, out_finfo->w_sub[i]); diff --git a/gst-libs/gst/video/video-scaler.c b/gst-libs/gst/video/video-scaler.c index c5cb34f..3853869 100644 --- a/gst-libs/gst/video/video-scaler.c +++ b/gst-libs/gst/video/video-scaler.c @@ -1467,10 +1467,15 @@ gst_video_scaler_2d (GstVideoScaler * hscale, GstVideoScaler * vscale, } } else { guint vx, vw; + guint h_taps; - vx = hscale->resampler.offset[x]; - vw = hscale->resampler.offset[x + width - 1] + - hscale->resampler.max_taps; + h_taps = hscale->resampler.max_taps; + + vx = (hscale->inc * x) >> 16; + vx = MIN (vx, hscale->resampler.offset[x]); + vw = (hscale->inc * (x + width)) >> 16; + vw = MAX (vw, hscale->resampler.offset[x + width - 1] + h_taps); + vw += 1; if (vscale->tmpwidth < vw) realloc_tmplines (vscale, n_elems, vw); -- 2.7.4