Loading lib_enc/igf_enc_fx.c +46 −1 Original line number Diff line number Diff line Loading @@ -762,9 +762,18 @@ crest factor calculation Word16 IGF_getCrest( Word16 *crest_exp, /* o : exponent of crest factor */ const Word32 *powerSpectrum, /* i : Q31 | power spectrum */ #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS const Word16 *powerSpectrum_exp,/* i : exponent of power spectrum */ #else const Word16 powerSpectrum_exp, /* i : exponent of power spectrum */ #endif const Word16 start, /* i : Q0 | start subband index */ #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS const Word16 stop, /* i : Q0 | stop subband index */ const Word16 element_mode /* i : IVAS element mode type */ #else const Word16 stop /* i : Q0 | stop subband index */ #endif ) { Word16 i; Loading @@ -775,6 +784,9 @@ Word16 IGF_getCrest( Word16 crest; Word16 tmp; Word32 tmp32; #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS Word16 powSpec_exp; #endif x_eff32 = 0; move32(); Loading @@ -784,13 +796,25 @@ Word16 IGF_getCrest( move16(); *crest_exp = 1; move16(); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS powSpec_exp = powerSpectrum_exp[0]; move16(); #endif FOR( i = start; i < stop; i++ ) { /*x = max(0, (int)(log(powerSpectrum[i]) * INV_LOG_2));*/ /*see IGF_getSFM for more comment */ #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS IF( GT_16( element_mode, EVS_MONO ) ) { powSpec_exp = powerSpectrum_exp[i]; /* exponent is a vector in IVAS (and a scalar in EVS) */ } x = sub( sub( powSpec_exp, norm_l( powerSpectrum[i] ) ), 1 ); /*Q0*/ #else x = sub( sub( powerSpectrum_exp, norm_l( powerSpectrum[i] ) ), 1 ); /*Q0*/ #endif if ( powerSpectrum[i] == 0 ) /*special case: energy is zero*/ { x = 0; Loading Loading @@ -840,7 +864,7 @@ Word16 IGF_getCrest( return crest; } #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS /* o: Q15| crest factor */ Word16 IGF_getCrest_ivas( Word16 *crest_exp, /* o : | exponent of crest factor */ Loading Loading @@ -922,6 +946,7 @@ Word16 IGF_getCrest_ivas( return crest; } #endif /************************************************************************* Loading Loading @@ -1208,7 +1233,11 @@ static void IGF_Whitening( { /*tmp = IGF_getSFM(powerSpectrum, hGrid->tile[p], hGrid->tile[p+1]) / IGF_getCrest(powerSpectrum, hGrid->tile[p], hGrid->tile[p+1]);*/ SFM = IGF_getSFM( &SFM_exp, powerSpectrum, &powerSpectrum_exp, hGrid->tile[p], hGrid->tile[p + 1] ); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS crest = IGF_getCrest( &crest_exp, powerSpectrum, &powerSpectrum_exp, hGrid->tile[p], hGrid->tile[p + 1], EVS_MONO ); #else crest = IGF_getCrest( &crest_exp, powerSpectrum, powerSpectrum_exp, hGrid->tile[p], hGrid->tile[p + 1] ); #endif tmp = BASOP_Util_Divide1616_Scale( SFM, crest, &s ); /* Q15 */ s = add( s, sub( SFM_exp, crest_exp ) ); Loading Loading @@ -3094,13 +3123,21 @@ static void IGF_CalculateStereoEnvelope_fx( // tmp_tb = IGF_getSFM_ivas(pPowerSpectrum, swb_offset[sfb], swb_offset[sfb + 1]) / IGF_getCrest_ivas(pPowerSpectrum, swb_offset[sfb], swb_offset[sfb + 1]); sfm = IGF_getSFM_ivas_fx( &sfm_exp, pPowerSpectrum_fx, pPowerSpectrum_e, swb_offset[sfb], swb_offset[sfb + 1] ); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS crest = IGF_getCrest( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, swb_offset[sfb], swb_offset[sfb + 1], IVAS_CPE_MDCT ); #else crest = IGF_getCrest_ivas( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, swb_offset[sfb], swb_offset[sfb + 1] ); #endif tmp_tb_fx = BASOP_Util_Divide1616_Scale( sfm, crest, &tmp_e ); tmp_tb_e = add( tmp_e, sub( sfm_exp, crest_exp ) ); /*stores the resultant exponent for tmp_tb_fx*/ // tmp_sb = IGF_getSFM_ivas(tileSrcSpec, 0, strt_cpy - tmp) / IGF_getCrest_ivas(tileSrcSpec, 0, strt_cpy - tmp); sfm = IGF_getSFM_ivas_fx( &sfm_exp, tileSrcSpec_fx, tileSrcSpec_e, 0, sub( strt_cpy, tmp ) ); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS crest = IGF_getCrest( &crest_exp, tileSrcSpec_fx, tileSrcSpec_e, 0, sub( strt_cpy, tmp ), IVAS_CPE_MDCT ); #else crest = IGF_getCrest_ivas( &crest_exp, tileSrcSpec_fx, tileSrcSpec_e, 0, sub( strt_cpy, tmp ) ); #endif tmp_sb_fx = BASOP_Util_Divide1616_Scale( sfm, crest, &tmp_e ); tmp_sb_e = add( tmp_e, sub( sfm_exp, crest_exp ) ); /*stores the resultant exponent for tmp_sb_fx*/ Loading Loading @@ -3245,7 +3282,11 @@ static void IGF_CalculateStereoEnvelope_fx( Word16 shift = shr( width, 1 ); // shiftedSFM = IGF_getSFM_ivas( pPowerSpectrum, swb_offset[sfb] - shift, swb_offset[sfb + 1] - shift ) / IGF_getCrest_ivas( pPowerSpectrum, swb_offset[sfb] - shift, swb_offset[sfb + 1] - shift ); sfm = IGF_getSFM_ivas_fx( &sfm_exp, pPowerSpectrum_fx, pPowerSpectrum_e, sub( swb_offset[sfb], shift ), sub( swb_offset[sfb + 1], shift ) ); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS crest = IGF_getCrest( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, sub( swb_offset[sfb], shift ), sub( swb_offset[sfb + 1], shift ), IVAS_CPE_MDCT ); #else crest = IGF_getCrest_ivas( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, sub( swb_offset[sfb], shift ), sub( swb_offset[sfb + 1], shift ) ); #endif shiftedSFM_fx = BASOP_Util_Divide1616_Scale( sfm, crest, &shiftedSFM_e ); } ELSE IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( slope_fx, add( slope_e, 16 ), threshold_fx, add( threshold_e, 16 ) ), 1 ) && ( NE_16( sfb, sub( hGrid->sfbWrap[hGrid->nTiles], 1 ) ) ) ) Loading @@ -3254,7 +3295,11 @@ static void IGF_CalculateStereoEnvelope_fx( shift = shr( width, 1 ); // shiftedSFM = IGF_getSFM_ivas( pPowerSpectrum, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift ) / IGF_getCrest_ivas( pPowerSpectrum, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift ); sfm = IGF_getSFM_ivas_fx( &sfm_exp, pPowerSpectrum_fx, pPowerSpectrum_e, add( swb_offset[sfb], shift ), add( swb_offset[sfb + 1], shift ) ); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS crest = IGF_getCrest( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, add( swb_offset[sfb], shift ), add( swb_offset[sfb + 1], shift ), IVAS_CPE_MDCT ); #else crest = IGF_getCrest_ivas( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, add( swb_offset[sfb], shift ), add( swb_offset[sfb + 1], shift ) ); #endif shiftedSFM_fx = BASOP_Util_Divide1616_Scale( sfm, crest, &shiftedSFM_e ); } IF( shiftedSFM_fx ) Loading lib_enc/prot_fx_enc.h +11 −1 Original line number Diff line number Diff line Loading @@ -2673,11 +2673,21 @@ void IGF_UpdateInfo( Word16 IGF_getCrest( Word16 *crest_exp, /**< out: | exponent of crest factor */ const Word32 *powerSpectrum, /**< in: Q31 | power spectrum */ #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS const Word16 *powerSpectrum_exp,/**< in: | exponent of power spectrum */ #else const Word16 powerSpectrum_exp, /**< in: | exponent of power spectrum */ #endif const Word16 start, /**< in: Q0 | start subband index */ #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS const Word16 stop, /**< in: Q0 | stop subband index */ const Word16 element_mode /**< in: | IVAS element mode type */ #else const Word16 stop /**< in: Q0 | stop subband index */ #endif ); #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS /* o: Q15| crest factor */ Word16 IGF_getCrest_ivas( Word16 *crest_exp, /* o : | exponent of crest factor */ Loading @@ -2686,7 +2696,7 @@ Word16 IGF_getCrest_ivas( const Word16 start, /* i : Q0 | start subband index */ const Word16 stop /* i : Q0 | stop subband index */ ); #endif /* o: Q15| SFM value */ Word16 IGF_getSFM( Word16 *SFM_exp, /* o : | exponent of SFM Factor */ Loading Loading
lib_enc/igf_enc_fx.c +46 −1 Original line number Diff line number Diff line Loading @@ -762,9 +762,18 @@ crest factor calculation Word16 IGF_getCrest( Word16 *crest_exp, /* o : exponent of crest factor */ const Word32 *powerSpectrum, /* i : Q31 | power spectrum */ #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS const Word16 *powerSpectrum_exp,/* i : exponent of power spectrum */ #else const Word16 powerSpectrum_exp, /* i : exponent of power spectrum */ #endif const Word16 start, /* i : Q0 | start subband index */ #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS const Word16 stop, /* i : Q0 | stop subband index */ const Word16 element_mode /* i : IVAS element mode type */ #else const Word16 stop /* i : Q0 | stop subband index */ #endif ) { Word16 i; Loading @@ -775,6 +784,9 @@ Word16 IGF_getCrest( Word16 crest; Word16 tmp; Word32 tmp32; #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS Word16 powSpec_exp; #endif x_eff32 = 0; move32(); Loading @@ -784,13 +796,25 @@ Word16 IGF_getCrest( move16(); *crest_exp = 1; move16(); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS powSpec_exp = powerSpectrum_exp[0]; move16(); #endif FOR( i = start; i < stop; i++ ) { /*x = max(0, (int)(log(powerSpectrum[i]) * INV_LOG_2));*/ /*see IGF_getSFM for more comment */ #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS IF( GT_16( element_mode, EVS_MONO ) ) { powSpec_exp = powerSpectrum_exp[i]; /* exponent is a vector in IVAS (and a scalar in EVS) */ } x = sub( sub( powSpec_exp, norm_l( powerSpectrum[i] ) ), 1 ); /*Q0*/ #else x = sub( sub( powerSpectrum_exp, norm_l( powerSpectrum[i] ) ), 1 ); /*Q0*/ #endif if ( powerSpectrum[i] == 0 ) /*special case: energy is zero*/ { x = 0; Loading Loading @@ -840,7 +864,7 @@ Word16 IGF_getCrest( return crest; } #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS /* o: Q15| crest factor */ Word16 IGF_getCrest_ivas( Word16 *crest_exp, /* o : | exponent of crest factor */ Loading Loading @@ -922,6 +946,7 @@ Word16 IGF_getCrest_ivas( return crest; } #endif /************************************************************************* Loading Loading @@ -1208,7 +1233,11 @@ static void IGF_Whitening( { /*tmp = IGF_getSFM(powerSpectrum, hGrid->tile[p], hGrid->tile[p+1]) / IGF_getCrest(powerSpectrum, hGrid->tile[p], hGrid->tile[p+1]);*/ SFM = IGF_getSFM( &SFM_exp, powerSpectrum, &powerSpectrum_exp, hGrid->tile[p], hGrid->tile[p + 1] ); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS crest = IGF_getCrest( &crest_exp, powerSpectrum, &powerSpectrum_exp, hGrid->tile[p], hGrid->tile[p + 1], EVS_MONO ); #else crest = IGF_getCrest( &crest_exp, powerSpectrum, powerSpectrum_exp, hGrid->tile[p], hGrid->tile[p + 1] ); #endif tmp = BASOP_Util_Divide1616_Scale( SFM, crest, &s ); /* Q15 */ s = add( s, sub( SFM_exp, crest_exp ) ); Loading Loading @@ -3094,13 +3123,21 @@ static void IGF_CalculateStereoEnvelope_fx( // tmp_tb = IGF_getSFM_ivas(pPowerSpectrum, swb_offset[sfb], swb_offset[sfb + 1]) / IGF_getCrest_ivas(pPowerSpectrum, swb_offset[sfb], swb_offset[sfb + 1]); sfm = IGF_getSFM_ivas_fx( &sfm_exp, pPowerSpectrum_fx, pPowerSpectrum_e, swb_offset[sfb], swb_offset[sfb + 1] ); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS crest = IGF_getCrest( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, swb_offset[sfb], swb_offset[sfb + 1], IVAS_CPE_MDCT ); #else crest = IGF_getCrest_ivas( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, swb_offset[sfb], swb_offset[sfb + 1] ); #endif tmp_tb_fx = BASOP_Util_Divide1616_Scale( sfm, crest, &tmp_e ); tmp_tb_e = add( tmp_e, sub( sfm_exp, crest_exp ) ); /*stores the resultant exponent for tmp_tb_fx*/ // tmp_sb = IGF_getSFM_ivas(tileSrcSpec, 0, strt_cpy - tmp) / IGF_getCrest_ivas(tileSrcSpec, 0, strt_cpy - tmp); sfm = IGF_getSFM_ivas_fx( &sfm_exp, tileSrcSpec_fx, tileSrcSpec_e, 0, sub( strt_cpy, tmp ) ); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS crest = IGF_getCrest( &crest_exp, tileSrcSpec_fx, tileSrcSpec_e, 0, sub( strt_cpy, tmp ), IVAS_CPE_MDCT ); #else crest = IGF_getCrest_ivas( &crest_exp, tileSrcSpec_fx, tileSrcSpec_e, 0, sub( strt_cpy, tmp ) ); #endif tmp_sb_fx = BASOP_Util_Divide1616_Scale( sfm, crest, &tmp_e ); tmp_sb_e = add( tmp_e, sub( sfm_exp, crest_exp ) ); /*stores the resultant exponent for tmp_sb_fx*/ Loading Loading @@ -3245,7 +3282,11 @@ static void IGF_CalculateStereoEnvelope_fx( Word16 shift = shr( width, 1 ); // shiftedSFM = IGF_getSFM_ivas( pPowerSpectrum, swb_offset[sfb] - shift, swb_offset[sfb + 1] - shift ) / IGF_getCrest_ivas( pPowerSpectrum, swb_offset[sfb] - shift, swb_offset[sfb + 1] - shift ); sfm = IGF_getSFM_ivas_fx( &sfm_exp, pPowerSpectrum_fx, pPowerSpectrum_e, sub( swb_offset[sfb], shift ), sub( swb_offset[sfb + 1], shift ) ); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS crest = IGF_getCrest( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, sub( swb_offset[sfb], shift ), sub( swb_offset[sfb + 1], shift ), IVAS_CPE_MDCT ); #else crest = IGF_getCrest_ivas( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, sub( swb_offset[sfb], shift ), sub( swb_offset[sfb + 1], shift ) ); #endif shiftedSFM_fx = BASOP_Util_Divide1616_Scale( sfm, crest, &shiftedSFM_e ); } ELSE IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( slope_fx, add( slope_e, 16 ), threshold_fx, add( threshold_e, 16 ) ), 1 ) && ( NE_16( sfb, sub( hGrid->sfbWrap[hGrid->nTiles], 1 ) ) ) ) Loading @@ -3254,7 +3295,11 @@ static void IGF_CalculateStereoEnvelope_fx( shift = shr( width, 1 ); // shiftedSFM = IGF_getSFM_ivas( pPowerSpectrum, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift ) / IGF_getCrest_ivas( pPowerSpectrum, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift ); sfm = IGF_getSFM_ivas_fx( &sfm_exp, pPowerSpectrum_fx, pPowerSpectrum_e, add( swb_offset[sfb], shift ), add( swb_offset[sfb + 1], shift ) ); #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS crest = IGF_getCrest( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, add( swb_offset[sfb], shift ), add( swb_offset[sfb + 1], shift ), IVAS_CPE_MDCT ); #else crest = IGF_getCrest_ivas( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, add( swb_offset[sfb], shift ), add( swb_offset[sfb + 1], shift ) ); #endif shiftedSFM_fx = BASOP_Util_Divide1616_Scale( sfm, crest, &shiftedSFM_e ); } IF( shiftedSFM_fx ) Loading
lib_enc/prot_fx_enc.h +11 −1 Original line number Diff line number Diff line Loading @@ -2673,11 +2673,21 @@ void IGF_UpdateInfo( Word16 IGF_getCrest( Word16 *crest_exp, /**< out: | exponent of crest factor */ const Word32 *powerSpectrum, /**< in: Q31 | power spectrum */ #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS const Word16 *powerSpectrum_exp,/**< in: | exponent of power spectrum */ #else const Word16 powerSpectrum_exp, /**< in: | exponent of power spectrum */ #endif const Word16 start, /**< in: Q0 | start subband index */ #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS const Word16 stop, /**< in: Q0 | stop subband index */ const Word16 element_mode /**< in: | IVAS element mode type */ #else const Word16 stop /**< in: Q0 | stop subband index */ #endif ); #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS /* o: Q15| crest factor */ Word16 IGF_getCrest_ivas( Word16 *crest_exp, /* o : | exponent of crest factor */ Loading @@ -2686,7 +2696,7 @@ Word16 IGF_getCrest_ivas( const Word16 start, /* i : Q0 | start subband index */ const Word16 stop /* i : Q0 | stop subband index */ ); #endif /* o: Q15| SFM value */ Word16 IGF_getSFM( Word16 *SFM_exp, /* o : | exponent of SFM Factor */ Loading