Compare commits

..

No commits in common. "ddfadf9a674212d8fb1d02a76347aece402b8172" and "a5fac7effd54613fb8edb38db63663e0716a20a3" have entirely different histories.

7 changed files with 18 additions and 42 deletions

View File

@ -3,8 +3,8 @@
# a look to the 'build.sh' script ! # # a look to the 'build.sh' script ! #
#################################################### ####################################################
COPT = -Wall -Wextra -fpic -g -no-pie -DDEBUG_LEVEL=0 COPT = -Wall -Wextra -fpic -g -pg -no-pie -DDEBUG_LEVEL=0
LDOPT = libfloatimg.a -g -lm LDOPT = libfloatimg.a -pg -lm
all: essai all: essai

View File

@ -22,7 +22,7 @@ fimg_draw_something(dessin);
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
void help(void) void help(int k)
{ {
puts("Options :"); puts("Options :");
puts("\t-d WxH\timage size"); puts("\t-d WxH\timage size");
@ -34,14 +34,14 @@ int main(int argc, char *argv[])
{ {
FloatImg fimgA, fimgB; FloatImg fimgA, fimgB;
int foo, opt; int foo, opt;
int W = 640, H = 480; int W = 800, H = 600;
double tb; double tb;
while ((opt = getopt(argc, argv, "d:hv")) != -1) { while ((opt = getopt(argc, argv, "d:hv")) != -1) {
switch(opt) { switch(opt) {
case 'd': parse_WxH(optarg, &W, &H); case 'd': parse_WxH(optarg, &W, &H);
break; break;
case 'h': help(); break; case 'h': help(0); break;
case 'v': verbosity++; break; case 'v': verbosity++; break;
} }
} }

View File

@ -4,8 +4,8 @@
* http://la.buvette.org/photos/cumul * http://la.buvette.org/photos/cumul
*/ */
#define FIMG_VERSION (181) #define FIMG_VERSION 179
#define RELEASE_NAME ("noname")
/* /*
* in memory descriptor * in memory descriptor
*/ */
@ -25,17 +25,16 @@ typedef struct {
* fimg file header (short version) * fimg file header (short version)
*/ */
typedef struct { typedef struct {
char magic[8]; // this is not an asciiz ! char magic[8];
int32_t w, h, t; int32_t w, h, t;
} FimgFileHead; } FimgFileHead;
/* /*
* new 11 mars 2022, and a lot of iterations * new 11 mars 2022
* around the concept of metadata for my work.
*/ */
typedef struct { typedef struct {
char magic[8]; // this is not an asciiz ! char magic[8];
struct timeval timestamp; struct timeval timestamp;
uint64_t pid; // process id of the creator uint64_t pid; // WTF ?
int32_t count; int32_t count;
float fval; float fval;
char idcam[32]; char idcam[32];

View File

@ -8,7 +8,6 @@ cp tools/mkfimg tools/fimg2pnm tools/fimgops \
tools/png2fimg tools/fimgstats tools/fimgfx \ tools/png2fimg tools/fimgstats tools/fimgfx \
tools/cumulfimgs tools/fimg2text \ tools/cumulfimgs tools/fimg2text \
tools/fimghalfsize \ tools/fimghalfsize \
tools/fimgmetadata \
/usr/local/bin /usr/local/bin
cp v4l2/grabvidseq v4l2/video-infos \ cp v4l2/grabvidseq v4l2/video-infos \

View File

@ -39,8 +39,8 @@ return "???";
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int fimg_print_version(int k) int fimg_print_version(int k)
{ {
fprintf(stderr, "*** FloatImg library, v%d '%s' (%s, %s)\n", fprintf(stderr, "*** FloatImg library, alpha %d (%s, %s)\n",
FIMG_VERSION, RELEASE_NAME, __DATE__, __TIME__); FIMG_VERSION, __DATE__, __TIME__);
if (51 == k) { if (51 == k) {
puts("+------------------------+"); puts("+------------------------+");

View File

@ -6,8 +6,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <unistd.h> #include <unistd.h>
#include <sys/time.h> #include "string.h"
#include <string.h>
#include "../floatimg.h" #include "../floatimg.h"
@ -30,7 +29,6 @@ fflush(fp);
int fimg_show_metadata(FimgMetaData *pmd, char *title, int notused) int fimg_show_metadata(FimgMetaData *pmd, char *title, int notused)
{ {
int foo; int foo;
double doubletime;
fprintf(stderr, ">>> %s ( %p '%s' 0x%08x )\n", __func__, fprintf(stderr, ">>> %s ( %p '%s' 0x%08x )\n", __func__,
pmd, title, notused); pmd, title, notused);
@ -42,10 +40,6 @@ if (verbosity) {
} }
/* SHOW TIMESTAMP HERE */ /* SHOW TIMESTAMP HERE */
fprintf(stderr, "seconds sc. epoch = %ld\n", pmd->timestamp.tv_sec);
doubletime = (double)pmd->timestamp.tv_sec + \
(double)pmd->timestamp.tv_usec / 1e6;
fprintf(stderr, "dtime of day = %e\n", doubletime);
fprintf(stderr, "creator pid = %ld\n", pmd->pid); fprintf(stderr, "creator pid = %ld\n", pmd->pid);
fprintf(stderr, "counter = %d\n", pmd->count); fprintf(stderr, "counter = %d\n", pmd->count);
fprintf(stderr, "float value = %.3f\n", pmd->fval); fprintf(stderr, "float value = %.3f\n", pmd->fval);
@ -63,25 +57,10 @@ return 0;
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
int fimg_default_metadata(FimgMetaData *pmd) int fimg_default_metadata(FimgMetaData *pmd)
{ {
int foo;
struct timeval tvl;
memset(pmd, 0, sizeof(FimgMetaData)); memset(pmd, 0, sizeof(FimgMetaData));
memcpy(pmd->magic, "metadata", 8); memcpy(pmd->magic, "metadata", 8);
/* set timestamp here ? */ /* set timestamp here ? */
/* CHALLENGE ACCEPTED */
memset(&tvl, 0, sizeof(struct timeval));
foo = gettimeofday(&tvl, NULL);
if (foo) {
/* error on get time of day ? */
perror("omg");
}
else {
fprintf(stderr, "Time of day %12ld %12ld\n", tvl.tv_sec, tvl.tv_usec);
memcpy(&(pmd->timestamp), &tvl, sizeof(struct timeval));
}
pmd->pid = getpid(); pmd->pid = getpid();
pmd->count = 0; pmd->count = 0;
pmd->fval = 255.0; pmd->fval = 255.0;

View File

@ -23,7 +23,6 @@ int verbosity;
#define T_TPAT0 6 #define T_TPAT0 6
#define T_MIRCOL1 7 #define T_MIRCOL1 7
#define T_BLOUP 8 #define T_BLOUP 8
#define T_STRIPES 9
typedef struct { typedef struct {
int code; int code;
char *name; char *name;
@ -39,7 +38,6 @@ Type types[] = {
{ T_TPAT0, "tpat0" }, { T_TPAT0, "tpat0" },
{ T_MIRCOL1, "mircol1" }, { T_MIRCOL1, "mircol1" },
{ T_BLOUP, "bloup" }, { T_BLOUP, "bloup" },
{ T_STRIPES, "stripes" },
{ 0, NULL } { 0, NULL }
}; };
@ -56,6 +54,7 @@ for (type = types; type->code; type++) {
return type->code; return type->code;
} }
} }
return -1; return -1;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
@ -88,7 +87,7 @@ puts("\n\t-v\tincrease verbosity");
if (verbosity) { if (verbosity) {
fimg_print_version(1); fimg_print_version(1);
printf("*** compiled on the %s, at %s\n", __DATE__, __TIME__); printf("*** compiled %s, %s\n", __DATE__, __TIME__);
} }
exit(0); exit(0);
@ -191,7 +190,7 @@ else {
foo = fimg_dump_to_file(&fimg, fname, 0); foo = fimg_dump_to_file(&fimg, fname, 0);
} }
if (foo) { if (foo) {
fprintf(stderr, "dump fimg to %s error -> %d\n", fname, foo); fprintf(stderr, "dump fimg to %s -> %d\n", fname, foo);
exit(1); exit(1);
} }