2020-11-15 21:31:02 +01:00
|
|
|
/*
|
|
|
|
* test des trucs
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2020-11-16 11:12:29 +01:00
|
|
|
#include <unistd.h>
|
2020-11-15 21:31:02 +01:00
|
|
|
|
|
|
|
#include "../floatimg.h"
|
|
|
|
#include "glitches.h"
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
|
|
|
|
int verbosity;
|
|
|
|
|
|
|
|
#define PNG "out.png"
|
2020-11-25 14:38:39 +01:00
|
|
|
#define W 512
|
|
|
|
#define H 512
|
2020-11-15 21:31:02 +01:00
|
|
|
#define LMAX 233.333
|
|
|
|
#define TIMER 1
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int foo, iter, xloc, bloub;
|
|
|
|
FloatImg image;
|
|
|
|
char buff[1000];
|
|
|
|
double debut, fin;
|
|
|
|
float omega;
|
2020-11-25 14:38:39 +01:00
|
|
|
|
|
|
|
verbosity = 2;
|
2020-11-15 21:31:02 +01:00
|
|
|
|
|
|
|
fimg_print_version(1);
|
|
|
|
|
|
|
|
foo = fimg_create(&image, W, H, FIMG_TYPE_RGB);
|
|
|
|
if (foo) {
|
|
|
|
fprintf(stderr, "err %d create image\n", foo);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2020-11-25 14:38:39 +01:00
|
|
|
fimg_printhead(&image);
|
|
|
|
|
2020-11-16 11:12:29 +01:00
|
|
|
srand(getpid());
|
2020-11-15 21:31:02 +01:00
|
|
|
debut = fimg_timer_set(TIMER);
|
|
|
|
|
2020-11-25 14:38:39 +01:00
|
|
|
for (iter=0; iter<127; iter++) {
|
2020-11-15 21:31:02 +01:00
|
|
|
|
2020-11-16 11:12:29 +01:00
|
|
|
fimg_vdeg_a(&image, LMAX);
|
|
|
|
|
|
|
|
for (bloub=0; bloub<7; bloub++) {
|
2020-11-15 21:31:02 +01:00
|
|
|
xloc = rand() % W;
|
2020-11-16 11:12:29 +01:00
|
|
|
omega = (float)(0.1 + drand48()*0.6) * 0.4;
|
2020-11-15 21:31:02 +01:00
|
|
|
foo = vertical_singlitch(&image, xloc, LMAX,
|
|
|
|
omega, (float)iter);
|
|
|
|
if (foo) abort();
|
|
|
|
}
|
|
|
|
|
2020-11-20 19:06:08 +01:00
|
|
|
sprintf(buff, "/tmp/out%03d.png", iter);
|
2020-11-15 21:31:02 +01:00
|
|
|
foo = fimg_save_as_png(&image, buff, 0);
|
|
|
|
if (foo) {
|
|
|
|
fprintf(stderr, "err %d saving to '%s'\n", foo, PNG);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fin = fimg_timer_set(TIMER);
|
|
|
|
fprintf(stderr, "elapsed %f\n", fin-debut);
|
|
|
|
|
2020-11-25 14:38:39 +01:00
|
|
|
fimg_destroy(&image);
|
|
|
|
|
2020-11-15 21:31:02 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|