X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=images%2Fsig-seg.c;h=cdcb71c8417ba147af293d0a1eb334fc644f66e1;hb=d46d9596c225dbbcaef4b76e0828036e3addfbe3;hp=7e6e09f5a2a802ad1e71870848af0e9883ff65b2;hpb=3cbca97fcc3bd2708329315fa60e535ba319b9d2;p=libucw.git diff --git a/images/sig-seg.c b/images/sig-seg.c index 7e6e09f5..cdcb71c8 100644 --- a/images/sig-seg.c +++ b/images/sig-seg.c @@ -7,7 +7,7 @@ * of the GNU Lesser General Public License. */ -#define LOCAL_DEBUG +#undef LOCAL_DEBUG #include "sherlock/sherlock.h" #include "lib/conf.h" @@ -68,7 +68,9 @@ static void prequant_finish_region(struct image_sig_region *region) { if (region->count < 2) - memcpy(region->c, region->a, sizeof(region->c)); + { + region->e = 0; + } else { u64 a = 0; @@ -120,13 +122,13 @@ prequant(struct image_sig_block *blocks, uns blocks_count, struct image_sig_regi 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) + 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); continue; } - /* Select axis to split - the one with maximum covariance */ + /* Select axis to split - the one with maximum average quadratic error */ axis = 0; u64 cov = (u64)region->count * region->c[0] - (u64)region->b[0] * region->b[0]; for (uns i = 1; i < 6; i++) @@ -324,7 +326,7 @@ postquant(struct image_sig_block *blocks, uns blocks_count, struct image_sig_reg if (error > last_error) break; u64 dif = last_error - error; - if (dif * image_sig_postquant_threshold < last_error * 100) + if (dif * image_sig_postquant_threshold < (u64)last_error * 100) break; } }