[gst-cvs] gst-plugins-base: videoscale: Don' t read after the end of a line when lineary scaling YUYV/UYVY
Sebastian Dröge
slomo at kemper.freedesktop.org
Sun Mar 29 02:54:36 PDT 2009
Module: gst-plugins-base
Branch: master
Commit: b69231ad214b28a267c3e14ce66c27e2b124ba7e
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=b69231ad214b28a267c3e14ce66c27e2b124ba7e
Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date: Sat Mar 28 11:27:56 2009 +0100
videoscale: Don't read after the end of a line when lineary scaling YUYV/UYVY
Partially fixes bug #577054.
---
gst/videoscale/vs_scanline.c | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/gst/videoscale/vs_scanline.c b/gst/videoscale/vs_scanline.c
index 9a04572..6e8576c 100644
--- a/gst/videoscale/vs_scanline.c
+++ b/gst/videoscale/vs_scanline.c
@@ -280,10 +280,16 @@ vs_scanline_resample_linear_YUYV (uint8_t * dest, uint8_t * src, int n,
j = acc >> 17;
x = acc & 0x1ffff;
- dest[i * 4 + 1] =
- (src[j * 4 + 1] * (131072 - x) + src[j * 4 + 5] * x) >> 17;
- dest[i * 4 + 3] =
- (src[j * 4 + 3] * (131072 - x) + src[j * 4 + 7] * x) >> 17;
+
+ if (i < n - 1) {
+ dest[i * 4 + 1] =
+ (src[j * 4 + 1] * (131072 - x) + src[j * 4 + 5] * x) >> 17;
+ dest[i * 4 + 3] =
+ (src[j * 4 + 3] * (131072 - x) + src[j * 4 + 7] * x) >> 17;
+ } else {
+ dest[i * 4 + 1] = src[j * 4 + 1];
+ dest[i * 4 + 3] = src[j * 4 + 3];
+ }
acc += increment;
@@ -379,10 +385,16 @@ vs_scanline_resample_linear_UYVY (uint8_t * dest, uint8_t * src, int n,
j = acc >> 17;
x = acc & 0x1ffff;
- dest[i * 4 + 0] =
- (src[j * 4 + 0] * (131072 - x) + src[j * 4 + 4] * x) >> 17;
- dest[i * 4 + 2] =
- (src[j * 4 + 2] * (131072 - x) + src[j * 4 + 6] * x) >> 17;
+
+ if (i < n - 1) {
+ dest[i * 4 + 0] =
+ (src[j * 4 + 0] * (131072 - x) + src[j * 4 + 4] * x) >> 17;
+ dest[i * 4 + 2] =
+ (src[j * 4 + 2] * (131072 - x) + src[j * 4 + 6] * x) >> 17;
+ } else {
+ dest[i * 4 + 0] = src[j * 4 + 0];
+ dest[i * 4 + 2] = src[j * 4 + 2];
+ }
acc += increment;
More information about the Gstreamer-commits
mailing list