Commit fc47fee1 authored by Jan Kiene's avatar Jan Kiene
Browse files

merge !1610

parent d5508bff
Loading
Loading
Loading
Loading
Loading
+304 −4
Original line number Diff line number Diff line
@@ -42,6 +42,11 @@
#include "prot_fx.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
#include "lib_isar_pre_rend.h"
#include "isar_prot.h"
#include "isar_stat.h"
#endif


/*-------------------------------------------------------------------*
@@ -52,6 +57,214 @@ static ivas_error ivas_read_format( Decoder_Struct *st_ivas, Word16 *num_bits_re

static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas );

#ifdef SPLIT_REND_WITH_HEAD_ROT
static ivas_error ivas_dec_reconfig_split_rend( Decoder_Struct *st_ivas );


/*-------------------------------------------------------------------*
 * ivas_dec_reconfig_split_rend()
 *
 * IVAS decoder split rend reconfig
 *-------------------------------------------------------------------*/

static ivas_error ivas_dec_reconfig_split_rend(
    Decoder_Struct *st_ivas /* i  : IVAS decoder structure      */
)
{
    ivas_error error;
    Word16 cldfb_in_flag, num_ch, ch, isCldfbNeeded, i, pcm_out_flag;
    SPLIT_REND_WRAPPER *hSplitRendWrapper;

    hSplitRendWrapper = &st_ivas->hSplitBinRend->splitrend;
    move16();
    pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
    move16();
    cldfb_in_flag = 0;
    move16();

    IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) ||
        EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ||
        EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) ||
        EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) )
    {
        cldfb_in_flag = 1;
        move16();
    }

    ISAR_PRE_REND_GetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &hSplitRendWrapper->multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS );

    isCldfbNeeded = 0;
    move16();

    IF( ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) && EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ||
        ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) )
    {
        cldfb_in_flag = 0;
        move16();
    }

    IF( NE_16( st_ivas->renderer_type, RENDERER_DISABLE ) )
    {
        IF( EQ_16( cldfb_in_flag, 0 ) )
        {
            isCldfbNeeded = 1;
            move16();
        }
        ELSE IF( EQ_16( st_ivas->hRenderConfig->split_rend_config.codec, ISAR_SPLIT_REND_CODEC_LC3PLUS ) && cldfb_in_flag )
        {
            isCldfbNeeded = 1;
            move16();
        }
        ELSE IF( pcm_out_flag && cldfb_in_flag )
        {
            isCldfbNeeded = 1;
            move16();
        }
    }
    ELSE IF( st_ivas->hDecoderConfig->Opt_non_diegetic_pan )
    {
        isCldfbNeeded = 1;
        move16();
    }

    IF( EQ_16( isCldfbNeeded, 1 ) && hSplitRendWrapper->hCldfbHandles == NULL )
    {
        IF( ( hSplitRendWrapper->hCldfbHandles = (CLDFB_HANDLES_WRAPPER_HANDLE) malloc( sizeof( CLDFB_HANDLES_WRAPPER ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB handles\n" ) );
        }

        num_ch = i_mult( MAX_HEAD_ROT_POSES, BINAURAL_CHANNELS );
        move16();
        FOR( ch = 0; ch < num_ch; ch++ )
        {
            hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] = NULL;
            move16();
        }

        num_ch = i_mult( hSplitRendWrapper->multiBinPoseData.num_poses, BINAURAL_CHANNELS );
        move16();

        FOR( ch = 0; ch < num_ch; ch++ )
        {
            IF( ( error = openCldfb_ivas_fx( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), CLDFB_ANALYSIS, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK )
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not open CLDFB handles\n" ) );
            }
        }

        FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {
            if ( ( error = openCldfb_ivas_fx( &( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] ), CLDFB_SYNTHESIS, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
    }
    ELSE IF( EQ_16( isCldfbNeeded, 0 ) && hSplitRendWrapper->hCldfbHandles != NULL )
    {
        num_ch = i_mult( MAX_HEAD_ROT_POSES, BINAURAL_CHANNELS );
        move16();
        FOR( ch = 0; ch < num_ch; ch++ )
        {
            IF( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] != NULL )
            {
                deleteCldfb_ivas_fx( &hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] );
                hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] = NULL;
                move32();
            }
        }

        FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {
            IF( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] != NULL )
            {
                deleteCldfb_ivas_fx( &hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] );
                hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] = NULL;
                move32();
            }
        }

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

    IF( ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_OBJECTS_TD ) ) &&
        ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || NE_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) &&
        !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) ) /* td-rend not needed? */
    {
        FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i )
        {
            IF( st_ivas->hTdRendHandles[i] != NULL )
            {
                st_ivas->hTdRendHandles[i]->HrFiltSet_p = NULL;
                move32();
                ivas_td_binaural_close_fx( &st_ivas->hTdRendHandles[i] );
            }
        }
    }

    return IVAS_ERR_OK;
}


/*-------------------------------------------------------------------*
 * ivas_dec_init_split_rend()
 *
 * IVAS decoder split rend init
 *-------------------------------------------------------------------*/

static ivas_error ivas_dec_init_split_rend(
    Decoder_Struct *st_ivas /* i  : IVAS decoder structure      */
)
{
    ivas_error error;
    Word16 cldfb_in_flag, pcm_out_flag;
    Word16 mixed_td_cldfb_flag;

    pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
    cldfb_in_flag = 0;
    move16();

    IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) ||
        EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ||
        EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) ||
        EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) )
    {
        cldfb_in_flag = 1;
        move16();
    }

    ISAR_PRE_REND_GetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS );

    IF( EQ_16( cldfb_in_flag, 1 ) && ( EQ_16( st_ivas->hSplitBinRend->splitrend.multiBinPoseData.poseCorrectionMode, ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) ) )
    {
        IF( ( st_ivas->hSplitBinRend->hCldfbDataOut = (ISAR_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_CLDFB_OUT_DATA ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for cldfb data out buffer\n" ) );
        }
    }

    mixed_td_cldfb_flag = 0;
    move16();
    IF( ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) && EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ||
        ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) )
    {
        mixed_td_cldfb_flag = 1;
        move16();
    }

#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
    error = ISAR_PRE_REND_open( &st_ivas->hSplitBinRend->splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, st_ivas->hDecoderConfig->render_framesize, mixed_td_cldfb_flag );
    move16();
#else
    error = ISAR_PRE_REND_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, mixed_td_cldfb_flag );
    move16();
#endif
    return error;
}
#endif

/*-------------------------------------------------------------------*
 * ivas_dec_setup()
@@ -521,6 +734,19 @@ ivas_error ivas_dec_setup(
        }
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    /*-----------------------------------------------------------------*
     * reconfig split rendering as renderer might change after bitrate switching
     *-----------------------------------------------------------------*/

    IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
    {
        if ( ( error = ivas_dec_reconfig_split_rend( st_ivas ) ) != IVAS_ERR_OK )
        {
            return error;
        }
    }
#endif

    /*----------------------------------------------------------------*
     * Reset bitstream pointers
@@ -956,7 +1182,12 @@ ivas_error ivas_init_decoder_front(
     *--------------------------------------------------------------------*/
    test();
    test();
#ifdef SPLIT_REND_WITH_HEAD_ROT
    IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ||
        ( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) )
#else
    IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
#endif
    {
        IF( NE_32( ( error = ivas_render_config_open( &( st_ivas->hRenderConfig ) ) ), IVAS_ERR_OK ) )
        {
@@ -1131,6 +1362,20 @@ ivas_error ivas_init_decoder_fx(
        }
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    /*-----------------------------------------------------------------*
     * Initialize binuaral split rendering
     *-----------------------------------------------------------------*/

    IF( st_ivas->hSplitBinRend != NULL && ( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ||
                                            ( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && st_ivas->hDecoderConfig->Opt_non_diegetic_pan && EQ_16( st_ivas->hRenderConfig->split_rend_config.dof, 0 ) ) ) )
    {
        IF( ( error = ivas_dec_init_split_rend( st_ivas ) ) != IVAS_ERR_OK )
        {
            return error;
        }
    }
#endif

    /*-----------------------------------------------------------------*
     * Allocate and initialize SCE/CPE and other handles
@@ -1321,7 +1566,7 @@ ivas_error ivas_init_decoder_fx(
            }

            ivas_dirac_config_bands_fx( band_grouping, IVAS_MAX_NUM_BANDS, extract_l( Mpy_32_32_r( st_ivas->hDecoderConfig->output_Fs, INV_CLDFB_BANDWIDTH_Q31 ) ),
                                        st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 );
                                        st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0, 1 );
        }
        st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas );
        move16();
@@ -1511,7 +1756,7 @@ ivas_error ivas_init_decoder_fx(
            }

            ivas_dirac_config_bands_fx( band_grouping, IVAS_MAX_NUM_BANDS, extract_l( Mpy_32_32_r( st_ivas->hDecoderConfig->output_Fs, INV_CLDFB_BANDWIDTH_Q31 ) ),
                                        st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 );
                                        st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0, 1 );
        }

        FOR( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ )
@@ -2067,9 +2312,15 @@ ivas_error ivas_init_decoder_fx(
            }
        }

#ifdef SPLIT_REND_WITH_HEAD_ROT
        IF( NE_32( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config,
                                                  st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ),
                   IVAS_ERR_OK ) )
#else
        IF( NE_32( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config,
                                                  st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ),
                   IVAS_ERR_OK ) )
#endif
        {
            return error;
        }
@@ -2233,6 +2484,9 @@ ivas_error ivas_init_decoder_fx(
        {
            IF( st_ivas->hBinRenderer->render_lfe )
            {
#ifdef SPLIT_REND_WITH_HEAD_ROT
                IF( NE_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && NE_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
#endif
                {
                    /* Account for filterbank delay */
                    binauralization_delay_ns = L_add( binauralization_delay_ns, IVAS_FB_DEC_DELAY_NS );
@@ -2582,7 +2836,14 @@ void ivas_initialize_handles_dec(

    /* rendering handles */
    st_ivas->hBinRenderer = NULL;
#ifdef SPLIT_REND_WITH_HEAD_ROT
    for ( i = 0; i < MAX_HEAD_ROT_POSES; i++ )
    {
        st_ivas->hDiracDecBin[i] = NULL;
    }
#else
    st_ivas->hDiracDecBin = NULL;
#endif
    st_ivas->hDirACRend = NULL;
    st_ivas->hSpatParamRendCom = NULL;
    st_ivas->hLsSetUpConversion = NULL;
@@ -2607,7 +2868,13 @@ void ivas_initialize_handles_dec(
    st_ivas->hExtOrientationData = NULL;
    st_ivas->hCombinedOrientationData = NULL;


#ifdef SPLIT_REND_WITH_HEAD_ROT
    st_ivas->hSplitBinRend = NULL;
    for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i )
    {
        st_ivas->hTdRendHandles[i] = NULL;
    }
#endif
    /* JBM handles */
    st_ivas->hTcBuffer = NULL;
    st_ivas->hJbmMetadata = NULL;
@@ -2744,12 +3011,31 @@ void ivas_destroy_dec_fx(
    /* Fastconv binaural renderer handle */
    ivas_binRenderer_close_fx( &st_ivas->hBinRenderer );

#ifdef SPLIT_REND_WITH_HEAD_ROT
    /* TD binaural renderer handles */
    for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i )
    {
        if ( st_ivas->hTdRendHandles[i] != NULL )
        {
            st_ivas->hTdRendHandles[i]->HrFiltSet_p = NULL;
            ivas_td_binaural_close_fx( &st_ivas->hTdRendHandles[i] );
        }
    }
#endif

    /* Parametric binaural renderer handle */
#ifdef SPLIT_REND_WITH_HEAD_ROT
    ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
#else
    ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin );
#endif

    /* Crend handle */

#ifdef SPLIT_REND_WITH_HEAD_ROT
    ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses );
#else
    ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) );
#endif

    /* Reverb handle */
    ivas_reverb_close( &st_ivas->hReverb );
@@ -2915,7 +3201,11 @@ void ivas_init_dec_get_num_cldfb_instances(
                    move16();
                }
            }
#ifdef SPLIT_REND_WITH_HEAD_ROT
            IF( st_ivas->hDiracDecBin[0]->useTdDecorr )
#else
            IF( st_ivas->hDiracDecBin->useTdDecorr )
#endif
            {
                *numCldfbAnalyses = add( *numCldfbAnalyses, 2 );
                move16();
@@ -3468,12 +3758,22 @@ static ivas_error doSanityChecks_IVAS(
        }
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    IF( ( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) && NE_32( output_Fs, 48000 ) )
    {
        return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Error: Only 48kHz output sampling rate is supported for split rendering." );
    }
#endif

    IF( st_ivas->hDecoderConfig->Opt_Headrotation )
    {
        test();
        test();
#ifdef SPLIT_REND_WITH_HEAD_ROT
        IF( !( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) )
#else
        IF( !( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) )
#endif
        {
            return IVAS_ERROR( IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED, "Wrong set-up: Head-rotation not supported in this configuration" );
        }
+20 −1
Original line number Diff line number Diff line
@@ -100,6 +100,10 @@ Word16 audioCfg2channels(
            move16();
            BREAK;
        case IVAS_AUDIO_CONFIG_BINAURAL:
#ifdef SPLIT_REND_WITH_HEAD_ROT
        case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED:
        case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM:
#endif
        case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR:
        case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB:
            nchan_out = 2;
@@ -266,6 +270,10 @@ void ivas_output_init(
                move16();
                BREAK;
            case IVAS_AUDIO_CONFIG_BINAURAL:
#ifdef SPLIT_REND_WITH_HEAD_ROT
            case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED:
            case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM:
#endif
            case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR:
            case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB:
            case IVAS_AUDIO_CONFIG_ISM1:
@@ -370,7 +378,12 @@ Word16 ivas_get_nchan_buffers_dec(
        {
            nchan_out_buff = s_max( nchan_out_buff, add( st_ivas->hOutSetup.nchan_out_woLFE, st_ivas->hOutSetup.num_lfe ) );
        }
        ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
        ELSE if ( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
#ifdef SPLIT_REND_WITH_HEAD_ROT
                  || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
                  EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
#endif
        )
        {
            nchan_out_buff = shl( CPE_CHANNELS, 1 );
        }
@@ -451,6 +464,12 @@ Word16 ivas_get_nchan_buffers_dec(
        }
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
    {
        nchan_out_buff = max( nchan_out_buff, st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS );
    }
#endif

    return nchan_out_buff;
}