summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2013-09-10 11:31:57 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2013-09-10 16:24:55 +0200
commitc8cbcb6f02f27d23caf3d9d6bd0370073b7cab53 (patch)
tree5f089c0f6cf77c32081ae387e13244e1bac9f7b6
parent7b3ca538fd9ddc146795f79b7eb420db78e02885 (diff)
videoscale: pick nearest line in scaling
Use rounding to pick the nearest line instead of rounding down.
-rw-r--r--gst/videoscale/vs_image.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/gst/videoscale/vs_image.c b/gst/videoscale/vs_image.c
index bcd0d9892..00096fdef 100644
--- a/gst/videoscale/vs_image.c
+++ b/gst/videoscale/vs_image.c
@@ -65,7 +65,7 @@ vs_image_scale_nearest_RGBA (const VSImage * dest, const VSImage * src,
acc = 0;
prev_j = -1;
for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
+ j = (acc + 0x8000) >> 16;
if (j == prev_j) {
memcpy (dest->pixels + i * dest->stride,
@@ -160,7 +160,7 @@ vs_image_scale_nearest_RGB (const VSImage * dest, const VSImage * src,
acc = 0;
for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
+ j = (acc + 0x8000) >> 16;
xacc = 0;
vs_scanline_resample_nearest_RGB (dest->pixels + i * dest->stride,
@@ -290,7 +290,7 @@ vs_image_scale_nearest_YUYV (const VSImage * dest, const VSImage * src,
acc = 0;
for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
+ j = (acc + 0x8000) >> 16;
xacc = 0;
vs_scanline_resample_nearest_YUYV (dest->pixels + i * dest->stride,
@@ -420,7 +420,7 @@ vs_image_scale_nearest_UYVY (const VSImage * dest, const VSImage * src,
acc = 0;
for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
+ j = (acc + 0x8000) >> 16;
xacc = 0;
vs_scanline_resample_nearest_UYVY (dest->pixels + i * dest->stride,
@@ -550,7 +550,7 @@ vs_image_scale_nearest_NV12 (const VSImage * dest, const VSImage * src,
acc = 0;
for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
+ j = (acc + 0x8000) >> 16;
xacc = 0;
vs_scanline_resample_nearest_NV12 (dest->pixels + i * dest->stride,
@@ -679,7 +679,7 @@ vs_image_scale_nearest_Y (const VSImage * dest, const VSImage * src,
acc = 0;
for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
+ j = (acc + 0x8000) >> 16;
video_scale_orc_resample_nearest_u8 (dest->pixels + i * dest->stride,
src->pixels + j * src->stride, 0, x_increment, dest->width);
@@ -806,7 +806,7 @@ vs_image_scale_nearest_Y16 (const VSImage * dest, const VSImage * src,
acc = 0;
for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
+ j = (acc + 0x8000) >> 16;
xacc = 0;
vs_scanline_resample_nearest_Y16 (dest->pixels + i * dest->stride,
@@ -936,7 +936,7 @@ vs_image_scale_nearest_RGB565 (const VSImage * dest, const VSImage * src,
acc = 0;
for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
+ j = (acc + 0x8000) >> 16;
xacc = 0;
vs_scanline_resample_nearest_RGB565 (dest->pixels + i * dest->stride,
@@ -1066,7 +1066,7 @@ vs_image_scale_nearest_RGB555 (const VSImage * dest, const VSImage * src,
acc = 0;
for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
+ j = (acc + 0x8000) >> 16;
xacc = 0;
vs_scanline_resample_nearest_RGB555 (dest->pixels + i * dest->stride,
@@ -1196,7 +1196,7 @@ vs_image_scale_nearest_AYUV64 (const VSImage * dest, const VSImage * src,
acc = 0;
prev_j = -1;
for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
+ j = (acc + 0x8000) >> 16;
if (j == prev_j) {
memcpy (dest->pixels + i * dest->stride,