Ignore:
Timestamp:
Apr 18, 2009 2:29:28 PM (15 years ago)
Author:
bennylp
Message:

More ticket #774: optimization for siren7/siren14 codecs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/third_party/g7221/encode/dct4_a.c

    r2601 r2616  
    136136 
    137137        /*    set_span      = 1 << (DCT_LENGTH_LOG - set_count_log); */ 
    138         set_span = shr(dct_length,set_count_log); 
    139  
    140         set_count     = shl(1,set_count_log); 
     138        set_span = shr_nocheck(dct_length,set_count_log); 
     139 
     140        set_count     = shl_nocheck(1,set_count_log); 
    141141 
    142142        in_ptr        = in_buffer; 
     
    169169                in_val_low      = *in_ptr++; 
    170170                in_val_high     = *in_ptr++; 
    171                 acca            = L_add(in_val_low,in_val_high); 
    172                 acca            = L_shr(acca,1); 
     171                // blp: addition of two 16bits vars, there's no way 
     172                //      they'll overflow a 32bit var 
     173                //acca            = L_add(in_val_low,in_val_high); 
     174                acca = (in_val_low + in_val_high); 
     175                acca            = L_shr_nocheck(acca,1); 
    173176                out_val_low     = extract_l(acca); 
    174177 
    175178                acca            = L_sub(in_val_low,in_val_high); 
    176                 acca            = L_shr(acca,1); 
     179                acca            = L_shr_nocheck(acca,1); 
    177180                out_val_high    = extract_l(acca); 
    178181 
     
    214217 
    215218    temp = sub(dct_length_log,1); 
    216     temp = shl(1,temp); 
     219    temp = shl_nocheck(1,temp); 
    217220 
    218221    for (pairs_left=temp; pairs_left > 0; pairs_left--) 
     
    220223        for ( k=0; k<CORE_SIZE; k++ ) 
    221224        { 
     225#if PJ_HAS_INT64 
     226            /* blp: danger danger! not really compatible but faster */ 
     227            pj_int64_t sum64=0; 
     228            move32(); 
     229             
     230            for ( i=0; i<CORE_SIZE; i++ ) 
     231            { 
     232                sum64 += L_mult(pair_ptr[i], dct_core_a[i][k]); 
     233            } 
     234            sum = L_saturate(sum64); 
     235#else 
    222236            sum=0L; 
    223237            move32(); 
     
    226240                sum = L_mac(sum, pair_ptr[i],dct_core_a[i][k]); 
    227241            } 
     242#endif 
    228243            buffer_swap[k] = itu_round(sum); 
    229244        } 
     
    251266        /*===========================================================*/ 
    252267        /*    set_span      = 1 << (DCT_LENGTH_LOG - set_count_log); */ 
    253         set_span = shr(dct_length,set_count_log); 
    254  
    255         set_count     = shl(1,set_count_log); 
     268        set_span = shr_nocheck(dct_length,set_count_log); 
     269 
     270        set_count     = shl_nocheck(1,set_count_log); 
    256271        next_in_base  = in_buffer; 
    257272        move16(); 
     
    278293            in_ptr_low     = next_in_base; 
    279294            move16(); 
    280             temp           = shr(set_span,1); 
     295            temp           = shr_nocheck(set_span,1); 
    281296 
    282297            /* address arithmetic */ 
Note: See TracChangeset for help on using the changeset viewer.