Compare commits

...

5 Commits

Author SHA1 Message Date
tth
ddfadf9a67 /say /sieste 2022-04-12 14:54:07 +02:00
tth
455428f444 cosmetic 2022-04-12 14:49:00 +02:00
tth
6810783426 add fimgmetadata 2022-04-12 14:16:00 +02:00
tth
5064126da8 remove useless parameter 2022-04-12 14:15:08 +02:00
tth
2e6bff3f67 no more profiling 2022-04-12 14:14:13 +02:00
7 changed files with 42 additions and 18 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,8 @@
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include "string.h"
#include <sys/time.h>
#include <string.h>
#include "../floatimg.h"
@ -29,6 +30,7 @@ fflush(fp);
int fimg_show_metadata(FimgMetaData *pmd, char *title, int notused)
{
int foo;
double doubletime;
fprintf(stderr, ">>> %s ( %p '%s' 0x%08x )\n", __func__,
pmd, title, notused);
@ -40,6 +42,10 @@ if (verbosity) {
}
/* 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, "counter = %d\n", pmd->count);
fprintf(stderr, "float value = %.3f\n", pmd->fval);
@ -48,7 +54,7 @@ fprintf(stderr, "origin = 0x%x\n", pmd->origin);
fputs("reserved words are:\n ", stderr);
for (foo=0; foo<8; foo++) {
fprintf(stderr, " 0x%08x", pmd->reserved[foo]);
fprintf(stderr, " 0x%08x", pmd->reserved[foo]);
if (3 == foo) fputs("\n ", stderr);
}
fputc('\n', stderr);
@ -57,10 +63,25 @@ return 0;
/* ---------------------------------------------------------------- */
int fimg_default_metadata(FimgMetaData *pmd)
{
int foo;
struct timeval tvl;
memset(pmd, 0, sizeof(FimgMetaData));
memcpy(pmd->magic, "metadata", 8);
/* 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->count = 0;
pmd->fval = 255.0;

View File

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