futher option reduction and ifdef removal.

SVN revision: 78029
This commit is contained in:
Carsten Haitzler 2012-10-16 03:15:40 +00:00
parent 6912aba9db
commit 71adbc0c38
8 changed files with 47 additions and 559 deletions

View File

@ -1181,9 +1181,6 @@ EVAS_CHECK_DITHER([no-dither-mask], [conversion to 16bpp without dither mask], [
##################################################################### #####################################################################
## no longer options - turn on. ## no longer options - turn on.
AC_DEFINE(BUILD_SCALE_SAMPLE, 1, [YUV])
AC_DEFINE(BUILD_SCALE_SMOOTH, 1, [YUV])
AC_DEFINE(BUILD_CONVERT_YUV, 1, [YUV])
AC_DEFINE(BUILD_CONVERT_8_RGB_332, 1, [8bpp RGB 332]) AC_DEFINE(BUILD_CONVERT_8_RGB_332, 1, [8bpp RGB 332])
AC_DEFINE(BUILD_CONVERT_8_RGB_666, 1, [8bpp RGB 666]) AC_DEFINE(BUILD_CONVERT_8_RGB_666, 1, [8bpp RGB 666])
AC_DEFINE(BUILD_CONVERT_8_RGB_232, 1, [8bpp RGB 232]) AC_DEFINE(BUILD_CONVERT_8_RGB_232, 1, [8bpp RGB 232])

View File

@ -1,7 +1,7 @@
#include "evas_common.h" #include "evas_common.h"
#include "evas_convert_yuv.h" #include "evas_convert_yuv.h"
#if defined BUILD_MMX || defined BUILD_SSE #if defined BUILD_MMX
# include "evas_mmx.h" # include "evas_mmx.h"
#endif #endif
@ -15,8 +15,6 @@
#endif #endif
#ifdef BUILD_CONVERT_YUV
static void _evas_yuv_init (void); static void _evas_yuv_init (void);
static void _evas_yv12torgb_sse (unsigned char **yuv, unsigned char *rgb, int w, int h); static void _evas_yv12torgb_sse (unsigned char **yuv, unsigned char *rgb, int w, int h);
static void _evas_yv12torgb_mmx (unsigned char **yuv, unsigned char *rgb, int w, int h); static void _evas_yv12torgb_mmx (unsigned char **yuv, unsigned char *rgb, int w, int h);
@ -108,8 +106,6 @@ const vector unsigned char pickrgb2 = AVV(0x3, 0x1, 0x2, 0x19,
#endif #endif
#endif #endif
#ifdef BUILD_C
/* shortcut speedup lookup-tables */ /* shortcut speedup lookup-tables */
static short _v1164[256]; static short _v1164[256];
static short _v1596[256]; static short _v1596[256];
@ -124,8 +120,6 @@ static unsigned char _clip_lut[1024];
static int initted = 0; static int initted = 0;
#endif
void void
evas_common_convert_yuv_420p_601_rgba(DATA8 **src, DATA8 *dst, int w, int h) evas_common_convert_yuv_420p_601_rgba(DATA8 **src, DATA8 *dst, int w, int h)
{ {
@ -151,12 +145,10 @@ evas_common_convert_yuv_420p_601_rgba(DATA8 **src, DATA8 *dst, int w, int h)
#endif #endif
else else
{ {
#ifdef BUILD_C
if (!initted) _evas_yuv_init(); if (!initted) _evas_yuv_init();
initted = 1; initted = 1;
/* FIXME: diz may be faster sometimes */ /* FIXME: diz may be faster sometimes */
_evas_yv12torgb_raster(src, dst, w, h); _evas_yv12torgb_raster(src, dst, w, h);
#endif
} }
} }
@ -724,7 +716,6 @@ _evas_yv12torgb_altivec(unsigned char **yuv, unsigned char *rgb, int w, int h)
static void static void
_evas_yuv_init(void) _evas_yuv_init(void)
{ {
#ifdef BUILD_C
int i; int i;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
@ -742,14 +733,12 @@ _evas_yuv_init(void)
{ {
_clip_lut[i+384] = i < 0 ? 0 : (i > 255) ? 255 : i; _clip_lut[i+384] = i < 0 ? 0 : (i > 255) ? 255 : i;
} }
#endif
} }
#ifdef BUILD_ALTIVEC #ifdef BUILD_ALTIVEC
static void static void
_evas_yv12torgb_diz(unsigned char **yuv, unsigned char *rgb, int w, int h) _evas_yv12torgb_diz(unsigned char **yuv, unsigned char *rgb, int w, int h)
{ {
#ifdef BUILD_C
int xx, yy; int xx, yy;
int y, u, v, r, g, b; int y, u, v, r, g, b;
unsigned char *yp1, *yp2, *up, *vp; unsigned char *yp1, *yp2, *up, *vp;
@ -820,14 +809,12 @@ _evas_yv12torgb_diz(unsigned char **yuv, unsigned char *rgb, int w, int h)
dp1 += (w * 4); dp1 += (w * 4);
dp2 += (w * 4); dp2 += (w * 4);
} }
#endif
} }
#endif #endif
static void static void
_evas_yv12torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h) _evas_yv12torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h)
{ {
#ifdef BUILD_C
int xx, yy; int xx, yy;
int y, u, v; int y, u, v;
unsigned char *yp1, *yp2, *up, *vp; unsigned char *yp1, *yp2, *up, *vp;
@ -887,43 +874,35 @@ _evas_yv12torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h)
dp1 += (w * 4); dp1 += (w * 4);
dp2 += (w * 4); dp2 += (w * 4);
} }
#endif
} }
void void
evas_common_convert_yuv_422_601_rgba(DATA8 **src, DATA8 *dst, int w, int h) evas_common_convert_yuv_422_601_rgba(DATA8 **src, DATA8 *dst, int w, int h)
{ {
#ifdef BUILD_C
if (!initted) _evas_yuv_init(); if (!initted) _evas_yuv_init();
initted = 1; initted = 1;
_evas_yuy2torgb_raster(src, dst, w, h); _evas_yuy2torgb_raster(src, dst, w, h);
#endif
} }
void void
evas_common_convert_yuv_420_601_rgba(DATA8 **src, DATA8 *dst, int w, int h) evas_common_convert_yuv_420_601_rgba(DATA8 **src, DATA8 *dst, int w, int h)
{ {
#ifdef BUILD_C
if (!initted) _evas_yuv_init(); if (!initted) _evas_yuv_init();
initted = 1; initted = 1;
_evas_nv12torgb_raster(src, dst, w, h); _evas_nv12torgb_raster(src, dst, w, h);
#endif
} }
void void
evas_common_convert_yuv_420T_601_rgba(DATA8 **src, DATA8 *dst, int w, int h) evas_common_convert_yuv_420T_601_rgba(DATA8 **src, DATA8 *dst, int w, int h)
{ {
#ifdef BUILD_C
if (initted) _evas_yuv_init(); if (initted) _evas_yuv_init();
initted = 1; initted = 1;
_evas_nv12tiledtorgb_raster(src, dst, w, h); _evas_nv12tiledtorgb_raster(src, dst, w, h);
#endif
} }
static void static void
_evas_yuy2torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h) _evas_yuy2torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h)
{ {
#ifdef BUILD_C
int xx, yy; int xx, yy;
int y, u, v; int y, u, v;
unsigned char *yp1, *yp2, *up, *vp; unsigned char *yp1, *yp2, *up, *vp;
@ -972,10 +951,8 @@ _evas_yuy2torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h)
yp1 += 4; yp2 += 4; up += 4; vp += 4; yp1 += 4; yp2 += 4; up += 4; vp += 4;
} }
} }
#endif
} }
#ifdef BUILD_C
static inline void static inline void
_evas_yuv2rgb_420_raster(unsigned char *yp1, unsigned char *yp2, unsigned char *up, unsigned char *vp, _evas_yuv2rgb_420_raster(unsigned char *yp1, unsigned char *yp2, unsigned char *up, unsigned char *vp,
unsigned char *dp1, unsigned char *dp2) unsigned char *dp1, unsigned char *dp2)
@ -1055,13 +1032,10 @@ _evas_yuv2rgb_420_raster(unsigned char *yp1, unsigned char *yp2, unsigned char *
#endif #endif
*((DATA32 *) dp2) = 0xff000000 + rgb; *((DATA32 *) dp2) = 0xff000000 + rgb;
} }
#endif
static void static void
_evas_nv12tiledtorgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h) _evas_nv12tiledtorgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h)
{ {
#ifdef BUILD_C
#define HANDLE_MACROBLOCK(YP1, YP2, UP, VP, DP1, DP2) \ #define HANDLE_MACROBLOCK(YP1, YP2, UP, VP, DP1, DP2) \
{ \ { \
int i; \ int i; \
@ -1211,13 +1185,11 @@ _evas_nv12tiledtorgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int
HANDLE_MACROBLOCK(yp1, yp2, up, vp, dp1, dp2); HANDLE_MACROBLOCK(yp1, yp2, up, vp, dp1, dp2);
} }
} }
#endif
} }
static void static void
_evas_nv12torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h) _evas_nv12torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h)
{ {
#ifdef BUILD_C
int xx, yy; int xx, yy;
unsigned char *yp1, *yp2, *up, *vp; unsigned char *yp1, *yp2, *up, *vp;
unsigned char *dp1; unsigned char *dp1;
@ -1251,8 +1223,5 @@ _evas_nv12torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h)
yp1 += w; yp1 += w;
yp2 += w; yp2 += w;
} }
#endif
} }
#endif

View File

@ -736,32 +736,24 @@ evas_common_image_colorspace_normalize(RGBA_Image *im)
} }
break; break;
case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P601_PL:
#ifdef BUILD_CONVERT_YUV
if ((im->image.data) && (*((unsigned char **)im->cs.data))) if ((im->image.data) && (*((unsigned char **)im->cs.data)))
evas_common_convert_yuv_420p_601_rgba(im->cs.data, (DATA8*) im->image.data, evas_common_convert_yuv_420p_601_rgba(im->cs.data, (DATA8*) im->image.data,
im->cache_entry.w, im->cache_entry.h); im->cache_entry.w, im->cache_entry.h);
#endif
break; break;
case EVAS_COLORSPACE_YCBCR422601_PL: case EVAS_COLORSPACE_YCBCR422601_PL:
#ifdef BUILD_CONVERT_YUV
if ((im->image.data) && (*((unsigned char **)im->cs.data))) if ((im->image.data) && (*((unsigned char **)im->cs.data)))
evas_common_convert_yuv_422_601_rgba(im->cs.data, (DATA8*) im->image.data, evas_common_convert_yuv_422_601_rgba(im->cs.data, (DATA8*) im->image.data,
im->cache_entry.w, im->cache_entry.h); im->cache_entry.w, im->cache_entry.h);
#endif
break; break;
case EVAS_COLORSPACE_YCBCR420NV12601_PL: case EVAS_COLORSPACE_YCBCR420NV12601_PL:
#ifdef BUILD_CONVERT_YUV
if ((im->image.data) && (*((unsigned char **)im->cs.data))) if ((im->image.data) && (*((unsigned char **)im->cs.data)))
evas_common_convert_yuv_420_601_rgba(im->cs.data, (DATA8*) im->image.data, evas_common_convert_yuv_420_601_rgba(im->cs.data, (DATA8*) im->image.data,
im->cache_entry.w, im->cache_entry.h); im->cache_entry.w, im->cache_entry.h);
#endif
break; break;
case EVAS_COLORSPACE_YCBCR420TM12601_PL: case EVAS_COLORSPACE_YCBCR420TM12601_PL:
#ifdef BUILD_CONVERT_YUV
if ((im->image.data) && (*((unsigned char **)im->cs.data))) if ((im->image.data) && (*((unsigned char **)im->cs.data)))
evas_common_convert_yuv_420T_601_rgba(im->cs.data, (DATA8*) im->image.data, evas_common_convert_yuv_420T_601_rgba(im->cs.data, (DATA8*) im->image.data,
im->cache_entry.w, im->cache_entry.h); im->cache_entry.w, im->cache_entry.h);
#endif
break; break;
default: default:
break; break;

View File

@ -5,11 +5,9 @@
#include "evas_cs2_private.h" #include "evas_cs2_private.h"
#endif #endif
#ifdef BUILD_SCALE_SMOOTH #ifdef BUILD_MMX
# ifdef BUILD_MMX # undef SCALE_USING_MMX
# undef SCALE_USING_MMX # define SCALE_USING_MMX
# define SCALE_USING_MMX
# endif
#endif #endif
#define FPI 8 #define FPI 8
@ -630,26 +628,23 @@ evas_common_map_rgba_prepare(RGBA_Image *src, RGBA_Image *dst,
return EINA_TRUE; return EINA_TRUE;
} }
#ifdef BUILD_SCALE_SMOOTH #ifdef BUILD_MMX
# ifdef BUILD_MMX # undef FUNC_NAME
# undef FUNC_NAME # undef FUNC_NAME_DO
# undef FUNC_NAME_DO # define FUNC_NAME evas_common_map_rgba_internal_mmx
# define FUNC_NAME evas_common_map_rgba_internal_mmx # define FUNC_NAME_DO evas_common_map_rgba_internal_mmx_do
# define FUNC_NAME_DO evas_common_map_rgba_internal_mmx_do # undef SCALE_USING_MMX
# undef SCALE_USING_MMX # define SCALE_USING_MMX
# define SCALE_USING_MMX # include "evas_map_image_internal.c"
# include "evas_map_image_internal.c"
# endif
# ifdef BUILD_C
# undef FUNC_NAME
# undef FUNC_NAME_DO
# define FUNC_NAME evas_common_map_rgba_internal
# define FUNC_NAME_DO evas_common_map_rgba_internal_do
# undef SCALE_USING_MMX
# include "evas_map_image_internal.c"
# endif
#endif #endif
#undef FUNC_NAME
#undef FUNC_NAME_DO
#define FUNC_NAME evas_common_map_rgba_internal
#define FUNC_NAME_DO evas_common_map_rgba_internal_do
#undef SCALE_USING_MMX
#include "evas_map_image_internal.c"
EAPI void EAPI void
evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst, evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst,
RGBA_Draw_Context *dc, RGBA_Draw_Context *dc,
@ -685,9 +680,7 @@ evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst,
evas_common_map_rgba_internal_mmx(src, dst, dc, p, smooth, level); evas_common_map_rgba_internal_mmx(src, dst, dc, p, smooth, level);
else else
#endif #endif
#ifdef BUILD_C
evas_common_map_rgba_internal(src, dst, dc, p, smooth, level); evas_common_map_rgba_internal(src, dst, dc, p, smooth, level);
#endif
return; return;
} }
/* save out clip info */ /* save out clip info */
@ -709,9 +702,7 @@ evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst,
evas_common_map_rgba_internal_mmx(src, dst, dc, p, smooth, level); evas_common_map_rgba_internal_mmx(src, dst, dc, p, smooth, level);
else else
#endif #endif
#ifdef BUILD_C
evas_common_map_rgba_internal(src, dst, dc, p, smooth, level); evas_common_map_rgba_internal(src, dst, dc, p, smooth, level);
#endif
} }
/* restore clip info */ /* restore clip info */
dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
@ -749,11 +740,9 @@ evas_common_map_rgba_do(const Eina_Rectangle *clip,
&spans->spans[0], smooth, level); &spans->spans[0], smooth, level);
else else
#endif #endif
#ifdef BUILD_C
evas_common_map_rgba_internal_do(src, dst, dc, evas_common_map_rgba_internal_do(src, dst, dc,
&spans->spans[0], smooth, level); &spans->spans[0], smooth, level);
#endif return;
return ;
} }
for (i = 0; i < rects->active; ++i) for (i = 0; i < rects->active; ++i)
@ -769,9 +758,7 @@ evas_common_map_rgba_do(const Eina_Rectangle *clip,
&spans->spans[i], smooth, level); &spans->spans[i], smooth, level);
else else
#endif #endif
#ifdef BUILD_C
evas_common_map_rgba_internal_do(src, dst, dc, evas_common_map_rgba_internal_do(src, dst, dc,
&spans->spans[i], smooth, level); &spans->spans[i], smooth, level);
#endif
} }
} }

View File

@ -3,43 +3,6 @@
static void scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); static void scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
#ifndef BUILD_SCALE_SMOOTH
#ifdef BUILD_SCALE_SAMPLE
EAPI void
evas_common_scale_rgba_in_to_out_clip_smooth_do(const Cutout_Rects *reuse,
const Eina_Rectangle *clip,
RGBA_Image *src, RGBA_Image *dst,
RGBA_Draw_Context *dc,
int src_region_x, int src_region_y,
int src_region_w, int src_region_h,
int dst_region_x, int dst_region_y,
int dst_region_w, int dst_region_h)
{
evas_common_scale_rgba_in_to_out_clip_sample_do(reuse, clip, src, dst, dc,
src_region_x, src_region_y,
src_region_w, src_region_h,
dst_region_x, dst_region_y,
dst_region_w, dst_region_h);
}
EAPI void
evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
RGBA_Draw_Context *dc,
int src_region_x, int src_region_y,
int src_region_w, int src_region_h,
int dst_region_x, int dst_region_y,
int dst_region_w, int dst_region_h)
{
evas_common_scale_rgba_in_to_out_clip_sample(src, dst, dc,
src_region_x, src_region_y,
src_region_w, src_region_h,
dst_region_x, dst_region_y,
dst_region_w, dst_region_h);
}
#endif
#endif
#ifdef BUILD_SCALE_SAMPLE
EAPI void EAPI void
evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst, evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
RGBA_Draw_Context *dc, RGBA_Draw_Context *dc,
@ -443,38 +406,3 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
} }
} }
} }
#else
#ifdef BUILD_SCALE_SMOOTH
EAPI void
evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
RGBA_Draw_Context *dc,
int src_region_x, int src_region_y,
int src_region_w, int src_region_h,
int dst_region_x, int dst_region_y,
int dst_region_w, int dst_region_h)
{
evas_common_scale_rgba_in_to_out_clip_smooth(src, dst, dc,
src_region_x, src_region_y,
src_region_w, src_region_h,
dst_region_x, dst_region_y,
dst_region_w, dst_region_h);
}
EAPI void
evas_common_scale_rgba_in_to_out_clip_sample_do(const Cutout_Rects *reuse,
const Eina_Rectangle *clip,
RGBA_Image *src, RGBA_Image *dst,
RGBA_Draw_Context *dc,
int src_region_x, int src_region_y,
int src_region_w, int src_region_h,
int dst_region_x, int dst_region_y,
int dst_region_w, int dst_region_h)
{
evas_common_scale_rgba_in_to_out_clip_smooth_do(reuse, clip, src, dst, dc,
src_region_x, src_region_y,
src_region_w, src_region_h,
dst_region_x, dst_region_y,
dst_region_w, dst_region_h);
}
#endif
#endif

View File

@ -89,373 +89,26 @@ scale_calc_a_points(int *p, int s, int d, int c, int cc)
} }
} }
#ifdef BUILD_SCALE_SMOOTH
#ifdef BUILD_C
EAPI void
evas_common_scale_rgba_mipmap_down_2x2_c(DATA32 *src, DATA32 *dst, int src_w, int src_h)
{
int x, y, dst_w, dst_h;
DATA32 *src_ptr, *src_ptr2, *dst_ptr;
dst_w = src_w >> 1;
dst_h = src_h >> 1;
if (dst_w < 1) dst_w = 1;
if (dst_h < 1) dst_h = 1;
src_ptr = src;
src_ptr2 = src + src_w;
dst_ptr = dst;
for (y = 0; y < dst_h; y++)
{
src_ptr = src + (y * src_w * 2);
src_ptr2 = src_ptr + src_w;
for (x = 0; x < dst_w; x++)
{
R_VAL(dst_ptr) = (R_VAL(src_ptr) + R_VAL(src_ptr + 1) + R_VAL(src_ptr2) + R_VAL(src_ptr2 + 1)) >> 2;
G_VAL(dst_ptr) = (G_VAL(src_ptr) + G_VAL(src_ptr + 1) + G_VAL(src_ptr2) + G_VAL(src_ptr2 + 1)) >> 2;
B_VAL(dst_ptr) = (B_VAL(src_ptr) + B_VAL(src_ptr + 1) + B_VAL(src_ptr2) + B_VAL(src_ptr2 + 1)) >> 2;
A_VAL(dst_ptr) = (A_VAL(src_ptr) + A_VAL(src_ptr + 1) + A_VAL(src_ptr2) + A_VAL(src_ptr2 + 1)) >> 2;
src_ptr+=2;
src_ptr2+=2;
dst_ptr++;
}
}
}
#endif
#endif
#ifdef BUILD_SCALE_SMOOTH
#ifdef BUILD_C
EAPI void
evas_common_scale_rgba_mipmap_down_2x1_c(DATA32 *src, DATA32 *dst, int src_w, int src_h)
{
int x, y, dst_w, dst_h;
DATA32 *src_ptr, *dst_ptr;
dst_w = src_w >> 1;
dst_h = src_h >> 1;
if (dst_w < 1) dst_w = 1;
if (dst_h < 1) dst_h = 1;
src_ptr = src;
dst_ptr = dst;
for (y = 0; y < dst_h; y++)
{
src_ptr = src + (y * src_w * 2);
for (x = 0; x < dst_w; x++)
{
R_VAL(dst_ptr) = (R_VAL(src_ptr) + R_VAL(src_ptr + 1)) >> 1;
G_VAL(dst_ptr) = (G_VAL(src_ptr) + G_VAL(src_ptr + 1)) >> 1;
B_VAL(dst_ptr) = (B_VAL(src_ptr) + B_VAL(src_ptr + 1)) >> 1;
A_VAL(dst_ptr) = (A_VAL(src_ptr) + A_VAL(src_ptr + 1)) >> 1;
src_ptr+=2;
dst_ptr++;
}
}
}
#endif
#endif
#ifdef BUILD_SCALE_SMOOTH
#ifdef BUILD_C
EAPI void
evas_common_scale_rgba_mipmap_down_1x2_c(DATA32 *src, DATA32 *dst, int src_w, int src_h)
{
int x, y, dst_w, dst_h;
DATA32 *src_ptr, *src_ptr2, *dst_ptr;
dst_w = src_w >> 1;
dst_h = src_h >> 1;
if (dst_w < 1) dst_w = 1;
if (dst_h < 1) dst_h = 1;
src_ptr = src;
dst_ptr = dst;
for (y = 0; y < dst_h; y++)
{
src_ptr = src + (y * src_w * 2);
src_ptr2 = src_ptr + src_w;
for (x = 0; x < dst_w; x++)
{
R_VAL(dst_ptr) = (R_VAL(src_ptr) + R_VAL(src_ptr2)) >> 1;
G_VAL(dst_ptr) = (G_VAL(src_ptr) + G_VAL(src_ptr2)) >> 1;
B_VAL(dst_ptr) = (B_VAL(src_ptr) + B_VAL(src_ptr2)) >> 1;
A_VAL(dst_ptr) = (A_VAL(src_ptr) + A_VAL(src_ptr2)) >> 1;
src_ptr+=2;
src_ptr2+=2;
dst_ptr++;
}
}
}
#endif
#endif
#ifdef BUILD_SCALE_SMOOTH
#ifdef BUILD_C
EAPI void
evas_common_scale_rgb_mipmap_down_2x2_c(DATA32 *src, DATA32 *dst, int src_w, int src_h)
{
int x, y, dst_w, dst_h;
DATA32 *src_ptr, *src_ptr2, *dst_ptr;
dst_w = src_w >> 1;
dst_h = src_h >> 1;
if (dst_w < 1) dst_w = 1;
if (dst_h < 1) dst_h = 1;
src_ptr = src;
src_ptr2 = src + src_w;
dst_ptr = dst;
for (y = 0; y < dst_h; y++)
{
for (x = 0; x < dst_w; x++)
{
R_VAL(dst_ptr) = (R_VAL(src_ptr) + R_VAL(src_ptr + 1) + R_VAL(src_ptr2) + R_VAL(src_ptr2 + 1)) >> 2;
G_VAL(dst_ptr) = (G_VAL(src_ptr) + G_VAL(src_ptr + 1) + G_VAL(src_ptr2) + G_VAL(src_ptr2 + 1)) >> 2;
B_VAL(dst_ptr) = (B_VAL(src_ptr) + B_VAL(src_ptr + 1) + B_VAL(src_ptr2) + B_VAL(src_ptr2 + 1)) >> 2;
A_VAL(dst_ptr) = 0xff;
src_ptr+=2;
src_ptr2+=2;
dst_ptr++;
}
src_ptr += src_w;
src_ptr2 += src_w;
}
}
#endif
#endif
#ifdef BUILD_SCALE_SMOOTH
#ifdef BUILD_C
EAPI void
evas_common_scale_rgb_mipmap_down_2x1_c(DATA32 *src, DATA32 *dst, int src_w, int src_h)
{
int x, y, dst_w, dst_h;
DATA32 *src_ptr, *dst_ptr;
dst_w = src_w >> 1;
dst_h = src_h >> 1;
if (dst_w < 1) dst_w = 1;
if (dst_h < 1) dst_h = 1;
src_ptr = src;
dst_ptr = dst;
for (y = 0; y < dst_h; y++)
{
for (x = 0; x < dst_w; x++)
{
R_VAL(dst_ptr) = (R_VAL(src_ptr) + R_VAL(src_ptr + 1)) >> 1;
G_VAL(dst_ptr) = (G_VAL(src_ptr) + G_VAL(src_ptr + 1)) >> 1;
B_VAL(dst_ptr) = (B_VAL(src_ptr) + B_VAL(src_ptr + 1)) >> 1;
A_VAL(dst_ptr) = 0xff;
src_ptr+=2;
dst_ptr++;
}
src_ptr += src_w;
}
}
#endif
#endif
#ifdef BUILD_SCALE_SMOOTH
#ifdef BUILD_C
EAPI void
evas_common_scale_rgb_mipmap_down_1x2_c(DATA32 *src, DATA32 *dst, int src_w, int src_h)
{
int x, y, dst_w, dst_h;
DATA32 *src_ptr, *src_ptr2, *dst_ptr;
dst_w = src_w >> 1;
dst_h = src_h >> 1;
if (dst_w < 1) dst_w = 1;
if (dst_h < 1) dst_h = 1;
src_ptr = src;
src_ptr2 = src + src_w;
dst_ptr = dst;
for (y = 0; y < dst_h; y++)
{
for (x = 0; x < dst_w; x++)
{
R_VAL(dst_ptr) = (R_VAL(src_ptr) + R_VAL(src_ptr2)) >> 1;
G_VAL(dst_ptr) = (G_VAL(src_ptr) + G_VAL(src_ptr2)) >> 1;
B_VAL(dst_ptr) = (B_VAL(src_ptr) + B_VAL(src_ptr2)) >> 1;
A_VAL(dst_ptr) = 0xff;
src_ptr+=2;
src_ptr2+=2;
dst_ptr++;
}
src_ptr += src_w;
src_ptr2 += src_w;
}
}
#endif
#endif
#ifdef BUILD_SCALE_SMOOTH
#ifdef BUILD_MMX #ifdef BUILD_MMX
EAPI void # undef SCALE_FUNC
evas_common_scale_rgba_mipmap_down_2x2_mmx(DATA32 *src, DATA32 *dst, int src_w, int src_h) # define SCALE_FUNC evas_common_scale_rgba_in_to_out_clip_smooth_mmx
{ # undef SCALE_USING_MMX
int x, y, dst_w, dst_h; # define SCALE_USING_MMX
DATA32 *src_ptr, *src_ptr2, *dst_ptr; # include "evas_scale_smooth_scaler.c"
dst_w = src_w >> 1;
dst_h = src_h >> 1;
if (dst_w < 1) dst_w = 1;
if (dst_h < 1) dst_h = 1;
/* NB: Dead assignments (reassigned to different values below)
src_ptr = src;
src_ptr2 = src + src_w;
*/
dst_ptr = dst;
for (y = 0; y < dst_h; y++)
{
src_ptr = src + (y * src_w * 2);
src_ptr2 = src_ptr + src_w;
for (x = 0; x < dst_w; x++)
{
punpcklbw_m2r(src_ptr[0], mm0);
punpcklbw_m2r(src_ptr[1], mm1);
punpcklbw_m2r(src_ptr2[0], mm2);
punpcklbw_m2r(src_ptr2[1], mm3);
psrlw_i2r(8, mm0);
psrlw_i2r(8, mm1);
psrlw_i2r(8, mm2);
psrlw_i2r(8, mm3);
paddw_r2r(mm1, mm0);
paddw_r2r(mm2, mm0);
paddw_r2r(mm3, mm0);
psrlw_i2r(2, mm0);
packuswb_r2r(mm0, mm0);
movd_r2m(mm0, dst_ptr[0]);
src_ptr+=2;
src_ptr2+=2;
dst_ptr++;
}
}
}
#endif
#endif #endif
#ifdef BUILD_SCALE_SMOOTH #undef SCALE_FUNC
#ifdef BUILD_MMX #define SCALE_FUNC evas_common_scale_rgba_in_to_out_clip_smooth_c
EAPI void #undef SCALE_USING_MMX
evas_common_scale_rgba_mipmap_down_2x1_mmx(DATA32 *src, DATA32 *dst, int src_w, int src_h) #include "evas_scale_smooth_scaler.c"
{
int x, y, dst_w, dst_h;
DATA32 *src_ptr, *dst_ptr;
dst_w = src_w >> 1;
dst_h = src_h >> 1;
if (dst_w < 1) dst_w = 1;
if (dst_h < 1) dst_h = 1;
src_ptr = src;
dst_ptr = dst;
for (y = 0; y < dst_h; y++)
{
src_ptr = src + (y * src_w * 2);
for (x = 0; x < dst_w; x++)
{
punpcklbw_m2r(src_ptr[0], mm0);
punpcklbw_m2r(src_ptr[1], mm1);
psrlw_i2r(8, mm0);
psrlw_i2r(8, mm1);
paddw_r2r(mm1, mm0);
psrlw_i2r(1, mm0);
packuswb_r2r(mm0, mm0);
movd_r2m(mm0, dst_ptr[0]);
src_ptr+=2;
dst_ptr++;
}
}
}
#endif
#endif
#ifdef BUILD_SCALE_SMOOTH
#ifdef BUILD_MMX
EAPI void
evas_common_scale_rgba_mipmap_down_1x2_mmx(DATA32 *src, DATA32 *dst, int src_w, int src_h)
{
int x, y, dst_w, dst_h;
DATA32 *src_ptr, *src_ptr2, *dst_ptr;
dst_w = src_w >> 1;
dst_h = src_h >> 1;
if (dst_w < 1) dst_w = 1;
if (dst_h < 1) dst_h = 1;
/* NB: Dead assignment (gets reassigned later) */
// src_ptr = src;
src_ptr2 = src + src_w;
dst_ptr = dst;
for (y = 0; y < dst_h; y++)
{
src_ptr = src + (y * src_w * 2);
src_ptr2 = src_ptr + src_w;
for (x = 0; x < dst_w; x++)
{
punpcklbw_m2r(src_ptr[0], mm0);
punpcklbw_m2r(src_ptr2[0], mm1);
psrlw_i2r(8, mm0);
psrlw_i2r(8, mm1);
paddw_r2r(mm1, mm0);
psrlw_i2r(1, mm0);
packuswb_r2r(mm0, mm0);
movd_r2m(mm0, dst_ptr[0]);
src_ptr+=2;
src_ptr2+=2;
dst_ptr++;
}
}
}
#endif
#endif
#ifdef BUILD_SCALE_SMOOTH
# ifdef BUILD_MMX
# undef SCALE_FUNC
# define SCALE_FUNC evas_common_scale_rgba_in_to_out_clip_smooth_mmx
# undef SCALE_USING_MMX
# define SCALE_USING_MMX
# include "evas_scale_smooth_scaler.c"
# endif
# ifdef BUILD_C
# undef SCALE_FUNC
# define SCALE_FUNC evas_common_scale_rgba_in_to_out_clip_smooth_c
# undef SCALE_USING_MMX
# include "evas_scale_smooth_scaler.c"
# endif
EAPI void EAPI void
evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst, evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
RGBA_Draw_Context *dc, RGBA_Draw_Context *dc,
int src_region_x, int src_region_y, int src_region_x, int src_region_y,
int src_region_w, int src_region_h, int src_region_w, int src_region_h,
int dst_region_x, int dst_region_y, int dst_region_x, int dst_region_y,
int dst_region_w, int dst_region_h) int dst_region_w, int dst_region_h)
{ {
# ifdef BUILD_MMX # ifdef BUILD_MMX
int mmx, sse, sse2; int mmx, sse, sse2;
@ -517,13 +170,11 @@ evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
dst_region_w, dst_region_h); dst_region_w, dst_region_h);
else else
# endif # endif
# ifdef BUILD_C
evas_common_scale_rgba_in_to_out_clip_smooth_c(src, dst, dc, evas_common_scale_rgba_in_to_out_clip_smooth_c(src, dst, dc,
src_region_x, src_region_y, src_region_x, src_region_y,
src_region_w, src_region_h, src_region_w, src_region_h,
dst_region_x, dst_region_y, dst_region_x, dst_region_y,
dst_region_w, dst_region_h); dst_region_w, dst_region_h);
# endif
} }
/* restore clip info */ /* restore clip info */
dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
@ -561,14 +212,12 @@ evas_common_scale_rgba_in_to_out_clip_smooth_do(const Cutout_Rects *reuse,
dst_region_w, dst_region_h); dst_region_w, dst_region_h);
else else
# endif # endif
# ifdef BUILD_C
evas_common_scale_rgba_in_to_out_clip_smooth_c(src, dst, dc, evas_common_scale_rgba_in_to_out_clip_smooth_c(src, dst, dc,
src_region_x, src_region_y, src_region_x, src_region_y,
src_region_w, src_region_h, src_region_w, src_region_h,
dst_region_x, dst_region_y, dst_region_x, dst_region_y,
dst_region_w, dst_region_h); dst_region_w, dst_region_h);
# endif return;
return ;
} }
for (i = 0; i < reuse->active; ++i) for (i = 0; i < reuse->active; ++i)
@ -587,14 +236,10 @@ evas_common_scale_rgba_in_to_out_clip_smooth_do(const Cutout_Rects *reuse,
dst_region_w, dst_region_h); dst_region_w, dst_region_h);
else else
# endif # endif
# ifdef BUILD_C
evas_common_scale_rgba_in_to_out_clip_smooth_c(src, dst, dc, evas_common_scale_rgba_in_to_out_clip_smooth_c(src, dst, dc,
src_region_x, src_region_y, src_region_x, src_region_y,
src_region_w, src_region_h, src_region_w, src_region_h,
dst_region_x, dst_region_y, dst_region_x, dst_region_y,
dst_region_w, dst_region_h); dst_region_w, dst_region_h);
# endif
} }
} }
#endif

View File

@ -1,19 +1,7 @@
#ifndef _EVAS_SCALE_SMOOTH_H #ifndef _EVAS_SCALE_SMOOTH_H
#define _EVAS_SCALE_SMOOTH_H #define _EVAS_SCALE_SMOOTH_H
EAPI void evas_common_scale_rgba_mipmap_down_2x2_c (DATA32 *src, DATA32 *dst, int src_w, int src_h);
EAPI void evas_common_scale_rgba_mipmap_down_2x1_c (DATA32 *src, DATA32 *dst, int src_w, int src_h);
EAPI void evas_common_scale_rgba_mipmap_down_1x2_c (DATA32 *src, DATA32 *dst, int src_w, int src_h);
EAPI void evas_common_scale_rgb_mipmap_down_2x2_c (DATA32 *src, DATA32 *dst, int src_w, int src_h);
EAPI void evas_common_scale_rgb_mipmap_down_2x1_c (DATA32 *src, DATA32 *dst, int src_w, int src_h);
EAPI void evas_common_scale_rgb_mipmap_down_1x2_c (DATA32 *src, DATA32 *dst, int src_w, int src_h);
EAPI void evas_common_scale_rgba_mipmap_down_2x2_mmx (DATA32 *src, DATA32 *dst, int src_w, int src_h);
EAPI void evas_common_scale_rgba_mipmap_down_2x1_mmx (DATA32 *src, DATA32 *dst, int src_w, int src_h);
EAPI void evas_common_scale_rgba_mipmap_down_1x2_mmx (DATA32 *src, DATA32 *dst, int src_w, int src_h);
EAPI void evas_common_scale_rgba_in_to_out_clip_smooth_mmx (RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); EAPI void evas_common_scale_rgba_in_to_out_clip_smooth_mmx (RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
EAPI void evas_common_scale_rgba_in_to_out_clip_smooth_c (RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); EAPI void evas_common_scale_rgba_in_to_out_clip_smooth_c (RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
#endif /* _EVAS_SCALE_SMOOTH_H */ #endif /* _EVAS_SCALE_SMOOTH_H */

View File

@ -37,33 +37,15 @@
/*#define BUILD_CONVERT_32_RGB_ROT0*/ /*#define BUILD_CONVERT_32_RGB_ROT0*/
/*#define BUILD_CONVERT_32_RGB_ROT270*/ /*#define BUILD_CONVERT_32_RGB_ROT270*/
/*#define BUILD_SCALE_SAMPLE*/
/*#define BUILD_SCALE_SMOOTH*/
/*#define BUILD_SCALE_TRILINEAR*/
/*#define BUILD_MMX*/ /*#define BUILD_MMX*/
/*#define BUILD_SSE*/
/*#define BUILD_SSE3*/ /*#define BUILD_SSE3*/
/*#define BUILD_C*/
/*#define BUILD_LOADER_PNG*/ /*#define BUILD_LOADER_PNG*/
/*#define BUILD_LOADER_JPEG*/ /*#define BUILD_LOADER_JPEG*/
/*#define BUILD_LOADER_EET*/ /*#define BUILD_LOADER_EET*/
/*#define BUILD_LOADER_EDB*/
/*#define BUILD_FMEMOPEN*/ /*#define BUILD_FMEMOPEN*/
/* check in that the user configured it right */
#ifndef BUILD_MMX
# ifndef BUILD_SSE3
# ifndef BUILD_SSE
# ifndef BUILD_C
# error "Please Read the README"
#endif
# endif
# endif
#endif
#define DIRECT_SCALE #define DIRECT_SCALE
#endif #endif