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_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