diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 20a85f9aa8811d92ec0fce52795170792d17d748..1ef95583c37274d4d13a7001987fd5467bffd361 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -312,7 +312,7 @@ void stereo_dmx_evs_close_encoder( ivas_error ivas_dec( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ -#ifdef SPLIT_REND_WITH_HEAD_ROT +#if( defined SPLIT_REND_WITH_HEAD_ROT && !defined NONBE_UNIFIED_DECODING_PATHS_FIX ) const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -3726,13 +3726,14 @@ void ivas_dirac_dec_set_md_map( const int16_t nCldfbTs /* i : number of CLDFB time slots */ ); +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX void ivas_dirac_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_transport, /* i : number of transport channels */ const int16_t num_subframes /* i : number of subframes to render */ ); - +#endif void ivas_dirac_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const int16_t nchan_transport, /* i : number of transport channels */ @@ -3814,11 +3815,12 @@ void ivas_mc_paramupmix_enc_close( const int32_t input_Fs /* i : input sampling rate */ ); +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX void ivas_mc_paramupmix_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ); - +#endif ivas_error ivas_mc_paramupmix_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); @@ -4178,12 +4180,13 @@ void ivas_spar_config( const int16_t sid_format /* i : IVAS format indicator from SID frame */ ); +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX ivas_error ivas_sba_upmixer_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ float *output[], /* i/o: transport/output audio channels */ const int16_t output_frame /* i : output frame length */ ); - +#endif ivas_error ivas_sba_linear_renderer( float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t output_frame, /* i : output frame length per channel */ @@ -5296,12 +5299,13 @@ void ivas_ism_renderer_close( ISM_RENDERER_HANDLE *hIsmRendererData /* i/o: ISM renderer handle */ ); +#ifndef NONBE_UNIFIED_DECODING_PATHS void ivas_ism_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output_f[], /* i/o: core-coder transport channels/object output */ const int16_t output_frame /* i : output frame length per channel */ ); - +#endif void ivas_ism_render_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output_f[], /* i/o: core-coder transport channels/object output */ @@ -5334,6 +5338,7 @@ void ivas_param_mc_mc2sba_cldfb( const float gain_lfe /* i : gain applied to LFE */ ); +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX void ivas_ism2sba( float *buffer_td[], /* i/o: TD signal buffers */ ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ @@ -5343,6 +5348,7 @@ void ivas_ism2sba( const int16_t sba_order /* i : SBA order */ ); +#endif void ivas_ism2sba_sf( float *buffer_in[], /* i : TC buffer */ float *buffer_out[], /* o : TD signal buffers */ @@ -5691,11 +5697,13 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( float *output_f[] /* o : rendered time signal */ ); +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX ivas_error ivas_osba_dirac_td_binaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output[], /* o : output synthesis signal */ const int16_t output_frame /* i : output frame length per channel */ ); +#endif ivas_error ivas_osba_ism_metadata_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -5704,11 +5712,21 @@ ivas_error ivas_osba_ism_metadata_dec( int16_t nb_bits_metadata[] /* o : number of ISM metadata bits */ ); +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX +ivas_error ivas_osba_render_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ + float *output_f[] /* o : rendered time signal */ +); +#else ivas_error ivas_osba_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output_f[], /* i/o: core-coder transport channels/object output */ const int16_t output_frame /* i : output frame length per channel */ ); +#endif void ivas_osba_data_close( SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ @@ -5847,12 +5865,13 @@ ivas_error ivas_omasa_ism_metadata_dec( int16_t nb_bits_metadata[] /* o : number of ISM metadata bits */ ); +#ifndef NONBE_UNIFIED_DECODING_PATHS ivas_error ivas_omasa_dirac_td_binaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output[], /* o : output synthesis signal */ const int16_t output_frame /* i : output frame length per channel */ ); - +#endif ivas_error ivas_omasa_dirac_td_binaural_jbm( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of samples requested */ @@ -5862,12 +5881,14 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( float *output_f[] /* o : rendered time signal */ ); +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX void ivas_omasa_dirac_rend( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output[], /* o : output synthesis signal */ const int16_t output_frame /* i : output frame length per channel */ ); +#endif void ivas_omasa_rearrange_channels( float *output[], /* o : output synthesis signal */ const int16_t nchan_transport_ism, /* i : number of ISM TCs */ @@ -5899,6 +5920,7 @@ void ivas_omasa_separate_object_renderer_close( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX void ivas_omasa_separate_object_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float input_f[][L_FRAME48k], /* i : separated object signal */ @@ -5906,9 +5928,13 @@ void ivas_omasa_separate_object_render( const int16_t output_frame /* i : output frame length per channel */ ); +#endif void ivas_omasa_separate_object_render_jbm( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const uint16_t nSamplesRendered, /* i : number of samples rendered */ +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + float input_f[][L_FRAME48k], /* i : separated object signal */ +#endif float *output_f[], /* o : rendered time signal */ const int16_t subframes_rendered, /* i : number of subframes rendered */ const int16_t slots_rendered /* i : number of CLDFB slots rendered */ @@ -5931,7 +5957,7 @@ void ivas_omasa_decode_masa_to_total( ); void ivas_omasa_modify_masa_energy_ratios( - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_MAXIMUM_CODING_SUBBANDS] ); diff --git a/lib_com/options.h b/lib_com/options.h old mode 100755 new mode 100644 index c8eb019c5bc5759d6e49d2fe527bae2bd0fec653..801fd7ed9eed71713524ff84b2f52ed68104faf9 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,6 +163,10 @@ #define NONBE_FIX_856_TCX_LTP_SYNTH_FILTER /* FhG: issue 856: correct filtering length for tcx-ltp synth filtering*/ #define NONBE_UNIFIED_DECODING_PATHS /* FhG: unify decoding paths */ +#ifdef NONBE_UNIFIED_DECODING_PATHS +#define NONBE_UNIFIED_DECODING_PATHS_FIX /* VA: issue 876: fixes within NONBE_UNIFIED_DECODING_PATHS */ +#endif +#define NONBE_FIX_874_OMASA_BRSW_2TD /* Nokia: issue 874: Fixes the crashes with the long test vectors that prompted switching to TD*/ #define NONBE_FIX_871_ACELP_CRASH_IN_OSBA /* FhG: isse 871: crash in ACELP core encoder with OSBA */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index bf25c6cbefbd8c3e65eec40486fae123a599f569..a936cf5a628b83687c32fcee1cb48a847a68409c 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -51,8 +51,21 @@ * Principal IVAS decoder routine *--------------------------------------------------------------------------*/ +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX ivas_error ivas_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + int16_t *data /* o : output synthesis signal */ +) +{ + // TODO: move here function ivas_jbm_dec_tc() and rename it to ivas_dec() + st_ivas->ivas_format = UNDEFINED_FORMAT; // temp. to avoid compilation warnings + data[0] = 0; // temp. to avoid compilation warnings + + return IVAS_ERR_OK; +} +#else +ivas_error ivas_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ #ifdef SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ @@ -1163,3 +1176,4 @@ ivas_error ivas_dec( pop_wmops(); return IVAS_ERR_OK; } +#endif diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 9d66a9172bf3dd009e5786fadd1244b6552ccc42..25fc8d99fef5ee2e36f8034a71d45c1ebf2a3119 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1590,7 +1590,7 @@ void ivas_dirac_dec_set_md_map( return; } - +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX /*------------------------------------------------------------------------- * ivas_dirac_dec() * @@ -1669,7 +1669,7 @@ void ivas_dirac_dec( return; } - +#endif /*------------------------------------------------------------------------- * ivas_dirac_dec_render() @@ -1690,6 +1690,9 @@ void ivas_dirac_dec_render( uint16_t slot_size, n_samples_sf, ch, nchan_intern; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; float *output_f_local[MAX_OUTPUT_CHANNELS]; +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + float output_f_local_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; // VE2SB: TBV +#endif hSpatParamRendCom = st_ivas->hSpatParamRendCom; @@ -1699,7 +1702,12 @@ void ivas_dirac_dec_render( #endif for ( ch = 0; ch < nchan_intern; ch++ ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + output_f_local[ch] = output_f_local_buff[ch]; + set_zero( output_f_local_buff[ch], nSamplesAsked ); +#else output_f_local[ch] = output_f[ch]; +#endif } slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); @@ -1733,6 +1741,16 @@ void ivas_dirac_dec_render( #endif } +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + for ( ch = 0; ch < nchan_intern; ch++ ) + { + if ( !( ( st_ivas->hDirACRend->hOutSetup.separateChannelEnabled ) && ( st_ivas->hDirACRend->hOutSetup.separateChannelIndex == ch || st_ivas->hDirACRend->hOutSetup.separateChannelIndex + 1 == ch ) ) ) + { + mvr2r( output_f_local_buff[ch], output_f[ch], *nSamplesRendered ); + } + } + +#endif if ( hSpatParamRendCom->slots_rendered == hSpatParamRendCom->num_slots ) { if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) @@ -1752,9 +1770,9 @@ void ivas_dirac_dec_render( /*------------------------------------------------------------------------- - * ivas_dirac_dec() + * ivas_dirac_dec_render_sf() * - * DirAC decoding process + * DirAC decoding renderer process *------------------------------------------------------------------------*/ void ivas_dirac_dec_render_sf( diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 94060ae8ef99c1e0ab030449636fdd53370ff561..63c8f47d2ce2c995156e57e4dc1aebfc18b30faa 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -132,7 +132,7 @@ void ivas_ism_renderer_close( return; } - +#ifndef NONBE_UNIFIED_DECODING_PATHS /*-------------------------------------------------------------------------* * ivas_ism_render() * @@ -233,7 +233,7 @@ void ivas_ism_render( return; } - +#endif /*-------------------------------------------------------------------------* * ivas_ism_render_sf() @@ -254,6 +254,10 @@ void ivas_ism_render_sf( int16_t tc_offset; int16_t interp_offset; float gain, prev_gain; +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + float tc_local[MAX_NUM_OBJECTS][L_FRAME48k]; + float *p_tc[MAX_NUM_OBJECTS]; +#endif num_objects = st_ivas->nchan_transport; if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) @@ -266,6 +270,23 @@ void ivas_ism_render_sf( tc_offset = st_ivas->hTcBuffer->n_samples_rendered; interp_offset = st_ivas->hTcBuffer->n_samples_rendered; +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( st_ivas->hDecoderConfig->Opt_tsm ) + { + for ( i = 0; i < num_objects; i++ ) + { + p_tc[i] = &st_ivas->hTcBuffer->tc[i][tc_offset]; + } + } + else + { + for ( i = 0; i < num_objects; i++ ) + { + mvr2r( &output_f[i][tc_offset], tc_local[i], n_samples_to_render ); + p_tc[i] = tc_local[i]; + } + } +#endif for ( i = 0; i < nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; i++ ) { @@ -312,7 +333,11 @@ void ivas_ism_render_sf( if ( fabsf( gain ) > 0.0f || fabsf( prev_gain ) > 0.0f ) { g1 = &st_ivas->hIsmRendererData->interpolator[interp_offset]; +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + tc = p_tc[i]; +#else tc = &st_ivas->hTcBuffer->tc[i][tc_offset]; +#endif for ( k = 0; k < n_samples_to_render; k++ ) { g2 = 1.0f - *g1; @@ -487,7 +512,7 @@ void ivas_omasa_separate_object_renderer_close( return; } - +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX /*-------------------------------------------------------------------------* * ivas_omasa_separate_object_render() * @@ -598,7 +623,7 @@ void ivas_omasa_separate_object_render( return; } - +#endif /*-------------------------------------------------------------------------* * ivas_omasa_separate_object_render_jbm() @@ -607,8 +632,11 @@ void ivas_omasa_separate_object_render( *-------------------------------------------------------------------------*/ void ivas_omasa_separate_object_render_jbm( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const uint16_t nSamplesRendered, /* i : number of samples rendered */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const uint16_t nSamplesRendered, /* i : number of samples rendered */ +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + float input_f_in[][L_FRAME48k], /* i : separated object signal */ +#endif float *output_f[], /* o : rendered time signal */ const int16_t subframes_rendered, /* i : number of subframes rendered */ const int16_t slots_rendered /* i : number of CLDFB slots rendered */ @@ -658,10 +686,26 @@ void ivas_omasa_separate_object_render_jbm( { output_f_local[j] = output_f[j]; } - for ( obj = 0; obj < num_objects; obj++ ) + +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( st_ivas->hDecoderConfig->Opt_tsm ) { - input_f[obj] = &st_ivas->hTcBuffer->tc[obj + 2][offsetSamples]; +#endif + for ( obj = 0; obj < num_objects; obj++ ) + { + input_f[obj] = &st_ivas->hTcBuffer->tc[obj + 2][offsetSamples]; + } +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + } + else + { + for ( obj = 0; obj < num_objects; obj++ ) + { + input_f[obj] = input_f_in[obj]; + } } +#endif + slots_to_render = nSamplesRendered / hSpatParamRendCom->slot_size; first_sf = subframes_rendered; last_sf = first_sf; diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index d1e6fda06038e72b71749a779ea8de7915140ba8..d3f1bdf0bcbb4e4cac6ff588bb455ba86fe810c5 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -71,9 +71,11 @@ ivas_error ivas_jbm_dec_tc( ) { int16_t n, output_frame, nchan_out; - Decoder_State *st; /* used for bitstream handling */ - float *p_output[MAX_TRANSPORT_CHANNELS]; /* 'float' buffer for output synthesis */ + Decoder_State *st; /* used for bitstream handling */ + float *p_output[MAX_TRANSPORT_CHANNELS]; /* 'float' buffer for output synthesis */ +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX float output_f[MAX_TRANSPORT_CHANNELS][L_FRAME48k]; /* TODO: can be allocated dynamically using st_ivas->p_output_f */ +#endif int16_t nchan_remapped; int16_t nb_bits_metadata[MAX_SCE + 1]; int32_t output_Fs, ivas_total_brate; @@ -97,9 +99,27 @@ ivas_error ivas_jbm_dec_tc( for ( n = 0; n < MAX_TRANSPORT_CHANNELS; n++ ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + p_output[n] = st_ivas->p_output_f[n]; + if ( p_output[n] != NULL ) + { + set_zero( p_output[n], L_FRAME48k ); + } +#else p_output[n] = output_f[n]; +#endif + } + +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( !st_ivas->hDecoderConfig->Opt_tsm ) + { + for ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) + { + st_ivas->hTcBuffer->tc[n] = st_ivas->p_output_f[n]; + } } +#endif /*----------------------------------------------------------------* * Decoding + pre-rendering *----------------------------------------------------------------*/ @@ -937,7 +957,9 @@ ivas_error ivas_jbm_dec_render( { int16_t n, nchan_out; int16_t nchan_transport; +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX float output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][L_FRAME48k]; /* 'float' buffer for output synthesis */ +#endif int16_t nchan_remapped; int32_t output_Fs; AUDIO_CONFIG output_config; @@ -962,16 +984,38 @@ ivas_error ivas_jbm_dec_render( output_config = st_ivas->hDecoderConfig->output_config; nSamplesAskedLocal = nSamplesAsked + st_ivas->hTcBuffer->n_samples_discard; - for ( n = 0; n < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; n++ ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + p_output[n] = st_ivas->p_output_f[n]; +#else p_output[n] = &output[n][0]; +#endif } - for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( !st_ivas->hDecoderConfig->Opt_tsm ) + { + for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) + { + p_tc[n] = p_output[n]; + } + + for ( n = 0; n < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; n++ ) + { + st_ivas->hTcBuffer->tc[n] = p_output[n]; + } + } + else { - p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered]; +#endif + for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) + { + p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered]; + } +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX } +#endif #ifndef NONBE_UNIFIED_DECODING_PATHS /*----------------------------------------------------------------* @@ -1136,7 +1180,7 @@ ivas_error ivas_jbm_dec_render( ivas_dirac_dec_render( st_ivas, nchan_remapped, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); } } - else /* SBA_MODE_SPAR */ + else { if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) { @@ -1185,10 +1229,21 @@ ivas_error ivas_jbm_dec_render( { *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + /* shift SBA channels to avoid overwrite by ISM upmix in 1 object case and non-TSM unified channel memory*/ + if ( st_ivas->nchan_ism == 1 && st_ivas->hDecoderConfig->Opt_tsm == 0 ) + { + mvr2r( p_tc[2], p_output[3], *nSamplesRendered ); + mvr2r( p_tc[1], p_output[2], *nSamplesRendered ); + p_tc[1] = p_output[2]; + p_tc[2] = p_output[3]; + } +#endif + /* render objects */ ivas_ism_render_sf( st_ivas, p_output, *nSamplesRendered ); - /* add already rendererd SBA part */ + /* add already rendered SBA part */ for ( n = 0; n < nchan_out; n++ ) { v_add( p_output[n], p_tc[n + st_ivas->nchan_ism], p_output[n], *nSamplesRendered ); @@ -1196,6 +1251,12 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->renderer_type == RENDERER_OSBA_AMBI || st_ivas->renderer_type == RENDERER_OSBA_LS || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( ( error = ivas_osba_render_sf( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) + { + return error; + } +#else float output_ism[MAX_OUTPUT_CHANNELS][L_FRAME48k]; float *p_output_ism[MAX_OUTPUT_CHANNELS]; @@ -1221,6 +1282,7 @@ ivas_error ivas_jbm_dec_render( } v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); } +#endif } else if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) /*EXT output = individual objects + HOA3*/ { @@ -1246,7 +1308,7 @@ ivas_error ivas_jbm_dec_render( { ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output ); } - else /* SBA_MODE_SPAR */ + else { if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) { @@ -1260,11 +1322,19 @@ ivas_error ivas_jbm_dec_render( #endif for ( n = st_ivas->hIntSetup.nchan_out_woLFE - 1; n >= 0; n-- ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + mvr2r( p_output[n], p_output[n + st_ivas->nchan_ism], *nSamplesRendered ); +#else mvr2r( output[n], output[n + st_ivas->nchan_ism], *nSamplesRendered ); +#endif } for ( n = 0; n < st_ivas->nchan_ism; n++ ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + set_zero( p_output[n], *nSamplesRendered ); +#else set_zero( output[n], *nSamplesRendered ); +#endif } } } @@ -1421,15 +1491,24 @@ ivas_error ivas_jbm_dec_render( /* we still need to copy the separate channel if available */ if ( st_ivas->hOutSetup.separateChannelEnabled ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); +#else mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); +#endif } + ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f ); } else if ( st_ivas->intern_config == IVAS_AUDIO_CONFIG_5_1 && ( output_config == IVAS_AUDIO_CONFIG_5_1_2 || output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1 ) ) { for ( n = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; n < st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; n++ ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + set_zero( p_output[n], *nSamplesRendered ); +#else set_zero( output[n], *nSamplesRendered ); +#endif } } } @@ -1441,13 +1520,22 @@ ivas_error ivas_jbm_dec_render( output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1_4 || output_config == IVAS_AUDIO_CONFIG_5_1_2 || ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe > 0 ) ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL] + offset, p_output[LFE_CHANNEL], *nSamplesRendered ); + mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); +#else mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL] + offset, output[LFE_CHANNEL], *nSamplesRendered ); mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); +#endif } else if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe == 0 ) { /* Delay the separated channel to sync with the DirAC rendering */ +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); +#else mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); +#endif } } } @@ -1469,7 +1557,11 @@ ivas_error ivas_jbm_dec_render( if ( st_ivas->hTcBuffer->n_samples_discard > 0 ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + for ( n = 0; n < min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); n++ ) +#else for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) +#endif { p_output[n] += st_ivas->hTcBuffer->n_samples_discard; } @@ -1561,6 +1653,13 @@ ivas_error ivas_jbm_dec_flush_renderer( float output[MAX_CICP_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; float *p_output[MAX_CICP_CHANNELS]; +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( !st_ivas->hDecoderConfig->Opt_tsm ) + { + return IVAS_ERR_OK; + } +#endif + *nSamplesRendered = 0; hTcBuffer = st_ivas->hTcBuffer; @@ -2068,7 +2167,16 @@ int16_t ivas_jbm_dec_get_num_tc_channels( output_config = st_ivas->hDecoderConfig->output_config; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( st_ivas->ivas_format == MONO_FORMAT ) + { + num_tc = st_ivas->hDecoderConfig->nchan_out; + } + else if ( st_ivas->ivas_format == STEREO_FORMAT && st_ivas->hDecoderConfig->nchan_out == 1 ) +#else if ( st_ivas->ivas_format == STEREO_FORMAT && st_ivas->hDecoderConfig->nchan_out == 1 ) +#endif { num_tc = 1; } @@ -2368,27 +2476,38 @@ ivas_error ivas_jbm_dec_tc_buffer_open( } else { - if ( ( hTcBuffer->tc_buffer = (float *) malloc( nsamp_to_allocate * sizeof( float ) ) ) == NULL ) +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( st_ivas->hDecoderConfig->Opt_tsm ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) ); - } - set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate ); +#endif + if ( ( hTcBuffer->tc_buffer = (float *) malloc( nsamp_to_allocate * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) ); + } + set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate ); - offset = 0; - for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) - { - hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; - offset += n_samp_full; - } - for ( ; ch_idx < hTcBuffer->nchan_transport_internal; ch_idx++ ) - { - hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; - offset += n_samp_residual; + offset = 0; + for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) + { + hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; + offset += n_samp_full; + } + for ( ; ch_idx < hTcBuffer->nchan_transport_internal; ch_idx++ ) + { + hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; + offset += n_samp_residual; + } + for ( ; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) + { + hTcBuffer->tc[ch_idx] = NULL; + } +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX } - for ( ; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) + else { - hTcBuffer->tc[ch_idx] = NULL; + hTcBuffer->tc_buffer = NULL; } +#endif } } @@ -2500,27 +2619,38 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( else { #endif - if ( ( hTcBuffer->tc_buffer = (float *) malloc( nsamp_to_allocate * sizeof( float ) ) ) == NULL ) +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( st_ivas->hDecoderConfig->Opt_tsm ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) ); - } - set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate ); +#endif + if ( ( hTcBuffer->tc_buffer = (float *) malloc( nsamp_to_allocate * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) ); + } + set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate ); - offset = 0; - for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) - { - hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; - offset += n_samp_full; - } - for ( ; ch_idx < hTcBuffer->nchan_transport_internal; ch_idx++ ) - { - hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; - offset += n_samp_residual; + offset = 0; + for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) + { + hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; + offset += n_samp_full; + } + for ( ; ch_idx < hTcBuffer->nchan_transport_internal; ch_idx++ ) + { + hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; + offset += n_samp_residual; + } + for ( ; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) + { + hTcBuffer->tc[ch_idx] = NULL; + } +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX } - for ( ; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) + else { - hTcBuffer->tc[ch_idx] = NULL; + hTcBuffer->tc_buffer = NULL; } +#endif #ifdef NONBE_UNIFIED_DECODING_PATHS } #endif @@ -2766,10 +2896,19 @@ void ivas_jbm_dec_copy_tc_no_tsm( n_ch_cldfb = hTcBuffer->nchan_transport_jbm - hTcBuffer->nchan_buffer_full; /* copy full tcs*/ - for ( ch_idx = 0; ch_idx < n_ch_full_copy; ch_idx++ ) +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( st_ivas->hDecoderConfig->Opt_tsm ) { - mvr2r( tc[ch_idx], st_ivas->hTcBuffer->tc[ch_idx], hTcBuffer->n_samples_buffered ); +#endif + for ( ch_idx = 0; ch_idx < n_ch_full_copy; ch_idx++ ) + { + mvr2r( tc[ch_idx], st_ivas->hTcBuffer->tc[ch_idx], hTcBuffer->n_samples_buffered ); + } +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX } + ch_idx = 0; +#endif + /* CLDFB ana for ParamMC/ParamISM */ if ( n_ch_cldfb > 0 ) { diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index bfc9ca3b18f14343463542b0a142329c3bf69e57..57065ed325a34a55963913bddbef4579d8539693 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -64,8 +64,9 @@ const int16_t MC_PARAMUPMIX_CHIDX2[MC_PARAMUPMIX_COMBINATIONS] = { 2, 3, 6, 7 }; * Local function prototypes *-----------------------------------------------------------------------*/ +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX static void ps_pred_process( MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, float qmf_mod_re[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float qmf_mod_im[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float qmf_side_re[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float qmf_side_im[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t ch ); - +#endif 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 ); #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -76,8 +77,9 @@ static void ivas_mc_paramupmix_dec_sf( Decoder_Struct *st_ivas, float *output_f[ static void ivas_param_upmix_dec_decorr_subframes( Decoder_Struct *st_ivas, const int16_t nSamplesForRendering ); +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX static void paramupmix_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr[], float *pcm_in[], float **pp_out_pcm, const int16_t output_frame ); - +#endif static int16_t huff_read( Decoder_State *st, const int16_t ( *ht )[2] ); #ifdef FIX_891_PARAMUPMIX_CLEANUP @@ -182,7 +184,7 @@ void ivas_mc_paramupmix_dec_read_BS( return; } - +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX /*------------------------------------------------------------------------- * ivas_mc_paramupmix_dec() * @@ -474,7 +476,7 @@ void ivas_mc_paramupmix_dec( pop_wmops(); return; } - +#endif /*------------------------------------------------------------------------- * ivas_mc_paramupmix_dec_digest_tc() @@ -581,7 +583,12 @@ void ivas_mc_paramupmix_dec_render( #else ivas_mc_paramupmix_dec_sf( st_ivas, output_f_local ); #endif + +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + for ( ch = 0; ch < min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ) ); ch++ ) +#else for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) +#endif { output_f_local[ch] += n_samples_sf; } @@ -785,7 +792,7 @@ void ivas_mc_paramupmix_dec_close( /*------------------------------------------------------------------------- - * ivas_param_upmix_dec_decorr_subframes() + * paramupmix_td_decorr_process_jbm() * * *------------------------------------------------------------------------*/ @@ -837,6 +844,12 @@ static void paramupmix_td_decorr_process_jbm( } +/*------------------------------------------------------------------------- + * ivas_param_upmix_dec_decorr_subframes() + * + * + *------------------------------------------------------------------------*/ + static void ivas_param_upmix_dec_decorr_subframes( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const int16_t nSamplesForRendering ) @@ -885,7 +898,7 @@ static void ivas_param_upmix_dec_decorr_subframes( /*****************************************************************************************/ /* local functions */ /*****************************************************************************************/ - +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX static void ps_pred_process( MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, float qmf_mod_re[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* in/out */ @@ -948,6 +961,7 @@ static void ps_pred_process( return; } +#endif static void ps_pred_process_sf( MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, @@ -1282,7 +1296,7 @@ static void ivas_mc_paramupmix_dec_sf( return; } - +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX static void paramupmix_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr[], /* i/o: SPAR Covar. decoder handle */ float *pcm_in[], /* i : input audio channels */ @@ -1328,7 +1342,7 @@ static void paramupmix_td_decorr_process( return; } - +#endif static int16_t huff_read( Decoder_State *st, diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index ce71f1307a91dc932642e0a64581cab574bfdf72..a0f522711e8b9985bd1cf760c036c7e506200eb6 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -309,6 +309,9 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural( int16_t original_subframes_rendered; int16_t original_slots_rendered; float *p_bin_output[BINAURAL_CHANNELS]; +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + float output_local[MAX_OUTPUT_CHANNELS][L_FRAME48k]; // VE2SB: TBV +#endif push_wmops( "ivas_td_binaural_renderer_sf_splitBinaural" ); pMultiBinPoseData = &st_ivas->hSplitBinRend.splitrend.multiBinPoseData; @@ -378,7 +381,11 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural( /* set output channels */ for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + p_bin_output[i] = output_local[pos_idx * BINAURAL_CHANNELS + i]; +#else p_bin_output[i] = output[pos_idx * BINAURAL_CHANNELS + i]; +#endif } st_ivas->hTcBuffer->subframes_rendered = original_subframes_rendered; st_ivas->hTcBuffer->slots_rendered = original_slots_rendered; @@ -398,6 +405,12 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural( } } +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + for ( i = 0; i < pMultiBinPoseData->num_poses * BINAURAL_CHANNELS; i++ ) + { + mvr2r( output_local[i], output[i], nSamplesRendered ); + } +#endif /* Restore original head rotation */ for ( i = 0; i < st_ivas->hCombinedOrientationData->num_subframes; ++i ) diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 16f7462ef780c291760e6ca3a7eede706b49225e..daf217575a0334e92e0f682c79dc7f8b3eaa7d0c 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -579,7 +579,7 @@ ivas_error ivas_omasa_ism_metadata_dec( return IVAS_ERR_OK; } - +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX /*--------------------------------------------------------------------------* * ivas_omasa_dirac_rend() * @@ -617,7 +617,7 @@ void ivas_omasa_dirac_rend( return; } - +#endif /*--------------------------------------------------------------------------* * ivas_omasa_dirac_rend_jbm() @@ -636,19 +636,38 @@ void ivas_omasa_dirac_rend_jbm( { int16_t subframes_rendered; int16_t slots_rendered; +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + int16_t n; + float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; + + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + { + mvr2r( output_f[CPE_CHANNELS], data_separated_objects[0], nSamplesAsked ); + } + else + { + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + mvr2r( output_f[n + CPE_CHANNELS], data_separated_objects[n], nSamplesAsked ); + } + } +#endif subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; - ivas_dirac_dec_render( st_ivas, nchan_transport, nSamplesAsked, nSamplesRendered, nSamplesAvailable, output_f ); +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + ivas_omasa_separate_object_render_jbm( st_ivas, *nSamplesRendered, data_separated_objects, output_f, subframes_rendered, slots_rendered ); +#else ivas_omasa_separate_object_render_jbm( st_ivas, *nSamplesRendered, output_f, subframes_rendered, slots_rendered ); +#endif return; } - +#ifndef NONBE_UNIFIED_DECODING_PATHS /*--------------------------------------------------------------------------* * ivas_omasa_dirac_td_binaural() * @@ -702,7 +721,7 @@ ivas_error ivas_omasa_dirac_td_binaural( return IVAS_ERR_OK; } - +#endif /*--------------------------------------------------------------------------* * ivas_omasa_dirac_td_binaural_render() diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 9c8f2a5b86109b357ed9ea949614fd75f13fd2fe..a30ddfb55719dc3a51a43e10469b56eadfa97717 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -134,8 +134,24 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( { int16_t n; ivas_error error; +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + float output_separated_objects[BINAURAL_CHANNELS][L_FRAME48k]; // VE2SB: TBV + float *p_sepobj[BINAURAL_CHANNELS]; + int16_t channel_offset; + + for ( n = 0; n < BINAURAL_CHANNELS; n++ ) + { + p_sepobj[n] = &output_separated_objects[n][0]; + } + + channel_offset = st_ivas->nchan_ism; +#endif +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, &output_f[channel_offset] ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, &output_f[2] ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -183,7 +199,11 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( { #endif - if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, output_f, *nSamplesRendered ) ) != IVAS_ERR_OK ) +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_sepobj, *nSamplesRendered ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, output_f, *nSamplesRendered ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -193,7 +213,11 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( int16_t i; for ( i = 0; i < nSamplesAsked; i++ ) { - output_f[n][i] = 0.5f * output_f[2 + n][i] + 0.5f * output_f[n][i]; +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + output_f[n][i] = 0.5f * output_f[channel_offset + n][i] + 0.5f * p_sepobj[n][i]; +#else + output_f[n][i] = 0.5f * output_f[2 + n][i] + 0.5f * output_f[n][i]; +#endif } } #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -202,7 +226,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( return IVAS_ERR_OK; } - +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX /*--------------------------------------------------------------------------* * ivas_osba_dirac_td_binaural() * @@ -336,7 +360,7 @@ ivas_error ivas_osba_dirac_td_binaural( return IVAS_ERR_OK; } - +#endif /*-------------------------------------------------------------------------* * ivas_osba_ism_metadata_dec() @@ -368,7 +392,59 @@ ivas_error ivas_osba_ism_metadata_dec( return IVAS_ERR_OK; } +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX +/*-------------------------------------------------------------------------* + * ivas_osba_render_sf() + * + * Object + SBA rendering process. + *-------------------------------------------------------------------------*/ +ivas_error ivas_osba_render_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ + float *p_output[] /* o : rendered time signal */ +) +{ + int16_t n; + float output_ism[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + float *p_output_ism[MAX_OUTPUT_CHANNELS]; + ivas_error error; + + for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) + { + p_output_ism[n] = &output_ism[n][0]; + } + + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + mvr2r( p_output[n], output_ism[n], nSamplesAsked ); + } + + if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) + { + ivas_ism_render_sf( st_ivas, p_output_ism, *nSamplesRendered ); + } + + for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) + { + if ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) + { + v_add( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered ); + } + + v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); + } + + return IVAS_ERR_OK; +} +#else /*-------------------------------------------------------------------------* * ivas_osba_render() * @@ -428,3 +504,4 @@ ivas_error ivas_osba_render( return IVAS_ERR_OK; } +#endif diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index a853a007289d672b06165ae98ba50b8cf47e78e9..6c5ecdb3e5a53a922ce7b443cc50c5a0671fcfee 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -934,5 +934,13 @@ void ivas_sba_dirac_stereo_dec( } } +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + /* reset the other channels to 0 (they are not used since here) */ + for ( int16_t ch = CPE_CHANNELS; ch < st_ivas->nchan_transport; ch++ ) + { + set_zero( output[ch], output_frame ); + } +#endif + return; } diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 7ab8bf7fc4a19392824af09634f5581f3afdcc01..a87cdaca303e516f524010a78b1819f0fde8b57d 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -339,7 +339,7 @@ int16_t ivas_sba_remapTCs( return ( nchan_remapped ); } - +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX /*-------------------------------------------------------------------------* * ivas_ism2sba() * @@ -402,9 +402,11 @@ void ivas_ism2sba( return; } +#endif + /*-------------------------------------------------------------------------* - * ivas_ism2sba() + * ivas_ism2sba_sf() * * ISM transformed into SBA in TD domain. *-------------------------------------------------------------------------*/ @@ -421,6 +423,9 @@ void ivas_ism2sba_sf( { int16_t i, j, k; float g1, *g2, *tc, *out, gain, prev_gain; +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + float buffer_tmp[HOA3_CHANNELS][L_FRAME48k]; // VE2SB: TBV +#endif int16_t sba_num_chans; assert( ( sba_order <= 3 ) && "Only order up to 3 is supported!" ); @@ -430,7 +435,11 @@ void ivas_ism2sba_sf( sba_num_chans = ( sba_order + 1 ) * ( sba_order + 1 ); for ( j = 0; j < sba_num_chans; j++ ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + set_zero( buffer_tmp[j], n_samples_to_render ); +#else set_zero( buffer_out[j], n_samples_to_render ); +#endif } for ( i = 0; i < num_objects; i++ ) @@ -439,7 +448,11 @@ void ivas_ism2sba_sf( { g2 = hIsmRendererData->interpolator + offset; tc = buffer_in[i] + offset; +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + out = buffer_tmp[j]; +#else out = buffer_out[j]; +#endif gain = hIsmRendererData->gains[i][j]; prev_gain = hIsmRendererData->prev_gains[i][j]; for ( k = 0; k < n_samples_to_render; k++ ) @@ -450,9 +463,17 @@ void ivas_ism2sba_sf( } } +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + for ( j = 0; j < sba_num_chans; j++ ) + { + mvr2r( buffer_tmp[j], buffer_out[j], n_samples_to_render ); + } +#endif + return; } +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX /*-------------------------------------------------------------------* * ivas_sba_upmixer_renderer() * @@ -503,7 +524,7 @@ ivas_error ivas_sba_upmixer_renderer( return IVAS_ERR_OK; } - +#endif /*-------------------------------------------------------------------* * ivas_sba_linear_renderer() diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 4b0135f3af307817481301dacff5b0e734fcc234..5db840877a48448bb1a587b51c2475c553186d5f 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -910,16 +910,20 @@ typedef struct ivas_masa_ism_data_structure typedef struct decoder_tc_buffer_structure { - float *tc_buffer; /* the buffer itself */ + float *tc_buffer; /* the buffer itself */ +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + float *tc[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* pointers into the buffer to the beginning of each tc */ // VE2SB: TBV +#else float *tc[MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS]; /* pointers into the buffer to the beginning of each tc */ - TC_BUFFER_MODE tc_buffer_mode; /* mode of the buffer (no buffering, render buffering, out buffering) */ - int16_t nchan_transport_jbm; /* number of TCs after TC decoding */ - int16_t nchan_transport_internal; /* total number of TC buffer channels, can include e.g. TD decorr data */ - int16_t nchan_buffer_full; /* number of channels to be fully buffered */ - int16_t n_samples_available; /* samples still available for rendering in the current frame */ - int16_t n_samples_buffered; /* full number of samples in the buffer (including spill to next frame) */ - int16_t n_samples_rendered; /* samples already rendered in the current frame */ - int16_t n_samples_granularity; /* render granularity */ +#endif + TC_BUFFER_MODE tc_buffer_mode; /* mode of the buffer (no buffering, render buffering, out buffering) */ + int16_t nchan_transport_jbm; /* number of TCs after TC decoding */ + int16_t nchan_transport_internal; /* total number of TC buffer channels, can include e.g. TD decorr data */ + int16_t nchan_buffer_full; /* number of channels to be fully buffered */ + int16_t n_samples_available; /* samples still available for rendering in the current frame */ + int16_t n_samples_buffered; /* full number of samples in the buffer (including spill to next frame) */ + int16_t n_samples_rendered; /* samples already rendered in the current frame */ + int16_t n_samples_granularity; /* render granularity */ int16_t n_samples_flushed; int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; int16_t nb_subframes; @@ -1010,7 +1014,7 @@ typedef struct decoder_config_structure /* temp. development parameters */ int16_t force_rend; /* forced TD/CLDFB binaural renderer (for ISM and MC) */ #endif - int16_t Opt_tsm; + int16_t Opt_tsm; /* indicates whether time scaling modification is activated */ #ifdef SPLIT_REND_WITH_HEAD_ROT int16_t Opt_Limiter; #endif diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 72cf0ca99dfb7520fbfa433b1ffa129b0961874f..b1ac64db2d5c42149c76bed077b05179c7b3c5ee 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -977,7 +977,11 @@ ivas_error IVAS_DEC_GetSamples( ) { ivas_error error; +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + int16_t nOutSamplesElse, nSamplesToRender; +#else int16_t nOutSamplesElse, result, nSamplesToRender; +#endif uint16_t nSamplesRendered, nSamplesRendered_loop, l_ts, nTimeScalerOutSamples; uint8_t nTransportChannels, nOutChannels; @@ -1092,7 +1096,11 @@ ivas_error IVAS_DEC_GetSamples( int16_t nResidualSamples, nSamplesTcsScaled; nSamplesRendered += nSamplesRendered_loop; +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm && nTransportChannels != hIvasDec->nTransportChannelsOld ) +#else if ( nTransportChannels != hIvasDec->nTransportChannelsOld ) +#endif { if ( ( error = IVAS_DEC_VoIP_reconfigure( hIvasDec, nTransportChannels, l_ts ) ) != IVAS_ERR_OK ) { @@ -1100,32 +1108,50 @@ ivas_error IVAS_DEC_GetSamples( } } - /* decode TCs only */ + /* IVAS decoder */ if ( ( error = IVAS_DEC_GetTcSamples( hIvasDec, hIvasDec->apaExecBuffer, &nOutSamplesElse ) ) != IVAS_ERR_OK ) { return error; } + /* JBM */ if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { if ( apa_set_scale( hIvasDec->hTimeScaler, hIvasDec->tsm_scale ) != 0 ) { return IVAS_ERR_UNKNOWN; } + +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( apa_exec( hIvasDec->hTimeScaler, hIvasDec->apaExecBuffer, hIvasDec->nSamplesFrame * nTransportChannels, (uint16_t) hIvasDec->tsm_max_scaling, hIvasDec->apaExecBuffer, &nTimeScalerOutSamples ) != 0 ) + { + return IVAS_ERR_UNKNOWN; + } + + assert( nTimeScalerOutSamples <= APA_BUF ); + nSamplesTcsScaled = nTimeScalerOutSamples / nTransportChannels; +#else result = apa_exec( hIvasDec->hTimeScaler, hIvasDec->apaExecBuffer, hIvasDec->nSamplesFrame * nTransportChannels, (uint16_t) hIvasDec->tsm_max_scaling, hIvasDec->apaExecBuffer, &nTimeScalerOutSamples ); if ( result != 0 ) { return IVAS_ERR_UNKNOWN; } assert( nTimeScalerOutSamples <= APA_BUF ); +#endif } else { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + nSamplesTcsScaled = hIvasDec->nSamplesFrame; +#else nTimeScalerOutSamples = hIvasDec->nSamplesFrame * nTransportChannels; +#endif } +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX nSamplesTcsScaled = nTimeScalerOutSamples / nTransportChannels; +#endif - /* render IVAS frames */ + /* Feed decoded transport channels samples to the renderer */ if ( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer ) ) != IVAS_ERR_OK ) { return error; @@ -1142,9 +1168,8 @@ ivas_error IVAS_DEC_GetSamples( hIvasDec->hasBeenFedFrame = false; } - /* render IVAS frames directly to the output buffer */ + /* render IVAS frames directly to the output buffer */ nSamplesToRender = nSamplesAsked - nSamplesRendered; - #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) ) ) != IVAS_ERR_OK ) #else @@ -1485,7 +1510,7 @@ static ivas_error IVAS_DEC_GetTcSamples( /*---------------------------------------------------------------------* * IVAS_DEC_Rendered_FeedTcSamples( ) * - * Main function to decode to PCM data of the transport channels + * Feed decoded transport channels samples to the renderer *---------------------------------------------------------------------*/ static ivas_error IVAS_DEC_RendererFeedTcSamples( @@ -1514,7 +1539,7 @@ static ivas_error IVAS_DEC_RendererFeedTcSamples( /*---------------------------------------------------------------------* * IVAS_DEC_GetRenderedSamples( ) * - * Main function to render the transport channels to PCM output datat + * Main function to render the transport channels to PCM output data *---------------------------------------------------------------------*/ static ivas_error IVAS_DEC_GetRenderedSamples( @@ -2806,7 +2831,6 @@ ivas_error IVAS_DEC_Flush( nSamplesToRender = (uint16_t) *nSamplesFlushed; /* render IVAS frames */ - #ifdef SPLIT_REND_WITH_HEAD_ROT error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, pcmType, pcmBuf ); #else @@ -3063,6 +3087,9 @@ static ivas_error printConfigInfo_dec( { ivas_error error; char config_str[50]; +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + AUDIO_CONFIG output_config; +#endif /*-----------------------------------------------------------------* * Print info on screen @@ -3162,10 +3189,25 @@ static ivas_error printConfigInfo_dec( } } +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + output_config = st_ivas->hDecoderConfig->output_config; + get_channel_config( output_config, &config_str[0] ); +#else get_channel_config( st_ivas->hDecoderConfig->output_config, &config_str[0] ); +#endif fprintf( stdout, "Output configuration: %s\n", config_str ); + #ifdef NONBE_UNIFIED_DECODING_PATHS - fprintf( stdout, "Render framesize: %dms\n", get_render_frame_size_ms( st_ivas->hDecoderConfig->render_framesize ) ); +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) +#else + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#endif +#endif + { + fprintf( stdout, "Render framesize: %dms\n", get_render_frame_size_ms( st_ivas->hDecoderConfig->render_framesize ) ); + } #endif if ( st_ivas->hDecoderConfig->Opt_HRTF_binary ) { @@ -3230,7 +3272,7 @@ static ivas_error printConfigInfo_dec( if ( st_ivas->hDecoderConfig->Opt_tsm ) { - fprintf( stdout, "TSM mode: ON\n" ); + fprintf( stdout, "TSM mode: ON\n" ); } #ifndef NONBE_UNIFIED_DECODING_PATHS /*-----------------------------------------------------------------* @@ -3346,7 +3388,9 @@ static ivas_error evs_dec_main( int16_t *pcmBuf ) { DEC_CORE_HANDLE *hCoreCoder; +#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX float output[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN][L_FRAME48k]; +#endif float mixer_left, mixer_rigth; float *p_output[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; int16_t ch; @@ -3359,7 +3403,11 @@ static ivas_error evs_dec_main( for ( ch = 0; ch < MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; ch++ ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + p_output[ch] = st_ivas->p_output_f[ch]; +#else p_output[ch] = output[ch]; +#endif } /* run the main EVS decoding routine */ @@ -3367,14 +3415,22 @@ static ivas_error evs_dec_main( { if ( hCoreCoder[0]->Opt_AMR_WB ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( ( error = amr_wb_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0] ) ) != IVAS_ERR_OK ) +#else if ( ( error = amr_wb_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output[0] ) ) != IVAS_ERR_OK ) +#endif { return error; } } else { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) +#else if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -3384,21 +3440,33 @@ static ivas_error evs_dec_main( { if ( hCoreCoder[0]->bfi == 0 ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) +#else if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) +#endif { return error; } } else if ( hCoreCoder[0]->bfi == 2 ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_FUTURE ) ) != IVAS_ERR_OK ) +#else if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output[0], FRAMEMODE_FUTURE ) ) != IVAS_ERR_OK ) +#endif { return error; } } else { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_MISSING ) ) != IVAS_ERR_OK ) +#else if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output[0], FRAMEMODE_MISSING ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -3411,8 +3479,13 @@ static ivas_error evs_dec_main( { mixer_left = ( st_ivas->hDecoderConfig->non_diegetic_pan_gain + 1.f ) * 0.5f; mixer_rigth = 1.f - mixer_left; +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + v_multc( p_output[0], mixer_rigth, p_output[1], nOutSamples ); + v_multc( p_output[0], mixer_left, p_output[0], nOutSamples ); +#else v_multc( output[0], mixer_rigth, output[1], nOutSamples ); v_multc( output[0], mixer_left, output[0], nOutSamples ); +#endif } #ifndef NONBE_UNIFIED_DECODING_PATHS diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 582056fb78e639dd5c1758bb9f227decfa0a2c27..1d7bebf5b85622cf5093978f401d71b9f2cb399d 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1740,7 +1740,7 @@ static ivas_error ivas_rend_crendConvolver( /*-----------------------------------------------------------------------------------------* - * Function ivas_rend_crend_Process() + * Function ivas_rend_crendProcess() * * Process call for IVAS Crend renderer *-----------------------------------------------------------------------------------------*/ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 55d30e40e52641d3c8271e60b0b7e18158498e14..52f771806981d346ce43a359d826419106a59543 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -468,7 +468,11 @@ void ivas_dirac_dec_binaural_render( uint16_t nchan_out; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; float *output_f_local[MAX_OUTPUT_CHANNELS]; +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + float output_f_local_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + int16_t output_length; +#endif hSpatParamRendCom = st_ivas->hSpatParamRendCom; nchan_out = BINAURAL_CHANNELS; #ifdef DEBUGGING @@ -476,7 +480,11 @@ void ivas_dirac_dec_binaural_render( #endif for ( ch = 0; ch < nchan_out; ch++ ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + output_f_local[ch] = output_f_local_buff[ch]; +#else output_f_local[ch] = output_f[ch]; +#endif } slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); @@ -494,6 +502,9 @@ void ivas_dirac_dec_binaural_render( #ifdef DEBUGGING assert( slots_to_render == 0 ); +#endif +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + output_length = 0; #endif for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { @@ -505,12 +516,23 @@ void ivas_dirac_dec_binaural_render( output_f_local[ch] += n_samples_sf; } +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + output_length += n_samples_sf; + +#endif #ifdef NONBE_UNIFIED_DECODING_PATHS /* update combined orientation access index */ ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, n_samples_sf ); #endif } +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + for ( ch = 0; ch < nchan_out; ch++ ) + { + mvr2r( output_f_local_buff[ch], output_f[ch], output_length ); + } + +#endif if ( hSpatParamRendCom->slots_rendered == hSpatParamRendCom->num_slots ) { hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % hSpatParamRendCom->dirac_md_buffer_length; @@ -554,7 +576,7 @@ void ivas_dirac_dec_binaural_sba_gain( return; } - +#ifndef NONBE_UNIFIED_DECODING_PATHS /*------------------------------------------------------------------------- * ivas_dirac_dec_binaural() * @@ -660,7 +682,7 @@ void ivas_dirac_dec_binaural( return; } - +#endif /*------------------------------------------------------------------------- * Local functions diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index 7f4301cc2e0ef357bc9e33ce8fe13ce3a193dff4..795779800bc38863462de3050a1623d5d71a69be 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -278,7 +278,11 @@ int16_t ivas_get_nchan_buffers_dec( if ( st_ivas->ivas_format == MONO_FORMAT ) { +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX + nchan_out_buff = st_ivas->hDecoderConfig->nchan_out; +#else nchan_out_buff = 0; +#endif } else if ( st_ivas->ivas_format == STEREO_FORMAT ) { @@ -323,6 +327,16 @@ int16_t ivas_get_nchan_buffers_dec( { nchan_out_buff = max( nchan_out_buff, st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe ); } +#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX +#ifdef SPLIT_REND_WITH_HEAD_ROT + else if ( output_config == IVAS_AUDIO_CONFIG_STEREO || output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) +#else + else if ( output_config == IVAS_AUDIO_CONFIG_STEREO || output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#endif + { + nchan_out_buff = 2 * CPE_CHANNELS; + } +#endif else if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL ) { nchan_out_buff = max( nchan_out_buff, audioCfg2channels( st_ivas->intern_config ) ); @@ -369,7 +383,7 @@ int16_t ivas_get_nchan_buffers_dec( } else { - nchan_out_buff = max( nchan_out_buff + st_ivas->nchan_ism, audioCfg2channels( output_config ) ); /* needed for iivas_spar_dec_upmixer_sf() which is based on 'nchan_out' */ + nchan_out_buff = max( nchan_out_buff + st_ivas->nchan_ism, audioCfg2channels( output_config ) ); /* needed for ivas_spar_dec_upmixer_sf() which is based on 'nchan_out' */ } } else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index a8269bba4c1e2f9d906b4f971ff3e4f898a9e920..0bd5a09f5c916b00a7ef661f03d4447bfcd1f319 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -221,6 +221,7 @@ void ivas_dirac_dec_binaural_sba_gain( const int16_t output_frame /* i : output frame length */ ); +#ifndef NONBE_UNIFIED_DECODING_PATHS void ivas_dirac_dec_binaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined orientation handle */ @@ -228,7 +229,7 @@ void ivas_dirac_dec_binaural( const int16_t nchan_transport, /* i : number of transport channels */ const int16_t num_subframes /* i : number of subframes to render */ ); - +#endif void ivas_dirac_dec_binaural_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */