Commit ca8fea9e authored by Nishant S Kulgod's avatar Nishant S Kulgod
Browse files

commit 4

parent 09b85f48
Loading
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -937,12 +937,20 @@ int main(
            fprintf( stderr, "Error in IVAS_REND_SetTotalNumberOfObjects(): %s\n", ivas_error_to_string( error ) );
            exit( -1 );
        }

#ifdef IVAS_FLOAT_FIXED
        Word32 var1 = (Word32)(args.syncMdDelay);
        IF((error = IVAS_REND_SetIsmMetadataDelay(hIvasRend, var1)) != IVAS_ERR_OK)
        {
            fprintf(stderr, "Error in IVAS_REND_SetIsmMetadataDelay(): %s\n", ivas_error_to_string(error));
            exit(-1);
        }
#else
        if ( ( error = IVAS_REND_SetIsmMetadataDelay( hIvasRend, args.syncMdDelay ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error in IVAS_REND_SetIsmMetadataDelay(): %s\n", ivas_error_to_string( error ) );
            exit( -1 );
        }
#endif
    }

    IVAS_REND_LfePanMtx lfePanMatrix;
+0 −150
Original line number Diff line number Diff line
@@ -297,153 +297,3 @@ Word16 L_get_q_buf1( float *ptr_flt, Word16 length )
    }
}
#endif

#ifdef IVAS_FLOAT_FIXED
void stereo_tcx_dec_mode_switch_reconf_To_fixed(
    Decoder_State *st,
    Word16 tofix,
    Word16 last_element_mode)
{
    bool reconf = ( st->bits_frame_nominal != st->last_bits_frame_nominal ) ||
                  ( st->bwidth != st->last_bwidth ) ||
                  ( st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE && !( st->prev_bfi == 1 && st->last_core == ACELP_CORE && st->last_con_tcx == 1 ) ) ||
                  ( st->idchan == 1 && st->element_mode == IVAS_CPE_MDCT && last_element_mode != IVAS_CPE_MDCT );
    if ( reconf )
    {
        Word16 Q_cldfbAna_cldfb_state = 0, Q_cldfbBPF_cldfb_state = 0, Q_cldfbSyn_cldfb_state = 0, Q_cldfbSynHB_cldfb_state = 0;//,

        if ( tofix )
        {

            IF( st->hTcxDec )
            {
                st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) );
                st->output_frame_fx = st->hTcxDec->L_frameTCX;
            }
            IF( st->hHQ_core )
            {
                //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;
            }
            IF( st->cldfbAna )
            {
                Q_cldfbAna_cldfb_state = Q_factor_arrL( st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_length ) - 1;
                floatToFixed_arrL( st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_fx, Q_cldfbAna_cldfb_state, st->cldfbAna->cldfb_state_length );
            }
            IF( st->cldfbBPF )
            {
                Q_cldfbBPF_cldfb_state = Q_factor_arrL( st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_length ) - 1;
                floatToFixed_arrL( st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_fx, Q_cldfbBPF_cldfb_state, st->cldfbBPF->cldfb_state_length );
            }
            IF( st->cldfbSyn )
            {
                Q_cldfbSyn_cldfb_state = Q_factor_arrL( st->cldfbSyn->cldfb_state, st->cldfbSyn->cldfb_state_length ) - 1;
                floatToFixed_arrL( st->cldfbSyn->cldfb_state, st->cldfbSyn->cldfb_state_fx, Q_cldfbSyn_cldfb_state, st->cldfbSyn->cldfb_state_length );
            }
            IF( st->cldfbSynHB )
            {
                Q_cldfbSynHB_cldfb_state = Q_factor_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_length ) - 1;
                floatToFixed_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_fx, Q_cldfbSynHB_cldfb_state, st->cldfbSynHB->cldfb_state_length );
            }
            st->last_gain_syn_deemph = 0;
        }
        else
        {
            IF( st->cldfbAna )
            {
                Q_cldfbAna_cldfb_state = Q_factor_arrL( st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_length ) - 1;
                fixedToFloat_arrL( st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_state, Q_cldfbAna_cldfb_state, st->cldfbAna->cldfb_state_length );
            }
            IF( st->cldfbBPF )
            {
                Q_cldfbBPF_cldfb_state = Q_factor_arrL( st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_length ) - 1;
                fixedToFloat_arrL( st->cldfbBPF->cldfb_state_fx, st->cldfbBPF->cldfb_state, Q_cldfbBPF_cldfb_state, st->cldfbBPF->cldfb_state_length );
            }
            IF( st->cldfbSyn )
            {
                Q_cldfbSyn_cldfb_state = Q_factor_arrL( st->cldfbSyn->cldfb_state, st->cldfbSyn->cldfb_state_length ) - 1;
                fixedToFloat_arrL( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->cldfb_state, Q_cldfbSyn_cldfb_state, st->cldfbSyn->cldfb_state_length );
            }
            IF( st->cldfbSynHB )
            {
                Q_cldfbSynHB_cldfb_state = Q_factor_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_length ) - 1;
                fixedToFloat_arrL( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->cldfb_state, Q_cldfbSynHB_cldfb_state, st->cldfbSynHB->cldfb_state_length );
            }
        }
    }
}

void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
    Decoder_State *st,
    Word16 tofix,
    Word16 last_element_mode,
    const FRAME_MODE frameMode)
{
    UNUSED_PARAM(frameMode);
    bool reconf = ( st->bits_frame_nominal != st->last_bits_frame_nominal ) ||
                  ( st->bwidth != st->last_bwidth ) ||
                  ( st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE && !( st->prev_bfi == 1 && st->last_core == ACELP_CORE && st->last_con_tcx == 1 ) ) ||
                  ( st->idchan == 1 && st->element_mode == IVAS_CPE_MDCT && last_element_mode != IVAS_CPE_MDCT );
    if ( reconf )
    {
        Word16 Q_cldfbSynHB_cldfb_state = 0;//,


        if ( tofix )
        {

            IF( st->hTcxDec )
            {
                st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) );
                st->output_frame_fx = st->hTcxDec->L_frameTCX;
            }
            IF( st->hHQ_core )
            {
                st->hHQ_core->Q_old_out = 0;
                st->hHQ_core->Q_old_outLB = 0;
				st->hHQ_core->Q_fer_samples = 0;
            }
            IF( st->cldfbSynHB )
            {
                Q_cldfbSynHB_cldfb_state = Q_factor_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_length ) - 1;
                floatToFixed_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_fx, Q_cldfbSynHB_cldfb_state, st->cldfbSynHB->cldfb_state_length );
            }


            st->last_gain_syn_deemph = 0;
        }
        else
        {
            IF( st->hTcxDec )
            {
                st->hTcxDec->conCngLevelBackgroundTrace_e = 0;
                st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi;
                st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi;
                st->hTcxDec->conLastFrameLevel = st->hTcxDec->LastFrameLevel_bfi_fx;
            }
            IF( st->cldfbSynHB )
            {
                Q_cldfbSynHB_cldfb_state = Q_factor_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_length ) - 1;
                fixedToFloat_arrL( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->cldfb_state, Q_cldfbSynHB_cldfb_state, st->cldfbSynHB->cldfb_state_length );
            }
        }
    }

    if ( tofix )
    {
        st->Q_syn = 0;
        st->prev_Q_syn = st->Q_syn;
        st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi;
        st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi;

        st->mem_error = st->hBPF->pst_mem_deemp_err_fx;

        // u8bit to 16bit
        FOR(int l = 0; l < IGF_START_MX; l++)
        {
          st->hIGFDec->infoTCXNoise_evs[l] = (Word16)st->hIGFDec->infoTCXNoise[l];
        }
    }
}
#endif // IVAS_FLOAT_FIXED
+12 −4
Original line number Diff line number Diff line
@@ -4823,7 +4823,9 @@ Word16 matrix_product_mant_exp(
  Word32 *Z_fx,          /* o  : resulting matrix after the matrix multiplication                                       */
  Word16 *Z_e            /* o  : resulting matrix after the matrix multiplication                                       */
);
#endif

#ifdef IVAS_FLOAT_FIXED
void mat2svdMat_fx(
    const Word32 *mat,                                       /* i  : matrix as column ordered vector */
    Word32 svdMat[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], /* o  : matrix as two-dimensional arry  */
@@ -4838,7 +4840,7 @@ void svdMat2mat_fx(
    const Word16 nRows,                                    /* i  : number of rows of the matrix    */
    const Word16 mCols                                     /* i  : number of columns of the matrix */
);
#endif
#else

void mat2svdMat(
    const float *mat,                                           /* i  : matrix as column ordered vector */
@@ -4854,6 +4856,7 @@ void svdMat2mat(
    const int16_t nRows,                                        /* i  : number of rows of the matrix    */
    const int16_t mCols                                         /* i  : number of columns of the matrix */
);
#endif

int16_t matrix_diag_product(
    const float *X,                                             /* i  : left hand matrix                                                                       */
@@ -4896,6 +4899,7 @@ void cmplx_matrix_square(
    float *imagZ                                                /* o  : imaginary part of the resulting matrix                                      */
);

#ifndef IVAS_FLOAT_FIXED
int16_t computeMixingMatrices(
    const int16_t num_inputs,                                   /* i  : number of input channels                                                                                      */
    const int16_t num_outputs,                                  /* i  : number of output channels                                                                                     */
@@ -4909,7 +4913,7 @@ int16_t computeMixingMatrices(
    float *Cr                                                   /* o  : residual covariance matrix                                                                                    */
);

#ifdef IVAS_FLOAT_FIXED
#else
Word16 computeMixingMatrices_fx(
    const Word16 num_inputs,               /* i  : number of input channels                                                                                      */
    const Word16 num_outputs,              /* i  : number of output channels                                                                                     */
@@ -4931,6 +4935,7 @@ Word16 computeMixingMatrices_fx(
);
#endif

#ifndef IVAS_FLOAT_FIXED
int16_t computeMixingMatricesResidual(
    const int16_t num_outputs,                                  /* i  : number of output channels                                           */
    const float *Cx,                                            /* i  : vector containing the diagonal diffuse prototype covariance         */
@@ -4940,7 +4945,7 @@ int16_t computeMixingMatricesResidual(
    float *mixing_matrix                                        /* o  : resulting residual mixing matrix                                    */
);

#ifdef IVAS_FLOAT_FIXED
#else
Word16 computeMixingMatricesResidual_fx(
    const Word32 num_outputs, /* i  : number of output channels                                           */
    const Word32 *Cx_fx,           /* i  : vector containing the diagonal diffuse prototype covariance         */
@@ -4956,6 +4961,7 @@ Word16 computeMixingMatricesResidual_fx(
);
#endif

#ifdef IVAS_FLOAT_FIXED
/*! r: error or success */
Word16 svd_fx(
    Word32 InputMatrix[][MAX_OUTPUT_CHANNELS],           /* i  : matrix to be decomposed (M)                      */
@@ -4967,7 +4973,7 @@ Word16 svd_fx(
    const Word16 nChannelsL,                           /* i  : number of rows in the matrix to be decomposed    */
    const Word16 nChannelsC                            /* i  : number of columns in the matrix to be decomposed */
);

#else
/*! r: error or success */
int16_t svd(
    float InputMatrix[][MAX_OUTPUT_CHANNELS],                   /* i  : matrix to be decomposed (M)                      */
@@ -4977,6 +4983,8 @@ int16_t svd(
    const int16_t nChannelsL,                                   /* i  : number of rows in the matrix to be decomposed    */
    const int16_t nChannelsC                                    /* i  : number of columns in the matrix to be decomposed */
);
#endif

#ifdef IVAS_FLOAT_FIXED
ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx(
    DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params,   /* i/o: handle for the covariance synthesis parameters                                                        */
+3 −1
Original line number Diff line number Diff line
@@ -135,10 +135,12 @@
#define FIX_736_BWE_SECT_C        // Solves an issue where the BWE was disappearing, problem related to wrong scaling in ic-BWE
#define FIX_734_MISSING_SUBFR_LOW_RATE_ACELP
#define FIX_747_TDBWE_ENERGY_BURST
#define FIX_770_DISCONTINUITIES_SW_TCX2ACELP  // Fix discontinuities when switching from TCX to ACELP
#define FIX_680_CNG_FRAME_BOUNDARIES_ISSUE /* Step was right shift by 2, which made the OVA wrong */
/* ################## End DEVELOPMENT switches ######################### */

/* clang-format on */
#define NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO
//#define NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO

#define UNUSED_PARAM(...) (void)(__VA_ARGS__)

+0 −18
Original line number Diff line number Diff line
@@ -62,18 +62,6 @@

/* conversion functions: */

// needed to be removed
void stereo_tcx_dec_mode_switch_reconf_To_fixed(
    Decoder_State *st,
    Word16 tofix,
    Word16 last_element_mode );

void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
  Decoder_State *st,
  Word16 tofix,
  Word16 last_element_mode,
  const FRAME_MODE frameMode);

// Float to Word32
Word32 float_to_fix( float number, Word32 Q );
// Word32 to Float
@@ -9358,12 +9346,6 @@ void ivas_bw_switching_pre_proc_fx(
    Word16 Q_audio
);

#ifdef IVAS_FLOAT_FIXED
/* float2fix and fix2float utilities (to be removed) */
void acelp_decoder_state_float2fix(Decoder_State *st);
void acelp_decoder_state_fix2float(Decoder_State *st);
#endif

uint32_t mvl2s_r(
    const Word32 x[], /* i  : input vector  */
    const Word16 q,
Loading