Compare commits

..

No commits in common. "82a7050d07193f587dbe7d8b756b7bdd68e589d5" and "8a163578ad128343815533558afe7e7512236e63" have entirely different histories.

3 changed files with 14 additions and 39 deletions

View File

@ -20,53 +20,34 @@
\ \
} while (0) } while (0)
#define SZPIC 5777 #define SZPIC 7777
double tthi_dtime(void); double tthi_dtime(void);
void essai_pixcopy(int usemacro) void essai_pixcopy(void)
{ {
Image_Desc *alice, *bob; Image_Desc *alice, *bob;
int x, y, foo; int x, y;
double T0, T1, perpix; double T0, T1;
long count; long count;
alice = Image_alloc(SZPIC, SZPIC, IMAGE_RGB); alice = Image_alloc(SZPIC, SZPIC, IMAGE_RGB);
bob = Image_alloc(SZPIC, SZPIC, IMAGE_RGB); bob = Image_alloc(SZPIC, SZPIC, IMAGE_RGB);
Image_pattern_000(alice, rand());
T0 = tthi_dtime(); T0 = tthi_dtime();
count = 0L; count = 0L;
for (y=0; y<SZPIC; y++) {
for (x=0; x<SZPIC; x++) {
Image_pixel_copy(alice, x, y, bob, x, y);
count++;
if (usemacro) {
for (y=0; y<SZPIC; y++) {
for (x=0; x<SZPIC; x++) {
PIXEL_COPY(alice, x, y, bob, x, y);
count++;
}
}
}
else {
for (y=0; y<SZPIC; y++) {
for (x=0; x<SZPIC; x++) {
Image_pixel_copy(alice, x, y, bob, x, y);
count++;
}
} }
} }
T1 = tthi_dtime(); T1 = tthi_dtime();
foo = Image_TGA_save("bob.tga", bob, 0); fprintf(stderr, "count %ld, elapsed %g\n", count, T1-T0);
if (foo) {
fprintf(stderr, "%s: save -> %d\n", __func__, foo);
}
perpix = (T1-T0) / (double)count;
fprintf(stderr, "%s : %10ld pixels, elapsed %9.6f seconds ==> %5.3g µs/ppix\n",
usemacro ? "macro" : "func ",
count, T1-T0, perpix);
/* end */ /* end */
} }
@ -75,9 +56,8 @@ fprintf(stderr, "%s : %10ld pixels, elapsed %9.6f seconds ==> %5.3g µs/ppix\n",
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int i;
fprintf(stderr, "******** %s is running *********\n", argv[0]); fprintf(stderr, "*** %s is running\n", argv[0]);
if (argc > 1) { if (argc > 1) {
fprintf(stderr, "argument: %s\n", argv[1]); fprintf(stderr, "argument: %s\n", argv[1]);
@ -85,10 +65,7 @@ if (argc > 1) {
Image_print_sizeof_structs("foo"); Image_print_sizeof_structs("foo");
} }
else { else {
for (i=0; i<5; i++) { essai_pixcopy();
essai_pixcopy(0);
essai_pixcopy(1);
}
} }
/* /*

View File

@ -3,8 +3,7 @@
set -e set -e
SRC="testtga.c essais.c operat.c image.c effects.c tele_2.c calculs.c" SRC="testtga.c essais.c operat.c image.c effects.c tele_2.c calculs.c"
SRC="$SRC dither.c television.c rgbmask.c sobel4.c tga.c patterns*.c" SRC="$SRC dither.c television.c"
echo $SRC ; echo
FLOW="cflow.txt" FLOW="cflow.txt"

View File

@ -14,13 +14,12 @@ HTML_DIR=$(DESTDIR)/html
# pour tracer plein de trucs: -DDEBUG_LEVEL=1 # pour tracer plein de trucs: -DDEBUG_LEVEL=1
# if IMGCOMMENT, the image comment is written to the TGA file, # if IMGCOMMENT, the image comment is written to the TGA file,
# but this files can't be loaded by Xv... # but this files can't be loaded by Xv...
#
# pour coredumper dans les situations graves: -DABORT=1 # pour coredumper dans les situations graves: -DABORT=1
# #
# use -Wmissing-prototypes ? # use -Wmissing-prototypes ?
LIBIMG_OPT=-DFORCE_ABORT=0 -DDEBUG_LEVEL=0 -DIMGCOMMENT=0 LIBIMG_OPT=-DFORCE_ABORT=0 -DDEBUG_LEVEL=0 -DIMGCOMMENT=0
CC_OPTS=-Wall -W -g -ansi -O1 -fPIC -no-pie CC_OPTS=-Wall -W -g -ansi -O0 -fPIC -no-pie
CC_HACKS=-DNEED_ALLOCA_H CC_HACKS=-DNEED_ALLOCA_H
CFLAGS= $(CC_OPTS) \ CFLAGS= $(CC_OPTS) \