tweaking the speedtest

This commit is contained in:
tTh 2024-08-16 03:22:55 +02:00
parent f4c3825186
commit 725ccf3c87
3 changed files with 21 additions and 12 deletions

2
Lib/.gitignore vendored
View File

@ -1,4 +1,6 @@
*.png
*.gif
cflow.txt

View File

@ -17,14 +17,12 @@
*/
#define PIXEL_COPY(ip, ix, iy, op, ox, oy) \
do { \
op->Rpix[oy][x] = ip->Rpix[y][x]; \
op->Gpix[oy][x] = ip->Gpix[y][x]; \
op->Bpix[oy][x] = ip->Bpix[y][x]; \
(op->Rpix[oy])[ox] = (ip->Rpix[iy])[ix]; \
(op->Gpix[oy])[ox] = (ip->Gpix[iy])[ix]; \
(op->Bpix[oy])[ox] = (ip->Bpix[iy])[ix]; \
} while (0)
#define SZPIC 5777
double tthi_dtime(void);
#define SZPIC 4096
void essai_pixcopy(int usemacro)
{
@ -32,11 +30,13 @@ Image_Desc *alice, *bob;
int x, y, foo;
double T0, T1, perpix;
long count;
char *fname;
alice = Image_alloc(SZPIC, SZPIC, IMAGE_RGB);
bob = Image_alloc(SZPIC, SZPIC, IMAGE_RGB);
Image_pattern_000(alice, rand());
Image_pattern_000(alice, 0);
Image_TGA_save("alice.tga", alice, 0);
T0 = tthi_dtime();
count = 0L;
@ -48,6 +48,7 @@ if (usemacro) {
count++;
}
}
fname = "bob1.tga";
}
else {
for (y=0; y<SZPIC; y++) {
@ -56,17 +57,18 @@ else {
count++;
}
}
fname = "bob0.tga";
}
T1 = tthi_dtime();
foo = Image_TGA_save("bob.tga", bob, 0);
foo = Image_TGA_save(fname, bob, 0);
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",
perpix = ((T1-T0) / (double)count) * 1e6;
fprintf(stderr, "%s : %10ld pixels, elapsed %9.6f seconds ==> %9.6f µs/pix\n",
usemacro ? "macro" : "func ",
count, T1-T0, perpix);
@ -79,7 +81,7 @@ int main(int argc, char *argv[])
{
int i;
fprintf(stderr, "******** %s is running *********\n", argv[0]);
fprintf(stderr, "*********** %s ************\n", argv[0]);
if (argc > 1) {
fprintf(stderr, "argument: %s\n", argv[1]);

View File

@ -4,7 +4,7 @@
http://la.buvette.org/devel/libimage/
*/
#ifndef IMAGE_VERSION_STRING
#define IMAGE_VERSION_STRING "0.4.51 pl 85"
#define IMAGE_VERSION_STRING "0.4.51 pl 91"
/*::------------------------------------------------------------------::*/
/*
@ -315,10 +315,15 @@ int Image_G_pixel(Image_Desc *img, int x, int y);
int Image_B_pixel(Image_Desc *img, int x, int y);
int Image_A_pixel(Image_Desc *img, int x, int y);
/* Mon Aug 12 2024 : this function may be rewrited with a macro ? */
int Image_pixel_copy(Image_Desc *s, int x, int y, Image_Desc *d, int i, int j);
int Image_compare_desc(Image_Desc *a, Image_Desc *b);
/*::------------------------------------------------------------------::*/
/* module functions.c */
double tthi_dtime(void);
/*::------------------------------------------------------------------::*/
/* module pixels.c */