]> mj.ucw.cz Git - libucw.git/blobdiff - images/signature.h
xtypes: Small code cleanups.
[libucw.git] / images / signature.h
index 791acc6819ef78a49aa4f40157c31888b5dbeb01..34a6c9ad2340631c240635d7aa7469efbf563d24 100644 (file)
@@ -1,16 +1,42 @@
 #ifndef _IMAGES_SIGNATURE_H
 #define _IMAGES_SIGNATURE_H
 
+#ifdef CONFIG_UCW_CLEAN_ABI
+#define compute_image_signature ucw_compute_image_signature
+#define image_region_dump ucw_image_region_dump
+#define image_sig_border_bonus ucw_image_sig_border_bonus
+#define image_sig_border_size ucw_image_sig_border_size
+#define image_sig_cleanup ucw_image_sig_cleanup
+#define image_sig_cmp_features_weights ucw_image_sig_cmp_features_weights
+#define image_sig_compare_method ucw_image_sig_compare_method
+#define image_sig_detect_textured ucw_image_sig_detect_textured
+#define image_sig_finish ucw_image_sig_finish
+#define image_sig_inertia_scale ucw_image_sig_inertia_scale
+#define image_sig_init ucw_image_sig_init
+#define image_sig_min_height ucw_image_sig_min_height
+#define image_sig_min_width ucw_image_sig_min_width
+#define image_sig_postquant_max_steps ucw_image_sig_postquant_max_steps
+#define image_sig_postquant_min_steps ucw_image_sig_postquant_min_steps
+#define image_sig_postquant_threshold ucw_image_sig_postquant_threshold
+#define image_sig_preprocess ucw_image_sig_preprocess
+#define image_sig_prequant_thresholds ucw_image_sig_prequant_thresholds
+#define image_sig_segmentation ucw_image_sig_segmentation
+#define image_sig_textured_threshold ucw_image_sig_textured_threshold
+#define image_signatures_dist ucw_image_signatures_dist
+#define image_signatures_dist_explain ucw_image_signatures_dist_explain
+#define image_vector_dump ucw_image_vector_dump
+#endif
+
 /* Configuration */
-extern uns image_sig_min_width, image_sig_min_height;
-extern uns *image_sig_prequant_thresholds;
-extern uns image_sig_postquant_min_steps, image_sig_postquant_max_steps, image_sig_postquant_threshold;
+extern uint image_sig_min_width, image_sig_min_height;
+extern uint *image_sig_prequant_thresholds;
+extern uint image_sig_postquant_min_steps, image_sig_postquant_max_steps, image_sig_postquant_threshold;
 extern double image_sig_border_size;
 extern int image_sig_border_bonus;
 extern double image_sig_inertia_scale[];
 extern double image_sig_textured_threshold;
 extern int image_sig_compare_method;
-extern uns image_sig_cmp_features_weights[];
+extern uint image_sig_cmp_features_weights[];
 
 #define IMAGE_VEC_F    6
 #define IMAGE_REG_F    IMAGE_VEC_F
@@ -22,43 +48,41 @@ struct image_vector {
   byte f[IMAGE_VEC_F];         /* texture features */
 } PACKED;
 
-/* Fetures for image regions (16 bytes) */
+/* Features for image regions (16 bytes) */
 struct image_region {
   byte f[IMAGE_VEC_F];         /* texture features - L, u, v, LH, HL, HH */
   byte h[IMAGE_REG_H];         /* shape/pos features - I1, I2, I3, X, Y */
   byte wa;                     /* normalized area percentage */
   byte wb;                     /* normalized weight */
-  byte reserved[3];
-} PACKED;
+};
 
 #define IMAGE_SIG_TEXTURED     0x1
 
-/* Image signature (16 + len * 16 bytes) */
+/* Image signature (usually 16 + len * 16 bytes) */
 struct image_signature {
-  byte len;                    /* Number of regions */
+  byte len;                    /* number of regions */
   byte flags;                  /* IMAGE_SIG_xxx */
-  u16 cols;                    /* Image width */
-  u16 rows;                    /* Image height */
-  u16 df;                      /* Average weighted f dist */
-  u16 dh;                      /* Average weighted h dist */
-  struct image_vector vec;     /* Average features of all regions... simple signature */
-  struct image_region reg[IMAGE_REG_MAX];/* Feature vector for every region */
-} PACKED;
+  u16 cols;                    /* image width */
+  u16 rows;                    /* image height */
+  u16 df;                      /* average weighted f dist */
+  u16 dh;                      /* average weighted h dist */
+  struct image_vector vec;     /* average features of all regions... simple signature */
+  struct image_region reg[IMAGE_REG_MAX];/* feature vector for every region */
+};
 
 struct image_cluster {
   union {
     struct {
-      s32 dot;                 /* Dot product of the splitting plane */
-      s8 vec[IMAGE_VEC_F];     /* Normal vector of the splitting plane */
-    } PACKED;
+      s32 dot;                 /* dot product of the splitting plane */
+      s8 vec[IMAGE_VEC_F];     /* normal vector of the splitting plane */
+    };
     struct {
-      u64 pos;                 /* Cluster size in bytes */
-    } PACKED;
-  } PACKED;
-} PACKED;
+      u64 pos;                 /* cluster size in bytes */
+    };
+  };
+};
 
-static inline uns
-image_signature_size(uns len)
+static inline uint image_signature_size(uint len)
 {
   return OFFSETOF(struct image_signature, reg) + len * sizeof(struct image_region);
 }
@@ -124,8 +148,8 @@ void image_sig_detect_textured(struct image_sig_data *data);
 
 /* sig-cmp.c */
 
-uns image_signatures_dist(struct image_signature *sig1, struct image_signature *sig2);
-uns image_signatures_dist_explain(struct image_signature *sig1, struct image_signature *sig2, void (*msg)(byte *text, void *param), void *param);
+uint image_signatures_dist(struct image_signature *sig1, struct image_signature *sig2);
+uint image_signatures_dist_explain(struct image_signature *sig1, struct image_signature *sig2, void (*msg)(byte *text, void *param), void *param);
 
 #endif