#undef LOCAL_DEBUG
-#include "lib/lib.h"
-#include "lib/conf.h"
-#include "lib/heap.h"
-#include "images/images.h"
-#include "images/signature.h"
-#include "images/math.h"
+#include <ucw/lib.h>
+#include <ucw/conf.h>
+#include <ucw/heap.h>
+#include <images/images.h>
+#include <images/signature.h>
+#include <images/math.h>
#include <string.h>
#define ASORT_PREFIX(x) prequant_##x
#define ASORT_KEY_TYPE uns
-#define ASORT_ELT(i) val[i]
-#define ASORT_EXTRA_ARGS , uns *val
-#include "lib/arraysort.h"
+#include <ucw/sorter/array-simple.h>
static uns
prequant(struct image_sig_block *blocks, uns blocks_count, struct image_sig_region *regions)
if (region->count < 2 ||
region->e < image_sig_prequant_thresholds[regions_count - 1] * blocks_count)
{
- HEAP_DELMIN(struct image_sig_region *, heap, heap_count, prequant_heap_cmp, HEAP_SWAP);
+ HEAP_DELETE_MIN(struct image_sig_region *, heap, heap_count, prequant_heap_cmp, HEAP_SWAP);
continue;
}
block = region->blocks;
for (uns i = 0; i < region->count; i++, block = block->next)
val[i] = block->v[axis];
- prequant_sort(region->count, val);
+ prequant_sort(val, region->count);
cval = 1;
cnt[0] = 1;
for (uns i = 1; i < region->count; i++)
}
prequant_finish_region(region);
prequant_finish_region(region2);
- HEAP_INCREASE(struct image_sig_region *, heap, heap_count, prequant_heap_cmp, HEAP_SWAP, 1);
- heap[++heap_count] = region2;
- HEAP_INSERT(struct image_sig_region *, heap, heap_count, prequant_heap_cmp, HEAP_SWAP);
+ HEAP_INCREASE(struct image_sig_region *, heap, heap_count, prequant_heap_cmp, HEAP_SWAP, 1, region);
+ HEAP_INSERT(struct image_sig_region *, heap, heap_count, prequant_heap_cmp, HEAP_SWAP, region2);
}
DBG("Pre-quantized to %u regions", regions_count);