diff --git a/apps/encoder.c b/apps/encoder.c index ec69fd443dd5a3e8026ee90b87ec1fa018b2ffa9..dfd3da593b6a265c932d4316e5cfc9dcc36e91fc 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -384,13 +384,11 @@ int main( goto cleanup; } -#ifdef SUPPORT_FORCE_TCX10_TCX20 #ifdef DEBUGGING if ( arg.forcedMode == IVAS_ENC_FORCE_TCX10 && totalBitrate < 48000 ) { fprintf( stderr, "Warning: Enforcing the TCX10 mode is only supported for bitrates higher or equal than 48 kbps!\n\n" ); } -#endif #endif /*------------------------------------------------------------------------------------------* @@ -1111,7 +1109,6 @@ static bool parseCmdlIVAS_enc( } else { -#ifdef SUPPORT_FORCE_TCX10_TCX20 if ( arg->forcedMode == IVAS_ENC_FORCE_TCX10 ) { strcpy( stmp, "TCX10" ); @@ -1126,9 +1123,6 @@ static bool parseCmdlIVAS_enc( } fprintf( stdout, "Forcing codec to: %s\n", stmp ); -#else - fprintf( stdout, "Forcing codec to: %s\n", argv[i + 1] ); -#endif } #endif @@ -2114,24 +2108,14 @@ static IVAS_ENC_FORCED_MODE parseForcedMode( { return IVAS_ENC_FORCE_GSC; } - if ( ( strcmp( forcedModeChar, "TCX" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX'" ) == 0 ) -#ifdef SUPPORT_FORCE_TCX10_TCX20 - || ( strcmp( forcedModeChar, "TCX20" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX20'" ) == 0 ) -#endif - ) + if ( ( strcmp( forcedModeChar, "TCX" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX'" ) == 0 ) || ( strcmp( forcedModeChar, "TCX20" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX20'" ) == 0 ) ) { -#ifdef SUPPORT_FORCE_TCX10_TCX20 return IVAS_ENC_FORCE_TCX20; -#else - return IVAS_ENC_FORCE_TCX; -#endif } -#ifdef SUPPORT_FORCE_TCX10_TCX20 if ( ( strcmp( forcedModeChar, "TCX10" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX10'" ) == 0 ) ) { return IVAS_ENC_FORCE_TCX10; } -#endif else if ( ( strcmp( forcedModeChar, "HQ" ) == 0 ) || ( strcmp( forcedModeChar, "'HQ'" ) == 0 ) ) { return IVAS_ENC_FORCE_HQ; @@ -2174,24 +2158,14 @@ static IVAS_ENC_FORCED_MODE parseForcedMode( { return IVAS_ENC_FORCE_GSC; } - if ( ( strcmp( forcedModeChar, "TCX" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX'" ) == 0 ) -#ifdef SUPPORT_FORCE_TCX10_TCX20 - || ( strcmp( forcedModeChar, "TCX20" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX20'" ) == 0 ) -#endif - ) + if ( ( strcmp( forcedModeChar, "TCX" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX'" ) == 0 ) || ( strcmp( forcedModeChar, "TCX20" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX20'" ) == 0 ) ) { -#ifdef SUPPORT_FORCE_TCX10_TCX20 return IVAS_ENC_FORCE_TCX20; -#else - return IVAS_ENC_FORCE_TCX; -#endif } -#ifdef SUPPORT_FORCE_TCX10_TCX20 if ( ( strcmp( forcedModeChar, "TCX10" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX10'" ) == 0 ) ) { return IVAS_ENC_FORCE_TCX10; } -#endif if ( ( strcmp( forcedModeChar, "HQ" ) == 0 ) || ( strcmp( forcedModeChar, "'HQ'" ) == 0 ) ) { return IVAS_ENC_FORCE_HQ; diff --git a/lib_com/arith_coder.c b/lib_com/arith_coder.c index e71a40749e81ffff546e77fe4159e8e0969a3401..c0db15127ac8dccad79f13d7120b2ab3dfec8a8c 100644 --- a/lib_com/arith_coder.c +++ b/lib_com/arith_coder.c @@ -243,10 +243,7 @@ void tcx_arith_scale_envelope( Word16 statesi, bits; Word32 mean, a, s, L_tmp; Word16 mean_e, tmp, tmp2; -#ifdef BASOP_NOGLOB Flag Overflow; -#endif /* BASOP_NOGLOB */ - lob_bits = 0; move16(); @@ -271,11 +268,7 @@ void tcx_arith_scale_envelope( tmp = norm_l( env[k] ); tmp2 = sub( 15, tmp ); -#ifndef BASOP_NOGLOB - tmp = Inv16( round_fx( L_shl( env[k], tmp ) ), &tmp2 ); -#else /* BASOP_NOGLOB */ tmp = Inv16( round_fx_o( L_shl( env[k], tmp ), &Overflow ), &tmp2 ); -#endif /* BASOP_NOGLOB */ ienv[k] = L_shl( L_deposit_h( tmp ), sub( tmp2, 15 ) ); /* Q16 */ move32(); mean = L_add( mean, ienv[k] ); @@ -309,11 +302,7 @@ void tcx_arith_scale_envelope( b_e = add( b_e, mean_e ); /* scale = (-b + sqrtf(b*b - 4.0f*a*0.035f)) / (2.0f * a); */ -#ifndef BASOP_NOGLOB - tmp = round_fx( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16( a, FL2WORD16( -4.0f * 0.035f ) ), a_e, &tmp2 ) ); -#else tmp = round_fx_o( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16( a, FL2WORD16( -4.0f * 0.035f ) ), a_e, &tmp2 ), &Overflow ); -#endif IF( tmp <= 0 ) { @@ -332,11 +321,7 @@ void tcx_arith_scale_envelope( tmp2 = BASOP_Util_Add_MantExp( negate( b ), b_e, tmp, tmp2, &scale ); scale = BASOP_Util_Divide1616_Scale( scale, round_fx( a ), &tmp ); -#ifndef BASOP_NOGLOB - scale = shl( scale, sub( sub( add( tmp, tmp2 ), a_e ), 1 ) ); /* Q15 */ -#else scale = shl_o( scale, sub( sub( add( tmp, tmp2 ), a_e ), 1 ), &Overflow ); /* Q15 */ -#endif /* iscale = 1.0f / scale; */ iscale_e = 0; @@ -385,11 +370,7 @@ void tcx_arith_scale_envelope( L_tmp = L_add( L_tmp, L_shl( Mpy_32_16( env[k], mult_r( FL2WORD16( 0.035f ), iscale ) ), iscale_e ) ); tmp = norm_l( L_tmp ); -#ifndef BASOP_NOGLOB - statesi = mult_r( statesi, round_fx( L_shl( L_tmp, tmp ) ) ); -#else /* BASOP_NOGLOB */ statesi = mult_r( statesi, round_fx_o( L_shl( L_tmp, tmp ), &Overflow ) ); -#endif /* BASOP_NOGLOB */ bits = add( bits, sub( 15, tmp ) ); tmp = norm_s( statesi ); @@ -489,11 +470,7 @@ void tcx_arith_scale_envelope( *s_env_e = sub( add( 15, iscale_e ), tmp ); move16(); BASOP_SATURATE_WARNING_OFF; -#ifndef BASOP_NOGLOB - a = L_shl( 1265000, sub( 15, *s_env_e ) ); -#else /* BASOP_NOGLOB */ a = L_shl_o( 1265000, sub( 15, *s_env_e ), &Overflow ); -#endif /* BASOP_NOGLOB */ BASOP_SATURATE_WARNING_ON; FOR( k = 0; k < L_frame; k++ ) diff --git a/lib_com/basop32.c b/lib_com/basop32.c index 5a5a434846333bbcc752cf8e1e0dbcfa5ab08241..0a3bbb3a8ad8436d8454ab14bcfe9ee8b984573b 100644 --- a/lib_com/basop32.c +++ b/lib_com/basop32.c @@ -160,9 +160,7 @@ HISTORY: #include #include #include "stl.h" -#ifdef BASOP_NOGLOB #include -#endif /* BASOP_NOGLOB */ #define WMC_TOOL_SKIP @@ -175,9 +173,7 @@ HISTORY: | Local Functions | |___________________________________________________________________________| */ -#ifdef BASOP_NOGLOB static Word16 saturate_o( Word32 L_var1, Flag *Overflow ); -#endif /* BASOP_NOGLOB */ static Word16 saturate( Word32 L_var1 ); @@ -186,16 +182,10 @@ static Word16 saturate( Word32 L_var1 ); | Constants and Globals | |___________________________________________________________________________| */ -#ifndef BASOP_NOGLOB -Flag Overflow = 0; -Flag Carry = 0; - -#else /* BASOP_NOGLOB */ /* Flag BASOP_Overflow = 0; Flag BASOP_Carry = 0; */ -#endif /* BASOP_NOGLOB */ /*___________________________________________________________________________ | | @@ -232,30 +222,18 @@ Flag BASOP_Carry = 0; | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |___________________________________________________________________________| */ -#ifndef BASOP_NOGLOB -static Word16 saturate( Word32 L_var1 ) -#else /* BASOP_NOGLOB */ static Word16 saturate_o( Word32 L_var1, Flag *Overflow ) -#endif /* BASOP_NOGLOB */ { Word16 var_out; if ( L_var1 > 0X00007fffL ) { -#ifndef BASOP_NOGLOB - Overflow = 1; -#else /* BASOP_NOGLOB */ *Overflow = 1; -#endif /* BASOP_NOGLOB */ var_out = MAX_16; } else if ( L_var1 < (Word32) 0xffff8000L ) { -#ifndef BASOP_NOGLOB - Overflow = 1; -#else /* BASOP_NOGLOB */ *Overflow = 1; -#endif /* BASOP_NOGLOB */ var_out = MIN_16; } else @@ -271,7 +249,6 @@ static Word16 saturate_o( Word32 L_var1, Flag *Overflow ) return ( var_out ); } -#ifdef BASOP_NOGLOB static Word16 saturate( Word32 L_var1 ) { Word16 var_out; @@ -298,7 +275,6 @@ static Word16 saturate( Word32 L_var1 ) return ( var_out ); } -#endif /* BASOP_NOGLOB */ /*___________________________________________________________________________ | | @@ -333,7 +309,6 @@ static Word16 saturate( Word32 L_var1 ) | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |___________________________________________________________________________| */ -#ifdef BASOP_NOGLOB Word16 add_o( Word16 var1, Word16 var2, Flag *Overflow ) { Word16 var_out; @@ -348,7 +323,6 @@ Word16 add_o( Word16 var1, Word16 var2, Flag *Overflow ) return ( var_out ); } -#endif /* BASOP_NOGLOB */ Word16 add( Word16 var1, Word16 var2 ) { Word16 var_out; @@ -397,7 +371,6 @@ Word16 add( Word16 var1, Word16 var2 ) | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |___________________________________________________________________________| */ -#ifdef BASOP_NOGLOB Word16 sub_o( Word16 var1, Word16 var2, Flag *Overflow ) { Word16 var_out; @@ -412,7 +385,6 @@ Word16 sub_o( Word16 var1, Word16 var2, Flag *Overflow ) return ( var_out ); } -#endif /* BASOP_NOGLOB */ Word16 sub( Word16 var1, Word16 var2 ) { Word16 var_out; @@ -519,11 +491,7 @@ Word16 abs_s( Word16 var1 ) | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |___________________________________________________________________________| */ -#ifndef BASOP_NOGLOB -Word16 shl( Word16 var1, Word16 var2 ) -#else /* BASOP_NOGLOB */ Word16 shl_o( Word16 var1, Word16 var2, Flag *Overflow ) -#endif /* BASOP_NOGLOB */ { Word16 var_out; Word32 result; @@ -545,11 +513,7 @@ Word16 shl_o( Word16 var1, Word16 var2, Flag *Overflow ) if ( ( var2 > 15 && var1 != 0 ) || ( result != (Word32) ( (Word16) result ) ) ) { -#ifndef BASOP_NOGLOB - Overflow = 1; -#else /* BASOP_NOGLOB */ *Overflow = 1; -#endif /* BASOP_NOGLOB */ var_out = ( var1 > 0 ) ? MAX_16 : MIN_16; } else @@ -572,7 +536,6 @@ Word16 shl_o( Word16 var1, Word16 var2, Flag *Overflow ) return ( var_out ); } -#ifdef BASOP_NOGLOB Word16 shl( Word16 var1, Word16 var2 ) { Word16 var_out; @@ -616,7 +579,6 @@ Word16 shl( Word16 var1, Word16 var2 ) return ( var_out ); } -#endif /* BASOP_NOGLOB */ /*___________________________________________________________________________ | | @@ -658,9 +620,7 @@ Word16 shr( Word16 var1, Word16 var2 ) if ( var2 < 0 ) { -#ifdef BASOP_NOGLOB assert( 0 ); -#endif /* BASOP_NOGLOB */ if ( var2 < -16 ) var2 = -16; var2 = -var2; @@ -734,7 +694,6 @@ Word16 shr( Word16 var1, Word16 var2 ) | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |___________________________________________________________________________| */ -#ifdef BASOP_NOGLOB Word16 mult_o( Word16 var1, Word16 var2, Flag *Overflow ) { Word16 var_out; @@ -756,7 +715,6 @@ Word16 mult_o( Word16 var1, Word16 var2, Flag *Overflow ) return ( var_out ); } -#endif /* BASOP_NOGLOB */ Word16 mult( Word16 var1, Word16 var2 ) { Word16 var_out; @@ -812,11 +770,7 @@ Word16 mult( Word16 var1, Word16 var2 ) | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |___________________________________________________________________________| */ -#ifndef BASOP_NOGLOB -Word32 L_mult( Word16 var1, Word16 var2 ) -#else /* BASOP_NOGLOB */ Word32 L_mult_o( Word16 var1, Word16 var2, Flag *Overflow ) -#endif /* BASOP_NOGLOB */ { Word32 L_var_out; @@ -828,11 +782,7 @@ Word32 L_mult_o( Word16 var1, Word16 var2, Flag *Overflow ) } else { -#ifndef BASOP_NOGLOB - Overflow = 1; -#else /* BASOP_NOGLOB */ *Overflow = 1; -#endif /* BASOP_NOGLOB */ L_var_out = MAX_32; } @@ -845,7 +795,6 @@ Word32 L_mult_o( Word16 var1, Word16 var2, Flag *Overflow ) return ( L_var_out ); } -#ifdef BASOP_NOGLOB Word32 L_mult( Word16 var1, Word16 var2 ) { Word32 L_var_out; @@ -870,7 +819,6 @@ Word32 L_mult( Word16 var1, Word16 var2 ) return ( L_var_out ); } -#endif /* BASOP_NOGLOB */ /*___________________________________________________________________________ | | @@ -1036,7 +984,6 @@ Word16 extract_l( Word32 L_var1 ) | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |___________________________________________________________________________| */ -#ifdef BASOP_NOGLOB Word16 round_fx_o( Word32 L_var1, Flag *Overflow ) { Word16 var_out; @@ -1058,7 +1005,6 @@ Word16 round_fx_o( Word32 L_var1, Flag *Overflow ) return ( var_out ); } -#endif /* BASOP_NOGLOB */ Word16 round_fx( Word32 L_var1 ) { Word16 var_out; @@ -1116,7 +1062,6 @@ Word16 round_fx( Word32 L_var1 ) | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |___________________________________________________________________________| */ -#ifdef BASOP_NOGLOB Word32 L_mac_o( Word32 L_var3, Word16 var1, Word16 var2, Flag *Overflow ) { Word32 L_var_out; @@ -1134,7 +1079,6 @@ Word32 L_mac_o( Word32 L_var3, Word16 var1, Word16 var2, Flag *Overflow ) return ( L_var_out ); } -#endif /* BASOP_NOGLOB */ Word32 L_mac( Word32 L_var3, Word16 var1, Word16 var2 ) { Word32 L_var_out; @@ -1190,7 +1134,6 @@ Word32 L_mac( Word32 L_var3, Word16 var1, Word16 var2 ) | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |___________________________________________________________________________| */ -#ifdef BASOP_NOGLOB Word32 L_msu_o( Word32 L_var3, Word16 var1, Word16 var2, Flag *Overflow ) { Word32 L_var_out; @@ -1208,7 +1151,6 @@ Word32 L_msu_o( Word32 L_var3, Word16 var1, Word16 var2, Flag *Overflow ) return ( L_var_out ); } -#endif /* BASOP_NOGLOB */ Word32 L_msu( Word32 L_var3, Word16 var1, Word16 var2 ) { Word32 L_var_out; @@ -1266,28 +1208,16 @@ Word32 L_msu( Word32 L_var3, Word16 var1, Word16 var2 ) | | | Caution : | | | -#ifndef BASOP_NOGLOB - | In some cases the Carry flag has to be cleared or set before using | -#else | In some cases the BASOP_Carry flag has to be cleared or set before using | -#endif | operators which take into account its value. | |___________________________________________________________________________| */ -#ifndef BASOP_NOGLOB -Word32 L_macNs( Word32 L_var3, Word16 var1, Word16 var2 ) -#else /* BASOP_NOGLOB */ Word32 DEPR_L_macNs( Word32 L_var3, Word16 var1, Word16 var2, Flag *Carry ) -#endif /* BASOP_NOGLOB */ { Word32 L_var_out; L_var_out = L_mult( var1, var2 ); -#ifndef BASOP_NOGLOB - L_var_out = L_add_c( L_var3, L_var_out ); -#else /* BASOP_NOGLOB */ L_var_out = DEPR_L_add_c( L_var3, L_var_out, Carry ); -#endif /* BASOP_NOGLOB */ #ifdef WMOPS multiCounter[currCounter].L_mult--; @@ -1340,28 +1270,16 @@ Word32 DEPR_L_macNs( Word32 L_var3, Word16 var1, Word16 var2, Flag *Carry ) | | | Caution : | | | -#ifndef BASOP_NOGLOB - | In some cases the Carry flag has to be cleared or set before using | -#else | In some cases the BASOP_Carry flag has to be cleared or set before using | -#endif | operators which take into account its value. | |___________________________________________________________________________| */ -#ifndef BASOP_NOGLOB -Word32 L_msuNs( Word32 L_var3, Word16 var1, Word16 var2 ) -#else /* BASOP_NOGLOB */ Word32 DEPR_L_msuNs( Word32 L_var3, Word16 var1, Word16 var2, Flag *Carry ) -#endif /* BASOP_NOGLOB */ { Word32 L_var_out; L_var_out = L_mult( var1, var2 ); -#ifndef BASOP_NOGLOB - L_var_out = L_sub_c( L_var3, L_var_out ); -#else /* BASOP_NOGLOB */ L_var_out = DEPR_L_sub_c( L_var3, L_var_out, Carry ); -#endif /* BASOP_NOGLOB */ #ifdef WMOPS multiCounter[currCounter].L_mult--; @@ -1406,11 +1324,7 @@ Word32 DEPR_L_msuNs( Word32 L_var3, Word16 var1, Word16 var2, Flag *Carry ) | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |___________________________________________________________________________| */ -#ifndef BASOP_NOGLOB -Word32 L_add( Word32 L_var1, Word32 L_var2 ) -#else /* BASOP_NOGLOB */ Word32 L_add_o( Word32 L_var1, Word32 L_var2, Flag *Overflow ) -#endif /* BASOP_NOGLOB */ { Word32 L_var_out; @@ -1421,11 +1335,7 @@ Word32 L_add_o( Word32 L_var1, Word32 L_var2, Flag *Overflow ) if ( ( L_var_out ^ L_var1 ) & MIN_32 ) { L_var_out = ( L_var1 < 0 ) ? MIN_32 : MAX_32; -#ifndef BASOP_NOGLOB - Overflow = 1; -#else /* BASOP_NOGLOB */ *Overflow = 1; -#endif /* BASOP_NOGLOB */ } } @@ -1439,7 +1349,6 @@ Word32 L_add_o( Word32 L_var1, Word32 L_var2, Flag *Overflow ) return ( L_var_out ); } -#ifdef BASOP_NOGLOB Word32 L_add( Word32 L_var1, Word32 L_var2 ) { Word32 L_var_out; @@ -1460,7 +1369,6 @@ Word32 L_add( Word32 L_var1, Word32 L_var2 ) #endif return ( L_var_out ); } -#endif /* BASOP_NOGLOB */ /*___________________________________________________________________________ | | @@ -1493,11 +1401,7 @@ Word32 L_add( Word32 L_var1, Word32 L_var2 ) | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |___________________________________________________________________________| */ -#ifndef BASOP_NOGLOB -Word32 L_sub( Word32 L_var1, Word32 L_var2 ) -#else /* BASOP_NOGLOB */ Word32 L_sub_o( Word32 L_var1, Word32 L_var2, Flag *Overflow ) -#endif /* BASOP_NOGLOB */ { Word32 L_var_out; @@ -1508,11 +1412,7 @@ Word32 L_sub_o( Word32 L_var1, Word32 L_var2, Flag *Overflow ) if ( ( L_var_out ^ L_var1 ) & MIN_32 ) { L_var_out = ( L_var1 < 0L ) ? MIN_32 : MAX_32; -#ifndef BASOP_NOGLOB - Overflow = 1; -#else /* BASOP_NOGLOB */ *Overflow = 1; -#endif /* BASOP_NOGLOB */ } } @@ -1525,7 +1425,6 @@ Word32 L_sub_o( Word32 L_var1, Word32 L_var2, Flag *Overflow ) return ( L_var_out ); } -#ifdef BASOP_NOGLOB Word32 L_sub( Word32 L_var1, Word32 L_var2 ) { Word32 L_var_out; @@ -1548,7 +1447,6 @@ Word32 L_sub( Word32 L_var1, Word32 L_var2 ) return ( L_var_out ); } -#endif /* BASOP_NOGLOB */ /*___________________________________________________________________________ | | @@ -1557,11 +1455,7 @@ Word32 L_sub( Word32 L_var1, Word32 L_var2 ) | Purpose : | | | | Performs 32 bits addition of the two 32 bits variables (L_var1+L_var2+C)| -#ifndef BASOP_NOGLOB - | with carry. No saturation. Generate carry and Overflow values. The car- | -#else | with carry. No saturation. Generate carry and BASOP_Overflow values. The car- | -#endif | ry and overflow values are binary variables which can be tested and as- | | signed values. | | | @@ -1587,37 +1481,22 @@ Word32 L_sub( Word32 L_var1, Word32 L_var2 ) | | | Caution : | | | -#ifndef BASOP_NOGLOB - | In some cases the Carry flag has to be cleared or set before using | -#else | In some cases the BASOP_Carry flag has to be cleared or set before using | -#endif | operators which take into account its value. | |___________________________________________________________________________| */ -#ifndef BASOP_NOGLOB -Word32 L_add_c( Word32 L_var1, Word32 L_var2 ) -#else /* BASOP_NOGLOB */ Word32 DEPR_L_add_c( Word32 L_var1, Word32 L_var2, Flag *Carry ) -#endif /* BASOP_NOGLOB */ { Word32 L_var_out; Word32 L_test; Flag carry_int = 0; -#ifndef BASOP_NOGLOB - L_var_out = L_var1 + L_var2 + Carry; -#else /* BASOP_NOGLOB */ L_var_out = L_var1 + L_var2 + *Carry; -#endif /* BASOP_NOGLOB */ L_test = L_var1 + L_var2; if ( ( L_var1 > 0 ) && ( L_var2 > 0 ) && ( L_test < 0 ) ) { -#ifndef BASOP_NOGLOB - Overflow = 1; -#endif /* ! BASOP_NOGLOB */ carry_int = 0; } else @@ -1626,16 +1505,10 @@ Word32 DEPR_L_add_c( Word32 L_var1, Word32 L_var2, Flag *Carry ) { if ( L_test >= 0 ) { -#ifndef BASOP_NOGLOB - Overflow = 1; -#endif /* ! BASOP_NOGLOB */ carry_int = 1; } else { -#ifndef BASOP_NOGLOB - Overflow = 0; -#endif /* ! BASOP_NOGLOB */ carry_int = 1; } } @@ -1643,63 +1516,36 @@ Word32 DEPR_L_add_c( Word32 L_var1, Word32 L_var2, Flag *Carry ) { if ( ( ( L_var1 ^ L_var2 ) < 0 ) && ( L_test >= 0 ) ) { -#ifndef BASOP_NOGLOB - Overflow = 0; -#endif /* ! BASOP_NOGLOB */ carry_int = 1; } else { -#ifndef BASOP_NOGLOB - Overflow = 0; -#endif /* ! BASOP_NOGLOB */ carry_int = 0; } } } -#ifndef BASOP_NOGLOB - if ( Carry ) -#else /* BASOP_NOGLOB */ if ( *Carry ) -#endif /* BASOP_NOGLOB */ { if ( L_test == MAX_32 ) { -#ifndef BASOP_NOGLOB - Overflow = 1; - Carry = carry_int; -#else /* BASOP_NOGLOB */ *Carry = carry_int; -#endif /* BASOP_NOGLOB */ } else { if ( L_test == (Word32) 0xFFFFFFFFL ) { -#ifndef BASOP_NOGLOB - Carry = 1; -#else /* BASOP_NOGLOB */ *Carry = 1; -#endif /* BASOP_NOGLOB */ } else { -#ifndef BASOP_NOGLOB - Carry = carry_int; -#else /* BASOP_NOGLOB */ *Carry = carry_int; -#endif /* BASOP_NOGLOB */ } } } else { -#ifndef BASOP_NOGLOB - Carry = carry_int; -#else /* BASOP_NOGLOB */ *Carry = carry_int; -#endif /* BASOP_NOGLOB */ } #ifdef WMOPS @@ -1720,11 +1566,7 @@ Word32 DEPR_L_add_c( Word32 L_var1, Word32 L_var2, Flag *Carry ) | Purpose : | | | | Performs 32 bits subtraction of the two 32 bits variables with carry | -#ifndef BASOP_NOGLOB - | (borrow) : L_var1-L_var2-C. No saturation. Generate carry and Overflow | -#else | (borrow) : L_var1-L_var2-C. No saturation. Generate carry and BASOP_Overflow | -#endif | values. The carry and overflow values are binary variables which can | | be tested and assigned values. | | | @@ -1750,42 +1592,22 @@ Word32 DEPR_L_add_c( Word32 L_var1, Word32 L_var2, Flag *Carry ) | | | Caution : | | | -#ifndef BASOP_NOGLOB - | In some cases the Carry flag has to be cleared or set before using | -#else | In some cases the BASOP_Carry flag has to be cleared or set before using | -#endif | operators which take into account its value. | |___________________________________________________________________________| */ -#ifndef BASOP_NOGLOB -Word32 L_sub_c( Word32 L_var1, Word32 L_var2 ) -#else /* BASOP_NOGLOB */ Word32 DEPR_L_sub_c( Word32 L_var1, Word32 L_var2, Flag *Carry ) -#endif /* BASOP_NOGLOB */ { Word32 L_var_out; Word32 L_test; Flag carry_int = 0; -#ifndef BASOP_NOGLOB - if ( Carry ) -#else /* BASOP_NOGLOB */ if ( *Carry ) -#endif /* BASOP_NOGLOB */ { -#ifndef BASOP_NOGLOB - Carry = 0; -#else /* BASOP_NOGLOB */ *Carry = 0; -#endif /* BASOP_NOGLOB */ if ( L_var2 != MIN_32 ) { -#ifndef BASOP_NOGLOB - L_var_out = L_add_c( L_var1, -L_var2 ); -#else /* BASOP_NOGLOB */ L_var_out = DEPR_L_add_c( L_var1, -L_var2, Carry ); -#endif /* BASOP_NOGLOB */ #ifdef WMOPS multiCounter[currCounter].L_add_c--; #endif @@ -1795,12 +1617,7 @@ Word32 DEPR_L_sub_c( Word32 L_var1, Word32 L_var2, Flag *Carry ) L_var_out = L_var1 - L_var2; if ( L_var1 > 0L ) { -#ifndef BASOP_NOGLOB - Overflow = 1; - Carry = 0; -#else /* BASOP_NOGLOB */ *Carry = 0; -#endif /* BASOP_NOGLOB */ } } } @@ -1811,41 +1628,23 @@ Word32 DEPR_L_sub_c( Word32 L_var1, Word32 L_var2, Flag *Carry ) if ( ( L_test < 0 ) && ( L_var1 > 0 ) && ( L_var2 < 0 ) ) { -#ifndef BASOP_NOGLOB - Overflow = 1; -#endif /* ! BASOP_NOGLOB */ carry_int = 0; } else if ( ( L_test > 0 ) && ( L_var1 < 0 ) && ( L_var2 > 0 ) ) { -#ifndef BASOP_NOGLOB - Overflow = 1; -#endif /* ! BASOP_NOGLOB */ carry_int = 1; } else if ( ( L_test > 0 ) && ( ( L_var1 ^ L_var2 ) > 0 ) ) { -#ifndef BASOP_NOGLOB - Overflow = 0; -#endif /* ! BASOP_NOGLOB */ carry_int = 1; } if ( L_test == MIN_32 ) { -#ifndef BASOP_NOGLOB - Overflow = 1; - Carry = carry_int; -#else /* BASOP_NOGLOB */ *Carry = carry_int; -#endif /* BASOP_NOGLOB */ } else { -#ifndef BASOP_NOGLOB - Carry = carry_int; -#else /* BASOP_NOGLOB */ *Carry = carry_int; -#endif /* BASOP_NOGLOB */ } } @@ -1937,7 +1736,6 @@ Word32 L_negate( Word32 L_var1 ) | range : 0x8000 <= var_out <= 0x7fff. | |___________________________________________________________________________| */ -#ifdef BASOP_NOGLOB Word16 mult_ro( Word16 var1, Word16 var2, Flag *Overflow ) { Word16 var_out; @@ -1961,7 +1759,6 @@ Word16 mult_ro( Word16 var1, Word16 var2, Flag *Overflow ) return ( var_out ); } -#endif /* BASOP_NOGLOB */ Word16 mult_r( Word16 var1, Word16 var2 ) { Word16 var_out; @@ -2018,11 +1815,7 @@ Word16 mult_r( Word16 var1, Word16 var2 ) | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |___________________________________________________________________________| */ -#ifndef BASOP_NOGLOB -Word32 L_shl( Word32 L_var1, Word16 var2 ) -#else /* BASOP_NOGLOB */ Word32 L_shl_o( Word32 L_var1, Word16 var2, Flag *Overflow ) -#endif /* BASOP_NOGLOB */ { Word32 L_var_out = 0L; @@ -2043,11 +1836,7 @@ Word32 L_shl_o( Word32 L_var1, Word16 var2, Flag *Overflow ) { if ( L_var1 > (Word32) 0X3fffffffL ) { -#ifndef BASOP_NOGLOB - Overflow = 1; -#else /* BASOP_NOGLOB */ *Overflow = 1; -#endif /* BASOP_NOGLOB */ L_var_out = MAX_32; break; } @@ -2055,11 +1844,7 @@ Word32 L_shl_o( Word32 L_var1, Word16 var2, Flag *Overflow ) { if ( L_var1 < (Word32) 0xc0000000L ) { -#ifndef BASOP_NOGLOB - Overflow = 1; -#else /* BASOP_NOGLOB */ *Overflow = 1; -#endif /* BASOP_NOGLOB */ L_var_out = MIN_32; break; } @@ -2079,7 +1864,6 @@ Word32 L_shl_o( Word32 L_var1, Word16 var2, Flag *Overflow ) return ( L_var_out ); } -#ifdef BASOP_NOGLOB Word32 L_shl( Word32 L_var1, Word16 var2 ) { @@ -2127,7 +1911,6 @@ Word32 L_shl( Word32 L_var1, Word16 var2 ) return ( L_var_out ); } -#endif /* BASOP_NOGLOB */ /*___________________________________________________________________________ | | @@ -2162,7 +1945,6 @@ Word32 L_shl( Word32 L_var1, Word16 var2 ) | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |___________________________________________________________________________| */ -#ifdef BASOP_NOGLOB Word32 L_shr_o( Word32 L_var1, Word16 var2, Flag *Overflow ) { Word32 L_var_out; @@ -2206,7 +1988,6 @@ Word32 L_shr_o( Word32 L_var1, Word16 var2, Flag *Overflow ) return ( L_var_out ); } -#endif /* BASOP_NOGLOB */ Word32 L_shr( Word32 L_var1, Word16 var2 ) { Word32 L_var_out; @@ -2363,7 +2144,6 @@ Word16 shr_r( Word16 var1, Word16 var2 ) | range : 0x0000 8000 <= L_var_out <= 0x0000 7fff. | |___________________________________________________________________________| */ -#ifdef BASOP_NOGLOB Word16 mac_ro( Word32 L_var3, Word16 var1, Word16 var2, Flag *Overflow ) { Word16 var_out; @@ -2385,7 +2165,6 @@ Word16 mac_ro( Word32 L_var3, Word16 var1, Word16 var2, Flag *Overflow ) return ( var_out ); } -#endif /* BASOP_NOGLOB */ Word16 mac_r( Word32 L_var3, Word16 var1, Word16 var2 ) { Word16 var_out; @@ -2446,7 +2225,6 @@ Word16 mac_r( Word32 L_var3, Word16 var1, Word16 var2 ) | range : 0x0000 8000 <= L_var_out <= 0x0000 7fff. | |___________________________________________________________________________| */ -#ifdef BASOP_NOGLOB Word16 msu_ro( Word32 L_var3, Word16 var1, Word16 var2, Flag *Overflow ) { Word16 var_out; @@ -2466,7 +2244,6 @@ Word16 msu_ro( Word32 L_var3, Word16 var1, Word16 var2, Flag *Overflow ) return ( var_out ); } -#endif /* BASOP_NOGLOB */ Word16 msu_r( Word32 L_var3, Word16 var1, Word16 var2 ) { Word16 var_out; @@ -2742,11 +2519,7 @@ Word32 L_abs( Word32 L_var1 ) | range : 0x8000 0000 <= var_out <= 0x7fff ffff. | |___________________________________________________________________________| */ -#ifndef BASOP_NOGLOB -Word32 L_sat( Word32 L_var1 ) -#else /* BASOP_NOGLOB */ Word32 DEPR_L_sat_co( Word32 L_var1, Flag Overflow, Flag Carry ) -#endif /* BASOP_NOGLOB */ { Word32 L_var_out; @@ -2763,11 +2536,9 @@ Word32 DEPR_L_sat_co( Word32 L_var1, Flag Overflow, Flag Carry ) { L_var_out = MAX_32; } -#ifndef BASOP_NOGLOB Carry = 0; Overflow = 0; -#endif /* ! BASOP_NOGLOB */ } #ifdef WMOPS @@ -3070,7 +2841,6 @@ Word16 norm_l( Word32 L_var1 ) | | |___________________________________________________________________________| */ -#ifdef BASOP_NOGLOB Word32 L_mls_o( Word32 Lv, Word16 v, Flag *Overflow ) { Word32 Temp; @@ -3092,7 +2862,6 @@ Word32 L_mls_o( Word32 Lv, Word16 v, Flag *Overflow ) return Temp; } -#endif /* BASOP_NOGLOB */ Word32 L_mls( Word32 Lv, Word16 v ) { Word32 Temp; @@ -3251,11 +3020,7 @@ Word16 div_l( Word32 L_num, Word16 den ) | are performed if ORIGINAL_G7231 is defined. | |___________________________________________________________________________| */ -#ifndef BASOP_NOGLOB -Word16 i_mult( Word16 a, Word16 b ) -#else /* BASOP_NOGLOB */ Word16 DEPR_i_mult( Word16 a, Word16 b ) -#endif /* BASOP_NOGLOB */ { #ifdef ORIGINAL_G7231 return a * b; @@ -3348,7 +3113,6 @@ Word32 L_mult0( Word16 var1, Word16 var2 ) | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. |___________________________________________________________________________ */ -#ifdef BASOP_NOGLOB Word32 L_mac0_o( Word32 L_var3, Word16 var1, Word16 var2, Flag *Overflow ) { Word32 L_var_out; @@ -3368,7 +3132,6 @@ Word32 L_mac0_o( Word32 L_var3, Word16 var1, Word16 var2, Flag *Overflow ) return ( L_var_out ); } -#endif /* BASOP_NOGLOB */ Word32 L_mac0( Word32 L_var3, Word16 var1, Word16 var2 ) { Word32 L_var_out; @@ -3420,7 +3183,6 @@ Word32 L_mac0( Word32 L_var3, Word16 var1, Word16 var2 ) | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. |___________________________________________________________________________ */ -#ifdef BASOP_NOGLOB Word32 L_msu0_o( Word32 L_var3, Word16 var1, Word16 var2, Flag *Overflow ) { Word32 L_var_out; @@ -3440,7 +3202,6 @@ Word32 L_msu0_o( Word32 L_var3, Word16 var1, Word16 var2, Flag *Overflow ) return ( L_var_out ); } -#endif /* BASOP_NOGLOB */ Word32 L_msu0( Word32 L_var3, Word16 var1, Word16 var2 ) { Word32 L_var_out; diff --git a/lib_com/basop32.h b/lib_com/basop32.h index a8a72aed04825925a8ce418730d929c571b70203..422bc7229505c661acb5f93751caa91280405451 100644 --- a/lib_com/basop32.h +++ b/lib_com/basop32.h @@ -86,17 +86,12 @@ | Constants and Globals | |___________________________________________________________________________| */ -#ifndef BASOP_NOGLOB -extern Flag Overflow, Overflow2; -extern Flag Carry; -#else /* BASOP_NOGLOB */ /* DISABLED TO AVOID GLOBAL VARIABLES */ /* extern Flag BASOP_Overflow, BASOP_Overflow2; extern Flag BASOP_Carry; */ -#endif /* BASOP_NOGLOB */ #define BASOP_SATURATE_WARNING_ON #define BASOP_SATURATE_WARNING_OFF #define BASOP_SATURATE_ERROR_ON @@ -116,23 +111,7 @@ extern Flag BASOP_Carry; |___________________________________________________________________________| */ -#ifndef BASOP_NOGLOB -Word16 add( Word16 var1, Word16 var2 ); /* Short add, 1 */ -Word16 sub( Word16 var1, Word16 var2 ); /* Short sub, 1 */ -Word16 abs_s( Word16 var1 ); /* Short abs, 1 */ -Word16 shl( Word16 var1, Word16 var2 ); /* Short shift left, 1 */ -Word16 shr( Word16 var1, Word16 var2 ); /* Short shift right, 1 */ -Word16 mult( Word16 var1, Word16 var2 ); /* Short mult, 1 */ -Word32 L_mult( Word16 var1, Word16 var2 ); /* Long mult, 1 */ -Word16 negate( Word16 var1 ); /* Short negate, 1 */ -Word16 extract_h( Word32 L_var1 ); /* Extract high, 1 */ -Word16 extract_l( Word32 L_var1 ); /* Extract low, 1 */ -Word16 round_fx( Word32 L_var1 ); /* Round, 1 */ -Word32 L_mac( Word32 L_var3, Word16 var1, Word16 var2 ); /* Mac, 1 */ -Word32 L_msu( Word32 L_var3, Word16 var1, Word16 var2 ); /* Msu, 1 */ -Word32 L_macNs( Word32 L_var3, Word16 var1, Word16 var2 ); /* Mac without - sat, 1 */ -#else /* BASOP_NOGLOB */ + Word16 add( Word16 var1, Word16 var2 ); /* Short add, 1 */ Word16 sub( Word16 var1, Word16 var2 ); /* Short sub, 1 */ Word16 abs_s( Word16 var1 ); /* Short abs, 1 */ @@ -146,97 +125,44 @@ Word16 extract_l( Word32 L_var1 ); /* Word16 round_fx( Word32 L_var1 ); /* Round, 1 */ Word32 L_mac( Word32 L_var3, Word16 var1, Word16 var2 ); /* Mac, 1 */ Word32 L_msu( Word32 L_var3, Word16 var1, Word16 var2 ); /* Msu, 1 */ -Word32 DEPR_L_macNs( Word32 L_var3, Word16 var1, Word16 var2, Flag *Carry ); /* Mac without - sat, 1 */ -#endif /* BASOP_NOGLOB */ - -#ifndef BASOP_NOGLOB -Word32 L_msuNs( Word32 L_var3, Word16 var1, Word16 var2 ); /* Msu without - sat, 1 */ -#else /* BASOP_NOGLOB */ -Word32 DEPR_L_msuNs( Word32 L_var3, Word16 var1, Word16 var2, Flag *Carry ); /* Msu without - sat, 1 */ -#endif /* BASOP_NOGLOB */ -#ifndef BASOP_NOGLOB -Word32 L_add( Word32 L_var1, Word32 L_var2 ); /* Long add, 1 */ -Word32 L_sub( Word32 L_var1, Word32 L_var2 ); /* Long sub, 1 */ -Word32 L_add_c( Word32 L_var1, Word32 L_var2 ); /* Long add with c, 2 */ -Word32 L_sub_c( Word32 L_var1, Word32 L_var2 ); /* Long sub with c, 2 */ -Word32 L_negate( Word32 L_var1 ); /* Long negate, 1 */ -Word16 mult_r( Word16 var1, Word16 var2 ); /* Mult with round, 1 */ -Word32 L_shl( Word32 L_var1, Word16 var2 ); /* Long shift left, 1 */ -Word32 L_shr( Word32 L_var1, Word16 var2 ); /* Long shift right, 1 */ -Word16 shr_r( Word16 var1, Word16 var2 ); /* Shift right with - round, 2 */ -#else /* BASOP_NOGLOB */ -Word32 L_add( Word32 L_var1, Word32 L_var2 ); /* Long add, 1 */ -Word32 L_sub( Word32 L_var1, Word32 L_var2 ); /* Long sub, 1 */ -Word32 DEPR_L_add_c( Word32 L_var1, Word32 L_var2, Flag *Carry ); /* Long add with c, 2 */ -Word32 DEPR_L_sub_c( Word32 L_var1, Word32 L_var2, Flag *Carry ); /* Long sub with c, 2 */ -Word32 L_negate( Word32 L_var1 ); /* Long negate, 1 */ -Word16 mult_r( Word16 var1, Word16 var2 ); /* Mult with round, 1 */ -Word32 L_shl( Word32 L_var1, Word16 var2 ); /* Long shift left, 1 */ -Word32 L_shr( Word32 L_var1, Word16 var2 ); /* Long shift right, 1 */ -Word16 shr_r( Word16 var1, Word16 var2 ); /* Shift right with - round, 2 */ -#endif /* BASOP_NOGLOB */ - -#ifndef BASOP_NOGLOB +Word32 DEPR_L_macNs( Word32 L_var3, Word16 var1, Word16 var2, Flag *Carry ); /* Mac without sat, 1 */ + +Word32 DEPR_L_msuNs( Word32 L_var3, Word16 var1, Word16 var2, Flag *Carry ); /* Msu without sat, 1 */ + +Word32 L_add( Word32 L_var1, Word32 L_var2 ); /* Long add, 1 */ +Word32 L_sub( Word32 L_var1, Word32 L_var2 ); /* Long sub, 1 */ +Word32 DEPR_L_add_c( Word32 L_var1, Word32 L_var2, Flag *Carry ); /* Long add with c, 2 */ +Word32 DEPR_L_sub_c( Word32 L_var1, Word32 L_var2, Flag *Carry ); /* Long sub with c, 2 */ +Word32 L_negate( Word32 L_var1 ); /* Long negate, 1 */ +Word16 mult_r( Word16 var1, Word16 var2 ); /* Mult with round, 1 */ +Word32 L_shl( Word32 L_var1, Word16 var2 ); /* Long shift left, 1 */ +Word32 L_shr( Word32 L_var1, Word16 var2 ); /* Long shift right, 1 */ +Word16 shr_r( Word16 var1, Word16 var2 ); /* Shift right with + round, 2 */ + Word16 mac_r( Word32 L_var3, Word16 var1, Word16 var2 ); /* Mac with - rounding, 1 */ -#else /* BASOP_NOGLOB */ -Word16 mac_r( Word32 L_var3, Word16 var1, Word16 var2 ); /* Mac with - rounding, 1 */ -#endif /* BASOP_NOGLOB */ -#ifndef BASOP_NOGLOB + rounding, 1 */ Word16 msu_r( Word32 L_var3, Word16 var1, Word16 var2 ); /* Msu with - rounding, 1 */ -#else /* BASOP_NOGLOB */ -Word16 msu_r( Word32 L_var3, Word16 var1, Word16 var2 ); /* Msu with - rounding, 1 */ -#endif /* BASOP_NOGLOB */ -#ifndef BASOP_NOGLOB -Word32 L_deposit_h( Word16 var1 ); /* 16 bit var1 -> MSB, 1 */ -Word32 L_deposit_l( Word16 var1 ); /* 16 bit var1 -> LSB, 1 */ -#else /* BASOP_NOGLOB */ -Word32 L_deposit_h( Word16 var1 ); /* 16 bit var1 -> MSB, 1 */ -Word32 L_deposit_l( Word16 var1 ); /* 16 bit var1 -> LSB, 1 */ -#endif /* BASOP_NOGLOB */ - -#ifndef BASOP_NOGLOB + rounding, 1 */ +Word32 L_deposit_h( Word16 var1 ); /* 16 bit var1 -> MSB, 1 */ +Word32 L_deposit_l( Word16 var1 ); /* 16 bit var1 -> LSB, 1 */ + Word32 L_shr_r( Word32 L_var1, Word16 var2 ); /* Long shift right with - round, 3 */ -#else /* BASOP_NOGLOB */ -Word32 L_shr_r( Word32 L_var1, Word16 var2 ); /* Long shift right with - round, 3 */ -#endif /* BASOP_NOGLOB */ -#ifndef BASOP_NOGLOB -Word32 L_abs( Word32 L_var1 ); /* Long abs, 1 */ -Word32 L_sat( Word32 L_var1 ); /* Long saturation, 4 */ -Word16 norm_s( Word16 var1 ); /* Short norm, 1 */ -Word16 div_s( Word16 var1, Word16 var2 ); /* Short division, 18 */ -Word16 norm_l( Word32 L_var1 ); /* Long norm, 1 */ -#else /* BASOP_NOGLOB */ -Word32 L_abs( Word32 L_var1 ); /* Long abs, 1 */ -Word32 DEPR_L_sat_co( Word32 L_var1, Flag Overflow, Flag Carry ); /* Long saturation, 4 */ -Word16 norm_s( Word16 var1 ); /* Short norm, 1 */ -Word16 div_s( Word16 var1, Word16 var2 ); /* Short division, 18 */ -Word16 norm_l( Word32 L_var1 ); /* Long norm, 1 */ -#endif /* BASOP_NOGLOB */ + round, 3 */ + +Word32 L_abs( Word32 L_var1 ); /* Long abs, 1 */ +Word32 DEPR_L_sat_co( Word32 L_var1, Flag Overflow, Flag Carry ); /* Long saturation, 4 */ +Word16 norm_s( Word16 var1 ); /* Short norm, 1 */ +Word16 div_s( Word16 var1, Word16 var2 ); /* Short division, 18 */ +Word16 norm_l( Word32 L_var1 ); /* Long norm, 1 */ /* * Additional G.723.1 operators */ -#ifndef BASOP_NOGLOB -Word32 L_mls( Word32, Word16 ); /* Weight FFS; currently assigned 5 */ -Word16 div_l( Word32, Word16 ); /* Weight FFS; currently assigned 32 */ -Word16 i_mult( Word16 a, Word16 b ); /* Weight FFS; currently assigned 3 */ -#else /* BASOP_NOGLOB */ -Word32 L_mls( Word32, Word16 ); /* Weight FFS; currently assigned 5 */ -Word16 div_l( Word32, Word16 ); /* Weight FFS; currently assigned 32 */ -Word16 DEPR_i_mult( Word16 a, Word16 b ); /* Weight FFS; currently assigned 3 */ -#endif /* BASOP_NOGLOB */ +Word32 L_mls( Word32, Word16 ); /* Weight FFS; currently assigned 5 */ +Word16 div_l( Word32, Word16 ); /* Weight FFS; currently assigned 32 */ +Word16 DEPR_i_mult( Word16 a, Word16 b ); /* Weight FFS; currently assigned 3 */ /* * New shiftless operators, not used in G.729/G.723.1 @@ -244,7 +170,6 @@ Word16 DEPR_i_mult( Word16 a, Word16 b ); /* Word32 L_mult0( Word16 v1, Word16 v2 ); /* 32-bit Multiply w/o shift 1 */ Word32 L_mac0( Word32 L_v3, Word16 v1, Word16 v2 ); /* 32-bit Mac w/o shift 1 */ Word32 L_msu0( Word32 L_v3, Word16 v1, Word16 v2 ); /* 32-bit Msu w/o shift 1 */ -#ifdef BASOP_NOGLOB /* * Overflowing operators @@ -267,7 +192,6 @@ Word32 L_msu0_o( Word32 L_var3, Word16 var1, Word16 var2, Flag *Overflow ); Word16 mult_ro( Word16 var1, Word16 var2, Flag *Overflow ); Word16 mac_ro( Word32 L_var3, Word16 var1, Word16 var2, Flag *Overflow ); Word16 msu_ro( Word32 L_var3, Word16 var1, Word16 var2, Flag *Overflow ); -#endif /* BASOP_NOGLOB */ #endif /* ifndef _BASIC_OP_H */ diff --git a/lib_com/basop_lsf_tools.c b/lib_com/basop_lsf_tools.c index 498018c1eea64571bcf8eecbcf8c694a197b55ab..b3319d95dc78e7c49911fbec1e1294587168afc4 100644 --- a/lib_com/basop_lsf_tools.c +++ b/lib_com/basop_lsf_tools.c @@ -243,10 +243,7 @@ static Word16 E_LPC_f_lsp_pol_get( Word16 Ovf = 0; Word16 Q_out; Word16 m2; -#ifdef BASOP_NOGLOB Flag Overflow; -#endif /* BASOP_NOGLOB */ - Q_out = 31 - 23; move16(); @@ -300,9 +297,8 @@ static Word16 E_LPC_f_lsp_pol_get( test(); IF( Overflow > 0 && isMODE1 ) { -#ifdef BASOP_NOGLOB assert( 0 ); -#endif /* BASOP_NOGLOB */ + /* If an overflow is detected, redo the computation with 1 bit less */ Ovf = add( Ovf, 1 ); Ovf = E_LPC_f_lsp_pol_get( lsp, f, n, Ovf, isMODE1 ); diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 197fe884082c1c57d3a8b56b9da51875bc1002a9..5d9b6bc03f0020fd748d500e5f192651da6ba902 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -240,9 +240,7 @@ static Word16 Sqrt16_common( Word16 e ) { Word16 index, frac; -#ifdef BASOP_NOGLOB Flag Overflow; -#endif /* BASOP_NOGLOB */ assert( ( m >= 0x4000 ) || ( m == 0 ) ); @@ -257,11 +255,7 @@ static Word16 Sqrt16_common( if ( m != 0 ) { BASOP_SATURATE_WARNING_OFF; -#ifndef BASOP_NOGLOB - m = mac_r( SqrtTable[index], SqrtDiffTable[index], frac ); -#else /* BASOP_NOGLOB */ m = mac_ro( SqrtTable[index], SqrtDiffTable[index], frac, &Overflow ); -#endif /* BASOP_NOGLOB */ BASOP_SATURATE_WARNING_ON; } diff --git a/lib_com/bitalloc.c b/lib_com/bitalloc.c index 28715d184c0e24c403a492f31424a18160df7fd2..951f75eacd6a85a3688b4662d156f601c01ff089 100644 --- a/lib_com/bitalloc.c +++ b/lib_com/bitalloc.c @@ -250,9 +250,7 @@ int16_t BitAllocF( Word16 tmp, exp1, exp2; Word32 Rsubband_w32_fx[NB_SFM]; /* Q15 */ Word16 B_w16_fx; -#ifdef BASOP_NOGLOB Flag Overflow; -#endif /* BASOP_NOGLOB */ set_l( Rsubband_w32_fx, 0, NB_SFM ); @@ -365,11 +363,7 @@ int16_t BitAllocF( exp1 = sub( norm_l( L_tmp1 ), 1 ); exp2 = norm_s( n ); tmp = div_s( extract_h( L_shl( L_tmp1, exp1 ) ), shl( n, exp2 ) ); /*15 + 15 + exp1 - 16 - exp2*/ -#ifndef BASOP_NOGLOB - m_fx = shl( tmp, sub( exp2, exp1 ) ); /*Q14*/ -#else - m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ -#endif + m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ t_fx = 0; n = 0; @@ -435,11 +429,7 @@ int16_t BitAllocF( exp1 = sub( norm_l( L_tmp2 ), 1 ); exp2 = norm_s( n ); tmp = div_s( extract_h( L_shl( L_tmp2, exp1 ) ), shl( n, exp2 ) ); /*15 + 15 + exp1 - 16 - exp2*/ -#ifndef BASOP_NOGLOB - m_fx = shl( tmp, sub( exp2, exp1 ) ); /*Q14*/ -#else /* BASOP_NOGLOB */ - m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ -#endif /* BASOP_NOGLOB */ + m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ if ( L_tmp1 < 0 ) { m_fx = negate( m_fx ); diff --git a/lib_com/bits_alloc.c b/lib_com/bits_alloc.c index 7a1832bffb7c2d8b2c3a00d0da7626a78e00b3dc..5880de97d4b9fc4a308049a4f606b60c6b4fc033 100644 --- a/lib_com/bits_alloc.c +++ b/lib_com/bits_alloc.c @@ -531,33 +531,31 @@ static ivas_error acelp_FCB_allocator( *--------------------------------------------------------------------*/ ivas_error config_acelp1( - const int16_t enc_dec, /* i : encoder/decoder flag */ - const int32_t total_brate, /* i : total bitrate */ - const int32_t core_brate_inp, /* i : core bitrate */ - const int16_t core, /* i : core */ - const int16_t extl, /* i : extension layer */ - const int32_t extl_brate, /* i : extension layer bitrate */ - const int16_t L_frame, /* i : frame length at internal Fs */ - const int16_t GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ - ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ - const int16_t signaling_bits, /* i : number of signaling bits */ - const int16_t coder_type, /* i : coder type */ -#ifdef NONBE_FIX_GSC_BSTR + const int16_t enc_dec, /* i : encoder/decoder flag */ + const int32_t total_brate, /* i : total bitrate */ + const int32_t core_brate_inp, /* i : core bitrate */ + const int16_t core, /* i : core */ + const int16_t extl, /* i : extension layer */ + const int32_t extl_brate, /* i : extension layer bitrate */ + const int16_t L_frame, /* i : frame length at internal Fs */ + const int16_t GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ + ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ + const int16_t signaling_bits, /* i : number of signaling bits */ + const int16_t coder_type, /* i : coder type */ const int16_t inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif - const int16_t tc_subfr, /* i : TC subfr ID */ - const int16_t tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ - int16_t *nBits_es_Pred, /* o : number of bits for Es_pred Q */ - int16_t *unbits, /* o : number of unused bits */ - const int16_t element_mode, /* i : element mode */ - int16_t *uc_two_stage_flag, /* o : flag undicating two-stage UC */ - const int16_t tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ - const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const int16_t idchan, /* i : stereo channel ID */ - const int16_t active_cnt, /* i : Active frame counter */ - const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ - const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ + const int16_t tc_subfr, /* i : TC subfr ID */ + const int16_t tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ + int16_t *nBits_es_Pred, /* o : number of bits for Es_pred Q */ + int16_t *unbits, /* o : number of unused bits */ + const int16_t element_mode, /* i : element mode */ + int16_t *uc_two_stage_flag, /* o : flag undicating two-stage UC */ + const int16_t tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ + const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ + const int16_t idchan, /* i : stereo channel ID */ + const int16_t active_cnt, /* i : Active frame counter */ + const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ + const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ ) { int16_t i, bits, nb_subfr; @@ -778,13 +776,8 @@ ivas_error config_acelp1( } /* gain Q bit-budget - part 1 */ -#ifdef NONBE_FIX_GSC_BSTR if ( ( coder_type != UNVOICED && coder_type != AUDIO && coder_type != INACTIVE && !( core_brate <= ACELP_8k00 && coder_type != TRANSITION ) ) /* mid bitrates in GC and VC, low+mid bitrates in TC */ || - ( coder_type == INACTIVE && !inactive_coder_type_flag ) /* AVQ inactive */ - ) -#else - if ( ( coder_type != UNVOICED && coder_type != AUDIO && coder_type != INACTIVE && !( core_brate <= ACELP_8k00 && coder_type != TRANSITION ) ) || ( coder_type == INACTIVE && total_brate > MAX_GSC_INACTIVE_BRATE ) ) -#endif + ( coder_type == INACTIVE && !inactive_coder_type_flag ) /* AVQ inactive */ ) { *nBits_es_Pred = Es_pred_bits_tbl[BIT_ALLOC_IDX( core_brate, coder_type, -1, -1 )]; bits -= *nBits_es_Pred; @@ -877,11 +870,7 @@ ivas_error config_acelp1( } else if ( core_brate >= ACELP_11k60 && ( coder_type != AUDIO && !( coder_type == INACTIVE && L_frame == L_FRAME ) ) ) { -#ifdef NONBE_FIX_GSC_BSTR if ( coder_type == INACTIVE && L_frame == L_FRAME16k && inactive_coder_type_flag ) /* GSC Inactive @16kHz */ -#else - if ( coder_type == INACTIVE && L_frame == L_FRAME16k && total_brate <= MAX_GSC_INACTIVE_BRATE ) /* GSC Inactive @16kHz */ -#endif { acelp_cfg->ltf_mode = FULL_BAND; } @@ -1065,13 +1054,9 @@ ivas_error config_acelp1( acelp_cfg->fixed_cdk_index[2] = -1; acelp_cfg->fixed_cdk_index[3] = -1; } -#ifdef NONBE_FIX_GSC_BSTR else if ( ( coder_type != INACTIVE && nb_subfr == NB_SUBFR && coder_type != AUDIO ) || /* @12.8kHz core except of GSC */ ( nb_subfr == NB_SUBFR16k && ( !inactive_coder_type_flag || coder_type != INACTIVE ) ) /* @16kHz core GC, TC, AVQ inactive */ || core == HQ_CORE /* ACELP -> HQ switching in EVS */ ) -#else - else if ( ( coder_type != INACTIVE && nb_subfr == NB_SUBFR && coder_type != AUDIO ) || ( nb_subfr == NB_SUBFR16k && ( total_brate > MAX_GSC_INACTIVE_BRATE || coder_type != INACTIVE ) ) || core == HQ_CORE ) -#endif { /* pitch Q & gain Q bit-budget - part 2*/ for ( i = 0; i < nb_subfr; i++ ) @@ -1119,13 +1104,9 @@ ivas_error config_acelp1( } /* algebraic codebook bit-budget */ -#ifdef NONBE_FIX_GSC_BSTR if ( flag_hardcoded || /* EVS */ ( core_brate_inp >= MIN_BRATE_AVQ_EXC && coder_type != INACTIVE ) /* high-birate ACELP except IC */ || ( !inactive_coder_type_flag && coder_type == INACTIVE ) /* AVQ inactive */ ) -#else - if ( flag_hardcoded || ( core_brate_inp >= MIN_BRATE_AVQ_EXC && coder_type != INACTIVE ) || ( total_brate > MAX_GSC_INACTIVE_BRATE && coder_type == INACTIVE ) ) -#endif { for ( i = 0; i < nb_subfr; i++ ) { @@ -1212,12 +1193,8 @@ ivas_error config_acelp1( } /* AVQ codebook */ -#ifdef NONBE_FIX_GSC_BSTR if ( ( core_brate_inp >= MIN_BRATE_AVQ_EXC && coder_type != INACTIVE ) /* high-birate ACELP except IC */ || ( !inactive_coder_type_flag && coder_type == INACTIVE ) /* AVQ inactive */ ) -#else - if ( ( core_brate_inp >= MIN_BRATE_AVQ_EXC && coder_type != INACTIVE ) || ( total_brate > MAX_GSC_INACTIVE_BRATE && coder_type == INACTIVE ) ) -#endif { for ( i = 0; i < nb_subfr; i++ ) { @@ -1252,13 +1229,9 @@ ivas_error config_acelp1( } } } -#ifdef NONBE_FIX_GSC_BSTR else if ( ( coder_type == UNVOICED && tdm_low_rate_mode == 1 && element_mode == IVAS_CPE_TD ) /* LBR secondary channel in TD stereo */ || ( ( coder_type == INACTIVE || coder_type == AUDIO ) && nb_subfr == NB_SUBFR ) /* GSC @12.8kHz */ || ( coder_type == INACTIVE && inactive_coder_type_flag ) /* AVQ inactive */ ) -#else - else if ( ( coder_type == UNVOICED && tdm_low_rate_mode == 1 && element_mode == IVAS_CPE_TD ) || ( ( coder_type == INACTIVE || coder_type == AUDIO ) && nb_subfr == NB_SUBFR ) || ( coder_type == INACTIVE && total_brate <= MAX_GSC_INACTIVE_BRATE ) ) -#endif { int32_t Local_BR, Pitch_BR; int16_t Pitch_CT; @@ -1351,12 +1324,8 @@ ivas_error config_acelp1( /* sanity check */ if ( ( coder_type != INACTIVE && nb_subfr == NB_SUBFR && coder_type != AUDIO ) || nb_subfr == NB_SUBFR16k ) { -#ifdef NONBE_FIX_GSC_BSTR if ( ( L_frame == L_FRAME16k && coder_type == INACTIVE && inactive_coder_type_flag ) /* GSC Inactive @16kHz */ || ( GSC_IVAS_mode > 0 && L_frame == L_FRAME16k ) ) /* IVAS GSC @16kHz */ -#else - if ( ( L_frame == L_FRAME16k && coder_type == INACTIVE && total_brate <= MAX_GSC_INACTIVE_BRATE ) || ( GSC_IVAS_mode > 0 && L_frame == L_FRAME16k ) ) /* GSC Inactive @16kHz */ -#endif { acelp_cfg->ubits = 0; } diff --git a/lib_com/cnst.h b/lib_com/cnst.h index c7fb691fa2bb1bff08be971ca84720a37be48485..ce86e46545ec83c41f9269b2cfda739fdd9b055b 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -81,14 +81,9 @@ #define FORCE_MUSIC 101 /* debugging - force music on the command line */ #define FORCE_ACELP 102 /* debugging - force ACELP core on the command line */ #define FORCE_GSC 103 /* debugging - force GSC core on the command line */ -#ifdef SUPPORT_FORCE_TCX10_TCX20 #define FORCE_TCX10 104 /* debugging - force TCX10 core on the command line */ #define FORCE_TCX20 105 /* debugging - force TCX20 core on the command line */ #define FORCE_HQ 106 /* debugging - force HQ core on the command line */ -#else -#define FORCE_TCX 104 /* debugging - force TCX core on the command line */ -#define FORCE_HQ 105 /* debugging - force HQ core on the command line */ -#endif #define FORCE_TD_RENDERER 201 #define FORCE_CLDFB_RENDERER 202 #endif @@ -569,9 +564,7 @@ enum #define INT_FS_12k8 12800 /* internal sampling frequency */ #define M 16 /* order of the LP filter @ 12.8kHz */ -#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT #define MAX_LP_FILTER_ORDER 20 /* Max order of an LP filter */ -#endif #define L_FRAME 256 /* frame size at 12.8kHz */ #define NB_SUBFR 4 /* number of subframes per frame */ @@ -750,9 +743,7 @@ typedef enum #define GAIN_PRED_ORDER 4 /* Gain quantization - prediction order for gain quantizer (only for AMR-WB IO mode) */ #define MEAN_ENER 30 /* Gain quantization - average innovation energy */ -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD #define DTX_THR 5 /* DTX - lp_noise threshold for DTX at higher bitrates */ -#endif #define DTX_HIST_SIZE 8 /* CNG & DTX - number of last signal frames used for CNG averaging */ #define CNG_ISF_FACT 0.9f /* CNG & DTX - CNG spectral envelope smoothing factor */ diff --git a/lib_com/enh40.c b/lib_com/enh40.c index 80ff285cece358464a7b4da491ced951553340b3..570f4b211ab675c8fd924a2b0d4786ddec25c679 100644 --- a/lib_com/enh40.c +++ b/lib_com/enh40.c @@ -96,9 +96,7 @@ #include #include #include "stl.h" -#ifdef BASOP_NOGLOB #include -#endif /* BASOP_NOGLOB */ #define WMC_TOOL_SKIP @@ -160,11 +158,7 @@ * the range : MIN_40 <= L40_var_out <= MAX_40. * *****************************************************************************/ -#ifndef BASOP_NOGLOB -Word40 L40_shl( Word40 L40_var1, Word16 var2 ) -#else /* BASOP_NOGLOB */ Word40 L40_shl_o( Word40 L40_var1, Word16 var2, Flag *Overflow ) -#endif /* BASOP_NOGLOB */ { Word40 L40_var_out; @@ -194,27 +188,15 @@ Word40 L40_shl_o( Word40 L40_var1, Word16 var2, Flag *Overflow ) if ( L40_var_out > 0x003fffffffffLL ) #endif { -#ifndef BASOP_NOGLOB - Overflow = 1; - exit( 1 ); - /* L40_var_out = L40_OVERFLOW_OCCURED( L40_var_out); */ -#else /* BASOP_NOGLOB */ *Overflow = 1; L40_var_out = MAX_40; -#endif /* BASOP_NOGLOB */ break; } else if ( L40_var_out < L40_constant ) { -#ifndef BASOP_NOGLOB - Overflow = 1; - exit( 2 ); - /* L40_var_out = L40_UNDERFLOW_OCCURED( L40_var_out); */ -#else /* BASOP_NOGLOB */ *Overflow = 1; L40_var_out = MIN_40; -#endif /* BASOP_NOGLOB */ break; } @@ -234,7 +216,6 @@ Word40 L40_shl_o( Word40 L40_var1, Word16 var2, Flag *Overflow ) return ( L40_var_out ); } -#ifdef BASOP_NOGLOB Word40 L40_shl( Word40 L40_var1, Word16 var2 ) { @@ -293,7 +274,6 @@ Word40 L40_shl( Word40 L40_var1, Word16 var2 ) return ( L40_var_out ); } -#endif /* BASOP_NOGLOB */ /***************************************************************************** * @@ -422,7 +402,6 @@ Word40 L40_negate( Word40 L40_var1 ) * the range : MIN_40 <= L40_var_out <= MAX_40. * *****************************************************************************/ -#ifdef BASOP_NOGLOB Word40 L40_add_o( Word40 L40_var1, Word40 L40_var2, Flag *Overflow ) { @@ -465,7 +444,6 @@ Word40 L40_add_o( Word40 L40_var1, Word40 L40_var2, Flag *Overflow ) return ( L40_var_out ); } -#endif /* BASOP_NOGLOB */ Word40 L40_add( Word40 L40_var1, Word40 L40_var2 ) { Word40 L40_var_out; @@ -475,48 +453,24 @@ Word40 L40_add( Word40 L40_var1, Word40 L40_var2 ) #if defined( _MSC_VER ) && ( _MSC_VER <= 1200 ) if ( ( ( ( L40_var1 & 0x8000000000 ) >> 39 ) != 0 ) && ( ( ( L40_var2 & 0x8000000000 ) >> 39 ) != 0 ) && ( ( ( L40_var_out & 0x8000000000 ) >> 39 ) == 0 ) ) { -#ifndef BASOP_NOGLOB - Overflow = 1; - exit( 2 ); - /* L40_var_out = L40_UNDERFLOW_OCCURED( L40_var_out); */ -#else /* BASOP_NOGLOB */ assert( 0 ); L40_var_out = MIN_40; -#endif /* BASOP_NOGLOB */ } else if ( ( ( ( L40_var1 & 0x8000000000 ) >> 39 ) == 0 ) && ( ( ( L40_var2 & 0x8000000000 ) >> 39 ) == 0 ) && ( ( ( L40_var_out & 0x8000000000 ) >> 39 ) != 0 ) ) { -#ifndef BASOP_NOGLOB - Overflow = 1; - exit( 1 ); - /* L40_var_out = L40_OVERFLOW_OCCURED( L40_var_out); */ -#else /* BASOP_NOGLOB */ assert( 0 ); L40_var_out = MAX_40; -#endif /* BASOP_NOGLOB */ } #else if ( ( ( ( L40_var1 & 0x8000000000LL ) >> 39 ) != 0 ) && ( ( ( L40_var2 & 0x8000000000LL ) >> 39 ) != 0 ) && ( ( ( L40_var_out & 0x8000000000LL ) >> 39 ) == 0 ) ) { -#ifndef BASOP_NOGLOB - Overflow = 1; - exit( 2 ); - /* L40_var_out = L40_UNDERFLOW_OCCURED( L40_var_out); */ -#else /* BASOP_NOGLOB */ assert( 0 ); L40_var_out = MIN_40; -#endif /* BASOP_NOGLOB */ } else if ( ( ( ( L40_var1 & 0x8000000000LL ) >> 39 ) == 0 ) && ( ( ( L40_var2 & 0x8000000000LL ) >> 39 ) == 0 ) && ( ( ( L40_var_out & 0x8000000000LL ) >> 39 ) != 0 ) ) { -#ifndef BASOP_NOGLOB - Overflow = 1; - exit( 1 ); - /* L40_var_out = L40_OVERFLOW_OCCURED( L40_var_out); */ -#else /* BASOP_NOGLOB */ assert( 0 ); L40_var_out = MAX_40; -#endif /* BASOP_NOGLOB */ } #endif @@ -561,11 +515,7 @@ Word40 L40_add( Word40 L40_var1, Word40 L40_var2 ) * the range : MIN_40 <= L40_var_out <= MAX_40. * *****************************************************************************/ -#ifndef BASOP_NOGLOB -Word40 L40_sub( Word40 L40_var1, Word40 L40_var2 ) -#else /* BASOP_NOGLOB */ Word40 L40_sub_o( Word40 L40_var1, Word40 L40_var2, Flag *Overflow ) -#endif /* BASOP_NOGLOB */ { Word40 L40_var_out; @@ -574,48 +524,24 @@ Word40 L40_sub_o( Word40 L40_var1, Word40 L40_var2, Flag *Overflow ) #if defined( _MSC_VER ) && ( _MSC_VER <= 1200 ) if ( ( ( ( L40_var1 & 0x8000000000 ) >> 39 ) != 0 ) && ( ( ( L40_var2 & 0x8000000000 ) >> 39 ) == 0 ) && ( ( ( L40_var_out & 0x8000000000 ) >> 39 ) == 0 ) ) { -#ifndef BASOP_NOGLOB - Overflow = 1; - exit( 2 ); - /* L40_var_out = L40_UNDERFLOW_OCCURED( L40_var_out); */ -#else /* BASOP_NOGLOB */ *Overflow = 1; L40_var_out = MIN_40; -#endif /* BASOP_NOGLOB */ } else if ( ( ( ( L40_var1 & 0x8000000000 ) >> 39 ) == 0 ) && ( ( ( L40_var2 & 0x8000000000 ) >> 39 ) != 0 ) && ( ( ( L40_var_out & 0x8000000000 ) >> 39 ) != 0 ) ) { -#ifndef BASOP_NOGLOB - Overflow = 1; - exit( 1 ); - /* L40_var_out = L40_OVERFLOW_OCCURED( L40_var_out); */ -#else /* BASOP_NOGLOB */ *Overflow = 1; L40_var_out = MAX_40; -#endif /* BASOP_NOGLOB */ } #else if ( ( ( ( L40_var1 & 0x8000000000LL ) >> 39 ) != 0 ) && ( ( ( L40_var2 & 0x8000000000LL ) >> 39 ) == 0 ) && ( ( ( L40_var_out & 0x8000000000LL ) >> 39 ) == 0 ) ) { -#ifndef BASOP_NOGLOB - Overflow = 1; - exit( 2 ); - /* L40_var_out = L40_UNDERFLOW_OCCURED( L40_var_out); */ -#else /* BASOP_NOGLOB */ *Overflow = 1; L40_var_out = MIN_40; -#endif /* BASOP_NOGLOB */ } else if ( ( ( ( L40_var1 & 0x8000000000LL ) >> 39 ) == 0 ) && ( ( ( L40_var2 & 0x8000000000LL ) >> 39 ) != 0 ) && ( ( ( L40_var_out & 0x8000000000LL ) >> 39 ) != 0 ) ) { -#ifndef BASOP_NOGLOB - Overflow = 1; - exit( 1 ); - /* L40_var_out = L40_OVERFLOW_OCCURED( L40_var_out); */ -#else /* BASOP_NOGLOB */ *Overflow = 1; L40_var_out = MAX_40; -#endif /* BASOP_NOGLOB */ } #endif @@ -629,7 +555,6 @@ Word40 L40_sub_o( Word40 L40_var1, Word40 L40_var2, Flag *Overflow ) return ( L40_var_out ); } -#ifdef BASOP_NOGLOB Word40 L40_sub( Word40 L40_var1, Word40 L40_var2 ) { Word40 L40_var_out; @@ -669,7 +594,6 @@ Word40 L40_sub( Word40 L40_var1, Word40 L40_var2 ) return ( L40_var_out ); } -#endif /* BASOP_NOGLOB */ /***************************************************************************** * @@ -838,12 +762,8 @@ Word40 L40_min( Word40 L40_var1, Word40 L40_var2 ) * the range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. * *****************************************************************************/ -#ifndef BASOP_NOGLOB -Word32 L_saturate40( Word40 L40_var1 ) -#else /* BASOP_NOGLOB */ Word32 L_saturate40_o( Word40 L40_var1, Flag *Overflow ) -#endif /* BASOP_NOGLOB */ { Word32 L_var_out; @@ -853,21 +773,13 @@ Word32 L_saturate40_o( Word40 L40_var1, Flag *Overflow ) if ( L40_var1 < UNDER_L40_var2 ) { L40_var1 = UNDER_L40_var2; -#ifndef BASOP_NOGLOB - Overflow = 1; -#else /* BASOP_NOGLOB */ *Overflow = 1; -#endif /* BASOP_NOGLOB */ } if ( L40_var1 > OVER_L40_var2 ) { L40_var1 = OVER_L40_var2; -#ifndef BASOP_NOGLOB - Overflow = 1; -#else /* BASOP_NOGLOB */ *Overflow = 1; -#endif /* BASOP_NOGLOB */ } L_var_out = L_Extract40( L40_var1 ); @@ -882,7 +794,6 @@ Word32 L_saturate40_o( Word40 L40_var1, Flag *Overflow ) return ( L_var_out ); } -#ifdef BASOP_NOGLOB Word32 L_saturate40( Word40 L40_var1 ) { Word32 L_var_out; @@ -913,7 +824,6 @@ Word32 L_saturate40( Word40 L40_var1 ) return ( L_var_out ); } -#endif /* BASOP_NOGLOB */ /***************************************************************************** * diff --git a/lib_com/enh40.h b/lib_com/enh40.h index a258a4869353f5bfcf078e38cf47959b7f5f26f2..9c3742f3ef23b24bced88e87e71b85a8ac83baca 100644 --- a/lib_com/enh40.h +++ b/lib_com/enh40.h @@ -56,10 +56,8 @@ #include "stl.h" -#if defined( BASOP_NOGLOB ) || defined( _MSC_VER ) #define MAX_40 ( 0x0000007fffffffff ) #define MIN_40 ( 0xffffff8000000000 ) -#endif #define L40_OVERFLOW_OCCURED( L40_var1 ) ( Overflow = 1, exit( 1 ), L40_var1 ) #define L40_UNDERFLOW_OCCURED( L40_var1 ) ( Overflow = 1, exit( 2 ), L40_var1 ) @@ -111,7 +109,6 @@ Word40 L40_max( Word40 L40_var1, Word40 L40_var2 ); Word40 L40_min( Word40 L40_var1, Word40 L40_var2 ); Word32 L_saturate40( Word40 L40_var1 ); Word16 norm_L40( Word40 L40_var1 ); -#ifdef BASOP_NOGLOB /* * Overflowing operators */ @@ -119,7 +116,6 @@ Word40 L40_shl_o( Word40 L40_var1, Word16 var2, Flag *Overflow ); Word40 L40_add_o( Word40 L40_var1, Word40 L40_var2, Flag *Overflow ); Word40 L40_sub_o( Word40 L40_var1, Word40 L40_var2, Flag *Overflow ); Word32 L_saturate40_o( Word40 L40_var1, Flag *Overflow ); -#endif /* BASOP_NOGLOB */ /*#ifdef _MSC_VER*/ static __inline Word40 L40_set( Word40 L40_var1 ) { diff --git a/lib_com/env_stab.c b/lib_com/env_stab.c index 0908ce3377dea71fe7fb952c4cbaf3f242bbc6d7..8821899402c67a4367f4e1393d18a19047ff51bd 100644 --- a/lib_com/env_stab.c +++ b/lib_com/env_stab.c @@ -80,9 +80,7 @@ float env_stability( Word32 L_tmp, L_env_delta; Word16 inv_nb_sfm; float env_stab_f; -#ifdef BASOP_NOGLOB Flag Overflow; -#endif /* BASOP_NOGLOB */ if ( core_switching_flag ) { @@ -90,12 +88,8 @@ float env_stability( { mem_norm[i] = ynrm[i]; } -#ifdef BASOP_NOGLOB Overflow = 0; env_delta = shl_o( *mem_env_delta, 1, &Overflow ); -#else - env_delta = shl( *mem_env_delta, 1 ); -#endif } else { @@ -128,23 +122,12 @@ float env_stability( } exp = shr( exp, 1 ); -#ifndef BASOP_NOGLOB - env_delta = round_fx( L_shl( L_tmp, sub( 26, exp ) ) ); /* Q10 */ - L_tmp = L_mult0( 26214, env_delta ); /* 26214 is 0.1 in Q18. Q28 */ - L_tmp = L_mac( L_tmp, 29491, *mem_env_delta ); /* 29491 is 0.9 in Q15. Q28 */ - *mem_env_delta = round_fx( L_tmp ); /* Q12 */ -#else /* BASOP_NOGLOB */ env_delta = round_fx_o( L_shl_o( L_tmp, sub( 26, exp ), &Overflow ), &Overflow ); /* Q10 */ L_tmp = L_mult0( 26214, env_delta ); /* 26214 is 0.1 in Q18. Q28 */ L_tmp = L_mac_o( L_tmp, 29491, *mem_env_delta, &Overflow ); /* 29491 is 0.9 in Q15. Q28 */ *mem_env_delta = round_fx_o( L_tmp, &Overflow ); /* Q12 */ -#endif /* BASOP_NOGLOB */ Overflow = 0; -#ifndef BASOP_NOGLOB - env_delta = round_fx( L_shl( L_tmp, 1 ) ); /* Q13 */ -#else /* BASOP_NOGLOB */ - env_delta = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /* Q13 */ -#endif /* BASOP_NOGLOB */ + env_delta = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /* Q13 */ } if ( Overflow != 0 ) /* Saturated due to the above up-shifting operation. */ { diff --git a/lib_com/gs_bitallocation.c b/lib_com/gs_bitallocation.c index 6097e4ef7d180d507d2eebce22c697970e04be34..eddda88c32cf908b5e8a1ce166320e4dedc3a955 100644 --- a/lib_com/gs_bitallocation.c +++ b/lib_com/gs_bitallocation.c @@ -54,7 +54,6 @@ static float Find_bit_frac( const int16_t nb_band, const int16_t remaining_bits static void reajust_bits( float *bits_per_bands, const int16_t st_band, const int16_t end_band, const int16_t sum_bit_in, const int16_t bit_bdgt_in ); -#ifdef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING #define Q15_0_33 10922 /* 0.33 */ #define Q18_0_1 26214 /* 0.1 */ #define Q18_0_50 131072 /* 0.50 */ @@ -76,7 +75,6 @@ static void reajust_bits( float *bits_per_bands, const int16_t st_band, const in static Word16 Find_norm_inv( const Word32 ToDivide, Word16 *e_div ); static Word16 Find_bit_alloc_IVAS_int( const Word32 core_brate, const Word16 GSC_IVAS_mode, const Word16 Diff_len, const Word16 nb_tot_bands, const Word16 L_frame, Word16 *bit, Word16 *max_ener_band, float *ener_vec, float *bits_per_bands ); static Word16 maximum_fx( const Word16 *vec_fx, const Word16 lvec_fx, Word16 *max_fx ); -#endif /*-------------------------------------------------------------------* * bands_and_bit_alloc() @@ -115,12 +113,7 @@ void bands_and_bit_alloc( int16_t pos, band; float SWB_bit_budget; float bits_per_bands[MBANDS_GN_BITALLOC16k]; -#ifndef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING - float fzero_val, mp, mb, nb_bands_adj, bit_adj; - int16_t nb_pulse_per_band[MBANDS_GN_BITALLOC16k]; -#else float fzero_val; -#endif /* initializations */ nb_tot_bands = 16; @@ -220,189 +213,8 @@ void bands_and_bit_alloc( { if ( GSC_IVAS_mode > 0 ) { -#ifndef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING - SWB_bit_budget = *bit; - st_band = 5; - - set_f( bits_per_bands, 0, MBANDS_GN_BITALLOC16k ); - - /* 2- Decide the pourcentage of bits allocated to LF (between 50-75%) depending of the temporal contribution in GSC */ - bit_fracf = ( -0.125f * Diff_len + 76.0f ) / 100; - bit_fracf = check_bounds( bit_fracf, 0.50f, 0.75f ); - - /* Adjusment of the bitrate between LF and HF base on the content type */ - /* 1 = new GSC bit alloc - 2 = GSC bit alloc for tc frame - 3 = more music like (should not happen often given music is coded with dft) */ - - if ( GSC_IVAS_mode <= 3 ) - { - nb_bands_max -= 6; - } - - if ( GSC_IVAS_mode == 2 ) - { - bit_fracf += 0.1f; - nb_bands_max--; - } - - if ( GSC_IVAS_mode == 3 ) - { - bit_fracf -= 0.1f; - nb_bands_max += 3; - } - - /* First find how much we want to share between LF and HF, at low bitrate, a miminum of bits is needed in LF by limitating the number of bands*/ - /* Adjust the number of band based on the content type and bitrate */ - nb_bands_adj = 1.0f; - if ( GSC_IVAS_mode == 1 && core_brate < GSC_L_RATE_STG ) - { - nb_bands_adj = 0.0125f * SWB_bit_budget - 0.75f; - } - else if ( GSC_IVAS_mode != 2 && core_brate > GSC_H_RATE_STG ) - { - nb_bands_adj = 0.02f * SWB_bit_budget - 1.2f; - } - nb_bands_max = (int16_t) ( nb_bands_max * nb_bands_adj + 0.5f ); - nb_bands_max = check_bounds_s( nb_bands_max, 5, nb_tot_bands ); - - bit_fracf *= SWB_bit_budget; - - /* Estimation of the number of bit used in HF */ - /* with only the first weigthing The number of bits in max_ener_band[st_band-1] = 17% of bit_fracf */ - mb = .17f * bit_fracf; - mp = ( 2.0f * DSR_NB_PULSE ); - if ( core_brate < GSC_L_RATE_STG && GSC_IVAS_mode == 3 ) - { - mp = 1.5f * DSR_NB_PULSE; - } - else if ( core_brate < GSC_L_RATE_STG ) - { - mp = DSR_NB_PULSE; - } - - /* We want max_ener_band[st_band] <= max_ener_band[st_band-1] and max_ener_band[nb_bands_max-1] <= max_ener_band[st_band]*/ - /* We will estimate the number of bits to allocate of HF and put the remaining bits, if any, back on LF */ - /* compute the total possible number of band to be coded */ - nb_tot_bands = (int16_t) ( ( SWB_bit_budget - bit_fracf ) / ( mp + ( mb - mp ) / 2.0f ) ); - mp = min( mp, mb ); - if ( nb_tot_bands + st_band > nb_bands_max ) - { - bit_adj = ( ( mb + mp ) / 2 ) * ( nb_tot_bands + st_band - nb_bands_max ); - bit_adj = max( 0, bit_adj ); - nb_tot_bands = nb_bands_max - st_band; - bit_fracf += bit_adj; - } - nb_tot_bands += st_band; - - /* Allocate bits to LF */ - etmp = 0.23f; - for ( j = 0; j < st_band; j++ ) - { - i = j; - max_ener_band[j] = i; - ener_vec[i] = MIN16B; - bits_per_bands[j] = etmp * bit_fracf; - etmp -= 0.015f; - } - - SWB_bit_budget -= bit_fracf; - - /* Find low energy band in HF */ - set_s( nb_pulse_per_band, 2, MBANDS_GN_BITALLOC16k ); - for ( i = st_band + 2; i < nb_tot_bands - 1; i++ ) - { - if ( ener_vec[i] < ener_vec[i - 1] && ener_vec[i] < ener_vec[i + 1] ) - { - nb_pulse_per_band[i] = 1; - } - } - for ( j = st_band; j < nb_tot_bands; j++ ) - { - if ( j > 6 ) - { - i = maximum( ener_vec, nb_tot_bands, &etmp ); - } - else - { - i = j; - } - - max_ener_band[j] = i; - ener_vec[i] = MIN16B; - } - - /* Recompute the final bit distribution for HF */ - if ( nb_tot_bands > st_band ) - { - bit_fracf = DSR_NB_PULSE; - mb = ( SWB_bit_budget * 2 / ( nb_tot_bands - st_band ) ) - mp; - bit_fracf = ( mb - mp ) / ( nb_tot_bands - st_band ); - mb -= bit_fracf; - /* Do the distribution */ - for ( j = st_band; j < nb_tot_bands; j++ ) - { - if ( nb_pulse_per_band[max_ener_band[j]] > 1 ) - { - bits_per_bands[max_ener_band[j]] = mb; - } - else - { - bits_per_bands[max_ener_band[j]] = 4.5f; - } - mb -= bit_fracf; - SWB_bit_budget -= bits_per_bands[max_ener_band[j]]; - } - } - - /* Series of verification in case bit allocated != the budget */ - if ( SWB_bit_budget > 0 ) - { - i = st_band - 1; - while ( SWB_bit_budget > 0 ) - { - bits_per_bands[i]++; - SWB_bit_budget--; - i--; - if ( i == -1 ) - { - i = st_band - 1; - } - } - } - - nb_bands = nb_tot_bands; - - sum_bit = 0; - j = 0; - for ( i = 0; i < nb_bands; i++ ) - { - if ( bits_per_bands[i] > 112 ) - { - sum_bit += bits_per_bands[i] - 112; - bits_per_bands[i] = 112; - j = i + 1; - } - - /* safety check for overage bit reallocation */ - else if ( bits_per_bands[i] + sum_bit / 3 > 112 ) - { - j = i + 1; - } - } - - if ( sum_bit != 0 ) - { - sum_bit /= ( nb_bands - j ); - for ( i = j; i < nb_bands; i++ ) - { - bits_per_bands[i] += sum_bit; - } - } -#else nb_tot_bands = Find_bit_alloc_IVAS_int( core_brate, GSC_IVAS_mode, Diff_len, nb_tot_bands, L_frame, bit, max_ener_band, ener_vec, bits_per_bands ); nb_bands = nb_tot_bands; -#endif } else if ( GSC_noisy_speech ) { @@ -966,7 +778,6 @@ static float Find_bit_frac( return ( var_out ); } -#ifdef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING static Word16 Find_bit_alloc_IVAS_int( /* o : Number of band to encode */ const Word32 core_brate, /* i : core bit rate */ const Word16 GSC_IVAS_mode, /* i : GSC IVAS mode */ @@ -1265,4 +1076,3 @@ static Word16 maximum_fx( /* o : index of the maximum val return ind; } -#endif diff --git a/lib_com/gs_inact_switching.c b/lib_com/gs_inact_switching.c index e7cb216da42671427f60f7b21b3d6b08f2a5fc0b..1d6d06525f18f3c31d546cbc3acd16dede9f9842 100644 --- a/lib_com/gs_inact_switching.c +++ b/lib_com/gs_inact_switching.c @@ -59,22 +59,17 @@ *-------------------------------------------------------------------*/ void inact_switch_ematch( - float exc2[], /* i/o: CELP/GSC excitation buffer */ - float dct_exc_tmp[], /* i : GSC excitation in DCT domain */ - float lt_ener_per_band[], /* i/o: Long term energy per band */ - const int16_t coder_type, /* i : Coder type */ -#ifdef NONBE_FIX_GSC_BSTR + float exc2[], /* i/o: CELP/GSC excitation buffer */ + float dct_exc_tmp[], /* i : GSC excitation in DCT domain */ + float lt_ener_per_band[], /* i/o: Long term energy per band */ + const int16_t coder_type, /* i : Coder type */ const int16_t inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif - const int16_t L_frame, /* i : Frame length */ -#ifndef NONBE_FIX_GSC_BSTR - const int32_t total_brate, /* i : Total bitrate */ -#endif - const int16_t bfi, /* i : frame lost indicator */ - const int16_t last_core, /* i : Last core used */ - const int16_t last_codec_mode, /* i : Last codec mode */ - const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ - const int16_t element_mode /* i : element mode */ + const int16_t L_frame, /* i : Frame length */ + const int16_t bfi, /* i : frame lost indicator */ + const int16_t last_core, /* i : Last core used */ + const int16_t last_codec_mode, /* i : Last codec mode */ + const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ + const int16_t element_mode /* i : element mode */ ) { float Ener_per_bd[MBANDS_GN16k]; @@ -110,11 +105,7 @@ void inact_switch_ematch( lt_ener_per_band[i] = Ener_per_bd[i]; } } -#ifdef NONBE_FIX_GSC_BSTR else if ( coder_type == INACTIVE && inactive_coder_type_flag ) -#else - else if ( coder_type == INACTIVE && total_brate <= MAX_GSC_INACTIVE_BRATE ) -#endif { /* Find spectrum and energy per band for inactive frames */ edct( exc2, dct_exc_tmp, L_frame, element_mode ); diff --git a/lib_com/hq2_bit_alloc.c b/lib_com/hq2_bit_alloc.c index b2a65ba469aa185f2d67b5da5f99ff3b5116e99f..e74c1d880ba0aa139433d88ed1d4b8cb62dd872b 100644 --- a/lib_com/hq2_bit_alloc.c +++ b/lib_com/hq2_bit_alloc.c @@ -375,10 +375,8 @@ void hq2_bit_alloc_har( Word32 L_y[BANDS_MAX]; -#ifdef BASOP_NOGLOB Flag Overflow; Overflow = 0; -#endif grp_rngmax_fx[0] = 0; grp_rngmax_fx[1] = 0; @@ -644,12 +642,8 @@ void hq2_bit_alloc_har( L_temp = Mpy_32_16( L_Ravg_sub[GRP_SB - 1], sub( GRP_SB, 1 ) ); /* Qbe+0+1 */ L_temp = Mpy_32_16( L_temp, Inv_norm_sum_fx ); /* Qbe+1+QIpb+1 */ -#ifdef BASOP_NOGLOB lf_hf_ge_r_fx = round_fx_o( L_shl_o( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ), &Overflow ), &Overflow ); Overflow = 0; /* reset BASOP Overflow */ -#else - lf_hf_ge_r_fx = round_fx( L_shl( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ) ) ); -#endif exp_normn = norm_s( norm_sum_fx ); exp_normn = sub( exp_normn, 1 ); diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 43deb608bfb99625315060ce24bf28d7cce16b0f..6e21e9caf33e8b2a7633d1c0e716db8ea4cf03f5 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1138,18 +1138,12 @@ enum #define MASA_TRANSP_BITS 1 #define NO_BITS_MASA_ISM_NO_OBJ 2 -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL #define MASA2TOTAL_THR 0.9799999f #define MASA2TOTAL_PREC_THRESHOLD 1e-7 #define MASA2TOTAL_PREC_INV_THRESHOLD 1e7 -#else -#define MASA2TOTAL_THR 0.98f -#endif #define BITS_MASA2TOTTAL_DCT0 6 #define STEP_M2T 0.1f -#ifdef NONBE_1319_M2R_PRECISION_ALIGN #define STEP_M2T_FX 214748365 // Q31 -#endif #define MASA_HEADER_BITS 2 #define MASA_SUBFRAME_BITS 1 #define MASA_LOWBITRATE_MODE_BITS 1 @@ -1194,10 +1188,8 @@ enum #define MASA_RATIO_TOLERANCE 0.1f #define MASA_RATIO_THRESHOLD 0.1f #define MASA_ANGLE_TOLERANCE 0.5f -#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP #define MASA_SUR_COH_THRESHOLD 1e-7f #define MASA_SUR_COH_PRECISION 1e7f -#endif #define MASA_LIMIT_NO_BANDS_SUR_COH 8 #define MINIMUM_BIT_BUDGET_NORMAL_META 100 #define DIFF_DFRATIO_2BIT_LIMIT_IDX_HODIRAC 4 @@ -1453,11 +1445,7 @@ typedef enum /* LFE PLC */ #define LFE_PLC_BUFLEN 240 #define LFE_PLC_FS 1600 -#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT #define L_FRAME_1k6 ( LFE_PLC_FS / FRAMES_PER_SEC ) -#else -#define L_FRAME_1k6 ( 20 * LFE_PLC_FS / 1000 ) -#endif #define LFE_PLC_LENANA LFE_PLC_BUFLEN #define LFE_PLC_FDEL 300 diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 06b78519386bf2718c7732ac3fd06fb4550e1ee4..e7379aca05cf05ed3d950acf126a0ac4aaa2944a 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -200,9 +200,7 @@ ivas_error pre_proc_front_ivas( const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ -#ifdef NONBE_1211_DTX_BR_SWITCHING const int32_t last_ivas_total_brate, /* i : last IVAS total bitrate */ -#endif const int32_t ivas_total_brate /* i : IVAS total bitrate */ #ifdef DEBUG_MODE_INFO , const int16_t ch_idx @@ -759,7 +757,6 @@ int16_t get_igf_startline( float rand_triangular_signed( int16_t *seed ); -#ifdef NONBE_1319_M2R_PRECISION_ALIGN Word16 matrix_product_fx( const Word32 *X_fx, /* i : left hand matrix Qx*/ const Word16 rowsX, /* i : number of rows of the left hand matrix Q0*/ @@ -783,7 +780,6 @@ Word16 matrix_product_q30_fx( const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication Q0*/ Word32 *Z_fx /* o : resulting matrix after the matrix multiplication Q30*/ ); -#endif void dtx_read_padding_bits( DEC_CORE_HANDLE st, @@ -4016,7 +4012,6 @@ void ivas_dirac_dec_output_synthesis_cov_close( ); void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( -#ifdef FIX_835_PARAMMC_BUFFER_VALUES float *RealBuffer, /* i : input channel filter bank samples (real part) */ float *ImagBuffer, /* i : input channel filter bank samples (imaginary part */ float cx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */ @@ -4024,14 +4019,6 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( const int16_t param_band, /* i : parameter band */ PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */ const int16_t nchan_in /* i : number of input channels */ -#else - float *RealBuffer, /* i : input channel filter bank samples (real part) */ - float *ImagBuffer, /* i : input channel filter bank samples (imaginary part) */ - float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */ - float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (imaginary part) */ - PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */ - const int16_t nchan_in /* i : number of input channels */ -#endif ); void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( @@ -5528,11 +5515,7 @@ void ivas_lfe_dec( void ivas_lfe_tdplc( LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */ -#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT float *prevsynth, /* i : previous frame synthesis */ -#else - double *prevsynth, /* i : previous frame synthesis */ -#endif float *ytda, /* o : output time-domain buffer */ const int16_t output_frame /* i : output frame length */ ); diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 00ebff8da5fb25966af8cb9f7843bc48c5680ab5..3b0c10581022c9b156d3504777cc8674d9300d37 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2781,7 +2781,6 @@ const int32_t sep_object_brate[][MAX_NUM_OBJECTS] = }; /* column wise DCT matrices for 4 5, and 8 dim */ -#ifdef NONBE_1319_M2R_PRECISION_ALIGN const Word32 dct4_fx[4 * 4] = { // Q31 1073741824, 1402951040, 1073741824, 581109056, 1073741824, 581109056, -1073741824, -1402951040, @@ -2822,7 +2821,7 @@ const Word32 dct12_fx[12 * 12] = { // Q31 619978560, -335436960, 0, 335436960, -619978560, 810030848, -876602816, 810030848, -619978560, 335436960, 619978560, -869301376, 846752832, -810030848, 759350208, -695569984, 619978560, -533649696, 438301408, -335436960, 226989024, -114460880 }; -#endif + const float dct4[4*4] = { 0.5000f, 0.6533f, 0.5000f, 0.2706f, @@ -3181,7 +3180,6 @@ const int16_t ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 1, 0 }; const float ivas_lfe_lpf_delay[2] = { 0.00175f, 0.0035f }; -#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT const float hamm_lfe_plc[LFE_PLC_LENANA / 2] = { 0.08000000000000002f, 0.08015895227847719f, 0.08063569926248770f, 0.08142991147368656f, 0.08254104003450596f, 0.08396831704748331f, 0.08571075612595230f, 0.08776715307573196f, @@ -3200,26 +3198,6 @@ const float hamm_lfe_plc[LFE_PLC_LENANA / 2] = 0.96233504613317988f, 0.96698111571154954f, 0.97133209998031445f, 0.97538499198789563f, 0.97913699079334116f, 0.98258550340204664f, 0.98572814655776630f, 0.98856274838967395f, 0.99108734991333569f, 0.99330020638455863f, 0.99519978850517732f, 0.99678478347994692f, 0.99805409592381300f, 0.99900684861892730f, 0.99964238312089115f, 0.99996026021380402f }; -#else -const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2] = -{ - 0.08000000000000002, 0.08015895227847719, 0.08063569926248770, 0.08142991147368656, 0.08254104003450596, 0.08396831704748331, 0.08571075612595230, 0.08776715307573196, - 0.09013608672734141, 0.09281591991816535, 0.09580480062389246, 0.09910066323844335, 0.10270123000150438, 0.10660401257268071, 0.11080631375118072, 0.11530522933984272, - 0.12009765015221685, 0.12518026416131367, 0.13054955878853602, 0.13620182333121073, 0.14213315152704381, 0.14833944425372619, 0.15481641236182375, 0.16155957963899570, - 0.16856428590349043, 0.17582569022478273, 0.18333877426912554, 0.19109834576770490, 0.19909904210500018, 0.20733533402487142, 0.21580152945181053, 0.22449177742471671, - 0.23340007214047787, 0.24252025710456171, 0.25184602938575001, 0.26137094397207467, 0.27108841822494550, 0.28099173642839037, 0.29107405443026624, 0.30132840437223085, - 0.31174769950520753, 0.32232473908701620, 0.33305221335878232, 0.34392270859668939, 0.35492871223557998, 0.36606261806086549, 0.37731673146515798, 0.38868327476598852, - 0.40015439258093899, 0.41172215725647360, 0.42337857434671339, 0.43511558813837425, 0.44692508721804453, 0.45879891007795709, 0.47072885075638249, 0.48270666450874267, - 0.49472407350552849, 0.50677277255308162, 0.51884443483328757, 0.53093071765821398, 0.54302326823571601, 0.55511372944202464, 0.56719374559732838, 0.57925496824035816, - 0.59128906189798180, 0.60328770984582458, 0.61524261985593010, 0.62714552992749328, 0.63898821399670414, 0.65076248762175315, 0.66246021363907504, 0.67407330778691554, - 0.68559374429233988, 0.69701356141781945, 0.70832486696356345, 0.71951984372179334, 0.73059075487919101, 0.74152994936378558, 0.75232986713258543, 0.76298304439630038, - 0.77348211877754336, 0.78381983439894576, 0.79398904689767136, 0.80398272836286389, 0.81379397219261318, 0.82341599786708708, 0.83284215563452701, 0.84206593110687011, - 0.85108094976182280, 0.85988098134827329, 0.86845994419199846, 0.87681190939868969, 0.88493110495139349, 0.89281191969953333, 0.90044890723675941, 0.90783678966494241, - 0.91497046124171255, 0.92184499190902180, 0.92845563070029180, 0.93479780902379184, 0.94086714381997805, 0.94665944059061280, 0.95217069629756890, 0.95739710212931617, - 0.96233504613317988, 0.96698111571154954, 0.97133209998031445, 0.97538499198789563, 0.97913699079334116, 0.98258550340204664, 0.98572814655776630, 0.98856274838967395, - 0.99108734991333569, 0.99330020638455863, 0.99519978850517732, 0.99678478347994692, 0.99805409592381300, 0.99900684861892730, 0.99964238312089115, 0.99996026021380402 -}; -#endif /*------------------------------------------------------------------------------------------* * MDFT/iMDFT ROM tables diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index 4cfd08b73c87be0cad69f0848a363a1015604736..6cce7f9ecc6945614fcb00a6b4062c7ea1282e5d 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -327,12 +327,10 @@ extern const float dct4[]; extern const float dct5[]; extern const float dct8[]; extern const float dct12[]; -#ifdef NONBE_1319_M2R_PRECISION_ALIGN extern const Word32 dct4_fx[]; extern const Word32 dct5_fx[]; extern const Word32 dct8_fx[]; extern const Word32 dct12_fx[]; -#endif /*----------------------------------------------------------------------------------* * ISM ROM tables @@ -368,11 +366,7 @@ extern const int16_t ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP]; extern const ivas_lfe_freq_models ivas_str_lfe_freq_models; extern const float ivas_lfe_lpf_delay[2]; -#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT extern const float hamm_lfe_plc[LFE_PLC_LENANA / 2]; -#else -extern const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2]; -#endif extern const float ivas_sin_twiddle_480[IVAS_480_PT_LEN >> 1]; extern const float ivas_cos_twiddle_480[IVAS_480_PT_LEN >> 1]; diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index b960d3bb5129b6d86619086b3b6e56c366587079..ac21ec3e7aeca641c05894dd0296a76db6426086 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -1258,11 +1258,7 @@ static void ivas_calc_mat_inv( ivas_calc_mat_det( dbl_in_re, dim, &det_re ); -#ifdef NONBE_FIX_1213_SBA_DET_MAT_INV_3BY3 det = det_re > 0 ? 1 / max( IVAS_DBL_EPS, det_re ) : 1 / min( det_re, -IVAS_DBL_EPS ); -#else - det = det_re > 0 ? 1 / max( IVAS_DBL_EPS, det_re ) : min( det_re, -IVAS_DBL_EPS ); -#endif for ( i = 0; i < dim; i++ ) { diff --git a/lib_com/ivas_stereo_mdct_bands_com.c b/lib_com/ivas_stereo_mdct_bands_com.c index 51b541ab2cf0ce201daf0b0ab85a05a009d045db..3e414582afa6658fed2378f0ccc89ab073d08bd0 100644 --- a/lib_com/ivas_stereo_mdct_bands_com.c +++ b/lib_com/ivas_stereo_mdct_bands_com.c @@ -44,11 +44,7 @@ * Local union *-------------------------------------------------------------------*/ -#ifndef BASOP_NOGLOB typedef union -#else /* BASOP_NOGLOB */ -typedef union -#endif /* BASOP_NOGLOB */ { MDCTStereoBands_config const *steBands; SpectrumWarping const *lpcBndsParam; diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index c2183e0e061d86a39f51bd747a053e5fcdf0d431..ce4f837e4b49a4d8ae26e7f7edf4d9fc90461c2f 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -41,9 +41,8 @@ #include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_rom_com.h" -#ifdef NONBE_1319_M2R_PRECISION_ALIGN #include "basop_settings.h" -#endif + /*--------------------------------------------------------------- * sumAbs() * @@ -1255,7 +1254,6 @@ float rand_triangular_signed( } } -#ifdef NONBE_1319_M2R_PRECISION_ALIGN Word16 matrix_product_fx( const Word32 *X_fx, /* i : left hand matrix Qx*/ const Word16 rowsX, /* i : number of rows of the left hand matrix Q0*/ @@ -1493,4 +1491,3 @@ Word16 matrix_product_q30_fx( return EXIT_SUCCESS; } -#endif diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c index 4277fa20b762a227b3bc2a4a66ed823f57baf345..affaa063edd0c4964cafb9cf6d3c9e65c5c99614 100644 --- a/lib_com/lsf_tools.c +++ b/lib_com/lsf_tools.c @@ -959,22 +959,14 @@ void isp2isf( * * Convert from LPC to reflection coeff *-------------------------------------------------------------------*/ -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -void a2rc( -#else /*! r: stability flag */ uint16_t a2rc( -#endif const float *a, /* i : LPC coefficients */ float *refl, /* o : Reflection co-efficients */ const int16_t lpcorder /* i : LPC order */ ) { -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - float f[M]; -#else float f[MAX_LP_FILTER_ORDER]; -#endif int16_t m, j, n; float km, denom, x; @@ -993,11 +985,7 @@ uint16_t a2rc( { refl[j] = 0.f; } -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - return; -#else return 0; -#endif } refl[m] = -km; @@ -1017,11 +1005,7 @@ uint16_t a2rc( } } -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - return; -#else return 1; -#endif } diff --git a/lib_com/mslvq_com.c b/lib_com/mslvq_com.c index d07dd8076320902cd07ccc75b624d2eeb1043579..7f67bd57509104be0fc1d6a3e6fcbd26375e258b 100644 --- a/lib_com/mslvq_com.c +++ b/lib_com/mslvq_com.c @@ -828,11 +828,7 @@ void deindex_lvq_SHB( /* find idx_leader */ i = 1; -#ifdef NONBE_FIX_1054_NEGATIVE_LVQ_INDEX while ( index > table_no_cv[i] ) -#else - while ( index >= table_no_cv[i] ) -#endif { i++; } diff --git a/lib_com/options.h b/lib_com/options.h index 7731646a8bb2c1a00c33c5f36a2ba084626cfa1b..0d12e5bd166981976aa7b3e187cfa96d54c8d985 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -75,7 +75,6 @@ /*#define DEBUG_MODE_LFE */ /* define to output LFE relevant parameters */ /*#define DEBUG_FORCE_DIR*/ /* Force modes/parameters by reading from external binary files */ #endif -#define SUPPORT_FORCE_TCX10_TCX20 /* VA: Enable -force tcx10|tcx20 command-line option */ #ifdef DEBUG_MODE_MDCT #define DEBUG_PLOT_BITS @@ -143,50 +142,8 @@ /* ################### Start FIXES switches ########################### */ -#define NON_BE_FIX_1048_THRESHOLD_COH_BASOP /* Nokia: Fix 1048 replace comparison with 0 with comparison to threshold, to align with BASOP*/ -#define NONBE_FIX_1054_NEGATIVE_LVQ_INDEX /* Nokia: issue 1054: Input to decode_comb in deindex_lvq_SHB should be positive */ -#define NONBE_FIX_738_QUATERNION_SLERP_PRECISION /* Philips: issue 738: Quaternion spherical linear interpolation precision handling issues */ -#define FIX_1033_MEMORY_LEAK_OMASA /* Nokia / Orange: issue #1033: Memory leak in OMASA to BINAURAL with HRTF with bitrate switching */ -#define FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* Ericsson: premature cast to unsigned detected by USAN corrected */ -#define FIX_1027_GSC_INT_OVERFLOW /* VA: issue 2207: overflow in GSC */ -#define NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO /* FhG: avoid sidegain DFT-Stereo param to be larger than 1 when converting from Dirac parameters */ -#define NON_BE_1055_RESET_LP_MEMORIES /* VA: issue 1055: Correctly reset LP filter MA and AR memories in bitrate switching */ -#define NONBE_FIX_1069_SVD_TUNING /* FhG: issue 1069: tune SVD constants */ -#define NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO /* Eri: Issue 1010: Division by zero in Stereo CNG */ -#define NONBE_MDCT_ST_DTX_SKIP_DEWHITENING_OF_NOISE_SHAPES_ON_SID_FRAMES /* FhG: issue 1133: skip de-whitening of bg noise shape after frameloss period if the first good frame is an SID */ -#define NONBE_MDCT_ST_PLC_DO_NOT_SCALE_OLD_OUT_IF_FIRST_GOOD_IS_SID /* FhG: issue 1133: in TCX PLC, don't scale hHQ_core->old_out after applying fade to noise in burst frame error */ -#define NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING /* VA: Add fix point bit allocation for special GSC mode such that float and fixed point have the same final bit allocation */ -#define NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE /* VA: issue 1132: prevent division by extremely low energy value in SWB TBE */ -#define FIX_BASOP_812_NAN_COHSNR /* FhG: BASOP issue 812: fix nan values in sparse frames for cohSNR value in ITD estimation*/ - -#define NON_BE_FIX_807_MASA_DTX_BRSW /* Nokia: adds fix to check existence of DTX encoder for secondary channel in TD mode */ -#define NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL /* Nokia: add fix for precision limitation in comparison with masa2total energy ratio threshold */ -#define FIX_828_PORT_1152_FROM_FLT_REPO /* FhG: fix for issue 828 - fix uninitialized value used in BASOP */ -#define NONE_BE_FIX_816_LFE_PLC_FLOAT /* DLB: issue 816: reduce required precision to float for LFE-PLC*/ -#define FIX_835_PARAMMC_BUFFER_VALUES /* FhG: issue 835: wide range of buffer values for cx in ParamMC */ -#define NONBE_FIX_943_PORT_1208_DFT_STEREO_PLC_BURST /* Ericsson: BASOP Issue 943, Float Issue 1208, fix for overflow of sample offset counter for burst error in DFT Stereo PLC. */ -#define FIX_903_ZERO_OUT_IMDCT_BUFFERS_FOR_MCT_IGNORE /* FhG: zero out all relevant imdct buffers in MCT decoding of channels with mct_chan_mode == MCT_CHAN_MODE_IGNORE */ -#define FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC_FP /* Nokia: Fixes ivas_decode_masaism_metadata decision logic change due to precision difference; this is the fix in floating point */ -#define NONBE_FIX_1205_TD_STEREO_MOD_CT /* VA: fix mismatch of coder_type (mod_ct) btw. TD stereo encoder and decoder */ -#define NONBE_FIX_1213_SBA_DET_MAT_INV_3BY3 /*Dolby: issue 1213: fix for inverse of det < 0*/ -#define NONBE_FIX_1204_MDCT_STEREO_NOISE_EST_SCALING /* FhG: fixes for decoder-side noise level estimation in MDCT-Stereo to prevent noise bursts in stereo switching */ -#define NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO /* Eri: issue 1233: Address possible division by zero in hf_spectrum_sparseness() */ - -#define NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS /* DLB: adjust prerendering and mixing gain in OSBA encoder. This is fix to float codes*/ -#define NONBE_1211_DTX_BR_SWITCHING /* VA: port float issue 1211: fix crash in MASA DTX bitrate switching */ -#define NONBE_FIX_1189_GSC_IVAS_OMASA /* VA: Fix for issue 1189: Bitstream desynchornization due to reading/writing of the GSC_IVAS_mode parameter */ -#define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ -#define FIX_920_IGF_INIT_ERROR /* FhG: issue 920: fix bitrate mismatch in initial IGF config to avoid error message in same cases */ -#define NONBE_1273_ISM_METADATA_COUNTER /* VA: FLP issue 1273: fix counter overflow in ISM metadata encoder */ -#define NONBE_FIX_GSC_BSTR /* VA: issue 1264 FLP (1189 BASOP): Fix bitstream synchronization between encoder and decoder in ACELP GSC in OMASA */ -#define NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD /* VA/Eri: FLP issue 1277: Fix Mismatch in DTX high-rate threshold between EVS float and BASOP */ -#define NONBE_FIX_708_OSBA_BR_SWITCHING_CRASH /* FhG: issue 708: fix crash in OSBA BR switching with long test vectors */ - - -#define NONBE_1319_M2R_PRECISION_ALIGN /* Nokia: bring updates from PC code related to OMASA masa2total ratios */ -/* #################### End FIXES switches ############################ */ -#define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ +/* #################### End FIXES switches ############################ */ /* clang-format on */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 006a506e2e3b9643c859ee90580c9bb9dbb60060..335e4bd444057f3b0a0f9401d33edd77ca3f8cd8 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -2989,12 +2989,8 @@ void a2isf( const float *old_isf, const int16_t lpcOrder ); -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -void a2rc( -#else /*! r: stability flag */ uint16_t a2rc( -#endif const float *a, /* i : LPC coefficients */ float *refl, /* o : Reflection co-efficients */ const int16_t lpcorder /* i : LPC order */ @@ -3548,22 +3544,17 @@ void highband_exc_dct_in( ); void inact_switch_ematch( - float exc2[], /* i/o: CELP/GSC excitation buffer */ - float dct_exc_tmp[], /* i : GSC excitation in DCT domain */ - float lt_ener_per_band[], /* i/o: long-term energy per band */ - const int16_t coder_type, /* i : coder type */ -#ifdef NONBE_FIX_GSC_BSTR + float exc2[], /* i/o: CELP/GSC excitation buffer */ + float dct_exc_tmp[], /* i : GSC excitation in DCT domain */ + float lt_ener_per_band[], /* i/o: long-term energy per band */ + const int16_t coder_type, /* i : coder type */ const int16_t inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif - const int16_t L_frame, /* i : frame length */ -#ifndef NONBE_FIX_GSC_BSTR - const int32_t total_brate, /* i : Total bitrate */ -#endif - const int16_t bfi, /* i : frame lost indicator */ - const int16_t last_core, /* i : Last core used */ - const int16_t last_codec_mode, /* i : Last codec mode */ - const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const int16_t element_mode /* i : element mode */ + const int16_t L_frame, /* i : frame length */ + const int16_t bfi, /* i : frame lost indicator */ + const int16_t last_core, /* i : Last core used */ + const int16_t last_codec_mode, /* i : Last codec mode */ + const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ + const int16_t element_mode /* i : element mode */ ); void music_postfilt_init( @@ -3907,13 +3898,11 @@ void td_cng_enc_init( ); void dtx( - Encoder_State *st, /* i/o: encoder state structure */ -#ifdef NONBE_1211_DTX_BR_SWITCHING + Encoder_State *st, /* i/o: encoder state structure */ const int32_t last_ivas_total_brate, /* i : last IVAS total bitrate */ -#endif - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const int16_t vad, /* i : VAD flag for DTX */ - const float speech[] /* i : Pointer to the speech frame */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t vad, /* i : VAD flag for DTX */ + const float speech[] /* i : Pointer to the speech frame */ ); void dtx_hangover_control( @@ -6767,10 +6756,8 @@ float correlation_shift( void init_coder_ace_plus( Encoder_State *st, /* i : Encoder state handle */ const int32_t last_total_brate, /* i : last total bitrate */ -#ifdef FIX_920_IGF_INIT_ERROR - const int32_t igf_brate, /* i : IGF configuration bitrate */ -#endif - const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ + const int32_t igf_brate, /* i : IGF configuration bitrate */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ); void core_coder_reconfig( @@ -9092,33 +9079,31 @@ int16_t BITS_ALLOC_config_acelp( ); ivas_error config_acelp1( - const int16_t enc_dec, /* i : encoder/decoder flag */ - const int32_t total_brate, /* i : total bitrate */ - const int32_t core_brate_inp, /* i : core bitrate */ - const int16_t core, /* i : core */ - const int16_t extl, /* i : extension layer */ - const int32_t extl_brate, /* i : extension layer bitrate */ - const int16_t L_frame, /* i : frame length at internal Fs */ - const int16_t GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ - ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ - const int16_t signaling_bits, /* i : number of signaling bits */ - const int16_t coder_type, /* i : coder type */ -#ifdef NONBE_FIX_GSC_BSTR + const int16_t enc_dec, /* i : encoder/decoder flag */ + const int32_t total_brate, /* i : total bitrate */ + const int32_t core_brate_inp, /* i : core bitrate */ + const int16_t core, /* i : core */ + const int16_t extl, /* i : extension layer */ + const int32_t extl_brate, /* i : extension layer bitrate */ + const int16_t L_frame, /* i : frame length at internal Fs */ + const int16_t GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ + ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ + const int16_t signaling_bits, /* i : number of signaling bits */ + const int16_t coder_type, /* i : coder type */ const int16_t inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif - const int16_t tc_subfr, /* i : TC subfr ID */ - const int16_t tc_call, /* i : TC call number (0,1,2) */ - int16_t *nBits_es_Pred, /* o : number of bits for Es_pred Q */ - int16_t *unbits, /* o : number of unused bits */ - const int16_t element_mode, /* i : element mode */ - int16_t *uc_two_stage_flag, /* o : flag undicating two-stage UC */ - const int16_t tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel*/ - const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ - const int16_t idchan, /* i : channel id */ - const int16_t active_cnt, /* i : Active frame counter */ - const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ - const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ + const int16_t tc_subfr, /* i : TC subfr ID */ + const int16_t tc_call, /* i : TC call number (0,1,2) */ + int16_t *nBits_es_Pred, /* o : number of bits for Es_pred Q */ + int16_t *unbits, /* o : number of unused bits */ + const int16_t element_mode, /* i : element mode */ + int16_t *uc_two_stage_flag, /* o : flag undicating two-stage UC */ + const int16_t tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel*/ + const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ + const int16_t idchan, /* i : channel id */ + const int16_t active_cnt, /* i : Active frame counter */ + const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ + const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ ); /*! r: ACELP16k flag */ diff --git a/lib_com/stl.h b/lib_com/stl.h index 5389c3c3a27da2664f2c0b94297376002025733e..06e7df889787ca4a196bc185a5b56388d7a9e799 100644 --- a/lib_com/stl.h +++ b/lib_com/stl.h @@ -57,7 +57,6 @@ #ifndef _STL_H #define _STL_H -#include "options.h" /* note: needed until BASOP_NOGLOB is accepted */ #include "typedef.h" #include "basop32.h" #include "wmc_auto.h" diff --git a/lib_com/tools.c b/lib_com/tools.c index 3225cefc5b8a27e378a8eb46d99ed0f5b3f3b7aa..8631bbc153e151d8e9aae0d66f8c76157e9459e6 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -1687,11 +1687,7 @@ double anint( int16_t is_numeric_float( float x ) { -#ifndef BASOP_NOGLOB union float_int -#else /* BASOP_NOGLOB */ - union float_int -#endif /* BASOP_NOGLOB */ { float float_val; int32_t int_val; diff --git a/lib_dec/FEC.c b/lib_dec/FEC.c index b4742e576504bdd94b4b8037d47d4a5cc740585c..deb80c697eb1cf6f2f4087b3f79069cee642dce5 100644 --- a/lib_dec/FEC.c +++ b/lib_dec/FEC.c @@ -332,11 +332,7 @@ void FEC_exc_estim( * Replicate the last spectrum in case the last good frame was coded by GSC *-----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR if ( ( st->last_coder_type == AUDIO || st->last_good == INACTIVE_CLAS ) && st->inactive_coder_type_flag && !st->Opt_AMR_WB ) -#else - if ( ( st->last_coder_type == AUDIO || st->last_good == INACTIVE_CLAS ) && st->total_brate <= MAX_GSC_INACTIVE_BRATE && !st->Opt_AMR_WB ) -#endif { /* Replication of the last spectrum, with a slight downscaling of its dynamic */ st->GSC_noisy_speech = st->Last_GSC_noisy_speech_flag; @@ -409,11 +405,7 @@ void FEC_exc_estim( * Total excitation *-----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR if ( ( st->last_coder_type == AUDIO || st->last_good == INACTIVE_CLAS ) && st->inactive_coder_type_flag && !st->Opt_AMR_WB ) -#else - if ( ( st->last_coder_type == AUDIO || st->last_good == INACTIVE_CLAS ) && st->total_brate <= MAX_GSC_INACTIVE_BRATE && !st->Opt_AMR_WB ) -#endif { /* For GSC - the excitation is already computed */ mvr2r( exc, exc2, st->L_frame ); @@ -547,9 +539,7 @@ static void pulseRes_preCalc( { Word16 tmp_pit, tmp_pit_e, tmp_frame, tmp_frame_e; Word32 tmp_pit2; -#ifdef BASOP_NOGLOB Flag Overflow; -#endif /* BASOP_NOGLOB */ tmp_pit = BASOP_Util_Divide1616_Scale( new_pit /*Q0*/, Tc /*Q0*/, &tmp_pit_e ) /*Q15*/; tmp_frame = add( extract_l( L_mult0( L_frame, 64 /*1.f/L_SUBFR Q12*/ ) /*Q12*/ ), 4096 /*1.f Q12*/ ); /*Q12*/ @@ -557,16 +547,8 @@ static void pulseRes_preCalc( tmp_frame = shl( tmp_frame, add( tmp_frame_e, 1 ) ); tmp_frame = sub( 32767 /*1.f Q15*/, tmp_frame ); /*Q15*/ -#ifndef BASOP_NOGLOB - BASOP_SATURATE_WARNING_OFF -#endif /* ! BASOP_NOGLOB */ /*To calc Q15 threshold, overflow may happen - do negation and compare with negated value to check also highest possible value*/ -#ifndef BASOP_NOGLOB - tmp_pit = shl( negate( tmp_pit ), tmp_pit_e ); - BASOP_SATURATE_WARNING_ON -#else /* BASOP_NOGLOB */ tmp_pit = shl_o( negate( tmp_pit ), tmp_pit_e, &Overflow ); -#endif /* BASOP_NOGLOB */ *cond1 = sub( tmp_pit, negate( tmp_frame ) ); diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index 4b563556f27634949308e1af1b57e47ce6c57b8e..26a0bcff49c76537db982fd61ec733d974ede1fc 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -231,11 +231,7 @@ ivas_error acelp_core_dec( st->hGSCDec->Last_frame_ener = (float) MAX_32; } -#ifdef NON_BE_FIX_807_MASA_DTX_BRSW if ( st->hFdCngDec != NULL && ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) && ( st->last_core_brate == SID_2k40 || st->last_core_brate == FRAME_NO_DATA ) ) -#else - if ( ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) && ( st->last_core_brate == SID_2k40 || st->last_core_brate == FRAME_NO_DATA ) ) -#endif { set_zero( st->hFdCngDec->hFdCngCom->olapBufferSynth2, FFTLEN ); set_zero( hStereoCng->olapBufferSynth22, FFTLEN ); @@ -487,11 +483,7 @@ ivas_error acelp_core_dec( if ( st->element_mode > EVS_MONO && st->idchan == 0 && !( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && !tdm_low_rate_mode ) { -#ifdef NONBE_FIX_1189_GSC_IVAS_OMASA if ( st->coder_type == AUDIO || ( st->coder_type == INACTIVE && st->inactive_coder_type_flag ) ) -#else - if ( st->coder_type == AUDIO || ( st->coder_type == INACTIVE && st->total_brate <= MAX_GSC_INACTIVE_BRATE ) ) -#endif { st->GSC_IVAS_mode = get_next_indice( st, 2 ); } @@ -621,19 +613,11 @@ ivas_error acelp_core_dec( nb_bits = -1; } -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, st->inactive_coder_type_flag, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif if ( st->coder_type == TRANSITION && tc_subfr < L_SUBFR && st->L_frame == L_FRAME ) { -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, TRANSITION, -1, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif } } @@ -855,11 +839,7 @@ ivas_error acelp_core_dec( * Apply energy matching when switching to inactive frames *-----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR inact_switch_ematch( exc2, dct_exc_tmp, st->hGSCDec->lt_ener_per_band, st->coder_type, st->inactive_coder_type_flag, st->L_frame, st->bfi, st->last_core, st->last_codec_mode, tdm_low_rate_mode, st->element_mode ); -#else - inact_switch_ematch( exc2, dct_exc_tmp, st->hGSCDec->lt_ener_per_band, st->coder_type, st->L_frame, st->total_brate, st->bfi, st->last_core, st->last_codec_mode, tdm_low_rate_mode, st->element_mode ); -#endif /*------------------------------------------------------------* * Decode information and modify the excitation signal of stationary unvoiced frames @@ -995,11 +975,7 @@ ivas_error acelp_core_dec( } /* Apply energy matching when switching to inactive frames */ -#ifdef NONBE_FIX_GSC_BSTR inact_switch_ematch( exc2, dct_exc_tmp, st->hGSCDec->lt_ener_per_band, st->coder_type, st->inactive_coder_type_flag, st->L_frame, st->bfi, st->last_core, st->last_codec_mode, tdm_low_rate_mode, st->element_mode ); -#else - inact_switch_ematch( exc2, dct_exc_tmp, st->hGSCDec->lt_ener_per_band, st->coder_type, st->L_frame, st->total_brate, st->bfi, st->last_core, st->last_codec_mode, tdm_low_rate_mode, st->element_mode ); -#endif /* update past excitation signals for LD music post-filter */ if ( st->hMusicPF != NULL ) diff --git a/lib_dec/acelp_core_switch_dec.c b/lib_dec/acelp_core_switch_dec.c index 16a3c5be2e82c67fefeceb43e10965a732818f94..cedc755794b31f49007bbf96e6b590901b2b811c 100644 --- a/lib_dec/acelp_core_switch_dec.c +++ b/lib_dec/acelp_core_switch_dec.c @@ -158,11 +158,7 @@ ivas_error acelp_core_switch_dec( * Excitation decoding *----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( DEC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, GENERIC, st->inactive_coder_type_flag, -1, -1, &decode_bwe /* dummy */, &i, st->element_mode, &i /*dummy*/, 0, 0, st->idchan, st->active_cnt, 0, 0, 0 /*st->GSC_IVAS_mode*/ ); -#else - config_acelp1( DEC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, GENERIC, -1, -1, &decode_bwe /* dummy */, &i, st->element_mode, &i /*dummy*/, 0, 0, st->idchan, st->active_cnt, 0, 0, 0 /*st->GSC_IVAS_mode*/ ); -#endif decod_gen_voic_core_switch( st, L_frame_for_cs, 0, Aq, exc, cbrate ); diff --git a/lib_dec/dec_gen_voic.c b/lib_dec/dec_gen_voic.c index 978b7c036a58a82559c88d97ecd057fcc5f40fa0..06dd4f2f055d9d7d6e51dda1a828fb46ffab8f6d 100644 --- a/lib_dec/dec_gen_voic.c +++ b/lib_dec/dec_gen_voic.c @@ -174,11 +174,7 @@ ivas_error decod_gen_voic( * Transform-domain contribution decoding (inactive frames) *-----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR if ( !st->inactive_coder_type_flag && st->coder_type == INACTIVE ) -#else - if ( st->total_brate >= MAX_GSC_INACTIVE_BRATE && st->coder_type == INACTIVE ) -#endif { transf_cdbk_dec( st, 0, i_subfr, Es_pred, gain_code, &gain_preQ, &norm_gain_preQ, code_preQ, unbits ); } diff --git a/lib_dec/gs_dec.c b/lib_dec/gs_dec.c index 9482eb494e7c8b93cfffe7ab67ac17e4a4e40057..a04a8c6837f196f0d06fea3cb2bf330b8904361f 100644 --- a/lib_dec/gs_dec.c +++ b/lib_dec/gs_dec.c @@ -111,11 +111,7 @@ void decod_audio( } /* set bit-allocation */ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, st->inactive_coder_type_flag, -1, 1, &nb_bits, NULL, st->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, -1, 1, &nb_bits, NULL, st->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif /*---------------------------------------------------------------* * Decode energy dynamics @@ -647,11 +643,7 @@ void gsc_dec( } if ( concat_out[j] < 0 ) { -#ifdef FIX_1027_GSC_INT_OVERFLOW seed_init = (int16_t) ( (int32_t) seed_init + 3 ); -#else - seed_init += 3; -#endif } } diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index b2389c53e698b09a6b255b92ed5b5510613c126a..4ee9187e7b0f2ed7b90bfa33f590f08f92338554 100644 --- a/lib_dec/hq_lr_dec.c +++ b/lib_dec/hq_lr_dec.c @@ -120,9 +120,7 @@ void hq_lr_dec( Word32 L_band_energy[BANDS_MAX], L_band_energy_tmp[BANDS_MAX]; UWord16 lo; Word16 Q_band_energy; -#ifdef BASOP_NOGLOB Flag Overflow; -#endif /* BASOP_NOGLOB */ HQ_DEC_HANDLE hHQ_core = st->hHQ_core; @@ -461,17 +459,10 @@ void hq_lr_dec( move16(); } Mpy_32_16_ss( Ep_avrg_fx, tmp, &L_tmp, &lo ); -#ifndef BASOP_NOGLOB - L_tmp = L_shl( L_tmp, sub( 14, exp ) ); /*Q(13+exp-15 +14-exp+2 = 14) */ - L_tmp = L_max( L_tmp, 16384 ); /*14 */ - tmp = extract_l( L_min( L_tmp, beta_fx ) ); /*14 */ - alpha_fx = shl( mult( alpha_fx, tmp ), 1 ); /*14+14-15 +1=14 */ -#else /* BASOP_NOGLOB */ L_tmp = L_shl_o( L_tmp, sub( 14, exp ), &Overflow ); /*Q(13+exp-15 +14-exp+2 = 14) */ L_tmp = L_max( L_tmp, 16384 ); /*14 */ tmp = extract_l( L_min( L_tmp, beta_fx ) ); /*14 */ alpha_fx = shl( mult( alpha_fx, tmp ), 1 ); /*14+14-15 +1=14 */ -#endif /* BASOP_NOGLOB */ } ELSE { @@ -552,19 +543,10 @@ void hq_lr_dec( Mpy_32_16_ss( Ep_peak_fx, tmp, &L_tmp, &lo ); Mpy_32_16_ss( L_tmp, lowband, &L_tmp, &lo ); Mpy_32_16_ss( L_tmp, 18842, &L_tmp, &lo ); -#ifndef BASOP_NOGLOB - L_tmp = L_shl( L_tmp, sub( 27, exp ) ); /*Q14 0.5 */ - tmp2 = extract_l( L_min( L_tmp, 19661 ) ); /*14 */ -#else /* BASOP_NOGLOB */ - L_tmp = L_shl_o( L_tmp, sub( 27, exp ), &Overflow ); /*Q14 0.5 */ - tmp2 = extract_l( L_min( L_tmp, 19661 ) ); /*14 */ -#endif /* BASOP_NOGLOB */ + L_tmp = L_shl_o( L_tmp, sub( 27, exp ), &Overflow ); /*Q14 0.5 */ + tmp2 = extract_l( L_min( L_tmp, 19661 ) ); /*14 */ Mpy_32_16_ss( L_band_energy_tmp[i], tmp2, &L_tmp, &lo ); -#ifndef BASOP_NOGLOB - L_band_energy_tmp[i] = L_shl( L_tmp, 1 ); /*Q_band_energy */ -#else /* BASOP_NOGLOB */ - L_band_energy_tmp[i] = L_shl_o( L_tmp, 1, &Overflow ); /*Q_band_energy */ -#endif /* BASOP_NOGLOB */ + L_band_energy_tmp[i] = L_shl_o( L_tmp, 1, &Overflow ); /*Q_band_energy */ } } #undef WMC_TOOL_SKIP @@ -587,11 +569,7 @@ void hq_lr_dec( } FOR( i = 0; i < bands; i++ ) { -#ifndef BASOP_NOGLOB - Ep_tmp_fx[i] = L_shl( Ep_tmp_fx[i], 2 ); -#else /* BASOP_NOGLOB */ Ep_tmp_fx[i] = L_shl_o( Ep_tmp_fx[i], 2, &Overflow ); -#endif /* BASOP_NOGLOB */ } IF( st->core_brate == ACELP_13k20 ) { @@ -624,13 +602,8 @@ void hq_lr_dec( { IF( sub( i, lowband ) >= 0 && add( sub( i, bands ), p2a_bands ) < 0 ) { -#ifndef BASOP_NOGLOB - Ep_vari_fx = L_add( Ep_vari_fx, L_abs( L_sub( Ep_tmp_fx[i], Ep_tmp_fx[sub( i, 1 )] ) ) ); /*Q15 */ - Ep_avrg_fx = L_add( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ -#else /* BASOP_NOGLOB */ Ep_vari_fx = L_add_o( Ep_vari_fx, L_abs( L_sub( Ep_tmp_fx[i], Ep_tmp_fx[sub( i, 1 )] ) ), &Overflow ); /*Q15 */ Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ -#endif /* BASOP_NOGLOB */ } IF( sub( i, highband ) >= 0 ) @@ -664,11 +637,7 @@ void hq_lr_dec( tmp = sub( bands, p2a_bands ); tmp = sub( tmp, lowband ); /*Q0 */ -#ifndef BASOP_NOGLOB - tmp1 = extract_h( L_shl( Ep_avrg_fx, 1 ) ); /*Q0 */ -#else - tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ -#endif + tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ IF( tmp1 != 0 ) { exp = norm_s( tmp1 ); @@ -708,11 +677,7 @@ void hq_lr_dec( { tmp = sub( tmp, lowband ); Mpy_32_16_ss( Ep_tmp_fx[i], tmp, &L_tmp, &lo ); -#ifndef BASOP_NOGLOB - tmp = extract_h( L_shl( L_tmp, 16 ) ); /*Q0 */ -#else - tmp = extract_h( L_shl_o( L_tmp, 16, &Overflow ) ); /*Q0 */ -#endif + tmp = extract_h( L_shl_o( L_tmp, 16, &Overflow ) ); /*Q0 */ IF( tmp != 0 ) { exp = norm_s( tmp ); @@ -737,11 +702,7 @@ void hq_lr_dec( { tmp = sub( tmp, lowband ); -#ifndef BASOP_NOGLOB - tmp1 = extract_h( L_shl( Ep_avrg_fx, 1 ) ); /*Q0 */ -#else - tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ -#endif + tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ IF( tmp1 != 0 ) { exp = norm_s( tmp1 ); @@ -780,19 +741,11 @@ void hq_lr_dec( { IF( sub( i, lowband ) >= 0 ) { -#ifndef BASOP_NOGLOB - Ep_avrg_fx = L_add( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ -#else /* BASOP_NOGLOB */ - Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ -#endif /* BASOP_NOGLOB */ + Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ } ELSE { -#ifndef BASOP_NOGLOB - Ep_avrgL_fx = L_add( Ep_avrgL_fx, Ep_tmp_fx[i] ); /*Q15 */ -#else /* BASOP_NOGLOB */ - Ep_avrgL_fx = L_add_o( Ep_avrgL_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ -#endif /* BASOP_NOGLOB */ + Ep_avrgL_fx = L_add_o( Ep_avrgL_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ IF( L_sub( Ep_tmp_fx[i], Ep_peak_fx ) > 0 ) { Ep_peak_fx = Ep_tmp_fx[i]; @@ -812,11 +765,7 @@ void hq_lr_dec( move16(); FOR( i = 0; i < lowband; i++ ) { -#ifndef BASOP_NOGLOB - tmp = extract_h( L_shl( Ep_avrgL_fx, 1 ) ); /*Q0 */ -#else - tmp = extract_h( L_shl_o( Ep_avrgL_fx, 1, &Overflow ) ); /*Q0 */ -#endif + tmp = extract_h( L_shl_o( Ep_avrgL_fx, 1, &Overflow ) ); /*Q0 */ IF( tmp != 0 ) { exp = norm_s( tmp ); diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 9d6270e947bf7cd9dabee5643fc12da3c3ee70b0..86a4ef71ac27132e733647a1c30b597f952033a8 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -189,12 +189,7 @@ ivas_error ivas_core_dec( st->flagGuidedAcelp = 0; } -#ifdef NONBE_MDCT_ST_PLC_DO_NOT_SCALE_OLD_OUT_IF_FIRST_GOOD_IS_SID if ( !st->bfi && st->prev_bfi && st->total_brate > SID_2k40 && ( st->last_core_bfi == TCX_20_CORE || st->last_core_bfi == TCX_10_CORE ) && st->hTcxDec != NULL ) -#else - - if ( !st->bfi && st->prev_bfi && ( st->last_core_bfi == TCX_20_CORE || st->last_core_bfi == TCX_10_CORE ) && st->hTcxDec != NULL ) -#endif { v_multc( st->hHQ_core->old_out, st->hTcxDec->conceal_eof_gain * st->last_concealed_gain_syn_deemph, st->hHQ_core->old_out, st->hTcxDec->L_frameTCX ); v_multc( st->hHQ_core->old_outLB, st->hTcxDec->conceal_eof_gain * st->last_concealed_gain_syn_deemph, st->hHQ_core->old_outLB, st->L_frame ); @@ -407,17 +402,10 @@ ivas_error ivas_core_dec( { updateBuffersForDmxMdctStereo( hCPE, output_frame, output, synth ); } -#ifdef NONBE_MDCT_ST_DTX_SKIP_DEWHITENING_OF_NOISE_SHAPES_ON_SID_FRAMES /* On first good active frame after frameloss undo the whitening of the bg noise shape */ if ( sts[0]->core_brate > SID_2k40 && sts[0]->bfi == 0 && sts[0]->prev_bfi == 1 ) { -#else - - if ( sts[0]->bfi == 0 && sts[0]->prev_bfi == 1 ) - { - /* On first good frame after frameloss undo the whitening of the bg noise shape */ -#endif for ( n = 0; n < n_channels; ++n ) { if ( sts[n]->last_core_bfi != ACELP_CORE ) diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index ca98600a79cdda65ab4eae98e8c0f879a79cadc9..447a56d20802ba4ba465155bc83a9e845a6d00cb 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -307,7 +307,6 @@ void ivas_dirac_dec_output_synthesis_cov_close( *-------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( -#ifdef FIX_835_PARAMMC_BUFFER_VALUES float *RealBuffer, /* i : input channel filter bank samples (real part) */ float *ImagBuffer, /* i : input channel filter bank samples (imaginary part */ float cx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */ @@ -315,65 +314,38 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( const int16_t param_band, /* i : parameter band */ PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */ const int16_t nchan_in /* i : number of input channels */ -#else - float *RealBuffer, /* i : input channel filter bank samples (real part) */ - float *ImagBuffer, /* i : input channel filter bank samples (imaginary part */ - float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */ - float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (imaginary part) */ - PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */ - const int16_t nchan_in /* i : number of input channels */ -#endif ) { -#ifdef FIX_835_PARAMMC_BUFFER_VALUES int16_t band_idx, ch_idx; -#else - int16_t param_band, band_idx, ch_idx; -#endif int16_t brange[2]; float real_in_buffer[PARAM_MC_MAX_BANDS_IN_PARAMETER_BAND * MAX_TRANSPORT_CHANNELS]; float imag_in_buffer[PARAM_MC_MAX_BANDS_IN_PARAMETER_BAND * MAX_TRANSPORT_CHANNELS]; float real_buffer[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; float imag_buffer[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; -/* estimate input covariance */ -#ifndef FIX_835_PARAMMC_BUFFER_VALUES - for ( param_band = 0; param_band < hParamMC->num_param_bands_synth; param_band++ ) - { -#endif - /* Already stack here instead of in the process_subframe */ + /* estimate input covariance */ + /* Already stack here instead of in the process_subframe */ - /* collect input frame */ - int16_t num_bands; - brange[0] = hParamMC->band_grouping[param_band]; - brange[1] = hParamMC->band_grouping[param_band + 1]; - num_bands = brange[1] - brange[0]; + /* collect input frame */ + int16_t num_bands; + brange[0] = hParamMC->band_grouping[param_band]; + brange[1] = hParamMC->band_grouping[param_band + 1]; + num_bands = brange[1] - brange[0]; - for ( band_idx = 0; band_idx < num_bands; band_idx++ ) + for ( band_idx = 0; band_idx < num_bands; band_idx++ ) + { + int16_t band = brange[0] + band_idx; + for ( ch_idx = 0; ch_idx < nchan_in; ch_idx++ ) { - int16_t band = brange[0] + band_idx; - for ( ch_idx = 0; ch_idx < nchan_in; ch_idx++ ) - { - real_in_buffer[band_idx + num_bands * ch_idx] = RealBuffer[ch_idx * hParamMC->num_freq_bands + band]; - imag_in_buffer[band_idx + num_bands * ch_idx] = ImagBuffer[ch_idx * hParamMC->num_freq_bands + band]; - } + real_in_buffer[band_idx + num_bands * ch_idx] = RealBuffer[ch_idx * hParamMC->num_freq_bands + band]; + imag_in_buffer[band_idx + num_bands * ch_idx] = ImagBuffer[ch_idx * hParamMC->num_freq_bands + band]; } + } - cmplx_matrix_square( real_in_buffer, imag_in_buffer, num_bands, nchan_in, real_buffer, imag_buffer ); - -#ifdef FIX_835_PARAMMC_BUFFER_VALUES - v_add( cx, real_buffer, cx, nchan_in * nchan_in ); - - v_add( cx_imag, imag_buffer, cx_imag, nchan_in * nchan_in ); -#else - v_add( cx[param_band], real_buffer, cx[param_band], nchan_in * nchan_in ); + cmplx_matrix_square( real_in_buffer, imag_in_buffer, num_bands, nchan_in, real_buffer, imag_buffer ); - v_add( cx_imag[param_band], imag_buffer, cx_imag[param_band], nchan_in * nchan_in ); -#endif - -#ifndef FIX_835_PARAMMC_BUFFER_VALUES - } -#endif + v_add( cx, real_buffer, cx, nchan_in * nchan_in ); + v_add( cx_imag, imag_buffer, cx_imag, nchan_in * nchan_in ); return; } diff --git a/lib_dec/ivas_lfe_plc.c b/lib_dec/ivas_lfe_plc.c index 39637f33b91a0fe4e0b5e98d189a6ed60cc60b75..9a35a85407f1f2831aff71db431dc9394afe147c 100644 --- a/lib_dec/ivas_lfe_plc.c +++ b/lib_dec/ivas_lfe_plc.c @@ -45,202 +45,15 @@ * Local constants *------------------------------------------------------------------------------------------*/ -#define LFE_PLC_DSF ( 48000 / LFE_PLC_FS ) -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -#define LFE_PLC_LPCORD ( 20 ) -#else -#define LFE_PLC_LPCORD ( MAX_LP_FILTER_ORDER ) -#endif +#define LFE_PLC_DSF ( 48000 / LFE_PLC_FS ) +#define LFE_PLC_LPCORD ( MAX_LP_FILTER_ORDER ) #define POW_THR ( 1.0e-8f ) #define LFE_PLC_RECLEN_48K ( ( IVAS_LFE_NUM_COEFFS_IN_SUBGRP + 1 ) * L_FRAME48k / IVAS_LFE_NUM_COEFFS_IN_SUBGRP + LFE_PLC_FDEL ) #define LFE_PLC_RECLEN ( ( LFE_PLC_RECLEN_48K / LFE_PLC_DSF ) ) #define LFE_PLC_MUTE_THR ( 10 ) -#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT -#define LFE_PLC_BURST_ATT ( powf( powf( 10.0f, -3.0f / 20.0f ), 1.0f / ( LFE_PLC_FS * 20 / 1000 ) ) ) /* attenuate 3dB per frame starting with 10th consecutive loss */ -#define EPS_STOP 1e-5f -#else -#define LFE_PLC_BURST_ATT ( pow( pow( 10.0, -3.0 / 20.0 ), 1.0 / ( LFE_PLC_FS * 0.02 ) ) ) /* attenuate 3dB per frame starting with 10th consecutive loss */ -#define MAX_LEN_LP 960 -#define EPS_STOP 1e-5 -#endif - -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -/*------------------------------------------------------------------------------------------* - * Static function declarations - * - * Note (DLB): the local double precision functions defined below are replica of corresponding - * float functions defined in tools.c, lpc_tools.c and syn_filt.c. - * Double precision arithmetic is required for proper functioning of the lfe_plc. - *------------------------------------------------------------------------------------------*/ - -static void mvr2d( - const float x[], /* i : input vector */ - double y[], /* o : output vector */ - const int16_t n /* i : vector size */ -) -{ - int16_t i; - - if ( n <= 0 ) - { - /* cannot transfer vectors with size 0 */ - return; - } - - for ( i = n - 1; i >= 0; i-- ) - { - y[i] = x[i]; - } - - return; -} - - -/*---------------------------------------------------------------------* - * autocorr() - * - * Compute autocorrelations of input signal - *---------------------------------------------------------------------*/ - -static void d_autocorr( - const double *x, /* i : input signal */ - double *r, /* o : autocorrelations vector */ - const int16_t m, /* i : order of LP filter */ - const int16_t len, /* i : window size */ - const double *wind, /* i : window */ - const int16_t rev_flag, /* i : flag to reverse window */ - const int16_t sym_flag, /* i : symmetric window flag */ - const int16_t no_thr /* i : flag to avoid thresholding */ -) -{ - double t[MAX_LEN_LP]; - double s; - int16_t i, j; - - /* Windowing of signal */ - if ( rev_flag == 1 ) - { - /* time reversed window */ - for ( i = 0; i < len; i++ ) - { - t[i] = x[i] * wind[len - i - 1]; - } - } - else if ( sym_flag == 1 ) - { - /* symmetric window of even length */ - for ( i = 0; i < len / 2; i++ ) - { - t[i] = x[i] * wind[i]; - } - - for ( ; i < len; i++ ) - { - t[i] = x[i] * wind[len - 1 - i]; - } - } - else /* assymetric window */ - { - for ( i = 0; i < len; i++ ) - { - t[i] = x[i] * wind[i]; - } - } - - /* Compute r[1] to r[m] */ - for ( i = 0; i <= m; i++ ) - { - s = t[0] * t[i]; - for ( j = 1; j < len - i; j++ ) - { - s += t[j] * t[i + j]; - } - r[i] = s; - } - - if ( r[0] < 100.0f && no_thr == 0 ) - { - r[0] = 100.0f; - } - - return; -} - - -/*---------------------------------------------------------------------* - * lev_dur() - * - * Wiener-Levinson-Durbin algorithm to compute LP parameters from the autocorrelations - * of input signal - *---------------------------------------------------------------------*/ - -/*! r: energy of prediction error */ -static int16_t d_lev_dur( - double *a, /* o : LP coefficients (a[0] = 1.0) */ - const double *r, /* i : vector of autocorrelations */ - const int16_t m, /* i : order of LP filter */ - double epsP[] /* o : prediction error energy */ -) -{ - int16_t i, j, l; - double buf[TCXLTP_LTP_ORDER]; - double *rc; /* reflection coefficients 0,...,m-1 */ - double s, at, err; - int16_t flag = 0; - - rc = &buf[0]; - rc[0] = ( -r[1] ) / r[0]; - a[0] = 1.0; - a[1] = rc[0]; - err = r[0] + r[1] * rc[0]; - - if ( epsP != NULL ) - { - epsP[0] = r[0]; - epsP[1] = err; - } - - for ( i = 2; i <= m; i++ ) - { - s = 0.0; - for ( j = 0; j < i; j++ ) - { - s += r[i - j] * a[j]; - } - - rc[i - 1] = ( -s ) / err; - - if ( fabs( rc[i - 1] ) > 0.99945f ) - { - flag = 1; /* Test for unstable filter. If unstable keep old A(z) */ - } - - for ( j = 1; j <= i / 2; j++ ) - { - l = i - j; - at = a[j] + rc[i - 1] * a[l]; - a[l] += rc[i - 1] * a[j]; - a[j] = at; - } - - a[i] = rc[i - 1]; - - err += rc[i - 1] * s; - - if ( err <= 0.0f ) - { - err = 0.01f; - } - - if ( epsP != NULL ) - { - epsP[i] = err; - } - } +#define LFE_PLC_BURST_ATT ( powf( powf( 10.0f, -3.0f / 20.0f ), 1.0f / ( LFE_PLC_FS * 20 / 1000 ) ) ) /* attenuate 3dB per frame starting with 10th consecutive loss */ +#define EPS_STOP 1e-5f - return ( flag ); -} -#else /*---------------------------------------------------------------------* * lfeplc_lev_dur() * @@ -308,120 +121,12 @@ static int16_t lfeplc_lev_dur( return 0; } -#endif - -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -/*-------------------------------------------------------------------* - * a2rc() - * - * Convert from LPC to reflection coeff - *-------------------------------------------------------------------*/ -static uint16_t d_a2rc( - const double *a, /* i : LPC coefficients */ - double *refl, /* o : Reflection co-efficients */ - const int16_t lpcorder /* i : LPC order */ -) -{ - double ff[LFE_PLC_LPCORD]; - double km, denom, x; - int16_t m, j, n; - - for ( m = 0; m < lpcorder; m++ ) - { - ff[m] = -a[m]; - } - - /* Initialization */ - for ( m = lpcorder - 1; m >= 0; m-- ) - { - km = ff[m]; - if ( km <= -1.0 || km >= 1.0 ) - { - for ( j = 0; j < lpcorder; j++ ) - { - refl[j] = 0.0; - } - - return 0; - } - - refl[m] = -km; - denom = 1.0 / ( 1.0 - km * km ); - for ( j = 0; j < m / 2; j++ ) - { - n = m - 1 - j; - x = denom * ff[j] + km * denom * ff[n]; - ff[n] = denom * ff[n] + km * denom * ff[j]; - ff[j] = x; - } - - if ( m & 1 ) - { - ff[j] = denom * ff[j] + km * denom * ff[j]; - } - } - - return 1; -} - -static void d_syn_filt( - const double a[], /* i : LP filter coefficients */ - const int16_t m, /* i : order of LP filter */ - const float x[], /* i : input signal */ - float y[], /* o : output signal */ - const int16_t l, /* i : size of filtering */ - const float mem[] /* i : initial filter states */ -) -{ - int16_t i, j; - double buf[LFE_PLC_LPCORD + LFE_PLC_RECLEN]; /* temporary synthesis buffer */ - double s, *yy; - - yy = &buf[0]; - - /*------------------------------------------------------------------* - * copy initial filter states into synthesis buffer and do synthesis - *------------------------------------------------------------------*/ - for ( i = 0; i < m; i++ ) - { - *yy++ = mem[i]; - } - - /*-----------------------------------------------------------------------* - * Do the filtering - *-----------------------------------------------------------------------*/ - - for ( i = 0; i < l; i++ ) - { - s = x[i]; - for ( j = 1; j <= m; j++ ) - { - s -= a[j] * yy[i - j]; - } - - yy[i] = s; - y[i] = (float) s; - } - - return; -} -#endif - /*-----------------------------------------------------------------------------------------* * Function check_stab() * * LPC filter stability check applying given sharpening value delta *-----------------------------------------------------------------------------------------*/ -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -static uint16_t check_stab( - const double *a, - double delta ) -{ - double amod[LFE_PLC_LPCORD], refl[LFE_PLC_LPCORD]; - double fac; - double fac1; -#else static uint16_t check_stab( const float *a, const float delta ) @@ -429,15 +134,10 @@ static uint16_t check_stab( float amod[LFE_PLC_LPCORD], refl[LFE_PLC_LPCORD]; float fac; float fac1; -#endif int16_t i; uint16_t stable; -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - fac = 1.0 + delta; -#else fac = 1.0f + delta; -#endif fac1 = fac; for ( i = 0; i < LFE_PLC_LPCORD; i++ ) @@ -446,11 +146,7 @@ static uint16_t check_stab( fac *= fac1; } -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - stable = d_a2rc( amod, refl, LFE_PLC_LPCORD ); -#else stable = a2rc( amod, refl, LFE_PLC_LPCORD ); -#endif return stable; } @@ -462,30 +158,16 @@ static uint16_t check_stab( * Find maximum LPC filter sharpening by iteration to get a filter that is almost instable *-----------------------------------------------------------------------------------------*/ -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -static double find_max_delta( - double *a ) -{ - double delta; - double eps; - double fac; -#else static float find_max_delta( float *a ) { float delta; float eps; float fac; -#endif uint16_t stable; -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - delta = 0.0; - eps = 0.01; -#else delta = 0.0f; eps = 0.01f; -#endif fac = 2; stable = FALSE; @@ -495,11 +177,7 @@ static float find_max_delta( eps *= fac; stable = TRUE; } -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - fac = 0.5; -#else fac = 0.5f; -#endif if ( stable ) { @@ -521,27 +199,6 @@ static float find_max_delta( delta += eps; stable = check_stab( a, delta ); -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - if ( !stable ) - { - if ( fabs( eps ) > EPS_STOP ) - { - eps = -fabs( eps ) * fac; - } - else - { - eps = -fabs( eps ); - } - } - else - { - if ( fabs( eps ) < EPS_STOP ) - { - break; - } - eps = fabs( eps ) * fac; - } -#else if ( !stable ) { if ( fabsf( eps ) > EPS_STOP ) @@ -561,7 +218,6 @@ static float find_max_delta( } eps = fabsf( eps ) * fac; } -#endif } return delta; @@ -576,54 +232,28 @@ static float find_max_delta( static void recover_samples( const int16_t bfi_count, -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - const float *outbuf, -#else float *outbuf, -#endif float *rec_frame ) { int16_t i; float zeroes[LFE_PLC_RECLEN]; -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - double delta, fac, att; - double d_outbuf[LFE_PLC_BUFLEN], d_r[LFE_PLC_LPCORD + 1], d_a[LFE_PLC_LPCORD + 1], d_pee[LFE_PLC_LPCORD + 1]; - - - mvr2d( outbuf, d_outbuf, LFE_PLC_BUFLEN ); - d_autocorr( d_outbuf, d_r, LFE_PLC_LPCORD, LFE_PLC_BUFLEN, d_hamm_lfe_plc, 0, 1, 1 ); -#else float delta, fac, att; float r[LFE_PLC_LPCORD + 1], a[LFE_PLC_LPCORD + 1]; autocorr( outbuf, r, LFE_PLC_LPCORD, LFE_PLC_BUFLEN, hamm_lfe_plc, 0, 1, 1 ); -#endif -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - if ( d_r[0] < POW_THR * LFE_PLC_BUFLEN ) -#else if ( r[0] < POW_THR * LFE_PLC_BUFLEN ) -#endif { set_zero( rec_frame, LFE_PLC_RECLEN ); return; } -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - d_lev_dur( d_a, d_r, LFE_PLC_LPCORD, d_pee ); - - delta = find_max_delta( d_a + 1 ); - - fac = 1.0 + delta; - att = 1.0; -#else lfeplc_lev_dur( a, r, LFE_PLC_LPCORD ); delta = find_max_delta( a + 1 ); fac = 1.0f + delta; att = 1.0f; -#endif if ( bfi_count >= LFE_PLC_MUTE_THR ) { @@ -633,22 +263,13 @@ static void recover_samples( for ( i = 1; i <= LFE_PLC_LPCORD; i++ ) { -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - d_a[i] = d_a[i] * fac; - fac *= att * ( 1.0 + delta ); -#else a[i] = a[i] * fac; fac *= att * ( 1.0f + delta ); -#endif } set_zero( zeroes, LFE_PLC_RECLEN ); -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - d_syn_filt( d_a, LFE_PLC_LPCORD, zeroes, rec_frame, LFE_PLC_RECLEN, outbuf + LFE_PLC_BUFLEN - LFE_PLC_LPCORD ); -#else syn_filt( a, LFE_PLC_LPCORD, zeroes, rec_frame, LFE_PLC_RECLEN, outbuf + LFE_PLC_BUFLEN - LFE_PLC_LPCORD, 0 ); -#endif return; } @@ -661,12 +282,8 @@ static void recover_samples( *-----------------------------------------------------------------------------------------*/ void ivas_lfe_tdplc( - LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */ -#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT - float *prevsynth, /* i : previous frame synthesis */ -#else - double *prevsynth, /* i : previous frame synthesis */ -#endif + LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */ + float *prevsynth, /* i : previous frame synthesis */ float *ytda, /* o : output time-domain buffer */ const int16_t output_frame /* i : output frame length */ ) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 92c055fe0358ba88b37200a1227c4899a2f8b59c..16c54a9f91e5b79651afed0b430b4be8907be5f8 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -2347,21 +2347,13 @@ static int16_t ivas_decode_masaism_metadata( if ( azimuth * hMasaIsmData->q_azimuth_old[obj] > 0 ) { delta_phi = 180.0f / (float) ( no_phi_masa[bits_ism[obj] - 1][idx_el] ); /* 360/2*/ -#ifdef FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC_FP if ( roundf( 100 * ( no_phi_masa[bits_ism[obj] - 1][idx_el] ) * ( azimuth - hMasaIsmData->q_azimuth_old[obj] ) ) / (float) 100.0f > 180.0f ) -#else - if ( azimuth - hMasaIsmData->q_azimuth_old[obj] > delta_phi ) -#endif { azimuth -= delta_phi; } else { -#ifdef FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC_FP if ( roundf( 100 * ( no_phi_masa[bits_ism[obj] - 1][idx_el] ) * ( hMasaIsmData->q_azimuth_old[obj] - azimuth ) ) / 100.0f > 180.0f ) -#else - if ( hMasaIsmData->q_azimuth_old[obj] - azimuth > delta_phi ) -#endif { azimuth += delta_phi; } diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 1716abb57a7331bb81ad4595317f75250cc20f26..9218e2fc7a8356930fa28807388b794adad6fa81 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -86,17 +86,9 @@ static int16_t ivas_param_mc_uniform_decoder( float *seq, const int16_t sz_seq, static void ivas_param_mc_dequantize_cov( PARAM_MC_DEC_HANDLE hDirAC, float *ild_q, float *icc_q, const int16_t param_band_index, const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nY, const int16_t nX, float *Cx_state, float *Cproto, float *Cy_state ); -#ifdef FIX_835_PARAMMC_BUFFER_VALUES static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], const int16_t param_band_idx, float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nX, const int16_t nY ); -#else -static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nX, const int16_t nY ); -#endif -#ifdef FIX_835_PARAMMC_BUFFER_VALUES static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float Cx_in[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], const int16_t param_band_idx, float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_intern, const int16_t nX, const int16_t nY_cov ); -#else -static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_intern, const int16_t nX, const int16_t nY_cov ); -#endif static void param_mc_update_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float *mixing_matrix[], float *mixing_matrix_res[], const uint16_t nX, const uint16_t nY ); @@ -1338,24 +1330,18 @@ void ivas_param_mc_dec_digest_tc( { PARAM_MC_DEC_HANDLE hParamMC; int16_t i, ch; -#ifdef FIX_835_PARAMMC_BUFFER_VALUES int16_t is_next_band, skip_next_band; -#endif int16_t slot_idx, param_band_idx; int16_t nchan_transport, nchan_out_transport, nchan_out_cldfb; int16_t nchan_out_cov; /*CLDFB*/ -#ifdef FIX_835_PARAMMC_BUFFER_VALUES float *pCx, *pCx_imag; float cx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; float cx_imag[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; float cx_next_band[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; float cx_imag_next_band[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; -#else - float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; -#endif float real_part, imag_part; + /* format converter */ int16_t channel_active[MAX_OUTPUT_CHANNELS]; IVAS_OUTPUT_SETUP *hSynthesisOutputSetup; @@ -1413,7 +1399,6 @@ void ivas_param_mc_dec_digest_tc( ivas_param_mc_dec_compute_interpolator( hParamMC->hMetadataPMC->bAttackPresent, hParamMC->hMetadataPMC->attackIndex, nCldfbSlots, hParamMC->h_output_synthesis_params.interpolator ); -#ifdef FIX_835_PARAMMC_BUFFER_VALUES /* loop over two bands at a time */ for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx += 2 ) { @@ -1537,98 +1522,6 @@ void ivas_param_mc_dec_digest_tc( } } -#else - for ( param_band_idx = 0; param_band_idx < PARAM_MC_MAX_PARAMETER_BANDS; param_band_idx++ ) - { - set_zero( cx[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); - set_zero( cx_imag[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); - } - - /* slot loop for gathering the input data */ - for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) - { - if ( st_ivas->hDecoderConfig->Opt_tsm ) - { - float RealBuffer[CLDFB_NO_CHANNELS_MAX]; - float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; - - /* CLDFB Analysis*/ - for ( ch = 0; ch < nchan_transport; ch++ ) - { - cldfbAnalysis_ts( &( transport_channels_f[ch][hParamMC->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hParamMC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); - - mvr2r( RealBuffer, &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); - mvr2r( ImagBuffer, &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); - } - } - - if ( slot_idx >= 2 * hParamMC->hMetadataPMC->attackIndex ) - { - ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport], - &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport], - cx, - cx_imag, - hParamMC, - nchan_transport ); - } - } - - /* map from complex input covariance to real values */ - for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ ) - { - /* Cx for transport channels */ - for ( i = 0; i < nchan_transport * nchan_transport; i++ ) - { - real_part = cx[param_band_idx][i]; - imag_part = cx_imag[param_band_idx][i]; - - /* (a-ib)(c+id) = ac + bd + i(ad-bc) */ - if ( param_band_idx < hParamMC->max_param_band_abs_cov ) - { - cx[param_band_idx][i] = sqrtf( real_part * real_part + imag_part * imag_part ); - } - else - { - cx[param_band_idx][i] = real_part; - } - } - } - - /* we have to do it similar to the encoder in case of attacks (i.e. accumulate two bands) to ensure correct DMX of the target covariance*/ - if ( hParamMC->hMetadataPMC->bAttackPresent && ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) ) - { - for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx += 2 ) - { - v_add( cx[param_band_idx], cx[param_band_idx + 1], cx[param_band_idx], nchan_transport * nchan_transport ); - mvr2r( cx[param_band_idx], cx[param_band_idx + 1], nchan_transport * nchan_transport ); - } - } - - if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - ivas_param_mc_get_mono_stereo_mixing_matrices( hParamMC, - cx, - hParamMC->h_output_synthesis_cov_state.mixing_matrix, - hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, - nchan_out_transport, - nchan_transport, - nchan_out_cov ); - } - else - { - /* generate mixing matrices */ - ivas_param_mc_get_mixing_matrices( hParamMC, - hSynthesisOutputSetup, - cx, - hParamMC->h_output_synthesis_cov_state.mixing_matrix, - hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, - nchan_out_transport, - hParamMC->synthesis_conf, - nchan_transport, - nchan_out_cov ); - } -#endif - pop_wmops(); return; @@ -2316,7 +2209,6 @@ static void remove_lfe_from_cy( *------------------------------------------------------------------------*/ static void ivas_param_mc_get_mixing_matrices( -#ifdef FIX_835_PARAMMC_BUFFER_VALUES PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : input covariance for all parameter bands */ @@ -2327,22 +2219,8 @@ static void ivas_param_mc_get_mixing_matrices( const PARAM_MC_SYNTHESIS_CONF synth_config, /* i : Parametric MC synthesis config */ const int16_t nX, /* i : number of transport channels */ const int16_t nY_cov /* i : number of covariance synthesis output channels */ -#else - PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ - IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, - float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : input covariance for all parameter bands */ - float *mixing_matrix[], /* o : direct mixing matrices for all parameter bands */ - float *mixing_matrix_res[], /* o : residual mixing matrices for all parameter bands */ - const int16_t nY_intern, /* i : number of channels in the transported format */ - const PARAM_MC_SYNTHESIS_CONF synth_config, /* i : Parametric MC synthesis config */ - const int16_t nX, /* i : number of transport channels */ - const int16_t nY_cov /* i : number of covariance synthesis output channels */ -#endif ) { -#ifndef FIX_835_PARAMMC_BUFFER_VALUES - int16_t param_band_idx; -#endif float Cx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; float Cy[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; float Cy_diag[MAX_CICP_CHANNELS]; @@ -2412,175 +2290,165 @@ static void ivas_param_mc_get_mixing_matrices( num_lfe_bands = PARAM_MC_MAX_BAND_LFE; } -#ifndef FIX_835_PARAMMC_BUFFER_VALUES - for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ ) + + if ( hSynthesisOutputSetup->num_lfe > 0 && param_band_idx >= num_lfe_bands ) { -#endif - if ( hSynthesisOutputSetup->num_lfe > 0 && param_band_idx >= num_lfe_bands ) - { - remove_lfe = 1; - nY_band = nY_cov - hSynthesisOutputSetup->num_lfe; - proto_matrix_ptr = proto_matrix_noLFE; - } - else - { - proto_matrix_ptr = hParamMC->h_output_synthesis_params.proto_matrix; - } + remove_lfe = 1; + nY_band = nY_cov - hSynthesisOutputSetup->num_lfe; + proto_matrix_ptr = proto_matrix_noLFE; + } + else + { + proto_matrix_ptr = hParamMC->h_output_synthesis_params.proto_matrix; + } - brange[0] = hParamMC->band_grouping[param_band_idx]; - brange[1] = hParamMC->band_grouping[param_band_idx + 1]; + brange[0] = hParamMC->band_grouping[param_band_idx]; + brange[1] = hParamMC->band_grouping[param_band_idx + 1]; -#ifdef FIX_835_PARAMMC_BUFFER_VALUES - Cx_state = Cx_in; -#else - Cx_state = Cx_in[param_band_idx]; -#endif - Cx_old_state = hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx]; - Cy_old_state = hParamMC->h_output_synthesis_cov_state.cy_old[param_band_idx]; + Cx_state = Cx_in; + Cx_old_state = hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx]; + Cy_old_state = hParamMC->h_output_synthesis_cov_state.cy_old[param_band_idx]; - /* Getting mixing mtx */ - /* estimate target cov from input cov and proto_matrix */ - matrix_product( hParamMC->proto_matrix_int, nY_intern, nX, 0, Cx_state, nX, nX, 0, mat_mult_buffer1 ); + /* Getting mixing mtx */ + /* estimate target cov from input cov and proto_matrix */ + matrix_product( hParamMC->proto_matrix_int, nY_intern, nX, 0, Cx_state, nX, nX, 0, mat_mult_buffer1 ); - matrix_product( mat_mult_buffer1, nY_intern, nX, 0, hParamMC->proto_matrix_int, nY_intern, nX, 1, Cproto ); + matrix_product( mat_mult_buffer1, nY_intern, nX, 0, hParamMC->proto_matrix_int, nY_intern, nX, 1, Cproto ); - for ( ch_idx1 = 0; ch_idx1 < nY_intern; ch_idx1++ ) + for ( ch_idx1 = 0; ch_idx1 < nY_intern; ch_idx1++ ) + { + if ( Cproto[ch_idx1 + ch_idx1 * nY_intern] < 0.0f ) { - if ( Cproto[ch_idx1 + ch_idx1 * nY_intern] < 0.0f ) - { - Cproto[ch_idx1 + ch_idx1 * nY_intern] = 0.0f; - } + Cproto[ch_idx1 + ch_idx1 * nY_intern] = 0.0f; } + } - ivas_param_mc_dequantize_cov( hParamMC, - hParamMC->icld_q + param_band_idx * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe, - hParamMC->icc_q + param_band_idx * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe, - param_band_idx, nY_cov, - synth_config, - nY_intern, - nX, Cx_state, Cproto, Cy_state ); + ivas_param_mc_dequantize_cov( hParamMC, + hParamMC->icld_q + param_band_idx * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe, + hParamMC->icc_q + param_band_idx * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe, + param_band_idx, nY_cov, + synth_config, + nY_intern, + nX, Cx_state, Cproto, Cy_state ); - /* Smoothing: Sum over two buffers */ - if ( hParamMC->hMetadataPMC->bAttackPresent ) - { - /* no smoothing on attacks */ - mvr2r( Cx_state, Cx, nX * nX ); - mvr2r( Cy_state, Cy_full, nY_cov * nY_cov ); - } - else - { - /* smoothing gains are now identical to one, simply add up */ - v_add( Cx_state, Cx_old_state, Cx, nX * nX ); - v_add( Cy_state, Cy_old_state, Cy_full, nY_cov * nY_cov ); - } + /* Smoothing: Sum over two buffers */ + if ( hParamMC->hMetadataPMC->bAttackPresent ) + { + /* no smoothing on attacks */ + mvr2r( Cx_state, Cx, nX * nX ); + mvr2r( Cy_state, Cy_full, nY_cov * nY_cov ); + } + else + { + /* smoothing gains are now identical to one, simply add up */ + v_add( Cx_state, Cx_old_state, Cx, nX * nX ); + v_add( Cy_state, Cy_old_state, Cy_full, nY_cov * nY_cov ); + } - /* cov buffer update */ - mvr2r( Cx_state, Cx_old_state, nX * nX ); - mvr2r( Cy_state, Cy_old_state, nY_cov * nY_cov ); + /* cov buffer update */ + mvr2r( Cx_state, Cx_old_state, nX * nX ); + mvr2r( Cy_state, Cy_old_state, nY_cov * nY_cov ); - /* remove LFE if necessary */ - if ( remove_lfe ) - { - remove_lfe_from_cy( nY_cov, lfe_indices, hSynthesisOutputSetup->num_lfe, Cy_full, Cy ); - } - else - { - mvr2r( Cy_full, Cy, nY_band * nY_band ); - } + /* remove LFE if necessary */ + if ( remove_lfe ) + { + remove_lfe_from_cy( nY_cov, lfe_indices, hSynthesisOutputSetup->num_lfe, Cy_full, Cy ); + } + else + { + mvr2r( Cy_full, Cy, nY_band * nY_band ); + } - matrix_product( proto_matrix_ptr, nY_band, nX, 0, Cx, nX, nX, 0, mat_mult_buffer1 ); + matrix_product( proto_matrix_ptr, nY_band, nX, 0, Cx, nX, nX, 0, mat_mult_buffer1 ); - matrix_product_diag( mat_mult_buffer1, nY_band, nX, 0, proto_matrix_ptr, nY_band, nX, 1, Cproto_diag ); + matrix_product_diag( mat_mult_buffer1, nY_band, nX, 0, proto_matrix_ptr, nY_band, nX, 1, Cproto_diag ); - /* make sure we have no negative entries in Cproto_diag due to rounding errors */ - for ( ch_idx1 = 0; ch_idx1 < nY_band; ch_idx1++ ) + /* make sure we have no negative entries in Cproto_diag due to rounding errors */ + for ( ch_idx1 = 0; ch_idx1 < nY_band; ch_idx1++ ) + { + if ( Cproto_diag[ch_idx1] < 0.0f ) { - if ( Cproto_diag[ch_idx1] < 0.0f ) - { - Cproto_diag[ch_idx1] = 0.0f; - } + Cproto_diag[ch_idx1] = 0.0f; } + } - /* Computing the mixing matrices */ + /* Computing the mixing matrices */ - /* bands with decorr */ - if ( brange[0] < hParamMC->h_output_synthesis_params.max_band_decorr ) - { - computeMixingMatrices( nX, nY_band, Cx, Cy, proto_matrix_ptr, 0, PARAM_MC_REG_SX, PARAM_MC_REG_GHAT, mixing_matrix_local, Cr ); + /* bands with decorr */ + if ( brange[0] < hParamMC->h_output_synthesis_params.max_band_decorr ) + { + computeMixingMatrices( nX, nY_band, Cx, Cy, proto_matrix_ptr, 0, PARAM_MC_REG_SX, PARAM_MC_REG_GHAT, mixing_matrix_local, Cr ); - /* Compute mixing matrix for residual */ - computeMixingMatricesResidual( nY_band, Cproto_diag, Cr, PARAM_MC_REG_SX, PARAM_MC_REG_GHAT, mixing_matrix_res_local ); + /* Compute mixing matrix for residual */ + computeMixingMatricesResidual( nY_band, Cproto_diag, Cr, PARAM_MC_REG_SX, PARAM_MC_REG_GHAT, mixing_matrix_res_local ); - if ( remove_lfe ) - { - set_zero( mixing_matrix_res[param_band_idx], nY_cov * nY_cov ); + if ( remove_lfe ) + { + set_zero( mixing_matrix_res[param_band_idx], nY_cov * nY_cov ); - ptrMM = mixing_matrix_res_local; - ptrMM_out = mixing_matrix_res[param_band_idx]; - for ( lfe_idx1 = 0; lfe_idx1 < hSynthesisOutputSetup->num_lfe + 1; lfe_idx1++ ) + ptrMM = mixing_matrix_res_local; + ptrMM_out = mixing_matrix_res[param_band_idx]; + for ( lfe_idx1 = 0; lfe_idx1 < hSynthesisOutputSetup->num_lfe + 1; lfe_idx1++ ) + { + for ( ch_idx1 = lfe_indices[lfe_idx1] + 1; ch_idx1 < lfe_indices[lfe_idx1 + 1]; ch_idx1++ ) { - for ( ch_idx1 = lfe_indices[lfe_idx1] + 1; ch_idx1 < lfe_indices[lfe_idx1 + 1]; ch_idx1++ ) + for ( lfe_idx2 = 0; lfe_idx2 < hSynthesisOutputSetup->num_lfe + 1; lfe_idx2++ ) { - for ( lfe_idx2 = 0; lfe_idx2 < hSynthesisOutputSetup->num_lfe + 1; lfe_idx2++ ) + for ( ch_idx2 = lfe_indices[lfe_idx2] + 1; ch_idx2 < lfe_indices[lfe_idx2 + 1]; ch_idx2++ ) { - for ( ch_idx2 = lfe_indices[lfe_idx2] + 1; ch_idx2 < lfe_indices[lfe_idx2 + 1]; ch_idx2++ ) - { - *( ptrMM_out++ ) = *( ptrMM++ ); - } - ptrMM_out++; + *( ptrMM_out++ ) = *( ptrMM++ ); } - ptrMM_out--; + ptrMM_out++; } - ptrMM_out += nY_cov; + ptrMM_out--; } + ptrMM_out += nY_cov; } - else - { - mvr2r( mixing_matrix_res_local, mixing_matrix_res[param_band_idx], nY_cov * nY_cov ); - } - } - else if ( brange[0] < hParamMC->max_band_energy_compensation ) - { - /* Compute mixing matrices (energy compensation only) */ - computeMixingMatrices( nX, nY_band, Cx, Cy, proto_matrix_ptr, 1, PARAM_MC_REG_SX, PARAM_MC_REG_GHAT, mixing_matrix_local, Cr ); } else { - /*if neither decorrelation nor energy compensation is applied*/ - for ( i = 0; i < nY_band; i++ ) - { - Cy_diag[i] = Cy[i + nY_band * i]; - Cy_diag[i] = sqrtf( Cy_diag[i] / ( Cproto_diag[i] + EPSILON ) ); - } - - diag_matrix_product( Cy_diag, nY_band, proto_matrix_ptr, nY_band, nX, 0, mixing_matrix_local ); + mvr2r( mixing_matrix_res_local, mixing_matrix_res[param_band_idx], nY_cov * nY_cov ); } - if ( remove_lfe ) + } + else if ( brange[0] < hParamMC->max_band_energy_compensation ) + { + /* Compute mixing matrices (energy compensation only) */ + computeMixingMatrices( nX, nY_band, Cx, Cy, proto_matrix_ptr, 1, PARAM_MC_REG_SX, PARAM_MC_REG_GHAT, mixing_matrix_local, Cr ); + } + else + { + /*if neither decorrelation nor energy compensation is applied*/ + for ( i = 0; i < nY_band; i++ ) { - set_zero( mixing_matrix[param_band_idx], nX * nY_cov ); + Cy_diag[i] = Cy[i + nY_band * i]; + Cy_diag[i] = sqrtf( Cy_diag[i] / ( Cproto_diag[i] + EPSILON ) ); + } + + diag_matrix_product( Cy_diag, nY_band, proto_matrix_ptr, nY_band, nX, 0, mixing_matrix_local ); + } + if ( remove_lfe ) + { + set_zero( mixing_matrix[param_band_idx], nX * nY_cov ); - ptrMM = mixing_matrix_local; - ptrMM_out = mixing_matrix[param_band_idx]; - for ( ch_idx1 = 0; ch_idx1 < nX; ch_idx1++ ) + ptrMM = mixing_matrix_local; + ptrMM_out = mixing_matrix[param_band_idx]; + for ( ch_idx1 = 0; ch_idx1 < nX; ch_idx1++ ) + { + for ( lfe_idx1 = 0; lfe_idx1 < hSynthesisOutputSetup->num_lfe + 1; lfe_idx1++ ) { - for ( lfe_idx1 = 0; lfe_idx1 < hSynthesisOutputSetup->num_lfe + 1; lfe_idx1++ ) + for ( ch_idx2 = lfe_indices[lfe_idx1] + 1; ch_idx2 < lfe_indices[lfe_idx1 + 1]; ch_idx2++ ) { - for ( ch_idx2 = lfe_indices[lfe_idx1] + 1; ch_idx2 < lfe_indices[lfe_idx1 + 1]; ch_idx2++ ) - { - *( ptrMM_out++ ) = *( ptrMM++ ); - } - ptrMM_out++; + *( ptrMM_out++ ) = *( ptrMM++ ); } - ptrMM_out--; + ptrMM_out++; } + ptrMM_out--; } - else - { - mvr2r( mixing_matrix_local, mixing_matrix[param_band_idx], nY_cov * nX ); - } -#ifndef FIX_835_PARAMMC_BUFFER_VALUES } -#endif + else + { + mvr2r( mixing_matrix_local, mixing_matrix[param_band_idx], nY_cov * nX ); + } return; } @@ -2594,7 +2462,6 @@ static void ivas_param_mc_get_mixing_matrices( *------------------------------------------------------------------------*/ static void ivas_param_mc_get_mono_stereo_mixing_matrices( -#ifdef FIX_835_PARAMMC_BUFFER_VALUES PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ float Cx_in[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : transport channel covariance for all parameter bands */ const int16_t param_band_idx, /* i : parameter band index */ @@ -2603,20 +2470,8 @@ static void ivas_param_mc_get_mono_stereo_mixing_matrices( const int16_t nY_intern, /* i : number of channels of the transport format */ const int16_t nX, /* i : number of transport channels */ const int16_t nY_cov /* i : number of output channels */ -#else - PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ - float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : transport channel covariance for all parameter bands */ - float *mixing_matrix[], /* o : direct mixing matrices for all parameter bands */ - float *mixing_matrix_res[], /* o : residual mixing matrices for all parameter bands */ - const int16_t nY_intern, /* i : number of channels of the transport format */ - const int16_t nX, /* i : number of transport channels */ - const int16_t nY_cov /* i : number of output channels */ -#endif ) { -#ifndef FIX_835_PARAMMC_BUFFER_VALUES - int16_t param_band_idx; -#endif float Cy_full[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; float mixing_matrix_woLFE[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; float Nrqq[MAX_OUTPUT_CHANNELS]; @@ -2644,84 +2499,6 @@ static void ivas_param_mc_get_mono_stereo_mixing_matrices( mvr2r( hParamMC->h_output_synthesis_params.proto_matrix, proto_matrix, nY_cov * nX ); nY_band = nY_cov; -#ifndef FIX_835_PARAMMC_BUFFER_VALUES - for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ ) - { - Cx_state = Cx_in[param_band_idx]; - Cx_old_state = hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx]; - Cy_old_state = hParamMC->h_output_synthesis_cov_state.cy_old[param_band_idx]; - - set_zero( Nrqq, MAX_OUTPUT_CHANNELS ); - set_zero( target_ch_ener, MAX_OUTPUT_CHANNELS ); - set_zero( Cy_full, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); - set_zero( Cy_state, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); - set_zero( Cproto_diag, MAX_CICP_CHANNELS ); - ild_q = hParamMC->icld_q + param_band_idx * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe; - - /*get back Nrg*/ - for ( k = 0; k < nY_intern; k++ ) - { - float ref_ener = 0.0f; - int16_t ref_channel_cnt; - int16_t ref_channel_idx; - - for ( ref_channel_cnt = 0; ref_channel_cnt < hParamMC->hMetadataPMC->ild_mapping_conf->num_ref_channels[k]; ref_channel_cnt++ ) - { - ref_channel_idx = hParamMC->hMetadataPMC->ild_mapping_conf->ref_channel_idx[k][ref_channel_cnt]; - ref_ener += Cx_state[ref_channel_idx + ref_channel_idx * nX]; - } - Nrqq[hParamMC->hMetadataPMC->ild_mapping_conf->ild_index[k]] = powf( 10.0f, ild_q[k] / 10.0f ) * hParamMC->hMetadataPMC->ild_factors[k] * ref_ener; - } - for ( k = 0; k < nY_cov; k++ ) - { - for ( l = 0; l < nY_intern; l++ ) - { - target_ch_ener[k] += hParamMC->ls_conv_dmx_matrix[k + l * nY_cov] * Nrqq[l]; - } - Cy_state[k + nY_cov * k] = target_ch_ener[k]; - } - - /* Smoothing: Sum over two buffers */ - if ( hParamMC->hMetadataPMC->bAttackPresent ) - { - /* no smoothing on attacks */ - mvr2r( Cx_state, Cx, nX * nX ); - mvr2r( Cy_state, Cy_full, nY_cov * nY_cov ); - } - else - { - /* smoothing gains are now identical to one, simply add up */ - v_add( Cx_state, Cx_old_state, Cx, nX * nX ); - v_add( Cy_state, Cy_old_state, Cy_full, nY_cov * nY_cov ); - } - - /* cov buffer update */ - mvr2r( Cx_state, Cx_old_state, nX * nX ); - mvr2r( Cy_state, Cy_old_state, nY_cov * nY_cov ); - - - matrix_product( proto_matrix, nY_band, nX, 0, Cx, nX, nX, 0, mat_mult_buffer1 ); - - matrix_product_diag( mat_mult_buffer1, nY_band, nX, 0, proto_matrix, nY_band, nX, 1, Cproto_diag ); - - /* Computing the mixing matrices */ - for ( i = 0; i < nY_band; i++ ) - { - Cy_diag[i] = Cy_full[i + nY_band * i]; - Cy_diag[i] = sqrtf( Cy_diag[i] / ( Cproto_diag[i] + EPSILON ) ); - } - - diag_matrix_product( Cy_diag, nY_band, proto_matrix, nY_band, nX, 0, mixing_matrix_woLFE ); - - mvr2r( mixing_matrix_woLFE, mixing_matrix[param_band_idx], nY_cov * nX ); - if ( hParamMC->band_grouping[param_band_idx] < hParamMC->h_output_synthesis_params.max_band_decorr ) - { - set_zero( mixing_matrix_res[param_band_idx], nY_cov * nY_cov ); - } - } - -#else - Cx_state = Cx_in; Cx_old_state = hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx]; Cy_old_state = hParamMC->h_output_synthesis_cov_state.cy_old[param_band_idx]; @@ -2792,7 +2569,6 @@ static void ivas_param_mc_get_mono_stereo_mixing_matrices( { set_zero( mixing_matrix_res[param_band_idx], nY_cov * nY_cov ); } -#endif return; } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index fc9265a1be35c8184c8492c5bdc16c7782a5addf..d184fb890df35052a57a5292500d20d06787c6f6 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -83,9 +83,7 @@ ivas_error ivas_mct_dec( STnsData tnsData[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; Decoder_State **sts; float synth[CPE_CHANNELS][L_FRAME_PLUS]; -#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS float *p_output_orig[2]; -#endif float output_lfe_ch[L_FRAME48k]; int32_t ivas_total_brate; ivas_error error; @@ -147,7 +145,6 @@ ivas_error ivas_mct_dec( /* MCT side bits decoder */ ivas_mct_side_bits( hMCT, st_ivas->hCPE, nCPE, st_ivas->hCPE[0]->hCoreCoder[0], st_ivas->bfi, st_ivas->hCPE[0]->hCoreCoder[0]->bit_stream, ivas_total_brate, nb_bits_metadata ); -#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS /* in case of switching from an SID frame (with ACELP core) to MCT, buffer of L_FRAME_PLUS samples is needed -> use synth[] as a temporary buffer */ if ( st_ivas->hCPE[0]->hCoreCoder[0]->last_core == ACELP_CORE ) { @@ -157,7 +154,6 @@ ivas_error ivas_mct_dec( output[n] = synth[n]; } } -#endif for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { @@ -243,7 +239,6 @@ ivas_error ivas_mct_dec( ivas_mdct_core_reconstruct( hCPE, x, synth, fUseTns[cpe_id], 1 ); -#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS /* set pointers back */ if ( cpe_id == 0 && st_ivas->hCPE[0]->hCoreCoder[0]->last_core == ACELP_CORE ) { @@ -253,7 +248,6 @@ ivas_error ivas_mct_dec( } } -#endif /*----------------------------------------------------------------* * CoreCoder Post-processing and updates *----------------------------------------------------------------*/ @@ -1199,15 +1193,11 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hBinRendererTd != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) ) { -#ifdef FIX_1033_MEMORY_LEAK_OMASA if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) { -#endif ivas_td_binaural_close( &st_ivas->hBinRendererTd ); st_ivas->hHrtfTD = NULL; -#ifdef FIX_1033_MEMORY_LEAK_OMASA } -#endif } if ( st_ivas->hDiracDecBin != NULL ) diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 27d468a21bdd624360299638507eede940c4bd0a..dd0bfac76dcf3c64dc273e6d6733f25c12cd018d 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -865,7 +865,6 @@ void ivas_mdct_core_reconstruct( { set_f( &synth[k * L_frame[ch]], 0.f, L_frame[ch] ); set_f( &synthFB[k * L_frame[ch]], 0.f, L_frameTCX[ch] ); -#ifdef FIX_903_ZERO_OUT_IMDCT_BUFFERS_FOR_MCT_IGNORE /* Note: these buffers are not subframe-based, hence no indexing with k */ set_f( &st->hHQ_core->old_outLB[0], 0.f, L_frame[ch] ); set_f( &st->hHQ_core->old_out[0], 0.f, L_frameTCX[ch] ); @@ -873,7 +872,6 @@ void ivas_mdct_core_reconstruct( set_f( &st->hTcxDec->syn_OverlFB[0], 0.f, L_frameTCX[ch] / 2 ); set_f( &st->hTcxDec->syn_Overl_TDAC[0], 0.f, L_frame[ch] / 2 ); set_f( &st->hTcxDec->syn_Overl_TDACFB[0], 0.f, L_frameTCX[ch] / 2 ); -#endif } } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index a0cb26f69bf21775a138443a643e56536bb62530..0af1c6751fd71848d00043a973bfb19e9a6cc4ad 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -313,17 +313,13 @@ ivas_error ivas_omasa_dec_config( if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { /* Allocate TD renderer for the objects in DISC mode */ -#ifdef FIX_1033_MEMORY_LEAK_OMASA if ( st_ivas->hBinRendererTd == NULL ) { -#endif if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } -#ifdef FIX_1033_MEMORY_LEAK_OMASA } -#endif /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ if ( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) @@ -334,16 +330,12 @@ ivas_error ivas_omasa_dec_config( else { /* TD renderer handle */ -#ifdef FIX_1033_MEMORY_LEAK_OMASA if ( st_ivas->hBinRendererTd != NULL && st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) { -#endif /* TD renderer handle */ ivas_td_binaural_close( &st_ivas->hBinRendererTd ); st_ivas->hHrtfTD = NULL; -#ifdef FIX_1033_MEMORY_LEAK_OMASA } -#endif /* ISM renderer handle + ISM data handle */ ivas_omasa_separate_object_renderer_close( st_ivas ); diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 9e66d0ace83e4d1ba3fb0871486c833e2623062e..d91a8b5b644f23f6249813fb8efe42b0b0e60454 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -40,9 +40,7 @@ #include "ivas_rom_dec.h" #include "wmc_auto.h" #include "prot.h" -#ifdef NONBE_1319_M2R_PRECISION_ALIGN #include "basop_settings.h" -#endif /*-----------------------------------------------------------------------* * Local function prototypes @@ -100,11 +98,7 @@ static int16_t read_surround_coherence_hr( uint16_t *bitstream, int16_t *p_bit_p static int16_t read_coherence_data_hr_512( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData, const int16_t idx_dir, const int16_t nbits_coh ); -#ifdef NONBE_1319_M2R_PRECISION_ALIGN static void read_stream_dct_coeffs_omasa( int16_t *q_idx, Word32 *q_dct_data_fx, const int16_t len_stream, uint16_t *bit_stream, int16_t *index, const int16_t first_line ); -#else -static void read_stream_dct_coeffs_omasa( int16_t *q_idx, float *q_dct_data, const int16_t len_stream, uint16_t *bit_stream, int16_t *index, const int16_t first_line ); -#endif /*-----------------------------------------------------------------------* * Global function definitions @@ -4076,9 +4070,7 @@ static int16_t read_surround_coherence_hr( IVAS_QDIRECTION *q_direction; int16_t min_index; int16_t d, idx; -#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP int32_t int_error_ratio_surr; -#endif coding_subbands = hQMetaData->q_direction[0].cfg.nbands; q_direction = hQMetaData->q_direction; @@ -4101,10 +4093,10 @@ static int16_t read_surround_coherence_hr( { error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[sf]; } -#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP + int_error_ratio_surr = (int32_t) ( MASA_SUR_COH_PRECISION * error_ratio_surr ); error_ratio_surr = (float) ( int_error_ratio_surr * MASA_SUR_COH_THRESHOLD ); -#endif + if ( error_ratio_surr <= 0 ) { error_ratio_surr = 0; @@ -4253,11 +4245,7 @@ static void decode_combined_index( static void read_stream_dct_coeffs_omasa( int16_t *q_idx, -#ifdef NONBE_1319_M2R_PRECISION_ALIGN Word32 *q_dct_data_fx, -#else - float *q_dct_data, -#endif const int16_t len_stream, uint16_t *bit_stream, int16_t *index, @@ -4265,16 +4253,9 @@ static void read_stream_dct_coeffs_omasa( { int16_t sign, nbits; int16_t i, j, i_min; -#ifndef NONBE_1319_M2R_PRECISION_ALIGN - float step; -#endif int16_t GR1, GR2; -#ifdef NONBE_1319_M2R_PRECISION_ALIGN int64_t step_fx; step_fx = STEP_M2T_FX; -#else - step = STEP_M2T; -#endif nbits = 0; sign = 1; if ( first_line == 0 ) @@ -4341,7 +4322,6 @@ static void read_stream_dct_coeffs_omasa( } /* deindex */ -#ifdef NONBE_1319_M2R_PRECISION_ALIGN q_dct_data_fx[0] = (Word32) ( ( step_fx * q_idx[0] ) >> 6 ); /* Q25 */ for ( i = 1; i < len_stream; i++ ) { @@ -4354,20 +4334,7 @@ static void read_stream_dct_coeffs_omasa( q_dct_data_fx[i] = (Word32) ( ( step_fx * ( q_idx[i] + 1 ) ) >> 7 ); /* Q25 */ } } -#else - q_dct_data[0] = q_idx[0] * step; - for ( i = 1; i < len_stream; i++ ) - { - if ( ( q_idx[i] % 2 ) == 0 ) - { - q_dct_data[i] = -( q_idx[i] >> 1 ) * step; - } - else - { - q_dct_data[i] = ( ( q_idx[i] + 1 ) >> 1 ) * step; - } - } -#endif + return; } @@ -4386,19 +4353,10 @@ void ivas_omasa_decode_masa_to_total( { int16_t i, j, k; int16_t q_idx[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; -#ifdef NONBE_1319_M2R_PRECISION_ALIGN Word32 q_dct_data_fx[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS], dct_data_tmp_fx[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; -#else - float q_dct_data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS], - dct_data_tmp[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; -#endif int16_t n_streams, len_stream; -#ifndef NONBE_1319_M2R_PRECISION_ALIGN -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL - int32_t int_tmp; -#endif -#endif + /* Setup coding parameters */ n_streams = 1; len_stream = nbands * nblocks; @@ -4412,16 +4370,11 @@ void ivas_omasa_decode_masa_to_total( for ( i = 0; i < n_streams; i++ ) { read_stream_dct_coeffs_omasa( &q_idx[i * len_stream], -#ifdef NONBE_1319_M2R_PRECISION_ALIGN &q_dct_data_fx[i * len_stream], -#else - &q_dct_data[i * len_stream], -#endif len_stream, bit_stream, index, i == 0 ); } /* inverse DCT2 transform */ -#ifdef NONBE_1319_M2R_PRECISION_ALIGN SWITCH( len_stream ) { case 4: @@ -4499,82 +4452,5 @@ void ivas_omasa_decode_masa_to_total( } } -#else - switch ( len_stream ) - { - case 4: - matrix_product( dct4, nblocks, nblocks, 1, q_dct_data, nblocks, 1, 0, dct_data_tmp ); - mvr2r( dct_data_tmp, q_dct_data, nblocks ); - break; - case 5: - matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); - mvr2r( dct_data_tmp, q_dct_data, nbands ); - break; - case 8: - matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); - mvr2r( dct_data_tmp, q_dct_data, nbands ); - break; - case 12: - matrix_product( dct12, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); - mvr2r( dct_data_tmp, q_dct_data, nbands ); - break; - case 20: - matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, nblocks, 0, dct_data_tmp ); - matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 0, q_dct_data ); /* reuse of variable*/ - break; - case 32: - matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, nblocks, 0, dct_data_tmp ); - matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 0, q_dct_data ); - break; - default: - printf( "Incorrect number of coefficients for OMASA.\n" ); - break; - } - - k = 0; - for ( i = 0; i < nblocks; i++ ) - { - for ( j = 0; j < nbands; j++ ) - { - masa_to_total_energy_ratio[i][j] = max( 0.0f, q_dct_data[k] ); - masa_to_total_energy_ratio[i][j] = min( 1.0f, masa_to_total_energy_ratio[i][j] ); -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL - int_tmp = (int32_t) ( MASA2TOTAL_PREC_INV_THRESHOLD * masa_to_total_energy_ratio[i][j] ); - masa_to_total_energy_ratio[i][j] = (float) ( int_tmp * MASA2TOTAL_PREC_THRESHOLD ); -#endif - k++; - } - } - - if ( nblocks == 1 ) - { - for ( i = 1; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - for ( j = 0; j < nbands; j++ ) - { - masa_to_total_energy_ratio[i][j] = masa_to_total_energy_ratio[0][j]; -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL - int_tmp = (int32_t) ( MASA2TOTAL_PREC_INV_THRESHOLD * masa_to_total_energy_ratio[i][j] ); - masa_to_total_energy_ratio[i][j] = (float) ( int_tmp * MASA2TOTAL_PREC_THRESHOLD ); -#endif - } - } - } - - if ( nbands == 1 ) - { - for ( j = 1; j < 5; j++ ) - { - for ( i = 0; i < nblocks; i++ ) - { - masa_to_total_energy_ratio[i][j] = masa_to_total_energy_ratio[i][0]; -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL - int_tmp = (int32_t) ( MASA2TOTAL_PREC_INV_THRESHOLD * masa_to_total_energy_ratio[i][j] ); - masa_to_total_energy_ratio[i][j] = (float) ( int_tmp * MASA2TOTAL_PREC_THRESHOLD ); -#endif - } - } - } -#endif return; } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index ac4e155b8ecc7ad80b9b5b4f7242519cc41acb54..13c3dc4fa711f2c745dbed5dd5887ac8872158cd 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -296,11 +296,7 @@ ivas_error ivas_sba_dec_reconfigure( } } -#ifdef NONBE_FIX_708_OSBA_BR_SWITCHING_CRASH if ( hSpar->hPCA == NULL && st_ivas->hDecoderConfig->ivas_total_brate == PCA_BRATE && st_ivas->sba_order == 1 && ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) ) -#else - if ( hSpar->hPCA == NULL && st_ivas->hDecoderConfig->ivas_total_brate == PCA_BRATE && st_ivas->sba_order == 1 && st_ivas->ivas_format == SBA_FORMAT ) -#endif { if ( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL ) { diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index 933a16d6a916ab635b294806e2f6304d13c227da..52262a9e8fe2af2205b2146115a6dc6e45651467 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -395,7 +395,6 @@ static void map_params_dirac_to_stereo( } } -#ifdef NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO /* Clamp values here. [-1, 1] is the allowed range, but due to precision issues they can be slightly off which can cause problems later. */ side_gain[b] *= sqrtf( 1.f - diffuseness[b] ); side_gain[b] = max( min( side_gain[b], 1 ), -1 ); @@ -406,12 +405,6 @@ static void map_params_dirac_to_stereo( res_pred_gain[b] = max( min( res_pred_gain[b], 1 ), 0 ); res_pred_gain[b + STEREO_DFT_BAND_MAX] = diffuseness[b] * ( 1.0f - surrCoh[b] ); res_pred_gain[b + STEREO_DFT_BAND_MAX] = max( min( res_pred_gain[b + STEREO_DFT_BAND_MAX], 1 ), 0 ); -#else - side_gain[b] *= sqrtf( 1.f - diffuseness[b] ); - side_gain[b + STEREO_DFT_BAND_MAX] *= sqrtf( 1.f - diffuseness[b] ); - res_pred_gain[b] = diffuseness[b] * ( 1.0f - surrCoh[b] ); - res_pred_gain[b + STEREO_DFT_BAND_MAX] = diffuseness[b] * ( 1.0f - surrCoh[b] ); -#endif } } diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 4189adec7003d12cd1b979b8d3dab66e8e4202bd..3bc98a006749a36e840e01a45cef3fc7c00bc4c3 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -2947,11 +2947,7 @@ void stereo_dft_dec_smooth_parameters( if ( hStereoDft->frame_sid_nodata ) { /* set new xfade target if new itd received */ -#ifdef NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO if ( hStereoDft->ipd_xfade_counter < STEREO_DFT_ITD_CNG_XFADE ) -#else - if ( hStereoDft->gipd[k + k_offset] != hStereoDft->ipd_xfade_target ) -#endif { if ( ( hStereoDft->gipd[k + k_offset] - hStereoDft->ipd_xfade_prev ) > EVS_PI ) { @@ -2997,11 +2993,7 @@ void stereo_dft_dec_smooth_parameters( if ( hStereoDft->frame_sid_nodata ) { /* set new xfade target if new itd received */ -#ifdef NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO if ( hStereoDft->itd_xfade_counter < STEREO_DFT_ITD_CNG_XFADE ) -#else - if ( hStereoDft->itd[k + k_offset] != hStereoDft->itd_xfade_target ) -#endif { hStereoDft->itd_xfade_target = hStereoDft->itd[k + k_offset]; hStereoDft->itd_xfade_step = ( hStereoDft->itd_xfade_target - hStereoDft->itd_xfade_prev ) / ( STEREO_DFT_ITD_CNG_XFADE - hStereoDft->itd_xfade_counter ); diff --git a/lib_dec/ivas_stereo_dft_plc.c b/lib_dec/ivas_stereo_dft_plc.c index f7c482763eeef00d63a32d483dc9fd3388701f71..2186aa1b1cff6f5a85042535552f4d508ac74f19 100644 --- a/lib_dec/ivas_stereo_dft_plc.c +++ b/lib_dec/ivas_stereo_dft_plc.c @@ -80,9 +80,7 @@ void stereo_dft_res_ecu( float fac; float trigo_dec[STEREO_DFT32MS_N_8k / 2 + 1]; int16_t trigo_step; -#ifdef NONBE_FIX_943_PORT_1208_DFT_STEREO_PLC_BURST int16_t time_offs; -#endif set_zero( pDFT_RES, L_FRAME8k ); @@ -109,12 +107,8 @@ void stereo_dft_res_ecu( if ( k == 0 ) { mvr2r( pDFT_RES, res_buf, L_FRAME8k ); -#ifdef NONBE_FIX_943_PORT_1208_DFT_STEREO_PLC_BURST time_offs = min( MAX16B, hStereoDft->time_offs + output_frame ); stereo_dft_res_subst_spec( hStereoDft, res_buf, DFT_PRED_RES, time_offs, L_res, L_FRAME8k, k, num_plocs, plocs, plocsi, FALSE ); -#else - stereo_dft_res_subst_spec( hStereoDft, res_buf, DFT_PRED_RES, hStereoDft->time_offs + output_frame, L_res, L_FRAME8k, k, num_plocs, plocs, plocsi, FALSE ); -#endif rfft( res_buf, trigo_dec, L_FRAME8k, +1 ); @@ -141,11 +135,7 @@ void stereo_dft_res_ecu( } /*in case of burst error*/ -#ifdef NONBE_FIX_943_PORT_1208_DFT_STEREO_PLC_BURST hStereoDft->time_offs = min( MAX16B, hStereoDft->time_offs + L_FRAME8k ); -#else - hStereoDft->time_offs += L_FRAME8k; -#endif } set_zero( DFT_PRED_RES, 2 * L_res ); diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index 50aabafeb881d8d3a0b33b2daf299ab2ec63b33b..5c2ba97c2720bacb45e135cbba0f60e7281fbaa7 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -620,47 +620,28 @@ static void run_min_stats( computed only once (for ch == 0) and not again in the second run sive the outcome will be the same anyway */ if ( ( will_estimate_noise_on_channel[0] == will_estimate_noise_on_channel[1] ) || ch == 0 ) { -#ifdef NONBE_FIX_1204_MDCT_STEREO_NOISE_EST_SCALING float power_spec_scale_fac; /* calculate power spectrum from MDCT coefficients and estimated MDST coeffs */ power_spec_scale_fac = 1.f / (float) ( L_FRAME16k * L_FRAME16k ); power_spec[0] = spec_in[0] * spec_in[0] * power_spec_scale_fac; power_spec[L_FRAME16k - 1] = spec_in[L_FRAME16k - 1] * spec_in[L_FRAME16k - 1] * power_spec_scale_fac; -#else - /* calculate power spectrum from MDCT coefficients and estimated MDST coeffs */ - power_spec[0] = spec_in[0] * spec_in[0]; - power_spec[L_FRAME16k - 1] = spec_in[L_FRAME16k - 1] * spec_in[L_FRAME16k - 1]; -#endif + for ( int16_t i = 1; i < L_FRAME16k - 1; i++ ) { float mdst; mdst = spec_in[i + 1] - spec_in[i - 1]; -#ifdef NONBE_FIX_1204_MDCT_STEREO_NOISE_EST_SCALING power_spec[i] = power_spec_scale_fac * ( spec_in[i] * spec_in[i] + mdst * mdst ); -#else - power_spec[i] = spec_in[i] * spec_in[i] + mdst * mdst; -#endif } } -#ifndef NONBE_FIX_1204_MDCT_STEREO_NOISE_EST_SCALING - - noisy_speech_detection( st->hFdCngDec, st->VAD && st->m_frame_type == ACTIVE_FRAME, power_spec ); - - st->hFdCngDec->hFdCngCom->likelihood_noisy_speech = 0.99f * st->hFdCngDec->hFdCngCom->likelihood_noisy_speech + 0.01f * (float) st->hFdCngDec->hFdCngCom->flag_noisy_speech; - - st->lp_noise = st->hFdCngDec->lp_noise; -#endif } -#ifdef NONBE_FIX_1204_MDCT_STEREO_NOISE_EST_SCALING if ( st->core == TCX_20_CORE ) { noisy_speech_detection( st->hFdCngDec, save_VAD[ch] && st->m_frame_type == ACTIVE_FRAME, x[ch][0] ); st->hFdCngDec->hFdCngCom->likelihood_noisy_speech = 0.99f * st->hFdCngDec->hFdCngCom->likelihood_noisy_speech + 0.01f * (float) st->hFdCngDec->hFdCngCom->flag_noisy_speech; st->lp_noise = st->hFdCngDec->lp_noise; } -#endif if ( will_estimate_noise_on_channel[0] || will_estimate_noise_on_channel[1] || st->bfi ) { diff --git a/lib_dec/ivas_svd_dec.c b/lib_dec/ivas_svd_dec.c index 85dadbac409c0c3a58d676cfa882dd99e9fae997..d4ac7d139b5330753a0e8c1560328e9e86be3363 100644 --- a/lib_dec/ivas_svd_dec.c +++ b/lib_dec/ivas_svd_dec.c @@ -48,17 +48,10 @@ *-----------------------------------------------------------------------*/ /* The SVD is sensitive to changes to the following constants, so please be careful when trying to tune things */ -#ifdef NONBE_FIX_1069_SVD_TUNING #define SVD_MINIMUM_VALUE 1e-32f /* minimum value */ #define CONVERGENCE_FACTOR 1.0e-04f /* factor for SVD convergence */ #define SVD_MAX_NUM_ITERATION 75 /* maximum number of interations before exiting the SVD */ #define SVD_ZERO_FLUSH_THRESHOLD 1.0e-20f -#else -#define SVD_MINIMUM_VALUE 1e-32f /* minimum value */ -#define CONVERGENCE_FACTOR 1.19209290e-07f /* factor for SVD convergence */ -#define SVD_MAX_NUM_ITERATION 75 /* maximum number of interations before exiting the SVD */ -#define SVD_ZERO_FLUSH_THRESHOLD 1.0e-20f -#endif /*-----------------------------------------------------------------------* * Local function prototypes diff --git a/lib_dec/pitch_extr.c b/lib_dec/pitch_extr.c index 83a71c91488fd6d40786a2d0fbc9c99f7ea4c2de..24d8d081f8e49f23738ece5bbb55b66aed92c49d 100644 --- a/lib_dec/pitch_extr.c +++ b/lib_dec/pitch_extr.c @@ -163,9 +163,7 @@ void pitch_pred_linear_fit( { Word32 t1, t2, t3, t4, t5, t6, t7; Word16 e1, e2, e3, e4, e5, e6, e7; -#ifdef BASOP_NOGLOB Flag Overflow; -#endif t1 = L_mult0( pg_fx[4], pg_fx[3] ); /*Q24*/ /* t1 = pg[4]*pg[3] */ e1 = 7; t2 = L_add( L_deposit_l( pg_fx[3] ), L_shl( L_deposit_l( pg_fx[4] ), 2 ) ); /*Q12*/ @@ -187,12 +185,8 @@ void pitch_pred_linear_fit( t6 = BASOP_Util_Add_Mant32Exp( t3, e3, t4, e4, &e6 ); t7 = BASOP_Util_Add_Mant32Exp( t5, e5, t6, e6, &e7 ); /*Q31,e7*/ sum0_q = norm_l( t7 ); -#ifdef BASOP_NOGLOB sum0 = round_fx_o( L_shl( t7, sum0_q ), &Overflow ); /*Q15,e7-sum0_q*/ -#else - sum0 = round_fx( L_shl( t7, sum0_q ) ); /*Q15,e7-sum0_q*/ -#endif - sum0_q = add( 15, sub( sum0_q, e7 ) ); /* sum0 is now Qsum0_q*/ + sum0_q = add( 15, sub( sum0_q, e7 ) ); /* sum0 is now Qsum0_q*/ } pit = 0; diff --git a/lib_dec/pvq_core_dec.c b/lib_dec/pvq_core_dec.c index 5079e49f3d1af86636ffbc38e2d1052f38ecc352..b8904d534c7d93ee9bc1ed874c59b3b88d1948e1 100644 --- a/lib_dec/pvq_core_dec.c +++ b/lib_dec/pvq_core_dec.c @@ -112,18 +112,10 @@ static void pvq_decode_band( for ( j = 0; j < Np; j++ ) { -#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR g_part[j] = -( (float) g_part_s[j] ) / 32768; /* note: here g_part needs to be become exactly 1.0(float) thus in BASOP Word16 g_part_s is in the negative Q15 domain */ -#endif - - -#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* aligned to BASOP to avoid USAN undefined negation warning for -(-32768) */ g_part_s[j] = negate( g_part_s[j] ); -#else - g_part_s[j] = -g_part_s[j]; -#endif } srt_vec_ind( g_part_s, sg_part, idx_sort, Np ); @@ -404,9 +396,7 @@ static void densitySymbolIndexDecode( int16_t r_dim = opp_sz; int16_t l_dim = near_sz; int16_t alpha; -#ifdef BASOP_NOGLOB Flag Overflow; -#endif /* BASOP_NOGLOB */ if ( ( 0xFFFE & density ) == 0 ) { /* odd density exit */ @@ -415,11 +405,7 @@ static void densitySymbolIndexDecode( } #define WMC_TOOL_SKIP angle = atan2_fx( SQRT_DIM_fx[r_dim], SQRT_DIM_fx[l_dim] ); -#ifndef BASOP_NOGLOB - angle = shl( angle, 1 ); -#else /* BASOP_NOGLOB */ angle = shl_o( angle, 1, &Overflow ); -#endif /* BASOP_NOGLOB */ angle = mult_r( angle, 20861 ); c = mult_r( res, angle ); #undef WMC_TOOL_SKIP @@ -429,11 +415,7 @@ static void densitySymbolIndexDecode( { tot = res * ( res + 1 ) + 1; dec_freq = rc_decode( &st->BER_detect, hPVQ, tot ); -#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR alpha = (int16_t) floor_sqrt_exact( (uint32_t) ( ( res + 1 ) * ( res + 1 ) - dec_freq ) ) + res + 1; -#else - alpha = (int16_t) floor_sqrt_exact( (uint32_t) ( res + 1 ) * ( res + 1 ) - dec_freq ) + res + 1; -#endif sym_freq = 2 * ( res - alpha ) + 1; cum_freq = alpha * ( 2 * ( res + 1 ) - alpha ); } @@ -451,11 +433,7 @@ static void densitySymbolIndexDecode( dec_freq = rc_decode( &st->BER_detect, hPVQ, tot ); if ( dec_freq < tot - ( res + 1 ) - ( res - ( c + 1 ) ) * ( res - c ) * c + c + 1 ) { -#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR alpha = ( res_c - 1 + (int16_t) floor_sqrt_exact( (uint32_t) ( res_c * ( res_c + 4 * dec_freq - 2 ) + 1 ) ) ) / ( 2 * res_c ); -#else - alpha = ( res_c - 1 + (int16_t) floor_sqrt_exact( (uint32_t) res_c * ( res_c + 4 * dec_freq - 2 ) + 1 ) ) / ( 2 * res_c ); -#endif sym_freq = 2 * alpha * res_c + 1; cum_freq = alpha * ( ( alpha - 1 ) * res_c + 1 ); } diff --git a/lib_dec/swb_bwe_dec.c b/lib_dec/swb_bwe_dec.c index 05a0ac2249e90e4c32cad4212c97c1e6326cf038..e26072db4a208ab088995417056c1f3374291a60 100644 --- a/lib_dec/swb_bwe_dec.c +++ b/lib_dec/swb_bwe_dec.c @@ -499,9 +499,7 @@ int16_t swb_bwe_gain_deq( { Word16 tmp, frac, exp; Word32 L_tmp; -#ifdef BASOP_NOGLOB Flag Overflow; -#endif tmp = add( (int16_t) ( SWB_fenv[n_band] * 256 ), (int16_t) ( Mean_env[n_band] * 256 ) ); /*Q8 */ L_tmp = L_mult( tmp, 21771 ); /* 0.166096 in Q17 -> Q26 */ @@ -512,12 +510,8 @@ int16_t swb_bwe_gain_deq( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 13 ); -#ifdef BASOP_NOGLOB tmp = shl_o( tmp, add( exp, 1 ), &Overflow ); /*Q1 */ -#else - tmp = shl( tmp, add( exp, 1 ) ); /*Q1 */ -#endif - SWB_fenv[n_band] = (float) tmp * 0.5f; /*Q1 */ + SWB_fenv[n_band] = (float) tmp * 0.5f; /*Q1 */ } if ( hqswb_clas == HQ_GEN_FB ) diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index f344b1228e9000a1e47cd29be23d5bb3ce994766..0442f9eb7758e0287c1de4930ee8c40cf88d5483 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -328,14 +328,12 @@ void wb_tbe_dec( prev_pow = sum2_f( shaped_wb_excitation, L_SHB_LAHEAD / 4 ); curr_pow = sum2_f( shaped_wb_excitation + L_SHB_LAHEAD / 4, L_SHB_LAHEAD / 4 ); -#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE if ( st->element_mode > EVS_MONO ) { /* prevent too low values of energy */ prev_pow = max( 0.00001f, prev_pow ); curr_pow = max( 0.00001f, curr_pow ); } -#endif if ( voice_factors[0] > 0.75f ) { @@ -1072,14 +1070,12 @@ void swb_tbe_dec( prev_pow = sum2_f( shaped_shb_excitation, L_SHB_LAHEAD + 10 ); curr_pow = sum2_f( shaped_shb_excitation + L_SHB_LAHEAD + 10, L_SHB_LAHEAD + 10 ); -#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE if ( st->element_mode > EVS_MONO ) { /* prevent too low values of energy */ prev_pow = max( 0.00001f, prev_pow ); curr_pow = max( 0.00001f, curr_pow ); } -#endif if ( voice_factors[0] > 0.75f ) { diff --git a/lib_dec/updt_dec.c b/lib_dec/updt_dec.c index 014f58f61a68e18b360591bfc8c8524e8fc280ac..424a4f5320828ceb7be0674b798a52204b3ffe29 100644 --- a/lib_dec/updt_dec.c +++ b/lib_dec/updt_dec.c @@ -521,11 +521,7 @@ void updt_dec_common( st->stab_fac_smooth_lt = ENV_SMOOTH_FAC * st->stab_fac + ( 1.0f - ENV_SMOOTH_FAC ) * st->stab_fac_smooth_lt; } -#ifdef NON_BE_1055_RESET_LP_MEMORIES if ( ( st->core_brate <= SID_2k40 && st->cng_type == FD_CNG ) || ( st->tcxonly && ( st->codec_mode == MODE2 || st->element_mode > EVS_MONO ) ) ) -#else - if ( ( st->core_brate <= SID_2k40 && st->cng_type == FD_CNG ) || ( st->tcxonly && st->codec_mode == MODE2 ) ) -#endif { /* reset LP memories */ set_zero( st->mem_MA, M ); diff --git a/lib_enc/acelp_core_enc.c b/lib_enc/acelp_core_enc.c index 3a951e796ef3a15fd8dfb6bb2026207357de52c8..55d21983df7946d0917a5a89fd255fa0ea748ae4 100644 --- a/lib_enc/acelp_core_enc.c +++ b/lib_enc/acelp_core_enc.c @@ -372,21 +372,13 @@ ivas_error acelp_core_enc( if ( !nelp_mode && !ppp_mode ) { -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif } /*-----------------------------------------------------------------* * After inactive period, use the most up-to-date ISPs *-----------------------------------------------------------------*/ -#ifdef NON_BE_FIX_807_MASA_DTX_BRSW if ( st->hDtxEnc != NULL && ( st->last_core_brate == FRAME_NO_DATA || st->last_core_brate == SID_2k40 ) ) -#else - if ( st->last_core_brate == FRAME_NO_DATA || st->last_core_brate == SID_2k40 ) -#endif { mvr2r( st->hDtxEnc->lspCNG, st->lsp_old, M ); lsp2lsf( st->hDtxEnc->lspCNG, st->lsf_old, M, int_fs ); @@ -499,11 +491,7 @@ ivas_error acelp_core_enc( { tc_classif_enc( st->L_frame, &tc_subfr, &position, attack_flag, st->pitch[0], res ); -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 1, NULL, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 1, NULL, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif } /*---------------------------------------------------------------* @@ -561,11 +549,7 @@ ivas_error acelp_core_enc( lsf_syn_mem_restore( st, tilt_code_bck, gc_threshold_bck, clip_var_bck, next_force_sf_bck, lsp_new, lsp_mid, clip_var, mem_AR, mem_MA, lsp_new_bck, lsp_mid_bck, Bin_E, Bin_E_old, mem_syn_bck, mem_w0_bck, streaklimit, pstreaklen ); /* Configure ACELP bit allocation */ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif /* redo LSF quantization */ lsf_enc( st, lsf_new, lsp_new, lsp_mid, Aq, tdm_low_rate_mode, 0, NULL ); diff --git a/lib_enc/acelp_core_switch_enc.c b/lib_enc/acelp_core_switch_enc.c index 130144e69e808256e430da3fdd865d35dd32bd3a..0a54b475cb030a71d45aa4bc96e9cf7f8872324d 100644 --- a/lib_enc/acelp_core_switch_enc.c +++ b/lib_enc/acelp_core_switch_enc.c @@ -132,11 +132,7 @@ void acelp_core_switch_enc( * Excitation encoding *----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( ENC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, GENERIC, st->inactive_coder_type_flag, -1, -1, &j, &i, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); -#else - config_acelp1( ENC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, GENERIC, -1, -1, &j, &i, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); -#endif encod_gen_voic_core_switch( st, st->last_L_frame, inp, Aq, A, T_op, st->voicing, exc, cbrate ); diff --git a/lib_enc/amr_wb_enc.c b/lib_enc/amr_wb_enc.c index 3ae31680c9f88d099b6a17ef7242722af85434be..1a507f4736eb0b6c6fea8a631b8325a16f60f16d 100644 --- a/lib_enc/amr_wb_enc.c +++ b/lib_enc/amr_wb_enc.c @@ -311,11 +311,7 @@ void amr_wb_enc( st->fd_cng_reset_flag = 0; } -#ifdef NONBE_1211_DTX_BR_SWITCHING dtx( st, -1, -1, vad_flag_dtx, inp ); -#else - dtx( st, -1, vad_flag_dtx, inp ); -#endif /*----------------------------------------------------------------* * Noise energy down-ward update and total noise energy estimation diff --git a/lib_enc/core_enc_init.c b/lib_enc/core_enc_init.c index 4b4bd0c4fe4834c7bfc9e381ee673b241ed77f3a..70f9efa9ea3b868f11361d8555b14faded774edb 100644 --- a/lib_enc/core_enc_init.c +++ b/lib_enc/core_enc_init.c @@ -64,10 +64,8 @@ static void init_modes( Encoder_State *st, const int32_t last_total_brate ); void init_coder_ace_plus( Encoder_State *st, /* i : Encoder state */ const int32_t last_total_brate, /* i : last total bitrate */ -#ifdef FIX_920_IGF_INIT_ERROR - const int32_t igf_brate, /* i : IGF configuration bitrate */ -#endif - const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ + const int32_t igf_brate, /* i : IGF configuration bitrate */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ) { TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; @@ -157,11 +155,7 @@ void init_coder_ace_plus( if ( st->igf && st->hIGFEnc != NULL ) { -#ifdef FIX_920_IGF_INIT_ERROR IGFEncSetMode( st->hIGFEnc, igf_brate, st->bwidth, st->element_mode, st->rf_mode ); -#else - IGFEncSetMode( st->hIGFEnc, st->total_brate, st->bwidth, st->element_mode, st->rf_mode ); -#endif } else if ( st->hIGFEnc != NULL ) { diff --git a/lib_enc/core_enc_switch.c b/lib_enc/core_enc_switch.c index 25266ed4c499e4a9a62f457363fa9053135d0f7a..dfc4b337b6e9f7b7a8b5567c8b1baa5591602ce8 100644 --- a/lib_enc/core_enc_switch.c +++ b/lib_enc/core_enc_switch.c @@ -152,11 +152,7 @@ void core_coder_mode_switch( else { st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); -#ifdef FIX_920_IGF_INIT_ERROR init_coder_ace_plus( st, last_total_brate, st->total_brate, MCT_flag ); -#else - init_coder_ace_plus( st, last_total_brate, MCT_flag ); -#endif } if ( st->igf && st->hBWE_TD != NULL ) diff --git a/lib_enc/core_enc_updt.c b/lib_enc/core_enc_updt.c index 7969f00f101c57ef39e2e2d2bb18053541295e85..59a8c03ed559b14f740c62b5a2b530146a880997 100644 --- a/lib_enc/core_enc_updt.c +++ b/lib_enc/core_enc_updt.c @@ -92,11 +92,7 @@ void core_encode_update( } } -#ifdef NON_BE_1055_RESET_LP_MEMORIES if ( ( st->Opt_DTX_ON && st->core_brate <= SID_2k40 && st->cng_type == FD_CNG ) || ( st->tcxonly && ( st->codec_mode == MODE2 || st->element_mode > EVS_MONO ) ) ) -#else - if ( ( st->Opt_DTX_ON && st->core_brate <= SID_2k40 && st->cng_type == FD_CNG ) || ( st->tcxonly && st->codec_mode == MODE2 ) ) -#endif { /* reset LP memories */ set_zero( st->mem_MA, M ); diff --git a/lib_enc/dtx.c b/lib_enc/dtx.c index 77a7ad04043eb51039351c804bd282a7641c5e5c..c553fe2f888b12b338b1b3bb448a9247e918c823 100644 --- a/lib_enc/dtx.c +++ b/lib_enc/dtx.c @@ -66,9 +66,7 @@ #define MAX_BRATE_DTX_EVS ACELP_24k40 /* maximum bitrate to which the default DTX is applied in EVS; otherwise DTX is applied only in silence */ #define MAX_BRATE_DTX_IVAS IVAS_80k /* maximum bitrate to which the default DTX is applied in IVAS; otherwise DTX is applied only in silence */ -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD #define DTX_THR_EVS 15 /* lp_noise threshold for DTX at higher bitrates in EVS */ // ToDo: to be removed once EVS is CR fixed -#endif /*-------------------------------------------------------------------* * Local function prototypes @@ -83,21 +81,17 @@ static void update_SID_cnt( DTX_ENC_HANDLE hDtxEnc, const int32_t core_brate, co *-------------------------------------------------------------------*/ void dtx( - Encoder_State *st, /* i/o: encoder state structure */ -#ifdef NONBE_1211_DTX_BR_SWITCHING + Encoder_State *st, /* i/o: encoder state structure */ const int32_t last_ivas_total_brate, /* i : last IVAS total bitrate */ -#endif - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const int16_t vad, /* i : VAD flag for DTX */ - const float speech[] /* i : Pointer to the speech frame */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t vad, /* i : VAD flag for DTX */ + const float speech[] /* i : Pointer to the speech frame */ ) { float alpha; DTX_ENC_HANDLE hDtxEnc = st->hDtxEnc; int16_t last_br_cng_flag, last_br_flag, br_dtx_flag; -#ifdef NONBE_1211_DTX_BR_SWITCHING int32_t total_brate_ref; -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD int16_t dtx_thr; dtx_thr = DTX_THR; @@ -105,38 +99,20 @@ void dtx( { dtx_thr = DTX_THR_EVS; // ToDo: to be removed once EVS is CR fixed } -#endif total_brate_ref = st->total_brate; -#endif if ( st->dtx_sce_sba != 0 ) { last_br_cng_flag = 1; last_br_flag = 1; -#ifndef NONBE_1211_DTX_BR_SWITCHING - br_dtx_flag = 1; -#endif } else { -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD last_br_cng_flag = st->last_total_brate_cng <= MAX_BRATE_DTX_EVS || st->lp_noise < dtx_thr || ( st->element_mode == IVAS_SCE && st->last_total_brate_cng <= MAX_BRATE_DTX_IVAS ); -#else - last_br_cng_flag = st->last_total_brate_cng <= MAX_BRATE_DTX_EVS || st->lp_noise < 15 || ( st->element_mode == IVAS_SCE && st->last_total_brate_cng <= MAX_BRATE_DTX_IVAS ); -#endif -#ifdef NONBE_1211_DTX_BR_SWITCHING last_br_flag = ( st->element_mode == EVS_MONO && st->last_total_brate <= MAX_BRATE_DTX_EVS ) || ( st->element_mode != EVS_MONO && last_ivas_total_brate <= MAX_BRATE_DTX_IVAS ) || -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD st->lp_noise < dtx_thr; -#else - st->lp_noise < 15; -#endif -#else - last_br_flag = st->last_total_brate <= MAX_BRATE_DTX_EVS || st->lp_noise < 15 || ( st->element_mode == IVAS_SCE && st->last_total_brate <= MAX_BRATE_DTX_IVAS ); - br_dtx_flag = 0; -#endif } /* Initialization */ @@ -210,18 +186,12 @@ void dtx( * Select SID or FRAME_NO_DATA frame if DTX is enabled *------------------------------------------------------------------------*/ -#ifdef NONBE_1211_DTX_BR_SWITCHING br_dtx_flag = 1; -#endif if ( st->dtx_sce_sba == 0 ) { br_dtx_flag = ( st->element_mode == EVS_MONO && st->total_brate <= MAX_BRATE_DTX_EVS ) || ( st->element_mode != EVS_MONO && ivas_total_brate <= MAX_BRATE_DTX_IVAS ) || -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD st->lp_noise < dtx_thr; -#else - st->lp_noise < 15; -#endif } if ( st->Opt_DTX_ON && vad == 0 && @@ -305,12 +275,10 @@ void dtx( reset_indices_enc( st->hBstr, st->hBstr->nb_ind_tot ); } } -#ifdef NONBE_1211_DTX_BR_SWITCHING else if ( st->element_mode != EVS_MONO ) { st->total_brate = total_brate_ref; } -#endif /*------------------------------------------------------------------------* * Reset counters when in active frame (neither SID nor FRAME_NO_DATA frame) diff --git a/lib_enc/enc_gen_voic.c b/lib_enc/enc_gen_voic.c index 0d2713b0f9fb9c4990355e0e11035c14707109e3..f05f1a87c8582f151c819db193fc59dda9b5a818 100644 --- a/lib_enc/enc_gen_voic.c +++ b/lib_enc/enc_gen_voic.c @@ -255,11 +255,7 @@ void encod_gen_voic( * Transform-domain contribution (inactive frames) *-----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR if ( !st->inactive_coder_type_flag && st->coder_type == INACTIVE ) -#else - if ( st->total_brate >= MAX_GSC_INACTIVE_BRATE && st->coder_type == INACTIVE ) -#endif { transf_cdbk_enc( st, 0, i_subfr, cn, exc, p_Aq, p_Aw, h1, xn, xn2, y1, y2, Es_pred, &gain_pit, gain_code, g_corr, clip_gain, &gain_preQ, code_preQ, unbits ); } diff --git a/lib_enc/gs_enc.c b/lib_enc/gs_enc.c index 376dcb6ee46e630e64f6dcf6dbe67e63ce27781a..3a77adaac0205bc1e6cec011365eabd8ed7c82c4 100644 --- a/lib_enc/gs_enc.c +++ b/lib_enc/gs_enc.c @@ -545,11 +545,7 @@ void gsc_enc( } if ( concat_out[j] < 0 ) { -#ifdef FIX_1027_GSC_INT_OVERFLOW seed_init = (int16_t) ( (int32_t) seed_init + 3 ); -#else - seed_init += 3; -#endif } } diff --git a/lib_enc/hq_classifier_enc.c b/lib_enc/hq_classifier_enc.c index 7dfada3fb6d8a59679504004b8e3ebd37c96cf66..7d5efe2e43d0f49625a4c900dfc7194c2d4dfb5d 100644 --- a/lib_enc/hq_classifier_enc.c +++ b/lib_enc/hq_classifier_enc.c @@ -573,7 +573,7 @@ static int16_t hf_spectrum_sparseness( inv_rms = 0.0f; crest_mod = 0.0f; maximum( A, L_SPEC_HB, &Amax ); -#ifdef NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO + if ( Amax == 0 ) { /* For all-zero input the crest is 1.0 */ @@ -626,50 +626,7 @@ static int16_t hf_spectrum_sparseness( crest = Amax * inv_rms; crest_mod = crest_mod * inv_rms; } -#else - thr = Amax * PEAK_THRESHOLD; - movmean = 0.0f; /* avoid uninitialized warning */ - p_num = &inv_tbl[HALF_WIN_LENGTH + 1]; /* Table for division 1./(11:21) */ - for ( i = 0; i < L_SPEC_HB; i++ ) - { - inv_rms += A[i] * A[i]; - if ( A[i] < thr ) - { - low_count += 1; - } - if ( i <= HALF_WIN_LENGTH ) - { - if ( i == 0 ) - { - movmean = sum_f( &A[0], i + HALF_WIN_LENGTH + 1 ) * ( *p_num ); - } - else - { - p_num++; - movmean = movmean + ( A[i + HALF_WIN_LENGTH] - movmean ) * ( *p_num ); - } - } - else - { - if ( L_SPEC_HB <= i + HALF_WIN_LENGTH ) - { - p_num--; - movmean = movmean + ( movmean - A[i - HALF_WIN_LENGTH - 1] ) * ( *p_num ); - } - else - { - movmean = movmean + ( A[i + HALF_WIN_LENGTH] - A[i - HALF_WIN_LENGTH - 1] ) * ( *p_num ); - } - } - if ( crest_mod < movmean ) - { - crest_mod = movmean; - } - } - inv_rms = 1.0f / (float) sqrtf( inv_rms / L_SPEC_HB ); - crest = Amax * inv_rms; - crest_mod = crest_mod * inv_rms; -#endif + *crest_lp = HQ_CREST_FAC_SM * ( *crest_lp ) + ( 1.0f - HQ_CREST_FAC_SM ) * crest; *crest_mod_lp = HQ_CREST_FAC_SM * ( *crest_mod_lp ) + ( 1.0f - HQ_CREST_FAC_SM ) * crest_mod; diff --git a/lib_enc/hq_lr_enc.c b/lib_enc/hq_lr_enc.c index 65b5dd4ef5b3a37deeae00c7a6a382ad2ae8f416..acafddc16f771a5874cf48cff77bf2a023a7f441 100644 --- a/lib_enc/hq_lr_enc.c +++ b/lib_enc/hq_lr_enc.c @@ -195,9 +195,7 @@ void hq_lr_enc( Word32 L_band_energy[BANDS_MAX], L_band_energy_tmp[BANDS_MAX]; UWord16 lo; Word16 Q_band_energy; -#ifdef BASOP_NOGLOB Flag Overflow; -#endif /* BASOP_NOGLOB */ BSTR_ENC_HANDLE hBstr = st->hBstr; HQ_ENC_HANDLE hHQ_core = st->hHQ_core; @@ -410,11 +408,7 @@ void hq_lr_enc( } ELSE { -#ifdef BASOP_NOGLOB Ep_avrgL_fx = L_add_o( Ep_avrgL_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ -#else - Ep_avrgL_fx = L_add( Ep_avrgL_fx, Ep_tmp_fx[i] ); /*Q15 */ -#endif IF( L_sub( Ep_tmp_fx[i], Ep_peak_fx ) > 0 ) { Ep_peak_fx = Ep_tmp_fx[i]; @@ -533,17 +527,10 @@ void hq_lr_enc( move16(); } Mpy_32_16_ss( Ep_avrg_fx, tmp, &L_tmp, &lo ); -#ifndef BASOP_NOGLOB - L_tmp = L_shl( L_tmp, sub( 14, exp ) ); /*Q(13+exp-15 +14-exp+2 = 14) */ - L_tmp = L_max( L_tmp, 16384 ); /*14 */ - tmp = extract_l( L_min( L_tmp, beta_fx ) ); /*14 */ - alpha_fx = shl( mult( alpha_fx, tmp ), 1 ); /*14+14-15 +1=14 */ -#else /* BASOP_NOGLOB */ L_tmp = L_shl_o( L_tmp, sub( 14, exp ), &Overflow ); /*Q(13+exp-15 +14-exp+2 = 14) */ L_tmp = L_max( L_tmp, 16384 ); /*14 */ tmp = extract_l( L_min( L_tmp, beta_fx ) ); /*14 */ alpha_fx = shl( mult( alpha_fx, tmp ), 1 ); /*14+14-15 +1=14 */ -#endif /* BASOP_NOGLOB */ } ELSE { @@ -586,11 +573,7 @@ void hq_lr_enc( { IF( sub( i, lowband ) >= 0 ) { -#ifdef BASOP_NOGLOB Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ -#else - Ep_avrg_fx = L_add( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ -#endif } ELSE { @@ -629,13 +612,8 @@ void hq_lr_enc( Mpy_32_16_ss( Ep_peak_fx, tmp, &L_tmp, &lo ); Mpy_32_16_ss( L_tmp, lowband, &L_tmp, &lo ); Mpy_32_16_ss( L_tmp, 18842, &L_tmp, &lo ); -#ifndef BASOP_NOGLOB - L_tmp = L_shl( L_tmp, sub( 27, exp ) ); /*Q14 0.5 */ - tmp2 = extract_l( L_min( L_tmp, 19661 ) ); /*14 */ -#else /* BASOP_NOGLOB */ - L_tmp = L_shl_o( L_tmp, sub( 27, exp ), &Overflow ); /*Q14 0.5 */ - tmp2 = extract_l( L_min( L_tmp, 19661 ) ); /*14 */ -#endif /* BASOP_NOGLOB */ + L_tmp = L_shl_o( L_tmp, sub( 27, exp ), &Overflow ); /*Q14 0.5 */ + tmp2 = extract_l( L_min( L_tmp, 19661 ) ); /*14 */ Mpy_32_16_ss( L_band_energy_tmp[i], tmp2, &L_tmp, &lo ); L_band_energy_tmp[i] = L_shl( L_tmp, 1 ); /*Q_band_energy */ } @@ -661,11 +639,7 @@ void hq_lr_enc( bit_budget = sub( bit_budget, 2 ); /* bits in high bands to indicate the last 2 subbands is allocated bits or not */ FOR( i = 0; i < bands; i++ ) { -#ifndef BASOP_NOGLOB - Ep_tmp_fx[i] = L_shl( Ep_tmp_fx[i], 2 ); -#else /* BASOP_NOGLOB */ Ep_tmp_fx[i] = L_shl_o( Ep_tmp_fx[i], 2, &Overflow ); -#endif /* BASOP_NOGLOB */ } IF( st->core_brate == ACELP_13k20 ) { @@ -699,11 +673,7 @@ void hq_lr_enc( IF( sub( i, lowband ) >= 0 && add( sub( i, bands ), p2a_bands ) < 0 ) { Ep_vari_fx = L_add( Ep_vari_fx, L_abs( L_sub( Ep_tmp_fx[i], Ep_tmp_fx[sub( i, 1 )] ) ) ); /*Q15 */ -#ifndef BASOP_NOGLOB - Ep_avrg_fx = L_add( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ -#else /* BASOP_NOGLOB */ - Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ -#endif /* BASOP_NOGLOB */ + Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ } IF( sub( i, highband ) >= 0 ) @@ -736,11 +706,7 @@ void hq_lr_enc( tmp = sub( bands, p2a_bands ); tmp = sub( tmp, lowband ); /*Q0 */ -#ifndef BASOP_NOGLOB - tmp1 = extract_h( L_shl( Ep_avrg_fx, 1 ) ); /*Q0 */ -#else - tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ -#endif + tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ IF( tmp1 != 0 ) { exp = norm_s( tmp1 ); @@ -779,11 +745,7 @@ void hq_lr_enc( { tmp = sub( tmp, lowband ); Mpy_32_16_ss( Ep_tmp_fx[i], tmp, &L_tmp, &lo ); -#ifndef BASOP_NOGLOB - tmp = extract_h( L_shl( L_tmp, 16 ) ); /*Q0 */ -#else /* BASOP_NOGLOB */ - tmp = extract_h( L_shl_o( L_tmp, 16, &Overflow ) ); /*Q0 */ -#endif /* BASOP_NOGLOB */ + tmp = extract_h( L_shl_o( L_tmp, 16, &Overflow ) ); /*Q0 */ IF( tmp != 0 ) { exp = norm_s( tmp ); @@ -808,11 +770,7 @@ void hq_lr_enc( { tmp = sub( tmp, lowband ); -#ifndef BASOP_NOGLOB - tmp1 = extract_h( L_shl( Ep_avrg_fx, 1 ) ); /*Q0 */ -#else - tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ -#endif + tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ IF( tmp1 != 0 ) { exp = norm_s( tmp1 ); @@ -850,19 +808,11 @@ void hq_lr_enc( { IF( sub( i, lowband ) >= 0 ) { -#ifndef BASOP_NOGLOB - Ep_avrg_fx = L_add( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ -#else /* BASOP_NOGLOB */ - Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ -#endif /* BASOP_NOGLOB */ + Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ } ELSE { -#ifndef BASOP_NOGLOB - Ep_avrgL_fx = L_add( Ep_avrgL_fx, Ep_tmp_fx[i] ); /*Q15 */ -#else /* BASOP_NOGLOB */ Ep_avrgL_fx = L_add_o( Ep_avrgL_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ -#endif /* BASOP_NOGLOB */ IF( L_sub( Ep_tmp_fx[i], Ep_peak_fx ) > 0 ) { Ep_peak_fx = Ep_tmp_fx[i]; @@ -882,11 +832,7 @@ void hq_lr_enc( move16(); FOR( i = 0; i < lowband; i++ ) { -#ifndef BASOP_NOGLOB - tmp = extract_h( L_shl( Ep_avrgL_fx, 1 ) ); /*Q0 */ -#else - tmp = extract_h( L_shl_o( Ep_avrgL_fx, 1, &Overflow ) ); /*Q0 */ -#endif + tmp = extract_h( L_shl_o( Ep_avrgL_fx, 1, &Overflow ) ); /*Q0 */ IF( tmp != 0 ) { exp = norm_s( tmp ); diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 9734864a64c03f87b3e2c3764f9e9f04a6e4cac6..e920f21bc9ff957a3f3787e2a88d7ef484b452e8 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -825,11 +825,7 @@ ivas_error init_encoder( set_f( st->totalNoise_increase_hist, 0.f, TOTALNOISE_HIST_SIZE ); st->totalNoise_increase_len = 0; -#ifdef FIX_920_IGF_INIT_ERROR init_coder_ace_plus( st, st->last_total_brate, igf_brate, 0 /* initialization value */ ); -#else - init_coder_ace_plus( st, st->last_total_brate, 0 /* initialization value */ ); -#endif /*-----------------------------------------------------------------* * FD-CNG encoder diff --git a/lib_enc/ivas_core_pre_proc.c b/lib_enc/ivas_core_pre_proc.c index 026a9ff3fade05c39989e28e3bbe0189a6994b70..969e02235acb7b56bdb56cd074123ce6f470da02 100644 --- a/lib_enc/ivas_core_pre_proc.c +++ b/lib_enc/ivas_core_pre_proc.c @@ -209,11 +209,7 @@ ivas_error pre_proc_ivas( } else if ( st->total_brate > MAX_GSC_INACTIVE_BRATE && ( ( st->vad_flag == 0 && st->bwidth >= SWB && st->max_bwidth >= SWB ) || ( st->localVAD == 0 && ( st->bwidth <= WB || st->max_bwidth <= WB ) ) ) ) { -#ifdef NONBE_FIX_GSC_BSTR /* inactive frames will be coded by AVQ technology (exceptionally it can be later rewritten to GSC technology in ivas_combined_format_brate_sanity()) */ -#else - /* inactive frames will be coded by AVQ technology */ -#endif st->coder_type = INACTIVE; } diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index ea740b6af174dfb8ab604458bd09b374b3ff12b6..b24fab48e5cf02dfec9433cb2ef062dcd207e8f2 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -112,10 +112,8 @@ ivas_error pre_proc_front_ivas( const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ -#ifdef NONBE_1211_DTX_BR_SWITCHING - const int32_t last_ivas_total_brate, /* i : last IVAS total bitrate */ -#endif - const int32_t ivas_total_brate /* i : IVAS total bitrate - for setting the DTX */ + const int32_t last_ivas_total_brate, /* i : last IVAS total bitrate */ + const int32_t ivas_total_brate /* i : IVAS total bitrate - for setting the DTX */ #ifdef DEBUG_MODE_INFO , const int16_t ch_idx @@ -585,11 +583,7 @@ ivas_error pre_proc_front_ivas( st->cng_type = LP_CNG; } -#ifdef NONBE_1211_DTX_BR_SWITCHING dtx( st, last_ivas_total_brate, ivas_total_brate, *vad_flag_dtx, inp_12k8 ); -#else - dtx( st, ivas_total_brate, *vad_flag_dtx, inp_12k8 ); -#endif if ( hCPE != NULL && hCPE->hStereoDft != NULL && st->core_brate == SID_2k40 ) { diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index e6ed38c70d8729fa4b5219f50cd6dfa7c7515d75..568ddfd916b8a3d050492a4926178c413f170361 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -501,11 +501,7 @@ ivas_error ivas_cpe_enc( error = pre_proc_front_ivas( NULL, hCPE, hCPE->element_brate, nb_bits_metadata, input_frame, n, old_inp_12k8[n], old_inp_16k[n], &ener[n], &relE[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], &vad_hover_flag[n], &attack_flag[n], realBuffer[n], imagBuffer[n], old_wsp[n], pitch_fr[n], voicing_fr[n], &loc_harm[n], &cor_map_sum[n], &vad_flag_dtx[n], enerBuffer[n], -#ifdef NONBE_1211_DTX_BR_SWITCHING fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, ivas_format, st_ivas->hMCT != NULL, st_ivas->hEncoderConfig->last_ivas_total_brate, ivas_total_brate -#else - fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, ivas_format, st_ivas->hMCT != NULL, ivas_total_brate -#endif #ifdef DEBUG_MODE_INFO , ( st_ivas->nSCE + ( cpe_id * CPE_CHANNELS ) + n ) diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index 578c89d25cfbbe1d0375319e00b3ffab701eb6bf..f6cfdbc611957503e7cce5440f18a5f028a87e08 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -211,17 +211,10 @@ void ivas_decision_matrix_enc( { st->core = ACELP_CORE; } -#ifdef SUPPORT_FORCE_TCX10_TCX20 else if ( st->force == FORCE_TCX20 || st->force == FORCE_TCX10 ) /* Initalizations should always happen with TCX20*/ { st->core = TCX_20_CORE; } -#else - else if ( st->force == FORCE_TCX ) - { - st->core = TCX_20_CORE; - } -#endif else if ( st->force == FORCE_HQ && st->element_mode != IVAS_CPE_MDCT && element_brate >= IVAS_24k4 ) { st->core = HQ_CORE; @@ -233,16 +226,12 @@ void ivas_decision_matrix_enc( if ( st->core == TCX_20_CORE && st->total_brate < STEREO_TCX_MIN_RATE ) { st->core = ACELP_CORE; -#ifdef NONBE_FIX_1205_TD_STEREO_MOD_CT /* In TD stereo below 24.4 kbps we cannot overwrite the `coder_type` when it is set to TRANSITION, */ /* as it is used for TD stereo bit allocation. To ensure consistent bit allocation, it must remain unchanged on the decoder side. */ if ( st->idchan == 0 && !( element_brate < IVAS_24k4 && st->coder_type == TRANSITION && st->element_mode == IVAS_CPE_TD ) ) { st->coder_type = AUDIO; } -#else - st->coder_type = AUDIO; -#endif st->sp_aud_decision2 = 0; if ( st->low_rate_mode ) @@ -529,7 +518,6 @@ void ivas_signaling_enc( if ( st->core == ACELP_CORE ) { -#ifdef NONBE_FIX_1205_TD_STEREO_MOD_CT /* write coder type */ push_indice( hBstr, IND_ACELP_SIGNALLING, st->coder_type, 3 ); @@ -538,20 +526,6 @@ void ivas_signaling_enc( /* write sharpening flag */ push_indice( hBstr, IND_SHARP_FLAG, st->sharpFlag, 1 ); } -#else - if ( element_brate < FRMT_SHP_MIN_BRATE_IVAS ) - { - push_indice( hBstr, IND_ACELP_SIGNALLING, st->coder_type, 3 ); - } - else - { - /* write coder type */ - push_indice( hBstr, IND_ACELP_SIGNALLING, st->coder_type, 3 ); - - /* write sharpening flag */ - push_indice( hBstr, IND_SHARP_FLAG, st->sharpFlag, 1 ); - } -#endif /* write extension layer flag to distinguish between TBE (0) and BWE (1) */ if ( st->extl_brate > 0 ) diff --git a/lib_enc/ivas_front_vad.c b/lib_enc/ivas_front_vad.c index 4c2742a5252c776f214992fe94ac407164417b21..cb355ef4a640551f996be758f9f1e11528613562 100644 --- a/lib_enc/ivas_front_vad.c +++ b/lib_enc/ivas_front_vad.c @@ -422,12 +422,10 @@ ivas_error front_vad_spar( } noise_est_down( fr_bands[0], hFrontVad->hNoiseEst->bckr, tmpN, tmpE, st->min_band, st->max_band, &hFrontVad->hNoiseEst->totalNoise, Etot[0], &hFrontVad->hNoiseEst->Etot_last, &hFrontVad->hNoiseEst->Etot_v_h2 ); + corr_shift = correlation_shift( hFrontVad->hNoiseEst->totalNoise ); -#ifdef NONBE_1211_DTX_BR_SWITCHING + dtx( st, hEncoderConfig->last_ivas_total_brate, hEncoderConfig->ivas_total_brate, vad_flag_dtx[0], inp_12k8 ); -#else - dtx( st, hEncoderConfig->ivas_total_brate, vad_flag_dtx[0], inp_12k8 ); -#endif /* linear prediction analysis */ alw_pitch_lag_12k8[0] = st->old_pitch_la; diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 7c7114d6ea7f6391a0e286d78dab317fa637f9af..77bdd62711fdb7684233175adb5d10ad188b6f90 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -155,11 +155,7 @@ int16_t ivas_ism_dtx_enc( ( nchan_ism == 2 && ivas_total_brate <= IVAS_48k ) || ( nchan_ism == 3 && ivas_total_brate <= IVAS_80k ) || ( nchan_ism == 4 && ivas_total_brate <= IVAS_96k ) || -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD lp_noise_max < DTX_THR ) ) -#else - lp_noise_max < 15 ) ) -#endif { dtx_flag = 0; } diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index f45fe6f51d380c69183b7e162480633227fdd4bf..5267ce0b943e65834781b0085062ec5e11980371 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -182,11 +182,7 @@ ivas_error ivas_ism_enc( error = pre_proc_front_ivas( hSCE, NULL, hSCE->element_brate, nb_bits_metadata[sce_id], input_frame, 0, old_inp_12k8[sce_id][0], old_inp_16k[sce_id][0], &ener[sce_id][0], &relE[sce_id][0], A[sce_id][0], Aw[sce_id][0], epsP[sce_id][0], lsp_new[sce_id][0], lsp_mid[sce_id][0], &vad_hover_flag[sce_id][0], &attack_flag[sce_id][0], realBuffer[sce_id][0], imagBuffer[sce_id][0], old_wsp[sce_id][0], pitch_fr[sce_id][0], voicing_fr[sce_id][0], &loc_harm[sce_id][0], &cor_map_sum[sce_id][0], &vad_flag_dtx[sce_id][0], enerBuffer[sce_id][0], -#ifdef NONBE_1211_DTX_BR_SWITCHING fft_buff[sce_id][0], A[sce_id][0], lsp_new[sce_id][0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, 0, 0, 0, 0, ISM_FORMAT, 0, st_ivas->hEncoderConfig->last_ivas_total_brate, st_ivas->hEncoderConfig->ivas_total_brate -#else - fft_buff[sce_id][0], A[sce_id][0], lsp_new[sce_id][0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, 0, 0, 0, 0, ISM_FORMAT, 0, st_ivas->hEncoderConfig->ivas_total_brate -#endif #ifdef DEBUG_MODE_INFO , st->id_element diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index c2b047ebb6c522628b1e0aafa2d51a6625c13bb0..7f6828e4d77106f4fa3be6df0edf26bf4c465636 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -277,9 +277,7 @@ ivas_error ivas_ism_metadata_enc( } else if ( hIsmMeta[ch]->ism_md_fec_cnt_enc == ISM_MD_FEC_CNT_MAX ) { -#ifdef NONBE_1273_ISM_METADATA_COUNTER hIsmMeta[ch]->ism_md_fec_cnt_enc = 0; -#endif lowrate_metadata_flag[ch] = 1; hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; @@ -569,9 +567,7 @@ ivas_error ivas_ism_metadata_enc( if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { hIsmMeta[ch]->ism_md_fec_cnt_enc++; -#ifdef NONBE_1273_ISM_METADATA_COUNTER hIsmMeta[ch]->ism_md_fec_cnt_enc = min( hIsmMeta[ch]->ism_md_fec_cnt_enc, ISM_MD_FEC_CNT_MAX ); -#endif } else { @@ -716,9 +712,7 @@ ivas_error ivas_ism_metadata_enc( if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { hIsmMeta[ch]->ism_md_fec_cnt_enc++; -#ifdef NONBE_1273_ISM_METADATA_COUNTER hIsmMeta[ch]->ism_md_fec_cnt_enc = min( hIsmMeta[ch]->ism_md_fec_cnt_enc, ISM_MD_FEC_CNT_MAX ); -#endif } else { diff --git a/lib_enc/ivas_lfe_enc.c b/lib_enc/ivas_lfe_enc.c index f4852c82f20b8928f5e91b4a0c46ad0be95b4bd5..d6527764a1a3621d24ccacf6b0d92d6b4b4aa664 100644 --- a/lib_enc/ivas_lfe_enc.c +++ b/lib_enc/ivas_lfe_enc.c @@ -164,11 +164,7 @@ static void ivas_lfe_enc_quant( } else { -#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT shift = (int16_t) floorf( IVAS_LFE_SHIFTS_PER_DOUBLE * log2_f( max_value / lfe_abs_sum ) ); -#else - shift = (int16_t) floor( IVAS_LFE_SHIFTS_PER_DOUBLE * log2_f( max_value / lfe_abs_sum ) ); -#endif } shift = max( min_shift * IVAS_LFE_SHIFTS_PER_DOUBLE, min( max_shift, shift ) ); diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 7f97c32f7fc94339c27929500b3d00e9aa43c53e..d81157a48ffedbab67a53b4858e29fb3fca5362b 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -72,11 +72,7 @@ static void ivas_merge_sba_transports( { for ( j = 0; j < input_frame; j++ ) { -#ifdef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS data_out_f[i][j] = 0.5f * ( data_in_f1[i][j] + data_in_f2[i][j] ); -#else - data_out_f[i][j] = ( data_in_f1[i][j] + data_in_f2[i][j] ); -#endif } } @@ -480,17 +476,5 @@ static void ivas_osba_render_ism_to_sba( } } -#ifndef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS - /* Gain with loudness-matching gains */ - output_gain = 0.7499f; - for ( j = 0; j < nchan_sba; j++ ) - { - for ( k = 0; k < input_frame; k++ ) - { - data_out_f[j][k] *= output_gain; - } - } -#endif - return; } diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 68efb5246a9be0d110571de237684bd73997df83..d7c12b10c1357c9eebfb51d04511a3da06ad19d6 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -41,9 +41,7 @@ #include "ivas_stat_enc.h" #include "wmc_auto.h" #include "prot.h" -#ifdef NONBE_1319_M2R_PRECISION_ALIGN #include "basop_settings.h" -#endif /*-----------------------------------------------------------------------* * Local function prototypes @@ -4911,9 +4909,8 @@ static int16_t encode_surround_coherence_hr( int16_t max_val = 0, nbits_max; int16_t no_cv_shift[MASA_MAXIMUM_CODING_SUBBANDS], min_idx; int16_t idx16; -#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP int32_t int_error_ratio_surr; -#endif + coding_subbands = hQMetaData->q_direction[0].cfg.nbands; all_coherence_zero = hQMetaData->all_coherence_zero; q_direction = &( hQMetaData->q_direction[0] ); @@ -4942,10 +4939,9 @@ static int16_t encode_surround_coherence_hr( { error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[sf]; } -#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP + int_error_ratio_surr = (int32_t) ( MASA_SUR_COH_PRECISION * error_ratio_surr ); error_ratio_surr = (float) ( int_error_ratio_surr * MASA_SUR_COH_THRESHOLD ); -#endif if ( error_ratio_surr <= 0 ) { @@ -6018,17 +6014,11 @@ void ivas_omasa_encode_masa_to_total( float dct_data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; int16_t bits_pos, nb_bits; int16_t n_streams, len_stream; -#ifdef NONBE_1319_M2R_PRECISION_ALIGN Word32 q_dct_data_fx[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS], dct_data_tmp_fx[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; int64_t step_fx; step_fx = STEP_M2T_FX; -#else -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL - int32_t int_tmp; -#endif -#endif #ifdef DEBUG_MODE_QMETADATA static FILE *pF = NULL; static FILE *pF_ratio = NULL; @@ -6137,7 +6127,6 @@ void ivas_omasa_encode_masa_to_total( } /* reconstruct masa2total */ -#ifdef NONBE_1319_M2R_PRECISION_ALIGN q_dct_data_fx[0] = (Word32) ( ( step_fx * q_idx[0] ) >> 6 ); // Q25 for ( i = 1; i < len_stream; i++ ) { @@ -6227,67 +6216,6 @@ void ivas_omasa_encode_masa_to_total( } } -#else - q_dct_data[0] = q_idx[0] * step; - for ( i = 1; i < len_stream; i++ ) - { - if ( ( q_idx[i] % 2 ) == 0 ) - { - q_dct_data[i] = -( q_idx[i] >> 1 ) * step; - } - else - { - q_dct_data[i] = ( ( q_idx[i] + 1 ) >> 1 ) * step; - } - } - - /* inverse DCT2 transform */ - switch ( len_stream ) - { - case 4: - matrix_product( dct4, nblocks, nblocks, 1, q_dct_data, nblocks, 1, 0, dct_data_tmp ); - mvr2r( dct_data_tmp, q_dct_data, nblocks ); - break; - case 5: - matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); - mvr2r( dct_data_tmp, q_dct_data, nbands ); - break; - case 8: - matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); - mvr2r( dct_data_tmp, q_dct_data, nbands ); - break; - case 12: - matrix_product( dct12, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); - mvr2r( dct_data_tmp, q_dct_data, nbands ); - break; - case 20: - matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, nblocks, 0, dct_data_tmp ); - matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 0, q_dct_data ); /* reuse of variable*/ - break; - case 32: - matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, nblocks, 0, dct_data_tmp ); - matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 0, q_dct_data ); - break; - default: - printf( "Incorrect number of coefficients for OMASA.\n" ); - break; - } - - k = 0; - for ( i = 0; i < nblocks; i++ ) - { - for ( j = 0; j < nbands; j++ ) - { - masa_to_total_energy_ratio[i][j] = max( 0.0f, q_dct_data[k] ); - masa_to_total_energy_ratio[i][j] = min( 1.0f, masa_to_total_energy_ratio[i][j] ); -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL - int_tmp = (int32_t) ( MASA2TOTAL_PREC_INV_THRESHOLD * masa_to_total_energy_ratio[i][j] ); - masa_to_total_energy_ratio[i][j] = (float) ( int_tmp * MASA2TOTAL_PREC_THRESHOLD ); -#endif - k++; - } - } -#endif assert( nb_bits == ( hMetaData->nb_bits_tot - bits_pos ) ); #ifdef DEBUG_MODE_QMETADATA diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 49cc45dd10903d2e70bda6ab012c97eb81145b1c..3b592ae232747d92fc01a6c83d34901c351ad866 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -186,11 +186,7 @@ ivas_error ivas_sce_enc( &ener[0], &relE[0], A[0], Aw[0], epsP[0], lsp_new[0], lsp_mid[0], &vad_hover_flag[0], &attack_flag[0], realBuffer[0], imagBuffer[0], old_wsp[0], pitch_fr[0], voicing_fr[0], &loc_harm[0], &cor_map_sum[0], &vad_flag_dtx[0], enerBuffer[0], fft_buff[0], A[0], lsp_new[0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, flag_16k_smc, -#ifdef NONBE_1211_DTX_BR_SWITCHING st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, ivas_format, 0, st_ivas->hEncoderConfig->last_ivas_total_brate, st_ivas->hEncoderConfig->ivas_total_brate -#else - st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, ivas_format, 0, st_ivas->hEncoderConfig->ivas_total_brate -#endif #ifdef DEBUG_MODE_INFO , st->id_element diff --git a/lib_enc/ivas_stereo_dft_enc_itd.c b/lib_enc/ivas_stereo_dft_enc_itd.c index 1d973e92dba7a493fefcea041f410afff6945096..7913a8bf5546881db6b57b942f86b91bd7564611 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd.c +++ b/lib_enc/ivas_stereo_dft_enc_itd.c @@ -288,13 +288,9 @@ static int16_t stereo_dft_enc_itd_vad( float Spd[STEREO_DFT_N_16k_ENC / 2 + 1]; -#ifdef FIX_828_PORT_1152_FROM_FLT_REPO /* Spd is later only used starting at itd_vad_band_tbl[0], so only compute values starting from there */ /* -> this avoids uninitialized values in Spd_L and Spd_R at index 0 to be used */ for ( i = itd_vad_band_tbl[0]; i < STEREO_DFT_N_16k_ENC / 2; i++ ) -#else - for ( i = 0; i <= STEREO_DFT_N_16k_ENC / 2; i++ ) -#endif { Spd[i] = 0.5f * ( Spd_L[i] + Spd_R[i] ); } @@ -1035,19 +1031,15 @@ void stereo_dft_enc_compute_itd( mEr = calc_mean_E_ratio( hItd, nbands, band_limits, sfm_L, pNrgL, pNrgR, &total_mEr ); } -/*calculate total cohSNR for frame in dB*/ -#ifdef FIX_BASOP_812_NAN_COHSNR + /*calculate total cohSNR for frame in dB*/ if ( mEr > 1.0f ) { -#endif cohSNR = 20 * log10f( mEr ); -#ifdef FIX_BASOP_812_NAN_COHSNR } else { cohSNR = 0; } -#endif /* collect UNCLR classifier parameters */ { diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 1a71686f03c497714a0ce9eec2fb7045ac916231..02bf9b6068c30d1b13a724fdf0c0ab480b647cf1 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -449,7 +449,6 @@ void tdm_configure_enc( } mod_ct = AUDIO; -#ifdef NONBE_FIX_1205_TD_STEREO_MOD_CT if ( hCPE->element_brate < IVAS_24k4 ) { /* In TD stereo, the TRANSITION mode has a specific bit allocation. All other formats share the same bit allocation. For these other formats, `mod_ct` is set to AUDIO to aid in debugging, though it does not have any functional impact. */ @@ -464,21 +463,6 @@ void tdm_configure_enc( mod_ct = TRANSITION; } } -#else - if ( hCPE->element_brate < IVAS_24k4 ) - { - mod_ct = sts[0]->coder_type; - /* Only sure TRANSITION coding modes are important for bit allocation, otherwise mod_ct is set to AUDIO only to easy debugging if needed */ - if ( ( ( sts[0]->last_L_frame >= L_FRAME16k && sts[0]->flag_ACELP16k == 0 ) || ( sts[0]->last_L_frame == L_FRAME && sts[0]->flag_ACELP16k == 1 ) ) && sts[0]->last_core_brate != FRAME_NO_DATA && sts[0]->last_core_brate != SID_2k40 && sts[0]->coder_type_raw != VOICED /*in case of CNG, this code is not reached sts[0]->core_brate != FRAME_NO_DATA && sts[0]->core_brate != SID_2k40 &&*/ ) - { - mod_ct = TRANSITION; - } - else if ( sts[0]->sp_aud_decision1 == 1 || sts[0]->sp_aud_decision2 == 1 || mod_ct != TRANSITION ) - { - mod_ct = AUDIO; - } - } -#endif /* Correction of tdm_inst_ratio_idx in case of TC in the seecondary channel */ if ( hStereoTD->flag_skip_DMX == 0 && hStereoTD->tdm_LRTD_flag == 1 && sts[1]->tc_cnt > 1 /*&& abs(hStereoTD->tdm_inst_ratio_idx-LRTD_STEREO_MID_IS_PRIM) > 5*/ ) diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 3c186cc0166c4ff745d0032486f1be1afb274dfd..8216b3c54de6b51dc5339c7e51d521b5e433c55d 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -990,11 +990,7 @@ static ivas_error configureEncoder( } #endif -#ifdef NONBE_FIX_708_OSBA_BR_SWITCHING_CRASH if ( hEncoderConfig->Opt_PCA_ON && !( ( hEncoderConfig->ivas_format == SBA_FORMAT || hEncoderConfig->ivas_format == SBA_ISM_FORMAT ) && hEncoderConfig->ivas_total_brate == PCA_BRATE && hEncoderConfig->sba_order == SBA_FOA_ORDER ) ) -#else - if ( hEncoderConfig->Opt_PCA_ON && !( hEncoderConfig->ivas_format == SBA_FORMAT && hEncoderConfig->ivas_total_brate == PCA_BRATE && hEncoderConfig->sba_order == SBA_FOA_ORDER ) ) -#endif { return IVAS_ERROR( IVAS_ERR_NOT_SUPPORTED_OPTION, "PCA supported at SBA FOA 256 kbps only." ); } @@ -2358,18 +2354,12 @@ static ivas_error forcedModeApiToInternal( case IVAS_ENC_FORCE_GSC: *forcedModeInternal = FORCE_GSC; break; -#ifdef SUPPORT_FORCE_TCX10_TCX20 case IVAS_ENC_FORCE_TCX10: *forcedModeInternal = FORCE_TCX10; break; case IVAS_ENC_FORCE_TCX20: *forcedModeInternal = FORCE_TCX20; break; -#else - case IVAS_ENC_FORCE_TCX: - *forcedModeInternal = FORCE_TCX; - break; -#endif case IVAS_ENC_FORCE_HQ: *forcedModeInternal = FORCE_HQ; break; diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index b90d897fbe70ef3dbf7f38e58303983d2c40b2f8..5a42c3dad1ebe2eb7df9caa796d0422902b35177 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -127,12 +127,8 @@ typedef enum _IVAS_ENC_FORCED_MODE IVAS_ENC_FORCE_MUSIC, IVAS_ENC_FORCE_ACELP, IVAS_ENC_FORCE_GSC, -#ifdef SUPPORT_FORCE_TCX10_TCX20 IVAS_ENC_FORCE_TCX10, IVAS_ENC_FORCE_TCX20, -#else - IVAS_ENC_FORCE_TCX, -#endif IVAS_ENC_FORCE_HQ, #ifdef DEBUG_FORCE_DIR IVAS_ENC_FORCE_FILE, diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c index 36e33aaa6715cad64beb8356d8f7bb6e6de21727..09f126c59d043befcffed51b9ce6a1c1b7c19e2f 100644 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -251,11 +251,7 @@ void pre_proc( * Select SID or FRAME_NO_DATA frame if DTX enabled *-----------------------------------------------------------------*/ -#ifdef NONBE_1211_DTX_BR_SWITCHING dtx( st, -1, -1, vad_flag_dtx, inp_12k8 ); -#else - dtx( st, -1, vad_flag_dtx, inp_12k8 ); -#endif /*----------------------------------------------------------------* * Adjust FD-CNG Noise Estimator diff --git a/lib_enc/pvq_core_enc.c b/lib_enc/pvq_core_enc.c index 83bbb2b0b75d538a5a6919ae9612568a8f3a8391..17d4dab1ea41281b1d13fe3931a89d6b766a2eab 100644 --- a/lib_enc/pvq_core_enc.c +++ b/lib_enc/pvq_core_enc.c @@ -124,12 +124,8 @@ static void pvq_encode_band( for ( j = 0; j < Np; j++ ) { g_part[j] = -( (float) g_part_s[j] ) / 32768; -#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* aligned to BASOP to avoid USAN undefined negation warning with -(-32768) */ g_part_s[j] = negate( g_part_s[j] ); -#else - g_part_s[j] = -g_part_s[j]; -#endif } srt_vec_ind( g_part_s, sg_part, idx_sort, Np ); @@ -423,18 +419,12 @@ static void densityIndexSymbolEncode( int32_t cum_freq, tot; int16_t densityPlOne, densitySubC; int16_t densitySubIndex, nearFlag; -#ifdef BASOP_NOGLOB Flag Overflow; -#endif /* BASOP_NOGLOB */ if ( ( 0xFFFE & density ) != 0 ) /* even */ { angle = atan2_fx( SQRT_DIM_fx[opp_sz], SQRT_DIM_fx[near_sz] ); -#ifndef BASOP_NOGLOB - angle = shl( angle, 1 ); -#else /* BASOP_NOGLOB */ angle = shl_o( angle, 1, &Overflow ); -#endif /* BASOP_NOGLOB */ angle = mult_r( angle, 20861 ); c = mult_r( density, angle ); diff --git a/lib_enc/swb_bwe_enc.c b/lib_enc/swb_bwe_enc.c index 8157f83372462218e04d10dec4cfb25b40ff14d4..b35fcd97d122d388d8e57d1de64222102719e622 100644 --- a/lib_enc/swb_bwe_enc.c +++ b/lib_enc/swb_bwe_enc.c @@ -1795,11 +1795,9 @@ void hq_generic_hf_encoding( { Word16 tmp, frac, exp; Word32 L_tmp; -#ifdef BASOP_NOGLOB Flag Overflow; Overflow = 0; -#endif tmp = add( (int16_t) ( hq_generic_fenv[n_band] * 256 ), (int16_t) ( Mean_env[n_band] * 256 ) ); /*Q8 */ L_tmp = L_mult( tmp, 21771 ); /* 0.166096 in Q17 -> Q26 */ @@ -1810,11 +1808,7 @@ void hq_generic_hf_encoding( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 13 ); -#ifdef BASOP_NOGLOB tmp = shl_o( tmp, add( exp, 1 ), &Overflow ); /*Q1 */ -#else - tmp = shl( tmp, add( exp, 1 ) ); /*Q1 */ -#endif hq_generic_fenv[n_band] = (float) tmp * 0.5f; /*Q1 */ } diff --git a/lib_enc/swb_tbe_enc.c b/lib_enc/swb_tbe_enc.c index febd1b14badfbad7ec4b27cbd00f0501b85e2375..70c8797bd088ac393816f318664afac1fd33c609 100644 --- a/lib_enc/swb_tbe_enc.c +++ b/lib_enc/swb_tbe_enc.c @@ -376,14 +376,12 @@ void wb_tbe_enc( prev_pow = sum2_f( shaped_wb_excitation, L_SHB_LAHEAD / 4 ); curr_pow = sum2_f( shaped_wb_excitation + L_SHB_LAHEAD / 4, L_SHB_LAHEAD / 4 ); -#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE if ( st->element_mode > EVS_MONO ) { /* prevent too low values of energy */ prev_pow = max( 0.00001f, prev_pow ); curr_pow = max( 0.00001f, curr_pow ); } -#endif if ( voice_factors[0] > 0.75f ) { @@ -1063,14 +1061,12 @@ void swb_tbe_enc( prev_pow = sum2_f( shaped_shb_excitation, L_SHB_LAHEAD + 10 ); curr_pow = sum2_f( shaped_shb_excitation + L_SHB_LAHEAD + 10, L_SHB_LAHEAD + 10 ); -#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE if ( st->element_mode > EVS_MONO ) { /* prevent too low values of energy */ prev_pow = max( 0.00001f, prev_pow ); curr_pow = max( 0.00001f, curr_pow ); } -#endif if ( voice_factors[0] > 0.75f ) { diff --git a/lib_enc/transient_detection.c b/lib_enc/transient_detection.c index 1a53d8b511e6670e27f395b8759e117e51af4224..7c169d9015a8b87adab8b1fc6f73132c22a56011 100644 --- a/lib_enc/transient_detection.c +++ b/lib_enc/transient_detection.c @@ -325,7 +325,6 @@ void SetTCXModeInfo( } } -#ifdef SUPPORT_FORCE_TCX10_TCX20 #ifdef DEBUGGING if ( st->force == FORCE_TCX10 ) { @@ -335,7 +334,6 @@ void SetTCXModeInfo( { hTcxEnc->tcxMode = TCX_20; } -#endif #endif /* set the left window overlap */ diff --git a/lib_enc/transition_enc.c b/lib_enc/transition_enc.c index e2be62f565689bca3203d0a89c7fb25542169dcc..016f5ba0fa970a193b91f59be5016f43b16dd019 100644 --- a/lib_enc/transition_enc.c +++ b/lib_enc/transition_enc.c @@ -178,11 +178,7 @@ void transition_enc( if ( *tc_subfr == TC_0_0 ) { /* this is called only to compute unused bits */ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, L_FRAME, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, TC_0_0, 3, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); -#else - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, L_FRAME, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, TC_0_0, 3, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); -#endif } *clip_gain = gp_clip( st->element_mode, st->core_brate, st->voicing, i_subfr, TRANSITION, xn, gp_cl ); @@ -278,11 +274,7 @@ void transition_enc( if ( i_subfr - *tc_subfr <= L_SUBFR ) { -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, *tc_subfr, 2, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); -#else - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, *tc_subfr, 2, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); -#endif } /*-----------------------------------------------------------------* diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index e8377e54bab67e4ae61a5bbad69989a3c6071c07..a3fe0b61fb9a6a98e73fd786f4c395c32a8b1fa2 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -48,11 +48,8 @@ * Local constants *------------------------------------------------------------------------------------------*/ -#define OTR_UPDATE_RATE (float) FRAMES_PER_SEC /* rate of the Process() calls [Hz]; 1x per IVAS frame */ -#ifdef NONBE_FIX_738_QUATERNION_SLERP_PRECISION +#define OTR_UPDATE_RATE (float) FRAMES_PER_SEC /* rate of the Process() calls [Hz]; 1x per IVAS frame */ #define COS_ONE_TENTH_DEGREE ( 0.999998476913288f ) -#endif - /*------------------------------------------------------------------------------------------* * Local functions @@ -160,7 +157,6 @@ void QuaternionSlerp( const float t, IVAS_QUATERNION *const r ) { -#ifdef NONBE_FIX_738_QUATERNION_SLERP_PRECISION IVAS_QUATERNION r1, r2; float phi, sinPhi, cosPhi, s1, s2; @@ -199,28 +195,7 @@ void QuaternionSlerp( r->y = ( s1 * r1.y + s2 * r2.y ) / sinPhi; r->z = ( s1 * r1.z + s2 * r2.z ) / sinPhi; } -#else - - float angle, denom, s, s2; - s = QuaternionDotProduct( q1, q2 ); - - if ( fabsf( s ) >= 1.0f ) - { - *r = q2; - return; - } - - angle = acosf( s ); - denom = sinf( angle ); - - s = sinf( ( 1 - t ) * angle ); - s2 = sinf( t * angle ); - r->x = ( q1.x * s + q2.x * s2 ) / denom; - r->y = ( q1.y * s + q2.y * s2 ) / denom; - r->z = ( q1.z * s + q2.z * s2 ) / denom; - r->w = ( q1.w * s + q2.w * s2 ) / denom; -#endif QuaternionNormalize( *r, r ); return;