From d1d8945d64aebc27397f0826b3f2e7e883a1e6d3 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 11 Aug 2004 14:23:31 +0000 Subject: [PATCH] underscore prefix the mmx implementations, in order to not export them. 2004-08-11 Matthias Clasen * pixops/pixops-internal.h: * pixops/pixops.c: * pixops/*.S: underscore prefix the mmx implementations, in order to not export them. * gdk-pixbuf.symbols: Remove the mmx pixops implementations. * abicheck.sh: No need to define INCLUDE_MMX_SYMBOLS any more. --- gdk-pixbuf/ChangeLog | 11 ++ gdk-pixbuf/abicheck.sh | 2 +- gdk-pixbuf/gdk-pixbuf.symbols | 6 - gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S | 10 +- .../pixops/composite_line_color_22_4a4_mmx.S | 10 +- gdk-pixbuf/pixops/have_mmx.S | 10 +- gdk-pixbuf/pixops/pixops-internal.h | 8 +- gdk-pixbuf/pixops/pixops.c | 120 +++++++++--------- gdk-pixbuf/pixops/scale_line_22_33_mmx.S | 10 +- 9 files changed, 98 insertions(+), 89 deletions(-) diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index adf4104b6d..14597bd37f 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,14 @@ +2004-08-11 Matthias Clasen + + * pixops/pixops-internal.h: + * pixops/pixops.c: + * pixops/*.S: underscore prefix the mmx implementations, in order + to not export them. + + * gdk-pixbuf.symbols: Remove the mmx pixops implementations. + + * abicheck.sh: No need to define INCLUDE_MMX_SYMBOLS any more. + Tue Aug 10 23:53:59 2004 Matthias Clasen Add hidden aliases for exported symbols which are diff --git a/gdk-pixbuf/abicheck.sh b/gdk-pixbuf/abicheck.sh index 9363c889d1..1c6309f338 100755 --- a/gdk-pixbuf/abicheck.sh +++ b/gdk-pixbuf/abicheck.sh @@ -1,5 +1,5 @@ #! /bin/sh -cpp -P -DINCLUDE_INTERNAL_SYMBOLS -DINCLUDE_MMX_SYMBOLS gdk-pixbuf.symbols | sed -e '/^$/d' | sort > expected-abi +cpp -P -DINCLUDE_INTERNAL_SYMBOLS gdk-pixbuf.symbols | sed -e '/^$/d' | sort > expected-abi nm -D .libs/libgdk_pixbuf-2.0.so | grep " T " | cut -c12- | grep "^\(gdk\|pixops\)_" | sort > actual-abi diff -u expected-abi actual-abi diff --git a/gdk-pixbuf/gdk-pixbuf.symbols b/gdk-pixbuf/gdk-pixbuf.symbols index 5762b21036..1001163558 100644 --- a/gdk-pixbuf/gdk-pixbuf.symbols +++ b/gdk-pixbuf/gdk-pixbuf.symbols @@ -93,9 +93,3 @@ gdk_pixdata_deserialize gdk_pixdata_from_pixbuf gdk_pixdata_serialize gdk_pixdata_to_csource -#ifdef INCLUDE_MMX_SYMBOLS -pixops_composite_line_22_4a4_mmx -pixops_composite_line_color_22_4a4_mmx -pixops_have_mmx -pixops_scale_line_22_33_mmx -#endif diff --git a/gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S b/gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S index a6e8d19433..fa67e9a908 100644 --- a/gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S +++ b/gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S @@ -6,14 +6,14 @@ gcc2_compiled.: #if !defined(__MINGW32__) && !defined(__CYGWIN__) -.globl pixops_composite_line_22_4a4_mmx - .type pixops_composite_line_22_4a4_mmx,@function -pixops_composite_line_22_4a4_mmx: +.globl _pixops_composite_line_22_4a4_mmx + .type _pixops_composite_line_22_4a4_mmx,@function +_pixops_composite_line_22_4a4_mmx: #else -.globl _pixops_composite_line_22_4a4_mmx -_pixops_composite_line_22_4a4_mmx: +.globl __pixops_composite_line_22_4a4_mmx +__pixops_composite_line_22_4a4_mmx: #endif /* diff --git a/gdk-pixbuf/pixops/composite_line_color_22_4a4_mmx.S b/gdk-pixbuf/pixops/composite_line_color_22_4a4_mmx.S index 50ad00bd5e..8472f2f6fc 100644 --- a/gdk-pixbuf/pixops/composite_line_color_22_4a4_mmx.S +++ b/gdk-pixbuf/pixops/composite_line_color_22_4a4_mmx.S @@ -6,14 +6,14 @@ gcc2_compiled.: #if !defined(__MINGW32__) && !defined(__CYGWIN__) -.globl pixops_composite_line_color_22_4a4_mmx - .type pixops_composite_line_color_22_4a4_mmx,@function -pixops_composite_line_color_22_4a4_mmx: +.globl _pixops_composite_line_color_22_4a4_mmx + .type _pixops_composite_line_color_22_4a4_mmx,@function +_pixops_composite_line_color_22_4a4_mmx: #else -.globl _pixops_composite_line_color_22_4a4_mmx -_pixops_composite_line_color_22_4a4_mmx: +.globl __pixops_composite_line_color_22_4a4_mmx +__pixops_composite_line_color_22_4a4_mmx: #endif /* diff --git a/gdk-pixbuf/pixops/have_mmx.S b/gdk-pixbuf/pixops/have_mmx.S index 4f8f5d87e3..dbb0bd5f55 100644 --- a/gdk-pixbuf/pixops/have_mmx.S +++ b/gdk-pixbuf/pixops/have_mmx.S @@ -6,14 +6,14 @@ gcc2_compiled.: #if !defined(__MINGW32__) && !defined(__CYGWIN__) -.globl pixops_have_mmx - .type pixops_have_mmx,@function -pixops_have_mmx: +.globl _pixops_have_mmx + .type _pixops_have_mmx,@function +_pixops_have_mmx: #else -.globl _pixops_have_mmx -_pixops_have_mmx: +.globl __pixops_have_mmx +__pixops_have_mmx: #endif diff --git a/gdk-pixbuf/pixops/pixops-internal.h b/gdk-pixbuf/pixops/pixops-internal.h index bb0440f5ae..3b09fc49ac 100644 --- a/gdk-pixbuf/pixops/pixops-internal.h +++ b/gdk-pixbuf/pixops/pixops-internal.h @@ -1,7 +1,7 @@ #ifdef USE_MMX -guchar *pixops_scale_line_22_33_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init); -guchar *pixops_composite_line_22_4a4_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init); -guchar *pixops_composite_line_color_22_4a4_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init, int dest_x, int check_shift, int *colors); -int pixops_have_mmx (void); +guchar *_pixops_scale_line_22_33_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init); +guchar *_pixops_composite_line_22_4a4_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init); +guchar *_pixops_composite_line_color_22_4a4_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init, int dest_x, int check_shift, int *colors); +int _pixops_have_mmx (void); #endif diff --git a/gdk-pixbuf/pixops/pixops.c b/gdk-pixbuf/pixops/pixops.c index 6f629d90ba..b235a4ac5d 100644 --- a/gdk-pixbuf/pixops/pixops.c +++ b/gdk-pixbuf/pixops/pixops.c @@ -71,35 +71,45 @@ pixops_scale_nearest (guchar *dest_buf, double scale_x, double scale_y) { - int i, j; + int i; int x; int x_step = (1 << SCALE_SHIFT) / scale_x; int y_step = (1 << SCALE_SHIFT) / scale_y; + int xmax, xstart, xstop, x_pos, y_pos; + const guchar *p; -#define INNER_LOOP(SRC_CHANNELS,DEST_CHANNELS) \ - for (j=0; j < (render_x1 - render_x0); j++) \ +#define INNER_LOOP(SRC_CHANNELS,DEST_CHANNELS,ASSIGN_PIXEL) \ + xmax = x + (render_x1 - render_x0) * x_step; \ + xstart = MIN (0, xmax); \ + xstop = MIN (src_width << SCALE_SHIFT, xmax); \ + p = src + (CLAMP (x, xstart, xstop) >> SCALE_SHIFT) * SRC_CHANNELS; \ + while (x < xstart) \ { \ - const guchar *p = src + (x >> SCALE_SHIFT) * SRC_CHANNELS; \ - \ - dest[0] = p[0]; \ - dest[1] = p[1]; \ - dest[2] = p[2]; \ - \ - if (DEST_CHANNELS == 4) \ + ASSIGN_PIXEL; \ + dest += DEST_CHANNELS; \ + x += x_step; \ + } \ + while (x < xstop) \ { \ - if (SRC_CHANNELS == 4) \ - dest[3] = p[3]; \ - else \ - dest[3] = 0xff; \ + p = src + (x >> SCALE_SHIFT) * SRC_CHANNELS; \ + ASSIGN_PIXEL; \ + dest += DEST_CHANNELS; \ + x += x_step; \ } \ - \ + x_pos = x >> SCALE_SHIFT; \ + p = src + CLAMP (x_pos, 0, src_width - 1) * SRC_CHANNELS; \ + while (x < xmax) \ + { \ + ASSIGN_PIXEL; \ dest += DEST_CHANNELS; \ x += x_step; \ } for (i = 0; i < (render_y1 - render_y0); i++) { - const guchar *src = src_buf + (((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT) * src_rowstride; + y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT; + y_pos = CLAMP (y_pos, 0, src_height - 1); + const guchar *src = src_buf + y_pos * src_rowstride; guchar *dest = dest_buf + i * dest_rowstride; x = render_x0 * x_step + x_step / 2; @@ -108,36 +118,25 @@ pixops_scale_nearest (guchar *dest_buf, { if (dest_channels == 3) { - INNER_LOOP (3, 3); + INNER_LOOP (3, 3, dest[0]=p[0];dest[1]=p[1];dest[2]=p[2]); } else { - INNER_LOOP (3, 4); + INNER_LOOP (3, 4, dest[0]=p[0];dest[1]=p[1];dest[2]=p[2]); } } else if (src_channels == 4) { if (dest_channels == 3) { - INNER_LOOP (4, 3); + INNER_LOOP (4, 3, dest[0]=p[0];dest[1]=p[1];dest[2]=p[2];dest[3]=0xff); } else { - for (j=0; j < (render_x1 - render_x0); j++) - { - const guchar *p = src + (x >> SCALE_SHIFT) * 4; - guint32 *p32; - - p32 = (guint32 *) dest; - *p32 = *((guint32 *) p); - - dest += 4; - x += x_step; - } + INNER_LOOP(4, 4, guint32 *p32=(guint32*)dest;*p32=*((guint32*)p)); } } } -#undef INNER_LOOP } static void @@ -159,23 +158,25 @@ pixops_composite_nearest (guchar *dest_buf, double scale_y, int overall_alpha) { - int i, j; + int i; int x; int x_step = (1 << SCALE_SHIFT) / scale_x; int y_step = (1 << SCALE_SHIFT) / scale_y; + int xmax, xstart, xstop, x_pos, y_pos; + const guchar *p; + unsigned int a0; + for (i = 0; i < (render_y1 - render_y0); i++) { - const guchar *src = src_buf + (((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT) * src_rowstride; + y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT; + y_pos = CLAMP (y_pos, 0, src_height - 1); + const guchar *src = src_buf + y_pos * src_rowstride; guchar *dest = dest_buf + i * dest_rowstride; x = render_x0 * x_step + x_step / 2; - for (j=0; j < (render_x1 - render_x0); j++) - { - const guchar *p = src + (x >> SCALE_SHIFT) * src_channels; - unsigned int a0; - + INNER_LOOP(src_channels, dest_channels, if (src_has_alpha) a0 = (p[3] * overall_alpha) / 0xff; else @@ -218,9 +219,7 @@ pixops_composite_nearest (guchar *dest_buf, } break; } - dest += dest_channels; - x += x_step; - } + ); } } @@ -254,14 +253,20 @@ pixops_composite_color_nearest (guchar *dest_buf, int y_step = (1 << SCALE_SHIFT) / scale_y; int r1, g1, b1, r2, g2, b2; int check_shift = get_check_shift (check_size); + int xmax, xstart, xstop, x_pos, y_pos; + const guchar *p; + unsigned int a0; for (i = 0; i < (render_y1 - render_y0); i++) { - const guchar *src = src_buf + (((i + render_y0) * y_step + y_step/2) >> SCALE_SHIFT) * src_rowstride; + y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT; + y_pos = CLAMP (y_pos, 0, src_height - 1); + const guchar *src = src_buf + y_pos * src_rowstride; guchar *dest = dest_buf + i * dest_rowstride; x = render_x0 * x_step + x_step / 2; + if (((i + check_y) >> check_shift) & 1) { r1 = (color2 & 0xff0000) >> 16; @@ -283,12 +288,8 @@ pixops_composite_color_nearest (guchar *dest_buf, b2 = color2 & 0xff; } - for (j=0 ; j < (render_x1 - render_x0); j++) - { - const guchar *p = src + (x >> SCALE_SHIFT) * src_channels; - int a0; - int tmp; - + j = 0; + INNER_LOOP(src_channels, dest_channels, if (src_has_alpha) a0 = (p[3] * overall_alpha + 0xff) >> 8; else @@ -316,6 +317,8 @@ pixops_composite_color_nearest (guchar *dest_buf, dest[2] = p[2]; break; default: + { + unsigned int tmp; if (((j + check_x) >> check_shift) & 1) { tmp = ((int) p[0] - r2) * a0; @@ -334,17 +337,18 @@ pixops_composite_color_nearest (guchar *dest_buf, tmp = ((int) p[2] - b1) * a0; dest[2] = b1 + ((tmp + (tmp >> 8) + 0x80) >> 8); } + } break; } if (dest_channels == 4) dest[3] = 0xff; - dest += dest_channels; - x += x_step; - } + j++; + ); } } +#undef INNER_LOOP static void composite_pixel (guchar *dest, int dest_x, int dest_channels, int dest_has_alpha, @@ -546,7 +550,7 @@ composite_line_22_4a4_mmx_stub (int *weights, int n_x, int n_y, mmx_weights[j][7] = 0x00010001 * (weights[4*j + 3] >> 8); } - return pixops_composite_line_22_4a4_mmx (mmx_weights, dest, src[0], src[1], x_step, dest_end, x_init); + return _pixops_composite_line_22_4a4_mmx (mmx_weights, dest, src[0], src[1], x_step, dest_end, x_init); } #endif /* USE_MMX */ @@ -691,8 +695,8 @@ composite_line_color_22_4a4_mmx_stub (int *weights, int n_x, int n_y, colors[2] = (color2 & 0xff00) << 8 | (color2 & 0xff); colors[3] = (color2 & 0xff0000) >> 16; - return pixops_composite_line_color_22_4a4_mmx (mmx_weights, dest, src[0], src[1], x_step, dest_end, x_init, - dest_x, check_shift, colors); + return _pixops_composite_line_color_22_4a4_mmx (mmx_weights, dest, src[0], src[1], x_step, dest_end, x_init, + dest_x, check_shift, colors); } #endif /* USE_MMX */ @@ -842,7 +846,7 @@ scale_line_22_33_mmx_stub (int *weights, int n_x, int n_y, mmx_weights[j][7] = 0x00010001 * (weights[4*j + 3] >> 8); } - return pixops_scale_line_22_33_mmx (mmx_weights, dest, src[0], src[1], x_step, dest_end, x_init); + return _pixops_scale_line_22_33_mmx (mmx_weights, dest, src[0], src[1], x_step, dest_end, x_init); } #endif /* USE_MMX */ @@ -1385,7 +1389,7 @@ _pixops_composite_color (guchar *dest_buf, PixopsLineFunc line_func; #ifdef USE_MMX - gboolean found_mmx = pixops_have_mmx(); + gboolean found_mmx = _pixops_have_mmx (); #endif g_return_if_fail (!(dest_channels == 3 && dest_has_alpha)); @@ -1482,7 +1486,7 @@ _pixops_composite (guchar *dest_buf, PixopsLineFunc line_func; #ifdef USE_MMX - gboolean found_mmx = pixops_have_mmx(); + gboolean found_mmx = _pixops_have_mmx (); #endif g_return_if_fail (!(dest_channels == 3 && dest_has_alpha)); @@ -1558,7 +1562,7 @@ _pixops_scale (guchar *dest_buf, PixopsLineFunc line_func; #ifdef USE_MMX - gboolean found_mmx = pixops_have_mmx(); + gboolean found_mmx = _pixops_have_mmx (); #endif g_return_if_fail (!(dest_channels == 3 && dest_has_alpha)); diff --git a/gdk-pixbuf/pixops/scale_line_22_33_mmx.S b/gdk-pixbuf/pixops/scale_line_22_33_mmx.S index f389217ca0..abdff6e83b 100644 --- a/gdk-pixbuf/pixops/scale_line_22_33_mmx.S +++ b/gdk-pixbuf/pixops/scale_line_22_33_mmx.S @@ -6,14 +6,14 @@ gcc2_compiled.: #if !defined(__MINGW32__) && !defined(__CYGWIN__) -.globl pixops_scale_line_22_33_mmx - .type pixops_scale_line_22_33_mmx,@function -pixops_scale_line_22_33_mmx: +.globl _pixops_scale_line_22_33_mmx + .type _pixops_scale_line_22_33_mmx,@function +_pixops_scale_line_22_33_mmx: #else -.globl _pixops_scale_line_22_33_mmx -_pixops_scale_line_22_33_mmx: +.globl __pixops_scale_line_22_33_mmx +__pixops_scale_line_22_33_mmx: #endif /*