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

Stereo, OMASA LTV crash fixes, Float buffer cleanup

[x] Stereo LTV crash issues fixed:
    [stereo at 13.2 kbps, 32kHz in, 32kHz out, DTX on, random FER at 5%, bandwidth switching]
    [stereo bitrate switching from 13.2 kbps to 128 kbps, 32kHz in, 32kHz out]
[x] OMASA LTV crash issues fixed:
    [OMASA 1Dir1TC 4ISM at br sw techs 13.2 to 512 kbps start 32 kbps, 48kHz in, 48kHz out, BINAURAL out, FER at 5%]
    [OMASA 1Dir1TC 4ISM at br sw techs 13.2 to 512 kbps start 32 kbps, 48kHz in, 48kHz out, BINAURAL out, JBM Prof 5]
    [OMASA 2Dir2TC 3ISM at br sw techs 13.2 to 512 kbps start 160 kbps, 48kHz in, 48kHz out, MONO out, JBM Prof 5]
[x] Float buffers removal and cleanup changes
parent fac56a47
Loading
Loading
Loading
Loading
Loading
+28 −20
Original line number Diff line number Diff line
@@ -371,8 +371,8 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
                st->hHQ_core->Q_old_out = Q_factor_arr( st->hHQ_core->old_out, L_FRAME48k );
                st->hHQ_core->Q_old_outLB = Q_factor_arr( st->hHQ_core->old_outLB, L_FRAME32k );
				st->hHQ_core->Q_fer_samples = 0;
                floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k );
                floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k );
                //floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k );
                //floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k );
            }
            IF( st->cldfbAna )
            {
@@ -461,8 +461,8 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(

            IF( st->hHQ_core )
            {
                fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_out, L_FRAME48k );
                fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_outLB, L_FRAME32k );
                //fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_out, L_FRAME48k );
                //fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_outLB, L_FRAME32k );
            }
            IF( st->cldfbAna )
            {
@@ -591,8 +591,8 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
                st->hHQ_core->Q_old_out = 0;
                st->hHQ_core->Q_old_outLB = 0;
				st->hHQ_core->Q_fer_samples = 0;
                floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k );
                floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k );
                //floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k );
                //floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k );
            }
            IF( st->cldfbAna )
            {
@@ -684,8 +684,8 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(

            IF( st->hHQ_core )
            {
                fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_out, L_FRAME48k );
                fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_outLB, L_FRAME32k );
                //fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_wtda, L_FRAME48k );
                //fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_outLB, L_FRAME32k );
            }
            IF( st->cldfbAna )
            {
@@ -763,7 +763,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
            //hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( hTcxDec->tcxltp_last_gain_unmodified_float, Q15 );
        }

        floatToFixed_arr( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hHQ_core->old_out_fx + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), 0, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) );
        //floatToFixed_arr( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hHQ_core->old_out_fx + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), 0, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) );

        //if ( !st->tcxonly )
        //{
@@ -833,17 +833,17 @@ void fixed_to_float_stereo_tcx_core_dec(
    {
        if (st->hHQ_core->Q_old_wtda >= 0)
        {
            for ( int p = 0; p < st->L_frame; p++ )
            for ( int p = 0; p < 960; p++ )
            {
                st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda );
                st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda );
                //st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda );
                //st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda );
            }
        }
        else{
            for ( int p = 0; p < st->L_frame; p++ )
            for ( int p = 0; p < 960; p++ )
            {
                st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) );
                st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) );
                //st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) );
                //st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) );
            }
        }
    }
@@ -868,7 +868,7 @@ void fixed_to_float_stereo_tcx_core_dec(
            {
                for ( int p = 0; p < st->hFdCngDec->npart_shaping; p++ )
                {
                    st->hFdCngDec->msNoiseEst_float[p] = (float) st->hFdCngDec->msNoiseEst[p] / ( 1u << ( 31 - st->hFdCngDec->msNoiseEst_exp ) );
                    //st->hFdCngDec->msNoiseEst_float[p] = (float) st->hFdCngDec->msNoiseEst[p] / ( 1u << ( 31 - st->hFdCngDec->msNoiseEst_exp ) );
					
                }
            }
@@ -877,13 +877,21 @@ void fixed_to_float_stereo_tcx_core_dec(
    IF( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) )
    {

        FOR( Word16 ind = 0; ind < 640; ind++ )
        //FOR( Word16 ind = 0; ind < 640; ind++ )
        //{
        //    st->hHQ_core->old_outLB[ind] = (float) st->hHQ_core->old_out_LB_fx[ind] / ( (float) pow( 2, st->hHQ_core->Q_old_wtda ) );
        //}
        //FOR( Word16 ind = 0; ind < 960; ind++ )
        //{
        //    st->hHQ_core->old_out[ind] = (float) st->hHQ_core->old_out_fx[ind] / ( (float) pow( 2, st->hHQ_core->Q_old_wtda ) );
        //}
        FOR( Word16 ind = 0; ind < L_FRAME32k / 2; ind++ )
        {
            st->hHQ_core->old_outLB[ind] = (float) st->hHQ_core->old_out_LB_fx[ind] / ( (float) pow( 2, st->hHQ_core->Q_old_wtda ) );
            //st->hTcxDec->syn_Overl_float[ind] = (float) st->hTcxDec->syn_Overl[ind] / ( (float) pow( 2, st->Q_syn + 1 ) );
        }
        FOR( Word16 ind = 0; ind < 960; ind++ )
        FOR( Word16 ind = 0; ind < L_FRAME_MAX / 2; ind++ )
        {
            st->hHQ_core->old_out[ind] = (float) st->hHQ_core->old_out_fx[ind] / ( (float) pow( 2, st->hHQ_core->Q_old_wtda ) );
            //st->hTcxDec->syn_OverlFB_float[ind] = (float) st->hTcxDec->syn_OverlFB[ind] / ( (float) pow( 2, st->Q_syn ) );
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ void sns_compute_scf_fx(
    FOR( i = 0; i < FDNS_NPTS; i++ )
    {
        xs[i] = Mpy_32_16_1( xs[i], pow_tilt[i] );
        xs[i] = L_shl( xs[i], Q6 ); // xs => Q10
        xs[i] = L_shl( xs[i], Q4 ); // xs => Q8
    }

    /* Noise floor at -40dB */
+10 −0
Original line number Diff line number Diff line
@@ -4623,6 +4623,7 @@ void signaling_enc_rf(
    Encoder_State *st /* i/o: encoder state structure             */
);
#ifndef IVAS_FLOAT_FIXED
ivas_error acelp_core_dec(
  Decoder_State *st,                   /* i/o: Decoder state structure             */
  float output[],                      /* o  : synthesis @internal Fs              */
@@ -4646,6 +4647,7 @@ ivas_error acelp_core_dec(
  STEREO_CNG_DEC_HANDLE hStereoCng,    /* i  :  stereo CNG handle                  */
  const int16_t read_sid_info          /* i  : read SID info flag                  */
);
#endif
#ifdef IVAS_FLOAT_FIXED
ivas_error acelp_core_dec_ivas_fx(
@@ -7437,6 +7439,7 @@ void ACcontextMapping_encode2_no_mem_s17_LC(
    int16_t resQMaxBits,
    CONTEXT_HM_CONFIG *hm_cfg );
#ifndef IVAS_FLOAT_FIXED
int16_t ACcontextMapping_decode2_no_mem_s17_LC_ivas(
    Decoder_State *st,        /* i/o: decoder state                               */
    int16_t *x,               /* o  : decoded spectrum                            */
@@ -7445,6 +7448,7 @@ int16_t ACcontextMapping_decode2_no_mem_s17_LC_ivas(
    int16_t resQMaxBits,      /* i  : residual coding maximum bits                */
    CONTEXT_HM_CONFIG *hm_cfg /* i  : context-based harmonic model configuration  */
);
#endif
int16_t ACcontextMapping_encode2_estimate_no_mem_s17_LC(
    const int16_t *x,
@@ -7464,6 +7468,7 @@ void RCcontextMapping_encode2_no_mem_s17_LCS(
    const int16_t resQMaxBits,
    CONTEXT_HM_CONFIG *hm_cfg );
#ifndef IVAS_FLOAT_FIXED
int16_t RCcontextMapping_decode2_no_mem_s17_LCS(
    Decoder_State *st,         /* i/o: decoder state                               */
    int16_t *x,                /* o  : decoded spectrum                            */
@@ -7472,6 +7477,7 @@ int16_t RCcontextMapping_decode2_no_mem_s17_LCS(
    const int16_t resQMaxBits, /* i  : residual coding maximum bits                */
    CONTEXT_HM_CONFIG *hm_cfg  /* i  : context-based harmonic model configuration  */
);
#endif
int16_t RCcontextMapping_encode2_estimate_no_mem_s17_LCS(
    int16_t *x,       /* Spectral coefficients */
@@ -7822,11 +7828,13 @@ int16_t ari_start_decoding_14bits_prm_ivas(
    int16_t bp,
    Tastat *s );
#ifdef IVAS_FLOAT_FIXED
Word16 ari_start_decoding_14bits_prm_ivas_fx(
    const Word16 *ptr,
    Word16  bp,
    Tastat *s
);
#endif
void ari_decode_14bits_s17_ext_ivas(
    Decoder_State *st,
@@ -9880,12 +9888,14 @@ int16_t GetPLCModeDecision(
    Decoder_State *st /* i/o: decoder memory state pointer                        */
);
#ifndef IVAS_FLOAT_FIXED
void addBassPostFilter(
    const float *harm_timeIn,
    const int16_t samplesToProcess,
    float **rAnalysis,
    float **iAnalysis,
    HANDLE_CLDFB_FILTER_BANK cldfb );
#endif
ivas_error TonalMDCTConceal_Init_ivas(
    TonalMDCTConcealPtr hTonalMDCTConc,
+2 −0
Original line number Diff line number Diff line
@@ -8970,6 +8970,7 @@ void decoder_acelp_fx(
#endif

//d_gain2p.c
#ifdef IVAS_FLOAT_FIXED
void decode_acelp_gains_fx(
  Word16 *code,
  Word16 gains_mode,
@@ -8984,6 +8985,7 @@ void decode_acelp_gains_fx(
  Word16 *code2,
  Word32 *gain_code2
);
#endif

void d_gain_pred_fx(
  Word16  nrg_mode,           /* i  : NRG mode                                  */
+4 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@
 *-------------------------------------------------------------------*/

/*! r: resQBits */
#ifndef IVAS_FLOAT_FIXED
int16_t ACcontextMapping_decode2_no_mem_s17_LC_ivas(
    Decoder_State *st,        /* i/o: decoder state                             */
    int16_t *x,               /* o  : decoded spectrum                          */
@@ -318,7 +319,7 @@ int16_t ACcontextMapping_decode2_no_mem_s17_LC_ivas(

    return resQBits;
}

#endif

/*-------------------------------------------------------------------*
 * RCcontextMapping_decode2_no_mem_s17_LCS()
@@ -327,6 +328,7 @@ int16_t ACcontextMapping_decode2_no_mem_s17_LC_ivas(
 *-------------------------------------------------------------------*/

/*! r: resQBits */
#ifndef IVAS_FLOAT_FIXED
int16_t RCcontextMapping_decode2_no_mem_s17_LCS(
    Decoder_State *st,         /* i/o: decoder state                             */
    int16_t *x,                /* o  : decoded spectrum                          */
@@ -670,3 +672,4 @@ int16_t RCcontextMapping_decode2_no_mem_s17_LCS(

    return resQBits;
}
#endif
 No newline at end of file
Loading