Commit 96f97a43 authored by vaillancour's avatar vaillancour
Browse files

adding basop sat for signal with extreme saturation

parent c5c5b488
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -322,7 +322,11 @@ void hp20(Word16 signal[], /* i/o: signal to filter any *

  prescale = getScaleFactor16(signal, lg);
  prescaleOld = extract_l(mem[4]);
#ifdef BASOP_NOGLOB
  diff = norm_l( L_shl_sat( mem[2], prescaleOld ) );
#else
  diff = norm_l( L_shl( mem[2], prescaleOld ) );
#endif
  if (mem[2] != 0)
  {
    prescale = s_min(prescale, diff);
+21 −8
Original line number Diff line number Diff line
@@ -147,12 +147,20 @@ void preecho_sb_fx(
        fx32ptr1 = wtda_audio_fx + len3xLp20 - 1;
        FOR( i = 0; i < len3xLp20; i++ )
        {
#ifdef BASOP_NOGLOB
            *fxptr1++ = negate( extract_h( L_shl_sat( *fx32ptr1--, 15 - q_sig32 ) ) );
#else
            *fxptr1++ = negate( extract_h( L_shl( *fx32ptr1--, 15 - q_sig32 ) ) );
#endif
            move16(); /*convert to Word16 Q-1 with saturation (saturation not a problem here) */
        }
        FOR( i = 0; i < L_shr(framelength, 1); i++ )
        {
#ifdef BASOP_NOGLOB
            *fxptr1++ = negate( extract_h( L_shl_sat( wtda_audio_fx[i], 15 - q_sig32 ) ) );
#else
            *fxptr1++ = negate( extract_h( L_shl( wtda_audio_fx[i], 15 - q_sig32 ) ) );
#endif
            move16(); /*convert to Word16 Q-1 with saturation (saturation not a problem here) */
        }
        qmemp1 = 0; /*already in q-1*/
@@ -253,11 +261,15 @@ void preecho_sb_fx(
        FOR (j = 0; j < NUMSF; j++)                 /* 8 present subframes */
        {
            tmp_fx2 = sub(j, 1);
#ifdef BASOP_NOGLOB
            tmp_fx1 = shr_sat( *fxptr2, q16p1 ); /*q-1 to avoisd saturation in energy*/
            tmp_fxL1 = L_mac0_sat(25, tmp_fx1, tmp_fx1);
            tmp_fxL2 = L_mac0_sat(100, *fxptr3, *fxptr3);
#else
            tmp_fx1 = shr( *fxptr2, q16p1 ); /*q-1 to avoisd saturation in energy*/
            tmp_fxL1 = L_mac0(25, tmp_fx1, tmp_fx1);

            tmp_fxL2 = L_mac0(100, *fxptr3, *fxptr3);

#endif
            sptr2_loc = 0;
            move16();

@@ -277,11 +289,12 @@ void preecho_sb_fx(
                    *fx32ptr6 = tmp_fxL1;
                    move32();
                }
                tmp_fx1 = shr(*fxptr2, q16p1); /*q-1 to avoisd saturation in energy*/
#ifdef BASOP_NOGLOB
                tmp_fx1 = shr_sat( *fxptr2, q16p1 ); /*q-1 to avoisd saturation in energy*/
                tmp_fxL1 = L_mac0_sat( tmp_fxL1, tmp_fx1, tmp_fx1 );
                tmp_fxL2 = L_mac0_sat(tmp_fxL2, *fxptr3, *fxptr3);
#else
                tmp_fx1 = shr( *fxptr2, q16p1 ); /*q-1 to avoisd saturation in energy*/
                tmp_fxL1 = L_mac0( tmp_fxL1, tmp_fx1, tmp_fx1 );
                tmp_fxL2 = L_mac0(tmp_fxL2, *fxptr3, *fxptr3);
#endif
+10 −2
Original line number Diff line number Diff line
@@ -1535,7 +1535,11 @@ static void Repetition_smoothing_nextgood_fx(
    /*mvr2r(&ImdctOutWin[L], OldauOut, L);*/
    FOR (i = 0; i < L; i++)
    {
#ifdef BASOP_NOGLOB
        auOut_fx[i] = add_sat( ImdctOutWin_fx[N_ZERO_NB + i], OldauOut_fx[i] );
#else
        auOut_fx[i] = add( ImdctOutWin_fx[N_ZERO_NB + i], OldauOut_fx[i] );
#endif
        move16();
    }
    Copy(&ImdctOutWin_fx[L], OldauOut_fx, L);
@@ -1626,7 +1630,11 @@ static void common_overlapping_fx(
    FOR (i=0 ; i < end1; i++)
    {
        /*auOut_fx[i] = L_add(ImdctOutWin_fx[i+7*L/20], OldauOut_fx[i+offset1]);*/
#ifdef BASOP_NOGLOB
        auOut_fx[i] = add_sat( ImdctOutWin_fx[i + N_ZERO_NB], OldauOut_fx[i + offset1] );
#else
        auOut_fx[i] = add( ImdctOutWin_fx[i + N_ZERO_NB], OldauOut_fx[i + offset1] );
#endif
        move16();
    }
    FOR (i=start2 ; i < end2; i++)
+15 −3
Original line number Diff line number Diff line
@@ -344,7 +344,11 @@ void LD_music_post_filter_fx
                tmp16 = s_min(max_ovf_4k, hMusicPF->filt_lfE_fx[i]);
                tmp16 = s_max(min_g_4k, tmp16);
                /*DCT_buf[i] *= ftmp;*/
#ifdef BASOP_NOGLOB
                dtc_out[i] = round_fx_sat( L_shl_sat( L_mult_sat( dtc_out[i], tmp16 ), 3 ) );
#else
                dtc_out[i] = round_fx( L_shl( L_mult( dtc_out[i], tmp16 ), 3 ) );
#endif
            }

            test();
@@ -356,7 +360,11 @@ void LD_music_post_filter_fx
                    tmp16 = s_min(max_ovf_6k, hMusicPF->filt_lfE_fx[i]);
                    tmp16 = s_max(min_g_6k, tmp16);
                    /*DCT_buf[i] *= ftmp;*/
#ifdef BASOP_NOGLOB
                    dtc_out[i] = round_fx_sat( L_shl_sat( L_mult_sat( dtc_out[i], tmp16 ), 3 ) );
#else
                    dtc_out[i] = round_fx( L_shl( L_mult( dtc_out[i], tmp16 ), 3 ) );
#endif
                }
            }
        }
@@ -367,7 +375,11 @@ void LD_music_post_filter_fx
            {
                tmp16 = s_min(4096, hMusicPF->filt_lfE_fx[i]);
                /*DCT_buf[i] *= ftmp;*/
#ifdef BASOP_NOGLOB
                dtc_out[i] = round_fx_sat( L_shl_sat( L_mult_sat( dtc_out[i], tmp16 ), 3 ) );
#else
                dtc_out[i] = round_fx( L_shl( L_mult( dtc_out[i], tmp16 ), 3 ) );
#endif
            }
        }
    }
+15 −4
Original line number Diff line number Diff line
@@ -188,7 +188,11 @@ void gain_dec_tc_fx(

    /* *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 */

    /**norm_gain_code = *gain_code / *gain_inov;*/
@@ -742,8 +746,11 @@ void gain_dec_lbr_fx(
        move16();

        L_tmp = L_mult(cdbk_fx[add(shl(index,1),1)] , gcode0_fx);  /* Q9*Q0 -> Q10 */
#ifdef BASOP_NOGLOB
        *gain_code_fx = L_shl_sat( L_tmp, add( exp_gcode0, 6 ) ); /* Q10 -> Q16*/
#else
        *gain_code_fx = L_shl( L_tmp, add( exp_gcode0, 6 ) ); /* Q10 -> Q16*/

#endif
        gc_mem[2] = *gain_code_fx;
        move32();
        gp_mem[2] = *gain_pit_fx;
@@ -822,7 +829,11 @@ void gain_dec_lbr_fx(
        move16();

        L_tmp = L_mult(cdbk_fx[add(shl(index,1),1)] , gcode0_fx);  /* Q9*Q0 -> Q10 */
#ifdef BASOP_NOGLOB
        *gain_code_fx = L_shl_sat( L_tmp, add( exp_gcode0, 6 ) );
#else
        *gain_code_fx = L_shl( L_tmp, add( exp_gcode0, 6 ) );
#endif
        move32();  /* Q10 -> Q16*/
    }

Loading