retired and removed.
* app/composite/gimp-composite-dispatch.[ch]: retired and removed. * app/composite/Makefile.am: The 'test' target now builds and runs all the tests in TESTS Fixed typos of mismatched parenthesis in 'regenerate' target * app/composite/Makefile.am: TESTS now include ss2 and 3dnow instruction sets. * app/composite/make-gimp-composite-dispatch.py: retired and removed. * app/composite/gimp-composite.c: call the installers of all the various instruction sets supplied by x86 type processors. * app/base/base.c (base_init): Call gimp_composite_init() *before* paint_funcs_setup() (preparation for retiring app/paint-funcs/paint-funcs.c) * app/composite/gimp-composite-sse2.[ch] * app/composite/gimp-composite-3dnow.[ch] * app/composite/gimp-composite-sse2-installer.c * app/composite/gimp-composite-3dnow-installer.c: Added * app/composite/make-installer.py: generate regression test programmes that take the command line arguments --iterations and --n-pixels for the number of iterations of a set of tests, and the number of pixels to use in each test, respectively. Conditionally compile tests in order to build and run tests on machines that can actually perform the tests. Failing a regression test now causes remaining tests to be skipped and a non-zero exit code by the programme.
This commit is contained in:
38
ChangeLog
38
ChangeLog
@ -1,3 +1,41 @@
|
||||
2003-08-17 Helvetix Victorinox <helvetix@gimp.org>
|
||||
|
||||
* app/composite/gimp-composite-dispatch.[ch]: retired and removed.
|
||||
|
||||
* app/composite/Makefile.am: The 'test' target now builds and runs
|
||||
all the tests in TESTS
|
||||
|
||||
Fixed typos of mismatched parenthesis in 'regenerate' target
|
||||
|
||||
* app/composite/Makefile.am: TESTS now include ss2 and 3dnow
|
||||
instruction sets.
|
||||
|
||||
* app/composite/make-gimp-composite-dispatch.py: retired and removed.
|
||||
|
||||
* app/composite/gimp-composite.c: call the installers of all the
|
||||
various instruction sets supplied by x86 type processors.
|
||||
|
||||
* app/base/base.c (base_init): Call gimp_composite_init() *before*
|
||||
paint_funcs_setup() (preparation for retiring
|
||||
app/paint-funcs/paint-funcs.c)
|
||||
|
||||
* app/composite/gimp-composite-sse2.[ch]
|
||||
* app/composite/gimp-composite-3dnow.[ch]
|
||||
* app/composite/gimp-composite-sse2-installer.c
|
||||
* app/composite/gimp-composite-3dnow-installer.c:
|
||||
Added
|
||||
|
||||
* app/composite/make-installer.py: generate regression test
|
||||
programmes that take the command line arguments --iterations and
|
||||
--n-pixels for the number of iterations of a set of tests, and the
|
||||
number of pixels to use in each test, respectively.
|
||||
|
||||
Conditionally compile tests in order to build and run tests on
|
||||
machines that can actually perform the tests.
|
||||
|
||||
Failing a regression test now causes remaining tests to be
|
||||
skipped and a non-zero exit code by the programme.
|
||||
|
||||
2003-08-18 Simon Budig <simon@gimp.org>
|
||||
|
||||
* app/tools/gimpvectortool.c: Minor fix.
|
||||
|
||||
@ -128,8 +128,9 @@ base_init (GimpBaseConfig *config,
|
||||
|
||||
g_free (path);
|
||||
|
||||
paint_funcs_setup (use_mmx);
|
||||
gimp_composite_init ();
|
||||
|
||||
paint_funcs_setup (use_mmx);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@ -28,6 +28,10 @@ libappcomposite_a_sources = \
|
||||
gimp-composite-mmx.h \
|
||||
gimp-composite-sse.c \
|
||||
gimp-composite-sse.h \
|
||||
gimp-composite-sse2.c \
|
||||
gimp-composite-sse2.h \
|
||||
gimp-composite-3dnow.c \
|
||||
gimp-composite-3dnow.h \
|
||||
gimp-composite-altivec.c \
|
||||
gimp-composite-altivec.h \
|
||||
gimp-composite-vis.c \
|
||||
@ -41,6 +45,10 @@ libappcomposite_a_built_sources = \
|
||||
gimp-composite-mmx-installer.h \
|
||||
gimp-composite-sse-installer.c \
|
||||
gimp-composite-sse-installer.h \
|
||||
gimp-composite-sse2-installer.c \
|
||||
gimp-composite-sse2-installer.h \
|
||||
gimp-composite-3dnow-installer.c \
|
||||
gimp-composite-3dnow-installer.h \
|
||||
gimp-composite-altivec-installer.c \
|
||||
gimp-composite-altivec-installer.h \
|
||||
gimp-composite-vis-installer.c \
|
||||
@ -50,22 +58,38 @@ libappcomposite_a_SOURCES = $(libappcomposite_a_built_sources) $(libappcomposite
|
||||
|
||||
regenerate: gimp-composite-generic.o gimp-composite-mmx.o gimp-composite-sse.o gimp-composite-altivec.o gimp-composite-vis.o
|
||||
$(srcdir)/make-installer.py -t -f gimp-composite-generic.o
|
||||
$(srcdir)/make-installer.py -t -r '(__GNUC__ >= 3) && defined(USE_MMX) && defined(ARCH_X86)' -f gimp-composite-mmx.o
|
||||
$(srcdir)/make-installer.py -t -r '(__GNUC__ >= 3) && defined(USE_MMX) && defined(ARCH_X86)' -f gimp-composite-sse.o
|
||||
$(srcdir)/make-installer.py -t -r '(__GNUC__ >= 3) && defined(USE_ALTIVEC) && defined(ARCH_PPC)' -f gimp-composite-altivec.o
|
||||
$(srcdir)/make-installer.py -t -r '(__GNUC__ >= 3) && defined(USE_VIS) && defined(ARCH_SPARC))' -f gimp-composite-vis.o
|
||||
$(srcdir)/make-installer.py -t -r '(__GNUC__ >= 3) && defined(USE_MMX) && defined(ARCH_X86)' -f gimp-composite-mmx.o
|
||||
$(srcdir)/make-installer.py -t -r '(__GNUC__ >= 3) && defined(USE_SSE) && defined(ARCH_X86)' -f gimp-composite-sse.o
|
||||
$(srcdir)/make-installer.py -t -r '(__GNUC__ >= 3) && defined(USE_SSE) && defined(ARCH_X86)' -f gimp-composite-sse2.o
|
||||
$(srcdir)/make-installer.py -t -r '(__GNUC__ >= 3) && defined(USE_3DNOW) && defined(ARCH_X86)' -f gimp-composite-3dnow.o
|
||||
$(srcdir)/make-installer.py -t -r '(__GNUC__ >= 3) && defined(USE_ALTIVEC) && defined(ARCH_PPC)' -f gimp-composite-altivec.o
|
||||
$(srcdir)/make-installer.py -t -r '(__GNUC__ >= 3) && defined(USE_VIS) && defined(ARCH_SPARC)' -f gimp-composite-vis.o
|
||||
|
||||
EXTRA_DIST = \
|
||||
make-installer.py \
|
||||
ns.py
|
||||
|
||||
EXTRA_PROGRAMS = test-composite gimp-composite-test gimp-composite-mmx-test gimp-composite-sse-test gimp-composite-altivec-test gimp-composite-vis-test
|
||||
|
||||
#
|
||||
# unit tests and meta tools for GimpComposite
|
||||
#
|
||||
|
||||
TESTS = test-composite gimp-composite-test gimp-composite-mmx-test gimp-composite-sse-test gimp-composite-altivec-test gimp-composite-vis-test
|
||||
TESTS = test-composite gimp-composite-test \
|
||||
gimp-composite-mmx-test \
|
||||
gimp-composite-sse-test \
|
||||
gimp-composite-sse2-test \
|
||||
gimp-composite-3dnow-test \
|
||||
gimp-composite-altivec-test \
|
||||
gimp-composite-vis-test
|
||||
|
||||
|
||||
tests: $(TESTS)
|
||||
for test in $(TESTS); do \
|
||||
echo $${test}; \
|
||||
if ! $${test}; then \
|
||||
exit 1; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
test_composite_SOURCES = \
|
||||
gimp-composite-regression.c \
|
||||
@ -120,6 +144,34 @@ gimp_composite_sse_test_LDADD = \
|
||||
$(top_builddir)/app/base/libappbase.a \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
gimp_composite_sse2_test_SOURCES = \
|
||||
gimp-composite-regression.c \
|
||||
gimp-composite-regression.h \
|
||||
gimp-composite-sse2-test.c
|
||||
|
||||
gimp_composite_sse2_test_DEPENDENCIES = $(gimpcomposite_dependencies)
|
||||
|
||||
gimp_composite_sse2_test_LDADD = \
|
||||
libappcomposite.a \
|
||||
$(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la \
|
||||
$(top_builddir)/app/base/libappbase.a \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
|
||||
gimp_composite_3dnow_test_SOURCES = \
|
||||
gimp-composite-regression.c \
|
||||
gimp-composite-regression.h \
|
||||
gimp-composite-3dnow-test.c
|
||||
|
||||
gimp_composite_3dnow_test_DEPENDENCIES = $(gimpcomposite_dependencies)
|
||||
|
||||
gimp_composite_3dnow_test_LDADD = \
|
||||
libappcomposite.a \
|
||||
$(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la \
|
||||
$(top_builddir)/app/base/libappbase.a \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
|
||||
gimp_composite_altivec_test_SOURCES = \
|
||||
gimp-composite-regression.c \
|
||||
gimp-composite-regression.h \
|
||||
@ -146,4 +198,6 @@ gimp_composite_vis_test_LDADD = \
|
||||
$(top_builddir)/app/base/libappbase.a \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
EXTRA_PROGRAMS = test-composite gimp-composite-test $(TESTS)
|
||||
|
||||
CLEANFILES = $(EXTRA_PROGRAMS)
|
||||
|
||||
19
app/composite/gimp-composite-3dnow-installer.c
Normal file
19
app/composite/gimp-composite-3dnow-installer.c
Normal file
@ -0,0 +1,19 @@
|
||||
/* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT */
|
||||
/* REGENERATE BY USING make-installer.py */
|
||||
#include "config.h"
|
||||
#include <glib-object.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "base/base-types.h"
|
||||
#include "gimp-composite.h"
|
||||
|
||||
#include "gimp-composite-3dnow.h"
|
||||
|
||||
|
||||
void
|
||||
gimp_composite_3dnow_install (void)
|
||||
{
|
||||
/* nothing to do */
|
||||
|
||||
gimp_composite_3dnow_init();
|
||||
}
|
||||
48
app/composite/gimp-composite-3dnow.c
Normal file
48
app/composite/gimp-composite-3dnow.c
Normal file
@ -0,0 +1,48 @@
|
||||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* -*- mode: c tab-width: 2; -*-
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Gimp image compositing
|
||||
* Copyright (C) 2003 Helvetix Victorinox, a pseudonym, <helvetix@gimp.org>
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if defined(USE_MMX)
|
||||
#if defined(ARCH_X86)
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "base/base-types.h"
|
||||
|
||||
#include "gimp-composite.h"
|
||||
#include "gimp-composite-3dnow.h"
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
|
||||
#endif /* __GNUC__ > 3 */
|
||||
#endif /* defined(ARCH_X86) */
|
||||
#endif /* defined(USE_MMX) */
|
||||
|
||||
void
|
||||
gimp_composite_3dnow_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
12
app/composite/gimp-composite-3dnow.h
Normal file
12
app/composite/gimp-composite-3dnow.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef gimp_composite_3dnow_h
|
||||
#define gimp_composite_3dnow_h
|
||||
|
||||
extern void gimp_composite_3dnow_init(void);
|
||||
|
||||
/*
|
||||
* The function gimp_composite_*_install() is defined in the code generated by make-install.py
|
||||
* I hate to create a .h file just for that declaration, so I do it here (for now).
|
||||
*/
|
||||
extern void gimp_composite_3dnow_install(void);
|
||||
|
||||
#endif
|
||||
@ -11,7 +11,6 @@
|
||||
#include "base/base-types.h"
|
||||
|
||||
#include "gimp-composite.h"
|
||||
#include "gimp-composite-dispatch.h"
|
||||
#include "gimp-composite-regression.h"
|
||||
#include "gimp-composite-util.h"
|
||||
#include "gimp-composite-generic.h"
|
||||
@ -20,6 +19,7 @@
|
||||
int
|
||||
gimp_composite_altivec_test(int iterations, int n_pixels)
|
||||
{
|
||||
#if (__GNUC__ >= 3) && defined(USE_ALTIVEC) && defined(ARCH_PPC)
|
||||
GimpCompositeContext generic_ctx;
|
||||
GimpCompositeContext special_ctx;
|
||||
double ft0;
|
||||
@ -56,6 +56,7 @@ gimp_composite_altivec_test(int iterations, int n_pixels)
|
||||
va8M[i].a = i;
|
||||
}
|
||||
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -72,6 +73,19 @@ main(int argc, char *argv[])
|
||||
iterations = 1;
|
||||
n_pixels = 262145;
|
||||
|
||||
argv++, argc--;
|
||||
while (argc >= 2) {
|
||||
if ((strcmp(argv[0], "--iterations") == 0 || strcmp(argv[0], "-i") == 0) && argc > 1) {
|
||||
iterations = atoi(argv[1]);
|
||||
argc -= 2, argv++; argv++;
|
||||
} else if ((strcmp(argv[0], "--n-pixels") == 0 || strcmp(argv[0], "-n") == 0) && argc > 1) {
|
||||
n_pixels = atoi(argv[1]);
|
||||
argc -= 2, argv++; argv++;
|
||||
} else {
|
||||
argc--, argv++;
|
||||
}
|
||||
}
|
||||
|
||||
gimp_composite_generic_install();
|
||||
|
||||
return (gimp_composite_altivec_test(iterations, n_pixels));
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,3 +0,0 @@
|
||||
/* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT */
|
||||
|
||||
typedef void (*GimpCompositeFunctionTable[GIMP_COMPOSITE_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N]);
|
||||
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,6 @@
|
||||
#include "base/base-types.h"
|
||||
|
||||
#include "gimp-composite.h"
|
||||
#include "gimp-composite-dispatch.h"
|
||||
#include "gimp-composite-regression.h"
|
||||
#include "gimp-composite-util.h"
|
||||
#include "gimp-composite-generic.h"
|
||||
@ -20,6 +19,7 @@
|
||||
int
|
||||
gimp_composite_mmx_test(int iterations, int n_pixels)
|
||||
{
|
||||
#if (__GNUC__ >= 3) && defined(USE_MMX) && defined(ARCH_X86)
|
||||
GimpCompositeContext generic_ctx;
|
||||
GimpCompositeContext special_ctx;
|
||||
double ft0;
|
||||
@ -86,7 +86,9 @@ gimp_composite_mmx_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_multiply_rgba8_rgba8_rgba8_mmx, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("multiply", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("multiply", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("multiply", ft0, ft1);
|
||||
|
||||
/* gimp_composite_screen_rgba8_rgba8_rgba8 */
|
||||
@ -118,7 +120,9 @@ gimp_composite_mmx_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_screen_rgba8_rgba8_rgba8_mmx, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("screen", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("screen", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("screen", ft0, ft1);
|
||||
|
||||
/* gimp_composite_overlay_rgba8_rgba8_rgba8 */
|
||||
@ -150,7 +154,9 @@ gimp_composite_mmx_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_overlay_rgba8_rgba8_rgba8_mmx, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("overlay", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("overlay", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("overlay", ft0, ft1);
|
||||
|
||||
/* gimp_composite_difference_rgba8_rgba8_rgba8 */
|
||||
@ -182,7 +188,9 @@ gimp_composite_mmx_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_difference_rgba8_rgba8_rgba8_mmx, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("difference", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("difference", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("difference", ft0, ft1);
|
||||
|
||||
/* gimp_composite_addition_rgba8_rgba8_rgba8 */
|
||||
@ -214,7 +222,9 @@ gimp_composite_mmx_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_addition_rgba8_rgba8_rgba8_mmx, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("addition", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("addition", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("addition", ft0, ft1);
|
||||
|
||||
/* gimp_composite_subtract_rgba8_rgba8_rgba8 */
|
||||
@ -246,7 +256,9 @@ gimp_composite_mmx_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_subtract_rgba8_rgba8_rgba8_mmx, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("subtract", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("subtract", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("subtract", ft0, ft1);
|
||||
|
||||
/* gimp_composite_darken_rgba8_rgba8_rgba8 */
|
||||
@ -278,7 +290,9 @@ gimp_composite_mmx_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_darken_rgba8_rgba8_rgba8_mmx, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("darken", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("darken", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("darken", ft0, ft1);
|
||||
|
||||
/* gimp_composite_lighten_rgba8_rgba8_rgba8 */
|
||||
@ -310,7 +324,9 @@ gimp_composite_mmx_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_lighten_rgba8_rgba8_rgba8_mmx, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("lighten", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("lighten", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("lighten", ft0, ft1);
|
||||
|
||||
/* gimp_composite_divide_rgba8_rgba8_rgba8 */
|
||||
@ -342,7 +358,9 @@ gimp_composite_mmx_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_divide_rgba8_rgba8_rgba8_mmx, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("divide", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("divide", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("divide", ft0, ft1);
|
||||
|
||||
/* gimp_composite_dodge_rgba8_rgba8_rgba8 */
|
||||
@ -374,7 +392,9 @@ gimp_composite_mmx_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_dodge_rgba8_rgba8_rgba8_mmx, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("dodge", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("dodge", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("dodge", ft0, ft1);
|
||||
|
||||
/* gimp_composite_burn_rgba8_rgba8_rgba8 */
|
||||
@ -406,7 +426,9 @@ gimp_composite_mmx_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_burn_rgba8_rgba8_rgba8_mmx, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("burn", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("burn", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("burn", ft0, ft1);
|
||||
|
||||
/* gimp_composite_grain_extract_rgba8_rgba8_rgba8 */
|
||||
@ -438,7 +460,9 @@ gimp_composite_mmx_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_grain_extract_rgba8_rgba8_rgba8_mmx, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("grain_extract", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("grain_extract", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("grain_extract", ft0, ft1);
|
||||
|
||||
/* gimp_composite_grain_merge_rgba8_rgba8_rgba8 */
|
||||
@ -470,7 +494,9 @@ gimp_composite_mmx_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_grain_merge_rgba8_rgba8_rgba8_mmx, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("grain_merge", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("grain_merge", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("grain_merge", ft0, ft1);
|
||||
|
||||
/* gimp_composite_swap_rgba8_rgba8_rgba8 */
|
||||
@ -502,7 +528,9 @@ gimp_composite_mmx_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_swap_rgba8_rgba8_rgba8_mmx, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("swap", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("swap", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("swap", ft0, ft1);
|
||||
|
||||
/* gimp_composite_scale_rgba8_rgba8_rgba8 */
|
||||
@ -534,8 +562,11 @@ gimp_composite_mmx_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_scale_rgba8_rgba8_rgba8_mmx, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("scale", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("scale", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("scale", ft0, ft1);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -552,6 +583,19 @@ main(int argc, char *argv[])
|
||||
iterations = 1;
|
||||
n_pixels = 262145;
|
||||
|
||||
argv++, argc--;
|
||||
while (argc >= 2) {
|
||||
if ((strcmp(argv[0], "--iterations") == 0 || strcmp(argv[0], "-i") == 0) && argc > 1) {
|
||||
iterations = atoi(argv[1]);
|
||||
argc -= 2, argv++; argv++;
|
||||
} else if ((strcmp(argv[0], "--n-pixels") == 0 || strcmp(argv[0], "-n") == 0) && argc > 1) {
|
||||
n_pixels = atoi(argv[1]);
|
||||
argc -= 2, argv++; argv++;
|
||||
} else {
|
||||
argc--, argv++;
|
||||
}
|
||||
}
|
||||
|
||||
gimp_composite_generic_install();
|
||||
|
||||
return (gimp_composite_mmx_test(iterations, n_pixels));
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
#include "base/base-types.h"
|
||||
|
||||
#include "gimp-composite.h"
|
||||
#include "gimp-composite-dispatch.h"
|
||||
#include "gimp-composite-regression.h"
|
||||
#include "gimp-composite-util.h"
|
||||
#include "gimp-composite-generic.h"
|
||||
|
||||
@ -16,7 +16,7 @@ static struct install_table {
|
||||
GimpPixelFormat D;
|
||||
void (*function)(GimpCompositeContext *);
|
||||
} _gimp_composite_sse[] = {
|
||||
#if (__GNUC__ >= 3) && defined(USE_MMX) && defined(ARCH_X86)
|
||||
#if (__GNUC__ >= 3) && defined(USE_SSE) && defined(ARCH_X86)
|
||||
{ GIMP_COMPOSITE_MULTIPLY, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, gimp_composite_multiply_rgba8_rgba8_rgba8_sse },
|
||||
{ GIMP_COMPOSITE_SCREEN, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, gimp_composite_screen_rgba8_rgba8_rgba8_sse },
|
||||
{ GIMP_COMPOSITE_OVERLAY, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, gimp_composite_overlay_rgba8_rgba8_rgba8_sse },
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
#include "base/base-types.h"
|
||||
|
||||
#include "gimp-composite.h"
|
||||
#include "gimp-composite-dispatch.h"
|
||||
#include "gimp-composite-regression.h"
|
||||
#include "gimp-composite-util.h"
|
||||
#include "gimp-composite-generic.h"
|
||||
@ -20,6 +19,7 @@
|
||||
int
|
||||
gimp_composite_sse_test(int iterations, int n_pixels)
|
||||
{
|
||||
#if (__GNUC__ >= 3) && defined(USE_SSE) && defined(ARCH_X86)
|
||||
GimpCompositeContext generic_ctx;
|
||||
GimpCompositeContext special_ctx;
|
||||
double ft0;
|
||||
@ -86,7 +86,9 @@ gimp_composite_sse_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_multiply_rgba8_rgba8_rgba8_sse, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("multiply", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("multiply", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("multiply", ft0, ft1);
|
||||
|
||||
/* gimp_composite_screen_rgba8_rgba8_rgba8 */
|
||||
@ -118,7 +120,9 @@ gimp_composite_sse_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_screen_rgba8_rgba8_rgba8_sse, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("screen", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("screen", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("screen", ft0, ft1);
|
||||
|
||||
/* gimp_composite_overlay_rgba8_rgba8_rgba8 */
|
||||
@ -150,7 +154,9 @@ gimp_composite_sse_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_overlay_rgba8_rgba8_rgba8_sse, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("overlay", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("overlay", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("overlay", ft0, ft1);
|
||||
|
||||
/* gimp_composite_difference_rgba8_rgba8_rgba8 */
|
||||
@ -182,7 +188,9 @@ gimp_composite_sse_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_difference_rgba8_rgba8_rgba8_sse, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("difference", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("difference", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("difference", ft0, ft1);
|
||||
|
||||
/* gimp_composite_addition_rgba8_rgba8_rgba8 */
|
||||
@ -214,7 +222,9 @@ gimp_composite_sse_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_addition_rgba8_rgba8_rgba8_sse, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("addition", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("addition", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("addition", ft0, ft1);
|
||||
|
||||
/* gimp_composite_subtract_rgba8_rgba8_rgba8 */
|
||||
@ -246,7 +256,9 @@ gimp_composite_sse_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_subtract_rgba8_rgba8_rgba8_sse, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("subtract", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("subtract", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("subtract", ft0, ft1);
|
||||
|
||||
/* gimp_composite_darken_rgba8_rgba8_rgba8 */
|
||||
@ -278,7 +290,9 @@ gimp_composite_sse_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_darken_rgba8_rgba8_rgba8_sse, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("darken", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("darken", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("darken", ft0, ft1);
|
||||
|
||||
/* gimp_composite_lighten_rgba8_rgba8_rgba8 */
|
||||
@ -310,7 +324,9 @@ gimp_composite_sse_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_lighten_rgba8_rgba8_rgba8_sse, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("lighten", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("lighten", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("lighten", ft0, ft1);
|
||||
|
||||
/* gimp_composite_divide_rgba8_rgba8_rgba8 */
|
||||
@ -342,7 +358,9 @@ gimp_composite_sse_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_divide_rgba8_rgba8_rgba8_sse, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("divide", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("divide", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("divide", ft0, ft1);
|
||||
|
||||
/* gimp_composite_dodge_rgba8_rgba8_rgba8 */
|
||||
@ -374,7 +392,9 @@ gimp_composite_sse_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_dodge_rgba8_rgba8_rgba8_sse, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("dodge", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("dodge", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("dodge", ft0, ft1);
|
||||
|
||||
/* gimp_composite_burn_rgba8_rgba8_rgba8 */
|
||||
@ -406,7 +426,9 @@ gimp_composite_sse_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_burn_rgba8_rgba8_rgba8_sse, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("burn", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("burn", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("burn", ft0, ft1);
|
||||
|
||||
/* gimp_composite_grain_extract_rgba8_rgba8_rgba8 */
|
||||
@ -438,7 +460,9 @@ gimp_composite_sse_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_grain_extract_rgba8_rgba8_rgba8_sse, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("grain_extract", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("grain_extract", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("grain_extract", ft0, ft1);
|
||||
|
||||
/* gimp_composite_grain_merge_rgba8_rgba8_rgba8 */
|
||||
@ -470,7 +494,9 @@ gimp_composite_sse_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_grain_merge_rgba8_rgba8_rgba8_sse, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("grain_merge", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("grain_merge", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("grain_merge", ft0, ft1);
|
||||
|
||||
/* gimp_composite_swap_rgba8_rgba8_rgba8 */
|
||||
@ -502,7 +528,9 @@ gimp_composite_sse_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_swap_rgba8_rgba8_rgba8_sse, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("swap", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("swap", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("swap", ft0, ft1);
|
||||
|
||||
/* gimp_composite_scale_rgba8_rgba8_rgba8 */
|
||||
@ -534,8 +562,11 @@ gimp_composite_sse_test(int iterations, int n_pixels)
|
||||
memset(generic_ctx.D, 0, generic_ctx.n_pixels * gimp_composite_pixel_bpp[generic_ctx.pixelformat_D]);
|
||||
ft0 = gimp_composite_regression_time_function(iterations, gimp_composite_dispatch, &generic_ctx);
|
||||
ft1 = gimp_composite_regression_time_function(iterations, gimp_composite_scale_rgba8_rgba8_rgba8_sse, &special_ctx);
|
||||
gimp_composite_regression_compare_contexts("scale", &generic_ctx, &special_ctx);
|
||||
if (gimp_composite_regression_compare_contexts("scale", &generic_ctx, &special_ctx)) {
|
||||
return (1);
|
||||
}
|
||||
gimp_composite_regression_timer_report("scale", ft0, ft1);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -552,6 +583,19 @@ main(int argc, char *argv[])
|
||||
iterations = 1;
|
||||
n_pixels = 262145;
|
||||
|
||||
argv++, argc--;
|
||||
while (argc >= 2) {
|
||||
if ((strcmp(argv[0], "--iterations") == 0 || strcmp(argv[0], "-i") == 0) && argc > 1) {
|
||||
iterations = atoi(argv[1]);
|
||||
argc -= 2, argv++; argv++;
|
||||
} else if ((strcmp(argv[0], "--n-pixels") == 0 || strcmp(argv[0], "-n") == 0) && argc > 1) {
|
||||
n_pixels = atoi(argv[1]);
|
||||
argc -= 2, argv++; argv++;
|
||||
} else {
|
||||
argc--, argv++;
|
||||
}
|
||||
}
|
||||
|
||||
gimp_composite_generic_install();
|
||||
|
||||
return (gimp_composite_sse_test(iterations, n_pixels));
|
||||
|
||||
19
app/composite/gimp-composite-sse2-installer.c
Normal file
19
app/composite/gimp-composite-sse2-installer.c
Normal file
@ -0,0 +1,19 @@
|
||||
/* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT */
|
||||
/* REGENERATE BY USING make-installer.py */
|
||||
#include "config.h"
|
||||
#include <glib-object.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "base/base-types.h"
|
||||
#include "gimp-composite.h"
|
||||
|
||||
#include "gimp-composite-sse2.h"
|
||||
|
||||
|
||||
void
|
||||
gimp_composite_sse2_install (void)
|
||||
{
|
||||
/* nothing to do */
|
||||
|
||||
gimp_composite_sse2_init();
|
||||
}
|
||||
48
app/composite/gimp-composite-sse2.c
Normal file
48
app/composite/gimp-composite-sse2.c
Normal file
@ -0,0 +1,48 @@
|
||||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* -*- mode: c tab-width: 2; -*-
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Gimp image compositing
|
||||
* Copyright (C) 2003 Helvetix Victorinox, a pseudonym, <helvetix@gimp.org>
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if defined(USE_SSE)
|
||||
#if defined(ARCH_X86)
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "base/base-types.h"
|
||||
|
||||
#include "gimp-composite.h"
|
||||
#include "gimp-composite-vis.h"
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
|
||||
#endif /* __GNUC__ > 3 */
|
||||
#endif /* defined(ARCH_X86) */
|
||||
#endif /* defined(USE_SSE) */
|
||||
|
||||
void
|
||||
gimp_composite_sse2_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
12
app/composite/gimp-composite-sse2.h
Normal file
12
app/composite/gimp-composite-sse2.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef gimp_composite_sse2_h
|
||||
#define gimp_composite_sse2_h
|
||||
|
||||
extern void gimp_composite_sse2_init(void);
|
||||
|
||||
/*
|
||||
* The function gimp_composite_*_install() is defined in the code generated by make-install.py
|
||||
* I hate to create a .h file just for that declaration, so I do it here (for now).
|
||||
*/
|
||||
extern void gimp_composite_sse2_install(void);
|
||||
|
||||
#endif
|
||||
@ -11,7 +11,6 @@
|
||||
#include "base/base-types.h"
|
||||
|
||||
#include "gimp-composite.h"
|
||||
#include "gimp-composite-dispatch.h"
|
||||
#include "gimp-composite-regression.h"
|
||||
#include "gimp-composite-util.h"
|
||||
#include "gimp-composite-generic.h"
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
#include "base/base-types.h"
|
||||
|
||||
#include "gimp-composite.h"
|
||||
#include "gimp-composite-dispatch.h"
|
||||
#include "gimp-composite-regression.h"
|
||||
#include "gimp-composite-util.h"
|
||||
#include "gimp-composite-generic.h"
|
||||
@ -20,6 +19,7 @@
|
||||
int
|
||||
gimp_composite_vis_test(int iterations, int n_pixels)
|
||||
{
|
||||
#if (__GNUC__ >= 3) && defined(USE_VIS) && defined(ARCH_SPARC)
|
||||
GimpCompositeContext generic_ctx;
|
||||
GimpCompositeContext special_ctx;
|
||||
double ft0;
|
||||
@ -56,6 +56,7 @@ gimp_composite_vis_test(int iterations, int n_pixels)
|
||||
va8M[i].a = i;
|
||||
}
|
||||
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -72,6 +73,19 @@ main(int argc, char *argv[])
|
||||
iterations = 1;
|
||||
n_pixels = 262145;
|
||||
|
||||
argv++, argc--;
|
||||
while (argc >= 2) {
|
||||
if ((strcmp(argv[0], "--iterations") == 0 || strcmp(argv[0], "-i") == 0) && argc > 1) {
|
||||
iterations = atoi(argv[1]);
|
||||
argc -= 2, argv++; argv++;
|
||||
} else if ((strcmp(argv[0], "--n-pixels") == 0 || strcmp(argv[0], "-n") == 0) && argc > 1) {
|
||||
n_pixels = atoi(argv[1]);
|
||||
argc -= 2, argv++; argv++;
|
||||
} else {
|
||||
argc--, argv++;
|
||||
}
|
||||
}
|
||||
|
||||
gimp_composite_generic_install();
|
||||
|
||||
return (gimp_composite_vis_test(iterations, n_pixels));
|
||||
|
||||
@ -301,6 +301,7 @@ void
|
||||
gimp_composite_init (void)
|
||||
{
|
||||
const gchar *p;
|
||||
guint32 cpu;
|
||||
|
||||
if ((p = g_getenv ("GIMP_COMPOSITE")))
|
||||
{
|
||||
@ -316,50 +317,45 @@ gimp_composite_init (void)
|
||||
gimp_composite_generic_install();
|
||||
g_printerr ("gimp-composite:");
|
||||
#ifdef ARCH_X86
|
||||
#ifdef USE_MMX /* USE_MMX here means "use cpu optimisations" XXX */
|
||||
if (cpu_accel() & CPU_ACCEL_X86_MMX) {
|
||||
extern void gimp_composite_mmx_install(void);
|
||||
g_printerr (" mmx");
|
||||
gimp_composite_mmx_install();
|
||||
}
|
||||
|
||||
if (cpu_accel() & CPU_ACCEL_X86_SSE) {
|
||||
if (cpu_accel() & CPU_ACCEL_X86_SSE || cpu_accel() & CPU_ACCEL_X86_MMXEXT) {
|
||||
extern void gimp_composite_sse_install(void);
|
||||
g_printerr (" sse");
|
||||
gimp_composite_sse_install();
|
||||
}
|
||||
#if 0
|
||||
if (cpu_accel() & CPU_ACCEL_X86_MMXEXT) {
|
||||
g_printerr (" mmxext");
|
||||
gimp_composite_mmxext_install();
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
|
||||
if (cpu_accel() & CPU_ACCEL_X86_SSE2) {
|
||||
extern void gimp_composite_sse2_install(void);
|
||||
g_printerr (" sse2");
|
||||
gimp_composite_sse2_install();
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
|
||||
if (cpu_accel() & CPU_ACCEL_X86_3DNOW) {
|
||||
extern void gimp_composite_3dnow_install(void);
|
||||
g_printerr (" 3dnow");
|
||||
gimp_composite_3dnow_install();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ARCH_PPC
|
||||
#if 0
|
||||
if (cpu_accel() & CPU_ACCEL_PPC_ALTIVEC) {
|
||||
g_printerr (" altivec");
|
||||
gimp_composite_altivec_install();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ARCH_SPARC
|
||||
#if 0
|
||||
g_printerr (" vis");
|
||||
gimp_composite_vis_install();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
g_printerr ("\n");
|
||||
|
||||
gimp_composite_options.bits |= GIMP_COMPOSITE_OPTION_INITIALISED;
|
||||
|
||||
@ -1,470 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- mode: python py-indent-offset: 2; -*-
|
||||
#
|
||||
# Gimp image compositing
|
||||
# Copyright (C) 2003 Helvetix Victorinox, <helvetix@gimp.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
import sys
|
||||
import string
|
||||
import os
|
||||
import ns
|
||||
import pprint
|
||||
import getopt
|
||||
import copy
|
||||
|
||||
#
|
||||
# This programme creates C code for gluing a collection of compositing
|
||||
# functions into an array indexed by compositing function, and the
|
||||
# pixel formats of its arguments.
|
||||
#
|
||||
# I make some assuptions about the names of the compositing functions.
|
||||
#
|
||||
# I look into the namespace of a set of object files and figure out
|
||||
# from them what compositing functions are implemented. This let's me
|
||||
# build a table with the right cells populated with either the special
|
||||
# compositing functions, or to use a generically implemented
|
||||
# compositing function.
|
||||
|
||||
|
||||
# These are in the same order as they appear in the
|
||||
# ./app/base/base-enums.h GimpLayerModeEffects enumeration, because we
|
||||
# (probably unwisely) use the value of the enumeration as an index
|
||||
# into the Big Table.
|
||||
#
|
||||
# XXX I'd like some python functions that let me rummage around in C code....
|
||||
#
|
||||
composite_modes=[
|
||||
"GIMP_COMPOSITE_NORMAL",
|
||||
"GIMP_COMPOSITE_DISSOLVE",
|
||||
"GIMP_COMPOSITE_BEHIND",
|
||||
"GIMP_COMPOSITE_MULTIPLY",
|
||||
"GIMP_COMPOSITE_SCREEN",
|
||||
"GIMP_COMPOSITE_OVERLAY",
|
||||
"GIMP_COMPOSITE_DIFFERENCE",
|
||||
"GIMP_COMPOSITE_ADDITION",
|
||||
"GIMP_COMPOSITE_SUBTRACT",
|
||||
"GIMP_COMPOSITE_DARKEN",
|
||||
"GIMP_COMPOSITE_LIGHTEN",
|
||||
"GIMP_COMPOSITE_HUE",
|
||||
"GIMP_COMPOSITE_SATURATION",
|
||||
"GIMP_COMPOSITE_COLOR_ONLY",
|
||||
"GIMP_COMPOSITE_VALUE",
|
||||
"GIMP_COMPOSITE_DIVIDE",
|
||||
"GIMP_COMPOSITE_DODGE",
|
||||
"GIMP_COMPOSITE_BURN",
|
||||
"GIMP_COMPOSITE_HARDLIGHT",
|
||||
"GIMP_COMPOSITE_SOFTLIGHT",
|
||||
"GIMP_COMPOSITE_GRAIN_EXTRACT",
|
||||
"GIMP_COMPOSITE_GRAIN_MERGE",
|
||||
"GIMP_COMPOSITE_COLOR_ERASE",
|
||||
"GIMP_COMPOSITE_ERASE" ,
|
||||
"GIMP_COMPOSITE_REPLACE" ,
|
||||
"GIMP_COMPOSITE_ANTI_ERASE",
|
||||
"GIMP_COMPOSITE_BLEND",
|
||||
"GIMP_COMPOSITE_SHADE",
|
||||
"GIMP_COMPOSITE_SWAP",
|
||||
"GIMP_COMPOSITE_SCALE",
|
||||
"GIMP_COMPOSITE_CONVERT",
|
||||
"GIMP_COMPOSITE_XOR",
|
||||
]
|
||||
|
||||
pixel_format=[
|
||||
"GIMP_PIXELFORMAT_V8",
|
||||
"GIMP_PIXELFORMAT_VA8",
|
||||
"GIMP_PIXELFORMAT_RGB8",
|
||||
"GIMP_PIXELFORMAT_RGBA8",
|
||||
# "GIMP_PIXELFORMAT_V16",
|
||||
# "GIMP_PIXELFORMAT_VA16",
|
||||
# "GIMP_PIXELFORMAT_RGB16",
|
||||
# "GIMP_PIXELFORMAT_RGBA16"
|
||||
# "GIMP_PIXELFORMAT_V32",
|
||||
# "GIMP_PIXELFORMAT_VA32",
|
||||
# "GIMP_PIXELFORMAT_RGB32",
|
||||
# "GIMP_PIXELFORMAT_RGBA32"
|
||||
"GIMP_PIXELFORMAT_ANY",
|
||||
]
|
||||
|
||||
|
||||
def mode_name(mode):
|
||||
s = string.replace(mode.lower(), "gimp_composite_", "")
|
||||
return (s)
|
||||
|
||||
def pixel_depth_name(pixel_format):
|
||||
s = string.replace(pixel_format.lower(), "gimp_pixelformat_", "")
|
||||
return (s)
|
||||
|
||||
|
||||
pp = pprint.PrettyPrinter(indent=4)
|
||||
|
||||
|
||||
def functionnameify(filename):
|
||||
f = os.path.basename(filename)
|
||||
f = string.replace(f, ".o", "")
|
||||
f = string.replace(f, ".c", "")
|
||||
f = string.replace(f, ".h", "")
|
||||
f = string.replace(f, "-", "_")
|
||||
return (f)
|
||||
|
||||
def print_function_table(fpout, filename, function_table):
|
||||
|
||||
function_table_declarations = dict()
|
||||
|
||||
function_table_keys = function_table.keys()
|
||||
function_table_keys.sort()
|
||||
|
||||
for key in function_table_keys:
|
||||
if not function_table_declarations.has_key(function_table[key][0]):
|
||||
print >>fpout, 'void %s(GimpCompositeContext *);' % (function_table[key][0])
|
||||
function_table_declarations[function_table[key][0]] = function_table[key][0]
|
||||
pass
|
||||
pass
|
||||
|
||||
print >>fpout, ''
|
||||
print >>fpout, 'void (*%s[%s][%s][%s][%s])(GimpCompositeContext *) = {' % (functionnameify(filename),
|
||||
"GIMP_COMPOSITE_N",
|
||||
"GIMP_PIXELFORMAT_N",
|
||||
"GIMP_PIXELFORMAT_N",
|
||||
"GIMP_PIXELFORMAT_N")
|
||||
for mode in composite_modes:
|
||||
print >>fpout, ' { /* %s */' % (mode)
|
||||
for A in filter(lambda pf: pf != "GIMP_PIXELFORMAT_ANY", pixel_format):
|
||||
print >>fpout, ' { /* A = %s */' % (pixel_depth_name(A))
|
||||
for B in filter(lambda pf: pf != "GIMP_PIXELFORMAT_ANY", pixel_format):
|
||||
print >>fpout, ' /* %-6s */ {' % (pixel_depth_name(B)),
|
||||
for D in filter(lambda pf: pf != "GIMP_PIXELFORMAT_ANY", pixel_format):
|
||||
key = "%s_%s_%s_%s" % (string.lower(mode), pixel_depth_name(A), pixel_depth_name(B), pixel_depth_name(D))
|
||||
if function_table.has_key(key):
|
||||
print >>fpout, '%s, ' % (function_table[key][0]),
|
||||
else:
|
||||
print >>fpout, '%s, ' % ("NULL"),
|
||||
pass
|
||||
pass
|
||||
print >>fpout, '},'
|
||||
pass
|
||||
print >>fpout, ' },'
|
||||
pass
|
||||
print >>fpout, ' },'
|
||||
pass
|
||||
|
||||
print >>fpout, '};\n'
|
||||
|
||||
return
|
||||
|
||||
def print_function_table_name(fpout, filename, function_table):
|
||||
|
||||
print >>fpout, ''
|
||||
print >>fpout, 'char *%s_name[%s][%s][%s][%s] = {' % (functionnameify(filename),
|
||||
"GIMP_COMPOSITE_N",
|
||||
"GIMP_PIXELFORMAT_N",
|
||||
"GIMP_PIXELFORMAT_N",
|
||||
"GIMP_PIXELFORMAT_N")
|
||||
for mode in composite_modes:
|
||||
print >>fpout, ' { /* %s */' % (mode)
|
||||
for A in filter(lambda pf: pf != "GIMP_PIXELFORMAT_ANY", pixel_format):
|
||||
print >>fpout, ' { /* A = %s */' % (pixel_depth_name(A))
|
||||
for B in filter(lambda pf: pf != "GIMP_PIXELFORMAT_ANY", pixel_format):
|
||||
print >>fpout, ' /* %-6s */ {' % (pixel_depth_name(B)),
|
||||
for D in filter(lambda pf: pf != "GIMP_PIXELFORMAT_ANY", pixel_format):
|
||||
key = "%s_%s_%s_%s" % (string.lower(mode), pixel_depth_name(A), pixel_depth_name(B), pixel_depth_name(D))
|
||||
if function_table.has_key(key):
|
||||
print >>fpout, '"%s", ' % (function_table[key][0]),
|
||||
else:
|
||||
print >>fpout, '"%s", ' % (""),
|
||||
pass
|
||||
pass
|
||||
print >>fpout, '},'
|
||||
pass
|
||||
print >>fpout, ' },'
|
||||
pass
|
||||
print >>fpout, ' },'
|
||||
pass
|
||||
|
||||
print >>fpout, '};\n'
|
||||
|
||||
return
|
||||
|
||||
def load_function_table(filename):
|
||||
nmx = ns.nmx(filename)
|
||||
|
||||
gimp_composite_function = dict()
|
||||
|
||||
for mode in composite_modes:
|
||||
for A in filter(lambda pf: pf != "GIMP_PIXELFORMAT_ANY", pixel_format):
|
||||
for B in filter(lambda pf: pf != "GIMP_PIXELFORMAT_ANY", pixel_format):
|
||||
for D in filter(lambda pf: pf != "GIMP_PIXELFORMAT_ANY", pixel_format):
|
||||
key = "%s_%s_%s_%s" % (string.lower(mode), pixel_depth_name(A), pixel_depth_name(B), pixel_depth_name(D))
|
||||
|
||||
for a in ["GIMP_PIXELFORMAT_ANY", A]:
|
||||
for b in ["GIMP_PIXELFORMAT_ANY", B]:
|
||||
for d in ["GIMP_PIXELFORMAT_ANY", D]:
|
||||
key = "%s_%s_%s_%s" % (string.lower(mode), pixel_depth_name(a), pixel_depth_name(b), pixel_depth_name(d))
|
||||
|
||||
f = nmx.exports_re(key + ".*")
|
||||
if f != None: gimp_composite_function["%s_%s_%s_%s" % (string.lower(mode), pixel_depth_name(A), pixel_depth_name(B), pixel_depth_name(D))] = [f]
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
|
||||
return (gimp_composite_function)
|
||||
|
||||
|
||||
def merge_function_tables(tables):
|
||||
main_table = copy.deepcopy(tables[0][1])
|
||||
|
||||
for t in tables[1:]:
|
||||
print >>sys.stderr, t[0]
|
||||
for mode in composite_modes:
|
||||
for A in filter(lambda pf: pf != "GIMP_PIXELFORMAT_ANY", pixel_format):
|
||||
for B in filter(lambda pf: pf != "GIMP_PIXELFORMAT_ANY", pixel_format):
|
||||
for D in filter(lambda pf: pf != "GIMP_PIXELFORMAT_ANY", pixel_format):
|
||||
key = "%s_%s_%s_%s" % (string.lower(mode), pixel_depth_name(A), pixel_depth_name(B), pixel_depth_name(D))
|
||||
if t[1].has_key(key):
|
||||
#print >>sys.stderr, "%s = %s::%s" % (key, t[0], t[1][key])
|
||||
main_table[key] = t[1][key]
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
|
||||
return (main_table)
|
||||
|
||||
|
||||
def print_test_code(tables):
|
||||
return
|
||||
|
||||
def gimp_composite_regression(fpout, function_tables):
|
||||
|
||||
# XXX move all this out to C code, instead of here.
|
||||
print >>fpout, '#include "config.h"'
|
||||
print >>fpout, ''
|
||||
print >>fpout, '#include <stdio.h>'
|
||||
print >>fpout, '#include <stdlib.h>'
|
||||
print >>fpout, '#include <string.h>'
|
||||
print >>fpout, ''
|
||||
print >>fpout, '#include <sys/time.h>'
|
||||
print >>fpout, ''
|
||||
print >>fpout, '#include <glib-object.h>'
|
||||
print >>fpout, ''
|
||||
print >>fpout, '#include "base/base-types.h"'
|
||||
print >>fpout, ''
|
||||
print >>fpout, '#include "gimp-composite.h"'
|
||||
print >>fpout, '#include "gimp-composite-dispatch.h"'
|
||||
print >>fpout, '#include "gimp-composite-regression.h"'
|
||||
print >>fpout, '#include "gimp-composite-util.h"'
|
||||
print >>fpout, '#include "gimp-composite-generic.h"'
|
||||
print >>fpout, ''
|
||||
print >>fpout, 'int'
|
||||
print >>fpout, 'gimp_composite_regression(int iterations, int n_pixels)'
|
||||
print >>fpout, '{'
|
||||
print >>fpout, ' GimpCompositeContext generic_ctx;'
|
||||
print >>fpout, ' GimpCompositeContext special_ctx;'
|
||||
print >>fpout, ' double ft0;'
|
||||
print >>fpout, ' double ft1;'
|
||||
print >>fpout, ' gimp_rgba8_t *rgba8D1;'
|
||||
print >>fpout, ' gimp_rgba8_t *rgba8D2;'
|
||||
print >>fpout, ' gimp_rgba8_t *rgba8A;'
|
||||
print >>fpout, ' gimp_rgba8_t *rgba8B;'
|
||||
print >>fpout, ' gimp_rgba8_t *rgba8M;'
|
||||
print >>fpout, ' gimp_va8_t *va8A;'
|
||||
print >>fpout, ' gimp_va8_t *va8B;'
|
||||
print >>fpout, ' gimp_va8_t *va8M;'
|
||||
print >>fpout, ' gimp_va8_t *va8D1;'
|
||||
print >>fpout, ' gimp_va8_t *va8D2;'
|
||||
print >>fpout, ' int i;'
|
||||
print >>fpout, ''
|
||||
print >>fpout, ' rgba8A = (gimp_rgba8_t *) calloc(sizeof(gimp_rgba8_t), n_pixels+1);'
|
||||
print >>fpout, ' rgba8B = (gimp_rgba8_t *) calloc(sizeof(gimp_rgba8_t), n_pixels+1);'
|
||||
print >>fpout, ' rgba8M = (gimp_rgba8_t *) calloc(sizeof(gimp_rgba8_t), n_pixels+1);'
|
||||
print >>fpout, ' rgba8D1 = (gimp_rgba8_t *) calloc(sizeof(gimp_rgba8_t), n_pixels+1);'
|
||||
print >>fpout, ' rgba8D2 = (gimp_rgba8_t *) calloc(sizeof(gimp_rgba8_t), n_pixels+1);'
|
||||
print >>fpout, ' va8A = (gimp_va8_t *) calloc(sizeof(gimp_va8_t), n_pixels+1);'
|
||||
print >>fpout, ' va8B = (gimp_va8_t *) calloc(sizeof(gimp_va8_t), n_pixels+1);'
|
||||
print >>fpout, ' va8M = (gimp_va8_t *) calloc(sizeof(gimp_va8_t), n_pixels+1);'
|
||||
print >>fpout, ' va8D1 = (gimp_va8_t *) calloc(sizeof(gimp_va8_t), n_pixels+1);'
|
||||
print >>fpout, ' va8D2 = (gimp_va8_t *) calloc(sizeof(gimp_va8_t), n_pixels+1);'
|
||||
print >>fpout, ''
|
||||
print >>fpout, ' for (i = 0; i < n_pixels; i++) {'
|
||||
print >>fpout, ' rgba8A[i].r = 255-i;'
|
||||
print >>fpout, ' rgba8A[i].g = 255-i;'
|
||||
print >>fpout, ' rgba8A[i].b = 255-i;'
|
||||
print >>fpout, ' rgba8A[i].a = 255-i;'
|
||||
print >>fpout, ''
|
||||
print >>fpout, ' rgba8B[i].r = i;'
|
||||
print >>fpout, ' rgba8B[i].g = i;'
|
||||
print >>fpout, ' rgba8B[i].b = i;'
|
||||
print >>fpout, ' rgba8B[i].a = i;'
|
||||
print >>fpout, ''
|
||||
print >>fpout, ' rgba8M[i].r = i;'
|
||||
print >>fpout, ' rgba8M[i].g = i;'
|
||||
print >>fpout, ' rgba8M[i].b = i;'
|
||||
print >>fpout, ' rgba8M[i].a = i;'
|
||||
print >>fpout, ''
|
||||
print >>fpout, ' va8A[i].v = i;'
|
||||
print >>fpout, ' va8A[i].a = 255-i;'
|
||||
print >>fpout, ' va8B[i].v = i;'
|
||||
print >>fpout, ' va8B[i].a = i;'
|
||||
print >>fpout, ' va8M[i].v = i;'
|
||||
print >>fpout, ' va8M[i].a = i;'
|
||||
print >>fpout, ' }'
|
||||
print >>fpout, ''
|
||||
|
||||
generic_table = function_tables[0][1]
|
||||
|
||||
pp.pprint(function_tables[1:])
|
||||
|
||||
for mode in composite_modes:
|
||||
for A in filter(lambda pf: pf != "GIMP_PIXELFORMAT_ANY", pixel_format):
|
||||
for B in filter(lambda pf: pf != "GIMP_PIXELFORMAT_ANY", pixel_format):
|
||||
for D in filter(lambda pf: pf != "GIMP_PIXELFORMAT_ANY", pixel_format):
|
||||
key = "%s_%s_%s_%s" % (string.lower(mode), pixel_depth_name(A), pixel_depth_name(B), pixel_depth_name(D))
|
||||
for f in function_tables[1:]:
|
||||
if f[1].has_key(key):
|
||||
print f[0], key
|
||||
print >>fpout, ''
|
||||
print >>fpout, ' /* %s */' % (key)
|
||||
print >>fpout, ' memset((void *) &special_ctx, 0, sizeof(special_ctx));'
|
||||
print >>fpout, ' memset((void *) &generic_ctx, 0, sizeof(special_ctx));'
|
||||
print >>fpout, ' special_ctx.op = generic_ctx.op = %s;' % (mode)
|
||||
print >>fpout, ' special_ctx.n_pixels = generic_ctx.n_pixels = n_pixels;'
|
||||
print >>fpout, ' special_ctx.scale.scale = generic_ctx.scale.scale = 2;'
|
||||
print >>fpout, ' special_ctx.pixelformat_A = generic_ctx.pixelformat_A = %s;' % (A)
|
||||
print >>fpout, ' special_ctx.pixelformat_B = generic_ctx.pixelformat_B = %s;' % (B)
|
||||
print >>fpout, ' special_ctx.pixelformat_D = generic_ctx.pixelformat_D = %s;' % (D)
|
||||
print >>fpout, ' special_ctx.pixelformat_M = generic_ctx.pixelformat_M = %s;' % (D)
|
||||
print >>fpout, ' special_ctx.A = (unsigned char *) %sA;' % (pixel_depth_name(A))
|
||||
print >>fpout, ' special_ctx.B = (unsigned char *) %sB;' % (pixel_depth_name(B))
|
||||
print >>fpout, ' special_ctx.M = (unsigned char *) %sB;' % (pixel_depth_name(D))
|
||||
print >>fpout, ' special_ctx.D = (unsigned char *) %sD1;' % (pixel_depth_name(D))
|
||||
print >>fpout, ' generic_ctx.A = (unsigned char *) %sA;' % (pixel_depth_name(A))
|
||||
print >>fpout, ' generic_ctx.B = (unsigned char *) %sB;' % (pixel_depth_name(B))
|
||||
print >>fpout, ' generic_ctx.M = (unsigned char *) %sB;' % (pixel_depth_name(D))
|
||||
print >>fpout, ' generic_ctx.D = (unsigned char *) %sD2;' % (pixel_depth_name(D))
|
||||
print >>fpout, ' ft0 = gimp_composite_regression_time_function(iterations, %s, &special_ctx);' % ("gimp_composite_dispatch")
|
||||
print >>fpout, ' ft1 = gimp_composite_regression_time_function(iterations, %s, &generic_ctx);' % (generic_table[key][0])
|
||||
print >>fpout, ' gimp_composite_regression_compare_contexts("%s", &generic_ctx, &special_ctx);' % (mode_name(mode))
|
||||
print >>fpout, ' gimp_composite_regression_timer_report("%s", ft0, ft1);' % (mode_name(mode))
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
|
||||
print >>fpout, ' return (0);'
|
||||
print >>fpout, '}'
|
||||
|
||||
print >>fpout, ''
|
||||
print >>fpout, 'int'
|
||||
print >>fpout, 'main(int argc, char *argv[])'
|
||||
print >>fpout, '{'
|
||||
print >>fpout, ' int iterations;'
|
||||
print >>fpout, ' int n_pixels;'
|
||||
print >>fpout, ''
|
||||
print >>fpout, ' srand(314159);'
|
||||
print >>fpout, ''
|
||||
print >>fpout, ' iterations = 1;'
|
||||
print >>fpout, ' n_pixels = 256*256;'
|
||||
print >>fpout, ''
|
||||
print >>fpout, ' return (gimp_composite_regression(iterations, n_pixels));'
|
||||
print >>fpout, '}'
|
||||
|
||||
return
|
||||
|
||||
|
||||
def gimp_composite_init(fpout, function_tables):
|
||||
for o in function_tables:
|
||||
print >>fpout, 'extern void %s_init (void);' % (functionnameify(o[0]))
|
||||
pass
|
||||
|
||||
print >>fpout, ''
|
||||
print >>fpout, 'void'
|
||||
print >>fpout, 'gimp_composite_init (void)'
|
||||
print >>fpout, '{'
|
||||
print >>fpout, ' const gchar *p;'
|
||||
print >>fpout, ''
|
||||
print >>fpout, ' if ((p = g_getenv ("GIMP_COMPOSITE")))'
|
||||
print >>fpout, ' {'
|
||||
print >>fpout, ' gimp_composite_options.bits = strtoul(p, NULL, 16);'
|
||||
print >>fpout, ' g_printerr ("gimp_composite_options: %08lx\\n", gimp_composite_options.bits);'
|
||||
print >>fpout, ' if (gimp_composite_options.bits & GIMP_COMPOSITE_OPTION_USE) {'
|
||||
print >>fpout, ' g_printerr ("using new gimp_composite functions\\n");'
|
||||
print >>fpout, ' }'
|
||||
print >>fpout, ' }'
|
||||
print >>fpout, ''
|
||||
|
||||
print >>fpout, ' if (! (gimp_composite_options.bits & GIMP_COMPOSITE_OPTION_INITIALISED))'
|
||||
print >>fpout, ' {'
|
||||
|
||||
for o in function_tables:
|
||||
print >>fpout, ' %s_init ();' % (functionnameify(o[0]))
|
||||
pass
|
||||
|
||||
print >>fpout, ' gimp_composite_options.bits |= GIMP_COMPOSITE_OPTION_INITIALISED;'
|
||||
print >>fpout, ' }'
|
||||
print >>fpout, '}'
|
||||
pass
|
||||
|
||||
def gimp_composite_hfile(fpout):
|
||||
print >>fpout, '/* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT */'
|
||||
print >>fpout, ''
|
||||
print >>fpout, 'typedef void (*GimpCompositeFunctionTable[%s][%s][%s][%s]);' % ("GIMP_COMPOSITE_N",
|
||||
"GIMP_PIXELFORMAT_N",
|
||||
"GIMP_PIXELFORMAT_N",
|
||||
"GIMP_PIXELFORMAT_N")
|
||||
return
|
||||
|
||||
def gimp_composite_cfile(fpout, function_tables):
|
||||
print >>fpout, '/* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT */'
|
||||
print >>fpout, '#include "config.h"'
|
||||
print >>fpout, '#include <glib-object.h>'
|
||||
print >>fpout, '#include <stdlib.h>'
|
||||
print >>fpout, '#include "base/base-types.h"'
|
||||
print >>fpout, '#include "gimp-composite.h"'
|
||||
print >>fpout, '#include "gimp-composite-dispatch.h"'
|
||||
#print >>fpout, 'extern void %s(GimpCompositeContext *);' % ("gimp_composite_unsupported")
|
||||
print >>fpout, ''
|
||||
|
||||
for f in function_tables:
|
||||
print_function_table(fpout, f[0], f[1])
|
||||
pass
|
||||
|
||||
main_table = merge_function_tables(d)
|
||||
|
||||
print_function_table(fpout, "gimp_composite_function", main_table)
|
||||
print_function_table_name(fpout, "gimp_composite_function", main_table)
|
||||
|
||||
gimp_composite_init(fpout, function_tables)
|
||||
|
||||
return
|
||||
|
||||
###########################################
|
||||
d = list()
|
||||
for f in sys.argv[1:]:
|
||||
d.append((f, load_function_table(f)))
|
||||
pass
|
||||
|
||||
gimp_composite_hfile(open("gimp-composite-dispatch.h", "w"))
|
||||
gimp_composite_cfile(open("gimp-composite-dispatch.c", "w"), d)
|
||||
gimp_composite_regression(open("gimp-composite-test.c", "w"), d)
|
||||
|
||||
sys.exit(0)
|
||||
@ -263,7 +263,7 @@ def gimp_composite_regression(fpout, function_tables, options):
|
||||
print >>fpout, '#include "base/base-types.h"'
|
||||
print >>fpout, ''
|
||||
print >>fpout, '#include "gimp-composite.h"'
|
||||
print >>fpout, '#include "gimp-composite-dispatch.h"'
|
||||
|
||||
print >>fpout, '#include "gimp-composite-regression.h"'
|
||||
print >>fpout, '#include "gimp-composite-util.h"'
|
||||
print >>fpout, '#include "gimp-composite-generic.h"'
|
||||
@ -272,6 +272,11 @@ def gimp_composite_regression(fpout, function_tables, options):
|
||||
print >>fpout, 'int'
|
||||
print >>fpout, '%s_test(int iterations, int n_pixels)' % (functionnameify(options.file))
|
||||
print >>fpout, '{'
|
||||
|
||||
for r in options.requires:
|
||||
print >>fpout, '#if %s' % (r)
|
||||
pass
|
||||
|
||||
print >>fpout, ' GimpCompositeContext generic_ctx;'
|
||||
print >>fpout, ' GimpCompositeContext special_ctx;'
|
||||
print >>fpout, ' double ft0;'
|
||||
@ -355,7 +360,9 @@ def gimp_composite_regression(fpout, function_tables, options):
|
||||
|
||||
print >>fpout, ' ft0 = gimp_composite_regression_time_function(iterations, %s, &generic_ctx);' % ("gimp_composite_dispatch")
|
||||
print >>fpout, ' ft1 = gimp_composite_regression_time_function(iterations, %s, &special_ctx);' % (generic_table[key][0])
|
||||
print >>fpout, ' gimp_composite_regression_compare_contexts("%s", &generic_ctx, &special_ctx);' % (mode_name(mode))
|
||||
print >>fpout, ' if (gimp_composite_regression_compare_contexts("%s", &generic_ctx, &special_ctx)) {' % (mode_name(mode))
|
||||
print >>fpout, ' return (1);'
|
||||
print >>fpout, ' }'
|
||||
print >>fpout, ' gimp_composite_regression_timer_report("%s", ft0, ft1);' % (mode_name(mode))
|
||||
pass
|
||||
pass
|
||||
@ -363,6 +370,10 @@ def gimp_composite_regression(fpout, function_tables, options):
|
||||
pass
|
||||
pass
|
||||
|
||||
for r in options.requires:
|
||||
print >>fpout, '#endif'
|
||||
pass
|
||||
|
||||
print >>fpout, ' return (0);'
|
||||
print >>fpout, '}'
|
||||
|
||||
@ -380,6 +391,19 @@ def gimp_composite_regression(fpout, function_tables, options):
|
||||
print >>fpout, ' iterations = %d;' % options.iterations
|
||||
print >>fpout, ' n_pixels = %d;' % options.n_pixels
|
||||
print >>fpout, ''
|
||||
print >>fpout, ' argv++, argc--;'
|
||||
print >>fpout, ' while (argc >= 2) {'
|
||||
print >>fpout, ' if ((strcmp(argv[0], "--iterations") == 0 || strcmp(argv[0], "-i") == 0) && argc > 1) {'
|
||||
print >>fpout, ' iterations = atoi(argv[1]);'
|
||||
print >>fpout, ' argc -= 2, argv++; argv++;'
|
||||
print >>fpout, ' } else if ((strcmp(argv[0], "--n-pixels") == 0 || strcmp(argv[0], "-n") == 0) && argc > 1) {'
|
||||
print >>fpout, ' n_pixels = atoi(argv[1]);'
|
||||
print >>fpout, ' argc -= 2, argv++; argv++;'
|
||||
print >>fpout, ' } else {'
|
||||
print >>fpout, ' argc--, argv++;'
|
||||
print >>fpout, ' }'
|
||||
print >>fpout, ' }'
|
||||
print >>fpout, ''
|
||||
print >>fpout, ' gimp_composite_generic_install();'
|
||||
print >>fpout, ''
|
||||
print >>fpout, ' return (%s_test(iterations, n_pixels));' % (functionnameify(options.file))
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
#include "base/base-types.h"
|
||||
|
||||
#include "gimp-composite.h"
|
||||
#include "gimp-composite-dispatch.h"
|
||||
#include "gimp-composite-regression.h"
|
||||
#include "gimp-composite-util.h"
|
||||
#include "gimp-composite-generic.h"
|
||||
|
||||
Reference in New Issue
Block a user