Commit b0145abd authored by Sandesh Venkatesh's avatar Sandesh Venkatesh Committed by Fabian Bauer
Browse files

10dB LTV crash fix, Q-documentation for lib_enc files

parent 356bda5f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7257,7 +7257,7 @@ Word16 find_guarded_bits_fx( Word32 n )
    }
}

Word16 L_norm_arr( Word32 *arr, Word16 size )
Word16 L_norm_arr( const Word32 *arr, Word16 size )
{
    Word16 q = 31;
    move16();
+80 −80
Original line number Diff line number Diff line
@@ -69,10 +69,10 @@ void stereo_dmx_evs_enc(

/*! r: number of channels to be analysed */

void copy_encoder_config(
void copy_encoder_config_ivas_fx(
    Encoder_Struct *st_ivas,                                    /* i  : IVAS encoder structure                  */
    Encoder_State *st,                                          /* o  : encoder state structure                 */
    const int16_t flag_all                                      /* i  : flag 1==update all, 0=partial update    */
    const Word16 flag_all                                      /* i  : flag 1==update all, 0=partial update    Q0*/
);


@@ -200,94 +200,94 @@ ivas_error pre_proc_front_ivas(
ivas_error pre_proc_front_ivas_fx(
    SCE_ENC_HANDLE hSCE,                                       /* i/o: SCE encoder structure                   */
    CPE_ENC_HANDLE hCPE,                                       /* i/o: CPE encoder structure                   */
    const Word32 element_brate,                                /* i  : SCE/CPE element bitrate                 */
    const Word16 nb_bits_metadata,                             /* i  : number of metadata bits                 */
    const Word16 input_frame,                                  /* i  : frame length                            */
    const Word16 n,                                            /* i  : channel number                          */
    Word16 old_inp_12k8_fx[],                                  /* o  : (Q-1) buffer of old input signal              */
    Word16 old_inp_16k_fx[],                                       /* o  : buffer of old input signal @16kHz     Q-1 */
    Word32 *ener_fx,                                              /* o  : residual energy from Levinson-Durbin  Q_r  */
    const Word32 element_brate,            /* i  : SCE/CPE element bitrate					Q0*/
    const Word16 nb_bits_metadata,         /* i  : number of metadata bits					Q0*/
    const Word16 input_frame,              /* i  : frame length								Q0*/
    const Word16 n,                        /* i  : channel number							Q0*/
    Word16 old_inp_12k8_fx[],              /* o  : buffer of old input signal				Q_new-1*/
    Word16 old_inp_16k_fx[],               /* o  : buffer of old input signal @16kHz		Q_new-1*/
    Word32 *ener_fx,                       /* o  : residual energy from Levinson-Durbin		epsP_fx_q*/
    Word16 *relE_fx,                       /* o  : frame relative energy					Q8*/
    Word16 A_fx[NB_SUBFR16k * ( M + 1 )],                          /* o  : A(z) unquantized for the 4 subframes    */
    Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )],                         /* o  : weighted A(z) unquantized for subframes */
    Word32 epsP_fx[M + 1],                                         /* o  : LP prediction errors                    */
    Word16 A_fx[NB_SUBFR16k * ( M + 1 )],  /* o  : A(z) unquantized for the 4 subframes		Q12*/
    Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )], /* o  : weighted A(z) unquantized for subframes	Q12*/
    Word32 epsP_fx[M + 1],                 /* o  : LP prediction errors						epsP_fx_q*/
    Word16 *epsP_fx_q,
    Word16 lsp_new_fx[M],                                          /* o  : LSPs at the end of the frame				Q15*/
    Word16 lsp_mid_fx[M],                                          /* o  : LSPs in the middle of the frame			Q15*/
    Word16 *vad_hover_flag,                                    /* o  : VAD hangover flag                       */
    Word16 *attack_flag,                                       /* o  : flag signaling attack                  */
    Word16 *vad_hover_flag,                                        /* o  : VAD hangover flag						Q0*/
    Word16 *attack_flag,                                           /* o  : flag signaling attack					Q0*/
    Word32 realBuffer_fx[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: real buffer								Q(q_re_im_buf)*/
    Word32 imagBuffer_fx[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: imag buffer								Q(q_re_im_buf)*/
    Word16 *q_re_im_buf,                                           /* i/o: Q-factor of real and imag buffer			*/
    Word16 old_wsp[],                                           /* o  : weighted input signal buffer            q_old_wsp*/
    Word16 old_wsp_fx[],                                           /* o  : weighted input signal buffer				q_old_wsp*/
    Word16 *q_old_wsp,
    Word16 pitch_fr_fx[NB_SUBFR],                /* o  : fractional pitch values						Q6*/
    Word16 voicing_fr_fx[NB_SUBFR],              /* o  : fractional pitch gains							Q15*/
    Word16 *loc_harm,                                          /* o  : harmonicity flag                        */
    Word16 *loc_harm,                            /* o  : harmonicity flag								Q0*/
    Word16 *cor_map_sum_fx,                      /* o  : speech/music clasif. parameter					Q8*/
    Word16 *vad_flag_dtx,                                      /* o  : HE-SAD flag with additional DTX HO      */
    Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX],                      /* o  : energy buffer                           */
    Word16 *vad_flag_dtx,                        /* o  : HE-SAD flag with additional DTX HO				Q0*/
    Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* o  : energy buffer									enerBuffer_fx_exp*/
    Word16 *enerBuffer_fx_exp,                   /* o  : energy buffer									*/
    Word16 fft_buff_fx[2 * L_FFT],                             /* o  : FFT buffer                                 */
    Word16 fft_buff_fx[2 * L_FFT],               /* o  : FFT buffer										fft_buff_fx_q*/
    Word16 *fft_buff_fx_q,                       /* o  : FFT buffer										*/
    const Word16 tdm_A_PCh_fx[M + 1],            /* i  : unq. LP coeff. of primary channel				Q12*/
    const Word16 tdm_lsp_new_PCh_fx[M],          /* i  : unq. LSPs of primary channel					Q15*/
    const Word16 currFlatness_fx,                /* i  : flatness parameter								Q7*/
    const Word16 tdm_ratio_idx,                                /* i  : Current Ratio_L index                   */
    Word32 fr_bands_LR_fx[][2 * NB_BANDS],                         /* i  : energy in frequency bands (fr_bands_LR_fx_q) */
    const Word16 tdm_ratio_idx,                  /* i  : Current Ratio_L index							Q0*/
    Word32 fr_bands_LR_fx[][2 * NB_BANDS],       /* i  : energy in frequency bands (fr_bands_LR_fx_q)	fr_bands_LR_fx_q*/
    Word16 fr_bands_LR_fx_q[CPE_CHANNELS],
    const Word16 Etot_LR_fx[],          /* i  : total energy Left & Right channel						Q8*/
    Word32 lf_E_LR_fx[][2 * VOIC_BINS], /* i  : per bin spectrum energy in lf, LR channels				(lf_E_LR_fx_q)*/
    Word16 lf_E_LR_fx_q,
    const Word16 localVAD_HE_SAD_LR[],                         /* i  : HE-SAD flag without hangover, LR channels  */
    const Word16 localVAD_HE_SAD_LR[],        /* i  : HE-SAD flag without hangover, LR channels			Q0*/
    Word32 band_energies_LR_fx[2 * NB_BANDS], /* o  : energy in critical bands without minimum noise floor E_MIN	(band_energies_LR_fx_q)*/
    Word16 band_energies_LR_fx_q,
    const Word16 flag_16k_smc,                                 /* i  : flag to indicate if the OL SMC is run at 16 kHz */
    const Word16 front_vad_flag,                               /* i  : front-VAD flag to overwrite VAD decision */
    const Word16 force_front_vad,                              /* i  : flag to force VAD decision               */
    const Word16 front_vad_dtx_flag,                           /* i  : front-VAD DTX flag to overwrite VAD decision*/
    const Word16 flag_16k_smc,       /* i  : flag to indicate if the OL SMC is run at 16 kHz			Q0*/
    const Word16 front_vad_flag,     /* i  : front-VAD flag to overwrite VAD decision					Q0*/
    const Word16 force_front_vad,    /* i  : flag to force VAD decision									Q0*/
    const Word16 front_vad_dtx_flag, /* i  : front-VAD DTX flag to overwrite VAD decision				Q0*/
    const IVAS_FORMAT ivas_format,   /* i  : IVAS format												*/
    const Word16 MCT_flag,                                     /* i  : hMCT handle allocated (1) or not (0)    */
    const Word32 ivas_total_brate,                             /* i  : IVAS total bitrate - for setting the DTX */
    const Word16 MCT_flag,           /* i  : hMCT handle allocated (1) or not (0)						Q0*/
    const Word32 ivas_total_brate,   /* i  : IVAS total bitrate - for setting the DTX					Q0*/
    Word16 *Q_new
#ifdef DEBUG_MODE_INFO
    ,
    const Word16 ch_idx
#endif
);
ivas_error pre_proc_ivas(
ivas_error pre_proc_ivas_fx(
    Encoder_State *st,                     /* i/o: encoder state structure                 */
    const Word16 last_element_mode,        /* i  : last element mode                       */
    const Word32 element_brate,            /* i  : element bitrate                         */
    const Word32 last_element_brate,       /* i  : last element bitrate                    */
    const Word16 input_frame,              /* i  : frame length                            */
    Word16 old_inp_12k8_fx[],              /* i/o: buffer of old input signal              */
    Word16 old_inp_16k_fx[],               /* i/o: buffer of old input signal @ 16kHz      */
    Word16 **inp_fx,                       /* o  : ptr. to inp. signal in the current frame*/
    Word32 *ener_fx,                       /* o  : residual energy from Levinson-Durbin Q6 */
    Word16 A_fx[NB_SUBFR16k * ( M + 1 )],  /* i/o: A(z) unquantized for the 4 subframes    */
    Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: weighted A(z) unquantized for subframes */
    const Word16 last_element_mode,        /* i  : last element mode						Q0*/
    const Word32 element_brate,            /* i  : element bitrate							Q0*/
    const Word32 last_element_brate,       /* i  : last element bitrate						Q0*/
    const Word16 input_frame,              /* i  : frame length								Q0*/
    Word16 old_inp_12k8_fx[],              /* i/o: buffer of old input signal				Q_new-1 */
    Word16 old_inp_16k_fx[],               /* i/o: buffer of old input signal @ 16kHz		Q_new-1 */
    Word16 **inp_fx,                       /* o  : ptr. to inp. signal in the current frame	Q_new*/
    Word32 *ener_fx,                       /* o  : residual energy from Levinson-Durbin		epsP_fx_q*/
    Word16 A_fx[NB_SUBFR16k * ( M + 1 )],  /* i/o: A(z) unquantized for the 4 subframes		Q12*/
    Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: weighted A(z) unquantized for subframes	Q14*/
    Word32 epsP_fx[M + 1],                 /* i  : LP prediction errors						epsP_fx_q*/
    Word16 *epsP_fx_q,                     /* i  : LP prediction errors						*/
    Word16 lsp_new_fx[M],                  /* i/o: LSPs at the end of the frame            */
    Word16 lsp_mid_fx[M],                  /* i/o: LSPs in the middle of the frame         */
    Word16 *new_inp_resamp16k_fx,          /* o  : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */
    Word16 *Voicing_flag,                  /* o  : voicing flag for HQ FEC                 */
    Word16 old_wsp_fx[],                   /* i  : weighted input signal buffer            */
    Word16 lsp_new_fx[M],                  /* i/o: LSPs at the end of the frame				Q15*/
    Word16 lsp_mid_fx[M],                  /* i/o: LSPs in the middle of the frame			Q15*/
    Word16 *new_inp_resamp16k_fx,          /* o  : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE	Q_new-1*/
    Word16 *Voicing_flag,                  /* o  : voicing flag for HQ FEC					Q0*/
    Word16 old_wsp_fx[],                   /* i  : weighted input signal buffer				e_old_wsp*/
    Word16 e_old_wsp,
    const Word16 loc_harm,       /* i  : harmonicity flag                        */
    const Word16 vad_flag_dtx,   /* i  : HE-SAD flag with additional DTX HO      */
    const Word16 MCT_flag,       /* i  : hMCT handle allocated (1) or not (0)    */
    const Word16 vad_hover_flag, /* i  : VAD hangover flag                       */
    const Word16 flag_16k_smc,   /* i  : flag to indicate if the OL SMC is run at 16 kHz */
    Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX],
    const Word16 loc_harm,       /* i  : harmonicity flag									Q0*/
    const Word16 vad_flag_dtx,   /* i  : HE-SAD flag with additional DTX HO					Q0*/
    const Word16 MCT_flag,       /* i  : hMCT handle allocated (1) or not (0)				Q0*/
    const Word16 vad_hover_flag, /* i  : VAD hangover flag									Q0*/
    const Word16 flag_16k_smc,   /* i  : flag to indicate if the OL SMC is run at 16 kHz	Q0*/
    Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX],	/* e_enerBuffer */
    Word16 e_enerBuffer,
    Word16 fft_buff_fx[2 * L_FFT],
    Word16 cor_map_sum_fx, // Q8
    Word16 fft_buff_fx[2 * L_FFT], /* Qx */
    Word16 cor_map_sum_fx,         /* Q8 */
    Word16 *Q_new
);
/*! r: number of clipped samples */
void ivas_initialize_handles_enc(
void ivas_initialize_handles_enc_fx(
    Encoder_Struct *st_ivas                                     /* i/o: IVAS encoder structure                  */
);

@@ -295,16 +295,16 @@ ivas_error ivas_init_encoder(
    Encoder_Struct *st_ivas                                     /* i/o: IVAS encoder structure                  */
);

void ivas_destroy_enc(
void ivas_destroy_enc_fx(
    Encoder_Struct *st_ivas                                     /* i/o: IVAS encoder structure                  */
);

ivas_error ivas_initialize_MD_bstr_enc(
ivas_error ivas_initialize_MD_bstr_enc_fx(
    BSTR_ENC_HANDLE *hBstr,                                     /* o  : encoder MD bitstream handle             */
    Encoder_Struct *st_ivas                                     /* i/o: IVAS encoder structure                  */
);

void ivas_destroy_MD_bstr_enc(
void ivas_destroy_MD_bstr_enc_fx(
    BSTR_ENC_HANDLE *hMetaData                                  /* i/o: encoder MD bitstream handle             */
);

@@ -3347,11 +3347,11 @@ void pca_dec_s3(
);


void ivas_huffman_encode(
void ivas_huffman_encode_fx(
    ivas_huffman_cfg_t *huff_cfg,
    int16_t in,
    int16_t *hcode,
    int16_t *hlen
    Word16 in,
    Word16 *hcode,
    Word16 *hlen
);


+8 −7
Original line number Diff line number Diff line
@@ -3444,17 +3444,18 @@ ivas_error ivas_param_mc_enc_reconfig_fx(
    Encoder_Struct *st_ivas /* i/o: IVAS encoder handle                                 */
);

Word16 ivas_arith_encode_cmplx_cell_array(
Word16 ivas_arith_encode_cmplx_cell_array_fx(
    ivas_arith_t *pArith_re,
    ivas_arith_t *pArith_re_diff,
    const Word16 *pDo_diff,
    const Word16 nB,
    Word16 *pSymbol_re,
    Word16 *pSymbol_old_re,
    const Word16 *pDo_diff, /* Q0 */
    const Word16 nB,        /* Q0 */
    Word16 *pSymbol_re,     /* Q0 */
    Word16 *pSymbol_old_re, /* Q0 */
    ivas_cell_dim_t *pCell_dims,
    BSTR_ENC_HANDLE hMetaData,
    const Word16 any_diff,
    const Word16 wc_strat_arith );
    const Word16 any_diff,      /* Q0 */
    const Word16 wc_strat_arith /* Q0 */
);

ivas_error stereo_dmx_evs_init_encoder_fx(
    STEREO_DMX_EVS_ENC_HANDLE *hStereoDmxEVS_out, /* o  : Stereo downmix for EVS encoder handle   */
+1 −1
Original line number Diff line number Diff line
@@ -4577,7 +4577,7 @@ void DoRTFTn_fx_ivas(
Word16 find_guarded_bits_fx( Word32 n );
Word16 L_norm_arr( Word32 *arr, Word16 size );
Word16 L_norm_arr( const Word32 *arr, Word16 size );
Word16 norm_arr( Word16 *arr, Word16 size );
Word16 get_min_scalefactor( Word32 x, Word32 y );
+6 −1
Original line number Diff line number Diff line
@@ -281,13 +281,18 @@ Word32 sum2_32_exp_fx(
    Word16 gb          /* i  : guard bits                           */
)
{
    Word16 i, s;
    Word16 i, s, norm;
    Word64 W_tmp;

    W_tmp = 0;
    Word64 var_a = 0;
    move64();
    move64();

    norm = L_norm_arr( vec, lvec );

    gb = sub( gb, norm );

    FOR( i = 0; i < lvec; i++ )
    {
        var_a = W_mult0_32_32( vec[i], vec[i] );    // 2x
Loading