Commit c83d31aa authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge branch '874-omasa-ltv-crashes-for-bitrate-switching-to-td-stereo' into 'main'

[NonBE] Resolve "OMASA ltv crashes for bitrate switching to TD stereo"

See merge request !1182
parents 3291069a a1e0de57
Loading
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1925,8 +1925,10 @@ void stereo_icBWE_decproc(
/*! r: element mode */
int16_t select_stereo_mode(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure                           */
    const IVAS_FORMAT ivas_format,                              /* i  : IVAS format                                     */
    const int32_t ivas_total_brate                              /* i  : IVAS total brate                                */
    const IVAS_FORMAT ivas_format                               /* i  : IVAS format                                     */
#ifndef NONBE_FIX_874_OMASA_BRSW_2TD
   ,const int32_t ivas_total_brate                              /* i  : IVAS total brate                                */
    #endif
);

void stereo_classifier_init(
+13 −1
Original line number Diff line number Diff line
@@ -307,7 +307,7 @@ void tdm_bit_alloc(
    else
    {
        *total_brate_sec = min( *total_brate_sec, element_brate_wo_meta - ( 5900 + BWE_brate ) );

#ifndef NONBE_FIX_874_OMASA_BRSW_2TD
        if ( coder_type == INACTIVE )
        {
            *total_brate_sec = max( *total_brate_sec, tdm_bit_allc_tbl[0][0] ); /* sanity check to ensure the secondary channel always gets the minimal bitrate it needs */
@@ -316,7 +316,19 @@ void tdm_bit_alloc(
        {
            *total_brate_sec = max( *total_brate_sec, 3500 ); /* sanity check to ensure the secondary channel always gets the minimal bitrate it needs */
        }
#endif
    }

#ifdef NONBE_FIX_874_OMASA_BRSW_2TD
    if ( coder_type == INACTIVE )
    {
        *total_brate_sec = max( *total_brate_sec, tdm_bit_allc_tbl[0][0] ); /* sanity check to ensure the secondary channel always gets the minimal bitrate it needs */
    }
    else
    {
        *total_brate_sec = max( *total_brate_sec, 3500 ); /* sanity check to ensure the secondary channel always gets the minimal bitrate it needs */
    }
#endif

    /* Secondary channel bitrate adjusment                                                      */
    /* First, adjust the bitrate depending of what is transmitted                               */
+1 −0
Original line number Diff line number Diff line
@@ -162,6 +162,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_836_PARAMUPMIX_HEADROT                      /* Dlb: issue #836: Resolve "ParamUpmix MC to SBA conversion done on the already binaurlized output" */
#define NONBE_FIX_874_OMASA_BRSW_2TD                          /* Nokia: issue 874: Fixes the crashes with the long test vectors that prompted switching to TD*/

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

+4 −0
Original line number Diff line number Diff line
@@ -200,6 +200,7 @@ ivas_error ivas_jbm_dec_tc(
    {
        set_s( nb_bits_metadata, 0, MAX_SCE );


        /* read parameters from the bitstream */
        if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hQMetaData != NULL )
        {
@@ -225,6 +226,9 @@ ivas_error ivas_jbm_dec_tc(

        if ( st_ivas->nchan_transport == CPE_CHANNELS && st_ivas->nCPE >= 1 )
        {
#ifdef NONBE_FIX_874_OMASA_BRSW_2TD
            st_ivas->hCPE[0]->brate_surplus = 0;
#endif
            st_ivas->hCPE[0]->element_brate = ivas_total_brate;
        }

+4 −0
Original line number Diff line number Diff line
@@ -176,7 +176,11 @@ ivas_error ivas_cpe_enc(

    if ( sts[0]->ini_frame > 0 && st_ivas->hMCT == NULL )
    {
#ifdef NONBE_FIX_874_OMASA_BRSW_2TD
        hCPE->element_mode = select_stereo_mode( hCPE, ivas_format );
#else
        hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate );
#endif
    }

    stereo_mode_combined_format_enc( st_ivas, hCPE );
Loading