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