Fix secondary sketch computation, some more accuracy in diff detection.

This commit is contained in:
Moinak Ghosh 2012-09-04 23:28:02 +05:30
parent 262566b59a
commit 560fa85aab
2 changed files with 4 additions and 8 deletions

View file

@ -409,7 +409,7 @@ rabin_dedup(rabin_context_t *ctx, uchar_t *buf, ssize_t *size, ssize_t offset, s
*/ */
fpos[0] = fpos[(fplist[fpos[1]] > fplist[fpos[0]])]; fpos[0] = fpos[(fplist[fpos[1]] > fplist[fpos[0]])];
if (len1 == SKETCH_BASIC_BLOCK_SZ) { if (len1 == SKETCH_BASIC_BLOCK_SZ) {
uint32_t p1, p2; uint32_t p1, p2, p3;
/* /*
* Compute the super sketch value by summing all the representative * Compute the super sketch value by summing all the representative
* fingerprints of the block. * fingerprints of the block.
@ -424,18 +424,16 @@ rabin_dedup(rabin_context_t *ctx, uchar_t *buf, ssize_t *size, ssize_t offset, s
*/ */
p1 = 0; p1 = 0;
p2 = 0; p2 = 0;
p3 = 0;
for (len1=0; len1<256; len1++) { for (len1=0; len1<256; len1++) {
if (charcounts[len1] > p1) { if (charcounts[len1] > p1) {
p3 = p2;
p2 = p1; p2 = p1;
p1 = len1; p1 = len1;
} }
charcounts[len1] = 0; charcounts[len1] = 0;
} }
if (ctx->delta_flag == DELTA_LESS_FUZZY) { cur_sketch2 += ((p1 << 16) | (p2 << 8) | p3);
cur_sketch2 += ((p1 << 8) | p2);
} else {
cur_sketch2 += p2;
}
len1 = 0; len1 = 0;
j++; j++;
} }

View file

@ -117,8 +117,6 @@
*/ */
#define SIMILAR_EXACT 1 #define SIMILAR_EXACT 1
#define SIMILAR_PARTIAL 2 #define SIMILAR_PARTIAL 2
#define DELTA_FUZZY 1
#define DELTA_LESS_FUZZY 2
/* /*
* Irreducible polynomial for Rabin modulus. This value is from the * Irreducible polynomial for Rabin modulus. This value is from the