Commit 5f51c480 authored by vaillancour's avatar vaillancour
Browse files

Merge branch '1904-removing-encoder-acelp-bit-exact-code-duplication' into...

Merge branch '1904-removing-encoder-acelp-bit-exact-code-duplication' into 1905-integrate-acelp-evs-function-that-introduces-with-minor-rounding-differences
parents 33d9c411 5369ebf5
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -396,7 +396,7 @@ ivas_error acelp_core_enc_fx(
#else
            config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate,
                              st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, st_fx->inactive_coder_type_flag,
                              tc_subfr_fx, 0, &nb_bits, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_fr_cnt_fx,
                              tc_subfr_fx, 0, &nb_bits, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt,
                              tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode );
#endif
        }
@@ -469,7 +469,7 @@ ivas_error acelp_core_enc_fx(
#else
            config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame,
                              -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, tc_subfr_fx, 1, NULL, unbits_fx, st_fx->element_mode, &uc_two_stage_flag,
                              tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_fr_cnt_fx, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode );
                              tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode );
#endif
        }

@@ -527,7 +527,7 @@ ivas_error acelp_core_enc_fx(
#else
                config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame,
                                  -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, st_fx->inactive_coder_type_flag, tc_subfr_fx, 0, &nb_bits, unbits_fx, 0, &uc_two_stage_flag, 0, 0,
                                  st_fx->idchan, st_fx->active_fr_cnt_fx, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode );
                                  st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode );
#endif

                /* redo LSF quantization */
+14 −12
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ void acelp_core_switch_enc_fx(
                      GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ );
#else
    config_acelp1_fx( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot,
                      GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ );
                      GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ );
#endif

    encod_gen_voic_core_switch_fx( st_fx, st_fx->last_L_frame, inp, Aq, A, T_op, exc, cbrate, shift, Q_new );
@@ -253,7 +253,7 @@ void acelp_core_switch_enc_ivas_fx(
    config_acelp1_fx( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ );
#else
    config_acelp1_fx( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot,
                      GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ );
                      GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ );
#endif

    encod_gen_voic_core_switch_ivas_fx( st_fx, st_fx->last_L_frame, inp, Aq, A, T_op, exc, cbrate, shift, Q_new );
@@ -414,7 +414,8 @@ static void encod_gen_voic_core_switch_fx(
    pitch = pit_encode_fx( hBstr,
                           st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/
#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR
                                   , st_fx->element_mode, Q_new
                           ,
                           st_fx->element_mode, Q_new
#endif
    ); /* Q6 */

@@ -629,7 +630,8 @@ static void encod_gen_voic_core_switch_ivas_fx(
    pitch = pit_encode_fx( hBstr,
                           st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/
#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR
                           , st_fx->element_mode, Q_new
                           ,
                           st_fx->element_mode, Q_new
#endif
    );                                                                                                                                        /* Q6 */
#endif
+10 −4
Original line number Diff line number Diff line
@@ -14,8 +14,9 @@
 * Local prototypes
 *-------------------------------------------------------------------*/
static void wrte_cv( BSTR_ENC_HANDLE hBstr, const Word16 nq, const Word16 i_ind, const Word16 kv_ind, UWord16 I, Word16 kv[], Word16 *bits );
#ifndef REUSE_EVS_BE_ACELP_AVQ
static void wrte_cv_ivas_fx( BSTR_ENC_HANDLE hBstr, const Word16 nq, const Word16 i_ind, const Word16 kv_ind, UWord16 I, Word16 kv[], Word16 *bits );

#endif
/*-------------------------------------------------------------------*
 * Function AVQ_cod()                                                *
 *                                                                   *
@@ -470,7 +471,11 @@ void AVQ_encmux_fx(
                bitsMod = 0;
                move16();
            }
#ifdef REUSE_EVS_BE_ACELP_AVQ
            ELSE IF( GT_16( nq_est, 4 ) && ( ( bitsMod == 0 && GT_16( nullVec, 3 ) && LT_16( nullVec, 6 ) ) || ( EQ_16( bitsMod, 4 ) && EQ_16( nullVec, 5 ) ) ) && nq[svOrder[Nsvm2]] == 0 ) /* wasted bits 4, 5 for nq 6,7..*/
#else
            ELSE IF( nq_est > 4 && ( ( bitsMod == 0 && GT_16( nullVec, 3 ) && GT_16( nullVec, 6 ) ) || ( EQ_16( bitsMod, 4 ) && EQ_16( nullVec, 5 ) ) ) && nq[svOrder[Nsvm2]] == 0 ) /* wasted bits 4, 5 for nq 6,7..*/
#endif
            {
                overflow = 0;
                move16();
@@ -857,7 +862,7 @@ void AVQ_encmux_ivas_fx(
                bits = sub( bits, 1 );
            }

            wrte_cv_ivas_fx( hBstr, nq[k], i_ind, kv_ind, I[k], &kv[k * 8], &bits );
            wrte_cv( hBstr, nq[k], i_ind, kv_ind, I[k], &kv[k * 8], &bits );
        }
    } /* for */
    /* Bit Saving Solution */
@@ -1015,7 +1020,7 @@ void AVQ_encmux_ivas_fx(
        move16();

        /* write codebook indices (rank I and event. Voronoi index kv) */
        wrte_cv_ivas_fx( hBstr, nq[i], i_ind, kv_ind, I[i], &kv[i * 8], &bits );
        wrte_cv( hBstr, nq[i], i_ind, kv_ind, I[i], &kv[i * 8], &bits );

        bits = sub( bits, dummy_bits );

@@ -1184,7 +1189,7 @@ static void wrte_cv(
    move16();
    return;
}

#ifndef REUSE_EVS_BE_ACELP_AVQ
static void wrte_cv_ivas_fx(
    BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle         */
    const Word16 nq,       /* i  : AVQ nq index                     */
@@ -1244,3 +1249,4 @@ static void wrte_cv_ivas_fx(
    move16();
    return;
}
#endif
+0 −5
Original line number Diff line number Diff line
@@ -207,11 +207,6 @@ void init_coder_ace_plus_fx(
    move16();
    st->tfa_flag = 0;
    move16();
    /* Initialize DTX */
    IF( st->ini_frame == 0 )
    {
        vad_init_fx( &st->vad_st );
    }

    st->glr = 0;
    move16();
+5 −5
Original line number Diff line number Diff line
@@ -656,7 +656,7 @@ void dtx_fx(
    /* Initialization */
    IF( st_fx->ini_frame == 0 )
    {
        st_fx->active_fr_cnt_fx = CNG_TYPE_HO;
        st_fx->active_cnt = CNG_TYPE_HO;
        move16();

        st_fx->cng_type = FD_CNG;
@@ -756,7 +756,7 @@ void dtx_fx(
        st_fx->fd_cng_reset_flag == 0 )
    {
        /* reset counter */
        st_fx->active_fr_cnt_fx = 0;
        st_fx->active_cnt = 0;
        move16();

        IF( st_fx->Opt_AMR_WB )
@@ -878,7 +878,7 @@ void dtx_fx(
            move16(); /* reset the counter of CNG frames for averaging */
        }
        test();
        IF( GE_16( st_fx->active_fr_cnt_fx, CNG_TYPE_HO ) && st_fx->Opt_AMR_WB == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) )
        IF( GE_16( st_fx->active_cnt, CNG_TYPE_HO ) && st_fx->Opt_AMR_WB == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) )
        {
            IF( EQ_16( st_fx->element_mode, IVAS_SCE ) )
            {
@@ -911,8 +911,8 @@ void dtx_fx(
            st_fx->cng_type = LP_CNG;
            move16();
        }
        st_fx->active_fr_cnt_fx = add( st_fx->active_fr_cnt_fx, 1 );
        st_fx->active_fr_cnt_fx = s_min( st_fx->active_fr_cnt_fx, 200 );
        st_fx->active_cnt = add( st_fx->active_cnt, 1 );
        st_fx->active_cnt = s_min( st_fx->active_cnt, 200 );
    }

    /*------------------------------------------------------------------------*
Loading