Commit 30f347c3 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'core_coder_cleanup_evs_fixes' into 'main'

Float buffer/structure element cleanup and EVS/IVAS crash fixes.

See merge request !247
parents 30632c9d 883aa83f
Loading
Loading
Loading
Loading
Loading
+2 −39
Original line number Diff line number Diff line
@@ -411,21 +411,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
            }
            st->preemph_fac_float = fixedToFloat( st->preemph_fac, 15 );
            st->TcxBandwidth_float = fixedToFloat( st->TcxBandwidth, 15 );
            IF( EQ_32( st->sr_core, INT_FS_16k ) )
            {
                st->gamma_float = GAMMA16k_FLT;
                move16();
            }
            ELSE IF( GT_32( st->sr_core, INT_FS_16k ) && EQ_16( st->element_mode, IVAS_CPE_MDCT ) )
            {
                st->gamma_float = GAMMA16k_FLT;
                move16();
            }
            ELSE
            {
                st->gamma_float = GAMMA1_FLT;
                move16();
            }

            IF( st->hBWE_TD != NULL )
            {
                Q_state_lsyn_filt_shb = Q_factor_arr( hBWE_TD->state_lsyn_filt_shb, 6 );
@@ -870,21 +856,6 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
            }
            st->preemph_fac_float = fixedToFloat( st->preemph_fac, 15 );
            st->TcxBandwidth_float = fixedToFloat( st->TcxBandwidth, 15 );
            IF( EQ_32( st->sr_core, INT_FS_16k ) )
            {
                st->gamma_float = GAMMA16k_FLT;
                move16();
            }
            ELSE IF( GT_32( st->sr_core, INT_FS_16k ) && EQ_16( st->element_mode, IVAS_CPE_MDCT ) )
            {
                st->gamma_float = GAMMA16k_FLT;
                move16();
            }
            ELSE
            {
                st->gamma_float = GAMMA1_FLT;
                move16();
            }
            IF( st->hBWE_TD != NULL )
            {
                Q_state_lsyn_filt_shb = Q_factor_arr( hBWE_TD->state_lsyn_filt_shb, 6 );
@@ -1120,14 +1091,6 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
            st->mem_MA_fx[p] = (Word16) ( st->mem_MA[p] * 2.56 );
            st->mem_AR_fx[p] = (Word16) ( st->mem_AR[p] * 2.56 );
        }
        if ( st->gamma_float == GAMMA1_FLT )
        {
            st->inv_gamma = GAMMA1_INV;
        }
        else if ( st->gamma_float == GAMMA16k_FLT )
        {
            st->inv_gamma = GAMMA16k_INV;
        }

        for ( int p = 0; p < 2 * NB_SUBFR16k + 2; p++ )
        {
@@ -1234,7 +1197,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
            }
        }

        st->gamma = float_to_fix16( st->gamma_float, Q15 );
        //st->gamma = float_to_fix16( st->gamma_float, Q15 );
        st->hTcxDec->cummulative_damping_tcx = float_to_fix16( st->hTcxDec->cummulative_damping_tcx_float, Q15 );
        // st->Mode2_lp_gainp = float_to_fix(st->lp_gainp, Q16);
        st->Mode2_lp_gainp = float_to_fix( st->lp_gainp, Q29 );
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@

#define INV_SQRT2                               7.071067811865475e-1f /* 1/sqrt(2) */
#define INV_SQRT3                               0.577350269189626f    /* 1/sqrt(3) */
#define INV_SQRT2_FX                               1518500224 /* 1/sqrt(2) */
#define INV_SQRT2_FX                               1518500224 /* 1/sqrt(2) in Q31 */

#ifdef IVAS_FLOAT_FIXED
#define INV_SQRT2_FX_Q15                        23170                 /* 1/sqrt(2) Q15*/
+59 −3
Original line number Diff line number Diff line
@@ -820,6 +820,19 @@ void ivas_imdft_fx(
    const Word16 length                                        /* i  : signal length                           */
);
#endif
#ifdef IVAS_FLOAT_FIXED
void TonalMdctConceal_create_concealment_noise_ivas_fx(
    Word32 concealment_noise[L_FRAME48k],
    Word16 *concealment_noise_exp,
    CPE_DEC_HANDLE hCPE,
    const Word16 L_frameTCX,
    const Word16 L_frame,
    const Word16 idchan,
    const Word16 subframe_idx,
    const Word16 core,
    const Word16 crossfade_gain,
    const TONALMDCTCONC_NOISE_GEN_MODE noise_gen_mode);
#endif
void TonalMdctConceal_create_concealment_noise_ivas(
    float concealment_noise[L_FRAME48k],
    CPE_DEC_HANDLE hCPE,
@@ -887,6 +900,19 @@ ivas_error ivas_jbm_dec_render(
    uint16_t *nSamplesAvailableNext,                            /* o  : number of samples still available in the rendering pipeline */
    int16_t *data                                               /* o  : output synthesis signal                                     */
);
#ifdef IVAS_FLOAT_FIXED
ivas_error ivas_jbm_dec_flush_renderer_fx(
    Decoder_Struct *st_ivas,                     /* i/o: IVAS decoder structure    */
    const Word16 tc_granularity_new,            /* i  : new renderer granularity  */
    const RENDERER_TYPE renderer_type_old,       /* i  : old renderer type         */
    const AUDIO_CONFIG intern_config_old,        /* i  : old internal config       */
    const IVAS_OUTPUT_SETUP_HANDLE hIntSetupOld, /* i  : old internal output setup */
    const MC_MODE mc_mode_old,                   /* i  : old MC mode               */
    const ISM_MODE ism_mode_old,                 /* i  : old ISM mode              */
    UWord16 *nSamplesRendered,                  /* o  : number of samples flushed */
    Word16 *data                                /* o  : output synthesis signal                 */
);
#endif // IVAS_FLOAT_FIXED

ivas_error ivas_jbm_dec_flush_renderer(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                                      */
@@ -4862,6 +4888,16 @@ void ivas_spar_config(
    int32_t *core_nominal_brate,                                /* o  : core-coding nominal bitrate             */
    const int16_t sid_format                                    /* i  : IVAS format indicator from SID frame    */
);
#ifdef IVAS_FLOAT_FIXED
ivas_error ivas_sba_linear_renderer_fx(
	Word32 *output_f[],                   /* i/o: synthesized core-coder transport channels/DirAC output  */
	const Word16 output_frame,          /* i  : output frame length per channel                         */
	const Word16 nchan_in,              /* i  : number of input ambisonics channels                     */
	const Word16 nchan_ism,             /* i  : number of objects                                      */
	const AUDIO_CONFIG output_config,    /* i  : output audio configuration                              */
	const IVAS_OUTPUT_SETUP output_setup /* i  : output format setup                                     */
);
#endif // IVAS_FLOAT_FIXED

ivas_error ivas_sba_linear_renderer(
    float *output_f[],                                          /* i/o: synthesized core-coder transport channels/DirAC output  */
@@ -5164,7 +5200,16 @@ void ivas_sba_dec_digest_tc_fx(
    const Word16 nCldfbSlots,         /* i  : number of CLDFB slots        */
    const Word16 nSamplesForRendering /* i  : number of samples provided   */
);
#endif
ivas_error ivas_sba_dec_render_fx(
    Decoder_Struct *st_ivas,         /* i/o: IVAS decoder handle                       */
    const UWord16 nSamplesAsked,    /* i  : number of CLDFB slots requested           */
    UWord16 *nSamplesRendered,      /* o  : number of CLDFB slots rendered            */
    UWord16 *nSamplesAvailableNext, /* o  : number of CLDFB slots still to render     */
    Word32 *output_fx[],               /* o  : rendered time signal                      */
    Word16 out_len/*Store the length of values in each channel*/
);
#endif // IVAS_FLOAT_FIXED

ivas_error ivas_sba_dec_render(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                     */
    const uint16_t nSamplesAsked,                               /* i  : number of CLDFB slots requested         */
@@ -5175,8 +5220,9 @@ ivas_error ivas_sba_dec_render(
#ifdef IVAS_FLOAT_FIXED
void ivas_spar_dec_upmixer_sf_fx(
    Decoder_Struct *st_ivas,     /* i/o: IVAS decoder handle                     */
    float *output[],             /* o  : output audio channels                   */
    const Word16 nchan_internal /* i  : number of internal channels             */
    Word32 *output_fx[],             /* o  : output audio channels                   */
    const Word16 nchan_internal, /* i  : number of internal channels             */
	Word16 out_len
);
#endif // IVAS_FLOAT_FIXED

@@ -6700,6 +6746,16 @@ void ivas_osba_enc(
ivas_error ivas_osba_data_open(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder handle                     */
);
#ifdef IVAS_FLOAT_FIXED
ivas_error ivas_osba_dirac_td_binaural_jbm_fx(
    Decoder_Struct *st_ivas,      /* i/o: IVAS decoder structure                    */
    const UWord16 nSamplesAsked, /* i  : number of CLDFB slots requested           */
    UWord16 *nSamplesRendered,   /* o  : number of CLDFB slots rendered            */
    UWord16 *nSamplesAvailable,  /* o  : number of CLDFB slots still to render     */
    Word32 *output_fx[],          /* o  : rendered time signal                      */
    Word16 out_len/*Store the length of values in each channel*/
);
#endif // IVAS_FLOAT_FIXED

ivas_error ivas_osba_dirac_td_binaural_jbm(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
+1 −1
Original line number Diff line number Diff line
@@ -1596,7 +1596,7 @@ void ivas_hq_pred_hb_bws_fx(
    const Word16 *SWB_fenv               /* i  : SWB frequency envelopes             Q1  */
);

void synchro_synthesis_fixed_clean(
void synchro_synthesis_fx(
  const Word32 ivas_total_brate,     /* i  : IVAS total bitrate                  */
  CPE_DEC_HANDLE hCPE,                /* i/o: CPE decoder structure               */
  Word32 *output_fx[CPE_CHANNELS],        /* i/o: output synthesis signal             */
+2 −0
Original line number Diff line number Diff line
@@ -62,6 +62,8 @@ const Word16 a_hp400_ivas_fx[3] = { 4096, 7320, -3540 };/*Q12*/
Word32 float_to_fix( float number, Word32 Q )
{
    assert( Q >= 0 );
    if (number == 1.0f && Q == Q31)
        return ONE_IN_Q31;
    assert( fabs( number ) < pow( 2, 31 - Q ) );
    Word32 ret = (Word32) ( number * ( (UWord32) 1 << Q ) );
    return ret;
Loading