app/composite/gimp-composite-generic.h: Use

GimpCompositeFunction as the type for all compositing functions.

app/composite/Makefile.am: gimp-composite.c is no longer
dependant upon gimp-composite-dispatch.c

app/composite/gimp-composite-dispatch.[ch]
app/composite/make-gimp-composite-dispatch.py: Fixed type
mismatches.

app/composite/test-composite.c: Fixed bit-rot in not keeping up
with the changes in the surrounding .h files.

app/composite/gimp-composite-mmx.c: Incipient cleanup in marking
some asm constructs as volatile.
This commit is contained in:
Helvetix Victorinox
2003-07-15 16:04:39 +00:00
parent 562865a092
commit f5e839a39c
6 changed files with 153 additions and 127 deletions

View File

@ -1,3 +1,21 @@
2003-07-15 Helvetix Victorinox <helvetix@gimp.org>
* app/composite/gimp-composite-generic.h: Use
GimpCompositeFunction as the type for all compositing functions.
* app/composite/Makefile.am: gimp-composite.c is no longer
dependant upon gimp-composite-dispatch.c
* app/composite/gimp-composite-dispatch.[ch]
app/composite/make-gimp-composite-dispatch.py: Fixed type
mismatches.
* app/composite/test-composite.c: Fixed bit-rot in not keeping up
with the changes in the surrounding .h files.
* app/composite/gimp-composite-mmx.c: Incipient cleanup in marking
some asm constructs as volatile.
2003-07-15 Michael Natterer <mitch@gimp.org>
* app/paint/gimppaintoptions.[ch]: took the fade options out of

View File

@ -34,7 +34,7 @@ libappcomposite_a_SOURCES = $(libappcomposite_a_built_sources) $(libappcomposite
gimp-composite.c: gimp-composite-dispatch.c
#gimp-composite.c: gimp-composite-dispatch.c
gimp-composite-dispatch.c: gimp-composite-generic.o make-gimp-composite-dispatch.py
./make-gimp-composite-dispatch.py gimp-composite-generic.o > gimp-composite-dispatch.c

View File

@ -1,29 +1,32 @@
extern void gimp_composite_color_generic (GimpCompositeContext *);
extern void gimp_composite_blend_pixels (GimpCompositeContext *);
extern void gimp_composite_shade_generic (GimpCompositeContext *);
extern void gimp_composite_darken_generic(GimpCompositeContext *);
extern void gimp_composite_lighten_generic(GimpCompositeContext *);
extern void gimp_composite_hue_only_generic (GimpCompositeContext *);
extern void gimp_composite_saturation_generic (GimpCompositeContext *);
extern void gimp_composite_value_generic(GimpCompositeContext *);
extern void gimp_composite_color_only_generic(GimpCompositeContext *);
extern void gimp_composite_multiply_generic(GimpCompositeContext *);
extern void gimp_composite_divide_generic(GimpCompositeContext *);
extern void gimp_composite_screen_generic(GimpCompositeContext *);
extern void gimp_composite_overlay_generic(GimpCompositeContext *);
extern void gimp_composite_dodge_generic(GimpCompositeContext *);
extern void gimp_composite_burn_generic (GimpCompositeContext *);
extern void gimp_composite_hardlight_generic(GimpCompositeContext *);
extern void gimp_composite_softlight_generic(GimpCompositeContext *);
extern void gimp_composite_grain_extract_generic(GimpCompositeContext *);
extern void gimp_composite_grain_merge_generic(GimpCompositeContext *);
extern void gimp_composite_addition_generic(GimpCompositeContext *);
extern void gimp_composite_subtract_generic(GimpCompositeContext *);
extern void gimp_composite_difference_generic(GimpCompositeContext *);
extern void gimp_composite_dissolve_generic(GimpCompositeContext *);
extern void gimp_composite_replace_generic(GimpCompositeContext *);
extern void gimp_composite_generic_init(GimpCompositeContext *);
extern void gimp_composite_swap_generic (GimpCompositeContext *);
extern void gimp_composite_scale_generic (GimpCompositeContext *);
GimpCompositeFunction gimp_composite_addition_any_any_any_generic();
GimpCompositeFunction gimp_composite_anti_erase_any_any_any_generic();
GimpCompositeFunction gimp_composite_blend_any_any_any_generic();
GimpCompositeFunction gimp_composite_burn_any_any_any_generic();
GimpCompositeFunction gimp_composite_color_any_any_any_generic();
GimpCompositeFunction gimp_composite_color_erase_any_any_any_generic();
GimpCompositeFunction gimp_composite_color_only_any_any_any_generic();
GimpCompositeFunction gimp_composite_convert_any_any_any_generic();
GimpCompositeFunction gimp_composite_darken_any_any_any_generic();
GimpCompositeFunction gimp_composite_difference_any_any_any_generic();
GimpCompositeFunction gimp_composite_dissolve_any_any_any_generic();
GimpCompositeFunction gimp_composite_divide_any_any_any_generic();
GimpCompositeFunction gimp_composite_dodge_any_any_any_generic();
GimpCompositeFunction gimp_composite_erase_rgba8_any_any_generic();
GimpCompositeFunction gimp_composite_generic_init();
GimpCompositeFunction gimp_composite_grain_extract_any_any_any_generic();
GimpCompositeFunction gimp_composite_grain_merge_any_any_any_generic();
GimpCompositeFunction gimp_composite_hardlight_any_any_any_generic();
GimpCompositeFunction gimp_composite_hue_any_any_any_generic();
GimpCompositeFunction gimp_composite_lighten_any_any_any_generic();
GimpCompositeFunction gimp_composite_multiply_any_any_any_generic();
GimpCompositeFunction gimp_composite_normal_any_any_any_generic();
GimpCompositeFunction gimp_composite_normal_rgba8_any_any_generic();
GimpCompositeFunction gimp_composite_overlay_any_any_any_generic();
GimpCompositeFunction gimp_composite_replace_any_any_any_generic();
GimpCompositeFunction gimp_composite_saturation_any_any_any_generic();
GimpCompositeFunction gimp_composite_scale_any_any_any_generic();
GimpCompositeFunction gimp_composite_screen_any_any_any_generic();
GimpCompositeFunction gimp_composite_softlight_any_any_any_generic();
GimpCompositeFunction gimp_composite_subtract_any_any_any_generic();
GimpCompositeFunction gimp_composite_swap_any_any_any_generic();
GimpCompositeFunction gimp_composite_value_any_any_any_generic();

View File

@ -183,10 +183,13 @@ gimp_composite_addition_rgba8_rgba8_rgba8_mmx(GimpCompositeContext *_op)
{
GimpCompositeContext op = *_op;
asm("movq %0,%%mm0" : : "m" (rgba8_alpha_mask) : "%mm0");
asm volatile ("movq %0,%%mm0"
: /* empty */
: "m" (rgba8_alpha_mask)
: "%mm0");
for (; op.n_pixels >= 2; op.n_pixels -= 2) {
asm volatile (" movq (%0), %%mm2; addl $8, %0\n"
asm (" movq (%0), %%mm2; addl $8, %0\n"
"\tmovq (%1), %%mm3; addl $8, %1\n"
"\tmovq %%mm2, %%mm4\n"
"\tpaddusb %%mm3, %%mm4\n"
@ -202,7 +205,7 @@ gimp_composite_addition_rgba8_rgba8_rgba8_mmx(GimpCompositeContext *_op)
}
if (op.n_pixels) {
asm(" movd (%0), %%mm2;\n"
asm volatile (" movd (%0), %%mm2;\n"
"\tmovd (%1), %%mm3;\n"
"\tmovq %%mm2, %%mm4\n"
"\tpaddusb %%mm3, %%mm4\n"
@ -224,13 +227,13 @@ void gimp_composite_burn_rgba8_rgba8_rgba8_mmx(GimpCompositeContext *_op)
{
GimpCompositeContext op = *_op;
asm("movq %0,%%mm1"
:
asm volatile ("movq %0,%%mm1"
: /* empty */
: "m" (rgba8_alpha_mask)
: "%mm1");
for (; op.n_pixels >= 2; op.n_pixels -= 2) {
asm volatile (" movq (%0),%%mm0; addl $8,%0\n"
asm (" movq (%0),%%mm0; addl $8,%0\n"
"\tmovq (%1),%%mm1; addl $8,%1\n"
"\tmovq %3,%%mm2\n"
@ -370,7 +373,7 @@ gimp_composite_darken_rgba8_rgba8_rgba8_mmx(GimpCompositeContext *_op)
GimpCompositeContext op = *_op;
for (; op.n_pixels >= 2; op.n_pixels -= 2) {
asm volatile (" movq (%0), %%mm2; addl $8, %0\n"
asm (" movq (%0), %%mm2; addl $8, %0\n"
"\tmovq (%1), %%mm3; addl $8, %1\n"
"\t" pminub(mm3, mm2, mm4) "\n"
"\tmovq %%mm2, (%2); addl $8, %2\n"
@ -400,7 +403,7 @@ gimp_composite_difference_rgba8_rgba8_rgba8_mmx(GimpCompositeContext *_op)
asm("movq %0,%%mm0" : : "m" (rgba8_alpha_mask) : "%mm0");
for (; op.n_pixels >= 2; op.n_pixels -= 2) {
asm volatile (" movq (%0), %%mm2; addl $8, %0\n"
asm (" movq (%0), %%mm2; addl $8, %0\n"
"\tmovq (%1), %%mm3; addl $8, %1\n"
"\tmovq %%mm2, %%mm4\n"
"\tmovq %%mm3, %%mm5\n"

View File

@ -118,7 +118,7 @@ def print_function_table(filename, function_table):
for key in function_table_keys:
if not function_table_declarations.has_key(function_table[key][0]):
print 'void %s(GimpCompositeContext *);' % (function_table[key][0])
print 'GimpCompositeFunction %s();' % (function_table[key][0])
function_table_declarations[function_table[key][0]] = function_table[key][0]
pass
pass
@ -289,12 +289,12 @@ def main(argv):
print '/* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT */'
print '$Id$'
print '#include "gimp-composite.h"'
print 'extern void %s(GimpCompositeContext *);' % ("gimp_composite_unsupported")
print 'extern GimpCompositeFunction %s();' % ("gimp_composite_unsupported")
done = dict()
for k in gimp_composite_function.keys():
f = gimp_composite_function[k]
if not done.has_key(f[0]):
print 'extern void %s(GimpCompositeContext *);' % (f[0])
print 'extern GimpCompositeFunction %s();' % (f[0])
done.update({f[0] : None})
pass
pass
@ -445,7 +445,7 @@ print '#include <glib-object.h>'
print '#include "base/base-types.h"'
print '#include "gimp-composite.h"'
print '#include "gimp-composite-dispatch.h"'
print 'extern GimpCompositeFunction %s;' % ("gimp_composite_unsupported")
print 'extern GimpCompositeFunction %s();' % ("gimp_composite_unsupported")
print ''

View File

@ -10,7 +10,9 @@
#include "base/base-types.h"
#include "gimp-composite.h"
#include "gimp-composite-dispatch.h"
#include "gimp-composite-util.h"
#include "gimp-composite-generic.h"
#undef use_oldmmx
@ -271,7 +273,7 @@ main (int argc, char *argv[])
for (i = 0; i < iterations; i++) { gimp_composite_burn_any_any_any_generic(&ctx_generic); }
gettimeofday(&t1, NULL);
timersub(&t1, &t0, &old_elapsed);
comp_rgba8("burn rgba8", ctx.A, ctx.B, ctx_generic.D, ctx.D, ctx.n_pixels);
comp_rgba8("burn rgba8", (rgba8_t *) ctx.A, (rgba8_t *) ctx.B, (rgba8_t *) ctx_generic.D, (rgba8_t *) ctx.D, ctx.n_pixels);
timer_report("burn rgba8", old_elapsed, new_elapsed);
gettimeofday(&t0, NULL);
@ -284,7 +286,7 @@ main (int argc, char *argv[])
for (i = 0; i < iterations; i++) { gimp_composite_burn_any_any_any_generic(&ctx_va8_generic); }
gettimeofday(&t1, NULL);
timersub(&t1, &t0, &old_elapsed);
comp_va8("burn rgba8", ctx_va8.A, ctx_va8.B, ctx_va8_generic.D, ctx_va8.D, ctx_va8.n_pixels);
comp_va8("burn rgba8", (va8_t *) ctx_va8.A, (va8_t *) ctx_va8.B, (va8_t *) ctx_va8_generic.D, (va8_t *) ctx_va8.D, ctx_va8.n_pixels);
timer_report("burn va8", old_elapsed, new_elapsed);
#endif
@ -299,7 +301,7 @@ main (int argc, char *argv[])
for (i = 0; i < iterations; i++) { gimp_composite_dodge_any_any_any_generic(&ctx_generic); }
gettimeofday(&t1, NULL);
timersub(&t1, &t0, &old_elapsed);
comp_rgba8("dodge", ctx.A, ctx.B, ctx_generic.D, ctx.D, ctx.n_pixels);
comp_rgba8("dodge", (rgba8_t *) ctx.A, (rgba8_t *) ctx.B, (rgba8_t *) ctx_generic.D, (rgba8_t *) ctx.D, ctx.n_pixels);
timer_report("dodge", old_elapsed, new_elapsed);
#endif
@ -314,7 +316,7 @@ main (int argc, char *argv[])
for (i = 0; i < iterations; i++) { gimp_composite_divide_any_any_any_generic(&ctx_generic); }
gettimeofday(&t1, NULL);
timersub(&t1, &t0, &old_elapsed);
comp_rgba8("divide", ctx.A, ctx.B, ctx_generic.D, ctx.D, ctx.n_pixels);
comp_rgba8("divide", (rgba8_t *) ctx.A, (rgba8_t *) ctx.B, (rgba8_t *) ctx_generic.D, (rgba8_t *) ctx.D, ctx.n_pixels);
timer_report("divide", old_elapsed, new_elapsed);
#endif
@ -329,7 +331,7 @@ main (int argc, char *argv[])
for (i = 0; i < iterations; i++) { gimp_composite_grain_extract_any_any_any_generic(&ctx_generic); }
gettimeofday(&t1, NULL);
timersub(&t1, &t0, &old_elapsed);
comp_rgba8("grain extract", ctx.A, ctx.B, ctx_generic.D, ctx.D, ctx.n_pixels);
comp_rgba8("grain extract", (rgba8_t *) ctx.A, (rgba8_t *) ctx.B, (rgba8_t *) ctx_generic.D, (rgba8_t *) ctx.D, ctx.n_pixels);
timer_report("grainextract", old_elapsed, new_elapsed);
#endif
@ -343,7 +345,7 @@ main (int argc, char *argv[])
for (i = 0; i < iterations; i++) { gimp_composite_grain_merge_any_any_any_generic(&ctx_generic); }
gettimeofday(&t1, NULL);
timersub(&t1, &t0, &old_elapsed);
comp_rgba8("grain merge", ctx.A, ctx.B, ctx_generic.D, ctx.D, ctx.n_pixels);
comp_rgba8("grain merge", (rgba8_t *) ctx.A, (rgba8_t *) ctx.B, (rgba8_t *) ctx_generic.D, (rgba8_t *) ctx.D, ctx.n_pixels);
timer_report("grainmerge", old_elapsed, new_elapsed);
#endif
@ -358,7 +360,7 @@ main (int argc, char *argv[])
for (i = 0; i < iterations; i++) { gimp_composite_scale_any_any_any_generic(&ctx_generic); }
gettimeofday(&t1, NULL);
timersub(&t1, &t0, &old_elapsed);
comp_rgba8("scale", ctx.A, NULL, ctx_generic.D, ctx.D, ctx.n_pixels);
comp_rgba8("scale", (rgba8_t *) ctx.A, NULL, (rgba8_t *) ctx_generic.D, (rgba8_t *) ctx.D, ctx.n_pixels);
timer_report("scale", old_elapsed, new_elapsed);
#endif
@ -372,7 +374,7 @@ main (int argc, char *argv[])
for (i = 0; i < iterations; i++) { gimp_composite_screen_any_any_any_generic(&ctx_generic); }
gettimeofday(&t1, NULL);
timersub(&t1, &t0, &old_elapsed);
comp_rgba8("screen", ctx.A, ctx.B, ctx_generic.D, ctx.D, ctx.n_pixels);
comp_rgba8("screen", (rgba8_t *) ctx.A,(rgba8_t *) ctx.B, (rgba8_t *) ctx_generic.D, (rgba8_t *) ctx.D, ctx.n_pixels);
timer_report("screen", old_elapsed, new_elapsed);
#endif
@ -386,7 +388,7 @@ main (int argc, char *argv[])
for (i = 0; i < iterations; i++) { gimp_composite_lighten_any_any_any_generic(&ctx_generic); }
gettimeofday(&t1, NULL);
timersub(&t1, &t0, &old_elapsed);
comp_rgba8("lighten", ctx.A, ctx.B, ctx_generic.D, ctx.D, ctx.n_pixels);
comp_rgba8("lighten", (rgba8_t *) ctx.A, (rgba8_t *) ctx.B, (rgba8_t *) ctx_generic.D, (rgba8_t *) ctx.D, ctx.n_pixels);
timer_report("lighten", old_elapsed, new_elapsed);
#endif
@ -401,7 +403,7 @@ main (int argc, char *argv[])
for (i = 0; i < iterations; i++) { gimp_composite_darken_any_any_any_generic(&ctx_generic); }
gettimeofday(&t1, NULL);
timersub(&t1, &t0, &old_elapsed);
comp_rgba8("darken", ctx.A, ctx.B, ctx_generic.D, ctx.D, ctx.n_pixels);
comp_rgba8("darken", (rgba8_t *) ctx.A, (rgba8_t *) ctx.B, (rgba8_t *) ctx_generic.D, (rgba8_t *) ctx.D, ctx.n_pixels);
timer_report("darken", old_elapsed, new_elapsed);
#endif
@ -415,7 +417,7 @@ main (int argc, char *argv[])
for (i = 0; i < iterations; i++) { gimp_composite_difference_any_any_any_generic(&ctx_generic); }
gettimeofday(&t1, NULL);
timersub(&t1, &t0, &old_elapsed);
comp_rgba8("difference", ctx.A, ctx.B, ctx_generic.D, ctx.D, ctx.n_pixels);
comp_rgba8("difference", (rgba8_t *) ctx.A, (rgba8_t *) ctx.B, (rgba8_t *) ctx_generic.D, (rgba8_t *) ctx.D, ctx.n_pixels);
timer_report("difference", old_elapsed, new_elapsed);
#endif
@ -429,7 +431,7 @@ main (int argc, char *argv[])
for (i = 0; i < iterations; i++) { gimp_composite_multiply_any_any_any_generic(&ctx_generic); }
gettimeofday(&t1, NULL);
timersub(&t1, &t0, &old_elapsed);
comp_rgba8("multiply", ctx.A, ctx.B, ctx_generic.D, ctx.D, ctx.n_pixels);
comp_rgba8("multiply", (rgba8_t *)ctx.A, (rgba8_t *)ctx.B, (rgba8_t *) ctx_generic.D, (rgba8_t *) ctx.D, ctx.n_pixels);
timer_report("multiply", old_elapsed, new_elapsed);
#endif
@ -443,7 +445,7 @@ main (int argc, char *argv[])
for (i = 0; i < iterations; i++) { gimp_composite_subtract_any_any_any_generic(&ctx_generic); }
gettimeofday(&t1, NULL);
timersub(&t1, &t0, &old_elapsed);
comp_rgba8("subtract", ctx.A, ctx.B, ctx_generic.D, ctx.D, ctx.n_pixels);
comp_rgba8("subtract", (rgba8_t *) ctx.A, (rgba8_t *) ctx.B, (rgba8_t *) ctx_generic.D, (rgba8_t *) ctx.D, ctx.n_pixels);
timer_report("subtract", old_elapsed, new_elapsed);
#endif
@ -457,7 +459,7 @@ main (int argc, char *argv[])
for (i = 0; i < iterations; i++) { gimp_composite_addition_any_any_any_generic(&ctx_generic); }
gettimeofday(&t1, NULL);
timersub(&t1, &t0, &old_elapsed);
comp_rgba8("addition", ctx.A, ctx.B, ctx_generic.D, ctx.D, ctx.n_pixels);
comp_rgba8("addition", (rgba8_t *) ctx.A, (rgba8_t *) ctx.B, (rgba8_t *) ctx_generic.D, (rgba8_t *) ctx.D, ctx.n_pixels);
timer_report("add", old_elapsed, new_elapsed);
#endif
@ -471,8 +473,8 @@ main (int argc, char *argv[])
for (i = 0; i < iterations; i++) { gimp_composite_swap_any_any_any_generic(&ctx_generic); }
gettimeofday(&t1, NULL);
timersub(&t1, &t0, &old_elapsed);
comp_rgba8("swap", ctx.A, ctx.B, ctx_generic.A, ctx.A, ctx.n_pixels);
comp_rgba8("swap", ctx.A, ctx.B, ctx_generic.B, ctx.B, ctx.n_pixels);
comp_rgba8("swap", (rgba8_t *) ctx.A, (rgba8_t *) ctx.B, (rgba8_t *) ctx_generic.A, (rgba8_t *) ctx.A, ctx.n_pixels);
comp_rgba8("swap", (rgba8_t *) ctx.A, (rgba8_t *) ctx.B, (rgba8_t *) ctx_generic.B, (rgba8_t *) ctx.B, ctx.n_pixels);
timer_report("swap", old_elapsed, new_elapsed);
#endif