Commit f5562cef authored by Vladimir Malenovsky's avatar Vladimir Malenovsky
Browse files

Merge branch 'main' into...

Merge branch 'main' into basop-2298-port-float-mr-2468-swb-tbe-fix-constant-in-create_random_vector-to-allow-more-reliable
parents eede486f 4e61820e
Loading
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2668,6 +2668,11 @@ static CmdlnArgs defaultArgs(

    args.inConfig.inSetupCustom.num_spk = 0;
    args.inConfig.inSetupCustom.num_lfe = 0;
    for ( i = 0; i < RENDERER_MAX_INPUT_CHANNELS; i++ )
    {
        args.inConfig.inSetupCustom.azimuth[i] = 0.f;
        args.inConfig.inSetupCustom.elevation[i] = 0.f;
    }
    args.inConfig.numAudioObjects = 0;
    args.inConfig.numAmbisonicsBuses = 0;
    args.inConfig.numMultiChannelBuses = 0;
@@ -2676,6 +2681,11 @@ static CmdlnArgs defaultArgs(
    args.outConfig.audioConfig = IVAS_AUDIO_CONFIG_INVALID;
    args.outConfig.outSetupCustom.num_spk = 0;
    args.outConfig.outSetupCustom.num_lfe = 0;
    for ( i = 0; i < RENDERER_MAX_OUTPUT_CHANNELS; i++ )
    {
        args.outConfig.outSetupCustom.azimuth[i] = 0.f;
        args.outConfig.outSetupCustom.elevation[i] = 0.f;
    }
    for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i )
    {
        args.inConfig.ambisonicsBuses[i].audioConfig = IVAS_AUDIO_CONFIG_INVALID;
+12 −0
Original line number Diff line number Diff line
@@ -160,7 +160,11 @@ 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                    */
@@ -207,7 +211,11 @@ 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                         */
@@ -235,7 +243,11 @@ 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      */
+1 −0
Original line number Diff line number Diff line
@@ -170,6 +170,7 @@
#define FIX_1479_MSAN_SPAR_UNINITIALIZED_VALUE          /* Dolby: Fix for issue 1479, MSAN error due to uninitialized value in SPAR */
#define REMOVE_UNUSED_CODE_IVAS_DEC                     /* VA: remove unused code in ivas_jbm_dec_tc_fx() */
#define REMOVE_CAM_FROM_IVAS                            /* VA: basop issue 210: remove obsoelte CAM code from IVAS */
#define FIX_2344_ALIGN_PREPROC                          /* VA: basop issue 2344: Align pre_proc_ivas() between FLP and BASOP */

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

+4 −0
Original line number Diff line number Diff line
@@ -174,10 +174,14 @@ 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 )
        {
+57 −9
Original line number Diff line number Diff line
@@ -51,7 +51,11 @@
 * 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                         */
@@ -83,12 +87,15 @@ 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
     *----------------------------------------------------------------*/
@@ -213,7 +220,6 @@ ivas_error pre_proc_ivas(
        st->coder_type = INACTIVE;
    }


    /*---------------------------------------------------------------------*
     * Decision matrix (selection of technologies)
     *---------------------------------------------------------------------*/
@@ -294,7 +300,6 @@ ivas_error pre_proc_ivas(
        }
    }


    /*-----------------------------------------------------------------*
     * Update of ACELP harmonicity counter (used in ACELP transform codebook @32kbps)
     *-----------------------------------------------------------------*/
@@ -354,12 +359,13 @@ 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 )
    {
@@ -395,11 +401,15 @@ 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 ) )
@@ -439,7 +449,6 @@ ivas_error pre_proc_ivas(
    /* update old weighted speech buffer - for OL pitch analysis */
    mvr2r( &old_wsp[L_FRAME], st->old_wsp, L_WSP_MEM );


    /* set the pointer of the current frame for the ACELP core */
    if ( st->L_frame == L_FRAME )
    {
@@ -473,7 +482,11 @@ ivas_error pre_proc_ivas(
#endif

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


@@ -483,7 +496,11 @@ 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       */
@@ -596,22 +613,32 @@ 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 )
@@ -672,14 +699,16 @@ ivas_error ivas_compute_core_buffers(
     * Perform fixed preemphasis (16kHz signal) through 1 - g*z^-1
     *-----------------------------------------------------------------*/

    if (
        st->tcxonly == 0 &&
        !( ( element_mode == IVAS_CPE_TD && st->idchan == 1 ) || element_mode == IVAS_CPE_MDCT ) )
    if ( st->tcxonly == 0 && !( ( element_mode == IVAS_CPE_TD && st->idchan == 1 ) || element_mode == IVAS_CPE_MDCT ) )
    {
        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 )
        {
@@ -729,8 +758,13 @@ 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];
@@ -739,7 +773,9 @@ ivas_error ivas_compute_core_buffers(
        {
            st->mem_preemph16k = new_inp_16k[L_frame_tmp - lMemRecalc_16k - 1];
        }
        else if ( element_mode == IVAS_CPE_MDCT )
        else
#endif
            if ( element_mode == IVAS_CPE_MDCT )
        {
            st->mem_preemph16k = 0;
        }
@@ -800,11 +836,19 @@ 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 );
    }
@@ -819,5 +863,9 @@ 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
}
Loading