Commit a5f8e292 authored by vaillancour's avatar vaillancour
Browse files

adding basop sat for signal with extreme saturation

parent 96f97a43
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -2122,7 +2122,11 @@ void IMDCT(Word32 *x, Word16 x_e,
                tmp1 = sub(overlap, tcx_mdct_window_min_length);
                FOR (i=0; i < tmp1; i++)
                {
#ifdef BASOP_NOGLOB
                    xn_buf[i + tmp4] = shl_sat( add( xn_buf[i + tmp4], shr( old_out[i + nz], tmp2 ) ), TCX_IMDCT_HEADROOM );
#else
                    xn_buf[i + tmp4] = shl( add( xn_buf[i + tmp4], shr( old_out[i + nz], tmp2 ) ), TCX_IMDCT_HEADROOM );
#endif
                    move16();
                }

@@ -2131,19 +2135,31 @@ void IMDCT(Word32 *x, Word16 x_e,
                FOR ( ; i < tmp1; i++)
                {
                    tmp3 = mult_r(shr(old_out[i+nz], tmp2), tcx_mdct_window_minimum[i-overlap+tcx_mdct_window_min_length].v.re);
#ifdef BASOP_NOGLOB
                    xn_buf[i + tmp4] = shl_sat( add( xn_buf[i + tmp4], tmp3 ), TCX_IMDCT_HEADROOM );
#else
                    xn_buf[i + tmp4] = shl( add( xn_buf[i + tmp4], tmp3 ), TCX_IMDCT_HEADROOM );
#endif
                    move16();
                }
                FOR ( ; i < overlap; i++)
                {
                    tmp3 = mult_r(shr(old_out[i+nz], tmp2), tcx_mdct_window_minimum[overlap-1-i].v.im);
#ifdef BASOP_NOGLOB
                    xn_buf[i + tmp4] = shl_sat( add( xn_buf[i + tmp4], tmp3 ), TCX_IMDCT_HEADROOM );
#else
                    xn_buf[i + tmp4] = shl( add( xn_buf[i + tmp4], tmp3 ), TCX_IMDCT_HEADROOM );
#endif
                    move16();
                }

                FOR (i = add(i, tmp4) ; i < L_frame; i++)
                {
#ifdef BASOP_NOGLOB
                    xn_buf[i] = shl_sat( xn_buf[i], TCX_IMDCT_HEADROOM );
#else
                    xn_buf[i] = shl( xn_buf[i], TCX_IMDCT_HEADROOM );
#endif
                    move16();
                }
            }
+7 −3
Original line number Diff line number Diff line
@@ -324,9 +324,13 @@ static void bass_pf_1sf_delay(
                        tmp16 = mac_r(tmp32, gain, syn[i+i_subfr]); /* Q0 */
#endif
                        lp_error = Mpy_32_16_1(lp_error, 29491/*0.9f Q15*/);
#ifdef BASOP_NOGLOB
                        lp_error = L_mac_sat( lp_error, tmp16, 0x1000 ); /* Q13 */
                        tmp16 = round_fx_sat( L_shl_sat( lp_error, s1 ) );   /* Q0+s1-3 */
#else
                        lp_error = L_mac( lp_error, tmp16, 0x1000 ); /* Q13 */

                        tmp16 = round_fx( L_shl( lp_error, s1 ) );   /* Q0+s1-3 */
#endif
                        ener2_64 = W_mac0_16_16(ener2_64, tmp16, tmp16); /* Q0+(s1-3)*2 */
                    }
                    ener2 = W_sat_l(ener2_64);