Skip to content
Commits on Source (90)
......@@ -81,6 +81,8 @@ variables:
RUNNER_TAG: "ivas-basop-linux"
LOGS_BACKUP_SOURCE_DIR: ""
LOGS_BACKUP_TARGET_DIR: ""
# set this to true to skip the external HRTF testcases in pytest calls
DISABLE_HRTF: "false"
MANUAL_PIPELINE_TYPE:
description: "Type for the manual pipeline run. Use 'pytest-compare' to run comparison test against reference float codec."
value: 'default'
......
......@@ -82,6 +82,7 @@
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
......@@ -129,6 +130,7 @@
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
......
......@@ -82,6 +82,7 @@
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
......@@ -137,6 +138,7 @@
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
......
......@@ -72,6 +72,7 @@
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
......@@ -109,6 +110,7 @@
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
......
......@@ -68,6 +68,7 @@
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)$(TargetName).lib</OutputFile>
......@@ -94,6 +95,7 @@
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)$(TargetName).lib</OutputFile>
......
......@@ -82,6 +82,7 @@
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
......@@ -124,6 +125,7 @@
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
......
......@@ -82,6 +82,7 @@
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
......@@ -128,6 +129,7 @@
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
......
......@@ -110,6 +110,7 @@
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
......
......@@ -82,6 +82,7 @@
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
......@@ -124,6 +125,7 @@
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
......
......@@ -67,6 +67,7 @@
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)$(TargetName).lib</OutputFile>
......@@ -90,6 +91,7 @@
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)$(TargetName).lib</OutputFile>
......
......@@ -79,6 +79,7 @@
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
......@@ -126,6 +127,7 @@
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
......
......@@ -1861,7 +1861,22 @@ static ivas_error initOnFirstGoodFrame(
if ( numInitialBadFrames > 0 )
{
/* Duplicate good first frame metadata to fill the beginning of stream. */
#ifdef NONBE_FIX_1261_MASA_EXT_META_JBM
int16_t fullDelayNumSamplesLocal[3];
int32_t delayTimeScaleLocal;
float delayMs;
IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
hMasaExtOutMeta = NULL;
/* fullDelayNumSamples is zeroed so need to re-fetch delay info */
if ( ( error = IVAS_DEC_GetDelay( hIvasDec, fullDelayNumSamplesLocal, &delayTimeScaleLocal ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
}
delayMs = (float) ( fullDelayNumSamplesLocal[0] ) / (float) ( delayTimeScaleLocal );
#else
IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL;
#endif
if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
{
......@@ -1871,7 +1886,9 @@ static ivas_error initOnFirstGoodFrame(
for ( int16_t j = 0; j < numInitialBadFrames; ++j )
{
#ifndef NONBE_FIX_1261_MASA_EXT_META_JBM
float delayMs = (float) ( pFullDelayNumSamples[0] ) / (float) ( *delayTimeScale );
#endif
if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) );
......
......@@ -2072,12 +2072,18 @@ Word16 idiv1616_1( Word16 x, Word16 y )
}
}
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Word32 norm_llQ31( /* o : normalized result Q31 */
Word32 L_c, /* i : upper bits of accu Q-1 */
Word32 L_sum, /* i : lower bits of accu, unsigned Q31 */
Word16 *exp /* o : exponent of result in [-32,31] Q0 */
)
{
#ifdef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
move32(); /* compensate missing instrumentation */
move32(); /* compensate missing instrumentation */
return w_norm_llQ31( ( (Word64) L_c << 32 ) | (UWord32) L_sum, exp );
#else
Word16 i;
Word32 L_tmp;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
......@@ -2088,8 +2094,8 @@ Word32 norm_llQ31( /* o : normalized result Q31 */
#endif /* BASOP_NOGLOB */
/* Move MSBit of L_sum into L_c */
Carry = 0;
#ifdef ISSUE_1836_replace_overflow_libcom
Carry = 0;
L_tmp = L_add_c( L_sum, L_sum, &Carry ); /* L_tmp = L_sum << 1 */
L_c = L_add_c( L_c, L_c, &Carry );
#else
......@@ -2121,7 +2127,9 @@ Word32 norm_llQ31( /* o : normalized result Q31 */
*exp = i;
move16();
return L_sum;
#endif /* #ifdef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW */
}
#endif /* #ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW */
Word32 Dot_product16HQ( /* o : normalized result Q31 */
......
......@@ -647,7 +647,10 @@ Word32 norm_llQ31( /* o : normalized result Q31 */
* \brief Compute normalized Q31 Values out of overflowed Q31 value
* using 64-bit operators
*------------------------------------------------------------------*/
static inline Word32 w_norm_llQ31( Word64 L64_var1, Word16 *S_var2 ) /*Q31 - L_tmp_exp*/
static inline Word32 w_norm_llQ31( /* o : normalized result Q31 - *S_var2 */
Word64 L64_var1, /* i : 64-bit accu Q63 */
Word16 *S_var2 /* o : exponent of result in [-32,31] Q0 */
)
{
Word32 L_result;
Word16 sh = W_norm( L64_var1 );
......
......@@ -1115,28 +1115,42 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in
)
{
Word16 /*Q0*/ sfb;
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Word16 /*Q0*/ line;
Word32 L_c;
#endif
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Flag Overflow = 0;
Flag Carry = 0;
move16();
move16();
#endif
#endif
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
FOR( sfb = startSfb; sfb < stopSfb; sfb++ )
{
sfbEnergy[sfb] = L_deposit_l( 0 );
move32();
}
#endif
IF( NULL == pPowerSpectrum )
{
#ifdef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
FOR( sfb = startSfb; sfb < stopSfb; sfb++ )
{
sfbEnergy[sfb] = L_deposit_l( 0 );
move32();
}
#endif
return;
}
FOR( sfb = startSfb; sfb < stopSfb; sfb++ )
{
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_c = L_deposit_l( 0 );
FOR( line = swb_offset[sfb]; line < swb_offset[sfb + 1]; line++ )
{
......@@ -1150,6 +1164,12 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in
}
sfbEnergy[sfb] = norm_llQ31( L_c, sfbEnergy[sfb], &( sfbEnergy_exp[sfb] ) );
move32();
#else
sfbEnergy[sfb] = sum_array_norm( pPowerSpectrum + swb_offset[sfb],
swb_offset[sfb + 1] - swb_offset[sfb],
&( sfbEnergy_exp[sfb] ) );
move32();
#endif
sfbEnergy_exp[sfb] = add( sfbEnergy_exp[sfb], *pPowerSpectrum_exp );
move16();
}
......
......@@ -73,6 +73,7 @@
/* Note: each compile switch (FIX_1101_...) is independent from the other ones */
#define FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW /* FhG: bit-exact, replace carry and overflow operations by 64-bit operations, MR 2166 */
#define ISSUE_1836_replace_overflow_libcom /* FhG: BE - replace overflow operators by non-overflow-alternatives in lib_com */
#define ISSUE_1867_replace_overflow_libenc /* FhG: BE - replace overflow operators by non-overflow-alternatives all over the lib_enc module */
#define FIX_1942_ASSERTION_LOWSHELF /* FhG: Modified the target_gains_db_fx calculation in compute_t60_coeffs_fx() */
......@@ -89,6 +90,7 @@
#define FIX_1819_EIGENVALUE_ERROR /* FhG: Workaround for zero eigenvalue: replace with epsilon if det != 0*/
#define FIX_1990_SANITIZER_IN_REVERB_LOAD /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure. */
#define FIX_1995_REVERB_INIT /* VA/Nokia: issue 1995: Fix use-of-uninitialized-value in ivas_binaural_reverb_init() */
#define FIX_1996_MASKING_NOISE /* Dlb: Heavy precision loss in ola buffers causing discontinuity*/
/* #################### Start BASOP porting switches ############################ */
......@@ -99,11 +101,13 @@
#define FIX_1319_STACK_SBA_DECODER /* VA: issue 1319: Optimize the definition of buffer lengths in the SBA decoder */
#define FIX_1320_STACK_CPE_DECODER /* VA: issue 1320: Optimize the stack memory consumption in the CPE decoder */
#define FIX_1984_SAT_IN_PSYCHAD /* VA: Issue 1984: proposal to fix an assert */
#define NONBE_FIX_1261_MASA_EXT_META_JBM /* Nokia: issue #1261: MASA metadata EXT output delay buffer init in JBM */
#define NONBE_FIX_1143_MASA_BRSW /* Nok: Fix for issue 1143: MSAN use of uninitialized value in masa decoding to binaural with dtx bitrate switching and 5 % FER */
#define NONBE_FIX_1220_OMASA_JBM_EXT_USAN /* Nokia: fix issue 1220 OMASA EXT JBM USAN, also fix similar cases of free to avoid future problems */
#define FIX_CREND_SIMPLIFY_CODE
#ifdef FIX_CREND_SIMPLIFY_CODE
#define FIX_989_TD_REND_ROM /* Eri: Clean-up for TD renderer and completion of ROM generation tool */
#endif
/* #################### End BASOP porting switches ############################ */
#endif
......@@ -6123,12 +6123,14 @@ void non_linearity_ivas_fx(
scale = 1438814044;
move32(); /* Q31; 0.67 in Q31 */
}
#ifdef NONBE_1328_FIX_NON_LINEARITY
/* sc_factor = 32; */ /* Here we divise prev_scale, so 32 == 2 << (15-10) 1024.0 corresponds to 10 bits and 32 to 5 bits */
/* sc_factor = 32; */ /* Here we divide prev_scale, so 32 == 2 << (15-10) 1024.0 corresponds to 10 bits and 32 to 5 bits */
/* if ( element_mode > EVS_MONO ) */ /* element mode is not needed because the function is duplicated for IVAS */
sc_factor = shl_sat( 1, sub( 15, max( 13 - norm_s( add( j, 1 ) ), 0 ) ) ); /* Adapt the scaling factor allowed depending of max position */
sc_factor = s_min( sc_factor, 16384 );
sc_factor = shl_sat( 1, sub( 16, max( 13 - norm_s( add( j, 1 ) ), 0 ) ) ); /* Adapt the scaling factor allowed depending of max position */
sc_factor = s_max( s_min( sc_factor, 16384 ), 2 * 32 ); /* note: The thresholding is purposely different between float and BASOP implementations. */
test();
IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, sc_factor ) /*Q30 -> Q31*/, scale /*Q31*/ ) )
#else
test();
......@@ -6218,13 +6220,13 @@ void non_linearity_ivas_fx(
move32(); /* Q31; 0.67 in Q31 */
}
test();
#ifdef NONBE_1328_FIX_NON_LINEARITY
/* sc_factor = 32; */ /* Here we divise prev_scale, so 32 == 2 << (15-10) 1024.0 corresponds to 10 bits and 32 to 5 bits */
/* sc_factor = 32; */ /* Here we divide prev_scale, so 32 == 2 << (15-10) 1024.0 corresponds to 10 bits and 32 to 5 bits */
/* if ( element_mode > EVS_MONO ) */ /* element mode is not needed because the function is duplicated for IVAS */
sc_factor = shl_sat( 1, sub( 15, max( 12 - norm_s( add( j, 1 ) ), 0 ) ) ); /* Adapt the scaling factor allowed depending of max position */
sc_factor = s_min( sc_factor, 16384 );
sc_factor = shl_sat( 1, sub( 16, max( 12 - norm_s( add( j, 1 ) ), 0 ) ) ); /* Adapt the scaling factor allowed depending of max position */
sc_factor = s_max( s_min( sc_factor, 16384 ), 2 * 32 ); /* note: The thresholding is purposely different between float and BASOP implementations. */
test();
IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, sc_factor ) /*Q30 -> Q31*/, scale /*Q31*/ ) )
#else
IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, 64 ), scale ) )
......
......@@ -1637,12 +1637,16 @@ ivas_error acelp_core_dec_fx(
IF( NE_16( st->element_mode, last_element_mode ) )
{
set16_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2, 0, st->hFdCngDec->hFdCngCom->fftlen );
#ifdef FIX_1996_MASKING_NOISE
set32_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, 0, st->hFdCngDec->hFdCngCom->fftlen );
#endif
}
Word32 psyn_32_fx[L_FRAME16k];
Copy_Scale_sig_16_32_no_sat( psyn_fx, psyn_32_fx, st->hFdCngDec->hFdCngCom->frameSize, sub( Q6, st->Q_syn ) ); // Q6
#ifndef FIX_1996_MASKING_NOISE
Copy_Scale_sig_16_32_no_sat( st->hFdCngDec->hFdCngCom->olapBufferSynth2, st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, shl( st->hFdCngDec->hFdCngCom->frameSize, 1 ), Q15 ); // Q15
#endif
generate_masking_noise_ivas_fx( psyn_32_fx, &exp, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, hStereoCng, nchan_out );
Copy_Scale_sig_32_16( psyn_32_fx, psyn_fx, st->hFdCngDec->hFdCngCom->frameSize, sub( st->Q_syn, exp ) ); // Q = st->Q_syn
......@@ -1734,6 +1738,9 @@ ivas_error acelp_core_dec_fx(
IF( st->idchan == 0 )
{
set16_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2, 0, st->hFdCngDec->hFdCngCom->fftlen );
#ifdef FIX_1996_MASKING_NOISE
set32_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, 0, st->hFdCngDec->hFdCngCom->fftlen );
#endif
}
IF( hStereoCng != NULL && ( st->idchan == 0 ) )
{
......
......@@ -27,11 +27,16 @@ static Word16 tcx_arith_decode_fx(
Tastat as;
Word16 exp_k;
Word16 tmp;
Word32 L_tmp, Q;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Word32 L_tmp, Q;
Flag Overflow = 0;
move32();
Flag Carry = 0;
#else
Word32 Q;
Word64 W_tmp;
#endif
move32();
#endif
......@@ -39,7 +44,11 @@ static Word16 tcx_arith_decode_fx(
bp = ari_start_decoding_14bits_prm_fx( prm, 0, &as );
tmp = sub( envelope_e, 1 + 15 );
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_tmp = L_deposit_l( 0 );
#else
W_tmp = 0;
#endif
FOR( k = 0; k < L_frame; k++ )
{
IF( envelope[k] == 0 ) /* safety check in case of bit errors */
......@@ -63,7 +72,11 @@ static Word16 tcx_arith_decode_fx(
{
bp = ari_decode_14bits_sign_fx( prm, bp, target_bits, &s, &as );
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_tmp = L_macNs_co( L_tmp, q, k, &Carry, &Overflow );
#else
W_tmp = W_mac_16_16( W_tmp, q, k );
#endif
Q = L_mult( q, negate( shl( 1, sub( 30, SPEC_EXP_DEC ) ) ) );
IF( EQ_16( s, 0 ) )
......@@ -88,7 +101,11 @@ static Word16 tcx_arith_decode_fx(
set32_fx( q_spectrum + k, 0, sub( L_frame, k ) );
/* noise filling seed */
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
*nf_seed = extract_l( L_tmp );
#else
*nf_seed = extract_l( W_extract_l( W_tmp ) );
#endif
move16();
return bp;
......
......@@ -15,23 +15,36 @@
******************************************************/
static void calcGainc_fx( Word16 *exc, Word16 Q_exc, Word32 old_fpitch /*Q16*/, Word16 L_subfr /*Q0*/, Word32 lp_gainp /*Q16*/, Word32 *lp_gainc /*Q16*/ )
{
Word32 L_c;
Word16 tmp16, tmp16_2, tmp16_3, tmp_e, tmp2_e, tmp_loop, i;
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Word32 L_c;
Word32 L_acc, L_tmp;
#else
Word64 W_acc;
Word32 L_tmp;
#endif
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Flag Overflow = 0;
Flag Carry = 0;
#endif
move32();
move32();
#endif
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_acc = L_deposit_l( 0 );
L_c = L_deposit_l( 0 );
#else
W_acc = 0;
#endif
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Overflow = 0;
move16();
Carry = 0;
move16();
#endif
tmp16 = round_fx( old_fpitch ); /*Q0*/
tmp_loop = shl( L_subfr, 1 );
......@@ -44,14 +57,22 @@ static void calcGainc_fx( Word16 *exc, Word16 Q_exc, Word32 old_fpitch /*Q16*/,
/*st->lp_gainc += ( exc[i-2*L_subfr] - st->Mode2_lp_gainp * exc[i-2*L_subfr-(int)(st->old_fpitch+0.5f)] ) *
( exc[i-2*L_subfr] - st->Mode2_lp_gainp * exc[i-2*L_subfr-(int)(st->old_fpitch+0.5f)] );*/
tmp16_3 = sub_sat( exc[( i - ( L_subfr * 2 ) )] /*Q1*/, mult_r( tmp16_2 /*Q15*/, exc[( ( i - ( L_subfr * 2 ) ) - tmp16 )] /*Q1*/ ) /*Q1*/ );
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_acc = L_macNs_co( L_acc, tmp16_3, tmp16_3, &Carry, &Overflow ); /*Q3*/
Overflow = 0;
move16();
L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); /*Accumulate Carrys Q-1*/
Carry = 0;
move16();
#else
W_acc = W_mac_16_16( W_acc, tmp16_3, tmp16_3 ); /*Q3*/
#endif
}
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_tmp = norm_llQ31( L_c, L_acc, &tmp_e ); /*Q3,norm,tmp_e*/
#else
L_tmp = w_norm_llQ31( W_acc, &tmp_e ); /*Q3,norm,tmp_e*/
#endif
tmp_e = add( tmp_e, 31 - ( add( shl( Q_exc, 1 ), 1 ) ) ); /*L_tmp is Q31, now*/
tmp16 = BASOP_Util_Divide3216_Scale( L_tmp /*Q31,norm,tmp_e*/, shl( L_subfr, 1 ) /*Q15,15*/, &tmp2_e ) /*Q15,tmp2_e+tmp_e-15*/;
tmp_e = sub( add( tmp2_e, tmp_e ), 15 );
......@@ -67,15 +88,23 @@ static void calcGainc_fx( Word16 *exc, Word16 Q_exc, Word32 old_fpitch /*Q16*/,
static void calcGainc2_fx( Word16 *exc, Word16 Q_exc, Word16 L_subfr /*Q0*/, Word32 *lp_gainc /*Q16*/ )
{
Word16 i, cnt, tmp16, tmp_e, tmp2_e;
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Word32 L_c, L_acc, L_tmp;
#else
Word64 W_acc;
Word32 L_tmp;
#endif
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Flag Overflow = 0;
Flag Carry = 0;
#endif
#endif
move16();
move16();
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Carry = 0;
move16();
Overflow = 0;
......@@ -83,21 +112,32 @@ static void calcGainc2_fx( Word16 *exc, Word16 Q_exc, Word16 L_subfr /*Q0*/, Wor
L_c = L_deposit_l( 0 );
L_acc = L_deposit_l( 0 );
#else
W_acc = 0;
#endif
cnt = shl( L_subfr, 1 );
FOR( i = 0; i < cnt; i++ )
{
/* *gainc += ( exc[i-2*L_subfr] ) * ( exc[i-2*L_subfr]); */
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_acc = L_macNs_co( L_acc, exc[( i - ( L_subfr * 2 ) )] /*Q1*/, exc[( i - ( L_subfr * 2 ) )] /*Q1*/, &Carry, &Overflow ); /*Q3*/
Overflow = 0;
move16();
L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); /* Accumulate Carrys Q-1*/
Carry = 0;
move16();
#else
W_acc = W_mac_16_16( W_acc, exc[( i - ( L_subfr * 2 ) )] /*Q1*/, exc[( i - ( L_subfr * 2 ) )] /*Q1*/ ); /*Q3*/
#endif
}
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_tmp = norm_llQ31( L_c, L_acc, &tmp_e ); /*Q3,norm,tmp_e*/
#else
L_tmp = w_norm_llQ31( W_acc, &tmp_e ); /*Q3,norm,tmp_e*/
#endif
tmp_e = add( tmp_e, sub( 31, ( add( shl( Q_exc, 1 ), 1 ) ) ) ); /*L_tmp is Q31, now*/
tmp16 = BASOP_Util_Divide3216_Scale( L_tmp /*Q31,norm,tmp_e*/, shl( L_subfr, 1 ) /*Q15,15*/, &tmp2_e ) /*Q15,tmp2_e+tmp_e-15*/;
tmp_e = sub( add( tmp2_e, tmp_e ), 15 );
......