* for aspect ratio threshold near one
*/
-#define LOCAL_DEBUG
+#undef LOCAL_DEBUG
#include "sherlock/sherlock.h"
#include "lib/mempool.h"
#include <fcntl.h>
static uns image_dup_ratio_threshold = 140;
-static uns image_dup_error_threshold = 600;
+static uns image_dup_error_threshold = 800;
static uns image_dup_tab_limit = 8;
static inline byte *
dest[2] = ((uns)src1[2] + (uns)src2[2]) >> 1;
}
-int
+uns
+image_dup_estimate_size(uns cols, uns rows)
+{
+ uns tab_cols, tab_rows;
+ for (tab_cols = 0; (uns)(2 << tab_cols) < cols && tab_cols < image_dup_tab_limit; tab_cols++);
+ for (tab_rows = 0; (uns)(2 << tab_rows) < rows && tab_rows < image_dup_tab_limit; tab_rows++);
+ return sizeof(struct image) + cols * rows * 3 + sizeof(struct image_dup) + (12 << (tab_cols + tab_rows)) + 64;
+}
+
+uns
image_dup_init(struct image_thread *thread, struct image_dup *dup, struct image *img, struct mempool *pool)
{
DBG("image_dup_init()");
return err <= image_dup_error_threshold;
}
-int
+uns
image_dup_compare(struct image_dup *dup1, struct image_dup *dup2, uns flags)
{
DBG("image_dup_compare()");
result |= 1 << t;
if (!(flags & IMAGE_DUP_WANT_ALL))
return result;
+ else
+ break;
}
}
}
result |= 1 << t;
if (!(flags & IMAGE_DUP_WANT_ALL))
return result;
+ else
+ break;
}
}
}
#define IMAGE_DUP_SCALE 0x100
#define IMAGE_DUP_WANT_ALL 0x200
-int image_dup_init(struct image_thread *thread, struct image_dup *dup, struct image *image, struct mempool *pool);
-int image_dup_compare(struct image_dup *dup1, struct image_dup *dup2, uns flags);
+uns image_dup_init(struct image_thread *thread, struct image_dup *dup, struct image *image, struct mempool *pool);
+uns image_dup_compare(struct image_dup *dup1, struct image_dup *dup2, uns flags);
+uns image_dup_estimate_size(uns cols, uns rows);
#endif
* This software may be freely distributed and used according to the terms
*/
-#define LOCAL_DEBUG
+#undef LOCAL_DEBUG
#include "sherlock/sherlock.h"
#include "lib/base224.h"
if (!io->background_color.color_space)
io->background_color = color_white;
struct image *img;
- if (!(img = image_io_read_data(io, 0)))
+ if (!(img = image_io_read_data(io, 1)))
goto error;
- ASSERT(img->cols == ioi->thumb_cols && img->rows == ioi->thumb_rows);
DBG("Decompressed thumbnail: size=%ux%u", img->cols, img->rows);
return img;
error: