Commit 7175c465 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'cpe_enc_integration' into 'main'

CPE encoder subfunctions conversion and integration [allow regression]

See merge request !622
parents 4e5c5a18 eed38fad
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -824,7 +824,9 @@ enum fea_names
#define STEREO_BITS_TCA_CORRSTATS               5                           /* target corrStats */
#define STEREO_BITS_TCA_GD                      5                           /* target gain */
#define STEREO_TCA_GDMIN                        -1.0f
#define STEREO_TCA_GDMIN_FX                     -32768
#define STEREO_TCA_GDSTEP                       0.05f
#define STEREO_TCA_GDSTEP_FX                       819
#define STEREO_BITS_TCA                         ( STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS + STEREO_BITS_TCA_GD )

#define STEREO_ICBWE_MSFLAG_BITS                1                           /* BWE Multi Source flag */
+73 −21
Original line number Diff line number Diff line
@@ -317,13 +317,25 @@ ivas_error pre_proc_ivas(
    int16_t *Voicing_flag,                                      /* o  : voicing flag for HQ FEC                 */
    const float old_wsp[],                                      /* i  : weighted input signal buffer            */
    const int16_t loc_harm,                                     /* i  : harmonicity flag                        */
#ifndef IVAS_FLOAT_FIXED
    const float cor_map_sum,                                    /* i  : speech/music clasif. parameter          */
#endif
    const int16_t vad_flag_dtx,                                 /* i  : HE-SAD flag with additional DTX HO      */
#ifndef IVAS_FLOAT_FIXED
    /*const*/ float enerBuffer[CLDFB_NO_CHANNELS_MAX],              /* i  : energy buffer                           */
    /*const*/ float fft_buff[2 * L_FFT],                            /* i  : FFT buffer                              */
#endif
    const int16_t MCT_flag,                                     /* i  : hMCT handle allocated (1) or not (0)    */
    const int16_t vad_hover_flag,                               /* i  : VAD hangover flag                       */
    const int16_t flag_16k_smc                                  /* i  : flag to indicate if the OL SMC is run at 16 kHz */
#ifdef IVAS_FLOAT_FIXED
    ,
    Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX],
    Word16 e_enerBuffer,
    Word16 fft_buff_fx[2 * L_FFT],
    Word32 cor_map_sum_fx,
    Word16 exp_cor_map_sum
#endif
);

ivas_error ivas_compute_core_buffers(
@@ -2680,17 +2692,33 @@ void stereo_td_init_enc_fx(
    STEREO_TD_ENC_DATA_HANDLE hStereoTD,                        /* i/o: TD stereo encoder handle                */
    const Word16 last_element_mode                             /* i  : last element mode                       */
);

#ifndef IVAS_FLOAT_FIXED
ivas_error stereo_set_tdm(
    CPE_ENC_HANDLE hCPE,                                        /* i  : CPE encoder structure                   */
    const int16_t input_frame                                   /* i  : input frame length per channel          */
);

#else
ivas_error stereo_set_tdm_fx(
    CPE_ENC_HANDLE hCPE,                                        /* i  : CPE encoder structure                   */
    const Word16 input_frame,                                   /* i  : input frame length per channel          */
    Word16 input_q
);
#endif
#ifndef IVAS_FLOAT_FIXED
void stereo_tdm_prep_dwnmx (
    CPE_ENC_HANDLE hCPE,                                        /* i  : CPE encoder structure                   */
    const float *input1,                                        /* i  : right channel input                     */       
    const int16_t input_frame                                   /* i  : frame lenght                            */           
);
#else
void stereo_tdm_prep_dwnmx_fx(
    CPE_ENC_HANDLE hCPE,      /* i  : CPE encoder structure             */
    const Word32 *input1,      /* i  : right channel input               */
    const Word16 input_frame, /* i  : frame lenght                      */
    const Word16 input_q /* i  : frame lenght                      */
);
#endif

#ifndef IVAS_FLOAT_FIXED
int16_t stereo_tdm_ener_analysis(
    const int16_t ivas_format,                                  /* i  : IVAS format                             */
@@ -3638,6 +3666,11 @@ ivas_error front_vad_create_fx(
void front_vad_destroy(
    FRONT_VAD_ENC_HANDLE *hFrontVad                             /* i/o: front-VAD handle                        */
);
#ifdef IVAS_FLOAT_FIXED
void front_vad_destroy_fx(
    FRONT_VAD_ENC_HANDLE *hFrontVad /* i/o: front-VAD handle           */
);
#endif

ivas_error front_vad(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure, nullable         */
@@ -3662,19 +3695,21 @@ ivas_error front_vad_fx(
        Encoder_State * st,                         /* i/o: encoder state structure                                   */
        const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i  : configuration structure                                   */
        FRONT_VAD_ENC_HANDLE *hFrontVads,           /* i/o: FrontVad handles                                          */
    const int16_t MCT_flag,                     /* i  : hMCT handle allocated (1) or not (0)                      */
    const int16_t input_frame,                  /* i  : frame length                                              */
    int16_t vad_flag_dtx[],                     /* o  : HE-SAD flag with additional DTX HO                        */
    float fr_bands[][2 * NB_BANDS],             /* i  : energy in frequency bands                                 */
    float Etot_LR[],                            /* o  : total energy Left & Right channel                         */
    float lf_E[][2 * VOIC_BINS],                /* i  : per bin spectrum energy in lf, LR channels                */
    int16_t localVAD_HE_SAD[],                  /* o  : HE-SAD flag without hangover, LR channels                 */
    int16_t vad_hover_flag[],                   /* o  : VAD hangover flag                                         */
    float band_energies_LR[2 * NB_BANDS],       /* o  : energy in critical bands without minimum noise floor E_MIN*/
    float *PS_out,                              /* o  : energy spectrum                                           */
    float *Bin_E_out,                           /* o  : log-energy spectrum of the current frame                  */
        const Word16 MCT_flag,                      /* i  : hMCT handle allocated (1) or not (0)                      */
        const Word16 input_frame,                   /* i  : frame length                                              */
        Word16 vad_flag_dtx[],                      /* o  : HE-SAD flag with additional DTX HO                        */
        Word32 fr_bands_fx[][2 * NB_BANDS],         /* o  : energy in frequency bands     Q_buffer[n] + QSCALE + 2                            */
        Word16 Etot_LR_fx[],                        /* o  : total energy Left & Right channel       Q8                  */
        Word32 lf_E_fx[][2 * VOIC_BINS],            /* i  : per bin spectrum energy in lf, LR channels  Q_buffer[n] + QSCALE              */
        Word16 localVAD_HE_SAD[],                   /* o  : HE-SAD flag without hangover, LR channels                 */
        Word16 vad_hover_flag[],                    /* o  : VAD hangover flag                                         */
        Word32 band_energies_LR_fx[2 * NB_BANDS],   /* o  : energy in critical bands without minimum noise floor E_MIN Q_buffer[1] + QSCALE + 2 - band_ener_guardbits*/
        Word32 *PS_out_fx,                          /* o  : energy spectrum                                       Q_buffer + QSCALE    */
        Word16 *Bin_E_out_fx,                       /* o  : log-energy spectrum of the current frame            Q7      */
        Word16 Q_inp,
    Word16 Q_add );
        Word16 *Q_buffer,
        Word16 Q_add,
        Word16 *front_create_flag );
#endif
ivas_error front_vad_spar(
    SPAR_ENC_HANDLE hSpar,                                      /* i/o: SPAR encoder structure                  */
@@ -4004,7 +4039,16 @@ Word32 check_bounds_l(
    const Word32 low,   /* i  : Low limit                    */
    const Word32 high   /* i  : High limit                   */
);
#ifdef IVAS_FLOAT_FIXED
ivas_error stereo_memory_enc_fx(
    CPE_ENC_HANDLE hCPE,                                        /* i  : CPE encoder structure                   */
    const int32_t input_Fs,                                     /* i  : input sampling rate                     */
    const int16_t max_bwidth,                                   /* i  : maximum audio bandwidth                 */
    const IVAS_FORMAT ivas_format,                              /* i  : IVAS format                             */
    const int16_t nchan_transport                               /* i  : number transport chans                  */

);
#else
ivas_error stereo_memory_enc(
    CPE_ENC_HANDLE hCPE,                                        /* i  : CPE encoder structure                   */
    const int32_t input_Fs,                                     /* i  : input sampling rate                     */
@@ -4014,6 +4058,7 @@ ivas_error stereo_memory_enc(
    const int16_t nchan_transport                               /* i  : number transport chans                  */

);
#endif

ivas_error stereo_memory_dec(
    const int32_t ivas_total_brate,                             /* i  : IVAS total bitrate                      */
@@ -4024,13 +4069,20 @@ ivas_error stereo_memory_dec(
    const MC_MODE mc_mode,                                      /* i  : MC mode                                 */
    const int16_t nchan_transport                               /* i  : number of transport channels            */
);

#ifdef IVAS_FLOAT_FIXED
void stereo_switching_enc_fx(
    CPE_ENC_HANDLE hCPE,           /* i  : CPE encoder structure               */
    Word16 old_input_signal_pri[], /* i  : old input signal of primary channel */
    const Word16 input_frame,       /* i  : input frame length                  */
    const Word16 q_inp
);
#else
void stereo_switching_enc(
    CPE_ENC_HANDLE hCPE,                                        /* i  : CPE structure                           */
    float old_input_signal_pri[],                               /* i  : old input signal of primary channel     */
    const int16_t input_frame                                   /* i  : input frame length                      */
);

#endif
void stereo_switching_dec(
    CPE_DEC_HANDLE hCPE,                                        /* i/o: CPE decoder structure                   */
    const int32_t ivas_total_brate                              /* i  : IVAS total bitrate                      */
+5 −0
Original line number Diff line number Diff line
@@ -3015,6 +3015,11 @@ Word16 transient_analysis_ivas_fx(
    const Word16 multi_harm_limit, /* i  : multi harmonic threshold Q_multi_harm_limit = Qx */
    Word16 Q_multi_harm_limit );

void set_transient_stereo_fx(
    CPE_ENC_HANDLE hCPE,  /* i  : CPE structure                           */
    Word16 currFlatness[] /* i/o: current flatness                       Q7*/
);

void ivas_smc_mode_selection_fx(
    Encoder_State *st,          /* i/o: encoder state structure                 */
    const Word32 element_brate, /* i  : element bitrate                         */
+3 −3
Original line number Diff line number Diff line
@@ -272,7 +272,7 @@ static void find_enr_dft_fx(
    /* for low frequency bins, save per bin energy for the use in find_tilt() */
    freq = bin_freq;
    move32();
    for ( i = 0; i < NB_BANDS - 1; i++ ) /* up to maximum allowed voiced critical band */
    FOR( i = 0; i < NB_BANDS - 1; i++ ) /* up to maximum allowed voiced critical band */
    {
        band_fx[i] = 0;
        move32();
@@ -317,7 +317,7 @@ static void find_enr_dft_fx(
        move32();
        band_ener_fx[i] = band_fx[i]; /* per band energy without E_MIN   */
        move32();
        if ( band_fx[i] < L_shl( E_MIN_Q11_FX, sub( Qout, Q11 ) ) )
        if ( LT_32( band_fx[i], L_shl( E_MIN_Q11_FX, sub( Qout, Q11 ) ) ) )
        {
            band_fx[i] = L_shl( E_MIN_Q11_FX, sub( Qout, Q11 ) );
            move32();
@@ -381,7 +381,7 @@ static void find_enr_dft_fx(
    /* put bin energies from BinE into Bin_E[L_FFT/2-1] (interpolate 40 Hz bin values to fit into 50 Hz bins) */
    /* Last value of Bin_E is handled outside this function*/
    assert( bin_cnt == ( STEREO_DFT_N_12k8_ENC / 2 - 1 ) );
    Scale_sig32( BinE_fx, 256, sub( Qout, ( 2 * Q_inp_dmx - 32 ) ) );
    Scale_sig32( BinE_fx, 256, sub( Qout, sub( shl( Q_inp_dmx, 1 ), 32 ) ) );
    BinE_fx[STEREO_DFT_N_12k8_ENC / 2 - 1] = BinE_fx[STEREO_DFT_N_12k8_ENC / 2 - 2];
    move32();
    L_lerp_fx( BinE_fx, Bin_E_fx, L_FFT / 2, STEREO_DFT_N_12k8_ENC / 2, &Qout );
+168 −99

File changed.

Preview size limit exceeded, changes collapsed.

Loading