]> mj.ucw.cz Git - libucw.git/blobdiff - images/config.c
Opt: Constify
[libucw.git] / images / config.c
index 3d9a326a4a1d1e44979f74e87c03f4bca9e0299f..286097e8880185108a3b885939eba1cbad35b88c 100644 (file)
@@ -6,44 +6,71 @@
 
 #undef LOCAL_DEBUG
 
-#include "lib/lib.h"
-#include "lib/conf.h"
-#include "images/images.h"
-#include "images/signature.h"
+#include <ucw/lib.h>
+#include <ucw/conf.h>
+#include <images/images.h>
+#include <images/error.h>
+#if defined(CONFIG_IMAGES_SIM) || defined(CONFIG_IMAGES_DUP)
+#include <images/signature.h>
+#endif
 
 #include <string.h>
 
-uns image_sig_min_width;
-uns image_sig_min_height;
-uns *image_sig_prequant_thresholds;
-uns image_sig_postquant_min_steps;
-uns image_sig_postquant_max_steps;
-uns image_sig_postquant_threshold;
+/* ImageLib section */
+uint image_trace;
+uint image_max_dim = 0xffff;
+uint image_max_bytes = ~0U;
+
+#if defined(CONFIG_IMAGES_SIM) || defined(CONFIG_IMAGES_DUP)
+/* ImageSig section */
+uint image_sig_min_width;
+uint image_sig_min_height;
+uint *image_sig_prequant_thresholds;
+uint image_sig_postquant_min_steps;
+uint image_sig_postquant_max_steps;
+uint image_sig_postquant_threshold;
 double image_sig_border_size;
 int image_sig_border_bonus;
+double image_sig_inertia_scale[3];
 double image_sig_textured_threshold;
 int image_sig_compare_method;
-uns image_sig_cmp_features_weights[IMAGE_VEC_F + IMAGE_REG_H];
+uint image_sig_cmp_features_weights[IMAGE_REG_F + IMAGE_REG_H];
+#endif
+
+static struct cf_section image_lib_config = {
+  CF_ITEMS{
+    CF_UINT("Trace", &image_trace),
+    CF_UINT("ImageMaxDim", &image_max_dim),
+    CF_UINT("ImageMaxBytes", &image_max_bytes),
+    CF_END
+  }
+};
 
-static struct cf_section sig_config = {
+#if defined(CONFIG_IMAGES_SIM) || defined(CONFIG_IMAGES_DUP)
+static struct cf_section image_sig_config = {
   CF_ITEMS{
-    CF_UNS("MinWidth", &image_sig_min_width),
-    CF_UNS("MinHeight", &image_sig_min_height),
-    CF_UNS_DYN("PreQuantThresholds", &image_sig_prequant_thresholds, CF_ANY_NUM),
-    CF_UNS("PostQuantMinSteps", &image_sig_postquant_min_steps),
-    CF_UNS("PostQuantMaxSteps", &image_sig_postquant_max_steps),
-    CF_UNS("PostQuantThreshold", &image_sig_postquant_threshold),
+    CF_UINT("MinWidth", &image_sig_min_width),
+    CF_UINT("MinHeight", &image_sig_min_height),
+    CF_UINT_DYN("PreQuantThresholds", &image_sig_prequant_thresholds, CF_ANY_NUM),
+    CF_UINT("PostQuantMinSteps", &image_sig_postquant_min_steps),
+    CF_UINT("PostQuantMaxSteps", &image_sig_postquant_max_steps),
+    CF_UINT("PostQuantThreshold", &image_sig_postquant_threshold),
     CF_DOUBLE("BorderSize", &image_sig_border_size),
     CF_INT("BorderBonus", &image_sig_border_bonus),
+    CF_DOUBLE_ARY("InertiaScale", image_sig_inertia_scale, 3),
     CF_DOUBLE("TexturedThreshold", &image_sig_textured_threshold),
-    CF_LOOKUP("CompareMethod", &image_sig_compare_method, ((byte *[]){"intergrated", "fuzzy", NULL})),
-    CF_UNS_ARY("CompareFeaturesWeights", image_sig_cmp_features_weights, IMAGE_VEC_F + IMAGE_REG_H),
+    CF_LOOKUP("CompareMethod", &image_sig_compare_method, ((const char * const []){"integrated", "fuzzy", "average", NULL})),
+    CF_UINT_ARY("CompareFeaturesWeights", image_sig_cmp_features_weights, IMAGE_REG_F + IMAGE_REG_H),
     CF_END
   }
 };
+#endif
 
 static void CONSTRUCTOR
 images_init_config(void)
 {
-  cf_declare_section("ImageSig", &sig_config, 0);
+  cf_declare_section("ImageLib", &image_lib_config, 0);
+#if defined(CONFIG_IMAGES_SIM) || defined(CONFIG_IMAGES_DUP)
+  cf_declare_section("ImageSig", &image_sig_config, 0);
+#endif
 }