video-scaler: fix YUY2 scaling some more
authorWim Taymans <wtaymans@redhat.com>
Tue, 21 Apr 2015 11:31:44 +0000 (13:31 +0200)
committerWim Taymans <wtaymans@redhat.com>
Tue, 21 Apr 2015 11:31:44 +0000 (13:31 +0200)
Take into account the different steps between Y and UV when calculating
the line size for vertical resampling or else we might not resample
enough pixels and leave bad lines.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=747790

gst-libs/gst/video/video-scaler.c

index 07c92b0..abef4af 100644 (file)
@@ -1480,16 +1480,23 @@ gst_video_scaler_2d (GstVideoScaler * hscale, GstVideoScaler * vscale,
           vfunc (vscale, lines, LINE (dest, dest_stride, i), i, width, n_elems);
         }
       } else {
-        guint vx, vw;
+        guint vx, vw, w1;
         guint h_taps;
 
         h_taps = hscale->resampler.max_taps;
+        w1 = x + width - 1;
 
         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] + (mult * h_taps));
+        if (hscale->merged) {
+          if ((w1 & 1) == hscale->out_y_offset)
+            vw = MAX (vw, hscale->resampler.offset[w1] + (2 * h_taps));
+          else
+            vw = MAX (vw, hscale->resampler.offset[w1] + (4 * h_taps));
+        } else {
+          vw = MAX (vw, hscale->resampler.offset[w1] + h_taps);
+        }
         vw += 1;
 
         if (vscale->tmpwidth < vw)