Commit fcf80cb6 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

remove nested SPLIT_REND_WITH_HEAD_ROT instances in ivas_dec_init.c

parent 9effa2d0
Loading
Loading
Loading
Loading
Loading
+1 −31
Original line number Diff line number Diff line
@@ -76,9 +76,6 @@ static ivas_error ivas_dec_reconfig_split_rend(
    ivas_error error;
    int16_t cldfb_in_flag, num_ch, ch, isCldfbNeeded, i, pcm_out_flag;
    SPLIT_REND_WRAPPER *hSplitRendWrapper;
#ifndef SPLIT_REND_WITH_HEAD_ROT
    CLDFB_TYPE cldfbMode;
#endif

    hSplitRendWrapper = &st_ivas->hSplitBinRend.splitrend;
    pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
@@ -95,38 +92,26 @@ static ivas_error ivas_dec_reconfig_split_rend(
    isar_renderSplitGetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &hSplitRendWrapper->multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS );

    isCldfbNeeded = 0;
#ifndef SPLIT_REND_WITH_HEAD_ROT
    cldfbMode = CLDFB_ANALYSIS;
#else

    if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT ) ||
         ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) )
    {
        cldfb_in_flag = 0;
    }
#endif

    if ( st_ivas->renderer_type != RENDERER_DISABLE )
    {
        if ( cldfb_in_flag == 0 )
        {
            isCldfbNeeded = 1;
#ifndef SPLIT_REND_WITH_HEAD_ROT
            cldfbMode = CLDFB_ANALYSIS;
#endif
        }
        else if ( st_ivas->hRenderConfig->split_rend_config.codec == ISAR_SPLIT_REND_CODEC_LC3PLUS && cldfb_in_flag )
        {
            isCldfbNeeded = 1;
#ifndef SPLIT_REND_WITH_HEAD_ROT
            cldfbMode = CLDFB_SYNTHESIS;
#endif
        }
        else if ( pcm_out_flag && cldfb_in_flag )
        {
            isCldfbNeeded = 1;
#ifndef SPLIT_REND_WITH_HEAD_ROT
            cldfbMode = CLDFB_SYNTHESIS;
#endif
        }
    }
    else if ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan )
@@ -151,18 +136,12 @@ static ivas_error ivas_dec_reconfig_split_rend(

        for ( ch = 0; ch < num_ch; ch++ )
        {
#ifndef SPLIT_REND_WITH_HEAD_ROT
            if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), cldfbMode, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK )
#else
            if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), CLDFB_ANALYSIS, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK )
#endif

            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not open CLDFB handles\n" ) );
            }
        }

#ifdef SPLIT_REND_WITH_HEAD_ROT
        for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {
            if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] ), CLDFB_SYNTHESIS, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK )
@@ -170,7 +149,6 @@ static ivas_error ivas_dec_reconfig_split_rend(
                return error;
            }
        }
#endif
    }
    else if ( isCldfbNeeded == 0 && hSplitRendWrapper->hCldfbHandles != NULL )
    {
@@ -184,7 +162,6 @@ static ivas_error ivas_dec_reconfig_split_rend(
            }
        }

#ifdef SPLIT_REND_WITH_HEAD_ROT
        for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {
            if ( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] != NULL )
@@ -193,19 +170,14 @@ static ivas_error ivas_dec_reconfig_split_rend(
                hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] = NULL;
            }
        }
#endif

        free( hSplitRendWrapper->hCldfbHandles );
        hSplitRendWrapper->hCldfbHandles = NULL;
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) &&
         ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV || st_ivas->ivas_format != SBA_ISM_FORMAT ) &&
         !( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) /* td-rend not needed? */
#else
    if ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD )
#endif
    {
        for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i )
        {
@@ -260,13 +232,11 @@ static ivas_error ivas_dec_init_split_rend(
        return error;
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT ) ||
         ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) )
    {
        cldfb_in_flag = 0;
    }
#endif

    error = isar_split_renderer_open( &st_ivas->hSplitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, (int16_t) st_ivas->hDecoderConfig->render_framesize );
    return error;