From 89ddc0920ba60b32da6bf18e91528eb596969ed7 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 29 Mar 2023 15:18:44 +0200 Subject: [PATCH 1/6] formatting --- apps/encoder.c | 22 +++++++--------------- lib_dec/ivas_stereo_switching_dec.c | 3 +-- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/apps/encoder.c b/apps/encoder.c index ff6f461838..8924064b3d 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -392,25 +392,17 @@ int main( } break; case IVAS_ENC_INPUT_SBA: - if ( ( error = - IVAS_ENC_ConfigureForAmbisonics( - hIvasEnc, - arg.inputFs, - totalBitrate, - arg.max_bwidth_user, - bandwidth, - arg.dtxConfig, - arg.inputFormatConfig.sba.order, - arg.inputFormatConfig.sba.isPlanar, + if ( ( error = IVAS_ENC_ConfigureForAmbisonics( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, + arg.inputFormatConfig.sba.order, arg.inputFormatConfig.sba.isPlanar, #ifdef DEBUG_AGC_ENCODER_CMD_OPTION - arg.agc, + arg.agc, #endif - arg.pca + arg.pca #ifdef DEBUG_SBA_AUDIO_DUMP - , - &numTransportChannels + , + &numTransportChannels #endif - ) ) != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForAmbisonics failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 2e98d358f8..c2367c2025 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -421,8 +421,7 @@ ivas_error stereo_memory_dec( deallocate_CoreCoder( hCPE->hCoreCoder[1] ); /* allocate DFT stereo data structure */ - if ( ( error = stereo_dft_dec_create( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, 0, - nchan_transport ) ) != IVAS_ERR_OK ) + if ( ( error = stereo_dft_dec_create( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, 0, nchan_transport ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From 735c70300cdd3638b3e8a14e1dd6a1a7657102b9 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Tue, 18 Apr 2023 09:58:55 +0300 Subject: [PATCH 2/6] address potential 2dir MASA metadata field direction misalignment issue #398 by aligning the directions over time --- lib_com/options.h | 5 +- lib_enc/ivas_masa_enc.c | 172 ++++++++++++++++++++++++++++++++++++++++ lib_enc/ivas_stat_enc.h | 15 ++++ 3 files changed, 189 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index cce0aff460..a753fa0103 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,12 +151,10 @@ #define FIX_382_MASA_META_FRAMING_ASYNC /* Nokia: Issue 382: detect potential MASA metadata framing offset */ #define FIX_386_CORECODER_RECONFIG /* VA: Issue 386: Resolve ToDo comments in CoreCoder reconfig. */ - #define SBA2MONO /* FhG: Issue 365: Adapt processing of SBA mono output to be in line with stereo output (less delay, lower complexity) */ #define FIX_379_EXT_METADATA /* Eri: Extended metadata issues */ #define FIX_379_ANGLE /* Eri: Extended metadata issues related to angle structure */ - #define NOKIA_PARAMBIN_REQULARIZATION /* Nokia: Contribution - Configured reqularization factor for parametric binauralizer. */ #define NOKIA_ADAPTIVE_BINAURAL_PROTOS /* Nokia: Contribution 28: Adaptive binaural prototypes */ #define NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT /* Nokia: enable adaptive binaural prototype complexity optimizations */ @@ -167,8 +165,9 @@ #define FIX_ISM_DTX_CLICKS /* FhG: fix for clicks in ISM DTX for inactive to active TCX transitions */ -#define ISSUE_24_CLEANUP_MCT_LFE /* Issue 24: Cleanup LFE path withing MCT */ +#define ISSUE_24_CLEANUP_MCT_LFE /* Issue 24: Cleanup LFE path withing MCT */ +#define FIX_398_MASA_DIRECTION_ALIGNMENT /* Nokia: Issue 398: in 2dir MASA, dynamically adjust directions to be consistent */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index fbb7af9ab4..822df98da4 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -73,6 +73,10 @@ static uint8_t are_masa_subframes_similar( const MASA_METADATA_HANDLE frame1, co static void detect_framing_async( MASA_ENCODER_HANDLE hMasa ); #endif +#ifdef FIX_398_MASA_DIRECTION_ALIGNMENT +static void masa_metadata_direction_alignment( MASA_ENCODER_HANDLE hMasa ); +#endif + /*-----------------------------------------------------------------------* * Local constants *-----------------------------------------------------------------------*/ @@ -155,6 +159,13 @@ ivas_error ivas_masa_enc_open( hMasa->data.sync_state.frame_mode = MASA_FRAME_4SF; #endif +#ifdef FIX_398_MASA_DIRECTION_ALIGNMENT + set_zero( hMasa->data.dir_align_state.previous_azi_dir1, MASA_FREQUENCY_BANDS ); + set_zero( hMasa->data.dir_align_state.previous_ele_dir1, MASA_FREQUENCY_BANDS ); + set_zero( hMasa->data.dir_align_state.previous_azi_dir2, MASA_FREQUENCY_BANDS ); + set_zero( hMasa->data.dir_align_state.previous_ele_dir2, MASA_FREQUENCY_BANDS ); +#endif + st_ivas->hMasa = hMasa; return error; @@ -525,6 +536,9 @@ ivas_error ivas_masa_enc_config( if ( ivas_format == MASA_FORMAT ) { +#ifdef FIX_398_MASA_DIRECTION_ALIGNMENT + masa_metadata_direction_alignment( hMasa ); +#endif #ifdef FIX_382_MASA_META_FRAMING_ASYNC detect_framing_async( hMasa ); /* detect the offset, set 1sf/4sf mode based on this. potentially also shift the metadata using a history buffer */ if ( hMasa->data.sync_state.frame_mode == MASA_FRAME_1SF && hMasa->data.sync_state.prev_offset != 0 ) @@ -2198,3 +2212,161 @@ static void detect_framing_async( return; } #endif + +#ifdef FIX_398_MASA_DIRECTION_ALIGNMENT +/*-------------------------------------------------------------------* + * masa_metadata_direction_alignment() + * + * In 2dir MASA metadata, determine the ordering of the directional + * fields such that the azi/ele change across time is minimized. + *-------------------------------------------------------------------*/ +void masa_metadata_direction_alignment( + MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder handle */ +) +{ + uint8_t band, n_dirs; + + MASA_DIR_ALIGN_HANDLE hAlignState; + MASA_METADATA_HANDLE hMeta; + + hAlignState = &( hMasa->data.dir_align_state ); + hMeta = &( hMasa->masaMetadata ); + + n_dirs = hMeta->descriptive_meta.numberOfDirections + 1; /* 1-based */ + for ( band = 0; band < MASA_FREQUENCY_BANDS; band++ ) + { + uint8_t sf; + float diff_swap, diff_no_swap; + + /* trade 2*(cos+sin) against storing the values between frames */ + float prev_ele_dir1_sin, prev_ele_dir2_sin; + float prev_ele_dir1_cos, prev_ele_dir2_cos; + + prev_ele_dir1_sin = sinf( hAlignState->previous_ele_dir1[band] ); + prev_ele_dir2_sin = sinf( hAlignState->previous_ele_dir2[band] ); + + prev_ele_dir1_cos = cosf( hAlignState->previous_ele_dir1[band] ); + prev_ele_dir2_cos = cosf( hAlignState->previous_ele_dir2[band] ); + + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + float azi_rad1, ele_rad1; + float azi_rad2, ele_rad2; + float cos_ele1, cos_ele2; + float sin_ele1, sin_ele2; + + azi_rad1 = hMeta->directional_meta[0].azimuth[sf][band] * PI_OVER_180; + ele_rad1 = hMeta->directional_meta[0].elevation[sf][band] * PI_OVER_180; + + if ( n_dirs > 1 ) + { + azi_rad2 = hMeta->directional_meta[1].azimuth[sf][band] * PI_OVER_180; + ele_rad2 = hMeta->directional_meta[1].elevation[sf][band] * PI_OVER_180; + + /* quick checks to detect constant data and earlier flip */ + if ( fabsf( azi_rad1 - hAlignState->previous_azi_dir1[band] ) < EPSILON && + fabsf( azi_rad2 - hAlignState->previous_azi_dir2[band] ) < EPSILON && + fabsf( ele_rad1 - hAlignState->previous_ele_dir1[band] ) < EPSILON && + fabsf( ele_rad2 - hAlignState->previous_ele_dir2[band] ) < EPSILON ) + { + diff_swap = 1.0f; + diff_no_swap = 0.0f; + /* cached values that will be used for the short-cuts and over-written by the real computations, if done */ + sin_ele1 = prev_ele_dir1_sin; + sin_ele2 = prev_ele_dir2_sin; + cos_ele1 = prev_ele_dir1_cos; + cos_ele2 = prev_ele_dir2_cos; + } + else if ( fabsf( azi_rad1 - hAlignState->previous_azi_dir2[band] ) < EPSILON && + fabsf( azi_rad2 - hAlignState->previous_azi_dir1[band] ) < EPSILON && + fabsf( ele_rad1 - hAlignState->previous_ele_dir2[band] ) < EPSILON && + fabsf( ele_rad2 - hAlignState->previous_ele_dir1[band] ) < EPSILON ) + { + diff_swap = 0.0f; + diff_no_swap = 1.0f; + /* cached values that will be used for the short-cuts and over-written by the real computations, if done */ + sin_ele1 = prev_ele_dir2_sin; + sin_ele2 = prev_ele_dir1_sin; + cos_ele1 = prev_ele_dir2_cos; + cos_ele2 = prev_ele_dir1_cos; + } + else + { + /* angular distance of the two vectors */ + /* pre-compute values for re-use */ + sin_ele1 = sinf( ele_rad1 ); + sin_ele2 = sinf( ele_rad2 ); + + cos_ele1 = cosf( ele_rad1 ); + cos_ele2 = cosf( ele_rad2 ); + + diff_no_swap = acosf( cos_ele1 * prev_ele_dir1_cos * cosf( azi_rad1 - hAlignState->previous_azi_dir1[band] ) + sin_ele1 * prev_ele_dir1_sin ) + + acosf( cos_ele2 * prev_ele_dir2_cos * cosf( azi_rad2 - hAlignState->previous_azi_dir2[band] ) + sin_ele2 * prev_ele_dir2_sin ); + + diff_swap = acosf( cos_ele1 * prev_ele_dir2_cos * cosf( azi_rad1 - hAlignState->previous_azi_dir2[band] ) + sin_ele1 * prev_ele_dir2_sin ) + + acosf( cos_ele2 * prev_ele_dir1_cos * cosf( azi_rad2 - hAlignState->previous_azi_dir1[band] ) + sin_ele2 * prev_ele_dir1_sin ); + } + } + else + { + /* 1dir */ + sin_ele1 = sinf( ele_rad1 ); + cos_ele1 = cosf( ele_rad1 ); + + azi_rad2 = 0.0f; + ele_rad2 = 0.0f; + + sin_ele2 = 0.0f; /* sin(0) */ + cos_ele2 = 1.0f; /* cos(0) */ + } + + if ( n_dirs > 1 && diff_no_swap > diff_swap ) + { + /* swap the metadata of the two directions in this TF-tile */ + float tmp_val; + tmp_val = hMeta->directional_meta[0].azimuth[sf][band]; + hMeta->directional_meta[0].azimuth[sf][band] = hMeta->directional_meta[1].azimuth[sf][band]; + hMeta->directional_meta[1].azimuth[sf][band] = tmp_val; + + tmp_val = hMeta->directional_meta[0].elevation[sf][band]; + hMeta->directional_meta[0].elevation[sf][band] = hMeta->directional_meta[1].elevation[sf][band]; + hMeta->directional_meta[1].elevation[sf][band] = tmp_val; + + tmp_val = hMeta->directional_meta[0].energy_ratio[sf][band]; + hMeta->directional_meta[0].energy_ratio[sf][band] = hMeta->directional_meta[1].energy_ratio[sf][band]; + hMeta->directional_meta[1].energy_ratio[sf][band] = tmp_val; + + tmp_val = hMeta->directional_meta[0].spread_coherence[sf][band]; + hMeta->directional_meta[0].spread_coherence[sf][band] = hMeta->directional_meta[1].spread_coherence[sf][band]; + hMeta->directional_meta[1].spread_coherence[sf][band] = tmp_val; + + hAlignState->previous_azi_dir1[band] = azi_rad2; + hAlignState->previous_ele_dir1[band] = ele_rad2; + + hAlignState->previous_azi_dir2[band] = azi_rad1; + hAlignState->previous_ele_dir2[band] = ele_rad1; + + prev_ele_dir1_cos = cos_ele2; + prev_ele_dir1_sin = sin_ele2; + + prev_ele_dir2_cos = cos_ele1; + prev_ele_dir2_sin = sin_ele1; + } + else + { + hAlignState->previous_azi_dir1[band] = azi_rad1; + hAlignState->previous_ele_dir1[band] = ele_rad1; + + hAlignState->previous_azi_dir2[band] = azi_rad2; + hAlignState->previous_ele_dir2[band] = ele_rad2; + + prev_ele_dir1_cos = cos_ele1; + prev_ele_dir1_sin = sin_ele1; + + prev_ele_dir2_cos = cos_ele2; + prev_ele_dir2_sin = sin_ele2; + } + } /* sf */ + } /* band */ +} +#endif diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 6638a89488..b7aad8cea7 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -740,6 +740,17 @@ typedef struct ivas_param_mc_enc_data_structure * MASA encoder structures *----------------------------------------------------------------------------------*/ +#ifdef FIX_398_MASA_DIRECTION_ALIGNMENT +typedef struct ivas_masa_dir_align_struct +{ + float previous_azi_dir1[MASA_FREQUENCY_BANDS]; + float previous_ele_dir1[MASA_FREQUENCY_BANDS]; + + float previous_azi_dir2[MASA_FREQUENCY_BANDS]; + float previous_ele_dir2[MASA_FREQUENCY_BANDS]; +} MASA_DIR_ALIGN_STATE, *MASA_DIR_ALIGN_HANDLE; +#endif + #ifdef FIX_382_MASA_META_FRAMING_ASYNC /* structure storing MASA framing sync detection and compensation data */ typedef struct ivas_masa_sync_struct @@ -773,6 +784,10 @@ typedef struct ivas_masa_encoder_data_struct #ifdef FIX_382_MASA_META_FRAMING_ASYNC MASA_SYNC_STATE sync_state; #endif + +#ifdef FIX_398_MASA_DIRECTION_ALIGNMENT + MASA_DIR_ALIGN_STATE dir_align_state; +#endif } MASA_ENCODER_DATA; typedef struct ivas_masa_encoder_struct -- GitLab From 209e4ed0715570179f39d5dcb718c7d21a153869 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Tue, 18 Apr 2023 09:50:44 +0200 Subject: [PATCH 3/6] fix build warning of potentially uninitialized variables --- lib_enc/ivas_masa_enc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 822df98da4..af7c03bcb0 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -2318,6 +2318,9 @@ void masa_metadata_direction_alignment( sin_ele2 = 0.0f; /* sin(0) */ cos_ele2 = 1.0f; /* cos(0) */ + + diff_swap = 1.0f; + diff_no_swap = 0.0f; } if ( n_dirs > 1 && diff_no_swap > diff_swap ) -- GitLab From d052db7eb224fc31930e297a7db761b42df99222 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 18 Apr 2023 09:57:40 +0200 Subject: [PATCH 4/6] formal improvements + formatting --- lib_enc/ivas_masa_enc.c | 8 +++++++- lib_enc/ivas_stat_enc.h | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index af7c03bcb0..5c6e596cd2 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -539,8 +539,10 @@ ivas_error ivas_masa_enc_config( #ifdef FIX_398_MASA_DIRECTION_ALIGNMENT masa_metadata_direction_alignment( hMasa ); #endif + #ifdef FIX_382_MASA_META_FRAMING_ASYNC detect_framing_async( hMasa ); /* detect the offset, set 1sf/4sf mode based on this. potentially also shift the metadata using a history buffer */ + if ( hMasa->data.sync_state.frame_mode == MASA_FRAME_1SF && hMasa->data.sync_state.prev_offset != 0 ) { /* average over sub-frames */ @@ -2213,6 +2215,7 @@ static void detect_framing_async( } #endif + #ifdef FIX_398_MASA_DIRECTION_ALIGNMENT /*-------------------------------------------------------------------* * masa_metadata_direction_alignment() @@ -2220,7 +2223,8 @@ static void detect_framing_async( * In 2dir MASA metadata, determine the ordering of the directional * fields such that the azi/ele change across time is minimized. *-------------------------------------------------------------------*/ -void masa_metadata_direction_alignment( + +static void masa_metadata_direction_alignment( MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder handle */ ) { @@ -2371,5 +2375,7 @@ void masa_metadata_direction_alignment( } } /* sf */ } /* band */ + + return; } #endif diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index b7aad8cea7..424e6b0c02 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -748,6 +748,7 @@ typedef struct ivas_masa_dir_align_struct float previous_azi_dir2[MASA_FREQUENCY_BANDS]; float previous_ele_dir2[MASA_FREQUENCY_BANDS]; + } MASA_DIR_ALIGN_STATE, *MASA_DIR_ALIGN_HANDLE; #endif @@ -759,6 +760,7 @@ typedef struct ivas_masa_sync_struct uint8_t prev_sim_stop; uint8_t prev_offset; MASA_FRAME_MODE frame_mode; + } MASA_SYNC_STATE, *MASA_SYNC_HANDLE; #endif @@ -788,6 +790,7 @@ typedef struct ivas_masa_encoder_data_struct #ifdef FIX_398_MASA_DIRECTION_ALIGNMENT MASA_DIR_ALIGN_STATE dir_align_state; #endif + } MASA_ENCODER_DATA; typedef struct ivas_masa_encoder_struct -- GitLab From 85800755e4c5c59c4295246d3f73f92006e17370 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 18 Apr 2023 12:40:13 +0200 Subject: [PATCH 5/6] revert reversion of FIX_392_LATE_REVERB --- apps/encoder.c | 22 +++++++++++++++------- apps/renderer.c | 4 ++++ lib_com/common_api_types.h | 3 +-- lib_com/options.h | 1 + lib_dec/ivas_stereo_switching_dec.c | 3 ++- lib_dec/lib_dec.c | 2 +- lib_rend/lib_rend.c | 16 ++++++++++++++-- lib_rend/lib_rend.h | 8 ++++++-- 8 files changed, 44 insertions(+), 15 deletions(-) diff --git a/apps/encoder.c b/apps/encoder.c index 92cd3a11b9..aae2e1e88e 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -386,17 +386,25 @@ int main( } break; case IVAS_ENC_INPUT_SBA: - if ( ( error = IVAS_ENC_ConfigureForAmbisonics( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, - arg.inputFormatConfig.sba.order, arg.inputFormatConfig.sba.isPlanar, + if ( ( error = + IVAS_ENC_ConfigureForAmbisonics( + hIvasEnc, + arg.inputFs, + totalBitrate, + arg.max_bwidth_user, + bandwidth, + arg.dtxConfig, + arg.inputFormatConfig.sba.order, + arg.inputFormatConfig.sba.isPlanar, #ifdef DEBUG_AGC_ENCODER_CMD_OPTION - arg.agc, + arg.agc, #endif - arg.pca + arg.pca #ifdef DEBUG_SBA_AUDIO_DUMP - , - &numTransportChannels + , + &numTransportChannels #endif - ) ) != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForAmbisonics failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; diff --git a/apps/renderer.c b/apps/renderer.c index 6bb3b04fd5..726eeb237b 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -675,7 +675,11 @@ int main( } /* === Configure === */ +#ifdef FIX_392_LATE_REVERB + if ( ( error = IVAS_REND_InitConfig( hIvasRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_REND_InitConfig( hIvasRend, ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) || ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL ) ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "Error in Renderer Config Init\n" ); exit( -1 ); diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 3e012a6f99..756a8b20ee 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -47,7 +47,7 @@ #define IVAS_MAX_BITS_PER_FRAME ( 512000 / 50 ) #define IVAS_MAX_NUM_OBJECTS 4 #define IVAS_MAX_OUTPUT_CHANNELS 16 -#define IVAS_CLDFB_NO_CHANNELS_MAX ( 60 ) +#define IVAS_CLDFB_NO_CHANNELS_MAX 60 #define IVAS_MAX_INPUT_LFE_CHANNELS 4 #define RENDERER_HEAD_POSITIONS_PER_FRAME 4 @@ -161,7 +161,6 @@ typedef struct _IVAS_LS_CUSTOM_LAYOUT } IVAS_CUSTOM_LS_DATA; -typedef struct ivas_LS_setup_custom *IVAS_LSSETUP_CUSTOM_HANDLE; typedef struct ivas_LS_setup_custom IVAS_LSSETUP_CUSTOM_STRUCT; diff --git a/lib_com/options.h b/lib_com/options.h index 79bf683bbf..cce0aff460 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,6 +163,7 @@ #define FIX_389_EXT_REND_PCM_SR /* Nokia: Issue 389: Fix assignment of sample rate with PCM input. */ #define FIX_390_EXT_REND_MASA_META_COPY /* Nokia: Issue 390: Fixes MASA metadata copying to renderer. */ +#define FIX_392_LATE_REVERB /* DLB : Issue 392: keep late reverb by default off when output config is not BINAURAL_ROOM*/ #define FIX_ISM_DTX_CLICKS /* FhG: fix for clicks in ISM DTX for inactive to active TCX transitions */ diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 43cdc343c9..144f7950e9 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -421,7 +421,8 @@ ivas_error stereo_memory_dec( deallocate_CoreCoder( hCPE->hCoreCoder[1] ); /* allocate DFT stereo data structure */ - if ( ( error = stereo_dft_dec_create( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, 0, nchan_transport ) ) != IVAS_ERR_OK ) + if ( ( error = stereo_dft_dec_create( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, 0, + nchan_transport ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index a1410c482e..46fa4f2834 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -999,7 +999,7 @@ ivas_error IVAS_DEC_FeedCustomLsData( ) { int16_t i, is_planar; - IVAS_LSSETUP_CUSTOM_HANDLE hLsSetupCustom; + IVAS_LSSETUP_CUSTOM_STRUCT *hLsSetupCustom; if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 5a4d31d313..3d2420632d 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3657,11 +3657,20 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_InitConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ +#ifdef FIX_392_LATE_REVERB + const IVAS_REND_AudioConfig outAudioConfig /* i : output audioConfig */ +#else const bool rendererConfigEnabled /* i : flag indicating if a renderer configuration file was supplied */ +#endif ) { ivas_error error; +#ifdef FIX_392_LATE_REVERB + bool rendererConfigEnabled; + + rendererConfigEnabled = ( getAudioConfigType( outAudioConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ); +#endif if ( rendererConfigEnabled ) { @@ -3678,8 +3687,11 @@ ivas_error IVAS_REND_InitConfig( { return error; } - +#ifdef FIX_392_LATE_REVERB + if ( ( error = ivas_render_config_init_from_rom( &hIvasRend->hRendererConfig, outAudioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_render_config_init_from_rom( &hIvasRend->hRendererConfig, hIvasRend->rendererConfigEnabled ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 99b33dc381..ec4c05a6d6 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -228,8 +228,12 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( ); ivas_error IVAS_REND_InitConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const bool rendererConfigEnabled /* i : flag indicating if a renderer configuration file was supplied */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ +#ifdef FIX_392_LATE_REVERB + const IVAS_REND_AudioConfig outAudioConfig /* i : output audioConfig */ +#else + const bool rendererConfigEnabled /* i : flag indicating if a renderer configuration file was supplied */ +#endif ); int16_t IVAS_REND_GetRenderConfig( -- GitLab From fb1c11f14d340095b7ba349108b7008bb00738f3 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 19 Apr 2023 10:26:05 +0200 Subject: [PATCH 6/6] revert removal of typedef struct ivas_LS_setup_custom *IVAS_LSSETUP_CUSTOM_HANDLE; --- lib_com/common_api_types.h | 3 ++- lib_dec/lib_dec.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 756a8b20ee..3e012a6f99 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -47,7 +47,7 @@ #define IVAS_MAX_BITS_PER_FRAME ( 512000 / 50 ) #define IVAS_MAX_NUM_OBJECTS 4 #define IVAS_MAX_OUTPUT_CHANNELS 16 -#define IVAS_CLDFB_NO_CHANNELS_MAX 60 +#define IVAS_CLDFB_NO_CHANNELS_MAX ( 60 ) #define IVAS_MAX_INPUT_LFE_CHANNELS 4 #define RENDERER_HEAD_POSITIONS_PER_FRAME 4 @@ -161,6 +161,7 @@ typedef struct _IVAS_LS_CUSTOM_LAYOUT } IVAS_CUSTOM_LS_DATA; +typedef struct ivas_LS_setup_custom *IVAS_LSSETUP_CUSTOM_HANDLE; typedef struct ivas_LS_setup_custom IVAS_LSSETUP_CUSTOM_STRUCT; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 46fa4f2834..a1410c482e 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -999,7 +999,7 @@ ivas_error IVAS_DEC_FeedCustomLsData( ) { int16_t i, is_planar; - IVAS_LSSETUP_CUSTOM_STRUCT *hLsSetupCustom; + IVAS_LSSETUP_CUSTOM_HANDLE hLsSetupCustom; if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { -- GitLab