mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
gst/videoscale/: Add a 4-tap image scaler. Theoretically looks much prettier.
Original commit message from CVS: * gst/videoscale/Makefile.am: * gst/videoscale/gstvideoscale.c: * gst/videoscale/gstvideoscale.h: * gst/videoscale/vs_4tap.c: * gst/videoscale/vs_4tap.h: * gst/videoscale/vs_image.c: * gst/videoscale/vs_image.h: * gst/videoscale/vs_scanline.c: * gst/videoscale/vs_scanline.h: Add a 4-tap image scaler. Theoretically looks much prettier. The tap calculation could use some improvement.
This commit is contained in:
parent
d24ad6ac0a
commit
25d874ec9b
10 changed files with 396 additions and 165 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2006-11-14 David Schleef <ds@schleef.org>
|
||||
|
||||
* gst/videoscale/Makefile.am:
|
||||
* gst/videoscale/gstvideoscale.c:
|
||||
* gst/videoscale/gstvideoscale.h:
|
||||
* gst/videoscale/vs_4tap.c:
|
||||
* gst/videoscale/vs_4tap.h:
|
||||
* gst/videoscale/vs_image.c:
|
||||
* gst/videoscale/vs_image.h:
|
||||
* gst/videoscale/vs_scanline.c:
|
||||
* gst/videoscale/vs_scanline.h:
|
||||
Add a 4-tap image scaler. Theoretically looks much prettier.
|
||||
The tap calculation could use some improvement.
|
||||
|
||||
2006-11-14 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
Patch by: Jan David Mol <j dot j dot d dot mol at tudelft dot nl>
|
||||
|
|
|
@ -3,7 +3,8 @@ plugin_LTLIBRARIES = libgstvideoscale.la
|
|||
libgstvideoscale_la_SOURCES = \
|
||||
gstvideoscale.c \
|
||||
vs_image.c \
|
||||
vs_scanline.c
|
||||
vs_scanline.c \
|
||||
vs_4tap.c
|
||||
|
||||
libgstvideoscale_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(LIBOIL_CFLAGS)
|
||||
libgstvideoscale_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||
|
@ -14,4 +15,5 @@ libgstvideoscale_la_LIBADD = \
|
|||
noinst_HEADERS = \
|
||||
gstvideoscale.h \
|
||||
vs_image.h \
|
||||
vs_scanline.h
|
||||
vs_scanline.h \
|
||||
vs_4tap.h
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
|
||||
#include "gstvideoscale.h"
|
||||
#include "vs_image.h"
|
||||
#include "vs_4tap.h"
|
||||
|
||||
|
||||
/* debug variable definition */
|
||||
|
@ -141,6 +142,7 @@ gst_video_scale_method_get_type (void)
|
|||
static const GEnumValue video_scale_methods[] = {
|
||||
{GST_VIDEO_SCALE_NEAREST, "Nearest Neighbour", "nearest-neighbour"},
|
||||
{GST_VIDEO_SCALE_BILINEAR, "Bilinear", "bilinear"},
|
||||
{GST_VIDEO_SCALE_4TAP, "4-tap", "4-tap"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
|
@ -513,7 +515,7 @@ gst_video_scale_set_caps (GstBaseTransform * trans, GstCaps * in, GstCaps * out)
|
|||
if (videoscale->tmp_buf)
|
||||
g_free (videoscale->tmp_buf);
|
||||
|
||||
videoscale->tmp_buf = g_malloc (videoscale->dest.stride * 2);
|
||||
videoscale->tmp_buf = g_malloc (videoscale->dest.stride * 4);
|
||||
|
||||
/* FIXME: par */
|
||||
GST_DEBUG_OBJECT (videoscale, "from=%dx%d, size %d -> to=%dx%d, size %d",
|
||||
|
@ -681,7 +683,7 @@ gst_video_scale_prepare_image (gint format, GstBuffer * buf,
|
|||
img_u->pixels = img->pixels + GST_ROUND_UP_2 (img->height) * img->stride;
|
||||
img_u->height = GST_ROUND_UP_2 (img->height) / 2;
|
||||
img_u->width = GST_ROUND_UP_2 (img->width) / 2;
|
||||
img_u->stride = GST_ROUND_UP_4 (img->stride / 2);
|
||||
img_u->stride = GST_ROUND_UP_4 (img_u->width);
|
||||
memcpy (img_v, img_u, sizeof (*img_v));
|
||||
img_v->pixels = img_u->pixels + img_u->height * img_u->stride;
|
||||
break;
|
||||
|
@ -789,8 +791,6 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
|
|||
case GST_VIDEO_SCALE_I420:
|
||||
case GST_VIDEO_SCALE_YV12:
|
||||
vs_image_scale_linear_Y (dest, src, videoscale->tmp_buf);
|
||||
//memset (dest_u.pixels, 128, dest_u.stride * dest_u.height);
|
||||
//memset (dest_v.pixels, 128, dest_v.stride * dest_v.height);
|
||||
vs_image_scale_linear_Y (&dest_u, &src_u, videoscale->tmp_buf);
|
||||
vs_image_scale_linear_Y (&dest_v, &src_v, videoscale->tmp_buf);
|
||||
break;
|
||||
|
@ -804,6 +804,18 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
|
|||
goto unsupported;
|
||||
}
|
||||
break;
|
||||
case GST_VIDEO_SCALE_4TAP:
|
||||
switch (videoscale->format) {
|
||||
case GST_VIDEO_SCALE_I420:
|
||||
case GST_VIDEO_SCALE_YV12:
|
||||
vs_image_scale_4tap_Y (dest, src, videoscale->tmp_buf);
|
||||
vs_image_scale_4tap_Y (&dest_u, &src_u, videoscale->tmp_buf);
|
||||
vs_image_scale_4tap_Y (&dest_v, &src_v, videoscale->tmp_buf);
|
||||
break;
|
||||
default:
|
||||
goto unsupported;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto unknown_mode;
|
||||
}
|
||||
|
@ -880,6 +892,8 @@ plugin_init (GstPlugin * plugin)
|
|||
GST_DEBUG_CATEGORY_INIT (video_scale_debug, "videoscale", 0,
|
||||
"videoscale element");
|
||||
|
||||
vs_4tap_init ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,12 +45,14 @@ GST_DEBUG_CATEGORY_EXTERN (video_scale_debug);
|
|||
* GstVideoScaleMethod:
|
||||
* @GST_VIDEO_SCALE_NEAREST: use nearest neighbour scaling (fast and ugly)
|
||||
* @GST_VIDEO_SCALE_BILINEAR: use bilinear scaling (slower but prettier).
|
||||
* @GST_VIDEO_SCALE_4TAP: use a 4-tap filter for scaling (slow).
|
||||
*
|
||||
* The videoscale method to use.
|
||||
*/
|
||||
typedef enum {
|
||||
GST_VIDEO_SCALE_NEAREST,
|
||||
GST_VIDEO_SCALE_BILINEAR,
|
||||
GST_VIDEO_SCALE_4TAP
|
||||
} GstVideoScaleMethod;
|
||||
|
||||
typedef struct _GstVideoScale GstVideoScale;
|
||||
|
|
186
gst/videoscale/vs_4tap.c
Normal file
186
gst/videoscale/vs_4tap.c
Normal file
|
@ -0,0 +1,186 @@
|
|||
/*
|
||||
* Image Scaling Functions (4 tap)
|
||||
* Copyright (c) 2005 David A. Schleef <ds@schleef.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "vs_image.h"
|
||||
#include "vs_scanline.h"
|
||||
|
||||
#include <liboil/liboil.h>
|
||||
#include <math.h>
|
||||
|
||||
#define SHIFT 10
|
||||
|
||||
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#define CLAMP(x,a,b) MAX(MIN((x),(b)),(a))
|
||||
|
||||
int16_t vs_4tap_taps[256][4];
|
||||
|
||||
double
|
||||
vs_4tap_func (double x)
|
||||
{
|
||||
#if 0
|
||||
if (x < -1)
|
||||
return 0;
|
||||
if (x > 1)
|
||||
return 0;
|
||||
if (x < 0)
|
||||
return 1 + x;
|
||||
return 1 - x;
|
||||
#endif
|
||||
#if 0
|
||||
if (x == 0)
|
||||
return 1;
|
||||
return sin (M_PI * x) / (M_PI * x) * (1 - 0.25 * x * x);
|
||||
#endif
|
||||
#if 1
|
||||
if (x == 0)
|
||||
return 1;
|
||||
return sin (M_PI * x) / (M_PI * x);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
vs_4tap_init (void)
|
||||
{
|
||||
int i;
|
||||
double a, b, c, d;
|
||||
double sum;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
a = vs_4tap_func (-1 - i / 256.0);
|
||||
b = vs_4tap_func (0 - i / 256.0);
|
||||
c = vs_4tap_func (1 - i / 256.0);
|
||||
d = vs_4tap_func (2 - i / 256.0);
|
||||
sum = a + b + c + d;
|
||||
|
||||
vs_4tap_taps[i][0] = rint ((1 << SHIFT) * (a / sum));
|
||||
vs_4tap_taps[i][1] = rint ((1 << SHIFT) * (b / sum));
|
||||
vs_4tap_taps[i][2] = rint ((1 << SHIFT) * (c / sum));
|
||||
vs_4tap_taps[i][3] = rint ((1 << SHIFT) * (d / sum));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
vs_scanline_resample_4tap_Y (uint8_t * dest, uint8_t * src,
|
||||
int n, int *xacc, int increment)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int acc;
|
||||
int x;
|
||||
int y;
|
||||
|
||||
acc = *xacc;
|
||||
for (i = 0; i < n; i++) {
|
||||
j = acc >> 16;
|
||||
x = (acc & 0xff00) >> 8;
|
||||
y = (vs_4tap_taps[x][0] * src[MAX (j - 1, 0)] +
|
||||
vs_4tap_taps[x][1] * src[j] +
|
||||
vs_4tap_taps[x][2] * src[j + 1] +
|
||||
vs_4tap_taps[x][3] * src[j + 2] + (1 << (SHIFT - 1))) >> SHIFT;
|
||||
if (y < 0)
|
||||
y = 0;
|
||||
if (y > 255)
|
||||
y = 255;
|
||||
dest[i] = y;
|
||||
acc += increment;
|
||||
}
|
||||
*xacc = acc;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_4tap_Y (uint8_t * dest, uint8_t * src1, uint8_t * src2,
|
||||
uint8_t * src3, uint8_t * src4, int n, int acc)
|
||||
{
|
||||
int i;
|
||||
int y;
|
||||
|
||||
acc = (acc >> 8) & 0xff;
|
||||
for (i = 0; i < n; i++) {
|
||||
y = (vs_4tap_taps[acc][0] * src1[i] +
|
||||
vs_4tap_taps[acc][1] * src2[i] +
|
||||
vs_4tap_taps[acc][2] * src3[i] +
|
||||
vs_4tap_taps[acc][3] * src4[i] + (1 << (SHIFT - 1))) >> SHIFT;
|
||||
if (y < 0)
|
||||
y = 0;
|
||||
if (y > 255)
|
||||
y = 255;
|
||||
dest[i] = y;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
vs_image_scale_4tap_Y (const VSImage * dest, const VSImage * src,
|
||||
uint8_t * tmpbuf)
|
||||
{
|
||||
int yacc;
|
||||
int y_increment;
|
||||
int x_increment;
|
||||
int i;
|
||||
int j;
|
||||
int xacc;
|
||||
int k;
|
||||
|
||||
y_increment = ((src->height - 1) << 16) / (dest->height - 1);
|
||||
x_increment = ((src->width - 1) << 16) / (dest->width - 1);
|
||||
|
||||
k = 0;
|
||||
for (i = 0; i < 4; i++) {
|
||||
xacc = 0;
|
||||
vs_scanline_resample_4tap_Y (tmpbuf + i * dest->width,
|
||||
src->pixels + i * src->stride, dest->width, &xacc, x_increment);
|
||||
}
|
||||
|
||||
yacc = 0;
|
||||
for (i = 0; i < dest->height; i++) {
|
||||
uint8_t *t0, *t1, *t2, *t3;
|
||||
|
||||
j = yacc >> 16;
|
||||
|
||||
if (j > k) {
|
||||
k++;
|
||||
if (k + 3 < src->height) {
|
||||
xacc = 0;
|
||||
vs_scanline_resample_4tap_Y (tmpbuf + ((k + 3) & 3) * dest->width,
|
||||
src->pixels + (k + 3) * src->stride,
|
||||
dest->width, &xacc, x_increment);
|
||||
}
|
||||
}
|
||||
|
||||
t0 = tmpbuf + (CLAMP (j - 1, 0, src->height - 1) & 3) * dest->width;
|
||||
t1 = tmpbuf + (CLAMP (j, 0, src->height - 1) & 3) * dest->width;
|
||||
t2 = tmpbuf + (CLAMP (j + 1, 0, src->height - 1) & 3) * dest->width;
|
||||
t3 = tmpbuf + (CLAMP (j + 2, 0, src->height - 1) & 3) * dest->width;
|
||||
vs_scanline_merge_4tap_Y (dest->pixels + i * dest->stride,
|
||||
t0, t1, t2, t3, dest->width, yacc & 0xffff);
|
||||
|
||||
yacc += y_increment;
|
||||
}
|
||||
}
|
44
gst/videoscale/vs_4tap.h
Normal file
44
gst/videoscale/vs_4tap.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Image Scaling Functions (4 tap)
|
||||
* Copyright (c) 2005 David A. Schleef <ds@schleef.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _VS_4TAP_H_
|
||||
#define _VS_4TAP_H_
|
||||
|
||||
#include "vs_image.h"
|
||||
|
||||
#include <liboil/liboil.h>
|
||||
|
||||
void vs_4tap_init (void);
|
||||
void vs_scanline_resample_4tap_Y (uint8_t *dest, uint8_t *src,
|
||||
int n, int *xacc, int increment);
|
||||
void vs_scanline_merge_4tap_Y (uint8_t *dest, uint8_t *src1, uint8_t *src2,
|
||||
uint8_t *src3, uint8_t *src4, int n, int acc);
|
||||
void vs_image_scale_4tap_Y (const VSImage * dest, const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
#endif
|
||||
|
|
@ -25,7 +25,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "vs_scanline.h"
|
||||
|
@ -37,7 +36,7 @@
|
|||
|
||||
void
|
||||
vs_image_scale_nearest_RGBA (const VSImage * dest, const VSImage * src,
|
||||
guint8 * tmpbuf)
|
||||
uint8_t * tmpbuf)
|
||||
{
|
||||
int acc;
|
||||
int y_increment;
|
||||
|
@ -65,13 +64,13 @@ vs_image_scale_nearest_RGBA (const VSImage * dest, const VSImage * src,
|
|||
|
||||
void
|
||||
vs_image_scale_linear_RGBA (const VSImage * dest, const VSImage * src,
|
||||
guint8 * tmpbuf)
|
||||
uint8_t * tmpbuf)
|
||||
{
|
||||
int acc;
|
||||
int y_increment;
|
||||
int x_increment;
|
||||
guint8 *tmp1;
|
||||
guint8 *tmp2;
|
||||
uint8_t *tmp1;
|
||||
uint8_t *tmp2;
|
||||
int y1;
|
||||
int y2;
|
||||
int i;
|
||||
|
@ -153,7 +152,7 @@ vs_image_scale_linear_RGBA (const VSImage * dest, const VSImage * src,
|
|||
|
||||
void
|
||||
vs_image_scale_nearest_RGB (const VSImage * dest, const VSImage * src,
|
||||
guint8 * tmpbuf)
|
||||
uint8_t * tmpbuf)
|
||||
{
|
||||
int acc;
|
||||
int y_increment;
|
||||
|
@ -181,13 +180,13 @@ vs_image_scale_nearest_RGB (const VSImage * dest, const VSImage * src,
|
|||
|
||||
void
|
||||
vs_image_scale_linear_RGB (const VSImage * dest, const VSImage * src,
|
||||
guint8 * tmpbuf)
|
||||
uint8_t * tmpbuf)
|
||||
{
|
||||
int acc;
|
||||
int y_increment;
|
||||
int x_increment;
|
||||
guint8 *tmp1;
|
||||
guint8 *tmp2;
|
||||
uint8_t *tmp1;
|
||||
uint8_t *tmp2;
|
||||
int y1;
|
||||
int y2;
|
||||
int i;
|
||||
|
@ -270,7 +269,7 @@ vs_image_scale_linear_RGB (const VSImage * dest, const VSImage * src,
|
|||
|
||||
void
|
||||
vs_image_scale_nearest_YUYV (const VSImage * dest, const VSImage * src,
|
||||
guint8 * tmpbuf)
|
||||
uint8_t * tmpbuf)
|
||||
{
|
||||
int acc;
|
||||
int y_increment;
|
||||
|
@ -300,13 +299,13 @@ vs_image_scale_nearest_YUYV (const VSImage * dest, const VSImage * src,
|
|||
|
||||
void
|
||||
vs_image_scale_linear_YUYV (const VSImage * dest, const VSImage * src,
|
||||
guint8 * tmpbuf)
|
||||
uint8_t * tmpbuf)
|
||||
{
|
||||
int acc;
|
||||
int y_increment;
|
||||
int x_increment;
|
||||
guint8 *tmp1;
|
||||
guint8 *tmp2;
|
||||
uint8_t *tmp1;
|
||||
uint8_t *tmp2;
|
||||
int y1;
|
||||
int y2;
|
||||
int i;
|
||||
|
@ -388,7 +387,7 @@ vs_image_scale_linear_YUYV (const VSImage * dest, const VSImage * src,
|
|||
|
||||
void
|
||||
vs_image_scale_nearest_UYVY (const VSImage * dest, const VSImage * src,
|
||||
guint8 * tmpbuf)
|
||||
uint8_t * tmpbuf)
|
||||
{
|
||||
int acc;
|
||||
int y_increment;
|
||||
|
@ -418,13 +417,13 @@ vs_image_scale_nearest_UYVY (const VSImage * dest, const VSImage * src,
|
|||
|
||||
void
|
||||
vs_image_scale_linear_UYVY (const VSImage * dest, const VSImage * src,
|
||||
guint8 * tmpbuf)
|
||||
uint8_t * tmpbuf)
|
||||
{
|
||||
int acc;
|
||||
int y_increment;
|
||||
int x_increment;
|
||||
guint8 *tmp1;
|
||||
guint8 *tmp2;
|
||||
uint8_t *tmp1;
|
||||
uint8_t *tmp2;
|
||||
int y1;
|
||||
int y2;
|
||||
int i;
|
||||
|
@ -506,7 +505,7 @@ vs_image_scale_linear_UYVY (const VSImage * dest, const VSImage * src,
|
|||
|
||||
void
|
||||
vs_image_scale_nearest_Y (const VSImage * dest, const VSImage * src,
|
||||
guint8 * tmpbuf)
|
||||
uint8_t * tmpbuf)
|
||||
{
|
||||
int acc;
|
||||
int y_increment;
|
||||
|
@ -534,13 +533,13 @@ vs_image_scale_nearest_Y (const VSImage * dest, const VSImage * src,
|
|||
|
||||
void
|
||||
vs_image_scale_linear_Y (const VSImage * dest, const VSImage * src,
|
||||
guint8 * tmpbuf)
|
||||
uint8_t * tmpbuf)
|
||||
{
|
||||
int acc;
|
||||
int y_increment;
|
||||
int x_increment;
|
||||
guint8 *tmp1;
|
||||
guint8 *tmp2;
|
||||
uint8_t *tmp1;
|
||||
uint8_t *tmp2;
|
||||
int y1;
|
||||
int y2;
|
||||
int i;
|
||||
|
@ -623,7 +622,7 @@ vs_image_scale_linear_Y (const VSImage * dest, const VSImage * src,
|
|||
|
||||
void
|
||||
vs_image_scale_nearest_RGB565 (const VSImage * dest, const VSImage * src,
|
||||
guint8 * tmpbuf)
|
||||
uint8_t * tmpbuf)
|
||||
{
|
||||
int acc;
|
||||
int y_increment;
|
||||
|
@ -651,13 +650,13 @@ vs_image_scale_nearest_RGB565 (const VSImage * dest, const VSImage * src,
|
|||
|
||||
void
|
||||
vs_image_scale_linear_RGB565 (const VSImage * dest, const VSImage * src,
|
||||
guint8 * tmpbuf)
|
||||
uint8_t * tmpbuf)
|
||||
{
|
||||
int acc;
|
||||
int y_increment;
|
||||
int x_increment;
|
||||
guint8 *tmp1;
|
||||
guint8 *tmp2;
|
||||
uint8_t *tmp1;
|
||||
uint8_t *tmp2;
|
||||
int y1;
|
||||
int y2;
|
||||
int i;
|
||||
|
@ -740,7 +739,7 @@ vs_image_scale_linear_RGB565 (const VSImage * dest, const VSImage * src,
|
|||
|
||||
void
|
||||
vs_image_scale_nearest_RGB555 (const VSImage * dest, const VSImage * src,
|
||||
guint8 * tmpbuf)
|
||||
uint8_t * tmpbuf)
|
||||
{
|
||||
int acc;
|
||||
int y_increment;
|
||||
|
@ -768,13 +767,13 @@ vs_image_scale_nearest_RGB555 (const VSImage * dest, const VSImage * src,
|
|||
|
||||
void
|
||||
vs_image_scale_linear_RGB555 (const VSImage * dest, const VSImage * src,
|
||||
guint8 * tmpbuf)
|
||||
uint8_t * tmpbuf)
|
||||
{
|
||||
int acc;
|
||||
int y_increment;
|
||||
int x_increment;
|
||||
guint8 *tmp1;
|
||||
guint8 *tmp2;
|
||||
uint8_t *tmp1;
|
||||
uint8_t *tmp2;
|
||||
int y1;
|
||||
int y2;
|
||||
int i;
|
||||
|
|
|
@ -28,55 +28,51 @@
|
|||
#ifndef __VS_IMAGE_H__
|
||||
#define __VS_IMAGE_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct _VSImage VSImage;
|
||||
|
||||
struct _VSImage {
|
||||
guint8 *pixels;
|
||||
uint8_t *pixels;
|
||||
int width;
|
||||
int height;
|
||||
int stride;
|
||||
};
|
||||
|
||||
void vs_image_scale_nearest_RGBA (const VSImage *dest, const VSImage *src,
|
||||
guint8 *tmpbuf);
|
||||
uint8_t *tmpbuf);
|
||||
void vs_image_scale_linear_RGBA (const VSImage *dest, const VSImage *src,
|
||||
guint8 *tmpbuf);
|
||||
uint8_t *tmpbuf);
|
||||
|
||||
void vs_image_scale_nearest_RGB (const VSImage *dest, const VSImage *src,
|
||||
guint8 *tmpbuf);
|
||||
uint8_t *tmpbuf);
|
||||
void vs_image_scale_linear_RGB (const VSImage *dest, const VSImage *src,
|
||||
guint8 *tmpbuf);
|
||||
uint8_t *tmpbuf);
|
||||
|
||||
void vs_image_scale_nearest_YUYV (const VSImage *dest, const VSImage *src,
|
||||
guint8 *tmpbuf);
|
||||
uint8_t *tmpbuf);
|
||||
void vs_image_scale_linear_YUYV (const VSImage *dest, const VSImage *src,
|
||||
guint8 *tmpbuf);
|
||||
uint8_t *tmpbuf);
|
||||
|
||||
void vs_image_scale_nearest_UYVY (const VSImage *dest, const VSImage *src,
|
||||
guint8 *tmpbuf);
|
||||
uint8_t *tmpbuf);
|
||||
void vs_image_scale_linear_UYVY (const VSImage *dest, const VSImage *src,
|
||||
guint8 *tmpbuf);
|
||||
uint8_t *tmpbuf);
|
||||
|
||||
void vs_image_scale_nearest_Y (const VSImage *dest, const VSImage *src,
|
||||
guint8 *tmpbuf);
|
||||
uint8_t *tmpbuf);
|
||||
void vs_image_scale_linear_Y (const VSImage *dest, const VSImage *src,
|
||||
guint8 *tmpbuf);
|
||||
uint8_t *tmpbuf);
|
||||
|
||||
void vs_image_scale_nearest_RGB565 (const VSImage *dest, const VSImage *src,
|
||||
guint8 *tmpbuf);
|
||||
uint8_t *tmpbuf);
|
||||
void vs_image_scale_linear_RGB565 (const VSImage *dest, const VSImage *src,
|
||||
guint8 *tmpbuf);
|
||||
uint8_t *tmpbuf);
|
||||
|
||||
void vs_image_scale_nearest_RGB555 (const VSImage *dest, const VSImage *src,
|
||||
guint8 *tmpbuf);
|
||||
uint8_t *tmpbuf);
|
||||
void vs_image_scale_linear_RGB555 (const VSImage *dest, const VSImage *src,
|
||||
guint8 *tmpbuf);
|
||||
|
||||
G_END_DECLS
|
||||
uint8_t *tmpbuf);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -28,12 +28,11 @@
|
|||
#include "vs_scanline.h"
|
||||
|
||||
#include <liboil/liboil.h>
|
||||
#include <glib.h>
|
||||
|
||||
/* greyscale, i.e., single componenet */
|
||||
|
||||
void
|
||||
vs_scanline_downsample_Y (guint8 * dest, guint8 * src, int n)
|
||||
vs_scanline_downsample_Y (uint8_t * dest, uint8_t * src, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -43,7 +42,7 @@ vs_scanline_downsample_Y (guint8 * dest, guint8 * src, int n)
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_Y (guint8 * dest, guint8 * src, int n,
|
||||
vs_scanline_resample_nearest_Y (uint8_t * dest, uint8_t * src, int n,
|
||||
int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
|
@ -63,7 +62,7 @@ vs_scanline_resample_nearest_Y (guint8 * dest, guint8 * src, int n,
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_linear_Y (guint8 * dest, guint8 * src, int n,
|
||||
vs_scanline_resample_linear_Y (uint8_t * dest, uint8_t * src, int n,
|
||||
int *accumulator, int increment)
|
||||
{
|
||||
uint32_t vals[2];
|
||||
|
@ -77,28 +76,19 @@ vs_scanline_resample_linear_Y (guint8 * dest, guint8 * src, int n,
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_linear_Y (guint8 * dest, guint8 * src1, guint8 * src2,
|
||||
vs_scanline_merge_linear_Y (uint8_t * dest, uint8_t * src1, uint8_t * src2,
|
||||
int n, int x)
|
||||
{
|
||||
/* FIXME after liboil-0.3.7 is released */
|
||||
#ifdef oil_merge_linear_u8
|
||||
uint32_t value = x >> 8;
|
||||
|
||||
oil_merge_linear_u8 (dest, src1, src2, &value, n);
|
||||
#else
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
dest[i] = (src1[i] * (65536 - x) + src2[i] * x) >> 16;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* RGBA */
|
||||
|
||||
void
|
||||
vs_scanline_downsample_RGBA (guint8 * dest, guint8 * src, int n)
|
||||
vs_scanline_downsample_RGBA (uint8_t * dest, uint8_t * src, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -111,7 +101,7 @@ vs_scanline_downsample_RGBA (guint8 * dest, guint8 * src, int n)
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_RGBA (guint8 * dest, guint8 * src, int n,
|
||||
vs_scanline_resample_nearest_RGBA (uint8_t * dest, uint8_t * src, int n,
|
||||
int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
|
@ -134,7 +124,7 @@ vs_scanline_resample_nearest_RGBA (guint8 * dest, guint8 * src, int n,
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_linear_RGBA (guint8 * dest, guint8 * src, int n,
|
||||
vs_scanline_resample_linear_RGBA (uint8_t * dest, uint8_t * src, int n,
|
||||
int *accumulator, int increment)
|
||||
{
|
||||
uint32_t vals[2];
|
||||
|
@ -142,26 +132,26 @@ vs_scanline_resample_linear_RGBA (guint8 * dest, guint8 * src, int n,
|
|||
vals[0] = *accumulator;
|
||||
vals[1] = increment;
|
||||
|
||||
oil_resample_linear_argb ((guint32 *) dest, (guint32 *) src, n, vals);
|
||||
oil_resample_linear_argb ((uint32_t *) dest, (uint32_t *) src, n, vals);
|
||||
|
||||
*accumulator = vals[0];
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_linear_RGBA (guint8 * dest, guint8 * src1, guint8 * src2,
|
||||
vs_scanline_merge_linear_RGBA (uint8_t * dest, uint8_t * src1, uint8_t * src2,
|
||||
int n, int x)
|
||||
{
|
||||
uint32_t value = x >> 8;
|
||||
|
||||
oil_merge_linear_argb ((guint32 *) dest, (guint32 *) src1, (guint32 *) src2,
|
||||
&value, n);
|
||||
oil_merge_linear_argb ((uint32_t *) dest, (uint32_t *) src1,
|
||||
(uint32_t *) src2, &value, n);
|
||||
}
|
||||
|
||||
|
||||
/* RGB */
|
||||
|
||||
void
|
||||
vs_scanline_downsample_RGB (guint8 * dest, guint8 * src, int n)
|
||||
vs_scanline_downsample_RGB (uint8_t * dest, uint8_t * src, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -173,7 +163,7 @@ vs_scanline_downsample_RGB (guint8 * dest, guint8 * src, int n)
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_RGB (guint8 * dest, guint8 * src, int n,
|
||||
vs_scanline_resample_nearest_RGB (uint8_t * dest, uint8_t * src, int n,
|
||||
int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
|
@ -195,7 +185,7 @@ vs_scanline_resample_nearest_RGB (guint8 * dest, guint8 * src, int n,
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_linear_RGB (guint8 * dest, guint8 * src, int n,
|
||||
vs_scanline_resample_linear_RGB (uint8_t * dest, uint8_t * src, int n,
|
||||
int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
|
@ -217,25 +207,12 @@ vs_scanline_resample_linear_RGB (guint8 * dest, guint8 * src, int n,
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_linear_RGB (guint8 * dest, guint8 * src1, guint8 * src2,
|
||||
vs_scanline_merge_linear_RGB (uint8_t * dest, uint8_t * src1, uint8_t * src2,
|
||||
int n, int x)
|
||||
{
|
||||
#ifdef oil_merge_linear_u8
|
||||
uint32_t value = x >> 8;
|
||||
|
||||
oil_merge_linear_u8 (dest, src1, src2, &value, n * 3);
|
||||
#else
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
dest[3 * i + 0] =
|
||||
(src1[3 * i + 0] * (65536 - x) + src2[3 * i + 0] * x) >> 16;
|
||||
dest[3 * i + 1] =
|
||||
(src1[3 * i + 1] * (65536 - x) + src2[3 * i + 1] * x) >> 16;
|
||||
dest[3 * i + 2] =
|
||||
(src1[3 * i + 2] * (65536 - x) + src2[3 * i + 2] * x) >> 16;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -245,7 +222,7 @@ vs_scanline_merge_linear_RGB (guint8 * dest, guint8 * src1, guint8 * src2,
|
|||
/* increment is per Y pixel */
|
||||
|
||||
void
|
||||
vs_scanline_downsample_YUYV (guint8 * dest, guint8 * src, int n)
|
||||
vs_scanline_downsample_YUYV (uint8_t * dest, uint8_t * src, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -258,7 +235,7 @@ vs_scanline_downsample_YUYV (guint8 * dest, guint8 * src, int n)
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_YUYV (guint8 * dest, guint8 * src, int n,
|
||||
vs_scanline_resample_nearest_YUYV (uint8_t * dest, uint8_t * src, int n,
|
||||
int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
|
@ -288,7 +265,7 @@ vs_scanline_resample_nearest_YUYV (guint8 * dest, guint8 * src, int n,
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_linear_YUYV (guint8 * dest, guint8 * src, int n,
|
||||
vs_scanline_resample_linear_YUYV (uint8_t * dest, uint8_t * src, int n,
|
||||
int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
|
@ -320,7 +297,7 @@ vs_scanline_resample_linear_YUYV (guint8 * dest, guint8 * src, int n,
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_linear_YUYV (guint8 * dest, guint8 * src1, guint8 * src2,
|
||||
vs_scanline_merge_linear_YUYV (uint8_t * dest, uint8_t * src1, uint8_t * src2,
|
||||
int n, int x)
|
||||
{
|
||||
int i;
|
||||
|
@ -344,7 +321,7 @@ vs_scanline_merge_linear_YUYV (guint8 * dest, guint8 * src1, guint8 * src2,
|
|||
/* increment is per Y pixel */
|
||||
|
||||
void
|
||||
vs_scanline_downsample_UYVY (guint8 * dest, guint8 * src, int n)
|
||||
vs_scanline_downsample_UYVY (uint8_t * dest, uint8_t * src, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -357,7 +334,7 @@ vs_scanline_downsample_UYVY (guint8 * dest, guint8 * src, int n)
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_UYVY (guint8 * dest, guint8 * src, int n,
|
||||
vs_scanline_resample_nearest_UYVY (uint8_t * dest, uint8_t * src, int n,
|
||||
int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
|
@ -387,7 +364,7 @@ vs_scanline_resample_nearest_UYVY (guint8 * dest, guint8 * src, int n,
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_linear_UYVY (guint8 * dest, guint8 * src, int n,
|
||||
vs_scanline_resample_linear_UYVY (uint8_t * dest, uint8_t * src, int n,
|
||||
int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
|
@ -419,19 +396,19 @@ vs_scanline_resample_linear_UYVY (guint8 * dest, guint8 * src, int n,
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_linear_UYVY (guint8 * dest, guint8 * src1, guint8 * src2,
|
||||
vs_scanline_merge_linear_UYVY (uint8_t * dest, uint8_t * src1, uint8_t * src2,
|
||||
int n, int x)
|
||||
{
|
||||
uint32_t value = x >> 8;
|
||||
|
||||
oil_merge_linear_argb ((guint32 *) dest, (guint32 *) src1, (guint32 *) src2,
|
||||
&value, n);
|
||||
oil_merge_linear_argb ((uint32_t *) dest, (uint32_t *) src1,
|
||||
(uint32_t *) src2, &value, n);
|
||||
}
|
||||
|
||||
|
||||
/* RGB565 */
|
||||
|
||||
/* note that src and dest are guint16, and thus endian dependent */
|
||||
/* note that src and dest are uint16_t, and thus endian dependent */
|
||||
|
||||
#define RGB565_R(x) (((x)&0xf800)>>8 | ((x)&0xf800)>>13)
|
||||
#define RGB565_G(x) (((x)&0x07e0)>>3 | ((x)&0x07e0)>>9)
|
||||
|
@ -442,10 +419,10 @@ vs_scanline_merge_linear_UYVY (guint8 * dest, guint8 * src1, guint8 * src2,
|
|||
|
||||
|
||||
void
|
||||
vs_scanline_downsample_RGB565 (guint8 * dest_u8, guint8 * src_u8, int n)
|
||||
vs_scanline_downsample_RGB565 (uint8_t * dest_u8, uint8_t * src_u8, int n)
|
||||
{
|
||||
guint16 *dest = (guint16 *) dest_u8;
|
||||
guint16 *src = (guint16 *) src_u8;
|
||||
uint16_t *dest = (uint16_t *) dest_u8;
|
||||
uint16_t *src = (uint16_t *) src_u8;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -457,11 +434,11 @@ vs_scanline_downsample_RGB565 (guint8 * dest_u8, guint8 * src_u8, int n)
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_RGB565 (guint8 * dest_u8, guint8 * src_u8, int n,
|
||||
vs_scanline_resample_nearest_RGB565 (uint8_t * dest_u8, uint8_t * src_u8, int n,
|
||||
int *accumulator, int increment)
|
||||
{
|
||||
guint16 *dest = (guint16 *) dest_u8;
|
||||
guint16 *src = (guint16 *) src_u8;
|
||||
uint16_t *dest = (uint16_t *) dest_u8;
|
||||
uint16_t *src = (uint16_t *) src_u8;
|
||||
int acc = *accumulator;
|
||||
int i;
|
||||
int j;
|
||||
|
@ -479,11 +456,11 @@ vs_scanline_resample_nearest_RGB565 (guint8 * dest_u8, guint8 * src_u8, int n,
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_linear_RGB565 (guint8 * dest_u8, guint8 * src_u8, int n,
|
||||
vs_scanline_resample_linear_RGB565 (uint8_t * dest_u8, uint8_t * src_u8, int n,
|
||||
int *accumulator, int increment)
|
||||
{
|
||||
guint16 *dest = (guint16 *) dest_u8;
|
||||
guint16 *src = (guint16 *) src_u8;
|
||||
uint16_t *dest = (uint16_t *) dest_u8;
|
||||
uint16_t *src = (uint16_t *) src_u8;
|
||||
int acc = *accumulator;
|
||||
int i;
|
||||
int j;
|
||||
|
@ -504,12 +481,12 @@ vs_scanline_resample_linear_RGB565 (guint8 * dest_u8, guint8 * src_u8, int n,
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_linear_RGB565 (guint8 * dest_u8, guint8 * src1_u8,
|
||||
guint8 * src2_u8, int n, int x)
|
||||
vs_scanline_merge_linear_RGB565 (uint8_t * dest_u8, uint8_t * src1_u8,
|
||||
uint8_t * src2_u8, int n, int x)
|
||||
{
|
||||
guint16 *dest = (guint16 *) dest_u8;
|
||||
guint16 *src1 = (guint16 *) src1_u8;
|
||||
guint16 *src2 = (guint16 *) src2_u8;
|
||||
uint16_t *dest = (uint16_t *) dest_u8;
|
||||
uint16_t *src1 = (uint16_t *) src1_u8;
|
||||
uint16_t *src2 = (uint16_t *) src2_u8;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -523,7 +500,7 @@ vs_scanline_merge_linear_RGB565 (guint8 * dest_u8, guint8 * src1_u8,
|
|||
|
||||
/* RGB555 */
|
||||
|
||||
/* note that src and dest are guint16, and thus endian dependent */
|
||||
/* note that src and dest are uint16_t, and thus endian dependent */
|
||||
|
||||
#define RGB555_R(x) (((x)&0x7c00)>>8 | ((x)&0x7c00)>>13)
|
||||
#define RGB555_G(x) (((x)&0x03e0)>>3 | ((x)&0x03e0)>>9)
|
||||
|
@ -534,10 +511,10 @@ vs_scanline_merge_linear_RGB565 (guint8 * dest_u8, guint8 * src1_u8,
|
|||
|
||||
|
||||
void
|
||||
vs_scanline_downsample_RGB555 (guint8 * dest_u8, guint8 * src_u8, int n)
|
||||
vs_scanline_downsample_RGB555 (uint8_t * dest_u8, uint8_t * src_u8, int n)
|
||||
{
|
||||
guint16 *dest = (guint16 *) dest_u8;
|
||||
guint16 *src = (guint16 *) src_u8;
|
||||
uint16_t *dest = (uint16_t *) dest_u8;
|
||||
uint16_t *src = (uint16_t *) src_u8;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -549,11 +526,11 @@ vs_scanline_downsample_RGB555 (guint8 * dest_u8, guint8 * src_u8, int n)
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_RGB555 (guint8 * dest_u8, guint8 * src_u8, int n,
|
||||
vs_scanline_resample_nearest_RGB555 (uint8_t * dest_u8, uint8_t * src_u8, int n,
|
||||
int *accumulator, int increment)
|
||||
{
|
||||
guint16 *dest = (guint16 *) dest_u8;
|
||||
guint16 *src = (guint16 *) src_u8;
|
||||
uint16_t *dest = (uint16_t *) dest_u8;
|
||||
uint16_t *src = (uint16_t *) src_u8;
|
||||
int acc = *accumulator;
|
||||
int i;
|
||||
int j;
|
||||
|
@ -571,11 +548,11 @@ vs_scanline_resample_nearest_RGB555 (guint8 * dest_u8, guint8 * src_u8, int n,
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_linear_RGB555 (guint8 * dest_u8, guint8 * src_u8, int n,
|
||||
vs_scanline_resample_linear_RGB555 (uint8_t * dest_u8, uint8_t * src_u8, int n,
|
||||
int *accumulator, int increment)
|
||||
{
|
||||
guint16 *dest = (guint16 *) dest_u8;
|
||||
guint16 *src = (guint16 *) src_u8;
|
||||
uint16_t *dest = (uint16_t *) dest_u8;
|
||||
uint16_t *src = (uint16_t *) src_u8;
|
||||
int acc = *accumulator;
|
||||
int i;
|
||||
int j;
|
||||
|
@ -596,12 +573,12 @@ vs_scanline_resample_linear_RGB555 (guint8 * dest_u8, guint8 * src_u8, int n,
|
|||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_linear_RGB555 (guint8 * dest_u8, guint8 * src1_u8,
|
||||
guint8 * src2_u8, int n, int x)
|
||||
vs_scanline_merge_linear_RGB555 (uint8_t * dest_u8, uint8_t * src1_u8,
|
||||
uint8_t * src2_u8, int n, int x)
|
||||
{
|
||||
guint16 *dest = (guint16 *) dest_u8;
|
||||
guint16 *src1 = (guint16 *) src1_u8;
|
||||
guint16 *src2 = (guint16 *) src2_u8;
|
||||
uint16_t *dest = (uint16_t *) dest_u8;
|
||||
uint16_t *src1 = (uint16_t *) src1_u8;
|
||||
uint16_t *src2 = (uint16_t *) src2_u8;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
|
|
|
@ -28,46 +28,43 @@
|
|||
#ifndef __VS_SCANLINE_H__
|
||||
#define __VS_SCANLINE_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
void vs_scanline_downsample_Y (uint8_t *dest, uint8_t *src, int n);
|
||||
void vs_scanline_resample_nearest_Y (uint8_t *dest, uint8_t *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_resample_linear_Y (uint8_t *dest, uint8_t *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_merge_linear_Y (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
|
||||
|
||||
void vs_scanline_downsample_Y (guint8 *dest, guint8 *src, int n);
|
||||
void vs_scanline_resample_nearest_Y (guint8 *dest, guint8 *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_resample_linear_Y (guint8 *dest, guint8 *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_merge_linear_Y (guint8 *dest, guint8 *src1, guint8 *src2, int n, int x);
|
||||
void vs_scanline_downsample_RGBA (uint8_t *dest, uint8_t *src, int n);
|
||||
void vs_scanline_resample_nearest_RGBA (uint8_t *dest, uint8_t *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_resample_linear_RGBA (uint8_t *dest, uint8_t *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_merge_linear_RGBA (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
|
||||
|
||||
void vs_scanline_downsample_RGBA (guint8 *dest, guint8 *src, int n);
|
||||
void vs_scanline_resample_nearest_RGBA (guint8 *dest, guint8 *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_resample_linear_RGBA (guint8 *dest, guint8 *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_merge_linear_RGBA (guint8 *dest, guint8 *src1, guint8 *src2, int n, int x);
|
||||
void vs_scanline_downsample_RGB (uint8_t *dest, uint8_t *src, int n);
|
||||
void vs_scanline_resample_nearest_RGB (uint8_t *dest, uint8_t *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_resample_linear_RGB (uint8_t *dest, uint8_t *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_merge_linear_RGB (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
|
||||
|
||||
void vs_scanline_downsample_RGB (guint8 *dest, guint8 *src, int n);
|
||||
void vs_scanline_resample_nearest_RGB (guint8 *dest, guint8 *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_resample_linear_RGB (guint8 *dest, guint8 *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_merge_linear_RGB (guint8 *dest, guint8 *src1, guint8 *src2, int n, int x);
|
||||
void vs_scanline_downsample_YUYV (uint8_t *dest, uint8_t *src, int n);
|
||||
void vs_scanline_resample_nearest_YUYV (uint8_t *dest, uint8_t *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_resample_linear_YUYV (uint8_t *dest, uint8_t *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_merge_linear_YUYV (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
|
||||
|
||||
void vs_scanline_downsample_YUYV (guint8 *dest, guint8 *src, int n);
|
||||
void vs_scanline_resample_nearest_YUYV (guint8 *dest, guint8 *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_resample_linear_YUYV (guint8 *dest, guint8 *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_merge_linear_YUYV (guint8 *dest, guint8 *src1, guint8 *src2, int n, int x);
|
||||
void vs_scanline_downsample_UYVY (uint8_t *dest, uint8_t *src, int n);
|
||||
void vs_scanline_resample_nearest_UYVY (uint8_t *dest, uint8_t *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_resample_linear_UYVY (uint8_t *dest, uint8_t *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_merge_linear_UYVY (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
|
||||
|
||||
void vs_scanline_downsample_UYVY (guint8 *dest, guint8 *src, int n);
|
||||
void vs_scanline_resample_nearest_UYVY (guint8 *dest, guint8 *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_resample_linear_UYVY (guint8 *dest, guint8 *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_merge_linear_UYVY (guint8 *dest, guint8 *src1, guint8 *src2, int n, int x);
|
||||
void vs_scanline_downsample_RGB565 (uint8_t *dest, uint8_t *src, int n);
|
||||
void vs_scanline_resample_nearest_RGB565 (uint8_t *dest, uint8_t *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_resample_linear_RGB565 (uint8_t *dest, uint8_t *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_merge_linear_RGB565 (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
|
||||
|
||||
void vs_scanline_downsample_RGB565 (guint8 *dest, guint8 *src, int n);
|
||||
void vs_scanline_resample_nearest_RGB565 (guint8 *dest, guint8 *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_resample_linear_RGB565 (guint8 *dest, guint8 *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_merge_linear_RGB565 (guint8 *dest, guint8 *src1, guint8 *src2, int n, int x);
|
||||
void vs_scanline_downsample_RGB555 (uint8_t *dest, uint8_t *src, int n);
|
||||
void vs_scanline_resample_nearest_RGB555 (uint8_t *dest, uint8_t *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_resample_linear_RGB555 (uint8_t *dest, uint8_t *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_merge_linear_RGB555 (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
|
||||
|
||||
void vs_scanline_downsample_RGB555 (guint8 *dest, guint8 *src, int n);
|
||||
void vs_scanline_resample_nearest_RGB555 (guint8 *dest, guint8 *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_resample_linear_RGB555 (guint8 *dest, guint8 *src, int n, int *accumulator, int increment);
|
||||
void vs_scanline_merge_linear_RGB555 (guint8 *dest, guint8 *src1, guint8 *src2, int n, int x);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue