Commit e42b52a2 authored by vaclav's avatar vaclav
Browse files

Merge branch 'voiceage/harm_gsc' of...

Merge branch 'voiceage/harm_gsc' of https://forge.3gpp.org/rep/sa4/audio/ivas-basop into voiceage/harm_gsc
parents b51ba8ed a8b5b655
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1020,7 +1020,11 @@ void highband_exc_dct_in_fx(
#endif


#ifdef FIX_1904_HARM_GSC_ENC
void highband_exc_dct_in_fx(
#else
void highband_exc_dct_in_ivas_fx(
#endif
    const Word32 core_brate,         /* i  : core bitrate                            */
    const Word16 *mfreq_bindiv,      /* i  : bin per bands tables                    */
    Word16 last_bin,                 /* i  : last bin of bit allocation              */
+33 −2
Original line number Diff line number Diff line
@@ -5079,8 +5079,6 @@ void highband_exc_dct_in_fx(
    const Word16 element_mode,   /* i  : IVAS element mode                       */
    const Word16 GSC_IVAS_mode   /* i  : GSC IVAS mode                           */
);
#endif
void highband_exc_dct_in_ivas_fx(
    const Word32 core_brate,         /* i  : core bitrate                            */
    const Word16 *mfreq_bindiv,      /* i  : bin per bands tables                    */
@@ -5112,6 +5110,39 @@ void highband_exc_dct_in_ivas_fx(
    const Word16 element_mode,   /* i  : IVAS element mode                       */
    const Word16 GSC_IVAS_mode   /* i  : GSC IVAS mode                           */
);
#else
void highband_exc_dct_in_fx(
    const Word32 core_brate,         /* i  : core bitrate                            */
    const Word16 *mfreq_bindiv,      /* i  : bin per bands tables                    */
    Word16 last_bin,                 /* i  : last bin of bit allocation              */
    Word16 Diff_len,                 /* i  : number of bin before cut-off frequency  */
    Word16 noise_lev,                /* i  : pulses dynamic                          */
    Word16 pit_band_idx,             /* i  : bin position of the cut-off frequency   */
    Word16 *exc_diffQ,               /* i  : frequency coefficients of per band      */
    Word16 *seed_tcx,                /* i  : Seed for noise                          */
    Word16 *Ener_per_bd_iQ,          /* i  : Quantized energy of targeted vector     */
    Word16 nb_subfr,                 /* i  : Number of subframe considered           */
    Word16 *exc_dct_in,              /* o  : dct of residual signal                  */
    Word16 last_coder_type,          /* i  : coding type of last frame               */
    Word16 *bitallocation_band,      /* i  : bit allocation flag of each band        */
    const Word16 *lsf_new,           /* i  : LSFs at the end of the frame            */
    Word16 *last_exc_dct_in,         /* i  : dct of residual signal of last frame    */
    Word16 *last_ener,               /* i  : frequency energy  of last frame         */
    Word16 *last_bitallocation_band, /* i  : bit allocation flag of each band  of last frame   */
    Word16 *bitallocation_exc,       /* i  : flag of decoded coefficients            */
    Word16 bfi,                      /* i  : bad frame indicator                     */
    const Word16 coder_type,         /* i  : coder type                              */
    Word16 bwidth,
    Word16 *exc_wo_nf, /* o  : temporal excitation (in f domain) without noisefill   */
    Word16 Qexc_diffQ,
    Word16 *Q_exc,
    const Word16 GSC_noisy_speech,
    Word16 *lt_ener_per_band_fx, /* i/o: Average per band energy                 */
    const Word16 L_frame,        /* i  : frame length                            */
    const Word16 element_mode,   /* i  : IVAS element mode                       */
    const Word16 GSC_IVAS_mode   /* i  : GSC IVAS mode                           */
);
#endif
void lsf_dec_bfi(
    const Word16 codec_mode,      /* i: : codec mode: MODE1 | MODE2              */
+7 −2
Original line number Diff line number Diff line
@@ -860,12 +860,17 @@ void gsc_dec_fx(
    /*--------------------------------------------------------------------------------------*
     * Estimate noise level
     *--------------------------------------------------------------------------------------*/

#ifdef FIX_1904_HARM_GSC_ENC
    highband_exc_dct_in_fx( st_fx->core_brate, mfreq_bindiv_loc, *last_bin, Diff_len, hGSCDec->noise_lev, pit_band_idx, exc_diffQ,
                            &hGSCDec->seed_tcx, Ener_per_bd_iQ, nb_subfr, exc_dct_in, st_fx->last_coder_type, bitallocation_band, lsf_new,
                            hGSCDec->last_exc_dct_in_fx, &hGSCDec->last_ener_fx, hGSCDec->last_bitallocation_band, bitallocation_exc, st_fx->bfi, coder_type,
                            st_fx->bwidth, exc_wo_nf, Qexc_diffQ, Q_exc, st_fx->GSC_noisy_speech, hGSCDec->lt_ener_per_band_fx, st_fx->L_frame, st_fx->element_mode, st_fx->GSC_IVAS_mode );
#else
    highband_exc_dct_in_ivas_fx( st_fx->core_brate, mfreq_bindiv_loc, *last_bin, Diff_len, hGSCDec->noise_lev, pit_band_idx, exc_diffQ,
                                 &hGSCDec->seed_tcx, Ener_per_bd_iQ, nb_subfr, exc_dct_in, st_fx->last_coder_type, bitallocation_band, lsf_new,
                                 hGSCDec->last_exc_dct_in_fx, &hGSCDec->last_ener_fx, hGSCDec->last_bitallocation_band, bitallocation_exc, st_fx->bfi, coder_type,
                                 st_fx->bwidth, exc_wo_nf, Qexc_diffQ, Q_exc, st_fx->GSC_noisy_speech, hGSCDec->lt_ener_per_band_fx, st_fx->L_frame, st_fx->element_mode, st_fx->GSC_IVAS_mode );

#endif
    exc_dct_in[0] = 0;
    move16();

+6 −6
Original line number Diff line number Diff line
@@ -385,7 +385,7 @@ void encod_audio_fx(
#ifdef FIX_1904_HARM_GSC_ENC
    IF( NE_16( st_fx->element_mode, EVS_MONO ) )
    {
        Scale_sig( exc, st_fx->L_frame, sub( Q_new, Q_exc ) ); /* TV This could probably be removed, tbc */
        Scale_sig( exc, st_fx->L_frame, sub( Q_new, Q_exc ) ); /* TV This could probably be removed, but won't be BE */
        Scale_sig( exc_wo_nf, st_fx->L_frame, sub( Q_new, Q_exc ) );
    }
#endif
@@ -993,7 +993,7 @@ void gsc_enc_fx(
        i--;
    }
#ifdef FIX_1904_HARM_GSC_ENC
    IF( NE_16( st_fx->element_mode, EVS_MONO ) ) /* This could be harmonized, but won't be mathematically BE */
    IF( NE_16( st_fx->element_mode, EVS_MONO ) ) /* This could be harmonized, but won't be 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
@@ -1170,7 +1170,7 @@ void gsc_enc_fx(
    }

#ifdef FIX_1904_HARM_GSC_ENC
    IF( NE_16( st_fx->element_mode, EVS_MONO ) ) /* This could be harmonized, but won't be mathematically BE */
    IF( NE_16( st_fx->element_mode, EVS_MONO ) ) /* This could be harmonized, but won't be BE */
    {
        Word16 Q_exc_new = s_min( *Q_exc, hGSCEnc->Q_last_exc_dct_in );
        IF( NE_16( Q_exc_new, hGSCEnc->Q_last_exc_dct_in ) )
@@ -1193,7 +1193,7 @@ void gsc_enc_fx(
     *--------------------------------------------------------------------------------------*/

#ifdef FIX_1904_HARM_GSC_ENC
    highband_exc_dct_in_ivas_fx( st_fx->core_brate, mfreq_bindiv_loc, last_bin, Diff_len, hGSCEnc->noise_lev, tmp_band, exc_diffQ /* Q12 */, &hGSCEnc->seed_tcx, Ener_per_bd_iQ, nb_subfr, exc_dct_in /* Q_exc */,
    highband_exc_dct_in_fx( st_fx->core_brate, mfreq_bindiv_loc, last_bin, Diff_len, hGSCEnc->noise_lev, tmp_band, exc_diffQ /* Q12 */, &hGSCEnc->seed_tcx, Ener_per_bd_iQ, nb_subfr, exc_dct_in /* Q_exc */,
                            st_fx->last_coder_type, bitallocation_band, lsf_new /* x2.56 */, hGSCEnc->last_exc_dct_in_fx /* Q_exc */, &hGSCEnc->last_ener_fx /* Q0 */, hGSCEnc->last_bitallocation_band, bitallocation_exc, 0, st_fx->coder_type,
                            st_fx->bwidth, exc_wo_nf, Q_concat, Q_exc, st_fx->GSC_noisy_speech, NULL, st_fx->L_frame, st_fx->element_mode, st_fx->GSC_IVAS_mode );
#else