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