]> mj.ucw.cz Git - libucw.git/blob - images/duplicates.h
Packages: Several fixes in debian packages and their versioning.
[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   uns error;
27 };
28
29 struct image_dup {
30   struct image image;
31   byte *tab_pixels;
32   u32 tab_cols;
33   u32 tab_rows;
34   u32 tab_row_size;
35   u32 tab_size;
36 };
37
38 /* dup-init.c */
39
40 void image_dup_context_init(struct image_context *ic, struct image_dup_context *ctx);
41 void image_dup_context_cleanup(struct image_dup_context *ctx);
42
43 uns image_dup_estimate_size(uns cols, uns rows, uns same_size_compare, uns qtree_limit);
44 uns image_dup_new(struct image_dup_context *ctx, struct image *image, void *buffer, uns same_size_compare);
45
46 /* dup-cmp.c */
47
48 uns image_dup_compare(struct image_dup_context *ctx, struct image_dup *dup1, struct image_dup *dup2);
49
50 /* internals */
51
52 static inline byte *
53 image_dup_block(struct image_dup *dup, uns tab_col, uns tab_row)
54 {
55   return dup->tab_pixels + (dup->tab_row_size << tab_row) + (3 << (tab_row + tab_col));
56 }
57
58
59 #endif