Commit 14fea47b authored by fotopoulou's avatar fotopoulou
Browse files

Merge branch 'main' into 752-osba-mct-misconfiguration-causes-crashes-at-256kbps

parents 2b550e7a eb137f09
Loading
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -476,6 +476,10 @@ static ivas_error acelp_FCB_allocator(
        }

        /* try to increase the FCB of the first subframe in cases when the next step is lower than the current step */
#ifdef NONBE_FIX_694_OMASA_ACELP
        if ( fixed_cdk_index[sfr] < ACELP_FIXED_CDK_NB - 1 )
        {
#endif
            step = fcb_table( fixed_cdk_index[sfr] + 1, L_subfr ) - fcb_table( fixed_cdk_index[sfr], L_subfr );
            if ( *nBits >= step && cdbk >= 0 )
            {
@@ -489,6 +493,9 @@ static ivas_error acelp_FCB_allocator(
                    *nBits -= step;
                }
            }
#ifdef NONBE_FIX_694_OMASA_ACELP
        }
#endif
    }
    /* TRANSITION coding: allocate highest FCBQ bit-budget to the subframe with the glottal-shape codebook */
    if ( tc_subfr >= L_SUBFR )
+4 −0
Original line number Diff line number Diff line
@@ -1187,7 +1187,11 @@ enum

#define QMETADATA_MAXBIT_REQ_MASA               900                         /* max bit-bit/direction for avoiding requantization in MASA path */
#define QMETADATA_MAXBIT_REQ_SBA                400                         /* max bit-bit/direction for avoiding requantization in SBA path */
#ifdef NONBE_FIX_760_COHERENCE_MASA
#define MASA_COH_LIMIT_2IDX                     96                          /* limit for sum of values across components for having two joint indexes */
#else
#define MASA_COH_LIMIT_2IDX                     144                         /* limit for sum of values across components for having two joint indexes */
#endif
#define QMETADATA_MAX_NO_DIRECTIONS             2
#define MASA_MAX_BITS                           1300                        /* max. bit-budget for MASA metadata */

+11 −0
Original line number Diff line number Diff line
@@ -308,7 +308,18 @@ void tdm_bit_alloc(
    {
        *total_brate_sec = min( *total_brate_sec, element_brate_wo_meta - ( 5900 + BWE_brate ) );

#ifdef NONBE_FIX_694_OMASA_ACELP
        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 */
        }
#else
        *total_brate_sec = max( *total_brate_sec, tdm_bit_allc_tbl[idx][coder_type] ); /* sanity check to ensure the secondary channel always gets the minimal bitrate it needs */
#endif
    }

    /* Secondary channel bitrate adjusment                                                      */
+3 −2
Original line number Diff line number Diff line
@@ -160,14 +160,15 @@

/* #################### End BE switches ################################## */


/* #################### Start NON-BE switches ############################ */
/* any switch which is non-be wrt selection floating point code */
/* all switches in this category should start with "NONBE_" */

#define NONBE_FIX_736_FOA_BR_SWITCH                           /* FhG/Dlb : Issue 736: FOA bitrate switching decoding crashes in in ivas_spar_to_dirac */
#define NONBE_FIX_746_NONDIEGETIC_MD                          /* Eri: Issue 746: The non-diegetic panning flag affects the encoder bitstream even if extended metadata is not enabled. Crashes the decoder.*/
#define NONBE_FIX_752_OSBA_MISCONFIG_MCT                    /* FhG: issue 752: misconfiguration of MCT causes crashes for coding with sampling rate under 48kHz at 256kbps*/
#define NONBE_FIX_729_ASAN_2ISM_ACELP                         /* VA: issue 729: fix ASAN ACELP errors with 2 ISM coding using LTV */
#define NONBE_FIX_694_OMASA_ACELP                             /* Nokia: Issue #694: OMASA crash in ACELP with extreme item */
#define NONBE_FIX_760_COHERENCE_MASA                          /* Nokia: Issue 760: fixes decoder crash for some cases when all energy ratios are 1 */#define NONBE_FIX_752_OSBA_MISCONFIG_MCT                    /* FhG: issue 752: misconfiguration of MCT causes crashes for coding with sampling rate under 48kHz at 256kbps*/
/* ##################### End NON-BE switches ############################# */

/* ################## End DEVELOPMENT switches ######################### */
+18 −3
Original line number Diff line number Diff line
@@ -3774,9 +3774,13 @@ static int16_t read_coherence_data(
    uint16_t byteBuffer;
    int16_t idx_ER;
    int16_t min_index;

#ifdef NONBE_FIX_760_COHERENCE_MASA
    int16_t extra_cv;
#endif
    coding_subbands = hQMetaData->q_direction[idx_dir].cfg.nbands;

#ifdef NONBE_FIX_760_COHERENCE_MASA
    extra_cv = (int16_t) ( coding_subbands / MASA_FACTOR_CV_COH );
#endif
    q_direction = &( hQMetaData->q_direction[idx_dir] );
    bit_pos = *p_bit_pos;
    nbits = 0;
@@ -3787,12 +3791,19 @@ static int16_t read_coherence_data(
        {
            if ( hrmasa_flag )
            {
#ifdef NONBE_FIX_760_COHERENCE_MASA
                idx_ER = 7 - ( q_direction->band_data[j].energy_ratio_index_mod[0] >> 1 ) + extra_cv;
#else
                idx_ER = 7 - ( q_direction->band_data[j].energy_ratio_index_mod[0] >> 1 ) + coding_subbands / MASA_FACTOR_CV_COH;
#endif
            }
            else
            {

#ifdef NONBE_FIX_760_COHERENCE_MASA
                idx_ER = 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + extra_cv;
#else
                idx_ER = 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + coding_subbands / MASA_FACTOR_CV_COH;
#endif
            }
            no_cv_vec[j] = idx_ER + 1;
        }
@@ -3812,7 +3823,11 @@ static int16_t read_coherence_data(
        if ( byteBuffer & 1 )
        {
            /* decode GR min removed */
#ifdef NONBE_FIX_760_COHERENCE_MASA
            nbits += read_GR_min_removed_data( bitstream, &bit_pos, no_cv_vec, coding_subbands, decoded_idx, MASA_MAX_NO_CV_SUR_COH + extra_cv );
#else
            nbits += read_GR_min_removed_data( bitstream, &bit_pos, no_cv_vec, coding_subbands, decoded_idx, MASA_MAX_NO_CV_SUR_COH );
#endif
            for ( j = 0; j < coding_subbands; j++ )
            {
                if ( no_cv_vec[j] > 1 )
Loading