diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 6b6e1c39c2c352b6622fe2c65c8f52014e067bf8..06a1d8d1ea95182e5dd9b6c4047d028f24772fbe 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -533,7 +533,7 @@ ivas_error ivas_core_enc( const int16_t flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz */ ); #ifdef IVAS_FLOAT_FIXED -ivas_error ivas_core_dec( +ivas_error ivas_core_dec_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ diff --git a/lib_com/options.h b/lib_com/options.h index 7a446867dfe8d141fe2e99c13c5b75e5f6500eb8..32b4203c062452c58967bb5ff7f3651bb6ee002e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -1,163 +1,166 @@ -/****************************************************************************************************** - - (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository. All Rights Reserved. - - This software is protected by copyright law and by international treaties. - The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository retain full ownership rights in their respective contributions in - the software. This notice grants no license of any kind, including but not limited to patent - license, nor is any license granted by implication, estoppel or otherwise. - - Contributors are required to enter into the IVAS codec Public Collaboration agreement before making - contributions. - - This software is provided "AS IS", without any express or implied warranties. The software is in the - development stage. It is intended exclusively for experts who have experience with such software and - solely for the purpose of inspection. All implied warranties of non-infringement, merchantability - and fitness for a particular purpose are hereby disclaimed and excluded. - - Any dispute, controversy or claim arising under or in relation to providing this software shall be - submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in - accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and - the United Nations Convention on Contracts on the International Sales of Goods. - -*******************************************************************************************************/ - -/*==================================================================================== - EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0 - ====================================================================================*/ - -#ifndef OPTIONS_H -#define OPTIONS_H -//#define DEBUGGING /*allows message printed out during run time */ -#ifdef DEBUGGING -#include "debug.h" -#endif - -#include "stl.h" - -/* clang-format off */ - /* ################### Start compiler switches ######################## */ - -#define SUPPORT_JBM_TRACEFILE /* support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */ - -/* #################### End compiler switches ######################### */ - -/* ################### Start compiler switches ######################## */ -/* */ -#ifdef _MSC_VER -#pragma warning(disable:4310) /* cast truncates constant value this affects mainly constants tables*/ -#endif - -/*#define WMOPS 1 --> activation or deactivation in count.h*/ /* Activate FIXED-POINT complexity counters */ -/*#define DONT_COUNT */ /* To prevent the complexity counting */ - -#ifdef WMOPS_FLT -/*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ -/*#define WMOPS_DETAIL*/ /* Output detailed complexity printout for every function. Increases runtime overhead */ -/*#define WMOPS_WC_FRAME_ANALYSIS*/ /* Output detailed complexity analysis for the worst-case frame */ -/*#define MEM_COUNT_DETAILS*/ /* Output detailed memory analysis for the worst-case frame (writes to the file "mem_analysis.csv") */ -#endif - -/* #################### End DEBUGGING switches ############################ */ - -/* ################### Start FIXES switches ########################### */ - -#define NON_BE_FIX_1048_THRESHOLD_COH_BASOP /* Nokia: Fix 1048 replace comparison with 0 with comparison to threshold, to align with BASOP*/ -#define NONBE_FIX_1054_NEGATIVE_LVQ_INDEX /* Nokia: issue 1054: Input to decode_comb in deindex_lvq_SHB should be positive */ -#define FIX_1033_MEMORY_LEAK_OMASA /* Nokia / Orange: issue #1033: Memory leak in OMASA to BINAURAL with HRTF with bitrate switching */ -#define FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* Ericsson: premature cast to unsigned detected by USAN corrected */ -#define FIX_1027_GSC_INT_OVERFLOW /* VA: issue 2207: overflow in GSC */ -#define NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO /* FhG: avoid sidegain DFT-Stereo param to be larger than 1 when converting from Dirac parameters */ -#define NON_BE_1055_RESET_LP_MEMORIES /* VA: issue 1055: Correctly reset LP filter MA and AR memories in bitrate switching */ - -/* #################### End FIXES switches ############################ */ - -#define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ - - -/* ################### Start BE switches ################################# */ -/* only BE switches wrt selection floating point code */ - -/*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ - -#define FIX_854_ARRAY_SIZE_MISMATCH /* VA: issue 854: correct the mismatch between definition and declaration of `ivas_core_dec() */ -#define FIX_785_REMOVE_DEAD_CODE /* VA: issue 785: remove dead code */ -#define FIX_852_FIX_HANDLE_DEREF /* VA: issue 852: Fix missing handle dereferencing of hIsmMetadaData in ivas_ism_metadata_close() */ -#define FIX_901_PARAMMC_DEAD_CODE /* FhG: issue 901: remove dead ParamMC code */ - -/* #################### End BE switches ################################## */ - - -/* #################### Start NON-BE switches ############################ */ -/* any switch which is non-be wrt selection floating point code */ -/* all switches in this category should start with "NONBE_" */ - -#define NONBE_FIX_838_CRASH_24_4_WB /* FhG: Issue 838: fix encoder crashes for Unified Stereo and MASA 2 TC at 24.4 kbps WB due to missing IGF (re-) allocation */ -#define NONBE_FIX_839_MC_RS_CHANNEL_ALLOC /* FhG: Issues #839: problems with reallocation of the channels on the heap in case of MC RS */ -#define BE_FIX_832_ASAN_ERROR_EFAP_OSBA /* FhG: issue #832: fix ASAN error caused by re-allocating EFAP memories in OSBA*/ -#define NONBE_FIX_819_DOUBLE_PREC_COMB_FORMATS /* VA: issue 820: Double precision arithmetic in combined formats */ -#define NONBE_FIX_849_OMASA_BFI_CRASH /* VA: issue 849: fix OMASA 2TC and FEC crashes */ -#define NONBE_FIX_738_QUATERNION_SLERP_PRECISION /* Quaternion slerp changes*/ -#define IVAS_FLOAT_FIXED -#ifdef IVAS_FLOAT_FIXED -#define MSAN_FIX -#endif -#define ISM_DISABLE -#define FIX_TMP_714 -#define BASOP_NOGLOB_TMP_715 -#define EVS_FUNC_MODIFIED -//#define DEBUGGING -//#define DBG_WAV_WRITER -#define EVS_FLOAT_ENC -//#define DUMPS_ENABLED -//#define WMOPS -#define FIX_667_DISABLE_INITIAL_PLC_SUPPRESSION -#define IVAS_CNST -#define REMOVE_IVAS_UNUSED_PARAMETERS_WARNING /*temporary operation on unused EVS parameters to remove warnings, these parameters will be used in IVAS */ - -#define MOD_BIT_ALLOC_ROM_TABLE // Just to highlight modification in bit allocation table and to ensure these modifications doesn't affect EVS modes*/ -#define SIMPLIFY_CODE_BE // Simplify synthesis loop - -#define CR_2109_to_2112_cd0_ce0 /* This is related to the CRs include in the 26.444 package of 21-12. Concerns lead_deindexing and */ - -#define FIX_ISSUE_723_INFO_TCX_NOISE /*FhG: Issue 723: fix for IGF that introduces wrong noise filling behavion*/ - -#define FIX_QMETADATA_PENALTY /* Nokia: transform penalty calculation in qmetadata into integer operations */ - -/* ##################### End NON-BE switches ########################### */ -#define FIX_740_HQ_CORE_OVA // Proposed fix to solve overlap and add issue for HQ_CORE -#define FIX_746 // proposed fix to solve low bit-rate frame boundaries issues -#define FIX_SATURATION_725 // Propose fix for saturation in AVQ -#define FIX_737_HQ_ACELP_SWITCH_SCALING_ERROR /* Eri: Proposed fix for issue 737: scaling error in excitation memory after HQ->ACELP switch */ -#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 */ -#define NONBE_FIX_1069_SVD_TUNING /* FhG: issue 1069: tune SVD constants */ -#define FIX_778_STEREO_BRATE_SWITCHING -#define FIX_774_ENERGY_BURST /* Fix 0 bit BWE */ -#define FIX_729_MISSING_RESCALING -#define FIX_798_LSF_SECONDARY_CH_MISSING_CODE /* Adding the missing code to properly render the secondary channel of TD stereo*/ -#define FIX_798_WRONG_CPY_OF_PITCH /* The copy of the pitch from primary to secondary channel was wrong AND safety check was really wrong */ -#define FIX_800_PROPOSAL_HB_LPC_COEFFICIENT /* Proposal to fix wrong shape of TDBWE, #800 */ - -#define FIX_802__NON_BE_DECODING /* Fix possible difference float and fixed point when computing the GSC bit allocation */ -#define FIX_802_1137_1137_GSC_IVAS_FXFLT_DECODING /* VA: ISSUES 802 and 1137 Made sure that float and fixed point GCS bit allocation is the same during IVAS modes */ - -/* ################## End DEVELOPMENT switches ######################### */ - -/* clang-format on */ -#define NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO - -#define UNUSED_PARAM( ... ) (void) ( __VA_ARGS__ ) - -#endif +/****************************************************************************************************** + + (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +/*==================================================================================== + EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0 + ====================================================================================*/ + +#ifndef OPTIONS_H +#define OPTIONS_H +//#define DEBUGGING /*allows message printed out during run time */ +#ifdef DEBUGGING +#include "debug.h" +#endif + +#include "stl.h" + +/* clang-format off */ + /* ################### Start compiler switches ######################## */ + +#define SUPPORT_JBM_TRACEFILE /* support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */ + +/* #################### End compiler switches ######################### */ + +/* ################### Start compiler switches ######################## */ +/* */ +#ifdef _MSC_VER +#pragma warning(disable:4310) /* cast truncates constant value this affects mainly constants tables*/ +#endif + +/*#define WMOPS 1 --> activation or deactivation in count.h*/ /* Activate FIXED-POINT complexity counters */ +/*#define DONT_COUNT */ /* To prevent the complexity counting */ + +#ifdef WMOPS_FLT +/*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ +/*#define WMOPS_DETAIL*/ /* Output detailed complexity printout for every function. Increases runtime overhead */ +/*#define WMOPS_WC_FRAME_ANALYSIS*/ /* Output detailed complexity analysis for the worst-case frame */ +/*#define MEM_COUNT_DETAILS*/ /* Output detailed memory analysis for the worst-case frame (writes to the file "mem_analysis.csv") */ +#endif + +/* #################### End DEBUGGING switches ############################ */ + +/* ################### Start FIXES switches ########################### */ + +#define NON_BE_FIX_1048_THRESHOLD_COH_BASOP /* Nokia: Fix 1048 replace comparison with 0 with comparison to threshold, to align with BASOP*/ +#define NONBE_FIX_1054_NEGATIVE_LVQ_INDEX /* Nokia: issue 1054: Input to decode_comb in deindex_lvq_SHB should be positive */ +#define FIX_1033_MEMORY_LEAK_OMASA /* Nokia / Orange: issue #1033: Memory leak in OMASA to BINAURAL with HRTF with bitrate switching */ +#define FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* Ericsson: premature cast to unsigned detected by USAN corrected */ +#define FIX_1027_GSC_INT_OVERFLOW /* VA: issue 2207: overflow in GSC */ +#define NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO /* FhG: avoid sidegain DFT-Stereo param to be larger than 1 when converting from Dirac parameters */ +#define NON_BE_1055_RESET_LP_MEMORIES /* VA: issue 1055: Correctly reset LP filter MA and AR memories in bitrate switching */ + +/* #################### End FIXES switches ############################ */ + +#define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ + + +/* ################### Start BE switches ################################# */ +/* only BE switches wrt selection floating point code */ + +/*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ + +#define FIX_854_ARRAY_SIZE_MISMATCH /* VA: issue 854: correct the mismatch between definition and declaration of `ivas_core_dec() */ +#define FIX_785_REMOVE_DEAD_CODE /* VA: issue 785: remove dead code */ +#define FIX_852_FIX_HANDLE_DEREF /* VA: issue 852: Fix missing handle dereferencing of hIsmMetadaData in ivas_ism_metadata_close() */ +#define FIX_901_PARAMMC_DEAD_CODE /* FhG: issue 901: remove dead ParamMC code */ + +/* #################### End BE switches ################################## */ + + +/* #################### Start NON-BE switches ############################ */ +/* any switch which is non-be wrt selection floating point code */ +/* all switches in this category should start with "NONBE_" */ + +#define NONBE_FIX_838_CRASH_24_4_WB /* FhG: Issue 838: fix encoder crashes for Unified Stereo and MASA 2 TC at 24.4 kbps WB due to missing IGF (re-) allocation */ +#define NONBE_FIX_839_MC_RS_CHANNEL_ALLOC /* FhG: Issues #839: problems with reallocation of the channels on the heap in case of MC RS */ +#define BE_FIX_832_ASAN_ERROR_EFAP_OSBA /* FhG: issue #832: fix ASAN error caused by re-allocating EFAP memories in OSBA*/ +#define NONBE_FIX_819_DOUBLE_PREC_COMB_FORMATS /* VA: issue 820: Double precision arithmetic in combined formats */ +#define NONBE_FIX_849_OMASA_BFI_CRASH /* VA: issue 849: fix OMASA 2TC and FEC crashes */ +#define NONBE_FIX_738_QUATERNION_SLERP_PRECISION /* Quaternion slerp changes*/ +#define IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED +#define MSAN_FIX +#endif +#define ISM_DISABLE +#define FIX_TMP_714 +#define BASOP_NOGLOB_TMP_715 +#define EVS_FUNC_MODIFIED +//#define DEBUGGING +//#define DBG_WAV_WRITER +#define EVS_FLOAT_ENC +//#define DUMPS_ENABLED +//#define WMOPS +#define FIX_667_DISABLE_INITIAL_PLC_SUPPRESSION +#define IVAS_CNST +#define REMOVE_IVAS_UNUSED_PARAMETERS_WARNING /*temporary operation on unused EVS parameters to remove warnings, these parameters will be used in IVAS */ + +#define MOD_BIT_ALLOC_ROM_TABLE // Just to highlight modification in bit allocation table and to ensure these modifications doesn't affect EVS modes*/ +#define SIMPLIFY_CODE_BE // Simplify synthesis loop + +#define CR_2109_to_2112_cd0_ce0 /* This is related to the CRs include in the 26.444 package of 21-12. Concerns lead_deindexing and */ + +#define FIX_ISSUE_723_INFO_TCX_NOISE /*FhG: Issue 723: fix for IGF that introduces wrong noise filling behavion*/ + +#define FIX_QMETADATA_PENALTY /* Nokia: transform penalty calculation in qmetadata into integer operations */ + +#define NONBE_MDCT_ST_DTX_SKIP_DEWHITENING_OF_NOISE_SHAPES_ON_SID_FRAMES /* FhG: issue 1133: skip de-whitening of bg noise shape after frameloss period if the first good frame is an SID */ +#define NONBE_MDCT_ST_PLC_DO_NOT_SCALE_OLD_OUT_IF_FIRST_GOOD_IS_SID /* FhG: issue 1133: in TCX PLC, don't scale hHQ_core->old_out after applying fade to noise in burst frame error */ + +/* ##################### End NON-BE switches ########################### */ +#define FIX_740_HQ_CORE_OVA // Proposed fix to solve overlap and add issue for HQ_CORE +#define FIX_746 // proposed fix to solve low bit-rate frame boundaries issues +#define FIX_SATURATION_725 // Propose fix for saturation in AVQ +#define FIX_737_HQ_ACELP_SWITCH_SCALING_ERROR /* Eri: Proposed fix for issue 737: scaling error in excitation memory after HQ->ACELP switch */ +#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 */ +#define NONBE_FIX_1069_SVD_TUNING /* FhG: issue 1069: tune SVD constants */ +#define FIX_778_STEREO_BRATE_SWITCHING +#define FIX_774_ENERGY_BURST /* Fix 0 bit BWE */ +#define FIX_729_MISSING_RESCALING +#define FIX_798_LSF_SECONDARY_CH_MISSING_CODE /* Adding the missing code to properly render the secondary channel of TD stereo*/ +#define FIX_798_WRONG_CPY_OF_PITCH /* The copy of the pitch from primary to secondary channel was wrong AND safety check was really wrong */ +#define FIX_800_PROPOSAL_HB_LPC_COEFFICIENT /* Proposal to fix wrong shape of TDBWE, #800 */ + +#define FIX_802__NON_BE_DECODING /* Fix possible difference float and fixed point when computing the GSC bit allocation */ +#define FIX_802_1137_1137_GSC_IVAS_FXFLT_DECODING /* VA: ISSUES 802 and 1137 Made sure that float and fixed point GCS bit allocation is the same during IVAS modes */ + +/* ################## End DEVELOPMENT switches ######################### */ + +/* clang-format on */ +#define NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO + +#define UNUSED_PARAM( ... ) (void) ( __VA_ARGS__ ) + +#endif diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 4ee545e4923c21dc398826f47350f8350a45520e..1ef2e9d41b01c59c18f734d194a1e244ae714e88 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -53,7 +53,7 @@ * Principal IVAS core decoder routine, where number of core channels is 1 or 2 *-------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED -ivas_error ivas_core_dec( +ivas_error ivas_core_dec_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ @@ -279,7 +279,12 @@ ivas_error ivas_core_dec( test(); test(); test(); + test(); +#ifdef NONBE_MDCT_ST_PLC_DO_NOT_SCALE_OLD_OUT_IF_FIRST_GOOD_IS_SID + IF( !st->bfi && st->prev_bfi && GT_32( st->total_brate, SID_2k40 ) && ( EQ_16( st->last_core_bfi, TCX_20_CORE ) || EQ_16( st->last_core_bfi, TCX_10_CORE ) ) && st->hTcxDec != NULL ) +#else IF( !st->bfi && st->prev_bfi && ( EQ_16( st->last_core_bfi, TCX_20_CORE ) || EQ_16( st->last_core_bfi, TCX_10_CORE ) ) && st->hTcxDec != NULL ) +#endif { conceal_eof_gain32 = L_shl( L_deposit_l( st->hTcxDec->conceal_eof_gain ), 1 ); @@ -795,10 +800,18 @@ ivas_error ivas_core_dec( sts[1]->hHQ_core->Q_old_wtda = sub( 15, sts[1]->hHQ_core->exp_old_out ); } } + + test(); test(); +#ifdef NONBE_MDCT_ST_DTX_SKIP_DEWHITENING_OF_NOISE_SHAPES_ON_SID_FRAMES + /* On first good active frame after frameloss undo the whitening of the bg noise shape */ + IF( GT_32( sts[0]->core_brate, SID_2k40 ) && sts[0]->bfi == 0 && EQ_16( sts[0]->prev_bfi, 1 ) ) + { +#else IF( sts[0]->bfi == 0 && EQ_16( sts[0]->prev_bfi, 1 ) ) { /* On first good frame after frameloss undo the whitening of the bg noise shape */ +#endif FOR( n = 0; n < n_channels; ++n ) { IF( NE_16( sts[n]->last_core_bfi, ACELP_CORE ) ) @@ -1754,7 +1767,11 @@ ivas_error ivas_core_dec( st->flagGuidedAcelp = 0; } +#ifdef NONBE_MDCT_ST_PLC_DO_NOT_SCALE_OLD_OUT_IF_FIRST_GOOD_IS_SID + if ( !st->bfi && st->prev_bfi && st->total_brate > SID_2k40 && ( st->last_core_bfi == TCX_20_CORE || st->last_core_bfi == TCX_10_CORE ) && st->hTcxDec != NULL ) +#else if ( !st->bfi && st->prev_bfi && ( st->last_core_bfi == TCX_20_CORE || st->last_core_bfi == TCX_10_CORE ) && st->hTcxDec != NULL ) +#endif { v_multc( st->hHQ_core->old_out, st->hTcxDec->conceal_eof_gain_float * st->last_concealed_gain_syn_deemph_float, st->hHQ_core->old_out, st->hTcxDec->L_frameTCX ); v_multc( st->hHQ_core->old_outLB, st->hTcxDec->conceal_eof_gain_float * st->last_concealed_gain_syn_deemph_float, st->hHQ_core->old_outLB, st->L_frame ); @@ -1968,9 +1985,16 @@ ivas_error ivas_core_dec( updateBuffersForDmxMdctStereo( hCPE, output_frame, output, synth ); } +#ifdef NONBE_MDCT_ST_DTX_SKIP_DEWHITENING_OF_NOISE_SHAPES_ON_SID_FRAMES + + /* On first good active frame after frameloss undo the whitening of the bg noise shape */ + if ( sts[0]->core_brate > SID_2k40 && sts[0]->bfi == 0 && sts[0]->prev_bfi == 1 ) + { +#else if ( sts[0]->bfi == 0 && sts[0]->prev_bfi == 1 ) { /* On first good frame after frameloss undo the whitening of the bg noise shape */ +#endif for ( n = 0; n < n_channels; ++n ) { if ( sts[n]->last_core_bfi != ACELP_CORE ) diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index e0ac57446c165ddca7789cb16608827411dd9057..1a97e84b55d1499a5e742520544b7e6d5b679109 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -586,7 +586,7 @@ ivas_error ivas_cpe_dec_fx( test(); IF( NE_16( hCPE->element_mode, IVAS_CPE_DFT ) || ( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hCPE->hStereoDft->hConfig->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) ) { - IF( NE_32( ( error = ivas_core_dec( st_ivas, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB_fx, NULL, st_ivas->sba_dirac_stereo_flag ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_core_dec_fx( st_ivas, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB_fx, NULL, st_ivas->sba_dirac_stereo_flag ) ), IVAS_ERR_OK ) ) { return error; } @@ -611,7 +611,7 @@ ivas_error ivas_cpe_dec_fx( set32_fx( DFT_fx[1], 0, STEREO_DFT_BUF_MAX ); /* core decoder */ - IF( NE_32( ( error = ivas_core_dec( NULL, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB_fx, DFT_fx, 0 ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_core_dec_fx( NULL, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB_fx, DFT_fx, 0 ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index 78ce1a71ab3f75504ae36c46a077ba6c724a0d5b..5976c81a3a88482b52a6676d923bb420de5889a0 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -298,7 +298,7 @@ ivas_error ivas_sce_dec_fx( set32_fx( output[0], 0, L_FRAME48k ); - IF( NE_32( ( error = ivas_core_dec( st_ivas, hSCE, NULL, NULL, 1, output, outputHB, NULL, st_ivas->sba_dirac_stereo_flag ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_core_dec_fx( st_ivas, hSCE, NULL, NULL, 1, output, outputHB, NULL, st_ivas->sba_dirac_stereo_flag ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_svd_dec.c b/lib_dec/ivas_svd_dec.c index 630e24d4e0918dfeda66fe360ceef6fb79316093..5d5ccedb474d46e4e97279b77ee682e79610d745 100644 --- a/lib_dec/ivas_svd_dec.c +++ b/lib_dec/ivas_svd_dec.c @@ -52,7 +52,7 @@ #ifdef NONBE_FIX_1069_SVD_TUNING #define SVD_MINIMUM_VALUE 1e-32f /* minimum value */ #define CONVERGENCE_FACTOR 1.0e-04f /* factor for SVD convergence */ -#define SVD_ZERO_FLUSH_THRESHOLD 0.0f +#define SVD_ZERO_FLUSH_THRESHOLD 1.0e-20f #else #define SVD_MINIMUM_VALUE 1e-32f /* minimum value */ #define CONVERGENCE_FACTOR 1.19209290e-07f /* factor for SVD convergence */