From 2347c27af93089b3e847214e24a9f6e2bb472988 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 11 Nov 2025 13:49:18 +0100 Subject: [PATCH 1/7] remove float <-> fixed conversion leftovers --- Workspace_msvc/lib_com.vcxproj | 1 - Workspace_msvc/lib_com.vcxproj.filters | 3 - Workspace_msvc/lib_util.vcxproj | 4 +- lib_com/float_to_fix_ops.c | 297 ------------------------- lib_com/prot_fx.h | 100 +-------- lib_com/tools_fx.c | 293 ------------------------ lib_dec/lib_dec_fx.c | 4 +- lib_enc/ivas_ism_metadata_enc_fx.c | 2 - lib_isar/isar_splitRendererPre.c | 3 + lib_rend/ivas_reverb_fft_filter_fx.c | 6 +- lib_rend/ivas_rotation_fx.c | 20 ++ lib_util/float_to_fix_ops.c | 129 +++++++++++ lib_util/float_to_fix_ops.h | 20 ++ lib_util/ism_file_reader.c | 23 +- lib_util/ism_file_writer.c | 5 +- lib_util/ivas_rtp_file.c | 7 +- lib_util/rotation_file_reader.c | 13 +- lib_util/vector3_pair_file_reader.c | 7 +- 18 files changed, 220 insertions(+), 717 deletions(-) delete mode 100644 lib_com/float_to_fix_ops.c create mode 100644 lib_util/float_to_fix_ops.c create mode 100644 lib_util/float_to_fix_ops.h diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index ee67280d0..702c6c1ad 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -161,7 +161,6 @@ - diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters index e8bbb17e9..37a179045 100644 --- a/Workspace_msvc/lib_com.vcxproj.filters +++ b/Workspace_msvc/lib_com.vcxproj.filters @@ -256,9 +256,6 @@ common_all_c - - common_all_c - common_all_c diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index 72dac3925..bfbfa8d4c 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -109,6 +109,7 @@ + @@ -141,6 +142,7 @@ + @@ -176,4 +178,4 @@ - + \ No newline at end of file diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c deleted file mode 100644 index 8b69e05e8..000000000 --- a/lib_com/float_to_fix_ops.c +++ /dev/null @@ -1,297 +0,0 @@ -#include -#include -#include -#include -#include "options.h" -#include "prot_fx.h" -#define WMC_TOOL_SKIP - -Word32 floatToFixed( float f, Word16 Q ) -{ - Word64 result_32; - if ( f == 1.0f && Q == Q15 ) - return MAX16B; - if ( f == 1.0f && Q == Q31 ) - return MAXVAL_WORD32; - if ( Q < 0 ) - result_32 = (Word64) ( (float) ( f ) / (double) ( (unsigned Word64) 1 << ( -Q ) ) + ( f >= 0 ? 0.5 : -0.5 ) ); - else - result_32 = (Word64) ( f * (double) ( (unsigned Word64) 1 << Q ) + ( f >= 0 ? 0.5 : -0.5 ) ); - if ( result_32 > MAX_32 ) - return MAX_32; - if ( result_32 < MIN_32 ) - return MIN_32; - return (Word32) result_32; -} - - -float fixedToFloat( Word32 i, Word16 Q ) -{ - if ( Q < 0 ) - return ( i * (float) ( ( 1LL ) << ( -Q ) ) ); - else - return (float) ( i ) / (float) ( 1LL << Q ); -} -void floatToFixed_arrL( float *f, Word32 *i, Word16 Q, Word16 l ) -{ - for ( int j = 0; j < l; j++ ) - { - Word64 i64_val = floatToFixed( f[j], Q ); - IF( i64_val > MAX_32 ) - { - i64_val = MAX_32; - } - ELSE IF( i64_val < MIN_32 ) - { - i64_val = MIN_32; - } - i[j] = (Word32) i64_val; - } -} -void floatToFixed_arr16( float *f, Word16 *i, Word16 Q, Word16 l ) -{ - if ( Q <= 0 ) - { - floatToFixed_arr( f, i, Q, l ); - return; - } - for ( int j = 0; j < l; j++ ) - { - i[j] = float_to_fix16( f[j], Q ); - } -} -void floatToFixed_arr32( float *f, Word32 *i, Word16 Q, Word16 l ) -{ - if ( Q <= 0 ) - { - floatToFixed_arrL( f, i, Q, l ); - return; - } - for ( int j = 0; j < l; j++ ) - { - i[j] = float_to_fix( f[j], Q ); - } -} - -float fixedToFloat_16( Word16 i, Word16 Q ) -{ - if ( Q < 0 ) - return ( i * (float) ( ( (unsigned) 1 ) << ( -Q ) ) ); - else - return (float) ( i ) / (float) ( (unsigned int) 1 << Q ); -} -float fixedToFloat_32( Word32 number, Word16 Q ) -{ - float val = 0.0f; - assert( abs_s( Q ) <= 63 ); - if ( abs_s( Q ) > 31 ) - { - if ( Q > 0 ) - { - val = ( ( (float) number / ( 1 << ( Q - 31 ) ) ) / ( (unsigned int) MAX_32 + 1 ) ); - } - else - { - val = ( (float) number * ( 1 << ( -Q - 31 ) ) * (unsigned int) MIN_32 ); - } - } - else - { - val = fixedToFloat( number, Q ); - } - return val; -} - -Word32 floatToFixed_32( float number, Word16 Q ) -{ - float val = 0.0f; - assert( abs_s( Q ) <= 63 ); - if ( abs_s( Q ) > 31 ) - { - if ( Q > 0 ) - { - val = ( number * ( (unsigned int) MAX_32 + 1 ) ) * ( 1 << ( Q - 31 ) ); - } - else - { - val = ( number / ( 1 << ( -Q - 31 ) ) ) / (unsigned int) MIN_32; - } - if ( val >= 0.0f ) - { - assert( (Word32) val <= MAX_32 ); - } - else - { - assert( (Word32) val >= MIN_32 ); - } - } - else - { - return floatToFixed( number, Q ); - } - - return (Word32) val; -} - -void floatToFixed_arrL32( float *f, Word32 *i, Word16 Q, Word16 l ) -{ - for ( int j = 0; j < l; j++ ) - { - i[j] = floatToFixed_32( f[j], Q ); - } -} - -void fixedToFloat_arrL32( Word32 *i, float *f, Word16 Q, Word16 l ) -{ - for ( int j = 0; j < l; j++ ) - { - f[j] = fixedToFloat_32( i[j], Q ); - } -} - -void floatToFixed_arr( float *f, Word16 *i, Word16 Q, Word16 l ) -{ - for ( int j = 0; j < l; j++ ) - { - Word32 i32_val = floatToFixed( f[j], Q ); - IF( i32_val > MAX_16 ) - { - i32_val = MAX_16; - } - ELSE IF( i32_val < MIN_16 ) - { - i32_val = MIN_16; - } - i[j] = (Word16) i32_val; - } -} -void fixedToFloat_arrL( Word32 *i, float *f, Word16 Q, Word16 l ) -{ - for ( int j = 0; j < l; j++ ) - { - f[j] = fixedToFloat( i[j], Q ); - } -} -void fixedToFloat_arr( Word16 *i, float *f, Word16 Q, Word16 l ) -{ - for ( int j = 0; j < l; j++ ) - { - f[j] = fixedToFloat( i[j], Q ); - } -} -Word16 Q_factor( float x ) -{ - Word16 Q = 15; - if ( x >= 1 || x <= -1 ) - Q = norm_s( (Word16) L_abs( (Word32) x ) ); - return Q; -} -Word16 Q_factor_L( float x ) -{ - Word16 Q = 31; - if ( x >= 1 || x <= -1 ) - Q = norm_l( L_abs( (Word32) x ) ); - return Q; -} -Word16 Q_factor_L_32( Word32 x ) -{ - Word16 Q = 31; - if ( x >= 1 || x <= -1 ) - Q = norm_l( L_abs( (Word32) x ) ); - return Q; -} -Word16 Q_factor_arr( float *x, Word16 l ) -{ - Word16 Q = 15; - for ( int i = 0; i < l; i++ ) - { - if ( x[i] >= 1 || x[i] <= -1 ) - Q = s_min( Q, norm_s( (Word16) L_abs( (Word32) x[i] ) ) ); - } - return Q; -} -Word16 Q_factor_arrL( float *x, Word16 l ) -{ - Word16 Q = 31; - for ( int i = 0; i < l; i++ ) - { - if ( x[i] >= 1 || x[i] <= -1 ) - Q = s_min( Q, norm_l( (Word32) L_abs( (Word32) x[i] ) ) ); - } - return Q; -} - -Word16 L_get_q( float f ) -{ - if ( fabsf( f ) > (float) INT_MAX ) - { - return sub( sub( W_norm( (Word64) f ), 32 ), 0 ); - } - else - { - return sub( norm_l( (Word32) f ), 0 ); - } -} - -Word16 L_get_q_buf( float *ptr_flt, Word16 length ) -{ - Word16 k; - float ftemp = 0.0; - - for ( k = 0; k < length; k++ ) - { - if ( fabsf( ptr_flt[k] ) > ftemp ) - ftemp = fabsf( ptr_flt[k] ); - } - - if ( ftemp > (float) INT_MAX ) - { - return sub( sub( W_norm( (Word64) ftemp ), 32 ), 0 ); - } - else - { - return sub( norm_l( (Word32) ftemp ), 0 ); - } -} - -Word16 L_get_q1( float f ) -{ - if ( fabsf( f ) >= 0.f && fabsf( f ) < 1.f ) - { - return Q31; - } - else if ( fabsf( f ) > (float) INT_MAX ) - { - return sub( sub( W_norm( (Word64) f ), 32 ), 0 ); - } - else - { - return sub( norm_l( (Word32) f ), 0 ); - } -} - -Word16 L_get_q_buf1( float *ptr_flt, Word16 length ) -{ - Word16 k; - float ftemp = 0.0; - - for ( k = 0; k < length; k++ ) - { - if ( fabsf( ptr_flt[k] ) > ftemp ) - ftemp = fabsf( ptr_flt[k] ); - } - - if ( ftemp >= 0.f && ftemp < 1.f ) - { - return Q31; - } - else if ( ftemp > (float) INT_MAX ) - { - return sub( sub( W_norm( (Word64) ftemp ), 32 ), 0 ); - } - else - { - return sub( norm_l( (Word32) ftemp ), 0 ); - } -} -#undef WMC_TOOL_SKIP diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 8f4b53c5e..e5bdb4c29 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -102,80 +102,16 @@ } #endif -/*================================================================================*/ -/* conversion functions: */ -/*================================================================================*/ - -// Float to Word32 -Word32 float_to_fix( float number, Word32 Q ); -// Word32 to Float -float fix_to_float( Word32 number, Word32 Q ); -// Float to Word16 -Word16 float_to_fix16( float number, Word16 Q ); -// Word16 to Float -float fix16_to_float( Word16 number, Word16 Q ); - -Word16 float_to_fix16_thrld( float number, Word16 Q ); - -void floatToFixed_arrL( float *f, Word32 *i, Word16 Q, Word16 l ); -void floatToFixed_arr( float *f, Word16 *i, Word16 Q, Word16 l ); -void fixedToFloat_arrL( Word32 *i, float *f, Word16 Q, Word16 l ); -void fixedToFloat_arr( Word16 *i, float *f, Word16 Q, Word16 l ); -void floatToFixed_arrL32( float *f, Word32 *i, Word16 Q, Word16 l ); -void fixedToFloat_arrL32( Word32 *i, float *f, Word16 Q, Word16 l ); -Word16 Q_factor( float x ); -Word16 Q_factor_L( float x ); -Word16 Q_factor_arr( float *x, Word16 l ); -Word16 Q_factor_arrL( float *x, Word16 l ); -Word16 Q_factor_L_32( Word32 x ); -// Handles the cases where Q is negative -Word32 floatToFixed( float f, Word16 Q ); -float fixedToFloat( Word32 i, Word16 Q ); -Word32 floatToFixed_32( float f, Word16 Q ); -float fixedToFloat_32( Word32 i, Word16 Q ); -float fixedToFloat_16( Word16 i, Word16 Q ); - -void floatToFixed_arr16( float *f, Word16 *i, Word16 Q, Word16 l ); -void floatToFixed_arr32( float *f, Word32 *i, Word16 Q, Word16 l ); -// Float to 32-bit Mantissa and Exponent using frexp -void f2me( float n, Word32 *mantissa, Word16 *expo ); -// 32-bit Mantissa and Exponent to Float using ldexp -float me2f( Word32 m, Word16 expo ); -// Float to 32-bit Mantissa Array and Exponent -void f2me_buf( const float *x, Word32 *m, Word16 *e, const Word32 n ); -// 32-bit Mantissa Array and Exponent to Float -void me2f_buf( const Word32 *m, const Word16 e, float *out, const Word32 n ); -// Float to 16-bit Mantissa and Exponent using frexp -void f2me_16( float n, Word16 *mantissa, Word16 *expo ); -// 16-bit Mantissa and Exponent to Float using ldexp -float me2f_16( Word16 m, Word16 expo ); -// Float to 16-bit Mantissa Array and Exponent -void f2me_buf_16( const float *x, Word16 *m, Word16 *e, const Word32 n ); -// 16-bit Mantissa Array and Exponent to Float -void me2f_buf_16( const Word16 *m, const Word16 e, float *out, const Word32 n ); - -void f2fix_16( float *var_flt, Word16 *var_fix, Word32 expo ); -void fix2f_16( Word16 *var_fix, float *var_flt, Word32 expo ); -void f2fix( float *var_flt, Word32 *var_fix, Word32 expo ); -void fix2f( Word32 *var_fix, float *var_flt, Word32 expo ); - -// Get max Q factor for a float value before sat in 32-bit -Word16 L_get_q( float f ); -Word16 L_get_q1( float f ); -// Get max Q factor for a float buffer before sat in 32-bit -Word16 L_get_q_buf( float *ptr_flt, Word16 length ); -Word16 L_get_q_buf1( float *ptr_flt, Word16 length ); - -/*================================================================================*/ -/* conversion functions: */ -/*================================================================================*/ + +/*----------------------------------------------------------------------------------* + * Prototypes of tools + *----------------------------------------------------------------------------------*/ Word32 sum_l_fx( const Word32 *vec, /* i : input vector */ const Word16 lvec /* i : length of input vector */ ); - Word32 Mult_32_16( Word32 a, Word16 b ); @@ -215,13 +151,11 @@ void set32_fx( const Word16 N /* i : Lenght of the vector */ ); -// tools.c /* o : output random value */ Word16 Random( Word16 *seed /* i/o: random seed */ ); -// tools.c void Copy( const Word16 x[], /* i : i vector */ Word16 y[], /* o : output vector */ @@ -10980,9 +10914,6 @@ Word16 own_random( Word16 *seed /* i/o: random seed */ ); -Word16 norm_ul_float( - UWord32 UL_var1 ); - /*! r: sum of all vector elements */ Word16 sum_s( const Word16 *vec, /* i : input vector */ @@ -11022,17 +10953,6 @@ void set16_zero_fx( const Word16 lvec /* i : length of the vector */ ); -void set_zero( - float *vec, /* o : input vector */ - const Word16 lvec /* i : length of the vector */ -); - -void mvr2r( - const float x[], /* i : input vector */ - float y[], /* o : output vector */ - const Word16 n /* i : vector size */ -); - void mvs2s( const Word16 x[], /* i : input vector */ Word16 y[], /* o : output vector */ @@ -11058,18 +10978,6 @@ Word16 minimum_s( Word16 *min_val /* o : minimum value in the input vector */ ); -/*! r: dequanzited gain */ -float usdequant( - const Word16 idx, /* i : quantizer index */ - const float qlow, /* i : lowest codebook entry (index 0) */ - const float delta /* i : quantization step */ -); - -void sort( - UWord16 *x, /* i/o: Vector to be sorted */ - UWord16 len /* i/o: vector length */ -); - void sort_l( Word32 *x, /* i/o: Vector to be sorted */ Word16 len /* i/o: vector length */ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 1be575c24..d6eb0e2dc 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -72,31 +72,6 @@ Word16 own_random( return ( *seed ); } -/*--------------------------------------------------------------------- - * norm_ul_float() - * - *---------------------------------------------------------------------*/ - -Word16 norm_ul_float( UWord32 UL_var1 ) -{ - Word16 var_out; - - if ( UL_var1 == 0 ) - { - var_out = 0; - } - else - { - for ( var_out = 0; UL_var1 < (UWord32) 0x80000000U; var_out++ ) - { - UL_var1 <<= 1; - } - } - BASOP_CHECK(); - - return ( var_out ); -} - /*--------------------------------------------------------------------- * sum_s() @@ -359,68 +334,6 @@ void set_l( return; } -/*---------------------------------------------------------------------* - * set_zero() - * - * Set a vector vec[] of dimension lvec to zero - *---------------------------------------------------------------------*/ - -void set_zero( - float *vec, /* o : input vector */ - const Word16 lvec /* i : length of the vector */ -) -{ - Word16 i; - - for ( i = 0; i < lvec; i++ ) - { - *vec++ = 0.0f; - } - - return; -} - - -/*---------------------------------------------------------------------* - * mvr2r() - * mvs2s() - * mvr2d() - * mvd2r() - * - * Transfer the contents of vector x[] to vector y[] - *---------------------------------------------------------------------*/ - -void mvr2r( - const float x[], /* i : input vector */ - float y[], /* o : output vector */ - const Word16 n /* i : vector size */ -) -{ - Word16 i; - - if ( n <= 0 ) - { - /* cannot transfer vectors with size 0 */ - return; - } - - if ( y < x ) - { - for ( i = 0; i < n; i++ ) - { - y[i] = x[i]; - } - } - else - { - for ( i = n - 1; i >= 0; i-- ) - { - y[i] = x[i]; - } - } - - return; -} void mvs2s( const Word16 x[], /* i : input vector */ @@ -879,26 +792,6 @@ void v_multc_fx_16_16( return; } -/*-------------------------------------------------------------------* - * usdequant() - * - * Uniform scalar de-quantizer routine - * - * Applies de-quantization based on scale and round operations. - *-------------------------------------------------------------------*/ - -float usdequant( - const Word16 idx, /* i : quantizer index */ - const float qlow, /* i : lowest codebook entry (index 0) */ - const float delta /* i : quantization step */ -) -{ - float g; - - g = idx * delta + qlow; - - return ( g ); -} void sort( UWord16 *x, /* i/o: Vector to be sorted */ @@ -925,192 +818,6 @@ void sort( return; } -#define WMC_TOOL_SKIP - -// conversion functions: -Word32 float_to_fix( float number, Word32 Q ) -{ - assert( Q >= 0 ); - if ( number == 1.0f && Q == Q31 ) - { - return ONE_IN_Q31; - } - if ( isnan( number ) ) - { - number = 0; - } - assert( fabs( number ) < pow( 2, 31 - Q ) ); - Word32 ret = (Word32) ( number * ( (UWord32) 1 << Q ) ); - return ret; -} - -float fix_to_float( - Word32 number, - Word32 Q ) -{ - assert( Q >= 0 ); - float ret = (float) number / ( (UWord32) 1 << Q ); - return ret; -} - -Word16 float_to_fix16( - float number, - Word16 Q ) -{ - assert( Q >= 0 ); - IF( isnan( number ) ) - return 0; - if ( number == 1.0f && Q == Q15 ) - return MAX16B; - if ( number == -1.0f && Q == Q15 ) - return MIN16B; - assert( fabs( number ) < pow( 2, 15 - Q ) ); - Word16 ret = (Word16) ( number * ( (UWord16) 1 << Q ) ); - return ret; -} - -Word16 float_to_fix16_thrld( float number, Word16 Q ) -{ - assert( Q >= 0 ); - if ( number == 1.0f && Q == Q15 ) - return MAX16B; - float limit = (float) pow( 2, 15 - Q ); - /*Add threshold*/ - if ( number > MAX16B_FLT ) - { - number = MAX16B_FLT; - } - else if ( number < MIN16B_FLT ) - { - number = MIN16B_FLT; - } - assert( number <= limit && number >= -limit ); - Word16 ret = (Word16) ( number * ( (UWord16) 1 << Q ) ); - return ret; -} - -float fix16_to_float( Word16 number, Word16 Q ) -{ - assert( Q >= 0 ); - float ret = (float) number / ( (UWord16) 1 << Q ); - return ret; -} - -// Float to 32-bit Mantissa and Exponent -void f2me( float n, Word32 *mantissa, Word16 *expo ) -{ - Word32 e; - float mf = (float) frexp( n, &e ); - *expo = (Word16) e; - *mantissa = float_to_fix( mf, Q31 ); -} - -// 32-bit Mantissa and Exponent to Float -float me2f( Word32 m, Word16 expo ) -{ - float mf = fix_to_float( m, Q31 ); - return (float) ldexp( mf, expo ); -} - -// Float buffer to 32-bit mantissa buffer and common exponent. -void f2me_buf( const float *x, Word32 *m, Word16 *e, const Word32 n ) -{ - Word16 max_e = -32, tmp_e; - Word32 i; - - for ( i = 0; i < n; i++ ) - { - f2me( x[i], &m[i], &tmp_e ); - max_e = ( max_e > tmp_e ) ? max_e : tmp_e; - } - - for ( i = 0; i < n; i++ ) - { - f2me( x[i], &m[i], &tmp_e ); - m[i] = L_shr( m[i], max_e - tmp_e ); - } - - *e = max_e; -} - -// 32-bit Mantissa buffer and exponent into float buffer. -void me2f_buf( const Word32 *m, const Word16 e, float *out, const Word32 n ) -{ - for ( int i = 0; i < n; i++ ) - { - out[i] = me2f( m[i], e ); - } -} - -// Float to 16-bit Mantissa and Exponent -void f2me_16( float n, Word16 *mantissa, Word16 *expo ) -{ - Word32 e; - float mf = (float) frexp( n, &e ); - *expo = (Word16) e; - *mantissa = float_to_fix16( mf, 15 ); -} - -// 16-bit Mantissa and Exponent to Float -float me2f_16( Word16 m, Word16 expo ) -{ - float mf = fix16_to_float( m, 15 ); - return (float) ldexp( mf, expo ); -} - -// Float buffer to 16-bit mantissa buffer and common exponent. -void f2me_buf_16( const float *x, Word16 *m, Word16 *e, const Word32 n ) -{ - Word16 max_e = -16, tmp_e; - Word32 i; - - for ( i = 0; i < n; i++ ) - { - f2me_16( x[i], &m[i], &tmp_e ); - max_e = ( max_e > tmp_e ) ? max_e : tmp_e; - } - - for ( i = 0; i < n; i++ ) - { - f2me_16( x[i], &m[i], &tmp_e ); - m[i] = shr( m[i], max_e - tmp_e ); - } - - *e = max_e; -} - -// 16-bit Mantissa buffer and exponent into float buffer. -void me2f_buf_16( const Word16 *m, const Word16 e, float *out, const Word32 n ) -{ - for ( int i = 0; i < n; i++ ) - { - out[i] = me2f_16( m[i], e ); - } -} -void f2fix( float *var_flt, Word32 *var_fix, Word32 expo ) -{ - *var_fix = (Word32) ( *var_flt * pow( 2, 31 - expo ) ); -} - -void fix2f( Word32 *var_fix, float *var_flt, Word32 expo ) -{ - float mf = fix_to_float( *var_fix, 31 ); - *var_flt = (float) ldexp( mf, expo ); -} - -void f2fix_16( float *var_flt, Word16 *var_fix, Word32 expo ) -{ - *var_fix = (Word16) ( *var_flt * pow( 2, 15 - expo ) ); -} - -void fix2f_16( Word16 *var_fix, float *var_flt, Word32 expo ) -{ - float mf = fix16_to_float( *var_fix, 15 ); - *var_flt = (float) ldexp( mf, expo ); -} - -#undef WMC_TOOL_SKIP - /*-------------------------------------------------------------------* * usdequant_fx() diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index dd5bb4264..d0d31f93a 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -5499,7 +5499,7 @@ static ivas_error printConfigInfo_dec( IF( st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) { fprintf( stdout, "Output configuration: mono EVS bit-exact decoding to stereo\n" ); - float non_diegetic_pan_gain = fixedToFloat( st_ivas->hDecoderConfig->non_diegetic_pan_gain_fx, 15 ); + float non_diegetic_pan_gain = (float) ( st_ivas->hDecoderConfig->non_diegetic_pan_gain_fx ) / (float) ( 1LL << Q15 ); fprintf( stdout, "Non-diegetic panning: %.2f\n", non_diegetic_pan_gain * 90.f ); } ELSE @@ -5620,7 +5620,7 @@ static ivas_error printConfigInfo_dec( IF( st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) { - float non_diegetic_pan_gain = fixedToFloat( st_ivas->hDecoderConfig->non_diegetic_pan_gain_fx, 15 ); + float non_diegetic_pan_gain = (float) ( st_ivas->hDecoderConfig->non_diegetic_pan_gain_fx ) / (float) ( 1LL << Q15 ); fprintf( stdout, "Non-diegetic panning: %.2f\n", non_diegetic_pan_gain * 90.f ); } diff --git a/lib_enc/ivas_ism_metadata_enc_fx.c b/lib_enc/ivas_ism_metadata_enc_fx.c index 32582f2db..e68556664 100644 --- a/lib_enc/ivas_ism_metadata_enc_fx.c +++ b/lib_enc/ivas_ism_metadata_enc_fx.c @@ -505,7 +505,6 @@ ivas_error ivas_ism_metadata_enc_fx( { idx_angle1_abs = ism_quant_meta_fx( hIsmMetaData->azimuth_fx, &valQ_fx, ism_azimuth_borders_fx, ISM_Q_STEP_FX, ISM_Q_STEP_BORDER_FX, 1 << ISM_AZIMUTH_NBITS ); idx_angle2_abs = ism_quant_meta_fx( hIsmMetaData->elevation_fx, &valQ_fx, ism_elevation_borders_fx, ISM_Q_STEP_FX, ISM_Q_STEP_BORDER_FX, 1 << ISM_ELEVATION_NBITS ); - // valQ = fixedToFloat( valQ_fx, Q22 ); } ELSE /* ISM_MODE_PARAM */ { @@ -527,7 +526,6 @@ ivas_error ivas_ism_metadata_enc_fx( Word16 valQ_fx_tmp = extract_h( valQ_fx ); // 22 - 16 = 6 idx_radius_abs = usquant_fx( hIsmMetaData->radius_fx, &valQ_fx_tmp, ISM_RADIUS_MIN_Q9, ISM_RADIUS_DELTA_Q8, 1 << ISM_RADIUS_NBITS ); valQ_fx = L_shr( L_deposit_h( valQ_fx_tmp ), 3 ); // Q22 - // valQ = fixedToFloat( valQ_fx, Q22 ); encode_angle_indices_fx( hBstr, &( hIsmMetaData->orientation_angle ), hIsmMetaData->last_ism_metadata_flag, ini_frame, idx_angle1_abs, idx_angle2_abs, &flag_abs_yaw[ch], &flag_abs_pitch[ch] ); encode_radius_fx( hBstr, &hIsmMetaData->last_radius_idx, &hIsmMetaData->radius_diff_cnt, hIsmMetaData->last_ism_metadata_flag, idx_radius_abs, &flag_abs_radius[ch] ); } diff --git a/lib_isar/isar_splitRendererPre.c b/lib_isar/isar_splitRendererPre.c index 445540715..37ebdf278 100644 --- a/lib_isar/isar_splitRendererPre.c +++ b/lib_isar/isar_splitRendererPre.c @@ -48,6 +48,9 @@ #ifdef DBG_WAV_WRITER #include "string.h" #endif +#ifdef DEBUG_QUANT_CODE_OUT +#include "float_to_fix_ops.h" +#endif #include "basop_util.h" /*---------------------------------------------------------------------* diff --git a/lib_rend/ivas_reverb_fft_filter_fx.c b/lib_rend/ivas_reverb_fft_filter_fx.c index 09720d202..b7f890ec3 100644 --- a/lib_rend/ivas_reverb_fft_filter_fx.c +++ b/lib_rend/ivas_reverb_fft_filter_fx.c @@ -37,15 +37,17 @@ #include #include "wmc_auto.h" #include "debug.h" -#define float_to_fix( n, factor ) ( round( n * ( 1 << factor ) ) ) -#define fix_to_float( n, factor ) ( (float) n / ( 1 << factor ) ) + /*------------------------------------------------------------------------------------------* * Static functions declarations *------------------------------------------------------------------------------------------*/ + static void fft_wrapper_2ch_fx( Word32 *buffer_L, Word32 *buffer_R, const Word16 fft_size ); static void ifft_wrapper_2ch_fx( Word32 *buffer_L, Word32 *buffer_R, const Word16 fft_size ); + + /*-----------------------------------------------------------------------------------------* * Function int_log2() * diff --git a/lib_rend/ivas_rotation_fx.c b/lib_rend/ivas_rotation_fx.c index b9762f72c..d45002320 100644 --- a/lib_rend/ivas_rotation_fx.c +++ b/lib_rend/ivas_rotation_fx.c @@ -98,6 +98,26 @@ static void external_target_interpolation_fx( EXTERNAL_ORIENTATION_HANDLE hExtOr static bool are_orientations_same_fx( const IVAS_QUATERNION *orientation1, const IVAS_QUATERNION *orientation2 ); +/*-----------------------------------------------------------------------* + * function Q_factor_L_32() + * + * + *-----------------------------------------------------------------------*/ + +static Word16 Q_factor_L_32( + const Word32 x ) +{ + Word16 Q = 31; + + if ( x >= 1 || x <= -1 ) + { + Q = norm_l( L_abs( (Word32) x ) ); + } + + return Q; +} + + /*-----------------------------------------------------------------------* * ivas_headTrack_open() * diff --git a/lib_util/float_to_fix_ops.c b/lib_util/float_to_fix_ops.c new file mode 100644 index 000000000..0b0dda78c --- /dev/null +++ b/lib_util/float_to_fix_ops.c @@ -0,0 +1,129 @@ + +#include "common_api_types.h" +#include "float_to_fix_ops.h" +#include +#include + + +#define Q15 15 +#define Q31 31 +#define ONE_IN_Q31 0x7fffffff +#define MAX16B 32767 +#define MIN16B ( -32768 ) +#define MAXVAL_WORD32 ( (int32_t) 0x7FFFFFFF ) + + +Word32 float_to_fix( + float number, + const Word32 Q ) +{ + assert( Q >= 0 ); + if ( number == 1.0f && Q == Q31 ) + { + return ONE_IN_Q31; + } + if ( isnan( number ) ) + { + number = 0; + } + assert( fabs( number ) < pow( 2, 31 - Q ) ); + Word32 ret = (Word32) ( number * ( (UWord32) 1 << Q ) ); + + return ret; +} + + +Word16 float_to_fix16( + const float number, + const Word16 Q ) +{ + assert( Q >= 0 ); + if( isnan( number ) ) + return 0; + if ( number == 1.0f && Q == Q15 ) + return MAX16B; + if ( number == -1.0f && Q == Q15 ) + return MIN16B; + assert( fabs( number ) < pow( 2, 15 - Q ) ); + Word16 ret = (Word16) ( number * ( (UWord16) 1 << Q ) ); + + return ret; +} + + +Word32 floatToFixed( + const float f, + const Word16 Q ) +{ + Word64 result_32; + + if ( f == 1.0f && Q == Q15 ) + return MAX16B; + if ( f == 1.0f && Q == Q31 ) + return MAXVAL_WORD32; + if ( Q < 0 ) + result_32 = (Word64) ( (float) ( f ) / (double) ( (unsigned Word64) 1 << ( -Q ) ) + ( f >= 0 ? 0.5 : -0.5 ) ); + else + result_32 = (Word64) ( f * (double) ( (unsigned Word64) 1 << Q ) + ( f >= 0 ? 0.5 : -0.5 ) ); + if ( result_32 > MAX_32 ) + return MAX_32; + if ( result_32 < MIN_32 ) + return MIN_32; + + return (Word32) result_32; +} + +float fixedToFloat( + const Word32 i, + const Word16 Q ) +{ + if ( Q < 0 ) + return ( i * (float) ( ( 1LL ) << ( -Q ) ) ); + else + return (float) ( i ) / (float) ( 1LL << Q ); +} + + +float fix16_to_float( + const Word16 number, + const Word16 Q ) +{ + assert( Q >= 0 ); + float ret = (float) number / ( (UWord16) 1 << Q ); + + return ret; +} + + +Word32 floatToFixed_32( + const float number, + const Word16 Q ) +{ + float val = 0.0f; + assert( abs_s( Q ) <= 63 ); + if ( abs_s( Q ) > 31 ) + { + if ( Q > 0 ) + { + val = ( number * ( (unsigned int) MAX_32 + 1 ) ) * ( 1 << ( Q - 31 ) ); + } + else + { + val = ( number / ( 1 << ( -Q - 31 ) ) ) / (unsigned int) MIN_32; + } + if ( val >= 0.0f ) + { + assert( (Word32) val <= MAX_32 ); + } + else + { + assert( (Word32) val >= MIN_32 ); + } + } + else + { + return floatToFixed( number, Q ); + } + + return (Word32) val; +} diff --git a/lib_util/float_to_fix_ops.h b/lib_util/float_to_fix_ops.h new file mode 100644 index 000000000..35ae446bf --- /dev/null +++ b/lib_util/float_to_fix_ops.h @@ -0,0 +1,20 @@ + +#include "common_api_types.h" + +#ifndef FLOAT_TO_FIX_OPS_H +#define FLOAT_TO_FIX_OPS_H + +Word32 float_to_fix( float number, const Word32 Q ); + +Word16 float_to_fix16( const float number, const Word16 Q ); + +Word32 floatToFixed( const float f, const Word16 Q ); + +Word32 floatToFixed_32( const float number, const Word16 Q ); + +float fixedToFloat( const Word32 i, const Word16 Q ); + +float fix16_to_float( const Word16 number, const Word16 Q ); + +#endif /* FLOAT_TO_FIX_OPS_H */ + diff --git a/lib_util/ism_file_reader.c b/lib_util/ism_file_reader.c index aa9c62661..2cced2665 100644 --- a/lib_util/ism_file_reader.c +++ b/lib_util/ism_file_reader.c @@ -34,12 +34,19 @@ #include "cmdl_tools.h" #include #include -#include "prot_fx.h" +#include "float_to_fix_ops.h" + #define META_LINE_LENGTH 200 /* max number of characters at one line of metadata input/output file */ #define NUM_ISM_METADATA_PER_LINE 8 /* Number of ISM metadata per line in a metadata file */ #define NUM_MIN_ISM_METADATA 1 /* Minimum number of metadata parameters (azimuth) */ +#define Q9 9 +#define Q22 22 +#define Q31 31 +#define DEG_360_IN_Q22 ( 360 << Q22 ) /* Q22 */ +#define DEG_180_IN_Q22 ( 180 << Q22 ) /* Q22 */ +#define DEG_90_IN_Q22 ( 90 << Q22 ) /* Q22 */ struct IsmFileReader { @@ -175,7 +182,7 @@ ivas_error IsmFileReader_readNextFrame( } #ifdef FIX_2084_FLOATING_POINT_LEFTOVERS - if ( GT_32( ismMetadata->azimuth_fx, DEG_180_IN_Q22 ) || LT_32( ismMetadata->azimuth_fx, -DEG_180_IN_Q22 ) ) + if ( ( ismMetadata->azimuth_fx > DEG_180_IN_Q22 ) || ( ismMetadata->azimuth_fx < -DEG_180_IN_Q22 ) ) #else if ( ismMetadata->azimuth > 180 || ismMetadata->azimuth < -180 ) #endif @@ -183,7 +190,7 @@ ivas_error IsmFileReader_readNextFrame( return IVAS_ERR_ISM_INVALID_METADATA_VALUE; } #ifdef FIX_2084_FLOATING_POINT_LEFTOVERS - if ( GT_32( ismMetadata->elevation_fx, DEG_90_IN_Q22 ) || LT_32( ismMetadata->elevation_fx, -DEG_90_IN_Q22 ) ) + if ( ( ismMetadata->elevation_fx > DEG_90_IN_Q22 ) || ( ismMetadata->elevation_fx < -DEG_90_IN_Q22 ) ) #else if ( ismMetadata->elevation > 90 || ismMetadata->elevation < -90 ) #endif @@ -191,7 +198,7 @@ ivas_error IsmFileReader_readNextFrame( return IVAS_ERR_ISM_INVALID_METADATA_VALUE; } #ifdef FIX_2084_FLOATING_POINT_LEFTOVERS - if ( LT_32( ismMetadata->radius_fx, 0 ) ) /* Negative radius not supported. Max quantized radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */ + if ( ismMetadata->radius_fx < 0 ) /* Negative radius not supported. Max quantized radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */ #else if ( ismMetadata->radius < 0 ) /* Negative radius not supported. Max quantized radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */ #endif @@ -199,7 +206,7 @@ ivas_error IsmFileReader_readNextFrame( return IVAS_ERR_ISM_INVALID_METADATA_VALUE; } #ifdef FIX_2084_FLOATING_POINT_LEFTOVERS - if ( GT_32( ismMetadata->spread_fx, DEG_360_IN_Q22 ) || LT_32( ismMetadata->spread_fx, 0 ) ) + if ( ( ismMetadata->spread_fx > DEG_360_IN_Q22 ) || ( ismMetadata->spread_fx < 0 ) ) #else if ( ismMetadata->spread > 360 || ismMetadata->spread < 0 ) #endif @@ -207,7 +214,7 @@ ivas_error IsmFileReader_readNextFrame( return IVAS_ERR_ISM_INVALID_METADATA_VALUE; } #ifdef FIX_2084_FLOATING_POINT_LEFTOVERS - if ( /*GT_32( ismMetadata->gainFactor_fx, ONE_IN_Q31 ) ||*/ LT_32( ismMetadata->gainFactor_fx, 0 ) ) + if ( /*( ismMetadata->gainFactor_fx > ONE_IN_Q31 ) ||*/ ( ismMetadata->gainFactor_fx < 0 ) ) #else if ( ismMetadata->gainFactor > 1 || ismMetadata->gainFactor < 0 ) #endif @@ -215,7 +222,7 @@ ivas_error IsmFileReader_readNextFrame( return IVAS_ERR_ISM_INVALID_METADATA_VALUE; } #ifdef FIX_2084_FLOATING_POINT_LEFTOVERS - if ( GT_32( ismMetadata->yaw_fx, DEG_180_IN_Q22 ) || LT_32( ismMetadata->yaw_fx, -DEG_180_IN_Q22 ) ) + if ( ( ismMetadata->yaw_fx > DEG_180_IN_Q22 ) || ( ismMetadata->yaw_fx < -DEG_180_IN_Q22 ) ) #else if ( ismMetadata->yaw > 180 || ismMetadata->yaw < -180 ) #endif @@ -223,7 +230,7 @@ ivas_error IsmFileReader_readNextFrame( return IVAS_ERR_ISM_INVALID_METADATA_VALUE; } #ifdef FIX_2084_FLOATING_POINT_LEFTOVERS - if ( GT_32( ismMetadata->pitch_fx, DEG_90_IN_Q22 ) || LT_32( ismMetadata->pitch_fx, -DEG_90_IN_Q22 ) ) + if ( ( ismMetadata->pitch_fx > DEG_90_IN_Q22 ) || ( ismMetadata->pitch_fx < -DEG_90_IN_Q22 ) ) #else if ( ismMetadata->pitch > 90 || ismMetadata->pitch < -90 ) #endif diff --git a/lib_util/ism_file_writer.c b/lib_util/ism_file_writer.c index 8e55187c8..ba53566af 100644 --- a/lib_util/ism_file_writer.c +++ b/lib_util/ism_file_writer.c @@ -33,11 +33,14 @@ #include "ism_file_writer.h" #include #include +#include "float_to_fix_ops.h" -#include "prot_fx.h" #define META_LINE_LENGTH 200 /* max number of characters at one line of metadata input/output file */ +#define Q9 9 +#define Q22 22 +#define Q31 31 struct IsmFileWriter { diff --git a/lib_util/ivas_rtp_file.c b/lib_util/ivas_rtp_file.c index 4ef3578f6..dd4d235ef 100644 --- a/lib_util/ivas_rtp_file.c +++ b/lib_util/ivas_rtp_file.c @@ -29,11 +29,16 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ + +#include #include #include #include "ivas_rtp_file.h" #include "ivas_error_utils.h" -#include "prot_fx.h" +#include "float_to_fix_ops.h" + + +#define Q15 15 struct IVAS_RTP_FILE { diff --git a/lib_util/rotation_file_reader.c b/lib_util/rotation_file_reader.c index 2f32ea858..9746c69ac 100644 --- a/lib_util/rotation_file_reader.c +++ b/lib_util/rotation_file_reader.c @@ -33,10 +33,14 @@ #include "rotation_file_reader.h" #include #include -#include -#include "prot_fx.h" +#include "float_to_fix_ops.h" +#define Q22 22 +#define Q25 25 +#define Q29 29 +#define Q31 31 + struct RotFileReader { FILE *trajFile; @@ -206,10 +210,7 @@ ivas_error ExternalOrientationFileReading( pQuaternion->x_fx = float_to_fix( x, Q29 ); pQuaternion->y_fx = float_to_fix( y, Q29 ); pQuaternion->z_fx = float_to_fix( z, Q29 ); - move32(); - move32(); - move32(); - move32(); + *enableHeadRotation = (int8_t) headRotFlag; *enableExternalOrientation = (int8_t) extOrientationFlag; *enableRotationInterpolation = (int8_t) rotInterpolationFlag; diff --git a/lib_util/vector3_pair_file_reader.c b/lib_util/vector3_pair_file_reader.c index a4b8cc450..737ef91af 100644 --- a/lib_util/vector3_pair_file_reader.c +++ b/lib_util/vector3_pair_file_reader.c @@ -33,8 +33,7 @@ #include "vector3_pair_file_reader.h" #include #include -#include "prot_fx.h" // needed for floatToFixed_32 -//#include "ivas_prot_fx.h" // needed for floatToFixed_32 +#include "float_to_fix_ops.h" // needed for floatToFixed_32 struct Vector3PairFileReader @@ -115,8 +114,8 @@ ivas_error Vector3PairFileReader_read( pSecond->y = y2; pSecond->z = z2; - pFirst->q_fact = Q29; - pSecond->q_fact = Q29; + pFirst->q_fact = 29; // Q29 + pSecond->q_fact = 29; // Q29 pFirst->x_fx = floatToFixed_32( pFirst->x, pFirst->q_fact ); pFirst->y_fx = floatToFixed_32( pFirst->y, pFirst->q_fact ); pFirst->z_fx = floatToFixed_32( pFirst->z, pFirst->q_fact ); -- GitLab From eb0ef329ec186bc70e11d0541beda95ce1b81fa3 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 11 Nov 2025 14:26:57 +0100 Subject: [PATCH 2/7] clang-format + more cleaning --- apps/decoder.c | 1 - apps/encoder.c | 1 - lib_com/ivas_tools_fx.c | 90 ------------------------------- lib_util/float_to_fix_ops.c | 14 ++--- lib_util/float_to_fix_ops.h | 3 +- lib_util/ls_custom_file_reader.c | 92 +++++++++++++++++++++++++++++++- 6 files changed, 99 insertions(+), 102 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 7bbc63e61..b4068a0c8 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -50,7 +50,6 @@ #include "obj_edit_file_reader.h" #include "vector3_pair_file_reader.h" #include "wmc_auto.h" -#include "options.h" #include "stl.h" #ifdef IVAS_RTPDUMP #include "ivas_rtp_file.h" diff --git a/apps/encoder.c b/apps/encoder.c index fe64442e1..95802ba80 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -31,7 +31,6 @@ *******************************************************************************************************/ #include -#include "options.h" #ifdef DEBUGGING #include "debug.h" #endif diff --git a/lib_com/ivas_tools_fx.c b/lib_com/ivas_tools_fx.c index 515a10cdb..29d470a55 100644 --- a/lib_com/ivas_tools_fx.c +++ b/lib_com/ivas_tools_fx.c @@ -1992,26 +1992,6 @@ void lls_interp_n_fx( } -/* helper function for panning_wrap_angles */ -static float wrap_azi( - const float azi_deg ) -{ - float azi = azi_deg; - - /* Wrap azimuth value */ - while ( azi > 180 ) - { - azi -= 360.0f; - } - - while ( azi <= -180 ) - { - azi += 360; - } - - return azi; -} - /* helper function for panning_wrap_angles */ static Word32 wrap_azi_fx( const Word32 azi_deg /* Q22 */ ) @@ -2034,76 +2014,6 @@ static Word32 wrap_azi_fx( } -/*-------------------------------------------------------------------* - * panning_wrap_angles() - * - * Wrap angles for amplitude panning to the range: - * azimuth = (-180, 180] - * elevation = [-90, 90] - * Considers direction changes from large elevation values - *-------------------------------------------------------------------*/ - -void panning_wrap_angles( - const float azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ - const float ele_deg, /* i : elevation in degrees for panning direction (positive up) */ - float *azi_wrapped, /* o : wrapped azimuth component */ - float *ele_wrapped /* o : wrapped elevation component */ -) -{ - float azi, ele; - - azi = azi_deg; - ele = ele_deg; - - if ( fabsf( ele ) < 90 ) - { - *ele_wrapped = ele; - *azi_wrapped = wrap_azi( azi ); - return; - } - else - { - /* Special case when elevation is a multiple of 90; azimuth is irrelevant */ - if ( ( fmodf( ele, 90 ) == 0 ) && ( fmodf( ele, 180 ) != 0 ) ) - { - *azi_wrapped = 0; - while ( ele > 90 ) - { - ele -= 360; - } - while ( ele < -90 ) - { - ele += 360; - } - *ele_wrapped = ele; - } - else - { - /* Wrap elevation and adjust azimuth accordingly */ - while ( fabsf( ele ) > 90 ) - { - /* Flip to other hemisphere */ - azi += 180; - - /* Compensate elevation accordingly */ - if ( ele > 90 ) - { - ele = 180 - ele; - } - else if ( ele < -90 ) - { - ele = -180 - ele; - } - } - *azi_wrapped = wrap_azi( azi ); - *ele_wrapped = ele; - } - - return; - } -} - - /*-------------------------------------------------------------------* * panning_wrap_angles_fx() * diff --git a/lib_util/float_to_fix_ops.c b/lib_util/float_to_fix_ops.c index 0b0dda78c..4bab0a6b1 100644 --- a/lib_util/float_to_fix_ops.c +++ b/lib_util/float_to_fix_ops.c @@ -5,11 +5,11 @@ #include -#define Q15 15 -#define Q31 31 -#define ONE_IN_Q31 0x7fffffff -#define MAX16B 32767 -#define MIN16B ( -32768 ) +#define Q15 15 +#define Q31 31 +#define ONE_IN_Q31 0x7fffffff +#define MAX16B 32767 +#define MIN16B ( -32768 ) #define MAXVAL_WORD32 ( (int32_t) 0x7FFFFFFF ) @@ -38,8 +38,8 @@ Word16 float_to_fix16( const Word16 Q ) { assert( Q >= 0 ); - if( isnan( number ) ) - return 0; + if ( isnan( number ) ) + return 0; if ( number == 1.0f && Q == Q15 ) return MAX16B; if ( number == -1.0f && Q == Q15 ) diff --git a/lib_util/float_to_fix_ops.h b/lib_util/float_to_fix_ops.h index 35ae446bf..0cd23cbc6 100644 --- a/lib_util/float_to_fix_ops.h +++ b/lib_util/float_to_fix_ops.h @@ -13,8 +13,7 @@ Word32 floatToFixed( const float f, const Word16 Q ); Word32 floatToFixed_32( const float number, const Word16 Q ); float fixedToFloat( const Word32 i, const Word16 Q ); - + float fix16_to_float( const Word16 number, const Word16 Q ); #endif /* FLOAT_TO_FIX_OPS_H */ - diff --git a/lib_util/ls_custom_file_reader.c b/lib_util/ls_custom_file_reader.c index 37784a630..5c1ac6ae0 100644 --- a/lib_util/ls_custom_file_reader.c +++ b/lib_util/ls_custom_file_reader.c @@ -33,7 +33,7 @@ #include "ls_custom_file_reader.h" #include #include -#include "ivas_prot_fx.h" +#include struct LsCustomFileReader @@ -105,6 +105,96 @@ void CustomLsReader_close( } +/*-------------------------------------------------------------------* + * panning_wrap_angles() + * + * Wrap angles for amplitude panning to the range: + * azimuth = (-180, 180] + * elevation = [-90, 90] + * Considers direction changes from large elevation values + *-------------------------------------------------------------------*/ + +/* helper function for panning_wrap_angles */ +static float wrap_azi( + const float azi_deg ) +{ + float azi = azi_deg; + + /* Wrap azimuth value */ + while ( azi > 180 ) + { + azi -= 360.0f; + } + + while ( azi <= -180 ) + { + azi += 360; + } + + return azi; +} + +static void panning_wrap_angles( + const float azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ + const float ele_deg, /* i : elevation in degrees for panning direction (positive up) */ + float *azi_wrapped, /* o : wrapped azimuth component */ + float *ele_wrapped /* o : wrapped elevation component */ +) +{ + float azi, ele; + + azi = azi_deg; + ele = ele_deg; + + if ( fabsf( ele ) < 90 ) + { + *ele_wrapped = ele; + *azi_wrapped = wrap_azi( azi ); + return; + } + else + { + /* Special case when elevation is a multiple of 90; azimuth is irrelevant */ + if ( ( fmodf( ele, 90 ) == 0 ) && ( fmodf( ele, 180 ) != 0 ) ) + { + *azi_wrapped = 0; + while ( ele > 90 ) + { + ele -= 360; + } + while ( ele < -90 ) + { + ele += 360; + } + *ele_wrapped = ele; + } + else + { + /* Wrap elevation and adjust azimuth accordingly */ + while ( fabsf( ele ) > 90 ) + { + /* Flip to other hemisphere */ + azi += 180; + + /* Compensate elevation accordingly */ + if ( ele > 90 ) + { + ele = 180 - ele; + } + else if ( ele < -90 ) + { + ele = -180 - ele; + } + } + *azi_wrapped = wrap_azi( azi ); + *ele_wrapped = ele; + } + + return; + } +} + + /*-------------------------------------------------------------------------* * CustomLoudspeakerLayout_validate() * -- GitLab From ce6307ad646a82a063f3f334b7a1e0c3d733079c Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 11 Nov 2025 14:41:51 +0100 Subject: [PATCH 3/7] clang-format + more cleaning --- lib_com/ivas_prot_fx.h | 12 ------------ lib_dec/lib_dec_fx.c | 3 +++ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 0e607039f..75227dd6a 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -6771,18 +6771,6 @@ void ivas_ism_renderer_close( ); -/*----------------------------------------------------------------------------------* - * Amplitude Panning VBAP prototypes - *----------------------------------------------------------------------------------*/ - -void panning_wrap_angles( - const float azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ - const float ele_deg, /* i : elevation in degrees for panning direction (positive up) */ - float *azi_wrapped, /* o : wrapped azimuth component */ - float *ele_wrapped /* o : wrapped elevation component */ -); - - /*----------------------------------------------------------------------------------* * McMASA prototypes *----------------------------------------------------------------------------------*/ diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index d0d31f93a..34abd9c41 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -43,6 +43,9 @@ #include "jbm_pcmdsp_fifo.h" #include #include +#ifdef DEBUGGING +#include "float_to_fix_ops.h" +#endif #include "wmc_auto.h" -- GitLab From c20b9516ed0e92127548cd7f5e491cffcbedb528 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 11 Nov 2025 17:55:39 +0100 Subject: [PATCH 4/7] fix --- lib_dec/lib_dec_fx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index afedc30c1..0c96500a2 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -3470,7 +3470,11 @@ static ivas_error IVAS_DEC_FeedAcousticEnvPI( move32(); move32(); - mvr2r( hAcoustEnvPI.absorbCoeffs, hRenderConfig->roomAcoustics.AbsCoeff, IVAS_ROOM_ABS_COEFF ); + FOR( Word16 i = 0; i < IVAS_ROOM_ABS_COEFF; i++ ) + { + hRenderConfig->roomAcoustics.AbsCoeff[i] = hAcoustEnvPI.absorbCoeffs[i]; + move16(); + } } IF( ( error = IVAS_DEC_AddAcousticEnvironment( hIvasDec, acEnv ) ) != IVAS_ERR_OK ) -- GitLab From ae192da685f6613a7045ad4f6a5055fac194a8b4 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 11 Nov 2025 22:30:37 +0100 Subject: [PATCH 5/7] remove forgotten float/intX_t datatypes --- apps/decoder.c | 3 +-- lib_com/basop_proto_func.h | 4 ---- lib_com/fd_cng_com_fx.c | 5 +++-- lib_com/ivas_prot_fx.h | 4 ++-- lib_com/ivas_tools_fx.c | 8 ++++---- lib_com/prot_fx.h | 11 +++-------- lib_com/pvq_com_fx.c | 12 ++++++------ lib_dec/ivas_binRenderer_internal_fx.c | 2 +- lib_dec/ivas_jbm_dec_fx.c | 2 -- lib_dec/ivas_omasa_dec_fx.c | 2 +- lib_dec/lib_dec_fx.c | 1 - lib_dec/updt_dec_fx.c | 6 +++--- lib_enc/core_switching_enc_fx.c | 4 ++-- lib_enc/ivas_tcx_core_enc_fx.c | 1 - lib_enc/prot_fx_enc.h | 2 +- lib_enc/swb_tbe_enc_fx.c | 2 +- lib_rend/ivas_hrtf_fx.c | 4 ++-- lib_rend/ivas_prot_rend_fx.h | 6 +++--- 18 files changed, 33 insertions(+), 46 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 19a72df38..640fb83af 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1786,12 +1786,11 @@ static void usage_dec( void ) fprintf( stdout, " ID and duration pairs, where duration is specified in frames\n" ); fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration.\n" ); fprintf( stdout, "-obj_edit File : Object editing instructions file or NULL for built-in example\n" ); - fprintf( stdout, "-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" ); fprintf( stdout, " Currently, all values default to level 3 (full functionality).\n" ); #ifdef FIX_1318_ROOM_SIZE_CMD_LINE fprintf( stdout, "-room_size (S|M|L) : Selects default reverb based on a room size (S - small | M - medium | L - large)\n" ); - fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration,\n" ); + fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration\n" ); #endif fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); fprintf( stdout, " default is deactivated\n" ); diff --git a/lib_com/basop_proto_func.h b/lib_com/basop_proto_func.h index 0e2fc5ad7..55c15f291 100644 --- a/lib_com/basop_proto_func.h +++ b/lib_com/basop_proto_func.h @@ -43,10 +43,6 @@ #include "basop_util.h" -/* tcx_lpc_cdk.h */ -#define LSF_GAP_VAL( x ) ( Word16 )( (x) *2.0f * 1.28f ) -#define LSFM( x ) FL2WORD16_SCALE( x * 1.28, 15 - 1 ) /* 14Q1*1.28 */ - /* cnst.h */ #define GAMMA1_INV 17809 /* weighting factor (numerator) default:0.92 (1Q14format) */ #define GAMMA16k_INV 17430 /* weighting factor (numerator) default:0.94 (1Q14format) */ diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 363113f21..390afbd00 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -27,7 +27,7 @@ * Local function prototypes *-------------------------------------------------------------------*/ static void getmidbands( const Word16 *part, const Word16 npart, Word16 *midband, Word16 *psize, Word16 *psize_norm, Word16 *psize_norm_exp, Word16 *psize_inv ); - +static void mhvals( const Word16 d, Word16 *m ); /*------------------------------------------------------------------- * createFdCngCom() @@ -2823,7 +2823,8 @@ void SynthesisSTFT_ivas_fx( /************************************************************************************** * Compute some values used in the bias correction of the minimum statistics algorithm * **************************************************************************************/ -void mhvals( + +static void mhvals( const Word16 d, Word16 *m /*, Word16 * h*/ ) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 6989cc524..db13b368b 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -3720,8 +3720,8 @@ void ivas_init_binaural_hrtf_fx( ivas_error ivas_allocate_binaural_hrtf_fx( HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ - const int16_t n_channels, /* i : number of input channels */ - const int16_t allocate_init_flag /* i : Memory allocation flag */ + const Word16 n_channels, /* i : number of input channels */ + const Word16 allocate_init_flag /* i : Memory allocation flag */ ); void ivas_binRenderer_fx( diff --git a/lib_com/ivas_tools_fx.c b/lib_com/ivas_tools_fx.c index 29d470a55..973837ac0 100644 --- a/lib_com/ivas_tools_fx.c +++ b/lib_com/ivas_tools_fx.c @@ -117,8 +117,8 @@ void mvc2c( /*! r: number of clipped samples */ UWord32 ivas_syn_output_fx( - Word32 *synth[], /* i/o: float synthesis signal q_synth*/ - const Word16 q_synth, + Word32 *synth[], /* i/o: synthesis signal q_synth*/ + const Word16 q_synth, /* i : Q factor */ const Word16 output_frame, /* i : output frame length (one channel) Q0*/ const Word16 n_channels, /* i : number of output channels Q0*/ Word16 *synth_out /* o : integer 16 bits synthesis signal Q0*/ @@ -131,7 +131,7 @@ UWord32 ivas_syn_output_fx( move32(); /*-----------------------------------------------------------------* - * float to integer conversion with saturation control + * Word32 to Word16 conversion with saturation control *-----------------------------------------------------------------*/ FOR( n = 0; n < n_channels; n++ ) @@ -2094,7 +2094,7 @@ void panning_wrap_angles_fx( /*-------------------------------------------------------------------------* * v_sort_ind_fixed() * - * Sort a float array + * Sort a Word32 array * (modified version of v_sort() to return an index array) *-------------------------------------------------------------------------*/ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index e5bdb4c29..28601b9ca 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -3401,7 +3401,7 @@ void apply_gain_fx( const Word16 *band_end, /* i : Sub band end indices Q0 */ const Word16 num_sfm, /* i : Number of bands Q0 */ const Word16 *gains, /* i : Band gain vector Q12 */ - Word16 *xq /* i/o: Float synthesis / Gain adjusted synth Q15/Q12 */ + Word16 *xq /* i/o: synthesis / Gain adjusted synth Q15/Q12 */ ); void fine_gain_quant_fx( @@ -5344,11 +5344,6 @@ void SynthesisSTFT_ivas_fx( const Word16 nchan_out /* i : number of output channels */ ); -void mhvals( - const Word16 d, - Word16 *m /*, float * h*/ -); - Word32 sign_l( const Word32 x /* i : input value of x */ ); @@ -7820,8 +7815,8 @@ void updt_IO_switch_dec_fx( ); void updt_bw_switching_fx( - Decoder_State *st_fx, /* i/o: decoder state structure */ - const Word16 *synth, /* i : float synthesis signal */ + Decoder_State *st_fx, /* i/o: decoder state structure */ + const Word16 *synth, /* i : synthesis signal Qpost */ const Word16 Qpost ); void updt_dec_common_fx( diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index 98ca8c4ab..73276fda3 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -474,12 +474,12 @@ void NearOppSplitAdjustment_fx( *--------------------------------------------------------------------------*/ void apply_gain_fx( - const Word16 *ord, /* i : Indices for energy order Q0 */ - const Word16 *band_start, /* i : Sub band start indices Q0 */ - const Word16 *band_end, /* i : Sub band end indices Q0 */ - const Word16 num_sfm, /* i : Number of bands Q0 */ - const Word16 *gains, /* i : Band gain vector Qx */ - Word16 *xq /* i/o: Float synthesis / Gain adjusted synth Q15/Qx */ + const Word16 *ord, /* i : Indices for energy order Q0 */ + const Word16 *band_start, /* i : Sub band start indices Q0 */ + const Word16 *band_end, /* i : Sub band end indices Q0 */ + const Word16 num_sfm, /* i : Number of bands Q0 */ + const Word16 *gains, /* i : Band gain vector Qx */ + Word16 *xq /* i/o: synthesis / Gain adjusted synth Q15/Qx */ ) { Word16 band, i; diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index 36471b156..5d4a6d964 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -543,7 +543,7 @@ return IVAS_ERR_OK; ivas_error ivas_allocate_binaural_hrtf_fx( HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ - const int16_t n_channels, /* i : number of input channels */ + const Word16 n_channels, /* i : number of input channels */ const Word16 allocate_init_flag /* i : Memory allocation flag */ ) { diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 42270d50d..94d709461 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -2710,7 +2710,6 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( } ELSE IF( EQ_16( renderer_type_old, RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) { - /*TODO :To be tested : no stream entering---------------------------------------*/ /* Convert to CICPxx; used also for ISM->CICP19->binaural_room rendering */ set16_fx( st_ivas->hIsmRendererData->interpolator_fx, 32767, hTcBuffer->n_samples_granularity ); // 32767=1.0f in Q15 @@ -2755,7 +2754,6 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( test(); IF( EQ_16( renderer_type_old, RENDERER_BINAURAL_MIXER_CONV ) || EQ_16( renderer_type_old, RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) { - /*TODO :To be tested : no stream entering*/ st_ivas->hCrendWrapper->p_io_qfactor = &st_ivas->hCrendWrapper->io_qfactor; IF( NE_32( ( error = getAudioConfigNumChannels( intern_config_old, &nchan_in ) ), IVAS_ERR_OK ) ) { diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index 30f307731..7df8ddfef 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -681,7 +681,7 @@ ivas_error ivas_omasa_dec_config_fx( { set_s( hMasaIsmData->azimuth_ism_fx[obj_idx], 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); set_s( hMasaIsmData->elevation_ism_fx[obj_idx], 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); - FOR( int16_t sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; sf++ ) + FOR( Word16 sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; sf++ ) { set_l( hMasaIsmData->energy_ratio_ism_fx[obj_idx][sf], 0, CLDFB_NO_CHANNELS_MAX ); } diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 0c96500a2..82d52ca00 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1457,7 +1457,6 @@ static ivas_error isar_generate_metadata_and_bitstream( { /*TD input*/ /*if CLDFB handles have been allocated then assume valid multi binaural input in out[][] buffer and perform CLDFB analysis*/ - /* local float2fix, to be removed */ num_poses = hSplitBinRend->splitrend.multiBinPoseData.num_poses; move16(); diff --git a/lib_dec/updt_dec_fx.c b/lib_dec/updt_dec_fx.c index 8704c2e07..7d389a0e2 100644 --- a/lib_dec/updt_dec_fx.c +++ b/lib_dec/updt_dec_fx.c @@ -394,8 +394,8 @@ void updt_IO_switch_dec_fx( *-------------------------------------------------------------------*/ void updt_bw_switching_fx( - Decoder_State *st_fx, /* i/o: decoder state structure */ - const Word16 *synth, /* i : fixed point synthesis signal Qpost */ + Decoder_State *st_fx, /* i/o: decoder state structure */ + const Word16 *synth, /* i : synthesis signal Qpost */ const Word16 Qpost ) { test(); @@ -786,7 +786,7 @@ static void ivas_updt_bw_switching_fx( move16(); } } - st_fx->prev_bws_cnt = st_fx->bws_cnt; // TODO: Duplicate variables + st_fx->prev_bws_cnt = st_fx->bws_cnt; move16(); return; } diff --git a/lib_enc/core_switching_enc_fx.c b/lib_enc/core_switching_enc_fx.c index b7cdbc994..c390ab78b 100644 --- a/lib_enc/core_switching_enc_fx.c +++ b/lib_enc/core_switching_enc_fx.c @@ -298,7 +298,7 @@ void core_switching_pre_enc_fx( /* reset BWE memories */ IF( hBWE_FD != NULL ) { - set16_fx( hBWE_FD->old_syn_12k8_16k_fx, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ) ); /* TODO : this might not be needed */ + set16_fx( hBWE_FD->old_syn_12k8_16k_fx, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ) ); } } test(); @@ -915,7 +915,7 @@ void core_switching_pre_enc_ivas_fx( /* reset BWE memories */ IF( hBWE_FD != NULL ) { - set16_fx( hBWE_FD->old_syn_12k8_16k_fx, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ) ); /* TODO : this might not be needed */ + set16_fx( hBWE_FD->old_syn_12k8_16k_fx, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ) ); } } test(); diff --git a/lib_enc/ivas_tcx_core_enc_fx.c b/lib_enc/ivas_tcx_core_enc_fx.c index c10705e5d..7c5972545 100644 --- a/lib_enc/ivas_tcx_core_enc_fx.c +++ b/lib_enc/ivas_tcx_core_enc_fx.c @@ -370,7 +370,6 @@ void stereo_tcx_core_enc( * Core Signal Analysis: MDCT, TNS, LPC analysis *---------------------------------------------------------------*/ - /* TODO: integrate this. */ st->prev_Q_new = 0; st->Q_old = 0; diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 5e9950615..6e15790ad 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -3625,7 +3625,7 @@ void re8_cod_fx( void TBEreset_enc_fx( TD_BWE_ENC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ - const int16_t last_core, /* i : last core */ + const Word16 last_core, /* i : last core */ Word16 bandwidth /* i : bandwidth mode */ ); diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index c6c7135fc..9aeaf5f2c 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -7637,7 +7637,7 @@ void tbe_write_bitstream_fx( void TBEreset_enc_fx( TD_BWE_ENC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ - const int16_t last_core, /* i : last core */ + const Word16 last_core, /* i : last core */ Word16 bandwidth /* i : bandwidth mode */ ) { diff --git a/lib_rend/ivas_hrtf_fx.c b/lib_rend/ivas_hrtf_fx.c index 8bc3c0379..dee0fe052 100644 --- a/lib_rend/ivas_hrtf_fx.c +++ b/lib_rend/ivas_hrtf_fx.c @@ -55,7 +55,7 @@ ivas_error ivas_HRTF_binary_open_fx( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF binary!" ); } - set_c( (int8_t *) ( *hHrtfTD ), 0, (int32_t) sizeof( TDREND_HRFILT_FiltSet_t ) ); + set_c( (Word8 *) ( *hHrtfTD ), 0, (Word32) sizeof( TDREND_HRFILT_FiltSet_t ) ); return IVAS_ERR_OK; } @@ -246,7 +246,7 @@ ivas_error ivas_HRTF_parambin_binary_open_fx( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for parametric binauralizer HRTF tables!" ); } - set_c( (int8_t *) ( *hHrtfParambin ), 0, (int32_t) sizeof( HRTFS_PARAMBIN ) ); + set_c( (Word8 *) ( *hHrtfParambin ), 0, (Word32) sizeof( HRTFS_PARAMBIN ) ); return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_prot_rend_fx.h b/lib_rend/ivas_prot_rend_fx.h index 9dce43a97..e257ccd12 100644 --- a/lib_rend/ivas_prot_rend_fx.h +++ b/lib_rend/ivas_prot_rend_fx.h @@ -608,7 +608,7 @@ ivas_error ivas_HRTF_CRend_binary_open_fx( ); ivas_error ivas_HRTF_CRend_binary_open_buffers_int16( - int16_t **buffer, /* o : buffer to allocate */ + Word16 **buffer, /* o : buffer to allocate */ const uint32_t mem_size /* i : size of buffer */ ); @@ -618,7 +618,7 @@ void ivas_HRTF_CRend_binary_close_fx( ivas_error ivas_HRTF_statistics_init_fx( HRTFS_STATISTICS_HANDLE *hHrtfStatistics, /* i/o: HRTF statistics structure */ - const int32_t sampleRate /* i : Sample rate */ + const Word32 sampleRate /* i : Sample rate */ ); void ivas_HRTF_statistics_close_fx( @@ -891,7 +891,7 @@ ivas_error ivas_rend_openCrend_fx( HRTFS_CREND_HANDLE hHrtfCrend, HRTFS_STATISTICS_HANDLE hHrtfStatistics, const Word32 output_Fs, - const int16_t ext_rend_flag, + const Word16 ext_rend_flag, const Word16 num_poses ); -- GitLab From f082ed6ec32c3a4f3c47da8721b98c5471940b56 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 11 Nov 2025 22:43:19 +0100 Subject: [PATCH 6/7] clang-format --- lib_enc/prot_fx_enc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 6e15790ad..e4b29eb08 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -3625,7 +3625,7 @@ void re8_cod_fx( void TBEreset_enc_fx( TD_BWE_ENC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ - const Word16 last_core, /* i : last core */ + const Word16 last_core, /* i : last core */ Word16 bandwidth /* i : bandwidth mode */ ); -- GitLab From b7e1c9be7b2113f430e690e3b15bdab33b2dbfc8 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 12 Nov 2025 13:04:53 +0100 Subject: [PATCH 7/7] reintroduce #include "options.h" --- apps/decoder.c | 1 + apps/encoder.c | 1 + 2 files changed, 2 insertions(+) diff --git a/apps/decoder.c b/apps/decoder.c index 640fb83af..7b02e26b4 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -31,6 +31,7 @@ *******************************************************************************************************/ #include "lib_dec.h" +#include "options.h" #include #include "cmdl_tools.h" #include "audio_file_writer.h" diff --git a/apps/encoder.c b/apps/encoder.c index 95802ba80..fe64442e1 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -31,6 +31,7 @@ *******************************************************************************************************/ #include +#include "options.h" #ifdef DEBUGGING #include "debug.h" #endif -- GitLab