Commit 24d5f878 authored by vaclav's avatar vaclav
Browse files

issue 913: Resolve "Crash in OMASA encoder - DFT-Stereo bit-budget violated";...

issue 913: Resolve "Crash in OMASA encoder - DFT-Stereo bit-budget violated"; under fix NONBE_FIX_913_OMASA_BITBUDGET_VIOLATION
parent fe26d687
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -164,6 +164,7 @@
#define NONBE_FIX_856_TCX_LTP_SYNTH_FILTER                    /* FhG: issue 856: correct filtering length for tcx-ltp synth filtering*/
#define NONBE_UNIFIED_DECODING_PATHS                          /* FhG: unify decoding paths   */
#define NONBE_FIX_871_ACELP_CRASH_IN_OSBA                     /* FhG: isse 871: crash in ACELP core encoder with OSBA */
#define NONBE_FIX_913_OMASA_BITBUDGET_VIOLATION               /* VA: issue 913: Resolve "Crash in OMASA encoder - DFT-Stereo bit-budget violated" */

/* ##################### End NON-BE switches ########################### */

+9 −0
Original line number Diff line number Diff line
@@ -256,6 +256,15 @@ ivas_error ivas_cpe_dec(
            }
            else
            {
#ifdef NONBE_FIX_913_OMASA_BITBUDGET_VIOLATION
                if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT )
                {
                    nb_bits -= nb_bits_metadata;
                    nb_bits += (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC );
                    nb_bits = min( nb_bits, 800 - 32 );
                }
#endif

                stereo_dft_dec_read_BS( ivas_total_brate, hCPE->element_brate, &sts[0]->total_brate, sts[1], hCPE->hStereoDft, sts[0]->bwidth, output_frame, res_buf, &nb_bits, hCPE->hStereoCng->coh, st_ivas->ivas_format );
            }

+8 −0
Original line number Diff line number Diff line
@@ -657,17 +657,25 @@ ivas_error ivas_cpe_enc(
            {
                max_bits -= nb_bits_metadata;
                max_bits += (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC );
#ifdef NONBE_FIX_913_OMASA_BITBUDGET_VIOLATION
                nb_bits = min( nb_bits, 800 - 32 );
#endif
            }

            stereo_dft_enc_res( hCPE->hStereoDft, old_inp_12k8[1] + L_INP_MEM - STEREO_DFT_OVL_8k, hCPE->hMetaData, &nb_bits, max_bits );
        }

        if ( sts[0]->core_brate == FRAME_NO_DATA || sts[0]->core_brate == SID_2k40 )
        {
            assert( ( nb_bits <= ( ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS ) ) && "Stereo DFT CNG: bit budget is violated" );
        }
        else
        {
#ifdef NONBE_FIX_913_OMASA_BITBUDGET_VIOLATION
            assert( ( nb_bits >= 0 ) && "Stereo DFT: bit budget is violated" );
#else
            assert( ( ( hCPE->element_brate / FRAMES_PER_SEC - nb_bits ) >= ( 0.8f * sts[0]->bits_frame_nominal ) ) && "Stereo DFT: bit budget is violated" );
#endif

            /* Flexible total bitrate in M channel */
            sts[0]->total_brate = hCPE->element_brate - ( nb_bits * FRAMES_PER_SEC );