Commit 3f91f622 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'VoiceAge/HRacelp_test' into 'main'

possible fix to 1421 [allow regression]

See merge request !1387
parents 6052bce8 38a198c4
Loading
Loading
Loading
Loading
Loading
+90 −87
Original line number Diff line number Diff line
@@ -84,4 +84,7 @@
//#define HARM_SCE_INIT
#define DIV32_OPT_NEWTON                               /* FhG: faster 32 by 32 bit division */ 
#define	MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE /* FhG: reduce WMOPS of Cy calculation in ivas_param_mc_param_est_enc_fx() by using 64 Bit addition. Obsoletes IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE. */

#define TEST_HR

#endif
+21 −1
Original line number Diff line number Diff line
@@ -518,7 +518,12 @@ void encod_gen_voic_ivas_fx(
    set16_fx( code_preQ_fx, 0, L_SUBFR );

    shift_wsp = add( Q_new, shift );

#ifdef TEST_HR
    if ( LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) )
    {
        shift_wsp = sub( shift_wsp, 1 );
    }
#endif
    /* set and write harmonicity flag */
    harm_flag_acelp = 0;
    move16();
@@ -621,18 +626,33 @@ void encod_gen_voic_ivas_fx(

        IF( LE_32( st_fx->core_brate, ACELP_8k00 ) )
        {
#ifdef TEST_HR
            gain_enc_lbr_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->coder_type, i_subfr_fx, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx,
                                  &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, gc_mem, gp_mem, clip_gain_fx, L_SUBFR );
#else
            gain_enc_lbr_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->coder_type, i_subfr_fx, xn_fx, y1_fx, sub( shift_wsp, 1 ), y2_fx, code_fx,
                                  &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, gc_mem, gp_mem, clip_gain_fx, L_SUBFR );
#endif
        }
        ELSE IF( GT_32( st_fx->core_brate, ACELP_32k ) )
        {
#ifdef TEST_HR
            gain_enc_SQ_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr_fx, xn_fx, y1_fx, y2_fx, code_fx, Es_pred_fx,
                                 &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx, shift_wsp );
#else
            gain_enc_SQ_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr_fx, xn_fx, y1_fx, y2_fx, code_fx, Es_pred_fx,
                                 &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx, sub( shift_wsp, 1 ) );
#endif
        }
        ELSE
        {
#ifdef TEST_HR
            gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, i_subfr_fx, -1, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx, Es_pred_fx,
                                    &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx );
#else
            gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, i_subfr_fx, -1, xn_fx, y1_fx, sub( shift_wsp, 1 ), y2_fx, code_fx, Es_pred_fx,
                                    &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx );
#endif
        }
        IF( st_fx->Opt_SC_VBR )
        {
+27 −2
Original line number Diff line number Diff line
@@ -520,7 +520,12 @@ Word16 encod_tran_ivas_fx(
    move16();
    set16_fx( code_preQ, 0, L_SUBFR );
    shift_wsp = add( Q_new, shift );

#ifdef TEST_HR
    if ( LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) )
    {
        shift_wsp = sub( shift_wsp, 1 );
    }
#endif
    /*----------------------------------------------------------------*
     * ACELP subframe loop
     *----------------------------------------------------------------*/
@@ -540,8 +545,11 @@ Word16 encod_tran_ivas_fx(

        q_h1 = sub( 14, norm_s( h1[0] ) );
        Copy_Scale_sig( h1, h2_fx, L_SUBFR, sub( 11, q_h1 ) ); /*Q11*/
#ifdef TEST_HR
        Scale_sig( h1, L_SUBFR, sub( 14, q_h1 ) );
#else
        Scale_sig( h1, L_SUBFR, sub( 13, q_h1 ) );

#endif
        /* scaling of xn[] to limit dynamic at 12 bits */
        Scale_sig( xn, L_SUBFR, shift );

@@ -559,7 +567,9 @@ Word16 encod_tran_ivas_fx(

        IF( GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) )
        {
#ifndef TEST_HR
            Scale_sig( h1, L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */
#endif
            transf_cdbk_enc_ivas_fx( st_fx, 0, i_subfr, cn, exc_fx, p_Aq, Aw_fx, h1, xn, xn2, y1, y2, Es_pred_fx,
                                     &gain_pit, gain_code, g_corr, clip_gain, &gain_preQ, code_preQ, unbits, Q_new, shift );
        }
@@ -587,22 +597,37 @@ Word16 encod_tran_ivas_fx(
        IF( Jopt_flag == 0 )
        {
            /* SQ gain_code */
#ifdef TEST_HR
            gain_enc_tc_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr, xn, y2, code, Es_pred_fx,
                                 &gain_pit, &gain_code, &gain_inov, &norm_gain_code, shift_wsp );
#else
            gain_enc_tc_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr, xn, y2, code, Es_pred_fx,
                                 &gain_pit, &gain_code, &gain_inov, &norm_gain_code, sub( shift_wsp, 1 ) );
#endif
        }
        ELSE
        {
            IF( GT_32( st_fx->core_brate, ACELP_32k ) )
            {
                /* SQ gain_pit and gain_code */
#ifdef TEST_HR
                gain_enc_SQ_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr, xn, y1, y2, code, Es_pred_fx,
                                     &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain, shift_wsp );
#else
                gain_enc_SQ_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr, xn, y1, y2, code, Es_pred_fx,
                                     &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain, sub( shift_wsp, 1 ) );
#endif
            }
            ELSE
            {
                /* VQ gain_pit and gain_code */
#ifdef TEST_HR
                gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame_fx, i_subfr, tc_subfr, xn, y1, shift_wsp, y2, code, Es_pred_fx,
                                        &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain );
#else
                gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame_fx, i_subfr, tc_subfr, xn, y1, sub( shift_wsp, 1 ), y2, code, Es_pred_fx,
                                        &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain );
#endif
            }
        }
        gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit, st_fx->clip_var_fx );
+12 −0
Original line number Diff line number Diff line
@@ -1423,7 +1423,11 @@ void transition_enc_ivas_fx(
                *clip_gain = gp_clip_fx( st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx, i_subfr, TRANSITION, xn_fx, gp_cl_fx, ( Q_new + shift - 1 ) );
                move16();

#ifdef TEST_HR
                Copy( h1_fx, h1_fx_q15, L_SUBFR + ( M + 1 ) );
#else
                Copy_Scale_sig( h1_fx, h1_fx_q15, L_SUBFR + ( M + 1 ), 1 );
#endif
                lp_select = lp_filt_exc_enc_ivas_fx( MODE1, TRANSITION, i_subfr, exc_fx, h1_fx_q15,
                                                     xn_fx, y1_fx, xn2_fx, L_SUBFR, st_fx->L_frame, g_corr_fx, *clip_gain, gain_pit_fx, &lp_flag );

@@ -1660,7 +1664,11 @@ void transition_enc_ivas_fx(
                *clip_gain = gp_clip_fx( st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx, i_subfr, TRANSITION, xn_fx, gp_cl_fx, Q_new );
                move16();

#ifdef TEST_HR
                Copy( h1_fx, h1_fx_q15, L_SUBFR + ( M + 1 ) );
#else
                Copy_Scale_sig( h1_fx, h1_fx_q15, L_SUBFR + ( M + 1 ), 1 );
#endif
                lp_select = lp_filt_exc_enc_ivas_fx( MODE1, TRANSITION, i_subfr, exc_fx, h1_fx_q15,
                                                     xn_fx, y1_fx, xn2_fx, L_SUBFR, st_fx->L_frame, g_corr_fx, *clip_gain, gain_pit_fx, &lp_flag );
                IF( EQ_16( lp_flag, NORMAL_OPERATION ) )
@@ -2082,7 +2090,11 @@ static void tc_enc_ivas_fx(
    /*--------------------------------------------------------------*
     * compute glottal-shape codebook excitation
     *--------------------------------------------------------------*/
#ifdef TEST_HR
    Copy( h1, h1_fx, L_SUBFR + ( M + 1 ) );
#else
    Copy_Scale_sig( h1, h1_fx, L_SUBFR + ( M + 1 ), 1 );
#endif
    /* create filtered glottal codebook contribution */
    conv_fx( &exc_fx[i_subfr], h1_fx, yy1_fx, L_SUBFR );