Commit 57df6e89 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

mc_dec_reconfig conversions and float cleanup

parent 5732e5a2
Loading
Loading
Loading
Loading
Loading
+44 −1
Original line number Diff line number Diff line
@@ -1614,7 +1614,7 @@ void configureCldfb_ivas_fx(
 *
 * open and configures a CLDFB handle
 *--------------------------------------------------------------------*/

#ifdef IVAS_FLOAT_FIXED
ivas_error openCldfb_ivas(
    HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle                */
    CLDFB_TYPE type,                   /* i  : analysis or synthesis             */
@@ -1667,7 +1667,50 @@ ivas_error openCldfb_ivas(

    return IVAS_ERR_OK;
}
#else
ivas_error openCldfb_ivas(
  HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle                */
  CLDFB_TYPE type,                   /* i  : analysis or synthesis             */
  const int32_t sampling_rate,       /* i  : sampling rate                     */
  CLDFB_PROTOTYPE prototype          /* i  : CLDFB version (1.25ms/5ms delay)  */
)
{
  HANDLE_CLDFB_FILTER_BANK hs;
  int16_t buf_len;

  if ((hs = (HANDLE_CLDFB_FILTER_BANK)malloc(sizeof(CLDFB_FILTER_BANK))) == NULL)
  {
    return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB");
  }

  hs->type = type;
  hs->prototype = prototype;

  configureCldfb_ivas(hs, sampling_rate);
  hs->memory_flt = NULL;
  hs->memory_length = 0;

  if (type == CLDFB_ANALYSIS)
  {
    buf_len = hs->p_filter_length - hs->no_channels;
  }
  else
  {
    buf_len = hs->p_filter_length;
  }

  if ((hs->cldfb_state = (float *)malloc(buf_len * sizeof(float))) == NULL)
  {
    return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB");
  }

  set_f(hs->cldfb_state, 0.0f, buf_len);

  *h_cldfb = hs;

  return IVAS_ERR_OK;
}
#endif
#ifdef IVAS_FLOAT_FIXED
ivas_error openCldfb_ivas_fx(
    HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle                */
+10 −0
Original line number Diff line number Diff line
@@ -4630,6 +4630,11 @@ void ivas_param_mc_enc(
    float *data_f[],                                            /* i/o: input/transport MC data                             */
    const int16_t input_frame                                   /* i  : input frame length                                  */
);
#ifdef IVAS_FLOAT_FIXED
ivas_error ivas_param_mc_dec_open_fx(
    Decoder_Struct *st_ivas /* i/o: IVAS decoder structure  */
);
#endif // IVAS_FLOAT_FIXED

ivas_error ivas_param_mc_dec_open(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                              */
@@ -4644,6 +4649,11 @@ ivas_error ivas_param_mc_dec_reconfig_fx(
ivas_error ivas_param_mc_dec_reconfig(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                              */
);
#ifdef IVAS_FLOAT_FIXED
void ivas_param_mc_dec_close_fx(
	PARAM_MC_DEC_HANDLE *hParamMC_out /* i/o: Parametric MC decoder handle   */
);
#endif // IVAS_FLOAT_FIXED

void ivas_param_mc_dec_close(
    PARAM_MC_DEC_HANDLE *hParamMC                               /* i/o: Parametric MC decoder handle                        */
+38 −0
Original line number Diff line number Diff line
@@ -727,6 +727,7 @@ void Post_music_postP(
 *
 * Initialize LD music postfilter state structure
 *-------------------------------------------------------------------*/
#ifdef IVAS_FLOAT_FIXED

void music_postfilt_init_flt(
    MUSIC_POSTFILT_HANDLE hMusicPF /* i/o: LD music postfilter handle */
@@ -801,3 +802,40 @@ void music_postfilt_init_flt(
#endif
    return;
}
#else
    void music_postfilt_init_flt(
      MUSIC_POSTFILT_HANDLE hMusicPF /* i/o: LD music postfilter handle */
    )
    {
      int16_t i;

      set_f(hMusicPF->dct_post_old_exc, 0, DCT_L_POST - OFFSET2);

      hMusicPF->LDm_enh_min_ns_gain = (float)pow(10.0f, -12 / 20.0f);
      hMusicPF->LDm_last_music_flag = 0;
      set_f(hMusicPF->LDm_lt_diff_etot, 0, MAX_LT);
      hMusicPF->LDm_thres[0] = TH_0_MIN;
      hMusicPF->LDm_thres[1] = TH_1_MIN;
      hMusicPF->LDm_thres[2] = TH_2_MIN;
      hMusicPF->LDm_thres[3] = TH_3_MIN;
      hMusicPF->LDm_nb_thr_1 = 0;
      hMusicPF->LDm_nb_thr_3 = 0;
      hMusicPF->LDm_mem_etot = 0.0f;

      for (i = 0; i < VOIC_BINS_HR; i++)
      {
        hMusicPF->LDm_enh_lp_gbin[i] = 1.0f;
        hMusicPF->LDm_enh_lf_EO[i] = 0.01f;
      }

      for (i = 0; i < MBANDS_GN_LD; i++)
      {
        hMusicPF->LDm_bckr_noise[i] = E_MIN;
      }

      set_f(hMusicPF->filt_lfE, 1.0f, DCT_L_POST);
      hMusicPF->last_nonfull_music = 0;

      return;
    }
#endif
 No newline at end of file
+33 −1
Original line number Diff line number Diff line
@@ -1449,7 +1449,7 @@ void open_decoder_LPD(
 *
 * Initialization TCX-LTP handle
 *-----------------------------------------------------------------------*/

#ifdef IVAS_FLOAT_FIXED
void tcxltp_dec_init(
    TCX_LTP_DEC_HANDLE hTcxLtpDec,
    const int16_t ini_frame,
@@ -1489,7 +1489,39 @@ void tcxltp_dec_init(

    return;
}
#else
void tcxltp_dec_init(
  TCX_LTP_DEC_HANDLE hTcxLtpDec,
  const int16_t ini_frame,
  const int16_t last_codec_mode,
  const int16_t element_mode,
  const int16_t pit_max,
  const int32_t sr_core)
{
  hTcxLtpDec->tcxltp_gain_float = 0.0f;

  hTcxLtpDec->tcxltp = getTcxLtp(sr_core);

  if (ini_frame == 0 || (last_codec_mode == MODE1 && element_mode == EVS_MONO))
  {

    hTcxLtpDec->tcxltp_pitch_int = pit_max;
    hTcxLtpDec->tcxltp_pitch_fr = 0;

    if (ini_frame == 0)
    {
      set_f(hTcxLtpDec->tcxltp_mem_in_float, 0.0f, TCXLTP_MAX_DELAY);
      set_f(hTcxLtpDec->tcxltp_mem_out_float, 0.0f, L_FRAME48k);
      hTcxLtpDec->tcxltp_pitch_int_post_prev = 0;
      hTcxLtpDec->tcxltp_pitch_fr_post_prev = 0;
      hTcxLtpDec->tcxltp_gain_post_prev_float = 0.f;
      hTcxLtpDec->tcxltp_filt_idx_prev = -1;
    }
  }

  return;
}
#endif
/*-----------------------------------------------------------------------*
 * reset_tcx_overl_buf()
 *
+75 −1
Original line number Diff line number Diff line
@@ -649,7 +649,7 @@ void hq_core_dec(
 *
 * Initialize HQ core state structure
 *-------------------------------------------------------------------*/

#ifdef IVAS_FLOAT_FIXED
void HQ_core_dec_init_flt(
    HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle  */
)
@@ -745,6 +745,80 @@ void HQ_core_dec_init_flt(

    return;
}
#else
void HQ_core_dec_init_flt(
  HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle  */
)
{

  set_f(hHQ_core->old_out, 0, L_FRAME48k);
  set_f(hHQ_core->old_outLB, 0, L_FRAME32k);
  set_s(hHQ_core->old_is_transient, 0, 3);

  hHQ_core->oldHqVoicing = 0;

  set_f(hHQ_core->prev_noise_level, 0.0f, 2);
  hHQ_core->prev_R = 0;
  set_f(hHQ_core->prev_coeff_out, 0, L_HQ_WB_BWE);
  set_s(hHQ_core->prev_SWB_peak_pos, 0, SPT_SHORTEN_SBNUM);

  /* HQ GENERIC */
  hHQ_core->hq_generic_seed = RANDOM_INITSEED;

  hHQ_core->mem_norm[0] = 31;
  set_s(hHQ_core->mem_norm + 1, 39, SFM_N_ENV_STAB - 1);
  hHQ_core->mem_env_delta = 0;
  hHQ_core->no_att_hangover = 0;
  hHQ_core->energy_lt = 300.0f;

  hHQ_core->HqVoicing = 0;
  set_f(hHQ_core->fer_samples, 0, L_FRAME48k);
  set_f(hHQ_core->prev_env, 0, SFM_N_WB);
  set_f(hHQ_core->prev_normq, 0, SFM_N_WB);
  hHQ_core->prev_hqswb_clas = HQ_NORMAL;

  set_f(hHQ_core->last_ni_gain, 0, BANDS_MAX);
  set_f(hHQ_core->last_env, 0, BANDS_MAX);
  hHQ_core->last_max_pos_pulse = 0;
  hHQ_core->prev_frm_hfe2 = 0;
  hHQ_core->prev_stab_hfe2 = 0;
  hHQ_core->prev_ni_ratio = 0.5f;
  set_f(hHQ_core->prev_En_sb, 0.0f, NB_SWB_SUBBANDS);


  /*----------------------------------------------------------------------------------*
   * HQ FEC
   *----------------------------------------------------------------------------------*/

  set_f(hHQ_core->X_sav, 0.0f, PH_ECU_SPEC_SIZE);
  hHQ_core->num_p = 0;
  hHQ_core->ph_ecu_active = 0;
  hHQ_core->ni_seed_forfec = 0;
  hHQ_core->last_fec = 0;
  hHQ_core->ph_ecu_HqVoicing = 0;
  set_f(hHQ_core->oldgapsynth, 0.0f, L_FRAME48k);
  hHQ_core->env_stab = 0.75f;
  hHQ_core->mem_norm_hqfec[0] = 31;
  set_s(hHQ_core->mem_norm_hqfec + 1, 39, SFM_N_ENV_STAB - 1);
  hHQ_core->mem_env_delta_hqfec = 0;
  hHQ_core->env_stab_plc = 0.0f;
  set_f(hHQ_core->env_stab_state_p, 1.0f / NUM_ENV_STAB_PLC_STATES, NUM_ENV_STAB_PLC_STATES);
  hHQ_core->envstabplc_hocnt = 0;

  set_f(hHQ_core->mag_chg_1st, 1.0f, LGW_MAX);
  set_f(hHQ_core->Xavg, 0.0f, LGW_MAX);
  hHQ_core->beta_mute = BETA_MUTE_FAC_INI_FLT;

  hHQ_core->time_offs = 0;
  hHQ_core->ber_occured_in_pvq = 0;

  hHQ_core->last_hq_core_type = -1;

  reset_preecho_dec(hHQ_core);

  return;
}
#endif

#ifndef IVAS_FLOAT_FIXED
/*-------------------------------------------------------------------*
Loading