diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj
index 28dae4b83bcd32f3fac943c53d3420f30e53c6fb..9119a2c38c6d94ad4c32158b3b97aaa32b9348f1 100644
--- a/Workspace_msvc/lib_com.vcxproj
+++ b/Workspace_msvc/lib_com.vcxproj
@@ -388,8 +388,10 @@
+
+
diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters
index 46d83453ac2480c96dc4f570a757346e4fd4d77b..c8ed6bc107148cc9fdc3c6c50e73f1ebce697ff7 100644
--- a/Workspace_msvc/lib_com.vcxproj.filters
+++ b/Workspace_msvc/lib_com.vcxproj.filters
@@ -597,6 +597,12 @@
common_h
+
+ common_h
+
+
+ common_h
+
diff --git a/apps/decoder.c b/apps/decoder.c
index dc1cc25b35998a1f38f62f7481e0d28083441758..54a4c1dfe970f29f9dc79f83cd87a2993e56b7fa 100644
--- a/apps/decoder.c
+++ b/apps/decoder.c
@@ -45,6 +45,7 @@
#include "rotation_file_reader.h"
#include "vector3_pair_file_reader.h"
#include "wmc_auto.h"
+#include "options.h"
#include "stl.h"
@@ -54,7 +55,7 @@
* Local constants
*------------------------------------------------------------------------------------------*/
-#if !defined( DEBUGGING ) && !defined( WMOPS_FLT )
+#if !defined( DEBUGGING ) && !defined( WMOPS )
static
#endif
int32_t frame = 0; /* Counter of frames */
@@ -161,15 +162,11 @@ int main(
IVAS_RENDER_FRAMESIZE asked_frame_size;
int16_t run_unit_tests = 0;
-#ifdef WMOPS_FLT
+#ifdef WMOPS
reset_wmops();
reset_mem( USE_BYTES );
#endif
-#if ( WMOPS )
-#ifndef DONT_COUNT
- BASOP_init
-#endif
-#endif
+
/*------------------------------------------------------------------------------------------*
* Parse command-line arguments
*------------------------------------------------------------------------------------------*/
@@ -611,12 +608,8 @@ int main(
mainFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */
cleanup:
-#ifndef DONT_COUNT
- /* end of WMOPS counting */
- BASOP_end
- BASOP_end_noprint
-#endif
- free( pcmBuf );
+
+ free( pcmBuf );
if ( arg.hrtfReaderEnabled )
{
@@ -642,10 +635,11 @@ cleanup:
fprintf( stderr, "\nError while closing file: %s\nContinuing...\n\n", arg.inputBitstreamFilename );
}
-#ifdef WMOPS_FLT
+#ifdef WMOPS
print_wmops();
print_mem( NULL );
#endif
+
if ( !arg.quietModeEnabled )
{
printf( "\n" );
@@ -1550,7 +1544,7 @@ static ivas_error decodeG192(
delayNumSamples_orig[0] = -1;
-#ifdef WMOPS_FLT
+#ifdef WMOPS
reset_stack();
reset_wmops();
#endif
@@ -1806,28 +1800,18 @@ static ivas_error decodeG192(
}
}
}
+
vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;
-#ifdef WMOPS_FLT
+
+#ifdef WMOPS
if ( vec_pos_update == 0 )
{
update_wmops();
update_mem();
-#ifdef MEM_COUNT_DETAILS
- export_mem( "mem_analysis.csv" );
-#endif
}
-#endif
-#ifdef WMOPS
-#ifndef DONT_COUNT
- if ( vec_pos_update == 0 )
- {
- /* update WMPOS counting (end of frame) */
- BASOP_frame_update();
- }
-
-#endif
#endif
}
+
/*------------------------------------------------------------------------------------------*
* Flush what is still left in the VoIP Buffers....
*------------------------------------------------------------------------------------------*/
@@ -1948,12 +1932,15 @@ static ivas_error decodeG192(
}
}
}
+
#ifdef WMOPS
-#ifndef DONT_COUNT
- /* update WMPOS counting (end of frame) */
- BASOP_frame_update();
+ update_wmops();
+ update_mem();
+#ifdef MEM_COUNT_DETAILS
+ export_mem( "mem_analysis.csv" );
#endif
#endif
+
frame++;
if ( !arg.quietModeEnabled )
{
@@ -2211,7 +2198,7 @@ static ivas_error decodeVoIP(
fprintf( stdout, "\n-- Start the decoder (quiet mode) --\n\n" );
}
-#ifdef WMOPS_FLT
+#ifdef WMOPS
reset_stack();
reset_wmops();
#endif
@@ -2493,13 +2480,8 @@ static ivas_error decodeVoIP(
vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;
frame++;
systemTime_ms += systemTimeInc_ms;
+
#ifdef WMOPS
-#ifndef DONT_COUNT
- /* update WMPOS counting (end of frame) */
- BASOP_frame_update();
-#endif
-#endif
-#ifdef WMOPS_FLT
update_mem();
update_wmops();
#endif
diff --git a/apps/encoder.c b/apps/encoder.c
index 283f1626a57fbfd0f2c159cf7fb73616e39eddbf..e7c5a20b7be9e3a6525e1c9041b3ef8a45cc28ce 100644
--- a/apps/encoder.c
+++ b/apps/encoder.c
@@ -39,6 +39,7 @@
#include "jbm_file_reader.h"
#include "masa_file_reader.h"
#include "wmc_auto.h"
+#include "options.h"
#include "stl.h"
diff --git a/lib_com/basop32.c b/lib_com/basop32.c
index 3c45383b7e63e6080275ae67d6795ec214c4e8cc..2a813e15c27a7a0b7ce0b6a337d1320615e1693b 100644
--- a/lib_com/basop32.c
+++ b/lib_com/basop32.c
@@ -170,7 +170,7 @@ HISTORY:
#pragma warning( disable : 4310 )
#endif
-#if ( WMOPS )
+#ifdef WMOPS
extern BASIC_OP multiCounter[MAXCOUNTERS];
extern int currCounter;
#endif
@@ -896,11 +896,10 @@ Word16 shl_sat( Word16 var1, Word16 var2 )
*/
#ifdef BASOP_NOGLOB
Word16 shr_o( Word16 var1, Word16 var2, Flag *Overflow )
-{
#else /* BASOP_NOGLOB */
Word16 shr( Word16 var1, Word16 var2 )
-{
#endif /* BASOP_NOGLOB */
+{
Word16 var_out;
if ( var2 < 0 )
@@ -914,7 +913,7 @@ Word16 shr( Word16 var1, Word16 var2 )
var_out = shl( var1, var2 );
#endif /* BASOP_NOGLOB */
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].shl--;
#endif
}
@@ -995,11 +994,10 @@ Word16 shr_sat( Word16 var1, Word16 var2 )
*/
#ifdef BASOP_NOGLOB
Word16 mult_o( Word16 var1, Word16 var2, Flag *Overflow )
-{
#else /* BASOP_NOGLOB */
Word16 mult( Word16 var1, Word16 var2 )
-{
#endif /* BASOP_NOGLOB */
+{
Word16 var_out;
Word32 L_product;
@@ -1589,11 +1587,10 @@ Word32 DEPR_L_macNs( Word32 L_var3, Word16 var1, Word16 var2, Flag *Carry )
#endif
#ifdef BASOP_NOGLOB
Word32 L_macNs_co( Word32 L_var3, Word16 var1, Word16 var2, Flag *Carry, Flag *Overflow )
-{
#else /* BASOP_NOGLOB */
Word32 L_macNs( Word32 L_var3, Word16 var1, Word16 var2 )
-{
#endif /* BASOP_NOGLOB */
+{
Word32 L_var_out;
#ifdef BASOP_NOGLOB
diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c
index 8daae8a031488259915e2ee5afa5904d6441ae64..ce32ca59c023b82176d608b85e270c57043229b7 100644
--- a/lib_com/basop_util.c
+++ b/lib_com/basop_util.c
@@ -2613,7 +2613,7 @@ cmplx CL_scale_t( cmplx x, Word16 y )
cmplx result;
result.re = Mpy_32_16_1( x.re, y );
result.im = Mpy_32_16_1( x.im, y );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_16_1--;
multiCounter[currCounter].Mpy_32_16_1--;
multiCounter[currCounter].CL_scale++;
@@ -2626,11 +2626,11 @@ cmplx CL_dscale_t( cmplx x, Word16 y1, Word16 y2 )
cmplx result;
result.re = Mpy_32_16_1( x.re, y1 );
result.im = Mpy_32_16_1( x.im, y2 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_16_1--;
multiCounter[currCounter].Mpy_32_16_1--;
multiCounter[currCounter].CL_dscale++;
-#endif /* #if (WMOPS) */
+#endif /* #ifdef WMOPS */
return ( result );
}
@@ -2639,7 +2639,7 @@ cmplx CL_mult_32x16( cmplx input, cmplx_s coeff )
cmplx result;
result.re = L_sub( Mpy_32_16_1( input.re, coeff.re ), Mpy_32_16_1( input.im, coeff.im ) );
result.im = L_add( Mpy_32_16_1( input.re, coeff.im ), Mpy_32_16_1( input.im, coeff.re ) );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_multr_32x16++;
multiCounter[currCounter].Mpy_32_16_1--;
multiCounter[currCounter].Mpy_32_16_1--;
diff --git a/lib_com/cldfb_evs.c b/lib_com/cldfb_evs.c
index bad77d7f177404ce7c2f942a7755c43b336f0d0d..1186c82fae9369424ac970c12f58424e70536ae4 100644
--- a/lib_com/cldfb_evs.c
+++ b/lib_com/cldfb_evs.c
@@ -1016,7 +1016,7 @@ ivas_error openCldfb(
{
HANDLE_CLDFB_FILTER_BANK hs;
- hs = (HANDLE_CLDFB_FILTER_BANK) count_malloc( sizeof( CLDFB_FILTER_BANK ) );
+ hs = (HANDLE_CLDFB_FILTER_BANK) malloc( sizeof( CLDFB_FILTER_BANK ) );
IF( hs == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB" );
@@ -1030,11 +1030,11 @@ ivas_error openCldfb(
IF( type == CLDFB_ANALYSIS )
{
- hs->FilterStates = (Word16 *) count_malloc( STATE_BUFFER_SIZE * maxCldfbBands * sizeof( Word16 ) );
+ hs->FilterStates = (Word16 *) malloc( STATE_BUFFER_SIZE * maxCldfbBands * sizeof( Word16 ) );
}
ELSE
{
- hs->FilterStates = (Word16 *) count_malloc( 2 * STATE_BUFFER_SIZE * maxCldfbBands * sizeof( Word16 ) );
+ hs->FilterStates = (Word16 *) malloc( 2 * STATE_BUFFER_SIZE * maxCldfbBands * sizeof( Word16 ) );
}
if ( hs->FilterStates == NULL )
{
@@ -1500,9 +1500,9 @@ void deleteCldfb( HANDLE_CLDFB_FILTER_BANK *h_cldfb ) /* i: cldfb handle */
{
IF( ( *h_cldfb )->FilterStates != NULL )
{
- count_free( ( *h_cldfb )->FilterStates );
+ free( ( *h_cldfb )->FilterStates );
}
- count_free( *h_cldfb );
+ free( *h_cldfb );
}
*h_cldfb = NULL;
}
@@ -1691,7 +1691,7 @@ void cldfb_restore_memory( HANDLE_CLDFB_FILTER_BANK hs ) /* i/o: cldfb handle */
}
hs->memory_length = 0;
- count_free( hs->memory );
+ free( hs->memory );
hs->memory = NULL;
return;
diff --git a/lib_com/cnst.h b/lib_com/cnst.h
index 53b1d472377dd240b7ddedb23c1b5e807c3f7889..c5562860337081413241365f1f56cd73668cd5be 100644
--- a/lib_com/cnst.h
+++ b/lib_com/cnst.h
@@ -3040,7 +3040,7 @@ extern const Word16 Idx2Freq_Tbl[];
/* 'x' is converted to Q6, 'Freq_Tbl'/1000 in Q9 */
/* only works for 'fs' = [8000,12800,16000,25600,32000,48000] (unpredictable otherwise) */
/* 15625 is 1000000.0f/Q6 but we use the calculated value to avoid float point code */
-#define NS2SA_fx2(fs,x) (chk_fs(fs) mult((&Idx2Freq_Tbl[-2])[L_and(L_shr(fs,8),7)], (Word16)((x)/15625)))
+#define NS2SA_FX2(fs,x) (chk_fs(fs) mult((&Idx2Freq_Tbl[-2])[L_and(L_shr(fs,8),7)], (Word16)((x)/15625)))
#define L_FRAME_12k8 256 /* Frame size at 12k8Hz: 20ms = 256 samples */
#define L_FRAME_16k 320 /* Frame size at 16kHz: 20ms = 320 samples */
diff --git a/lib_com/complex_basop.c b/lib_com/complex_basop.c
index b9a20ddaf0816bbdd3bb941400a1f3f07847db83..ffe56d47545610529d208ab39b4d0f9c5b2c4757 100644
--- a/lib_com/complex_basop.c
+++ b/lib_com/complex_basop.c
@@ -17,7 +17,7 @@
#include "stl.h"
-#if ( WMOPS )
+#ifdef WMOPS
extern BASIC_OP multiCounter[MAXCOUNTERS];
@@ -35,7 +35,7 @@ cmplx CL_shr( cmplx inp, Word16 shift_val )
cmplx out;
out.re = L_shr( inp.re, shift_val );
out.im = L_shr( inp.im, shift_val );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_shr++;
multiCounter[currCounter].L_shr--;
multiCounter[currCounter].L_shr--;
@@ -48,7 +48,7 @@ cmplx CL_shl( cmplx inp, Word16 shift_val )
cmplx out;
out.re = L_shl( inp.re, shift_val );
out.im = L_shl( inp.im, shift_val );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_shl++;
multiCounter[currCounter].L_shl--;
multiCounter[currCounter].L_shl--;
@@ -61,7 +61,7 @@ cmplx CL_add( cmplx inp1, cmplx inp2 )
cmplx out;
out.re = L_add( inp1.re, inp2.re );
out.im = L_add( inp1.im, inp2.im );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_add++;
multiCounter[currCounter].L_add--;
multiCounter[currCounter].L_add--;
@@ -74,7 +74,7 @@ cmplx CL_sub( cmplx inp1, cmplx inp2 )
cmplx out;
out.re = L_sub( inp1.re, inp2.re );
out.im = L_sub( inp1.im, inp2.im );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_sub++;
multiCounter[currCounter].L_sub--;
multiCounter[currCounter].L_sub--;
@@ -87,11 +87,11 @@ cmplx CL_scale( cmplx x, Word16 y )
cmplx result;
result.re = Mpy_32_16_r( x.re, y );
result.im = Mpy_32_16_r( x.im, y );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_16_r--;
multiCounter[currCounter].Mpy_32_16_r--;
multiCounter[currCounter].CL_scale++;
-#endif /* #if (WMOPS) */
+#endif /* #ifdef WMOPS */
return ( result );
}
@@ -100,11 +100,11 @@ cmplx CL_dscale( cmplx x, Word16 y1, Word16 y2 )
cmplx result;
result.re = Mpy_32_16_r( x.re, y1 );
result.im = Mpy_32_16_r( x.im, y2 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_16_r--;
multiCounter[currCounter].Mpy_32_16_r--;
multiCounter[currCounter].CL_dscale++;
-#endif /* #if (WMOPS) */
+#endif /* #ifdef WMOPS */
return ( result );
}
@@ -113,7 +113,7 @@ cmplx CL_msu_j( cmplx x, cmplx y )
cmplx result;
result.re = L_add( x.re, y.im );
result.im = L_sub( x.im, y.re );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_msu_j++;
multiCounter[currCounter].L_add--;
multiCounter[currCounter].L_sub--;
@@ -126,7 +126,7 @@ cmplx CL_mac_j( cmplx x, cmplx y )
cmplx result;
result.re = L_sub( x.re, y.im );
result.im = L_add( x.im, y.re );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_mac_j++;
multiCounter[currCounter].L_add--;
multiCounter[currCounter].L_sub--;
@@ -136,7 +136,7 @@ cmplx CL_mac_j( cmplx x, cmplx y )
cmplx CL_move( cmplx x )
{
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move++;
#endif
return x;
@@ -144,7 +144,7 @@ cmplx CL_move( cmplx x )
Word32 CL_Extract_real( cmplx x )
{
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_Extract_real++;
#endif
return x.re;
@@ -152,7 +152,7 @@ Word32 CL_Extract_real( cmplx x )
Word32 CL_Extract_imag( cmplx x )
{
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_Extract_imag++;
#endif
return x.im;
@@ -163,7 +163,7 @@ cmplx CL_form( Word32 re, Word32 im )
cmplx result;
result.re = re;
result.im = im;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_form++;
#endif
return result;
@@ -174,7 +174,7 @@ cmplx CL_multr_32x16( cmplx input, cmplx_s coeff )
cmplx result;
result.re = W_round48_L( W_sub_nosat( W_mult_32_16( input.re, coeff.re ), W_mult_32_16( input.im, coeff.im ) ) );
result.im = W_round48_L( W_add_nosat( W_mult_32_16( input.re, coeff.im ), W_mult_32_16( input.im, coeff.re ) ) );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_multr_32x16++;
multiCounter[currCounter].W_mult_32_16--;
multiCounter[currCounter].W_mult_32_16--;
@@ -193,7 +193,7 @@ cmplx CL_negate( cmplx x )
cmplx result;
result.re = L_negate( x.re );
result.im = L_negate( x.im );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_negate++;
multiCounter[currCounter].L_negate--;
multiCounter[currCounter].L_negate--;
@@ -206,7 +206,7 @@ cmplx CL_conjugate( cmplx x )
cmplx result;
result.re = x.re;
result.im = L_negate( x.im );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_conjugate++;
multiCounter[currCounter].L_negate--;
#endif
@@ -220,7 +220,7 @@ cmplx CL_mul_j( cmplx input )
temp = CL_negate( input );
result.re = temp.im;
result.im = input.re;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_mul_j++;
multiCounter[currCounter].CL_negate--;
#endif
@@ -232,7 +232,7 @@ cmplx CL_swap_real_imag( cmplx input )
cmplx result;
result.re = input.im;
result.im = input.re;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_swap_real_imag++;
#endif
return result;
@@ -244,7 +244,7 @@ cmplx_s C_add( cmplx_s inp1, cmplx_s inp2 )
out.re = add( inp1.re, inp2.re );
out.im = add( inp1.im, inp2.im );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].C_add++;
multiCounter[currCounter].add--;
multiCounter[currCounter].add--;
@@ -258,7 +258,7 @@ cmplx_s C_sub( cmplx_s inp1, cmplx_s inp2 )
out.re = sub( inp1.re, inp2.re );
out.im = sub( inp1.im, inp2.im );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].C_sub++;
multiCounter[currCounter].sub--;
multiCounter[currCounter].sub--;
@@ -274,7 +274,7 @@ cmplx_s C_mul_j( cmplx_s input )
result.re = temp;
result.im = input.re;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].C_mul_j++;
multiCounter[currCounter].negate--;
#endif
@@ -287,7 +287,7 @@ cmplx_s C_multr( cmplx_s x, cmplx_s c )
result.re = round_fx( W_sat_l( W_sub_nosat( W_mult_16_16( x.re, c.re ), W_mult_16_16( x.im, c.im ) ) ) );
result.im = round_fx( W_sat_l( W_add_nosat( W_mult_16_16( x.im, c.re ), W_mult_16_16( x.re, c.im ) ) ) );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].C_multr++;
multiCounter[currCounter].W_mult_16_16--;
multiCounter[currCounter].W_mult_16_16--;
@@ -308,7 +308,7 @@ cmplx_s C_form( Word16 re, Word16 im )
cmplx_s result;
result.re = re;
result.im = im;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].C_form++;
#endif
return result;
@@ -319,11 +319,11 @@ cmplx C_scale( cmplx_s x, Word16 y )
cmplx result;
result.re = L_mult( x.re, y );
result.im = L_mult( x.im, y );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].L_mult--;
multiCounter[currCounter].L_mult--;
multiCounter[currCounter].C_scale++;
-#endif /* #if (WMOPS) */
+#endif /* #ifdef WMOPS */
return ( result );
}
@@ -333,7 +333,7 @@ cmplx_s CL_round32_16( cmplx x )
result.re = round_fx( x.re );
result.im = round_fx( x.im );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_round32_16++;
multiCounter[currCounter].round--;
multiCounter[currCounter].round--;
@@ -346,11 +346,11 @@ cmplx CL_scale_32( cmplx x, Word32 y )
cmplx result;
result.re = Mpy_32_32_r( x.re, y );
result.im = Mpy_32_32_r( x.im, y );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_32_r--;
multiCounter[currCounter].Mpy_32_32_r--;
multiCounter[currCounter].CL_scale_32++;
-#endif /* #if (WMOPS) */
+#endif /* #ifdef WMOPS */
return ( result );
}
@@ -359,11 +359,11 @@ cmplx CL_dscale_32( cmplx x, Word32 y1, Word32 y2 )
cmplx result;
result.re = Mpy_32_32_r( x.re, y1 );
result.im = Mpy_32_32_r( x.im, y2 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_32_r--;
multiCounter[currCounter].Mpy_32_32_r--;
multiCounter[currCounter].CL_dscale_32++;
-#endif /* #if (WMOPS) */
+#endif /* #ifdef WMOPS */
return ( result );
}
@@ -373,7 +373,7 @@ cmplx CL_multr_32x32( cmplx x, cmplx y )
result.re = W_round64_L( W_sub( W_mult_32_32( x.re, y.re ), W_mult_32_32( x.im, y.im ) ) );
result.im = W_round64_L( W_add( W_mult_32_32( x.im, y.re ), W_mult_32_32( x.re, y.im ) ) );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_multr_32x32++;
multiCounter[currCounter].W_mult_32_32--;
multiCounter[currCounter].W_mult_32_32--;
@@ -393,7 +393,7 @@ cmplx_s C_mac_r( cmplx x, cmplx_s y, Word16 c )
cmplx temp = CL_add( x, C_scale( y, c ) );
result = CL_round32_16( temp );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].C_mac_r++;
multiCounter[currCounter].CL_add--;
multiCounter[currCounter].C_scale--;
@@ -408,7 +408,7 @@ cmplx_s C_msu_r( cmplx x, cmplx_s y, Word16 c )
cmplx temp = CL_sub( x, C_scale( y, c ) );
result = CL_round32_16( temp );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].C_msu_r++;
multiCounter[currCounter].CL_sub--;
multiCounter[currCounter].C_scale--;
@@ -419,7 +419,7 @@ cmplx_s C_msu_r( cmplx x, cmplx_s y, Word16 c )
Word16 C_Extract_real( cmplx_s x )
{
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].C_Extract_real++;
#endif
return x.re;
@@ -427,7 +427,7 @@ Word16 C_Extract_real( cmplx_s x )
Word16 C_Extract_imag( cmplx_s x )
{
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].C_Extract_imag++;
#endif
return x.im;
@@ -438,7 +438,7 @@ cmplx_s C_negate( cmplx_s x )
cmplx_s result;
result.re = negate( x.re );
result.im = negate( x.im );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].C_negate++;
multiCounter[currCounter].negate--;
multiCounter[currCounter].negate--;
@@ -451,7 +451,7 @@ cmplx_s C_conjugate( cmplx_s x )
cmplx_s result;
result.re = x.re;
result.im = negate( x.im );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].C_conjugate++;
multiCounter[currCounter].negate--;
#endif
@@ -463,7 +463,7 @@ cmplx_s C_shr( cmplx_s inp, Word16 shift_val )
cmplx_s out;
out.re = shr( inp.re, shift_val );
out.im = shr( inp.im, shift_val );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].C_shr++;
multiCounter[currCounter].shr--;
multiCounter[currCounter].shr--;
@@ -476,7 +476,7 @@ cmplx_s C_shl( cmplx_s inp, Word16 shift_val )
cmplx_s out;
out.re = shl( inp.re, shift_val );
out.im = shl( inp.im, shift_val );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].C_shl++;
multiCounter[currCounter].shl--;
multiCounter[currCounter].shl--;
diff --git a/lib_com/control.c b/lib_com/control.c
index 94f3d5aeb9d7781811c93d5359a8c232b133dd8e..20865de23788f218d0022257b64fe0a2d8c35ad6 100644
--- a/lib_com/control.c
+++ b/lib_com/control.c
@@ -36,7 +36,7 @@ Flag LT_16( Word16 var1, Word16 var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].LT_16++;
#endif
return F_ret;
@@ -50,7 +50,7 @@ Flag GT_16( Word16 var1, Word16 var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].GT_16++;
#endif
return F_ret;
@@ -64,7 +64,7 @@ Flag LE_16( Word16 var1, Word16 var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].LE_16++;
#endif
return F_ret;
@@ -78,7 +78,7 @@ Flag GE_16( Word16 var1, Word16 var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].GE_16++;
#endif
return F_ret;
@@ -92,7 +92,7 @@ Flag EQ_16( Word16 var1, Word16 var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].EQ_16++;
#endif
return F_ret;
@@ -106,7 +106,7 @@ Flag NE_16( Word16 var1, Word16 var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].NE_16++;
#endif
return F_ret;
@@ -120,7 +120,7 @@ Flag LT_32( Word32 L_var1, Word32 L_var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].LT_32++;
#endif
return F_ret;
@@ -134,7 +134,7 @@ Flag GT_32( Word32 L_var1, Word32 L_var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].GT_32++;
#endif
return F_ret;
@@ -148,7 +148,7 @@ Flag LE_32( Word32 L_var1, Word32 L_var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].LE_32++;
#endif
return F_ret;
@@ -162,7 +162,7 @@ Flag GE_32( Word32 L_var1, Word32 L_var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].GE_32++;
#endif
return F_ret;
@@ -176,7 +176,7 @@ Flag EQ_32( Word32 L_var1, Word32 L_var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].EQ_32++;
#endif
return F_ret;
@@ -190,7 +190,7 @@ Flag NE_32( Word32 L_var1, Word32 L_var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].NE_32++;
#endif
return F_ret;
@@ -204,7 +204,7 @@ Flag LT_64( Word64 L64_var1, Word64 L64_var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].LT_64++;
#endif
return F_ret;
@@ -218,7 +218,7 @@ Flag GT_64( Word64 L64_var1, Word64 L64_var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].GT_64++;
#endif
return F_ret;
@@ -232,7 +232,7 @@ Flag LE_64( Word64 L64_var1, Word64 L64_var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].LE_64++;
#endif
return F_ret;
@@ -245,7 +245,7 @@ Flag GE_64( Word64 L64_var1, Word64 L64_var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].GE_64++;
#endif
return F_ret;
@@ -259,7 +259,7 @@ Flag EQ_64( Word64 L64_var1, Word64 L64_var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].EQ_64++;
#endif
return F_ret;
@@ -272,7 +272,7 @@ Flag NE_64( Word64 L64_var1, Word64 L64_var2 )
{
F_ret = 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].NE_64++;
#endif
return F_ret;
diff --git a/lib_com/control.h b/lib_com/control.h
index d6a9610ac2185bbbdcfc8b7f920e4657c09f2ab2..ad1e5ae6929c43918f6b9438232418ee31e1082b 100644
--- a/lib_com/control.h
+++ b/lib_com/control.h
@@ -41,7 +41,7 @@
* Constants and Globals
*
*****************************************************************************/
-#if ( WMOPS )
+#ifdef WMOPS
extern BASIC_OP multiCounter[MAXCOUNTERS];
extern int currCounter;
diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c
index a10ecac19110b777bf32ff0c5fe80d60d94b229c..4b16b0b53cb5a4a3a143a69e4b755399cd9c1993 100644
--- a/lib_com/core_com_config.c
+++ b/lib_com/core_com_config.c
@@ -85,7 +85,6 @@ Word16 is_EVS_bitrate(
{
return 0;
}
- BREAK;
}
*Opt_AMR_WB = 1;
@@ -289,238 +288,241 @@ Word16 getTcxonly(
}
break;
#endif
- return tcxonly;
+#ifdef IVAS_CODE_SWITCHING
}
+#endif
+ return tcxonly;
+}
- Word16 getTcxonly_fx(
- const Word16 element_mode, /* i : IVAS element mode */
- const Word32 total_brate, /* i : total bitrate */
- const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/
- const Word16 is_ism_format /* i : flag indicating ISM format */
- )
- {
- Word16 tcxonly;
- tcxonly = 0;
- move16();
+Word16 getTcxonly_fx(
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/
+ const Word16 is_ism_format /* i : flag indicating ISM format */
+)
+{
+ Word16 tcxonly;
+ tcxonly = 0;
+ move16();
- SWITCH( element_mode )
- {
- case EVS_MONO:
- if ( GT_32( total_brate, ACELP_32k ) )
+ SWITCH( element_mode )
+ {
+ case EVS_MONO:
+ if ( GT_32( total_brate, ACELP_32k ) )
+ {
+ tcxonly = 1;
+ move16();
+ }
+ BREAK;
+ case IVAS_SCE:
+ IF( is_ism_format )
+ {
+ if ( GT_32( total_brate, MAX_ACELP_BRATE_ISM ) )
{
tcxonly = 1;
move16();
}
- BREAK;
- case IVAS_SCE:
- IF( is_ism_format )
- {
- if ( GT_32( total_brate, MAX_ACELP_BRATE_ISM ) )
- {
- tcxonly = 1;
- move16();
- }
- }
- ELSE
- {
- if ( GT_32( total_brate, MAX_ACELP_BRATE ) )
- {
- tcxonly = 1;
- move16();
- }
- }
- BREAK;
-
- case IVAS_CPE_DFT:
- case IVAS_CPE_TD:
+ }
+ ELSE
+ {
if ( GT_32( total_brate, MAX_ACELP_BRATE ) )
{
tcxonly = 1;
move16();
}
- BREAK;
- case IVAS_CPE_MDCT:
- IF( MCT_flag )
- {
+ }
+ BREAK;
+
+ case IVAS_CPE_DFT:
+ case IVAS_CPE_TD:
+ if ( GT_32( total_brate, MAX_ACELP_BRATE ) )
+ {
+ tcxonly = 1;
+ move16();
+ }
+ BREAK;
+ case IVAS_CPE_MDCT:
+ IF( MCT_flag )
+ {
- if ( GE_32( total_brate, IVAS_32k ) )
- {
- tcxonly = 1;
- move16();
- }
+ if ( GE_32( total_brate, IVAS_32k ) )
+ {
+ tcxonly = 1;
+ move16();
}
- ELSE
+ }
+ ELSE
+ {
+ if ( GE_32( total_brate, IVAS_48k ) )
{
- if ( GE_32( total_brate, IVAS_48k ) )
- {
- tcxonly = 1;
- move16();
- }
+ tcxonly = 1;
+ move16();
}
- BREAK;
- }
-
- return tcxonly;
+ }
+ BREAK;
}
- /*-------------------------------------------------------------------*
- * getCtxHm()
- *
- *
- *-------------------------------------------------------------------*/
-
- Word16 getCtxHm(
- const Word16 element_mode, /* i : IVAS element mode */
- const Word32 total_brate, /* i : total bitrate */
- const Word16 rf_flag /* i : flag to signal the RF mode */
- )
- {
- Word16 ctx_hm;
-
- ctx_hm = 0;
- move16();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- if ( ( ( LE_16( element_mode, IVAS_SCE ) && GT_32( total_brate, LPC_SHAPED_ARI_MAX_RATE ) ) || ( GT_16( element_mode, IVAS_SCE ) && GT_32( total_brate, LPC_SHAPED_ARI_MAX_RATE_CPE ) ) ) && !rf_flag && ( ( LE_32( total_brate, IVAS_64k ) && NE_16( element_mode, IVAS_CPE_DFT ) ) || ( LT_32( total_brate, 24400 ) && EQ_16( element_mode, IVAS_CPE_DFT ) ) ) && NE_16( element_mode, IVAS_CPE_MDCT ) )
- {
- ctx_hm = 1;
- move16();
- }
+ return tcxonly;
+}
- return ctx_hm;
- }
+/*-------------------------------------------------------------------*
+ * getCtxHm()
+ *
+ *
+ *-------------------------------------------------------------------*/
- /*-------------------------------------------------------------------*
- * getResq()
- *
- *
- *-------------------------------------------------------------------*/
+Word16 getCtxHm(
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 rf_flag /* i : flag to signal the RF mode */
+)
+{
+ Word16 ctx_hm;
- Word16 getResq(
- const Word32 total_brate /* i : total bitrate */
- )
+ ctx_hm = 0;
+ move16();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ if ( ( ( LE_16( element_mode, IVAS_SCE ) && GT_32( total_brate, LPC_SHAPED_ARI_MAX_RATE ) ) || ( GT_16( element_mode, IVAS_SCE ) && GT_32( total_brate, LPC_SHAPED_ARI_MAX_RATE_CPE ) ) ) && !rf_flag && ( ( LE_32( total_brate, IVAS_64k ) && NE_16( element_mode, IVAS_CPE_DFT ) ) || ( LT_32( total_brate, 24400 ) && EQ_16( element_mode, IVAS_CPE_DFT ) ) ) && NE_16( element_mode, IVAS_CPE_MDCT ) )
{
- Word16 resq;
-
- resq = 0;
+ ctx_hm = 1;
move16();
- if ( LE_32( total_brate, IVAS_64k ) )
- {
- resq = 1;
- move16();
- }
-
- return resq;
}
- /*-------------------------------------------------------------------*
- * getTnsAllowed()
- *
- *
- *-------------------------------------------------------------------*/
+ return ctx_hm;
+}
- Word16 getTnsAllowed(
- const Word32 total_brate, /* i : total bitrate */
- const Word16 igf, /* i : flag indicating IGF activity*/
- const Word16 element_mode /* i : IVAS element mode */
- )
- {
- Word16 tnsAllowed;
+/*-------------------------------------------------------------------*
+ * getResq()
+ *
+ *
+ *-------------------------------------------------------------------*/
- tnsAllowed = 0;
- move16();
- IF( igf != 0 )
- {
- test();
- test();
- if ( GT_32( total_brate, HQ_16k40 ) || ( GT_32( total_brate, HQ_13k20 ) && EQ_16( element_mode, IVAS_CPE_DFT ) ) )
- {
- tnsAllowed = 1;
- move16();
- }
- }
- ELSE
- {
- if ( GT_32( total_brate, HQ_32k ) )
- {
- tnsAllowed = 1;
- move16();
- }
- }
+Word16 getResq(
+ const Word32 total_brate /* i : total bitrate */
+)
+{
+ Word16 resq;
- return tnsAllowed;
+ resq = 0;
+ move16();
+ if ( LE_32( total_brate, IVAS_64k ) )
+ {
+ resq = 1;
+ move16();
}
- /*-------------------------------------------------------------------*
- * getRestrictedMode()
- *
- *
- *-------------------------------------------------------------------*/
+ return resq;
+}
- Word16 getRestrictedMode(
- const Word16 element_mode, /* i : IVAS element mode */
- const Word32 total_brate, /* i : total bitrate */
- const Word16 Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */
- )
- {
- Word16 restrictedMode;
- restrictedMode = 3;
- move16();
+/*-------------------------------------------------------------------*
+ * getTnsAllowed()
+ *
+ *
+ *-------------------------------------------------------------------*/
+Word16 getTnsAllowed(
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 igf, /* i : flag indicating IGF activity*/
+ const Word16 element_mode /* i : IVAS element mode */
+)
+{
+ Word16 tnsAllowed;
+
+ tnsAllowed = 0;
+ move16();
+ IF( igf != 0 )
+ {
test();
test();
- test();
- test();
- IF( !Opt_AMR_WB && ( GT_32( total_brate, HQ_32k ) && NE_16( element_mode, IVAS_SCE ) ) )
- {
- restrictedMode = 6;
- move16();
- }
- ELSE IF( !Opt_AMR_WB && ( GT_32( total_brate, HQ_48k ) && EQ_16( element_mode, IVAS_SCE ) ) )
+ if ( GT_32( total_brate, HQ_16k40 ) || ( GT_32( total_brate, HQ_13k20 ) && EQ_16( element_mode, IVAS_CPE_DFT ) ) )
{
- restrictedMode = 6;
+ tnsAllowed = 1;
move16();
}
- ELSE IF( Opt_AMR_WB )
+ }
+ ELSE
+ {
+ if ( GT_32( total_brate, HQ_32k ) )
{
- restrictedMode = 1;
+ tnsAllowed = 1;
move16();
}
-
- return restrictedMode;
}
- /*-------------------------------------------------------------------*
- * getMdctWindowLength()
- *
- *
- *-------------------------------------------------------------------*/
+ return tnsAllowed;
+}
- int16_t getMdctWindowLength(
- const int16_t fscale )
- {
- int16_t mdctWindowLength;
+/*-------------------------------------------------------------------*
+ * getRestrictedMode()
+ *
+ *
+ *-------------------------------------------------------------------*/
- mdctWindowLength = ( L_LOOK_12k8 * fscale ) / FSCALE_DENOM;
+Word16 getRestrictedMode(
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */
+)
+{
+ Word16 restrictedMode;
+ restrictedMode = 3;
+ move16();
- return mdctWindowLength;
+ test();
+ test();
+ test();
+ test();
+ IF( !Opt_AMR_WB && ( GT_32( total_brate, HQ_32k ) && NE_16( element_mode, IVAS_SCE ) ) )
+ {
+ restrictedMode = 6;
+ move16();
}
-#ifdef IVAS_FLOAT_FIXED
- Word16 getMdctWindowLength_fx(
- const Word16 fscale )
+ ELSE IF( !Opt_AMR_WB && ( GT_32( total_brate, HQ_48k ) && EQ_16( element_mode, IVAS_SCE ) ) )
{
- Word16 mdctWindowLength;
- mdctWindowLength = extract_l( L_shr( L_mult0( L_LOOK_12k8, fscale ), LD_FSCALE_DENOM ) );
-
- return mdctWindowLength;
+ restrictedMode = 6;
+ move16();
+ }
+ ELSE IF( Opt_AMR_WB )
+ {
+ restrictedMode = 1;
+ move16();
}
+
+ return restrictedMode;
+}
+
+/*-------------------------------------------------------------------*
+ * getMdctWindowLength()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+int16_t getMdctWindowLength(
+ const int16_t fscale )
+{
+ int16_t mdctWindowLength;
+
+ mdctWindowLength = ( L_LOOK_12k8 * fscale ) / FSCALE_DENOM;
+
+ return mdctWindowLength;
+}
+#ifdef IVAS_FLOAT_FIXED
+Word16 getMdctWindowLength_fx(
+ const Word16 fscale )
+{
+ Word16 mdctWindowLength;
+ mdctWindowLength = extract_l( L_shr( L_mult0( L_LOOK_12k8, fscale ), LD_FSCALE_DENOM ) );
+
+ return mdctWindowLength;
+}
#endif // IVAS_FLOAT_FIXED
/*-------------------------------------------------------------------*
@@ -529,1140 +531,1140 @@ Word16 getTcxonly(
*
*-------------------------------------------------------------------*/
#ifdef IVAS_FLOAT_FIXED
- Word16 sr2fscale_fx(
- const Word32 sr_core /* i : internal sampling rate */
- )
- {
- return extract_l( Mpy_32_16_1( sr_core, FSCALE_DENOM_BY_12800_Q15 ) );
- }
+Word16 sr2fscale_fx(
+ const Word32 sr_core /* i : internal sampling rate */
+)
+{
+ return extract_l( Mpy_32_16_1( sr_core, FSCALE_DENOM_BY_12800_Q15 ) );
+}
#endif
- int16_t sr2fscale(
- const int32_t sr_core /* i : internal sampling rate */
- )
- {
+int16_t sr2fscale(
+ const int32_t sr_core /* i : internal sampling rate */
+)
+{
- return (int16_t) ( ( FSCALE_DENOM * sr_core ) / 12800 );
- }
+ return (int16_t) ( ( FSCALE_DENOM * sr_core ) / 12800 );
+}
- /*-------------------------------------------------------------------*
- * getCoreSamplerateMode2_flt()
- *
- *
- *-------------------------------------------------------------------*/
+/*-------------------------------------------------------------------*
+ * getCoreSamplerateMode2_flt()
+ *
+ *
+ *-------------------------------------------------------------------*/
- int32_t getCoreSamplerateMode2_flt(
- const int16_t element_mode, /* i : IVAS element mode */
- const int32_t total_brate, /* i : total bitrate */
- const int16_t bwidth, /* i : audio bandwidth */
- const int16_t flag_ACELP16k, /* i : ACELP@16kHz flag */
- const int16_t rf_mode, /* i : flag to signal the RF mode */
- const IVAS_FORMAT is_ism_format /* i : flag indicating ISM format */
- )
+int32_t getCoreSamplerateMode2_flt(
+ const int16_t element_mode, /* i : IVAS element mode */
+ const int32_t total_brate, /* i : total bitrate */
+ const int16_t bwidth, /* i : audio bandwidth */
+ const int16_t flag_ACELP16k, /* i : ACELP@16kHz flag */
+ const int16_t rf_mode, /* i : flag to signal the RF mode */
+ const IVAS_FORMAT is_ism_format /* i : flag indicating ISM format */
+)
+{
+ int32_t sr_core = 0;
+
+ if ( bwidth == NB )
+ {
+ sr_core = INT_FS_12k8;
+ }
+ else if ( element_mode == EVS_MONO && ( ( bwidth == WB && total_brate < ACELP_13k20 ) || ( bwidth == SWB && total_brate <= ACELP_13k20 ) || ( rf_mode == 1 ) ) )
+ {
+ sr_core = INT_FS_12k8;
+ }
+ else if ( element_mode > EVS_MONO && flag_ACELP16k == 0 )
+ {
+ sr_core = INT_FS_12k8;
+ }
+ else if ( bwidth == WB || ( bwidth == SWB && total_brate <= ACELP_32k ) || ( bwidth == FB && total_brate <= ACELP_32k ) )
+ {
+ sr_core = INT_FS_16k;
+ }
+ else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && !is_ism_format )
+ {
+ sr_core = INT_FS_16k;
+ }
+ else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE_ISM && element_mode == IVAS_SCE && is_ism_format )
+ {
+ sr_core = INT_FS_16k;
+ }
+ else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && is_ism_format )
+ {
+ sr_core = 25600;
+ }
+ else if ( ( ( bwidth == SWB || bwidth == FB ) && element_mode == EVS_MONO && total_brate <= HQ_64k ) || ( element_mode > IVAS_SCE && ( ( bwidth == SWB && total_brate <= IVAS_96k ) || ( bwidth == FB && total_brate <= IVAS_96k ) ) ) )
+ {
+ sr_core = 25600;
+ }
+ else if ( bwidth == SWB || bwidth == FB )
{
- int32_t sr_core = 0;
+ sr_core = 32000;
+ }
- if ( bwidth == NB )
- {
- sr_core = INT_FS_12k8;
- }
- else if ( element_mode == EVS_MONO && ( ( bwidth == WB && total_brate < ACELP_13k20 ) || ( bwidth == SWB && total_brate <= ACELP_13k20 ) || ( rf_mode == 1 ) ) )
- {
- sr_core = INT_FS_12k8;
- }
- else if ( element_mode > EVS_MONO && flag_ACELP16k == 0 )
- {
- sr_core = INT_FS_12k8;
- }
- else if ( bwidth == WB || ( bwidth == SWB && total_brate <= ACELP_32k ) || ( bwidth == FB && total_brate <= ACELP_32k ) )
- {
- sr_core = INT_FS_16k;
- }
- else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && !is_ism_format )
- {
- sr_core = INT_FS_16k;
- }
- else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE_ISM && element_mode == IVAS_SCE && is_ism_format )
- {
- sr_core = INT_FS_16k;
- }
- else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && is_ism_format )
- {
- sr_core = 25600;
- }
- else if ( ( ( bwidth == SWB || bwidth == FB ) && element_mode == EVS_MONO && total_brate <= HQ_64k ) || ( element_mode > IVAS_SCE && ( ( bwidth == SWB && total_brate <= IVAS_96k ) || ( bwidth == FB && total_brate <= IVAS_96k ) ) ) )
- {
- sr_core = 25600;
- }
- else if ( bwidth == SWB || bwidth == FB )
- {
- sr_core = 32000;
- }
+ return sr_core;
+}
- return sr_core;
- }
+Word32 getCoreSamplerateMode2(
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */
+ const Word16 rf_mode, /* i : flag to signal the RF mode */
+ const IVAS_FORMAT is_ism_format /* i : flag indicating ISM format */
+)
+{
- Word32 getCoreSamplerateMode2(
- const Word16 element_mode, /* i : IVAS element mode */
- const Word32 total_brate, /* i : total bitrate */
- const Word16 bwidth, /* i : audio bandwidth */
- const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */
- const Word16 rf_mode, /* i : flag to signal the RF mode */
- const IVAS_FORMAT is_ism_format /* i : flag indicating ISM format */
- )
+ Word32 sr_core;
+ Word16 bwd_swb_or_fb_flag;
+ sr_core = -1; /* to suppress MSVC warning */
+ move32();
+
+ bwd_swb_or_fb_flag = s_or( (Word16) EQ_16( bwidth, SWB ), (Word16) EQ_16( bwidth, FB ) );
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ IF( bwidth == NB )
{
-
- Word32 sr_core;
- Word16 bwd_swb_or_fb_flag;
- sr_core = -1; /* to suppress MSVC warning */
+ sr_core = INT_FS_12k8;
move32();
-
- bwd_swb_or_fb_flag = s_or( (Word16) EQ_16( bwidth, SWB ), (Word16) EQ_16( bwidth, FB ) );
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- IF( bwidth == NB )
- {
- sr_core = INT_FS_12k8;
- move32();
- }
- ELSE IF( element_mode == EVS_MONO && ( L_and( EQ_32( bwidth, WB ), LT_32( total_brate, ACELP_13k20 ) ) ||
- L_and( EQ_32( bwidth, SWB ), LE_32( total_brate, ACELP_13k20 ) ) || EQ_16( rf_mode, 1 ) ) )
- {
- sr_core = INT_FS_12k8;
- move32();
- }
- ELSE IF( element_mode > EVS_MONO && flag_ACELP16k == 0 )
- {
- sr_core = INT_FS_12k8;
- move32();
- }
- ELSE IF( EQ_32( bwidth, WB ) || ( ( LE_32( total_brate, ACELP_32k ) ) && ( ( EQ_32( bwidth, SWB ) ) || ( EQ_32( bwidth, FB ) ) ) ) )
- {
- sr_core = INT_FS_16k;
- move32();
- }
- ELSE IF( bwd_swb_or_fb_flag && LE_32( total_brate, MAX_ACELP_BRATE ) && EQ_16( element_mode, IVAS_SCE ) && !is_ism_format )
- {
- sr_core = INT_FS_16k;
- move32();
- }
- ELSE IF( bwd_swb_or_fb_flag && LE_32( total_brate, MAX_ACELP_BRATE_ISM ) && EQ_16( element_mode, IVAS_SCE ) && is_ism_format )
- {
- sr_core = INT_FS_16k;
- move32();
- }
- ELSE IF( bwd_swb_or_fb_flag && LE_32( total_brate, MAX_ACELP_BRATE ) && EQ_16( element_mode, IVAS_SCE ) && is_ism_format )
- {
- sr_core = 25600;
- move32();
- }
- ELSE IF( ( element_mode == EVS_MONO && ( bwd_swb_or_fb_flag && LE_32( total_brate, HQ_64k ) ) ) || ( GT_16( element_mode, IVAS_SCE ) && ( ( EQ_16( bwidth, SWB ) && LE_32( total_brate, IVAS_96k ) ) || ( EQ_16( bwidth, FB ) && LE_32( total_brate, IVAS_96k ) ) ) ) )
- {
- sr_core = 25600;
- move32();
- }
- ELSE IF( bwd_swb_or_fb_flag )
- {
- sr_core = 32000;
- move32();
- }
- ELSE
- {
- assert( 0 );
- }
-
- return sr_core;
}
-
- Word16 getTcxBandwidth(
- const Word16 bwidth /* i : audio bandwidth */
- )
+ ELSE IF( element_mode == EVS_MONO && ( L_and( EQ_32( bwidth, WB ), LT_32( total_brate, ACELP_13k20 ) ) ||
+ L_and( EQ_32( bwidth, SWB ), LE_32( total_brate, ACELP_13k20 ) ) || EQ_16( rf_mode, 1 ) ) )
+ {
+ sr_core = INT_FS_12k8;
+ move32();
+ }
+ ELSE IF( element_mode > EVS_MONO && flag_ACELP16k == 0 )
{
+ sr_core = INT_FS_12k8;
+ move32();
+ }
+ ELSE IF( EQ_32( bwidth, WB ) || ( ( LE_32( total_brate, ACELP_32k ) ) && ( ( EQ_32( bwidth, SWB ) ) || ( EQ_32( bwidth, FB ) ) ) ) )
+ {
+ sr_core = INT_FS_16k;
+ move32();
+ }
+ ELSE IF( bwd_swb_or_fb_flag && LE_32( total_brate, MAX_ACELP_BRATE ) && EQ_16( element_mode, IVAS_SCE ) && !is_ism_format )
+ {
+ sr_core = INT_FS_16k;
+ move32();
+ }
+ ELSE IF( bwd_swb_or_fb_flag && LE_32( total_brate, MAX_ACELP_BRATE_ISM ) && EQ_16( element_mode, IVAS_SCE ) && is_ism_format )
+ {
+ sr_core = INT_FS_16k;
+ move32();
+ }
+ ELSE IF( bwd_swb_or_fb_flag && LE_32( total_brate, MAX_ACELP_BRATE ) && EQ_16( element_mode, IVAS_SCE ) && is_ism_format )
+ {
+ sr_core = 25600;
+ move32();
+ }
+ ELSE IF( ( element_mode == EVS_MONO && ( bwd_swb_or_fb_flag && LE_32( total_brate, HQ_64k ) ) ) || ( GT_16( element_mode, IVAS_SCE ) && ( ( EQ_16( bwidth, SWB ) && LE_32( total_brate, IVAS_96k ) ) || ( EQ_16( bwidth, FB ) && LE_32( total_brate, IVAS_96k ) ) ) ) )
+ {
+ sr_core = 25600;
+ move32();
+ }
+ ELSE IF( bwd_swb_or_fb_flag )
+ {
+ sr_core = 32000;
+ move32();
+ }
+ ELSE
+ {
+ assert( 0 );
+ }
- Word16 tcxBandwidth;
+ return sr_core;
+}
- tcxBandwidth = 16384 /*0.5f Q15*/;
- move16();
- if ( bwidth == NB )
- {
- tcxBandwidth = 10240 /*0.3125f Q15*/;
- move16();
- }
+Word16 getTcxBandwidth(
+ const Word16 bwidth /* i : audio bandwidth */
+)
+{
+
+ Word16 tcxBandwidth;
- return tcxBandwidth;
+ tcxBandwidth = 16384 /*0.5f Q15*/;
+ move16();
+ if ( bwidth == NB )
+ {
+ tcxBandwidth = 10240 /*0.3125f Q15*/;
+ move16();
}
- /*-------------------------------------------------------------------*
- * getTcxBandwidth_flt()
- *
- *
- *-------------------------------------------------------------------*/
+ return tcxBandwidth;
+}
- float getTcxBandwidth_flt(
- const int16_t bwidth /* i : audio bandwidth */
- )
- {
- float tcxBandwidth = 0.5f;
+/*-------------------------------------------------------------------*
+ * getTcxBandwidth_flt()
+ *
+ *
+ *-------------------------------------------------------------------*/
- if ( bwidth == NB )
- {
- tcxBandwidth = 0.3125f;
- }
+float getTcxBandwidth_flt(
+ const int16_t bwidth /* i : audio bandwidth */
+)
+{
+ float tcxBandwidth = 0.5f;
- return tcxBandwidth;
+ if ( bwidth == NB )
+ {
+ tcxBandwidth = 0.3125f;
}
- /*-------------------------------------------------------------------*
- * getIgfPresent()
- *
- *
- *-------------------------------------------------------------------*/
+ return tcxBandwidth;
+}
- int16_t getIgfPresent(
- const int16_t element_mode, /* i : IVAS element mode */
- const int32_t total_brate, /* i : total bitrate */
- const int16_t bwidth, /* i : audio bandwidth */
- const int16_t rf_mode /* i : flag to signal the RF mode */
- )
- {
- int16_t igfPresent = 0;
+/*-------------------------------------------------------------------*
+ * getIgfPresent()
+ *
+ *
+ *-------------------------------------------------------------------*/
+int16_t getIgfPresent(
+ const int16_t element_mode, /* i : IVAS element mode */
+ const int32_t total_brate, /* i : total bitrate */
+ const int16_t bwidth, /* i : audio bandwidth */
+ const int16_t rf_mode /* i : flag to signal the RF mode */
+)
+{
+ int16_t igfPresent = 0;
- if ( bwidth == SWB )
- {
- switch ( element_mode )
- {
- case EVS_MONO:
- case IVAS_SCE:
- if ( total_brate <= HQ_64k )
- {
- igfPresent = 1;
- }
- break;
- case IVAS_CPE_DFT:
- case IVAS_CPE_TD:
- if ( total_brate <= HQ_48k )
- {
- igfPresent = 1;
- }
- break;
- case IVAS_CPE_MDCT:
- if ( total_brate <= IVAS_96k )
- {
- igfPresent = 1;
- }
- break;
- }
- }
- else if ( bwidth == FB )
+
+ if ( bwidth == SWB )
+ {
+ switch ( element_mode )
{
- switch ( element_mode )
- {
- case EVS_MONO:
- case IVAS_SCE:
- if ( total_brate <= IVAS_128k )
- {
- igfPresent = 1;
- }
- break;
- case IVAS_CPE_DFT:
- case IVAS_CPE_TD:
- if ( total_brate <= IVAS_48k )
- {
- igfPresent = 1;
- }
- break;
- case IVAS_CPE_MDCT:
- if ( total_brate <= IVAS_128k )
- {
- igfPresent = 1;
- }
- break;
- }
+ case EVS_MONO:
+ case IVAS_SCE:
+ if ( total_brate <= HQ_64k )
+ {
+ igfPresent = 1;
+ }
+ break;
+ case IVAS_CPE_DFT:
+ case IVAS_CPE_TD:
+ if ( total_brate <= HQ_48k )
+ {
+ igfPresent = 1;
+ }
+ break;
+ case IVAS_CPE_MDCT:
+ if ( total_brate <= IVAS_96k )
+ {
+ igfPresent = 1;
+ }
+ break;
}
- else if ( bwidth == WB )
+ }
+ else if ( bwidth == FB )
+ {
+ switch ( element_mode )
{
- switch ( element_mode )
- {
- case EVS_MONO:
- case IVAS_SCE:
- if ( total_brate <= ACELP_9k60 )
- {
- igfPresent = 1;
- }
- break;
- case IVAS_CPE_DFT:
- case IVAS_CPE_TD:
- case IVAS_CPE_MDCT:
- if ( total_brate <= ACELP_13k20 )
- {
- igfPresent = 1;
- }
- break;
- }
+ case EVS_MONO:
+ case IVAS_SCE:
+ if ( total_brate <= IVAS_128k )
+ {
+ igfPresent = 1;
+ }
+ break;
+ case IVAS_CPE_DFT:
+ case IVAS_CPE_TD:
+ if ( total_brate <= IVAS_48k )
+ {
+ igfPresent = 1;
+ }
+ break;
+ case IVAS_CPE_MDCT:
+ if ( total_brate <= IVAS_128k )
+ {
+ igfPresent = 1;
+ }
+ break;
}
-
- if ( ( ( bwidth == WB ) || ( bwidth == SWB ) ) && ( rf_mode == 1 ) && ( total_brate == ACELP_13k20 ) )
+ }
+ else if ( bwidth == WB )
+ {
+ switch ( element_mode )
{
- igfPresent = 1;
+ case EVS_MONO:
+ case IVAS_SCE:
+ if ( total_brate <= ACELP_9k60 )
+ {
+ igfPresent = 1;
+ }
+ break;
+ case IVAS_CPE_DFT:
+ case IVAS_CPE_TD:
+ case IVAS_CPE_MDCT:
+ if ( total_brate <= ACELP_13k20 )
+ {
+ igfPresent = 1;
+ }
+ break;
}
-
- return igfPresent;
}
- Word16 getIgfPresent_fx(
- const Word16 element_mode, /* i : IVAS element mode */
- const Word32 total_brate, /* i : total bitrate */
- const Word16 bwidth, /* i : audio bandwidth */
- const Word16 rf_mode /* i : flag to signal the RF mode */
- )
+ if ( ( ( bwidth == WB ) || ( bwidth == SWB ) ) && ( rf_mode == 1 ) && ( total_brate == ACELP_13k20 ) )
{
- Word16 igfPresent;
- igfPresent = 0;
- move16();
+ igfPresent = 1;
+ }
- IF( EQ_16( bwidth, SWB ) )
- {
- SWITCH( element_mode )
- {
- case EVS_MONO:
- case IVAS_SCE:
- if ( LE_32( total_brate, HQ_64k ) )
- {
- igfPresent = 1;
- move16();
- }
- BREAK;
- case IVAS_CPE_DFT:
- case IVAS_CPE_TD:
- if ( LE_32( total_brate, HQ_48k ) )
- {
- igfPresent = 1;
- move16();
- }
- BREAK;
- case IVAS_CPE_MDCT:
- if ( LE_32( total_brate, IVAS_96k ) )
- {
- igfPresent = 1;
- move16();
- }
- BREAK;
- }
- }
- ELSE IF( EQ_16( bwidth, FB ) )
+ return igfPresent;
+}
+
+Word16 getIgfPresent_fx(
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 rf_mode /* i : flag to signal the RF mode */
+)
+{
+ Word16 igfPresent;
+ igfPresent = 0;
+ move16();
+
+ IF( EQ_16( bwidth, SWB ) )
+ {
+ SWITCH( element_mode )
{
- SWITCH( element_mode )
- {
- case EVS_MONO:
- case IVAS_SCE:
- if ( LE_32( total_brate, IVAS_128k ) )
- {
- igfPresent = 1;
- move16();
- }
- BREAK;
- case IVAS_CPE_DFT:
- case IVAS_CPE_TD:
- if ( LE_32( total_brate, IVAS_48k ) )
- {
- igfPresent = 1;
- move16();
- }
- BREAK;
- case IVAS_CPE_MDCT:
- if ( LE_32( total_brate, IVAS_128k ) )
- {
- igfPresent = 1;
- move16();
- }
- BREAK;
- }
+ case EVS_MONO:
+ case IVAS_SCE:
+ if ( LE_32( total_brate, HQ_64k ) )
+ {
+ igfPresent = 1;
+ move16();
+ }
+ BREAK;
+ case IVAS_CPE_DFT:
+ case IVAS_CPE_TD:
+ if ( LE_32( total_brate, HQ_48k ) )
+ {
+ igfPresent = 1;
+ move16();
+ }
+ BREAK;
+ case IVAS_CPE_MDCT:
+ if ( LE_32( total_brate, IVAS_96k ) )
+ {
+ igfPresent = 1;
+ move16();
+ }
+ BREAK;
}
- ELSE IF( EQ_16( bwidth, WB ) )
+ }
+ ELSE IF( EQ_16( bwidth, FB ) )
+ {
+ SWITCH( element_mode )
{
- SWITCH( element_mode )
- {
- case EVS_MONO:
- case IVAS_SCE:
- if ( LE_32( total_brate, ACELP_9k60 ) )
- {
- igfPresent = 1;
- move16();
- }
- BREAK;
- case IVAS_CPE_DFT:
- case IVAS_CPE_TD:
- case IVAS_CPE_MDCT:
- if ( LE_32( total_brate, ACELP_13k20 ) )
- {
- igfPresent = 1;
- move16();
- }
- BREAK;
- }
+ case EVS_MONO:
+ case IVAS_SCE:
+ if ( LE_32( total_brate, IVAS_128k ) )
+ {
+ igfPresent = 1;
+ move16();
+ }
+ BREAK;
+ case IVAS_CPE_DFT:
+ case IVAS_CPE_TD:
+ if ( LE_32( total_brate, IVAS_48k ) )
+ {
+ igfPresent = 1;
+ move16();
+ }
+ BREAK;
+ case IVAS_CPE_MDCT:
+ if ( LE_32( total_brate, IVAS_128k ) )
+ {
+ igfPresent = 1;
+ move16();
+ }
+ BREAK;
}
- test();
- test();
- test();
- if ( ( ( EQ_16( bwidth, WB ) ) || ( EQ_16( bwidth, SWB ) ) ) && ( EQ_16( rf_mode, 1 ) ) && ( EQ_32( total_brate, ACELP_13k20 ) ) )
+ }
+ ELSE IF( EQ_16( bwidth, WB ) )
+ {
+ SWITCH( element_mode )
{
- igfPresent = 1;
- move16();
+ case EVS_MONO:
+ case IVAS_SCE:
+ if ( LE_32( total_brate, ACELP_9k60 ) )
+ {
+ igfPresent = 1;
+ move16();
+ }
+ BREAK;
+ case IVAS_CPE_DFT:
+ case IVAS_CPE_TD:
+ case IVAS_CPE_MDCT:
+ if ( LE_32( total_brate, ACELP_13k20 ) )
+ {
+ igfPresent = 1;
+ move16();
+ }
+ BREAK;
}
-
- return igfPresent;
}
- /*-------------------------------------------------------------------*
- * getCnaPresent()
- *
- *
- *-------------------------------------------------------------------*/
-
- int16_t getCnaPresent(
- const int16_t element_mode, /* i : element mode */
- const int32_t element_brate, /* i : element bitrate */
- const int32_t total_brate, /* i : total bitrate */
- const int16_t bwidth /* i : audio bandwidth */
- )
+ test();
+ test();
+ test();
+ if ( ( ( EQ_16( bwidth, WB ) ) || ( EQ_16( bwidth, SWB ) ) ) && ( EQ_16( rf_mode, 1 ) ) && ( EQ_32( total_brate, ACELP_13k20 ) ) )
{
- int16_t flag_cna = 0;
+ igfPresent = 1;
+ move16();
+ }
+
+ return igfPresent;
+}
+/*-------------------------------------------------------------------*
+ * getCnaPresent()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+int16_t getCnaPresent(
+ const int16_t element_mode, /* i : element mode */
+ const int32_t element_brate, /* i : element bitrate */
+ const int32_t total_brate, /* i : total bitrate */
+ const int16_t bwidth /* i : audio bandwidth */
+)
+{
+ int16_t flag_cna = 0;
- if ( element_mode == IVAS_CPE_DFT && element_brate <= CNA_MAX_BRATE_DFT_STEREO )
+ if ( element_mode == IVAS_CPE_DFT && element_brate <= CNA_MAX_BRATE_DFT_STEREO )
+ {
+ flag_cna = 1;
+ }
+ else
+ {
+ if ( bwidth == NB && total_brate <= ACELP_13k20 )
{
flag_cna = 1;
}
- else
- {
- if ( bwidth == NB && total_brate <= ACELP_13k20 )
- {
- flag_cna = 1;
- }
-
- if ( bwidth == WB && total_brate <= ACELP_13k20 )
- {
- flag_cna = 1;
- }
- if ( bwidth == SWB && total_brate <= ACELP_13k20 )
- {
- flag_cna = 1;
- }
+ if ( bwidth == WB && total_brate <= ACELP_13k20 )
+ {
+ flag_cna = 1;
}
- return flag_cna;
+ if ( bwidth == SWB && total_brate <= ACELP_13k20 )
+ {
+ flag_cna = 1;
+ }
}
- Word16 getCnaPresent_fx(
- const Word16 element_mode, /* i : element mode */
- const Word32 element_brate, /* i : element bitrate */
- const Word32 total_brate, /* i : total bitrate */
- const Word16 bwidth /* i : audio bandwidth */
- )
+ return flag_cna;
+}
+
+Word16 getCnaPresent_fx(
+ const Word16 element_mode, /* i : element mode */
+ const Word32 element_brate, /* i : element bitrate */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 bwidth /* i : audio bandwidth */
+)
+{
+ Word16 flag_cna;
+ flag_cna = 0;
+ move16();
+
+ test();
+ IF( EQ_16( element_mode, IVAS_CPE_DFT ) && LE_32( element_brate, CNA_MAX_BRATE_DFT_STEREO ) )
{
- Word16 flag_cna;
- flag_cna = 0;
+ flag_cna = 1;
move16();
-
+ }
+ ELSE
+ {
test();
- IF( EQ_16( element_mode, IVAS_CPE_DFT ) && LE_32( element_brate, CNA_MAX_BRATE_DFT_STEREO ) )
+ if ( LE_16( bwidth, SWB ) && ( LE_32( total_brate, ACELP_13k20 ) ) )
{
flag_cna = 1;
move16();
}
- ELSE
- {
- test();
- if ( LE_16( bwidth, SWB ) && ( LE_32( total_brate, ACELP_13k20 ) ) )
- {
- flag_cna = 1;
- move16();
- }
- }
-
- return flag_cna;
}
- /*-------------------------------------------------------------------*
- * getTcxLtp()
- *
- *
- *-------------------------------------------------------------------*/
- Word16 getTcxLtp(
- const Word32 sr_core /* i : internal sampling rate */
- )
- {
- Word16 tcxltp;
+ return flag_cna;
+}
+/*-------------------------------------------------------------------*
+ * getTcxLtp()
+ *
+ *
+ *-------------------------------------------------------------------*/
- tcxltp = 0;
- move16();
+Word16 getTcxLtp(
+ const Word32 sr_core /* i : internal sampling rate */
+)
+{
+ Word16 tcxltp;
- if ( ( LE_32( sr_core, 25600 ) ) )
- {
- tcxltp = 1;
- move16();
- }
+ tcxltp = 0;
+ move16();
- return tcxltp;
+ if ( ( LE_32( sr_core, 25600 ) ) )
+ {
+ tcxltp = 1;
+ move16();
}
- /*-------------------------------------------------------------------*
- * initPitchLagParameters()
- *
- *
- *-------------------------------------------------------------------*/
+ return tcxltp;
+}
+
+/*-------------------------------------------------------------------*
+ * initPitchLagParameters()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+Word16 initPitchLagParameters(
+ const Word32 sr_core,
+ Word16 *pit_min,
+ Word16 *pit_fr1,
+ Word16 *pit_fr1b,
+ Word16 *pit_fr2,
+ Word16 *pit_max )
+{
+ Word16 pit_res_max;
- Word16 initPitchLagParameters(
- const Word32 sr_core,
- Word16 *pit_min,
- Word16 *pit_fr1,
- Word16 *pit_fr1b,
- Word16 *pit_fr2,
- Word16 *pit_max )
+ IF( EQ_32( sr_core, INT_FS_12k8 ) )
+ {
+ *pit_min = PIT_MIN_12k8;
+ move16();
+ *pit_max = PIT_MAX_12k8;
+ move16();
+ *pit_fr2 = PIT_FR2_12k8;
+ move16();
+ *pit_fr1 = PIT_FR1_12k8;
+ move16();
+ *pit_fr1b = PIT_FR1_8b_12k8;
+ move16();
+ pit_res_max = 4;
+ move16();
+ }
+ ELSE IF( EQ_32( sr_core, INT_FS_16k ) )
+ {
+ *pit_min = PIT_MIN_16k;
+ move16();
+ *pit_max = PIT16k_MAX;
+ move16();
+ *pit_fr2 = PIT_FR2_16k;
+ move16();
+ *pit_fr1 = PIT_FR1_16k;
+ move16();
+ *pit_fr1b = PIT_FR1_8b_16k;
+ move16();
+ pit_res_max = 6;
+ move16();
+ }
+ ELSE IF( EQ_32( sr_core, 25600 ) )
+ {
+ *pit_min = PIT_MIN_25k6;
+ move16();
+ *pit_max = PIT_MAX_25k6;
+ move16();
+ *pit_fr2 = PIT_FR2_25k6;
+ move16();
+ *pit_fr1 = PIT_FR1_25k6;
+ move16();
+ *pit_fr1b = PIT_FR1_8b_25k6;
+ move16();
+ pit_res_max = 4;
+ move16();
+ }
+ ELSE /* sr_core==32000 */
{
- Word16 pit_res_max;
+ *pit_min = PIT_MIN_32k;
+ move16();
+ *pit_max = PIT_MAX_32k;
+ move16();
+ *pit_fr2 = PIT_FR2_32k;
+ move16();
+ *pit_fr1 = PIT_FR1_32k;
+ move16();
+ *pit_fr1b = PIT_FR1_8b_32k;
+ move16();
+ pit_res_max = 6;
+ move16();
+ }
- IF( EQ_32( sr_core, INT_FS_12k8 ) )
- {
- *pit_min = PIT_MIN_12k8;
- move16();
- *pit_max = PIT_MAX_12k8;
- move16();
- *pit_fr2 = PIT_FR2_12k8;
- move16();
- *pit_fr1 = PIT_FR1_12k8;
- move16();
- *pit_fr1b = PIT_FR1_8b_12k8;
- move16();
- pit_res_max = 4;
- move16();
- }
- ELSE IF( EQ_32( sr_core, INT_FS_16k ) )
- {
- *pit_min = PIT_MIN_16k;
- move16();
- *pit_max = PIT16k_MAX;
- move16();
- *pit_fr2 = PIT_FR2_16k;
- move16();
- *pit_fr1 = PIT_FR1_16k;
- move16();
- *pit_fr1b = PIT_FR1_8b_16k;
- move16();
- pit_res_max = 6;
- move16();
- }
- ELSE IF( EQ_32( sr_core, 25600 ) )
- {
- *pit_min = PIT_MIN_25k6;
- move16();
- *pit_max = PIT_MAX_25k6;
- move16();
- *pit_fr2 = PIT_FR2_25k6;
- move16();
- *pit_fr1 = PIT_FR1_25k6;
- move16();
- *pit_fr1b = PIT_FR1_8b_25k6;
- move16();
- pit_res_max = 4;
- move16();
- }
- ELSE /* sr_core==32000 */
- {
- *pit_min = PIT_MIN_32k;
- move16();
- *pit_max = PIT_MAX_32k;
+ return pit_res_max;
+}
+
+/*-------------------------------------------------------------------*
+ * getNumTcxCodedLines()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+Word16 getNumTcxCodedLines(
+ const Word16 bwidth /* i : audio bandwidth */
+)
+{
+ Word16 tcx_coded_lines;
+
+ tcx_coded_lines = 0;
+ move16();
+
+ SWITCH( bwidth )
+ {
+ case NB:
+ tcx_coded_lines = 160;
move16();
- *pit_fr2 = PIT_FR2_32k;
+ BREAK;
+ case WB:
+ tcx_coded_lines = 320;
move16();
- *pit_fr1 = PIT_FR1_32k;
+ BREAK;
+ case SWB:
+ tcx_coded_lines = 640;
move16();
- *pit_fr1b = PIT_FR1_8b_32k;
+ BREAK;
+ case FB:
+ tcx_coded_lines = 960;
move16();
- pit_res_max = 6;
+ BREAK;
+ default:
+ tcx_coded_lines = 0;
move16();
- }
+ BREAK;
+ }
+
+ return tcx_coded_lines;
+}
+
+/*-------------------------------------------------------------------*
+ * getTcxLpcShapedAri()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+Word16 getTcxLpcShapedAri(
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 rf_mode, /* i : flag to signal the RF mode */
+ const Word16 element_mode /* i : IVAS element mode */
+)
+{
+ Word16 tcx_lpc_shaped_ari;
+ tcx_lpc_shaped_ari = 0;
+ move16();
+
+ test();
+ test();
+ test();
+ test();
+ if ( ( ( LE_16( element_mode, IVAS_SCE ) && LE_32( total_brate, LPC_SHAPED_ARI_MAX_RATE ) ) || ( GT_16( element_mode, IVAS_SCE ) && LE_32( total_brate, LPC_SHAPED_ARI_MAX_RATE_CPE ) ) ) || rf_mode )
+ {
+ tcx_lpc_shaped_ari = 1;
+ move16();
+ }
+
+ return tcx_lpc_shaped_ari;
+}
+
+
+/*-----------------------------------------------------------------------*
+ * init_tcx_window_cfg()
+ *
+ * Initialization of TCX windows
+ *-----------------------------------------------------------------------*/
+
+void init_tcx_window_cfg(
+ TCX_CONFIG_HANDLE hTcxCfg, /* i/o: TCX Config handle */
+ const int32_t sr_core, /* i : SR core */
+ const int32_t input_Fs, /* i : input/output SR */
+ const int16_t L_frame, /* i : L_frame at sr_core */
+ const int16_t L_frameTCX, /* i : L_frame at i/o SR */
+ const int16_t encoderLookahead_enc, /* i : encoder LA at sr_core */
+ const int16_t encoderLookahead_FB, /* i : encoder LA at i/o SR */
+ const int16_t mdctWindowLength, /* i : window length at sr_core */
+ const int16_t mdctWindowLengthFB, /* i : window length at i/o SR */
+ const int16_t element_mode /* i : mode of CPE/SCE */
+)
+{
+ /* Symmetric window = sine LD window*/
+ hTcxCfg->tcx_mdct_window_delay = mdctWindowLength;
+ hTcxCfg->tcx_mdct_window_delayFB = mdctWindowLengthFB;
+ hTcxCfg->tcx_mdct_window_length = mdctWindowLength;
+ hTcxCfg->tcx_mdct_window_lengthFB = mdctWindowLengthFB;
+
+ mdct_window_sine_flt( hTcxCfg->tcx_mdct_window_flt, sr_core, hTcxCfg->tcx_mdct_window_length, FULL_OVERLAP, element_mode );
+ if ( hTcxCfg->tcx_mdct_window_length == hTcxCfg->tcx_mdct_window_lengthFB )
+ {
+ mvr2r( hTcxCfg->tcx_mdct_window_flt, hTcxCfg->tcx_mdct_windowFB_flt, hTcxCfg->tcx_mdct_window_length );
+ }
+ else
+ {
+ mdct_window_sine_flt( hTcxCfg->tcx_mdct_windowFB_flt, input_Fs, hTcxCfg->tcx_mdct_window_lengthFB, FULL_OVERLAP, element_mode );
+ }
+
+ /*ALDO windows for MODE2*/
+ mdct_window_aldo_flt( hTcxCfg->tcx_aldo_window_1_flt, hTcxCfg->tcx_aldo_window_2_flt, L_frame );
+ mdct_window_aldo_flt( hTcxCfg->tcx_aldo_window_1_FB_flt, hTcxCfg->tcx_aldo_window_2_FB_flt, NS2SA( input_Fs, FRAME_SIZE_NS ) );
+ hTcxCfg->tcx_aldo_window_1_trunc_flt = hTcxCfg->tcx_aldo_window_1_flt + NS2SA( sr_core, N_ZERO_MDCT_NS );
+ hTcxCfg->tcx_aldo_window_1_FB_trunc_flt = hTcxCfg->tcx_aldo_window_1_FB_flt + NS2SA( input_Fs, N_ZERO_MDCT_NS );
+
+ /*1.25ms transition window for ACELP->TCX*/
+ hTcxCfg->tcx_mdct_window_trans_length = NS2SA( sr_core, ACELP_TCX_TRANS_NS );
+ mdct_window_sine_flt( hTcxCfg->tcx_mdct_window_trans_flt, sr_core, hTcxCfg->tcx_mdct_window_trans_length, TRANSITION_OVERLAP, element_mode );
+ hTcxCfg->tcx_mdct_window_trans_lengthFB = NS2SA( input_Fs, ACELP_TCX_TRANS_NS );
+ if ( hTcxCfg->tcx_mdct_window_trans_length == hTcxCfg->tcx_mdct_window_trans_lengthFB )
+ {
+ mvr2r( hTcxCfg->tcx_mdct_window_trans_flt, hTcxCfg->tcx_mdct_window_transFB_flt, hTcxCfg->tcx_mdct_window_trans_length );
+ }
+ else
+ {
+ mdct_window_sine_flt( hTcxCfg->tcx_mdct_window_transFB_flt, input_Fs, hTcxCfg->tcx_mdct_window_trans_lengthFB, TRANSITION_OVERLAP, element_mode );
+ }
+
+ /*Mid-OLA*/
+ /*compute minimum length for "half" window: lookahead - 5ms. It must be also multiple of 2*/
+ hTcxCfg->tcx_mdct_window_half_length = 2 * ( ( encoderLookahead_enc - (int16_t) ( 0.005f * sr_core + 0.5f ) ) >> 1 );
+ hTcxCfg->tcx_mdct_window_half_lengthFB = 2 * ( ( encoderLookahead_FB - (int16_t) ( 0.005f * input_Fs + 0.5f ) ) >> 1 );
+ assert( ( hTcxCfg->tcx_mdct_window_half_length > 16 ) && "Half window can not be large enough!" );
+
+ mdct_window_sine_flt( hTcxCfg->tcx_mdct_window_half_flt, sr_core, hTcxCfg->tcx_mdct_window_half_length, HALF_OVERLAP, element_mode );
+ if ( hTcxCfg->tcx_mdct_window_half_length == hTcxCfg->tcx_mdct_window_half_lengthFB )
+ {
+ mvr2r( hTcxCfg->tcx_mdct_window_half_flt, hTcxCfg->tcx_mdct_window_halfFB_flt, hTcxCfg->tcx_mdct_window_half_length );
+ }
+ else
+ {
+ mdct_window_sine_flt( hTcxCfg->tcx_mdct_window_halfFB_flt, input_Fs, hTcxCfg->tcx_mdct_window_half_lengthFB, HALF_OVERLAP, element_mode );
+ }
- return pit_res_max;
+ /* minimum overlap 1.25 ms */
+ hTcxCfg->tcx_mdct_window_min_length = (int16_t) ( sr_core * INV_CLDFB_BANDWIDTH );
+ hTcxCfg->tcx_mdct_window_min_lengthFB = (int16_t) ( input_Fs * INV_CLDFB_BANDWIDTH );
+ /* save complexity by copying the small windows if they have the same length */
+ if ( hTcxCfg->tcx_mdct_window_min_length == hTcxCfg->tcx_mdct_window_trans_length )
+ {
+ mvr2r( hTcxCfg->tcx_mdct_window_trans_flt, hTcxCfg->tcx_mdct_window_minimum_flt, hTcxCfg->tcx_mdct_window_min_length );
+ }
+ else
+ {
+ mdct_window_sine_flt( hTcxCfg->tcx_mdct_window_minimum_flt, sr_core, hTcxCfg->tcx_mdct_window_min_length, MIN_OVERLAP, element_mode );
}
- /*-------------------------------------------------------------------*
- * getNumTcxCodedLines()
- *
- *
- *-------------------------------------------------------------------*/
-
- Word16 getNumTcxCodedLines(
- const Word16 bwidth /* i : audio bandwidth */
- )
+ if ( hTcxCfg->tcx_mdct_window_min_lengthFB == hTcxCfg->tcx_mdct_window_trans_lengthFB )
{
- Word16 tcx_coded_lines;
-
- tcx_coded_lines = 0;
- move16();
+ mvr2r( hTcxCfg->tcx_mdct_window_transFB_flt, hTcxCfg->tcx_mdct_window_minimumFB_flt, hTcxCfg->tcx_mdct_window_min_lengthFB );
+ }
+ else if ( hTcxCfg->tcx_mdct_window_min_length == hTcxCfg->tcx_mdct_window_min_lengthFB )
+ {
+ mvr2r( hTcxCfg->tcx_mdct_window_minimum_flt, hTcxCfg->tcx_mdct_window_minimumFB_flt, hTcxCfg->tcx_mdct_window_min_lengthFB );
+ }
+ else
+ {
+ mdct_window_sine_flt( hTcxCfg->tcx_mdct_window_minimumFB_flt, input_Fs, hTcxCfg->tcx_mdct_window_min_lengthFB, MIN_OVERLAP, element_mode );
+ }
- SWITCH( bwidth )
- {
- case NB:
- tcx_coded_lines = 160;
- move16();
- BREAK;
- case WB:
- tcx_coded_lines = 320;
- move16();
- BREAK;
- case SWB:
- tcx_coded_lines = 640;
- move16();
- BREAK;
- case FB:
- tcx_coded_lines = 960;
- move16();
- BREAK;
- default:
- tcx_coded_lines = 0;
- move16();
- BREAK;
- }
+ /* TCX Offset */
+ hTcxCfg->tcx_offset = ( hTcxCfg->tcx_mdct_window_delay >> 1 );
+ hTcxCfg->tcx_offsetFB = ( hTcxCfg->tcx_mdct_window_delayFB >> 1 );
+ /*<0 rectangular transition with optimized window size = L_frame+L_frame/4*/
+ hTcxCfg->lfacNext = hTcxCfg->tcx_offset - L_frame / 4;
+ hTcxCfg->lfacNextFB = hTcxCfg->tcx_offsetFB - L_frameTCX / 4;
- return tcx_coded_lines;
- }
+ return;
+}
- /*-------------------------------------------------------------------*
- * getTcxLpcShapedAri()
- *
- *
- *-------------------------------------------------------------------*/
+/*-----------------------------------------------------------------------*
+ * init_tcx()
+ *
+ * Initialization of TCX
+ *-----------------------------------------------------------------------*/
+
+void init_tcx_cfg(
+ TCX_CONFIG_HANDLE hTcxCfg,
+ const int32_t total_brate,
+ const int32_t sr_core,
+ const int32_t input_Fs,
+ const int16_t L_frame,
+ const int16_t bwidth,
+ const int16_t L_frameTCX,
+ const int16_t fscale,
+ const int16_t encoderLookahead_enc,
+ const int16_t encoderLookahead_FB,
+ const float preemph_fac,
+ const int16_t tcxonly,
+ const int16_t rf_mode,
+ const int16_t igf,
+ const int16_t infoIGFStopFreq,
+ const int16_t element_mode,
+ const int16_t ini_frame,
+ const int16_t MCT_flag )
+{
+ int16_t i;
+ int16_t mdctWindowLength;
+ int16_t mdctWindowLengthFB;
+ int16_t na_scale_bwidth;
- Word16 getTcxLpcShapedAri(
- const Word32 total_brate, /* i : total bitrate */
- const Word16 rf_mode, /* i : flag to signal the RF mode */
- const Word16 element_mode /* i : IVAS element mode */
- )
- {
- Word16 tcx_lpc_shaped_ari;
- tcx_lpc_shaped_ari = 0;
- move16();
+ hTcxCfg->preemph_fac_flt = preemph_fac;
+ hTcxCfg->tcx5Size = NS2SA( sr_core, FRAME_SIZE_NS / 4 ); /* Always 5 ms */
+ hTcxCfg->tcx5SizeFB = NS2SA( input_Fs, FRAME_SIZE_NS / 4 ); /* Always 5 ms */
- test();
- test();
- test();
- test();
- if ( ( ( LE_16( element_mode, IVAS_SCE ) && LE_32( total_brate, LPC_SHAPED_ARI_MAX_RATE ) ) || ( GT_16( element_mode, IVAS_SCE ) && LE_32( total_brate, LPC_SHAPED_ARI_MAX_RATE_CPE ) ) ) || rf_mode )
- {
- tcx_lpc_shaped_ari = 1;
- move16();
- }
+ hTcxCfg->tcx_mdct_window_length_old = hTcxCfg->tcx_mdct_window_length;
+ mdctWindowLength = getMdctWindowLength( fscale );
+ mdctWindowLengthFB = (int16_t) ( mdctWindowLength * input_Fs / sr_core );
- return tcx_lpc_shaped_ari;
- }
-
-
- /*-----------------------------------------------------------------------*
- * init_tcx_window_cfg()
- *
- * Initialization of TCX windows
- *-----------------------------------------------------------------------*/
-
- void init_tcx_window_cfg(
- TCX_CONFIG_HANDLE hTcxCfg, /* i/o: TCX Config handle */
- const int32_t sr_core, /* i : SR core */
- const int32_t input_Fs, /* i : input/output SR */
- const int16_t L_frame, /* i : L_frame at sr_core */
- const int16_t L_frameTCX, /* i : L_frame at i/o SR */
- const int16_t encoderLookahead_enc, /* i : encoder LA at sr_core */
- const int16_t encoderLookahead_FB, /* i : encoder LA at i/o SR */
- const int16_t mdctWindowLength, /* i : window length at sr_core */
- const int16_t mdctWindowLengthFB, /* i : window length at i/o SR */
- const int16_t element_mode /* i : mode of CPE/SCE */
- )
- {
- /* Symmetric window = sine LD window*/
- hTcxCfg->tcx_mdct_window_delay = mdctWindowLength;
- hTcxCfg->tcx_mdct_window_delayFB = mdctWindowLengthFB;
- hTcxCfg->tcx_mdct_window_length = mdctWindowLength;
- hTcxCfg->tcx_mdct_window_lengthFB = mdctWindowLengthFB;
-
- mdct_window_sine_flt( hTcxCfg->tcx_mdct_window_flt, sr_core, hTcxCfg->tcx_mdct_window_length, FULL_OVERLAP, element_mode );
- if ( hTcxCfg->tcx_mdct_window_length == hTcxCfg->tcx_mdct_window_lengthFB )
- {
- mvr2r( hTcxCfg->tcx_mdct_window_flt, hTcxCfg->tcx_mdct_windowFB_flt, hTcxCfg->tcx_mdct_window_length );
- }
- else
- {
- mdct_window_sine_flt( hTcxCfg->tcx_mdct_windowFB_flt, input_Fs, hTcxCfg->tcx_mdct_window_lengthFB, FULL_OVERLAP, element_mode );
- }
+ init_tcx_window_cfg( hTcxCfg, sr_core, input_Fs, L_frame, L_frameTCX, encoderLookahead_enc, encoderLookahead_FB, mdctWindowLength, mdctWindowLengthFB, element_mode );
- /*ALDO windows for MODE2*/
- mdct_window_aldo_flt( hTcxCfg->tcx_aldo_window_1_flt, hTcxCfg->tcx_aldo_window_2_flt, L_frame );
- mdct_window_aldo_flt( hTcxCfg->tcx_aldo_window_1_FB_flt, hTcxCfg->tcx_aldo_window_2_FB_flt, NS2SA( input_Fs, FRAME_SIZE_NS ) );
- hTcxCfg->tcx_aldo_window_1_trunc_flt = hTcxCfg->tcx_aldo_window_1_flt + NS2SA( sr_core, N_ZERO_MDCT_NS );
- hTcxCfg->tcx_aldo_window_1_FB_trunc_flt = hTcxCfg->tcx_aldo_window_1_FB_flt + NS2SA( input_Fs, N_ZERO_MDCT_NS );
-
- /*1.25ms transition window for ACELP->TCX*/
- hTcxCfg->tcx_mdct_window_trans_length = NS2SA( sr_core, ACELP_TCX_TRANS_NS );
- mdct_window_sine_flt( hTcxCfg->tcx_mdct_window_trans_flt, sr_core, hTcxCfg->tcx_mdct_window_trans_length, TRANSITION_OVERLAP, element_mode );
- hTcxCfg->tcx_mdct_window_trans_lengthFB = NS2SA( input_Fs, ACELP_TCX_TRANS_NS );
- if ( hTcxCfg->tcx_mdct_window_trans_length == hTcxCfg->tcx_mdct_window_trans_lengthFB )
- {
- mvr2r( hTcxCfg->tcx_mdct_window_trans_flt, hTcxCfg->tcx_mdct_window_transFB_flt, hTcxCfg->tcx_mdct_window_trans_length );
- }
- else
- {
- mdct_window_sine_flt( hTcxCfg->tcx_mdct_window_transFB_flt, input_Fs, hTcxCfg->tcx_mdct_window_trans_lengthFB, TRANSITION_OVERLAP, element_mode );
- }
+ /* SQ deadzone & memory quantization*/
+ hTcxCfg->sq_rounding_flt = 0.375f; /*deadzone of 1.25->rounding=1-1.25/2 (No deadzone=0.5)*/
- /*Mid-OLA*/
- /*compute minimum length for "half" window: lookahead - 5ms. It must be also multiple of 2*/
- hTcxCfg->tcx_mdct_window_half_length = 2 * ( ( encoderLookahead_enc - (int16_t) ( 0.005f * sr_core + 0.5f ) ) >> 1 );
- hTcxCfg->tcx_mdct_window_half_lengthFB = 2 * ( ( encoderLookahead_FB - (int16_t) ( 0.005f * input_Fs + 0.5f ) ) >> 1 );
- assert( ( hTcxCfg->tcx_mdct_window_half_length > 16 ) && "Half window can not be large enough!" );
+ /* TCX rate loop */
+ hTcxCfg->tcxRateLoopOpt = ( tcxonly ) ? 2 : 0;
+ hTcxCfg->tcxRateLoopOpt = ( element_mode == IVAS_CPE_MDCT ) ? 3 : hTcxCfg->tcxRateLoopOpt;
- mdct_window_sine_flt( hTcxCfg->tcx_mdct_window_half_flt, sr_core, hTcxCfg->tcx_mdct_window_half_length, HALF_OVERLAP, element_mode );
- if ( hTcxCfg->tcx_mdct_window_half_length == hTcxCfg->tcx_mdct_window_half_lengthFB )
- {
- mvr2r( hTcxCfg->tcx_mdct_window_half_flt, hTcxCfg->tcx_mdct_window_halfFB_flt, hTcxCfg->tcx_mdct_window_half_length );
- }
- else
- {
- mdct_window_sine_flt( hTcxCfg->tcx_mdct_window_halfFB_flt, input_Fs, hTcxCfg->tcx_mdct_window_half_lengthFB, HALF_OVERLAP, element_mode );
- }
+ /* TCX bandwidth */
+ hTcxCfg->bandwidth_flt = getTcxBandwidth_flt( bwidth );
- /* minimum overlap 1.25 ms */
- hTcxCfg->tcx_mdct_window_min_length = (int16_t) ( sr_core * INV_CLDFB_BANDWIDTH );
- hTcxCfg->tcx_mdct_window_min_lengthFB = (int16_t) ( input_Fs * INV_CLDFB_BANDWIDTH );
- /* save complexity by copying the small windows if they have the same length */
- if ( hTcxCfg->tcx_mdct_window_min_length == hTcxCfg->tcx_mdct_window_trans_length )
- {
- mvr2r( hTcxCfg->tcx_mdct_window_trans_flt, hTcxCfg->tcx_mdct_window_minimum_flt, hTcxCfg->tcx_mdct_window_min_length );
- }
- else
- {
- mdct_window_sine_flt( hTcxCfg->tcx_mdct_window_minimum_flt, sr_core, hTcxCfg->tcx_mdct_window_min_length, MIN_OVERLAP, element_mode );
- }
+ /* set number of coded lines */
+ hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( bwidth );
- if ( hTcxCfg->tcx_mdct_window_min_lengthFB == hTcxCfg->tcx_mdct_window_trans_lengthFB )
- {
- mvr2r( hTcxCfg->tcx_mdct_window_transFB_flt, hTcxCfg->tcx_mdct_window_minimumFB_flt, hTcxCfg->tcx_mdct_window_min_lengthFB );
- }
- else if ( hTcxCfg->tcx_mdct_window_min_length == hTcxCfg->tcx_mdct_window_min_lengthFB )
- {
- mvr2r( hTcxCfg->tcx_mdct_window_minimum_flt, hTcxCfg->tcx_mdct_window_minimumFB_flt, hTcxCfg->tcx_mdct_window_min_lengthFB );
- }
- else
- {
- mdct_window_sine_flt( hTcxCfg->tcx_mdct_window_minimumFB_flt, input_Fs, hTcxCfg->tcx_mdct_window_min_lengthFB, MIN_OVERLAP, element_mode );
- }
+ /* TNS in TCX */
+ hTcxCfg->pCurrentTnsConfig = NULL;
+ hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, igf, element_mode );
- /* TCX Offset */
- hTcxCfg->tcx_offset = ( hTcxCfg->tcx_mdct_window_delay >> 1 );
- hTcxCfg->tcx_offsetFB = ( hTcxCfg->tcx_mdct_window_delayFB >> 1 );
- /*<0 rectangular transition with optimized window size = L_frame+L_frame/4*/
- hTcxCfg->lfacNext = hTcxCfg->tcx_offset - L_frame / 4;
- hTcxCfg->lfacNextFB = hTcxCfg->tcx_offsetFB - L_frameTCX / 4;
-
- return;
- }
-
- /*-----------------------------------------------------------------------*
- * init_tcx()
- *
- * Initialization of TCX
- *-----------------------------------------------------------------------*/
-
- void init_tcx_cfg(
- TCX_CONFIG_HANDLE hTcxCfg,
- const int32_t total_brate,
- const int32_t sr_core,
- const int32_t input_Fs,
- const int16_t L_frame,
- const int16_t bwidth,
- const int16_t L_frameTCX,
- const int16_t fscale,
- const int16_t encoderLookahead_enc,
- const int16_t encoderLookahead_FB,
- const float preemph_fac,
- const int16_t tcxonly,
- const int16_t rf_mode,
- const int16_t igf,
- const int16_t infoIGFStopFreq,
- const int16_t element_mode,
- const int16_t ini_frame,
- const int16_t MCT_flag )
- {
- int16_t i;
- int16_t mdctWindowLength;
- int16_t mdctWindowLengthFB;
- int16_t na_scale_bwidth;
-
- hTcxCfg->preemph_fac_flt = preemph_fac;
- hTcxCfg->tcx5Size = NS2SA( sr_core, FRAME_SIZE_NS / 4 ); /* Always 5 ms */
- hTcxCfg->tcx5SizeFB = NS2SA( input_Fs, FRAME_SIZE_NS / 4 ); /* Always 5 ms */
-
- hTcxCfg->tcx_mdct_window_length_old = hTcxCfg->tcx_mdct_window_length;
- mdctWindowLength = getMdctWindowLength( fscale );
- mdctWindowLengthFB = (int16_t) ( mdctWindowLength * input_Fs / sr_core );
-
- init_tcx_window_cfg( hTcxCfg, sr_core, input_Fs, L_frame, L_frameTCX, encoderLookahead_enc, encoderLookahead_FB, mdctWindowLength, mdctWindowLengthFB, element_mode );
-
- /* SQ deadzone & memory quantization*/
- hTcxCfg->sq_rounding_flt = 0.375f; /*deadzone of 1.25->rounding=1-1.25/2 (No deadzone=0.5)*/
-
- /* TCX rate loop */
- hTcxCfg->tcxRateLoopOpt = ( tcxonly ) ? 2 : 0;
- hTcxCfg->tcxRateLoopOpt = ( element_mode == IVAS_CPE_MDCT ) ? 3 : hTcxCfg->tcxRateLoopOpt;
-
- /* TCX bandwidth */
- hTcxCfg->bandwidth_flt = getTcxBandwidth_flt( bwidth );
-
- /* set number of coded lines */
- hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( bwidth );
-
- /* TNS in TCX */
- hTcxCfg->pCurrentTnsConfig = NULL;
- hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, igf, element_mode );
-
- if ( hTcxCfg->fIsTNSAllowed )
- {
- InitTnsConfigs_flt( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag );
+ if ( hTcxCfg->fIsTNSAllowed )
+ {
+ InitTnsConfigs_flt( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag );
- SetAllowTnsOnWhite_flt( hTcxCfg->tnsConfig, element_mode == IVAS_CPE_MDCT );
- }
+ SetAllowTnsOnWhite_flt( hTcxCfg->tnsConfig, element_mode == IVAS_CPE_MDCT );
+ }
- if ( ini_frame == 0 )
- {
- hTcxCfg->tcx_curr_overlap_mode = hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW;
- hTcxCfg->last_aldo = 1;
- }
+ if ( ini_frame == 0 )
+ {
+ hTcxCfg->tcx_curr_overlap_mode = hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW;
+ hTcxCfg->last_aldo = 1;
+ }
- /* Context HM*/
- hTcxCfg->ctx_hm = getCtxHm( element_mode, total_brate, rf_mode );
+ /* Context HM*/
+ hTcxCfg->ctx_hm = getCtxHm( element_mode, total_brate, rf_mode );
- /* Residual Coding*/
- hTcxCfg->resq = getResq( total_brate );
- hTcxCfg->tcxRateLoopOpt = ( hTcxCfg->resq && !tcxonly ) ? 1 : hTcxCfg->tcxRateLoopOpt;
+ /* Residual Coding*/
+ hTcxCfg->resq = getResq( total_brate );
+ hTcxCfg->tcxRateLoopOpt = ( hTcxCfg->resq && !tcxonly ) ? 1 : hTcxCfg->tcxRateLoopOpt;
- /*Set bandwidth scale*/
- if ( bwidth == NB )
- {
- na_scale_bwidth = NB;
- }
- else if ( sr_core <= INT_FS_16k )
- {
- na_scale_bwidth = WB;
- }
- else
- {
- na_scale_bwidth = SWB;
- }
+ /*Set bandwidth scale*/
+ if ( bwidth == NB )
+ {
+ na_scale_bwidth = NB;
+ }
+ else if ( sr_core <= INT_FS_16k )
+ {
+ na_scale_bwidth = WB;
+ }
+ else
+ {
+ na_scale_bwidth = SWB;
+ }
- /* Scale TCX for non-active frames to adjust loudness with ACELP*/
- hTcxCfg->na_scale_flt = 1.f;
+ /* Scale TCX for non-active frames to adjust loudness with ACELP*/
+ hTcxCfg->na_scale_flt = 1.f;
- if ( na_scale_bwidth < SWB && !tcxonly )
+ if ( na_scale_bwidth < SWB && !tcxonly )
+ {
+ for ( i = 0; i < SIZE_SCALE_TABLE_TCX; i++ )
{
- for ( i = 0; i < SIZE_SCALE_TABLE_TCX; i++ )
+ if ( ( na_scale_bwidth == scaleTcxTable[i].bwmode ) &&
+ ( total_brate >= scaleTcxTable[i].bitrateFrom ) &&
+ ( total_brate < scaleTcxTable[i].bitrateTo ) )
{
- if ( ( na_scale_bwidth == scaleTcxTable[i].bwmode ) &&
- ( total_brate >= scaleTcxTable[i].bitrateFrom ) &&
- ( total_brate < scaleTcxTable[i].bitrateTo ) )
+ if ( rf_mode )
{
- if ( rf_mode )
- {
- i--;
- }
- hTcxCfg->na_scale_flt = scaleTcxTable[i].scale_flt;
- break;
+ i--;
}
+ hTcxCfg->na_scale_flt = scaleTcxTable[i].scale_flt;
+ break;
}
}
+ }
- if ( tcxonly )
- {
- InitPsychLPC( sr_core, L_frame, hTcxCfg );
- }
- else
- {
- hTcxCfg->psychParamsCurrent = NULL;
- }
-
- return;
+ if ( tcxonly )
+ {
+ InitPsychLPC( sr_core, L_frame, hTcxCfg );
}
+ else
+ {
+ hTcxCfg->psychParamsCurrent = NULL;
+ }
+
+ return;
+}
#ifdef IVAS_FLOAT_FIXED
- void init_tcx_window_cfg_fx(
- TCX_CONFIG_HANDLE hTcxCfg, /* i/o: TCX Config handle */
- const Word32 sr_core, /* i : SR core */
- const Word32 input_Fs, /* i : input/output SR */
- const Word16 L_frame, /* i : L_frame at sr_core */
- const Word16 L_frameTCX, /* i : L_frame at i/o SR */
- const Word16 mdctWindowLength, /* i : window length at sr_core */
- const Word16 mdctWindowLengthFB, /* i : window length at i/o SR */
- const Word16 element_mode /* i : mode of CPE/SCE */
- )
- {
- /* Symmetric window = sine LD window*/
- hTcxCfg->tcx_mdct_window_delay = mdctWindowLength;
- hTcxCfg->tcx_mdct_window_delayFB = mdctWindowLengthFB;
- hTcxCfg->tcx_mdct_window_length = mdctWindowLength;
- hTcxCfg->tcx_mdct_window_lengthFB = mdctWindowLengthFB;
- move16();
- move16();
- move16();
- move16();
- mdct_window_sine_IVAS_updated( hTcxCfg->tcx_mdct_window, sr_core, hTcxCfg->tcx_mdct_window_length, FULL_OVERLAP, element_mode );
+void init_tcx_window_cfg_fx(
+ TCX_CONFIG_HANDLE hTcxCfg, /* i/o: TCX Config handle */
+ const Word32 sr_core, /* i : SR core */
+ const Word32 input_Fs, /* i : input/output SR */
+ const Word16 L_frame, /* i : L_frame at sr_core */
+ const Word16 L_frameTCX, /* i : L_frame at i/o SR */
+ const Word16 mdctWindowLength, /* i : window length at sr_core */
+ const Word16 mdctWindowLengthFB, /* i : window length at i/o SR */
+ const Word16 element_mode /* i : mode of CPE/SCE */
+)
+{
+ /* Symmetric window = sine LD window*/
+ hTcxCfg->tcx_mdct_window_delay = mdctWindowLength;
+ hTcxCfg->tcx_mdct_window_delayFB = mdctWindowLengthFB;
+ hTcxCfg->tcx_mdct_window_length = mdctWindowLength;
+ hTcxCfg->tcx_mdct_window_lengthFB = mdctWindowLengthFB;
+ move16();
+ move16();
+ move16();
+ move16();
+ mdct_window_sine_IVAS_updated( hTcxCfg->tcx_mdct_window, sr_core, hTcxCfg->tcx_mdct_window_length, FULL_OVERLAP, element_mode );
- IF( EQ_16( hTcxCfg->tcx_mdct_window_length, hTcxCfg->tcx_mdct_window_lengthFB ) )
- {
- Copy_pword( hTcxCfg->tcx_mdct_window, hTcxCfg->tcx_mdct_windowFB, shr( hTcxCfg->tcx_mdct_window_length, 1 ) );
- }
- ELSE
- {
- mdct_window_sine_IVAS_updated( hTcxCfg->tcx_mdct_windowFB, input_Fs, hTcxCfg->tcx_mdct_window_lengthFB, FULL_OVERLAP, element_mode );
- }
+ IF( EQ_16( hTcxCfg->tcx_mdct_window_length, hTcxCfg->tcx_mdct_window_lengthFB ) )
+ {
+ Copy_pword( hTcxCfg->tcx_mdct_window, hTcxCfg->tcx_mdct_windowFB, shr( hTcxCfg->tcx_mdct_window_length, 1 ) );
+ }
+ ELSE
+ {
+ mdct_window_sine_IVAS_updated( hTcxCfg->tcx_mdct_windowFB, input_Fs, hTcxCfg->tcx_mdct_window_lengthFB, FULL_OVERLAP, element_mode );
+ }
- /*ALDO windows for MODE2*/
- mdct_window_aldo( hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2, L_frame );
- mdct_window_aldo( hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, NS2SA_fx2( input_Fs, FRAME_SIZE_NS ) );
+ /*ALDO windows for MODE2*/
+ mdct_window_aldo( hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2, L_frame );
+ mdct_window_aldo( hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, NS2SA_FX2( input_Fs, FRAME_SIZE_NS ) );
- /*1.25ms transition window for ACELP->TCX*/
- hTcxCfg->tcx_mdct_window_trans_length = NS2SA_fx2( sr_core, ACELP_TCX_TRANS_NS );
- move16();
- mdct_window_sine_IVAS_updated( hTcxCfg->tcx_mdct_window_trans, sr_core, hTcxCfg->tcx_mdct_window_trans_length, TRANSITION_OVERLAP, element_mode );
- hTcxCfg->tcx_mdct_window_trans_lengthFB = NS2SA_fx2( input_Fs, ACELP_TCX_TRANS_NS );
- move16();
- IF( EQ_16( hTcxCfg->tcx_mdct_window_trans_length, hTcxCfg->tcx_mdct_window_trans_lengthFB ) )
- {
- Copy_pword( hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_transFB, shr( hTcxCfg->tcx_mdct_window_trans_length, 1 ) );
- }
- ELSE
- {
- mdct_window_sine_IVAS_updated( hTcxCfg->tcx_mdct_window_transFB, input_Fs, hTcxCfg->tcx_mdct_window_trans_lengthFB, TRANSITION_OVERLAP, element_mode );
- }
- /*Mid-OLA*/
- /*compute minimum length for "half" window: lookahead - 5ms. It must be also multiple of 2*/
- hTcxCfg->tcx_mdct_window_half_length = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA_fx2( 12800, 5000000L ), sr2fscale( sr_core ) ), LD_FSCALE_DENOM ) );
- hTcxCfg->tcx_mdct_window_half_lengthFB = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA_fx2( 12800, 5000000L ), sr2fscale( input_Fs ) ), LD_FSCALE_DENOM ) );
- move16();
- move16();
- assert( GT_16( hTcxCfg->tcx_mdct_window_half_length, 16 ) && "Half window can not be large enough!" );
+ /*1.25ms transition window for ACELP->TCX*/
+ hTcxCfg->tcx_mdct_window_trans_length = NS2SA_FX2( sr_core, ACELP_TCX_TRANS_NS );
+ move16();
+ mdct_window_sine_IVAS_updated( hTcxCfg->tcx_mdct_window_trans, sr_core, hTcxCfg->tcx_mdct_window_trans_length, TRANSITION_OVERLAP, element_mode );
+ hTcxCfg->tcx_mdct_window_trans_lengthFB = NS2SA_FX2( input_Fs, ACELP_TCX_TRANS_NS );
+ move16();
+ IF( EQ_16( hTcxCfg->tcx_mdct_window_trans_length, hTcxCfg->tcx_mdct_window_trans_lengthFB ) )
+ {
+ Copy_pword( hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_transFB, shr( hTcxCfg->tcx_mdct_window_trans_length, 1 ) );
+ }
+ ELSE
+ {
+ mdct_window_sine_IVAS_updated( hTcxCfg->tcx_mdct_window_transFB, input_Fs, hTcxCfg->tcx_mdct_window_trans_lengthFB, TRANSITION_OVERLAP, element_mode );
+ }
+ /*Mid-OLA*/
+ /*compute minimum length for "half" window: lookahead - 5ms. It must be also multiple of 2*/
+ hTcxCfg->tcx_mdct_window_half_length = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA_FX2( 12800, 5000000L ), sr2fscale( sr_core ) ), LD_FSCALE_DENOM ) );
+ hTcxCfg->tcx_mdct_window_half_lengthFB = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA_FX2( 12800, 5000000L ), sr2fscale( input_Fs ) ), LD_FSCALE_DENOM ) );
+ move16();
+ move16();
+ assert( GT_16( hTcxCfg->tcx_mdct_window_half_length, 16 ) && "Half window can not be large enough!" );
- mdct_window_sine_IVAS_updated( hTcxCfg->tcx_mdct_window_half, sr_core, hTcxCfg->tcx_mdct_window_half_length, HALF_OVERLAP, element_mode );
- IF( EQ_16( hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_half_lengthFB ) )
- {
- Copy_pword( hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_halfFB, shr( hTcxCfg->tcx_mdct_window_half_length, 1 ) );
- }
- ELSE
- {
- mdct_window_sine_IVAS_updated( hTcxCfg->tcx_mdct_window_halfFB, input_Fs, hTcxCfg->tcx_mdct_window_half_lengthFB, HALF_OVERLAP, element_mode );
- }
+ mdct_window_sine_IVAS_updated( hTcxCfg->tcx_mdct_window_half, sr_core, hTcxCfg->tcx_mdct_window_half_length, HALF_OVERLAP, element_mode );
+ IF( EQ_16( hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_half_lengthFB ) )
+ {
+ Copy_pword( hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_halfFB, shr( hTcxCfg->tcx_mdct_window_half_length, 1 ) );
+ }
+ ELSE
+ {
+ mdct_window_sine_IVAS_updated( hTcxCfg->tcx_mdct_window_halfFB, input_Fs, hTcxCfg->tcx_mdct_window_half_lengthFB, HALF_OVERLAP, element_mode );
+ }
- /* minimum overlap 1.25 ms */
- hTcxCfg->tcx_mdct_window_min_length = shr( L_frame, 4 ); /* 1.25ms */
- hTcxCfg->tcx_mdct_window_min_lengthFB = shr( L_frameTCX, 4 ); /* 1.25ms */
- move16();
- move16();
- /* save complexity by copying the small windows if they have the same length */
- IF( EQ_16( hTcxCfg->tcx_mdct_window_min_length, hTcxCfg->tcx_mdct_window_trans_length ) )
- {
- Copy_pword( hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_minimum, shr( hTcxCfg->tcx_mdct_window_min_length, 1 ) );
- }
- ELSE
- {
- mdct_window_sine_IVAS_updated( hTcxCfg->tcx_mdct_window_minimum, sr_core, hTcxCfg->tcx_mdct_window_min_length, MIN_OVERLAP, element_mode );
- }
+ /* minimum overlap 1.25 ms */
+ hTcxCfg->tcx_mdct_window_min_length = shr( L_frame, 4 ); /* 1.25ms */
+ hTcxCfg->tcx_mdct_window_min_lengthFB = shr( L_frameTCX, 4 ); /* 1.25ms */
+ move16();
+ move16();
+ /* save complexity by copying the small windows if they have the same length */
+ IF( EQ_16( hTcxCfg->tcx_mdct_window_min_length, hTcxCfg->tcx_mdct_window_trans_length ) )
+ {
+ Copy_pword( hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_minimum, shr( hTcxCfg->tcx_mdct_window_min_length, 1 ) );
+ }
+ ELSE
+ {
+ mdct_window_sine_IVAS_updated( hTcxCfg->tcx_mdct_window_minimum, sr_core, hTcxCfg->tcx_mdct_window_min_length, MIN_OVERLAP, element_mode );
+ }
- IF( EQ_16( hTcxCfg->tcx_mdct_window_min_lengthFB, hTcxCfg->tcx_mdct_window_trans_lengthFB ) )
- {
- Copy_pword( hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_minimumFB, shr( hTcxCfg->tcx_mdct_window_min_lengthFB, 1 ) );
- }
- ELSE IF( EQ_16( hTcxCfg->tcx_mdct_window_min_length, hTcxCfg->tcx_mdct_window_min_lengthFB ) )
- {
- Copy_pword( hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_minimumFB, shr( hTcxCfg->tcx_mdct_window_min_lengthFB, 1 ) );
- }
- ELSE
- {
- mdct_window_sine_IVAS_updated( hTcxCfg->tcx_mdct_window_minimumFB, input_Fs, hTcxCfg->tcx_mdct_window_min_lengthFB, MIN_OVERLAP, element_mode );
- }
- /* TCX Offset */
- hTcxCfg->tcx_offset = shr( hTcxCfg->tcx_mdct_window_delay, 1 );
- hTcxCfg->tcx_offsetFB = shr( hTcxCfg->tcx_mdct_window_delayFB, 1 );
- /*<0 rectangular transition with optimized window size = L_frame+L_frame/4*/
- hTcxCfg->lfacNext = sub( hTcxCfg->tcx_offset, shr( L_frame, 2 ) );
- hTcxCfg->lfacNextFB = sub( hTcxCfg->tcx_offsetFB, shr( L_frameTCX, 2 ) );
- move16();
- move16();
- move16();
- move16();
+ IF( EQ_16( hTcxCfg->tcx_mdct_window_min_lengthFB, hTcxCfg->tcx_mdct_window_trans_lengthFB ) )
+ {
+ Copy_pword( hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_minimumFB, shr( hTcxCfg->tcx_mdct_window_min_lengthFB, 1 ) );
+ }
+ ELSE IF( EQ_16( hTcxCfg->tcx_mdct_window_min_length, hTcxCfg->tcx_mdct_window_min_lengthFB ) )
+ {
+ Copy_pword( hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_minimumFB, shr( hTcxCfg->tcx_mdct_window_min_lengthFB, 1 ) );
+ }
+ ELSE
+ {
+ mdct_window_sine_IVAS_updated( hTcxCfg->tcx_mdct_window_minimumFB, input_Fs, hTcxCfg->tcx_mdct_window_min_lengthFB, MIN_OVERLAP, element_mode );
+ }
+ /* TCX Offset */
+ hTcxCfg->tcx_offset = shr( hTcxCfg->tcx_mdct_window_delay, 1 );
+ hTcxCfg->tcx_offsetFB = shr( hTcxCfg->tcx_mdct_window_delayFB, 1 );
+ /*<0 rectangular transition with optimized window size = L_frame+L_frame/4*/
+ hTcxCfg->lfacNext = sub( hTcxCfg->tcx_offset, shr( L_frame, 2 ) );
+ hTcxCfg->lfacNextFB = sub( hTcxCfg->tcx_offsetFB, shr( L_frameTCX, 2 ) );
+ move16();
+ move16();
+ move16();
+ move16();
- return;
- }
-
- void init_tcx_cfg_fx(
- TCX_CONFIG_HANDLE hTcxCfg,
- const Word32 total_brate,
- const Word32 sr_core,
- const Word32 input_Fs,
- const Word16 L_frame,
- const Word16 bwidth,
- const Word16 L_frameTCX,
- const Word16 fscale,
- const Word16 preemph_fac,
- const Word16 tcxonly,
- const Word16 rf_mode,
- const Word16 igf,
- const Word16 infoIGFStopFreq,
- const Word16 element_mode,
- const Word16 ini_frame,
- const Word16 MCT_flag,
- const Word16 fscaleFB )
- {
- Word16 i;
- Word16 mdctWindowLength;
- Word16 mdctWindowLengthFB;
- Word16 na_scale_bwidth;
-
- hTcxCfg->preemph_fac = preemph_fac;
- move16();
+ return;
+}
- hTcxCfg->tcx5Size = shr( L_frame, 2 ); /* Always 5 ms */
- hTcxCfg->tcx5SizeFB = shr( L_frameTCX, 2 ); /* Always 5 ms */
- move16();
- move16();
+void init_tcx_cfg_fx(
+ TCX_CONFIG_HANDLE hTcxCfg,
+ const Word32 total_brate,
+ const Word32 sr_core,
+ const Word32 input_Fs,
+ const Word16 L_frame,
+ const Word16 bwidth,
+ const Word16 L_frameTCX,
+ const Word16 fscale,
+ const Word16 preemph_fac,
+ const Word16 tcxonly,
+ const Word16 rf_mode,
+ const Word16 igf,
+ const Word16 infoIGFStopFreq,
+ const Word16 element_mode,
+ const Word16 ini_frame,
+ const Word16 MCT_flag,
+ const Word16 fscaleFB )
+{
+ Word16 i;
+ Word16 mdctWindowLength;
+ Word16 mdctWindowLengthFB;
+ Word16 na_scale_bwidth;
- hTcxCfg->tcx_mdct_window_length_old = hTcxCfg->tcx_mdct_window_length;
- move16();
- mdctWindowLength = getMdctWindowLength_fx( fscale );
- mdctWindowLengthFB = getMdctWindowLength_fx( fscaleFB );
- init_tcx_window_cfg_fx( hTcxCfg, sr_core, input_Fs, L_frame, L_frameTCX, mdctWindowLength, mdctWindowLengthFB, element_mode );
- /* SQ deadzone & memory quantization*/
- hTcxCfg->sq_rounding = 12288 /*0.375f Q15*/; /*deadzone of 1.25->rounding=1-1.25/2 (No deadzone=0.5)*/
- move16();
+ hTcxCfg->preemph_fac = preemph_fac;
+ move16();
- /* TCX rate loop */
- hTcxCfg->tcxRateLoopOpt = 0;
- move16();
+ hTcxCfg->tcx5Size = shr( L_frame, 2 ); /* Always 5 ms */
+ hTcxCfg->tcx5SizeFB = shr( L_frameTCX, 2 ); /* Always 5 ms */
+ move16();
+ move16();
- if ( tcxonly != 0 )
- {
- hTcxCfg->tcxRateLoopOpt = 2;
- move16();
- }
- if ( EQ_16( element_mode, IVAS_CPE_MDCT ) )
- {
- hTcxCfg->tcxRateLoopOpt = 3;
- move16();
- }
- hTcxCfg->bandwidth = getTcxBandwidth( bwidth );
- move16();
+ hTcxCfg->tcx_mdct_window_length_old = hTcxCfg->tcx_mdct_window_length;
+ move16();
+ mdctWindowLength = getMdctWindowLength_fx( fscale );
+ mdctWindowLengthFB = getMdctWindowLength_fx( fscaleFB );
+ init_tcx_window_cfg_fx( hTcxCfg, sr_core, input_Fs, L_frame, L_frameTCX, mdctWindowLength, mdctWindowLengthFB, element_mode );
+ /* SQ deadzone & memory quantization*/
+ hTcxCfg->sq_rounding = 12288 /*0.375f Q15*/; /*deadzone of 1.25->rounding=1-1.25/2 (No deadzone=0.5)*/
+ move16();
- /* set number of coded lines */
- hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( bwidth );
- move16();
+ /* TCX rate loop */
+ hTcxCfg->tcxRateLoopOpt = 0;
+ move16();
- /* TNS in TCX */
- hTcxCfg->pCurrentTnsConfig = NULL;
- hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, igf, element_mode );
+ if ( tcxonly != 0 )
+ {
+ hTcxCfg->tcxRateLoopOpt = 2;
+ move16();
+ }
+ if ( EQ_16( element_mode, IVAS_CPE_MDCT ) )
+ {
+ hTcxCfg->tcxRateLoopOpt = 3;
move16();
+ }
+ hTcxCfg->bandwidth = getTcxBandwidth( bwidth );
+ move16();
- IF( hTcxCfg->fIsTNSAllowed )
- {
- InitTnsConfigs( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag );
+ /* set number of coded lines */
+ hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( bwidth );
+ move16();
- SetAllowTnsOnWhite( hTcxCfg->tnsConfig, (Word8) EQ_16( element_mode, IVAS_CPE_MDCT ) );
- }
+ /* TNS in TCX */
+ hTcxCfg->pCurrentTnsConfig = NULL;
+ hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, igf, element_mode );
+ move16();
- IF( ini_frame == 0 )
- {
- hTcxCfg->tcx_curr_overlap_mode = hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW;
- hTcxCfg->last_aldo = 1;
- move16();
- move16();
- move16();
- }
+ IF( hTcxCfg->fIsTNSAllowed )
+ {
+ InitTnsConfigs( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag );
- /* Context HM*/
- hTcxCfg->ctx_hm = getCtxHm( element_mode, total_brate, rf_mode );
- move16();
+ SetAllowTnsOnWhite( hTcxCfg->tnsConfig, (Word8) EQ_16( element_mode, IVAS_CPE_MDCT ) );
+ }
- /* Residual Coding*/
- hTcxCfg->resq = getResq( total_brate );
+ IF( ini_frame == 0 )
+ {
+ hTcxCfg->tcx_curr_overlap_mode = hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW;
+ hTcxCfg->last_aldo = 1;
move16();
- test();
- if ( hTcxCfg->resq && !tcxonly )
- {
- hTcxCfg->tcxRateLoopOpt = 1;
- move16();
- }
-
- /*Set bandwidth scale*/
- IF( bwidth == NB )
- {
- na_scale_bwidth = NB;
- }
- ELSE IF( LE_32( sr_core, INT_FS_16k ) )
- {
- na_scale_bwidth = WB;
- }
- ELSE
- {
- na_scale_bwidth = SWB;
- }
move16();
- hTcxCfg->na_scale = 32767 /*1.0f Q15*/;
move16();
+ }
- test();
- IF( LT_16( na_scale_bwidth, SWB ) && !tcxonly )
+ /* Context HM*/
+ hTcxCfg->ctx_hm = getCtxHm( element_mode, total_brate, rf_mode );
+ move16();
+
+ /* Residual Coding*/
+ hTcxCfg->resq = getResq( total_brate );
+ move16();
+ test();
+ if ( hTcxCfg->resq && !tcxonly )
+ {
+ hTcxCfg->tcxRateLoopOpt = 1;
+ move16();
+ }
+
+ /*Set bandwidth scale*/
+ IF( bwidth == NB )
+ {
+ na_scale_bwidth = NB;
+ }
+ ELSE IF( LE_32( sr_core, INT_FS_16k ) )
+ {
+ na_scale_bwidth = WB;
+ }
+ ELSE
+ {
+ na_scale_bwidth = SWB;
+ }
+ move16();
+ hTcxCfg->na_scale = 32767 /*1.0f Q15*/;
+ move16();
+
+ test();
+ IF( LT_16( na_scale_bwidth, SWB ) && !tcxonly )
+ {
+ FOR( i = 0; i < SIZE_SCALE_TABLE_TCX; i++ )
{
- FOR( i = 0; i < SIZE_SCALE_TABLE_TCX; i++ )
+ test();
+ test();
+ IF( ( EQ_16( na_scale_bwidth, scaleTcxTable[i].bwmode ) ) &&
+ ( GE_32( total_brate, scaleTcxTable[i].bitrateFrom ) ) &&
+ ( LT_32( total_brate, scaleTcxTable[i].bitrateTo ) ) )
{
- test();
- test();
- IF( ( EQ_16( na_scale_bwidth, scaleTcxTable[i].bwmode ) ) &&
- ( GE_32( total_brate, scaleTcxTable[i].bitrateFrom ) ) &&
- ( LT_32( total_brate, scaleTcxTable[i].bitrateTo ) ) )
+ if ( rf_mode )
{
- if ( rf_mode )
- {
- i = sub( i, 1 );
- }
- hTcxCfg->na_scale = scaleTcxTable[i].scale;
- move16();
- BREAK;
+ i = sub( i, 1 );
}
+ hTcxCfg->na_scale = scaleTcxTable[i].scale;
+ move16();
+ BREAK;
}
}
+ }
- IF( tcxonly )
- {
- InitPsychLPC( sr_core, L_frame, hTcxCfg );
- }
- ELSE
- {
- hTcxCfg->psychParamsCurrent = NULL;
- }
-
- return;
+ IF( tcxonly )
+ {
+ InitPsychLPC( sr_core, L_frame, hTcxCfg );
+ }
+ ELSE
+ {
+ hTcxCfg->psychParamsCurrent = NULL;
}
+
+ return;
+}
#endif // IVAS_FLOAT_FIXED
diff --git a/lib_com/count.c b/lib_com/count.c
index 999229e3d8194d95b5250985f874c142a87da56b..e2c2ba8ee804e58da86326a02f84b3e2fc96a349 100644
--- a/lib_com/count.c
+++ b/lib_com/count.c
@@ -46,23 +46,51 @@
#include
#include
#include
-#include "stl.h"
#include
+#include "stl.h"
+#include "options.h"
+#include "wmc_auto.h"
+
+#define WMC_TOOL_SKIP
#ifdef WMOPS
static double frameRate = FRAME_RATE; /* default value : 10 ms */
-#endif /* ifdef WMOPS */
-#ifdef WMOPS
+#define MAX_RECORDS 1024
+#define MAX_STACK 64
+#define MAX_CHAR 64
+
+// struct wmops_record
+//{
+// char label[MAX_CHAR];
+// long call_number;
+// long update_cnt;
+// int call_tree[MAX_RECORDS];
+// double start_selfcnt;
+// double current_selfcnt;
+// double max_selfcnt;
+// double min_selfcnt;
+// double tot_selfcnt;
+// double start_cnt; /* The following take into account the decendants */
+// double current_cnt;
+// double max_cnt;
+// double min_cnt;
+// double tot_cnt;
+// };
+//
+// static struct wmops_record wmops[MAX_RECORDS];
+
+static int stack[MAX_STACK];
+static int sptr;
+static int sum_stack[MAX_STACK];
+
/* Global counter variable for calculation of complexity weight */
/* Some enhancement written by Vail., GJR and M.Mul. during EVS time */
BASIC_OP multiCounter[MAXCOUNTERS];
BASIC_OP glob_multiCounter;
int currCounter = 0; /* Zero equals global counter */
-#endif /* ifdef WMOPS */
-#ifdef WMOPS
void setFrameRate( int samplingFreq, int frameLength )
{
if ( frameLength > 0 )
@@ -72,9 +100,7 @@ void setFrameRate( int samplingFreq, int frameLength )
return;
}
-#endif /* ifdef WMOPS */
-#ifdef WMOPS
/*
* Below list is used for displaying the code profiling information in
* the file which name is defined by CODE_PROFILE_FILENAME.
@@ -142,10 +168,8 @@ char *BasicOperationList[] = {
#endif /* #ifdef CONTROL_CODE_OPS */
};
-#endif /* ifdef WMOPS */
-#ifdef WMOPS
const BASIC_OP op_weight = {
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
@@ -297,9 +321,9 @@ static char *my_strdup( const char *s )
#endif /* ifdef WMOPS */
-int getCounterId( char *objectNameArg )
+int getCounterId( const char *objectNameArg )
{
-#if WMOPS
+#ifdef WMOPS
if ( maxCounter >= MAXCOUNTERS - 1 )
return 0;
objectName[++maxCounter] = my_strdup( objectNameArg );
@@ -313,7 +337,7 @@ int getCounterId( char *objectNameArg )
}
-#if WMOPS
+#ifdef WMOPS
int readCounterId()
{
return currCounter;
@@ -330,7 +354,7 @@ char *readCounterIdName()
void setCounter( int counterId )
{
-#if WMOPS
+#ifdef WMOPS
if ( ( counterId > maxCounter ) || ( counterId < 0 ) )
{
currCounter = 0;
@@ -346,7 +370,7 @@ void setCounter( int counterId )
void incrementNbTimeObjectIsCalled( int counterId )
{
-#if WMOPS
+#ifdef WMOPS
if ( ( counterId > maxCounter ) || ( counterId < 0 ) )
{
nbTimeObjectIsCalled[0]++;
@@ -359,7 +383,7 @@ void incrementNbTimeObjectIsCalled( int counterId )
}
-#if WMOPS
+#ifdef WMOPS
static Word32 WMOPS_frameStat( void )
{
/* calculate the WMOPS seen so far and update the global
@@ -411,7 +435,7 @@ static void WMOPS_clearMultiCounter( void )
void ClearNbTimeObjectsAreCalled()
{
-#if WMOPS
+#ifdef WMOPS
Word16 i;
for ( i = 0; i < (Word16) ( sizeof( multiCounter[currCounter] ) / sizeof( Word32 ) ); i++ )
@@ -423,13 +447,14 @@ void ClearNbTimeObjectsAreCalled()
Word32 TotalWeightedOperation()
{
-#if WMOPS
+#ifdef WMOPS
Word16 i;
- Word32 tot, *ptr, *ptr2;
+ Word32 tot, *ptr;
+ const Word32 *ptr2;
tot = 0;
ptr = (Word32 *) &multiCounter[currCounter];
- ptr2 = (Word32 *) &op_weight;
+ ptr2 = (const Word32 *) &op_weight;
for ( i = 0; i < (Word16) ( sizeof( multiCounter[currCounter] ) / sizeof( Word32 ) ); i++ )
{
tot += ( ( *ptr++ ) * ( *ptr2++ ) );
@@ -445,7 +470,7 @@ Word32 TotalWeightedOperation()
Word32 DeltaWeightedOperation()
{
-#if WMOPS
+#ifdef WMOPS
Word32 NewWOper, delta;
NewWOper = TotalWeightedOperation();
@@ -462,7 +487,7 @@ Word32 DeltaWeightedOperation()
void Init_WMOPS_counter( void )
{
-#if WMOPS
+#ifdef WMOPS
Word16 i;
/* reset function weight operation counter variable */
@@ -507,7 +532,7 @@ void Init_WMOPS_counter( void )
Word32 Reset_WMOPS_counter( void )
{
-#if WMOPS
+#ifdef WMOPS
Word32 tot = WMOPS_frameStat();
/* increase the frame counter --> a frame is counted WHEN IT BEGINS */
@@ -535,7 +560,7 @@ Word32 Reset_WMOPS_counter( void )
Word32 fwc( void )
{
/* function worst case */
-#if WMOPS
+#ifdef WMOPS
Word32 tot;
tot = DeltaWeightedOperation();
@@ -561,7 +586,7 @@ Word32 fwc( void )
void WMOPS_output( Word16 dtx_mode )
{
-#if WMOPS
+#ifdef WMOPS
Word16 i;
Word32 tot, tot_wm, tot_wc;
@@ -596,7 +621,7 @@ void WMOPS_output( Word16 dtx_mode )
void WMOPS_output_avg( Word16 dtx_mode, Word32 *tot_wm, Word32 *num_frames )
{
-#if WMOPS
+#ifdef WMOPS
Word16 i;
Word32 tot, tot_wc;
@@ -632,10 +657,11 @@ void WMOPS_output_avg( Word16 dtx_mode, Word32 *tot_wm, Word32 *num_frames )
void generic_WMOPS_output( Word16 dtx_mode, char *test_file_name )
{
-#if WMOPS
+#ifdef WMOPS
int saved_value;
Word16 i;
- Word32 tot, tot_wm, tot_wc, *ptr, *ptr2;
+ Word32 tot, tot_wm, tot_wc, *ptr;
+ const Word32 *ptr2;
Word40 grand_total;
FILE *WMOPS_file;
@@ -744,7 +770,7 @@ void generic_WMOPS_output( Word16 dtx_mode, char *test_file_name )
tot = 0;
ptr = (Word32 *) &multiCounter[0] + i;
- ptr2 = (Word32 *) &op_weight + i;
+ ptr2 = (const Word32 *) &op_weight + i;
for ( currCounter = 0; currCounter <= maxCounter; currCounter++ )
{
tot += ( ( *ptr ) * ( *ptr2 ) );
@@ -777,17 +803,11 @@ void generic_WMOPS_output( Word16 dtx_mode, char *test_file_name )
}
/* FROM_EVS_DEV */
-#define MAX_STACK 64
-#if WMOPS
-static int stack[MAX_STACK];
-static int sptr;
-static int sum_stack[MAX_STACK];
-#endif
/* jdr 20120117: add FLC similar functions */
void BASOP_frame_update( void )
{
-#if WMOPS
+#ifdef WMOPS
int i, current;
#if MAX_CALLERS_SAVED_FRAMES
int k;
@@ -907,7 +927,7 @@ void BASOP_frame_update( void )
void printStack( char *text, char *Id )
{
-#if WMOPS
+#ifdef WMOPS
int i;
if ( !Id )
return;
@@ -927,7 +947,7 @@ void printStack( char *text, char *Id )
void BASOP_push_wmops( const char *label )
{
-#if WMOPS
+#ifdef WMOPS
int new_flag, prev_counter;
int i, j;
@@ -1004,7 +1024,7 @@ void BASOP_push_wmops( const char *label )
Word32 BASOP_pop_wmops( void )
{
-#if WMOPS
+#ifdef WMOPS
Word32 ops_cnt;
#ifdef DEBUG_COUNTER
@@ -1050,17 +1070,10 @@ Word32 BASOP_get_wops( void )
return BASOP_pop_wmops();
}
-#define FRAMES_PER_SECOND 50.0
-#define MILLION_CYCLES 1e6
-#define FAC ( FRAMES_PER_SECOND / MILLION_CYCLES )
-
-#if WMOPS
-static Word32 prom_cnt = 0;
-#endif
void WMOPS_destroy( void )
{
-#if WMOPS
+#ifdef WMOPS
int i;
/* release the memory allocated for the objectName array */
@@ -1068,7 +1081,7 @@ void WMOPS_destroy( void )
{
if ( NULL != objectName[i] )
{
- free( objectName[i] );
+ free_( objectName[i] );
objectName[i] = NULL;
}
}
@@ -1082,7 +1095,7 @@ void WMOPS_destroy( void )
void WMOPS_output_all( Word16 dtx_mode )
{
-#if WMOPS
+#ifdef WMOPS
float ops_cnt = 0.0f;
int i;
@@ -1091,7 +1104,6 @@ void WMOPS_output_all( Word16 dtx_mode )
char *sfmt = "%-40s %8s %8s %7s %7s %7s %7s %7s\n";
char *dfmt = "%-40s %8.2f %8.3f %7.3f %7.3f %7.3f %7.3f %7.3f\n";
- fprintf( stderr, "\nProgram Memory Analysis: %12.0f words\n", (float) prom_cnt );
/*fprintf (stderr, "\nInstruction Type Analysis (for worst case frame):\n\n");*/
fprintf( stderr, "\nInstruction Type Analysis (for worst case frame number %ld):\n\n", (long int) nbframe[0] ); /* added -- JPA */
for ( i = 0; i < (int) ( sizeof( BasicOperationList ) / sizeof( char * ) ); i++ )
@@ -1236,7 +1248,7 @@ void WMOPS_output_all( Word16 dtx_mode )
}
void WMOPS_output_all_std( Word16 dtx_mode )
{
-#if WMOPS
+#ifdef WMOPS
float ops_cnt = 0.0f;
int i;
@@ -1245,7 +1257,6 @@ void WMOPS_output_all_std( Word16 dtx_mode )
char *sfmt = "%-40s %8s %8s %7s %7s %7s %7s %7s\n";
char *dfmt = "%-40s %8.2f %8.3f %7.3f %7.3f %7.3f %7.3f %7.3f\n";
- fprintf( stdout, "\nProgram Memory Analysis: %12.0f words\n", (float) prom_cnt );
/*fprintf (stdout, "\nInstruction Type Analysis (for worst case frame):\n\n");*/
fprintf( stdout, "\nInstruction Type Analysis (for worst case frame number %ld):\n\n", (long int) nbframe[0] ); /* added -- JPA */
if ( nbframe[0] > 0 )
@@ -1338,7 +1349,7 @@ void WMOPS_output_all_std( Word16 dtx_mode )
void Reset_all_WMOPS_counter( void )
{
-#if WMOPS
+#ifdef WMOPS
int i;
int currCounterSave;
@@ -1359,7 +1370,7 @@ void Reset_all_WMOPS_counter( void )
/* Returns the total min/max/avg WMOPS values like printed in BASOP_end(). */
void BASOP_get_total_wmops( double *min, double *max, double *avg )
{
-#if WMOPS
+#ifdef WMOPS
if ( min != NULL )
*min = frameRate * glob_bc[0];
if ( max != NULL )
@@ -1378,3 +1389,4 @@ void BASOP_get_total_wmops( double *min, double *max, double *avg )
UNUSED_PARAM( avg );
}
/* end of file */
+#undef WMC_TOOL_SKIP
diff --git a/lib_com/count.h b/lib_com/count.h
index 1e5cd840840d2524c2c5db2d0798430044d2db73..10e96e44fad77b519fa544389b64623cad14b4be 100644
--- a/lib_com/count.h
+++ b/lib_com/count.h
@@ -60,12 +60,13 @@
#ifndef _COUNT_H
#define _COUNT_H "$Id$"
-/*#define WMOPS 1*/ /* <<<- enable or disable WMOPS profiling features here */
+#include
+
#define MAXCOUNTERS ( 512 )
#define MAX_CALLERS_SAVED_FRAMES 5 /* # of Frame for which WMOPS Complexity Details will be saved, 0 = Disabled */
-int getCounterId( char *objectName );
+int getCounterId( const char *objectName );
/*
* Create a counter group, the "objectname" will be used when printing
* statistics for this counter group.
@@ -586,30 +587,6 @@ void BASOP_get_total_wmops( double *min, double *max, double *avg );
#define END_SUB_WMOPS BASOP_sub_end()
-#if !defined WMOPS_FL //&& defined WMOPS
-#include
-#define reset_wmops() BASOP_init
-// extern int cntr_push_pop;
-#define push_wmops( x ) \
- { \
- BASOP_push_wmops( x ); \
- }
-#define pop_wmops() \
- { \
- BASOP_pop_wmops(); \
- }
-#define update_wmops() \
- { \
- BASOP_frame_update(); \
- }
-#define print_wmops() \
- { \
- WMOPS_output_all_std( 0 ); \
- }
-#define update_mem() ;
-#endif
-
-
#endif /* _COUNT_H */
diff --git a/lib_com/enh1632.c b/lib_com/enh1632.c
index 3704c2bd39f729cb73b8e456bc9cca713647682b..1e6c41a0ef9ccb5b558dbb021ee700875ad16f2c 100644
--- a/lib_com/enh1632.c
+++ b/lib_com/enh1632.c
@@ -56,7 +56,9 @@
#include
#include "stl.h"
-#if ( WMOPS )
+#define WMC_TOOL_SKIP
+
+#ifdef WMOPS
extern BASIC_OP multiCounter[MAXCOUNTERS];
extern int currCounter;
#endif /* ifdef WMOPS */
@@ -117,7 +119,7 @@ Word16 lshl( Word16 var1, Word16 var2 )
var2 = -var2;
var_out = lshr( var1, var2 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].lshr--;
#endif /* ifdef WMOPS */
}
@@ -136,7 +138,7 @@ Word16 lshl( Word16 var1, Word16 var2 )
var_out = var1 << var2;
}
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].lshl++;
#endif /* ifdef WMOPS */
@@ -184,7 +186,7 @@ Word16 lshr( Word16 var1, Word16 var2 )
var2 = -var2;
var_out = lshl( var1, var2 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].lshl--;
#endif /* ifdef WMOPS */
}
@@ -205,7 +207,7 @@ Word16 lshr( Word16 var1, Word16 var2 )
var_out = var_out >> ( var2 - 1 );
}
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].lshr++;
#endif /* ifdef WMOPS */
@@ -254,7 +256,7 @@ Word32 L_lshl( Word32 L_var1, Word16 var2 )
var2 = -var2;
L_var_out = L_lshr( L_var1, var2 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].L_lshr--;
#endif /* ifdef WMOPS */
}
@@ -273,7 +275,7 @@ Word32 L_lshl( Word32 L_var1, Word16 var2 )
L_var_out = L_var1 << var2;
}
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].L_lshl++;
#endif /* ifdef WMOPS */
@@ -322,7 +324,7 @@ Word32 L_lshr( Word32 L_var1, Word16 var2 )
var2 = -var2;
L_var_out = L_lshl( L_var1, var2 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].L_lshl--;
#endif /* ifdef WMOPS */
}
@@ -343,7 +345,7 @@ Word32 L_lshr( Word32 L_var1, Word16 var2 )
L_var_out = L_var_out >> ( var2 - 1 );
}
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].L_lshr++;
#endif /* ifdef WMOPS */
@@ -382,11 +384,10 @@ Word32 L_lshr( Word32 L_var1, Word16 var2 )
*****************************************************************************/
#ifdef BASOP_NOGLOB
Word16 shl_ro( Word16 var1, Word16 var2, Flag *Overflow )
-{
#else
Word16 shl_r( Word16 var1, Word16 var2 )
-{
#endif
+{
Word16 var_out;
if ( var2 >= 0 )
@@ -396,7 +397,7 @@ Word16 shl_r( Word16 var1, Word16 var2 )
#else
var_out = shl( var1, var2 );
#endif
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].shl--;
#endif /* ifdef WMOPS */
}
@@ -408,12 +409,12 @@ Word16 shl_r( Word16 var1, Word16 var2 )
#else
var_out = shr_r( var1, var2 );
#endif
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].shr_r--;
#endif /* ifdef WMOPS */
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].shl_r++;
#endif /* ifdef WMOPS */
@@ -462,7 +463,7 @@ Word32 L_shl_r( Word32 L_var1, Word16 var2 )
{
var_out = L_shl( L_var1, var2 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].L_shl--;
#endif /* ifdef WMOPS */
}
@@ -471,12 +472,12 @@ Word32 L_shl_r( Word32 L_var1, Word16 var2 )
var2 = -var2;
var_out = L_shr_r( L_var1, var2 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].L_shr_r--;
#endif /* ifdef WMOPS */
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].L_shl_r++;
#endif /* ifdef WMOPS */
@@ -521,7 +522,7 @@ Word16 rotr( Word16 var1, Word16 var2, Word16 *var3 )
*var3 = s_and( var1, 0x1 );
var_out = s_or( lshr( var1, 1 ), lshl( var2, 15 ) );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].s_and--;
multiCounter[currCounter].lshl--;
multiCounter[currCounter].lshr--;
@@ -571,7 +572,7 @@ Word16 rotl( Word16 var1, Word16 var2, Word16 *var3 )
var_out = s_or( lshl( var1, 1 ), s_and( var2, 0x1 ) );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].lshr--;
multiCounter[currCounter].s_and--;
multiCounter[currCounter].lshl--;
@@ -621,7 +622,7 @@ Word32 L_rotr( Word32 L_var1, Word16 var2, Word16 *var3 )
L_var_out = L_or( L_lshr( L_var1, 1 ), L_lshl( L_deposit_l( var2 ), 31 ) );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].extract_l--;
multiCounter[currCounter].s_and--;
multiCounter[currCounter].L_deposit_l--;
@@ -673,7 +674,7 @@ Word32 L_rotl( Word32 L_var1, Word16 var2, Word16 *var3 )
L_var_out = L_or( L_lshl( L_var1, 1 ), L_deposit_l( s_and( var2, 0x1 ) ) );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].L_lshr--;
multiCounter[currCounter].extract_l--;
multiCounter[currCounter].s_and--;
@@ -686,5 +687,6 @@ Word32 L_rotl( Word32 L_var1, Word16 var2, Word16 *var3 )
return ( L_var_out );
}
+#undef WMC_TOOL_SKIP
/* end of file */
diff --git a/lib_com/enh1632.h b/lib_com/enh1632.h
index 2ef87cd64a2bf56d25b2bbf230a8874b1a46dbb5..1477c6c8093b3048dcf64e3fbc2b874d49dc9945 100644
--- a/lib_com/enh1632.h
+++ b/lib_com/enh1632.h
@@ -36,7 +36,7 @@
#include "stl.h"
-#if ( WMOPS )
+#ifdef WMOPS
#include "count.h"
extern BASIC_OP multiCounter[MAXCOUNTERS];
extern int currCounter;
@@ -109,7 +109,7 @@ static __inline Word16 s_max( Word16 var1, Word16 var2 )
else
var_out = var2;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].s_max++;
#endif /* ifdef WMOPS */
@@ -154,7 +154,7 @@ static __inline Word16 s_min( Word16 var1, Word16 var2 )
else
var_out = var2;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].s_min++;
#endif /* ifdef WMOPS */
@@ -199,7 +199,7 @@ static __inline Word32 L_max( Word32 L_var1, Word32 L_var2 )
else
L_var_out = L_var2;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].L_max++;
#endif /* ifdef WMOPS */
@@ -244,7 +244,7 @@ static __inline Word32 L_min( Word32 L_var1, Word32 L_var2 )
else
L_var_out = L_var2;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].L_min++;
#endif /* ifdef WMOPS */
@@ -287,7 +287,7 @@ static __inline Word16 s_and( Word16 var1, Word16 var2 )
var_out = var1 & var2;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].s_and++;
#endif /* ifdef WMOPS */
@@ -330,7 +330,7 @@ static __inline Word32 L_and( Word32 L_var1, Word32 L_var2 )
L_var_out = L_var1 & L_var2;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].L_and++;
#endif /* ifdef WMOPS */
@@ -373,7 +373,7 @@ static __inline Word16 s_or( Word16 var1, Word16 var2 )
var_out = var1 | var2;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].s_or++;
#endif /* ifdef WMOPS */
@@ -417,7 +417,7 @@ static __inline Word32 L_or( Word32 L_var1, Word32 L_var2 )
L_var_out = L_var1 | L_var2;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].L_or++;
#endif /* ifdef WMOPS */
@@ -460,7 +460,7 @@ static __inline Word16 s_xor( Word16 var1, Word16 var2 )
var_out = var1 ^ var2;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].s_xor++;
#endif /* ifdef WMOPS */
@@ -503,7 +503,7 @@ static __inline Word32 L_xor( Word32 L_var1, Word32 L_var2 )
L_var_out = L_var1 ^ L_var2;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].L_xor++;
#endif /* ifdef WMOPS */
diff --git a/lib_com/enh32.c b/lib_com/enh32.c
index 3fb1148fcda0cd6eac261c5cb089b47112ebae6b..d2466ce6423561dc4139627fcb0c8e1ac3bb7493 100644
--- a/lib_com/enh32.c
+++ b/lib_com/enh32.c
@@ -23,7 +23,9 @@
#include
#include "enh32.h"
-#if ( WMOPS )
+#define WMC_TOOL_SKIP
+
+#ifdef WMOPS
extern BASIC_OP multiCounter[MAXCOUNTERS];
extern int currCounter;
#endif /* if WMOPS */
@@ -51,7 +53,7 @@ extern int currCounter;
Word32 Mpy_32_16_1( Word32 L_var1, Word16 var2 )
{
Word32 L_var_out = W_sat_m( W_mult_32_16( L_var1, var2 ) );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_16_1++;
multiCounter[currCounter].W_mult_32_16--;
multiCounter[currCounter].W_sat_m--;
@@ -62,7 +64,7 @@ Word32 Mpy_32_16_1( Word32 L_var1, Word16 var2 )
Word32 Mpy_32_16_r( Word32 L_var1, Word16 var2 )
{
Word32 L_var_out = W_round48_L( W_mult_32_16( L_var1, var2 ) );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_16_r++;
multiCounter[currCounter].W_mult_32_16--;
multiCounter[currCounter].W_round48_L--;
@@ -85,7 +87,7 @@ Word32 Mpy_32_32( Word32 L_var1, Word32 L_var2 )
L64_var1 = W_shl( L64_var1, 1 );
#endif /* BASOP_NOGLOB */
L_var_out = W_extract_h( L64_var1 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_32++;
multiCounter[currCounter].W_shl--;
multiCounter[currCounter].W_extract_h--;
@@ -101,7 +103,7 @@ Word32 Mpy_32_32_r( Word32 L_var1, Word32 L_var2 )
L64_var1 = ( (Word64) L_var1 * L_var2 );
L64_var1 = W_shr( L64_var1, 15 );
L_var_out = W_round48_L( L64_var1 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_32_r++;
multiCounter[currCounter].W_shr--;
multiCounter[currCounter].W_round48_L--;
@@ -123,7 +125,7 @@ Word32 Madd_32_16( Word32 L_var3, Word32 L_var1, Word16 var2 )
L_var_out = L_add( L_var3, L_var_out );
#endif /* BASOP_NOGLOB */
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_16_1--;
multiCounter[currCounter].L_add--;
multiCounter[currCounter].Madd_32_16++;
@@ -138,7 +140,7 @@ Word32 Madd_32_16_r( Word32 L_var3, Word32 L_var1, Word16 var2 )
L_var_out = Mpy_32_16_r( L_var1, var2 );
L_var_out = L_add( L_var3, L_var_out );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_16_r--;
multiCounter[currCounter].L_add--;
multiCounter[currCounter].Madd_32_16_r++;
@@ -160,7 +162,7 @@ Word32 Msub_32_16( Word32 L_var3, Word32 L_var1, Word16 var2 )
L_var_out = L_sub( L_var3, L_var_out );
#endif
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_16_1--;
multiCounter[currCounter].L_sub--;
multiCounter[currCounter].Msub_32_16++;
@@ -175,7 +177,7 @@ Word32 Msub_32_16_r( Word32 L_var3, Word32 L_var1, Word16 var2 )
L_var_out = Mpy_32_16_r( L_var1, var2 );
L_var_out = L_sub( L_var3, L_var_out );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_16_r--;
multiCounter[currCounter].L_sub--;
multiCounter[currCounter].Msub_32_16_r++;
@@ -190,7 +192,7 @@ Word32 Madd_32_32( Word32 L_var3, Word32 L_var1, Word32 L_var2 )
L_var_out = Mpy_32_32( L_var1, L_var2 );
L_var_out = L_add( L_var3, L_var_out );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_32--;
multiCounter[currCounter].L_add--;
multiCounter[currCounter].Madd_32_32++;
@@ -205,7 +207,7 @@ Word32 Madd_32_32_r( Word32 L_var3, Word32 L_var1, Word32 L_var2 )
L_var_out = Mpy_32_32_r( L_var1, L_var2 );
L_var_out = L_add( L_var3, L_var_out );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_32_r--;
multiCounter[currCounter].L_add--;
multiCounter[currCounter].Madd_32_32_r++;
@@ -220,7 +222,7 @@ Word32 Msub_32_32( Word32 L_var3, Word32 L_var1, Word32 L_var2 )
L_var_out = Mpy_32_32( L_var1, L_var2 );
L_var_out = L_sub( L_var3, L_var_out );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_32--;
multiCounter[currCounter].L_sub--;
multiCounter[currCounter].Msub_32_32++;
@@ -235,7 +237,7 @@ Word32 Msub_32_32_r( Word32 L_var3, Word32 L_var1, Word32 L_var2 )
L_var_out = Mpy_32_32_r( L_var1, L_var2 );
L_var_out = L_sub( L_var3, L_var_out );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_32_r--;
multiCounter[currCounter].L_sub--;
multiCounter[currCounter].Msub_32_32_r++;
@@ -244,5 +246,6 @@ Word32 Msub_32_32_r( Word32 L_var3, Word32 L_var1, Word32 L_var2 )
}
#endif /* #ifdef ENH_32_BIT_OPERATOR */
+#undef WMC_TOOL_SKIP
/* end of file */
diff --git a/lib_com/enh64.c b/lib_com/enh64.c
index dda2d451b6e0e13ce1689fdda506acdbd7044e53..0571277fe1afd638a168a5b25ecf47155be300c3 100644
--- a/lib_com/enh64.c
+++ b/lib_com/enh64.c
@@ -18,7 +18,9 @@
#include
#include "enh64.h"
-#if ( WMOPS )
+#define WMC_TOOL_SKIP
+
+#ifdef WMOPS
extern BASIC_OP multiCounter[MAXCOUNTERS];
extern int currCounter;
#endif /* if WMOPS */
@@ -81,7 +83,7 @@ Word64 W_add_nosat( Word64 L64_var1, Word64 L64_var2 )
L64_var_out = L64_var1 + L64_var2;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_add_nosat++;
#endif
@@ -124,7 +126,7 @@ Word64 W_sub_nosat( Word64 L64_var1, Word64 L64_var2 )
L64_var_out = L64_var1 - L64_var2;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_sub_nosat++;
#endif
@@ -167,11 +169,10 @@ Word64 W_sub_nosat( Word64 L64_var1, Word64 L64_var2 )
*/
#ifdef BASOP_NOGLOB
Word64 W_shl_o( Word64 L64_var1, Word16 var2, Flag *Overflow )
-{
#else /* BASOP_NOGLOB */
Word64 W_shl( Word64 L64_var1, Word16 var2 )
-{
#endif /* BASOP_NOGLOB */
+{
Word64 L64_var_out = 0LL;
@@ -213,7 +214,7 @@ Word64 W_shl( Word64 L64_var1, Word16 var2 )
L64_var_out = L64_var1;
}
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_shl++;
#endif
@@ -272,7 +273,7 @@ Word64 W_shr( Word64 L64_var1, Word16 var2 )
var2 = -var2;
L64_var_out = W_shl( L64_var1, var2 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_shl--;
#endif /* if WMOPS */
}
@@ -281,7 +282,7 @@ Word64 W_shr( Word64 L64_var1, Word16 var2 )
L64_var_out = L64_var1 >> var2;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_shr++;
#endif /* if WMOPS */
@@ -337,7 +338,7 @@ Word64 W_shl_nosat( Word64 L64_var1, Word16 var2 )
{
L64_var_out = L64_var1 << var2;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_shl_nosat++;
#endif
@@ -395,7 +396,7 @@ Word64 W_shr_nosat( Word64 L64_var1, Word16 var2 )
L64_var_out = L64_var1 >> var2;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_shr_nosat++;
#endif /* if WMOPS */
@@ -443,7 +444,7 @@ Word64 W_mac_32_16( Word64 L64_var1, Word32 L_var2, Word16 var3 )
{
Word64 L64_var_out = ( (Word64) L_var2 * var3 ) << 1;
L64_var_out += L64_var1;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_mac_32_16++;
#endif /* if WMOPS */
return L64_var_out;
@@ -490,7 +491,7 @@ Word64 W_msu_32_16( Word64 L64_var1, Word32 L_var2, Word16 var3 )
{
Word64 L64_var_out = ( (Word64) L_var2 * var3 ) << 1;
L64_var_out = L64_var1 - L64_var_out;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_msu_32_16++;
#endif /* if WMOPS */
return L64_var_out;
@@ -531,7 +532,7 @@ Word64 W_msu_32_16( Word64 L64_var1, Word32 L_var2, Word16 var3 )
Word64 W_mult_32_16( Word32 L_var1, Word16 var2 )
{
Word64 L64_var_out = ( (Word64) L_var1 * var2 ) << 1;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_mult_32_16++;
#endif /* if WMOPS */
return L64_var_out;
@@ -571,7 +572,7 @@ Word64 W_mult_32_16( Word32 L_var1, Word16 var2 )
Word64 W_mult0_16_16( Word16 var1, Word16 var2 )
{
Word64 L64_var_out = (Word64) var1 * var2;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_mult0_16_16++;
#endif /* if WMOPS */
return L64_var_out;
@@ -616,7 +617,7 @@ Word64 W_mac0_16_16( Word64 L64_var1, Word16 var2, Word16 var3 )
{
Word64 L64_var_out = (Word64) var2 * var3;
L64_var_out += L64_var1;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_mac0_16_16++;
#endif /* if WMOPS */
return L64_var_out;
@@ -662,7 +663,7 @@ Word64 W_msu0_16_16( Word64 L64_var1, Word16 var2, Word16 var3 )
{
Word64 L64_var_out = (Word64) var2 * var3;
L64_var_out = L64_var1 - L64_var_out;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_msu0_16_16++;
#endif /* if WMOPS */
return L64_var_out;
@@ -713,7 +714,7 @@ Word32 W_sat_l( Word64 L64_var )
L_var_out = (Word32) L64_var;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_sat_l++;
#endif /* if WMOPS */
@@ -756,7 +757,7 @@ Word32 W_sat_m( Word64 L64_var )
L64_var = L64_var >> 16;
L_var_out = W_sat_l( L64_var );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_sat_l--;
multiCounter[currCounter].W_sat_m++;
#endif /* if WMOPS */
@@ -798,7 +799,7 @@ Word64 W_deposit32_l( Word32 L_var1 )
L64_var_out = (Word64) L_var1;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_deposit32_l++;
#endif
@@ -839,7 +840,7 @@ Word64 W_deposit32_h( Word32 L_var1 )
L64_var_out = (Word64) L_var1 << 32;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_deposit32_h++;
#endif
@@ -880,7 +881,7 @@ Word32 W_extract_l( Word64 L64_var1 )
L_var_out = (Word32) L64_var1;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_extract_l++;
#endif /* if WMOPS */
@@ -921,7 +922,7 @@ Word32 W_extract_h( Word64 L64_var1 )
L_var_out = (Word32) ( L64_var1 >> 32 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_extract_h++;
#endif /* if WMOPS */
@@ -963,7 +964,7 @@ Word32 W_extract_h( Word64 L64_var1 )
Word64 W_mult_16_16( Word16 var1, Word16 var2 )
{
Word64 L64_var_out = ( (Word64) var1 * var2 ) << 1;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_mult_16_16++;
#endif /* if WMOPS */
return L64_var_out;
@@ -1009,7 +1010,7 @@ Word64 W_mac_16_16( Word64 L64_acc, Word16 var1, Word16 var2 )
Word64 L64_var_out = ( (Word64) var1 * var2 ) << 1;
L64_acc = L64_acc + L64_var_out;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_mac_16_16++;
#endif /* if WMOPS */
return L64_acc;
@@ -1056,7 +1057,7 @@ Word64 W_msu_16_16( Word64 L64_var1, Word16 var2, Word16 var3 )
{
Word64 L64_var_out = ( (Word64) var2 * var3 ) << 1;
L64_var_out = L64_var1 - L64_var_out;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_msu_16_16++;
#endif /* if WMOPS */
return L64_var_out;
@@ -1104,7 +1105,7 @@ Word64 W_mac_32_32( Word64 L64_var1, Word32 L_var2, Word32 L_var3 )
Word64 L64_var_out = W_mult_32_32( L_var2, L_var3 );
L64_var_out = W_add( L64_var1, L64_var_out );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_mult_32_32--;
/* multiCounter[currCounter].W_add--; */
#endif
@@ -1153,7 +1154,7 @@ Word32 W_shl_sat_l( Word64 L64_var, Word16 n )
d_var_64 = W_shl( L64_var, n );
L_result = W_sat_l( d_var_64 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_shl_sat_l++;
multiCounter[currCounter].W_shl--;
multiCounter[currCounter].W_sat_l--;
@@ -1192,11 +1193,10 @@ Word32 W_shl_sat_l( Word64 L64_var, Word16 n )
*/
#ifdef BASOP_NOGLOB
Word32 W_round48_L_o( Word64 L64_var1, Flag *Overflow )
-{
#else /* BASOP_NOGLOB */
Word32 W_round48_L( Word64 L64_var1 )
-{
#endif /* BASOP_NOGLOB */
+{
Word64 L64_var_out;
Word32 L_result;
@@ -1221,7 +1221,7 @@ Word32 W_round48_L( Word64 L64_var1 )
}
}
L_result = W_extract_h( L64_var_out );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_round48_L++;
multiCounter[currCounter].W_extract_h--;
multiCounter[currCounter].W_shl--;
@@ -1266,11 +1266,10 @@ Word32 W_round48_L( Word64 L64_var1 )
*/
#ifdef BASOP_NOGLOB
Word16 W_round32_s_o( Word64 L64_var1, Flag *Overflow )
-{
#else /* BASOP_NOGLOB */
Word16 W_round32_s( Word64 L64_var1 )
-{
#endif /* BASOP_NOGLOB */
+{
Word64 L64_var_out;
Word32 L_var;
Word16 var_out;
@@ -1297,7 +1296,7 @@ Word16 W_round32_s( Word64 L64_var1 )
}
L_var = W_extract_h( L64_var_out );
var_out = extract_h( L_var );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_round32_s++;
multiCounter[currCounter].W_extract_h--;
multiCounter[currCounter].extract_h--;
@@ -1367,7 +1366,7 @@ Word16 W_norm( Word64 L64_var1 )
}
}
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_norm++;
#endif /* if WMOPS */
return ( var_out );
@@ -1407,11 +1406,10 @@ Word16 W_norm( Word64 L64_var1 )
*/
#ifdef BASOP_NOGLOB
Word64 W_add_o( Word64 L64_var1, Word64 L64_var2, Flag *Overflow )
-{
#else /* BASOP_NOGLOB */
Word64 W_add( Word64 L64_var1, Word64 L64_var2 )
-{
#endif /* BASOP_NOGLOB */
+{
Word64 L64_var_out;
L64_var_out = L64_var1 + L64_var2;
@@ -1429,7 +1427,7 @@ Word64 W_add( Word64 L64_var1, Word64 L64_var2 )
}
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_add++;
#endif
return L64_var_out;
@@ -1475,11 +1473,10 @@ Word64 W_add( Word64 L64_var1, Word64 L64_var2 )
*/
#ifdef BASOP_NOGLOB
Word64 W_sub_o( Word64 L64_var1, Word64 L64_var2, Flag *Overflow )
-{
#else /* BASOP_NOGLOB */
Word64 W_sub( Word64 L64_var1, Word64 L64_var2 )
-{
#endif /* BASOP_NOGLOB */
+{
Word64 L64_var_out;
L64_var_out = L64_var1 - L64_var2;
@@ -1497,7 +1494,7 @@ Word64 W_sub( Word64 L64_var1, Word64 L64_var2 )
}
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_add++;
#endif
return L64_var_out;
@@ -1540,11 +1537,10 @@ Word64 W_sub( Word64 L64_var1, Word64 L64_var2 )
*/
#ifdef BASOP_NOGLOB
Word64 W_neg_o( Word64 L64_var1, Flag *Overflow )
-{
#else /* BASOP_NOGLOB */
Word64 W_neg( Word64 L64_var1 )
-{
#endif /* BASOP_NOGLOB */
+{
Word64 L64_var_out;
if ( L64_var1 == MIN_64 )
@@ -1561,7 +1557,7 @@ Word64 W_neg( Word64 L64_var1 )
L64_var_out = -L64_var1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_neg++;
#endif
@@ -1605,11 +1601,10 @@ Word64 W_neg( Word64 L64_var1 )
*/
#ifdef BASOP_NOGLOB
Word64 W_abs_o( Word64 L64_var1, Flag *Overflow )
-{
#else /* BASOP_NOGLOB */
Word64 W_abs( Word64 L64_var1 )
-{
#endif /* BASOP_NOGLOB */
+{
Word64 L64_var_out;
if ( L64_var1 == MIN_64 )
@@ -1633,7 +1628,7 @@ Word64 W_abs( Word64 L64_var1 )
}
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_abs++;
#endif
@@ -1681,11 +1676,10 @@ Word64 W_abs( Word64 L64_var1 )
*/
#ifdef BASOP_NOGLOB
Word64 W_mult_32_32_o( Word32 L_var1, Word32 L_var2, Flag *Overflow )
-{
#else /* BASOP_NOGLOB */
Word64 W_mult_32_32( Word32 L_var1, Word32 L_var2 )
-{
#endif /* BASOP_NOGLOB */
+{
Word64 L64_var_out;
if ( ( L_var1 == MIN_32 ) && ( L_var2 == MIN_32 ) )
@@ -1702,7 +1696,7 @@ Word64 W_mult_32_32( Word32 L_var1, Word32 L_var2 )
L64_var_out = ( (Word64) L_var1 * L_var2 ) << 1;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_mult_32_32++;
#endif /* if WMOPS */
return L64_var_out;
@@ -1753,7 +1747,7 @@ Word64 W_mult0_32_32( Word32 L_var1, Word32 L_var2 )
L64_var_out = (Word64) L_var1 * L_var2;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_mult0_32_32++;
#endif /* if WMOPS */
return L64_var_out;
@@ -1805,7 +1799,7 @@ UWord64 W_lshl( UWord64 L64_var1, Word16 var2 )
{
L64_var_out = L64_var1 << var2;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_lshl++;
#endif
@@ -1857,7 +1851,7 @@ UWord64 W_lshr( UWord64 L64_var1, Word16 var2 )
{
L64_var_out = L64_var1 >> var2;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_lshr++;
#endif
@@ -1902,7 +1896,7 @@ Word32 W_round64_L( Word64 L64_var1 )
L64_var_out = W_add( L64_var1, L64_tmp );
L_result = W_extract_h( L64_var_out );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].W_round64_L++;
multiCounter[currCounter].W_extract_h--;
multiCounter[currCounter].W_add--;
@@ -1912,5 +1906,6 @@ Word32 W_round64_L( Word64 L64_var1 )
}
#endif /* #ifdef ENH_64_BIT_OPERATOR */
+#undef WMC_TOOL_SKIP
/* end of file */
diff --git a/lib_com/enhUL32.c b/lib_com/enhUL32.c
index 0aa21b4fcf3789ed72a7c8c6bac0b3d0c1b7e8e4..ff1c684250c24dece2d10241aab626895ae16818 100644
--- a/lib_com/enhUL32.c
+++ b/lib_com/enhUL32.c
@@ -27,7 +27,9 @@
#include "stl.h"
#include "enhUL32.h"
-#if ( WMOPS )
+#define WMC_TOOL_SKIP
+
+#ifdef WMOPS
extern BASIC_OP multiCounter[MAXCOUNTERS];
extern int currCounter;
#endif /* if WMOPS */
@@ -62,7 +64,7 @@ UWord32 UL_deposit_l( UWord16 uvar )
{
UWord32 UL_result;
UL_result = (UWord32) uvar; /* no sign extension*/
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].UL_deposit_l++;
#endif
return ( UL_result );
@@ -113,7 +115,7 @@ Word16 norm_ul_float (UWord32 UL_var1) {
}
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].norm_ul_float++;
#endif
@@ -155,7 +157,7 @@ UWord32 UL_addNs( UWord32 UL_var1, UWord32 UL_var2, UWord16 *wrap )
*wrap = 0;
}
-#if WMOPS
+#ifdef WMOPS
multiCounter[currCounter].UL_addNs++;
#endif
@@ -195,7 +197,7 @@ UWord32 UL_subNs( UWord32 UL_var1, UWord32 UL_var2, UWord16 *sgn )
*sgn = 1; /* "negative", wrapped output */
}
-#if WMOPS
+#ifdef WMOPS
multiCounter[currCounter].UL_subNs++;
#endif
return UL_var3;
@@ -247,7 +249,7 @@ void Mpy_32_16_uu( UWord32 UL_var1, UWord16 uvar2, UWord32 *UL_varout_h, UWord16
*varout_l = (UWord16) UL64_var1;
*UL_varout_h = (UWord32) ( UL64_var1 >> 16 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_16_uu++;
#endif /* if WMOPS */
@@ -297,7 +299,7 @@ void Mpy_32_32_uu( UWord32 UL_var1, UWord32 UL_var2, UWord32 *UL_varout_h, UWord
*UL_varout_h = (UWord32) ( UL64_var1 >> 32 );
*UL_varout_l = (UWord32) ( UL64_var1 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].Mpy_32_32_uu++;
#endif /* if WMOPS */
@@ -350,7 +352,7 @@ UWord32 UL_Mpy_32_32( UWord32 UL_var1, UWord32 UL_var2 )
UL_varout_l = UL_varout_l & MASK32;
#undef MASK32
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].UL_Mpy_32_32++;
#endif /* if WMOPS */
@@ -417,5 +419,6 @@ UWord32 UL_addNsD( UWord32 UL_var1, UWord32 UL_var2 )
#endif
#endif /* ENH_U_32_BIT_OPERATOR */
+#undef WMC_TOOL_SKIP
/* end of file */
diff --git a/lib_com/enhUL32.h b/lib_com/enhUL32.h
index 240dead793f3cc8177be74a7b0f71cb038f5d6b9..39a79d700d330a41545a87b301b5ae1745581495 100644
--- a/lib_com/enhUL32.h
+++ b/lib_com/enhUL32.h
@@ -24,7 +24,7 @@
#define UWord64 unsigned long long /* for local use inside UL_Mpy_32_* */
#endif
-#if ( WMOPS )
+#ifdef WMOPS
#include "count.h"
extern BASIC_OP multiCounter[MAXCOUNTERS]; /* existing signed counters are reused for unsigedn operators */
extern int currCounter;
diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c
index a42a85a1590b0c46fb30baff9661cb77e7d41ce8..16a5ae86940982922c8681a1b6097c0fbd1b1ea3 100644
--- a/lib_com/fd_cng_com_fx.c
+++ b/lib_com/fd_cng_com_fx.c
@@ -35,7 +35,7 @@ ivas_error createFdCngCom(
HANDLE_FD_CNG_COM hs;
/* Allocate memory */
- hs = (HANDLE_FD_CNG_COM) count_malloc( sizeof( FD_CNG_COM ) );
+ hs = (HANDLE_FD_CNG_COM) malloc( sizeof( FD_CNG_COM ) );
if ( hs == NULL )
{
@@ -287,7 +287,7 @@ void deleteFdCngCom( HANDLE_FD_CNG_COM *hFdCngCom ) /* i/o: Contains the variabl
move16();
IF( hsCom != NULL )
{
- count_free( hsCom );
+ free( hsCom );
*hFdCngCom = NULL;
move16();
}
diff --git a/lib_com/fft_cldfb_fx.c b/lib_com/fft_cldfb_fx.c
index d60a285f5561ca43ee3b695f4fa7af6ed3bc5633..dcc86b94ffb05cb0962982f9a06badb4f6623ad8 100644
--- a/lib_com/fft_cldfb_fx.c
+++ b/lib_com/fft_cldfb_fx.c
@@ -186,7 +186,7 @@ static void fft8_with_cmplx_data( cmplx *inp )
inp[1] = CL_add( s5, s6 );
inp[5] = CL_sub( s5, s6 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move += 8;
#endif
}
@@ -244,7 +244,7 @@ static void fft5_with_cmplx_data( cmplx *inp )
inp[2] = CL_mac_j( y3, y4 );
inp[3] = CL_msu_j( y3, y4 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move += 5;
#endif
}
@@ -351,7 +351,7 @@ static void fft10_with_cmplx_data( cmplx *inp_data )
inp_data[3] = CL_sub( y[8], y[9] );
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move += 10;
#endif
}
@@ -598,7 +598,7 @@ static void fft20_with_cmplx_data( cmplx *inp_data )
inp_data[11] = CL_mac_j( t1, t3 );
}
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move += 20;
#endif
}
@@ -1037,7 +1037,7 @@ static void fft30_with_cmplx_data( cmplx *inp )
l += 1;
h += 1;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move += 30;
#endif
}
diff --git a/lib_com/fft_evs.c b/lib_com/fft_evs.c
index 56b735804472042cf19e8d6f9dd97bfa78533dbb..0a59cbb64e8126ff9963803dddc553e62c18bf56 100644
--- a/lib_com/fft_evs.c
+++ b/lib_com/fft_evs.c
@@ -181,7 +181,7 @@ static void fft5_with_cmplx_data( cmplx *inp )
inp[2] = CL_mac_j( y3, y4 );
inp[3] = CL_msu_j( y3, y4 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move += 5;
#endif
}
@@ -261,7 +261,7 @@ static void fft8_with_cmplx_data( cmplx *inp )
inp[1] = CL_add( s5, s6 );
inp[5] = CL_sub( s5, s6 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move += 8;
#endif
}
@@ -370,7 +370,7 @@ static void fft10_with_cmplx_data( cmplx *inp_data )
inp_data[3] = CL_sub( y[8], y[9] );
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move += 10;
#endif
}
@@ -521,7 +521,7 @@ static void fft15_with_cmplx_data( cmplx *inp_data )
inp_data[4] = CL_mac_j( c_y1, c_y2 );
inp_data[14] = CL_msu_j( c_y1, c_y2 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move += 15;
#endif
}
@@ -755,7 +755,7 @@ void fft16_with_cmplx_data( cmplx *input, Word16 bScale )
input[11] = CL_sub( t0, t4 );
input[15] = CL_mac_j( t2, t7 );
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move += 16;
#endif
}
@@ -1003,7 +1003,7 @@ static void fft20_with_cmplx_data( cmplx *inp_data )
inp_data[11] = CL_mac_j( t1, t3 );
}
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move += 20;
#endif
}
@@ -1443,7 +1443,7 @@ static void fft30_with_cmplx_data( cmplx *inp )
l += 1;
h += 1;
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move += 30;
#endif
}
@@ -1816,7 +1816,7 @@ static void fft32_with_cmplx_data( cmplx *inp )
inp[23] = CL_sub( t[0], t[2] );
inp[31] = CL_add( t[1], t[3] );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move += 32;
#endif
}
@@ -1861,7 +1861,7 @@ static void fftN2(
FOR( j = 0; j < dim1; j++ )
{
x_cmplx[i * dim1 + j] = pComplexBuf[i + j * dim2];
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move++;
#endif
}
@@ -2142,7 +2142,7 @@ static void fftN2(
}
BREAK;
}
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move += len;
#endif
}
diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c
index 5ba9b55a632b61ab8ca8638af242a9a6cadfe769..7a081f35137dabf9796d96f7fcb8f07e9e3b1018 100644
--- a/lib_com/float_to_fix_ops.c
+++ b/lib_com/float_to_fix_ops.c
@@ -5,6 +5,7 @@
#include "options.h"
#include "prot.h"
#include "prot_fx.h"
+#define WMC_TOOL_SKIP
Word32 floatToFixed( float f, Word16 Q )
{
@@ -14,9 +15,9 @@ Word32 floatToFixed( float f, Word16 Q )
if ( f == 1.0f && Q == Q31 )
return MAXVAL_WORD32;
if ( Q < 0 )
- result_32 = (Word64) ( (float) ( f ) / (double) ( 1llu << ( -Q ) ) + ( f >= 0 ? 0.5 : -0.5 ) );
+ result_32 = (Word64) ( (float) ( f ) / (double) ( (unsigned Word64) 1 << ( -Q ) ) + ( f >= 0 ? 0.5 : -0.5 ) );
else
- result_32 = (Word64) ( f * (double) ( 1llu << Q ) + ( f >= 0 ? 0.5 : -0.5 ) );
+ 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 )
@@ -24,6 +25,7 @@ Word32 floatToFixed( float f, Word16 Q )
return (Word32) result_32;
}
+
float fixedToFloat( Word32 i, Word16 Q )
{
if ( Q < 0 )
@@ -36,7 +38,7 @@ void floatToFixed_arrL( float *f, Word32 *i, Word16 Q, Word16 l )
for ( int j = 0; j < l; j++ )
{
#if 0
- i[j] = floatToFixed(f[j], Q);
+ i[j] = floatToFixed(f[j], Q);
#else
Word64 i64_val = floatToFixed( f[j], Q );
IF( i64_val > MAX_32 )
@@ -150,7 +152,7 @@ void floatToFixed_arr( float *f, Word16 *i, Word16 Q, Word16 l )
for ( int j = 0; j < l; j++ )
{
#if 0
- i[j] = (Word16)floatToFixed(f[j], Q);
+ i[j] = (Word16)floatToFixed(f[j], Q);
#else
Word32 i32_val = floatToFixed( f[j], Q );
IF( i32_val > MAX_16 )
@@ -296,3 +298,4 @@ Word16 L_get_q_buf1( float *ptr_flt, Word16 length )
}
}
#endif
+#undef WMC_TOOL_SKIP
diff --git a/lib_com/ivas_lfe_com.c b/lib_com/ivas_lfe_com.c
index 7fdfe40fa4f993ec8e045eaac4ea6b9ae743b625..95797ef84776d97010d71414045be9b63ee70d2a 100644
--- a/lib_com/ivas_lfe_com.c
+++ b/lib_com/ivas_lfe_com.c
@@ -192,7 +192,7 @@ void ivas_lfe_window_init_fx(
move16();
/* 8ms of latency */
- hLFEWindow->fade_len = NS2SA_fx2( sampling_rate, IVAS_LFE_FADE_NS );
+ hLFEWindow->fade_len = NS2SA_FX2( sampling_rate, IVAS_LFE_FADE_NS );
hLFEWindow->zero_pad_len = ( mult( IVAS_ZERO_PAD_LEN_MULT_FAC_fx, sub( hLFEWindow->dct_len, hLFEWindow->fade_len ) ) );
hLFEWindow->full_len = add( add( hLFEWindow->zero_pad_len, hLFEWindow->fade_len ), hLFEWindow->dct_len );
move16();
diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c
index 45ce295859edb0b58046d40ec46df692aa430167..7f6c56bbfafb5c5f0942333c8b723a0814059f44 100644
--- a/lib_com/ivas_tools.c
+++ b/lib_com/ivas_tools.c
@@ -948,7 +948,7 @@ void v_mult_mat_fixed(
pt_y++;
}
- Copy32( tmp_y, y, Nc );
+ MVR2R_WORD32( tmp_y, y, Nc );
}
Word32 dot_product_cholesky_fx(
const Word32 *x, /* i : vector x */
@@ -1050,7 +1050,7 @@ void v_mult_mat_fx(
pt_y_fx++;
}
- Copy32( tmp_y_fx, y_fx, Nc );
+ MVR2R_WORD32( tmp_y_fx, y_fx, Nc );
return;
}
diff --git a/lib_com/log2.c b/lib_com/log2.c
index 4e70862d1097ec3b12b6baf4ab0bc0c368dcbbe0..9e1cb14ae62c97d917d4cc97b79557922ff88ca2 100644
--- a/lib_com/log2.c
+++ b/lib_com/log2.c
@@ -78,8 +78,11 @@ Word32 log10_fx( Word32 Linput )
Word32 Ltemp1, Ltemp2;
Word32 L_tmp;
- if ( Linput <= 0 )
+ IF( Linput <= 0 )
+ {
return ( LW_MIN );
+ }
+
n1 = norm_l( Linput );
Ltemp1 = (Word32) L_shl( Linput, n1 );
diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c
index c0c42d31911cd1a88d9b3ba818aeac2c29e6b4b7..1e64cc13b18b0ea9e9c9ae25bc3772bb1aa8a912 100644
--- a/lib_com/modif_fs_fx.c
+++ b/lib_com/modif_fs_fx.c
@@ -190,7 +190,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
mu_preemph_fx = extract_h( t0 ); /*r_fx[1] / r_fx[0]; */
mem_preemph_fx = signal_ana_fx[mem_len_ana + lg - LEN_WIN_SSS - 1];
move16();
- preemph_fx( signal_ana_fx + mem_len_ana + lg - LEN_WIN_SSS, mu_preemph_fx, LEN_WIN_SSS, &mem_preemph_fx );
+ PREEMPH_FX( signal_ana_fx + mem_len_ana + lg - LEN_WIN_SSS, mu_preemph_fx, LEN_WIN_SSS, &mem_preemph_fx );
/* Autocorrelations */
diff --git a/lib_com/move.h b/lib_com/move.h
index 2afeb1ccba1f040d729bf6aaa9370527d643856d..a6f5b353e8aba360d4ff04ad456f62cc960a9873 100644
--- a/lib_com/move.h
+++ b/lib_com/move.h
@@ -39,7 +39,7 @@
#include "stl.h"
/* BASOP -> FLC brigde: data move counting */
-#if ( WMOPS )
+#ifdef WMOPS
extern BASIC_OP multiCounter[MAXCOUNTERS];
extern int currCounter;
#endif /* ifdef WMOPS */
diff --git a/lib_com/oper_32b.c b/lib_com/oper_32b.c
index 9f1ce2157155e7d0a29a05db7fe5b0228eb54705..30b97811b61ad883e8d08dfe5587ade950a34ac6 100644
--- a/lib_com/oper_32b.c
+++ b/lib_com/oper_32b.c
@@ -25,6 +25,8 @@
#include "stl.h"
#include "basop32.h"
+#define WMC_TOOL_SKIP
+
/*****************************************************************************
* *
* Function L_Extract() *
@@ -407,3 +409,4 @@ Word32 Div_32( Word32 L_num, Word16 denom_hi, Word16 denom_lo )
#endif
return ( L_32 );
}
+#undef WMC_TOOL_SKIP
diff --git a/lib_com/options.h b/lib_com/options.h
index be93e6a440487527d69c6633b817f10dc1260f3e..fdd0757d33b150df9e0b2d8f23fa3ccfd486bc2d 100644
--- a/lib_com/options.h
+++ b/lib_com/options.h
@@ -36,30 +36,24 @@
#ifndef OPTIONS_H
#define OPTIONS_H
-//#define DEBUGGING /*allows message printed out during run time */
-#ifdef DEBUGGING
-#include "debug.h"
-#endif
-
-#include "stl.h"
/* clang-format off */
- /* ################### Start compiler switches ######################## */
-
-#define SUPPORT_JBM_TRACEFILE /* support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */
-/* #################### End compiler switches ######################### */
+/* ################### Start DEBUGGING switches ######################## */
-/* ################### Start compiler switches ######################## */
-/* */
#ifdef _MSC_VER
#pragma warning(disable:4310) /* cast truncates constant value this affects mainly constants tables*/
#endif
-/*#define WMOPS 1 --> activation or deactivation in count.h*/ /* Activate FIXED-POINT complexity counters */
-/*#define DONT_COUNT */ /* To prevent the complexity counting */
+/*#define DEBUGGING*/ /* Allows debugging message to be printed out during runtime */
+#ifdef DEBUGGING
+/*#define DBG_WAV_WRITER*/
+#endif
+
+#define SUPPORT_JBM_TRACEFILE /* Support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */
-#ifdef WMOPS_FLT
+/*#define WMOPS*/ /* Activate complexity and memory counters */
+#ifdef WMOPS
/*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */
/*#define WMOPS_DETAIL*/ /* Output detailed complexity printout for every function. Increases runtime overhead */
/*#define WMOPS_WC_FRAME_ANALYSIS*/ /* Output detailed complexity analysis for the worst-case frame */
@@ -119,11 +113,7 @@
#define FIX_TMP_714
#define BASOP_NOGLOB_TMP_715
#define EVS_FUNC_MODIFIED
-//#define DEBUGGING
-//#define DBG_WAV_WRITER
#define EVS_FLOAT_ENC
-//#define DUMPS_ENABLED
-//#define WMOPS
#define FIX_667_DISABLE_INITIAL_PLC_SUPPRESSION
#define IVAS_CNST
#define REMOVE_IVAS_UNUSED_PARAMETERS_WARNING /*temporary operation on unused EVS parameters to remove warnings, these parameters will be used in IVAS */
diff --git a/lib_com/parameter_bitmaping.c b/lib_com/parameter_bitmaping.c
index 2be70b058664caabd37b9745bbcea9efbffe1696..aae7af5f06c04bd14721a18fd2f4fd7107889b87 100644
--- a/lib_com/parameter_bitmaping.c
+++ b/lib_com/parameter_bitmaping.c
@@ -326,7 +326,9 @@ void WriteToBitstream_fx(
nBits = param->nBits;
IF( param->nBits == 0 )
{
+#define WMC_TOOL_SKIP
nBits = param->GetNumberOfBits( **pStream, index );
+#undef WMC_TOOL_SKIP
}
test();
diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h
index 68a89424e28270ac45ac57b01d2136175f9a8c77..96d4354bd66c6b3eaee30170d01a7e2e5f46c9ed 100644
--- a/lib_com/prot_fx.h
+++ b/lib_com/prot_fx.h
@@ -36,19 +36,8 @@
* Prototypes of RAM counting tool macros
*----------------------------------------------------------------------------------*/
-#ifdef RAM_COUNTING_TOOL
-#define count_malloc( n1 ) MALLOC_FCT_CALL( n1 )
-#define count_calloc( n1, n2 ) CALLOC_FCT_CALL( n1, n2 )
-#define count_free( ptr ) FREE_FCT_CALL( ptr )
-#else
-#define count_malloc( n1 ) malloc( n1 )
-#define count_calloc( n1, n2 ) calloc( n1, n2 )
-#define count_free( ptr ) free( ptr )
-#endif
-
-#define dynamic_malloc( n1 ) malloc( n1 )
-#define dynamic_calloc( n1, n2 ) calloc( n1, n2 )
-#define dynamic_free( n1 ) free( n1 )
+#define MVR2R_WORD32( x, y, n ) Copy32( x, y, n )
+#define MVR2R_WORD16( x, y, n ) Copy( x, y, n )
#include
#include
@@ -2414,7 +2403,7 @@ void lag_wind_32(
);
// preemp_fx.c
-#define preemph_fx( signal, mu, L, mem ) preemph_copy_fx( ( signal ), ( signal ), ( mu ), ( L ), ( mem ) )
+#define PREEMPH_FX( signal, mu, L, mem ) preemph_copy_fx( ( signal ), ( signal ), ( mu ), ( L ), ( mem ) )
void preemph_copy_fx(
const Word16 x[], /* i : i signal Qx */
diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c
index 3bf612bcad39210a2d74a38c66e9978286c493ff..8bc681806d99d042251973bbbb5a46c9b233bc72 100644
--- a/lib_com/rom_com.c
+++ b/lib_com/rom_com.c
@@ -41807,13 +41807,13 @@ const Word16 Gamma_29491_Tbl[] = {
* NB post-filter tables
*---------------------------------------------------------------------*/
-const Word16 Tab_hup_s[SIZ_TAB_HUP_S] = {
+const Word16 tab_hup_s_fx[SIZ_TAB_HUP_S] = {
-188, 2873, 31650, -1597, -484, 7041, 28469, -2147, -933, 12266,
23705, -1992, -1492, 18050, 18050, -1492, -1992, 23705, 12266, -933,
-2147, 28469, 7041, -484, -1597, 31650, 2873, -188
};
-const Word16 Tab_hup_l[SIZ_TAB_HUP_L] = {
+const Word16 tab_hup_l_fx[SIZ_TAB_HUP_L] = {
-40, 72, -156, 315, -579, 1023, -1874, 4439,
31915, -3390, 1595, -887, 501, -266, 130, -59,
-77, 147, -317, 631, -1150, 2030, -3773, 9639,
@@ -42043,7 +42043,7 @@ const Word16 pwf78_fx[17] = { 25559, 19936, 15550, 12129, 9460, 7379, 5755, 4489
* lag window for windowing the autocorrelations in LP analysis
* Used in lib_enc\analy_lp_fx.c
*------------------------------------------------------------------------------*/
-const Word16 Hamcos_Window[L_LP_AMR_WB] = {
+const Word16 hamcos_window_fx[L_LP_AMR_WB] = {
2621, 2622, 2626, 2632, 2640, 2650, 2662, 2677,
2694, 2714, 2735, 2759, 2785, 2814, 2844, 2877,
2912, 2949, 2989, 3031, 3075, 3121, 3169, 3220,
diff --git a/lib_com/rom_com.h b/lib_com/rom_com.h
index a4d78c03a879c9e1c1f89582f16be3e2727be4af..43384b6f0c4e3ba827eec12626114f3ae8922a17 100644
--- a/lib_com/rom_com.h
+++ b/lib_com/rom_com.h
@@ -2103,8 +2103,8 @@ extern const Word16 Gamma_29491_Tbl[];
* NB post-filter tables
*---------------------------------------------------------------------*/
-extern const Word16 Tab_hup_s[];
-extern const Word16 Tab_hup_l[];
+extern const Word16 tab_hup_s_fx[];
+extern const Word16 tab_hup_l_fx[];
extern const Word16 mfreq_loc_Q2fx[];
extern const Word16 mfreq_loc_div_25[];
@@ -2160,7 +2160,7 @@ enum FUNC_GAIN_ENC
FUNC_GAIN_ENC_GACELP_UV /* UV GACELP gain quantizer ((7=5-2bits/subfr) */
};
-extern const Word16 Hamcos_Window[];
+extern const Word16 hamcos_window_fx[];
extern const Word16 CNG_burst_att_fx[6][8];
extern const Word16 lpc_weights_fx[];
extern const Word16 SHBCB_SubGain5bit_12_fx[]; /* 5 bit Quantizer table for SHB gain shapes */
diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c
index 9869019fa6fce0836ae920230d65336527464d8d..e91ea907e3085529012cd2d9b505d6a8ec7f1242 100644
--- a/lib_com/stat_noise_uv_mod_fx.c
+++ b/lib_com/stat_noise_uv_mod_fx.c
@@ -171,7 +171,7 @@ void stat_noise_uv_mod_fx(
exctilt = mult( shl( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */
#endif /* BASOP_NOGLOB */
- preemph_fx( &Exc2_local[i_subfr], exctilt, L_SUBFR, exc_pe );
+ PREEMPH_FX( &Exc2_local[i_subfr], exctilt, L_SUBFR, exc_pe );
}
}
diff --git a/lib_com/stl.h b/lib_com/stl.h
index ad437e3b29c950ab41996a738f07124aafda58f2..77e55b8668b86fcea757e21530eda7ea030e0e71 100644
--- a/lib_com/stl.h
+++ b/lib_com/stl.h
@@ -71,7 +71,7 @@
#include "typedef.h"
#include "basop32.h"
#include "count.h"
-//#include "wmc_auto.h"
+#include "wmc_auto.h"
#include "move.h"
#include "control.h"
#include "oper_32b.h"
diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c
index 55ca77c35b494eb573bd5376c6f0a45ce0ade055..b5f418fc6fcab569153193caffa1eed8f5fac008 100644
--- a/lib_com/swb_tbe_com_fx.c
+++ b/lib_com/swb_tbe_com_fx.c
@@ -2510,7 +2510,7 @@ void GenShapedSHBExcitation_fx(
move16();
/* exc16kWhtnd: Q_bwe_exc */
}
- preemph_fx( exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph );
+ PREEMPH_FX( exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph );
/* i/o: exc16kWhtnd (Q_bwe_exc) */
/* i/o: tbe_premph (Q_bwe_exc) */
}
@@ -2605,7 +2605,7 @@ void GenShapedSHBExcitation_fx(
temp = div_s( temp, temp2 ); /* Q15 */
temp = mult_r( PREEMPH_FAC, temp );
- preemph_fx( &exc16kWhtnd[i * lSubFr], temp, lSubFr, tbe_premph );
+ PREEMPH_FX( &exc16kWhtnd[i * lSubFr], temp, lSubFr, tbe_premph );
/* exc16kWhtnd: Q_bwe_exc;
tbe_premph: Q_bwe_exc*/
}
@@ -3434,7 +3434,7 @@ void GenShapedSHBExcitation_ivas_fx(
}
}
// preemph(exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph);
- preemph_fx( exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph );
+ PREEMPH_FX( exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph );
}
ELSE
#endif
@@ -3460,7 +3460,7 @@ void GenShapedSHBExcitation_ivas_fx(
move16();
/* exc16kWhtnd: Q_bwe_exc */
}
- preemph_fx( exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph );
+ PREEMPH_FX( exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph );
/* i/o: exc16kWhtnd (Q_bwe_exc) */
/* i/o: tbe_premph (Q_bwe_exc) */
}
@@ -3558,7 +3558,7 @@ void GenShapedSHBExcitation_ivas_fx(
temp = div_s( temp, temp2 ); /* Q15 */
temp = mult_r( PREEMPH_FAC, temp );
- preemph_fx( &exc16kWhtnd[i * lSubFr], temp, lSubFr, tbe_premph );
+ PREEMPH_FX( &exc16kWhtnd[i * lSubFr], temp, lSubFr, tbe_premph );
/* exc16kWhtnd: Q_bwe_exc;
tbe_premph: Q_bwe_exc*/
}
diff --git a/lib_com/tcx_ltp_fx.c b/lib_com/tcx_ltp_fx.c
index 9d18d4841c273cfe6ccb485508e231013cee98a9..fb5a8e27d5009b9392ff1c819d8f7f886014e03d 100644
--- a/lib_com/tcx_ltp_fx.c
+++ b/lib_com/tcx_ltp_fx.c
@@ -1704,7 +1704,7 @@ void tcx_ltp_post32(
filtIdx = 0; /* just to avoid comilation warnings */
move16();
- tcx_buf_len = NS2SA_fx2( st->output_Fs, TCXLTP_DELAY_NS );
+ tcx_buf_len = NS2SA_FX2( st->output_Fs, TCXLTP_DELAY_NS );
move16();
SideInfoOnly = 0;
move16();
diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c
index 914f05a02efa04a7058c95ccf9ed3e9b9a71f203..19c5efcbb903118ed2141691d96cc7d8f80b2c38 100644
--- a/lib_com/tools_fx.c
+++ b/lib_com/tools_fx.c
@@ -60,6 +60,8 @@ const Word16 b_hp400_fx[3] = { 3660, -7320, 3660 }; /* Q12 (/4) */
const Word16 a_hp400_fx[3] = { 16384, 29280, -14160 };
const Word16 a_hp400_ivas_fx[3] = { 4096, 7320, -3540 }; /*Q12*/
+#define WMC_TOOL_SKIP
+
// conversion functions:
Word32 float_to_fix( float number, Word32 Q )
{
@@ -238,6 +240,8 @@ void fix2f_16( Word16 *var_fix, float *var_flt, Word32 expo )
*var_flt = (float) ldexp( mf, expo );
}
+#undef WMC_TOOL_SKIP
+
int16_t norm_ul( uint32_t UL_var1 )
{
int16_t var_out;
diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c
index 233a2f6ba4ae518d937c1e5625a8a76466068bda..675ba31aabb71d87c9831e78022abe79f313617a 100644
--- a/lib_com/wi_fx.c
+++ b/lib_com/wi_fx.c
@@ -1258,9 +1258,9 @@ static void DTFS_transform_fx(
}
- count_free( tmp1_dtfs_fx );
- count_free( tmp2_dtfs_fx );
- count_free( tmp3_dtfs_fx );
+ free( tmp1_dtfs_fx );
+ free( tmp2_dtfs_fx );
+ free( tmp3_dtfs_fx );
return;
}
/*===================================================================*/
diff --git a/lib_com/wtda.c b/lib_com/wtda.c
index f1b47ee6c06df5a4f7e40ab03fc49588644e515b..eed61a240778fb7867926794b02c2501ffbff432 100644
--- a/lib_com/wtda.c
+++ b/lib_com/wtda.c
@@ -43,7 +43,7 @@
#include "wmc_auto.h"
#ifdef IVAS_FLOAT_FIXED
#include "prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
+#endif
/*--------------------------------------------------------------------------*
* mvr2r_inv()
diff --git a/lib_debug/debug.c b/lib_debug/debug.c
index 5e65379903e77a3b064c33bebd23f1c683122859..f1cfa928ab136ad2fb2817655dae23025cf79eed 100644
--- a/lib_debug/debug.c
+++ b/lib_debug/debug.c
@@ -919,6 +919,7 @@ int16_t dbgwrite_wav(
return 0;
}
+#endif
int16_t dbgwrite_txt(
@@ -974,5 +975,4 @@ int16_t dbgwrite_txt(
return 0;
}
-#endif
#endif /* DEBUGGING */
diff --git a/lib_debug/debug.h b/lib_debug/debug.h
index 0d3e920ca4f7f870cd12ecb306f0b4534da12436..e88def922b0992a0ba765942089cb59a8d4a76c6 100644
--- a/lib_debug/debug.h
+++ b/lib_debug/debug.h
@@ -105,12 +105,14 @@ int16_t dbgwrite_wav(
const char *const filename,
int32_t fs,
int16_t num_chs );
+#endif
+
int16_t dbgwrite_txt(
const float *buffer, /* i : Write buffer */
const int16_t count, /* i : Number of elements */
const char *const filename,
const char *const msg_opt );
-#endif
+
void dbgwrite_mat_repeat(
float *buffer, /* i : write buffer */
int16_t nRow, /* i : matrix size (rows) */
diff --git a/lib_debug/wmc_auto.c b/lib_debug/wmc_auto.c
index eafa02a2ea3c3d259927b7c8e00d207bcbedccd1..e37fecf2ebdec6b1fead6dccf0df4e8ff5bc321c 100644
--- a/lib_debug/wmc_auto.c
+++ b/lib_debug/wmc_auto.c
@@ -16,6 +16,7 @@
#include
#include
#include
+#include
#include
#ifndef _MSC_VER
@@ -28,25 +29,32 @@
#include "options.h"
#include "wmc_auto.h"
+#include "typedef.h"
+#include "count.h"
+
#define WMC_TOOL_SKIP /* Skip the instrumentation of this file, if invoked by accident */
-#ifdef WMOPS_FLT
+#ifdef WMOPS
/*-------------------------------------------------------------------*
* Complexity counting tool
*--------------------------------------------------------------------*/
-#define MAX_RECORDS 1024
-#define MAX_CHAR 64
-#define MAX_STACK 64
-#define DOUBLE_MAX 0x80000000
+#define MAX_FUNCTION_NAME_LENGTH 200 /* Maximum length of the function name */
+#define MAX_PARAMS_LENGTH 200 /* Maximum length of the function parameter string */
+#define MAX_NUM_RECORDS 300 /* Initial maximum number of records -> might be increased during runtime, if needed */
+#define MAX_NUM_RECORDS_REALLOC_STEP 50 /* When re-allocating the list of records, increase the number of records by this number */
+#define MAX_CALL_TREE_DEPTH 100 /* maximum depth of the function call tree */
+#define DOUBLE_MAX 0x80000000
+#define FAC ( FRAMES_PER_SECOND / 1e6 )
-struct wmops_record
+typedef struct
{
- char label[MAX_CHAR];
+ char label[MAX_FUNCTION_NAME_LENGTH];
long call_number;
long update_cnt;
- int call_tree[MAX_RECORDS];
+ int call_tree[MAX_CALL_TREE_DEPTH];
+ long LastWOper;
double start_selfcnt;
double current_selfcnt;
double max_selfcnt;
@@ -63,16 +71,14 @@ struct wmops_record
double wc_selfcnt;
int32_t wc_call_number;
#endif
-};
+} wmops_record;
-double ops_cnt;
-double prom_cnt;
+double ops_cnt_wmc;
+double prom_cnt_wmc;
double inst_cnt[NUM_INST];
-static struct wmops_record wmops[MAX_RECORDS];
-static int stack[MAX_STACK];
-static int sptr;
-static int num_records;
+static wmops_record* wmops = NULL;
+static int num_wmops_records, max_num_wmops_records;
static int current_record;
static long update_cnt;
static double start_cnt;
@@ -80,20 +86,59 @@ static double max_cnt;
static double min_cnt;
static double inst_cnt_wc[NUM_INST];
static long fnum_cnt_wc;
-
+static int *wmops_caller_stack = NULL, wmops_caller_stack_index, max_wmops_caller_stack_index = 0;
static int *heap_allocation_call_tree = NULL, heap_allocation_call_tree_size = 0, heap_allocation_call_tree_max_size = 0;
void reset_wmops( void )
{
int i, j;
+ //unsigned int *ptr;
+
+ num_wmops_records = 0;
+ max_num_wmops_records = MAX_NUM_RECORDS;
+ current_record = -1;
+ update_cnt = 0;
+
+ max_cnt = 0.0;
+ min_cnt = DOUBLE_MAX;
+ start_cnt = 0.0;
+ ops_cnt_wmc = 0.0;
+
+ /* allocate the list of wmops records */
+ if ( wmops == NULL )
+ {
+ wmops = (wmops_record *) malloc( max_num_wmops_records * sizeof( wmops_record ) );
+ }
+
+ if ( wmops == NULL )
+ {
+ fprintf( stderr, "Error: Unable to Allocate List of WMOPS Records!" );
+ exit( -1 );
+ }
+
+ /* allocate the BASOP WMOPS counter */
+ //if ( multiCounter == NULL )
+ //{
+ // multiCounter = (BASIC_OP *) malloc( max_num_wmops_records * sizeof( BASIC_OP ) );
+ //}
+
+ //if ( multiCounter == NULL )
+ //{
+ // fprintf( stderr, "Error: Unable to Allocate the BASOP WMOPS counter!" );
+ // exit( -1 );
+ //}
+
+ BASOP_init
- for ( i = 0; i < MAX_RECORDS; i++ )
+ /* initilize the list of WMOPS records */
+ /* initilize the BASOP WMOPS counters */
+ for ( i = 0; i < max_num_wmops_records; i++ )
{
strcpy( &wmops[i].label[0], "\0" );
wmops[i].call_number = 0;
wmops[i].update_cnt = 0;
- for ( j = 0; j < MAX_RECORDS; j++ )
+ for ( j = 0; j < MAX_CALL_TREE_DEPTH; j++ )
{
wmops[i].call_tree[j] = -1;
}
@@ -111,96 +156,175 @@ void reset_wmops( void )
wmops[i].wc_cnt = 0.0;
wmops[i].wc_selfcnt = 0.0;
wmops[i].current_call_number = 0;
+ wmops[i].wc_call_number = -1;
#endif
+
+ /* clear all BASOP operation counters */
+ //ptr = (unsigned int *) &multiCounter[i];
+ //for ( j = 0; j < (int) ( sizeof( BASIC_OP ) / sizeof( unsigned int ) ); j++ )
+ //{
+ // *ptr++ = 0;
+ //}
+ wmops[i].LastWOper = 0;
}
- for ( i = 0; i < MAX_STACK; i++ )
+ /* allocate the list of wmops callers to track the sequence of function calls */
+ wmops_caller_stack_index = 0;
+ max_wmops_caller_stack_index = MAX_NUM_RECORDS;
+ if ( wmops_caller_stack == NULL )
{
- stack[i] = -1;
+ wmops_caller_stack = malloc( max_wmops_caller_stack_index * sizeof( int ) );
}
- sptr = 0;
- num_records = 0;
- current_record = -1;
- update_cnt = 0;
- max_cnt = 0.0;
- min_cnt = DOUBLE_MAX;
- start_cnt = 0.0;
- ops_cnt = 0.0;
-}
+ if ( wmops_caller_stack == NULL )
+ {
+ fprintf( stderr, "Error: Unable to Allocate List of WMOPS Callers!" );
+ exit( -1 );
+ }
+ for ( i = 0; i < max_wmops_caller_stack_index; i++ )
+ {
+ wmops_caller_stack[i] = -1;
+ }
+
+ /* initialize auxiliary BASOP WMOPS variables */
+ //call_occurred = 1;
+ //funcId_where_last_call_to_else_occurred = INT_MAX;
+
+ return;
+}
-void push_wmops( const char *label )
+void push_wmops_fct( const char *label, ... )
{
int new_flag;
- int i, j;
+ int i, j, index_record;
+ //unsigned int *ptr;
+ va_list arg;
+ char func_name[MAX_FUNCTION_NAME_LENGTH] = "";
+
+ /* concatenate all function name labels into a single string */
+ va_start( arg, label );
+ while ( label )
+ {
+ strcat( func_name, label );
+ label = va_arg( arg, const char * );
+ }
+ va_end( arg );
- /* Check if new function record label */
+ /* Check, if this is a new function label */
new_flag = 1;
- for ( i = 0; i < num_records; i++ )
+ for ( i = 0; i < num_wmops_records; i++ )
{
- if ( strcmp( wmops[i].label, label ) == 0 )
+ if ( strcmp( wmops[i].label, func_name ) == 0 )
{
new_flag = 0;
break;
}
}
+ index_record = i;
- /* Configure new record */
+ /* Create a new record in the list */
if ( new_flag )
{
- if ( num_records >= MAX_RECORDS )
+ if ( num_wmops_records >= max_num_wmops_records )
{
- fprintf( stdout, "push_wmops(): exceeded MAX_RECORDS count.\n\n" );
- exit( -1 );
+ /* There is no room for a new WMOPS record -> reallocate the list */
+ max_num_wmops_records += MAX_NUM_RECORDS_REALLOC_STEP;
+ wmops = realloc( wmops, max_num_wmops_records * sizeof( wmops_record ) );
+ //multiCounter = realloc( multiCounter, max_num_wmops_records * sizeof( BASIC_OP ) );
+
+ /* initilize newly created WMOPS records */
+ for ( i = num_wmops_records; i < max_num_wmops_records; i++ )
+ {
+ strcpy( &wmops[i].label[0], "\0" );
+ wmops[i].call_number = 0;
+ wmops[i].update_cnt = 0;
+ for ( j = 0; j < MAX_CALL_TREE_DEPTH; j++ )
+ {
+ wmops[i].call_tree[j] = -1;
+ }
+ wmops[i].start_selfcnt = 0.0;
+ wmops[i].current_selfcnt = 0.0;
+ wmops[i].max_selfcnt = 0.0;
+ wmops[i].min_selfcnt = DOUBLE_MAX;
+ wmops[i].tot_selfcnt = 0.0;
+ wmops[i].start_cnt = 0.0;
+ wmops[i].current_cnt = 0.0;
+ wmops[i].max_cnt = 0.0;
+ wmops[i].min_cnt = DOUBLE_MAX;
+ wmops[i].tot_cnt = 0.0;
+#ifdef WMOPS_WC_FRAME_ANALYSIS
+ wmops[i].wc_cnt = 0.0;
+ wmops[i].wc_selfcnt = 0.0;
+ wmops[i].current_call_number = 0;
+ wmops[i].wc_call_number = -1;
+#endif
+
+ /* initialize BASOP WMOPS counters */
+ //ptr = (unsigned int *) &multiCounter[i];
+ //for ( j = 0; j < (int) ( sizeof( BASIC_OP ) / sizeof( unsigned int ) ); j++ )
+ //{
+ // *ptr++ = 0;
+ //}
+ wmops[i].LastWOper = 0;
+ }
}
- strcpy( wmops[i].label, label );
- num_records++;
+
+ strcpy( wmops[index_record].label, func_name );
+
+ num_wmops_records++;
}
- /* Push current context onto stack */
+ /* Push the current context info to the new record */
if ( current_record >= 0 )
{
- if ( sptr >= MAX_STACK )
+ if ( wmops_caller_stack_index >= max_wmops_caller_stack_index )
{
- fprintf( stdout, "\r push_wmops(): stack exceeded, try inreasing MAX_STACK\n" );
- exit( -1 );
+ /* There is no room for a new record -> reallocate the list */
+ max_wmops_caller_stack_index += MAX_NUM_RECORDS_REALLOC_STEP;
+ wmops_caller_stack = realloc( wmops_caller_stack, max_wmops_caller_stack_index * sizeof( int ) );
}
- stack[sptr++] = current_record;
+ wmops_caller_stack[wmops_caller_stack_index++] = current_record;
/* accumulate op counts */
- wmops[current_record].current_selfcnt += ops_cnt - wmops[current_record].start_selfcnt;
+ wmops[current_record].current_selfcnt += ops_cnt_wmc - wmops[current_record].start_selfcnt;
/* update call tree */
- for ( j = 0; j < MAX_RECORDS; j++ )
+ for ( j = 0; j < MAX_CALL_TREE_DEPTH; j++ )
{
- if ( wmops[i].call_tree[j] == current_record )
+ if ( wmops[index_record].call_tree[j] == current_record )
{
break;
}
- else if ( wmops[i].call_tree[j] == -1 )
+ else if ( wmops[index_record].call_tree[j] == -1 )
{
- wmops[i].call_tree[j] = current_record;
+ wmops[index_record].call_tree[j] = current_record;
break;
}
}
}
- /* init current record */
- current_record = i;
- wmops[current_record].start_selfcnt = ops_cnt;
- wmops[current_record].start_cnt = ops_cnt;
- wmops[current_record].call_number++;
+ /* update the current context info */
+ current_record = index_record;
+ wmops[index_record].start_selfcnt = ops_cnt_wmc;
+ wmops[index_record].start_cnt = ops_cnt_wmc;
+ wmops[index_record].call_number++;
#ifdef WMOPS_WC_FRAME_ANALYSIS
- wmops[current_record].current_call_number++;
+ wmops[index_record].current_call_number++;
#endif
+ /* set the ID of BASOP functions counters */
+ //Set_BASOP_WMOPS_counter( index_record );
+
+ BASOP_push_wmops( func_name );
+
return;
}
void pop_wmops( void )
{
+ //long tot;
/* Check for underflow */
if ( current_record < 0 )
@@ -209,21 +333,30 @@ void pop_wmops( void )
exit( -1 );
}
+ /* add the BASOP complexity to the counter */
+ //tot = DeltaWeightedOperation();
+ //ops_cnt_wmc += tot;
+
/* update count of current record */
- wmops[current_record].current_selfcnt += ops_cnt - wmops[current_record].start_selfcnt;
- wmops[current_record].current_cnt += ops_cnt - wmops[current_record].start_cnt;
+ wmops[current_record].current_selfcnt += ops_cnt_wmc - wmops[current_record].start_selfcnt;
+ wmops[current_record].current_cnt += ops_cnt_wmc - wmops[current_record].start_cnt;
/* Get back previous context from stack */
- if ( sptr > 0 )
+ if ( wmops_caller_stack_index > 0 )
{
- current_record = stack[--sptr];
- wmops[current_record].start_selfcnt = ops_cnt;
+ current_record = wmops_caller_stack[--wmops_caller_stack_index];
+ wmops[current_record].start_selfcnt = ops_cnt_wmc;
+
+ /* set the ID of the previous BASOP counter */
+ //Set_BASOP_WMOPS_counter( current_record );
}
else
{
current_record = -1;
}
+ BASOP_pop_wmops();
+
return;
}
@@ -238,9 +371,9 @@ void update_wmops( void )
float tmpF;
#endif
- if ( sptr != 0 )
+ if ( wmops_caller_stack_index != 0 )
{
- fprintf( stdout, "update_wmops(): Stack must be empty!\n" );
+ fprintf( stdout, "update_wmops(): WMOPS caller stack corrupted - check that all push_wmops() are matched with pop_wmops()!\n" );
exit( -1 );
}
@@ -265,7 +398,7 @@ void update_wmops( void )
#ifdef WMOPS_WC_FRAME_ANALYSIS
if ( ops_cnt - start_cnt > max_cnt )
{
- for ( i = 0; i < num_records; i++ )
+ for ( i = 0; i < num_wmops_records; i++ )
{
wmops[i].wc_cnt = wmops[i].current_cnt;
wmops[i].wc_selfcnt = wmops[i].current_selfcnt;
@@ -274,7 +407,7 @@ void update_wmops( void )
}
#endif
- for ( i = 0; i < num_records; i++ )
+ for ( i = 0; i < num_wmops_records; i++ )
{
wmops[i].tot_selfcnt += wmops[i].current_selfcnt;
wmops[i].tot_cnt += wmops[i].current_cnt;
@@ -301,6 +434,7 @@ void update_wmops( void )
wmops[i].max_cnt = wmops[i].current_cnt;
}
+
if ( wmops[i].current_cnt < wmops[i].min_cnt )
{
wmops[i].min_cnt = wmops[i].current_cnt;
@@ -313,9 +447,13 @@ void update_wmops( void )
#ifdef WMOPS_WC_FRAME_ANALYSIS
wmops[i].current_call_number = 0;
#endif
+
+ /* update the WC of all BASOP counters */
+ //Set_BASOP_WMOPS_counter( i );
+ //Reset_BASOP_WMOPS_counter();
}
- current_cnt = ops_cnt - start_cnt;
+ current_cnt = ops_cnt_wmc - start_cnt;
if ( current_cnt > max_cnt )
{
max_cnt = current_cnt;
@@ -338,169 +476,196 @@ void update_wmops( void )
inst_cnt[i] = 0.0;
}
- start_cnt = ops_cnt;
+ start_cnt = ops_cnt_wmc;
/* increment frame counter */
update_cnt++;
+ BASOP_frame_update();
+
return;
}
-
void print_wmops( void )
{
- int i;
-
- char *sfmts = "%20s %8s %8s %7s %7s\n";
- char *dfmts = "%20s %8.2f %8.3f %7.3f %7.3f\n";
- char *sfmt = "%20s %8s %8s %7s %7s %7s %7s %7s\n";
- char *dfmt = "%20s %8.2f %8.3f %7.3f %7.3f %7.3f %7.3f %7.3f\n";
-
-#ifdef WMOPS_WC_FRAME_ANALYSIS
- int j, label_len, max_label_len;
- char *sfmtt = "%20s %4s %15s\n";
- char *dfmtt = "%20s %4d ";
-#endif
-
- fprintf( stdout, "\n\n --- Complexity analysis [WMOPS] --- \n\n" );
-
- fprintf( stdout, "%54s %23s\n", "|------ SELF ------|", "|--- CUMULATIVE ---|" );
- fprintf( stdout, sfmt, " routine", " calls", " min ", " max ", " avg ", " min ", " max ", " avg " );
- fprintf( stdout, sfmt, "---------------", "------", "------", "------", "------", "------", "------", "------" );
-
- for ( i = 0; i < num_records; i++ )
- {
- fprintf( stdout, dfmt, wmops[i].label, update_cnt == 0 ? 0 : (float) wmops[i].call_number / update_cnt,
- wmops[i].min_selfcnt == DOUBLE_MAX ? 0 : FAC * wmops[i].min_selfcnt,
- FAC * wmops[i].max_selfcnt,
- wmops[i].update_cnt == 0 ? 0 : FAC * wmops[i].tot_selfcnt / wmops[i].update_cnt,
- wmops[i].min_cnt == DOUBLE_MAX ? 0 : FAC * wmops[i].min_cnt,
- FAC * wmops[i].max_cnt,
- wmops[i].update_cnt == 0 ? 0 : FAC * wmops[i].tot_cnt / wmops[i].update_cnt );
- }
-
- fprintf( stdout, sfmts, "---------------", "------", "------", "------", "------" );
- fprintf( stdout, dfmts, "total", (float) update_cnt, update_cnt == 0 ? 0 : FAC * min_cnt, FAC * max_cnt, update_cnt == 0 ? 0 : FAC * ops_cnt / update_cnt );
- fprintf( stdout, "\n" );
-
-#ifdef WMOPS_WC_FRAME_ANALYSIS
- /* calculate maximum label length for compact prinout */
- max_label_len = 0;
- for ( i = 0; i < num_records; i++ )
- {
- label_len = strlen( wmops[i].label );
- if ( label_len > max_label_len )
- {
- max_label_len = label_len;
- }
- }
- max_label_len += 4;
-
- fprintf( stdout, "\nComplexity analysis for the worst-case frame %ld:\n", fnum_cnt_wc );
- fprintf( stdout, "%*s %8s %10s %12s\n", max_label_len, " routine", " calls", " SELF", " CUMULATIVE" );
- fprintf( stdout, "%*s %8s %10s %10s\n", max_label_len, "---------------", "------", "------", "----------" );
+ //int i, label_len, max_label_len;
- for ( i = 0; i < num_records; i++ )
- {
- fprintf( stdout, "%*s %8d %10.3f %12.3f\n", max_label_len, wmops[i].label, wmops[i].wc_call_number, FAC * wmops[i].wc_selfcnt, FAC * wmops[i].wc_cnt );
- }
-
- fprintf( stdout, "\nCall Tree:\n\n" );
- fprintf( stdout, sfmtt, " function", "num", "called by: " );
- fprintf( stdout, sfmtt, "---------------", "---", "--------------" );
-
- for ( i = 0; i < num_records; i++ )
- {
- fprintf( stdout, dfmtt, wmops[i].label, i );
- for ( j = 0; wmops[i].call_tree[j] != -1; j++ )
- {
- if ( j != 0 )
- {
- fprintf( stdout, ", " );
- }
- fprintf( stdout, "%d", wmops[i].call_tree[j] );
- }
- fprintf( stdout, "\n" );
- }
+ //char *sfmts = "%*s %8s %8s %7s %7s\n";
+ //char *dfmts = "%*s %8.2f %8.3f %7.3f %7.3f\n";
+ //char *sfmt = "%*s %8s %8s %7s %7s %7s %7s %7s\n";
+ //char *dfmt = "%*s %8.2f %8.3f %7.3f %7.3f %7.3f %7.3f %7.3f\n";
- fprintf( stdout, sfmtt, "---------------", "---", "--------------" );
- fprintf( stdout, "\n\n" );
+ WMOPS_output_all_std( 0 );
+ WMOPS_destroy();
+ return;
- fprintf( stdout, "\nInstruction type analysis for the worst-case frame %ld:\n\n", fnum_cnt_wc ); /* added -- JPA */
- for ( i = 0; i < NUM_INST; i++ )
- {
- switch ( (enum instructions) i )
- {
- case _ADD:
- fprintf( stdout, "\tAdds: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _ABS:
- fprintf( stdout, "\tAbsolutes: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _MULT:
- fprintf( stdout, "\tMultiplies: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _MAC:
- fprintf( stdout, "\tMACs: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _MOVE:
- fprintf( stdout, "\tMoves: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _STORE:
- fprintf( stdout, "\tStores: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _LOGIC:
- fprintf( stdout, "\tLogicals: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _SHIFT:
- fprintf( stdout, "\tShifts: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _BRANCH:
- fprintf( stdout, "\tBranches: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _DIV:
- fprintf( stdout, "\tDivisions: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _SQRT:
- fprintf( stdout, "\tSquare Root: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _TRANS:
- fprintf( stdout, "\tTrans: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _FUNC:
- fprintf( stdout, "\tFunc Call: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _LOOP:
- fprintf( stdout, "\tLoop Init: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _INDIRECT:
- fprintf( stdout, "\tIndirect Addr: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _PTR_INIT:
- fprintf( stdout, "\tPointer Init: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _TEST:
- fprintf( stdout, "\tExtra condit.: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _POWER:
- fprintf( stdout, "\tExponential: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _LOG:
- fprintf( stdout, "\tLogarithm: %12.1f\n", inst_cnt_wc[i] );
- break;
- case _MISC:
- fprintf( stdout, "\tAll other op.: %12.1f\n", inst_cnt_wc[i] );
- break;
- default:
- fprintf( stdout, "\tERROR: Invalid instruction type: %d\n\n", i );
- }
- }
-#endif
+//#ifdef WMOPS_WC_FRAME_ANALYSIS
+// int j;
+// char *sfmtt = "%20s %4s %15s\n";
+// char *dfmtt = "%20s %4d ";
+//#endif
+
+// /* calculate maximum label length for compact prinout */
+// max_label_len = 0;
+// for ( i = 0; i < num_wmops_records; i++ )
+// {
+// label_len = strlen( wmops[i].label );
+// if ( label_len > max_label_len )
+// {
+// max_label_len = label_len;
+// }
+// }
+// max_label_len += 4;
+//
+// fprintf( stdout, "\n\n --- Complexity analysis [WMOPS] --- \n\n" );
+//
+// fprintf( stdout, "%*s %33s %23s\n", max_label_len, "", "|------ SELF ------|", "|--- CUMULATIVE ---|" );
+// fprintf( stdout, sfmt, max_label_len, " routine", " calls", " min ", " max ", " avg ", " min ", " max ", " avg " );
+// fprintf( stdout, sfmt, max_label_len, "---------------", "------", "------", "------", "------", "------", "------", "------" );
+//
+// for ( i = 0; i < num_wmops_records; i++ )
+// {
+// fprintf( stdout, dfmt, max_label_len, wmops[i].label, update_cnt == 0 ? 0 : (float) wmops[i].call_number / update_cnt,
+// wmops[i].min_selfcnt == DOUBLE_MAX ? 0 : FAC * wmops[i].min_selfcnt,
+// FAC * wmops[i].max_selfcnt,
+// wmops[i].update_cnt == 0 ? 0 : FAC * wmops[i].tot_selfcnt / wmops[i].update_cnt,
+// wmops[i].min_cnt == DOUBLE_MAX ? 0 : FAC * wmops[i].min_cnt,
+// FAC * wmops[i].max_cnt,
+// wmops[i].update_cnt == 0 ? 0 : FAC * wmops[i].tot_cnt / wmops[i].update_cnt );
+// }
+//
+// fprintf( stdout, sfmts, max_label_len, "---------------", "------", "------", "------", "------" );
+// fprintf( stdout, dfmts, max_label_len, "total", (float) update_cnt, update_cnt == 0 ? 0 : FAC * min_cnt, FAC * max_cnt, update_cnt == 0 ? 0 : FAC * ops_cnt_wmc / update_cnt );
+// fprintf( stdout, "\n" );
+//
+//#ifdef WMOPS_WC_FRAME_ANALYSIS
+// fprintf( stdout, "\nComplexity analysis for the worst-case frame %ld:\n\n", fnum_cnt_wc );
+// fprintf( stdout, "%*s %8s %10s %12s\n", max_label_len, " routine", " calls", " SELF", " CUMULATIVE" );
+// fprintf( stdout, "%*s %8s %10s %10s\n", max_label_len, "---------------", "------", "------", "----------" );
+//
+// for ( i = 0; i < num_wmops_records; i++ )
+// {
+// if ( wmops[i].wc_call_number > 0 )
+// {
+// fprintf( stdout, "%*s %8d %10.3f %12.3f\n", max_label_len, wmops[i].label, wmops[i].wc_call_number, FAC * wmops[i].wc_selfcnt, FAC * wmops[i].wc_cnt );
+// }
+// }
+//
+// fprintf( stdout, "\nCall tree for the worst-case frame %ld:\n\n", fnum_cnt_wc );
+// fprintf( stdout, sfmtt, " function", "num", "called by " );
+// fprintf( stdout, sfmtt, "---------------", "---", "--------------" );
+//
+// for ( i = 0; i < num_wmops_records; i++ )
+// {
+// if ( wmops[i].wc_call_number > 0 )
+// {
+// fprintf( stdout, dfmtt, wmops[i].label, i );
+// for ( j = 0; wmops[i].call_tree[j] != -1 && j < MAX_CALL_TREE_DEPTH; j++ )
+// {
+// if ( j != 0 )
+// {
+// fprintf( stdout, ", " );
+// }
+// fprintf( stdout, "%d", wmops[i].call_tree[j] );
+// }
+// fprintf( stdout, "\n" );
+// }
+// }
+//
+// fprintf( stdout, "\n\n" );
+//
+// fprintf( stdout, "\nInstruction type analysis for the worst-case frame %ld:\n\n", fnum_cnt_wc );
+// for ( i = 0; i < NUM_INST; i++ )
+// {
+// switch ( (enum instructions) i )
+// {
+// case _ADD:
+// fprintf( stdout, "\tAdds: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _ABS:
+// fprintf( stdout, "\tAbsolutes: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _MULT:
+// fprintf( stdout, "\tMultiplies: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _MAC:
+// fprintf( stdout, "\tMACs: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _MOVE:
+// fprintf( stdout, "\tMoves: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _STORE:
+// fprintf( stdout, "\tStores: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _LOGIC:
+// fprintf( stdout, "\tLogicals: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _SHIFT:
+// fprintf( stdout, "\tShifts: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _BRANCH:
+// fprintf( stdout, "\tBranches: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _DIV:
+// fprintf( stdout, "\tDivisions: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _SQRT:
+// fprintf( stdout, "\tSquare Root: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _TRANS:
+// fprintf( stdout, "\tTrans: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _FUNC:
+// fprintf( stdout, "\tFunc Call: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _LOOP:
+// fprintf( stdout, "\tLoop Init: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _INDIRECT:
+// fprintf( stdout, "\tIndirect Addr: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _PTR_INIT:
+// fprintf( stdout, "\tPointer Init: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _TEST:
+// fprintf( stdout, "\tExtra condit.: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _POWER:
+// fprintf( stdout, "\tExponential: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _LOG:
+// fprintf( stdout, "\tLogarithm: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// case _MISC:
+// fprintf( stdout, "\tAll other op.: %12.1f\n", inst_cnt_wc[i] );
+// break;
+// default:
+// fprintf( stdout, "\tERROR: Invalid instruction type: %d\n\n", i );
+// }
+// }
+//#endif
+//
+// /* De-allocate the list of wmops record */
+// if ( wmops != NULL )
+// {
+// free( wmops );
+// }
+//
+// /* De-allocate the list of wmops caller functions */
+// if ( wmops_caller_stack != NULL )
+// {
+// free( wmops_caller_stack );
+// }
+//
+// /* De-allocate the BASOP WMOPS counter */
+// //if ( multiCounter != NULL )
+// //{
+// // free( multiCounter );
+// //}
return;
}
-
/*-------------------------------------------------------------------*
* Memory counting tool measuring RAM usage (stack and heap)
*
@@ -523,11 +688,6 @@ void print_wmops( void )
* #define WMC_TOOL_SKIP ... #undef WMC_TOOL_SKIP macro pair around the malloc(), calloc() and free().
*--------------------------------------------------------------------*/
-#define MAX_RECORDABLE_CALLS 100
-#define MAX_FUNCTION_NAME_LENGTH 35 /* Maximum length that the function string will be truncated to */
-#define MAX_PARAMS_LENGTH 50 /* Maximum length that the parameter string will be truncated to */
-#define MAX_NUM_RECORDS 300 /* Initial maximum number of memory records -> mightb be increased during runtime, if needed */
-#define MAX_NUM_RECORDS_REALLOC_STEP 50 /* When re-allocating the list of memory records, increase the number of records by this number */
/* This is the value (in bytes) towards which the block size is rounded. For example, a block of 123 bytes, when using
a 32 bits system, will end up taking 124 bytes since the last unused byte cannot be used for another block. */
@@ -558,7 +718,14 @@ typedef struct
int16_t *stack_ptr;
} caller_info;
-caller_info stack_callers[2][MAX_RECORDABLE_CALLS];
+static caller_info *stack_callers[2] = { NULL, NULL };
+
+static int16_t *ptr_base_stack = 0; /* Pointer to the bottom of stack (base pointer). Stack grows up. */
+static int16_t *ptr_current_stack = 0; /* Pointer to the current stack pointer */
+static int16_t *ptr_max_stack = 0; /* Pointer to the maximum stack pointer (the farest point from the bottom of stack) */
+static int32_t wc_stack_frame = 0; /* Frame corresponding to the worst-case stack usage */
+static int current_calls = 0, max_num_calls = MAX_NUM_RECORDS;
+static char location_max_stack[256] = "undefined";
typedef struct
{
@@ -579,18 +746,12 @@ typedef struct
allocator_record *allocation_list = NULL;
-static int16_t *ptr_base_stack = 0; /* Pointer to the bottom of stack (base pointer). Stack grows up. */
-static int16_t *ptr_current_stack = 0; /* Pointer to the current stack pointer */
-static int16_t *ptr_max_stack = 0; /* Pointer to the maximum stack pointer (the farest point from the bottom of stack) */
-static int32_t wc_stack_frame = 0; /* Frame corresponding to the worst-case stack usage */
-static int32_t wc_ram_size, wc_ram_frame;
-static int32_t current_heap_size;
-static int current_calls = 0;
-static char location_max_stack[256] = "undefined";
static int Num_Records, Max_Num_Records;
static size_t Stat_Cnt_Size = USE_BYTES;
-static const char *Count_Unit[] = { "bytes", "words", "words" };
+static const char *Count_Unit[] = { "bytes", "words", "words", "words" };
+static int32_t wc_ram_size, wc_ram_frame;
+static int32_t current_heap_size;
static int *list_wc_intra_frame_heap, n_items_wc_intra_frame_heap, max_items_wc_intra_frame_heap, size_wc_intra_frame_heap, location_wc_intra_frame_heap;
static int *list_current_inter_frame_heap, n_items_current_inter_frame_heap, max_items_current_inter_frame_heap, size_current_inter_frame_heap;
static int *list_wc_inter_frame_heap, n_items_wc_inter_frame_heap, max_items_wc_inter_frame_heap, size_wc_inter_frame_heap, location_wc_inter_frame_heap;
@@ -611,11 +772,28 @@ void reset_mem( Counting_Size cnt_size )
int16_t something;
size_t tmp_size;
+ /* initialize list of stack records */
+ if ( stack_callers[0] == NULL )
+ {
+ stack_callers[0] = malloc( MAX_NUM_RECORDS * sizeof( caller_info ) );
+ stack_callers[1] = malloc( MAX_NUM_RECORDS * sizeof( caller_info ) );
+ }
+
+ if ( stack_callers[0] == NULL || stack_callers[1] == NULL )
+ {
+ fprintf( stderr, "Error: Unable to Allocate List of Stack Records!" );
+ exit( -1 );
+ }
+
+ current_calls = 0;
+ max_num_calls = MAX_NUM_RECORDS;
+
/* initialize stack pointers */
ptr_base_stack = &something;
ptr_max_stack = ptr_base_stack;
ptr_current_stack = ptr_base_stack;
+ /* initialize the unit of memory block size */
Stat_Cnt_Size = cnt_size;
/* Check, if sizeof(int32_t) is 4 bytes */
@@ -741,11 +919,12 @@ int push_stack( const char *filename, const char *fctname )
(void) *filename; /* to avoid compilation warning */
- /* Is there room to save the caller's information? */
- if ( current_calls >= MAX_RECORDABLE_CALLS )
- { /* No */
- fprintf( stderr, "No more room to store call stack info. Please increase MAX_RECORDABLE_CALLS" );
- exit( -1 );
+ if ( current_calls >= max_num_calls )
+ {
+ /* There is no room for a new record -> reallocate the list */
+ max_num_calls += MAX_NUM_RECORDS_REALLOC_STEP;
+ stack_callers[0] = realloc( stack_callers[0], max_num_calls * sizeof( caller_info ) );
+ stack_callers[1] = realloc( stack_callers[1], max_num_calls * sizeof( caller_info ) );
}
/* Valid Function Name? */
@@ -762,7 +941,7 @@ int push_stack( const char *filename, const char *fctname )
/* Save the Stack Pointer */
stack_callers[0][current_calls].stack_ptr = ptr_current_stack;
- /* Increase Stack Calling Tree Level */
+ /* Increase the Number of Calls in the List */
current_calls++;
/* Is this the First Time or the Worst Case? */
@@ -771,22 +950,24 @@ int push_stack( const char *filename, const char *fctname )
/* Save Info about it */
ptr_max_stack = ptr_current_stack;
- wc_stack_frame = update_cnt; /* current frame number is stored in the variable update_cnt and updated in the function update_wmops() */
+ /* save the worst-case frame number */
+ /* current frame number is stored in the variable update_cnt and updated in the function update_wmops() */
+ wc_stack_frame = update_cnt;
strncpy( location_max_stack, fctname, sizeof( location_max_stack ) - 1 );
location_max_stack[sizeof( location_max_stack ) - 1] = '\0';
/* Save Call Tree */
memmove( stack_callers[1], stack_callers[0], sizeof( caller_info ) * current_calls );
- /* Terminate the List (Unless Full) */
- if ( current_calls < MAX_RECORDABLE_CALLS )
+ /* Terminate the List with 0 (for printing purposes) */
+ if ( current_calls < max_num_calls )
{
stack_callers[1][current_calls].function_name[0] = 0;
}
}
/* Check, if This is the New Worst-Case RAM (stack + heap) */
- current_stack_size = (int32_t) ( ( ( ptr_base_stack - ptr_current_stack ) * sizeof( int16_t ) ) );
+ current_stack_size = ( int32_t )( ( ( ptr_base_stack - ptr_current_stack ) * sizeof( int16_t ) ) );
if ( current_stack_size < 0 )
{
@@ -815,13 +996,13 @@ int pop_stack( const char *filename, const char *fctname )
(void) *filename; /* to avoid compilation warning */
- /* Decrease Stack Calling */
+ /* Decrease the Number of Records */
current_calls--;
/* Get Pointer to Caller Information */
caller_info_ptr = &stack_callers[0][current_calls];
- /* Check, if Names Match */
+ /* Check, if the Function Names Match */
if ( strncmp( caller_info_ptr->function_name, fctname, MAX_FUNCTION_NAME_LENGTH ) != 0 )
{
fprintf( stderr, "Invalid usage of pop_stack()" );
@@ -860,7 +1041,7 @@ static void print_stack_call_tree( void )
fprintf( stdout, "\nList of functions when maximum stack size is reached:\n\n" );
caller_info_ptr = &stack_callers[1][0];
- for ( call_level = 0; call_level < MAX_RECORDABLE_CALLS; call_level++ )
+ for ( call_level = 0; call_level < max_num_calls; call_level++ )
{
/* Done? */
if ( caller_info_ptr->function_name[0] == 0 )
@@ -979,7 +1160,7 @@ void *mem_alloc(
#ifdef MEM_COUNT_DETAILS
/* Export heap memory allocation record to the .csv file */
- fprintf( fid_csv_filename, "A,%d,%s,%d,%d\n", update_cnt, ptr_record->name, ptr_record->lineno, ptr_record->block_size );
+ fprintf( fid_csv_filename, "A,%ld,%s,%d,%d\n", update_cnt, ptr_record->name, ptr_record->lineno, ptr_record->block_size );
#endif
if ( ptr_record->frame_allocated != -1 )
@@ -994,7 +1175,7 @@ void *mem_alloc(
current_heap_size += ptr_record->block_size;
/* Check, if this is the new Worst-Case RAM (stack + heap) */
- current_stack_size = (int32_t) ( ( ( ptr_base_stack - ptr_current_stack ) * sizeof( int16_t ) ) );
+ current_stack_size = ( int32_t )( ( ( ptr_base_stack - ptr_current_stack ) * sizeof( int16_t ) ) );
if ( current_stack_size + current_heap_size > wc_ram_size )
{
wc_ram_size = current_stack_size + current_heap_size;
@@ -1059,7 +1240,7 @@ static void *mem_alloc_block( size_t size, const char *size_str )
/* Fill Memory Block with Magic Value or 0 */
fill_value = MAGIC_VALUE_USED;
- if ( IS_CALLOC( size_str ) )
+ if ( size_str[0] == 'c' )
{
fill_value = 0x00000000;
}
@@ -1277,8 +1458,8 @@ allocator_record *get_mem_record( unsigned long *hash, const char *func_name, in
/*-------------------------------------------------------------------*
* mem_free()
*
- * This function de-allocatesd the memory block and frees the mphysical memory with free().
- * It also updates actual and average usage of the memory block.
+ * This function de-allocates memory blocks and frees physical memory with free().
+ * It also updates the actual and average usage of memory blocks.
*
* Note: The record is not removed from the list and may be reused later on in mem_alloc()!
*--------------------------------------------------------------------*/
@@ -1319,7 +1500,7 @@ void mem_free( const char *func_name, int func_lineno, void *ptr )
#ifdef MEM_COUNT_DETAILS
/* Export heap memory de-allocation record to the .csv file */
- fprintf( fid_csv_filename, "D,%d,%s,%d,%d\n", update_cnt, ptr_record->name, ptr_record->lineno, ptr_record->block_size );
+ fprintf( fid_csv_filename, "D,%ld,%s,%d,%d\n", update_cnt, ptr_record->name, ptr_record->lineno, ptr_record->block_size );
#endif
/* De-Allocate Memory Block */
@@ -1579,7 +1760,7 @@ static void mem_count_summary( void )
allocator_record *ptr_record, *ptr;
/* Prepare format string */
- sprintf( format_str, "%%-%ds %%5s %%6s %%-%ds %%20s %%6s ", MAX_FUNCTION_NAME_LENGTH, MAX_PARAMS_LENGTH );
+ sprintf( format_str, "%%-%d.%ds %%5.5s %%6.6s %%-%d.%ds %%20.20s %%6.6s ", 50, 50, 50, 50 );
if ( n_items_wc_intra_frame_heap > 0 )
{
@@ -1780,7 +1961,16 @@ void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] )
for ( i = 0; i < nElem; i++ )
{
- fprintf( stdout, "Program ROM size (%s): %d instruction words\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].PROM_size );
+ if ( Stat_Cnt_Size > 0 )
+ {
+ /* words */
+ fprintf( stdout, "Program ROM size (%s): %d words\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].PROM_size );
+ }
+ else
+ {
+ /* bytes (here, we assume that each instruction takes PROM_INST_SIZE bits of the PROM memory) */
+ fprintf( stdout, "Program ROM size (%s): %d bytes\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].PROM_size * ( PROM_INST_SIZE / 8 ) );
+ }
}
for ( i = 0; i < nElem; i++ )
@@ -1871,9 +2061,15 @@ void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] )
if ( Stat_Cnt_Size > 0 )
{
- fprintf( stdout, "\nNote: 1 word = %d bits\n", 8 << Stat_Cnt_Size );
- fprintf( stdout, "This is an optimistic estimate of memory consumption assuming that each variable type is stored with sizeof(type) bits\n" );
+ /* words */
+ fprintf( stdout, "\nNote: The Program ROM size is calculated under the assumption that 1 instruction word is stored with %d bits\n", 8 << Stat_Cnt_Size );
}
+ else
+ {
+ /* bytes */
+ fprintf( stdout, "\nNote: The Program ROM size is calculated under the assumption that 1 instruction word is stored with %d bits\n", PROM_INST_SIZE );
+ }
+ fprintf( stdout, "Note: The Data ROM size is calculated using the sizeof(type) built-in function\n" );
if ( n_items_wc_intra_frame_heap > 0 )
{
@@ -1886,6 +2082,17 @@ void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] )
free( allocation_list );
}
+ /* De-allocate list of stack records */
+ if ( stack_callers[0] != NULL )
+ {
+ free( stack_callers[0] );
+ }
+
+ if ( stack_callers[1] != NULL )
+ {
+ free( stack_callers[1] );
+ }
+
/* De-allocate heap allocation call tree */
if ( heap_allocation_call_tree != NULL )
{
@@ -1920,7 +2127,7 @@ void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] )
#endif /* WMOPS */
-#ifndef WMOPS_FLT
+
+#ifndef WMOPS
int cntr_push_pop = 0; /* global counter for checking balanced push_wmops()/pop_wmops() pairs when WMOPS is not activated */
-double ops_cnt;
#endif
diff --git a/lib_debug/wmc_auto.h b/lib_debug/wmc_auto.h
index 7d07a84a0e9383331f20e5181a548fca927d798f..5f5d6d9753f98612762f47dca560f63c7b22ddd6 100644
--- a/lib_debug/wmc_auto.h
+++ b/lib_debug/wmc_auto.h
@@ -23,21 +23,17 @@
#include /* stdio is needed for fprintf() */
#endif
+#include "options.h"
/* To Prevent "warning: '$' in identifier or number" message under GCC */
#ifdef __GNUC__
#pragma GCC system_header
#endif
-/* Real-time relationships */
#define FRAMES_PER_SECOND 50.0
-#define MILLION_CYCLES 1e6
-#define WMOPS_BOOST_FAC ( 1.0f ) /* scaling factor for equalizing the difference between automatic and manual instrumentation */
-#define FAC ( FRAMES_PER_SECOND / MILLION_CYCLES * WMOPS_BOOST_FAC )
-#define NUM_INST 20 /* Total number of instruction types (in enum below) */
+#define PROM_INST_SIZE 32 /* number of bits of each program instruction when stored in the PROM memory (applied only when the user selects reporting in bytes) */
-
-#ifdef WMOPS_FLT
+#ifdef WMOPS
enum instructions
{
_ADD,
@@ -59,7 +55,8 @@ enum instructions
_TEST,
_POWER,
_LOG,
- _MISC
+ _MISC,
+ NUM_INST
};
#define _ADD_C 1
@@ -107,14 +104,14 @@ enum instructions
#define ADD( x ) \
{ \
{ \
- ops_cnt += ( _ADD_C * ( x ) ); \
+ ops_cnt_wmc += ( _ADD_C * ( x ) ); \
inst_cnt[_ADD] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _ADD_P * ( x ) ); \
+ prom_cnt_wmc += ( _ADD_P * ( x ) ); \
} \
} \
} \
@@ -122,14 +119,14 @@ enum instructions
#define ABS( x ) \
{ \
{ \
- ops_cnt += ( _ABS_C * ( x ) ); \
+ ops_cnt_wmc += ( _ABS_C * ( x ) ); \
inst_cnt[_ABS] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _ABS_P * ( x ) ); \
+ prom_cnt_wmc += ( _ABS_P * ( x ) ); \
} \
} \
} \
@@ -137,14 +134,14 @@ enum instructions
#define MULT( x ) \
{ \
{ \
- ops_cnt += ( _MULT_C * ( x ) ); \
+ ops_cnt_wmc += ( _MULT_C * ( x ) ); \
inst_cnt[_MULT] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _MULT_P * ( x ) ); \
+ prom_cnt_wmc += ( _MULT_P * ( x ) ); \
} \
} \
} \
@@ -152,14 +149,14 @@ enum instructions
#define MAC( x ) \
{ \
{ \
- ops_cnt += ( _MAC_C * ( x ) ); \
+ ops_cnt_wmc += ( _MAC_C * ( x ) ); \
inst_cnt[_MAC] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _MAC_P * ( x ) ); \
+ prom_cnt_wmc += ( _MAC_P * ( x ) ); \
} \
} \
} \
@@ -167,14 +164,14 @@ enum instructions
#define MOVE( x ) \
{ \
{ \
- ops_cnt += ( _MOVE_C * ( x ) ); \
+ ops_cnt_wmc += ( _MOVE_C * ( x ) ); \
inst_cnt[_MOVE] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _MOVE_P * ( x ) ); \
+ prom_cnt_wmc += ( _MOVE_P * ( x ) ); \
} \
} \
} \
@@ -182,14 +179,14 @@ enum instructions
#define STORE( x ) \
{ \
{ \
- ops_cnt += ( _STORE_C * ( x ) ); \
+ ops_cnt_wmc += ( _STORE_C * ( x ) ); \
inst_cnt[_STORE] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _STORE_P * ( x ) ); \
+ prom_cnt_wmc += ( _STORE_P * ( x ) ); \
} \
} \
} \
@@ -197,14 +194,14 @@ enum instructions
#define LOGIC( x ) \
{ \
{ \
- ops_cnt += ( _LOGIC_C * ( x ) ); \
+ ops_cnt_wmc += ( _LOGIC_C * ( x ) ); \
inst_cnt[_LOGIC] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _LOGIC_P * ( x ) ); \
+ prom_cnt_wmc += ( _LOGIC_P * ( x ) ); \
} \
} \
} \
@@ -212,14 +209,14 @@ enum instructions
#define SHIFT( x ) \
{ \
{ \
- ops_cnt += ( _SHIFT_C * ( x ) ); \
+ ops_cnt_wmc += ( _SHIFT_C * ( x ) ); \
inst_cnt[_SHIFT] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _SHIFT_P * ( x ) ); \
+ prom_cnt_wmc += ( _SHIFT_P * ( x ) ); \
} \
} \
} \
@@ -227,14 +224,14 @@ enum instructions
#define BRANCH( x ) \
{ \
{ \
- ops_cnt += ( _BRANCH_C * ( x ) ); \
+ ops_cnt_wmc += ( _BRANCH_C * ( x ) ); \
inst_cnt[_BRANCH] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _BRANCH_P * ( x ) ); \
+ prom_cnt_wmc += ( _BRANCH_P * ( x ) ); \
} \
} \
} \
@@ -242,14 +239,14 @@ enum instructions
#define DIV( x ) \
{ \
{ \
- ops_cnt += ( _DIV_C * ( x ) ); \
+ ops_cnt_wmc += ( _DIV_C * ( x ) ); \
inst_cnt[_DIV] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _DIV_P * ( x ) ); \
+ prom_cnt_wmc += ( _DIV_P * ( x ) ); \
} \
} \
} \
@@ -257,14 +254,14 @@ enum instructions
#define SQRT( x ) \
{ \
{ \
- ops_cnt += ( _SQRT_C * ( x ) ); \
+ ops_cnt_wmc += ( _SQRT_C * ( x ) ); \
inst_cnt[_SQRT] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _SQRT_P * ( x ) ); \
+ prom_cnt_wmc += ( _SQRT_P * ( x ) ); \
} \
} \
} \
@@ -272,14 +269,14 @@ enum instructions
#define TRANS( x ) \
{ \
{ \
- ops_cnt += ( _TRANS_C * ( x ) ); \
+ ops_cnt_wmc += ( _TRANS_C * ( x ) ); \
inst_cnt[_TRANS] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _TRANS_P * ( x ) ); \
+ prom_cnt_wmc += ( _TRANS_P * ( x ) ); \
} \
} \
} \
@@ -287,14 +284,14 @@ enum instructions
#define LOOP( x ) \
{ \
{ \
- ops_cnt += ( _LOOP_C * ( x ) ); \
+ ops_cnt_wmc += ( _LOOP_C * ( x ) ); \
inst_cnt[_LOOP] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _LOOP_P * ( x ) ); \
+ prom_cnt_wmc += ( _LOOP_P * ( x ) ); \
} \
} \
} \
@@ -302,14 +299,14 @@ enum instructions
#define INDIRECT( x ) \
{ \
{ \
- ops_cnt += ( _INDIRECT_C * ( x ) ); \
+ ops_cnt_wmc += ( _INDIRECT_C * ( x ) ); \
inst_cnt[_INDIRECT] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _INDIRECT_P * ( x ) ); \
+ prom_cnt_wmc += ( _INDIRECT_P * ( x ) ); \
} \
} \
} \
@@ -317,14 +314,14 @@ enum instructions
#define PTR_INIT( x ) \
{ \
{ \
- ops_cnt += ( _PTR_INIT_C * ( x ) ); \
+ ops_cnt_wmc += ( _PTR_INIT_C * ( x ) ); \
inst_cnt[_PTR_INIT] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _PTR_INIT_P * ( x ) ); \
+ prom_cnt_wmc += ( _PTR_INIT_P * ( x ) ); \
} \
} \
} \
@@ -332,14 +329,14 @@ enum instructions
#define TEST( x ) \
{ \
{ \
- ops_cnt += ( _TEST_C * ( x ) ); \
+ ops_cnt_wmc += ( _TEST_C * ( x ) ); \
inst_cnt[_TEST] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _TEST_P * ( x ) ); \
+ prom_cnt_wmc += ( _TEST_P * ( x ) ); \
} \
} \
} \
@@ -347,14 +344,14 @@ enum instructions
#define POWER( x ) \
{ \
{ \
- ops_cnt += ( _POWER_C * ( x ) ); \
+ ops_cnt_wmc += ( _POWER_C * ( x ) ); \
inst_cnt[_POWER] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _POWER_P * ( x ) ); \
+ prom_cnt_wmc += ( _POWER_P * ( x ) ); \
} \
} \
} \
@@ -362,14 +359,14 @@ enum instructions
#define LOG( x ) \
{ \
{ \
- ops_cnt += ( _LOG_C * ( x ) ); \
+ ops_cnt_wmc += ( _LOG_C * ( x ) ); \
inst_cnt[_LOG] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _LOG_P * ( x ) ); \
+ prom_cnt_wmc += ( _LOG_P * ( x ) ); \
} \
} \
} \
@@ -377,14 +374,14 @@ enum instructions
#define MISC( x ) \
{ \
{ \
- ops_cnt += ( _MISC_C * ( x ) ); \
+ ops_cnt_wmc += ( _MISC_C * ( x ) ); \
inst_cnt[_MISC] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _MISC_P * ( x ) ); \
+ prom_cnt_wmc += ( _MISC_P * ( x ) ); \
} \
} \
} \
@@ -393,7 +390,7 @@ enum instructions
#define FUNC( x ) \
{ \
{ \
- ops_cnt += ( _FUNC_C + _MOVE_C * ( x ) ); \
+ ops_cnt_wmc += ( _FUNC_C + _MOVE_C * ( x ) ); \
inst_cnt[_FUNC]++; \
inst_cnt[_MOVE] += ( x ); \
{ \
@@ -401,7 +398,7 @@ enum instructions
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _FUNC_P + _MOVE_P * ( x ) ); \
+ prom_cnt_wmc += ( _FUNC_P + _MOVE_P * ( x ) ); \
} \
} \
} \
@@ -410,14 +407,14 @@ enum instructions
#define DADD( x ) \
{ \
{ \
- ops_cnt += ( 2 * _ADD_C * ( x ) ); \
+ ops_cnt_wmc += ( 2 * _ADD_C * ( x ) ); \
inst_cnt[_ADD] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _ADD_P * ( x ) ); \
+ prom_cnt_wmc += ( _ADD_P * ( x ) ); \
} \
} \
} \
@@ -425,14 +422,14 @@ enum instructions
#define DMULT( x ) \
{ \
{ \
- ops_cnt += ( 2 * _MULT_C * ( x ) ); \
+ ops_cnt_wmc += ( 2 * _MULT_C * ( x ) ); \
inst_cnt[_MULT] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _MULT_P * ( x ) ); \
+ prom_cnt_wmc += ( _MULT_P * ( x ) ); \
} \
} \
} \
@@ -440,14 +437,14 @@ enum instructions
#define DMAC( x ) \
{ \
{ \
- ops_cnt += ( 2 * _MAC_C * ( x ) ); \
+ ops_cnt_wmc += ( 2 * _MAC_C * ( x ) ); \
inst_cnt[_MAC] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _MAC_P * ( x ) ); \
+ prom_cnt_wmc += ( _MAC_P * ( x ) ); \
} \
} \
} \
@@ -455,14 +452,14 @@ enum instructions
#define DMOVE( x ) \
{ \
{ \
- ops_cnt += ( 2 * _MOVE_C * ( x ) ); \
+ ops_cnt_wmc += ( 2 * _MOVE_C * ( x ) ); \
inst_cnt[_MOVE] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _MOVE_P * ( x ) ); \
+ prom_cnt_wmc += ( _MOVE_P * ( x ) ); \
} \
} \
} \
@@ -470,14 +467,14 @@ enum instructions
#define DSTORE( x ) \
{ \
{ \
- ops_cnt += ( 2 * _STORE_C * ( x ) ); \
+ ops_cnt_wmc += ( 2 * _STORE_C * ( x ) ); \
inst_cnt[_STORE] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _STORE_P * ( x ) ); \
+ prom_cnt_wmc += ( _STORE_P * ( x ) ); \
} \
} \
} \
@@ -485,14 +482,14 @@ enum instructions
#define DLOGIC( x ) \
{ \
{ \
- ops_cnt += ( 2 * _LOGIC_C * ( x ) ); \
+ ops_cnt_wmc += ( 2 * _LOGIC_C * ( x ) ); \
inst_cnt[_LOGIC] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _LOGIC_P * ( x ) ); \
+ prom_cnt_wmc += ( _LOGIC_P * ( x ) ); \
} \
} \
} \
@@ -500,14 +497,14 @@ enum instructions
#define DSHIFT( x ) \
{ \
{ \
- ops_cnt += ( 2 * _SHIFT_C * ( x ) ); \
+ ops_cnt_wmc += ( 2 * _SHIFT_C * ( x ) ); \
inst_cnt[_SHIFT] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _SHIFT_P * ( x ) ); \
+ prom_cnt_wmc += ( _SHIFT_P * ( x ) ); \
} \
} \
} \
@@ -515,14 +512,14 @@ enum instructions
#define DDIV( x ) \
{ \
{ \
- ops_cnt += ( 2 * _DIV_C * ( x ) ); \
+ ops_cnt_wmc += ( 2 * _DIV_C * ( x ) ); \
inst_cnt[_DIV] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _DIV_P * ( x ) ); \
+ prom_cnt_wmc += ( _DIV_P * ( x ) ); \
} \
} \
} \
@@ -530,14 +527,14 @@ enum instructions
#define DSQRT( x ) \
{ \
{ \
- ops_cnt += ( 2 * _SQRT_C * ( x ) ); \
+ ops_cnt_wmc += ( 2 * _SQRT_C * ( x ) ); \
inst_cnt[_SQRT] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _SQRT_P * ( x ) ); \
+ prom_cnt_wmc += ( _SQRT_P * ( x ) ); \
} \
} \
} \
@@ -545,42 +542,40 @@ enum instructions
#define DTRANS( x ) \
{ \
{ \
- ops_cnt += ( 2 * _TRANS_C * ( x ) ); \
+ ops_cnt_wmc += ( 2 * _TRANS_C * ( x ) ); \
inst_cnt[_TRANS] += ( x ); \
{ \
static int pcnt; \
if ( !pcnt ) \
{ \
pcnt = 1; \
- prom_cnt += ( _TRANS_P * ( x ) ); \
+ prom_cnt_wmc += ( _TRANS_P * ( x ) ); \
} \
} \
} \
}
-extern double ops_cnt;
-extern double prom_cnt;
+extern double ops_cnt_wmc;
+extern double prom_cnt_wmc;
extern double inst_cnt[NUM_INST];
-extern int ops_cnt_activ;
-void reset_wmops( void );
-void push_wmops( const char *label );
+#define push_wmops( ... ) push_wmops_fct( __VA_ARGS__, NULL )
+void push_wmops_fct( const char *label, ... );
void pop_wmops( void );
+void reset_wmops( void );
+void print_wmops( void );
void update_wmops( void );
void update_mem( void );
-void print_wmops( void );
-#else /* WMOPS_FL counting disabled */
-#if 0 /* -> defined in count.h instead */
-#include
-#define reset_wmops()
+#else
+
extern int cntr_push_pop;
#define push_wmops( x ) ( cntr_push_pop++ )
#define pop_wmops() ( cntr_push_pop-- )
-#define update_wmops() ( assert( cntr_push_pop == 0 ) )
-#define update_mem()
+#define reset_wmops()
#define print_wmops()
-#endif
+#define update_wmops() ( assert( cntr_push_pop == 0 ) )
+#define update_mem()
#define ADD( x )
#define ABS( x )
@@ -620,11 +615,11 @@ extern int cntr_push_pop;
#ifndef mac
#define mac( a, b, c ) ( ( a ) + ( b ) * ( c ) )
#endif
-#ifndef mac
+#ifndef msu
#define msu( a, b, c ) ( ( a ) - ( b ) * ( c ) )
#endif
-#ifndef WMOPS_FLT
+#ifndef WMOPS
/* DESACTIVATE the Counting Mechanism */
#define OP_COUNT_( op, n )
@@ -639,8 +634,8 @@ extern int cntr_push_pop;
#else
-/* '*ops_cnt_ptr' is Used to Avoid: "warning: operation on 'ops_cnt' may be undefined" with Cygwin gcc Compiler */
-static double *ops_cnt_ptr = &ops_cnt;
+/* '*ops_cnt_ptr' is Used to Avoid: "warning: operation on 'ops_cnt_wmc' may be undefined" with Cygwin gcc Compiler */
+static double *ops_cnt_ptr = &ops_cnt_wmc;
#define OP_COUNT_( op, x ) ( *ops_cnt_ptr += ( op##_C * ( x ) ), inst_cnt[op] += ( x ) )
/******************************************************************/
@@ -671,84 +666,99 @@ static int wmc_flag_ = 0;
#endif
/* Define all Macros without '{' & '}' (None of these should be called externally!) */
-#define ABS_( x ) OP_COUNT_( _ABS, ( x ) / WMOPS_BOOST_FAC )
-#define ADD_( x ) OP_COUNT_( _ADD, ( x ) / WMOPS_BOOST_FAC )
-#define MULT_( x ) OP_COUNT_( _MULT, ( x ) / WMOPS_BOOST_FAC )
-#define MAC_( x ) OP_COUNT_( _MAC, ( x ) / WMOPS_BOOST_FAC )
-#define MOVE_( x ) OP_COUNT_( _MOVE, ( x ) / WMOPS_BOOST_FAC )
-#define STORE_( x ) OP_COUNT_( _STORE, ( x ) / WMOPS_BOOST_FAC )
-#define LOGIC_( x ) OP_COUNT_( _LOGIC, ( x ) / WMOPS_BOOST_FAC )
-#define SHIFT_( x ) OP_COUNT_( _SHIFT, ( x ) / WMOPS_BOOST_FAC )
-#define BRANCH_( x ) OP_COUNT_( _BRANCH, ( x ) / WMOPS_BOOST_FAC )
-#define DIV_( x ) OP_COUNT_( _DIV, ( x ) / WMOPS_BOOST_FAC )
-#define SQRT_( x ) OP_COUNT_( _SQRT, ( x ) / WMOPS_BOOST_FAC )
-#define TRANS_( x ) OP_COUNT_( _TRANS, ( x ) / WMOPS_BOOST_FAC )
+#define ABS_( x ) OP_COUNT_( _ABS, ( x ) )
+#define ADD_( x ) OP_COUNT_( _ADD, ( x ) )
+#define MULT_( x ) OP_COUNT_( _MULT, ( x ) )
+#define MAC_( x ) OP_COUNT_( _MAC, ( x ) )
+#define MOVE_( x ) OP_COUNT_( _MOVE, ( x ) )
+#define STORE_( x ) OP_COUNT_( _STORE, ( x ) )
+#define LOGIC_( x ) OP_COUNT_( _LOGIC, ( x ) )
+#define SHIFT_( x ) OP_COUNT_( _SHIFT, ( x ) )
+#define BRANCH_( x ) OP_COUNT_( _BRANCH, ( x ) )
+#define DIV_( x ) OP_COUNT_( _DIV, ( x ) )
+#define SQRT_( x ) OP_COUNT_( _SQRT, ( x ) )
+#define TRANS_( x ) OP_COUNT_( _TRANS, ( x ) )
#define POWER_( x ) TRANS_( x )
#define LOG_( x ) TRANS_( x )
-#define LOOP_( x ) OP_COUNT_( _LOOP, ( x ) / WMOPS_BOOST_FAC )
-#define INDIRECT_( x ) OP_COUNT_( _INDIRECT, ( x ) / WMOPS_BOOST_FAC )
-#define PTR_INIT_( x ) OP_COUNT_( _PTR_INIT, ( x ) / WMOPS_BOOST_FAC )
-#define FUNC_( x ) ( OP_COUNT_( _MOVE, ( x ) / WMOPS_BOOST_FAC ), OP_COUNT_( _FUNC, 1 ) )
+#define LOOP_( x ) OP_COUNT_( _LOOP, ( x ) )
+#define INDIRECT_( x ) OP_COUNT_( _INDIRECT, ( x ) )
+#define PTR_INIT_( x ) OP_COUNT_( _PTR_INIT, ( x ) )
+#define FUNC_( x ) ( OP_COUNT_( _MOVE, ( x ) ), OP_COUNT_( _FUNC, 1 ) )
#define MISC_( x ) ABS_( x )
/* Math Operations */
-#define abs_ OP_COUNT_WRAPPER1_( ABS_( 1 ), abs )
-#define fabs_ OP_COUNT_WRAPPER1_( ABS_( 1 ), fabs )
-#define labs_ OP_COUNT_WRAPPER1_( ABS_( 1 ), labs )
-#define floor_ OP_COUNT_WRAPPER1_( MISC_( 1 ), floor )
-#define sqrt_ OP_COUNT_WRAPPER1_( SQRT_( 1 ), sqrt )
-#define pow_ OP_COUNT_WRAPPER1_( POWER_( 1 ), pow )
-#define exp_ OP_COUNT_WRAPPER1_( POWER_( 1 ), exp )
-#define log_ OP_COUNT_WRAPPER1_( LOG_( 1 ), log )
-#define log10_ OP_COUNT_WRAPPER1_( LOG_( 1 ), log10 )
-#define cos_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), cos )
-#define sin_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), sin )
-#define tan_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), tan )
-#define acos_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), acos )
-#define asin_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), asin )
-#define atan_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), atan )
-#define atan2_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), atan2 )
-#define cosh_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), cosh )
-#define sinh_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), sinh )
-#define tanh_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), tanh )
-#define fmod_ OP_COUNT_WRAPPER1_( DIV_( 1 ), fmod )
-/* these macros use any local macros already defined */
-/* min/max and their Variants */
-#define min_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), min( ( a ), ( b ) ) )
-#define max_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), max( ( a ), ( b ) ) )
-#define MIN_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), MIN( ( a ), ( b ) ) )
-#define MAX_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), MAX( ( a ), ( b ) ) )
-#define Min_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), Min( ( a ), ( b ) ) )
-#define Max_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), Max( ( a ), ( b ) ) )
-/* Square and its Variants */
-#define sqr_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), sqr( ( x ) ) )
-#define Sqr_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), Sqr( ( x ) ) )
-#define SQR_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), SQR( ( x ) ) )
-#define square_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), square( ( x ) ) )
-#define Square_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), Square( ( x ) ) )
-#define SQUARE_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), SQUARE( ( x ) ) )
-/* Sign and its Variants */
-#define sign_( x ) OP_COUNT_WRAPPER1_( MOVE_( 1 ), sign( ( x ) ) )
-#define Sign_( x ) OP_COUNT_WRAPPER1_( MOVE_( 1 ), Sign( ( x ) ) )
-#define SIGN_( x ) OP_COUNT_WRAPPER1_( MOVE_( 1 ), SIGN( ( x ) ) )
-/* Square Root and its Variants */
-#define sqrtf_( x ) OP_COUNT_WRAPPER1_( SQRT_( 1 ), sqrtf( ( x ) ) )
-/* Invert Square Root and its Variants */
-#define inv_sqrt_( x ) OP_COUNT_WRAPPER1_( SQRT_( 1 ), inv_sqrt( ( x ) ) )
-/* Others */
+#define abs_ OP_COUNT_WRAPPER1_( ABS_( 1 ), abs )
+#define fabs_ OP_COUNT_WRAPPER1_( ABS_( 1 ), fabs )
+#define fabsf_ OP_COUNT_WRAPPER1_( ABS_( 1 ), fabsf )
+#define labs_ OP_COUNT_WRAPPER1_( ABS_( 1 ), labs )
+#define floor_ OP_COUNT_WRAPPER1_( MISC_( 1 ), floor )
+#define floorf_ OP_COUNT_WRAPPER1_( MISC_( 1 ), floorf )
+#define sqrt_ OP_COUNT_WRAPPER1_( SQRT_( 1 ), sqrt )
+#define sqrtf_ OP_COUNT_WRAPPER1_( SQRT_( 1 ), sqrtf )
+#define pow_ OP_COUNT_WRAPPER1_( POWER_( 1 ), pow )
+#define powf_ OP_COUNT_WRAPPER1_( POWER_( 1 ), powf )
+#define exp_ OP_COUNT_WRAPPER1_( POWER_( 1 ), exp )
+#define expf_ OP_COUNT_WRAPPER1_( POWER_( 1 ), expf )
+#define log_ OP_COUNT_WRAPPER1_( LOG_( 1 ), log )
+#define logf_ OP_COUNT_WRAPPER1_( LOG_( 1 ), logf )
+#define log10_ OP_COUNT_WRAPPER1_( LOG_( 1 ), log10 )
+#define log10f_ OP_COUNT_WRAPPER1_( LOG_( 1 ), log10f )
+#define cos_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), cos )
+#define cosf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), cosf )
+#define sin_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), sin )
+#define sinf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), sinf )
+#define tan_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), tan )
+#define tanf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), tanf )
+#define acos_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), acos )
+#define acosf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), acosf )
+#define asin_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), asin )
+#define asinf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), asinf )
+#define atan_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), atan )
+#define atanf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), atanf )
+#define atan2_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), atan2 )
+#define atan2f_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), atan2f )
+#define cosh_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), cosh )
+#define coshf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), coshf )
+#define sinh_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), sinh )
+#define sinhf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), sinhf )
+#define tanh_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), tanh )
+#define tanhf_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), tanhf )
+#define fmod_ OP_COUNT_WRAPPER1_( DIV_( 1 ), fmod )
+#define fmodf_ OP_COUNT_WRAPPER1_( DIV_( 1 ), fmodf )
+#define frexp_ OP_COUNT_WRAPPER1_( MISC_( 2 ), frexp )
+#define frexpf_ OP_COUNT_WRAPPER1_( MISC_( 2 ), frexpf )
+
+/* the macros below are instrumented versions of user-defined macros that might be used in the source code
+ representing some well-known and recognized mathematical operations (that are not defined in math.h)
+ Note: the 'wmc_flag_=wmc_flag_' is used to avoid warning: left-hand operand of comma expression has no effect with gcc */
+
+#define min_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), min( ( a ), ( b ) ) )
+#define max_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), max( ( a ), ( b ) ) )
+#define MIN_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), MIN( ( a ), ( b ) ) )
+#define MAX_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), MAX( ( a ), ( b ) ) )
+#define Min_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), Min( ( a ), ( b ) ) )
+#define Max_( a, b ) OP_COUNT_WRAPPER1_( MISC_( 1 ), Max( ( a ), ( b ) ) )
+#define sqr_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), sqr( ( x ) ) )
+#define Sqr_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), Sqr( ( x ) ) )
+#define SQR_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), SQR( ( x ) ) )
+#define square_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), square( ( x ) ) )
+#define Square_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), Square( ( x ) ) )
+#define SQUARE_( x ) OP_COUNT_WRAPPER1_( MULT_( 1 ), SQUARE( ( x ) ) )
+#define sign_( x ) OP_COUNT_WRAPPER1_( MOVE_( 1 ), sign( ( x ) ) )
+#define Sign_( x ) OP_COUNT_WRAPPER1_( MOVE_( 1 ), Sign( ( x ) ) )
+#define SIGN_( x ) OP_COUNT_WRAPPER1_( MOVE_( 1 ), SIGN( ( x ) ) )
+#define inv_sqrt_( x ) OP_COUNT_WRAPPER1_( SQRT_( 1 ), inv_sqrt( ( x ) ) )
+#define inv_sqrtf_( x ) OP_COUNT_WRAPPER1_( SQRT_( 1 ), inv_sqrtf( ( x ) ) )
#define log_base_2_( x ) OP_COUNT_WRAPPER1_( ( LOG_( 1 ), MULT_( 1 ) ), log_base_2( ( x ) ) )
+#define log2_( x ) OP_COUNT_WRAPPER1_( ( LOG_( 1 ), MULT_( 1 ) ), log2( ( x ) ) )
+#define log2f_( x ) OP_COUNT_WRAPPER1_( ( LOG_( 1 ), MULT_( 1 ) ), log2f( ( x ) ) )
#define log2_f_( x ) OP_COUNT_WRAPPER1_( ( LOG_( 1 ), MULT_( 1 ) ), log2_f( ( x ) ) )
-/* The 'wmc_flag_=wmc_flag_' is Used to Avoid: "warning: left-hand operand of comma expression has no effect"
- with Cygwin gcc Compiler */
-#define _round_( x ) OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, _round( ( x ) ) )
-#define round_f_( x ) OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, round_f( ( x ) ) )
-#define _squant_( x ) OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, _squant( ( x ) ) )
-/* Set Min/Max */
+#define _round_( x ) OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, _round( ( x ) ) )
+#define round_( x ) OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, round( ( x ) ) )
+#define round_f_( x ) OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, round_f( ( x ) ) )
+#define roundf_( x ) OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, roundf( ( x ) ) )
#define set_min_( a, b ) OP_COUNT_WRAPPER3_( ( ADD_( 1 ), BRANCH_( 1 ), MOVE_( 1 ) ), set_min( ( a ), ( b ) ) )
#define set_max_( a, b ) OP_COUNT_WRAPPER3_( ( ADD_( 1 ), BRANCH_( 1 ), MOVE_( 1 ) ), set_max( ( a ), ( b ) ) )
-/* mac & msu (Instrumented Versions) */
-#define mac_( a, b, c ) OP_COUNT_WRAPPER1_( MAC_( 1 ), mac( a, b, c ) )
-#define msu_( a, b, c ) OP_COUNT_WRAPPER1_( MAC_( 1 ), msu( a, b, c ) )
/* Functions */
#define func_( name, x ) OP_COUNT_WRAPPER1_( FUNC_( x ), name )
@@ -797,7 +807,7 @@ static int wmc_flag_ = 0;
switch
#define cost_( n ) OP_COUNT_WRAPPER2_( wmc_flag_ ? ( ADD_( n ), BRANCH_( n ), wmc_flag_ = 0 ) : 0 );
-#ifdef WMOPS_FLT
+#ifdef WMOPS
#define ACC 2
#define MUL 1
@@ -969,7 +979,7 @@ typedef struct ROM_Size_Lookup_Table
* ROM_Size_Lookup_Table Const_Data_PROM_Table[] =
* {
* {"../lib_enc/rom_enc.c", 0, NULL},
- * {"../lib_com/*.c", 0, NULL},
+ * {"../lib_com/[star].c", 0, NULL},
* {"", -1, NULL}
* };
* #endif
@@ -998,7 +1008,7 @@ typedef enum
#endif
-#ifdef WMOPS_FLT
+#ifdef WMOPS
void *mem_alloc( const char *func_name, int func_lineno, size_t size, char *alloc_str );
void mem_free( const char *func_name, int func_lineno, void *ptr );
diff --git a/lib_dec/FEC_HQ_core_fx.c b/lib_dec/FEC_HQ_core_fx.c
index 3a5b71cff6db35db2eefd5992aafa17ee8581395..49dab93588a863200675b1a0fcf3522397273592 100644
--- a/lib_dec/FEC_HQ_core_fx.c
+++ b/lib_dec/FEC_HQ_core_fx.c
@@ -1015,1099 +1015,1101 @@ void HQ_FEC_Mem_update_fx(
move16();
hHQ_core->old_is_transient[0] = is_transient;
move16();
-
- return;
+#ifdef ADD_IVAS_HQ_CODE_FEC
}
+#endif
+ return;
+}
#endif
#ifdef IVAS_FLOAT_FIXED
- static Word16 find_best_delay_fx(
- Word16 * mu_o_fx,
- Word16 * in_fx,
- Word16 mind1,
- Word16 maxd1,
- Word16 lin,
- Word16 delta,
- Word16 * false_flag )
- {
- Word16 i, d1, k;
- Word16 d1m = 0;
-
- Word16 tmp, exp1, exp2;
- Word32 L_tmp1, L_tmp2;
-
- Word32 min_sq_cross_fx, min_corr_fx;
- Word32 accA_fx, accB_fx;
- Word32 Rxy_fx[MAXDELAY_FEC], Ryy_fx[MAXDELAY_FEC];
+static Word16 find_best_delay_fx(
+ Word16 *mu_o_fx,
+ Word16 *in_fx,
+ Word16 mind1,
+ Word16 maxd1,
+ Word16 lin,
+ Word16 delta,
+ Word16 *false_flag )
+{
+ Word16 i, d1, k;
+ Word16 d1m = 0;
+
+ Word16 tmp, exp1, exp2;
+ Word32 L_tmp1, L_tmp2;
+
+ Word32 min_sq_cross_fx, min_corr_fx;
+ Word32 accA_fx, accB_fx;
+ Word32 Rxy_fx[MAXDELAY_FEC], Ryy_fx[MAXDELAY_FEC];
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
+ Flag Overflow = 0;
+ move32();
#endif
- move16(); // d1m
+ move16(); // d1m
- d1 = mind1;
- move16();
- FOR( k = 0; k < idiv1616( sub( maxd1, mind1 ), delta ); k++ )
+ d1 = mind1;
+ move16();
+ FOR( k = 0; k < idiv1616( sub( maxd1, mind1 ), delta ); k++ )
+ {
+ accA_fx = L_deposit_l( 0 );
+ accB_fx = L_deposit_l( 0 );
+ FOR( i = 0; i < lin; i += delta )
{
- accA_fx = L_deposit_l( 0 );
- accB_fx = L_deposit_l( 0 );
- FOR( i = 0; i < lin; i += delta )
- {
#ifdef BASOP_NOGLOB
- accA_fx = L_add_sat( accA_fx, L_shr( L_mult_sat( mu_o_fx[add( d1, i )], mu_o_fx[add( d1, i )] ), 2 ) );
- accB_fx = L_add_sat( accB_fx, L_shr( L_mult_sat( mu_o_fx[add( d1, i )], in_fx[i] ), 2 ) );
+ accA_fx = L_add_sat( accA_fx, L_shr( L_mult_sat( mu_o_fx[add( d1, i )], mu_o_fx[add( d1, i )] ), 2 ) );
+ accB_fx = L_add_sat( accB_fx, L_shr( L_mult_sat( mu_o_fx[add( d1, i )], in_fx[i] ), 2 ) );
#else
accA_fx = L_add( accA_fx, L_shr( L_mult( mu_o_fx[d1 + i], mu_o_fx[d1 + i] ), 2 ) );
accB_fx = L_add( accB_fx, L_shr( L_mult( mu_o_fx[d1 + i], in_fx[i] ), 2 ) );
#endif
- }
-
- Rxy_fx[k] = accB_fx;
- move32();
- Ryy_fx[k] = accA_fx;
- move32();
-
- d1 = add( d1, delta );
}
- /* Obtain the best delay values */
- min_sq_cross_fx = 0x80000000;
+ Rxy_fx[k] = accB_fx;
+ move32();
+ Ryy_fx[k] = accA_fx;
move32();
- min_corr_fx = L_deposit_l( 0 );
- exp2 = 0;
- move16();
- FOR( d1 = 0; d1 < ( maxd1 - mind1 ) / delta; d1++ )
- {
- IF( GT_32( L_abs( Rxy_fx[d1] ), L_abs( Ryy_fx[d1] ) ) )
- exp1 = norm_l( Rxy_fx[d1] );
- ELSE
- exp1 = norm_l( Ryy_fx[d1] );
- L_tmp1 = Mult_32_32( L_shl( Rxy_fx[d1], exp1 ), L_shl( min_corr_fx, exp2 ) );
- L_tmp2 = Mult_32_32( L_shl( Ryy_fx[d1], exp1 ), L_shl( min_sq_cross_fx, exp2 ) );
- IF( GE_32( L_tmp1, L_tmp2 ) )
- {
- d1m = d1;
- move16();
- min_corr_fx = L_add( Ryy_fx[d1], 0 ); /*12 + 12 - 31 */
- min_sq_cross_fx = L_add( Rxy_fx[d1], 0 ); /*12 + 12 - 31 */
- exp2 = exp1;
- move16();
- }
- }
+ d1 = add( d1, delta );
+ }
- test();
- IF( ( min_sq_cross_fx <= 0 ) || ( min_corr_fx <= 0 ) )
- {
- tmp = 0;
- move16(); /* If cross correlation is negative, the division per the energy will always be negative --> tmp will be < 8192, no need to do the division per say */
- }
+ /* Obtain the best delay values */
+ min_sq_cross_fx = 0x80000000;
+ move32();
+ min_corr_fx = L_deposit_l( 0 );
+ exp2 = 0;
+ move16();
+ FOR( d1 = 0; d1 < ( maxd1 - mind1 ) / delta; d1++ )
+ {
+ IF( GT_32( L_abs( Rxy_fx[d1] ), L_abs( Ryy_fx[d1] ) ) )
+ exp1 = norm_l( Rxy_fx[d1] );
ELSE
- {
- /*d1m *= delta; */
- d1m = extract_l( L_mult0( d1m, delta ) );
-
- exp1 = sub( norm_l( min_sq_cross_fx ), 1 );
- exp2 = norm_l( min_corr_fx );
- L_tmp1 = L_shl( min_sq_cross_fx, exp1 );
- L_tmp2 = L_shl( min_corr_fx, exp2 );
- tmp = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); /*15 + exp1 - exp2 */
-#ifdef BASOP_NOGLOB
- tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */
-#else
- tmp = shl( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */
-#endif
- }
+ exp1 = norm_l( Ryy_fx[d1] );
- *false_flag = 0;
- move16();
- test();
- if ( LT_16( tmp, 8192 ) || GT_16( tmp, 24576 ) )
+ L_tmp1 = Mult_32_32( L_shl( Rxy_fx[d1], exp1 ), L_shl( min_corr_fx, exp2 ) );
+ L_tmp2 = Mult_32_32( L_shl( Ryy_fx[d1], exp1 ), L_shl( min_sq_cross_fx, exp2 ) );
+ IF( GE_32( L_tmp1, L_tmp2 ) )
{
- *false_flag = 1;
+ d1m = d1;
+ move16();
+ min_corr_fx = L_add( Ryy_fx[d1], 0 ); /*12 + 12 - 31 */
+ min_sq_cross_fx = L_add( Rxy_fx[d1], 0 ); /*12 + 12 - 31 */
+ exp2 = exp1;
move16();
}
+ }
- return d1m;
+ test();
+ IF( ( min_sq_cross_fx <= 0 ) || ( min_corr_fx <= 0 ) )
+ {
+ tmp = 0;
+ move16(); /* If cross correlation is negative, the division per the energy will always be negative --> tmp will be < 8192, no need to do the division per say */
+ }
+ ELSE
+ {
+ /*d1m *= delta; */
+ d1m = extract_l( L_mult0( d1m, delta ) );
+
+ exp1 = sub( norm_l( min_sq_cross_fx ), 1 );
+ exp2 = norm_l( min_corr_fx );
+ L_tmp1 = L_shl( min_sq_cross_fx, exp1 );
+ L_tmp2 = L_shl( min_corr_fx, exp2 );
+ tmp = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); /*15 + exp1 - exp2 */
+#ifdef BASOP_NOGLOB
+ tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */
+#else
+ tmp = shl( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */
+#endif
}
- static Word16 Search_Max_Corr_fx(
- Word16 * mu_o_fx, /* i : *old_auOut_2fr, */
- Word16 old_Min_ind, /* i : *old_auOut_2fr, */
- const Word16 L /* i : L/2 */
- )
+ *false_flag = 0;
+ move16();
+ test();
+ if ( LT_16( tmp, 8192 ) || GT_16( tmp, 24576 ) )
{
- Word16 pos;
- Word16 pos2, delta2;
- Word16 lin, delta;
- Word16 mind1, maxd1;
- Word16 false_flag;
- Word16 min_d1, max_d1;
- Word16 tmp1, tmp2;
- Word16 *in_fx;
+ *false_flag = 1;
+ move16();
+ }
- IF( old_Min_ind == 0 )
- {
- /*lin = 8*L/20; */ /* Basic size of the block for phase matching */
- lin = mult_r( L, 13107 ); /* Basic size of the block for phase matching */
- /*min_dist = -1e35f; */
- mind1 = 0;
- move16(); /* min value of delay d1 to search for */
- /*maxd1 = 12*L/20; */ /* max value of delay d1 to search for */
- maxd1 = mult_r( L, 19661 ); /* max value of delay d1 to search for */
-
- /*in = mu_o + 2*L -lin; */
- in_fx = mu_o_fx + sub( shl( L, 1 ), lin );
- move16();
+ return d1m;
+}
- /* generate correlation */
- delta = 2;
- move16();
- delta2 = 1;
- move16();
+static Word16 Search_Max_Corr_fx(
+ Word16 *mu_o_fx, /* i : *old_auOut_2fr, */
+ Word16 old_Min_ind, /* i : *old_auOut_2fr, */
+ const Word16 L /* i : L/2 */
+)
+{
+ Word16 pos;
+ Word16 pos2, delta2;
+ Word16 lin, delta;
+ Word16 mind1, maxd1;
+ Word16 false_flag;
+ Word16 min_d1, max_d1;
+ Word16 tmp1, tmp2;
+ Word16 *in_fx;
+
+ IF( old_Min_ind == 0 )
+ {
+ /*lin = 8*L/20; */ /* Basic size of the block for phase matching */
+ lin = mult_r( L, 13107 ); /* Basic size of the block for phase matching */
+ /*min_dist = -1e35f; */
+ mind1 = 0;
+ move16(); /* min value of delay d1 to search for */
+ /*maxd1 = 12*L/20; */ /* max value of delay d1 to search for */
+ maxd1 = mult_r( L, 19661 ); /* max value of delay d1 to search for */
+
+ /*in = mu_o + 2*L -lin; */
+ in_fx = mu_o_fx + sub( shl( L, 1 ), lin );
+ move16();
- pos = find_best_delay_fx( mu_o_fx, in_fx, mind1, maxd1, lin, delta, &false_flag );
+ /* generate correlation */
+ delta = 2;
+ move16();
+ delta2 = 1;
+ move16();
- IF( false_flag )
- {
- return 0;
- }
+ pos = find_best_delay_fx( mu_o_fx, in_fx, mind1, maxd1, lin, delta, &false_flag );
- tmp1 = add( mind1, sub( add( pos, 1 ), delta ) );
- tmp2 = add( mind1, add( pos, delta ) );
- min_d1 = s_max( mind1, tmp1 );
- max_d1 = s_min( maxd1, tmp2 );
- pos2 = find_best_delay_fx( mu_o_fx, in_fx, min_d1, max_d1, lin, delta2, &false_flag );
- IF( GT_16( mind1, tmp1 ) )
- {
- pos = pos2;
- move16();
- }
- ELSE
- {
- pos = add( pos, add( sub( pos2, delta ), 1 ) );
- }
+ IF( false_flag )
+ {
+ return 0;
+ }
- pos = add( pos, add( lin, mind1 ) );
+ tmp1 = add( mind1, sub( add( pos, 1 ), delta ) );
+ tmp2 = add( mind1, add( pos, delta ) );
+ min_d1 = s_max( mind1, tmp1 );
+ max_d1 = s_min( maxd1, tmp2 );
+ pos2 = find_best_delay_fx( mu_o_fx, in_fx, min_d1, max_d1, lin, delta2, &false_flag );
+ IF( GT_16( mind1, tmp1 ) )
+ {
+ pos = pos2;
+ move16();
}
ELSE
{
- lin = mult_r( L, 9830 );
- mind1 = mult_r( L, 14746 ); /* min value of delay d1 to search for */
- maxd1 = mult_r( L, 22938 ); /* max value of delay d1 to search for */
- in_fx = mu_o_fx + sub( shl( L, 1 ), lin );
- move16();
-
- /* generate correlation */
- delta = 2;
- move16();
- delta2 = 1;
- move16();
-
- pos = find_best_delay_fx( mu_o_fx, in_fx, mind1, maxd1, lin, delta, &false_flag );
-
- IF( false_flag )
- {
- return 0;
- }
-
- tmp1 = add( mind1, add( sub( pos, delta ), 1 ) );
- tmp2 = add( mind1, add( pos, delta ) );
- min_d1 = s_max( mind1, tmp1 );
- max_d1 = s_min( maxd1, tmp2 );
- pos2 = find_best_delay_fx( mu_o_fx, in_fx, min_d1, max_d1, lin, delta2, &false_flag );
-
- IF( GT_16( mind1, tmp1 ) )
- {
- pos = pos2;
- move16();
- }
- ELSE
- {
- pos = add( pos, add( sub( pos2, delta ), 1 ) );
- }
- pos = add( pos, add( lin, mind1 ) );
+ pos = add( pos, add( sub( pos2, delta ), 1 ) );
}
- return pos;
+ pos = add( pos, add( lin, mind1 ) );
}
-
- static Word16 FEC_phase_matching_fx(
- HQ_NBFEC_HANDLE st_fx, /* i : Decoder State */
- Word32 * ImdctOut_fx, /* i : input */
- Word16 * auOut_fx, /* o : output audio */
- Word16 * OldauOut_fx,
- Word16 OldauOut_pha_fx[2][N_LEAD_NB] )
+ ELSE
{
- Word16 i;
- Word16 pos, remain;
- Word16 ol_size;
- Word16 L_overlap, L;
- Word16 ImdctOutWin_fx[2 * L_FRAME8k];
- Word16 OldauOutnoWin_fx[L_FRAME8k];
- Word16 OldauOut2_fx[L_FRAME8k];
- Word16 win_NB_fx[L_FRAME8k + 25];
- Word16 exp1, exp2, tmp;
- Word32 pow1_fx, pow22_fx;
- Word16 SmoothingWin_NB3_fx[24];
-
- L = L_FRAME8k;
+ lin = mult_r( L, 9830 );
+ mind1 = mult_r( L, 14746 ); /* min value of delay d1 to search for */
+ maxd1 = mult_r( L, 22938 ); /* max value of delay d1 to search for */
+ in_fx = mu_o_fx + sub( shl( L, 1 ), lin );
move16();
- ol_size = idiv1616( shl( L, 1 ), 20 );
+
+ /* generate correlation */
+ delta = 2;
move16();
- L_overlap = idiv1616( imult1616( 3, L ), 20 );
+ delta2 = 1;
move16();
- FOR( i = 0; i < L_overlap; i++ )
- {
- SmoothingWin_NB3_fx[i] = SmoothingWin_NB875_fx[imult1616( i, 3 )];
- move16();
- }
+ pos = find_best_delay_fx( mu_o_fx, in_fx, mind1, maxd1, lin, delta, &false_flag );
- FOR( i = 0; i < add( L, 25 ); i++ )
+ IF( false_flag )
{
- win_NB_fx[i] = window_48kHz_fx[add( imult1616( i, 6 ), 3 )];
- move16();
+ return 0;
}
- set16_fx( ImdctOutWin_fx, 0, shl( L, 1 ) );
- pos = Search_Max_Corr_fx( st_fx->old_auOut_2fr_fx, st_fx->old_Min_ind, L );
+ tmp1 = add( mind1, add( sub( pos, delta ), 1 ) );
+ tmp2 = add( mind1, add( pos, delta ) );
+ min_d1 = s_max( mind1, tmp1 );
+ max_d1 = s_min( maxd1, tmp2 );
+ pos2 = find_best_delay_fx( mu_o_fx, in_fx, min_d1, max_d1, lin, delta2, &false_flag );
- IF( pos == 0 )
+ IF( GT_16( mind1, tmp1 ) )
{
- return 1;
- }
-
- /* Repetition */
- remain = sub( add( L, N_Z_L_NB ), sub( shl( L, 1 ), pos ) );
- Copy( &st_fx->old_auOut_2fr_fx[pos], &ImdctOutWin_fx[N_ZERO_NB], sub( shl( L, 1 ), pos ) );
-
- /* OldauOut without windowing */
- FOR( i = N_ZERO_NB; i < shr( L, 1 ); i++ )
- {
- OldauOutnoWin_fx[i - N_ZERO_NB] = extract_l( L_shr( L_negate( st_fx->oldIMDCTout_fx[sub( sub( shr( L, 1 ), 1 ), i )] ), 6 ) );
+ pos = pos2;
move16();
}
- FOR( i = 0; i < shr( L, 1 ); i++ )
+ ELSE
{
- OldauOutnoWin_fx[i + N_ZERO_O_NB] = extract_l( L_shr( L_negate( st_fx->oldIMDCTout_fx[i] ), 6 ) );
- move16();
+ pos = add( pos, add( sub( pos2, delta ), 1 ) );
}
+ pos = add( pos, add( lin, mind1 ) );
+ }
- Copy( OldauOutnoWin_fx, &ImdctOutWin_fx[add( N_ZERO_NB, sub( shl( L, 1 ), pos ) )], remain );
+ return pos;
+}
- pow1_fx = L_deposit_l( 0 );
- pow22_fx = L_deposit_l( 0 );
- FOR( i = 0; i < L; i++ )
- {
- pow1_fx = L_add( pow1_fx, shr( abs_s( st_fx->old_auOut_2fr_fx[add( L, i )] ), 1 ) );
- pow22_fx = L_add( pow22_fx, shr( abs_s( ImdctOutWin_fx[N_ZERO_NB + i] ), 1 ) );
- }
- IF( pow22_fx != 0 )
+static Word16 FEC_phase_matching_fx(
+ HQ_NBFEC_HANDLE st_fx, /* i : Decoder State */
+ Word32 *ImdctOut_fx, /* i : input */
+ Word16 *auOut_fx, /* o : output audio */
+ Word16 *OldauOut_fx,
+ Word16 OldauOut_pha_fx[2][N_LEAD_NB] )
+{
+ Word16 i;
+ Word16 pos, remain;
+ Word16 ol_size;
+ Word16 L_overlap, L;
+ Word16 ImdctOutWin_fx[2 * L_FRAME8k];
+ Word16 OldauOutnoWin_fx[L_FRAME8k];
+ Word16 OldauOut2_fx[L_FRAME8k];
+ Word16 win_NB_fx[L_FRAME8k + 25];
+ Word16 exp1, exp2, tmp;
+ Word32 pow1_fx, pow22_fx;
+ Word16 SmoothingWin_NB3_fx[24];
+
+ L = L_FRAME8k;
+ move16();
+ ol_size = idiv1616( shl( L, 1 ), 20 );
+ move16();
+ L_overlap = idiv1616( imult1616( 3, L ), 20 );
+ move16();
+
+ FOR( i = 0; i < L_overlap; i++ )
+ {
+ SmoothingWin_NB3_fx[i] = SmoothingWin_NB875_fx[imult1616( i, 3 )];
+ move16();
+ }
+
+ FOR( i = 0; i < add( L, 25 ); i++ )
+ {
+ win_NB_fx[i] = window_48kHz_fx[add( imult1616( i, 6 ), 3 )];
+ move16();
+ }
+ set16_fx( ImdctOutWin_fx, 0, shl( L, 1 ) );
+
+ pos = Search_Max_Corr_fx( st_fx->old_auOut_2fr_fx, st_fx->old_Min_ind, L );
+
+ IF( pos == 0 )
+ {
+ return 1;
+ }
+
+ /* Repetition */
+ remain = sub( add( L, N_Z_L_NB ), sub( shl( L, 1 ), pos ) );
+ Copy( &st_fx->old_auOut_2fr_fx[pos], &ImdctOutWin_fx[N_ZERO_NB], sub( shl( L, 1 ), pos ) );
+
+ /* OldauOut without windowing */
+ FOR( i = N_ZERO_NB; i < shr( L, 1 ); i++ )
+ {
+ OldauOutnoWin_fx[i - N_ZERO_NB] = extract_l( L_shr( L_negate( st_fx->oldIMDCTout_fx[sub( sub( shr( L, 1 ), 1 ), i )] ), 6 ) );
+ move16();
+ }
+ FOR( i = 0; i < shr( L, 1 ); i++ )
+ {
+ OldauOutnoWin_fx[i + N_ZERO_O_NB] = extract_l( L_shr( L_negate( st_fx->oldIMDCTout_fx[i] ), 6 ) );
+ move16();
+ }
+
+ Copy( OldauOutnoWin_fx, &ImdctOutWin_fx[add( N_ZERO_NB, sub( shl( L, 1 ), pos ) )], remain );
+
+ pow1_fx = L_deposit_l( 0 );
+ pow22_fx = L_deposit_l( 0 );
+ FOR( i = 0; i < L; i++ )
+ {
+ pow1_fx = L_add( pow1_fx, shr( abs_s( st_fx->old_auOut_2fr_fx[add( L, i )] ), 1 ) );
+ pow22_fx = L_add( pow22_fx, shr( abs_s( ImdctOutWin_fx[N_ZERO_NB + i] ), 1 ) );
+ }
+ IF( pow22_fx != 0 )
+ {
+ exp1 = sub( norm_l( pow1_fx ), 1 );
+ exp2 = norm_l( pow22_fx );
+ tmp = div_s( extract_h( L_shl( pow1_fx, exp1 ) ), extract_h( L_shl( pow22_fx, exp2 ) ) ); /*15 + exp1 - exp2*/
+ tmp = shl( tmp, sub( sub( exp2, exp1 ), 1 ) ); /*14*/
+ FOR( i = N_ZERO_NB; i < shl( L, 1 ); i++ )
{
- exp1 = sub( norm_l( pow1_fx ), 1 );
- exp2 = norm_l( pow22_fx );
- tmp = div_s( extract_h( L_shl( pow1_fx, exp1 ) ), extract_h( L_shl( pow22_fx, exp2 ) ) ); /*15 + exp1 - exp2*/
- tmp = shl( tmp, sub( sub( exp2, exp1 ), 1 ) ); /*14*/
- FOR( i = N_ZERO_NB; i < shl( L, 1 ); i++ )
- {
#ifdef BASOP_NOGLOB
- ImdctOutWin_fx[i] = shl_sat( mult( ImdctOutWin_fx[i], tmp ), 1 );
+ ImdctOutWin_fx[i] = shl_sat( mult( ImdctOutWin_fx[i], tmp ), 1 );
#else
ImdctOutWin_fx[i] = shl( mult( ImdctOutWin_fx[i], tmp ), 1 );
#endif
- move16();
- }
- }
- Smoothing_vector_NB_fx( OldauOutnoWin_fx, &ImdctOutWin_fx[N_ZERO_NB], SmoothingWin_NB2_fx, auOut_fx, ol_size );
-
- FOR( i = 0; i < shr( L, 1 ); i++ )
- {
- /*ImdctOutWin[3*L/2 + i] *= win_NB[L/2-i-1];*/
- ImdctOutWin_fx[add( shr( imult1616( 3, L ), 1 ), i )] = mult( ImdctOutWin_fx[add( shr( imult1616( 3, L ), 1 ), i )], win_NB_fx[sub( sub( shr( L, 1 ), i ), 1 )] );
move16();
}
+ }
+ Smoothing_vector_NB_fx( OldauOutnoWin_fx, &ImdctOutWin_fx[N_ZERO_NB], SmoothingWin_NB2_fx, auOut_fx, ol_size );
- FOR( i = N_ZERO_NB; i < shr( L, 1 ); i++ )
- {
- /*ImdctOutWin_fx[L + i] *= win_NB_fx[(L-1-i)];*/
- ImdctOutWin_fx[add( L, i )] = mult( ImdctOutWin_fx[add( L, i )], win_NB_fx[sub( sub( L, 1 ), i )] );
- move16();
- }
+ FOR( i = 0; i < shr( L, 1 ); i++ )
+ {
+ /*ImdctOutWin[3*L/2 + i] *= win_NB[L/2-i-1];*/
+ ImdctOutWin_fx[add( shr( imult1616( 3, L ), 1 ), i )] = mult( ImdctOutWin_fx[add( shr( imult1616( 3, L ), 1 ), i )], win_NB_fx[sub( sub( shr( L, 1 ), i ), 1 )] );
+ move16();
+ }
- Copy( &ImdctOutWin_fx[N_Z_L_O_NB], &OldauOut_pha_fx[0][0], N_LEAD_NB );
- Copy( &ImdctOutWin_fx[add( ol_size, N_ZERO_NB )], &auOut_fx[ol_size], sub( N_Z_L_NB, ol_size ) );
- Copy( &ImdctOutWin_fx[L], &auOut_fx[N_Z_L_NB], N_ZERO_NB );
- Copy( &ImdctOutWin_fx[L], OldauOut_fx, L );
+ FOR( i = N_ZERO_NB; i < shr( L, 1 ); i++ )
+ {
+ /*ImdctOutWin_fx[L + i] *= win_NB_fx[(L-1-i)];*/
+ ImdctOutWin_fx[add( L, i )] = mult( ImdctOutWin_fx[add( L, i )], win_NB_fx[sub( sub( L, 1 ), i )] );
+ move16();
+ }
- FOR( i = 0; i < shr( L, 1 ); i++ )
- {
- OldauOut2_fx[i] = extract_l( L_shr( L_negate( ImdctOut_fx[sub( sub( shr( L, 1 ), 1 ), i )] ), 6 ) );
- move16();
- OldauOut2_fx[add( shr( L, 1 ), i )] = extract_l( L_shr( L_negate( ImdctOut_fx[i] ), 6 ) );
- move16();
- }
+ Copy( &ImdctOutWin_fx[N_Z_L_O_NB], &OldauOut_pha_fx[0][0], N_LEAD_NB );
+ Copy( &ImdctOutWin_fx[add( ol_size, N_ZERO_NB )], &auOut_fx[ol_size], sub( N_Z_L_NB, ol_size ) );
+ Copy( &ImdctOutWin_fx[L], &auOut_fx[N_Z_L_NB], N_ZERO_NB );
+ Copy( &ImdctOutWin_fx[L], OldauOut_fx, L );
- Smoothing_vector_NB_fx( &ImdctOutWin_fx[N_Z_L_O_NB], &OldauOut2_fx[N_ZERO_NB], SmoothingWin_NB3_fx, &OldauOut_pha_fx[1][0], L_overlap );
+ FOR( i = 0; i < shr( L, 1 ); i++ )
+ {
+ OldauOut2_fx[i] = extract_l( L_shr( L_negate( ImdctOut_fx[sub( sub( shr( L, 1 ), 1 ), i )] ), 6 ) );
+ move16();
+ OldauOut2_fx[add( shr( L, 1 ), i )] = extract_l( L_shr( L_negate( ImdctOut_fx[i] ), 6 ) );
+ move16();
+ }
- FOR( i = L_overlap; i < N_LEAD_NB; i++ )
- {
- OldauOut_pha_fx[1][i] = OldauOut2_fx[i + N_ZERO_NB];
- move32();
- }
+ Smoothing_vector_NB_fx( &ImdctOutWin_fx[N_Z_L_O_NB], &OldauOut2_fx[N_ZERO_NB], SmoothingWin_NB3_fx, &OldauOut_pha_fx[1][0], L_overlap );
- return 0;
+ FOR( i = L_overlap; i < N_LEAD_NB; i++ )
+ {
+ OldauOut_pha_fx[1][i] = OldauOut2_fx[i + N_ZERO_NB];
+ move32();
}
- static void FEC_phase_matching_nextgood_fx(
- const Word32 *ImdctOut_fx, /* i : input */
- Word16 *auOut_fx, /* o : output audio */
- Word16 *OldauOut_fx, /* i/o: audio from previous frame */
- Word16 OldauOut_pha_fx[2][N_LEAD_NB],
- Word16 mean_en_high_fx /*Q5 */
- )
- {
- Word16 i;
- Word16 L_overlap, L;
- Word16 oldout_pha_idx;
- Word16 *OldOut_pha_fx;
- Word16 ImdctOutWin_fx[2 * L_FRAME48k];
- Word16 win_NB_fx[L_FRAME8k + 25];
+ return 0;
+}
- L = L_FRAME8k;
- move16();
- FOR( i = 0; i < L + 25; i++ )
- {
- /* win_NB[i] = window_48kHz[i*6+3]; */
- win_NB_fx[i] = window_48kHz_fx[add( imult1616( i, 6 ), 3 )];
- move16();
- }
+static void FEC_phase_matching_nextgood_fx(
+ const Word32 *ImdctOut_fx, /* i : input */
+ Word16 *auOut_fx, /* o : output audio */
+ Word16 *OldauOut_fx, /* i/o: audio from previous frame */
+ Word16 OldauOut_pha_fx[2][N_LEAD_NB],
+ Word16 mean_en_high_fx /*Q5 */
+)
+{
+ Word16 i;
+ Word16 L_overlap, L;
+ Word16 oldout_pha_idx;
+ Word16 *OldOut_pha_fx;
+ Word16 ImdctOutWin_fx[2 * L_FRAME48k];
+ Word16 win_NB_fx[L_FRAME8k + 25];
- test();
- IF( ( GT_16( mean_en_high_fx, 64 ) ) || ( LT_16( mean_en_high_fx, 16 ) ) )
- {
- oldout_pha_idx = 1;
- move16();
- }
- ELSE
- {
- oldout_pha_idx = 0;
- move16();
- }
+ L = L_FRAME8k;
+ move16();
+ FOR( i = 0; i < L + 25; i++ )
+ {
+ /* win_NB[i] = window_48kHz[i*6+3]; */
+ win_NB_fx[i] = window_48kHz_fx[add( imult1616( i, 6 ), 3 )];
+ move16();
+ }
- /* Overlapping with next good frame : Overlapping to remove the discontinuity */
- L_overlap = N_LEAD_NB;
+ test();
+ IF( ( GT_16( mean_en_high_fx, 64 ) ) || ( LT_16( mean_en_high_fx, 16 ) ) )
+ {
+ oldout_pha_idx = 1;
move16();
- OldOut_pha_fx = OldauOut_pha_fx[oldout_pha_idx];
- FOR( i = 0; i < N_LEAD_NB; i++ )
- {
- /* OldOut_pha[i] *= SmoothingWin_NB875[L_overlap-i-1]; */
- OldOut_pha_fx[i] = mult( OldOut_pha_fx[i], SmoothingWin_NB875_fx[sub( sub( L_overlap, i ), 1 )] );
- move16();
- }
+ }
+ ELSE
+ {
+ oldout_pha_idx = 0;
+ move16();
+ }
- IF( EQ_16( oldout_pha_idx, 1 ) )
- {
- /* Use phase matching and overlapping with the Oldauout*/
- /* Windowing */
- /*Windowing_1st_NB(ImdctOutWin, ImdctOut, win_NB, NULL, 0);*/
- /*Windowing_2nd_NB(ImdctOutWin, ImdctOut, win_NB); */
- Windowing_1st_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx, NULL, 0 );
- Windowing_2nd_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx );
- }
- ELSE
- {
- /* Only use phase matching */
- /* Windowing */
- Windowing_1st_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx, SmoothingWin_NB875_fx, 1 );
- Windowing_2nd_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx );
- }
- /* common_overlapping(auOut, ImdctOutWin, OldOut_pha, N_LEAD_NB, 0, N_LEAD_NB, L, N_ZERO_NB, 0, L);*/
- common_overlapping_fx( auOut_fx, ImdctOutWin_fx, OldOut_pha_fx, N_LEAD_NB, 0, N_LEAD_NB, L, N_ZERO_NB, 0 );
- Copy( &ImdctOutWin_fx[L], OldauOut_fx, L );
+ /* Overlapping with next good frame : Overlapping to remove the discontinuity */
+ L_overlap = N_LEAD_NB;
+ move16();
+ OldOut_pha_fx = OldauOut_pha_fx[oldout_pha_idx];
+ FOR( i = 0; i < N_LEAD_NB; i++ )
+ {
+ /* OldOut_pha[i] *= SmoothingWin_NB875[L_overlap-i-1]; */
+ OldOut_pha_fx[i] = mult( OldOut_pha_fx[i], SmoothingWin_NB875_fx[sub( sub( L_overlap, i ), 1 )] );
+ move16();
+ }
- return;
+ IF( EQ_16( oldout_pha_idx, 1 ) )
+ {
+ /* Use phase matching and overlapping with the Oldauout*/
+ /* Windowing */
+ /*Windowing_1st_NB(ImdctOutWin, ImdctOut, win_NB, NULL, 0);*/
+ /*Windowing_2nd_NB(ImdctOutWin, ImdctOut, win_NB); */
+ Windowing_1st_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx, NULL, 0 );
+ Windowing_2nd_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx );
+ }
+ ELSE
+ {
+ /* Only use phase matching */
+ /* Windowing */
+ Windowing_1st_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx, SmoothingWin_NB875_fx, 1 );
+ Windowing_2nd_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx );
}
+ /* common_overlapping(auOut, ImdctOutWin, OldOut_pha, N_LEAD_NB, 0, N_LEAD_NB, L, N_ZERO_NB, 0, L);*/
+ common_overlapping_fx( auOut_fx, ImdctOutWin_fx, OldOut_pha_fx, N_LEAD_NB, 0, N_LEAD_NB, L, N_ZERO_NB, 0 );
+ Copy( &ImdctOutWin_fx[L], OldauOut_fx, L );
+
+ return;
+}
#endif
#ifdef IVAS_FLOAT_FIXED
- static void FEC_phase_matching_burst_fx(
- const Word32 *ImdctOut_fx, /* i : input */
- Word16 *auOut_fx, /* o : output audio */
- Word16 *OldauOut_fx, /* i/o: audio from previous frame */
- Word16 OldauOut_pha_fx[2][N_LEAD_NB],
- Word16 *prev_oldauOut_fx /* i : OldauOut from previous frame */
- )
- {
- Word16 i;
- Word16 L_overlap;
- Word16 L;
- Word16 OldauOut2_fx[L_FRAME8k];
- Word16 ImdctOutWin_fx[2 * L_FRAME8k];
- Word16 win_NB_fx[L_FRAME8k + 25];
- Word16 SmoothingWin_NB3_fx[24];
+static void FEC_phase_matching_burst_fx(
+ const Word32 *ImdctOut_fx, /* i : input */
+ Word16 *auOut_fx, /* o : output audio */
+ Word16 *OldauOut_fx, /* i/o: audio from previous frame */
+ Word16 OldauOut_pha_fx[2][N_LEAD_NB],
+ Word16 *prev_oldauOut_fx /* i : OldauOut from previous frame */
+)
+{
+ Word16 i;
+ Word16 L_overlap;
+ Word16 L;
+ Word16 OldauOut2_fx[L_FRAME8k];
+ Word16 ImdctOutWin_fx[2 * L_FRAME8k];
+ Word16 win_NB_fx[L_FRAME8k + 25];
+ Word16 SmoothingWin_NB3_fx[24];
+
+ L = L_FRAME8k;
+ move16();
+ L_overlap = idiv1616( imult1616( 3, L ), 20 );
+ move16();
- L = L_FRAME8k;
+ FOR( i = 0; i < L_overlap; i++ )
+ {
+ SmoothingWin_NB3_fx[i] = SmoothingWin_NB875_fx[i * 3];
move16();
- L_overlap = idiv1616( imult1616( 3, L ), 20 );
+ }
+
+ FOR( i = 0; i < add( L, 25 ); i++ )
+ {
+ win_NB_fx[i] = window_48kHz_fx[add( imult1616( i, 6 ), 3 )];
move16();
+ }
- FOR( i = 0; i < L_overlap; i++ )
- {
- SmoothingWin_NB3_fx[i] = SmoothingWin_NB875_fx[i * 3];
- move16();
- }
+ /* Windowing */
+ Windowing_1st_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx, NULL, 0 );
+ Windowing_2nd_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx );
- FOR( i = 0; i < add( L, 25 ); i++ )
- {
- win_NB_fx[i] = window_48kHz_fx[add( imult1616( i, 6 ), 3 )];
- move16();
- }
+ /* Repetition with old frame to reserve energy */
+ /*common_overlapping(auOut, ImdctOutWin, prev_oldauOut, N_Z_L_NB, 0, N_Z_L_NB, L, N_ZERO_NB, 0, L);*/
+ common_overlapping_fx( auOut_fx, ImdctOutWin_fx, prev_oldauOut_fx, N_Z_L_NB, 0, N_Z_L_NB, L, N_ZERO_NB, 0 );
- /* Windowing */
- Windowing_1st_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx, NULL, 0 );
- Windowing_2nd_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx );
+ /* data transition from OldauOut to auOut using smoothing win*/
+ Smoothing_vector_NB_fx( OldauOut_pha_fx[0], auOut_fx, SmoothingWin_NB875_fx, auOut_fx, N_LEAD_NB );
+
+ /* Update the OldauOut array for next overlapping */
+ Copy( &ImdctOutWin_fx[N_Z_L_O_NB], &OldauOut_pha_fx[0][0], N_LEAD_NB );
+ Copy( &ImdctOutWin_fx[L], OldauOut_fx, L );
+ Scaledown_fx( prev_oldauOut_fx, prev_oldauOut_fx, 23170, L );
- /* Repetition with old frame to reserve energy */
- /*common_overlapping(auOut, ImdctOutWin, prev_oldauOut, N_Z_L_NB, 0, N_Z_L_NB, L, N_ZERO_NB, 0, L);*/
- common_overlapping_fx( auOut_fx, ImdctOutWin_fx, prev_oldauOut_fx, N_Z_L_NB, 0, N_Z_L_NB, L, N_ZERO_NB, 0 );
+ FOR( i = 0; i < shr( L, 1 ); i++ )
+ {
+ /* OldauOut2[i] = -ImdctOut[L/2 - 1 - i];*/
+ /* OldauOut2[L/2+i] = -ImdctOut[i];*/
+ OldauOut2_fx[i] = extract_l( L_shr( L_negate( ImdctOut_fx[sub( sub( shr( L, 1 ), 1 ), i )] ), 6 ) );
+ move16();
+ OldauOut2_fx[add( shr( L, 1 ), i )] = extract_l( L_shr( L_negate( ImdctOut_fx[i] ), 6 ) );
+ move16();
+ }
- /* data transition from OldauOut to auOut using smoothing win*/
- Smoothing_vector_NB_fx( OldauOut_pha_fx[0], auOut_fx, SmoothingWin_NB875_fx, auOut_fx, N_LEAD_NB );
+ Smoothing_vector_NB_fx( &ImdctOutWin_fx[N_Z_L_O_NB], &OldauOut2_fx[N_ZERO_NB], SmoothingWin_NB3_fx, &OldauOut_pha_fx[1][0], L_overlap );
- /* Update the OldauOut array for next overlapping */
- Copy( &ImdctOutWin_fx[N_Z_L_O_NB], &OldauOut_pha_fx[0][0], N_LEAD_NB );
- Copy( &ImdctOutWin_fx[L], OldauOut_fx, L );
- Scaledown_fx( prev_oldauOut_fx, prev_oldauOut_fx, 23170, L );
+ FOR( i = L_overlap; i < N_LEAD_NB; i++ )
+ {
+ /* OldauOut_pha[1][i] = OldauOut2[i+N_ZERO_NB]; */
+ OldauOut_pha_fx[1][i] = OldauOut2_fx[i + N_ZERO_NB];
+ move16();
+ }
- FOR( i = 0; i < shr( L, 1 ); i++ )
- {
- /* OldauOut2[i] = -ImdctOut[L/2 - 1 - i];*/
- /* OldauOut2[L/2+i] = -ImdctOut[i];*/
- OldauOut2_fx[i] = extract_l( L_shr( L_negate( ImdctOut_fx[sub( sub( shr( L, 1 ), 1 ), i )] ), 6 ) );
- move16();
- OldauOut2_fx[add( shr( L, 1 ), i )] = extract_l( L_shr( L_negate( ImdctOut_fx[i] ), 6 ) );
- move16();
- }
+ return;
+}
- Smoothing_vector_NB_fx( &ImdctOutWin_fx[N_Z_L_O_NB], &OldauOut2_fx[N_ZERO_NB], SmoothingWin_NB3_fx, &OldauOut_pha_fx[1][0], L_overlap );
+static void Repetition_smoothing_nextgood_fx(
+ const Word32 *ImdctOut_fx, /* i : input */
+ Word16 *auOut_fx, /* o : output audio */
+ Word32 *OldImdctOut_fx, /* i : input */
+ Word16 *OldauOut_fx, /* i/o: audio from previous frame */
+ Word16 cur_data_use_flag, /* i : current imdct data use flag */
+ Word16 overlap_time )
+{
+ Word16 i;
+ Word16 L_overlap;
+ Word16 ol_size;
+ Word16 L;
+ Word16 ImdctOutWin_fx[2 * L_FRAME8k];
+ Word16 win_NB_fx[L_FRAME8k + 25];
- FOR( i = L_overlap; i < N_LEAD_NB; i++ )
- {
- /* OldauOut_pha[1][i] = OldauOut2[i+N_ZERO_NB]; */
- OldauOut_pha_fx[1][i] = OldauOut2_fx[i + N_ZERO_NB];
- move16();
- }
+ L = L_FRAME8k;
+ move16();
- return;
+ FOR( i = 0; i < L_FRAME8k + 25; i++ )
+ {
+ /*win_NB[i] = window_48kHz[i*6+3];*/
+ win_NB_fx[i] = window_48kHz_fx[add( imult1616( i, 6 ), 3 )];
+ move16();
}
- static void Repetition_smoothing_nextgood_fx(
- const Word32 *ImdctOut_fx, /* i : input */
- Word16 *auOut_fx, /* o : output audio */
- Word32 *OldImdctOut_fx, /* i : input */
- Word16 *OldauOut_fx, /* i/o: audio from previous frame */
- Word16 cur_data_use_flag, /* i : current imdct data use flag */
- Word16 overlap_time )
+ FOR( i = N_ZERO_NB; i < shr( L, 1 ); i++ )
{
- Word16 i;
- Word16 L_overlap;
- Word16 ol_size;
- Word16 L;
- Word16 ImdctOutWin_fx[2 * L_FRAME8k];
- Word16 win_NB_fx[L_FRAME8k + 25];
-
- L = L_FRAME8k;
+ /*OldauOut[i-N_ZERO_NB] = -OldImdctOut[L/2 - 1 - i];*/
+ OldauOut_fx[i - N_ZERO_NB] = extract_l( L_shr( L_negate( OldImdctOut_fx[sub( sub( shr( L, 1 ), 1 ), i )] ), 6 ) ); /* Q6 -> Q0 */
+ move16();
+ }
+ FOR( i = 0; i < shr( L, 2 ); i++ )
+ {
+ /*OldauOut[i+N_ZERO_O_NB] = -OldImdctOut[i];*/
+ OldauOut_fx[i + N_ZERO_O_NB] = extract_l( L_shr( L_negate( OldImdctOut_fx[i] ), 6 ) ); /* Q6 -> Q0 */
move16();
+ }
- FOR( i = 0; i < L_FRAME8k + 25; i++ )
- {
- /*win_NB[i] = window_48kHz[i*6+3];*/
- win_NB_fx[i] = window_48kHz_fx[add( imult1616( i, 6 ), 3 )];
- move16();
- }
+ /* Overlapping with next good frame : Overlapping to remove the discontinuity */
+ IF( cur_data_use_flag )
+ {
+ ol_size = N_LEAD_NB;
+ move16();
FOR( i = N_ZERO_NB; i < shr( L, 1 ); i++ )
{
- /*OldauOut[i-N_ZERO_NB] = -OldImdctOut[L/2 - 1 - i];*/
- OldauOut_fx[i - N_ZERO_NB] = extract_l( L_shr( L_negate( OldImdctOut_fx[sub( sub( shr( L, 1 ), 1 ), i )] ), 6 ) ); /* Q6 -> Q0 */
+ /* ImdctOutWin[i+L] = -ImdctOut[L/2 - 1 - i]; */
+ ImdctOutWin_fx[add( i, L )] = extract_l( L_shr( L_negate( ImdctOut_fx[sub( sub( shr( L, 1 ), 1 ), i )] ), 6 ) );
move16();
}
- FOR( i = 0; i < shr( L, 2 ); i++ )
+ FOR( i = 0; i < shr( L, 1 ); i++ )
{
- /*OldauOut[i+N_ZERO_O_NB] = -OldImdctOut[i];*/
- OldauOut_fx[i + N_ZERO_O_NB] = extract_l( L_shr( L_negate( OldImdctOut_fx[i] ), 6 ) ); /* Q6 -> Q0 */
+ ImdctOutWin_fx[add( i, shr( imult1616( 3, L ), 1 ) )] = extract_l( L_shr( L_negate( ImdctOut_fx[i] ), 6 ) );
move16();
}
- /* Overlapping with next good frame : Overlapping to remove the discontinuity */
- IF( cur_data_use_flag )
- {
- ol_size = N_LEAD_NB;
- move16();
-
- FOR( i = N_ZERO_NB; i < shr( L, 1 ); i++ )
- {
- /* ImdctOutWin[i+L] = -ImdctOut[L/2 - 1 - i]; */
- ImdctOutWin_fx[add( i, L )] = extract_l( L_shr( L_negate( ImdctOut_fx[sub( sub( shr( L, 1 ), 1 ), i )] ), 6 ) );
- move16();
- }
- FOR( i = 0; i < shr( L, 1 ); i++ )
- {
- ImdctOutWin_fx[add( i, shr( imult1616( 3, L ), 1 ) )] = extract_l( L_shr( L_negate( ImdctOut_fx[i] ), 6 ) );
- move16();
- }
-
- /*a = (float)(1./(float)(ol_size)); y = ax */
- Smoothing_vector_scaledown_NB_fx( OldauOut_fx, &ImdctOutWin_fx[N_Z_L_O_NB], SmoothingWin_NB875_fx, OldauOut_fx, ol_size );
+ /*a = (float)(1./(float)(ol_size)); y = ax */
+ Smoothing_vector_scaledown_NB_fx( OldauOut_fx, &ImdctOutWin_fx[N_Z_L_O_NB], SmoothingWin_NB875_fx, OldauOut_fx, ol_size );
- /* Scale down the overlapped signal */
- Scaledown_fx( &ImdctOutWin_fx[add( ol_size, N_Z_L_O_NB )], &OldauOut_fx[ol_size], 23170, sub( N_Z_L_NB, ol_size ) );
- }
+ /* Scale down the overlapped signal */
+ Scaledown_fx( &ImdctOutWin_fx[add( ol_size, N_Z_L_O_NB )], &OldauOut_fx[ol_size], 23170, sub( N_Z_L_NB, ol_size ) );
+ }
- L_overlap = overlap_time;
+ L_overlap = overlap_time;
+ move16();
+ FOR( i = 0; i < L_overlap; i++ )
+ {
+ /*OldauOut[i] *= SmoothingWin_NB875[L_overlap-i-1];*/
+ OldauOut_fx[i] = mult( OldauOut_fx[i], SmoothingWin_NB875_fx[sub( sub( L_overlap, i ), 1 )] );
move16();
- FOR( i = 0; i < L_overlap; i++ )
- {
- /*OldauOut[i] *= SmoothingWin_NB875[L_overlap-i-1];*/
- OldauOut_fx[i] = mult( OldauOut_fx[i], SmoothingWin_NB875_fx[sub( sub( L_overlap, i ), 1 )] );
- move16();
- }
- FOR( i = L_overlap; i < L; i++ )
- {
- OldauOut_fx[i] = 0;
- move16();
- }
+ }
+ FOR( i = L_overlap; i < L; i++ )
+ {
+ OldauOut_fx[i] = 0;
+ move16();
+ }
- /* Windowing */
- /*Windowing_1st_NB(ImdctOutWin, ImdctOut, win_NB, SmoothingWin_NB875, 1);*/
- /*Windowing_2nd_NB(ImdctOutWin, ImdctOut, win_NB);*/
- Windowing_1st_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx, SmoothingWin_NB875_fx, 1 );
- Windowing_2nd_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx );
+ /* Windowing */
+ /*Windowing_1st_NB(ImdctOutWin, ImdctOut, win_NB, SmoothingWin_NB875, 1);*/
+ /*Windowing_2nd_NB(ImdctOutWin, ImdctOut, win_NB);*/
+ Windowing_1st_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx, SmoothingWin_NB875_fx, 1 );
+ Windowing_2nd_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx );
- /*v_add(&ImdctOutWin[N_ZERO_NB], OldauOut, auOut, L);*/
- /*mvr2r(&ImdctOutWin[L], OldauOut, L);*/
- FOR( i = 0; i < L; i++ )
- {
+ /*v_add(&ImdctOutWin[N_ZERO_NB], OldauOut, auOut, L);*/
+ /*mvr2r(&ImdctOutWin[L], OldauOut, L);*/
+ FOR( i = 0; i < L; i++ )
+ {
#ifdef BASOP_NOGLOB
- auOut_fx[i] = add_sat( ImdctOutWin_fx[N_ZERO_NB + i], OldauOut_fx[i] );
+ auOut_fx[i] = add_sat( ImdctOutWin_fx[N_ZERO_NB + i], OldauOut_fx[i] );
#else
auOut_fx[i] = add( ImdctOutWin_fx[N_ZERO_NB + i], OldauOut_fx[i] );
#endif
- move16();
- }
- Copy( &ImdctOutWin_fx[L], OldauOut_fx, L );
+ move16();
+ }
+ Copy( &ImdctOutWin_fx[L], OldauOut_fx, L );
+
+ return;
+}
+
+static Word16 Repetition_smoothing_fx(
+ const Word32 *ImdctOut_fx, /* i : input */
+ Word16 *auOut_fx, /* o : output audio */
+ Word32 *OldImdctOut_fx, /* i : input */
+ Word16 *OldauOut_fx, /* i/o: audio from previous frame */
+ const Word16 L, /* i : length */
+ Word16 *prev_oldauOut_fx, /* i : OldauOut from previous frame */
+ Word16 overlap_time /* i : overlap time */
+)
+{
+ Word16 i;
+ Word32 pow1_fx;
+ Word32 pow22_fx;
+ Word16 ImdctOutWin_fx[2 * L_FRAME8k];
+ Word16 OldauOutnoWin_fx[L_FRAME8k];
+ Word16 win_NB_fx[L_FRAME8k + 25];
- return;
+ FOR( i = 0; i < L_FRAME8k + 25; i++ )
+ {
+ /*win_NB[i] = window_48kHz[i*6+3];*/
+ win_NB_fx[i] = window_48kHz_fx[add( imult1616( i, 6 ), 3 )];
+ move16();
}
- static Word16 Repetition_smoothing_fx(
- const Word32 *ImdctOut_fx, /* i : input */
- Word16 *auOut_fx, /* o : output audio */
- Word32 *OldImdctOut_fx, /* i : input */
- Word16 *OldauOut_fx, /* i/o: audio from previous frame */
- const Word16 L, /* i : length */
- Word16 *prev_oldauOut_fx, /* i : OldauOut from previous frame */
- Word16 overlap_time /* i : overlap time */
- )
+ /* Windowing */
+ Windowing_1st_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx, NULL, 0 );
+ Windowing_2nd_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx );
+
+ /* Repetition with old frame to reserve energy */
+ common_overlapping_fx( auOut_fx, ImdctOutWin_fx, prev_oldauOut_fx, N_Z_L_NB, 0, N_Z_L_NB, L, N_ZERO_NB, 0 );
+
+ /* OldauOut without windowing */
+ FOR( i = N_ZERO_NB; i < shr( L, 1 ); i++ )
+ {
+ OldauOutnoWin_fx[i - N_ZERO_NB] = extract_l( L_shr( L_negate( OldImdctOut_fx[sub( sub( shr( L, 1 ), 1 ), i )] ), 6 ) );
+ move16();
+ }
+ FOR( i = 0; i < shr( L, 1 ); i++ )
{
- Word16 i;
- Word32 pow1_fx;
- Word32 pow22_fx;
- Word16 ImdctOutWin_fx[2 * L_FRAME8k];
- Word16 OldauOutnoWin_fx[L_FRAME8k];
- Word16 win_NB_fx[L_FRAME8k + 25];
+ OldauOutnoWin_fx[i + N_ZERO_O_NB] = extract_l( L_shr( L_negate( OldImdctOut_fx[i] ), 6 ) );
+ move16();
+ }
- FOR( i = 0; i < L_FRAME8k + 25; i++ )
- {
- /*win_NB[i] = window_48kHz[i*6+3];*/
- win_NB_fx[i] = window_48kHz_fx[add( imult1616( i, 6 ), 3 )];
- move16();
- }
+ /* data transition from OldauOut to auOut using smoothing win*/
+ Smoothing_vector_NB_fx( OldauOutnoWin_fx, auOut_fx, SmoothingWin_NB875_fx, auOut_fx, overlap_time );
- /* Windowing */
- Windowing_1st_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx, NULL, 0 );
- Windowing_2nd_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx );
+ pow1_fx = L_deposit_l( 0 );
+ pow22_fx = L_deposit_l( 0 );
+ FOR( i = 0; i < idiv1616( imult1616( 4, L ), 20 ); i++ )
+ {
+ pow1_fx = L_add( pow1_fx, Mult_32_32( L_shl( (Word32) auOut_fx[add( idiv1616( L, 20 ), i )], 6 ), L_shl( (Word32) auOut_fx[add( idiv1616( L, 20 ), i )], 6 ) ) );
+ pow22_fx = L_add( pow22_fx, Mult_32_32( L_shl( (Word32) auOut_fx[N_LEAD_NB + i], 6 ), L_shl( (Word32) auOut_fx[N_LEAD_NB + i], 6 ) ) );
+ }
- /* Repetition with old frame to reserve energy */
- common_overlapping_fx( auOut_fx, ImdctOutWin_fx, prev_oldauOut_fx, N_Z_L_NB, 0, N_Z_L_NB, L, N_ZERO_NB, 0 );
- /* OldauOut without windowing */
- FOR( i = N_ZERO_NB; i < shr( L, 1 ); i++ )
- {
- OldauOutnoWin_fx[i - N_ZERO_NB] = extract_l( L_shr( L_negate( OldImdctOut_fx[sub( sub( shr( L, 1 ), 1 ), i )] ), 6 ) );
- move16();
- }
- FOR( i = 0; i < shr( L, 1 ); i++ )
- {
- OldauOutnoWin_fx[i + N_ZERO_O_NB] = extract_l( L_shr( L_negate( OldImdctOut_fx[i] ), 6 ) );
- move16();
- }
+ IF( GT_32( pow22_fx, L_add( pow1_fx, L_shl( pow1_fx, 1 ) ) ) )
+ {
+ return 1;
+ }
- /* data transition from OldauOut to auOut using smoothing win*/
- Smoothing_vector_NB_fx( OldauOutnoWin_fx, auOut_fx, SmoothingWin_NB875_fx, auOut_fx, overlap_time );
+ /* Update the OldauOut array for next overlapping */
+ Copy( &ImdctOutWin_fx[L], OldauOut_fx, L );
+ Scaledown_fx( prev_oldauOut_fx, prev_oldauOut_fx, 23170, L );
- pow1_fx = L_deposit_l( 0 );
- pow22_fx = L_deposit_l( 0 );
- FOR( i = 0; i < idiv1616( imult1616( 4, L ), 20 ); i++ )
- {
- pow1_fx = L_add( pow1_fx, Mult_32_32( L_shl( (Word32) auOut_fx[add( idiv1616( L, 20 ), i )], 6 ), L_shl( (Word32) auOut_fx[add( idiv1616( L, 20 ), i )], 6 ) ) );
- pow22_fx = L_add( pow22_fx, Mult_32_32( L_shl( (Word32) auOut_fx[N_LEAD_NB + i], 6 ), L_shl( (Word32) auOut_fx[N_LEAD_NB + i], 6 ) ) );
- }
+ return 0;
+}
+static void common_overlapping_fx(
+ Word16 *auOut_fx, /* i : Input */
+ Word16 *ImdctOutWin_fx, /* o : Output */
+ Word16 *OldauOut_fx, /* i : Window */
+ Word16 end1, /* i : Decay */
+ Word16 offset1,
+ Word16 start2,
+ Word16 end2,
+ Word16 offset_i2,
+ Word16 offset2 )
+{
+ Word16 i;
- IF( GT_32( pow22_fx, L_add( pow1_fx, L_shl( pow1_fx, 1 ) ) ) )
- {
- return 1;
- }
+ /* Common Overlapping */
+ FOR( i = 0; i < end1; i++ )
+ {
+ /*auOut_fx[i] = L_add(ImdctOutWin_fx[i+7*L/20], OldauOut_fx[i+offset1]);*/
+#ifdef BASOP_NOGLOB
+ auOut_fx[i] = add_sat( ImdctOutWin_fx[i + N_ZERO_NB], OldauOut_fx[add( i, offset1 )] );
+#else
+ auOut_fx[i] = add( ImdctOutWin_fx[i + N_ZERO_NB], OldauOut_fx[i + offset1] );
+#endif
+ move16();
+ }
+ FOR( i = start2; i < end2; i++ )
+ {
+ /*auOut_fx[i+offset2] = ImdctOutWin_fx[i+offset_i2]; move32();*/
+ auOut_fx[add( i, offset2 )] = ImdctOutWin_fx[add( i, offset_i2 )];
+ move16();
+ }
+
+ return;
+}
- /* Update the OldauOut array for next overlapping */
- Copy( &ImdctOutWin_fx[L], OldauOut_fx, L );
- Scaledown_fx( prev_oldauOut_fx, prev_oldauOut_fx, 23170, L );
- return 0;
+static void Smoothing_vector_NB_fx(
+ const Word16 OldauOutnoWin_fx[], /* i : Input vector 1 */
+ const Word16 ImdctOutWin_fx[], /* i : Input vector 2 */
+ const Word16 SmoothingWin_fx[], /* i : Smoothing window */
+ Word16 auOut_fx[], /* o : Output vector that contains vector 1 .* vector 2 */
+ const Word16 ol_size /* i : Overlap size */
+)
+{
+ Word16 i;
+ Word16 weight_fx;
+
+ FOR( i = 0; i < ol_size; i++ )
+ {
+ weight_fx = SmoothingWin_fx[i];
+ move16();
+ auOut_fx[i] = add( mult( OldauOutnoWin_fx[i], sub( 32767, weight_fx ) ), mult( ImdctOutWin_fx[i], weight_fx ) );
+ move16();
}
- static void common_overlapping_fx(
- Word16 * auOut_fx, /* i : Input */
- Word16 * ImdctOutWin_fx, /* o : Output */
- Word16 * OldauOut_fx, /* i : Window */
- Word16 end1, /* i : Decay */
- Word16 offset1,
- Word16 start2,
- Word16 end2,
- Word16 offset_i2,
- Word16 offset2 )
+ return;
+}
+
+
+static void Windowing_1st_NB_fx(
+ Word16 *ImdctOutWin_fx, /* o : Output */
+ const Word32 *ImdctOut_fx, /* i : Input */
+ const Word16 *win_fx, /* i : Window */
+ const Word16 *smoothingWin_fx, /* i : Smoothing Window */
+ Word16 smoothing_flag /* i : 1=Smoothing window, 0=Original window */
+)
+{
+ Word16 i;
+ Word16 L;
+
+ L = L_FRAME8k;
+ move16();
+ IF( smoothing_flag == 0 )
{
- Word16 i;
-
- /* Common Overlapping */
- FOR( i = 0; i < end1; i++ )
+ FOR( i = N_ZERO_NB; i < shr( L, 1 ); i++ )
{
- /*auOut_fx[i] = L_add(ImdctOutWin_fx[i+7*L/20], OldauOut_fx[i+offset1]);*/
-#ifdef BASOP_NOGLOB
- auOut_fx[i] = add_sat( ImdctOutWin_fx[i + N_ZERO_NB], OldauOut_fx[add( i, offset1 )] );
-#else
- auOut_fx[i] = add( ImdctOutWin_fx[i + N_ZERO_NB], OldauOut_fx[i + offset1] );
-#endif
+ /*ImdctOutWin[i] = ImdctOut[L/2 + i] * win[(2*L-1-i)-N_LEAD_O_NB];*/
+ ImdctOutWin_fx[i] = extract_l( L_shr( Mult_32_16( ImdctOut_fx[add( shr( L, 1 ), i )], win_fx[sub( sub( sub( shl( L, 1 ), 1 ), i ), N_LEAD_O_NB )] ), 6 ) );
move16();
}
- FOR( i = start2; i < end2; i++ )
+
+ FOR( i = 0; i < N_ZERO_O_NB; i++ )
{
- /*auOut_fx[i+offset2] = ImdctOutWin_fx[i+offset_i2]; move32();*/
- auOut_fx[add( i, offset2 )] = ImdctOutWin_fx[add( i, offset_i2 )];
+ /*ImdctOutWin[L/2 + i] = -ImdctOut[L - 1 - i] * win[(3*L/2-1-i)-N_LEAD_O_NB];*/
+ /*ImdctOutWin[3*L/2 + i] = -ImdctOut[i] * win[(L/2-i-1)];*/
+ ImdctOutWin_fx[add( shr( L, 1 ), i )] = extract_l( L_shr( Mult_32_16( L_negate( ImdctOut_fx[sub( sub( L, 1 ), i )] ), win_fx[sub( ( sub( sub( shr( imult1616( 3, L ), 1 ), 1 ), i ) ), N_LEAD_O_NB )] ), 6 ) );
+ move16();
+ ImdctOutWin_fx[add( idiv1616( imult1616( 3, L ), 2 ), i )] = extract_l( L_shr( Mult_32_16( L_negate( ImdctOut_fx[i] ), win_fx[sub( sub( shr( L, 1 ), i ), 1 )] ), 6 ) );
move16();
}
-
- return;
}
-
-
- static void Smoothing_vector_NB_fx(
- const Word16 OldauOutnoWin_fx[], /* i : Input vector 1 */
- const Word16 ImdctOutWin_fx[], /* i : Input vector 2 */
- const Word16 SmoothingWin_fx[], /* i : Smoothing window */
- Word16 auOut_fx[], /* o : Output vector that contains vector 1 .* vector 2 */
- const Word16 ol_size /* i : Overlap size */
- )
+ ELSE
{
- Word16 i;
- Word16 weight_fx;
+ FOR( i = N_ZERO_NB; i < shr( L, 1 ); i++ )
+ {
+ /*ImdctOutWin[i] = ImdctOut[L/2 + i] * smoothingWin[(i-N_ZERO_NB)];*/ /*win[(2*L-i)*decimate-1-decay-14*L_FRAME48k/20];*/
+ ImdctOutWin_fx[i] = extract_l( L_shr( Mult_32_16( ImdctOut_fx[add( shr( L, 1 ), i )], smoothingWin_fx[sub( i, N_ZERO_NB )] ), 6 ) ); /*win[(2*L-i)*decimate-1-decay-14*L_FRAME48k/20];*/
+ move16();
+ }
- FOR( i = 0; i < ol_size; i++ )
+ FOR( i = 0; i < N_ZERO_O_NB; i++ )
{
- weight_fx = SmoothingWin_fx[i];
+ /*ImdctOutWin[L/2 + i] = -ImdctOut[L - 1 - i] * smoothingWin[(i+N_ZERO_O_NB)];*/ /*win[(3*L/2-1-i)*decimate+decay-L_FRAME48k*14/20];*/
+ /*ImdctOutWin[3*L/2 + i] = -ImdctOut[i] * win[(L/2-i-1)];*/
+ ImdctOutWin_fx[add( shr( L, 1 ), i )] = extract_l( L_shr( Mult_32_16( L_negate( ImdctOut_fx[sub( sub( L, 1 ), i )] ), smoothingWin_fx[add( i, N_ZERO_O_NB )] ), 6 ) ); /*win[(3*L/2-1-i)*decimate+decay-L_FRAME48k*14/20];*/
move16();
- auOut_fx[i] = add( mult( OldauOutnoWin_fx[i], sub( 32767, weight_fx ) ), mult( ImdctOutWin_fx[i], weight_fx ) );
+ ImdctOutWin_fx[add( shr( imult1616( 3, L ), 1 ), i )] = extract_l( L_shr( Mult_32_16( L_negate( ImdctOut_fx[i] ), win_fx[sub( sub( shr( L, 1 ), i ), 1 )] ), 6 ) );
move16();
}
-
- return;
}
+ return;
+}
+static void Windowing_2nd_NB_fx(
+ Word16 *ImdctOutWin_fx, /* o : Output */
+ const Word32 *ImdctOut_fx, /* i : Input */
+ const Word16 *win_fx /* i : Window */
+)
+{
+ Word16 i;
+ Word16 L;
- static void Windowing_1st_NB_fx(
- Word16 * ImdctOutWin_fx, /* o : Output */
- const Word32 *ImdctOut_fx, /* i : Input */
- const Word16 *win_fx, /* i : Window */
- const Word16 *smoothingWin_fx, /* i : Smoothing Window */
- Word16 smoothing_flag /* i : 1=Smoothing window, 0=Original window */
- )
+ L = L_FRAME8k;
+ move16();
+ FOR( i = N_ZERO_O_NB; i < shr( L, 1 ); i++ )
{
- Word16 i;
- Word16 L;
-
- L = L_FRAME8k;
+ /*ImdctOutWin[L/2 + i] = -ImdctOut[L - 1 - i];*/
+ /*ImdctOutWin[3*L/2 + i] = -ImdctOut[i] * win[L/2-i-1];*/
+ ImdctOutWin_fx[add( shr( L, 1 ), i )] = extract_l( L_shr( L_negate( ImdctOut_fx[sub( sub( L, 1 ), i )] ), 6 ) );
+ move16();
+ ImdctOutWin_fx[add( shr( imult1616( 3, L ), 1 ), i )] = extract_l( L_shr( Mult_32_16( L_negate( ImdctOut_fx[i] ), win_fx[sub( sub( shr( L, 1 ), i ), 1 )] ), 6 ) );
move16();
- IF( smoothing_flag == 0 )
- {
- FOR( i = N_ZERO_NB; i < shr( L, 1 ); i++ )
- {
- /*ImdctOutWin[i] = ImdctOut[L/2 + i] * win[(2*L-1-i)-N_LEAD_O_NB];*/
- ImdctOutWin_fx[i] = extract_l( L_shr( Mult_32_16( ImdctOut_fx[add( shr( L, 1 ), i )], win_fx[sub( sub( sub( shl( L, 1 ), 1 ), i ), N_LEAD_O_NB )] ), 6 ) );
- move16();
- }
-
- FOR( i = 0; i < N_ZERO_O_NB; i++ )
- {
- /*ImdctOutWin[L/2 + i] = -ImdctOut[L - 1 - i] * win[(3*L/2-1-i)-N_LEAD_O_NB];*/
- /*ImdctOutWin[3*L/2 + i] = -ImdctOut[i] * win[(L/2-i-1)];*/
- ImdctOutWin_fx[add( shr( L, 1 ), i )] = extract_l( L_shr( Mult_32_16( L_negate( ImdctOut_fx[sub( sub( L, 1 ), i )] ), win_fx[sub( ( sub( sub( shr( imult1616( 3, L ), 1 ), 1 ), i ) ), N_LEAD_O_NB )] ), 6 ) );
- move16();
- ImdctOutWin_fx[add( idiv1616( imult1616( 3, L ), 2 ), i )] = extract_l( L_shr( Mult_32_16( L_negate( ImdctOut_fx[i] ), win_fx[sub( sub( shr( L, 1 ), i ), 1 )] ), 6 ) );
- move16();
- }
- }
- ELSE
- {
- FOR( i = N_ZERO_NB; i < shr( L, 1 ); i++ )
- {
- /*ImdctOutWin[i] = ImdctOut[L/2 + i] * smoothingWin[(i-N_ZERO_NB)];*/ /*win[(2*L-i)*decimate-1-decay-14*L_FRAME48k/20];*/
- ImdctOutWin_fx[i] = extract_l( L_shr( Mult_32_16( ImdctOut_fx[add( shr( L, 1 ), i )], smoothingWin_fx[sub( i, N_ZERO_NB )] ), 6 ) ); /*win[(2*L-i)*decimate-1-decay-14*L_FRAME48k/20];*/
- move16();
- }
-
- FOR( i = 0; i < N_ZERO_O_NB; i++ )
- {
- /*ImdctOutWin[L/2 + i] = -ImdctOut[L - 1 - i] * smoothingWin[(i+N_ZERO_O_NB)];*/ /*win[(3*L/2-1-i)*decimate+decay-L_FRAME48k*14/20];*/
- /*ImdctOutWin[3*L/2 + i] = -ImdctOut[i] * win[(L/2-i-1)];*/
- ImdctOutWin_fx[add( shr( L, 1 ), i )] = extract_l( L_shr( Mult_32_16( L_negate( ImdctOut_fx[sub( sub( L, 1 ), i )] ), smoothingWin_fx[add( i, N_ZERO_O_NB )] ), 6 ) ); /*win[(3*L/2-1-i)*decimate+decay-L_FRAME48k*14/20];*/
- move16();
- ImdctOutWin_fx[add( shr( imult1616( 3, L ), 1 ), i )] = extract_l( L_shr( Mult_32_16( L_negate( ImdctOut_fx[i] ), win_fx[sub( sub( shr( L, 1 ), i ), 1 )] ), 6 ) );
- move16();
- }
- }
-
- return;
}
- static void Windowing_2nd_NB_fx(
- Word16 * ImdctOutWin_fx, /* o : Output */
- const Word32 *ImdctOut_fx, /* i : Input */
- const Word16 *win_fx /* i : Window */
- )
+
+ FOR( i = 0; i < N_ZERO_NB; i++ )
{
- Word16 i;
- Word16 L;
+ /*ImdctOutWin[L + i] = -ImdctOut[L/2 - 1 - i];*/
+ ImdctOutWin_fx[add( L, i )] = extract_l( L_shr( L_negate( ImdctOut_fx[sub( sub( shr( L, 1 ), 1 ), i )] ), 6 ) );
+ move16();
+ }
- L = L_FRAME8k;
+ FOR( i = N_ZERO_NB; i < shr( L, 1 ); i++ )
+ {
+ /*ImdctOutWin[L + i] = -ImdctOut[L/2 - 1 - i] * win[L - 1 - i];*/
+ ImdctOutWin_fx[add( L, i )] = extract_l( L_shr( Mult_32_16( L_negate( ImdctOut_fx[sub( sub( shr( L, 1 ), 1 ), i )] ), win_fx[sub( sub( L, 1 ), i )] ), 6 ) );
move16();
- FOR( i = N_ZERO_O_NB; i < shr( L, 1 ); i++ )
- {
- /*ImdctOutWin[L/2 + i] = -ImdctOut[L - 1 - i];*/
- /*ImdctOutWin[3*L/2 + i] = -ImdctOut[i] * win[L/2-i-1];*/
- ImdctOutWin_fx[add( shr( L, 1 ), i )] = extract_l( L_shr( L_negate( ImdctOut_fx[sub( sub( L, 1 ), i )] ), 6 ) );
- move16();
- ImdctOutWin_fx[add( shr( imult1616( 3, L ), 1 ), i )] = extract_l( L_shr( Mult_32_16( L_negate( ImdctOut_fx[i] ), win_fx[sub( sub( shr( L, 1 ), i ), 1 )] ), 6 ) );
- move16();
- }
+ }
- FOR( i = 0; i < N_ZERO_NB; i++ )
- {
- /*ImdctOutWin[L + i] = -ImdctOut[L/2 - 1 - i];*/
- ImdctOutWin_fx[add( L, i )] = extract_l( L_shr( L_negate( ImdctOut_fx[sub( sub( shr( L, 1 ), 1 ), i )] ), 6 ) );
- move16();
- }
+ return;
+}
- FOR( i = N_ZERO_NB; i < shr( L, 1 ); i++ )
- {
- /*ImdctOutWin[L + i] = -ImdctOut[L/2 - 1 - i] * win[L - 1 - i];*/
- ImdctOutWin_fx[add( L, i )] = extract_l( L_shr( Mult_32_16( L_negate( ImdctOut_fx[sub( sub( shr( L, 1 ), 1 ), i )] ), win_fx[sub( sub( L, 1 ), i )] ), 6 ) );
- move16();
- }
+static void Smoothing_vector_scaledown_NB_fx(
+ const Word16 OldauOutnoWin_fx[], /* i : Input vector 1 */
+ const Word16 ImdctOutWin_fx[], /* i : Input vector 2 */
+ const Word16 SmoothingWin_fx[], /* i : Smoothing window */
+ Word16 auOut_fx[], /* o : Output vector that contains vector 1 .* vector 2 */
+ const Word16 ol_size /* i : Overlap size */
+
+)
+{
+ Word16 i;
+ Word16 weight_fx;
- return;
+ FOR( i = 0; i < ol_size; i++ )
+ {
+ weight_fx = SmoothingWin_fx[i];
+ move16();
+ auOut_fx[i] = add( mult( OldauOutnoWin_fx[i], sub( 32767, weight_fx ) ),
+ mult( ImdctOutWin_fx[i], mult_r( 23170, weight_fx ) ) );
+ move16();
}
- static void Smoothing_vector_scaledown_NB_fx(
- const Word16 OldauOutnoWin_fx[], /* i : Input vector 1 */
- const Word16 ImdctOutWin_fx[], /* i : Input vector 2 */
- const Word16 SmoothingWin_fx[], /* i : Smoothing window */
- Word16 auOut_fx[], /* o : Output vector that contains vector 1 .* vector 2 */
- const Word16 ol_size /* i : Overlap size */
+ return;
+}
- )
- {
- Word16 i;
- Word16 weight_fx;
- FOR( i = 0; i < ol_size; i++ )
- {
- weight_fx = SmoothingWin_fx[i];
- move16();
- auOut_fx[i] = add( mult( OldauOutnoWin_fx[i], sub( 32767, weight_fx ) ),
- mult( ImdctOutWin_fx[i], mult_r( 23170, weight_fx ) ) );
- move16();
- }
+static void Scaledown_fx(
+ Word16 x[], /* i : Input vector */
+ Word16 y[], /* o : Output vector that contains vector 1 .* vector 2 */
+ Word16 scale_v, /*Q15 */
+ const Word16 N /* i : Overlap size */
+)
+{
+ Word16 i;
- return;
+ FOR( i = 0; i < N; i++ )
+ {
+ y[i] = mult( x[i], scale_v );
+ move16();
}
+ return;
+}
+
+void time_domain_FEC_HQ_fx(
+ Decoder_State *st_fx, /* i : Decoder State */
+ Word32 *wtda_audio_fx, /* i : input */
+ Word16 *out_fx, /* o : output audio */
+ Word16 mean_en_high_fx, /* i : transient flag */
+ const Word16 output_frame,
+ Word16 *Q_synth )
+{
+ HQ_NBFEC_HANDLE hHQ_nbfec;
+ HQ_DEC_HANDLE hHQ_core;
+ hHQ_nbfec = st_fx->hHQ_nbfec;
+ hHQ_core = st_fx->hHQ_core;
- static void Scaledown_fx(
- Word16 x[], /* i : Input vector */
- Word16 y[], /* o : Output vector that contains vector 1 .* vector 2 */
- Word16 scale_v, /*Q15 */
- const Word16 N /* i : Overlap size */
- )
+ IF( hHQ_core->Q_old_wtda != 0 )
{
- Word16 i;
+ Scale_sig( hHQ_core->old_out_fx, output_frame, negate( hHQ_core->Q_old_wtda ) );
+ hHQ_core->Q_old_wtda = 0;
+ move16();
+ }
- FOR( i = 0; i < N; i++ )
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ IF( ( EQ_16( st_fx->nbLostCmpt, 1 ) ) && ( EQ_16( hHQ_nbfec->phase_mat_flag, 1 ) ) && ( hHQ_nbfec->phase_mat_next == 0 ) )
+ {
+ IF( FEC_phase_matching_fx( hHQ_nbfec, wtda_audio_fx, out_fx, hHQ_core->old_out_fx, hHQ_nbfec->old_out_pha_fx ) )
{
- y[i] = mult( x[i], scale_v );
+ /* window_ola( wtda_audio, out, st->old_out, output_frame, 0, 0, 0 ); */
+ window_ola_fx( wtda_audio_fx, out_fx, Q_synth, hHQ_core->old_out_fx, &hHQ_core->Q_old_wtda, output_frame, ALDO_WINDOW, ALDO_WINDOW, 0, 0, 0 );
+ hHQ_nbfec->phase_mat_next = 0;
move16();
}
-
- return;
- }
-
- void time_domain_FEC_HQ_fx(
- Decoder_State * st_fx, /* i : Decoder State */
- Word32 * wtda_audio_fx, /* i : input */
- Word16 * out_fx, /* o : output audio */
- Word16 mean_en_high_fx, /* i : transient flag */
- const Word16 output_frame,
- Word16 *Q_synth )
- {
- HQ_NBFEC_HANDLE hHQ_nbfec;
- HQ_DEC_HANDLE hHQ_core;
- hHQ_nbfec = st_fx->hHQ_nbfec;
- hHQ_core = st_fx->hHQ_core;
-
- IF( hHQ_core->Q_old_wtda != 0 )
+ ELSE
{
- Scale_sig( hHQ_core->old_out_fx, output_frame, negate( hHQ_core->Q_old_wtda ) );
- hHQ_core->Q_old_wtda = 0;
+ hHQ_nbfec->phase_mat_next = 1;
+ move16();
+ *Q_synth = 0;
move16();
}
+ }
+ ELSE IF( ( EQ_16( st_fx->prev_bfi, 1 ) ) && ( st_fx->bfi == 0 ) && ( EQ_16( hHQ_nbfec->phase_mat_next, 1 ) ) )
+ {
+ FEC_phase_matching_nextgood_fx( wtda_audio_fx, out_fx, hHQ_core->old_out_fx, hHQ_nbfec->old_out_pha_fx, mean_en_high_fx );
+ hHQ_nbfec->phase_mat_next = 0;
+ move16();
+ *Q_synth = 0;
+ move16();
+ }
+ ELSE IF( ( EQ_16( st_fx->prev_bfi, 1 ) ) && ( EQ_16( st_fx->bfi, 1 ) ) && ( EQ_16( hHQ_nbfec->phase_mat_next, 1 ) ) )
+ {
+ FEC_phase_matching_burst_fx( wtda_audio_fx, out_fx, hHQ_core->old_out_fx, hHQ_nbfec->old_out_pha_fx, hHQ_nbfec->prev_oldauOut_fx );
+ hHQ_nbfec->phase_mat_next = 1;
+ move16();
+ *Q_synth = 0;
+ move16();
+ }
+ ELSE
+ {
+ /*n4 = (short)(N_LEAD_MDCT*(float)(output_frame/20));*/
test();
- test();
- test();
- test();
- test();
- test();
- IF( ( EQ_16( st_fx->nbLostCmpt, 1 ) ) && ( EQ_16( hHQ_nbfec->phase_mat_flag, 1 ) ) && ( hHQ_nbfec->phase_mat_next == 0 ) )
+ IF( st_fx->bfi == 0 && EQ_16( st_fx->prev_bfi, 1 ) )
{
- IF( FEC_phase_matching_fx( hHQ_nbfec, wtda_audio_fx, out_fx, hHQ_core->old_out_fx, hHQ_nbfec->old_out_pha_fx ) )
+ test();
+ IF( ( EQ_16( hHQ_nbfec->stat_mode_out, 1 ) ) || ( LT_16( hHQ_nbfec->diff_energy_fx, ED_THRES_50P_fx ) ) ) /* Q11 */
{
- /* window_ola( wtda_audio, out, st->old_out, output_frame, 0, 0, 0 ); */
- window_ola_fx( wtda_audio_fx, out_fx, Q_synth, hHQ_core->old_out_fx, &hHQ_core->Q_old_wtda, output_frame, ALDO_WINDOW, ALDO_WINDOW, 0, 0, 0 );
- hHQ_nbfec->phase_mat_next = 0;
+ Word16 tmp;
+
+ tmp = 0;
+ move16();
+ if ( GT_16( st_fx->old_bfi_cnt, 1 ) )
+ {
+ tmp = 1;
+ move16();
+ }
+ Repetition_smoothing_nextgood_fx( wtda_audio_fx, out_fx, hHQ_nbfec->oldIMDCTout_fx, hHQ_core->old_out_fx, tmp, N_LEAD_NB );
+ *Q_synth = 0;
move16();
}
- ELSE
+ ELSE IF( GT_16( st_fx->old_bfi_cnt, 1 ) )
{
- hHQ_nbfec->phase_mat_next = 1;
- move16();
+ Next_good_after_burst_erasures_fx( wtda_audio_fx, out_fx, hHQ_core->old_out_fx, N_LEAD_NB );
*Q_synth = 0;
move16();
}
+ ELSE
+ {
+ /*window_ola( wtda_audio, out, st->old_out, output_frame, 0, 0, 0); */
+ window_ola_fx( wtda_audio_fx, out_fx, Q_synth, hHQ_core->old_out_fx, &hHQ_core->Q_old_wtda, output_frame,
+ st_fx->hTcxCfg->tcx_last_overlap_mode, st_fx->hTcxCfg->tcx_curr_overlap_mode, st_fx->prev_bfi, hHQ_core->oldHqVoicing, hHQ_core->oldgapsynth_fx );
+ }
}
- ELSE IF( ( EQ_16( st_fx->prev_bfi, 1 ) ) && ( st_fx->bfi == 0 ) && ( EQ_16( hHQ_nbfec->phase_mat_next, 1 ) ) )
- {
- FEC_phase_matching_nextgood_fx( wtda_audio_fx, out_fx, hHQ_core->old_out_fx, hHQ_nbfec->old_out_pha_fx, mean_en_high_fx );
-
- hHQ_nbfec->phase_mat_next = 0;
- move16();
- *Q_synth = 0;
- move16();
- }
- ELSE IF( ( EQ_16( st_fx->prev_bfi, 1 ) ) && ( EQ_16( st_fx->bfi, 1 ) ) && ( EQ_16( hHQ_nbfec->phase_mat_next, 1 ) ) )
- {
- FEC_phase_matching_burst_fx( wtda_audio_fx, out_fx, hHQ_core->old_out_fx, hHQ_nbfec->old_out_pha_fx, hHQ_nbfec->prev_oldauOut_fx );
- hHQ_nbfec->phase_mat_next = 1;
- move16();
- *Q_synth = 0;
- move16();
- }
- ELSE
+ ELSE /* if(st->bfi == 1) */
{
- /*n4 = (short)(N_LEAD_MDCT*(float)(output_frame/20));*/
test();
- IF( st_fx->bfi == 0 && EQ_16( st_fx->prev_bfi, 1 ) )
+ IF( ( EQ_16( hHQ_nbfec->stat_mode_out, 1 ) ) || ( LT_16( hHQ_nbfec->diff_energy_fx, ED_THRES_50P_fx ) ) )
{
- test();
- IF( ( EQ_16( hHQ_nbfec->stat_mode_out, 1 ) ) || ( LT_16( hHQ_nbfec->diff_energy_fx, ED_THRES_50P_fx ) ) ) /* Q11 */
+ /* if( window_ola_bfi( wtda_audio, out, st->oldIMDCTout, st->old_out, output_frame, st->prev_oldauOut, N_LEAD_NB) ) */
+ IF( Repetition_smoothing_fx( wtda_audio_fx, out_fx, hHQ_nbfec->oldIMDCTout_fx, hHQ_core->old_out_fx, output_frame, hHQ_nbfec->prev_oldauOut_fx, N_LEAD_NB ) )
{
- Word16 tmp;
-
- tmp = 0;
- move16();
- if ( GT_16( st_fx->old_bfi_cnt, 1 ) )
- {
- tmp = 1;
- move16();
- }
- Repetition_smoothing_nextgood_fx( wtda_audio_fx, out_fx, hHQ_nbfec->oldIMDCTout_fx, hHQ_core->old_out_fx, tmp, N_LEAD_NB );
- *Q_synth = 0;
- move16();
+ /*window_ola( wtda_audio, out, st->old_out, output_frame, 0, 0, 0);*/
+ window_ola_fx( wtda_audio_fx, out_fx, Q_synth, hHQ_core->old_out_fx, &hHQ_core->Q_old_wtda, output_frame,
+ st_fx->hTcxCfg->tcx_last_overlap_mode, st_fx->hTcxCfg->tcx_curr_overlap_mode, st_fx->prev_bfi, hHQ_core->oldHqVoicing, hHQ_core->oldgapsynth_fx );
}
- ELSE IF( GT_16( st_fx->old_bfi_cnt, 1 ) )
+ ELSE
{
- Next_good_after_burst_erasures_fx( wtda_audio_fx, out_fx, hHQ_core->old_out_fx, N_LEAD_NB );
*Q_synth = 0;
move16();
}
- ELSE
- {
- /*window_ola( wtda_audio, out, st->old_out, output_frame, 0, 0, 0); */
- window_ola_fx( wtda_audio_fx, out_fx, Q_synth, hHQ_core->old_out_fx, &hHQ_core->Q_old_wtda, output_frame,
- st_fx->hTcxCfg->tcx_last_overlap_mode, st_fx->hTcxCfg->tcx_curr_overlap_mode, st_fx->prev_bfi, hHQ_core->oldHqVoicing, hHQ_core->oldgapsynth_fx );
- }
}
- ELSE /* if(st->bfi == 1) */
+ ELSE
{
- test();
- IF( ( EQ_16( hHQ_nbfec->stat_mode_out, 1 ) ) || ( LT_16( hHQ_nbfec->diff_energy_fx, ED_THRES_50P_fx ) ) )
- {
- /* if( window_ola_bfi( wtda_audio, out, st->oldIMDCTout, st->old_out, output_frame, st->prev_oldauOut, N_LEAD_NB) ) */
- IF( Repetition_smoothing_fx( wtda_audio_fx, out_fx, hHQ_nbfec->oldIMDCTout_fx, hHQ_core->old_out_fx, output_frame, hHQ_nbfec->prev_oldauOut_fx, N_LEAD_NB ) )
- {
- /*window_ola( wtda_audio, out, st->old_out, output_frame, 0, 0, 0);*/
- window_ola_fx( wtda_audio_fx, out_fx, Q_synth, hHQ_core->old_out_fx, &hHQ_core->Q_old_wtda, output_frame,
- st_fx->hTcxCfg->tcx_last_overlap_mode, st_fx->hTcxCfg->tcx_curr_overlap_mode, st_fx->prev_bfi, hHQ_core->oldHqVoicing, hHQ_core->oldgapsynth_fx );
- }
- ELSE
- {
- *Q_synth = 0;
- move16();
- }
- }
- ELSE
- {
- /*window_ola( wtda_audio, out, st->old_out, output_frame, 0, 0, 0 );*/
- window_ola_fx( wtda_audio_fx, out_fx, Q_synth, hHQ_core->old_out_fx, &hHQ_core->Q_old_wtda, output_frame,
- st_fx->hTcxCfg->tcx_last_overlap_mode, st_fx->hTcxCfg->tcx_curr_overlap_mode, st_fx->prev_bfi, hHQ_core->oldHqVoicing, hHQ_core->oldgapsynth_fx );
- }
+ /*window_ola( wtda_audio, out, st->old_out, output_frame, 0, 0, 0 );*/
+ window_ola_fx( wtda_audio_fx, out_fx, Q_synth, hHQ_core->old_out_fx, &hHQ_core->Q_old_wtda, output_frame,
+ st_fx->hTcxCfg->tcx_last_overlap_mode, st_fx->hTcxCfg->tcx_curr_overlap_mode, st_fx->prev_bfi, hHQ_core->oldHqVoicing, hHQ_core->oldgapsynth_fx );
}
- hHQ_nbfec->phase_mat_next = 0;
- move16();
}
-
- return;
+ hHQ_nbfec->phase_mat_next = 0;
+ move16();
}
- static void Next_good_after_burst_erasures_fx(
- const Word32 *ImdctOut_fx,
- Word16 *auOut_fx,
- Word16 *OldauOut_fx,
- const Word16 ol_size )
- {
- Word16 i, L;
- Word16 ImdctOutWin_fx[2 * L_FRAME48k];
- Word16 win_NB_fx[L_FRAME8k + 25];
+ return;
+}
+
+static void Next_good_after_burst_erasures_fx(
+ const Word32 *ImdctOut_fx,
+ Word16 *auOut_fx,
+ Word16 *OldauOut_fx,
+ const Word16 ol_size )
+{
+ Word16 i, L;
+ Word16 ImdctOutWin_fx[2 * L_FRAME48k];
+ Word16 win_NB_fx[L_FRAME8k + 25];
- L = L_FRAME8k;
+ L = L_FRAME8k;
+ move16();
+ FOR( i = 0; i < add( L, 25 ); i++ )
+ {
+ win_NB_fx[i] = window_48kHz_fx[add( imult1616( i, 6 ), 3 )];
move16();
- FOR( i = 0; i < add( L, 25 ); i++ )
- {
- win_NB_fx[i] = window_48kHz_fx[add( imult1616( i, 6 ), 3 )];
- move16();
- }
+ }
- /* Windowing */
- Windowing_1st_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx, NULL, 0 );
- Windowing_2nd_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx );
+ /* Windowing */
+ Windowing_1st_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx, NULL, 0 );
+ Windowing_2nd_NB_fx( ImdctOutWin_fx, ImdctOut_fx, win_NB_fx );
- /* Overlapping with next good frame : Overlapping to remove the discontinuity */
- Smoothing_vector_scaledown_NB_fx( &OldauOut_fx[N_ZERO_NB], &ImdctOutWin_fx[N_Z_L_O_NB], SmoothingWin_NB875_fx, &OldauOut_fx[N_ZERO_NB], ol_size );
+ /* Overlapping with next good frame : Overlapping to remove the discontinuity */
+ Smoothing_vector_scaledown_NB_fx( &OldauOut_fx[N_ZERO_NB], &ImdctOutWin_fx[N_Z_L_O_NB], SmoothingWin_NB875_fx, &OldauOut_fx[N_ZERO_NB], ol_size );
- /* Scale down the overlapped signal */
- Scaledown_fx( &ImdctOutWin_fx[add( ol_size, N_Z_L_O_NB )], &OldauOut_fx[add( ol_size, N_ZERO_NB )], 23170, sub( N_Z_L_NB, ol_size ) );
+ /* Scale down the overlapped signal */
+ Scaledown_fx( &ImdctOutWin_fx[add( ol_size, N_Z_L_O_NB )], &OldauOut_fx[add( ol_size, N_ZERO_NB )], 23170, sub( N_Z_L_NB, ol_size ) );
- /* Common Overlapping */
- common_overlapping_fx( auOut_fx, ImdctOutWin_fx, OldauOut_fx, N_Z_L_NB, N_ZERO_NB, 0, N_ZERO_NB, L, N_Z_L_NB );
- Copy( &ImdctOutWin_fx[L], OldauOut_fx, L );
+ /* Common Overlapping */
+ common_overlapping_fx( auOut_fx, ImdctOutWin_fx, OldauOut_fx, N_Z_L_NB, N_ZERO_NB, 0, N_ZERO_NB, L, N_Z_L_NB );
+ Copy( &ImdctOutWin_fx[L], OldauOut_fx, L );
- return;
- }
+ return;
+}
#endif
#ifdef ADD_IVAS_HQ_CODE_FEC
- /*--------------------------------------------------------------------------
- * save_synthesis_hq_fec()
- *
- * Save synthesis for HQ FEC
- *-------------------------------------------------------------------------*/
-
- void save_synthesis_hq_fec(
- Decoder_State * st, /* i/o: decoder state structure */
- const float *output, /* i : decoded synthesis */
- const int16_t output_frame, /* i : decoded synthesis */
- CPE_DEC_HANDLE hCPE /* i : CPE decoder structure */
- )
- {
- int16_t post_hq_delay;
-
- switch ( st->element_mode )
- {
- case EVS_MONO:
- post_hq_delay = NS2SA( st->output_Fs, POST_HQ_DELAY_NS );
- break;
- case IVAS_SCE:
+/*--------------------------------------------------------------------------
+ * save_synthesis_hq_fec()
+ *
+ * Save synthesis for HQ FEC
+ *-------------------------------------------------------------------------*/
+
+void save_synthesis_hq_fec(
+ Decoder_State *st, /* i/o: decoder state structure */
+ const float *output, /* i : decoded synthesis */
+ const int16_t output_frame, /* i : decoded synthesis */
+ CPE_DEC_HANDLE hCPE /* i : CPE decoder structure */
+)
+{
+ int16_t post_hq_delay;
+
+ switch ( st->element_mode )
+ {
+ case EVS_MONO:
+ post_hq_delay = NS2SA( st->output_Fs, POST_HQ_DELAY_NS );
+ break;
+ case IVAS_SCE:
+ post_hq_delay = NS2SA( st->output_Fs, DELAY_CLDFB_NS );
+ break;
+ case IVAS_CPE_DFT:
+ if ( hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF )
+ {
post_hq_delay = NS2SA( st->output_Fs, DELAY_CLDFB_NS );
- break;
- case IVAS_CPE_DFT:
- if ( hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF )
- {
- post_hq_delay = NS2SA( st->output_Fs, DELAY_CLDFB_NS );
- }
- else
- {
- post_hq_delay = 0;
- }
- break;
- default:
+ }
+ else
+ {
post_hq_delay = 0;
- break;
- }
+ }
+ break;
+ default:
+ post_hq_delay = 0;
+ break;
+ }
- if ( ( st->codec_mode == MODE1 && st->hTcxDec != NULL ) && ( ( st->core == ACELP_CORE && !( st->bfi == 1 && st->con_tcx == 1 ) ) || st->core == HQ_CORE ) )
+ if ( ( st->codec_mode == MODE1 && st->hTcxDec != NULL ) && ( ( st->core == ACELP_CORE && !( st->bfi == 1 && st->con_tcx == 1 ) ) || st->core == HQ_CORE ) )
+ {
+ mvr2r( st->hTcxDec->synth_history + output_frame, st->hTcxDec->synth_history, output_frame - post_hq_delay + NS2SA( st->output_Fs, PH_ECU_MEM_NS ) );
+ mvr2r( output, st->hTcxDec->old_synthFB + output_frame - post_hq_delay, output_frame );
+
+ if ( st->element_mode == EVS_MONO )
{
- mvr2r( st->hTcxDec->synth_history + output_frame, st->hTcxDec->synth_history, output_frame - post_hq_delay + NS2SA( st->output_Fs, PH_ECU_MEM_NS ) );
- mvr2r( output, st->hTcxDec->old_synthFB + output_frame - post_hq_delay, output_frame );
+ /* reset the remaining buffer, which is read in TCX concealment the necessary samples to fill
+ this buffer are not available for all cases, the impact on the output is limited */
+ set_f( st->hTcxDec->old_synthFB + 2 * output_frame - post_hq_delay, 0.f, post_hq_delay );
+ if ( output_frame >= L_FRAME16k )
+ {
+ mvr2r( st->prev_synth_buffer, st->hTcxDec->old_synthFB + 2 * output_frame - NS2SA( st->output_Fs, DELAY_BWE_TOTAL_NS ), NS2SA( st->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ) );
+ }
+ else
+ {
+ mvr2r( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB + 2 * output_frame, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) );
+ }
- if ( st->element_mode == EVS_MONO )
+ if ( st->core != ACELP_CORE )
{
- /* reset the remaining buffer, which is read in TCX concealment the necessary samples to fill
- this buffer are not available for all cases, the impact on the output is limited */
- set_f( st->hTcxDec->old_synthFB + 2 * output_frame - post_hq_delay, 0.f, post_hq_delay );
if ( output_frame >= L_FRAME16k )
{
- mvr2r( st->prev_synth_buffer, st->hTcxDec->old_synthFB + 2 * output_frame - NS2SA( st->output_Fs, DELAY_BWE_TOTAL_NS ), NS2SA( st->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ) );
- }
- else
- {
+ mvr2r( st->delay_buf_out, st->hTcxDec->old_synthFB + 2 * output_frame - NS2SA( st->output_Fs, DELAY_CLDFB_NS ), NS2SA( st->output_Fs, DELAY_CLDFB_NS ) );
mvr2r( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB + 2 * output_frame, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) );
}
-
- if ( st->core != ACELP_CORE )
+ else
{
- if ( output_frame >= L_FRAME16k )
- {
- mvr2r( st->delay_buf_out, st->hTcxDec->old_synthFB + 2 * output_frame - NS2SA( st->output_Fs, DELAY_CLDFB_NS ), NS2SA( st->output_Fs, DELAY_CLDFB_NS ) );
- mvr2r( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB + 2 * output_frame, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) );
- }
- else
- {
- mvr2r( st->delay_buf_out, st->hTcxDec->old_synthFB + 2 * output_frame - NS2SA( st->output_Fs, DELAY_BWE_TOTAL_NS ), NS2SA( st->output_Fs, DELAY_CLDFB_NS ) );
- mvr2r( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB + 2 * output_frame - NS2SA( st->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ), NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) );
- }
+ mvr2r( st->delay_buf_out, st->hTcxDec->old_synthFB + 2 * output_frame - NS2SA( st->output_Fs, DELAY_BWE_TOTAL_NS ), NS2SA( st->output_Fs, DELAY_CLDFB_NS ) );
+ mvr2r( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB + 2 * output_frame - NS2SA( st->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ), NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) );
}
}
- else
+ }
+ else
+ {
+ if ( st->core != ACELP_CORE )
{
- if ( st->core != ACELP_CORE )
- {
- mvr2r( st->delay_buf_out, st->hTcxDec->old_synthFB + 2 * output_frame - post_hq_delay, post_hq_delay );
- mvr2r( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB + 2 * output_frame, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) );
- }
+ mvr2r( st->delay_buf_out, st->hTcxDec->old_synthFB + 2 * output_frame - post_hq_delay, post_hq_delay );
+ mvr2r( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB + 2 * output_frame, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) );
}
}
-
- return;
}
+
+ return;
+}
#endif
diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c
index 972e7f4f8a0bad887d749ebe2f44bed7eb4b27d5..d31fa5a7f0320a88bcfcb7eefada2db4d5f4f9a8 100644
--- a/lib_dec/FEC_HQ_phase_ecu_fx.c
+++ b/lib_dec/FEC_HQ_phase_ecu_fx.c
@@ -3279,7 +3279,7 @@ static void rec_wtda_fx(
p_ecu++;
}
- timesh = NS2SA_fx2( fs, 10000000L - PH_ECU_ALDO_OLP2_NS );
+ timesh = NS2SA_FX2( fs, 10000000L - PH_ECU_ALDO_OLP2_NS );
move16();
set16_fx( rec_buf, 0, output_frame );
diff --git a/lib_dec/FEC_adapt_codebook_fx.c b/lib_dec/FEC_adapt_codebook_fx.c
index 71717bd4101e6ffc190b183032561a3a9af9cd7d..d6aec88404e2ecee34b8437376f9d46bb259e021 100644
--- a/lib_dec/FEC_adapt_codebook_fx.c
+++ b/lib_dec/FEC_adapt_codebook_fx.c
@@ -118,7 +118,7 @@ Word16 FEC_SinOnset_fx(
exp2 = add( sub( exp2, 15 ), Q_exc ); /* from Q15 to Q_exc */
/* Find if rescaling needed */
- tmp = extract_h( L_mult( H_low[2], gain ) );
+ tmp = extract_h( L_mult( h_low_fx[2], gain ) );
exp_gain = norm_s( tmp );
tmp = sub( exp_gain, exp2 ); /* difference */
@@ -131,7 +131,7 @@ Word16 FEC_SinOnset_fx(
/* Generate the scaled pulse */
FOR( i = 0; i < MODE1_L_FIR_FER; i++ )
{
- L_tmp = L_mult( gain, H_low[i] ); /* Q_exc*Q15 -> Q_exc */
+ L_tmp = L_mult( gain, h_low_fx[i] ); /* Q_exc*Q15 -> Q_exc */
H_low_s[i] = round_fx( L_shl( L_tmp, exp2 ) );
move16();
}
diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c
index c0c0777e4ab587a35bb60c12292f73c078fdd8e6..024e8f1e2d30c2322c6b71a4166e58b8c3fbec97 100644
--- a/lib_dec/acelp_core_dec_fx.c
+++ b/lib_dec/acelp_core_dec_fx.c
@@ -1537,8 +1537,10 @@ ivas_error acelp_core_dec_fx(
}
}
}
+#endif
}
+#ifdef IVAS_CODE
if ( !st->cna_dirac_flag )
{
if ( st->flag_cna == 0 && st->L_frame == L_FRAME16k && st->last_flag_cna == 1 && ( ( st->last_core == ACELP_CORE && !( st->last_coder_type == AUDIO && !( st->element_mode > EVS_MONO && st->Last_GSC_noisy_speech_flag ) ) ) || st->last_core == AMR_WB_CORE ) )
@@ -1560,20 +1562,21 @@ ivas_error acelp_core_dec_fx(
}
}
#else
- IF( st_fx->flag_cna && NE_16( st_fx->coder_type, AUDIO ) )
- {
- generate_masking_noise_fx( syn_fx, st_fx->Q_syn, st_fx->hFdCngDec->hFdCngCom, st_fx->hFdCngDec->hFdCngCom->frameSize, 0 );
- }
- ELSE IF( st_fx->flag_cna && st_fx->coder_type == AUDIO && st_fx->last_core == ACELP_CORE && st_fx->last_coder_type != AUDIO )
+ IF( st_fx->flag_cna && NE_16( st_fx->coder_type, AUDIO ) )
+ {
+ generate_masking_noise_fx( syn_fx, st_fx->Q_syn, st_fx->hFdCngDec->hFdCngCom, st_fx->hFdCngDec->hFdCngCom->frameSize, 0 );
+ }
+ ELSE IF( st_fx->flag_cna && st_fx->coder_type == AUDIO && st_fx->last_core == ACELP_CORE && st_fx->last_coder_type != AUDIO )
+ {
+ FOR( i = 0; i < st_fx->hFdCngDec->hFdCngCom->frameSize / 2; i++ )
{
- FOR( i = 0; i < st_fx->hFdCngDec->hFdCngCom->frameSize / 2; i++ )
- {
- syn_fx[i] = add( syn_fx[i], shr_r( mult_r( st_fx->hFdCngDec->hFdCngCom->olapBufferSynth2[i + 5 * st_fx->hFdCngDec->hFdCngCom->frameSize / 4], st_fx->hFdCngDec->hFdCngCom->fftlenFac ), -st_fx->Q_syn ) );
- move16();
- }
+ syn_fx[i] = add( syn_fx[i], shr_r( mult_r( st_fx->hFdCngDec->hFdCngCom->olapBufferSynth2[i + 5 * st_fx->hFdCngDec->hFdCngCom->frameSize / 4], st_fx->hFdCngDec->hFdCngCom->fftlenFac ), -st_fx->Q_syn ) );
+ move16();
}
}
+#endif
+#ifndef IVAS_CODE
IF( st_fx->flag_cna == 0 && EQ_16( st_fx->L_frame, L_FRAME16k ) && st_fx->last_flag_cna == 1 && ( ( st_fx->last_core == ACELP_CORE && st_fx->last_coder_type != AUDIO ) || st_fx->last_core == AMR_WB_CORE ) )
{
FOR( i = 0; i < st_fx->L_frame / 2; i++ )
@@ -1590,6 +1593,7 @@ ivas_error acelp_core_dec_fx(
}
#endif
}
+
/*----------------------------------------------------------------*
* Resample to the output sampling rate (8/16/32/48 kHz)
* Bass post-filter
@@ -1670,7 +1674,7 @@ ivas_error acelp_core_dec_fx(
/* set NB mask for upsampling */
st_fx->cldfbSyn->bandsToZero = sub( st_fx->cldfbSyn->no_channels, 10 );
}
- ELSE if ( NE_16( st_fx->cldfbSyn->bandsToZero, sub( st_fx->cldfbSyn->no_channels, st_fx->cldfbAna->no_channels ) ) )
+ ELSE IF( NE_16( st_fx->cldfbSyn->bandsToZero, sub( st_fx->cldfbSyn->no_channels, st_fx->cldfbAna->no_channels ) ) )
{
/* in case of BW switching, re-init to default */
st_fx->cldfbSyn->bandsToZero = sub( st_fx->cldfbSyn->no_channels, st_fx->cldfbAna->no_channels );
diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c
index ddad02b9ec219bc52be7c2e1a296a8723151d405..9d715d30b75f7e75b6784e37fca9b79acd0a5323 100644
--- a/lib_dec/acelp_core_dec_ivas_fx.c
+++ b/lib_dec/acelp_core_dec_ivas_fx.c
@@ -953,7 +953,7 @@ ivas_error acelp_core_dec_ivas_fx(
tmpF_fx = *old_exc_s_fx;
st->mem_deemph_fx = old_exc_s_fx[sub( st->L_frame, 1 )];
move16();
- preemph_fx( old_exc_s_fx, st->preemph_fac, L_FRAME16k, &tmpF_fx );
+ PREEMPH_FX( old_exc_s_fx, st->preemph_fac, L_FRAME16k, &tmpF_fx );
Copy( old_exc_s_fx + st->L_frame - M, st->mem_syn2_fx, M );
Residu3_fx( Aq_fx, old_exc_s_fx, old_exc_fx + L_EXC_MEM_DEC - st->L_frame, st->L_frame, 0 );
#ifdef FIX_737_HQ_ACELP_SWITCH_SCALING_ERROR
@@ -1283,11 +1283,10 @@ ivas_error acelp_core_dec_ivas_fx(
FEC_lsf2lsp_interp( st, st->L_frame, Aq_fx, lsf_new_fx, lsp_new_fx );
#ifndef MSAN_FIX
for ( int nsf = 0; nsf < NB_SUBFR16k; nsf++ )
- {
#else
FOR( Word32 nsf = 0; nsf < st->nb_subfr; nsf++ )
- {
#endif
+ {
Scale_sig( Aq_fx + ( nsf * ( M + 1 ) ), M + 1, sub( norm_s( Aq_fx[imult3216( nsf, M + 1 )] ), Q2 ) );
Aq_fx[imult3216( nsf, M + 1 )] = ONE_IN_Q12;
move16();
diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c
index 95242729c3ac13c90937a98e63974bc08d68101e..6062659416cd1230efab6461e4506f9da3c4022d 100644
--- a/lib_dec/acelp_core_switch_dec_fx.c
+++ b/lib_dec/acelp_core_switch_dec_fx.c
@@ -316,10 +316,10 @@ ivas_error acelp_core_switch_dec_fx(
move16();
}
- i = NS2SA_fx2( st_fx->output_Fs, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS );
+ i = NS2SA_FX2( st_fx->output_Fs, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS );
move16();
Copy( st_fx->old_synth_sw_fx, hb_synth_tmp, i );
- set16_fx( hb_synth_tmp + i, 0, NS2SA_fx2( st_fx->output_Fs, 10000000L ) - i );
+ set16_fx( hb_synth_tmp + i, 0, NS2SA_FX2( st_fx->output_Fs, 10000000L ) - i );
fir_fx( hb_synth_tmp, hp_filter, hb_synth_tmp, tmp_mem2, shr( output_frame, 1 ), fdelay, 1, 0 );
set16_fx( tmp_synth_bwe, 0, SWITCH_MAX_GAP );
diff --git a/lib_dec/amr_wb_dec_fx.c b/lib_dec/amr_wb_dec_fx.c
index b5d194c6dbcc4f4f127b833cfb7355eee9ac1167..132322c061d529d101f9cf96e888c6eab3039816 100644
--- a/lib_dec/amr_wb_dec_fx.c
+++ b/lib_dec/amr_wb_dec_fx.c
@@ -1014,7 +1014,7 @@ ivas_error amr_wb_dec_fx(
}
}
- delay_comp = NS2SA_fx2( st_fx->output_Fs, DELAY_CLDFB_NS );
+ delay_comp = NS2SA_FX2( st_fx->output_Fs, DELAY_CLDFB_NS );
Scale_sig( st_fx->delay_buf_out_fx, delay_comp, sub( st_fx->Q_syn2, hHQ_core->Q_old_postdec ) );
hHQ_core->Q_old_postdec = st_fx->Q_syn2;
move16();
@@ -1030,8 +1030,8 @@ ivas_error amr_wb_dec_fx(
i = 15;
move16();
- tmps = NS2SA_fx2( st_fx->output_Fs, 6000000L );
- nz = NS2SA_fx2( st_fx->output_Fs, N_ZERO_MDCT_NS );
+ tmps = NS2SA_FX2( st_fx->output_Fs, 6000000L );
+ nz = NS2SA_FX2( st_fx->output_Fs, N_ZERO_MDCT_NS );
step = Inv16( tmps, &i );
step = shl( step, i );
alpha = 0;
@@ -1063,7 +1063,7 @@ ivas_error amr_wb_dec_fx(
/* Delay ACELP synthesis by DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS delay */
IF( GE_16( output_frame, L_FRAME16k ) )
{
- tmps = NS2SA_fx2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS );
+ tmps = NS2SA_FX2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS );
Scale_sig( st_fx->prev_synth_buffer_fx, tmps, sub( st_fx->Q_syn2, st_fx->Qprev_synth_buffer_fx ) );
delay_signal( synth_out_fx, output_frame, st_fx->prev_synth_buffer_fx, tmps );
}
@@ -1074,7 +1074,7 @@ ivas_error amr_wb_dec_fx(
move16();
IF( GE_16( output_frame, L_FRAME16k ) )
{
- tmps = NS2SA_fx2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS );
+ tmps = NS2SA_FX2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS );
move16();
}
@@ -1090,11 +1090,11 @@ ivas_error amr_wb_dec_fx(
hp20( synth_out_fx, 1 /*stride*/, output_frame, st_fx->L_mem_hp_out_fx, L_mult0( output_frame, 50 ) );
/* save synthesis for core switching */
- Copy_Scale_sig( synth_out_fx + NS2SA_fx2( st_fx->output_Fs, ACELP_LOOK_NS + DELAY_BWE_TOTAL_NS ), st_fx->old_synth_sw_fx, NS2SA_fx2( st_fx->output_Fs, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS ), sub( hHQ_core->Q_old_postdec, st_fx->Q_syn2 ) );
+ Copy_Scale_sig( synth_out_fx + NS2SA_FX2( st_fx->output_Fs, ACELP_LOOK_NS + DELAY_BWE_TOTAL_NS ), st_fx->old_synth_sw_fx, NS2SA_FX2( st_fx->output_Fs, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS ), sub( hHQ_core->Q_old_postdec, st_fx->Q_syn2 ) );
{
/* TCX-LTP Postfilter: used in AMR-WB IO to update memories and to avoid discontinuities when the past frame was TCX */
- Word16 delta = NS2SA_fx2( st_fx->output_Fs, TCXLTP_DELAY_NS );
+ Word16 delta = NS2SA_FX2( st_fx->output_Fs, TCXLTP_DELAY_NS );
move16();
Scale_sig( hTcxLtpDec->tcxltp_mem_in, delta, sub( st_fx->Q_syn2, st_fx->Qprev_synth_buffer_fx ) );
Scale_sig( hTcxLtpDec->tcxltp_mem_out, output_frame, sub( st_fx->Q_syn2, st_fx->Qprev_synth_buffer_fx ) );
diff --git a/lib_dec/bass_psfilter.c b/lib_dec/bass_psfilter.c
index 63e304417487c1c270e297c350d122e1cc935c32..5572077146782ef9b9b02586907b12fdcd04a752 100644
--- a/lib_dec/bass_psfilter.c
+++ b/lib_dec/bass_psfilter.c
@@ -47,7 +47,7 @@
#include "wmc_auto.h"
#ifdef IVAS_FLOAT_FIXED
#include "ivas_prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
+#endif
/*---------------------------------------------------------------------*
* Local constants
diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c
index 960ef827d928e779f6a4cc90ba941acd834e2d4d..bcee307664768221f77306e7761ef9a954bb0b91 100644
--- a/lib_dec/core_dec_init_fx.c
+++ b/lib_dec/core_dec_init_fx.c
@@ -450,9 +450,9 @@ void open_decoder_LPD_fx(
W2 = shr( st->hTcxCfg->tcx_mdct_window_lengthFB, 1 );
w = st->hTcxCfg->tcx_mdct_windowFB; /*pointer - no need to instrument*/
- nz = NS2SA_fx2( st->output_Fs, N_ZERO_MDCT_NS );
+ nz = NS2SA_FX2( st->output_Fs, N_ZERO_MDCT_NS );
move16();
- delay_comp = NS2SA_fx2( st->output_Fs, DELAY_CLDFB_NS ); /*CLDFB delay*/
+ delay_comp = NS2SA_FX2( st->output_Fs, DELAY_CLDFB_NS ); /*CLDFB delay*/
move16();
Copy( hHQ_core->fer_samples_fx + delay_comp, hTcxDec->syn_OverlFB, shr( hTcxDec->L_frameTCX, 1 ) );
@@ -480,7 +480,7 @@ void open_decoder_LPD_fx(
lerp( hHQ_core->old_out_fx, hHQ_core->old_out_LB_fx, st->L_frame, hTcxDec->L_frameTCX );
Copy( hHQ_core->old_out_fx + nz, hTcxDec->syn_Overl_TDACFB, shr( hTcxDec->L_frameTCX, 1 ) );
- nz = NS2SA_fx2( st->sr_core, N_ZERO_MDCT_NS );
+ nz = NS2SA_FX2( st->sr_core, N_ZERO_MDCT_NS );
move16();
Copy( hHQ_core->old_out_LB_fx + nz, hTcxDec->syn_Overl_TDAC, shr( st->L_frame, 1 ) );
hHQ_core->Q_old_wtda_LB = hHQ_core->Q_old_wtda;
@@ -1170,9 +1170,9 @@ void acelp_plc_mdct_transition_fx(
W2 = shr( st->hTcxCfg->tcx_mdct_window_lengthFB, 1 );
w = st->hTcxCfg->tcx_mdct_windowFB; /*pointer - no need to instrument*/
- nz = NS2SA_fx2( st->output_Fs, N_ZERO_MDCT_NS );
+ nz = NS2SA_FX2( st->output_Fs, N_ZERO_MDCT_NS );
move16();
- delay_comp = NS2SA_fx2( st->output_Fs, DELAY_CLDFB_NS );
+ delay_comp = NS2SA_FX2( st->output_Fs, DELAY_CLDFB_NS );
move16(); /*CLDFB delay*/
Copy( st->hHQ_core->fer_samples_fx + delay_comp, st->hTcxDec->syn_OverlFB, shr( st->hTcxDec->L_frameTCX, 1 ) );
diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c
index b6f6f7276f13fb2068e6199e348b9a2ed88af1ad..a0e74feb6197e4de132a2888af4ff893a57c52af 100644
--- a/lib_dec/core_switching_dec_fx.c
+++ b/lib_dec/core_switching_dec_fx.c
@@ -542,11 +542,11 @@ ivas_error core_switching_pre_dec_fx(
/* reset old HB synthesis buffer */
IF( EQ_16( st_fx->last_L_frame, L_FRAME ) )
{
- st_fx->old_bwe_delay = NS2SA_fx2( st_fx->output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_12k8_NS );
+ st_fx->old_bwe_delay = NS2SA_FX2( st_fx->output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_12k8_NS );
}
ELSE
{
- st_fx->old_bwe_delay = NS2SA_fx2( st_fx->output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_16k_NS );
+ st_fx->old_bwe_delay = NS2SA_FX2( st_fx->output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_16k_NS );
}
set16_fx( st_fx->hb_prev_synth_buffer_fx, 0, NS2SA( 48000, DELAY_BWE_TOTAL_NS ) );
@@ -639,7 +639,7 @@ ivas_error core_switching_pre_dec_fx(
move16();
}
- delay_comp = NS2SA_fx2( st_fx->output_Fs, DELAY_CLDFB_NS );
+ delay_comp = NS2SA_FX2( st_fx->output_Fs, DELAY_CLDFB_NS );
IF( !st_fx->last_con_tcx && st_fx->last_core_bfi == ACELP_CORE && EQ_16( st_fx->core, HQ_CORE ) )
{
diff --git a/lib_dec/dec_LPD_fx.c b/lib_dec/dec_LPD_fx.c
index 3b840fc5e735bcf6509e29a36cc11bbdb577ded8..c870b04a03b7973ab10ad57106a8d3891f6d1091 100644
--- a/lib_dec/dec_LPD_fx.c
+++ b/lib_dec/dec_LPD_fx.c
@@ -894,9 +894,9 @@ void decoder_LPD_fx(
/* Update */
Copy( synth_buf + L_frame, hTcxDec->old_synth, hTcxDec->old_synth_len );
- Copy( hTcxDec->old_synthFB_fx + L_frameTCX - NS2SA_fx2( st->output_Fs, PH_ECU_MEM_NS ), hTcxDec->synth_history_fx, NS2SA_fx2( st->output_Fs, PH_ECU_MEM_NS ) );
+ Copy( hTcxDec->old_synthFB_fx + L_frameTCX - NS2SA_FX2( st->output_Fs, PH_ECU_MEM_NS ), hTcxDec->synth_history_fx, NS2SA_FX2( st->output_Fs, PH_ECU_MEM_NS ) );
Copy( synth_bufFB + L_frameTCX, hTcxDec->old_synthFB_fx, hTcxDec->old_synth_lenFB );
- Copy_Scale_sig( st->hHQ_core->old_out_fx + NS2SA_fx2( st->output_Fs, N_ZERO_MDCT_NS ), hTcxDec->old_synthFB_fx + hTcxDec->old_synth_lenFB, NS2SA_fx2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ), negate( st->hHQ_core->Q_old_wtda ) );
+ Copy_Scale_sig( st->hHQ_core->old_out_fx + NS2SA_FX2( st->output_Fs, N_ZERO_MDCT_NS ), hTcxDec->old_synthFB_fx + hTcxDec->old_synth_lenFB, NS2SA_FX2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ), negate( st->hHQ_core->Q_old_wtda ) );
Copy( &xspnew_uw[imult1616( sub( st->numlpc, 1 ), M )], st->lspold_uw, M );
Copy( &xsfnew_uw[imult1616( sub( st->numlpc, 1 ), M )], st->lsfold_uw, M );
diff --git a/lib_dec/dec_gen_voic_fx.c b/lib_dec/dec_gen_voic_fx.c
index 23363dd6727fda2c046f090ebf96a31f8f6cf240..b8d17a1e3938937c3c0ab77da7b78feaf47b2a37 100644
--- a/lib_dec/dec_gen_voic_fx.c
+++ b/lib_dec/dec_gen_voic_fx.c
@@ -486,8 +486,8 @@ ivas_error decod_gen_voic_fx(
interp_code_4over2_fx( exc_fx + i_subfr_fx, bwe_exc_fx + shl( i_subfr_fx, 1 ), L_SUBFR );
}
- count_free( PREVP );
- count_free( CURRP );
+ free( PREVP );
+ free( CURRP );
}
}
@@ -985,8 +985,8 @@ ivas_error decod_gen_voic_ivas_fx(
interp_code_4over2_fx( exc_fx + i_subfr_fx, bwe_exc_fx + ( i_subfr_fx * 2 ), L_SUBFR );
}
- count_free( PREVP );
- count_free( CURRP );
+ free( PREVP );
+ free( CURRP );
}
}
diff --git a/lib_dec/dec_higher_acelp.c b/lib_dec/dec_higher_acelp.c
index 962bbc686747e3968b608b719ea5981b07f176eb..d3d0876fda3cd9a5ef71c2fb13566273494b87b8 100644
--- a/lib_dec/dec_higher_acelp.c
+++ b/lib_dec/dec_higher_acelp.c
@@ -43,7 +43,7 @@
#include "wmc_auto.h"
#ifdef IVAS_FLOAT_FIXED
#include "prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
+#endif
/*-----------------------------------------------------------------*
* transf_cdbk_dec()
diff --git a/lib_dec/dec_higher_acelp_fx.c b/lib_dec/dec_higher_acelp_fx.c
index fb32be0d4f47549f7196b6af3922e0b363405509..042a69b3abefdda66e966b73870bff26c296bca0 100644
--- a/lib_dec/dec_higher_acelp_fx.c
+++ b/lib_dec/dec_higher_acelp_fx.c
@@ -218,7 +218,7 @@ void transf_cdbk_dec_fx(
st_fx->last_code_preq = extract_h( code_preQ[L_SUBFR - 1] );
move16();
#endif
- preemph_fx( code_preQ, FAC_PRE_AVQ_FX, L_SUBFR, &st_fx->mem_preemp_preQ_fx );
+ PREEMPH_FX( code_preQ, FAC_PRE_AVQ_FX, L_SUBFR, &st_fx->mem_preemp_preQ_fx );
/*--------------------------------------------------------------*
* Compute normalized prequantizer excitation gain for FEC
*
diff --git a/lib_dec/dec_post_fx.c b/lib_dec/dec_post_fx.c
index a8580c8ce001282d59201985c57c58a938dc661c..7826cabc4c51120e5b984efb58ad72b3acf19d50 100644
--- a/lib_dec/dec_post_fx.c
+++ b/lib_dec/dec_post_fx.c
@@ -1070,7 +1070,7 @@ static void search_del_fx(
move32();
ptr_L_den0 = L_den0;
ptr_L_den1 = L_den1;
- ptr_h = Tab_hup_s;
+ ptr_h = tab_hup_s_fx;
temp = sub( lambda, LH_UP_S - 1 );
ptr_sig_past0 = ptr_sig_in - temp;
@@ -1420,7 +1420,7 @@ static void compute_ltp_l_fx(
temp = sub( phase, 1 );
temp = shl( temp, L2_LH2_L );
- ptr_h = Tab_hup_l + temp; /* Tab_hup_l + LH2_L * (phase-1) */
+ ptr_h = tab_hup_l_fx + temp; /* tab_hup_l_fx + LH2_L * (phase-1) */
temp = sub( LH_UP_L, ltpdel );
ptr2 = s_in + temp;
diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c
index 64008b42436d3f4d9eb8ad78a2a408ba9fb65ae2..11af1d430e9a4dc40bc252b7ffa8ce48f0c45df7 100644
--- a/lib_dec/dec_tcx.c
+++ b/lib_dec/dec_tcx.c
@@ -46,9 +46,9 @@
#include "wmc_auto.h"
#include "ivas_rom_com.h"
#include "ivas_prot_fx.h"
-#ifndef IVAS_FLOAT_FIXED_UNIT_TESTING
+//#ifndef IVAS_FLOAT_FIXED_UNIT_TESTING
#include "debug.h"
-#endif // !IVAS_FLOAT_FIXED_UNIT_TESTING
+//#endif
#ifndef IVAS_FLOAT_FIXED
/*-----------------------------------------------------------------*
diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c
index 6d280edbbbfece65810fcaf8bb705ec011f196c9..870299242a97fd0c27dcb1ded0d2512785505399 100644
--- a/lib_dec/dec_tcx_fx.c
+++ b/lib_dec/dec_tcx_fx.c
@@ -2015,7 +2015,7 @@ void IMDCT_fx( Word32 *x, Word16 x_e, Word16 *old_syn_overl, Word16 *syn_Overl_T
{
tmp32 = L_add( st->output_Fs, 0 );
}
- nz = NS2SA_fx2( tmp32, N_ZERO_MDCT_NS );
+ nz = NS2SA_FX2( tmp32, N_ZERO_MDCT_NS );
tmp_offset = 0;
move16();
diff --git a/lib_dec/evs_dec_fx.c b/lib_dec/evs_dec_fx.c
index ee9bc103ce190190f4066605488d3b88e88a00d9..ba94c988a1b4fef895855f96612d021830f7e542 100644
--- a/lib_dec/evs_dec_fx.c
+++ b/lib_dec/evs_dec_fx.c
@@ -532,7 +532,7 @@ ivas_error evs_dec_fx(
IF( GE_16( output_frame, L_FRAME16k ) )
{
- tmps = NS2SA_fx2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS );
+ tmps = NS2SA_FX2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS );
exp = s_min( Qpostd, st_fx->Qprev_synth_buffer_fx );
Scale_sig( synth_fx, output_frame, sub( exp, Qpostd ) );
@@ -570,7 +570,7 @@ ivas_error evs_dec_fx(
move16();
IF( GE_16( output_frame, L_FRAME16k ) )
{
- tmps = NS2SA_fx2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS );
+ tmps = NS2SA_FX2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS );
}
waveform_adj2_fix( st_fx->tonalMDCTconceal.secondLastPcmOut,
@@ -602,7 +602,7 @@ ivas_error evs_dec_fx(
IF( EQ_16( st_fx->L_frame, L_FRAME ) )
{
/* TBE on top of ACELP@12.8kHz */
- tmps = NS2SA_fx2( st_fx->output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_12k8_NS );
+ tmps = NS2SA_FX2( st_fx->output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_12k8_NS );
}
ELSE
{
@@ -610,12 +610,12 @@ ivas_error evs_dec_fx(
IF( EQ_16( st_fx->extl, SWB_BWE_HIGHRATE ) || EQ_16( st_fx->extl, FB_BWE_HIGHRATE ) )
{
/* HR SWB BWE on top of ACELP@16kHz */
- tmps = NS2SA_fx2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS );
+ tmps = NS2SA_FX2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS );
}
ELSE
{
/* TBE on top of ACELP@16kHz */
- tmps = NS2SA_fx2( st_fx->output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_16k_NS );
+ tmps = NS2SA_FX2( st_fx->output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_16k_NS );
}
}
@@ -766,7 +766,7 @@ ivas_error evs_dec_fx(
move16();
/* TCX-LTP Postfilter: used in MODE1 to update memories and to avoid discontinuities when the past frame was TCX */
- delta = NS2SA_fx2( st_fx->output_Fs, TCXLTP_DELAY_NS );
+ delta = NS2SA_FX2( st_fx->output_Fs, TCXLTP_DELAY_NS );
Scale_sig( hTcxLtpDec->tcxltp_mem_in, delta, sub( Qpostd, Qpostd_prev ) );
Scale_sig( hTcxLtpDec->tcxltp_mem_out, output_frame, sub( Qpostd, Qpostd_prev ) );
tcx_ltp_post( st_fx, hTcxLtpDec, ACELP_CORE, output_frame, 0, synth_fx, NULL );
@@ -1175,11 +1175,11 @@ ivas_error evs_dec_fx(
/*CLDFB output always in timeIn_e*/
/* MODE1 MDCT to ACELP 2 transition */
- delay_comp = NS2SA_fx2( st_fx->output_Fs, DELAY_CLDFB_NS );
+ delay_comp = NS2SA_FX2( st_fx->output_Fs, DELAY_CLDFB_NS );
Scale_sig( st_fx->delay_buf_out_fx, delay_comp, negate( hHQ_core->Q_old_postdec ) );
hHQ_core->Q_old_postdec = 0;
move16();
- delay_tdbwe = NS2SA_fx2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS );
+ delay_tdbwe = NS2SA_FX2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS );
IF( GE_16( output_frame, L_FRAME16k ) )
{
Scale_sig( st_fx->prev_synth_buffer_fx, delay_tdbwe, sub( Qpostd, st_fx->Qprev_synth_buffer_fx ) );
@@ -1195,8 +1195,8 @@ ivas_error evs_dec_fx(
i = 15;
move16();
- tmps = NS2SA_fx2( st_fx->output_Fs, 3000000L );
- nz = NS2SA_fx2( st_fx->output_Fs, N_ZERO_MDCT_NS );
+ tmps = NS2SA_FX2( st_fx->output_Fs, 3000000L );
+ nz = NS2SA_FX2( st_fx->output_Fs, N_ZERO_MDCT_NS );
step = Inv16( tmps, &i );
step = shl( step, i );
alpha = 0;
@@ -1308,13 +1308,13 @@ ivas_error evs_dec_fx(
IF( EQ_32( st_fx->output_Fs, 8000 ) )
{
- tmps = NS2SA_fx2( st_fx->output_Fs, DELAY_CLDFB_NS );
+ tmps = NS2SA_FX2( st_fx->output_Fs, DELAY_CLDFB_NS );
}
ELSE
{
- tmps = NS2SA_fx2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS );
+ tmps = NS2SA_FX2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS );
}
- delta = NS2SA_fx2( st_fx->output_Fs, TCXLTP_DELAY_NS );
+ delta = NS2SA_FX2( st_fx->output_Fs, TCXLTP_DELAY_NS );
test();
test();
@@ -1404,7 +1404,7 @@ ivas_error evs_dec_fx(
Scale_sig( output_sp, output_frame, timeIn_e );
- tcx_ltp_post( st_fx, hTcxLtpDec, st_fx->core, output_frame /*hTcxDec->L_frameTCX*/, NS2SA_fx2( st_fx->output_Fs, ACELP_LOOK_NS ) + tmps,
+ tcx_ltp_post( st_fx, hTcxLtpDec, st_fx->core, output_frame /*hTcxDec->L_frameTCX*/, NS2SA_FX2( st_fx->output_Fs, ACELP_LOOK_NS ) + tmps,
output_sp, hTcxDec->FBTCXdelayBuf );
Copy( output_sp, synth_fx, output_frame );
@@ -1415,11 +1415,11 @@ ivas_error evs_dec_fx(
* Save synthesis for HQ FEC
*----------------------------------------------------------------*/
// PMT("The code below could be move to save_synthesis_hq_fec")
- post_hq_delay = NS2SA_fx2( st_fx->output_Fs, POST_HQ_DELAY_NS );
+ post_hq_delay = NS2SA_FX2( st_fx->output_Fs, POST_HQ_DELAY_NS );
IF( EQ_16( st_fx->codec_mode, MODE1 ) )
{
- Copy( hTcxDec->synth_history_fx + output_frame, hTcxDec->synth_history_fx, add( sub( output_frame, post_hq_delay ), NS2SA_fx2( st_fx->output_Fs, PH_ECU_MEM_NS ) ) );
+ Copy( hTcxDec->synth_history_fx + output_frame, hTcxDec->synth_history_fx, add( sub( output_frame, post_hq_delay ), NS2SA_FX2( st_fx->output_Fs, PH_ECU_MEM_NS ) ) );
Copy_Scale_sig( synth_fx, hTcxDec->old_synthFB_fx + sub( output_frame, post_hq_delay ), output_frame, negate( Qpostd ) ); /* output_sp not initialized yet */
/* reset the remaining buffer, which is read in TCX concealment the necessary samples to fill
this buffer are not available for all cases, the impact on the output is limited */
@@ -1427,20 +1427,20 @@ ivas_error evs_dec_fx(
IF( GE_16( output_frame, L_FRAME16k ) )
{
- Copy_Scale_sig( st_fx->prev_synth_buffer_fx, hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_fx2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS ) ), NS2SA_fx2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ), negate( st_fx->Qprev_synth_buffer_fx ) );
+ Copy_Scale_sig( st_fx->prev_synth_buffer_fx, hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_FX2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS ) ), NS2SA_FX2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ), negate( st_fx->Qprev_synth_buffer_fx ) );
}
IF( NE_16( st_fx->core, ACELP_CORE ) )
{
IF( GE_16( output_frame, L_FRAME16k ) )
{
- Copy_Scale_sig( synth_fx + output_frame, hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_fx2( st_fx->output_Fs, DELAY_CLDFB_NS ) ), NS2SA_fx2( st_fx->output_Fs, DELAY_CLDFB_NS ), negate( Qpostd ) );
- Copy_Scale_sig( hHQ_core->old_out_fx + NS2SA_fx2( st_fx->output_Fs, N_ZERO_MDCT_NS ), hTcxDec->old_synthFB_fx + shl( output_frame, 1 ), NS2SA_fx2( st_fx->output_Fs, PH_ECU_LOOKAHEAD_NS ), negate( hHQ_core->Q_old_wtda ) );
+ Copy_Scale_sig( synth_fx + output_frame, hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_FX2( st_fx->output_Fs, DELAY_CLDFB_NS ) ), NS2SA_FX2( st_fx->output_Fs, DELAY_CLDFB_NS ), negate( Qpostd ) );
+ Copy_Scale_sig( hHQ_core->old_out_fx + NS2SA_FX2( st_fx->output_Fs, N_ZERO_MDCT_NS ), hTcxDec->old_synthFB_fx + shl( output_frame, 1 ), NS2SA_FX2( st_fx->output_Fs, PH_ECU_LOOKAHEAD_NS ), negate( hHQ_core->Q_old_wtda ) );
}
ELSE
{
- Copy_Scale_sig( synth_fx + output_frame, hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_fx2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS ) ), NS2SA_fx2( st_fx->output_Fs, DELAY_CLDFB_NS ), negate( Qpostd ) );
- Copy_Scale_sig( hHQ_core->old_out_fx + NS2SA_fx2( st_fx->output_Fs, N_ZERO_MDCT_NS ), hTcxDec->old_synthFB_fx + shl( output_frame, 1 ) - NS2SA_fx2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ), NS2SA_fx2( st_fx->output_Fs, PH_ECU_LOOKAHEAD_NS ), negate( hHQ_core->Q_old_wtda ) );
+ Copy_Scale_sig( synth_fx + output_frame, hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_FX2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS ) ), NS2SA_FX2( st_fx->output_Fs, DELAY_CLDFB_NS ), negate( Qpostd ) );
+ Copy_Scale_sig( hHQ_core->old_out_fx + NS2SA_FX2( st_fx->output_Fs, N_ZERO_MDCT_NS ), hTcxDec->old_synthFB_fx + shl( output_frame, 1 ) - NS2SA_FX2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ), NS2SA_FX2( st_fx->output_Fs, PH_ECU_LOOKAHEAD_NS ), negate( hHQ_core->Q_old_wtda ) );
}
}
}
diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c
index a50653526725ba497e07fbefcf706dab953f863f..54c251e2123eca4d588309433868ddacb0e2dac4 100644
--- a/lib_dec/fd_cng_dec_fx.c
+++ b/lib_dec/fd_cng_dec_fx.c
@@ -51,7 +51,7 @@ ivas_error createFdCngDec_fx( HANDLE_FD_CNG_DEC *hFdCngDec )
error = IVAS_ERR_OK;
/* Allocate memory */
- hs = (HANDLE_FD_CNG_DEC) count_malloc( sizeof( FD_CNG_DEC ) );
+ hs = (HANDLE_FD_CNG_DEC) malloc( sizeof( FD_CNG_DEC ) );
IF( hs == NULL )
{
@@ -544,7 +544,7 @@ void deleteFdCngDec_fx( HANDLE_FD_CNG_DEC *hFdCngDec )
IF( hsDec != NULL )
{
deleteFdCngCom( &( hsDec->hFdCngCom ) );
- count_free( hsDec );
+ free( hsDec );
*hFdCngDec = NULL;
}
}
diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c
index b8a7e4dd429ef9459cb4d4465acc6fcd221757a1..bde72c4a35cb7a62306ae1f50574d49e22d1d5d8 100644
--- a/lib_dec/hq_core_dec_fx.c
+++ b/lib_dec/hq_core_dec_fx.c
@@ -196,7 +196,7 @@ void hq_core_dec_fx(
IF( GE_16( output_frame, L_FRAME16k ) )
{
/* keep st->previoussynth updated as in FEC_HQ_pitch_analysis but no LP analysis */
- delay_comp = NS2SA_fx2( st_fx->output_Fs, DELAY_CLDFB_NS );
+ delay_comp = NS2SA_FX2( st_fx->output_Fs, DELAY_CLDFB_NS );
Copy( st_fx->previoussynth_fx + delay_comp, st_fx->previoussynth_fx, sub( output_frame, delay_comp ) );
Copy( st_fx->delay_buf_out_fx, st_fx->previoussynth_fx + output_frame - delay_comp, delay_comp );
@@ -781,7 +781,7 @@ void ivas_hq_core_dec_fx(
IF( GE_16( output_frame, L_FRAME16k ) )
{
/* keep st->previoussynth updated as in FEC_HQ_pitch_analysis but no LP analysis */
- delay_comp = NS2SA_fx2( st_fx->output_Fs, DELAY_CLDFB_NS );
+ delay_comp = NS2SA_FX2( st_fx->output_Fs, DELAY_CLDFB_NS );
Copy( st_fx->previoussynth_fx + delay_comp, st_fx->previoussynth_fx, sub( output_frame, delay_comp ) );
Copy( st_fx->delay_buf_out_fx, st_fx->previoussynth_fx + output_frame - delay_comp, delay_comp );
diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c
index 05cda5a462822b22c9dfaac3233946b827832b4e..bed5c11bb8b4f6d2901b06cf656b184b61575a0b 100644
--- a/lib_dec/init_dec_fx.c
+++ b/lib_dec/init_dec_fx.c
@@ -131,7 +131,7 @@ ivas_error init_decoder_fx(
test();
IF( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) )
{
- IF( ( st_fx->hBWE_FD = (FD_BWE_DEC_HANDLE) count_malloc( sizeof( FD_BWE_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hBWE_FD = (FD_BWE_DEC_HANDLE) malloc( sizeof( FD_BWE_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FD BWE\n" ) );
}
@@ -150,7 +150,7 @@ ivas_error init_decoder_fx(
test();
IF( idchan == 0 || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) )
{
- IF( ( st_fx->hIGFDec = (IGF_DEC_INSTANCE_HANDLE) count_malloc( sizeof( IGFDEC_INSTANCE ) ) ) == NULL )
+ IF( ( st_fx->hIGFDec = (IGF_DEC_INSTANCE_HANDLE) malloc( sizeof( IGFDEC_INSTANCE ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for IGF\n" ) );
}
@@ -170,7 +170,7 @@ ivas_error init_decoder_fx(
IF( EQ_16( st_fx->element_mode, EVS_MONO ) )
{
- IF( ( st_fx->hBWE_FD_HR = (HR_BWE_DEC_HANDLE) count_malloc( sizeof( HR_BWE_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hBWE_FD_HR = (HR_BWE_DEC_HANDLE) malloc( sizeof( HR_BWE_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HR BWE\n" ) );
}
@@ -210,7 +210,7 @@ ivas_error init_decoder_fx(
test();
IF( ( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) )
{
- IF( ( st_fx->hGSCDec = (GSC_DEC_HANDLE) count_malloc( sizeof( GSC_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hGSCDec = (GSC_DEC_HANDLE) malloc( sizeof( GSC_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for GSC\n" ) );
}
@@ -228,7 +228,7 @@ ivas_error init_decoder_fx(
test();
IF( EQ_32( st_fx->output_Fs, 16000 ) && ( st_fx->element_mode == EVS_MONO ) )
{
- IF( ( st_fx->hWIDec = (WI_DEC_HANDLE) count_malloc( sizeof( WI_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hWIDec = (WI_DEC_HANDLE) malloc( sizeof( WI_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FEC WI\n" ) );
}
@@ -249,7 +249,7 @@ ivas_error init_decoder_fx(
test();
IF( ( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) )
{
- IF( ( st_fx->hPFstat = (PFSTAT_HANDLE) count_malloc( sizeof( PFSTAT ) ) ) == NULL )
+ IF( ( st_fx->hPFstat = (PFSTAT_HANDLE) malloc( sizeof( PFSTAT ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for NB/formant postflter\n" ) );
}
@@ -337,7 +337,7 @@ ivas_error init_decoder_fx(
test();
IF( ( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) )
{
- IF( ( st_fx->hMusicPF = (MUSIC_POSTFILT_HANDLE) count_malloc( sizeof( MUSIC_POSTFILT_DATA ) ) ) == NULL )
+ IF( ( st_fx->hMusicPF = (MUSIC_POSTFILT_HANDLE) malloc( sizeof( MUSIC_POSTFILT_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LD music postflter\n" ) );
}
@@ -355,7 +355,7 @@ ivas_error init_decoder_fx(
test();
IF( idchan == 0 && ( ( st_fx->element_mode == EVS_MONO ) || EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) )
{
- IF( ( st_fx->hTdCngDec = (TD_CNG_DEC_HANDLE) count_malloc( sizeof( TD_CNG_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hTdCngDec = (TD_CNG_DEC_HANDLE) malloc( sizeof( TD_CNG_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DTX/TD CNG\n" ) );
}
@@ -432,7 +432,7 @@ ivas_error init_decoder_fx(
test();
IF( ( idchan == 0 || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) || EQ_16( st_fx->element_mode, IVAS_SCE ) || ( st_fx->element_mode == EVS_MONO ) ) )
{
- IF( ( st_fx->hHQ_core = (HQ_DEC_HANDLE) count_malloc( sizeof( HQ_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hHQ_core = (HQ_DEC_HANDLE) malloc( sizeof( HQ_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HQ core\n" ) );
}
@@ -443,7 +443,7 @@ ivas_error init_decoder_fx(
IF( st_fx->element_mode == EVS_MONO )
{
/* HQ NB FEC initialization */
- IF( ( st_fx->hHQ_nbfec = (HQ_NBFEC_HANDLE) count_malloc( sizeof( HQ_NBFEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hHQ_nbfec = (HQ_NBFEC_HANDLE) malloc( sizeof( HQ_NBFEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HQ NB FEC\n" ) );
}
@@ -481,7 +481,7 @@ ivas_error init_decoder_fx(
/* TCX-LTP */
IF( ( idchan == 0 || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) )
{
- IF( ( st_fx->hTcxLtpDec = (TCX_LTP_DEC_HANDLE) count_malloc( sizeof( TCX_LTP_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hTcxLtpDec = (TCX_LTP_DEC_HANDLE) malloc( sizeof( TCX_LTP_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TCX-LTP handle\n" ) );
}
@@ -495,7 +495,7 @@ ivas_error init_decoder_fx(
// VE: reduction possible for MCT_CHAN_MODE_LFE channel - see I1-172
IF( idchan == 0 || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) )
{
- IF( ( st_fx->hTcxDec = (TCX_DEC_HANDLE) count_malloc( sizeof( TCX_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hTcxDec = (TCX_DEC_HANDLE) malloc( sizeof( TCX_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hTcxDec\n" ) );
}
@@ -512,7 +512,7 @@ ivas_error init_decoder_fx(
/* TCX config. data structure */
IF( idchan == 0 || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) )
{
- IF( ( st_fx->hTcxCfg = (TCX_CONFIG_HANDLE) count_malloc( sizeof( TCX_config ) ) ) == NULL )
+ IF( ( st_fx->hTcxCfg = (TCX_CONFIG_HANDLE) malloc( sizeof( TCX_config ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hTcxCfg\n" ) );
}
@@ -528,8 +528,8 @@ ivas_error init_decoder_fx(
st_fx->tilt_wb_fx = 0;
move16();
- set16_fx( st_fx->prev_synth_buffer_fx, 0, NS2SA_fx2( 48000, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ) );
- set16_fx( st_fx->hb_prev_synth_buffer_fx, 0, NS2SA_fx2( 48000, DELAY_BWE_TOTAL_NS ) );
+ set16_fx( st_fx->prev_synth_buffer_fx, 0, NS2SA_FX2( 48000, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ) );
+ set16_fx( st_fx->hb_prev_synth_buffer_fx, 0, NS2SA_FX2( 48000, DELAY_BWE_TOTAL_NS ) );
st_fx->old_bwe_delay = -1; /*Q0*/
move16();
@@ -540,7 +540,7 @@ ivas_error init_decoder_fx(
test();
IF( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) )
{
- IF( ( st_fx->hBWE_TD = (TD_BWE_DEC_HANDLE) count_malloc( sizeof( TD_BWE_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hBWE_TD = (TD_BWE_DEC_HANDLE) malloc( sizeof( TD_BWE_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) );
}
@@ -627,7 +627,7 @@ ivas_error init_decoder_fx(
test();
IF( st_fx->Opt_AMR_WB || st_fx->element_mode == EVS_MONO )
{
- IF( ( st_fx->hAmrwb_IO = (AMRWB_IO_DEC_HANDLE) count_malloc( sizeof( AMRWB_IO_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hAmrwb_IO = (AMRWB_IO_DEC_HANDLE) malloc( sizeof( AMRWB_IO_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for AMR-WB IO\n" ) );
}
@@ -649,7 +649,7 @@ ivas_error init_decoder_fx(
test();
IF( ( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) )
{
- IF( ( st_fx->hBWE_zero = (ZERO_BWE_DEC_HANDLE) count_malloc( sizeof( ZERO_BWE_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hBWE_zero = (ZERO_BWE_DEC_HANDLE) malloc( sizeof( ZERO_BWE_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for zero BWE\n" ) );
}
@@ -676,7 +676,7 @@ ivas_error init_decoder_fx(
test();
IF( ( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) )
{
- IF( ( st_fx->hBPF = (BPF_DEC_HANDLE) count_malloc( sizeof( BPF_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hBPF = (BPF_DEC_HANDLE) malloc( sizeof( BPF_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for BPF\n" ) );
}
@@ -735,7 +735,7 @@ ivas_error init_decoder_fx(
IF( st_fx->element_mode == EVS_MONO )
{
- IF( ( st_fx->hSC_VBR = (SC_VBR_DEC_HANDLE) count_malloc( sizeof( SC_VBR_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hSC_VBR = (SC_VBR_DEC_HANDLE) malloc( sizeof( SC_VBR_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SC-VBR\n" ) );
}
@@ -1091,10 +1091,10 @@ ivas_error init_decoder_ivas_fx(
st_fx->last_voice_factor_fx = 0;
move16();
- set16_fx( st_fx->prev_synth_buffer_fx, 0, NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS ) );
+ set16_fx( st_fx->prev_synth_buffer_fx, 0, NS2SA_FX2( 48000, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS ) );
st_fx->Qprev_synth_buffer_fx = 15;
move16();
- set32_fx( st_fx->prev_synth_buffer32_fx, 0, NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS ) );
+ set32_fx( st_fx->prev_synth_buffer32_fx, 0, NS2SA_FX2( 48000, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS ) );
st_fx->old_bfi_cnt = 0;
move16();
@@ -1114,7 +1114,7 @@ ivas_error init_decoder_ivas_fx(
test();
IF( ( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) )
{
- IF( ( st_fx->hGSCDec = (GSC_DEC_HANDLE) count_malloc( sizeof( GSC_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hGSCDec = (GSC_DEC_HANDLE) malloc( sizeof( GSC_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for GSC\n" ) );
}
@@ -1133,7 +1133,7 @@ ivas_error init_decoder_ivas_fx(
test();
IF( EQ_32( st_fx->output_Fs, 16000 ) && ( st_fx->element_mode == EVS_MONO ) )
{
- IF( ( st_fx->hWIDec = (WI_DEC_HANDLE) count_malloc( sizeof( WI_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hWIDec = (WI_DEC_HANDLE) malloc( sizeof( WI_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FEC WI\n" ) );
}
@@ -1153,7 +1153,7 @@ ivas_error init_decoder_ivas_fx(
test();
IF( ( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) )
{
- IF( ( st_fx->hPFstat = (PFSTAT_HANDLE) count_malloc( sizeof( PFSTAT ) ) ) == NULL )
+ IF( ( st_fx->hPFstat = (PFSTAT_HANDLE) malloc( sizeof( PFSTAT ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for NB/formant postflter\n" ) );
}
@@ -1197,7 +1197,7 @@ ivas_error init_decoder_ivas_fx(
test();
IF( ( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) )
{
- IF( ( st_fx->hMusicPF = (MUSIC_POSTFILT_HANDLE) count_malloc( sizeof( MUSIC_POSTFILT_DATA ) ) ) == NULL )
+ IF( ( st_fx->hMusicPF = (MUSIC_POSTFILT_HANDLE) malloc( sizeof( MUSIC_POSTFILT_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LD music postflter\n" ) );
}
@@ -1231,7 +1231,7 @@ ivas_error init_decoder_ivas_fx(
test();
IF( idchan == 0 && ( EQ_16( st_fx->element_mode, EVS_MONO ) || EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) )
{
- IF( ( st_fx->hTdCngDec = (TD_CNG_DEC_HANDLE) count_malloc( sizeof( TD_CNG_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hTdCngDec = (TD_CNG_DEC_HANDLE) malloc( sizeof( TD_CNG_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DTX/TD CNG\n" ) );
}
@@ -1325,7 +1325,7 @@ ivas_error init_decoder_ivas_fx(
st_fx->old_bwe_delay = -1; /*Q0*/
move16();
- set16_fx( st_fx->hb_prev_synth_buffer_fx, 0, NS2SA_fx2( 48000, DELAY_BWE_TOTAL_NS ) );
+ set16_fx( st_fx->hb_prev_synth_buffer_fx, 0, NS2SA_FX2( 48000, DELAY_BWE_TOTAL_NS ) );
/*-----------------------------------------------------------------*
* SWB BWE parameters
@@ -1378,7 +1378,7 @@ ivas_error init_decoder_ivas_fx(
IF( ( st_fx->element_mode == EVS_MONO ) )
{
- IF( ( st_fx->hBWE_FD_HR = (HR_BWE_DEC_HANDLE) count_malloc( sizeof( HR_BWE_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hBWE_FD_HR = (HR_BWE_DEC_HANDLE) malloc( sizeof( HR_BWE_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HR BWE\n" ) );
}
@@ -1396,7 +1396,7 @@ ivas_error init_decoder_ivas_fx(
test();
IF( st_fx->Opt_AMR_WB || EQ_16( st_fx->element_mode, EVS_MONO ) )
{
- IF( ( st_fx->hAmrwb_IO = (AMRWB_IO_DEC_HANDLE) count_malloc( sizeof( AMRWB_IO_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hAmrwb_IO = (AMRWB_IO_DEC_HANDLE) malloc( sizeof( AMRWB_IO_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for AMR-WB IO\n" ) );
}
@@ -1532,7 +1532,7 @@ ivas_error init_decoder_ivas_fx(
IF( EQ_16( st_fx->element_mode, EVS_MONO ) )
{
- IF( ( st_fx->hSC_VBR = (SC_VBR_DEC_HANDLE) count_malloc( sizeof( SC_VBR_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hSC_VBR = (SC_VBR_DEC_HANDLE) malloc( sizeof( SC_VBR_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SC-VBR\n" ) );
}
@@ -1571,7 +1571,7 @@ ivas_error init_decoder_ivas_fx(
test();
IF( ( idchan == 0 || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) )
{
- IF( ( st_fx->hTcxLtpDec = (TCX_LTP_DEC_HANDLE) count_malloc( sizeof( TCX_LTP_DEC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hTcxLtpDec = (TCX_LTP_DEC_HANDLE) malloc( sizeof( TCX_LTP_DEC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TCX-LTP handle\n" ) );
}
@@ -1592,8 +1592,8 @@ ivas_error init_decoder_ivas_fx(
set32_fx( st_fx->hTcxDec->FBTCXdelayBuf_32, 0, 111 );
- st_fx->hTcxDec->old_synthFB_fx = st_fx->hTcxDec->synth_history_fx + NS2SA_fx2( st_fx->output_Fs, PH_ECU_MEM_NS );
- st_fx->hTcxDec->prev_good_synth_fx = st_fx->hTcxDec->old_synthFB_fx + NS2SA_fx2( st_fx->output_Fs, PH_ECU_LOOKAHEAD_NS );
+ st_fx->hTcxDec->old_synthFB_fx = st_fx->hTcxDec->synth_history_fx + NS2SA_FX2( st_fx->output_Fs, PH_ECU_MEM_NS );
+ st_fx->hTcxDec->prev_good_synth_fx = st_fx->hTcxDec->old_synthFB_fx + NS2SA_FX2( st_fx->output_Fs, PH_ECU_LOOKAHEAD_NS );
}
ELSE
{
@@ -1604,7 +1604,7 @@ ivas_error init_decoder_ivas_fx(
test();
IF( ( idchan == 0 || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) )
{
- IF( ( st_fx->hTcxCfg = (TCX_CONFIG_HANDLE) count_malloc( sizeof( TCX_config ) ) ) == NULL )
+ IF( ( st_fx->hTcxCfg = (TCX_CONFIG_HANDLE) malloc( sizeof( TCX_config ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hTcxCfg\n" ) );
}
diff --git a/lib_dec/ivas_agc_dec.c b/lib_dec/ivas_agc_dec.c
index 83a2147632fb5d79ff12e48b1103bc960402bad2..6296e6c12925bcc0f37788adca8cc4465c116013 100644
--- a/lib_dec/ivas_agc_dec.c
+++ b/lib_dec/ivas_agc_dec.c
@@ -31,13 +31,13 @@
*******************************************************************************************************/
#include
+#include
+#include
#include "options.h"
+#include "wmc_auto.h"
#ifndef IVAS_FLOAT_FIXED
#include "prot.h"
#include "ivas_prot.h"
-#include
-#include
-#include "wmc_auto.h"
/*-----------------------------------------------------------------------------------------*
diff --git a/lib_dec/ivas_agc_dec_fx.c b/lib_dec/ivas_agc_dec_fx.c
index 26aad59c178910ac2b7c85a4cf5935e7690e59ce..bd01d2f04d08f102b7ad32bbebbb52d9c8e41e07 100644
--- a/lib_dec/ivas_agc_dec_fx.c
+++ b/lib_dec/ivas_agc_dec_fx.c
@@ -108,7 +108,7 @@ ivas_error ivas_spar_agc_dec_open_fx(
}
output_frame = extract_l( Mpy_32_16_1( output_Fs, INV_FRAME_PER_SEC_Q15 ) );
- delay = NS2SA_fx2( output_Fs, ( IVAS_ENC_DELAY_NS + IVAS_DEC_DELAY_NS ) );
+ delay = NS2SA_FX2( output_Fs, ( IVAS_ENC_DELAY_NS + IVAS_DEC_DELAY_NS ) );
move16();
IF( ( hAgc->agc_com.winFunc_fx = (Word16 *) malloc( sizeof( Word16 ) * ( output_frame - delay ) ) ) == NULL )
diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c
index e3526f7f58eb12411ab887fa7fe9cd46b3a38dc2..b8fec2d9ed17267f587a2e8dda795a0e7b24e86f 100644
--- a/lib_dec/ivas_core_dec.c
+++ b/lib_dec/ivas_core_dec.c
@@ -816,12 +816,11 @@ ivas_error ivas_core_dec_fx(
#ifdef NONBE_MDCT_ST_DTX_SKIP_DEWHITENING_OF_NOISE_SHAPES_ON_SID_FRAMES
/* On first good active frame after frameloss undo the whitening of the bg noise shape */
IF( GT_32( sts[0]->core_brate, SID_2k40 ) && sts[0]->bfi == 0 && EQ_16( sts[0]->prev_bfi, 1 ) )
- {
#else
IF( sts[0]->bfi == 0 && EQ_16( sts[0]->prev_bfi, 1 ) )
- {
- /* On first good frame after frameloss undo the whitening of the bg noise shape */
+ /* On first good frame after frameloss undo the whitening of the bg noise shape */
#endif
+ {
FOR( n = 0; n < n_channels; ++n )
{
IF( NE_16( sts[n]->last_core_bfi, ACELP_CORE ) )
@@ -889,7 +888,7 @@ ivas_error ivas_core_dec_fx(
IF( p_output_mem_fx != NULL )
{
p_output_mem_16 = output_mem_16_fx;
- Copy_Scale_sig_32_16( p_output_mem_fx, p_output_mem_16, NS2SA_fx2( output_Fs, STEREO_DFT32MS_OVL_NS ), negate( Q11 ) );
+ Copy_Scale_sig_32_16( p_output_mem_fx, p_output_mem_16, NS2SA_FX2( output_Fs, STEREO_DFT32MS_OVL_NS ), negate( Q11 ) );
}
ELSE
{
@@ -1291,7 +1290,7 @@ ivas_error ivas_core_dec_fx(
test();
IF( EQ_16( st->core, ACELP_CORE ) && !st->bfi && st->prev_bfi && GE_32( st->last_total_brate, HQ_48k ) && EQ_16( st->last_codec_mode, MODE2 ) && ( EQ_16( st->last_core_bfi, TCX_20_CORE ) || EQ_16( st->last_core_bfi, TCX_10_CORE ) ) && EQ_16( st->hPlcInfo->concealment_method, TCX_NONTONAL ) && LT_16( st->hPlcInfo->nbLostCmpt, 4 ) )
{
- tmps = NS2SA_fx2( output_Fs, DELAY_CLDFB_NS );
+ tmps = NS2SA_FX2( output_Fs, DELAY_CLDFB_NS );
waveform_adj2_fix( st->hTonalMDCTConc->secondLastPcmOut, synth_16_fx[n] + tmps, st->plcInfo.data_noise, &st->plcInfo.outx_new_n1_fx,
&st->plcInfo.nsapp_gain_fx, &st->plcInfo.nsapp_gain_n_fx, &st->plcInfo.recovery_gain, st->plcInfo.step_concealgain_fx,
@@ -2012,12 +2011,11 @@ ivas_error ivas_core_dec(
/* On first good active frame after frameloss undo the whitening of the bg noise shape */
if ( sts[0]->core_brate > SID_2k40 && sts[0]->bfi == 0 && sts[0]->prev_bfi == 1 )
- {
#else
if ( sts[0]->bfi == 0 && sts[0]->prev_bfi == 1 )
- {
- /* On first good frame after frameloss undo the whitening of the bg noise shape */
+ /* On first good frame after frameloss undo the whitening of the bg noise shape */
#endif
+ {
for ( n = 0; n < n_channels; ++n )
{
if ( sts[n]->last_core_bfi != ACELP_CORE )
diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c
index fa66debaa8e47ad7ef44fad6342ac88c16d8952d..31c723eab8d115b5600db24356c930433f2547d5 100644
--- a/lib_dec/ivas_cpe_dec_fx.c
+++ b/lib_dec/ivas_cpe_dec_fx.c
@@ -758,7 +758,7 @@ ivas_error ivas_cpe_dec_fx(
FOR( n = 0; n < hCPE->nchan_out; n++ )
{
Scale_sig32( output[n], L_FRAME48k, sub( hCPE->hStereoDft->q_dft, Q11 ) );
- scale_sig32( hCPE->output_mem_fx[n], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) );
+ scale_sig32( hCPE->output_mem_fx[n], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) );
hCPE->q_output_mem_fx[n] = hCPE->hStereoDft->q_dft;
move16();
}
@@ -773,7 +773,7 @@ ivas_error ivas_cpe_dec_fx(
FOR( n = 0; n < hCPE->nchan_out; n++ )
{
Scale_sig32( output[n], L_FRAME48k, sub( Q11, hCPE->hStereoDft->q_dft ) );
- scale_sig32( hCPE->output_mem_fx[n], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) );
+ scale_sig32( hCPE->output_mem_fx[n], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) );
hCPE->q_output_mem_fx[n] = Q11;
move16();
}
@@ -1001,8 +1001,8 @@ ivas_error create_cpe_dec(
FOR( n = 0; n < CPE_CHANNELS; n++ )
{
- set32_fx( hCPE->prev_hb_synth_fx[n], 0, NS2SA_fx2( output_Fs, L_sub( IVAS_DEC_DELAY_NS, DELAY_BWE_TOTAL_NS ) ) );
- set32_fx( hCPE->prev_synth_fx[n], 0, NS2SA_fx2( output_Fs, L_sub( IVAS_DEC_DELAY_NS, STEREO_DFT32MS_OVL_NS ) ) );
+ set32_fx( hCPE->prev_hb_synth_fx[n], 0, NS2SA_FX2( output_Fs, L_sub( IVAS_DEC_DELAY_NS, DELAY_BWE_TOTAL_NS ) ) );
+ set32_fx( hCPE->prev_synth_fx[n], 0, NS2SA_FX2( output_Fs, L_sub( IVAS_DEC_DELAY_NS, STEREO_DFT32MS_OVL_NS ) ) );
}
hCPE->q_prev_synth_fx = 0;
move16();
@@ -1023,11 +1023,11 @@ ivas_error create_cpe_dec(
IF( EQ_16( (Word16) st_ivas->ivas_format, STEREO_FORMAT ) || EQ_16( (Word16) st_ivas->ivas_format, MASA_FORMAT ) || EQ_16( (Word16) st_ivas->ivas_format, MASA_ISM_FORMAT ) ||
( EQ_16( (Word16) st_ivas->ivas_format, MC_FORMAT ) && EQ_16( (Word16) st_ivas->mc_mode, MC_MODE_MCMASA ) ) || st_ivas->sba_dirac_stereo_flag )
{
- IF( ( hCPE->input_mem_fx[i] = (Word32 *) malloc( sizeof( Word32 ) * NS2SA_fx2( output_Fs, STEREO_DFT32MS_OVL_NS ) ) ) == NULL )
+ IF( ( hCPE->input_mem_fx[i] = (Word32 *) malloc( sizeof( Word32 ) * NS2SA_FX2( output_Fs, STEREO_DFT32MS_OVL_NS ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT stereo memory\n" ) );
}
- set32_fx( hCPE->input_mem_fx[i], 0, NS2SA_fx2( output_Fs, STEREO_DFT32MS_OVL_NS ) );
+ set32_fx( hCPE->input_mem_fx[i], 0, NS2SA_FX2( output_Fs, STEREO_DFT32MS_OVL_NS ) );
IF( ( hCPE->input_mem_LB_fx[i] = (Word32 *) malloc( sizeof( Word32 ) * STEREO_DFT32MS_OVL_16k ) ) == NULL )
{
@@ -1044,20 +1044,20 @@ ivas_error create_cpe_dec(
set32_fx( hCPE->input_mem_BPF_fx[0], 0, STEREO_DFT32MS_OVL_16k );
}
- IF( ( hCPE->output_mem_fx[i] = (Word32 *) malloc( sizeof( Word32 ) * NS2SA_fx2( output_Fs, STEREO_DFT32MS_OVL_NS ) ) ) == NULL )
+ IF( ( hCPE->output_mem_fx[i] = (Word32 *) malloc( sizeof( Word32 ) * NS2SA_FX2( output_Fs, STEREO_DFT32MS_OVL_NS ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT stereo memory\n" ) );
}
- set32_fx( hCPE->output_mem_fx[i], 0, NS2SA_fx2( output_Fs, STEREO_DFT32MS_OVL_NS ) );
+ set32_fx( hCPE->output_mem_fx[i], 0, NS2SA_FX2( output_Fs, STEREO_DFT32MS_OVL_NS ) );
hCPE->q_output_mem_fx[i] = Q11;
move16();
IF( LT_16( i, hCPE->nchan_out ) )
{
- IF( ( hCPE->prev_synth_chs_fx[i] = (Word32 *) malloc( sizeof( Word32 ) * NS2SA_fx2( output_Fs, FRAME_SIZE_NS ) ) ) == NULL )
+ IF( ( hCPE->prev_synth_chs_fx[i] = (Word32 *) malloc( sizeof( Word32 ) * NS2SA_FX2( output_Fs, FRAME_SIZE_NS ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT stereo memory\n" ) );
}
- set32_fx( hCPE->prev_synth_chs_fx[i], 0, NS2SA_fx2( output_Fs, FRAME_SIZE_NS ) );
+ set32_fx( hCPE->prev_synth_chs_fx[i], 0, NS2SA_FX2( output_Fs, FRAME_SIZE_NS ) );
}
ELSE
{
diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c
index 71a9514d80f817532a53f20685f92ae3b9945d1c..1615a177618c63639672abf70f1b1e111a514f29 100644
--- a/lib_dec/ivas_ism_dec.c
+++ b/lib_dec/ivas_ism_dec.c
@@ -40,7 +40,8 @@
#ifdef IVAS_FLOAT_FIXED
#include "ivas_prot_fx.h"
#include "prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
+#endif
+
#define IVAS_FLOAT_FIXED_TO_BE_REMOVED
/*-------------------------------------------------------------------------*
diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c
index a5997460e8665e136d2bfd22b0986dd1eee5c606..7300334388a2443148e0ee5d0cb5ddf821f4db02 100644
--- a/lib_dec/ivas_jbm_dec.c
+++ b/lib_dec/ivas_jbm_dec.c
@@ -43,14 +43,14 @@
#include
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
-#ifdef DUMPS_ENABLED
+#ifdef DEBUGGING
#include "debug.h"
-#endif // DUMPS_ENABLED
+#endif
#include "prot_fx.h"
+
#define float_to_fixed( n, factor ) ( round( n * ( 1 << factor ) ) )
#define fixed_to_float( n, factor ) ( (float) n / ( 1 << factor ) )
-#include "debug.h"
/*-----------------------------------------------------------------------*
* Local function prototypes
*-----------------------------------------------------------------------*/
@@ -471,7 +471,7 @@ ivas_error ivas_jbm_dec_tc_fx(
st_ivas->hSpar->hMdDec->Q_mixer_mat = 30;
FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ )
{
- scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) );
+ scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) );
hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft;
}
#ifdef MSAN_FIX
@@ -550,7 +550,7 @@ ivas_error ivas_jbm_dec_tc_fx(
st_ivas->hSpar->hMdDec->Q_mixer_mat = 30;
FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ )
{
- scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) );
+ scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) );
hCPE->q_output_mem_fx[ii] = Q11;
}
}
@@ -915,12 +915,12 @@ ivas_error ivas_jbm_dec_tc_fx(
}
FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ )
{
- scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) );
+ scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) );
hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft;
}
#ifdef MSAN_FIX
FOR( i = 0; i < CPE_CHANNELS; i++ )
- Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_fx2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), hCPE->q_prev_synth_fx - 11 );
+ Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), hCPE->q_prev_synth_fx - 11 );
#else
Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), hCPE->q_prev_synth_fx - 11 );
#endif
@@ -932,7 +932,7 @@ ivas_error ivas_jbm_dec_tc_fx(
#ifdef MSAN_FIX
FOR( i = 0; i < CPE_CHANNELS; i++ )
- Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_fx2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), 11 - hCPE->q_prev_synth_fx );
+ Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), 11 - hCPE->q_prev_synth_fx );
#else
Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx );
#endif
@@ -959,7 +959,7 @@ ivas_error ivas_jbm_dec_tc_fx(
st_ivas->hSpar->hMdDec->Q_mixer_mat = 30;
FOR( int ii = 0; ii < CPE_CHANNELS; ii++ )
{
- scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) );
+ scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) );
hCPE->q_output_mem_fx[ii] = Q11;
}
}
@@ -1320,12 +1320,12 @@ ivas_error ivas_jbm_dec_tc_fx(
}
FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ )
{
- scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) );
+ scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) );
hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft;
}
#ifdef MSAN_FIX
FOR( i = 0; i < CPE_CHANNELS; i++ )
- Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_fx2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), hCPE->q_prev_synth_fx - 11 );
+ Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), hCPE->q_prev_synth_fx - 11 );
#else
Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), hCPE->q_prev_synth_fx - 11 );
#endif
@@ -1336,7 +1336,7 @@ ivas_error ivas_jbm_dec_tc_fx(
}
#ifdef MSAN_FIX
FOR( i = 0; i < CPE_CHANNELS; i++ )
- Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_fx2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), 11 - hCPE->q_prev_synth_fx );
+ Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), 11 - hCPE->q_prev_synth_fx );
#else
Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx );
#endif // MSAN_FIX
@@ -1365,7 +1365,7 @@ ivas_error ivas_jbm_dec_tc_fx(
move16();
FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ )
{
- scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) );
+ scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) );
hCPE->q_output_mem_fx[ii] = Q11;
move16();
}
diff --git a/lib_dec/ivas_lfe_dec.c b/lib_dec/ivas_lfe_dec.c
index a6368a72785bc9df6154fc5ef6297b4839e487e8..df9bf4748a126f76726be0875c65d9fd96e1d4a6 100644
--- a/lib_dec/ivas_lfe_dec.c
+++ b/lib_dec/ivas_lfe_dec.c
@@ -31,13 +31,14 @@
*******************************************************************************************************/
#include
+#include
#include "options.h"
+#include "wmc_auto.h"
+
#ifndef IVAS_FLOAT_FIXED
#include "prot.h"
#include "ivas_prot.h"
#include "ivas_rom_com.h"
-#include "math.h"
-#include "wmc_auto.h"
/*------------------------------------------------------------------------------------------*
diff --git a/lib_dec/ivas_lfe_dec_fx.c b/lib_dec/ivas_lfe_dec_fx.c
index 775535614d42349a64ab1695f074b4d5400e257a..0b38566e1a8a697d32cd54b8e65981d9298a2353 100644
--- a/lib_dec/ivas_lfe_dec_fx.c
+++ b/lib_dec/ivas_lfe_dec_fx.c
@@ -470,7 +470,7 @@ ivas_error ivas_create_lfe_dec_fx(
move16();
hLFE->lfe_block_delay_s_fx = add( hLFE->lfe_block_delay_s_fx, low_pass_delay_dec_out );
move16();
- hLFE->lfe_prior_buf_len = NS2SA_fx2( output_Fs, IVAS_LFE_FADE_NS );
+ hLFE->lfe_prior_buf_len = NS2SA_FX2( output_Fs, IVAS_LFE_FADE_NS );
move16();
hLFE->bfi_count = 0;
diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c
index 240dae544ce199467ae6ccea44c756ffc3a9f825..6921066aa007d69b33456ebadedb8abd83950abc 100644
--- a/lib_dec/ivas_mc_paramupmix_dec.c
+++ b/lib_dec/ivas_mc_paramupmix_dec.c
@@ -352,11 +352,11 @@ ivas_error ivas_mc_paramupmix_dec_open(
FOR( i = 0; i < MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; i++ )
{
- IF( ( hMCParamUpmix->pcm_delay_fx[i] = (Word32 *) malloc( NS2SA_fx2( output_Fs, IVAS_FB_DEC_DELAY_NS ) * sizeof( Word32 ) ) ) == NULL )
+ IF( ( hMCParamUpmix->pcm_delay_fx[i] = (Word32 *) malloc( NS2SA_FX2( output_Fs, IVAS_FB_DEC_DELAY_NS ) * sizeof( Word32 ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for delay buffer\n" ) );
}
- set32_fx( hMCParamUpmix->pcm_delay_fx[i], 0, NS2SA_fx2( output_Fs, IVAS_FB_DEC_DELAY_NS ) );
+ set32_fx( hMCParamUpmix->pcm_delay_fx[i], 0, NS2SA_FX2( output_Fs, IVAS_FB_DEC_DELAY_NS ) );
}
/* Head or external rotation */
diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c
index 87ff7b4e9e3d5a5077f6024f540ac7149b5605e3..5546d3f4c1f3b7a5295fc8c47fb4853b6c96a611 100644
--- a/lib_dec/ivas_mct_dec.c
+++ b/lib_dec/ivas_mct_dec.c
@@ -45,7 +45,7 @@
#include "wmc_auto.h"
#ifdef IVAS_FLOAT_FIXED
#include "ivas_prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
+#endif
/*-----------------------------------------------------------------------*
diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c
index 538cb2301e5a398c947cdeb477552dcdd8e57be9..ee7864a13e7153acab4a33a18ac4f573d2ab6967 100644
--- a/lib_dec/ivas_mdct_core_dec.c
+++ b/lib_dec/ivas_mdct_core_dec.c
@@ -47,7 +47,7 @@
#ifdef IVAS_FLOAT_FIXED
#include "prot_fx.h"
#include "ivas_prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
+#endif
/*-----------------------------------------------------------------*
diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c
index 4b9951065695502679ba43dc60d7b6628c75e4ac..4c8c8103eee490879f406e82e30ca9cecc86464d 100644
--- a/lib_dec/ivas_osba_dec.c
+++ b/lib_dec/ivas_osba_dec.c
@@ -41,7 +41,7 @@
#include "ivas_prot_fx.h"
#ifdef IVAS_FLOAT_FIXED
#include "prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
+#endif
/*-------------------------------------------------------------------*
diff --git a/lib_dec/ivas_post_proc.c b/lib_dec/ivas_post_proc.c
index c2decb8c5bbee17c0a16a746efa079ee5bc85af2..ed7cc13c4d7b7677f1345f3afd42810f9b797f38 100644
--- a/lib_dec/ivas_post_proc.c
+++ b/lib_dec/ivas_post_proc.c
@@ -198,7 +198,7 @@ void ivas_post_proc_fx(
ELSE
{
/* set delay */
- delay_comp = NS2SA_fx2( output_Fs, DELAY_CLDFB_NS );
+ delay_comp = NS2SA_FX2( output_Fs, DELAY_CLDFB_NS );
move16();
test();
@@ -212,12 +212,12 @@ void ivas_post_proc_fx(
}
ELSE IF( sba_dirac_stereo_flag && EQ_16( sts[n]->element_mode, IVAS_CPE_MDCT ) )
{
- Word16 numZeros = (Word16) ( NS2SA_fx2( output_Fs, N_ZERO_MDCT_NS ) );
+ Word16 numZeros = (Word16) ( NS2SA_FX2( output_Fs, N_ZERO_MDCT_NS ) );
move16();
Copy32( sts[n]->hHQ_core->oldOut_fx + numZeros, sts[n]->hTcxDec->FBTCXdelayBuf_32, delay_comp );
}
- tcx_ltp_post32( sts[n], hTcxLtpDec, sts[n]->core, output_frame, add( NS2SA_fx2( output_Fs, ACELP_LOOK_NS ), delay_comp ), synth, sts[n]->hTcxDec->FBTCXdelayBuf_32 );
+ tcx_ltp_post32( sts[n], hTcxLtpDec, sts[n]->core, output_frame, add( NS2SA_FX2( output_Fs, ACELP_LOOK_NS ), delay_comp ), synth, sts[n]->hTcxDec->FBTCXdelayBuf_32 );
}
}
}
diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c
index bb71b0fc8d73b4220844c73d2a15950f30758536..2d20ed6898bfb2381675c8d88ac47e22b75929e9 100644
--- a/lib_dec/ivas_qmetadata_dec.c
+++ b/lib_dec/ivas_qmetadata_dec.c
@@ -1708,16 +1708,20 @@ Word16 ivas_qmetadata_dec_decode_hr_384_512(
{
FOR( m = 0; m < hQMetaData->q_direction[0].cfg.nblocks; m++ )
{
+ hQMetaData->q_direction[0].band_data[b].energy_ratio_fx[m] = W_round64_L( W_nrg_ratio[0][b][m] );
+ move32();
+ }
+ }
#else
FOR( b = 0; b < MASA_MAXIMUM_CODING_SUBBANDS; b++ )
{
FOR( m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES; m++ )
{
-#endif // MSAN_FIX
hQMetaData->q_direction[0].band_data[b].energy_ratio_fx[m] = W_round64_L( W_nrg_ratio[0][b][m] );
move32();
}
}
+#endif // MSAN_FIX
IF( EQ_32( hQMetaData->no_directions, 2 ) )
{
#ifdef MSAN_FIX
@@ -1725,16 +1729,20 @@ Word16 ivas_qmetadata_dec_decode_hr_384_512(
{
FOR( m = 0; m < hQMetaData->q_direction[1].cfg.nblocks; m++ )
{
+ hQMetaData->q_direction[1].band_data[b].energy_ratio_fx[m] = W_round64_L( W_nrg_ratio[1][b][m] );
+ move32();
+ }
+ }
#else
FOR( b = 0; b < MASA_MAXIMUM_CODING_SUBBANDS; b++ )
{
FOR( m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES; m++ )
{
-#endif // MSAN_FIX
hQMetaData->q_direction[1].band_data[b].energy_ratio_fx[m] = W_round64_L( W_nrg_ratio[1][b][m] );
move32();
}
}
+#endif // MSAN_FIX
}
/* Store status information for renderer use */
hQMetaData->ec_flag = 0;
diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c
index c20c805853edca4bdc34ae639086046e2056aa4c..6ed2b922a9720e59835195716440a94c1d967db5 100644
--- a/lib_dec/ivas_sba_dec.c
+++ b/lib_dec/ivas_sba_dec.c
@@ -1570,12 +1570,10 @@ void ivas_sba_dec_digest_tc(
{
#ifndef IVAS_FLOAT_FIXED
ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, p_tc, decorr_signal, nSamplesToDecorr );
-#ifdef DUMPS_ENABLED
+#ifdef DEBUGGING
for ( i = 0; i < st_ivas->hDiracDecBin->hTdDecorr->num_apd_outputs; i++ )
{
-#ifdef DUMPS_ENABLED
dbgwrite_txt( decorr_signal[i], nSamplesToDecorr, "fixed.txt", NULL );
-#endif
}
#endif
#else
@@ -1605,7 +1603,7 @@ void ivas_sba_dec_digest_tc(
{
decorr_signal[i][j] = ( decorr_signal_fx[i][j] ) / (float) ( 1 << q_format );
}
-#ifdef DUMPS_ENABLED
+#ifdef DEBUGGING
dbgwrite_txt( decorr_signal[i], nSamplesToDecorr, "fixed.txt", NULL );
#endif
}
@@ -1805,7 +1803,7 @@ ivas_error ivas_sba_dec_render_fx(
output_f_local_fx[ch] = output_fx[ch];
}
- slot_size = NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS );
+ slot_size = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS );
move16();
/* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */
diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c
index d433d3712535fbca74256e338ea2e53e697efb0e..1088e44c0ed320a3df6a8532e3f6d322ac4dec23 100644
--- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c
+++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c
@@ -1244,16 +1244,16 @@ void ivas_sba_dirac_stereo_dec_fx(
move16();
#ifdef MSAN_FIX
- Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hCPE->hStereoDft->q_dft ) ) );
+ Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hCPE->hStereoDft->q_dft ) ) );
#else
- Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), -( Q11 - hCPE->hStereoDft->q_dft ) );
+ Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), -( Q11 - hCPE->hStereoDft->q_dft ) );
#endif
IF( hSCE != NULL )
{
#ifdef MSAN_FIX
- Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hCPE->hStereoDft->q_dft ) ) );
+ Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hCPE->hStereoDft->q_dft ) ) );
#else
- Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), -( Q11 - hCPE->hStereoDft->q_dft ) );
+ Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), -( Q11 - hCPE->hStereoDft->q_dft ) );
#endif // MSAN_FIX
hSCE->q_prev_hb_synth_fx = hCPE->hStereoDft->q_dft;
move16();
@@ -1381,16 +1381,16 @@ void ivas_sba_dirac_stereo_dec_fx(
}
#ifdef MSAN_FIX
- Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) );
+ Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) );
#else
- Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), ( Q11 - hCPE->hStereoDft->q_dft ) );
+ Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), ( Q11 - hCPE->hStereoDft->q_dft ) );
#endif
IF( hSCE != NULL )
{
#ifdef MSAN_FIX
- Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) );
+ Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) );
#else
- Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), ( Q11 - hCPE->hStereoDft->q_dft ) );
+ Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), ( Q11 - hCPE->hStereoDft->q_dft ) );
#endif // MSAN_FIX
hSCE->q_prev_hb_synth_fx = Q11;
move16();
diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c
index 54773e30c9f7dc322c4d1a664d970a4ef3d62b99..0ef56c856ea4389e20bdb7dd15167bd77efa766d 100644
--- a/lib_dec/ivas_sba_rendering_internal.c
+++ b/lib_dec/ivas_sba_rendering_internal.c
@@ -42,11 +42,10 @@
#ifdef IVAS_FLOAT_FIXED
#include "ivas_prot_fx.h"
#include "prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
-#ifdef DUMPS_ENABLED
+#endif
+#ifdef DEBUGGING
#include "debug.h"
-#endif // DUMPS_ENABLED
-
+#endif
/*-------------------------------------------------------------------------*
* ivas_sba2MC_cldfb()
@@ -912,9 +911,9 @@ void ivas_sba_mix_matrix_determiner_fx(
move16();
ivas_agc_dec_process_fx( hSpar->hAgcDec, ( output_fx ), ( output_fx ), nchan_transport, output_frame );
Q_p_output = sub( Q_p_output, 3 );
-#ifdef DUMPS_ENABLED
- dbgwrite_txt( &output[0][0], output_frame, "fix_ivas_agc_dec_process_output.txt", NULL );
-#endif // DUMPS_ENABLED
+#ifdef DEBUGGING
+ dbgwrite_txt( (const float *) ( output_fx[0] ), output_frame, "fix_ivas_agc_dec_process_output.txt", NULL );
+#endif
/* Convert numeric range back */
FOR( ch = 0; ch < nchan_out; ch++ )
diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c
index 070cbf4ed8829752177614683dbec010c50f766b..9d33f6dd74e679906d8c58e87b2a47e873a85a2e 100644
--- a/lib_dec/ivas_sce_dec_fx.c
+++ b/lib_dec/ivas_sce_dec_fx.c
@@ -320,13 +320,13 @@ ivas_error ivas_sce_dec_fx(
* LB synthesis synchronization between IVAS formats
*----------------------------------------------------------------*/
- delay_signal_fx( output[0], output_frame, st->prev_synth_buffer32_fx, NS2SA_fx2( output_Fs, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS ) );
+ delay_signal_fx( output[0], output_frame, st->prev_synth_buffer32_fx, NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS ) );
/*----------------------------------------------------------------*
* HB synthesis synchronization between IVAS formats
*----------------------------------------------------------------*/
- delay_signal_fx( outputHB[0], output_frame, hSCE->prev_hb_synth_fx, NS2SA_fx2( output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) );
+ delay_signal_fx( outputHB[0], output_frame, hSCE->prev_hb_synth_fx, NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) );
/*----------------------------------------------------------------*
* output LB and HB mix
@@ -390,7 +390,7 @@ ivas_error create_sce_dec(
hSCE->element_brate = element_brate;
move32();
- set32_fx( hSCE->prev_hb_synth_fx, 0, NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) );
+ set32_fx( hSCE->prev_hb_synth_fx, 0, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) );
/*-----------------------------------------------------------------*
* Core Coder, 1 instance: allocate and initialize
diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c
index 37bcdbea0bec2ccb8bead0ebdd117e0733164065..7186d031a0c96af22b7d67fb857cef7304861ee1 100644
--- a/lib_dec/ivas_spar_decoder.c
+++ b/lib_dec/ivas_spar_decoder.c
@@ -31,6 +31,8 @@
*******************************************************************************************************/
#include
+#include
+#include
#include "options.h"
#include "ivas_stat_dec.h"
#include "prot.h"
@@ -41,17 +43,14 @@
#include "ivas_rom_dec.h"
#include "ivas_stat_com.h"
#include "stat_com.h"
-#include
-#include
#include "wmc_auto.h"
#ifdef IVAS_FLOAT_FIXED
#include "prot_fx.h"
#include "ivas_prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
-#ifdef DUMPS_ENABLED
+#endif
+#ifdef DEBUGGING
#include "debug.h"
-#endif // DUMPS_ENABLED
-
+#endif
/*-------------------------------------------------------------------*
* Local function prototypes
@@ -1166,9 +1165,9 @@ void ivas_spar_get_cldfb_gains_fx(
num_cldfb_bands = cldfbAnaDec0->no_channels;
move16();
- stride = NS2SA_fx2( output_Fs_fx, DELAY_CLDFB_NS );
- encfb_delay = NS2SA_fx2( output_Fs_fx, IVAS_FB_ENC_DELAY_NS );
- decfb_delay = NS2SA_fx2( output_Fs_fx, IVAS_FB_DEC_DELAY_NS );
+ stride = NS2SA_FX2( output_Fs_fx, DELAY_CLDFB_NS );
+ encfb_delay = NS2SA_FX2( output_Fs_fx, IVAS_FB_ENC_DELAY_NS );
+ decfb_delay = NS2SA_FX2( output_Fs_fx, IVAS_FB_DEC_DELAY_NS );
cf_start = add( sub( hSpar->hFbMixer->cross_fade_start_offset, encfb_delay ), decfb_delay ); /* time domain after CLDFB synthesis*/
cf_end = add( sub( hSpar->hFbMixer->cross_fade_end_offset, encfb_delay ), decfb_delay );
diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c
index d142217120f30ba5d16c9b426fd31e76637bdc54..0a644465cc0c716f03331caa0f6c45f280b7c097 100644
--- a/lib_dec/ivas_stereo_dft_dec.c
+++ b/lib_dec/ivas_stereo_dft_dec.c
@@ -47,7 +47,7 @@
#include "wmc_auto.h"
#ifdef IVAS_FLOAT_FIXED
#include "ivas_prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
+#endif
/*-------------------------------------------------------------------*
* Local constants
diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c
index 3a2cea5207e66fa165d525962501d1e9b898bd6c..6e428de2f10163b9062f42fd4528d673bcba517f 100644
--- a/lib_dec/ivas_stereo_dft_dec_fx.c
+++ b/lib_dec/ivas_stereo_dft_dec_fx.c
@@ -49,6 +49,13 @@
#ifdef IVAS_FLOAT_FIXED
#include "ivas_prot_fx.h"
#include "basop_util.h"
+#endif
+#ifdef DEBUGGING
+#include "debug.h"
+#endif
+
+
+#ifdef IVAS_FLOAT_FIXED
/*-------------------------------------------------------------------*
* Local constants
@@ -3926,9 +3933,9 @@ void stereo_dft_dec_read_BS_fx(
rc_uni_dec_init_fx( &range_uni_dec_state, bit_stream_side + *nb_bits, max_bits - *nb_bits );
hStereoDft->res_global_gain_fx = ECSQ_dequantize_gain_fx( I );
-#ifdef DUMPS_ENABLED
- dbgwrite_txt( &hStereoDft->res_global_gain, 1, "fixed_res_global_gain.txt", NULL );
-#endif // DUMPS_ENABLED
+#ifdef DEBUGGING
+ dbgwrite_txt( (const float *) ( &hStereoDft->res_global_gain_fx ), 1, "fixed_res_global_gain.txt", NULL );
+#endif
ecsq_inst.config_index = sub( shl( hStereoDft->res_cod_mode[k_offset], 1 ), 1 );
@@ -3946,9 +3953,9 @@ void stereo_dft_dec_read_BS_fx(
ECSQ_dequantize_vector_fx( dec, hStereoDft->res_global_gain_fx, hStereoDft->res_cod_line_max, res_buf_fx );
-#ifdef DUMPS_ENABLED
- dbgwrite_txt( res_buf, hStereoDft->res_cod_line_max, "fixed_res_buf.txt", NULL );
-#endif // DUMPS_ENABLED
+#ifdef DEBUGGING
+ dbgwrite_txt( (const float *) res_buf_fx, hStereoDft->res_cod_line_max, "fixed_res_buf.txt", NULL );
+#endif
}
ELSE
{
diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec.c b/lib_dec/ivas_stereo_mdct_stereo_dec.c
index 9177bf69ca1653f7e7aa2b9923d5744a05cb8e0c..a745752bd28011c9842bac048f86909b9d8d7dd7 100644
--- a/lib_dec/ivas_stereo_mdct_stereo_dec.c
+++ b/lib_dec/ivas_stereo_mdct_stereo_dec.c
@@ -41,7 +41,7 @@
#ifdef IVAS_FLOAT_FIXED
#include "prot_fx.h"
#include "ivas_prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
+#endif
/*-------------------------------------------------------------------*
@@ -1295,7 +1295,7 @@ void updateBuffersForDmxMdctStereo_fx(
}
delay_buf_out_len = i_mult( delta, HQ_DELAY_COMP );
- tcxltp_mem_in_len = NS2SA_fx2( sts[0]->output_Fs, TCXLTP_DELAY_NS );
+ tcxltp_mem_in_len = NS2SA_FX2( sts[0]->output_Fs, TCXLTP_DELAY_NS );
move16();
assert( delay_buf_out_len > tcxltp_mem_in_len );
diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c
index 67d867d826292c4ef73501a2443f18fce68e0f46..877cbb938cc3739575c250f363a5e17d535243cc 100644
--- a/lib_dec/ivas_tcx_core_dec.c
+++ b/lib_dec/ivas_tcx_core_dec.c
@@ -814,9 +814,9 @@ void stereo_tcx_core_dec_fx(
/* Update past buffers */
Copy_Scale_sig( synth_buf_fx + st->L_frame, hTcxDec->old_synth, hTcxDec->old_synth_len, 0 );
- Copy( hTcxDec->old_synthFB_fx + sub( hTcxDec->L_frameTCX, NS2SA_fx2( st->output_Fs, PH_ECU_MEM_NS ) ), hTcxDec->synth_history_fx, NS2SA_fx2( st->output_Fs, PH_ECU_MEM_NS ) );
+ Copy( hTcxDec->old_synthFB_fx + sub( hTcxDec->L_frameTCX, NS2SA_FX2( st->output_Fs, PH_ECU_MEM_NS ) ), hTcxDec->synth_history_fx, NS2SA_FX2( st->output_Fs, PH_ECU_MEM_NS ) );
Copy( synth_bufFB_fx + hTcxDec->L_frameTCX, hTcxDec->old_synthFB_fx, hTcxDec->old_synth_lenFB );
- Copy( st->hHQ_core->old_out_fx + NS2SA_fx2( st->output_Fs, N_ZERO_MDCT_NS ), hTcxDec->old_synthFB_fx + hTcxDec->old_synth_lenFB, NS2SA_fx2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) );
+ Copy( st->hHQ_core->old_out_fx + NS2SA_FX2( st->output_Fs, N_ZERO_MDCT_NS ), hTcxDec->old_synthFB_fx + hTcxDec->old_synth_lenFB, NS2SA_FX2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) );
Copy( &lspnew_uw_fx[imult1616( sub( st->numlpc, 1 ), M )], st->lspold_uw, M );
Copy( &lsfnew_uw_fx[imult1616( sub( st->numlpc, 1 ), M )], st->lsfold_uw, M );
diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c
index 9e11f8085aa8b436e9e9da6a671a3e72dd197e26..b3a7886ea0308f66104e5ceb9f5126ce1b451b19 100644
--- a/lib_dec/jbm_pcmdsp_apa.c
+++ b/lib_dec/jbm_pcmdsp_apa.c
@@ -1683,54 +1683,56 @@ static Word8 logarithmic_search_fx( const apa_state_t *ps,
}
/* update max corr */
- IF( LT_16( ps->scale, 100 ) ){
+ IF( LT_16( ps->scale, 100 ) )
+ {
/* shrinking: prefer greater synchpos for equal coeff */
- BASOP_SATURATE_WARNING_OFF_EVS
- IF( GE_32( coeff, coeff_max ) ){
- coeff_max = L_add( coeff, 0 );
- *synchpos = i;
- move16();
+ BASOP_SATURATE_WARNING_OFF_EVS;
+ IF( GE_32( coeff, coeff_max ) )
+ {
+ coeff_max = L_add( coeff, 0 );
+ *synchpos = i;
+ move16();
+ }
+ BASOP_SATURATE_WARNING_ON_EVS;
+ }
+ ELSE
+ {
+ /* extending: prefer smaller synchpos for equal coeff */
+ BASOP_SATURATE_WARNING_OFF_EVS;
+ IF( GT_32( coeff, coeff_max ) )
+ {
+ coeff_max = L_add( coeff, 0 );
+ *synchpos = i;
+ move16();
+ }
+ BASOP_SATURATE_WARNING_ON_EVS;
+ }
}
- BASOP_SATURATE_WARNING_ON_EVS
- }
- ELSE
- {
- /* extending: prefer smaller synchpos for equal coeff */
- BASOP_SATURATE_WARNING_OFF_EVS
- IF( GT_32( coeff, coeff_max ) )
+ /* backup old search range */
+ s_start_old = s_start;
+ move16();
+ s_len_old = inlen;
+ move16();
+
+ css = shr( css, 1 );
+ inlen = shr( inlen, 1 );
+ s_start_old = s_start;
+ move16();
+ s_start = sub( *synchpos, shr( inlen, 1 ) );
+
+ if ( LT_16( s_start, s_start_old ) )
{
- coeff_max = L_add( coeff, 0 );
- *synchpos = i;
+ s_start = s_start_old;
move16();
}
- BASOP_SATURATE_WARNING_ON_EVS
- }
-}
-/* backup old search range */
-s_start_old = s_start;
-move16();
-s_len_old = inlen;
-move16();
-
-css = shr( css, 1 );
-inlen = shr( inlen, 1 );
-s_start_old = s_start;
-move16();
-s_start = sub( *synchpos, shr( inlen, 1 ) );
-
-if ( LT_16( s_start, s_start_old ) )
-{
- s_start = s_start_old;
- move16();
-}
-IF( GT_16( add( s_start, inlen ), add( s_start_old, s_len_old ) ) )
-{
- inlen = add( sub( s_start_old, s_start ), s_len_old );
-}
-}
-WHILE( GT_16( css, 2 ) );
-return 0;
+ IF( GT_16( add( s_start, inlen ), add( s_start_old, s_len_old ) ) )
+ {
+ inlen = add( sub( s_start_old, s_start ), s_len_old );
+ }
+ }
+ WHILE( GT_16( css, 2 ) );
+ return 0;
}
#endif
/*
diff --git a/lib_dec/jbm_pcmdsp_window.h b/lib_dec/jbm_pcmdsp_window.h
index 1abf57f3374bd448df90f5aab5e3c932edf29410..9a20fdab2d8dac8533dd2503d04a2946bde9ad69 100644
--- a/lib_dec/jbm_pcmdsp_window.h
+++ b/lib_dec/jbm_pcmdsp_window.h
@@ -41,6 +41,7 @@
#include
#include "options.h"
+#include "typedef.h"
/*! Generates a Hann window (cos-shaped) of length n.
* Roughly:
diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c
index 44e0c0770c93204b79fbb9041e1cb69385f3cdcf..51b5af294eaf9cf63081ef228578247df9e12d8d 100644
--- a/lib_dec/lib_dec.c
+++ b/lib_dec/lib_dec.c
@@ -30,7 +30,11 @@
*******************************************************************************************************/
+#include
+#include
+#include
#include "lib_dec.h"
+#include "wmc_auto.h"
#ifndef IVAS_FLOAT_FIXED
#include "ivas_cnst.h"
#include "ivas_prot.h"
@@ -40,10 +44,6 @@
#include "jbm_jb4sb.h"
#include "jbm_pcmdsp_apa.h"
#include "jbm_pcmdsp_fifo.h"
-#include
-#include
-#include
-#include "wmc_auto.h"
/*---------------------------------------------------------------------*
* Local structs
diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c
index 9becbc8cc12a1d8b7131ab96eb44769f22438cc1..7e740a311eefc6aa04853edf336ecadef069406c 100644
--- a/lib_dec/lib_dec_fx.c
+++ b/lib_dec/lib_dec_fx.c
@@ -1444,9 +1444,11 @@ static ivas_error IVAS_DEC_Setup(
{
// fixedToFloat_arrL( st_ivas->hParamMC->h_output_synthesis_params.proto_matrix_fx, st_ivas->hParamMC->h_output_synthesis_params.proto_matrix, 26, st_ivas->hParamMC->h_output_synthesis_params.proto_matrix_len );
IF( st_ivas->hParamMC->diff_proto_info )
- FOR( i = 0; i < st_ivas->hParamMC->diff_proto_info->num_protos_diff; i++ )
{
- fixedToFloat_arrL( st_ivas->hParamMC->diff_proto_info->proto_fac_fx[i], st_ivas->hParamMC->diff_proto_info->proto_fac[i], 26, st_ivas->hParamMC->diff_proto_info->num_source_chan_diff[i] );
+ FOR( i = 0; i < st_ivas->hParamMC->diff_proto_info->num_protos_diff; i++ )
+ {
+ fixedToFloat_arrL( st_ivas->hParamMC->diff_proto_info->proto_fac_fx[i], st_ivas->hParamMC->diff_proto_info->proto_fac[i], 26, st_ivas->hParamMC->diff_proto_info->num_source_chan_diff[i] );
+ }
}
}
}
@@ -2703,7 +2705,7 @@ ivas_error IVAS_DEC_GetDelay(
}
move32();
- nSamples[1] = NS2SA_fx2( hDecoderConfig->output_Fs, get_delay_fx( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0] ) );
+ nSamples[1] = NS2SA_FX2( hDecoderConfig->output_Fs, get_delay_fx( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0] ) );
move16();
nSamples[2] = (Word16) W_round64_L( W_mult0_32_32( L_shl( st_ivas->binaural_latency_ns, 1 ), out_fs_fx ) );
move16();
@@ -2713,7 +2715,7 @@ ivas_error IVAS_DEC_GetDelay(
IF( EQ_16( (Word16) st_ivas->ivas_format, MASA_FORMAT ) )
{
/* note: in MASA, all delay is compensated at the decoder by default, so subtract the encoder delay for print-out */
- nSamples[1] = sub( nSamples[1], NS2SA_fx2( hDecoderConfig->output_Fs, IVAS_ENC_DELAY_NS ) );
+ nSamples[1] = sub( nSamples[1], NS2SA_FX2( hDecoderConfig->output_Fs, IVAS_ENC_DELAY_NS ) );
move16();
}
@@ -3894,7 +3896,6 @@ static ivas_error input_format_API_to_internal(
BREAK;
default:
return IVAS_ERR_INVALID_BITSTREAM;
- BREAK;
}
move16();
diff --git a/lib_dec/ppp_dec_fx.c b/lib_dec/ppp_dec_fx.c
index b3514a980081ca07f710a706903949889c7c93e6..7d8bcb0056c5b4640c1fd93be4646f45e20cf550 100644
--- a/lib_dec/ppp_dec_fx.c
+++ b/lib_dec/ppp_dec_fx.c
@@ -365,6 +365,6 @@ ivas_error ppp_quarter_decoder_fx(
Q2phaseShift_fx( CURRCW_Q_DTFS_FX, temp_fx, CURRCW_Q_DTFS_FX->lag_fx, S_fx, C_fx );
}
- count_free( PREVDTFS_FX );
+ free( PREVDTFS_FX );
return error;
}
diff --git a/lib_dec/rom_dec.c b/lib_dec/rom_dec.c
index 062f4df35b5b9a5926d08d1092dc8e046fe4354c..8a2169f802dc3b1b331cd5021e5c6b7619601169 100644
--- a/lib_dec/rom_dec.c
+++ b/lib_dec/rom_dec.c
@@ -47,7 +47,7 @@
*----------------------------------------------------------------------------------*/
const float h_low[5] = { -0.0125f, 0.1090f, 0.7813f, 0.1090f, -0.0125f };
-const Word16 H_low[5] =
+const Word16 h_low_fx[5] =
{
-410, 3572, 25602, 3572, -410
};
diff --git a/lib_dec/rom_dec.h b/lib_dec/rom_dec.h
index 6402bb6d3d32c94a431b0ceb057bedf265b08b53..dca09eedf89754a4a28bf76ac1ed2e7139f9a976 100644
--- a/lib_dec/rom_dec.h
+++ b/lib_dec/rom_dec.h
@@ -42,7 +42,7 @@
#include "cnst.h"
extern const float h_low[]; /* LP filter for filtering periodic part of excitation in artificial onset construction after FEC */
-extern const Word16 H_low[5];
+extern const Word16 h_low_fx[5];
extern const Word16 inv_sqi[15];
extern const Word16 sqi[15];
extern const int16_t mult_avq_tab[];
diff --git a/lib_dec/swb_bwe_dec.c b/lib_dec/swb_bwe_dec.c
index 9264d6900a9ce734083e2c0bda347afd30a3514b..967070b7814d76aa7840954256ee64114e2215c8 100644
--- a/lib_dec/swb_bwe_dec.c
+++ b/lib_dec/swb_bwe_dec.c
@@ -45,8 +45,6 @@
#include "basop_proto_func.h"
#include "wmc_auto.h"
-#ifdef IVAS_FLOAT_FIXED
-#endif // IVAS_FLOAT_FIXED
#ifndef IVAS_FLOAT_FIXED
/*-------------------------------------------------------------------*
diff --git a/lib_dec/swb_bwe_dec_hr.c b/lib_dec/swb_bwe_dec_hr.c
index 1332bec6043bf51c1e74dd34ae23bc06ac862875..949b45481b52e5434463bb90f4ae7fa8c9bb8b99 100644
--- a/lib_dec/swb_bwe_dec_hr.c
+++ b/lib_dec/swb_bwe_dec_hr.c
@@ -42,7 +42,7 @@
#include "wmc_auto.h"
#ifdef IVAS_FLOAT_FIXED
#include "prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
+#endif
/*-------------------------------------------------------------------*
* swb_bwe_dec_hr()
diff --git a/lib_dec/tonalMDCTconcealment.c b/lib_dec/tonalMDCTconcealment.c
index f3456310ad5232b9c45b87ffca39f7c427f88262..328c00d184ff0059b2282f67adfcbdbcb8de3e5f 100644
--- a/lib_dec/tonalMDCTconcealment.c
+++ b/lib_dec/tonalMDCTconcealment.c
@@ -46,7 +46,7 @@
#ifdef IVAS_FLOAT_FIXED
#include "ivas_prot_fx.h"
#include "prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
+#endif
/*******************************************************/
diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c
index d4f558893f0f5c91befcb14891468c144ebde27e..b2828ae9f6a1cb101cdb029f74ce394cd2427603 100644
--- a/lib_dec/tonalMDCTconcealment_fx.c
+++ b/lib_dec/tonalMDCTconcealment_fx.c
@@ -2780,13 +2780,14 @@ void TonalMDCTConceal_InsertNoise(
}
void TonalMDCTConceal_Apply(
- const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */
- Word32 *mdctSpectrum, /*IN/OUT*/
- Word16 *mdctSpectrum_exp /*IN */
+ const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */
+ Word32 *mdctSpectrum, /*IN/OUT*/
+ Word16 *mdctSpectrum_exp /*IN */
#ifdef IVAS_CODE_MDCT_GSHAPE
- ,const PsychoacousticParameters* psychParamsCurrent)
+ ,
+ const PsychoacousticParameters *psychParamsCurrent
#endif
- )
+)
{
Word16 i, l, exp;
Word16 *phaseDiff, *pCurrentPhase;
diff --git a/lib_dec/updt_dec_fx.c b/lib_dec/updt_dec_fx.c
index 28de7cca5017ebd0bad10c640f58730424e5ef2a..1518fa50c0ec4dd87335395a2ab41360a09d23e8 100644
--- a/lib_dec/updt_dec_fx.c
+++ b/lib_dec/updt_dec_fx.c
@@ -575,7 +575,7 @@ void updt_dec_common_fx(
test();
IF( EQ_16( st_fx->element_mode, EVS_MONO ) && NE_16( st_fx->core, AMR_WB_CORE ) )
{
- Copy_Scale_sig( synth + NS2SA_fx2( st_fx->output_Fs, ACELP_LOOK_NS + DELAY_BWE_TOTAL_NS ), st_fx->old_synth_sw_fx, NS2SA_fx2( st_fx->output_Fs, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS ), st_fx->hHQ_core->Q_old_postdec );
+ Copy_Scale_sig( synth + NS2SA_FX2( st_fx->output_Fs, ACELP_LOOK_NS + DELAY_BWE_TOTAL_NS ), st_fx->old_synth_sw_fx, NS2SA_FX2( st_fx->output_Fs, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS ), st_fx->hHQ_core->Q_old_postdec );
}
test();
test();
@@ -968,7 +968,7 @@ void ivas_updt_dec_common_fx(
test();
IF( EQ_16( st_fx->element_mode, EVS_MONO ) && NE_16( st_fx->core, AMR_WB_CORE ) )
{
- Copy_Scale_sig_32_16( synth + NS2SA_fx2( st_fx->output_Fs, ACELP_LOOK_NS + DELAY_BWE_TOTAL_NS ), st_fx->old_synth_sw_fx, NS2SA_fx2( st_fx->output_Fs, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS ), st_fx->hHQ_core->Q_old_postdec );
+ Copy_Scale_sig_32_16( synth + NS2SA_FX2( st_fx->output_Fs, ACELP_LOOK_NS + DELAY_BWE_TOTAL_NS ), st_fx->old_synth_sw_fx, NS2SA_FX2( st_fx->output_Fs, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS ), st_fx->hHQ_core->Q_old_postdec );
}
test();
test();
@@ -993,7 +993,7 @@ void ivas_updt_dec_common_fx(
IF( st_fx->element_mode != EVS_MONO )
{
Word16 q_div = sub( Q31, shl( Qpostd, 1 ) );
- Word16 output_frame = NS2SA_fx2( st_fx->output_Fs, FRAME_SIZE_NS );
+ Word16 output_frame = NS2SA_FX2( st_fx->output_Fs, FRAME_SIZE_NS );
move16();
Word32 sum_val = sum_32_32_fx( synth, output_frame );
Word32 div_val = BASOP_Util_Divide3232_Scale( sum_val, output_frame, &q_div );
diff --git a/lib_dec/voiced_dec_fx.c b/lib_dec/voiced_dec_fx.c
index 827089e0190318fe34c86bcddc1f962df9c524f9..a0f47e75bec4e8aeb48a030c5cb6ee0555e34069 100644
--- a/lib_dec/voiced_dec_fx.c
+++ b/lib_dec/voiced_dec_fx.c
@@ -395,9 +395,9 @@ ivas_error ppp_voiced_decoder_fx(
hSC_VBR->dtfs_dec_Q = dtfs_temp_fx->Q;
move16();
- count_free( TMPDTFS_FX );
- count_free( CURRP_Q_D_FX );
- count_free( dtfs_temp_fx );
+ free( TMPDTFS_FX );
+ free( CURRP_Q_D_FX );
+ free( dtfs_temp_fx );
return IVAS_ERR_OK;
}
diff --git a/lib_dec/waveadjust_fec_dec_fx.c b/lib_dec/waveadjust_fec_dec_fx.c
index d305ad27db529291ec775a49b612804831ccf760..083c7854cc7fa7948d7042a7638537b455d7c99d 100644
--- a/lib_dec/waveadjust_fec_dec_fx.c
+++ b/lib_dec/waveadjust_fec_dec_fx.c
@@ -920,7 +920,7 @@ void concealment_decode_fix( Word16 curr_mode, Word32 *invkoef, Word16 *invkoef_
IF( EQ_16( curr_mode, 1 ) )
{
/* copy the data of the last frame */
- Copy32( plcInfo->data_reci2_fx, invkoef, N );
+ MVR2R_WORD32( plcInfo->data_reci2_fx, invkoef, N );
*invkoef_scale = plcInfo->data_reci2_scale;
move16();
/* sign randomization */
@@ -1416,7 +1416,7 @@ static Word16 waveform_adj_fix( Word16 *overlapbuf,
/* use last good signal for noise generation */
add_noise( sbuf, outx_new_n1, outdata2, tmp, nsapp_gain, nsapp_gain_n, 1 );
/* save current (noisy) output from IMDCT */
- Copy( outx_new, data_noise, tmp );
+ MVR2R_WORD16( outx_new, data_noise, tmp );
/* overlapbuf can now be filled with sbuf, needed for subsequently lost frames */
Copy( pitch125_data, &overlapbuf[Framesize / 4], shr( imult1616( 3, Framesize ), 2 ) );
}
@@ -1481,7 +1481,7 @@ void waveform_adj2_fix( Word16 *overlapbuf,
/* save current (noisy) output from IMDCT */
IF( bfi )
{
- Copy( outx_new, noise_ptr, size );
+ MVR2R_WORD16( outx_new, noise_ptr, size );
}
}
test();
diff --git a/lib_enc/acelp_core_switch_enc_fx.c b/lib_enc/acelp_core_switch_enc_fx.c
index f2558851bd7bab39c835fb0dc63302cc6bc07695..9ab60f5d76c32855bc03b007e9cc6f56e55d054e 100644
--- a/lib_enc/acelp_core_switch_enc_fx.c
+++ b/lib_enc/acelp_core_switch_enc_fx.c
@@ -437,7 +437,7 @@ static void bwe_switch_enc_fx(
Flag Overflow = 0;
#endif
hBstr = st_fx->hBstr;
- L = NS2SA_fx2( st_fx->input_Fs, FRAME_SIZE_NS );
+ L = NS2SA_FX2( st_fx->input_Fs, FRAME_SIZE_NS );
/* set multiplication factor according to the sampling rate */
tmp = extract_l( L_shr( st_fx->input_Fs, 14 ) );
diff --git a/lib_enc/amr_wb_enc_fx.c b/lib_enc/amr_wb_enc_fx.c
index 8edf03a4c92a54f3714da1387974d124fc1ff160..4a3d44fe3d58017caa1f8ad96f823d36458cdd01 100644
--- a/lib_enc/amr_wb_enc_fx.c
+++ b/lib_enc/amr_wb_enc_fx.c
@@ -160,7 +160,7 @@ void amr_wb_enc_fx(
*----------------------------------------------------------------*/
/* get delay to synchronize ACELP and MDCT frame */
- delay = NS2SA_fx2( st->input_Fs, DELAY_FIR_RESAMPL_NS );
+ delay = NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS );
Copy( st->input_fx - delay, st->old_input_signal_fx, input_frame + delay );
@@ -451,7 +451,7 @@ void amr_wb_enc_fx(
IF( EQ_32( st->input_Fs, 16000 ) )
{
/* no resampling needed, only delay adjustement to account for the FIR resampling delay */
- tmps = NS2SA_fx2( 16000, DELAY_FIR_RESAMPL_NS );
+ tmps = NS2SA_FX2( 16000, DELAY_FIR_RESAMPL_NS );
Copy_Scale_sig( &st->mem_decim16k_fx[tmps], new_inp_16k, tmps, -1 ); /* Input in Q0 -> Output in Q-1 to mimic the resampling filter */
Copy_Scale_sig( st->input_fx, new_inp_16k + tmps, sub( input_frame, tmps ), -1 ); /* Input in Q0 -> Output in Q-1 to mimic the resampling filter */
Copy( st->input_fx + input_frame - shl( tmps, 1 ), st->mem_decim16k_fx, shl( tmps, 1 ) ); /* memory still in Q0 */
diff --git a/lib_enc/analy_lp_fx.c b/lib_enc/analy_lp_fx.c
index b8582d2710cb861ce71d567486d957e0ce760af2..314f7a9c2ffe687d944c448f70dcbeb1dd4f1589 100644
--- a/lib_enc/analy_lp_fx.c
+++ b/lib_enc/analy_lp_fx.c
@@ -145,7 +145,7 @@ void analy_lp_AMR_WB_fx(
/* Initialization */
wind_length = L_LP_AMR_WB;
move16();
- wind = Hamcos_Window;
+ wind = hamcos_window_fx;
/* Autocorrelations */
autocorr_fx( speech - L_SUBFR, M, r_h, r_l, &Q_r[0], wind_length, wind, 0, 0 );
diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c
index 0a747b4771c50441ccf7ef606dd8b18d784c8915..86ca20698746a0e43461bdec0f0a08f8567bcd4d 100644
--- a/lib_enc/cod_tcx_fx.c
+++ b/lib_enc/cod_tcx_fx.c
@@ -1201,7 +1201,7 @@ void QuantizeSpectrum_fx(
move16();
aldo = 0;
move16();
- nz = NS2SA_fx2( st->sr_core, N_ZERO_MDCT_NS );
+ nz = NS2SA_FX2( st->sr_core, N_ZERO_MDCT_NS );
move16();
/* Modified the overlap to the delay in case of short blocks*/
tcx_offset = hTcxCfg->tcx_offset;
diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c
index dba3ce8359a831ccb578177274becda38cd6a886..58657bb6b78f737852110fc86262ef8ab352ae90 100644
--- a/lib_enc/core_enc_init_fx.c
+++ b/lib_enc/core_enc_init_fx.c
@@ -97,9 +97,9 @@ void init_coder_ace_plus_fx(
}
/* Core Lookahead */
- st->encoderLookahead_enc = NS2SA_fx2( st->sr_core, ACELP_LOOK_NS );
+ st->encoderLookahead_enc = NS2SA_FX2( st->sr_core, ACELP_LOOK_NS );
move16();
- st->encoderLookahead_FB = NS2SA_fx2( st->input_Fs, ACELP_LOOK_NS );
+ st->encoderLookahead_FB = NS2SA_FX2( st->input_Fs, ACELP_LOOK_NS );
move16();
IF( st->ini_frame == 0 )
diff --git a/lib_enc/core_switching_enc_fx.c b/lib_enc/core_switching_enc_fx.c
index 4494f01040b1e5e76d240eba091d7aaf690a2cbe..fe470af2df29bc6a5dc5242a86f45f6985fcf17b 100644
--- a/lib_enc/core_switching_enc_fx.c
+++ b/lib_enc/core_switching_enc_fx.c
@@ -430,8 +430,8 @@ void core_switching_post_enc_fx(
test();
IF( ( EQ_16( st_fx->last_core, ACELP_CORE ) || EQ_16( st_fx->last_core, AMR_WB_CORE ) ) && EQ_16( st_fx->element_mode, EVS_MONO ) ) /* core switching ==> CELP subframe encoding */
{
- acelp_core_switch_enc_fx( st_fx, old_inp_12k8 + L_INP_MEM - NS2SA_fx2( INT_FS_FX, ACELP_LOOK_NS ),
- old_inp_16k + L_INP_MEM - NS2SA_fx2( INT_FS_16k, ACELP_LOOK_NS ), A, Qshift, Q_new );
+ acelp_core_switch_enc_fx( st_fx, old_inp_12k8 + L_INP_MEM - NS2SA_FX2( INT_FS_FX, ACELP_LOOK_NS ),
+ old_inp_16k + L_INP_MEM - NS2SA_FX2( INT_FS_16k, ACELP_LOOK_NS ), A, Qshift, Q_new );
}
hBWE_TD->bwe_non_lin_prev_scale_fx = L_deposit_l( 0 );
diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c
index 59e2a359e0009de2e98cb776d8c363d26fb43138..a228b0b6d8e14f86261685f6f2ddf0b4c0aec31e 100644
--- a/lib_enc/enc_higher_acelp_fx.c
+++ b/lib_enc/enc_higher_acelp_fx.c
@@ -374,7 +374,7 @@ void transf_cdbk_enc_fx(
st->last_code_preq = (int16_t) code_preQ[L_SUBFR - 1];
#endif
- preemph_fx( code_preQ, FAC_PRE_AVQ_FX, L_SUBFR, &( st_fx->mem_preemp_preQ_fx ) );
+ PREEMPH_FX( code_preQ, FAC_PRE_AVQ_FX, L_SUBFR, &( st_fx->mem_preemp_preQ_fx ) );
/*--------------------------------------------------------------*
* For inactive segments
@@ -440,7 +440,7 @@ static void find_cn_fx(
Copy( xn, tmp_fl + M, L_SUBFR );
tmp = 0;
move16();
- preemph_fx( tmp_fl + M, PREEMPH_FAC_16k, L_SUBFR, &tmp );
+ PREEMPH_FX( tmp_fl + M, PREEMPH_FAC_16k, L_SUBFR, &tmp );
syn_filt_s_lc_fx( 0, Ap, tmp_fl + M, tmp_fl + M, L_SUBFR );
Residu3_lc_fx( p_Aq, M, tmp_fl + M, cn, L_SUBFR, 1 );
diff --git a/lib_enc/evs_enc_fx.c b/lib_enc/evs_enc_fx.c
index 92cb8700088d3f10d8048d94997441d98625f2e5..40b1d7b56f54d06f427ef151a0f3c44a7229ca4b 100644
--- a/lib_enc/evs_enc_fx.c
+++ b/lib_enc/evs_enc_fx.c
@@ -137,7 +137,7 @@ ivas_error evs_enc_fx(
*----------------------------------------------------------------*/
/* get delay to synchronize ACELP and MDCT frame */
- delay = NS2SA_fx2( st->input_Fs, DELAY_FIR_RESAMPL_NS );
+ delay = NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS );
Copy( st->input_fx - delay, st->old_input_signal_fx, input_frame + delay );
diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c
index ccc4498d95d572101bda557a6e4fc408bede979d..ee7c572c007f2ff86af1fc1530307bca09676481 100644
--- a/lib_enc/ext_sig_ana_fx.c
+++ b/lib_enc/ext_sig_ana_fx.c
@@ -74,9 +74,11 @@ void core_signal_analysis_high_bitrate_fx(
TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc;
#ifndef IVAS_CODE
+ /* dummy */
(void) vad_hover_flag;
(void) last_element_mode;
#endif
+
#ifdef IVAS_CODE
if ( NE_16( last_element_mode, st->element_mode ) )
{
@@ -551,67 +553,71 @@ void core_signal_analysis_high_bitrate_fx(
{
set_f( &mdst_spectrum[frameno][MCT_LFE_MAX_LINE], 0.f, L_subframe - MCT_LFE_MAX_LINE );
}
-#endif
}
- IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) )
- {
- test();
- test();
- TNSAnalysis_fx( st->hTcxCfg, L_frameTCX,
- st->hTcxCfg->tcx_coded_lines,
- transform_type[frameno], ( frameno == 0 ) && ( st->last_core == ACELP_CORE ),
- spectrum[frameno], &hTcxEnc->tnsData[frameno], &hTcxEnc->fUseTns[frameno], NULL );
+#endif
+ }
+
+ IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) )
+ {
+ test();
+ test();
+ TNSAnalysis_fx( st->hTcxCfg, L_frameTCX,
+ st->hTcxCfg->tcx_coded_lines,
+ transform_type[frameno], ( frameno == 0 ) && ( st->last_core == ACELP_CORE ),
+ spectrum[frameno], &hTcxEnc->tnsData[frameno], &hTcxEnc->fUseTns[frameno], NULL );
#ifdef IVAS_CODE
- IF( st->hTcxCfg->fIsTNSAllowed )
+ IF( st->hTcxCfg->fIsTNSAllowed )
#endif
+ {
+ EncodeTnsData_fx( st->hTcxCfg->pCurrentTnsConfig, &hTcxEnc->tnsData[frameno],
+ param_core + frameno * NPRM_DIV + 1 + NOISE_FILL_RANGES + LTPSIZE, pTnsSize + frameno, pTnsBits + frameno );
+ }
+ IF( EQ_16( transform_type[frameno], TCX_5 ) )
+ {
+ /* group sub-windows: interleave bins according to their frequencies */
+ FOR( i = 0; i < tcx5SizeFB; i++ )
{
- EncodeTnsData_fx( st->hTcxCfg->pCurrentTnsConfig, &hTcxEnc->tnsData[frameno],
- param_core + frameno * NPRM_DIV + 1 + NOISE_FILL_RANGES + LTPSIZE, pTnsSize + frameno, pTnsBits + frameno );
- }
- IF( EQ_16( transform_type[frameno], TCX_5 ) )
- {
- /* group sub-windows: interleave bins according to their frequencies */
- FOR( i = 0; i < tcx5SizeFB; i++ )
- {
- interleaveBuf[2 * i] = spectrum[frameno][i];
- move32();
- interleaveBuf[2 * i + 1] = spectrum[frameno][tcx5SizeFB + i];
- move32();
- }
- Copy32( interleaveBuf, spectrum[frameno], tcx10SizeFB );
+ interleaveBuf[2 * i] = spectrum[frameno][i];
+ move32();
+ interleaveBuf[2 * i + 1] = spectrum[frameno][tcx5SizeFB + i];
+ move32();
}
+ MVR2R_WORD32( interleaveBuf, spectrum[frameno], tcx10SizeFB );
+ }
- /*--------------------------------------------------------------*
- * LPC analysis
- *---------------------------------------------------------------*/
+ /*--------------------------------------------------------------*
+ * LPC analysis
+ *---------------------------------------------------------------*/
#ifdef IVAS_CODE
- IF( st->tcxonly )
+ IF( st->tcxonly )
#endif
- {
- HBAutocorrelation_fx( st->hTcxCfg, lpc_left_overlap_mode, lpc_right_overlap_mode, &st->speech_enc_pe[frameno * tcx10Size],
- shr( L_frame, sub( nSubframes, 1 ) ), r, M );
-
- FOR( i = 0; i <= M; i++ )
- {
- move16();
- move16();
- r_l[frameno][i] = L_Extract_lc( r[i], &r_h[frameno][i] );
- }
-
- adapt_lag_wind( r_h[frameno], r_l[frameno], M, alw_pitch_lag_12k8[frameno], alw_voicing[frameno], st->sr_core );
-
- E_LPC_lev_dur( r_h[frameno], r_l[frameno], A, epsP, M, NULL );
+ {
+ HBAutocorrelation_fx( st->hTcxCfg, lpc_left_overlap_mode, lpc_right_overlap_mode, &st->speech_enc_pe[frameno * tcx10Size],
+ shr( L_frame, sub( nSubframes, 1 ) ), r, M );
- E_LPC_a_lsp_conversion( A, lsp[nSubframes - 1 - frameno], st->lspold_enc_fx, M );
- }
- IF( st->igf )
+ FOR( i = 0; i <= M; i++ )
{
- ProcessIGF_fx( st->hIGFEnc, st, spectrum[frameno], &( spectrum_e[frameno] ), powerSpec, &powerSpec_e, transform_type[frameno] == TCX_20, hTcxEnc->fUseTns[frameno], ( st->last_core == ACELP_CORE ), frameno );
+ move16();
+ move16();
+ r_l[frameno][i] = L_Extract_lc( r[i], &r_h[frameno][i] );
}
- /* Copy memory */
- Copy( lsp_new, st->lspold_enc_fx, M );
+ adapt_lag_wind( r_h[frameno], r_l[frameno], M, alw_pitch_lag_12k8[frameno], alw_voicing[frameno], st->sr_core );
+
+ E_LPC_lev_dur( r_h[frameno], r_l[frameno], A, epsP, M, NULL );
+
+ E_LPC_a_lsp_conversion( A, lsp[nSubframes - 1 - frameno], st->lspold_enc_fx, M );
}
+ IF( st->igf )
+ {
+ ProcessIGF_fx( st->hIGFEnc, st, spectrum[frameno], &( spectrum_e[frameno] ), powerSpec, &powerSpec_e, transform_type[frameno] == TCX_20, hTcxEnc->fUseTns[frameno], ( st->last_core == ACELP_CORE ), frameno );
+ }
+
+ /* Copy memory */
+ MVR2R_WORD16( lsp_new, st->lspold_enc_fx, M );
}
}
+
+ return;
+}
diff --git a/lib_enc/find_uv_fx.c b/lib_enc/find_uv_fx.c
index ec934ad9c5ee93bac3e3c267bf815d480831d0c6..778e7b51a80dbabf5cc77cdc978df6cfbed03b26 100644
--- a/lib_enc/find_uv_fx.c
+++ b/lib_enc/find_uv_fx.c
@@ -476,22 +476,27 @@ Word16 find_uv_fx( /* o : coding type
test();
#ifdef BASOP_NOGLOB
if ( ( ( LT_16( add_o( mean_voi3, corr_shift, &Overflow ), add( 22774, mean_voi3_offset ) ) ) && /* normalized correlation low */
-#else /* BASOP_NOGLOB */
- if ( ( ( LT_16( add( mean_voi3, corr_shift ), add( 22774, mean_voi3_offset ) ) ) && /* normalized correlation low */
-#endif
-#ifdef BASOP_NOGLOB
- ( LT_16( add_sat( st_fx->voicing_fx[2], corr_shift ), 25887 ) ) && /* normalized correlation low on look-ahead - onset detection */
+ ( LT_16( add_sat( st_fx->voicing_fx[2], corr_shift ), 25887 ) ) && /* normalized correlation low on look-ahead - onset detection */
+ ( LT_32( ee[0], 397 ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */
+ ( LT_32( ee[1], 397 ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */
+ ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */
+ /*( st_fx->music_hysteresis_fx == 0 ) && */ /* ... and in segment after AUDIO frames */
+ ( LE_32( dE1, 245760 ) ) && /* Avoid on sharp energy spikes */
+ ( LE_32( st_fx->old_dE1_fx, 245760 ) ) && /* + one frame hysteresis */
+ ( st_fx->spike_hyst < 0 ) ) /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */
+ || ( flag_low_relE && ( LE_32( st_fx->old_dE1_fx, 245760 ) ) ) ) /* low relative frame energy (only for SC-VBR) */
#else
+ if ( ( ( LT_16( add( mean_voi3, corr_shift ), add( 22774, mean_voi3_offset ) ) ) && /* normalized correlation low */
( LT_16( add( st_fx->voicing_fx[2], corr_shift ), 25887 ) ) && /* normalized correlation low on look-ahead - onset detection */
+ ( LT_32( ee[0], 397 ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */
+ ( LT_32( ee[1], 397 ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */
+ ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */
+ /*( st_fx->music_hysteresis_fx == 0 ) && */ /* ... and in segment after AUDIO frames */
+ ( LE_32( dE1, 245760 ) ) && /* Avoid on sharp energy spikes */
+ ( LE_32( st_fx->old_dE1_fx, 245760 ) ) && /* + one frame hysteresis */
+ ( st_fx->spike_hyst < 0 ) ) /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */
+ || ( flag_low_relE && ( LE_32( st_fx->old_dE1_fx, 245760 ) ) ) ) /* low relative frame energy (only for SC-VBR) */
#endif
- ( LT_32( ee[0], 397 ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */
- ( LT_32( ee[1], 397 ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */
- ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */
- /*( st_fx->music_hysteresis_fx == 0 ) && */ /* ... and in segment after AUDIO frames */
- ( LE_32( dE1, 245760 ) ) && /* Avoid on sharp energy spikes */
- ( LE_32( st_fx->old_dE1_fx, 245760 ) ) && /* + one frame hysteresis */
- ( st_fx->spike_hyst < 0 ) ) /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */
- || ( flag_low_relE && ( LE_32( st_fx->old_dE1_fx, 245760 ) ) ) ) /* low relative frame energy (only for SC-VBR) */
{
coder_type = UNVOICED;
move16();
diff --git a/lib_enc/igf_enc_fx.c b/lib_enc/igf_enc_fx.c
index b179794af933b6cde5ab766792471f36189c274d..61b844fde1d5bbcc0710fcbb89fa2bf8c1816ba0 100644
--- a/lib_enc/igf_enc_fx.c
+++ b/lib_enc/igf_enc_fx.c
@@ -251,14 +251,19 @@ static void IGF_CalculateEnvelope( const IGF_ENC_INSTANCE_HANDLE hInstance, /**<
}
#ifdef BASOP_NOGLOB
BASOP_Util_Divide_MantExp( round_fx_sat( sfbEnergyR[sfb] ),
+ sfbEnergyR_exp[sfb],
+ width,
+ 15,
+ &gain,
+ &gain_exp );
#else
BASOP_Util_Divide_MantExp( round_fx( sfbEnergyR[sfb] ),
-#endif
sfbEnergyR_exp[sfb],
width,
15,
&gain,
&gain_exp );
+#endif
L_tmp = L_deposit_h( gain );
}
diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c
index a99092fdd26b48902e7c4d3e96bac25a35fb7973..ac191c7ff89ed31926c142caf352b1aa5eb3a745 100644
--- a/lib_enc/init_enc.c
+++ b/lib_enc/init_enc.c
@@ -47,7 +47,6 @@
#ifdef IVAS_FLOAT_FIXED
#include "ivas_prot_fx.h"
#endif
-#include "tools_fx.c"
#include "prot_fx_enc.h"
/*-----------------------------------------------------------------------*
@@ -351,8 +350,8 @@ ivas_error init_encoder(
if ( st->element_mode == EVS_MONO )
{
#ifdef IVAS_FLOAT_FIXED
- st->input_fx = st->input_buff_fx + st->input_Fs / FRAMES_PER_SEC + NS2SA_fx2( st->input_Fs, DELAY_FIR_RESAMPL_NS );
- st->input32_fx = st->input_buff32_fx + st->input_Fs / FRAMES_PER_SEC + NS2SA_fx2( st->input_Fs, DELAY_FIR_RESAMPL_NS );
+ st->input_fx = st->input_buff_fx + st->input_Fs / FRAMES_PER_SEC + NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS );
+ st->input32_fx = st->input_buff32_fx + st->input_Fs / FRAMES_PER_SEC + NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS );
#endif // IVAS_FLOAT_FIXED
st->input = st->input_buff + st->input_Fs / FRAMES_PER_SEC + NS2SA( st->input_Fs, DELAY_FIR_RESAMPL_NS );
}
diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c
index 7d1f5530200f36d03e880168690b8333220fc643..aa7a2954988e09070aab8c9222cd631d69faec8a 100644
--- a/lib_enc/init_enc_fx.c
+++ b/lib_enc/init_enc_fx.c
@@ -40,7 +40,7 @@ ivas_error init_encoder_fx(
*-----------------------------------------------------------------*/
IF( !vad_only_flag )
{
- IF( ( st_fx->hSignalBuf = (SIGNAL_BUFFERS_ENC_HANDLE) count_malloc( sizeof( SIGNAL_BUFFERS_ENC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hSignalBuf = (SIGNAL_BUFFERS_ENC_HANDLE) malloc( sizeof( SIGNAL_BUFFERS_ENC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Signal buffers\n" ) );
}
@@ -129,7 +129,7 @@ ivas_error init_encoder_fx(
IF( !vad_only_flag )
{
- IF( ( st_fx->hBstr = (BSTR_ENC_HANDLE) count_malloc( sizeof( BSTR_ENC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hBstr = (BSTR_ENC_HANDLE) malloc( sizeof( BSTR_ENC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Bitstream structure\n" ) );
}
@@ -174,7 +174,7 @@ ivas_error init_encoder_fx(
test();
IF( st_fx->Opt_AMR_WB || EQ_16( st_fx->element_mode, EVS_MONO ) )
{
- IF( ( st_fx->hAmrwb_IO = (AMRWB_IO_ENC_HANDLE) count_malloc( sizeof( AMRWB_IO_ENC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hAmrwb_IO = (AMRWB_IO_ENC_HANDLE) malloc( sizeof( AMRWB_IO_ENC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for AMR-WB IO\n" ) );
}
@@ -299,7 +299,7 @@ ivas_error init_encoder_fx(
test();
IF( ( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) )
{
- IF( ( st_fx->hGSCEnc = (GSC_ENC_HANDLE) count_malloc( sizeof( GSC_ENC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hGSCEnc = (GSC_ENC_HANDLE) malloc( sizeof( GSC_ENC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for GSC\n" ) );
}
@@ -349,7 +349,7 @@ ivas_error init_encoder_fx(
test();
IF( ( idchan == 0 || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) || EQ_16( st_fx->element_mode, EVS_MONO ) ) && ( !vad_only_flag ) )
{
- if ( ( st_fx->hVAD = (VAD_HANDLE) count_malloc( sizeof( VAD_DATA ) ) ) == NULL )
+ if ( ( st_fx->hVAD = (VAD_HANDLE) malloc( sizeof( VAD_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VAD\n" ) );
}
@@ -403,7 +403,7 @@ ivas_error init_encoder_fx(
// PMT("deal with idchan ")
IF( /*idchan == 0 ||*/ EQ_16( st_fx->element_mode, IVAS_CPE_TD ) || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) || EQ_16( st_fx->element_mode, EVS_MONO ) )
{
- if ( ( st_fx->hNoiseEst = (NOISE_EST_HANDLE) count_malloc( sizeof( NOISE_EST_DATA ) ) ) == NULL )
+ if ( ( st_fx->hNoiseEst = (NOISE_EST_HANDLE) malloc( sizeof( NOISE_EST_DATA ) ) ) == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Noise estimation\n" );
}
@@ -421,7 +421,7 @@ ivas_error init_encoder_fx(
test();
IF( idchan == 0 || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) || EQ_16( st_fx->element_mode, EVS_MONO ) )
{
- IF( ( st_fx->hSpMusClas = (SP_MUS_CLAS_HANDLE) count_malloc( sizeof( SP_MUS_CLAS_DATA ) ) ) == NULL )
+ IF( ( st_fx->hSpMusClas = (SP_MUS_CLAS_HANDLE) malloc( sizeof( SP_MUS_CLAS_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Speech/music classifier\n" ) );
}
@@ -500,7 +500,7 @@ ivas_error init_encoder_fx(
test();
IF( ( ( idchan == 0 && st_fx->Opt_DTX_ON ) || EQ_16( st_fx->element_mode, EVS_MONO ) ) || ( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && st_fx->Opt_DTX_ON ) )
{
- if ( ( st_fx->hDtxEnc = (DTX_ENC_HANDLE) count_malloc( sizeof( DTX_ENC_DATA ) ) ) == NULL )
+ if ( ( st_fx->hDtxEnc = (DTX_ENC_HANDLE) malloc( sizeof( DTX_ENC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DTX variables\n" ) );
}
@@ -533,7 +533,7 @@ ivas_error init_encoder_fx(
test();
IF( ( ( idchan == 0 && st_fx->Opt_DTX_ON && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, EVS_MONO ) ) && !( EQ_16( ism_mode, ISM_MODE_PARAM ) || EQ_16( ism_mode, ISM_MODE_DISC ) ) )
{
- IF( ( st_fx->hTdCngEnc = (TD_CNG_ENC_HANDLE) count_malloc( sizeof( TD_CNG_ENC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hTdCngEnc = (TD_CNG_ENC_HANDLE) malloc( sizeof( TD_CNG_ENC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DTX/TD CNG\n" ) );
}
@@ -554,7 +554,7 @@ ivas_error init_encoder_fx(
test();
IF( ( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) )
{
- IF( ( st_fx->hLPDmem = (LPD_state_HANDLE) count_malloc( sizeof( LPD_state ) ) ) == NULL )
+ IF( ( st_fx->hLPDmem = (LPD_state_HANDLE) malloc( sizeof( LPD_state ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LPDmem\n" ) );
}
@@ -621,7 +621,7 @@ ivas_error init_encoder_fx(
test();
IF( st_fx->Opt_SC_VBR || EQ_16( st_fx->element_mode, EVS_MONO ) )
{
- IF( ( st_fx->hSC_VBR = (SC_VBR_ENC_HANDLE) count_malloc( sizeof( SC_VBR_ENC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hSC_VBR = (SC_VBR_ENC_HANDLE) malloc( sizeof( SC_VBR_ENC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SC-VBR\n" ) );
}
@@ -635,7 +635,7 @@ ivas_error init_encoder_fx(
/* PLC encoder */
IF( EQ_16( st_fx->element_mode, EVS_MONO ) )
{
- IF( ( st_fx->hPlcExt = (PLC_ENC_EVS_HANDLE) count_malloc( sizeof( PLC_ENC_EVS ) ) ) == NULL )
+ IF( ( st_fx->hPlcExt = (PLC_ENC_EVS_HANDLE) malloc( sizeof( PLC_ENC_EVS ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hPlcExt\n" ) );
}
@@ -650,7 +650,7 @@ ivas_error init_encoder_fx(
IF( st_fx->element_mode == EVS_MONO )
{
- IF( ( st_fx->hTECEnc = (TEC_ENC_HANDLE) count_malloc( sizeof( TEC_ENC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hTECEnc = (TEC_ENC_HANDLE) malloc( sizeof( TEC_ENC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TEC\n" ) );
}
@@ -666,7 +666,7 @@ ivas_error init_encoder_fx(
IF( !vad_only_flag )
{
- IF( ( st_fx->hBstr = (BSTR_ENC_HANDLE) count_malloc( sizeof( BSTR_ENC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hBstr = (BSTR_ENC_HANDLE) malloc( sizeof( BSTR_ENC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Bitstream structure\n" ) );
}
@@ -681,7 +681,7 @@ ivas_error init_encoder_fx(
*-----------------------------------------------------------------*/
IF( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) )
{
- IF( ( st_fx->hBWE_FD = (FD_BWE_ENC_HANDLE) count_malloc( sizeof( FD_BWE_ENC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hBWE_FD = (FD_BWE_ENC_HANDLE) malloc( sizeof( FD_BWE_ENC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FD BWE\n" ) );
}
@@ -704,7 +704,7 @@ ivas_error init_encoder_fx(
IF( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) )
{
- IF( ( st_fx->hBWE_TD = (TD_BWE_ENC_HANDLE) count_malloc( sizeof( TD_BWE_ENC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hBWE_TD = (TD_BWE_ENC_HANDLE) malloc( sizeof( TD_BWE_ENC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) );
}
@@ -726,7 +726,7 @@ ivas_error init_encoder_fx(
IF( st_fx->Opt_RF_ON || EQ_16( st_fx->element_mode, EVS_MONO ) )
{
- IF( ( st_fx->hRF = (RF_ENC_HANDLE) count_malloc( sizeof( RF_ENC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hRF = (RF_ENC_HANDLE) malloc( sizeof( RF_ENC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for RF\n" ) );
}
@@ -746,7 +746,7 @@ ivas_error init_encoder_fx(
st_fx->input_fx = st_fx->input_buff_fx + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS );
set16_fx( st_fx->input_buff_fx + L_FRAME48k, 0, L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) );
- st_fx->old_input_signal_fx = st_fx->input_fx - add( NS2SA_fx2( st_fx->input_Fs, DELAY_FIR_RESAMPL_NS ), st_fx->input_frame_fx );
+ st_fx->old_input_signal_fx = st_fx->input_fx - add( NS2SA_FX2( st_fx->input_Fs, DELAY_FIR_RESAMPL_NS ), st_fx->input_frame_fx );
st_fx->Energy_Old_fx = 0;
@@ -767,7 +767,7 @@ ivas_error init_encoder_fx(
// VE: reduction possible for MCT_CHAN_MODE_LFE channel - see I1-172
IF( idchan == 0 || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) )
{
- IF( ( st_fx->hTcxEnc = (TCX_ENC_HANDLE) count_malloc( sizeof( TCX_ENC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hTcxEnc = (TCX_ENC_HANDLE) malloc( sizeof( TCX_ENC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hTcxEnc\n" ) );
}
@@ -786,7 +786,7 @@ ivas_error init_encoder_fx(
/* MDCT classifier */
MDCT_classifier_reset_fx( st_fx->hTcxEnc );
- IF( ( st_fx->hTcxCfg = (TCX_CONFIG_HANDLE) count_malloc( sizeof( TCX_config ) ) ) == NULL )
+ IF( ( st_fx->hTcxCfg = (TCX_CONFIG_HANDLE) malloc( sizeof( TCX_config ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hTcxCfg\n" ) );
}
@@ -804,7 +804,7 @@ ivas_error init_encoder_fx(
test();
IF( NE_16( st_fx->element_mode, IVAS_CPE_TD ) && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) && idchan == 0 )
{
- IF( ( st_fx->hHQ_core = (HQ_ENC_HANDLE) count_malloc( sizeof( HQ_ENC_DATA ) ) ) == NULL )
+ IF( ( st_fx->hHQ_core = (HQ_ENC_HANDLE) malloc( sizeof( HQ_ENC_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HQ core\n" ) );
}
@@ -865,7 +865,7 @@ ivas_error init_encoder_fx(
test();
IF( idchan == 0 || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) )
{
- IF( ( st_fx->hIGFEnc = (IGF_ENC_INSTANCE_HANDLE) count_malloc( sizeof( IGF_ENC_INSTANCE ) ) ) == NULL )
+ IF( ( st_fx->hIGFEnc = (IGF_ENC_INSTANCE_HANDLE) malloc( sizeof( IGF_ENC_INSTANCE ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hIGFEnc\n" ) );
}
@@ -907,7 +907,7 @@ ivas_error init_encoder_fx(
init_coder_ace_plus_fx( st_fx, st_fx->last_total_brate, 0, -10 /*hack*/ );
// PMT("Transient detector init needs review, handle hTranDet is missing")
InitTransientDetection_fx( extract_l( Mult_32_16( st_fx->input_Fs, 0x0290 ) ),
- NS2SA_fx2( st_fx->input_Fs, DELAY_FIR_RESAMPL_NS ),
+ NS2SA_FX2( st_fx->input_Fs, DELAY_FIR_RESAMPL_NS ),
&st_fx->transientDetection );
// reset_indices_enc_fx( st_fx->hBstr);
diff --git a/lib_enc/ivas_agc_enc.c b/lib_enc/ivas_agc_enc.c
index 8e70554102ff12df891f3e86c392ddd1184a17e0..2e4c17c8396836b3beaf0616d97286f3778c5769 100644
--- a/lib_enc/ivas_agc_enc.c
+++ b/lib_enc/ivas_agc_enc.c
@@ -398,7 +398,7 @@ ivas_error ivas_spar_agc_enc_open_fx(
}
input_frame = (Word16) Mpy_32_16_1( input_Fs, INV_FRAME_PER_SEC_Q15 );
- delay = NS2SA_fx2( input_Fs, ( IVAS_ENC_DELAY_NS + IVAS_DEC_DELAY_NS ) );
+ delay = NS2SA_FX2( input_Fs, ( IVAS_ENC_DELAY_NS + IVAS_DEC_DELAY_NS ) );
if ( ( hAgc->agc_com.winFunc_fx = (Word16 *) malloc( sizeof( Word16 ) * ( input_frame - delay ) ) ) == NULL )
{
diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c
index 239e57cfc3f805b8dcd83bf64e01b17193db6dc2..33a06a43a3c91a4db81c42cd24bc4e9773e24cd7 100644
--- a/lib_enc/ivas_core_pre_proc_front.c
+++ b/lib_enc/ivas_core_pre_proc_front.c
@@ -1469,9 +1469,9 @@ ivas_error pre_proc_front_ivas_fx(
st->mem_preemph_fx = st->mem_preemph_DFT_fx;
st->mem_preemph_DFT_fx = old_inp_12k8_fx[L_INP_MEM - STEREO_DFT_OVL_12k8 + L_FRAME - 1];
- preemph_fx( new_inp_12k8_fx - STEREO_DFT_OVL_12k8, PREEMPH_FAC, L_FRAME, &st->mem_preemph_fx );
+ PREEMPH_FX( new_inp_12k8_fx - STEREO_DFT_OVL_12k8, PREEMPH_FAC, L_FRAME, &st->mem_preemph_fx );
dummy_fx = st->mem_preemph_fx;
- preemph_fx( new_inp_12k8_fx - STEREO_DFT_OVL_12k8 + L_FRAME, PREEMPH_FAC_FLT, STEREO_DFT_OVL_12k8, &dummy_fx );
+ PREEMPH_FX( new_inp_12k8_fx - STEREO_DFT_OVL_12k8 + L_FRAME, PREEMPH_FAC_FLT, STEREO_DFT_OVL_12k8, &dummy_fx );
fixedToFloat_arr( new_inp_12k8_fx - STEREO_DFT_OVL_12k8, new_inp_12k8 - STEREO_DFT_OVL_12k8, 0, L_FRAME + STEREO_DFT_OVL_12k8 ); // To be removed
st->mem_preemph = (float) st->mem_preemph_fx;
@@ -1494,7 +1494,7 @@ ivas_error pre_proc_front_ivas_fx(
#endif
st->mem_preemph_fx = st->mem_preemph_DFT_fx;
Copy( st->inp_12k8_mem_stereo_sw_fx, new_inp_12k8_fx - L_MEM_RECALC_12K8 - ( STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT ), STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT );
- preemph_fx( new_inp_12k8_fx - L_MEM_RECALC_12K8 - ( STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT ), PREEMPH_FAC, STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT, &st->mem_preemph_fx );
+ PREEMPH_FX( new_inp_12k8_fx - L_MEM_RECALC_12K8 - ( STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT ), PREEMPH_FAC, STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT, &st->mem_preemph_fx );
fixedToFloat_arr( new_inp_12k8_fx - L_MEM_RECALC_12K8 - ( STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT ), new_inp_12k8 - L_MEM_RECALC_12K8 - ( STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT ), 0, STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT ); // To be removed
}
@@ -1512,16 +1512,16 @@ ivas_error pre_proc_front_ivas_fx(
floatToFixed_arr( new_inp_12k8 - lMemRecalc_12k8 - length_12k8, new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, 0, length_12k8 ); // To be removed
- preemph_fx( new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, PREEMPH_FAC, length_12k8, &st->mem_preemph_fx );
+ PREEMPH_FX( new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, PREEMPH_FAC, length_12k8, &st->mem_preemph_fx );
fixedToFloat_arr( new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, new_inp_12k8 - lMemRecalc_12k8 - length_12k8, 0, length_12k8 ); // To be removed
}
floatToFixed_arr( new_inp_12k8 - lMemRecalc_12k8, new_inp_12k8_fx - lMemRecalc_12k8, 0, L_FRAME + lMemRecalc_12k8 + L_FILT ); // To be removed
- preemph_fx( new_inp_12k8_fx - lMemRecalc_12k8, PREEMPH_FAC, L_FRAME, &st->mem_preemph_fx );
+ PREEMPH_FX( new_inp_12k8_fx - lMemRecalc_12k8, PREEMPH_FAC, L_FRAME, &st->mem_preemph_fx );
dummy_fx = st->mem_preemph_fx;
- preemph_fx( new_inp_12k8_fx - lMemRecalc_12k8 + L_FRAME, PREEMPH_FAC, lMemRecalc_12k8 + L_FILT, &dummy_fx );
+ PREEMPH_FX( new_inp_12k8_fx - lMemRecalc_12k8 + L_FRAME, PREEMPH_FAC, lMemRecalc_12k8 + L_FILT, &dummy_fx );
fixedToFloat_arr( new_inp_12k8_fx - lMemRecalc_12k8, new_inp_12k8 - lMemRecalc_12k8, 0, L_FRAME + lMemRecalc_12k8 + L_FILT ); // To be removed
}
@@ -1530,9 +1530,9 @@ ivas_error pre_proc_front_ivas_fx(
floatToFixed_arr( new_inp_12k8, new_inp_12k8_fx, 0, L_FRAME + L_FILT ); // To be removed
st->mem_preemph_fx = (Word16) st->mem_preemph;
- preemph_fx( new_inp_12k8_fx, PREEMPH_FAC, L_FRAME, &st->mem_preemph_fx );
+ PREEMPH_FX( new_inp_12k8_fx, PREEMPH_FAC, L_FRAME, &st->mem_preemph_fx );
dummy_fx = st->mem_preemph_fx;
- preemph_fx( new_inp_12k8_fx + L_FRAME, PREEMPH_FAC, L_FILT, &dummy_fx );
+ PREEMPH_FX( new_inp_12k8_fx + L_FRAME, PREEMPH_FAC, L_FILT, &dummy_fx );
st->mem_preemph = (float) st->mem_preemph_fx;
dummy = (float) dummy_fx;
diff --git a/lib_enc/ivas_entropy_coder.c b/lib_enc/ivas_entropy_coder.c
index dec1dfc265204bd823e25781dee0548513a3a351..900f0bb49b0850738f755240febb8c93c0f38e41 100644
--- a/lib_enc/ivas_entropy_coder.c
+++ b/lib_enc/ivas_entropy_coder.c
@@ -31,17 +31,20 @@
*******************************************************************************************************/
#include
+#include
#include "options.h"
#include "ivas_cnst.h"
#include "prot.h"
#include "ivas_prot.h"
#include "ivas_rom_com.h"
#include "math.h"
-#include
#include "wmc_auto.h"
#ifdef IVAS_FLOAT_FIXED
#include "ivas_prot_fx.h"
#endif
+#ifdef DEBUGGING
+#include "debug.h"
+#endif
#ifndef IVAS_FLOAT_FIXED
/*-----------------------------------------------------------------------------------------*
@@ -83,7 +86,7 @@ static ivas_error ivas_get_dyn_freq_model(
curr_bps -= ( curr_dist[i] * pArith->saved_dist_arr[0][i] );
}
curr_bps_min = curr_bps;
-#ifdef DUMPS_ENABLED
+#ifdef DEBUGGING
dbgwrite_txt( &curr_bps_min, 1, "float_curr_bps_min.txt", NULL );
#endif
model_idx = 0;
@@ -95,7 +98,7 @@ static ivas_error ivas_get_dyn_freq_model(
{
curr_bps_new -= ( curr_dist[i] * pArith->saved_dist_arr[m + 1][i] );
}
-#ifdef DUMPS_ENABLED
+#ifdef DEBUGGING
dbgwrite_txt( &curr_bps_new, 1, "float_curr_bps_new.txt", NULL );
#endif
if ( curr_bps_new < curr_bps_min )
@@ -159,7 +162,7 @@ static ivas_error ivas_get_dyn_freq_model_fx(
curr_bps = L_sub( curr_bps, curr_dist[i] * pArith->saved_dist_arr[0][i] );
}
curr_bps_min = curr_bps;
-#ifdef DUMPS_ENABLED
+#ifdef DEBUGGING
{
float a = curr_bps_min / 32768.0f;
dbgwrite_txt( &a, 1, "fixed_curr_bps_min.txt", NULL );
@@ -174,7 +177,7 @@ static ivas_error ivas_get_dyn_freq_model_fx(
{
curr_bps_new = L_sub( curr_bps_new, ( curr_dist[i] * pArith->saved_dist_arr[m + 1][i] ) );
}
-#ifdef DUMPS_ENABLED
+#ifdef DEBUGGING
{
float a = curr_bps_new / 32768.0f;
dbgwrite_txt( &a, 1, "fixed_curr_bps_new.txt", NULL );
diff --git a/lib_enc/ivas_front_vad.c b/lib_enc/ivas_front_vad.c
index 7a835228e302eb104735ecdaade2fe82e557acc6..78e265baaddab83f174a90ae1d969612b288481b 100644
--- a/lib_enc/ivas_front_vad.c
+++ b/lib_enc/ivas_front_vad.c
@@ -513,7 +513,7 @@ ivas_error front_vad_spar(
floatToFixed_arr( st->mem_decim2, st->mem_decim2_fx, Q10, 3 );
// st->mem_wsp_fx = (Word16) floatToFixed( st->mem_wsp, Q_inp_12k8 );
- Copy( st->old_wsp_fx, old_wsp_fx, L_WSP_MEM );
+ MVR2R_WORD16( st->old_wsp_fx, old_wsp_fx, L_WSP_MEM );
wsp = old_wsp + L_WSP_MEM;
wsp_fx = old_wsp_fx + L_WSP_MEM;
@@ -769,7 +769,7 @@ ivas_error front_vad_spar(
#if 0
vad_param_updt( st, corr_shift, corr_shift, A, st->pitch[1], &hFrontVad, 1 );
#else
- // Copy( st->pitch, st->pitch, 3 );
+ MVR2R_WORD16( st->pitch, st->pitch, 3 );
corr_shift_fx = (Word16) floatToFixed( corr_shift, Q15 );
hFrontVad->hVAD->running_avg_fx = (Word16) floatToFixed( hFrontVad->hVAD->running_avg, Q15 );
hFrontVad->hVAD->ra_deltasum_fx = (Word16) floatToFixed( hFrontVad->hVAD->ra_deltasum, Q15 );
diff --git a/lib_enc/ivas_lfe_enc.c b/lib_enc/ivas_lfe_enc.c
index 6719ae1d78008ed1021da9b76a8e3fe7e4058b58..636658d2562ed2b8279f9bba5c3368acc427a8e8 100644
--- a/lib_enc/ivas_lfe_enc.c
+++ b/lib_enc/ivas_lfe_enc.c
@@ -38,11 +38,10 @@
#include "ivas_cnst.h"
#include "ivas_rom_com.h"
#include "wmc_auto.h"
-
#ifdef IVAS_FLOAT_FIXED
#include "prot_fx.h"
#include "ivas_prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
+#endif
/*-----------------------------------------------------------------------------------------*
diff --git a/lib_enc/ivas_mc_paramupmix_enc.c b/lib_enc/ivas_mc_paramupmix_enc.c
index a4ba849d48ad77e82f6d44eca336d5d10ca83b25..06c9dde4d4464ddcf5f7345ba92b68b30eea4bbf 100644
--- a/lib_enc/ivas_mc_paramupmix_enc.c
+++ b/lib_enc/ivas_mc_paramupmix_enc.c
@@ -46,6 +46,9 @@
#include "ivas_rom_com.h"
#include "ivas_rom_enc.h"
#include "wmc_auto.h"
+#ifdef DEBUGGING
+#include "debug.h"
+#endif
/*-------------------------------------------------------------------------
* Local function prototypes
@@ -757,14 +760,14 @@ static void ivas_mc_paramupmix_param_est_enc(
ivas_transient_det_process( hMCParamUpmix->hTranDet[2 * i + 1], pcm_in[2 * i + 1], input_frame, transient_det_r );
#else
ivas_transient_det_process_fx( hMCParamUpmix->hTranDet[2 * i], pcm_in_fx[2 * i], input_frame, transient_det_l );
-#ifdef DUMPS_ENABLED
+#ifdef DEBUGGING
float a[2];
a[0] = transient_det_l[0];
a[1] = transient_det_l[1];
dbgwrite_txt( a, 2, "fixed.txt", NULL );
#endif
ivas_transient_det_process_fx( hMCParamUpmix->hTranDet[2 * i + 1], pcm_in_fx[2 * i + 1], input_frame, transient_det_r );
-#ifdef DUMPS_ENABLED
+#ifdef DEBUGGING
a[0] = transient_det_r[0];
a[1] = transient_det_r[1];
dbgwrite_txt( a, 2, "fixed.txt", NULL );
diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c
index 1b5b215f7a01031ce34b1b78582969815feb6adb..ead9c4d2598cb84ee2b32fd8ab5154ff17162e6e 100644
--- a/lib_enc/ivas_spar_encoder.c
+++ b/lib_enc/ivas_spar_encoder.c
@@ -31,20 +31,22 @@
*******************************************************************************************************/
#include
+#include
#include "options.h"
#include "ivas_prot.h"
#ifdef IVAS_FLOAT_FIXED
#include "ivas_prot_fx.h"
#include "prot_fx.h"
-#include "options.h"
#endif
#include "ivas_rom_com.h"
#include "ivas_stat_com.h"
#include "prot.h"
#include "math.h"
-#include
#include "wmc_auto.h"
#include "prot_fx_enc.h"
+#ifdef DEBUGGING
+#include "debug.h"
+#endif
/*-------------------------------------------------------------------*
@@ -976,12 +978,16 @@ static ivas_error ivas_spar_enc_process(
#else
ivas_transient_det_process( hSpar->hTranDet, data_f[0], input_frame, transient_det );
#endif
-#ifdef DUMPS_ENABLED
- float a[2];
- a[0] = transient_det[0];
- a[1] = transient_det[1];
- dbgwrite_txt( a, 2, "fixed.txt", NULL );
+
+#ifdef DEBUGGING
+ {
+ float a[2];
+ a[0] = transient_det[0];
+ a[1] = transient_det[1];
+ dbgwrite_txt( a, 2, "fixed.txt", NULL );
+ }
#endif
+
if ( ivas_total_brate < IVAS_24k4 )
{
transient_det[1] = 0;
@@ -1295,12 +1301,16 @@ static ivas_error ivas_spar_enc_process(
* Transient detector
*-----------------------------------------------------------------------------------------*/
ivas_transient_det_process( hSpar->hTranDet, data_f[0], input_frame, transient_det );
-#ifdef DUMPS_ENABLED
- float a[2];
- a[0] = transient_det[0];
- a[1] = transient_det[1];
- dbgwrite_txt( a, 2, "fixed.txt", NULL );
+
+#ifdef DEBUGGING
+ {
+ float a[2];
+ a[0] = transient_det[0];
+ a[1] = transient_det[1];
+ dbgwrite_txt( a, 2, "fixed.txt", NULL );
+ }
#endif
+
if ( ivas_total_brate < IVAS_24k4 )
{
transient_det[1] = 0;
diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c
index 6ca4545f25423116781a1685ba06201b31c976b1..faf701d12902e5f877854a930750bc0221349737 100644
--- a/lib_enc/lib_enc.c
+++ b/lib_enc/lib_enc.c
@@ -2800,7 +2800,6 @@ static ivas_error bandwidthApiToInternal(
case IVAS_ENC_BANDWIDTH_UNDEFINED:
default:
return IVAS_ERR_INVALID_BANDWIDTH;
- BREAK;
}
return IVAS_ERR_OK;
@@ -2827,7 +2826,6 @@ static ivas_error fecIndicatorApiToInternal(
BREAK;
default:
return IVAS_ERR_INTERNAL;
- BREAK;
}
return IVAS_ERR_OK;
diff --git a/lib_enc/pitch_ol_fx.c b/lib_enc/pitch_ol_fx.c
index a43bdd82f0f250dfa4cff99b35a7faf9918d9c28..0a7d20c6a2bcdcfde02050f231380c69b7f103b2 100644
--- a/lib_enc/pitch_ol_fx.c
+++ b/lib_enc/pitch_ol_fx.c
@@ -2464,10 +2464,10 @@ static void LP_Decim2_Copy(
move16();
FOR( i = 0; i < l; i += 2 )
{
- L_tmp = L_mult( *p_x, H_fir[0] );
+ L_tmp = L_mult( *p_x, h_fir_fx[0] );
FOR( k = 1; k < L_FIR_PO; k++ )
{
- L_tmp = L_mac( L_tmp, p_x[k], H_fir[k] );
+ L_tmp = L_mac( L_tmp, p_x[k], h_fir_fx[k] );
}
p_x += 2;
diff --git a/lib_enc/ppp_enc_fx.c b/lib_enc/ppp_enc_fx.c
index 29c0fefe7d1f2d4390d7084bd3f278515598aa42..3e5de17fa033d09164281b096fe1819354c3d15e 100644
--- a/lib_enc/ppp_enc_fx.c
+++ b/lib_enc/ppp_enc_fx.c
@@ -200,7 +200,7 @@ ivas_error ppp_quarter_encoder_fx(
push_indice_fx( hBstr, IND_GLOBAL_ALIGNMENT, shr( add( tmp_fx, 12 ), 2 ), 3 );
- count_free( PREVDTFS_FX );
+ free( PREVDTFS_FX );
return error;
}
diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c
index 42169453225a4cc5ddee8e3e3f2821047ba41aac..e55f488df2546d3ab7014e6c0fa8a394808b8edb 100644
--- a/lib_enc/pre_proc_fx.c
+++ b/lib_enc/pre_proc_fx.c
@@ -672,7 +672,7 @@ void pre_proc_fx(
}
st->sr_core = L_mult0( FRAMES_PER_SEC, st->L_frame );
- st->encoderLookahead_enc = NS2SA_fx2( st->sr_core, ACELP_LOOK_NS );
+ st->encoderLookahead_enc = NS2SA_FX2( st->sr_core, ACELP_LOOK_NS );
move16();
st->encoderPastSamples_enc = shr( imult1616( st->L_frame, 9 ), 4 );
}
@@ -829,7 +829,7 @@ void pre_proc_fx(
Mpy_32_16_ss( st->sr_core, 5243, &L_tmp, &lsb ); /* 5243 is 1/50 in Q18. (0+18-15=3) */
st->L_frame = extract_l( L_shr( L_tmp, 3 ) ); /* Q0 */
- st->encoderLookahead_enc = NS2SA_fx2( st->sr_core, ACELP_LOOK_NS );
+ st->encoderLookahead_enc = NS2SA_FX2( st->sr_core, ACELP_LOOK_NS );
move16();
st->encoderPastSamples_enc = shr( imult1616( st->L_frame, 9 ), 4 );
assert( st->L_frame == st->sr_core / 50 );
@@ -995,7 +995,7 @@ void pre_proc_fx(
L_frame_tmp = L_FRAME16k;
move16();
}
- L_look = NS2SA_fx2( sr_core_tmp, ACELP_LOOK_NS );
+ L_look = NS2SA_FX2( sr_core_tmp, ACELP_LOOK_NS );
move16(); /* lookahead at other sampling rate (16kHz, 25.5kHz, 32kHz) */
new_inp_16k = old_inp_16k + L_INP_MEM; /* pointer to new samples of the input signal in 16kHz core */
@@ -1010,7 +1010,7 @@ void pre_proc_fx(
IF( EQ_32( st->input_Fs, sr_core_tmp ) )
{
/* no resampling needed, only delay adjustement to account for the FIR resampling delay */
- delay = NS2SA_fx2( st->input_Fs, DELAY_FIR_RESAMPL_NS );
+ delay = NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS );
Copy_Scale_sig( st->mem_decim16k_fx + delay, new_inp_16k, delay, -1 ); /* Input in Q0 -> Output in Q-1 to mimic the resampling filter */
Copy_Scale_sig( signal_in, new_inp_16k + delay, input_frame - delay, -1 ); /* Input in Q0 -> Output in Q-1 to mimic the resampling filter */
Copy( signal_in + input_frame - shl( delay, 1 ), st->mem_decim16k_fx, shl( delay, 1 ) ); /* memory still in Q0 */
@@ -1022,7 +1022,7 @@ void pre_proc_fx(
ELSE /* keep memories up-to-date in case of bitrate switching */
{
/* no resampling needed, only delay adjustement to account for the FIR resampling delay */
- delay = NS2SA_fx2( st->input_Fs, DELAY_FIR_RESAMPL_NS );
+ delay = NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS );
Copy( st->mem_decim16k_fx + delay, new_inp_16k, delay );
Copy( signal_in, new_inp_16k + delay, sub( input_frame, delay ) );
Copy( signal_in + sub( input_frame, shl( delay, 1 ) ), st->mem_decim16k_fx, shl( delay, 1 ) );
diff --git a/lib_enc/rom_enc.c b/lib_enc/rom_enc.c
index 3b9302765cb64dd7f630a71ea2e64bf750310a9e..49ea00a498f97a80d156fce03a163f6dae007ba0 100644
--- a/lib_enc/rom_enc.c
+++ b/lib_enc/rom_enc.c
@@ -231,7 +231,7 @@ const int16_t sublen1_12k8[7] = { 40, 40, 50, 50, 80, 80, 115 };
const int16_t sec_length_12k8[4] = { 7, 15, 30, 54 };
const int16_t sec_length1_12k8[4] = { 10, 19, 37, 38 };
const float h_fir[5] = {0.13f, 0.23f, 0.28f, 0.23f, 0.13f};
-const Word16 H_fir[] = { 4260, 7536, 9175, 7536, 4260 };
+const Word16 h_fir_fx[] = { 4260, 7536, 9175, 7536, 4260 };
const float W_HIST[DTX_HIST_SIZE] =
{
diff --git a/lib_enc/rom_enc.h b/lib_enc/rom_enc.h
index 3542e43a6aa17e18596c8ea5c52bc5f30c17c7eb..87537fc80ce0acc536f8161183045746086e4e4e 100644
--- a/lib_enc/rom_enc.h
+++ b/lib_enc/rom_enc.h
@@ -60,8 +60,8 @@ extern const Word16 W_HIST_S_FX[DTX_HIST_SIZE]; /* CNG & DTX - table for calcula
extern const int16_t bwd_start_bin[];
extern const int16_t bwd_end_bin[];
-extern const float h_fir[]; /* 2nd order fir filter for wsp, decimation by 2 */
-extern const Word16 H_fir[]; /* 2nd order fir filter for wsp, decimation by 2 */
+extern const float h_fir[]; /* 2nd order fir filter for wsp, decimation by 2 */
+extern const Word16 h_fir_fx[]; /* 2nd order fir filter for wsp, decimation by 2 */
extern const float preemphCompensation[];
extern const Word16 preemphCompensation_fx[];
diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c
index f651907e9d0f08eaaeca2a21b0c5cea2c9b75831..677c94e04dea92b278d7b26780f1a15ccca60e56 100644
--- a/lib_enc/speech_music_classif_fx.c
+++ b/lib_enc/speech_music_classif_fx.c
@@ -1886,7 +1886,7 @@ Word16 ivas_smc_gmm_fx(
temp32_log = L_add( BASOP_Util_Log2( ps_sta_fx ), L_shl( ps_sta_exp, Q25 ) );
temp32_log = Mpy_32_32( temp32_log, 1488522239 ); /*logf(x) = log2(x)*logf(2)*/
*pFV_fx++ = L_shr( temp32_log, Q5 ); // logf( ps_sta + 1e-5f );
- Copy32( &PS_norm_fx[LOWEST_FBIN], hSpMusClas->past_PS_fx, HIGHEST_FBIN - LOWEST_FBIN );
+ MVR2R_WORD32( &PS_norm_fx[LOWEST_FBIN], hSpMusClas->past_PS_fx, HIGHEST_FBIN - LOWEST_FBIN );
/* save ps_diff and ps_sta features for XTALK and UNCLR classifier */
IF( hStereoClassif != NULL )
@@ -1981,7 +1981,7 @@ Word16 ivas_smc_gmm_fx(
}
/* update */
- Copy32( FV_fx, hSpMusClas->prev_FV_fx, N_SMC_FEATURES );
+ MVR2R_WORD32( FV_fx, hSpMusClas->prev_FV_fx, N_SMC_FEATURES );
/*------------------------------------------------------------------*
* Non-linear power transformation (boxcox) on certain features
*------------------------------------------------------------------*/
@@ -2368,7 +2368,7 @@ Word16 ivas_smc_gmm_fx(
*------------------------------------------------------------------*/
/* update buffer of past non-binary decisions */
- Copy( &hSpMusClas->past_dlp_fx[0], &hSpMusClas->past_dlp_fx[1], HANG_LEN - 2 );
+ MVR2R_WORD16( &hSpMusClas->past_dlp_fx[0], &hSpMusClas->past_dlp_fx[1], HANG_LEN - 2 );
hSpMusClas->past_dlp_fx[0] = extract_l( L_shr( dlp_fx, 10 ) );
move16();
mvr2r( &hSpMusClas->past_dlp_mean_ST[0], &hSpMusClas->past_dlp_mean_ST[1], HANG_LEN - 2 );
diff --git a/lib_enc/subband_fft_fx.c b/lib_enc/subband_fft_fx.c
index e5ffd49a68742299bbe324dea1fbe168da2eed07..83a1b41dd1dc30fe79f5b36f00f8f584d2ead612 100644
--- a/lib_enc/subband_fft_fx.c
+++ b/lib_enc/subband_fft_fx.c
@@ -125,7 +125,7 @@ static void passf4_1_16(
ch[i + 4] = C_multr( c2, wa1[i] );
ch[i + 8] = C_multr( c3, wa2[i] );
ch[i + 12] = C_multr( c4, wa3[i] );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move += 4;
#endif
}
@@ -157,7 +157,7 @@ static void passf4_2_16(
ch[k + 8] = C_sub( t2, t3 );
ch[k + 4] = C_add( t1, t4 );
ch[k + 12] = C_sub( t1, t4 );
-#if ( WMOPS )
+#ifdef WMOPS
multiCounter[currCounter].CL_move += 4;
#endif
}
diff --git a/lib_enc/swb_pre_proc_fx.c b/lib_enc/swb_pre_proc_fx.c
index 463f0a96a02ff465af01fb44e7886ec2b30d02b4..dbd41484e6713567f3b4b55e0652eb40a0b88da8 100644
--- a/lib_enc/swb_pre_proc_fx.c
+++ b/lib_enc/swb_pre_proc_fx.c
@@ -75,7 +75,7 @@ void wb_pre_proc_fx(
move16();
}
- set16_fx( old_input, 0, NS2SA_fx2( 16000, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS ) + L_FRAME16k );
+ set16_fx( old_input, 0, NS2SA_FX2( 16000, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS ) + L_FRAME16k );
max_wb = 1;
move16();
@@ -153,7 +153,7 @@ void wb_pre_proc_fx(
test();
IF( ( NE_16( st_fx->extl, WB_BWE ) || ( EQ_16( st_fx->extl, WB_BWE ) && LE_32( st_fx->total_brate, ACELP_8k00 ) ) ) && !hSC_VBR->ppp_mode )
{
- Sample_Delay_WB_BWE = NS2SA_fx2( 16000, DELAY_FD_BWE_ENC_12k8_NS );
+ Sample_Delay_WB_BWE = NS2SA_FX2( 16000, DELAY_FD_BWE_ENC_12k8_NS );
Copy( new_inp_resamp16k, &old_input[Sample_Delay_WB_BWE], L_FRAME16k );
Copy( hBWE_FD->old_input_wb_fx, old_input, Sample_Delay_WB_BWE );
@@ -232,7 +232,7 @@ void swb_pre_proc_fx(
imagBufferFlipped[j] = imagBufferTmp[j];
}
- set16_fx( old_input_fx, 0, NS2SA_fx2( 48000, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS ) + L_FRAME48k );
+ set16_fx( old_input_fx, 0, NS2SA_FX2( 48000, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS ) + L_FRAME48k );
IF( EQ_32( st_fx->input_Fs, 32000 ) )
{
@@ -241,7 +241,7 @@ void swb_pre_proc_fx(
test();
IF( NE_16( st_fx->last_extl, SWB_BWE ) && NE_16( st_fx->last_extl, FB_BWE ) && NE_16( st_fx->extl, SWB_BWE_HIGHRATE ) )
{
- Sample_Delay_SWB_BWE = NS2SA_fx2( 32000, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS );
+ Sample_Delay_SWB_BWE = NS2SA_FX2( 32000, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS );
Copy( hBWE_FD->old_fdbwe_speech_fx, &old_input_fx[Sample_Delay_SWB_BWE], L_FRAME32k );
set16_fx( old_input_fx, 0, Sample_Delay_SWB_BWE );
Copy( hBWE_FD->old_fdbwe_speech_fx + L_FRAME32k - Sample_Delay_SWB_BWE, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE );
@@ -290,7 +290,7 @@ void swb_pre_proc_fx(
decimate_3_ov_2_lowpass_num_fx, decimate_3_ov_2_lowpass_den_fx, hBWE_TD->dec_2_over_3_mem_lp_fx );
}
- Sample_Delay_SWB_BWE = NS2SA_fx2( inner_Fs, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS );
+ Sample_Delay_SWB_BWE = NS2SA_FX2( inner_Fs, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS );
Copy( new_swb_speech_fx, &old_input_fx[Sample_Delay_SWB_BWE], inner_frame );
set16_fx( old_input_fx, 0, Sample_Delay_SWB_BWE );
Copy( new_swb_speech_fx + inner_frame - Sample_Delay_SWB_BWE, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE );
diff --git a/lib_enc/transient_detection_fx.c b/lib_enc/transient_detection_fx.c
index c57facc67907cbc0eacc8553e4302ab9cfb18e73..182f2acc5f7ad770889d4e37311e690dfb80dd47 100644
--- a/lib_enc/transient_detection_fx.c
+++ b/lib_enc/transient_detection_fx.c
@@ -569,10 +569,12 @@ static void RunTransientDetector( TransientDetector *pTransientDetector )
assert( ( pTransientDetector->CheckSubblocksForAttack_fx != NULL ) );
+#define WMC_TOOL_SKIP
pTransientDetector->CheckSubblocksForAttack_fx( pSubblockNrg, pAccSubblockNrg,
NSUBBLOCKS + nDelay, nRelativeDelay,
attackRatioThreshold,
&pTransientDetector->bIsAttackPresent, &pTransientDetector->attackIndex );
+#undef WMC_TOOL_SKIP
}
static void UpdateDelayBuffer( Word16 const *input, Word16 nSamplesAvailable, DelayBuffer *pDelayBuffer )
diff --git a/lib_enc/updt_enc_fx.c b/lib_enc/updt_enc_fx.c
index 1b153f387b8ef296d413e285dc5ecc8e60e2e1ab..6a3202a1595650cd87d2d6cc049bafe6db557b4e 100644
--- a/lib_enc/updt_enc_fx.c
+++ b/lib_enc/updt_enc_fx.c
@@ -190,7 +190,7 @@ void updt_IO_switch_enc_fx(
/* Perform preemphasis of the old input signal @16kHz */
st->mem_preemph16k_fx = 0;
move16();
- preemph_fx( st->old_inp_16k_fx, PREEMPH_FAC_16k, L_INP_MEM, &( st->mem_preemph16k_fx ) );
+ PREEMPH_FX( st->old_inp_16k_fx, PREEMPH_FAC_16k, L_INP_MEM, &( st->mem_preemph16k_fx ) );
Scale_sig( st->old_inp_16k_fx, L_INP_MEM, st->prev_Q_new );
/* reset TD BWE buffers */
set16_fx( hBWE_TD->old_speech_shb_fx, 0, L_LOOK_16k + L_SUBFR16k );
diff --git a/lib_enc/voiced_enc_fx.c b/lib_enc/voiced_enc_fx.c
index 0e3d7b20b179eb4c401ba8ceb0ca018a30280761..b9e0b9c425c7dcbf19ffd794b99f6686696ab86d 100644
--- a/lib_enc/voiced_enc_fx.c
+++ b/lib_enc/voiced_enc_fx.c
@@ -205,12 +205,12 @@ ivas_error ppp_voiced_encoder_fx(
{
hSC_VBR->bump_up = 1;
move16();
- count_free( CURRP_NQ_FX );
- count_free( TMPDTFS_FX );
- count_free( TMPDTFS2_FX );
- count_free( TMPDTFS3_FX );
- count_free( CURRP_Q_E_FX );
- count_free( dtfs_temp_fx );
+ free( CURRP_NQ_FX );
+ free( TMPDTFS_FX );
+ free( TMPDTFS2_FX );
+ free( TMPDTFS3_FX );
+ free( CURRP_Q_E_FX );
+ free( dtfs_temp_fx );
return error;
}
@@ -236,12 +236,12 @@ ivas_error ppp_voiced_encoder_fx(
{
hSC_VBR->bump_up = 1;
move16();
- count_free( CURRP_NQ_FX );
- count_free( TMPDTFS_FX );
- count_free( TMPDTFS2_FX );
- count_free( TMPDTFS3_FX );
- count_free( CURRP_Q_E_FX );
- count_free( dtfs_temp_fx );
+ free( CURRP_NQ_FX );
+ free( TMPDTFS_FX );
+ free( TMPDTFS2_FX );
+ free( TMPDTFS3_FX );
+ free( CURRP_Q_E_FX );
+ free( dtfs_temp_fx );
return error;
}
@@ -267,12 +267,12 @@ ivas_error ppp_voiced_encoder_fx(
{
hSC_VBR->bump_up = 1;
move16();
- count_free( CURRP_NQ_FX );
- count_free( TMPDTFS_FX );
- count_free( TMPDTFS2_FX );
- count_free( TMPDTFS3_FX );
- count_free( CURRP_Q_E_FX );
- count_free( dtfs_temp_fx );
+ free( CURRP_NQ_FX );
+ free( TMPDTFS_FX );
+ free( TMPDTFS2_FX );
+ free( TMPDTFS3_FX );
+ free( CURRP_Q_E_FX );
+ free( dtfs_temp_fx );
return error;
}
@@ -594,12 +594,12 @@ ivas_error ppp_voiced_encoder_fx(
{
hSC_VBR->bump_up = 1;
move16();
- count_free( CURRP_NQ_FX );
- count_free( TMPDTFS_FX );
- count_free( TMPDTFS2_FX );
- count_free( TMPDTFS3_FX );
- count_free( CURRP_Q_E_FX );
- count_free( dtfs_temp_fx );
+ free( CURRP_NQ_FX );
+ free( TMPDTFS_FX );
+ free( TMPDTFS2_FX );
+ free( TMPDTFS3_FX );
+ free( CURRP_Q_E_FX );
+ free( dtfs_temp_fx );
return error;
}
}
@@ -641,12 +641,12 @@ ivas_error ppp_voiced_encoder_fx(
{
hSC_VBR->bump_up = 1;
move16();
- count_free( CURRP_NQ_FX );
- count_free( TMPDTFS_FX );
- count_free( TMPDTFS2_FX );
- count_free( TMPDTFS3_FX );
- count_free( CURRP_Q_E_FX );
- count_free( dtfs_temp_fx );
+ free( CURRP_NQ_FX );
+ free( TMPDTFS_FX );
+ free( TMPDTFS2_FX );
+ free( TMPDTFS3_FX );
+ free( CURRP_Q_E_FX );
+ free( dtfs_temp_fx );
return error;
}
}
@@ -661,12 +661,12 @@ ivas_error ppp_voiced_encoder_fx(
IF( hSC_VBR->bump_up == 1 )
{
- count_free( CURRP_NQ_FX );
- count_free( TMPDTFS_FX );
- count_free( TMPDTFS2_FX );
- count_free( TMPDTFS3_FX );
- count_free( CURRP_Q_E_FX );
- count_free( dtfs_temp_fx );
+ free( CURRP_NQ_FX );
+ free( TMPDTFS_FX );
+ free( TMPDTFS2_FX );
+ free( TMPDTFS3_FX );
+ free( CURRP_Q_E_FX );
+ free( dtfs_temp_fx );
return error;
}
@@ -675,12 +675,12 @@ ivas_error ppp_voiced_encoder_fx(
{
hSC_VBR->bump_up = 1;
move16();
- count_free( CURRP_NQ_FX );
- count_free( TMPDTFS_FX );
- count_free( TMPDTFS2_FX );
- count_free( TMPDTFS3_FX );
- count_free( CURRP_Q_E_FX );
- count_free( dtfs_temp_fx );
+ free( CURRP_NQ_FX );
+ free( TMPDTFS_FX );
+ free( TMPDTFS2_FX );
+ free( TMPDTFS3_FX );
+ free( CURRP_Q_E_FX );
+ free( dtfs_temp_fx );
return error;
}
/* -----End Open-loop Bump-Up */
@@ -694,12 +694,12 @@ ivas_error ppp_voiced_encoder_fx(
{
if ( ( error = ppp_quarter_encoder_fx( &flag, CURRP_Q_E_FX, TMPDTFS_FX, dtfs_temp_fx->lag_fx, *CURRP_NQ_FX, lpc2_fx, &hSC_VBR->lastLgainE_fx, &hSC_VBR->lastHgainE_fx, hSC_VBR->lasterbE_fx, *dtfs_temp_fx, S_fx, C_fx, hBstr ) ) != IVAS_ERR_OK )
{
- count_free( CURRP_NQ_FX );
- count_free( TMPDTFS_FX );
- count_free( TMPDTFS2_FX );
- count_free( TMPDTFS3_FX );
- count_free( CURRP_Q_E_FX );
- count_free( dtfs_temp_fx );
+ free( CURRP_NQ_FX );
+ free( TMPDTFS_FX );
+ free( TMPDTFS2_FX );
+ free( TMPDTFS3_FX );
+ free( CURRP_Q_E_FX );
+ free( dtfs_temp_fx );
return error;
}
}
@@ -1172,12 +1172,12 @@ ivas_error ppp_voiced_encoder_fx(
{
hSC_VBR->bump_up = 1;
move16();
- count_free( CURRP_NQ_FX );
- count_free( TMPDTFS_FX );
- count_free( TMPDTFS2_FX );
- count_free( TMPDTFS3_FX );
- count_free( CURRP_Q_E_FX );
- count_free( dtfs_temp_fx );
+ free( CURRP_NQ_FX );
+ free( TMPDTFS_FX );
+ free( TMPDTFS2_FX );
+ free( TMPDTFS3_FX );
+ free( CURRP_Q_E_FX );
+ free( dtfs_temp_fx );
return error;
}
@@ -1192,12 +1192,12 @@ ivas_error ppp_voiced_encoder_fx(
move16();
hSC_VBR->bump_up = 1;
move16();
- count_free( CURRP_NQ_FX );
- count_free( TMPDTFS_FX );
- count_free( TMPDTFS2_FX );
- count_free( TMPDTFS3_FX );
- count_free( CURRP_Q_E_FX );
- count_free( dtfs_temp_fx );
+ free( CURRP_NQ_FX );
+ free( TMPDTFS_FX );
+ free( TMPDTFS2_FX );
+ free( TMPDTFS3_FX );
+ free( CURRP_Q_E_FX );
+ free( dtfs_temp_fx );
return error;
}
}
@@ -1244,12 +1244,12 @@ ivas_error ppp_voiced_encoder_fx(
hSC_VBR->dtfs_enc_Q = dtfs_temp_fx->Q;
move16();
- count_free( CURRP_NQ_FX );
- count_free( TMPDTFS_FX );
- count_free( TMPDTFS2_FX );
- count_free( TMPDTFS3_FX );
- count_free( CURRP_Q_E_FX );
- count_free( dtfs_temp_fx );
+ free( CURRP_NQ_FX );
+ free( TMPDTFS_FX );
+ free( TMPDTFS2_FX );
+ free( TMPDTFS3_FX );
+ free( CURRP_Q_E_FX );
+ free( dtfs_temp_fx );
return error;
}
diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c
index 861d0fdd050e1648137cedb1e24a71066fe3370d..95260d7b1bce7e1202e6fabdc2ce0727bba177db 100644
--- a/lib_rend/ivas_crend.c
+++ b/lib_rend/ivas_crend.c
@@ -42,13 +42,17 @@
#include "ivas_stat_rend.h"
#include "lib_rend.h"
#include "wmc_auto.h"
+#ifdef DEBUGGING
+#include "debug.h"
+#endif
+
#ifdef IVAS_FLOAT_FIXED
#include "control.h"
#include "prot_fx.h"
-#include "debug.h"
#define float_to_fix( n, factor ) ( round( n * ( 1 << factor ) ) )
#define fix_to_float( n, factor ) ( (float) n / ( 1 << factor ) )
#endif
+
#ifdef IVAS_FLOAT_FIXED
/*-------------------------------------------------------------------------
* ivas_hrtf_init()
@@ -3178,9 +3182,9 @@ static ivas_error ivas_rend_crendConvolver(
ivas_mdft_fx( pIn, pFreq_buf_re, pFreq_buf_im, subframe_length, subframe_length );
-#ifdef DUMPS_ENABLED
- dbgwrite_txt( pFreq_buf_re, subframe_length, "Fixed_pFreq_buf_re_mdft.txt", NULL );
- dbgwrite_txt( pFreq_buf_im, subframe_length, "Fixed_pFreq_buf_im_mdft.txt", NULL );
+#ifdef DEBUGGING
+ dbgwrite_txt( (const float *) pFreq_buf_re, subframe_length, "Fixed_pFreq_buf_re_mdft.txt", NULL );
+ dbgwrite_txt( (const float *) pFreq_buf_im, subframe_length, "Fixed_pFreq_buf_im_mdft.txt", NULL );
#endif
i = add( i, 1 );
}
@@ -3246,8 +3250,8 @@ static ivas_error ivas_rend_crendConvolver(
ivas_imdft_fx( tmp_out_re, tmp_out_im, pOut, subframe_length );
-#ifdef DUMPS_ENABLED
- dbgwrite_txt( pOut, subframe_length << 1, "Fixed_imdft_out.txt", NULL );
+#ifdef DEBUGGING
+ dbgwrite_txt( (const float *) pOut, subframe_length << 1, "Fixed_imdft_out.txt", NULL );
#endif
pFreq_buf_re = &pcm_out[j][imult1616( i_ts, subframe_length )];
FOR( k = 0; k < subframe_length; k++ )
@@ -3590,7 +3594,7 @@ ivas_error ivas_rend_crendProcess(
/* move to output */
FOR( i = 0; i < nchan_out; i++ )
{
- Copy32( pcm_tmp_fx[i], output_fx[i], imult1616( num_subframes, subframe_len ) );
+ MVR2R_WORD32( pcm_tmp_fx[i], output_fx[i], imult1616( num_subframes, subframe_len ) );
}
pop_wmops();
@@ -3890,7 +3894,7 @@ ivas_error ivas_rend_crendProcessSubframe(
/* move to output */
FOR( ch = 0; ch < nchan_out; ch++ )
{
- Copy32( pcm_tmp_fx[ch], output[ch], n_samples_to_render );
+ MVR2R_WORD32( pcm_tmp_fx[ch], output[ch], n_samples_to_render );
}
hTcBuffer->subframes_rendered = last_sf;
diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c
index bf2799309885377338530b4d9148ba98819cb8e7..d248df0d2116586d13242f0d2b6ad0b32a7d3274 100644
--- a/lib_rend/ivas_dirac_dec_binaural_functions.c
+++ b/lib_rend/ivas_dirac_dec_binaural_functions.c
@@ -580,12 +580,12 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx(
move16();
}
- n_samples_granularity = NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS );
+ n_samples_granularity = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS );
test();
test();
IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
{
- n_samples_granularity = NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Use the same granularity as tdrend */
+ n_samples_granularity = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Use the same granularity as tdrend */
}
IF( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, ivas_jbm_dec_get_num_tc_channels( st_ivas ), nchan_to_allocate, nchan_to_allocate, n_samples_granularity ) ) != IVAS_ERR_OK )
@@ -887,7 +887,7 @@ void ivas_dirac_dec_binaural_render_fx(
{
output_fx_local[ch] = output_fx_local_buff[ch];
}
- slot_size = NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS );
+ slot_size = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS );
/* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */
slots_to_render = s_min( sub( hSpatParamRendCom->num_slots, hSpatParamRendCom->slots_rendered ), idiv1616( (Word16) nSamplesAsked, (Word16) slot_size ) );
diff --git a/lib_rend/ivas_masa_merge.c b/lib_rend/ivas_masa_merge.c
index 9f7d8f7f1f03550a5d1243757a2642df211944de..734751f2db23870f3cba463d2555d92c330a44b9 100644
--- a/lib_rend/ivas_masa_merge.c
+++ b/lib_rend/ivas_masa_merge.c
@@ -41,7 +41,7 @@
#ifdef IVAS_FLOAT_FIXED
#include "prot_fx.h"
#include "ivas_prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
+#endif
/*---------------------------------------------------------------------*
diff --git a/lib_rend/ivas_mcmasa_ana.c b/lib_rend/ivas_mcmasa_ana.c
index 5666cba22ed6f25f33c6fcc117f0c20f2c83b547..08c01b3b743a2f0431d6d613684ee153cf01db48 100644
--- a/lib_rend/ivas_mcmasa_ana.c
+++ b/lib_rend/ivas_mcmasa_ana.c
@@ -45,7 +45,7 @@
#ifdef IVAS_FLOAT_FIXED
#include "prot_fx.h"
#include "ivas_rom_com_fx.h"
-#endif // IVAS_FLOAT_FIXED
+#endif
/*-------------------------------------------------------------------------
* Local constants
diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c
index 997477c5d20727c2dedb67786fb68fbf238f0663..67a70fcb12706074d4104b9d6c0172e2893b20a7 100644
--- a/lib_rend/ivas_objectRenderer_mix.c
+++ b/lib_rend/ivas_objectRenderer_mix.c
@@ -39,10 +39,9 @@
#include "wmc_auto.h"
#include "ivas_rom_rend.h"
#include "ivas_prot_fx.h"
-
#ifdef IVAS_FLOAT_FIXED
#include "prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
+#endif
#define IVAS_FLOAT_FIXED_TO_BE_REMOVED
diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c
index 6fa37e77f0d649bf2fbf58562df9d485ea140e35..743b98a1d7a7d1b9ea0d4ad65b5a72a38e6d6e21 100644
--- a/lib_rend/ivas_objectRenderer_sources.c
+++ b/lib_rend/ivas_objectRenderer_sources.c
@@ -39,7 +39,7 @@
#ifdef IVAS_FLOAT_FIXED
#include "ivas_prot_fx.h"
#include "prot_fx.h"
-#endif // IVAS_FLOAT_FIXED
+#endif
/*---------------------------------------------------------------------*
diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c
index 66475c3ed4adf156a3bd49c6ae7d233d8b6295fe..f1a8205a75fbd47a1abd7945978aefbfc5415381 100644
--- a/lib_rend/ivas_reverb.c
+++ b/lib_rend/ivas_reverb.c
@@ -3304,7 +3304,6 @@ static ivas_error downmix_input_block_fx(
}
default:
return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Unsupported input format for reverb" );
- BREAK;
}
return IVAS_ERR_OK;
@@ -3568,8 +3567,8 @@ ivas_error ivas_reverb_process_fx(
}
ELSE
{
- Copy32( tmp1_fx, &pcm_out_fx[0][i_mult( i_ts, hReverb->full_block_size )], hReverb->full_block_size );
- Copy32( tmp2_fx, &pcm_out_fx[1][i_mult( i_ts, hReverb->full_block_size )], hReverb->full_block_size );
+ MVR2R_WORD32( tmp1_fx, &pcm_out_fx[0][i_mult( i_ts, hReverb->full_block_size )], hReverb->full_block_size );
+ MVR2R_WORD32( tmp2_fx, &pcm_out_fx[1][i_mult( i_ts, hReverb->full_block_size )], hReverb->full_block_size );
}
return IVAS_ERR_OK;
diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c
index e6642cc3e14b50817fef2badc34a10ce46dea152..40cec01981ce99f119681f532ef0e8952ec505e3 100644
--- a/lib_rend/ivas_rotation.c
+++ b/lib_rend/ivas_rotation.c
@@ -30,10 +30,10 @@
*******************************************************************************************************/
-#include "basop_util.h"
-#include "ivas_cnst.h"
#include
#include
+#include "basop_util.h"
+#include "ivas_cnst.h"
#include "options.h"
#include
#include "cnst.h"
@@ -1025,7 +1025,7 @@ void rotateFrame_shd(
/* move Rmat to Rmat_prev */
FOR( i = 0; i < 3; i++ )
{
- Copy32(
+ MVR2R_WORD32(
hCombinedOrientationData->Rmat_fx[subframe_idx][i],
hCombinedOrientationData->Rmat_prev_fx[i],
3 );
@@ -1161,14 +1161,17 @@ void rotateFrame_sd(
Word16 azimuth, elevation;
Word32 azimuth_fx, elevation_fx;
Word32 tmp = Q31_BY_SUB_FRAME_240; // Q31
- move32();
Word32 out_temp;
Word32 tmp_gains_fx[MAX_CICP_CHANNELS - 1];
Word32 gains_fx[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS];
Word32 gains_prev_fx[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS];
Word32 output_tmp_fx[MAX_CICP_CHANNELS][L_FRAME48k];
Word32 cross_fade_fx[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES];
+
push_wmops( "rotateFrame_sd" );
+
+ move32();
+
nchan = add( hTransSetup.nchan_out_woLFE, hTransSetup.num_lfe );
index_lfe = hTransSetup.index_lfe[0];
move16();
@@ -1323,7 +1326,7 @@ void rotateFrame_sd(
/* move Rmat to Rmat_prev */
FOR( i = 0; i < 3; i++ )
{
- Copy32(
+ MVR2R_WORD32(
hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx][i],
hCombinedOrientationData->Rmat_prev_fx[i],
3 );
@@ -1331,7 +1334,7 @@ void rotateFrame_sd(
/* copy to output */
FOR( ch_out = 0; ch_out < nchan; ch_out++ )
{
- Copy32( &output_tmp_fx[ch_out][offset], &output[ch_out][offset], subframe_len );
+ MVR2R_WORD32( &output_tmp_fx[ch_out][offset], &output[ch_out][offset], subframe_len );
}
pop_wmops();
@@ -1514,9 +1517,10 @@ void rotateFrame_shd_cldfb(
/* calculate Ambisonics rotation matrix from the quaternion */
SHrotmatgen_fx( SHrotmat, Rmat, shd_rot_max_order );
-#ifdef DUMPS_ENABLED
- dbgwrite_txt( SHrotmat, HEADROT_SHMAT_DIM * HEADROT_SHMAT_DIM, "Fixed_SHrotmat.txt", NULL );
+#ifdef DEBUGGING
+ dbgwrite_txt( (const float *) SHrotmat[0], HEADROT_SHMAT_DIM * HEADROT_SHMAT_DIM, "Fixed_SHrotmat.txt", NULL );
#endif
+
/* rotation by mtx multiplication */
FOR( i = 0; i < numTimeSlots; i++ )
{
diff --git a/lib_rend/ivas_td_decorr.c b/lib_rend/ivas_td_decorr.c
index e3e224c9afb829c034137f186464570b597574bc..880844a9f3bb36756781629267e279d2a1f78872 100644
--- a/lib_rend/ivas_td_decorr.c
+++ b/lib_rend/ivas_td_decorr.c
@@ -31,21 +31,19 @@
*******************************************************************************************************/
#include
+#include
#include "options.h"
#include "prot.h"
#ifdef IVAS_FLOAT_FIXED
#include "prot_fx.h"
-#endif
-#include "ivas_prot.h"
-#ifdef IVAS_FLOAT_FIXED
#include "ivas_prot_fx.h"
#endif
+#include "ivas_prot.h"
#include "ivas_prot_rend.h"
#include "math.h"
-#include
#include "wmc_auto.h"
-#ifdef DUMPS_ENABLED
-#include
+#ifdef DEBUGGING
+#include "debug.h"
#endif
/*------------------------------------------------------------------------------------------*
diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c
index 1fd016fc2c064ba06af5fe9c32d56350efcb6d5a..e0bc60311cc89460f7eceb792915c4f69eec5a05 100644
--- a/lib_rend/lib_rend.c
+++ b/lib_rend/lib_rend.c
@@ -7354,7 +7354,7 @@ ivas_error IVAS_REND_FeedInputAudio_fx(
inputBase->inputBuffer.config = inputAudio.config;
- Copy32( inputAudio.data_fx, inputBase->inputBuffer.data_fx, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels );
+ MVR2R_WORD32( inputAudio.data_fx, inputBase->inputBuffer.data_fx, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels );
inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel;
move32();
@@ -7430,8 +7430,7 @@ ivas_error IVAS_REND_FeedInputAudio(
inputBase->inputBuffer.config = inputAudio.config;
#ifdef IVAS_FLOAT_FIXED
- Copy32( inputAudio.data_fx, inputBase->inputBuffer.data_fx, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels );
-
+ MVR2R_WORD32( inputAudio.data_fx, inputBase->inputBuffer.data_fx, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels );
#endif
mvr2r( inputAudio.data, inputBase->inputBuffer.data, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels );
@@ -8873,7 +8872,7 @@ static ivas_error rotateFrameMc_fx(
/* move gains to gains_prev */
FOR( i = 0; i < nchan; i++ )
{
- Copy32( gains[i], gains_prev[i], nchan );
+ MVR2R_WORD32( gains[i], gains_prev[i], nchan );
}
}
@@ -9098,9 +9097,9 @@ static ivas_error rotateFrameSba_fx(
/* calculate ambisonics rotation matrices for the previous and current frames */
SHrotmatgen_fx( gains, Rmat, shd_rot_max_order );
-#ifdef DUMPS_ENABLED
- dbgwrite_txt( gains, HEADROT_SHMAT_DIM * HEADROT_SHMAT_DIM, "Fixed_code_gains.txt", NULL );
- dbgwrite_txt( Rmat, 3 * 3, "Fixed_code_Rmat.txt", NULL );
+#ifdef DEBUGGING
+ dbgwrite_txt( (const float *) ( gains[0] ), HEADROT_SHMAT_DIM * HEADROT_SHMAT_DIM, "Fixed_code_gains.txt", NULL );
+ dbgwrite_txt( (const float *) ( Rmat[0] ), 3 * 3, "Fixed_code_Rmat.txt", NULL );
#endif
FOR( i = 0; i < subframe_len; i++ )
{
@@ -10508,7 +10507,7 @@ static ivas_error renderLfeToBinaural_fx(
v_multc_fixed( lfeInput, gain_fx, tmpLfeBuffer + num_cpy_smpl_prev_frame, num_cpy_smpl_cur_frame ); // Qinp-1
/* Save remaining LFE samples of current frame for next frame */
- Copy32( lfeInput + num_cpy_smpl_cur_frame, mcInput->lfeDelayBuffer_fx, num_cpy_smpl_prev_frame );
+ MVR2R_WORD32( lfeInput + num_cpy_smpl_cur_frame, mcInput->lfeDelayBuffer_fx, num_cpy_smpl_prev_frame );
r_shift = sub( sub( in_q, 1 ), out_q );
IF( r_shift != 0 )
@@ -11631,7 +11630,7 @@ static ivas_error renderSbaToBinaural(
tmpRotBuffer.data_fx = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( Word32 ) );
/* copy input for in-place rotation */
- Copy32( sbaInput->base.inputBuffer.data_fx, tmpRotBuffer.data_fx, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel );
+ MVR2R_WORD32( sbaInput->base.inputBuffer.data_fx, tmpRotBuffer.data_fx, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel );
IF( NE_16( ( error = rotateFrameSba_fx( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData,
sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev_fx, tmpRotBuffer ) ),
@@ -11801,7 +11800,7 @@ static ivas_error renderSbaToBinauralRoom(
tmpRotBuffer.data_fx = malloc( imult1616( tmpRotBuffer.config.numSamplesPerChannel, tmpRotBuffer.config.numChannels ) * sizeof( Word32 ) );
/* copy input for in-place rotation */
- Copy32( sbaInput->base.inputBuffer.data_fx, tmpRotBuffer.data_fx, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel );
+ MVR2R_WORD32( sbaInput->base.inputBuffer.data_fx, tmpRotBuffer.data_fx, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel );
IF( NE_32( ( error = rotateFrameSba_fx( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData,
sbaInput->base.ctx.pCombinedOrientationData,
@@ -12365,7 +12364,7 @@ static void renderMasaToMasa(
test();
IF( EQ_16( masaInput->base.inputBuffer.config.numChannels, 1 ) && EQ_16( outAudio.config.numChannels, 2 ) )
{
- Copy32( tmpBuffer_fx[0], tmpBuffer_fx[1], masaInput->base.inputBuffer.config.numSamplesPerChannel );
+ MVR2R_WORD32( tmpBuffer_fx[0], tmpBuffer_fx[1], masaInput->base.inputBuffer.config.numSamplesPerChannel );
}
ELSE IF( EQ_16( masaInput->base.inputBuffer.config.numChannels, 2 ) && EQ_16( outAudio.config.numChannels, 1 ) )
{