Changeset 20

Show
Ignore:
Timestamp:
01.11.2006 15:52:11 (2 years ago)
Author:
jorge
Message:

Check whether hasing is configured, or return early from hasing functions, saving a few computational steps.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/devel/FuzzyOcr/Hashing.pm

    r19 r20  
    33 
    44use base 'Exporter'; 
    5 our @EXPORT_OK = qw(check_image_hash_db check_image_hash_db add_image_hash_db calc_image_hash); 
     5our @EXPORT_OK = qw(check_image_hash_db 
     6    check_image_hash_db  
     7    add_image_hash_db  
     8    calc_image_hash); 
    69 
    710use lib "../"; 
     
    5558sub check_image_hash_db { 
    5659    my $conf = get_config(); 
     60    return (0,'') unless ( 
     61        ($conf->{'focr_enable_image_hashing'} > 0) and 
     62        ($conf->{'focr_enable_image_hashing'} < 3) 
     63    ); 
    5764    my $digest = $_[0]; 
    5865    my $dbfile = $_[1] || $conf->{"focr_db_hash"}; 
     
    135142sub add_image_hash_db { 
    136143    my $conf = get_config(); 
     144    return unless ( 
     145        ($conf->{'focr_enable_image_hashing'} > 0) and 
     146        ($conf->{'focr_enable_image_hashing'} < 3) 
     147    ); 
    137148    my $digest = $_[0]; 
    138149    my $score  = $_[1];