Commit 4920cc29 authored by malenovsky's avatar malenovsky
Browse files

Merge branch '1130-usan-division-by-zero-in-levinson-durbin-algorithm-in-wb-tbe' into 'main'

Resolve "USAN: division-by-zero in levinson durbin algorithm in WB TBE"

See merge request !1641
parents 2add32b3 2f98b8b1
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@

#define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER                  /* FhG: issue 1128: set output ambisonics order to input order for EXT output */
#define NONBE_FIX_1052_SBA_EXT_FIX                            /* VA: SBA external output support fix - do not overwrite "output_config" parameter */
#define NONBE_FIX_1130_DIV_ZERO_LEV_DUR                       /* VA: issue 1130: avoid div by zero in L-D by thresholding R[0] to a min value of 100.0 */


/* ##################### End NON-BE switches ########################### */
+9 −0
Original line number Diff line number Diff line
@@ -280,6 +280,15 @@ void wb_tbe_enc(
    }

    autocorr( hb_old_speech, R, LPC_SHB_ORDER_WB + 1, ( NS2SA( INT_FS_12k8, 5000000L ) + L_SUBFR + L_FRAME ) * 5 / 16, win_lpc_hb_wb, 0, 1, 1 );

#ifdef NONBE_FIX_1130_DIV_ZERO_LEV_DUR
    if ( st->element_mode > EVS_MONO )
    {
        /* Ensure R[0] isn't zero when entering Levinson-Durbin */
        R[0] = max( R[0], 1.0e-8f );
    }
#endif

    lev_dur( lpc_wb_temp, R, LPC_SHB_ORDER_WB, ervec_temp );
    a2lsp( lsp_wb_temp, lpc_wb_temp, LPC_SHB_ORDER_WB );
    lsp_spacing = 0.5f;