Commit c570cb89 authored by vaclav's avatar vaclav
Browse files

Issue 230: fix bitbudget distribution in inactive frames in ISM format; under FIX_ISM_INACTIVE_BITS

parent 4353d954
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -199,7 +199,11 @@ ivas_error ivas_ism_config(
        diff = 0;
        for ( ch = 0; ch < n_ISms; ch++ )
        {
#ifdef FIX_ISM_INACTIVE_BITS
            int16_t limit;
#else
            int32_t limit;
#endif

            limit = MIN_BRATE_SWB_BWE / FRMS_PER_SECOND;
            if ( element_brate[ch] < MIN_BRATE_SWB_STEREO ) /* replicate function set_bw() -> check the coded audio band-width */
@@ -219,12 +223,20 @@ ivas_error ivas_ism_config(
            else if ( ism_imp[ch] == ISM_LOW_IMP )
            {
                tmp = (int16_t) ( BETA_ISM_LOW_IMP * bits_CoreCoder[ch] );
#ifdef FIX_ISM_INACTIVE_BITS
                tmp = max( limit, tmp );
#else
                tmp = (int16_t) max( limit, bits_CoreCoder[ch] - tmp );
#endif
            }
            else if ( ism_imp[ch] == ISM_MEDIUM_IMP )
            {
                tmp = (int16_t) ( BETA_ISM_MEDIUM_IMP * bits_CoreCoder[ch] );
#ifdef FIX_ISM_INACTIVE_BITS
                tmp = max( limit, tmp );
#else
                tmp = (int16_t) max( limit, bits_CoreCoder[ch] - tmp );
#endif
            }
            else /* ism_imp[ch] == ISM_HIGH_IMP */
            {
+2 −2
Original line number Diff line number Diff line
@@ -173,10 +173,10 @@
#define FIX_DTX_RANGE                                   /* Issue 118: fix the DTX usage: default DTX up to 64 kbps, otherwise only in silence */
#define FIX_ISM_METADATA_READER                         /* Issue 211: make ISM metadata file reader robust against invalid files */
#define FIX_GET_DELAY_RETURN                            /* Issue 223: change return data type in function get_delay() */

/* NTT switches */
#define NTT_REDUC_COMP_POC                              /* Contribution  : Complexity reduction of phase spectrum in stereo downmix*/

#define FIX_ISM_INACTIVE_BITS                           /* fix bitbudget distribution in inactive frames in ISM format */

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
#endif
+1 −0
Original line number Diff line number Diff line
@@ -438,6 +438,7 @@ ivas_error ivas_core_enc(
        dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "extl_brate", n, id, ENC ) );

        dbgwrite( &st->coder_type, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "coder_type", n, id, ENC ) );
        dbgwrite( &st->coder_type_raw, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "coder_type_raw", n, id, ENC ) );
        dbgwrite( &st->clas, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "clas", n, id, ENC ) );
        dbgwrite( &st->cng_type, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "cng_type", n, id, ENC ) );
        dbgwrite( &st->L_frame, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "L_frame", n, id, ENC ) );
+14 −0
Original line number Diff line number Diff line
@@ -105,6 +105,20 @@ static void rate_ism_importance(
    {
        ctype = hSCE[ch]->hCoreCoder[0]->coder_type_raw;

#ifdef FIX_ISM_INACTIVE_BITS
        if ( hSCE[ch]->hCoreCoder[0]->tcxonly )
        {
            if ( hSCE[ch]->hCoreCoder[0]->localVAD == 0 )
            {
                ctype = INACTIVE;
            }
            else if ( ctype == UNVOICED )
            {
                ctype = GENERIC;
            }
        }
#endif

        if ( hIsmMeta[ch]->ism_metadata_flag == 0 )
        {
            ism_imp[ch] = ISM_NO_META;