mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
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.
This commit is contained in:
parent
77ff8c9fdb
commit
4cb1a6bd3a
2 changed files with 13 additions and 42 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2006-02-28 Edward Hervey <edward@fluendo.com>
|
||||||
|
|
||||||
|
* 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 <wim@fluendo.com>
|
2006-02-28 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst-libs/gst/audio/gstbaseaudiosink.c:
|
* gst-libs/gst/audio/gstbaseaudiosink.c:
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
|
|
||||||
#include <liboil/liboil.h>
|
#include <liboil/liboil.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
/* greyscale, i.e., single componenet */
|
/* greyscale, i.e., single componenet */
|
||||||
|
|
||||||
|
@ -115,57 +114,22 @@ void
|
||||||
vs_scanline_resample_nearest_RGBA (guint8 * dest, guint8 * src, int n,
|
vs_scanline_resample_nearest_RGBA (guint8 * dest, guint8 * src, int n,
|
||||||
int *accumulator, int increment)
|
int *accumulator, int increment)
|
||||||
{
|
{
|
||||||
guint8 *tmpsrc;
|
|
||||||
int acc = *accumulator;
|
int acc = *accumulator;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
/* Optimization Pass #1 :
|
for (i = 0; i < n; i++) {
|
||||||
* - Unroll loop by 16
|
|
||||||
* - Pointer arithmetics (most CPUs have DAGs !)
|
|
||||||
* - Avoid useless branching
|
|
||||||
*/
|
|
||||||
for (i = 0, tmpsrc = src; i < n; i++) {
|
|
||||||
j = acc >> 16;
|
j = acc >> 16;
|
||||||
x = acc & 0xffff;
|
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) {
|
acc += increment;
|
||||||
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++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- 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;
|
*accumulator = acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue