Commit 6e9b00db authored by vaillancour's avatar vaillancour
Browse files

adding basop sat for signal with extreme saturation

parent b13d2720
Loading
Loading
Loading
Loading
+27 −5
Original line number Diff line number Diff line
@@ -3381,7 +3381,11 @@ Word16 ppp_extract_pitch_period_fx(
            spike=i;
            move16();
        }
#ifdef BASOP_NOGLOB
        en1 = L_mac0_sat( en1, ptr[i], ptr[i] ); /*  Q0 */
#else
        en1 = L_mac0( en1, ptr[i], ptr[i] ); /*  Q0 */
#endif
    }

    IF (ptr[spike]>0)
@@ -3508,7 +3512,11 @@ Word16 ppp_extract_pitch_period_fx(
    Lacc = L_deposit_l(0);
    FOR (i=0; i<l; i++)
    {
#ifdef BASOP_NOGLOB
        Lacc = L_mac0_sat( Lacc, out[i], out[i] ); /*  Q0 */
#else
        Lacc = L_mac0( Lacc, out[i], out[i] ); /*  Q0 */
#endif
    }


@@ -3579,8 +3587,11 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx,Word32 *pos_fx, Word16 *Qpos, Wo

    FOR (i=0; i<256; i++)
    {
#ifdef BASOP_NOGLOB
        L_temp = L_mult_sat( time_fx[i], time_fx[i] ); /*  Q(1) */
#else
        L_temp = L_mult( time_fx[i], time_fx[i] ); /*  Q(1) */

#endif
        IF (time_fx[i] >= 0)
        {
            if (GT_32(L_temp,maxPosEn_fx))
@@ -3980,6 +3991,16 @@ static void c_fft_wi_fx(Word16 * farray_ptr_fx, Word16 size, Word16 stage, Word1
                    tmp1 = round_fx(ftmp_real_fx);
                    tmp2 = round_fx(ftmp_imag_fx);

#ifdef BASOP_NOGLOB
                    *( farray_ptr_fx + kj ) = sub_sat( *( farray_ptr_fx + k ), tmp1 );
                    move16();
                    *(farray_ptr_fx + kj + 1) = sub_sat(*(farray_ptr_fx + k + 1), tmp2);
                    move16();
                    *(farray_ptr_fx + k) = add_sat(*(farray_ptr_fx + k), tmp1);
                    move16();
                    *(farray_ptr_fx + k + 1) = add_sat(*(farray_ptr_fx + k + 1), tmp2);
                    move16();
#else
                    *( farray_ptr_fx + kj ) = sub( *( farray_ptr_fx + k ), tmp1 );
                    move16();
                    *(farray_ptr_fx + kj + 1) = sub(*(farray_ptr_fx + k + 1), tmp2);
@@ -3988,6 +4009,7 @@ static void c_fft_wi_fx(Word16 * farray_ptr_fx, Word16 size, Word16 stage, Word1
                    move16();
                    *(farray_ptr_fx + k + 1) = add(*(farray_ptr_fx + k + 1), tmp2);
                    move16();
#endif
                }
            }
        }
+10 −2
Original line number Diff line number Diff line
@@ -954,7 +954,11 @@ void gain_enc_tc_fx(

    i = sub(exp_num, exp_den); /* Gain_trans in Q7 */
    g_code_fx = i_mult2(g_code_fx, tmp16); /* apply sign */
#ifdef BASOP_NOGLOB
    *gain_code_fx = L_shr_sat( L_deposit_l( g_code_fx ), i );
#else
    *gain_code_fx = L_shr( L_deposit_l( g_code_fx ), i );
#endif
    move32();

    /*----------------------------------------------------------------*
@@ -1058,7 +1062,11 @@ void gain_enc_tc_fx(
            move16();
            /**gain_code *= gcode0;*/
            L_tmp = L_mult(wgain_code, gcode0_fx);         /* Q13*Q0 -> Q14 */
#ifdef BASOP_NOGLOB
            *gain_code_fx = L_shl_sat( L_tmp, add( exp_gcode0, 2 ) );
#else
            *gain_code_fx = L_shl( L_tmp, add( exp_gcode0, 2 ) );
#endif
            move32(); /* Q14 -> Q16 */
            push_indice_fx( hBstr, IND_GAIN_CODE, index, nBits );
        }