Commit 3768210c authored by Manuel Jander's avatar Manuel Jander
Browse files

Merge remote-tracking branch 'origin' into 3gpp_issue_1348_fix

parents 0bab7023 f48701fc
Loading
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -6366,7 +6366,7 @@ void wb_tbe_extras_reset_synth_fx(

void elliptic_bpf_48k_generic_fx(
#ifdef FIX_1439_SPEEDUP_SIMPLIFY_elliptic_bpf_48k_generic_STAGE2
    int16_t element_mode,
    const int16_t element_mode,
#endif
#ifdef FIX_1439_SPEEDUP_SIMPLIFY_elliptic_bpf_48k_generic
    Word16 IsUpsampled3,
@@ -7025,8 +7025,8 @@ void synthesise_fb_high_band_fx(
    {
#ifdef FIX_1439_SPEEDUP_synthesise_fb_high_band_fx
        L_tmp = Mult_32_16( ratio2, tmp[i] ); /* Q(16-exp+exp_tmp-15 = 1-exp+exp_tmp) */
        Word32 L_tmp32;
        Word16 tmp16;
        Word32 L_tmp32 = L_add( 0, 0 );
        Word16 tmp16 = add( 0, 0 );

        // if (L_tmp < 0)
        if ( L_tmp < 0 )
+2 −0
Original line number Diff line number Diff line
@@ -377,6 +377,8 @@ ivas_error init_encoder_fx(
        move16();
        st_fx->hVAD->L_snr_sum_vad_fx = 0;
        move32();
        st_fx->hVAD->q_L_snr_sum_vad = Q31;
        move16();
    }
    ELSE
    {
+12 −23
Original line number Diff line number Diff line
@@ -223,6 +223,7 @@ ivas_error pre_proc_front_ivas_fx(
    Word16 res_cod_SNR_M_fx_e[STEREO_DFT_BAND_MAX];
    Word16 Qfact_PS, q_lf_E_fx;
    Word16 enerBuffer_fx_exp_buf[CLDFB_NO_CHANNELS_MAX];
    Word32 bckr_temp[NB_BANDS];
#ifdef DEBUG_MODE_INFO
    Word32 *in_buff_temp;
    Word16 in_q_temp;
@@ -781,21 +782,9 @@ ivas_error pre_proc_front_ivas_fx(
        move16();
    }

    Word16 scale = add( L_norm_arr( st->hNoiseEst->enrO_fx, NB_BANDS ), st->hNoiseEst->q_enrO );
    scale = s_min( scale, fr_bands_fx_q );

    scale_sig32( st->hNoiseEst->enrO_fx, NB_BANDS, sub( scale, st->hNoiseEst->q_enrO ) );
    st->hNoiseEst->q_enrO = scale;
    move16();

    scale_sig32( fr_bands_fx, 2 * NB_BANDS, sub( scale, fr_bands_fx_q ) );
    fr_bands_fx_q = scale;
    move16();

    st->vad_flag = wb_vad_ivas_fx( st, fr_bands_fx, fr_bands_fx_q, &i, &i, &i, &snr_sum_he_fx, &localVAD_HE_SAD,
                                   &( st->flag_noisy_speech_snr ), NULL, NULL, -MAX_16, -MAX_16 ); //-100000f == max 16bit float
    move16();

#ifdef DEBUG_FORCE_DIR
    if ( st->force_dir[0] != '\0' )
    {
@@ -919,13 +908,13 @@ ivas_error pre_proc_front_ivas_fx(
     *----------------------------------------------------------------*/

    noise_est_down_ivas_fx( fr_bands_fx, fr_bands_fx_q, st->hNoiseEst->bckr_fx, &st->hNoiseEst->q_bckr, tmpN_fx, &q_tmpN, tmpE_fx, &q_tmpE, st->min_band, st->max_band,
                            &st->hNoiseEst->totalNoise_fx, Etot_fx, &st->hNoiseEst->Etot_last_32fx, &st->hNoiseEst->Etot_v_h2_fx );
                            &st->hNoiseEst->totalNoise_fx, Etot_fx, &st->hNoiseEst->Etot_last_32fx, &st->hNoiseEst->Etot_v_h2_32fx );

    test();
    IF( lr_vad_enabled && st->idchan == 0 )
    {
        noise_est_down_ivas_fx( fr_bands_LR_fx[0], fr_bands_LR_fx_q[0], hCPE->hFrontVad[0]->hNoiseEst->bckr_fx, &hCPE->hFrontVad[0]->hNoiseEst->q_bckr, tmpN_LR_fx[0], &q_tmpN_LR[0], tmpE_LR_fx[0], &q_tmpE_LR[0], st->min_band, st->max_band, &hCPE->hFrontVad[0]->hNoiseEst->totalNoise_fx, L_deposit_h( Etot_LR_fx[0] ), &hCPE->hFrontVad[0]->hNoiseEst->Etot_last_32fx, &hCPE->hFrontVad[0]->hNoiseEst->Etot_v_h2_fx );
        noise_est_down_ivas_fx( fr_bands_LR_fx[1], fr_bands_LR_fx_q[1], hCPE->hFrontVad[1]->hNoiseEst->bckr_fx, &hCPE->hFrontVad[1]->hNoiseEst->q_bckr, tmpN_LR_fx[1], &q_tmpN_LR[1], tmpE_LR_fx[1], &q_tmpE_LR[1], st->min_band, st->max_band, &hCPE->hFrontVad[1]->hNoiseEst->totalNoise_fx, L_deposit_h( Etot_LR_fx[1] ), &hCPE->hFrontVad[1]->hNoiseEst->Etot_last_32fx, &hCPE->hFrontVad[1]->hNoiseEst->Etot_v_h2_fx );
        noise_est_down_ivas_fx( fr_bands_LR_fx[0], fr_bands_LR_fx_q[0], hCPE->hFrontVad[0]->hNoiseEst->bckr_fx, &hCPE->hFrontVad[0]->hNoiseEst->q_bckr, tmpN_LR_fx[0], &q_tmpN_LR[0], tmpE_LR_fx[0], &q_tmpE_LR[0], st->min_band, st->max_band, &hCPE->hFrontVad[0]->hNoiseEst->totalNoise_fx, L_deposit_h( Etot_LR_fx[0] ), &hCPE->hFrontVad[0]->hNoiseEst->Etot_last_32fx, &hCPE->hFrontVad[0]->hNoiseEst->Etot_v_h2_32fx );
        noise_est_down_ivas_fx( fr_bands_LR_fx[1], fr_bands_LR_fx_q[1], hCPE->hFrontVad[1]->hNoiseEst->bckr_fx, &hCPE->hFrontVad[1]->hNoiseEst->q_bckr, tmpN_LR_fx[1], &q_tmpN_LR[1], tmpE_LR_fx[1], &q_tmpE_LR[1], st->min_band, st->max_band, &hCPE->hFrontVad[1]->hNoiseEst->totalNoise_fx, L_deposit_h( Etot_LR_fx[1] ), &hCPE->hFrontVad[1]->hNoiseEst->Etot_last_32fx, &hCPE->hFrontVad[1]->hNoiseEst->Etot_v_h2_32fx );

        corr_shiftL_fx = correlation_shift_fx( hCPE->hFrontVad[0]->hNoiseEst->totalNoise_fx ); // Q15
        corr_shiftR_fx = correlation_shift_fx( hCPE->hFrontVad[1]->hNoiseEst->totalNoise_fx ); // Q15
@@ -1249,7 +1238,7 @@ ivas_error pre_proc_front_ivas_fx(
     * Update estimated noise energy and voicing cut-off frequency
     *-----------------------------------------------------------------*/

    scale = s_min( Q31, s_min( add( q_tmpN, L_norm_arr( tmpN_fx, NB_BANDS ) ), add( st->hNoiseEst->q_bckr, L_norm_arr( st->hNoiseEst->bckr_fx, NB_BANDS ) ) ) );
    Word16 scale = s_min( Q31, s_min( add( q_tmpN, L_norm_arr( tmpN_fx, NB_BANDS ) ), add( st->hNoiseEst->q_bckr, L_norm_arr( st->hNoiseEst->bckr_fx, NB_BANDS ) ) ) );
    scale = sub( scale, 1 ); // guard bits
    scale_sig32( st->hNoiseEst->bckr_fx, NB_BANDS, sub( scale, st->hNoiseEst->q_bckr ) );
    scale_sig32( tmpN_fx, NB_BANDS, sub( scale, q_tmpN ) );
@@ -1278,7 +1267,7 @@ ivas_error pre_proc_front_ivas_fx(

    noise_est_ivas_fx( st, old_pitch1, tmpN_fx, epsP_fx, extract_h( Etot_fx ), *relE_fx, corr_shift_fx, tmpE_fx, q_tmpE, fr_bands_fx, fr_bands_fx_q, cor_map_sum_fx,
                       &ncharX_fx, &sp_div_fx, &q_sp_div, &non_staX_fx, loc_harm, lf_E_fx, q_lf_E_fx, &st->hNoiseEst->harm_cor_cnt, extract_h( st->hNoiseEst->Etot_l_lp_32fx ),
                       st->hNoiseEst->Etot_v_h2_fx, &st->hNoiseEst->bg_cnt, st->lgBin_E_fx, &dummy_fx, S_map_fx,
                       extract_h( st->hNoiseEst->Etot_v_h2_32fx ), &st->hNoiseEst->bg_cnt, st->lgBin_E_fx, &dummy_fx, S_map_fx,
                       hStereoClassif, NULL, st->ini_frame );

    test();
@@ -1321,14 +1310,14 @@ ivas_error pre_proc_front_ivas_fx(
        noise_est_ivas_fx( st, old_pitch1, tmpN_LR_fx[0], epsP_fx, Etot_LR_fx[0], sub( Etot_LR_fx[0], hCPE->hFrontVad[0]->lp_speech_fx ), corr_shiftL_fx,
                           tmpE_LR_fx[0], q_tmpE_LR[0], fr_bands_LR_fx[0], fr_bands_LR_fx_q[0], &cor_map_sum_LR_fx[0], &ncharX_LR_fx, &sp_div_LR_fx, &q_sp_div_LR,
                           &non_staX_LR_fx, loc_harmLR_fx, lf_E_LR_fx[0], lf_E_LR_fx_q, &hCPE->hFrontVad[0]->hNoiseEst->harm_cor_cnt,
                           extract_h( hCPE->hFrontVad[0]->hNoiseEst->Etot_l_lp_32fx ), hCPE->hFrontVad[0]->hNoiseEst->Etot_v_h2_fx, &hCPE->hFrontVad[0]->hNoiseEst->bg_cnt,
                           extract_h( hCPE->hFrontVad[0]->hNoiseEst->Etot_l_lp_32fx ), extract_h( hCPE->hFrontVad[0]->hNoiseEst->Etot_v_h2_32fx ), &hCPE->hFrontVad[0]->hNoiseEst->bg_cnt,
                           st->lgBin_E_fx, &dummy_fx, S_map_LR_fx, NULL, hCPE->hFrontVad[0], hCPE->hFrontVad[0]->ini_frame );

        /* Note: the index [0] in the last argument is intended, the ini_frame counter is only maintained in the zero-th channel's VAD handle */
        noise_est_ivas_fx( st, old_pitch1, tmpN_LR_fx[1], epsP_fx, Etot_LR_fx[1], sub( Etot_LR_fx[1], hCPE->hFrontVad[1]->lp_speech_fx ), corr_shiftR_fx,
                           tmpE_LR_fx[1], q_tmpE_LR[1], fr_bands_LR_fx[1], fr_bands_LR_fx_q[1], &cor_map_sum_LR_fx[1], &ncharX_LR_fx, &sp_div_LR_fx, &q_sp_div_LR,
                           &non_staX_LR_fx, loc_harmLR_fx, lf_E_LR_fx[1], lf_E_LR_fx_q, &hCPE->hFrontVad[1]->hNoiseEst->harm_cor_cnt,
                           extract_h( hCPE->hFrontVad[1]->hNoiseEst->Etot_l_lp_32fx ), hCPE->hFrontVad[1]->hNoiseEst->Etot_v_h2_fx, &hCPE->hFrontVad[1]->hNoiseEst->bg_cnt,
                           extract_h( hCPE->hFrontVad[1]->hNoiseEst->Etot_l_lp_32fx ), extract_h( hCPE->hFrontVad[1]->hNoiseEst->Etot_v_h2_32fx ), &hCPE->hFrontVad[1]->hNoiseEst->bg_cnt,
                           st->lgBin_E_fx, &dummy_fx, S_map_LR_fx, NULL, hCPE->hFrontVad[1], hCPE->hFrontVad[0]->ini_frame );
    }

@@ -1346,14 +1335,14 @@ ivas_error pre_proc_front_ivas_fx(
     * Find spectral tilt
     * UC and VC frame selection
     *-----------------------------------------------------------------*/

    scale = s_min( Q31, s_min( add( st->hNoiseEst->q_bckr, L_norm_arr( st->hNoiseEst->bckr_fx, NB_BANDS ) ), add( fr_bands_fx_q, L_norm_arr( fr_bands_fx, 2 * NB_BANDS ) ) ) );
    scale_sig32( fr_bands_fx, 2 * NB_BANDS, sub( scale, fr_bands_fx_q ) );
    scale_sig32( st->hNoiseEst->bckr_fx, NB_BANDS, sub( scale, st->hNoiseEst->q_bckr ) );
    st->hNoiseEst->q_bckr = fr_bands_fx_q = scale;
    move16();
    Copy_Scale_sig32( st->hNoiseEst->bckr_fx, bckr_temp, NB_BANDS, sub( scale, st->hNoiseEst->q_bckr ) );
    fr_bands_fx_q = scale;
    move16();

    find_tilt_ivas_fx( fr_bands_fx, fr_bands_fx_q, st->hNoiseEst->bckr_fx, st->hNoiseEst->q_bckr, ee_fx, st->pitch, st->voicing_fx, lf_E_fx, q_lf_E_fx,
    find_tilt_ivas_fx( fr_bands_fx, fr_bands_fx_q, bckr_temp, scale, ee_fx, st->pitch, st->voicing_fx, lf_E_fx, q_lf_E_fx,
                       corr_shift_fx, st->input_bwidth, st->max_band, hp_E_fx, MODE1, &( st->bckr_tilt_lt ), st->Opt_SC_VBR );

    st->coder_type = find_uv_ivas_fx( st, pitch_fr_fx, voicing_fr_fx, inp_12k8_fx, ee_fx, &dE1X_fx, corr_shift_fx, *relE_fx, extract_h( Etot_fx ), hp_E_fx,
+0 −7
Original line number Diff line number Diff line
@@ -336,7 +336,6 @@ ivas_error ivas_cpe_enc_fx(
                                       &q_band_energies_LR, NULL, NULL, NULL, Q_inp, Q_buffer, Q_add, &front_create_flag ) ),
               IVAS_ERR_OK ) )
    {
        pop_wmops();
        return error;
    }

@@ -370,7 +369,6 @@ ivas_error ivas_cpe_enc_fx(
     *----------------------------------------------------------------*/
    IF( ( error = stereo_memory_enc_fx( hCPE, input_Fs, max_bwidth, ivas_format, st_ivas->nchan_transport ) ) != IVAS_ERR_OK )
    {
        pop_wmops();
        return error;
    }

@@ -381,7 +379,6 @@ ivas_error ivas_cpe_enc_fx(

    IF( ( error = stereo_set_tdm_fx( hCPE, input_frame, sts[1]->q_inp32 ) ) != IVAS_ERR_OK )
    {
        pop_wmops();
        return error;
    }

@@ -919,7 +916,6 @@ ivas_error ivas_cpe_enc_fx(
        move16();
        IF( error != IVAS_ERR_OK )
        {
            pop_wmops();
            return error;
        }
    }
@@ -994,7 +990,6 @@ ivas_error ivas_cpe_enc_fx(
            igf = getIgfPresent_fx( sts[n]->element_mode, L_mult0( sts[n]->bits_frame_nominal, FRAMES_PER_SEC ), sts[n]->max_bwidth, sts[n]->rf_mode ); /* Q0 */
            IF( ( error = IGF_Reconfig_fx( &sts[n]->hIGFEnc, igf, 0, L_mult0( sts[n]->bits_frame_nominal, FRAMES_PER_SEC ), sts[n]->max_bwidth, sts[n]->element_mode, sts[n]->rf_mode ) ) != IVAS_ERR_OK )
            {
                pop_wmops();
                return error;
            }
        }
@@ -1023,7 +1018,6 @@ ivas_error ivas_cpe_enc_fx(
            {
                IF( ( error = initMdctItdHandling_fx( hCPE->hStereoMdct, input_Fs ) ) != IVAS_ERR_OK )
                {
                    pop_wmops();
                    return error;
                }
            }
@@ -1200,7 +1194,6 @@ ivas_error ivas_cpe_enc_fx(
    }
    IF( NE_32( ( error = ivas_core_enc_fx( NULL, hCPE, st_ivas->hMCT, n_CoreChannels, old_inp_12k8_16fx, old_inp_16k_16fx, Q_new, ener_fx, A_fx, Aw_fx, epsP_fx, epsP_fx_q, lsp_new_fx, lsp_mid_fx, vad_hover_flag, attack_flag, realBuffer_fx, imagBuffer_fx, q_re_im_buf, old_wsp_fx, e_old_wsp, loc_harm, cor_map_sum_fx, vad_flag_dtx, enerBuffer_fx, enerBuffer_fx_exp, fft_buff_fx, tdm_SM_or_LRTD_Pri, ivas_format, 0 ) ), IVAS_ERR_OK ) )
    {
        pop_wmops();
        return error;
    }

+2 −12
Original line number Diff line number Diff line
@@ -282,16 +282,6 @@ ivas_error front_vad_fx(
            move16();

            /* wb_vad */
            Word16 scale = s_min( q_fr_bands[n], add( hFrontVads[n]->hNoiseEst->q_enrO, L_norm_arr( hFrontVads[n]->hNoiseEst->enrO_fx, NB_BANDS ) ) );

            scale_sig32( hFrontVads[n]->hNoiseEst->enrO_fx, NB_BANDS, sub( scale, hFrontVads[n]->hNoiseEst->q_enrO ) ); // scale
            hFrontVads[n]->hNoiseEst->q_enrO = scale;
            move16();

            scale_sig32( fr_bands_fx[n], 2 * NB_BANDS, sub( scale, q_fr_bands[n] ) ); // scale
            q_fr_bands[n] = scale;
            move16();

            hFrontVad->hVAD->vad_flag = wb_vad_ivas_fx( sts[n], fr_bands_fx[n], q_fr_bands[n], &dummy, &dummy, &dummy, &snr_sum_he_fx,
                                                        &localVAD_HE_SAD[n], &dummy_short, hFrontVad->hVAD, hFrontVad->hNoiseEst,
                                                        hFrontVad->lp_speech_fx, hFrontVad->lp_noise_fx ); // Q0
@@ -613,7 +603,7 @@ ivas_error front_vad_spar_fx(

        Word16 q_tmpN, q_tmpE;
        noise_est_down_ivas_fx( fr_bands_fx[0], q_fr_bands[0], hFrontVad->hNoiseEst->bckr_fx, &hFrontVad->hNoiseEst->q_bckr, tmpN_fx, &q_tmpN, tmpE_fx, &q_tmpE, st->min_band, st->max_band,
                                &hFrontVad->hNoiseEst->totalNoise_fx, L_deposit_h( Etot_fx[0] ) /*q8->q24*/, &hFrontVad->hNoiseEst->Etot_last_32fx, &hFrontVad->hNoiseEst->Etot_v_h2_fx );
                                &hFrontVad->hNoiseEst->totalNoise_fx, L_deposit_h( Etot_fx[0] ) /*q8->q24*/, &hFrontVad->hNoiseEst->Etot_last_32fx, &hFrontVad->hNoiseEst->Etot_v_h2_32fx );

        corr_shift_fx = correlation_shift_fx( hFrontVad->hNoiseEst->totalNoise_fx ); /* Q15 */

@@ -755,7 +745,7 @@ ivas_error front_vad_spar_fx(

        noise_est_ivas_fx( st, old_pitch, tmpN_fx, epsP_fx, Etot_fx[0], sub( Etot_fx[0], hFrontVad->lp_speech_fx ), corr_shift_fx, tmpE_fx,
                           hFrontVad->hNoiseEst->ave_enr_q, fr_bands_fx[0], q_fr_bands[0], &cor_map_sum_fx, NULL, &sp_div_fx, &Q_sp_div, &non_staX_fx, &loc_harm,
                           lf_E_fx[0], q_lf_E[0], &hFrontVad->hNoiseEst->harm_cor_cnt, extract_h( hFrontVad->hNoiseEst->Etot_l_lp_32fx ), hFrontVad->hNoiseEst->Etot_v_h2_fx,
                           lf_E_fx[0], q_lf_E[0], &hFrontVad->hNoiseEst->harm_cor_cnt, extract_h( hFrontVad->hNoiseEst->Etot_l_lp_32fx ), extract_h( hFrontVad->hNoiseEst->Etot_v_h2_32fx ),
                           &hFrontVad->hNoiseEst->bg_cnt, st->lgBin_E_fx, &sp_floor, S_map_fx, NULL, hFrontVad, hFrontVad->ini_frame );

        MVR2R_WORD16( st->pitch, st->pitch, 3 );
Loading