Loading lib_dec/igf_dec_fx.c +30 −70 Original line number Diff line number Diff line Loading @@ -123,8 +123,8 @@ return noise; } static Word16 ivas_IGF_replaceTCXNoise_1_fx( /**< out: Q0 | number of noise bands */ const Word32 *in, /**< in: Q31 | MDCT spectrum */ Word16 s_l, /**< in: Q0 | noise headroom */ const Word32 *in, /**< in: in_exp | MDCT spectrum */ Word16 in_exp, /**< in: Q0 | noise headroom */ 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 */ Loading @@ -132,41 +132,44 @@ static Word16 ivas_IGF_replaceTCXNoise_1_fx( /**< out: Q Word16 *totalNoiseNrg_exp ) { Word16 sb; Word16 tmp16; Word16 tmp16, shift; Word16 noise; Word32 tmp32; Word64 nE; tmp16 = 0; shift = 2; move16(); noise = 0; move16(); s_l = sub( s_l, 5 ); nE = 0; move64(); *totalNoiseNrg = 0; move32(); *totalNoiseNrg_exp = 0; move16(); FOR( sb = start; sb < stop; sb++ ) { IF( TCXNoise[sb] ) { tmp16 = extract_h( L_shl( in[sb], s_l ) ); // Q31 + s_l } IF( TCXNoise[sb] ) { nE = W_mac_16_16( nE, tmp16, tmp16 ); // Q31 + s_l } IF( TCXNoise[sb] ) { noise = add( noise, 1 ); // Q0 tmp32 = L_shr( in[sb], shift ); nE = W_mac_32_32( nE, tmp32, tmp32 ); // 62 - (in_exp + shift + in_exp + shift + 1) noise = add( noise, 1 ); } } IF( nE ) { tmp16 = W_norm( nE ); nE = W_shl( nE, tmp16 ); *totalNoiseNrg = W_extract_h( nE ); move32(); *totalNoiseNrg_exp = sub( tmp16, 32 ); *totalNoiseNrg_exp = sub( add( shl( shift, 1 ), shl( in_exp, 1 ) ), tmp16 ); move16(); } return noise; } Loading Loading @@ -3533,14 +3536,8 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in specMed_e = igf_spec_e[i]; move16(); /*14 seems to be precise enough*/ hPrivateData->headroom_TCX_noise_white = IGF_getScaleFactor32Cond( hInstance->infoTCXNoise_ptr, igf_spec + hGrid->minSrcSubband, sub( hGrid->startLine, hGrid->minSrcSubband ) ); move16(); hPrivateData->n_noise_bands = ivas_IGF_replaceTCXNoise_1_fx( igf_spec, hPrivateData->headroom_TCX_noise_white, igf_spec_e[i], hInstance->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, Loading @@ -3548,9 +3545,6 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in &hPrivateData->totalNoiseNrg_exp ); move16(); hPrivateData->totalNoiseNrg_exp = sub( shl( sub( igf_spec_e[i], sub( hPrivateData->headroom_TCX_noise_white, 5 ) ), 1 ), hPrivateData->totalNoiseNrg_exp ); move16(); BREAK; } } Loading @@ -3560,22 +3554,15 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in { IF( EQ_16( hPrivateData->currWhiteningLevel[i], IGF_WHITENING_OFF ) ) { hPrivateData->headroom_TCX_noise = IGF_getScaleFactor32Cond( hInstance->infoTCXNoise_ptr, hPrivateData->pSpecFlat + hGrid->minSrcSubband, sub( hGrid->startLine, hGrid->minSrcSubband ) ); move16(); hPrivateData->n_noise_bands_off = ivas_IGF_replaceTCXNoise_1_fx( hPrivateData->pSpecFlat, hPrivateData->headroom_TCX_noise, hPrivateData->pSpecFlat_exp, hInstance->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateData->totalNoiseNrg_off, &hPrivateData->totalNoiseNrg_off_exp ); move16(); hPrivateData->totalNoiseNrg_off_exp = sub( shl( sub( hPrivateData->pSpecFlat_exp, sub( hPrivateData->headroom_TCX_noise, 5 ) ), 1 ), hPrivateData->totalNoiseNrg_off_exp ); move16(); BREAK; } } Loading Loading @@ -3760,12 +3747,9 @@ void IGFDecApplyStereo( move16(); } hPrivateDataL->headroom_TCX_noise_white = IGF_getScaleFactor32Cond( hIGFDecL->infoTCXNoise_ptr + hGrid->minSrcSubband, igf_specL_fx + hGrid->minSrcSubband, sub( hGrid->startLine, hGrid->minSrcSubband ) ); move16(); hPrivateDataL->n_noise_bands = ivas_IGF_replaceTCXNoise_1_fx( igf_specL_fx, hPrivateDataL->headroom_TCX_noise_white, specMedL_e, hIGFDecL->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, Loading @@ -3773,9 +3757,6 @@ void IGFDecApplyStereo( &hPrivateDataL->totalNoiseNrg_exp ); move16(); hPrivateDataL->totalNoiseNrg_exp = sub( shl( sub( specMedL_e, sub( hPrivateDataL->headroom_TCX_noise_white, 5 ) ), 1 ), hPrivateDataL->totalNoiseNrg_exp ); move16(); IF( !bfi ) { s_l = getScaleFactor32( hPrivateDataR->pSpecFlat + hGrid->minSrcSubband - whiteningLevel, Loading @@ -3796,21 +3777,14 @@ void IGFDecApplyStereo( move16(); } hPrivateDataR->headroom_TCX_noise_white = IGF_getScaleFactor32Cond( hIGFDecR->infoTCXNoise_ptr, igf_specR_fx + hGrid->minSrcSubband, sub( hGrid->startLine, hGrid->minSrcSubband ) ); move16(); hPrivateDataR->n_noise_bands = ivas_IGF_replaceTCXNoise_1_fx( igf_specR_fx, hPrivateDataR->headroom_TCX_noise_white, specMedR_e, hIGFDecR->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataR->totalNoiseNrg, &hPrivateDataR->totalNoiseNrg_exp ); move16(); hPrivateDataR->totalNoiseNrg_exp = sub( shl( sub( specMedR_e, sub( hPrivateDataR->headroom_TCX_noise_white, 5 ) ), 1 ), hPrivateDataR->totalNoiseNrg_exp ); move16(); BREAK; } } Loading @@ -3820,37 +3794,23 @@ void IGFDecApplyStereo( test(); IF( EQ_16( hPrivateDataL->currWhiteningLevel[i], IGF_WHITENING_OFF ) || EQ_16( hPrivateDataR->currWhiteningLevel[i], IGF_WHITENING_OFF ) ) { hPrivateDataL->headroom_TCX_noise_white = IGF_getScaleFactor32Cond( hIGFDecL->infoTCXNoise_ptr + hGrid->minSrcSubband, hPrivateDataL->pSpecFlat + hGrid->minSrcSubband, sub( hGrid->startLine, hGrid->minSrcSubband ) ); hPrivateDataL->n_noise_bands_off = ivas_IGF_replaceTCXNoise_1_fx( hPrivateDataL->pSpecFlat, hPrivateDataL->headroom_TCX_noise_white, hPrivateDataL->pSpecFlat_exp, hIGFDecL->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataL->totalNoiseNrg_off, &hPrivateDataL->totalNoiseNrg_off_exp ); hPrivateDataL->totalNoiseNrg_off_exp = sub( shl( sub( hPrivateDataL->pSpecFlat_exp, sub( hPrivateDataL->headroom_TCX_noise_white, 5 ) ), 1 ), hPrivateDataL->totalNoiseNrg_off_exp ); move16(); move16(); move16(); hPrivateDataR->headroom_TCX_noise_white = IGF_getScaleFactor32Cond( hIGFDecR->infoTCXNoise_ptr, hPrivateDataR->pSpecFlat + hGrid->minSrcSubband, sub( hGrid->startLine, hGrid->minSrcSubband ) ); hPrivateDataR->n_noise_bands_off = ivas_IGF_replaceTCXNoise_1_fx( hPrivateDataR->pSpecFlat, hPrivateDataR->headroom_TCX_noise_white, hPrivateDataR->pSpecFlat_exp, hIGFDecR->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataR->totalNoiseNrg_off, &hPrivateDataR->totalNoiseNrg_off_exp ); hPrivateDataR->totalNoiseNrg_off_exp = sub( shl( sub( hPrivateDataR->pSpecFlat_exp, sub( hPrivateDataR->headroom_TCX_noise_white, 5 ) ), 1 ), hPrivateDataR->totalNoiseNrg_off_exp ); move16(); move16(); move16(); BREAK; } } Loading lib_enc/ivas_masa_enc_fx.c +36 −20 Original line number Diff line number Diff line Loading @@ -2297,7 +2297,9 @@ static void reduce_metadata_further_fx( UWord8 computeCoherence; Word32 onset_filter; Word16 onset_filter_e, exp; Word32 bandEnergy; Word64 bandEnergy; Word32 bandEnergy32; Word16 bandEnergy_exp, shift; UWord8 mergeOverFreqBands; Word32 meanRatio; Word16 tmp, tmp2; Loading Loading @@ -2437,13 +2439,16 @@ static void reduce_metadata_further_fx( move32(); bandEnergy = 0; move32(); move64(); FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { bandEnergy = L_add( bandEnergy, energy[sf][band] ); bandEnergy = W_mac_32_32( bandEnergy, energy[sf][band], 1 ); } shift = W_norm( bandEnergy ); bandEnergy32 = W_extract_h( W_shl( bandEnergy, shift ) ); bandEnergy_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) ); IF( BASOP_Util_Cmp_Mant32Exp( Mpy_32_32( L_shr( bandEnergy, 2 ), bandRatio ), sub( 31 + 1, hMasa->data.q_energy ), threshold, exp ) > 0 ) IF( BASOP_Util_Cmp_Mant32Exp( Mpy_32_32( L_shr( bandEnergy32, 2 ), bandRatio ), add( 1, bandEnergy_exp ), threshold, exp ) > 0 ) { selectedBand = band; move16(); Loading Loading @@ -4640,7 +4645,9 @@ static void ivas_encode_masaism_metadata_fx( UWord8 numCodingBands; UWord8 numSf; Word16 brange[2]; Word32 eneBand; Word64 eneBand; Word32 eneBand32; Word16 eneBand_exp, shift; Word16 bin; Word16 obj; Word16 bits_ism[MAX_NUM_OBJECTS]; Loading Loading @@ -4689,11 +4696,14 @@ static void ivas_encode_masaism_metadata_fx( eneBand = 0; move16(); move16(); move32(); move64(); FOR( bin = brange[0]; bin < brange[1]; bin++ ) { eneBand = L_add( eneBand, hMasa->data.energy_fx[sf][bin] ); // hMasa->data.q_energy eneBand = W_mac_32_32( eneBand, hMasa->data.energy_fx[sf][bin], 1 ); // hMasa->data.q_energy + 1 } shift = W_norm( eneBand ); eneBand32 = W_extract_h( W_shl( eneBand, shift ) ); eneBand_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) ); energy_ism = 0; energy_ism_e = 0; Loading Loading @@ -4727,12 +4737,12 @@ static void ivas_encode_masaism_metadata_fx( hOmasaData->energy_ratio_ism_fx[sf][0][obj] = L_shl( hOmasaData->energy_ratio_ism_fx[sf][0][obj], sub( L_tmp_e, 1 ) ); // Q30 move32(); } L_tmp = BASOP_Util_Add_Mant32Exp( eneBand, sub( 31, hMasa->data.q_energy ), energy_ism, energy_ism_e, &L_tmp_e ); L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, energy_ism, energy_ism_e, &L_tmp_e ); IF( L_tmp != 0 ) { hOmasaData->masa_to_total_energy_ratio_fx[sf][0] = BASOP_Util_Divide3232_Scale_cadence( eneBand, L_tmp, &tmp ); hOmasaData->masa_to_total_energy_ratio_fx[sf][0] = BASOP_Util_Divide3232_Scale_cadence( eneBand32, L_tmp, &tmp ); move32(); tmp = add( tmp, sub( sub( 31, hMasa->data.q_energy ), L_tmp_e ) ); tmp = add( tmp, sub( eneBand_exp, L_tmp_e ) ); /* Scaling to Q30 */ hOmasaData->masa_to_total_energy_ratio_fx[sf][0] = L_shl( hOmasaData->masa_to_total_energy_ratio_fx[sf][0], sub( tmp, 1 ) ); // Q30 move32(); Loading Loading @@ -4794,21 +4804,24 @@ static void ivas_encode_masaism_metadata_fx( move16(); eneBand = 0; move32(); move64(); FOR( sf = 0; sf < omasa_nblocks; sf++ ) { FOR( bin = brange[0]; bin < brange[1]; bin++ ) { eneBand = L_add( eneBand, hMasa->data.energy_fx[sf][bin] ); // hMasa->data.q_energy eneBand = W_mac_32_32( eneBand, hMasa->data.energy_fx[sf][bin], 1 ); // hMasa->data.q_energy + 1 } } shift = W_norm( eneBand ); eneBand32 = W_extract_h( W_shl( eneBand, shift ) ); eneBand_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) ); L_tmp = BASOP_Util_Add_Mant32Exp( eneBand, sub( 31, hMasa->data.q_energy ), energy_ism, energy_ism_e, &L_tmp_e ); L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, energy_ism, energy_ism_e, &L_tmp_e ); IF( L_tmp != 0 ) { hOmasaData->masa_to_total_energy_ratio_fx[0][band] = BASOP_Util_Divide3232_Scale_cadence( eneBand, L_tmp, &tmp ); hOmasaData->masa_to_total_energy_ratio_fx[0][band] = BASOP_Util_Divide3232_Scale_cadence( eneBand32, L_tmp, &tmp ); move32(); tmp = add( tmp, sub( sub( 31, hMasa->data.q_energy ), L_tmp_e ) ); tmp = add( tmp, sub( eneBand_exp, L_tmp_e ) ); /* Scaling to Q30 */ hOmasaData->masa_to_total_energy_ratio_fx[0][band] = L_shl( hOmasaData->masa_to_total_energy_ratio_fx[0][band], sub( tmp, 1 ) ); // Q30 move32(); Loading Loading @@ -4851,18 +4864,21 @@ static void ivas_encode_masaism_metadata_fx( move16(); eneBand = 0; move32(); move64(); FOR( bin = brange[0]; bin < brange[1]; bin++ ) { eneBand = L_add( eneBand, hMasa->data.energy_fx[sf][bin] ); // hMasa->data.q_energy eneBand = W_mac_32_32( eneBand, hMasa->data.energy_fx[sf][bin], 1 ); // hMasa->data.q_energy + 1 } shift = W_norm( eneBand ); eneBand32 = W_extract_h( W_shl( eneBand, shift ) ); eneBand_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) ); L_tmp = BASOP_Util_Add_Mant32Exp( eneBand, sub( 31, hMasa->data.q_energy ), hOmasaData->energy_ism_fx[sf][band], hOmasaData->energy_ism_fx_e[sf][band], &L_tmp_e ); L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, hOmasaData->energy_ism_fx[sf][band], hOmasaData->energy_ism_fx_e[sf][band], &L_tmp_e ); IF( L_tmp != 0 ) { hOmasaData->masa_to_total_energy_ratio_fx[sf][band] = BASOP_Util_Divide3232_Scale_cadence( eneBand, L_tmp, &tmp ); hOmasaData->masa_to_total_energy_ratio_fx[sf][band] = BASOP_Util_Divide3232_Scale_cadence( eneBand32, L_tmp, &tmp ); move32(); tmp = add( tmp, sub( sub( 31, hMasa->data.q_energy ), L_tmp_e ) ); tmp = add( tmp, sub( eneBand_exp, L_tmp_e ) ); /* Scaling to Q30 */ hOmasaData->masa_to_total_energy_ratio_fx[sf][band] = L_shl( hOmasaData->masa_to_total_energy_ratio_fx[sf][band], sub( tmp, 1 ) ); // Q30 move32(); Loading Loading
lib_dec/igf_dec_fx.c +30 −70 Original line number Diff line number Diff line Loading @@ -123,8 +123,8 @@ return noise; } static Word16 ivas_IGF_replaceTCXNoise_1_fx( /**< out: Q0 | number of noise bands */ const Word32 *in, /**< in: Q31 | MDCT spectrum */ Word16 s_l, /**< in: Q0 | noise headroom */ const Word32 *in, /**< in: in_exp | MDCT spectrum */ Word16 in_exp, /**< in: Q0 | noise headroom */ 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 */ Loading @@ -132,41 +132,44 @@ static Word16 ivas_IGF_replaceTCXNoise_1_fx( /**< out: Q Word16 *totalNoiseNrg_exp ) { Word16 sb; Word16 tmp16; Word16 tmp16, shift; Word16 noise; Word32 tmp32; Word64 nE; tmp16 = 0; shift = 2; move16(); noise = 0; move16(); s_l = sub( s_l, 5 ); nE = 0; move64(); *totalNoiseNrg = 0; move32(); *totalNoiseNrg_exp = 0; move16(); FOR( sb = start; sb < stop; sb++ ) { IF( TCXNoise[sb] ) { tmp16 = extract_h( L_shl( in[sb], s_l ) ); // Q31 + s_l } IF( TCXNoise[sb] ) { nE = W_mac_16_16( nE, tmp16, tmp16 ); // Q31 + s_l } IF( TCXNoise[sb] ) { noise = add( noise, 1 ); // Q0 tmp32 = L_shr( in[sb], shift ); nE = W_mac_32_32( nE, tmp32, tmp32 ); // 62 - (in_exp + shift + in_exp + shift + 1) noise = add( noise, 1 ); } } IF( nE ) { tmp16 = W_norm( nE ); nE = W_shl( nE, tmp16 ); *totalNoiseNrg = W_extract_h( nE ); move32(); *totalNoiseNrg_exp = sub( tmp16, 32 ); *totalNoiseNrg_exp = sub( add( shl( shift, 1 ), shl( in_exp, 1 ) ), tmp16 ); move16(); } return noise; } Loading Loading @@ -3533,14 +3536,8 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in specMed_e = igf_spec_e[i]; move16(); /*14 seems to be precise enough*/ hPrivateData->headroom_TCX_noise_white = IGF_getScaleFactor32Cond( hInstance->infoTCXNoise_ptr, igf_spec + hGrid->minSrcSubband, sub( hGrid->startLine, hGrid->minSrcSubband ) ); move16(); hPrivateData->n_noise_bands = ivas_IGF_replaceTCXNoise_1_fx( igf_spec, hPrivateData->headroom_TCX_noise_white, igf_spec_e[i], hInstance->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, Loading @@ -3548,9 +3545,6 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in &hPrivateData->totalNoiseNrg_exp ); move16(); hPrivateData->totalNoiseNrg_exp = sub( shl( sub( igf_spec_e[i], sub( hPrivateData->headroom_TCX_noise_white, 5 ) ), 1 ), hPrivateData->totalNoiseNrg_exp ); move16(); BREAK; } } Loading @@ -3560,22 +3554,15 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in { IF( EQ_16( hPrivateData->currWhiteningLevel[i], IGF_WHITENING_OFF ) ) { hPrivateData->headroom_TCX_noise = IGF_getScaleFactor32Cond( hInstance->infoTCXNoise_ptr, hPrivateData->pSpecFlat + hGrid->minSrcSubband, sub( hGrid->startLine, hGrid->minSrcSubband ) ); move16(); hPrivateData->n_noise_bands_off = ivas_IGF_replaceTCXNoise_1_fx( hPrivateData->pSpecFlat, hPrivateData->headroom_TCX_noise, hPrivateData->pSpecFlat_exp, hInstance->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateData->totalNoiseNrg_off, &hPrivateData->totalNoiseNrg_off_exp ); move16(); hPrivateData->totalNoiseNrg_off_exp = sub( shl( sub( hPrivateData->pSpecFlat_exp, sub( hPrivateData->headroom_TCX_noise, 5 ) ), 1 ), hPrivateData->totalNoiseNrg_off_exp ); move16(); BREAK; } } Loading Loading @@ -3760,12 +3747,9 @@ void IGFDecApplyStereo( move16(); } hPrivateDataL->headroom_TCX_noise_white = IGF_getScaleFactor32Cond( hIGFDecL->infoTCXNoise_ptr + hGrid->minSrcSubband, igf_specL_fx + hGrid->minSrcSubband, sub( hGrid->startLine, hGrid->minSrcSubband ) ); move16(); hPrivateDataL->n_noise_bands = ivas_IGF_replaceTCXNoise_1_fx( igf_specL_fx, hPrivateDataL->headroom_TCX_noise_white, specMedL_e, hIGFDecL->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, Loading @@ -3773,9 +3757,6 @@ void IGFDecApplyStereo( &hPrivateDataL->totalNoiseNrg_exp ); move16(); hPrivateDataL->totalNoiseNrg_exp = sub( shl( sub( specMedL_e, sub( hPrivateDataL->headroom_TCX_noise_white, 5 ) ), 1 ), hPrivateDataL->totalNoiseNrg_exp ); move16(); IF( !bfi ) { s_l = getScaleFactor32( hPrivateDataR->pSpecFlat + hGrid->minSrcSubband - whiteningLevel, Loading @@ -3796,21 +3777,14 @@ void IGFDecApplyStereo( move16(); } hPrivateDataR->headroom_TCX_noise_white = IGF_getScaleFactor32Cond( hIGFDecR->infoTCXNoise_ptr, igf_specR_fx + hGrid->minSrcSubband, sub( hGrid->startLine, hGrid->minSrcSubband ) ); move16(); hPrivateDataR->n_noise_bands = ivas_IGF_replaceTCXNoise_1_fx( igf_specR_fx, hPrivateDataR->headroom_TCX_noise_white, specMedR_e, hIGFDecR->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataR->totalNoiseNrg, &hPrivateDataR->totalNoiseNrg_exp ); move16(); hPrivateDataR->totalNoiseNrg_exp = sub( shl( sub( specMedR_e, sub( hPrivateDataR->headroom_TCX_noise_white, 5 ) ), 1 ), hPrivateDataR->totalNoiseNrg_exp ); move16(); BREAK; } } Loading @@ -3820,37 +3794,23 @@ void IGFDecApplyStereo( test(); IF( EQ_16( hPrivateDataL->currWhiteningLevel[i], IGF_WHITENING_OFF ) || EQ_16( hPrivateDataR->currWhiteningLevel[i], IGF_WHITENING_OFF ) ) { hPrivateDataL->headroom_TCX_noise_white = IGF_getScaleFactor32Cond( hIGFDecL->infoTCXNoise_ptr + hGrid->minSrcSubband, hPrivateDataL->pSpecFlat + hGrid->minSrcSubband, sub( hGrid->startLine, hGrid->minSrcSubband ) ); hPrivateDataL->n_noise_bands_off = ivas_IGF_replaceTCXNoise_1_fx( hPrivateDataL->pSpecFlat, hPrivateDataL->headroom_TCX_noise_white, hPrivateDataL->pSpecFlat_exp, hIGFDecL->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataL->totalNoiseNrg_off, &hPrivateDataL->totalNoiseNrg_off_exp ); hPrivateDataL->totalNoiseNrg_off_exp = sub( shl( sub( hPrivateDataL->pSpecFlat_exp, sub( hPrivateDataL->headroom_TCX_noise_white, 5 ) ), 1 ), hPrivateDataL->totalNoiseNrg_off_exp ); move16(); move16(); move16(); hPrivateDataR->headroom_TCX_noise_white = IGF_getScaleFactor32Cond( hIGFDecR->infoTCXNoise_ptr, hPrivateDataR->pSpecFlat + hGrid->minSrcSubband, sub( hGrid->startLine, hGrid->minSrcSubband ) ); hPrivateDataR->n_noise_bands_off = ivas_IGF_replaceTCXNoise_1_fx( hPrivateDataR->pSpecFlat, hPrivateDataR->headroom_TCX_noise_white, hPrivateDataR->pSpecFlat_exp, hIGFDecR->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataR->totalNoiseNrg_off, &hPrivateDataR->totalNoiseNrg_off_exp ); hPrivateDataR->totalNoiseNrg_off_exp = sub( shl( sub( hPrivateDataR->pSpecFlat_exp, sub( hPrivateDataR->headroom_TCX_noise_white, 5 ) ), 1 ), hPrivateDataR->totalNoiseNrg_off_exp ); move16(); move16(); move16(); BREAK; } } Loading
lib_enc/ivas_masa_enc_fx.c +36 −20 Original line number Diff line number Diff line Loading @@ -2297,7 +2297,9 @@ static void reduce_metadata_further_fx( UWord8 computeCoherence; Word32 onset_filter; Word16 onset_filter_e, exp; Word32 bandEnergy; Word64 bandEnergy; Word32 bandEnergy32; Word16 bandEnergy_exp, shift; UWord8 mergeOverFreqBands; Word32 meanRatio; Word16 tmp, tmp2; Loading Loading @@ -2437,13 +2439,16 @@ static void reduce_metadata_further_fx( move32(); bandEnergy = 0; move32(); move64(); FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { bandEnergy = L_add( bandEnergy, energy[sf][band] ); bandEnergy = W_mac_32_32( bandEnergy, energy[sf][band], 1 ); } shift = W_norm( bandEnergy ); bandEnergy32 = W_extract_h( W_shl( bandEnergy, shift ) ); bandEnergy_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) ); IF( BASOP_Util_Cmp_Mant32Exp( Mpy_32_32( L_shr( bandEnergy, 2 ), bandRatio ), sub( 31 + 1, hMasa->data.q_energy ), threshold, exp ) > 0 ) IF( BASOP_Util_Cmp_Mant32Exp( Mpy_32_32( L_shr( bandEnergy32, 2 ), bandRatio ), add( 1, bandEnergy_exp ), threshold, exp ) > 0 ) { selectedBand = band; move16(); Loading Loading @@ -4640,7 +4645,9 @@ static void ivas_encode_masaism_metadata_fx( UWord8 numCodingBands; UWord8 numSf; Word16 brange[2]; Word32 eneBand; Word64 eneBand; Word32 eneBand32; Word16 eneBand_exp, shift; Word16 bin; Word16 obj; Word16 bits_ism[MAX_NUM_OBJECTS]; Loading Loading @@ -4689,11 +4696,14 @@ static void ivas_encode_masaism_metadata_fx( eneBand = 0; move16(); move16(); move32(); move64(); FOR( bin = brange[0]; bin < brange[1]; bin++ ) { eneBand = L_add( eneBand, hMasa->data.energy_fx[sf][bin] ); // hMasa->data.q_energy eneBand = W_mac_32_32( eneBand, hMasa->data.energy_fx[sf][bin], 1 ); // hMasa->data.q_energy + 1 } shift = W_norm( eneBand ); eneBand32 = W_extract_h( W_shl( eneBand, shift ) ); eneBand_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) ); energy_ism = 0; energy_ism_e = 0; Loading Loading @@ -4727,12 +4737,12 @@ static void ivas_encode_masaism_metadata_fx( hOmasaData->energy_ratio_ism_fx[sf][0][obj] = L_shl( hOmasaData->energy_ratio_ism_fx[sf][0][obj], sub( L_tmp_e, 1 ) ); // Q30 move32(); } L_tmp = BASOP_Util_Add_Mant32Exp( eneBand, sub( 31, hMasa->data.q_energy ), energy_ism, energy_ism_e, &L_tmp_e ); L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, energy_ism, energy_ism_e, &L_tmp_e ); IF( L_tmp != 0 ) { hOmasaData->masa_to_total_energy_ratio_fx[sf][0] = BASOP_Util_Divide3232_Scale_cadence( eneBand, L_tmp, &tmp ); hOmasaData->masa_to_total_energy_ratio_fx[sf][0] = BASOP_Util_Divide3232_Scale_cadence( eneBand32, L_tmp, &tmp ); move32(); tmp = add( tmp, sub( sub( 31, hMasa->data.q_energy ), L_tmp_e ) ); tmp = add( tmp, sub( eneBand_exp, L_tmp_e ) ); /* Scaling to Q30 */ hOmasaData->masa_to_total_energy_ratio_fx[sf][0] = L_shl( hOmasaData->masa_to_total_energy_ratio_fx[sf][0], sub( tmp, 1 ) ); // Q30 move32(); Loading Loading @@ -4794,21 +4804,24 @@ static void ivas_encode_masaism_metadata_fx( move16(); eneBand = 0; move32(); move64(); FOR( sf = 0; sf < omasa_nblocks; sf++ ) { FOR( bin = brange[0]; bin < brange[1]; bin++ ) { eneBand = L_add( eneBand, hMasa->data.energy_fx[sf][bin] ); // hMasa->data.q_energy eneBand = W_mac_32_32( eneBand, hMasa->data.energy_fx[sf][bin], 1 ); // hMasa->data.q_energy + 1 } } shift = W_norm( eneBand ); eneBand32 = W_extract_h( W_shl( eneBand, shift ) ); eneBand_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) ); L_tmp = BASOP_Util_Add_Mant32Exp( eneBand, sub( 31, hMasa->data.q_energy ), energy_ism, energy_ism_e, &L_tmp_e ); L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, energy_ism, energy_ism_e, &L_tmp_e ); IF( L_tmp != 0 ) { hOmasaData->masa_to_total_energy_ratio_fx[0][band] = BASOP_Util_Divide3232_Scale_cadence( eneBand, L_tmp, &tmp ); hOmasaData->masa_to_total_energy_ratio_fx[0][band] = BASOP_Util_Divide3232_Scale_cadence( eneBand32, L_tmp, &tmp ); move32(); tmp = add( tmp, sub( sub( 31, hMasa->data.q_energy ), L_tmp_e ) ); tmp = add( tmp, sub( eneBand_exp, L_tmp_e ) ); /* Scaling to Q30 */ hOmasaData->masa_to_total_energy_ratio_fx[0][band] = L_shl( hOmasaData->masa_to_total_energy_ratio_fx[0][band], sub( tmp, 1 ) ); // Q30 move32(); Loading Loading @@ -4851,18 +4864,21 @@ static void ivas_encode_masaism_metadata_fx( move16(); eneBand = 0; move32(); move64(); FOR( bin = brange[0]; bin < brange[1]; bin++ ) { eneBand = L_add( eneBand, hMasa->data.energy_fx[sf][bin] ); // hMasa->data.q_energy eneBand = W_mac_32_32( eneBand, hMasa->data.energy_fx[sf][bin], 1 ); // hMasa->data.q_energy + 1 } shift = W_norm( eneBand ); eneBand32 = W_extract_h( W_shl( eneBand, shift ) ); eneBand_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) ); L_tmp = BASOP_Util_Add_Mant32Exp( eneBand, sub( 31, hMasa->data.q_energy ), hOmasaData->energy_ism_fx[sf][band], hOmasaData->energy_ism_fx_e[sf][band], &L_tmp_e ); L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, hOmasaData->energy_ism_fx[sf][band], hOmasaData->energy_ism_fx_e[sf][band], &L_tmp_e ); IF( L_tmp != 0 ) { hOmasaData->masa_to_total_energy_ratio_fx[sf][band] = BASOP_Util_Divide3232_Scale_cadence( eneBand, L_tmp, &tmp ); hOmasaData->masa_to_total_energy_ratio_fx[sf][band] = BASOP_Util_Divide3232_Scale_cadence( eneBand32, L_tmp, &tmp ); move32(); tmp = add( tmp, sub( sub( 31, hMasa->data.q_energy ), L_tmp_e ) ); tmp = add( tmp, sub( eneBand_exp, L_tmp_e ) ); /* Scaling to Q30 */ hOmasaData->masa_to_total_energy_ratio_fx[sf][band] = L_shl( hOmasaData->masa_to_total_energy_ratio_fx[sf][band], sub( tmp, 1 ) ); // Q30 move32(); Loading