You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.7 KiB
66 lines
1.7 KiB
2 months ago
|
#ifndef _IMAGES_DUPLICATES_H
|
||
|
#define _IMAGES_DUPLICATES_H
|
||
|
|
||
|
#ifdef CONFIG_UCW_CLEAN_ABI
|
||
|
#define image_dup_compare ucw_image_dup_compare
|
||
|
#define image_dup_context_cleanup ucw_image_dup_context_cleanup
|
||
|
#define image_dup_context_init ucw_image_dup_context_init
|
||
|
#define image_dup_estimate_size ucw_image_dup_estimate_size
|
||
|
#define image_dup_new ucw_image_dup_new
|
||
|
#endif
|
||
|
|
||
|
enum image_dup_flags {
|
||
|
IMAGE_DUP_TRANS_ID = 0x0001,
|
||
|
IMAGE_DUP_FLIP_X = 0x0002,
|
||
|
IMAGE_DUP_FLIP_Y = 0x0004,
|
||
|
IMAGE_DUP_ROT_180 = 0x0008,
|
||
|
IMAGE_DUP_FLIP_BACK = 0x0010,
|
||
|
IMAGE_DUP_ROT_CCW = 0x0020,
|
||
|
IMAGE_DUP_ROT_CW = 0x0040,
|
||
|
IMAGE_DUP_FLIP_SLASH = 0x0080,
|
||
|
IMAGE_DUP_TRANS_ALL = 0x00ff,
|
||
|
IMAGE_DUP_SCALE = 0x0100,
|
||
|
IMAGE_DUP_WANT_ALL = 0x0200,
|
||
|
};
|
||
|
|
||
|
struct image_dup_context {
|
||
|
struct image_context *ic;
|
||
|
uint flags;
|
||
|
uint ratio_threshold;
|
||
|
uint error_threshold;
|
||
|
uint qtree_limit;
|
||
|
u64 sum_depth;
|
||
|
u64 sum_pixels;
|
||
|
uint error;
|
||
|
};
|
||
|
|
||
|
struct image_dup {
|
||
|
struct image image;
|
||
|
byte *tab_pixels;
|
||
|
u32 tab_cols;
|
||
|
u32 tab_rows;
|
||
|
u32 tab_row_size;
|
||
|
u32 tab_size;
|
||
|
};
|
||
|
|
||
|
/* dup-init.c */
|
||
|
|
||
|
void image_dup_context_init(struct image_context *ic, struct image_dup_context *ctx);
|
||
|
void image_dup_context_cleanup(struct image_dup_context *ctx);
|
||
|
|
||
|
uint image_dup_estimate_size(uint cols, uint rows, uint same_size_compare, uint qtree_limit);
|
||
|
uint image_dup_new(struct image_dup_context *ctx, struct image *image, void *buffer, uint same_size_compare);
|
||
|
|
||
|
/* dup-cmp.c */
|
||
|
|
||
|
uint image_dup_compare(struct image_dup_context *ctx, struct image_dup *dup1, struct image_dup *dup2);
|
||
|
|
||
|
/* internals */
|
||
|
|
||
|
static inline byte *image_dup_block(struct image_dup *dup, uint tab_col, uint tab_row)
|
||
|
{
|
||
|
return dup->tab_pixels + (dup->tab_row_size << tab_row) + (3 << (tab_row + tab_col));
|
||
|
}
|
||
|
|
||
|
#endif
|