From f2dbf8ec73daeaeb6bf1a2591190cdd56b66378f Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 12 May 2023 16:35:47 +0200 Subject: [PATCH 1/5] fix indexing of DoA arrays for head rotation in DirAC --- lib_dec/ivas_dirac_dec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 73c8dcf12e..2cc3d15fec 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2572,8 +2572,7 @@ void ivas_dirac_dec( num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) { - index_slot = subframe_idx * hDirAC->subframe_nbslots + slot_idx; - /* Todo: This access to azimuth & elevation may use wrong indices as access should probably be based on hDirAC->dirac_read_idx */ + index_slot = ( hDirAC->dirac_read_idx + slot_idx ) % hDirAC->dirac_md_buffer_length; rotateAziEle_DirAC( hDirAC->azimuth[index_slot], hDirAC->elevation[index_slot], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); } } -- GitLab From 8c81788184d2d84514a7b6b506db17fb6d045abd Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 15 May 2023 08:35:41 +0200 Subject: [PATCH 2/5] wrap changes into the new switch FIX_642 --- lib_com/options.h | 2 ++ lib_dec/ivas_dirac_dec.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index e68aca0ef1..b13da21142 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -216,6 +216,8 @@ #define COMPLEXITY_LEVEL_INDICATION +#define FIX_642 /* FhG: Fix for usse 642, buggy DoA-array access in DirAC head rotation*/ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 2cc3d15fec..88bdd4dda5 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2572,7 +2572,11 @@ void ivas_dirac_dec( num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) { +#ifndef FIX_642 + index_slot = subframe_idx * hDirAC->subframe_nbslots + slot_idx; +#else index_slot = ( hDirAC->dirac_read_idx + slot_idx ) % hDirAC->dirac_md_buffer_length; +#endif rotateAziEle_DirAC( hDirAC->azimuth[index_slot], hDirAC->elevation[index_slot], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); } } -- GitLab From 38ae0a6d3928009b87accbbad616b29b46142e3a Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 15 May 2023 13:29:56 +0200 Subject: [PATCH 3/5] fix compiler warning --- lib_dec/ivas_dirac_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 5c574713da..7581d8e352 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3017,7 +3017,7 @@ void ivas_dirac_dec_render_sf( #endif } } -#ifdef JBM_TSM_ON_TCS +#if defined( JBM_TSM_ON_TCS ) & !defined( FIX_642) else if ( !st_ivas->hHeadTrackData ) #else else -- GitLab From c2158e6511c52b286b9c9602c702c31d03c3bcab Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 15 May 2023 14:08:01 +0200 Subject: [PATCH 4/5] fix asan error in DirAC head rotation --- lib_dec/ivas_dirac_dec.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 7581d8e352..3d7b2bfc58 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2995,15 +2995,11 @@ void ivas_dirac_dec_render_sf( { num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; #ifdef JBM_TSM_ON_TCS -#ifndef FIX_642 for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) -#endif #else for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) #endif -#ifndef FIX_642 { -#endif #ifdef JBM_TSM_ON_TCS rotateAziEle_DirAC( azimuth[slot_idx], elevation[slot_idx], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); #else @@ -3012,9 +3008,7 @@ void ivas_dirac_dec_render_sf( /* Todo: This access to azimuth & elevation may use wrong indices as access should probably be based on hDirAC->dirac_read_idx */ rotateAziEle_DirAC( hDirAC->azimuth[index_slot], hDirAC->elevation[index_slot], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); #endif -#ifndef FIX_642 } -#endif } } #if defined( JBM_TSM_ON_TCS ) & !defined( FIX_642) -- GitLab From 073374813acad115285dbffd0576ab2e7190916f Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 15 May 2023 14:27:30 +0200 Subject: [PATCH 5/5] fix formatting --- lib_dec/ivas_dirac_dec.c | 200 +++++++++++++++++++-------------------- 1 file changed, 100 insertions(+), 100 deletions(-) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 3d7b2bfc58..cb7c9f5b9a 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -268,7 +268,7 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { - hDirAC->slot_size = ( int16_t )( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); + hDirAC->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); #ifdef JBM_TSM_ON_TCS set_s( hDirAC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); set_s( hDirAC->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); @@ -277,7 +277,7 @@ ivas_error ivas_dirac_dec_config( hDirAC->slots_rendered = 0; hDirAC->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; #else - hDirAC->subframe_nbslots = ( int16_t )( CLDFB_NO_COL_MAX * 5.f / 20.f + 0.5f ); + hDirAC->subframe_nbslots = (int16_t) ( CLDFB_NO_COL_MAX * 5.f / 20.f + 0.5f ); hDirAC->nb_subframes = CLDFB_NO_COL_MAX / hDirAC->subframe_nbslots; assert( hDirAC->nb_subframes <= MAX_PARAM_SPATIAL_SUBFRAMES ); #endif @@ -374,7 +374,7 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { - hDirAC->num_freq_bands = ( int16_t )( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); + hDirAC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); if ( ( hDirAC->frequency_axis = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); @@ -1886,7 +1886,7 @@ void ivas_dirac_dec_read_BS( if ( !st->bfi && ivas_total_brate > IVAS_SID_5k2 ) { next_bit_pos_orig = st->next_bit_pos; - st->next_bit_pos = ( int16_t )( ivas_total_brate / FRAMES_PER_SEC - 1 ); + st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 ); /* 1 bit flag for signaling metadata to read */ b = st->bit_stream[( st->next_bit_pos )--]; @@ -1990,7 +1990,7 @@ void ivas_dirac_dec_read_BS( next_bit_pos_orig = st->next_bit_pos; /* subtract mode signaling bits, since bitstream was moved after mode reading */ - st->next_bit_pos = ( int16_t )( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS ); + st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS ); /* 1 bit flag for SPAR/DirAC, already read in read format function */ b = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits )++; @@ -2417,14 +2417,14 @@ void ivas_qmetadata_to_dirac( #ifdef HODIRAC if ( hodirac ) { - azi = ( int16_t )( azimuth + 0.5f ); - ele = ( int16_t )( elevation + 0.5f ); + azi = (int16_t) ( azimuth + 0.5f ); + ele = (int16_t) ( elevation + 0.5f ); } else #endif { - azi = ( int16_t )( azimuth + rand_triangular_signed( seed_ptr ) * dirac_dithering_azi_scale[diff_idx] + 0.5f ); - ele = ( int16_t )( elevation + rand_triangular_signed( seed_ptr ) * dirac_dithering_ele_scale[diff_idx] + 0.5f ); + azi = (int16_t) ( azimuth + rand_triangular_signed( seed_ptr ) * dirac_dithering_azi_scale[diff_idx] + 0.5f ); + ele = (int16_t) ( elevation + rand_triangular_signed( seed_ptr ) * dirac_dithering_ele_scale[diff_idx] + 0.5f ); /* limit the elevation to [-90, 90] */ ele = min( 90, ele ); ele = max( -90, ele ); @@ -2878,10 +2878,10 @@ void ivas_dirac_dec_render_sf( { for ( i = 0; i < output_frame; i++ ) { - tmp[nchan_transport * i + n] = ( int16_t )( output_f[n][i] + 0.5f ); + tmp[nchan_transport * i + n] = (int16_t) ( output_f[n][i] + 0.5f ); } } - sprintf( file_name, "./res/ivas_dirac_dec_DMX%d.%d.pcm", nchan_transport, ( int16_t )( output_frame * 0.05 ) ); + sprintf( file_name, "./res/ivas_dirac_dec_DMX%d.%d.pcm", nchan_transport, (int16_t) ( output_frame * 0.05 ) ); dbgwrite( tmp, sizeof( int16_t ), nchan_transport * output_frame, 1, file_name ); } #endif @@ -2978,13 +2978,13 @@ void ivas_dirac_dec_render_sf( } #ifdef JBM_TSM_ON_TCS - if ( st_ivas->hHeadTrackData + if ( st_ivas->hHeadTrackData #ifndef FIX_642 - && st_ivas->hDecoderConfig->voip_active == 1 + && st_ivas->hDecoderConfig->voip_active == 1 #endif - ) + ) #else - if ( st_ivas->hHeadTrackData ) + if ( st_ivas->hHeadTrackData ) #endif { QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], st_ivas->hHeadTrackData->Rmat ); @@ -2997,24 +2997,24 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) #else - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) #endif { #ifdef JBM_TSM_ON_TCS rotateAziEle_DirAC( azimuth[slot_idx], elevation[slot_idx], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); #else - /* note, this seems wrong since it does not take the dirac read ptr into account */ - index_slot = subframe_idx * hDirAC->subframe_nbslots + slot_idx; - /* Todo: This access to azimuth & elevation may use wrong indices as access should probably be based on hDirAC->dirac_read_idx */ - rotateAziEle_DirAC( hDirAC->azimuth[index_slot], hDirAC->elevation[index_slot], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); + /* note, this seems wrong since it does not take the dirac read ptr into account */ + index_slot = subframe_idx * hDirAC->subframe_nbslots + slot_idx; + /* Todo: This access to azimuth & elevation may use wrong indices as access should probably be based on hDirAC->dirac_read_idx */ + rotateAziEle_DirAC( hDirAC->azimuth[index_slot], hDirAC->elevation[index_slot], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); #endif } } } -#if defined( JBM_TSM_ON_TCS ) & !defined( FIX_642) +#if defined( JBM_TSM_ON_TCS ) & !defined( FIX_642 ) else if ( !st_ivas->hHeadTrackData ) #else - else + else #endif { p_Rmat = 0; @@ -3030,7 +3030,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS diffuseness_vector[0], #else - hDirAC->diffuseness_vector[hDirAC->dirac_read_idx], + hDirAC->diffuseness_vector[hDirAC->dirac_read_idx], #endif hDirAC->h_output_synthesis_psd_params.max_band_decorr, hDirAC->h_output_synthesis_psd_state.direct_power_factor, @@ -3044,7 +3044,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS surCohEner = hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] * hDirAC->surroundingCoherence[md_idx][i]; #else - surCohEner = hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] * hDirAC->surroundingCoherence[hDirAC->dirac_read_idx][i]; + surCohEner = hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] * hDirAC->surroundingCoherence[hDirAC->dirac_read_idx][i]; #endif hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] -= surCohEner; hDirAC->h_output_synthesis_psd_state.direct_power_factor[i] += surCohEner; @@ -3063,7 +3063,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS hDirAC->diffuseness_vector[md_idx], #else - hDirAC->diffuseness_vector[hDirAC->dirac_read_idx], + hDirAC->diffuseness_vector[hDirAC->dirac_read_idx], #endif hDirAC->h_output_synthesis_psd_params.max_band_decorr, hDirAC->h_output_synthesis_psd_state.direct_power_factor, @@ -3076,7 +3076,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS surCohRatio[i] = hDirAC->surroundingCoherence[md_idx][i]; #else - surCohRatio[i] = hDirAC->surroundingCoherence[hDirAC->dirac_read_idx][i]; + surCohRatio[i] = hDirAC->surroundingCoherence[hDirAC->dirac_read_idx][i]; #endif } } @@ -3131,7 +3131,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) #else - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) #endif { #ifdef JBM_TSM_ON_TCS @@ -3145,7 +3145,7 @@ void ivas_dirac_dec_render_sf( md_idx = hDirAC->render_to_md_map[subframe_idx]; } #else - index_slot = subframe_idx * hDirAC->subframe_nbslots + slot_idx; + index_slot = subframe_idx * hDirAC->subframe_nbslots + slot_idx; #endif if ( st_ivas->sba_mode == SBA_MODE_SPAR ) @@ -3177,17 +3177,17 @@ void ivas_dirac_dec_render_sf( #endif #else #ifdef SPAR_TUNING - cldfbAnalysis_ts( &( output_f[hDirAC->sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), - Cldfb_RealBuffer[ch][0], - Cldfb_ImagBuffer[ch][0], - hDirAC->num_freq_bands, - st_ivas->cldfbAnaDec[ch] ); + cldfbAnalysis_ts( &( output_f[hDirAC->sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), + Cldfb_RealBuffer[ch][0], + Cldfb_ImagBuffer[ch][0], + hDirAC->num_freq_bands, + st_ivas->cldfbAnaDec[ch] ); #else - cldfbAnalysis_ts( &( output_f[sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), - Cldfb_RealBuffer[ch][0], - Cldfb_ImagBuffer[ch][0], - hDirAC->num_freq_bands, - st_ivas->cldfbAnaDec[ch] ); + cldfbAnalysis_ts( &( output_f[sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), + Cldfb_RealBuffer[ch][0], + Cldfb_ImagBuffer[ch][0], + hDirAC->num_freq_bands, + st_ivas->cldfbAnaDec[ch] ); #endif #endif @@ -3204,7 +3204,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS st_ivas->hTcBuffer->tc[1], #else - &( output_f[1][L_FRAME48k - L_FRAME16k] ), + &( output_f[1][L_FRAME48k - L_FRAME16k] ), #endif Cldfb_RealBuffer[1][0], Cldfb_ImagBuffer[1][0], @@ -3223,7 +3223,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS md_idx, #else - subframe_idx, + subframe_idx, #endif nchan_transport ); } @@ -3340,8 +3340,8 @@ void ivas_dirac_dec_render_sf( azimuth[slot_idx], elevation[slot_idx] #else - hDirAC->azimuth[hDirAC->dirac_estimator_idx], - hDirAC->elevation[hDirAC->dirac_estimator_idx] + hDirAC->azimuth[hDirAC->dirac_estimator_idx], + hDirAC->elevation[hDirAC->dirac_estimator_idx] #endif ); @@ -3353,7 +3353,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS diffuseness_vector[slot_idx] #else - hDirAC->diffuseness_vector[hDirAC->dirac_estimator_idx] + hDirAC->diffuseness_vector[hDirAC->dirac_estimator_idx] #endif ); @@ -3524,47 +3524,47 @@ void ivas_dirac_dec_render_sf( ); } #else - if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order > 0 ) - { - ivas_dirac_dec_output_synthesis_process_slot( reference_power, - p_onset_filter, - azimuth[slot_idx], - elevation[slot_idx], - diffuseness_vector[slot_idx], - hDirAC, - st_ivas->hHeadTrackData->shd_rot_max_order, - p_Rmat, - st_ivas->hVBAPdata, - hDirAC->hOutSetup, - nchan_transport, - md_idx, + if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order > 0 ) + { + ivas_dirac_dec_output_synthesis_process_slot( reference_power, + p_onset_filter, + azimuth[slot_idx], + elevation[slot_idx], + diffuseness_vector[slot_idx], + hDirAC, + st_ivas->hHeadTrackData->shd_rot_max_order, + p_Rmat, + st_ivas->hVBAPdata, + hDirAC->hOutSetup, + nchan_transport, + md_idx, #ifdef HODIRAC - st_ivas->sba_analysis_order > 1 && - st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k + st_ivas->sba_analysis_order > 1 && + st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k #endif - ); - } - else - { - ivas_dirac_dec_output_synthesis_process_slot( reference_power, - p_onset_filter, - azimuth[slot_idx], - elevation[slot_idx], - diffuseness_vector[slot_idx], - hDirAC, - 0, - 0, - st_ivas->hVBAPdata, - hDirAC->hOutSetup, - nchan_transport, - md_idx, + ); + } + else + { + ivas_dirac_dec_output_synthesis_process_slot( reference_power, + p_onset_filter, + azimuth[slot_idx], + elevation[slot_idx], + diffuseness_vector[slot_idx], + hDirAC, + 0, + 0, + st_ivas->hVBAPdata, + hDirAC->hOutSetup, + nchan_transport, + md_idx, #ifdef HODIRAC - st_ivas->sba_analysis_order > 1 && - st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k + st_ivas->sba_analysis_order > 1 && + st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k #endif - ); - } + ); + } #endif if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) @@ -3687,7 +3687,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS index_slot = slot_idx_start_cldfb_synth; #else - index_slot = subframe_idx * hDirAC->subframe_nbslots; + index_slot = subframe_idx * hDirAC->subframe_nbslots; #endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) @@ -3713,7 +3713,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) #else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) #endif { RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; @@ -3727,11 +3727,11 @@ void ivas_dirac_dec_render_sf( hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); #else - cldfbSynthesis( RealBuffer, - ImagBuffer, - &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), - hDirAC->num_freq_bands * hDirAC->subframe_nbslots, - st_ivas->cldfbSynDec[ch] ); + cldfbSynthesis( RealBuffer, + ImagBuffer, + &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), + hDirAC->num_freq_bands * hDirAC->subframe_nbslots, + st_ivas->cldfbSynDec[ch] ); #endif } } @@ -3742,7 +3742,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) #else - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) #endif { mvr2r( Cldfb_RealBuffer[ch][slot_idx], pppQMfFrame_ts_re[ch][slot_idx], hDirAC->num_freq_bands ); @@ -3778,7 +3778,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS const int16_t num_samples_subframe = hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx]; #else - const int16_t num_samples_subframe = hDirAC->num_freq_bands * hDirAC->subframe_nbslots; + const int16_t num_samples_subframe = hDirAC->num_freq_bands * hDirAC->subframe_nbslots; #endif /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */ @@ -3809,7 +3809,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) #else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) #endif { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; @@ -3839,7 +3839,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) #else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) #endif { RealBuffer[i] = Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][i]; @@ -3848,7 +3848,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[hDirAC->hOutSetup.nchan_out_woLFE + idx_lfe] ); #else - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots, st_ivas->cldfbSynDec[hDirAC->hOutSetup.nchan_out_woLFE + idx_lfe] ); + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots, st_ivas->cldfbSynDec[hDirAC->hOutSetup.nchan_out_woLFE + idx_lfe] ); #endif } else if ( st_ivas->mc_mode == MC_MODE_MCMASA && hDirAC->hOutSetup.separateChannelEnabled ) @@ -3860,7 +3860,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS set_zero( &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots[subframe_idx] * hDirAC->num_freq_bands ); #else - set_zero( &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots * hDirAC->num_freq_bands ); + set_zero( &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots * hDirAC->num_freq_bands ); #endif } @@ -3880,7 +3880,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) #else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) #endif { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; @@ -3889,7 +3889,7 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[idx_in] ); #else - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots, st_ivas->cldfbSynDec[idx_in] ); + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots, st_ivas->cldfbSynDec[idx_in] ); #endif idx_in++; } @@ -4629,8 +4629,8 @@ static void protoSignalComputation4( proto_frame_f[2 * l * num_freq_bands + 2 * k] += RealBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc_ind[n]]; proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] += ImagBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc_ind[n]]; #else - proto_frame_f[2 * l * num_freq_bands + 2 * k] += RealBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc[n]]; - proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] += ImagBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc[n]]; + proto_frame_f[2 * l * num_freq_bands + 2 * k] += RealBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc[n]]; + proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] += ImagBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc[n]]; #endif } } @@ -4773,8 +4773,8 @@ static void computeDirectionAngles( z = *( intensity_real_z++ ) * intensityNorm; } radius = sqrtf( x * x + y * y ); - azimuth[k] = ( int16_t )( max( -180.0f, min( 180.0f, atan2f( y, x ) / EVS_PI * 180.0f ) ) + 0.5f ); - elevation[k] = ( int16_t )( max( -90.0f, min( 180.0f, atan2f( z, radius ) / EVS_PI * 180.0f ) ) + 0.5f ); + azimuth[k] = (int16_t) ( max( -180.0f, min( 180.0f, atan2f( y, x ) / EVS_PI * 180.0f ) ) + 0.5f ); + elevation[k] = (int16_t) ( max( -90.0f, min( 180.0f, atan2f( z, radius ) / EVS_PI * 180.0f ) ) + 0.5f ); } return; @@ -5059,8 +5059,8 @@ static void rotateAziEle_DirAC( dv_r_2 = p_Rmat[6] * dv_0 + p_Rmat[7] * dv_1 + p_Rmat[8] * dv_2; /*Conversion spherical to cartesian coordinates*/ - azi[b] = ( int16_t )( atan2f( dv_r_1, dv_r_0 ) * _180_OVER_PI ); - ele[b] = ( int16_t )( atan2f( dv_r_2, sqrtf( dv_r_0 * dv_r_0 + dv_r_1 * dv_r_1 ) ) * _180_OVER_PI ); + azi[b] = (int16_t) ( atan2f( dv_r_1, dv_r_0 ) * _180_OVER_PI ); + ele[b] = (int16_t) ( atan2f( dv_r_2, sqrtf( dv_r_0 * dv_r_0 + dv_r_1 * dv_r_1 ) ) * _180_OVER_PI ); } pop_wmops(); -- GitLab