]> mj.ucw.cz Git - libucw.git/blob - images/duplicates.h
Merge branch 'master' into table
[libucw.git] / images / duplicates.h
1 #ifndef _IMAGES_DUPLICATES_H
2 #define _IMAGES_DUPLICATES_H
3
4 #ifdef CONFIG_UCW_CLEAN_ABI
5 #define image_dup_compare ucw_image_dup_compare
6 #define image_dup_context_cleanup ucw_image_dup_context_cleanup
7 #define image_dup_context_init ucw_image_dup_context_init
8 #define image_dup_estimate_size ucw_image_dup_estimate_size
9 #define image_dup_new ucw_image_dup_new
10 #endif
11
12 enum image_dup_flags {
13   IMAGE_DUP_TRANS_ID =          0x0001,
14   IMAGE_DUP_FLIP_X =            0x0002,
15   IMAGE_DUP_FLIP_Y =            0x0004,
16   IMAGE_DUP_ROT_180 =           0x0008,
17   IMAGE_DUP_FLIP_BACK =         0x0010,
18   IMAGE_DUP_ROT_CCW =           0x0020,
19   IMAGE_DUP_ROT_CW =            0x0040,
20   IMAGE_DUP_FLIP_SLASH =        0x0080,
21   IMAGE_DUP_TRANS_ALL =         0x00ff,
22   IMAGE_DUP_SCALE =             0x0100,
23   IMAGE_DUP_WANT_ALL =          0x0200,
24 };
25
26 struct image_dup_context {
27   struct image_context *ic;
28   uint flags;
29   uint ratio_threshold;
30   uint error_threshold;
31   uint qtree_limit;
32   u64 sum_depth;
33   u64 sum_pixels;
34   uint error;
35 };
36
37 struct image_dup {
38   struct image image;
39   byte *tab_pixels;
40   u32 tab_cols;
41   u32 tab_rows;
42   u32 tab_row_size;
43   u32 tab_size;
44 };
45
46 /* dup-init.c */
47
48 void image_dup_context_init(struct image_context *ic, struct image_dup_context *ctx);
49 void image_dup_context_cleanup(struct image_dup_context *ctx);
50
51 uint image_dup_estimate_size(uint cols, uint rows, uint same_size_compare, uint qtree_limit);
52 uint image_dup_new(struct image_dup_context *ctx, struct image *image, void *buffer, uint same_size_compare);
53
54 /* dup-cmp.c */
55
56 uint image_dup_compare(struct image_dup_context *ctx, struct image_dup *dup1, struct image_dup *dup2);
57
58 /* internals */
59
60 static inline byte *image_dup_block(struct image_dup *dup, uint tab_col, uint tab_row)
61 {
62   return dup->tab_pixels + (dup->tab_row_size << tab_row) + (3 << (tab_row + tab_col));
63 }
64
65 #endif