Commit 7752bf9e authored by Helvetix Victorinox's avatar Helvetix Victorinox

migrated to new (trimmer) code and removed dead code. Some beautification


* app/composite/make-install.py: migrated to new (trimmer) code and
  removed dead code.  Some beautification for generated code.

* app/composite/gimp-composite-{mmx,sse,sse2,3dnow,altivec,vis,generic}.{c,h}:
  All init() functions are also a run-time check and now expected to
  return TRUE/FALSE if the particular set of compositing functions can
  be used.

* app/composite/gimp-composite.c: No longer has to determine if
  the particular set of compositing functions can be used.

* app/composite/gimp-composite-{mmx,sse,sse2,3dnow,altivec,vis}-{install,test}.c:
  Regenerated

* app/composite/test-composite.c: Deprecated, removed.  All tests are automatically
  generated and the code is in app/composite/gimp-composite-{mmx,sse,sse2,3dnow,altivec,vis}-test.c:

* app/composite/Makefile.am: removed unused references to test-composite.c
parent 9d233217
......@@ -79,19 +79,6 @@ TESTS = \
gimp-composite-sse2-test \
gimp-composite-vis-test
test_composite_SOURCES = \
gimp-composite-regression.c \
gimp-composite-regression.h \
test-composite.c
test_composite_DEPENDENCIES = $(gimpcomposite_dependencies)
test_composite_LDADD = \
libappcomposite.a \
$(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la \
$(top_builddir)/app/base/libappbase.a \
$(GLIB_LIBS)
gimp_composite_test_SOURCES = \
gimp-composite-regression.c \
gimp-composite-regression.h \
......
......@@ -10,10 +10,10 @@
#include "gimp-composite-3dnow.h"
void
gboolean
gimp_composite_3dnow_install (void)
{
/* nothing to do */
gimp_composite_3dnow_init ();
return (FALSE);
}
......@@ -20,11 +20,6 @@ int
gimp_composite_3dnow_test (int iterations, int n_pixels)
{
#if (__GNUC__ >= 3) && defined(USE_3DNOW) && defined(ARCH_X86)
printf("\nRunning gimp_composite_3dnow tests...\n");
if (gimp_composite_3dnow_init () == 0) {
printf("gimp_composite_3dnow: Instruction set is not available.\n");
return (0);
}
GimpCompositeContext generic_ctx;
GimpCompositeContext special_ctx;
double ft0;
......@@ -41,6 +36,13 @@ gimp_composite_3dnow_test (int iterations, int n_pixels)
gimp_va8_t *va8D2;
int i;
printf("\nRunning gimp_composite_3dnow tests...\n");
if (gimp_composite_3dnow_init () == 0)
{
printf("gimp_composite_3dnow: Instruction set is not available.\n");
return (0);
}
rgba8A = gimp_composite_regression_fixed_rgba8(n_pixels+1);
rgba8B = gimp_composite_regression_fixed_rgba8(n_pixels+1);
rgba8M = gimp_composite_regression_fixed_rgba8(n_pixels+1);
......@@ -52,14 +54,15 @@ gimp_composite_3dnow_test (int iterations, int n_pixels)
va8D1 = (gimp_va8_t *) calloc(sizeof(gimp_va8_t), n_pixels+1);
va8D2 = (gimp_va8_t *) calloc(sizeof(gimp_va8_t), n_pixels+1);
for (i = 0; i < n_pixels; i++) {
va8A[i].v = i;
va8A[i].a = 255-i;
va8B[i].v = i;
va8B[i].a = i;
va8M[i].v = i;
va8M[i].a = i;
}
for (i = 0; i < n_pixels; i++)
{
va8A[i].v = i;
va8A[i].a = 255-i;
va8B[i].v = i;
va8B[i].a = i;
va8M[i].v = i;
va8M[i].a = i;
}
#endif
return (0);
......@@ -79,18 +82,24 @@ main (int argc, char *argv[])
n_pixels = 1048593;
argv++, argc--;
while (argc >= 2) {
if (argc > 1 && (strcmp (argv[0], "--iterations") == 0 || strcmp (argv[0], "-i") == 0)) {
iterations = atoi(argv[1]);
argc -= 2, argv++; argv++;
} else if (argc > 1 && (strcmp (argv[0], "--n-pixels") == 0 || strcmp (argv[0], "-n") == 0)) {
n_pixels = atoi (argv[1]);
argc -= 2, argv++; argv++;
} else {
printf("Usage: gimp-composites-*-test [-i|--iterations n] [-n|--n-pixels n]");
argc--, argv++;
while (argc >= 2)
{
if (argc > 1 && (strcmp (argv[0], "--iterations") == 0 || strcmp (argv[0], "-i") == 0))
{
iterations = atoi(argv[1]);
argc -= 2, argv++; argv++;
}
else if (argc > 1 && (strcmp (argv[0], "--n-pixels") == 0 || strcmp (argv[0], "-n") == 0))
{
n_pixels = atoi (argv[1]);
argc -= 2, argv++; argv++;
}
else
{
printf("Usage: gimp-composites-*-test [-i|--iterations n] [-n|--n-pixels n]");
argc--, argv++;
}
}
}
gimp_composite_generic_install ();
......
......@@ -41,16 +41,14 @@
#endif /* ARCH_X86 */
#endif /* USE_MMX */
int
gboolean
gimp_composite_3dnow_init (void)
{
#if defined(USE_MMX) && defined(ARCH_X86)
guint32 cpu = cpu_accel ();
if (cpu & CPU_ACCEL_X86_3DNOW)
if (cpu_accel () & CPU_ACCEL_X86_3DNOW)
{
return (1);
return (FALSE);
}
#endif
return (0);
return (TRUE);
}
#ifndef gimp_composite_3dnow_h
#define gimp_composite_3dnow_h
extern int gimp_composite_3dnow_init (void);
extern gboolean 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);
extern gboolean gimp_composite_3dnow_install (void);
#endif
......@@ -10,10 +10,10 @@
#include "gimp-composite-altivec.h"
void
gboolean
gimp_composite_altivec_install (void)
{
/* nothing to do */
gimp_composite_altivec_init ();
return (FALSE);
}
......@@ -20,11 +20,6 @@ int
gimp_composite_altivec_test (int iterations, int n_pixels)
{
#if (__GNUC__ >= 3) && defined(USE_ALTIVEC) && defined(ARCH_PPC)
printf("\nRunning gimp_composite_altivec tests...\n");
if (gimp_composite_altivec_init () == 0) {
printf("gimp_composite_altivec: Instruction set is not available.\n");
return (0);
}
GimpCompositeContext generic_ctx;
GimpCompositeContext special_ctx;
double ft0;
......@@ -41,6 +36,13 @@ gimp_composite_altivec_test (int iterations, int n_pixels)
gimp_va8_t *va8D2;
int i;
printf("\nRunning gimp_composite_altivec tests...\n");
if (gimp_composite_altivec_init () == 0)
{
printf("gimp_composite_altivec: Instruction set is not available.\n");
return (0);
}
rgba8A = gimp_composite_regression_fixed_rgba8(n_pixels+1);
rgba8B = gimp_composite_regression_fixed_rgba8(n_pixels+1);
rgba8M = gimp_composite_regression_fixed_rgba8(n_pixels+1);
......@@ -52,14 +54,15 @@ gimp_composite_altivec_test (int iterations, int n_pixels)
va8D1 = (gimp_va8_t *) calloc(sizeof(gimp_va8_t), n_pixels+1);
va8D2 = (gimp_va8_t *) calloc(sizeof(gimp_va8_t), n_pixels+1);
for (i = 0; i < n_pixels; i++) {
va8A[i].v = i;
va8A[i].a = 255-i;
va8B[i].v = i;
va8B[i].a = i;
va8M[i].v = i;
va8M[i].a = i;
}
for (i = 0; i < n_pixels; i++)
{
va8A[i].v = i;
va8A[i].a = 255-i;
va8B[i].v = i;
va8B[i].a = i;
va8M[i].v = i;
va8M[i].a = i;
}
#endif
return (0);
......@@ -79,18 +82,24 @@ main (int argc, char *argv[])
n_pixels = 1048593;
argv++, argc--;
while (argc >= 2) {
if (argc > 1 && (strcmp (argv[0], "--iterations") == 0 || strcmp (argv[0], "-i") == 0)) {
iterations = atoi(argv[1]);
argc -= 2, argv++; argv++;
} else if (argc > 1 && (strcmp (argv[0], "--n-pixels") == 0 || strcmp (argv[0], "-n") == 0)) {
n_pixels = atoi (argv[1]);
argc -= 2, argv++; argv++;
} else {
printf("Usage: gimp-composites-*-test [-i|--iterations n] [-n|--n-pixels n]");
argc--, argv++;
while (argc >= 2)
{
if (argc > 1 && (strcmp (argv[0], "--iterations") == 0 || strcmp (argv[0], "-i") == 0))
{
iterations = atoi(argv[1]);
argc -= 2, argv++; argv++;
}
else if (argc > 1 && (strcmp (argv[0], "--n-pixels") == 0 || strcmp (argv[0], "-n") == 0))
{
n_pixels = atoi (argv[1]);
argc -= 2, argv++; argv++;
}
else
{
printf("Usage: gimp-composites-*-test [-i|--iterations n] [-n|--n-pixels n]");
argc--, argv++;
}
}
}
gimp_composite_generic_install ();
......
......@@ -36,17 +36,15 @@
#endif /* __GNUC__ > 3 */
#endif /* ARCH_PPC */
int
gboolean
gimp_composite_altivec_init (void)
{
#ifdef ARCH_PPC
guint32 cpu = cpu_accel ();
if (cpu & CPU_ACCEL_PPC_ALTIVEC)
if (cpu_accel () & CPU_ACCEL_PPC_ALTIVEC)
{
return (1);
return (TRUE);
}
#endif
return (0);
return (FALSE);
}
#ifndef gimp_composite_altivec_h
#define gimp_composite_altivec_h
extern int gimp_composite_altivec_init (void);
extern gboolean gimp_composite_altivec_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_altivec_install (void);
extern gboolean gimp_composite_altivec_install (void);
#endif
......@@ -1939,14 +1939,19 @@ static struct install_table {
{ 0, 0, 0, 0, NULL }
};
void
gboolean
gimp_composite_generic_install (void)
{
static struct install_table *t = _gimp_composite_generic;
for (t = &_gimp_composite_generic[0]; t->function != NULL; t++) {
gimp_composite_function[t->mode][t->A][t->B][t->D] = t->function;
}
if (gimp_composite_generic_init ())
{
for (t = &_gimp_composite_generic[0]; t->function != NULL; t++)
{
gimp_composite_function[t->mode][t->A][t->B][t->D] = t->function;
}
return (TRUE);
}
gimp_composite_generic_init ();
return (FALSE);
}
......@@ -1142,7 +1142,7 @@ gimp_composite_scale_any_any_any_generic (GimpCompositeContext * ctx)
}
}
void
gboolean
gimp_composite_generic_init (void)
{
GRand *gr;
......@@ -1163,4 +1163,6 @@ gimp_composite_generic_init (void)
for (i = 256; i <= 510; i++)
add_lut[i] = 255;
return (TRUE);
}
#ifndef gimp_composite_generic_h
#define gimp_composite_generic_h
void gimp_composite_generic_init (void);
extern gboolean gimp_composite_generic_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).
*/
void gimp_composite_generic_install (void);
extern gboolean gimp_composite_generic_install (void);
void gimp_composite_addition_any_any_any_generic (GimpCompositeContext *);
void gimp_composite_anti_erase_any_any_any_generic (GimpCompositeContext *);
......
......@@ -35,14 +35,19 @@ static struct install_table {
{ 0, 0, 0, 0, NULL }
};
void
gboolean
gimp_composite_mmx_install (void)
{
static struct install_table *t = _gimp_composite_mmx;
for (t = &_gimp_composite_mmx[0]; t->function != NULL; t++) {
gimp_composite_function[t->mode][t->A][t->B][t->D] = t->function;
}
if (gimp_composite_mmx_init ())
{
for (t = &_gimp_composite_mmx[0]; t->function != NULL; t++)
{
gimp_composite_function[t->mode][t->A][t->B][t->D] = t->function;
}
return (TRUE);
}
gimp_composite_mmx_init ();
return (FALSE);
}
......@@ -20,11 +20,6 @@ int
gimp_composite_mmx_test (int iterations, int n_pixels)
{
#if (__GNUC__ >= 3) && defined(USE_MMX) && defined(ARCH_X86)
printf("\nRunning gimp_composite_mmx tests...\n");
if (gimp_composite_mmx_init () == 0) {
printf("gimp_composite_mmx: Instruction set is not available.\n");
return (0);
}
GimpCompositeContext generic_ctx;
GimpCompositeContext special_ctx;
double ft0;
......@@ -41,6 +36,13 @@ gimp_composite_mmx_test (int iterations, int n_pixels)
gimp_va8_t *va8D2;
int i;
printf("\nRunning gimp_composite_mmx tests...\n");
if (gimp_composite_mmx_init () == 0)
{
printf("gimp_composite_mmx: Instruction set is not available.\n");
return (0);
}
rgba8A = gimp_composite_regression_fixed_rgba8(n_pixels+1);
rgba8B = gimp_composite_regression_fixed_rgba8(n_pixels+1);
rgba8M = gimp_composite_regression_fixed_rgba8(n_pixels+1);
......@@ -52,154 +54,169 @@ gimp_composite_mmx_test (int iterations, int n_pixels)
va8D1 = (gimp_va8_t *) calloc(sizeof(gimp_va8_t), n_pixels+1);
va8D2 = (gimp_va8_t *) calloc(sizeof(gimp_va8_t), n_pixels+1);
for (i = 0; i < n_pixels; i++) {
va8A[i].v = i;
va8A[i].a = 255-i;
va8B[i].v = i;
va8B[i].a = i;
va8M[i].v = i;
va8M[i].a = i;
}
for (i = 0; i < n_pixels; i++)
{
va8A[i].v = i;
va8A[i].a = 255-i;
va8B[i].v = i;
va8B[i].a = i;
va8M[i].v = i;
va8M[i].a = i;
}
gimp_composite_context_init (&special_ctx, GIMP_COMPOSITE_ADDITION, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D2);
gimp_composite_context_init (&generic_ctx, GIMP_COMPOSITE_ADDITION, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D1);
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);
if (gimp_composite_regression_compare_contexts ("addition", &generic_ctx, &special_ctx)) {
printf("addition failed\n");
return (1);
}
if (gimp_composite_regression_compare_contexts ("addition", &generic_ctx, &special_ctx))
{
printf("addition failed\n");
return (1);
}
gimp_composite_regression_timer_report ("addition", ft0, ft1);
gimp_composite_context_init (&special_ctx, GIMP_COMPOSITE_BURN, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D2);
gimp_composite_context_init (&generic_ctx, GIMP_COMPOSITE_BURN, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D1);
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);
if (gimp_composite_regression_compare_contexts ("burn", &generic_ctx, &special_ctx)) {
printf("burn failed\n");
return (1);
}
if (gimp_composite_regression_compare_contexts ("burn", &generic_ctx, &special_ctx))
{
printf("burn failed\n");
return (1);
}
gimp_composite_regression_timer_report ("burn", ft0, ft1);
gimp_composite_context_init (&special_ctx, GIMP_COMPOSITE_DARKEN, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D2);
gimp_composite_context_init (&generic_ctx, GIMP_COMPOSITE_DARKEN, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D1);
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);
if (gimp_composite_regression_compare_contexts ("darken", &generic_ctx, &special_ctx)) {
printf("darken failed\n");
return (1);
}
if (gimp_composite_regression_compare_contexts ("darken", &generic_ctx, &special_ctx))
{
printf("darken failed\n");
return (1);
}
gimp_composite_regression_timer_report ("darken", ft0, ft1);
gimp_composite_context_init (&special_ctx, GIMP_COMPOSITE_DIFFERENCE, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D2);
gimp_composite_context_init (&generic_ctx, GIMP_COMPOSITE_DIFFERENCE, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D1);
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);
if (gimp_composite_regression_compare_contexts ("difference", &generic_ctx, &special_ctx)) {
printf("difference failed\n");
return (1);
}
if (gimp_composite_regression_compare_contexts ("difference", &generic_ctx, &special_ctx))
{
printf("difference failed\n");
return (1);
}
gimp_composite_regression_timer_report ("difference", ft0, ft1);
gimp_composite_context_init (&special_ctx, GIMP_COMPOSITE_DIVIDE, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D2);
gimp_composite_context_init (&generic_ctx, GIMP_COMPOSITE_DIVIDE, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D1);
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);
if (gimp_composite_regression_compare_contexts ("divide", &generic_ctx, &special_ctx)) {
printf("divide failed\n");
return (1);
}
if (gimp_composite_regression_compare_contexts ("divide", &generic_ctx, &special_ctx))
{
printf("divide failed\n");
return (1);
}
gimp_composite_regression_timer_report ("divide", ft0, ft1);
gimp_composite_context_init (&special_ctx, GIMP_COMPOSITE_DODGE, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D2);
gimp_composite_context_init (&generic_ctx, GIMP_COMPOSITE_DODGE, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D1);
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);
if (gimp_composite_regression_compare_contexts ("dodge", &generic_ctx, &special_ctx)) {
printf("dodge failed\n");
return (1);
}
if (gimp_composite_regression_compare_contexts ("dodge", &generic_ctx, &special_ctx))
{
printf("dodge failed\n");
return (1);
}
gimp_composite_regression_timer_report ("dodge", ft0, ft1);
gimp_composite_context_init (&special_ctx, GIMP_COMPOSITE_GRAIN_EXTRACT, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D2);
gimp_composite_context_init (&generic_ctx, GIMP_COMPOSITE_GRAIN_EXTRACT, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D1);
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);
if (gimp_composite_regression_compare_contexts ("grain_extract", &generic_ctx, &special_ctx)) {
printf("grain_extract failed\n");
return (1);
}
if (gimp_composite_regression_compare_contexts ("grain_extract", &generic_ctx, &special_ctx))
{
printf("grain_extract failed\n");
return (1);
}
gimp_composite_regression_timer_report ("grain_extract", ft0, ft1);
gimp_composite_context_init (&special_ctx, GIMP_COMPOSITE_GRAIN_MERGE, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D2);
gimp_composite_context_init (&generic_ctx, GIMP_COMPOSITE_GRAIN_MERGE, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D1);
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);
if (gimp_composite_regression_compare_contexts ("grain_merge", &generic_ctx, &special_ctx)) {
printf("grain_merge failed\n");
return (1);
}
if (gimp_composite_regression_compare_contexts ("grain_merge", &generic_ctx, &special_ctx))
{
printf("grain_merge failed\n");
return (1);
}
gimp_composite_regression_timer_report ("grain_merge", ft0, ft1);
gimp_composite_context_init (&special_ctx, GIMP_COMPOSITE_LIGHTEN, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D2);
gimp_composite_context_init (&generic_ctx, GIMP_COMPOSITE_LIGHTEN, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D1);
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);
if (gimp_composite_regression_compare_contexts ("lighten", &generic_ctx, &special_ctx)) {
printf("lighten failed\n");
return (1);
}
if (gimp_composite_regression_compare_contexts ("lighten", &generic_ctx, &special_ctx))
{
printf("lighten failed\n");
return (1);
}
gimp_composite_regression_timer_report ("lighten", ft0, ft1);
gimp_composite_context_init (&special_ctx, GIMP_COMPOSITE_MULTIPLY, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D2);
gimp_composite_context_init (&generic_ctx, GIMP_COMPOSITE_MULTIPLY, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D1);
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);
if (gimp_composite_regression_compare_contexts ("multiply", &generic_ctx, &special_ctx)) {
printf("multiply failed\n");
return (1);
}
if (gimp_composite_regression_compare_contexts ("multiply", &generic_ctx, &special_ctx))
{
printf("multiply failed\n");
return (1);
}
gimp_composite_regression_timer_report ("multiply", ft0, ft1);
gimp_composite_context_init (&special_ctx, GIMP_COMPOSITE_SCALE, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D2);
gimp_composite_context_init (&generic_ctx, GIMP_COMPOSITE_SCALE, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D1);
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);
if (gimp_composite_regression_compare_contexts ("scale", &generic_ctx, &special_ctx)) {
printf("scale failed\n");
return (1);
}
if (gimp_composite_regression_compare_contexts ("scale", &generic_ctx, &special_ctx))
{
printf("scale failed\n");
return (1);
}
gimp_composite_regression_timer_report ("scale", ft0, ft1);
gimp_composite_context_init (&special_ctx, GIMP_COMPOSITE_SCREEN, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D2);
gimp_composite_context_init (&generic_ctx, GIMP_COMPOSITE_SCREEN, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D1);
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);
if (gimp_composite_regression_compare_contexts ("screen", &generic_ctx, &special_ctx)) {
printf("screen failed\n");
return (1);
}
if (gimp_composite_regression_compare_contexts ("screen", &generic_ctx, &special_ctx))
{
printf("screen failed\n");
return (1);
}
gimp_composite_regression_timer_report ("screen", ft0, ft1);
gimp_composite_context_init (&special_ctx, GIMP_COMPOSITE_SUBTRACT, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D2);
gimp_composite_context_init (&generic_ctx, GIMP_COMPOSITE_SUBTRACT, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D1);
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);
if (gimp_composite_regression_compare_contexts ("subtract", &generic_ctx, &special_ctx)) {
printf("subtract failed\n");
return (1);
}
if (gimp_composite_regression_compare_contexts ("subtract", &generic_ctx, &special_ctx))
{
printf("subtract failed\n");
return (1);
}
gimp_composite_regression_timer_report ("subtract", ft0, ft1);
gimp_composite_context_init (&special_ctx, GIMP_COMPOSITE_SWAP, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D2);
gimp_composite_context_init (&generic_ctx, GIMP_COMPOSITE_SWAP, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, GIMP_PIXELFORMAT_RGBA8, n_pixels, (unsigned char *) rgba8A, (unsigned char *) rgba8B, (unsigned char *) rgba8B, (unsigned char *) rgba8D1);
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);
if (gimp_composite_regression_compare_contexts ("swap", &generic_ctx, &special_ctx)) {
printf("swap failed\n");
return (1);
}
if (gimp_composite_regression_compare_contexts ("swap", &generic_ctx, &special_ctx))
{
printf("swap failed\n");
return (1);
}
gimp_composite_regression_timer_report ("swap", ft0, ft1);
#endif
return (0);
......@@ -219,18 +236,24 @@ main (int argc, char *argv[])
n_pixels = 1048593;
argv++, argc--;
while (argc >= 2) {
if (argc > 1 && (strcmp (argv[0], "--iterations") == 0 || strcmp (argv[0], "-i") == 0)) {
iterations = atoi(argv[1]);
argc -= 2, argv++; argv++;
} else if (argc > 1 && (strcmp (argv[0], "--n-pixels") == 0 || strcmp (argv[0], "-n") == 0)) {
n_pixels = atoi (argv[1]);
argc -= 2, argv++; argv++;
} else {
printf("Usage: gimp-composites-*-test [-i|--iterations n] [-n|--n-pixels n]");
argc--, argv++;
}
}
while (argc >= 2)
{
if (argc > 1 && (strcmp (argv[0], "--iterations") == 0 || strcmp (argv[0], "-i") == 0))
{
iterations = atoi(argv[1]);
argc -= 2, argv++; argv++;
}
else if (argc > 1 && (strcmp (argv[0], "--n-pixels") == 0 || strcmp (argv[0], "-n") == 0))
{
n_pixels = atoi (argv[1]);
argc -= 2, argv++; argv++;
}
else
{
printf("Usage: gimp-composites-*-test [-i|--iterations n] [-n|--n-pixels n]");
argc--, argv++;
}
}
gimp_composite_generic_install ();
......
/* -*- mode: c tab-width: 2; c-basic-indent: 2; indent-tabs-mode: nil -*-
*
* The GIMP -- an image manipulation program
*
* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis