Loading lib_rend/lib_rend_fx.c +57 −45 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ typedef struct rendering_context ctx; Word32 numNewSamplesPerChannel; /* Used to keep track how much new audio was fed before rendering current frame */ } input_base; typedef struct { input_base base; Loading @@ -132,6 +133,7 @@ typedef struct UWord16 total_num_objects; Word32 ism_metadata_delay_ms_fx; /* Q0 */ } input_ism; typedef struct { Word16 numLfeChannels; Loading @@ -145,6 +147,7 @@ typedef struct // IVAS_REND_LfePanMtx lfePanMtx; IVAS_REND_LfePanMtx_fx lfePanMtx_fx; /* Q31 */ } lfe_routing; typedef struct { input_base base; Loading @@ -168,6 +171,7 @@ typedef struct Word32 *lfeDelayBuffer_fx; MCMASA_ANA_HANDLE hMcMasa; } input_mc; typedef struct { input_base base; Loading @@ -180,7 +184,6 @@ typedef struct DIRAC_ANA_HANDLE hDirAC; } input_sba; typedef struct { input_base base; Loading @@ -200,6 +203,7 @@ typedef struct hrtf_handles IVAS_DEC_HRTF_STATISTICS_HANDLE hHrtfStatistics; } hrtf_handles; struct IVAS_REND { Word32 sampleRateOut; Loading Loading @@ -403,14 +407,15 @@ static void accumulateCLDFBArrayToBuffer_fx( { UWord32 smplIdx, slotIdx; UWord32 numCldfbSamples, num_bands; UWord32 chnlIdx; Word16 chnlIdx; Word32 *writePtr; assert( ( buffer->config.is_cldfb == 1 ) && "for time domain input call copyBufferTo2dArray()" ); writePtr = buffer->data_fx; numCldfbSamples = (UWord32) shr( buffer->config.numSamplesPerChannel, 1 ); num_bands = (UWord32) Mpy_32_32( numCldfbSamples, ONE_BY_CLDFB_NO_COL_MAX_Q31 ); FOR( chnlIdx = 0; chnlIdx < (uint32_t) buffer->config.numChannels; ++chnlIdx ) FOR( chnlIdx = 0; chnlIdx < buffer->config.numChannels; ++chnlIdx ) { FOR( slotIdx = 0; slotIdx < CLDFB_NO_COL_MAX; ++slotIdx ) { Loading Loading @@ -2585,9 +2590,7 @@ static ivas_error initMcBinauralRendering( ELSE IF( !useTDRend && inputMc->crendWrapper == NULL ) { /* open CREND */ IF( NE_32( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, outSampleRate, ( ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ), IVAS_ERR_OK ) ) IF( NE_32( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, outSampleRate, num_poses ) ), IVAS_ERR_OK ) ) { return error; } Loading Loading @@ -3019,8 +3022,7 @@ static ivas_error updateSbaPanGains( else { assert( ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural crend mode is currently supported with 48k sampling rate only" ); if ( ( error = ivas_rend_openMultiBinCrend( &inputSba->crendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) if ( ( error = ivas_rend_openMultiBinCrend( &inputSba->crendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } Loading @@ -3031,8 +3033,7 @@ static ivas_error updateSbaPanGains( { if ( hRendCfg->split_rend_config.rendererSelection == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { if ( ( error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) if ( ( error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } Loading Loading @@ -3108,15 +3109,13 @@ static ivas_error setRendInputActiveSba( const AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, RENDER_CONFIG_DATA *hRendCfg, hrtf_handles *hrtfs ) hrtf_handles *hrtfs ) { ivas_error error; rendering_context rendCtx; AUDIO_CONFIG outConfig; input_sba *inputSba; int16_t pos_idx; Word16 pos_idx; inputSba = (input_sba *) input; rendCtx = inputSba->base.ctx; Loading Loading @@ -3160,18 +3159,28 @@ static ivas_error setRendInputActiveSba( return error; } static void clearInputSba( input_sba *inputSba ) { rendering_context rendCtx; Word16 num_poses; rendCtx = inputSba->base.ctx; num_poses = 1; move16(); if ( rendCtx.pSplitRendWrapper != NULL ) { num_poses = rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses; move16(); } freeInputBaseBufferData_fx( &inputSba->bufferData_fx ); initRendInputBase_fx( &inputSba->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); ivas_rend_closeCrend( &inputSba->crendWrapper, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ); ivas_rend_closeCrend( &inputSba->crendWrapper, num_poses ); IF( inputSba->cldfbRendWrapper.hCldfbRend != NULL ) { Loading Loading @@ -3922,6 +3931,7 @@ static ivas_error ivas_pre_rend_init( ivas_error error; IVAS_REND_AudioBufferConfig bufConfig; test(); IF( EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { IF( EQ_32( pSplit_rend_config->poseCorrectionMode, ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) ) Loading Loading @@ -4987,7 +4997,7 @@ Word16 IVAS_REND_FeedRenderConfig( /* if its not initialized yet then no need to re-initialize, initialization will happen while adding inputs*/ IF( hIvasRend->splitRendEncBuffer.data_fx != NULL && hIvasRend->hRendererConfig != NULL ) { int16_t cldfb_in_flag; Word16 cldfb_in_flag; cldfb_in_flag = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN ); IF( hIvasRend->splitRendWrapper != NULL ) { Loading Loading @@ -5156,8 +5166,9 @@ ivas_error IVAS_REND_DisableHeadRotation( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_SetSplitRendBFI( IVAS_REND_HANDLE hIvasRend, const int16_t bfi ) IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const Word16 bfi /* i : Bad Frame Indicator */ ) { hIvasRend->splitRendBFI = bfi; Loading Loading @@ -7886,7 +7897,7 @@ static ivas_error renderInputSba( { ivas_error error; IVAS_REND_AudioBuffer inAudio; int16_t cldfb2tdShift; Word16 cldfb2tdShift; error = IVAS_ERR_OK; move32(); inAudio = sbaInput->base.inputBuffer; Loading Loading @@ -8240,7 +8251,7 @@ static ivas_error renderInputMasa( Word16 maxBin; Word32 *tmpBuffer_fx[MAX_OUTPUT_CHANNELS]; Word32 tmpBuffer_buff_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; int16_t cldfb2tdShift; Word16 cldfb2tdShift; Word32 Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Loading Loading @@ -8624,7 +8635,7 @@ static ivas_error getSamplesInternal( { ivas_error error; Word16 numOutChannels; int16_t cldfb2tdSampleShift; Word16 cldfb2tdSampleShift; IVAS_REND_AudioBuffer outAudioOrig; /* Validate function arguments */ Loading Loading @@ -8744,7 +8755,9 @@ static ivas_error getSamplesInternal( set32_fx( outAudio.data_fx, 0, imult1616( outAudio.config.numChannels, outAudio.config.numSamplesPerChannel ) ); outAudioOrig = outAudio; /* Use internal buffer if outputting split rendering bitstream */ test(); IF( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { Loading Loading @@ -8780,15 +8793,13 @@ static ivas_error getSamplesInternal( } test(); test(); IF( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { ISAR_SPLIT_REND_BITS_DATA bits; Word16 cldfb_in_flag, i, j, k, ch, ro_md_flag; Word32 Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; FOR( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; i++ ) { FOR( j = 0; j < CLDFB_NO_COL_MAX; j++ ) Loading Loading @@ -8884,7 +8895,7 @@ static ivas_error getSamplesInternal( if ( ( error = ISAR_PRE_REND_MultiBinToSplitBinaural( hIvasRend->splitRendWrapper, hIvasRend->headRotData.headPositions[0], hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, hIvasRend->hRendererConfig->split_rend_config.codec, hIvasRend->hRendererConfig->split_rend_config.isar_frame_size_ms, hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0, ro_md_flag, Q_buff, &Q_out[0] ) ) != IVAS_ERR_OK ) &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const Word16 )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0, ro_md_flag, Q_buff, &Q_out[0] ) ) != IVAS_ERR_OK ) { return error; } Loading Loading @@ -8952,7 +8963,7 @@ ivas_error IVAS_REND_GetSplitBinauralBitstream( IVAS_REND_BitstreamBuffer *hBits /* o : buffer for output bitstream */ ) { int16_t cldfb_in_flag; Word16 cldfb_in_flag; cldfb_in_flag = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN ); hIvasRend->splitRendEncBuffer.config.is_cldfb = cldfb_in_flag; Loading @@ -8963,8 +8974,9 @@ ivas_error IVAS_REND_GetSplitBinauralBitstream( } else { hIvasRend->splitRendEncBuffer.config.numSamplesPerChannel = (int16_t) ( hIvasRend->sampleRateOut / FRAMES_PER_SEC ); hIvasRend->splitRendEncBuffer.config.numSamplesPerChannel = (Word16) ( hIvasRend->sampleRateOut / FRAMES_PER_SEC ); } hIvasRend->splitRendEncBuffer.config.numSamplesPerChannel *= cldfb_in_flag ? 2 : 1; /* hIvasRend->splitRendEncBuffer used for BINAURAL_SPLIT_CODED output Loading @@ -8983,8 +8995,8 @@ ivas_error IVAS_REND_GetSplitRendBitstreamHeader( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ ISAR_SPLIT_REND_CODEC *pCodec, /* o : pointer to codec setting */ ISAR_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection, /* o : pointer to pose correction mode */ int16_t *pCodec_frame_size_ms, /* o : pointer to codec frame size setting */ int16_t *pIsar_frame_size_ms /* o : pointer to ISAR frame size setting */ Word16 *pCodec_frame_size_ms, /* o : pointer to codec frame size setting */ Word16 *pIsar_frame_size_ms /* o : pointer to ISAR frame size setting */ ) { test(); Loading Loading @@ -9089,33 +9101,33 @@ void IVAS_REND_Close( ivas_error IVAS_REND_openCldfb( IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS], IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_OUTPUT_CHANNELS], const int16_t num_in_chs, const int16_t num_out_chs, const int32_t output_Fs ) const Word16 num_in_chs, const Word16 num_out_chs, const Word32 output_Fs ) { int16_t n; Word16 n; ivas_error error; for ( n = 0; n < num_in_chs; n++ ) FOR( n = 0; n < num_in_chs; n++ ) { if ( ( error = openCldfb_ivas_fx( &( cldfbAna[n] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK ) IF( ( error = openCldfb_ivas_fx( &( cldfbAna[n] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK ) { return error; } } for ( ; n < IVAS_MAX_INPUT_CHANNELS; n++ ) FOR( ; n < IVAS_MAX_INPUT_CHANNELS; n++ ) { cldfbAna[n] = NULL; } for ( n = 0; n < num_out_chs; n++ ) FOR( n = 0; n < num_out_chs; n++ ) { if ( ( error = openCldfb_ivas_fx( &( cldfbSyn[n] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK ) IF( ( error = openCldfb_ivas_fx( &( cldfbSyn[n] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK ) { return error; } } for ( ; n < IVAS_MAX_OUTPUT_CHANNELS; n++ ) FOR( ; n < IVAS_MAX_OUTPUT_CHANNELS; n++ ) { cldfbSyn[n] = NULL; } Loading @@ -9134,20 +9146,20 @@ void IVAS_REND_closeCldfb( IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS], IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_OUTPUT_CHANNELS] ) { int16_t n; Word16 n; for ( n = 0; n < IVAS_MAX_INPUT_CHANNELS; n++ ) FOR( n = 0; n < IVAS_MAX_INPUT_CHANNELS; n++ ) { if ( cldfbAna[n] != NULL ) IF( cldfbAna[n] != NULL ) { deleteCldfb_ivas_fx( &( cldfbAna[n] ) ); cldfbAna[n] = NULL; } } for ( n = 0; n < IVAS_MAX_OUTPUT_CHANNELS; n++ ) FOR( n = 0; n < IVAS_MAX_OUTPUT_CHANNELS; n++ ) { if ( cldfbSyn[n] != NULL ) IF( cldfbSyn[n] != NULL ) { deleteCldfb_ivas_fx( &( cldfbSyn[n] ) ); cldfbSyn[n] = NULL; Loading Loading @@ -9194,7 +9206,7 @@ void IVAS_REND_cldfbSynthesis_wrapper( Word32 **realBuffer, /* i : real values */ Word32 **imagBuffer, /* i : imag values */ Word32 *timeOut, /* o : output time domain samples */ const int16_t samplesToProcess, /* i : number of processed samples */ const Word16 samplesToProcess, /* i : number of processed samples */ IVAS_CLDFB_FILTER_BANK_HANDLE h_cldfb, /* i : filter bank state */ Word16 Q_cldfb, Word16 *Q_out ) Loading Loading
lib_rend/lib_rend_fx.c +57 −45 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ typedef struct rendering_context ctx; Word32 numNewSamplesPerChannel; /* Used to keep track how much new audio was fed before rendering current frame */ } input_base; typedef struct { input_base base; Loading @@ -132,6 +133,7 @@ typedef struct UWord16 total_num_objects; Word32 ism_metadata_delay_ms_fx; /* Q0 */ } input_ism; typedef struct { Word16 numLfeChannels; Loading @@ -145,6 +147,7 @@ typedef struct // IVAS_REND_LfePanMtx lfePanMtx; IVAS_REND_LfePanMtx_fx lfePanMtx_fx; /* Q31 */ } lfe_routing; typedef struct { input_base base; Loading @@ -168,6 +171,7 @@ typedef struct Word32 *lfeDelayBuffer_fx; MCMASA_ANA_HANDLE hMcMasa; } input_mc; typedef struct { input_base base; Loading @@ -180,7 +184,6 @@ typedef struct DIRAC_ANA_HANDLE hDirAC; } input_sba; typedef struct { input_base base; Loading @@ -200,6 +203,7 @@ typedef struct hrtf_handles IVAS_DEC_HRTF_STATISTICS_HANDLE hHrtfStatistics; } hrtf_handles; struct IVAS_REND { Word32 sampleRateOut; Loading Loading @@ -403,14 +407,15 @@ static void accumulateCLDFBArrayToBuffer_fx( { UWord32 smplIdx, slotIdx; UWord32 numCldfbSamples, num_bands; UWord32 chnlIdx; Word16 chnlIdx; Word32 *writePtr; assert( ( buffer->config.is_cldfb == 1 ) && "for time domain input call copyBufferTo2dArray()" ); writePtr = buffer->data_fx; numCldfbSamples = (UWord32) shr( buffer->config.numSamplesPerChannel, 1 ); num_bands = (UWord32) Mpy_32_32( numCldfbSamples, ONE_BY_CLDFB_NO_COL_MAX_Q31 ); FOR( chnlIdx = 0; chnlIdx < (uint32_t) buffer->config.numChannels; ++chnlIdx ) FOR( chnlIdx = 0; chnlIdx < buffer->config.numChannels; ++chnlIdx ) { FOR( slotIdx = 0; slotIdx < CLDFB_NO_COL_MAX; ++slotIdx ) { Loading Loading @@ -2585,9 +2590,7 @@ static ivas_error initMcBinauralRendering( ELSE IF( !useTDRend && inputMc->crendWrapper == NULL ) { /* open CREND */ IF( NE_32( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, outSampleRate, ( ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ), IVAS_ERR_OK ) ) IF( NE_32( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, outSampleRate, num_poses ) ), IVAS_ERR_OK ) ) { return error; } Loading Loading @@ -3019,8 +3022,7 @@ static ivas_error updateSbaPanGains( else { assert( ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural crend mode is currently supported with 48k sampling rate only" ); if ( ( error = ivas_rend_openMultiBinCrend( &inputSba->crendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) if ( ( error = ivas_rend_openMultiBinCrend( &inputSba->crendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } Loading @@ -3031,8 +3033,7 @@ static ivas_error updateSbaPanGains( { if ( hRendCfg->split_rend_config.rendererSelection == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { if ( ( error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) if ( ( error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } Loading Loading @@ -3108,15 +3109,13 @@ static ivas_error setRendInputActiveSba( const AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, RENDER_CONFIG_DATA *hRendCfg, hrtf_handles *hrtfs ) hrtf_handles *hrtfs ) { ivas_error error; rendering_context rendCtx; AUDIO_CONFIG outConfig; input_sba *inputSba; int16_t pos_idx; Word16 pos_idx; inputSba = (input_sba *) input; rendCtx = inputSba->base.ctx; Loading Loading @@ -3160,18 +3159,28 @@ static ivas_error setRendInputActiveSba( return error; } static void clearInputSba( input_sba *inputSba ) { rendering_context rendCtx; Word16 num_poses; rendCtx = inputSba->base.ctx; num_poses = 1; move16(); if ( rendCtx.pSplitRendWrapper != NULL ) { num_poses = rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses; move16(); } freeInputBaseBufferData_fx( &inputSba->bufferData_fx ); initRendInputBase_fx( &inputSba->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); ivas_rend_closeCrend( &inputSba->crendWrapper, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ); ivas_rend_closeCrend( &inputSba->crendWrapper, num_poses ); IF( inputSba->cldfbRendWrapper.hCldfbRend != NULL ) { Loading Loading @@ -3922,6 +3931,7 @@ static ivas_error ivas_pre_rend_init( ivas_error error; IVAS_REND_AudioBufferConfig bufConfig; test(); IF( EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { IF( EQ_32( pSplit_rend_config->poseCorrectionMode, ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) ) Loading Loading @@ -4987,7 +4997,7 @@ Word16 IVAS_REND_FeedRenderConfig( /* if its not initialized yet then no need to re-initialize, initialization will happen while adding inputs*/ IF( hIvasRend->splitRendEncBuffer.data_fx != NULL && hIvasRend->hRendererConfig != NULL ) { int16_t cldfb_in_flag; Word16 cldfb_in_flag; cldfb_in_flag = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN ); IF( hIvasRend->splitRendWrapper != NULL ) { Loading Loading @@ -5156,8 +5166,9 @@ ivas_error IVAS_REND_DisableHeadRotation( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_SetSplitRendBFI( IVAS_REND_HANDLE hIvasRend, const int16_t bfi ) IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const Word16 bfi /* i : Bad Frame Indicator */ ) { hIvasRend->splitRendBFI = bfi; Loading Loading @@ -7886,7 +7897,7 @@ static ivas_error renderInputSba( { ivas_error error; IVAS_REND_AudioBuffer inAudio; int16_t cldfb2tdShift; Word16 cldfb2tdShift; error = IVAS_ERR_OK; move32(); inAudio = sbaInput->base.inputBuffer; Loading Loading @@ -8240,7 +8251,7 @@ static ivas_error renderInputMasa( Word16 maxBin; Word32 *tmpBuffer_fx[MAX_OUTPUT_CHANNELS]; Word32 tmpBuffer_buff_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; int16_t cldfb2tdShift; Word16 cldfb2tdShift; Word32 Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Loading Loading @@ -8624,7 +8635,7 @@ static ivas_error getSamplesInternal( { ivas_error error; Word16 numOutChannels; int16_t cldfb2tdSampleShift; Word16 cldfb2tdSampleShift; IVAS_REND_AudioBuffer outAudioOrig; /* Validate function arguments */ Loading Loading @@ -8744,7 +8755,9 @@ static ivas_error getSamplesInternal( set32_fx( outAudio.data_fx, 0, imult1616( outAudio.config.numChannels, outAudio.config.numSamplesPerChannel ) ); outAudioOrig = outAudio; /* Use internal buffer if outputting split rendering bitstream */ test(); IF( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { Loading Loading @@ -8780,15 +8793,13 @@ static ivas_error getSamplesInternal( } test(); test(); IF( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { ISAR_SPLIT_REND_BITS_DATA bits; Word16 cldfb_in_flag, i, j, k, ch, ro_md_flag; Word32 Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; FOR( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; i++ ) { FOR( j = 0; j < CLDFB_NO_COL_MAX; j++ ) Loading Loading @@ -8884,7 +8895,7 @@ static ivas_error getSamplesInternal( if ( ( error = ISAR_PRE_REND_MultiBinToSplitBinaural( hIvasRend->splitRendWrapper, hIvasRend->headRotData.headPositions[0], hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, hIvasRend->hRendererConfig->split_rend_config.codec, hIvasRend->hRendererConfig->split_rend_config.isar_frame_size_ms, hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0, ro_md_flag, Q_buff, &Q_out[0] ) ) != IVAS_ERR_OK ) &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const Word16 )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0, ro_md_flag, Q_buff, &Q_out[0] ) ) != IVAS_ERR_OK ) { return error; } Loading Loading @@ -8952,7 +8963,7 @@ ivas_error IVAS_REND_GetSplitBinauralBitstream( IVAS_REND_BitstreamBuffer *hBits /* o : buffer for output bitstream */ ) { int16_t cldfb_in_flag; Word16 cldfb_in_flag; cldfb_in_flag = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN ); hIvasRend->splitRendEncBuffer.config.is_cldfb = cldfb_in_flag; Loading @@ -8963,8 +8974,9 @@ ivas_error IVAS_REND_GetSplitBinauralBitstream( } else { hIvasRend->splitRendEncBuffer.config.numSamplesPerChannel = (int16_t) ( hIvasRend->sampleRateOut / FRAMES_PER_SEC ); hIvasRend->splitRendEncBuffer.config.numSamplesPerChannel = (Word16) ( hIvasRend->sampleRateOut / FRAMES_PER_SEC ); } hIvasRend->splitRendEncBuffer.config.numSamplesPerChannel *= cldfb_in_flag ? 2 : 1; /* hIvasRend->splitRendEncBuffer used for BINAURAL_SPLIT_CODED output Loading @@ -8983,8 +8995,8 @@ ivas_error IVAS_REND_GetSplitRendBitstreamHeader( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ ISAR_SPLIT_REND_CODEC *pCodec, /* o : pointer to codec setting */ ISAR_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection, /* o : pointer to pose correction mode */ int16_t *pCodec_frame_size_ms, /* o : pointer to codec frame size setting */ int16_t *pIsar_frame_size_ms /* o : pointer to ISAR frame size setting */ Word16 *pCodec_frame_size_ms, /* o : pointer to codec frame size setting */ Word16 *pIsar_frame_size_ms /* o : pointer to ISAR frame size setting */ ) { test(); Loading Loading @@ -9089,33 +9101,33 @@ void IVAS_REND_Close( ivas_error IVAS_REND_openCldfb( IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS], IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_OUTPUT_CHANNELS], const int16_t num_in_chs, const int16_t num_out_chs, const int32_t output_Fs ) const Word16 num_in_chs, const Word16 num_out_chs, const Word32 output_Fs ) { int16_t n; Word16 n; ivas_error error; for ( n = 0; n < num_in_chs; n++ ) FOR( n = 0; n < num_in_chs; n++ ) { if ( ( error = openCldfb_ivas_fx( &( cldfbAna[n] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK ) IF( ( error = openCldfb_ivas_fx( &( cldfbAna[n] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK ) { return error; } } for ( ; n < IVAS_MAX_INPUT_CHANNELS; n++ ) FOR( ; n < IVAS_MAX_INPUT_CHANNELS; n++ ) { cldfbAna[n] = NULL; } for ( n = 0; n < num_out_chs; n++ ) FOR( n = 0; n < num_out_chs; n++ ) { if ( ( error = openCldfb_ivas_fx( &( cldfbSyn[n] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK ) IF( ( error = openCldfb_ivas_fx( &( cldfbSyn[n] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK ) { return error; } } for ( ; n < IVAS_MAX_OUTPUT_CHANNELS; n++ ) FOR( ; n < IVAS_MAX_OUTPUT_CHANNELS; n++ ) { cldfbSyn[n] = NULL; } Loading @@ -9134,20 +9146,20 @@ void IVAS_REND_closeCldfb( IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS], IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_OUTPUT_CHANNELS] ) { int16_t n; Word16 n; for ( n = 0; n < IVAS_MAX_INPUT_CHANNELS; n++ ) FOR( n = 0; n < IVAS_MAX_INPUT_CHANNELS; n++ ) { if ( cldfbAna[n] != NULL ) IF( cldfbAna[n] != NULL ) { deleteCldfb_ivas_fx( &( cldfbAna[n] ) ); cldfbAna[n] = NULL; } } for ( n = 0; n < IVAS_MAX_OUTPUT_CHANNELS; n++ ) FOR( n = 0; n < IVAS_MAX_OUTPUT_CHANNELS; n++ ) { if ( cldfbSyn[n] != NULL ) IF( cldfbSyn[n] != NULL ) { deleteCldfb_ivas_fx( &( cldfbSyn[n] ) ); cldfbSyn[n] = NULL; Loading Loading @@ -9194,7 +9206,7 @@ void IVAS_REND_cldfbSynthesis_wrapper( Word32 **realBuffer, /* i : real values */ Word32 **imagBuffer, /* i : imag values */ Word32 *timeOut, /* o : output time domain samples */ const int16_t samplesToProcess, /* i : number of processed samples */ const Word16 samplesToProcess, /* i : number of processed samples */ IVAS_CLDFB_FILTER_BANK_HANDLE h_cldfb, /* i : filter bank state */ Word16 Q_cldfb, Word16 *Q_out ) Loading