diff --git a/lib_com/bits_alloc.c b/lib_com/bits_alloc.c index ff840a9a631cdbfd0c772a76b323b08be11087ef..3e3faf95644910097e4046690bfc1d7bdbf5ec8c 100644 --- a/lib_com/bits_alloc.c +++ b/lib_com/bits_alloc.c @@ -476,19 +476,26 @@ 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 */ - step = fcb_table( fixed_cdk_index[sfr] + 1, L_subfr ) - fcb_table( fixed_cdk_index[sfr], L_subfr ); - if ( *nBits >= step && cdbk >= 0 ) +#ifdef NONBE_FIX_694_OMASA_ACELP + if ( fixed_cdk_index[sfr] < ACELP_FIXED_CDK_NB - 1 ) { - fixed_cdk_index[sfr]++; - *nBits -= step; - - if ( *nBits >= step && fixed_cdk_index[sfr + 1] == fixed_cdk_index[sfr] - 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 ) { - sfr++; fixed_cdk_index[sfr]++; *nBits -= step; + + if ( *nBits >= step && fixed_cdk_index[sfr + 1] == fixed_cdk_index[sfr] - 1 ) + { + sfr++; + fixed_cdk_index[sfr]++; + *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 ) diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index 8282cb9dbdd173f65ea34d91eed100e0cfbc9b74..5dfb2b0e3dde29fbb244db559db978d5abfd16b6 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -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 */ diff --git a/lib_com/options.h b/lib_com/options.h index 4eac787b42719fb16a8c46ef638c6b897bced99a..bb7652a6a274fff01ff23ae6632104db970079be 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -167,7 +167,7 @@ #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_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 */ /* ##################### End NON-BE switches ############################# */