From ca4bfcff05364c51a37956d4442ebc372880da85 Mon Sep 17 00:00:00 2001 From: tth Date: Mon, 18 Nov 2019 10:18:30 +0100 Subject: [PATCH] moving a function to a better place --- floatimg.h | 1 + lib/contrast.c | 11 +++++++++++ lib/runme.sh | 2 +- v4l2/grabvidseq.c | 13 ++----------- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/floatimg.h b/floatimg.h index 1ea3872..da2903a 100644 --- a/floatimg.h +++ b/floatimg.h @@ -77,6 +77,7 @@ double fimg_timer_set(int whot); double fimg_timer_get(int whot); /* --> lib/contrast.c */ +int fimg_id_contraste(char *name); int fimg_square_root(FloatImg *s, FloatImg *d, double maxval); int fimg_power_2(FloatImg *s, FloatImg *d, double maxval); int fimg_cos_01(FloatImg *s, FloatImg *d, double maxval); diff --git a/lib/contrast.c b/lib/contrast.c index 2232389..1cf0c0e 100644 --- a/lib/contrast.c +++ b/lib/contrast.c @@ -12,6 +12,17 @@ extern int verbosity; +/* ---------------------------------------------------------------- */ +int fimg_id_contraste(char *str) +{ + +if (!strcmp(str, "none")) return CONTRAST_NONE; +if (!strcmp(str, "sqrt")) return CONTRAST_SQRT; +if (!strcmp(str, "pow2")) return CONTRAST_POW2; +if (!strcmp(str, "cos01")) return CONTRAST_COS01; + +return -1; +} /* ---------------------------------------------------------------- */ /* * if the second parameter is NULL, operate 'in-place' diff --git a/lib/runme.sh b/lib/runme.sh index 35f07cc..d38a4d3 100755 --- a/lib/runme.sh +++ b/lib/runme.sh @@ -1,7 +1,7 @@ #!/bin/bash -../v4l2/grabvidseq -s 960x720 -n 10000 -p 0.078 \ +../v4l2/grabvidseq -s 960x720 -n 10000 -p 0.193 \ -vv -g -c none \ -o original.fimg diff --git a/v4l2/grabvidseq.c b/v4l2/grabvidseq.c index c69632c..41c9a64 100644 --- a/v4l2/grabvidseq.c +++ b/v4l2/grabvidseq.c @@ -64,16 +64,6 @@ if (r == -1) { } } /* --------------------------------------------------------------------- */ -int contraste(char *str) -{ - -if (!strcmp(str, "sqrt")) return CONTRAST_SQRT; -if (!strcmp(str, "pow2")) return CONTRAST_POW2; -if (!strcmp(str, "cos01")) return CONTRAST_COS01; - -return -1; -} -/* --------------------------------------------------------------------- */ void help(int v) { if (verbosity) { @@ -128,7 +118,8 @@ FloatImg cumul; while ((opt = getopt(argc, argv, "c:d:ghn:o:O:p:s:uv")) != -1) { switch(opt) { - case 'c': contrast = contraste(optarg); break; + case 'c': contrast = fimg_id_contraste(optarg); + break; case 'd': dev_name = optarg; break; case 'g': to_gray = 1; break; case 'h': help(0); break;