]> mj.ucw.cz Git - libucw.git/blob - images/config.c
tableprinter: update of user-defined column types
[libucw.git] / images / config.c
1 /*
2  *      Image Library -- Configuration
3  *
4  *      (c) 2006 Pavel Charvat <pchar@ucw.cz>
5  */
6
7 #undef LOCAL_DEBUG
8
9 #include <ucw/lib.h>
10 #include <ucw/conf.h>
11 #include <images/images.h>
12 #include <images/error.h>
13 #if defined(CONFIG_IMAGES_SIM) || defined(CONFIG_IMAGES_DUP)
14 #include <images/signature.h>
15 #endif
16
17 #include <string.h>
18
19 /* ImageLib section */
20 uint image_trace;
21 uint image_max_dim = 0xffff;
22 uint image_max_bytes = ~0U;
23
24 #if defined(CONFIG_IMAGES_SIM) || defined(CONFIG_IMAGES_DUP)
25 /* ImageSig section */
26 uint image_sig_min_width;
27 uint image_sig_min_height;
28 uint *image_sig_prequant_thresholds;
29 uint image_sig_postquant_min_steps;
30 uint image_sig_postquant_max_steps;
31 uint image_sig_postquant_threshold;
32 double image_sig_border_size;
33 int image_sig_border_bonus;
34 double image_sig_inertia_scale[3];
35 double image_sig_textured_threshold;
36 int image_sig_compare_method;
37 uint image_sig_cmp_features_weights[IMAGE_REG_F + IMAGE_REG_H];
38 #endif
39
40 static struct cf_section image_lib_config = {
41   CF_ITEMS{
42     CF_UINT("Trace", &image_trace),
43     CF_UINT("ImageMaxDim", &image_max_dim),
44     CF_UINT("ImageMaxBytes", &image_max_bytes),
45     CF_END
46   }
47 };
48
49 #if defined(CONFIG_IMAGES_SIM) || defined(CONFIG_IMAGES_DUP)
50 static struct cf_section image_sig_config = {
51   CF_ITEMS{
52     CF_UINT("MinWidth", &image_sig_min_width),
53     CF_UINT("MinHeight", &image_sig_min_height),
54     CF_UINT_DYN("PreQuantThresholds", &image_sig_prequant_thresholds, CF_ANY_NUM),
55     CF_UINT("PostQuantMinSteps", &image_sig_postquant_min_steps),
56     CF_UINT("PostQuantMaxSteps", &image_sig_postquant_max_steps),
57     CF_UINT("PostQuantThreshold", &image_sig_postquant_threshold),
58     CF_DOUBLE("BorderSize", &image_sig_border_size),
59     CF_INT("BorderBonus", &image_sig_border_bonus),
60     CF_DOUBLE_ARY("InertiaScale", image_sig_inertia_scale, 3),
61     CF_DOUBLE("TexturedThreshold", &image_sig_textured_threshold),
62     CF_LOOKUP("CompareMethod", &image_sig_compare_method, ((const char * const []){"integrated", "fuzzy", "average", NULL})),
63     CF_UINT_ARY("CompareFeaturesWeights", image_sig_cmp_features_weights, IMAGE_REG_F + IMAGE_REG_H),
64     CF_END
65   }
66 };
67 #endif
68
69 static void CONSTRUCTOR
70 images_init_config(void)
71 {
72   cf_declare_section("ImageLib", &image_lib_config, 0);
73 #if defined(CONFIG_IMAGES_SIM) || defined(CONFIG_IMAGES_DUP)
74   cf_declare_section("ImageSig", &image_sig_config, 0);
75 #endif
76 }