2003-07-22 07:49:48 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
|
|
|
|
#include "base/base-types.h"
|
|
|
|
|
|
|
|
#include "gimp-composite.h"
|
|
|
|
#include "gimp-composite-regression.h"
|
|
|
|
#include "gimp-composite-util.h"
|
|
|
|
#include "gimp-composite-generic.h"
|
|
|
|
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
/**
|
|
|
|
* gimp_composite_regression_print_rgba8:
|
|
|
|
* @rgba8:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
**/
|
2003-07-22 07:49:48 +08:00
|
|
|
void
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
gimp_composite_regression_print_rgba8 (gimp_rgba8_t *rgba8)
|
2003-07-22 07:49:48 +08:00
|
|
|
{
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
printf ("#%02x%02x%02x,%02X", rgba8->r, rgba8->g, rgba8->b, rgba8->a);
|
2003-08-18 23:05:22 +08:00
|
|
|
fflush (stdout);
|
2003-07-22 07:49:48 +08:00
|
|
|
}
|
|
|
|
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
/**
|
|
|
|
* gimp_composite_regression_print_va8:
|
|
|
|
* @va8:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
**/
|
2003-07-22 07:49:48 +08:00
|
|
|
void
|
2003-08-18 23:05:22 +08:00
|
|
|
gimp_composite_regression_print_va8 (gimp_va8_t *va8)
|
2003-07-22 07:49:48 +08:00
|
|
|
{
|
2003-08-18 23:05:22 +08:00
|
|
|
printf ("#%02x,%02X", va8->v, va8->a);
|
|
|
|
fflush (stdout);
|
2003-07-22 07:49:48 +08:00
|
|
|
}
|
|
|
|
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
/**
|
|
|
|
* gimp_composite_regression_compare_contexts:
|
|
|
|
* @operation:
|
|
|
|
* @ctx1:
|
|
|
|
* @ctx2:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
**/
|
2003-07-22 07:49:48 +08:00
|
|
|
int
|
2003-08-18 23:05:22 +08:00
|
|
|
gimp_composite_regression_compare_contexts (char *operation, GimpCompositeContext *ctx1, GimpCompositeContext *ctx2)
|
2003-07-22 07:49:48 +08:00
|
|
|
{
|
2003-08-18 23:05:22 +08:00
|
|
|
switch (ctx1->pixelformat_D) {
|
|
|
|
case GIMP_PIXELFORMAT_ANY:
|
|
|
|
case GIMP_PIXELFORMAT_N:
|
|
|
|
default:
|
|
|
|
printf("Bad pixelformat! %d\n", ctx1->pixelformat_A);
|
|
|
|
exit(1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PIXELFORMAT_V8:
|
|
|
|
if (memcmp(ctx1->D, ctx2->D, ctx1->n_pixels * gimp_composite_pixel_bpp[ctx1->pixelformat_D])) {
|
|
|
|
printf("%s: failed to agree\n", operation);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PIXELFORMAT_VA8:
|
|
|
|
if (memcmp(ctx1->D, ctx2->D, ctx1->n_pixels * gimp_composite_pixel_bpp[ctx1->pixelformat_D])) {
|
|
|
|
printf("%s: failed to agree\n", operation);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PIXELFORMAT_RGB8:
|
|
|
|
if (memcmp(ctx1->D, ctx2->D, ctx1->n_pixels * gimp_composite_pixel_bpp[ctx1->pixelformat_D])) {
|
|
|
|
printf("%s: failed to agree\n", operation);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PIXELFORMAT_RGBA8:
|
|
|
|
gimp_composite_regression_comp_rgba8(operation, (gimp_rgba8_t *) ctx1->A, (gimp_rgba8_t *) ctx1->B, (gimp_rgba8_t *) ctx1->D, (gimp_rgba8_t *) ctx2->D, ctx1->n_pixels);
|
|
|
|
break;
|
2003-07-24 16:00:12 +08:00
|
|
|
|
|
|
|
#if GIMP_COMPOSITE_16BIT
|
2003-08-18 23:05:22 +08:00
|
|
|
case GIMP_PIXELFORMAT_V16:
|
|
|
|
if (memcmp(ctx1->D, ctx2->D, ctx1->n_pixels * gimp_composite_pixel_bpp[ctx1->pixelformat_D])) {
|
|
|
|
printf("%s: failed to agree\n", operation);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PIXELFORMAT_VA16:
|
|
|
|
if (memcmp(ctx1->D, ctx2->D, ctx1->n_pixels * gimp_composite_pixel_bpp[ctx1->pixelformat_D])) {
|
|
|
|
printf("%s: failed to agree\n", operation);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PIXELFORMAT_RGB16:
|
|
|
|
if (memcmp(ctx1->D, ctx2->D, ctx1->n_pixels * gimp_composite_pixel_bpp[ctx1->pixelformat_D])) {
|
|
|
|
printf("%s: failed to agree\n", operation);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PIXELFORMAT_RGBA16:
|
|
|
|
if (memcmp(ctx1->D, ctx2->D, ctx1->n_pixels * gimp_composite_pixel_bpp[ctx1->pixelformat_D])) {
|
|
|
|
printf("%s: failed to agree\n", operation);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
break;
|
2003-07-24 16:00:12 +08:00
|
|
|
|
|
|
|
#endif
|
|
|
|
#if GIMP_COMPOSITE_32BIT
|
2003-08-18 23:05:22 +08:00
|
|
|
case GIMP_PIXELFORMAT_V32:
|
|
|
|
if (memcmp(ctx1->D, ctx2->D, ctx1->n_pixels * gimp_composite_pixel_bpp[ctx1->pixelformat_D])) {
|
|
|
|
printf("%s: failed to agree\n", operation);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PIXELFORMAT_VA32:
|
|
|
|
if (memcmp(ctx1->D, ctx2->D, ctx1->n_pixels * gimp_composite_pixel_bpp[ctx1->pixelformat_D])) {
|
|
|
|
printf("%s: failed to agree\n", operation);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PIXELFORMAT_RGB32:
|
|
|
|
if (memcmp(ctx1->D, ctx2->D, ctx1->n_pixels * gimp_composite_pixel_bpp[ctx1->pixelformat_D])) {
|
|
|
|
printf("%s: failed to agree\n", operation);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PIXELFORMAT_RGBA32:
|
|
|
|
if (memcmp(ctx1->D, ctx2->D, ctx1->n_pixels * gimp_composite_pixel_bpp[ctx1->pixelformat_D])) {
|
|
|
|
printf("%s: failed to agree\n", operation);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
break;
|
2003-07-24 16:00:12 +08:00
|
|
|
|
|
|
|
#endif
|
2003-08-18 23:05:22 +08:00
|
|
|
}
|
2003-07-22 07:49:48 +08:00
|
|
|
|
2003-08-18 23:05:22 +08:00
|
|
|
return (0);
|
2003-07-22 07:49:48 +08:00
|
|
|
}
|
|
|
|
|
2003-07-24 16:00:12 +08:00
|
|
|
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
/**
|
|
|
|
* gimp_composite_regression_comp_rgba8:
|
|
|
|
* @str:
|
|
|
|
* @rgba8A:
|
|
|
|
* @rgba8B:
|
|
|
|
* @expected:
|
|
|
|
* @actual:
|
|
|
|
* @length:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
**/
|
2003-07-22 07:49:48 +08:00
|
|
|
int
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
gimp_composite_regression_comp_rgba8 (char *str, gimp_rgba8_t *rgba8A, gimp_rgba8_t *rgba8B, gimp_rgba8_t *expected, gimp_rgba8_t *actual, u_long length)
|
2003-07-22 07:49:48 +08:00
|
|
|
{
|
2003-09-17 13:43:28 +08:00
|
|
|
u_long i;
|
2003-07-22 07:49:48 +08:00
|
|
|
int failed;
|
|
|
|
int fail_count;
|
|
|
|
|
|
|
|
fail_count = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < length; i++) {
|
|
|
|
failed = 0;
|
|
|
|
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
if (expected[i].r != actual[i].r) { failed = 1; }
|
|
|
|
if (expected[i].g != actual[i].g) { failed = 1; }
|
|
|
|
if (expected[i].b != actual[i].b) { failed = 1; }
|
|
|
|
if (expected[i].a != actual[i].a) { failed = 1; }
|
2003-07-22 07:49:48 +08:00
|
|
|
if (failed) {
|
|
|
|
fail_count++;
|
2003-09-27 20:59:22 +08:00
|
|
|
printf("%s %8lu A=", str, i); gimp_composite_regression_print_rgba8(&rgba8A[i]);
|
2003-07-22 07:49:48 +08:00
|
|
|
if (rgba8B != (gimp_rgba8_t *) 0) {
|
|
|
|
printf(" B="); gimp_composite_regression_print_rgba8(&rgba8B[i]);
|
|
|
|
}
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
printf(" expected=");
|
2003-07-22 07:49:48 +08:00
|
|
|
gimp_composite_regression_print_rgba8(&expected[i]);
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
printf(" actual=");
|
|
|
|
gimp_composite_regression_print_rgba8(&actual[i]);
|
2003-07-22 07:49:48 +08:00
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
if (fail_count > 5)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (fail_count);
|
|
|
|
}
|
|
|
|
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
/**
|
|
|
|
* gimp_composite_regression_comp_va8:
|
|
|
|
* @str:
|
|
|
|
* @va8A:
|
|
|
|
* @va8B:
|
|
|
|
* @expected:
|
|
|
|
* @actual:
|
|
|
|
* @length:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
**/
|
2003-07-22 07:49:48 +08:00
|
|
|
int
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
gimp_composite_regression_comp_va8 (char *str, gimp_va8_t *va8A, gimp_va8_t *va8B, gimp_va8_t *expected, gimp_va8_t *actual, u_long length)
|
2003-07-22 07:49:48 +08:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int failed;
|
|
|
|
int fail_count;
|
|
|
|
|
|
|
|
fail_count = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < length; i++) {
|
|
|
|
failed = 0;
|
|
|
|
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
if (expected[i].v != actual[i].v) { failed = 1; }
|
|
|
|
if (expected[i].a != actual[i].a) { failed = 1; }
|
2003-07-22 07:49:48 +08:00
|
|
|
if (failed) {
|
|
|
|
fail_count++;
|
|
|
|
printf("%s %8d A=", str, i); gimp_composite_regression_print_va8(&va8A[i]);
|
|
|
|
if (va8B != (gimp_va8_t *) 0) { printf(" B="); gimp_composite_regression_print_va8(&va8B[i]); }
|
|
|
|
printf(" ");
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
printf("expected=");
|
2003-07-22 07:49:48 +08:00
|
|
|
gimp_composite_regression_print_va8(&expected[i]);
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
printf(" actual=");
|
|
|
|
gimp_composite_regression_print_va8(&actual[i]);
|
2003-07-22 07:49:48 +08:00
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
if (fail_count > 5)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (fail_count);
|
|
|
|
}
|
|
|
|
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
/**
|
|
|
|
* gimp_composite_regression_dump_rgba8:
|
|
|
|
* @str:
|
|
|
|
* @rgba:
|
|
|
|
* @n_pixels:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
**/
|
2003-07-22 07:49:48 +08:00
|
|
|
void
|
2003-08-18 23:05:22 +08:00
|
|
|
gimp_composite_regression_dump_rgba8 (char *str, gimp_rgba8_t *rgba, u_long n_pixels)
|
2003-07-22 07:49:48 +08:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
printf("%s\n", str);
|
|
|
|
|
2003-08-18 03:01:24 +08:00
|
|
|
for (i = 0; i < n_pixels; i++) {
|
2003-07-22 07:49:48 +08:00
|
|
|
printf("%5d: ", i);
|
|
|
|
gimp_composite_regression_print_rgba8(&rgba[i]);
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#define tv_to_secs(tv) ((double) ((tv).tv_sec) + (double) ((tv).tv_usec / 1000000.0))
|
|
|
|
|
|
|
|
#define timer_report(name,t1,t2) printf("%-17s %17.7f %17.7f %17.7f%c\n", name, tv_to_secs(t1), tv_to_secs(t2), tv_to_secs(t1)/tv_to_secs(t2), tv_to_secs(t1)/tv_to_secs(t2) > 1.0 ? ' ' : '*');
|
|
|
|
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
/**
|
|
|
|
* gimp_composite_regression_timer_report:
|
|
|
|
* @name:
|
|
|
|
* @t1:
|
|
|
|
* @t2:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
**/
|
2003-07-22 07:49:48 +08:00
|
|
|
void
|
2003-08-18 23:05:22 +08:00
|
|
|
gimp_composite_regression_timer_report (char *name, double t1, double t2)
|
2003-07-22 07:49:48 +08:00
|
|
|
{
|
2003-08-18 23:05:22 +08:00
|
|
|
printf ("%-17s %17.7f %17.7f %17.7f%c\n", name, t1, t2, t1/t2, t1/t2 > 1.0 ? ' ' : '*');
|
2003-07-22 07:49:48 +08:00
|
|
|
}
|
|
|
|
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
/**
|
|
|
|
* gimp_composite_regression_time_function:
|
|
|
|
* @iterations:
|
|
|
|
* @func:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
**/
|
2003-07-22 07:49:48 +08:00
|
|
|
double
|
2003-09-17 13:43:28 +08:00
|
|
|
gimp_composite_regression_time_function (u_long iterations, void (*func)(), GimpCompositeContext *ctx)
|
2003-07-22 07:49:48 +08:00
|
|
|
{
|
2003-08-18 23:05:22 +08:00
|
|
|
struct timeval t0;
|
|
|
|
struct timeval t1;
|
|
|
|
struct timeval tv_elapsed;
|
2003-09-17 13:43:28 +08:00
|
|
|
u_long i;
|
2003-07-22 07:49:48 +08:00
|
|
|
|
|
|
|
gettimeofday(&t0, NULL);
|
|
|
|
for (i = 0; i < iterations; i++) { (*func)(ctx); }
|
|
|
|
gettimeofday(&t1, NULL);
|
|
|
|
timersub(&t1, &t0, &tv_elapsed);
|
|
|
|
|
2003-08-18 23:05:22 +08:00
|
|
|
return (tv_to_secs(tv_elapsed));
|
2003-07-22 07:49:48 +08:00
|
|
|
}
|
2003-08-18 03:01:24 +08:00
|
|
|
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
/**
|
|
|
|
* gimp_composite_regression_random_rgba8:
|
|
|
|
* @n_pixels:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
**/
|
2003-08-18 03:01:24 +08:00
|
|
|
gimp_rgba8_t *
|
2003-09-17 13:43:28 +08:00
|
|
|
gimp_composite_regression_random_rgba8 (u_long n_pixels)
|
2003-08-18 03:01:24 +08:00
|
|
|
{
|
2003-08-18 23:05:22 +08:00
|
|
|
gimp_rgba8_t *rgba8;
|
2003-09-17 13:43:28 +08:00
|
|
|
u_long i;
|
2003-08-18 23:05:22 +08:00
|
|
|
|
|
|
|
if ((rgba8 = (gimp_rgba8_t *) calloc (sizeof(gimp_rgba8_t), n_pixels))) {
|
|
|
|
for (i = 0; i < n_pixels; i++) {
|
|
|
|
rgba8[i].r = rand() % 256;
|
|
|
|
rgba8[i].g = rand() % 256;
|
|
|
|
rgba8[i].b = rand() % 256;
|
|
|
|
rgba8[i].a = rand() % 256;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rgba8);
|
2003-08-18 03:01:24 +08:00
|
|
|
}
|
|
|
|
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
/**
|
|
|
|
* gimp_composite_regression_fixed_rgba8:
|
|
|
|
* @n_pixels:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
**/
|
2003-08-18 03:01:24 +08:00
|
|
|
gimp_rgba8_t *
|
2003-09-17 13:43:28 +08:00
|
|
|
gimp_composite_regression_fixed_rgba8 (u_long n_pixels)
|
2003-08-18 03:01:24 +08:00
|
|
|
{
|
2003-08-18 23:05:22 +08:00
|
|
|
gimp_rgba8_t *rgba8;
|
2003-09-17 13:43:28 +08:00
|
|
|
u_long i;
|
|
|
|
u_long v;
|
2003-08-18 23:05:22 +08:00
|
|
|
|
|
|
|
if ((rgba8 = (gimp_rgba8_t *) calloc(sizeof(gimp_rgba8_t), n_pixels))) {
|
|
|
|
for (i = 0; i < n_pixels; i++) {
|
|
|
|
v = i % 256;
|
2003-08-20 10:55:46 +08:00
|
|
|
rgba8[i].r = v;
|
|
|
|
rgba8[i].g = v;
|
|
|
|
rgba8[i].b = v;
|
|
|
|
rgba8[i].a = v;
|
2003-08-18 23:05:22 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rgba8);
|
2003-08-18 03:01:24 +08:00
|
|
|
}
|
2003-08-22 13:54:01 +08:00
|
|
|
|
app/composite/gimp-composite.h app/composite/gimp-composite-generic.h
* app/composite/gimp-composite.h
* app/composite/gimp-composite-generic.h
* app/composite/gimp-composite-regression.h: Reformatted to include
argument names in function prototypes.
* app/composite/gimp-composite.c
* app/composite/gimp-composite-generic.c
* app/composite/gimp-composite-regression.c: Added gtk-doc templates for functions.
* 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
2003-10-12 08:10:21 +08:00
|
|
|
/**
|
|
|
|
* gimp_composite_context_init:
|
|
|
|
* @ctx:
|
|
|
|
* @op:
|
|
|
|
* @a_format:
|
|
|
|
* @b_format:
|
|
|
|
* @d_format:
|
|
|
|
* @m_format:
|
|
|
|
* @n_pixels:
|
|
|
|
* @A:
|
|
|
|
* @B:
|
|
|
|
* @M:
|
|
|
|
* @D:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
**/
|
2003-08-22 13:54:01 +08:00
|
|
|
GimpCompositeContext *
|
|
|
|
gimp_composite_context_init (GimpCompositeContext *ctx,
|
|
|
|
GimpCompositeOperation op,
|
|
|
|
GimpPixelFormat a_format,
|
|
|
|
GimpPixelFormat b_format,
|
|
|
|
GimpPixelFormat d_format,
|
|
|
|
GimpPixelFormat m_format,
|
|
|
|
unsigned long n_pixels,
|
|
|
|
unsigned char *A,
|
|
|
|
unsigned char *B,
|
|
|
|
unsigned char *M,
|
|
|
|
unsigned char *D)
|
|
|
|
{
|
|
|
|
memset ((void *) ctx, 0, sizeof(*ctx));
|
|
|
|
ctx->op = op;
|
|
|
|
ctx->n_pixels = n_pixels;
|
|
|
|
ctx->scale.scale = 2;
|
|
|
|
ctx->pixelformat_A = a_format;
|
|
|
|
ctx->pixelformat_B = b_format;
|
|
|
|
ctx->pixelformat_D = d_format;
|
|
|
|
ctx->pixelformat_M = m_format;
|
|
|
|
ctx->A = (unsigned char *) A;
|
|
|
|
ctx->B = (unsigned char *) B;
|
|
|
|
ctx->M = (unsigned char *) B;
|
|
|
|
ctx->D = (unsigned char *) D;
|
|
|
|
memset (ctx->D, 0, ctx->n_pixels * gimp_composite_pixel_bpp[ctx->pixelformat_D]);
|
|
|
|
|
|
|
|
return (ctx);
|
|
|
|
}
|