Commit 17dc22a4 authored by vaillancour's avatar vaillancour
Browse files

fix BE issue

parent 31c8476c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -90,7 +90,8 @@
#define HARM_GSC_ENC                                    /* VA: Harmonization of EVS and IVAS GSC code */
#define HARM_GSC_ENC_PART2
#define HARM_GSC_ENC_PART3
#define BE_COMPL_RED
#define HARM_GSC_ENC_PART4

/* #################### End BE switches ################################## */

/* #################### Start NON-BE switches ############################ */
+0 −6
Original line number Diff line number Diff line
@@ -58,14 +58,8 @@ void pred_lt4_ivas_fx(
            FOR( i = 0; i < nb_coef; i++ )
            {
                /*s += (*x1--) * (*c1) + (*x2++) * (*c2);*/
#ifdef BE_COMPL_RED
                s64 = W_mac_32_32( s64, L_deposit_l( *x1-- ), ( *c1 ) ); /* Q_exc + Q32 */
                s64 = W_mac_32_32( s64, L_deposit_l( *x2++ ), ( *c2 ) ); /* Q_exc + Q32 */
#else
                s64 = W_mac_32_16( s64, ( *c1 ), *x1-- ); /* Q_exc + Q32 */
                s64 = W_mac_32_16( s64, ( *c2 ), *x2++ ); /* Q_exc + Q32 */

#endif
                c1 += up_sample;
                c2 += up_sample;
            }
+1 −1
Original line number Diff line number Diff line
@@ -1371,7 +1371,7 @@ ivas_error acelp_core_enc_ivas_fx(
        ELSE IF( EQ_16( st->coder_type, AUDIO ) || ( st->coder_type == INACTIVE && st->inactive_coder_type_flag ) )
        {
            /* AUDIO and INACTIVE frames (coded by GSC technology) */
#ifndef HARM_GSC_ENC_PART3
#ifndef HARM_GSC_ENC_PART4
            encod_audio_ivas_fx( st, inp, Aw, Aq, res_fx, syn_fx, exc_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, attack_flag, lsf_new_fx, &tmp_noise_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, Q_new, 0 );
#else
            encod_audio_fx( st, inp, Aw, Aq, res_fx, syn_fx, exc_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, attack_flag, lsf_new_fx, &tmp_noise_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, Q_new, 0 );
+10 −6
Original line number Diff line number Diff line
@@ -888,6 +888,7 @@ void gsc_enc_fx(
#ifdef HARM_GSC_ENC_PART3
    Word32 L_tmp;
    Word16 max_eq = 0;
    Word16 Q_concat = Q_PVQ_OUT;
#endif
    set16_fx( inpulses_fx, 0, NB_SFM );
    set16_fx( imaxpulse_fx, 0, NB_SFM );
@@ -964,13 +965,14 @@ void gsc_enc_fx(
    IF( NE_16( st_fx->element_mode, EVS_MONO ) ) /* This could be harmonized, but won't be mathematically BE */
    {
        mean_gain = gsc_gainQ_ivas_fx( hBstr, st_fx->element_mode, st_fx->idchan, Ener_per_bd_iQ, Ener_per_bd_iQ, brate_intermed_tbl[i], st_fx->coder_type, st_fx->bwidth, st_fx->L_frame, st_fx->tdm_LRTD_flag, st_fx->core_brate );
        *tmp_noise = mult( mean_gain, 20480 ); // 20480 => 10 in Q11
    }
    ELSE
#endif
    {
        mean_gain = gsc_gainQ_fx( hBstr, /*st_fX->element_mode, st_fx->idchan,IVAS_CODE*/ Ener_per_bd_iQ, Ener_per_bd_iQ, brate_intermed_tbl[i], st_fx->coder_type, st_fx->bwidth /*, st_fx->L_frame, st_fx->tdm_LRTD_flag, st_fx->core_brate*/ );
    }
        *tmp_noise = mult_r( 320, mean_gain ); /*10 in Q5  lp_gainc in Q3 */
    }
    move16();

    /*--------------------------------------------------------------------------------------*
@@ -996,7 +998,7 @@ void gsc_enc_fx(
#ifdef HARM_GSC_ENC_PART3
        IF( NE_16( st_fx->element_mode, EVS_MONO ) ) /* This could probably be harmonized */
        {
            Word16 Q_concat = Q12;
            Q_concat = Q12;
            move16();
            bit = sub( bit, pvq_core_enc_ivas_fx( hBstr, concat_in, concat_out, &Q_concat, bit, nb_subbands, gsc_sfm_start, gsc_sfm_end, gsc_sfm_size, bits_per_bands, NULL, inpulses_fx, imaxpulse_fx, ACELP_CORE ) );
        }
@@ -1005,7 +1007,7 @@ void gsc_enc_fx(
        {
            tmp = pvq_core_enc_fx( hBstr, concat_in, concat_out, &Q_tmp, bit, nb_subbands, gsc_sfm_start, gsc_sfm_end,
                                   gsc_sfm_size, bits_per_bands, NULL, inpulses_fx, imaxpulse_fx, ACELP_CORE );
            Scale_sig( concat_out, gsc_sfm_end[nb_subbands - 1], sub( Q_PVQ_OUT, Q_tmp ) ); /* Q_PVQ_OUT */
            Scale_sig( concat_out, gsc_sfm_end[nb_subbands - 1], sub( Q_concat, Q_tmp ) ); /* Q_PVQ_OUT */
            bit = sub( bit, tmp );
        }

@@ -1127,7 +1129,7 @@ void gsc_enc_fx(
    ELSE
#endif
    {
        freq_dnw_scaling_fx( hGSCEnc->cor_strong_limit, st_fx->coder_type, hGSCEnc->noise_lev, st_fx->core_brate, exc_diffQ, Q_PVQ_OUT, st_fx->L_frame );
        freq_dnw_scaling_fx( hGSCEnc->cor_strong_limit, st_fx->coder_type, hGSCEnc->noise_lev, st_fx->core_brate, exc_diffQ, Q_concat /*Q12 or Q10*/, st_fx->L_frame );
    }
#ifdef HARM_GSC_ENC_PART3
    IF( NE_16( st_fx->element_mode, EVS_MONO ) ) /* This could be harmonized, but won't be mathematically BE */
@@ -1264,9 +1266,11 @@ void gsc_enc_ivas_fx(
        tmp_band = hGSCEnc->mem_last_pit_band;
    }
    move16();

#ifdef HARM_GSC_ENC_PART3
    Ener_per_band_comp_fx( exc_diff_fx, Ener_per_bd_iQ_fx, *Q_exc, MBANDS_GN, 1, st->L_frame );
#else
    Ener_per_band_comp_ivas_fx( exc_diff_fx, Ener_per_bd_iQ_fx, *Q_exc, MBANDS_GN, 1, st->L_frame );

#endif
    /*--------------------------------------------------------------------------------------*
     * Gain quantizaion
     *--------------------------------------------------------------------------------------*/