#undef LOCAL_DEBUG
#include "sherlock/sherlock.h"
-#include "lib/math.h"
-#include "lib/fastbuf.h"
#include "lib/conf.h"
#include "lib/heap.h"
-#include "images/math.h"
#include "images/images.h"
-#include "images/color.h"
#include "images/signature.h"
+#include "images/math.h"
-#include <alloca.h>
+#include <string.h>
#ifdef LOCAL_DEBUG
static void
prequant(struct image_sig_block *blocks, uns blocks_count, struct image_sig_region *regions)
{
DBG("Starting pre-quantization");
-
+
uns regions_count, heap_count, axis, cov;
struct image_sig_block *blocks_end = blocks + blocks_count, *block, *block2;
struct image_sig_region *heap[IMAGE_REG_MAX + 1], *region, *region2;
regions_count <= DARY_LEN(image_sig_prequant_thresholds) && heap_count)
{
region = heap[1];
- DBG("Step... regions_count=%u heap_count=%u region->count=%u, region->e=%u",
+ DBG("Step... regions_count=%u heap_count=%u region->count=%u, region->e=%u",
regions_count, heap_count, region->count, (uns)region->e);
if (region->count < 2 ||
region->e < image_sig_prequant_thresholds[regions_count - 1] * region->count)
postquant(struct image_sig_block *blocks, uns blocks_count, struct image_sig_region *regions, uns regions_count)
{
DBG("Starting post-quantization");
-
+
struct image_sig_block *blocks_end = blocks + blocks_count, *block;
struct image_sig_region *regions_end = regions + regions_count, *region;
uns error = 0, last_error;
for (uns step = 0; step < image_sig_postquant_max_steps; step++)
{
DBG("Step...");
-
+
/* Clear regions */
for (region = regions; region != regions_end; region++)
{
}
DBG("Post-quantized to %u regions with average square error %u", regions_end - regions, error / blocks_count);
-
+
return regions_end - regions;
}
{
uns regions_count;
regions_count = prequant(blocks, blocks_count, regions);
-#ifdef LOCAL_DEBUG
+#ifdef LOCAL_DEBUG
dump_segmentation(regions, regions_count);
-#endif
+#endif
regions_count = postquant(blocks, blocks_count, regions, regions_count);
-#ifdef LOCAL_DEBUG
+#ifdef LOCAL_DEBUG
dump_segmentation(regions, regions_count);
-#endif
+#endif
return regions_count;
}