diff options
author | Chris Xiong <chirs241097@gmail.com> | 2020-04-06 00:50:58 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2020-04-06 00:50:58 +0800 |
commit | ed47c1557915bb2472f6959e723cd76155312a98 (patch) | |
tree | 85bc451630ebaa4f5ffce3043b4cbf948a912a66 /deduper/libpuzzle/src/tunables.c | |
parent | 0a094f28c2e2ebfaac91398ae62e40f00f09221b (diff) | |
download | oddities-ed47c1557915bb2472f6959e723cd76155312a98.tar.xz |
Add deduper (unfinished tool for finding image duplicates).
Diffstat (limited to 'deduper/libpuzzle/src/tunables.c')
-rw-r--r-- | deduper/libpuzzle/src/tunables.c | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/deduper/libpuzzle/src/tunables.c b/deduper/libpuzzle/src/tunables.c new file mode 100644 index 0000000..280dfb2 --- /dev/null +++ b/deduper/libpuzzle/src/tunables.c @@ -0,0 +1,84 @@ +#include "puzzle_common.h" +#include "puzzle_p.h" +#include "puzzle.h" +#include "globals.h" + +int puzzle_set_max_width(PuzzleContext * const context, + const unsigned int width) +{ + if (width <= 0U) { + return -1; + } + context->puzzle_max_width = width; + + return 0; +} + +int puzzle_set_max_height(PuzzleContext * const context, + const unsigned int height) +{ + if (height <= 0U) { + return -1; + } + context->puzzle_max_height = height; + + return 0; +} + +int puzzle_set_lambdas(PuzzleContext * const context, + const unsigned int lambdas) +{ + if (lambdas <= 0U) { + return -1; + } + context->puzzle_lambdas = lambdas; + + return 0; +} + +int puzzle_set_p_ratio(PuzzleContext * const context, const double p_ratio) +{ + if (p_ratio < 1.0) { + return -1; + } + context->puzzle_p_ratio = p_ratio; + + return 0; +} + +int puzzle_set_noise_cutoff(PuzzleContext * const context, + const double noise_cutoff) +{ + context->puzzle_noise_cutoff = noise_cutoff; + + return 0; +} + +int puzzle_set_contrast_barrier_for_cropping(PuzzleContext * const context, + const double barrier) +{ + if (barrier <= 0.0) { + return -1; + } + context->puzzle_contrast_barrier_for_cropping = barrier; + + return 0; +} + +int puzzle_set_max_cropping_ratio(PuzzleContext * const context, + const double ratio) +{ + if (ratio <= 0.0) { + return -1; + } + context->puzzle_max_cropping_ratio = ratio; + + return 0; +} + +int puzzle_set_autocrop(PuzzleContext * const context, const int enable) +{ + context->puzzle_enable_autocrop = (enable != 0); + + return 0; +} |