Commit ca5c58bb authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Core encoder and CPE function/sub-functions conversion/integration

[x] core_enc functions converted/integrated: lsf_syn_mem_restore, ProcessIGF_ivas_fx, fb_tbe_enc_ivas_fx, fd_cng_enc, preemph calls in ivas_compute_core_buffer
[x] CPE enc path functions converted/integrated: stereo_classifier, hp_20_fix32, tdm_ol_pitch_comparison, map_input_to_cpe_channels_ivas_fx, stereo_fd_cng_coherence, stereo_td_itd_mdct_stereo, stereo_tca_enc sub-functions
parent 81c8a9c5
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -893,7 +893,7 @@ static void IGF_gridSetUp_ivas_fx(
    Word16 bitRateIndex,     /* i  : IGF bitrate index                                                  */
    const Word32 sampleRate, /* i  : sample rate                                                        */
    Word16 frameLength,      /* i  : frame length                                                       */
    const Word16 transFac,   /* i  : transFac                                                           */
    const Word16 transFac,   /* i  : transFac, Q14                                                      */
    const Word16 igfMinFq    /* i  : IGF minimum frequency indicating lower start frequency for copy up */
)
{
+1 −0
Original line number Diff line number Diff line
@@ -840,6 +840,7 @@ enum fea_names

#define MAX_DELAYREGLEN                         12                          /* max regression length */
#define INV_MAX_DELAYREGLEN                     0.083333333333333f          /* (1/MAX_DELAYREGLEN) */
#define INV_MAX_DELAYREGLEN_FX_Q15              2731          /* (1/MAX_DELAYREGLEN) */
#define MAX_INTERPOLATE                         11
#define ADDED_MEM_DS                            40

+1 −52
Original line number Diff line number Diff line
@@ -1768,19 +1768,6 @@ void stereo_dft_enc_analyze(
    float *input_mem[CPE_CHANNELS]                              /* i/o: input buffer memory                 */
);

#ifdef IVAS_FLOAT_FIXED
void stereo_dft_enc_analyze_fx(
  Encoder_State **sts,                                        /* i/o: encoder state structure             */
  const Word16 n_channels,                                   /* i  : number of input channels            */
  const Word16 input_frame,                                  /* i  : input frame length                  */
  STEREO_DFT_ENC_DATA_HANDLE hStereoDft,                      /* i/o: encoder DFT stereo handle           */
  STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct,                    /* i/o: encoder MDCT stereo handle          */
  Word32 DFT[CPE_CHANNELS][STEREO_DFT_N_MAX_ENC],              /* o  : DFT buffers                         */
  Word16 *input_mem[CPE_CHANNELS],                              /* i/o: input buffer memory                 */
  Word16 *q_input_mem
  );
#endif

float stereo_dft_enc_synthesize(
    STEREO_DFT_ENC_DATA_HANDLE hStereoDft,                      /* i/o: encoder DFT stereo handle           */
    float *output,                                              /* o  : output synthesis                    */
@@ -2285,22 +2272,6 @@ void stereo_dft_hybrid_ITD_flag(
    const Word16 hybrid_itd_max                                /* i  : flag for hybrid ITD for very large ITDs */
);

#ifdef IVAS_FLOAT_FIXED
void stereo_dft_enc_compute_itd_fx(
    CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure           */
    Word32 *DFT_L,
    Word16 *DFT_L_e,
    Word32 *DFT_R,
    Word16 *DFT_R_e,
    const Word16 k_offset,
    const Word16 input_frame,
    const Word16 vad_flag_dtx[],
    const Word16 vad_hover_flag[],
    Word32 *bin_nrgL,
    Word16 *bin_nrgL_e,
    Word32 *bin_nrgR,
    Word16 *bin_nrgR_e );
#endif
void stereo_dft_enc_compute_itd(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure                   */
    float *DFT_L,
@@ -2337,32 +2308,10 @@ void stereo_td_itd(
    float *input_mem[CPE_CHANNELS]                              /* i/o: input buffer memory                     */
);

#ifdef IVAS_FLOAT_FIXED
void stereo_td_itd_fx(
  ITD_DATA *hITD,                                             /* i/o: ITD data structure                      */
  Word16 input_mem_itd_fx[CPE_CHANNELS][STEREO_DFT_OVL_MAX],      /* o  : ITD memory (only used in DFT Stereo)    */
  Word16 *q_input_mem_itd,
  const Word16 hybrid_itd_flag,                              /* i  : flag for hybrid TD/FD ITD processing    */
  const Word16 dft_ovl,                                      /* i  : size of DFT overlap                     */
  Encoder_State **sts,                                        /* i/o: Encoder state structure                 */
  const Word16 input_frame,                                  /* i  : input frame length                      */
  Word16 *input_mem[CPE_CHANNELS],                            /* i/o: input buffer memory                     */
  Word16 *q_input_mem
);
#endif

void stereo_dft_dmx_out_reset(
    STEREO_DFT_DMX_DATA_HANDLE hStereoDftDmx                    /* i/o: DFT stereo DMX decoder                  */
);
#ifdef IVAS_FLOAT_FIXED
void stereo_dft_unify_dmx_fx(
  STEREO_DFT_DEC_DATA_HANDLE hStereoDft,       /* i/o: decoder stereo handle          */
  Decoder_State *st0,                          /* i/o: decoder state structure        */
  Word32 DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* i/o: DFT buffers                    */
  Word32 *input_mem,                            /* i/o: mem of buffer DFT analysis     */
  const Word16 prev_sid_nodata                /* i  : Previous SID/No data indicator */
);
#endif

void stereo_dft_unify_dmx(
    STEREO_DFT_DEC_DATA_HANDLE hStereoDft,                      /* i/o: decoder stereo handle                   */
    Decoder_State *st0,                                         /* i/o: decoder state structure                 */
+102 −0
Original line number Diff line number Diff line
@@ -932,6 +932,17 @@ ivas_error ivas_ism_config_fx(
    const Word16 combined_format_flag                 /* i  : flag indicating combined format             */
);

void stereo_dft_enc_analyze_fx(
    Encoder_State **sts,                            /* i/o: encoder state structure     */
    const Word16 n_channels,                        /* i  : number of input channels    */
    const Word16 input_frame,                       /* i  : input frame length          */
    STEREO_DFT_ENC_DATA_HANDLE hStereoDft,          /* i/o: encoder stereo handle       */
    STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct,        /* i/o: encoder MDCT stereo handle  */
    Word32 DFT[CPE_CHANNELS][STEREO_DFT_N_MAX_ENC], /* o  : DFT buffers                 */
    Word16 DFT_e[CPE_CHANNELS],                     /* o  : DFT buffers                 */
    Word16 *input_mem[CPE_CHANNELS],                /* i/o: input buffer memory         */
    Word16 *q_input_mem );

Word16 IGF_MapBitRateToIndex(
    const Word32 brate,        /* i  :  bitrate                    */
    const Word16 bwidth,       /* i  :  audio bandwidth            */
@@ -954,6 +965,47 @@ void stereo_dft_config_fx(
    Word16 *bits_frame_nominal_2           /* o  : secondary channel nominal bits per frame*/
);

void stereo_td_itd_mdct_stereo_fx(
    CPE_ENC_HANDLE hCPE,           /* i/o: CPE encoder handle     */
    const Word16 vad_flag_dtx[],   /* i  : VAD dtx flags          */
    const Word16 vad_hover_flag[], /* i  : VAD hangover flags     */
    const Word16 input_frame       /* i  : frame length           */
);

void stereo_td_itd_fx(
    ITD_DATA *hITD,                                            /* i/o: ITD data structure                      */
    Word16 input_mem_itd_fx[CPE_CHANNELS][STEREO_DFT_OVL_MAX], /* o  : ITD memory (only used in DFT Stereo)    */
    Word16 *q_input_mem_itd,
    const Word16 hybrid_itd_flag,    /* i  : flag for hybrid TD/FD ITD processing    */
    const Word16 dft_ovl,            /* i  : size of DFT overlap                     */
    Encoder_State **sts,             /* i/o: Encoder state structure                 */
    const Word16 input_frame,        /* i  : input frame length                      */
    Word16 *input_mem[CPE_CHANNELS], /* i/o: input buffer memory                     */
    Word16 *q_input_mem );

void stereo_dft_unify_dmx_fx(
    STEREO_DFT_DEC_DATA_HANDLE hStereoDft,        /* i/o: decoder stereo handle          */
    Decoder_State *st0,                           /* i/o: decoder state structure        */
    Word32 DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* i/o: DFT buffers                    */
    Word32 *input_mem,                            /* i/o: mem of buffer DFT analysis     */
    const Word16 prev_sid_nodata                  /* i  : Previous SID/No data indicator */
);

void stereo_dft_enc_compute_itd_fx(
    CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure           */
    Word32 *DFT_L,
    Word16 *DFT_L_e,
    Word32 *DFT_R,
    Word16 *DFT_R_e,
    const Word16 k_offset,
    const Word16 input_frame,
    const Word16 vad_flag_dtx[],
    const Word16 vad_hover_flag[],
    Word32 *bin_nrgL,
    Word16 *bin_nrgL_e,
    Word32 *bin_nrgR,
    Word16 *bin_nrgR_e );

Word16 stereo_dft_band_config_fx(
    Word16 *band_limits,   /* o  : DFT band limits                     */
    const Word16 band_res, /* i  : DFT band resolution                 */
@@ -1769,6 +1821,24 @@ void ivas_interpolate_3_over_1_allpass_fx(
    Word16 *mem_fx /* i/o: memory                  */ /* Q_input */
);

void tdm_configure_enc_fx(
    const Word16 ivas_format,                /* i  : IVAS format                             */
    const Word16 ism_mode,                   /* i  : ISM mode in combined format             */
    CPE_ENC_HANDLE hCPE,                     /* i  : CPE encoder structure                   */
    const Word16 Etot_last_fx[CPE_CHANNELS], /* i/o: Energy of last frame                    Q8*/
    const Word16 tdm_SM_or_LRTD_Pri,         /* i  : channel combination scheme flag in TD stereo OR LRTD primary channel */
    const Word16 tdm_ratio_idx,              /* i  : ratio index                             */
    const Word16 tdm_ratio_idx_SM,           /* i  : ratio index in SM mode                  */
    const Word16 attack_flag,                /* i  : Primary channel attack flag             */
    const Word16 nb_bits_metadata            /* i  : number of metadata bits                 */
);

void stereoFdCngCoherence_fx(
    Encoder_State **sts,                      /* i/o: core encoder structures                 */
    const Word16 last_element_mode,           /* i  : last element mode                       */
    Word16 fft_buff[CPE_CHANNELS][2 * L_FFT], /* i  : fft buffers for L and R channels        fft_exp*/
    Word16 fft_exp );

void ivas_wb_tbe_dec_fx(
    Decoder_State *st_fx,     /* i/o: decoder state structure         */
    const Word16 coder_type,  /* i  : coding type                     */
@@ -2805,6 +2875,13 @@ void spectral_balancer_fx16(
    const Word16 coeff_set /* i  : coefficient set              */
);

void spectral_balancer_fx(
    Word32 *signal,        /* i/o  : signal  Qx                   */
    Word32 *mem,           /* i/o  : mem  Qx                      */
    const Word16 lg,       /* i  : input signal length            */
    const Word16 coeff_set /* i  : coefficient set                */
);

void stereo_icBWE_preproc_fx(
    CPE_ENC_HANDLE hCPE,        /* i/o: CPE encoder structure                           */
    const Word16 input_frame,   /* i  : input frame length                              */
@@ -2941,4 +3018,29 @@ void ivas_smc_mode_selection_fx(
    const Word16 flag_spitch    /* i  : flag to indicate very short stable pitch*/
);

void stereo_classifier_features_ivas_fx(
    STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure                     */
    const Word16 idchan,                  /* i  : channel ID                                      */
    const Word16 element_mode,            /* i  : element mode                                    */
    const Word16 vad_flag,                /* i  : VAD flag                                        */
    Word32 lsf_new_fx[],                  /* i  : LSFs at the end of the frame                    */
    Word32 epsP_fx[],                     /* i  : LP analysis residual energies for each iteration*/
    Word16 pitch[],                       /*q0 i  : open-loop pitch values for quantiz.           */
    Word16 voicing_fx[],                  /* i  : OL maximum normalized correlation               */
    Word32 cor_map_sum_fx,                /* i  : speech/music clasif. parameter                  */
    Word32 non_staX_fx,                   /* i  : unbound non-stationarity for sp/mu clas.        */
    Word32 sp_div_fx,                     /* i  : spectral diversity feature                      */
    const Word16 clas,                    /* i  : signal class                                    */
    Word16 epsP_e,                        /*exponent for epsP_fx                                  */
    Word16 voicing_e,                     /*exponent for voicing_fx                               */
    Word16 cor_map_sum_e,                 /*exponent for cor_map_sum_fx                           */
    Word16 non_staX_e,                    /*exponent for non_staX_fx                              */
    Word16 sp_div_e                       /*exponent for sp_div_fx                                */
);

void tdm_ol_pitch_comparison_fx(
    CPE_ENC_HANDLE hCPE,                      /* i  : CPE encoder structure                  */
    Word16 pitch_fr[CPE_CHANNELS][NB_SUBFR],  /* i/o: fractional pitch values, Q6            */
    Word16 voicing_fr[CPE_CHANNELS][NB_SUBFR] /* i/o: fractional pitch gains, Q15            */
);
#endif
+8 −0
Original line number Diff line number Diff line
@@ -1275,6 +1275,14 @@ const Word32 ica_sincInterp2_fx[2 * SINC_ORDER1 + 1] = {
    -4988604, 0
};

const Word32 ica_sincInterp4_fx[2 * SINC_ORDER1 + 1] = {
    0, -7054484, -11890617, -10587094, 0, 17813376, 32618130, 29564408, 0, -46911780, -82209968, -71380208, 0, 105465072, 180201792, 153819952, 0, -226492960, -394310208, -349923872, 0, 621904832, 1345701248, 1925805312, 2147483647, 1925805312, 1345701248, 621904832, 0, -349923872, -394310208, -226492960, 0, 153819952, 180201792, 105465072, 0, -71380208, -82209968, -46911780, 0, 29564408, 32618130, 17813376, 0, -10587094, -11890617, -7054484, 0
};

const Word32 ica_sincInterp6_fx[2 * SINC_ORDER1 + 1] = {
    0, -7481833, -15444702, -22462678, -25151328, -18893562, 0, 31359704, 68816112, 99516536, 106796512, 75709536, 0, -111862424, -234090752, -326303712, -341870816, -240232560, 0, 371151744, 833251584, 1319259392, 1748116096, 2042624128, 2147483647, 2042624128, 1748116096, 1319259392, 833251584, 371151744, 0, -240232560, -341870816, -326303712, -234090752, -111862424, 0, 75709536, 106796512, 99516536, 68816112, 31359704, 0, -18893562, -25151328, -22462678, -15444702, -7481833, 0
};

/*----------------------------------------------------------------------------------*
 * Stereo IC-BWE ROM tables
 *----------------------------------------------------------------------------------*/
Loading