Loading lib_com/cldfb_evs_fx.c +10 −0 Original line number Diff line number Diff line Loading @@ -1598,17 +1598,27 @@ ivas_error cldfb_save_memory( } hs->memory_length = cldfb_get_memory_length( hs ); move16(); #ifdef FIX_2431_AVOID_CALLOC hs->memory = (Word16 *) malloc( ( hs->memory_length + CLDFB_MEM_EXPONENTS + 1 ) * sizeof( Word16 ) ); IF( hs->memory == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB\n" ); } #else hs->memory = (Word16 *) calloc( hs->memory_length + CLDFB_MEM_EXPONENTS + 1, sizeof( Word16 ) ); #endif /* save the memory */ Copy( hs->FilterStates, hs->memory, hs->memory_length ); Copy( hs->FilterStates_e, hs->memory + hs->memory_length, CLDFB_MEM_EXPONENTS ); hs->memory[hs->memory_length + CLDFB_MEM_EXPONENTS] = hs->FilterStates_eg; move16(); #ifndef FIX_2431_AVOID_CALLOC IF( hs->memory == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB\n" ); } #endif return IVAS_ERR_OK; } Loading lib_com/modif_fs_fx.c +8 −2 Original line number Diff line number Diff line Loading @@ -651,7 +651,11 @@ Word16 modify_Fs_intcub3m_sup_fx( const Word16( *cu )[3] = 0; Word16 *sigin_sr, *sigOutptr, *cptr; const Word16 *uptr, *ctptr; #ifdef FIX_2431_AVOID_CALLOC Word16 sigin_sr_tab[NS2SA( 16000, DELAY_CLDFB_NS ) + 2]; #else Word16 *sigin_sr_tab; #endif Word16 lim, inc, lim2, lim3; Word32 vv32; #define QSR 2 /* right shift to avoid overflow, 2 is OK */ Loading @@ -677,7 +681,9 @@ Word16 modify_Fs_intcub3m_sup_fx( } ELSE { #ifndef FIX_2431_AVOID_CALLOC sigin_sr_tab = (Word16 *) calloc( lg + 2, sizeof( *sigin_sr ) ); /*shift right*/ #endif sigin_sr = sigin_sr_tab + 2; FOR( i = -2; i < lg; i++ ) { Loading Loading @@ -861,7 +867,6 @@ Word16 modify_Fs_intcub3m_sup_fx( } } kk = sub( kk, 1 ); if ( kk < 0 ) { Loading Loading @@ -916,8 +921,9 @@ Word16 modify_Fs_intcub3m_sup_fx( } } #ifndef FIX_2431_AVOID_CALLOC free( sigin_sr_tab ); #endif return lg_out; } Loading lib_com/options.h +4 −1 Original line number Diff line number Diff line Loading @@ -99,6 +99,10 @@ #define FIX_2385_GETTCXONLY /* FhG: issue 2385 : harmonizing getTcxonly_ivas_fx() and getTcxonly_ivas_fx() functions */ #define FIX_2196_UNREACHABLE_CODE_IN_OSBA_STEREO_OUTPUT /* FhG: remove unreachable code in ivas_osba_stereo_add_channels */ #define FIX_OUTPUT_FRAME /* VA: harmonize "output_frame" parameter usage to correspond to FLP */ #define HARMONIZE_ISSUE_2435_WRITETNSDATA /* FhG basop 2435: Harmonize WriteTnsData*_fx(), EncodeTnsData*_fx() */ #define HARM_2336_DOTP /* VA: basop 2336; Harmonisation of some dot_product function + some BE optimisation */ #define FIX_2431_AVOID_CALLOC /* VA: basp issue 2431: avoid use of calloc() */ #define FIX_2424_REMOVE_GAUSS_L2_ENC /* VA: basop issue 2424: Remove duplicated code in gauss_L2_ivas_fx() */ /* #################### End BE switches ################################## */ Loading @@ -111,7 +115,6 @@ /* ##################### End NON-BE switches ########################### */ /* ################## End MAINTENANCE switches ######################### */ /* clang-format on */ #endif lib_com/prot_fx.h +29 −7 Original line number Diff line number Diff line Loading @@ -5687,7 +5687,7 @@ void v_add_fx_me( const Word16 N, /* i : Vector length */ const Word16 hdrm /* i : headroom for when subtraction result > 1 or < -1 */ ); #ifndef HARM_2336_DOTP void v_add_w64( const Word64 x1[], /* i : Input vector 1 */ const Word64 x2[], /* i : Input vector 2 */ Loading @@ -5695,7 +5695,7 @@ void v_add_w64( const Word16 N, /* i : Vector length */ const Word16 hdrm /* i : headroom for when subtraction result > 1 or < -1 */ ); #endif void v_sub_fx( const Word32 x1[], /* i : Input vector 1 */ const Word32 x2[], /* i : Input vector 2 */ Loading Loading @@ -5725,7 +5725,7 @@ Word32 dotp_fx32_o( const Word16 n, /* i : vector length */ const Word16 log_len, /* i : max factor added to result q after dot product (equal to log2(n)) */ Word16 *res_q ); #ifndef HARM_2336_DOTP Word32 dotp_fx32_fac( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ Loading @@ -5733,7 +5733,7 @@ Word32 dotp_fx32_fac( const Word16 log_len, /* i : max factor added to result q after dot product (equal to log2(n)) */ Word16 *res_q /*stores resultant Q*/ ); #endif Word32 dotp_fx_ivas_fx( const Word32 x[], /* i : vector x[] */ Word16 x_e, Loading @@ -5747,7 +5747,7 @@ Word32 dotp_fx_guarded( const Word32 y[], /* i : vector y[] */ const Word16 n /* i : vector length */ ); #ifndef HARM_2336_DOTP Word32 dotp_me_fx( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ Loading @@ -5755,7 +5755,7 @@ Word32 dotp_me_fx( Word16 exp_x, Word16 exp_y, Word16 *exp_suma ); #endif void lsf_end_dec_fx( Decoder_State *st, /* i/o: decoder state structure */ Word16 mode2_flag, /* Q0 */ Loading Loading @@ -7346,8 +7346,14 @@ void core_switching_hq_prepare_dec_fx( ); ivas_error amr_wb_dec_fx( #ifdef FIX_2431_AVOID_CALLOC Decoder_State *st_fx, /* i/o: Decoder static variables structure */ Word16 output_sp[], /* o : synthesis output */ Word32 *mem_hp20_in_fx /* i/o: hp20 filter memory Qx*/ #else Word16 output_sp[], /* o : synthesis output */ Decoder_State *st_fx /* o : Decoder static variables structure */ #endif ); void amr_wb_dec_init_fx( Loading Loading @@ -8188,6 +8194,7 @@ void GetParameters_fx( Word16 *pnBits // Q0 ); #ifndef HARMONIZE_ISSUE_2435_WRITETNSDATA void EncodeTnsData_ivas_fx( STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */ STnsData const *pTnsData, /* i : TNS data struct (quantized param) */ Loading @@ -8195,6 +8202,15 @@ void EncodeTnsData_ivas_fx( Word16 *pnSize, /* o : number of written parameters Q0*/ Word16 *pnBits /* o : number of written bits Q0*/ ); #else void EncodeTnsData_ivas_fx( STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */ STnsData const *pTnsData, /* i : TNS data struct (quantized param) */ Word16 *stream, /* o : internal data stream Q0 */ Word16 *pnSize, /* o : number of written parameters Q0 */ Word16 *pnBits /* o : number of written bits Q0 */ ); #endif void SetParameters( ParamsBitMap const *paramsBitMap, Loading Loading @@ -8709,6 +8725,9 @@ void d_gain_pred_fx( ivas_error evs_dec_fx( Decoder_State *st_fx, /* i/o : Decoder state structure */ Word16 output_sp[], /* o : output synthesis signal */ #ifdef FIX_2431_AVOID_CALLOC Word32 *mem_hp20_in_fx, /* i/o: hp20 filter memory Qx*/ #endif FRAME_MODE frameMode /* i : Decoder frame mode */ ); Loading Loading @@ -10808,6 +10827,7 @@ void ResetTnsData_flt( void ClearTnsFilterCoefficients_flt( STnsFilter *pTnsFilter ); #ifndef HARMONIZE_ISSUE_2435_WRITETNSDATA void EncodeTnsData( STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */ STnsData const *pTnsData, /* i : TNS data struct (quantized param) */ Loading @@ -10815,6 +10835,7 @@ void EncodeTnsData( Word16 *pnSize, /* o : number of written parameters */ Word16 *pnBits /* o : number of written bits */ ); #endif void WriteTnsData( const STnsConfig *pTnsConfig, /* i : TNS Configuration struct */ Loading @@ -10823,6 +10844,7 @@ void WriteTnsData( BSTR_ENC_HANDLE hBstr, /* o : bitstream */ Word16 *pnBits /* o : number of written bits */ ); #ifndef HARMONIZE_READ_DECODE_TNS void ReadTnsData_ivas( STnsConfig const *pTnsConfig, Loading lib_com/tools_fx.c +28 −5 Original line number Diff line number Diff line Loading @@ -630,7 +630,7 @@ Word32 dotp_fx32_o( return W_extract_l( suma ); } #ifndef HARM_2336_DOTP Word32 dotp_fx32_fac( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ Loading Loading @@ -686,6 +686,7 @@ void v_add_w64( return; } #endif /*-------------------------------------------------------------------* Loading @@ -703,10 +704,18 @@ void v_sub_fx( ) { Word16 i; #ifdef HARM_2336_DOTP Word32 wtmp; assert( hdrm < 31 && hdrm > 0 ); wtmp = L_shl_sat( 1, sub( 31, hdrm ) ); #endif FOR( i = 0; i < N; i++ ) { #ifndef HARM_2336_DOTP y[i] = L_sub( L_shr( x1[i], hdrm ), L_shr( x2[i], hdrm ) ); #else y[i] = Msub_32_32( Mpy_32_32( x1[i], wtmp ), x2[i], wtmp ); #endif move32(); } Loading Loading @@ -5143,7 +5152,7 @@ UWord32 mvl2s_r( return noClipping; } #ifndef HARM_2336_DOTP Word32 dotp_me_fx( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ Loading @@ -5166,7 +5175,7 @@ Word32 dotp_me_fx( return suma; } #endif Word32 dotp_fx_guarded( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ Loading Loading @@ -5195,6 +5204,7 @@ Word32 dotp_fx_ivas_fx( const Word16 n, /* i : vector length */ Word16 *out_e ) { #ifndef HARM_2336_DOTP Word16 i, exp; Word32 suma = 0; Loading @@ -5208,7 +5218,20 @@ Word32 dotp_fx_ivas_fx( *out_e = exp; move16(); #else Word16 i; Word32 suma; Word32 mul; Word16 mul_exp = add( x_e, y_e ); suma = Mpy_32_32( x[0], y[0] ); *out_e = mul_exp; move16(); FOR( i = 1; i < n; i++ ) { mul = Mpy_32_32( x[i], y[i] ); suma = BASOP_Util_Add_Mant32Exp( suma, *out_e, mul, mul_exp, out_e ); // exp_x+exp_A } #endif return suma; } Loading Loading
lib_com/cldfb_evs_fx.c +10 −0 Original line number Diff line number Diff line Loading @@ -1598,17 +1598,27 @@ ivas_error cldfb_save_memory( } hs->memory_length = cldfb_get_memory_length( hs ); move16(); #ifdef FIX_2431_AVOID_CALLOC hs->memory = (Word16 *) malloc( ( hs->memory_length + CLDFB_MEM_EXPONENTS + 1 ) * sizeof( Word16 ) ); IF( hs->memory == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB\n" ); } #else hs->memory = (Word16 *) calloc( hs->memory_length + CLDFB_MEM_EXPONENTS + 1, sizeof( Word16 ) ); #endif /* save the memory */ Copy( hs->FilterStates, hs->memory, hs->memory_length ); Copy( hs->FilterStates_e, hs->memory + hs->memory_length, CLDFB_MEM_EXPONENTS ); hs->memory[hs->memory_length + CLDFB_MEM_EXPONENTS] = hs->FilterStates_eg; move16(); #ifndef FIX_2431_AVOID_CALLOC IF( hs->memory == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB\n" ); } #endif return IVAS_ERR_OK; } Loading
lib_com/modif_fs_fx.c +8 −2 Original line number Diff line number Diff line Loading @@ -651,7 +651,11 @@ Word16 modify_Fs_intcub3m_sup_fx( const Word16( *cu )[3] = 0; Word16 *sigin_sr, *sigOutptr, *cptr; const Word16 *uptr, *ctptr; #ifdef FIX_2431_AVOID_CALLOC Word16 sigin_sr_tab[NS2SA( 16000, DELAY_CLDFB_NS ) + 2]; #else Word16 *sigin_sr_tab; #endif Word16 lim, inc, lim2, lim3; Word32 vv32; #define QSR 2 /* right shift to avoid overflow, 2 is OK */ Loading @@ -677,7 +681,9 @@ Word16 modify_Fs_intcub3m_sup_fx( } ELSE { #ifndef FIX_2431_AVOID_CALLOC sigin_sr_tab = (Word16 *) calloc( lg + 2, sizeof( *sigin_sr ) ); /*shift right*/ #endif sigin_sr = sigin_sr_tab + 2; FOR( i = -2; i < lg; i++ ) { Loading Loading @@ -861,7 +867,6 @@ Word16 modify_Fs_intcub3m_sup_fx( } } kk = sub( kk, 1 ); if ( kk < 0 ) { Loading Loading @@ -916,8 +921,9 @@ Word16 modify_Fs_intcub3m_sup_fx( } } #ifndef FIX_2431_AVOID_CALLOC free( sigin_sr_tab ); #endif return lg_out; } Loading
lib_com/options.h +4 −1 Original line number Diff line number Diff line Loading @@ -99,6 +99,10 @@ #define FIX_2385_GETTCXONLY /* FhG: issue 2385 : harmonizing getTcxonly_ivas_fx() and getTcxonly_ivas_fx() functions */ #define FIX_2196_UNREACHABLE_CODE_IN_OSBA_STEREO_OUTPUT /* FhG: remove unreachable code in ivas_osba_stereo_add_channels */ #define FIX_OUTPUT_FRAME /* VA: harmonize "output_frame" parameter usage to correspond to FLP */ #define HARMONIZE_ISSUE_2435_WRITETNSDATA /* FhG basop 2435: Harmonize WriteTnsData*_fx(), EncodeTnsData*_fx() */ #define HARM_2336_DOTP /* VA: basop 2336; Harmonisation of some dot_product function + some BE optimisation */ #define FIX_2431_AVOID_CALLOC /* VA: basp issue 2431: avoid use of calloc() */ #define FIX_2424_REMOVE_GAUSS_L2_ENC /* VA: basop issue 2424: Remove duplicated code in gauss_L2_ivas_fx() */ /* #################### End BE switches ################################## */ Loading @@ -111,7 +115,6 @@ /* ##################### End NON-BE switches ########################### */ /* ################## End MAINTENANCE switches ######################### */ /* clang-format on */ #endif
lib_com/prot_fx.h +29 −7 Original line number Diff line number Diff line Loading @@ -5687,7 +5687,7 @@ void v_add_fx_me( const Word16 N, /* i : Vector length */ const Word16 hdrm /* i : headroom for when subtraction result > 1 or < -1 */ ); #ifndef HARM_2336_DOTP void v_add_w64( const Word64 x1[], /* i : Input vector 1 */ const Word64 x2[], /* i : Input vector 2 */ Loading @@ -5695,7 +5695,7 @@ void v_add_w64( const Word16 N, /* i : Vector length */ const Word16 hdrm /* i : headroom for when subtraction result > 1 or < -1 */ ); #endif void v_sub_fx( const Word32 x1[], /* i : Input vector 1 */ const Word32 x2[], /* i : Input vector 2 */ Loading Loading @@ -5725,7 +5725,7 @@ Word32 dotp_fx32_o( const Word16 n, /* i : vector length */ const Word16 log_len, /* i : max factor added to result q after dot product (equal to log2(n)) */ Word16 *res_q ); #ifndef HARM_2336_DOTP Word32 dotp_fx32_fac( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ Loading @@ -5733,7 +5733,7 @@ Word32 dotp_fx32_fac( const Word16 log_len, /* i : max factor added to result q after dot product (equal to log2(n)) */ Word16 *res_q /*stores resultant Q*/ ); #endif Word32 dotp_fx_ivas_fx( const Word32 x[], /* i : vector x[] */ Word16 x_e, Loading @@ -5747,7 +5747,7 @@ Word32 dotp_fx_guarded( const Word32 y[], /* i : vector y[] */ const Word16 n /* i : vector length */ ); #ifndef HARM_2336_DOTP Word32 dotp_me_fx( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ Loading @@ -5755,7 +5755,7 @@ Word32 dotp_me_fx( Word16 exp_x, Word16 exp_y, Word16 *exp_suma ); #endif void lsf_end_dec_fx( Decoder_State *st, /* i/o: decoder state structure */ Word16 mode2_flag, /* Q0 */ Loading Loading @@ -7346,8 +7346,14 @@ void core_switching_hq_prepare_dec_fx( ); ivas_error amr_wb_dec_fx( #ifdef FIX_2431_AVOID_CALLOC Decoder_State *st_fx, /* i/o: Decoder static variables structure */ Word16 output_sp[], /* o : synthesis output */ Word32 *mem_hp20_in_fx /* i/o: hp20 filter memory Qx*/ #else Word16 output_sp[], /* o : synthesis output */ Decoder_State *st_fx /* o : Decoder static variables structure */ #endif ); void amr_wb_dec_init_fx( Loading Loading @@ -8188,6 +8194,7 @@ void GetParameters_fx( Word16 *pnBits // Q0 ); #ifndef HARMONIZE_ISSUE_2435_WRITETNSDATA void EncodeTnsData_ivas_fx( STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */ STnsData const *pTnsData, /* i : TNS data struct (quantized param) */ Loading @@ -8195,6 +8202,15 @@ void EncodeTnsData_ivas_fx( Word16 *pnSize, /* o : number of written parameters Q0*/ Word16 *pnBits /* o : number of written bits Q0*/ ); #else void EncodeTnsData_ivas_fx( STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */ STnsData const *pTnsData, /* i : TNS data struct (quantized param) */ Word16 *stream, /* o : internal data stream Q0 */ Word16 *pnSize, /* o : number of written parameters Q0 */ Word16 *pnBits /* o : number of written bits Q0 */ ); #endif void SetParameters( ParamsBitMap const *paramsBitMap, Loading Loading @@ -8709,6 +8725,9 @@ void d_gain_pred_fx( ivas_error evs_dec_fx( Decoder_State *st_fx, /* i/o : Decoder state structure */ Word16 output_sp[], /* o : output synthesis signal */ #ifdef FIX_2431_AVOID_CALLOC Word32 *mem_hp20_in_fx, /* i/o: hp20 filter memory Qx*/ #endif FRAME_MODE frameMode /* i : Decoder frame mode */ ); Loading Loading @@ -10808,6 +10827,7 @@ void ResetTnsData_flt( void ClearTnsFilterCoefficients_flt( STnsFilter *pTnsFilter ); #ifndef HARMONIZE_ISSUE_2435_WRITETNSDATA void EncodeTnsData( STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */ STnsData const *pTnsData, /* i : TNS data struct (quantized param) */ Loading @@ -10815,6 +10835,7 @@ void EncodeTnsData( Word16 *pnSize, /* o : number of written parameters */ Word16 *pnBits /* o : number of written bits */ ); #endif void WriteTnsData( const STnsConfig *pTnsConfig, /* i : TNS Configuration struct */ Loading @@ -10823,6 +10844,7 @@ void WriteTnsData( BSTR_ENC_HANDLE hBstr, /* o : bitstream */ Word16 *pnBits /* o : number of written bits */ ); #ifndef HARMONIZE_READ_DECODE_TNS void ReadTnsData_ivas( STnsConfig const *pTnsConfig, Loading
lib_com/tools_fx.c +28 −5 Original line number Diff line number Diff line Loading @@ -630,7 +630,7 @@ Word32 dotp_fx32_o( return W_extract_l( suma ); } #ifndef HARM_2336_DOTP Word32 dotp_fx32_fac( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ Loading Loading @@ -686,6 +686,7 @@ void v_add_w64( return; } #endif /*-------------------------------------------------------------------* Loading @@ -703,10 +704,18 @@ void v_sub_fx( ) { Word16 i; #ifdef HARM_2336_DOTP Word32 wtmp; assert( hdrm < 31 && hdrm > 0 ); wtmp = L_shl_sat( 1, sub( 31, hdrm ) ); #endif FOR( i = 0; i < N; i++ ) { #ifndef HARM_2336_DOTP y[i] = L_sub( L_shr( x1[i], hdrm ), L_shr( x2[i], hdrm ) ); #else y[i] = Msub_32_32( Mpy_32_32( x1[i], wtmp ), x2[i], wtmp ); #endif move32(); } Loading Loading @@ -5143,7 +5152,7 @@ UWord32 mvl2s_r( return noClipping; } #ifndef HARM_2336_DOTP Word32 dotp_me_fx( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ Loading @@ -5166,7 +5175,7 @@ Word32 dotp_me_fx( return suma; } #endif Word32 dotp_fx_guarded( const Word32 x[], /* i : vector x[] */ const Word32 y[], /* i : vector y[] */ Loading Loading @@ -5195,6 +5204,7 @@ Word32 dotp_fx_ivas_fx( const Word16 n, /* i : vector length */ Word16 *out_e ) { #ifndef HARM_2336_DOTP Word16 i, exp; Word32 suma = 0; Loading @@ -5208,7 +5218,20 @@ Word32 dotp_fx_ivas_fx( *out_e = exp; move16(); #else Word16 i; Word32 suma; Word32 mul; Word16 mul_exp = add( x_e, y_e ); suma = Mpy_32_32( x[0], y[0] ); *out_e = mul_exp; move16(); FOR( i = 1; i < n; i++ ) { mul = Mpy_32_32( x[i], y[i] ); suma = BASOP_Util_Add_Mant32Exp( suma, *out_e, mul, mul_exp, out_e ); // exp_x+exp_A } #endif return suma; } Loading