Loading lib_dec/tonalMDCTconcealment_fx.c +75 −79 Original line number Diff line number Diff line Loading @@ -1383,12 +1383,15 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( Word16 rnd; Word16 tmp, g, tilt, exp_last, exp_noise, tiltFactor, crossfadeGain, e_crossfadeGain; Word32 L_tmp, L_tmp2, nrgNoiseInLastFrame, nrgWhiteNoise; Word32 L_tmp, L_tmp1, L_tmp2, nrgNoiseInLastFrame, nrgWhiteNoise; Word16 inv_exp, inv_samples, exp; Word32 last_block_nrg_correct; Word16 last_block_nrg_correct_e; Word32 max_concealment_value; Word16 max_spectral_value; Word64 sum1, sum2; Word16 num16, den16, exp1, exp2; Word16 shift1, shift2; crossfadeGain = crossfadeGain_const; move16(); Loading Loading @@ -1851,28 +1854,36 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( } } ELSE{ IF( !tonalConcealmentActive ){ ld = sub( 14, norm_s( hTonalMDCTConc->lastBlockData.nSamples ) ); fac = shr( -32768, ld ); IF( tonalConcealmentActive == 0 ){ sum1 = 0; sum2 = 0; move64(); move64(); FOR( i = 0; i < crossOverFreq; i++ ) { Word16 x = hTonalMDCTConc->lastBlockData.spectralData[i]; Word32 y; rnd = extract_l( L_mac0( 13849, rnd, 31821 ) ); /* Q0 */ y = L_mult( tilt, rnd ); /* 15Q16 */ Word16 x; /*x = hTonalMDCTConc->lastBlockData.spectralData[i]; nrgNoiseInLastFrame += x * x;*/ sum1 = W_mac0_16_16( sum1, hTonalMDCTConc->lastBlockData.spectralData[i], hTonalMDCTConc->lastBlockData.spectralData[i] ); // Q: 2*(15-hTonalMDCTConc->lastBlockData.spectralData_exp) nrgNoiseInLastFrame = L_add( nrgNoiseInLastFrame, Mpy_32_16_1( L_msu( 0, x, fac ), x ) ); // Q(31 - x_exp - ld) + Q(15 - x_exp) - 15 = Q(31 - x_exp * 2 - ld) x = round_fx( y ); /* 15Q16 -> 15Q0 */ nrgWhiteNoise = L_add( nrgWhiteNoise, Mpy_32_16_1( L_msu( 0, x, fac ), x ) ); // Q(31 - (15 - 0) - ld) + Q(0) - 15 = Q(1 - ld) /* rnd = own_random(&rnd); */ rnd = extract_l( L_mac0( 13849, rnd, 31821 ) ); /* Q0 */ mdctSpectrum[i] = y; /* 15Q16 */ /* mdctSpectrum[i] = tilt * rnd; */ mdctSpectrum[i] = L_mult( tilt, rnd ); // Q16 move32(); /* tilt *= tiltFactor; */ tilt = mult_r( tilt, tiltFactor ); /* Q15 */ /* nrgWhiteNoise += mdctSpectrum[i] * mdctSpectrum[i]; */ x = round_fx( mdctSpectrum[i] ); // Q0 sum2 = W_mac0_16_16( sum2, x, x ); // Q0 } *mdctSpectrum_exp = 15; move16(); IF( nrgNoiseInLastFrame == 0 ) IF( sum1 /* nrgNoiseInLastFrame */ == 0 ) { set32_fx( mdctSpectrum, 0, crossOverFreq ); *mdctSpectrum_exp = SPEC_EXP_DEC; Loading @@ -1880,85 +1891,70 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( } ELSE { exp_last = add( ld, shl( hTonalMDCTConc->lastBlockData.spectralData_exp, 1 ) ); exp_noise = add( ld, 30 ); IF( nrgWhiteNoise > 0 ) IF( g == 0 ) { ld = norm_l( nrgNoiseInLastFrame ); nrgNoiseInLastFrame = L_shl( nrgNoiseInLastFrame, ld ); // Q31- exp_last + ld exp_last = sub( exp_last, ld ); ld = norm_l( nrgWhiteNoise ); nrgWhiteNoise = L_shl( nrgWhiteNoise, ld ); // Q31 - exp_noise + ld exp_noise = sub( exp_noise, ld ); exp = sub( exp_last, exp_noise ); IF( GT_32( nrgNoiseInLastFrame, nrgWhiteNoise ) ) *mdctSpectrum_exp = add( add( hTonalMDCTConc->lastBlockData.spectralData_exp, e_crossfadeGain ), 31 - SPEC_EXP_DEC ); move16(); FOR( i = 0; i < crossOverFreq; i++ ) { nrgNoiseInLastFrame = L_shr( nrgNoiseInLastFrame, 1 ); // Q31-exp -1 exp = add( exp, 1 ); } tmp = div_l( nrgNoiseInLastFrame, round_fx( nrgWhiteNoise ) ); // Q15 tmp = Sqrt16( tmp, &exp ); g = mult_r( g, tmp ); // exponent of g = exp L_tmp = L_deposit_h( 0 ); ld = sub( hTonalMDCTConc->lastBlockData.spectralData_exp, 15 ); exp = sub( ld, exp ); IF( exp > 0 ) /* mdctSpectrum[i] = g * mdctSpectrum[i] + crossfadeGain * hTonalMDCTConc->lastBlockData.spectralData[i]; */ L_tmp = L_mult( crossfadeGain, hTonalMDCTConc->lastBlockData.spectralData[i] ); // exp: hTonalMDCTConc->lastBlockData.spectralData_exp+e_crossfadeGain if ( mdctSpectrum[i] <= 0 ) { g = shr( g, exp ); // Q15 - exp *mdctSpectrum_exp = hTonalMDCTConc->lastBlockData.spectralData_exp; move16(); /* mdctSpectrum[i] = g * mdctSpectrum[i] - crossfadeGain * hTonalMDCTConc->lastBlockData.spectralData[i]; */ L_tmp = L_negate( L_tmp ); // exp: hTonalMDCTConc->lastBlockData.spectralData_exp+e_crossfadeGain } ELSE { crossfadeGain = shl( crossfadeGain, exp ); // Q15-e_crossfadeGain+ exp e_crossfadeGain = sub( e_crossfadeGain, exp ); *mdctSpectrum_exp = add( e_crossfadeGain, hTonalMDCTConc->lastBlockData.spectralData_exp ); move16(); /* headroom for mdct_shaping */ mdctSpectrum[i] = L_shr( L_tmp, 31 - SPEC_EXP_DEC ); // *mdctSpectrum_exp move32(); } /*make a headroom for mdct_shaping*/ exp = sub( *mdctSpectrum_exp, SPEC_EXP_DEC ); /* assert(exp < 0);*/ IF( exp < 0 ) { *mdctSpectrum_exp = SPEC_EXP_DEC; move16(); } ELSE { exp = 0; move16(); } } FOR( i = 0; i < crossOverFreq; i++ ) IF( sum2 /* nrgWhiteNoise */ > 0 ) { Word16 const x = hTonalMDCTConc->lastBlockData.spectralData[i]; // Q15 - spectralData_exp move16(); Word32 const y = mdctSpectrum[i]; // Q31-mdctSpectrum_exp move32(); exp1 = sub( W_norm( sum1 ), 1 ); num16 = extract_h( W_extract_h( W_shl( sum1, exp1 ) ) ); // nrgNoiseInLastFrame -> Q: 2*(15-hTonalMDCTConc->lastBlockData.spectralData_exp)+exp1-48 exp2 = W_norm( sum2 ); den16 = extract_h( W_extract_h( W_shl( sum2, exp2 ) ) ); // nrgWhiteNoise -> Q: exp2-48 IF( g > 0 ) { L_tmp = Mpy_32_16_1( y, g ); // Q31-mdctSpectrum_exp- spectralData_exp /* sqrt( nrgNoiseInLastFrame / nrgWhiteNoise ) */ tmp = div_s( num16, den16 ); // Q: 15+(2*(15-hTonalMDCTConc->lastBlockData.spectralData_exp)+exp1-48)-(exp2-48) exp = sub( sub( shl( hTonalMDCTConc->lastBlockData.spectralData_exp, 1 ), 30 ), sub( exp1, exp2 ) ); // exp of tmp tmp = Sqrt16( tmp, &exp ); g = mult_r( g, tmp ); // exponent of g = exp } L_tmp2 = L_msu( L_tmp, crossfadeGain, x ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp IF( GT_32( y, 0 ) ) exp1 = add( *mdctSpectrum_exp, exp ); exp2 = add( hTonalMDCTConc->lastBlockData.spectralData_exp, e_crossfadeGain ); exp = add( s_max( exp1, exp2 ), 1 ); shift1 = sub( exp1, exp ); shift2 = sub( exp2, exp ); FOR( i = 0; i < crossOverFreq; i++ ) { L_tmp2 = L_mac( L_tmp, crossfadeGain, x ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp L_tmp1 = L_shl( Mpy_32_16_1( mdctSpectrum[i], g ), shift1 ); // g * mdctSpectrum[i] L_tmp2 = L_shl( L_mult( crossfadeGain, hTonalMDCTConc->lastBlockData.spectralData[i] ), shift2 ); // exp /* mdctSpectrum[i] = g * mdctSpectrum[i] - crossfadeGain * hTonalMDCTConc->lastBlockData.spectralData[i]; */ L_tmp = L_sub( L_tmp1, L_tmp2 ); // exp if ( mdctSpectrum[i] > 0 ) { /* mdctSpectrum[i] = g * mdctSpectrum[i] + crossfadeGain * hTonalMDCTConc->lastBlockData.spectralData[i]; */ L_tmp = L_add( L_tmp1, L_tmp2 ); // exp } mdctSpectrum[i] = L_shl( L_tmp2, exp ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp + exp mdctSpectrum[i] = L_shr( L_tmp, 31 - SPEC_EXP_DEC ); // exp+31-SPEC_EXP_DEC move32(); } /* headroom for mdct_shaping */ *mdctSpectrum_exp = add( exp, 31 - SPEC_EXP_DEC ); move16(); } exp = sub( hTonalMDCTConc->lastBlockData.spectralData_exp, sub( *mdctSpectrum_exp, 16 ) ); } exp = sub( hTonalMDCTConc->lastBlockData.spectralData_exp, *mdctSpectrum_exp ); FOR( i = crossOverFreq; i < hTonalMDCTConc->lastBlockData.nSamples; i++ ) { mdctSpectrum[i] = L_shl( L_deposit_l( hTonalMDCTConc->lastBlockData.spectralData[i] ), exp ); // Q15 - spectralData_exp + exp mdctSpectrum[i] = L_shl( L_deposit_h( hTonalMDCTConc->lastBlockData.spectralData[i] ), exp ); // mdctSpectrum_exp move32(); } } Loading lib_enc/ivas_core_pre_proc_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -827,8 +827,8 @@ ivas_error ivas_compute_core_buffers_fx( /* no resampling needed, only delay adjustment to account for the FIR resampling delay */ delay = NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ); move16(); Copy( st->mem_decim16k_fx + delay, new_inp_16k_fx - sub( lMemRecalc, add( delay, L_FILT16k ) ), delay ); /* Q(-1) */ Copy( signal_in_fx - lMemRecalc, new_inp_16k_fx - add( lMemRecalc, L_FILT16k ), add( input_frame, lMemRecalc ) ); /* st->q_inp */ Copy( st->mem_decim16k_fx + delay, new_inp_16k_fx - add( lMemRecalc, sub( delay, L_FILT16k ) ), delay ); /* Q(-1) */ Copy( signal_in_fx - lMemRecalc, new_inp_16k_fx - sub( lMemRecalc, L_FILT16k ), add( input_frame, lMemRecalc ) ); /* st->q_inp */ Copy( signal_in_fx + sub( sub( input_frame, lMemRecalc ), shl( delay, 1 ) ), st->mem_decim16k_fx, shl( delay, 1 ) ); /* st->q_inp */ } ELSE IF( EQ_32( input_Fs, 32000 ) || EQ_32( input_Fs, 48000 ) ) Loading lib_enc/ivas_mc_param_enc_fx.c +15 −2 Original line number Diff line number Diff line Loading @@ -1422,8 +1422,21 @@ static void ivas_param_mc_quantize_ilds_fx( dmx_ener_fx = BASOP_Util_Add_Mant32Exp( dmx_ener_fx, dmx_ener_e, Cx_fx[k][k], Cx_e[k][k], &dmx_ener_e ); } /*ener_fac = 10.0f * log10f( ( tot_ener + EPSILON ) / ( dmx_ener + EPSILON ) )*/ tot_ener_fx = BASOP_Util_Add_Mant32Exp( tot_ener_fx, tot_ener_e, EPSILON_FX, 0, &tot_ener_e ); dmx_ener_fx = BASOP_Util_Add_Mant32Exp( dmx_ener_fx, dmx_ener_e, EPSILON_FX, 0, &dmx_ener_e ); IF( tot_ener_fx == 0 ) { tot_ener_fx = 9223; // 1e-15(EPSILON) in Q63 tot_ener_e = -32; move32(); move16(); } IF( dmx_ener_fx == 0 ) { dmx_ener_fx = 9223; // 1e-15(EPSILON) in Q63 dmx_ener_e = -32; move32(); move16(); } L_tmp = L_deposit_h( BASOP_Util_Divide3232_Scale( tot_ener_fx, dmx_ener_fx, &tmp_e ) ); tmp_e = add( sub( tot_ener_e, dmx_ener_e ), tmp_e ); ener_fac_fx = BASOP_Util_Log10( L_tmp, tmp_e ); // Q25 Loading lib_enc/ivas_sce_enc_fx.c +0 −4 Original line number Diff line number Diff line Loading @@ -612,10 +612,6 @@ ivas_error create_evs_sce_enc_fx( /*-----------------------------------------------------------------* * Bitstream *-----------------------------------------------------------------*/ IF( ( st_fx->hBstr = (BSTR_ENC_HANDLE) malloc( sizeof( BSTR_ENC_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Bitstream structure\n" ) ); } /* set pointer to the buffer of indices */ st_fx->hBstr->ind_list = st_ivas->ind_list; Loading Loading
lib_dec/tonalMDCTconcealment_fx.c +75 −79 Original line number Diff line number Diff line Loading @@ -1383,12 +1383,15 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( Word16 rnd; Word16 tmp, g, tilt, exp_last, exp_noise, tiltFactor, crossfadeGain, e_crossfadeGain; Word32 L_tmp, L_tmp2, nrgNoiseInLastFrame, nrgWhiteNoise; Word32 L_tmp, L_tmp1, L_tmp2, nrgNoiseInLastFrame, nrgWhiteNoise; Word16 inv_exp, inv_samples, exp; Word32 last_block_nrg_correct; Word16 last_block_nrg_correct_e; Word32 max_concealment_value; Word16 max_spectral_value; Word64 sum1, sum2; Word16 num16, den16, exp1, exp2; Word16 shift1, shift2; crossfadeGain = crossfadeGain_const; move16(); Loading Loading @@ -1851,28 +1854,36 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( } } ELSE{ IF( !tonalConcealmentActive ){ ld = sub( 14, norm_s( hTonalMDCTConc->lastBlockData.nSamples ) ); fac = shr( -32768, ld ); IF( tonalConcealmentActive == 0 ){ sum1 = 0; sum2 = 0; move64(); move64(); FOR( i = 0; i < crossOverFreq; i++ ) { Word16 x = hTonalMDCTConc->lastBlockData.spectralData[i]; Word32 y; rnd = extract_l( L_mac0( 13849, rnd, 31821 ) ); /* Q0 */ y = L_mult( tilt, rnd ); /* 15Q16 */ Word16 x; /*x = hTonalMDCTConc->lastBlockData.spectralData[i]; nrgNoiseInLastFrame += x * x;*/ sum1 = W_mac0_16_16( sum1, hTonalMDCTConc->lastBlockData.spectralData[i], hTonalMDCTConc->lastBlockData.spectralData[i] ); // Q: 2*(15-hTonalMDCTConc->lastBlockData.spectralData_exp) nrgNoiseInLastFrame = L_add( nrgNoiseInLastFrame, Mpy_32_16_1( L_msu( 0, x, fac ), x ) ); // Q(31 - x_exp - ld) + Q(15 - x_exp) - 15 = Q(31 - x_exp * 2 - ld) x = round_fx( y ); /* 15Q16 -> 15Q0 */ nrgWhiteNoise = L_add( nrgWhiteNoise, Mpy_32_16_1( L_msu( 0, x, fac ), x ) ); // Q(31 - (15 - 0) - ld) + Q(0) - 15 = Q(1 - ld) /* rnd = own_random(&rnd); */ rnd = extract_l( L_mac0( 13849, rnd, 31821 ) ); /* Q0 */ mdctSpectrum[i] = y; /* 15Q16 */ /* mdctSpectrum[i] = tilt * rnd; */ mdctSpectrum[i] = L_mult( tilt, rnd ); // Q16 move32(); /* tilt *= tiltFactor; */ tilt = mult_r( tilt, tiltFactor ); /* Q15 */ /* nrgWhiteNoise += mdctSpectrum[i] * mdctSpectrum[i]; */ x = round_fx( mdctSpectrum[i] ); // Q0 sum2 = W_mac0_16_16( sum2, x, x ); // Q0 } *mdctSpectrum_exp = 15; move16(); IF( nrgNoiseInLastFrame == 0 ) IF( sum1 /* nrgNoiseInLastFrame */ == 0 ) { set32_fx( mdctSpectrum, 0, crossOverFreq ); *mdctSpectrum_exp = SPEC_EXP_DEC; Loading @@ -1880,85 +1891,70 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( } ELSE { exp_last = add( ld, shl( hTonalMDCTConc->lastBlockData.spectralData_exp, 1 ) ); exp_noise = add( ld, 30 ); IF( nrgWhiteNoise > 0 ) IF( g == 0 ) { ld = norm_l( nrgNoiseInLastFrame ); nrgNoiseInLastFrame = L_shl( nrgNoiseInLastFrame, ld ); // Q31- exp_last + ld exp_last = sub( exp_last, ld ); ld = norm_l( nrgWhiteNoise ); nrgWhiteNoise = L_shl( nrgWhiteNoise, ld ); // Q31 - exp_noise + ld exp_noise = sub( exp_noise, ld ); exp = sub( exp_last, exp_noise ); IF( GT_32( nrgNoiseInLastFrame, nrgWhiteNoise ) ) *mdctSpectrum_exp = add( add( hTonalMDCTConc->lastBlockData.spectralData_exp, e_crossfadeGain ), 31 - SPEC_EXP_DEC ); move16(); FOR( i = 0; i < crossOverFreq; i++ ) { nrgNoiseInLastFrame = L_shr( nrgNoiseInLastFrame, 1 ); // Q31-exp -1 exp = add( exp, 1 ); } tmp = div_l( nrgNoiseInLastFrame, round_fx( nrgWhiteNoise ) ); // Q15 tmp = Sqrt16( tmp, &exp ); g = mult_r( g, tmp ); // exponent of g = exp L_tmp = L_deposit_h( 0 ); ld = sub( hTonalMDCTConc->lastBlockData.spectralData_exp, 15 ); exp = sub( ld, exp ); IF( exp > 0 ) /* mdctSpectrum[i] = g * mdctSpectrum[i] + crossfadeGain * hTonalMDCTConc->lastBlockData.spectralData[i]; */ L_tmp = L_mult( crossfadeGain, hTonalMDCTConc->lastBlockData.spectralData[i] ); // exp: hTonalMDCTConc->lastBlockData.spectralData_exp+e_crossfadeGain if ( mdctSpectrum[i] <= 0 ) { g = shr( g, exp ); // Q15 - exp *mdctSpectrum_exp = hTonalMDCTConc->lastBlockData.spectralData_exp; move16(); /* mdctSpectrum[i] = g * mdctSpectrum[i] - crossfadeGain * hTonalMDCTConc->lastBlockData.spectralData[i]; */ L_tmp = L_negate( L_tmp ); // exp: hTonalMDCTConc->lastBlockData.spectralData_exp+e_crossfadeGain } ELSE { crossfadeGain = shl( crossfadeGain, exp ); // Q15-e_crossfadeGain+ exp e_crossfadeGain = sub( e_crossfadeGain, exp ); *mdctSpectrum_exp = add( e_crossfadeGain, hTonalMDCTConc->lastBlockData.spectralData_exp ); move16(); /* headroom for mdct_shaping */ mdctSpectrum[i] = L_shr( L_tmp, 31 - SPEC_EXP_DEC ); // *mdctSpectrum_exp move32(); } /*make a headroom for mdct_shaping*/ exp = sub( *mdctSpectrum_exp, SPEC_EXP_DEC ); /* assert(exp < 0);*/ IF( exp < 0 ) { *mdctSpectrum_exp = SPEC_EXP_DEC; move16(); } ELSE { exp = 0; move16(); } } FOR( i = 0; i < crossOverFreq; i++ ) IF( sum2 /* nrgWhiteNoise */ > 0 ) { Word16 const x = hTonalMDCTConc->lastBlockData.spectralData[i]; // Q15 - spectralData_exp move16(); Word32 const y = mdctSpectrum[i]; // Q31-mdctSpectrum_exp move32(); exp1 = sub( W_norm( sum1 ), 1 ); num16 = extract_h( W_extract_h( W_shl( sum1, exp1 ) ) ); // nrgNoiseInLastFrame -> Q: 2*(15-hTonalMDCTConc->lastBlockData.spectralData_exp)+exp1-48 exp2 = W_norm( sum2 ); den16 = extract_h( W_extract_h( W_shl( sum2, exp2 ) ) ); // nrgWhiteNoise -> Q: exp2-48 IF( g > 0 ) { L_tmp = Mpy_32_16_1( y, g ); // Q31-mdctSpectrum_exp- spectralData_exp /* sqrt( nrgNoiseInLastFrame / nrgWhiteNoise ) */ tmp = div_s( num16, den16 ); // Q: 15+(2*(15-hTonalMDCTConc->lastBlockData.spectralData_exp)+exp1-48)-(exp2-48) exp = sub( sub( shl( hTonalMDCTConc->lastBlockData.spectralData_exp, 1 ), 30 ), sub( exp1, exp2 ) ); // exp of tmp tmp = Sqrt16( tmp, &exp ); g = mult_r( g, tmp ); // exponent of g = exp } L_tmp2 = L_msu( L_tmp, crossfadeGain, x ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp IF( GT_32( y, 0 ) ) exp1 = add( *mdctSpectrum_exp, exp ); exp2 = add( hTonalMDCTConc->lastBlockData.spectralData_exp, e_crossfadeGain ); exp = add( s_max( exp1, exp2 ), 1 ); shift1 = sub( exp1, exp ); shift2 = sub( exp2, exp ); FOR( i = 0; i < crossOverFreq; i++ ) { L_tmp2 = L_mac( L_tmp, crossfadeGain, x ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp L_tmp1 = L_shl( Mpy_32_16_1( mdctSpectrum[i], g ), shift1 ); // g * mdctSpectrum[i] L_tmp2 = L_shl( L_mult( crossfadeGain, hTonalMDCTConc->lastBlockData.spectralData[i] ), shift2 ); // exp /* mdctSpectrum[i] = g * mdctSpectrum[i] - crossfadeGain * hTonalMDCTConc->lastBlockData.spectralData[i]; */ L_tmp = L_sub( L_tmp1, L_tmp2 ); // exp if ( mdctSpectrum[i] > 0 ) { /* mdctSpectrum[i] = g * mdctSpectrum[i] + crossfadeGain * hTonalMDCTConc->lastBlockData.spectralData[i]; */ L_tmp = L_add( L_tmp1, L_tmp2 ); // exp } mdctSpectrum[i] = L_shl( L_tmp2, exp ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp + exp mdctSpectrum[i] = L_shr( L_tmp, 31 - SPEC_EXP_DEC ); // exp+31-SPEC_EXP_DEC move32(); } /* headroom for mdct_shaping */ *mdctSpectrum_exp = add( exp, 31 - SPEC_EXP_DEC ); move16(); } exp = sub( hTonalMDCTConc->lastBlockData.spectralData_exp, sub( *mdctSpectrum_exp, 16 ) ); } exp = sub( hTonalMDCTConc->lastBlockData.spectralData_exp, *mdctSpectrum_exp ); FOR( i = crossOverFreq; i < hTonalMDCTConc->lastBlockData.nSamples; i++ ) { mdctSpectrum[i] = L_shl( L_deposit_l( hTonalMDCTConc->lastBlockData.spectralData[i] ), exp ); // Q15 - spectralData_exp + exp mdctSpectrum[i] = L_shl( L_deposit_h( hTonalMDCTConc->lastBlockData.spectralData[i] ), exp ); // mdctSpectrum_exp move32(); } } Loading
lib_enc/ivas_core_pre_proc_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -827,8 +827,8 @@ ivas_error ivas_compute_core_buffers_fx( /* no resampling needed, only delay adjustment to account for the FIR resampling delay */ delay = NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ); move16(); Copy( st->mem_decim16k_fx + delay, new_inp_16k_fx - sub( lMemRecalc, add( delay, L_FILT16k ) ), delay ); /* Q(-1) */ Copy( signal_in_fx - lMemRecalc, new_inp_16k_fx - add( lMemRecalc, L_FILT16k ), add( input_frame, lMemRecalc ) ); /* st->q_inp */ Copy( st->mem_decim16k_fx + delay, new_inp_16k_fx - add( lMemRecalc, sub( delay, L_FILT16k ) ), delay ); /* Q(-1) */ Copy( signal_in_fx - lMemRecalc, new_inp_16k_fx - sub( lMemRecalc, L_FILT16k ), add( input_frame, lMemRecalc ) ); /* st->q_inp */ Copy( signal_in_fx + sub( sub( input_frame, lMemRecalc ), shl( delay, 1 ) ), st->mem_decim16k_fx, shl( delay, 1 ) ); /* st->q_inp */ } ELSE IF( EQ_32( input_Fs, 32000 ) || EQ_32( input_Fs, 48000 ) ) Loading
lib_enc/ivas_mc_param_enc_fx.c +15 −2 Original line number Diff line number Diff line Loading @@ -1422,8 +1422,21 @@ static void ivas_param_mc_quantize_ilds_fx( dmx_ener_fx = BASOP_Util_Add_Mant32Exp( dmx_ener_fx, dmx_ener_e, Cx_fx[k][k], Cx_e[k][k], &dmx_ener_e ); } /*ener_fac = 10.0f * log10f( ( tot_ener + EPSILON ) / ( dmx_ener + EPSILON ) )*/ tot_ener_fx = BASOP_Util_Add_Mant32Exp( tot_ener_fx, tot_ener_e, EPSILON_FX, 0, &tot_ener_e ); dmx_ener_fx = BASOP_Util_Add_Mant32Exp( dmx_ener_fx, dmx_ener_e, EPSILON_FX, 0, &dmx_ener_e ); IF( tot_ener_fx == 0 ) { tot_ener_fx = 9223; // 1e-15(EPSILON) in Q63 tot_ener_e = -32; move32(); move16(); } IF( dmx_ener_fx == 0 ) { dmx_ener_fx = 9223; // 1e-15(EPSILON) in Q63 dmx_ener_e = -32; move32(); move16(); } L_tmp = L_deposit_h( BASOP_Util_Divide3232_Scale( tot_ener_fx, dmx_ener_fx, &tmp_e ) ); tmp_e = add( sub( tot_ener_e, dmx_ener_e ), tmp_e ); ener_fac_fx = BASOP_Util_Log10( L_tmp, tmp_e ); // Q25 Loading
lib_enc/ivas_sce_enc_fx.c +0 −4 Original line number Diff line number Diff line Loading @@ -612,10 +612,6 @@ ivas_error create_evs_sce_enc_fx( /*-----------------------------------------------------------------* * Bitstream *-----------------------------------------------------------------*/ IF( ( st_fx->hBstr = (BSTR_ENC_HANDLE) malloc( sizeof( BSTR_ENC_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Bitstream structure\n" ) ); } /* set pointer to the buffer of indices */ st_fx->hBstr->ind_list = st_ivas->ind_list; Loading