Commit eed28acd authored by norvell's avatar norvell
Browse files

Added fix FIX_I74_BW_LIMITATION to address deviation between bitrate limited...

Added fix FIX_I74_BW_LIMITATION to address deviation between bitrate limited BW and '-max_band' limited BW.
parent 4ca8e1a5
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -149,6 +149,8 @@

#define DIRAC_DRCT_GAIN_TUNING                          /* issue 64: tuning of DirAC energy-compensation gains */

#define FIX_I74_BW_LIMITATION                           /* Propagate bitrate induced BW limitation to hEncoderConfig. Ensures BE between explicit BW limitation using "-max_band <BW>" and BW limited by bitrate */


/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+13 −0
Original line number Diff line number Diff line
@@ -1572,16 +1572,26 @@ static ivas_error printConfigInfo_enc(
            if ( hEncoderConfig->ivas_total_brate < ACELP_9k60 )
            {
                fprintf( stdout, "Switching to WB.\n" );
#ifdef FIX_I74_BW_LIMITATION
                hEncoderConfig->max_bwidth = WB;
#endif
            }
            else
            {
                fprintf( stdout, "Switching to SWB.\n" );
#ifdef FIX_I74_BW_LIMITATION
                hEncoderConfig->max_bwidth = SWB;
#endif

            }
        }

        if ( hEncoderConfig->max_bwidth == SWB && hEncoderConfig->ivas_total_brate < ACELP_9k60 )
        {
            fprintf( stdout, "\nSWB coding not supported below %.2f kbps. Switching to WB.", ACELP_9k60 / 1000.f );
#ifdef FIX_I74_BW_LIMITATION
            hEncoderConfig->max_bwidth = WB;
#endif
        }

        /* in case of 8kHz input sampling or "-max_band NB", require the total bitrate to be below 24.40 kbps */
@@ -1596,6 +1606,9 @@ static ivas_error printConfigInfo_enc(
        if ( hEncoderConfig->max_bwidth == FB && hEncoderConfig->ivas_total_brate < MIN_BRATE_FB_STEREO )
        {
            fprintf( stdout, "\nFB coding not supported below %.2f kbps. Switching to SWB.\n", MIN_BRATE_FB_STEREO / 1000.f );
#ifdef FIX_I74_BW_LIMITATION
            hEncoderConfig->max_bwidth = SWB;
#endif
        }
    }