Commit ea5ce9b0 authored by vaclav's avatar vaclav
Browse files

reintroduce warning print-out that bandwidth was reduced automatically due to...

reintroduce warning print-out that bandwidth was reduced automatically due to bitrate; also remove redundant printout of "Bandwidth limited to XX." as the same info is already present in "Max. encoded bandwidth: XX"; changes are under FIX_I74_BW_LIMITATION_ALT
parent f5fb28ce
Loading
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -1413,7 +1413,9 @@ static ivas_error printConfigInfo_enc(
{
    Encoder_Struct *st_ivas;
    ENCODER_CONFIG_HANDLE hEncoderConfig;
#ifndef FIX_I74_BW_LIMITATION_ALT
    char max_bwidth_string[4];
#endif

    st_ivas = hIvasEnc->st_ivas;
    hEncoderConfig = st_ivas->hEncoderConfig;
@@ -1554,6 +1556,7 @@ static ivas_error printConfigInfo_enc(
     * Print potential limitation of audio bandwidth
     *-----------------------------------------------------------------*/

#ifndef FIX_I74_BW_LIMITATION_ALT
    switch ( hEncoderConfig->max_bwidth )
    {
        case NB:
@@ -1569,19 +1572,43 @@ static ivas_error printConfigInfo_enc(
            strncpy( max_bwidth_string, "FB\0", sizeof( max_bwidth_string ) );
            break;
    }
#endif

    if ( st_ivas->hEncoderConfig->Opt_SC_VBR && !hEncoderConfig->Opt_DTX_ON )
    {
        return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "\nError: SC-VBR 5900 bps not supported without DTX\n\n" );
    }

#ifndef FIX_I74_BW_LIMITATION_ALT
    if ( hIvasEnc->maxBandwidthUser )
    {
        fprintf( stdout, "\nBandwidth limited to %s.\n", max_bwidth_string );
    }
#endif

    if ( hEncoderConfig->ivas_format == MONO_FORMAT )
    {
#ifdef FIX_I74_BW_LIMITATION_ALT
        if ( hIvasEnc->newBandwidthApi != hEncoderConfig->max_bwidth )
        {
            if ( hIvasEnc->newBandwidthApi == FB )
            {
                fprintf( stdout, "\nFB coding not supported below %.2f kbps. ", ACELP_16k40 / 1000.f );
                if ( hEncoderConfig->max_bwidth == WB )
                {
                    fprintf( stdout, "Switching to WB.\n" );
                }
                else
                {
                    fprintf( stdout, "Switching to SWB.\n" );
                }
            }
            else if ( hIvasEnc->newBandwidthApi == SWB )
            {
                fprintf( stdout, "\nSWB coding not supported below %.2f kbps. Switching to WB.\n", ACELP_9k60 / 1000.f );
            }
        }
#else
        if ( hEncoderConfig->max_bwidth == FB && hEncoderConfig->ivas_total_brate < ACELP_16k40 )
        {
            fprintf( stdout, "\nFB coding not supported below %.2f kbps. ", ACELP_16k40 / 1000.f );
@@ -1599,9 +1626,14 @@ static ivas_error printConfigInfo_enc(
        {
            fprintf( stdout, "\nSWB coding not supported below %.2f kbps. Switching to WB.", ACELP_9k60 / 1000.f );
        }
#endif

        /* in case of 8kHz input sampling or "-max_band NB", require the total bitrate to be below 24.40 kbps */
#ifdef FIX_I74_BW_LIMITATION_ALT
        if ( ( hIvasEnc->newBandwidthApi == NB || hEncoderConfig->input_Fs == 8000 ) && hEncoderConfig->ivas_total_brate > ACELP_24k40 )
#else
        if ( ( hEncoderConfig->max_bwidth == NB || hEncoderConfig->input_Fs == 8000 ) && hEncoderConfig->ivas_total_brate > ACELP_24k40 )
#endif
        {
            fprintf( stdout, "\nError: Unsupported mode NB %d bps, NB mode supports rates 5900-24400 bps\n\n", hEncoderConfig->ivas_total_brate );
            return IVAS_ERR_INVALID_BITRATE;
@@ -1609,7 +1641,11 @@ static ivas_error printConfigInfo_enc(
    }
    else
    {
#ifdef FIX_I74_BW_LIMITATION_ALT
        if ( hIvasEnc->newBandwidthApi != hEncoderConfig->max_bwidth )
#else
        if ( hEncoderConfig->max_bwidth == FB && hEncoderConfig->ivas_total_brate < MIN_BRATE_FB_STEREO )
#endif
        {
            fprintf( stdout, "\nFB coding not supported below %.2f kbps. Switching to SWB.\n", MIN_BRATE_FB_STEREO / 1000.f );
        }