added "tthi_dtime" profiling helper

This commit is contained in:
tTh 2024-08-15 12:08:37 +02:00
parent a01eebd240
commit 8a163578ad
3 changed files with 70 additions and 30 deletions

View File

@ -64,6 +64,7 @@ extractbits.o: extractbits.c $(DEPS)
filtadapt.o: filtadapt.c $(DEPS) filtadapt.o: filtadapt.c $(DEPS)
filtres.o: filtres.c $(DEPS) filtres.o: filtres.c $(DEPS)
falsecolors.o: falsecolors.c $(DEPS) falsecolors.o: falsecolors.c $(DEPS)
functions.o: functions.c $(DEPS) # new Aug 15, 2024
gadgrect.o: gadgrect.c $(DEPS) gadgrect.o: gadgrect.c $(DEPS)
glitch.o: glitch.c $(DEPS) glitch.o: glitch.c $(DEPS)
@ -153,6 +154,7 @@ OBJECTS = 7seg.o \
doublesz.o drawalpha.o drawing.o drawpatt.o \ doublesz.o drawalpha.o drawing.o drawpatt.o \
effects.o effects2.o effects3.o extractbits.o \ effects.o effects2.o effects3.o extractbits.o \
filtadapt.o filtres.o falsecolors.o \ filtadapt.o filtres.o falsecolors.o \
functions.o \
gadgrect.o glitch.o gradient.o \ gadgrect.o glitch.o gradient.o \
halfsize.o \ halfsize.o \
image.o imprime.o \ image.o imprime.o \

View File

@ -8,41 +8,52 @@
/* ============================== */ /* ============================== */
int essai_false_colors(void) /* new Wed Aug 14 19:17:20 UTC 2024
*
* parameters :
* ip: Image_Desc * of input picture
* ix, iy: coordinate of the pixel in this pic.
* op, ox, oy : same things for output picture
*/
#define PIXEL_COPY(ip, ix, iy, op, ox, oy) \
do { \
\
} while (0)
#define SZPIC 7777
double tthi_dtime(void);
void essai_pixcopy(void)
{ {
int foo; Image_Desc *alice, *bob;
RGB_map luts; int x, y;
double T0, T1;
long count;
foo = Image_gen_fc_lut(27e3, 33, &luts); alice = Image_alloc(SZPIC, SZPIC, IMAGE_RGB);
fprintf(stderr, "retour gen_fc_lut = %d\n", foo); bob = Image_alloc(SZPIC, SZPIC, IMAGE_RGB);
return -1; T0 = tthi_dtime();
count = 0L;
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();
fprintf(stderr, "count %ld, elapsed %g\n", count, T1-T0);
/* end */
} }
/* ============================== */ /* ============================== */
int essai_show_t16x24( char *text)
{
if (NULL != text)
Image_t16x24_essai("16x24thin", text, "16x24.tga");
else
Image_t16x24_essai("16x24gruik", "0123456789abcdef", "16x24.tga");
return 0;
}
/* ============================== */
void essai_gradients(void)
{
int foo;
foo = Image_plot_H_gradient("foo.tga", 640, 200);
fprintf(stderr, "plot h gradient -> %d\n", foo);
foo = Image_plot_V_gradient("foo.tga", 900, 200);
fprintf(stderr, "plot v gradient -> %d\n", foo);
}
/* ============================== */
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
@ -50,11 +61,11 @@ 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]);
Image_print_version(0); Image_print_version(2);
Image_print_sizeof_structs("foo"); Image_print_sizeof_structs("foo");
} }
else { else {
essai_false_colors(); essai_pixcopy();
} }
/* /*

27
Lib/functions.c Normal file
View File

@ -0,0 +1,27 @@
/*
* miscellaneous functions
* -----------------------
*
* new: Thu Aug 15 09:55:36 UTC 2024
*
*/
#include <stdio.h>
#include <sys/time.h>
#include "../tthimage.h"
/* ------------------------------------------------------------------- */
/*
* for what FSCKING reason, this func is not in the stdlib ???
*/
double tthi_dtime(void)
{
struct timeval t;
double d;
(void)gettimeofday(&t, NULL);
d = (double)t.tv_sec + (double)t.tv_usec / 1e6;
return d;
}
/* ------------------------------------------------------------------- */
/* ------------------------------------------------------------------- */