]> mj.ucw.cz Git - libucw.git/commitdiff
MergeImages: Just small improvements.
authorPavel Charvat <pavel.charvat@netcentrum.cz>
Fri, 23 Nov 2007 12:15:18 +0000 (13:15 +0100)
committerPavel Charvat <pavel.charvat@netcentrum.cz>
Fri, 23 Nov 2007 12:15:18 +0000 (13:15 +0100)
images/dup-cmp.c
images/duplicates.h

index 9f98b1939dd145b1c7c209bfdb1fb4a45a15eae6..b71feaef9fa871fc4e4ff8675b593e956e9604ea 100644 (file)
@@ -104,6 +104,7 @@ blocks_compare(struct image_dup_context *ctx, struct image_dup *dup1, struct ima
       case 0: ;
        uns err = (err_sum(block1, block2, 1 << (tab_col + tab_row)) >> (tab_col + tab_row));
        DBG("average error=%d", err);
+       ctx->error = err;
        return err <= ctx->error_threshold;
       case 1:
        col_step = -3;
@@ -144,6 +145,7 @@ blocks_compare(struct image_dup_context *ctx, struct image_dup *dup1, struct ima
     }
   uns err = (err_sum_transformed(block1, block2, (1 << tab_col), (1 << tab_row), (3 << tab_col), col_step, row_step) >> (tab_col + tab_row));
   DBG("average error=%d", err);
+  ctx->error = err;
   return err <= ctx->error_threshold;
 }
 
@@ -204,13 +206,14 @@ same_size_compare(struct image_dup_context *ctx, struct image_dup *dup1, struct
     }
   uns err = (err_sum_transformed(block1, block2, img1->cols, img1->rows, img1->row_size, col_step, row_step) / ((u64)img1->cols * img1->rows));
   DBG("average error=%d", err);
+  ctx->error = err;
   return err <= ctx->error_threshold;
 }
 
 uns
 image_dup_compare(struct image_dup_context *ctx, struct image_dup *dup1, struct image_dup *dup2)
 {
-  DBG("image_dup_compare()");
+  DBG("image_dup_compare(%p, %p)", dup1, dup2);
   if (!average_compare(ctx, dup1, dup2))
     return 0;
   struct image *img1 = &dup1->image;
index 968335bf674c1a60e74cf69d68500719c2a490a6..ddeddd5c65f8e317ce402b15c976f15ef1792908 100644 (file)
@@ -23,6 +23,7 @@ struct image_dup_context {
   uns qtree_limit;
   u64 sum_depth;
   u64 sum_pixels;
+  uns error;
 };
 
 struct image_dup {