Commit f83c0ace authored by multrus's avatar multrus
Browse files

cleanup

parent f655f656
Loading
Loading
Loading
Loading
Loading
+20 −43
Original line number Diff line number Diff line
@@ -311,8 +311,7 @@ static void tcx_ltp_pitch_search_fx(
    const Word16 pitmax,
    const Word16 pitres,
    const Word16 check_border_case,
    Word16 *border_case,
    Word16 element_mode )
    Word16 *border_case )
#endif // !FIX_2479_HARM_PITCH_GAIN
{
    Word16 i, t, t0, t1, step, fraction, t0_min, t0_max, t_min, t_max, delta, temp_m, temp_e, s, s_wsp;
@@ -350,10 +349,7 @@ static void tcx_ltp_pitch_search_fx(

    /* normalize wsp */
#ifdef FIX_2479_HARM_PITCH_GAIN
    IF( EQ_16( element_mode, EVS_MONO ) )
    {
    assert( len + t_max <= L_FRAME_PLUS + PIT_MAX_MAX + L_INTERPOL1 );
    }
#endif // FIX_2479_HARM_PITCH_GAIN

    s_wsp = getScaleFactor16( wsp - t_max, add( len, t_max ) );
@@ -363,15 +359,9 @@ static void tcx_ltp_pitch_search_fx(
        wsp2[t + t_max] = shl( wsp[t], s_wsp ); // Q(x + s_wsp)
        move16();
    }
    wsp = wsp2 + t_max;
#ifdef FIX_2479_HARM_PITCH_GAIN
    move16();
#endif // FIX_2479_HARM_PITCH_GAIN

    wsp = wsp2 + t_max;
    pt_cor = cor;
#ifdef FIX_2479_HARM_PITCH_GAIN
    move32();
#endif // FIX_2479_HARM_PITCH_GAIN
    FOR( t = t_min; t <= t_max; t++ )
    {
        *pt_cor = dot( wsp, wsp - t, len ); // 2*(x + s_wsp)
@@ -383,10 +373,6 @@ static void tcx_ltp_pitch_search_fx(
    cor_max = L_add( *pt_cor++, 0 );
    t1 = t0_min;
    move16();
#ifdef FIX_2479_HARM_PITCH_GAIN
    move32();
#endif // FIX_2479_HARM_PITCH_GAIN


    FOR( t = t0_min + 1; t <= t0_max; t++ )
    {
@@ -422,25 +408,7 @@ static void tcx_ltp_pitch_search_fx(
    temp_e = sub( negate( s ), temp_e );

    *norm_corr = shl_sat( temp_m, temp_e );
#ifndef FIX_2479_HARM_PITCH_GAIN
    test();
    IF( check_border_case && EQ_16( t1, t0_min ) )
    {
        Word32 tmpCor;
        FOR( t = t1 - L_INTERPOL1; t < t1; t++ )
        {
            tmpCor = dot( wsp, wsp - t, len );
            IF( GT_32( tmpCor, cor_max ) )
            {
                *border_case = 1;
                move16();
                BREAK;
            }
        }
    }
#else
    IF( NE_16( element_mode, EVS_MONO ) )
    {

    test();
    IF( check_border_case && EQ_16( t1, t0_min ) )
    {
@@ -456,9 +424,6 @@ static void tcx_ltp_pitch_search_fx(
            }
        }
    }
    }
#endif // !FIX_2479_HARM_PITCH_GAIN


    IF( GE_16( t1, pitfr1 ) )
    {
@@ -729,7 +694,7 @@ void tcx_ltp_encode_fx(
#ifndef FIX_2479_HARM_PITCH_GAIN
        tcx_ltp_pitch_search( Top, pitch_int, pitch_fr, &ltp_param[1], &norm_corr, L_frame, wsp, pitmin, pitfr1, pitfr2, pitmax, pitres );
#else
        tcx_ltp_pitch_search_fx( Top, pitch_int, pitch_fr, &ltp_param[1], &norm_corr, L_frame, wsp, pitmin, pitfr1, pitfr2, pitmax, pitres, 1, &border_case, EVS_MONO );
        tcx_ltp_pitch_search_fx( Top, pitch_int, pitch_fr, &ltp_param[1], &norm_corr, L_frame, wsp, pitmin, pitfr1, pitfr2, pitmax, pitres, 0, &border_case );
#endif // !FIX_2479_HARM_PITCH_GAIN


@@ -1032,7 +997,7 @@ void tcx_ltp_encode_ivas_fx(
#ifndef FIX_2479_HARM_PITCH_GAIN
                tcx_ltp_pitch_search_ivas_fx( shr( add( Top[0], Top[1] ), 1 ), &hTcxEnc->tcxltp_pitch_int, &hTcxEnc->tcxltp_pitch_fr, &ltp_param[1], &norm_corr_fx, L_frame, wsp_fx, st->pit_min, st->pit_fr1, st->pit_fr2, st->pit_max, st->pit_res_max, 1, &border_case );
#else
                tcx_ltp_pitch_search_fx( shr( add( Top[0], Top[1] ), 1 ), &hTcxEnc->tcxltp_pitch_int, &hTcxEnc->tcxltp_pitch_fr, &ltp_param[1], &norm_corr_fx, L_frame, wsp_fx, st->pit_min, st->pit_fr1, st->pit_fr2, st->pit_max, st->pit_res_max, 1, &border_case, element_mode );
                tcx_ltp_pitch_search_fx( shr( add( Top[0], Top[1] ), 1 ), &hTcxEnc->tcxltp_pitch_int, &hTcxEnc->tcxltp_pitch_fr, &ltp_param[1], &norm_corr_fx, L_frame, wsp_fx, st->pit_min, st->pit_fr1, st->pit_fr2, st->pit_max, st->pit_res_max, 1, &border_case );
#endif // !FIX_2479_HARM_PITCH_GAIN
            }
            ELSE
@@ -1048,7 +1013,7 @@ void tcx_ltp_encode_ivas_fx(
#ifndef FIX_2479_HARM_PITCH_GAIN
                    tcx_ltp_pitch_search_ivas_fx( Top[i], &pitch_int_2[i], &pitch_fr_2[i], &pit_param_2[i], &norm_corr_2_fx[i], L_frame, wsp_fx, st->pit_min, st->pit_fr1, st->pit_fr2, st->pit_max, st->pit_res_max, 1, &border_case );
#else
                    tcx_ltp_pitch_search_fx( Top[i], &pitch_int_2[i], &pitch_fr_2[i], &pit_param_2[i], &norm_corr_2_fx[i], L_frame, wsp_fx, st->pit_min, st->pit_fr1, st->pit_fr2, st->pit_max, st->pit_res_max, 1, &border_case, element_mode );
                    tcx_ltp_pitch_search_fx( Top[i], &pitch_int_2[i], &pitch_fr_2[i], &pit_param_2[i], &norm_corr_2_fx[i], L_frame, wsp_fx, st->pit_min, st->pit_fr1, st->pit_fr2, st->pit_max, st->pit_res_max, 1, &border_case );
#endif // !FIX_2479_HARM_PITCH_GAIN
                }

@@ -1074,6 +1039,17 @@ void tcx_ltp_encode_ivas_fx(
        }
        ELSE
        {
#ifdef FIX_2479_HARM_PITCH_GAIN
            Word16 check_border_case;
            IF( GT_16( element_mode, EVS_MONO ) )
            {
                check_border_case = 1;
            }
            ELSE
            {
                check_border_case = 0;
            }
#else
            Word16 tmp;
            IF( GT_16( element_mode, EVS_MONO ) )
            {
@@ -1083,11 +1059,12 @@ void tcx_ltp_encode_ivas_fx(
            {
                tmp = 0;
            }
#endif
            move16();
#ifndef FIX_2479_HARM_PITCH_GAIN
            tcx_ltp_pitch_search_ivas_fx( Top[1], &hTcxEnc->tcxltp_pitch_int, &hTcxEnc->tcxltp_pitch_fr, &ltp_param[1], &norm_corr_fx, L_frame, wsp_fx, st->pit_min, st->pit_fr1, st->pit_fr2, st->pit_max, st->pit_res_max, tmp, &border_case );
#else
            tcx_ltp_pitch_search_fx( Top[1], &hTcxEnc->tcxltp_pitch_int, &hTcxEnc->tcxltp_pitch_fr, &ltp_param[1], &norm_corr_fx, L_frame, wsp_fx, st->pit_min, st->pit_fr1, st->pit_fr2, st->pit_max, st->pit_res_max, tmp, &border_case, element_mode );
            tcx_ltp_pitch_search_fx( Top[1], &hTcxEnc->tcxltp_pitch_int, &hTcxEnc->tcxltp_pitch_fr, &ltp_param[1], &norm_corr_fx, L_frame, wsp_fx, st->pit_min, st->pit_fr1, st->pit_fr2, st->pit_max, st->pit_res_max, check_border_case, &border_case );
#endif // !FIX_2479_HARM_PITCH_GAIN
        }