Commit 3b566a13 authored by vaclav's avatar vaclav
Browse files

Merge branch '562-ism2-at-64kbps-performs-worse-than-at-48-kbps' into 'main'

[non-BE] Resolve "ISM2 at 64kbps performs worse than at 48 kbps"

See merge request !768
parents ba24642b 65867b68
Loading
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -61,6 +61,10 @@
#define BETA_ISM_LOW_IMP    0.6f
#define BETA_ISM_MEDIUM_IMP 0.8f

#ifdef FIX_562_ISM2_64KBPS
#define MAX_BRATE_TCX_32k 48000
#endif


/*-------------------------------------------------------------------*
 * bitbudget_to_brate()
@@ -346,6 +350,23 @@ ivas_error ivas_ism_config(
            bits_CoreCoder[ch] = tmp;
        }

#ifdef FIX_562_ISM2_64KBPS
        /* limitaton to avoid too high bitrate in one active TCX channel */
        if ( element_brate[0] >= SCE_CORE_16k_LOW_LIMIT && element_brate[0] <= IVAS_32k )
        {
            diff = 0;
            limit_high = MAX_BRATE_TCX_32k / FRAMES_PER_SEC;

            for ( ch = 0; ch < n_ISms; ch++ )
            {
                tmp = (int16_t) min( bits_CoreCoder[ch], limit_high );

                diff += bits_CoreCoder[ch] - tmp;
                bits_CoreCoder[ch] = tmp;
            }
        }
#endif

        if ( diff > 0 )
        {
            ch = 0;
+3 −0
Original line number Diff line number Diff line
@@ -167,6 +167,9 @@
#define FIX_564                                         /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */
#define FIX_566_2DIR_MASA_384K                          /* Nokia: Issued 566:  Bugfix in 384k MASA metadata encoding of second direction */

#define FIX_562_ISM2_64KBPS                             /* VA: issue 562: fix ISM2 at 64kbps issue */


/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */

+5 −0
Original line number Diff line number Diff line
@@ -542,7 +542,12 @@ ivas_error ivas_ism_metadata_dec(
            if ( ism_mode == ISM_MODE_DISC )
            {
#ifdef FIX_532_ISM_MD_INACTIVE
#ifdef FIX_562_ISM2_64KBPS
                if ( ism_imp[ch] == ISM_NO_META && ( ( total_brate[ch] < ACELP_8k00 && element_brate[ch] < SCE_CORE_16k_LOW_LIMIT ) ||
                                                     ( total_brate[ch] <= ACELP_16k_LOW_LIMIT && element_brate[ch] >= SCE_CORE_16k_LOW_LIMIT ) ) )
#else
                if ( ism_imp[ch] == ISM_NO_META && total_brate[ch] < ACELP_8k00 )
#endif
#else
                if ( hIsmMeta[ch]->ism_metadata_flag == 0 && localVAD[ch] == 0 && ism_metadata_flag_global )
#endif
+5 −0
Original line number Diff line number Diff line
@@ -636,7 +636,12 @@ ivas_error ivas_ism_metadata_enc(
        if ( ism_mode == ISM_MODE_DISC )
        {
#ifdef FIX_532_ISM_MD_INACTIVE
#ifdef FIX_562_ISM2_64KBPS
            if ( ism_imp[ch] == ISM_NO_META && ( ( total_brate[ch] < ACELP_8k00 && element_brate[ch] < SCE_CORE_16k_LOW_LIMIT ) ||
                                                 ( total_brate[ch] <= ACELP_16k_LOW_LIMIT && element_brate[ch] >= SCE_CORE_16k_LOW_LIMIT ) ) )
#else
            if ( ism_imp[ch] == ISM_NO_META && total_brate[ch] < ACELP_8k00 )
#endif
#else
            if ( hIsmMeta[ch]->ism_metadata_flag == 0 && vad_flag[ch] == 0 && ism_metadata_flag_global )
#endif