Commit 4d351142 authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_2344_ALIGN_PREPROC

parent 6d597ff1
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -160,11 +160,7 @@ ivas_error ivas_mct_enc(
    const int16_t nb_bits_metadata                              /* i  : number of metadata bits                 */
);

#ifdef FIX_2344_ALIGN_PREPROC
void pre_proc_front_ivas(
#else
ivas_error pre_proc_front_ivas(
#endif
    SCE_ENC_HANDLE hSCE,                                        /* i/o: SCE encoder structure                      */
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure                      */
    const int32_t element_brate,                                /* i  : SCE/CPE element bitrate                    */
@@ -211,11 +207,7 @@ ivas_error pre_proc_front_ivas(
    const int32_t ivas_total_brate                              /* i  : IVAS total bitrate                         */
);

#ifdef FIX_2344_ALIGN_PREPROC
void pre_proc_ivas(
#else
ivas_error pre_proc_ivas(
#endif
    Encoder_State *st,                                          /* i/o: encoder state structure                 */
    const int16_t last_element_mode,                            /* i  : last element mode                       */
    const int32_t element_brate,                                /* i  : element bitrate                         */
@@ -243,11 +235,7 @@ ivas_error pre_proc_ivas(
    const int16_t flag_16k_smc                                  /* i  : flag to indicate if the OL SMC is run at 16 kHz */
);

#ifdef FIX_2344_ALIGN_PREPROC
void ivas_compute_core_buffers(
#else
ivas_error ivas_compute_core_buffers(
#endif
    Encoder_State *st,                                          /* i/o: encoder state structure                 */
    float **inp16k_out,                                         /* o  : ptr. to inp. signal in the current frame*/
    float *old_inp_16k,                                         /* i/o: buffer of old input signal @ 16kHz      */
+0 −1
Original line number Diff line number Diff line
@@ -162,7 +162,6 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define FIX_2344_ALIGN_PREPROC                          /* VA: basop issue 2344: Align pre_proc_ivas() between FLP and BASOP */
#define FIX_FLOAT_1501_UNIT_VALUE_IN_OMASA              /* Nokia: Fix float issue 1501, uninitialized value in ivas_masa_combine_directions for OMASA */
#define FIX_2331_CLANG18_MSAN_UNINIT_VARIABLE           /* FhG: Fix issue 2331: Uninitialized variable */

+0 −7
Original line number Diff line number Diff line
@@ -174,14 +174,7 @@ ivas_error ivas_core_enc(
         * Pre-processing, incl. Decision matrix
         *---------------------------------------------------------------------*/

#ifdef FIX_2344_ALIGN_PREPROC
        pre_proc_ivas( st, last_element_mode, element_brate, ivas_format == SBA_FORMAT ? last_element_brate : element_brate, input_frame, old_inp_12k8[n], old_inp_16k[n], &inp[n], &ener[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], new_inp_resamp16k[n], &Voicing_flag[n], old_wsp[n], loc_harm[n], cor_map_sum[n], vad_flag_dtx[n], enerBuffer[n], fft_buff[n], MCT_flag, vad_hover_flag[n], flag_16k_smc );
#else
        if ( ( error = pre_proc_ivas( st, last_element_mode, element_brate, ivas_format == SBA_FORMAT ? last_element_brate : element_brate, input_frame, old_inp_12k8[n], old_inp_16k[n], &inp[n], &ener[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], new_inp_resamp16k[n], &Voicing_flag[n], old_wsp[n], loc_harm[n], cor_map_sum[n], vad_flag_dtx[n], enerBuffer[n], fft_buff[n], MCT_flag, vad_hover_flag[n], flag_16k_smc ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#endif

        if ( st->element_mode == IVAS_CPE_MDCT || st->element_mode == IVAS_SCE )
        {
+0 −80
Original line number Diff line number Diff line
@@ -51,11 +51,7 @@
 * Decision matrix, Preprocessing at other Fs, core switching decision, ...)
 *--------------------------------------------------------------------*/

#ifdef FIX_2344_ALIGN_PREPROC
void pre_proc_ivas(
#else
ivas_error pre_proc_ivas(
#endif
    Encoder_State *st,                             /* i/o: encoder state structure                 */
    const int16_t last_element_mode,               /* i  : last element mode                       */
    const int32_t element_brate,                   /* i  : element bitrate                         */
@@ -87,15 +83,9 @@ ivas_error pre_proc_ivas(
    float *inp_12k8, *new_inp_12k8, *inp_16k; /* pointers to current frame and new data */
    const float *wsp;                         /* weighted input signal buffer           */
    int32_t sr_core_tmp, total_brate_tmp;
#ifndef FIX_2344_ALIGN_PREPROC
    ivas_error error;
#endif

    push_wmops( "pre_proc" );

#ifndef FIX_2344_ALIGN_PREPROC
    error = IVAS_ERR_OK;
#endif
    /*----------------------------------------------------------------*
     * Initialization
     *----------------------------------------------------------------*/
@@ -359,13 +349,6 @@ ivas_error pre_proc_ivas(
        }
    }

#ifndef FIX_2344_ALIGN_PREPROC
    /* channel-aware mode - due to lack of signaling bit, sharpFlag is 1 always in RF mode */
    if ( st->rf_mode && ( st->coder_type == VOICED || st->coder_type == GENERIC ) )
    {
        st->sharpFlag = 1;
    }
#endif
    /* TD stereo, secondary channel - due to lack of signaling bits, sharpFlag is always 1 */
    if ( element_mode == IVAS_CPE_TD && st->idchan == 1 )
    {
@@ -401,15 +384,7 @@ ivas_error pre_proc_ivas(

    if ( !flag_16k_smc )
    {
#ifdef FIX_2344_ALIGN_PREPROC
        ivas_compute_core_buffers( st, &inp_16k, old_inp_16k, new_inp_resamp16k, input_frame, last_element_mode, sr_core_tmp, ener, A, Aw, epsP, lsp_new, lsp_mid );
#else
        error = ivas_compute_core_buffers( st, &inp_16k, old_inp_16k, new_inp_resamp16k, input_frame, last_element_mode, sr_core_tmp, ener, A, Aw, epsP, lsp_new, lsp_mid );
        if ( error != IVAS_ERR_OK )
        {
            return error;
        }
#endif
    }

    if ( !( st->L_frame == L_FRAME16k && element_mode != IVAS_CPE_MDCT ) )
@@ -482,11 +457,7 @@ ivas_error pre_proc_ivas(
#endif

    pop_wmops();
#ifdef FIX_2344_ALIGN_PREPROC
    return;
#else
    return error;
#endif
}


@@ -496,11 +467,7 @@ ivas_error pre_proc_ivas(
 * Compute core-coder buffers at internal sampling rate
 *--------------------------------------------------------------------*/

#ifdef FIX_2344_ALIGN_PREPROC
void ivas_compute_core_buffers(
#else
ivas_error ivas_compute_core_buffers(
#endif
    Encoder_State *st,                 /* i/o: encoder state structure                  */
    float **inp16k_out,                /* o  : ptr. to inp. signal in the current frame */
    float *old_inp_16k,                /* i/o: buffer of old input signal @ 16kHz       */
@@ -613,33 +580,17 @@ ivas_error ivas_compute_core_buffers(
                modify_Fs( signal_in - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_16k - lMemRecalc_16k - length_16k, sr_core, st->mem_decim16k, 0 );
            }

#ifdef FIX_2344_ALIGN_PREPROC
            modify_Fs( signal_in - lMemRecalc, input_frame, input_Fs, new_inp_16k - lMemRecalc_16k, sr_core, st->mem_decim16k, 0 );
#else
            modify_Fs( signal_in - lMemRecalc, input_frame, input_Fs, new_inp_16k - ( lMemRecalc * sr_core ) / st->input_Fs, sr_core, st->mem_decim16k, 0 );
#endif
            mvr2r( st->mem_decim16k, mem_decim16k_dummy, 2 * L_FILT_MAX );

            if ( lMemRecalc > 0 )
            {
#ifdef FIX_2344_ALIGN_PREPROC
                modify_Fs( signal_in - lMemRecalc + input_frame, lMemRecalc, input_Fs, new_inp_16k + NS2SA( sr_core, FRAME_SIZE_NS ) - lMemRecalc_16k, sr_core, mem_decim16k_dummy, 0 );
#else
                modify_Fs( signal_in - lMemRecalc + input_frame, lMemRecalc, input_Fs, new_inp_16k + NS2SA( sr_core, FRAME_SIZE_NS ) - ( lMemRecalc * sr_core ) / st->input_Fs, sr_core, mem_decim16k_dummy, 0 );
#endif
            }

            set_f( temp1F_icatdmResampBuf, 0, L_FILT_MAX );
            modify_Fs( temp1F_icatdmResampBuf, NS2SA( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k + NS2SA( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy, 0 );
        }
#ifndef FIX_2344_ALIGN_PREPROC
#ifdef DEBUGGING
        else
        {
            return ( IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong internal sampling rate. Exiting..." ) );
        }
#endif
#endif
    }
    else if ( st->idchan == 0 )
    {
@@ -704,11 +655,7 @@ ivas_error ivas_compute_core_buffers(
        st->mem_preemph_enc = new_inp_16k[L_frame_tmp - 1];
    }

#ifdef FIX_2344_ALIGN_PREPROC
    if ( sr_core == INT_FS_16k && element_mode != IVAS_CPE_MDCT )
#else
    if ( input_Fs > 8000 && sr_core == INT_FS_16k && element_mode != IVAS_CPE_MDCT )
#endif
    {
        if ( element_mode == IVAS_CPE_DFT )
        {
@@ -758,23 +705,8 @@ ivas_error ivas_compute_core_buffers(
            preemph( new_inp_16k + L_FRAME16k, PREEMPH_FAC_16k, L_FILT16k, &tmp );
        }
    }
#ifdef FIX_2344_ALIGN_PREPROC
    else /* keep memory up-to-date in case of bitrate switching */
#else
    else if ( input_Fs > 8000 ) /* keep memory up-to-date in case of bitrate switching */
#endif
    {
#ifndef FIX_2344_ALIGN_PREPROC
        if ( element_mode == IVAS_CPE_DFT )
        {
            st->mem_preemph16k = new_inp_16k[L_frame_tmp - STEREO_DFT_OVL_16k - 1];
        }
        else if ( element_mode == IVAS_CPE_TD )
    {
            st->mem_preemph16k = new_inp_16k[L_frame_tmp - lMemRecalc_16k - 1];
        }
        else
#endif
            if ( element_mode == IVAS_CPE_MDCT )
        {
            st->mem_preemph16k = 0;
@@ -836,19 +768,11 @@ ivas_error ivas_compute_core_buffers(
    {
        set_f( st->old_inp_16k, 0, L_INP_MEM );
    }
#ifdef FIX_2344_ALIGN_PREPROC
    else if ( sr_core == INT_FS_16k )
#else
    else if ( input_Fs > 8000 && sr_core == INT_FS_16k )
#endif
    {
        mvr2r( &old_inp_16k[L_frame_tmp], st->old_inp_16k, L_INP_MEM );
    }
#ifdef FIX_2344_ALIGN_PREPROC
    else
#else
    else if ( input_Fs > 8000 )
#endif
    {
        lerp( st->old_inp_12k8 + L_INP_MEM - L_INP_MEM * 4 / 5, st->old_inp_16k, L_INP_MEM, L_INP_MEM * 4 / 5 );
    }
@@ -863,9 +787,5 @@ ivas_error ivas_compute_core_buffers(
        mvr2r( new_inp_resamp16k, new_inp_resamp16k_out, L_FRAME16k );
    }

#ifdef FIX_2344_ALIGN_PREPROC
    return;
#else
    return IVAS_ERR_OK;
#endif
}
+0 −22
Original line number Diff line number Diff line
@@ -67,11 +67,7 @@ static void calculate_energy_buffer( CPE_ENC_HANDLE hCPE, float enerBuffer_dft[]
 * (resampling, spectral analysis, LP analysis, VAD, OL pitch calculation, classification)
 *--------------------------------------------------------------------*/

#ifdef FIX_2344_ALIGN_PREPROC
void pre_proc_front_ivas(
#else
ivas_error pre_proc_front_ivas(
#endif
    SCE_ENC_HANDLE hSCE,                                       /* i/o: SCE encoder structure                   */
    CPE_ENC_HANDLE hCPE,                                       /* i/o: CPE encoder structure                   */
    const int32_t element_brate,                               /* i  : SCE/CPE element bitrate                 */
@@ -168,9 +164,6 @@ ivas_error pre_proc_front_ivas(
    float temp1F_icatdmResampBuf[L_FILT_MAX]; /* temp buffers for ICA TDM resamplers */
    int16_t old_pitch1;                       /* previous frame OL pitch[1] @12.8 kHz */
    int16_t LR_localVAD;
#ifndef FIX_2344_ALIGN_PREPROC
    ivas_error error;
#endif

    push_wmops( "pre_proc_front" );

@@ -178,9 +171,6 @@ ivas_error pre_proc_front_ivas(
     * Initialization
     *------------------------------------------------------------------*/

#ifndef FIX_2344_ALIGN_PREPROC
    error = IVAS_ERR_OK;
#endif
    tmpS = 0;
    tdm_SM_last_clas = &tmpS;
    set_f( tmpF, 0, STEREO_DFT_BAND_MAX );
@@ -813,15 +803,7 @@ ivas_error pre_proc_front_ivas(
            if ( flag_16k_smc )
            {
                /* Compute core-coder buffers at internal sampling rate */
#ifdef FIX_2344_ALIGN_PREPROC
                ivas_compute_core_buffers( st, NULL, old_inp_16k, NULL, input_frame, IVAS_SCE /*last_element_mode*/, INT_FS_16k /*sr_core_tmp*/, ener, A, Aw, epsP, lsp_new, lsp_mid );
#else
                error = ivas_compute_core_buffers( st, NULL, old_inp_16k, NULL, input_frame, IVAS_SCE /*last_element_mode*/, INT_FS_16k /*sr_core_tmp*/, ener, A, Aw, epsP, lsp_new, lsp_mid );
                if ( error != IVAS_ERR_OK )
                {
                    return error;
                }
#endif

                smc_dec = ivas_acelp_tcx20_switching( st, st->speech_enc, st->wspeech_enc, non_staX, pitch_fr, voicing_fr, currFlatness, lsp_mid, stab_fac, res_cod_SNR_M, flag_16k_smc );
            }
@@ -873,11 +855,7 @@ ivas_error pre_proc_front_ivas(
    mvr2r( &old_inp_12k8[L_FRAME], st->old_inp_12k8, L_INP_MEM );

    pop_wmops();
#ifdef FIX_2344_ALIGN_PREPROC
    return;
#else
    return error;
#endif
}


Loading