From e96c940baafd1ff4c521e9ebe280d5ee7b3ada09 Mon Sep 17 00:00:00 2001 From: tth Date: Tue, 12 Nov 2019 13:57:32 +0100 Subject: [PATCH] no milestone here --- floatimg.h | 7 ++++++- lib/fimg-core.c | 33 ++++++++++++++++++++++++++++++++- lib/t.c | 6 +----- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/floatimg.h b/floatimg.h index c2da9b72..9a50ebc7 100644 --- a/floatimg.h +++ b/floatimg.h @@ -2,7 +2,7 @@ * floatimg.h */ -#define FIMG_VERSION 74 +#define FIMG_VERSION 75 /* * in memory descriptor @@ -41,6 +41,7 @@ typedef struct { */ int fimg_create(FloatImg *fimg, int w, int h, int t); int fimg_destroy(FloatImg *fimg); +int fimg_clone(FloatImg *fimg, FloatImg *newpic, int flags); int fimg_print_version(int k); void fimg_printhead(FloatImg *h); @@ -69,6 +70,10 @@ int fimg_load_from_pnm(char *fname, FloatImg *head, int notused); double fimg_timer_set(int whot); double fimg_timer_get(int whot); +/* --> lib/contrast.c */ +int fimg_square_root(FloatImg *s, FloatImg *d, double maxval); +int fimg_power_2(FloatImg *s, FloatImg *d, double maxval); + int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k); diff --git a/lib/fimg-core.c b/lib/fimg-core.c index 40ee79ff..7571a1c4 100644 --- a/lib/fimg-core.c +++ b/lib/fimg-core.c @@ -75,7 +75,9 @@ printf(" pixels@ %p %p %p %p\n", return 0; } /* ---------------------------------------------------------------- */ - +/* + * + */ int fimg_create(FloatImg *fimg, int w, int h, int t) { int surface, size; @@ -146,6 +148,35 @@ if (NULL == fimg->R) { free(fimg->R); memset(fimg, 0, sizeof(FloatImg)); +return 0; +} +/* --------------------------------------------------------------------- */ +int fimg_clone(FloatImg *old, FloatImg *new, int flags) +{ +int foo; + +#if DEBUG_LEVEL +fprintf(stderr, ">>> %-25s ( %p %p 0x%x)\n", __func__, old, new, flags); +#endif + +if ( ! fimg_type_is_valid(old->type) ) { + fprintf(stderr, "invalid type %d in %s\n", old->type, __func__); + return -2; + } + +memset(new, 0, sizeof(FloatImg)); + +foo = fimg_create(new, old->width, old->height, old->type); +if (foo) { + fprintf(stderr, "error %d in %s\n", foo, __func__); + return -3; + } + +if (flag & 0x01) { + /* XXX copy all the pixels's datas */ + + } + return 0; } /* --------------------------------------------------------------------- */ diff --git a/lib/t.c b/lib/t.c index 6534d76f..6c41ab0b 100644 --- a/lib/t.c +++ b/lib/t.c @@ -68,9 +68,6 @@ return 0; } /* ---------------------------------------------------------------- */ -int fimg_square_root(FloatImg *s, FloatImg *d, double maxval); -int fimg_power_2(FloatImg *s, FloatImg *d, double maxval); - int essai_contraste(char *fname) { int foo; @@ -113,7 +110,6 @@ while ((opt = getopt(argc, argv, "gn:v")) != -1) { if (verbosity) fimg_print_version(0); foo = essai_contraste("src.fimg"); - - +fprintf(stderr, "retour essai contraste -> %d\n", return 0; }