Loading lib_dec/igf_dec_fx.c +176 −79 Original line number Diff line number Diff line Loading @@ -1835,7 +1835,7 @@ static void IGF_calc_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in } } #endif #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS /**********************************************************************/ /* apply IGF **************************************************************************/ Loading Loading @@ -1976,12 +1976,7 @@ static void IGF_appl( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in *spectrum_e, energyTmp, &dE_e, #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS negate( tmp ), EVS_MONO ); #else negate( tmp ) ); #endif L_tmp = sum_array_norm( energyTmp, 24, &shift ); /* float: dE = (float)sqrt(dE / 24.f); basop: */ Loading Loading @@ -2509,7 +2504,6 @@ static void IGF_appl( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in } } } /**********************************************************************/ /* apply IGF (for IVAS) **************************************************************************/ Loading @@ -2524,6 +2518,23 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in Word16 *flag_sparse, /**< out: Q0 | temp flattening indicator */ Word16 bfi_apply_damping /**< in: | bfi apply damping */ ) #else /**********************************************************************/ /* apply IGF **************************************************************************/ static void IGF_appl( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in: | IGF private data handle */ const Word16 igfGridIdx, /**< in: Q0 | in case of CELP->TCX switching, use 1.25 framelength */ Word32 *spectrum, /**< in: Q31 | MDCT spectrum */ Word16 *spectrum_e, /**< in: | exponent of pSpectralData */ const Word32 *igf_spec, /**< in: Q31 | prepared IGF spectrum */ const Word16 *igf_spec_e, /**< in: | array exponents of igf_spec, one exponent per tile */ Word32 *virtualSpec, /**< out:Q31 | virtual IGF spectrum, used for temp flattening */ Word16 *virtualSpec_e, /**< out: | exponent of virtualSpec */ Word16 *flag_sparse, /**< out: Q0 | temp flattening indicator */ Word16 bfi_apply_damping, /**< in: | bfi apply damping */ Word16 element_mode /**< in: | IVAS element mode type */ ) #endif { H_IGF_GRID hGrid; Word16 i; Loading Loading @@ -2653,7 +2664,7 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in energyTmp, &dE_e, negate( tmp ), IVAS_CPE_MDCT ); element_mode ); #else IGFCommonFuncsMDCTSquareSpec_ivas( tmp, hGrid->startLine, Loading Loading @@ -2686,7 +2697,11 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in move16(); } hopsize = s_min( hopsize, hPrivateData->igfInfo.maxHopsize ); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS IF( hPrivateData->restrict_hopsize && GT_16( element_mode, EVS_MONO ) ) #else IF( hPrivateData->restrict_hopsize ) #endif { hopsize = s_min( hopsize, 2 ); } Loading Loading @@ -2732,6 +2747,9 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in move16(); move16(); gn_e = 13; /* set exponent of igf_curr to 13 = 15 - 2; -> igf_curr = igf_curr * 0.25, virtual division by 4 */ #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS move16(); #endif gn = sub( gn, 16 ); /* 13Q2 | 4 = 16 * 2^(-15 + 13); ("4" has same exponent as igf_curr now) */ /* float: tmp = pow(2.f, gn); basop: */ Loading Loading @@ -2778,7 +2796,17 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in /* calc square root of L_tmp and store result in dN */ L_tmp = Sqrt32( L_tmp, &L_tmp_e ); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS if ( EQ_16( element_mode, EVS_MONO ) ) { dN[sfb] = round_fx_sat( L_tmp ); } else { dN[sfb] = extract_h( L_tmp ); } #else dN[sfb] = extract_h( L_tmp ); #endif move16(); dN_e[sfb] = L_tmp_e; move16(); Loading Loading @@ -2834,8 +2862,14 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in /* max(0.001 * sNlocal, L_tmp) */ /* Build a threshold and compare with L_tmp. Build negated threshold and compare with negated L_tmp to cover also fullscale L_tmp case */ #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS BASOP_SATURATE_WARNING_OFF_EVS #endif L_tmp2 = L_shl_sat( L_negate( Mpy_32_16_1( sNlocal, 33 /*0.001f Q15*/ ) ), sub( sNlocal_e, L_tmp_e ) ); L_tmp2 = L_sub_sat( L_tmp2, L_negate( L_tmp ) ); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS BASOP_SATURATE_WARNING_ON_EVS; #endif IF( L_tmp2 < 0 ) { Loading Loading @@ -3107,11 +3141,56 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in } } #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS if ( EQ_16( element_mode, EVS_MONO ) ) { FOR( tb = hGrid->swb_offset[sfb]; tb < hGrid->swb_offset[sfb + 1]; tb++ ) { /* multiply the prepared IGF spectrum with the gain */ L_tmp2 = 0; /* set L_tmp2 to default value */ move32(); L_tmp = Mpy_32_16_1( igf_spec[tb], gain[sfb] ); L_tmp_e = add( igf_spec_e[tileIdx], gain_e[sfb] ); /* store the finalized IGF spectrum */ IF( spectrum[tb] == 0 ) { shift = sub( L_tmp_e, *spectrum_e ); tmp = sub( sub( norm_l( L_tmp ), shift ), 32 ); IF( tmp < 0 ) { L_tmp2 = L_shl( L_tmp, shift ); } spectrum[tb] = L_tmp2; move32(); flag_sparse[tb - IGF_START_MN] = 1; move16(); } ELSE { shift = sub( L_tmp_e, *virtualSpec_e ); tmp = sub( sub( norm_l( L_tmp ), shift ), 32 ); IF( tmp < 0 ) { L_tmp2 = L_shl( L_tmp, shift ); } virtualSpec[tb - IGF_START_MN] = L_tmp2; move32(); flag_sparse[tb - IGF_START_MN] = 2; move16(); } } } else { #endif FOR( tb = hGrid->swb_offset[sfb]; tb < hGrid->swb_offset[sfb + 1]; tb++ ) { /* multiply the prepared IGF spectrum with the gain */ #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS L_tmp2 = 0; /* set L_tmp2 to default value */ move32(); #endif L_tmp = Mpy_32_16_1( igf_spec[tb], gain[sfb] ); L_tmp_e = add( igf_spec_e[tileIdx], gain_e[sfb] ); Loading @@ -3135,8 +3214,15 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in move16(); } } #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS } #endif } #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS if ( GT_16( element_mode, EVS_MONO ) ) { #endif Word16 max_e; max_e = *spectrum_e; move16(); Loading Loading @@ -3171,6 +3257,9 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in } *virtualSpec_e = max_e; move16(); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS } #endif } /**********************************************************************/ /* Loading Loading @@ -4088,21 +4177,7 @@ void IGFDecApplyMono( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | in igf_spec_e, element_mode ); IF( EQ_16( element_mode, EVS_MONO ) ) { IGF_appl( hPrivateData, igfGridIdx, spectrum, spectrum_e, igf_spec, igf_spec_e, hInstance->virtualSpec, &hInstance->virtualSpec_e, hInstance->flag_sparseBuf ); } ELSE { IGF_appl_ivas( hPrivateData, igfGridIdx, spectrum, spectrum_e, Loading @@ -4111,8 +4186,8 @@ void IGFDecApplyMono( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | in hInstance->virtualSpec, &hInstance->virtualSpec_e, hInstance->flag_sparseBuf, 1 ); } 1, element_mode ); #else IGF_prep_ivas( hPrivateData, igfGridIdx, Loading Loading @@ -4471,6 +4546,28 @@ void IGFDecApplyStereo( igf_specR_fx, igf_specR_e, IVAS_CPE_MDCT ); IGF_appl( hPrivateDataL, igfGridIdx, spectrumL_fx, spectrumL_e, igf_specL_fx, igf_specL_e, hIGFDecL->virtualSpec, &hIGFDecL->virtualSpec_e, hIGFDecL->flag_sparseBuf, bfi_apply_damping, IVAS_CPE_MDCT ); IGF_appl( hPrivateDataR, igfGridIdx, spectrumR_fx, spectrumR_e, igf_specR_fx, igf_specR_e, hIGFDecR->virtualSpec, &hIGFDecR->virtualSpec_e, hIGFDecR->flag_sparseBuf, bfi_apply_damping, IVAS_CPE_MDCT ); #else IGF_calc_ivas( hPrivateDataL, igfGridIdx, Loading @@ -4484,7 +4581,6 @@ void IGFDecApplyStereo( *spectrumR_e, igf_specR_fx, igf_specR_e ); #endif IGF_appl_ivas( hPrivateDataL, igfGridIdx, spectrumL_fx, Loading @@ -4505,6 +4601,7 @@ void IGFDecApplyStereo( &hIGFDecR->virtualSpec_e, hIGFDecR->flag_sparseBuf, bfi_apply_damping ); #endif } /* reset TCX noise indicator vector */ Loading Loading
lib_dec/igf_dec_fx.c +176 −79 Original line number Diff line number Diff line Loading @@ -1835,7 +1835,7 @@ static void IGF_calc_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in } } #endif #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS /**********************************************************************/ /* apply IGF **************************************************************************/ Loading Loading @@ -1976,12 +1976,7 @@ static void IGF_appl( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in *spectrum_e, energyTmp, &dE_e, #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS negate( tmp ), EVS_MONO ); #else negate( tmp ) ); #endif L_tmp = sum_array_norm( energyTmp, 24, &shift ); /* float: dE = (float)sqrt(dE / 24.f); basop: */ Loading Loading @@ -2509,7 +2504,6 @@ static void IGF_appl( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in } } } /**********************************************************************/ /* apply IGF (for IVAS) **************************************************************************/ Loading @@ -2524,6 +2518,23 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in Word16 *flag_sparse, /**< out: Q0 | temp flattening indicator */ Word16 bfi_apply_damping /**< in: | bfi apply damping */ ) #else /**********************************************************************/ /* apply IGF **************************************************************************/ static void IGF_appl( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in: | IGF private data handle */ const Word16 igfGridIdx, /**< in: Q0 | in case of CELP->TCX switching, use 1.25 framelength */ Word32 *spectrum, /**< in: Q31 | MDCT spectrum */ Word16 *spectrum_e, /**< in: | exponent of pSpectralData */ const Word32 *igf_spec, /**< in: Q31 | prepared IGF spectrum */ const Word16 *igf_spec_e, /**< in: | array exponents of igf_spec, one exponent per tile */ Word32 *virtualSpec, /**< out:Q31 | virtual IGF spectrum, used for temp flattening */ Word16 *virtualSpec_e, /**< out: | exponent of virtualSpec */ Word16 *flag_sparse, /**< out: Q0 | temp flattening indicator */ Word16 bfi_apply_damping, /**< in: | bfi apply damping */ Word16 element_mode /**< in: | IVAS element mode type */ ) #endif { H_IGF_GRID hGrid; Word16 i; Loading Loading @@ -2653,7 +2664,7 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in energyTmp, &dE_e, negate( tmp ), IVAS_CPE_MDCT ); element_mode ); #else IGFCommonFuncsMDCTSquareSpec_ivas( tmp, hGrid->startLine, Loading Loading @@ -2686,7 +2697,11 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in move16(); } hopsize = s_min( hopsize, hPrivateData->igfInfo.maxHopsize ); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS IF( hPrivateData->restrict_hopsize && GT_16( element_mode, EVS_MONO ) ) #else IF( hPrivateData->restrict_hopsize ) #endif { hopsize = s_min( hopsize, 2 ); } Loading Loading @@ -2732,6 +2747,9 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in move16(); move16(); gn_e = 13; /* set exponent of igf_curr to 13 = 15 - 2; -> igf_curr = igf_curr * 0.25, virtual division by 4 */ #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS move16(); #endif gn = sub( gn, 16 ); /* 13Q2 | 4 = 16 * 2^(-15 + 13); ("4" has same exponent as igf_curr now) */ /* float: tmp = pow(2.f, gn); basop: */ Loading Loading @@ -2778,7 +2796,17 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in /* calc square root of L_tmp and store result in dN */ L_tmp = Sqrt32( L_tmp, &L_tmp_e ); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS if ( EQ_16( element_mode, EVS_MONO ) ) { dN[sfb] = round_fx_sat( L_tmp ); } else { dN[sfb] = extract_h( L_tmp ); } #else dN[sfb] = extract_h( L_tmp ); #endif move16(); dN_e[sfb] = L_tmp_e; move16(); Loading Loading @@ -2834,8 +2862,14 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in /* max(0.001 * sNlocal, L_tmp) */ /* Build a threshold and compare with L_tmp. Build negated threshold and compare with negated L_tmp to cover also fullscale L_tmp case */ #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS BASOP_SATURATE_WARNING_OFF_EVS #endif L_tmp2 = L_shl_sat( L_negate( Mpy_32_16_1( sNlocal, 33 /*0.001f Q15*/ ) ), sub( sNlocal_e, L_tmp_e ) ); L_tmp2 = L_sub_sat( L_tmp2, L_negate( L_tmp ) ); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS BASOP_SATURATE_WARNING_ON_EVS; #endif IF( L_tmp2 < 0 ) { Loading Loading @@ -3107,11 +3141,56 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in } } #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS if ( EQ_16( element_mode, EVS_MONO ) ) { FOR( tb = hGrid->swb_offset[sfb]; tb < hGrid->swb_offset[sfb + 1]; tb++ ) { /* multiply the prepared IGF spectrum with the gain */ L_tmp2 = 0; /* set L_tmp2 to default value */ move32(); L_tmp = Mpy_32_16_1( igf_spec[tb], gain[sfb] ); L_tmp_e = add( igf_spec_e[tileIdx], gain_e[sfb] ); /* store the finalized IGF spectrum */ IF( spectrum[tb] == 0 ) { shift = sub( L_tmp_e, *spectrum_e ); tmp = sub( sub( norm_l( L_tmp ), shift ), 32 ); IF( tmp < 0 ) { L_tmp2 = L_shl( L_tmp, shift ); } spectrum[tb] = L_tmp2; move32(); flag_sparse[tb - IGF_START_MN] = 1; move16(); } ELSE { shift = sub( L_tmp_e, *virtualSpec_e ); tmp = sub( sub( norm_l( L_tmp ), shift ), 32 ); IF( tmp < 0 ) { L_tmp2 = L_shl( L_tmp, shift ); } virtualSpec[tb - IGF_START_MN] = L_tmp2; move32(); flag_sparse[tb - IGF_START_MN] = 2; move16(); } } } else { #endif FOR( tb = hGrid->swb_offset[sfb]; tb < hGrid->swb_offset[sfb + 1]; tb++ ) { /* multiply the prepared IGF spectrum with the gain */ #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS L_tmp2 = 0; /* set L_tmp2 to default value */ move32(); #endif L_tmp = Mpy_32_16_1( igf_spec[tb], gain[sfb] ); L_tmp_e = add( igf_spec_e[tileIdx], gain_e[sfb] ); Loading @@ -3135,8 +3214,15 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in move16(); } } #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS } #endif } #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS if ( GT_16( element_mode, EVS_MONO ) ) { #endif Word16 max_e; max_e = *spectrum_e; move16(); Loading Loading @@ -3171,6 +3257,9 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in } *virtualSpec_e = max_e; move16(); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS } #endif } /**********************************************************************/ /* Loading Loading @@ -4088,21 +4177,7 @@ void IGFDecApplyMono( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | in igf_spec_e, element_mode ); IF( EQ_16( element_mode, EVS_MONO ) ) { IGF_appl( hPrivateData, igfGridIdx, spectrum, spectrum_e, igf_spec, igf_spec_e, hInstance->virtualSpec, &hInstance->virtualSpec_e, hInstance->flag_sparseBuf ); } ELSE { IGF_appl_ivas( hPrivateData, igfGridIdx, spectrum, spectrum_e, Loading @@ -4111,8 +4186,8 @@ void IGFDecApplyMono( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | in hInstance->virtualSpec, &hInstance->virtualSpec_e, hInstance->flag_sparseBuf, 1 ); } 1, element_mode ); #else IGF_prep_ivas( hPrivateData, igfGridIdx, Loading Loading @@ -4471,6 +4546,28 @@ void IGFDecApplyStereo( igf_specR_fx, igf_specR_e, IVAS_CPE_MDCT ); IGF_appl( hPrivateDataL, igfGridIdx, spectrumL_fx, spectrumL_e, igf_specL_fx, igf_specL_e, hIGFDecL->virtualSpec, &hIGFDecL->virtualSpec_e, hIGFDecL->flag_sparseBuf, bfi_apply_damping, IVAS_CPE_MDCT ); IGF_appl( hPrivateDataR, igfGridIdx, spectrumR_fx, spectrumR_e, igf_specR_fx, igf_specR_e, hIGFDecR->virtualSpec, &hIGFDecR->virtualSpec_e, hIGFDecR->flag_sparseBuf, bfi_apply_damping, IVAS_CPE_MDCT ); #else IGF_calc_ivas( hPrivateDataL, igfGridIdx, Loading @@ -4484,7 +4581,6 @@ void IGFDecApplyStereo( *spectrumR_e, igf_specR_fx, igf_specR_e ); #endif IGF_appl_ivas( hPrivateDataL, igfGridIdx, spectrumL_fx, Loading @@ -4505,6 +4601,7 @@ void IGFDecApplyStereo( &hIGFDecR->virtualSpec_e, hIGFDecR->flag_sparseBuf, bfi_apply_damping ); #endif } /* reset TCX noise indicator vector */ Loading