diff --git a/apps/decoder.c b/apps/decoder.c index 10a8ce23705d30e0326c0b008a69db37a7d3ed35..aca1635eae8a9de576d934aa559e678017d08452 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -455,14 +455,9 @@ int main( *------------------------------------------------------------------------------------------*/ #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef SPLIT_REND_LCLD_5MS asked_frame_size = arg.renderFramesize; -#endif if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { -#ifndef SPLIT_REND_LCLD_5MS - asked_frame_size = arg.renderFramesize; -#endif if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); @@ -475,12 +470,6 @@ int main( goto cleanup; } -#ifndef SPLIT_REND_LCLD_5MS - if ( arg.renderFramesize != asked_frame_size ) - { - fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for split rendering!\n" ); - } -#endif arg.enableHeadRotation = true; } #endif @@ -633,26 +622,6 @@ int main( goto cleanup; } -#ifdef SPLIT_REND_WITH_HEAD_ROT -#ifndef SPLIT_REND_LCLD_5MS - if ( arg.renderFramesize == IVAS_RENDER_FRAMESIZE_5MS && ( renderConfig.split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE || - renderConfig.split_rend_config.dof == 0 ) ) - { - /*TODO : needs to be refined as this wont work with LCLD codec*/ - arg.renderFramesize = IVAS_RENDER_FRAMESIZE_5MS; - } - else - { - arg.renderFramesize = IVAS_RENDER_FRAMESIZE_20MS; - } - - if ( ( error = IVAS_DEC_SetRenderFramesize( hIvasDec, arg.renderFramesize ) ) != IVAS_ERR_OK ) - { - return error; - } - -#endif -#endif if ( RenderConfigReader_read( renderConfigReader, arg.renderConfigFilename, &renderConfig ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename ); @@ -665,7 +634,6 @@ int main( goto cleanup; } -#ifdef SPLIT_REND_LCLD_5MS #ifdef SPLIT_REND_WITH_HEAD_ROT if ( asked_frame_size != IVAS_RENDER_FRAMESIZE_20MS && ( renderConfig.split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE || renderConfig.split_rend_config.dof == 0 ) ) @@ -686,7 +654,6 @@ int main( { fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for non-0dof split rendering!\n" ); } -#endif #endif if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) diff --git a/apps/renderer.c b/apps/renderer.c index 636c6d651bdb9d52a7c50730af9806315c516314..007ef477e7687759d994c44a413a0243f576bc69 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1889,7 +1889,6 @@ int main( #ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < args.inConfig.numBinBuses; ++i ) { -#ifdef SPLIT_REND_LCLD_5MS if ( numSamplesRead > 0 ) { if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, splitBinIds[i], &numChannels ) ) != IVAS_ERR_OK ) @@ -1905,23 +1904,8 @@ int main( exit( -1 ); } } -#endif if ( splitBinNeedsNewFrame ) { -#ifndef SPLIT_REND_LCLD_5MS - if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, splitBinIds[i], &numChannels ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); - } - IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.binBuses[i].inputChannelIndex, numChannels ); - - if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, splitBinIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); - } -#endif if ( ( error = IVAS_REND_FeedSplitBinauralBitstream( hIvasRend, splitBinIds[i], &bitsBuffer ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); @@ -2225,9 +2209,7 @@ cleanup: } split_rend_reader_writer_close( &hSplitRendFileReadWrite ); -#ifdef SPLIT_REND_LCLD_5MS SplitRendBFIFileReader_close( &splitRendBFIReader ); -#endif #endif for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) diff --git a/lib_com/options.h b/lib_com/options.h index f79b3468396f65f777e1dc2fd031e0ecab217607..7065d18d9114789de0b208306ba3f52e7b4ac46c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,11 +173,6 @@ /* all switches in this category should start with "NONBE_" */ #define NONBE_FIX_978_MC_TDREND_REVERB /* Eri : activate reverb for TDREND with headtracking */ - -#ifdef SPLIT_REND_WITH_HEAD_ROT -#define SPLIT_REND_LCLD_5MS /* Dlb: LCLD 5ms framing operation */ -#endif - #define NONBE_FIX_984_OMASA_EXT_OUTPUT /* Nokia: issue #984: complete the OMASA EXT output implementation */ #define NONBE_FIX_1000_G1_G2_SWB_TBE /* VA: issue 1000: avoid div by zero due to g1 + g2 being zero in SWB TBE */ #define NONBE_FIX_999_JBM_MCT_FLUSH /* FhG: issue #999: fix wrong flushing for MCT at a JBM rate switch */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 802c2394848b81e9875204c597ad59288ca35ece..1e6ac794ebb10a03db37e1b1c7c4fadea67c6133 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -247,17 +247,10 @@ static ivas_error ivas_dec_init_split_rend( } } -#ifdef SPLIT_REND_LCLD_5MS if ( ( error = ivas_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; } -#else - if ( ( error = ivas_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 ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT ) @@ -266,11 +259,7 @@ static ivas_error ivas_dec_init_split_rend( } #endif -#ifdef SPLIT_REND_LCLD_5MS error = ivas_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 ); -#else - error = ivas_split_renderer_open( &st_ivas->hSplitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, st_ivas->hDecoderConfig->render_framesize == IVAS_RENDER_FRAMESIZE_5MS ); -#endif return error; } #endif @@ -2559,9 +2548,6 @@ void ivas_initialize_handles_dec( st_ivas->hSplitBinRend.hMultiBinCldfbData = NULL; st_ivas->hSplitBinRend.hSplitRendBits = NULL; st_ivas->hSplitBinRend.hCldfbDataOut = NULL; -#ifndef SPLIT_REND_LCLD_5MS - st_ivas->hSplitBinRend.tdDataOut = NULL; -#endif st_ivas->hSplitBinRend.numTdSamplesPerChannelCached = 0; ivas_init_split_rend_handles( &st_ivas->hSplitBinRend.splitrend ); #endif @@ -2711,12 +2697,6 @@ void ivas_destroy_dec( free( st_ivas->hSplitBinRend.hCldfbDataOut ); st_ivas->hSplitBinRend.hCldfbDataOut = NULL; } -#ifndef SPLIT_REND_LCLD_5MS - if ( st_ivas->hSplitBinRend.tdDataOut != NULL ) - { - free( st_ivas->hSplitBinRend.tdDataOut ); - } -#endif #endif /* Parametric binaural renderer handle */ diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 2ff77228f829165ce1238bcb4f7a8465b563ee4e..d6b12947ef70498e08ca2123987f5594d6272c69 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -66,15 +66,7 @@ const int16_t MC_PARAMUPMIX_CHIDX2[MC_PARAMUPMIX_COMBINATIONS] = { 2, 3, 6, 7 }; static void ps_pred_process_sf( MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, DECODER_TC_BUFFER_HANDLE hTcBuffer, float qmf_mod_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_mod_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_side_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_side_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float *param_interpol, const int16_t ch, const int16_t slots_rendered ); -#ifndef SPLIT_REND_LCLD_5MS -#ifdef SPLIT_REND_WITH_HEAD_ROT -static void ivas_mc_paramupmix_dec_sf( Decoder_Struct *st_ivas, float *output_f[MAX_OUTPUT_CHANNELS], const int16_t slot_index_start ); -#else -static void ivas_mc_paramupmix_dec_sf( Decoder_Struct *st_ivas, float *output_f[MAX_OUTPUT_CHANNELS] ); -#endif -#else static void ivas_mc_paramupmix_dec_sf( Decoder_Struct *st_ivas, float *output_f[MAX_OUTPUT_CHANNELS] ); -#endif static void ivas_param_upmix_dec_decorr_subframes( Decoder_Struct *st_ivas, const int16_t nSamplesForRendering ); @@ -234,11 +226,6 @@ void ivas_mc_paramupmix_dec_render( int16_t slots_to_render, first_sf, last_sf, subframe_idx; uint16_t slot_size, ch; float *output_f_local[MAX_OUTPUT_CHANNELS]; -#ifndef SPLIT_REND_LCLD_5MS -#ifdef SPLIT_REND_WITH_HEAD_ROT - int16_t slot_index_start; -#endif -#endif MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; hMCParamUpmix = st_ivas->hMCParamUpmix; @@ -273,25 +260,10 @@ void ivas_mc_paramupmix_dec_render( assert( slots_to_render == 0 ); #endif { -#ifndef SPLIT_REND_LCLD_5MS -#ifdef SPLIT_REND_WITH_HEAD_ROT - slot_index_start = 0; -#endif -#endif for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { int16_t n_samples_sf = slot_size * st_ivas->hTcBuffer->subframe_nbslots[subframe_idx]; -#ifndef SPLIT_REND_LCLD_5MS -#ifdef SPLIT_REND_WITH_HEAD_ROT - ivas_mc_paramupmix_dec_sf( st_ivas, output_f_local, slot_index_start ); - - slot_index_start += st_ivas->hTcBuffer->subframe_nbslots[subframe_idx]; -#else - ivas_mc_paramupmix_dec_sf( st_ivas, output_f_local ); -#endif -#else ivas_mc_paramupmix_dec_sf( st_ivas, output_f_local ); -#endif for ( ch = 0; ch < min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ) ); ch++ ) { @@ -664,22 +636,10 @@ static void ps_pred_process_sf( return; } -#ifndef SPLIT_REND_LCLD_5MS -static void ivas_mc_paramupmix_dec_sf( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ -#ifdef SPLIT_REND_WITH_HEAD_ROT - float *output_f[MAX_OUTPUT_CHANNELS], /* i/o: synthesized core-coder transport channels */ - const int16_t slot_index_start -#else - float *output_f[MAX_OUTPUT_CHANNELS] /* i/o: synthesized core-coder transport channels */ -#endif -) -#else static void ivas_mc_paramupmix_dec_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float *output_f[MAX_OUTPUT_CHANNELS] /* i/o: synthesized core-coder transport channels */ ) -#endif { int16_t i, ch, slot_idx, k; float *pPcm_temp[MC_PARAMUPMIX_COMBINATIONS * 2]; /* decorrelated and undecorrelated*/ @@ -694,9 +654,7 @@ static void ivas_mc_paramupmix_dec_sf( #ifdef SPLIT_REND_WITH_HEAD_ROT float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#ifdef SPLIT_REND_LCLD_5MS int16_t slot_index_start; -#endif #else float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; @@ -707,9 +665,7 @@ static void ivas_mc_paramupmix_dec_sf( push_wmops( "ivas_mc_paramupmix_dec_sf" ); #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef SPLIT_REND_LCLD_5MS slot_index_start = st_ivas->hTcBuffer->slots_rendered; -#endif #endif for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) { diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 46b2533270af9100c84f779e3d4183daf38d22dc..dccd1391a514b4321ab6bc928a6bef4ba7a3badb 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -998,9 +998,6 @@ typedef struct IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits; /*scratch buffer for frame by frame processing*/ SPLIT_REND_WRAPPER splitrend; IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE hCldfbDataOut; /*buffer to store cldfb data before binauralization*/ -#ifndef SPLIT_REND_LCLD_5MS - float *tdDataOut; /*buffer to store TD data before binauralization*/ -#endif int16_t numTdSamplesPerChannelCached; } IVAS_DEC_SPLIT_REND_WRAPPER; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 61d452d9da43cdf0a81ef57b940755867552fd23..d06e882f4d4a3542c8dfa2173ccc5a6c04228c12 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1058,20 +1058,11 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( Decoder_Struct *st_ivas; AUDIO_CONFIG output_config; int32_t output_Fs; -#ifndef SPLIT_REND_LCLD_5MS - float *writePtr; - float *readPtr, *readEnd; -#endif float *pOutput[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES]; float output[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES][L_FRAME48k]; float pcmBuf[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES * L_FRAME48k]; -#ifdef SPLIT_REND_LCLD_5MS float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; -#else - int16_t numSamplesPerChannelCacheSize; - int16_t numSamplesPerChannelToSplitEncode; -#endif int16_t numSamplesPerChannelToDecode; int16_t i, j; ivas_error error; @@ -1080,9 +1071,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( int16_t pcm_out_flag; int16_t td_input; int16_t numPoses; -#ifdef SPLIT_REND_LCLD_5MS int16_t slots_rendered, slots_rendered_new; -#endif int16_t ro_md_flag; error = IVAS_ERR_OK; @@ -1101,7 +1090,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( numPoses = hSplitBinRend->splitrend.multiBinPoseData.num_poses; -#ifdef SPLIT_REND_LCLD_5MS if ( st_ivas->hDecoderConfig->render_framesize != IVAS_RENDER_FRAMESIZE_20MS && ( hIvasDec->st_ivas->hRenderConfig->split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE || hIvasDec->st_ivas->hRenderConfig->split_rend_config.dof == 0 ) ) @@ -1109,35 +1097,11 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( numSamplesPerChannelToDecode = (int16_t) ( output_Fs / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ); numSamplesPerChannelToDecode *= (int16_t) st_ivas->hDecoderConfig->render_framesize; } -#else - if ( st_ivas->hDecoderConfig->render_framesize == IVAS_RENDER_FRAMESIZE_5MS && hIvasDec->st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS && - ( hIvasDec->st_ivas->hRenderConfig->split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE || - hIvasDec->st_ivas->hRenderConfig->split_rend_config.dof == 0 ) ) - { - numSamplesPerChannelToSplitEncode = (int16_t) ( output_Fs / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ); - numSamplesPerChannelCacheSize = numSamplesPerChannelToDecode - numSamplesPerChannelToSplitEncode; - - if ( hSplitBinRend->tdDataOut == NULL ) - { - /* Allocate enough space to save all decoded samples that will not be split encoded directly after decoding */ - if ( ( hSplitBinRend->tdDataOut = malloc( numSamplesPerChannelCacheSize * BINAURAL_CHANNELS * numPoses * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERR_FAILED_ALLOC; - } - } - } - else - { - numSamplesPerChannelToSplitEncode = (int16_t) ( output_Fs / FRAMES_PER_SEC ); - numSamplesPerChannelCacheSize = 0; - } -#endif if ( output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { return IVAS_ERR_WRONG_PARAMS; } -#ifdef SPLIT_REND_LCLD_5MS if ( st_ivas->hTcBuffer == NULL || hIvasDec->hasBeenFedFrame ) { slots_rendered = 0; @@ -1153,55 +1117,9 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( { return error; } -#else - if ( numSamplesPerChannelToDecode == numSamplesPerChannelToSplitEncode || hSplitBinRend->numTdSamplesPerChannelCached == 0 ) - { - /* Decode and render */ - if ( ( error = IVAS_DEC_GetSamples( hIvasDec, numSamplesPerChannelToDecode, IVAS_DEC_PCM_FLOAT, pcmBuf, nOutSamples, needNewFrame ) ) != IVAS_ERR_OK ) - { - return error; - } -#ifdef DEBUGGING - assert( numSamplesPerChannelToDecode == *nOutSamples ); -#endif - - /* copy to cache if cache is in use */ - if ( hSplitBinRend->tdDataOut != NULL ) - { - writePtr = hSplitBinRend->tdDataOut; - readPtr = pcmBuf + numSamplesPerChannelToSplitEncode * BINAURAL_CHANNELS * numPoses; - readEnd = pcmBuf + *nOutSamples * BINAURAL_CHANNELS * numPoses; - - while ( readPtr != readEnd ) - { - *writePtr++ = *readPtr++; - } - hSplitBinRend->numTdSamplesPerChannelCached = *nOutSamples - numSamplesPerChannelToSplitEncode; - } - } - else - { - /* copy from cache */ - assert( hSplitBinRend->tdDataOut != NULL ); - - readPtr = hSplitBinRend->tdDataOut + ( numSamplesPerChannelCacheSize - hSplitBinRend->numTdSamplesPerChannelCached ) * BINAURAL_CHANNELS * numPoses; - readEnd = readPtr + numSamplesPerChannelToSplitEncode * BINAURAL_CHANNELS * numPoses; - writePtr = pcmBuf; - - while ( readPtr != readEnd ) - { - *writePtr++ = *readPtr++; - } - hSplitBinRend->numTdSamplesPerChannelCached -= numSamplesPerChannelToSplitEncode; - } -#endif -/* change buffer layout */ -#ifdef SPLIT_REND_LCLD_5MS + /* change buffer layout */ for ( i = 0; i < numSamplesPerChannelToDecode; ++i ) -#else - for ( i = 0; i < numSamplesPerChannelToSplitEncode; ++i ) -#endif { for ( j = 0; j < BINAURAL_CHANNELS * numPoses; ++j ) { @@ -1213,7 +1131,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( pOutput[i] = output[i]; } -#ifdef SPLIT_REND_LCLD_5MS if ( st_ivas->hTcBuffer == NULL ) { slots_rendered_new = 0; @@ -1231,7 +1148,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( mvr2r( hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[i][j], Cldfb_ImagBuffer_Binaural[i][j - slots_rendered], CLDFB_NO_CHANNELS_MAX ); } } -#endif max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); pcm_out_flag = ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; @@ -1252,13 +1168,8 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( st_ivas->hRenderConfig->split_rend_config.codec, st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms, hSplitBinRend->hSplitRendBits, -#ifdef SPLIT_REND_LCLD_5MS Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, -#else - hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, - hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural, -#endif max_band, pOutput, 1, !td_input, pcm_out_flag, ro_md_flag ) ) != IVAS_ERR_OK ) { @@ -1271,30 +1182,18 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( if ( st_ivas->hDecoderConfig->render_framesize == IVAS_RENDER_FRAMESIZE_5MS ) { #ifndef DISABLE_LIMITER -#ifdef SPLIT_REND_LCLD_5MS ivas_limiter_dec( st_ivas->hLimiter, pOutput, st_ivas->hDecoderConfig->nchan_out, numSamplesPerChannelToDecode, st_ivas->BER_detect ); -#else - ivas_limiter_dec( st_ivas->hLimiter, pOutput, st_ivas->hDecoderConfig->nchan_out, numSamplesPerChannelToSplitEncode, st_ivas->BER_detect ); -#endif #endif } else { -#ifdef SPLIT_REND_LCLD_5MS ivas_limiter_dec( st_ivas->hLimiter, pOutput, st_ivas->hDecoderConfig->nchan_out, numSamplesPerChannelToDecode, st_ivas->BER_detect ); -#else - ivas_limiter_dec( st_ivas->hLimiter, pOutput, st_ivas->hDecoderConfig->nchan_out, numSamplesPerChannelToSplitEncode, st_ivas->BER_detect ); -#endif } #ifdef DEBUGGING st_ivas->noClipping += #endif -#ifdef SPLIT_REND_LCLD_5MS ivas_syn_output( pOutput, numSamplesPerChannelToDecode, st_ivas->hDecoderConfig->nchan_out, (int16_t *) pcmBuf_out ); -#else - ivas_syn_output( pOutput, numSamplesPerChannelToSplitEncode, st_ivas->hDecoderConfig->nchan_out, (int16_t *) pcmBuf_out ); -#endif } free( st_ivas->hSplitBinRend.hMultiBinCldfbData ); @@ -3844,11 +3743,9 @@ ivas_error IVAS_DEC_GetSplitRendBits( splitRendBits->pose_correction = hIvasDec->st_ivas->hSplitBinRend.hSplitRendBits->pose_correction; splitRendBits->codec_frame_size_ms = hIvasDec->st_ivas->hSplitBinRend.hSplitRendBits->codec_frame_size_ms; -#ifdef SPLIT_REND_LCLD_5MS /* data consumed, free it */ free( hIvasDec->st_ivas->hSplitBinRend.hSplitRendBits ); hIvasDec->st_ivas->hSplitBinRend.hSplitRendBits = NULL; -#endif return IVAS_ERR_OK; diff --git a/lib_rend/ivas_PredDecoder.c b/lib_rend/ivas_PredDecoder.c index 1fe552f3fae10051d4dd040c63aa3d14d46a819f..ce791e93291b12d5f4034fcf111172137040126d 100644 --- a/lib_rend/ivas_PredDecoder.c +++ b/lib_rend/ivas_PredDecoder.c @@ -52,9 +52,7 @@ ivas_error CreatePredictionDecoder( const int32_t iNumBlocks ) { int16_t n; -#ifdef SPLIT_REND_LCLD_5MS int16_t m; -#endif PredictionDecoder *psPredictionDecoder = NULL; if ( ( psPredictionDecoder = (PredictionDecoder *) malloc( sizeof( PredictionDecoder ) ) ) == NULL ) @@ -64,25 +62,12 @@ ivas_error CreatePredictionDecoder( psPredictionDecoder->iChannels = iChannels; psPredictionDecoder->iNumBlocks = iNumBlocks; -#ifdef SPLIT_REND_LCLD_5MS psPredictionDecoder->iNumSubSets = LCLD_BLOCKS_PER_FRAME / psPredictionDecoder->iNumBlocks; psPredictionDecoder->iSubSetId = 0; -#endif if ( ( psPredictionDecoder->piPredChanEnable = (int32_t *) malloc( sizeof( int32_t ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } -#ifndef SPLIT_REND_LCLD_5MS - if ( ( psPredictionDecoder->piNumPredBands = (int32_t *) malloc( sizeof( int32_t ) * iChannels ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); - } - - if ( ( psPredictionDecoder->ppfEstPredGain = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); - } -#endif if ( ( psPredictionDecoder->ppiPredBandEnable = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); @@ -103,7 +88,6 @@ ivas_error CreatePredictionDecoder( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } -#ifdef SPLIT_REND_LCLD_5MS if ( ( psPredictionDecoder->ppfPredStateReal = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) ); @@ -112,28 +96,18 @@ ivas_error CreatePredictionDecoder( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) ); } -#endif for ( n = 0; n < psPredictionDecoder->iChannels; n++ ) { -#ifdef SPLIT_REND_LCLD_5MS psPredictionDecoder->piPredChanEnable[n] = 0; -#else - if ( ( psPredictionDecoder->ppfEstPredGain[n] = (float *) malloc( sizeof( float ) * LCLD_BANDS ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); - } -#endif if ( ( psPredictionDecoder->ppiPredBandEnable[n] = (int32_t *) malloc( LCLD_BANDS * sizeof( int32_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } -#ifdef SPLIT_REND_LCLD_5MS for ( m = 0; m < LCLD_BANDS; m++ ) { psPredictionDecoder->ppiPredBandEnable[n][m] = 0; } -#endif if ( ( psPredictionDecoder->ppfA1Real[n] = (float *) malloc( sizeof( float ) * LCLD_BANDS ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); @@ -150,7 +124,6 @@ ivas_error CreatePredictionDecoder( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } -#ifdef SPLIT_REND_LCLD_5MS if ( ( psPredictionDecoder->ppfPredStateReal[n] = (float *) malloc( LCLD_BANDS * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionDecoder Module \n" ) ); @@ -159,14 +132,11 @@ ivas_error CreatePredictionDecoder( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionDecoder Module \n" ) ); } -#ifdef SPLIT_REND_LCLD_5MS for ( m = 0; m < LCLD_BANDS; m++ ) { psPredictionDecoder->ppfPredStateReal[n][m] = 0; psPredictionDecoder->ppfPredStateImag[n][m] = 0; } -#endif -#endif } /* pre-define these tables? */ @@ -205,33 +175,22 @@ void DeletePredictionDecoder( for ( n = 0; n < psPredictionDecoder->iChannels; n++ ) { -#ifndef SPLIT_REND_LCLD_5MS - free( psPredictionDecoder->ppfEstPredGain[n] ); -#endif free( psPredictionDecoder->ppiPredBandEnable[n] ); free( psPredictionDecoder->ppfA1Real[n] ); free( psPredictionDecoder->ppfA1Imag[n] ); free( psPredictionDecoder->ppiA1Mag[n] ); free( psPredictionDecoder->ppiA1Phase[n] ); -#ifdef SPLIT_REND_LCLD_5MS free( psPredictionDecoder->ppfPredStateReal[n] ); free( psPredictionDecoder->ppfPredStateImag[n] ); -#endif } free( psPredictionDecoder->piPredChanEnable ); -#ifndef SPLIT_REND_LCLD_5MS - free( psPredictionDecoder->piNumPredBands ); - free( psPredictionDecoder->ppfEstPredGain ); -#endif free( psPredictionDecoder->ppiPredBandEnable ); free( psPredictionDecoder->ppfA1Real ); free( psPredictionDecoder->ppfA1Imag ); free( psPredictionDecoder->ppiA1Mag ); free( psPredictionDecoder->ppiA1Phase ); -#ifdef SPLIT_REND_LCLD_5MS free( psPredictionDecoder->ppfPredStateReal ); free( psPredictionDecoder->ppfPredStateImag ); -#endif free( psPredictionDecoder ); psPredictionDecoder = NULL; @@ -239,110 +198,6 @@ void DeletePredictionDecoder( return; } -#ifndef SPLIT_REND_LCLD_5MS -#define USE_TABLE_LOOKUP -/*-------------------------------------------------------------------* - * Function ReadPredictors() - * - * - *-------------------------------------------------------------------*/ - -int32_t ReadPredictors( - PredictionDecoder *psPredictionDecoder, - IVAS_SPLIT_REND_BITS_HANDLE pBits ) -{ - int16_t iBitsRead = 0; - int32_t c; - - for ( c = 0; c < psPredictionDecoder->iChannels; c++ ) - { - psPredictionDecoder->piPredChanEnable[c] = ivas_split_rend_bitstream_read_int32( pBits, 1 ); - iBitsRead += 1; - - if ( psPredictionDecoder->piPredChanEnable[c] ) - { - int32_t b; - - for ( b = 0; b < LCLD_BANDS; b++ ) - { - psPredictionDecoder->ppiPredBandEnable[c][b] = 0; - } - psPredictionDecoder->piNumPredBands[c] = ivas_split_rend_bitstream_read_int32( pBits, 6 ); - iBitsRead += 6; - - for ( b = 0; b < psPredictionDecoder->piNumPredBands[c]; b++ ) - { - psPredictionDecoder->ppiPredBandEnable[c][b] = ivas_split_rend_bitstream_read_int32( pBits, 1 ); - iBitsRead += 1; - - if ( psPredictionDecoder->ppiPredBandEnable[c][b] == 1 ) - { -#ifdef USE_TABLE_LOOKUP - int32_t iA1Mag; - int32_t iA1Phase; - float fA1Real; - float fA1Imag; - iA1Mag = ivas_split_rend_bitstream_read_int32( pBits, PRED_QUNAT_FILTER_MAG_BITS ); - iBitsRead += PRED_QUNAT_FILTER_MAG_BITS; - iA1Phase = ivas_split_rend_bitstream_read_int32( pBits, PRED_QUANT_FILTER_PHASE_BITS ); - iBitsRead += PRED_QUANT_FILTER_PHASE_BITS; - - psPredictionDecoder->ppiA1Mag[c][b] = iA1Mag; - psPredictionDecoder->ppiA1Phase[c][b] = iA1Phase + PRED_QUANT_FILTER_PHASE_MIN; - - fA1Real = psPredictionDecoder->pfMagLUT[iA1Mag] * psPredictionDecoder->pfP2RRealLUT[iA1Phase]; - fA1Imag = psPredictionDecoder->pfMagLUT[iA1Mag] * psPredictionDecoder->pfP2RImagLUT[iA1Phase]; - - psPredictionDecoder->ppfA1Real[c][b] = fA1Real; - psPredictionDecoder->ppfA1Imag[c][b] = fA1Imag; -#else - const float fInvMagScale = M_PI / ( 2.0 * (float) ( 1 << ( PRED_QUNAT_FILTER_MAG_BITS ) ) + 1.0 ); - const float fInvPhaseScale = M_PI / (float) ( 1 << ( PRED_QUANT_FILTER_PHASE_BITS - 1 ) ); - int32_t iA1Mag; - int32_t iA1Phase; - float fA1Mag; - float fA1Phase; - float fA1Real; - float fA1Imag; - - iA1Mag = ivas_split_rend_bitstream_read_int32( pBits, PRED_QUNAT_FILTER_MAG_BITS ); - iBitsRead += PRED_QUNAT_FILTER_MAG_BITS; - - iA1Phase = ivas_split_rend_bitstream_read_int32( pBits, PRED_QUANT_FILTER_PHASE_BITS ); - iBitsRead += PRED_QUANT_FILTER_PHASE_BITS; - iA1Phase += PRED_QUANT_FILTER_PHASE_MIN; - - psPredictionDecoder->ppiA1Mag[c][b] = iA1Mag; - psPredictionDecoder->ppiA1Phase[c][b] = iA1Phase; - - fA1Mag = sinf( fInvMagScale * (float) iA1Mag ); - fA1Phase = fInvPhaseScale * (float) iA1Phase; - - fA1Real = fA1Mag * cosf( fA1Phase ); - fA1Imag = fA1Mag * sinf( fA1Phase ); - - psPredictionDecoder->ppfA1Real[c][b] = fA1Real; - psPredictionDecoder->ppfA1Imag[c][b] = fA1Imag; - - /* printf("Dec %f\t%f\t%f\n",fA1Real,fA1Imag,fA1Real * fA1Real + fA1Imag * fA1Imag); */ -#endif - } - } - } - else - { - int16_t b; - for ( b = 0; b < LCLD_BANDS; b++ ) - { - psPredictionDecoder->ppiPredBandEnable[c][b] = 0; - } - } - } - - return iBitsRead; -} - -#else /*-------------------------------------------------------------------* * Function ReadPredictors() * @@ -438,55 +293,7 @@ int32_t ReadPredictors( return iBitsRead; } -#endif -#ifndef SPLIT_REND_LCLD_5MS -/*-------------------------------------------------------------------* - * Function ApplyInversePredictros() - * - * - *-------------------------------------------------------------------*/ - -void ApplyInversePredictros( - PredictionDecoder *psPredictionDecoder, - float ***pppfReal, - float ***pppfImag ) -{ - int32_t c; - for ( c = 0; c < psPredictionDecoder->iChannels; c++ ) - { - if ( psPredictionDecoder->piPredChanEnable[c] == 1 ) - { - int32_t b; - for ( b = 0; b < psPredictionDecoder->piNumPredBands[c]; b++ ) - { - if ( psPredictionDecoder->ppiPredBandEnable[c][b] == 1 ) - { - int32_t n; - float fA1Real; - float fA1Imag; - - fA1Real = psPredictionDecoder->ppfA1Real[c][b]; - fA1Imag = psPredictionDecoder->ppfA1Imag[c][b]; - for ( n = 1; n < psPredictionDecoder->iNumBlocks; n++ ) - { - float fReal; - float fImag; - - fReal = pppfReal[c][n][b] - fA1Real * pppfReal[c][n - 1][b] + fA1Imag * pppfImag[c][n - 1][b]; - fImag = pppfImag[c][n][b] - fA1Real * pppfImag[c][n - 1][b] - fA1Imag * pppfReal[c][n - 1][b]; - - pppfReal[c][n][b] = fReal; - pppfImag[c][n][b] = fImag; - } - } - } - } - } - - return; -} -#else /*-------------------------------------------------------------------* * Function ApplyInversePredictors() * @@ -547,4 +354,3 @@ void ApplyInversePredictors( return; } #endif -#endif diff --git a/lib_rend/ivas_PredEncoder.c b/lib_rend/ivas_PredEncoder.c index 2f7cfd3900cb03948ddb3175858f0f3962efabfc..50ac5524fb57bf39e81531790301d6e736a2dfa4 100644 --- a/lib_rend/ivas_PredEncoder.c +++ b/lib_rend/ivas_PredEncoder.c @@ -40,7 +40,6 @@ #include "ivas_prot_rend.h" #include "wmc_auto.h" -#ifdef SPLIT_REND_LCLD_5MS /*-------------------------------------------------------------------* * Function activate_bit() @@ -66,7 +65,6 @@ static void deactivate_bit( { ( *state ) &= ( ~( 1 << bit_id ) ); } -#endif /*-------------------------------------------------------------------* * Function CreatePredictionEncoder() @@ -74,19 +72,12 @@ static void deactivate_bit( * *-------------------------------------------------------------------*/ -#ifdef SPLIT_REND_LCLD_5MS ivas_error CreatePredictionEncoder( PredictionEncoder **psPredictionEncoder_out, const int32_t iChannels, const int32_t iNumBlocks, const int32_t iNumSubSets, const int32_t iMaxNumPredBands ) -#else -ivas_error CreatePredictionEncoder( - PredictionEncoder **psPredictionEncoder_out, - const int32_t iChannels, - const int32_t iNumBlocks ) -#endif { int32_t k, n; PredictionEncoder *psPredictionEncoder = NULL; @@ -98,7 +89,6 @@ ivas_error CreatePredictionEncoder( psPredictionEncoder->iChannels = iChannels; psPredictionEncoder->iNumBlocks = iNumBlocks; -#ifdef SPLIT_REND_LCLD_5MS psPredictionEncoder->iSubSetId = 0; psPredictionEncoder->iMaxNumPredBands = iMaxNumPredBands; psPredictionEncoder->iNumSubSets = iNumSubSets; @@ -106,24 +96,11 @@ ivas_error CreatePredictionEncoder( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } -#else - if ( ( psPredictionEncoder->pfWindow = (float *) malloc( sizeof( float ) * iNumBlocks ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); - } -#endif -#ifdef SPLIT_REND_LCLD_5MS 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 ); } -#else - for ( n = 0; n < iNumBlocks; n++ ) - { - psPredictionEncoder->pfWindow[n] = 0.54f - 0.46f * cosf( 2.0f * M_PI * ( (float) n + 0.5f ) / (float) iNumBlocks ); - } -#endif if ( ( psPredictionEncoder->piPredChanEnable = (int32_t *) malloc( sizeof( int32_t ) * iChannels ) ) == NULL ) @@ -141,7 +118,6 @@ ivas_error CreatePredictionEncoder( psPredictionEncoder->piNumPredBands[n] = 40; // Will need to be set correctly } -#ifdef SPLIT_REND_LCLD_5MS if ( ( psPredictionEncoder->ppiPredBandEnable = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); @@ -194,50 +170,9 @@ ivas_error CreatePredictionEncoder( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } -#else - if ( ( psPredictionEncoder->ppfEstPredGain = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); - } - if ( ( psPredictionEncoder->ppfEstPredBitGain = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); - } - if ( ( psPredictionEncoder->ppiPredBandEnable = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); - } - if ( ( psPredictionEncoder->ppfA1Real = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); - } - if ( ( psPredictionEncoder->ppfA1Imag = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); - } - if ( ( psPredictionEncoder->ppiA1Mag = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); - } - if ( ( psPredictionEncoder->ppiA1Phase = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); - } - -#endif for ( n = 0; n < psPredictionEncoder->iChannels; n++ ) { -#ifndef SPLIT_REND_LCLD_5MS - if ( ( psPredictionEncoder->ppfEstPredGain[n] = (float *) malloc( sizeof( float ) * LCLD_BANDS ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); - } - if ( ( psPredictionEncoder->ppfEstPredBitGain[n] = (float *) malloc( sizeof( float ) * LCLD_BANDS ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); - } -#endif if ( ( psPredictionEncoder->ppiPredBandEnable[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_BANDS ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); @@ -258,7 +193,6 @@ ivas_error CreatePredictionEncoder( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); } -#ifdef SPLIT_REND_LCLD_5MS if ( ( psPredictionEncoder->pppfInpBufReal[n] = (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" ) ); @@ -313,17 +247,11 @@ ivas_error CreatePredictionEncoder( } set_zero( psPredictionEncoder->ppfPredStateRealTmp[n], LCLD_BANDS ); set_zero( psPredictionEncoder->ppfPredStateImagTmp[n], LCLD_BANDS ); -#endif for ( k = 0; k < LCLD_BANDS; k++ ) { psPredictionEncoder->ppiPredBandEnable[n][k] = 0; -#ifndef SPLIT_REND_LCLD_5MS - psPredictionEncoder->ppfA1Real[n][k] = 0.0; - psPredictionEncoder->ppfA1Imag[n][k] = 0.0; -#else psPredictionEncoder->ppfA1Real[n][k] = 0.0f; psPredictionEncoder->ppfA1Imag[n][k] = 0.0f; -#endif } } @@ -348,18 +276,12 @@ void DeletePredictionEncoder( for ( n = 0; n < psPredictionEncoder->iChannels; n++ ) { -#ifdef SPLIT_REND_LCLD_5MS int32_t k; -#else - free( psPredictionEncoder->ppfEstPredGain[n] ); - free( psPredictionEncoder->ppfEstPredBitGain[n] ); -#endif free( psPredictionEncoder->ppiPredBandEnable[n] ); free( psPredictionEncoder->ppfA1Real[n] ); free( psPredictionEncoder->ppfA1Imag[n] ); free( psPredictionEncoder->ppiA1Mag[n] ); free( psPredictionEncoder->ppiA1Phase[n] ); -#ifdef SPLIT_REND_LCLD_5MS for ( k = 0; k < LCLD_PRED_WIN_LEN; k++ ) { free( psPredictionEncoder->pppfInpBufReal[n][k] ); @@ -373,20 +295,14 @@ void DeletePredictionEncoder( free( psPredictionEncoder->ppfPredStateImag[n] ); free( psPredictionEncoder->ppfPredStateRealTmp[n] ); free( psPredictionEncoder->ppfPredStateImagTmp[n] ); -#endif } free( psPredictionEncoder->piPredChanEnable ); free( psPredictionEncoder->piNumPredBands ); -#ifndef SPLIT_REND_LCLD_5MS - free( psPredictionEncoder->ppfEstPredGain ); - free( psPredictionEncoder->ppfEstPredBitGain ); -#endif free( psPredictionEncoder->ppiPredBandEnable ); free( psPredictionEncoder->ppfA1Real ); free( psPredictionEncoder->ppfA1Imag ); free( psPredictionEncoder->ppiA1Mag ); free( psPredictionEncoder->ppiA1Phase ); -#ifdef SPLIT_REND_LCLD_5MS free( psPredictionEncoder->pppfInpBufReal ); free( psPredictionEncoder->pppfInpBufImag ); free( psPredictionEncoder->ppfInpPrevReal ); @@ -395,7 +311,6 @@ void DeletePredictionEncoder( free( psPredictionEncoder->ppfPredStateImag ); free( psPredictionEncoder->ppfPredStateRealTmp ); free( psPredictionEncoder->ppfPredStateImagTmp ); -#endif free( psPredictionEncoder ); @@ -410,7 +325,6 @@ void DeletePredictionEncoder( * *-------------------------------------------------------------------*/ -#ifdef SPLIT_REND_LCLD_5MS void ComputePredictors( PredictionEncoder *psPredictionEncoder, float ***pppfReal, @@ -598,205 +512,6 @@ void ComputePredictors( } } } -#else -int32_t ComputePredictors( - PredictionEncoder *psPredictionEncoder, - float ***pppfReal, - float ***pppfImag ) -{ - int32_t c; - int32_t iPredictionBits = 0; - - for ( c = 0; c < psPredictionEncoder->iChannels; c++ ) - { - int32_t b; - psPredictionEncoder->piNumPredBands[c] = 50; - for ( b = 0; b < psPredictionEncoder->piNumPredBands[c]; b++ ) - { - int32_t n; - int32_t iNumBlocks; - float fGain = 0.0; - float fBitGain = 0.0; - float *pfRxxReal; - float *pfRxxImag; - float fA1Real; - float fA1Imag; - int32_t iA1Mag; - int32_t iA1Phase; - - iNumBlocks = psPredictionEncoder->iNumBlocks; - - pfRxxReal = psPredictionEncoder->pfRxxReal; - pfRxxImag = psPredictionEncoder->pfRxxImag; - - pfRxxReal[0] = 0.0; - pfRxxImag[0] = 0.0; - for ( n = 0; n < iNumBlocks; n++ ) - { - pfRxxReal[0] += ( pppfReal[c][n][b] * pppfReal[c][n][b] + pppfImag[c][n][b] * pppfImag[c][n][b] ); - } - - pfRxxReal[1] = 0.0; - pfRxxImag[1] = 0.0; - for ( n = 1; n < iNumBlocks; n++ ) - { - pfRxxReal[1] += ( pppfReal[c][n][b] * pppfReal[c][n - 1][b] + pppfImag[c][n][b] * pppfImag[c][n - 1][b] ); - pfRxxImag[1] += ( pppfImag[c][n][b] * pppfReal[c][n - 1][b] - pppfReal[c][n][b] * pppfImag[c][n - 1][b] ); - } - - if ( pfRxxReal[0] > 1e-12f ) - { - float fA1Mag; - float fA1Phase; - float fGain2; - float fBitGain2; - - const float fMagScale = ( 2.0f * (float) ( 1 << ( PRED_QUNAT_FILTER_MAG_BITS ) ) + 1.0f ) / M_PI; - const float fInvMagScale = M_PI / ( 2.0f * (float) ( 1 << ( PRED_QUNAT_FILTER_MAG_BITS ) ) + 1.0f ); - const float fPhaseScale = (float) ( 1 << ( PRED_QUANT_FILTER_PHASE_BITS - 1 ) ) / M_PI; - const float fInvPhaseScale = M_PI / (float) ( 1 << ( PRED_QUANT_FILTER_PHASE_BITS - 1 ) ); - - /* Compute filter coefficeints */ - fA1Real = -pfRxxReal[1] / pfRxxReal[0]; - fA1Imag = -pfRxxImag[1] / pfRxxReal[0]; - - /* compute these before quant */ - /* Compute est coding gain based on quantized filter coefficients */ - fGain = 1.0f / ( 1.0f - fA1Real * fA1Real - fA1Imag * fA1Imag ); - fBitGain = 0.6f * log2f( fGain ) * (float) ( iNumBlocks ) - (float) ( PRED_QUNAT_FILTER_MAG_BITS + PRED_QUANT_FILTER_PHASE_BITS ); // Wrong fix (iNumBlocks-1) - - fA1Mag = sqrtf( fA1Real * fA1Real + fA1Imag * fA1Imag ); - fA1Mag = fMagScale * asinf( fA1Mag ); - iA1Mag = (int32_t) ( fA1Mag + 0.5f ); - iA1Mag = ( iA1Mag > PRED_QUANT_FILTER_MAG_MIN ) ? iA1Mag : PRED_QUANT_FILTER_MAG_MIN; - iA1Mag = ( iA1Mag < PRED_QUANT_FILTER_MAG_MAX ) ? iA1Mag : PRED_QUANT_FILTER_MAG_MAX; - fA1Mag = sinf( fInvMagScale * (float) iA1Mag ); - - fA1Phase = atan2f( fA1Imag, fA1Real ); - fA1Phase = fPhaseScale * fA1Phase; - iA1Phase = ( fA1Phase > 0.0f ) ? (int32_t) ( fA1Phase + 0.5f ) : (int32_t) ( fA1Phase - 0.5f ); - iA1Phase = ( iA1Phase > PRED_QUANT_FILTER_PHASE_MIN ) ? iA1Phase : PRED_QUANT_FILTER_PHASE_MIN; - iA1Phase = ( iA1Phase < PRED_QUANT_FILTER_PHASE_MAX ) ? iA1Phase : PRED_QUANT_FILTER_PHASE_MAX; // Is this the correct way to deal with this? should wrap? - fA1Phase = fInvPhaseScale * (float) iA1Phase; - - fA1Real = fA1Mag * cosf( fA1Phase ); - fA1Imag = fA1Mag * sinf( fA1Phase ); - - fGain2 = 1.0f / ( 1.0f - fA1Real * fA1Real - fA1Imag * fA1Imag ); - fBitGain2 = 0.6f * log2f( fGain ) * (float) ( iNumBlocks ) - (float) ( PRED_QUNAT_FILTER_MAG_BITS + PRED_QUANT_FILTER_PHASE_BITS ); // Wrong fix (iNumBlocks-1) - - fGain = ( fGain < fGain2 ) ? fGain : fGain2; - fBitGain = ( fBitGain < fBitGain2 ) ? fBitGain : fBitGain2; - } - else - { - psPredictionEncoder->ppfEstPredGain[c][b] = 0.0f; - fA1Real = 0.0f; - fA1Imag = 0.0f; - // iA1Real = 0; - // iA1Imag = 0; - iA1Mag = 0; - iA1Phase = 0; - fGain = -10.0f; // Fix this - } - - psPredictionEncoder->ppfEstPredGain[c][b] = fGain; - psPredictionEncoder->ppfEstPredBitGain[c][b] = fBitGain; - psPredictionEncoder->ppiPredBandEnable[c][b] = ( fBitGain > 0 ) ? 1 : 0; // Initial prediction enable - psPredictionEncoder->ppfA1Real[c][b] = fA1Real; - psPredictionEncoder->ppfA1Imag[c][b] = fA1Imag; - psPredictionEncoder->ppiA1Mag[c][b] = iA1Mag; - psPredictionEncoder->ppiA1Phase[c][b] = iA1Phase; - } - - { - /*int32_t iDone; - int32_t iPredBands; - - iDone = 0; - iPredBands = 30; - while(iPredBands > 0 && iDone == 0){ - int32_t b; - float fBitGain; - - fBitGain = -7.0; - for(b = 0; b < iPredBands; b ++){ - fBitGain -= 1.0; - if(psPredictionEncoder->ppiPredBandEnable[c][b] == 1){ - fBitGain += psPredictionEncoder->ppfEstPredBitGain[c][b]; - } - } - if(fBitGain > 0.0){ //thresh - iDone ++; - } - else{ - iPredBands --; - } - }*/ - // int32_t b; - float fBestCost; - int32_t iPredBands; - float fBitGain; - - fBestCost = 0.0; - iPredBands = 0; - fBitGain = -7.0; - for ( b = 0; b < 30; b++ ) - { // still getting this decision wrong! - fBitGain -= 1.0; - if ( psPredictionEncoder->ppiPredBandEnable[c][b] == 1 ) - { - fBitGain += psPredictionEncoder->ppfEstPredBitGain[c][b]; - } - if ( fBitGain > fBestCost ) - { - fBestCost = fBitGain; - iPredBands = b; - } - } - - // printf("%d\t%f\n",iPredBands,fBestCost); - /*if(fBestCost < 300.0){ - iPredBands = 0; - }*/ - - if ( iPredBands > 0 ) - { - // int32_t b; - iPredictionBits += 1; - iPredictionBits += 6; - for ( b = 0; b < iPredBands; b++ ) - { - iPredictionBits += 1; - if ( psPredictionEncoder->ppiPredBandEnable[c][b] == 1 ) - { - iPredictionBits += ( PRED_QUNAT_FILTER_MAG_BITS + PRED_QUANT_FILTER_PHASE_BITS ); - } - } - for ( b = iPredBands; b < LCLD_BANDS; b++ ) - { - psPredictionEncoder->ppiPredBandEnable[c][b] = 0; - } - psPredictionEncoder->piPredChanEnable[c] = 1; - psPredictionEncoder->piNumPredBands[c] = iPredBands; - } - else - { - // int32_t b; - iPredictionBits += 1; - for ( b = 0; b < LCLD_BANDS; b++ ) - { - psPredictionEncoder->ppiPredBandEnable[c][b] = 0; - } - psPredictionEncoder->piPredChanEnable[c] = 0; - psPredictionEncoder->piNumPredBands[c] = 0; - } - } - } - - return iPredictionBits; -} -#endif /*-------------------------------------------------------------------* @@ -805,7 +520,6 @@ int32_t ComputePredictors( * *-------------------------------------------------------------------*/ -#ifdef SPLIT_REND_LCLD_5MS void ApplyForwardPredictors( PredictionEncoder *psPredictionEncoder, float ***pppfReal, @@ -859,54 +573,6 @@ void ApplyForwardPredictors( return; } -#else -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] == 1 ) - { - for ( b = 0; b < psPredictionEncoder->piNumPredBands[c]; b++ ) - { - if ( psPredictionEncoder->ppiPredBandEnable[c][b] == 1 ) - { - int32_t n; - float fOldReal; - float fOldImag; - float fA1Real; - float fA1Imag; - - fOldReal = pppfReal[c][0][b]; - fOldImag = pppfImag[c][0][b]; - fA1Real = psPredictionEncoder->ppfA1Real[c][b]; - fA1Imag = psPredictionEncoder->ppfA1Imag[c][b]; - for ( n = 1; 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 /*-------------------------------------------------------------------* @@ -915,7 +581,6 @@ void ApplyForwardPredictors( * *-------------------------------------------------------------------*/ -#ifdef SPLIT_REND_LCLD_5MS int32_t WritePredictors( PredictionEncoder *psPredictionEncoder, IVAS_SPLIT_REND_BITS_HANDLE pBits ) @@ -979,47 +644,4 @@ int32_t WritePredictors( return iBitsWritten; } -#else -int32_t WritePredictors( - PredictionEncoder *psPredictionEncoder, - IVAS_SPLIT_REND_BITS_HANDLE pBits ) -{ - int32_t iBitsWritten = 0; - int32_t c; - - for ( c = 0; c < psPredictionEncoder->iChannels; c++ ) - { - int32_t b; - ivas_split_rend_bitstream_write_int32( pBits, psPredictionEncoder->piPredChanEnable[c], 1 ); - iBitsWritten += 1; - - if ( psPredictionEncoder->piPredChanEnable[c] == 1 ) - { - ivas_split_rend_bitstream_write_int32( pBits, psPredictionEncoder->piNumPredBands[c], 6 ); - iBitsWritten += 6; - - for ( b = 0; b < psPredictionEncoder->piNumPredBands[c]; b++ ) - { - ivas_split_rend_bitstream_write_int32( pBits, psPredictionEncoder->ppiPredBandEnable[c][b], 1 ); - iBitsWritten += 1; - - if ( psPredictionEncoder->ppiPredBandEnable[c][b] == 1 ) - { - int32_t iA1Mag; - int32_t iA1Phase; - - iA1Mag = psPredictionEncoder->ppiA1Mag[c][b]; - iA1Phase = psPredictionEncoder->ppiA1Phase[c][b] - PRED_QUANT_FILTER_PHASE_MIN; - ivas_split_rend_bitstream_write_int32( pBits, iA1Mag, PRED_QUNAT_FILTER_MAG_BITS ); - iBitsWritten += PRED_QUNAT_FILTER_MAG_BITS; - ivas_split_rend_bitstream_write_int32( pBits, iA1Phase, PRED_QUANT_FILTER_PHASE_BITS ); - iBitsWritten += PRED_QUANT_FILTER_PHASE_BITS; - } - } - } - } - - return iBitsWritten; -} -#endif #endif diff --git a/lib_rend/ivas_RMSEnvGrouping.c b/lib_rend/ivas_RMSEnvGrouping.c index 81deff1759403f313fcdc213089e2ab1f5dfa6e3..b67b8c1f757d261abe3bb53c7c2061bd32402bd9 100644 --- a/lib_rend/ivas_RMSEnvGrouping.c +++ b/lib_rend/ivas_RMSEnvGrouping.c @@ -698,13 +698,9 @@ void ComputeEnvelopeGrouping( psRMSEnvelopeGrouping->psGMNodes[n].psNext = NULL; } -/* Perform grouping via Greedy Merge */ -/* Allows control over max groups can call using 16 if want same as previous call */ -#ifdef SPLIT_REND_LCLD_5MS + /* Perform grouping via Greedy Merge */ + /* Allows control over max groups can call using 16 if want same as previous call */ ComputeGreedyGroups3( psRMSEnvelopeGrouping, iChannels, iNumBands, piBandwidths, psRMSEnvelopeGrouping->iNumBlocks ); -#else - ComputeGreedyGroups3( psRMSEnvelopeGrouping, iChannels, iNumBands, piBandwidths, LCLD_BLOCKS_PER_FRAME ); -#endif /* Calc Groups from Merge Results */ *piNumGroups = 0; diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 8a45c47fdbaee92392398b8113ba1bf770fc90a1..e55279c60fe8b2b0c58412ed0e708a4d1f514d5b 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1605,9 +1605,7 @@ void ivas_rend_closeCldfbRend( } ivas_binRenderer_close( &pCldfbRend->hCldfbRend ); -#ifdef SPLIT_REND_LCLD_5MS ivas_binaural_hrtf_close( &pCldfbRend->hHrtfFastConv ); -#endif ivas_HRTF_fastconv_binary_close( &pCldfbRend->hHrtfFastConv ); return; diff --git a/lib_rend/ivas_lcld_decoder.c b/lib_rend/ivas_lcld_decoder.c index 067b1ede71fae592112c18478309d597df237532..b98b4f4e00ef2cae0f2328217b857d5e0fc11e30 100644 --- a/lib_rend/ivas_lcld_decoder.c +++ b/lib_rend/ivas_lcld_decoder.c @@ -341,18 +341,11 @@ static void CreateDecodeTable( LCLDDecoder *psLCLDDecoder, int32_t num, const ui * *------------------------------------------------------------------------------------------*/ -#ifndef SPLIT_REND_LCLD_5MS -ivas_error CreateLCLDDecoder( - LCLDDecoder **psLCLDDecoder_out, - const int32_t iSampleRate, - const int32_t iChannels ) -#else ivas_error CreateLCLDDecoder( LCLDDecoder **psLCLDDecoder_out, const int32_t iSampleRate, const int32_t iChannels, const int32_t iNumBlocks ) -#endif { int32_t n; int32_t read_length; @@ -360,27 +353,17 @@ ivas_error CreateLCLDDecoder( LCLDDecoder *psLCLDDecoder = NULL; assert( iSampleRate == 48000 ); -#ifdef SPLIT_REND_LCLD_5MS assert( iNumBlocks == 16 || iNumBlocks == 8 || iNumBlocks == 4 ); -#endif if ( ( psLCLDDecoder = (LCLDDecoder *) malloc( sizeof( LCLDDecoder ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); } psLCLDDecoder->iSampleRate = iSampleRate; psLCLDDecoder->iChannels = iChannels; -#ifdef SPLIT_REND_LCLD_5MS psLCLDDecoder->iNumBlocks = iNumBlocks; -#else - psLCLDDecoder->iNumBlocks = LCLD_BLOCKS_PER_FRAME; -#endif psLCLDDecoder->iAllocOffset = 0; -#ifdef SPLIT_REND_LCLD_5MS psLCLDDecoder->iNumBands = 0; /* read from bitstream*/ -#else - psLCLDDecoder->iNumBands = MAX_BANDS_48; /* Fix */ -#endif psLCLDDecoder->piBandwidths = c_aiBandwidths48; psLCLDDecoder->iMSMode = 0; @@ -713,11 +696,7 @@ void DeleteLCLDDecoder( LCLDDecoder *psLCLDDecoder ) static void ApplyRMSEnvelope( const int32_t iNumBands, const int32_t *piBandwidths, const int32_t iNumGroups, const int32_t *piGroupLengths, int32_t **ppiRMSEnvelope, float **ppfReal, float **ppfImag ); -#ifdef SPLIT_REND_LCLD_5MS static void ReplaceSign( const int32_t iNumBlocks, const int32_t iNumLCLDBands, int32_t **ppiSignReal, int32_t **ppiSignImag, float **ppfReal, float **ppfImag, const int32_t *piBandwidths ); -#else -static void ReplaceSign( const int32_t iNumBlocks, const int32_t iNumLCLDBands, int32_t **ppiSignReal, int32_t **ppiSignImag, float **ppfReal, float **ppfImag ); -#endif static void InvQuantizeSpectrum( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, int32_t **ppiAlloc, int32_t **ppiQReal, int32_t **ppiQImag, float **ppfReal, float **ppfImag, NoiseGen *psNoiseGen ); @@ -823,17 +802,10 @@ int32_t DecodeLCLDFrame( pppfLCLDReal[n], pppfLCLDImag[n], psLCLDDecoder->psNoiseGen ); -#ifdef SPLIT_REND_LCLD_5MS ReplaceSign( psLCLDDecoder->iNumBlocks, psLCLDDecoder->iNumBands, psLCLDDecoder->pppiLCLDSignReal[n], psLCLDDecoder->pppiLCLDSignImag[n], pppfLCLDReal[n], pppfLCLDImag[n], psLCLDDecoder->piBandwidths ); -#else - ReplaceSign( psLCLDDecoder->iNumBlocks, LCLD_BANDS, - psLCLDDecoder->pppiLCLDSignReal[n], - psLCLDDecoder->pppiLCLDSignImag[n], - pppfLCLDReal[n], pppfLCLDImag[n] ); -#endif } #ifdef DEBUG_WRITE_PREDICTORS { @@ -850,11 +822,7 @@ int32_t DecodeLCLDFrame( } #endif -#ifdef SPLIT_REND_LCLD_5MS ApplyInversePredictors( psLCLDDecoder->psPredictionDecoder, pppfLCLDReal, pppfLCLDImag ); -#else - ApplyInversePredictros( psLCLDDecoder->psPredictionDecoder, pppfLCLDReal, pppfLCLDImag ); -#endif for ( n = 0; n < psLCLDDecoder->iChannels; n++ ) { @@ -926,7 +894,6 @@ static void ApplyRMSEnvelope( return; } -#ifdef SPLIT_REND_LCLD_5MS static void ReplaceSign( const int32_t iNumBlocks, const int32_t iNumLCLDBands, @@ -935,24 +902,12 @@ static void ReplaceSign( float **ppfReal, float **ppfImag, const int32_t *piBandwidths ) -#else -static void ReplaceSign( - const int32_t iNumBlocks, - const int32_t iNumLCLDBands, - int32_t **ppiSignReal, - int32_t **ppiSignImag, - float **ppfReal, - float **ppfImag ) -#endif { int32_t b, n; -#ifdef SPLIT_REND_LCLD_5MS int32_t m, idx; -#endif for ( n = 0; n < iNumBlocks; n++ ) { -#ifdef SPLIT_REND_LCLD_5MS idx = 0; for ( b = 0; b < iNumLCLDBands; b++ ) { @@ -970,20 +925,6 @@ static void ReplaceSign( idx++; } } -#else - for ( b = 0; b < iNumLCLDBands; b++ ) - { - if ( ppiSignReal[n][b] == 1 ) - { - ppfReal[n][b] = -ppfReal[n][b]; - } - - if ( ppiSignImag[n][b] == 1 ) - { - ppfImag[n][b] = -ppfImag[n][b]; - } - } -#endif } return; @@ -1075,11 +1016,7 @@ static void InvMSCoding( { int32_t b; int32_t iFBOffset; -#ifdef SPLIT_REND_LCLD_5MS int32_t bMSPred = 0; -#else - int32_t bms = 0; -#endif iFBOffset = 0; for ( b = 0; b < iNumBands; b++ ) @@ -1087,12 +1024,10 @@ static void InvMSCoding( if ( piMSFlags[b] == 1 ) { int32_t n; -#ifdef SPLIT_REND_LCLD_5MS int32_t phaseIdx; float fPred; phaseIdx = piLRPhaseDiffs[bMSPred] - PHASE_MIN_VAL; fPred = dequantPred( piMSPredCoefs[bMSPred] ); -#endif for ( n = 0; n < piBandwidths[b]; n++ ) { int32_t k; @@ -1105,10 +1040,6 @@ static void InvMSCoding( if ( iMSMode == 3 ) { -#ifndef SPLIT_REND_LCLD_5MS - float fPred; - fPred = dequantPred( piMSPredCoefs[bms] ); -#endif pppfReal[1][k][iFBOffset] += fPred * pppfReal[0][k][iFBOffset]; pppfImag[1][k][iFBOffset] += fPred * pppfImag[0][k][iFBOffset]; } @@ -1120,10 +1051,6 @@ static void InvMSCoding( if ( iMSMode == 3 ) { -#ifndef SPLIT_REND_LCLD_5MS - int32_t phaseIdx; - phaseIdx = piLRPhaseDiffs[bms] - PHASE_MIN_VAL; -#endif cplxmult( &fRightReal, &fRightImag, c_afRotRealImag[phaseIdx][0], -c_afRotRealImag[phaseIdx][1] ); } @@ -1134,11 +1061,7 @@ static void InvMSCoding( } iFBOffset++; } -#ifdef SPLIT_REND_LCLD_5MS bMSPred++; -#else - bms++; -#endif } else { diff --git a/lib_rend/ivas_lcld_encoder.c b/lib_rend/ivas_lcld_encoder.c index bab9409157d84ae6720656951a89699b60b50a01..4ad176ec0dcd9a5e06527ae5deff400aa6ca6acf 100644 --- a/lib_rend/ivas_lcld_encoder.c +++ b/lib_rend/ivas_lcld_encoder.c @@ -52,9 +52,6 @@ struct LCLD_ENCODER int32_t iNumBlocks; int32_t iTargetBitRate; -#ifndef SPLIT_REND_LCLD_5MS - int32_t iTargetBitsPerFrame; -#endif int32_t iNumBands; const int32_t *piBandwidths; @@ -88,7 +85,6 @@ struct LCLD_ENCODER PredictionEncoder *psPredictionEncoder; }; -#ifdef SPLIT_REND_LCLD_5MS /*------------------------------------------------------------------------------------------* * Function Quantize() * @@ -139,7 +135,6 @@ static float UnQuantize( } return fVal; } -#endif /*------------------------------------------------------------------------------------------* * Function CreateLCLDEncoder() @@ -147,7 +142,6 @@ static float UnQuantize( * *------------------------------------------------------------------------------------------*/ -#ifdef SPLIT_REND_LCLD_5MS ivas_error CreateLCLDEncoder( LCLDEncoder **psLCLDEncoder_out, const int32_t iSampleRate, @@ -156,27 +150,15 @@ ivas_error CreateLCLDEncoder( const int32_t iAllowSidePred, const int16_t iNumBlocks, const int16_t iNumSubSets ) -#else -ivas_error CreateLCLDEncoder( - LCLDEncoder **psLCLDEncoder_out, - const int32_t iSampleRate, - const int32_t iChannels, - const int32_t iTargetBitRate, - const int32_t iAllowSidePred ) -#endif { int32_t n; LCLDEncoder *psLCLDEncoder; ivas_error error; -#ifdef SPLIT_REND_LCLD_5MS int32_t iMaxNumPredBands = 0; -#endif assert( iSampleRate == 48000 ); // Fix -#ifdef SPLIT_REND_LCLD_5MS assert( iNumBlocks == 16 || iNumBlocks == 8 || iNumBlocks == 4 ); assert( iNumSubSets > 0 && iNumSubSets <= LCLD_MAX_NUM_PRED_SUBSETS ); -#endif if ( ( psLCLDEncoder = (LCLDEncoder *) malloc( sizeof( LCLDEncoder ) ) ) == NULL ) { @@ -185,28 +167,17 @@ ivas_error CreateLCLDEncoder( psLCLDEncoder->iSampleRate = iSampleRate; psLCLDEncoder->iChannels = iChannels; -#ifdef SPLIT_REND_LCLD_5MS psLCLDEncoder->iNumBlocks = (int32_t) iNumBlocks; -#else - psLCLDEncoder->iNumBlocks = LCLD_BLOCKS_PER_FRAME; -#endif psLCLDEncoder->iAllocOffset = 0; psLCLDEncoder->iTargetBitRate = iTargetBitRate; -#ifndef SPLIT_REND_LCLD_5MS - psLCLDEncoder->iTargetBitsPerFrame = iTargetBitRate * LCLD_BLOCKS_PER_FRAME * LCLD_BANDS / iSampleRate; -#endif psLCLDEncoder->piBandwidths = c_aiBandwidths48; -#ifdef SPLIT_REND_LCLD_5MS psLCLDEncoder->iNumBands = DEF_BANDS_48; /* 22 bands = 50 CLDFB bands (rather than 23 bands) */ for ( n = 0; n < psLCLDEncoder->iNumBands; n++ ) { iMaxNumPredBands += psLCLDEncoder->piBandwidths[n]; } -#else - psLCLDEncoder->iNumBands = MAX_BANDS_48; -#endif psLCLDEncoder->iMSMode = 0; @@ -371,17 +342,10 @@ ivas_error CreateLCLDEncoder( } } -#ifdef SPLIT_REND_LCLD_5MS if ( ( error = CreatePredictionEncoder( &( psLCLDEncoder->psPredictionEncoder ), iChannels, psLCLDEncoder->iNumBlocks, (int32_t) iNumSubSets, iMaxNumPredBands ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = CreatePredictionEncoder( &( psLCLDEncoder->psPredictionEncoder ), iChannels, psLCLDEncoder->iNumBlocks ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif *psLCLDEncoder_out = psLCLDEncoder; @@ -559,11 +523,7 @@ static int32_t WriteAllocInformation( const int32_t iAllocOffset, IVAS_SPLIT_REN 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, IVAS_SPLIT_REND_BITS_HANDLE pBits ); -#ifdef SPLIT_REND_LCLD_5MS 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 ); -#else -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, int32_t **ppiPredEnable, float **ppfA1Real, float **ppfA1Imag ); -#endif /*------------------------------------------------------------------------------------------* * Function EncodeLCLDFrame() @@ -584,9 +544,7 @@ int32_t EncodeLCLDFrame( int32_t iNumMSBands = 0; iAvailableBits = available_bits; // HCBR for now iBitsWritten = 0; -#ifdef SPLIT_REND_LCLD_5MS assert( available_bits <= pBits->buf_len * 8 ); -#endif /* Do MS calc here */ if ( psLCLDEncoder->iChannels == 2 ) @@ -737,14 +695,7 @@ int32_t EncodeLCLDFrame( psLCLDEncoder->pppiQLCLDImag, psLCLDEncoder->pppiLCLDSignReal, psLCLDEncoder->pppiLCLDSignImag, -#ifdef SPLIT_REND_LCLD_5MS psLCLDEncoder->psPredictionEncoder ); -#else - psLCLDEncoder->psPredictionEncoder->ppiPredBandEnable, - psLCLDEncoder->psPredictionEncoder->ppfA1Real, - psLCLDEncoder->psPredictionEncoder->ppfA1Imag ); - -#endif iBitsWritten += WriteAllocInformation( psLCLDEncoder->iAllocOffset, pBits ); @@ -787,7 +738,6 @@ int32_t GetNumGroups( LCLDEncoder *psLCLDEncoder ) * *------------------------------------------------------------------------------------------*/ -#ifdef SPLIT_REND_LCLD_5MS enum MSPred_Types { MS_PHASE_AND_PRED = 0, /* LR phase alignment + real-valued M/S prediction */ @@ -878,9 +828,6 @@ static int32_t MSModeCalculation( int32_t tabIdx = 0; float fNumLines = (float) ( iNumBlocks * piBandwidths[b] * 2 ); /* per band per channel */ float fLevelToSMRdBFactor = (float) c_aiDefaultTheta48[b] / (float) ( 1 << PERCEPTUAL_MODEL_SLGAIN_SHIFT ); /* frequency dependent SMR slope in psy model */ -#ifndef SPLIT_REND_LCLD_5MS - fLevelToSMRdBFactor = (float) c_aiDefaultTheta48[b] / 16.0f; /* this is a bug due to a change of PERCEPTUAL_MODEL_SLGAIN_SHIFT */ -#endif fLeftEnergy = 0.0f; fRightEnergy = 0.0f; fMidEnergy = 0.0f; @@ -996,10 +943,8 @@ static int32_t MSModeCalculation( /* find the best M/S Pred type */ iMSPredType = MS_PHASE_AND_PRED; -#ifdef SPLIT_REND_LCLD_5MS iMSPredType = ( pfMSPredBitGain[MS_PRED_ONLY] > pfMSPredBitGain[iMSPredType] ? MS_PRED_ONLY : iMSPredType ); iMSPredType = ( pfMSPredBitGain[MS_PHASE_ONLY] > pfMSPredBitGain[iMSPredType] ? MS_PHASE_ONLY : iMSPredType ); -#endif /* plain M/S */ iMsInfoBits = CountMSBits( iNumBands, MS_SOME, piMSFlags, NULL, NULL ); @@ -1124,316 +1069,6 @@ static int32_t MSModeCalculation( return iNumMSBands; } -#else -static int32_t MSModeCalculation( - const int32_t iNumBlocks, - const int32_t iNumBands, - const int32_t *piBandwidths, - float ***pppfReal, - float ***pppfImag, - int32_t *piMSMode, - int32_t *piLRPhaseDiffs, - int32_t *piMSPredCoefs, - const int32_t iAllowSidePred, - int32_t *piMSFlags ) -{ - int32_t b; - int32_t iFBOffset; - int32_t iNumMSBands; - int32_t piMSPredFlags[MAX_BANDS]; - int32_t iNumMSPredBands = 0; - float msBitsReduction = 0.0f; - float msPredBitsReduction = 0.0f; - int32_t msBits; - int32_t msPredBits; - float fPred; -#if defined SIMPLE_PHASE - void( *pFuncPhaseRotateOptions[4] ) = { &rot_zero, &rot_p_pi_2, &rot_pm_pi, &rot_m_pi_2 }; -#endif - const float one_by_log10_2 = 3.32192809488736f; - - set_l( piMSPredFlags, 0, MAX_BANDS ); - *piMSMode = 0; - iFBOffset = 0; - iNumMSBands = 0; - for ( b = 0; b < iNumBands; b++ ) - { - int32_t n; - float fLeftEnergy; - float fRightEnergy; - float fMidEnergy; - float fSideEnergy; - float fLRRatio; - float fMSRatio; - float fMSPredRatio; - float fMidEnergyPred; - float fSideEnergyPred; - float fLRCovReal = 0.0f; - float fLRCovImag = 0.0f; - int32_t iPhase; - int32_t iPred; - int32_t tabIdx = 0; - - fLeftEnergy = 0.0f; - fRightEnergy = 0.0f; - fMidEnergy = 0.0; - fSideEnergy = 0.0; - - for ( n = 0; n < piBandwidths[b]; n++ ) - { - int32_t k; - for ( k = 0; k < iNumBlocks; k++ ) - { - float fMidReal; - float fMidImag; - float fSideReal; - float fSideImag; - - fMidReal = 0.5f * ( pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset] ); - fMidImag = 0.5f * ( pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset] ); - fSideReal = 0.5f * ( pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset] ); - fSideImag = 0.5f * ( pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset] ); - - fLeftEnergy += ( pppfReal[0][k][iFBOffset] * pppfReal[0][k][iFBOffset] + pppfImag[0][k][iFBOffset] * pppfImag[0][k][iFBOffset] ); - fRightEnergy += ( pppfReal[1][k][iFBOffset] * pppfReal[1][k][iFBOffset] + pppfImag[1][k][iFBOffset] * pppfImag[1][k][iFBOffset] ); - fMidEnergy += ( fMidReal * fMidReal + fMidImag * fMidImag ); - fSideEnergy += ( fSideReal * fSideReal + fSideImag * fSideImag ); - - fLRCovReal += ( pppfReal[0][k][iFBOffset] * pppfReal[1][k][iFBOffset] + pppfImag[0][k][iFBOffset] * pppfImag[1][k][iFBOffset] ); - fLRCovImag += ( pppfImag[0][k][iFBOffset] * pppfReal[1][k][iFBOffset] - pppfImag[1][k][iFBOffset] * pppfReal[0][k][iFBOffset] ); - } - - iFBOffset++; - } - - /* compute L/R phase difference if high coherence */ - if ( fLRCovReal * fLRCovReal + fLRCovImag * fLRCovImag > 0.5f * fLeftEnergy * fRightEnergy ) - { - float fPhase = (float) atan2( fLRCovImag, fLRCovReal ); // ToDo: replace by atan2f() - iPhase = quantPhase( fPhase ); - } - else - { - iPhase = 0; - } - piLRPhaseDiffs[b] = iPhase; - - /* adjust covariance based on phase rotation */ -#ifdef SIMPLE_PHASE - cplxmult( &fLRCovReal, &fLRCovImag, c_afRotRealImagSimple[iPhase][0], -c_afRotRealImagSimple[iPhase][1] ); -#else - tabIdx = iPhase - PHASE_MIN_VAL; - cplxmult( &fLRCovReal, &fLRCovImag, c_afRotRealImag[tabIdx][0], -c_afRotRealImag[tabIdx][1] ); -#endif - /* compute MS prediction coefficient based on LR covariance*/ - fMidEnergyPred = 0.25f * ( fLeftEnergy + fRightEnergy + 2.0f * fLRCovReal ); - fSideEnergyPred = 0.25f * ( fLeftEnergy + fRightEnergy - 2.0f * fLRCovReal ); - - /* M/S prediction */ - fPred = fMidEnergyPred == 0.0f ? 0.0f : 0.25f * ( fLeftEnergy - fRightEnergy ) / fMidEnergyPred; - iPred = quantPred( fPred ); - fPred = dequantPred( iPred ); - piMSPredCoefs[b] = iPred; - - /* evaluation */ - fSideEnergyPred += ( fPred * fPred * fMidEnergyPred - 2.0f * fPred * 0.25f * ( fLeftEnergy - fRightEnergy ) ); - /* -= fPred * fPred * fMidEnergyPred doesn't work because fPred is quantized and does not match MS/MM exactly */ - fMSPredRatio = log10f( ( fMidEnergyPred + 1e-12f ) / ( fSideEnergyPred + 1e-12f ) ); - - fLeftEnergy = log10f( fLeftEnergy + 1e-12f ); - fRightEnergy = log10f( fRightEnergy + 1e-12f ); - fMidEnergy = log10f( fMidEnergy + 1e-12f ); - fSideEnergy = log10f( fSideEnergy + 1e-12f ); - - if ( fLeftEnergy > fRightEnergy ) - { - fLRRatio = fLeftEnergy - fRightEnergy; - } - else - { - fLRRatio = fRightEnergy - fLeftEnergy; - } - - if ( fMidEnergy > fSideEnergy ) - { - fMSRatio = fMidEnergy - fSideEnergy; - } - else - { - fMSRatio = fSideEnergy - fMidEnergy; - } - - if ( fMSRatio > fLRRatio ) - { - iNumMSBands++; - piMSFlags[b] = 1; - } - else - { - piMSFlags[b] = 0; - } - - if ( fMSRatio > fLRRatio ) - { - float maskThresShift_dB_by_10 = ( fMSRatio - fLRRatio ) * (float) c_aiDefaultTheta48[b] / 16.0f; - msBitsReduction += (float) ( piBandwidths[b] * iNumBlocks * 2 ) * one_by_log10_2 * maskThresShift_dB_by_10; /* * 2 for real/imag */ - } - - if ( fMSPredRatio > fLRRatio ) - { - float maskThresShift_dB_by_10 = ( fMSPredRatio - fLRRatio ) * (float) c_aiDefaultTheta48[b] / 16.0f; - msPredBitsReduction += (float) ( piBandwidths[b] * iNumBlocks * 2 ) * one_by_log10_2 * maskThresShift_dB_by_10; - iNumMSPredBands++; - piMSPredFlags[b] = 1; - } - else - { - piMSPredFlags[b] = 0; - } - } - - msPredBits = CountMSBits( iNumBands, 3, piMSPredFlags, piLRPhaseDiffs, piMSPredCoefs ); - msPredBitsReduction = max( msPredBitsReduction - (float) msPredBits, 0.0f ); - msBits = CountMSBits( iNumBands, 2, piMSFlags, NULL, NULL ); - msBitsReduction = max( msBitsReduction - (float) msBits, 0.0f ); -#ifdef DEBUG_WRITE_MS_PRED - { - static FILE *fid = 0; - if ( !fid ) - { - fid = fopen( "bit_red.txt", "wt" ); - } - fprintf( fid, "%.1f %.1f %d %d\n", msBitsReduction, msPredBitsReduction, msBits, msPredBits ); - } -#endif - - if ( iAllowSidePred && msPredBitsReduction > 1.1f * msBitsReduction ) - { - *piMSMode = 3; - for ( b = 0; b < iNumBands; b++ ) - { - piMSFlags[b] = piMSPredFlags[b]; - } - iNumMSBands = iNumMSPredBands; - } - else if ( iNumMSBands == iNumBands ) - { - *piMSMode = 1; - } - else if ( iNumMSBands > 0 ) - { - *piMSMode = 2; - } - else - { - *piMSMode = 0; - } - - if ( *piMSMode > 0 ) - { - iFBOffset = 0; - for ( b = 0; b < iNumBands; b++ ) - { -#if defined SIMPLE_PHASE - void ( *pFuncPhaseRotate )( float *, float * ) = pFuncPhaseRotateOptions[piLRPhaseDiffs[b]]; -#endif - if ( piMSFlags[b] == 1 ) - { - int32_t n; - for ( n = 0; n < piBandwidths[b]; n++ ) - { - int32_t k; - for ( k = 0; k < iNumBlocks; k++ ) - { - float fMidReal; - float fMidImag; - float fSideReal; - float fSideImag; - - if ( *piMSMode == 3 ) - { -#ifdef SIMPLE_PHASE - ( *pFuncPhaseRotate )( &pppfReal[1][k][iFBOffset], &pppfImag[1][k][iFBOffset] ); -#else - int32_t phaseIdx; - - phaseIdx = piLRPhaseDiffs[b] - PHASE_MIN_VAL; - cplxmult( &pppfReal[1][k][iFBOffset], &pppfImag[1][k][iFBOffset], c_afRotRealImag[phaseIdx][0], c_afRotRealImag[phaseIdx][1] ); -#endif - } - - fMidReal = 0.5f * ( pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset] ); - fMidImag = 0.5f * ( pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset] ); - fSideReal = 0.5f * ( pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset] ); - fSideImag = 0.5f * ( pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset] ); - - if ( *piMSMode == 3 ) - { - fPred = dequantPred( piMSPredCoefs[b] ); - fSideReal -= fPred * fMidReal; - fSideImag -= fPred * fMidImag; - } - - pppfReal[0][k][iFBOffset] = fMidReal; - pppfReal[1][k][iFBOffset] = fSideReal; - pppfImag[0][k][iFBOffset] = fMidImag; - pppfImag[1][k][iFBOffset] = fSideImag; - } - iFBOffset++; - } - } - else - { - iFBOffset += piBandwidths[b]; - } - } - } - -#ifdef DEBUG_WRITE_MS_PRED - { - static FILE *fid = 0; - if ( !fid ) - { - fid = fopen( "ms_mode_enc_raw.txt", "wt" ); - } - writeMSPred( piLRPhaseDiffs, piMSPredCoefs, *piMSMode, iNumBands, iNumBands, fid, piMSFlags ); - } -#endif - if ( *piMSMode == 3 ) - { - /* Differential Coding of Phase Data*/ - PrepEncode( piLRPhaseDiffs, piMSFlags, iNumBands ); - PrepEncode( piMSPredCoefs, piMSFlags, iNumBands ); -#ifdef DEBUG_WRITE_MS_PRED - { - static FILE *fid = 0; - if ( !fid ) - { - fid = fopen( "ms_mode_enc.txt", "wt" ); - } - writeMSPred( piLRPhaseDiffs, piMSPredCoefs, *piMSMode, iNumMSBands, iNumBands, fid, piMSFlags ); - } -#endif - /* Differential Coding*/ -#ifndef SIMPLE_PHASE - EncodePhase( piLRPhaseDiffs, iNumMSBands, PHASE_DIFF_DIM ); -#endif - EncodePredCoef( piMSPredCoefs, iNumMSBands ); -#ifdef DEBUG_WRITE_MS_PRED - { - static FILE *fid = 0; - if ( !fid ) - { - fid = fopen( "ms_mode_enc_diff.txt", "wt" ); - } - writeMSPred( piLRPhaseDiffs, piMSPredCoefs, *piMSMode, iNumMSBands, iNumBands, fid, piMSFlags ); - } -#endif - } - - return iNumMSBands; -} -#endif static void RemoveRMSEnvelope( @@ -1473,7 +1108,6 @@ static void RemoveRMSEnvelope( return; } -#ifdef SPLIT_REND_LCLD_5MS static void QuantizeSpectrumDPCM_Opt( const int32_t iNumGroups, const int32_t *piGroupLengths, @@ -1585,149 +1219,6 @@ static void QuantizeSpectrumDPCM_Opt( } /* bandwidth */ } /* bands */ } -#else -static void QuantizeSpectrumDPCM_Opt( - const int32_t iNumGroups, - const int32_t *piGroupLengths, - const int32_t iNumBands, - const int32_t *piBandwidths, - int32_t **ppiAlloc, - float **ppfReal, - float **ppfImag, - int32_t **ppiQReal, - int32_t **ppiQImag, - int32_t **ppiSignReal, - int32_t **ppiSignImag, - int32_t *piPredEnable, - float *pfA1Real, - float *pfA1Imag ) /* Pass in 2 previous value buffers NULLABLE */ -{ - int32_t b, m, n, iBlockOffset; - float fVal, fPrevReal, fPrevImag, fPredReal, fPredImag; - int32_t iFBOffset; - int32_t k, iAlloc, iQuantValue, iMaxQuantVal; - float fSCFGain, fInvSCFGain; - - iFBOffset = 0; - for ( b = 0; b < iNumBands; b++ ) - { - for ( m = 0; m < piBandwidths[b]; m++ ) - { - iBlockOffset = 0; - fPrevReal = 0.0; - fPrevImag = 0.0; - for ( n = 0; n < iNumGroups; n++ ) - { - iAlloc = ppiAlloc[n][b]; - iMaxQuantVal = c_aiQuantMaxValues[iAlloc]; - fSCFGain = c_afScaleFactor[iAlloc]; - fInvSCFGain = c_afInvScaleFactor[iAlloc]; - - if ( piPredEnable[iFBOffset] == 1 ) - { - for ( k = 0; k < piGroupLengths[n]; k++ ) - { - fPredReal = 0.0; - fPredImag = 0.0; - - fPredReal = pfA1Real[iFBOffset] * fPrevReal - pfA1Imag[iFBOffset] * fPrevImag; - fPredImag = pfA1Real[iFBOffset] * fPrevImag + pfA1Imag[iFBOffset] * fPrevReal; - - fVal = ppfReal[iBlockOffset][iFBOffset] + fPredReal; - if ( fVal > 0.0 ) - { - iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); - ppiSignReal[iBlockOffset][iFBOffset] = 0; - } - else - { - iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); - ppiSignReal[iBlockOffset][iFBOffset] = 1; - } - iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; - - ppiQReal[iBlockOffset][iFBOffset] = iQuantValue; - - fVal = ppfImag[iBlockOffset][iFBOffset] + fPredImag; - if ( fVal > 0.0 ) - { - iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); - ppiSignImag[iBlockOffset][iFBOffset] = 0; - } - else - { - iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); - ppiSignImag[iBlockOffset][iFBOffset] = 1; - } - - iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; - ppiQImag[iBlockOffset][iFBOffset] = iQuantValue; - - - if ( ppiSignReal[iBlockOffset][iFBOffset] == 0 ) - { - fPrevReal = fInvSCFGain * (float) ppiQReal[iBlockOffset][iFBOffset] - fPredReal; - } - else - { - fPrevReal = -fInvSCFGain * (float) ppiQReal[iBlockOffset][iFBOffset] - fPredReal; - } - if ( ppiSignImag[iBlockOffset][iFBOffset] == 0 ) - { - fPrevImag = fInvSCFGain * (float) ppiQImag[iBlockOffset][iFBOffset] - fPredImag; - } - else - { - fPrevImag = -fInvSCFGain * (float) ppiQImag[iBlockOffset][iFBOffset] - fPredImag; - } - - iBlockOffset++; - } - } - else - { - for ( k = 0; k < piGroupLengths[n]; k++ ) - { - fVal = ppfReal[iBlockOffset][iFBOffset]; - if ( fVal > 0.0 ) - { - iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); - ppiSignReal[iBlockOffset][iFBOffset] = 0; - } - else - { - iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); - ppiSignReal[iBlockOffset][iFBOffset] = 1; - } - iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; - - ppiQReal[iBlockOffset][iFBOffset] = iQuantValue; - - fVal = ppfImag[iBlockOffset][iFBOffset]; - if ( fVal > 0.0 ) - { - iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); - ppiSignImag[iBlockOffset][iFBOffset] = 0; - } - else - { - iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); - ppiSignImag[iBlockOffset][iFBOffset] = 1; - } - iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; - ppiQImag[iBlockOffset][iFBOffset] = iQuantValue; - iBlockOffset++; - } - } - } - - iFBOffset++; - } - } - - return; -} -#endif static int32_t CountLCLDBits( const int32_t iNumGroups, @@ -2220,13 +1711,7 @@ static int32_t ComputeAllocation( int32_t ***pppiQImag, int32_t ***pppiSignReal, int32_t ***pppiSignImag, -#ifdef SPLIT_REND_LCLD_5MS PredictionEncoder *psPredictionEncoder ) -#else - int32_t **ppiPredEnable, - float **ppfA1Real, - float **ppfA1Imag ) -#endif { int32_t iBitsUsed, iDone, iDelta; int32_t b, k, n; @@ -2260,13 +1745,11 @@ static int32_t ComputeAllocation( } } -#ifdef SPLIT_REND_LCLD_5MS if ( psPredictionEncoder->iNumSubSets > 1 ) { mvr2r( psPredictionEncoder->ppfPredStateReal[n], psPredictionEncoder->ppfPredStateRealTmp[n], LCLD_BANDS ); mvr2r( psPredictionEncoder->ppfPredStateImag[n], psPredictionEncoder->ppfPredStateImagTmp[n], LCLD_BANDS ); } -#endif QuantizeSpectrumDPCM_Opt( piNumGroups[n], (const int32_t *) ppiGroupLengths[n], @@ -2279,7 +1762,6 @@ static int32_t ComputeAllocation( pppiQImag[n], pppiSignReal[n], pppiSignImag[n], -#ifdef SPLIT_REND_LCLD_5MS psPredictionEncoder->iNumSubSets, psPredictionEncoder->iSubSetId, psPredictionEncoder->ppiPredBandEnable[n], @@ -2287,21 +1769,12 @@ static int32_t ComputeAllocation( psPredictionEncoder->ppfA1Imag[n], psPredictionEncoder->ppfPredStateRealTmp[n], psPredictionEncoder->ppfPredStateImagTmp[n] ); -#else - ppiPredEnable[n], - ppfA1Real[n], - ppfA1Imag[n] ); -#endif iBitsUsed += CountLCLDBits( piNumGroups[n], (const int32_t *) ppiGroupLengths[n], iNumBands, piBandwidths, -#ifdef SPLIT_REND_LCLD_5MS (const int32_t *) psPredictionEncoder->ppiPredBandEnable[n], -#else - (const int32_t *) ppiPredEnable[n], -#endif pppiAlloc[n], pppiQReal[n], pppiQImag[n] ); @@ -2348,7 +1821,6 @@ static int32_t ComputeAllocation( } } -#ifdef SPLIT_REND_LCLD_5MS if ( psPredictionEncoder->iNumSubSets > 1 ) { for ( n = 0; n < iChannels; n++ ) @@ -2361,7 +1833,6 @@ static int32_t ComputeAllocation( psPredictionEncoder->iSubSetId = 0; } } -#endif // printf("%d\n",*piAllocOffset); // printf("%d\t%d\t%d\n",pppiAlloc[0][0][0],pppiAlloc[0][0][1],pppiAlloc[0][0][22]); diff --git a/lib_rend/ivas_lcld_prot.h b/lib_rend/ivas_lcld_prot.h index f83ef8ae8bd4959b0dfa07b1e610748927d25995..6fbc250fcc73c9119b951be53c681c855c8ec5ca 100644 --- a/lib_rend/ivas_lcld_prot.h +++ b/lib_rend/ivas_lcld_prot.h @@ -42,7 +42,6 @@ typedef struct LCLD_ENCODER LCLDEncoder; -#ifdef SPLIT_REND_LCLD_5MS ivas_error CreateLCLDEncoder( LCLDEncoder **psLCLDEncoder_out, const int32_t iSampleRate, @@ -51,14 +50,6 @@ ivas_error CreateLCLDEncoder( const int32_t iAllowSidePred, const int16_t iNumBlocks, const int16_t iNumSubSets ); -#else -ivas_error CreateLCLDEncoder( - LCLDEncoder **psLCLDEncoder, - const int32_t iSampleRate, - const int32_t iChannels, - const int32_t iTargetBitRate, - const int32_t iAllowSidePred ); -#endif void DeleteLCLDEncoder( LCLDEncoder *psLCLDEncoder @@ -79,18 +70,11 @@ int32_t GetNumGroups( typedef struct LCLD_DECODER LCLDDecoder; -#ifndef SPLIT_REND_LCLD_5MS -ivas_error CreateLCLDDecoder( - LCLDDecoder **psLCLDDecoder_out, - const int32_t iSampleRate, - const int32_t iChannels ); -#else ivas_error CreateLCLDDecoder( LCLDDecoder **psLCLDDecoder_out, const int32_t iSampleRate, const int32_t iChannels, const int32_t iNumBlocks ); -#endif void DeleteLCLDDecoder( LCLDDecoder *psLCLDDecoder @@ -243,7 +227,6 @@ typedef struct PREDICTION_ENCODER int32_t iChannels; int32_t iNumBlocks; -#ifdef SPLIT_REND_LCLD_5MS int32_t iSubSetId; int32_t iNumSubSets; int32_t iMaxNumPredBands; @@ -255,7 +238,6 @@ typedef struct PREDICTION_ENCODER float **ppfPredStateImagTmp; float **ppfInpPrevReal; /* channels, bands */ float **ppfInpPrevImag; -#endif float *pfWindow; float pfRxxReal[2]; @@ -263,10 +245,6 @@ typedef struct PREDICTION_ENCODER int32_t *piPredChanEnable; int32_t *piNumPredBands; -#ifndef SPLIT_REND_LCLD_5MS - float **ppfEstPredGain; - float **ppfEstPredBitGain; -#endif int32_t **ppiPredBandEnable; float **ppfA1Real; @@ -276,7 +254,6 @@ typedef struct PREDICTION_ENCODER int32_t **ppiA1Phase; } PredictionEncoder; -#ifdef SPLIT_REND_LCLD_5MS ivas_error CreatePredictionEncoder( PredictionEncoder **psPredictionEncoder_out, const int32_t iChannels, @@ -284,31 +261,16 @@ ivas_error CreatePredictionEncoder( const int32_t iNumSubSets, const int32_t iMaxNumPredBands ); -#else -ivas_error CreatePredictionEncoder( - PredictionEncoder **psPredictionEncoder_out, - const int32_t iChannels, - const int32_t iNumBlocks -); -#endif void DeletePredictionEncoder( PredictionEncoder *psPredictionEncoder ); -#ifdef SPLIT_REND_LCLD_5MS void ComputePredictors( PredictionEncoder *psPredictionEncoder, float ***pppfReal, float ***pppfImag ); -#else -int32_t ComputePredictors( - PredictionEncoder *psPredictionEncoder, - float ***pppfReal, - float ***pppfImag -); -#endif void ApplyForwardPredictors( PredictionEncoder *psPredictionEncoder, @@ -325,19 +287,12 @@ typedef struct PREDICTION_DECODER { int32_t iChannels; int32_t iNumBlocks; - #ifdef SPLIT_REND_LCLD_5MS int32_t iSubSetId; int32_t iNumSubSets; float **ppfPredStateReal; float **ppfPredStateImag; - #endif int32_t *piPredChanEnable; - #ifndef SPLIT_REND_LCLD_5MS - int32_t *piNumPredBands; - - float **ppfEstPredGain; - #endif int32_t **ppiPredBandEnable; float **ppfA1Real; @@ -367,11 +322,7 @@ int32_t ReadPredictors( IVAS_SPLIT_REND_BITS_HANDLE pBits ); -#ifdef SPLIT_REND_LCLD_5MS void ApplyInversePredictors( -#else -void ApplyInversePredictros( -#endif PredictionDecoder *psPredictionDecoder, float ***pppfReal, float ***pppfImag diff --git a/lib_rend/ivas_lcld_rom_tables.c b/lib_rend/ivas_lcld_rom_tables.c index 0499ded47cc2f3ee2c63369ed45bad9fd72921a2..c562624ffaba94d69280d904512851bd2b45d386 100644 --- a/lib_rend/ivas_lcld_rom_tables.c +++ b/lib_rend/ivas_lcld_rom_tables.c @@ -39,14 +39,6 @@ /* clang-format off */ -#ifndef SPLIT_REND_LCLD_5MS -const float c_afRotRealImagSimple[SIMPLE_PHASE_MAX_VAL + 1][2] = { - { 1.0f, 0.0f }, /* zero */ - { 0.0f, 1.0f }, /* pi/2 */ - { -1.0f, 0.0f }, /* pi */ - { 0.0f, -1.0f }, /* 3*pi/2 */ -}; -#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_rend/ivas_lcld_rom_tables.h b/lib_rend/ivas_lcld_rom_tables.h index 15a8e2921199329419fa6b3f60745422de1873a8..8deb0aadf5e69fe570cc79af71396e3a7404b129 100644 --- a/lib_rend/ivas_lcld_rom_tables.h +++ b/lib_rend/ivas_lcld_rom_tables.h @@ -45,16 +45,12 @@ #define LCLD_BLOCKS_PER_FRAME ( 16 ) #define LCLD_MAX_BLOCKS_PER_FRAME ( 16 ) #define LCLD_BANDS ( 60 ) -#ifdef SPLIT_REND_LCLD_5MS #define LCLD_PRED_WIN_LEN ( 16 ) #define LCLD_MAX_NUM_PRED_SUBSETS ( 8 ) -#endif #define MAX_BANDS ( 23 ) #define MAX_BANDS_48 ( 23 ) -#ifdef SPLIT_REND_LCLD_5MS #define DEF_BANDS_48 ( 22 ) -#endif #define ENV_MIN ( -64 ) #define ENV_MAX ( 64 ) @@ -95,15 +91,6 @@ #define PHASE_DIFF_DIM ( 2 ) #define PHASE_BAND0_BITS ( 5 ) -#ifndef SPLIT_REND_LCLD_5MS -#define SIMPLE_PHASE_MAX_VAL ( 3 ) -#define SIMPLE_PHASE_MIN_VAL ( 0 ) -#define SIMPLE_PHASE_BITS ( 2 ) -#define SIMPLE_PHASE_QUANT_FACTOR ( 2.0f / _PI_ ) - -#define TON_QUOTA_ABS_THRESHOLD ( 8.0f ) -#define TON_QUOTA_INC_THRESHOLD ( 4.0f ) -#endif #define PERCEPTUAL_MODEL_SLGAIN_SHIFT ( 8 ) //#define USE_DEMOD_TABLES @@ -111,9 +98,6 @@ #define HUFF_DEC_TABLE_SIZE ( 16 ) extern const float c_afRotRealImag[PRED_MAX_VAL - PRED_MIN_VAL + 1][2]; -#ifndef SPLIT_REND_LCLD_5MS -extern const float c_afRotRealImagSimple[SIMPLE_PHASE_MAX_VAL + 1][2]; -#endif extern const int32_t c_aiDefaultTheta48[MAX_BANDS_48]; extern const float c_afScaleFactor[ALLOC_TABLE_SIZE]; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 80b53d508d10e5dfd70dbb2ce5618fb9cb4be835..3767a7fea22b737e8a66c707a10065d2ec9b4580 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1466,7 +1466,6 @@ void ivas_init_split_post_rend_handles( SPLIT_POST_REND_WRAPPER *hSplitRendWrapper ); -#ifdef SPLIT_REND_LCLD_5MS ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitBinRend, const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, @@ -1475,22 +1474,11 @@ ivas_error ivas_split_renderer_open( const int16_t pcm_out_flag, const int16_t num_subframes ); -#else -ivas_error ivas_split_renderer_open( - SPLIT_REND_WRAPPER *hSplitBinRend, - const IVAS_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 is_5ms_frame -); -#endif void ivas_split_renderer_close( SPLIT_REND_WRAPPER *hSplitBinRend ); -#ifdef SPLIT_REND_LCLD_5MS ivas_error ivas_splitBinLCLDEncOpen( BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc, const int32_t iSampleRate, @@ -1499,14 +1487,6 @@ ivas_error ivas_splitBinLCLDEncOpen( const int16_t iNumBlocks, const int16_t iNumIterations ); -#else -ivas_error ivas_splitBinLCLDEncOpen( - BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc, - const int32_t iSampleRate, - const int16_t iChannels, - const int32_t iDataRate -); -#endif void ivas_splitBinLCLDEncClose( BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc @@ -1520,7 +1500,6 @@ void ivas_splitBinLCLDEncProcess( IVAS_SPLIT_REND_BITS_HANDLE pBits ); -#ifdef SPLIT_REND_LCLD_5MS ivas_error ivas_splitBinLCLDDecOpen( BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec, const int32_t iSampleRate, @@ -1528,13 +1507,6 @@ ivas_error ivas_splitBinLCLDDecOpen( const int16_t iNumBlocks, const int16_t iNumIterations ); -#else -ivas_error ivas_splitBinLCLDDecOpen( - BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec, - const int32_t iSampleRate, - const int16_t iChannels -); -#endif void ivas_splitBinLCLDDecClose( BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec @@ -1644,7 +1616,6 @@ void ivas_splitBinRendPLCClose( SPLIT_REND_PLC_HANDLE* phSplitRendPLC ); -#ifdef SPLIT_REND_LCLD_5MS void ivas_splitBinRendPLCsaveState( SPLIT_REND_PLC_HANDLE hSplitRendPLC, float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -1653,16 +1624,7 @@ void ivas_splitBinRendPLCsaveState( const int16_t iNumBlocks, const int16_t iNumIterations ); -#else -void ivas_splitBinRendPLCsaveState( - SPLIT_REND_PLC_HANDLE hSplitRendPLC, - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const int16_t num_chs -); -#endif -#ifdef SPLIT_REND_LCLD_5MS void ivas_splitBinRendPLC_xf( SPLIT_REND_PLC_HANDLE hSplitRendPLC, float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -1671,16 +1633,7 @@ void ivas_splitBinRendPLC_xf( const int16_t iNumBlocks, const int16_t iNumIterations ); -#else -void ivas_splitBinRendPLC_xf( - SPLIT_REND_PLC_HANDLE hSplitRendPLC, - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const int16_t num_chs -); -#endif -#ifdef SPLIT_REND_LCLD_5MS void ivas_splitBinRendPLC( SPLIT_REND_PLC_HANDLE hSplitRendPLC, float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -1689,14 +1642,6 @@ void ivas_splitBinRendPLC( const int16_t iNumBlocks, const int16_t iNumIterations ); -#else -void ivas_splitBinRendPLC( - SPLIT_REND_PLC_HANDLE hSplitRendPLC, - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const int16_t num_chs -); -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG void ivas_log_cldfb2wav_data( @@ -1977,12 +1922,10 @@ int32_t ivas_split_rend_bitstream_read_int32( const int32_t bits ); -#ifdef SPLIT_REND_LCLD_5MS int32_t get_bit( const int32_t state, const int32_t bit_id ); -#endif void ivas_rend_closeCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend @@ -2034,7 +1977,6 @@ void ivas_split_rend_get_quant_params( int16_t *num_complex_bands ); -#ifdef SPLIT_REND_LCLD_5MS ivas_error ivas_split_rend_choose_default_codec( IVAS_SPLIT_REND_CODEC *pCodec, /* i/o: pointer to codec setting */ int16_t *pCodec_frame_size_ms, /* i/o: pointer to codec frame size setting */ @@ -2042,14 +1984,6 @@ ivas_error ivas_split_rend_choose_default_codec( const int16_t pcm_out_flag, /* i : flag to indicate PCM output */ const int16_t num_subframes /* i : number of subframes */ ); -#else -ivas_error ivas_split_rend_choose_default_codec( - IVAS_SPLIT_REND_CODEC *pCodec, /* i/o: pointer to codec setting */ - int16_t *pCodec_frame_size_ms, /* i/o: pointer to codec frame size setting */ - const int16_t cldfb_in_flag, /* i : flag indicating rendering in CLDFB */ - const int16_t pcm_out_flag /* i : flag to indicate PCM output */ -); -#endif #endif diff --git a/lib_rend/ivas_splitRend_lcld_dec.c b/lib_rend/ivas_splitRend_lcld_dec.c index feb11fe89b7370e6d4b222c59c7c0887f80a3493..9493d076af79417888b4e7ec4daef90abe10b43e 100644 --- a/lib_rend/ivas_splitRend_lcld_dec.c +++ b/lib_rend/ivas_splitRend_lcld_dec.c @@ -48,19 +48,12 @@ * *------------------------------------------------------------------------*/ -#ifdef SPLIT_REND_LCLD_5MS ivas_error ivas_splitBinLCLDDecOpen( BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec, const int32_t iSampleRate, const int16_t iChannels, const int16_t iNumBlocks, const int16_t iNumIterations ) -#else -ivas_error ivas_splitBinLCLDDecOpen( - BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec, - const int32_t iSampleRate, - const int16_t iChannels ) -#endif { int16_t n; BIN_HR_SPLIT_LCLD_DEC_HANDLE splitBinLCLDDec; @@ -75,17 +68,10 @@ ivas_error ivas_splitBinLCLDDecOpen( splitBinLCLDDec->iChannels = iChannels; -#ifndef SPLIT_REND_LCLD_5MS - if ( ( error = CreateLCLDDecoder( &splitBinLCLDDec->psLCLDDecoder, iSampleRate, iChannels ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = CreateLCLDDecoder( &splitBinLCLDDec->psLCLDDecoder, iSampleRate, iChannels, iNumBlocks ) ) != IVAS_ERR_OK ) { return error; } -#endif if ( ( splitBinLCLDDec->pppfDecLCLDReal = (float ***) malloc( iChannels * sizeof( float ** ) ) ) == NULL ) { @@ -125,10 +111,8 @@ ivas_error ivas_splitBinLCLDDecOpen( { return error; } -#ifdef SPLIT_REND_LCLD_5MS splitBinLCLDDec->iNumBlocks = iNumBlocks; splitBinLCLDDec->iNumIterations = iNumIterations; -#endif *hSplitBinLCLDDec = splitBinLCLDDec; @@ -192,9 +176,7 @@ void ivas_splitBinLCLDDecProcess( const int16_t bfi ) { int16_t k, n; -#ifdef SPLIT_REND_LCLD_5MS int16_t itr; -#endif push_wmops( "ivas_splitBinLCLDDecProcess" ); assert( hSplitBinLCLDDec != NULL ); @@ -207,14 +189,11 @@ void ivas_splitBinLCLDDecProcess( #endif if ( !bfi ) { -#ifdef SPLIT_REND_LCLD_5MS for ( itr = 0; itr < hSplitBinLCLDDec->iNumIterations; itr++ ) { -#endif /* Initialized with zeros....... */ for ( n = 0; n < hSplitBinLCLDDec->iChannels; n++ ) { -#ifdef SPLIT_REND_LCLD_5MS for ( k = 0; k < hSplitBinLCLDDec->iNumBlocks; k++ ) { hSplitBinLCLDDec->pppfDecLCLDReal[n][k] = Cldfb_Out_Real[n][hSplitBinLCLDDec->iNumBlocks * itr + k]; @@ -222,15 +201,6 @@ void ivas_splitBinLCLDDecProcess( set_f( hSplitBinLCLDDec->pppfDecLCLDReal[n][k], 0, CLDFB_NO_CHANNELS_MAX ); set_f( hSplitBinLCLDDec->pppfDecLCLDImag[n][k], 0, CLDFB_NO_CHANNELS_MAX ); } -#else - for ( k = 0; k < CLDFB_NO_COL_MAX; k++ ) - { - hSplitBinLCLDDec->pppfDecLCLDReal[n][k] = Cldfb_Out_Real[n][k]; - hSplitBinLCLDDec->pppfDecLCLDImag[n][k] = Cldfb_Out_Imag[n][k]; - set_f( hSplitBinLCLDDec->pppfDecLCLDReal[n][k], 0, CLDFB_NO_CHANNELS_MAX ); - set_f( hSplitBinLCLDDec->pppfDecLCLDImag[n][k], 0, CLDFB_NO_CHANNELS_MAX ); - } -#endif } DecodeLCLDFrame( hSplitBinLCLDDec->psLCLDDecoder, pBits, hSplitBinLCLDDec->pppfDecLCLDReal, hSplitBinLCLDDec->pppfDecLCLDImag ); @@ -257,32 +227,18 @@ void ivas_splitBinLCLDDecProcess( if ( hSplitBinLCLDDec->hSplitRendPLC->prev_bfi != 0 ) { /* cross-fade recovered frame into good frame */ -#ifdef SPLIT_REND_LCLD_5MS ivas_splitBinRendPLC_xf( hSplitBinLCLDDec->hSplitRendPLC, Cldfb_Out_Real, Cldfb_Out_Imag, (int16_t) hSplitBinLCLDDec->iChannels, hSplitBinLCLDDec->iNumBlocks, hSplitBinLCLDDec->iNumIterations ); -#else - ivas_splitBinRendPLC_xf( hSplitBinLCLDDec->hSplitRendPLC, Cldfb_Out_Real, Cldfb_Out_Imag, (int16_t) hSplitBinLCLDDec->iChannels ); -#endif } -#ifdef SPLIT_REND_LCLD_5MS } -#endif } else { /* do PLC for lost split renderer frame */ -#ifdef SPLIT_REND_LCLD_5MS ivas_splitBinRendPLC( hSplitBinLCLDDec->hSplitRendPLC, Cldfb_Out_Real, Cldfb_Out_Imag, (int16_t) hSplitBinLCLDDec->iChannels, hSplitBinLCLDDec->iNumBlocks, hSplitBinLCLDDec->iNumIterations ); -#else - ivas_splitBinRendPLC( hSplitBinLCLDDec->hSplitRendPLC, Cldfb_Out_Real, Cldfb_Out_Imag, (int16_t) hSplitBinLCLDDec->iChannels ); -#endif } /* save PLC state */ -#ifdef SPLIT_REND_LCLD_5MS ivas_splitBinRendPLCsaveState( hSplitBinLCLDDec->hSplitRendPLC, Cldfb_Out_Real, Cldfb_Out_Imag, (int16_t) hSplitBinLCLDDec->iChannels, hSplitBinLCLDDec->iNumBlocks, hSplitBinLCLDDec->iNumIterations ); -#else - ivas_splitBinRendPLCsaveState( hSplitBinLCLDDec->hSplitRendPLC, Cldfb_Out_Real, Cldfb_Out_Imag, (int16_t) hSplitBinLCLDDec->iChannels ); -#endif pop_wmops(); diff --git a/lib_rend/ivas_splitRend_lcld_enc.c b/lib_rend/ivas_splitRend_lcld_enc.c index c18d188d1d3801a58a22c053266153607204bfa0..6903989dd158a5b880c30fdd8300e3fa319b2feb 100644 --- a/lib_rend/ivas_splitRend_lcld_enc.c +++ b/lib_rend/ivas_splitRend_lcld_enc.c @@ -47,7 +47,6 @@ * *------------------------------------------------------------------------*/ -#ifdef SPLIT_REND_LCLD_5MS ivas_error ivas_splitBinLCLDEncOpen( BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc, const int32_t iSampleRate, @@ -55,13 +54,6 @@ ivas_error ivas_splitBinLCLDEncOpen( const int32_t iDataRate, const int16_t iNumBlocks, const int16_t iNumIterations ) -#else -ivas_error ivas_splitBinLCLDEncOpen( - BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc, - const int32_t iSampleRate, - const int16_t iChannels, - const int32_t iDataRate ) -#endif { BIN_HR_SPLIT_LCLD_ENC_HANDLE splitBinLCLDEnc; ivas_error error; @@ -74,17 +66,10 @@ ivas_error ivas_splitBinLCLDEncOpen( splitBinLCLDEnc->pLcld_enc = NULL; /* place holder for CLDFB encoder handle*/ splitBinLCLDEnc->iChannels = iChannels; -#ifdef SPLIT_REND_LCLD_5MS if ( ( error = CreateLCLDEncoder( &( splitBinLCLDEnc->psLCLDEncoder ), iSampleRate, iChannels, iDataRate, 1, iNumBlocks, (int16_t) CLDFB_NO_COL_MAX / iNumBlocks ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = CreateLCLDEncoder( &( splitBinLCLDEnc->psLCLDEncoder ), iSampleRate, iChannels, iDataRate, 1 ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif if ( ( splitBinLCLDEnc->pppfLCLDReal = (float ***) malloc( iChannels * sizeof( float ** ) ) ) == NULL ) { @@ -107,10 +92,8 @@ ivas_error ivas_splitBinLCLDEncOpen( } } -#ifdef SPLIT_REND_LCLD_5MS splitBinLCLDEnc->iNumIterations = iNumIterations; splitBinLCLDEnc->iNumBlocks = iNumBlocks; -#endif #ifdef CLDFB_DEBUG splitBinLCLDEnc->numFrame = 0; @@ -180,11 +163,7 @@ void ivas_splitBinLCLDEncProcess( const int32_t available_bits, IVAS_SPLIT_REND_BITS_HANDLE pBits ) { -#ifdef SPLIT_REND_LCLD_5MS int32_t iBitsWritten, itr, available_bits_itr, rem_itr, available_bits_local; -#else - int32_t iBitsWritten; -#endif push_wmops( "ivas_splitBinLCLDEncProcess" ); assert( hSplitBinLCLDEnc != NULL ); @@ -192,11 +171,8 @@ void ivas_splitBinLCLDEncProcess( assert( Cldfb_In_Imag != NULL ); assert( pBits != NULL ); -#ifdef SPLIT_REND_LCLD_5MS available_bits_local = available_bits; -#endif /* A conversion is needed for the 3d pointer interface here ........ */ -#ifdef SPLIT_REND_LCLD_5MS for ( itr = 0; itr < hSplitBinLCLDEnc->iNumIterations; itr++ ) { @@ -211,40 +187,19 @@ void ivas_splitBinLCLDEncProcess( hSplitBinLCLDEnc->pppfLCLDImag[n][k] = Cldfb_In_Imag[n][hSplitBinLCLDEnc->iNumBlocks * itr + k]; } } -#else - for ( int32_t n = 0; n < hSplitBinLCLDEnc->iChannels; n++ ) - { - for ( int32_t k = 0; k < CLDFB_NO_COL_MAX; k++ ) - { - hSplitBinLCLDEnc->pppfLCLDReal[n][k] = Cldfb_In_Real[n][k]; - hSplitBinLCLDEnc->pppfLCLDImag[n][k] = Cldfb_In_Imag[n][k]; - } - } -#endif #ifdef CLDFB_DEBUG int16_t readByte = 0; -#ifdef SPLIT_REND_LCLD_5MS for ( int16_t k = 0; k < hSplitBinLCLDEnc->iNumBlocks; k++ ) -#else - for ( int16_t k = 0; k < CLDFB_NO_COL_MAX; k++ ) -#endif { for ( int16_t b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) { for ( int16_t n = 0; n < hSplitBinLCLDEnc->iChannels; n++ ) { -#ifdef SPLIT_REND_LCLD_5MS readByte = fread( &hSplitBinLCLDEnc->pppfLCLDReal[n][k][b], sizeof( float ), 1, hSplitBinLCLDEnc->cldfbIn ); if ( readByte != 1 ) break; readByte = fread( &hSplitBinLCLDEnc->pppfLCLDReal[n][k][b], sizeof( float ), 1, hSplitBinLCLDEnc->cldfbIn ); -#else - readByte = fread( &Cldfb_In_Real[n][k][b], sizeof( float ), 1, hSplitBinLCLDEnc->cldfbIn ); - if ( readByte != 1 ) - break; - readByte = fread( &Cldfb_In_Imag[n][k][b], sizeof( float ), 1, hSplitBinLCLDEnc->cldfbIn ); -#endif } } } @@ -256,11 +211,7 @@ void ivas_splitBinLCLDEncProcess( else { printf( "Writing zeroes...\n" ); -#ifdef SPLIT_REND_LCLD_5MS for ( int16_T k = 0; k < hSplitBinLCLDEnc->iNumBlocks; k++ ) -#else - for ( int16_T k = 0; k < CLDFB_NO_COL_MAX; k++ ) -#endif { for ( int16_t b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) { @@ -273,30 +224,17 @@ void ivas_splitBinLCLDEncProcess( } } #endif -#ifdef SPLIT_REND_LCLD_5MS EncodeLCLDFrame( hSplitBinLCLDEnc->psLCLDEncoder, hSplitBinLCLDEnc->pppfLCLDReal, hSplitBinLCLDEnc->pppfLCLDImag, &iBitsWritten, available_bits_itr, pBits ); -#else - EncodeLCLDFrame( hSplitBinLCLDEnc->psLCLDEncoder, hSplitBinLCLDEnc->pppfLCLDReal, hSplitBinLCLDEnc->pppfLCLDImag, &iBitsWritten, available_bits, pBits ); -#endif -#ifdef SPLIT_REND_LCLD_5MS available_bits_local -= iBitsWritten; #ifdef DEBUGGING assert( available_bits_local >= 0 ); #endif -#else -#ifdef DEBUGGING - if ( iBitsWritten > available_bits ) - assert( iBitsWritten <= available_bits ); -#endif -#endif #ifdef CLDFB_DEBUG printf( "Bits written = %d\n", iBitsWritten ); #endif -#ifdef SPLIT_REND_LCLD_5MS } -#endif pop_wmops(); return; diff --git a/lib_rend/ivas_splitRendererPLC.c b/lib_rend/ivas_splitRendererPLC.c index 197be5a39447cb641198aa8ac2d8b0e9a09e9a4b..299430f28ee1191c44152cf4e49f645d6ff447f4 100644 --- a/lib_rend/ivas_splitRendererPLC.c +++ b/lib_rend/ivas_splitRendererPLC.c @@ -74,11 +74,8 @@ static void adaptive_polar_ext_plc( float xf_alp[CLDFB_PLC_XF], float xf_bet[CLDFB_PLC_XF] #endif -#ifdef SPLIT_REND_LCLD_5MS , - const int16_t iNumCols -#endif -) + const int16_t iNumCols ) { float uth[CLDFB_NO_COL_MAX], uthu[CLDFB_NO_COL_MAX], urh[CLDFB_NO_COL_MAX]; float ph_adj, ph_diff, ph_adj_t, quot, drho, srho, diff, dth, sth, fac_real, fac_imag; @@ -86,10 +83,6 @@ static void adaptive_polar_ext_plc( float start_real, start_imag, abs_fac, abs_fac_powj, comp_fac, fac_powj_real, fac_powj_imag, temp, abs2inv; float fac_ph_real, fac_ph_imag, rat_real, rat_imag, abs_temp; int32_t k, j; -#ifndef SPLIT_REND_LCLD_5MS - int16_t iNumCols; - iNumCols = CLDFB_NO_COL_MAX; -#endif /* reset of accumulators */ ph_adj = 0.0f; @@ -409,7 +402,6 @@ void ivas_splitBinRendPLCClose( * *------------------------------------------------------------------------*/ -#ifdef SPLIT_REND_LCLD_5MS void ivas_splitBinRendPLCsaveState( SPLIT_REND_PLC_HANDLE hSplitRendPLC, float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -417,22 +409,11 @@ void ivas_splitBinRendPLCsaveState( const int16_t num_chs, const int16_t iNumBlocks, const int16_t iNumIterations ) -#else -void ivas_splitBinRendPLCsaveState( - SPLIT_REND_PLC_HANDLE hSplitRendPLC, - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const int16_t num_chs ) -#endif { int16_t k, n; -/* Save Cldfb frame */ -#ifdef SPLIT_REND_LCLD_5MS + /* Save Cldfb frame */ for ( k = 0; k < ( iNumBlocks * iNumIterations ); k++ ) -#else - for ( k = 0; k < CLDFB_NO_COL_MAX; k++ ) -#endif { for ( n = 0; n < num_chs; n++ ) { @@ -451,7 +432,6 @@ void ivas_splitBinRendPLCsaveState( * Cross-fade of preceding bad frame into good frame *------------------------------------------------------------------------*/ -#ifdef SPLIT_REND_LCLD_5MS void ivas_splitBinRendPLC_xf( SPLIT_REND_PLC_HANDLE hSplitRendPLC, float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -459,13 +439,6 @@ void ivas_splitBinRendPLC_xf( const int16_t num_chs, const int16_t iNumBlocks, const int16_t iNumIterations ) -#else -void ivas_splitBinRendPLC_xf( - SPLIT_REND_PLC_HANDLE hSplitRendPLC, - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const int16_t num_chs ) -#endif { int16_t n, i, k; @@ -484,13 +457,8 @@ void ivas_splitBinRendPLC_xf( #if CLDFB_PLC_XF > 0 for ( k = 0; k < CLDFB_PLC_XF; k++ ) { -#ifdef SPLIT_REND_LCLD_5MS Cldfb_RealBuffer_Binaural[n][k][i] = hSplitRendPLC->CldfbPLC_state.xf_bet[n][i][k] * Cldfb_RealBuffer_Binaural[n][k][i] + hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinReal[n][k + ( iNumBlocks * iNumIterations )][i]; Cldfb_ImagBuffer_Binaural[n][k][i] = hSplitRendPLC->CldfbPLC_state.xf_bet[n][i][k] * Cldfb_ImagBuffer_Binaural[n][k][i] + hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinImag[n][k + ( iNumBlocks * iNumIterations )][i]; -#else - Cldfb_RealBuffer_Binaural[n][k][i] = hSplitRendPLC->CldfbPLC_state.xf_bet[n][i][k] * Cldfb_RealBuffer_Binaural[n][k][i] + hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinReal[n][k + CLDFB_NO_COL_MAX][i]; - Cldfb_ImagBuffer_Binaural[n][k][i] = hSplitRendPLC->CldfbPLC_state.xf_bet[n][i][k] * Cldfb_ImagBuffer_Binaural[n][k][i] + hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinImag[n][k + CLDFB_NO_COL_MAX][i]; -#endif } #endif } @@ -506,7 +474,6 @@ void ivas_splitBinRendPLC_xf( * Conceal bad frame *------------------------------------------------------------------------*/ -#ifdef SPLIT_REND_LCLD_5MS void ivas_splitBinRendPLC( SPLIT_REND_PLC_HANDLE hSplitRendPLC, float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -514,13 +481,6 @@ void ivas_splitBinRendPLC( const int16_t num_chs, const int16_t iNumBlocks, const int16_t iNumIterations ) -#else -void ivas_splitBinRendPLC( - SPLIT_REND_PLC_HANDLE hSplitRendPLC, - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const int16_t num_chs ) -#endif { int32_t i, n, k; float fade_fac; @@ -528,11 +488,9 @@ void ivas_splitBinRendPLC( #if CLDFB_PLC_XF > 0 float xf_alp[CLDFB_PLC_XF]; #endif -#ifdef SPLIT_REND_LCLD_5MS int16_t iNumCols, fade_start_cntr, mute_cntr, fade_val; iNumCols = iNumBlocks * iNumIterations; -#endif /* Indicate that next transition will be from a bad frame */ hSplitRendPLC->prev_bfi = 1; @@ -549,11 +507,7 @@ void ivas_splitBinRendPLC( { for ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) { -#ifdef SPLIT_REND_LCLD_5MS for ( k = 0; k < iNumCols; k++ ) -#else - for ( k = 0; k < CLDFB_NO_COL_MAX; k++ ) -#endif { prev_real[k] = hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinReal[n][k][i]; prev_imag[k] = hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinImag[n][k][i]; @@ -564,17 +518,10 @@ void ivas_splitBinRendPLC( , xf_alp, hSplitRendPLC->CldfbPLC_state.xf_bet[n][i] #endif -#ifdef SPLIT_REND_LCLD_5MS , - iNumCols -#endif - ); + iNumCols ); -#ifdef SPLIT_REND_LCLD_5MS for ( k = 0; k < iNumCols; k++ ) -#else - for ( k = 0; k < CLDFB_NO_COL_MAX; k++ ) -#endif { Cldfb_RealBuffer_Binaural[n][k][i] = rec_real[k]; hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinReal[n][k][i] = rec_real[k]; @@ -583,11 +530,7 @@ void ivas_splitBinRendPLC( } #if CLDFB_PLC_XF > 0 -#ifdef SPLIT_REND_LCLD_5MS for ( k = iNumCols; k < iNumCols + CLDFB_PLC_XF; k++ ) -#else - for ( k = CLDFB_NO_COL_MAX; k < CLDFB_NO_COL_MAX + CLDFB_PLC_XF; k++ ) -#endif { hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinReal[n][k][i] = rec_real[k]; hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinImag[n][k][i] = rec_imag[k]; @@ -597,8 +540,7 @@ void ivas_splitBinRendPLC( } -/* Check bf counter */ -#ifdef SPLIT_REND_LCLD_5MS + /* Check bf counter */ fade_start_cntr = SR_PLC_FADE_START * CLDFB_NO_COL_MAX / iNumCols; mute_cntr = SR_PLC_MUTE * CLDFB_NO_COL_MAX / iNumCols; @@ -631,23 +573,6 @@ void ivas_splitBinRendPLC( hSplitRendPLC->bf_count = mute_cntr; } } -#else - if ( hSplitRendPLC->bf_count++ >= SR_PLC_FADE_START ) - { - if ( hSplitRendPLC->bf_count < SR_PLC_MUTE ) - { - fade_fac = powf( 10, ( hSplitRendPLC->bf_count - SR_PLC_FADE_START ) * SR_PLC_FADE_DEGREE / 20.0f ); - v_multc( &Cldfb_RealBuffer_Binaural[0][0][0], fade_fac, &Cldfb_RealBuffer_Binaural[0][0][0], (int16_t) ( (CLDFB_NO_COL_MAX) *num_chs * CLDFB_NO_CHANNELS_MAX ) ); - v_multc( &Cldfb_ImagBuffer_Binaural[0][0][0], fade_fac, &Cldfb_ImagBuffer_Binaural[0][0][0], (int16_t) ( (CLDFB_NO_COL_MAX) *num_chs * CLDFB_NO_CHANNELS_MAX ) ); - } - else - { - set_zero( &Cldfb_RealBuffer_Binaural[0][0][0], (int16_t) ( (CLDFB_NO_COL_MAX) *num_chs * CLDFB_NO_CHANNELS_MAX ) ); - set_zero( &Cldfb_ImagBuffer_Binaural[0][0][0], (int16_t) ( (CLDFB_NO_COL_MAX) *num_chs * CLDFB_NO_CHANNELS_MAX ) ); - hSplitRendPLC->bf_count = SR_PLC_MUTE; - } - } -#endif return; } diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index 3a4172020e04dc0d9aa7151c10fcd248dc781c04..002229d8b8e60b584d498f59b4f0c7ff99808134 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -1289,15 +1289,6 @@ static void interpolate_rend_md( gd2 = rot_md[idx2 - 1][sf_idx][band_idx].gd; gd4 = rot_md[idx2 - 1][sf_idx][band_idx].gd2; } -#if 0 - diff = gd1 / gd2; - pitch_gain_l = gd2 * powf( diff, 1.0f - interp_pitch_fact ); - pitch_gain_l = max( 0.0f, pitch_gain_l ); - - diff = gd3 / gd4; - pitch_gain_r = gd4 * powf( diff, 1.0f - interp_pitch_fact ); - pitch_gain_r = max( 0.0f, pitch_gain_r ); -#else diff = gd1 - gd2; pitch_gain_l = gd1 - ( diff * interp_pitch_fact ); pitch_gain_l = max( 0.0f, pitch_gain_l ); @@ -1305,7 +1296,6 @@ static void interpolate_rend_md( diff = gd3 - gd4; pitch_gain_r = gd3 - ( diff * interp_pitch_fact ); pitch_gain_r = max( 0.0f, pitch_gain_r ); -#endif for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index b9dd7e9a7a9ef9be59fe4c3f73ac11de37808604..25bc04dfb50dba53d411d4713ee69c5e90d3d960 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -640,69 +640,9 @@ static void ComputeCoeffs( } } -#if 0 - if ( 1 ) - { -#endif gd2 = 0.0f; sigma_d = 0.0f; hMd->gd = 0.0f; -#if 0 - } - else - { - - sigma_d = cov_ii_norm_re[0][0] + cov_ii_norm_re[1][1] + cov_ii_norm_re[0][1] + cov_ii_norm_re[1][0] + EPSILON; - - rho_hat = max( EPSILON, sqrtf( postpred_cov_re[0][0] * postpred_cov_re[1][1] ) ); - rho_hat = postpred_cov_re[0][1] / rho_hat; - rho = max( EPSILON, sqrtf( cov_oo_norm_re[0][0] * cov_oo_norm_re[1][1] ) ); - rho = cov_oo_norm_re[0][1] / rho; - rho_hat = min( max( rho_hat, -0.9999f ), 0.9999f ); - rho = min( max( rho, -0.9999f ), 0.9999f ); - - // Compute decorrelator gain : gd2 = 0; - gd = 0; - gd2 = 0; - - aa = ( sigma_d * sigma_d ) * ( ( rho_hat * rho_hat ) - 1 ) + EPSILON; - bb = -( rho_hat * rho_hat ) * sigma_d * ( cov_oo_norm_re[0][0] + cov_oo_norm_re[1][1] ); - cc = ( rho_hat * rho_hat ) * cov_oo_norm_re[0][0] * cov_oo_norm_re[1][1]; - cc -= cov_oo_norm_re[0][1] * cov_oo_norm_re[0][1]; - - sign = +1.0f; - if ( rho < ( rho_hat - 0.0001 ) ) - { - bb -= 2 * sigma_d * cov_oo_norm_re[0][1]; - sign = -1.0f; - } - else if ( rho > ( rho_hat + 0.0001 ) ) - { - bb += 2 * sigma_d * cov_oo_norm_re[0][1]; - } - dd = bb * bb - ( 4 * aa * cc ); - if ( dd >= 0 ) - { - float gd2_1, gd2_2; - gd2_1 = ( -bb + sqrtf( dd ) ) / ( 2 * aa ); - gd2_2 = ( -bb - sqrtf( dd ) ) / ( 2 * aa ); - if ( ( gd2_1 >= 0 ) && ( gd2_2 >= 0 ) ) - { - gd2 = min( gd2_1, gd2_2 ); - } - else - { - gd2 = max( 0, max( gd2_1, gd2_2 ) ); - } - gd = sign * sqrtf( gd2 ); - } - - gd = min( IVAS_SPLIT_REND_D_MAX_VAL, max( gd, IVAS_SPLIT_REND_D_MIN_VAL ) ); - hMd->gd = SPLIT_REND_DECOR_ALPHA * gd + ( 1 - SPLIT_REND_DECOR_ALPHA ) * hMd->gd; - gd2 = min( gd2, cov_oo_norm_re[0][0] / sigma_d ); - gd2 = min( gd2, cov_oo_norm_re[1][1] / sigma_d ); - } -#endif /* 0 */ if ( postpred_cov_re[0][0] > EPSILON ) { @@ -1457,17 +1397,6 @@ void ivas_rend_CldfbSplitPreRendProcess( QuaternionsPost[sf_idx].z = 0.0f; } -#if 0 - read_off = pBits->bits_read; - write_off = pBits->bits_written; - ivas_splitBinPostRendMdDec( - pBits, - hBinHrSplitPreRend->hBinHrSplitPostRend, - pMultiBinPoseData ); - pMultiBinPoseData->poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; - pBits->bits_read = read_off; - pBits->bits_written = write_off; -#else hBinHrSplitPreRend->hBinHrSplitPostRend->low_Res = 1; set_fix_rotation_mat( hBinHrSplitPreRend->hBinHrSplitPostRend->fix_pos_rot_mat, pMultiBinPoseData ); set_pose_types( hBinHrSplitPreRend->hBinHrSplitPostRend->pose_type, pMultiBinPoseData ); @@ -1486,7 +1415,6 @@ void ivas_rend_CldfbSplitPreRendProcess( for ( b = 0; b < MAX_SPLIT_REND_MD_BANDS; b++ ) { hBinHrSplitPreRend->hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b] = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; -#if 1 BIN_HR_SPLIT_REND_MD_HANDLE hMd; hMd = &hBinHrSplitPreRend->hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; minv = -1.4f; @@ -1523,12 +1451,10 @@ void ivas_rend_CldfbSplitPreRendProcess( hMd->pred_mat_im[ch1][ch2] = quant_val * step; } } -#endif } } } -#endif for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) { mvr2r( (float *) Cldfb_In_BinReal[0][sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES], (float *) Cldfb_RealBuffer_Binaural_5ms[0], MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX ); @@ -1795,39 +1721,18 @@ void ivas_init_split_rend_handles( * *------------------------------------------------------------------------*/ -#ifdef SPLIT_REND_LCLD_5MS static ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWrapper, const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int32_t OutSampleRate, const int16_t num_subframes ) -#else -static ivas_error split_renderer_open_lc3plus( - SPLIT_REND_WRAPPER *hSplitRendWrapper, - const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, - const int32_t OutSampleRate, - const int16_t is_5ms_frame ) -#endif { ivas_error error; int16_t i, delayBufferLength; LC3PLUS_CONFIG config; -#ifdef SPLIT_REND_LCLD_5MS config.lc3plus_frame_duration_us = pSplitRendConfig->codec_frame_size_ms * 1000; config.ivas_frame_duration_us = ( pSplitRendConfig->dof == 0 ) ? config.lc3plus_frame_duration_us * num_subframes : 20000; -#else - if ( is_5ms_frame ) - { - config.lc3plus_frame_duration_us = pSplitRendConfig->codec_frame_size_ms * 1000; - config.ivas_frame_duration_us = ( pSplitRendConfig->dof == 0 ) ? config.lc3plus_frame_duration_us : 20000; - } - else - { - config.lc3plus_frame_duration_us = 5000; - config.ivas_frame_duration_us = 20000; - } -#endif config.samplerate = OutSampleRate; config.channels = BINAURAL_CHANNELS; @@ -1885,7 +1790,6 @@ static ivas_error split_renderer_open_lc3plus( * *------------------------------------------------------------------------*/ -#ifdef SPLIT_REND_LCLD_5MS ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, @@ -1893,15 +1797,6 @@ ivas_error ivas_split_renderer_open( const int16_t cldfb_in_flag, const int16_t pcm_out_flag, const int16_t num_subframes ) -#else -ivas_error ivas_split_renderer_open( - SPLIT_REND_WRAPPER *hSplitRendWrapper, - const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, - const int32_t OutSampleRate, - const int16_t cldfb_in_flag, - const int16_t pcm_out_flag, - const int16_t is_5ms_frame ) -#endif { ivas_error error, ch, num_ch; #ifndef SPLIT_REND_WITH_HEAD_ROT @@ -2008,21 +1903,13 @@ ivas_error ivas_split_renderer_open( { if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS ) { -#ifdef SPLIT_REND_LCLD_5MS if ( ( error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate, num_subframes ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate, is_5ms_frame ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } else { -#ifdef SPLIT_REND_LCLD_5MS int16_t iNumBlocksPerFrame; iNumBlocksPerFrame = ( CLDFB_NO_COL_MAX * pSplitRendConfig->codec_frame_size_ms ) / 20; @@ -2030,12 +1917,6 @@ ivas_error ivas_split_renderer_open( { return error; } -#else - if ( ( error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, BINAURAL_CHANNELS, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate, hSplitRendWrapper->multiBinPoseData.poseCorrectionMode ) ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } } @@ -2195,9 +2076,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( uint8_t useLc3plus; float *in_delayed[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS]; int16_t i; -#ifdef SPLIT_REND_LCLD_5MS int32_t num_slots; -#endif push_wmops( "ivas_renderMultiTDBinToSplitBinaural" ); @@ -2230,14 +2109,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( actual_md_bits = pBits->bits_written; if ( ( hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) || ( !useLc3plus && !pcm_out_flag ) ) { -#ifndef SPLIT_REND_LCLD_5MS - if ( !useLc3plus && codec_frame_size_ms != 20 && !pcm_out_flag ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_INPUT_BUFFER_SIZE, "Unsupported framing for LCLD codec!" ); - } -#else num_slots = ( hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) ? CLDFB_NO_COL_MAX : ( hSplitBin->hSplitBinLCLDEnc->iNumBlocks * hSplitBin->hSplitBinLCLDEnc->iNumIterations ); -#endif num_cldfb_bands = hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels; /* CLDFB Analysis*/ @@ -2261,11 +2133,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( #endif for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { -#ifdef SPLIT_REND_LCLD_5MS for ( slot_idx = 0; slot_idx < num_slots; slot_idx++ ) -#else - for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) -#endif { cldfbAnalysis_ts( &( in_delayed[pos_idx * BINAURAL_CHANNELS + ch][num_cldfb_bands * slot_idx] ), Cldfb_In_BinReal[pos_idx * BINAURAL_CHANNELS + ch][slot_idx], Cldfb_In_BinImag[pos_idx * BINAURAL_CHANNELS + ch][slot_idx], @@ -2291,17 +2159,10 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( if ( !useLc3plus ) { -#ifdef SPLIT_REND_LCLD_5MS available_bits = ( SplitRendBitRate * hSplitBin->hSplitBinLCLDEnc->iNumBlocks * hSplitBin->hSplitBinLCLDEnc->iNumIterations ) / ( 16 * FRAMES_PER_SEC ); actual_md_bits = pBits->bits_written - actual_md_bits; available_bits -= actual_md_bits; pBits->codec_frame_size_ms = codec_frame_size_ms; -#else - available_bits = SplitRendBitRate * L_FRAME48k / 48000; - actual_md_bits = pBits->bits_written - actual_md_bits; - available_bits -= actual_md_bits; - pBits->codec_frame_size_ms = 20; -#endif ivas_splitBinLCLDEncProcess( hSplitBin->hSplitBinLCLDEnc, Cldfb_In_BinReal, Cldfb_In_BinImag, available_bits, pBits ); } @@ -2328,11 +2189,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( { if ( !useLc3plus ) { -#ifdef SPLIT_REND_LCLD_5MS bit_len = ( SplitRendBitRate * hSplitBin->hSplitBinLCLDEnc->iNumBlocks * hSplitBin->hSplitBinLCLDEnc->iNumIterations ) / ( 16 * FRAMES_PER_SEC ); -#else - bit_len = SplitRendBitRate / FRAMES_PER_SEC; -#endif } else { @@ -2451,17 +2308,10 @@ ivas_error ivas_renderMultiBinToSplitBinaural( /* 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 */ -#ifdef SPLIT_REND_LCLD_5MS if ( ( error = ivas_split_rend_choose_default_codec( &splitCodec, &codec_frame_size_ms, cldfb_in_flag, pcm_out_flag, 0 ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = ivas_split_rend_choose_default_codec( &splitCodec, &codec_frame_size_ms, cldfb_in_flag, pcm_out_flag ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif if ( cldfb_in_flag == 0 ) @@ -2497,38 +2347,24 @@ ivas_error ivas_renderMultiBinToSplitBinaural( if ( splitCodec == IVAS_SPLIT_REND_CODEC_LCLD ) { -#ifdef SPLIT_REND_LCLD_5MS available_bits = ( SplitRendBitRate * hSplitBin->hSplitBinLCLDEnc->iNumBlocks * hSplitBin->hSplitBinLCLDEnc->iNumIterations ) / ( 16 * FRAMES_PER_SEC ); actual_md_bits = pBits->bits_written - actual_md_bits; available_bits -= actual_md_bits; pBits->codec_frame_size_ms = codec_frame_size_ms; -#else - available_bits = SplitRendBitRate * L_FRAME48k / 48000; - actual_md_bits = pBits->bits_written - actual_md_bits; - available_bits -= actual_md_bits; -#endif ivas_splitBinLCLDEncProcess( hSplitBin->hSplitBinLCLDEnc, Cldfb_In_BinReal, Cldfb_In_BinImag, available_bits, pBits ); } else { -#ifdef SPLIT_REND_LCLD_5MS int16_t ch, slot_idx, num_slots, ivas_fs; ivas_fs = (int16_t) hSplitBin->hLc3plusEnc->config.ivas_frame_duration_us / 1000; num_slots = (int16_t) ( CLDFB_NO_COL_MAX * ivas_fs ) / 20; -#else - int16_t ch, slot_idx; -#endif /* CLDFB synthesis of main pose */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { float *Cldfb_In_BinReal_p[CLDFB_NO_COL_MAX]; float *Cldfb_In_BinImag_p[CLDFB_NO_COL_MAX]; -#ifdef SPLIT_REND_LCLD_5MS for ( slot_idx = 0; slot_idx < num_slots; slot_idx++ ) -#else - for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) -#endif { Cldfb_In_BinReal_p[slot_idx] = Cldfb_In_BinReal[ch][slot_idx]; Cldfb_In_BinImag_p[slot_idx] = Cldfb_In_BinImag[ch][slot_idx]; @@ -2536,11 +2372,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural( #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 -#ifdef SPLIT_REND_LCLD_5MS cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, output[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * num_slots, hSplitBin->hCldfbHandles->cldfbSyn[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 #endif } @@ -2585,11 +2417,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural( { if ( splitCodec == IVAS_SPLIT_REND_CODEC_LCLD ) { -#ifdef SPLIT_REND_LCLD_5MS bit_len = ( SplitRendBitRate * hSplitBin->hSplitBinLCLDEnc->iNumBlocks * hSplitBin->hSplitBinLCLDEnc->iNumIterations ) / ( 16 * FRAMES_PER_SEC ); -#else - bit_len = SplitRendBitRate / FRAMES_PER_SEC; -#endif } else { diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index c330a63f881406d02751fadba9b1fcb546a193a6..da9ba62801bda41292f9cdcb08695b481fd19de4 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -724,11 +724,7 @@ ivas_error ivas_split_rend_validate_config( if ( pSplitRendConfig->codec_frame_size_ms != 0 ) /* 0 means "default for current codec", will be set to actual value at a later stage */ { -#ifdef SPLIT_REND_LCLD_5MS if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LCLD && pSplitRendConfig->codec_frame_size_ms != 5 && pSplitRendConfig->codec_frame_size_ms != 10 && pSplitRendConfig->codec_frame_size_ms != 20 ) -#else - if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LCLD && pSplitRendConfig->codec_frame_size_ms != 20 ) -#endif { return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Invalid framing for LCLD codec" ); } @@ -1053,7 +1049,6 @@ void ivas_init_multi_bin_pose_data( * *------------------------------------------------------------------------*/ -#ifdef SPLIT_REND_LCLD_5MS ivas_error ivas_split_rend_choose_default_codec( IVAS_SPLIT_REND_CODEC *pCodec, /* i/o: pointer to codec setting */ int16_t *pCodec_frame_size_ms, /* i/o: pointer to codec frame size setting */ @@ -1061,14 +1056,6 @@ ivas_error ivas_split_rend_choose_default_codec( const int16_t pcm_out_flag, /* i : flag to indicate PCM output */ const int16_t num_subframes /* i : number of subframes */ ) -#else -ivas_error ivas_split_rend_choose_default_codec( - IVAS_SPLIT_REND_CODEC *pCodec, /* i/o: pointer to codec setting */ - int16_t *pCodec_frame_size_ms, /* i/o: pointer to codec frame size setting */ - const int16_t cldfb_in_flag, /* i : flag indicating rendering in TD */ - const int16_t pcm_out_flag /* i : flag to indicate PCM output */ -) -#endif { if ( pcm_out_flag == 0 ) { @@ -1087,11 +1074,7 @@ ivas_error ivas_split_rend_choose_default_codec( switch ( *pCodec ) { case IVAS_SPLIT_REND_CODEC_LCLD: -#ifdef SPLIT_REND_LCLD_5MS *pCodec_frame_size_ms = num_subframes * 5; -#else - *pCodec_frame_size_ms = 20; -#endif break; case IVAS_SPLIT_REND_CODEC_LC3PLUS: case IVAS_SPLIT_REND_CODEC_NONE: @@ -1106,7 +1089,6 @@ ivas_error ivas_split_rend_choose_default_codec( } #endif -#ifdef SPLIT_REND_LCLD_5MS /*-------------------------------------------------------------------* * Function get_bit() * @@ -1119,4 +1101,3 @@ int32_t get_bit( { return ( state & ( 1 << bit_id ) ); } -#endif diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index d5701c81f630b77b63b821f68765e1f3a2e200ff..516d6a7ee2983e5d756bc012964acd0df6f8849b 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1455,10 +1455,8 @@ typedef struct ivas_binaural_head_rot_split_rendering_lcld_enc_struct FILE *cldfbIn; int16_t numFrame; #endif -#ifdef SPLIT_REND_LCLD_5MS int16_t iNumIterations; int16_t iNumBlocks; -#endif } BIN_HR_SPLIT_LCLD_ENC, *BIN_HR_SPLIT_LCLD_ENC_HANDLE; @@ -1492,10 +1490,8 @@ typedef struct ivas_binaural_head_rot_split_rendering_lcld_dec_struct int16_t numFrame; #endif SPLIT_REND_PLC_HANDLE hSplitRendPLC; -#ifdef SPLIT_REND_LCLD_5MS int16_t iNumBlocks; int16_t iNumIterations; -#endif } BIN_HR_SPLIT_LCLD_DEC, *BIN_HR_SPLIT_LCLD_DEC_HANDLE; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index fec022e19f60f1e22da841d0b623a7f9310f54b2..cef748044357a1c2dfbf270baf8609cd369c808b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3041,7 +3041,6 @@ static void clearInputMasa( } #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef SPLIT_REND_LCLD_5MS static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer, @@ -3051,17 +3050,6 @@ static ivas_error initSplitRend( const AUDIO_CONFIG outConfig, const int16_t cldfb_in_flag, const int16_t num_subframes ) -#else -static ivas_error initSplitRend( - SPLIT_REND_WRAPPER *pSplitRendWrapper, - IVAS_REND_AudioBuffer *pSplitRendEncBuffer, - const IVAS_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 is_5ms_frame ) -#endif { ivas_error error; IVAS_REND_AudioBufferConfig bufConfig; @@ -3077,17 +3065,10 @@ static ivas_error initSplitRend( ivas_renderSplitUpdateNoCorrectionPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData ); } -#ifdef SPLIT_REND_LCLD_5MS if ( ( error = ivas_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; } -#else - if ( ( error = ivas_split_renderer_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in_flag, outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, is_5ms_frame ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif /*allocate for CLDFB in and change to TD during process if needed*/ bufConfig.numSamplesPerChannel = MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL; @@ -3811,7 +3792,6 @@ ivas_error IVAS_REND_AddInput( int16_t cldfb_in_flag; cldfb_in_flag = getCldfbRendFlag( hIvasRend, getAudioConfigType( inConfig ) ); -#ifdef SPLIT_REND_LCLD_5MS if ( ( error = ivas_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; @@ -3821,17 +3801,6 @@ ivas_error IVAS_REND_AddInput( { return error; } -#else - if ( ( error = ivas_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 ) ) != 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 == 1 ) ? 1 : 0 ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } #endif @@ -4308,12 +4277,10 @@ ivas_error IVAS_REND_GetDelay( { latency_ns += IVAS_FB_DEC_DELAY_NS; } -#ifdef SPLIT_REND_LCLD_5MS else if ( hIvasRend->inputsSplitPost[i].splitPostRendWrapper.hSplitBinLCLDDec != NULL ) { latency_ns += IVAS_FB_DEC_DELAY_NS; } -#endif max_latency_ns = max( max_latency_ns, latency_ns ); } } @@ -4705,7 +4672,6 @@ int16_t IVAS_REND_FeedRenderConfig( cldfb_in_flag = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN ); closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); -#ifdef SPLIT_REND_LCLD_5MS if ( ( error = ivas_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; @@ -4715,17 +4681,6 @@ int16_t IVAS_REND_FeedRenderConfig( { return error; } -#else - if ( ( error = ivas_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 ) ) != 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 == 1 ) ? 1 : 0 ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } #endif @@ -6903,10 +6858,8 @@ static ivas_error renderSplitBinauralWithPostRot( int16_t outBufNumSamplesPerChannel, outBufNumColPerChannel; int16_t numSamplesPerChannelCacheSize, numColPerChannelCacheSize; float *readPtr, *writePtr; -#ifdef SPLIT_REND_LCLD_5MS LC3PLUS_CONFIG config; int16_t iNumBlocksPerFrame, iNumLCLDIterationsPerFrame; -#endif isPostRendInputCldfb = 0; push_wmops( "renderSplitBinauralWithPostRot" ); @@ -6916,7 +6869,6 @@ static ivas_error renderSplitBinauralWithPostRot( hSplitBin = &splitBinInput->splitPostRendWrapper; convertBitsBufferToInternalBitsBuff( *splitBinInput->hBits, &bits ); -#ifdef SPLIT_REND_LCLD_5MS config.lc3plus_frame_duration_us = bits.codec_frame_size_ms * 1000; if ( pCombinedOrientationData->num_subframes != MAX_PARAM_SPATIAL_SUBFRAMES ) { @@ -6949,41 +6901,16 @@ static ivas_error renderSplitBinauralWithPostRot( config.channels = BINAURAL_CHANNELS; config.samplerate = *splitBinInput->base.ctx.pOutSampleRate; -#endif if ( bits.codec == IVAS_SPLIT_REND_CODEC_LCLD && splitBinInput->splitPostRendWrapper.hSplitBinLCLDDec == NULL ) { -#ifdef SPLIT_REND_LCLD_5MS if ( ( error = ivas_splitBinLCLDDecOpen( &splitBinInput->splitPostRendWrapper.hSplitBinLCLDDec, *splitBinInput->base.ctx.pOutSampleRate, BINAURAL_CHANNELS, iNumBlocksPerFrame, iNumLCLDIterationsPerFrame ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = ivas_splitBinLCLDDecOpen( &splitBinInput->splitPostRendWrapper.hSplitBinLCLDDec, *splitBinInput->base.ctx.pOutSampleRate, BINAURAL_CHANNELS ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } else if ( bits.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS && splitBinInput->splitPostRendWrapper.hLc3plusDec == NULL ) { -#ifndef SPLIT_REND_LCLD_5MS - LC3PLUS_CONFIG config; - - if ( outAudio.config.numSamplesPerChannel == 240 ) - { - config.lc3plus_frame_duration_us = bits.codec_frame_size_ms * 1000; - config.ivas_frame_duration_us = ( bits.pose_correction == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) ? config.lc3plus_frame_duration_us : 20000; - } - else - { - config.lc3plus_frame_duration_us = 5000; - config.ivas_frame_duration_us = 20000; - } - config.channels = BINAURAL_CHANNELS; - config.samplerate = *splitBinInput->base.ctx.pOutSampleRate; - -#endif if ( ( error = IVAS_LC3PLUS_DEC_Open( config, &splitBinInput->splitPostRendWrapper.hLc3plusDec ) ) != IVAS_ERR_OK ) { @@ -7027,20 +6954,12 @@ static ivas_error renderSplitBinauralWithPostRot( { isPostRendInputCldfb = 1; } -#ifdef SPLIT_REND_LCLD_5MS preRendFrameSize_ms = (int16_t) ( config.ivas_frame_duration_us ) / 1000; -#else - preRendFrameSize_ms = bits.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS ? (int16_t) ( hSplitBin->hLc3plusDec->config.ivas_frame_duration_us ) / 1000 : 20; -#endif numSamplesPerChannelCacheSize = (int16_t) ( *splitBinInput->base.ctx.pOutSampleRate * ( preRendFrameSize_ms - bits.codec_frame_size_ms ) / 1000 ); outBufNumColPerChannel = MAX_PARAM_SPATIAL_SUBFRAMES; -#ifdef SPLIT_REND_LCLD_5MS numColPerChannelCacheSize = ( iNumBlocksPerFrame * iNumLCLDIterationsPerFrame ) - outBufNumColPerChannel; -#else - numColPerChannelCacheSize = CLDFB_NO_COL_MAX - outBufNumColPerChannel; -#endif for ( sf_idx = 0; sf_idx < pCombinedOrientationData->num_subframes; sf_idx++ ) { @@ -7063,11 +6982,7 @@ static ivas_error renderSplitBinauralWithPostRot( /* cache the remaining 15ms */ splitBinInput->numCachedSamples = numColPerChannelCacheSize; writePtr = splitBinInput->bufferData; -#ifdef SPLIT_REND_LCLD_5MS for ( slotIdx = CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; slotIdx < ( iNumBlocksPerFrame * iNumLCLDIterationsPerFrame ); ++slotIdx ) -#else - for ( slotIdx = CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; slotIdx < CLDFB_NO_COL_MAX; ++slotIdx ) -#endif { for ( chnlIdx = 0; chnlIdx < BINAURAL_CHANNELS; ++chnlIdx ) { @@ -7135,7 +7050,6 @@ static ivas_error renderSplitBinauralWithPostRot( else { copyBufferTo2dArray( splitBinInput->base.inputBuffer, tmpCrendBuffer ); -#ifdef SPLIT_REND_LCLD_5MS if ( splitBinInput->numCachedSamples == 0 ) { preRendFrameSize_ms = (int16_t) ( config.ivas_frame_duration_us ) / 1000; @@ -7147,7 +7061,6 @@ static ivas_error renderSplitBinauralWithPostRot( { splitBinInput->numCachedSamples -= outAudio.config.numSamplesPerChannel; } -#endif } /* apply pose correction if enabled */ @@ -8512,18 +8425,10 @@ ivas_error IVAS_REND_GetSplitBinauralBitstream( cldfb_in_flag = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN ); hIvasRend->splitRendEncBuffer.config.is_cldfb = cldfb_in_flag; -#ifdef SPLIT_REND_LCLD_5MS if ( hIvasRend->hRendererConfig->split_rend_config.dof == 0 || hIvasRend->hRendererConfig->split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) { hIvasRend->splitRendEncBuffer.config.numSamplesPerChannel = outAudio.config.numSamplesPerChannel; } -#else - if ( hIvasRend->hRendererConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS && - ( hIvasRend->hRendererConfig->split_rend_config.dof == 0 || hIvasRend->hRendererConfig->split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) ) - { - hIvasRend->splitRendEncBuffer.config.numSamplesPerChannel = hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms * hIvasRend->num_subframes * (int16_t) ( hIvasRend->sampleRateOut / 1000 ); - } -#endif else { hIvasRend->splitRendEncBuffer.config.numSamplesPerChannel = (int16_t) ( hIvasRend->sampleRateOut / FRAMES_PER_SEC );