]> mj.ucw.cz Git - libucw.git/blob - images/config.c
Added a new mempool primitive mp_spread().
[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 "lib/lib.h"
10 #include "lib/conf.h"
11 #include "images/images.h"
12 #if defined(CONFIG_IMAGES_SIM) || defined(CONFIG_IMAGES_DUP)
13 #include "images/signature.h"
14 #endif
15
16 #include <string.h>
17
18 /* ImageLib section */
19 uns image_trace;
20 uns image_max_dim = 0xffff;
21 uns image_max_bytes = ~0U;
22
23 #if defined(CONFIG_IMAGES_SIM) || defined(CONFIG_IMAGES_DUP)
24 /* ImageSig section */
25 uns image_sig_min_width;
26 uns image_sig_min_height;
27 uns *image_sig_prequant_thresholds;
28 uns image_sig_postquant_min_steps;
29 uns image_sig_postquant_max_steps;
30 uns image_sig_postquant_threshold;
31 double image_sig_border_size;
32 int image_sig_border_bonus;
33 double image_sig_inertia_scale[3];
34 double image_sig_textured_threshold;
35 int image_sig_compare_method;
36 uns image_sig_cmp_features_weights[IMAGE_REG_F + IMAGE_REG_H];
37 #endif
38
39 static struct cf_section image_lib_config = {
40   CF_ITEMS{
41     CF_UNS("Trace", &image_trace),
42     CF_UNS("ImageMaxDim", &image_max_dim),
43     CF_UNS("ImageMaxBytes", &image_max_bytes),
44     CF_END
45   }
46 };
47
48 #if defined(CONFIG_IMAGES_SIM) || defined(CONFIG_IMAGES_DUP)
49 static struct cf_section image_sig_config = {
50   CF_ITEMS{
51     CF_UNS("MinWidth", &image_sig_min_width),
52     CF_UNS("MinHeight", &image_sig_min_height),
53     CF_UNS_DYN("PreQuantThresholds", &image_sig_prequant_thresholds, CF_ANY_NUM),
54     CF_UNS("PostQuantMinSteps", &image_sig_postquant_min_steps),
55     CF_UNS("PostQuantMaxSteps", &image_sig_postquant_max_steps),
56     CF_UNS("PostQuantThreshold", &image_sig_postquant_threshold),
57     CF_DOUBLE("BorderSize", &image_sig_border_size),
58     CF_INT("BorderBonus", &image_sig_border_bonus),
59     CF_DOUBLE_ARY("InertiaScale", image_sig_inertia_scale, 3),
60     CF_DOUBLE("TexturedThreshold", &image_sig_textured_threshold),
61     CF_LOOKUP("CompareMethod", &image_sig_compare_method, ((byte *[]){"integrated", "fuzzy", "average", NULL})),
62     CF_UNS_ARY("CompareFeaturesWeights", image_sig_cmp_features_weights, IMAGE_REG_F + IMAGE_REG_H),
63     CF_END
64   }
65 };
66 #endif
67
68 static void CONSTRUCTOR
69 images_init_config(void)
70 {
71   cf_declare_section("ImageLib", &image_lib_config, 0);
72 #if defined(CONFIG_IMAGES_SIM) || defined(CONFIG_IMAGES_DUP)
73   cf_declare_section("ImageSig", &image_sig_config, 0);
74 #endif
75 }