From 78c85dc297dd5a578b93edf9adbeae3b3caf2e31 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 7 Aug 2023 17:24:14 +0200 Subject: [PATCH 1/2] revert interface changes to div_s(), div_l() --- lib_com/ari_hm.c | 4 +- lib_com/arith_coder.c | 8 +-- lib_com/basop32.c | 136 +++++++++++------------------------ lib_com/basop32.h | 12 ++-- lib_com/basop_util.c | 6 +- lib_com/bitalloc.c | 20 +++--- lib_com/hq2_bit_alloc.c | 22 +++--- lib_com/hq2_core_com.c | 4 +- lib_com/lerp.c | 2 +- lib_com/pvq_com.c | 4 +- lib_com/tcq_position_arith.c | 20 +++--- lib_dec/gain_dec.c | 2 +- lib_dec/hq_lr_dec.c | 26 +++---- lib_enc/gain_enc.c | 2 +- lib_enc/hq_lr_enc.c | 26 +++---- 15 files changed, 118 insertions(+), 176 deletions(-) diff --git a/lib_com/ari_hm.c b/lib_com/ari_hm.c index f1f9d5a42b..3995913c43 100644 --- a/lib_com/ari_hm.c +++ b/lib_com/ari_hm.c @@ -236,7 +236,7 @@ int16_t tcx_hm_render( } ELSE { - div_s( &tmp, 13915, PeakDeviation ); + tmp = div_s( 13915, PeakDeviation ); tmp = mult_r( tmp, tmp ); /* Q15 */ } @@ -282,7 +282,7 @@ void tcx_hm_modify_envelope( for ( k = 0; k < 2 * kTcxHmParabolaHalfWidth + 1; ++k ) { - div_s( &inv_shape[k], 512, add( 512, round_fx( L_mult( gain, p[k] ) ) ) ); + inv_shape[k] = div_s( 512, add( 512, round_fx( L_mult( gain, p[k] ) ) ) ); } h = 1; diff --git a/lib_com/arith_coder.c b/lib_com/arith_coder.c index 1912b4cbf2..cc29c97477 100644 --- a/lib_com/arith_coder.c +++ b/lib_com/arith_coder.c @@ -281,7 +281,7 @@ void tcx_arith_scale_envelope( mean = L_add( mean, ienv[k] ); } tmp = norm_s( L_frame ); - div_s( &tmp2, 8192, shl( L_frame, tmp ) ); + tmp2 = div_s( 8192, shl( L_frame, tmp ) ); tmp = shl( tmp2, sub( tmp, 7 ) ); mean = L_shr( Mpy_32_16( mean, tmp ), 6 ); /* Q16 */ @@ -416,7 +416,7 @@ void tcx_arith_scale_envelope( IF( hib > 0 ) /* Bisection search */ { - div_s( &adjust, sub( hib_bits, target_bits ), sub( hib_bits, lob_bits ) ); + adjust = div_s( sub( hib_bits, target_bits ), sub( hib_bits, lob_bits ) ); scale = add( mult_r( sub( lob, hib ), adjust ), hib ); } ELSE @@ -439,7 +439,7 @@ void tcx_arith_scale_envelope( IF( lob > 0 ) /* Bisection search */ { - div_s( &adjust, sub( hib_bits, target_bits ), sub( hib_bits, lob_bits ) ); + adjust = div_s( sub( hib_bits, target_bits ), sub( hib_bits, lob_bits ) ); scale = add( mult_r( sub( lob, hib ), adjust ), hib ); } ELSE @@ -458,7 +458,7 @@ void tcx_arith_scale_envelope( } ELSE { - div_s( &adjust, mult_r( 31130 /*0.95f Q15*/, target_bits ), bits ); + adjust = div_s( mult_r( 31130 /*0.95f Q15*/, target_bits ), bits ); } scale = mult_r( scale, adjust ); } diff --git a/lib_com/basop32.c b/lib_com/basop32.c index 1f28351c79..a3b764499d 100644 --- a/lib_com/basop32.c +++ b/lib_com/basop32.c @@ -163,8 +163,6 @@ HISTORY: #ifdef BASOP_NOGLOB #include #endif /* BASOP_NOGLOB */ -#include "ivas_error.h" -#include "ivas_error_utils.h" #define WMC_TOOL_SKIP @@ -410,9 +408,6 @@ Word16 sub( Word16 var1, Word16 var2 ) L_diff = (Word32) var1 - var2; var_out = saturate( L_diff ); -#ifndef BASOP_NOGLOB - -#endif /* ! BASOP_NOGLOB */ return ( var_out ); } @@ -727,9 +722,7 @@ Word16 mult( Word16 var1, Word16 var2 ) return ( var_out ); } -#ifndef BASOP_NOGLOB -#endif /* ! BASOP_NOGLOB */ /*___________________________________________________________________________ | | | Function Name : L_mult | @@ -790,9 +783,6 @@ Word32 L_mult_o( Word16 var1, Word16 var2, Flag *Overflow ) BASOP_CHECK(); -#ifndef BASOP_NOGLOB - -#endif /* ! BASOP_NOGLOB */ return ( L_var_out ); } @@ -1000,15 +990,10 @@ Word16 round_fx( Word32 L_var1 ) BASOP_CHECK(); -#ifndef BASOP_NOGLOB - -#endif /* ! BASOP_NOGLOB */ return ( var_out ); } -#ifndef BASOP_NOGLOB -#endif /* ! BASOP_NOGLOB */ /*___________________________________________________________________________ | | | Function Name : L_mac | @@ -1070,15 +1055,10 @@ Word32 L_mac( Word32 L_var3, Word16 var1, Word16 var2 ) BASOP_CHECK(); -#ifndef BASOP_NOGLOB - -#endif /* ! BASOP_NOGLOB */ return ( L_var_out ); } -#ifndef BASOP_NOGLOB -#endif /* ! BASOP_NOGLOB */ /*___________________________________________________________________________ | | | Function Name : L_msu | @@ -1140,15 +1120,10 @@ Word32 L_msu( Word32 L_var3, Word16 var1, Word16 var2 ) BASOP_CHECK(); -#ifndef BASOP_NOGLOB - -#endif /* ! BASOP_NOGLOB */ return ( L_var_out ); } -#ifndef BASOP_NOGLOB -#endif /* ! BASOP_NOGLOB */ /*___________________________________________________________________________ | | | Function Name : L_macNs | @@ -1421,9 +1396,6 @@ Word32 L_sub_o( Word32 L_var1, Word32 L_var2, Flag *Overflow ) BASOP_CHECK(); -#ifndef BASOP_NOGLOB - -#endif /* ! BASOP_NOGLOB */ return ( L_var_out ); } @@ -1781,14 +1753,8 @@ Word32 L_negate( Word32 L_var1 ) L_var_out = ( L_var1 == MIN_32 ) ? MAX_32 : -L_var1; -#ifndef BASOP_NOGLOB - -#endif /* ! BASOP_NOGLOB */ BASOP_CHECK(); -#ifndef BASOP_NOGLOB - -#endif /* ! BASOP_NOGLOB */ return ( L_var_out ); } @@ -1868,9 +1834,7 @@ Word16 mult_r( Word16 var1, Word16 var2 ) return ( var_out ); } -#ifndef BASOP_NOGLOB -#endif /* ! BASOP_NOGLOB */ /*___________________________________________________________________________ | | | Function Name : L_shl | @@ -2109,9 +2073,7 @@ Word32 L_shr( Word32 L_var1, Word16 var2 ) return ( L_var_out ); } -#ifndef BASOP_NOGLOB -#endif /* ! BASOP_NOGLOB */ /*___________________________________________________________________________ | | | Function Name : shr_r | @@ -2176,9 +2138,6 @@ Word16 shr_r( Word16 var1, Word16 var2 ) BASOP_CHECK(); -#ifndef BASOP_NOGLOB - -#endif /* ! BASOP_NOGLOB */ return ( var_out ); } @@ -2315,15 +2274,10 @@ Word16 msu_r( Word32 L_var3, Word16 var1, Word16 var2 ) BASOP_CHECK(); -#ifndef BASOP_NOGLOB - -#endif /* ! BASOP_NOGLOB */ return ( var_out ); } -#ifndef BASOP_NOGLOB -#endif /* ! BASOP_NOGLOB */ /*___________________________________________________________________________ | | | Function Name : L_deposit_h | @@ -2697,45 +2651,49 @@ Word16 norm_s( Word16 var1 ) | It's a Q15 value (point between b15 and b14). | |___________________________________________________________________________| */ -ivas_error div_s( Word16 *result, Word16 var1, Word16 var2 ) +Word16 div_s (Word16 var1, Word16 var2) { Word16 var_out = 0; Word16 iteration; Word32 L_num; Word32 L_denom; - if ( ( var1 > var2 ) || ( var1 < 0 ) || ( var2 < 0 ) ) + if ((var1 > var2) || (var1 < 0) || (var2 < 0)) { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Division Error var1=%d var2=%d in div_s", var1, var2 ); + /* printf ("Division Error var1=%d var2=%d in ", var1, var2); printStack(); */ + char text[60]; + sprintf (text, "Division Error var1=%d var2=%d in ", var1, var2); + abort(); /* exit (0); */ } - if ( var2 == 0 ) + if (var2 == 0) { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Division by 0 in div_s" ); + /* printf ("Division by 0, Fatal error in "); printStack(); */ + abort(); /* exit (0); */ } - if ( var1 == 0 ) + if (var1 == 0) { var_out = 0; } else { - if ( var1 == var2 ) + if (var1 == var2) { var_out = MAX_16; } else { - L_num = L_deposit_l( var1 ); - L_denom = L_deposit_l( var2 ); + L_num = L_deposit_l (var1); + L_denom = L_deposit_l (var2); - for ( iteration = 0; iteration < 15; iteration++ ) + for (iteration = 0; iteration < 15; iteration++) { var_out <<= 1; L_num <<= 1; - if ( L_num >= L_denom ) + if (L_num >= L_denom) { - L_num = L_sub( L_num, L_denom ); - var_out = add( var_out, 1 ); + L_num = L_sub (L_num, L_denom); + var_out = add (var_out, 1); } } } @@ -2743,8 +2701,8 @@ ivas_error div_s( Word16 *result, Word16 var1, Word16 var2 ) BASOP_CHECK(); - *result = var_out; - return IVAS_ERR_OK; + + return (var_out); } @@ -2886,15 +2844,10 @@ Word32 L_mls( Word32 Lv, Word16 v ) BASOP_CHECK(); -#ifndef BASOP_NOGLOB - -#endif /* ! BASOP_NOGLOB */ return Temp; } -#ifndef BASOP_NOGLOB -#endif /* ! BASOP_NOGLOB */ /*__________________________________________________________________________ | | | Function Name : div_l | @@ -2933,55 +2886,53 @@ Word32 L_mls( Word32 Lv, Word16 v ) | It's a Q15 value (point between b15 and b14). | |___________________________________________________________________________| */ -ivas_error div_l( Word16 *result, Word32 L_num, Word16 den ) +Word16 div_l (Word32 L_num, Word16 den) { - Word16 var_out = (Word16) 0; - Word32 L_den; - Word16 iteration; - ivas_error error; + Word16 var_out = (Word16)0; + Word32 L_den; + Word16 iteration; - error = IVAS_ERR_OK; if ( den == (Word16) 0 ) { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Division by 0 in div_l, Fatal error in div_l" ); + /* printf("Division by 0 in div_l, Fatal error in "); printStack(); */ + exit(-1); } - if ( ( L_num < (Word32) 0 ) || ( den < (Word16) 0 ) ) + if ( (L_num < (Word32) 0) || (den < (Word16) 0) ) { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Division Error in div_l, Fatal error in div_l" ); + /* printf("Division Error in div_l, Fatal error in "); printStack(); */ + exit(-1); } - L_den = L_deposit_h( den ); + L_den = L_deposit_h( den ) ; if ( L_num >= L_den ) { + + BASOP_CHECK(); - *result = MAX_16; - return error; + return MAX_16 ; } else { - L_num = L_shr( L_num, (Word16) 1 ); - L_den = L_shr( L_den, (Word16) 1 ); - for ( iteration = (Word16) 0; iteration < (Word16) 15; iteration++ ) + L_num = L_shr(L_num, (Word16)1) ; + L_den = L_shr(L_den, (Word16)1); + for(iteration=(Word16)0; iteration< (Word16)15; iteration++) { - var_out = shl( var_out, (Word16) 1 ); - L_num = L_shl( L_num, (Word16) 1 ); - if ( L_num >= L_den ) + var_out = shl( var_out, (Word16)1); + L_num = L_shl( L_num, (Word16)1); + if (L_num >= L_den) { - L_num = L_sub( L_num, L_den ); - var_out = add( var_out, (Word16) 1 ); + L_num = L_sub(L_num,L_den); + var_out = add(var_out, (Word16)1); } } -#ifndef BASOP_NOGLOB -#endif /* ! BASOP_NOGLOB */ BASOP_CHECK(); - *result = var_out; - return error; + return var_out; } } @@ -3138,9 +3089,7 @@ Word32 L_mac0( Word32 L_var3, Word16 var1, Word16 var2 ) return ( L_var_out ); } -#ifndef BASOP_NOGLOB -#endif /* ! BASOP_NOGLOB */ /*___________________________________________________________________________ | | Function Name : L_msu0 @@ -3200,8 +3149,5 @@ Word32 L_msu0( Word32 L_var3, Word16 var1, Word16 var2 ) return ( L_var_out ); } -#ifndef BASOP_NOGLOB - -#endif /* ! BASOP_NOGLOB */ #undef WMC_TOOL_SKIP diff --git a/lib_com/basop32.h b/lib_com/basop32.h index ff41a1d81d..83a458382e 100644 --- a/lib_com/basop32.h +++ b/lib_com/basop32.h @@ -79,10 +79,6 @@ #define _BASIC_OP_H #include "typedef.h" -#include "ivas_error.h" -#ifndef BASOP_NOGLOB - -#endif /* ! BASOP_NOGLOB */ #define BASOP_OVERFLOW2 /*___________________________________________________________________________ @@ -218,13 +214,13 @@ Word32 L_shr_r( Word32 L_var1, Word16 var2 ); /* 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 */ -ivas_error div_s( Word16 *result, Word16 var1, Word16 var2 ); /* Short division, 18 */ +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 */ -ivas_error div_s( Word16 *result, Word16 var1, Word16 var2 ); /* Short division, 18 */ +Word16 div_s (Word16 var1, Word16 var2); /* Short division, 18 */ Word16 norm_l( Word32 L_var1 ); /* Long norm, 1 */ #endif /* BASOP_NOGLOB */ @@ -234,11 +230,11 @@ Word16 norm_l( Word32 L_var1 ); /* */ #ifndef BASOP_NOGLOB Word32 L_mls( Word32, Word16 ); /* Weight FFS; currently assigned 5 */ -ivas_error div_l( Word16 *result, Word32, Word16 ); /* Weight FFS; currently assigned 32 */ +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 */ -ivas_error div_l( Word16 *result, Word32, Word16 ); /* Weight FFS; currently assigned 32 */ +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 */ diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index bfd05e09e2..09ccc44ae6 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -490,7 +490,7 @@ Word16 BASOP_Util_Divide1616_Scale( move16(); *s = add( *s, sy ); - div_s( &z, x, y ); + z = div_s( x, y ); if ( sign != 0 ) { @@ -670,7 +670,7 @@ Word16 idiv1616U( BASOP_SATURATE_WARNING_ON /* divide and shift */ - div_s( &tmp, x, y ); + tmp = div_s( x, y ); y = shr( tmp, sub( 15, s ) ); return y; @@ -781,7 +781,7 @@ Word16 BASOP_Util_Divide3216_Scale( *s = sub( sy, sx ); move16(); - div_s( &z, round_fx( x ), y ); + z = div_s( round_fx( x ), y ); if ( sign < 0 ) /* if sign bits differ, negate the result */ { diff --git a/lib_com/bitalloc.c b/lib_com/bitalloc.c index e8db20d133..e560e300a1 100644 --- a/lib_com/bitalloc.c +++ b/lib_com/bitalloc.c @@ -289,7 +289,7 @@ int16_t BitAllocF( n = 0; tmp = add( band_end_HQ[num_env_bands - 1], shl( band_end_HQ[num_env_bands - 1], 1 ) ); exp1 = norm_s( tmp ); - div_s( &tmp, 16384, shl( tmp, exp1 ) ); /*15 + 14 - exp1*/ + tmp = div_s( 16384, shl( tmp, exp1 ) ); /*15 + 14 - exp1*/ exp2 = norm_s( tmp ); tmp = shl( tmp, exp2 ); exp1 = add( 29, sub( exp2, exp1 ) ); @@ -331,7 +331,7 @@ int16_t BitAllocF( n = 0; tmp = add( band_end_HQ[N - 1], shl( band_end_HQ[N - 1], 1 ) ); exp1 = norm_s( tmp ); - div_s( &tmp, 16384, shl( tmp, exp1 ) ); /*15 + 14 - exp1*/ + tmp = div_s( 16384, shl( tmp, exp1 ) ); /*15 + 14 - exp1*/ exp2 = norm_s( tmp ); tmp = shl( tmp, exp2 ); exp1 = add( 29, sub( exp2, exp1 ) ); @@ -364,7 +364,7 @@ int16_t BitAllocF( L_tmp1 = L_sub( t_fx, B_fx ); exp1 = sub( norm_l( L_tmp1 ), 1 ); exp2 = norm_s( n ); - div_s( &tmp, extract_h( L_shl( L_tmp1, exp1 ) ), shl( n, exp2 ) ); /*15 + 15 + exp1 - 16 - exp2*/ + 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 @@ -434,7 +434,7 @@ int16_t BitAllocF( { exp1 = sub( norm_l( L_tmp2 ), 1 ); exp2 = norm_s( n ); - div_s( &tmp, extract_h( L_shl( L_tmp2, exp1 ) ), shl( n, exp2 ) ); /*15 + 15 + exp1 - 16 - exp2*/ + 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 */ @@ -589,7 +589,7 @@ static void Bit_group_fx( reordvct( y_index, band_num, index ); /* norm vector modification */ - div_s( &factor_fx, 1, band_num ); /*Q15 */ + factor_fx = div_s( 1, band_num ); /*Q15 */ IF( sub( thr, 5 ) > 0 ) { FOR( i = 0; i < band_num; i++ ) @@ -650,7 +650,7 @@ static void Bit_group_fx( { exp = norm_s( norm_sum ); tmp = shl( norm_sum, exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp) */ Bits_avg_fx = L_mult( tmp, Bits ); /*Q(30-exp) */ FOR( k = 0; k <= i; k++ ) @@ -717,7 +717,7 @@ static void Bit_group_fx( { exp = norm_s( norm_sum ); tmp = shl( norm_sum, exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp) */ Bits_avg_fx = L_mult( tmp, Bits ); /*Q(30-exp) */ FOR( k = 0; k < i; k++ ) { @@ -842,7 +842,7 @@ int16_t BitAllocWB( move16(); /*Q0 */ } } - div_s( &tmp, 1, BANDS - SFM_G1G2 ); /*Q15 */ + tmp = div_s( 1, BANDS - SFM_G1G2 ); /*Q15 */ Ravg_sub_32_fx[2] = L_mult( Rsum_sub_fx[2], tmp ); move32(); /*Q16 */ @@ -873,7 +873,7 @@ int16_t BitAllocWB( { exp = norm_s( Rsum_fx ); tmp = shl( Rsum_fx, exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp) */ L_tmp1 = L_mult( B, Rsum_sub_fx[0] ); /*Q1 */ Mpy_32_16_ss( L_tmp1, tmp, &L_tmp, &lo ); B1 = extract_h( L_shl( L_tmp, add( exp, 1 ) ) ); /*Q0 */ @@ -970,7 +970,7 @@ int16_t BitAllocWB( { exp = norm_s( Rsum_fx ); tmp = shl( Rsum_fx, exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp) */ L_tmp1 = L_mult( B, Rsum_sub_fx[0] ); /*Q1 */ Mpy_32_16_ss( L_tmp1, tmp, &L_tmp, &lo ); B1 = extract_h( L_shl( L_tmp, add( exp, 1 ) ) ); /*Q0 */ diff --git a/lib_com/hq2_bit_alloc.c b/lib_com/hq2_bit_alloc.c index 6b53adec8f..34c37babd3 100644 --- a/lib_com/hq2_bit_alloc.c +++ b/lib_com/hq2_bit_alloc.c @@ -96,7 +96,7 @@ static Word16 div_s_ss( norm_d = norm_s( d ); ds = shl( d, norm_d ); - div_s( &tmp, ns, ds ); + tmp = div_s( ns, ds ); res = shr( tmp, add( sub( norm_n, norm_d ), 15 ) ); return res; @@ -209,7 +209,7 @@ static void Bits2indvsb_fx( exp_normn = norm_s( be_sum_fx ); exp_normn = sub( exp_normn, 1 ); exp_normd = norm_s( be_cnt_fx ); - div_s( &Ravg_fx, shl( be_sum_fx, exp_normn ), shl( be_cnt_fx, exp_normd ) ); + Ravg_fx = div_s( shl( be_sum_fx, exp_normn ), shl( be_cnt_fx, exp_normd ) ); Ravg_fx = shr( Ravg_fx, 2 ); /* safe shift */ QRavg = add( sub( exp_normn, exp_normd ), 15 - 2 ); @@ -246,7 +246,7 @@ static void Bits2indvsb_fx( exp_normn = norm_s( be_sum_fx ); exp_normn = sub( exp_normn, 1 ); exp_normd = norm_s( Rcnt_fx ); - div_s( &Ravg_fx, shl( be_sum_fx, exp_normn ), shl( Rcnt_fx, exp_normd ) ); + Ravg_fx = div_s( shl( be_sum_fx, exp_normn ), shl( Rcnt_fx, exp_normd ) ); Ravg_fx = shr( Ravg_fx, 2 ); /* safe shift */ QRavg = add( sub( exp_normn, exp_normd ), 15 - 2 ); @@ -267,7 +267,7 @@ static void Bits2indvsb_fx( exp_normn = norm_s( Bits ); exp_normn = sub( exp_normn, 1 ); exp_normd = norm_s( be_sum_fx ); - div_s( &Bits_avg_fx, shl( Bits, exp_normn ), shl( be_sum_fx, exp_normd ) ); + Bits_avg_fx = div_s( shl( Bits, exp_normn ), shl( be_sum_fx, exp_normd ) ); Bits_avg_fx = shr( Bits_avg_fx, 2 ); /* safe_shift */ QBavg = add( sub( exp_normn, exp_normd ), 15 - 2 ); } @@ -623,20 +623,20 @@ void hq2_bit_alloc_har( exp_normn = sub( exp_normn, 1 ); exp_normd = norm_s( N_fx ); - div_l( &div_fx, L_shl( L_temp, exp_normn ), shl( N_fx, exp_normd ) ); /* (Qbe+exp_normn)-(0+exp_normd)-1) */ + div_fx = div_l( L_shl( L_temp, exp_normn ), shl( N_fx, exp_normd ) ); /* (Qbe+exp_normn)-(0+exp_normd)-1) */ L_norm_sum_avg = L_shr( L_deposit_h( div_fx ), add( sub( exp_normn, exp_normd ), 15 ) ); /* -> Qbe */ exp_norm = norm_l( L_norm_sum ); norm_sum_fx = extract_h( L_shl( L_norm_sum, exp_norm ) ); /* SWB_BWE_LR_Qbe+exp_norm-16 */ Qns = sub( add( SWB_BWE_LR_Qbe, exp_norm ), 16 ); - div_s( &Inv_norm_sum_fx, 0x4000 /* Q15 */, norm_sum_fx ); + Inv_norm_sum_fx = div_s( 0x4000 /* Q15 */, norm_sum_fx ); QIns = sub( 31, exp_norm ); /* 14 - (14+exp_norm-16) + 15 */ grp_bit_avg_fx = div_s_ss( B_fx, GRP_SB ); /* Q0 */ exp_normd = norm_s( p2a_bands_fx ); - div_s( &Inv_p2a_bands_fx, 0x3fff, shl( p2a_bands_fx, exp_normd ) ); /* 14-exp_normd+15 */ + Inv_p2a_bands_fx = div_s( 0x3fff, shl( p2a_bands_fx, exp_normd ) ); /* 14-exp_normd+15 */ QIpb = sub( 29, exp_normd ); L_temp = L_shl( Mpy_32_16( L_Ravg_sub[GRP_SB - 1], Inv_p2a_bands_fx ), sub( SWB_BWE_LR_Qbe, sub( QIpb, 1 ) ) ); @@ -655,7 +655,7 @@ void hq2_bit_alloc_har( exp_normn = sub( exp_normn, 1 ); exp_normd = norm_s( harmonic_band_fx ); - div_s( &div_fx, shl( norm_sum_fx, exp_normn ), shl( harmonic_band_fx, exp_normd ) ); + div_fx = div_s( shl( norm_sum_fx, exp_normn ), shl( harmonic_band_fx, exp_normd ) ); L_avg_enhf_en_diff = L_sub( L_temp_band_energy[index_fx[0]], L_shl( L_deposit_h( div_fx ), sub( sub( SWB_BWE_LR_Qbe, ( add( Qns, sub( exp_normn, exp_normd ) ) ) ), 31 ) ) ); /* Qbe - (Qns+exp_normn-(exp_normd)+15) -16 */ IF( sub( lf_hf_ge_r_fx, 26214 ) > 0x0 && L_sub( L_avg_enhf_en_diff, (Word32) ( 8 << SWB_BWE_LR_Qbe ) ) > 0x0L ) /* 0.8=26214.4(Q15) 8.0f=131072(Qbe) */ @@ -861,11 +861,11 @@ void hq2_bit_alloc( tmp = s_max( tmp, 1 ); IF( L_Ravg > 0 ) { - div_l( &div_fx, L_shl( L_Ravg, exp_normd ), tmp ); /* Qdiv = 14+exp_normd-(exp_normn)-1 */ + div_fx = div_l( L_shl( L_Ravg, exp_normd ), tmp ); /* Qdiv = 14+exp_normd-(exp_normn)-1 */ } ELSE { - div_l( &div_fx, L_shl( L_abs( L_Ravg ), exp_normd ), tmp ); /* Qdiv = 14+exp_normd-(exp_normn)-1 */ + div_fx = div_l( L_shl( L_abs( L_Ravg ), exp_normd ), tmp ); /* Qdiv = 14+exp_normd-(exp_normn)-1 */ div_fx = negate( div_fx ); } @@ -883,7 +883,7 @@ void hq2_bit_alloc( test(); IF( bit_budget_norm_fx > 0 && sub( bit_budget_norm_fx, tmp ) < 0 ) { - div_s( &div_fx, bit_budget_norm_fx, tmp ); + div_fx = div_s( bit_budget_norm_fx, tmp ); } Qdiv = add( sub( exp_normd, exp_normn ), 15 ); diff --git a/lib_com/hq2_core_com.c b/lib_com/hq2_core_com.c index aafe578b42..22a596a75f 100644 --- a/lib_com/hq2_core_com.c +++ b/lib_com/hq2_core_com.c @@ -334,7 +334,7 @@ void bit_allocation_second_fx( { exp = norm_s( band_width[k_sort[k]] ); tmp = shl( band_width[k_sort[k]], exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp = 29-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp = 29-exp) */ L_tmp = Mult_32_16( Rk_sort[k], tmp ); /* Q(16+29-exp-15 = 30-exp) */ tmp = sub( 18, exp ); ever_bits[k] = extract_l( L_shr( L_tmp, tmp ) ); /*Q12 */ @@ -354,7 +354,7 @@ void bit_allocation_second_fx( { exp = norm_s( band_width[k_sort[k]] ); tmp = shl( band_width[k_sort[k]], exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp = 29-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp = 29-exp) */ L_tmp = Mult_32_16( Rk_sort[k], tmp ); /* Q(16+29-exp-15 = 30-exp) */ tmp = sub( 18, exp ); ever_sort[k] = extract_l( L_shr( L_tmp, tmp ) ); /*Q12 */ diff --git a/lib_com/lerp.c b/lib_com/lerp.c index 1172710313..60e7bf628e 100644 --- a/lib_com/lerp.c +++ b/lib_com/lerp.c @@ -132,7 +132,7 @@ static void lerp_proc( } /* Using the basop code to avoid reading beyond end of input for bufferOldSize=320, bufferNewSize=640 */ - div_s( &tmp, bufferOldSize, shl( bufferNewSize, 4 ) ); + tmp = div_s( bufferOldSize, shl( bufferNewSize, 4 ) ); shift = (float) ( L_shl( L_deposit_l( tmp ), 4 - 15 + 16 ) ) / 65536.0f; pos = 0.5f * shift - 0.5f; diff --git a/lib_com/pvq_com.c b/lib_com/pvq_com.c index d655dd7d4a..62587ef687 100644 --- a/lib_com/pvq_com.c +++ b/lib_com/pvq_com.c @@ -789,7 +789,7 @@ Word16 ratio( expNumer = norm_l( numer ); /* exponent */ manNumer = extract_h( L_shl( numer, expNumer ) ); /* mantissa */ manNumer = shr( manNumer, 1 ); /* Ensure the numerator < the denominator */ - div_s( "ient, manNumer, manDenom ); /* in Q14 */ + quotient = div_s( manNumer, manDenom ); /* in Q14 */ *expo = sub( expNumer, expDenom ); @@ -836,7 +836,7 @@ Word16 atan2_fx( */ expo = norm_l( arg ); man = extract_h( L_shl( arg, expo ) ); - div_s( &reciprocal, 0x3fff, man ); + reciprocal = div_s( 0x3fff, man ); expo = sub( 15 + 1, expo ); reciprocal = shr( reciprocal, expo ); /* Q14*/ angle = sub( 25736, reciprocal ); /* Q14 (EVS_PI/2 - 1/x) */ diff --git a/lib_com/tcq_position_arith.c b/lib_com/tcq_position_arith.c index 1869562074..306f29a60b 100644 --- a/lib_com/tcq_position_arith.c +++ b/lib_com/tcq_position_arith.c @@ -350,7 +350,7 @@ void decode_position_ari_fx( mode_num_nz[0] = MAX_AR_FREQ; for ( i = 0; i < size; i++ ) { - div_l( &tmp, L_deposit_h( size - i - 1 ), size ); + tmp = div_l( L_deposit_h( size - i - 1 ), size ); mode_num_nz[i + 1] = round_fx( L_shr( L_deposit_h( tmp ), 1 ) ); } @@ -377,7 +377,7 @@ void decode_position_ari_fx( } else { - div_l( &tmp, L_deposit_h( nzp ), ( size - i ) ); + tmp = div_l( L_deposit_h( nzp ), ( size - i ) ); cp = L_sub( fxone, tmp ); } scp = Mult_32_16( scp, extract_l( cp ) ); @@ -422,7 +422,7 @@ void decode_position_ari_fx( mode_num_nz[0] = MAX_AR_FREQ; for ( i = 0; i < size; i++ ) { - div_l( &tmp, L_deposit_h( size - i - 1 ), size ); + tmp = div_l( L_deposit_h( size - i - 1 ), size ); mode_num_nz[i + 1] = round_fx( L_shr( L_deposit_h( tmp ), 1 ) ); } @@ -505,7 +505,7 @@ void decode_magnitude_usq_fx( else { Word16 tmp; - div_l( &tmp, L_deposit_h( magnzp ), magnp - i ); + tmp = div_l( L_deposit_h( magnzp ), magnp - i ); cp = L_sub( fxone, tmp ); } @@ -671,7 +671,7 @@ void decode_mangitude_tcq_fx( { exp1 = sub( norm_s( num ), 1 ); exp2 = norm_s( denum ); - div_s( &prob1_fx, shl( num, exp1 ), shl( denum, exp2 ) ); /*15 + exp1 - exp2 */ + prob1_fx = div_s( shl( num, exp1 ), shl( denum, exp2 ) ); /*15 + exp1 - exp2 */ exp = 15 + exp1 - exp2; prob1_fx = shl( prob1_fx, sub( 15, exp ) ); prob0_fx = sub( MAX_16, prob1_fx ); @@ -776,7 +776,7 @@ Word16 GetScale_fx( exp1 = sub( norm_l( bits_fx ), 1 ); exp2 = norm_s( blen - 1 ); - div_l( &tmp, L_shl( bits_fx, exp1 ), shl( blen - 1, exp2 ) ); + tmp = div_l( L_shl( bits_fx, exp1 ), shl( blen - 1, exp2 ) ); b = L_shr( L_deposit_l( tmp ), exp1 - exp2 ); ab = L_add( a, b ); @@ -904,7 +904,7 @@ Word32 encode_position_ari_fx( else { Word16 tmp; - div_l( &tmp, L_deposit_h( nz ), ( size - i ) ); + tmp = div_l( L_deposit_h( nz ), ( size - i ) ); cp = L_sub( fxone, tmp ); } scp = Mult_32_16( scp, extract_l( cp ) ); @@ -945,7 +945,7 @@ Word32 encode_position_ari_fx( for ( i = 0; i < size; i++ ) { Word16 tmp; - div_l( &tmp, L_deposit_h( size - i - 1 ), size ); + tmp = div_l( L_deposit_h( size - i - 1 ), size ); model_num_nz[i + 1] = round_fx( L_shr( L_deposit_h( tmp ), 1 ) ); if ( cur_quants[i] != 0 ) @@ -1010,7 +1010,7 @@ Word32 encode_magnitude_tcq_fx( { exp1 = sub( norm_s( num ), 1 ); exp2 = norm_s( denum ); - div_s( &prob1_fx, shl( num, exp1 ), shl( denum, exp2 ) ); /*15 + exp1 - exp2 */ + prob1_fx = div_s( shl( num, exp1 ), shl( denum, exp2 ) ); /*15 + exp1 - exp2 */ exp = 15 + exp1 - exp2; prob1_fx = shl( prob1_fx, sub( 15, exp ) ); prob0_fx = sub( MAX_16, prob1_fx ); @@ -1133,7 +1133,7 @@ Word32 encode_magnitude_usq_fx( else { Word16 tmp; - div_l( &tmp, L_deposit_h( magnzp ), magnp ); + tmp = div_l( L_deposit_h( magnzp ), magnp ); cp = L_sub( fxone, tmp ); } scp = Mult_32_16( scp, extract_l( cp ) ); diff --git a/lib_dec/gain_dec.c b/lib_dec/gain_dec.c index 99eecba56a..6f769dd6ea 100644 --- a/lib_dec/gain_dec.c +++ b/lib_dec/gain_dec.c @@ -635,7 +635,7 @@ void gain_dec_SQ( index = get_next_indice( st, nBits >> 1 ); /*Ei = (G_PITCH_MAX - G_PITCH_MIN) / ((1 << (nBits>>1)) - 1);*/ /* set quantization step */ - div_s( &tmp16, 1, ( ( 1 << ( nBits >> 1 ) ) - 1 ) ); /* Q15*/ + tmp16 = div_s( 1, ( ( 1 << ( nBits >> 1 ) ) - 1 ) ); /* Q15*/ Ei = (float) mult_r( (int16_t) ( G_PITCH_MAX * 8192.0f + 0.5f ), tmp16 ) / 8192.0f; *gain_pit = usdequant( index, G_PITCH_MIN, Ei ); diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index 47a5d10d5f..3b9ae0c6fc 100644 --- a/lib_dec/hq_lr_dec.c +++ b/lib_dec/hq_lr_dec.c @@ -288,7 +288,7 @@ void hq_lr_dec( { exp2 = add( exp2, 1 ); } - div_s( &tmp, tmp2, tmp ); + tmp = div_s( tmp2, tmp ); L_tmp = L_deposit_h( tmp ); L_tmp = Isqrt_lc1( L_tmp, &exp2 ); move32(); /*Q(31-exp2) */ @@ -373,7 +373,7 @@ void hq_lr_dec( { exp = norm_s( tmp ); tmp = shl( tmp, exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp=29-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -405,7 +405,7 @@ void hq_lr_dec( { exp = norm_s( tmp ); tmp = shl( tmp, exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp=29-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -424,7 +424,7 @@ void hq_lr_dec( { exp = norm_s( tmp2 ); tmp2 = shl( tmp2, exp ); /*Q(exp) */ - div_s( &tmp2, 16384, tmp2 ); /*Q(15+14-exp=29-exp) */ + tmp2 = div_s( 16384, tmp2 ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -450,7 +450,7 @@ void hq_lr_dec( { exp = norm_s( tmp ); tmp = shl( tmp, exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp=29-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -480,7 +480,7 @@ void hq_lr_dec( { exp = norm_s( tmp2 ); tmp2 = shl( tmp2, exp ); /*Q(exp) */ - div_s( &tmp2, 16384, tmp2 ); /*Q(15+14-exp=29-exp) */ + tmp2 = div_s( 16384, tmp2 ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -539,7 +539,7 @@ void hq_lr_dec( { exp = norm_s( tmp ); tmp = shl( tmp, exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp=29-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -673,7 +673,7 @@ void hq_lr_dec( { exp = norm_s( tmp1 ); tmp1 = shl( tmp1, exp ); /*Q(exp) */ - div_s( &tmp1, 16384, tmp1 ); /*Q(15+14-exp = 29-exp) */ + tmp1 = div_s( 16384, tmp1 ); /*Q(15+14-exp = 29-exp) */ exp = sub( 29, exp ); } ELSE @@ -717,7 +717,7 @@ void hq_lr_dec( { exp = norm_s( tmp ); tmp = shl( tmp, exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp=29-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -746,7 +746,7 @@ void hq_lr_dec( { exp = norm_s( tmp1 ); tmp1 = shl( tmp1, exp ); /*Q(exp) */ - div_s( &tmp1, 16384, tmp1 ); /*Q(15+14-exp=29-exp) */ + tmp1 = div_s( 16384, tmp1 ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -821,7 +821,7 @@ void hq_lr_dec( { exp = norm_s( tmp ); tmp = shl( tmp, exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp=29-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -1219,7 +1219,7 @@ static float band_energy_dequant( #define WMC_TOOL_SKIP /* Get the reference energy */ exp_normd = norm_l( L_qint ); - div_s( &rev_qint_fx, 0x4000, round_fx( L_shl( L_qint, exp_normd ) ) ); /* Q14-(29+exp_normd-16)+15 */ + rev_qint_fx = div_s( 0x4000, round_fx( L_shl( L_qint, exp_normd ) ) ); /* Q14-(29+exp_normd-16)+15 */ Qrev_qint = sub( 14 - ( 29 - 16 ) + 15, exp_normd ); bq0 = (int16_t) round_fx( L_shl( L_mult( eref_fx, rev_qint_fx ), sub( 5, Qrev_qint ) ) ); /* 16-(10+Qrev_qint+1) */ @@ -1315,7 +1315,7 @@ static void mdct_spectrum_fine_gain_dec( exp_normn = norm_l( L_qint ); exp_normn = sub( exp_normn, 1 ); exp_normd = norm_s( gqlevs ); - div_l( &delta_fx, L_shl( L_qint, exp_normn ), shl( gqlevs, exp_normd ) ); + delta_fx = div_l( L_shl( L_qint, exp_normn ), shl( gqlevs, exp_normd ) ); Qdelta = add( sub( exp_normn, exp_normd ), 28 ); /* 29+exp_normn-(exp_normd)-1; */ L_delta = L_shl( L_deposit_h( delta_fx ), sub( 13, Qdelta ) ); /*q = (-qint + delta) / 2.0f; */ diff --git a/lib_enc/gain_enc.c b/lib_enc/gain_enc.c index 4883ea77b4..b114b34c7f 100644 --- a/lib_enc/gain_enc.c +++ b/lib_enc/gain_enc.c @@ -561,7 +561,7 @@ void gain_enc_SQ( nBits_code = ( nBits_pitch + 1 ) >> 1; nBits_pitch = nBits_pitch >> 1; - div_s( &tmp16, 1, ( ( 1 << ( nBits_pitch ) ) - 1 ) ); /* Q15*/ + tmp16 = div_s( 1, ( ( 1 << ( nBits_pitch ) ) - 1 ) ); /* Q15*/ tmp1 = (float) mult_r( (int16_t) ( G_PITCH_MAX * 8192.0f + 0.5f ), tmp16 ) / 8192.0f; index = usquant( *gain_pit, gain_pit, G_PITCH_MIN, tmp1, ( 1 << nBits_pitch ) ); push_indice( hBstr, IND_GAIN_PIT, index, nBits_pitch ); diff --git a/lib_enc/hq_lr_enc.c b/lib_enc/hq_lr_enc.c index e43baef59d..343a31713f 100644 --- a/lib_enc/hq_lr_enc.c +++ b/lib_enc/hq_lr_enc.c @@ -362,7 +362,7 @@ void hq_lr_enc( { exp2 = add( exp2, 1 ); } - div_s( &tmp, tmp2, tmp ); + tmp = div_s( tmp2, tmp ); L_tmp = L_deposit_h( tmp ); L_tmp = Isqrt_lc1( L_tmp, &exp2 ); move32(); /*Q(31-exp2) */ @@ -443,7 +443,7 @@ void hq_lr_enc( { exp = norm_s( tmp ); tmp = shl( tmp, exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp=29-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -477,7 +477,7 @@ void hq_lr_enc( { exp = norm_s( tmp ); tmp = shl( tmp, exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp=29-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -497,7 +497,7 @@ void hq_lr_enc( { exp = norm_s( tmp2 ); tmp2 = shl( tmp2, exp ); /*Q(exp) */ - div_s( &tmp2, 16384, tmp2 ); /*Q(15+14-exp=29-exp) */ + tmp2 = div_s( 16384, tmp2 ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -522,7 +522,7 @@ void hq_lr_enc( { exp = norm_s( tmp ); tmp = shl( tmp, exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp=29-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -552,7 +552,7 @@ void hq_lr_enc( { exp = norm_s( tmp2 ); tmp2 = shl( tmp2, exp ); /*Q(exp) */ - div_s( &tmp2, 16384, tmp2 ); /*Q(15+14-exp=29-exp) */ + tmp2 = div_s( 16384, tmp2 ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -615,7 +615,7 @@ void hq_lr_enc( { exp = norm_s( tmp ); tmp = shl( tmp, exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp=29-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -745,7 +745,7 @@ void hq_lr_enc( { exp = norm_s( tmp1 ); tmp1 = shl( tmp1, exp ); /*Q(exp) */ - div_s( &tmp1, 16384, tmp1 ); /*Q(15+14-exp = 29-exp) */ + tmp1 = div_s( 16384, tmp1 ); /*Q(15+14-exp = 29-exp) */ exp = sub( 29, exp ); } ELSE @@ -788,7 +788,7 @@ void hq_lr_enc( { exp = norm_s( tmp ); tmp = shl( tmp, exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp=29-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -817,7 +817,7 @@ void hq_lr_enc( { exp = norm_s( tmp1 ); tmp1 = shl( tmp1, exp ); /*Q(exp) */ - div_s( &tmp1, 16384, tmp1 ); /*Q(15+14-exp=29-exp) */ + tmp1 = div_s( 16384, tmp1 ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -891,7 +891,7 @@ void hq_lr_enc( { exp = norm_s( tmp ); tmp = shl( tmp, exp ); /*Q(exp) */ - div_s( &tmp, 16384, tmp ); /*Q(15+14-exp=29-exp) */ + tmp = div_s( 16384, tmp ); /*Q(15+14-exp=29-exp) */ exp = sub( 29, exp ); } ELSE @@ -1512,7 +1512,7 @@ static float band_energy_quant( #define WMC_TOOL_SKIP exp_normd = norm_l( L_qint ); - div_s( &rev_qint_fx, 0x4000, round_fx( L_shl( L_qint, exp_normd ) ) ); /* Q14-(29+exp_normd-16)+15 */ + rev_qint_fx = div_s( 0x4000, round_fx( L_shl( L_qint, exp_normd ) ) ); /* Q14-(29+exp_normd-16)+15 */ Qrev_qint = sub( 14 - ( 29 - 16 ) + 15, exp_normd ); bq0 = round_fx( L_shl( L_mult( eref_fx, rev_qint_fx ), sub( 5, Qrev_qint ) ) ); /* 16-(10+Qrev_qint+1) */ @@ -1714,7 +1714,7 @@ static void mdct_spectrum_fine_gain_enc( exp_normn = norm_l( L_qint ); exp_normn = sub( exp_normn, 1 ); exp_normd = norm_s( gqlevs ); - div_l( &delta_fx, L_shl( L_qint, exp_normn ), shl( gqlevs, exp_normd ) ); + delta_fx = div_l( L_shl( L_qint, exp_normn ), shl( gqlevs, exp_normd ) ); Qdelta = add( sub( exp_normn, exp_normd ), 28 ); /* 29+exp_normn-(exp_normd)-1; */ L_delta = L_shl( L_deposit_h( delta_fx ), sub( 13, Qdelta ) ); /*q = (-qint + delta) / 2.0f; */ -- GitLab From a372594741beb2f3ef46caf3611fccd41b8fe998 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 10 Aug 2023 00:11:05 +0200 Subject: [PATCH 2/2] formatting --- lib_com/basop32.c | 60 +++++++++++++++++++++++------------------------ lib_com/basop32.h | 28 +++++++++++----------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/lib_com/basop32.c b/lib_com/basop32.c index a3b764499d..3e608e4a65 100644 --- a/lib_com/basop32.c +++ b/lib_com/basop32.c @@ -2651,49 +2651,49 @@ Word16 norm_s( Word16 var1 ) | It's a Q15 value (point between b15 and b14). | |___________________________________________________________________________| */ -Word16 div_s (Word16 var1, Word16 var2) +Word16 div_s( Word16 var1, Word16 var2 ) { Word16 var_out = 0; Word16 iteration; Word32 L_num; Word32 L_denom; - if ((var1 > var2) || (var1 < 0) || (var2 < 0)) + if ( ( var1 > var2 ) || ( var1 < 0 ) || ( var2 < 0 ) ) { /* printf ("Division Error var1=%d var2=%d in ", var1, var2); printStack(); */ char text[60]; - sprintf (text, "Division Error var1=%d var2=%d in ", var1, var2); + sprintf( text, "Division Error var1=%d var2=%d in ", var1, var2 ); abort(); /* exit (0); */ } - if (var2 == 0) + if ( var2 == 0 ) { /* printf ("Division by 0, Fatal error in "); printStack(); */ abort(); /* exit (0); */ } - if (var1 == 0) + if ( var1 == 0 ) { var_out = 0; } else { - if (var1 == var2) + if ( var1 == var2 ) { var_out = MAX_16; } else { - L_num = L_deposit_l (var1); - L_denom = L_deposit_l (var2); + L_num = L_deposit_l( var1 ); + L_denom = L_deposit_l( var2 ); - for (iteration = 0; iteration < 15; iteration++) + for ( iteration = 0; iteration < 15; iteration++ ) { var_out <<= 1; L_num <<= 1; - if (L_num >= L_denom) + if ( L_num >= L_denom ) { - L_num = L_sub (L_num, L_denom); - var_out = add (var_out, 1); + L_num = L_sub( L_num, L_denom ); + var_out = add( var_out, 1 ); } } } @@ -2702,7 +2702,7 @@ Word16 div_s (Word16 var1, Word16 var2) BASOP_CHECK(); - return (var_out); + return ( var_out ); } @@ -2886,46 +2886,46 @@ Word32 L_mls( Word32 Lv, Word16 v ) | It's a Q15 value (point between b15 and b14). | |___________________________________________________________________________| */ -Word16 div_l (Word32 L_num, Word16 den) +Word16 div_l( Word32 L_num, Word16 den ) { - Word16 var_out = (Word16)0; - Word32 L_den; - Word16 iteration; + Word16 var_out = (Word16) 0; + Word32 L_den; + Word16 iteration; if ( den == (Word16) 0 ) { /* printf("Division by 0 in div_l, Fatal error in "); printStack(); */ - exit(-1); + exit( -1 ); } - if ( (L_num < (Word32) 0) || (den < (Word16) 0) ) + if ( ( L_num < (Word32) 0 ) || ( den < (Word16) 0 ) ) { /* printf("Division Error in div_l, Fatal error in "); printStack(); */ - exit(-1); + exit( -1 ); } - L_den = L_deposit_h( den ) ; + L_den = L_deposit_h( den ); if ( L_num >= L_den ) { BASOP_CHECK(); - return MAX_16 ; + return MAX_16; } else { - L_num = L_shr(L_num, (Word16)1) ; - L_den = L_shr(L_den, (Word16)1); - for(iteration=(Word16)0; iteration< (Word16)15; iteration++) + L_num = L_shr( L_num, (Word16) 1 ); + L_den = L_shr( L_den, (Word16) 1 ); + for ( iteration = (Word16) 0; iteration < (Word16) 15; iteration++ ) { - var_out = shl( var_out, (Word16)1); - L_num = L_shl( L_num, (Word16)1); - if (L_num >= L_den) + var_out = shl( var_out, (Word16) 1 ); + L_num = L_shl( L_num, (Word16) 1 ); + if ( L_num >= L_den ) { - L_num = L_sub(L_num,L_den); - var_out = add(var_out, (Word16)1); + L_num = L_sub( L_num, L_den ); + var_out = add( var_out, (Word16) 1 ); } } diff --git a/lib_com/basop32.h b/lib_com/basop32.h index 83a458382e..f1a7e1b864 100644 --- a/lib_com/basop32.h +++ b/lib_com/basop32.h @@ -211,32 +211,32 @@ Word32 L_shr_r( Word32 L_var1, Word16 var2 ); /* 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 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 div_s( Word16 var1, Word16 var2 ); /* Short division, 18 */ Word16 norm_l( Word32 L_var1 ); /* Long norm, 1 */ -#endif /* BASOP_NOGLOB */ +#endif /* BASOP_NOGLOB */ /* * 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 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 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 */ +#endif /* BASOP_NOGLOB */ /* * New shiftless operators, not used in G.729/G.723.1 -- GitLab