Commit 0288a08c authored by Jouni Paulus's avatar Jouni Paulus
Browse files

renamed switch into SPLIT_REND_WITH_HEAD_ROT_PARAMBIN.

draft refactoring allowing the re-use of decorrelated and reverb signals in split rendering parambin.
do not open unnecessary td-decorrs in split rendering, but keep the useTdDecorr flag.
parent fd80dbf7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@
#define RENAME_GWLPR                                    /* FhG: Rename clashing symbol */

#define SPLIT_REND_WITH_HEAD_ROT                        /* Dlb,FhG: Split Rendering contributions 21 and 35 */
#define SPLIT_REND_WITH_HEAD_ROT_MASA                   /* Nokia, Dlb: Split rendering support for parambin renderer */
#define SPLIT_REND_WITH_HEAD_ROT_PARAMBIN               /* Nokia, Dlb: Split rendering support for parambin renderer */

/* ################## End BE DEVELOPMENT switches ######################### */

+3 −3
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ ivas_error ivas_dec(
         ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
    {
        assert( ( st_ivas->ivas_format == SBA_FORMAT ||
#ifdef SPLIT_REND_WITH_HEAD_ROT_MASA
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
                  st_ivas->ivas_format == MASA_FORMAT ||
#endif
                  ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_PARAM ) ||
@@ -834,7 +834,7 @@ ivas_error ivas_dec(
        IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend;
        int16_t max_band;
        int16_t pcm_out;
#ifdef SPLIT_REND_WITH_HEAD_ROT_MASA
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
        int16_t td_input;

        td_input = st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC;
@@ -851,7 +851,7 @@ ivas_error ivas_dec(
                                            hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural,
                                            hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural,
                                            max_band, output, 1,
#ifdef SPLIT_REND_WITH_HEAD_ROT_MASA
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
                                            td_input,
#else
                                            st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV,
+42 −44
Original line number Diff line number Diff line
@@ -826,7 +826,7 @@ ivas_error ivas_dirac_dec_config(

    if ( !need_parambin )
    {
#ifdef SPLIT_REND_WITH_HEAD_ROT_MASA
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
        ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
#else
        ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin );
@@ -874,7 +874,7 @@ ivas_error ivas_dirac_dec_config(
        {
            if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC )
            {
#ifdef SPLIT_REND_WITH_HEAD_ROT_MASA
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
                if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
                     ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
                {
@@ -911,8 +911,8 @@ ivas_error ivas_dirac_dec_config(
                }
            }
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT_MASA
            if ( st_ivas->hDiracDecBin[0] == NULL )  /* TODO: is it enough to check the first element or do we need to check all n_poses pointers? the init function runs over n_poses */
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
            if ( st_ivas->hDiracDecBin[0] == NULL )
#else
            if ( st_ivas->hDiracDecBin == NULL )
#endif
@@ -924,64 +924,56 @@ ivas_error ivas_dirac_dec_config(
            }
            else
            {
#ifdef SPLIT_REND_WITH_HEAD_ROT_MASA
                int16_t pos_idx;
                for ( pos_idx = 0; pos_idx < st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses; pos_idx++ )
                {
                    if ( st_ivas->hDiracDecBin[pos_idx]->h_freq_domain_decorr_ap_params != NULL && !( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nSCE > 0 ) )
                    {
                        ivas_dirac_dec_decorr_close( &st_ivas->hDiracDecBin[pos_idx]->h_freq_domain_decorr_ap_params, &st_ivas->hDiracDecBin[pos_idx]->h_freq_domain_decorr_ap_state );
                    }

                    if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin[pos_idx]->hTdDecorr ), &( st_ivas->hDiracDecBin[pos_idx]->useTdDecorr ) ) ) != IVAS_ERR_OK )
                    {
                        return error;
                    }

                    if ( !st_ivas->hDiracDecBin[pos_idx]->useTdDecorr )
                    {
                        if ( st_ivas->hDiracDecBin[pos_idx]->h_freq_domain_decorr_ap_params == NULL )
                        {
                            float frequency_axis[CLDFB_NO_CHANNELS_MAX];
                            ivas_dirac_dec_get_frequency_axis( frequency_axis, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSpatParamRendCom->num_freq_bands );
                            if ( ( error = ivas_dirac_dec_decorr_open( &( st_ivas->hDiracDecBin[pos_idx]->h_freq_domain_decorr_ap_params ),
                                                                       &( st_ivas->hDiracDecBin[pos_idx]->h_freq_domain_decorr_ap_state ),
                                                                       st_ivas->hSpatParamRendCom->num_freq_bands,
                                                                       BINAURAL_CHANNELS,
                                                                       BINAURAL_CHANNELS,
                                                                       DIRAC_SYNTHESIS_PSD_LS,
                                                                       frequency_axis,
                                                                       BINAURAL_CHANNELS,
                                                                       st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
                            {
                                return error;
                            }
                        }
                    }

                    st_ivas->hDiracDecBin[pos_idx]->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate );
                }
            }
#else
                /* This is required to keep BE in rate switching. This probably means that 1TC and 2TC MASA perform differently. */
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
                if ( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params != NULL && !( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nSCE > 0 ) )
#else
                if ( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params != NULL && !( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nSCE > 0 ) )
#endif
                {
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
                    ivas_dirac_dec_decorr_close( &st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params, &st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_state );
#else
                    ivas_dirac_dec_decorr_close( &st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params, &st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state );
#endif
                }

#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
                if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin[0]->hTdDecorr ), &( st_ivas->hDiracDecBin[0]->useTdDecorr ) ) ) != IVAS_ERR_OK )
#else
                if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK )
#endif
                {
                    return error;
                }

#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
                /* copy td-decorr flag to split renderer side rendereres */
                for ( int16_t pos_idx = 1; pos_idx < st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses; pos_idx++ )
                {
                    st_ivas->hDiracDecBin[pos_idx]->useTdDecorr = st_ivas->hDiracDecBin[0]->useTdDecorr;
                }

                if ( !st_ivas->hDiracDecBin[0]->useTdDecorr )
#else
                if ( !st_ivas->hDiracDecBin->useTdDecorr )
#endif
                {
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
                    if ( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params == NULL )
#else
                    if ( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params == NULL )
#endif
                    {
                        float frequency_axis[CLDFB_NO_CHANNELS_MAX];
                        ivas_dirac_dec_get_frequency_axis( frequency_axis, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSpatParamRendCom->num_freq_bands );
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
                        if ( ( error = ivas_dirac_dec_decorr_open( &( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params ),
                                                                   &( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_state ),
#else
                        if ( ( error = ivas_dirac_dec_decorr_open( &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params ),
                                                                   &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ),
#endif
                                                                   st_ivas->hSpatParamRendCom->num_freq_bands,
                                                                   BINAURAL_CHANNELS,
                                                                   BINAURAL_CHANNELS,
@@ -995,11 +987,17 @@ ivas_error ivas_dirac_dec_config(
                    }
                }

                st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate );
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
                for ( int16_t pos_idx = 0; pos_idx < st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses; pos_idx++ )
                {
                    st_ivas->hDiracDecBin[pos_idx]->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate );
                }
#else
                st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate );
#endif
            }
        }
    }

    /* Allocate transport channel buffers for SBA format when in JBM */
    if ( dec_config_flag == DIRAC_OPEN )
+5 −5
Original line number Diff line number Diff line
@@ -1317,7 +1317,7 @@ ivas_error ivas_init_decoder(
    /* ParamISM is handled separately from other common config */
    else if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) )
    {
#ifdef SPLIT_REND_WITH_HEAD_ROT_MASA
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
        /* TODO jpaulus: paramBin modes needed? */
        if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
             ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
@@ -1341,7 +1341,7 @@ ivas_error ivas_init_decoder(
            return error;
        }
        /* TODO jpaulus: is this needed here? */
#ifdef SPLIT_REND_WITH_HEAD_ROT_MASA
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
        if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
             ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
        {
@@ -1850,7 +1850,7 @@ void ivas_initialize_handles_dec(
    st_ivas->splitBinRend.hSplitRendBits = NULL;
    ivas_init_split_rend_handles( &st_ivas->splitBinRend.splitrend );
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT_MASA
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
    for ( i = 0; i < MAX_HEAD_ROT_POSES; i++ )
    {
        st_ivas->hDiracDecBin[i] = NULL;
@@ -2021,7 +2021,7 @@ void ivas_destroy_dec(
#endif

    /* Parametric binaural renderer handle */
#ifdef SPLIT_REND_WITH_HEAD_ROT_MASA
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
    ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
#else
    ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin );
@@ -2144,7 +2144,7 @@ void ivas_init_dec_get_num_cldfb_instances(
            {
                *numCldfbAnalyses = st_ivas->nchan_transport + 1;
            }
#ifdef SPLIT_REND_WITH_HEAD_ROT_MASA
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
            if ( st_ivas->hDiracDecBin[0]->useTdDecorr )
#else
            if ( st_ivas->hDiracDecBin->useTdDecorr )
+2 −2
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ static ivas_error ivas_ism_bitrate_switching(
#endif
        {
            /* close the parametric binaural renderer */
#ifdef SPLIT_REND_WITH_HEAD_ROT_MASA
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
            ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
#else
            ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin );
@@ -224,7 +224,7 @@ static ivas_error ivas_ism_bitrate_switching(
#endif
        {
            /* close the parametric binaural renderer */
#ifdef SPLIT_REND_WITH_HEAD_ROT_MASA
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
            ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
#else
            ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin );
Loading