Commit 368e59c9 authored by fotopoulou's avatar fotopoulou
Browse files

Merge branch 'main' into add-plc-conditions-for-OSBA-in-self-test

parents ba0c10b2 ccfb71e3
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -175,6 +175,8 @@
#define NONBE_FIX_898_ISM_BRATE_CRASH                         /* VA: issue 898: fix decoder crash in ISM bitrate switching with DTX and binaural output */
#define NONBE_FIX_862_UBSAN_SPAR_DEC_BR_SW_PLC                /* DLB: issue 862 : UBSAN: out-of-bound error in SPAR for OSBA bitrate switching with PLC*/
#define NONBE_FIX_DISCRETE_ISM_NOISE_SEED_HANDLING            /* FhG: fix handling of common and differing noise seeds in SCEs for ISM DTX */
#define NONBE_FIX_913_OMASA_BITBUDGET_VIOLATION               /* VA/Nok: issue 913: Resolve "Crash in OMASA encoder - DFT-Stereo bit-budget violated" */


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

+11 −0
Original line number Diff line number Diff line
@@ -260,6 +260,17 @@ 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;
                    if ( hCPE->brate_surplus < 0 )
                    {
                        nb_bits += (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC );
                    }
                }

#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 );
            }

+23 −1
Original line number Diff line number Diff line
@@ -656,19 +656,41 @@ ivas_error ivas_cpe_enc(
            if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT )
            {
                max_bits -= nb_bits_metadata;
#ifdef NONBE_FIX_913_OMASA_BITBUDGET_VIOLATION
                if ( hCPE->brate_surplus < 0 )
                {
#endif
                    max_bits += (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC );
#ifdef NONBE_FIX_913_OMASA_BITBUDGET_VIOLATION
                }
#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
#ifdef DEBUGGING
            if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT )
            {
                assert( ( ( hCPE->element_brate / FRAMES_PER_SEC - nb_bits - nb_bits_metadata + (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC ) ) >= ( 0.8f * sts[0]->bits_frame_nominal ) ) && "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
#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 );
        }