From 682108544df9fa581d19c721a4fd85486c169ed8 Mon Sep 17 00:00:00 2001 From: vaclav Date: Sun, 14 Sep 2025 19:06:24 +0200 Subject: [PATCH 1/2] fix issue 2011: decoding of a bitstream with first frame lost; under FIX_2011_BSTR_FIRST_LOST --- lib_com/options.h | 2 ++ lib_dec/lib_dec_fx.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 31c786278..9c1ae0f6f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,6 +100,8 @@ #define FIX_ISSUE_2013_MDCT_STEREO_FER_DISCONTINUITIES /* Eri/FhG: Issue 2013 fix for FER discontinuities */ #define FIX_2000_NON_LINEARITY_OVERSHOOT /* Eri: Issue 2000: SWB TBE energy overshoot in non-linearity. Aligns with float */ +#define FIX_2011_BSTR_FIRST_LOST /* VA: issue 2011: decoding of a bitstream with first frame lost */ + /* #################### Start BASOP porting switches ############################ */ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index c1cc0bd04..187ab742d 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1138,6 +1138,11 @@ ivas_error IVAS_DEC_GetSamples( { hIvasDec->hasBeenFedFrame = false; move16(); +#ifdef FIX_2011_BSTR_FIRST_LOST + set16_fx( pcmBuf, 0, imult1616( hIvasDec->st_ivas->hDecoderConfig->nchan_out, nSamplesAsked ) ); + nSamplesRendered = nSamplesAsked; + hIvasDec->nSamplesAvailableNext -= nSamplesAsked; +#else set16_fx( pcmBuf, 0, imult1616( hIvasDec->st_ivas->hDecoderConfig->nchan_out, nSamplesAsked ) ); hIvasDec->nSamplesRendered = add( hIvasDec->nSamplesRendered, nSamplesAsked ); move16(); @@ -1152,6 +1157,7 @@ ivas_error IVAS_DEC_GetSamples( move16(); move16(); } +#endif } ELSE { @@ -1324,6 +1330,13 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } +#ifdef FIX_2011_BSTR_FIRST_LOST + IF( !hIvasDec->hasBeenFedFirstGoodFrame ) + { + return IVAS_ERR_OK; + } + +#endif st_ivas = hIvasDec->st_ivas; output_config = st_ivas->hDecoderConfig->output_config; output_Fs = st_ivas->hDecoderConfig->output_Fs; -- GitLab From 27de2629a0961c35fa463740811dcdc77ab31db4 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 16 Sep 2025 18:46:19 +0200 Subject: [PATCH 2/2] Apply 1 suggestion(s) to 1 file(s) Co-authored-by: Archit Tamarapu --- lib_dec/lib_dec_fx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 187ab742d..77b250750 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1141,7 +1141,8 @@ ivas_error IVAS_DEC_GetSamples( #ifdef FIX_2011_BSTR_FIRST_LOST set16_fx( pcmBuf, 0, imult1616( hIvasDec->st_ivas->hDecoderConfig->nchan_out, nSamplesAsked ) ); nSamplesRendered = nSamplesAsked; - hIvasDec->nSamplesAvailableNext -= nSamplesAsked; + move16(); + hIvasDec->nSamplesAvailableNext = sub( hIvasDec->nSamplesAvailableNext, nSamplesAsked ); #else set16_fx( pcmBuf, 0, imult1616( hIvasDec->st_ivas->hDecoderConfig->nchan_out, nSamplesAsked ) ); hIvasDec->nSamplesRendered = add( hIvasDec->nSamplesRendered, nSamplesAsked ); -- GitLab