Commit adeac539 authored by vaclav's avatar vaclav
Browse files

- BRATE_SWITCHING_FRAMEWORK - Bitrate switching changes related to the general framework

- BRATE_SWITCHING_RENDERING - Bitrate switching changes related to the renderers
parent 9063e751
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -154,6 +154,10 @@
#define FIX_TCX_DEC_RECONF_BFI
#define FIX_SBA_DTX_DECODE_ERROR                        /* Issue 176: SBA decoder error with DTX at 80kbps SWB, Issue 21: SBA front-VAD threshold (203) */


#define BRATE_SWITCHING_FRAMEWORK                       /* Bitrate switching changes related to the general framework  */
#define BRATE_SWITCHING_RENDERING                       /* Bitrate switching changes related to the renderers */

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
#endif
+9 −2
Original line number Diff line number Diff line
@@ -552,10 +552,17 @@ ivas_error ivas_binRenderer_open(
        }

        ivas_output_init( &out_setup, AUDIO_CONFIG_7_1_4 );

#ifdef BRATE_SWITCHING_RENDERING
        if ( st_ivas->hoa_dec_mtx == NULL )
#endif
        {
            if ( ( error = ivas_sba_get_hoa_dec_matrix( out_setup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }

        hBinRenderer->hoa_dec_mtx = st_ivas->hoa_dec_mtx;
        st_ivas->binaural_latency_ns = (int32_t) ( FASTCONV_BRIR_latency_s * 1000000000.f );
    }
+3 −0
Original line number Diff line number Diff line
@@ -538,6 +538,9 @@ void ivas_binaural_reverb_close(
    }

    count_free( ( *hReverb ) );
#ifdef BRATE_SWITCHING_RENDERING
    ( *hReverb ) = NULL;
#endif

    return;
}
+4 −0
Original line number Diff line number Diff line
@@ -270,6 +270,10 @@ ivas_error ivas_dirac_dec_config(
    /* band config needed only for SPAR with FOA output */
    if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA && st_ivas->sba_mode == SBA_MODE_SPAR )
    {
#ifdef BRATE_SWITCHING_FRAMEWORK
        st_ivas->nchan_transport = nchan_transport_orig;
#endif

        return IVAS_ERR_OK;
    }

+46 −11
Original line number Diff line number Diff line
@@ -98,11 +98,23 @@ ivas_error ivas_dirac_dec_init_binaural_data(
    float binCenterFreq, tmpFloat;
    ivas_error error;

#ifdef BRATE_SWITCHING_RENDERING
    hBinaural = st_ivas->hDiracDecBin;

    if ( hBinaural == NULL )
#endif
    {
        if ( ( hBinaural = (DIRAC_DEC_BIN_HANDLE) count_malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL )
        {
            return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " );
        }

#ifdef BRATE_SWITCHING_RENDERING
        hBinaural->hTdDecorr = NULL;
        hBinaural->hReverb = NULL;
#endif
    }

    nBins = st_ivas->hDirAC->num_freq_bands;
    output_Fs = st_ivas->hDecoderConfig->output_Fs;
    renderer_type = st_ivas->renderer_type;
@@ -189,6 +201,18 @@ ivas_error ivas_dirac_dec_init_binaural_data(
    {
        mvr2r( parametricEarlyPartEneCorrection, hBinaural->earlyPartEneCorrection, nBins );

#ifdef BRATE_SWITCHING_RENDERING
        /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */
        if ( hBinaural->hReverb != NULL && ( ( hBinaural->hReverb->numBins != nBins ) ||
                                             ( hBinaural->useSubframeMode && hBinaural->hReverb->blockSize != CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ) ||
                                             ( !hBinaural->useSubframeMode && hBinaural->hReverb->blockSize != CLDFB_NO_COL_MAX ) ) )
        {
            ivas_binaural_reverb_close( &( hBinaural->hReverb ) );
        }

        if ( hBinaural->hReverb == NULL )
#endif
        {
            if ( hBinaural->useSubframeMode )
            {
                if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, st_ivas->hIntSetup.output_config, output_Fs, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) != IVAS_ERR_OK )
@@ -204,6 +228,7 @@ ivas_error ivas_dirac_dec_init_binaural_data(
                }
            }
        }
    }
    else if ( renderer_type == RENDERER_STEREO_PARAMETRIC )
    {
        set_f( hBinaural->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX );
@@ -219,7 +244,13 @@ ivas_error ivas_dirac_dec_init_binaural_data(
    {
        if ( st_ivas->hDecoderConfig->ivas_total_brate >= IVAS_13k2 && st_ivas->ivas_format == SBA_FORMAT )
        {
#ifdef BRATE_SWITCHING_RENDERING
            if ( hBinaural->hTdDecorr == NULL )
#endif
            {
                ivas_spar_td_decorr_dec_open( &( hBinaural->hTdDecorr ), output_Fs, 3, 1 );
            }

            if ( st_ivas->hDecoderConfig->ivas_total_brate < IVAS_24k4 )
            {
                hBinaural->hTdDecorr->pTrans_det->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR;
@@ -236,7 +267,11 @@ ivas_error ivas_dirac_dec_init_binaural_data(
    }
    else
    {
#ifdef BRATE_SWITCHING_RENDERING
        ivas_spar_td_decorr_dec_close( &( hBinaural->hTdDecorr ) );
#else
        hBinaural->hTdDecorr = NULL;
#endif
    }

    st_ivas->hDiracDecBin = hBinaural;
Loading