Commit 78b45a03 authored by vaillancour's avatar vaillancour
Browse files

adding basop sat for signal with extreme saturation

parent 1f3443a6
Loading
Loading
Loading
Loading
+49 −11
Original line number Diff line number Diff line
@@ -132,17 +132,34 @@ static void c_fft_fx(

			input_ptr1 = in_ptr + (const Word16)((uintptr_t)(*table_ptr++) >> (uintptr_t)shift);

#ifdef BASOP_NOGLOB
            tmp1 = msu_r_sat( L_tmp1, *input_ptr1, 16384 );
            tmp3 = mac_r_sat(L_tmp1, *input_ptr1++, 16384);
#else
            tmp1 = msu_r( L_tmp1, *input_ptr1, 16384 );
            tmp3 = mac_r(L_tmp1, *input_ptr1++, 16384);

#endif
            input_ptr2 = in_ptr + (const Word16)((uintptr_t)(*table_ptr++) >> (uintptr_t)shift);
            input_ptr3 = in_ptr + (const Word16)((uintptr_t)(*table_ptr++) >> (uintptr_t)shift);

            L_tmp1 = L_mult(*input_ptr2++, 16384);
#ifdef BASOP_NOGLOB
            tmp2 = mac_r_sat( L_tmp1, *input_ptr3, 16384 );
            tmp4 = msu_r_sat(L_tmp1, *input_ptr3++, 16384);
#else
            tmp2 = mac_r( L_tmp1, *input_ptr3, 16384 );
            tmp4 = msu_r(L_tmp1, *input_ptr3++, 16384);

#endif
            L_tmp1 = L_mult(tmp3, 16384);
#ifdef BASOP_NOGLOB
            out_ptr[k] = mac_r_sat( L_tmp1, tmp2, 16384 );
            move16();
            out_ptr[k+4] = msu_r_sat(L_tmp1, tmp2, 16384);
            move16();

            tmp2 = mac_r_sat(L_tmp2, *input_ptr1, 16384);
            tmp3 = msu_r_sat(L_tmp2, *input_ptr1, 16384);
#else
            out_ptr[k] = mac_r( L_tmp1, tmp2, 16384 );
            move16();
            out_ptr[k+4] = msu_r(L_tmp1, tmp2, 16384);
@@ -150,28 +167,49 @@ static void c_fft_fx(

            tmp2 = mac_r(L_tmp2, *input_ptr1, 16384);
            tmp3 = msu_r(L_tmp2, *input_ptr1, 16384);

#endif
            L_tmp2 = L_mult(*input_ptr2, 16384);

            L_tmp1 = L_mult(tmp1, 16384);
#ifdef BASOP_NOGLOB
            tmp1 = msu_r_sat( L_tmp2, *input_ptr3, 16384 );
            out_ptr[k + 2] = mac_r_sat( L_tmp1, tmp1, 16384 );
            move16();
            out_ptr[k + 6] = msu_r_sat( L_tmp1, tmp1, 16384 );
            move16();
#else
            tmp1 = msu_r( L_tmp2, *input_ptr3, 16384 );
            out_ptr[k+2] = mac_r(L_tmp1, tmp1, 16384);
            move16();
            out_ptr[k+6] = msu_r(L_tmp1, tmp1, 16384);
            move16();

#endif
            L_tmp1 = L_mult(tmp2, 16384);
#ifdef BASOP_NOGLOB
            tmp2 = mac_r_sat( L_tmp2, *input_ptr3, 16384 );
            out_ptr[k+1] = mac_r_sat(L_tmp1, tmp2, 16384);
            move16();
            out_ptr[k+5] = msu_r_sat(L_tmp1, tmp2, 16384);
            move16();
#else
            tmp2 = mac_r( L_tmp2, *input_ptr3, 16384 );
            out_ptr[k+1] = mac_r(L_tmp1, tmp2, 16384);
            move16();
            out_ptr[k+5] = msu_r(L_tmp1, tmp2, 16384);
            move16();

#endif
            L_tmp1 = L_mult(tmp3, 16384);
#ifdef BASOP_NOGLOB
            out_ptr[k + 3] = msu_r_sat( L_tmp1, tmp4, 16384 );
            move16();
            out_ptr[k+7] = mac_r_sat(L_tmp1, tmp4, 16384);
            move16();
#else
            out_ptr[k + 3] = msu_r( L_tmp1, tmp4, 16384 );
            move16();
            out_ptr[k+7] = mac_r(L_tmp1, tmp4, 16384);
            move16();
#endif
        }

        /* Remaining Stages */
+5 −1
Original line number Diff line number Diff line
@@ -1217,7 +1217,11 @@ static void DTFS_transform_fx(
            tmptmp3_40_fx=L_add(tmptmp3_40_fx, Mult_32_16(x_r_fx[m],sinc_fx[k][j]));

        }
#ifdef BASOP_NOGLOB
        out_fx[i] = round_fx_sat( L_shl_sat( tmptmp3_40_fx, 2 ) );
#else
        out_fx[i] = round_fx( L_shl( tmptmp3_40_fx, 2 ) );
#endif
    }


+10 −2
Original line number Diff line number Diff line
@@ -549,14 +549,22 @@ static void trans_ana_fx(
            tr_dec[k] = 0;
            move16();
            Mpy_32_16_ss(*pGrPowLeft, THRESH_TR_LIN_BY2_FX, &acc, &lsb); /* To facilitate fixed-point implementation, divide threshold by 2. */
#ifdef BASOP_NOGLOB
            acc = L_or( L_shl_sat( acc, 16 ), L_and( 0xffffL, lsb ) ); /* Equivalent to concatenate acc and lsb, and then down shift by 16 bits. */
#else
            acc = L_or( L_shl( acc, 16 ), L_and( 0xffffL, lsb ) ); /* Equivalent to concatenate acc and lsb, and then down shift by 16 bits. */
#endif
            if (GT_32(*pGrPowRight, acc)) /* gr_pow_right > thres_tr_lin*gr_pow_left */
            {
                tr_dec[k] = 1;
                move16();
            }
            Mpy_32_16_ss(*pGrPowRight, THRESH_TR_LIN_BY2_FX, &acc, &lsb);
#ifdef BASOP_NOGLOB
            acc = L_or( L_shl_sat( acc, 16 ), L_and( 0xffffL, lsb ) ); /* Equivalent to concatenate acc and lsb, and then down shift by 16 bits. */
#else
            acc = L_or( L_shl( acc, 16 ), L_and( 0xffffL, lsb ) ); /* Equivalent to concatenate acc and lsb, and then down shift by 16 bits. */
#endif
            if (GT_32(*pGrPowLeft, acc))  /* gr_pow_left > thres_tr_lin*gr_pow_right */
            {
                tr_dec[k] = 1;