Commit 22fc24c3 authored by advasila's avatar advasila
Browse files

fix crash on 2 objects in OMASA

parent be825bd1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1929,6 +1929,10 @@ 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                                */
#ifdef FIX_694_OMASA_EXTREME 
    ,
    const int32_t real_brate                                   /* i  : real available brate                             */
#endif
);

void stereo_classifier_init(
+12 −0
Original line number Diff line number Diff line
@@ -181,7 +181,19 @@ ivas_error ivas_cpe_enc(

    if ( sts[0]->ini_frame > 0 && st_ivas->hMCT == NULL )
    {
#ifdef FIX_694_OMASA_EXTREME
        if ( ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 )
        {
            hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate, element_brate_ref + hCPE->brate_surplus - nb_bits_metadata * FRAMES_PER_SEC );
        }
        else
        {
            hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate, ivas_total_brate );
        }
#else
        hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate );
#endif
    
    }

#ifdef MASA_AND_OBJECTS
+7 −0
Original line number Diff line number Diff line
@@ -90,6 +90,10 @@ 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            */
#ifdef FIX_694_OMASA_EXTREME
    ,
    const int32_t real_brate    /* i  : bitrate surplus in MASA_ISM_FORMAT   */
#endif
)
{
    int16_t element_mode;
@@ -112,6 +116,9 @@ int16_t select_stereo_mode(

    stereo_switching_flag = 1;
    if ( hCPE->element_brate >= MIN_BRATE_MDCT_STEREO || ( ivas_format >= MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE )
#ifdef FIX_694_OMASA_EXTREME
         || ( ivas_format >= MASA_FORMAT && real_brate < MASA_STEREO_MIN_BITRATE ) /* both conditions should stay such that the second one is activated only when the surplus bitrate is negative*/
#endif
#ifdef DEBUGGING
         || ( hCPE->stereo_mode_cmdl == IVAS_CPE_DFT || hCPE->stereo_mode_cmdl == IVAS_CPE_TD )
#endif