diff --git a/apps/decoder.c b/apps/decoder.c index cd811b7a3bbc5d5a8acc94f1e6e6c42f20758469..65344333d2c0919c3dc55c8347081a7a77b0f129 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -142,11 +142,6 @@ typedef struct hrtfFileReader *hrtfReader; char *hrtfFileName; -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA - IVAS_DEC_HRTF_TD_HANDLE *hHrtfTD; - - IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics; -#endif IVAS_BIN_RENDERER_TYPE binaural_renderer; IVAS_BIN_RENDERER_TYPE binaural_renderer_old; @@ -209,10 +204,6 @@ int main( reset_mem( USE_BYTES ); #endif -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA - hHrtfBinary.hHrtfTD = NULL; /* just to avoid compilation warning */ - hHrtfBinary.hHrtfStatistics = NULL; /* just to avoid compilation warning */ -#endif splitRendBits.bits_buf = splitRendBitsBuf; @@ -741,21 +732,6 @@ cleanup: free( arg.aeSequence.pValidity ); } -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA - if ( arg.hrtfReaderEnabled ) - { - destroy_td_hrtf( hHrtfBinary.hHrtfTD ); - destroy_hrtf_statistics( hHrtfBinary.hHrtfStatistics ); - } -#ifdef FIX_1990_SANITIZER_IN_REVERB_LOAD - // TODO: - /* This free differs from float version. - This is needed as HRTF statistics from ROM are currently converted from Word16 values to scaled Word32 values. */ - IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL; - IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics ); - destroy_hrtf_statistics( hHrtfStatistics ); -#endif -#endif IVAS_DEC_Close( &hIvasDec ); CustomLsReader_close( &hLsCustomReader ); hrtfFileReader_close( &hrtfReader ); @@ -3769,12 +3745,6 @@ static ivas_error load_hrtf_from_file( /*------------------------------------------------------------------------------------------* * Release HRTF binary data *------------------------------------------------------------------------------------------*/ -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA - if ( !( binaural_renderer == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT ) && binaural_renderer_sec != IVAS_BIN_RENDERER_TYPE_TDREND && hHrtfBinary->hHrtfTD != NULL ) - { - destroy_td_hrtf( hHrtfBinary->hHrtfTD ); - } -#endif if ( ( error = IVAS_DEC_HRTF_binary_close( hIvasDec, hHrtfBinary->binaural_renderer_old ) ) != IVAS_ERR_OK ) { return error; @@ -3797,22 +3767,14 @@ static ivas_error load_hrtf_from_file( if ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer_sec == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT ) { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA IVAS_DEC_HRTF_TD_HANDLE *hHrtfTD = NULL; if ( ( error = IVAS_DEC_GetHrtfTDrendHandle( hIvasDec, &hHrtfTD ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_GetHrtfTDrendHandle( hIvasDec, &hHrtfBinary->hHrtfTD ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nIVAS_DEC_GetHrtfTDrendHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); return error; } -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA if ( ( error = load_TDrend_HRTF_binary( *hHrtfTD, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK ) -#else - if ( ( error = load_TDrend_HRTF_binary( *hHrtfBinary->hHrtfTD, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK ) -#endif { if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) { @@ -3821,11 +3783,7 @@ static ivas_error load_hrtf_from_file( } else { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA destroy_td_hrtf( hHrtfTD ); -#else - destroy_td_hrtf( hHrtfBinary->hHrtfTD ); -#endif } } } @@ -3898,53 +3856,32 @@ static ivas_error load_hrtf_from_file( } } } -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA - } -#endif -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA - if ( ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND ) && OutputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#else - if ( hHrtfBinary->hHrtfStatistics == NULL && ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND ) && OutputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif - { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA - IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL; - if ( ( error = IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfBinary->hHrtfStatistics ) ) != IVAS_ERR_OK ) -#endif + if ( ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND ) && OutputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - fprintf( stderr, "\nIVAS_DEC_GetHrtfStatisticsHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - return error; - } - -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA - if ( ( error = load_HrtfStatistics_from_binary( *hHrtfStatistics, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK ) -#else - if ( ( error = load_reverb_binary( *hHrtfBinary->hHrtfStatistics, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK ) -#endif - { - if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) + IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL; + if ( ( error = IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", hHrtfBinary->hrtfFileName ); + fprintf( stderr, "\nIVAS_DEC_GetHrtfStatisticsHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); return error; } - else + + if ( ( error = load_HrtfStatistics_from_binary( *hHrtfStatistics, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK ) { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA - destroy_hrtf_statistics( hHrtfStatistics ); -#else - destroy_hrtf_statistics( hHrtfBinary->hHrtfStatistics ); -#endif + if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) + { + fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", hHrtfBinary->hrtfFileName ); + return error; + } + else + { + destroy_hrtf_statistics( hHrtfStatistics ); + } } } } -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA -} -#endif -return IVAS_ERR_OK; + return IVAS_ERR_OK; } diff --git a/apps/renderer.c b/apps/renderer.c index 356e8c0af20d6868eff04f1464a2ba3eb9f985ea..8da507bbed4975b251777d4f88616e4d6b0338b8 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1107,11 +1107,7 @@ int main( fprintf( stderr, "\nIVAS_REND_GetHrtfStatisticsHandle failed\n\n" ); goto cleanup; } -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA if ( ( error = load_HrtfStatistics_from_binary( *hHrtfStatistics, args.sampleRate, hrtfFileReader ) ) != IVAS_ERR_OK ) -#else - if ( ( error = load_reverb_binary( *hHrtfStatistics, args.sampleRate, hrtfFileReader ) ) != IVAS_ERR_OK ) -#endif { if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) { @@ -2203,10 +2199,6 @@ cleanup: RotationFileReader_close( &externalOrientationFileReader ); RotationFileReader_close( &referenceRotReader ); Vector3PairFileReader_close( &referenceVectorReader ); -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA - destroy_td_hrtf( hHrtfTD ); - destroy_hrtf_statistics( hHrtfStatistics ); -#endif IVAS_REND_Close( &hIvasRend ); IsmPositionProvider_close( positionProvider ); RenderConfigReader_close( &renderConfigReader ); diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 43c20a27a4c7015360831afeb1b5b08241d8e347..051b6024f418a77c628ed1bb70d625fababbf4e0 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -2734,11 +2734,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 */ -#ifdef FIX_2286_GCC_WARNING_Idx2Freq_Tbl #define NS2SA_FX2(fs,x) (chk_fs(fs) mult(Idx2Freq_Tbl[L_and(L_shr(fs,8),7)-2], (Word16)((x)/15625))) -#else -#define NS2SA_FX2(fs,x) (chk_fs(fs) mult((&Idx2Freq_Tbl[-2])[L_and(L_shr(fs,8),7)], (Word16)((x)/15625))) -#endif #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/est_tilt_fx.c b/lib_com/est_tilt_fx.c index 9d92d5d778c0c66690786a50daf91771d49569bb..95e527da0e813e09f3196ef785d0bd7a47095a0a 100644 --- a/lib_com/est_tilt_fx.c +++ b/lib_com/est_tilt_fx.c @@ -33,93 +33,9 @@ /* RETURN ARGUMENTS : */ /* _ (Word16) tolt_code : tilt of the code Q15 */ /*=======================================================================*/ -#ifndef CLEANUP_ACELP_ENC -Word16 est_tilt_fx( /* o : tilt of the code Q15 */ - const Word16 *exc, /* i : adaptive excitation vector Qx */ - const Word16 gain_pit, /* i : adaptive gain Q14 */ - const Word16 *code, /* i : algebraic excitation vector Q9 */ - const Word32 gain_code, /* i : algebraic code gain Q16 */ - Word16 *voice_fac, /* o : voicing factor Q15 */ - const Word16 Q_exc /* i : Scaling factor of excitation Q0 */ -) -{ - Word16 i, tmp, exp, ener1, exp1, ener2, exp2; - Word32 L_tmp; - Word16 tilt_code; - - ener1 = extract_h( Dot_product12( exc, exc, L_SUBFR, &exp1 ) ); - exp1 = sub( exp1, add( Q_exc, Q_exc ) ); - L_tmp = L_mult( gain_pit, gain_pit ); /* energy of pitch excitation */ - exp = norm_l( L_tmp ); - tmp = extract_h( L_shl( L_tmp, exp ) ); - ener1 = mult( ener1, tmp ); - exp1 = sub( sub( exp1, exp ), 10 ); /* 10 -> gain_pit Q14 to Q9 */ - - ener2 = extract_h( Dot_product12( code, code, L_SUBFR, &exp2 ) ); - - exp = norm_l( gain_code ); - tmp = extract_h( L_shl( gain_code, exp ) ); - tmp = mult( tmp, tmp ); /* energy of innovative code excitation */ - ener2 = mult( ener2, tmp ); - exp2 = sub( exp2, add( exp, exp ) ); - - i = sub( exp1, exp2 ); - BASOP_SATURATE_WARNING_OFF_EVS - ener1 = shr_sat( ener1, sub( 1, s_min( i, 0 ) ) ); - ener2 = shr_sat( ener2, add( s_max( 0, i ), 1 ) ); - BASOP_SATURATE_WARNING_ON_EVS - tmp = sub( ener1, ener2 ); - ener1 = add( add( ener1, ener2 ), 1 ); - - /* find voice factor (1=voiced, -1=unvoiced) */ - exp = div_s( abs_s( tmp ), ener1 ); - if ( tmp < 0 ) - { - exp = negate( exp ); - } - *voice_fac = exp; - move16(); - - /* tilt of code for next subframe: 0.5=voiced, 0=unvoiced */ - - /* tilt_code = (float)(0.25*(1.0 + *voice_fac)) */ - tilt_code = mac_r( 8192L /*0.25.Q15*/ * 65536 /*1.Q16*/ - 0x8000 /*1.Q15*/, *voice_fac, 8192 /*0.25.Q15*/ ); /*Q15 */ - - return tilt_code; -} - -/*======================================================================*/ -/* FUNCTION : est_tilt_ivas_fx() */ -/*-----------------------------------------------------------------------*/ -/* PURPOSE : Estimate spectral tilt based on the relative E of adaptive */ -/* and innovative excitations */ -/* */ -/*-----------------------------------------------------------------------*/ -/* INPUT ARGUMENTS : */ -/* _ (Word16 *) exc : adaptive excitation vector Q0 */ -/* _ (Word16) gain_pit : adaptive gain Q14 */ -/* _ (Word16 *) code : algebraic exctitation vector Q12 */ -/* _ (Word32) gain_code : algebraic code gain Q16 */ -/* _ (Word16) Q_exc : Scaling factor of excitation Q0 */ -/*-----------------------------------------------------------------------*/ -/* OUTPUT ARGUMENTS : */ -/* _ (Word16 *) voice_fac : voicing factor Q15 */ -/*-----------------------------------------------------------------------*/ -/* INPUT OUTPUT ARGUMENTS */ -/*-----------------------------------------------------------------------*/ - -/*-----------------------------------------------------------------------*/ -/* RETURN ARGUMENTS : */ -/* _ (Word16) tolt_code : tilt of the code Q15 */ -/*=======================================================================*/ -#endif /* o : tilt of the code Q15 */ -#ifdef CLEANUP_ACELP_ENC Word16 est_tilt_fx( -#else -Word16 est_tilt_ivas_fx( -#endif const Word16 *exc, /* i : adaptive excitation vector Qx */ const Word16 gain_pit, /* i : adaptive gain Q14 */ const Word16 *code, /* i : algebraic excitation vector Q9 */ @@ -127,10 +43,6 @@ Word16 est_tilt_ivas_fx( Word16 *voice_fac, /* o : voicing factor Q15 */ const Word16 Q_exc, /* i : Scaling factor of excitation Q0 */ const Word16 L_subfr /* i : Sub frame length */ -#ifndef CLEANUP_ACELP_ENC - , - const Word16 flag_tilt /* i : flag for special tilt */ -#endif ) { Word16 i, tmp, exp, ener1, exp1, ener2, exp2; @@ -170,29 +82,7 @@ Word16 est_tilt_ivas_fx( *voice_fac = exp; move16(); -#ifdef CLEANUP_ACELP_ENC tilt_code = mac_r( 8192L /*0.25.Q15*/ * 65536 /*1.Q16*/ - 0x8000 /*1.Q15*/, *voice_fac, 8192 /*0.25.Q15*/ ); /*Q15 */ -#else - IF( flag_tilt == 0 ) - { - /* tilt of code for next subframe: 0.5=voiced, 0=unvoiced */ - - /* tilt_code = (float)(0.25*(1.0 + *voice_fac)) */ - tilt_code = mac_r( 8192L /*0.25.Q15*/ * 65536 /*1.Q16*/ - 0x8000 /*1.Q15*/, *voice_fac, 8192 /*0.25.Q15*/ ); /*Q15 */ - } - ELSE IF( EQ_16( flag_tilt, 1 ) ) - { - /*Between 0.25 (=unvoiced) and 0.5 (=voiced)*/ - // tilt_code = (float)(0.25f + (*voice_fac + 1.0f) * 0.125f); - tilt_code = mac_r( 12288L /*0.375.Q15*/ * 65536 /*1.Q16*/ - 0x8000 /*1.Q15*/, *voice_fac, 4096 /*0.125.Q15*/ ); /*Q15 */ - } - ELSE - { - /*Between 0.28 (=unvoiced) and 0.56 (=voiced)*/ - // tilt_code = (float)(0.28f + (*voice_fac + 1.0f) * 0.14f); - tilt_code = mac_r( 13763L /*0.42.Q15*/ * 65536 /*1.Q16*/ - 0x8000 /*1.Q15*/, *voice_fac, 4588 /*0.14.Q15*/ ); /*Q15 */ - } -#endif return tilt_code; } diff --git a/lib_com/hvq_pvq_bitalloc_fx.c b/lib_com/hvq_pvq_bitalloc_fx.c index 2e01a7361318702a9aac7e447d32b282483e3613..905749d47d8ca12ecf270991ac0cab4a2082c75b 100644 --- a/lib_com/hvq_pvq_bitalloc_fx.c +++ b/lib_com/hvq_pvq_bitalloc_fx.c @@ -40,10 +40,8 @@ Word16 hvq_pvq_bitalloc_fx( UWord16 lsb; Word16 num_sfm; -#ifdef FIX_1483_PEAQ_VQ_ENC_MSAN_ERROR *n_sel_bands = 0; move16(); -#endif IF( EQ_16( bwidth_fx, FB ) ) { @@ -112,10 +110,6 @@ Word16 hvq_pvq_bitalloc_fx( return 0; } -#ifndef FIX_1483_PEAQ_VQ_ENC_MSAN_ERROR - *n_sel_bands = 0; - move16(); -#endif envSum = 0; move16(); E_max = L_deposit_l( 0 ); diff --git a/lib_com/ifft_rel_fx.c b/lib_com/ifft_rel_fx.c index d11e07baaabd43c803faf35dc6dea5c6557c8108..e47f07128eaf5d98d8a60987d14dd984ca6858e0 100644 --- a/lib_com/ifft_rel_fx.c +++ b/lib_com/ifft_rel_fx.c @@ -139,12 +139,10 @@ void ifft_rel_fx( /*Can be acheived with a shr */ step = idiv1616( N_MAX_SAS, n2 ); move16(); -#ifdef FIX_2268_OOB_INDEXING_IN_IFFT IF( LT_16( n8, 2 ) ) { continue; } -#endif s = sincos_t_fx + step; /*Q15 */ c = s + 64; /*Q15 */ s3 = sincos_t_fx + i_mult2( step, 3 ); /*Q15 */ diff --git a/lib_com/ivas_pca_tools_fx.c b/lib_com/ivas_pca_tools_fx.c index a265a149636fa5e92d0897493f23c873eec0873e..854578bfa5162ec209a53935b5aa0d252b88ba10 100644 --- a/lib_com/ivas_pca_tools_fx.c +++ b/lib_com/ivas_pca_tools_fx.c @@ -1375,11 +1375,7 @@ void pca_enc_s3_fx( q_ang_2surv_fx( ph1_fx, n1, ph1_q_fx, ind1 ); -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE tmp = mac_r( L_mac( L_mult( q_fx[1], q_fx[1] ), q_fx[2], q_fx[2] ), q_fx[3], q_fx[3] ); // Q15 + Q15 - Q15 -> Q15 -#else - tmp = add( add( mult( q_fx[1], q_fx[1] ), mult( q_fx[2], q_fx[2] ) ), mult( q_fx[3], q_fx[3] ) ); // Q15 + Q15 - Q15 -> Q15 -#endif r_e = 0; move16(); r_fx = Sqrt16( tmp, &r_e ); @@ -1433,11 +1429,7 @@ void pca_enc_s3_fx( q_ang_2surv_fx( ph2_fx, n2[i], ph2_q_fx + 2 * i, ind2 + 2 * i ); } -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE r_fx = Sqrt16( mac_r( L_mult( q_fx[2], q_fx[2] ), q_fx[3], q_fx[3] ), &r_e ); -#else - r_fx = Sqrt16( add( mult( q_fx[2], q_fx[2] ), mult( q_fx[3], q_fx[3] ) ), &r_e ); -#endif v_fx = BASOP_Util_Divide1616_Scale( q_fx[2], r_fx, &v_e ); v_e = add( v_e, sub( 0, r_e ) ); diff --git a/lib_com/log2.c b/lib_com/log2.c index 55ea6aa402ebac10554e864c2ed4deb0bec8fff9..6f398df1e66c198ca82f8208c0e496ce788fabd6 100644 --- a/lib_com/log2.c +++ b/lib_com/log2.c @@ -57,24 +57,17 @@ Word16 Log2_norm_lc( /* (o) : Fractional part of Log2. (range: 0<=val { Word16 i, a; Word16 y; -#ifndef FIX_2264_OUT_OF_BOUND_READING_IN_LOG2_NORM_LC - if ( L_x <= 0 ) - L_x = L_deposit_h( 0x4000 ); -#else if ( L_x > 0 ) /* There are many cases in the code where L_x == 0 */ assert( L_x >= 0x40000000 ); /* If assert fail, means input is not normalized as it should be */ L_x = L_max( L_x, 0x40000000 ); -#endif L_x = L_shr( L_x, 9 ); a = extract_l( L_x ); /* Extract b10-b24 of fraction */ a = lshr( a, 1 ); i = mac_r( L_x, -32 * 2 - 1, 16384 ); /* Extract b25-b31 minus 32 */ -#ifdef FIX_2284_ADD_ASSERT_LOG assert( ( i >= 0 ) && ( i < (Word16) ( sizeof( L_table_Log2_norm_lc ) / sizeof( L_table_Log2_norm_lc[0] ) ) ) && ( i < (Word16) ( sizeof( table_diff_Log2_norm_lc ) / sizeof( table_diff_Log2_norm_lc[0] ) ) ) ); -#endif y = mac_r( L_table_Log2_norm_lc[i], table_diff_Log2_norm_lc[i], a ); /* table[i] << 16 - diff*a*2 */ @@ -84,9 +77,7 @@ Word16 Log2_norm_lc( /* (o) : Fractional part of Log2. (range: 0<=val Word32 log10_fx( Word32 Linput ) /*o : Q23, i: 2Q13*/ { Word16 n1, frac, p1, p2, q1; -#ifdef FIX_2284_ADD_ASSERT_LOG Word16 idx; -#endif Word32 Ltemp1, Ltemp2; Word32 L_tmp; @@ -101,7 +92,6 @@ Word32 log10_fx( Word32 Linput ) /*o : Q23, i: 2Q13*/ Ltemp2 = L_mult( extract_h( Ltemp1 ), 0x40 ); frac = extract_l( Ltemp2 ); -#ifdef FIX_2284_ADD_ASSERT_LOG idx = sub( extract_h( Ltemp2 ), 0x20 ); assert( idx >= 0 && idx < (Word16) ( sizeof( log2_tab ) / sizeof( log2_tab[0] ) ) ); p1 = log2_tab[idx]; @@ -112,12 +102,6 @@ Word32 log10_fx( Word32 Linput ) /*o : Q23, i: 2Q13*/ p2 = log2_tab[idx]; move16(); -#else - p1 = log2_tab[sub( extract_h( Ltemp2 ), 0x20 )]; - move16(); - p2 = log2_tab[sub( extract_h( Ltemp2 ), 0x1F )]; - move16(); -#endif Ltemp2 = L_mult( n1, 0x200 ); n1 = extract_l( Ltemp2 ); diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 7893d9b798e0484631c8250daf31ce842a161152..945f3249d2a8f793921994405d5f1d2124f51785 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -2962,91 +2962,6 @@ void lsf_syn_mem_backup_fx( return; } -#ifndef CLEANUP_VBR_CAM_ENC -/*-------------------------------------------------------------------* - * lsf_syn_mem_backup_fx() - * - * - *--------------------------------------------------------------------*/ - -void lsf_syn_mem_backup_ivas_fx( - Encoder_State *st_fx, /* i: state structure */ - Word16 *btilt_code_fx, /* i: tilt code Q15 */ - Word32 *gc_threshold_fx, /* i: Q16 */ - Word16 *clip_var_bck_fx, /* o: Q(2.56), Q14, Q7, Q0, Q14, Q14 */ - Word16 *next_force_sf_bck_fx, /* o: */ - Word16 *lsp_new, /* i: LSP vector to quantize Q15 */ - Word16 *lsp_mid, /* i: mid-frame LSP vector Q15 */ - Word16 *clip_var, /* o: pitch clipping state var Q(2.56) */ - Word16 *mem_AR, /* o: quantizer memory for AR model Q(2.56) */ - Word16 *mem_MA, /* o: quantizer memory for AR model Q(2.56) */ - Word16 *lsp_new_bck, /* o: LSP vector to quantize- backup Q15 */ - Word16 *lsp_mid_bck, /* o: mid-frame LSP vector - backup Q15 */ - Word32 *Bin_E, /* o: FFT Bin energy 128 *2 sets Q_new + Q_SCALE - 2 */ - Word32 *Bin_E_old, /* o: FFT Bin energy 128 sets Q_new + Q_SCALE - 2 */ - Word16 *mem_syn_bck, /* o: synthesis filter memory ( 15 - st_fx->hLPDmem->e_mem_syn ) */ - Word16 *mem_w0_bck, /* o: memory of the weighting filter ( 15 - st_fx->hLPDmem->e_mem_syn ) */ - Word16 *streaklimit, /* Q15 */ - Word16 *pstreaklen ) -{ - Word16 i; - LPD_state_HANDLE hLPDmem = st_fx->hLPDmem; - - *clip_var = st_fx->clip_var_fx[0]; - move16(); - - FOR( i = 0; i < M; i++ ) - { - mem_AR[i] = st_fx->mem_AR_fx[i]; // Q2.56 - move16(); - mem_MA[i] = st_fx->mem_MA_fx[i]; // Q2.56 - move16(); - lsp_new_bck[i] = lsp_new[i]; // Q15 - move16(); - lsp_mid_bck[i] = lsp_mid[i]; // Q15 - move16(); - } - - *streaklimit = st_fx->streaklimit_fx; // Q15 - move16(); - *pstreaklen = st_fx->pstreaklen; - move16(); - - FOR( i = 0; i < L_FFT; i++ ) - { - Bin_E[i] = st_fx->Bin_E_fx[i]; // Q_new + Q_SCALE - 2 - move32(); - } - - FOR( i = 0; i < ( L_FFT / 2 ); i++ ) - { - Bin_E_old[i] = st_fx->Bin_E_old_fx[i]; // Q_new + Q_SCALE - 2 - move32(); - } - - /* back-up memories */ - FOR( i = 0; i < M; i++ ) - { - mem_syn_bck[i] = hLPDmem->mem_syn[i]; // Q( st_fx->hLPDmem->q_mem_syn ) - move16(); - } - - *mem_w0_bck = hLPDmem->mem_w0; // Q( st_fx->hLPDmem->q_mem_syn ) - move16(); - - - *btilt_code_fx = hLPDmem->tilt_code; // Q15 - move16(); - *gc_threshold_fx = hLPDmem->gc_threshold; // Q16 - move16(); - Copy( st_fx->clip_var_fx, clip_var_bck_fx, 6 ); - *next_force_sf_bck_fx = st_fx->next_force_safety_net; - move16(); - - - return; -} -#endif void lsf_update_memory( Word16 narrowband, /* i : narrowband flag */ @@ -3191,85 +3106,6 @@ void lsf_syn_mem_restore_fx( return; } -#ifndef CLEANUP_VBR_CAM_ENC -void lsf_syn_mem_restore_ivas_fx( - Encoder_State *st_fx, /* o: state structure */ - Word16 btilt_code_fx, /* i: Q15 */ - Word32 gc_threshold_fx, /* i: Q16 */ - Word16 *clip_var_bck_fx, /* i: Q(2.56), Q14, Q7, Q0, Q14, Q14 */ - Word16 next_force_sf_bck_fx, /* i: */ - Word16 *lsp_new, /* o: LSP vector to quantize Q15 */ - Word16 *lsp_mid, /* o: mid-frame LSP vector Q15 */ - Word16 clip_var, /* i: pitch clipping state var Q(2.56), Q14, Q7, Q0, Q14, Q14 */ - Word16 *mem_AR, /* i: quantizer memory for AR model 2.56 */ - Word16 *mem_MA, /* i: quantizer memory for MA model 2.56 */ - Word16 *lsp_new_bck, /* i: LSP vector to quantize- backup Q15 */ - Word16 *lsp_mid_bck, /* i: mid-frame LSP vector - backup Q15 */ - Word32 *Bin_E, /* i: FFT Bin energy 128 *2 sets Q_new + Q_SCALE - 2 */ - Word32 *Bin_E_old, /* i: FFT Bin energy 128 sets Q_new + Q_SCALE - 2 */ - Word16 *mem_syn_bck, /* i: synthesis filter memory Q(15 - st_fx->hLPDmem->e_mem_syn ) */ - Word16 mem_w0_bck, /* i: memory of the weighting filter Q(15 - st_fx->hLPDmem->e_mem_syn ) */ - Word16 streaklimit, /* i:LSF quantizer Q15 */ - Word16 pstreaklen /* i:LSF quantizer */ -) -{ - Word16 i; - LPD_state_HANDLE hLPDmem = st_fx->hLPDmem; - - /* restore lsf memories */ - st_fx->clip_var_fx[0] = clip_var; - move16(); - - FOR( i = 0; i < M; i++ ) - { - st_fx->mem_AR_fx[i] = mem_AR[i]; // 2.56 - move16(); - st_fx->mem_MA_fx[i] = mem_MA[i]; // 2.56 - move16(); - lsp_new[i] = lsp_new_bck[i]; // Q15 - move16(); - lsp_mid[i] = lsp_mid_bck[i]; // Q15 - move16(); - } - - st_fx->streaklimit_fx = streaklimit; // Q15 - move16(); - st_fx->pstreaklen = pstreaklen; - move16(); - - FOR( i = 0; i < L_FFT; i++ ) - { - st_fx->Bin_E_fx[i] = Bin_E[i]; // Q_new + Q_SCALE - 2 - move16(); - } - - FOR( i = 0; i < ( L_FFT / 2 ); i++ ) - { - st_fx->Bin_E_old_fx[i] = Bin_E_old[i]; // Q_new + Q_SCALE - 2 - move32(); - } - - /* restoring memories */ - hLPDmem->mem_w0 = mem_w0_bck; // Q( st_fx->hLPDmem->q_mem_syn ) - move16(); - - FOR( i = 0; i < M; i++ ) - { - hLPDmem->mem_syn[i] = mem_syn_bck[i]; // Q( st_fx->hLPDmem->q_mem_syn ) - move16(); - } - - move16(); - hLPDmem->tilt_code = btilt_code_fx; // Q15 - move32(); - hLPDmem->gc_threshold = gc_threshold_fx; // Q16 - Copy( clip_var_bck_fx, st_fx->clip_var_fx, 6 ); - st_fx->next_force_safety_net = next_force_sf_bck_fx; - move16(); - - return; -} -#endif /* Returns: codebook index */ Word16 tcxlpc_get_cdk( diff --git a/lib_com/options.h b/lib_com/options.h index 4a272cf24e4e578fc4823a28586a3b0ca871cb86..301bee4d85d157c1e3ce4329ae5d7e34803fbb45 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -84,39 +84,12 @@ #define FIX_1990_SANITIZER_IN_REVERB_LOAD /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure - keep until #2059 is addressed */ #define FIX_1999_TEMPORARY_DISABLE_DIST_ATT_CHECK /* Eri: Issue 1999: Range check on float values of distance attenuation, while the float values are not propagated to this function. The test is not correct, but configurable distance attenuation is not used in Characterization.*/ #define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */ -#define FIX_1466_EXTREND /* FhG: float issue 1466: enable rendering of mono/stereo to other formats in the external renderer */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ -#define FIX_1435_MOVE_STEREO_PANNING /* VA: issue 1435: do the EVS stereo panning in the renderer */ -#define FIX_2249_MEMORY_LEAK_IN_SBA /* OR : issue 2249 : Memory leak in SBA to BINAURAL_ROOM_REVERB with memory instrumentation */ -#define FIX_2252_SCALING_SAVE_HB_SYNTH /* VA: issue 2252: fix use-of-uninit-value in save_hb_synth_fx[] scaling in FOA decoding with bitstream that starts with an SID */ -#define FIX_2248_EVS_ASSERT /* VA: Include _sat in an EVS related part of the code */ -#define FIX_2254_IMPROV_COMPLEXITY_BE /* VA: BE small complexity reduction */ -#define FIX_2275_OOB_INDEXING_IN_PREDICT_SIGNAL_FUNC /* FhG: fix a USAN OOB error */ -#define FIX_2284_ADD_ASSERT_LOG /* FhG: add asserts to Log2_norm_lc() and log10_fx() */ -#define FIX_2286_GCC_WARNING_Idx2Freq_Tbl /* FhG: Fix compiler warning for OOB access of Idx2Freq_Tbl[] */ -#define FIX_CLANG18_MSAN_IN_DEC_INIT_BY_MOVING_COMMON_INITS_TOGETHER /* FhG: fix CLANG18 MSAN error in decoder init */ -#define FIX_1481_CLANG18_MSAN_INIT_LAST_ELEM_BRATE /* FhG: initialize last_element_brate to avoid CLANG18 MSAN complaint */ -#define FIX_1484_CLANG18_MSAN_INIT_ST_ELEM_BRATE /* FhG: initialize st->element_brate per default */ -#define FIX_1464_UBSAN_RC_CONTEXT_MAP /* FhG: BE UBSAN fix for float issue 1464 in the TCX range coder */ -#define FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH /* FhG: fix OOB index USAN error in TCX LTP pitch search */ -#define FIX_2274_OOB_INDEXING_IN_CORRMATRIX /* FhG: fix OOB indexing complaint */ -#define FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH /* FhG: fix oob indexing USAN complaint */ -#define FIX_2287_MCT_MDCT_STEREO_DATA_MALLOC_SIZE /* FhG: correct allocation size for STEREO_MDCT_DEC_DATA struct */ #define FIX_1904_HARM_GSC_ENC /* VA: #1904 Harmonization of EVS and IVAS GSC code */ -#define FIX_1474_USAN_TRANS_INV /* Eri: Float issue 1474: Fix USAN out-of-bounds warning. No OOB occurs, but the pointer is set to point to uninitialized memory. */ -#define FIX_2268_OOB_INDEXING_IN_IFFT /* VA: Fix for issue 2268, to silence clang18 */ -#define FIX_2271_OOB_INDEXING_IN_PIT_OL2 /* VA: Fix for issue 2271, to silence clang18 */ -#define FIX_2273_OOB_INDEXING_IN_PIT_FR4 /* VA: Fix to silence clang on ptr init */ -#define FIX_1483_PEAQ_VQ_ENC_MSAN_ERROR /* Eri: When no PVQ bands are selected in peaq_vq_enc, the number of bands is not initialized. */ -#define FIX_1480_CLANG18_MSAN_UNINIT_VARIABLE /* Eri: Initializes a variables in HQ decoder. It is not used, but is passed uninitialized to a function which is caught by clang-18 */ #define FIX_1449_RENDERER_FRAME_SIZE_UNCLEAR_IN_ISAR /* Dolby: Fix for issue 1449: renderer frame size unclear in ISAR */ #define FIX_1872_REMOVE_UNUSED_PSNOISEGEN_ISAR /* Dolby: Remove unused psNoiseGen from ISAR */ #define FIX_1478_UNINIT_ON_BFI /* VA: Fix issue 1478 where a vector is partly un-initialized during bfi */ -#define FIX_1487_ACCESS_OF_UNINIT_VAL_FROM_ARR_ISM_DTX /* FhG/VA: init nb_bits_metadata to zero */ #define FIX_1486_INIT_OUTPUT_POINTERS /* FhG: always initialize pointers in renderer flush */ -#define FIX_2290_COPY_OF_UNINIT_DATA /* VA: prevent the copy of un-initialized data */ -#define CLEANUP_ACELP_ENC /* VA: basop issue 2304: Remove duplicated code in excitation encoding in the ACELP core */ -#define CLEANUP_VBR_CAM_ENC /* VA: basop issue 2299: Remove unused core-encoder VBR and CAM code */ #define FIX_1494_SET_SPLITBFI_UNUSED /* Dolby: Fix issue 1494, remove unused function setting BFI flag in ISAR renderer */ #define FIX_1479_MSAN_SPAR_UNINITIALIZED_VALUE /* Dolby: Fix for issue 1479, MSAN error due to uninitialized value in SPAR */ #define HARM_LSF_ENC /* VA: basop issue 2301: Remove duplicated code in LSF quantizer */ @@ -130,18 +103,9 @@ /* #################### Start NON-BE switches ############################ */ /* any switch which is non-be wrt. TS 26.251 V3.0 */ -#define FIX_1454_FIX_STEREO_TO_FOA_JBM /* VA: issue 1454: fix buggy stereo to FOA in JBM */ -#define FIX_1461_CNG_BW_SWITCHING /* Eri: float issue 1461: Stereo parameters are not updated when SID/NODATA forces BW to stay the same */ -#define FIX_2041_SPECTRAL_GAPS_FOR_INACTIVE_FRAMES /* FhG: Using rounding in multiplication to improve precision in cngNoiseLevel[] */ -#define FIX_2264_OUT_OF_BOUND_READING_IN_LOG2_NORM_LC /* VA: Fix issue 2264 by adding a proper safeguard in log2 and by adding a missing normalization in swb_pre_proc_ivas_fx()*/ #define FIX_2250_LARGE_DIFFERENCES_BETWEEN_BASOP_AND_FLOAT /* Dolby: Issue 2250: random vector generation in GenShapedSHBExcitation() */ -#define FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE /* VA: Precision improvement without increasing complexity, or complexity reduction that might be not BE on the LSB */ -#define FIX_2252_LP_CNG_STARTS_SID /* VA: issues 2251 and 2252: fix LP CNG uninitialized value in bitstream that starts with an SID */ -#define FIX_1381_BWD /* VA: issue 1381: apply no hysteresis in BWD at higher bitrates also in mono MASA and OMASA */ -#define FIX_2285_CODE_DECODER_INIT_BW /* VA: basop issue 2285: fix core-decoder initialization bandwidth */ #define FIX_2306_MISSING_UPDATE_LOWRATE_PITCH_GAIN /* Dolby: Fix missing update of low-rate pitch gain in the S/M classifier */ #define FIX_2257_INCR_GUARD_BITS /* FhG: take correct rendering frame-size into account for guard-bits calculation */ -#define FIX_2297_SBA_SCALING_32KHZ /* VA: basop issue 2297: Fix scaling factor before the SBA decoder for output_Fs = 32 or 16 */ #define FIX_2315_AGC_MEMORY_RESET /* VA: basop issue 2315: fix reset of the AGC memory */ #define FIX_2312_CONDITION_MISSING_GSC_DEC_LR /* VA: basop issue 2297: addition of condition missing in the GSC gain decoder at low-rate */ #define FIX_2313_HF_RESET_16KHZ /* VA: basop issue 2313: Call hf_synth_reset_fx() also for 16 kHz output_Fs */ @@ -154,13 +118,9 @@ /* #################### Start BASOP optimization switches ############################ */ -#define OPT_2181_MATRIX_TRANSP_1_MUL /* Dolby: Issue 2181, optimize matrixTransp1Mul_fx. */ -#define OPT_2182_MATRIX_SCALE_OPS /* Dolby: Issue 2181, move matrix scale operations outside mul operations. */ -#define OPT_2185_MATRIX_OUT_SCALING /* Dolby: Issue 2185, optimize matrix-mul output-format. */ -#define NONBE_OPT_2239_IVAS_FILTER_PROCESS /* Dolby: Issue 2239, optimize ivas_filter_process_fx. */ -#define NONBE_OPT_2193_EIG2X2 /* Dolby: Issue 2193, optimize eig2x2_fx. */ -#define BE_FIX_2240_COMPUTE_COV_MTC_FX_FAST /* FhG: Speeds up covariance calculation e.g. 60 WMOPS for encoding -mc 7_1_4 24400 48 */ -#define OPT_2308_FIND_TARGET /* VA: Issue 2308, Speeds up computation and improve accuracy of the impulse response */ +#define NONBE_OPT_2239_IVAS_FILTER_PROCESS /* Dolby: Issue 2239, optimize ivas_filter_process_fx. */ +#define NONBE_OPT_2193_EIG2X2 /* Dolby: Issue 2193, optimize eig2x2_fx. */ +#define OPT_2308_FIND_TARGET /* VA: Issue 2308, Speeds up computation and improve accuracy of the impulse response */ /* #################### End BASOP optimization switches ############################ */ diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index 591eab841154b0b58b1235137d15a53e96409374..b04456870275c50cc5f02f259d093d6f1c991319 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -58,13 +58,8 @@ void pred_lt4_ivas_fx( FOR( i = 0; i < nb_coef; i++ ) { /*s += (*x1--) * (*c1) + (*x2++) * (*c2);*/ -#ifdef FIX_2254_IMPROV_COMPLEXITY_BE s64 = W_mac_32_16( s64, ( *c1 ), *x1-- ); /* Q_exc + Q32 */ s64 = W_mac_32_16( s64, ( *c2 ), *x2++ ); /* Q_exc + Q32 */ -#else - s64 = W_mac_32_32( s64, L_deposit_l( *x1-- ), ( *c1 ) ); /* Q_exc + Q32 */ - s64 = W_mac_32_32( s64, L_deposit_l( *x2++ ), ( *c2 ) ); /* Q_exc + Q32 */ -#endif c1 += up_sample; c2 += up_sample; } diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 588617196aec8fd700b481d4c3c1f847ae16f69b..708a5e2118efbaea9da48f29a2211f216278b733 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -906,28 +906,6 @@ void lsf_syn_mem_restore_fx( Word16 pstreaklen /* i:LSF quantizer */ ); -#ifndef CLEANUP_VBR_CAM_ENC -void lsf_syn_mem_restore_ivas_fx( - Encoder_State *st_fx, /* o: state structure */ - Word16 btilt_code_fx, /* i: Q15 */ - Word32 gc_threshold_fx, /* i: Q16 */ - Word16 *clip_var_bck_fx, /* i: Q(2.56), Q14, Q7, Q0, Q14, Q14 */ - Word16 next_force_sf_bck_fx, /* i: */ - Word16 *lsp_new, /* o: LSP vector to quantize Q15 */ - Word16 *lsp_mid, /* o: mid-frame LSP vector Q15 */ - Word16 clip_var, /* i: pitch clipping state var Q(2.56), Q14, Q7, Q0, Q14, Q14 */ - Word16 *mem_AR, /* i: quantizer memory for AR model 2.56 */ - Word16 *mem_MA, /* i: quantizer memory for MA model 2.56 */ - Word16 *lsp_new_bck, /* i: LSP vector to quantize- backup Q15 */ - Word16 *lsp_mid_bck, /* i: mid-frame LSP vector - backup Q15 */ - Word32 *Bin_E, /* i: FFT Bin energy 128 *2 sets Q_new + Q_SCALE - 2 */ - Word32 *Bin_E_old, /* i: FFT Bin energy 128 sets Q_new + Q_SCALE - 2 */ - Word16 *mem_syn_bck, /* i: synthesis filter memory Q(15 - st_fx->hLPDmem->e_mem_syn ) */ - Word16 mem_w0_bck, /* i: memory of the weighting filter Q(15 - st_fx->hLPDmem->e_mem_syn ) */ - Word16 streaklimit, /* i:LSF quantizer Q15 */ - Word16 pstreaklen /* i:LSF quantizer */ -); -#endif void lsf_update_memory( Word16 narrowband, /* i : narrowband flag */ const Word16 qisf[], /* i : quantized xSF coefficients */ @@ -2895,19 +2873,7 @@ Word16 tbe_celp_exc_offset( const Word16 L_frame /* i : frame lenght */ ); -#ifdef CLEANUP_ACELP_ENC void tbe_celp_exc_fx( -#else -void tbe_celp_exc( - const Word16 L_frame_fx, /* i : Frame lenght */ - const Word16 i_subfr_fx, /* i : sub frame */ - const Word16 T0_fx, /* i : Integer pitch */ - const Word16 T0_frac_fx, /* i : Fractional part of the pitch */ - Word16 *error_fx, /* i/o: Error */ - Word16 *bwe_exc_fx /* i/o: bandwitdh extension signal */ -); -void tbe_celp_exc_ivas( -#endif const Word16 element_mode, /* i : element mode */ const Word16 idchan, /* i : channel ID */ const Word16 L_frame_fx, /* i : Frame lenght */ @@ -3836,14 +3802,6 @@ void nelp_encoder_fx( Word16 *qIn1, Word16 reduce_gains ); -#ifndef CLEANUP_VBR_CAM_ENC -void nelp_encoder_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state */ - Word16 *in_fx, /* i : residual signal */ - Word16 *exc_fx, /* o : NELP quantized excitation signal */ - Word16 *qIn1, - Word16 reduce_gains ); -#endif void swb_bwe_enc_lr_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 L_m_core[], /* i : lowband synthesis */ @@ -4830,30 +4788,10 @@ Word16 est_tilt_fx( const Word16 *code, /* i : algebraic exctitation vector Q9 */ const Word32 gain_code, /* i : algebraic code gain Q16 */ Word16 *voice_fac, /* o : voicing factor Q15 */ -#ifdef CLEANUP_ACELP_ENC - const Word16 Q_exc, /* i : Scaling factor of excitation Q0 */ - const Word16 L_subfr /* i : Sub frame length */ -#else - const Word16 Q_exc /* i : Scaling factor of excitation Q0 */ -#endif -); - -#ifndef CLEANUP_ACELP_ENC -/* o : tilt of the code Q15 */ -Word16 est_tilt_ivas_fx( - const Word16 *exc, /* i : adaptive excitation vector Qx */ - const Word16 gain_pit, /* i : adaptive gain Q14 */ - const Word16 *code, /* i : algebraic excitation vector Q9 */ - const Word32 gain_code, /* i : algebraic code gain Q16 */ - Word16 *voice_fac, /* o : voicing factor Q15 */ const Word16 Q_exc, /* i : Scaling factor of excitation Q0 */ const Word16 L_subfr /* i : Sub frame length */ -#ifndef CLEANUP_ACELP_ENC - , - const Word16 flag_tilt /* i : flag for special tilt */ -#endif ); -#endif + /* o : tilt of the code */ Word16 Est_tilt2( const Word16 *exc, /* i : adaptive excitation vector Qx */ @@ -6846,18 +6784,7 @@ void gain_dec_lbr_fx( ); void lp_gain_updt_fx( -#ifdef CLEANUP_ACELP_ENC - const Word16 element_mode, /* i : element mode */ -#else - const Word16 i_subfr, /* i : subframe number Q0 */ - const Word16 gain_pit, /* i : Decoded gain pitch Q14 */ - const Word32 norm_gain_code, /* i : Normalised gain code Q16 */ - Word16 *lp_gainp, /* i/o: LP-filtered pitch gain(FEC) Q14 */ - Word16 *lp_gainc, /* i/o: LP-filtered code gain (FEC) Q3 */ - const Word16 L_frame /* i : length of the frame */ -); -void lp_gain_updt_ivas_fx( -#endif + const Word16 element_mode, /* i : element mode */ const Word16 i_subfr, /* i : subframe number Q0 */ const Word16 gain_pit, /* i : Decoded gain pitch Q14 */ const Word32 norm_gain_code, /* i : Normalised gain code Q16 */ @@ -7116,21 +7043,6 @@ void inov_decode_fx( const Word16 L_subfr /* i : subframe length Q0 */ ); -#ifndef CLEANUP_ACELP_ENC -void inov_decode_ivas_fx( - Decoder_State *st_fx, /* i/o: decoder state structure */ - const Word32 core_brate, /* i : core bitrate Q0 */ - const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode Q0 */ - const Word16 L_frame, /* i : length of the frame Q0 */ - const Word16 sharpFlag, /* i : formant sharpening flag Q0 */ - const Word16 i_subfr, /* i : subframe index Q0 */ - const Word16 *p_Aq, /* i : LP filter coefficients Q12 */ - const Word16 tilt_code, /* i : tilt of the excitation of previous subframe Q15 */ - const Word16 pt_pitch, /* i : pointer to current subframe fractional pitch Q6*/ - Word16 *code, /* o : algebraic excitation Q12 */ - const Word16 L_subfr /* i : subframe length Q0 */ -); -#endif void dec_acelp_4t64_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ Word16 nbbits, /* i : number of bits per codebook */ @@ -10661,27 +10573,6 @@ Word16 ari_decode_14bits_sign_ivas( Word16 *res, Tastat *s ); -#ifndef CLEANUP_VBR_CAM_ENC -void lsf_syn_mem_backup_ivas_fx( - Encoder_State *st_fx, /* i: state structure */ - Word16 *btilt_code_fx, /* i: tilt code Q15 */ - Word32 *gc_threshold_fx, /* i: Q16 */ - Word16 *clip_var_bck_fx, /* o: Q(2.56), Q14, Q7, Q0, Q14, Q14 */ - Word16 *next_force_sf_bck_fx, /* o: */ - Word16 *lsp_new, /* i: LSP vector to quantize Q15 */ - Word16 *lsp_mid, /* i: mid-frame LSP vector Q15 */ - Word16 *clip_var, /* o: pitch clipping state var Q(2.56) */ - Word16 *mem_AR, /* o: quantizer memory for AR model Q(2.56) */ - Word16 *mem_MA, /* o: quantizer memory for AR model Q(2.56) */ - Word16 *lsp_new_bck, /* o: LSP vector to quantize- backup Q15 */ - Word16 *lsp_mid_bck, /* o: mid-frame LSP vector - backup Q15 */ - Word32 *Bin_E, /* o: FFT Bin energy 128 *2 sets Q_new + Q_SCALE - 2 */ - Word32 *Bin_E_old, /* o: FFT Bin energy 128 sets Q_new + Q_SCALE - 2 */ - Word16 *mem_syn_bck, /* o: synthesis filter memory ( 15 - st_fx->hLPDmem->e_mem_syn ) */ - Word16 *mem_w0_bck, /* o: memory of the weighting filter ( 15 - st_fx->hLPDmem->e_mem_syn ) */ - Word16 *streaklimit, /* Q15 */ - Word16 *pstreaklen ); -#endif ivas_error config_acelp1_fx( const Word16 enc_dec, /* i : encoder/decoder flag */ const Word32 total_brate, /* i : total bitrate */ @@ -10897,13 +10788,6 @@ ivas_error IGF_Reconfig_fx( void core_switching_post_enc_ivas_fx( Encoder_State *st /* i/o: encoder state structure */ -#ifndef CLEANUP_ACELP_ENC - , - Word16 *old_inp_12k8_fx, /* i : old input signal @12.8kHz */ - Word16 *old_inp_16k_fx, /* i : old input signal @16kHz */ - Word16 A_fx[], /* i : unquant. LP filter coefs. */ - Word16 Q_new -#endif ); void residu_ivas_fx( diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 0ad2588f238d7e18092f3e45fe6993c50af42de2..d6543475927d26b1b8bf7ecf279539c0bc4b59a0 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -160,92 +160,8 @@ Word16 tbe_celp_exc_offset( * * Compute tbe bwe celp excitation *-------------------------------------------------------------------*/ -#ifndef CLEANUP_ACELP_ENC -void tbe_celp_exc( - const Word16 L_frame_fx, /* i : Frame lenght */ - const Word16 i_subfr_fx, /* i : sub frame */ - const Word16 T0_fx, /* i : Integer pitch Q0 */ - const Word16 T0_frac_fx, /* i : Fractional part of the pitch Q1 */ - Word16 *error_fx, /* i/o: Error Q5 */ - Word16 *bwe_exc_fx /* i/o: bandwitdh extension signal */ -) -{ - Word16 offset_fx, tmp_fx, i; - IF( EQ_16( L_frame_fx, L_FRAME ) ) - { - /*offset = T0 * HIBND_ACB_L_FAC + (int) ((float) T0_frac * 0.25f * HIBND_ACB_L_FAC + 2 * HIBND_ACB_L_FAC + 0.5f) - 2 * HIBND_ACB_L_FAC; - for (i=0; i 0 ) - { - tmp_fx = shr( *error_fx, 5 ); /*Q0*/ - } - ELSE - { - tmp_fx = negate( shr( abs_s( *error_fx ), 5 ) ); /*Q0*/ - } - - FOR( i = 0; i < L_SUBFR * HIBND_ACB_L_FAC; i++ ) - { - bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC - offset_fx + tmp_fx]; // Qx - move16(); - } - tmp_fx = extract_l( L_mult( T0_frac_fx, 1 ) ); /*Q3; 0.25 in Q2*/ - tmp_fx = add( shl( T0_fx, 3 ), tmp_fx ); /*Q3*/ - tmp_fx = extract_l( L_mult( tmp_fx, 5 ) ); /*Q5, 2.5 in Q1*/ - tmp_fx = sub( shl( offset_fx, 5 ), tmp_fx ); /*Q5*/ - *error_fx = add( *error_fx, tmp_fx ); /*Q5*/ - move16(); - } - ELSE - { - /* offset = T0*2.5 + (int) ((float) T0_frac * 0.25f*2.5 + 2*2.5 + 0.5f) - 2*2.5; - case above*/ - /* offset = T0*2 + (int) ((float) T0_frac * 0.25f*2 + 2*2 + 0.5f) - 2*2; - case here*/ - /*(int) ((float) T0_frac * 0.25f*2 + 2*2 + 0.5f)*/ - offset_fx = tbe_celp_exc_offset( T0_fx, T0_frac_fx, L_frame_fx ); - IF( *error_fx > 0 ) - { - tmp_fx = shr( *error_fx, 5 ); /*Q0*/ - } - ELSE - { - tmp_fx = negate( shr( abs_s( *error_fx ), 5 ) ); /*Q0*/ - } - - FOR( i = 0; i < L_SUBFR * 2; i++ ) - { - bwe_exc_fx[i + i_subfr_fx * 2] = bwe_exc_fx[i + i_subfr_fx * 2 - offset_fx + tmp_fx]; // Qx - move16(); - } - - /* error += (float) offset - (float) T0 * 2 - 0.5f * (float) T0_frac;*/ - tmp_fx = extract_l( L_mult( T0_frac_fx, 2 ) ); /*Q3; 0.5 in Q2*/ - tmp_fx = add( shl( T0_fx, 4 ), tmp_fx ); /* now tmp_fx = "T0_fx*2+ 0.5f*T0_frac_fx" in Q3*/ - tmp_fx = shl( tmp_fx, 2 ); /*now above tmp_fx in Q5*/ - tmp_fx = sub( shl( offset_fx, 5 ), tmp_fx ); /*move offset_fx to Q5, tmp_fx in Q5, ans tmp_fx in Q5*/ - *error_fx = add( *error_fx, tmp_fx ); /*error_fx in Q5*/ - move16(); - } -} - -/*-------------------------------------------------------------------* - * swb_tbe_celp_exc_ivas() - * - * Compute tbe bwe celp excitation - *-------------------------------------------------------------------*/ -#endif - -#ifdef CLEANUP_ACELP_ENC void tbe_celp_exc_fx( -#else -void tbe_celp_exc_ivas( -#endif const Word16 element_mode, /* i : element mode */ const Word16 idchan, /* i : channel ID */ const Word16 L_frame_fx, /* i : Frame lenght */ @@ -359,14 +275,12 @@ void tbe_celp_exc_ivas( /* _ None */ /*---------------------------------------------------------------------------*/ -#ifdef CLEANUP_ACELP_ENC static const Word16 local_negsin_table17[17] = { 0, -11793, -22005, -29268, -32609, -31580, -26319, -17530, -6393, 6393, 17530, 26319, 31580, 32609, 29268, 22005, 11793 }; /* Q15 */ static const Word16 local_cos_table17[17] = { 32767, 30571, 24279, 14732, 3212, -8739, -19519, -27683, -32137, -32137, -27683, -19519, -8739, 3212, 14732, 24279, 30571 }; /* Q15 */ -#endif void flip_and_downmix_generic_fx( Word16 input[], /* i : input spectrum Qx*/ @@ -390,24 +304,11 @@ void flip_and_downmix_generic_fx( /*Word16 s_tmp[L_FRAME32k];*/ /*Word16 factor;*/ Word16 period; -#ifndef CLEANUP_ACELP_ENC - Word16 local_negsin_table17[17] = { 0, -11793, -22005, -29268, -32609, -31580, - -26319, -17530, -6393, 6393, 17530, 26319, - 31580, 32609, 29268, 22005, 11793 }; /* Q15 */ - Word16 local_cos_table17[17] = { 32767, 30571, 24279, 14732, 3212, -8739, - -19519, -27683, -32137, -32137, -27683, - -19519, -8739, 3212, 14732, 24279, 30571 }; /* Q15 */ - Word16 *local_negsin_table, *local_cos_table; -#endif Word32 L_tmp; /* 1850 Hz downmix */ period = 17; move16(); -#ifndef CLEANUP_ACELP_ENC - local_negsin_table = local_negsin_table17; - local_cos_table = local_cos_table17; -#endif FOR( i = 0; i < length; i = i + 2 ) { @@ -489,14 +390,9 @@ void flip_and_downmix_generic_fx( { WHILE( ( j < period ) && ( i < length ) ) { -#ifdef CLEANUP_ACELP_ENC L_tmp = Mult_32_16( tmp_R[i + 4], local_cos_table17[j] ); /*//Qx+16 */ L_tmp = Madd_32_16( L_tmp, tmp_I[i + 4], local_negsin_table17[j] ); /*Qx+16 */ -#else - L_tmp = Mult_32_16( tmp_R[i + 4], local_cos_table[j] ); /*//Qx+16 */ - L_tmp = Madd_32_16( L_tmp, tmp_I[i + 4], local_negsin_table[j] ); /*Qx+16 */ -#endif - output[i] = round_fx( L_tmp ); /*Qx */ + output[i] = round_fx( L_tmp ); /*Qx */ move16(); i++; j++; @@ -538,24 +434,11 @@ void flip_and_downmix_generic_fx32( /*Word16 s_tmp[L_FRAME32k];*/ /*Word16 factor;*/ Word16 period; -#ifndef CLEANUP_ACELP_ENC - Word16 local_negsin_table17[17] = { 0, -11793, -22005, -29268, -32609, -31580, - -26319, -17530, -6393, 6393, 17530, 26319, - 31580, 32609, 29268, 22005, 11793 }; /* Q15 */ - Word16 local_cos_table17[17] = { 32767, 30571, 24279, 14732, 3212, -8739, - -19519, -27683, -32137, -32137, -27683, - -19519, -8739, 3212, 14732, 24279, 30571 }; /* Q15 */ - Word16 *local_negsin_table, *local_cos_table; -#endif Word32 L_tmp; /* 1850 Hz downmix */ period = 17; move16(); -#ifndef CLEANUP_ACELP_ENC - local_negsin_table = local_negsin_table17; - local_cos_table = local_cos_table17; -#endif FOR( i = 0; i < length; i = i + 2 ) { @@ -627,14 +510,9 @@ void flip_and_downmix_generic_fx32( WHILE( ( j < period ) && ( i < length ) ) { test(); -#ifdef CLEANUP_ACELP_ENC L_tmp = Mult_32_16( tmp_R[i + 4], local_cos_table17[j] ); /*//Qx+16 */ L_tmp = Madd_32_16( L_tmp, tmp_I[i + 4], local_negsin_table17[j] ); /*Qx+16 */ -#else - L_tmp = Mult_32_16( tmp_R[i + 4], local_cos_table[j] ); /*//Qx+16 */ - L_tmp = Madd_32_16( L_tmp, tmp_I[i + 4], local_negsin_table[j] ); /*Qx+16 */ -#endif - output[i] = L_tmp; /*Qx */ + output[i] = L_tmp; /*Qx */ move32(); i++; j++; @@ -6157,7 +6035,7 @@ void create_random_vector_fx( L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[0] ) ) ); /*Q23 */ } #else - L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[0] ) ) ); /*Q23 */ + L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[0] ) ) ); /*Q23 */ #endif j = extract_l( L_shr( L_tmp, 23 ) ); @@ -6174,7 +6052,7 @@ void create_random_vector_fx( } #else - L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ + L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ #endif k = extract_l( L_shr( L_tmp, 23 ) ); @@ -6192,7 +6070,7 @@ void create_random_vector_fx( L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ } #else - L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ + L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ #endif k = extract_l( L_shr( L_tmp, 23 ) ); diff --git a/lib_com/tcx_ltp_fx.c b/lib_com/tcx_ltp_fx.c index 1ecc8b7665b0ff7cd22727b2624c106c0d156782..29febbbfc0ba569368b8fa6ace26bdcf9756765a 100644 --- a/lib_com/tcx_ltp_fx.c +++ b/lib_com/tcx_ltp_fx.c @@ -401,7 +401,6 @@ void predict_signal( x0--; } -#ifdef FIX_2275_OOB_INDEXING_IN_PREDICT_SIGNAL_FUNC IF( EQ_16( frac_max, 6 ) ) { win = &inter6_2tcx2[frac][0]; /* Q15 */ @@ -410,11 +409,6 @@ void predict_signal( { win = &inter4_2tcx2[frac][0]; /* Q15 */ } -#else - win = &inter4_2tcx2[frac][0]; /* Q15 */ - if ( EQ_16( frac_max, 6 ) ) - win = &inter6_2tcx2[frac][0]; /* Q15 */ -#endif FOR( j = 0; j < L_subfr; j++ ) { diff --git a/lib_com/trans_direct_fx.c b/lib_com/trans_direct_fx.c index 7598bd42237bc1adc5fbdb7ce7df9ce165b80a34..c84cd9efad4c495df32efee54db2a27c02a2faa0 100644 --- a/lib_com/trans_direct_fx.c +++ b/lib_com/trans_direct_fx.c @@ -76,21 +76,14 @@ void direct_transform_fx( move32(); } -#ifndef FIX_1474_USAN_TRANS_INV - iseg_fx = &in32_r16_fx[-segment_length4]; /*Q*/ -#endif oseg_fx = out32_fx; /*Q*/ wh_fx = &win_fx[segment_length4]; /*Q15*/ wl_fx = wh_fx - 1; /*Q15*/ shift = extract_l( L_mult0( 3, segment_length4 ) ); /*Q0*/ -#ifdef FIX_1474_USAN_TRANS_INV - sh_fx = &in32_r16_fx[segment_length2]; /*Q*/ -#else - sh_fx = &iseg_fx[shift]; /*Q*/ -#endif - sl_fx2 = sh_fx - 1; /*Q*/ + sh_fx = &in32_r16_fx[segment_length2]; /*Q*/ + sl_fx2 = sh_fx - 1; /*Q*/ FOR( i = 0; i < segment_length4; i++ ) @@ -100,11 +93,7 @@ void direct_transform_fx( move32(); } -#ifdef FIX_1474_USAN_TRANS_INV sl_fx2 = &in32_r16_fx[( segment_length4 - 1 )]; /*Q*/ -#else - sl_fx2 = &iseg_fx[( segment_length2 - 1 )]; /*Q*/ -#endif FOR( i = segment_length4; i < segment_length2; i++ ) { @@ -117,11 +106,7 @@ void direct_transform_fx( edct_fx( dctin32_fx, oseg_fx, segment_length2, &Qs[0] ); Qmin = s_min( Qs[0], Qmin ); -#ifdef FIX_1474_USAN_TRANS_INV iseg_fx = &in32_r16_fx[segment_length4]; -#else - iseg_fx += segment_length2; -#endif oseg_fx += segment_length2; FOR( seg = 1; seg < NUM_TIME_SWITCHING_BLOCKS - 1; seg++ ) diff --git a/lib_com/trans_inv_fx.c b/lib_com/trans_inv_fx.c index 9a07742151ba6dc7bbf9c4ef8853c8c122f521e8..34d424f26e0bcdebff96c44bcc3584ff2f2f725c 100644 --- a/lib_com/trans_inv_fx.c +++ b/lib_com/trans_inv_fx.c @@ -1032,11 +1032,7 @@ void Inverse_Transform( } } -#ifdef FIX_1474_USAN_TRANS_INV out_segment = out_alias; -#else - out_segment = out_alias - segment_length_div4; -#endif in_segment = in_mdct_modif; /*Q*/ tmp = *Q; @@ -1055,11 +1051,7 @@ void Inverse_Transform( FOR( ta = segment_length_div4; ta < segment_length_div2; ta++ ) { -#ifdef FIX_1474_USAN_TRANS_INV *out_segment++ = L_shr( alias[ta], tmp ); /*q_out*/ -#else - out_segment[ta] = L_shr( alias[ta], tmp ); /*q_out*/ -#endif move32(); } /* This previous loop fills the output buffer from [0..seg_len_div4-1] */ @@ -1067,21 +1059,13 @@ void Inverse_Transform( win2 = &win[segment_length_div2]; /*Q15*/ FOR( ta = segment_length_div2; ta < segment_length; ta++ ) { -#ifdef FIX_1474_USAN_TRANS_INV *out_segment++ = L_shr( Mult_32_16( alias[ta], *--win2 ), tmp ); /*q_out*/ -#else - out_segment[ta] = L_shr( Mult_32_16( alias[ta], *--win2 ), tmp ); /*q_out*/ -#endif move32(); } /* This previous loop fills the output buffer from [seg_len_div4..seg_len-seg_len_div4-1] */ -#ifdef FIX_1474_USAN_TRANS_INV out_segment = &out_alias[segment_length_div4]; /*q_out*/ -#else - out_segment += segment_length_div2; /*q_out*/ -#endif - in_segment += segment_length_div2; /*Q*/ + in_segment += segment_length_div2; /*Q*/ FOR( seg = 1; seg < NUM_TIME_SWITCHING_BLOCKS - 1; seg++ ) { diff --git a/lib_dec/ACcontextMapping_dec_fx.c b/lib_dec/ACcontextMapping_dec_fx.c index e88d96aa686ee1cba56bbe7b28315e6c4385fb75..9b6ac8434f6235b4fd38a4c91d051cfdcf0748c9 100644 --- a/lib_dec/ACcontextMapping_dec_fx.c +++ b/lib_dec/ACcontextMapping_dec_fx.c @@ -702,15 +702,9 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx( c = add( 12, esc_nb ); } -#ifdef FIX_1464_UBSAN_RC_CONTEXT_MAP s = shl( s_and( s, 0x0F ), 4 ); /*Shift old 4 bits*/ s = add( s, c ); /*replace last 4 bits*/ t = s_and( s, 0xFF ); -#else - s = (UWord16) L_shl( s, 4 ); /*Shift old 4 bits*/ - s = (UWord16) L_add( s, c ); /*replace last 4 bits*/ - t = (UWord16) L_and( s, 0xFF ); -#endif } /* Decode signs */ diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index 580e3610aa8f3f11722911b5d926a54929f0bd88..c5d367699f632186feceb64089cfcee55bd073e6 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -2337,17 +2337,9 @@ ivas_error acelp_core_dec_fx( IF( NE_16( st->element_mode, EVS_MONO ) ) { -#ifdef FIX_2252_SCALING_SAVE_HB_SYNTH IF( save_hb_synth_fx16 != NULL ) -#else - IF( save_hb_synth_fx16 ) -#endif { -#ifdef FIX_2252_SCALING_SAVE_HB_SYNTH Copy_Scale_sig_32_16( save_hb_synth_fx, save_hb_synth_fx16, output_frame, 0 ); // Q0 -#else - Copy_Scale_sig_32_16( save_hb_synth_fx, save_hb_synth_fx16, L_FRAME48k, 0 ); // Q0 -#endif } Copy_Scale_sig_32_16( synth_fx, synth_fx16, output_frame, 0 ); // Q_syn2 } diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index 049626e597e13ebd43166a24a1ca28a83980c630..707957d0f29e01b3d862c6961adc86eeb2c6aacd 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -936,11 +936,7 @@ static void decod_gen_voic_core_switch_fx( gain_dec_mless_fx( st_fx, L_frame, GENERIC, 0, -1, code, st_fx->old_Es_pred_fx, &gain_pit, &gain_code, &gain_inov, &norm_gain_code ); } -#ifdef CLEANUP_ACELP_ENC st_fx->tilt_code_fx = est_tilt_fx( exc, gain_pit, code, gain_code, &voice_fac, *Q_exc, L_SUBFR ); /*Q15*/ -#else - st_fx->tilt_code_fx = est_tilt_fx( exc, gain_pit, code, gain_code, &voice_fac, *Q_exc ); /*Q15*/ -#endif move16(); /*----------------------------------------------------------------------* diff --git a/lib_dec/bass_psfilter_fx.c b/lib_dec/bass_psfilter_fx.c index 29672d3e0db3bd71b28c6515249fca15b37434c9..d2558f47c1f1bc9a5ff1b5dca78acb5763eeff17 100644 --- a/lib_dec/bass_psfilter_fx.c +++ b/lib_dec/bass_psfilter_fx.c @@ -1041,11 +1041,7 @@ Word16 res_bpf_adapt_ivas_fx( bpf_error_ratio = ONE_IN_Q14; // Q13 move16(); } -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE bpf_error_ratio = mac_r( L_mult( STEREO_DFT_BPF_ADAPT_BETA_FX, bpf_error_ratio ), ( MAX_16 - STEREO_DFT_BPF_ADAPT_BETA_FX ), hStereoDft->bpf_error_ratio_mem_fx ); -#else - bpf_error_ratio = add( mult( STEREO_DFT_BPF_ADAPT_BETA_FX, bpf_error_ratio ), mult( ( MAX_16 - STEREO_DFT_BPF_ADAPT_BETA_FX ), hStereoDft->bpf_error_ratio_mem_fx ) ); -#endif hStereoDft->bpf_error_ratio_mem_fx = bpf_error_ratio; move16(); diff --git a/lib_dec/dec_ace_fx.c b/lib_dec/dec_ace_fx.c index 9c1cd74acd7129e34163bd1467657e45842b5943..ac137b37c99be1174fcc91f5a549d265eeeff808 100644 --- a/lib_dec/dec_ace_fx.c +++ b/lib_dec/dec_ace_fx.c @@ -353,11 +353,7 @@ void decoder_acelp_fx( IF( st->igf != 0 ) { -#ifdef CLEANUP_ACELP_ENC tbe_celp_exc_fx( EVS_MONO, 0, st->L_frame, L_SUBFR, i_subfr, T0, T0_frac, &error, bwe_exc, 0 ); -#else - tbe_celp_exc( st->L_frame, i_subfr, T0, T0_frac, &error, bwe_exc ); -#endif } pitch_buffer[idx] = shl( add( shl( T0, 2 ), T0_frac ), 4 ); // Q6 diff --git a/lib_dec/dec_amr_wb_fx.c b/lib_dec/dec_amr_wb_fx.c index 2a977033dc2a2da841a1ab0440a839d5b2583cfc..af6c706f707b26fa9080b21007ba168478c7c1cc 100644 --- a/lib_dec/dec_amr_wb_fx.c +++ b/lib_dec/dec_amr_wb_fx.c @@ -99,17 +99,9 @@ void decod_amr_wb_fx( gain_dec_amr_wb_fx( st_fx, st_fx->core_brate, &gain_pit_fx, &L_gain_code_fx, hAmrwb_IO->past_qua_en_fx, &gain_inov_fx, code_fx, &L_norm_gain_code_fx ); /* update LP filtered gains for the case of frame erasures */ -#ifdef CLEANUP_ACELP_ENC lp_gain_updt_fx( EVS_MONO, i_subfr, gain_pit_fx, L_norm_gain_code_fx, &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, L_FRAME ); -#else - lp_gain_updt_fx( i_subfr, gain_pit_fx, L_norm_gain_code_fx, &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, L_FRAME ); -#endif -#ifdef CLEANUP_ACELP_ENC st_fx->tilt_code_fx = est_tilt_fx( exc_fx + i_subfr, gain_pit_fx, code_fx, L_gain_code_fx, &voice_fac_fx, st_fx->Q_exc, L_SUBFR ); -#else - st_fx->tilt_code_fx = est_tilt_fx( exc_fx + i_subfr, gain_pit_fx, code_fx, L_gain_code_fx, &voice_fac_fx, st_fx->Q_exc ); -#endif move16(); Rescale_exc( hMusicPF->dct_post_old_exc_fx, &exc_fx[i_subfr], NULL, st_fx->hGSCDec->last_exc_dct_in_fx, L_SUBFR, 0, diff --git a/lib_dec/dec_gen_voic_fx.c b/lib_dec/dec_gen_voic_fx.c index 0288e3d85761f7c7d6bd813432cb95a27844f4d6..e1a3917df5d5f1e1885f1db2cc5c36e825e02ab5 100644 --- a/lib_dec/dec_gen_voic_fx.c +++ b/lib_dec/dec_gen_voic_fx.c @@ -174,11 +174,7 @@ ivas_error decod_gen_voic_fx( pred_lt4( &exc_fx[i_subfr_fx], &exc_fx[i_subfr_fx], T0_fx, T0_frac_fx, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); } -#ifdef CLEANUP_ACELP_ENC tbe_celp_exc_fx( st_fx->element_mode, st_fx->idchan, L_frame, L_SUBFR, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx, st_fx->tdm_LRTD_flag ); -#else - tbe_celp_exc_ivas( st_fx->element_mode, st_fx->idchan, L_frame, L_SUBFR, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx, st_fx->tdm_LRTD_flag ); -#endif /*--------------------------------------------------------------* * LP filtering of the adaptive excitation @@ -222,11 +218,7 @@ ivas_error decod_gen_voic_fx( gain_dec_mless_fx( st_fx, L_frame, st_fx->coder_type, i_subfr_fx, -1, code_fx, Es_pred_fx, &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx ); } -#ifdef CLEANUP_ACELP_ENC st_fx->tilt_code_fx = est_tilt_fx( exc_fx + i_subfr_fx, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, st_fx->Q_exc, L_SUBFR ); // Q15 -#else - st_fx->tilt_code_fx = est_tilt_ivas_fx( exc_fx + i_subfr_fx, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, st_fx->Q_exc, L_SUBFR, 0 ); // Q15 -#endif move16(); /*-----------------------------------------------------------------* @@ -240,18 +232,7 @@ ivas_error decod_gen_voic_fx( } /* update LP filtered gains for the case of frame erasures */ -#ifdef CLEANUP_ACELP_ENC lp_gain_updt_fx( st_fx->element_mode, i_subfr_fx, gain_pit_fx, L_add( norm_gain_code_fx, norm_gain_preQ_fx ), &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, L_frame ); -#else - IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) - { - lp_gain_updt_fx( i_subfr_fx, gain_pit_fx, L_add( norm_gain_code_fx, norm_gain_preQ_fx ), &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, L_frame ); - } - ELSE - { - lp_gain_updt_ivas_fx( i_subfr_fx, gain_pit_fx, L_add( norm_gain_code_fx, norm_gain_preQ_fx ), &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, L_frame ); - } -#endif /*----------------------------------------------------------------------* * Find the total excitation diff --git a/lib_dec/dec_pit_exc_fx.c b/lib_dec/dec_pit_exc_fx.c index 41fcb64c707b9457c54ce11dd1c1caaa2c23c34e..83818d1c9aae785f8534622fa770f1b6dc283cc1 100644 --- a/lib_dec/dec_pit_exc_fx.c +++ b/lib_dec/dec_pit_exc_fx.c @@ -202,11 +202,7 @@ void dec_pit_exc_fx( gain_dec_mless_fx( st_fx, st_fx->L_frame, LOCAL_CT, i_subfr_fx, -1, code_fx, Es_pred_fx, &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx ); -#ifdef CLEANUP_ACELP_ENC st_fx->tilt_code_fx = est_tilt_fx( exc_fx + i_subfr_fx, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, 0, L_subfr_fx ); -#else - st_fx->tilt_code_fx = est_tilt_ivas_fx( exc_fx + i_subfr_fx, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, 0, L_subfr_fx, 0 ); -#endif move16(); } ELSE IF( EQ_16( use_fcb, 2 ) ) /* IVAS only */ @@ -220,11 +216,7 @@ void dec_pit_exc_fx( gain_dec_lbr_fx( st_fx, GENERIC, i_subfr_fx, code_fx, &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, gc_mem, gp_mem, L_subfr_fx ); -#ifdef CLEANUP_ACELP_ENC st_fx->tilt_code_fx = est_tilt_fx( exc_fx + i_subfr_fx, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, 0, L_subfr_fx ); -#else - st_fx->tilt_code_fx = est_tilt_ivas_fx( exc_fx + i_subfr_fx, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, 0, L_subfr_fx, 0 ); -#endif move16(); } ELSE @@ -426,11 +418,7 @@ void dec_pit_exc_fx( move16(); pt_gain++; -#ifdef CLEANUP_ACELP_ENC lp_gain_updt_fx( st_fx->element_mode, i_subfr_fx, gain_pit_fx, 0, &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, st_fx->L_frame ); -#else - lp_gain_updt_ivas_fx( i_subfr_fx, gain_pit_fx, 0, &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, st_fx->L_frame ); -#endif } } diff --git a/lib_dec/dec_tran_fx.c b/lib_dec/dec_tran_fx.c index 43a948bba590f800334cb78f4ab7d393c5c66545..110c6e97f08838057bdb027bf0dd9aca6b69fe69 100644 --- a/lib_dec/dec_tran_fx.c +++ b/lib_dec/dec_tran_fx.c @@ -168,27 +168,10 @@ void decod_tran_fx( } /* update LP filtered gains for the case of frame erasures */ -#ifdef CLEANUP_ACELP_ENC lp_gain_updt_fx( st_fx->element_mode, i_subfr, gain_pit_fx, L_add( norm_gain_code_fx, norm_gain_preQ_fx ), &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, L_frame_fx ); st_fx->tilt_code_fx = est_tilt_fx( exc_fx + i_subfr, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, st_fx->Q_exc, L_SUBFR ); move16(); -#else - IF( st_fx->element_mode == EVS_MONO ) - { - lp_gain_updt_fx( i_subfr, gain_pit_fx, L_add( norm_gain_code_fx, norm_gain_preQ_fx ), &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, L_frame_fx ); - - st_fx->tilt_code_fx = est_tilt_fx( exc_fx + i_subfr, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, st_fx->Q_exc ); - move16(); - } - ELSE - { - lp_gain_updt_ivas_fx( i_subfr, gain_pit_fx, L_add( norm_gain_code_fx, norm_gain_preQ_fx ), &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, L_frame_fx ); - - st_fx->tilt_code_fx = est_tilt_ivas_fx( exc_fx + i_subfr, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, st_fx->Q_exc, L_SUBFR, 0 ); - move16(); - } -#endif /*----------------------------------------------------------------------* * Find the total excitation diff --git a/lib_dec/dec_uv_fx.c b/lib_dec/dec_uv_fx.c index 9ced61d6864c6ef7ab4aca92a19552957e9a077a..83e5666b4f44ad691d655fdaa355ce364695ff40 100644 --- a/lib_dec/dec_uv_fx.c +++ b/lib_dec/dec_uv_fx.c @@ -116,26 +116,11 @@ void decod_unvoiced_fx( gain_dec_gacelp_uv_fx( index, code_fx, code2_fx, Es_pred_fx, L_SUBFR, &gain_pit_fx, &gain_code_fx, &gain_code2_fx, &( st_fx->past_gpit ), &norm_gain_code_fx, &gain_inov_fx ); -#ifdef CLEANUP_ACELP_ENC st_fx->tilt_code_fx = est_tilt_fx( exc_fx + i_subfr_fx, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, st_fx->Q_exc, L_SUBFR ); -#else - st_fx->tilt_code_fx = est_tilt_ivas_fx( exc_fx + i_subfr_fx, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, st_fx->Q_exc, L_SUBFR, 0 ); -#endif move16(); /* update LP filtered gains for the case of frame erasures */ -#ifdef CLEANUP_ACELP_ENC lp_gain_updt_fx( st_fx->element_mode, i_subfr_fx, gain_pit_fx, norm_gain_code_fx, &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, L_FRAME ); -#else - IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) - { - lp_gain_updt_fx( i_subfr_fx, gain_pit_fx, norm_gain_code_fx, &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, L_FRAME ); - } - ELSE - { - lp_gain_updt_ivas_fx( i_subfr_fx, gain_pit_fx, norm_gain_code_fx, &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, L_FRAME ); - } -#endif /*-------------------------------------------------------* * - Find the total excitation. * diff --git a/lib_dec/decision_matrix_dec_fx.c b/lib_dec/decision_matrix_dec_fx.c index cddc163147a47c1fed76a5905838b3a80495613c..055f1325f884406f175cbf35e8ecc5d54ef82375 100644 --- a/lib_dec/decision_matrix_dec_fx.c +++ b/lib_dec/decision_matrix_dec_fx.c @@ -84,11 +84,9 @@ void decision_matrix_dec_fx( { st->L_frame = L_FRAME16k; move16(); -#ifdef FIX_2252_LP_CNG_STARTS_SID st->nb_subfr = NB_SUBFR16k; move16(); st->bwidth = s_max( st->bwidth, WB ); -#endif } } ELSE diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 88748bcecdc8623632cf8036c30d19078392b438..471600ca384bdf57eb243d35a22f4ea120904fde 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -1095,11 +1095,7 @@ Word16 ApplyFdCng_fx( s = s_max( s_min( s, sub( WORD32_BITS, 1 ) ), negate( sub( WORD32_BITS, 1 ) ) ); FOR( ; j <= hFdCngCom->part[k]; j++ ) { -#ifdef FIX_2041_SPECTRAL_GAPS_FOR_INACTIVE_FRAMES cngNoiseLevel[j] = L_shl_r( Mpy_32_16_r( hFdCngDec->bandNoiseShape[j], facTab[k] ), s ); /*Q31 - hFdCngDec->bandNoiseShape_exp*/ -#else - cngNoiseLevel[j] = L_shl( Mpy_32_16_1( hFdCngDec->bandNoiseShape[j], facTab[k] ), s ); /*Q31 - hFdCngDec->bandNoiseShape_exp*/ -#endif move32(); } } @@ -1710,11 +1706,7 @@ void perform_noise_estimation_dec_ivas_fx( FOR( p = 0; p < npart; p++ ) { temp = L_shl( msPeriodog[p], q_shift ); -#ifdef FIX_2041_SPECTRAL_GAPS_FOR_INACTIVE_FRAMES msNoiseEst[p] = Madd_32_16( Mpy_32_16_r( msNoiseEst[p], sub( MAX_16, alpha ) ), temp, alpha ); /*Q31 - hFdCngDec->msNoiseEst_exp*/ -#else - msNoiseEst[p] = Madd_32_16( Mpy_32_16_1( msNoiseEst[p], sub( MAX_16, alpha ) ), temp, alpha ); /*Q31 - hFdCngDec->msNoiseEst_exp*/ -#endif move32(); } } @@ -1792,11 +1784,7 @@ void perform_noise_estimation_dec_ivas_fx( L_tmp = L_shr( msPeriodog[p], sub( sub( 31, hFdCngDec->hFdCngCom->periodog_exp ), 4 ) ); IF( LT_32( L_tmp, msNoiseEst[p] ) ) { -#ifdef FIX_2041_SPECTRAL_GAPS_FOR_INACTIVE_FRAMES msNoiseEst[p] = Madd_32_16( Mpy_32_16_r( msNoiseEst[p], wght ), L_tmp, (Word16) L_sub( shr( MAX_16, sub( 15, scale ) ), wght ) ); /*temp_q_msNoiseEst[p]*/ -#else - msNoiseEst[p] = Madd_32_16( Mpy_32_16_1( msNoiseEst[p], wght ), L_tmp, (Word16) L_sub( shr( MAX_16, sub( 15, scale ) ), wght ) ); /*temp_q_msNoiseEst[p]*/ -#endif move32(); temp_q_msNoiseEst[p] = sub( add( hFdCngDec->msNoiseEst_exp, scale ), 15 ); move16(); @@ -1819,11 +1807,7 @@ void perform_noise_estimation_dec_ivas_fx( L_tmp = L_shr_sat( hFdCngDec->msPeriodog_ST_fx[p], sub( hFdCngDec->msNoiseEst_exp, hFdCngDec->msPeriodog_ST_exp ) ); /*Q31 - hFdCngDec->msPeriodog_ST_exp*/ IF( LT_32( L_tmp, msNoiseEst[p] ) ) { -#ifdef FIX_2041_SPECTRAL_GAPS_FOR_INACTIVE_FRAMES msNoiseEst[p] = Madd_32_16( Mpy_32_16_r( msNoiseEst[p], CNA_ACT_DN_FACT_Q15 ), L_tmp, ONE_IN_Q15 - CNA_ACT_DN_FACT_Q15 ); /*Q31 - hFdCngDec->msNoiseEst_exp*/ -#else - msNoiseEst[p] = Madd_32_16( Mpy_32_16_1( msNoiseEst[p], CNA_ACT_DN_FACT_Q15 ), L_tmp, ONE_IN_Q15 - CNA_ACT_DN_FACT_Q15 ); /*Q31 - hFdCngDec->msNoiseEst_exp*/ -#endif move32(); } } diff --git a/lib_dec/gain_dec_fx.c b/lib_dec/gain_dec_fx.c index c145610f8af488659267ec34f64163ba66526f62..cd19197cd379be2e99992c0b1de37442227357c6 100644 --- a/lib_dec/gain_dec_fx.c +++ b/lib_dec/gain_dec_fx.c @@ -989,125 +989,9 @@ void gain_dec_lbr_fx( /* RETURN ARGUMENTS : */ /* _ None */ /*=======================================================================*/ -#ifndef CLEANUP_ACELP_ENC -void lp_gain_updt_fx( - const Word16 i_subfr, /* i : subframe number Q0 */ - const Word16 gain_pit, /* i : Decoded gain pitch Q14 */ - const Word32 norm_gain_code, /* i : Normalised gain code Q16 */ - Word16 *lp_gainp, /* i/o: LP-filtered pitch gain(FEC) Q14 */ - Word16 *lp_gainc, /* i/o: LP-filtered code gain (FEC) Q3 */ - const Word16 L_frame /* i : length of the frame */ -) -{ - Word16 tmp; - - tmp = extract_h( L_shl_sat( norm_gain_code, 3 ) ); /*(16+3)-16 -> Q3*/ - IF( EQ_16( L_frame, L_FRAME ) ) - { - IF( EQ_16( i_subfr, 0 ) ) - { - *lp_gainp = mult( 3277, gain_pit ); - move16(); /*0.1 in Q15 = 3277 , (15+14)-15 -> Q14*/ - *lp_gainc = mult_r( 3277, tmp ); - move16(); /* (15+3)-15 -> Q3*/ - } - ELSE IF( EQ_16( i_subfr, L_SUBFR ) ) - { - *lp_gainp = add( *lp_gainp, mult( 6554, gain_pit ) ); - move16(); /*Q14 (0.2 in Q15 = 6554)*/ - *lp_gainc = mac_r( L_deposit_h( *lp_gainc ), 6554, tmp ); - move16(); /*Q3*/ - } - ELSE IF( EQ_16( i_subfr, 2 * L_SUBFR ) ) - { - *lp_gainp = add( *lp_gainp, mult( 9830, gain_pit ) ); - move16(); /*Q14 (0.3 in Q15 = 9830)*/ - *lp_gainc = mac_r( L_deposit_h( *lp_gainc ), 9830, tmp ); - move16(); /*Q3*/ - } - ELSE /* i_subfr == 3*L_SUBFR */ - { - *lp_gainp = add( *lp_gainp, mult( 13107, gain_pit ) ); - move16(); /*Q14 (0.4 in Q15 = 13107)*/ - *lp_gainc = mac_r_sat( L_deposit_h( *lp_gainc ), 13107, tmp ); - move16(); /*Q3*/ - } - } - ELSE - { - IF( i_subfr == 0 ) - { - *lp_gainp = mult( 2185, gain_pit ); - move16(); /*(1.0/15.0) in Q15 = 2185 , (15+14)-15 -> Q14*/ - *lp_gainc = mult_r( 2185, tmp ); - move16(); /* (15+3)-15 -> Q3*/ - } - ELSE IF( EQ_16( i_subfr, L_SUBFR ) ) - { - *lp_gainp = add( *lp_gainp, mult( 4369, gain_pit ) ); - move16(); /*Q14 (2.0/15.0 in Q15 = 4369)*/ - *lp_gainc = mac_r( L_deposit_h( *lp_gainc ), 4369, tmp ); - move16(); /*Q3*/ - } - ELSE IF( EQ_16( i_subfr, 2 * L_SUBFR ) ) - { - *lp_gainp = add( *lp_gainp, mult( 6554, gain_pit ) ); - move16(); /*Q14 (3.0/15.0 in Q15 = 6554)*/ - *lp_gainc = mac_r( L_deposit_h( *lp_gainc ), 6554, tmp ); - move16(); /*Q3*/ - } - ELSE IF( EQ_16( i_subfr, 3 * L_SUBFR ) ) - { - *lp_gainp = add( *lp_gainp, mult( 8738, gain_pit ) ); - move16(); /*Q14 (4.0/15.0 in Q15 = 8738)*/ - *lp_gainc = mac_r( L_deposit_h( *lp_gainc ), 8738, tmp ); - move16(); /*Q3*/ - } - ELSE /* i_subfr == 4*L_SUBFR */ - { - *lp_gainp = add( *lp_gainp, mult( 10923, gain_pit ) ); - move16(); /*Q14 (5.0/15.0 in Q15 = 10923)*/ - *lp_gainc = mac_r_sat( L_deposit_h( *lp_gainc ), 10923, tmp ); - move16(); /*Q3*/ - } - } - return; -} - -/*====================================================================== */ -/* FUNCTION : lp_gain_updt_ivas_fx() */ -/*-----------------------------------------------------------------------*/ -/* PURPOSE : Update of LP pitch and code gains (FEC) */ -/* */ -/*-----------------------------------------------------------------------*/ -/* INPUT ARGUMENTS : */ -/* _ (Word16) i_subfr : subframe number Q0 */ -/* _ (Word16) gain_pit : Decoded gain pitch Q14 */ -/* _ (Word32) norm_gain_code : Normalised gain code Q16 */ -/* _ (Word16) L_frame : length of the frame Q0 */ -/*-----------------------------------------------------------------------*/ -/* OUTPUT ARGUMENTS : */ -/* _ (Word16 *) T0 : close loop integer pitch */ -/* _ (Word16 *) T0_frac : close loop fractional part of the pitch */ -/* _ (Word16 ) pitch : pitch value Q6 */ -/*-----------------------------------------------------------------------*/ -/* INPUT OUTPUT ARGUMENTS */ -/* _ (Word16 *) lp_gainp : LP-filtered pitch gain(FEC) Q14 */ -/* _ (Word16 *) lp_gainc : LP-filtered code gain (FEC) Q3 */ -/*-----------------------------------------------------------------------*/ - -/*-----------------------------------------------------------------------*/ -/* RETURN ARGUMENTS : */ -/* _ None */ -/*=======================================================================*/ -#endif -#ifdef CLEANUP_ACELP_ENC void lp_gain_updt_fx( - const Word16 element_mode, /* i : element mode */ -#else -void lp_gain_updt_ivas_fx( -#endif + const Word16 element_mode, /* i : element mode */ const Word16 i_subfr, /* i : subframe number Q0 */ const Word16 gain_pit, /* i : Decoded gain pitch Q14 */ const Word32 norm_gain_code, /* i : Normalised gain code Q16 */ @@ -1121,12 +1005,8 @@ void lp_gain_updt_ivas_fx( tmp = extract_h( L_shl_sat( norm_gain_code, 3 ) ); /*(16+3)-16 -> Q3*/ /* To handle extremely low values */ test(); -#ifdef CLEANUP_ACELP_ENC test(); if ( element_mode != EVS_MONO && norm_gain_code != 0 && tmp == 0 ) -#else - if ( norm_gain_code != 0 && tmp == 0 ) -#endif { tmp = 1; move16(); @@ -1204,12 +1084,8 @@ void lp_gain_updt_ivas_fx( /* To handle extremely low values */ test(); -#ifdef CLEANUP_ACELP_ENC test(); if ( element_mode != EVS_MONO && tmp != 0 && *lp_gainc == 0 ) -#else - if ( tmp != 0 && *lp_gainc == 0 ) -#endif { *lp_gainc = 1; move16(); diff --git a/lib_dec/gaus_dec_fx.c b/lib_dec/gaus_dec_fx.c index 456a7a9028cb86e0e42adb2b0bd66ef87fc03200..0d38c40bcae3b2bb344d92d0a21cb4c379361fca 100644 --- a/lib_dec/gaus_dec_fx.c +++ b/lib_dec/gaus_dec_fx.c @@ -87,18 +87,7 @@ void gaus_dec_fx( move32(); /* update LP filtered gains for the case of frame erasures */ -#ifdef CLEANUP_ACELP_ENC lp_gain_updt_fx( st_fx->element_mode, i_subfr, 0, *L_norm_gain_code, lp_gainp, lp_gainc, L_FRAME ); /* supposes that gain_dec_gaus() is used for ACELP@12k8 only */ -#else - IF( st_fx->element_mode == EVS_MONO ) - { - lp_gain_updt_fx( i_subfr, 0, *L_norm_gain_code, lp_gainp, lp_gainc, L_FRAME ); /* supposes that gain_dec_gaus() is used for ACELP@12k8 only */ - } - ELSE - { - lp_gain_updt_ivas_fx( i_subfr, 0, *L_norm_gain_code, lp_gainp, lp_gainc, L_FRAME ); /* supposes that gain_dec_gaus() is used for ACELP@12k8 only */ - } -#endif /*------------------------------------------------------------------------------------------* * Updates diff --git a/lib_dec/hq_hr_dec_fx.c b/lib_dec/hq_hr_dec_fx.c index 975b643a4fd331101684d16f39a58d8117e1e52a..858306b17dd3fa556a10ba26cf0ad2aa2768b970 100644 --- a/lib_dec/hq_hr_dec_fx.c +++ b/lib_dec/hq_hr_dec_fx.c @@ -166,10 +166,8 @@ void ivas_hq_hr_dec_fx( Word16 csw_flag1, csw_flag2; HQ_DEC_HANDLE hHQ_core = st_fx->hHQ_core; -#ifdef FIX_1480_CLANG18_MSAN_UNINIT_VARIABLE hq_generic_offset = 0; move16(); -#endif move16(); move16(); diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 933bfda721ba75e6a33ef079ad30deefa01d0bdd..52f977d59048970416b6bf574ff34a9dc79f3533 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -91,7 +91,6 @@ ivas_error init_decoder_fx( move16(); st_fx->ini_frame = 0; move16(); -#ifdef FIX_2252_LP_CNG_STARTS_SID IF( st_fx->element_mode == EVS_MONO ) { st_fx->bwidth = NB; @@ -101,23 +100,11 @@ ivas_error init_decoder_fx( } ELSE { -#ifdef FIX_2285_CODE_DECODER_INIT_BW st_fx->bwidth = WB; move16(); st_fx->last_bwidth = WB; -#else - st_fx->bwidth = NB; - move16(); - st_fx->last_bwidth = NB; -#endif move16(); } -#else - st_fx->bwidth = NB; - move16(); - st_fx->last_bwidth = NB; - move16(); -#endif st_fx->extl_brate = 0; move16(); diff --git a/lib_dec/inov_dec_fx.c b/lib_dec/inov_dec_fx.c index 30479dd045f1c35631ea87046bcb88c20713878f..21e70e083045a138a72ac4a8a909e9654abe63c4 100644 --- a/lib_dec/inov_dec_fx.c +++ b/lib_dec/inov_dec_fx.c @@ -191,189 +191,3 @@ void inov_decode_fx( cb_shape_fx( 1, 1, 0, sharpFlag, 0, g1, g2, p_Aq, code, tilt_code, shr( add( pt_pitch, 26 ), 6 ), 0, L_subfr ); return; } -#ifndef CLEANUP_ACELP_ENC -/*======================================================================*/ -/* FUNCTION : inov_decode_ivas_fx() */ -/*-----------------------------------------------------------------------*/ -/* PURPOSE : Decode the algebraic innovation and do pitch sharpening */ -/* */ -/*-----------------------------------------------------------------------*/ -/* INPUT ARGUMENTS : */ -/* _ (Word32) core_brate : Core bitrate Q0 */ -/* _ (Word16) Opt_AMR_WB : flag indicating AMR-WB IO mode Q0 */ -/* _ (Word16) L_frame : length of the frame Q0 */ -/* _ (Word16) i_subfr : length of the frame Q0 */ -/* _ (Word16) coder_type : coding type */ -/* _ (Word16) L_subfr : subframe length */ -/* _ (Word16) sharpFlag : formant sharpening flag */ -/* _ (Word16) tc_subfr : TC subframe index */ -/* _ (Word16 *) p_Aq : LP filter coefficients Q12 */ -/* _ (Word16) tilt_code : tilt of the excitation of previous subframe Q15*/ -/* _ (Word16) pt_pitch : current subframe fractional pitch Q6 */ -/*-----------------------------------------------------------------------*/ -/* OUTPUT ARGUMENTS : */ -/* _ (Word16 *[]) code : subframe length Q12 */ -/* _ (Word16 []) index_buf_4T : subframe length */ -/*-----------------------------------------------------------------------*/ -/* INPUT OUTPUT ARGUMENTS */ -/*-----------------------------------------------------------------------*/ - -/*-----------------------------------------------------------------------*/ -/* RETURN ARGUMENTS : */ -/* _ None */ -/*=======================================================================*/ - -void inov_decode_ivas_fx( - Decoder_State *st_fx, /* i/o: decoder state structure */ - const Word32 core_brate, /* i : core bitrate Q0 */ - const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode Q0 */ - const Word16 L_frame, /* i : length of the frame Q0 */ - const Word16 sharpFlag, /* i : formant sharpening flag Q0 */ - const Word16 i_subfr, /* i : subframe index Q0 */ - const Word16 *p_Aq, /* i : LP filter coefficients Q12 */ - const Word16 tilt_code, /* i : tilt of the excitation of previous subframe Q15 */ - const Word16 pt_pitch, /* i : pointer to current subframe fractional pitch Q6*/ - Word16 *code, /* o : algebraic excitation Q12 */ - const Word16 L_subfr /* i : subframe length Q0 */ -) -{ - Word16 nBits; - Word16 g1, g2; - - IF( EQ_16( L_frame, L_FRAME ) ) - { - g1 = FORMANT_SHARPENING_G1; - move16(); - g2 = FORMANT_SHARPENING_G2; - move16(); - } - ELSE - { - g1 = FORMANT_SHARPENING_G1_16k; - move16(); - g2 = FORMANT_SHARPENING_G2_16k; - move16(); - } - - IF( !Opt_AMR_WB ) - { - IF( st_fx->acelp_cfg.fcb_mode ) - { - Word16 i; - Word16 indexing_indices[8], wordcnt, bitcnt; - PulseConfig config; - test(); - test(); - test(); - IF( st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_subfr] >= 0 ) - { - IF( EQ_16( L_subfr, 2 * L_SUBFR ) ) - { - nBits = st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_subfr]; // Q0 - move16(); - - IF( EQ_16( nBits, 8 ) ) - { - dec_acelp_1t64_fx( st_fx, code, L_subfr ); - } - ELSE - { - dec_acelp_fast_fx( st_fx, nBits, code, L_subfr ); - } - } - ELSE IF( ( EQ_16( st_fx->idchan, 1 ) && LE_16( st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR], 7 ) ) || ( ( st_fx->idchan == 0 ) && LE_16( st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR], 3 ) ) ) - { - IF( st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR] == 0 ) - { - dec_acelp_1t64_fx( st_fx, code, L_SUBFR ); - } - ELSE - { - dec_acelp_fast_fx( st_fx, st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR], code, L_SUBFR ); - } - } - ELSE - { - wordcnt = shr( ACELP_FIXED_CDK_BITS( st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR] ), 4 ); // Q0 - move16(); - bitcnt = s_and( ACELP_FIXED_CDK_BITS( st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR] ), 15 ); // Q0 - move16(); - - FOR( i = 0; i < wordcnt; i++ ) - { - indexing_indices[i] = get_next_indice_fx( st_fx, 16 ); // Q0 - move16(); - } - IF( bitcnt ) - { - indexing_indices[i] = get_next_indice_fx( st_fx, bitcnt ); // Q0 - move16(); - } - config = PulseConfTable[st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR]]; - D_ACELP_indexing_fx( code, config, NB_TRACK_FCB_4T, indexing_indices, &st_fx->BER_detect ); - } - } - ELSE - { - set16_fx( code, 0, L_SUBFR ); - } - } - ELSE - { - nBits = st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR]; // Q0 - move16(); - - IF( EQ_16( nBits, 7 ) ) - { - dec_acelp_1t64_fx( st_fx, code, L_SUBFR ); - } - ELSE IF( EQ_16( nBits, 12 ) ) - { - dec_acelp_2t32_fx( st_fx, code ); - } - ELSE - { - dec_acelp_4t64_fx( st_fx, nBits, code, Opt_AMR_WB ); - } - } - } - ELSE - { - IF( EQ_32( core_brate, ACELP_6k60 ) ) - { - dec_acelp_2t32_fx( st_fx, code ); - } - ELSE IF( EQ_32( core_brate, ACELP_8k85 ) ) - { - dec_acelp_4t64_fx( st_fx, 20, code, Opt_AMR_WB ); - } - ELSE IF( EQ_32( core_brate, ACELP_12k65 ) ) - { - dec_acelp_4t64_fx( st_fx, 36, code, Opt_AMR_WB ); - } - ELSE IF( EQ_32( core_brate, ACELP_14k25 ) ) - { - dec_acelp_4t64_fx( st_fx, 44, code, Opt_AMR_WB ); - } - ELSE IF( EQ_32( core_brate, ACELP_15k85 ) ) - { - dec_acelp_4t64_fx( st_fx, 52, code, Opt_AMR_WB ); - } - ELSE IF( EQ_32( core_brate, ACELP_18k25 ) ) - { - dec_acelp_4t64_fx( st_fx, 64, code, Opt_AMR_WB ); - } - ELSE IF( EQ_32( core_brate, ACELP_19k85 ) ) - { - dec_acelp_4t64_fx( st_fx, 72, code, Opt_AMR_WB ); - } - ELSE - { - dec_acelp_4t64_fx( st_fx, 88, code, Opt_AMR_WB ); - } - } - - cb_shape_fx( 1, 1, 0, sharpFlag, 0, g1, g2, p_Aq, code, tilt_code, shr( add( pt_pitch, 26 ), 6 ), 0, L_subfr ); - return; -} -#endif diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index bf1f75333e3f46e6d7a28fa4b76e89b5293ea159..d839e3808a917fb02aa6cbaae276b2c5c34a8689 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -562,14 +562,10 @@ ivas_error ivas_core_dec_fx( hSCE->q_save_hb_synth_fx = Q11; move16(); } -#ifdef FIX_2290_COPY_OF_UNINIT_DATA IF( st->hBWE_FD != NULL ) { Copy_Scale_sig_16_32_DEPREC( old_syn_12k8_16k_fx_16, old_syn_12k8_16k_fx[n], st->L_frame, Q11 - ( -Q1 ) ); // Q(11 - (-1)) } -#else - Copy_Scale_sig_16_32_DEPREC( old_syn_12k8_16k_fx_16, old_syn_12k8_16k_fx[n], L_FRAME16k, Q11 - ( -Q1 ) ); // Q(11 - (-1)) -#endif } Copy_Scale_sig_32_16( st->previoussynth_fx_32, st->previoussynth_fx, L_FRAME48k, 0 ); // Q0 diff --git a/lib_dec/ivas_decision_matrix_dec_fx.c b/lib_dec/ivas_decision_matrix_dec_fx.c index fadd9d008a8a9fede030a54c86ebc8e2b76fce76..d6f1f8f4943b8dba261bb97a796385fb6ec5de09 100644 --- a/lib_dec/ivas_decision_matrix_dec_fx.c +++ b/lib_dec/ivas_decision_matrix_dec_fx.c @@ -115,11 +115,9 @@ void ivas_decision_matrix_dec_fx( { st->L_frame = L_FRAME16k; move16(); -#ifdef FIX_2252_LP_CNG_STARTS_SID st->nb_subfr = NB_SUBFR16k; move16(); st->bwidth = s_max( st->bwidth, WB ); -#endif } ELSE { diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 939f1d8c58a60e177bbda0e4fc815cf910100a16..b32406a2091521f322c15edc482e98f672f7523b 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -1799,18 +1799,11 @@ ivas_error ivas_init_decoder_fx( IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { /* Init HRTF statistics */ -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA /* Allocate HRTF and init statistics */ IF( NE_32( ( error = ivas_reverb_HRTF_statistics_open_fx( &( st_ivas->hHrtfStatistics ), output_Fs ) ), IVAS_ERR_OK ) ) { return error; } -#else - IF( NE_32( ( error = ivas_HRTF_statistics_init_fx( &st_ivas->hHrtfStatistics, output_Fs ) ), IVAS_ERR_OK ) ) - { - return error; - } -#endif /* Get default reverb values based on format, if custom values were not given */ IF( EQ_16( st_ivas->hDecoderConfig->Opt_RendConfigCustom, 0 ) ) @@ -3549,30 +3542,12 @@ void ivas_destroy_dec_fx( ivas_combined_orientation_close_fx( &st_ivas->hCombinedOrientationData ); /* Time Domain binaural renderer handle */ -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); ivas_HRTF_td_binary_close_fx( &st_ivas->hHrtfTD ); -#else - IF( st_ivas->hBinRendererTd != NULL ) - { - ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); - } - - IF( st_ivas->hHrtfTD != NULL ) - { - BSplineModelEvalDealloc_fx( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval ); - - ivas_HRTF_binary_close_fx( &st_ivas->hHrtfTD ); - } -#endif /* CRend binaural renderer handle */ ivas_HRTF_CRend_binary_close_fx( &st_ivas->hHrtfCrend ); -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA - /* Fastconv HRTF memories */ - ivas_binaural_hrtf_close_fx( &st_ivas->hHrtfFastConv ); -#endif /* Fastconv HRTF filters */ ivas_HRTF_fastconv_binary_close_fx( &st_ivas->hHrtfFastConv ); @@ -3580,12 +3555,8 @@ void ivas_destroy_dec_fx( /* Parametric binauralizer HRTF filters */ ivas_HRTF_parambin_binary_close_fx( &st_ivas->hHrtfParambin ); -/* HRTF statistics */ -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA + /* HRTF statistics */ ivas_HRTF_statistics_binary_close_fx( &st_ivas->hHrtfStatistics ); -#else - ivas_HRTF_statistics_close_fx( &st_ivas->hHrtfStatistics ); -#endif /* Config. Renderer */ ivas_render_config_close_fx( &( st_ivas->hRenderConfig ) ); diff --git a/lib_dec/ivas_ism_dtx_dec_fx.c b/lib_dec/ivas_ism_dtx_dec_fx.c index ebd6a036063ecc7bdfa1fbc605232b434e42d12d..f69fe17ea5e3340154c765b0ea6d39190aa7731e 100644 --- a/lib_dec/ivas_ism_dtx_dec_fx.c +++ b/lib_dec/ivas_ism_dtx_dec_fx.c @@ -126,12 +126,10 @@ void ivas_ism_dtx_dec_fx( move16(); } } -#ifdef FIX_1487_ACCESS_OF_UNINIT_VAL_FROM_ARR_ISM_DTX ELSE { set16_fx( nb_bits_metadata, 0, st_ivas->nchan_transport ); } -#endif IF( !st_ivas->bfi ) { diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index fce0f97f37929f4fdda8fd9eae093c17a89c1a71..2104fc4510cab2de16fd8c11d2b54ffbf46e5245 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -401,11 +401,7 @@ ivas_error ivas_dec_fx( move16(); FOR( i = 0; i < 2; i++ ) { -#ifdef FIX_2297_SBA_SCALING_32KHZ s = s_min( s, L_norm_arr( p_output_fx[i], output_frame ) - 11 ) /* Guard bits */; -#else - s = s_min( s, L_norm_arr( p_output_fx[i], L_FRAME48k ) - 11 ) /* Guard bits */; // L_frame should be used instead of L_FRAME48k */ -#endif } FOR( i = 0; i < 2; i++ ) { @@ -971,11 +967,7 @@ ivas_error ivas_dec_fx( move16(); FOR( i = 0; i < 2; i++ ) { -#ifdef FIX_2297_SBA_SCALING_32KHZ s = s_min( s, L_norm_arr( p_output_fx[sba_ch_idx + i], output_frame ) - 11 /* Guard bits */ ); -#else - s = s_min( s, L_norm_arr( p_output_fx[sba_ch_idx + i], L_FRAME48k ) - 11 /* Guard bits */ ); -#endif } FOR( i = 0; i < 2; i++ ) { @@ -1452,11 +1444,7 @@ ivas_error ivas_dec_fx( move16(); FOR( i = 0; i < 2; i++ ) { -#ifdef FIX_2297_SBA_SCALING_32KHZ s = s_min( s, L_norm_arr( p_output_fx[i], output_frame ) - 11 /* Guard bits */ ); -#else - s = s_min( s, L_norm_arr( p_output_fx[i], L_FRAME48k ) - 11 /* Guard bits */ ); -#endif } FOR( i = 0; i < 2; i++ ) { @@ -1844,16 +1832,6 @@ ivas_error ivas_dec_render_fx( } ELSE IF( EQ_32( st_ivas->hTcBuffer->tc_buffer_mode, TC_BUFFER_MODE_BUFFER ) ) { -#ifndef FIX_1435_MOVE_STEREO_PANNING - Word16 slot_size, tmp, e; - - slot_size = st_ivas->hTcBuffer->n_samples_granularity; - move16(); - - /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ - tmp = BASOP_Util_Divide1616_Scale( nSamplesAsked, slot_size, &e ); - tmp = shr( tmp, sub( 15, e ) ); -#endif ivas_dec_tc_buffer_playout_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, p_output_fx ); } ELSE IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) || EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) ) @@ -1863,19 +1841,13 @@ ivas_error ivas_dec_render_fx( { ivas_ls_setup_conversion_fx( st_ivas, st_ivas->nchan_transport, *nSamplesRendered, p_tc_fx, p_output_fx ); } -#ifdef FIX_1435_MOVE_STEREO_PANNING ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_NON_DIEGETIC_DOWNMIX ) ) { ivas_apply_non_diegetic_panning_fx( p_tc_fx[0], p_output_fx, st_ivas->hDecoderConfig->non_diegetic_pan_gain_fx, *nSamplesRendered ); } -#endif ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) ) { -#ifdef FIX_1454_FIX_STEREO_TO_FOA_JBM ivas_stereo2sba_fx( p_tc_fx, p_output_fx, *nSamplesRendered ); -#else - ivas_stereo2sba_fx( p_output_fx, p_output_fx, *nSamplesRendered ); -#endif } } ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) ) @@ -3232,7 +3204,6 @@ Word16 ivas_dec_get_num_tc_channels_fx( test(); test(); test(); -#ifdef FIX_1435_MOVE_STEREO_PANNING test(); IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) ) { @@ -3240,9 +3211,6 @@ Word16 ivas_dec_get_num_tc_channels_fx( move16(); } ELSE IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) && EQ_16( st_ivas->hDecoderConfig->nchan_out, 1 ) ) -#else - IF( EQ_16( st_ivas->ivas_format, STEREO_FORMAT ) && EQ_16( st_ivas->hDecoderConfig->nchan_out, 1 ) ) -#endif { num_tc = 1; move16(); @@ -3383,13 +3351,6 @@ Word16 ivas_dec_get_num_tc_channels_fx( } } } -#ifndef FIX_1435_MOVE_STEREO_PANNING - ELSE IF( EQ_16( st_ivas->ivas_format, MONO_FORMAT ) && EQ_16( st_ivas->renderer_type, RENDERER_NON_DIEGETIC_DOWNMIX ) ) - { - num_tc = MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; - move16(); - } -#endif return num_tc; } @@ -3920,9 +3881,7 @@ TC_BUFFER_MODE ivas_dec_get_tc_buffer_mode_fx( buffer_mode = TC_BUFFER_MODE_BUFFER; move16(); BREAK; -#ifdef FIX_1435_MOVE_STEREO_PANNING case RENDERER_NON_DIEGETIC_DOWNMIX: -#endif case RENDERER_TD_PANNING: case RENDERER_BINAURAL_OBJECTS_TD: case RENDERER_BINAURAL_FASTCONV: @@ -3941,20 +3900,6 @@ TC_BUFFER_MODE ivas_dec_get_tc_buffer_mode_fx( buffer_mode = TC_BUFFER_MODE_RENDERER; move16(); BREAK; -#ifndef FIX_1435_MOVE_STEREO_PANNING - case RENDERER_NON_DIEGETIC_DOWNMIX: - IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) ) - { - buffer_mode = TC_BUFFER_MODE_BUFFER; - move16(); - } - ELSE - { - buffer_mode = TC_BUFFER_MODE_RENDERER; - move16(); - } - break; -#endif case RENDERER_MC_PARAMMC: IF( EQ_32( st_ivas->hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) ) { diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 5c5b0ac524d3a99d40db8eebd47362afea92bd01..c8a712c496d35f75419fb013496491c8642c4b86 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -699,11 +699,7 @@ ivas_error mct_dec_reconfigure_fx( move16(); /* MDCT stereo initialization */ -#ifdef FIX_2287_MCT_MDCT_STEREO_DATA_MALLOC_SIZE IF( ( hMCT->hBlockData[n]->hStereoMdct = (STEREO_MDCT_DEC_DATA_HANDLE) malloc( sizeof( STEREO_MDCT_DEC_DATA ) ) ) == NULL ) -#else - IF( ( hMCT->hBlockData[n]->hStereoMdct = (STEREO_MDCT_DEC_DATA_HANDLE) malloc( sizeof( STEREO_MDCT_ENC_DATA ) ) ) == NULL ) -#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MDCT Stereo \n" ) ); } diff --git a/lib_dec/ivas_output_config_fx.c b/lib_dec/ivas_output_config_fx.c index 2d825d64a5e2c4500d11666bf9715a058eddbe8b..932f076065c9bc17672d661766889cd78c0bb65c 100644 --- a/lib_dec/ivas_output_config_fx.c +++ b/lib_dec/ivas_output_config_fx.c @@ -283,22 +283,14 @@ void ivas_renderer_select( * Non-binaural rendering configurations *-----------------------------------------------------------------*/ -#ifdef FIX_1435_MOVE_STEREO_PANNING ELSE IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) || EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) ) -#else - ELSE IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) ) -#endif { test(); test(); test(); test(); test(); -#ifdef FIX_1435_MOVE_STEREO_PANNING IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) -#else - IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) -#endif { *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX; move16(); @@ -308,38 +300,13 @@ void ivas_renderer_select( *renderer_type = RENDERER_MC; move16(); } -#ifdef FIX_1435_MOVE_STEREO_PANNING ELSE IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) && ( EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) { *renderer_type = RENDERER_SBA_LINEAR_ENC; move16(); } -#endif } -#ifndef FIX_1435_MOVE_STEREO_PANNING - ELSE IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) ) - { - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) - { - *renderer_type = RENDERER_SBA_LINEAR_ENC; - move16(); - } - ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) - { - *renderer_type = RENDERER_MC; - move16(); - } - } -#endif ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) ) { test(); diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index 37bc171387db82d7feb74f8384df8fd9205553e7..5bb141207baa1745c3158825d17538d3cc82a5a6 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -1285,11 +1285,7 @@ void ivas_sba_dirac_stereo_dec_fx( move16(); FOR( i = 0; i < CPE_CHANNELS; i++ ) { -#ifdef FIX_2297_SBA_SCALING_32KHZ s = s_min( s, L_norm_arr( output[i], output_frame ) - Q11 ) /* Guard bits */; -#else - s = s_min( s, L_norm_arr( output[i], L_FRAME48k ) - 11 ) /* Guard bits */; // L_frame should be used instead of L_FRAME48k */ -#endif } FOR( i = 0; i < CPE_CHANNELS; i++ ) { diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index ab237934afcb059520eedd3d40234d1c6f2e5662..8d5f7d0c3846ee71dad9b18395edd29a0821722f 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -385,10 +385,8 @@ ivas_error create_sce_dec( move16(); hSCE->element_brate = element_brate; /*Q0*/ move32(); -#ifdef FIX_1481_CLANG18_MSAN_INIT_LAST_ELEM_BRATE hSCE->last_element_brate = hSCE->element_brate; move32(); -#endif set32_fx( hSCE->prev_hb_synth_fx, 0, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) ); @@ -406,10 +404,8 @@ ivas_error create_sce_dec( st->total_brate = hSCE->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ move32(); -#ifdef FIX_1484_CLANG18_MSAN_INIT_ST_ELEM_BRATE st->element_brate = -1; move32(); -#endif st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; move16(); st->is_ism_format = 0; diff --git a/lib_dec/ivas_sns_dec_fx.c b/lib_dec/ivas_sns_dec_fx.c index 2f0217b48ad7cbc167a7d35cd5999e7218685644..b86234ec9ca884bcdcb525cdabe1ee68360256c3 100644 --- a/lib_dec/ivas_sns_dec_fx.c +++ b/lib_dec/ivas_sns_dec_fx.c @@ -81,11 +81,7 @@ static void sns_1st_dec_fx( FOR( i = 0; i < M / 2; i++ ) { -#ifdef FIX_2254_IMPROV_COMPLEXITY_BE snsq_fx[i] = L_mac( L_mult( ( *p_dico++ ), cdbk_fix ), means[i], means_fix ); // Q16 -#else - snsq_fx[i] = L_add( L_mult( ( *p_dico++ ), cdbk_fix ), L_mult( means[i], means_fix ) ); // Q16 -#endif move32(); } @@ -93,11 +89,7 @@ static void sns_1st_dec_fx( FOR( i = M / 2; i < M; i++ ) { -#ifdef FIX_2254_IMPROV_COMPLEXITY_BE snsq_fx[i] = L_mac( L_mult( ( *p_dico++ ), cdbk_fix ), means[i], means_fix ); /*Q16*/ -#else - snsq_fx[i] = L_add( L_mult( ( *p_dico++ ), cdbk_fix ), L_mult( means[i], means_fix ) ); /*Q16*/ -#endif move32(); } diff --git a/lib_dec/ivas_stereo_cng_dec_fx.c b/lib_dec/ivas_stereo_cng_dec_fx.c index d08b38852953f2d5dc6122556bd17b469c296921..7edb49a929959c00af75fc888da9141b96a828ca 100644 --- a/lib_dec/ivas_stereo_cng_dec_fx.c +++ b/lib_dec/ivas_stereo_cng_dec_fx.c @@ -119,9 +119,7 @@ static void stereo_dft_generate_comfort_noise_fx( Word32 tmp32_1, tmp32_2; Word16 q_div, q_sqrt1, q_sqrt2, q_sqrt, sqrt_res; Word16 q_shift, q_shift_1, q_shift_2, min_q; -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE Word16 tmp16, tmp_p, tmp_s; -#endif hFdCngCom = st->hFdCngDec->hFdCngCom; push_wmops( "DFT_CNG" ); @@ -164,11 +162,7 @@ static void stereo_dft_generate_comfort_noise_fx( } ELSE { -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE hStereoDft->g_state_fx[b] = mac_r( L_mult( ONE_MINUS_A_GFILT_FX, extract_h( *pSideGain++ ) ), A_GFILT_FX, hStereoDft->g_state_fx[b] ); /* Q15 */ -#else - hStereoDft->g_state_fx[b] = add( mult( ONE_MINUS_A_GFILT_FX, extract_h( *pSideGain++ ) ), mult( A_GFILT_FX, hStereoDft->g_state_fx[b] ) ); /* Q15 */ -#endif move16(); } @@ -195,21 +189,13 @@ static void stereo_dft_generate_comfort_noise_fx( } ELSE { -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE hStereoCng->cm_fx[b] = mac_r( L_mult( ONE_MINUS_A_GFILT_FX, hStereoCng->coh_fx[b] ), A_GFILT_FX, hStereoCng->cm_fx[b] ); /* Q15 */ -#else - hStereoCng->cm_fx[b] = add( mult( ONE_MINUS_A_GFILT_FX, hStereoCng->coh_fx[b] ), mult( A_GFILT_FX, hStereoCng->cm_fx[b] ) ); /* Q15 */ -#endif move16(); } } ELSE { -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE hStereoCng->cm_fx[b] = mac_r( L_mult( ONE_MINUS_A_GFILT_FX, hStereoCng->coh_fx[b] ), A_GFILT_FX, hStereoCng->cm_fx[b] ); /* Q15 */ -#else - hStereoCng->cm_fx[b] = add( mult( ONE_MINUS_A_GFILT_FX, hStereoCng->coh_fx[b] ), mult( A_GFILT_FX, hStereoCng->cm_fx[b] ) ); /* Q15 */ -#endif move16(); } } @@ -241,7 +227,6 @@ static void stereo_dft_generate_comfort_noise_fx( } LR_ratio = extract_h( tdm_ratio_tabl_fx[hStereoCng->last_tdm_idx] ); /* Q15 */ -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE tmp16 = shr( hStereoDft->g_state_fx[b], 2 ); tmp_p = add( ONE_IN_Q13, tmp16 ); tmp_s = sub( ONE_IN_Q13, tmp16 ); @@ -251,16 +236,6 @@ static void stereo_dft_generate_comfort_noise_fx( L_mac( L_mult( tmp_p, tmp_p ), gamma, tmp16 ), L_mac( L_mult( tmp_s, tmp_s ), gamma, tmp16 ), &c_e ); -#else - c = BASOP_Util_Divide3232_Scale( - L_add( L_mult( add( ONE_IN_Q13, shr( hStereoDft->g_state_fx[b], 2 ) ), - add( ONE_IN_Q13, shr( hStereoDft->g_state_fx[b], 2 ) ) ), - L_shr( L_mult( gamma, gamma ), 4 ) ), - L_add( L_mult( sub( ONE_IN_Q13, shr( hStereoDft->g_state_fx[b], 2 ) ), - sub( ONE_IN_Q13, shr( hStereoDft->g_state_fx[b], 2 ) ) ), - L_shr( L_mult( gamma, gamma ), 4 ) ), - &c_e ); -#endif q_sqrt = c_e; move16(); sqrt_res = Sqrt16( mult( c, hStereoCng->cm_fx[b] ), &q_sqrt ); diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 491dcca1ca7f1207f4019476d90a3b15f73de4e8..a8548e0f1e4614e80439249d69cadc04e34f78ea 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -3719,11 +3719,7 @@ void stereo_dft_dec_sid_coh_fx( pred_fx = add( pred_fx, shl( mult( ( *pptr_fx++ ), cohBandq_fx[i] ), 2 ) ); /*q-13*/ } /* Weighted intra/inter-frame prediction */ -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE pred_fx = mac_r( L_mult( alpha_fx, pred_fx ), sub( 32767, alpha_fx ), shr( coh_fx[b], 2 ) ); /*q-13*/ -#else - pred_fx = add( mult( alpha_fx, pred_fx ), mult( sub( 32767, alpha_fx ), shr( coh_fx[b], 2 ) ) ); /*q-13*/ -#endif /* Read residual index from bitstream */ IF( LT_16( *nb_bits, nr_of_sid_stereo_bits ) ) /* If the bit limit is reached, res_index = 0 is assumed for remaining indices */ { diff --git a/lib_dec/ivas_stereo_ica_dec_fx.c b/lib_dec/ivas_stereo_ica_dec_fx.c index fc02a8ba480e410cd9263d5fc16116a971c7b8ac..5f39c179eb65ef7b53b4e9d0d874fb229616b36b 100644 --- a/lib_dec/ivas_stereo_ica_dec_fx.c +++ b/lib_dec/ivas_stereo_ica_dec_fx.c @@ -193,11 +193,7 @@ void stereo_tca_dec_fx( IF( currentNCShift != 0 ) { -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE currentNCShift = mac_r( L_mult( 19660 /* 0.6 in Q15 */, prevNCShift ), 13106 /* 0.4 in Q15 */, currentNCShift ); /* Q0 */ -#else - currentNCShift = add( mult( 19660 /* 0.6 in Q15 */, prevNCShift ), mult( 13106 /* 0.4 in Q15 */, currentNCShift ) ); /* Q0 */ -#endif } prevNCShift = hStereoTCA->interp_dec_prevNCShift; /* Q0 */ diff --git a/lib_dec/ivas_td_low_rate_dec_fx.c b/lib_dec/ivas_td_low_rate_dec_fx.c index 92d6d3153fad45660ab1e286ec99ab5811bd48fc..205093d6fa950e595719fd92b9d0bbe5d5249822 100644 --- a/lib_dec/ivas_td_low_rate_dec_fx.c +++ b/lib_dec/ivas_td_low_rate_dec_fx.c @@ -267,11 +267,7 @@ void decod_gen_2sbfr_fx( test(); IF( !( EQ_16( st->element_mode, IVAS_CPE_TD ) && EQ_16( st->idchan, 1 ) && !( st->tdm_LRTD_flag ) ) ) { -#ifdef CLEANUP_ACELP_ENC tbe_celp_exc_fx( st->element_mode, st->idchan, L_frame, 2 * L_SUBFR, i_subfr, T0, T0_frac, &error, bwe_exc, 0 ); -#else - tbe_celp_exc( L_frame, i_subfr, T0, T0_frac, &error, bwe_exc ); -#endif } /*--------------------------------------------------------------* @@ -297,11 +293,7 @@ void decod_gen_2sbfr_fx( * Innovation decoding *--------------------------------------------------------------*/ -#ifdef CLEANUP_ACELP_ENC inov_decode_fx( st, st->core_brate, 0, L_frame, sharpFlag, i_subfr, p_Aq, st->tilt_code_fx, *pt_pitch, code, 2 * L_SUBFR ); -#else - inov_decode_ivas_fx( st, st->core_brate, 0, L_frame, sharpFlag, i_subfr, p_Aq, st->tilt_code_fx, *pt_pitch, code, 2 * L_SUBFR ); -#endif /*--------------------------------------------------------------* * Gain decoding @@ -310,21 +302,12 @@ void decod_gen_2sbfr_fx( gain_dec_lbr_fx( st, GENERIC, i_subfr, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, gc_mem, gp_mem, 2 * L_SUBFR ); -#ifdef CLEANUP_ACELP_ENC st->tilt_code_fx = est_tilt_fx( exc + i_subfr, gain_pit, code, gain_code, &voice_fac, st->Q_exc, 2 * L_SUBFR ); /* Q15 */ -#else - st->tilt_code_fx = est_tilt_ivas_fx( exc + i_subfr, gain_pit, code, gain_code, &voice_fac, st->Q_exc, 2 * L_SUBFR, 0 ); /* Q15 */ -#endif move16(); /* update LP filtered gains for the case of frame erasures */ -#ifdef CLEANUP_ACELP_ENC lp_gain_updt_fx( st->element_mode, i_subfr, gain_pit, norm_gain_code, &st->lp_gainp_fx, &st->lp_gainc_fx, L_frame ); lp_gain_updt_fx( st->element_mode, add( i_subfr, L_SUBFR ), gain_pit, norm_gain_code, &st->lp_gainp_fx, &st->lp_gainc_fx, L_frame ); -#else - lp_gain_updt_ivas_fx( i_subfr, gain_pit, norm_gain_code, &st->lp_gainp_fx, &st->lp_gainc_fx, L_frame ); - lp_gain_updt_ivas_fx( add( i_subfr, L_SUBFR ), gain_pit, norm_gain_code, &st->lp_gainp_fx, &st->lp_gainc_fx, L_frame ); -#endif /*----------------------------------------------------------------------* * Find the total excitation diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 63cbe2e1e1771d489cbe22ac8dd7b16b5f1f7a49..8adcb9a3ec0393e2f164ae5e99be07bccd2e7a31 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -690,11 +690,7 @@ UWord8 apa_exec_fx( ) { UWord16 i; -#ifdef FIX_1435_MOVE_STEREO_PANNING Word16 frm_in[APA_BUF_PER_CHANNEL]; /* NOTE: this buffer could be smaller if alocated dynamically based on the actual sampling rate */ -#else - Word16 frm_in[CPE_CHANNELS * APA_BUF / APA_MAX_NUM_CHANNELS]; /* in EVS, 2 output channels */ /* NOTE: this buffer could be smaller if alocated dynamically based on the actual sampling rate and number of channels */ -#endif UWord16 l_frm_out; Word16 l_rem; Word32 dl_scaled, dl_copied, l_frm_out_target; diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index f7d12e5d2d97a9ec9d7a932818cf279a0a00c393..17a8d966edbaf4f26ed58a6ebb956580f2b99114 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -232,7 +232,6 @@ ivas_error IVAS_DEC_Open( move16(); /* set high-level parameters */ -#ifdef FIX_CLANG18_MSAN_IN_DEC_INIT_BY_MOVING_COMMON_INITS_TOGETHER st_ivas->codec_mode = 0; /* unknown before first frame */ st_ivas->transport_config = IVAS_AUDIO_CONFIG_INVALID; st_ivas->intern_config = IVAS_AUDIO_CONFIG_INVALID; @@ -244,15 +243,8 @@ ivas_error IVAS_DEC_Open( move16(); move16(); -#endif IF( EQ_16( mode, IVAS_DEC_MODE_EVS ) ) { -#ifndef FIX_CLANG18_MSAN_IN_DEC_INIT_BY_MOVING_COMMON_INITS_TOGETHER - st_ivas->codec_mode = 0; /* unknown before first frame */ - st_ivas->transport_config = IVAS_AUDIO_CONFIG_INVALID; - st_ivas->intern_config = IVAS_AUDIO_CONFIG_INVALID; - st_ivas->writeFECoffset = 0; -#endif st_ivas->element_mode_init = EVS_MONO; st_ivas->ivas_format = MONO_FORMAT; hIvasDec->hasDecodedFirstGoodFrame = true; /* Functionality to suppress output for initial lost frames is disabled in EVS operation */ @@ -264,13 +256,6 @@ ivas_error IVAS_DEC_Open( } ELSE IF( EQ_16( mode, IVAS_DEC_MODE_IVAS ) ) { -#ifndef FIX_CLANG18_MSAN_IN_DEC_INIT_BY_MOVING_COMMON_INITS_TOGETHER - st_ivas->codec_mode = 0; /* unknown before first frame */ - st_ivas->transport_config = IVAS_AUDIO_CONFIG_INVALID; - st_ivas->intern_config = IVAS_AUDIO_CONFIG_INVALID; - st_ivas->writeFECoffset = 0; - st_ivas->sba_analysis_order = 0; -#endif st_ivas->element_mode_init = -1; st_ivas->ivas_format = UNDEFINED_FORMAT; st_ivas->renderer_type = RENDERER_DISABLE; @@ -1637,18 +1622,7 @@ static ivas_error ivas_dec_setup_all( IF( EQ_16( (Word16) hIvasDec->mode, IVAS_DEC_MODE_EVS ) ) { -#ifdef FIX_1435_MOVE_STEREO_PANNING *nTransportChannels = 1; -#else - IF( EQ_16( (Word16) hIvasDec->st_ivas->renderer_type, RENDERER_NON_DIEGETIC_DOWNMIX ) ) - { - *nTransportChannels = MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; - } - ELSE - { - *nTransportChannels = 1; - } -#endif move16(); } ELSE @@ -2494,11 +2468,7 @@ ivas_error IVAS_DEC_HRTF_binary_open( test(); IF( ( EQ_32( binaural_renderer, IVAS_BIN_RENDERER_TYPE_TDREND ) || EQ_32( binaural_renderer, IVAS_BIN_RENDERER_TYPE_DEFAULT ) ) && st_ivas->hHrtfTD == NULL ) { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA IF( ( error = ivas_HRTF_td_binary_open_fx( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK ) -#else - IF( ( error = ivas_HRTF_binary_open_fx( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2580,11 +2550,7 @@ ivas_error IVAS_DEC_HRTF_binary_close( test(); IF( !( EQ_32( binaural_renderer_old, IVAS_BIN_RENDERER_TYPE_TDREND ) || EQ_32( binaural_renderer_old, IVAS_BIN_RENDERER_TYPE_DEFAULT ) ) ) { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_td_binary_close_fx( &st_ivas->hHrtfTD ); -#else - ivas_HRTF_binary_close_fx( &st_ivas->hHrtfTD ); -#endif } test(); @@ -2597,10 +2563,6 @@ ivas_error IVAS_DEC_HRTF_binary_close( test(); IF( !( EQ_32( binaural_renderer_old, IVAS_BIN_RENDERER_TYPE_FASTCONV ) || EQ_32( binaural_renderer_old, IVAS_BIN_RENDERER_TYPE_DEFAULT ) ) ) { -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA - /* Fastconv HRTF memories */ - ivas_binaural_hrtf_close_fx( &st_ivas->hHrtfFastConv ); -#endif /* Fastconv HRTF filters */ ivas_HRTF_fastconv_binary_close_fx( &st_ivas->hHrtfFastConv ); @@ -3852,11 +3814,7 @@ static ivas_error apa_exec_evs_wrapper( { Word16 ch; UWord16 apa_buff_len; -#ifdef FIX_1435_MOVE_STEREO_PANNING Word16 tmp_apaExecBuffer[APA_BUF_PER_CHANNEL]; -#else - Word16 tmp_apaExecBuffer[CPE_CHANNELS * APA_BUF / APA_MAX_NUM_CHANNELS]; /* in EVS, 2 output channels */ -#endif DECODER_TC_BUFFER_HANDLE hTcBuffer; test(); @@ -5645,14 +5603,8 @@ static ivas_error evs_dec_main_fx( Decoder_Struct *st_ivas ) { DEC_CORE_HANDLE *hCoreCoder; -#ifndef FIX_1435_MOVE_STEREO_PANNING - Word16 mixer_left_fx, mixer_right_fx; - Word32 *p_output_fx[MAX_TRANSPORT_CHANNELS]; - Word16 ch, i, nOutSamples; -#else Word32 *p_output_fx[1]; Word16 i, nOutSamples; -#endif Word16 output_16[L_FRAME48k]; ivas_error error; @@ -5666,18 +5618,7 @@ static ivas_error evs_dec_main_fx( mdct_switching_dec_fx( hCoreCoder[0] ); -#ifdef FIX_1435_MOVE_STEREO_PANNING p_output_fx[0] = st_ivas->p_output_fx[0]; -#else - FOR( ch = 0; ch < MAX_TRANSPORT_CHANNELS; ch++ ) - { - p_output_fx[ch] = st_ivas->p_output_fx[ch]; // Q0 - IF( p_output_fx[ch] != NULL ) - { - set_zero_fx( p_output_fx[ch], L_FRAME48k ); - } - } -#endif /* run the main EVS decoding routine */ IF( EQ_16( hCoreCoder[0]->codec_mode, MODE1 ) ) @@ -5729,16 +5670,6 @@ static ivas_error evs_dec_main_fx( st_ivas->BER_detect = hCoreCoder[0]->BER_detect; move16(); -#ifndef FIX_1435_MOVE_STEREO_PANNING - IF( EQ_16( st_ivas->renderer_type, RENDERER_NON_DIEGETIC_DOWNMIX ) ) - { - mixer_left_fx = add( shr( st_ivas->hDecoderConfig->non_diegetic_pan_gain_fx, Q1 ), ONE_IN_Q14 ); // Q14 - mixer_right_fx = sub( MAX16B, mixer_left_fx ); - - v_multc_fx_16( p_output_fx[0], mixer_right_fx, p_output_fx[1], nOutSamples ); /* Q11 */ - v_multc_fx_16( p_output_fx[0], mixer_left_fx, p_output_fx[0], nOutSamples ); /* Q11 */ - } -#endif /*if ( st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO )*/ { diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index 2d2ad83b1b5da91e0cac8d59e5d50982cb26a145..b637047a2fa8f182e55c5cec56b5bdc0dcbba03d 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -1099,13 +1099,8 @@ void RCcontextMapping_encode2_no_mem_s17_LCS_fx( } /*Shift old 4 bits, replace last 4 bits*/ -#ifdef FIX_1464_UBSAN_RC_CONTEXT_MAP s = add( shl( s_and( s, 0x0F ), 4 ), cp ); t = s_and( s, 0xFF ); -#else - s = (UWord16) ( L_add( L_shl( s, 4 ), cp ) ); - t = (UWord16) L_and( s, 0xFF ); -#endif } /*end of the 2-tuples loop*/ } @@ -1569,13 +1564,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( cp = add( 12, esc_nb ); /* Q0 */ } /*shift old bits and replace last 4 bits*/ -#ifdef FIX_1464_UBSAN_RC_CONTEXT_MAP s = add( shl( s_and( s, 0x0F ), 4 ), cp ); t = s_and( s, 0xFF ); -#else - s = (UWord16) L_add( L_shl( s, 4 ), cp ); - t = s_and( s, 0xFF ); -#endif } /*end of the 2-tuples loop*/ tot_bits2 = round_fx( W_shl_sat_l( nbits2_fx, -Q7 ) ); /* Q23 -> Q16 -> Q0 */ diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index 89af9370771ebe5299242d406ca19a13994068d3..25928d3d23c577c1108cc23aeef0229c274b9c7a 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -96,16 +96,7 @@ ivas_error acelp_core_enc_fx( error = IVAS_ERR_OK; -#ifdef CLEANUP_ACELP_ENC (void) hStereoTD; -#else - test(); - IF( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && LE_32( st_fx->core_brate, SID_2k40 ) ) - { - /* Core was ACELP because of DTX in MDCT-Stereo, but SID encoding for that is done in separate function */ - return error; - } -#endif /*------------------------------------------------------------------* * Initialization *------------------------------------------------------------------*/ @@ -201,30 +192,11 @@ ivas_error acelp_core_enc_fx( move16(); } -#ifndef CLEANUP_ACELP_ENC - /* TD stereo */ - test(); - IF( EQ_16( st_fx->element_mode, IVAS_CPE_TD ) && EQ_16( st_fx->idchan, 1 ) ) - { - tdm_lp_reuse_flag = hStereoTD->tdm_lp_reuse_flag; - tdm_low_rate_mode = hStereoTD->tdm_low_rate_mode; - tdm_Pitch_reuse_flag = hStereoTD->tdm_Pitch_reuse_flag; - tdm_Pri_pitch_buf = hStereoTD->tdm_Pri_pitch_buf_fx; - } - ELSE -#endif { tdm_lp_reuse_flag = 0; tdm_low_rate_mode = 0; move16(); move16(); -#ifndef CLEANUP_ACELP_ENC - if ( EQ_16( st_fx->element_mode, IVAS_SCE ) && st_fx->low_rate_mode ) - { - tdm_low_rate_mode = 1; - move16(); - } -#endif tdm_Pitch_reuse_flag = 0; tdm_Pri_pitch_buf = NULL; move16(); @@ -569,26 +541,11 @@ ivas_error acelp_core_enc_fx( E_UTIL_deemph2( sub( Q_new, 1 ), syn1_fx, st_fx->preemph_fac, st_fx->L_frame, &hLPDmem->syn[M] ); Copy( syn1_fx + st_fx->L_frame - M - 1, hLPDmem->syn, M + 1 ); // Q_syn -#ifndef CLEANUP_ACELP_ENC - test(); - IF( st_fx->element_mode > EVS_MONO && st_fx->hTcxEnc != NULL ) - { - Copy( syn1_fx + st_fx->L_frame / 2, st_fx->hTcxEnc->Txnq, st_fx->L_frame / 2 ); // Q_syn - } -#endif /*--------------------------------------------------------------------------------------* * Modify the excitation signal when the noise is stationary *--------------------------------------------------------------------------------------*/ -#ifdef CLEANUP_ACELP_ENC IF( NE_16( nelp_mode, 1 ) ) -#else - test(); - test(); - test(); - test(); - IF( !( EQ_16( st_fx->idchan, 1 ) && EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) && NE_16( nelp_mode, 1 ) && !( EQ_16( st_fx->element_mode, IVAS_SCE ) && tdm_low_rate_mode ) ) -#endif { L_epsP[0] = L_Comp( epsP_h_fx[2], epsP_l_fx[2] ); move32(); @@ -751,20 +708,10 @@ ivas_error acelp_core_enc_ivas_fx( Word32 int_fs; Word16 nb_bits; /* parameters handling */ -#ifndef CLEANUP_VBR_CAM_ENC - /* SC-VBR - back-up memories for LSF quantizer and synthesis filter */ - Word16 pstreaklen; -#endif Word16 sid_bw = -1; move16(); -#ifndef CLEANUP_VBR_CAM_ENC - Word16 next_force_sf_bck; -#endif Word16 uc_two_stage_flag; Word16 position; -#ifndef CLEANUP_VBR_CAM_ENC - Word16 ppp_mode, nelp_mode; -#endif Word16 tdm_lp_reuse_flag, tdm_low_rate_mode, tdm_Pitch_reuse_flag; /* bitstream */ @@ -779,22 +726,12 @@ ivas_error acelp_core_enc_ivas_fx( Word16 tmp_noise_fx; /* NB post-filter long-term noise energy*/ Word16 old_bwe_exc_fx[( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2]; /* excitation buffer Q_new */ Word16 *bwe_exc_fx; /* excitation for SWB TBE Q_new */ -#ifndef CLEANUP_VBR_CAM_ENC - Word16 mem_MA_fx[M], mem_AR_fx[M], lsp_new_bck_fx[M], /*lsf_new_bck_fx[M],*/ lsp_mid_bck_fx[M], mem_syn_bck_fx[M]; - Word32 Bin_E_fx[L_FFT], Bin_E_old_fx[L_FFT / 2]; - Word16 clip_var_fx, mem_w0_bck_fx, streaklimit_fx; -#endif set16_fx( old_bwe_exc_fx, 0, ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 ); set16_fx( old_exc_fx, 0, L_EXC ); set16_fx( Aq, 0, NB_SUBFR16k * ( M + 1 ) ); set16_fx( syn_fx, 0, L_FRAME16k ); -#ifndef CLEANUP_VBR_CAM_ENC - Word16 tilt_code_bck_fx; - Word32 gc_threshold_bck_fx; - Word16 clip_var_bck_fx[6]; -#endif Word32 q_env_fx[NUM_ENV_CNG]; set32_fx( q_env_fx, 0, NUM_ENV_CNG ); set16_fx( exc2_fx, 0, L_FRAME16k ); @@ -917,34 +854,6 @@ ivas_error acelp_core_enc_ivas_fx( position = -1; move16(); -#ifndef CLEANUP_VBR_CAM_ENC - /* SC-VBR temporary variables */ - pstreaklen = 0; - move16(); - clip_var_fx = 0; - move16(); - mem_w0_bck_fx = 0; - move16(); - streaklimit_fx = 0; - move16(); - - /* channel-aware mode */ - reset_rf_indices_fx( st ); - - /* VBR modes */ - IF( st->Opt_SC_VBR ) - { - ppp_mode = st->hSC_VBR->ppp_mode; - nelp_mode = st->hSC_VBR->nelp_mode; - } - ELSE - { - ppp_mode = 0; - nelp_mode = 0; - } - move16(); - move16(); -#endif test(); /* TD stereo */ @@ -1210,15 +1119,7 @@ ivas_error acelp_core_enc_ivas_fx( uc_two_stage_flag = 0; move16(); -#ifndef CLEANUP_VBR_CAM_ENC - test(); - IF( !nelp_mode && !ppp_mode ) - { -#endif - config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#ifndef CLEANUP_VBR_CAM_ENC - } -#endif + config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); /*-----------------------------------------------------------------* * After inactive period, use the most up-to-date ISPs @@ -1255,10 +1156,6 @@ ivas_error acelp_core_enc_ivas_fx( * A[z] calculation *-----------------------------------------------------------------*/ -#ifndef CLEANUP_VBR_CAM_ENC - /* SC-VBR & channel-aware mode - back-up memories for LSF quantizer and synthesis filter */ - lsf_syn_mem_backup_ivas_fx( st, &tilt_code_bck_fx, &gc_threshold_bck_fx, clip_var_bck_fx, &next_force_sf_bck, lsp_new, lsp_mid, &clip_var_fx, mem_AR_fx, mem_MA_fx, lsp_new_bck_fx, lsp_mid_bck_fx, Bin_E_fx, Bin_E_old_fx, mem_syn_bck_fx, &mem_w0_bck_fx, &streaklimit_fx, &pstreaklen ); -#endif IF( !tdm_lp_reuse_flag ) { #ifdef HARM_LSF_ENC @@ -1384,68 +1281,15 @@ ivas_error acelp_core_enc_ivas_fx( encod_gen_2sbfr_fx( st, inp, Aw, Aq, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, Q_new, 0 ); } } -#ifndef CLEANUP_VBR_CAM_ENC - ELSE IF( nelp_mode ) - { - /* SC-VBR - NELP frames */ - encod_nelp_ivas_fx( st, inp, Aw, Aq, res_fx, syn_fx, &tmp_noise_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, Q_new, 0 ); - } -#endif ELSE IF( EQ_16( st->coder_type, UNVOICED ) ) { /* UNVOICED frames (Gauss. excitation) */ -#ifdef CLEANUP_ACELP_ENC encod_unvoiced_fx( st, inp, Aw, Aq, Es_pred_fx, uc_two_stage_flag, res_fx, syn_fx, &tmp_noise_fx, exc_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, Q_new, 0 ); -#else - encod_unvoiced_ivas_fx( st, inp, Aw, Aq, Es_pred_fx, uc_two_stage_flag, res_fx, syn_fx, &tmp_noise_fx, exc_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, Q_new, 0 ); -#endif } ELSE IF( EQ_16( st->coder_type, TRANSITION ) ) { -#ifdef CLEANUP_ACELP_ENC encod_tran_fx( st, inp, Aw, Aq, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, tc_subfr, position, unbits, 0, Q_new ); -#else - encod_tran_ivas_fx( st, inp, Aw, Aq, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, tc_subfr, position, unbits, 0, Q_new ); -#endif } -#ifndef CLEANUP_VBR_CAM_ENC - ELSE IF( ppp_mode ) - { - /* SC-VBR - PPP frames */ - IF( ( error = encod_ppp_ivas_fx( st, inp, Aw, Aq, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, Q_new, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - - IF( st->hSC_VBR->bump_up ) /* PPP failed, bump up */ - { - /* restore memories of LSF quantizer and synthesis filter */ - lsf_syn_mem_restore_ivas_fx( st, tilt_code_bck_fx, gc_threshold_bck_fx, clip_var_bck_fx, next_force_sf_bck, lsp_new, lsp_mid, clip_var_fx, mem_AR_fx, mem_MA_fx, lsp_new_bck_fx, lsp_mid_bck_fx, Bin_E_fx, Bin_E_old_fx, mem_syn_bck_fx, mem_w0_bck_fx, streaklimit_fx, pstreaklen ); - - /* Configure ACELP bit allocation */ - config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); - - /* redo LSF quantization */ -#ifdef HARM_LSF_ENC - lsf_enc_fx( st, lsf_new_fx, lsp_new, lsp_mid, Aq, tdm_low_rate_mode, 0, NULL, Q_new ); -#else - lsf_enc_ivas_fx( st, lsf_new_fx, lsp_new, lsp_mid, Aq, tdm_low_rate_mode, 0, NULL, Q_new ); -#endif - - /* recalculation of LP residual (filtering through A[z] filter) */ - calc_residu_fx( st, inp, res_fx, Aq ); - st->hTdCngEnc->burst_ho_cnt = 0; - move16(); - - /* VOICED frames in SC-VBR */ -#ifdef CLEANUP_ACELP_ENC - encod_gen_voic_fx( st, inp, Aw, Aq, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, unbits, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, 0, Q_new ); -#else - encod_gen_voic_ivas_fx( st, inp, Aw, Aq, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, unbits, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, 0, Q_new ); -#endif - } - } -#endif ELSE IF( EQ_16( st->coder_type, AUDIO ) || ( st->coder_type == INACTIVE && st->inactive_coder_type_flag ) ) { /* AUDIO and INACTIVE frames (coded by GSC technology) */ @@ -1458,11 +1302,7 @@ ivas_error acelp_core_enc_ivas_fx( ELSE { /* GENERIC, VOICED and INACTIVE frames (coded by AVQ technology) */ -#ifdef CLEANUP_ACELP_ENC encod_gen_voic_fx( st, inp, Aw, Aq, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, unbits, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, 0, Q_new ); -#else - encod_gen_voic_ivas_fx( st, inp, Aw, Aq, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, unbits, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, 0, Q_new ); -#endif } /* update mem_syn1_flt for ACELP core switching */ @@ -1515,12 +1355,7 @@ ivas_error acelp_core_enc_ivas_fx( test(); test(); test(); -#ifdef CLEANUP_VBR_CAM_ENC IF( !( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) ) && !( EQ_16( st->element_mode, IVAS_SCE ) && tdm_low_rate_mode ) ) -#else - test(); - IF( !( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) ) && NE_16( nelp_mode, 1 ) && !( EQ_16( st->element_mode, IVAS_SCE ) && tdm_low_rate_mode ) ) -#endif { /* exc2 buffer is needed only for updating of Aq[] which is needed for core switching */ Copy( exc_fx, exc2_fx, st->L_frame ); // Q_new @@ -1584,13 +1419,7 @@ ivas_error acelp_core_enc_ivas_fx( test(); test(); test(); -#ifdef CLEANUP_VBR_CAM_ENC IF( ( ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, WB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && NE_16( st->last_extl, SWB_TBE ) && NE_16( st->last_extl, WB_TBE ) && NE_16( st->last_extl, FB_TBE ) ) || ( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) && !st->tdm_LRTD_flag ) ) -#else - test(); - test(); - IF( ( EQ_16( st->last_Opt_SC_VBR, 1 ) && st->Opt_SC_VBR == 0 ) || ( ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, WB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && NE_16( st->last_extl, SWB_TBE ) && NE_16( st->last_extl, WB_TBE ) && NE_16( st->last_extl, FB_TBE ) ) || ( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) && !st->tdm_LRTD_flag ) ) -#endif { st->hBWE_TD->bwe_non_lin_prev_scale_fx = 0; move16(); @@ -1601,12 +1430,7 @@ ivas_error acelp_core_enc_ivas_fx( test(); test(); test(); -#ifdef CLEANUP_VBR_CAM_ENC IF( st->idchan == 0 || NE_16( st->element_mode, IVAS_CPE_TD ) || ( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) && st->tdm_LRTD_flag ) ) -#else - test(); - IF( !st->Opt_SC_VBR && ( st->idchan == 0 || NE_16( st->element_mode, IVAS_CPE_TD ) || ( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) && st->tdm_LRTD_flag ) ) ) -#endif { /* Apply a non linearity to the SHB excitation */ Copy_Scale_sig_16_32_no_sat( st->hBWE_TD->old_bwe_exc_extended_fx, bwe_exc_extended_fx, NL_BUFF_OFFSET, ( sub( shl( Q_new, 1 ), sub( st->hBWE_TD->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc @@ -1685,17 +1509,6 @@ ivas_error acelp_core_enc_ivas_fx( } } -#ifndef CLEANUP_VBR_CAM_ENC - /* SC-VBR update of average data rate */ - IF( EQ_16( st->vad_flag, 1 ) ) - { - /* reset in case of bitrate switching in EVS */ - if ( st->hSC_VBR != NULL ) - { - update_average_rate_fx( st->hSC_VBR, st->core_brate ); - } - } -#endif pop_wmops(); return error; diff --git a/lib_enc/acelp_core_switch_enc_fx.c b/lib_enc/acelp_core_switch_enc_fx.c index 98ab17afbd9d84db4591b1165697ff818397334f..b4c10b9acc5795dd1ab5351e9cca00f36055c22e 100644 --- a/lib_enc/acelp_core_switch_enc_fx.c +++ b/lib_enc/acelp_core_switch_enc_fx.c @@ -17,14 +17,8 @@ static void encod_gen_voic_core_switch_fx( Encoder_State *st_fx, const Word16 L_frame_fx, const Word16 inp_fx[], const Word16 Aq_fx[], const Word16 A_fx[], const Word16 T_op[], Word16 *exc_fx, const Word32 core_bitrate_fx, const Word16 shift, const Word16 Q_new ); -#ifndef CLEANUP_ACELP_ENC -static void encod_gen_voic_core_switch_ivas_fx( Encoder_State *st_fx, const Word16 L_frame_fx, const Word16 inp_fx[], const Word16 Aq_fx[], const Word16 A_fx[], const Word16 T_op[], Word16 *exc_fx, const Word32 core_bitrate_fx, const Word16 shift, const Word16 Q_new ); -#endif static void bwe_switch_enc_fx( Encoder_State *st_fx, const Word16 *new_speech ); -#ifndef CLEANUP_ACELP_ENC -static void bwe_switch_enc_ivas_fx( Encoder_State *st_fx, const Word16 *new_speech ); -#endif static Word16 dotprod_satcont( const Word16 *x, const Word16 *y, const Word16 qx, const Word16 qy, Word16 *qo, const Word16 len, const Word16 delta ); @@ -166,117 +160,6 @@ void acelp_core_switch_enc_fx( return; } -#ifndef CLEANUP_ACELP_ENC -void acelp_core_switch_enc_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 inp12k8[], /* i : input signal @12.8 kHz Q0 */ - const Word16 inp16k[], /* i : input signal @16 kHz Q0 */ - const Word16 A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/ - Word16 shift, - Word16 Q_new ) -{ - Word16 i, j, T_op[2]; - Word16 old_exc[L_EXC], *exc; /* excitation signal buffer Qexc */ - const Word16 *inp; - Word32 cbrate; - Word16 Aq[2 * ( M + 1 )]; - LPD_state_HANDLE hLPDmem; /* ACELP LPDmem memories */ - BSTR_ENC_HANDLE hBstr = st_fx->hBstr; - Word16 nb_bits; - UWord16 value; - - hLPDmem = st_fx->hLPDmem; - - /* initializations */ - exc = &old_exc[L_EXC_MEM]; - move16(); /* pointer to excitation signal in the current frame */ - Copy( hLPDmem->old_exc, old_exc, L_EXC_MEM ); /*now old_exc has the same scaling as st_fx->old_exc; need to change later? */ - - Copy( st_fx->old_Aq_12_8_fx, Aq, M + 1 ); /* Q12 */ - Copy( st_fx->old_Aq_12_8_fx, Aq + ( M + 1 ), M + 1 ); /* Q12 */ - T_op[0] = st_fx->pitch[0]; /* Q12 */ - move16(); - T_op[1] = st_fx->pitch[1]; /* Q12 */ - move16(); - - /*----------------------------------------------------------------* - * set switching frame bitrate - *----------------------------------------------------------------*/ - - IF( EQ_16( st_fx->last_L_frame, L_FRAME ) ) /* ACELP@12k8 core */ - { - inp = inp12k8; /* Q0 */ - - IF( GT_32( st_fx->core_brate, ACELP_24k40 ) ) - { - cbrate = L_add( ACELP_24k40, 0 ); - } - ELSE - { - cbrate = L_add( st_fx->core_brate, 0 ); - } - } - ELSE /* ACELP@16k core */ - { - inp = inp16k; /* Q0 */ - - IF( LE_32( st_fx->core_brate, ACELP_8k00 ) ) - { - cbrate = L_add( ACELP_8k00, 0 ); - } - ELSE IF( LE_32( st_fx->core_brate, ACELP_14k80 ) ) - { - cbrate = L_add( ACELP_14k80, 0 ); - } - ELSE - { - cbrate = L_min( st_fx->core_brate, ACELP_22k60 ); /* Q0 */ - } - } - - IF( NE_16( st_fx->last_L_frame, L_FRAME ) ) - { - T_op[0] = shr( add( round_fx( L_shl( L_mult( 20480 /* 1.25 in Q14 */, T_op[0] ), 2 ) ), 1 ), 1 ); /* Q0 */ - move16(); - T_op[1] = shr( add( round_fx( L_shl( L_mult( 20480 /* 1.25 in Q14 */, T_op[1] ), 2 ) ), 1 ), 1 ); /* Q0 */ - move16(); - } - - /*----------------------------------------------------------------* - * Excitation encoding - *----------------------------------------------------------------*/ - - config_acelp1_fx( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); - - encod_gen_voic_core_switch_ivas_fx( st_fx, st_fx->last_L_frame, inp, Aq, A, T_op, exc, cbrate, shift, Q_new ); - - /*----------------------------------------------------------------* - * bit-stream: modify the layer of sub frame CELP - *----------------------------------------------------------------*/ - - i = find_indice( hBstr, TAG_ACELP_SUBFR_LOOP_START, &value, &nb_bits ); /* Q0 */ - - while ( hBstr->ind_list[i].id == TAG_ACELP_SUBFR_LOOP_START ) - { - push_indice( hBstr, IND_CORE_SWITCHING_CELP_SUBFRAME, hBstr->ind_list[i].value, hBstr->ind_list[i].nb_bits ); - i++; - } - delete_indice( hBstr, TAG_ACELP_SUBFR_LOOP_START ); - - /*----------------------------------------------------------------* - * BWE encoding - *----------------------------------------------------------------*/ - - test(); - test(); - IF( !( ( EQ_16( st_fx->last_L_frame, L_FRAME16k ) && EQ_16( inner_frame_tbl[st_fx->bwidth], L_FRAME16k ) ) || EQ_16( inner_frame_tbl[st_fx->bwidth], L_FRAME8k ) ) ) - { - bwe_switch_enc_ivas_fx( st_fx, (const Word16 *) st_fx->old_input_signal_fx ); - } - - return; -} -#endif /*-------------------------------------------------------------------* * encod_gen_voic_core_switch() @@ -434,13 +317,8 @@ static void encod_gen_voic_core_switch_fx( * Innovation encoding *-----------------------------------------------------------------*/ -#ifdef CLEANUP_ACELP_ENC inov_encode_fx( st_fx, core_bitrate, 0, L_frame, st_fx->last_L_frame, GENERIC, st_fx->bwidth, 0, 0, -1, Aq, gain_pit, cn, exc, h2, hLPDmem->tilt_code, pitch, xn2, code, y2, &unbits, L_SUBFR, shift, 0 ); -#else - inov_encode_fx( st_fx, core_bitrate, 0, L_frame, st_fx->last_L_frame, GENERIC, st_fx->bwidth, 0, 0, -1, Aq, gain_pit, cn, exc, - h2, hLPDmem->tilt_code, pitch, xn2, code, y2, &unbits, L_SUBFR, shift ); -#endif /*-----------------------------------------------------------------* * Gain encoding @@ -498,219 +376,6 @@ static void encod_gen_voic_core_switch_fx( return; } -#ifndef CLEANUP_ACELP_ENC -static void encod_gen_voic_core_switch_ivas_fx( - Encoder_State *st_fx, /* i/o: state structure */ - const Word16 L_frame, /* i : length of the frame Q0*/ - const Word16 inp[], /* i : input signal Q0*/ - const Word16 Aq[], /* i : LP coefficients Q12*/ - const Word16 A[], /* i : unquantized A(z) filter Q12*/ - const Word16 T_op[], /* i : open loop pitch Q0*/ - Word16 *exc, /* i/o: current non-enhanced excitation Q_exc*/ - const Word32 core_bitrate, /* i : switching frame bitrate Q0*/ - const Word16 shift, - const Word16 Q_new ) -{ - Word16 res[L_SUBFR]; /* residual signal Qexc */ - Word16 Ap[M + 1]; /* A(z) with spectral expansion Q12 */ - Word16 xn[L_SUBFR]; /* Target vector for pitch search */ - Word16 xn2[L_SUBFR]; /* Target vector for codebook search */ - Word16 cn[L_SUBFR]; /* Target vector in residual domain */ - Word16 h1[L_SUBFR + ( M + 1 )]; /* Impulse response vector */ - - Word16 code[L_SUBFR]; /* Fixed codebook excitation Q9 */ - Word16 y1[L_SUBFR]; /* Filtered adaptive excitation */ - Word16 y2[L_SUBFR]; /* Filtered algebraic excitation */ - Word16 gain_pit; /* Pitch gain Q15 */ - Word16 voice_fac; /* Voicing factor Q15 */ - Word32 gain_code; /* Gain of code Q16 */ - Word16 gain_inov; /* inovation gain */ - Word16 i, gcode16; /* tmp variables */ - Word16 T0, T0_frac; /* close loop integer pitch and fractional part */ - Word16 T0_min, T0_max; /* pitch variables */ - - Word16 pitch, tmp16; /* floating pitch value */ - Word16 g_corr[6]; /* ACELP correl, values + gain pitch */ - Word16 clip_gain; /* ISF clip gain */ - - Word16 unbits; /* number of unused bits for PI */ - Word32 norm_gain_code; - Word16 pitch_limit_flag; - Word32 L_tmp, Lgcode; - Word16 shift_wsp; - Word16 h2[L_SUBFR + ( M + 1 )]; - Word16 dummyF[NB_SUBFR16k]; - Word16 lp_select, lp_flag; - Word16 q_h1; - LPD_state_HANDLE hLPDmem; /* ACELP LPDmem memories */ - BSTR_ENC_HANDLE hBstr; - - hLPDmem = st_fx->hLPDmem; - hBstr = st_fx->hBstr; - - // TD_CNG_ENC_HANDLE hTdCngEnc = st_fx->hTdCngEnc; - - /*------------------------------------------------------------------* - * Initializations - *------------------------------------------------------------------*/ - - shift_wsp = add( Q_new, shift ); - - unbits = 0; - move16(); - - IF( EQ_16( L_frame, L_FRAME ) ) - { - T0_max = PIT_MAX; - move16(); - T0_min = PIT_MIN; - move16(); - } - ELSE /* L_frame == L_FRAME16k */ - { - T0_max = PIT16k_MAX; - move16(); - T0_min = PIT16k_MIN; - move16(); - } - - /*------------------------------------------------------------------* - * Calculation of LP residual (filtering through A[z] filter) - *------------------------------------------------------------------*/ - - tmp16 = st_fx->L_frame; /* Q0 */ - move16(); - st_fx->L_frame = L_SUBFR; - move16(); - calc_residu_fx( st_fx, inp, res, Aq ); - - // hTdCngEnc->burst_ho_cnt = 0; - st_fx->L_frame = tmp16; /* Q0 */ - move16(); - - /*------------------------------------------------------------------* - * ACELP subframe loop - *------------------------------------------------------------------*/ - - - Copy( res, exc, L_SUBFR ); /* Q_exc */ - - IF( EQ_16( L_frame, L_FRAME16k ) ) - { - weight_a_fx( A, Ap, GAMMA16k, M ); /* Bandwidth expansion of A(z) filter coefficients */ - find_targets_ivas_fx( inp, hLPDmem->mem_syn, 0, &( hLPDmem->mem_w0 ), Aq, res, L_SUBFR, Ap, PREEMPH_FAC_16k, xn, cn, h1 ); - } - ELSE - { - weight_a_fx( A, Ap, GAMMA1, M ); /* Bandwidth expansion of A(z) filter coefficients */ - find_targets_ivas_fx( inp, hLPDmem->mem_syn, 0, &( hLPDmem->mem_w0 ), Aq, res, L_SUBFR, Ap, TILT_FAC_FX, xn, cn, h1 ); - } - - q_h1 = sub( 14, norm_s( h1[0] ) ); - Copy_Scale_sig( h1, h2, L_SUBFR, sub( 11, q_h1 ) ); /*Q11*/ - - /* scaling of xn[] to limit dynamic at 12 bits */ - Scale_sig( xn, L_SUBFR, shift ); /* Q_new */ - - /*----------------------------------------------------------------* - * Close-loop pitch search and quantization - * Adaptive exc. construction - *----------------------------------------------------------------*/ - - set16_fx( dummyF, -1, NB_SUBFR16k ); /* hack to signal ACELP->HQ switching frame */ - pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/, st_fx->element_mode, Q_new ); /* Q6 */ - - - /*-----------------------------------------------------------------* - * Find adaptive exitation - *-----------------------------------------------------------------*/ - - pred_lt4_ivas_fx( &exc[0], &exc[0], T0, T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); - - /*-----------------------------------------------------------------* - * Gain clipping test to avoid unstable synthesis on frame erasure - * or in case of floating point encoder & fixed p. decoder - *-----------------------------------------------------------------*/ - - clip_gain = gp_clip_fx( st_fx->element_mode, core_bitrate, st_fx->voicing_fx, 0, GENERIC, xn, st_fx->clip_var_fx, sub( shift_wsp, 1 ) ); /* Q0 */ - - /*-----------------------------------------------------------------* - * LP filtering of the adaptive excitation, codebook target computation - *-----------------------------------------------------------------*/ - lp_flag = st_fx->acelp_cfg.ltf_mode; /* Q0 */ - Scale_sig( h1, L_SUBFR, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14+shift*/ - lp_select = lp_filt_exc_enc_fx( MODE1, GENERIC, 0, exc, h1, xn, y1, xn2, L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ - IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) - { - push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); - } - - /*-----------------------------------------------------------------* - * Innovation encoding - *-----------------------------------------------------------------*/ - - inov_encode_ivas_fx( st_fx, core_bitrate, 0, L_frame, st_fx->last_L_frame, GENERIC, st_fx->bwidth, 0, 0, -1, Aq, gain_pit, cn, exc, - h2, hLPDmem->tilt_code, pitch, xn2, code, y2, &unbits, L_SUBFR, shift, Q_new ); - - /*-----------------------------------------------------------------* - * Gain encoding - *-----------------------------------------------------------------*/ - IF( EQ_16( L_frame, L_FRAME ) ) - { - gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, 0, -1, xn, y1, shift_wsp, y2, code, st_fx->old_Es_pred_fx, - &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain ); - } - ELSE - { - gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, 0, -1, xn, y1, shift_wsp, y2, code, st_fx->old_Es_pred_fx, - &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain ); - } - gp_clip_test_gain_pit_fx( st_fx->element_mode, core_bitrate, gain_pit, st_fx->clip_var_fx ); - - Lgcode = L_shl( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/ - gcode16 = round_fx( Lgcode ); /* Q0 */ - - // hLPDmem->tilt_code = Est_tilt2( exc + 0, gain_pit, code, gain_code, &voice_fac, shift ); - // Q_new or shift ?? ->Qexc - hLPDmem->tilt_code = est_tilt_ivas_fx( exc + 0, gain_pit, code, gain_code, &voice_fac, Q_new, L_SUBFR, 0 ); /* Q15 */ - move16(); - - /*-----------------------------------------------------------------* - * Construct adaptive part of the excitation - *-----------------------------------------------------------------*/ - - FOR( i = 0; i < L_SUBFR; i++ ) - { - /* code in Q9, gain_pit in Q14 */ - L_tmp = L_mult( gcode16, code[i] ); /* Q10 */ - L_tmp = L_shl_sat( L_tmp, 5 ); /* Q15 */ - L_tmp = L_mac_sat( L_tmp, exc[i], gain_pit ); - L_tmp = L_shl_sat( L_tmp, 1 ); /* saturation can occur here */ - exc[i] = round_fx_sat( L_tmp ); /* Q_exc */ - move16(); - } - - /* write reserved bits */ - IF( unbits ) - { - push_indice( hBstr, IND_UNUSED, 0, unbits ); - } - - /*-----------------------------------------------------------------* - * long term prediction on the 2nd sub frame - *-----------------------------------------------------------------*/ - - pred_lt4_ivas_fx( &exc[L_SUBFR], &exc[L_SUBFR], T0, T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); - - FOR( i = L_SUBFR; i < 2 * L_SUBFR; i++ ) - { - exc[i] = round_fx_sat( L_shl_sat( L_mult_sat( exc[i], gain_pit ), 1 ) ); /* Q_exc */ - move16(); - } - - return; -} -#endif /*-------------------------------------------------------------------* * bwe_switch_enc() @@ -861,147 +526,6 @@ static void bwe_switch_enc_fx( return; } -#ifndef CLEANUP_ACELP_ENC -static void bwe_switch_enc_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 *new_speech_fx /* i : original input signal Q0 */ -) -{ - - Word16 k, Loverlapp_fx, d1m_fx, maxd1_fx, ind1_fx, gapsize_fx; - Word16 delta_fx, fdelay_fx; - const Word16 *hp_filter_fx; - const Word16 *fpointers_tab[6] = { hp12800_16000_fx, hp12800_32000_fx, hp12800_48000_fx, hp16000_48000_fx, hp16000_32000_fx, hp16000_48000_fx }; - Word16 tmp, shift; - const Word16 *ptmp; - Word16 tmp_mem_fx[2 * L_FILT48k], tmp_mem2_fx[2 * L_FILT48k], hb_synth_tmp_fx[480]; - Word16 Fs_kHz; - Word16 q_tmp1, q_tmp2, Qmc, Qsq; - Word32 L_tmp1, L_tmp2, L_tmp3, min_sq_cross_fx; - Word16 accA_fx, accB_fx, min_corr_fx, E1_fx, E2_fx, gain_fx; - Word16 synth_subfr_bwe_fx[SWITCH_MAX_GAP]; /* synthesized bwe for core switching */ - Word16 n, L; - BSTR_ENC_HANDLE hBstr; - - hBstr = st_fx->hBstr; - 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 ) ); - delta_fx = add( tmp, 1 ); - Fs_kHz = shl( delta_fx, 4 ); - tmp = add( tmp, i_mult2( 3, ( sub( st_fx->last_L_frame, L_FRAME ) != 0 ) ) ); - ptmp = fpointers_tab[tmp]; - move16(); - - hp_filter_fx = ptmp; - fdelay_fx = i_mult2( 16, delta_fx ); - IF( EQ_16( st_fx->last_L_frame, L_FRAME ) ) - { - fdelay_fx = i_mult2( 20, delta_fx ); - } - - n = i_mult2( N16_CORE_SW, delta_fx ); - - set16_fx( tmp_mem_fx, 0, 2 * L_FILT48k ); - set16_fx( tmp_mem2_fx, 0, 2 * L_FILT48k ); - - Loverlapp_fx = i_mult2( delta_fx, SWITCH_OVERLAP_8k * 2 ); - gapsize_fx = i_mult2( delta_fx, NS2SA( 16000, SWITCH_GAP_LENGTH_NS ) ); - - shift = sub( add( add( shr( L, 1 ), n ), Loverlapp_fx ), gapsize_fx ); - Copy( new_speech_fx + shift, synth_subfr_bwe_fx, add( gapsize_fx, fdelay_fx ) ); - Copy( new_speech_fx + sub( shift, fdelay_fx ), tmp_mem_fx, fdelay_fx ); - - tmp = add( gapsize_fx, fdelay_fx ); - fir_fx( synth_subfr_bwe_fx, hp_filter_fx, synth_subfr_bwe_fx, tmp_mem_fx, tmp, fdelay_fx, 0, 0 ); - Copy( synth_subfr_bwe_fx + shr( fdelay_fx, 1 ), synth_subfr_bwe_fx, sub( gapsize_fx, shr( fdelay_fx, 1 ) ) ); - - tmp = i_mult2( Fs_kHz, 10 ); - fir_fx( new_speech_fx, hp_filter_fx, hb_synth_tmp_fx, tmp_mem2_fx, tmp, fdelay_fx, 1, 0 ); - - min_sq_cross_fx = L_negate( 1 ); - Qsq = 0; - move16(); - min_corr_fx = 0; - move16(); - Qmc = 0; - move16(); - d1m_fx = 0; - move16(); - - maxd1_fx = sub( tmp, add( gapsize_fx, fdelay_fx ) ); - - IF( EQ_16( delta_fx, 2 ) ) - { - maxd1_fx = shr( maxd1_fx, 1 ); - } - ELSE IF( EQ_16( delta_fx, 3 ) ) - { - maxd1_fx = extract_h( L_mult( maxd1_fx, 10923 ) ); - } - - /* find delay */ - ptmp = &hb_synth_tmp_fx[fdelay_fx]; - - FOR( k = 0; k < maxd1_fx; k++ ) - { - accA_fx = dotprod_satcont( ptmp, ptmp, 0, 0, &q_tmp1, gapsize_fx, delta_fx ); - accB_fx = dotprod_satcont( ptmp, synth_subfr_bwe_fx, 0, 0, &q_tmp2, gapsize_fx, delta_fx ); - ptmp += delta_fx; - L_tmp1 = L_mult0( accB_fx, accB_fx ); /*2*q_tmp2; */ - L_tmp2 = Mult_32_16( L_tmp1, min_corr_fx ); /*2*q_tmp2+Qmc-15 */ - L_tmp3 = Mult_32_16( min_sq_cross_fx, accA_fx ); /*Qsq+q_tmp1-15 */ - shift = s_min( add( shl( q_tmp2, 1 ), Qmc ), add( q_tmp1, Qsq ) ); - L_tmp2 = L_shr( L_tmp2, sub( add( shl( q_tmp2, 1 ), Qmc ), shift ) ); - L_tmp3 = L_shr( L_tmp3, sub( add( q_tmp1, Qsq ), shift ) ); - - IF( GE_32( L_tmp2, L_tmp3 ) ) - { - d1m_fx = k; - move16(); - min_corr_fx = accA_fx; - move16(); - Qmc = q_tmp1; - move16(); - min_sq_cross_fx = L_add( L_tmp1, 0 ); - Qsq = shl( q_tmp2, 1 ); - move16(); - } - } - - push_indice( hBstr, IND_CORE_SWITCHING_AUDIO_DELAY, d1m_fx, AUDIODELAYBITS ); - - tmp = add( i_mult2( d1m_fx, delta_fx ), fdelay_fx ); - ptmp = &hb_synth_tmp_fx[tmp]; - move16(); - E1_fx = dotprod_satcont( synth_subfr_bwe_fx, synth_subfr_bwe_fx, 0, 0, &q_tmp1, gapsize_fx, 1 ); - E2_fx = dotprod_satcont( ptmp, ptmp, 0, 0, &q_tmp2, gapsize_fx, 1 ); - - IF( !E1_fx ) - { - E1_fx = shl( 1, 14 ); - q_tmp1 = 14; - move16(); - } - IF( !E2_fx ) - { - E2_fx = shl( 1, 14 ); - q_tmp2 = 14; - move16(); - } - - tmp = div_s( shl( 1, 14 ), E1_fx ); /*Q(29-q_tmp1) */ - L_tmp1 = L_mult( tmp, E2_fx ); /*30-q_tmp1+q_tmp2 */ - q_tmp2 = sub( q_tmp1, q_tmp2 ); /*30-q_tmp2 */ - L_tmp1 = L_shl( L_tmp1, sub( q_tmp2, 24 ) ); - gain_fx = round_fx_sat( Isqrt( L_tmp1 ) ); /*Q12 */ - ind1_fx = usquant_fx( gain_fx, &gain_fx, shr( MINVALUEOFFIRSTGAIN_FX, 1 ), shr( DELTAOFFIRSTGAIN_FX, 4 ), ( 1 << NOOFGAINBITS1 ) ); - push_indice( hBstr, IND_CORE_SWITCHING_AUDIO_GAIN, ind1_fx, NOOFGAINBITS1 ); - - return; -} -#endif static Word16 dotprod_satcont( const Word16 *x, /* qx */ diff --git a/lib_enc/bw_detect_fx.c b/lib_enc/bw_detect_fx.c index 37b79491af007c7ba64d5e1b4da19d3027ece980..2e04b986ff3813d6ba305070632b388d41938a4b 100644 --- a/lib_enc/bw_detect_fx.c +++ b/lib_enc/bw_detect_fx.c @@ -18,9 +18,7 @@ *-------------------------------------------------------------------*/ #define BWD_MIN_BRATE_WIDER_BW_MDCT IVAS_48k -#ifdef FIX_1381_BWD #define BWD_MIN_BRATE_WIDER_BW_MASA IVAS_48k -#endif #define BWD_MIN_BRATE_WIDER_BW_ISM IVAS_32k #define BWD_MAX_BRATE_WIDER_BW_MDCT IVAS_80k #define BWD_MAX_BRATE_WIDER_BW_ISM IVAS_64k @@ -77,17 +75,11 @@ void bw_detect_fx( test(); test(); test(); -#ifdef FIX_1381_BWD test(); test(); -#endif if ( st->ini_frame > 0 && ( ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && ( GE_32( st->element_brate, BWD_MIN_BRATE_WIDER_BW_MDCT ) || mct_on ) ) || -#ifdef FIX_1381_BWD ( st->is_ism_format && GE_32( st->element_brate, BWD_MIN_BRATE_WIDER_BW_ISM ) ) || ( EQ_16( ivas_format, MASA_FORMAT ) && GE_32( st->element_brate, BWD_MIN_BRATE_WIDER_BW_MASA ) ) ) ) -#else - ( EQ_16( ivas_format, ISM_FORMAT ) && GE_32( st->element_brate, BWD_MIN_BRATE_WIDER_BW_ISM ) ) ) ) -#endif { bwd_count_wider_bw = BWD_COUNT_WIDER_BW_MDCT; move16(); diff --git a/lib_enc/cod_ace_fx.c b/lib_enc/cod_ace_fx.c index 0fbd01b3a2adb547dba3bd1a83e592bb85e80680..f4b74b351d9928d059ea9a61eb36108a7fe691fc 100644 --- a/lib_enc/cod_ace_fx.c +++ b/lib_enc/cod_ace_fx.c @@ -262,11 +262,7 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision * IF( st->igf != 0 ) { -#ifdef CLEANUP_ACELP_ENC tbe_celp_exc_fx( EVS_MONO, 0, L_frame, L_SUBFR, i_subfr, T0, T0_frac, &error, bwe_exc, 0 ); -#else - tbe_celp_exc( L_frame, i_subfr, T0, T0_frac, &error, bwe_exc ); -#endif } pitch_buf[i_subfr / L_SUBFR] = shl( add( shl( T0, 2 ), T0_frac ), 4 ); diff --git a/lib_enc/core_switching_enc_fx.c b/lib_enc/core_switching_enc_fx.c index 2d44ba36a7c493ad8f8df788c50bb5a5991bf56f..cc850da46bd775f3f06c61626a778f6754ac3f93 100644 --- a/lib_enc/core_switching_enc_fx.c +++ b/lib_enc/core_switching_enc_fx.c @@ -1052,40 +1052,13 @@ void core_switching_pre_enc_ivas_fx( *---------------------------------------------------------------------*/ void core_switching_post_enc_ivas_fx( -#ifdef CLEANUP_ACELP_ENC Encoder_State *st /* i/o: encoder state structure */ -#else - Encoder_State *st, /* i/o: encoder state structure */ - Word16 *old_inp_12k8_fx, /* i : old input signal @12.8kHz Q_new-1 */ - Word16 *old_inp_16k_fx, /* i : old input signal @16kHz Q_new-1 */ - Word16 A_fx[], /* i : unquant. LP filter coefs. Q12 */ - Word16 Q_new -#endif ) { IF( EQ_16( st->core, HQ_CORE ) ) { st->use_acelp_preq = 0; move16(); -#ifndef CLEANUP_ACELP_ENC - test(); - test(); - IF( ( st->last_core == ACELP_CORE || EQ_16( st->last_core, AMR_WB_CORE ) ) && st->element_mode == EVS_MONO ) /* core switching ==> ACELP subframe encoding */ - { - /* Memory scaling to keep everything in common q */ - Scale_sig( st->hLPDmem->mem_syn, M, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); /* Q_new-1 */ - Scale_sig( st->hLPDmem->mem_syn1_fx, M, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); /* Q_new-1 */ - Scale_sig( st->hLPDmem->mem_syn2, M, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); /* Q_new-1 */ - Scale_sig( st->hLPDmem->mem_syn3, M, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); /* Q_new-1 */ - Scale_sig( st->hLPDmem->mem_syn_r, L_SYN_MEM, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); /* Q_new-1 */ - st->hLPDmem->mem_w0 = shl( st->hLPDmem->mem_w0, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); /* Q_new-1 */ - move16(); - st->hLPDmem->q_mem_syn = sub( Q_new, 1 ); - move16(); - - acelp_core_switch_enc_ivas_fx( st, old_inp_12k8_fx + L_INP_MEM - NS2SA( INT_FS_12k8, ACELP_LOOK_NS ), old_inp_16k_fx + L_INP_MEM - NS2SA( INT_FS_16k, ACELP_LOOK_NS ), A_fx, 0, sub( Q_new, 1 ) ); - } -#endif st->hBWE_TD->bwe_non_lin_prev_scale_fx = 0; move32(); diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index 626d89aaaf8a6a38f47b93f54608e1626a4782fa..0f4e772534fcb5eb5a9ff452ca4899210a21de8e 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -997,14 +997,10 @@ void E_ACELP_corrmatrix_fx( p3 = &rrixiy[2][pos]; /* Q9 */ p2 = &rrixiy[1][pos]; p1 = &rrixiy[0][pos]; -#ifdef FIX_2274_OOB_INDEXING_IN_CORRMATRIX p0 = &rrixiy[3][pos]; /* decrement pointer instead of indexing the array to avoid CLANG Usan complaint */ /* for last loop iteration, this points to rrixiy[3][-1], but is not actually accessed in later loop (k = 15 then, so inner loop will not run) */ p0 -= 16; -#else - p0 = &rrixiy[3][pos - 16]; -#endif cor = L_deposit_h( 0 ); ptr_h1 = h; /*Q12*/ diff --git a/lib_enc/enc_acelpx_fx.c b/lib_enc/enc_acelpx_fx.c index 089c3bbb4d23fb9d4e536d691a0d413b66eeb589..a5b11f3b06ca27d9da208a793c7c7d8a54d0d14c 100644 --- a/lib_enc/enc_acelpx_fx.c +++ b/lib_enc/enc_acelpx_fx.c @@ -292,12 +292,8 @@ static void E_ACELP_1pulse_searchx_fx( /*alp0 = *alp + R[0]; INDIRECT(1);*/ ps0 = *ps; /* Qdn */ move16(); - alp0 = L_deposit_h( *alp ); /* Q22 */ -#ifndef FIX_2248_EVS_ASSERT - alp0 = L_mac( alp0, R[0], sign_val_1 ); /* Qalp = (Q_R=Q_cor)*Q_signval */ -#else + alp0 = L_deposit_h( *alp ); /* Q22 */ alp0 = L_mac_sat( alp0, R[0], sign_val_1 ); /* Qalp = (Q_R=Q_cor)*Q_signval */ -#endif /* Ensure that in the loop below s > 0 in the first iteration, the actual values do not matter. */ move16(); move16(); diff --git a/lib_enc/enc_amr_wb_fx.c b/lib_enc/enc_amr_wb_fx.c index 022483f829ba12bba2bacca633691672f278e71f..e31578c7a3993e639d5bbcce12002687d1f863d4 100644 --- a/lib_enc/enc_amr_wb_fx.c +++ b/lib_enc/enc_amr_wb_fx.c @@ -174,13 +174,8 @@ void encod_amr_wb_fx( * Innovation encoding *-----------------------------------------------------------------*/ -#ifdef CLEANUP_ACELP_ENC inov_encode_fx( st, st->core_brate, 1, L_FRAME, st->last_L_frame, -1, -1, 0, i_subfr, -1, p_Aq, gain_pit, cn, exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits, L_SUBFR, shift, 0 ); -#else - inov_encode_fx( st, st->core_brate, 1, L_FRAME, st->last_L_frame, -1, -1, 0, i_subfr, -1, p_Aq, gain_pit, cn, - exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits, L_SUBFR, shift ); -#endif /*-----------------------------------------------------------------* * Gain encoding diff --git a/lib_enc/enc_gain_fx.c b/lib_enc/enc_gain_fx.c index ed954ebed99ce40613d77f855d096c6a1833fbeb..2e1a5019b0358a1056cd07e600984cb0596e86a2 100644 --- a/lib_enc/enc_gain_fx.c +++ b/lib_enc/enc_gain_fx.c @@ -254,11 +254,7 @@ Word16 E_GAIN_closed_loop_search_fx( Word16 exc[], /*Q_new*/ { Word16 corr_v[32 + 2 * L_INTERPOL1 + 1]; Word16 cor_max, max, temp; -#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH Word16 corr_idx; -#else - Word16 *corr; -#endif Word16 i, fraction, frac1, frac2, step; Word16 t0, t_min, t_max; @@ -274,48 +270,29 @@ Word16 E_GAIN_closed_loop_search_fx( Word16 exc[], /*Q_new*/ move16(); move16(); -#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH corr_idx = negate( t_min ); -#else - /* allocate memory to normalized correlation vector */ - corr = &corr_v[negate( t_min )]; /* corr[t_min..t_max] */ -#endif /* Compute normalized correlation between target and filtered excitation */ E_GAIN_norm_corr_fx( exc, xn, h, t_min, t_max, corr_v, L_subfr ); /* find integer pitch */ -#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH max = corr_v[add( t0_min, corr_idx )]; /*(Q15+(Q_new+shift-1)+scale)*/ -#else - max = corr[t0_min]; /*(Q15+(Q_new+shift-1)+scale)*/ -#endif move16(); t0 = t0_min; /*Q0*/ move16(); FOR( i = t0_min + 1; i <= t0_max; i++ ) { -#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH Word16 corr_tmp; corr_tmp = corr_v[add( corr_idx, i )]; -#endif BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH if ( GE_16( corr_tmp, max ) ) -#else - if ( GE_16( corr[i], max ) ) -#endif { t0 = i; move16(); } -#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH max = s_max( max, corr_tmp ); -#else - max = s_max( max, corr[i] ); -#endif BASOP_SATURATE_WARNING_ON_EVS; } @@ -380,26 +357,16 @@ Word16 E_GAIN_closed_loop_search_fx( Word16 exc[], /*Q_new*/ } assert( frac1 <= 0 && frac2 >= 0 && frac2 > frac1 ); -#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH corr_idx = add( corr_idx, t0 ); -#endif IF( EQ_16( pit_res_max, 6 ) ) { -#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH cor_max = E_GAIN_norm_corr_interpolate6_fx( &corr_v[corr_idx], frac1 ); /*(Q15+(Q_new+shift-1)+scale)*/ -#else - cor_max = E_GAIN_norm_corr_interpolate6_fx( &corr[t0], frac1 ); /*(Q15+(Q_new+shift-1)+scale)*/ -#endif - fraction = frac1; /*Q0*/ + fraction = frac1; /*Q0*/ move16(); FOR( i = ( frac1 + step ); i <= frac2; i += step ) { -#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH temp = E_GAIN_norm_corr_interpolate6_fx( &corr_v[corr_idx], i ); /*(Q15+(Q_new+shift-1)+scale)*/ -#else - temp = E_GAIN_norm_corr_interpolate6_fx( &corr[t0], i ); /*(Q15+(Q_new+shift-1)+scale)*/ -#endif IF( GT_16( temp, cor_max ) ) { cor_max = temp; /*(Q15+(Q_new+shift-1)+scale)*/ @@ -411,21 +378,13 @@ Word16 E_GAIN_closed_loop_search_fx( Word16 exc[], /*Q_new*/ } ELSE { -#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH cor_max = E_GAIN_norm_corr_interpolate_fx( &corr_v[corr_idx], frac1 ); /*(Q15+(Q_new+shift-1)+scale)*/ -#else - cor_max = E_GAIN_norm_corr_interpolate_fx( &corr[t0], frac1 ); /*(Q15+(Q_new+shift-1)+scale)*/ -#endif - fraction = frac1; /*Q0*/ + fraction = frac1; /*Q0*/ move16(); FOR( i = ( frac1 + step ); i <= frac2; i += step ) { -#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH temp = E_GAIN_norm_corr_interpolate_fx( &corr_v[corr_idx], i ); /*(Q15+(Q_new+shift-1)+scale)*/ -#else - temp = E_GAIN_norm_corr_interpolate_fx( &corr[t0], i ); /*(Q15+(Q_new+shift-1)+scale)*/ -#endif IF( GT_16( temp, cor_max ) ) { cor_max = temp; /*(Q15+(Q_new+shift-1)+scale)*/ diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index a68d5be4eff6ee6643d035d64b3e31a77b667291..5e0a67dbcfd85a986373aacc1a65ffe3464238c3 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -77,371 +77,8 @@ static void rem_offset( /* RETURN ARGUMENTS : */ /* _ None */ /*======================================================================*/ -#ifndef CLEANUP_ACELP_ENC -void encod_gen_voic_fx( - Encoder_State *st_fx, /* i/o: state structure */ - const Word16 speech_fx[], /* i : input speech Q0*/ - const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes Q12*/ - const Word16 Aq_fx[], /* i : 12k8 Lp coefficient Q12*/ - const Word16 Es_pred_fx, /* i : predicted scaled innov. energy Q8*/ - const Word16 *res_fx, /* i : residual signal Q_new*/ - Word16 *syn_fx, /* i/o: core synthesis Q_new*/ - Word16 *exc_fx, /* i/o: current non-enhanced excitation Q0*/ - Word16 *exc2_fx, /* i/o: current enhanced excitation Q0*/ - Word16 *pitch_buf_fx, /* i/o: floating pitch values for each subframe Q6*/ - Word16 *voice_factors_fx, /* o : voicing factors Q15*/ - Word16 *bwe_exc_fx, /* o : excitation for SWB TBE Q0*/ - Word16 *unbits_fx, /* i/o: number of unused bits Q0*/ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag Q0*/ - const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer Q6*/ - Word16 shift, - Word16 Q_new ) -{ - Word16 xn_fx[L_SUBFR]; /* Target vector for pitch search */ - Word16 xn2_fx[L_SUBFR]; /* Target vector for codebook search */ - Word16 cn_fx[L_SUBFR]; /* Target vector in residual domain */ - Word16 h1_fx[L_SUBFR + ( M + 1 )]; /* Impulse response vector */ - Word16 h2_fx[L_SUBFR + ( M + 1 )]; /* Impulse response vector */ - Word16 code_fx[L_SUBFR]; /* Fixed codebook excitation */ - Word16 y1_fx[L_SUBFR] = { 0 }; /* Filtered adaptive excitation */ - Word16 y2_fx[L_SUBFR]; /* Filtered algebraic excitation */ - Word16 gain_pit_fx = 0; /* Pitch gain */ - move16(); - Word16 voice_fac_fx; /* Voicing factor */ - Word32 gain_code_fx = 0; /* Gain of code */ - move32(); - Word16 gain_inov_fx = 0; /* inovation gain */ - move16(); - Word32 gc_mem[NB_SUBFR - 1]; /* gain_code from previous subframes */ - Word16 gp_mem[NB_SUBFR - 1]; /* gain_pitch from previous subframes*/ - Word16 i, i_subfr_fx; /* tmp variables */ - Word16 T0_fx = 0, T0_frac_fx = 0; /* close loop integer pitch and fractional part */ - move16(); - move16(); - Word16 T0_min_fx, T0_max_fx; /* pitch variables */ - Word16 *pt_pitch_fx; /* pointer to floating pitch buffer */ - Word16 g_corr_fx[10]; /* ACELP correl, values + gain pitch */ - Word16 clip_gain_fx; /* LSF clip gain */ - const Word16 *p_Aw_fx, *p_Aq_fx; /* pointer to LP filter coeff. vector*/ - Word16 error_fx = 0; - Word16 gain_preQ_fx = 0; /* Gain of prequantizer excitation */ - move16(); - move16(); - Word16 code_preQ_fx[L_SUBFR]; /* Prequantizer excitation */ - Word16 unbits_PI_fx = 0; /* number of unused bits for PI */ - Word32 norm_gain_code_fx = 0; - move16(); - move32(); - Word16 pitch_limit_flag; - Word16 gcode16; - Word32 Ltmp; - Word32 Ltmp1; - Word32 Lgcode; - Word16 tmp1_fx; - Word16 shift_wsp; - Word16 harm_flag_acelp; - Word16 lp_select, lp_flag, L_frame; - SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; - BSTR_ENC_HANDLE hBstr = st_fx->hBstr; - SP_MUS_CLAS_HANDLE hSpMusClas = st_fx->hSpMusClas; - LPD_state_HANDLE hLPDmem = st_fx->hLPDmem; - - /*------------------------------------------------------------------* - * Initializations - *------------------------------------------------------------------*/ - - gain_pit_fx = 0; - move16(); - gain_code_fx = L_deposit_l( 0 ); - gain_preQ_fx = 0; - move16(); - unbits_PI_fx = 0; - move16(); - error_fx = 0; - move16(); - L_frame = st_fx->L_frame; - move16(); - - - IF( EQ_16( L_frame, L_FRAME ) ) - { - T0_max_fx = PIT_MAX; - move16(); - T0_min_fx = PIT_MIN; - move16(); - } - ELSE /* L_frame == L_FRAME16k */ - { - T0_max_fx = PIT16k_MAX; - move16(); - T0_min_fx = PIT16k_MIN; - move16(); - } - lp_flag = st_fx->acelp_cfg.ltf_mode; - move16(); - - *unbits_fx = 0; - move16(); - - p_Aw_fx = Aw_fx; /* Q12 */ - p_Aq_fx = Aq_fx; /* Q12 */ - pt_pitch_fx = pitch_buf_fx; /* Q6 */ - gain_preQ_fx = 0; - move16(); - set16_fx( code_preQ_fx, 0, L_SUBFR ); - - shift_wsp = add( Q_new, shift ); - - /* set and write harmonicity flag */ - harm_flag_acelp = 0; - move16(); - - test(); - test(); - IF( GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && LE_32( st_fx->core_brate, MAX_BRATE_AVQ_EXC_TD ) && EQ_16( st_fx->coder_type, GENERIC ) ) - { - if ( GT_16( st_fx->last_harm_flag_acelp, 2 ) ) - { - harm_flag_acelp = 1; - move16(); - } - - push_indice( hBstr, IND_HARM_FLAG_ACELP, harm_flag_acelp, 1 ); - } - - /*------------------------------------------------------------------* - * ACELP subframe loop - *------------------------------------------------------------------*/ - - FOR( i_subfr_fx = 0; i_subfr_fx < L_frame; i_subfr_fx += L_SUBFR ) - { - - /*----------------------------------------------------------------* - * Find the the excitation search target "xn" and innovation - * target in residual domain "cn" - * Compute impulse response, h1[], of weighted synthesis filter - *----------------------------------------------------------------*/ - - Copy( &res_fx[i_subfr_fx], &exc_fx[i_subfr_fx], L_SUBFR ); /*Q_new*/ - - find_targets_fx( speech_fx, hLPDmem->mem_syn, i_subfr_fx, &hLPDmem->mem_w0, p_Aq_fx, - res_fx, L_SUBFR, p_Aw_fx, st_fx->preemph_fac, xn_fx, cn_fx, h1_fx ); - - Copy_Scale_sig( h1_fx, h2_fx, L_SUBFR, -2 ); /*Q11*/ - Scale_sig( h1_fx, L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution Q(14+shift)*/ - - /* scaling of xn[] to limit dynamic at 12 bits */ - Scale_sig( xn_fx, L_SUBFR, shift ); - - /*----------------------------------------------------------------* - * Close-loop pitch search and quantization - *----------------------------------------------------------------*/ - - *pt_pitch_fx = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx, - L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st_fx->element_mode, Q_new ); /* Q6 */ - - tbe_celp_exc( L_frame, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx ); - - /*-----------------------------------------------------------------* - * Find adaptive exitation - *-----------------------------------------------------------------*/ - - pred_lt4( &exc_fx[i_subfr_fx], &exc_fx[i_subfr_fx], T0_fx, T0_frac_fx, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); - - /*-----------------------------------------------------------------* - * Gain clipping test to avoid unstable synthesis on frame erasure - *-----------------------------------------------------------------*/ - - clip_gain_fx = gp_clip_fx( st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx, i_subfr_fx, st_fx->coder_type, xn_fx, st_fx->clip_var_fx, sub( shift_wsp, 1 ) ); - - if ( EQ_16( st_fx->coder_type, INACTIVE ) ) - { - /* in case of AVQ inactive, limit the gain to 0.65 */ - clip_gain_fx = 2; - move16(); - } - - /*-----------------------------------------------------------------* - * LP filtering of the adaptive excitation, codebook target computation - *-----------------------------------------------------------------*/ - - lp_select = lp_filt_exc_enc_fx( MODE1, st_fx->coder_type, i_subfr_fx, exc_fx, h1_fx, - xn_fx, y1_fx, xn2_fx, L_SUBFR, L_frame, g_corr_fx, clip_gain_fx, &gain_pit_fx, &lp_flag ); - - IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) - { - push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); - } - - /*st_fx->lowrate_pitchGain = 0.9f * st_fx->lowrate_pitchGain + 0.1f * gain_pit_fx;*/ - hSpMusClas->lowrate_pitchGain = round_fx_sat( L_mac_sat( L_mult( 29491, hSpMusClas->lowrate_pitchGain ), 6554, gain_pit_fx ) ); /*Q14*Q16(0.1) + Q15 -> Q15*/ - - /*-----------------------------------------------------------------* - * Transform domain contribution encoding - active frames - *-----------------------------------------------------------------*/ - - test(); - IF( GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && NE_16( st_fx->coder_type, INACTIVE ) ) - { - transf_cdbk_enc_fx( st_fx, harm_flag_acelp, i_subfr_fx, cn_fx, exc_fx, p_Aq_fx, p_Aw_fx, h1_fx, xn_fx, - xn2_fx, y1_fx, y2_fx, Es_pred_fx, &gain_pit_fx, gain_code_fx, g_corr_fx, clip_gain_fx, &gain_preQ_fx, code_preQ_fx, unbits_fx, Q_new, shift ); - } - - /*-----------------------------------------------------------------* - * Innovation encoding - *-----------------------------------------------------------------*/ - - inov_encode_fx( st_fx, st_fx->core_brate, 0, L_frame, st_fx->last_L_frame, - st_fx->coder_type, st_fx->bwidth, st_fx->sharpFlag, i_subfr_fx, -1, p_Aq_fx, - gain_pit_fx, cn_fx, exc_fx, h2_fx, hLPDmem->tilt_code, *pt_pitch_fx, xn2_fx, code_fx, y2_fx, &unbits_PI_fx, L_SUBFR, shift ); - - /*-----------------------------------------------------------------* - * Gain encoding - *-----------------------------------------------------------------*/ - - IF( LE_32( st_fx->core_brate, ACELP_8k00 ) ) - { - gain_enc_lbr_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->coder_type, i_subfr_fx, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx, - &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, gc_mem, gp_mem, clip_gain_fx, L_SUBFR, - st_fx->element_mode ); - } - ELSE IF( GT_32( st_fx->core_brate, ACELP_32k ) ) - { - gain_enc_SQ_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr_fx, xn_fx, y1_fx, y2_fx, code_fx, Es_pred_fx, - &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx, shift_wsp ); - } - ELSE - { - gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, i_subfr_fx, -1, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx, Es_pred_fx, - &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx ); - } - IF( st_fx->Opt_SC_VBR ) - { - if ( EQ_16( hSC_VBR->last_ppp_mode, 1 ) ) - { - /* SC-VBR - all other st->clip_var values will be updated even in a PPP frame */ - st_fx->clip_var_fx[1] = gain_pit_fx; /*Q14*/ - move16(); - } - } - gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit_fx, st_fx->clip_var_fx ); - - Lgcode = L_shl_sat( gain_code_fx, Q_new ); /* scaled gain_code with Qnew -> Q16*/ - gcode16 = round_fx_sat( Lgcode ); /*Q0*/ - hLPDmem->tilt_code = Est_tilt2( &exc_fx[i_subfr_fx], gain_pit_fx, code_fx, Lgcode, &voice_fac_fx, shift ); /* Q15 */ - move16(); - - /*-----------------------------------------------------------------* - * Transform domain contribution encoding - inactive frames - *-----------------------------------------------------------------*/ - - test(); - IF( GE_32( st_fx->core_brate, MAX_GSC_INACTIVE_BRATE ) && EQ_16( st_fx->coder_type, INACTIVE ) ) - { - transf_cdbk_enc_fx( st_fx, 0, i_subfr_fx, cn_fx, exc_fx, p_Aq_fx, p_Aw_fx, h1_fx, xn_fx, xn2_fx, y1_fx, y2_fx, - Es_pred_fx, &gain_pit_fx, gain_code_fx, g_corr_fx, clip_gain_fx, &gain_preQ_fx, code_preQ_fx, unbits_fx, Q_new, shift ); - } - - /*-----------------------------------------------------------------* - * Update memory of the weighting filter - *-----------------------------------------------------------------*/ - - /* st_fx->mem_w0 = xn[L_SUBFR-1] - (gain_pit*y1[L_SUBFR-1]) - (gain_code*y2[L_SUBFR-1]); */ - Ltmp = L_mult( gcode16, y2_fx[L_SUBFR - 1] ); /*Q10*/ - Ltmp = L_shl( Ltmp, add( 5, shift ) ); /*Q15+shift*/ - Ltmp = L_negate( Ltmp ); - Ltmp = L_mac( Ltmp, xn_fx[L_SUBFR - 1], 16384 /*Q14*/ ); /* Q_new-1+shift+14+1 */ - Ltmp = L_msu( Ltmp, y1_fx[L_SUBFR - 1], gain_pit_fx /*Q14*/ ); /* Q_new-1+shift+14+1 */ - Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); /* 15 + Q_new */ - hLPDmem->mem_w0 = round_fx_sat( Ltmp ); /*Q_new-1 */ - move16(); - IF( gain_preQ_fx != 0 ) - { - tmp1_fx = add( 16 - ( 2 + Q_AVQ_OUT_DEC + 1 ), Q_new ); - - FOR( i = 0; i < L_SUBFR; i++ ) - { - /* Contribution from AVQ layer */ - Ltmp1 = L_mult_sat( gain_preQ_fx, code_preQ_fx[i] ); /* Q2 + Q6 -> Q9*/ - Ltmp1 = L_shl_sat( Ltmp1, tmp1_fx ); /* Q16 + Q_exc */ - - /* Compute exc2 */ - Ltmp = L_shl_sat( L_mult( gain_pit_fx, exc_fx[i + i_subfr_fx] ), 1 ); /* Q16 */ - exc2_fx[i + i_subfr_fx] = round_fx_sat( L_add_sat( Ltmp, Ltmp1 ) ); /* Q0 */ - move16(); - - /* code in Q9, gain_pit in Q14 */ - Ltmp = L_mult( gcode16, code_fx[i] ); /* Q10 */ - Ltmp = L_shl( Ltmp, 5 ); /* Q15 */ - Ltmp = L_mac( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx ); /* Q15 */ - Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here Q16*/ - exc_fx[i + i_subfr_fx] = round_fx_sat( L_add_sat( Ltmp, Ltmp1 ) ); /* Q0 */ - } - } - ELSE - { - /*-----------------------------------------------------------------* - * Construct adaptive part of the excitation - * Save the non-enhanced excitation for FEC_exc - *-----------------------------------------------------------------*/ - - FOR( i = 0; i < L_SUBFR; i++ ) - { - /* code in Q9, gain_pit in Q14 */ - Ltmp = L_mult( gcode16, code_fx[i] ); /* Q10 */ - Ltmp = L_shl_sat( Ltmp, 5 ); /* Q15 */ - Ltmp = L_mac_sat( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx ); /* Q15 */ - Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here Q16*/ - exc_fx[i + i_subfr_fx] = round_fx_sat( Ltmp ); /* Q0 */ - } - } - /*-----------------------------------------------------------------* - * Prepare TBE excitation - *-----------------------------------------------------------------*/ - - prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr_fx, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx, - &voice_factors_fx[i_subfr_fx / L_SUBFR], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, Q10, Q_new, - T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate, - st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag ); - - /*-----------------------------------------------------------------* - * Synthesize speech to update mem_syn[]. - * Update A(z) filters - *-----------------------------------------------------------------*/ - - Syn_filt_s( 1, p_Aq_fx, M, &exc_fx[i_subfr_fx], &syn_fx[i_subfr_fx], L_SUBFR, hLPDmem->mem_syn, 1 ); - - p_Aw_fx += ( M + 1 ); - p_Aq_fx += ( M + 1 ); - pt_pitch_fx++; - } - - /* write reserved bits */ - WHILE( unbits_PI_fx > 0 ) - { - i = s_min( unbits_PI_fx, 16 ); - push_indice( hBstr, IND_UNUSED, 0, i ); - unbits_PI_fx -= i; - } - IF( st_fx->Opt_SC_VBR ) - { - /* SC-VBR */ - hSC_VBR->prev_ppp_gain_pit_fx = gain_pit_fx; /* Q14 */ - move16(); - hSC_VBR->prev_tilt_code_fx = hLPDmem->tilt_code; /* Q15 */ - move16(); - } - - return; -} -#endif - -#ifdef CLEANUP_ACELP_ENC void encod_gen_voic_fx( -#else -void encod_gen_voic_ivas_fx( -#endif Encoder_State *st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : input speech Q0 / Qnew -1 */ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes Q12*/ @@ -554,12 +191,8 @@ void encod_gen_voic_ivas_fx( set16_fx( code_preQ_fx, 0, L_SUBFR ); shift_wsp = add( Q_new, shift ); -#ifdef CLEANUP_ACELP_ENC test(); if ( LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && NE_32( st_fx->element_mode, EVS_MONO ) ) -#else - if ( LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) ) -#endif { shift_wsp = sub( shift_wsp, 1 ); } @@ -596,7 +229,6 @@ void encod_gen_voic_ivas_fx( Copy( &res_fx[i_subfr_fx], &exc_fx[i_subfr_fx], L_SUBFR ); /*Q_new*/ -#ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { find_targets_fx( speech_fx, hLPDmem->mem_syn, i_subfr_fx, &hLPDmem->mem_w0, p_Aq_fx, @@ -609,7 +241,6 @@ void encod_gen_voic_ivas_fx( Scale_sig( xn_fx, L_SUBFR, shift ); } ELSE -#endif { find_targets_ivas_fx( speech_fx, hLPDmem->mem_syn, i_subfr_fx, &hLPDmem->mem_w0, p_Aq_fx, res_fx, L_SUBFR, p_Aw_fx, st_fx->preemph_fac, xn_fx, cn_fx, h1_fx ); @@ -639,23 +270,17 @@ void encod_gen_voic_ivas_fx( L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st_fx->element_mode, Q_new ); /* Q6 */ move16(); -#ifdef CLEANUP_ACELP_ENC tbe_celp_exc_fx( st_fx->element_mode, st_fx->idchan, L_frame, L_SUBFR, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx, st_fx->tdm_LRTD_flag ); -#else - tbe_celp_exc_ivas( st_fx->element_mode, st_fx->idchan, L_frame, L_SUBFR, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx, st_fx->tdm_LRTD_flag ); -#endif /*-----------------------------------------------------------------* * Find adaptive exitation *-----------------------------------------------------------------*/ -#ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { pred_lt4( &exc_fx[i_subfr_fx], &exc_fx[i_subfr_fx], T0_fx, T0_frac_fx, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); } ELSE -#endif { pred_lt4_ivas_fx( &exc_fx[i_subfr_fx], &exc_fx[i_subfr_fx], T0_fx, T0_frac_fx, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); } @@ -685,7 +310,6 @@ void encod_gen_voic_ivas_fx( push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); } -#ifdef CLEANUP_ACELP_ENC #ifndef FIX_2306_MISSING_UPDATE_LOWRATE_PITCH_GAIN IF( st_fx->element_mode == EVS_MONO ) { @@ -694,7 +318,6 @@ void encod_gen_voic_ivas_fx( st_fx->hSpMusClas->lowrate_pitchGain = round_fx_sat( L_mac_sat( L_mult( 29491, st_fx->hSpMusClas->lowrate_pitchGain ), 6554, gain_pit_fx ) ); /*Q14*Q16(0.1) + Q15 -> Q15*/ #ifndef FIX_2306_MISSING_UPDATE_LOWRATE_PITCH_GAIN } -#endif #endif /*-----------------------------------------------------------------* @@ -704,27 +327,16 @@ void encod_gen_voic_ivas_fx( test(); IF( GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && NE_16( st_fx->coder_type, INACTIVE ) ) { -#ifdef CLEANUP_ACELP_ENC transf_cdbk_enc_fx( st_fx, harm_flag_acelp, i_subfr_fx, cn_fx, exc_fx, p_Aq_fx, p_Aw_fx, h1_fx, xn_fx, xn2_fx, y1_fx, y2_fx, Es_pred_fx, &gain_pit_fx, gain_code_fx, g_corr_fx, clip_gain_fx, &gain_preQ_fx, code_preQ_fx, unbits_fx, Q_new, shift ); -#else - transf_cdbk_enc_ivas_fx( st_fx, harm_flag_acelp, i_subfr_fx, cn_fx, exc_fx, p_Aq_fx, p_Aw_fx, h1_fx, xn_fx, - xn2_fx, y1_fx, y2_fx, Es_pred_fx, &gain_pit_fx, gain_code_fx, g_corr_fx, clip_gain_fx, &gain_preQ_fx, code_preQ_fx, unbits_fx, Q_new, shift ); -#endif } /*-----------------------------------------------------------------* * Innovation encoding *-----------------------------------------------------------------*/ -#ifdef CLEANUP_ACELP_ENC inov_encode_fx( st_fx, st_fx->core_brate, 0, L_frame, st_fx->last_L_frame, st_fx->coder_type, st_fx->bwidth, st_fx->sharpFlag, i_subfr_fx, -1, p_Aq_fx, gain_pit_fx, cn_fx, exc_fx, h2_fx, hLPDmem->tilt_code, *pt_pitch_fx, xn2_fx, code_fx, y2_fx, &unbits_PI_fx, L_SUBFR, shift, Q_new ); -#else - inov_encode_ivas_fx( st_fx, st_fx->core_brate, 0, L_frame, st_fx->last_L_frame, - st_fx->coder_type, st_fx->bwidth, st_fx->sharpFlag, i_subfr_fx, -1, p_Aq_fx, - gain_pit_fx, cn_fx, exc_fx, h2_fx, hLPDmem->tilt_code, *pt_pitch_fx, xn2_fx, code_fx, y2_fx, &unbits_PI_fx, L_SUBFR, shift, Q_new ); -#endif /*-----------------------------------------------------------------* * Gain encoding @@ -760,7 +372,6 @@ void encod_gen_voic_ivas_fx( Lgcode = L_shl_sat( gain_code_fx, Q_new ); /* scaled gain_code with Qnew -> Q16*/ gcode16 = round_fx_sat( Lgcode ); -#ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { hLPDmem->tilt_code = Est_tilt2( &exc_fx[i_subfr_fx], gain_pit_fx, code_fx, Lgcode, &voice_fac_fx, shift ); /* Q15 */ @@ -769,9 +380,6 @@ void encod_gen_voic_ivas_fx( { hLPDmem->tilt_code = est_tilt_fx( &exc_fx[i_subfr_fx], gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, Q_new, L_SUBFR ); /* Q15 */ } -#else - hLPDmem->tilt_code = est_tilt_ivas_fx( &exc_fx[i_subfr_fx], gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, Q_new, L_SUBFR, 0 ); /* Q15 */ -#endif move16(); /*-----------------------------------------------------------------* @@ -781,20 +389,14 @@ void encod_gen_voic_ivas_fx( test(); IF( !st_fx->inactive_coder_type_flag && EQ_16( st_fx->coder_type, INACTIVE ) ) { -#ifdef CLEANUP_ACELP_ENC transf_cdbk_enc_fx( st_fx, 0, i_subfr_fx, cn_fx, exc_fx, p_Aq_fx, p_Aw_fx, h1_fx, xn_fx, xn2_fx, y1_fx, y2_fx, Es_pred_fx, &gain_pit_fx, gain_code_fx, g_corr_fx, clip_gain_fx, &gain_preQ_fx, code_preQ_fx, unbits_fx, Q_new, shift ); -#else - transf_cdbk_enc_ivas_fx( st_fx, 0, i_subfr_fx, cn_fx, exc_fx, p_Aq_fx, p_Aw_fx, h1_fx, xn_fx, xn2_fx, y1_fx, y2_fx, - Es_pred_fx, &gain_pit_fx, gain_code_fx, g_corr_fx, clip_gain_fx, &gain_preQ_fx, code_preQ_fx, unbits_fx, Q_new, shift ); -#endif } /*-----------------------------------------------------------------* * Update memory of the weighting filter *-----------------------------------------------------------------*/ -#ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { /* st_fx->mem_w0 = xn[L_SUBFR-1] - (gain_pit*y1[L_SUBFR-1]) - (gain_code*y2[L_SUBFR-1]); */ @@ -807,7 +409,6 @@ void encod_gen_voic_ivas_fx( hLPDmem->mem_w0 = round_fx_sat( Ltmp ); /*Q_new-1 */ } ELSE -#endif { /*At this point xn has to be in Qnew @@ -892,13 +493,11 @@ void encod_gen_voic_ivas_fx( * Update A(z) filters *-----------------------------------------------------------------*/ -#ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { Syn_filt_s( 1, p_Aq_fx, M, &exc_fx[i_subfr_fx], &syn_fx[i_subfr_fx], L_SUBFR, hLPDmem->mem_syn, 1 ); } ELSE -#endif { syn_filt_fx( 1, p_Aq_fx, M, &exc_fx[i_subfr_fx], &syn_fx[i_subfr_fx], L_SUBFR, hLPDmem->mem_syn, 1 ); } diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c index 913b208c084ad608dd5fa133e317fd087df5086e..24bf48838bdb9584f095f79c2f889e114930026f 100644 --- a/lib_enc/enc_higher_acelp_fx.c +++ b/lib_enc/enc_higher_acelp_fx.c @@ -22,367 +22,8 @@ static void find_cn_fx( const Word16 xn[], const Word16 Ap[], const Word16 *p_Aq *-----------------------------------------------------------------*/ #define Q_MINUS 4 -#ifndef CLEANUP_ACELP_ENC -void transf_cdbk_enc_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 harm_flag_acelp, /* i : harmonic flag for higher rates ACELP Q0*/ - const Word16 i_subfr, /* i : subframe index Q0*/ - Word16 cn[], /* i/o: target vector in residual domain Q_new*/ - Word16 exc[], /* i/o: pointer to excitation signal frame Q_new*/ - const Word16 *p_Aq, /* i : 12k8 Lp coefficient Q12*/ - const Word16 Ap[], /* i : weighted LP filter coefficients Q12*/ - const Word16 h1[], /* i : weighted filter input response Q15*/ - Word16 xn[], /* i/o: target vector Q_new + shift -1*/ - Word16 xn2[], /* i/o: target vector for innovation search Q_new + shift -1*/ - Word16 y1[], /* i/o: zero-memory filtered adaptive excitation Q_new + shift -1*/ - const Word16 y2[], /* i : zero-memory filtered innovative excitation Q9*/ - const Word16 Es_pred, /* i : predicited scaled innovation energy Q8*/ - Word16 *gain_pit, /* i/o: adaptive excitation gain Q14*/ - const Word32 gain_code, /* i : innovative excitation gain Q16*/ - Word16 g_corr[], /* o : ACELP correlation values Q15*/ - const Word16 clip_gain, /* i : adaptive gain clipping flag Q0*/ - Word16 *gain_preQ, /* o : prequantizer excitation gain Q2*/ - Word16 code_preQ[], /* o : prequantizer excitation Q_AVQ_OUT_DEC*/ - Word16 *unbits, /* o : number of AVQ unused bits Q0*/ - const Word16 Q_new, /* i : Current frame scaling */ - const Word16 shift /* i : shifting applied to y1, xn,... */ -) -{ - Word16 i, index, nBits, Nsv, Es_pred_loc; - Word16 x_in[L_SUBFR], x_tran[L_SUBFR], gcode16, stmp; - Word16 e_corr, m_corr, e_ener, m_ener, m_den, e_den; - Word16 x_norm[L_SUBFR + L_SUBFR / WIDTH_BAND]; - Word32 L_corr, L_ener, Ltmp, Ltmp1; - Word16 nq[L_SUBFR / WIDTH_BAND]; - Word32 out32[L_SUBFR]; - Word16 Qdct; - Word16 avq_bit_sFlag; - Word16 trgtSvPos; - Flag Overflow = 0; - move32(); - - avq_bit_sFlag = 0; - move16(); - if ( st_fx->element_mode > EVS_MONO ) - { - avq_bit_sFlag = 1; - move16(); - } - - /*--------------------------------------------------------------* - * Set bit-allocation - *--------------------------------------------------------------*/ - - Nsv = 8; - move16(); - nBits = st_fx->acelp_cfg.AVQ_cdk_bits[shr( i_subfr, 6 )]; /* Q0 */ - move16(); - - /* increase # of AVQ allocated bits by unused bits from the previous subframe */ - nBits = add( nBits, *unbits ); - - /*--------------------------------------------------------------* - * Compute/Update target - * For inactive frame, find target in residual domain - * Deemphasis - *--------------------------------------------------------------*/ - - IF( EQ_16( st_fx->coder_type, INACTIVE ) ) - { - gcode16 = round_fx_sat( L_shl_sat( gain_code, Q_new ) ); - FOR( i = 0; i < L_SUBFR; i++ ) - { - /*x_tran[i] = xn[i] - *gain_pit * y1[i] - gain_code * y2[i];*/ - Ltmp = L_mult( gcode16, y2[i] ); - Ltmp = L_shl( Ltmp, add( 5, shift ) ); - Ltmp = L_negate( Ltmp ); - Ltmp = L_mac( Ltmp, xn[i], 16384 ); - Ltmp = L_msu( Ltmp, y1[i], *gain_pit ); /* Q_new + 14 + shift */ - Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); /* Q_new + 15 */ - x_tran[i] = round_fx_sat( Ltmp ); /*Q_new-1 */ - move16(); - } - find_cn_fx( x_tran, Ap, p_Aq, x_in ); - } - ELSE - { - updt_tar_fx( cn, x_in, &exc[i_subfr], *gain_pit, L_SUBFR ); - } - Deemph2( x_in, FAC_PRE_AVQ_FX, L_SUBFR, &( st_fx->mem_deemp_preQ_fx ) ); - - /*--------------------------------------------------------------* - * DCT-II - *--------------------------------------------------------------*/ - - test(); - test(); - test(); - IF( NE_16( st_fx->coder_type, INACTIVE ) && LE_32( st_fx->core_brate, MAX_BRATE_AVQ_EXC_TD ) && GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && !harm_flag_acelp ) - { - Copy_Scale_sig( x_in, x_tran, L_SUBFR, -Q_MINUS + 1 ); /*Q_new-1 -> Q_new-4*/ - /*Copy( x_in, x_tran, L_SUBFR );*/ - Qdct = sub( Q_new, Q_MINUS ); - } - ELSE - { - Qdct = 0; - move16(); - edct2_fx( L_SUBFR, -1, x_in, out32, &Qdct, ip_edct2_64, w_edct2_64_fx ); - Qdct = negate( Qdct ); - Copy_Scale_sig_32_16( out32, x_tran, L_SUBFR, sub( Qdct, Q_MINUS - 1 ) ); /* Output in Q_new-4 */ - Qdct = sub( Q_new, Q_MINUS ); - } - - /*--------------------------------------------------------------* - * Split algebraic vector quantizer based on RE8 lattice - *--------------------------------------------------------------*/ - - AVQ_cod_fx( x_tran, x_norm, nBits, Nsv, 0 ); - - /*--------------------------------------------------------------* - * Find prequantizer excitation gain - * Quantize the gain - *--------------------------------------------------------------*/ - - L_corr = L_deposit_l( 0 ); - L_ener = L_deposit_l( 0 ); - FOR( i = 0; i < Nsv * 8; i++ ) - { - /*fcorr += fx_tran[i]*(float)ix_norm[i];*/ - /*fener += (float)ix_norm[i]*(float)ix_norm[i];*/ - stmp = shl_sat( x_norm[i], Q_AVQ_OUT ); - L_corr = L_mac_sat( L_corr, x_tran[i], stmp ); - L_ener = L_mac_sat( L_ener, stmp, stmp ); - } - L_ener = L_max( L_ener, 1 ); - - /* No negative gains allowed in the quantizer*/ - L_corr = L_max( L_corr, 0 ); - - e_corr = norm_l( L_corr ); - m_corr = extract_h( L_shl( L_corr, e_corr ) ); - e_corr = sub( 30, add( e_corr, sub( Qdct, Q_AVQ_OUT ) ) ); - e_ener = norm_l( L_ener ); - m_ener = extract_h( L_shl( L_ener, e_ener ) ); - e_ener = sub( 30, e_ener ); - - IF( GT_16( m_corr, m_ener ) ) - { - m_corr = shr( m_corr, 1 ); - e_corr = add( e_corr, 1 ); - } - m_corr = div_s( m_corr, m_ener ); /* e_corr - e_ener */ - e_corr = sub( e_corr, e_ener ); - Ltmp = L_shl_sat( m_corr, s_min( add( e_corr, 1 ), 31 ) ); /* Lgain in Q16 */ - IF( EQ_16( st_fx->coder_type, INACTIVE ) ) - { - Ltmp1 = L_max( gain_code, 1 ); - e_den = norm_l( Ltmp1 ); - m_den = extract_h( L_shl_sat( Ltmp1, e_den ) ); - /* ensure m_corr < m_den */ - test(); - IF( m_corr > 0 && m_den > 0 ) - { - m_corr = div_s( 16384, m_den ); - e_corr = sub( 14 + 4, e_den ); - Ltmp = L_shr( Mult_32_16( Ltmp, m_corr ), e_corr ); /*Q12*/ - stmp = round_fx_sat( L_shl_sat( Ltmp, 16 ) ); /* Q12 */ - } - ELSE - { - stmp = 0; - move16(); - } - IF( GT_32( st_fx->core_brate, 56000 ) ) - { - index = usquant_fx( stmp, &stmp, G_AVQ_MIN_INACT_64k_Q12, G_AVQ_DELTA_INACT_64k_Q12 >> 1, ( 1 << G_AVQ_BITS ) ); /* Q0 */ - } - ELSE IF( GT_32( st_fx->core_brate, 42000 ) ) - { - index = usquant_fx( stmp, &stmp, G_AVQ_MIN_INACT_48k_Q12, G_AVQ_DELTA_INACT_48k_Q12 >> 1, ( 1 << G_AVQ_BITS ) ); /* Q0 */ - } - ELSE - { - index = usquant_fx( stmp, &stmp, G_AVQ_MIN_INACT_Q12, G_AVQ_DELTA_INACT_Q12 >> 1, ( 1 << G_AVQ_BITS ) ); /* Q0 */ - } - Ltmp = Mult_32_16( gain_code, stmp ); /* Q16 * Q12 - 15 -> Q13*/ - Ltmp = L_shl_sat( Ltmp, 5 ); /* Q13 -> Q18*/ - *gain_preQ = round_fx_sat( Ltmp ); /* Q2*/ - } - ELSE - { - IF( Es_pred < 0 ) - { - Es_pred_loc = shr( negate( Es_pred ), 2 ); /* Q8 */ - } - ELSE - { - Es_pred_loc = Es_pred; /* Q8 */ - move16(); - } - - e_den = norm_s( Es_pred_loc ); - m_den = shl( Es_pred_loc, e_den ); - /* ensure m_corr < m_den */ - test(); - IF( m_corr > 0 && m_den > 0 ) - { - m_corr = div_s( 16384, m_den ); /* 14 - 8 - e_den */ - e_corr = sub( 14 - 8, e_den ); - Ltmp = L_shr( Mult_32_16( Ltmp, m_corr ), e_corr ); /* Q18 */ - } - ELSE - { - Ltmp = L_deposit_l( 0 ); - } - test(); - IF( LE_32( st_fx->core_brate, 42000 ) && GT_32( st_fx->core_brate, ACELP_24k40 ) ) - { - index = gain_quant_fx( &Ltmp, &stmp, LG10_G_AVQ_MIN_32kbps_Q14, LG10_G_AVQ_MAX_Q13, G_AVQ_BITS, &e_den ); /* Q0 */ - } - ELSE - { - index = gain_quant_fx( &Ltmp, &stmp, LG10_G_AVQ_MIN_Q14, LG10_G_AVQ_MAX_Q13, G_AVQ_BITS, &e_den ); /* Q0 */ - } - Ltmp = L_mult( stmp, Es_pred_loc ); /* Q0*Q8 -> Q9*/ - Ltmp = L_shl( Ltmp, add( e_den, 9 ) ); /* Q18*/ - *gain_preQ = round_fx( Ltmp ); /* Q2*/ - } - push_indice( st_fx->hBstr, IND_AVQ_GAIN, index, G_AVQ_BITS ); - - /*--------------------------------------------------------------* - * Encode and multiplex subvectors into bit-stream - *--------------------------------------------------------------*/ - - trgtSvPos = Nsv - 1; - move16(); - test(); - test(); - test(); - test(); - test(); - IF( avq_bit_sFlag && GT_16( nBits, 85 ) && !harm_flag_acelp && ( EQ_16( st_fx->coder_type, GENERIC ) || EQ_16( st_fx->coder_type, TRANSITION ) || EQ_16( st_fx->coder_type, INACTIVE ) ) ) - { - trgtSvPos = 2; - avq_bit_sFlag = 2; - move16(); - move16(); - } - - AVQ_encmux_fx( st_fx->hBstr, -1, x_norm, &nBits, Nsv, nq, avq_bit_sFlag, trgtSvPos ); - - /* save # of AVQ unused bits for next subframe */ - *unbits = nBits; /* Q0 */ - move16(); - - /* at the last subframe, write AVQ unused bits */ - test(); - test(); - IF( EQ_16( i_subfr, 4 * L_SUBFR ) && NE_16( st_fx->extl, SWB_BWE_HIGHRATE ) && NE_16( st_fx->extl, FB_BWE_HIGHRATE ) ) - { - WHILE( *unbits > 0 ) - { - i = s_min( *unbits, 16 ); - push_indice( st_fx->hBstr, IND_UNUSED, 0, i ); - *unbits -= i; - } - } - - /*--------------------------------------------------------------* - * DCT transform - *--------------------------------------------------------------*/ - - FOR( i = 0; i < Nsv * WIDTH_BAND; i++ ) - { - x_tran[i] = shl_sat( x_norm[i], Q_AVQ_OUT_DEC ); - move16(); - } - - test(); - test(); - test(); - IF( NE_16( st_fx->coder_type, INACTIVE ) && LE_32( st_fx->core_brate, MAX_BRATE_AVQ_EXC_TD ) && GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && !harm_flag_acelp ) - { - Copy( x_tran, code_preQ, L_SUBFR ); /* Q_AVQ_OUT_DEC */ - } - ELSE - { - Qdct = 0; - move16(); - edct2_fx( L_SUBFR, 1, x_tran, out32, &Qdct, ip_edct2_64, w_edct2_64_fx ); - /*qdct = sub(Q_AVQ_OUT_DEC,qdct+Q_AVQ_OUT_DEC);*/ - Qdct = negate( Qdct ); - Copy_Scale_sig_32_16( out32, code_preQ, L_SUBFR, Qdct ); /* Output in Q_AVQ_OUT_DEC */ - /*qdct = Q_AVQ_OUT_DEC;*/ - } - - /*--------------------------------------------------------------* - * Preemphasise - *--------------------------------------------------------------*/ - - /* in extreme cases at subframe boundaries, lower the preemphasis memory to avoid a saturation */ - test(); - if ( ( nq[7] != 0 ) && ( GT_16( sub( st_fx->last_nq_preQ, nq[0] ), 7 ) ) ) - { - /* *mem_preemp /= 16; */ - st_fx->mem_preemp_preQ_fx = shr( st_fx->mem_preemp_preQ_fx, 4 ); - move16(); - } - st_fx->last_nq_preQ = nq[7]; - move16(); - - preemph_fx( code_preQ, FAC_PRE_AVQ_FX, L_SUBFR, &( st_fx->mem_preemp_preQ_fx ) ); - - /*--------------------------------------------------------------* - * For inactive segments - * - Zero-memory filtered pre-filter excitation - * - Update of targets and gain_pit - * For inactive segments - * - Update xn[L_subfr-1] for updating the memory of the weighting filter - *--------------------------------------------------------------*/ - - IF( EQ_16( st_fx->coder_type, INACTIVE ) ) - { - /*ftemp = fcode_preQ[0] *fh1[L_SUBFR-1];*/ - Ltmp = L_mult( code_preQ[0], h1[L_SUBFR - 1] ); /*1+14+shift + Q_AVQ_OUT */ - FOR( i = 1; i < L_SUBFR; i++ ) - { - /*ftemp += fcode_preQ[i] * fh1[L_SUBFR-1-i];*/ - Ltmp = L_mac( Ltmp, code_preQ[i], h1[L_SUBFR - 1 - i] ); - } - /*fxn[L_SUBFR-1] -= *fgain_preQ * ftemp;*/ - Ltmp = L_shr( Mult_32_16( Ltmp, *gain_preQ ), sub( add( Q_AVQ_OUT_DEC, 2 ), Q_new ) ); /* (2 + 1 + 14 +shift+Q_AVQ_OUT)-(Q_AVQ_OUT+2-Q_new) = 15 + Q_new + shift */ - xn[L_SUBFR - 1] = round_fx( L_sub( L_mult( xn[L_SUBFR - 1], 32767 ), Ltmp ) ); /* -> Q_new + shift -1 */ - } - ELSE - { - conv_fx( code_preQ, h1, x_tran, L_SUBFR ); - updt_tar_HR_fx( cn, cn, code_preQ, *gain_preQ, sub( Q_new, add( -15 + 2, Q_AVQ_OUT_DEC ) ), L_SUBFR ); - - updt_tar_HR_fx( xn, xn, x_tran, *gain_preQ, sub( Q_new, add( -15 + 2, Q_AVQ_OUT_DEC ) ), L_SUBFR ); - *gain_pit = corr_xy1_fx( xn, y1, g_corr, L_SUBFR, 0, &Overflow ); /* Q14 */ - /* clip gain if necessary to avoid problems at decoder */ - test(); - if ( EQ_16( clip_gain, 1 ) && GT_16( *gain_pit, 15565 ) ) - { - *gain_pit = 15565; /* 0.95 in Q15 */ - move16(); - } - updt_tar_fx( xn, xn2, y1, *gain_pit, L_SUBFR ); - } - - st_fx->use_acelp_preq = 1; - move16(); - - return; -} -#endif -#ifdef CLEANUP_ACELP_ENC void transf_cdbk_enc_fx( -#else -void transf_cdbk_enc_ivas_fx( -#endif Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 harm_flag_acelp, /* i : harmonic flag for higher rates ACELP Q0*/ const Word16 i_subfr, /* i : subframe index Q0*/ @@ -495,13 +136,11 @@ void transf_cdbk_enc_ivas_fx( * Split algebraic vector quantizer based on RE8 lattice *--------------------------------------------------------------*/ -#ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { AVQ_cod_fx( x_tran, x_norm, nBits, Nsv, 0 ); } ELSE -#endif { AVQ_cod_fx( x_tran, x_norm, nBits, Nsv, Qdct ); } diff --git a/lib_enc/enc_nelp_fx.c b/lib_enc/enc_nelp_fx.c index 60bbab86cf44d716adf84f63bb1806aac54d9245..5181a08ffc86760cf387885ed8b0953bc65bdbc7 100644 --- a/lib_enc/enc_nelp_fx.c +++ b/lib_enc/enc_nelp_fx.c @@ -171,145 +171,3 @@ void encod_nelp_fx( return; } -#ifndef CLEANUP_VBR_CAM_ENC - -void encod_nelp_ivas_fx( - Encoder_State *st_fx, /* i/o: state structure */ - const Word16 *speech_fx, - /* i : input speech */ /* Q_new-1 */ - const Word16 Aw_fx[], - /* i : weighted A(z) unquantized for subframes */ /*exp(norm_s(Aw_fx[0])+1)*/ - const Word16 Aq_fx[], - /* i : 12k8 Lp coefficient */ /*exp(norm_s(Aw_fx[0])+1)*/ - Word16 *res_fx, - /* o : residual signal */ /* Q_new */ - Word16 *synth_fx, - /* o : core synthesis */ /* Q_new */ - Word16 *tmp_noise_fx, - /* o : long-term noise energy */ /* Q8 */ - Word16 *exc_fx, - /* i/o: current non-enhanced excitation */ /* Q_new */ - Word16 *exc2_fx, - /* i/o: current enhanced excitation */ /* Q_new */ - Word16 *pitch_buf_fx, - /* o : floating pitch values for each subframe */ /* Q6 */ - Word16 *voice_factors_fx, - /* o : voicing factors */ /* Q15 */ - Word16 *bwe_exc_fx, - /* o : excitation for SWB TBE */ /* Q_new */ - Word16 Q_new, - Word16 shift ) -{ - Word16 xn_fx[L_SUBFR]; /* Target vector for pitch search */ - Word16 h1_fx[L_SUBFR]; /* Impulse response vector */ - Word16 exc_nelp_fx[L_FRAME]; - - Word16 i_subfr, j; - - const Word16 *p_Aw_fx, *p_Aq_fx; /* pointer to LP filter coeff. vector */ - Word16 saved_Q_new = Q_new; - move16(); - - Word16 reduce_gains = 0; - move16(); - LPD_state_HANDLE hLPDmem = st_fx->hLPDmem; - SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; - - test(); - IF( EQ_16( st_fx->bwidth, NB ) && GE_32( st_fx->input_Fs, 16000 ) ) - { - IF( hSC_VBR->last_nelp_mode == 0 ) - { - set16_fx( hSC_VBR->nelp_lp_fit_mem, 0, NELP_LP_ORDER * 2 ); - } - Scale_sig( hSC_VBR->nelp_lp_fit_mem, NELP_LP_ORDER * 2, sub( Q_new, st_fx->prev_Q_new ) ); /* Q_new */ - - pz_filter_sp_fx( num_nelp_lp_fx, den_nelp_lp_fx, res_fx, res_fx, hSC_VBR->nelp_lp_fit_mem, NELP_LP_ORDER, NELP_LP_ORDER, L_FRAME, 3 ); /*16-Q of filter coeff*/ - } - - p_Aw_fx = Aw_fx; - p_Aq_fx = Aq_fx; - - - FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) - { - /*----------------------------------------------------------------* - * - Bandwidth expansion of A(z) filter coefficients - * - Find the excitation search target "xn" and innovation - * target in residual domain "cn" - * - Compute impulse response, h1[], of weighted synthesis filter - *----------------------------------------------------------------*/ - Copy( &res_fx[i_subfr], &exc_fx[i_subfr], L_SUBFR ); /* Q_new */ - - find_targets_ivas_fx( speech_fx, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq_fx, - res_fx, L_SUBFR, p_Aw_fx, TILT_FAC_FX, xn_fx, NULL, h1_fx ); - - /* scale xn[] and h1[] to avoid overflow in dot_product12() */ - Scale_sig( xn_fx, L_SUBFR, shift ); /* scaling of xn[] to limit dynamic at 12 bits Q_new-1+shift */ - - IF( i_subfr == 0 ) - { - test(); - IF( EQ_16( hSC_VBR->Local_VAD, 1 ) && EQ_16( st_fx->bwidth, NB ) ) - { - reduce_gains = 1; - move16(); - } - - nelp_encoder_ivas_fx( st_fx, res_fx, exc_nelp_fx, &Q_new, reduce_gains ); - - Scale_sig( exc_nelp_fx, L_FRAME, ( saved_Q_new - Q_new ) ); /* saved_Q_new */ - } - - - *tmp_noise_fx = 0; - move16(); - - /*-----------------------------------------------------------------* - * Synthesize speech to update mem_syn[]. - * Update A(z) filters - *-----------------------------------------------------------------*/ - Syn_filt_s( 1, p_Aq_fx, M, &exc_nelp_fx[i_subfr], &synth_fx[i_subfr], L_SUBFR, hLPDmem->mem_syn, 1 ); - - p_Aw_fx += ( M + 1 ); - p_Aq_fx += ( M + 1 ); - *pitch_buf_fx = L_SUBFR_Q6; /* Q6 */ - move16(); - - pitch_buf_fx++; - } - - Copy( exc_nelp_fx, exc_fx, L_FRAME ); /* Q_new */ - - /*-----------------------------------------------------------------* - * Updates: last value of new target is stored in mem_w0 - *-----------------------------------------------------------------*/ - - hLPDmem->mem_w0 = sub_sat( shr_sat( xn_fx[L_SUBFR - 1], shift ), shr( exc_fx[L_FRAME - 1], 1 ) ); - move16(); /*Q_new-1 */ - hLPDmem->tilt_code = 0; - move16(); /* purely unvoiced */ - hSC_VBR->prev_tilt_code_fx = hLPDmem->tilt_code; - move16(); - - Copy( exc_fx, exc2_fx, L_FRAME ); /* Q_new */ - - hSC_VBR->prev_ppp_gain_pit_fx = 0; - move16(); - - hLPDmem->dm_fx.prev_state = 0; - move16(); - hLPDmem->dm_fx.prev_gain_pit[0] = hSC_VBR->prev_ppp_gain_pit_fx; /* Q14 */ - move16(); - - FOR( j = 1; j < 5; j++ ) - { - hLPDmem->dm_fx.prev_gain_pit[j] = hLPDmem->dm_fx.prev_gain_pit[j - 1]; /* Q14 */ - move16(); - } - interp_code_5over2_fx( exc2_fx, bwe_exc_fx, L_FRAME ); - set16_fx( voice_factors_fx, 0, NB_SUBFR16k ); - - return; -} -#endif diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index bd9c429b2db79a6774f5088a902b1d8bf4f93ffb..00095a89dd3b7b178705be19cba4d4e4eea986f1 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -374,31 +374,12 @@ void enc_pit_exc_fx( } ELSE IF( use_fcb == 2 ) { -#ifdef CLEANUP_ACELP_ENC /*-----------------------------------------------------------------* * Innovation encoding *-----------------------------------------------------------------*/ inov_encode_fx( st_fx, st_fx->core_brate, 0, st_fx->L_frame, st_fx->last_L_frame, GENERIC, st_fx->bwidth, 0, i_subfr, -1, p_Aq, gain_pit, cn, exc, h2, st_fx->hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, 2 * L_SUBFR, shift, Q_new ); -#else -#ifdef FIX_1904_HARM_GSC_ENC - IF( NE_16( st_fx->element_mode, EVS_MONO ) ) - { - inov_encode_ivas_fx( st_fx, st_fx->core_brate, 0, st_fx->L_frame, st_fx->last_L_frame, GENERIC, st_fx->bwidth, 0, i_subfr, -1, p_Aq, - gain_pit, cn, exc, h2, st_fx->hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, 2 * L_SUBFR, shift, Q_new ); - } - ELSE -#endif - { - /*-----------------------------------------------------------------* - * Innovation encoding - *-----------------------------------------------------------------*/ - - inov_encode_fx( st_fx, st_fx->core_brate, 0, st_fx->L_frame, st_fx->last_L_frame, GENERIC, st_fx->bwidth, 0, i_subfr, -1, p_Aq, - gain_pit, cn, exc, h2, st_fx->hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, 2 * L_SUBFR, shift ); - } -#endif /*-----------------------------------------------------------------* * Gain encoding @@ -412,23 +393,8 @@ void enc_pit_exc_fx( * Innovation & gain encoding *-----------------------------------------------------------------*/ -#ifdef CLEANUP_ACELP_ENC inov_encode_fx( st_fx, Local_BR, 0, st_fx->L_frame, st_fx->last_L_frame, LOCAL_CT, WB, 1, i_subfr, -1, p_Aq, gain_pit, cn, exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, L_SUBFR, shift, Q_new ); -#else -#ifdef FIX_1904_HARM_GSC_ENC - IF( NE_16( st_fx->element_mode, EVS_MONO ) ) - { - inov_encode_ivas_fx( st_fx, Local_BR, 0, st_fx->L_frame, st_fx->last_L_frame, LOCAL_CT, WB, 1, i_subfr, -1, p_Aq, - gain_pit, cn, exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, L_SUBFR, shift, Q_new ); - } - ELSE -#endif - { - inov_encode_fx( st_fx, Local_BR, 0, st_fx->L_frame, st_fx->last_L_frame, LOCAL_CT, WB, 1, i_subfr, -1, p_Aq, - gain_pit, cn, exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, L_SUBFR, shift ); - } -#endif /*-----------------------------------------------------------------* * Gain encoding @@ -453,11 +419,7 @@ void enc_pit_exc_fx( #ifdef FIX_1904_HARM_GSC_ENC IF( NE_16( st_fx->element_mode, EVS_MONO ) ) { -#ifdef CLEANUP_ACELP_ENC hLPDmem->tilt_code = est_tilt_fx( &exc[i_subfr], gain_pit, code, gain_code, &voice_fac, Q_new, L_subfr ); /* Q15 */ -#else - hLPDmem->tilt_code = est_tilt_ivas_fx( &exc[i_subfr], gain_pit, code, gain_code, &voice_fac, Q_new, L_subfr, 0 ); /* Q15 */ -#endif } ELSE #endif diff --git a/lib_enc/enc_ppp_fx.c b/lib_enc/enc_ppp_fx.c index 9b62baea5c9b225d1231f70953a732dbb780ab29..5f097660449be0efb6aa925ba1995735af12dbf4 100644 --- a/lib_enc/enc_ppp_fx.c +++ b/lib_enc/enc_ppp_fx.c @@ -233,187 +233,3 @@ ivas_error encod_ppp_fx( return error; } -#ifndef CLEANUP_VBR_CAM_ENC - -ivas_error encod_ppp_ivas_fx( - Encoder_State *st_fx, /* i/o: state structure */ - const Word16 speech_fx[], /* i : input speech Q_new*/ - const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes Q12*/ - const Word16 Aq_fx[], /* i : 12k8 Lp coefficient Q12*/ - Word16 *res_fx, /* i : residual signal Q_new*/ - Word16 *synth_fx, /* o : core synthesis Q-1*/ - Word16 *exc_fx, /* i/o: current non-enhanced excitation Q_new*/ - Word16 *exc2_fx, /* o : current enhanced excitation Q0*/ - Word16 *pitch_buf_fx, /* o : floating pitch values for each subframe Q6*/ - Word16 *voice_factors, /* o : voicing factors Q15*/ - Word16 *bwe_exc, /* o : excitation for SWB TBE Q_new*/ - Word16 Q_new, - Word16 shift ) -{ - Word16 xn_fx[L_SUBFR]; /* Target vector for pitch search */ - Word16 h1_fx[L_SUBFR + ( M + 1 )]; /* Impulse response vector */ - Word16 i_subfr; /* tmp variables */ - const Word16 *p_Aw_fx, *p_Aq_fx; /* pointer to LP filter coeff. vector*/ - - Word16 k; - Word16 p_Aq_old_fx[M + 1], excQ_ppp_fx[L_FRAME], p_Aq_curr_fx[M], pitch_fx[NB_SUBFR]; - Word16 LPC_de_old_fx[M + 1], LPC_de_curr_fx[M + 1]; - Word16 shift_wsp = add( Q_new, shift ); - Word16 rate_ctrl_fx; - Word16 saved_Q_new = Q_new; - move16(); - LPD_state_HANDLE hLPDmem = st_fx->hLPDmem; - SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; - BSTR_ENC_HANDLE hBstr = st_fx->hBstr; - ivas_error error; - - error = IVAS_ERR_OK; - move16(); - rate_ctrl_fx = hSC_VBR->rate_control; - move16(); - - /*------------------------------------------------------------------* - * ACELP subframe loop - *------------------------------------------------------------------*/ - p_Aw_fx = Aw_fx; - p_Aq_fx = Aq_fx; - FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) - { - /*----------------------------------------------------------------* - * Bandwidth expansion of A(z) filter coefficients - * Find the the excitation search target "xn" and innovation - * target in residual domain "cn" - * Compute impulse response, h1[], of weighted synthesis filter - *----------------------------------------------------------------*/ - - Copy( &res_fx[i_subfr], &exc_fx[i_subfr], L_SUBFR ); /* Q_new */ - - find_targets_ivas_fx( speech_fx, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq_fx, - res_fx, L_SUBFR, p_Aw_fx, TILT_FAC_FX, xn_fx, NULL, h1_fx ); - - /* scale xn[] and h1[] to avoid overflow in dot_product12() */ - Scale_sig( xn_fx, L_SUBFR, shift ); /* scaling of xn[] to limit dynamic at 12 bits */ - - /* call voiced encoder at this point */ - IF( i_subfr == 0 ) /* generate the L_FRAME exc */ - { - FOR( k = 0; k < M; k++ ) - { - p_Aq_curr_fx[k] = p_Aq_fx[k + ( 3 * ( M + 1 ) ) + 1]; /* Q12 */ - move16(); - } - - E_LPC_f_lsp_a_conversion( st_fx->lsp_old_fx, p_Aq_old_fx, M ); - deemph_lpc_fx( p_Aq_curr_fx, p_Aq_old_fx, LPC_de_curr_fx, LPC_de_old_fx, 1 ); - /* both outputs LPC_de_curr_fx and LPC_de_old_fx are in Q12 */ - - - /* last frame-end lpc and curr frame-end lpc */ - IF( ( error = ppp_voiced_encoder_fx( hBstr, hSC_VBR, st_fx->bwidth, st_fx->last_coder_type_raw, st_fx->old_pitch_buf_fx, res_fx, - excQ_ppp_fx, st_fx->pitch[1], LPC_de_old_fx, LPC_de_curr_fx, exc_fx, pitch_fx, Q_new ) ) != IVAS_ERR_OK ) - { - return error; - } - - Scale_sig( exc_fx, L_FRAME, sub( saved_Q_new, Q_new ) ); /* saved_Q_new */ - if ( EQ_16( hSC_VBR->bump_up, 1 ) ) - { - i_subfr = L_FRAME; - move16(); - } - } - - IF( NE_16( hSC_VBR->bump_up, 1 ) ) - { - /*-----------------------------------------------------------------* - * Gain clipping test to avoid unstable synthesis on frame erasure - * or in case of floating point encoder & fixed p. decoder - *-----------------------------------------------------------------*/ - gp_clip_fx( st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx, i_subfr, st_fx->coder_type, xn_fx, st_fx->clip_var_fx, sub( shift_wsp, 1 ) ); - - - /* run the above to maintain gain clipping memories */ - gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, hSC_VBR->prev_ppp_gain_pit_fx, st_fx->clip_var_fx ); - - - /*-----------------------------------------------------------------* - * Synthesize speech to update mem_syn[]. - * Update A(z) filters - *-----------------------------------------------------------------*/ - - Syn_filt_s( 1, p_Aq_fx, M, &excQ_ppp_fx[i_subfr], &synth_fx[i_subfr], L_SUBFR, hLPDmem->mem_syn, 1 ); - - - p_Aw_fx += ( M + 1 ); - p_Aq_fx += ( M + 1 ); - } - - } /* end of subframe loop */ - - IF( hSC_VBR->bump_up ) - { - /* PPP failed, bump up */ - hSC_VBR->ppp_mode = 0; - move16(); - st_fx->core_brate = ACELP_7k20; - move16(); - hSC_VBR->pppcountE = 0; - move16(); - - IF( hSC_VBR->set_ppp_generic ) - { - st_fx->coder_type = GENERIC; - move16(); - } - ELSE - { - st_fx->coder_type = VOICED; - move16(); - } - - /* We write signalling indices again only in case of bump_up */ - /* delete previous indices */ - reset_indices_enc_fx( hBstr, hBstr->nb_ind_tot ); - /* signalling matrix (writing of signalling bits) */ - signalling_enc_fx( st_fx ); - } - ELSE - { - Copy( excQ_ppp_fx, exc_fx, L_FRAME ); /* Q_new */ - - /*-----------------------------------------------------------------* - * Updates: last value of new target is stored in mem_w0 - *-----------------------------------------------------------------*/ - - hLPDmem->mem_w0 = sub( shr( xn_fx[L_SUBFR - 1], shift ), shr( exc_fx[L_FRAME - 1], 1 ) ); /*Q_new-1 */ - - Copy( exc_fx, exc2_fx, L_FRAME ); /* Q_new */ - - hLPDmem->dm_fx.prev_state = 2; - move16(); /*Q0 dispMem index 0 */ - hLPDmem->dm_fx.prev_gain_pit[0] = hSC_VBR->prev_ppp_gain_pit_fx; - move16(); /*Q14 dispMem index 2 */ - - FOR( k = 1; k < 5; k++ ) - { - hLPDmem->dm_fx.prev_gain_pit[k] = hLPDmem->dm_fx.prev_gain_pit[k - 1]; /* Q14 */ - move16(); - } - - hLPDmem->tilt_code = hSC_VBR->prev_tilt_code_fx; /* Q15 */ - move16(); - Copy( pitch_fx, pitch_buf_fx, NB_SUBFR ); - pitch_buf_fx[NB_SUBFR16k - 1] = pitch_fx[NB_SUBFR - 1]; - - interp_code_5over2_fx( exc2_fx, bwe_exc, L_FRAME ); - set16_fx( voice_factors, 0, NB_SUBFR16k ); - } - - hSC_VBR->rate_control = rate_ctrl_fx; /* Q0 */ - move16(); - - set16_fx( hSC_VBR->nelp_lp_fit_mem, 0, NELP_LP_ORDER * 2 ); - - return error; -} -#endif diff --git a/lib_enc/enc_tran_fx.c b/lib_enc/enc_tran_fx.c index 975f62337808659a4170f17c0d2b4355fb966ac0..10e458fb5710a073f8c2f61cbd3b433e3e228791 100644 --- a/lib_enc/enc_tran_fx.c +++ b/lib_enc/enc_tran_fx.c @@ -43,387 +43,8 @@ /* RETURN ARGUMENTS : */ /* _ None */ /*---------------------------------------------------------------------------------*/ -#ifndef CLEANUP_ACELP_ENC -Word16 encod_tran_fx( - Encoder_State *st_fx, /* i/o: state structure */ - const Word16 speech_fx[], /* i : input speech Q0*/ - const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes Q12*/ - const Word16 Aq_fx[], /* i : 12k8 Lp coefficient Q12*/ - const Word16 Es_pred_fx, /* i : predicted scaled innov. energy Q8*/ - const Word16 *res_fx, /* i : residual signal Q_new*/ - Word16 *syn_fx, /* i/o: core synthesis Q_new*/ - Word16 *exc_fx, /* i/o: current non-enhanced excitation Q0*/ - Word16 *exc2_fx, /* i/o: current enhanced excitation Q0*/ - Word16 *pitch_buf_fx, /* i/o: floating pitch values for each subframe Q6*/ - Word16 *voice_factors, /* o : voicing factors Q15*/ - Word16 *bwe_exc_fx, /* i/o: excitation for SWB TBE Q0*/ - Word16 tc_subfr, /* i/o: TC subframe classification Q0*/ - Word16 position, /* i : maximum of residual signal index Q0*/ - Word16 *unbits, /* i/o: number of unused bits Q0*/ - const Word16 shift, /* i : Scaling to get 12 bits */ - const Word16 Q_new /* i : Input scaling */ -) -{ - Word16 xn[L_SUBFR]; /* Target vector for pitch search */ - Word16 xn2[L_SUBFR]; /* Target vector for codebook search */ - Word16 cn[L_SUBFR]; /* Target vector in residual domain */ - Word16 h1[L_SUBFR + ( M + 1 )]; /* Impulse response vector */ - Word16 h2_fx[L_SUBFR + ( M + 1 )]; /* Impulse response vector */ - Word16 code[L_SUBFR]; /* Fixed codebook excitation */ - Word16 y1[L_SUBFR]; /* Filtered adaptive excitation */ - Word16 y2[L_SUBFR]; /* Filtered algebraic excitation */ - Word16 gain_pit = 0, Gain_pitX2, gcode16; /* Pitch gain */ - Word16 voice_fac; /* Voicing factor */ - Word32 gain_code = 0; /* Gain of code */ - Word32 Lgcode; - Word16 gain_inov = 0; /* inovation gain */ - Word16 i, i_subfr, tmp1_fx, tmp_fx; /* tmp variables */ - Word16 unbits_ACELP; - Word16 T0_min, T0_max; /* pitch and TC variables */ - Word16 T0, T0_frac; /* close loop integer pitch and fractional part */ - Word16 *pt_pitch; /* pointer to floating pitch buffer */ - Word16 g_corr[10]; /* ACELP correlation values and gain pitch */ - Word16 clip_gain; /* LSF clip gain */ - const Word16 *p_Aw, *p_Aq; /* pointer to LP filter coefficient vector */ - Word16 gain_preQ = 0; /* Gain of prequantizer excitation */ - Word16 code_preQ[L_SUBFR]; /* Prequantizer excitation */ - Word16 Jopt_flag; /* joint optimization flag */ - Word16 unbits_PI = 0; /* saved bits for PI */ - Word32 norm_gain_code = 0; - Word16 L_frame_fx; - Word16 shift_wsp; - Word32 L_tmp; - BSTR_ENC_HANDLE hBstr = st_fx->hBstr; - SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; - LPD_state_HANDLE hLPDmem = st_fx->hLPDmem; - - L_frame_fx = st_fx->L_frame; - move16(); - - /*------------------------------------------------------------------* - * Initializations - *------------------------------------------------------------------*/ - - gain_pit = 0; - move16(); - gain_code = L_deposit_l( 0 ); - gain_preQ = 0; - move16(); - unbits_PI = 0; - move16(); - IF( EQ_16( L_frame_fx, L_FRAME ) ) - { - T0_max = PIT_MAX; - move16(); - T0_min = PIT_MIN; - move16(); - } - ELSE /* L_frame == L_FRAME16k */ - { - T0_max = PIT16k_MAX; - move16(); - T0_min = PIT16k_MIN; - move16(); - } - - /**unbits = 0;move16();*/ - Jopt_flag = 0; - move16(); - unbits_ACELP = *unbits; /* Q0 */ - move16(); - *unbits = 0; - move16(); - - p_Aw = Aw_fx; /* Q12 */ - p_Aq = Aq_fx; /* Q12 */ - pt_pitch = pitch_buf_fx; /* Q6 */ - gain_preQ = 0; - move16(); - set16_fx( code_preQ, 0, L_SUBFR ); - shift_wsp = add( Q_new, shift ); - - /*----------------------------------------------------------------* - * ACELP subframe loop - *----------------------------------------------------------------*/ - - FOR( i_subfr = 0; i_subfr < L_frame_fx; i_subfr += L_SUBFR ) - { - /*----------------------------------------------------------------* - * Find the the excitation search target "xn" and innovation - * target in residual domain "cn" - * Compute impulse response, h1[], of weighted synthesis filter - *----------------------------------------------------------------*/ - - Copy( &res_fx[i_subfr], &exc_fx[i_subfr], L_SUBFR ); /* Q_new */ - - find_targets_fx( speech_fx, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, - res_fx, L_SUBFR, p_Aw, st_fx->preemph_fac, xn, cn, h1 ); - - Copy_Scale_sig( h1, h2_fx, L_SUBFR, -2 ); - Scale_sig( h1, L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */ - - /* scaling of xn[] to limit dynamic at 12 bits */ - Scale_sig( xn, L_SUBFR, shift ); - - /*-----------------------------------------------------------------* - * TC: subframe determination & - * adaptive/glottal part of excitation construction - *-----------------------------------------------------------------*/ - - transition_enc_fx( st_fx, i_subfr, &tc_subfr, &Jopt_flag, &position, &T0, &T0_frac, &T0_min, &T0_max, exc_fx, y1, - h1, xn, xn2, st_fx->clip_var_fx, &gain_pit, g_corr, &clip_gain, &pt_pitch, bwe_exc_fx, &unbits_ACELP, Q_new, shift ); - - /*-----------------------------------------------------------------* - * Transform domain contribution encoding - active frames - *-----------------------------------------------------------------*/ - - IF( GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) ) - { - transf_cdbk_enc_fx( st_fx, 0, i_subfr, cn, exc_fx, p_Aq, Aw_fx, h1, xn, xn2, y1, y2, Es_pred_fx, - &gain_pit, gain_code, g_corr, clip_gain, &gain_preQ, code_preQ, unbits, Q_new, shift ); - } - - /*-----------------------------------------------------------------* - * ACELP codebook search + pitch sharpening - *-----------------------------------------------------------------*/ - - inov_encode_fx( st_fx, st_fx->core_brate, 0, L_frame_fx, st_fx->last_L_frame, st_fx->coder_type, st_fx->bwidth, st_fx->sharpFlag, - i_subfr, tc_subfr, p_Aq, gain_pit, cn, exc_fx, h2_fx, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, L_SUBFR, shift ); - - test(); - test(); - test(); - if ( ( EQ_16( st_fx->L_frame, L_FRAME16k ) ) && ( tc_subfr == 0 ) && ( EQ_16( i_subfr, L_SUBFR ) ) && ( EQ_16( T0, 2 * L_SUBFR ) ) ) - { - Jopt_flag = 1; - move16(); - } - - /*-----------------------------------------------------------------* - * Quantize the gains - * Test quantized gain of pitch for pitch clipping algorithm - * Update tilt of code: 0.0 (unvoiced) to 0.5 (voiced) - *-----------------------------------------------------------------*/ - - IF( Jopt_flag == 0 ) - { - /* SQ gain_code */ - gain_enc_tc_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr, xn, y2, code, Es_pred_fx, - &gain_pit, &gain_code, &gain_inov, &norm_gain_code, shift_wsp ); - } - ELSE - { - IF( GT_32( st_fx->core_brate, ACELP_32k ) ) - { - /* SQ gain_pit and gain_code */ - gain_enc_SQ_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr, xn, y1, y2, code, Es_pred_fx, - &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain, shift_wsp ); - } - ELSE - { - /* VQ gain_pit and gain_code */ - gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame_fx, i_subfr, tc_subfr, xn, y1, shift_wsp, y2, code, Es_pred_fx, - &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain ); - } - } - gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit, st_fx->clip_var_fx ); - - Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/ - gcode16 = round_fx_sat( Lgcode ); - hLPDmem->tilt_code = Est_tilt2( &exc_fx[i_subfr], gain_pit, code, Lgcode, &voice_fac, shift ); /* Q15 */ - - /*-----------------------------------------------------------------* - * Update memory of the weighting filter - *-----------------------------------------------------------------*/ - - /*st->mem_w0 = xn[L_SUBFR-1] - (gain_pit*y1[L_SUBFR-1]) - (gain_code*y2[L_SUBFR-1]);*/ - L_tmp = L_mult( gcode16, y2[L_SUBFR - 1] ); /* Q10 + Q_new */ - L_tmp = L_shl( L_tmp, add( 5, shift ) ); /* Q15 + Q_new + shift */ - L_tmp = L_negate( L_tmp ); - L_tmp = L_mac( L_tmp, xn[L_SUBFR - 1], 16384 ); - L_tmp = L_msu( L_tmp, y1[L_SUBFR - 1], gain_pit ); - L_tmp = L_shl_sat( L_tmp, sub( 1, shift ) ); /* Q_new + 15 */ - hLPDmem->mem_w0 = round_fx_sat( L_tmp ); /*Q_new-1*/ - - /*-----------------------------------------------------------------* - * Construct adaptive part of the excitation - * Save the non-enhanced excitation for FEC_exc - *-----------------------------------------------------------------*/ - - /* Here, all these conditions have one purpose: to use */ - /* the most efficient loop (the one with the least ops) */ - /* This is done by upscaling gain_pit_fx and/or gain_code16 */ - /* when they don't use all 16 bits of precision */ - - /* exc Q_exc, gpit Q14, code Q12, gcode Q0 */ - IF( norm_s( gain_pit ) == 0 ) - { - FOR( i = 0; i < L_SUBFR; i++ ) - { - exc2_fx[i + i_subfr] = round_fx_sat( L_shl_sat( L_mult_sat( gain_pit, exc_fx[i + i_subfr] ), 1 ) ); /* Q_new */ - } - } - ELSE - { - Gain_pitX2 = shl( gain_pit, 1 ); /* Q15 */ - FOR( i = 0; i < L_SUBFR; i++ ) - { - exc2_fx[i + i_subfr] = mult_r( Gain_pitX2, exc_fx[i + i_subfr] ); /* Q_new */ - } - } - - /*-----------------------------------------------------------------* - * Construct adaptive part of the excitation - * Save the non-enhanced excitation for FEC_exc - *-----------------------------------------------------------------*/ - FOR( i = 0; i < L_SUBFR; i++ ) - { - /* code in Q9, gain_pit in Q14 */ - L_tmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */ - L_tmp = L_shl_sat( L_tmp, 5 ); /* Q15 + Q_new */ - L_tmp = L_mac_sat( L_tmp, exc_fx[i + i_subfr], gain_pit ); /* Q15 + Q_new */ - L_tmp = L_shl_sat( L_tmp, 1 ); /* saturation can occur here Q16 + Q_new */ - exc_fx[i + i_subfr] = round_fx_sat( L_tmp ); /* Q_new */ - } - - /*-----------------------------------------------------------------* - * Add the ACELP pre-quantizer contribution - *-----------------------------------------------------------------*/ - - IF( GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) ) - { - tmp1_fx = add( 16 - ( 2 + Q_AVQ_OUT_DEC + 1 ), Q_new ); - FOR( i = 0; i < L_SUBFR; i++ ) - { - L_tmp = L_mult( gain_preQ, code_preQ[i] ); /* Q2 + Q10 -> Q13*/ - L_tmp = L_shl_sat( L_tmp, tmp1_fx ); /* Q16 + Q_exc */ - tmp_fx = round_fx_sat( L_tmp ); - exc2_fx[i + i_subfr] = add_sat( exc2_fx[i + i_subfr], tmp_fx ); /* Q_exc */ - move16(); - exc_fx[i + i_subfr] = add_sat( exc_fx[i + i_subfr], tmp_fx ); /* Q_exc */ - move16(); - } - } - - /*-----------------------------------------------------------------* - * Prepare TBE excitation - *-----------------------------------------------------------------*/ - - prep_tbe_exc_fx( L_frame_fx, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], - bwe_exc_fx, gain_preQ, code_preQ, Q10, Q_new, T0, T0_frac, st_fx->coder_type, st_fx->core_brate, st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag ); - - /*-----------------------------------------------------------------* - * Synthesize speech to update mem_syn[]. - * Update A(z) filters - *-----------------------------------------------------------------*/ - - Syn_filt_s( 1, p_Aq, M, &exc_fx[i_subfr], &syn_fx[i_subfr], L_SUBFR, hLPDmem->mem_syn, 1 ); - - p_Aw += ( M + 1 ); - p_Aq += ( M + 1 ); - pt_pitch++; - } - - /* write reserved bits */ - WHILE( unbits_PI > 0 ) - { - i = s_min( unbits_PI, 16 ); - push_indice( hBstr, IND_UNUSED, 0, i ); - unbits_PI -= i; - } - - /* write TC configuration */ - IF( EQ_16( L_frame_fx, L_FRAME ) ) - { - IF( EQ_16( tc_subfr, TC_0_0 ) ) - { - push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); - } - ELSE IF( EQ_16( tc_subfr, TC_0_64 ) ) - { - push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); - push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); - } - ELSE IF( EQ_16( tc_subfr, TC_0_128 ) ) - { - push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); - push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); - } - ELSE IF( EQ_16( tc_subfr, TC_0_192 ) ) - { - push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); - push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); - } - ELSE IF( EQ_16( tc_subfr, L_SUBFR ) ) - { - push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); - } - ELSE IF( EQ_16( tc_subfr, 2 * L_SUBFR ) ) - { - push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); - } - ELSE IF( EQ_16( tc_subfr, 3 * L_SUBFR ) ) - { - push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); - } - } - ELSE /* L_frame == L_FRAME16k */ - { - IF( tc_subfr == 0 ) - { - push_indice( hBstr, IND_TC_SUBFR, 0, 2 ); - } - ELSE IF( EQ_16( tc_subfr, L_SUBFR ) ) - { - push_indice( hBstr, IND_TC_SUBFR, 1, 2 ); - } - ELSE IF( EQ_16( tc_subfr, 2 * L_SUBFR ) ) - { - push_indice( hBstr, IND_TC_SUBFR, 2, 2 ); - } - ELSE IF( EQ_16( tc_subfr, 3 * L_SUBFR ) ) - { - push_indice( hBstr, IND_TC_SUBFR, 3, 2 ); - push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); - } - ELSE IF( EQ_16( tc_subfr, 4 * L_SUBFR ) ) - { - push_indice( hBstr, IND_TC_SUBFR, 3, 2 ); - push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); - } - } - - IF( st_fx->Opt_SC_VBR ) - { - /* SC-VBR */ - hSC_VBR->prev_ppp_gain_pit_fx = gain_pit; /* Q14 */ - move16(); - hSC_VBR->prev_tilt_code_fx = hLPDmem->tilt_code; /* Q15 */ - move16(); - } - - return tc_subfr; -} -#endif -#ifdef CLEANUP_ACELP_ENC Word16 encod_tran_fx( -#else -Word16 encod_tran_ivas_fx( -#endif Encoder_State *st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : input speech Q0*/ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes Q12*/ @@ -484,9 +105,6 @@ Word16 encod_tran_ivas_fx( L_frame_fx = st_fx->L_frame; move16(); -#ifndef CLEANUP_ACELP_ENC - set16_fx( h1, 0, L_SUBFR + ( M + 1 ) ); -#endif /*------------------------------------------------------------------* * Initializations *------------------------------------------------------------------*/ @@ -528,12 +146,8 @@ Word16 encod_tran_ivas_fx( move16(); set16_fx( code_preQ, 0, L_SUBFR ); shift_wsp = add( Q_new, shift ); -#ifdef CLEANUP_ACELP_ENC test(); if ( LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && NE_32( st_fx->element_mode, EVS_MONO ) ) -#else - if ( LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) ) -#endif { shift_wsp = sub( shift_wsp, 1 ); } @@ -552,7 +166,6 @@ Word16 encod_tran_ivas_fx( Copy( &res_fx[i_subfr], &exc_fx[i_subfr], L_SUBFR ); /* Q_new */ -#ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { find_targets_fx( speech_fx, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, @@ -562,7 +175,6 @@ Word16 encod_tran_ivas_fx( Scale_sig( h1, L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */ } ELSE -#endif { find_targets_ivas_fx( speech_fx, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, res_fx, L_SUBFR, p_Aw, st_fx->preemph_fac, xn, cn, h1 ); @@ -587,13 +199,8 @@ Word16 encod_tran_ivas_fx( * adaptive/glottal part of excitation construction *-----------------------------------------------------------------*/ -#ifdef CLEANUP_ACELP_ENC transition_enc_fx( st_fx, i_subfr, &tc_subfr, &Jopt_flag, &position, &T0, &T0_frac, &T0_min, &T0_max, exc_fx, y1, h1, xn, xn2, st_fx->clip_var_fx, &gain_pit, g_corr, &clip_gain, &pt_pitch, bwe_exc_fx, &unbits_ACELP, Q_new, shift ); -#else - transition_enc_ivas_fx( st_fx, i_subfr, &tc_subfr, &Jopt_flag, &position, &T0, &T0_frac, &T0_min, &T0_max, exc_fx, y1, - h1, xn, xn2, st_fx->clip_var_fx, &gain_pit, g_corr, &clip_gain, &pt_pitch, bwe_exc_fx, &unbits_ACELP, Q_new, shift ); -#endif /*-----------------------------------------------------------------* * Transform domain contribution encoding - active frames @@ -601,26 +208,16 @@ Word16 encod_tran_ivas_fx( IF( GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) ) { -#ifdef CLEANUP_ACELP_ENC transf_cdbk_enc_fx( st_fx, 0, i_subfr, cn, exc_fx, p_Aq, Aw_fx, h1, xn, xn2, y1, y2, Es_pred_fx, &gain_pit, gain_code, g_corr, clip_gain, &gain_preQ, code_preQ, unbits, Q_new, shift ); -#else - transf_cdbk_enc_ivas_fx( st_fx, 0, i_subfr, cn, exc_fx, p_Aq, Aw_fx, h1, xn, xn2, y1, y2, Es_pred_fx, - &gain_pit, gain_code, g_corr, clip_gain, &gain_preQ, code_preQ, unbits, Q_new, shift ); -#endif } /*-----------------------------------------------------------------* * ACELP codebook search + pitch sharpening *-----------------------------------------------------------------*/ -#ifdef CLEANUP_ACELP_ENC inov_encode_fx( st_fx, st_fx->core_brate, 0, L_frame_fx, st_fx->last_L_frame, st_fx->coder_type, st_fx->bwidth, st_fx->sharpFlag, i_subfr, tc_subfr, p_Aq, gain_pit, cn, exc_fx, h2_fx, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, L_SUBFR, shift, Q_new ); -#else - inov_encode_ivas_fx( st_fx, st_fx->core_brate, 0, L_frame_fx, st_fx->last_L_frame, st_fx->coder_type, st_fx->bwidth, st_fx->sharpFlag, - i_subfr, tc_subfr, p_Aq, gain_pit, cn, exc_fx, h2_fx, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, L_SUBFR, shift, Q_new ); -#endif test(); test(); @@ -663,7 +260,6 @@ Word16 encod_tran_ivas_fx( Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/ gcode16 = round_fx_sat( Lgcode ); -#ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { hLPDmem->tilt_code = Est_tilt2( &exc_fx[i_subfr], gain_pit, code, Lgcode, &voice_fac, shift ); /* Q15 */ @@ -673,22 +269,17 @@ Word16 encod_tran_ivas_fx( hLPDmem->tilt_code = est_tilt_fx( &exc_fx[i_subfr], gain_pit, code, gain_code, &voice_fac, Q_new, L_SUBFR ); // Q15 } move16(); -#else - hLPDmem->tilt_code = est_tilt_ivas_fx( &exc_fx[i_subfr], gain_pit, code, gain_code, &voice_fac, Q_new, L_SUBFR, 0 ); // Q15 -#endif /*-----------------------------------------------------------------* * Update memory of the weighting filter *-----------------------------------------------------------------*/ /*st->mem_w0 = xn[L_SUBFR-1] - (gain_pit*y1[L_SUBFR-1]) - (gain_code*y2[L_SUBFR-1]);*/ -#ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { L_tmp = L_mult( gcode16, y2[L_SUBFR - 1] ); /* Q10 + Q_new */ } ELSE -#endif { L_tmp = L_mult0( gcode16, y2[L_SUBFR - 1] ); } diff --git a/lib_enc/enc_uv_fx.c b/lib_enc/enc_uv_fx.c index de7f281f282daf3e4e8858b9fb5c8471962a9ee7..160814bc07d2e3c1c319d16d9ca90ebd9b80386c 100644 --- a/lib_enc/enc_uv_fx.c +++ b/lib_enc/enc_uv_fx.c @@ -16,244 +16,8 @@ * * Encode unvoiced (UC) frames *-------------------------------------------------------------------*/ -#ifndef CLEANUP_ACELP_ENC -void encod_unvoiced_fx( - Encoder_State *st_fx, /* i/o: state structure */ - const Word16 *speech_fx, /* i : Input speech Q_new*/ - const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes Q12*/ - const Word16 *Aq_fx, /* i : 12k8 Lp coefficient Q12*/ - const Word16 Es_pred, /* i : predicted scaled innov. energy Q8*/ - const Word16 uc_two_stage_flag, /* i : flag indicating two-stage UC Q0*/ - const Word16 *res_fx, /* i : residual signal Q_new*/ - Word16 *syn_fx, /* o : core synthesis Q_new -1 */ - Word16 *tmp_noise_fx, /* o : long-term noise energy Q0*/ - Word16 *exc_fx, /* i/o: current non-enhanced excitation Q_new*/ - Word16 *pitch_buf_fx, /* o : floating pitch values for each subframe Q6*/ - Word16 *voice_factors_fx, /* o : voicing factors Q15*/ - Word16 *bwe_exc_fx, /* i/o: excitation for SWB TBE Q_exc*/ - const Word16 Q_new, - const Word16 shift ) -{ - Word16 xn_fx[L_SUBFR]; /* Target vector for pitch search */ - Word16 h1_fx[L_SUBFR]; /* Impulse response vector */ - Word16 code_fx[L_SUBFR]; /* Fixed codebook excitation */ - Word16 y2_fx[L_SUBFR]; /* Filtered algebraic excitation */ - Word16 *pt_pitch_fx; /* pointer to floating pitch buffer */ - Word16 gain_pit_fx; /* Pitch gain */ - Word16 voice_fac_fx; /* Voicing factor */ - Word32 L_gain_code_fx; /* gain of code */ - Word16 gain_inov_fx; /* inovative gain */ - Word16 cn_fx[L_SUBFR]; /* Target vector in residual domain */ - Word16 y1[L_SUBFR]; /* Filtered adaptive excitation */ - Word16 code2[L_SUBFR]; /* Gaussian excitation */ - Word16 y22[L_SUBFR]; /* Filtered Gaussian excitation */ - Word16 prm_t[2 * NPRM_DIV], *prm = prm_t; - const Word16 *p_Aw_fx, *p_Aq_fx; /* pointer to LP filter coeff. vector */ - Word32 norm_gain_code_fx; - ACELP_config *acelp_cfg; - ACELP_CbkCorr g_corr; - Word32 gain_code2; - Word32 gain_code_vect[2], Ltmp, Ltmp2; - Word16 i_subfr, Q_xn, Q_new_p5, tmp2, j, i; - Word16 index, i_subfr_idx; - acelp_cfg = &( st_fx->acelp_cfg ); - SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; - LPD_state_HANDLE hLPDmem = st_fx->hLPDmem; - - /*------------------------------------------------------------------* - * Initializations - *------------------------------------------------------------------*/ - gain_pit_fx = 0; - move16(); - - test(); - test(); - test(); - IF( st_fx->Opt_SC_VBR && st_fx->vad_flag == 0 && ( EQ_16( hSC_VBR->last_ppp_mode, 1 ) || EQ_16( hSC_VBR->last_nelp_mode, 1 ) ) ) - { - /* SC_VBR - reset the encoder, to avoid memory not updated issue for the - case when UNVOICED mode is used to code inactive speech */ - CNG_reset_enc_fx( st_fx, hLPDmem, pitch_buf_fx, voice_factors_fx, 1 ); - } - - p_Aw_fx = Aw_fx; - p_Aq_fx = Aq_fx; - pt_pitch_fx = pitch_buf_fx; - move16(); - Q_xn = add( sub( Q_new, 1 ), shift ); - Q_new_p5 = add( Q_new, 5 ); - - FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) - { - /*----------------------------------------------------------------* - * Bandwidth expansion of A(z) filter coefficients - * Find the excitation search target "xn" and innovation target in residual domain "cn" - * Compute impulse response, h1[], of weighted synthesis filter - *----------------------------------------------------------------*/ - - i_subfr_idx = shr( i_subfr, 6 ); - Copy( &res_fx[i_subfr], &exc_fx[i_subfr], L_SUBFR ); /* Q_new */ - - find_targets_fx( speech_fx, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq_fx, - res_fx, L_SUBFR, p_Aw_fx, st_fx->preemph_fac, xn_fx, cn_fx, h1_fx ); - - /*Copy_Scale_sig(h1_fx, h2_fx, L_SUBFR, -2);*/ - Scale_sig( h1_fx, L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */ - - /* scaling of xn[] to limit dynamic at 12 bits */ - Scale_sig( xn_fx, L_SUBFR, shift ); - - /*----------------------------------------------------------------* - * Unvoiced subframe processing - *----------------------------------------------------------------*/ - - IF( !uc_two_stage_flag ) - { - *pt_pitch_fx = gaus_encode_fx( st_fx, i_subfr, h1_fx, xn_fx, exc_fx, &hLPDmem->mem_w0, st_fx->clip_var_fx, - &hLPDmem->tilt_code, code_fx, &L_gain_code_fx, y2_fx, &gain_inov_fx, - &voice_fac_fx, &gain_pit_fx, Q_new, shift, &norm_gain_code_fx ); /* Q0 */ - } - ELSE - { - /*----------------------------------------------------------------* - * Unvoiced subframe processing in two stages - *----------------------------------------------------------------*/ - /* No adaptive codebook (UC) */ - set16_fx( y1, 0, L_SUBFR ); - set16_fx( exc_fx + i_subfr, 0, L_SUBFR ); - - /*-----------------------------------------------------------------* - * Gain clipping test to avoid unstable synthesis on frame erasure - * or in case of floating point encoder & fixed p. decoder - *-----------------------------------------------------------------*/ - - Mode2_gp_clip_fx( st_fx->voicing_fx, i_subfr, st_fx->coder_type, xn_fx, st_fx->clip_var_fx, L_SUBFR, Q_xn ); - *pt_pitch_fx = L_SUBFR; - move16(); - - /*----------------------------------------------------------------------* - * Encode the algebraic innovation * - *----------------------------------------------------------------------*/ - - E_ACELP_innovative_codebook_fx( exc_fx, *pt_pitch_fx, 0, 1, gain_pit_fx, hLPDmem->tilt_code, acelp_cfg, i_subfr, p_Aq_fx, h1_fx, xn_fx, cn_fx, y1, y2_fx, (Word8) st_fx->acelp_autocorr, &prm, code_fx, shift, st_fx->L_frame, st_fx->last_L_frame, st_fx->total_brate ); - - E_ACELP_xy2_corr( xn_fx, y1, y2_fx, &g_corr, L_SUBFR, Q_xn ); - - g_corr.y2y2_e = sub( g_corr.y2y2_e, 18 ); /* -18 (y2*y2: Q9*Q9) */ - g_corr.xy2_e = sub( g_corr.xy2_e, add( Q_xn, 9 ) ); /* -(Q_xn+9) (xn: Q_xn y2: Q9) */ - g_corr.y1y2_e = sub( g_corr.y1y2_e, add( Q_xn, 9 ) ); /* -(Q_xn+9) (y1: Q_xn y2: Q9) */ - g_corr.xx_e = sub( g_corr.xx_e, add( Q_xn, Q_xn ) ); /* -(Q_xn+Q_xn) (xn: Q_xn) */ - - assert( gain_pit_fx == 0 ); - gauss_L2_fx( h1_fx, code2, y2_fx, y22, &gain_code2, &g_corr, gain_pit_fx, hLPDmem->tilt_code, p_Aq_fx, acelp_cfg->formant_enh_num, &( st_fx->seed_acelp ), shift ); - - /*----------------------------------------------------------* - * - Compute the fixed codebook gain * - * - quantize fixed codebook gain * - *----------------------------------------------------------*/ - - index = gain_enc_uv_fx( code_fx, code2, L_SUBFR, &gain_pit_fx, &L_gain_code_fx, &gain_code2, - st_fx->flag_noisy_speech_snr, &g_corr, Es_pred, &norm_gain_code_fx, &gain_inov_fx, FUNC_GAIN_ENC_GACELP_UV ); /* Q0 */ - -#ifdef DEBUGGING - assert( st_fx->acelp_cfg.gains_mode[i_subfr_idx] == 7 && "Error: UC two-stage, only 5+2 gain Q is supported" ); -#endif - push_indice( st_fx->hBstr, IND_GAIN, index, st_fx->acelp_cfg.gains_mode[i_subfr_idx] ); - - gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit_fx, st_fx->clip_var_fx ); - - gain_code_vect[0] = L_gain_code_fx; - move32(); - gain_code_vect[1] = L_gain_code_fx; - move32(); - - /*----------------------------------------------------------* - * - voice factor (for pitch enhancement) * - *----------------------------------------------------------*/ - - E_UTIL_voice_factor( exc_fx, i_subfr, code_fx, gain_pit_fx, L_gain_code_fx, &voice_fac_fx, &( hLPDmem->tilt_code ), L_SUBFR, acelp_cfg->voice_tilt, Q_new, shift ); - - IF( st_fx->Opt_RF_ON ) - { - st_fx->hRF->rf_tilt_buf[i_subfr_idx] = hLPDmem->tilt_code; - } - - /*-----------------------------------------------------------------* - * Update memory of the weighting filter - *-----------------------------------------------------------------*/ - - /* st_fx->mem_w0 = xn[L_SUBFR-1] - (gain_pit*y1[L_SUBFR-1]) - (gain_code*y2[L_SUBFR-1]); */ - Ltmp = Mpy_32_16_1( L_gain_code_fx, y2_fx[L_SUBFR - 1] ); /* Q10 */ - Ltmp = L_shl( Ltmp, add( 5, Q_xn ) ); /* Q15 + Q_xn */ - Ltmp = L_mac( Ltmp, y1[L_SUBFR - 1], gain_pit_fx ); /* Q15 + Q_xn */ - /* Add Gaussian contribution*/ - Ltmp2 = Mpy_32_16_1( gain_code2, y22[L_SUBFR - 1] ); /* Q10 */ - Ltmp2 = L_shl( Ltmp2, add( 5, Q_xn ) ); /* Q15 + Q_xn */ - Ltmp = L_add( Ltmp, Ltmp2 ); /* Q15 + Q_xn */ - hLPDmem->mem_w0 = sub( xn_fx[L_SUBFR - 1], round_fx( L_shl( Ltmp, 1 ) ) ); /* Q_xn */ - move16(); - BASOP_SATURATE_WARNING_OFF_EVS; - hLPDmem->mem_w0 = shr_sat( hLPDmem->mem_w0, shift ); /*Qnew-1*/ - BASOP_SATURATE_WARNING_ON_EVS; - - /*-------------------------------------------------------* - * - Find the total excitation. * - *-------------------------------------------------------*/ - - tmp2 = shr( L_SUBFR, 1 ); - FOR( j = 0; j < 2; j++ ) - { - FOR( i = sub( tmp2, shr( L_SUBFR, 1 ) ); i < tmp2; i++ ) - { - /* code in Q9, gain_pit in Q14; exc Q_new */ - Ltmp = Mpy_32_16_1( gain_code2, code2[i] ); /* Q10 */ - Ltmp = L_shl( Ltmp, Q_new_p5 ); /* Q15 + Q_new */ - Ltmp = L_mac( Ltmp, gain_pit_fx, exc_fx[i + i_subfr] ); /* Q_new + Q15 */ - Ltmp2 = Mpy_32_16_1( gain_code_vect[j], code_fx[i] ); /* Q10 */ - Ltmp2 = L_shl( Ltmp2, Q_new_p5 ); /* Q15 + Q_new */ - Ltmp = L_add( Ltmp, Ltmp2 ); /* Q15 + Q_new */ - Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here Q16 + Q_new */ - exc_fx[i + i_subfr] = round_fx_sat( Ltmp ); /* Q_new */ - } - tmp2 = L_SUBFR; - move16(); - } - } - - *tmp_noise_fx = extract_h( norm_gain_code_fx ); /* Q0 */ - voice_factors_fx[i_subfr / L_SUBFR] = 0; - move16(); - - interp_code_5over2_fx( &exc_fx[i_subfr], &bwe_exc_fx[i_subfr * HIBND_ACB_L_FAC], L_SUBFR ); - - /*-----------------------------------------------------------------* - * Synthesize speech to update mem_syn[]. - * Update A(z) filters - *-----------------------------------------------------------------*/ - - Syn_filt_s( 1, p_Aq_fx, M, &exc_fx[i_subfr], &syn_fx[i_subfr], L_SUBFR, hLPDmem->mem_syn, 1 ); - - p_Aw_fx += ( M + 1 ); - p_Aq_fx += ( M + 1 ); - pt_pitch_fx++; - } - - /* SC-VBR */ - hSC_VBR->prev_ppp_gain_pit_fx = gain_pit_fx; /* Q14 */ - move16(); - hSC_VBR->prev_tilt_code_fx = hLPDmem->tilt_code; /* Q15 */ - move16(); - - return; -} -#endif - -#ifdef CLEANUP_ACELP_ENC void encod_unvoiced_fx( -#else -void encod_unvoiced_ivas_fx( -#endif Encoder_State *st_fx, /* i/o: state structure */ const Word16 *speech_fx, /* i : Input speech Q_new*/ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes Q12*/ @@ -334,7 +98,6 @@ void encod_unvoiced_ivas_fx( i_subfr_idx = shr( i_subfr, 6 ); Copy( &res_fx[i_subfr], &exc_fx[i_subfr], L_SUBFR ); /* Q_new */ -#ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { find_targets_fx( speech_fx, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq_fx, @@ -344,7 +107,6 @@ void encod_unvoiced_ivas_fx( Scale_sig( h1_fx, L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */ } ELSE -#endif { find_targets_ivas_fx( speech_fx, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq_fx, res_fx, L_SUBFR, p_Aw_fx, st_fx->preemph_fac, xn_fx, cn_fx, h1_fx ); @@ -387,19 +149,16 @@ void encod_unvoiced_ivas_fx( *pt_pitch_fx = L_SUBFR << 6; move16(); -#ifdef CLEANUP_ACELP_ENC if ( st_fx->element_mode == EVS_MONO ) { *pt_pitch_fx = L_SUBFR; move16(); } -#endif /*----------------------------------------------------------------------* * Encode the algebraic innovation * *----------------------------------------------------------------------*/ -#ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { E_ACELP_innovative_codebook_fx( exc_fx, *pt_pitch_fx, 0, 1, gain_pit_fx, hLPDmem->tilt_code, acelp_cfg, i_subfr, p_Aq_fx, h1_fx, xn_fx, cn_fx, y1, y2_fx, (Word8) st_fx->acelp_autocorr, &prm, code_fx, shift, st_fx->L_frame, st_fx->last_L_frame, st_fx->total_brate ); @@ -409,11 +168,6 @@ void encod_unvoiced_ivas_fx( inov_encode_fx( st_fx, st_fx->core_brate, 0, L_FRAME, st_fx->last_L_frame, UNVOICED, st_fx->bwidth, 1, i_subfr, -1, p_Aq_fx, gain_pit_fx, cn_fx, exc_fx, h2_fx, hLPDmem->tilt_code, *pt_pitch_fx, xn_fx, code_fx, y2_fx, &unbits_PI, L_SUBFR, shift, Q_new ); } -#else - inov_encode_ivas_fx( st_fx, st_fx->core_brate, 0, L_FRAME, st_fx->last_L_frame, - UNVOICED, st_fx->bwidth, 1, i_subfr, -1, p_Aq_fx, - gain_pit_fx, cn_fx, exc_fx, h2_fx, hLPDmem->tilt_code, *pt_pitch_fx, xn_fx, code_fx, y2_fx, &unbits_PI, L_SUBFR, shift, Q_new ); -#endif E_ACELP_xy2_corr( xn_fx, y1, y2_fx, &g_corr, L_SUBFR, Q_xn ); @@ -427,13 +181,11 @@ void encod_unvoiced_ivas_fx( move16(); assert( gain_pit_fx == 0 ); -#ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { gauss_L2_fx( h1_fx, code2, y2_fx, y22, &gain_code2, &g_corr, gain_pit_fx, hLPDmem->tilt_code, p_Aq_fx, acelp_cfg->formant_enh_num, &( st_fx->seed_acelp ), shift ); } ELSE -#endif { gauss_L2_ivas_fx( h1_fx, code2, y2_fx, y22, &gain_code2, &g_corr, gain_pit_fx, hLPDmem->tilt_code, p_Aq_fx, acelp_cfg->formant_enh_num, &( st_fx->seed_acelp ), shift ); } diff --git a/lib_enc/inov_enc_fx.c b/lib_enc/inov_enc_fx.c index a1da64adfd7cd14bad83a66a888c9239df0845bf..0efcf795b2369c00a81ab0d120095893cf4166db 100644 --- a/lib_enc/inov_enc_fx.c +++ b/lib_enc/inov_enc_fx.c @@ -54,299 +54,8 @@ /* RETURN ARGUMENTS : */ /* _ None */ /*==============================================================================*/ -#ifndef CLEANUP_ACELP_ENC -Word16 inov_encode_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word32 core_brate, /* i : core bitrate */ - const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - const Word16 L_frame, /* i : length of the frame */ - const Word16 last_L_frame, /* i : length of the last frame */ - const Word16 coder_type, /* i : coding type */ - const Word16 bwidth, /* i : input signal bandwidth */ - const Word16 sharpFlag, /* i : formant sharpening flag */ - const Word16 i_subfr, /* i : subframe index */ - const Word16 tc_subfr, /* i : TC subframe index */ - const Word16 *p_Aq, /* i : LP filter coefficients Q12*/ - const Word16 gain_pit, /* i : adaptive excitation gain Q14*/ - Word16 *cn, /* i/o: target vector in residual domain Q_new*/ - const Word16 *exc, /* i : pointer to excitation signal frame Q_new*/ - Word16 *h2, /* i/o: weighted filter input response Q12*/ - const Word16 tilt_code, /* i : tilt of the excitation of previous subframe Q15*/ - const Word16 pt_pitch, /* i : pointer to current subframe fractional pitch Q6*/ - const Word16 *xn2, /* i : target vector for innovation search Q_new-1+shift*/ - Word16 *code, /* o : algebraic excitation Q9*/ - Word16 *y2, /* o : zero-memory filtered algebraic excitation Q9*/ - Word16 *unbits, /* o : number of unused bits for PI */ - const Word16 L_subfr, /* i : subframe length */ - Word16 shift ) -{ - Word16 dn[2 * L_SUBFR]; - Word16 nBits, cmpl_flag; - Word16 stack_pulses; - Word16 g1, g2; - Word16 Rw[L_SUBFR]; - Word16 acelpautoc; - BSTR_ENC_HANDLE hBstr = st_fx->hBstr; - (void) last_L_frame; - stack_pulses = 0; - move16(); - - IF( EQ_16( L_frame, L_FRAME ) ) - { - g1 = FORMANT_SHARPENING_G1; - move16(); - g2 = FORMANT_SHARPENING_G2; - move16(); - } - ELSE - { - g1 = FORMANT_SHARPENING_G1_16k; - move16(); - g2 = FORMANT_SHARPENING_G2_16k; - move16(); - } - - /*----------------------------------------------------------------* - * Update target vector for codebook search in residual domain - * Preemphasize the impulse response and include fixed-gain pitch contribution into impulse resp. h1[] (pitch sharpenning) - * Correlation between target xn2[] and impulse response h1[] - *----------------------------------------------------------------*/ - - test(); - test(); - IF( GT_32( core_brate, ACELP_13k20 ) && !Opt_AMR_WB && EQ_16( L_subfr, L_SUBFR ) ) - { - acelpautoc = 1; - move16(); - - cb_shape_fx( 1, 1, 0, sharpFlag, 0, g1, g2, p_Aq, h2, tilt_code, shr( add( pt_pitch, 26 ), 6 ), 0, L_SUBFR ); - /* h2: Q11, Rw: (Rw_e)Q */ - /* Rw_e = */ E_ACELP_hh_corr( h2, Rw, L_SUBFR, 3 ); - - E_ACELP_conv( xn2, h2, cn ); - - /* dn_e -> Rw_e*Q_xn */ - /*dn_e = */ E_ACELP_toeplitz_mul_fx( Rw, cn, dn, L_SUBFR, 1 ); - } - ELSE - { - acelpautoc = 0; - move16(); - updt_tar_fx( cn, cn, &exc[i_subfr], gain_pit, L_subfr ); - /* scaling of cn[] to limit dynamic at 12 bits */ - Scale_sig( cn, L_subfr, shift ); - - cb_shape_fx( 1, 1, 0, sharpFlag, 0, g1, g2, p_Aq, h2, tilt_code, shr( add( pt_pitch, 26 ), 6 ), 0, L_subfr ); - corr_xh_fx( xn2, dn, h2 ); - } - - /*-----------------------------------------------------------------* - * Set complexity reduction flag to limit the number of iterations - * in algebraic innovation search - *-----------------------------------------------------------------*/ - cmpl_flag = 0; - move16(); - test(); - IF( st_fx->acelp_cfg.fcb_mode ) - { - /* set number of iterations in TD stereo, secondary channel */ - test(); - if ( EQ_16( st_fx->element_mode, IVAS_CPE_TD ) && EQ_16( st_fx->idchan, 1 ) ) - { - cmpl_flag = 1; - move16(); - } - } - ELSE IF( EQ_16( L_frame, L_FRAME ) && EQ_16( coder_type, TRANSITION ) ) - { - test(); - test(); - if ( EQ_32( core_brate, ACELP_8k00 ) && i_subfr == 0 && LT_16( tc_subfr, L_SUBFR ) ) - { - cmpl_flag = 3; - move16(); - } - test(); - test(); - test(); - test(); - test(); - if ( EQ_32( core_brate, ACELP_11k60 ) && ( ( i_subfr == 0 && LT_16( tc_subfr, L_SUBFR ) ) || EQ_16( tc_subfr, TC_0_0 ) || ( EQ_16( i_subfr, 3 * L_SUBFR ) && EQ_16( tc_subfr, TC_0_64 ) ) ) ) - { - cmpl_flag = 3; - move16(); - } - test(); - test(); - test(); - test(); - if ( ( EQ_32( core_brate, ACELP_13k20 ) || EQ_32( core_brate, ACELP_12k15 ) ) && ( ( i_subfr == 0 && LT_16( tc_subfr, L_SUBFR ) ) || LE_16( tc_subfr, TC_0_64 ) ) ) - { - cmpl_flag = 3; - move16(); - } - } - - IF( EQ_16( L_frame, L_FRAME16k ) ) - { - IF( LE_32( core_brate, ACELP_32k ) ) - { - cmpl_flag = 4; - move16(); - - test(); - IF( EQ_16( coder_type, TRANSITION ) && GT_16( bwidth, WB ) ) - { - IF( LE_16( i_subfr, L_SUBFR ) ) - { - cmpl_flag = sub( cmpl_flag, 1 ); - } - ELSE - { - cmpl_flag = sub( cmpl_flag, 2 ); - } - } - } - ELSE IF( LE_32( core_brate, ACELP_48k ) ) - { - cmpl_flag = 3; - move16(); - - IF( EQ_16( coder_type, TRANSITION ) ) - { - IF( LE_16( i_subfr, L_SUBFR ) ) - { - cmpl_flag = sub( cmpl_flag, 1 ); - } - ELSE - { - cmpl_flag = sub( cmpl_flag, 2 ); - } - } - } - ELSE - { - cmpl_flag = 4; - move16(); - - IF( EQ_16( coder_type, TRANSITION ) ) - { - IF( LE_16( i_subfr, L_SUBFR ) ) - { - cmpl_flag = sub( cmpl_flag, 1 ); - } - ELSE - { - cmpl_flag = sub( cmpl_flag, 2 ); - } - } - - if ( coder_type == INACTIVE ) - { - cmpl_flag = 4; - move16(); - } - } - } - - test(); - test(); - test(); - IF( NE_16( L_frame, st_fx->last_L_frame ) && GT_32( core_brate, ACELP_13k20 ) && ( LT_32( core_brate, ACELP_32k ) || EQ_16( bwidth, WB ) ) ) - { - if ( GT_16( cmpl_flag, 1 ) ) - { - cmpl_flag = sub( cmpl_flag, 1 ); - } - } - - /*-----------------------------------------------------------------* - * Find and encode the algebraic innovation - *-----------------------------------------------------------------*/ - - set16_fx( y2, 0, L_SUBFR ); - - IF( !Opt_AMR_WB ) - { - IF( st_fx->acelp_cfg.fcb_mode ) - { - } - ELSE - { - nBits = st_fx->acelp_cfg.fixed_cdk_index[shr( i_subfr, 6 )]; - move16(); - - - IF( EQ_16( nBits, 7 ) ) - { - acelp_1t64_fx( hBstr, dn, h2, code, y2, L_SUBFR ); - } - ELSE IF( EQ_16( nBits, 12 ) ) - { - acelp_2t32_fx( hBstr, dn, h2, code, y2 ); - } - ELSE - { - *unbits = add( *unbits, acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, nBits, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ) ); - move16(); - } - } - } - ELSE - { - IF( EQ_32( core_brate, ACELP_6k60 ) ) - { - acelp_2t32_fx( hBstr, dn, h2, code, y2 ); - } - ELSE IF( ( EQ_32( core_brate, ACELP_8k85 ) ) ) - { - acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 20, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); - } - ELSE IF( EQ_32( core_brate, ACELP_12k65 ) ) - { - acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 36, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); - } - ELSE IF( EQ_32( core_brate, ACELP_14k25 ) ) - { - acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 44, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); - } - ELSE IF( EQ_32( core_brate, ACELP_15k85 ) ) - { - acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 52, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); - } - ELSE IF( EQ_32( core_brate, ACELP_18k25 ) ) - { - acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 64, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); - } - ELSE IF( EQ_32( core_brate, ACELP_19k85 ) ) - { - acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 72, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); - } - ELSE IF( EQ_32( core_brate, ACELP_23k05 ) ) - { - acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); - } - ELSE IF( EQ_32( core_brate, ACELP_23k85 ) ) - { - acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, 1, Opt_AMR_WB, st_fx->element_mode ); - } - } - - /*----------------------------------------------------------------* - * Pitch sharpening - *----------------------------------------------------------------*/ - - cb_shape_fx( 1, 1, 0, sharpFlag, 0, g1, g2, p_Aq, code, tilt_code, shr( add( pt_pitch, 26 ), 6 ), 0, L_subfr ); - - return stack_pulses; -} -#endif -#ifdef CLEANUP_ACELP_ENC Word16 inov_encode_fx( -#else -Word16 inov_encode_ivas_fx( -#endif Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 core_brate, /* i : core bitrate */ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ @@ -399,9 +108,7 @@ Word16 inov_encode_ivas_fx( move16(); } -#ifdef CLEANUP_ACELP_ENC IF( NE_32( st_fx->element_mode, EVS_MONO ) ) -#endif { maximum_abs_16_fx( xn2, L_subfr, &max_xn2 ); IF( max_xn2 ) @@ -413,13 +120,10 @@ Word16 inov_encode_ivas_fx( Qxn = 0; move16(); } -#ifdef CLEANUP_ACELP_ENC Qcn = Q_new; move16(); -#endif } -#ifdef CLEANUP_ACELP_ENC ELSE { Q_new = 0; @@ -430,7 +134,6 @@ Word16 inov_encode_ivas_fx( Qcn = 0; move16(); } -#endif /*----------------------------------------------------------------* * Update target vector for codebook search in residual domain @@ -440,10 +143,6 @@ Word16 inov_encode_ivas_fx( test(); test(); -#ifndef CLEANUP_ACELP_ENC - Qcn = Q_new; - move16(); -#endif IF( GT_32( core_brate, ACELP_13k20 ) && !Opt_AMR_WB && EQ_16( L_subfr, L_SUBFR ) ) { acelpautoc = 1; @@ -468,7 +167,6 @@ Word16 inov_encode_ivas_fx( /* scaling of cn[] to limit dynamic at 12 bits */ Scale_sig( cn, L_subfr, shift ); -#ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { cb_shape_fx( 1, 1, 0, sharpFlag, 0, g1, g2, p_Aq, h2, tilt_code, shr( add( pt_pitch, 26 ), 6 ), 0, L_subfr ); @@ -479,7 +177,6 @@ Word16 inov_encode_ivas_fx( move16(); } ELSE -#endif { Word16 q_h1 = sub( 14, norm_s( h2[0] ) ); Scale_sig( h2, L_SUBFR, sub( 11, q_h1 ) ); /* set h2[] in Q11*/ @@ -631,9 +328,7 @@ Word16 inov_encode_ivas_fx( set16_fx( y2, 0, L_SUBFR ); -#ifdef CLEANUP_ACELP_ENC IF( NE_32( st_fx->element_mode, EVS_MONO ) ) -#endif { Qh2 = sub( 14, norm_s( h2[0] ) ); Scale_sig( h2, L_SUBFR, sub( Q12, Qh2 ) ); diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index 4c9b00d46a615e889d4546332c6e5fa716cc7580..90f9222e0eb75d14d626234ff047f4f0a0613ff3 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -650,11 +650,7 @@ ivas_error ivas_core_enc_fx( * Postprocessing for ACELP/HQ core switching *---------------------------------------------------------------------*/ -#ifdef CLEANUP_ACELP_ENC core_switching_post_enc_ivas_fx( st ); -#else - core_switching_post_enc_ivas_fx( st, old_inp_12k8_fx[n], old_inp_16k_fx[n], A_fx[n], Q_new[n] ); -#endif /*---------------------------------------------------------------------* * WB TBE encoding diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index 7792f57d3e870a878721060bb3cbb78f8147da12..813cae04bed7c4f0bd26e5e3ede69a73407ba208 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -127,9 +127,7 @@ ivas_error ivas_cpe_enc_fx( Word16 old_wsp_fx[CPE_CHANNELS][L_WSP]; Word16 e_old_wsp[CPE_CHANNELS], q_old_wsp; Word16 Q_new[CPE_CHANNELS] = { 0 }; -#ifdef FIX_1461_CNG_BW_SWITCHING Word16 NFFT_inner; -#endif move16(); move16(); Word16 q_com, shift, q_min, gb; @@ -1132,12 +1130,10 @@ ivas_error ivas_cpe_enc_fx( IF( EQ_32( sts[0]->core_brate, SID_2k40 ) || sts[0]->core_brate == FRAME_NO_DATA ) { /* Reconfigure DFT Stereo for inactive frames */ -#ifdef FIX_1461_CNG_BW_SWITCHING /* -- nbands may need to be updated here in case the bandwidth was changed due to inactive frames */ NFFT_inner = shl( inner_frame_tbl[sts[0]->bwidth], 1 ); hCPE->hStereoDft->nbands = stereo_dft_band_config_fx( hCPE->hStereoDft->band_limits, hCPE->hStereoDft->hConfig->band_res, NFFT_inner, ENC ); move16(); -#endif IF( EQ_32( sts[0]->core_brate, SID_2k40 ) ) { stereo_dft_config_fx( hConfigDft, IVAS_SID_5k2, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); diff --git a/lib_enc/ivas_ism_param_enc_fx.c b/lib_enc/ivas_ism_param_enc_fx.c index f293131479c0ae019e8123c6fcd5c1e778401481..dbe3f541ea7b53fba06989152133b1f0f1485a17 100644 --- a/lib_enc/ivas_ism_param_enc_fx.c +++ b/lib_enc/ivas_ism_param_enc_fx.c @@ -292,11 +292,7 @@ void ivas_param_ism_stereo_dmx_fx( { tmp = L_add( tmp, 2 * EVS_PI_FX ); } -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE cardioid_left[i] = mac_r( L_mult( alpha, 16384 ), sub( ONE_IN_Q15 - 1, alpha ), getCosWord16( extract_l( tmp ) ) ); // Q14 -#else - cardioid_left[i] = add( shr( alpha, 1 ), mult( sub( ONE_IN_Q15 - 1, alpha ), getCosWord16( extract_l( tmp ) ) ) ); // Q14 -#endif move16(); IF( st_ivas->hSCE[0]->hCoreCoder[0]->ini_frame > 0 ) @@ -304,11 +300,7 @@ void ivas_param_ism_stereo_dmx_fx( Word16 last_cardioid_right; last_cardioid_right = sub( ONE_IN_Q14 /* 1.0f in Q14 */, last_cardioid_left ); /* Smoothing */ -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE cardioid_left[i] = mac_r( L_mult( 24576 /* 0.75f in Q15 */, cardioid_left[i] ), 8192 /* 0.25f in Q15 */, last_cardioid_left ); // Q14 -#else - cardioid_left[i] = add( mult( 24576 /* 0.75f in Q15 */, cardioid_left[i] ), mult( 8192 /* 0.25f in Q15 */, last_cardioid_left ) ); // Q14 -#endif move16(); Word32 grad_32 = L_mult( sub( cardioid_left[i], last_cardioid_left ), shl( one_by_input_frame, 1 ) /* 2.0f / (float) input_frame*/ ); /* Q14+Q16 = Q30 */ /* for the right cardioid, multiply with -1 */ /* Cardioids sum up to 1 */ diff --git a/lib_enc/ivas_mcmasa_enc_fx.c b/lib_enc/ivas_mcmasa_enc_fx.c index 98451f773b5b605786f9eb1feaf7ac1d13b898cc..a33fa909438b5253a11995881154e8b96a45ef7b 100644 --- a/lib_enc/ivas_mcmasa_enc_fx.c +++ b/lib_enc/ivas_mcmasa_enc_fx.c @@ -69,7 +69,6 @@ static void ivas_mcmasa_dmx_fx( const Word16 nchan_transport, const Word16 nchan_inp ); -#ifdef BE_FIX_2240_COMPUTE_COV_MTC_FX_FAST /* Compute covariance matrix, i.e., xT * conj(x), and accumulate to the output */ static void compute_cov_mtx_fx( Word32 sr[MCMASA_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : Input matrix, real, s[ch][freq] (inp_exp) */ @@ -79,16 +78,6 @@ static void compute_cov_mtx_fx( CovarianceMatrix pCOVls[MASA_FREQUENCY_BANDS], /* o : Output matrix, contains upper part of cov mtx */ Word16 inp_exp, /*Stores exponent for temp*/ Word16 *band_grouping ); -#else -static void compute_cov_mtx_fx( - Word32 sr[MCMASA_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : Input matrix, real, s[ch][freq] */ - Word32 si[MCMASA_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : Input matrix, imag, s[ch][freq] */ - const Word16 freq, /* i : Freq to process */ - const Word16 N, /* i : Number of channels */ - CovarianceMatrix *COVls, /* o : Output matrix, contains upper part of cov mtx */ - Word16 inp_exp /*Stores exponent for temp*/ -); -#endif static void computeIntensityVector_enc_fx( const Word16 *band_grouping, @@ -928,11 +917,7 @@ void ivas_mcmasa_param_est_enc_fx( Word32 renormalization_factor_diff_fx[MASA_FREQUENCY_BANDS]; // renormalization_factor_diff_e Word16 renormalization_factor_diff_e[MASA_FREQUENCY_BANDS]; Word32 norm_tmp_fx; -#ifdef BE_FIX_2240_COMPUTE_COV_MTC_FX_FAST Word16 mrange[2]; -#else - Word16 mrange[2], brange[2]; -#endif Word16 numSubFramesForRatio; CovarianceMatrix COVls[MASA_FREQUENCY_BANDS]; Word32 absCOVls_fx[MCMASA_MAX_ANA_CHANS][MCMASA_MAX_ANA_CHANS]; @@ -1077,7 +1062,6 @@ void ivas_mcmasa_param_est_enc_fx( } inp_q = add( inp_q, sf ); -#ifdef BE_FIX_2240_COMPUTE_COV_MTC_FX_FAST /* Compute covariance matrix */ assert( mrange[1] - mrange[0] == 1 ); @@ -1099,28 +1083,6 @@ void ivas_mcmasa_param_est_enc_fx( hMasa->data.energy_fx[block_m_idx][i] = BASOP_Util_Add_Mant32Exp( hMasa->data.energy_fx[block_m_idx][i], hMasa->data.energy_e[block_m_idx][i], COVls[i].xr_fx[j][j], COVls[i].xr_e[j][j], &hMasa->data.energy_e[block_m_idx][i] ); } } -#else - /* Compute covariance matrix */ - FOR( i = 0; i < num_freq_bands; i++ ) - { - brange[0] = hMcMasa->band_grouping[i]; - move16(); - brange[1] = hMcMasa->band_grouping[i + 1]; - move16(); - FOR( j = brange[0]; j < brange[1]; j++ ) - { - compute_cov_mtx_fx( Chnl_RealBuffer_fx, Chnl_ImagBuffer_fx, j, numAnalysisChannels, &( COVls[i] ), sub( 31, inp_q ) ); - } - - - /* Store energies for guiding metadata encoding */ - FOR( j = 0; j < numAnalysisChannels; j++ ) - { - move32(); - hMasa->data.energy_fx[block_m_idx][i] = BASOP_Util_Add_Mant32Exp( hMasa->data.energy_fx[block_m_idx][i], hMasa->data.energy_e[block_m_idx][i], COVls[i].xr_fx[j][j], COVls[i].xr_e[j][j], &hMasa->data.energy_e[block_m_idx][i] ); - } - } -#endif IF( !hMcMasa->separateChannelEnabled ) { @@ -2126,7 +2088,6 @@ static void ivas_mcmasa_dmx_fx( return; } -#ifdef BE_FIX_2240_COMPUTE_COV_MTC_FX_FAST /* Compute covariance matrix, i.e., xT * conj(x), and accumulate to the output */ static void compute_cov_mtx_fx( @@ -2192,55 +2153,6 @@ static void compute_cov_mtx_fx( } -#else -/* Compute covariance matrix, i.e., xT * conj(x), and accumulate to the output */ -static void compute_cov_mtx_fx( - Word32 sr[MCMASA_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : Input matrix, real, s[ch][freq] (inp_exp) */ - Word32 si[MCMASA_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : Input matrix, imag, s[ch][freq] (inp_exp) */ - const Word16 freq, /* i : Freq to process */ - const Word16 N, /* i : Number of channels */ - CovarianceMatrix *COVls, /* o : Output matrix, contains upper part of cov mtx */ - Word16 inp_exp /*Stores exponent for temp*/ -) -{ - Word16 i, j; - Word64 temp64_1, temp64_2; - Word16 tmp_16, max_exp; - Word16 temp_exp = shl( inp_exp, 1 ); - FOR( i = 0; i < N; i++ ) - { - FOR( j = i; j < N; j++ ) - { - temp64_1 = W_mac_32_32( W_mult_32_32( sr[i][freq], sr[j][freq] ), si[i][freq], si[j][freq] ); // exp:2*inp_exp - temp64_2 = W_deposit32_h( COVls->xr_fx[i][j] ); // exp:COVls->xr_e[i][j] - max_exp = s_max( COVls->xr_e[i][j], temp_exp ); - temp64_2 = W_shl( temp64_2, sub( COVls->xr_e[i][j], max_exp ) ); // exp:max_exp - temp64_1 = W_shl( temp64_1, sub( temp_exp, max_exp ) ); // exp:max_exp - temp64_1 = W_add( temp64_1, temp64_2 ); // exp:max_exp - tmp_16 = W_norm( temp64_1 ); - - COVls->xr_fx[i][j] = W_extract_h( W_shl( temp64_1, tmp_16 ) ); // exp:max_exp-tmp_16 - COVls->xr_e[i][j] = sub( max_exp, tmp_16 ); - move32(); - move16(); - - temp64_1 = W_sub( W_mult_32_32( si[i][freq], sr[j][freq] ), W_mult_32_32( sr[i][freq], si[j][freq] ) ); // exp :2*inp_exp - temp64_2 = W_deposit32_h( COVls->xi_fx[i][j] ); // exp:COVls->xi_e[i][j] - max_exp = s_max( COVls->xi_e[i][j], temp_exp ); - temp64_2 = W_shl( temp64_2, sub( COVls->xi_e[i][j], max_exp ) ); // exp:max_exp - temp64_1 = W_shl( temp64_1, sub( temp_exp, max_exp ) ); // exp:max_exp - temp64_1 = W_add( temp64_1, temp64_2 ); // exp:max_exp - tmp_16 = W_norm( temp64_1 ); - - COVls->xi_fx[i][j] = W_extract_h( W_shl( temp64_1, tmp_16 ) ); // exp:max_exp-tmp_16 - COVls->xi_e[i][j] = sub( max_exp, tmp_16 ); - move32(); - } - } - return; -} -#endif - static void computeIntensityVector_enc_fx( const Word16 *band_grouping, Word32 Cldfb_RealBuffer[FOA_CHANNELS][DIRAC_NO_FB_BANDS_MAX], /*inp_q*/ diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index 49418c8fc35d5c845eb483bae2ff664d3918d409..a0ea4e8cd29b67e187106cfaac5db75394713aa9 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -1541,12 +1541,8 @@ static void ivas_omasa_dmx_fx( { g1 = interpolator[k]; move16(); - g2 = sub( MAX_WORD16, g1 ); /*q15*/ -#ifdef FIX_2254_IMPROV_COMPLEXITY_BE + g2 = sub( MAX_WORD16, g1 ); /*q15*/ data_out[j][k] = L_add( data_out[j][k], Mpy_32_32( L_mac( L_mult( g1, gains[j] ), g2, prev_gains[i][j] ) /*q31*/, data_in[i][k] ) ); /*Qx*/ -#else - data_out[j][k] = L_add( data_out[j][k], Mpy_32_32( L_add( L_mult( g1, gains[j] ), L_mult( g2, prev_gains[i][j] ) ) /*q31*/, data_in[i][k] ) ); /*Qx*/ -#endif move32(); } } diff --git a/lib_enc/ivas_stereo_dft_enc_fx.c b/lib_enc/ivas_stereo_dft_enc_fx.c index 56dd1bab9db6ce88c16a1cbf68c1ff41009f9e24..8f6c7663e3ed25d1d89a53c75025c0d1653706f6 100644 --- a/lib_enc/ivas_stereo_dft_enc_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_fx.c @@ -3849,7 +3849,6 @@ static void stereo_dft_enc_compute_prm_fx( hStereoDft->nrg_past_pos = ( pos + 1 ) % STEREO_DFT_NRG_PAST_LEN; move16(); -#ifdef FIX_1461_CNG_BW_SWITCHING /* Replicate last band for remaining bands in case the bandwidth is higher after SID/NODATA is considered */ FOR( i = hStereoDft->nbands; i < STEREO_DFT_BAND_MAX; i++ ) { @@ -3858,7 +3857,6 @@ static void stereo_dft_enc_compute_prm_fx( pSideGain[i] = pSideGain[i - 1]; move32(); } -#endif /*------------------------------------------------------------------* diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index b26b688dc538948ad4b83c1e8bf6e1c547e80ff1..ceaf24790680fd07f1018673c9ad4d1a84ca15f6 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -396,15 +396,9 @@ void tdm_configure_enc_fx( hStereoTD->tdm_use_IAWB_Ave_lpc = 0; /* Flag initialisation */ move16(); -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE sts[0]->hSpMusClas->tdm_lt_Etot_fx = mac_r( L_mult( 3277 /*0.1f in Q15*/, Etot_last_fx[0] ), 29491 /* 0.9f*/, sts[0]->hSpMusClas->tdm_lt_Etot_fx ); move16(); sts[1]->hSpMusClas->tdm_lt_Etot_fx = mac_r( L_mult( 3277 /*0.1f in Q15*/, Etot_last_fx[1] ), 29491 /* 0.9f*/, sts[1]->hSpMusClas->tdm_lt_Etot_fx ); -#else - sts[0]->hSpMusClas->tdm_lt_Etot_fx = add( mult( 3277 /*0.1f in Q15*/, Etot_last_fx[0] ), mult( 29491 /* 0.9f*/, sts[0]->hSpMusClas->tdm_lt_Etot_fx ) ); - move16(); - sts[1]->hSpMusClas->tdm_lt_Etot_fx = add( mult( 3277 /*0.1f in Q15*/, Etot_last_fx[1] ), mult( 29491 /* 0.9f*/, sts[1]->hSpMusClas->tdm_lt_Etot_fx ) ); -#endif move16(); test(); @@ -801,21 +795,14 @@ static void tdm_downmix_plain_ivas_fx( ) { Word16 i; -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE Word16 One_m_Ratio_fx16, ratio_L_fx16; One_m_Ratio_fx16 = extract_h( One_m_Ratio_fx ); ratio_L_fx16 = extract_h( ratio_L_fx ); -#endif FOR( i = start_index; i < end_index; i++ ) { -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE FR_Y_fx[i] = mac_r( L_mult( Right_in_fx[i], One_m_Ratio_fx16 ), Left_in_fx[i], ratio_L_fx16 ); LR_X_fx[i] = msu_r( L_mult( Left_in_fx[i], One_m_Ratio_fx16 ), Right_in_fx[i], ratio_L_fx16 ); -#else - FR_Y_fx[i] = add( mult( Right_in_fx[i], extract_h( One_m_Ratio_fx ) ), mult( Left_in_fx[i], extract_h( ratio_L_fx ) ) ); - LR_X_fx[i] = sub( mult( Left_in_fx[i], extract_h( One_m_Ratio_fx ) ), mult( Right_in_fx[i], extract_h( ratio_L_fx ) ) ); -#endif move16(); move16(); } diff --git a/lib_enc/ivas_td_low_rate_enc_fx.c b/lib_enc/ivas_td_low_rate_enc_fx.c index b1018b917f39f590fcea671e93336ff47e9eb82a..5eb5ae562507db1aab610e282e07007e164e6fc2 100644 --- a/lib_enc/ivas_td_low_rate_enc_fx.c +++ b/lib_enc/ivas_td_low_rate_enc_fx.c @@ -289,11 +289,7 @@ void encod_gen_2sbfr_fx( Scale_sig( h1, 2 * L_SUBFR, sub( 13, q_h1 ) ); // Q13 -#ifdef CLEANUP_ACELP_ENC tbe_celp_exc_fx( st->element_mode, st->idchan, L_frame, 2 * L_SUBFR, i_subfr, T0, T0_frac, &error, bwe_exc, st->tdm_LRTD_flag ); -#else - tbe_celp_exc_ivas( st->element_mode, st->idchan, L_frame, 2 * L_SUBFR, i_subfr, T0, T0_frac, &error, bwe_exc, st->tdm_LRTD_flag ); -#endif /*-----------------------------------------------------------------* * Find adaptive exitation @@ -316,22 +312,14 @@ void encod_gen_2sbfr_fx( lp_filt_exc_enc_fx( MODE1, coder_type, i_subfr, exc, h1, xn, y1, xn2, 2 * L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &st->acelp_cfg.ltf_mode ); /* update long-term pitch gain for speech/music classifier */ -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE st->hSpMusClas->lowrate_pitchGain = mac_r( L_mult( 29491, st->hSpMusClas->lowrate_pitchGain ), 3277 /*Q15*/, gain_pit ); // Q14 -#else - st->hSpMusClas->lowrate_pitchGain = add( mult( 29491, st->hSpMusClas->lowrate_pitchGain ), mult( 3277 /*Q15*/, gain_pit ) ); // Q14 -#endif move16(); /*-----------------------------------------------------------------* * Innovation encoding *-----------------------------------------------------------------*/ -#ifdef CLEANUP_ACELP_ENC inov_encode_fx( st, st->core_brate, 0, L_frame, st->last_L_frame, coder_type, st->bwidth, st->sharpFlag, i_subfr, -1, p_Aq, gain_pit, cn, exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &i, 2 * L_SUBFR, shift, Q_new ); -#else - inov_encode_ivas_fx( st, st->core_brate, 0, L_frame, st->last_L_frame, coder_type, st->bwidth, st->sharpFlag, i_subfr, -1, p_Aq, gain_pit, cn, exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &i, 2 * L_SUBFR, shift, Q_new ); -#endif /*-----------------------------------------------------------------* * Gain encoding @@ -358,11 +346,7 @@ void encod_gen_2sbfr_fx( Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/ gcode16 = round_fx_sat( Lgcode ); /*Q0*/ -#ifdef CLEANUP_ACELP_ENC hLPDmem->tilt_code = est_tilt_fx( exc + i_subfr, gain_pit, code, Lgcode, &voice_fac, Q_new, 2 * L_SUBFR ); /* Q15 */ -#else - hLPDmem->tilt_code = est_tilt_ivas_fx( exc + i_subfr, gain_pit, code, Lgcode, &voice_fac, Q_new, 2 * L_SUBFR, 0 ); /* Q15 */ -#endif move16(); /*-----------------------------------------------------------------* diff --git a/lib_enc/nelp_enc_fx.c b/lib_enc/nelp_enc_fx.c index 60e2b29fecb787f30721aad04d9f0dd692a69c70..dbd6c9607491772424b41498826921d846ac5b2d 100644 --- a/lib_enc/nelp_enc_fx.c +++ b/lib_enc/nelp_enc_fx.c @@ -1032,739 +1032,3 @@ void nelp_encoder_fx( return; } -#ifndef CLEANUP_VBR_CAM_ENC - -void nelp_encoder_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state */ - Word16 *in_fx, /* i : residual signal */ - Word16 *exc_fx, /* o : NELP quantized excitation signal */ - Word16 *qIn1, - Word16 reduce_gains ) -{ - Word16 i, j; - Word16 *ptr_fx = exc_fx; - Word16 lag = 25; /* to cover 25*9 + 31 */ - move16(); - Word16 sqrt_inv_lag = 6554; /* sqrt(1/lag) in Q15 */ - move16(); - Word16 sqrt_inv_lframe_lag = 5885; /* sqrt(1/(L_FRAME-lag*9)) */ - move16(); - Word16 Gains_fx[10], gain_fac_fx; - Word16 iG1_fx, iG2_fx[2]; - Word16 fid; - Word16 fdbck_fx; - Word32 var_dB_fx; - Word32 E1_fx = 0, EL1_fx = 0, EH1_fx = 0, E2_fx = 0, E3_fx = 0, EL2_fx = 0, EH2_fx = 0; - move32(); - move32(); - move32(); - move32(); - move32(); - move32(); - move32(); - Word32 RL_fx = 0, RH_fx = 0; - move32(); - move32(); - Word16 R_fx = 0; - move16(); - Word16 filtRes_fx[L_FRAME]; - Word16 ptr_tmp_fx[L_FRAME]; - - Word16 qE1 = 0, qE2 = 0, qE3 = 0, qEL1 = 0, qEL2 = 0, qEH1 = 0, qEH2 = 0; - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - Word16 qIn = 0, qGain = 0, qf = 0, qf1 = 0, qNelpGain = 0; - move16(); - move16(); - move16(); - move16(); - move16(); - Word16 exp1, exp2, tmp1, tmp2; - Word16 f_Noise, etmp, e_Noise; - Word16 max1 = 0; - move16(); - Word32 l_nelp_gain_mem; - Word32 Ltemp = 0, Ltemp1 = 0, L_tmp = 0, L_const_1; - move32(); - move32(); - move32(); - Word16 BP1_ORDER; - Word16 rf_flag; - SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; - BSTR_ENC_HANDLE hBstr = st_fx->hBstr; - RF_ENC_HANDLE hRF = st_fx->hRF; - - rf_flag = st_fx->rf_mode; - move16(); - - test(); - if ( EQ_16( hSC_VBR->last_nelp_mode, 1 ) && NE_16( st_fx->bwidth, st_fx->last_bwidth ) ) - { - hSC_VBR->last_nelp_mode = 0; - move16(); - } - - qIn = *qIn1; - move16(); - test(); - IF( EQ_16( st_fx->bwidth, NB ) ) - { - IF( hSC_VBR->last_nelp_mode != 1 ) - { - BP1_ORDER = 7; - move16(); - set32_fx( hSC_VBR->bp1_filt_mem_nb_fx, 0, BP1_ORDER * 2 ); - hSC_VBR->qprevGain_fx = 0; - move16(); - } - } - ELSE IF( EQ_16( st_fx->bwidth, WB ) || EQ_16( st_fx->bwidth, SWB ) ) - { - IF( hSC_VBR->last_nelp_mode != 1 ) - { - BP1_ORDER = 4; - move16(); - set16_fx( hSC_VBR->bp1_filt_mem_wb_fx, 0, i_mult( BP1_ORDER, 2 ) ); - } - } - - IF( NE_16( hSC_VBR->last_nelp_mode, 1 ) ) - { - test(); - IF( EQ_16( st_fx->bwidth, WB ) || EQ_16( st_fx->bwidth, SWB ) ) - { - set16_fx( hSC_VBR->shape1_filt_mem_fx, 0, 10 ); - set16_fx( hSC_VBR->shape2_filt_mem_fx, 0, 10 ); - set16_fx( hSC_VBR->shape3_filt_mem_fx, 0, 10 ); - set16_fx( hSC_VBR->txlpf1_filt1_mem_fx, 0, 10 ); - set16_fx( hSC_VBR->txlpf1_filt2_mem_fx, 0, 10 ); - set16_fx( hSC_VBR->txhpf1_filt1_mem_fx, 0, 10 ); - set16_fx( hSC_VBR->txhpf1_filt2_mem_fx, 0, 10 ); - hSC_VBR->qprevIn_fx = 0; - move16(); - hSC_VBR->qprevGain_fx = 0; - move16(); - } - } - - /* Start Unvoiced/NELP Processing */ - test(); - IF( EQ_16( st_fx->bwidth, WB ) || EQ_16( st_fx->bwidth, SWB ) ) - { - qE1 = qIn; - move16(); - E1_fx = L_deposit_l( 0 ); - FOR( i = 0; i < L_FRAME; i++ ) - { - E1_fx = L_mac0_sat( E1_fx, in_fx[i], in_fx[i] ); /*Q(qE1+qE1) */ - } - - qE1 = shl( qE1, 1 ); - - qf = qIn; - move16(); - Scale_sig( hSC_VBR->txlpf1_filt1_mem_fx, 10, ( qf - hSC_VBR->qprevIn_fx ) ); - pz_filter_sp_fx( txlpf1_num_coef_fx, txlpf1_den_coef_fx, in_fx, filtRes_fx, hSC_VBR->txlpf1_filt1_mem_fx, 10, 10, L_FRAME, 3 ); /*1 = (16-qformat of shape1 cofficient) */ - - qEL1 = qf; - move16(); - EL1_fx = L_deposit_l( 0 ); - FOR( i = 0; i < L_FRAME; i++ ) - { - EL1_fx = L_mac0_sat( EL1_fx, filtRes_fx[i], filtRes_fx[i] ); /*Q(2*qIn) */ - } - qEL1 = shl( qEL1, 1 ); - - qf = qIn; - move16(); - Scale_sig( hSC_VBR->txhpf1_filt1_mem_fx, 10, qf - hSC_VBR->qprevIn_fx ); - pz_filter_sp_fx( txhpf1_num_coef_fx, txhpf1_den_coef_fx, in_fx, filtRes_fx, hSC_VBR->txhpf1_filt1_mem_fx, 10, 10, L_FRAME, 3 ); /*1 = (16-qformat of shape1 cofficient) */ - hSC_VBR->qprevIn_fx = qf; - move16(); - - qEH1 = qf; - move16(); - EH1_fx = L_deposit_l( 0 ); - FOR( i = 0; i < L_FRAME; i++ ) - { - EH1_fx = L_mac0_sat( EH1_fx, filtRes_fx[i], filtRes_fx[i] ); /*Q(2*qEH1) */ - } - qEH1 = shl( qEH1, 1 ); - move16(); - } - - qGain = qIn; - move16(); - qGain = shl( qGain, 1 ); - - FOR( i = 0; i < 9; i++ ) - { - Ltemp = L_deposit_l( 0 ); - FOR( j = (Word16) ( i * lag ); j < (Word16) ( ( i + 1 ) * lag ); j++ ) - { - Ltemp = L_mac0_sat( Ltemp, in_fx[j], in_fx[j] ); /*Q(2*qGain) */ - } - - /*Gains[i] = (float) sqrt(Gains[i]/lag); */ - IF( Ltemp != 0 ) - { - exp1 = norm_l( Ltemp ); - tmp1 = extract_h( L_shl( Ltemp, exp1 ) ); /*2*qGain+exp1-16 */ - exp1 = sub( exp1, 30 - qGain ); /* */ - - tmp1 = div_s( 16384, tmp1 ); /*14-2*qGain-exp1+16 */ - L_tmp = L_deposit_h( tmp1 ); - L_tmp = Isqrt_lc( L_tmp, &exp1 ); - L_tmp = Mult_32_16( L_tmp, sqrt_inv_lag ); - Ltemp = L_shl_sat( L_tmp, sub( exp1, 12 ) ); /*Q3 */ - } - Gains_fx[i] = round_fx_sat( Ltemp ); - move16(); - } - - - Ltemp = L_deposit_l( 0 ); - FOR( j = i_mult( i, lag ); j < L_FRAME; j++ ) - { - Ltemp = L_mac0_sat( Ltemp, in_fx[j], in_fx[j] ); /*Q(2*qGain) */ - } - - /*Gains[i] = (float) sqrt(Gains[i]/(L_FRAME-(lag*i))); */ - IF( Ltemp != 0 ) - { - exp1 = norm_l( Ltemp ); - tmp1 = extract_h( L_shl( Ltemp, exp1 ) ); - exp1 = sub( exp1, 30 - qGain ); /* */ - - tmp1 = div_s( 16384, tmp1 ); - L_tmp = L_deposit_h( tmp1 ); - L_tmp = Isqrt_lc( L_tmp, &exp1 ); - L_tmp = Mult_32_16( L_tmp, sqrt_inv_lframe_lag ); - Ltemp = L_shl_sat( L_tmp, sub( exp1, 12 ) ); - } - - Gains_fx[i] = round_fx_sat( Ltemp ); - move16(); - - IF( EQ_16( reduce_gains, 1 ) ) - { - FOR( i = 0; i < 10; i++ ) - { - Gains_fx[i] = mult( Gains_fx[i], 19661 ); - move16(); - } - } - - - qGain = 3; - move16(); - IF( NE_16( hSC_VBR->last_nelp_mode, 1 ) ) /* if prev frame was not NELP then init mem*/ - { - hSC_VBR->nelp_gain_mem_fx = Gains_fx[0]; - move16(); - qNelpGain = qGain; - move16(); - } - - /* tmp = (float) (20.0 * (log10 (Gains[0]) - log10 (st->nelp_gain_mem) ) ); */ - /* var_dB = tmp * tmp; */ - L_tmp = L_deposit_l( Gains_fx[0] ); - L_tmp = L_max( L_tmp, 1 ); - exp2 = norm_l( L_tmp ); - L_tmp = L_shl( L_tmp, exp2 ); /*15+qEL1-qEL2-exp1+exp2 */ - exp2 = sub( sub( 30, exp2 ), qGain ); - tmp1 = Log2_norm_lc( L_tmp ); - Ltemp = Mpy_32_16( exp2, tmp1, 9864 ); /*log(2) in Q13 format = Q0 format */ - /*tmp1 = round_fx(L_shl(Ltemp,12)); Q12 */ - - L_tmp = L_deposit_l( hSC_VBR->nelp_gain_mem_fx ); /*Q0 */ - L_tmp = L_max( L_tmp, 1 ); - exp2 = norm_l( L_tmp ); - L_tmp = L_shl( L_tmp, exp2 ); /*15+qEL1-qEL2-exp1+exp2 */ - exp2 = sub( sub( 30, exp2 ), qNelpGain ); - tmp2 = Log2_norm_lc( L_tmp ); - Ltemp1 = Mpy_32_16( exp2, tmp2, 9864 ); /*log(2) in Q13 format = Q0 format */ - Ltemp1 = L_sub( Ltemp, Ltemp1 ); /*Q16 */ - Ltemp = Mult_32_16( Ltemp1, 20480 ); /*Q11 (20 in Q10) */ - L_tmp = L_shl( Ltemp, 12 ); /*Q23 */ - var_dB_fx = Mult_32_32( L_tmp, L_tmp ); /*Q15 */ - - FOR( i = 1; i < 10; i++ ) - { - L_tmp = L_deposit_l( Gains_fx[i] ); - L_tmp = L_max( L_tmp, 1 ); - exp2 = norm_l( L_tmp ); - L_tmp = L_shl( L_tmp, exp2 ); /*15+qEL1-qEL2-exp1+exp2 */ - exp2 = sub( sub( 30, exp2 ), qGain ); - tmp1 = Log2_norm_lc( L_tmp ); - Ltemp = Mpy_32_16( exp2, tmp1, 9864 ); /*log(2) in Q13 format = Q0 format */ - - L_tmp = L_deposit_l( Gains_fx[i - 1] ); /*Q0 */ - L_tmp = L_max( L_tmp, 1 ); - exp2 = norm_l( L_tmp ); - L_tmp = L_shl( L_tmp, exp2 ); /*15+qEL1-qEL2-exp1+exp2 */ - exp2 = sub( sub( 30, exp2 ), qGain ); - tmp2 = Log2_norm_lc( L_tmp ); - Ltemp1 = Mpy_32_16( exp2, tmp2, 9864 ); /*log(2) in Q13 format = Q0 format */ - Ltemp1 = L_sub( Ltemp, Ltemp1 ); /*Q16 */ - Ltemp = Mult_32_16( Ltemp1, 20480 ); /*Q11 (20 in Q10) */ - L_tmp = L_shl( Ltemp, 12 ); /*Q23 */ - L_tmp = Mult_32_32( L_tmp, L_tmp ); /*Q15 */ - var_dB_fx = L_add( L_tmp, var_dB_fx ); /*Q15 */ - } - - IF( NE_16( hSC_VBR->last_nelp_mode, 1 ) ) - { - /*var_dB *= 0.111f; */ - var_dB_fx = Mult_32_16( var_dB_fx, 3637 ); /*0.111 in Q15 */ - } - ELSE - { - /*var_dB *= 0.1f; */ - var_dB_fx = Mult_32_16( var_dB_fx, 3277 ); /*0.1 in Q15 */ - } - - max1 = 0; - move16(); - FOR( i = 0; i < 10; i++ ) - { - max1 = s_max( max1, abs_s( Gains_fx[i] ) ); - } - - qf = norm_s( max1 ); - test(); - IF( ( qf == 0 ) && ( max1 == 0 ) ) - { - qf = 15; - move16(); - } - qf = sub( qf, 1 ); - qGain = add( qGain, qf ); - - Scale_sig( Gains_fx, 10, qf ); - - L_tmp = L_sub( var_dB_fx, 655360 ); /* 20 in Q15 */ - Ltemp = L_shr_r( L_tmp, 2 ); /*Q15 */ - { - /*exp = pow(2, x*log2(e)) */ - L_tmp = Mult_32_16( Ltemp, 23637 ); /*15 + 14 -15 ->Q14 */ - L_tmp = L_shl( L_tmp, 2 ); /*Q16 */ - f_Noise = L_Extract_lc( L_tmp, &e_Noise ); /*Q16 */ - etmp = extract_l( Pow2( 14, f_Noise ) ); /* Put 14 as exponent */ - e_Noise = sub( e_Noise, 14 ); /* Retreive exponent of etmp */ - - - IF( e_Noise > 0 ) - { - L_tmp = L_shl_sat( etmp, e_Noise ); /* Result in Q30 */ - L_tmp = L_add_sat( 1, L_tmp ); - - - exp1 = norm_l( L_tmp ); - tmp1 = extract_h( L_shl( L_tmp, exp1 ) ); /*exp1-16 */ - tmp1 = div_s( 16384, tmp1 ); /*14-(exp1-16)-> 30+15-exp1 */ - fdbck_fx = mult( 26870, tmp1 ); /*45-exp1+15-15=>45-exp1 */ - fdbck_fx = shr_r( fdbck_fx, 14 ); - exp1 = sub( 31, exp1 ); - } - ELSE - { - L_tmp = L_shl( etmp, add( e_Noise, 14 ) ); /* Result in Q30 */ - L_tmp = L_add( 16384, L_tmp ); - - exp1 = norm_l( L_tmp ); - tmp1 = extract_h( L_shl( L_tmp, exp1 ) ); /*14+exp1-16 */ - tmp1 = div_s( 16384, tmp1 ); /*14-(14+exp1-16)-> 16+15-exp1 */ - fdbck_fx = mult( 26870, tmp1 ); /*31-exp1+15-15=>31-exp1 */ - exp1 = sub( 31, exp1 ); - } - } - - IF( EQ_16( exp1, 31 ) ) - { - L_const_1 = 0x7fffffff; - move32(); - } - ELSE - { - L_const_1 = L_shl( 1, exp1 ); - } - - l_nelp_gain_mem = L_deposit_l( hSC_VBR->nelp_gain_mem_fx ); - IF( NE_16( qNelpGain, qGain ) ) - { - l_nelp_gain_mem = L_shl( l_nelp_gain_mem, sub( qGain, qNelpGain ) ); - } - - FOR( i = 0; i < 10; i++ ) - { - /*Gains[i] = (float)((1.0f - fdbck) * Gains[i] + fdbck * st->nelp_gain_mem); */ - L_tmp = L_sub( L_const_1, L_deposit_l( fdbck_fx ) ); /*31-exp1 */ - L_tmp = Mult_32_16( L_tmp, Gains_fx[i] ); /*exp1+qGain-15=>exp1-15+qGain */ - Ltemp1 = Mult_32_16( l_nelp_gain_mem, fdbck_fx ); /*exp1+qGain-15 */ - L_tmp = L_add( L_tmp, Ltemp1 ); - L_tmp = L_shr_r( L_tmp, ( exp1 - 15 ) ); - Gains_fx[i] = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); - move16(); - l_nelp_gain_mem = L_tmp; - } - - hSC_VBR->nelp_gain_mem_fx = round_fx( L_shl( l_nelp_gain_mem, 16 ) ); - move16(); - - Scale_sig( &hSC_VBR->nelp_gain_mem_fx, 1, -qGain ); - Scale_sig( Gains_fx, 10, -qGain ); - qGain = 0; - move16(); - - quantize_uvg_fx( Gains_fx, &iG1_fx, iG2_fx, Gains_fx, st_fx->bwidth ); - - IF( EQ_16( rf_flag, 1 ) ) - { - hRF->rf_indx_nelp_iG1[0] = iG1_fx; - move16(); - hRF->rf_indx_nelp_iG2[0][0] = iG2_fx[0]; - move16(); - hRF->rf_indx_nelp_iG2[0][1] = iG2_fx[1]; - move16(); - } - ELSE - { - push_indice( hBstr, IND_IG1, iG1_fx, 5 ); - push_indice( hBstr, IND_IG2A, iG2_fx[0], 6 ); - push_indice( hBstr, IND_IG2B, iG2_fx[1], 6 ); - } - - test(); - IF( EQ_16( st_fx->bwidth, WB ) || EQ_16( st_fx->bwidth, SWB ) ) - { - gain_fac_fx = 19005; - move16(); /* 1.16f in Q14 */ - } - ELSE - { - gain_fac_fx = 22446; - move16(); /* 1.37f in Q14 */ - } - - /* Normalize Gains_fx[10] with headroom 4 */ - /* This fills up qGain with some new value */ - normalize_arr( Gains_fx, &qGain, 10, 4 ); - - generate_nelp_excitation_fx( &( hSC_VBR->nelp_enc_seed ), Gains_fx, ptr_fx, gain_fac_fx ); - test(); - IF( EQ_16( st_fx->bwidth, WB ) || EQ_16( st_fx->bwidth, SWB ) ) - { - BP1_ORDER = 4; - move16(); - Scale_sig( hSC_VBR->bp1_filt_mem_wb_fx, BP1_ORDER * 2, qGain - hSC_VBR->qprevGain_fx ); /*qf-qAdj */ - pz_filter_sp_fx( bp1_num_coef_wb_fx, bp1_den_coef_wb_fx, ptr_fx, ptr_tmp_fx, hSC_VBR->bp1_filt_mem_wb_fx, BP1_ORDER, BP1_ORDER, L_FRAME, 2 ); - Copy( ptr_tmp_fx, ptr_fx, L_FRAME ); - } - ELSE IF( EQ_16( st_fx->bwidth, NB ) ) - { - BP1_ORDER = 7; - move16(); - Scale_sig32( hSC_VBR->bp1_filt_mem_nb_fx, BP1_ORDER * 2, ( qGain - hSC_VBR->qprevGain_fx ) ); - pz_filter_dp_fx( bp1_num_coef_nb_fx_order7, bp1_den_coef_nb_fx_order7, ptr_fx, ptr_tmp_fx, hSC_VBR->bp1_filt_mem_nb_fx, BP1_ORDER, BP1_ORDER, L_FRAME, ( sub( 16, BP1_COEF_NB_QF_ORDER7 ) ) ); - Copy( ptr_tmp_fx, ptr_fx, L_FRAME ); - - Scale_sig( ptr_fx, L_FRAME, -1 ); /* bring exc to qgain-1 */ - *qIn1 = sub( qGain, 1 ); /* use this temp only in the parent */ - } - - E3_fx = L_deposit_l( 0 ); - FOR( i = 0; i < L_FRAME; i++ ) - { - E3_fx = L_mac_sat( E3_fx, ptr_fx[i], ptr_fx[i] ); /*Q1 */ - } - qE3 = add( shl( qGain, 1 ), 1 ); - - test(); - IF( EQ_16( st_fx->bwidth, WB ) || EQ_16( st_fx->bwidth, SWB ) ) - { - Scale_sig( hSC_VBR->shape1_filt_mem_fx, 10, ( qGain - hSC_VBR->qprevGain_fx ) ); - pz_filter_sp_fx( shape1_num_coef_fx, shape1_den_coef_fx, ptr_fx, ptr_tmp_fx, hSC_VBR->shape1_filt_mem_fx, 10, 10, L_FRAME, 1 ); /*1 = (16-qformat of shape1 cofficient) */ - Copy( ptr_tmp_fx, ptr_fx, L_FRAME ); - - qf = qGain; - move16(); - E2_fx = L_deposit_l( 0 ); - FOR( i = 0; i < L_FRAME; i++ ) - { - Ltemp = L_mult0( ptr_fx[i], ptr_fx[i] ); /*Q(2*qE2+1) */ - Ltemp = L_shr_r( Ltemp, 4 ); - E2_fx = L_add( E2_fx, Ltemp ); - } - qE2 = sub( shl( qf, 1 ), 4 ); - - test(); - IF( E1_fx == 0 ) - { - R_fx = 0; - move16(); - } - ELSE IF( ( E2_fx == 0 ) && ( E1_fx != 0 ) ) - { - exp1 = norm_l( E1_fx ); - tmp1 = extract_h( L_shl( E1_fx, exp1 ) ); /*qE1+exp1-16 */ - tmp1 = div_s( 16384, tmp1 ); /*14-(qE1+exp1-16)-> 30-qE1-exp1 */ - exp1 = sub( exp1, 30 - qE1 ); - - L_tmp = L_deposit_h( tmp1 ); - L_tmp = Isqrt_lc( L_tmp, &exp1 ); - Ltemp = L_shl( L_tmp, sub( exp1, 12 ) ); - R_fx = round_fx( Ltemp ); - } - ELSE - { - exp1 = norm_l( E1_fx ); - tmp1 = extract_h( L_shl( E1_fx, exp1 ) ); /*qE1+exp1-16 */ - tmp1 = div_s( 16384, tmp1 ); /*14-(qE1+exp1-16)-> 30-qE1-exp1 */ - L_tmp = Mult_32_16( E2_fx, tmp1 ); /*qE2+30-qE1-exp1-15=>15+qE2-qE1-exp1 */ - - exp2 = norm_l( L_tmp ); - L_tmp = L_shl( L_tmp, exp2 ); /*15+qE2-qE1-exp1+exp2 */ - exp2 = add( 15, add( sub( sub( qE2, qE1 ), exp1 ), exp2 ) ); - L_tmp = Isqrt_lc( L_tmp, &exp2 ); /*Q(31+exp2) */ - R_fx = round_fx( L_tmp ); - exp1 = sub( 8, exp2 ); - } - - FOR( i = 0; i < L_FRAME; i++ ) - { - Ltemp = L_mult0( R_fx, ptr_fx[i] ); - Ltemp = L_shr_r( Ltemp, exp1 ); - filtRes_fx[i] = round_fx_sat( L_shl_sat( Ltemp, 16 ) ); - move16(); - } - - qf1 = qGain; - move16(); - Scale_sig( hSC_VBR->txlpf1_filt2_mem_fx, 10, ( qf1 - hSC_VBR->qprevGain_fx ) ); - - pz_filter_sp_fx( txlpf1_num_coef_fx, txlpf1_den_coef_fx, filtRes_fx, ptr_tmp_fx, hSC_VBR->txlpf1_filt2_mem_fx, 10, 10, L_FRAME, 3 ); /*1 = (16-qformat of shape1 cofficient) */ - Copy( ptr_tmp_fx, filtRes_fx, L_FRAME ); - - qEL2 = qf1; - move16(); - EL2_fx = L_deposit_l( 0 ); - FOR( i = 0; i < L_FRAME; i++ ) - { - EL2_fx = L_mac0_sat( EL2_fx, filtRes_fx[i], filtRes_fx[i] ); /*Q(2*qEL2) */ - } - qEL2 = shl( qEL2, 1 ); - - FOR( i = 0; i < L_FRAME; i++ ) - { - Ltemp = L_mult0( R_fx, ptr_fx[i] ); - Ltemp = L_shr_r( Ltemp, exp1 ); - filtRes_fx[i] = round_fx_sat( L_shl_sat( Ltemp, 16 ) ); - move16(); - } - - qf = qGain; - move16(); - Scale_sig( hSC_VBR->txhpf1_filt2_mem_fx, 10, ( qf - hSC_VBR->qprevGain_fx ) ); - pz_filter_sp_fx( txhpf1_num_coef_fx, txhpf1_den_coef_fx, filtRes_fx, ptr_tmp_fx, hSC_VBR->txhpf1_filt2_mem_fx, 10, 10, L_FRAME, 3 ); /*1 = (16-qformat of shape1 cofficient) */ - - Copy( ptr_tmp_fx, filtRes_fx, L_FRAME ); - - qEH2 = qf; - move16(); - EH2_fx = L_deposit_l( 0 ); - FOR( i = 0; i < L_FRAME; i++ ) - { - EH2_fx = L_mac0_sat( EH2_fx, filtRes_fx[i], filtRes_fx[i] ); /*Q(2*qEH2) */ - } - qEH2 = shl( qEH2, 1 ); - IF( EL2_fx == 0 ) - { - exp2 = norm_l( EL1_fx ); - L_tmp = L_shl( EL1_fx, exp2 ); - exp2 = sub( sub( 30, exp2 ), qEL1 ); - tmp1 = Log2_norm_lc( L_tmp ); - Ltemp = Mpy_32_16( exp2, tmp1, 9864 ); /*10*log(2) in Q15 format = Q0 format */ - tmp1 = round_fx_sat( L_shl_sat( Ltemp, 12 ) ); /* Q12 */ - RL_fx = L_mult0( tmp1, 10 ); - } - ELSE - { - exp1 = norm_l( EL2_fx ); - tmp1 = extract_h( L_shl( EL2_fx, exp1 ) ); /*qEL2+exp1-16 */ - tmp1 = div_s( 16384, tmp1 ); /*14-(qEL2+exp1-16)-> 30-qEL2-exp1 */ - L_tmp = Mult_32_16( EL1_fx, tmp1 ); /*qEL1+30-qEL2-exp1-15=>15+qE1-qEL2-exp1 */ - - exp2 = norm_l( L_tmp ); - L_tmp = L_shl( L_tmp, exp2 ); /*15+qEL1-qEL2-exp1+exp2 */ - exp2 = sub( 30, add( sub( sub( add( 30, qEL1 ), qEL2 ), exp1 ), exp2 ) ); - tmp1 = Log2_norm_lc( L_tmp ); - Ltemp = Mpy_32_16( exp2, tmp1, 9864 ); /*10*log(2) in Q15 format = Q0 format */ - tmp1 = round_fx_sat( L_shl_sat( Ltemp, 12 ) ); /* Q12 */ - RL_fx = L_mult0( tmp1, 10 ); - } - - IF( EH2_fx == 0 ) - { - exp2 = norm_l( EH2_fx ); - L_tmp = L_shl( EH2_fx, exp2 ); - exp2 = sub( sub( 30, exp2 ), qEH2 ); - tmp1 = Log2_norm_lc( L_tmp ); - Ltemp = Mpy_32_16( exp2, tmp1, 9864 ); /*10*log(2) in Q13 format = Q0 format */ - tmp1 = round_fx_sat( L_shl_sat( Ltemp, 12 ) ); /* Q12 */ - RH_fx = L_mult0( tmp1, 10 ); - } - ELSE - { - exp1 = norm_l( EH2_fx ); - tmp1 = extract_h( L_shl( EH2_fx, exp1 ) ); /*qEH2+exp1-16 */ - tmp1 = div_s( 16384, tmp1 ); /*14-(qEH2+exp1-16)-> 30-qEH2-exp1 */ - L_tmp = Mult_32_16( EH1_fx, tmp1 ); /*15+qEH1-qEH2-exp1 */ - - exp2 = norm_l( L_tmp ); - L_tmp = L_shl( L_tmp, exp2 ); /*15+qEH1-qEH2-exp1+exp2 */ - exp2 = sub( 30, add( 30, add( sub( sub( qEH1, qEH2 ), exp1 ), exp2 ) ) ); - tmp1 = Log2_norm_lc( L_tmp ); - Ltemp = Mpy_32_16( exp2, tmp1, 9864 ); /*10*log(2) in Q13 format = Q0 format */ - tmp1 = round_fx_sat( L_shl_sat( Ltemp, 12 ) ); /* Q12 */ - RH_fx = L_mult0( tmp1, 10 ); - } - - fid = 0; - move16(); - IF( LT_32( RL_fx, -12288 ) ) /* -3 in Q12 */ - { - fid = 1; - move16(); - } - ELSE IF( LT_32( RH_fx, -12288 ) ) /* -3 in Q12 */ - { - fid = 2; - move16(); - } - - IF( rf_flag == 0 ) - { - - SWITCH( fid ) - { - case 1: - /* Update other filter memory */ - Scale_sig( hSC_VBR->shape3_filt_mem_fx, 10, ( qGain - hSC_VBR->qprevGain_fx ) ); - pz_filter_sp_fx( shape3_num_coef_fx, shape3_den_coef_fx, ptr_fx, filtRes_fx, hSC_VBR->shape3_filt_mem_fx, 10, 10, L_FRAME, 1 ); /*1 = (16-qformat of shape1 cofficient) */ - - /* filter the residual to desired shape */ - Scale_sig( hSC_VBR->shape2_filt_mem_fx, 10, ( qGain - hSC_VBR->qprevGain_fx ) ); - pz_filter_sp_fx( shape2_num_coef_fx, shape2_den_coef_fx, ptr_fx, ptr_tmp_fx, hSC_VBR->shape2_filt_mem_fx, 10, 10, L_FRAME, 1 ); /*1 = (16-qformat of shape1 cofficient) */ - Copy( ptr_tmp_fx, ptr_fx, L_FRAME ); - - BREAK; - case 2: - /* Update other filter memory */ - Scale_sig( hSC_VBR->shape2_filt_mem_fx, 10, ( qGain - hSC_VBR->qprevGain_fx ) ); - pz_filter_sp_fx( shape2_num_coef_fx, shape2_den_coef_fx, ptr_fx, filtRes_fx, hSC_VBR->shape2_filt_mem_fx, 10, 10, L_FRAME, 1 ); /*1 = (16-qformat of shape1 cofficient) */ - - /* filter the residual to desired shape */ - Scale_sig( hSC_VBR->shape3_filt_mem_fx, 10, ( qGain - hSC_VBR->qprevGain_fx ) ); - pz_filter_sp_fx( shape3_num_coef_fx, shape3_den_coef_fx, ptr_fx, ptr_tmp_fx, hSC_VBR->shape3_filt_mem_fx, 10, 10, L_FRAME, 1 ); /*1 = (16-qformat of shape1 cofficient) */ - - Copy( ptr_tmp_fx, ptr_fx, L_FRAME ); - - BREAK; - default: - Scale_sig( hSC_VBR->shape2_filt_mem_fx, 10, ( qGain - hSC_VBR->qprevGain_fx ) ); - pz_filter_sp_fx( shape2_num_coef_fx, shape2_den_coef_fx, ptr_fx, filtRes_fx, hSC_VBR->shape2_filt_mem_fx, 10, 10, L_FRAME, 1 ); /*1 = (16-qformat of shape1 cofficient) */ - - Scale_sig( hSC_VBR->shape3_filt_mem_fx, 10, ( qGain - hSC_VBR->qprevGain_fx ) ); - pz_filter_sp_fx( shape3_num_coef_fx, shape3_den_coef_fx, ptr_fx, filtRes_fx, hSC_VBR->shape3_filt_mem_fx, 10, 10, L_FRAME, 1 ); /*1 = (16-qformat of shape1 cofficient) */ - - BREAK; - } - - qE2 = qGain; - move16(); - - E2_fx = L_deposit_l( 0 ); - FOR( i = 0; i < L_FRAME; i++ ) - { - Ltemp = L_mult0( ptr_fx[i], ptr_fx[i] ); /*Q(2*qE2+1) */ - Ltemp = L_shr_r( Ltemp, 4 ); - E2_fx = L_add( E2_fx, Ltemp ); - } - qE2 = sub( shl( qE2, 1 ), 4 ); - - test(); - IF( E3_fx == 0 ) - { - R_fx = 0; - move16(); - } - ELSE IF( ( E2_fx == 0 ) && ( E3_fx != 0 ) ) - { - exp1 = norm_l( E3_fx ); - tmp1 = extract_h( L_shl( E3_fx, exp1 ) ); /*qE3+exp1-16 */ - tmp1 = div_s( 16384, tmp1 ); /*14-(qE3+exp1-16)-> 30-qE3-exp1 */ - exp1 = sub( exp1, 30 - qE3 ); - - L_tmp = L_deposit_h( tmp1 ); - L_tmp = Isqrt_lc( L_tmp, &exp1 ); - Ltemp = L_shl( L_tmp, sub( exp1, 12 ) ); - R_fx = round_fx( Ltemp ); - } - ELSE - { - exp1 = norm_l( E3_fx ); - tmp1 = extract_h( L_shl( E3_fx, exp1 ) ); /*qE3+exp1-16 */ - tmp1 = div_s( 16384, tmp1 ); /*14-(qE3+exp1-16)-> 30-qE3-exp1 */ - L_tmp = Mult_32_16( E2_fx, tmp1 ); /*qE2+30-qE3-exp1-15=>15+qE2-qE3-exp1 */ - - exp2 = norm_l( L_tmp ); - L_tmp = L_shl( L_tmp, exp2 ); /*15+qE2-qE3-exp1+exp2 */ - exp2 = sub( 30, add( sub( sub( add( 15, qE2 ), qE3 ), exp1 ), exp2 ) ); - L_tmp = Isqrt_lc( L_tmp, &exp2 ); /*Q(31+exp2) */ - R_fx = round_fx( L_tmp ); - exp1 = sub( sub( sub( 31, exp2 ), 16 ), 7 ); - } - - FOR( i = 0; i < L_FRAME; i++ ) - { - L_tmp = L_mult0( R_fx, ptr_fx[i] ); - L_tmp = L_shr_r( L_tmp, exp1 + 1 ); - ptr_fx[i] = round_fx( L_shl( L_tmp, 16 ) ); - move16(); - } - *qIn1 = sub( qGain, 1 ); - move16(); - } - - IF( EQ_16( rf_flag, 1 ) ) - { - hRF->rf_indx_nelp_fid[0] = fid; - move16(); - } - ELSE - { - push_indice( hBstr, IND_NELP_FID, fid, 2 ); - } - } - - hSC_VBR->qprevGain_fx = qGain; - move16(); - - IF( rf_flag == 0 ) - { - FOR( i = 0; i < L_FRAME; i++ ) - { - exc_fx[i] = ptr_fx[i]; - move16(); - } - } - - return; -} -#endif diff --git a/lib_enc/pit_enc_fx.c b/lib_enc/pit_enc_fx.c index 5c9a5bdcddce50b07dda40d5f68f08958c662b12..1fff579055698c31cf92d70aabf0511db6b6e993 100644 --- a/lib_enc/pit_enc_fx.c +++ b/lib_enc/pit_enc_fx.c @@ -762,9 +762,7 @@ Word16 pitch_fr4_fx( Word16 corr_v[15 + 2 * L_INTERPOL1 + 1]; /* Total length = t0_max-t0_min+1+2*L_inter */ Word16 pit_min; Word16 cor_max; -#ifdef FIX_2273_OOB_INDEXING_IN_PIT_FR4 Word16 corr_off; -#endif /* initialization */ IF( limit_flag == 0 ) @@ -809,25 +807,11 @@ Word16 pitch_fr4_fx( t_min = sub( t0_min, L_INTERPOL1 ); t_max = add( t0_max, L_INTERPOL1 ); -#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4 - corr = &corr_v[-t_min]; -#else corr = corr_v; corr_off = -t_min; move16(); -#endif /* corr[t_min..t_max] */ -#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4 - if ( element_mode > EVS_MONO ) - { - norm_corr_ivas_fx( exc, xn, h, t_min, t_max, corr, L_subfr, Q_new ); - } - else - { - norm_corr_fx( exc, xn, h, t_min, t_max, corr, L_subfr ); - } -#else if ( element_mode > EVS_MONO ) { norm_corr_ivas_fx( exc, xn, h, t_min, t_max, corr + corr_off, L_subfr, Q_new ); @@ -836,37 +820,24 @@ Word16 pitch_fr4_fx( { norm_corr_fx( exc, xn, h, t_min, t_max, corr + corr_off, L_subfr ); } -#endif /*-----------------------------------------------------------------* * Find integer pitch *-----------------------------------------------------------------*/ -#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4 - max_val = corr[t0_min]; -#else max_val = corr[t0_min + corr_off]; -#endif move16(); t0 = t0_min; move16(); FOR( i = t0_min + 1; i <= t0_max; i++ ) { -#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4 - if ( GE_16( corr[i], max_val ) ) -#else if ( GE_16( corr[i + corr_off], max_val ) ) -#endif { t0 = i; move16(); } -#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4 - max_val = s_max( corr[i], max_val ); -#else max_val = s_max( corr[i + corr_off], max_val ); -#endif } IF( EQ_16( t0_fr1, pit_min ) ) @@ -880,11 +851,7 @@ Word16 pitch_fr4_fx( { i = sub( i, 2 ); } -#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4 - IF( GT_16( corr[i], corr[i + 2] ) ) -#else IF( GT_16( corr[i + corr_off], corr[i + 2 + corr_off] ) ) -#endif { t0 = i; move16(); @@ -935,27 +902,15 @@ Word16 pitch_fr4_fx( { fraction = 0; move16(); -#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4 - cor_max = Interpol_4( &corr[t0], fraction ); -#else cor_max = Interpol_4( &corr[t0 + corr_off], fraction ); -#endif } ELSE { t0 = sub( t0, 1 ); -#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4 - cor_max = Interpol_4( &corr[t0], fraction ); -#else cor_max = Interpol_4( &corr[t0 + corr_off], fraction ); -#endif FOR( i = fraction + step; i <= 3; i = ( i + step ) ) { -#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4 - temp = Interpol_4( &corr[t0], i ); -#else temp = Interpol_4( &corr[t0 + corr_off], i ); -#endif IF( GT_16( temp, cor_max ) ) { cor_max = temp; @@ -968,11 +923,7 @@ Word16 pitch_fr4_fx( FOR( i = 0; i <= 3; i = ( i + step ) ) { -#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4 - temp = Interpol_4( &corr[t1], i ); -#else temp = Interpol_4( &corr[t1 + corr_off], i ); -#endif IF( GT_16( temp, cor_max ) ) { cor_max = temp; diff --git a/lib_enc/pitch_ol2_fx.c b/lib_enc/pitch_ol2_fx.c index f50677cf064671664b99be73c19c425848552504..49566e31d08b26bf5ae71ffb331f8ac087f6bdc0 100644 --- a/lib_enc/pitch_ol2_fx.c +++ b/lib_enc/pitch_ol2_fx.c @@ -50,9 +50,7 @@ void pitch_ol2_fx( Word32 R1, R2; Word16 R0, exp_R0, exp_R1, exp_R2, j; Word16 pit_max; -#ifdef FIX_2271_OOB_INDEXING_IN_PIT_OL2 Word16 base_idx; -#endif /* initialization */ pit_max = PIT_MAX; move16(); @@ -106,14 +104,9 @@ void pitch_ol2_fx( * search the fractions around t0 and choose the one which maximizes * the interpolated normalized correlation. *----------------------------------------------------------------*/ -#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2 - pt_cor_fx = cor_fx + sub( L_INTERPOL1, t0_min ); -#endif t0s = t1s; move16(); -#ifdef FIX_2271_OOB_INDEXING_IN_PIT_OL2 base_idx = sub( L_INTERPOL1, t0_min ); -#endif step = 1; move16(); /* 1/4 subsample resolution */ @@ -123,18 +116,10 @@ void pitch_ol2_fx( IF( NE_16( t0s, t0_min ) ) /* Process negative fractions */ { t0s = sub( t0s, 1 ); -#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2 - cor_max_fx = Interpol_4( &pt_cor_fx[t0s], fraction ); -#else cor_max_fx = Interpol_4( &cor_fx[t0s + base_idx], fraction ); -#endif FOR( i = fraction + step; i <= 3; i += step ) { -#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2 - temp_fx = Interpol_4( &pt_cor_fx[t0s], i ); -#else temp_fx = Interpol_4( &cor_fx[t0s + base_idx], i ); -#endif if ( GT_16( temp_fx, cor_max_fx ) ) { fraction = i; @@ -147,20 +132,12 @@ void pitch_ol2_fx( { fraction = 0; move16(); -#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2 - cor_max_fx = Interpol_4( &pt_cor_fx[t0s], fraction ); -#else cor_max_fx = Interpol_4( &cor_fx[t0s + base_idx], fraction ); -#endif move16(); } FOR( i = 0; i <= 3; i += step ) /* Process positive fractions */ { -#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2 - temp_fx = Interpol_4( &pt_cor_fx[t1s], i ); -#else temp_fx = Interpol_4( &cor_fx[t1s + base_idx], i ); -#endif IF( GT_16( temp_fx, cor_max_fx ) ) { cor_max_fx = temp_fx; diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 06630ab571acc7531eb97d36008b121e4c445239..f760723bed2113c19f66e828e75e19d6c4aefe21 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -1874,46 +1874,7 @@ void encod_nelp_fx( Word16 Q_new, Word16 shift ); -#ifndef CLEANUP_VBR_CAM_ENC -void encod_nelp_ivas_fx( - Encoder_State *st_fx, /* i/o: state structure */ - const Word16 *speech_fx, /* i : input speech Q_new-1 */ - const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes exp(norm_s(Aw_fx[0])+1)*/ - const Word16 Aq_fx[], /* i : 12k8 Lp coefficient exp(norm_s(Aw_fx[0])+1)*/ - Word16 *res_fx, /* o : residual signal Q_new */ - Word16 *synth_fx, /* o : core synthesis Q_new */ - Word16 *tmp_noise_fx, /* o : long-term noise energy Q8 */ - Word16 *exc_fx, /* i/o: current non-enhanced excitation Q_new */ - Word16 *exc2_fx, /* i/o: current enhanced excitation Q_new */ - Word16 *pitch_buf_fx, /* o : floating pitch values for each subframe Q6 */ - Word16 *voice_factors_fx, /* o : voicing factors Q15 */ - Word16 *bwe_exc_fx, /* o : excitation for SWB TBE Q_new */ - Word16 Q_new, - Word16 shift ); -#endif Word16 encod_tran_fx( -#ifndef CLEANUP_ACELP_ENC - Encoder_State *st_fx, /* i/o: state structure */ - const Word16 speech_fx[], /* i : input speech Q0*/ - const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes Q12*/ - const Word16 Aq_fx[], /* i : 12k8 Lp coefficient Q12*/ - const Word16 Es_pred_fx, /* i : predicted scaled innov. energy Q8*/ - const Word16 *res_fx, /* i : residual signal Q_new*/ - Word16 *syn_fx, /* i/o: core synthesis Q_new*/ - Word16 *exc_fx, /* i/o: current non-enhanced excitation Q0*/ - Word16 *exc2_fx, /* i/o: current enhanced excitation Q0*/ - Word16 *pitch_buf_fx, /* i/o: floating pitch values for each subframe Q6*/ - Word16 *voice_factors, /* o : voicing factors Q15*/ - Word16 *bwe_exc_fx, /* i/o: excitation for SWB TBE Q0*/ - Word16 tc_subfr, /* i/o: TC subframe classification Q0*/ - Word16 position, /* i : maximum of residual signal index Q0*/ - Word16 *unbits, /* i/o: number of unused bits Q0*/ - const Word16 shift, /* i : Scaling to get 12 bits */ - const Word16 Q_new /* i : Input scaling */ -); - -Word16 encod_tran_ivas_fx( -#endif Encoder_State *st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : input speech Q0*/ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes Q12*/ @@ -2026,24 +1987,6 @@ void encod_unvoiced_fx( const Word16 shift /* i : Shift needed to obtain 12 bits vectors */ ); -#ifndef CLEANUP_ACELP_ENC -void encod_unvoiced_ivas_fx( - Encoder_State *st_fx, /* i/o: state structure */ - const Word16 *speech_fx, /* i : Input speech Q_new*/ - const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes Q12*/ - const Word16 *Aq_fx, /* i : 12k8 Lp coefficient Q12*/ - const Word16 Es_pred, /* i : predicted scaled innov. energy Q8*/ - const Word16 uc_two_stage_flag, /* i : flag indicating two-stage UC Q0*/ - const Word16 *res_fx, /* i : residual signal Q_new*/ - Word16 *syn_fx, /* o : core synthesis Q_new - 1*/ - Word16 *tmp_noise_fx, /* o : long-term noise energy Q0*/ - Word16 *exc_fx, /* i/o: current non-enhanced excitation Q_new*/ - Word16 *pitch_buf_fx, /* o : floating pitch values for each subframe Q6*/ - Word16 *voice_factors_fx, /* o : voicing factors Q15*/ - Word16 *bwe_exc_fx, /* i/o: excitation for SWB TBE Q_exc*/ - const Word16 Q_new, - const Word16 shift ); -#endif void enc_acelp_tcx_main_fx( const Word16 new_samples[], /* i : new samples Q15*/ Encoder_State *st, /* i/o: encoder state structure */ @@ -2073,44 +2016,7 @@ ivas_error encod_ppp_fx( const Word16 shift /* i : Shift needed to obtain 12 bits vectors */ ); -#ifndef CLEANUP_VBR_CAM_ENC -ivas_error encod_ppp_ivas_fx( - Encoder_State *st_fx, /* i/o: state structure */ - const Word16 speech_fx[], /* i : input speech Q_new*/ - const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes Q12*/ - const Word16 Aq_fx[], /* i : 12k8 Lp coefficient Q12*/ - Word16 *res_fx, /* i : residual signal Q_new*/ - Word16 *synth_fx, /* o : core synthesis Q-1*/ - Word16 *exc_fx, /* i/o: current non-enhanced excitation Q_new*/ - Word16 *exc2_fx, /* o : current enhanced excitation Q0*/ - Word16 *pitch_buf_fx, /* o : floating pitch values for each subframe Q6*/ - Word16 *voice_factors, /* o : voicing factors Q15*/ - Word16 *bwe_exc, /* o : excitation for SWB TBE Q_new*/ - Word16 Q_new, - Word16 shift ); -#endif void encod_gen_voic_fx( -#ifndef CLEANUP_ACELP_ENC - Encoder_State *st_fx, /* i/o: state structure */ - const Word16 speech_fx[], /* i : i speech Q0*/ - const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes Q12*/ - const Word16 Aq_fx[], /* i : 12k8 Lp coefficient Q12*/ - const Word16 Es_pred_fx, /* i : predicted scaled innov. energy Q8*/ - const Word16 *res_fx, /* i : residual signal Q_new*/ - Word16 *syn_fx, /* i/o: core synthesis Q_new*/ - Word16 *exc_fx, /* i/o: current non-enhanced excitation Q0*/ - Word16 *exc2_fx, /* i/o: current enhanced excitation Q0*/ - Word16 *pitch_buf_fx, /* i/o: floating pitch values for each subframe Q6*/ - Word16 *voice_factors_fx, /* o : voicing factors Q15*/ - Word16 *bwe_exc_fx, /* o : excitation for SWB TBE Q0*/ - Word16 *unbits_fx, /* i/o: number of unused bits Q0*/ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag Q0*/ - const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer Q6*/ - Word16 shift, - Word16 Q_new ); - -void encod_gen_voic_ivas_fx( -#endif Encoder_State *st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : input speech Q0*/ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes Q12*/ @@ -2150,26 +2056,6 @@ void encod_audio_fx( const Word16 shift /* i : Shift needed to obtain 12 bits vectors */ ); -#ifndef CLEANUP_ACELP_ENC -void encod_audio_ivas_fx( - Encoder_State *st_fx, /* i/o: State structure */ - const Word16 speech[], /* i : input speech Q_new */ - const Word16 Aw[], /* i : weighted A(z) unquantized for subframes */ - const Word16 Aq[], /* i : 12k8 Lp coefficient */ - const Word16 *res, /* i : residual signal Q_new */ - Word16 *synth, /* i/o: core synthesis Q-1 */ - Word16 *exc, /* i/o: current non-enhanced excitation Q_new */ - Word16 *pitch_buf, /* i/o: floating pitch values for each subframe Q6 */ - Word16 *voice_factors, /* o : voicing factors Q15 */ - Word16 *bwe_exc, /* o : excitation for SWB TBE Q0 */ - const Word16 attack_flag, /* i : Flag that point to an attack coded with AC mode (GSC)*/ - Word16 *lsf_new, /* i : current frame ISF vector */ - Word16 *tmp_noise, /* o : noise energy */ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ - const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer */ - Word16 Q_new, - Word16 shift ); -#endif void stat_noise_uv_enc_fx( Encoder_State *st_fx, /* i/o: state structure */ const Word32 *LepsP, /* i : LP prediction errors */ @@ -3538,33 +3424,6 @@ Word16 lp_filt_exc_enc_fx( ); Word16 inov_encode_fx( -#ifndef CLEANUP_ACELP_ENC - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word32 core_brate, /* i : core bitrate */ - const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - const Word16 L_frame, /* i : length of the frame */ - const Word16 last_L_frame, /* i : length of the last frame */ - const Word16 coder_type, /* i : coding type */ - const Word16 bwidth, /* i : i signal bandwidth */ - const Word16 sharpFlag, /* i : formant sharpening flag */ - const Word16 i_subfr, /* i : subframe index */ - const Word16 tc_subfr, /* i : TC subframe index */ - const Word16 *p_Aq, /* i : LP filter coefficients Q12*/ - const Word16 gain_pit, /* i : adaptive excitation gain Q14*/ - Word16 *cn, /* i/o: target vector in residual domain Q_new*/ - const Word16 *exc, /* i : pointer to excitation signal frame Q_new*/ - Word16 *h2, /* i/o: weighted filter i response Q12*/ - const Word16 tilt_code, /* i : tilt of the excitation of previous subframe Q15*/ - const Word16 pt_pitch, /* i : pointer to current subframe fractional pitch Q6*/ - const Word16 *xn2, /* i : target vector for innovation search Q_new-1+shift*/ - Word16 *code, /* o : algebraic excitation Q9*/ - Word16 *y2, /* o : zero-memory filtered algebraic excitation Q9*/ - Word16 *unbits, /* o : number of unused bits for PI */ - const Word16 L_subfr, /* i : subframe length */ - Word16 shift ); - -Word16 inov_encode_fx( -#endif Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 core_brate, /* i : core bitrate */ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ @@ -3674,15 +3533,6 @@ void acelp_core_switch_enc_fx( const Word16 shift, const Word16 Q_new ); -#ifndef CLEANUP_ACELP_ENC -void acelp_core_switch_enc_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 inp12k8[], /* i : i signal @12.8 kHz Q0 */ - const Word16 inp16k[], /* i : i signal @16 kHz Q0 */ - const Word16 A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12 */ - Word16 shift, - Word16 Q_new ); -#endif void gain_enc_amr_wb_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 *xn, /* i : target vector Q_xn*/ @@ -3742,32 +3592,6 @@ void transf_cdbk_enc_fx( const Word16 shift /* i : shifting applied to y1, xn,... */ ); -#ifndef CLEANUP_ACELP_ENC -void transf_cdbk_enc_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 harm_flag_acelp, /* i : harmonic flag for higher rates ACELP Q0*/ - const Word16 i_subfr, /* i : subframe index Q0*/ - Word16 cn[], /* i/o: target vector in residual domain Q_new*/ - Word16 exc[], /* i/o: pointer to excitation signal frame Q_new*/ - const Word16 *p_Aq, /* i : 12k8 Lp coefficient Q12*/ - const Word16 Ap[], /* i : weighted LP filter coefficients Q12*/ - const Word16 h1[], /* i : weighted filter input response Q15*/ - Word16 xn[], /* i/o: target vector Q_new + shift -1*/ - Word16 xn2[], /* i/o: target vector for innovation search Q_new + shift -1*/ - Word16 y1[], /* i/o: zero-memory filtered adaptive excitation Q_new + shift -1*/ - const Word16 y2[], /* i : zero-memory filtered innovative excitation Q9*/ - const Word16 Es_pred, /* i : predicited scaled innovation energy Q8*/ - Word16 *gain_pit, /* i/o: adaptive excitation gain Q14*/ - const Word32 gain_code, /* i : innovative excitation gain Q16*/ - Word16 g_corr[], /* o : ACELP correlation values Q15*/ - const Word16 clip_gain, /* i : adaptive gain clipping flag Q0*/ - Word16 *gain_preQ, /* o : prequantizer excitation gain Q2*/ - Word16 code_preQ[], /* o : prequantizer excitation Q_AVQ_OUT_DEC*/ - Word16 *unbits, /* o : number of AVQ unused bits Q0*/ - const Word16 Q_new, /* i : Current frame scaling */ - const Word16 shift /* i : shifting applied to y1, xn,... */ -); -#endif void gain_enc_lbr_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 gains_mode[], /* i : gain bits Q0*/ @@ -3877,33 +3701,6 @@ void transition_enc_fx( Word16 shift /* i : downscaling needs for 12 bits convolutions */ ); -#ifndef CLEANUP_ACELP_ENC -void transition_enc_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 i_subfr, /* i : subframe index */ - Word16 *tc_subfr, /* i/o: TC subframe index */ - Word16 *Jopt_flag, /* i : joint optimization flag */ - Word16 *position, /* i/o: maximum of residual signal index */ - Word16 *T0, /* i/o: close loop integer pitch Q0*/ - Word16 *T0_frac, /* i/o: close loop fractional part of the pitch Q0*/ - Word16 *T0_min, /* i/o: lower limit for close-loop search Q0*/ - Word16 *T0_max, /* i/o: higher limit for close-loop search Q0*/ - Word16 *exc_fx, /* i/o: pointer to excitation signal frame Q_new*/ - Word16 *y1_fx, /* o : zero-memory filtered adaptive excitation Q_new-1+shift*/ - const Word16 *h1_fx, /* i : weighted filter input response Q(14+shift)*/ - const Word16 *xn_fx, /* i : target vector Q_new-1+shift*/ - Word16 *xn2_fx, /* o : target vector for innovation search Q_new-1+shift*/ - Word16 *gp_cl_fx, /* i/o: memory of gain of pitch clipping algorithm */ - Word16 *gain_pit_fx, /* o : adaptive excitation gain Q14*/ - Word16 *g_corr_fx, /* o : ACELP correlation values */ - Word16 *clip_gain, /* i/o: adaptive gain clipping flag */ - Word16 **pt_pitch_fx, /* o : floating pitch values */ - Word16 *bwe_exc_fx, /* o : excitation for SWB TBE Q_new*/ - Word16 *unbits_ACELP, /* i/o: unused bits */ - Word16 Q_new, /* i : Current scaling */ - Word16 shift /* i : downscaling needs for 12 bits convolutions */ -); -#endif void gain_enc_tc_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 gains_mode[], /* i : gain bits Q0*/ diff --git a/lib_enc/swb_pre_proc_fx.c b/lib_enc/swb_pre_proc_fx.c index ffdb1d454df4797d99cf2995e24cfa0ad814d1bd..04d546ffa2e0992aa69bdf54afcf36864443d8a5 100644 --- a/lib_enc/swb_pre_proc_fx.c +++ b/lib_enc/swb_pre_proc_fx.c @@ -1125,9 +1125,7 @@ void swb_pre_proc_ivas_fx( CldfbHB_fx = EPSILON_FX; move32(); } -#ifdef FIX_2264_OUT_OF_BOUND_READING_IN_LOG2_NORM_LC exp = norm_l( CldfbHB_fx ); -#endif CldfbHB_fx = L_shl( CldfbHB_fx, exp ); /* CldfbHB_ener = CldfbHB_fl*2^(exp) */ Cldfbtemp1 = Log2_norm_lc( CldfbHB_fx ); /* Log2_norm_lc(t) = 2^15*(log2(t/2^30)) */ Cldfbtemp1 = sub( shr( Cldfbtemp1, 6 ), shl( add( sub( Q31 - Q30, CldfbHB_fx_e ), exp ), 9 ) ); diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index 6df7696bf172352d36d0903fb4ffa78635774d64..ebe37fae5846d8b972e2a1c2f19167d3482d4abd 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -3986,11 +3986,7 @@ void swb_tbe_enc_ivas_fx( FOR( i = 0; i < NUM_SHB_SUBGAINS; i++ ) { // GainShape[i] = ( 1 - feedback ) * GainShape[i] + feedback * GainShape_Interp[i]; -#ifdef FIX_2254_IMPROV_COMPLEXITY_BE GainShape_fx[i] = extract_h( L_mac( L_mult( sub( MAX16B, feedback ), GainShape_fx[i] ), feedback, GainShape_Interp_fx[i] ) ); -#else - GainShape_fx[i] = extract_h( L_add( L_mult( sub( MAX16B, feedback ), GainShape_fx[i] ), L_mult( feedback, GainShape_Interp_fx[i] ) ) ); -#endif move16(); } } @@ -4104,11 +4100,7 @@ void swb_tbe_enc_ivas_fx( FOR( i = 0; i < NUM_SHB_SUBGAINS; i++ ) { // GainShape[i] = ( 1 - feedback ) * GainShape[i * NUM_SHB_SUBGAINS] + feedback * GainShape_Interp[i]; -#ifdef FIX_2254_IMPROV_COMPLEXITY_BE GainShape_fx[i] = extract_h( L_mac( L_mult( sub( MAX16B, feedback ), GainShape_fx[i * NUM_SHB_SUBGAINS] ), feedback, GainShape_Interp_fx[i] ) ); // Q15 -#else - GainShape_fx[i] = extract_h( L_add( L_mult( sub( MAX16B, feedback ), GainShape_fx[i * NUM_SHB_SUBGAINS] ), L_mult( feedback, GainShape_Interp_fx[i] ) ) ); // Q15 -#endif move16(); } diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index bd43b84f111089d2af92f0c02014ad2135f26247..7650516cb3898086ace272f3966f4e47db1a2d00 100644 --- a/lib_enc/tcx_ltp_enc_fx.c +++ b/lib_enc/tcx_ltp_enc_fx.c @@ -89,9 +89,7 @@ static void tcx_ltp_pitch_search( Word16 pitres ) { Word16 i, t, t0, t1, step, fraction, t0_min, t0_max, t_min, t_max, delta, temp_m, temp_e, s, s_wsp; -#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH Word16 cor_idx_ini, cor_idx; -#endif Word32 cor_max, cor[256], *pt_cor, temp; Word16 wsp2[L_FRAME_PLUS + PIT_MAX_MAX + L_INTERPOL1]; @@ -206,11 +204,7 @@ static void tcx_ltp_pitch_search( * the interpolated normalized correlation. *-----------------------------------------------------------------*/ -#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH cor_idx_ini = sub( L_INTERPOL1, t0_min ); -#else - pt_cor = cor + sub( L_INTERPOL1, t0_min ); -#endif t0 = t1; move16(); @@ -226,34 +220,20 @@ static void tcx_ltp_pitch_search( IF( EQ_16( t0, t0_min ) ) /* Limit case */ { -#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH cor_idx = add( cor_idx_ini, t0 ); -#endif fraction = 0; move16(); -#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH cor_max = interpolate_corr( &cor[cor_idx], fraction, pitres ); -#else - cor_max = interpolate_corr( &pt_cor[t0], fraction, pitres ); -#endif } ELSE /* Process negative fractions */ { t0 = sub( t0, 1 ); -#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH cor_idx = add( cor_idx_ini, t0 ); cor_max = interpolate_corr( &cor[cor_idx], fraction, pitres ); -#else - cor_max = interpolate_corr( &pt_cor[t0], fraction, pitres ); -#endif FOR( i = fraction + step; i < pitres; i += step ) { -#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH temp = interpolate_corr( &cor[cor_idx], i, pitres ); -#else - temp = interpolate_corr( &pt_cor[t0], i, pitres ); -#endif IF( GT_32( temp, cor_max ) ) { @@ -264,16 +244,10 @@ static void tcx_ltp_pitch_search( } } -#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH cor_idx = add( cor_idx_ini, t1 ); -#endif FOR( i = 0; i < pitres; i += step ) /* Process positive fractions */ { -#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH temp = interpolate_corr( &cor[cor_idx], i, pitres ); -#else - temp = interpolate_corr( &pt_cor[t1], i, pitres ); -#endif IF( GT_32( temp, cor_max ) ) { @@ -321,9 +295,7 @@ static void tcx_ltp_pitch_search_ivas_fx( Word16 *border_case ) { Word16 i, t, t0, t1, step, fraction, t0_min, t0_max, t_min, t_max, delta, temp_m, temp_e, s, s_wsp; -#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH Word16 cor_idx_ini, cor_idx; -#endif Word32 cor_max, cor[256], *pt_cor, temp; Word16 wsp2[L_FRAME_PLUS + PIT_MAX_MAX + L_INTERPOL1]; @@ -449,12 +421,7 @@ static void tcx_ltp_pitch_search_ivas_fx( * search the fractions around t0 and choose the one which maximizes * the interpolated normalized correlation. *-----------------------------------------------------------------*/ -#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH cor_idx_ini = sub( L_INTERPOL1, t0_min ); -#else - - pt_cor = cor + sub( L_INTERPOL1, t0_min ); -#endif t0 = t1; move16(); @@ -470,34 +437,20 @@ static void tcx_ltp_pitch_search_ivas_fx( IF( EQ_16( t0, t0_min ) ) /* Limit case */ { -#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH cor_idx = add( cor_idx_ini, t0 ); -#endif fraction = 0; move16(); -#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH cor_max = interpolate_corr( &cor[cor_idx], fraction, pitres ); -#else - cor_max = interpolate_corr( &pt_cor[t0], fraction, pitres ); -#endif } ELSE /* Process negative fractions */ { t0 = sub( t0, 1 ); -#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH cor_idx = add( cor_idx_ini, t0 ); cor_max = interpolate_corr( &cor[cor_idx], fraction, pitres ); -#else - cor_max = interpolate_corr( &pt_cor[t0], fraction, pitres ); -#endif FOR( i = fraction + step; i < pitres; i += step ) { -#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH temp = interpolate_corr( &cor[cor_idx], i, pitres ); -#else - temp = interpolate_corr( &pt_cor[t0], i, pitres ); -#endif IF( GT_32( temp, cor_max ) ) { @@ -508,16 +461,10 @@ static void tcx_ltp_pitch_search_ivas_fx( } } -#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH cor_idx = add( cor_idx_ini, t1 ); -#endif FOR( i = 0; i < pitres; i += step ) /* Process positive fractions */ { -#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH temp = interpolate_corr( &cor[cor_idx], i, pitres ); -#else - temp = interpolate_corr( &pt_cor[t1], i, pitres ); -#endif IF( GT_32( temp, cor_max ) ) { diff --git a/lib_enc/transition_enc_fx.c b/lib_enc/transition_enc_fx.c index 5ec3fe6882057f2fa1598200f92f9095119bc0b6..00e047e16e6bfbc4f53e4b7b1fa9dc03710ef5e4 100644 --- a/lib_enc/transition_enc_fx.c +++ b/lib_enc/transition_enc_fx.c @@ -16,9 +16,6 @@ static void gain_trans_enc_fx( Word32 gain_trans32, Word16 exc[], Word16 *quant_index, Word16 *quant_sign, Word16 Q_new ); static void tc_enc_fx( Encoder_State *st_fx, const Word16 i_subfr, Word16 *tc_subfr, Word16 *position, const Word16 *h1_fx, const Word16 *xn_fx, Word16 *exc_fx, Word16 *yy1_fx, Word16 *T0_min, Word16 *T0_max, Word16 *T0, Word16 *T0_frac, Word16 *gain_pit_fx, Word16 g_corr_fx[], Word16 *bwe_exc_fx, Word16 Q_new ); -#ifndef CLEANUP_ACELP_ENC -static void tc_enc_ivas_fx( Encoder_State *st_fx, const Word16 i_subfr, Word16 *tc_subfr, Word16 *position, const Word16 *h1_fx, const Word16 *xn_fx, Word16 *exc_fx, Word16 *yy1_fx, Word16 *T0_min, Word16 *T0_max, Word16 *T0, Word16 *T0_frac, Word16 *gain_pit_fx, Word16 g_corr_fx[], Word16 *bwe_exc_fx, Word16 Q_new ); -#endif /*==========================================================================*/ @@ -165,7 +162,6 @@ void transition_enc_fx( move16(); *clip_gain = 0; move16(); -#ifdef CLEANUP_ACELP_ENC IF( NE_32( st_fx->element_mode, EVS_MONO ) ) { g_corr_fx[0] = MAX16B /* 1.0f in Q15 */; @@ -177,7 +173,6 @@ void transition_enc_fx( g_corr_fx[3] = 0; } ELSE -#endif { g_corr_fx[0] = 16384; move16(); @@ -413,13 +408,11 @@ void transition_enc_fx( push_indice( hBstr, IND_PITCH, index, nBits ); /* Find the adaptive codebook vector - ACELP long-term prediction */ -#ifdef CLEANUP_ACELP_ENC IF( NE_32( st_fx->element_mode, EVS_MONO ) ) { pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); } ELSE -#endif { pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); } @@ -470,13 +463,11 @@ void transition_enc_fx( push_indice( hBstr, IND_PITCH, index, nBits ); /* Find the adaptive codebook vector - ACELP long-term prediction */ -#ifdef CLEANUP_ACELP_ENC IF( NE_32( st_fx->element_mode, EVS_MONO ) ) { pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); } ELSE -#endif { pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); } @@ -543,13 +534,11 @@ void transition_enc_fx( push_indice( hBstr, IND_PITCH, index, nBits ); /* Find the adaptive codebook vector - ACELP long-term prediction */ -#ifdef CLEANUP_ACELP_ENC IF( NE_32( st_fx->element_mode, EVS_MONO ) ) { pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); } ELSE -#endif { pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); } @@ -577,13 +566,11 @@ void transition_enc_fx( push_indice( hBstr, IND_PITCH, index, nBits ); /* Find the adaptive codebook vector - ACELP long-term prediction */ -#ifdef CLEANUP_ACELP_ENC IF( NE_32( st_fx->element_mode, EVS_MONO ) ) { pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); } ELSE -#endif { pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); } @@ -623,13 +610,11 @@ void transition_enc_fx( pit_Q_enc_fx( hBstr, 0, nBits, 8, pit_flag, limit_flag, *T0, *T0_frac, T0_min, T0_max ); /* Find the adaptive codebook vector - ACELP long-term prediction */ -#ifdef CLEANUP_ACELP_ENC IF( NE_32( st_fx->element_mode, EVS_MONO ) ) { pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); } ELSE -#endif { pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); } @@ -868,7 +853,6 @@ void transition_enc_fx( move16(); *clip_gain = 0; move16(); -#ifdef CLEANUP_ACELP_ENC IF( NE_32( st_fx->element_mode, EVS_MONO ) ) { g_corr_fx[0] = 328 /* 0.01f in Q15 */; @@ -881,7 +865,6 @@ void transition_enc_fx( move16(); } ELSE -#endif { g_corr_fx[0] = 0; move16(); @@ -901,13 +884,11 @@ void transition_enc_fx( ELSE { /* Find the adaptive codebook vector - ACELP long-term prediction */ -#ifdef CLEANUP_ACELP_ENC IF( NE_32( st_fx->element_mode, EVS_MONO ) ) { pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); } ELSE -#endif { pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); } @@ -976,836 +957,6 @@ void transition_enc_fx( return; } -#ifndef CLEANUP_ACELP_ENC -void transition_enc_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 i_subfr, /* i : subframe index */ - Word16 *tc_subfr, /* i/o: TC subframe index */ - Word16 *Jopt_flag, /* i : joint optimization flag */ - Word16 *position, /* i/o: maximum of residual signal index */ - Word16 *T0, /* i/o: close loop integer pitch Q0*/ - Word16 *T0_frac, /* i/o: close loop fractional part of the pitch Q0*/ - Word16 *T0_min, /* i/o: lower limit for close-loop search Q0*/ - Word16 *T0_max, /* i/o: higher limit for close-loop search Q0*/ - Word16 *exc_fx, /* i/o: pointer to excitation signal frame Q_new*/ - Word16 *y1_fx, /* o : zero-memory filtered adaptive excitation Q_new-1+shift*/ - const Word16 *h1_fx, /* i : weighted filter input response Q(14+shift)*/ - const Word16 *xn_fx, /* i : target vector Q_new-1+shift*/ - Word16 *xn2_fx, /* o : target vector for innovation search Q_new-1+shift*/ - Word16 *gp_cl_fx, /* i/o: memory of gain of pitch clipping algorithm */ - Word16 *gain_pit_fx, /* o : adaptive excitation gain Q14*/ - Word16 *g_corr_fx, /* o : ACELP correlation values */ - Word16 *clip_gain, /* i/o: adaptive gain clipping flag */ - Word16 **pt_pitch_fx, /* o : floating pitch values */ - Word16 *bwe_exc_fx, /* o : excitation for SWB TBE Q_new*/ - Word16 *unbits_ACELP, /* i/o: unused bits */ - Word16 Q_new, /* i : Current scaling */ - Word16 shift /* i : downscaling needs for 12 bits convolutions */ -) -{ - Word16 pit_flag, pit_start, pit_limit, index, nBits; - Word16 tmp, tmp1, i; - Word32 offset; - Word16 shift_wsp; - Word16 limit_flag, mult_Top, lp_select, lp_flag; - Word16 T_op[2]; /* values for two half-frames */ - BSTR_ENC_HANDLE hBstr = st_fx->hBstr; - - /* set limit_flag to 0 for restrained limits, and 1 for extended limits */ - limit_flag = 0; - move16(); - pit_start = PIT_MIN; - move16(); - - /*----------------------------------------------------------------* - * convert pitch values to 16kHz domain - *----------------------------------------------------------------*/ - - IF( EQ_16( st_fx->L_frame, L_FRAME ) /*|| (tdm_Pri_pitch_buf != NULL && tdm_Pri_pitch_buf[0] < 0)*/ ) - { - Copy( st_fx->pitch, T_op, 2 ); - } - ELSE /* L_frame == L_FRAME16k */ - { - /*T_op[0] = (int16_t)(pitch[0] * 1.25f + 0.5f); - T_op[1] = (int16_t)(pitch[1] * 1.25f + 0.5f);*/ - T_op[0] = add( st_fx->pitch[0], mult_r( st_fx->pitch[0], 8192 /*0.25f Q15*/ ) ); - move16(); - T_op[1] = add( st_fx->pitch[1], mult_r( st_fx->pitch[1], 8192 /*0.25f Q15*/ ) ); - move16(); - } - shift_wsp = add( Q_new, shift ); - - lp_flag = st_fx->acelp_cfg.ltf_mode; - move16(); - - /*-----------------------------------------------------------------* - * TC: subrame determination for glottal shape search - * ------------------------------------------------------- - * tc_subfr == 0 - TC in 1st subframe - * tc_subfr == TC_0_0 - TC in 1st subframe + information about T0 - * tc_subfr == L_SUBFR - TC in 2nd subframe - * tc_subfr == 2*L_SUBFR - TC in 3rd subframe - * tc_subfr == 3*L_SUBFR - TC in 4th subframe - *-----------------------------------------------------------------*/ - - IF( i_subfr == 0 ) - { - mult_Top = 1; - move16(); - IF( limit_flag == 0 ) - { - test(); - IF( EQ_16( st_fx->L_frame, L_FRAME ) && LT_16( T_op[1], PIT_MIN ) ) - { - mult_Top = 2; - move16(); - } - test(); - if ( EQ_16( st_fx->L_frame, L_FRAME16k ) && LT_16( T_op[1], PIT16k_MIN ) ) - { - mult_Top = 2; - move16(); - } - } - - limit_T0_fx( st_fx->L_frame, 8, 0, limit_flag, mult_Top * T_op[1], 0, T0_min, T0_max ); - } - - /*-----------------------------------------------------------------* - * zero adaptive excitation signal construction - *-----------------------------------------------------------------*/ - - IF( GT_16( *tc_subfr, i_subfr ) ) - { - *gain_pit_fx = 0; - move16(); - *clip_gain = 0; - move16(); - g_corr_fx[0] = MAX16B /* 1.0f in Q15 */; - move16(); - g_corr_fx[1] = 0; - move16(); - g_corr_fx[2] = MAX16B /* 1.0f in Q15 */; - move16(); - g_corr_fx[3] = 0; - move16(); - - set16_fx( &exc_fx[i_subfr], 0, L_SUBFR ); /* set excitation for current subrame to 0 */ - - IF( EQ_16( st_fx->L_frame, L_FRAME ) ) - { - set16_fx( &bwe_exc_fx[i_subfr * HIBND_ACB_L_FAC], 0, (Word16) ( L_SUBFR * HIBND_ACB_L_FAC ) ); /* set past excitation buffer to 0 */ - } - ELSE - { - set16_fx( &bwe_exc_fx[i_subfr * 2], 0, L_SUBFR * 2 ); /* set past excitation buffer to 0 */ - } - - set16_fx( y1_fx, 0, L_SUBFR ); /* set filtered adaptive excitation to 0 */ - Copy( xn_fx, xn2_fx, L_SUBFR ); /* target vector for codebook search */ - *T0 = L_SUBFR; - move16(); - *T0_frac = 0; - move16(); - - **pt_pitch_fx = shl( add( shl( *T0, 2 ), *T0_frac ), 4 ); - move16(); /* save subframe pitch values Q6 */ - } - - /*-----------------------------------------------------------------* - * glottal codebook contribution construction - *-----------------------------------------------------------------*/ - - ELSE IF( EQ_16( *tc_subfr, i_subfr ) ) - { - IF( EQ_16( st_fx->L_frame, L_FRAME ) ) - { - set16_fx( bwe_exc_fx - PIT_MAX * HIBND_ACB_L_FAC, 0, PIT_MAX * HIBND_ACB_L_FAC ); /* set past excitation buffer to 0 */ - } - ELSE - { - set16_fx( bwe_exc_fx - PIT16k_MAX * 2, 0, PIT16k_MAX * 2 ); /* set past excitation buffer to 0 */ - } - - tc_enc_ivas_fx( st_fx, i_subfr, tc_subfr, position, h1_fx, xn_fx, exc_fx, - y1_fx, T0_min, T0_max, T0, T0_frac, gain_pit_fx, g_corr_fx, bwe_exc_fx, Q_new ); - - IF( EQ_16( *tc_subfr, TC_0_0 ) ) - { - /* this is called only to compute unused bits */ - config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, L_FRAME, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, TC_0_0, 3, NULL, unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); - } - - *clip_gain = gp_clip_fx( st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx, i_subfr, TRANSITION, xn_fx, gp_cl_fx, sub( shift_wsp, 1 ) ); - move16(); - updt_tar_fx( xn_fx, xn2_fx, y1_fx, *gain_pit_fx, L_SUBFR ); - - **pt_pitch_fx = shl( add( shl( *T0, 2 ), *T0_frac ), 4 ); - move16(); - *Jopt_flag = 1; - move16(); - } - - /*--------------------------------------------------------------* - * other subframes -> GENERIC encoding type, - * standard adaptive excitation contribution - * - exemption only in case when first glottal impulse is - * in the 1st subframe and the second one in 2nd subframe - * and later - *--------------------------------------------------------------*/ - - ELSE IF( LT_16( *tc_subfr, i_subfr ) ) - { - IF( EQ_16( st_fx->L_frame, L_FRAME ) ) - { - *Jopt_flag = 1; - move16(); - /* pit_flag for T0 bits number coding determination */ - test(); - IF( ( EQ_16( sub( i_subfr, *tc_subfr ), L_SUBFR ) ) || ( EQ_16( sub( i_subfr, *tc_subfr ), L_SUBFR - TC_0_0 ) ) ) - { - pit_flag = 0; - move16(); - } - ELSE - { - pit_flag = L_SUBFR; - move16(); - } - - IF( EQ_16( *tc_subfr, TC_0_0 ) ) - { - IF( EQ_16( i_subfr, L_SUBFR ) ) - { - limit_T0_fx( L_FRAME, 8, pit_flag, limit_flag, *T0, 0, T0_min, T0_max ); - } - pit_flag = 1; - move16(); - } - - /*----------------------------------------------------------* - * if tc_subfr==0, change tc_subfr corresponding to the - * second glot. impulse position - *----------------------------------------------------------*/ - - test(); - IF( ( *tc_subfr == 0 ) && ( EQ_16( i_subfr, L_SUBFR ) ) ) - { - IF( GT_16( PIT_MIN, ( *position ) ) ) - { - pit_start = sub( L_SUBFR, ( *position ) ); - } - ELSE - { - pit_start = PIT_MIN; - move16(); - } - pit_start = s_max( pit_start, PIT_MIN ); - - pit_limit = add( shl( pit_start, 1 ), *position ); - - /* Find the closed loop pitch period */ - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, pit_start, pit_limit, L_FRAME, L_SUBFR, 0 /*st_fx->element_mode*/, Q_new ); - move16(); - - offset = tbe_celp_exc_offset( *T0, *T0_frac, st_fx->L_frame ); - - FOR( i = 0; i < L_SUBFR * HIBND_ACB_L_FAC; i++ ) - { - bwe_exc_fx[i + i_subfr * HIBND_ACB_L_FAC] = bwe_exc_fx[i + i_subfr * HIBND_ACB_L_FAC - offset]; - move16(); - } - - test(); - IF( GT_16( ( *T0 ), sub( 2 * L_SUBFR, ( *position ) ) ) ) - { - IF( GE_16( add( ( *T0 ), ( *position ) ), 3 * L_SUBFR ) ) - { - /* second glottal impulse is in the 4th subframe */ - *tc_subfr = TC_0_192; - move16(); - } - ELSE - { - /* second glottal impulse is in the 3rd subframe */ - *tc_subfr = TC_0_128; - move16(); - } - } - ELSE IF( ( *tc_subfr == 0 ) && ( EQ_16( i_subfr, L_SUBFR ) ) ) - { - /* second glottal impulse is in the 2nd subframe */ - *tc_subfr = TC_0_64; - move16(); - } - } - - IF( LE_16( sub( i_subfr, *tc_subfr ), L_SUBFR ) ) - { - config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, *tc_subfr, 2, NULL, unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); - } - - /*-----------------------------------------------------------------* - * get number of bits for pitch encoding - *-----------------------------------------------------------------*/ - - nBits = st_fx->acelp_cfg.pitch_bits[shr( i_subfr, 6 )]; - move16(); - - /*-----------------------------------------------------------------* - * Find adaptive part of excitation, encode pitch period - *-----------------------------------------------------------------*/ - - test(); - test(); - test(); - test(); - test(); - test(); - /* first glottal impulse is in the 1st subrame */ - IF( ( EQ_16( i_subfr, L_SUBFR ) ) && ( GE_16( *tc_subfr, TC_0_128 ) ) ) - { - /*--------------------------------------------------------* - * second glottal impulse is in the 3rd or 4th subframe - * - build exc[] in 2nd subframe - *--------------------------------------------------------*/ - - *T0 = 2 * L_SUBFR; - move16(); - *T0_frac = 0; - move16(); - *Jopt_flag = 0; - move16(); - set16_fx( &exc_fx[i_subfr], 0, (Word16) ( L_SUBFR + 1 ) ); - set16_fx( &bwe_exc_fx[i_subfr * HIBND_ACB_L_FAC], 0, (Word16) ( L_SUBFR * HIBND_ACB_L_FAC ) ); - } - ELSE IF( ( EQ_16( i_subfr, L_SUBFR ) ) && ( EQ_16( *tc_subfr, TC_0_64 ) ) ) - { - /*--------------------------------------------------------* - * second glottal impulse is in the 2nd subframe, - * - build exc[] in 2nd subframe - *--------------------------------------------------------*/ - - IF( LT_16( add( *T0, *position ), L_SUBFR ) ) - { - /* impulse must be in the 2nd subframe (not in 1st) */ - *T0 = sub( L_SUBFR, ( *position ) ); - move16(); - *T0_frac = 0; - move16(); - } - IF( GE_16( add( *T0, *position ), 2 * L_SUBFR ) ) - { - /* impulse must be in the 2nd subframe (not in 3rd) */ - *T0 = sub( 2 * L_SUBFR - 1, ( *position ) ); - move16(); - *T0_frac = 2; - move16(); - } - - limit_T0_fx( L_FRAME, 8, pit_flag, limit_flag, *T0, 0, T0_min, T0_max ); /* find T0_min and T0_max for delta search */ - - /* 7bit ENCODER */ - /* index = (*T0-pit_start)*2 + *T0_frac/2;*/ - index = add( shl( sub( *T0, pit_start ), 1 ), shr( *T0_frac, 1 ) ); - push_indice( hBstr, IND_PITCH, index, nBits ); - - /* Find the adaptive codebook vector - ACELP long-term prediction */ - pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); - - - offset = tbe_celp_exc_offset( *T0, *T0_frac, st_fx->L_frame ); - - FOR( i = 0; i < L_SUBFR * HIBND_ACB_L_FAC; i++ ) - { - bwe_exc_fx[i + i_subfr * HIBND_ACB_L_FAC] = bwe_exc_fx[i + i_subfr * HIBND_ACB_L_FAC - offset]; - move16(); - } - } - ELSE IF( ( EQ_16( i_subfr, 2 * L_SUBFR ) ) && ( EQ_16( *tc_subfr, TC_0_128 ) ) ) - { - /*--------------------------------------------------------* - * second glottal impulse is in the 3rd subframe - * - build exc[] in 3rd subframe - *--------------------------------------------------------*/ - - pit_start = sub( 2 * L_SUBFR, ( *position ) ); - pit_flag = 0; - move16(); - - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, pit_start, 3 * L_SUBFR, L_FRAME, L_SUBFR, 0 /*st_fx->element_mode*/, Q_new ); - move16(); - - IF( LT_16( add( ( *T0 ), ( *position ) ), 2 * L_SUBFR ) ) - { - /* impulse must be in the 3rd subframe (not in 2nd) */ - *T0 = sub( 2 * L_SUBFR, ( *position ) ); - move16(); - *T0_frac = 0; - move16(); - } - - IF( GE_16( add( ( *T0 ), ( *position ) ), 3 * L_SUBFR ) ) - { - /* impulse must be in the 3rd subframe (not in 4th) */ - *T0 = sub( 3 * L_SUBFR - 1, ( *position ) ); - move16(); - *T0_frac = 2; - move16(); - } - - limit_T0_fx( L_FRAME, 8, pit_flag, limit_flag, *T0, 0, T0_min, T0_max ); /* find T0_min and T0_max for delta search */ - - index = add( shl( sub( *T0, pit_start ), 1 ), shr( *T0_frac, 1 ) ); - push_indice( hBstr, IND_PITCH, index, nBits ); - - /* Find the adaptive codebook vector - ACELP long-term prediction */ - pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); - - offset = tbe_celp_exc_offset( *T0, *T0_frac, st_fx->L_frame ); - - - FOR( i = 0; i < L_SUBFR * HIBND_ACB_L_FAC; i++ ) - { - bwe_exc_fx[i + i_subfr * HIBND_ACB_L_FAC] = bwe_exc_fx[i + i_subfr * HIBND_ACB_L_FAC - offset]; - move16(); - } - } - ELSE IF( ( EQ_16( i_subfr, 2 * L_SUBFR ) ) && ( EQ_16( *tc_subfr, TC_0_192 ) ) ) - { - /*--------------------------------------------------------* - * second glottal impulse is in the 4th subframe - * - build exc[] in 3rd subframe - *--------------------------------------------------------*/ - - *T0 = 4 * L_SUBFR; - move16(); - *T0_frac = 0; - move16(); - *Jopt_flag = 0; - move16(); - set16_fx( &exc_fx[i_subfr], 0, (Word16) ( L_SUBFR + 1 ) ); - set16_fx( &bwe_exc_fx[i_subfr * HIBND_ACB_L_FAC], 0, (Word16) ( L_SUBFR * HIBND_ACB_L_FAC ) ); - } - ELSE IF( ( EQ_16( i_subfr, 3 * L_SUBFR ) ) && ( EQ_16( *tc_subfr, TC_0_192 ) ) ) - { - /*--------------------------------------------------------* - * second glottal impulse is in the 4th subframe - * - build exc[] in 4th subframe - *--------------------------------------------------------*/ - - /* always T0_frac = 0 */ - pit_flag = 0; - move16(); - - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR, 0 /*st_fx->element_mode*/, Q_new ); - move16(); - - IF( LT_16( add( *T0, *position ), 3 * L_SUBFR ) ) - { - /* impulse must be in the 4th subframe (not in 3rd) */ - *T0 = sub( 3 * L_SUBFR, ( *position ) ); - move16(); - *T0_frac = 0; - move16(); - } - - pit_start = sub( 3 * L_SUBFR, ( *position ) ); - pit_limit = sub( 2 * L_FRAME - PIT_MAX - 2, shl( *position, 1 ) ); - - IF( LT_16( ( *T0 ), pit_limit ) ) - { - index = add( shl( sub( *T0, pit_start ), 1 ), shr( *T0_frac, 1 ) ); - } - ELSE - { - index = add( sub( *T0, pit_limit ), shl( sub( pit_limit, pit_start ), 1 ) ); - *T0_frac = 0; - move16(); - } - push_indice( hBstr, IND_PITCH, index, nBits ); - - /* Find the adaptive codebook vector - ACELP long-term prediction */ - pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); - - offset = tbe_celp_exc_offset( *T0, *T0_frac, st_fx->L_frame ); - - FOR( i = 0; i < L_SUBFR * HIBND_ACB_L_FAC; i++ ) - { - bwe_exc_fx[i + i_subfr * HIBND_ACB_L_FAC] = bwe_exc_fx[i + i_subfr * HIBND_ACB_L_FAC - offset]; - move16(); - } - } - ELSE IF( ( EQ_16( i_subfr, 3 * L_SUBFR ) ) && ( EQ_16( *tc_subfr, TC_0_128 ) ) ) - { - /*--------------------------------------------------------* - * second glottal impulse in the 3rd subframe - * build exc[] in 4th subframe - *--------------------------------------------------------*/ - - pit_flag = L_SUBFR; - move16(); - - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR, 0 /*st_fx->element_mode*/, Q_new ); - move16(); - index = delta_pit_enc_fx( 2, *T0, *T0_frac, *T0_min ); - push_indice( hBstr, IND_PITCH, index, nBits ); - - /* Find the adaptive codebook vector - ACELP long-term prediction */ - pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); - - offset = tbe_celp_exc_offset( *T0, *T0_frac, st_fx->L_frame ); - - FOR( i = 0; i < L_SUBFR * HIBND_ACB_L_FAC; i++ ) - { - bwe_exc_fx[i + i_subfr * HIBND_ACB_L_FAC] = bwe_exc_fx[i + i_subfr * HIBND_ACB_L_FAC - offset]; - move16(); - } - } - - /*------------------------------------------------------------* - * first glottal impulse is NOT in the 1st subframe, - * or two impulses are in the 1st subframe - *------------------------------------------------------------*/ - - ELSE - { - test(); - IF( EQ_16( nBits, 8 ) || EQ_16( nBits, 5 ) ) - { - test(); - IF( !( ( *tc_subfr == 0 ) && ( EQ_16( i_subfr, L_SUBFR ) ) ) ) - { - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR, 0 /*st_fx->element_mode*/, Q_new ); - move16(); - } - } - ELSE - { - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR, 0 /*st_fx->element_mode*/, Q_new ); - move16(); - } - pit_Q_enc_fx( hBstr, 0, nBits, 8, pit_flag, limit_flag, *T0, *T0_frac, T0_min, T0_max ); - /* Find the adaptive codebook vector - ACELP long-term prediction */ - pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); - - offset = tbe_celp_exc_offset( *T0, *T0_frac, st_fx->L_frame ); - - FOR( i = 0; i < L_SUBFR * HIBND_ACB_L_FAC; i++ ) - { - bwe_exc_fx[i + i_subfr * HIBND_ACB_L_FAC] = bwe_exc_fx[i + i_subfr * HIBND_ACB_L_FAC - offset]; - move16(); - } - } - - /*-----------------------------------------------------------------* - * - gain clipping test to avoid unstable synthesis - * - LP filtering of the adaptive excitation (if non-zero) - * - codebook target computation - *-----------------------------------------------------------------*/ - - IF( *Jopt_flag == 0 ) - { - /* adaptive/TC excitation is zero */ - Copy( xn_fx, xn2_fx, L_SUBFR ); - g_corr_fx[0] = 0; - move16(); - g_corr_fx[1] = 0; - move16(); - g_corr_fx[2] = 0; - move16(); - g_corr_fx[3] = 0; - move16(); - *clip_gain = 0; - move16(); - } - ELSE - { - *clip_gain = gp_clip_fx( st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx, i_subfr, TRANSITION, xn_fx, gp_cl_fx, ( Q_new + shift - 1 ) ); - move16(); - - lp_select = lp_filt_exc_enc_fx( MODE1, TRANSITION, i_subfr, exc_fx, h1_fx, - xn_fx, y1_fx, xn2_fx, L_SUBFR, st_fx->L_frame, g_corr_fx, *clip_gain, gain_pit_fx, &lp_flag ); - IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) - { - push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); - } - } - - **pt_pitch_fx = shl( add( shl( *T0, 2 ), *T0_frac ), 4 ); - move16(); - - /*---------------------------------------------------------------------* - * fill the pitch buffer - needed for post-processing - *---------------------------------------------------------------------*/ - - test(); - test(); - test(); - test(); - test(); - IF( ( *tc_subfr >= 2 * L_SUBFR ) && ( i_subfr == 3 * L_SUBFR ) ) - { - tmp = shl( add( shl( *T0, 2 ), *T0_frac ), 4 ); - ( *pt_pitch_fx ) -= 3; - move16(); - **pt_pitch_fx = tmp; - move16(); - ( *pt_pitch_fx )++; - move16(); - **pt_pitch_fx = tmp; - move16(); - ( *pt_pitch_fx )++; - move16(); - **pt_pitch_fx = tmp; - move16(); - ( *pt_pitch_fx )++; - move16(); - } - ELSE IF( ( *tc_subfr == L_SUBFR ) && ( i_subfr == 2 * L_SUBFR ) ) - { - tmp = shl( add( shl( *T0, 2 ), *T0_frac ), 4 ); - ( *pt_pitch_fx ) -= 2; - move16(); - **pt_pitch_fx = tmp; - move16(); - ( *pt_pitch_fx )++; - move16(); - **pt_pitch_fx = tmp; - move16(); - ( *pt_pitch_fx )++; - move16(); - } - ELSE IF( ( *tc_subfr == TC_0_64 ) && ( i_subfr == L_SUBFR ) ) - { - tmp = shl( add( shl( *T0, 2 ), *T0_frac ), 4 ); - ( *pt_pitch_fx ) -= 1; - move16(); - **pt_pitch_fx = tmp; - move16(); - ( *pt_pitch_fx )++; - move16(); - } - ELSE IF( ( *tc_subfr == TC_0_128 ) && ( i_subfr == 2 * L_SUBFR ) ) - { - tmp = shl( add( shl( *T0, 2 ), *T0_frac ), 4 ); - ( *pt_pitch_fx ) -= 2; - move16(); - **pt_pitch_fx = tmp; - move16(); - ( *pt_pitch_fx )++; - move16(); - **pt_pitch_fx = tmp; - move16(); - ( *pt_pitch_fx )++; - move16(); - } - ELSE IF( ( *tc_subfr == TC_0_192 ) && ( i_subfr == 3 * L_SUBFR ) ) - { - tmp = shl( add( shl( *T0, 2 ), *T0_frac ), 4 ); - ( *pt_pitch_fx ) -= 3; - move16(); - **pt_pitch_fx = tmp; - move16(); - ( *pt_pitch_fx )++; - move16(); - **pt_pitch_fx = tmp; - move16(); - ( *pt_pitch_fx )++; - move16(); - **pt_pitch_fx = tmp; - move16(); - ( *pt_pitch_fx )++; - move16(); - } - } - ELSE /* L_frame == L_FRAME16k */ - { - if ( GE_16( i_subfr, 2 * L_SUBFR ) ) - { - limit_flag = 1; - move16(); - } - IF( LE_16( i_subfr, 2 * L_SUBFR ) ) - { - IF( LT_16( i_subfr, 2 * L_SUBFR ) ) - { - mult_Top = 1; - move16(); - if ( LT_16( T_op[0], PIT16k_MIN ) ) - { - mult_Top = 2; - move16(); - } - - limit_T0_fx( L_FRAME16k, 8, 0, limit_flag, mult_Top * T_op[0], 0, T0_min, T0_max ); /* TC0 second subfr. */ - } - ELSE - { - limit_T0_fx( L_FRAME16k, 8, 0, limit_flag, T_op[1], 0, T0_min, T0_max ); /* TC0 third subfr., or TC64 third subfr. */ - } - } - - /*-----------------------------------------------------------------* - * get number of bits for pitch encoding - *-----------------------------------------------------------------*/ - - nBits = st_fx->acelp_cfg.pitch_bits[shr( i_subfr, 6 )]; - move16(); - - /*-----------------------------------------------------------------* - * Find adaptive part of excitation, encode pitch period - *-----------------------------------------------------------------*/ - - IF( EQ_16( nBits, 10 ) ) - { - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, 0, limit_flag, PIT16k_FR2_EXTEND_10b, PIT16k_MAX, st_fx->L_frame, L_SUBFR, 0 /*st_fx->element_mode*/, Q_new ); - move16(); - pit16k_Q_enc_fx( hBstr, nBits, limit_flag, *T0, *T0_frac, T0_min, T0_max ); - } - ELSE IF( EQ_16( nBits, 8 ) ) /* tc_subfr==0 && i_subfr==L_SUBFR */ - { - /*-----------------------------------------------------------------------------* - * The pitch range is encoded absolutely with 8 bits and is divided as follows: - * PIT16k_MIN to PIT16k_FR2_TC0_2SUBFR-1 resolution 1/4 (frac = 0,1,2 or 3) - * PIT16k_FR2_TC0_2SUBFR to 2*L_SUBFR resolution 1/2 (frac = 0 or 2) - *-----------------------------------------------------------------------------*/ - - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, 0, limit_flag, PIT16k_FR2_TC0_2SUBFR, 2 * L_SUBFR, st_fx->L_frame, L_SUBFR, 0 /*st_fx->element_mode*/, Q_new ); - move16(); - - IF( GT_16( *T0_max, 2 * L_SUBFR ) ) - { - *T0 = 2 * L_SUBFR; - move16(); - *T0_frac = 0; - move16(); - } - - IF( LT_16( *T0, PIT16k_FR2_TC0_2SUBFR ) ) - { - /*index = (*T0)*4 + (*T0_frac) - (PIT16k_MIN*4);*/ - index = add( shl( *T0, 2 ), sub( *T0_frac, PIT16k_MIN * 4 ) ); - } - ELSE - { - /*index = (*T0)*2 + ((*T0_frac)>>1) - (PIT16k_FR2_TC0_2SUBFR*2) + ((PIT16k_FR2_TC0_2SUBFR-PIT16k_MIN)*4);*/ - index = add( sub( add( shl( *T0, 1 ), shr( *T0_frac, 1 ) ), ( PIT16k_FR2_TC0_2SUBFR * 2 ) ), ( PIT16k_FR2_TC0_2SUBFR - PIT16k_MIN ) * 4 ); - } - push_indice( hBstr, IND_PITCH, index, nBits ); - } - ELSE IF( EQ_16( nBits, 6 ) ) - { - /* delta search */ - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, L_SUBFR, limit_flag, PIT16k_FR2_EXTEND_9b, PIT16k_FR1_EXTEND_9b, st_fx->L_frame, L_SUBFR, 0 /*st_fx->element_mode*/, Q_new ); - move16(); - - index = delta_pit_enc_fx( 4, *T0, *T0_frac, *T0_min ); - push_indice( hBstr, IND_PITCH, index, nBits ); - } - - IF( EQ_16( nBits, 6 ) ) - { - limit_T0_fx( L_FRAME16k, 8, L_SUBFR, limit_flag, *T0, *T0_frac, T0_min, T0_max ); - } - - /*-----------------------------------------------------------------* - * - gain clipping test to avoid unstable synthesis - * - LP filtering of the adaptive excitation - * - codebook target computation - *-----------------------------------------------------------------*/ - test(); - IF( ( EQ_16( i_subfr, L_SUBFR ) ) && ( EQ_16( *T0, 2 * L_SUBFR ) ) ) - { - *gain_pit_fx = 0; - move16(); - *clip_gain = 0; - move16(); - g_corr_fx[0] = 328 /* 0.01f in Q15 */; - move16(); - g_corr_fx[1] = 0; - move16(); - g_corr_fx[2] = 328 /* 0.01f in Q15 */; - move16(); - g_corr_fx[3] = 0; - move16(); - *Jopt_flag = 0; - move16(); - - set16_fx( &exc_fx[i_subfr], 0, L_SUBFR + 1 ); /* set excitation for current subrame to 0 */ - push_indice( hBstr, IND_LP_FILT_SELECT, 0, 1 ); /* this bit is actually not needed */ - - Copy( xn_fx, xn2_fx, L_SUBFR ); /* target vector for codebook search */ - set16_fx( y1_fx, 0, L_SUBFR ); /* set filtered adaptive excitation to 0 */ - set16_fx( &bwe_exc_fx[i_subfr * 2], 0, L_SUBFR * 2 ); - } - ELSE - { - /* Find the adaptive codebook vector - ACELP long-term prediction */ - pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); - offset = L_deposit_l( 0 ); - - tmp = extract_l( L_mult( *T0_frac, 32 ) ); /*Q8, 0.25 in Q7*/ - tmp = add( 512, tmp ); /*Q8; 2 in Q8*/ - tmp = mult_r( tmp, 256 ); /*Q16->Q0; 2 in Q7*/ - - tmp1 = sub( *T0, 2 ); /*Q0*/ - tmp1 = shl( tmp1, 1 ); /*Q0 */ - - offset = add( tmp, tmp1 ); /*Q0*/ - FOR( i = 0; i < L_SUBFR * 2; i++ ) - { - /* bwe_exc_fx[i + i_subfr * 2] = bwe_exc_fx[i + i_subfr * 2 - *T0 * 2 - (int) ((float) *T0_frac * 0.5f + 4 + 0.5f) + 4];move16();*/ - bwe_exc_fx[i + i_subfr * 2] = bwe_exc_fx[i + i_subfr * 2 - offset + 4]; - move16(); - } - - *clip_gain = gp_clip_fx( st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx, i_subfr, TRANSITION, xn_fx, gp_cl_fx, Q_new ); - move16(); - - lp_select = lp_filt_exc_enc_fx( MODE1, TRANSITION, i_subfr, exc_fx, h1_fx, - xn_fx, y1_fx, xn2_fx, L_SUBFR, st_fx->L_frame, g_corr_fx, *clip_gain, gain_pit_fx, &lp_flag ); - IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) - { - push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); - } - - *Jopt_flag = 1; - move16(); - } - - /***pt_pitch = (float)(*T0) + (float)(*T0_frac)/4.0f;*/ /* save subframe pitch value */ - /***pt_pitch_fx = shl(add(*T0,shr(*T0_frac,2)),4); move16();*/ - tmp = shl( add( shl( *T0, 2 ), *T0_frac ), 4 ); - **pt_pitch_fx = tmp; - move16(); - - /*---------------------------------------------------------------------* - * fill the pitch buffer - needed for post-processing - *---------------------------------------------------------------------*/ - test(); - test(); - IF( ( EQ_16( sub( i_subfr, *tc_subfr ), L_SUBFR ) ) || ( *tc_subfr == 0 && EQ_16( i_subfr, 2 * L_SUBFR ) ) ) - { - index = shr( i_subfr, 6 ); - ( *pt_pitch_fx ) -= index; - move16(); - - FOR( i = 0; i < index; i++ ) - { - **pt_pitch_fx = tmp; - move16(); - ( *pt_pitch_fx )++; - move16(); - } - } - } - } - - return; -} -#endif /*-------------------------------------------------------------------------------------------* * tc_enc() @@ -2047,228 +1198,6 @@ static void tc_enc_fx( return; } -#ifndef CLEANUP_ACELP_ENC -static void tc_enc_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 i_subfr, /* i : subrame index */ - Word16 *tc_subfr, /* i/o: TC subframe index */ - Word16 *position, /* i/o: index of the residual signal maximum */ - const Word16 *h1, /* i : weighted filter input response Q(14+shift)*/ - const Word16 *xn_fx, /* i : target signal Q_new-1+shift*/ - Word16 *exc_fx, /* o : glottal codebook contribution Q_new*/ - Word16 *yy1_fx, /* o : filtered glottal codebook contribution */ - Word16 *T0_min, /* o : lower pitch limit Q0*/ - Word16 *T0_max, /* o : higher pitch limit Q0*/ - Word16 *T0, /* o : close loop integer pitch Q0*/ - Word16 *T0_frac, /* o : close loop fractional part of the pitch Q0*/ - Word16 *gain_pit_fx, /* o : pitch gain (0..GAIN_PIT_MAX) Q14*/ - Word16 g_corr_fx[], /* o : correlations and -2 */ - Word16 *bwe_exc_fx, /* i/o: excitation for SWB TBE Q_new*/ - Word16 Q_new /* i : input scaling */ -) -{ - - Word16 h1_fx[L_SUBFR + ( M + 1 )]; - Word16 imp_shape, imp_pos, index, nBits; - Word16 pitch_index, pitch_sign_fx; - Word32 gain_trans32; - BSTR_ENC_HANDLE hBstr = st_fx->hBstr; - Flag Overflow = 0; - move32(); - imp_pos = sub( *position, i_subfr ); - /*-----------------------------------------------------------------* - * get number of bits for pitch encoding - *-----------------------------------------------------------------*/ - - nBits = st_fx->acelp_cfg.pitch_bits[shr( i_subfr, 6 )]; - move16(); - - /*--------------------------------------------------------------* - * Closed loop pitch search - *--------------------------------------------------------------*/ - - *T0_frac = 0; - move16(); - - IF( EQ_16( st_fx->L_frame, L_FRAME ) ) - { - test(); - IF( ( LE_16( *T0_min, L_SUBFR ) ) || ( EQ_16( *tc_subfr, 3 * L_SUBFR ) ) ) - { - IF( EQ_16( nBits, 9 ) ) - { - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1, *T0_min, *T0_max, T0_frac, 0, 0, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR, 0 /*st_fx->element_mode*/, Q_new ); - move16(); - } - ELSE IF( EQ_16( nBits, 6 ) ) - { - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1, *T0_min, *T0_max, T0_frac, 0, 0, PIT_MIN, L_SUBFR, L_FRAME, L_SUBFR, 0 /*st_fx->element_mode*/, Q_new ); - move16(); - } - ELSE - { - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1, *T0_min, *T0_max, T0_frac, 0, 0, PIT_MAX, PIT_MIN, L_FRAME, L_SUBFR, 0 /*st_fx->element_mode*/, Q_new ); - move16(); - } - } - ELSE - { - *T0 = L_SUBFR; - move16(); - } - - test(); - if ( EQ_16( *tc_subfr, L_SUBFR ) && LT_16( *T0, L_SUBFR ) ) - { - *T0 = L_SUBFR; - move16(); - } - } - ELSE /* st_fx->L_frame == L_FRAME16k */ - { - IF( EQ_16( nBits, 10 ) ) - { - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1, *T0_min, *T0_max, T0_frac, 0, 1, PIT16k_FR2_EXTEND_10b, PIT16k_MAX, L_FRAME16k, L_SUBFR, 0 /*st_fx->element_mode*/, Q_new ); - move16(); - } - ELSE IF( EQ_16( nBits, 6 ) ) - { - /* T0_frac with 1/2 sample resolution */ - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1, *T0_min, *T0_max, T0_frac, 0, 0, PIT16k_MIN, L_SUBFR, L_FRAME16k, L_SUBFR, 0 /*st_fx->element_mode*/, Q_new ); - move16(); - - IF( *T0 > L_SUBFR ) - { - *T0 = L_SUBFR; - move16(); - *T0_frac = 0; - move16(); - } - } - } - - /* set tc_subfr to TC_0_0 */ - test(); - test(); - test(); - if ( i_subfr == 0 && EQ_16( st_fx->L_frame, L_FRAME ) && ( LT_16( *T0, L_SUBFR ) || EQ_16( *tc_subfr, 3 * L_SUBFR ) ) ) - { - *tc_subfr = TC_0_0; - move16(); - } - - /*--------------------------------------------------------------* - * Builds glottal codebook contribution - *--------------------------------------------------------------*/ - - set_impulse_fx( xn_fx, h1, &exc_fx[i_subfr], yy1_fx, &imp_shape, &imp_pos, &gain_trans32, Q_new ); - - /*--------------------------------------------------------------* - * quantize gain_trans and scale glottal codebook contribution - *--------------------------------------------------------------*/ - - gain_trans_enc_fx( gain_trans32, &exc_fx[i_subfr], &pitch_index, &pitch_sign_fx, Q_new ); - - /* set past excitation buffer to zeros */ - set16_fx( exc_fx - L_EXC_MEM, 0, L_EXC_MEM ); - - /*--------------------------------------------------------------* - * adapt. search of the second impulse in the same subframe - * (when appears) - *--------------------------------------------------------------*/ - - pred_lt4_tc_fx( exc_fx, *T0, *T0_frac, inter4_2_fx, imp_pos, i_subfr ); - - IF( st_fx->hBWE_TD != NULL ) - { - IF( EQ_16( st_fx->L_frame, L_FRAME ) ) - { - interp_code_5over2_fx( &exc_fx[i_subfr], &bwe_exc_fx[i_subfr * HIBND_ACB_L_FAC], L_SUBFR ); - } - ELSE - { - interp_code_4over2_fx( &exc_fx[i_subfr], &bwe_exc_fx[i_subfr * 2], L_SUBFR ); - } - } - - /*--------------------------------------------------------------* - * compute glottal-shape codebook excitation - *--------------------------------------------------------------*/ - - Copy( h1, h1_fx, L_SUBFR + ( M + 1 ) ); - /* create filtered glottal codebook contribution */ - conv_fx( &exc_fx[i_subfr], h1_fx, yy1_fx, L_SUBFR ); - - /* gain_pit computation */ - *gain_pit_fx = corr_xy1_fx( xn_fx, yy1_fx, g_corr_fx, L_SUBFR, 0, &Overflow ); - move16(); - - /*--------------------------------------------------------------* - * Encode parameters and write indices - *--------------------------------------------------------------*/ - IF( EQ_16( st_fx->L_frame, L_FRAME ) ) - { - test(); - test(); - IF( ( ( i_subfr != 0 ) || ( EQ_16( *tc_subfr, TC_0_0 ) ) ) && ( NE_16( *tc_subfr, L_SUBFR ) ) ) - { - test(); - /* write pitch index */ - IF( ( GE_16( *T0, L_SUBFR ) ) && ( NE_16( *tc_subfr, 3 * L_SUBFR ) ) ) - { - push_indice( hBstr, IND_PITCH, 0, nBits ); - } - ELSE IF( EQ_16( *tc_subfr, 3 * L_SUBFR ) ) - { - IF( EQ_16( nBits, 9 ) ) - { - index = abs_pit_enc_fx( 4, 0, *T0, *T0_frac ); - } - ELSE - { - index = abs_pit_enc_fx( 2, 0, *T0, *T0_frac ); - } - push_indice( hBstr, IND_PITCH, index, nBits ); - - limit_T0_fx( L_FRAME, 8, 0, 0, *T0, 0, T0_min, T0_max ); - } - ELSE - { - IF( EQ_16( nBits, 6 ) ) - { - index = delta_pit_enc_fx( 2, *T0, *T0_frac, PIT_MIN - 1 ); - push_indice( hBstr, IND_PITCH, index, nBits ); - } - ELSE - { - index = delta_pit_enc_fx( 0, *T0, *T0_frac, PIT_MIN - 1 ); - push_indice( hBstr, IND_PITCH, index, nBits ); - } - } - } - } - ELSE /* st_fx->L_frame == L_FRAME16k */ - { - IF( EQ_16( nBits, 10 ) ) - { - pit16k_Q_enc_fx( hBstr, nBits, 1, *T0, *T0_frac, T0_min, T0_max ); - } - ELSE IF( EQ_16( nBits, 6 ) ) - { - index = add( shl( sub( *T0, PIT16k_MIN ), 1 ), shr( *T0_frac, 1 ) ); - push_indice( hBstr, IND_PITCH, index, nBits ); - } - } - push_indice( hBstr, IND_TC_IMP_SHAPE, imp_shape, 3 ); - push_indice( hBstr, IND_TC_IMP_POS, imp_pos, 6 ); - push_indice( hBstr, IND_TC_IMP_SIGN, pitch_sign_fx, 1 ); - push_indice( hBstr, IND_TC_IMP_GAIN, pitch_index, 3 ); - - *position = add( imp_pos, i_subfr ); - move16(); - return; -} -#endif /*-----------------------------------------------------------------* * gain_trans_enc() diff --git a/lib_rend/ivas_crend_fx.c b/lib_rend/ivas_crend_fx.c index 4d81175612993be06ff92591160d97c3aedb0e7a..2a4e2693737238584fb68e19f9c5cca366906241 100644 --- a/lib_rend/ivas_crend_fx.c +++ b/lib_rend/ivas_crend_fx.c @@ -1814,9 +1814,6 @@ void ivas_rend_closeCldfbRend( ivas_binRenderer_close_fx( &pCldfbRend->hCldfbRend ); -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA - ivas_binaural_hrtf_close_fx( &pCldfbRend->hHrtfFastConv ); -#endif ivas_HRTF_fastconv_binary_close_fx( &pCldfbRend->hHrtfFastConv ); return; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 815c01c7b4e9b36ba2ea3ee59477cc69dd707019..24eab4297409380eeccaae46dbec5a43b1df1646 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -117,17 +117,11 @@ static void ivas_masa_ext_rend_parambin_internal_fx( MASA_EXT_REND_HANDLE hMasaE static void formulate2x2MixingMatrix_fx( Word32 Ein1_fx /*q_Ein*/, Word32 Ein2_fx /*q_Ein*/, Word16 q_Ein, Word32 CinRe_fx /*q_Cin*/, Word32 CinIm_fx /*q_Cin*/, Word16 q_Cin, Word32 Eout1_fx /*q_Eout*/, Word32 Eout2_fx /*q_Eout*/, Word16 q_Eout, Word32 CoutRe_fx /*q_Cout*/, Word32 CoutIm_fx /*q_Cout*/, Word16 q_Cout, Word32 Q_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*Q31*/, Word32 Mre_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_M*/, Word32 Mim_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_M*/, Word16 *q_M, const Word16 regularizationFactor_fx /*Q14*/ ); -#ifdef OPT_2182_MATRIX_SCALE_OPS static void matrixScale_fx( Word32 Are_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_A*/, Word32 Aim_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_A*/, Word16 *q_A ); -#endif static void matrixMul_fx( Word32 Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_A*/, Word32 Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_A*/, Word16 *q_A, Word32 Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, Word32 Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, Word16 *q_B, Word32 outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, Word32 outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, Word16 *q_out ); -#ifdef OPT_2182_MATRIX_SCALE_OPS static void matrixTransp2Mul_fx( Word32 Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_A*/, Word32 Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_A*/, Word16 *q_A, Word32 Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, Word32 Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, Word16 *q_B, Word32 outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, Word32 outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, Word16 *q_out ); -#else -static void matrixTransp2Mul_fx( Word32 Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_A*/, Word32 Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_A*/, Word16 *q_A, Word32 Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, Word32 Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, Word16 *q_B, Word32 Ascale, Word32 Bscale, Word32 outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, Word32 outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, Word16 *q_out ); -#endif /*------------------------------------------------------------------------- @@ -2235,24 +2229,14 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( } /* Make matrix multiplication M*Cx*M' to determine resulting covariance matrix of processing input with M */ -#ifdef OPT_2182_MATRIX_SCALE_OPS matrixScale_fx( Mre_fx, Mim_fx, &q_M ); matrixScale_fx( CxRe_fx, CxIm_fx, &q_Cx ); -#endif matrixMul_fx( Mre_fx, Mim_fx, &q_M, CxRe_fx, CxIm_fx, &q_Cx, tmpMtxRe_fx, tmpMtxIm_fx, &q_tmp ); -#ifdef OPT_2182_MATRIX_SCALE_OPS matrixScale_fx( tmpMtxRe_fx, tmpMtxIm_fx, &q_tmp ); matrixTransp2Mul_fx( tmpMtxRe_fx, tmpMtxIm_fx, &q_tmp, Mre_fx, Mim_fx, &q_M, resultMtxRe_fx, resultMtxIm_fx, &q_res ); -#else - matrixTransp2Mul_fx( - tmpMtxRe_fx, tmpMtxIm_fx, &q_tmp, Mre_fx, Mim_fx, &q_M, - 1 /*int Ascale*/, - 0 /*int Bscale*/, - resultMtxRe_fx, resultMtxIm_fx, &q_res ); -#endif /* When below the frequency limit where decorrelation is applied, we inject the decorrelated * residual (or missing) signal component. The procedure is active when there are not enough independent @@ -2931,21 +2915,13 @@ static void ivas_dirac_dec_binaural_process_output_fx( { Word16 gain; /* Mixing using the formulated processing matrix M */ -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE gain = mac_r( L_mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxRePrev_fx[chA][chB][bin] ), interpVal_fx, hDiracDecBin->processMtxRe_fx[chA][chB][bin] ); // Q11 -#else - gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxRePrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxRe_fx[chA][chB][bin] ) ); // Q11 -#endif - outSlotRe_fx[bin] = Madd_32_16( outSlotRe_fx[bin], inRe_fx[chB][slot][bin], gain ); // q_inp_mix-4//q_result - outSlotIm_fx[bin] = Madd_32_16( outSlotIm_fx[bin], inIm_fx[chB][slot][bin], gain ); // q_inp_mix-4//q_result + outSlotRe_fx[bin] = Madd_32_16( outSlotRe_fx[bin], inRe_fx[chB][slot][bin], gain ); // q_inp_mix-4//q_result + outSlotIm_fx[bin] = Madd_32_16( outSlotIm_fx[bin], inIm_fx[chB][slot][bin], gain ); // q_inp_mix-4//q_result move32(); move32(); -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE gain = mac_r( L_mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxImPrev_fx[chA][chB][bin] ), interpVal_fx, hDiracDecBin->processMtxIm_fx[chA][chB][bin] ); // Q11 -#else - gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxImPrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxIm_fx[chA][chB][bin] ) ); // Q11 -#endif // interpVal * hDiracDecBin->processMtxIm[chA][chB][bin]; outSlotRe_fx[bin] = Msub_32_16( outSlotRe_fx[bin], inIm_fx[chB][slot][bin], gain ); // q_inp_mix-4//q_result outSlotIm_fx[bin] = Madd_32_16( outSlotIm_fx[bin], inRe_fx[chB][slot][bin], gain ); // q_inp_mix-4//q_result @@ -2956,11 +2932,7 @@ static void ivas_dirac_dec_binaural_process_output_fx( test(); IF( LT_16( bin, max_band_decorr ) && LT_16( chB, 2 ) ) { -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE gain = mac_r( L_mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecRePrev_fx[chA][chB][bin] ), interpVal_fx, hDiracDecBin->processMtxDecRe_fx[chA][chB][bin] ); // Q11 -#else - gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecRePrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxDecRe_fx[chA][chB][bin] ) ); // Q11 -#endif // interpVal * hDiracDecBin->processMtxDecRe[chA][chB][bin]; outSlotRe_fx[bin] = Madd_32_16( outSlotRe_fx[bin], decSlotRePointer_fx[bin], gain ); // q_inp_mix-4//q_result @@ -2968,13 +2940,9 @@ static void ivas_dirac_dec_binaural_process_output_fx( move32(); move32(); -#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE gain = mac_r( L_mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecImPrev_fx[chA][chB][bin] ), interpVal_fx, hDiracDecBin->processMtxDecIm_fx[chA][chB][bin] ); // Q11 -#else - gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecImPrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxDecIm_fx[chA][chB][bin] ) ); // Q11 -#endif - outSlotRe_fx[bin] = Msub_32_16( outSlotRe_fx[bin], decSlotImPointer_fx[bin], gain ); // q_inp_mix-4//q_result - outSlotIm_fx[bin] = Madd_32_16( outSlotIm_fx[bin], decSlotRePointer_fx[bin], gain ); // q_inp_mix-4//q_result + outSlotRe_fx[bin] = Msub_32_16( outSlotRe_fx[bin], decSlotImPointer_fx[bin], gain ); // q_inp_mix-4//q_result + outSlotIm_fx[bin] = Madd_32_16( outSlotIm_fx[bin], decSlotRePointer_fx[bin], gain ); // q_inp_mix-4//q_result move32(); move32(); } @@ -4216,9 +4184,7 @@ static void matrixDiagMul_fx( { Word16 chA, chB; -#ifdef OPT_2185_MATRIX_OUT_SCALING Word32 not_zero = 0; -#endif FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { @@ -4228,35 +4194,23 @@ static void matrixDiagMul_fx( imOut_fx[chA][chB] = Mpy_32_32( imIn_fx[chA][chB], D_fx[chB] ); move32(); move32(); -#ifdef OPT_2185_MATRIX_OUT_SCALING not_zero = L_or( not_zero, reOut_fx[chA][chB] ); not_zero = L_or( not_zero, imOut_fx[chA][chB] ); -#endif } } *q_Out = sub( add( q_In, q_D ), 31 ); move16(); -#ifdef OPT_2185_MATRIX_OUT_SCALING if ( !not_zero ) { *q_Out = Q31; move16(); } -#else - Word16 size = i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ); - if ( L_and( is_zero_arr( reOut_fx[0], size ), is_zero_arr( imOut_fx[0], size ) ) ) - { - *q_Out = Q31; - move16(); - } -#endif return; } -#ifdef OPT_2182_MATRIX_SCALE_OPS static void matrixScale_fx( Word32 Are_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ Word32 Aim_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ @@ -4270,7 +4224,6 @@ static void matrixScale_fx( *q_A = add( *q_A, shift ); move16(); } -#endif static void matrixMul_fx( Word32 Are_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ @@ -4283,29 +4236,8 @@ static void matrixMul_fx( Word32 outIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_out*/ Word16 *q_out ) { -#ifdef OPT_2182_MATRIX_SCALE_OPS Word16 chA, chB; -#else - Word16 chA, chB; - Word16 min_q_shift1, min_q_shift2; - Word16 size = i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ); - - min_q_shift1 = sub( s_min( L_norm_arr( Are_fx[0], size ), L_norm_arr( Aim_fx[0], size ) ), 1 ); - min_q_shift2 = sub( s_min( L_norm_arr( Bre_fx[0], size ), L_norm_arr( Bim_fx[0], size ) ), 1 ); - - scale_sig32( Are_fx[0], size, min_q_shift1 ); - scale_sig32( Aim_fx[0], size, min_q_shift1 ); - scale_sig32( Bre_fx[0], size, min_q_shift2 ); - scale_sig32( Bim_fx[0], size, min_q_shift2 ); - - *q_A = add( *q_A, min_q_shift1 ); - *q_B = add( *q_B, min_q_shift2 ); - move16(); - move16(); -#endif -#ifdef OPT_2185_MATRIX_OUT_SCALING Word32 not_zero = 0; -#endif FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { @@ -4332,31 +4264,18 @@ static void matrixMul_fx( Are_fx[chA][1], Bim_fx[1][chB] ); move32(); #endif /* #ifdef IVAS_ENH64_CADENCE_CHANGES */ -#ifdef OPT_2185_MATRIX_OUT_SCALING not_zero = L_or( not_zero, outRe_fx[chA][chB] ); not_zero = L_or( not_zero, outIm_fx[chA][chB] ); -#endif } } *q_out = sub( add( *q_A, *q_B ), 31 ); move16(); -#ifdef OPT_2185_MATRIX_OUT_SCALING if ( !not_zero ) { *q_out = Q31; move16(); } -#else -#ifdef OPT_2182_MATRIX_SCALE_OPS - Word16 size = BINAURAL_CHANNELS * BINAURAL_CHANNELS; -#endif - if ( L_and( is_zero_arr( outRe_fx[0], size ), is_zero_arr( outIm_fx[0], size ) ) ) - { - *q_out = Q31; - move16(); - } -#endif return; } @@ -4376,25 +4295,16 @@ static void matrixTransp1Mul_fx( Word64 tmp_outRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; Word64 tmp_outIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; -#ifdef OPT_2181_MATRIX_TRANSP_1_MUL Word64 tmp64; Word16 common_lsh, q; q = add( add( q_A, q_B ), 1 ); common_lsh = sub( 63, q ); move16(); -#else - Word16 q_tmp_outRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - Word16 q_tmp_outIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - Word64 tmp64_1, tmp64_2; - Word16 tmp16, q_common = 63; - move16(); -#endif FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { FOR( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) { -#ifdef OPT_2181_MATRIX_TRANSP_1_MUL tmp64 = W_mult_32_32( Are_fx[0][chA], Bre_fx[0][chB] ); tmp64 = W_mac_32_32( tmp64, Are_fx[1][chA], Bre_fx[1][chB] ); tmp64 = W_mac_32_32( tmp64, Aim_fx[0][chA], Bim_fx[0][chB] ); @@ -4408,93 +4318,32 @@ static void matrixTransp1Mul_fx( tmp_outIm_fx[chA][chB] = W_mac_32_32( tmp64, Are_fx[1][chA], Bim_fx[1][chB] ); move64(); common_lsh = s_min( common_lsh, W_norm( tmp_outIm_fx[chA][chB] ) ); -#else - tmp64_1 = W_mac_32_32( W_mult_32_32( Are_fx[0][chA], Bre_fx[0][chB] ), Are_fx[1][chA], Bre_fx[1][chB] ); // Q: add( add( q_A, q_B ), 1 ) - tmp64_2 = W_mac_32_32( W_mult_32_32( Aim_fx[0][chA], Bim_fx[0][chB] ), Aim_fx[1][chA], Bim_fx[1][chB] ); // Q: add( add( q_A, q_B ), 1 ) - tmp_outRe_fx[chA][chB] = W_add( tmp64_1, tmp64_2 ); // Q: add( add( q_A, q_B ), 1 ) - move64(); - tmp16 = W_norm( tmp_outRe_fx[chA][chB] ); - tmp_outRe_fx[chA][chB] = W_shl( tmp_outRe_fx[chA][chB], tmp16 ); // Q:add( tmp16, add( add( q_A, q_B ), 1 ) ) - move64(); - q_tmp_outRe_fx[chA][chB] = add( tmp16, add( add( q_A, q_B ), 1 ) ); - move16(); - q_common = s_min( q_tmp_outRe_fx[chA][chB], q_common ); - - - tmp64_1 = W_mac_32_32( W_mult_32_32( Are_fx[0][chA], Bim_fx[0][chB] ), Are_fx[1][chA], Bim_fx[1][chB] ); // Q: add( add( q_A, q_B ), 1 ) - tmp64_2 = W_mac_32_32( W_mult_32_32( Aim_fx[0][chA], Bre_fx[0][chB] ), Aim_fx[1][chA], Bre_fx[1][chB] ); // Q: add( add( q_A, q_B ), 1 ) - tmp_outIm_fx[chA][chB] = W_sub( tmp64_1, tmp64_2 ); // Q: add( add( q_A, q_B ), 1 ) - move64(); - tmp16 = W_norm( tmp_outIm_fx[chA][chB] ); - tmp_outIm_fx[chA][chB] = W_shl( tmp_outIm_fx[chA][chB], tmp16 ); // Q:add( tmp16, add( add( q_A, q_B ), 1 ) ) - move64(); - q_tmp_outIm_fx[chA][chB] = add( tmp16, add( add( q_A, q_B ), 1 ) ); - move16(); - q_common = s_min( q_tmp_outIm_fx[chA][chB], q_common ); -#endif } } -#ifdef OPT_2185_MATRIX_OUT_SCALING Word32 not_zero = 0; -#endif FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { FOR( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) { -#ifdef OPT_2181_MATRIX_TRANSP_1_MUL outRe_fx[chA][chB] = W_extract_h( W_shl( tmp_outRe_fx[chA][chB], common_lsh ) ); move32(); outIm_fx[chA][chB] = W_extract_h( W_shl( tmp_outIm_fx[chA][chB], common_lsh ) ); move32(); -#else - outRe_fx[chA][chB] = W_extract_h( W_shl( tmp_outRe_fx[chA][chB], s_max( -63, sub( q_common, q_tmp_outRe_fx[chA][chB] ) ) ) ); - move32(); - outIm_fx[chA][chB] = W_extract_h( W_shl( tmp_outIm_fx[chA][chB], s_max( -63, sub( q_common, q_tmp_outIm_fx[chA][chB] ) ) ) ); - move32(); -#endif -#ifdef OPT_2185_MATRIX_OUT_SCALING not_zero = L_or( not_zero, outRe_fx[chA][chB] ); not_zero = L_or( not_zero, outIm_fx[chA][chB] ); -#endif } } -#ifdef OPT_2181_MATRIX_TRANSP_1_MUL *q_out = sub( add( q, common_lsh ), 32 ); move16(); -#else - *q_out = sub( q_common, 32 ); - move16(); -#endif -#ifdef OPT_2185_MATRIX_OUT_SCALING if ( !not_zero ) { *q_out = Q31; move16(); } -#else - Word16 size = i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ); - if ( L_and( is_zero_arr( outRe_fx[0], size ), is_zero_arr( outIm_fx[0], size ) ) ) - { - *q_out = Q31; - move16(); - } -#endif return; } -#ifdef OPT_2182_MATRIX_SCALE_OPS -static void matrixTransp2Mul_fx( - Word32 Are_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ - Word32 Aim_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ - Word16 *q_A, - Word32 Bre_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_B*/ - Word32 Bim_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_B*/ - Word16 *q_B, - Word32 outRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_out*/ - Word32 outIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_out*/ - Word16 *q_out ) -#else static void matrixTransp2Mul_fx( Word32 Are_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ Word32 Aim_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ @@ -4502,42 +4351,13 @@ static void matrixTransp2Mul_fx( Word32 Bre_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_B*/ Word32 Bim_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_B*/ Word16 *q_B, - Word32 Ascale, - Word32 Bscale, Word32 outRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_out*/ Word32 outIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_out*/ Word16 *q_out ) -#endif { -#ifdef OPT_2182_MATRIX_SCALE_OPS Word16 chA, chB; // Word16 size = BINAURAL_CHANNELS * BINAURAL_CHANNELS; -#else - Word16 chA, chB; - Word16 min_q_shift; - Word16 size = BINAURAL_CHANNELS * BINAURAL_CHANNELS; - - IF( Ascale == 1 ) - { - min_q_shift = sub( s_min( L_norm_arr( Are_fx[0], size ), L_norm_arr( Aim_fx[0], size ) ), 1 ); - scale_sig32( Are_fx[0], size, min_q_shift ); - scale_sig32( Aim_fx[0], size, min_q_shift ); - *q_A = add( *q_A, min_q_shift ); - move16(); - } - - IF( Bscale == 1 ) - { - min_q_shift = sub( s_min( L_norm_arr( Bre_fx[0], size ), L_norm_arr( Bim_fx[0], size ) ), 1 ); - scale_sig32( Bre_fx[0], size, min_q_shift ); - scale_sig32( Bim_fx[0], size, min_q_shift ); - *q_B = add( *q_B, min_q_shift ); - move16(); - } -#endif -#ifdef OPT_2185_MATRIX_OUT_SCALING Word32 not_zero = 0; -#endif FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { FOR( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) @@ -4563,31 +4383,18 @@ static void matrixTransp2Mul_fx( Are_fx[chA][1], Bim_fx[chB][1] ); move32(); #endif /* #ifdef IVAS_ENH64_CADENCE_CHANGES */ -#ifdef OPT_2185_MATRIX_OUT_SCALING not_zero = L_or( not_zero, outRe_fx[chA][chB] ); not_zero = L_or( not_zero, outIm_fx[chA][chB] ); -#endif } } *q_out = sub( add( *q_A, *q_B ), 31 ); move16(); -#ifdef OPT_2185_MATRIX_OUT_SCALING if ( !not_zero ) { *q_out = Q31; move16(); } -#else -#ifdef OPT_2182_MATRIX_SCALE_OPS - Word16 size = BINAURAL_CHANNELS * BINAURAL_CHANNELS; -#endif - if ( L_and( is_zero_arr( outRe_fx[0], size ), is_zero_arr( outIm_fx[0], size ) ) ) - { - *q_out = Q31; - move16(); - } -#endif return; } @@ -5090,10 +4897,8 @@ static void formulate2x2MixingMatrix_fx( q_temp = sub( add( q_ky, q_GhatQ ), 31 ); /* A = Ky' * G_hat * Q * Kx (see publication) */ -#ifdef OPT_2182_MATRIX_SCALE_OPS matrixScale_fx( tmpRe_fx, tmpIm_fx, &q_temp ); matrixScale_fx( Kxre_fx, Kxim_fx, &q_Kx ); -#endif matrixMul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Kxre_fx, Kxim_fx, &q_Kx, Are_fx, Aim_fx, &q_A ); /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx @@ -5151,10 +4956,8 @@ static void formulate2x2MixingMatrix_fx( div_fx[0] = L_min( div_fx[0], thresh ); // q_div div_fx[1] = L_min( div_fx[1], thresh ); // q_div -#ifdef OPT_2182_MATRIX_SCALE_OPS matrixScale_fx( Are_fx, Aim_fx, &q_A ); matrixScale_fx( Ure_fx, Uim_fx, &q_U ); -#endif matrixMul_fx( Are_fx, Aim_fx, &q_A, Ure_fx, Uim_fx, &q_U, tmpRe_fx, tmpIm_fx, &q_temp ); exp = L_norm_arr( div_fx, BINAURAL_CHANNELS ); @@ -5218,17 +5021,10 @@ static void formulate2x2MixingMatrix_fx( } } -#ifdef OPT_2182_MATRIX_SCALE_OPS matrixTransp2Mul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Ure_fx, Uim_fx, &q_U, Pre_fx, Pim_fx, &q_P ); /* Nearest orthonormal matrix P to matrix A formulated */ -#else - matrixTransp2Mul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Ure_fx, Uim_fx, &q_U, - 0 /*int Ascale*/, - 0 /*int Bscale*/, - Pre_fx, Pim_fx, &q_P ); /* Nearest orthonormal matrix P to matrix A formulated */ -#endif /* These are the final formulas of the JAES publication M = Ky P Kx^(-1) */ #if ( BINAURAL_CHANNELS != 2 ) @@ -5359,23 +5155,14 @@ static void formulate2x2MixingMatrix_fx( } } -#ifdef OPT_2182_MATRIX_SCALE_OPS matrixScale_fx( KyRe_fx, KyIm_fx, &q_ky ); matrixScale_fx( Pre_fx, Pim_fx, &q_P ); -#endif matrixMul_fx( KyRe_fx, KyIm_fx, &q_ky, Pre_fx, Pim_fx, &q_P, tmpRe_fx, tmpIm_fx, &q_temp ); -#ifdef OPT_2182_MATRIX_SCALE_OPS matrixScale_fx( tmpRe_fx, tmpIm_fx, &q_temp ); matrixTransp2Mul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Uxre_fx, Uxim_fx, &q_Ux, Mre_fx, Mim_fx, q_M ); -#else - matrixTransp2Mul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Uxre_fx, Uxim_fx, &q_Ux, - 1 /*int Ascale*/, - 0 /*int Bscale*/, - Mre_fx, Mim_fx, q_M ); -#endif return; } diff --git a/lib_rend/ivas_hrtf_fx.c b/lib_rend/ivas_hrtf_fx.c index 118c94e32ea956e2482a0f3cc8c64a710af31459..d240d64ef86af578ade6db0bb60c82013c5129fd 100644 --- a/lib_rend/ivas_hrtf_fx.c +++ b/lib_rend/ivas_hrtf_fx.c @@ -37,9 +37,6 @@ #include "ivas_error.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA -#include "ivas_rom_binaural_crend_head.h" -#endif /*-----------------------------------------------------------------------* * ivas_HRTF_td_binary_open() @@ -47,13 +44,8 @@ * Allocate HRTF binary handle for TD renderer *-----------------------------------------------------------------------*/ -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_error ivas_HRTF_td_binary_open_fx( TDREND_HRFILT_FiltSet_t **hHrtfTD ) -#else -ivas_error ivas_HRTF_binary_open_fx( - TDREND_HRFILT_FiltSet_t **hHrtfTD ) -#endif { /* Allocate HR filter set for headphones configuration */ *hHrtfTD = (TDREND_HRFILT_FiltSet_t *) malloc( sizeof( TDREND_HRFILT_FiltSet_t ) ); @@ -72,13 +64,8 @@ ivas_error ivas_HRTF_binary_open_fx( * * Close HRTF binary handle for TD renderer *-------------------------------------------------------------------*/ -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA void ivas_HRTF_td_binary_close_fx( TDREND_HRFILT_FiltSet_t **hHrtfTD ) -#else -void ivas_HRTF_binary_close_fx( - TDREND_HRFILT_FiltSet_t **hHrtfTD ) -#endif { test(); IF( hHrtfTD == NULL || *hHrtfTD == NULL ) @@ -86,7 +73,6 @@ void ivas_HRTF_binary_close_fx( return; } -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA Word16 i; IF( ( *hHrtfTD )->ModelParams.modelROM ) { @@ -156,7 +142,6 @@ void ivas_HRTF_binary_close_fx( free( ( *hHrtfTD )->ModelEval.hrfModL_fx ); free( ( *hHrtfTD )->ModelEval.hrfModR_fx ); } -#endif free( *hHrtfTD ); *hHrtfTD = NULL; @@ -195,17 +180,10 @@ ivas_error ivas_HRTF_CRend_binary_open_fx( * * Allocate buffer with dynamic length for HRTF binary Crend handle *-----------------------------------------------------------------------*/ -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_error ivas_HRTF_binary_open_buffers_int16( Word16 **buffer, /* o : buffer to allocate */ const UWord32 mem_size /* i : size of buffer */ ) -#else -ivas_error ivas_HRTF_CRend_binary_open_buffers_int16( - Word16 **buffer, /* o : buffer to allocate */ - const UWord32 mem_size /* i : size of buffer */ -) -#endif { *buffer = (Word16 *) malloc( mem_size ); @@ -217,7 +195,6 @@ ivas_error ivas_HRTF_CRend_binary_open_buffers_int16( return IVAS_ERR_OK; } -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA /*-----------------------------------------------------------------------* * ivas_HRTF_binary_open_buffers_uint16() * @@ -298,7 +275,6 @@ ivas_error ivas_HRTF_binary_open_buffers_int32_ptr_const( return IVAS_ERR_OK; } -#endif /*-------------------------------------------------------------------* * ivas_HRTF_CRend_binary_close() * @@ -393,10 +369,8 @@ void ivas_HRTF_fastconv_binary_close_fx( return; } -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA /* Fastconv HRTF memories */ ivas_binaural_hrtf_close_fx( hHrtfFastConv ); -#endif free( *hHrtfFastConv ); *hHrtfFastConv = NULL; @@ -462,9 +436,7 @@ ivas_error ivas_HRTF_statistics_binary_open_fx( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for statistics HRTF tables!" ); } -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA set_c( (Word8 *) ( *hHrtfStatistics ), 0, (Word32) sizeof( HRTFS_STATISTICS ) ); -#endif return IVAS_ERR_OK; } @@ -473,22 +445,15 @@ ivas_error ivas_HRTF_statistics_binary_open_fx( * * Destroy the HRTF statistics set. *---------------------------------------------------------------------*/ -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA void ivas_HRTF_statistics_binary_close_fx( IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics /* i/o: HRTF statistics handle */ ) -#else -void ivas_HRTF_statistics_close_fx( - IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics /* i/o: HRTF statistics handle */ -) -#endif { test(); IF( hHrtfStatistics == NULL || *hHrtfStatistics == NULL ) { return; } -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA test(); IF( ( hHrtfStatistics != NULL ) && ( *hHrtfStatistics != NULL ) && ( ( *hHrtfStatistics )->fromROM == FALSE ) ) { @@ -505,220 +470,9 @@ void ivas_HRTF_statistics_close_fx( free( ( *hHrtfStatistics )->inter_aural_coherence_dyn ); } } -#endif free( *hHrtfStatistics ); *hHrtfStatistics = NULL; return; } - -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA -/*-----------------------------------------------------------------------* - * ivas_HRTF_statistics_init() - * - * Allocates HRTF statistics handle and initializes from ROM - *-----------------------------------------------------------------------*/ -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA -ivas_error ivas_HRTF_statistics_init_from_rom_fx( - HRTFS_STATISTICS_HANDLE *hHrtfStatistics, - const Word32 sampleRate ) -#else -ivas_error ivas_HRTF_statistics_init_fx( HRTFS_STATISTICS_HANDLE *hHrtfStatistics, - const Word32 sampleRate ) -#endif -{ -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA - - test(); - IF( hHrtfStatistics == NULL || *hHrtfStatistics == NULL ) - { - /* Tables already loaded from file */ - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - SWITCH( sampleRate ) - { - case 48000: - ( *hHrtfStatistics )->average_energy_l_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( Word32 ) ); - IF( ( *hHrtfStatistics )->average_energy_l_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - ( *hHrtfStatistics )->average_energy_r_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( Word32 ) ); - IF( ( *hHrtfStatistics )->average_energy_r_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - ( *hHrtfStatistics )->inter_aural_coherence_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( Word32 ) ); - IF( ( *hHrtfStatistics )->inter_aural_coherence_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - Copy_Scale_sig_16_32_r( defaultHRIR_left_avg_power_48kHz_fx, ( *hHrtfStatistics )->average_energy_l_dyn, LR_IAC_LENGTH_NR_FC, Q28 - defaultHRIR_Q_48kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - Copy_Scale_sig_16_32_r( defaultHRIR_right_avg_power_48kHz_fx, ( *hHrtfStatistics )->average_energy_r_dyn, LR_IAC_LENGTH_NR_FC, Q28 - defaultHRIR_Q_48kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - Copy_Scale_sig_16_32_r( defaultHRIR_coherence_48kHz_fx, ( *hHrtfStatistics )->inter_aural_coherence_dyn, LR_IAC_LENGTH_NR_FC, Q26 - defaultHRIR_Q_48kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - ( *hHrtfStatistics )->average_energy_l = (const Word32 *) ( *hHrtfStatistics )->average_energy_l_dyn; - ( *hHrtfStatistics )->average_energy_r = (const Word32 *) ( *hHrtfStatistics )->average_energy_r_dyn; - ( *hHrtfStatistics )->inter_aural_coherence = (const Word32 *) ( *hHrtfStatistics )->inter_aural_coherence_dyn; - BREAK; - case 32000: - ( *hHrtfStatistics )->average_energy_l_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( Word32 ) ); - IF( ( *hHrtfStatistics )->average_energy_l_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - ( *hHrtfStatistics )->average_energy_r_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( Word32 ) ); - IF( ( *hHrtfStatistics )->average_energy_r_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - ( *hHrtfStatistics )->inter_aural_coherence_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( Word32 ) ); - IF( ( *hHrtfStatistics )->inter_aural_coherence_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - Copy_Scale_sig_16_32_r( defaultHRIR_left_avg_power_32kHz_fx, ( *hHrtfStatistics )->average_energy_l_dyn, LR_IAC_LENGTH_NR_FC, Q28 - defaultHRIR_Q_32kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - Copy_Scale_sig_16_32_r( defaultHRIR_right_avg_power_32kHz_fx, ( *hHrtfStatistics )->average_energy_r_dyn, LR_IAC_LENGTH_NR_FC, Q28 - defaultHRIR_Q_32kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - Copy_Scale_sig_16_32_r( defaultHRIR_coherence_32kHz_fx, ( *hHrtfStatistics )->inter_aural_coherence_dyn, LR_IAC_LENGTH_NR_FC, Q26 - defaultHRIR_Q_32kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - ( *hHrtfStatistics )->average_energy_l = (const Word32 *) ( *hHrtfStatistics )->average_energy_l_dyn; - ( *hHrtfStatistics )->average_energy_r = (const Word32 *) ( *hHrtfStatistics )->average_energy_r_dyn; - ( *hHrtfStatistics )->inter_aural_coherence = (const Word32 *) ( *hHrtfStatistics )->inter_aural_coherence_dyn; - BREAK; - case 16000: - ( *hHrtfStatistics )->average_energy_l_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC_16KHZ * sizeof( Word32 ) ); - IF( ( *hHrtfStatistics )->average_energy_l_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - ( *hHrtfStatistics )->average_energy_r_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC_16KHZ * sizeof( Word32 ) ); - IF( ( *hHrtfStatistics )->average_energy_r_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - ( *hHrtfStatistics )->inter_aural_coherence_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC_16KHZ * sizeof( Word32 ) ); - IF( ( *hHrtfStatistics )->inter_aural_coherence_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - Copy_Scale_sig_16_32_r( defaultHRIR_left_avg_power_16kHz_fx, ( *hHrtfStatistics )->average_energy_l_dyn, LR_IAC_LENGTH_NR_FC_16KHZ, Q28 - defaultHRIR_Q_16kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - Copy_Scale_sig_16_32_r( defaultHRIR_right_avg_power_16kHz_fx, ( *hHrtfStatistics )->average_energy_r_dyn, LR_IAC_LENGTH_NR_FC_16KHZ, Q28 - defaultHRIR_Q_16kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - Copy_Scale_sig_16_32_r( defaultHRIR_coherence_16kHz_fx, ( *hHrtfStatistics )->inter_aural_coherence_dyn, LR_IAC_LENGTH_NR_FC_16KHZ, Q26 - defaultHRIR_Q_16kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - ( *hHrtfStatistics )->average_energy_l = (const Word32 *) ( *hHrtfStatistics )->average_energy_l_dyn; - ( *hHrtfStatistics )->average_energy_r = (const Word32 *) ( *hHrtfStatistics )->average_energy_r_dyn; - ( *hHrtfStatistics )->inter_aural_coherence = (const Word32 *) ( *hHrtfStatistics )->inter_aural_coherence_dyn; - BREAK; - default: - ( *hHrtfStatistics )->average_energy_l = NULL; - ( *hHrtfStatistics )->average_energy_r = NULL; - ( *hHrtfStatistics )->inter_aural_coherence = NULL; - BREAK; - } - ( *hHrtfStatistics )->fromROM = TRUE; -#ifdef FIX_1990_SANITIZER_IN_REVERB_LOAD - ( *hHrtfStatistics )->fromROM = FALSE; // TODO: temporary hack until HRTF statistics ROM tables are converted from Word16 to Word32 -#endif - -#else - HRTFS_STATISTICS *HrtfStatistics; - - test(); - IF( hHrtfStatistics != NULL && *hHrtfStatistics != NULL ) - { - /* Tables already loaded from file */ - return IVAS_ERR_OK; - } - - /* Initialise tables from ROM */ - IF( ( HrtfStatistics = (HRTFS_STATISTICS *) malloc( sizeof( HRTFS_STATISTICS ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for statistics HRTF tables!" ); - } - - HrtfStatistics->average_energy_l = NULL; - HrtfStatistics->average_energy_r = NULL; - HrtfStatistics->inter_aural_coherence = NULL; - - SWITCH( sampleRate ) - { - case 48000: - HrtfStatistics->average_energy_l_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( Word32 ) ); - IF( HrtfStatistics->average_energy_l_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - HrtfStatistics->average_energy_r_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( Word32 ) ); - IF( HrtfStatistics->average_energy_r_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - HrtfStatistics->inter_aural_coherence_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( Word32 ) ); - IF( HrtfStatistics->inter_aural_coherence_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - Copy_Scale_sig_16_32_r( defaultHRIR_left_avg_power_48kHz_fx, HrtfStatistics->average_energy_l_dyn, LR_IAC_LENGTH_NR_FC, Q28 - defaultHRIR_Q_48kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - Copy_Scale_sig_16_32_r( defaultHRIR_right_avg_power_48kHz_fx, HrtfStatistics->average_energy_r_dyn, LR_IAC_LENGTH_NR_FC, Q28 - defaultHRIR_Q_48kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - Copy_Scale_sig_16_32_r( defaultHRIR_coherence_48kHz_fx, HrtfStatistics->inter_aural_coherence_dyn, LR_IAC_LENGTH_NR_FC, Q26 - defaultHRIR_Q_48kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - HrtfStatistics->average_energy_l = (const Word32 *) HrtfStatistics->average_energy_l_dyn; - HrtfStatistics->average_energy_r = (const Word32 *) HrtfStatistics->average_energy_r_dyn; - HrtfStatistics->inter_aural_coherence = (const Word32 *) HrtfStatistics->inter_aural_coherence_dyn; - BREAK; - case 32000: - HrtfStatistics->average_energy_l_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( Word32 ) ); - IF( HrtfStatistics->average_energy_l_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - HrtfStatistics->average_energy_r_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( Word32 ) ); - IF( HrtfStatistics->average_energy_r_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - HrtfStatistics->inter_aural_coherence_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( Word32 ) ); - IF( HrtfStatistics->inter_aural_coherence_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - Copy_Scale_sig_16_32_r( defaultHRIR_left_avg_power_32kHz_fx, HrtfStatistics->average_energy_l_dyn, LR_IAC_LENGTH_NR_FC, Q28 - defaultHRIR_Q_32kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - Copy_Scale_sig_16_32_r( defaultHRIR_right_avg_power_32kHz_fx, HrtfStatistics->average_energy_r_dyn, LR_IAC_LENGTH_NR_FC, Q28 - defaultHRIR_Q_32kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - Copy_Scale_sig_16_32_r( defaultHRIR_coherence_32kHz_fx, HrtfStatistics->inter_aural_coherence_dyn, LR_IAC_LENGTH_NR_FC, Q26 - defaultHRIR_Q_32kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - HrtfStatistics->average_energy_l = (const Word32 *) HrtfStatistics->average_energy_l_dyn; - HrtfStatistics->average_energy_r = (const Word32 *) HrtfStatistics->average_energy_r_dyn; - HrtfStatistics->inter_aural_coherence = (const Word32 *) HrtfStatistics->inter_aural_coherence_dyn; - BREAK; - case 16000: - HrtfStatistics->average_energy_l_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC_16KHZ * sizeof( Word32 ) ); - IF( HrtfStatistics->average_energy_l_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - HrtfStatistics->average_energy_r_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC_16KHZ * sizeof( Word32 ) ); - IF( HrtfStatistics->average_energy_r_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - HrtfStatistics->inter_aural_coherence_dyn = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC_16KHZ * sizeof( Word32 ) ); - IF( HrtfStatistics->inter_aural_coherence_dyn == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - Copy_Scale_sig_16_32_r( defaultHRIR_left_avg_power_16kHz_fx, HrtfStatistics->average_energy_l_dyn, LR_IAC_LENGTH_NR_FC_16KHZ, Q28 - defaultHRIR_Q_16kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - Copy_Scale_sig_16_32_r( defaultHRIR_right_avg_power_16kHz_fx, HrtfStatistics->average_energy_r_dyn, LR_IAC_LENGTH_NR_FC_16KHZ, Q28 - defaultHRIR_Q_16kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - Copy_Scale_sig_16_32_r( defaultHRIR_coherence_16kHz_fx, HrtfStatistics->inter_aural_coherence_dyn, LR_IAC_LENGTH_NR_FC_16KHZ, Q26 - defaultHRIR_Q_16kHz_fx ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - HrtfStatistics->average_energy_l = (const Word32 *) HrtfStatistics->average_energy_l_dyn; - HrtfStatistics->average_energy_r = (const Word32 *) HrtfStatistics->average_energy_r_dyn; - HrtfStatistics->inter_aural_coherence = (const Word32 *) HrtfStatistics->inter_aural_coherence_dyn; - BREAK; - } - HrtfStatistics->fromROM = TRUE; -#ifdef FIX_1990_SANITIZER_IN_REVERB_LOAD - HrtfStatistics->fromROM = FALSE; // TODO: temporary hack until HRTF statistics ROM tables are converted from Word16 to Word32 -#endif - - *hHrtfStatistics = HrtfStatistics; -#endif - - return IVAS_ERR_OK; -} -#endif diff --git a/lib_rend/ivas_objectRenderer_mix_fx.c b/lib_rend/ivas_objectRenderer_mix_fx.c index 35cf3154606157bece24de2f71927a214e1df964..ac2067c00c58666164875ac908b21a2093f44f6f 100644 --- a/lib_rend/ivas_objectRenderer_mix_fx.c +++ b/lib_rend/ivas_objectRenderer_mix_fx.c @@ -151,31 +151,6 @@ void TDREND_MIX_Dealloc_fx( { BSplineModelEvalDealloc_fx( &hBinRendererTd->HrFiltSet_p->ModelParams, &hBinRendererTd->HrFiltSet_p->ModelEval ); } -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA - ELSE - { - IF( hBinRendererTd->HrFiltSet_p->Elev_p_fx != NULL ) - { - free( hBinRendererTd->HrFiltSet_p->Elev_p_fx ); - hBinRendererTd->HrFiltSet_p->Elev_p_fx = NULL; - } - IF( hBinRendererTd->HrFiltSet_p->Azim_p_fx != NULL ) - { - free( hBinRendererTd->HrFiltSet_p->Azim_p_fx ); - hBinRendererTd->HrFiltSet_p->Azim_p_fx = NULL; - } - IF( hBinRendererTd->HrFiltSet_p->LeftFiltSet_p_fx != NULL ) - { - free( hBinRendererTd->HrFiltSet_p->LeftFiltSet_p_fx ); - hBinRendererTd->HrFiltSet_p->LeftFiltSet_p_fx = NULL; - } - IF( hBinRendererTd->HrFiltSet_p->RightFiltSet_p_fx != NULL ) - { - free( hBinRendererTd->HrFiltSet_p->RightFiltSet_p_fx ); - hBinRendererTd->HrFiltSet_p->RightFiltSet_p_fx = NULL; - } - } -#endif IF( hBinRendererTd->HrFiltSet_p->ModelParams.modelROM ) { IF( hBinRendererTd->HrFiltSet_p->ModelParams.UseItdModel ) diff --git a/lib_rend/ivas_prot_rend_fx.h b/lib_rend/ivas_prot_rend_fx.h index f6416f1090e9258538bbe114d833df92abf4cd46..039b251ca86c08e8eef86613269e15cd2182cafb 100644 --- a/lib_rend/ivas_prot_rend_fx.h +++ b/lib_rend/ivas_prot_rend_fx.h @@ -578,7 +578,6 @@ void ivas_masa_ext_dirac_render_fx( /*----------------------------------------------------------------------------------* * HRTF *----------------------------------------------------------------------------------*/ -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_error ivas_HRTF_td_binary_open_fx( TDREND_HRFILT_FiltSet_t **hHrtfTD /* i/o: TD renderer HRTF handle */ ); @@ -586,15 +585,6 @@ ivas_error ivas_HRTF_td_binary_open_fx( void ivas_HRTF_td_binary_close_fx( TDREND_HRFILT_FiltSet_t **hHrtfTD /* i/o: TD renderer HRTF handle */ ); -#else -ivas_error ivas_HRTF_binary_open_fx( - TDREND_HRFILT_FiltSet_t **hHrtfTD /* i/o: TD renderer HRTF handle */ -); - -void ivas_HRTF_binary_close_fx( - TDREND_HRFILT_FiltSet_t **hHrtfTD /* i/o: TD renderer HRTF handle */ -); -#endif ivas_error ivas_HRTF_fastconv_binary_open_fx( HRTFS_FASTCONV **hHrtfFastConv /* i/o: FASTCONV HRTF structure */ @@ -616,7 +606,6 @@ ivas_error ivas_HRTF_CRend_binary_open_fx( HRTFS_CREND_DATA **hHrtfCrend /* i/o: Crend HRTF handle */ ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_error ivas_HRTF_binary_open_buffers_uint16( uint16_t **buffer, /* o : buffer to allocate */ const uint32_t mem_size /* i : size of buffer */ @@ -641,38 +630,13 @@ ivas_error ivas_HRTF_binary_open_buffers_int32_ptr_const( const int32_t ***buffer, /* o : buffer to allocate */ const uint32_t mem_size /* i : size of buffer */ ); -#else -ivas_error ivas_HRTF_CRend_binary_open_buffers_int16( - Word16 **buffer, /* o : buffer to allocate */ - const uint32_t mem_size /* i : size of buffer */ -); -#endif void ivas_HRTF_CRend_binary_close_fx( HRTFS_CREND_DATA **hHrtfCrend /* i/o: Crend HRTF handle */ ); -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA -ivas_error ivas_HRTF_statistics_init_from_rom_fx( - HRTFS_STATISTICS_HANDLE *hHrtfStatistics, /* i/o: HRTF statistics structure */ - const Word32 sampleRate /* i : Sample rate */ -); -#else -ivas_error ivas_HRTF_statistics_init_fx( - HRTFS_STATISTICS_HANDLE *hHrtfStatistics, /* i/o: HRTF statistics structure */ - const Word32 sampleRate /* i : Sample rate */ -); -#endif -#endif -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA void ivas_HRTF_statistics_binary_close_fx( HRTFS_STATISTICS **hHrtfStatistics ); /* i/o: HRTF statistics structure */ -#else -void ivas_HRTF_statistics_close_fx( - HRTFS_STATISTICS **hHrtfStatistics /* i/o: HRTF statistics structure */ -); -#endif ivas_error ivas_HRTF_statistics_binary_open_fx( HRTFS_STATISTICS **hHrtfStatistics /* i/o: HRTF statistics structure */ @@ -1002,12 +966,10 @@ void ivas_binaural_reverb_processSubframe_fx( Word32 outImag[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /* o : output CLDFB data imag */ ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_error ivas_reverb_HRTF_statistics_open_fx( HRTFS_STATISTICS_HANDLE *hHrtfStatistics, /* o : HRTF statistics handle */ const Word32 output_Fs /* i : output sampling rate */ ); -#endif ivas_error ivas_reverb_open_fx( REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 5d1e287a063dec86ee72514663ab1d465478b20c..773f592769aa88fb83f52b97275e0f2c8ed4fdcf 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -34,9 +34,7 @@ #include "options.h" #include "prot_fx.h" #include "ivas_prot_rend_fx.h" -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA #include "ivas_rom_binaural_crend_head.h" -#endif #include "ivas_cnst.h" #include "ivas_rom_rend.h" #include @@ -133,7 +131,6 @@ typedef struct ivas_reverb_params_t static ivas_error calc_jot_t60_coeffs_fx( Word16 *pH_dB_fx, Word16 pH_dB_exp, const UWord16 nrFrequencies, Word16 *pFrequencies_fx, Word16 *pCoeffA_fx, Word16 *pCoeffB_fx, const Word16 fNyquist_fx ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA /*------------------------------------------------------------------------- * ivas_reverb_HRTF_statistics_open() @@ -246,7 +243,6 @@ ivas_error ivas_reverb_HRTF_statistics_open_fx( return IVAS_ERR_OK; } -#endif /*------------------------------------------------------------------------- * wrap_rad_fx() * diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index ba5ee6f4e23b9854eedd94b65fbdcea4b18e8932..8b7580a4f0134d62ac36253b124e54ec7c3ea429 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1163,20 +1163,7 @@ typedef struct typedef struct ivas_hrtf_TDREND_HRFILT_FiltSet_struct { Word32 SampleRate; /* Sample rate of the HR filter */ -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA - Word16 NumPos; - Word16 NumElev; - Word32 Dist_fx; - Word32 *ItdSet_p_fx; -#endif Word16 FiltLength; -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA - Word16 *Azim_p_fx; - Word16 *Elev_p_fx; - Word16 *ItdSetNominal_p_fx; - Word16 *LeftFiltSet_p_fx; - Word16 *RightFiltSet_p_fx; -#endif ModelParams_t ModelParams; ModelEval_t ModelEval; ModelParamsITD_t ModelParamsITD; diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index 03286b669bb66c19442fe3c6c75ce6c104552f14..101015fd0a613eba3850c272ee220938b041a63d 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -1398,7 +1398,6 @@ static bool isIoConfigPairSupported( const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig ) { -#ifdef FIX_1466_EXTREND /* input config cannot be binaural */ test(); test(); @@ -1413,15 +1412,6 @@ static bool isIoConfigPairSupported( { return false; } -#else - /* Rendering mono or stereo to binaural is not supported */ - test(); - test(); - IF( ( EQ_32( inConfig, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( inConfig, IVAS_AUDIO_CONFIG_STEREO ) ) && EQ_32( getAudioConfigType( outConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) ) - { - return false; - } -#endif /* If not returned so far, config pair is supported */ return true; @@ -2586,23 +2576,18 @@ static ivas_error updateMcPanGainsForAmbiOut( { Word16 ch_in, ch_out, lfeIdx, i; Word16 numNonLfeInChannels, outAmbiOrder; -#ifdef FIX_1466_EXTREND AUDIO_CONFIG inConfig; -#endif const Word32 *spkAzi_fx, *spkEle_fx; /* Q22 */ ivas_error error; -#ifdef FIX_1466_EXTREND inConfig = inputMc->base.inConfig; move32(); -#endif IF( NE_32( ( error = getAmbisonicsOrder_fx( outConfig, &outAmbiOrder ) ), IVAS_ERR_OK ) ) { return error; } -#ifdef FIX_1466_EXTREND test(); IF( EQ_32( inConfig, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( inConfig, IVAS_AUDIO_CONFIG_STEREO ) ) { @@ -2630,9 +2615,6 @@ static ivas_error updateMcPanGainsForAmbiOut( return IVAS_ERR_OK; } ELSE IF( NE_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) -#else - IF( NE_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) -#endif { IF( NE_32( ( error = getNumNonLfeChannelsInSpeakerLayout( inputMc->base.inConfig, &numNonLfeInChannels ) ), IVAS_ERR_OK ) ) { @@ -2743,7 +2725,6 @@ static ivas_error updateMcPanGainsForAmbiOut( return IVAS_ERR_OK; } -#ifdef FIX_1466_EXTREND static ivas_error updateMcPanGainsForBinauralOut( input_mc *inputMc ) @@ -2775,7 +2756,6 @@ static ivas_error updateMcPanGainsForBinauralOut( return IVAS_ERR_OK; } -#endif static ivas_error updateMcPanGains( input_mc *inputMc, const AUDIO_CONFIG outConfig ) @@ -2797,7 +2777,6 @@ static ivas_error updateMcPanGains( error = updateMcPanGainsForAmbiOut( inputMc, outConfig ); BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: -#ifdef FIX_1466_EXTREND test(); IF( EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_STEREO ) ) { @@ -2806,7 +2785,6 @@ static ivas_error updateMcPanGains( } /* not mono or stereo */ -#endif SWITCH( outConfig ) { case IVAS_AUDIO_CONFIG_BINAURAL: @@ -2864,14 +2842,12 @@ static ivas_error initMcBinauralRendering( Word32 outSampleRate; Word8 useTDRend; Word16 i; -#ifdef FIX_1466_EXTREND test(); IF( EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_STEREO ) ) { return IVAS_ERR_OK; } -#endif /* Allocate TD binaural renderer for custom loudspeaker layouts (regardless of headrotation) or planar MC layouts with headrotation, CREND for the rest */ @@ -3898,17 +3874,10 @@ ivas_error IVAS_REND_Open( IF( asHrtfBinary ) { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA IF( NE_32( ( error = ivas_HRTF_td_binary_open_fx( &( hIvasRend->hHrtfs.hHrtfTD ) ) ), IVAS_ERR_OK ) ) { return error; } -#else - IF( NE_32( ( error = ivas_HRTF_binary_open_fx( &( hIvasRend->hHrtfs.hHrtfTD ) ) ), IVAS_ERR_OK ) ) - { - return error; - } -#endif IF( NE_32( ( error = ivas_HRTF_CRend_binary_open_fx( &( hIvasRend->hHrtfs.hHrtfCrend ) ) ), IVAS_ERR_OK ) ) { return error; @@ -3929,7 +3898,6 @@ ivas_error IVAS_REND_Open( IF( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA if ( hIvasRend->hHrtfs.hHrtfStatistics == NULL ) { /* Allocate and init HRTF statistics */ @@ -3938,9 +3906,6 @@ ivas_error IVAS_REND_Open( return error; } } -#else - IF( NE_32( ( error = ivas_HRTF_statistics_init_fx( &( hIvasRend->hHrtfs.hHrtfStatistics ), hIvasRend->sampleRateOut ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -7390,7 +7355,6 @@ static ivas_error renderActiveInputsIsm( } return IVAS_ERR_OK; } -#ifdef FIX_1466_EXTREND static void renderMonoStereoToBinaural( const input_mc *mcInput, @@ -7412,7 +7376,6 @@ static void renderMonoStereoToBinaural( return; } -#endif static ivas_error renderLfeToBinaural_fx( const input_mc *mcInput, @@ -8167,7 +8130,6 @@ static ivas_error renderInputMc( renderMcToSba( mcInput, outAudio ); BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: -#ifdef FIX_1466_EXTREND test(); IF( EQ_32( mcInput->base.inConfig, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( mcInput->base.inConfig, IVAS_AUDIO_CONFIG_STEREO ) ) { @@ -8176,7 +8138,6 @@ static ivas_error renderInputMc( } /* not mono or stereo */ -#endif SWITCH( outConfig ) { case IVAS_AUDIO_CONFIG_BINAURAL: @@ -9972,25 +9933,13 @@ void IVAS_REND_Close( ivas_external_orientation_close_fx( &hIvasRend->hExternalOrientationData ); ivas_combined_orientation_close_fx( &hIvasRend->hCombinedOrientationData ); -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA - /* Fastconv HRTF memories */ - ivas_binaural_hrtf_close_fx( &hIvasRend->hHrtfs.hHrtfFastConv ); -#endif -/* Parametric binauralizer HRTF filters */ -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA + /* Parametric binauralizer HRTF filters */ ivas_HRTF_td_binary_close_fx( &( hIvasRend->hHrtfs.hHrtfTD ) ); -#else - ivas_HRTF_binary_close_fx( &( hIvasRend->hHrtfs.hHrtfTD ) ); -#endif ivas_HRTF_CRend_binary_close_fx( &( hIvasRend->hHrtfs.hHrtfCrend ) ); ivas_HRTF_fastconv_binary_close_fx( &( hIvasRend->hHrtfs.hHrtfFastConv ) ); ivas_HRTF_parambin_binary_close_fx( &( hIvasRend->hHrtfs.hHrtfParambin ) ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_statistics_binary_close_fx( &( hIvasRend->hHrtfs.hHrtfStatistics ) ); -#else - ivas_HRTF_statistics_close_fx( &( hIvasRend->hHrtfs.hHrtfStatistics ) ); -#endif free( hIvasRend ); *phIvasRend = NULL; diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index a21569f8d49e2dddec4c0c80801d0a11a55b4773..02e99ae84d4316368996622d0cc30d28d5d9b678 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -296,11 +296,7 @@ static ivas_error TDREND_LoadBSplineBinaryITD( } fread( &modelITD->elevDim3, sizeof( Word16 ), 1, f_hrtf ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32( &modelITD->elevKSeq_dyn_fx, ( modelITD->elevDim3 - 2 ) * sizeof( Word32 ) ); -#else - modelITD->elevKSeq_dyn_fx = (Word32 *) malloc( ( modelITD->elevDim3 - 2 ) * sizeof( Word32 ) ); -#endif v_tmp16 = (Word16 *) malloc( ( modelITD->elevDim3 - 2 ) * sizeof( Word16 ) ); if ( modelITD->elevKSeq_dyn_fx == NULL || v_tmp16 == NULL ) { @@ -315,11 +311,7 @@ static ivas_error TDREND_LoadBSplineBinaryITD( free( v_tmp16 ); fread( &modelITD->azimDim3, sizeof( Word16 ), 1, f_hrtf ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32( &modelITD->azimKSeq_dyn_fx, ( ( modelITD->azimDim3 + 1 ) / 2 - 2 ) * sizeof( Word32 ) ); -#else - modelITD->azimKSeq_dyn_fx = (Word32 *) malloc( ( ( modelITD->azimDim3 + 1 ) / 2 - 2 ) * sizeof( Word32 ) ); /* basis functions are flipped around 180 deg, number of basis functions above/below is (N+1)/2 */ -#endif v_tmp16 = (Word16 *) malloc( ( ( modelITD->azimDim3 + 1 ) / 2 - 2 ) * sizeof( Word16 ) ); if ( modelITD->azimKSeq_dyn_fx == NULL || v_tmp16 == NULL ) { @@ -334,11 +326,7 @@ static ivas_error TDREND_LoadBSplineBinaryITD( free( v_tmp16 ); fread( &tmp, sizeof( Word16 ), 1, f_hrtf ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32( &modelITD->W_dyn_fx, tmp * sizeof( Word32 ) ); -#else - modelITD->W_dyn_fx = (Word32 *) malloc( tmp * sizeof( Word32 ) ); -#endif if ( modelITD->W_dyn_fx == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); @@ -360,21 +348,13 @@ static ivas_error TDREND_LoadBSplineBinaryITD( free( v_tmp16 ); /* azimuth */ -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int16( &modelITD->azimBsLen_dyn_fx, HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( Word16 ) ); -#else - modelITD->azimBsLen_dyn_fx = (Word16 *) malloc( HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( Word16 ) ); -#endif if ( modelITD->azimBsLen_dyn_fx == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); } fread( modelITD->azimBsLen_dyn_fx, sizeof( Word16 ), HRTF_MODEL_BSPLINE_NUM_COEFFS, f_hrtf ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int16( &modelITD->azimBsStart_dyn_fx, HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( Word16 ) ); -#else - modelITD->azimBsStart_dyn_fx = (Word16 *) malloc( HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( Word16 ) ); -#endif if ( modelITD->azimBsStart_dyn_fx == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); @@ -382,11 +362,7 @@ static ivas_error TDREND_LoadBSplineBinaryITD( fread( modelITD->azimBsStart_dyn_fx, sizeof( Word16 ), HRTF_MODEL_BSPLINE_NUM_COEFFS, f_hrtf ); fread( &tmp, sizeof( Word16 ), 1, f_hrtf ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32( &modelITD->azimBsShape_dyn_fx, tmp * sizeof( Word32 ) ); -#else - modelITD->azimBsShape_dyn_fx = (Word32 *) malloc( tmp * sizeof( Word32 ) ); -#endif v_tmp16 = (Word16 *) malloc( tmp * sizeof( Word16 ) ); if ( modelITD->azimBsShape_dyn_fx == NULL || v_tmp16 == NULL ) { @@ -403,21 +379,13 @@ static ivas_error TDREND_LoadBSplineBinaryITD( fread( &modelITD->azimSegSamples, sizeof( Word16 ), 1, f_hrtf ); /* elevation */ -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int16( &modelITD->elevBsLen_dyn_fx, HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( Word16 ) ); -#else - modelITD->elevBsLen_dyn_fx = (Word16 *) malloc( HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( Word16 ) ); -#endif if ( modelITD->elevBsLen_dyn_fx == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); } fread( modelITD->elevBsLen_dyn_fx, sizeof( Word16 ), HRTF_MODEL_BSPLINE_NUM_COEFFS, f_hrtf ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int16( &modelITD->elevBsStart_dyn_fx, HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( Word16 ) ); -#else - modelITD->elevBsStart_dyn_fx = (Word16 *) malloc( HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( Word16 ) ); -#endif if ( modelITD->elevBsStart_dyn_fx == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); @@ -425,11 +393,7 @@ static ivas_error TDREND_LoadBSplineBinaryITD( fread( modelITD->elevBsStart_dyn_fx, sizeof( Word16 ), HRTF_MODEL_BSPLINE_NUM_COEFFS, f_hrtf ); fread( &tmp, sizeof( Word16 ), 1, f_hrtf ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32( &modelITD->elevBsShape_dyn_fx, tmp * sizeof( Word32 ) ); -#else - modelITD->elevBsShape_dyn_fx = (Word32 *) malloc( tmp * sizeof( Word32 ) ); -#endif if ( modelITD->elevBsShape_dyn_fx == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); @@ -525,11 +489,7 @@ static ivas_error TDREND_LoadBSplineBinary( fread( &model->K, sizeof( Word16 ), 1, f_hrtf ); fread( &model->elevDim3, sizeof( Word16 ), 1, f_hrtf ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32( &model->elevKSeq_dyn_fx, ( model->elevDim3 - 2 ) * sizeof( Word32 ) ); -#else - model->elevKSeq_dyn_fx = (Word32 *) malloc( ( model->elevDim3 - 2 ) * sizeof( Word32 ) ); -#endif v_tmp16 = (Word16 *) malloc( ( model->elevDim3 - 2 ) * sizeof( Word16 ) ); if ( model->elevKSeq_dyn_fx == NULL || v_tmp16 == NULL ) @@ -543,21 +503,9 @@ static ivas_error TDREND_LoadBSplineBinary( model->elevKSeq_dyn_fx[j] = L_shl_r( L_deposit_l( v_tmp16[j] ), Q22 - factor_Q ); } free( v_tmp16 ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int16( &model->azimDim3_dyn, model->elevDim3 * sizeof( Word16 ) ); -#else - model->azimDim3_dyn = (Word16 *) malloc( model->elevDim3 * sizeof( Word16 ) ); -#endif -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int16( &model->azim_start_idx_dyn, model->elevDim3 * sizeof( Word16 ) ); -#else - model->azim_start_idx_dyn = (Word16 *) malloc( model->elevDim3 * sizeof( Word16 ) ); -#endif -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32_ptr( &model->azimKSeq_fx, model->elevDim3 * sizeof( float * ) ); -#else - model->azimKSeq_fx = (Word32 **) malloc( model->elevDim3 * sizeof( Word32 * ) ); -#endif if ( model->azimDim3_dyn == NULL || model->azim_start_idx_dyn == NULL || model->azimKSeq_fx == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); @@ -567,11 +515,7 @@ static ivas_error TDREND_LoadBSplineBinary( { fread( &model->azimDim3_dyn[i], sizeof( Word16 ), 1, f_hrtf ); fread( &model->azim_start_idx_dyn[i], sizeof( Word16 ), 1, f_hrtf ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32( &model->azimKSeq_fx[i], ( model->azimDim3_dyn[i] + 1 ) * sizeof( Word32 ) ); -#else - model->azimKSeq_fx[i] = (Word32 *) malloc( ( model->azimDim3_dyn[i] + 1 ) * sizeof( Word32 ) ); -#endif v_tmp16 = (Word16 *) malloc( ( model->azimDim3_dyn[i] + 1 ) * sizeof( Word16 ) ); if ( model->azimKSeq_fx[i] == NULL || v_tmp16 == NULL ) @@ -587,11 +531,7 @@ static ivas_error TDREND_LoadBSplineBinary( free( v_tmp16 ); } fread( &model->AlphaN, sizeof( Word16 ), 1, f_hrtf ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32( &model->AlphaL_dyn_fx, model->AlphaN * model->K * sizeof( Word32 ) ); -#else - model->AlphaL_dyn_fx = (Word32 *) malloc( model->AlphaN * model->K * sizeof( Word32 ) ); -#endif v_tmp16 = (Word16 *) malloc( model->AlphaN * model->K * sizeof( Word16 ) ); if ( model->AlphaL_dyn_fx == NULL || v_tmp16 == NULL ) @@ -609,11 +549,7 @@ static ivas_error TDREND_LoadBSplineBinary( { model->AlphaL_dyn_fx[j] = L_shl_r( L_deposit_l( v_tmp16[j] ), Q30 - factor_Q ); } -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32( &model->AlphaR_dyn_fx, model->AlphaN * model->K * sizeof( Word32 ) ); -#else - model->AlphaR_dyn_fx = (Word32 *) malloc( model->AlphaN * model->K * sizeof( Word32 ) ); -#endif if ( model->AlphaR_dyn_fx == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); @@ -629,21 +565,9 @@ static ivas_error TDREND_LoadBSplineBinary( /* azimuth */ fread( &model->num_unique_azim_splines, sizeof( Word16 ), 1, f_hrtf ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32_ptr_const( &model->azimBsShape_fx, model->num_unique_azim_splines * sizeof( float * ) ); -#else - model->azimBsShape_fx = (const Word32 **) malloc( model->num_unique_azim_splines * sizeof( Word32 * ) ); -#endif -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32_ptr( &model->azimBsShape_dyn_fx, model->num_unique_azim_splines * sizeof( float * ) ); -#else - model->azimBsShape_dyn_fx = (Word32 **) malloc( model->num_unique_azim_splines * sizeof( Word32 * ) ); -#endif -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int16( &model->azimSegSamples_dyn, model->num_unique_azim_splines * sizeof( Word16 ) ); -#else - model->azimSegSamples_dyn = (Word16 *) malloc( model->num_unique_azim_splines * sizeof( Word16 ) ); -#endif if ( model->azimBsShape_fx == NULL || model->azimBsShape_dyn_fx == NULL || model->azimSegSamples_dyn == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); @@ -652,11 +576,7 @@ static ivas_error TDREND_LoadBSplineBinary( for ( i = 0; i < model->num_unique_azim_splines; i++ ) { fread( &tmp, sizeof( Word16 ), 1, f_hrtf ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32( &model->azimBsShape_dyn_fx[i], tmp * sizeof( Word32 ) ); -#else - model->azimBsShape_dyn_fx[i] = (Word32 *) malloc( tmp * sizeof( Word32 ) ); -#endif if ( model->azimBsShape_dyn_fx[i] == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); @@ -676,21 +596,13 @@ static ivas_error TDREND_LoadBSplineBinary( fread( &model->azimSegSamples_dyn[i], sizeof( Word16 ), 1, f_hrtf ); free( v_tmp16 ); } -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int16( &model->azimShapeIdx_dyn, model->elevDim3 * sizeof( Word16 ) ); -#else - model->azimShapeIdx_dyn = (Word16 *) malloc( model->elevDim3 * sizeof( Word16 ) ); -#endif if ( model->azimShapeIdx_dyn == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); } fread( model->azimShapeIdx_dyn, sizeof( Word16 ), model->elevDim3, f_hrtf ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int16( &model->azimShapeSampFactor_dyn, model->elevDim3 * sizeof( Word16 ) ); -#else - model->azimShapeSampFactor_dyn = (Word16 *) malloc( model->elevDim3 * sizeof( Word16 ) ); -#endif if ( model->azimShapeSampFactor_dyn == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); @@ -698,21 +610,13 @@ static ivas_error TDREND_LoadBSplineBinary( fread( model->azimShapeSampFactor_dyn, sizeof( Word16 ), model->elevDim3, f_hrtf ); /* elevation */ -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int16( &model->elevBsLen_dyn, HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( Word16 ) ); -#else - model->elevBsLen_dyn = (Word16 *) malloc( HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( Word16 ) ); -#endif if ( model->elevBsLen_dyn == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); } fread( model->elevBsLen_dyn, sizeof( Word16 ), HRTF_MODEL_BSPLINE_NUM_COEFFS, f_hrtf ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int16( &model->elevBsStart_dyn, HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( Word16 ) ); -#else - model->elevBsStart_dyn = (Word16 *) malloc( HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( Word16 ) ); -#endif if ( model->elevBsStart_dyn == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); @@ -721,11 +625,7 @@ static ivas_error TDREND_LoadBSplineBinary( fread( &tmp, sizeof( Word16 ), 1, f_hrtf ); v_tmp16 = (Word16 *) malloc( tmp * sizeof( Word16 ) ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32( &model->elevBsShape_dyn_fx, tmp * sizeof( Word32 ) ); -#else - model->elevBsShape_dyn_fx = (Word32 *) malloc( tmp * sizeof( Word32 ) ); -#endif if ( model->elevBsShape_dyn_fx == NULL || v_tmp16 == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); @@ -741,11 +641,7 @@ static ivas_error TDREND_LoadBSplineBinary( fread( &model->elevSegSamples, sizeof( Word16 ), 1, f_hrtf ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32( &model->EL_dyn_fx, model->AlphaN * HRTF_MODEL_N_SECTIONS * sizeof( Word32 ) ); -#else - model->EL_dyn_fx = (Word32 *) malloc( model->AlphaN * HRTF_MODEL_N_SECTIONS * sizeof( Word32 ) ); -#endif if ( model->EL_dyn_fx == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); @@ -757,11 +653,7 @@ static ivas_error TDREND_LoadBSplineBinary( fread( (Word32 *) model->EL_dyn_fx, sizeof( Word32 ), model->AlphaN * HRTF_MODEL_N_SECTIONS, f_hrtf ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32( &model->ER_dyn_fx, model->AlphaN * HRTF_MODEL_N_SECTIONS * sizeof( Word32 ) ); -#else - model->ER_dyn_fx = (Word32 *) malloc( model->AlphaN * HRTF_MODEL_N_SECTIONS * sizeof( Word32 ) ); -#endif if ( model->ER_dyn_fx == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); @@ -791,13 +683,8 @@ static ivas_error TDREND_LoadBSplineBinary( HRTF_model_precalc( model ); HrFiltSet_p->FiltLength = HrFiltSet_p->ModelParams.K; -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32( &HrFiltSet_p->ModelEval.hrfModL_fx, model->K * sizeof( Word32 ) ); ivas_HRTF_binary_open_buffers_int32( &HrFiltSet_p->ModelEval.hrfModR_fx, model->K * sizeof( Word32 ) ); -#else - HrFiltSet_p->ModelEval.hrfModL_fx = (Word32 *) malloc( model->K * sizeof( Word32 ) ); - HrFiltSet_p->ModelEval.hrfModR_fx = (Word32 *) malloc( model->K * sizeof( Word32 ) ); -#endif if ( HrFiltSet_p->ModelEval.hrfModL_fx == NULL || HrFiltSet_p->ModelEval.hrfModR_fx == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); @@ -910,15 +797,9 @@ static ivas_error load_reverb_from_binary( if ( is_reverb ) { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_binary_open_buffers_int32( &hHrtfStatistics->average_energy_l_dyn, lr_iac_len * sizeof( Word32 ) ); ivas_HRTF_binary_open_buffers_int32( &hHrtfStatistics->average_energy_r_dyn, lr_iac_len * sizeof( Word32 ) ); ivas_HRTF_binary_open_buffers_int32( &hHrtfStatistics->inter_aural_coherence_dyn, lr_iac_len * sizeof( Word32 ) ); -#else - hHrtfStatistics->average_energy_l_dyn = (Word32 *) malloc( lr_iac_len * sizeof( Word32 ) ); - hHrtfStatistics->average_energy_r_dyn = (Word32 *) malloc( lr_iac_len * sizeof( Word32 ) ); - hHrtfStatistics->inter_aural_coherence_dyn = (Word32 *) malloc( lr_iac_len * sizeof( Word32 ) ); -#endif if ( hHrtfStatistics->average_energy_l_dyn == NULL || hHrtfStatistics->average_energy_r_dyn == NULL || hHrtfStatistics->inter_aural_coherence_dyn == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); @@ -954,7 +835,6 @@ static ivas_error load_reverb_from_binary( return IVAS_ERR_OK; } -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA /*---------------------------------------------------------------------* * load_HrtfStatistics_from_binary() * @@ -966,19 +846,6 @@ ivas_error load_HrtfStatistics_from_binary( const Word32 sampleRate, /* i : sample rate */ const hrtfFileReader *hrtfReader /* i/o: pointer to hrtfFileReader handle */ ) -#else -/*---------------------------------------------------------------------* - * load_reverb_binary() - * - * Load HRTF binary data into the HRTF handle for TD and Crend renderers - *---------------------------------------------------------------------*/ - -ivas_error load_reverb_binary( - IVAS_DEC_HRTF_STATISTICS_HANDLE hHrtfStatistics, /* i/o: HRTF statistics handle */ - const Word32 sampleRate, /* i : sample rate */ - const hrtfFileReader *hrtfReader /* i/o: pointer to hrtfFileReader handle */ -) -#endif { if ( hrtfReader == NULL || hrtfReader->file == NULL || hHrtfStatistics == NULL ) { @@ -1154,63 +1021,7 @@ void destroy_td_hrtf( ) { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_td_binary_close_fx( hHrtf ); -#else - Word16 i; - if ( ( hHrtf == NULL ) || ( *hHrtf == NULL ) ) - { - return; - } - - if ( !( *hHrtf )->ModelParams.modelROM ) - { - if ( ( *hHrtf )->ModelParams.UseItdModel ) - { - free( ( *hHrtf )->ModelParamsITD.elevKSeq_dyn_fx ); - free( ( *hHrtf )->ModelParamsITD.azimKSeq_dyn_fx ); - free( ( *hHrtf )->ModelParamsITD.W_dyn_fx ); - free( ( *hHrtf )->ModelParamsITD.azimBsShape_dyn_fx ); - free( ( *hHrtf )->ModelParamsITD.elevBsShape_dyn_fx ); - free( ( *hHrtf )->ModelParamsITD.azimBsLen_dyn_fx ); - free( ( *hHrtf )->ModelParamsITD.azimBsStart_dyn_fx ); - free( ( *hHrtf )->ModelParamsITD.elevBsLen_dyn_fx ); - free( ( *hHrtf )->ModelParamsITD.elevBsStart_dyn_fx ); - } - free( ( *hHrtf )->ModelParams.elevKSeq_dyn_fx ); - free( ( *hHrtf )->ModelParams.azim_start_idx_dyn ); - free( ( *hHrtf )->ModelParams.azimDim3_dyn ); - free( ( *hHrtf )->ModelParams.AlphaL_dyn_fx ); - free( ( *hHrtf )->ModelParams.AlphaR_dyn_fx ); - free( ( *hHrtf )->ModelParams.azimSegSamples_dyn ); - - free( ( *hHrtf )->ModelParams.azimShapeIdx_dyn ); - free( ( *hHrtf )->ModelParams.azimShapeSampFactor_dyn ); - free( ( *hHrtf )->ModelParams.elevBsLen_dyn ); - free( ( *hHrtf )->ModelParams.elevBsStart_dyn ); - free( ( *hHrtf )->ModelParams.elevBsShape_dyn_fx ); - - for ( i = 0; i < ( *hHrtf )->ModelParams.num_unique_azim_splines; i++ ) - { - free( ( *hHrtf )->ModelParams.azimBsShape_dyn_fx[i] ); - } - free( ( *hHrtf )->ModelParams.azimBsShape_dyn_fx ); - - free( (void *) ( *hHrtf )->ModelParams.azimBsShape_fx ); /* void* cast needed to please both gcc and Visual studio compilers. Deallocating const float** should be fine and gcc agrees, but Visual studio complains. */ - for ( i = 0; i < ( *hHrtf )->ModelParams.elevDim3; i++ ) - { - free( ( *hHrtf )->ModelParams.azimKSeq_fx[i] ); - } - free( ( *hHrtf )->ModelParams.azimKSeq_fx ); - - free( ( *hHrtf )->ModelParams.EL_dyn_fx ); - free( ( *hHrtf )->ModelParams.ER_dyn_fx ); - - free( ( *hHrtf )->ModelEval.hrfModL_fx ); - free( ( *hHrtf )->ModelEval.hrfModR_fx ); - } - ivas_HRTF_binary_close_fx( hHrtf ); -#endif return; @@ -1283,11 +1094,7 @@ static ivas_error create_Crend_HRTF_from_rawdata( { for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA if ( ( error = ivas_HRTF_binary_open_buffers_int16( &( *hHRTF )->pIndex_frequency_max_dyn_fx[i][j], mem_size ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_HRTF_CRend_binary_open_buffers_int16( &( *hHRTF )->pIndex_frequency_max_dyn_fx[i][j], mem_size ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1314,11 +1121,7 @@ static ivas_error create_Crend_HRTF_from_rawdata( for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { mem_size = ( *hHRTF )->num_iterations_diffuse[j] * sizeof( UWord16 ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA if ( ( error = ivas_HRTF_binary_open_buffers_int16( &( *hHRTF )->pIndex_frequency_max_diffuse_dyn_fx[j], mem_size ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_HRTF_CRend_binary_open_buffers_int16( &( *hHRTF )->pIndex_frequency_max_diffuse_dyn_fx[j], mem_size ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1361,11 +1164,7 @@ static ivas_error create_Crend_HRTF_from_rawdata( { for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA if ( ( error = ivas_HRTF_binary_open_buffers_int16( &( *hHRTF )->pOut_to_bin_re_dyn_fx[i][j], mem_size_buf ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_HRTF_CRend_binary_open_buffers_int16( &( *hHRTF )->pOut_to_bin_re_dyn_fx[i][j], mem_size_buf ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1392,11 +1191,7 @@ static ivas_error create_Crend_HRTF_from_rawdata( { for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA if ( ( error = ivas_HRTF_binary_open_buffers_int16( &( *hHRTF )->pOut_to_bin_im_dyn_fx[i][j], mem_size_buf ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_HRTF_CRend_binary_open_buffers_int16( &( *hHRTF )->pOut_to_bin_im_dyn_fx[i][j], mem_size_buf ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1431,11 +1226,7 @@ static ivas_error create_Crend_HRTF_from_rawdata( /* coeff_diffuse_re : The size depends on pIndex_frequency_max_diffuse */ for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA if ( ( error = ivas_HRTF_binary_open_buffers_int16( &( *hHRTF )->pOut_to_bin_diffuse_re_dyn_fx[j], mem_size_buf ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_HRTF_CRend_binary_open_buffers_int16( &( *hHRTF )->pOut_to_bin_diffuse_re_dyn_fx[j], mem_size_buf ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1459,11 +1250,7 @@ static ivas_error create_Crend_HRTF_from_rawdata( /* coeff_diffuse_im : The size depends on pIndex_frequency_max_diffuse */ for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA if ( ( error = ivas_HRTF_binary_open_buffers_int16( &( *hHRTF )->pOut_to_bin_diffuse_im_dyn_fx[j], mem_size_buf ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_HRTF_CRend_binary_open_buffers_int16( &( *hHRTF )->pOut_to_bin_diffuse_im_dyn_fx[j], mem_size_buf ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2149,51 +1936,7 @@ void destroy_crend_hrtf( IVAS_DEC_HRTF_CREND_HANDLE *hHrtfCrend /* i/o: Crend HRTF handle */ ) { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_CRend_binary_close_fx( hHrtfCrend ); -#else - UWord16 i, j; - - test(); - if ( *hHrtfCrend != NULL && hHrtfCrend != NULL ) - { - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) - { - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - if ( ( *hHrtfCrend )->pIndex_frequency_max[i][j] != NULL ) - { - free( ( *hHrtfCrend )->pIndex_frequency_max_dyn_fx[i][j] ); - } - if ( ( *hHrtfCrend )->pOut_to_bin_re_fx[i][j] != NULL ) - { - free( ( *hHrtfCrend )->pOut_to_bin_re_dyn_fx[i][j] ); - } - if ( ( *hHrtfCrend )->pOut_to_bin_im_fx[i][j] != NULL ) - { - free( ( *hHrtfCrend )->pOut_to_bin_im_dyn_fx[i][j] ); - } - } - } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - if ( ( *hHrtfCrend )->pIndex_frequency_max_diffuse[j] != NULL ) - { - free( ( *hHrtfCrend )->pIndex_frequency_max_diffuse_dyn_fx[j] ); - } - if ( ( *hHrtfCrend )->pOut_to_bin_diffuse_re_fx[j] != NULL ) - { - free( ( *hHrtfCrend )->pOut_to_bin_diffuse_re_dyn_fx[j] ); - } - if ( ( *hHrtfCrend )->pOut_to_bin_diffuse_im_fx[j] != NULL ) - { - free( ( *hHrtfCrend )->pOut_to_bin_diffuse_im_dyn_fx[j] ); - } - } - free( *hHrtfCrend ); - *hHrtfCrend = NULL; - } -#endif return; } @@ -2209,10 +1952,6 @@ void destroy_fastconv_hrtf( IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv /* i/o: FastConv HRTF handle */ ) { -#ifndef FIX_2249_MEMORY_LEAK_IN_SBA - /* Fastconv HRTF memories */ - ivas_binaural_hrtf_close_fx( hHrtfFastConv ); -#endif /* Fastconv HRTF filters */ ivas_HRTF_fastconv_binary_close_fx( hHrtfFastConv ); @@ -2245,26 +1984,7 @@ void destroy_hrtf_statistics( IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics /* i/o: HRTF statistics handle */ ) { -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA ivas_HRTF_statistics_binary_close_fx( hHrtfStatistics ); -#else - if ( ( hHrtfStatistics != NULL ) && ( *hHrtfStatistics != NULL ) && ( ( *hHrtfStatistics )->fromROM == FALSE ) ) - { - if ( ( *hHrtfStatistics )->average_energy_l_dyn != NULL ) - { - free( ( *hHrtfStatistics )->average_energy_l_dyn ); - } - if ( ( *hHrtfStatistics )->average_energy_r_dyn != NULL ) - { - free( ( *hHrtfStatistics )->average_energy_r_dyn ); - } - if ( ( *hHrtfStatistics )->inter_aural_coherence_dyn != NULL ) - { - free( ( *hHrtfStatistics )->inter_aural_coherence_dyn ); - } - } - ivas_HRTF_statistics_close_fx( hHrtfStatistics ); -#endif return; } diff --git a/lib_util/hrtf_file_reader.h b/lib_util/hrtf_file_reader.h index ea539a24e6674ea19690c39e2e3352ecca7a9065..c503caa739ef3bba526cd75a1002610a85324ff3 100644 --- a/lib_util/hrtf_file_reader.h +++ b/lib_util/hrtf_file_reader.h @@ -105,7 +105,6 @@ ivas_error load_TDrend_HRTF_binary( const hrtfFileReader *hrtfReader /* i/o: pointer to hrtfFileReader handle */ ); -#ifdef FIX_2249_MEMORY_LEAK_IN_SBA /*---------------------------------------------------------------------* * load_HrtfStatistics_from_binary() * @@ -117,19 +116,6 @@ ivas_error load_HrtfStatistics_from_binary( const Word32 sampleRate, /* i : sample rate */ const hrtfFileReader *hrtfReader /* i/o: pointer to hrtfFileReader handle */ ); -#else -/*---------------------------------------------------------------------* - * load_reverb_binary() - * - * Load reverb binary data into the HRTF handle - *---------------------------------------------------------------------*/ - -ivas_error load_reverb_binary( - IVAS_DEC_HRTF_STATISTICS_HANDLE hHrtfStatistics, /* i/o: HRTF statistics handle */ - const Word32 sampleRate, /* i : sample rate */ - const hrtfFileReader *hrtfReader /* i/o: pointer to hrtfFileReader handle */ -); -#endif /*---------------------------------------------------------------------* * load_Crend_HRTF_from_binary()