def _find_l1_phash_mul(cdict): candidate_lengths = _find_candidate_lengths_mul(cdict.tuple2int) for p in candidate_lengths: hash_f = hashmul.hashmul_t(p) if hash_f.is_perfect(iter(cdict.tuple2int.values())): return l1_phash_t(cdict, hash_f) del hash_f return None
def _find_l2_hash_mul(cdict): """Similar to the _find_l1_phash_mul, but not looking for perfection, just well distributed stuff""" global _l1_bucket_max candidate_lengths = _find_candidate_lengths_mul(cdict.tuple2int) for p in candidate_lengths: hash_f = hashmul.hashmul_t(p) if xedhash.is_well_distributed(cdict.tuple2int, hash_f, _l1_bucket_max): return hash_f del hash_f return None