From 4cb1a6bd3a530b7944d26dd407954fe26dea10e2 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 28 Feb 2006 12:19:11 +0000 Subject: [PATCH] gst/videoscale/vs_scanline.c: Revert optimization in videoscale. It should go in liboil and have an appropriate liboi... Original commit message from CVS: * gst/videoscale/vs_scanline.c: (vs_scanline_resample_nearest_RGBA): Revert optimization in videoscale. It should go in liboil and have an appropriate liboil function. --- ChangeLog | 7 ++++++ gst/videoscale/vs_scanline.c | 48 +++++------------------------------- 2 files changed, 13 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0b95338b6..852c34aecf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-02-28 Edward Hervey + + * gst/videoscale/vs_scanline.c: + (vs_scanline_resample_nearest_RGBA): + Revert optimization in videoscale. It should go in liboil and have + an appropriate liboil function. + 2006-02-28 Wim Taymans * gst-libs/gst/audio/gstbaseaudiosink.c: diff --git a/gst/videoscale/vs_scanline.c b/gst/videoscale/vs_scanline.c index cb2c28d7b8..d3c6e102aa 100644 --- a/gst/videoscale/vs_scanline.c +++ b/gst/videoscale/vs_scanline.c @@ -29,7 +29,6 @@ #include #include -#include /* greyscale, i.e., single componenet */ @@ -115,57 +114,22 @@ void vs_scanline_resample_nearest_RGBA (guint8 * dest, guint8 * src, int n, int *accumulator, int increment) { - guint8 *tmpsrc; int acc = *accumulator; int i; int j; int x; - /* Optimization Pass #1 : - * - Unroll loop by 16 - * - Pointer arithmetics (most CPUs have DAGs !) - * - Avoid useless branching - */ - for (i = 0, tmpsrc = src; i < n; i++) { + for (i = 0; i < n; i++) { j = acc >> 16; x = acc & 0xffff; + dest[i * 4 + 0] = (x < 32768) ? src[j * 4 + 0] : src[j * 4 + 4]; + dest[i * 4 + 1] = (x < 32768) ? src[j * 4 + 1] : src[j * 4 + 5]; + dest[i * 4 + 2] = (x < 32768) ? src[j * 4 + 2] : src[j * 4 + 6]; + dest[i * 4 + 3] = (x < 32768) ? src[j * 4 + 3] : src[j * 4 + 7]; - if (x < 32768) { - tmpsrc = src + j * 4; - *dest++ = *tmpsrc++; - - /* We do it here to avoid low-level instruction locks */ - acc += increment; - - *dest++ = *tmpsrc++; - *dest++ = *tmpsrc++; - *dest++ = *tmpsrc++; - } else { - tmpsrc = src + (j + 1) * 4;; - *dest++ = *tmpsrc++; - - /* We do it here to avoid low-level instruction locks */ - acc += increment; - - *dest++ = *tmpsrc++; - *dest++ = *tmpsrc++; - *dest++ = *tmpsrc++; - } + acc += increment; } - /* --- Unoptimized code BEGIN --- - for (i = 0; i < n; i++) { - j = acc >> 16; - x = acc & 0xffff; - dest[i * 4 + 0] = (x < 32768) ? src[j * 4 + 0] : src[j * 4 + 4]; - dest[i * 4 + 1] = (x < 32768) ? src[j * 4 + 1] : src[j * 4 + 5]; - dest[i * 4 + 2] = (x < 32768) ? src[j * 4 + 2] : src[j * 4 + 6]; - dest[i * 4 + 3] = (x < 32768) ? src[j * 4 + 3] : src[j * 4 + 7]; - - acc += increment; - } - --- Unoptimized code END --- */ - *accumulator = acc; }