From 0e5b6d6c2c42abe812021f5229a3044d7f798eba Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 6 Jun 2023 17:38:09 +0200 Subject: [PATCH 1/2] fix issue 531; under FIX_531_BWS_ISM_BFI --- apps/decoder.c | 14 ++++++++------ lib_com/options.h | 2 ++ lib_com/swb_bwe_com.c | 1 + lib_dec/ivas_core_dec.c | 4 ++++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 7ceda8f6f3..dd531b4ffa 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1776,12 +1776,14 @@ static ivas_error decodeG192( goto cleanup; } } - /* Run decoder for one frame (get rendered output) */ - if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamples ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError: could not get samples from decoder: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } + + if ( frame > 3200 ) + /* Run decoder for one frame (get rendered output) */ + if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamples ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: could not get samples from decoder: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } /* Continue checking for first good frame until it is found */ if ( !decodedGoodFrame ) diff --git a/lib_com/options.h b/lib_com/options.h index 6deb68b869..285fdd3be2 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -243,6 +243,8 @@ #define BINAURAL_AUDIO_CMDLINE #define FIX_570_TCX_LPC_WRITE /* FhG: fix issue 570: LPC bitstream writer in TCX */ #define FIX_506 /* FhG: Compiler warnings */ +#define FIX_531_BWS_ISM_BFI /* VA: issue 531: fix MemorySanitizer: use-of-uninitialized-value in ISM2 rate switching with frame errors */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_com/swb_bwe_com.c b/lib_com/swb_bwe_com.c index 4efbaa735d..21937632f8 100644 --- a/lib_com/swb_bwe_com.c +++ b/lib_com/swb_bwe_com.c @@ -309,6 +309,7 @@ void calc_tilt_bwe( } *tilt = (float) ( r1 / sqrt( r0 ) ); + dbgwrite( &sp[0], 4, 1, 960, "res/aa" ); return; } diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 9d6211bf8f..3367cd5d71 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -504,7 +504,11 @@ ivas_error ivas_core_dec( * SWB(FB) BWE decoding *---------------------------------------------------------------------*/ +#ifdef FIX_531_BWS_ISM_BFI + if ( st->extl == SWB_TBE || st->extl == FB_TBE || ( st->coder_type != AUDIO && st->coder_type != INACTIVE && st->core_brate >= SID_2k40 && st->core == ACELP_CORE && !st->con_tcx && output_Fs >= 32000 && st->bwidth > NB && st->bws_cnt > 0 ) ) +#else if ( st->extl == SWB_TBE || st->extl == FB_TBE || ( st->coder_type != AUDIO && st->coder_type != INACTIVE && st->core_brate >= SID_2k40 && st->core == ACELP_CORE && output_Fs >= 32000 && st->bwidth > NB && st->bws_cnt > 0 ) ) +#endif { /* SWB TBE decoder */ swb_tbe_dec( st, hStereoICBWE, bwe_exc_extended[n], voice_factors[n], old_syn_12k8_16k[n], tmp_buffer /*fb_exc*/, hb_synth[n], pitch_buf[n] ); -- GitLab From 099c0da16d83905e2cfc37a46da9a9fab1d4d056 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 6 Jun 2023 17:40:08 +0200 Subject: [PATCH 2/2] remove debugging code --- apps/decoder.c | 14 ++++++-------- lib_com/swb_bwe_com.c | 1 - 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index dd531b4ffa..7ceda8f6f3 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1776,14 +1776,12 @@ static ivas_error decodeG192( goto cleanup; } } - - if ( frame > 3200 ) - /* Run decoder for one frame (get rendered output) */ - if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamples ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError: could not get samples from decoder: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } + /* Run decoder for one frame (get rendered output) */ + if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamples ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: could not get samples from decoder: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } /* Continue checking for first good frame until it is found */ if ( !decodedGoodFrame ) diff --git a/lib_com/swb_bwe_com.c b/lib_com/swb_bwe_com.c index 21937632f8..4efbaa735d 100644 --- a/lib_com/swb_bwe_com.c +++ b/lib_com/swb_bwe_com.c @@ -309,7 +309,6 @@ void calc_tilt_bwe( } *tilt = (float) ( r1 / sqrt( r0 ) ); - dbgwrite( &sp[0], 4, 1, 960, "res/aa" ); return; } -- GitLab