Loading lib_com/lsf_tools_fx.c +147 −0 Original line number Diff line number Diff line Loading @@ -631,6 +631,153 @@ Word16 lpc2lsp_fx( return ( 1 ); } #ifdef FIX_ISSUE_1165 /*===================================================================*/ /* FUNCTION : lpc2lsp_ivas_fx () */ /*-------------------------------------------------------------------*/ /* PURPOSE : Convert LPC coefficients to LSP coefficients */ /*-------------------------------------------------------------------*/ /* INPUT ARGUMENTS : */ /* */ /* _ (Word32 []) a : LPC coefficients, Q27 */ /* _ (Word16 []) old_freq: Previous frame LSP coefficients, Q15 */ /* _ (Word16 []) order: LPC order */ /*-------------------------------------------------------------------*/ /* OUTPUT ARGUMENTS : */ /* _ (Word16 []) freq: LSP coefficients, Q15 */ /*-------------------------------------------------------------------*/ /* INPUT/OUTPUT ARGUMENTS : */ /* _ None */ /*-------------------------------------------------------------------*/ /* RETURN ARGUMENTS : */ /* _ (Word16) flag: 1 means all 10 LSPs are found, 0 otherwise */ /*===================================================================*/ /*NOTE: This function was created to avoid a crash that happens in the*/ /* first for loop of this function while performing L_shl on a in*/ /* lpc2lsp_fx, this computation assigns value to Lacc, which is */ /* kept in Q26 here to avoid L_shl when a has saturated value. */ Word16 lpc2lsp_ivas_fx( Word32 *a, Word16 *freq, Word16 *old_freq, Word16 order ) { Word16 i; Word16 rt, low, high, prev_rt, rc; Word32 p[11], q[11]; /* Q26 */ Word32 Ltemp, v_low; Word32 Lacc; Word16 tfreq[21]; /* First construct the P,Q polynomial */ /* p[0] = q[0] = 1 */ /* p[i] = -lpcCoeff[i] - lpcCoeff[11-i] - p[i-1] ( 1<=i<=5)*/ /* q[i] = -lpcCoeff[i] + lpcCoeff[11-i] + q[i-1] ( 1<=i<=5)*/ Ltemp = L_deposit_h( 0x400 ); /* Ltemp is 1.0 in Q26 */ p[0] = Ltemp; move32(); q[0] = Ltemp; move32(); FOR( i = 1; i < ( order / 2 ) + 1; i++ ) { Lacc = L_shr( a[order - i], 1 ); move32(); /* Q26 */ Lacc = L_sub( Lacc, L_shr( a[i - 1], 1 ) ); /* Lacc=-lpcCoeff[i-1] + lpcCoeff[order-i]//Q26 */ q[i] = L_add( ( Lacc ), q[i - 1] ); move32(); /* Q26 */ Lacc = L_add( Lacc, a[i - 1] ); /* Lacc=lpcCoeff[i-1] + lpcCoeff[order-i]//Q26 */ p[i] = L_sub( L_negate( Lacc ), p[i - 1] ); move32(); /* Q26 */ } /* Search roots of the P and Q polynomials */ v_low = polynomial_eval_fx( 0, p, order ); /* Q25 */ move16(); move16(); move16(); move16(); low = 0; high = 8; prev_rt = 0; rc = 0; /* root counter */ FOR( i = 0; i < 32; i++ ) { rt = root_search_fx( low, high, &v_low, p, order ); low = high; move16(); high = add( high, 8 ); IF( GE_16( rt, prev_rt ) ) { tfreq[rc] = rt; move16(); rc = add( rc, 2 ); } prev_rt = add( rt, 6 ); } /* End for P roots */ tfreq[rc] = 0x3f80; move16(); /* Set a high enough value as fake root for Q search */ IF( LT_16( rc, order ) ) { /* lost P root */ /* copy from previous LSP and return */ FOR( i = 0; i < order; i++ ) { move16(); freq[i] = old_freq[i]; } return ( 0 ); } ELSE { /* Search for Q roots between P roots */ v_low = L_deposit_h( 0x800 ); /* Init a positive value for v_low */ rc = 1; move16(); FOR( i = 0; i < order / 2; i++ ) { low = shr( tfreq[rc - 1], 6 ); high = add( shr( tfreq[rc + 1], 6 ), 1 ); rt = root_search_fx( low, high, &v_low, q, order ); IF( rt < 0 ) { /* No Q root in this interval */ /* copy from previous LSP and return */ FOR( i = 0; i < order; i++ ) { move16(); freq[i] = old_freq[i]; } return ( 0 ); } ELSE { move16(); tfreq[rc] = rt; rc = add( rc, 2 ); } /* end else, find Q root */ } /* end for */ } /* end else */ FOR( i = 0; i < order; i++ ) { freq[i] = tfreq[i]; move16(); } return ( 1 ); } #endif /*===================================================================*/ /* FUNCTION : lsp2lpc_fx () */ /*-------------------------------------------------------------------*/ Loading lib_com/options.h +2 −1 Original line number Diff line number Diff line Loading @@ -120,6 +120,7 @@ #define FIX_ISSUE_1167 /* Ittiam: Fix for Issue 1167: Encoder crash for OSBA ISM3SBA1 at 13.2 and 16.4 kbps in gauss_L2_ivas_fx() */ #define FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC /* FhG: Reduce workload of binaural rendering: replace 1./tmp & sqrt by Isqrt32 */ #define FIX_1113_OPT_DIRAC_BIN_REND /* FhG: Various optimizations to ivas_dirac_dec_binaual_functions.c */ #define FIX_ISSUE_1187 /* Ittiam: Fix for issue 1187: Assertion error observed in evs_enc_fx (with option stereo_dmx_evs) from bass_pf_enc_fx function*/ #define FIX_ISSUE_1186 /* Ittiam: Fix for Issue 1186: Energy/scaling issue for ISM-1 at all bitrates */ #define FIX_ISSUE_1187 /* Ittiam: Fix for issue 1187: Assertion error observed in evs_enc_fx (with option stereo_dmx_evs) from bass_pf_enc_fx function*/ #define FIX_ISSUE_1165 /* Ittiam: Fix for issue 1165: Assertion in lpc2lsp_fx for OMASA LTV input */ #endif lib_com/prot_fx.h +8 −0 Original line number Diff line number Diff line Loading @@ -808,6 +808,14 @@ Word16 lpc2lsp_fx( Word16 *old_freq, Word16 order ); #ifdef FIX_ISSUE_1165 Word16 lpc2lsp_ivas_fx( Word32 *a, Word16 *freq, Word16 *old_freq, Word16 order ); #endif void lsp2lpc_fx( Word16 *a, Word16 *freq, Loading lib_dec/hq_core_dec_fx.c +3 −0 Original line number Diff line number Diff line Loading @@ -649,6 +649,9 @@ void ivas_hq_core_dec_fx( set16_fx( gapsynth_fx, 0, L_FRAME48k ); set16_fx( num_bands_p, 0, MAX_SB_NB ); set16_fx( ynrm, 39, NB_SFM ); /* Initialize to the smallest value */ #ifdef MSAN_FIX set16_fx( wtda_audio_16, 0, 2 * L_FRAME48k ); #endif mean_en_high_fx = 0; move16(); Q_audio = 12; Loading lib_dec/ivas_stereo_dft_dec_fx.c +26 −0 Original line number Diff line number Diff line Loading @@ -124,13 +124,25 @@ void stereo_dft_dec_reset_fx( set16_fx( hStereoDft->res_pred_index_previous, 0, STEREO_DFT_BAND_MAX ); #ifdef MSAN_FIX FOR( i = 0; i < STEREO_DFT_BAND_MAX * 2; i++ ) { hStereoDft->res_gains_ind_fx[0][i] = 1006632960; /* 15.0f in Q26 */ move32(); } #else FOR( i = 0; i < STEREO_DFT_BAND_MAX; i++ ) { hStereoDft->res_gains_ind_fx[0][i] = 1006632960; /* 15.0f in Q26 */ move32(); } #endif #ifdef MSAN_FIX set32_fx( hStereoDft->res_gains_ind_fx[1], 0, STEREO_DFT_BAND_MAX * 2 ); #else set32_fx( hStereoDft->res_gains_ind_fx[1], 0, STEREO_DFT_BAND_MAX ); #endif /*residual coding*/ set16_fx( hStereoDft->res_cod_mode, hStereoDft->hConfig->res_cod_mode, STEREO_DFT_DEC_DFT_NB ); Loading Loading @@ -249,6 +261,19 @@ void stereo_dft_dec_reset_fx( hStereoDft->ipd_xfade_prev_fx = 0; move32(); #ifdef MSAN_FIX FOR( b = 0; b < 2 * IVAS_MAX_NUM_BANDS; b++ ) { FOR( i = 0; i < 2; i++ ) { FOR( j = 0; j < 4; j++ ) { hStereoDft->mixer_mat_smooth_fx[i][j][b] = 0; move32(); } } } #else FOR( b = 0; b < hStereoDft->nbands; b++ ) { FOR( i = 0; i < 2; i++ ) Loading @@ -260,6 +285,7 @@ void stereo_dft_dec_reset_fx( } } } #endif hStereoDft->first_frame = 1; move16(); hStereoDft->g_L_prev_fx = 0; Loading Loading
lib_com/lsf_tools_fx.c +147 −0 Original line number Diff line number Diff line Loading @@ -631,6 +631,153 @@ Word16 lpc2lsp_fx( return ( 1 ); } #ifdef FIX_ISSUE_1165 /*===================================================================*/ /* FUNCTION : lpc2lsp_ivas_fx () */ /*-------------------------------------------------------------------*/ /* PURPOSE : Convert LPC coefficients to LSP coefficients */ /*-------------------------------------------------------------------*/ /* INPUT ARGUMENTS : */ /* */ /* _ (Word32 []) a : LPC coefficients, Q27 */ /* _ (Word16 []) old_freq: Previous frame LSP coefficients, Q15 */ /* _ (Word16 []) order: LPC order */ /*-------------------------------------------------------------------*/ /* OUTPUT ARGUMENTS : */ /* _ (Word16 []) freq: LSP coefficients, Q15 */ /*-------------------------------------------------------------------*/ /* INPUT/OUTPUT ARGUMENTS : */ /* _ None */ /*-------------------------------------------------------------------*/ /* RETURN ARGUMENTS : */ /* _ (Word16) flag: 1 means all 10 LSPs are found, 0 otherwise */ /*===================================================================*/ /*NOTE: This function was created to avoid a crash that happens in the*/ /* first for loop of this function while performing L_shl on a in*/ /* lpc2lsp_fx, this computation assigns value to Lacc, which is */ /* kept in Q26 here to avoid L_shl when a has saturated value. */ Word16 lpc2lsp_ivas_fx( Word32 *a, Word16 *freq, Word16 *old_freq, Word16 order ) { Word16 i; Word16 rt, low, high, prev_rt, rc; Word32 p[11], q[11]; /* Q26 */ Word32 Ltemp, v_low; Word32 Lacc; Word16 tfreq[21]; /* First construct the P,Q polynomial */ /* p[0] = q[0] = 1 */ /* p[i] = -lpcCoeff[i] - lpcCoeff[11-i] - p[i-1] ( 1<=i<=5)*/ /* q[i] = -lpcCoeff[i] + lpcCoeff[11-i] + q[i-1] ( 1<=i<=5)*/ Ltemp = L_deposit_h( 0x400 ); /* Ltemp is 1.0 in Q26 */ p[0] = Ltemp; move32(); q[0] = Ltemp; move32(); FOR( i = 1; i < ( order / 2 ) + 1; i++ ) { Lacc = L_shr( a[order - i], 1 ); move32(); /* Q26 */ Lacc = L_sub( Lacc, L_shr( a[i - 1], 1 ) ); /* Lacc=-lpcCoeff[i-1] + lpcCoeff[order-i]//Q26 */ q[i] = L_add( ( Lacc ), q[i - 1] ); move32(); /* Q26 */ Lacc = L_add( Lacc, a[i - 1] ); /* Lacc=lpcCoeff[i-1] + lpcCoeff[order-i]//Q26 */ p[i] = L_sub( L_negate( Lacc ), p[i - 1] ); move32(); /* Q26 */ } /* Search roots of the P and Q polynomials */ v_low = polynomial_eval_fx( 0, p, order ); /* Q25 */ move16(); move16(); move16(); move16(); low = 0; high = 8; prev_rt = 0; rc = 0; /* root counter */ FOR( i = 0; i < 32; i++ ) { rt = root_search_fx( low, high, &v_low, p, order ); low = high; move16(); high = add( high, 8 ); IF( GE_16( rt, prev_rt ) ) { tfreq[rc] = rt; move16(); rc = add( rc, 2 ); } prev_rt = add( rt, 6 ); } /* End for P roots */ tfreq[rc] = 0x3f80; move16(); /* Set a high enough value as fake root for Q search */ IF( LT_16( rc, order ) ) { /* lost P root */ /* copy from previous LSP and return */ FOR( i = 0; i < order; i++ ) { move16(); freq[i] = old_freq[i]; } return ( 0 ); } ELSE { /* Search for Q roots between P roots */ v_low = L_deposit_h( 0x800 ); /* Init a positive value for v_low */ rc = 1; move16(); FOR( i = 0; i < order / 2; i++ ) { low = shr( tfreq[rc - 1], 6 ); high = add( shr( tfreq[rc + 1], 6 ), 1 ); rt = root_search_fx( low, high, &v_low, q, order ); IF( rt < 0 ) { /* No Q root in this interval */ /* copy from previous LSP and return */ FOR( i = 0; i < order; i++ ) { move16(); freq[i] = old_freq[i]; } return ( 0 ); } ELSE { move16(); tfreq[rc] = rt; rc = add( rc, 2 ); } /* end else, find Q root */ } /* end for */ } /* end else */ FOR( i = 0; i < order; i++ ) { freq[i] = tfreq[i]; move16(); } return ( 1 ); } #endif /*===================================================================*/ /* FUNCTION : lsp2lpc_fx () */ /*-------------------------------------------------------------------*/ Loading
lib_com/options.h +2 −1 Original line number Diff line number Diff line Loading @@ -120,6 +120,7 @@ #define FIX_ISSUE_1167 /* Ittiam: Fix for Issue 1167: Encoder crash for OSBA ISM3SBA1 at 13.2 and 16.4 kbps in gauss_L2_ivas_fx() */ #define FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC /* FhG: Reduce workload of binaural rendering: replace 1./tmp & sqrt by Isqrt32 */ #define FIX_1113_OPT_DIRAC_BIN_REND /* FhG: Various optimizations to ivas_dirac_dec_binaual_functions.c */ #define FIX_ISSUE_1187 /* Ittiam: Fix for issue 1187: Assertion error observed in evs_enc_fx (with option stereo_dmx_evs) from bass_pf_enc_fx function*/ #define FIX_ISSUE_1186 /* Ittiam: Fix for Issue 1186: Energy/scaling issue for ISM-1 at all bitrates */ #define FIX_ISSUE_1187 /* Ittiam: Fix for issue 1187: Assertion error observed in evs_enc_fx (with option stereo_dmx_evs) from bass_pf_enc_fx function*/ #define FIX_ISSUE_1165 /* Ittiam: Fix for issue 1165: Assertion in lpc2lsp_fx for OMASA LTV input */ #endif
lib_com/prot_fx.h +8 −0 Original line number Diff line number Diff line Loading @@ -808,6 +808,14 @@ Word16 lpc2lsp_fx( Word16 *old_freq, Word16 order ); #ifdef FIX_ISSUE_1165 Word16 lpc2lsp_ivas_fx( Word32 *a, Word16 *freq, Word16 *old_freq, Word16 order ); #endif void lsp2lpc_fx( Word16 *a, Word16 *freq, Loading
lib_dec/hq_core_dec_fx.c +3 −0 Original line number Diff line number Diff line Loading @@ -649,6 +649,9 @@ void ivas_hq_core_dec_fx( set16_fx( gapsynth_fx, 0, L_FRAME48k ); set16_fx( num_bands_p, 0, MAX_SB_NB ); set16_fx( ynrm, 39, NB_SFM ); /* Initialize to the smallest value */ #ifdef MSAN_FIX set16_fx( wtda_audio_16, 0, 2 * L_FRAME48k ); #endif mean_en_high_fx = 0; move16(); Q_audio = 12; Loading
lib_dec/ivas_stereo_dft_dec_fx.c +26 −0 Original line number Diff line number Diff line Loading @@ -124,13 +124,25 @@ void stereo_dft_dec_reset_fx( set16_fx( hStereoDft->res_pred_index_previous, 0, STEREO_DFT_BAND_MAX ); #ifdef MSAN_FIX FOR( i = 0; i < STEREO_DFT_BAND_MAX * 2; i++ ) { hStereoDft->res_gains_ind_fx[0][i] = 1006632960; /* 15.0f in Q26 */ move32(); } #else FOR( i = 0; i < STEREO_DFT_BAND_MAX; i++ ) { hStereoDft->res_gains_ind_fx[0][i] = 1006632960; /* 15.0f in Q26 */ move32(); } #endif #ifdef MSAN_FIX set32_fx( hStereoDft->res_gains_ind_fx[1], 0, STEREO_DFT_BAND_MAX * 2 ); #else set32_fx( hStereoDft->res_gains_ind_fx[1], 0, STEREO_DFT_BAND_MAX ); #endif /*residual coding*/ set16_fx( hStereoDft->res_cod_mode, hStereoDft->hConfig->res_cod_mode, STEREO_DFT_DEC_DFT_NB ); Loading Loading @@ -249,6 +261,19 @@ void stereo_dft_dec_reset_fx( hStereoDft->ipd_xfade_prev_fx = 0; move32(); #ifdef MSAN_FIX FOR( b = 0; b < 2 * IVAS_MAX_NUM_BANDS; b++ ) { FOR( i = 0; i < 2; i++ ) { FOR( j = 0; j < 4; j++ ) { hStereoDft->mixer_mat_smooth_fx[i][j][b] = 0; move32(); } } } #else FOR( b = 0; b < hStereoDft->nbands; b++ ) { FOR( i = 0; i < 2; i++ ) Loading @@ -260,6 +285,7 @@ void stereo_dft_dec_reset_fx( } } } #endif hStereoDft->first_frame = 1; move16(); hStereoDft->g_L_prev_fx = 0; Loading