added "tthi_dtime" profiling helper
This commit is contained in:
parent
a01eebd240
commit
8a163578ad
|
@ -64,6 +64,7 @@ extractbits.o: extractbits.c $(DEPS)
|
|||
filtadapt.o: filtadapt.c $(DEPS)
|
||||
filtres.o: filtres.c $(DEPS)
|
||||
falsecolors.o: falsecolors.c $(DEPS)
|
||||
functions.o: functions.c $(DEPS) # new Aug 15, 2024
|
||||
|
||||
gadgrect.o: gadgrect.c $(DEPS)
|
||||
glitch.o: glitch.c $(DEPS)
|
||||
|
@ -153,6 +154,7 @@ OBJECTS = 7seg.o \
|
|||
doublesz.o drawalpha.o drawing.o drawpatt.o \
|
||||
effects.o effects2.o effects3.o extractbits.o \
|
||||
filtadapt.o filtres.o falsecolors.o \
|
||||
functions.o \
|
||||
gadgrect.o glitch.o gradient.o \
|
||||
halfsize.o \
|
||||
image.o imprime.o \
|
||||
|
|
71
Lib/foo.c
71
Lib/foo.c
|
@ -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;
|
||||
RGB_map luts;
|
||||
Image_Desc *alice, *bob;
|
||||
int x, y;
|
||||
double T0, T1;
|
||||
long count;
|
||||
|
||||
foo = Image_gen_fc_lut(27e3, 33, &luts);
|
||||
fprintf(stderr, "retour gen_fc_lut = %d\n", foo);
|
||||
alice = Image_alloc(SZPIC, SZPIC, IMAGE_RGB);
|
||||
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[])
|
||||
{
|
||||
|
||||
|
@ -50,11 +61,11 @@ fprintf(stderr, "*** %s is running\n", argv[0]);
|
|||
|
||||
if (argc > 1) {
|
||||
fprintf(stderr, "argument: %s\n", argv[1]);
|
||||
Image_print_version(0);
|
||||
Image_print_version(2);
|
||||
Image_print_sizeof_structs("foo");
|
||||
}
|
||||
else {
|
||||
essai_false_colors();
|
||||
essai_pixcopy();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
/* ------------------------------------------------------------------- */
|
||||
/* ------------------------------------------------------------------- */
|
Loading…
Reference in New Issue