tweaking the speedtest
This commit is contained in:
parent
f4c3825186
commit
725ccf3c87
2
Lib/.gitignore
vendored
2
Lib/.gitignore
vendored
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
*.png
|
*.png
|
||||||
|
*.gif
|
||||||
|
|
||||||
cflow.txt
|
cflow.txt
|
||||||
|
|
||||||
|
24
Lib/foo.c
24
Lib/foo.c
@ -17,14 +17,12 @@
|
|||||||
*/
|
*/
|
||||||
#define PIXEL_COPY(ip, ix, iy, op, ox, oy) \
|
#define PIXEL_COPY(ip, ix, iy, op, ox, oy) \
|
||||||
do { \
|
do { \
|
||||||
op->Rpix[oy][x] = ip->Rpix[y][x]; \
|
(op->Rpix[oy])[ox] = (ip->Rpix[iy])[ix]; \
|
||||||
op->Gpix[oy][x] = ip->Gpix[y][x]; \
|
(op->Gpix[oy])[ox] = (ip->Gpix[iy])[ix]; \
|
||||||
op->Bpix[oy][x] = ip->Bpix[y][x]; \
|
(op->Bpix[oy])[ox] = (ip->Bpix[iy])[ix]; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define SZPIC 5777
|
#define SZPIC 4096
|
||||||
|
|
||||||
double tthi_dtime(void);
|
|
||||||
|
|
||||||
void essai_pixcopy(int usemacro)
|
void essai_pixcopy(int usemacro)
|
||||||
{
|
{
|
||||||
@ -32,11 +30,13 @@ Image_Desc *alice, *bob;
|
|||||||
int x, y, foo;
|
int x, y, foo;
|
||||||
double T0, T1, perpix;
|
double T0, T1, perpix;
|
||||||
long count;
|
long count;
|
||||||
|
char *fname;
|
||||||
|
|
||||||
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());
|
Image_pattern_000(alice, 0);
|
||||||
|
Image_TGA_save("alice.tga", alice, 0);
|
||||||
|
|
||||||
T0 = tthi_dtime();
|
T0 = tthi_dtime();
|
||||||
count = 0L;
|
count = 0L;
|
||||||
@ -48,6 +48,7 @@ if (usemacro) {
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fname = "bob1.tga";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (y=0; y<SZPIC; y++) {
|
for (y=0; y<SZPIC; y++) {
|
||||||
@ -56,17 +57,18 @@ else {
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fname = "bob0.tga";
|
||||||
}
|
}
|
||||||
|
|
||||||
T1 = tthi_dtime();
|
T1 = tthi_dtime();
|
||||||
|
|
||||||
foo = Image_TGA_save("bob.tga", bob, 0);
|
foo = Image_TGA_save(fname, bob, 0);
|
||||||
if (foo) {
|
if (foo) {
|
||||||
fprintf(stderr, "%s: save -> %d\n", __func__, foo);
|
fprintf(stderr, "%s: save -> %d\n", __func__, foo);
|
||||||
}
|
}
|
||||||
|
|
||||||
perpix = (T1-T0) / (double)count;
|
perpix = ((T1-T0) / (double)count) * 1e6;
|
||||||
fprintf(stderr, "%s : %10ld pixels, elapsed %9.6f seconds ==> %5.3g µs/ppix\n",
|
fprintf(stderr, "%s : %10ld pixels, elapsed %9.6f seconds ==> %9.6f µs/pix\n",
|
||||||
usemacro ? "macro" : "func ",
|
usemacro ? "macro" : "func ",
|
||||||
count, T1-T0, perpix);
|
count, T1-T0, perpix);
|
||||||
|
|
||||||
@ -79,7 +81,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
fprintf(stderr, "******** %s is running *********\n", argv[0]);
|
fprintf(stderr, "*********** %s ************\n", argv[0]);
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
fprintf(stderr, "argument: %s\n", argv[1]);
|
fprintf(stderr, "argument: %s\n", argv[1]);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
http://la.buvette.org/devel/libimage/
|
http://la.buvette.org/devel/libimage/
|
||||||
*/
|
*/
|
||||||
#ifndef IMAGE_VERSION_STRING
|
#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_B_pixel(Image_Desc *img, int x, int y);
|
||||||
int Image_A_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_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);
|
int Image_compare_desc(Image_Desc *a, Image_Desc *b);
|
||||||
|
|
||||||
|
/*::------------------------------------------------------------------::*/
|
||||||
|
/* module functions.c */
|
||||||
|
|
||||||
|
double tthi_dtime(void);
|
||||||
|
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/* module pixels.c */
|
/* module pixels.c */
|
||||||
|
Loading…
Reference in New Issue
Block a user