diff --git a/.gitignore b/.gitignore index 376f1a4170642a2fb5a79e00de26e934421164cc..32b5db376ac09f7ec5e07924dbf0401d064b6cbd 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,7 @@ scripts/testv/stvOMASA_*.met scripts/testv/stvOMASA_*.csv scripts/testv/stvOMASA_2ISM_1MASA1TC48c.wav scripts/testv/stvOMASA_3ISM_1MASA1TC48c.wav +scripts/testv/stvO* # default reference binary name IVAS_cod_ref* IVAS_dec_ref* diff --git a/Workspace_msvc/lib_isar.vcxproj b/Workspace_msvc/lib_isar.vcxproj index 100d1afa750f22fdef25c6b952ffbe1404b1af76..5536c5f92dfdfb93acfb4a8f3bfdb24a400c5221 100644 --- a/Workspace_msvc/lib_isar.vcxproj +++ b/Workspace_msvc/lib_isar.vcxproj @@ -169,6 +169,7 @@ + diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c index 3dd7ed99a5b1379085c235c0c42c0c00b7f4a4d0..3b131759e1472519bd68abd4f983525fa33ea668 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -119,16 +119,12 @@ typedef struct OutputConfig outConfig; char inMetadataFilePaths[RENDERER_MAX_ISM_INPUTS][POST_REND_MAX_CLI_ARG_LENGTH]; int16_t numInMetadataFiles; - char outMetadataFilePath[POST_REND_MAX_CLI_ARG_LENGTH]; char headRotationFilePath[POST_REND_MAX_CLI_ARG_LENGTH]; char splitRendBFIFilePath[POST_REND_MAX_CLI_ARG_LENGTH]; - char renderConfigFilePath[POST_REND_MAX_CLI_ARG_LENGTH]; ISAR_POST_REND_COMPLEXITY_LEVEL complexityLevel; bool delayCompensationEnabled; bool quietModeEnabled; bool sceneDescriptionInput; - int16_t nonDiegeticPan; - float nonDiegeticPanGain; IVAS_RENDER_FRAMESIZE render_framesize; } CmdlnArgs; @@ -139,7 +135,6 @@ typedef enum CmdLnOptionId_outputFile, CmdLnOptionId_sampleRate, CmdLnOptionId_trajFile, - CmdLnOptionId_renderConfigFile, CmdLnOptionId_orientationTracking, CmdLnOptionId_complexityLevel, CmdLnOptionId_noDelayCmp, @@ -148,7 +143,6 @@ typedef enum CmdLnOptionId_listFormats, CmdLnOptionId_SplitRendBFIFile, CmdLnOptionId_framing, - CmdLnOptionId_nonDiegeticPan, } CmdLnOptionId; static const CmdLnParser_Option cliOptions[] = { @@ -224,12 +218,6 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "fr", .description = "Set Render audio framing.", }, - { - .id = CmdLnOptionId_nonDiegeticPan, - .match = "non_diegetic_panning", - .matchShort = "non_diegetic_pan", - .description = "Panning mono non diegetic sound to stereo -90<= pan <= 90\nleft or l or 90->left, right or r or -90->right, center or c or 0 ->middle\n", - }, }; @@ -355,36 +343,6 @@ static bool parseInConfig( return true; } -static bool parseDiegeticPan( - char *value, - float *nonDiegeticPan ) -{ - to_upper( value ); - - if ( ( strcmp( value, "CENTER" ) == 0 ) || ( strchr( value, 'C' ) != NULL ) ) - { - *nonDiegeticPan = 0.f; - } - else if ( ( strcmp( value, "LEFT" ) == 0 ) || ( strchr( value, 'L' ) != NULL ) ) - { - *nonDiegeticPan = 1.f; - } - else if ( ( strcmp( value, "RIGHT" ) == 0 ) || ( strchr( value, 'R' ) != NULL ) ) - { - *nonDiegeticPan = -1.f; - } - else - { - *nonDiegeticPan = (float) atof( value ) / 90.f; - - if ( *nonDiegeticPan > 1.0f || *nonDiegeticPan < -1.0f ) - { - fprintf( stderr, "Error: Incorrect value for panning option argument specified!\n\n" ); - return false; - } - } - return true; -} static bool parseRenderFramesize( char *value, @@ -505,12 +463,7 @@ static CmdlnArgs defaultArgs( args.numInMetadataFiles = 0; clearString( args.headRotationFilePath ); - clearString( args.outMetadataFilePath ); clearString( args.splitRendBFIFilePath ); - clearString( args.renderConfigFilePath ); - - args.nonDiegeticPan = 0; - args.nonDiegeticPanGain = 0.f; args.delayCompensationEnabled = true; args.quietModeEnabled = false; @@ -575,10 +528,6 @@ static void parseOption( assert( numOptionValues == 1 ); strncpy( args->splitRendBFIFilePath, optionValues[0], POST_REND_MAX_CLI_ARG_LENGTH - 1 ); break; - case CmdLnOptionId_renderConfigFile: - assert( numOptionValues == 1 ); - strncpy( args->renderConfigFilePath, optionValues[0], POST_REND_MAX_CLI_ARG_LENGTH - 1 ); - break; case CmdLnOptionId_complexityLevel: assert( numOptionValues == 1 ); args->complexityLevel = (int32_t) ( strtol( optionValues[0], NULL, 10 ) ); @@ -608,15 +557,6 @@ static void parseOption( exit( -1 ); } - break; - case CmdLnOptionId_nonDiegeticPan: - assert( numOptionValues == 1 ); - if ( !parseDiegeticPan( optionValues[0], &args->nonDiegeticPanGain ) ) - { - fprintf( stderr, "Unknown option for diegetic panning: %s\n", optionValues[0] ); - exit( -1 ); - } - args->nonDiegeticPan = 1; break; default: assert( 0 && "This should be unreachable - all command line options should be explicitly handled." ); @@ -854,7 +794,6 @@ int main( IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_INPUT_CHANNELS]; int16_t cldfb_in_flag, CLDFBframeSize_smpls; SplitRendBFIFileReader *splitRendBFIReader = NULL; - RenderConfigReader *renderConfigReader = NULL; AudioFileReader *audioReader = NULL; AudioFileWriter *audioWriter; int32_t inBufferSize; @@ -918,15 +857,6 @@ int main( SplitRendBFIFileReader_open( args.splitRendBFIFilePath, &splitRendBFIReader ); } - if ( !isEmptyString( args.renderConfigFilePath ) ) - { - if ( RenderConfigReader_open( args.renderConfigFilePath, &renderConfigReader ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error opening file: %s\n", args.renderConfigFilePath ); - exit( -1 ); - } - } - strncpy( audioFilePath, args.inputFilePath, FILENAME_MAX - 1 ); hSplitRendFileReadWrite = NULL; if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) @@ -1386,7 +1316,6 @@ int main( RotationFileReader_close( &externalOrientationFileReader ); ISAR_POST_REND_Close( &hIsarPostRend ); - RenderConfigReader_close( &renderConfigReader ); #ifdef DEBUGGING dbgclose(); diff --git a/lib_com/options.h b/lib_com/options.h index 3d7966ba57c755d3193ffebb4da5e72092452760..f55b04265b050a049289ef3e7e1631468ac4606b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -154,13 +154,7 @@ /* only BE switches wrt selection floating point code */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ -#ifdef SPLIT_REND_WITH_HEAD_ROT -#define SPLIT_REBD_FIX_SBA_PRE_ROT -#define LCLD_PLC_IMPROVEMENT -#define LCLD_CLEAN_UPS -#define FIX_766_OMASA_SPLIT_REND /* Nokia: issue #766: split-rendering support for OMASA */ -#endif +#define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ #define FIX_NUM_SUBFRAME_UPDATE diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index b3e4623cd76102d7f1e8602d3aa389a7ccfc3ad4..289513f2bf08c38a9c5d5699a2dd7734389fe498 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1957,10 +1957,8 @@ void ivas_binRenderer( int16_t chIdx, k; #ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx, num_poses; -#ifdef SPLIT_REBD_FIX_SBA_PRE_ROT float RealBuffer_local[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float ImagBuffer_local[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#endif #endif push_wmops( "fastconv_binaural_rendering" ); @@ -1982,7 +1980,7 @@ void ivas_binRenderer( } } } -#ifdef SPLIT_REBD_FIX_SBA_PRE_ROT + for ( chIdx = 0; chIdx < hBinRenderer->hInputSetup->nchan_out_woLFE; chIdx++ ) { for ( k = 0; k < numTimeSlots; k++ ) @@ -1991,7 +1989,6 @@ void ivas_binRenderer( mvr2r( ImagBuffer[chIdx][k], ImagBuffer_local[chIdx][k], CLDFB_NO_CHANNELS_MAX ); } } -#endif #else for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) { @@ -2050,7 +2047,7 @@ void ivas_binRenderer( Quaternions_ref = &hCombinedOrientationData->Quaternions[0]; Quaternions_rel.w = -3.0f; /*euler*/ Quaternions_abs.w = -3.0f; -#ifdef SPLIT_REBD_FIX_SBA_PRE_ROT + if ( hCombinedOrientationData->shd_rot_max_order == 0 ) { /*HOA signal already rotated by DirAC*/ @@ -2063,12 +2060,9 @@ void ivas_binRenderer( /*euler*/ Quat2EulerDegree( *Quaternions_ref, &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ } -#else - Quat2EulerDegree( *Quaternions_ref, &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ -#endif + for ( pos_idx = 1; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) { -#ifdef SPLIT_REBD_FIX_SBA_PRE_ROT for ( chIdx = 0; chIdx < hBinRenderer->hInputSetup->nchan_out_woLFE; chIdx++ ) { for ( k = 0; k < numTimeSlots; k++ ) @@ -2085,17 +2079,6 @@ void ivas_binRenderer( Quaternions_abs.z = Quaternions_abs.z + Quaternions_rel.z; QuatToRotMat( Quaternions_abs, Rmat_local ); -#else - Quaternions_rel.x = pMultiBinPoseData->relative_head_poses[pos_idx][0] - pMultiBinPoseData->relative_head_poses[pos_idx - 1][0]; - Quaternions_rel.y = pMultiBinPoseData->relative_head_poses[pos_idx][1] - pMultiBinPoseData->relative_head_poses[pos_idx - 1][1]; - Quaternions_rel.z = pMultiBinPoseData->relative_head_poses[pos_idx][2] - pMultiBinPoseData->relative_head_poses[pos_idx - 1][2]; - Quaternions_abs.x = Quaternions_abs.x + Quaternions_rel.x; - Quaternions_abs.y = Quaternions_abs.y + Quaternions_rel.y; - Quaternions_abs.z = Quaternions_abs.z + Quaternions_rel.z; - - QuatToRotMat( Quaternions_rel, Rmat_local ); -#endif - if ( hBinRenderer->hInputSetup->is_loudspeaker_setup ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index df7c6dcbbef78fb0d2bf5ca95ec00c153d23da83..2936ff0fe2050c1a1a304569532ec5743ee96e9d 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -41,6 +41,7 @@ #include "prot.h" #ifdef SPLIT_REND_WITH_HEAD_ROT #include "common_api_types.h" +#include "lib_isar_pre_rend.h" #endif #include #include @@ -76,9 +77,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,42 +93,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 -#ifdef FIX_766_OMASA_SPLIT_REND + 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 ) ) -#else - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT ) -#endif { 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 ) @@ -155,18 +137,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 ) @@ -174,7 +150,6 @@ static ivas_error ivas_dec_reconfig_split_rend( return error; } } -#endif } else if ( isCldfbNeeded == 0 && hSplitRendWrapper->hCldfbHandles != NULL ) { @@ -188,7 +163,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 ) @@ -197,24 +171,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 -#ifdef FIX_766_OMASA_SPLIT_REND 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 ) && - ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV || st_ivas->ivas_format != SBA_ISM_FORMAT ) ) -#endif -#else - if ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) -#endif { for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { @@ -242,6 +206,7 @@ static ivas_error ivas_dec_init_split_rend( { ivas_error error; int16_t cldfb_in_flag, pcm_out_flag; + int16_t mixed_td_cldfb_flag; pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; cldfb_in_flag = 0; @@ -264,24 +229,14 @@ static ivas_error ivas_dec_init_split_rend( } } - if ( ( error = isar_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, &st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms, cldfb_in_flag, pcm_out_flag, (int16_t) st_ivas->hDecoderConfig->render_framesize ) ) != IVAS_ERR_OK ) - { - return error; - } - -#ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef FIX_766_OMASA_SPLIT_REND + mixed_td_cldfb_flag = 0; 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 ) ) -#else - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT ) -#endif { - cldfb_in_flag = 0; + mixed_td_cldfb_flag = 1; } -#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 ); + 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 ); return error; } #endif @@ -2705,7 +2660,7 @@ void ivas_destroy_dec( #ifdef SPLIT_REND_WITH_HEAD_ROT /* Split binaural renderer handle */ - isar_split_renderer_close( &st_ivas->hSplitBinRend.splitrend ); + isar_pre_rend_close( &st_ivas->hSplitBinRend.splitrend, NULL ); for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 9b200b3c56c54dd098463beffa9996ae17f21dfc..8a4cdeea9e17e8c30aeda3e5ade89c66f6331ba4 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -952,16 +952,12 @@ void ivas_jbm_dec_feed_tc_to_renderer( v_multc( st_ivas->hTcBuffer->tc[CPE_CHANNELS + n], OMASA_TDREND_MATCHING_GAIN, st_ivas->hTcBuffer->tc[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available ); } #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef FIX_766_OMASA_SPLIT_REND if ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { -#endif #endif delay_signal( st_ivas->hTcBuffer->tc[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size ); #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef FIX_766_OMASA_SPLIT_REND } -#endif #endif } } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 321a998c8f42df14fa61d39880ead14f283fc8df..e3829d8396dd6ed4ab04f0c3260ed55b00efee1d 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -751,11 +751,9 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( ivas_error error; float *p_sepobj[MAX_NUM_OBJECTS]; #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef FIX_766_OMASA_SPLIT_REND int16_t slot_idx_start; slot_idx_start = st_ivas->hSpatParamRendCom->slots_rendered; -#endif #endif for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) @@ -769,7 +767,6 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( ivas_combined_orientation_set_to_start_index( st_ivas->hCombinedOrientationData ); #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef FIX_766_OMASA_SPLIT_REND if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { int16_t slot_idx, num_cldfb_bands, nchan_transport_orig, cldfb_slots; @@ -807,7 +804,6 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( } else { -#endif #endif if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_sepobj, *nSamplesRendered ) ) != IVAS_ERR_OK ) { @@ -818,9 +814,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( v_add( output_f[n], p_sepobj[n], output_f[n], *nSamplesRendered ); } #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef FIX_766_OMASA_SPLIT_REND } -#endif #endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index a338b2f477848fa5dbfdbb27684b6413a627c65b..37ddcd37d29b235a163628b5b70395e57bf6e0a5 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -138,11 +138,9 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( float *p_sepobj[BINAURAL_CHANNELS]; int16_t channel_offset; #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef FIX_766_OMASA_SPLIT_REND int16_t slot_idx_start; slot_idx_start = st_ivas->hSpatParamRendCom->slots_rendered; -#endif #endif for ( n = 0; n < BINAURAL_CHANNELS; n++ ) @@ -162,20 +160,13 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { int16_t slot_idx, num_cldfb_bands, b, nchan_transport_orig; -#ifdef FIX_766_OMASA_SPLIT_REND int16_t cldfb_slots; -#else - int16_t cldfb_slots, slot_idx_start; -#endif float Cldfb_RealBuffer[CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[CLDFB_NO_CHANNELS_MAX]; num_cldfb_bands = st_ivas->hSplitBinRend.splitrend.hCldfbHandles->cldfbAna[0]->no_channels; nchan_transport_orig = st_ivas->nchan_transport; st_ivas->nchan_transport = st_ivas->nchan_ism; -#ifndef FIX_766_OMASA_SPLIT_REND - slot_idx_start = st_ivas->hTcBuffer->n_samples_rendered / num_cldfb_bands; -#endif if ( ( error = ivas_td_binaural_renderer_sf_splitBinaural( st_ivas, output_f, *nSamplesRendered ) ) != IVAS_ERR_OK ) { return error; @@ -191,19 +182,11 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( for ( b = 0; b < num_cldfb_bands; b++ ) { -#ifdef FIX_766_OMASA_SPLIT_REND st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] = -#else - st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx][b] = -#endif ( 0.5f * st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + ( 0.5f * Cldfb_RealBuffer[b] ); -#ifdef FIX_766_OMASA_SPLIT_REND st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] = -#else - st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx][b] = -#endif ( 0.5f * st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + ( 0.5f * Cldfb_ImagBuffer[b] ); } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 563736f20f19aaca4432dc359f501fbeffecbb9f..b7740d55b74d6993bc3022656dea650e2b675963 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -35,6 +35,7 @@ #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "isar_prot.h" +#include "lib_isar_pre_rend.h" #include "prot.h" #include "jbm_jb4sb.h" #include "jbm_pcmdsp_apa.h" @@ -941,9 +942,6 @@ ivas_error IVAS_DEC_GetSamples( { return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT - /* :TODO: change nSamplesAsked also if we are in 5ms 0dof split rendering... */ -#endif } { /* check if we need to run the setup function, tc decoding and feeding the renderer */ @@ -1110,7 +1108,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( } else { -#ifdef FIX_766_OMASA_SPLIT_REND /* this is needed for OMASA-DISC, because the td-rend granularity is 240 samples at 48kHz, leading to wrong slot count. */ if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { @@ -1120,9 +1117,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( { slots_rendered = st_ivas->hTcBuffer->n_samples_rendered / st_ivas->hTcBuffer->n_samples_granularity; } -#else - slots_rendered = st_ivas->hTcBuffer->n_samples_rendered / st_ivas->hTcBuffer->n_samples_granularity; -#endif } @@ -1151,7 +1145,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( } else { -#ifdef FIX_766_OMASA_SPLIT_REND /* this is needed for OMASA-DISC, because the td-rend granularity is 240 samples at 48kHz, leading to wrong slot count. */ if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { @@ -1161,9 +1154,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( { slots_rendered_new = st_ivas->hTcBuffer->n_samples_rendered / st_ivas->hTcBuffer->n_samples_granularity; } -#else - slots_rendered_new = st_ivas->hTcBuffer->n_samples_rendered / st_ivas->hTcBuffer->n_samples_granularity; -#endif } for ( i = 0; i < BINAURAL_CHANNELS * numPoses; ++i ) @@ -1199,15 +1189,15 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( Quaternion.y = 0.0f; Quaternion.z = 0.0f; } - if ( ( error = isar_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, - Quaternion, - st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, - st_ivas->hRenderConfig->split_rend_config.codec, - st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms, - splitRendBits, - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural, - max_band, pOutput, 1, !td_input, pcm_out_flag, ro_md_flag ) ) != IVAS_ERR_OK ) + if ( ( error = isar_pre_rend_MultiBinToSplitBinaural( &hSplitBinRend->splitrend, + Quaternion, + st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, + st_ivas->hRenderConfig->split_rend_config.codec, + st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms, + splitRendBits, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + max_band, pOutput, 1, !td_input, pcm_out_flag, ro_md_flag ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_isar/isar_PredEncoder.c b/lib_isar/isar_PredEncoder.c index 50476def749ff09ac195aede38b8233dd7611b39..29ad80329e5ef84414e53535aed2ab042c469fc1 100644 --- a/lib_isar/isar_PredEncoder.c +++ b/lib_isar/isar_PredEncoder.c @@ -100,17 +100,6 @@ ivas_error CreatePredictionEncoder( psPredictionEncoder->iSubSetId = 0; psPredictionEncoder->iMaxNumPredBands = iMaxNumPredBands; psPredictionEncoder->iNumSubSets = iNumSubSets; -#ifndef LCLD_CLEAN_UPS - if ( ( psPredictionEncoder->pfWindow = (float *) malloc( sizeof( float ) * LCLD_PRED_WIN_LEN ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); - } - - for ( n = 0; n < LCLD_PRED_WIN_LEN; n++ ) - { - psPredictionEncoder->pfWindow[n] = 0.54f - 0.46f * cosf( 2.0f * M_PI * ( (float) n + 0.5f ) / (float) LCLD_PRED_WIN_LEN ); - } -#endif if ( ( psPredictionEncoder->piPredChanEnable = (int32_t *) malloc( sizeof( int32_t ) * iChannels ) ) == NULL ) { @@ -280,9 +269,6 @@ void DeletePredictionEncoder( PredictionEncoder *psPredictionEncoder ) { int32_t n; -#ifndef LCLD_CLEAN_UPS - free( psPredictionEncoder->pfWindow ); -#endif for ( n = 0; n < psPredictionEncoder->iChannels; n++ ) { int32_t k; @@ -499,17 +485,6 @@ void ComputePredictors( activate_bit( &psPredictionEncoder->piPredChanEnable[c], psPredictionEncoder->iSubSetId ); psPredictionEncoder->piNumPredBands[c] = iPredBands + bstep; } -#ifndef LCLD_CLEAN_UPS - else if ( iPredBands > 0 ) - { - for ( b = iPredBands; b < LCLD_BANDS; b += bstep ) - { - psPredictionEncoder->ppiPredBandEnable[c][b] = 0; - } - activate_bit( &psPredictionEncoder->piPredChanEnable[c], psPredictionEncoder->iSubSetId ); - psPredictionEncoder->piNumPredBands[c] = iPredBands; - } -#endif else { for ( b = b0; b < LCLD_BANDS; b += bstep ) @@ -529,61 +504,6 @@ void ComputePredictors( * * *-------------------------------------------------------------------*/ -#ifndef LCLD_CLEAN_UPS -void ApplyForwardPredictors( - PredictionEncoder *psPredictionEncoder, - float ***pppfReal, - float ***pppfImag ) -{ - int32_t c; - for ( c = 0; c < psPredictionEncoder->iChannels; c++ ) - { - int32_t b; - if ( psPredictionEncoder->piPredChanEnable[c] > 0 ) - { - for ( b = 0; b < LCLD_BANDS; b++ ) - { - if ( psPredictionEncoder->ppiPredBandEnable[c][b] == 1 ) - { - int32_t n; - float fOldReal = 0.0f; - float fOldImag = 0.0f; - float fA1Real; - float fA1Imag; - - int32_t iSubset = b % psPredictionEncoder->iNumSubSets; - if ( iSubset != psPredictionEncoder->iSubSetId ) - { - fOldReal = psPredictionEncoder->ppfInpPrevReal[c][b]; - fOldImag = psPredictionEncoder->ppfInpPrevImag[c][b]; - } - psPredictionEncoder->ppfInpPrevReal[c][b] = pppfReal[c][psPredictionEncoder->iNumBlocks - 1][b]; - psPredictionEncoder->ppfInpPrevImag[c][b] = pppfImag[c][psPredictionEncoder->iNumBlocks - 1][b]; - - fA1Real = psPredictionEncoder->ppfA1Real[c][b]; - fA1Imag = psPredictionEncoder->ppfA1Imag[c][b]; - for ( n = 0; n < psPredictionEncoder->iNumBlocks; n++ ) - { - float fReal; - float fImag; - - fReal = pppfReal[c][n][b] + fA1Real * fOldReal - fA1Imag * fOldImag; - fImag = pppfImag[c][n][b] + fA1Real * fOldImag + fA1Imag * fOldReal; - - fOldReal = pppfReal[c][n][b]; - fOldImag = pppfImag[c][n][b]; - - pppfReal[c][n][b] = fReal; - pppfImag[c][n][b] = fImag; - } - } - } - } - } - - return; -} -#endif /*-------------------------------------------------------------------* * Function WritePredictors() diff --git a/lib_isar/isar_lcld_decoder.c b/lib_isar/isar_lcld_decoder.c index 0cba1c1ebb6715f2696dd04a43f9ce9317a21c36..8f3bf1f11723b55dc9ce314d7336149e86ffdca1 100644 --- a/lib_isar/isar_lcld_decoder.c +++ b/lib_isar/isar_lcld_decoder.c @@ -722,13 +722,8 @@ static int32_t ReadHuff( const uint32_t ( *pauiHuffDecTable )[HUFF_DEC_TABLE_SIZ static int32_t ReadRMSEnvelope( const int32_t iChannels, const int32_t *piNumGroups, const int32_t iNumBands, int32_t ***pppiRMSEnvelope, ISAR_SPLIT_REND_BITS_HANDLE pBits ); static int32_t ReadAllocInformation( int32_t *piAllocOffset, ISAR_SPLIT_REND_BITS_HANDLE pBits ); -#ifdef LCLD_PLC_IMPROVEMENT static int32_t ReadLCLDData( const int32_t *piNumGroups, int32_t **ppiGroupLengths, const int32_t iNumBands, const int32_t iNumChannels, int32_t **ppiDecodingUnresolved, int32_t **ppiPredEnable, const int32_t iNumSubSets, const int32_t iSubSetId, int32_t ***pppiAlloc, int32_t ***pppiSignReal, int32_t ***pppiSignImag, int32_t ***pppiQReal, int32_t ***pppiQImag, int32_t **ppiDecodingFailed, ISAR_SPLIT_REND_BITS_HANDLE pBits, uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE] ); -#else -static int32_t -ReadLCLDData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ISAR_SPLIT_REND_BITS_HANDLE pBits, uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE] ); -#endif static void ComputeAllocation( const int32_t iChannels, const int32_t *piNumGroups, const int32_t iNumBands, int32_t ***pppiSMR, const int32_t iAllocOffset, int32_t ***pppiAlloc ); void SetDecodingUnresolved( LCLDDecoder *psLCLDDecoder ) @@ -876,7 +871,7 @@ int32_t DecodeLCLDFrame( } ComputeAllocation( psLCLDDecoder->iChannels, (const int32_t *) psLCLDDecoder->piNumGroups, psLCLDDecoder->iNumBands, psLCLDDecoder->pppiSMR, psLCLDDecoder->iAllocOffset, psLCLDDecoder->pppiAlloc ); -#ifdef LCLD_PLC_IMPROVEMENT + ReadLCLDData( psLCLDDecoder->piNumGroups, psLCLDDecoder->ppiGroupLengths, @@ -894,29 +889,6 @@ int32_t DecodeLCLDFrame( psLCLDDecoder->psPredictionDecoder->ppiDecodingFailed, pBits, psLCLDDecoder->c_apauiHuffDecTable_RAM ); -#else - if ( AnyDecodingUnresolved( psLCLDDecoder->psPredictionDecoder ) ) - { - return 1; - } - for ( n = 0; n < psLCLDDecoder->iChannels; n++ ) - { - ReadLCLDData( - psLCLDDecoder->piNumGroups[n], - (const int32_t *) psLCLDDecoder->ppiGroupLengths[n], - psLCLDDecoder->iNumBands, - psLCLDDecoder->piBandwidths, - (const int32_t *) psLCLDDecoder->psPredictionDecoder->ppiPredBandEnable[n], - psLCLDDecoder->pppiAlloc[n], - psLCLDDecoder->pppiLCLDSignReal[n], - psLCLDDecoder->pppiLCLDSignImag[n], - psLCLDDecoder->pppiQLCLDReal[n], - psLCLDDecoder->pppiQLCLDImag[n], - pBits, - psLCLDDecoder->c_apauiHuffDecTable_RAM ); - } - SetDecodingPassed( psLCLDDecoder->psPredictionDecoder ); -#endif for ( n = 0; n < psLCLDDecoder->iChannels; n++ ) { @@ -1552,7 +1524,6 @@ static int32_t ReadAllocInformation( return iBitsRead; } -#ifdef LCLD_PLC_IMPROVEMENT static int32_t ReadLCLDData( const int32_t *piNumGroups, int32_t **ppiGroupLengths, @@ -1726,142 +1697,6 @@ static int32_t ReadLCLDData( return iBitsRead; } -#else -static int32_t ReadLCLDData( - const int32_t iNumGroups, - const int32_t *piGroupLengths, - const int32_t iNumBands, - const int32_t *piBandwidths, - const int32_t *piPredEnable, - int32_t **ppiAlloc, - int32_t **ppiSignReal, - int32_t **ppiSignImag, - int32_t **ppiQReal, - int32_t **ppiQImag, - ISAR_SPLIT_REND_BITS_HANDLE pBits, - uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE] ) -{ - int32_t b, k, m, n; - int32_t iBitsRead, iBlockOffest, iFBOffset; - int32_t iAlloc, iHuffDim, iHuffMod; - - iBitsRead = 0; - iBlockOffest = 0; - for ( n = 0; n < iNumGroups; n++ ) - { - for ( k = 0; k < piGroupLengths[n]; k++ ) - { - iFBOffset = 0; - for ( b = 0; b < iNumBands; b++ ) - { - iAlloc = ppiAlloc[n][b]; - - iHuffDim = c_aiHuffmanDim[iAlloc]; - iHuffMod = c_aiHuffmanMod[iAlloc]; - - if ( iAlloc > 0 ) - { - const uint32_t( *pauiHuffmanTable )[HUFF_DEC_TABLE_SIZE] = NULL; - const uint32_t( *pauiHuffmanTableDPCM )[HUFF_DEC_TABLE_SIZE] = NULL; -#ifdef USE_DEMOD_TABLES - const int32_t( *paiDemodTable )[2] = NULL; -#endif - pauiHuffmanTable = (const uint32_t( * )[HUFF_DEC_TABLE_SIZE]) c_apauiHuffDecTables[iAlloc]; - pauiHuffmanTableDPCM = (const uint32_t( * )[HUFF_DEC_TABLE_SIZE]) c_apauiHuffDecTables[ALLOC_TABLE_SIZE + iAlloc]; -#ifdef USE_DEMOD_TABLES - paiDemodTable = c_apaiDemodTables[iAlloc]; -#endif - for ( m = 0; m < piBandwidths[b]; m++ ) - { - int32_t iQuantValue1 = 0; - int32_t iQuantValue2 = 0; - - if ( piPredEnable[iFBOffset] == 1 ) - { - if ( iHuffDim == 2 ) - { - int32_t iSymbol; - iBitsRead += ReadHuff( pauiHuffmanTableDPCM, &iSymbol, pBits ); -#ifdef USE_DEMOD_TABLES - iQuantValue1 = paiDemodTable[iSymbol][0]; - iQuantValue2 = paiDemodTable[iSymbol][1]; -#else - iQuantValue1 = iSymbol / iHuffMod; - iQuantValue2 = iSymbol % iHuffMod; -#endif - } - else - { - iBitsRead += ReadHuff( pauiHuffmanTableDPCM, &iQuantValue1, pBits ); - iBitsRead += ReadHuff( pauiHuffmanTableDPCM, &iQuantValue2, pBits ); - } - } - else - { - if ( iHuffDim == 2 ) - { - int32_t iSymbol; - - iBitsRead += ReadHuff( pauiHuffmanTable, &iSymbol, pBits ); -#ifdef USE_DEMOD_TABLES - iQuantValue1 = paiDemodTable[iSymbol][0]; - iQuantValue2 = paiDemodTable[iSymbol][1]; -#else - iQuantValue1 = iSymbol / iHuffMod; - iQuantValue2 = iSymbol % iHuffMod; -#endif - } - else - { - iBitsRead += ReadHuff( pauiHuffmanTable, &iQuantValue1, pBits ); - iBitsRead += ReadHuff( pauiHuffmanTable, &iQuantValue2, pBits ); - } - } - - ppiQReal[iBlockOffest][iFBOffset] = iQuantValue1; - ppiQImag[iBlockOffest][iFBOffset] = iQuantValue2; - - if ( iQuantValue1 > 0 ) - { - ppiSignReal[iBlockOffest][iFBOffset] = ISAR_SPLIT_REND_BITStream_read_int32( pBits, 1 ); - iBitsRead += 1; - } - else - { - ppiSignReal[iBlockOffest][iFBOffset] = 0; - } - if ( iQuantValue2 > 0 ) - { - ppiSignImag[iBlockOffest][iFBOffset] = ISAR_SPLIT_REND_BITStream_read_int32( pBits, 1 ); - iBitsRead += 1; - } - else - { - ppiSignImag[iBlockOffest][iFBOffset] = 0; - } - - iFBOffset++; - } - } - else - { - for ( m = 0; m < piBandwidths[b]; m++ ) - { - ppiSignReal[iBlockOffest][iFBOffset] = 0; - ppiSignImag[iBlockOffest][iFBOffset] = 0; - iFBOffset++; - } - } - } - - iBlockOffest++; - } - } - - return iBitsRead; -} -#endif - static void ComputeAllocation( const int32_t iChannels, diff --git a/lib_isar/isar_lcld_encoder.c b/lib_isar/isar_lcld_encoder.c index fe230fcc0586db1158a30c7ac06ac7634b2d5652..67ec7569da16492140727d73ef0ed7f572a005d4 100644 --- a/lib_isar/isar_lcld_encoder.c +++ b/lib_isar/isar_lcld_encoder.c @@ -198,14 +198,7 @@ ivas_error CreateLCLDEncoder( psLCLDEncoder->piBandwidths = c_aiBandwidths48; psLCLDEncoder->iNumBands = DEF_BANDS_48; /* 22 bands = 50 CLDFB bands (rather than 23 bands) */ -#ifdef LCLD_CLEAN_UPS iMaxNumPredBands = min( c_aiNumLcldBandsPerBand[psLCLDEncoder->iNumBands - 1], 50 ); -#else - for ( n = 0; n < psLCLDEncoder->iNumBands; n++ ) - { - iMaxNumPredBands += psLCLDEncoder->piBandwidths[n]; - } -#endif if ( iRealOnlyOut == 1 ) { iMaxNumPredBands = 0; @@ -556,11 +549,8 @@ static int32_t WriteRMSEnvelope( const int32_t iChannels, const int32_t *piNumGr static int32_t WriteAllocInformation( const int32_t iAllocOffset, ISAR_SPLIT_REND_BITS_HANDLE pBits ); -#ifdef LCLD_PLC_IMPROVEMENT static int32_t WriteLCLDData( const int32_t *piNumGroups, int32_t **ppiGroupLengths, const int32_t iNumBands, const int32_t iNumChannels, int32_t **ppiPredEnable, const int32_t iNumSubSets, const int32_t iSubSetId, int32_t ***pppiAlloc, int32_t ***pppiSignReal, int32_t ***pppiSignImag, int32_t ***pppiQReal, int32_t ***pppiQImag, ISAR_SPLIT_REND_BITS_HANDLE pBits ); -#else -static int32_t WriteLCLDData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ISAR_SPLIT_REND_BITS_HANDLE pBits ); -#endif + static int32_t ComputeAllocation( const int32_t iChannels, const int32_t *piNumGroups, int32_t **ppiGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, float ***pppfReal, float ***pppfImag, int32_t ***pppiSMR, const int32_t iAvailableBits, int32_t *piAllocOffset, int32_t ***pppiAlloc, int32_t ***pppiQReal, int32_t ***pppiQImag, int32_t ***pppiSignReal, int32_t ***pppiSignImag, PredictionEncoder *psPredictionEncoder ); /*------------------------------------------------------------------------------------------* @@ -746,7 +736,6 @@ int32_t EncodeLCLDFrame( iBitsWritten += WriteAllocInformation( psLCLDEncoder->iAllocOffset, pBits ); iAudioBitsWritten = iBitsWritten; -#ifdef LCLD_PLC_IMPROVEMENT iBitsWritten += WriteLCLDData( psLCLDEncoder->piNumGroups, psLCLDEncoder->ppiGroupLengths, psLCLDEncoder->iNumBands, @@ -760,22 +749,6 @@ int32_t EncodeLCLDFrame( psLCLDEncoder->pppiQLCLDReal, psLCLDEncoder->pppiQLCLDImag, pBits ); -#else - for ( n = 0; n < psLCLDEncoder->iChannels; n++ ) - { - iBitsWritten += WriteLCLDData( psLCLDEncoder->piNumGroups[n], - (const int32_t *) psLCLDEncoder->ppiGroupLengths[n], - psLCLDEncoder->iNumBands, - psLCLDEncoder->piBandwidths, - (const int32_t *) psLCLDEncoder->psPredictionEncoder->ppiPredBandEnable[n], - psLCLDEncoder->pppiAlloc[n], - psLCLDEncoder->pppiLCLDSignReal[n], - psLCLDEncoder->pppiLCLDSignImag[n], - psLCLDEncoder->pppiQLCLDReal[n], - psLCLDEncoder->pppiQLCLDImag[n], - pBits ); - } -#endif *piBitsWritten = iBitsWritten; iAudioBitsWritten = iBitsWritten - iAudioBitsWritten; @@ -1642,7 +1615,7 @@ static int32_t WriteAllocInformation( return iBitsWritten; } -#ifdef LCLD_PLC_IMPROVEMENT + static int32_t WriteLCLDData( const int32_t *piNumGroups, int32_t **ppiGroupLengths, @@ -1772,130 +1745,6 @@ static int32_t WriteLCLDData( return iBitsWritten; } -#else -static int32_t WriteLCLDData( - const int32_t iNumGroups, - const int32_t *piGroupLengths, - const int32_t iNumBands, - const int32_t *piBandwidths, - const int32_t *piPredEnable, - int32_t **ppiAlloc, - int32_t **ppiSignReal, - int32_t **ppiSignImag, - int32_t **ppiQReal, - int32_t **ppiQImag, - ISAR_SPLIT_REND_BITS_HANDLE pBits ) -{ - int32_t n; - int32_t iBitsWritten; - int32_t iBlockOffest; - - iBitsWritten = 0; - iBlockOffest = 0; - - for ( n = 0; n < iNumGroups; n++ ) - { - int32_t k; - for ( k = 0; k < piGroupLengths[n]; k++ ) - { - int32_t b; - int32_t iFBOffset; - - iFBOffset = 0; - for ( b = 0; b < iNumBands; b++ ) - { - int32_t m; - int32_t iAlloc; - int32_t iHuffDim; - int32_t iHuffMod; - - iAlloc = ppiAlloc[n][b]; - - iHuffDim = c_aiHuffmanDim[iAlloc]; - iHuffMod = c_aiHuffmanMod[iAlloc]; - - if ( iAlloc > 0 ) - { - const uint16_t( *pauiHuffmanTable )[2] = NULL; - const uint16_t( *pauiHuffmanTableDPCM )[2] = NULL; - pauiHuffmanTable = c_apauiHuffEncTabels[iAlloc]; - pauiHuffmanTableDPCM = c_apauiHuffEncTabels[ALLOC_TABLE_SIZE + iAlloc]; - for ( m = 0; m < piBandwidths[b]; m++ ) - { - int32_t iQuantValue1; - int32_t iQuantValue2; - - iQuantValue1 = ppiQReal[iBlockOffest][iFBOffset]; - iQuantValue2 = ppiQImag[iBlockOffest][iFBOffset]; - - if ( piPredEnable[iFBOffset] == 1 ) - { - if ( iHuffDim == 2 ) - { - int32_t iSymbol; - iSymbol = iQuantValue1; - iSymbol *= iHuffMod; - iSymbol += iQuantValue2; - ISAR_SPLIT_REND_BITStream_write_int32( pBits, pauiHuffmanTableDPCM[iSymbol][1], pauiHuffmanTableDPCM[iSymbol][0] ); - iBitsWritten += pauiHuffmanTableDPCM[iSymbol][0]; - } - else - { - ISAR_SPLIT_REND_BITStream_write_int32( pBits, pauiHuffmanTableDPCM[iQuantValue1][1], pauiHuffmanTableDPCM[iQuantValue1][0] ); - iBitsWritten += pauiHuffmanTableDPCM[iQuantValue1][0]; - - ISAR_SPLIT_REND_BITStream_write_int32( pBits, pauiHuffmanTableDPCM[iQuantValue2][1], pauiHuffmanTableDPCM[iQuantValue2][0] ); - iBitsWritten += pauiHuffmanTableDPCM[iQuantValue2][0]; - } - } - else - { - if ( iHuffDim == 2 ) - { - int32_t iSymbol; - iSymbol = iQuantValue1; - iSymbol *= iHuffMod; - iSymbol += iQuantValue2; - ISAR_SPLIT_REND_BITStream_write_int32( pBits, pauiHuffmanTable[iSymbol][1], pauiHuffmanTable[iSymbol][0] ); - iBitsWritten += pauiHuffmanTable[iSymbol][0]; - } - else - { - ISAR_SPLIT_REND_BITStream_write_int32( pBits, pauiHuffmanTable[iQuantValue1][1], pauiHuffmanTable[iQuantValue1][0] ); - iBitsWritten += pauiHuffmanTable[iQuantValue1][0]; - - ISAR_SPLIT_REND_BITStream_write_int32( pBits, pauiHuffmanTable[iQuantValue2][1], pauiHuffmanTable[iQuantValue2][0] ); - iBitsWritten += pauiHuffmanTable[iQuantValue2][0]; - } - } - - if ( iQuantValue1 > 0 ) - { - ISAR_SPLIT_REND_BITStream_write_int32( pBits, ppiSignReal[iBlockOffest][iFBOffset], 1 ); - iBitsWritten += 1; - } - if ( iQuantValue2 > 0 ) - { - ISAR_SPLIT_REND_BITStream_write_int32( pBits, ppiSignImag[iBlockOffest][iFBOffset], 1 ); - iBitsWritten += 1; - } - - iFBOffset++; - } - } - else - { - iFBOffset += piBandwidths[b]; - } - } - - iBlockOffest++; - } - } - - return iBitsWritten; -} -#endif static int32_t ComputeAllocation( const int32_t iChannels, diff --git a/lib_isar/isar_lcld_prot.h b/lib_isar/isar_lcld_prot.h index 094d40698c19797ab25023c702bd17e3ac528691..048d3da65e1e7f71786ca1b0fde94eb2ab61d2a8 100644 --- a/lib_isar/isar_lcld_prot.h +++ b/lib_isar/isar_lcld_prot.h @@ -241,9 +241,6 @@ typedef struct PREDICTION_ENCODER float **ppfPredStateImagTmp; float **ppfInpPrevReal; /* channels, bands */ float **ppfInpPrevImag; -#ifndef LCLD_CLEAN_UPS - float *pfWindow; -#endif float pfRxxReal[2]; float pfRxxImag[2]; @@ -276,13 +273,6 @@ void ComputePredictors( float ***pppfImag ); -#ifndef LCLD_CLEAN_UPS -void ApplyForwardPredictors( - PredictionEncoder *psPredictionEncoder, - float ***pppfReal, - float ***pppfImag -); -#endif int32_t WritePredictors( PredictionEncoder *psPredictionEncoder, diff --git a/lib_isar/isar_lcld_rom_tables.c b/lib_isar/isar_lcld_rom_tables.c index 63c3751474e2fb78090ad2c598b88d846b4c3a58..85bc36494ee362724ee9e1fbc2b5879cec2e106a 100644 --- a/lib_isar/isar_lcld_rom_tables.c +++ b/lib_isar/isar_lcld_rom_tables.c @@ -42,12 +42,11 @@ const int32_t c_aiNumLcldBandsPerBand[MAX_BANDS_48] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 21, 24, 27, 31, 37, 43, 50, 60 }; -#ifdef LCLD_PLC_IMPROVEMENT const int32_t c_aiBandIdPerLcldBand[LCLD_BANDS] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 }; -#endif + /* phi = (-12:12)'/12 *pi; tmp = [cos(phi),sin(phi)]; tmp = tmp';sprintf('{%.8ff, %.8ff},\n',tmp(:)) */ const float c_afRotRealImag[PHASE_MAX_VAL - PHASE_MIN_VAL + 1][2] = { diff --git a/lib_isar/isar_prot.h b/lib_isar/isar_prot.h index a9917abb077b0c987e5ac99979f9f2ca191cf002..9288ccaf1ffaba9e22239ac30bfb68727c558d70 100644 --- a/lib_isar/isar_prot.h +++ b/lib_isar/isar_prot.h @@ -175,11 +175,6 @@ void isar_SplitRenderer_getdiagdiff( const int16_t min_val, const int16_t max_val ); -void isar_renderSplitGetMultiBinPoseData( - const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - const ISAR_SPLIT_REND_ROT_AXIS rot_axis ); - void isar_split_rend_get_quant_params( const int16_t num_md_bands, int16_t pred_real_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], @@ -232,6 +227,11 @@ void isar_rend_CldfbSplitPostRendProcess( void isar_init_multi_bin_pose_data( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData ); +void isar_renderSplitGetMultiBinPoseData( + const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const ISAR_SPLIT_REND_ROT_AXIS rot_axis ); + void isar_rend_CldfbSplitPreRendProcess( const ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, const IVAS_QUATERNION headPosition, @@ -246,19 +246,6 @@ void isar_rend_CldfbSplitPreRendProcess( void isar_init_split_post_rend_handles( ISAR_SPLIT_POST_REND_WRAPPER *hSplitRendWrapper ); -ivas_error isar_splitBinPreRendOpen( - ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend, -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - const int32_t output_Fs -#else - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData -#endif -); - -void ivas_splitBinPreRendClose( - ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend ); - void isar_set_split_rend_ht_setup( ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData ); @@ -286,17 +273,6 @@ int32_t isar_get_lcld_bitrate( int8_t isar_get_lc3plus_bitrate_id( const int32_t SplitRendBitRate ); -ivas_error isar_split_renderer_open( - SPLIT_REND_WRAPPER *hSplitBinRend, - const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, - const int32_t output_Fs, - const int16_t cldfb_in_flag, - const int16_t pcm_out_flag, - const int16_t num_subframes ); - -void isar_split_renderer_close( - SPLIT_REND_WRAPPER *hSplitBinRend ); - int32_t isar_get_split_rend_md_target_brate( const int32_t SplitRendBitRate, const int16_t pcm_out_flag ); @@ -309,22 +285,6 @@ ivas_error isar_split_rend_choose_default_codec( const int16_t num_subframes /* i : number of subframes */ ); -ivas_error isar_renderMultiBinToSplitBinaural( - SPLIT_REND_WRAPPER *hSplitBin, - const IVAS_QUATERNION headPosition, - const int32_t SplitRendBitRate, - ISAR_SPLIT_REND_CODEC splitCodec, - int16_t codec_frame_size_ms, - ISAR_SPLIT_REND_BITS_HANDLE pBits, - float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const int16_t max_bands, - float *output[], - const int16_t low_res_pre_rend_rot, - const int16_t cldfb_in_flag, - const int16_t pcm_out_flag, - const int16_t ro_md_flag ); - void ISAR_SPLIT_REND_BITStream_init( ISAR_SPLIT_REND_BITS_HANDLE pBits, const int32_t buf_len_bytes, @@ -357,20 +317,6 @@ ISAR_POST_REND_AudioConfigType isar_getAudioConfigType( void isar_init_split_rend_handles( SPLIT_REND_WRAPPER *hSplitRendWrapper ); -void closeSplitRend( - SPLIT_REND_WRAPPER *pSplitRendWrapper, - IVAS_REND_AudioBuffer *pSplitRendEncBuffer ); - -ivas_error initSplitRend( - SPLIT_REND_WRAPPER *pSplitRendWrapper, - IVAS_REND_AudioBuffer *pSplitRendEncBuffer, - const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, - IVAS_REND_HeadRotData headRotData, - const int32_t outputSampleRate, - const IVAS_AUDIO_CONFIG outConfig, - const int16_t cldfb_in_flag, - const int16_t num_subframes ); - #endif /* clang-format on */ diff --git a/lib_isar/isar_splitRendererPre.c b/lib_isar/isar_splitRendererPre.c index 44967419a018350aa212c27006b5b4910fb17990..52be145f44b1df09df63f22bc0f71d8f55e30336 100644 --- a/lib_isar/isar_splitRendererPre.c +++ b/lib_isar/isar_splitRendererPre.c @@ -41,6 +41,7 @@ #include "prot.h" #include "ivas_cnst.h" #include "isar_rom_post_rend.h" +#include "lib_isar_pre_rend.h" #include "isar_prot.h" #ifdef DEBUGGING #include "debug.h" @@ -50,6 +51,8 @@ #include "string.h" #endif +#define MAX_BUFFER_LENGTH_PER_CHANNEL ( L_FRAME48k ) +#define MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL ( MAX_BUFFER_LENGTH_PER_CHANNEL * 2 ) /*------------------------------------------------------------------------- * Local functions @@ -1491,7 +1494,7 @@ void isar_rend_CldfbSplitPreRendProcess( * *------------------------------------------------------------------------*/ -ivas_error isar_splitBinPreRendOpen( +static ivas_error isar_splitBinPreRendOpen( ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG @@ -1570,7 +1573,7 @@ ivas_error isar_splitBinPreRendOpen( * *------------------------------------------------------------------------*/ -void ivas_splitBinPreRendClose( +static void ivas_splitBinPreRendClose( ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend ) { if ( ( *hBinHrSplitPreRend ) != NULL ) @@ -1633,6 +1636,19 @@ void isar_set_split_rend_ht_setup( return; } +/*-------------------------------------------------------------------------* + * isar_pre_rend_GetMultiBinPoseData() + * + * + *-------------------------------------------------------------------------*/ + +void isar_pre_rend_GetMultiBinPoseData( + const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const ISAR_SPLIT_REND_ROT_AXIS rot_axis ) +{ + isar_renderSplitGetMultiBinPoseData( pSplit_rend_config, pMultiBinPoseData, rot_axis ); +} /*-------------------------------------------------------------------------* * isar_set_split_rend_setup() @@ -1640,6 +1656,7 @@ void isar_set_split_rend_ht_setup( * Setup IVAS split rendering *-------------------------------------------------------------------------*/ + ivas_error isar_set_split_rend_setup( ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, ISAR_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, @@ -1710,30 +1727,6 @@ void isar_init_split_rend_handles( return; } -/*------------------------------------------------------------------------- - * Function closeSplitRend() - * - * - *------------------------------------------------------------------------*/ - -void closeSplitRend( - SPLIT_REND_WRAPPER *pSplitRendWrapper, - IVAS_REND_AudioBuffer *pSplitRendEncBuffer ) -{ - isar_split_renderer_close( pSplitRendWrapper ); - - if ( pSplitRendEncBuffer->data != NULL ) - { - free( pSplitRendEncBuffer->data ); - pSplitRendEncBuffer->data = NULL; - } - - pSplitRendEncBuffer->config.numChannels = 0; - pSplitRendEncBuffer->config.numSamplesPerChannel = 0; - - return; -} - /*------------------------------------------------------------------------- * Function split_renderer_open_lc3plus() * @@ -1804,57 +1797,51 @@ static ivas_error split_renderer_open_lc3plus( /*------------------------------------------------------------------------- - * Function isar_split_renderer_open() + * Function isar_pre_rend_open() * * *------------------------------------------------------------------------*/ -ivas_error isar_split_renderer_open( +ivas_error isar_pre_rend_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, - const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, + ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int32_t OutSampleRate, const int16_t cldfb_in_flag, const int16_t pcm_out_flag, - const int16_t num_subframes ) + const int16_t num_subframes, + const int16_t mixed_td_cldfb_flag ) { ivas_error error, ch, num_ch; -#ifndef SPLIT_REND_WITH_HEAD_ROT - CLDFB_TYPE cldfbMode; -#endif uint8_t isCldfbNeeded = 0; -#ifndef SPLIT_REND_WITH_HEAD_ROT - cldfbMode = CLDFB_ANALYSIS; -#endif + + int16_t cldfb_in_flag_local = cldfb_in_flag; + + if ( ( error = isar_split_rend_choose_default_codec( &( pSplitRendConfig->codec ), &pSplitRendConfig->codec_frame_size_ms, cldfb_in_flag_local, pcm_out_flag, (int16_t) num_subframes ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( mixed_td_cldfb_flag ) + { + cldfb_in_flag_local = 0; + } if ( ( error = isar_split_rend_validate_config( pSplitRendConfig, pcm_out_flag ) ) != IVAS_ERR_OK ) { return error; } - if ( cldfb_in_flag == 0 ) + if ( cldfb_in_flag_local == 0 ) { isCldfbNeeded = 1; -#ifndef SPLIT_REND_WITH_HEAD_ROT - cldfbMode = CLDFB_ANALYSIS; -#endif } - else if ( pSplitRendConfig->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS && cldfb_in_flag ) + else if ( pSplitRendConfig->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS && cldfb_in_flag_local ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT isCldfbNeeded = 1; -#else - isCldfbNeeded = 1; - cldfbMode = CLDFB_SYNTHESIS; -#endif } - else if ( pcm_out_flag && cldfb_in_flag ) + else if ( pcm_out_flag && cldfb_in_flag_local ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT - isCldfbNeeded = 1; -#else isCldfbNeeded = 1; - cldfbMode = CLDFB_SYNTHESIS; -#endif } hSplitRendWrapper->hCldfbHandles = NULL; @@ -1871,30 +1858,23 @@ ivas_error isar_split_renderer_open( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] = NULL; } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] = NULL; } -#endif num_ch = hSplitRendWrapper->multiBinPoseData.num_poses * BINAURAL_CHANNELS; for ( ch = 0; ch < num_ch; ch++ ) { if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), -#ifndef SPLIT_REND_WITH_HEAD_ROT - cldfbMode, -#else CLDFB_ANALYSIS, -#endif OutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) { return error; } } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] ), CLDFB_SYNTHESIS, OutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) @@ -1902,7 +1882,6 @@ ivas_error isar_split_renderer_open( return error; } } -#endif } if ( pSplitRendConfig->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) @@ -1942,15 +1921,15 @@ ivas_error isar_split_renderer_open( return IVAS_ERR_OK; } - /*------------------------------------------------------------------------- - * Function isar_split_renderer_close() + * Function isar_pre_rend_close() * * *------------------------------------------------------------------------*/ -void isar_split_renderer_close( - SPLIT_REND_WRAPPER *hSplitBinRend ) +void isar_pre_rend_close( + SPLIT_REND_WRAPPER *hSplitBinRend, + IVAS_REND_AudioBuffer *pSplitRendEncBuffer ) { int16_t i; @@ -1977,7 +1956,6 @@ void isar_split_renderer_close( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { if ( hSplitBinRend->hCldfbHandles->cldfbSyn[ch] != NULL ) @@ -1986,7 +1964,6 @@ void isar_split_renderer_close( hSplitBinRend->hCldfbHandles->cldfbSyn[ch] = NULL; } } -#endif free( hSplitBinRend->hCldfbHandles ); hSplitBinRend->hCldfbHandles = NULL; @@ -2006,6 +1983,19 @@ void isar_split_renderer_close( } } + if ( pSplitRendEncBuffer != NULL ) + { + + if ( pSplitRendEncBuffer->data != NULL ) + { + free( pSplitRendEncBuffer->data ); + pSplitRendEncBuffer->data = NULL; + } + + pSplitRendEncBuffer->config.numChannels = 0; + pSplitRendEncBuffer->config.numSamplesPerChannel = 0; + } + return; } @@ -2282,12 +2272,12 @@ static void lc3plusTimeAlignCldfbPoseCorr( /*------------------------------------------------------------------------- - * Function isar_renderMultiBinToSplitBinaural() + * Function isar_pre_rend_MultiBinToSplitBinaural() * * *------------------------------------------------------------------------*/ -ivas_error isar_renderMultiBinToSplitBinaural( +ivas_error isar_pre_rend_MultiBinToSplitBinaural( SPLIT_REND_WRAPPER *hSplitBin, const IVAS_QUATERNION headPosition, const int32_t SplitRendBitRate, @@ -2307,7 +2297,7 @@ ivas_error isar_renderMultiBinToSplitBinaural( int32_t bit_len, target_md_bits, actual_md_bits, available_bits; error = IVAS_ERR_OK; - push_wmops( "isar_renderMultiBinToSplitBinaural" ); + push_wmops( "isar_pre_rend_MultiBinToSplitBinaural" ); if ( hSplitBin->multiBinPoseData.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { @@ -2315,15 +2305,6 @@ ivas_error isar_renderMultiBinToSplitBinaural( set_pose_types( hSplitBin->hBinHrSplitPreRend->pose_type, &hSplitBin->multiBinPoseData ); } - /* Needs to be done at runtime. If this was in another API function, - * there would be no guarantee that the user did not change - * the split rendering config before calling the main rendering function */ - if ( ( error = isar_split_rend_choose_default_codec( &splitCodec, &codec_frame_size_ms, cldfb_in_flag, pcm_out_flag, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( cldfb_in_flag == 0 ) { /*TD input*/ @@ -2379,11 +2360,8 @@ ivas_error isar_renderMultiBinToSplitBinaural( Cldfb_In_BinReal_p[slot_idx] = Cldfb_In_BinReal[ch][slot_idx]; Cldfb_In_BinImag_p[slot_idx] = Cldfb_In_BinImag[ch][slot_idx]; } -#ifndef SPLIT_REND_WITH_HEAD_ROT - cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, output[ch], hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbAna[ch] ); -#else + cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, output[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * num_slots, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); -#endif } if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, SplitRendBitRate, output ) ) != IVAS_ERR_OK ) @@ -2407,11 +2385,7 @@ ivas_error isar_renderMultiBinToSplitBinaural( Cldfb_In_BinImag_p[slot_idx] = Cldfb_In_BinImag[ch][slot_idx]; } -#ifndef SPLIT_REND_WITH_HEAD_ROT - cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, output[ch], hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbAna[ch] ); -#else cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, output[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); -#endif } pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; diff --git a/lib_isar/lib_isar_post_rend.c b/lib_isar/lib_isar_post_rend.c index e53dee1203c98101ac56ebee33d6a642f92aab38..fb11136002f52740c3f3df3bbd46fe8c1ae0d743 100644 --- a/lib_isar/lib_isar_post_rend.c +++ b/lib_isar/lib_isar_post_rend.c @@ -632,61 +632,6 @@ static void clearInputSplitRend( } -ivas_error initSplitRend( - SPLIT_REND_WRAPPER *pSplitRendWrapper, - IVAS_REND_AudioBuffer *pSplitRendEncBuffer, - const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, - IVAS_REND_HeadRotData headRotData, - const int32_t outputSampleRate, - const AUDIO_CONFIG outConfig, - const int16_t cldfb_in_flag, - const int16_t num_subframes ) -{ - ivas_error error; - IVAS_REND_AudioBufferConfig bufConfig; - - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) - { - if ( pSplit_rend_config->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) - { - isar_renderSplitGetMultiBinPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData, headRotData.sr_pose_pred_axis ); - } - else if ( pSplit_rend_config->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) - { - isar_renderSplitUpdateNoCorrectionPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData ); - } - - if ( ( error = isar_split_renderer_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in_flag, outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, num_subframes ) ) != IVAS_ERR_OK ) - { - return error; - } - - /*allocate for CLDFB in and change to TD during process if needed*/ - bufConfig.numSamplesPerChannel = MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL; - bufConfig.numChannels = BINAURAL_CHANNELS * pSplitRendWrapper->multiBinPoseData.num_poses; - bufConfig.is_cldfb = 1; - pSplitRendEncBuffer->config = bufConfig; - - if ( ( pSplitRendEncBuffer->data = malloc( bufConfig.numChannels * bufConfig.numSamplesPerChannel * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERR_FAILED_ALLOC; - } - } - else - { - IVAS_REND_AudioBufferConfig bufConfig2; - - bufConfig2.numSamplesPerChannel = 0; - bufConfig2.numChannels = 0; - bufConfig2.is_cldfb = 0; - pSplitRendEncBuffer->config = bufConfig2; - pSplitRendEncBuffer->data = NULL; - } - - return IVAS_ERR_OK; -} - - /*------------------------------------------------------------------------- * ISAR_POST_REND_Open() * diff --git a/lib_isar/lib_isar_pre_rend.h b/lib_isar/lib_isar_pre_rend.h new file mode 100644 index 0000000000000000000000000000000000000000..d8b8b2583e408f231624ce49e3eac2079b72935c --- /dev/null +++ b/lib_isar/lib_isar_pre_rend.h @@ -0,0 +1,75 @@ +/****************************************************************************************************** + + (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef LIB_ISAR_PRE_REND_H +#define LIB_ISAR_PRE_REND_H + +#include "common_api_types.h" +#include "isar_stat.h" +#include "isar_prot.h" + +ivas_error isar_pre_rend_open( + SPLIT_REND_WRAPPER *hSplitBinRend, + ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, + const int32_t output_Fs, + const int16_t cldfb_in_flag, + const int16_t pcm_out_flag, + const int16_t num_subframes, + const int16_t mixed_td_cldfb_flag ); + +void isar_pre_rend_close( + SPLIT_REND_WRAPPER *hSplitBinRend, + IVAS_REND_AudioBuffer *pSplitRendEncBuffer ); + +void isar_pre_rend_GetMultiBinPoseData( + const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const ISAR_SPLIT_REND_ROT_AXIS rot_axis ); + +ivas_error isar_pre_rend_MultiBinToSplitBinaural( + SPLIT_REND_WRAPPER *hSplitBin, + const IVAS_QUATERNION headPosition, + const int32_t SplitRendBitRate, + ISAR_SPLIT_REND_CODEC splitCodec, + int16_t codec_frame_size_ms, + ISAR_SPLIT_REND_BITS_HANDLE pBits, + float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const int16_t max_bands, + float *output[], + const int16_t low_res_pre_rend_rot, + const int16_t cldfb_in_flag, + const int16_t pcm_out_flag, + const int16_t ro_md_flag ); + + +#endif /* LIB_ISAR_PRE_REND_H */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 562f07b2345f1dbf6cd9ba8751ec145444a773ea..a15654155a956c9e7ba23a5b93be8a2a6a620d99 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -800,13 +800,8 @@ static void ivas_dirac_dec_binaural_internal( ivas_dirac_dec_binaural_formulate_input_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, subframe, subFrameTotalEne, IIReneLimiter ); -#ifdef FIX_766_OMASA_SPLIT_REND ivas_dirac_dec_binaural_formulate_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Rmat, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, subFrameTotalEne, IIReneLimiter, st_ivas->hMasaIsmData ); -#else - ivas_dirac_dec_binaural_formulate_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Rmat, subframe, - hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, subFrameTotalEne, IIReneLimiter, st_ivas->hMasaIsmData ); -#endif #endif nchanSeparateChannels = 0; @@ -837,19 +832,11 @@ static void ivas_dirac_dec_binaural_internal( for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { -#ifdef FIX_766_OMASA_SPLIT_REND for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe]; i++ ) { mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX ); mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX ); } -#else - for ( i = 0; i < CLDFB_SLOTS_PER_SUBFRAME; i++ ) - { - mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX ); - mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX ); - } -#endif } } else @@ -918,19 +905,11 @@ static void ivas_dirac_dec_binaural_internal( /* copy from temporary buffer to the main split rendering buffer */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { -#ifdef FIX_766_OMASA_SPLIT_REND for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe]; i++ ) { mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX ); mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX ); } -#else - for ( i = 0; i < CLDFB_SLOTS_PER_SUBFRAME; i++ ) - { - mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX ); - mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX ); - } -#endif } hDiracDecBin->hDiffuseDist = NULL; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 163797e7b3ae7ce219c7a79879efdf4c4ef95872..6d4d98162f93e4384eaf4207c7c61e64e3c3c59d 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1393,82 +1393,6 @@ ivas_error ivas_orient_trk_Process( IVAS_QUATERNION *pTrkRot /* o : tracked rotation */ ); -#ifdef SPLIT_REND_WITH_HEAD_ROT - - -/*----------------------------------------------------------------------------------* - * Split binaural renderer prototypes - *----------------------------------------------------------------------------------*/ - -void isar_set_split_rend_ht_setup( - ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData -); - -void isar_init_split_rend_handles( - SPLIT_REND_WRAPPER *hSplitRendWrapper -); - -ivas_error isar_split_renderer_open( - SPLIT_REND_WRAPPER *hSplitBinRend, - const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, - const int32_t output_Fs, - const int16_t cldfb_in_flag, - const int16_t pcm_out_flag, - const int16_t num_subframes -); - -void isar_split_renderer_close( - SPLIT_REND_WRAPPER *hSplitBinRend -); - -void isar_init_multi_bin_pose_data( - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData -); - -void isar_renderSplitGetMultiBinPoseData( - const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - const ISAR_SPLIT_REND_ROT_AXIS rot_axis -); - -void isar_renderSplitUpdateNoCorrectionPoseData( - const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData -); - -ivas_error isar_renderMultiBinToSplitBinaural( - SPLIT_REND_WRAPPER *hSplitBin, - const IVAS_QUATERNION headPosition, - const int32_t SplitRendBitRate, - ISAR_SPLIT_REND_CODEC splitCodec, - int16_t codec_frame_size_ms, - ISAR_SPLIT_REND_BITS_HANDLE pBits, - float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const int16_t max_bands, - float *output[], - const int16_t low_res_pre_rend_rot, - const int16_t cldfb_in_flag, - const int16_t pcm_out_flag, - const int16_t ro_md_flag -); - -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG -void isar_log_cldfb2wav_data( - float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - HANDLE_CLDFB_FILTER_BANK *cldfbSyn, - const int16_t num_chs, - const int16_t num_freq_bands, - const int32_t output_Fs, - const int16_t start_slot_idx, - const int16_t md_band_idx, - const char *filename -); -#endif - -#endif /*----------------------------------------------------------------------------------* * Rendering & merging to MASA format diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ac9eac225066523a2898ad6ada676614504a3e81..98a2bc4f32b6fbe4f54d79bb68ed76d761d082b3 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -37,6 +37,7 @@ #include "ivas_prot_rend.h" #include "isar_prot.h" #include "isar_stat.h" +#include "lib_isar_pre_rend.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_rend.h" @@ -3547,6 +3548,66 @@ static int16_t getCldfbRendFlag( return isCldfbRend; } +/*------------------------------------------------------------------------- + * Function ivas_pre_rend_init() + * + * + *------------------------------------------------------------------------*/ + +static ivas_error ivas_pre_rend_init( + SPLIT_REND_WRAPPER *pSplitRendWrapper, + IVAS_REND_AudioBuffer *pSplitRendEncBuffer, + ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, + IVAS_REND_HeadRotData headRotData, + const int32_t outputSampleRate, + const AUDIO_CONFIG outConfig, + const int16_t cldfb_in_flag, + const int16_t num_subframes ) +{ + ivas_error error; + IVAS_REND_AudioBufferConfig bufConfig; + + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + if ( pSplit_rend_config->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) + { + isar_renderSplitGetMultiBinPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData, headRotData.sr_pose_pred_axis ); + } + else if ( pSplit_rend_config->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) + { + isar_renderSplitUpdateNoCorrectionPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData ); + } + + if ( ( error = isar_pre_rend_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in_flag, outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, num_subframes, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + + /*allocate for CLDFB in and change to TD during process if needed*/ + bufConfig.numSamplesPerChannel = MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL; + bufConfig.numChannels = BINAURAL_CHANNELS * pSplitRendWrapper->multiBinPoseData.num_poses; + bufConfig.is_cldfb = 1; + pSplitRendEncBuffer->config = bufConfig; + + if ( ( pSplitRendEncBuffer->data = malloc( bufConfig.numChannels * bufConfig.numSamplesPerChannel * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERR_FAILED_ALLOC; + } + } + else + { + IVAS_REND_AudioBufferConfig bufConfig2; + + bufConfig2.numSamplesPerChannel = 0; + bufConfig2.numChannels = 0; + bufConfig2.is_cldfb = 0; + pSplitRendEncBuffer->config = bufConfig2; + pSplitRendEncBuffer->data = NULL; + } + + return IVAS_ERR_OK; +} + #endif @@ -3581,12 +3642,7 @@ ivas_error IVAS_REND_AddInput( int16_t cldfb_in_flag; cldfb_in_flag = getCldfbRendFlag( hIvasRend, getAudioConfigType( inConfig ) ); - if ( ( error = isar_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec, &hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, cldfb_in_flag, hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_pre_rend_init( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) { return error; } @@ -4421,14 +4477,9 @@ int16_t IVAS_REND_FeedRenderConfig( { int16_t cldfb_in_flag; cldfb_in_flag = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN ); - closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); - - if ( ( error = isar_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec, &hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, cldfb_in_flag, hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) - { - return error; - } + isar_pre_rend_close( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); - if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_pre_rend_init( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) { return error; } @@ -7672,8 +7723,8 @@ static ivas_error getSamplesInternal( } } - if ( ( error = isar_renderMultiBinToSplitBinaural( &hIvasRend->splitRendWrapper, hIvasRend->headRotData.headPositions[0], hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, hIvasRend->hRendererConfig->split_rend_config.codec, 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 ) ) != IVAS_ERR_OK ) + 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.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 ) ) != IVAS_ERR_OK ) { return error; } @@ -7823,12 +7874,6 @@ void IVAS_REND_Close( { clearInputMasa( &hIvasRend->inputsMasa[i] ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT - // for ( i = 0; i < RENDERER_MAX_BIN_INPUTS; ++i ) - // { - // clearInputSplitRend( &hIvasRend->inputsSplitPost[i] ); - // } -#endif /* clear Config. Renderer */ ivas_render_config_close( &( hIvasRend->hRendererConfig ) ); @@ -7837,7 +7882,7 @@ void IVAS_REND_Close( #ifdef SPLIT_REND_WITH_HEAD_ROT /* Split binaural rendering */ - closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); + isar_pre_rend_close( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); #endif closeHeadRotation( hIvasRend );