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/decode/dct4_s.c

    r2601 r2616  
    141141         
    142142        /*    set_span      = 1 << (DCT_LENGTH_LOG - set_count_log); */ 
    143         set_span = shr(dct_length,set_count_log); 
     143        set_span = shr_nocheck(dct_length,set_count_log); 
    144144            
    145         set_count     = shl(1,set_count_log); 
     145        set_count     = shl_nocheck(1,set_count_log); 
    146146        in_ptr        = in_buffer; 
    147147        move16(); 
     
    186186                         
    187187                    dummy = add(in_val_low,dither_ptr[i++]); 
    188                     acca = L_add(dummy,in_val_high); 
    189                     out_val_low = extract_l(L_shr(acca,1)); 
     188                    // blp: addition of two 16bits vars, there's no way 
     189                    //      they'll overflow a 32bit var 
     190                    //acca = L_add(dummy,in_val_high); 
     191                    acca = dummy + in_val_high; 
     192                    out_val_low = extract_l(L_shr_nocheck(acca,1)); 
    190193                     
    191194                    dummy = add(in_val_low,dither_ptr[i++]); 
    192                     acca = L_add(dummy,-in_val_high); 
    193                     out_val_high = extract_l(L_shr(acca,1)); 
     195                    // blp: addition of two 16bits vars, there's no way 
     196                    //      they'll overflow a 32bit var 
     197                    //acca = L_add(dummy,-in_val_high); 
     198                    acca = dummy - in_val_high; 
     199                    out_val_high = extract_l(L_shr_nocheck(acca,1)); 
    194200                     
    195201                    *out_ptr_low++  = out_val_low; 
     
    285291        for ( k=0; k<CORE_SIZE; k++ ) 
    286292        { 
     293#if PJ_HAS_INT64 
     294            /* blp: danger danger! not really compatible but faster */ 
     295            pj_int64_t sum64=0; 
     296            move32(); 
     297             
     298            for ( i=0; i<CORE_SIZE; i++ ) 
     299            { 
     300                sum64 += L_mult(pair_ptr[i], dct_core_s[i][k]); 
     301            } 
     302            sum = L_saturate(sum64); 
     303#else 
    287304            sum=0L; 
    288305            move32(); 
     
    292309                sum = L_mac(sum, pair_ptr[i],dct_core_s[i][k]); 
    293310            } 
     311#endif 
    294312            buffer_swap[k] = itu_round(sum); 
    295313        } 
     
    324342         
    325343        /*    set_span      = 1 << (DCT_LENGTH_LOG - set_count_log); */ 
    326         set_span = shr(dct_length,set_count_log); 
    327          
    328         set_count     = shl(1,set_count_log); 
     344        set_span = shr_nocheck(dct_length,set_count_log); 
     345         
     346        set_count     = shl_nocheck(1,set_count_log); 
    329347        next_in_base  = in_buffer; 
    330348        move16(); 
     
    355373            move16(); 
    356374             
    357             temp = shr(set_span,1); 
     375            temp = shr_nocheck(set_span,1); 
    358376            in_ptr_high    = in_ptr_low + temp; 
    359377            move16(); 
     
    402420                sum = L_mac(sum,cos_even,in_low_even); 
    403421                sum = L_mac(sum,negate(msin_even),in_high_even); 
    404                 out_low_even = itu_round(L_shl(sum,1)); 
     422                out_low_even = itu_round(L_shl_nocheck(sum,1)); 
    405423                 
    406424                sum = 0L; 
     
    408426                sum = L_mac(sum,msin_even,in_low_even); 
    409427                sum = L_mac(sum,cos_even,in_high_even); 
    410                 out_high_even = itu_round(L_shl(sum,1)); 
     428                out_high_even = itu_round(L_shl_nocheck(sum,1)); 
    411429                 
    412430                sum = 0L; 
     
    414432                sum = L_mac(sum,cos_odd,in_low_odd); 
    415433                sum = L_mac(sum,msin_odd,in_high_odd); 
    416                 out_low_odd = itu_round(L_shl(sum,1)); 
     434                out_low_odd = itu_round(L_shl_nocheck(sum,1)); 
    417435                 
    418436                sum = 0L; 
     
    420438                sum = L_mac(sum,msin_odd,in_low_odd); 
    421439                sum = L_mac(sum,negate(cos_odd),in_high_odd); 
    422                 out_high_odd = itu_round(L_shl(sum,1)); 
     440                out_high_odd = itu_round(L_shl_nocheck(sum,1)); 
    423441                 
    424442                *out_ptr_low++  = out_low_even; 
     
    459477        for(i=0;i<320;i++)  
    460478        { 
    461            sum = L_add(output[i],syn_bias_7khz[i]); 
     479           // blp: addition of two 16bits vars, there's no way 
     480           //      they'll overflow a 32bit var 
     481           //sum = L_add(output[i],syn_bias_7khz[i]); 
     482           sum = output[i] + syn_bias_7khz[i]; 
    462483           acca = L_sub(sum,32767); 
    463484           test(); 
     
    467488               move32(); 
    468489           } 
    469            acca = L_add(sum,32768L); 
     490           // blp: addition of two 16bits vars, there's no way 
     491           //      they'll overflow 32bit var 
     492           //acca = L_add(sum,32768L); 
     493           acca = sum + 32768; 
    470494           test(); 
    471495           if (acca < 0)  
Note: See TracChangeset for help on using the changeset viewer.