Loading lib_dec/igf_dec_fx.c +167 −2 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ static Word16 IGF_getScaleFactor32Cond( /**< ou return i; } #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS /**********************************************************************/ /* measures TCX noise **************************************************************************/ Loading Loading @@ -173,6 +173,82 @@ static Word16 ivas_IGF_replaceTCXNoise_1_fx( /**< out: Q return noise; } #else static Word16 IGF_replaceTCXNoise_1( /**< out: Q0 | number of noise bands */ const Word32 *in, /**< in: | MDCT spectrum */ Word16 in_exp, /**< in: | MDCT spectrum exponent */ Word16 s_l, /**< in: Q0 | noise headroom (for EVS) */ const Word16 *TCXNoise, /**< in: Q0 | tcx noise indicator vector */ const Word16 start, /**< in: Q0 | start MDCT subband index */ const Word16 stop, /**< in: Q0 | stop MDCT subband index */ Word32 *totalNoiseNrg, /**< out: | measured noise energy */ Word16 *totalNoiseNrg_exp, /**< out: | measured noise energy exponent */ const Word16 element_mode /**< in: | IVAS element mode type */ ) { Word16 sb, tmp16, shift, noise; Word32 tmp32, nE32; Word64 nE64; shift = 2; move16(); noise = 0; move16(); tmp16 = 0; move16(); tmp32 = 0; move32(); nE32 = 0; move32(); nE64 = 0; move64(); s_l = sub( s_l, 5 ); *totalNoiseNrg = 0; move32(); IF( totalNoiseNrg_exp ) { *totalNoiseNrg_exp = 0; move16(); } FOR( sb = start; sb < stop; sb++ ) { IF( TCXNoise[sb] ) { IF( EQ_16( element_mode, EVS_MONO ) ) { tmp16 = extract_h( L_shl( in[sb], s_l ) ); // Q31 + s_l nE32 = L_mac( nE32, tmp16, tmp16 ); // Q31 + s_l } ELSE { tmp32 = L_shr( in[sb], shift ); nE64 = W_mac_32_32( nE64, tmp32, tmp32 ); // 62 - (in_exp + shift + in_exp + shift + 1) } noise = add( noise, 1 ); } } IF( EQ_16( element_mode, EVS_MONO ) ) { *totalNoiseNrg = nE32; // Q31 + s_l move32(); } ELSE IF( nE64 ) { tmp16 = W_norm( nE64 ); nE64 = W_shl( nE64, tmp16 ); *totalNoiseNrg = W_extract_h( nE64 ); move32(); *totalNoiseNrg_exp = sub( add( shl( shift, 1 ), shl( in_exp, 1 ) ), tmp16 ); move16(); } return noise; } #endif /**********************************************************************/ /* replaces TCX noise Loading Loading @@ -3388,11 +3464,20 @@ void IGFDecApplyMono( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in igf_spec + hGrid->minSrcSubband, sub( hGrid->startLine, hGrid->minSrcSubband ) ); hPrivateData->n_noise_bands = IGF_replaceTCXNoise_1( igf_spec, #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS 0, #endif hPrivateData->headroom_TCX_noise_white, hInstance->infoTCXNoise_evs, hGrid->minSrcSubband, hGrid->startLine, #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS &hPrivateData->totalNoiseNrg, NULL, EVS_MONO ); #else &hPrivateData->totalNoiseNrg ); #endif move16(); move16(); Loading @@ -3409,11 +3494,20 @@ void IGFDecApplyMono( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in sub( hGrid->startLine, hGrid->minSrcSubband ) ); hPrivateData->n_noise_bands_off = IGF_replaceTCXNoise_1( hPrivateData->pSpecFlat, #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS 0, #endif hPrivateData->headroom_TCX_noise, hInstance->infoTCXNoise_evs, hGrid->minSrcSubband, hGrid->startLine, #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS &hPrivateData->totalNoiseNrg_off, NULL, EVS_MONO ); #else &hPrivateData->totalNoiseNrg_off ); #endif move16(); move16(); Loading Loading @@ -3577,6 +3671,17 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in specMed_e = igf_spec_e[i]; move16(); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS hPrivateData->n_noise_bands = IGF_replaceTCXNoise_1( igf_spec, igf_spec_e[i], 0, hInstance->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateData->totalNoiseNrg, &hPrivateData->totalNoiseNrg_exp, element_mode ); #else hPrivateData->n_noise_bands = ivas_IGF_replaceTCXNoise_1_fx( igf_spec, igf_spec_e[i], hInstance->infoTCXNoise_ptr, Loading @@ -3584,6 +3689,7 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in hGrid->startLine, &hPrivateData->totalNoiseNrg, &hPrivateData->totalNoiseNrg_exp ); #endif move16(); BREAK; Loading @@ -3596,6 +3702,17 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in IF( EQ_16( hPrivateData->currWhiteningLevel[i], IGF_WHITENING_OFF ) ) { #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS hPrivateData->n_noise_bands_off = IGF_replaceTCXNoise_1( hPrivateData->pSpecFlat, hPrivateData->pSpecFlat_exp, 0, hInstance->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateData->totalNoiseNrg_off, &hPrivateData->totalNoiseNrg_off_exp, element_mode ); #else hPrivateData->n_noise_bands_off = ivas_IGF_replaceTCXNoise_1_fx( hPrivateData->pSpecFlat, hPrivateData->pSpecFlat_exp, hInstance->infoTCXNoise_ptr, Loading @@ -3603,6 +3720,7 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in hGrid->startLine, &hPrivateData->totalNoiseNrg_off, &hPrivateData->totalNoiseNrg_off_exp ); #endif move16(); BREAK; } Loading Loading @@ -3810,7 +3928,17 @@ void IGFDecApplyStereo( move16(); } #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS hPrivateDataL->n_noise_bands = IGF_replaceTCXNoise_1( igf_specL_fx, specMedL_e, 0, hIGFDecL->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataL->totalNoiseNrg, &hPrivateDataL->totalNoiseNrg_exp, IVAS_CPE_MDCT ); #else hPrivateDataL->n_noise_bands = ivas_IGF_replaceTCXNoise_1_fx( igf_specL_fx, specMedL_e, hIGFDecL->infoTCXNoise_ptr, Loading @@ -3818,6 +3946,7 @@ void IGFDecApplyStereo( hGrid->startLine, &hPrivateDataL->totalNoiseNrg, &hPrivateDataL->totalNoiseNrg_exp ); #endif move16(); IF( !bfi ) Loading @@ -3840,6 +3969,17 @@ void IGFDecApplyStereo( move16(); } #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS hPrivateDataR->n_noise_bands = IGF_replaceTCXNoise_1( igf_specR_fx, specMedR_e, 0, hIGFDecR->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataR->totalNoiseNrg, &hPrivateDataR->totalNoiseNrg_exp, IVAS_CPE_MDCT ); #else hPrivateDataR->n_noise_bands = ivas_IGF_replaceTCXNoise_1_fx( igf_specR_fx, specMedR_e, hIGFDecR->infoTCXNoise_ptr, Loading @@ -3847,6 +3987,7 @@ void IGFDecApplyStereo( hGrid->startLine, &hPrivateDataR->totalNoiseNrg, &hPrivateDataR->totalNoiseNrg_exp ); #endif move16(); BREAK; } Loading @@ -3857,6 +3998,17 @@ void IGFDecApplyStereo( test(); IF( EQ_16( hPrivateDataL->currWhiteningLevel[i], IGF_WHITENING_OFF ) || EQ_16( hPrivateDataR->currWhiteningLevel[i], IGF_WHITENING_OFF ) ) { #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS hPrivateDataL->n_noise_bands_off = IGF_replaceTCXNoise_1( hPrivateDataL->pSpecFlat, hPrivateDataL->pSpecFlat_exp, 0, hIGFDecL->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataL->totalNoiseNrg_off, &hPrivateDataL->totalNoiseNrg_off_exp, IVAS_CPE_MDCT ); #else hPrivateDataL->n_noise_bands_off = ivas_IGF_replaceTCXNoise_1_fx( hPrivateDataL->pSpecFlat, hPrivateDataL->pSpecFlat_exp, hIGFDecL->infoTCXNoise_ptr, Loading @@ -3864,8 +4016,20 @@ void IGFDecApplyStereo( hGrid->startLine, &hPrivateDataL->totalNoiseNrg_off, &hPrivateDataL->totalNoiseNrg_off_exp ); #endif move16(); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS hPrivateDataR->n_noise_bands_off = IGF_replaceTCXNoise_1( hPrivateDataR->pSpecFlat, hPrivateDataR->pSpecFlat_exp, 0, hIGFDecR->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataR->totalNoiseNrg_off, &hPrivateDataR->totalNoiseNrg_off_exp, IVAS_CPE_MDCT ); #else hPrivateDataR->n_noise_bands_off = ivas_IGF_replaceTCXNoise_1_fx( hPrivateDataR->pSpecFlat, hPrivateDataR->pSpecFlat_exp, hIGFDecR->infoTCXNoise_ptr, Loading @@ -3873,6 +4037,7 @@ void IGFDecApplyStereo( hGrid->startLine, &hPrivateDataR->totalNoiseNrg_off, &hPrivateDataR->totalNoiseNrg_off_exp ); #endif move16(); BREAK; } Loading Loading
lib_dec/igf_dec_fx.c +167 −2 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ static Word16 IGF_getScaleFactor32Cond( /**< ou return i; } #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS /**********************************************************************/ /* measures TCX noise **************************************************************************/ Loading Loading @@ -173,6 +173,82 @@ static Word16 ivas_IGF_replaceTCXNoise_1_fx( /**< out: Q return noise; } #else static Word16 IGF_replaceTCXNoise_1( /**< out: Q0 | number of noise bands */ const Word32 *in, /**< in: | MDCT spectrum */ Word16 in_exp, /**< in: | MDCT spectrum exponent */ Word16 s_l, /**< in: Q0 | noise headroom (for EVS) */ const Word16 *TCXNoise, /**< in: Q0 | tcx noise indicator vector */ const Word16 start, /**< in: Q0 | start MDCT subband index */ const Word16 stop, /**< in: Q0 | stop MDCT subband index */ Word32 *totalNoiseNrg, /**< out: | measured noise energy */ Word16 *totalNoiseNrg_exp, /**< out: | measured noise energy exponent */ const Word16 element_mode /**< in: | IVAS element mode type */ ) { Word16 sb, tmp16, shift, noise; Word32 tmp32, nE32; Word64 nE64; shift = 2; move16(); noise = 0; move16(); tmp16 = 0; move16(); tmp32 = 0; move32(); nE32 = 0; move32(); nE64 = 0; move64(); s_l = sub( s_l, 5 ); *totalNoiseNrg = 0; move32(); IF( totalNoiseNrg_exp ) { *totalNoiseNrg_exp = 0; move16(); } FOR( sb = start; sb < stop; sb++ ) { IF( TCXNoise[sb] ) { IF( EQ_16( element_mode, EVS_MONO ) ) { tmp16 = extract_h( L_shl( in[sb], s_l ) ); // Q31 + s_l nE32 = L_mac( nE32, tmp16, tmp16 ); // Q31 + s_l } ELSE { tmp32 = L_shr( in[sb], shift ); nE64 = W_mac_32_32( nE64, tmp32, tmp32 ); // 62 - (in_exp + shift + in_exp + shift + 1) } noise = add( noise, 1 ); } } IF( EQ_16( element_mode, EVS_MONO ) ) { *totalNoiseNrg = nE32; // Q31 + s_l move32(); } ELSE IF( nE64 ) { tmp16 = W_norm( nE64 ); nE64 = W_shl( nE64, tmp16 ); *totalNoiseNrg = W_extract_h( nE64 ); move32(); *totalNoiseNrg_exp = sub( add( shl( shift, 1 ), shl( in_exp, 1 ) ), tmp16 ); move16(); } return noise; } #endif /**********************************************************************/ /* replaces TCX noise Loading Loading @@ -3388,11 +3464,20 @@ void IGFDecApplyMono( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in igf_spec + hGrid->minSrcSubband, sub( hGrid->startLine, hGrid->minSrcSubband ) ); hPrivateData->n_noise_bands = IGF_replaceTCXNoise_1( igf_spec, #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS 0, #endif hPrivateData->headroom_TCX_noise_white, hInstance->infoTCXNoise_evs, hGrid->minSrcSubband, hGrid->startLine, #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS &hPrivateData->totalNoiseNrg, NULL, EVS_MONO ); #else &hPrivateData->totalNoiseNrg ); #endif move16(); move16(); Loading @@ -3409,11 +3494,20 @@ void IGFDecApplyMono( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in sub( hGrid->startLine, hGrid->minSrcSubband ) ); hPrivateData->n_noise_bands_off = IGF_replaceTCXNoise_1( hPrivateData->pSpecFlat, #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS 0, #endif hPrivateData->headroom_TCX_noise, hInstance->infoTCXNoise_evs, hGrid->minSrcSubband, hGrid->startLine, #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS &hPrivateData->totalNoiseNrg_off, NULL, EVS_MONO ); #else &hPrivateData->totalNoiseNrg_off ); #endif move16(); move16(); Loading Loading @@ -3577,6 +3671,17 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in specMed_e = igf_spec_e[i]; move16(); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS hPrivateData->n_noise_bands = IGF_replaceTCXNoise_1( igf_spec, igf_spec_e[i], 0, hInstance->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateData->totalNoiseNrg, &hPrivateData->totalNoiseNrg_exp, element_mode ); #else hPrivateData->n_noise_bands = ivas_IGF_replaceTCXNoise_1_fx( igf_spec, igf_spec_e[i], hInstance->infoTCXNoise_ptr, Loading @@ -3584,6 +3689,7 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in hGrid->startLine, &hPrivateData->totalNoiseNrg, &hPrivateData->totalNoiseNrg_exp ); #endif move16(); BREAK; Loading @@ -3596,6 +3702,17 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in IF( EQ_16( hPrivateData->currWhiteningLevel[i], IGF_WHITENING_OFF ) ) { #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS hPrivateData->n_noise_bands_off = IGF_replaceTCXNoise_1( hPrivateData->pSpecFlat, hPrivateData->pSpecFlat_exp, 0, hInstance->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateData->totalNoiseNrg_off, &hPrivateData->totalNoiseNrg_off_exp, element_mode ); #else hPrivateData->n_noise_bands_off = ivas_IGF_replaceTCXNoise_1_fx( hPrivateData->pSpecFlat, hPrivateData->pSpecFlat_exp, hInstance->infoTCXNoise_ptr, Loading @@ -3603,6 +3720,7 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in hGrid->startLine, &hPrivateData->totalNoiseNrg_off, &hPrivateData->totalNoiseNrg_off_exp ); #endif move16(); BREAK; } Loading Loading @@ -3810,7 +3928,17 @@ void IGFDecApplyStereo( move16(); } #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS hPrivateDataL->n_noise_bands = IGF_replaceTCXNoise_1( igf_specL_fx, specMedL_e, 0, hIGFDecL->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataL->totalNoiseNrg, &hPrivateDataL->totalNoiseNrg_exp, IVAS_CPE_MDCT ); #else hPrivateDataL->n_noise_bands = ivas_IGF_replaceTCXNoise_1_fx( igf_specL_fx, specMedL_e, hIGFDecL->infoTCXNoise_ptr, Loading @@ -3818,6 +3946,7 @@ void IGFDecApplyStereo( hGrid->startLine, &hPrivateDataL->totalNoiseNrg, &hPrivateDataL->totalNoiseNrg_exp ); #endif move16(); IF( !bfi ) Loading @@ -3840,6 +3969,17 @@ void IGFDecApplyStereo( move16(); } #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS hPrivateDataR->n_noise_bands = IGF_replaceTCXNoise_1( igf_specR_fx, specMedR_e, 0, hIGFDecR->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataR->totalNoiseNrg, &hPrivateDataR->totalNoiseNrg_exp, IVAS_CPE_MDCT ); #else hPrivateDataR->n_noise_bands = ivas_IGF_replaceTCXNoise_1_fx( igf_specR_fx, specMedR_e, hIGFDecR->infoTCXNoise_ptr, Loading @@ -3847,6 +3987,7 @@ void IGFDecApplyStereo( hGrid->startLine, &hPrivateDataR->totalNoiseNrg, &hPrivateDataR->totalNoiseNrg_exp ); #endif move16(); BREAK; } Loading @@ -3857,6 +3998,17 @@ void IGFDecApplyStereo( test(); IF( EQ_16( hPrivateDataL->currWhiteningLevel[i], IGF_WHITENING_OFF ) || EQ_16( hPrivateDataR->currWhiteningLevel[i], IGF_WHITENING_OFF ) ) { #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS hPrivateDataL->n_noise_bands_off = IGF_replaceTCXNoise_1( hPrivateDataL->pSpecFlat, hPrivateDataL->pSpecFlat_exp, 0, hIGFDecL->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataL->totalNoiseNrg_off, &hPrivateDataL->totalNoiseNrg_off_exp, IVAS_CPE_MDCT ); #else hPrivateDataL->n_noise_bands_off = ivas_IGF_replaceTCXNoise_1_fx( hPrivateDataL->pSpecFlat, hPrivateDataL->pSpecFlat_exp, hIGFDecL->infoTCXNoise_ptr, Loading @@ -3864,8 +4016,20 @@ void IGFDecApplyStereo( hGrid->startLine, &hPrivateDataL->totalNoiseNrg_off, &hPrivateDataL->totalNoiseNrg_off_exp ); #endif move16(); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS hPrivateDataR->n_noise_bands_off = IGF_replaceTCXNoise_1( hPrivateDataR->pSpecFlat, hPrivateDataR->pSpecFlat_exp, 0, hIGFDecR->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataR->totalNoiseNrg_off, &hPrivateDataR->totalNoiseNrg_off_exp, IVAS_CPE_MDCT ); #else hPrivateDataR->n_noise_bands_off = ivas_IGF_replaceTCXNoise_1_fx( hPrivateDataR->pSpecFlat, hPrivateDataR->pSpecFlat_exp, hIGFDecR->infoTCXNoise_ptr, Loading @@ -3873,6 +4037,7 @@ void IGFDecApplyStereo( hGrid->startLine, &hPrivateDataR->totalNoiseNrg_off, &hPrivateDataR->totalNoiseNrg_off_exp ); #endif move16(); BREAK; } Loading