libtthimage/Lib/foo.c

78 lines
1.3 KiB
C
Raw Normal View History

2022-06-26 02:23:53 +02:00
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
2023-09-17 22:36:08 +02:00
#include <math.h>
2022-06-26 02:23:53 +02:00
2022-06-26 22:55:56 +02:00
#include "../tthimage.h"
2022-06-26 02:23:53 +02:00
/* ============================== */
2023-11-14 13:06:02 +01:00
2024-08-15 12:08:37 +02:00
/* 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)
2023-11-14 13:06:02 +01:00
{
2024-08-15 12:08:37 +02:00
Image_Desc *alice, *bob;
int x, y;
double T0, T1;
long count;
2023-11-14 13:06:02 +01:00
2024-08-15 12:08:37 +02:00
alice = Image_alloc(SZPIC, SZPIC, IMAGE_RGB);
bob = Image_alloc(SZPIC, SZPIC, IMAGE_RGB);
2023-11-14 13:06:02 +01:00
2024-08-15 12:08:37 +02:00
T0 = tthi_dtime();
count = 0L;
for (y=0; y<SZPIC; y++) {
for (x=0; x<SZPIC; x++) {
2023-11-14 13:06:02 +01:00
2024-08-15 12:08:37 +02:00
Image_pixel_copy(alice, x, y, bob, x, y);
count++;
2023-11-14 13:06:02 +01:00
2024-08-15 12:08:37 +02:00
}
}
2023-09-17 22:36:08 +02:00
2024-08-15 12:08:37 +02:00
T1 = tthi_dtime();
2023-09-18 08:46:13 +02:00
2024-08-15 12:08:37 +02:00
fprintf(stderr, "count %ld, elapsed %g\n", count, T1-T0);
2023-09-18 08:46:13 +02:00
2024-08-15 12:08:37 +02:00
/* end */
2023-09-17 22:36:08 +02:00
}
2024-08-15 12:08:37 +02:00
/* ============================== */
2022-06-26 02:23:53 +02:00
int main(int argc, char *argv[])
{
2023-09-28 23:50:23 +02:00
fprintf(stderr, "*** %s is running\n", argv[0]);
2023-11-14 13:06:02 +01:00
if (argc > 1) {
fprintf(stderr, "argument: %s\n", argv[1]);
2024-08-15 12:08:37 +02:00
Image_print_version(2);
2023-11-14 13:06:02 +01:00
Image_print_sizeof_structs("foo");
}
else {
2024-08-15 12:08:37 +02:00
essai_pixcopy();
2023-11-14 13:06:02 +01:00
}
2022-06-26 22:55:56 +02:00
2023-11-14 13:06:02 +01:00
/*
2022-10-28 05:54:07 +02:00
foo = essai_show_t16x24(NULL);
fprintf(stderr, "essai show t16x24 --> %d\n", foo);
2023-11-14 13:06:02 +01:00
*/
2023-09-17 22:36:08 +02:00
2022-06-26 02:23:53 +02:00
return 0;
}