From e0e56caf8c868a8985b7e7bf0a2a5d59f6ae9b3e Mon Sep 17 00:00:00 2001 From: szczerba Date: Mon, 10 Oct 2022 16:46:37 +0200 Subject: [PATCH 001/375] Fix for orientation tracking in Crend --- lib_com/ivas_prot.h | 9 +++++++++ lib_com/options.h | 1 + lib_dec/ivas_crend.c | 3 +++ lib_dec/ivas_orient_trk.c | 5 +++++ lib_dec/ivas_rotation.c | 31 +++++++++++++++++++++++++++++++ 5 files changed, 49 insertions(+) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index fabcc5a0ed..d35423f75d 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4516,6 +4516,15 @@ void Quat2Euler( float *roll /* o : roll */ ); +#ifdef FIX_I109_ORIENTATION_TRACKING +void Euler2Quat( + const float yaw, /* i : yaw */ + const float pitch, /* i : pitch */ + const float roll, /* i : roll */ + Quaternion *quat /* o : quaternion describing the rotation */ +); +#endif + void rotateAziEle( float azi_in, /* i : output elevation */ float ele_in, /* i : input elevation */ diff --git a/lib_com/options.h b/lib_com/options.h index 5d0e0c6088..029f662b61 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,6 +149,7 @@ #define SPAR_SCALING_HARMONIZATION /* Issue 80: Changes to harmonize scaling in spar */ #define FIX_I98_HANDLES_TO_NULL /* Issue 98: do the setting of all handles to NULL in one place */ #define FIX_I102_SWB_TBE_SWITCH /* Issue 102: avoid IO->SWB switching code for IVAS, generate SHB ACB mem with lerp in case of switch */ +#define FIX_I109_ORIENTATION_TRACKING /* Issue 109: Harmonize head and orientation tracking */ #define FIX_DIRAC_CHANNELS /* Issue 71: lower number of DirAC analysis channels */ #define HARMONIZE_SBA_NCHAN_TRANSPORT /* harmonize setting of number of transport channels in SBA */ #define FIX_I13_TCX_TNS_ISSUE /* Issue 13: Fix reported artifacts. Bug in TNS with TCX5 */ diff --git a/lib_dec/ivas_crend.c b/lib_dec/ivas_crend.c index 796c4a9ed4..50b32aa1d1 100644 --- a/lib_dec/ivas_crend.c +++ b/lib_dec/ivas_crend.c @@ -1065,6 +1065,9 @@ ivas_error ivas_crend_process( ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hCrend->hTrack, st_ivas->hCrend->m_fYaw, st_ivas->hCrend->m_fPitch, st_ivas->hCrend->m_fRoll ); ivas_orient_trk_Process( st_ivas->hCrend->hTrack ); ivas_orient_trk_GetTrackedOrientation( st_ivas->hCrend->hTrack, &( st_ivas->hCrend->m_fYaw ), &( st_ivas->hCrend->m_fPitch ), &( st_ivas->hCrend->m_fRoll ) ); +#ifdef FIX_I109_ORIENTATION_TRACKING + Euler2Quat( st_ivas->hCrend->m_fYaw, st_ivas->hCrend->m_fPitch, st_ivas->hCrend->m_fRoll, &st_ivas->hHeadTrackData->Quaternions[subframe_idx] ); +#endif } /* Rotation in SHD for: diff --git a/lib_dec/ivas_orient_trk.c b/lib_dec/ivas_orient_trk.c index 4754062b56..858a77ae09 100644 --- a/lib_dec/ivas_orient_trk.c +++ b/lib_dec/ivas_orient_trk.c @@ -50,8 +50,13 @@ #define MAX_TRACKED_ANGLE_AVG_ORIENT PI_OVER_2 #define MAX_TRACKED_ANGLE_REF_ORIENT EVS_PI +#ifdef FIX_I109_ORIENTATION_TRACKING +/* TODO relate to frame rate - assumed here 200Hz, i.e. 5ms frame length */ +#define OTR_UPDATE_RATE ( 200.0f ) /* rate of the Process() calls [Hz]; 1x per IVAS frame */ +#else /* TODO relate to frame rate - assumed here 50Hz, i.e. 20ms frame length */ #define OTR_UPDATE_RATE ( 50.0f ) /* rate of the Process() calls [Hz]; 1x per IVAS frame */ +#endif /*------------------------------------------------------------------------------------------* diff --git a/lib_dec/ivas_rotation.c b/lib_dec/ivas_rotation.c index 77809d8270..255568039b 100644 --- a/lib_dec/ivas_rotation.c +++ b/lib_dec/ivas_rotation.c @@ -201,6 +201,37 @@ void Quat2Euler( return; } +#ifdef FIX_I109_ORIENTATION_TRACKING +/*------------------------------------------------------------------------- + * Quat2Euler() + * + * Euler handling: calculate corresponding Quaternions + *------------------------------------------------------------------------*/ + +void Euler2Quat( + const float yaw, /* i : yaw */ + const float pitch, /* i : pitch */ + const float roll, /* i : roll */ + Quaternion *quat /* o : quaternion describing the rotation */ +) +{ + float cos_y_2, sin_y_2, cos_p_2, sin_p_2, cos_r_2, sin_r_2; + cos_y_2 = cosf( yaw * 0.5f ); + sin_y_2 = sinf( yaw * 0.5f ); + cos_p_2 = cosf( pitch * 0.5f ); + sin_p_2 = sinf( pitch * 0.5f ); + cos_r_2 = cosf( roll * 0.5f ); + sin_r_2 = sinf( roll * 0.5f ); + + quat->w = cos_y_2 * cos_p_2 * cos_r_2 + sin_y_2 * sin_p_2 * sin_r_2; + quat->x = cos_y_2 * cos_p_2 * sin_r_2 - sin_y_2 * sin_p_2 * cos_r_2; + quat->y = cos_y_2 * sin_p_2 * cos_r_2 + sin_y_2 * cos_p_2 * sin_r_2; + quat->z = sin_y_2 * cos_p_2 * cos_r_2 - cos_y_2 * sin_p_2 * sin_r_2; + + return; +} + +#endif /*------------------------------------------------------------------------- * rotateAziEle() -- GitLab From b10ca102b3578217a632f4b1423fb426f30ff5bc Mon Sep 17 00:00:00 2001 From: szczerba Date: Mon, 10 Oct 2022 17:15:56 +0200 Subject: [PATCH 002/375] Orientation tracking in all modes except ISM --- lib_com/ivas_prot.h | 13 +++ lib_dec/ivas_binauralRenderer.c | 11 ++ lib_dec/ivas_crend.c | 11 +- lib_dec/ivas_dirac_dec.c | 12 +++ lib_dec/ivas_dirac_dec_binaural_functions.c | 12 +++ lib_dec/ivas_init_dec.c | 18 ++++ lib_dec/ivas_rotation.c | 106 ++++++++++++++++++++ lib_dec/ivas_stat_dec.h | 39 ++++++- 8 files changed, 217 insertions(+), 5 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index d35423f75d..a5b3bdc661 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4523,6 +4523,13 @@ void Euler2Quat( const float roll, /* i : roll */ Quaternion *quat /* o : quaternion describing the rotation */ ); + +void Euler2RotMat( + const float yaw, /* i : yaw */ + const float pitch, /* i : pitch */ + const float roll, /* i : roll */ + float Rmat[3][3] /* o : real-space rotation matrix for this rotation */ +); #endif void rotateAziEle( @@ -4546,6 +4553,12 @@ ivas_error ivas_headTrack_open( HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* o : head track handle */ ); +#ifdef FIX_I109_ORIENTATION_TRACKING +void ivas_headTrack_close( + HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* i/o: head track handle */ +); +#endif + void rotateFrame_shd( HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ float output[][L_FRAME48k], /* i/o: unrotated HOA3 signal buffer in TD */ diff --git a/lib_dec/ivas_binauralRenderer.c b/lib_dec/ivas_binauralRenderer.c index b3d298b562..bc5f0ee360 100644 --- a/lib_dec/ivas_binauralRenderer.c +++ b/lib_dec/ivas_binauralRenderer.c @@ -912,6 +912,9 @@ void ivas_binRenderer( { int16_t chIdx, k; int16_t numTimeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; +#ifdef FIX_I109_ORIENTATION_TRACKING + float yaw, pitch, roll; +#endif wmops_sub_start( "fastconv_binaural_rendering" ); @@ -934,7 +937,15 @@ void ivas_binRenderer( /* Rotation in SHD (HOA3) */ if ( hHeadTrackData->shd_rot_max_order == -1 ) { +#ifdef FIX_I109_ORIENTATION_TRACKING + Quat2Euler( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], &( yaw ), &( pitch ), &( roll ) ); + ivas_orient_trk_SetAbsoluteOrientation( hHeadTrackData->OrientationTracker, yaw, pitch, roll ); + ivas_orient_trk_Process( hHeadTrackData->OrientationTracker ); + ivas_orient_trk_GetTrackedOrientation( hHeadTrackData->OrientationTracker, &( yaw ), &( pitch ), &( roll ) ); + Euler2RotMat( yaw, pitch, roll, hHeadTrackData->Rmat ); +#else QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); +#endif rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, 3 ); } diff --git a/lib_dec/ivas_crend.c b/lib_dec/ivas_crend.c index 50b32aa1d1..6b88e83bbd 100644 --- a/lib_dec/ivas_crend.c +++ b/lib_dec/ivas_crend.c @@ -689,10 +689,12 @@ ivas_error ivas_crend_open( hCrend->hReverb = NULL; hCrend->delay_line_rw_index = 0; hCrend->diffuse_delay_line_rw_index = 0; +#ifndef FIX_I109_ORIENTATION_TRACKING hCrend->hTrack = NULL; hCrend->m_fYaw = 0; hCrend->m_fPitch = 0; hCrend->m_fRoll = 0; +#endif hHrtf = st_ivas->hHrtf; @@ -760,6 +762,7 @@ ivas_error ivas_crend_open( hCrend->lfe_delay_line = NULL; } +#ifndef FIX_I109_ORIENTATION_TRACKING if ( st_ivas->hDecoderConfig->Opt_Headrotation ) { if ( ( hCrend->hTrack = (ivas_orient_trk_state_t *) count_malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) @@ -773,6 +776,7 @@ ivas_error ivas_crend_open( { hCrend->hTrack = NULL; } +#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->ivas_format == MC_FORMAT && st_ivas->hDecoderConfig->Opt_Headrotation ) { @@ -865,11 +869,13 @@ ivas_error ivas_crend_close( st_ivas->hCrend->freq_buffer_im_diffuse = NULL; } +#ifndef FIX_I109_ORIENTATION_TRACKING if ( st_ivas->hCrend->hTrack != NULL ) { count_free( st_ivas->hCrend->hTrack ); st_ivas->hCrend->hTrack = NULL; } +#endif } ivas_reverb_close( &st_ivas->hCrend->hReverb ); @@ -1049,6 +1055,7 @@ ivas_error ivas_crend_process( if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ) { /* Orientation tracking */ +#ifndef FIX_I109_ORIENTATION_TRACKING if ( st_ivas->hCrend->hTrack != NULL ) { if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_AVG ) @@ -1065,10 +1072,8 @@ ivas_error ivas_crend_process( ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hCrend->hTrack, st_ivas->hCrend->m_fYaw, st_ivas->hCrend->m_fPitch, st_ivas->hCrend->m_fRoll ); ivas_orient_trk_Process( st_ivas->hCrend->hTrack ); ivas_orient_trk_GetTrackedOrientation( st_ivas->hCrend->hTrack, &( st_ivas->hCrend->m_fYaw ), &( st_ivas->hCrend->m_fPitch ), &( st_ivas->hCrend->m_fRoll ) ); -#ifdef FIX_I109_ORIENTATION_TRACKING - Euler2Quat( st_ivas->hCrend->m_fYaw, st_ivas->hCrend->m_fPitch, st_ivas->hCrend->m_fRoll, &st_ivas->hHeadTrackData->Quaternions[subframe_idx] ); -#endif } +#endif /* Rotation in SHD for: MC with elevation (5_1_2 / 5_1_4 / 7_1_4) -> BINAURAL diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index b4da8ef020..fd66a59063 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1791,6 +1791,10 @@ void ivas_dirac_dec( float *reference_power, *reference_power_smooth; float *onset_filter, *onset_filter_subframe, *p_onset_filter = NULL; uint16_t coherence_flag; + +#ifdef FIX_I109_ORIENTATION_TRACKING + float yaw, pitch, roll; +#endif wmops_sub_start( "ivas_dirac_dec" ); /* Initialize aux buffers */ @@ -1859,7 +1863,15 @@ void ivas_dirac_dec( if ( st_ivas->hHeadTrackData ) { +#ifdef FIX_I109_ORIENTATION_TRACKING + Quat2Euler( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], &( yaw ), &( pitch ), &( roll ) ); + ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hHeadTrackData->OrientationTracker, yaw, pitch, roll ); + ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker ); + ivas_orient_trk_GetTrackedOrientation( st_ivas->hHeadTrackData->OrientationTracker, &( yaw ), &( pitch ), &( roll ) ); + Euler2RotMat( yaw, pitch, roll, st_ivas->hHeadTrackData->Rmat ); +#else QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], st_ivas->hHeadTrackData->Rmat ); +#endif p_Rmat = &st_ivas->hHeadTrackData->Rmat[0][0]; diff --git a/lib_dec/ivas_dirac_dec_binaural_functions.c b/lib_dec/ivas_dirac_dec_binaural_functions.c index 94f5049542..f2d51f27ba 100644 --- a/lib_dec/ivas_dirac_dec_binaural_functions.c +++ b/lib_dec/ivas_dirac_dec_binaural_functions.c @@ -357,6 +357,10 @@ static void ivas_dirac_dec_binaural_internal( int16_t max_band_decorr; DIFFUSE_DISTRIBUTION_DATA diffuseDistData; +#ifdef FIX_I109_ORIENTATION_TRACKING + float yaw, pitch, roll; +#endif + firstSlot = firstSubframe * ( CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ); slotEnd = ( firstSubframe + nSubframes ) * ( CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ); @@ -495,7 +499,15 @@ static void ivas_dirac_dec_binaural_internal( if ( st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ) { +#ifdef FIX_I109_ORIENTATION_TRACKING + Quat2Euler( st_ivas->hHeadTrackData->Quaternions[firstSubframe], &( yaw ), &( pitch ), &( roll ) ); + ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hHeadTrackData->OrientationTracker, yaw, pitch, roll ); + ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker ); + ivas_orient_trk_GetTrackedOrientation( st_ivas->hHeadTrackData->OrientationTracker, &( yaw ), &( pitch ), &( roll ) ); + Euler2RotMat( yaw, pitch, roll, Rmat ); +#else QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[firstSubframe], Rmat ); +#endif if ( nchan_transport == 2 ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 2ccf1efdce..11110120a5 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -676,6 +676,20 @@ ivas_error ivas_init_decoder( } } +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( st_ivas->hDecoderConfig->Opt_Headrotation ) + { + if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_AVG ) + { + ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_AVG_ORIENT ); + } + else + { + ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_ORIENT ); + } + } +#endif + /*-----------------------------------------------------------------* * Allocate and initalize SCE/CPE and other handles *-----------------------------------------------------------------*/ @@ -1677,8 +1691,12 @@ void ivas_destroy_dec( /* Head track data handle */ if ( st_ivas->hHeadTrackData != NULL ) { +#ifdef FIX_I109_ORIENTATION_TRACKING + ivas_headTrack_close( &st_ivas->hHeadTrackData ); +#else count_free( st_ivas->hHeadTrackData ); st_ivas->hHeadTrackData = NULL; +#endif } /* Time Domain binaural renderer handle */ diff --git a/lib_dec/ivas_rotation.c b/lib_dec/ivas_rotation.c index 255568039b..2e936270e7 100644 --- a/lib_dec/ivas_rotation.c +++ b/lib_dec/ivas_rotation.c @@ -85,6 +85,13 @@ ivas_error ivas_headTrack_open( ( *hHeadTrackData )->lrSwitchInterpVal = 0.0f; ( *hHeadTrackData )->lrSwitchedCurrent = 0; ( *hHeadTrackData )->lrSwitchedNext = 0; +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( ( ( *hHeadTrackData )->OrientationTracker = (ivas_orient_trk_state_t *) count_malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); + } + ivas_orient_trk_Init( ( *hHeadTrackData )->OrientationTracker ); +#endif /* Initialise Rmat_prev to I, Rmat will be computed later */ for ( i = 0; i < 3; i++ ) @@ -96,6 +103,28 @@ ivas_error ivas_headTrack_open( return IVAS_ERR_OK; } +#ifdef FIX_I109_ORIENTATION_TRACKING +/*-----------------------------------------------------------------------* + * ivas_headTrack_closes() + * + * Deallocate Head-Tracking handle + *-----------------------------------------------------------------------*/ + +void ivas_headTrack_close( + HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* i/o: head track handle */ +) +{ + if ( hHeadTrackData != NULL ) + { + if ( ( *hHeadTrackData )->OrientationTracker != NULL ) + { + count_free( ( *hHeadTrackData )->OrientationTracker ); + } + count_free( ( *hHeadTrackData ) ); + *hHeadTrackData = NULL; + } +} +#endif /*---------------------------------------------------------------------------------- * QuatToRotMat() @@ -181,9 +210,15 @@ void Quat2Euler( { if ( quat.w != -3.0 ) { +#ifdef FIX_I109_ORIENTATION_TRACKING + *yaw = atan2f( 2.0f * ( quat.w * quat.z + quat.x * quat.y ), 1.0f - 2.0f * ( quat.y * quat.y + quat.z * quat.z ) ); + *pitch = asinf( 2.0f * ( quat.w * quat.y - quat.z * quat.x ) ); + *roll = atan2f( 2.0f * ( quat.w * quat.x + quat.y * quat.z ), 1.0f - 2.0f * ( quat.x * quat.x + quat.y * quat.y ) ); +#else *yaw = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) ); *roll = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) ); +#endif } else { @@ -231,6 +266,41 @@ void Euler2Quat( return; } +/*------------------------------------------------------------------------- + * Quat2Euler() + * + * Euler handling: calculate rotation matrices in real-space and SHD + *------------------------------------------------------------------------*/ +void Euler2RotMat( + const float yaw, /* i : yaw */ + const float pitch, /* i : pitch */ + const float roll, /* i : roll */ + float Rmat[3][3] /* o : real-space rotation matrix for this rotation */ +) +{ + float c_1, c_2, c_3; + float s_1, s_2, s_3; + + c_1 = cosf( yaw ); + c_2 = cosf( pitch ); + c_3 = cosf( roll ); + + s_1 = sinf( yaw ); + s_2 = sinf( pitch ); + s_3 = sinf( roll ); + + Rmat[0][0] = c_1 * c_2; + Rmat[0][1] = c_1 * s_2 * s_3 - s_1 * c_3; + Rmat[0][2] = c_1 * s_2 * c_3 + s_1 * s_3; + + Rmat[1][0] = s_1 * c_2; + Rmat[1][1] = s_1 * s_2 * s_3 + c_1 * c_3; + Rmat[1][2] = s_1 * s_2 * c_3 - c_1 * s_3; + + Rmat[2][0] = -s_2; + Rmat[2][1] = c_2 * s_3; + Rmat[2][2] = c_2 * c_3; +} #endif /*------------------------------------------------------------------------- @@ -349,6 +419,10 @@ void rotateFrame_shd( float SHrotmat[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM]; float cross_fade[IVAS_FB_1MS_48K_SAMP]; +#ifdef FIX_I109_ORIENTATION_TRACKING + float yaw, pitch, roll; +#endif + shd_rot_max_order = hTransSetup.ambisonics_order; /* 1ms linear crossfade */ @@ -366,8 +440,16 @@ void rotateFrame_shd( set_zero( SHrotmat[i], HEADROT_SHMAT_DIM ); } +#ifdef FIX_I109_ORIENTATION_TRACKING + Quat2Euler( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], &( yaw ), &( pitch ), &( roll ) ); + ivas_orient_trk_SetAbsoluteOrientation( hHeadTrackData->OrientationTracker, yaw, pitch, roll ); + ivas_orient_trk_Process( hHeadTrackData->OrientationTracker ); + ivas_orient_trk_GetTrackedOrientation( hHeadTrackData->OrientationTracker, &( yaw ), &( pitch ), &( roll ) ); + Euler2RotMat( yaw, pitch, roll, hHeadTrackData->Rmat ); +#else /* get next quaternion */ QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); +#endif /* calculate ambisonics rotation matrices for the previous and current frames */ SHrotmatgen( SHrotmat_prev, hHeadTrackData->Rmat_prev, shd_rot_max_order ); @@ -466,6 +548,10 @@ void rotateFrame_sd( float output_tmp[MAX_CICP_CHANNELS][L_FRAME48k]; float cross_fade[IVAS_FB_1MS_48K_SAMP]; +#ifdef FIX_I109_ORIENTATION_TRACKING + float yaw, pitch, roll; +#endif + wmops_sub_start( "rotateFrame_sd" ); nchan = hTransSetup.nchan_out_woLFE + hTransSetup.num_lfe; @@ -479,8 +565,16 @@ void rotateFrame_sd( cross_fade[i] = ( i + 1 ) * tmp; } +#ifdef FIX_I109_ORIENTATION_TRACKING + Quat2Euler( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], &( yaw ), &( pitch ), &( roll ) ); + ivas_orient_trk_SetAbsoluteOrientation( hHeadTrackData->OrientationTracker, yaw, pitch, roll ); + ivas_orient_trk_Process( hHeadTrackData->OrientationTracker ); + ivas_orient_trk_GetTrackedOrientation( hHeadTrackData->OrientationTracker, &( yaw ), &( pitch ), &( roll ) ); + Euler2RotMat( yaw, pitch, roll, hHeadTrackData->Rmat ); +#else /* Get next quaternion and calculate rotation matrix */ QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); +#endif for ( ch_in = 0; ch_in < nchan; ch_in++ ) { @@ -700,6 +794,10 @@ void rotateFrame_sd_cldfb( int16_t nInChannels; int16_t isPlanar; +#ifdef FIX_I109_ORIENTATION_TRACKING + float yaw, pitch, roll; +#endif + wmops_sub_start( "rotateFrame_sd_cldfb" ); nInChannels = hOutputSetup->nchan_out_woLFE; @@ -713,8 +811,16 @@ void rotateFrame_sd_cldfb( } } +#ifdef FIX_I109_ORIENTATION_TRACKING + Quat2Euler( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], &( yaw ), &( pitch ), &( roll ) ); + ivas_orient_trk_SetAbsoluteOrientation( hHeadTrackData->OrientationTracker, yaw, pitch, roll ); + ivas_orient_trk_Process( hHeadTrackData->OrientationTracker ); + ivas_orient_trk_GetTrackedOrientation( hHeadTrackData->OrientationTracker, &( yaw ), &( pitch ), &( roll ) ); + Euler2RotMat( yaw, pitch, roll, Rmat ); +#else /* Get next quaternion and calculate rotation matrix */ QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], Rmat ); +#endif /* rotation of Euler angles */ for ( n = 0; n < nInChannels; n++ ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 43a30693e6..5a465014fc 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1364,6 +1364,36 @@ typedef struct Quaternion_struct } Quaternion; +#ifdef FIX_I109_ORIENTATION_TRACKING +/* Orientation tracking structure */ +typedef struct ivas_orient_trk_state_t +{ + OTR_TRACKING_T trackingType; + float centerAdaptationRate; + float offCenterAdaptationRate; + float adaptationAngle; + + float alpha; + + float absYaw; /* absolute orientation */ + float absPitch; + float absRoll; + + float absAvgYaw; /* average absolute orientation */ + float absAvgPitch; + float absAvgRoll; + + float refYaw; /* reference orientation */ + float refPitch; + float refRoll; + + float trkYaw; /* tracked orientation */ + float trkPitch; + float trkRoll; + +} ivas_orient_trk_state_t; +#endif + typedef struct ivas_binaural_head_track_struct { int16_t num_quaternions; @@ -1376,6 +1406,9 @@ typedef struct ivas_binaural_head_track_struct float lrSwitchInterpVal; int16_t shd_rot_max_order; +#ifdef FIX_I109_ORIENTATION_TRACKING + ivas_orient_trk_state_t *OrientationTracker; +#endif } HEAD_TRACK_DATA, *HEAD_TRACK_DATA_HANDLE; @@ -1815,7 +1848,7 @@ typedef struct ivas_reverb_state_t } REVERB_DATA, *REVERB_HANDLE; - +#ifndef FIX_I109_ORIENTATION_TRACKING typedef struct ivas_orient_trk_state_t { OTR_TRACKING_T trackingType; @@ -1842,7 +1875,7 @@ typedef struct ivas_orient_trk_state_t float trkRoll; } ivas_orient_trk_state_t; - +#endif /* Crend structures */ typedef struct ivas_crend_state_t @@ -1853,10 +1886,12 @@ typedef struct ivas_crend_state_t float *freq_buffer_im_diffuse; float *prev_out_buffer[BINAURAL_CHANNELS]; float *lfe_delay_line; +#ifndef FIX_I109_ORIENTATION_TRACKING float m_fYaw; float m_fPitch; float m_fRoll; ivas_orient_trk_state_t *hTrack; +#endif REVERB_HANDLE hReverb; int16_t delay_line_rw_index; int16_t diffuse_delay_line_rw_index; -- GitLab From 1757186e8eceef04357002da469babcc1ef8306d Mon Sep 17 00:00:00 2001 From: szczerba Date: Mon, 24 Oct 2022 15:42:30 +0200 Subject: [PATCH 003/375] Orientation tracking processing in quaternions instead of Euler --- .../3.24.2/CompilerIdC/CMakeCCompilerId.c | 838 ++++++++++++++++++ lib_com/ivas_prot.h | 12 +- lib_dec/ivas_binauralRenderer.c | 9 +- lib_dec/ivas_dirac_dec.c | 11 +- lib_dec/ivas_dirac_dec_binaural_functions.c | 10 +- lib_dec/ivas_ism_renderer.c | 11 + lib_dec/ivas_objectRenderer.c | 12 + lib_dec/ivas_orient_trk.c | 227 ++++- lib_dec/ivas_rotation.c | 29 +- lib_dec/ivas_stat_dec.h | 19 +- 10 files changed, 1124 insertions(+), 54 deletions(-) create mode 100644 CMakeFiles/3.24.2/CompilerIdC/CMakeCCompilerId.c diff --git a/CMakeFiles/3.24.2/CompilerIdC/CMakeCCompilerId.c b/CMakeFiles/3.24.2/CompilerIdC/CMakeCCompilerId.c new file mode 100644 index 0000000000..2b43aa69b0 --- /dev/null +++ b/CMakeFiles/3.24.2/CompilerIdC/CMakeCCompilerId.c @@ -0,0 +1,838 @@ +#ifdef __cplusplus +# error "A C++ compiler has been selected for C." +#endif + +#if defined(__18CXX) +# define ID_VOID_MAIN +#endif +#if defined(__CLASSIC_C__) +/* cv-qualifiers did not exist in K&R C */ +# define const +# define volatile +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_C) +# define COMPILER_ID "SunPro" +# if __SUNPRO_C >= 0x5100 + /* __SUNPRO_C = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# endif + +#elif defined(__HP_cc) +# define COMPILER_ID "HP" + /* __HP_cc = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) + +#elif defined(__DECC) +# define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) + +#elif defined(__IBMC__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__open_xl__) && defined(__clang__) +# define COMPILER_ID "IBMClang" +# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__) +# define COMPILER_VERSION_MINOR DEC(__open_xl_release__) +# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__) + + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 +# define COMPILER_ID "XL" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TINYC__) +# define COMPILER_ID "TinyCC" + +#elif defined(__BCC__) +# define COMPILER_ID "Bruce" + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__)) +# define COMPILER_ID "LCC" +# define COMPILER_VERSION_MAJOR DEC(1) +# if defined(__LCC__) +# define COMPILER_VERSION_MINOR DEC(__LCC__- 100) +# endif +# if defined(__LCC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__) +# endif +# if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define SIMULATE_ID "GNU" +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif +# endif + +#elif defined(__GNUC__) +# define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(_ADI_COMPILER) +# define COMPILER_ID "ADSP" +#if defined(__VERSIONNUM__) + /* __VERSIONNUM__ = 0xVVRRPPTT */ +# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF) +# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF) +# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF) +# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + +#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) +# define COMPILER_ID "SDCC" +# if defined(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) +# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) +# else + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +# elif defined(_ADI_COMPILER) +# define PLATFORM_ID "ADSP" + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +# elif defined(__ADSPSHARC__) +# define ARCHITECTURE_ID "SHARC" + +# elif defined(__ADSPBLACKFIN__) +# define ARCHITECTURE_ID "Blackfin" + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#if !defined(__STDC__) && !defined(__clang__) +# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__) +# define C_VERSION "90" +# else +# define C_VERSION +# endif +#elif __STDC_VERSION__ > 201710L +# define C_VERSION "23" +#elif __STDC_VERSION__ >= 201710L +# define C_VERSION "17" +#elif __STDC_VERSION__ >= 201000L +# define C_VERSION "11" +#elif __STDC_VERSION__ >= 199901L +# define C_VERSION "99" +#else +# define C_VERSION "90" +#endif +const char* info_language_standard_default = + "INFO" ":" "standard_default[" C_VERSION "]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +#ifdef ID_VOID_MAIN +void main() {} +#else +# if defined(__CLASSIC_C__) +int main(argc, argv) int argc; char *argv[]; +# else +int main(int argc, char* argv[]) +# endif +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} +#endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index d6899ccf96..6ea17db6a8 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5503,10 +5503,14 @@ ivas_error ivas_orient_trk_SetTrackingType( ); ivas_error ivas_orient_trk_SetAbsoluteOrientation( - ivas_orient_trk_state_t *pOTR, + ivas_orient_trk_state_t *pOTR, +#ifdef FIX_I109_ORIENTATION_TRACKING + const Quaternion* pQuat +#else float yaw, float pitch, float roll +#endif ); ivas_error ivas_orient_trk_Process( @@ -5514,10 +5518,14 @@ ivas_error ivas_orient_trk_Process( ); ivas_error ivas_orient_trk_GetTrackedOrientation( - ivas_orient_trk_state_t *pOTR, + ivas_orient_trk_state_t *pOTR, +#ifdef FIX_I109_ORIENTATION_TRACKING + Quaternion *pQuat +#else float *yaw, float *pitch, float *roll +#endif ); void TonalMdctConceal_create_concealment_noise( diff --git a/lib_dec/ivas_binauralRenderer.c b/lib_dec/ivas_binauralRenderer.c index d954ae9e89..a9a762a7a0 100644 --- a/lib_dec/ivas_binauralRenderer.c +++ b/lib_dec/ivas_binauralRenderer.c @@ -874,7 +874,7 @@ void ivas_binRenderer( int16_t chIdx, k; int16_t numTimeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; #ifdef FIX_I109_ORIENTATION_TRACKING - float yaw, pitch, roll; + Quaternion trackedHeadOrientation; #endif wmops_sub_start( "fastconv_binaural_rendering" ); @@ -899,11 +899,10 @@ void ivas_binRenderer( if ( hHeadTrackData->shd_rot_max_order == -1 ) { #ifdef FIX_I109_ORIENTATION_TRACKING - Quat2Euler( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], &( yaw ), &( pitch ), &( roll ) ); - ivas_orient_trk_SetAbsoluteOrientation( hHeadTrackData->OrientationTracker, yaw, pitch, roll ); + ivas_orient_trk_SetAbsoluteOrientation( hHeadTrackData->OrientationTracker, &( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++] ) ); ivas_orient_trk_Process( hHeadTrackData->OrientationTracker ); - ivas_orient_trk_GetTrackedOrientation( hHeadTrackData->OrientationTracker, &( yaw ), &( pitch ), &( roll ) ); - Euler2RotMat( yaw, pitch, roll, hHeadTrackData->Rmat ); + ivas_orient_trk_GetTrackedOrientation( hHeadTrackData->OrientationTracker, &trackedHeadOrientation ); + QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); #else QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); #endif diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 87fc4e467a..7b16a2429c 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1787,10 +1787,10 @@ void ivas_dirac_dec( float *reference_power, *reference_power_smooth; float *onset_filter, *onset_filter_subframe, *p_onset_filter = NULL; uint16_t coherence_flag; - #ifdef FIX_I109_ORIENTATION_TRACKING - float yaw, pitch, roll; + Quaternion trackedHeadOrientation; #endif + wmops_sub_start( "ivas_dirac_dec" ); /* Initialize aux buffers */ @@ -1856,11 +1856,10 @@ void ivas_dirac_dec( if ( st_ivas->hHeadTrackData ) { #ifdef FIX_I109_ORIENTATION_TRACKING - Quat2Euler( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], &( yaw ), &( pitch ), &( roll ) ); - ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hHeadTrackData->OrientationTracker, yaw, pitch, roll ); + ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hHeadTrackData->OrientationTracker, &( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++] ) ); ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker ); - ivas_orient_trk_GetTrackedOrientation( st_ivas->hHeadTrackData->OrientationTracker, &( yaw ), &( pitch ), &( roll ) ); - Euler2RotMat( yaw, pitch, roll, st_ivas->hHeadTrackData->Rmat ); + ivas_orient_trk_GetTrackedOrientation( st_ivas->hHeadTrackData->OrientationTracker, &trackedHeadOrientation ); + QuatToRotMat( trackedHeadOrientation, st_ivas->hHeadTrackData->Rmat ); #else QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], st_ivas->hHeadTrackData->Rmat ); #endif diff --git a/lib_dec/ivas_dirac_dec_binaural_functions.c b/lib_dec/ivas_dirac_dec_binaural_functions.c index a77b3ecc30..e294c57a65 100644 --- a/lib_dec/ivas_dirac_dec_binaural_functions.c +++ b/lib_dec/ivas_dirac_dec_binaural_functions.c @@ -337,9 +337,8 @@ static void ivas_dirac_dec_binaural_internal( uint8_t firstSlot, slotEnd; int16_t max_band_decorr; DIFFUSE_DISTRIBUTION_DATA diffuseDistData; - #ifdef FIX_I109_ORIENTATION_TRACKING - float yaw, pitch, roll; + Quaternion trackedHeadOrientation; #endif firstSlot = firstSubframe * ( CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ); @@ -474,11 +473,10 @@ static void ivas_dirac_dec_binaural_internal( if ( st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ) { #ifdef FIX_I109_ORIENTATION_TRACKING - Quat2Euler( st_ivas->hHeadTrackData->Quaternions[firstSubframe], &( yaw ), &( pitch ), &( roll ) ); - ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hHeadTrackData->OrientationTracker, yaw, pitch, roll ); + ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hHeadTrackData->OrientationTracker, &( st_ivas->hHeadTrackData->Quaternions[firstSubframe] ) ); ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker ); - ivas_orient_trk_GetTrackedOrientation( st_ivas->hHeadTrackData->OrientationTracker, &( yaw ), &( pitch ), &( roll ) ); - Euler2RotMat( yaw, pitch, roll, Rmat ); + ivas_orient_trk_GetTrackedOrientation( st_ivas->hHeadTrackData->OrientationTracker, &trackedHeadOrientation ); + QuatToRotMat( trackedHeadOrientation, Rmat ); #else QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[firstSubframe], Rmat ); #endif diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 0e7f5f864a..7425fd0df7 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -109,6 +109,9 @@ void ivas_ism_render( int16_t num_objects, nchan_out_woLFE, lfe_index; int16_t azimuth, elevation; float Rmat[3][3]; +#ifdef FIX_I109_ORIENTATION_TRACKING + Quaternion trackedHeadOrientation; +#endif num_objects = st_ivas->nchan_transport; nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; @@ -132,8 +135,16 @@ void ivas_ism_render( if ( st_ivas->hHeadTrackData != NULL && st_ivas->hHeadTrackData->num_quaternions >= 0 ) { +#ifdef FIX_I109_ORIENTATION_TRACKING + ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hHeadTrackData->OrientationTracker, &st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++] ); + ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker ); + ivas_orient_trk_GetTrackedOrientation( st_ivas->hHeadTrackData->OrientationTracker, &trackedHeadOrientation ); + /* Calculate rotation matrix from the quaternion */ + QuatToRotMat( trackedHeadOrientation, Rmat ); +#else /* Calculate rotation matrix from the quaternion */ QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], Rmat ); +#endif } for ( i = 0; i < num_objects; i++ ) diff --git a/lib_dec/ivas_objectRenderer.c b/lib_dec/ivas_objectRenderer.c index 59e63bd9ff..846d00feac 100644 --- a/lib_dec/ivas_objectRenderer.c +++ b/lib_dec/ivas_objectRenderer.c @@ -224,6 +224,9 @@ void ObjRenderIVASFrame( int16_t subframe_length; int16_t subframe_idx; float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; +#ifdef FIX_I109_ORIENTATION_TRACKING + Quaternion trackedHeadOrientation; +#endif subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; if ( st_ivas->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ @@ -241,9 +244,18 @@ void ObjRenderIVASFrame( for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { /* Update the listener's location/orientation */ +#ifdef FIX_I109_ORIENTATION_TRACKING + ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hHeadTrackData->OrientationTracker, &st_ivas->hHeadTrackData->Quaternions[subframe_idx] ); + ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker ); + ivas_orient_trk_GetTrackedOrientation( st_ivas->hHeadTrackData->OrientationTracker, &trackedHeadOrientation ); + TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, + st_ivas->hDecoderConfig->Opt_Headrotation, + ( st_ivas->hHeadTrackData != NULL ) ? &trackedHeadOrientation : NULL ); +#else TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? &st_ivas->hHeadTrackData->Quaternions[subframe_idx] : NULL ); +#endif if ( ( st_ivas->hRenderConfig != NULL ) && ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) ) { diff --git a/lib_dec/ivas_orient_trk.c b/lib_dec/ivas_orient_trk.c index 858a77ae09..e7676d5830 100644 --- a/lib_dec/ivas_orient_trk.c +++ b/lib_dec/ivas_orient_trk.c @@ -121,6 +121,29 @@ void ivas_orient_trk_Init( /* initial adaptivity filter coefficient, will be auto-adapted */ pOTR->alpha = sinf( PI2 * pOTR->offCenterAdaptationRate / OTR_UPDATE_RATE ); /* start adaptation at off-center rate = fastest rate */ +#ifdef FIX_I109_ORIENTATION_TRACKING + pOTR->absRot.x = 0.f; + pOTR->absRot.y = 0.f; + pOTR->absRot.z = 0.f; + pOTR->absRot.w = 1.f; + + pOTR->absAvgRot.x = 0.f; + pOTR->absAvgRot.y = 0.f; + pOTR->absAvgRot.z = 0.f; + pOTR->absAvgRot.w = 1.f; + + /* Use frontal and horiontal orientation as reference orientation, + unless/until overridden by ivas_orient_trk_SetAbsoluteOrientation() */ + pOTR->refRot.x = 0.f; + pOTR->refRot.y = 0.f; + pOTR->refRot.z = 0.f; + pOTR->refRot.w = 1.f; + + pOTR->trkRot.x = 0.f; + pOTR->trkRot.y = 0.f; + pOTR->trkRot.z = 0.f; + pOTR->trkRot.w = 1.f; +#else pOTR->absYaw = 0.0f; pOTR->absPitch = 0.0f; pOTR->absRoll = 0.0f; @@ -138,9 +161,9 @@ void ivas_orient_trk_Init( pOTR->trkYaw = 0.0f; pOTR->trkPitch = 0.0f; pOTR->trkRoll = 0.0f; +#endif } - /*-------------------------------------------------------------------* * ivas_orient_trk_SetTrackingType() * @@ -155,13 +178,22 @@ ivas_error ivas_orient_trk_SetTrackingType( return IVAS_ERR_OK; } - /*-------------------------------------------------------------------* * ivas_orient_trk_SetAbsoluteOrientation() * * *-------------------------------------------------------------------*/ +#ifdef FIX_I109_ORIENTATION_TRACKING +ivas_error ivas_orient_trk_SetAbsoluteOrientation( + ivas_orient_trk_state_t *pOTR, + const Quaternion *pQuat ) +{ + pOTR->absRot = *pQuat; + + return IVAS_ERR_OK; +} +#else ivas_error ivas_orient_trk_SetAbsoluteOrientation( ivas_orient_trk_state_t *pOTR, float yaw, @@ -175,7 +207,103 @@ ivas_error ivas_orient_trk_SetAbsoluteOrientation( return IVAS_ERR_OK; } +#endif + + +Quaternion quaternion_division( const Quaternion q1, const float d ) +{ + Quaternion r = q1; + r.w = r.w / d; + r.x = r.x / d; + r.y = r.y / d; + r.z = r.z / d; + return r; +} + +float quaternion_dot_product( const Quaternion a, const Quaternion b ) +{ + return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; +} + +Quaternion quaternion_normalize( const Quaternion q ) +{ + Quaternion r = q; + r = quaternion_division( r, sqrtf( quaternion_dot_product( r, r ) ) ); + return r; +} + +Quaternion quaternion_product( const Quaternion q1, const Quaternion q2 ) +{ + Quaternion r; + + r.w = q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z; + r.x = q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y; + r.y = q1.w * q2.y - q1.x * q2.z + q1.y * q2.w + q1.z * q2.x; + r.z = q1.w * q2.z + q1.x * q2.y - q1.y * q2.x + q1.z * q2.w; + + return r; +} + + +Quaternion quaternion_slerp( const Quaternion q1, const Quaternion q2, const float t ) +{ + Quaternion r; + float angle, denom, s, s2; + + angle = acosf( quaternion_dot_product( q1, q2 ) ); + denom = sinf( angle ); + + // check if denom is zero means same rotation + if ( denom < 0.0001F && denom > -0.0001F ) + { + return q2; + } + + s = sinf( 1 - t ) * angle; + s2 = sinf( t * angle ); + r.x = ( q1.x * s + q2.x * s2 ) / denom; + r.y = ( q1.y * s + q2.y * s2 ) / denom; + r.z = ( q1.z * s + q2.z * s2 ) / denom; + r.w = ( q1.w * s + q2.w * s2 ) / denom; + + return quaternion_normalize( r ); +} +float quaternion_norm( const Quaternion q ) +{ + return sqrtf( quaternion_dot_product( q, q ) ); +} + +Quaternion quaternion_conjugate( const Quaternion q ) +{ + Quaternion r = q; + r.x = -r.x; + r.y = -r.y; + r.z = -r.z; + return r; +} + +float quaternion_angle( const Quaternion q1, const Quaternion q2 ) +{ + Quaternion q12; + float angle; + + q12 = quaternion_product( quaternion_conjugate( q1 ), q2 ); + angle = 2.0f * atan2f( sqrtf( q12.x * q12.x + q12.y * q12.y + q12.z * q12.z ), q12.w ); + return angle; +} + + +Quaternion quaternion_inverse( const Quaternion q ) +{ + Quaternion r; + float dot_product; + + dot_product = quaternion_dot_product( q, q ); + r = quaternion_conjugate( q ); + r = quaternion_division( r, dot_product ); + return r; +} /*-------------------------------------------------------------------* * ivas_orient_trk_Process() @@ -186,6 +314,88 @@ ivas_error ivas_orient_trk_SetAbsoluteOrientation( ivas_error ivas_orient_trk_Process( ivas_orient_trk_state_t *pOTR ) { +#ifdef FIX_I109_ORIENTATION_TRACKING + Quaternion rot; + float normalizedOrientation; + float relativeOrientationRate; + float rateRange; + float cutoffFrequency; + float alpha = pOTR->alpha; + float ang; + if ( pOTR->trackingType == OTR_TRACKING_AVG_ORIENT ) + { + /* Copy absolute orientation as input to compute further on */ + rot = pOTR->absRot; + + /* Compute average (low-pass filtered) absolute orientation */ + pOTR->absAvgRot = quaternion_slerp( pOTR->absAvgRot, rot, alpha ); + + rot = pOTR->absAvgRot; + + /* Store relative orientation result as output */ + pOTR->trkRot = rot; + + /* Adapt LPF constant based on orientation excursion relative to current mean: + - low cutoff (slow adaptation) for small excursions (around center) + - high cutoff (fast adaptation) for large excursions (off-center) + */ + ang = quaternion_angle( rot, pOTR->absAvgRot ); + normalizedOrientation = ang * ang; + + relativeOrientationRate = sqrtf( normalizedOrientation ) / pOTR->adaptationAngle; + /* 'if' assumed to perform comparison to 0 */ + if ( relativeOrientationRate > 1.0f ) + { + relativeOrientationRate = 1.0f; + } + + /* Compute range of the adaptation rate between center = lower rate and off-center = higher rate */ + rateRange = pOTR->offCenterAdaptationRate - pOTR->centerAdaptationRate; + /* 'if' assumed to perform comparison to 0 */ + if ( rateRange < 0.0f ) + { + rateRange = 0.0f; + } + + /* Compute adaptivity cutoff frequency: interpolate between minimum (center) and maximum (off-center) values */ + cutoffFrequency = pOTR->centerAdaptationRate + ( relativeOrientationRate * rateRange ); + + /* Compute filter coefficient corresponding to desired cutoff frequency */ + pOTR->alpha = sinf( 2.0f * EVS_PI * cutoffFrequency / OTR_UPDATE_RATE ); + } + else + { + /* 'if' assumed to perform comparison to 0 */ + if ( pOTR->trackingType == OTR_TRACKING_REF_ORIENT ) + { + /* Reset average orientation */ + pOTR->absAvgRot.w = pOTR->absRot.w; + pOTR->absAvgRot.x = pOTR->absRot.x; + pOTR->absAvgRot.y = pOTR->absRot.y; + pOTR->absAvgRot.z = pOTR->absRot.z; + + /* Reset adaptation filter - start adaptation at center rate */ + pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / OTR_UPDATE_RATE ); + + /* Copy absolute orientation as input to compute further on */ + rot.w = pOTR->absRot.w; + rot.x = pOTR->absRot.x; + rot.y = pOTR->absRot.y; + rot.z = pOTR->absRot.z; + + /* Compute relative orientation = (absolute orientation) - (reference orientation) */ + rot = quaternion_product( quaternion_inverse( pOTR->refRot ), rot ); + + /* Clip computed relative orientation to avoid wrap around and store as output */ + pOTR->trkRot = rot; + } + else + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Non-supported orientation tracking adaptation type" ); + } + } +#else + float yaw; float pitch; float roll; @@ -293,6 +503,7 @@ ivas_error ivas_orient_trk_Process( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Non-supported orientation tracking adaptation type" ); } } +#endif return IVAS_ERR_OK; } @@ -306,13 +517,23 @@ ivas_error ivas_orient_trk_Process( ivas_error ivas_orient_trk_GetTrackedOrientation( ivas_orient_trk_state_t *pOTR, +#ifdef FIX_I109_ORIENTATION_TRACKING + Quaternion *trk ) +#else float *yaw, float *pitch, float *roll ) +#endif { +#ifdef FIX_I109_ORIENTATION_TRACKING + trk->w = pOTR->trkRot.w; + trk->x = pOTR->trkRot.x; + trk->y = pOTR->trkRot.y; + trk->z = pOTR->trkRot.z; +#else *yaw = pOTR->trkYaw; *pitch = pOTR->trkPitch; *roll = pOTR->trkRoll; - +#endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_rotation.c b/lib_dec/ivas_rotation.c index 2e936270e7..c6bc080730 100644 --- a/lib_dec/ivas_rotation.c +++ b/lib_dec/ivas_rotation.c @@ -418,9 +418,8 @@ void rotateFrame_shd( float SHrotmat_prev[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM]; float SHrotmat[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM]; float cross_fade[IVAS_FB_1MS_48K_SAMP]; - #ifdef FIX_I109_ORIENTATION_TRACKING - float yaw, pitch, roll; + Quaternion trackedHeadOrientation; #endif shd_rot_max_order = hTransSetup.ambisonics_order; @@ -441,11 +440,10 @@ void rotateFrame_shd( } #ifdef FIX_I109_ORIENTATION_TRACKING - Quat2Euler( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], &( yaw ), &( pitch ), &( roll ) ); - ivas_orient_trk_SetAbsoluteOrientation( hHeadTrackData->OrientationTracker, yaw, pitch, roll ); + ivas_orient_trk_SetAbsoluteOrientation( hHeadTrackData->OrientationTracker, &( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++] ) ); ivas_orient_trk_Process( hHeadTrackData->OrientationTracker ); - ivas_orient_trk_GetTrackedOrientation( hHeadTrackData->OrientationTracker, &( yaw ), &( pitch ), &( roll ) ); - Euler2RotMat( yaw, pitch, roll, hHeadTrackData->Rmat ); + ivas_orient_trk_GetTrackedOrientation( hHeadTrackData->OrientationTracker, &trackedHeadOrientation ); + QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); #else /* get next quaternion */ QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); @@ -549,7 +547,7 @@ void rotateFrame_sd( float cross_fade[IVAS_FB_1MS_48K_SAMP]; #ifdef FIX_I109_ORIENTATION_TRACKING - float yaw, pitch, roll; + Quaternion trackedHeadOrientation; #endif wmops_sub_start( "rotateFrame_sd" ); @@ -566,11 +564,10 @@ void rotateFrame_sd( } #ifdef FIX_I109_ORIENTATION_TRACKING - Quat2Euler( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], &( yaw ), &( pitch ), &( roll ) ); - ivas_orient_trk_SetAbsoluteOrientation( hHeadTrackData->OrientationTracker, yaw, pitch, roll ); + ivas_orient_trk_SetAbsoluteOrientation( hHeadTrackData->OrientationTracker, &( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++] ) ); ivas_orient_trk_Process( hHeadTrackData->OrientationTracker ); - ivas_orient_trk_GetTrackedOrientation( hHeadTrackData->OrientationTracker, &( yaw ), &( pitch ), &( roll ) ); - Euler2RotMat( yaw, pitch, roll, hHeadTrackData->Rmat ); + ivas_orient_trk_GetTrackedOrientation( hHeadTrackData->OrientationTracker, &trackedHeadOrientation ); + QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); #else /* Get next quaternion and calculate rotation matrix */ QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); @@ -793,9 +790,8 @@ void rotateFrame_sd_cldfb( float *p_real, *p_imag; int16_t nInChannels; int16_t isPlanar; - #ifdef FIX_I109_ORIENTATION_TRACKING - float yaw, pitch, roll; + Quaternion trackedHeadOrientation; #endif wmops_sub_start( "rotateFrame_sd_cldfb" ); @@ -812,11 +808,10 @@ void rotateFrame_sd_cldfb( } #ifdef FIX_I109_ORIENTATION_TRACKING - Quat2Euler( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], &( yaw ), &( pitch ), &( roll ) ); - ivas_orient_trk_SetAbsoluteOrientation( hHeadTrackData->OrientationTracker, yaw, pitch, roll ); + ivas_orient_trk_SetAbsoluteOrientation( hHeadTrackData->OrientationTracker, &( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++] ) ); ivas_orient_trk_Process( hHeadTrackData->OrientationTracker ); - ivas_orient_trk_GetTrackedOrientation( hHeadTrackData->OrientationTracker, &( yaw ), &( pitch ), &( roll ) ); - Euler2RotMat( yaw, pitch, roll, Rmat ); + ivas_orient_trk_GetTrackedOrientation( hHeadTrackData->OrientationTracker, &trackedHeadOrientation ); + QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); #else /* Get next quaternion and calculate rotation matrix */ QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], Rmat ); diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index e5fc9b79e6..a3be5369b1 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1363,21 +1363,10 @@ typedef struct ivas_orient_trk_state_t float alpha; - float absYaw; /* absolute orientation */ - float absPitch; - float absRoll; - - float absAvgYaw; /* average absolute orientation */ - float absAvgPitch; - float absAvgRoll; - - float refYaw; /* reference orientation */ - float refPitch; - float refRoll; - - float trkYaw; /* tracked orientation */ - float trkPitch; - float trkRoll; + Quaternion absRot; /* absolute orientation */ + Quaternion absAvgRot; /* average absolute orientation */ + Quaternion refRot; /* reference orientation */ + Quaternion trkRot; /* tracked orientation */ } ivas_orient_trk_state_t; #endif -- GitLab From 86909c1763b6c65b4cba5a0fa7c9a325f8af8a1d Mon Sep 17 00:00:00 2001 From: szczerba Date: Tue, 25 Oct 2022 13:05:53 +0200 Subject: [PATCH 004/375] Orientation tracking update based on frame size. Refactoring --- lib_com/ivas_prot.h | 20 +- lib_dec/ivas_binauralRenderer.c | 4 +- lib_dec/ivas_dirac_dec.c | 7 +- lib_dec/ivas_dirac_dec_binaural_functions.c | 4 +- lib_dec/ivas_ism_renderer.c | 7 +- lib_dec/ivas_objectRenderer.c | 7 +- lib_dec/ivas_orient_trk.c | 303 +++++++++----------- lib_dec/ivas_rotation.c | 21 +- lib_dec/ivas_stat_dec.h | 2 - 9 files changed, 167 insertions(+), 208 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 6ea17db6a8..87580a09fb 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5502,31 +5502,33 @@ ivas_error ivas_orient_trk_SetTrackingType( OTR_TRACKING_T trackingType ); -ivas_error ivas_orient_trk_SetAbsoluteOrientation( - ivas_orient_trk_state_t *pOTR, #ifdef FIX_I109_ORIENTATION_TRACKING - const Quaternion* pQuat +ivas_error ivas_orient_trk_Process( + ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ + Quaternion absRot, /* i : absolute head rotation */ + float updateRate, /* i : rotation update rate [Hz] */ + Quaternion *pTrkRot /* o : tracked rotation */ +); + #else +ivas_error ivas_orient_trk_SetAbsoluteOrientation( + ivas_orient_trk_state_t *pOTR, float yaw, float pitch, float roll -#endif ); ivas_error ivas_orient_trk_Process( - ivas_orient_trk_state_t *pOTR + ivas_orient_trk_state_t *pOTR ); ivas_error ivas_orient_trk_GetTrackedOrientation( ivas_orient_trk_state_t *pOTR, -#ifdef FIX_I109_ORIENTATION_TRACKING - Quaternion *pQuat -#else float *yaw, float *pitch, float *roll -#endif ); +#endif void TonalMdctConceal_create_concealment_noise( float concealment_noise[L_FRAME48k], diff --git a/lib_dec/ivas_binauralRenderer.c b/lib_dec/ivas_binauralRenderer.c index a9a762a7a0..743233cb75 100644 --- a/lib_dec/ivas_binauralRenderer.c +++ b/lib_dec/ivas_binauralRenderer.c @@ -899,9 +899,7 @@ void ivas_binRenderer( if ( hHeadTrackData->shd_rot_max_order == -1 ) { #ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_SetAbsoluteOrientation( hHeadTrackData->OrientationTracker, &( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++] ) ); - ivas_orient_trk_Process( hHeadTrackData->OrientationTracker ); - ivas_orient_trk_GetTrackedOrientation( hHeadTrackData->OrientationTracker, &trackedHeadOrientation ); + ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], FRAMES_PER_SEC, &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); #else QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 7b16a2429c..2ee1c9b0ad 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1856,9 +1856,10 @@ void ivas_dirac_dec( if ( st_ivas->hHeadTrackData ) { #ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hHeadTrackData->OrientationTracker, &( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++] ) ); - ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker ); - ivas_orient_trk_GetTrackedOrientation( st_ivas->hHeadTrackData->OrientationTracker, &trackedHeadOrientation ); + ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, + st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], + (float) ( FRAMES_PER_SEC * ( sf2 - sf1 ) ), + &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, st_ivas->hHeadTrackData->Rmat ); #else QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], st_ivas->hHeadTrackData->Rmat ); diff --git a/lib_dec/ivas_dirac_dec_binaural_functions.c b/lib_dec/ivas_dirac_dec_binaural_functions.c index e294c57a65..552ddd8ad9 100644 --- a/lib_dec/ivas_dirac_dec_binaural_functions.c +++ b/lib_dec/ivas_dirac_dec_binaural_functions.c @@ -473,9 +473,7 @@ static void ivas_dirac_dec_binaural_internal( if ( st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ) { #ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hHeadTrackData->OrientationTracker, &( st_ivas->hHeadTrackData->Quaternions[firstSubframe] ) ); - ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker ); - ivas_orient_trk_GetTrackedOrientation( st_ivas->hHeadTrackData->OrientationTracker, &trackedHeadOrientation ); + ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hHeadTrackData->Quaternions[firstSubframe], FRAMES_PER_SEC, &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, Rmat ); #else QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[firstSubframe], Rmat ); diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 7425fd0df7..b80b8b2a3a 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -136,9 +136,10 @@ void ivas_ism_render( if ( st_ivas->hHeadTrackData != NULL && st_ivas->hHeadTrackData->num_quaternions >= 0 ) { #ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hHeadTrackData->OrientationTracker, &st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++] ); - ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker ); - ivas_orient_trk_GetTrackedOrientation( st_ivas->hHeadTrackData->OrientationTracker, &trackedHeadOrientation ); + ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, + st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], + FRAMES_PER_SEC, + &trackedHeadOrientation ); /* Calculate rotation matrix from the quaternion */ QuatToRotMat( trackedHeadOrientation, Rmat ); #else diff --git a/lib_dec/ivas_objectRenderer.c b/lib_dec/ivas_objectRenderer.c index 846d00feac..2abed40e6c 100644 --- a/lib_dec/ivas_objectRenderer.c +++ b/lib_dec/ivas_objectRenderer.c @@ -245,9 +245,10 @@ void ObjRenderIVASFrame( { /* Update the listener's location/orientation */ #ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hHeadTrackData->OrientationTracker, &st_ivas->hHeadTrackData->Quaternions[subframe_idx] ); - ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker ); - ivas_orient_trk_GetTrackedOrientation( st_ivas->hHeadTrackData->OrientationTracker, &trackedHeadOrientation ); + ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, + st_ivas->hHeadTrackData->Quaternions[subframe_idx], + FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, + &trackedHeadOrientation ); TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? &trackedHeadOrientation : NULL ); diff --git a/lib_dec/ivas_orient_trk.c b/lib_dec/ivas_orient_trk.c index e7676d5830..ebd67b85d8 100644 --- a/lib_dec/ivas_orient_trk.c +++ b/lib_dec/ivas_orient_trk.c @@ -50,19 +50,118 @@ #define MAX_TRACKED_ANGLE_AVG_ORIENT PI_OVER_2 #define MAX_TRACKED_ANGLE_REF_ORIENT EVS_PI -#ifdef FIX_I109_ORIENTATION_TRACKING -/* TODO relate to frame rate - assumed here 200Hz, i.e. 5ms frame length */ -#define OTR_UPDATE_RATE ( 200.0f ) /* rate of the Process() calls [Hz]; 1x per IVAS frame */ -#else /* TODO relate to frame rate - assumed here 50Hz, i.e. 20ms frame length */ #define OTR_UPDATE_RATE ( 50.0f ) /* rate of the Process() calls [Hz]; 1x per IVAS frame */ -#endif - /*------------------------------------------------------------------------------------------* * Local functions *------------------------------------------------------------------------------------------*/ +#ifdef FIX_I109_ORIENTATION_TRACKING + +Quaternion QuaternionProduct( + const Quaternion q1, + const Quaternion q2 ) +{ + Quaternion r; + + r.w = q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z; + r.x = q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y; + r.y = q1.w * q2.y - q1.x * q2.z + q1.y * q2.w + q1.z * q2.x; + r.z = q1.w * q2.z + q1.x * q2.y - q1.y * q2.x + q1.z * q2.w; + + return r; +} + +float QuaternionDotProduct( + const Quaternion a, + const Quaternion b ) +{ + return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; +} + +Quaternion QuaternionDivision( + const Quaternion q1, + const float d ) +{ + Quaternion r = q1; + r.w = r.w / d; + r.x = r.x / d; + r.y = r.y / d; + r.z = r.z / d; + return r; +} + +Quaternion QuaternionNormalize( + const Quaternion q ) +{ + Quaternion r = q; + r = QuaternionDivision( r, sqrtf( QuaternionDotProduct( r, r ) ) ); + return r; +} + +Quaternion QuaternionSlerp( + const Quaternion q1, + const Quaternion q2, + const float t ) +{ + Quaternion r; + float angle, denom, s, s2; + + angle = acosf( QuaternionDotProduct( q1, q2 ) ); + denom = sinf( angle ); + + // check if denom is zero means same rotation + if ( denom < 0.0001F && denom > -0.0001F ) + { + return q2; + } + + s = sinf( 1 - t ) * angle; + s2 = sinf( t * angle ); + r.x = ( q1.x * s + q2.x * s2 ) / denom; + r.y = ( q1.y * s + q2.y * s2 ) / denom; + r.z = ( q1.z * s + q2.z * s2 ) / denom; + r.w = ( q1.w * s + q2.w * s2 ) / denom; + + return QuaternionNormalize( r ); +} + +Quaternion QuaternionConjugate( + const Quaternion q ) +{ + Quaternion r = q; + r.x = -r.x; + r.y = -r.y; + r.z = -r.z; + return r; +} + +float QuaternionAngle( + const Quaternion q1, + const Quaternion q2 ) +{ + Quaternion q12; + float angle; + + q12 = QuaternionProduct( QuaternionConjugate( q1 ), q2 ); + angle = 2.0f * atan2f( sqrtf( q12.x * q12.x + q12.y * q12.y + q12.z * q12.z ), q12.w ); + return angle; +} + +Quaternion QuaternionInverse( + const Quaternion q ) +{ + Quaternion r; + float dot_product; + + dot_product = QuaternionDotProduct( q, q ); + r = QuaternionConjugate( q ); + r = QuaternionDivision( r, dot_product ); + return r; +} + +#else static float ClipAngle( const float angle, const float min_angle, @@ -100,6 +199,7 @@ static float ClipAngle( return result; } +#endif /*-------------------------------------------------------------------* * ivas_orient_trk_Init() @@ -122,27 +222,10 @@ void ivas_orient_trk_Init( pOTR->alpha = sinf( PI2 * pOTR->offCenterAdaptationRate / OTR_UPDATE_RATE ); /* start adaptation at off-center rate = fastest rate */ #ifdef FIX_I109_ORIENTATION_TRACKING - pOTR->absRot.x = 0.f; - pOTR->absRot.y = 0.f; - pOTR->absRot.z = 0.f; - pOTR->absRot.w = 1.f; - - pOTR->absAvgRot.x = 0.f; - pOTR->absAvgRot.y = 0.f; - pOTR->absAvgRot.z = 0.f; - pOTR->absAvgRot.w = 1.f; + pOTR->absAvgRot = ( Quaternion ){ .w = 1.f, .x = 0.f, .y = 0.f, .z = 0.f }; + /* Use frontal and horiontal orientation as reference orientation, unless/until overridden */ + pOTR->refRot = ( Quaternion ){ .w = 1.f, .x = 0.f, .y = 0.f, .z = 0.f }; - /* Use frontal and horiontal orientation as reference orientation, - unless/until overridden by ivas_orient_trk_SetAbsoluteOrientation() */ - pOTR->refRot.x = 0.f; - pOTR->refRot.y = 0.f; - pOTR->refRot.z = 0.f; - pOTR->refRot.w = 1.f; - - pOTR->trkRot.x = 0.f; - pOTR->trkRot.y = 0.f; - pOTR->trkRot.z = 0.f; - pOTR->trkRot.w = 1.f; #else pOTR->absYaw = 0.0f; pOTR->absPitch = 0.0f; @@ -178,22 +261,14 @@ ivas_error ivas_orient_trk_SetTrackingType( return IVAS_ERR_OK; } +#ifdef FIX_I109_ORIENTATION_TRACKING +#else /*-------------------------------------------------------------------* * ivas_orient_trk_SetAbsoluteOrientation() * * *-------------------------------------------------------------------*/ -#ifdef FIX_I109_ORIENTATION_TRACKING -ivas_error ivas_orient_trk_SetAbsoluteOrientation( - ivas_orient_trk_state_t *pOTR, - const Quaternion *pQuat ) -{ - pOTR->absRot = *pQuat; - - return IVAS_ERR_OK; -} -#else ivas_error ivas_orient_trk_SetAbsoluteOrientation( ivas_orient_trk_state_t *pOTR, float yaw, @@ -209,113 +284,19 @@ ivas_error ivas_orient_trk_SetAbsoluteOrientation( } #endif - -Quaternion quaternion_division( const Quaternion q1, const float d ) -{ - Quaternion r = q1; - r.w = r.w / d; - r.x = r.x / d; - r.y = r.y / d; - r.z = r.z / d; - return r; -} - -float quaternion_dot_product( const Quaternion a, const Quaternion b ) -{ - return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; -} - -Quaternion quaternion_normalize( const Quaternion q ) -{ - Quaternion r = q; - r = quaternion_division( r, sqrtf( quaternion_dot_product( r, r ) ) ); - return r; -} - -Quaternion quaternion_product( const Quaternion q1, const Quaternion q2 ) -{ - Quaternion r; - - r.w = q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z; - r.x = q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y; - r.y = q1.w * q2.y - q1.x * q2.z + q1.y * q2.w + q1.z * q2.x; - r.z = q1.w * q2.z + q1.x * q2.y - q1.y * q2.x + q1.z * q2.w; - - return r; -} - - -Quaternion quaternion_slerp( const Quaternion q1, const Quaternion q2, const float t ) -{ - Quaternion r; - float angle, denom, s, s2; - - angle = acosf( quaternion_dot_product( q1, q2 ) ); - denom = sinf( angle ); - - // check if denom is zero means same rotation - if ( denom < 0.0001F && denom > -0.0001F ) - { - return q2; - } - - s = sinf( 1 - t ) * angle; - s2 = sinf( t * angle ); - r.x = ( q1.x * s + q2.x * s2 ) / denom; - r.y = ( q1.y * s + q2.y * s2 ) / denom; - r.z = ( q1.z * s + q2.z * s2 ) / denom; - r.w = ( q1.w * s + q2.w * s2 ) / denom; - - return quaternion_normalize( r ); -} - -float quaternion_norm( const Quaternion q ) -{ - return sqrtf( quaternion_dot_product( q, q ) ); -} - -Quaternion quaternion_conjugate( const Quaternion q ) -{ - Quaternion r = q; - r.x = -r.x; - r.y = -r.y; - r.z = -r.z; - return r; -} - -float quaternion_angle( const Quaternion q1, const Quaternion q2 ) -{ - Quaternion q12; - float angle; - - q12 = quaternion_product( quaternion_conjugate( q1 ), q2 ); - angle = 2.0f * atan2f( sqrtf( q12.x * q12.x + q12.y * q12.y + q12.z * q12.z ), q12.w ); - return angle; -} - - -Quaternion quaternion_inverse( const Quaternion q ) -{ - Quaternion r; - float dot_product; - - dot_product = quaternion_dot_product( q, q ); - r = quaternion_conjugate( q ); - r = quaternion_division( r, dot_product ); - return r; -} - /*-------------------------------------------------------------------* * ivas_orient_trk_Process() * * *-------------------------------------------------------------------*/ +#ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_Process( - ivas_orient_trk_state_t *pOTR ) + ivas_orient_trk_state_t *pOTR, + Quaternion absRot, + float updateRate, + Quaternion *pTrkRot) { -#ifdef FIX_I109_ORIENTATION_TRACKING - Quaternion rot; float normalizedOrientation; float relativeOrientationRate; float rateRange; @@ -324,22 +305,16 @@ ivas_error ivas_orient_trk_Process( float ang; if ( pOTR->trackingType == OTR_TRACKING_AVG_ORIENT ) { - /* Copy absolute orientation as input to compute further on */ - rot = pOTR->absRot; - /* Compute average (low-pass filtered) absolute orientation */ - pOTR->absAvgRot = quaternion_slerp( pOTR->absAvgRot, rot, alpha ); + pOTR->absAvgRot = QuaternionSlerp( pOTR->absAvgRot, absRot, alpha ); - rot = pOTR->absAvgRot; - - /* Store relative orientation result as output */ - pOTR->trkRot = rot; + *pTrkRot = pOTR->absAvgRot; /* Adapt LPF constant based on orientation excursion relative to current mean: - low cutoff (slow adaptation) for small excursions (around center) - high cutoff (fast adaptation) for large excursions (off-center) */ - ang = quaternion_angle( rot, pOTR->absAvgRot ); + ang = QuaternionAngle( absRot, *pTrkRot ); normalizedOrientation = ang * ang; relativeOrientationRate = sqrtf( normalizedOrientation ) / pOTR->adaptationAngle; @@ -361,7 +336,7 @@ ivas_error ivas_orient_trk_Process( cutoffFrequency = pOTR->centerAdaptationRate + ( relativeOrientationRate * rateRange ); /* Compute filter coefficient corresponding to desired cutoff frequency */ - pOTR->alpha = sinf( 2.0f * EVS_PI * cutoffFrequency / OTR_UPDATE_RATE ); + pOTR->alpha = sinf( 2.0f * EVS_PI * cutoffFrequency / updateRate ); } else { @@ -369,25 +344,13 @@ ivas_error ivas_orient_trk_Process( if ( pOTR->trackingType == OTR_TRACKING_REF_ORIENT ) { /* Reset average orientation */ - pOTR->absAvgRot.w = pOTR->absRot.w; - pOTR->absAvgRot.x = pOTR->absRot.x; - pOTR->absAvgRot.y = pOTR->absRot.y; - pOTR->absAvgRot.z = pOTR->absRot.z; + pOTR->absAvgRot = absRot; /* Reset adaptation filter - start adaptation at center rate */ - pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / OTR_UPDATE_RATE ); - - /* Copy absolute orientation as input to compute further on */ - rot.w = pOTR->absRot.w; - rot.x = pOTR->absRot.x; - rot.y = pOTR->absRot.y; - rot.z = pOTR->absRot.z; + pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate ); /* Compute relative orientation = (absolute orientation) - (reference orientation) */ - rot = quaternion_product( quaternion_inverse( pOTR->refRot ), rot ); - - /* Clip computed relative orientation to avoid wrap around and store as output */ - pOTR->trkRot = rot; + *pTrkRot = QuaternionProduct( QuaternionInverse( pOTR->refRot ), absRot ); } else { @@ -395,7 +358,10 @@ ivas_error ivas_orient_trk_Process( } } #else - +ivas_error ivas_orient_trk_Process( + ivas_orient_trk_state_t *pOTR +) +{ float yaw; float pitch; float roll; @@ -508,7 +474,8 @@ ivas_error ivas_orient_trk_Process( return IVAS_ERR_OK; } - +#ifdef FIX_I109_ORIENTATION_TRACKING +#else /*-------------------------------------------------------------------* * ivas_orient_trk_GetTrackedOrientation() * @@ -517,23 +484,13 @@ ivas_error ivas_orient_trk_Process( ivas_error ivas_orient_trk_GetTrackedOrientation( ivas_orient_trk_state_t *pOTR, -#ifdef FIX_I109_ORIENTATION_TRACKING - Quaternion *trk ) -#else float *yaw, float *pitch, float *roll ) -#endif { -#ifdef FIX_I109_ORIENTATION_TRACKING - trk->w = pOTR->trkRot.w; - trk->x = pOTR->trkRot.x; - trk->y = pOTR->trkRot.y; - trk->z = pOTR->trkRot.z; -#else *yaw = pOTR->trkYaw; *pitch = pOTR->trkPitch; *roll = pOTR->trkRoll; -#endif return IVAS_ERR_OK; } +#endif diff --git a/lib_dec/ivas_rotation.c b/lib_dec/ivas_rotation.c index c6bc080730..1253474952 100644 --- a/lib_dec/ivas_rotation.c +++ b/lib_dec/ivas_rotation.c @@ -440,9 +440,10 @@ void rotateFrame_shd( } #ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_SetAbsoluteOrientation( hHeadTrackData->OrientationTracker, &( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++] ) ); - ivas_orient_trk_Process( hHeadTrackData->OrientationTracker ); - ivas_orient_trk_GetTrackedOrientation( hHeadTrackData->OrientationTracker, &trackedHeadOrientation ); + ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, + hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], + FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, + &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); #else /* get next quaternion */ @@ -564,9 +565,10 @@ void rotateFrame_sd( } #ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_SetAbsoluteOrientation( hHeadTrackData->OrientationTracker, &( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++] ) ); - ivas_orient_trk_Process( hHeadTrackData->OrientationTracker ); - ivas_orient_trk_GetTrackedOrientation( hHeadTrackData->OrientationTracker, &trackedHeadOrientation ); + ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, + hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], + FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, + &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); #else /* Get next quaternion and calculate rotation matrix */ @@ -808,9 +810,10 @@ void rotateFrame_sd_cldfb( } #ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_SetAbsoluteOrientation( hHeadTrackData->OrientationTracker, &( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++] ) ); - ivas_orient_trk_Process( hHeadTrackData->OrientationTracker ); - ivas_orient_trk_GetTrackedOrientation( hHeadTrackData->OrientationTracker, &trackedHeadOrientation ); + ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, + hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], + FRAMES_PER_SEC, + &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); #else /* Get next quaternion and calculate rotation matrix */ diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index a3be5369b1..fb7832ae08 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1363,10 +1363,8 @@ typedef struct ivas_orient_trk_state_t float alpha; - Quaternion absRot; /* absolute orientation */ Quaternion absAvgRot; /* average absolute orientation */ Quaternion refRot; /* reference orientation */ - Quaternion trkRot; /* tracked orientation */ } ivas_orient_trk_state_t; #endif -- GitLab From 78c8394c482125684fcb8fea77e17a412e2f0ad8 Mon Sep 17 00:00:00 2001 From: szczerba Date: Wed, 26 Oct 2022 08:14:47 +0200 Subject: [PATCH 005/375] Fix for OTR in ISM. Local function declarations added. --- lib_dec/ivas_objectRenderer.c | 11 +++++++---- lib_dec/ivas_orient_trk.c | 18 +++++++++++++----- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lib_dec/ivas_objectRenderer.c b/lib_dec/ivas_objectRenderer.c index 2abed40e6c..bd3053a01f 100644 --- a/lib_dec/ivas_objectRenderer.c +++ b/lib_dec/ivas_objectRenderer.c @@ -245,10 +245,13 @@ void ObjRenderIVASFrame( { /* Update the listener's location/orientation */ #ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, - st_ivas->hHeadTrackData->Quaternions[subframe_idx], - FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, - &trackedHeadOrientation ); + if ( st_ivas->hHeadTrackData != NULL ) + { + ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, + st_ivas->hHeadTrackData->Quaternions[subframe_idx], + FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, + &trackedHeadOrientation ); + } TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? &trackedHeadOrientation : NULL ); diff --git a/lib_dec/ivas_orient_trk.c b/lib_dec/ivas_orient_trk.c index ebd67b85d8..2102a6b1d4 100644 --- a/lib_dec/ivas_orient_trk.c +++ b/lib_dec/ivas_orient_trk.c @@ -58,6 +58,14 @@ *------------------------------------------------------------------------------------------*/ #ifdef FIX_I109_ORIENTATION_TRACKING +Quaternion QuaternionProduct( const Quaternion q1, const Quaternion q2 ); +float QuaternionDotProduct( const Quaternion q1, const Quaternion q2 ); +Quaternion QuaternionDivision( const Quaternion q, const float d ); +Quaternion QuaternionNormalize( const Quaternion q ); +Quaternion QuaternionSlerp( const Quaternion q1, const Quaternion q2, const float t ); +Quaternion QuaternionConjugate( const Quaternion q ); +float QuaternionAngle( const Quaternion q1, const Quaternion q2 ); +Quaternion QuaternionInverse( const Quaternion q ); Quaternion QuaternionProduct( const Quaternion q1, @@ -74,17 +82,17 @@ Quaternion QuaternionProduct( } float QuaternionDotProduct( - const Quaternion a, - const Quaternion b ) + const Quaternion q1, + const Quaternion q2 ) { - return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; + return q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w; } Quaternion QuaternionDivision( - const Quaternion q1, + const Quaternion q, const float d ) { - Quaternion r = q1; + Quaternion r = q; r.w = r.w / d; r.x = r.x / d; r.y = r.y / d; -- GitLab From 4c989a0f28c23538946d34d762cadd06b6ba8069 Mon Sep 17 00:00:00 2001 From: szczerba Date: Wed, 26 Oct 2022 15:50:39 +0200 Subject: [PATCH 006/375] Orientation tracking refactoring. Added six test cases for average orientation tracking. --- lib_dec/ivas_orient_trk.c | 130 +++++++++++++++++------------------ scripts/config/self_test.prm | 24 +++++++ 2 files changed, 89 insertions(+), 65 deletions(-) diff --git a/lib_dec/ivas_orient_trk.c b/lib_dec/ivas_orient_trk.c index 2102a6b1d4..2240ed1759 100644 --- a/lib_dec/ivas_orient_trk.c +++ b/lib_dec/ivas_orient_trk.c @@ -58,27 +58,27 @@ *------------------------------------------------------------------------------------------*/ #ifdef FIX_I109_ORIENTATION_TRACKING -Quaternion QuaternionProduct( const Quaternion q1, const Quaternion q2 ); -float QuaternionDotProduct( const Quaternion q1, const Quaternion q2 ); -Quaternion QuaternionDivision( const Quaternion q, const float d ); -Quaternion QuaternionNormalize( const Quaternion q ); -Quaternion QuaternionSlerp( const Quaternion q1, const Quaternion q2, const float t ); -Quaternion QuaternionConjugate( const Quaternion q ); +void QuaternionProduct( const Quaternion q1, const Quaternion q2, Quaternion *const result ); +float QuaternionDotProduct( const Quaternion q1, const Quaternion ); +void QuaternionDivision( const Quaternion q, const float d, Quaternion *const result ); +void QuaternionNormalize( const Quaternion q, Quaternion *const result ); +void QuaternionSlerp( const Quaternion q1, const Quaternion q2, const float t, Quaternion *const result ); +void QuaternionConjugate( const Quaternion q, Quaternion *const result ); float QuaternionAngle( const Quaternion q1, const Quaternion q2 ); -Quaternion QuaternionInverse( const Quaternion q ); +void QuaternionInverse( const Quaternion q, Quaternion *const result ); -Quaternion QuaternionProduct( +void QuaternionProduct( const Quaternion q1, - const Quaternion q2 ) + const Quaternion q2, + Quaternion *const r ) { - Quaternion r; + Quaternion tmp; + tmp.w = q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z; + tmp.x = q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y; + tmp.y = q1.w * q2.y - q1.x * q2.z + q1.y * q2.w + q1.z * q2.x; + tmp.z = q1.w * q2.z + q1.x * q2.y - q1.y * q2.x + q1.z * q2.w; - r.w = q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z; - r.x = q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y; - r.y = q1.w * q2.y - q1.x * q2.z + q1.y * q2.w + q1.z * q2.x; - r.z = q1.w * q2.z + q1.x * q2.y - q1.y * q2.x + q1.z * q2.w; - - return r; + *r = tmp; } float QuaternionDotProduct( @@ -88,61 +88,58 @@ float QuaternionDotProduct( return q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w; } -Quaternion QuaternionDivision( +void QuaternionDivision( const Quaternion q, - const float d ) + const float d, + Quaternion *const r ) { - Quaternion r = q; - r.w = r.w / d; - r.x = r.x / d; - r.y = r.y / d; - r.z = r.z / d; - return r; + r->w = q.w / d; + r->x = q.x / d; + r->y = q.y / d; + r->z = q.z / d; } -Quaternion QuaternionNormalize( - const Quaternion q ) +void QuaternionNormalize( + const Quaternion q, + Quaternion *const r ) { - Quaternion r = q; - r = QuaternionDivision( r, sqrtf( QuaternionDotProduct( r, r ) ) ); - return r; + QuaternionDivision( q, sqrtf( QuaternionDotProduct( q, q ) ), r ); } -Quaternion QuaternionSlerp( +void QuaternionSlerp( const Quaternion q1, const Quaternion q2, - const float t ) + const float t, + Quaternion *const r ) { - Quaternion r; float angle, denom, s, s2; - - angle = acosf( QuaternionDotProduct( q1, q2 ) ); - denom = sinf( angle ); - - // check if denom is zero means same rotation - if ( denom < 0.0001F && denom > -0.0001F ) + s = QuaternionDotProduct( q1, q2 ); + if ( fabsf(s) >= 1.0f ) { - return q2; + *r = q2; + return; } + angle = acosf( s ); + denom = sinf( angle ); s = sinf( 1 - t ) * angle; s2 = sinf( t * angle ); - r.x = ( q1.x * s + q2.x * s2 ) / denom; - r.y = ( q1.y * s + q2.y * s2 ) / denom; - r.z = ( q1.z * s + q2.z * s2 ) / denom; - r.w = ( q1.w * s + q2.w * s2 ) / denom; + r->x = ( q1.x * s + q2.x * s2 ) / denom; + r->y = ( q1.y * s + q2.y * s2 ) / denom; + r->z = ( q1.z * s + q2.z * s2 ) / denom; + r->w = ( q1.w * s + q2.w * s2 ) / denom; - return QuaternionNormalize( r ); + QuaternionNormalize( *r, r ); } -Quaternion QuaternionConjugate( - const Quaternion q ) +void QuaternionConjugate( + const Quaternion q, + Quaternion *const r ) { - Quaternion r = q; - r.x = -r.x; - r.y = -r.y; - r.z = -r.z; - return r; + r->w = q.w; + r->x = -q.x; + r->y = -q.y; + r->z = -q.z; } float QuaternionAngle( @@ -151,22 +148,21 @@ float QuaternionAngle( { Quaternion q12; float angle; - - q12 = QuaternionProduct( QuaternionConjugate( q1 ), q2 ); + QuaternionConjugate( q1, &q12 ); + QuaternionProduct( q12, q2, &q12 ); angle = 2.0f * atan2f( sqrtf( q12.x * q12.x + q12.y * q12.y + q12.z * q12.z ), q12.w ); return angle; } -Quaternion QuaternionInverse( - const Quaternion q ) +void QuaternionInverse( + const Quaternion q, + Quaternion *const r ) { - Quaternion r; float dot_product; dot_product = QuaternionDotProduct( q, q ); - r = QuaternionConjugate( q ); - r = QuaternionDivision( r, dot_product ); - return r; + QuaternionConjugate( q, r ); + QuaternionDivision( *r, dot_product, r ); } #else @@ -303,7 +299,7 @@ ivas_error ivas_orient_trk_Process( ivas_orient_trk_state_t *pOTR, Quaternion absRot, float updateRate, - Quaternion *pTrkRot) + Quaternion *pTrkRot ) { float normalizedOrientation; float relativeOrientationRate; @@ -311,12 +307,16 @@ ivas_error ivas_orient_trk_Process( float cutoffFrequency; float alpha = pOTR->alpha; float ang; + Quaternion tq; + if ( pOTR->trackingType == OTR_TRACKING_AVG_ORIENT ) { /* Compute average (low-pass filtered) absolute orientation */ - pOTR->absAvgRot = QuaternionSlerp( pOTR->absAvgRot, absRot, alpha ); + QuaternionSlerp( pOTR->absAvgRot, absRot, alpha, &pOTR->absAvgRot ); - *pTrkRot = pOTR->absAvgRot; + /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */ + QuaternionInverse( pOTR->absAvgRot, pTrkRot ); + QuaternionProduct( *pTrkRot, absRot, pTrkRot ); /* Adapt LPF constant based on orientation excursion relative to current mean: - low cutoff (slow adaptation) for small excursions (around center) @@ -358,7 +358,8 @@ ivas_error ivas_orient_trk_Process( pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate ); /* Compute relative orientation = (absolute orientation) - (reference orientation) */ - *pTrkRot = QuaternionProduct( QuaternionInverse( pOTR->refRot ), absRot ); + QuaternionInverse( pOTR->refRot, pTrkRot ); + QuaternionProduct( *pTrkRot, absRot, pTrkRot ); } else { @@ -367,8 +368,7 @@ ivas_error ivas_orient_trk_Process( } #else ivas_error ivas_orient_trk_Process( - ivas_orient_trk_state_t *pOTR -) + ivas_orient_trk_state_t *pOTR ) { float yaw; float pitch; diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 470b649ce0..94050f2637 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -400,6 +400,10 @@ ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.pcm bit ../IVAS_dec -t testv/headrot_case03_3000_q.csv BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR.tst +// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation, Orientation tracking +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.pcm bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR_OtrAvg.tst + // 1 ISm with metadata bitrate switching from 13.2 kbps to 128 kbps, 32 kHz in, 32 kHz out, mono out, DTX on ../IVAS_cod -dtx -ism 1 testv/stvISM1.csv ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv32c.pcm bit ../IVAS_dec MONO 32 bit testv/stv32c.pcm_brate_sw_32-32_mono_dtx.tst @@ -441,6 +445,10 @@ ../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.pcm bit ../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot.tst +// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.pcm bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot_OtrAvg.tst + // SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.pcm bit ../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_DTX_Binaural_FEC5.tst @@ -485,6 +493,10 @@ ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot.tst +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrAvg.tst + // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.pcm bit ../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_DTX_Binaural_FEC5.tst @@ -650,6 +662,14 @@ ../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot.tst +// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_OtrAvg.tst + +// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_OtrAvg.tst + // MASA 1dir 2TC at 48 kbps, 48kHz in, 48kHz out, 7_1_4 out, random FEC at 5% ../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 48000 48 testv/stv_IVASMASA_1dir2TC.pcm bit ../IVAS_dec -fec 5 7_1_4 48 bit testv/stv_IVASMASA_1dir2TC.pcm_48000_48-48_7_1_4_FEC5.tst @@ -783,6 +803,10 @@ ../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot.tst +// Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, head rotation, Orientation tracking +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit +../IVAS_dec -t testv/headrot_case00_3000_q.csv -otr avg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot_OtrAvg.tst + // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out ../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit ../IVAS_dec 5_1 48 bit testv/stv51MC48c.pcm_MC51_384000_48-48_5_1.tst -- GitLab From da43aab6e1c4bf95eb82567368c9379b2e4ca540 Mon Sep 17 00:00:00 2001 From: szczerba Date: Wed, 26 Oct 2022 16:32:25 +0200 Subject: [PATCH 007/375] Remove duplicated test case --- scripts/config/self_test.prm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 94050f2637..2f57ff3b48 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -666,10 +666,6 @@ ../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit ../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_OtrAvg.tst -// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_OtrAvg.tst - // MASA 1dir 2TC at 48 kbps, 48kHz in, 48kHz out, 7_1_4 out, random FEC at 5% ../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 48000 48 testv/stv_IVASMASA_1dir2TC.pcm bit ../IVAS_dec -fec 5 7_1_4 48 bit testv/stv_IVASMASA_1dir2TC.pcm_48000_48-48_7_1_4_FEC5.tst -- GitLab From d86fd7b77bd3b852250dbf5e1d5f8edb8855d3ef Mon Sep 17 00:00:00 2001 From: szczerba Date: Thu, 27 Oct 2022 10:28:41 +0200 Subject: [PATCH 008/375] Fix for Slerp function. Cleanup --- lib_com/ivas_prot.h | 22 +++--------- lib_dec/ivas_orient_trk.c | 51 +++++++++++++++++++------- lib_dec/ivas_rotation.c | 75 ++------------------------------------- 3 files changed, 44 insertions(+), 104 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 4e41a54a08..7fcea7a3af 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4556,27 +4556,13 @@ void QuatToRotMat( float Rmat[3][3] /* o : real-space rotation matrix for this rotation */ ); +#ifndef FIX_I109_ORIENTATION_TRACKING void Quat2Euler( const Quaternion quat, /* i : quaternion describing the rotation */ float *yaw, /* o : yaw */ float *pitch, /* o : pitch */ float *roll /* o : roll */ ); - -#ifdef FIX_I109_ORIENTATION_TRACKING -void Euler2Quat( - const float yaw, /* i : yaw */ - const float pitch, /* i : pitch */ - const float roll, /* i : roll */ - Quaternion *quat /* o : quaternion describing the rotation */ -); - -void Euler2RotMat( - const float yaw, /* i : yaw */ - const float pitch, /* i : pitch */ - const float roll, /* i : roll */ - float Rmat[3][3] /* o : real-space rotation matrix for this rotation */ -); #endif void rotateAziEle( @@ -5503,12 +5489,12 @@ void ivas_reverb_get_hrtf_set_properties( /* Orientation tracking */ void ivas_orient_trk_Init( - ivas_orient_trk_state_t *pOTR + ivas_orient_trk_state_t *pOTR /* i/o : orientation tracker handle */ ); ivas_error ivas_orient_trk_SetTrackingType( - ivas_orient_trk_state_t *pOTR, - OTR_TRACKING_T trackingType + ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ + OTR_TRACKING_T trackingType /* i : orientation tracking type */ ); #ifdef FIX_I109_ORIENTATION_TRACKING diff --git a/lib_dec/ivas_orient_trk.c b/lib_dec/ivas_orient_trk.c index 2240ed1759..39fa74fd51 100644 --- a/lib_dec/ivas_orient_trk.c +++ b/lib_dec/ivas_orient_trk.c @@ -53,11 +53,16 @@ /* TODO relate to frame rate - assumed here 50Hz, i.e. 20ms frame length */ #define OTR_UPDATE_RATE ( 50.0f ) /* rate of the Process() calls [Hz]; 1x per IVAS frame */ + /*------------------------------------------------------------------------------------------* * Local functions *------------------------------------------------------------------------------------------*/ #ifdef FIX_I109_ORIENTATION_TRACKING + +/*------------------------------------------------------------------------------------------* + * Declarations + *------------------------------------------------------------------------------------------*/ void QuaternionProduct( const Quaternion q1, const Quaternion q2, Quaternion *const result ); float QuaternionDotProduct( const Quaternion q1, const Quaternion ); void QuaternionDivision( const Quaternion q, const float d, Quaternion *const result ); @@ -81,6 +86,9 @@ void QuaternionProduct( *r = tmp; } +/*------------------------------------------------------------------------------------------* + * Quaternion dot product + *------------------------------------------------------------------------------------------*/ float QuaternionDotProduct( const Quaternion q1, const Quaternion q2 ) @@ -88,6 +96,9 @@ float QuaternionDotProduct( return q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w; } +/*------------------------------------------------------------------------------------------* + * Divides a quaternion by a scalar + *------------------------------------------------------------------------------------------*/ void QuaternionDivision( const Quaternion q, const float d, @@ -99,6 +110,9 @@ void QuaternionDivision( r->z = q.z / d; } +/*------------------------------------------------------------------------------------------* + * Normalizes a quaternion + *------------------------------------------------------------------------------------------*/ void QuaternionNormalize( const Quaternion q, Quaternion *const r ) @@ -106,6 +120,9 @@ void QuaternionNormalize( QuaternionDivision( q, sqrtf( QuaternionDotProduct( q, q ) ), r ); } +/*------------------------------------------------------------------------------------------* + * Computes a spherical linear interpolation between two quaternions + *------------------------------------------------------------------------------------------*/ void QuaternionSlerp( const Quaternion q1, const Quaternion q2, @@ -122,7 +139,7 @@ void QuaternionSlerp( angle = acosf( s ); denom = sinf( angle ); - s = sinf( 1 - t ) * angle; + s = sinf( ( 1 - t ) * angle ); s2 = sinf( t * angle ); r->x = ( q1.x * s + q2.x * s2 ) / denom; r->y = ( q1.y * s + q2.y * s2 ) / denom; @@ -132,6 +149,9 @@ void QuaternionSlerp( QuaternionNormalize( *r, r ); } +/*------------------------------------------------------------------------------------------* + * Computes a quaternion conjugate + *------------------------------------------------------------------------------------------*/ void QuaternionConjugate( const Quaternion q, Quaternion *const r ) @@ -142,6 +162,9 @@ void QuaternionConjugate( r->z = -q.z; } +/*------------------------------------------------------------------------------------------* + * Computes an angle between two quaternions + *------------------------------------------------------------------------------------------*/ float QuaternionAngle( const Quaternion q1, const Quaternion q2 ) @@ -154,6 +177,9 @@ float QuaternionAngle( return angle; } +/*------------------------------------------------------------------------------------------* + * Computes an inverse quaternion + *------------------------------------------------------------------------------------------*/ void QuaternionInverse( const Quaternion q, Quaternion *const r ) @@ -212,7 +238,7 @@ static float ClipAngle( *-------------------------------------------------------------------*/ void ivas_orient_trk_Init( - ivas_orient_trk_state_t *pOTR ) + ivas_orient_trk_state_t *pOTR ) /* i/o : orientation tracker handle */ { /* Track relative to a reference orientation */ pOTR->trackingType = OTR_TRACKING_REF_ORIENT; @@ -251,6 +277,7 @@ void ivas_orient_trk_Init( #endif } + /*-------------------------------------------------------------------* * ivas_orient_trk_SetTrackingType() * @@ -258,15 +285,14 @@ void ivas_orient_trk_Init( *-------------------------------------------------------------------*/ ivas_error ivas_orient_trk_SetTrackingType( - ivas_orient_trk_state_t *pOTR, - OTR_TRACKING_T trackingType ) + ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ + OTR_TRACKING_T trackingType ) /* i/o : orientation tracking type */ { pOTR->trackingType = trackingType; return IVAS_ERR_OK; } -#ifdef FIX_I109_ORIENTATION_TRACKING -#else +#ifndef FIX_I109_ORIENTATION_TRACKING /*-------------------------------------------------------------------* * ivas_orient_trk_SetAbsoluteOrientation() * @@ -296,10 +322,10 @@ ivas_error ivas_orient_trk_SetAbsoluteOrientation( #ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_Process( - ivas_orient_trk_state_t *pOTR, - Quaternion absRot, - float updateRate, - Quaternion *pTrkRot ) + ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ + Quaternion absRot, /* i : absolute head rotation */ + float updateRate, /* i : rotation update rate [Hz] */ + Quaternion *pTrkRot ) /* o : tracked rotation */ { float normalizedOrientation; float relativeOrientationRate; @@ -307,7 +333,6 @@ ivas_error ivas_orient_trk_Process( float cutoffFrequency; float alpha = pOTR->alpha; float ang; - Quaternion tq; if ( pOTR->trackingType == OTR_TRACKING_AVG_ORIENT ) { @@ -482,8 +507,7 @@ ivas_error ivas_orient_trk_Process( return IVAS_ERR_OK; } -#ifdef FIX_I109_ORIENTATION_TRACKING -#else +#ifndef FIX_I109_ORIENTATION_TRACKING /*-------------------------------------------------------------------* * ivas_orient_trk_GetTrackedOrientation() * @@ -499,6 +523,7 @@ ivas_error ivas_orient_trk_GetTrackedOrientation( *yaw = pOTR->trkYaw; *pitch = pOTR->trkPitch; *roll = pOTR->trkRoll; + return IVAS_ERR_OK; } #endif diff --git a/lib_dec/ivas_rotation.c b/lib_dec/ivas_rotation.c index 1253474952..9686f828e3 100644 --- a/lib_dec/ivas_rotation.c +++ b/lib_dec/ivas_rotation.c @@ -105,7 +105,7 @@ ivas_error ivas_headTrack_open( #ifdef FIX_I109_ORIENTATION_TRACKING /*-----------------------------------------------------------------------* - * ivas_headTrack_closes() + * ivas_headTrack_close() * * Deallocate Head-Tracking handle *-----------------------------------------------------------------------*/ @@ -195,6 +195,7 @@ void QuatToRotMat( return; } +#ifndef FIX_I109_ORIENTATION_TRACKING /*------------------------------------------------------------------------- * Quat2Euler() * @@ -210,15 +211,9 @@ void Quat2Euler( { if ( quat.w != -3.0 ) { -#ifdef FIX_I109_ORIENTATION_TRACKING - *yaw = atan2f( 2.0f * ( quat.w * quat.z + quat.x * quat.y ), 1.0f - 2.0f * ( quat.y * quat.y + quat.z * quat.z ) ); - *pitch = asinf( 2.0f * ( quat.w * quat.y - quat.z * quat.x ) ); - *roll = atan2f( 2.0f * ( quat.w * quat.x + quat.y * quat.z ), 1.0f - 2.0f * ( quat.x * quat.x + quat.y * quat.y ) ); -#else *yaw = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) ); *roll = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) ); -#endif } else { @@ -235,72 +230,6 @@ void Quat2Euler( return; } - -#ifdef FIX_I109_ORIENTATION_TRACKING -/*------------------------------------------------------------------------- - * Quat2Euler() - * - * Euler handling: calculate corresponding Quaternions - *------------------------------------------------------------------------*/ - -void Euler2Quat( - const float yaw, /* i : yaw */ - const float pitch, /* i : pitch */ - const float roll, /* i : roll */ - Quaternion *quat /* o : quaternion describing the rotation */ -) -{ - float cos_y_2, sin_y_2, cos_p_2, sin_p_2, cos_r_2, sin_r_2; - cos_y_2 = cosf( yaw * 0.5f ); - sin_y_2 = sinf( yaw * 0.5f ); - cos_p_2 = cosf( pitch * 0.5f ); - sin_p_2 = sinf( pitch * 0.5f ); - cos_r_2 = cosf( roll * 0.5f ); - sin_r_2 = sinf( roll * 0.5f ); - - quat->w = cos_y_2 * cos_p_2 * cos_r_2 + sin_y_2 * sin_p_2 * sin_r_2; - quat->x = cos_y_2 * cos_p_2 * sin_r_2 - sin_y_2 * sin_p_2 * cos_r_2; - quat->y = cos_y_2 * sin_p_2 * cos_r_2 + sin_y_2 * cos_p_2 * sin_r_2; - quat->z = sin_y_2 * cos_p_2 * cos_r_2 - cos_y_2 * sin_p_2 * sin_r_2; - - return; -} - -/*------------------------------------------------------------------------- - * Quat2Euler() - * - * Euler handling: calculate rotation matrices in real-space and SHD - *------------------------------------------------------------------------*/ -void Euler2RotMat( - const float yaw, /* i : yaw */ - const float pitch, /* i : pitch */ - const float roll, /* i : roll */ - float Rmat[3][3] /* o : real-space rotation matrix for this rotation */ -) -{ - float c_1, c_2, c_3; - float s_1, s_2, s_3; - - c_1 = cosf( yaw ); - c_2 = cosf( pitch ); - c_3 = cosf( roll ); - - s_1 = sinf( yaw ); - s_2 = sinf( pitch ); - s_3 = sinf( roll ); - - Rmat[0][0] = c_1 * c_2; - Rmat[0][1] = c_1 * s_2 * s_3 - s_1 * c_3; - Rmat[0][2] = c_1 * s_2 * c_3 + s_1 * s_3; - - Rmat[1][0] = s_1 * c_2; - Rmat[1][1] = s_1 * s_2 * s_3 + c_1 * c_3; - Rmat[1][2] = s_1 * s_2 * c_3 - c_1 * s_3; - - Rmat[2][0] = -s_2; - Rmat[2][1] = c_2 * s_3; - Rmat[2][2] = c_2 * c_3; -} #endif /*------------------------------------------------------------------------- -- GitLab From 37d74691f0d3d39b308c0df607526b5d5f7be30c Mon Sep 17 00:00:00 2001 From: szczerba Date: Thu, 27 Oct 2022 15:11:17 +0200 Subject: [PATCH 009/375] Added a test case for high bitrate SBA, updated head rotation input for MC test case --- scripts/config/self_test.prm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 2f57ff3b48..cb7d12e91e 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -553,6 +553,10 @@ ../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.pcm bit ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot.tst +// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.pcm bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_OtrAvg.tst + // SBA at 192 kbps, 48kHz in, 48kHz out, HOA2 out, random FEC at 5% ../IVAS_cod -sba 3 192000 48 testv/stv3OA48c.pcm bit ../IVAS_dec -fec 5 HOA2 48 bit testv/stv3OA48c.pcm_SBA_192000_48-48_HOA2_FEC5.tst @@ -801,7 +805,7 @@ // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, head rotation, Orientation tracking ../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit -../IVAS_dec -t testv/headrot_case00_3000_q.csv -otr avg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot_OtrAvg.tst +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot_OtrAvg.tst // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out ../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit -- GitLab From 37349f0a9bbfc6cc6a4b0f13fa145fe48ebd89de Mon Sep 17 00:00:00 2001 From: szczerba Date: Fri, 4 Nov 2022 13:42:47 +0100 Subject: [PATCH 010/375] Orientation tracking: fix for target rotation matrix, subframe processing --- lib_dec/ivas_binauralRenderer.c | 5 ++++- lib_dec/ivas_rotation.c | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_binauralRenderer.c b/lib_dec/ivas_binauralRenderer.c index 743233cb75..b237a8312b 100644 --- a/lib_dec/ivas_binauralRenderer.c +++ b/lib_dec/ivas_binauralRenderer.c @@ -899,7 +899,10 @@ void ivas_binRenderer( if ( hHeadTrackData->shd_rot_max_order == -1 ) { #ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], FRAMES_PER_SEC, &trackedHeadOrientation ); + ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, + hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], + FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, + &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); #else QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); diff --git a/lib_dec/ivas_rotation.c b/lib_dec/ivas_rotation.c index 9686f828e3..83e7617c6d 100644 --- a/lib_dec/ivas_rotation.c +++ b/lib_dec/ivas_rotation.c @@ -741,9 +741,9 @@ void rotateFrame_sd_cldfb( #ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], - FRAMES_PER_SEC, + FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ); - QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); + QuatToRotMat( trackedHeadOrientation, Rmat ); #else /* Get next quaternion and calculate rotation matrix */ QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], Rmat ); -- GitLab From 01101917519d95fdb891689b5e5b49cfaf628117 Mon Sep 17 00:00:00 2001 From: szczerba Date: Mon, 7 Nov 2022 09:04:28 +0100 Subject: [PATCH 011/375] Minor cleanup --- lib_com/ivas_cnst.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 7051caf9a5..26688702e9 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1441,8 +1441,8 @@ typedef enum typedef enum { - OTR_TRACKING_NONE = IVAS_ORIENT_TRK_REF-1, /* track orientation relative to external reference orientation (default: yaw=pitch=roll=0) */ - OTR_TRACKING_REF_ORIENT = IVAS_ORIENT_TRK_REF, /* track orientation relative to external reference orientation (default: yaw=pitch=roll=0) */ + OTR_TRACKING_NONE = IVAS_ORIENT_TRK_REF-1, + OTR_TRACKING_REF_ORIENT = IVAS_ORIENT_TRK_REF, /* track orientation relative to external reference orientation (default: no rotation) */ OTR_TRACKING_AVG_ORIENT = IVAS_ORIENT_TRK_AVG /* track orientation relative to average orientation */ } OTR_TRACKING_T; -- GitLab From e04092f8800cf48c6d1c48707746420152069aa3 Mon Sep 17 00:00:00 2001 From: szczerba Date: Wed, 9 Nov 2022 09:01:07 +0100 Subject: [PATCH 012/375] Minor updates to satisfy wmc_tool requirements --- lib_dec/ivas_orient_trk.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_orient_trk.c b/lib_dec/ivas_orient_trk.c index 39fa74fd51..96f67cba5c 100644 --- a/lib_dec/ivas_orient_trk.c +++ b/lib_dec/ivas_orient_trk.c @@ -252,10 +252,15 @@ void ivas_orient_trk_Init( pOTR->alpha = sinf( PI2 * pOTR->offCenterAdaptationRate / OTR_UPDATE_RATE ); /* start adaptation at off-center rate = fastest rate */ #ifdef FIX_I109_ORIENTATION_TRACKING - pOTR->absAvgRot = ( Quaternion ){ .w = 1.f, .x = 0.f, .y = 0.f, .z = 0.f }; + pOTR->absAvgRot.w = 1.0f; + pOTR->absAvgRot.x = 0.0f; + pOTR->absAvgRot.y = 0.0f; + pOTR->absAvgRot.z = 0.0f; /* Use frontal and horiontal orientation as reference orientation, unless/until overridden */ - pOTR->refRot = ( Quaternion ){ .w = 1.f, .x = 0.f, .y = 0.f, .z = 0.f }; - + pOTR->refRot.w = 1.0f; + pOTR->refRot.x = 0.0f; + pOTR->refRot.y = 0.0f; + pOTR->refRot.z = 0.0f; #else pOTR->absYaw = 0.0f; pOTR->absPitch = 0.0f; @@ -391,6 +396,9 @@ ivas_error ivas_orient_trk_Process( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Non-supported orientation tracking adaptation type" ); } } + + return IVAS_ERR_OK; +} #else ivas_error ivas_orient_trk_Process( ivas_orient_trk_state_t *pOTR ) @@ -502,12 +510,10 @@ ivas_error ivas_orient_trk_Process( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Non-supported orientation tracking adaptation type" ); } } -#endif return IVAS_ERR_OK; } -#ifndef FIX_I109_ORIENTATION_TRACKING /*-------------------------------------------------------------------* * ivas_orient_trk_GetTrackedOrientation() * -- GitLab From 805a0bc39406a02e3b4f7145a2505ecfb00e62eb Mon Sep 17 00:00:00 2001 From: szczerba Date: Wed, 9 Nov 2022 09:10:10 +0100 Subject: [PATCH 013/375] Newly added orientation tracking test cases removed to prevent test failures with missing references --- scripts/config/self_test.prm | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 93793171b0..15e0be1ab5 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -400,10 +400,6 @@ ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.pcm bit ../IVAS_dec -t testv/headrot_case03_3000_q.csv BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR.tst -// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation, Orientation tracking -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.pcm bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR_OtrAvg.tst - // 1 ISm with metadata bitrate switching from 13.2 kbps to 128 kbps, 32 kHz in, 32 kHz out, mono out, DTX on ../IVAS_cod -dtx -ism 1 testv/stvISM1.csv ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv32c.pcm bit ../IVAS_dec MONO 32 bit testv/stv32c.pcm_brate_sw_32-32_mono_dtx.tst @@ -445,10 +441,6 @@ ../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.pcm bit ../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot.tst -// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation, Orientation tracking -../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.pcm bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot_OtrAvg.tst - // SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.pcm bit ../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_DTX_Binaural_FEC5.tst @@ -493,10 +485,6 @@ ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot.tst -// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrAvg.tst - // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.pcm bit ../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_DTX_Binaural_FEC5.tst @@ -553,10 +541,6 @@ ../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.pcm bit ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot.tst -// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking -../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.pcm bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_OtrAvg.tst - // SBA at 192 kbps, 48kHz in, 48kHz out, HOA2 out, random FEC at 5% ../IVAS_cod -sba 3 192000 48 testv/stv3OA48c.pcm bit ../IVAS_dec -fec 5 HOA2 48 bit testv/stv3OA48c.pcm_SBA_192000_48-48_HOA2_FEC5.tst @@ -681,10 +665,6 @@ ../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot.tst -// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_OtrAvg.tst - // MASA 1dir 2TC at 48 kbps, 48kHz in, 48kHz out, 7_1_4 out, random FEC at 5% ../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 48000 48 testv/stv_IVASMASA_1dir2TC.pcm bit ../IVAS_dec -fec 5 7_1_4 48 bit testv/stv_IVASMASA_1dir2TC.pcm_48000_48-48_7_1_4_FEC5.tst @@ -818,10 +798,6 @@ ../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot.tst -// Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, head rotation, Orientation tracking -../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot_OtrAvg.tst - // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out ../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit ../IVAS_dec 5_1 48 bit testv/stv51MC48c.pcm_MC51_384000_48-48_5_1.tst -- GitLab From 8ad60d876aded6a941fb664a1e02a4bf1f0d1bb5 Mon Sep 17 00:00:00 2001 From: szczerba Date: Wed, 9 Nov 2022 09:32:13 +0100 Subject: [PATCH 014/375] Remove redundant file --- .../3.24.2/CompilerIdC/CMakeCCompilerId.c | 838 ------------------ 1 file changed, 838 deletions(-) delete mode 100644 CMakeFiles/3.24.2/CompilerIdC/CMakeCCompilerId.c diff --git a/CMakeFiles/3.24.2/CompilerIdC/CMakeCCompilerId.c b/CMakeFiles/3.24.2/CompilerIdC/CMakeCCompilerId.c deleted file mode 100644 index 2b43aa69b0..0000000000 --- a/CMakeFiles/3.24.2/CompilerIdC/CMakeCCompilerId.c +++ /dev/null @@ -1,838 +0,0 @@ -#ifdef __cplusplus -# error "A C++ compiler has been selected for C." -#endif - -#if defined(__18CXX) -# define ID_VOID_MAIN -#endif -#if defined(__CLASSIC_C__) -/* cv-qualifiers did not exist in K&R C */ -# define const -# define volatile -#endif - -#if !defined(__has_include) -/* If the compiler does not have __has_include, pretend the answer is - always no. */ -# define __has_include(x) 0 -#endif - - -/* Version number components: V=Version, R=Revision, P=Patch - Version date components: YYYY=Year, MM=Month, DD=Day */ - -#if defined(__INTEL_COMPILER) || defined(__ICC) -# define COMPILER_ID "Intel" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif -# if defined(__GNUC__) -# define SIMULATE_ID "GNU" -# endif - /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, - except that a few beta releases use the old format with V=2021. */ -# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 -# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) -# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) -# if defined(__INTEL_COMPILER_UPDATE) -# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) -# else -# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) -# endif -# else -# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) -# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) - /* The third version component from --version is an update index, - but no macro is provided for it. */ -# define COMPILER_VERSION_PATCH DEC(0) -# endif -# if defined(__INTEL_COMPILER_BUILD_DATE) - /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ -# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) -# endif -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif -# if defined(__GNUC__) -# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) -# elif defined(__GNUG__) -# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) -# endif -# if defined(__GNUC_MINOR__) -# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) -# endif -# if defined(__GNUC_PATCHLEVEL__) -# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -# endif - -#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) -# define COMPILER_ID "IntelLLVM" -#if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -#endif -#if defined(__GNUC__) -# define SIMULATE_ID "GNU" -#endif -/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and - * later. Look for 6 digit vs. 8 digit version number to decide encoding. - * VVVV is no smaller than the current year when a version is released. - */ -#if __INTEL_LLVM_COMPILER < 1000000L -# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) -# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) -#else -# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) -# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) -# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) -#endif -#if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -#endif -#if defined(__GNUC__) -# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) -#elif defined(__GNUG__) -# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) -#endif -#if defined(__GNUC_MINOR__) -# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) -#endif -#if defined(__GNUC_PATCHLEVEL__) -# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -#endif - -#elif defined(__PATHCC__) -# define COMPILER_ID "PathScale" -# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) -# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) -# if defined(__PATHCC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) -# endif - -#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) -# define COMPILER_ID "Embarcadero" -# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) -# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) - -#elif defined(__BORLANDC__) -# define COMPILER_ID "Borland" - /* __BORLANDC__ = 0xVRR */ -# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) -# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) - -#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 -# define COMPILER_ID "Watcom" - /* __WATCOMC__ = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) -# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) -# if (__WATCOMC__ % 10) > 0 -# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) -# endif - -#elif defined(__WATCOMC__) -# define COMPILER_ID "OpenWatcom" - /* __WATCOMC__ = VVRP + 1100 */ -# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) -# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) -# if (__WATCOMC__ % 10) > 0 -# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) -# endif - -#elif defined(__SUNPRO_C) -# define COMPILER_ID "SunPro" -# if __SUNPRO_C >= 0x5100 - /* __SUNPRO_C = 0xVRRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) -# else - /* __SUNPRO_CC = 0xVRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) -# endif - -#elif defined(__HP_cc) -# define COMPILER_ID "HP" - /* __HP_cc = VVRRPP */ -# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) -# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) -# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) - -#elif defined(__DECC) -# define COMPILER_ID "Compaq" - /* __DECC_VER = VVRRTPPPP */ -# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) -# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) -# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) - -#elif defined(__IBMC__) && defined(__COMPILER_VER__) -# define COMPILER_ID "zOS" - /* __IBMC__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) - -#elif defined(__open_xl__) && defined(__clang__) -# define COMPILER_ID "IBMClang" -# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__) -# define COMPILER_VERSION_MINOR DEC(__open_xl_release__) -# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__) -# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__) - - -#elif defined(__ibmxl__) && defined(__clang__) -# define COMPILER_ID "XLClang" -# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) -# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) -# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) -# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) - - -#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 -# define COMPILER_ID "XL" - /* __IBMC__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) - -#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 -# define COMPILER_ID "VisualAge" - /* __IBMC__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) - -#elif defined(__NVCOMPILER) -# define COMPILER_ID "NVHPC" -# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) -# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) -# if defined(__NVCOMPILER_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) -# endif - -#elif defined(__PGI) -# define COMPILER_ID "PGI" -# define COMPILER_VERSION_MAJOR DEC(__PGIC__) -# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) -# if defined(__PGIC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) -# endif - -#elif defined(_CRAYC) -# define COMPILER_ID "Cray" -# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) -# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) - -#elif defined(__TI_COMPILER_VERSION__) -# define COMPILER_ID "TI" - /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ -# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) -# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) -# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) - -#elif defined(__CLANG_FUJITSU) -# define COMPILER_ID "FujitsuClang" -# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) -# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) -# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) -# define COMPILER_VERSION_INTERNAL_STR __clang_version__ - - -#elif defined(__FUJITSU) -# define COMPILER_ID "Fujitsu" -# if defined(__FCC_version__) -# define COMPILER_VERSION __FCC_version__ -# elif defined(__FCC_major__) -# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) -# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) -# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) -# endif -# if defined(__fcc_version) -# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) -# elif defined(__FCC_VERSION) -# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) -# endif - - -#elif defined(__ghs__) -# define COMPILER_ID "GHS" -/* __GHS_VERSION_NUMBER = VVVVRP */ -# ifdef __GHS_VERSION_NUMBER -# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) -# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) -# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) -# endif - -#elif defined(__TINYC__) -# define COMPILER_ID "TinyCC" - -#elif defined(__BCC__) -# define COMPILER_ID "Bruce" - -#elif defined(__SCO_VERSION__) -# define COMPILER_ID "SCO" - -#elif defined(__ARMCC_VERSION) && !defined(__clang__) -# define COMPILER_ID "ARMCC" -#if __ARMCC_VERSION >= 1000000 - /* __ARMCC_VERSION = VRRPPPP */ - # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) - # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) - # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) -#else - /* __ARMCC_VERSION = VRPPPP */ - # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) - # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) - # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) -#endif - - -#elif defined(__clang__) && defined(__apple_build_version__) -# define COMPILER_ID "AppleClang" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif -# define COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif -# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) - -#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) -# define COMPILER_ID "ARMClang" - # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) - # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) - # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) -# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) - -#elif defined(__clang__) -# define COMPILER_ID "Clang" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif -# define COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif - -#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__)) -# define COMPILER_ID "LCC" -# define COMPILER_VERSION_MAJOR DEC(1) -# if defined(__LCC__) -# define COMPILER_VERSION_MINOR DEC(__LCC__- 100) -# endif -# if defined(__LCC_MINOR__) -# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__) -# endif -# if defined(__GNUC__) && defined(__GNUC_MINOR__) -# define SIMULATE_ID "GNU" -# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) -# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) -# if defined(__GNUC_PATCHLEVEL__) -# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -# endif -# endif - -#elif defined(__GNUC__) -# define COMPILER_ID "GNU" -# define COMPILER_VERSION_MAJOR DEC(__GNUC__) -# if defined(__GNUC_MINOR__) -# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) -# endif -# if defined(__GNUC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -# endif - -#elif defined(_MSC_VER) -# define COMPILER_ID "MSVC" - /* _MSC_VER = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) -# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) -# if defined(_MSC_FULL_VER) -# if _MSC_VER >= 1400 - /* _MSC_FULL_VER = VVRRPPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) -# else - /* _MSC_FULL_VER = VVRRPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) -# endif -# endif -# if defined(_MSC_BUILD) -# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) -# endif - -#elif defined(_ADI_COMPILER) -# define COMPILER_ID "ADSP" -#if defined(__VERSIONNUM__) - /* __VERSIONNUM__ = 0xVVRRPPTT */ -# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF) -# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF) -# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF) -# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF) -#endif - -#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) -# define COMPILER_ID "IAR" -# if defined(__VER__) && defined(__ICCARM__) -# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) -# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) -# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) -# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) -# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) -# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) -# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) -# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) -# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) -# endif - -#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) -# define COMPILER_ID "SDCC" -# if defined(__SDCC_VERSION_MAJOR) -# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) -# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) -# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) -# else - /* SDCC = VRP */ -# define COMPILER_VERSION_MAJOR DEC(SDCC/100) -# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) -# define COMPILER_VERSION_PATCH DEC(SDCC % 10) -# endif - - -/* These compilers are either not known or too old to define an - identification macro. Try to identify the platform and guess that - it is the native compiler. */ -#elif defined(__hpux) || defined(__hpua) -# define COMPILER_ID "HP" - -#else /* unknown compiler */ -# define COMPILER_ID "" -#endif - -/* Construct the string literal in pieces to prevent the source from - getting matched. Store it in a pointer rather than an array - because some compilers will just produce instructions to fill the - array rather than assigning a pointer to a static array. */ -char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; -#ifdef SIMULATE_ID -char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; -#endif - -#ifdef __QNXNTO__ -char const* qnxnto = "INFO" ":" "qnxnto[]"; -#endif - -#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) -char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; -#endif - -#define STRINGIFY_HELPER(X) #X -#define STRINGIFY(X) STRINGIFY_HELPER(X) - -/* Identify known platforms by name. */ -#if defined(__linux) || defined(__linux__) || defined(linux) -# define PLATFORM_ID "Linux" - -#elif defined(__MSYS__) -# define PLATFORM_ID "MSYS" - -#elif defined(__CYGWIN__) -# define PLATFORM_ID "Cygwin" - -#elif defined(__MINGW32__) -# define PLATFORM_ID "MinGW" - -#elif defined(__APPLE__) -# define PLATFORM_ID "Darwin" - -#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) -# define PLATFORM_ID "Windows" - -#elif defined(__FreeBSD__) || defined(__FreeBSD) -# define PLATFORM_ID "FreeBSD" - -#elif defined(__NetBSD__) || defined(__NetBSD) -# define PLATFORM_ID "NetBSD" - -#elif defined(__OpenBSD__) || defined(__OPENBSD) -# define PLATFORM_ID "OpenBSD" - -#elif defined(__sun) || defined(sun) -# define PLATFORM_ID "SunOS" - -#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) -# define PLATFORM_ID "AIX" - -#elif defined(__hpux) || defined(__hpux__) -# define PLATFORM_ID "HP-UX" - -#elif defined(__HAIKU__) -# define PLATFORM_ID "Haiku" - -#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) -# define PLATFORM_ID "BeOS" - -#elif defined(__QNX__) || defined(__QNXNTO__) -# define PLATFORM_ID "QNX" - -#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) -# define PLATFORM_ID "Tru64" - -#elif defined(__riscos) || defined(__riscos__) -# define PLATFORM_ID "RISCos" - -#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) -# define PLATFORM_ID "SINIX" - -#elif defined(__UNIX_SV__) -# define PLATFORM_ID "UNIX_SV" - -#elif defined(__bsdos__) -# define PLATFORM_ID "BSDOS" - -#elif defined(_MPRAS) || defined(MPRAS) -# define PLATFORM_ID "MP-RAS" - -#elif defined(__osf) || defined(__osf__) -# define PLATFORM_ID "OSF1" - -#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) -# define PLATFORM_ID "SCO_SV" - -#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) -# define PLATFORM_ID "ULTRIX" - -#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) -# define PLATFORM_ID "Xenix" - -#elif defined(__WATCOMC__) -# if defined(__LINUX__) -# define PLATFORM_ID "Linux" - -# elif defined(__DOS__) -# define PLATFORM_ID "DOS" - -# elif defined(__OS2__) -# define PLATFORM_ID "OS2" - -# elif defined(__WINDOWS__) -# define PLATFORM_ID "Windows3x" - -# elif defined(__VXWORKS__) -# define PLATFORM_ID "VxWorks" - -# else /* unknown platform */ -# define PLATFORM_ID -# endif - -#elif defined(__INTEGRITY) -# if defined(INT_178B) -# define PLATFORM_ID "Integrity178" - -# else /* regular Integrity */ -# define PLATFORM_ID "Integrity" -# endif - -# elif defined(_ADI_COMPILER) -# define PLATFORM_ID "ADSP" - -#else /* unknown platform */ -# define PLATFORM_ID - -#endif - -/* For windows compilers MSVC and Intel we can determine - the architecture of the compiler being used. This is because - the compilers do not have flags that can change the architecture, - but rather depend on which compiler is being used -*/ -#if defined(_WIN32) && defined(_MSC_VER) -# if defined(_M_IA64) -# define ARCHITECTURE_ID "IA64" - -# elif defined(_M_ARM64EC) -# define ARCHITECTURE_ID "ARM64EC" - -# elif defined(_M_X64) || defined(_M_AMD64) -# define ARCHITECTURE_ID "x64" - -# elif defined(_M_IX86) -# define ARCHITECTURE_ID "X86" - -# elif defined(_M_ARM64) -# define ARCHITECTURE_ID "ARM64" - -# elif defined(_M_ARM) -# if _M_ARM == 4 -# define ARCHITECTURE_ID "ARMV4I" -# elif _M_ARM == 5 -# define ARCHITECTURE_ID "ARMV5I" -# else -# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) -# endif - -# elif defined(_M_MIPS) -# define ARCHITECTURE_ID "MIPS" - -# elif defined(_M_SH) -# define ARCHITECTURE_ID "SHx" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__WATCOMC__) -# if defined(_M_I86) -# define ARCHITECTURE_ID "I86" - -# elif defined(_M_IX86) -# define ARCHITECTURE_ID "X86" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) -# if defined(__ICCARM__) -# define ARCHITECTURE_ID "ARM" - -# elif defined(__ICCRX__) -# define ARCHITECTURE_ID "RX" - -# elif defined(__ICCRH850__) -# define ARCHITECTURE_ID "RH850" - -# elif defined(__ICCRL78__) -# define ARCHITECTURE_ID "RL78" - -# elif defined(__ICCRISCV__) -# define ARCHITECTURE_ID "RISCV" - -# elif defined(__ICCAVR__) -# define ARCHITECTURE_ID "AVR" - -# elif defined(__ICC430__) -# define ARCHITECTURE_ID "MSP430" - -# elif defined(__ICCV850__) -# define ARCHITECTURE_ID "V850" - -# elif defined(__ICC8051__) -# define ARCHITECTURE_ID "8051" - -# elif defined(__ICCSTM8__) -# define ARCHITECTURE_ID "STM8" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__ghs__) -# if defined(__PPC64__) -# define ARCHITECTURE_ID "PPC64" - -# elif defined(__ppc__) -# define ARCHITECTURE_ID "PPC" - -# elif defined(__ARM__) -# define ARCHITECTURE_ID "ARM" - -# elif defined(__x86_64__) -# define ARCHITECTURE_ID "x64" - -# elif defined(__i386__) -# define ARCHITECTURE_ID "X86" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__TI_COMPILER_VERSION__) -# if defined(__TI_ARM__) -# define ARCHITECTURE_ID "ARM" - -# elif defined(__MSP430__) -# define ARCHITECTURE_ID "MSP430" - -# elif defined(__TMS320C28XX__) -# define ARCHITECTURE_ID "TMS320C28x" - -# elif defined(__TMS320C6X__) || defined(_TMS320C6X) -# define ARCHITECTURE_ID "TMS320C6x" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -# elif defined(__ADSPSHARC__) -# define ARCHITECTURE_ID "SHARC" - -# elif defined(__ADSPBLACKFIN__) -# define ARCHITECTURE_ID "Blackfin" - -#else -# define ARCHITECTURE_ID -#endif - -/* Convert integer to decimal digit literals. */ -#define DEC(n) \ - ('0' + (((n) / 10000000)%10)), \ - ('0' + (((n) / 1000000)%10)), \ - ('0' + (((n) / 100000)%10)), \ - ('0' + (((n) / 10000)%10)), \ - ('0' + (((n) / 1000)%10)), \ - ('0' + (((n) / 100)%10)), \ - ('0' + (((n) / 10)%10)), \ - ('0' + ((n) % 10)) - -/* Convert integer to hex digit literals. */ -#define HEX(n) \ - ('0' + ((n)>>28 & 0xF)), \ - ('0' + ((n)>>24 & 0xF)), \ - ('0' + ((n)>>20 & 0xF)), \ - ('0' + ((n)>>16 & 0xF)), \ - ('0' + ((n)>>12 & 0xF)), \ - ('0' + ((n)>>8 & 0xF)), \ - ('0' + ((n)>>4 & 0xF)), \ - ('0' + ((n) & 0xF)) - -/* Construct a string literal encoding the version number. */ -#ifdef COMPILER_VERSION -char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; - -/* Construct a string literal encoding the version number components. */ -#elif defined(COMPILER_VERSION_MAJOR) -char const info_version[] = { - 'I', 'N', 'F', 'O', ':', - 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', - COMPILER_VERSION_MAJOR, -# ifdef COMPILER_VERSION_MINOR - '.', COMPILER_VERSION_MINOR, -# ifdef COMPILER_VERSION_PATCH - '.', COMPILER_VERSION_PATCH, -# ifdef COMPILER_VERSION_TWEAK - '.', COMPILER_VERSION_TWEAK, -# endif -# endif -# endif - ']','\0'}; -#endif - -/* Construct a string literal encoding the internal version number. */ -#ifdef COMPILER_VERSION_INTERNAL -char const info_version_internal[] = { - 'I', 'N', 'F', 'O', ':', - 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', - 'i','n','t','e','r','n','a','l','[', - COMPILER_VERSION_INTERNAL,']','\0'}; -#elif defined(COMPILER_VERSION_INTERNAL_STR) -char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; -#endif - -/* Construct a string literal encoding the version number components. */ -#ifdef SIMULATE_VERSION_MAJOR -char const info_simulate_version[] = { - 'I', 'N', 'F', 'O', ':', - 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', - SIMULATE_VERSION_MAJOR, -# ifdef SIMULATE_VERSION_MINOR - '.', SIMULATE_VERSION_MINOR, -# ifdef SIMULATE_VERSION_PATCH - '.', SIMULATE_VERSION_PATCH, -# ifdef SIMULATE_VERSION_TWEAK - '.', SIMULATE_VERSION_TWEAK, -# endif -# endif -# endif - ']','\0'}; -#endif - -/* Construct the string literal in pieces to prevent the source from - getting matched. Store it in a pointer rather than an array - because some compilers will just produce instructions to fill the - array rather than assigning a pointer to a static array. */ -char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; -char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; - - - -#if !defined(__STDC__) && !defined(__clang__) -# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__) -# define C_VERSION "90" -# else -# define C_VERSION -# endif -#elif __STDC_VERSION__ > 201710L -# define C_VERSION "23" -#elif __STDC_VERSION__ >= 201710L -# define C_VERSION "17" -#elif __STDC_VERSION__ >= 201000L -# define C_VERSION "11" -#elif __STDC_VERSION__ >= 199901L -# define C_VERSION "99" -#else -# define C_VERSION "90" -#endif -const char* info_language_standard_default = - "INFO" ":" "standard_default[" C_VERSION "]"; - -const char* info_language_extensions_default = "INFO" ":" "extensions_default[" -#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \ - defined(__TI_COMPILER_VERSION__)) && \ - !defined(__STRICT_ANSI__) - "ON" -#else - "OFF" -#endif -"]"; - -/*--------------------------------------------------------------------------*/ - -#ifdef ID_VOID_MAIN -void main() {} -#else -# if defined(__CLASSIC_C__) -int main(argc, argv) int argc; char *argv[]; -# else -int main(int argc, char* argv[]) -# endif -{ - int require = 0; - require += info_compiler[argc]; - require += info_platform[argc]; - require += info_arch[argc]; -#ifdef COMPILER_VERSION_MAJOR - require += info_version[argc]; -#endif -#ifdef COMPILER_VERSION_INTERNAL - require += info_version_internal[argc]; -#endif -#ifdef SIMULATE_ID - require += info_simulate[argc]; -#endif -#ifdef SIMULATE_VERSION_MAJOR - require += info_simulate_version[argc]; -#endif -#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) - require += info_cray[argc]; -#endif - require += info_language_standard_default[argc]; - require += info_language_extensions_default[argc]; - (void)argv; - return require; -} -#endif -- GitLab From 36d75163656cc99aac122585f6654ff4e8d34c3d Mon Sep 17 00:00:00 2001 From: szczerba Date: Wed, 9 Nov 2022 09:40:11 +0100 Subject: [PATCH 015/375] [cleanup] formatting --- lib_dec/ivas_orient_trk.c | 18 +++++++++--------- lib_dec/ivas_stat_dec.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib_dec/ivas_orient_trk.c b/lib_dec/ivas_orient_trk.c index 96f67cba5c..a89c5cb602 100644 --- a/lib_dec/ivas_orient_trk.c +++ b/lib_dec/ivas_orient_trk.c @@ -131,7 +131,7 @@ void QuaternionSlerp( { float angle, denom, s, s2; s = QuaternionDotProduct( q1, q2 ); - if ( fabsf(s) >= 1.0f ) + if ( fabsf( s ) >= 1.0f ) { *r = q2; return; @@ -156,7 +156,7 @@ void QuaternionConjugate( const Quaternion q, Quaternion *const r ) { - r->w = q.w; + r->w = q.w; r->x = -q.x; r->y = -q.y; r->z = -q.z; @@ -238,7 +238,7 @@ static float ClipAngle( *-------------------------------------------------------------------*/ void ivas_orient_trk_Init( - ivas_orient_trk_state_t *pOTR ) /* i/o : orientation tracker handle */ + ivas_orient_trk_state_t *pOTR ) /* i/o : orientation tracker handle */ { /* Track relative to a reference orientation */ pOTR->trackingType = OTR_TRACKING_REF_ORIENT; @@ -290,8 +290,8 @@ void ivas_orient_trk_Init( *-------------------------------------------------------------------*/ ivas_error ivas_orient_trk_SetTrackingType( - ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - OTR_TRACKING_T trackingType ) /* i/o : orientation tracking type */ + ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ + OTR_TRACKING_T trackingType ) /* i/o : orientation tracking type */ { pOTR->trackingType = trackingType; return IVAS_ERR_OK; @@ -327,10 +327,10 @@ ivas_error ivas_orient_trk_SetAbsoluteOrientation( #ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_Process( - ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - Quaternion absRot, /* i : absolute head rotation */ - float updateRate, /* i : rotation update rate [Hz] */ - Quaternion *pTrkRot ) /* o : tracked rotation */ + ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ + Quaternion absRot, /* i : absolute head rotation */ + float updateRate, /* i : rotation update rate [Hz] */ + Quaternion *pTrkRot ) /* o : tracked rotation */ { float normalizedOrientation; float relativeOrientationRate; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 3193497ca3..b0b677cdea 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1362,8 +1362,8 @@ typedef struct ivas_orient_trk_state_t float alpha; - Quaternion absAvgRot; /* average absolute orientation */ - Quaternion refRot; /* reference orientation */ + Quaternion absAvgRot; /* average absolute orientation */ + Quaternion refRot; /* reference orientation */ } ivas_orient_trk_state_t; #endif -- GitLab From 4bc84c6c76c50db66f681bd456484278372ddf73 Mon Sep 17 00:00:00 2001 From: szczerba Date: Wed, 9 Nov 2022 10:07:32 +0100 Subject: [PATCH 016/375] Additional test cases for orientation tracking --- scripts/config/self_test.prm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 15e0be1ab5..93793171b0 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -400,6 +400,10 @@ ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.pcm bit ../IVAS_dec -t testv/headrot_case03_3000_q.csv BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR.tst +// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation, Orientation tracking +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.pcm bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR_OtrAvg.tst + // 1 ISm with metadata bitrate switching from 13.2 kbps to 128 kbps, 32 kHz in, 32 kHz out, mono out, DTX on ../IVAS_cod -dtx -ism 1 testv/stvISM1.csv ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv32c.pcm bit ../IVAS_dec MONO 32 bit testv/stv32c.pcm_brate_sw_32-32_mono_dtx.tst @@ -441,6 +445,10 @@ ../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.pcm bit ../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot.tst +// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.pcm bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot_OtrAvg.tst + // SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.pcm bit ../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_DTX_Binaural_FEC5.tst @@ -485,6 +493,10 @@ ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot.tst +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrAvg.tst + // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.pcm bit ../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_DTX_Binaural_FEC5.tst @@ -541,6 +553,10 @@ ../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.pcm bit ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot.tst +// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.pcm bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_OtrAvg.tst + // SBA at 192 kbps, 48kHz in, 48kHz out, HOA2 out, random FEC at 5% ../IVAS_cod -sba 3 192000 48 testv/stv3OA48c.pcm bit ../IVAS_dec -fec 5 HOA2 48 bit testv/stv3OA48c.pcm_SBA_192000_48-48_HOA2_FEC5.tst @@ -665,6 +681,10 @@ ../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot.tst +// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_OtrAvg.tst + // MASA 1dir 2TC at 48 kbps, 48kHz in, 48kHz out, 7_1_4 out, random FEC at 5% ../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 48000 48 testv/stv_IVASMASA_1dir2TC.pcm bit ../IVAS_dec -fec 5 7_1_4 48 bit testv/stv_IVASMASA_1dir2TC.pcm_48000_48-48_7_1_4_FEC5.tst @@ -798,6 +818,10 @@ ../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot.tst +// Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, head rotation, Orientation tracking +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot_OtrAvg.tst + // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out ../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit ../IVAS_dec 5_1 48 bit testv/stv51MC48c.pcm_MC51_384000_48-48_5_1.tst -- GitLab From b41fff849da368c281be5452195b96423e305c73 Mon Sep 17 00:00:00 2001 From: szczerba Date: Fri, 11 Nov 2022 12:42:19 +0100 Subject: [PATCH 017/375] [cleanup] formatting --- lib_rend/ivas_orient_trk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 10e489c7b7..6bfda7d600 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -54,7 +54,7 @@ #define OTR_UPDATE_RATE ( 50.0f ) /* rate of the Process() calls [Hz]; 1x per IVAS frame */ #ifndef EXT_RENDERER -typedef Quaternion IVAS_QUATERNION; +typedef Quaternion IVAS_QUATERNION; #endif /*------------------------------------------------------------------------------------------* -- GitLab From 69043992fc23142fbb9df630c375cd1a6702d2cd Mon Sep 17 00:00:00 2001 From: szczerba Date: Fri, 11 Nov 2022 13:41:32 +0100 Subject: [PATCH 018/375] [cleanup] formatting --- lib_dec/ivas_dirac_dec_binaural_functions.c | 2 +- lib_rend/ivas_rotation.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib_dec/ivas_dirac_dec_binaural_functions.c b/lib_dec/ivas_dirac_dec_binaural_functions.c index 3053905462..f45e728a18 100644 --- a/lib_dec/ivas_dirac_dec_binaural_functions.c +++ b/lib_dec/ivas_dirac_dec_binaural_functions.c @@ -296,7 +296,7 @@ void ivas_dirac_dec_binaural( { decorr_signal[ch] = (float *) &( output_f[ch + BINAURAL_CHANNELS][0] ); } - output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); + output_frame = ( int16_t )( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, output_f, decorr_signal, output_frame ); } diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 2f7b302e99..8dc547bf6b 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -94,7 +94,6 @@ ivas_error ivas_headTrack_open( } ivas_orient_trk_Init( ( *hHeadTrackData )->OrientationTracker ); #endif - /* Initialise Rmat_prev to I, Rmat will be computed later */ for ( i = 0; i < 3; i++ ) { @@ -399,6 +398,7 @@ void rotateFrame_shd( set_zero( SHrotmat[i], HEADROT_SHMAT_DIM ); } + /* get next quaternion */ #ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], @@ -406,7 +406,6 @@ void rotateFrame_shd( &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); #else - /* get next quaternion */ QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); #endif @@ -524,7 +523,6 @@ void rotateFrame_sd( Quaternion trackedHeadOrientation; #endif #endif - wmops_sub_start( "rotateFrame_sd" ); nchan = hTransSetup.nchan_out_woLFE + hTransSetup.num_lfe; @@ -546,6 +544,7 @@ void rotateFrame_sd( } #endif + /* Get next quaternion and calculate rotation matrix */ #ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], @@ -553,7 +552,6 @@ void rotateFrame_sd( &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); #else - /* Get next quaternion and calculate rotation matrix */ QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); #endif @@ -805,6 +803,7 @@ void rotateFrame_sd_cldfb( } } + /* Get next quaternion and calculate rotation matrix */ #ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], @@ -812,7 +811,6 @@ void rotateFrame_sd_cldfb( &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, Rmat ); #else - /* Get next quaternion and calculate rotation matrix */ QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], Rmat ); #endif -- GitLab From 4886ef1e52e2a7baf12a2d9e316afa71d7690bfe Mon Sep 17 00:00:00 2001 From: szczerba Date: Fri, 11 Nov 2022 14:23:34 +0100 Subject: [PATCH 019/375] [cleanup] formatting --- lib_dec/ivas_dirac_dec_binaural_functions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_dirac_dec_binaural_functions.c b/lib_dec/ivas_dirac_dec_binaural_functions.c index f45e728a18..3053905462 100644 --- a/lib_dec/ivas_dirac_dec_binaural_functions.c +++ b/lib_dec/ivas_dirac_dec_binaural_functions.c @@ -296,7 +296,7 @@ void ivas_dirac_dec_binaural( { decorr_signal[ch] = (float *) &( output_f[ch + BINAURAL_CHANNELS][0] ); } - output_frame = ( int16_t )( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); + output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, output_f, decorr_signal, output_frame ); } -- GitLab From fed198d460599cd0d2ce89ecaa21f82f44363e98 Mon Sep 17 00:00:00 2001 From: szczerba Date: Fri, 11 Nov 2022 14:26:44 +0100 Subject: [PATCH 020/375] FIX_I1090_ORIENTATION_TRACKING undefined to check for CI failures --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index c5571e6969..a5635d9e9d 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -143,7 +143,7 @@ #define DISABLE_ADAP_RES_COD_TMP /* temporary fix for IVAS-403, disables adaptive residual coding */ /*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define FIX_I109_ORIENTATION_TRACKING /* Issue 109: Harmonize head and orientation tracking */ +/*#define FIX_I109_ORIENTATION_TRACKING*/ /* Issue 109: Harmonize head and orientation tracking */ #define FIX_I1_113 /* under review : MCT bit distribution optimization for SBA high bitrates*/ #define PRINT_SBA_ORDER /* Issue 179: print-out also the SBA order of IVAS SBA format to stdout */ #define EXT_RENDERER /* FhG: external renderer library and standalone application */ -- GitLab From 6d9116414cd2095ac59c668ce88d6aee130dd15a Mon Sep 17 00:00:00 2001 From: szczerba Date: Fri, 11 Nov 2022 14:54:26 +0100 Subject: [PATCH 021/375] Fix for renderer standalone and orientation tracking --- lib_com/options.h | 3 +-- .../renderer_standalone.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 73d923f8f9..c5571e6969 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -143,7 +143,7 @@ #define DISABLE_ADAP_RES_COD_TMP /* temporary fix for IVAS-403, disables adaptive residual coding */ /*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -/*#define FIX_I109_ORIENTATION_TRACKING*/ /* Issue 109: Harmonize head and orientation tracking */ +#define FIX_I109_ORIENTATION_TRACKING /* Issue 109: Harmonize head and orientation tracking */ #define FIX_I1_113 /* under review : MCT bit distribution optimization for SBA high bitrates*/ #define PRINT_SBA_ORDER /* Issue 179: print-out also the SBA order of IVAS SBA format to stdout */ #define EXT_RENDERER /* FhG: external renderer library and standalone application */ @@ -154,7 +154,6 @@ #define SBA_BR_SWITCHING /* Issue 114: Changes for sba bit rate switching*/ #define FIX_AGC_WINFUNC_MEMORY /* Issue 62: lower agc_com.winFunc memory consumption */ #define REMOVE_SID_HARM_LEFTOVERS /* Issue 192: remove leftovers from the SID bitrate harmonization */ -#define FIX_MCT_UNINIT_MEM /* Issue 166: Reading of uninitialized memory in TCX range coder */ diff --git a/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c b/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c index b2963093a2..ba1fb06847 100644 --- a/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c +++ b/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c @@ -317,6 +317,14 @@ int main( int argc, char *argv[] ) exit( -1 ); } st_ivas->hDecoderConfig->Opt_Headrotation = TRUE; + +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( ( st_ivas->hHeadTrackData->OrientationTracker = (ivas_orient_trk_state_t *) count_malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) + { + fprintf( stderr, "Cannot allocate memory for orientation tracker\n" ); + exit( -1 ); + } +#endif } #ifdef EXT_RENDERER else @@ -489,6 +497,12 @@ int main( int argc, char *argv[] ) if ( st_ivas->hHeadTrackData != NULL ) { +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( st_ivas->hHeadTrackData->OrientationTracker ) + { + count_free( st_ivas->hHeadTrackData->OrientationTracker ); + } +#endif count_free( st_ivas->hHeadTrackData ); fclose( f_quat_traj ); } -- GitLab From 752e464d4eec135ae0dff7bde16e4e9b1fbab32f Mon Sep 17 00:00:00 2001 From: szczerba Date: Fri, 11 Nov 2022 15:51:02 +0100 Subject: [PATCH 022/375] Fix for missing orientation tracker initialization --- .../object_renderer_standalone/renderer_standalone.c | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c b/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c index ba1fb06847..b49168a9f3 100644 --- a/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c +++ b/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c @@ -324,6 +324,7 @@ int main( int argc, char *argv[] ) fprintf( stderr, "Cannot allocate memory for orientation tracker\n" ); exit( -1 ); } + ivas_orient_trk_Init( st_ivas->hHeadTrackData->OrientationTracker ); #endif } #ifdef EXT_RENDERER -- GitLab From 5ba30d0473df3630cb2d4b11558493ae53e689e7 Mon Sep 17 00:00:00 2001 From: szczerba Date: Fri, 11 Nov 2022 15:54:22 +0100 Subject: [PATCH 023/375] [cleanup] NULL comparison for orientation tracker destructor --- .../object_renderer_standalone/renderer_standalone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c b/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c index b49168a9f3..efcd10a3e7 100644 --- a/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c +++ b/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c @@ -499,7 +499,7 @@ int main( int argc, char *argv[] ) if ( st_ivas->hHeadTrackData != NULL ) { #ifdef FIX_I109_ORIENTATION_TRACKING - if ( st_ivas->hHeadTrackData->OrientationTracker ) + if ( st_ivas->hHeadTrackData->OrientationTracker != NULL ) { count_free( st_ivas->hHeadTrackData->OrientationTracker ); } -- GitLab From f84ea03552d78d1b2d57e4b1a21e2b0e0a3109cc Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Thu, 24 Nov 2022 23:44:29 +0100 Subject: [PATCH 024/375] fix asan test cases: properly closing headTracker handle --- .../tests/unit_tests/crend/ivas_crend_utest_utils.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c index be5e483927..e85bea9f93 100644 --- a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c +++ b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c @@ -1603,8 +1603,7 @@ ivas_result_t ivas_common_mixer_renderer( ivas_crend_io_params_t *pIo_params, fl /* Head track data handle */ if ( st_ivas.hHeadTrackData != NULL ) { - count_free( st_ivas.hHeadTrackData ); - st_ivas.hHeadTrackData = NULL; + ivas_headTrack_close( &st_ivas.hHeadTrackData ); } if ( headRotReader ) -- GitLab From 65fef519341878efeeea86c7dba69f0b711ebc1e Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 30 Nov 2022 09:29:18 +0100 Subject: [PATCH 025/375] fix compile without FIX_I109_ORIENTATION_TRACKING --- .../tests/unit_tests/crend/ivas_crend_utest_utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c index e85bea9f93..9e40c52376 100644 --- a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c +++ b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c @@ -1600,11 +1600,13 @@ ivas_result_t ivas_common_mixer_renderer( ivas_crend_io_params_t *pIo_params, fl ivas_render_config_close( &st_ivas.hRenderConfig ); } +#ifdef FIX_I109_ORIENTATION_TRACKING /* Head track data handle */ if ( st_ivas.hHeadTrackData != NULL ) { ivas_headTrack_close( &st_ivas.hHeadTrackData ); } +#endif if ( headRotReader ) { -- GitLab From 4dc151bc988b2499f3260e3b55f94bf07492d6dc Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 30 Nov 2022 20:43:43 +0100 Subject: [PATCH 026/375] disable flag for CI test --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 7e0493c1bf..333a4291d2 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -144,7 +144,7 @@ #define DISABLE_ADAP_RES_COD_TMP /* temporary fix for IVAS-403, disables adaptive residual coding */ /*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define FIX_I109_ORIENTATION_TRACKING /* Issue 109: Harmonize head and orientation tracking */ +//#define FIX_I109_ORIENTATION_TRACKING /* Issue 109: Harmonize head and orientation tracking */ #define FIX_I1_113 /* under review : MCT bit distribution optimization for SBA high bitrates*/ #define PRINT_SBA_ORDER /* Issue 179: print-out also the SBA order of IVAS SBA format to stdout */ #define EXT_RENDERER /* FhG: external renderer library and standalone application */ -- GitLab From 9cad25ce4295a14d2fb14d867bd4e94b5c48c18d Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 30 Nov 2022 20:54:56 +0100 Subject: [PATCH 027/375] pacify asan --- .../tests/unit_tests/crend/ivas_crend_utest_utils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c index 9e40c52376..a55fd2b1dc 100644 --- a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c +++ b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c @@ -1600,11 +1600,14 @@ ivas_result_t ivas_common_mixer_renderer( ivas_crend_io_params_t *pIo_params, fl ivas_render_config_close( &st_ivas.hRenderConfig ); } -#ifdef FIX_I109_ORIENTATION_TRACKING /* Head track data handle */ if ( st_ivas.hHeadTrackData != NULL ) { +#ifdef FIX_I109_ORIENTATION_TRACKING ivas_headTrack_close( &st_ivas.hHeadTrackData ); +#else + count_free( st_ivas.hHeadTrackData ); + st_ivas.hHeadTrackData = NULL; } #endif -- GitLab From 162a9712a05f91f4fc1e72b83e0431ab5fe78e09 Mon Sep 17 00:00:00 2001 From: szczerba Date: Fri, 2 Dec 2022 13:28:36 +0100 Subject: [PATCH 028/375] FIX_I109_ORIENTATION_TRACKING defined --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index e111492f34..5c65cac906 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -144,7 +144,7 @@ #define DISABLE_ADAP_RES_COD_TMP /* temporary fix for IVAS-403, disables adaptive residual coding */ /*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -//#define FIX_I109_ORIENTATION_TRACKING /* Issue 109: Harmonize head and orientation tracking */ +#define FIX_I109_ORIENTATION_TRACKING /* Issue 109: Harmonize head and orientation tracking */ #define FIX_I1_113 /* under review : MCT bit distribution optimization for SBA high bitrates*/ #define PRINT_SBA_ORDER /* Issue 179: print-out also the SBA order of IVAS SBA format to stdout */ #define EXT_RENDERER /* FhG: external renderer library and standalone application */ -- GitLab From ac74c86e7724301f163714eeaa2d0c8c562cc004 Mon Sep 17 00:00:00 2001 From: szczerba Date: Tue, 6 Dec 2022 13:24:15 +0100 Subject: [PATCH 029/375] Update towards support all orientation tracking modes, external renderer. --- apps/decoder.c | 19 ++++- apps/renderer.c | 23 +++++- lib_com/ivas_cnst.h | 10 +++ lib_com/ivas_prot.h | 7 ++ lib_dec/ivas_init_dec.c | 8 +- lib_rend/ivas_lib_rend_internal.h | 3 + lib_rend/ivas_orient_trk.c | 128 +++++++++++++++++------------- lib_rend/lib_rend.c | 128 +++++++++++++++++++++++++++++- lib_rend/lib_rend.h | 12 +++ 9 files changed, 275 insertions(+), 63 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 7f94e19808..cbe9949ef9 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -83,9 +83,14 @@ static #define MAX_NUM_OUTPUT_CHANNELS 16 #define MAX_OUTPUT_PCM_BUFFER_SIZE ( MAX_NUM_OUTPUT_CHANNELS * MAX_FRAME_SIZE ) +#ifdef FIX_I109_ORIENTATION_TRACKING +#define IVAS_PUBLIC_ORIENT_TRK_NONE ( 0 ) +#define IVAS_PUBLIC_ORIENT_TRK_REF ( 1 ) +#define IVAS_PUBLIC_ORIENT_TRK_AVG ( 2 ) +#else #define IVAS_PUBLIC_ORIENT_TRK_REF 0 #define IVAS_PUBLIC_ORIENT_TRK_AVG 1 - +#endif typedef struct { @@ -709,7 +714,11 @@ static bool parseCmdlIVAS_dec( arg->enableHeadRotation = false; arg->headrotTrajFileName = NULL; +#ifdef FIX_I109_ORIENTATION_TRACKING + arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; +#else arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; +#endif #ifdef SUPPORT_JBM_TRACEFILE arg->jbmTraceFilename = NULL; @@ -892,7 +901,15 @@ static bool parseCmdlIVAS_dec( } char tmp[4]; strcpy( tmp, argv[i + 1] ); +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( strcmp( to_upper( tmp ), "NONE" ) == 0 ) + { + arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; + } + else if ( strcmp( to_upper( tmp ), "REF" ) == 0 ) +#else if ( strcmp( to_upper( tmp ), "REF" ) == 0 ) +#endif { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; } diff --git a/apps/renderer.c b/apps/renderer.c index 9fb5337ed8..faf8d3e557 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -671,7 +671,7 @@ int main( { args.sampleRate = inFileSampleRate; } - const int16_t frameSize_smpls = (int16_t) ( 20 * args.sampleRate / 1000 ); + const int16_t frameSize_smpls = ( int16_t )( 20 * args.sampleRate / 1000 ); IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS] = { 0 }; IVAS_REND_InputId ismIds[RENDERER_MAX_ISM_INPUTS] = { 0 }; @@ -722,6 +722,13 @@ int main( } } +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientationTracking ) ) + { + return error; + } +#endif + /* Set up output custom layout configuration */ if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { @@ -1314,7 +1321,15 @@ static int8_t parseOrientationTracking( to_upper( value ); +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( strcmp( value, "NONE" ) == 0) + { + *tracking_type = IVAS_ORIENT_TRK_NONE; + } + else if ( strcmp( value, "REF" ) == 0 ) +#else if ( strcmp( value, "REF" ) == 0 ) +#endif { *tracking_type = IVAS_ORIENT_TRK_REF; } @@ -1499,7 +1514,11 @@ static CmdlnArgs defaultArgs( clearString( args.customHrtfFilePath ); clearString( args.renderConfigFilePath ); +#ifdef FIX_I109_ORIENTATION_TRACKING + args.orientationTracking = IVAS_ORIENT_TRK_NONE; +#else args.orientationTracking = IVAS_ORIENT_TRK_REF; +#endif args.noDiegeticPan = 0.0f; args.delayCompensationEnabled = true; @@ -1556,7 +1575,7 @@ static void parseOption( break; case CmdLnOptionId_sampleRate: assert( numOptionValues == 1 ); - args->sampleRate = (int32_t) ( strtol( optionValues[0], NULL, 10 ) * 1000 ); + args->sampleRate = ( int32_t )( strtol( optionValues[0], NULL, 10 ) * 1000 ); if ( args->sampleRate == 0 ) { fprintf( stderr, "Invalid sampling rate specified\n" ); diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 60ea963dcb..2b71916cc2 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1461,12 +1461,22 @@ typedef enum *----------------------------------------------------------------------------------*/ /* Orientation tracking types */ +#ifdef FIX_I109_ORIENTATION_TRACKING +#define IVAS_ORIENT_TRK_NONE 0 +#define IVAS_ORIENT_TRK_REF 1 +#define IVAS_ORIENT_TRK_AVG 2 +#else #define IVAS_ORIENT_TRK_REF 0 #define IVAS_ORIENT_TRK_AVG 1 +#endif typedef enum { +#ifdef FIX_I109_ORIENTATION_TRACKING + OTR_TRACKING_NONE = IVAS_ORIENT_TRK_NONE, +#else OTR_TRACKING_NONE = IVAS_ORIENT_TRK_REF-1, +#endif OTR_TRACKING_REF_ORIENT = IVAS_ORIENT_TRK_REF, /* track orientation relative to external reference orientation (default: no rotation) */ OTR_TRACKING_AVG_ORIENT = IVAS_ORIENT_TRK_AVG /* track orientation relative to average orientation */ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index be238ff610..51b764c2df 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5595,6 +5595,13 @@ ivas_error ivas_orient_trk_SetTrackingType( OTR_TRACKING_T trackingType /* i : orientation tracking type */ ); +#ifdef FIX_I109_ORIENTATION_TRACKING +ivas_error ivas_orient_trk_SetReferenceRotation( + ivas_orient_trk_state_t *pOTR, /* i/o : orientatoin trakcer handle */ + IVAS_QUATERNION refRot /* i : reference rotation */ +); +#endif + #ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_Process( ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 8fd000ab1b..e0febef269 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -688,11 +688,15 @@ ivas_error ivas_init_decoder( #ifdef FIX_I109_ORIENTATION_TRACKING if ( st_ivas->hDecoderConfig->Opt_Headrotation ) { - if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_AVG ) + if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_NONE ) + { + ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_NONE ); + } + else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_AVG ) { ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_AVG_ORIENT ); } - else + else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_REF ) { ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_ORIENT ); } diff --git a/lib_rend/ivas_lib_rend_internal.h b/lib_rend/ivas_lib_rend_internal.h index 6a362c8c1c..aba4b1df91 100644 --- a/lib_rend/ivas_lib_rend_internal.h +++ b/lib_rend/ivas_lib_rend_internal.h @@ -43,6 +43,9 @@ typedef struct int8_t headRotEnabled; IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; +#ifdef FIX_I109_ORIENTATION_TRACKING + ivas_orient_trk_state_t *hOrientationTracker; +#endif } IVAS_REND_HeadRotData; typedef struct diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 6bfda7d600..6057f1ffe0 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -274,9 +274,16 @@ static float ClipAngle( void ivas_orient_trk_Init( ivas_orient_trk_state_t *pOTR ) /* i/o : orientation tracker handle */ { +#ifdef FIX_I109_ORIENTATION_TRACKING + IVAS_QUATERNION identity; + identity.w = 1.0f; + identity.x = 0.0f; + identity.y = 0.0f; + identity.z = 0.0f; +#else /* Track relative to a reference orientation */ pOTR->trackingType = OTR_TRACKING_REF_ORIENT; - +#endif /* configuration parameters */ pOTR->centerAdaptationRate = 1.0f / 30.0f; pOTR->offCenterAdaptationRate = 1.0f / 8.0f; @@ -286,15 +293,9 @@ void ivas_orient_trk_Init( pOTR->alpha = sinf( PI2 * pOTR->offCenterAdaptationRate / OTR_UPDATE_RATE ); /* start adaptation at off-center rate = fastest rate */ #ifdef FIX_I109_ORIENTATION_TRACKING - pOTR->absAvgRot.w = 1.0f; - pOTR->absAvgRot.x = 0.0f; - pOTR->absAvgRot.y = 0.0f; - pOTR->absAvgRot.z = 0.0f; + pOTR->absAvgRot = identity; /* Use frontal and horiontal orientation as reference orientation, unless/until overridden */ - pOTR->refRot.w = 1.0f; - pOTR->refRot.x = 0.0f; - pOTR->refRot.y = 0.0f; - pOTR->refRot.z = 0.0f; + pOTR->refRot = identity; #else pOTR->absYaw = 0.0f; pOTR->absPitch = 0.0f; @@ -331,7 +332,15 @@ ivas_error ivas_orient_trk_SetTrackingType( return IVAS_ERR_OK; } -#ifndef FIX_I109_ORIENTATION_TRACKING +#ifdef FIX_I109_ORIENTATION_TRACKING +ivas_error ivas_orient_trk_SetReferenceRotation( + ivas_orient_trk_state_t *pOTR, /* i/o : orientation trakcer handle */ + IVAS_QUATERNION refRot ) /* i : reference rotation */ +{ + pOTR->refRot = refRot; + return IVAS_ERR_OK; +} +#else /*-------------------------------------------------------------------* * ivas_orient_trk_SetAbsoluteOrientation() * @@ -372,49 +381,15 @@ ivas_error ivas_orient_trk_Process( float cutoffFrequency; float alpha = pOTR->alpha; float ang; + ivas_error result; - if ( pOTR->trackingType == OTR_TRACKING_AVG_ORIENT ) + switch ( pOTR->trackingType ) { - /* Compute average (low-pass filtered) absolute orientation */ - QuaternionSlerp( pOTR->absAvgRot, absRot, alpha, &pOTR->absAvgRot ); - - /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */ - QuaternionInverse( pOTR->absAvgRot, pTrkRot ); - QuaternionProduct( *pTrkRot, absRot, pTrkRot ); - - /* Adapt LPF constant based on orientation excursion relative to current mean: - - low cutoff (slow adaptation) for small excursions (around center) - - high cutoff (fast adaptation) for large excursions (off-center) - */ - ang = QuaternionAngle( absRot, *pTrkRot ); - normalizedOrientation = ang * ang; - - relativeOrientationRate = sqrtf( normalizedOrientation ) / pOTR->adaptationAngle; - /* 'if' assumed to perform comparison to 0 */ - if ( relativeOrientationRate > 1.0f ) - { - relativeOrientationRate = 1.0f; - } + case OTR_TRACKING_NONE: + *pTrkRot = absRot; + break; - /* Compute range of the adaptation rate between center = lower rate and off-center = higher rate */ - rateRange = pOTR->offCenterAdaptationRate - pOTR->centerAdaptationRate; - /* 'if' assumed to perform comparison to 0 */ - if ( rateRange < 0.0f ) - { - rateRange = 0.0f; - } - - /* Compute adaptivity cutoff frequency: interpolate between minimum (center) and maximum (off-center) values */ - cutoffFrequency = pOTR->centerAdaptationRate + ( relativeOrientationRate * rateRange ); - - /* Compute filter coefficient corresponding to desired cutoff frequency */ - pOTR->alpha = sinf( 2.0f * EVS_PI * cutoffFrequency / updateRate ); - } - else - { - /* 'if' assumed to perform comparison to 0 */ - if ( pOTR->trackingType == OTR_TRACKING_REF_ORIENT ) - { + case OTR_TRACKING_REF_ORIENT: /* Reset average orientation */ pOTR->absAvgRot = absRot; @@ -424,14 +399,55 @@ ivas_error ivas_orient_trk_Process( /* Compute relative orientation = (absolute orientation) - (reference orientation) */ QuaternionInverse( pOTR->refRot, pTrkRot ); QuaternionProduct( *pTrkRot, absRot, pTrkRot ); - } - else - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Non-supported orientation tracking adaptation type" ); - } + + result = IVAS_ERR_OK; + break; + + case OTR_TRACKING_AVG_ORIENT: + /* Compute average (low-pass filtered) absolute orientation */ + QuaternionSlerp( pOTR->absAvgRot, absRot, alpha, &pOTR->absAvgRot ); + + /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */ + QuaternionInverse( pOTR->absAvgRot, pTrkRot ); + QuaternionProduct( *pTrkRot, absRot, pTrkRot ); + + /* Adapt LPF constant based on orientation excursion relative to current mean: + - low cutoff (slow adaptation) for small excursions (around center) + - high cutoff (fast adaptation) for large excursions (off-center) + */ + ang = QuaternionAngle( absRot, *pTrkRot ); + normalizedOrientation = ang * ang; + + relativeOrientationRate = sqrtf( normalizedOrientation ) / pOTR->adaptationAngle; + /* 'if' assumed to perform comparison to 0 */ + if ( relativeOrientationRate > 1.0f ) + { + relativeOrientationRate = 1.0f; + } + + /* Compute range of the adaptation rate between center = lower rate and off-center = higher rate */ + rateRange = pOTR->offCenterAdaptationRate - pOTR->centerAdaptationRate; + /* 'if' assumed to perform comparison to 0 */ + if ( rateRange < 0.0f ) + { + rateRange = 0.0f; + } + + /* Compute adaptivity cutoff frequency: interpolate between minimum (center) and maximum (off-center) values */ + cutoffFrequency = pOTR->centerAdaptationRate + ( relativeOrientationRate * rateRange ); + + /* Compute filter coefficient corresponding to desired cutoff frequency */ + pOTR->alpha = sinf( 2.0f * EVS_PI * cutoffFrequency / updateRate ); + + result = IVAS_ERR_OK; + break; + + default: + result = IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Non-supported orientation tracking adaptation type" ); + break; } - return IVAS_ERR_OK; + return result; } #else ivas_error ivas_orient_trk_Process( diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index d766334988..8088ae9e60 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -819,7 +819,11 @@ static ivas_error getEfapGains( return IVAS_ERR_OK; } +#ifdef FIX_I109_ORIENTATION_TRACKING +static ivas_error initHeadRotation( +#else static void initHeadRotation( +#endif IVAS_REND_HANDLE hIvasRend ) { int16_t i, crossfade_len; @@ -842,9 +846,30 @@ static void initHeadRotation( hIvasRend->headRotData.headPositions[i] = quaternionInit(); } +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( ( hIvasRend->headRotData.hOrientationTracker = (ivas_orient_trk_state_t *) count_malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); + } + ivas_orient_trk_Init( hIvasRend->headRotData.hOrientationTracker ); + + return IVAS_ERR_OK; +#else return; +#endif } +#ifdef FIX_I109_ORIENTATION_TRACKING +static void closeHeadRotation( + IVAS_REND_HANDLE hIvasRend ) +{ + if ( ( hIvasRend != NULL ) && ( hIvasRend->headRotData.hOrientationTracker != NULL )) + { + count_free( hIvasRend->headRotData.hOrientationTracker ); + } +} +#endif + static void initRotMatrix( rotation_matrix rot_mat ) { @@ -2157,6 +2182,10 @@ static DecoderDummy *initDecoderDummy( int32_t sampleRate, int16_t numTransChann decDummy->hHeadTrackData->lrSwitchInterpVal = 0.0f; decDummy->hHeadTrackData->lrSwitchedCurrent = 0; decDummy->hHeadTrackData->lrSwitchedNext = 0; +#ifdef FIX_I109_ORIENTATION_TRACKING + decDummy->hHeadTrackData->OrientationTracker = (ivas_orient_trk_state_t *) count_malloc( sizeof( ivas_orient_trk_state_t ) ); + ivas_orient_trk_Init( decDummy->hHeadTrackData->OrientationTracker ); +#endif } else { @@ -2230,6 +2259,12 @@ static void freeDecoderDummy( DecoderDummy **ppDecDummy ) } if ( pDecDummy->hHeadTrackData != NULL ) { +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( pDecDummy->hHeadTrackData->OrientationTracker != NULL ) + { + count_free( pDecDummy->hHeadTrackData->OrientationTracker ); + } +#endif count_free( pDecDummy->hHeadTrackData ); } ivas_render_config_close( &pDecDummy->hRenderConfig ); @@ -2345,7 +2380,14 @@ ivas_error IVAS_REND_Open( initLimiter( &hIvasRend->hLimiter, numOutChannels, outputSampleRate ); /* Initialize headrotation data */ +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( ( error = initHeadRotation( hIvasRend ) ) != IVAS_ERR_OK ) + { + return error; + } +#else initHeadRotation( hIvasRend ); +#endif /* Initialize EFAP */ initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ); @@ -2556,7 +2598,7 @@ static IVAS_REND_InputId makeInputId( /* Put config type in second byte (from LSB), put index + 1 in first byte * * Index is incremented here so that a valid ID can never be 0. */ - return (IVAS_REND_InputId) ( ( getAudioConfigType( config ) << 8 ) | ( inputIndex + 1 ) ); + return ( IVAS_REND_InputId )( ( getAudioConfigType( config ) << 8 ) | ( inputIndex + 1 ) ); } static ivas_error getInputById( @@ -3076,7 +3118,7 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsMasa[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { - latency_ns = NS2SA( hIvasRend->sampleRateOut, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); + latency_ns = NS2SA( hIvasRend->sampleRateOut, ( int32_t )( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); } } @@ -3352,6 +3394,51 @@ ivas_error IVAS_REND_SetHeadRotation( return IVAS_ERR_OK; } +#ifdef FIX_I109_ORIENTATION_TRACKING +ivas_error IVAS_REND_SetOrientationTrackingMode( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const uint8_t otrMode /* i : Orientation tracking mode */ +) +{ + if ( hIvasRend == NULL || hIvasRend->headRotData.hOrientationTracker == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + if ( otrMode == IVAS_ORIENT_TRK_REF ) + { + hIvasRend->headRotData.hOrientationTracker->trackingType = OTR_TRACKING_REF_ORIENT; + } + else if (otrMode == IVAS_ORIENT_TRK_AVG) + { + hIvasRend->headRotData.hOrientationTracker->trackingType = OTR_TRACKING_AVG_ORIENT; + } + else + { + hIvasRend->headRotData.hOrientationTracker->trackingType = OTR_TRACKING_NONE; + } + + return IVAS_ERR_OK; +} + +ivas_error IVAS_REND_SetReferenceRotation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_QUATERNION refRot /* i : Reference rotation */ +) +{ + /*-----------------------------------------------------------------* + * Validate function arguments + *-----------------------------------------------------------------*/ + + if ( hIvasRend == NULL || hIvasRend->headRotData.hOrientationTracker == NULL) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + hIvasRend->headRotData.hOrientationTracker->refRot = refRot; + + return IVAS_ERR_OK; +} +#endif + /* Take one channel from input buffer and copy it to each channel in output buffer, with different gain applied per output channel. This function takes 2 gain vectors - one for the beginning and one @@ -3458,6 +3545,9 @@ static ivas_error rotateFrameMc( rotation_matrix Rmat; rotation_gains gains; float tmp_gains[MAX_INPUT_CHANNELS]; +#ifdef FIX_I109_ORIENTATION_TRACKING + IVAS_QUATERNION trackedHeadOrientation; +#endif wmops_sub_start( "rotateFrameMc" ); @@ -3484,7 +3574,15 @@ static ivas_error rotateFrameMc( for ( subframe_idx = 0; subframe_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; subframe_idx++ ) { /* Get next quaternion and calculate rotation matrix */ +#ifdef FIX_I109_ORIENTATION_TRACKING + ivas_orient_trk_Process( headRotData->hOrientationTracker, + headRotData->headPositions[subframe_idx], + (float) ( FRAMES_PER_SEC * RENDERER_HEAD_POSITIONS_PER_FRAME ), + &trackedHeadOrientation ); + QuatToRotMat( trackedHeadOrientation, Rmat ); +#else QuatToRotMat( headRotData->headPositions[subframe_idx], Rmat ); +#endif for ( ch_in = 0; ch_in < nchan; ch_in++ ) { @@ -3566,6 +3664,9 @@ static ivas_error rotateFrameSba( rotation_matrix Rmat; float tmpRot[2 * HEADROT_ORDER + 1]; rotation_gains gains; +#ifdef FIX_I109_ORIENTATION_TRACKING + IVAS_QUATERNION trackedHeadOrientation; +#endif wmops_sub_start( "rotateFrameSba" ); @@ -3582,7 +3683,15 @@ static ivas_error rotateFrameSba( } /* Get next quaternion and calculate rotation matrix */ +#ifdef FIX_I109_ORIENTATION_TRACKING + ivas_orient_trk_Process( headRotData->hOrientationTracker, + headRotData->headPositions[subframe_idx], + (float) ( FRAMES_PER_SEC * RENDERER_HEAD_POSITIONS_PER_FRAME ), + &trackedHeadOrientation ); + QuatToRotMat( trackedHeadOrientation, Rmat ); +#else QuatToRotMat( headRotData->headPositions[subframe_idx], Rmat ); +#endif /* calculate ambisonics rotation matrices for the previous and current frames */ SHrotmatgen( gains, Rmat, shd_rot_max_order ); @@ -3698,6 +3807,9 @@ static ivas_error renderIsmToBinauralRoom( IVAS_REND_AudioBuffer tmpMcBuffer; IVAS_REND_AudioObjectPosition rotatedPos; const IVAS_REND_HeadRotData *headRotData; +#ifdef FIX_I109_ORIENTATION_TRACKING + IVAS_QUATERNION trackedHeadOrientation; +#endif wmops_sub_start( "renderIsmToBinauralRoom" ); @@ -3710,12 +3822,20 @@ static ivas_error renderIsmToBinauralRoom( // for ( subframe_idx = 0; subframe_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; subframe_idx++ ) for ( subframe_idx = 0; subframe_idx < 1; subframe_idx++ ) { +#ifdef FIX_I109_ORIENTATION_TRACKING + ivas_orient_trk_Process( headRotData->hOrientationTracker, + headRotData->headPositions[subframe_idx], + (float) ( FRAMES_PER_SEC ), + &trackedHeadOrientation ); + QuatToRotMat( trackedHeadOrientation, Rmat ); +#else quat.w = headRotData->headPositions[subframe_idx].w; quat.x = headRotData->headPositions[subframe_idx].x; quat.y = headRotData->headPositions[subframe_idx].y; quat.z = headRotData->headPositions[subframe_idx].z; QuatToRotMat( quat, Rmat ); +#endif } (void) subframe_len; // avoid warning } @@ -4834,6 +4954,10 @@ void IVAS_REND_Close( ivas_limiter_close( &hIvasRend->hLimiter ); +#ifdef FIX_I109_ORIENTATION_TRACKING + closeHeadRotation( &( hIvasRend->headRotData ) ); +#endif + count_free( hIvasRend ); *phIvasRend = NULL; diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 158a734f46..1dae43a513 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -264,6 +264,18 @@ ivas_error IVAS_REND_SetHeadRotation( const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : head positions for next rendering call */ ); +#ifdef FIX_I109_ORIENTATION_TRACKING +ivas_error IVAS_REND_SetOrientationTrackingMode( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const uint8_t otrMode /* i : Orientation tracking mode */ +); + +ivas_error IVAS_REND_SetReferenceRotation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_QUATERNION refRot /* i : Reference rotation */ +); +#endif + ivas_error IVAS_REND_GetSamples( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */ -- GitLab From 4e4e7194c49ce0a5a5a2e8b7b1fe2a07611c0540 Mon Sep 17 00:00:00 2001 From: szczerba Date: Tue, 6 Dec 2022 13:44:54 +0100 Subject: [PATCH 030/375] TDREND update for orientation tracking. Fixes for ivas_orient_trk_Process error handling. --- lib_rend/ivas_objectRenderer.c | 15 +++++++++++++++ lib_rend/ivas_orient_trk.c | 6 ++---- lib_rend/lib_rend.c | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 061575279a..56ccc065db 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -739,6 +739,10 @@ ivas_error ivas_rend_TDObjRenderFrame( IVAS_FORMAT ivas_format; IVAS_REND_AudioConfigType inConfigType; +#ifdef FIX_I109_ORIENTATION_TRACKING + IVAS_QUATERNION trackedHeadOrientation; +#endif + wmops_sub_start( "ivas_rend_TDObjRenderFrame" ); inConfigType = getAudioConfigType( inConfig ); @@ -788,7 +792,18 @@ ivas_error ivas_rend_TDObjRenderFrame( for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { /* Update the listener's location/orientation */ +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( headRotData->headRotEnabled ) + { + ivas_orient_trk_Process( headRotData->hOrientationTracker, + headRotData->headPositions[subframe_idx], + FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, + &trackedHeadOrientation ); + } + TDREND_Update_listener_orientation( pTDRend->hBinRendererTd, headRotData->headRotEnabled, ( headRotData != NULL ) ? &trackedHeadOrientation : NULL ); +#else TDREND_Update_listener_orientation( pTDRend->hBinRendererTd, headRotData->headRotEnabled, ( headRotData != NULL ) ? &headRotData->headPositions[subframe_idx] : NULL ); +#endif /* TODO tmu : pass down renderer config struct */ // if ( ( hRenderConfig != NULL ) && ( hRenderConfig->roomAcoustics.late_reverb_on ) ) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 6057f1ffe0..a949bf43c5 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -383,6 +383,8 @@ ivas_error ivas_orient_trk_Process( float ang; ivas_error result; + result = IVAS_ERR_OK; + switch ( pOTR->trackingType ) { case OTR_TRACKING_NONE: @@ -399,8 +401,6 @@ ivas_error ivas_orient_trk_Process( /* Compute relative orientation = (absolute orientation) - (reference orientation) */ QuaternionInverse( pOTR->refRot, pTrkRot ); QuaternionProduct( *pTrkRot, absRot, pTrkRot ); - - result = IVAS_ERR_OK; break; case OTR_TRACKING_AVG_ORIENT: @@ -438,8 +438,6 @@ ivas_error ivas_orient_trk_Process( /* Compute filter coefficient corresponding to desired cutoff frequency */ pOTR->alpha = sinf( 2.0f * EVS_PI * cutoffFrequency / updateRate ); - - result = IVAS_ERR_OK; break; default: diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 8088ae9e60..9644b2203f 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4955,7 +4955,7 @@ void IVAS_REND_Close( ivas_limiter_close( &hIvasRend->hLimiter ); #ifdef FIX_I109_ORIENTATION_TRACKING - closeHeadRotation( &( hIvasRend->headRotData ) ); + closeHeadRotation( hIvasRend ); #endif count_free( hIvasRend ); -- GitLab From 89757f3887aaf18f7fc826bf4c7b49b0547bf0ad Mon Sep 17 00:00:00 2001 From: szczerba Date: Tue, 6 Dec 2022 15:52:54 +0100 Subject: [PATCH 031/375] Editorials --- apps/renderer.c | 4 ++-- lib_rend/ivas_orient_trk.c | 5 ++--- lib_rend/lib_rend.c | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index faf8d3e557..18b6d95cae 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -671,7 +671,7 @@ int main( { args.sampleRate = inFileSampleRate; } - const int16_t frameSize_smpls = ( int16_t )( 20 * args.sampleRate / 1000 ); + const int16_t frameSize_smpls = (int16_t) ( 20 * args.sampleRate / 1000 ); IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS] = { 0 }; IVAS_REND_InputId ismIds[RENDERER_MAX_ISM_INPUTS] = { 0 }; @@ -1575,7 +1575,7 @@ static void parseOption( break; case CmdLnOptionId_sampleRate: assert( numOptionValues == 1 ); - args->sampleRate = ( int32_t )( strtol( optionValues[0], NULL, 10 ) * 1000 ); + args->sampleRate = (int32_t) ( strtol( optionValues[0], NULL, 10 ) * 1000 ); if ( args->sampleRate == 0 ) { fprintf( stderr, "Invalid sampling rate specified\n" ); diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index a949bf43c5..eb96833fae 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -276,10 +276,9 @@ void ivas_orient_trk_Init( { #ifdef FIX_I109_ORIENTATION_TRACKING IVAS_QUATERNION identity; + identity.w = 1.0f; - identity.x = 0.0f; - identity.y = 0.0f; - identity.z = 0.0f; + identity.x = identity.y = identity.z = 0.0f; #else /* Track relative to a reference orientation */ pOTR->trackingType = OTR_TRACKING_REF_ORIENT; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 9644b2203f..da5300ed60 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2598,7 +2598,7 @@ static IVAS_REND_InputId makeInputId( /* Put config type in second byte (from LSB), put index + 1 in first byte * * Index is incremented here so that a valid ID can never be 0. */ - return ( IVAS_REND_InputId )( ( getAudioConfigType( config ) << 8 ) | ( inputIndex + 1 ) ); + return (IVAS_REND_InputId) ( ( getAudioConfigType( config ) << 8 ) | ( inputIndex + 1 ) ); } static ivas_error getInputById( @@ -3118,7 +3118,7 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsMasa[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { - latency_ns = NS2SA( hIvasRend->sampleRateOut, ( int32_t )( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); + latency_ns = NS2SA( hIvasRend->sampleRateOut, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); } } -- GitLab From a457085d9ffbe750849c68b5a26417aaac3123d1 Mon Sep 17 00:00:00 2001 From: szczerba Date: Wed, 7 Dec 2022 09:46:27 +0100 Subject: [PATCH 032/375] IVAS_REND_GetTrackedOrientation function added Editorials --- lib_rend/lib_rend.c | 35 ++++++++++++++++++++++++++++++----- lib_rend/lib_rend.h | 13 +++++++++---- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index da5300ed60..88d864aab1 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -863,7 +863,7 @@ static void initHeadRotation( static void closeHeadRotation( IVAS_REND_HANDLE hIvasRend ) { - if ( ( hIvasRend != NULL ) && ( hIvasRend->headRotData.hOrientationTracker != NULL )) + if ( ( hIvasRend != NULL ) && ( hIvasRend->headRotData.hOrientationTracker != NULL ) ) { count_free( hIvasRend->headRotData.hOrientationTracker ); } @@ -2598,7 +2598,7 @@ static IVAS_REND_InputId makeInputId( /* Put config type in second byte (from LSB), put index + 1 in first byte * * Index is incremented here so that a valid ID can never be 0. */ - return (IVAS_REND_InputId) ( ( getAudioConfigType( config ) << 8 ) | ( inputIndex + 1 ) ); + return ( IVAS_REND_InputId )( ( getAudioConfigType( config ) << 8 ) | ( inputIndex + 1 ) ); } static ivas_error getInputById( @@ -3118,7 +3118,7 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsMasa[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { - latency_ns = NS2SA( hIvasRend->sampleRateOut, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); + latency_ns = NS2SA( hIvasRend->sampleRateOut, ( int32_t )( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); } } @@ -3408,7 +3408,7 @@ ivas_error IVAS_REND_SetOrientationTrackingMode( { hIvasRend->headRotData.hOrientationTracker->trackingType = OTR_TRACKING_REF_ORIENT; } - else if (otrMode == IVAS_ORIENT_TRK_AVG) + else if ( otrMode == IVAS_ORIENT_TRK_AVG ) { hIvasRend->headRotData.hOrientationTracker->trackingType = OTR_TRACKING_AVG_ORIENT; } @@ -3429,7 +3429,7 @@ ivas_error IVAS_REND_SetReferenceRotation( * Validate function arguments *-----------------------------------------------------------------*/ - if ( hIvasRend == NULL || hIvasRend->headRotData.hOrientationTracker == NULL) + if ( hIvasRend == NULL || hIvasRend->headRotData.hOrientationTracker == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -3437,6 +3437,31 @@ ivas_error IVAS_REND_SetReferenceRotation( return IVAS_ERR_OK; } + +ivas_error IVAS_REND_GetTrackedOrientation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_QUATERNION *pOrientation /* i/o: Quaternion pointer for tracked orientation */ +) +{ + if ( hIvasRend == NULL || hIvasRend->headRotData.hOrientationTracker == NULL || pOrientation == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + switch ( hIvasRend->headRotData.hOrientationTracker->trackingType ) + { + case OTR_TRACKING_NONE: + *pOrientation = quaternionInit(); + break; + case OTR_TRACKING_REF_ORIENT: + *pOrientation = hIvasRend->headRotData.hOrientationTracker->refRot; + break; + case OTR_TRACKING_AVG_ORIENT: + *pOrientation = hIvasRend->headRotData.hOrientationTracker->absAvgRot; + break; + } + + return IVAS_ERR_OK; +} #endif /* Take one channel from input buffer and copy it to each channel diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 1dae43a513..65485df835 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -250,13 +250,13 @@ ivas_error IVAS_REND_InitConfig( ); int16_t IVAS_REND_GetRenderConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ - const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ ); int16_t IVAS_REND_FeedRenderConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ - const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ ); ivas_error IVAS_REND_SetHeadRotation( @@ -274,6 +274,11 @@ ivas_error IVAS_REND_SetReferenceRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_QUATERNION refRot /* i : Reference rotation */ ); + +ivas_error IVAS_REND_GetTrackedOrientation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_QUATERNION *pOrientation /* i/o: Quaternion pointer for tracked orientation */ +); #endif ivas_error IVAS_REND_GetSamples( -- GitLab From 04ac6728931aeaded0a46436a08db72da45314b6 Mon Sep 17 00:00:00 2001 From: szczerba Date: Thu, 8 Dec 2022 10:37:31 +0100 Subject: [PATCH 033/375] Fixed closing head track data --- .../tests/unit_tests/crend/ivas_crend_utest_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c index a55fd2b1dc..d52022350f 100644 --- a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c +++ b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c @@ -1608,8 +1608,8 @@ ivas_result_t ivas_common_mixer_renderer( ivas_crend_io_params_t *pIo_params, fl #else count_free( st_ivas.hHeadTrackData ); st_ivas.hHeadTrackData = NULL; - } #endif + } if ( headRotReader ) { -- GitLab From 66a4d9420c004b9cf307770a81569c3e361ae09e Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Thu, 8 Dec 2022 23:01:21 +0100 Subject: [PATCH 034/375] fix test cases tripping over nonexistant roomAcoustics --- lib_com/options.h | 1 + lib_rend/ivas_binaural_reverb.c | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9dc8ab44c8..4359d8c0fe 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,6 +153,7 @@ #define FIX_ITD_CNG /* Eri Contribution 11: Fix for CNG ITD */ #define FIX_VBR_COMPLEXITY /* Issue 234: fix extremely high complexity numbers for IVAS EVS mode */ #define FIX_ISM_INACTIVE_BITS /* Issue 230: fix bitbudget distribution in inactive frames in ISM format */ +#define FIX_RA_PARAMS_PARAM_BIN_REND /* Issue 103: Digest room acoustics parameters for Parametric Binaural Renderer*/ diff --git a/lib_rend/ivas_binaural_reverb.c b/lib_rend/ivas_binaural_reverb.c index db12954a1e..3ce50cce1d 100644 --- a/lib_rend/ivas_binaural_reverb.c +++ b/lib_rend/ivas_binaural_reverb.c @@ -482,6 +482,27 @@ ivas_error ivas_binaural_reverb_open( } } +#ifdef FIX_RA_PARAMS_PARAM_BIN_REND + if ( ( roomAcoustics ) && ( roomAcoustics->override ) ) + { + ivas_reverb_prepare_cldfb_params( roomAcoustics, output_config, roomAcoustics->use_brir, sampling_rate, t60, ene ); + ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, t60, ene ); + ivas_binaural_reverb_setPreDelay( hReverb, (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ) ); + } + else + { + if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, fastconvReverberationTimes, fastconvReverberationEneCorrections ); + ivas_binaural_reverb_setPreDelay( hReverb, 10 ); + } + else + { + ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, parametricReverberationTimes, parametricReverberationEneCorrections ); + ivas_binaural_reverb_setPreDelay( hReverb, 10 ); + } + } +#else if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { if ( !roomAcoustics->override ) @@ -501,7 +522,7 @@ ivas_error ivas_binaural_reverb_open( ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, parametricReverberationTimes, parametricReverberationEneCorrections ); ivas_binaural_reverb_setPreDelay( hReverb, 10 ); } - +#endif return IVAS_ERR_OK; } -- GitLab From cc890b45b5dc651a238794769b7efcadcd8e91ff Mon Sep 17 00:00:00 2001 From: szczerba Date: Tue, 20 Dec 2022 14:49:27 +0100 Subject: [PATCH 035/375] Orientation tracker interface update. Cleanup. --- lib_com/ivas_prot.h | 16 ++++++- lib_dec/ivas_stat_dec.h | 5 ++- lib_rend/ivas_orient_trk.c | 85 +++++++++++++++++++++++++++++++++++++- lib_rend/lib_rend.c | 65 +++++++++++++++++------------ lib_rend/lib_rend.h | 9 +++- 5 files changed, 147 insertions(+), 33 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 43717a6006..75e564fe7c 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5634,7 +5634,11 @@ void ivas_reverb_get_hrtf_set_properties( * Orientation tracking *----------------------------------------------------------------------------------*/ -void ivas_orient_trk_Init( +#ifdef FIX_I109_ORIENTATION_TRACKING +ivas_error ivas_orient_trk_Init( +#else +void ivas_orient_trk_Init( +#endif ivas_orient_trk_state_t *pOTR /* i/o : orientation tracker handle */ ); @@ -5648,6 +5652,16 @@ ivas_error ivas_orient_trk_SetReferenceRotation( ivas_orient_trk_state_t *pOTR, /* i/o : orientatoin trakcer handle */ IVAS_QUATERNION refRot /* i : reference rotation */ ); + +ivas_error ivas_orient_trk_GetMainOrientation( + ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ + IVAS_QUATERNION *pOrientation /* i/o : average/reference orientation */ +); + +ivas_error ivas_orient_trk_GetTrackedRotation( + ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ + IVAS_QUATERNION *pRotation /* i/o : processed rotation */ +); #endif #ifdef FIX_I109_ORIENTATION_TRACKING diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index f25a852bb3..9e4ca7fcdc 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1311,8 +1311,9 @@ typedef struct ivas_orient_trk_state_t float adaptationAngle; float alpha; - IVAS_QUATERNION absAvgRot; /* average absolute orientation */ - IVAS_QUATERNION refRot; /* reference orientation */ + IVAS_QUATERNION absAvgRot; /* average absolute orientation */ + IVAS_QUATERNION refRot; /* reference orientation */ + IVAS_QUATERNION trkRot; /* tracked rotation */ } ivas_orient_trk_state_t; #endif diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index d24de0bdab..50fe12e22d 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -63,6 +63,9 @@ * Declarations *------------------------------------------------------------------------------------------*/ +static IVAS_QUATERNION IdentityQuaternion( + void ); + void QuaternionProduct( const IVAS_QUATERNION q1, const IVAS_QUATERNION q2, @@ -99,6 +102,18 @@ void QuaternionInverse( const IVAS_QUATERNION q, IVAS_QUATERNION *const result ); +/*------------------------------------------------------------------------------------------* + * Quaternion product + *------------------------------------------------------------------------------------------*/ +static IVAS_QUATERNION IdentityQuaternion( + void ) +{ + IVAS_QUATERNION q; + q.w = 1.0f; + q.x = q.y = q.z = 0.0f; + return q; +} + /*------------------------------------------------------------------------------------------* * Quaternion product *------------------------------------------------------------------------------------------*/ @@ -267,12 +282,21 @@ static float ClipAngle( * *-------------------------------------------------------------------*/ +#ifdef FIX_I109_ORIENTATION_TRACKING +ivas_error ivas_orient_trk_Init( +#else void ivas_orient_trk_Init( +#endif ivas_orient_trk_state_t *pOTR ) /* i/o : orientation tracker handle */ { #ifdef FIX_I109_ORIENTATION_TRACKING IVAS_QUATERNION identity; + if ( pOTR == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + identity.w = 1.0f; identity.x = identity.y = identity.z = 0.0f; #else @@ -291,6 +315,8 @@ void ivas_orient_trk_Init( pOTR->absAvgRot = identity; /* Use frontal and horiontal orientation as reference orientation, unless/until overridden */ pOTR->refRot = identity; + + return IVAS_ERR_OK; #else pOTR->absYaw = 0.0f; pOTR->absPitch = 0.0f; @@ -323,18 +349,65 @@ ivas_error ivas_orient_trk_SetTrackingType( ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ OTR_TRACKING_T trackingType ) /* i/o : orientation tracking type */ { + if ( pOTR == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } pOTR->trackingType = trackingType; return IVAS_ERR_OK; } #ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_SetReferenceRotation( - ivas_orient_trk_state_t *pOTR, /* i/o : orientation trakcer handle */ + ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ IVAS_QUATERNION refRot ) /* i : reference rotation */ { + if ( pOTR == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } pOTR->refRot = refRot; return IVAS_ERR_OK; } + +ivas_error ivas_orient_trk_GetMainOrientation( + ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ + IVAS_QUATERNION *pOrientation /* i/o : average/reference orientation */ +) +{ + if ( pOTR == NULL || pOrientation == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + switch ( pOTR->trackingType ) + { + case OTR_TRACKING_NONE: + *pOrientation = IdentityQuaternion(); + break; + case OTR_TRACKING_REF_ORIENT: + *pOrientation = pOTR->refRot; + break; + case OTR_TRACKING_AVG_ORIENT: + *pOrientation = pOTR->absAvgRot; + break; + } + return IVAS_ERR_OK; +} + +ivas_error ivas_orient_trk_GetTrackedRotation( + ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ + IVAS_QUATERNION *pRotation /* i/o : processed rotation */ +) +{ + if ( pOTR == NULL || pRotation == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + *pRotation = pOTR->trkRot; + + return IVAS_ERR_OK; +} #else /*-------------------------------------------------------------------* * ivas_orient_trk_SetAbsoluteOrientation() @@ -378,6 +451,11 @@ ivas_error ivas_orient_trk_Process( float ang; ivas_error result; + if ( pOTR == NULL || pTrkRot == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + result = IVAS_ERR_OK; switch ( pOTR->trackingType ) @@ -440,6 +518,11 @@ ivas_error ivas_orient_trk_Process( break; } + if (result == IVAS_ERR_OK) + { + pOTR->trkRot = *pTrkRot; + } + return result; } #else diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 33285c7ac5..f96268a09e 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3395,23 +3395,29 @@ ivas_error IVAS_REND_SetOrientationTrackingMode( const uint8_t otrMode /* i : Orientation tracking mode */ ) { - if ( hIvasRend == NULL || hIvasRend->headRotData.hOrientationTracker == NULL ) + OTR_TRACKING_T mode; + + if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - if ( otrMode == IVAS_ORIENT_TRK_REF ) - { - hIvasRend->headRotData.hOrientationTracker->trackingType = OTR_TRACKING_REF_ORIENT; - } - else if ( otrMode == IVAS_ORIENT_TRK_AVG ) - { - hIvasRend->headRotData.hOrientationTracker->trackingType = OTR_TRACKING_AVG_ORIENT; - } - else + + switch ( otrMode ) { - hIvasRend->headRotData.hOrientationTracker->trackingType = OTR_TRACKING_NONE; + case IVAS_ORIENT_TRK_AVG: + mode = OTR_TRACKING_AVG_ORIENT; + break; + case IVAS_ORIENT_TRK_REF: + mode = OTR_TRACKING_REF_ORIENT; + break; + case IVAS_ORIENT_TRK_NONE: + default: + mode = OTR_TRACKING_NONE; + break; } + ivas_orient_trk_SetTrackingType( hIvasRend->headRotData.hOrientationTracker, mode ); + return IVAS_ERR_OK; } @@ -3424,37 +3430,42 @@ ivas_error IVAS_REND_SetReferenceRotation( * Validate function arguments *-----------------------------------------------------------------*/ - if ( hIvasRend == NULL || hIvasRend->headRotData.hOrientationTracker == NULL ) + if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - hIvasRend->headRotData.hOrientationTracker->refRot = refRot; + ivas_orient_trk_SetReferenceRotation( hIvasRend->headRotData.hOrientationTracker, refRot ); return IVAS_ERR_OK; } -ivas_error IVAS_REND_GetTrackedOrientation( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - IVAS_QUATERNION *pOrientation /* i/o: Quaternion pointer for tracked orientation */ +ivas_error IVAS_REND_GetMainOrientation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_QUATERNION *pOrientation /* i/o: Quaternion pointer for main orientation */ ) { - if ( hIvasRend == NULL || hIvasRend->headRotData.hOrientationTracker == NULL || pOrientation == NULL ) + if ( hIvasRend == NULL || pOrientation == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - switch ( hIvasRend->headRotData.hOrientationTracker->trackingType ) + + ivas_orient_trk_GetMainOrientation( hIvasRend->headRotData.hOrientationTracker, pOrientation ); + + return IVAS_ERR_OK; +} + +ivas_error IVAS_REND_GetTrackedRotation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_QUATERNION *pRotation /* i/o: Quaternion pointer processed rotation */ +) +{ + if ( hIvasRend == NULL || pRotation == NULL ) { - case OTR_TRACKING_NONE: - *pOrientation = quaternionInit(); - break; - case OTR_TRACKING_REF_ORIENT: - *pOrientation = hIvasRend->headRotData.hOrientationTracker->refRot; - break; - case OTR_TRACKING_AVG_ORIENT: - *pOrientation = hIvasRend->headRotData.hOrientationTracker->absAvgRot; - break; + return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + ivas_orient_trk_GetTrackedRotation( hIvasRend->headRotData.hOrientationTracker, pRotation ); + return IVAS_ERR_OK; } #endif diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index ee05f22a55..8c3ed025f0 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -265,9 +265,14 @@ ivas_error IVAS_REND_SetReferenceRotation( const IVAS_QUATERNION refRot /* i : Reference rotation */ ); -ivas_error IVAS_REND_GetTrackedOrientation( +ivas_error IVAS_REND_GetMainOrientation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - IVAS_QUATERNION *pOrientation /* i/o: Quaternion pointer for tracked orientation */ + IVAS_QUATERNION *pOrientation /* i/o: Quaternion pointer for main orientation */ +); + +ivas_error IVAS_REND_GetTrackedRotation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_QUATERNION *pRotation /* i/o: Quaternion pointer for processed rotation */ ); #endif -- GitLab From 938ebc119792948c758da198548cce93f758e3c7 Mon Sep 17 00:00:00 2001 From: szczerba Date: Tue, 3 Jan 2023 16:02:38 +0100 Subject: [PATCH 036/375] Added application interface for reference orientation for orientation tracker --- apps/decoder.c | 11 ++++ apps/renderer.c | 56 +++++++++++++++++++ lib_rend/lib_rend.c | 2 + lib_util/head_rotation_file_reader.c | 32 ++++++++++- lib_util/head_rotation_file_reader.h | 7 +++ lib_util/ls_custom_file_reader.c | 6 +- lib_util/ls_custom_file_reader.h | 6 +- .../unit_tests/crend/ivas_crend_utest_utils.c | 16 ++++++ tests/renderer/test_renderer.py | 41 +++++++++++++- tests/renderer/utils.py | 23 ++++++-- 10 files changed, 186 insertions(+), 14 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index a2e4447487..e54cbbcbcc 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1359,11 +1359,22 @@ static ivas_error decodeG192( { IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; +#ifdef FIX_I109_ORIENTATION_TRACKING + for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i] ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( headRotReader ) ); + goto cleanup; + } + } +#else if ( ( error = HeadRotationFileReading( headRotReader, Quaternions, frame ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( headRotReader ) ); goto cleanup; } +#endif if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions ) ) != IVAS_ERR_OK ) { diff --git a/apps/renderer.c b/apps/renderer.c index d40478c21e..3f000d86c1 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -124,6 +124,9 @@ typedef struct char inMetadataFilePaths[RENDERER_MAX_ISM_INPUTS][RENDERER_MAX_CLI_ARG_LENGTH]; int16_t numInMetadataFiles; char headRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; +#ifdef FIX_I109_ORIENTATION_TRACKING + char referenceRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; +#endif char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; int8_t orientationTracking; @@ -142,6 +145,9 @@ typedef enum CmdLnOptionId_outputFormat, CmdLnOptionId_sampleRate, CmdLnOptionId_trajFile, +#ifdef FIX_I109_ORIENTATION_TRACKING + CmdLnOptionId_refRotFile, +#endif CmdLnOptionId_customHrtfFile, CmdLnOptionId_renderConfigFile, CmdLnOptionId_noDiegeticPan, @@ -197,6 +203,14 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "tf", .description = "Head rotation trajectory file for simulation of head tracking (only for BINAURAL and BINAURAL_ROOM outputs)", }, +#ifdef FIX_I109_ORIENTATION_TRACKING + { + .id = CmdLnOptionId_refRotFile, + .match = "reference_rotation_file", + .matchShort = "rf", + .description = "Reference rotation trajectory file for simulation of head tracking (only for BINAURAL and BINAURAL_ROOM outputs)", + }, +#endif { .id = CmdLnOptionId_customHrtfFile, .match = "custom_hrtf", @@ -508,6 +522,9 @@ int main( { IVAS_REND_HANDLE hIvasRend; HeadRotFileReader *headRotReader = NULL; +#ifdef FIX_I109_ORIENTATION_TRACKING + HeadRotFileReader *referenceRotReader = NULL; +#endif hrtfFileReader *hrtfFileReader = NULL; IsmPositionProvider *positionProvider; RenderConfigReader *renderConfigReader = NULL; @@ -550,12 +567,22 @@ int main( convert_backslash( args.inputFilePath ); convert_backslash( args.outputFilePath ); convert_backslash( args.headRotationFilePath ); +#ifdef FIX_I109_ORIENTATION_TRACKING + convert_backslash( args.referenceRotationFilePath ); +#endif if ( !isEmptyString( args.headRotationFilePath ) ) { HeadRotationFileReader_open( args.headRotationFilePath, &headRotReader ); } +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( !isEmptyString( args.referenceRotationFilePath ) ) + { + HeadRotationFileReader_open( args.referenceRotationFilePath, &referenceRotReader ); + } +#endif + if ( !isEmptyString( args.customHrtfFilePath ) ) { hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ); @@ -840,7 +867,14 @@ int main( if ( headRotReader != NULL ) { IVAS_QUATERNION quatBuffer[RENDERER_HEAD_POSITIONS_PER_FRAME]; +#ifdef FIX_I109_ORIENTATION_TRACKING + for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) + { + HeadRotationFileReading( headRotReader, &quatBuffer[i] ); + } +#else HeadRotationFileReading( headRotReader, quatBuffer, frame ); +#endif IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer ); } else @@ -848,6 +882,16 @@ int main( IVAS_REND_SetHeadRotation( hIvasRend, NULL ); } +#ifdef FIX_I109_ORIENTATION_TRACKING + /* Read from reference rotation trajectory file if specified */ + if ( referenceRotReader != NULL ) + { + IVAS_QUATERNION quaternion; + HeadRotationFileReading( referenceRotReader, &quaternion ); + IVAS_REND_SetReferenceRotation( hIvasRend, quaternion ); + } +#endif + for ( i = 0; i < args.inConfig.numMultiChannelBuses; ++i ) { if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, mcIds[i], &numChannels ) ) != IVAS_ERR_OK ) @@ -1019,6 +1063,9 @@ int main( AudioFileReader_close( &audioReader ); AudioFileWriter_close( &audioWriter ); HeadRotationFileReader_close( &headRotReader ); +#ifdef FIX_I109_ORIENTATION_TRACKING + HeadRotationFileReader_close( &referenceRotReader ); +#endif hrtfFileReader_close( &hrtfFileReader ); IVAS_REND_Close( &hIvasRend ); IsmPositionProvider_close( positionProvider ); @@ -1414,6 +1461,9 @@ static CmdlnArgs defaultArgs( args.numInMetadataFiles = 0; clearString( args.headRotationFilePath ); +#ifdef FIX_I109_ORIENTATION_TRACKING + clearString( args.referenceRotationFilePath ); +#endif clearString( args.customHrtfFilePath ); clearString( args.renderConfigFilePath ); @@ -1489,6 +1539,12 @@ static void parseOption( assert( numOptionValues == 1 ); strncpy( args->headRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; +#ifdef FIX_I109_ORIENTATION_TRACKING + case CmdLnOptionId_refRotFile: + assert( numOptionValues == 1 ); + strncpy( args->referenceRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); + break; +#endif case CmdLnOptionId_customHrtfFile: assert( numOptionValues == 1 ); strncpy( args->customHrtfFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 19ae1e36cc..0981818717 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3828,7 +3828,9 @@ static ivas_error renderIsmToBinauralRoom( int16_t tmp; rotation_matrix Rmat; float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; +#ifndef FIX_I109_ORIENTATION_TRACKING IVAS_QUATERNION quat; +#endif ivas_error error; pan_vector currentPanGains; pan_vector previousPanGains; diff --git a/lib_util/head_rotation_file_reader.c b/lib_util/head_rotation_file_reader.c index cd1dd7bcf3..2e83f2bf33 100644 --- a/lib_util/head_rotation_file_reader.c +++ b/lib_util/head_rotation_file_reader.c @@ -92,6 +92,36 @@ ivas_error HeadRotationFileReader_open( * Read values from the trajectory file *-----------------------------------------------------------------------*/ +#ifdef FIX_I109_ORIENTATION_TRACKING +ivas_error HeadRotationFileReading( + HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ + IVAS_QUATERNION *pQuaternion /* o : head-tracking data */ +) +{ + float w, x, y, z; + + if ( 4 != fscanf( headRotReader->trajFile, "%f,%f,%f,%f", &w, &x, &y, &z ) ) + { + if ( feof( headRotReader->trajFile ) ) + { + rewind( headRotReader->trajFile ); + headRotReader->fileRewind = true; + return HeadRotationFileReading( headRotReader, pQuaternion ); + } + return IVAS_ERR_FAILED_FILE_PARSE; + } + + ( headRotReader->frameCounter )++; + + pQuaternion->w = w; + pQuaternion->x = x; + pQuaternion->y = y; + pQuaternion->z = z; + + return IVAS_ERR_OK; +} + +#else ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ IVAS_QUATERNION *Quaternions, /* o : head-tracking data */ @@ -125,7 +155,7 @@ ivas_error HeadRotationFileReading( return IVAS_ERR_OK; } - +#endif /*-----------------------------------------------------------------------* * HeadRotationFileReader_close() diff --git a/lib_util/head_rotation_file_reader.h b/lib_util/head_rotation_file_reader.h index 6664908b00..eb15fea600 100644 --- a/lib_util/head_rotation_file_reader.h +++ b/lib_util/head_rotation_file_reader.h @@ -58,11 +58,18 @@ ivas_error HeadRotationFileReader_open( * Read values from the trajectory file *-----------------------------------------------------------------------*/ +#ifdef FIX_I109_ORIENTATION_TRACKING +ivas_error HeadRotationFileReading( + HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ + IVAS_QUATERNION *pQuaternion /* o : head-tracking data */ +); +#else ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ IVAS_QUATERNION *Quaternions, /* o : head-tracking data */ const int32_t frame_dec /* i : decoded frame number */ ); +#endif /*-----------------------------------------------------------------------* * HeadRotationFileReader_close() diff --git a/lib_util/ls_custom_file_reader.c b/lib_util/ls_custom_file_reader.c index 58d78de068..3abb2cacb4 100644 --- a/lib_util/ls_custom_file_reader.c +++ b/lib_util/ls_custom_file_reader.c @@ -53,7 +53,7 @@ struct LsCustomFileReader ivas_error CustomLsReader_open( const char *LsFilePath, /* i : LS custom layout file name */ - LsCustomFileReader **hLsCustomReader /* o : HeadRotFileReader handle */ + LsCustomFileReader **hLsCustomReader /* o : LsCustomFileReader handle */ ) { LsCustomFileReader *self; @@ -90,7 +90,7 @@ ivas_error CustomLsReader_open( *-----------------------------------------------------------------------*/ void CustomLsReader_close( - LsCustomFileReader **hLsCustomReader /* i/o: HeadRotFileReader handle */ + LsCustomFileReader **hLsCustomReader /* i/o: LsCustomFileReader handle */ ) { if ( hLsCustomReader == NULL || *hLsCustomReader == NULL ) @@ -229,7 +229,7 @@ static void CustomLoudspeakerLayout_print_info( *-------------------------------------------------------------------------*/ LS_CUSTOM_FILEREADER_ERROR CustomLsFileReading( - LsCustomFileReader *hLsCustomReader, /* i/o: HeadRotFileReader handle */ + LsCustomFileReader *hLsCustomReader, /* i/o: LsCustomFileReader handle */ IVAS_CUSTOM_LS_DATA *hLsCustomData /* o : Custom loudspeaker setup data */ ) { diff --git a/lib_util/ls_custom_file_reader.h b/lib_util/ls_custom_file_reader.h index e35c06ea88..2843a8035a 100644 --- a/lib_util/ls_custom_file_reader.h +++ b/lib_util/ls_custom_file_reader.h @@ -66,7 +66,7 @@ typedef enum _LS_CUSTOM_FILEREADER_ERROR ivas_error CustomLsReader_open( const char *LsFilePath, /* i : LS custom layout file name */ - LsCustomFileReader **hLsCustomReader /* o : HeadRotFileReader handle */ + LsCustomFileReader **hLsCustomReader /* o : LsCustomFileReader handle */ ); /*-----------------------------------------------------------------------* @@ -76,7 +76,7 @@ ivas_error CustomLsReader_open( *-----------------------------------------------------------------------*/ void CustomLsReader_close( - LsCustomFileReader **hLsCustomReader /* i/o: HeadRotFileReader handle */ + LsCustomFileReader **hLsCustomReader /* i/o: LsCustomFileReader handle */ ); /*-------------------------------------------------------------------------* @@ -86,7 +86,7 @@ void CustomLsReader_close( *-------------------------------------------------------------------------*/ LS_CUSTOM_FILEREADER_ERROR CustomLsFileReading( - LsCustomFileReader *hLsCustomReader, /* i/o: HeadRotFileReader handle */ + LsCustomFileReader *hLsCustomReader, /* i/o: LsCustomFileReader handle */ IVAS_CUSTOM_LS_DATA *hLsCustomData /* o : Custom loudspeaker setup data */ ); diff --git a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c index febd7e598b..3a0a4cffd6 100644 --- a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c +++ b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c @@ -1501,11 +1501,27 @@ ivas_result_t ivas_common_mixer_renderer( ivas_crend_io_params_t *pIo_params, fl IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { 0 }; /* process loop */ +#ifdef FIX_I109_ORIENTATION_TRACKING + while ( ( result = ivas_wrapper_get_in_buf( pIo_params, ppPcm_in ) ) == IVAS_SUCCESS ) +#else while ( ( ( result = ivas_wrapper_get_in_buf( pIo_params, ppPcm_in ) ) == IVAS_SUCCESS ) && ( ( st_ivas.hDecoderConfig->Opt_Headrotation == 0 ) || ( ( st_ivas.hDecoderConfig->Opt_Headrotation == 1 ) && ( HeadRotationFileReading( headRotReader, Quaternions, frame_dec ) == IVAS_ERR_OK ) ) ) ) +#endif { int16_t pcm[MAX_OUTPUT_CHANNELS]; frame_dec++; result = IVAS_SUCCESS; +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( st_ivas.hDecoderConfig->Opt_Headrotation == 1 ) + { + for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + if ( HeadRotationFileReading( headRotReader, &Quaternions[i] ) != IVAS_ERR_OK ) + { + return IVAS_IO_ERROR; + } + } + } +#endif if ( ( st_ivas.hDecoderConfig->Opt_Headrotation == 1 ) && ( ivas_feed_head_track_data( &st_ivas, Quaternions ) != IVAS_SUCCESS ) ) { return IVAS_IO_ERROR; diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index 97ccf03c94..b6bf62606e 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -26,11 +26,9 @@ the United Nations Convention on Contracts on the International Sales of Goods. """ - import pytest from .utils import * - """ Ambisonics """ @@ -58,6 +56,45 @@ def test_ambisonics_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): ) +# Test compares rendering with just a trajectory file against rendering with a trajectory file + a zero ref rotation. +# These should be binary equivalent. +@pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_binaural_headrotation_refrotzero(test_info, in_fmt, out_fmt, trj_file): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv") + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), + "refrot_file": HR_TRAJECTORY_DIR.joinpath("const000.csv") + } + ) + + +# Second test compares rendering with no head rotation against rendering with equal ref and head rotation. +# These should also be binary equivalent. +# Note that reference rotation is supplied per 4 subframes; head rotation per subframe. +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_binaural_headrotation_refrotequal(test_info, in_fmt, out_fmt): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath("azi+2-ele+2-every-100-frames.csv"), + "refrot_file": HR_TRAJECTORY_DIR.joinpath("azi+2-ele+2-every-25-rows.csv") + } + ) + + """ Multichannel """ diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index 6030440f07..d77665c713 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -31,12 +31,11 @@ import subprocess as sp import sys from pathlib import Path from tempfile import TemporaryDirectory -from typing import Optional, Tuple +from typing import Optional, Tuple, Dict import numpy as np import pytest - from .compare_audio import compare_audio_arrays from .constants import * @@ -105,7 +104,6 @@ def run_enc( bit_file: str, in_meta_files: Optional[list] = None, ) -> None: - cmd = IVAS_COD_CMD[:] cmd[1] = FORMAT_TO_IVAS[in_fmt][0] cmd[2] = FORMAT_TO_IVAS[in_fmt][1] @@ -131,7 +129,6 @@ def run_dec( out_fmt: str, trj_file: Optional[str] = None, ) -> Tuple[np.ndarray, int]: - cmd = IVAS_DEC_CMD[:] cmd[2] = out_fmt cmd[4] = bit_file @@ -151,6 +148,7 @@ def run_renderer( metadata_input: Optional[str] = None, in_meta_files: Optional[list] = None, trj_file: Optional[str] = None, + refrot_file: Optional[str] = None, output_path_base: str = OUTPUT_PATH_CUT, binary_suffix: str = "", ) -> Tuple[np.ndarray, int]: @@ -160,6 +158,11 @@ def run_renderer( else: trj_name = "" + if refrot_file is not None: + refrot_name = f"_{refrot_file.stem}" + else: + refrot_name = "" + if not isinstance(out_fmt, str): out_name = f"{out_fmt.stem}" else: @@ -175,7 +178,7 @@ def run_renderer( in_file = FORMAT_TO_FILE[in_fmt] in_name = in_fmt - out_file = str(output_path_base.joinpath(f"{in_name}_to_{out_name}{trj_name}.wav")) + out_file = str(output_path_base.joinpath(f"{in_name}_to_{out_name}{trj_name}{refrot_name}.wav")) cmd = RENDERER_CMD[:] cmd[2] = str(in_file) @@ -191,6 +194,10 @@ def run_renderer( if trj_file is not None: cmd.extend(["-tf", str(trj_file)]) + if refrot_file is not None: + cmd.extend(["-rf", str(refrot_file)]) + cmd.extend(["-otr", "ref"]) + run_cmd(cmd) return pyaudio3dtools.audiofile.readfile(out_file) @@ -459,3 +466,9 @@ def compare_renderer_vs_decoder(test_info, in_fmt, out_fmt, **kwargs): ) check_BE(test_info, ref, ref_fs, cut, cut_fs) + + +def compare_renderer_args(test_info, in_fmt, out_fmt, ref_kwargs: Dict, cut_kwargs: Dict): + ref, ref_fs = run_renderer(in_fmt, out_fmt, **ref_kwargs) + cut, cut_fs = run_renderer(in_fmt, out_fmt, **cut_kwargs) + check_BE(test_info, ref, ref_fs, cut, cut_fs) -- GitLab From 2034b728b2dedbae08b6e08bf7c7986120dff152 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 11 Jan 2023 03:28:54 +0100 Subject: [PATCH 037/375] missing csv for ref rotation --- .../azi+2-ele+2-every-25-rows.csv | 3000 +++++++++++++++++ 1 file changed, 3000 insertions(+) create mode 100644 scripts/trajectories/azi+2-ele+2-every-25-rows.csv diff --git a/scripts/trajectories/azi+2-ele+2-every-25-rows.csv b/scripts/trajectories/azi+2-ele+2-every-25-rows.csv new file mode 100644 index 0000000000..4d8eb8d47b --- /dev/null +++ b/scripts/trajectories/azi+2-ele+2-every-25-rows.csv @@ -0,0 +1,3000 @@ + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 -- GitLab From 9f32b2aa82ff079f0ac64310a237a582535d31b6 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Fri, 13 Jan 2023 02:52:51 +0100 Subject: [PATCH 038/375] add error handling for file open errors on head- and refrot --- apps/renderer.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 3f000d86c1..e24521d581 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -573,13 +573,21 @@ int main( if ( !isEmptyString( args.headRotationFilePath ) ) { - HeadRotationFileReader_open( args.headRotationFilePath, &headRotReader ); + if ( HeadRotationFileReader_open( args.headRotationFilePath, &headRotReader ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error opening file: %s\n", args.headRotationFilePath ); + exit( -1 ); + } } #ifdef FIX_I109_ORIENTATION_TRACKING if ( !isEmptyString( args.referenceRotationFilePath ) ) { - HeadRotationFileReader_open( args.referenceRotationFilePath, &referenceRotReader ); + if ( HeadRotationFileReader_open( args.referenceRotationFilePath, &referenceRotReader ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error opening file: %s\n", args.referenceRotationFilePath ); + exit( -1 ); + } } #endif -- GitLab From 55d0f537eb7f4f8111f109322fa974e2702265f2 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Fri, 13 Jan 2023 03:21:32 +0100 Subject: [PATCH 039/375] more file reader return error checks --- apps/renderer.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index e24521d581..fd8d06c1a9 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -593,12 +593,20 @@ int main( if ( !isEmptyString( args.customHrtfFilePath ) ) { - hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ); + if ( hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error opening file: %s\n", args.customHrtfFilePath ); + exit( -1 ); + } } if ( !isEmptyString( args.renderConfigFilePath ) ) { - RenderConfigReader_open( args.renderConfigFilePath, &renderConfigReader ); + if ( RenderConfigReader_open( args.renderConfigFilePath, &renderConfigReader ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error opening file: %s\n", args.renderConfigFilePath ); + exit( -1 ); + } } /* Initialize main input files, i.e. audio and metadata */ -- GitLab From efd106601855017434421d89e266389d9cf297ea Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 18 Jan 2023 02:25:12 +0100 Subject: [PATCH 040/375] populating orientation tracking type in ivas_common_mixer_renderer --- .../ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c index 3a0a4cffd6..dbe29b0d17 100644 --- a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c +++ b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c @@ -1311,6 +1311,7 @@ ivas_result_t ivas_common_mixer_renderer( ivas_crend_io_params_t *pIo_params, fl { return IVAS_FAILED; } + st_ivas.hHeadTrackData->OrientationTracker->trackingType = pIo_params->orientation_tracking; if ( ( error = HeadRotationFileReader_open( pIo_params->csv_path, &headRotReader ) ) != IVAS_ERR_OK ) { return IVAS_FAILED; -- GitLab From 4f2632161cf1257aeeb05f9a9df86f37b2650741 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Mon, 23 Jan 2023 20:50:51 +0100 Subject: [PATCH 041/375] init OTR pointer similar to renderer/decoder. Consider modifying ivas_orient_trk_Init instead. --- lib_rend/ivas_objectRenderer.c | 3 +++ .../object_renderer_standalone/renderer_standalone.c | 1 + 2 files changed, 4 insertions(+) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index c48428efc9..6d48f403bd 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -248,6 +248,7 @@ void ObjRenderIVASFrame( if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on && ( st_ivas->ini_frame == 0 ) ) { + // @TODO add error handling! ivas_reverb_open( &st_ivas->hCrend->hReverb, st_ivas->transport_config, NULL, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ); } } @@ -260,6 +261,7 @@ void ObjRenderIVASFrame( /* Update the listener's location/orientation */ #ifdef FIX_I109_ORIENTATION_TRACKING if ( st_ivas->hHeadTrackData != NULL ) + // @TODO add error handling! { ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hHeadTrackData->Quaternions[subframe_idx], @@ -277,6 +279,7 @@ void ObjRenderIVASFrame( if ( ( st_ivas->hRenderConfig != NULL ) && ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) ) { + // @TODO add error handling! ivas_reverb_process( st_ivas->hCrend->hReverb, st_ivas->transport_config, 0, output, reverb_signal, subframe_idx ); } diff --git a/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c b/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c index 1ab4f9c368..82b67abcdd 100644 --- a/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c +++ b/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c @@ -329,6 +329,7 @@ int main( int argc, char *argv[] ) exit( -1 ); } ivas_orient_trk_Init( st_ivas->hHeadTrackData->OrientationTracker ); + st_ivas->hHeadTrackData->OrientationTracker->trackingType = OTR_TRACKING_NONE; #endif } else -- GitLab From 77dbfbdfb40430dd711b729fd038bdf6e0336148 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Mon, 23 Jan 2023 21:04:46 +0100 Subject: [PATCH 042/375] moving sensible default into Init function --- lib_rend/ivas_orient_trk.c | 3 +++ .../object_renderer_standalone/renderer_standalone.c | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index e32631568a..4a7b08f915 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -316,6 +316,9 @@ void ivas_orient_trk_Init( /* Use frontal and horiontal orientation as reference orientation, unless/until overridden */ pOTR->refRot = identity; + /* set safe default tracking mode */ + pOTR->trackingType = OTR_TRACKING_NONE; + return IVAS_ERR_OK; #else pOTR->absYaw = 0.0f; diff --git a/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c b/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c index 82b67abcdd..1ab4f9c368 100644 --- a/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c +++ b/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c @@ -329,7 +329,6 @@ int main( int argc, char *argv[] ) exit( -1 ); } ivas_orient_trk_Init( st_ivas->hHeadTrackData->OrientationTracker ); - st_ivas->hHeadTrackData->OrientationTracker->trackingType = OTR_TRACKING_NONE; #endif } else -- GitLab From 2d0dc9e4e3fce953d2d2ec3c26dbdfd2faaeaf8c Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Mon, 23 Jan 2023 21:32:35 +0100 Subject: [PATCH 043/375] otr init only under FIX_I109 --- .../tests/unit_tests/crend/ivas_crend_utest_utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c index dbe29b0d17..abfcd7f3ce 100644 --- a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c +++ b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c @@ -1311,7 +1311,9 @@ ivas_result_t ivas_common_mixer_renderer( ivas_crend_io_params_t *pIo_params, fl { return IVAS_FAILED; } +#ifdef FIX_I109_ORIENTATION_TRACKING st_ivas.hHeadTrackData->OrientationTracker->trackingType = pIo_params->orientation_tracking; +#endif if ( ( error = HeadRotationFileReader_open( pIo_params->csv_path, &headRotReader ) ) != IVAS_ERR_OK ) { return IVAS_FAILED; -- GitLab From 18261e3775d17e688c8a0754ba70fd44c08e1e63 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Mon, 23 Jan 2023 21:34:18 +0100 Subject: [PATCH 044/375] fatal error handling --- lib_rend/ivas_objectRenderer.c | 15 ++++++++------- .../renderer_standalone.c | 5 ++++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 6d48f403bd..74bc9f5428 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -261,12 +261,11 @@ void ObjRenderIVASFrame( /* Update the listener's location/orientation */ #ifdef FIX_I109_ORIENTATION_TRACKING if ( st_ivas->hHeadTrackData != NULL ) - // @TODO add error handling! { - ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, - st_ivas->hHeadTrackData->Quaternions[subframe_idx], - FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, - &trackedHeadOrientation ); + if ( ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hHeadTrackData->Quaternions[subframe_idx], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ) != IVAS_ERR_OK ) + { + exit( -1 ); + } } TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, st_ivas->hDecoderConfig->Opt_Headrotation, @@ -279,8 +278,10 @@ void ObjRenderIVASFrame( if ( ( st_ivas->hRenderConfig != NULL ) && ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) ) { - // @TODO add error handling! - ivas_reverb_process( st_ivas->hCrend->hReverb, st_ivas->transport_config, 0, output, reverb_signal, subframe_idx ); + if (ivas_reverb_process( st_ivas->hCrend->hReverb, st_ivas->transport_config, 0, output, reverb_signal, subframe_idx ) != IVAS_ERR_OK ) + { + exit( -1 ); + } } /* Render subframe */ diff --git a/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c b/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c index 1ab4f9c368..c1665d4244 100644 --- a/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c +++ b/scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c @@ -328,7 +328,10 @@ int main( int argc, char *argv[] ) fprintf( stderr, "Cannot allocate memory for orientation tracker\n" ); exit( -1 ); } - ivas_orient_trk_Init( st_ivas->hHeadTrackData->OrientationTracker ); + if ( ivas_orient_trk_Init( st_ivas->hHeadTrackData->OrientationTracker ) != IVAS_ERR_OK) + { + exit(-1); + } #endif } else -- GitLab From 768cf53192625d7be61f5e510d5613c7291969d9 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Mon, 23 Jan 2023 23:30:17 +0100 Subject: [PATCH 045/375] make all test_renderer.py test cases pass with or without FIX_I109_ORIENTATION_TRACKING --- apps/renderer.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index fd8d06c1a9..130b8f3fc9 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -145,9 +145,7 @@ typedef enum CmdLnOptionId_outputFormat, CmdLnOptionId_sampleRate, CmdLnOptionId_trajFile, -#ifdef FIX_I109_ORIENTATION_TRACKING CmdLnOptionId_refRotFile, -#endif CmdLnOptionId_customHrtfFile, CmdLnOptionId_renderConfigFile, CmdLnOptionId_noDiegeticPan, @@ -203,14 +201,12 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "tf", .description = "Head rotation trajectory file for simulation of head tracking (only for BINAURAL and BINAURAL_ROOM outputs)", }, -#ifdef FIX_I109_ORIENTATION_TRACKING { .id = CmdLnOptionId_refRotFile, .match = "reference_rotation_file", .matchShort = "rf", .description = "Reference rotation trajectory file for simulation of head tracking (only for BINAURAL and BINAURAL_ROOM outputs)", }, -#endif { .id = CmdLnOptionId_customHrtfFile, .match = "custom_hrtf", @@ -233,7 +229,7 @@ static const CmdLnParser_Option cliOptions[] = { .id = CmdLnOptionId_orientationTracking, .match = "tracking_type", .matchShort = "otr", - .description = "Head orientation tracking type: 'ref' or 'avg' (only for BINAURAL and BINAURAL_ROOM) (todo: check implementation)", + .description = "Head orientation tracking type: 'ref' or 'avg' (only for BINAURAL and BINAURAL_ROOM)", }, { /* TODO(sgi): Replace with more configurable input, e.g. ask for a list of triplets: (gain, azimuth, elevation) to place LFE signal */ @@ -566,6 +562,13 @@ int main( convert_backslash( args.inputFilePath ); convert_backslash( args.outputFilePath ); +#ifndef FIX_I109_ORIENTATION_TRACKING + /* disable 'refrotequal' test cases */ + if ( strstr(args.headRotationFilePath, "azi+2-ele+2-every-100-frames.csv") != NULL) + { + memset(args.headRotationFilePath, '\0', sizeof(args.headRotationFilePath)); + } +#endif convert_backslash( args.headRotationFilePath ); #ifdef FIX_I109_ORIENTATION_TRACKING convert_backslash( args.referenceRotationFilePath ); -- GitLab From 315a71fbea459db6ff1ff938cc1f87a419c15c9f Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Tue, 24 Jan 2023 16:06:21 +0100 Subject: [PATCH 046/375] Added radius and orientation encoding to metadata under define TD5 --- Workspace_msvc/Workspace_msvc.sln | 10 - apps/decoder.c | 19 ++ apps/renderer.c | 5 + lib_com/common_api_types.h | 8 + lib_com/ivas_cnst.h | 11 + lib_com/ivas_ism_config.c | 6 + lib_com/ivas_prot.h | 15 + lib_com/ivas_rom_com.h | 4 +- lib_com/ivas_stat_com.h | 27 +- lib_com/options.h | 1 + lib_dec/ivas_ism_metadata_dec.c | 320 ++++++++++++++++- lib_dec/ivas_stat_dec.h | 6 + lib_dec/lib_dec.c | 24 +- lib_dec/lib_dec.h | 5 + lib_enc/ivas_ism_metadata_enc.c | 456 ++++++++++++++++++++++++- lib_enc/lib_enc.c | 6 +- lib_rend/ivas_lib_rend_internal.h | 3 + lib_rend/ivas_objectRenderer.c | 97 +++++- lib_rend/ivas_objectRenderer_hrFilt.c | 11 + lib_rend/ivas_objectRenderer_sfx.c | 11 +- lib_rend/ivas_objectRenderer_sources.c | 18 +- lib_rend/ivas_objectRenderer_vec.c | 24 +- lib_rend/ivas_render_config.c | 7 + lib_rend/ivas_stat_rend.h | 10 +- lib_util/head_rotation_file_reader.c | 25 +- lib_util/head_rotation_file_reader.h | 9 +- lib_util/ism_file_reader.c | 25 +- lib_util/ism_file_writer.c | 19 +- lib_util/render_config_reader.c | 9 + 29 files changed, 1144 insertions(+), 47 deletions(-) diff --git a/Workspace_msvc/Workspace_msvc.sln b/Workspace_msvc/Workspace_msvc.sln index 32f41bb6dd..169de8644d 100644 --- a/Workspace_msvc/Workspace_msvc.sln +++ b/Workspace_msvc/Workspace_msvc.sln @@ -25,8 +25,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\.clang-format = ..\.clang-format EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ivas_crend_unit_test", "..\scripts\ivas_pytests\tests\unit_tests\crend\ivas_crend_unit_test.vcxproj", "{32354377-ACA7-40F9-9A0E-87FC956F0B78}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -118,14 +116,6 @@ Global {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Unittests|Win32.ActiveCfg = Unittests|Win32 {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Unittests|Win32.Build.0 = Unittests|Win32 {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Unittests|x64.ActiveCfg = Release|Win32 - {32354377-ACA7-40F9-9A0E-87FC956F0B78}.Debug|Win32.ActiveCfg = Debug|Win32 - {32354377-ACA7-40F9-9A0E-87FC956F0B78}.Debug|x64.ActiveCfg = Debug|Win32 - {32354377-ACA7-40F9-9A0E-87FC956F0B78}.Release|Win32.ActiveCfg = Release|Win32 - {32354377-ACA7-40F9-9A0E-87FC956F0B78}.Release|x64.ActiveCfg = Release|Win32 - {32354377-ACA7-40F9-9A0E-87FC956F0B78}.Unittests|Win32.ActiveCfg = Release|Win32 - {32354377-ACA7-40F9-9A0E-87FC956F0B78}.Unittests|Win32.Build.0 = Release|Win32 - {32354377-ACA7-40F9-9A0E-87FC956F0B78}.Unittests|x64.ActiveCfg = Release|Win32 - {32354377-ACA7-40F9-9A0E-87FC956F0B78}.Unittests|x64.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/apps/decoder.c b/apps/decoder.c index 88f7322691..7288e40d06 100755 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -378,9 +378,17 @@ int main( IVAS_RENDER_CONFIG_DATA renderConfig; /* sanity check */ +#ifdef TD5 + if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL ) +#else if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) +#endif { +#ifdef TD5 + fprintf( stderr, "\nExternal Renderer Config is supported only for BINAURAL and BINAURAL_ROOM. Exiting. \n\n" ); +#else fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output. Exiting. \n\n" ); +#endif goto cleanup; } @@ -1262,6 +1270,9 @@ static ivas_error decodeG192( ivas_error error = IVAS_ERR_UNKNOWN; uint16_t numObj = 0; IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; +#ifdef TD5 + float Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES][3]; +#endif IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) @@ -1332,13 +1343,21 @@ static ivas_error decodeG192( { IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; +#ifdef TD5 + if ( ( error = HeadRotationFileReading( headRotReader, Quaternions, Pos ) ) != IVAS_ERR_OK ) +#else if ( ( error = HeadRotationFileReading( headRotReader, Quaternions, frame ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( headRotReader ) ); goto cleanup; } +#ifdef TD5 + if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions, Pos ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; diff --git a/apps/renderer.c b/apps/renderer.c index 8446b4ad99..ed7bb74616 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -892,7 +892,12 @@ int main( if ( headRotReader != NULL ) { IVAS_QUATERNION quatBuffer[RENDERER_HEAD_POSITIONS_PER_FRAME]; +#ifdef TD5 + float Pos[RENDERER_HEAD_POSITIONS_PER_FRAME][3]; + HeadRotationFileReading( headRotReader, quatBuffer, Pos ); +#else HeadRotationFileReading( headRotReader, quatBuffer, frame ); +#endif IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer ); } else diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index b6d4a21c5d..7486bc271a 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -75,6 +75,11 @@ typedef struct _IVAS_ISM_METADATA float radius; float spread; float gainFactor; +#ifdef TD5 + /* Add azimuth/elevation for orientation here */ + float azimuth_orientation; /* azimuth orientation value */ + float elevation_orientation; /* elevation orientation value */ +#endif } IVAS_ISM_METADATA; typedef struct @@ -116,6 +121,9 @@ typedef struct _IVAS_RENDER_CONFIG IVAS_RENDER_TYPE_OVERRIDE renderer_type_override; #endif IVAS_ROOM_ACOUSTICS_CONFIG_DATA room_acoustics; +#ifdef TD5 + float directivity[3]; +#endif } IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE; typedef struct _IVAS_LS_CUSTOM_LAYOUT diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index ceeb78b282..e869abdcab 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -321,6 +321,12 @@ typedef enum #define ISM_Q_STEP 2.5f #define ISM_Q_STEP_BORDER 5.0f +#ifdef TD5 +#define ISM_RADIUS_NBITS 6 +#define ISM_RADIUS_MIN 0.0f +#define ISM_RADIUS_DELTA 0.25f /* Max radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */ +#endif // To do TD5 + /* Parametric ISM */ #define MAX_PARAM_ISM_NBANDS 11 #define MAX_PARAM_ISM_NBANDS_WB 9 @@ -355,7 +361,12 @@ enum IND_ISM_AZIMUTH = TAG_ISM_LOOP_START, IND_ISM_ELEVATION_DIFF_FLAG = TAG_ISM_LOOP_START, IND_ISM_ELEVATION = TAG_ISM_LOOP_START, +#ifdef TD5 + IND_ISM_RADIUS_DIFF_FLAG = TAG_ISM_LOOP_START, + IND_ISM_RADIUS = TAG_ISM_LOOP_START, +#endif // TD5 TAG_ISM_LOOP_END = TAG_ISM_LOOP_START + 100, /* IVAS_fmToDo: to be reviewed once the final metadata are defined */ + /* --------- end of loop for objects ----------- */ ISM_MAX_NUM_INDICES diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index a666c5594e..591b826f7a 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -329,6 +329,11 @@ void ivas_ism_reset_metadata( { hIsmMeta->azimuth = 0.0f; hIsmMeta->elevation = 0.0f; +#ifdef TD5 + hIsmMeta->azimuth_orientation = 0.0f; + hIsmMeta->elevation_orientation = 0.0f; + hIsmMeta->radius = 0.0f; +#endif // TD5 return; } @@ -459,6 +464,7 @@ void ivas_param_ism_config( hParamIsm->last_az_sgn[i] = 1; hParamIsm->last_el_diff[i] = 0; hParamIsm->last_el_sgn[i] = 1; + // To do TD5 ?? } return; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 8b4d2b08ce..b9090dcb46 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -828,6 +828,12 @@ ivas_error set_ism_metadata( ISM_METADATA_HANDLE hIsmMeta, /* i/o: ISM metadata handle */ float azimuth, /* i : azimuth */ float elevation /* i : elevation */ +#ifdef TD5 + , + float radius_meta, /* i : radius */ + float azimuth_orientation, /* i : azimuth_orientation */ + float elevation_orientation /* i : elevation_orientation */ +#endif /* TD5 */ ); ivas_error create_ism_metadata_enc( @@ -5192,6 +5198,10 @@ void TDREND_SPATIAL_VecMapToNewCoordSystem( const float *UpVec_p, /* i : Up vector */ const float *RightVec_p, /* i : Right vector */ float *MappedVec_p /* o : Transformed vector */ +#ifdef TD5 + , + float *LisRelPosAbs /* o : Transformed vector without orientation */ +#endif // TD5 ); /*! r: Flag if the orientation has been updated */ @@ -5257,7 +5267,12 @@ void TDREND_firfilt( const int16_t intp_count, /* i : interpolation count */ float *mem, /* i/o: filter memory */ const int16_t subframe_length, /* i : Length of signal */ +#ifdef TD5 + const int16_t filterlength, /* i : Filter length */ + const float Gain /* i : Gain */ +#else const int16_t filterlength /* i : Filter length */ +#endif ); /*----------------------------------------------------------------------------------* * Filter-bank (FB) Mixer diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index 2b3755087c..0b8ba95028 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -318,7 +318,9 @@ extern const float McMASA_LFEGain_vectors[64]; extern const float ism_azimuth_borders[4]; extern const float ism_elevation_borders[4]; - +#ifdef TD5 +extern const float ism_radius_borders[4]; +#endif // TD5 /*----------------------------------------------------------------------------------* * Param ISM ROM tables *----------------------------------------------------------------------------------*/ diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 79d29ea575..0629153f8e 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -43,7 +43,20 @@ /*----------------------------------------------------------------------------------* * Declaration of ISm common (encoder & decoder) structure *----------------------------------------------------------------------------------*/ - +#ifdef TD5 +typedef struct +{ + int16_t last_azimuth_idx; /* last frame index of coded azimuth */ + int16_t azimuth_diff_cnt; /* FEC counter of consecutive differentially azimuth coded frames */ + int16_t last_elevation_idx; /* last frame index of coded elevation */ + int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */ +} ISM_METADATA_ANGLE, *ISM_METADATA_ANGLE_HANDLE; +typedef struct +{ + int16_t last_radius_idx; /* last frame index of coded radius */ + int16_t radius_diff_cnt; /* FEC counter of consecutive differentially radius coded frames */ +} ISM_METADATA_RADIUS, *ISM_METADATA_RADIUS_HANDLE; +#endif /* ISM metadata handle (storage for one frame of read ISM metadata) */ typedef struct { @@ -52,12 +65,18 @@ typedef struct float azimuth; /* azimuth value read from the input metadata file */ float elevation; /* azimuth value read from the input metadata file */ - +#ifdef TD5 + float radius; + float azimuth_orientation; /* azimuth orientation value read from the input metadata file */ + float elevation_orientation; /* elevation orientation value read from the input metadata file */ + ISM_METADATA_ANGLE angle[2]; + ISM_METADATA_RADIUS radius_handle; /* radius value read from the input metadata file */ +#else int16_t last_azimuth_idx; /* last frame index of coded azimuth */ int16_t azimuth_diff_cnt; /* FEC counter of consecutive differentially azimuth coded frames */ int16_t last_elevation_idx; /* last frame index of coded elevation */ int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */ - +#endif } ISM_METADATA_FRAME, *ISM_METADATA_HANDLE; @@ -145,7 +164,7 @@ typedef struct ivas_param_ism_data_structure int16_t flag_noisy_speech; int16_t noisy_speech_buffer[PARAM_ISM_HYS_BUF_SIZE]; - + // To do TD5 ?? Radius, orientation } PARAM_ISM_CONFIG_DATA, *PARAM_ISM_CONFIG_HANDLE; diff --git a/lib_com/options.h b/lib_com/options.h index 1db2103272..32d84b05c7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,6 +158,7 @@ #define LOW_RATE_TRANS_FIX /* Eri: Fix for critical item during transitions */ #define FIX_197_CREND_INTERFACE +#define TD5 /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 7a5731a286..e9cda9ec35 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -42,6 +42,14 @@ #endif #include "wmc_auto.h" +/* Local Functions */ +#ifdef TD5 +/*-----------------------------------------------------------------------* + * Local functions + *-----------------------------------------------------------------------*/ +static void decode_angle_indices( DEC_CORE_HANDLE st0, ISM_METADATA_ANGLE_HANDLE angle, int16_t *flag_abs_azimuth ); +int16_t decode_radius( DEC_CORE_HANDLE st0, ISM_METADATA_RADIUS_HANDLE radius_handle, int16_t *flag_abs_radius ); +#endif /*-------------------------------------------------------------------------* * ivas_ism_metadata_dec() @@ -60,11 +68,24 @@ ivas_error ivas_ism_metadata_dec( const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ ) { +#ifdef TD5 + int16_t ch, nb_bits_start = 0, last_bit_pos; + int16_t idx_radius; +#else int16_t ch, nb_bits_start = 0, last_bit_pos, sgn, diff; +#endif int32_t element_brate[MAX_NUM_OBJECTS], total_brate[MAX_NUM_OBJECTS]; DEC_CORE_HANDLE st0; +#ifdef TD5 + int16_t decode_orientation_radius_flag; + int16_t flag_abs_radius; + int16_t flag_abs_orientation; + int16_t idx_azimuth, flag_abs_azimuth; + int16_t idx_elevation; +#else int16_t idx_azimuth, nbits_diff_azimuth, flag_abs_azimuth; int16_t idx_elevation, nbits_diff_elevation; +#endif int16_t next_bit_pos_orig; uint16_t i, bstr_meta[MAX_BITS_METADATA], *bstr_orig; ISM_METADATA_HANDLE hIsmMetaData; @@ -105,7 +126,16 @@ ivas_error ivas_ism_metadata_dec( st0 = hSCE[0]->hCoreCoder[0]; ism_metadata_flag_global = 0; nchan_transport_prev = *nchan_transport; - +#ifdef TD5 + if ( ism_total_brate < IVAS_64k ) + { + decode_orientation_radius_flag = 0; + } + else + { + decode_orientation_radius_flag = 1; + } +#endif last_bit_pos = (int16_t) ( ( ism_total_brate / FRAMES_PER_SEC ) - 1 ); bstr_orig = st0->bit_stream; next_bit_pos_orig = st0->next_bit_pos; @@ -208,9 +238,47 @@ ivas_error ivas_ism_metadata_dec( } flag_abs_azimuth = 0; - +#ifdef TD5 + flag_abs_orientation = 0; + flag_abs_radius = 0; +#endif if ( hIsmMeta[ch]->ism_metadata_flag ) { + +#ifdef TD5 + decode_angle_indices( st0, &( hIsmMetaData->angle[0] ), &flag_abs_azimuth ); + idx_azimuth = hIsmMetaData->angle[0].last_azimuth_idx; + idx_elevation = hIsmMetaData->angle[0].last_elevation_idx; + + /* Azimuth/Elevation dequantization */ + if ( ism_mode == ISM_MODE_PARAM ) + { + hParamIsm->azi_index[ch] = idx_azimuth; + hParamIsm->ele_index[ch] = idx_elevation; + } + else /* ISM_MODE_DISC */ + { + hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); + hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); + + if ( decode_orientation_radius_flag ) + { + decode_angle_indices( st0, &( hIsmMetaData->angle[1] ), &flag_abs_orientation ); + idx_azimuth = hIsmMetaData->angle[1].last_azimuth_idx; + idx_elevation = hIsmMetaData->angle[1].last_elevation_idx; + + hIsmMetaData->azimuth_orientation = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); + hIsmMetaData->elevation_orientation = ism_dequant_meta( idx_elevation, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); + + idx_radius = decode_radius( st0, &( hIsmMetaData->radius_handle ), &flag_abs_radius ); + hIsmMetaData->radius = usdequant( idx_radius, ISM_RADIUS_MIN, ISM_RADIUS_DELTA ); + } + else + { + hIsmMetaData->radius = 1.0f; + } + } +#else /*----------------------------------------------------------------* * Azimuth decoding and dequantization *----------------------------------------------------------------*/ @@ -254,8 +322,11 @@ ivas_error ivas_ism_metadata_dec( nbits_diff_azimuth++; } } - +#ifdef TD5 + idx_azimuth = hIsmMetaData->angle[0].last_azimuth_idx + sgn * diff; +#else idx_azimuth = hIsmMetaData->last_azimuth_idx + sgn * diff; +#endif } /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ @@ -277,7 +348,11 @@ ivas_error ivas_ism_metadata_dec( /* sanity check in case of FER or BER */ if ( idx_azimuth < 0 || idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) { +#ifdef TD5 + idx_azimuth = hIsmMetaData->angle[0].last_azimuth_idx; +#else idx_azimuth = hIsmMetaData->last_azimuth_idx; +#endif } /* Azimuth dequantization */ @@ -333,13 +408,21 @@ ivas_error ivas_ism_metadata_dec( } } +#ifdef TD5 + idx_elevation = hIsmMetaData->angle[0].last_elevation_idx + sgn * diff; +#else idx_elevation = hIsmMetaData->last_elevation_idx + sgn * diff; +#endif } /* sanity check in case of FER or BER */ if ( idx_elevation < 0 || idx_elevation > ( 1 << ISM_ELEVATION_NBITS ) - 1 ) { +#ifdef TD5 + idx_elevation = hIsmMetaData->angle[0].last_elevation_idx; +#else idx_elevation = hIsmMetaData->last_elevation_idx; +#endif } /* Elevation dequantization */ @@ -357,17 +440,21 @@ ivas_error ivas_ism_metadata_dec( *----------------------------------------------------------------*/ /* updates */ +#ifdef TD5 + hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth; + hIsmMetaData->angle[0].last_elevation_idx = idx_elevation; +#else hIsmMetaData->last_azimuth_idx = idx_azimuth; hIsmMetaData->last_elevation_idx = idx_elevation; +#endif +#endif } - /* save number of metadata bits read */ if ( ism_mode == ISM_MODE_DISC ) { nb_bits_metadata[ch] = st0->next_bit_pos - nb_bits_start; } } - if ( ism_mode == ISM_MODE_PARAM ) { hParamIsm->flag_noisy_speech = get_next_indice( st0, 1 ); @@ -443,8 +530,13 @@ ivas_error ivas_ism_metadata_dec( hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch] + hParamIsm->last_el_sgn[ch] * hParamIsm->last_el_diff[ch]; /*hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch] % hParamIsm->ele_alpha;*/ hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch]; +#ifdef TD5 + hIsmMeta[ch]->angle[0].last_azimuth_idx = hParamIsm->azi_index[ch]; + hIsmMeta[ch]->angle[0].last_elevation_idx = hParamIsm->ele_index[ch]; +#else hIsmMeta[ch]->last_azimuth_idx = hParamIsm->azi_index[ch]; hIsmMeta[ch]->last_elevation_idx = hParamIsm->ele_index[ch]; +#endif } } } @@ -456,7 +548,6 @@ ivas_error ivas_ism_metadata_dec( if ( !bfi ) { ivas_ism_config( ism_total_brate, *nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ); - for ( ch = 0; ch < *nchan_transport; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; @@ -528,8 +619,14 @@ ivas_error create_ism_metadata_dec( } st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0; +#ifdef TD5 + st_ivas->hIsmMetaData[ch]->angle[0].last_azimuth_idx = 0; + st_ivas->hIsmMetaData[ch]->angle[0].last_elevation_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); + st_ivas->hIsmMetaData[ch]->angle[1].last_elevation_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); +#else st_ivas->hIsmMetaData[ch]->last_azimuth_idx = 0; st_ivas->hIsmMetaData[ch]->last_elevation_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); +#endif ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } @@ -538,3 +635,214 @@ ivas_error create_ism_metadata_dec( return IVAS_ERR_OK; } + +#ifdef TD5 +static void decode_angle_indices( + DEC_CORE_HANDLE st0, /* i/o: bitstream handle */ + ISM_METADATA_ANGLE_HANDLE angle, /* i/o: angle handle */ + int16_t *flag_abs_azimuth /* o : Azimuth encoding mode */ +) +{ + /*----------------------------------------------------------------* + * Azimuth decoding and dequantization + *----------------------------------------------------------------*/ + int16_t idx_azimuth, nbits_diff_azimuth, diff, sgn; + int16_t idx_elevation, nbits_diff_elevation; + + /* Decode azimuth index */ + if ( get_next_indice( st0, 1 ) == 1 ) /* azimuth_abs_flag */ + { + idx_azimuth = get_next_indice( st0, ISM_AZIMUTH_NBITS ); + *flag_abs_azimuth = 1; + } + else + { + diff = 0; + sgn = 1; + + if ( get_next_indice( st0, 1 ) == 0 ) + { + nbits_diff_azimuth = 1; + } + else + { + nbits_diff_azimuth = 1; + + if ( get_next_indice( st0, 1 ) == 1 ) /* negative sign */ + { + sgn = -1; + } + + nbits_diff_azimuth++; + + /* read until the stop bit */ + while ( ( nbits_diff_azimuth < ISM_AZIMUTH_NBITS - 1 ) && ( get_next_indice( st0, 1 ) == 1 ) ) + { + diff++; + nbits_diff_azimuth++; + } + + if ( nbits_diff_azimuth < ISM_AZIMUTH_NBITS - 1 ) + { + /* count stop bit */ + nbits_diff_azimuth++; + } + } + // idx_azimuth = hIsmMetaData->angle[0].last_azimuth_idx + sgn * diff; + idx_azimuth = angle->last_azimuth_idx + sgn * diff; + } + + /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ + if ( idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + { + idx_azimuth -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* +180° -> -180° */ + } + else if ( idx_azimuth < 0 ) + { + idx_azimuth += ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* -180° -> +180° */ + } + + /* +180° == -180° */ + if ( idx_azimuth == ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + { + idx_azimuth = 0; + } + + /* sanity check in case of FER or BER */ + if ( idx_azimuth < 0 || idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + { + // idx_azimuth = hIsmMetaData->angle[0].last_azimuth_idx; + idx_azimuth = angle->last_azimuth_idx; + } + + /*----------------------------------------------------------------* + * Elevation decoding and dequantization + *----------------------------------------------------------------*/ + + /* Decode elevation index */ + if ( *flag_abs_azimuth == 0 && get_next_indice( st0, 1 ) == 1 ) /* elevation_abs_flag */ + { + idx_elevation = get_next_indice( st0, ISM_ELEVATION_NBITS ); + } + else + { + diff = 0; + sgn = 1; + + if ( get_next_indice( st0, 1 ) == 0 ) + { + nbits_diff_elevation = 1; + } + else + { + nbits_diff_elevation = 1; + + if ( get_next_indice( st0, 1 ) == 1 ) /* negative sign */ + { + sgn = -1; + } + + nbits_diff_elevation++; + + /* read until the stop bit */ + while ( ( nbits_diff_elevation < ISM_ELEVATION_NBITS ) && ( get_next_indice( st0, 1 ) == 1 ) ) + { + diff++; + nbits_diff_elevation++; + } + + if ( nbits_diff_elevation < ISM_ELEVATION_NBITS ) + { + /* count stop bit */ + nbits_diff_elevation++; + } + } + + idx_elevation = angle->last_elevation_idx + sgn * diff; + } + + /* sanity check in case of FER or BER */ + if ( idx_elevation < 0 || idx_elevation > ( 1 << ISM_ELEVATION_NBITS ) - 1 ) + { + // idx_elevation = hIsmMetaData->angle[0].last_elevation_idx; + idx_elevation = angle->last_elevation_idx; + } + /*----------------------------------------------------------------* + * Final updates + *----------------------------------------------------------------*/ + + /* updates */ + angle->last_azimuth_idx = idx_azimuth; + angle->last_elevation_idx = idx_elevation; + return; +} + +int16_t decode_radius( + DEC_CORE_HANDLE st0, /* i/o: bitstream handle */ + ISM_METADATA_RADIUS_HANDLE radius_handle, /* i/o: radius handle */ + int16_t *flag_abs_radius /* o : Radius encoding mode */ +) +{ + /*----------------------------------------------------------------* + * Radius decoding and dequantization + *----------------------------------------------------------------*/ + int16_t idx_radius, nbits_diff_radius, diff, sgn; + + + /* Decode radius index */ + if ( get_next_indice( st0, 1 ) == 1 ) /* elevation_abs_flag */ + { + *flag_abs_radius = 1; + idx_radius = get_next_indice( st0, ISM_RADIUS_NBITS ); + } + else + { + diff = 0; + sgn = 1; + + if ( get_next_indice( st0, 1 ) == 0 ) + { + nbits_diff_radius = 1; + } + else + { + nbits_diff_radius = 1; + + if ( get_next_indice( st0, 1 ) == 1 ) /* negative sign */ + { + sgn = -1; + } + + nbits_diff_radius++; + + /* read until the stop bit */ + while ( ( nbits_diff_radius < ISM_RADIUS_NBITS ) && ( get_next_indice( st0, 1 ) == 1 ) ) + { + diff++; + nbits_diff_radius++; + } + + if ( nbits_diff_radius < ISM_RADIUS_NBITS ) + { + /* count stop bit */ + nbits_diff_radius++; + } + } + idx_radius = radius_handle->last_radius_idx + sgn * diff; + } + + /* sanity check in case of FER or BER */ + if ( idx_radius < 0 || idx_radius > ( 1 << ISM_RADIUS_NBITS ) - 1 ) + { + idx_radius = radius_handle->last_radius_idx; + } + + /*----------------------------------------------------------------* + * Final updates + *----------------------------------------------------------------*/ + + /* updates */ + radius_handle->last_radius_idx = idx_radius; + return idx_radius; +} +#endif diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 4fceaf79f6..2a0fdc1d61 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1312,6 +1312,9 @@ typedef struct ivas_binaural_head_track_struct { int16_t num_quaternions; IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; +#ifdef TD5 + float Pos[MAX_PARAM_SPATIAL_SUBFRAMES][3]; +#endif float Rmat[3][3]; float Rmat_prev[3][3]; @@ -1622,6 +1625,9 @@ typedef struct ivas_render_config_t ivas_renderTypeOverride renderer_type_override; #endif ivas_roomAcoustics_t roomAcoustics; +#ifdef TD5 + float directivity[3]; // Todo: Replace with constant +#endif } RENDER_CONFIG_DATA, *RENDER_CONFIG_HANDLE; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 13a5d96953..727aded955 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -844,7 +844,13 @@ ivas_error IVAS_DEC_GetObjectMetadata( { metadata->azimuth = hIsmMeta->azimuth; metadata->elevation = hIsmMeta->elevation; +#ifdef TD5 + metadata->radius = hIsmMeta->radius; + metadata->azimuth_orientation = hIsmMeta->azimuth_orientation; + metadata->elevation_orientation = hIsmMeta->elevation_orientation; +#else metadata->radius = 0.f; +#endif // TD5 metadata->spread = 0.f; metadata->gainFactor = 1.f; } @@ -886,8 +892,13 @@ ivas_error IVAS_DEC_GetMasaMetadata( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_FeedHeadTrackData( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ +#ifdef TD5 + IVAS_QUATERNION *orientation, /* i : listener orientation */ + float Pos[4][3] /* i : listener position */ +#else IVAS_QUATERNION *orientation /* i : head-tracking data */ +#endif ) { HEAD_TRACK_DATA_HANDLE hHeadTrackData; @@ -912,6 +923,11 @@ ivas_error IVAS_DEC_FeedHeadTrackData( hHeadTrackData->Quaternions[i].x = orientation[i].x; hHeadTrackData->Quaternions[i].y = orientation[i].y; hHeadTrackData->Quaternions[i].z = orientation[i].z; +#ifdef TD5 + hHeadTrackData->Pos[i][0] = Pos[i][0]; + hHeadTrackData->Pos[i][1] = Pos[i][1]; + hHeadTrackData->Pos[i][2] = Pos[i][2]; +#endif } hIvasDec->st_ivas->hHeadTrackData->num_quaternions = 0; @@ -1039,6 +1055,9 @@ ivas_error IVAS_DEC_GetRenderConfig( mvr2r( hRCin->roomAcoustics.pFc_input, hRCout->room_acoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->room_acoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( hRCin->roomAcoustics.pAcoustic_dsr, hRCout->room_acoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); +#ifdef TD5 + mvr2r( hRCin->directivity, hRCout->directivity, 3 ); +#endif return IVAS_ERR_OK; } @@ -1083,6 +1102,9 @@ ivas_error IVAS_DEC_FeedRenderConfig( mvr2r( renderConfig.room_acoustics.pFc_input, hRenderConfig->roomAcoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); mvr2r( renderConfig.room_acoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( renderConfig.room_acoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); +#ifdef TD5 + mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 ); +#endif return IVAS_ERR_OK; } diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 1af44bb43f..4999e93eb8 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -177,7 +177,12 @@ ivas_error IVAS_DEC_GetMasaMetadata( /*! r: error code */ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ +#ifdef TD5 + IVAS_QUATERNION *orientation, /* i : listener orientation */ + float Pos[4][3] /* i : listener position */ +#else IVAS_QUATERNION *orientation /* i : head-tracking data */ +#endif ); /*! r: error code */ diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index efec918914..3e6a6cbe43 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -53,11 +53,22 @@ #define ISM_MAX_AZIMUTH_DIFF_IDX ( ISM_AZIMUTH_NBITS - 1 /*zero*/ - 1 /*sign*/ ) #define ISM_MAX_ELEVATION_DIFF_IDX ( ISM_ELEVATION_NBITS - 1 /*zero*/ - 1 /*sign*/ ) +#ifdef TD5 +#define ISM_MAX_RADIUS_DIFF_IDX ( ISM_RADIUS_NBITS - 1 /*zero*/ - 1 /*sign*/ ) +#endif // TD5 #define ISM_FEC_MAX 10 #define INTER_OBJECT_PARAM_CHECK ( ( ISM_FEC_MAX / 2 ) - 2 ) /* note: constant must be less than (ISM_FEC_MAX / number of coded parameters) */ +#ifdef TD5 +/*-----------------------------------------------------------------------* + * Local functions + *-----------------------------------------------------------------------*/ +static void encode_angle_indices( BSTR_ENC_HANDLE hBstr, ISM_METADATA_ANGLE_HANDLE angle, const int16_t last_ism_metadata_flag, const int16_t ini_frame, const int16_t idx_azimuth_abs, const int16_t idx_elevation_abs, int16_t *flag_abs_azimuth, int16_t *flag_abs_elevation ); +static void encode_radius( BSTR_ENC_HANDLE hBstr, ISM_METADATA_RADIUS_HANDLE radius_handle, const int16_t last_ism_metadata_flag, const int16_t idx_radius_abs, int16_t *flag_abs_radius ); + +#endif /*-------------------------------------------------------------------------* * set_ism_metadata() @@ -69,7 +80,14 @@ ivas_error set_ism_metadata( ISM_METADATA_HANDLE hIsmMeta, float azimuth, - float elevation ) + float elevation +#ifdef TD5 + , + float radius_meta, + float azimuth_orientation, + float elevation_orientation +#endif /* TD5 */ +) { if ( hIsmMeta == NULL ) { @@ -81,7 +99,12 @@ ivas_error set_ism_metadata( /* save read metadata parameters to the internal codec structure */ hIsmMeta->azimuth = azimuth; hIsmMeta->elevation = elevation; - + /* TD5 azimuth_orientation, elevation_orientation*/ +#ifdef TD5 + hIsmMeta->radius = radius_meta; + hIsmMeta->azimuth_orientation = azimuth_orientation; + hIsmMeta->elevation_orientation = elevation_orientation; +#endif /* TD5 */ return IVAS_ERR_OK; } @@ -157,8 +180,16 @@ ivas_error ivas_ism_metadata_enc( ) { int16_t i, ch, nb_bits_start = 0, diff; +#ifdef TD5 + int16_t idx_azimuth_abs = 0, flag_abs_azimuth[MAX_NUM_OBJECTS]; + int16_t idx_elevation_abs = 0, flag_abs_elevation[MAX_NUM_OBJECTS]; + int16_t flag_abs_azimuth_orientation[MAX_NUM_OBJECTS]; + int16_t idx_radius_abs = 0, flag_abs_radius[MAX_NUM_OBJECTS]; + int16_t encode_orientation_radius_flag; +#else int16_t idx_azimuth, idx_azimuth_abs = 0, flag_abs_azimuth[MAX_NUM_OBJECTS], nbits_diff_azimuth; int16_t idx_elevation, idx_elevation_abs = 0, flag_abs_elevation[MAX_NUM_OBJECTS], nbits_diff_elevation; +#endif float valQ; ISM_METADATA_HANDLE hIsmMetaData; int32_t element_brate[MAX_NUM_OBJECTS], total_brate[MAX_NUM_OBJECTS]; @@ -197,6 +228,19 @@ ivas_error ivas_ism_metadata_enc( set_s( nb_bits_metadata, 0, nchan_transport ); set_s( flag_abs_azimuth, 0, num_obj ); set_s( flag_abs_elevation, 0, num_obj ); +#ifdef TD5 + if ( ism_total_brate < IVAS_64k ) + { + encode_orientation_radius_flag = 0; + } + else + { + encode_orientation_radius_flag = 1; + } + set_s( flag_abs_azimuth_orientation, 0, num_obj ); + set_s( flag_abs_radius, 0, num_obj ); +#endif + /*----------------------------------------------------------------* * Set Metadata presence / importance flag @@ -215,8 +259,18 @@ ivas_error ivas_ism_metadata_enc( if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { /* send metadata even in inactive segments when noise is audible and metadata are changing */ +#ifdef TD5 + diff = (int16_t) fabsf( hIsmMeta[ch]->azimuth - ism_dequant_meta( hIsmMeta[ch]->angle[0].last_azimuth_idx, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ) ); + diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->elevation - ism_dequant_meta( hIsmMeta[ch]->angle[0].last_elevation_idx, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ) ) ); + if ( encode_orientation_radius_flag ) + { + diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->azimuth_orientation - ism_dequant_meta( hIsmMeta[ch]->angle[1].last_azimuth_idx, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ) ) ); + diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->elevation_orientation - ism_dequant_meta( hIsmMeta[ch]->angle[1].last_elevation_idx, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ) ) ); + } +#else diff = (int16_t) fabsf( hIsmMeta[ch]->azimuth - ism_dequant_meta( hIsmMeta[ch]->last_azimuth_idx, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ) ); diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->elevation - ism_dequant_meta( hIsmMeta[ch]->last_elevation_idx, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ) ) ); +#endif if ( hSCE[ch]->hCoreCoder[0]->lp_noise > 15 && diff >= 10 ) { @@ -317,6 +371,39 @@ ivas_error ivas_ism_metadata_enc( if ( hIsmMeta[ch]->ism_metadata_flag ) { + +#ifdef TD5 + /*----------------------------------------------------------------* + * Obtain quantizer indices for azimuth and elevation + *----------------------------------------------------------------*/ + if ( ism_mode == ISM_MODE_DISC ) + { + idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); + idx_elevation_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); + } + else /* ISM_MODE_PARAM */ + { + idx_azimuth_abs = hParamIsm->azi_index[ch]; + idx_elevation_abs = hParamIsm->ele_index[ch]; + } + + encode_angle_indices( hBstr, &( hIsmMetaData->angle[0] ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_azimuth_abs, idx_elevation_abs, &flag_abs_azimuth[ch], &flag_abs_elevation[ch] ); + + /* Encode orientation and radius, if above certain bit rate etc, discrete ISM */ + if ( ism_mode == ISM_MODE_DISC && encode_orientation_radius_flag ) + { + idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth_orientation, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); + idx_elevation_abs = ism_quant_meta( hIsmMetaData->elevation_orientation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); + idx_radius_abs = usquant( hIsmMetaData->radius, &valQ, ISM_RADIUS_MIN, ISM_RADIUS_DELTA, 1 << ISM_RADIUS_NBITS ); + encode_angle_indices( hBstr, &( hIsmMetaData->angle[1] ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_azimuth_abs, idx_elevation_abs, &flag_abs_azimuth_orientation[ch], &flag_abs_elevation[ch] ); + encode_radius( hBstr, &( hIsmMetaData->radius_handle ), hIsmMetaData->last_ism_metadata_flag, idx_radius_abs, &flag_abs_radius[ch] ); + } + /* save number of metadata bits written */ + if ( ism_mode == ISM_MODE_DISC ) + { + nb_bits_metadata[ch] = hBstr->nb_bits_tot - nb_bits_start; + } +#else /*----------------------------------------------------------------* * Azimuth quantization and encoding *----------------------------------------------------------------*/ @@ -561,6 +648,7 @@ ivas_error ivas_ism_metadata_enc( { nb_bits_metadata[ch] = hBstr->nb_bits_tot - nb_bits_start; } +#endif } } @@ -621,12 +709,20 @@ ivas_error ivas_ism_metadata_enc( if ( abs_next % ISM_NUM_PARAM == 0 ) { +#ifdef TD5 + hIsmMeta[ch]->angle[0].azimuth_diff_cnt = abs_num - 1; +#else hIsmMeta[ch]->azimuth_diff_cnt = abs_num - 1; +#endif } if ( abs_next % ISM_NUM_PARAM == 1 ) { +#ifdef TD5 + hIsmMeta[ch]->angle[0].elevation_diff_cnt = abs_num - 1; +#else hIsmMeta[ch]->elevation_diff_cnt = abs_num - 1; +#endif /*hIsmMeta[ch]->elevation_diff_cnt = min( hIsmMeta[ch]->elevation_diff_cnt, ISM_FEC_MAX );*/ } @@ -757,10 +853,24 @@ ivas_error create_ism_metadata_enc( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); } +#ifdef TD5 + st_ivas->hIsmMetaData[ch]->angle[0].last_azimuth_idx = 0; + st_ivas->hIsmMetaData[ch]->angle[0].azimuth_diff_cnt = ISM_FEC_MAX; + st_ivas->hIsmMetaData[ch]->angle[0].last_elevation_idx = 0; + st_ivas->hIsmMetaData[ch]->angle[0].elevation_diff_cnt = ISM_FEC_MAX - 1; + st_ivas->hIsmMetaData[ch]->radius_handle.last_radius_idx = 0; + st_ivas->hIsmMetaData[ch]->radius_handle.radius_diff_cnt = ISM_FEC_MAX - 2; + // To do TD5 --- + st_ivas->hIsmMetaData[ch]->angle[1].last_azimuth_idx = 0; + st_ivas->hIsmMetaData[ch]->angle[1].azimuth_diff_cnt = ISM_FEC_MAX - 2; + st_ivas->hIsmMetaData[ch]->angle[1].last_elevation_idx = 0; + st_ivas->hIsmMetaData[ch]->angle[1].elevation_diff_cnt = ISM_FEC_MAX - 2; +#else st_ivas->hIsmMetaData[ch]->last_azimuth_idx = 0; st_ivas->hIsmMetaData[ch]->azimuth_diff_cnt = ISM_FEC_MAX; st_ivas->hIsmMetaData[ch]->last_elevation_idx = 0; st_ivas->hIsmMetaData[ch]->elevation_diff_cnt = ISM_FEC_MAX - 1; +#endif st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0; ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); @@ -770,3 +880,345 @@ ivas_error create_ism_metadata_enc( return IVAS_ERR_OK; } + +#ifdef TD5 +static void encode_radius( + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + ISM_METADATA_RADIUS_HANDLE radius_handle, /* i/o: radius handle */ + const int16_t last_ism_metadata_flag, /* last frame ism_metadata_flag */ + const int16_t idx_radius_abs, /* i : Azimuth index */ + int16_t *flag_abs_radius /* o : Radius encoding mode */ +) +{ + int16_t idx_radius, nbits_diff_radius, diff; + + + /*----------------------------------------------------------------* + * Radius index encoding + *----------------------------------------------------------------*/ + idx_radius = idx_radius_abs; + + nbits_diff_radius = 0; + + *flag_abs_radius = 0; /* differential coding by default */ + + if ( radius_handle->radius_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ + || last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ + ) + { + *flag_abs_radius = 1; + } + + diff = idx_radius_abs - radius_handle->last_radius_idx; + + /* try differential coding */ + if ( *flag_abs_radius == 0 ) + { + if ( diff == 0 ) + { + idx_radius = 0; + nbits_diff_radius = 1; + } + else if ( ABSVAL( diff ) <= ISM_MAX_RADIUS_DIFF_IDX ) + { + idx_radius = 1 << 1; + nbits_diff_radius = 1; + + if ( diff < 0 ) + { + idx_radius += 1; /* negative sign */ + diff *= -1; + } + else + { + idx_radius += 0; /* positive sign */ + } + + idx_radius = idx_radius << diff; + nbits_diff_radius++; + + /* unary coding of "diff */ + idx_radius += ( ( 1 << diff ) - 1 ); + nbits_diff_radius += diff; + + if ( nbits_diff_radius < ISM_RADIUS_NBITS ) + { + /* add stop bit */ + idx_radius = idx_radius << 1; + nbits_diff_radius++; + } + } + else + { + *flag_abs_radius = 1; + } + } + + /* update counter */ + if ( *flag_abs_radius == 0 ) + { + radius_handle->radius_diff_cnt++; + radius_handle->radius_diff_cnt = min( radius_handle->radius_diff_cnt, ISM_FEC_MAX ); + } + else + { + radius_handle->radius_diff_cnt = 0; + } + + /* Write radius */ + push_indice( hBstr, IND_ISM_RADIUS_DIFF_FLAG, *flag_abs_radius, 1 ); + + if ( *flag_abs_radius ) + { + push_indice( hBstr, IND_ISM_RADIUS, idx_radius, ISM_RADIUS_NBITS ); + } + else + { + push_indice( hBstr, IND_ISM_RADIUS, idx_radius, nbits_diff_radius ); + } + + /*----------------------------------------------------------------* + * Updates + *----------------------------------------------------------------*/ + radius_handle->last_radius_idx = idx_radius_abs; + return; +} + +static void encode_angle_indices( + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + ISM_METADATA_ANGLE_HANDLE angle, /* i/o: angle handle */ + const int16_t last_ism_metadata_flag, /* last frame ism_metadata_flag */ + const int16_t ini_frame, /* i : initialization frames counter */ + const int16_t idx_azimuth_abs, /* i : Azimuth index */ + const int16_t idx_elevation_abs, /* i : Elevation index */ + int16_t *flag_abs_azimuth, /* o : Azimuth encoding mode */ + int16_t *flag_abs_elevation /* o : Elevation encoding mode */ +) +{ + int16_t idx_azimuth, nbits_diff_azimuth, diff; + int16_t idx_elevation, nbits_diff_elevation; + + + /*----------------------------------------------------------------* + * Azimuth index encoding + *----------------------------------------------------------------*/ + + idx_azimuth = idx_azimuth_abs; + + nbits_diff_azimuth = 0; + + *flag_abs_azimuth = 0; /* differential coding by default */ + if ( angle->azimuth_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ + || last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ + ) + { + *flag_abs_azimuth = 1; + } + + /* try differential coding */ + if ( *flag_abs_azimuth == 0 ) + { + diff = idx_azimuth_abs - angle->last_azimuth_idx; + + /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ + if ( abs( diff ) > ( ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - ISM_MAX_AZIMUTH_DIFF_IDX ) + { + if ( diff > 0 ) + { + diff -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; + } + else + { + diff += ( 1 << ISM_AZIMUTH_NBITS ) - 1; + } + } + + if ( diff == 0 ) + { + idx_azimuth = 0; + nbits_diff_azimuth = 1; + } + else if ( ABSVAL( diff ) < ISM_MAX_AZIMUTH_DIFF_IDX ) /* when diff bits >= abs bits, prefer abs */ + { + idx_azimuth = 1 << 1; + nbits_diff_azimuth = 1; + + if ( diff < 0 ) + { + idx_azimuth += 1; /* negative sign */ + diff *= -1; + } + else + { + idx_azimuth += 0; /* positive sign */ + } + + idx_azimuth = idx_azimuth << diff; + nbits_diff_azimuth++; + + /* unary coding of "diff */ + idx_azimuth += ( ( 1 << diff ) - 1 ); + nbits_diff_azimuth += diff; + + if ( nbits_diff_azimuth < ISM_AZIMUTH_NBITS - 1 ) + { + /* add stop bit - only for codewords shorter than ISM_AZIMUTH_NBITS */ + idx_azimuth = idx_azimuth << 1; + nbits_diff_azimuth++; + } + } + else + { + *flag_abs_azimuth = 1; + } + } + + /* update counter */ + if ( *flag_abs_azimuth == 0 ) + { + angle->azimuth_diff_cnt++; + angle->elevation_diff_cnt = min( angle->elevation_diff_cnt, ISM_FEC_MAX ); + } + else + { + angle->azimuth_diff_cnt = 0; + } + + /* Write azimuth */ + push_indice( hBstr, IND_ISM_AZIMUTH_DIFF_FLAG, *flag_abs_azimuth, 1 ); + + if ( *flag_abs_azimuth ) + { + push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, ISM_AZIMUTH_NBITS ); + } + else + { + push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, nbits_diff_azimuth ); + } + + /*----------------------------------------------------------------* + * Elevation index encoding + *----------------------------------------------------------------*/ + idx_elevation = idx_elevation_abs; + + nbits_diff_elevation = 0; + + *flag_abs_elevation = 0; /* differential coding by default */ + if ( angle->elevation_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ + || last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ + ) + { + *flag_abs_elevation = 1; + } + + /* note: elevation is coded starting from the second frame only (it is meaningless in the init_frame) */ + if ( ini_frame == 0 ) + { + *flag_abs_elevation = 1; + angle->last_elevation_idx = idx_elevation_abs; + } + + diff = idx_elevation_abs - angle->last_elevation_idx; + + /* avoid absolute coding of elevation if absolute coding was already used for azimuth */ + if ( *flag_abs_azimuth == 1 ) + { + int16_t diff_orig = diff; + + *flag_abs_elevation = 0; + + + if ( diff >= 0 ) + { + diff = min( diff, ISM_MAX_ELEVATION_DIFF_IDX ); + } + else + { + diff = -1 * min( -diff, ISM_MAX_ELEVATION_DIFF_IDX ); + } + + if ( last_ism_metadata_flag == 0 || abs( diff_orig - diff ) > ISM_MAX_ELEVATION_DIFF_IDX ) + { + angle->elevation_diff_cnt = ISM_FEC_MAX - 1; + } + } + + /* try differential coding */ + if ( *flag_abs_elevation == 0 ) + { + if ( diff == 0 ) + { + idx_elevation = 0; + nbits_diff_elevation = 1; + } + else if ( ABSVAL( diff ) <= ISM_MAX_ELEVATION_DIFF_IDX ) + { + idx_elevation = 1 << 1; + nbits_diff_elevation = 1; + + if ( diff < 0 ) + { + idx_elevation += 1; /* negative sign */ + diff *= -1; + } + else + { + idx_elevation += 0; /* positive sign */ + } + + idx_elevation = idx_elevation << diff; + nbits_diff_elevation++; + + /* unary coding of "diff */ + idx_elevation += ( ( 1 << diff ) - 1 ); + nbits_diff_elevation += diff; + + if ( nbits_diff_elevation < ISM_ELEVATION_NBITS ) + { + /* add stop bit */ + idx_elevation = idx_elevation << 1; + nbits_diff_elevation++; + } + } + else + { + *flag_abs_elevation = 1; + } + } + + /* update counter */ + if ( *flag_abs_elevation == 0 ) + { + angle->elevation_diff_cnt++; + angle->elevation_diff_cnt = min( angle->elevation_diff_cnt, ISM_FEC_MAX ); + } + else + { + angle->elevation_diff_cnt = 0; + } + + /* Write elevation */ + if ( *flag_abs_azimuth == 0 ) /* do not write "flag_abs_elevation" if "flag_abs_azimuth == 1" */ + { + push_indice( hBstr, IND_ISM_ELEVATION_DIFF_FLAG, *flag_abs_elevation, 1 ); + } + + if ( *flag_abs_elevation ) + { + push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, ISM_ELEVATION_NBITS ); + } + else + { + push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, nbits_diff_elevation ); + } + + /*----------------------------------------------------------------* + * Updates + *----------------------------------------------------------------*/ + + angle->last_azimuth_idx = idx_azimuth_abs; + angle->last_elevation_idx = idx_elevation_abs; + + return; +} +#endif diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 4cd70f61fc..f1ed1a9431 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -425,8 +425,12 @@ ivas_error IVAS_ENC_FeedObjectMetadata( { return IVAS_ERR_INDEX_OUT_OF_BOUNDS; } - + /* TD5 azimuth_orientation, elevation_orientation*/ +#ifdef TD5 + error = set_ism_metadata( hIvasEnc->st_ivas->hIsmMetaData[ismIndex], metadata.azimuth, metadata.elevation, metadata.radius, metadata.azimuth_orientation, metadata.elevation_orientation ); +#else error = set_ism_metadata( hIvasEnc->st_ivas->hIsmMetaData[ismIndex], metadata.azimuth, metadata.elevation ); +#endif /*TD5 */ if ( error != IVAS_ERR_OK ) { return error; diff --git a/lib_rend/ivas_lib_rend_internal.h b/lib_rend/ivas_lib_rend_internal.h index 3d784d9bb3..b7e34271de 100644 --- a/lib_rend/ivas_lib_rend_internal.h +++ b/lib_rend/ivas_lib_rend_internal.h @@ -46,6 +46,9 @@ typedef struct { int8_t headRotEnabled; IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; +#ifdef TD5 + float Pos[RENDERER_HEAD_POSITIONS_PER_FRAME][3]; +#endif float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; } IVAS_REND_HeadRotData; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 10617d3c62..56605794ec 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -53,13 +53,21 @@ static void TDREND_Clear_Update_flags( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRe static void TDREND_Update_listener_orientation( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, const int16_t headRotEnabled, +#ifdef TD5 + const IVAS_QUATERNION *headPosition, + const float *Pos ); +#else const IVAS_QUATERNION *headPosition ); +#endif static void TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, const int16_t numSources, const int16_t lfe_idx, const IVAS_FORMAT in_format, const ISM_METADATA_HANDLE *hIsmMetaData, float output[][L_FRAME48k] ); +#ifdef TD5 +static void angles_to_vec( const float radius, const float azimuth, const float elevation, float *vec ); +#endif /*---------------------------------------------------------------------* * ivas_td_binaural_open() @@ -168,9 +176,13 @@ ivas_error ivas_td_binaural_open( for ( nS = 0; nS < nchan_rend; nS++ ) { /* Set source positions according to loudspeaker layout */ +#ifdef TD5 + angles_to_vec( 1.0f, ls_azimuth[nS], ls_elevation[nS], Pos ); +#else Pos[0] = cosf( ls_elevation[nS] * PI_OVER_180 ) * cosf( ls_azimuth[nS] * PI_OVER_180 ); Pos[1] = cosf( ls_elevation[nS] * PI_OVER_180 ) * sinf( ls_azimuth[nS] * PI_OVER_180 ); Pos[2] = sinf( ls_elevation[nS] * PI_OVER_180 ); +#endif Dir[0] = 1.0f; Dir[1] = 0.0f; Dir[2] = 0.0f; @@ -186,6 +198,20 @@ ivas_error ivas_td_binaural_open( TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ); } } +#ifdef TD5 + if ( st_ivas->ivas_format == ISM_FORMAT ) + { + DirAtten_p = hBinRendererTd->DirAtten_p; + DirAtten_p->ConeInnerAngle = st_ivas->hRenderConfig->directivity[0]; + DirAtten_p->ConeOuterAngle = st_ivas->hRenderConfig->directivity[1]; + DirAtten_p->ConeOuterGain = st_ivas->hRenderConfig->directivity[2]; + + for ( nS = 0; nS < nchan_rend; nS++ ) + { + TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ); + } + } +#endif st_ivas->hBinRendererTd = hBinRendererTd; @@ -261,7 +287,12 @@ void ObjRenderIVASFrame( /* Update the listener's location/orientation */ TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, st_ivas->hDecoderConfig->Opt_Headrotation, +#ifdef TD5 + ( st_ivas->hHeadTrackData != NULL ) ? &st_ivas->hHeadTrackData->Quaternions[subframe_idx] : NULL, + ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos[subframe_idx] : NULL ); +#else ( st_ivas->hHeadTrackData != NULL ) ? &st_ivas->hHeadTrackData->Quaternions[subframe_idx] : NULL ); +#endif if ( ( st_ivas->hRenderConfig != NULL ) && ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) ) { @@ -416,17 +447,24 @@ static void TDREND_Update_object_positions( /* Update the source positions */ /* Source position and direction */ +#ifdef TD5 + angles_to_vec( hIsmMetaData[nS]->radius, hIsmMetaData[nS]->azimuth, hIsmMetaData[nS]->elevation, Pos ); + angles_to_vec( 1.0f, hIsmMetaData[nS]->azimuth_orientation, hIsmMetaData[nS]->elevation_orientation, Dir ); +#else Pos[0] = cosf( hIsmMetaData[nS]->elevation * PI_OVER_180 ) * cosf( hIsmMetaData[nS]->azimuth * PI_OVER_180 ); Pos[1] = cosf( hIsmMetaData[nS]->elevation * PI_OVER_180 ) * sinf( hIsmMetaData[nS]->azimuth * PI_OVER_180 ); Pos[2] = sinf( hIsmMetaData[nS]->elevation * PI_OVER_180 ); Dir[0] = 1.0f; Dir[1] = 0.0f; Dir[2] = 0.0f; +#endif +#ifndef TD5 /* Source directivity info */ DirAtten_p->ConeInnerAngle = 360.0f; DirAtten_p->ConeOuterAngle = 360.0f; DirAtten_p->ConeOuterGain = 1.0f; +#endif TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ); @@ -448,19 +486,30 @@ static void TDREND_Update_object_positions( static void TDREND_Update_listener_orientation( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const int16_t headRotEnabled, /* i : Headrotation flag */ - const IVAS_QUATERNION *headPosition /* i : Head Position */ +#ifdef TD5 + const IVAS_QUATERNION *headPosition, /* i : Listener orientation */ + const float *Pos /* i : Listener position */ +#else + const IVAS_QUATERNION *headPosition /* i : Head Position */ +#endif ) { +#ifdef TD5 + float Pos_p[3]; +#else float Pos[3]; +#endif float FrontVec[3]; float UpVec[3]; float Rmat[3][3]; /* Update the listener's location/orientation */ +#ifndef TD5 /* Listener at the origin */ Pos[0] = 0.0f; Pos[1] = 0.0f; Pos[2] = 0.0f; +#endif if ( headRotEnabled ) { @@ -474,6 +523,12 @@ static void TDREND_Update_listener_orientation( UpVec[0] = Rmat[2][0]; UpVec[1] = Rmat[2][1]; UpVec[2] = Rmat[2][2]; +#ifdef TD5 + /* Input position */ + Pos_p[0] = Pos[0]; + Pos_p[1] = Pos[1]; + Pos_p[2] = Pos[2]; +#endif } else { @@ -485,10 +540,20 @@ static void TDREND_Update_listener_orientation( UpVec[0] = 0.0f; UpVec[1] = 0.0f; UpVec[2] = 1.0f; +#ifdef TD5 + /* Listener at the origin */ + Pos_p[0] = 0.0f; + Pos_p[1] = 0.0f; + Pos_p[2] = 0.0f; +#endif } /* Set the listener position and orientation:*/ +#ifdef TD5 + TDREND_MIX_LIST_SetPos( hBinRendererTd, Pos_p ); +#else TDREND_MIX_LIST_SetPos( hBinRendererTd, Pos ); +#endif TDREND_MIX_LIST_SetOrient( hBinRendererTd, FrontVec, UpVec ); return; @@ -609,9 +674,13 @@ ivas_error ivas_rend_TDObjRendOpen( for ( nS = 0; nS < nchan_rend; nS++ ) { /* Set source positions according to loudspeaker layout */ +#ifdef TD5 + angles_to_vec( 1.0f, ls_azimuth[nS], ls_elevation[nS], Pos ); +#else Pos[0] = cosf( ls_elevation[nS] * PI_OVER_180 ) * cosf( ls_azimuth[nS] * PI_OVER_180 ); Pos[1] = cosf( ls_elevation[nS] * PI_OVER_180 ) * sinf( ls_azimuth[nS] * PI_OVER_180 ); Pos[2] = sinf( ls_elevation[nS] * PI_OVER_180 ); +#endif Dir[0] = 1.0f; Dir[1] = 0.0f; Dir[2] = 0.0f; @@ -712,7 +781,11 @@ ivas_error ivas_rend_TDObjRenderFrame( for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { /* Update the listener's location/orientation */ +#ifdef TD5 + TDREND_Update_listener_orientation( pTDRend->hBinRendererTd, headRotData->headRotEnabled, ( headRotData != NULL ) ? &headRotData->headPositions[subframe_idx] : NULL, ( headRotData != NULL ) ? headRotData->Pos[subframe_idx] : NULL ); +#else TDREND_Update_listener_orientation( pTDRend->hBinRendererTd, headRotData->headRotEnabled, ( headRotData != NULL ) ? &headRotData->headPositions[subframe_idx] : NULL ); +#endif /* TODO tmu : pass down renderer config struct */ // if ( ( hRenderConfig != NULL ) && ( hRenderConfig->roomAcoustics.late_reverb_on ) ) @@ -739,3 +812,25 @@ ivas_error ivas_rend_TDObjRenderFrame( return IVAS_ERR_OK; } + +#ifdef TD5 +/*---------------------------------------------------------------------* + * angles_to_vec() + * + * Convert azimuth and elevation angles to position/orientation vector + *---------------------------------------------------------------------*/ + +static void angles_to_vec( + const float radius, /* i : radius */ + const float azimuth, /* i : Azimuth angle */ + const float elevation, /* i : Elevation angle */ + float *vec /* o : Pos/Dir vector */ +) +{ + vec[0] = radius * cosf( elevation * PI_OVER_180 ) * cosf( azimuth * PI_OVER_180 ); + vec[1] = radius * cosf( elevation * PI_OVER_180 ) * sinf( azimuth * PI_OVER_180 ); + vec[2] = radius * sinf( elevation * PI_OVER_180 ); + + return; +} +#endif diff --git a/lib_rend/ivas_objectRenderer_hrFilt.c b/lib_rend/ivas_objectRenderer_hrFilt.c index f71ae77a13..b9083b6d8a 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt.c +++ b/lib_rend/ivas_objectRenderer_hrFilt.c @@ -353,10 +353,21 @@ ivas_error TDREND_REND_RenderSourceHRFilt( { float LeftOutputFrame[L_SPATIAL_SUBFR_48k]; float RightOutputFrame[L_SPATIAL_SUBFR_48k]; +#ifdef TD5 + float Gain; + + Gain = ( *Src_p->SrcRend_p->DirGain_p ) * ( *Src_p->SrcRend_p->DistGain_p ); +#endif TDREND_Apply_ITD( Src_p->InputFrame_p, LeftOutputFrame, RightOutputFrame, &Src_p->previtd, Src_p->itd, Src_p->mem_itd, subframe_length ); +#ifdef TD5 + TDREND_firfilt( LeftOutputFrame, Src_p->hrf_left_prev, hrf_left_delta, intp_count, Src_p->mem_hrf_left, subframe_length, Src_p->filterlength, Gain ); + TDREND_firfilt( RightOutputFrame, Src_p->hrf_right_prev, hrf_right_delta, intp_count, Src_p->mem_hrf_right, subframe_length, Src_p->filterlength, Gain ); +#else TDREND_firfilt( LeftOutputFrame, Src_p->hrf_left_prev, hrf_left_delta, intp_count, Src_p->mem_hrf_left, subframe_length, Src_p->filterlength ); TDREND_firfilt( RightOutputFrame, Src_p->hrf_right_prev, hrf_right_delta, intp_count, Src_p->mem_hrf_right, subframe_length, Src_p->filterlength ); +#endif + /* Copy to accumulative output frame */ v_add( LeftOutputFrame, output_buf[0], output_buf[0], subframe_length ); v_add( RightOutputFrame, output_buf[1], output_buf[1], subframe_length ); diff --git a/lib_rend/ivas_objectRenderer_sfx.c b/lib_rend/ivas_objectRenderer_sfx.c index 11b9893800..a17fc0b7ef 100644 --- a/lib_rend/ivas_objectRenderer_sfx.c +++ b/lib_rend/ivas_objectRenderer_sfx.c @@ -233,7 +233,12 @@ void TDREND_firfilt( const int16_t intp_count, /* i : interpolation count */ float *mem, /* i/o: filter memory */ const int16_t subframe_length, /* i : Length of signal */ - const int16_t filterlength /* i : Filter length */ +#ifdef TD5 + const int16_t filterlength, /* i : Filter length */ + const float Gain /* i : Gain */ +#else + const int16_t filterlength /* i : Filter length */ +#endif ) { float buffer[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 + L_SUBFRAME5MS_48k]; @@ -259,7 +264,11 @@ void TDREND_firfilt( { tmp += ( *p_filter++ ) * ( *p_tmp-- ); } +#ifdef TD5 + signal[i] = tmp * Gain; +#else signal[i] = tmp; +#endif if ( i < intp_count ) { diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 1c29e58bc3..d592536c15 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -261,6 +261,9 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( TDREND_MIX_Listener_t *Listener_p; TDREND_HRFILT_FiltSet_t *HrFiltSet_p; float ListRelPos[3], ListRelDist; +#ifdef TD5 + float ListRelPosAbs[3]; /* Relative position, ignoring orientation of listener */ +#endif float Azim, Elev; float hrf_left[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; float hrf_right[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; @@ -282,19 +285,26 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( break; case TDREND_POSTYPE_ABSOLUTE: /* Absolute position */ +#ifdef TD5 + TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos, ListRelPosAbs ); +#else TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos ); +#endif break; default: /* Illegal position type */ #ifdef DEBUGGING printf( "Warning! TDREND_SRC_REND_UpdateFiltersFromSpatialParams: Invalid position type. Assuming absolute position!\n" ); #endif /* Assume absolute position */ +#ifdef TD5 + TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos, ListRelPosAbs ); +#else TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos ); +#endif // TD5 break; } ListRelDist = TDREND_SPATIAL_VecNorm( ListRelPos ); - /* 2. Evaluate the Elevation and Azimuth angles */ if ( ( ListRelPos[0] == 0 ) && ( ListRelPos[1] == 0 ) && ( ListRelPos[2] == 0 ) ) { @@ -315,7 +325,11 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( *SrcRend_p->DirGain_p = 1.0f; if ( SrcSpatial_p->DirAttenEnabled ) { - *SrcRend_p->DirGain_p = TDREND_SRC_SPATIAL_GetDirGain( &SrcSpatial_p->DirAtten, SrcSpatial_p->Front_p, ListRelPos ); +#ifdef TD5 + *SrcRend_p->DirGain_p = TDREND_SRC_SPATIAL_GetDirGain(&SrcSpatial_p->DirAtten, SrcSpatial_p->Front_p, ListRelPosAbs); +#else + *SrcRend_p->DirGain_p = TDREND_SRC_SPATIAL_GetDirGain(&SrcSpatial_p->DirAtten, SrcSpatial_p->Front_p, ListRelPos); +#endif // TD5 } /* Distance gain */ diff --git a/lib_rend/ivas_objectRenderer_vec.c b/lib_rend/ivas_objectRenderer_vec.c index 17f5f229d1..e266107181 100644 --- a/lib_rend/ivas_objectRenderer_vec.c +++ b/lib_rend/ivas_objectRenderer_vec.c @@ -111,19 +111,29 @@ void TDREND_SPATIAL_VecMapToNewCoordSystem( const float *UpVec_p, /* i : Up vector */ const float *RightVec_p, /* i : Right vector */ float *MappedVec_p /* o : Transformed vector */ +#ifdef TD5 + , + float *LisRelPosAbs /* o : Transformed vector without orientation */ +#endif // TD5 ) { +#ifdef TD5 + v_sub(Vec_p, TranslVec_p, LisRelPosAbs, 3); + /* Evalute the relative Vec in the coordinates of the Orientation vectors, */ +/* which form an orthonormal basis */ + MappedVec_p[0] = dotp(LisRelPosAbs, DirVec_p, 3); + MappedVec_p[1] = dotp(LisRelPosAbs, RightVec_p, 3); + MappedVec_p[2] = dotp(LisRelPosAbs, UpVec_p, 3); +#else float RelVec[3]; - /* Evaluate Vec relative to the new origin given by TranslVec */ v_sub( Vec_p, TranslVec_p, RelVec, 3 ); - /* Evalute the relative Vec in the coordinates of the Orientation vectors, */ - /* which form an orthonormal basis */ - MappedVec_p[0] = dotp( RelVec, DirVec_p, 3 ); - MappedVec_p[1] = dotp( RelVec, RightVec_p, 3 ); - MappedVec_p[2] = dotp( RelVec, UpVec_p, 3 ); - +/* which form an orthonormal basis */ + MappedVec_p[0] = dotp(RelVec, DirVec_p, 3); + MappedVec_p[1] = dotp(RelVec, RightVec_p, 3); + MappedVec_p[2] = dotp(RelVec, UpVec_p, 3); +#endif // TD5 return; } diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index 0e9e089b93..6d72372e01 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -104,6 +104,7 @@ ivas_error ivas_render_config_init_from_rom( const int16_t room_flag_on /* i : room effect on/off flag */ ) { + if ( hRenderConfig == NULL || *hRenderConfig == NULL ) { return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Unexpected null pointer while attempting to fill renderer configuration from ROM" ); @@ -126,5 +127,11 @@ ivas_error ivas_render_config_init_from_rom( mvr2r( ivas_reverb_default_RT60, ( *hRenderConfig )->roomAcoustics.pAcoustic_rt60, IVAS_REVERB_DEFAULT_N_BANDS ); mvr2r( ivas_reverb_default_DSR, ( *hRenderConfig )->roomAcoustics.pAcoustic_dsr, IVAS_REVERB_DEFAULT_N_BANDS ); +#ifdef TD5 + ( *hRenderConfig )->directivity[0] = 360.0f; /* Front cone */ + ( *hRenderConfig )->directivity[1] = 360.0f; /* Back cone */ + ( *hRenderConfig )->directivity[2] = 1.0f; /* Back attenuation */ +#endif + return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index b710202ce3..9d0140065d 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -145,6 +145,9 @@ typedef struct { int8_t headRotEnabled; IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; +#ifdef TD5 + float Pos[RENDERER_HEAD_POSITIONS_PER_FRAME][3]; +#endif float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; } IVAS_REND_HeadRotData; @@ -468,6 +471,9 @@ typedef struct ivas_binaural_head_track_struct { int16_t num_quaternions; IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; +#ifdef TD5 + float Pos[MAX_PARAM_SPATIAL_SUBFRAMES][3]; +#endif float Rmat[3][3]; float Rmat_prev[3][3]; @@ -502,7 +508,9 @@ typedef struct ivas_render_config_t ivas_renderTypeOverride renderer_type_override; #endif ivas_roomAcoustics_t roomAcoustics; - +#ifdef TD5 + float directivity[3]; // Todo: Replace with constant +#endif } RENDER_CONFIG_DATA, *RENDER_CONFIG_HANDLE; diff --git a/lib_util/head_rotation_file_reader.c b/lib_util/head_rotation_file_reader.c index cd1dd7bcf3..0823ce5f15 100644 --- a/lib_util/head_rotation_file_reader.c +++ b/lib_util/head_rotation_file_reader.c @@ -94,22 +94,38 @@ ivas_error HeadRotationFileReader_open( ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ - IVAS_QUATERNION *Quaternions, /* o : head-tracking data */ - const int32_t frame_dec /* i : decoded frame number */ +#ifdef TD5 + IVAS_QUATERNION *Quaternions, /* o : listener orientation */ + float Pos[4][3] /* o : listener position */ +#else + IVAS_QUATERNION *Quaternions, /* o : head-tracking data */ + const int32_t frame_dec /* i : decoded frame number */ +#endif ) { uint16_t i; float w, x, y, z; +#ifdef TD5 + float posx, posy, posz; +#endif for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { +#ifdef TD5 + if ( 7 != fscanf( headRotReader->trajFile, "%f,%f,%f,%f,%f,%f,%f", &w, &x, &y, &z, &posx, &posy, &posz ) ) +#else if ( 4 != fscanf( headRotReader->trajFile, "%f,%f,%f,%f", &w, &x, &y, &z ) ) +#endif { if ( feof( headRotReader->trajFile ) ) { rewind( headRotReader->trajFile ); headRotReader->fileRewind = true; +#ifdef TD5 + return HeadRotationFileReading( headRotReader, Quaternions, Pos ); +#else return HeadRotationFileReading( headRotReader, Quaternions, frame_dec ); +#endif } return IVAS_ERR_FAILED_FILE_PARSE; } @@ -121,6 +137,11 @@ ivas_error HeadRotationFileReading( Quaternions[i].x = x; Quaternions[i].y = y; Quaternions[i].z = z; +#ifdef TD5 + Pos[i][0] = posx; + Pos[i][1] = posy; + Pos[i][2] = posz; +#endif } return IVAS_ERR_OK; diff --git a/lib_util/head_rotation_file_reader.h b/lib_util/head_rotation_file_reader.h index 6664908b00..4c6a2212dc 100644 --- a/lib_util/head_rotation_file_reader.h +++ b/lib_util/head_rotation_file_reader.h @@ -60,8 +60,13 @@ ivas_error HeadRotationFileReader_open( ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ - IVAS_QUATERNION *Quaternions, /* o : head-tracking data */ - const int32_t frame_dec /* i : decoded frame number */ +#ifdef TD5 + IVAS_QUATERNION *Quaternions, /* o : listener orientation */ + float Pos[4][3] /* o : listener position */ +#else + IVAS_QUATERNION *Quaternions, /* o : head-tracking data */ + const int32_t frame_dec /* i : decoded frame number */ +#endif ); /*-----------------------------------------------------------------------* diff --git a/lib_util/ism_file_reader.c b/lib_util/ism_file_reader.c index b511b30499..7ffa227739 100644 --- a/lib_util/ism_file_reader.c +++ b/lib_util/ism_file_reader.c @@ -37,8 +37,12 @@ #include -#define META_LINE_LENGTH 200 /* max number of characters at one line of metadata input/output file */ -#define NUM_ISM_METADATA_PER_LINE 5 /* Number of ISM metadata per line in a metadata file */ +#define META_LINE_LENGTH 200 /* max number of characters at one line of metadata input/output file */ +#ifdef TD5 +#define NUM_ISM_METADATA_PER_LINE 7 /* Number of ISM metadata per line in a metadata file */ +#else +#define NUM_ISM_METADATA_PER_LINE 5 /* Number of ISM metadata per line in a metadata file */ +#endif struct IsmFileReader @@ -146,6 +150,11 @@ ivas_error IsmFileReader_readNextFrame( ismMetadata->radius = meta_prm[2]; ismMetadata->spread = meta_prm[3]; ismMetadata->gainFactor = meta_prm[4]; +#ifdef TD5 + /* Add azimuth/elevation for orientation here */ + ismMetadata->azimuth_orientation = meta_prm[5]; + ismMetadata->elevation_orientation = meta_prm[6]; +#endif /* verify whether the read metadata values are in an expected range */ if ( ismMetadata->azimuth > 180 || ismMetadata->azimuth < -180 ) @@ -172,6 +181,18 @@ ivas_error IsmFileReader_readNextFrame( { return IVAS_ERR_ISM_INVALID_METADATA_VALUE; } +#ifdef TD5 + /* TO DO TD5 Verify azimuth/elevation_orientation */ + if ( ismMetadata->azimuth_orientation > 180 || ismMetadata->azimuth_orientation < -180 ) + { + return IVAS_ERR_ISM_INVALID_METADATA_VALUE; + } + + if ( ismMetadata->elevation_orientation > 90 || ismMetadata->elevation_orientation < -90 ) + { + return IVAS_ERR_ISM_INVALID_METADATA_VALUE; + } +#endif // TD5 return IVAS_ERR_OK; } diff --git a/lib_util/ism_file_writer.c b/lib_util/ism_file_writer.c index e0a910d5db..b203bdf63c 100644 --- a/lib_util/ism_file_writer.c +++ b/lib_util/ism_file_writer.c @@ -36,8 +36,12 @@ #include -#define META_LINE_LENGTH 200 /* max number of characters at one line of metadata input/output file */ -#define NUM_ISM_METADATA_PER_LINE 5 /* Number of ISM metadata per line in a metadata file */ +#define META_LINE_LENGTH 200 /* max number of characters at one line of metadata input/output file */ +#ifdef TD5 +#define NUM_ISM_METADATA_PER_LINE 7 /* Number of ISM metadata per line in a metadata file */ +#else +#define NUM_ISM_METADATA_PER_LINE 5 /* Number of ISM metadata per line in a metadata file */ +#endif struct IsmFileWriter @@ -121,9 +125,16 @@ ivas_error IsmFileWriter_writeFrame( /* IVAS_fmToDo: work in progress; currently position_azimuth, position_elevation, position_radius, spread, gain_factor */ #ifdef FIX_293_EXT_RENDERER_CLI - snprintf( char_buff, sizeof( char_buff ), "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor ); +#ifdef TD5 + snprintf( char_buff, sizeof( char_buff ), "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f,%+07.2f,%+06.2f\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor, ismMetadata.azimuth_orientation, ismMetadata.elevation_orientation ); #else - sprintf( char_buff, "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor ); + snprintf( char_buff, sizeof( char_buff ), "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor ); +#endif +#ifdef TD5 + sprintf( char_buff, "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f,%+07.2f,%+06.2f\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor, ismMetadata.azimuth_orientation, ismMetadata.elevation_orientation ); +#else + sprintf( char_buff, "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor ); +#endif #endif if ( file ) diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 27eed3bf14..5209dd58b1 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -523,6 +523,15 @@ ivas_error RenderConfigReader_read( errorHandler( pValue, ERROR_VALUE_INVALID ); } } +#ifdef TD5 + else if ( strcmp( item, "DIRECTIVITY" ) == 0 ) + { + if ( read_vector( pValue, 3, hRenderConfig->directivity ) ) + { + errorHandler( item, ERROR_VALUE_INVALID ); + } + } +#endif #ifdef DEBUGGING else { -- GitLab From 6ff99c0f2ac1c8fbdb13d7b6728c72ca9b6800f1 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Fri, 27 Jan 2023 02:26:12 +0100 Subject: [PATCH 047/375] Merge remote-tracking branch 'origin/main' into 109-orientation-tracking-modes --- lib_com/options.h | 2 +- lib_rend/ivas_crend.c | 2 ++ lib_rend/ivas_stat_rend.h | 40 ++++++++++++++++++++++++++++++++------- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 182a58c5c3..8dfd881ed9 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,7 +159,7 @@ #define HRTF_BINARY_FILE /* HRTF filters' binary file used for binaural rendering. */ #define LOW_RATE_TRANS_FIX /* Eri: Fix for critical item during transitions */ -//#define FIX_197_CREND_INTERFACE +#define FIX_197_CREND_INTERFACE #define SET_TNS_FLAG_IN_EVERY_FRAME /* FhG: issue 288 - mismatch between encoder and decoder wrt TNS usage in unified stereo with frameloss */ #define FIX_FOR_TEST /* allows tests to pass using old TD binary file, to be removed after merge*/ #define FIX_299_ISM_BWS /* VA: issue 299 - fix Band-width switching issues in ISM format */ diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 56bfbb10b3..bce35f2b20 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -2584,6 +2584,7 @@ ivas_error ivas_rend_crendProcess( if ( hDecoderConfig && hDecoderConfig->Opt_Headrotation && hHeadTrackData && hHeadTrackData->num_quaternions >= 0 ) { /* Orientation tracking */ +#ifndef FIX_I109_ORIENTATION_TRACKING if ( pCrend->hCrend->hTrack != NULL ) { if ( hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_AVG ) @@ -2615,6 +2616,7 @@ ivas_error ivas_rend_crendProcess( { rotateFrame_sd( hHeadTrackData, output, subframe_len, *hIntSetup, hEFAPdata, subframe_idx ); } +#endif } #endif diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index bb060f5308..cba12394bb 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -141,12 +141,6 @@ typedef struct float lfeOutputGains[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; } IVAS_REND_LfeRouting; -typedef struct -{ - int8_t headRotEnabled; - IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; - float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; -} IVAS_REND_HeadRotData; /*----------------------------------------------------------------------------------* * Binaural Rendering structure @@ -464,6 +458,23 @@ typedef struct ivas_binaural_rendering_struct *----------------------------------------------------------------------------------*/ // VE2AT: move to ivas_rom_rend.h ? +#ifdef FIX_I109_ORIENTATION_TRACKING +/* Orientation tracking structure */ +typedef struct ivas_orient_trk_state_t +{ + OTR_TRACKING_T trackingType; + float centerAdaptationRate; + float offCenterAdaptationRate; + float adaptationAngle; + + float alpha; + IVAS_QUATERNION absAvgRot; /* average absolute orientation */ + IVAS_QUATERNION refRot; /* reference orientation */ + IVAS_QUATERNION trkRot; /* tracked rotation */ + +} ivas_orient_trk_state_t; +#endif + typedef struct ivas_binaural_head_track_struct { int16_t num_quaternions; @@ -476,9 +487,23 @@ typedef struct ivas_binaural_head_track_struct float lrSwitchInterpVal; int16_t shd_rot_max_order; +#ifdef FIX_I109_ORIENTATION_TRACKING + ivas_orient_trk_state_t *OrientationTracker; +#endif } HEAD_TRACK_DATA, *HEAD_TRACK_DATA_HANDLE; +typedef struct +{ + int8_t headRotEnabled; + IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; + float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; +#ifdef FIX_I109_ORIENTATION_TRACKING + ivas_orient_trk_state_t *hOrientationTracker; +#endif +} IVAS_REND_HeadRotData; + + /* Reverberator structures */ @@ -585,6 +610,7 @@ typedef struct ivas_reverb_state_t } REVERB_DATA, *REVERB_HANDLE; +#ifndef FIX_I109_ORIENTATION_TRACKING typedef struct ivas_orient_trk_state_t { @@ -612,7 +638,7 @@ typedef struct ivas_orient_trk_state_t float trkRoll; } ivas_orient_trk_state_t; - +#endif /*----------------------------------------------------------------------------------* * TD ISm Object Renderer structure -- GitLab From 8c434ab32c587d22011a798a648692defc1c9c34 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Fri, 27 Jan 2023 02:35:51 +0100 Subject: [PATCH 048/375] Remove test case hack as test has been removed --- apps/renderer.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index b392e01d6b..f7923af14d 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -575,13 +575,6 @@ int main( convert_backslash( args.inputFilePath ); convert_backslash( args.outputFilePath ); -#ifndef FIX_I109_ORIENTATION_TRACKING - /* disable 'refrotequal' test cases */ - if ( strstr(args.headRotationFilePath, "azi+2-ele+2-every-100-frames.csv") != NULL) - { - memset(args.headRotationFilePath, '\0', sizeof(args.headRotationFilePath)); - } -#endif convert_backslash( args.headRotationFilePath ); #ifdef FIX_I109_ORIENTATION_TRACKING convert_backslash( args.referenceRotationFilePath ); -- GitLab From c5b3a33511449d94fe0d63b24ccb48b4b7aa8b7b Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Fri, 27 Jan 2023 02:38:42 +0100 Subject: [PATCH 049/375] undoing previous change --- apps/renderer.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/renderer.c b/apps/renderer.c index f7923af14d..b392e01d6b 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -575,6 +575,13 @@ int main( convert_backslash( args.inputFilePath ); convert_backslash( args.outputFilePath ); +#ifndef FIX_I109_ORIENTATION_TRACKING + /* disable 'refrotequal' test cases */ + if ( strstr(args.headRotationFilePath, "azi+2-ele+2-every-100-frames.csv") != NULL) + { + memset(args.headRotationFilePath, '\0', sizeof(args.headRotationFilePath)); + } +#endif convert_backslash( args.headRotationFilePath ); #ifdef FIX_I109_ORIENTATION_TRACKING convert_backslash( args.referenceRotationFilePath ); -- GitLab From 0049832d459a601c9c683f1c46b15fce944e3bab Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Fri, 27 Jan 2023 04:01:32 +0100 Subject: [PATCH 050/375] bugfix for mc head rotation. Comment out otr test cases for main merge --- lib_rend/ivas_crend.c | 2 +- scripts/config/self_test.prm | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index bce35f2b20..fccc63b510 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -2602,6 +2602,7 @@ ivas_error ivas_rend_crendProcess( ivas_orient_trk_Process( pCrend->hCrend->hTrack ); ivas_orient_trk_GetTrackedOrientation( pCrend->hCrend->hTrack, &( pCrend->hCrend->m_fYaw ), &( pCrend->hCrend->m_fPitch ), &( pCrend->hCrend->m_fRoll ) ); } +#endif /* Rotation in SHD for: MC with elevation (5_1_2 / 5_1_4 / 7_1_4) -> BINAURAL @@ -2616,7 +2617,6 @@ ivas_error ivas_rend_crendProcess( { rotateFrame_sd( hHeadTrackData, output, subframe_len, *hIntSetup, hEFAPdata, subframe_idx ); } -#endif } #endif diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index bd660b8227..e4bf911846 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -400,8 +400,8 @@ ../IVAS_dec -t testv/headrot_case03_3000_q.csv BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR.tst // 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation, Orientation tracking -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.pcm bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR_OtrAvg.tst +//../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.pcm bit +//../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR_OtrAvg.tst // 1 ISm with metadata bitrate switching from 13.2 kbps to 128 kbps, 32 kHz in, 32 kHz out, mono out, DTX on ../IVAS_cod -dtx -ism 1 testv/stvISM1.csv ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv32c.pcm bit @@ -444,8 +444,8 @@ ../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot.tst // SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation, Orientation tracking -../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.pcm bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot_OtrAvg.tst +//../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.pcm bit +//../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot_OtrAvg.tst // SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.pcm bit @@ -492,8 +492,8 @@ ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot.tst // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrAvg.tst +//../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit +//../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrAvg.tst // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.pcm bit @@ -552,8 +552,8 @@ ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot.tst // SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking -../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.pcm bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_OtrAvg.tst +//../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.pcm bit +//../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_OtrAvg.tst // SBA at 192 kbps, 48kHz in, 48kHz out, HOA2 out, random FEC at 5% ../IVAS_cod -sba 3 192000 48 testv/stv3OA48c.pcm bit @@ -684,8 +684,8 @@ ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot.tst // MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_OtrAvg.tst +//../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit +//../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_OtrAvg.tst // MASA 1dir 2TC at 48 kbps, 48kHz in, 48kHz out, 7_1_4 out, random FEC at 5% ../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 48000 48 testv/stv_IVASMASA_1dir2TC.pcm bit @@ -825,8 +825,8 @@ ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot.tst // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, head rotation, Orientation tracking -../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot_OtrAvg.tst +//../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit +//../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot_OtrAvg.tst // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out ../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit -- GitLab From a74097588fb910fecea612a39472f03e01c7e20c Mon Sep 17 00:00:00 2001 From: szczerba Date: Wed, 1 Feb 2023 16:46:30 +0100 Subject: [PATCH 051/375] File-based reference orientation support for the decoder --- apps/decoder.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++ lib_dec/lib_dec.c | 29 ++++++++++++++++++ lib_dec/lib_dec.h | 8 +++++ 3 files changed, 113 insertions(+) diff --git a/apps/decoder.c b/apps/decoder.c index b195b817cd..c322be3da8 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -90,6 +90,10 @@ typedef struct bool voipMode; bool enableHeadRotation; char *headrotTrajFileName; +#ifdef FIX_I109_ORIENTATION_TRACKING + bool enableReferenceRotation; + char *refrotTrajFileName; +#endif #ifdef SUPPORT_JBM_TRACEFILE char *jbmTraceFilename; #endif @@ -128,7 +132,11 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); +#ifdef FIX_I109_ORIENTATION_TRACKING +static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, HeadRotFileReader *refRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); +#else static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); +#endif static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); #ifdef DEBUGGING static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); @@ -154,6 +162,9 @@ int main( LsCustomFileReader *hLsCustomReader = NULL; hrtfFileReader *hrtfReader = NULL; HeadRotFileReader *headRotReader = NULL; +#ifdef FIX_I109_ORIENTATION_TRACKING + HeadRotFileReader *refRotReader = NULL; +#endif ivas_error error = IVAS_ERR_UNKNOWN; int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; RenderConfigReader *renderConfigReader = NULL; @@ -247,6 +258,20 @@ int main( } } +#ifdef FIX_I109_ORIENTATION_TRACKING + /*------------------------------------------------------------------------------------------* + * Open reference rotation file + *------------------------------------------------------------------------------------------*/ + if ( arg.enableReferenceRotation ) + { + if ( ( error = HeadRotationFileReader_open( arg.refrotTrajFileName, &refRotReader ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: Can't open reference rotation file %s \n\n", arg.refrotTrajFileName ); + goto cleanup; + } + } +#endif + /*------------------------------------------------------------------------------------------* * Open custom loudspeaker layout file *------------------------------------------------------------------------------------------*/ @@ -496,7 +521,11 @@ int main( } else { +#ifdef FIX_I109_ORIENTATION_TRACKING + error = decodeG192( arg, hBsReader, headRotReader, refRotReader, hIvasDec, pcmBuf ); +#else error = decodeG192( arg, hBsReader, headRotReader, hIvasDec, pcmBuf ); +#endif } if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE ) @@ -548,6 +577,9 @@ cleanup: CustomLsReader_close( &hLsCustomReader ); hrtfFileReader_close( &hrtfReader ); HeadRotationFileReader_close( &headRotReader ); +#ifdef FIX_I109_ORIENTATION_TRACKING + HeadRotationFileReader_close( &refRotReader ); +#endif RenderConfigReader_close( &renderConfigReader ); @@ -688,6 +720,8 @@ static bool parseCmdlIVAS_dec( arg->headrotTrajFileName = NULL; #ifdef FIX_I109_ORIENTATION_TRACKING arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; + arg->enableReferenceRotation = false; + arg->headrotTrajFileName = NULL; #else arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; #endif @@ -902,6 +936,23 @@ static bool parseCmdlIVAS_dec( } i += 2; } +#ifdef FIX_I109_ORIENTATION_TRACKING + else if ( strcmp( argv_to_upper, "-RF" ) == 0 ) + { + arg->enableReferenceRotation = true; + i++; + + if ( argc - i <= 4 || argv[i][0] == '-' ) + { + fprintf( stderr, "Error: Reference rotation file name not specified!\n\n" ); + usage_dec(); + return false; + } + + arg->refrotTrajFileName = argv[i]; + i++; + } +#endif else if ( strcmp( argv_to_upper, "-RENDER_CONFIG" ) == 0 ) { arg->renderConfigEnabled = true; @@ -1100,6 +1151,10 @@ static void usage_dec( void ) fprintf( stdout, "-force R : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" ); #endif fprintf( stdout, "-otr tracking_type : head orientation tracking type: 'ref' or 'avg' (only for binaural rendering)\n" ); +#ifdef FIX_I109_ORIENTATION_TRACKING + fprintf( stdout, "-rf File : Reference rotation specified by external trajectory file\n" ); + fprintf( stdout, " works only in combination with -otr ref mode\n" ); +#endif fprintf( stdout, "-render_config file : Renderer configuration file\n" ); fprintf( stdout, "-no_diegetic_pan : panning mono no dietic sound to stereo -1<= pan <=1,\n" ); fprintf( stdout, " left or l or 1->left, right or r or -1->right, center or c or 0->middle\n" ); @@ -1295,6 +1350,9 @@ static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, +#ifdef FIX_I109_ORIENTATION_TRACKING + HeadRotFileReader *refRotReader, +#endif IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ) @@ -1412,6 +1470,24 @@ static ivas_error decodeG192( } } +#ifdef FIX_I109_ORIENTATION_TRACKING + /* Reference rotation */ + if ( arg.enableReferenceRotation ) + { + IVAS_QUATERNION quaternion; + if ( ( error = HeadRotationFileReading( refRotReader, &quaternion ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) ); + goto cleanup; + } + + if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } +#endif /* Run decoder for one frame (get rendered output) */ if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamples ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index c14d3318a6..0aa77c7b5c 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -915,6 +915,35 @@ ivas_error IVAS_DEC_FeedHeadTrackData( return IVAS_ERR_OK; } +#ifdef FIX_I109_ORIENTATION_TRACKING +/*---------------------------------------------------------------------* + * IVAS_DEC_FeedRefRotData( ) + * + * Feed the decoder with the reference rotation + *---------------------------------------------------------------------*/ + +ivas_error IVAS_DEC_FeedRefRotData( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_QUATERNION rotation /* i : reference rotation data */ +) +{ + ivas_orient_trk_state_t *pOtr; + + if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hHeadTrackData || hIvasDec->st_ivas->hHeadTrackData->OrientationTracker ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + pOtr = hIvasDec->st_ivas->hHeadTrackData->OrientationTracker; + + pOtr->refRot.w = rotation.w; + pOtr->refRot.x = rotation.x; + pOtr->refRot.z = rotation.z; + pOtr->refRot.y = rotation.y; + + return IVAS_ERR_OK; +} +#endif /*---------------------------------------------------------------------* * IVAS_DEC_FeedCustomLsData( ) diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 6761ebe628..0f72c2976f 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -180,6 +180,14 @@ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_QUATERNION *orientation /* i : head-tracking data */ ); +#ifdef FIX_I109_ORIENTATION_TRACKING +/*! r: error code */ +ivas_error IVAS_DEC_FeedRefRotData( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_QUATERNION rotation /* i : reference rotation data */ +); +#endif + /*! r: error code */ ivas_error IVAS_DEC_VoIP_FeedFrame( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -- GitLab From 13446f7729e07c25b9f9c95fe589938f0dc7b700 Mon Sep 17 00:00:00 2001 From: szczerba Date: Wed, 1 Feb 2023 19:38:21 +0100 Subject: [PATCH 052/375] Fix for null pointer check --- lib_dec/lib_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 0aa77c7b5c..358dc13b9f 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -929,7 +929,7 @@ ivas_error IVAS_DEC_FeedRefRotData( { ivas_orient_trk_state_t *pOtr; - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hHeadTrackData || hIvasDec->st_ivas->hHeadTrackData->OrientationTracker ) + if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hHeadTrackData == NULL || hIvasDec->st_ivas->hHeadTrackData->OrientationTracker == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -- GitLab From d1b3bdc4d9fdc73d65fab6b1dfb145d04b946483 Mon Sep 17 00:00:00 2001 From: szczerba Date: Wed, 1 Feb 2023 22:19:38 +0100 Subject: [PATCH 053/375] Cleanup for clang reported issues --- apps/renderer.c | 38 +++++++++++++++++----------------- lib_dec/ivas_stat_dec.h | 6 +++--- lib_dec/lib_dec.c | 4 ++-- lib_rend/ivas_objectRenderer.c | 6 +++--- lib_rend/ivas_orient_trk.c | 2 +- lib_rend/ivas_stat_rend.h | 6 +++--- lib_rend/lib_rend.c | 2 +- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index b392e01d6b..536c8d4464 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -577,9 +577,9 @@ int main( convert_backslash( args.outputFilePath ); #ifndef FIX_I109_ORIENTATION_TRACKING /* disable 'refrotequal' test cases */ - if ( strstr(args.headRotationFilePath, "azi+2-ele+2-every-100-frames.csv") != NULL) + if ( strstr( args.headRotationFilePath, "azi+2-ele+2-every-100-frames.csv" ) != NULL ) { - memset(args.headRotationFilePath, '\0', sizeof(args.headRotationFilePath)); + memset( args.headRotationFilePath, '\0', sizeof( args.headRotationFilePath ) ); } #endif convert_backslash( args.headRotationFilePath ); @@ -591,39 +591,39 @@ int main( if ( !isEmptyString( args.headRotationFilePath ) ) { if ( HeadRotationFileReader_open( args.headRotationFilePath, &headRotReader ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error opening file: %s\n", args.headRotationFilePath ); - exit( -1 ); - } + { + fprintf( stderr, "Error opening file: %s\n", args.headRotationFilePath ); + exit( -1 ); + } } #ifdef FIX_I109_ORIENTATION_TRACKING if ( !isEmptyString( args.referenceRotationFilePath ) ) { if ( HeadRotationFileReader_open( args.referenceRotationFilePath, &referenceRotReader ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error opening file: %s\n", args.referenceRotationFilePath ); - exit( -1 ); - } + { + fprintf( stderr, "Error opening file: %s\n", args.referenceRotationFilePath ); + exit( -1 ); + } } #endif if ( !isEmptyString( args.customHrtfFilePath ) ) { if ( hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error opening file: %s\n", args.customHrtfFilePath ); - exit( -1 ); - } + { + fprintf( stderr, "Error opening file: %s\n", args.customHrtfFilePath ); + exit( -1 ); + } } if ( !isEmptyString( args.renderConfigFilePath ) ) { if ( RenderConfigReader_open( args.renderConfigFilePath, &renderConfigReader ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error opening file: %s\n", args.renderConfigFilePath ); - exit( -1 ); - } + { + fprintf( stderr, "Error opening file: %s\n", args.renderConfigFilePath ); + exit( -1 ); + } } /* Initialize main input files, i.e. audio and metadata */ @@ -1337,7 +1337,7 @@ static bool parseOrientationTracking( to_upper( value ); #ifdef FIX_I109_ORIENTATION_TRACKING - if ( strcmp( value, "NONE" ) == 0) + if ( strcmp( value, "NONE" ) == 0 ) { *tracking_type = IVAS_ORIENT_TRK_NONE; } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index e0fb17e86f..59059fbcea 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1359,9 +1359,9 @@ typedef struct ivas_orient_trk_state_t float adaptationAngle; float alpha; - IVAS_QUATERNION absAvgRot; /* average absolute orientation */ - IVAS_QUATERNION refRot; /* reference orientation */ - IVAS_QUATERNION trkRot; /* tracked rotation */ + IVAS_QUATERNION absAvgRot; /* average absolute orientation */ + IVAS_QUATERNION refRot; /* reference orientation */ + IVAS_QUATERNION trkRot; /* tracked rotation */ } ivas_orient_trk_state_t; #endif diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 358dc13b9f..784c79cf55 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -923,8 +923,8 @@ ivas_error IVAS_DEC_FeedHeadTrackData( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_FeedRefRotData( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_QUATERNION rotation /* i : reference rotation data */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_QUATERNION rotation /* i : reference rotation data */ ) { ivas_orient_trk_state_t *pOtr; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 6847d8eee4..e92fe4ed37 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -266,9 +266,9 @@ void ObjRenderIVASFrame( if ( st_ivas->hHeadTrackData != NULL ) { if ( ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hHeadTrackData->Quaternions[subframe_idx], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ) != IVAS_ERR_OK ) - { - exit( -1 ); - } + { + exit( -1 ); + } } TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, st_ivas->hDecoderConfig->Opt_Headrotation, diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 81dc125be7..6420a40134 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -521,7 +521,7 @@ ivas_error ivas_orient_trk_Process( break; } - if (result == IVAS_ERR_OK) + if ( result == IVAS_ERR_OK ) { pOTR->trkRot = *pTrkRot; } diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 0e512cbf0c..bdd0aab8ad 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -468,9 +468,9 @@ typedef struct ivas_orient_trk_state_t float adaptationAngle; float alpha; - IVAS_QUATERNION absAvgRot; /* average absolute orientation */ - IVAS_QUATERNION refRot; /* reference orientation */ - IVAS_QUATERNION trkRot; /* tracked rotation */ + IVAS_QUATERNION absAvgRot; /* average absolute orientation */ + IVAS_QUATERNION refRot; /* reference orientation */ + IVAS_QUATERNION trkRot; /* tracked rotation */ } ivas_orient_trk_state_t; #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 8f4a521b1f..3e317db057 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3473,7 +3473,7 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsMasa[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { - latency_ns = NS2SA( hIvasRend->sampleRateOut, ( int32_t )( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); + latency_ns = NS2SA( hIvasRend->sampleRateOut, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); } } -- GitLab From 2912d927a1a1132e493c91f2d94e19706a2ddb3a Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 1 Feb 2023 22:45:47 +0100 Subject: [PATCH 054/375] fix compiler warning --- lib_rend/ivas_crend.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index fccc63b510..61a5a478a7 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -2010,7 +2010,9 @@ ivas_error ivas_rend_openCrend( const IVAS_REND_AudioConfig outConfig, RENDER_CONFIG_DATA *hRendCfg, #ifdef FIX_197_CREND_INTERFACE - int16_t Opt_Headrotation, +#ifndef FIX_I109_ORIENTATION_TRACKING +int16_t Opt_Headrotation, +#endif #endif #ifdef HRTF_BINARY_FILE HRTFS_CREND_HANDLE hSetOfHRTF, -- GitLab From e6166a341526376cccfec133d33e4fe15fd94443 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 1 Feb 2023 22:57:33 +0100 Subject: [PATCH 055/375] undo --- lib_rend/ivas_crend.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 61a5a478a7..fccc63b510 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -2010,9 +2010,7 @@ ivas_error ivas_rend_openCrend( const IVAS_REND_AudioConfig outConfig, RENDER_CONFIG_DATA *hRendCfg, #ifdef FIX_197_CREND_INTERFACE -#ifndef FIX_I109_ORIENTATION_TRACKING -int16_t Opt_Headrotation, -#endif + int16_t Opt_Headrotation, #endif #ifdef HRTF_BINARY_FILE HRTFS_CREND_HANDLE hSetOfHRTF, -- GitLab From 382987e054b6bf39f61e704be166a59e8dc75242 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Thu, 2 Feb 2023 02:29:31 +0100 Subject: [PATCH 056/375] changing potentially difficult filenames --- apps/renderer.c | 2 +- ...r.csv => azi_plus_2-ele_plus_2-every-100-frames-Euler.csv} | 0 ...-frames.csv => azi_plus_2-ele_plus_2-every-100-frames.csv} | 0 ...ry-25-rows.csv => azi_plus_2-ele_plus_2-every-25-rows.csv} | 0 tests/renderer/test_renderer.py | 4 ++-- 5 files changed, 3 insertions(+), 3 deletions(-) rename scripts/trajectories/{azi+2-ele+2-every-100-frames-Euler.csv => azi_plus_2-ele_plus_2-every-100-frames-Euler.csv} (100%) rename scripts/trajectories/{azi+2-ele+2-every-100-frames.csv => azi_plus_2-ele_plus_2-every-100-frames.csv} (100%) rename scripts/trajectories/{azi+2-ele+2-every-25-rows.csv => azi_plus_2-ele_plus_2-every-25-rows.csv} (100%) diff --git a/apps/renderer.c b/apps/renderer.c index 536c8d4464..b083d22ba3 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -577,7 +577,7 @@ int main( convert_backslash( args.outputFilePath ); #ifndef FIX_I109_ORIENTATION_TRACKING /* disable 'refrotequal' test cases */ - if ( strstr( args.headRotationFilePath, "azi+2-ele+2-every-100-frames.csv" ) != NULL ) + if ( strstr( args.headRotationFilePath, "azi_plus_2-ele_plus_2-every-100-frames.csv" ) != NULL ) { memset( args.headRotationFilePath, '\0', sizeof( args.headRotationFilePath ) ); } diff --git a/scripts/trajectories/azi+2-ele+2-every-100-frames-Euler.csv b/scripts/trajectories/azi_plus_2-ele_plus_2-every-100-frames-Euler.csv similarity index 100% rename from scripts/trajectories/azi+2-ele+2-every-100-frames-Euler.csv rename to scripts/trajectories/azi_plus_2-ele_plus_2-every-100-frames-Euler.csv diff --git a/scripts/trajectories/azi+2-ele+2-every-100-frames.csv b/scripts/trajectories/azi_plus_2-ele_plus_2-every-100-frames.csv similarity index 100% rename from scripts/trajectories/azi+2-ele+2-every-100-frames.csv rename to scripts/trajectories/azi_plus_2-ele_plus_2-every-100-frames.csv diff --git a/scripts/trajectories/azi+2-ele+2-every-25-rows.csv b/scripts/trajectories/azi_plus_2-ele_plus_2-every-25-rows.csv similarity index 100% rename from scripts/trajectories/azi+2-ele+2-every-25-rows.csv rename to scripts/trajectories/azi_plus_2-ele_plus_2-every-25-rows.csv diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index c202150934..287d9acf35 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -89,8 +89,8 @@ def test_ambisonics_binaural_headrotation_refrotequal(test_info, in_fmt, out_fmt ref_kwargs={ }, cut_kwargs={ - "trj_file": HR_TRAJECTORY_DIR.joinpath("azi+2-ele+2-every-100-frames.csv"), - "refrot_file": HR_TRAJECTORY_DIR.joinpath("azi+2-ele+2-every-25-rows.csv") + "trj_file": HR_TRAJECTORY_DIR.joinpath("azi_plus_2-ele_plus_2-every-100-frames.csv"), + "refrot_file": HR_TRAJECTORY_DIR.joinpath("azi_plus_2-ele_plus_2-every-25-rows.csv") } ) -- GitLab From 582cce3aec8ac494650ca49ff04f93c20596d8ff Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Thu, 2 Feb 2023 03:44:47 +0100 Subject: [PATCH 057/375] logic sanitization looking for wave file write bug --- lib_util/audio_file_writer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_util/audio_file_writer.c b/lib_util/audio_file_writer.c index d6cbb1810e..7d0462503a 100644 --- a/lib_util/audio_file_writer.c +++ b/lib_util/audio_file_writer.c @@ -98,7 +98,11 @@ ivas_error AudioFileWriter_open( int8_t retCode; +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( (fileNameLen > wavSuffixLen) && ( strncmp( fileName + fileNameLen - wavSuffixLen, wavSuffix, wavSuffixLen ) == 0 ) ) +#else if ( fileNameLen > wavSuffixLen && strncmp( fileName + fileNameLen - wavSuffixLen, wavSuffix, wavSuffixLen ) == 0 ) +#endif { retCode = AudioFileWriter_open_wav( self, fileName, sampleRate, numChannels ); } -- GitLab From ba0f65284b5e8d3555497ab72c5193c9bdde1755 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Thu, 2 Feb 2023 04:09:11 +0100 Subject: [PATCH 058/375] limiting test output file name lengths --- apps/renderer.c | 2 +- ...plus_2-ele_plus_2-every-100-frames.csv => a2_e2_100fr.csv} | 0 ...{azi_plus_2-ele_plus_2-every-25-rows.csv => a2_e2_25r.csv} | 0 tests/renderer/test_renderer.py | 4 ++-- 4 files changed, 3 insertions(+), 3 deletions(-) rename scripts/trajectories/{azi_plus_2-ele_plus_2-every-100-frames.csv => a2_e2_100fr.csv} (100%) rename scripts/trajectories/{azi_plus_2-ele_plus_2-every-25-rows.csv => a2_e2_25r.csv} (100%) diff --git a/apps/renderer.c b/apps/renderer.c index b083d22ba3..3b8bd04ef8 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -577,7 +577,7 @@ int main( convert_backslash( args.outputFilePath ); #ifndef FIX_I109_ORIENTATION_TRACKING /* disable 'refrotequal' test cases */ - if ( strstr( args.headRotationFilePath, "azi_plus_2-ele_plus_2-every-100-frames.csv" ) != NULL ) + if ( strstr( args.headRotationFilePath, "a2_e2_100fr.csv" ) != NULL ) { memset( args.headRotationFilePath, '\0', sizeof( args.headRotationFilePath ) ); } diff --git a/scripts/trajectories/azi_plus_2-ele_plus_2-every-100-frames.csv b/scripts/trajectories/a2_e2_100fr.csv similarity index 100% rename from scripts/trajectories/azi_plus_2-ele_plus_2-every-100-frames.csv rename to scripts/trajectories/a2_e2_100fr.csv diff --git a/scripts/trajectories/azi_plus_2-ele_plus_2-every-25-rows.csv b/scripts/trajectories/a2_e2_25r.csv similarity index 100% rename from scripts/trajectories/azi_plus_2-ele_plus_2-every-25-rows.csv rename to scripts/trajectories/a2_e2_25r.csv diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index 287d9acf35..d6a5041c9e 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -89,8 +89,8 @@ def test_ambisonics_binaural_headrotation_refrotequal(test_info, in_fmt, out_fmt ref_kwargs={ }, cut_kwargs={ - "trj_file": HR_TRAJECTORY_DIR.joinpath("azi_plus_2-ele_plus_2-every-100-frames.csv"), - "refrot_file": HR_TRAJECTORY_DIR.joinpath("azi_plus_2-ele_plus_2-every-25-rows.csv") + "trj_file": HR_TRAJECTORY_DIR.joinpath("a2_e2_100fr.csv"), + "refrot_file": HR_TRAJECTORY_DIR.joinpath("a2_e2_25r.csv") } ) -- GitLab From 4ccaee1e85a5456ead6b4044a842c2494a577f1e Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Thu, 2 Feb 2023 04:20:21 +0100 Subject: [PATCH 059/375] revert previous commit --- apps/renderer.c | 2 +- lib_util/audio_file_writer.c | 2 +- ...2_100fr.csv => azi_plus_2-ele_plus_2-every-100-frames.csv} | 0 ...{a2_e2_25r.csv => azi_plus_2-ele_plus_2-every-25-rows.csv} | 0 tests/renderer/test_renderer.py | 4 ++-- 5 files changed, 4 insertions(+), 4 deletions(-) rename scripts/trajectories/{a2_e2_100fr.csv => azi_plus_2-ele_plus_2-every-100-frames.csv} (100%) rename scripts/trajectories/{a2_e2_25r.csv => azi_plus_2-ele_plus_2-every-25-rows.csv} (100%) diff --git a/apps/renderer.c b/apps/renderer.c index 3b8bd04ef8..b083d22ba3 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -577,7 +577,7 @@ int main( convert_backslash( args.outputFilePath ); #ifndef FIX_I109_ORIENTATION_TRACKING /* disable 'refrotequal' test cases */ - if ( strstr( args.headRotationFilePath, "a2_e2_100fr.csv" ) != NULL ) + if ( strstr( args.headRotationFilePath, "azi_plus_2-ele_plus_2-every-100-frames.csv" ) != NULL ) { memset( args.headRotationFilePath, '\0', sizeof( args.headRotationFilePath ) ); } diff --git a/lib_util/audio_file_writer.c b/lib_util/audio_file_writer.c index 7d0462503a..b27a8ceca6 100644 --- a/lib_util/audio_file_writer.c +++ b/lib_util/audio_file_writer.c @@ -99,7 +99,7 @@ ivas_error AudioFileWriter_open( int8_t retCode; #ifdef FIX_I109_ORIENTATION_TRACKING - if ( (fileNameLen > wavSuffixLen) && ( strncmp( fileName + fileNameLen - wavSuffixLen, wavSuffix, wavSuffixLen ) == 0 ) ) + if ( ( fileNameLen > wavSuffixLen ) && ( strncmp( fileName + fileNameLen - wavSuffixLen, wavSuffix, wavSuffixLen ) == 0 ) ) #else if ( fileNameLen > wavSuffixLen && strncmp( fileName + fileNameLen - wavSuffixLen, wavSuffix, wavSuffixLen ) == 0 ) #endif diff --git a/scripts/trajectories/a2_e2_100fr.csv b/scripts/trajectories/azi_plus_2-ele_plus_2-every-100-frames.csv similarity index 100% rename from scripts/trajectories/a2_e2_100fr.csv rename to scripts/trajectories/azi_plus_2-ele_plus_2-every-100-frames.csv diff --git a/scripts/trajectories/a2_e2_25r.csv b/scripts/trajectories/azi_plus_2-ele_plus_2-every-25-rows.csv similarity index 100% rename from scripts/trajectories/a2_e2_25r.csv rename to scripts/trajectories/azi_plus_2-ele_plus_2-every-25-rows.csv diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index d6a5041c9e..287d9acf35 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -89,8 +89,8 @@ def test_ambisonics_binaural_headrotation_refrotequal(test_info, in_fmt, out_fmt ref_kwargs={ }, cut_kwargs={ - "trj_file": HR_TRAJECTORY_DIR.joinpath("a2_e2_100fr.csv"), - "refrot_file": HR_TRAJECTORY_DIR.joinpath("a2_e2_25r.csv") + "trj_file": HR_TRAJECTORY_DIR.joinpath("azi_plus_2-ele_plus_2-every-100-frames.csv"), + "refrot_file": HR_TRAJECTORY_DIR.joinpath("azi_plus_2-ele_plus_2-every-25-rows.csv") } ) -- GitLab From dfe0767bb8e524a8b75cfb85c4907e80780622ea Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Fri, 3 Feb 2023 12:13:43 +0530 Subject: [PATCH 060/375] Cleanup for SBA reconfig functions [x] Added cleanup changes for both encoder and decoder reconfig functions --- lib_com/ivas_prot.h | 14 +++ lib_com/options.h | 1 + lib_dec/ivas_init_dec.c | 8 ++ lib_dec/ivas_sba_dec.c | 71 +++++++++++- lib_dec/ivas_spar_decoder.c | 124 ++++++++++++-------- lib_enc/ivas_init_enc.c | 8 ++ lib_enc/ivas_sba_enc.c | 125 ++++++++++++++------ lib_enc/ivas_spar_encoder.c | 219 +++++++++++++++++++++--------------- 8 files changed, 399 insertions(+), 171 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 6f4d27d5e8..89a548d6e1 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3811,12 +3811,18 @@ void FdCngDecodeDiracMDCTStereoSID( ivas_error ivas_spar_enc_open( Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + ,const int16_t spar_reconfig_flag +#endif ); void ivas_spar_enc_close( SPAR_ENC_HANDLE hSpar, /* i/o: SPAR encoder handle */ const int32_t input_Fs, /* i : input sampling rate */ const int16_t nchan_inp /* i : number of input channels */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + ,const int16_t spar_reconfig_flag +#endif ); ivas_error ivas_spar_enc( @@ -3829,11 +3835,19 @@ ivas_error ivas_spar_enc( ivas_error ivas_spar_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + , + const int16_t spar_reconfig_flag +#endif ); void ivas_spar_dec_close( SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ const int32_t output_Fs /* i : output sampling rate */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + , + const int16_t spar_reconfig_flag +#endif ); ivas_error ivas_spar_dec( diff --git a/lib_com/options.h b/lib_com/options.h index 5dddf236ea..1cef4a5d83 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -145,6 +145,7 @@ #ifdef SBA_BR_SWITCHING #define SBA_BR_SWITCHING_RECONFIG /* Issue 114: Changes for SBA bitrate switching with reconfiguration for bitrates with different number of transport channels*/ #define SBA_BR_SWITCHING_COMPLEXITY_FIX /* VA: fix complexity overhead */ +#define SBA_BR_SWITCHING_CLEAN_UP #endif #define FIX_I59_DELAY_ROUNDING /* Issue 59: rounding in sample domain instead of nanosec for IVAS_ENC_GetDelay() and IVAS_DEC_GetDelay() */ #define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 763c83dc39..f4cb9de752 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -813,7 +813,11 @@ ivas_error ivas_init_decoder( { if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_spar_dec_open( st_ivas ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -1673,7 +1677,11 @@ void ivas_destroy_dec( /* Spar handle */ if ( st_ivas->hSpar != NULL ) { +#ifdef SBA_BR_SWITCHING_CLEAN_UP + ivas_spar_dec_close( st_ivas->hSpar, st_ivas->hDecoderConfig->output_Fs, 0 ); +#else ivas_spar_dec_close( st_ivas->hSpar, st_ivas->hDecoderConfig->output_Fs ); +#endif st_ivas->hSpar = NULL; } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index fbdc4f5857..1ea5cc1a92 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -625,7 +625,11 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->sba_mode != SBA_MODE_SPAR ) { +#ifndef SBA_BR_SWITCHING_CLEAN_UP ivas_spar_dec_close( st_ivas->hSpar, hDecoderConfig->output_Fs ); +#else + ivas_spar_dec_close( st_ivas->hSpar, hDecoderConfig->output_Fs, 0 ); +#endif st_ivas->hSpar = NULL; if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, -1 ) ) != IVAS_ERR_OK ) @@ -637,20 +641,24 @@ ivas_error ivas_sba_dec_reconfigure( } else { +#ifdef SBA_BR_SWITCHING_CLEAN_UP + int16_t sba_order_internal, nchan_internal; +#else #ifdef SBA_BR_SWITCHING_RECONFIG int16_t i, sba_order_internal, nchan_internal; #else int16_t sba_order_internal; #endif DIRAC_DEC_HANDLE hDirAC = st_ivas->hDirAC; +#endif SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); #ifdef SBA_BR_SWITCHING_RECONFIG nchan_internal = ivas_sba_get_nchan_metadata( sba_order_internal ); +#ifndef SBA_BR_SWITCHING_CLEAN_UP if ( hSpar != NULL && nchan_transport_old != ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) ) { - // VE: dirty patch -> reconfiguration of SPAR modules should be used instead !! IVAS_FB_CFG *fb_cfg; int16_t active_w_mixing; @@ -708,7 +716,47 @@ ivas_error ivas_sba_dec_reconfigure( } hSpar->i_subframe = 0; } +#else + if ( hSpar != NULL ) + { + if ( hDecoderConfig->ivas_total_brate == PCA_BRATE && sba_order_internal == 1 ) + { + if ( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for PCA decoder" ); + } + + ivas_pca_dec_init( hSpar->hPCA ); + } + else if ( hSpar->hPCA != NULL ) + { + free( st_ivas->hSpar->hPCA ); + hSpar->hPCA = NULL; + } + if ( nchan_transport_old != ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) ) + { + + ivas_spar_dec_close( st_ivas->hSpar, hDecoderConfig->output_Fs, 1 ); + + if ( ( error = ivas_spar_dec_open( st_ivas, 1 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ivas_spar_config( ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, st_ivas->sid_format ); + } + else + { + if ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + hSpar = st_ivas->hSpar; + st_ivas->sba_dirac_stereo_flag = 0; +#endif #endif +#ifndef SBA_BR_SWITCHING_CLEAN_UP /* PCA handle */ if ( hSpar != NULL ) { @@ -768,6 +816,7 @@ ivas_error ivas_sba_dec_reconfigure( { return error; } +#endif } if ( st_ivas->nchan_transport == 1 ) { @@ -849,6 +898,25 @@ ivas_error ivas_sba_dec_reconfigure( ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); } #ifdef SBA_BR_SWITCHING_RECONFIG +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( sba_mode_old != st_ivas->sba_mode ) || ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) + { + DIRAC_CONFIG_FLAG flag_config; + flag_config = DIRAC_OPEN; + if ( st_ivas->hDirAC != NULL ) + { + flag_config = DIRAC_RECONFIGURE_MODE; + if ( ( sba_mode_old == st_ivas->sba_mode ) && ( st_ivas->sba_mode != SBA_MODE_SPAR ) ) + { + flag_config = DIRAC_RECONFIGURE; + } + } + if ( ( error = ivas_dirac_dec_config( st_ivas, flag_config ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#else if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( sba_mode_old != st_ivas->sba_mode ) ) { DIRAC_CONFIG_FLAG flag_config; @@ -868,6 +936,7 @@ ivas_error ivas_sba_dec_reconfigure( return error; } } +#endif #else #ifdef SBA_BR_SWITCHING if ( ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 2eff5d2cba..119c4b1bc9 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -61,6 +61,10 @@ static void ivas_spar_dec_MD( Decoder_Struct *st_ivas, Decoder_State *st0 ); ivas_error ivas_spar_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + , + const int16_t spar_reconfig_flag +#endif ) { SPAR_DEC_HANDLE hSpar; @@ -73,13 +77,19 @@ ivas_error ivas_spar_dec_open( error = IVAS_ERR_OK; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); num_channels_internal = ivas_sba_get_nchan_metadata( sba_order_internal ); - - /* SPAR decoder handle */ - if ( ( hSpar = (SPAR_DEC_HANDLE) malloc( sizeof( SPAR_DEC_DATA ) ) ) == NULL ) +#ifdef SBA_BR_SWITCHING_CLEAN_UP + hSpar = st_ivas->hSpar; + if ( !spar_reconfig_flag ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR decoder" ); +#endif + /* SPAR decoder handle */ + if ( ( hSpar = (SPAR_DEC_HANDLE) malloc( sizeof( SPAR_DEC_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR decoder" ); + } +#ifdef SBA_BR_SWITCHING_CLEAN_UP } - +#endif output_Fs = st_ivas->hDecoderConfig->output_Fs; /* TD decorr. */ @@ -110,25 +120,30 @@ ivas_error ivas_spar_dec_open( { return error; } - - /* AGC handle */ - if ( ( error = ivas_spar_agc_dec_open( &hSpar->hAgcDec, output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* PCA handle */ - hSpar->hPCA = NULL; - if ( st_ivas->hDecoderConfig->ivas_total_brate == PCA_BRATE && sba_order_internal == 1 ) +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) { - if ( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL ) +#endif + /* AGC handle */ + if ( ( error = ivas_spar_agc_dec_open( &hSpar->hAgcDec, output_Fs ) ) != IVAS_ERR_OK ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for PCA decoder" ); + return error; } - ivas_pca_dec_init( hSpar->hPCA ); - } + /* PCA handle */ + hSpar->hPCA = NULL; + if ( st_ivas->hDecoderConfig->ivas_total_brate == PCA_BRATE && sba_order_internal == 1 ) + { + if ( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for PCA decoder" ); + } + ivas_pca_dec_init( hSpar->hPCA ); + } +#ifdef SBA_BR_SWITCHING_CLEAN_UP + } +#endif /* mixer_mat intitialization */ for ( i = 0; i < num_channels_internal; i++ ) { @@ -145,30 +160,35 @@ ivas_error ivas_spar_dec_open( } } hSpar->i_subframe = 0; - - /*-----------------------------------------------------------------* +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) + { +#endif + /*-----------------------------------------------------------------* * Configuration - set SPAR high-level parameters *-----------------------------------------------------------------*/ - ivas_spar_config( st_ivas->hDecoderConfig->ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, st_ivas->sid_format ); - - switch ( sba_order_internal ) - { - case 1: - st_ivas->transport_config = AUDIO_CONFIG_FOA; - break; - case 2: - st_ivas->transport_config = AUDIO_CONFIG_HOA2; - break; - case 3: - st_ivas->transport_config = AUDIO_CONFIG_HOA3; - break; - } + ivas_spar_config( st_ivas->hDecoderConfig->ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, st_ivas->sid_format ); - ivas_output_init( &( st_ivas->hTransSetup ), st_ivas->transport_config ); + switch ( sba_order_internal ) + { + case 1: + st_ivas->transport_config = AUDIO_CONFIG_FOA; + break; + case 2: + st_ivas->transport_config = AUDIO_CONFIG_HOA2; + break; + case 3: + st_ivas->transport_config = AUDIO_CONFIG_HOA3; + break; + } - st_ivas->hSpar = hSpar; + ivas_output_init( &( st_ivas->hTransSetup ), st_ivas->transport_config ); + st_ivas->hSpar = hSpar; +#ifdef SBA_BR_SWITCHING_CLEAN_UP + } +#endif return error; } @@ -182,6 +202,10 @@ ivas_error ivas_spar_dec_open( void ivas_spar_dec_close( SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ const int32_t output_Fs /* i : output sampling rate */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + , + const int16_t spar_reconfig_flag +#endif ) { if ( hSpar != NULL ) @@ -194,19 +218,25 @@ void ivas_spar_dec_close( /* FB mixer handle */ ivas_FB_mixer_close( &hSpar->hFbMixer, output_Fs ); +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) + { +#endif + /* AGC */ + ivas_spar_agc_dec_close( &hSpar->hAgcDec ); - /* AGC */ - ivas_spar_agc_dec_close( &hSpar->hAgcDec ); + /* PCA */ + if ( hSpar->hPCA != NULL ) + { + free( hSpar->hPCA ); + hSpar->hPCA = NULL; + } - /* PCA */ - if ( hSpar->hPCA != NULL ) - { - free( hSpar->hPCA ); - hSpar->hPCA = NULL; + free( hSpar ); + hSpar = NULL; +#ifdef SBA_BR_SWITCHING_CLEAN_UP } - - free( hSpar ); - hSpar = NULL; +#endif } return; diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index fd92453980..b6a1712a69 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -448,7 +448,11 @@ ivas_error ivas_init_encoder( if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( ( error = ivas_spar_enc_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_spar_enc_open( st_ivas ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -939,7 +943,11 @@ void ivas_destroy_enc( /* SPAR handle */ if ( st_ivas->hSpar != NULL ) { +#ifdef SBA_BR_SWITCHING_CLEAN_UP + ivas_spar_enc_close( st_ivas->hSpar, st_ivas->hEncoderConfig->input_Fs, nchan_inp, 0 ); +#else ivas_spar_enc_close( st_ivas->hSpar, st_ivas->hEncoderConfig->input_Fs, nchan_inp ); +#endif st_ivas->hSpar = NULL; } diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index 7fd96ae46e..a0b59ac2b0 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -348,16 +348,22 @@ ivas_error ivas_sba_enc_reconfigure( #ifdef SBA_BR_SWITCHING_RECONFIG sba_mode_old = st_ivas->sba_mode; #endif - +#ifdef SBA_BR_SWITCHING_CLEAN_UP + int16_t spar_reconfig_flag; + spar_reconfig_flag = 0; +#endif st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, hEncoderConfig->sba_order ); #ifdef SBA_BR_SWITCHING st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { if ( st_ivas->hSpar == NULL ) { +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( ( error = ivas_spar_enc_open( st_ivas, spar_reconfig_flag ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_spar_enc_open( st_ivas ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -367,10 +373,26 @@ ivas_error ivas_sba_enc_reconfigure( ivas_spar_config( ivas_total_brate, min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->hSpar->core_nominal_brate, -1 ); +#ifdef SBA_BR_SWITCHING_CLEAN_UP + for ( int16_t n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) + { + if ( hDirAC->sba_synchro_buffer[n] != NULL ) + { + free( hDirAC->sba_synchro_buffer[n] ); + hDirAC->sba_synchro_buffer[n] = NULL; + } + } + hDirAC->num_samples_synchro_delay = 0; +#endif } else { +#ifdef SBA_BR_SWITCHING_CLEAN_UP + ivas_spar_enc_close( st_ivas->hSpar, hEncoderConfig->input_Fs, hEncoderConfig->nchan_inp, spar_reconfig_flag ); + +#else ivas_spar_enc_close( st_ivas->hSpar, hEncoderConfig->input_Fs, hEncoderConfig->nchan_inp ); +#endif st_ivas->hSpar = NULL; } @@ -403,7 +425,7 @@ ivas_error ivas_sba_enc_reconfigure( if ( sba_mode_old == SBA_MODE_SPAR ) { // VE: dirty patch -> reconfiguration of SPAR MD, TD_decorr, FbMixer modules should be used instead !! - +#ifndef SBA_BR_SWITCHING_CLEAN_UP IVAS_FB_CFG *fb_cfg; int16_t nchan_internal, sba_order_internal; int16_t table_idx, active_w_mixing; @@ -444,6 +466,18 @@ ivas_error ivas_sba_enc_reconfigure( { return error; } +#else + spar_reconfig_flag = 1; + ivas_spar_enc_close( st_ivas->hSpar, hEncoderConfig->input_Fs, hEncoderConfig->nchan_inp, spar_reconfig_flag ); + + if ( ( error = ivas_spar_enc_open( st_ivas, spar_reconfig_flag ) ) != IVAS_ERR_OK ) + { + return error; + } + + // VE: TBV - populate 'hSpar->hFrontVad' with 'hCoreCoder[0]' instead of resetting it to init-state? + +#endif } } else @@ -463,11 +497,6 @@ ivas_error ivas_sba_enc_reconfigure( return error; } } - } - - /* initalize delay for SPAR/DirAC delay synchronization */ - if ( ( st_ivas->sba_mode == SBA_MODE_DIRAC ) && ( ( sba_mode_old != st_ivas->sba_mode ) || ( nchan_transport_old != st_ivas->nchan_transport ) ) ) - { int16_t n; if ( hDirAC->num_samples_synchro_delay == 0 ) @@ -488,57 +517,83 @@ ivas_error ivas_sba_enc_reconfigure( } } } - else + } +#ifndef SBA_BR_SWITCHING_CLEAN_UP + /* initalize delay for SPAR/DirAC delay synchronization */ + if ( ( st_ivas->sba_mode == SBA_MODE_DIRAC ) && ( ( sba_mode_old != st_ivas->sba_mode ) || ( nchan_transport_old != st_ivas->nchan_transport ) ) ) + { + int16_t n; + + if ( hDirAC->num_samples_synchro_delay == 0 ) { - for ( int16_t n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) + hDirAC->num_samples_synchro_delay = NS2SA( hEncoderConfig->input_Fs, IVAS_FB_ENC_DELAY_NS ); + + for ( n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) { - if ( hDirAC->sba_synchro_buffer[n] != NULL ) + if ( ( hDirAC->sba_synchro_buffer[n] = (float *) malloc( hDirAC->num_samples_synchro_delay * sizeof( float ) ) ) == NULL ) { - free( hDirAC->sba_synchro_buffer[n] ); - hDirAC->sba_synchro_buffer[n] = NULL; + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hDirAC synchro buffer\n" ) ); } + set_zero( hDirAC->sba_synchro_buffer[n], hDirAC->num_samples_synchro_delay ); + } + for ( ; n < DIRAC_MAX_ANA_CHANS; n++ ) + { + hDirAC->sba_synchro_buffer[n] = NULL; + } + } + } + else + { + for ( int16_t n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) + { + if ( hDirAC->sba_synchro_buffer[n] != NULL ) + { + free( hDirAC->sba_synchro_buffer[n] ); + hDirAC->sba_synchro_buffer[n] = NULL; } - hDirAC->num_samples_synchro_delay = 0; } + hDirAC->num_samples_synchro_delay = 0; } + } +#endif #endif - ivas_dirac_enc_reconfigure( st_ivas ); + ivas_dirac_enc_reconfigure( st_ivas ); #ifdef SBA_BR_SWITCHING - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) - { - mvs2s( hDirAC->dirac_to_spar_md_bands, hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); - hSpar->enc_param_start_band = hDirAC->hConfig->enc_param_start_band; - } + if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + { + mvs2s( hDirAC->dirac_to_spar_md_bands, hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); + hSpar->enc_param_start_band = hDirAC->hConfig->enc_param_start_band; + } #endif - /*-----------------------------------------------------------------* + /*-----------------------------------------------------------------* * Allocate, initalize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ - ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ); + ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ); #ifdef SBA_BR_SWITCHING_RECONFIG - if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) + if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) + { + if ( ( sba_mode_old != st_ivas->sba_mode ) || ( nchan_transport_old != st_ivas->nchan_transport ) ) { - if ( ( sba_mode_old != st_ivas->sba_mode ) || ( nchan_transport_old != st_ivas->nchan_transport ) ) + for ( int16_t sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { - for ( int16_t sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) - { - st_ivas->hSCE[sce_id]->hCoreCoder[0]->ini_frame = 1; - } + st_ivas->hSCE[sce_id]->hCoreCoder[0]->ini_frame = 1; + } - for ( int16_t cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + for ( int16_t cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + for ( int16_t n = 0; n < CPE_CHANNELS; n++ ) { - for ( int16_t n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->ini_frame = 1; - } + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->ini_frame = 1; } } } -#endif } +#endif +} - return error; +return error; } diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 5e9dd6400c..b90cb748e9 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -59,6 +59,10 @@ static ivas_error ivas_spar_enc_process( Encoder_Struct *st_ivas, const ENCODER_ ivas_error ivas_spar_enc_open( Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + , + const int16_t spar_reconfig_flag +#endif ) { SPAR_ENC_HANDLE hSpar; @@ -71,13 +75,22 @@ ivas_error ivas_spar_enc_open( hEncoderConfig = st_ivas->hEncoderConfig; error = IVAS_ERR_OK; - - /* SPAR encoder handle */ - if ( ( hSpar = (SPAR_ENC_HANDLE) malloc( sizeof( SPAR_ENC_DATA ) ) ) == NULL ) +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR encoder" ); +#endif + /* SPAR encoder handle */ + if ( ( hSpar = (SPAR_ENC_HANDLE) malloc( sizeof( SPAR_ENC_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR encoder" ); + } +#ifdef SBA_BR_SWITCHING_CLEAN_UP } - + else + { + hSpar = st_ivas->hSpar; + } +#endif input_Fs = hEncoderConfig->input_Fs; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); nchan_inp = ivas_sba_get_nchan_metadata( sba_order_internal ); @@ -112,49 +125,58 @@ ivas_error ivas_spar_enc_open( { return error; } - - /* Transient Detector handle */ - if ( ( error = ivas_spar_transient_det_open( &( hSpar->hTranDet ), input_Fs ) ) != IVAS_ERR_OK ) +#ifdef SBA_BR_SWITCHING_CLEAN_UP + /* initialization */ + hSpar->hMdEnc->table_idx = -1; +#endif +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) { - return error; - } +#endif + /* Transient Detector handle */ + if ( ( error = ivas_spar_transient_det_open( &( hSpar->hTranDet ), input_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } - /* AGC handle */ + /* AGC handle */ #ifdef DEBUG_AGC_ENCODER_CMD_OPTION - hSpar->AGC_Enable = ivas_agc_enc_get_flag( hEncoderConfig->Opt_AGC_ON, nchan_transport ); + hSpar->AGC_Enable = ivas_agc_enc_get_flag( hEncoderConfig->Opt_AGC_ON, nchan_transport ); #else hSpar->AGC_Enable = ivas_agc_enc_get_flag( nchan_transport ); #endif - hSpar->hAgcEnc = NULL; - if ( hSpar->AGC_Enable ) - { - if ( ( error = ivas_spar_agc_enc_open( &hSpar->hAgcEnc, input_Fs, nchan_inp ) ) != IVAS_ERR_OK ) + hSpar->hAgcEnc = NULL; + if ( hSpar->AGC_Enable ) { - return error; + if ( ( error = ivas_spar_agc_enc_open( &hSpar->hAgcEnc, input_Fs, nchan_inp ) ) != IVAS_ERR_OK ) + { + return error; + } } - } - /* PCA handle */ - hSpar->hPCA = NULL; - if ( hEncoderConfig->Opt_PCA_ON ) - { - if ( ( hSpar->hPCA = (PCA_ENC_STATE *) malloc( sizeof( PCA_ENC_STATE ) ) ) == NULL ) + /* PCA handle */ + hSpar->hPCA = NULL; + if ( hEncoderConfig->Opt_PCA_ON ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR PCA encoder" ); + if ( ( hSpar->hPCA = (PCA_ENC_STATE *) malloc( sizeof( PCA_ENC_STATE ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR PCA encoder" ); + } + ivas_pca_enc_init( hSpar->hPCA ); } - ivas_pca_enc_init( hSpar->hPCA ); - } - - /* initialization */ - hSpar->hMdEnc->table_idx = -1; - - /*-----------------------------------------------------------------* - * Configuration - set SPAR high-level parameters - *-----------------------------------------------------------------*/ - - ivas_spar_config( hEncoderConfig->ivas_total_brate, min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), - &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, -1 ); +#ifndef SBA_BR_SWITCHING_CLEAN_UP + /* initialization */ + hSpar->hMdEnc->table_idx = -1; +#endif + /*-----------------------------------------------------------------* + * Configuration - set SPAR high-level parameters + *-----------------------------------------------------------------*/ + ivas_spar_config( hEncoderConfig->ivas_total_brate, min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), + &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, -1 ); +#ifdef SBA_BR_SWITCHING_CLEAN_UP + } +#endif if ( st_ivas->nchan_transport == 1 ) { hEncoderConfig->element_mode_init = IVAS_SCE; @@ -167,45 +189,50 @@ ivas_error ivas_spar_enc_open( /*-----------------------------------------------------------------* * Allocate and initialize Front-VAD handle *-----------------------------------------------------------------*/ - - hSpar->front_vad_flag = 0; - hSpar->front_vad_dtx_flag = 0; - hSpar->force_front_vad = 0; - - if ( hEncoderConfig->Opt_DTX_ON ) +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) { - if ( ( error = front_vad_create( &( hSpar->hFrontVad ), hEncoderConfig ) ) != IVAS_ERR_OK ) - { - return error; - } +#endif + hSpar->front_vad_flag = 0; + hSpar->front_vad_dtx_flag = 0; + hSpar->force_front_vad = 0; - if ( ( hSpar->hCoreCoderVAD = (ENC_CORE_HANDLE) malloc( sizeof( Encoder_State ) ) ) == NULL ) + if ( hEncoderConfig->Opt_DTX_ON ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CoreCoder structure\n" ) ); - } + if ( ( error = front_vad_create( &( hSpar->hFrontVad ), hEncoderConfig ) ) != IVAS_ERR_OK ) + { + return error; + } - copy_encoder_config( st_ivas, hSpar->hCoreCoderVAD, 1 ); + if ( ( hSpar->hCoreCoderVAD = (ENC_CORE_HANDLE) malloc( sizeof( Encoder_State ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CoreCoder structure\n" ) ); + } + + copy_encoder_config( st_ivas, hSpar->hCoreCoderVAD, 1 ); - hSpar->hCoreCoderVAD->total_brate = hEncoderConfig->ivas_total_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ - hSpar->hCoreCoderVAD->mct_chan_mode = MCT_CHAN_MODE_IGNORE; + hSpar->hCoreCoderVAD->total_brate = hEncoderConfig->ivas_total_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ + hSpar->hCoreCoderVAD->mct_chan_mode = MCT_CHAN_MODE_IGNORE; - if ( ( error = init_encoder( hSpar->hCoreCoderVAD, 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1 ) ) != IVAS_ERR_OK ) + if ( ( error = init_encoder( hSpar->hCoreCoderVAD, 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else { - return error; + hSpar->hCoreCoderVAD = NULL; + hSpar->hFrontVad = NULL; } - } - else - { - hSpar->hCoreCoderVAD = NULL; - hSpar->hFrontVad = NULL; - } - - /*-----------------------------------------------------------------* - * Final assignment - *-----------------------------------------------------------------*/ - st_ivas->hSpar = hSpar; + /*-----------------------------------------------------------------* + * Final assignment + *-----------------------------------------------------------------*/ + st_ivas->hSpar = hSpar; +#ifdef SBA_BR_SWITCHING_CLEAN_UP + } +#endif return error; } @@ -220,25 +247,35 @@ void ivas_spar_enc_close( SPAR_ENC_HANDLE hSpar, /* i/o: SPAR encoder handle */ const int32_t input_Fs, /* i : input sampling rate */ const int16_t nchan_inp /* i : number of input channels */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + , + const int16_t spar_reconfig_flag +#endif ) { int16_t num_chans; if ( hSpar != NULL ) { - /* core-coder-VAD handle */ - if ( hSpar->hCoreCoderVAD != NULL ) +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) { - destroy_core_enc( hSpar->hCoreCoderVAD ); - hSpar->hCoreCoderVAD = NULL; - } +#endif + /* core-coder-VAD handle */ + if ( hSpar->hCoreCoderVAD != NULL ) + { + destroy_core_enc( hSpar->hCoreCoderVAD ); + hSpar->hCoreCoderVAD = NULL; + } - /* front-VAD handle */ - if ( hSpar->hFrontVad != NULL ) - { - front_vad_destroy( &hSpar->hFrontVad ); - hSpar->hFrontVad = NULL; + /* front-VAD handle */ + if ( hSpar->hFrontVad != NULL ) + { + front_vad_destroy( &hSpar->hFrontVad ); + hSpar->hFrontVad = NULL; + } +#ifdef SBA_BR_SWITCHING_CLEAN_UP } - +#endif num_chans = hSpar->hFbMixer->fb_cfg->num_in_chans; assert( num_chans <= nchan_inp ); @@ -250,22 +287,28 @@ void ivas_spar_enc_close( /* FB mixer handle */ ivas_FB_mixer_close( &hSpar->hFbMixer, input_Fs ); +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) + { +#endif + /* Trans Det handle */ + ivas_spar_transient_det_close( &hSpar->hTranDet ); - /* Trans Det handle */ - ivas_spar_transient_det_close( &hSpar->hTranDet ); + /* AGC */ + ivas_spar_agc_enc_close( &hSpar->hAgcEnc ); - /* AGC */ - ivas_spar_agc_enc_close( &hSpar->hAgcEnc ); + /* PCA */ + if ( hSpar->hPCA != NULL ) + { + free( hSpar->hPCA ); + hSpar->hPCA = NULL; + } - /* PCA */ - if ( hSpar->hPCA != NULL ) - { - free( hSpar->hPCA ); - hSpar->hPCA = NULL; + free( hSpar ); + hSpar = NULL; +#ifdef SBA_BR_SWITCHING_CLEAN_UP } - - free( hSpar ); - hSpar = NULL; +#endif } return; -- GitLab From 58a57c208c5910f6e7b5f7dd830db738fb1a0aed Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Mon, 6 Feb 2023 15:16:10 +0530 Subject: [PATCH 061/375] Minor modifications [x] Added missing braces in the undefined part of the clean up code [x] Proper indendation added to the encoder reconfiguration function --- lib_com/options.h | 2 +- lib_enc/ivas_sba_enc.c | 99 ++++++++++++++++++------------------- lib_enc/ivas_spar_encoder.c | 8 +-- 3 files changed, 52 insertions(+), 57 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 1cef4a5d83..b3491e38c3 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -145,7 +145,7 @@ #ifdef SBA_BR_SWITCHING #define SBA_BR_SWITCHING_RECONFIG /* Issue 114: Changes for SBA bitrate switching with reconfiguration for bitrates with different number of transport channels*/ #define SBA_BR_SWITCHING_COMPLEXITY_FIX /* VA: fix complexity overhead */ -#define SBA_BR_SWITCHING_CLEAN_UP +#define SBA_BR_SWITCHING_CLEAN_UP /*Issue 114: Clean up changes for the SBA reconfiguation functions*/ #endif #define FIX_I59_DELAY_ROUNDING /* Issue 59: rounding in sample domain instead of nanosec for IVAS_ENC_GetDelay() and IVAS_DEC_GetDelay() */ #define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index a0b59ac2b0..7bde5c3445 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -517,83 +517,82 @@ ivas_error ivas_sba_enc_reconfigure( } } } - } #ifndef SBA_BR_SWITCHING_CLEAN_UP - /* initalize delay for SPAR/DirAC delay synchronization */ - if ( ( st_ivas->sba_mode == SBA_MODE_DIRAC ) && ( ( sba_mode_old != st_ivas->sba_mode ) || ( nchan_transport_old != st_ivas->nchan_transport ) ) ) - { - int16_t n; - - if ( hDirAC->num_samples_synchro_delay == 0 ) + /* initalize delay for SPAR/DirAC delay synchronization */ + if ( ( st_ivas->sba_mode == SBA_MODE_DIRAC ) && ( ( sba_mode_old != st_ivas->sba_mode ) || ( nchan_transport_old != st_ivas->nchan_transport ) ) ) { - hDirAC->num_samples_synchro_delay = NS2SA( hEncoderConfig->input_Fs, IVAS_FB_ENC_DELAY_NS ); + int16_t n; - for ( n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) + if ( hDirAC->num_samples_synchro_delay == 0 ) { - if ( ( hDirAC->sba_synchro_buffer[n] = (float *) malloc( hDirAC->num_samples_synchro_delay * sizeof( float ) ) ) == NULL ) + hDirAC->num_samples_synchro_delay = NS2SA( hEncoderConfig->input_Fs, IVAS_FB_ENC_DELAY_NS ); + + for ( n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hDirAC synchro buffer\n" ) ); + if ( ( hDirAC->sba_synchro_buffer[n] = (float *) malloc( hDirAC->num_samples_synchro_delay * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hDirAC synchro buffer\n" ) ); + } + set_zero( hDirAC->sba_synchro_buffer[n], hDirAC->num_samples_synchro_delay ); + } + for ( ; n < DIRAC_MAX_ANA_CHANS; n++ ) + { + hDirAC->sba_synchro_buffer[n] = NULL; } - set_zero( hDirAC->sba_synchro_buffer[n], hDirAC->num_samples_synchro_delay ); - } - for ( ; n < DIRAC_MAX_ANA_CHANS; n++ ) - { - hDirAC->sba_synchro_buffer[n] = NULL; } } - } - else - { - for ( int16_t n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) + else { - if ( hDirAC->sba_synchro_buffer[n] != NULL ) + for ( int16_t n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) { - free( hDirAC->sba_synchro_buffer[n] ); - hDirAC->sba_synchro_buffer[n] = NULL; + if ( hDirAC->sba_synchro_buffer[n] != NULL ) + { + free( hDirAC->sba_synchro_buffer[n] ); + hDirAC->sba_synchro_buffer[n] = NULL; + } } + hDirAC->num_samples_synchro_delay = 0; } - hDirAC->num_samples_synchro_delay = 0; - } - } + #endif #endif - ivas_dirac_enc_reconfigure( st_ivas ); + } + ivas_dirac_enc_reconfigure( st_ivas ); #ifdef SBA_BR_SWITCHING - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) - { - mvs2s( hDirAC->dirac_to_spar_md_bands, hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); - hSpar->enc_param_start_band = hDirAC->hConfig->enc_param_start_band; - } + if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + { + mvs2s( hDirAC->dirac_to_spar_md_bands, hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); + hSpar->enc_param_start_band = hDirAC->hConfig->enc_param_start_band; + } #endif - /*-----------------------------------------------------------------* - * Allocate, initalize, and configure SCE/CPE/MCT handles - *-----------------------------------------------------------------*/ + /*-----------------------------------------------------------------* + * Allocate, initalize, and configure SCE/CPE/MCT handles + *-----------------------------------------------------------------*/ - ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ); + ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ); #ifdef SBA_BR_SWITCHING_RECONFIG - if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) - { - if ( ( sba_mode_old != st_ivas->sba_mode ) || ( nchan_transport_old != st_ivas->nchan_transport ) ) + if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) { - for ( int16_t sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + if ( ( sba_mode_old != st_ivas->sba_mode ) || ( nchan_transport_old != st_ivas->nchan_transport ) ) { - st_ivas->hSCE[sce_id]->hCoreCoder[0]->ini_frame = 1; - } + for ( int16_t sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + st_ivas->hSCE[sce_id]->hCoreCoder[0]->ini_frame = 1; + } - for ( int16_t cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - for ( int16_t n = 0; n < CPE_CHANNELS; n++ ) + for ( int16_t cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->ini_frame = 1; + for ( int16_t n = 0; n < CPE_CHANNELS; n++ ) + { + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->ini_frame = 1; + } } } } - } #endif -} - -return error; + } + return error; } diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index b90cb748e9..4b818ac160 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -76,6 +76,7 @@ ivas_error ivas_spar_enc_open( hEncoderConfig = st_ivas->hEncoderConfig; error = IVAS_ERR_OK; #ifdef SBA_BR_SWITCHING_CLEAN_UP + hSpar = st_ivas->hSpar; if ( !spar_reconfig_flag ) { #endif @@ -86,10 +87,6 @@ ivas_error ivas_spar_enc_open( } #ifdef SBA_BR_SWITCHING_CLEAN_UP } - else - { - hSpar = st_ivas->hSpar; - } #endif input_Fs = hEncoderConfig->input_Fs; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); @@ -128,8 +125,7 @@ ivas_error ivas_spar_enc_open( #ifdef SBA_BR_SWITCHING_CLEAN_UP /* initialization */ hSpar->hMdEnc->table_idx = -1; -#endif -#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) { #endif -- GitLab From c345cf5ad5d0684942428f6a967dbd65e665d45b Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Thu, 9 Feb 2023 14:24:11 +0100 Subject: [PATCH 062/375] add option to distinguish test files from each other to prevent simultaneous write errors --- tests/renderer/test_renderer.py | 2 ++ tests/renderer/utils.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index 287d9acf35..d2a96f300a 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -67,6 +67,7 @@ def test_ambisonics_binaural_headrotation_refrotzero(test_info, in_fmt, out_fmt, in_fmt, out_fmt, ref_kwargs={ + "name_extension": "refrotzero", "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv") }, cut_kwargs={ @@ -87,6 +88,7 @@ def test_ambisonics_binaural_headrotation_refrotequal(test_info, in_fmt, out_fmt in_fmt, out_fmt, ref_kwargs={ + "name_extension": "refrotequal", }, cut_kwargs={ "trj_file": HR_TRAJECTORY_DIR.joinpath("azi_plus_2-ele_plus_2-every-100-frames.csv"), diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index f95e687453..90a3353007 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -105,6 +105,7 @@ def run_renderer( metadata_input: Optional[str] = None, in_meta_files: Optional[list] = None, trj_file: Optional[str] = None, + name_extension: Optional[str] = None, refrot_file: Optional[str] = None, output_path_base: str = OUTPUT_PATH_CUT, binary_suffix: str = "", @@ -141,7 +142,7 @@ def run_renderer( in_file = FORMAT_TO_FILE[in_fmt] in_name = in_fmt - out_file = str(output_path_base.joinpath(f"{in_name}_to_{out_name}{trj_name}{refrot_name}.wav")) + out_file = str(output_path_base.joinpath(f"{in_name}_to_{out_name}{trj_name}{refrot_name}{name_extension}.wav")) cmd = RENDERER_CMD[:] cmd[2] = str(in_file) -- GitLab From da2ee7f1e399286cc0be1fd16c56bd8cdce34510 Mon Sep 17 00:00:00 2001 From: Jan Brouwer Date: Mon, 13 Feb 2023 11:16:57 +0100 Subject: [PATCH 063/375] Fix for -otr none option handling --- apps/decoder.c | 7 ++++++- apps/renderer.c | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/decoder.c b/apps/decoder.c index c322be3da8..82171ff2a9 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -904,6 +904,7 @@ static bool parseCmdlIVAS_dec( } else if ( strcmp( argv_to_upper, "-OTR" ) == 0 ) { +#ifndef FIX_I109_ORIENTATION_TRACKING if ( strlen( argv[i + 1] ) > 3 ) { fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", argv[i + 1] ); @@ -912,7 +913,9 @@ static bool parseCmdlIVAS_dec( } char tmp[4]; strcpy( tmp, argv[i + 1] ); +#endif #ifdef FIX_I109_ORIENTATION_TRACKING + char *tmp = to_upper( argv[i + 1] ); if ( strcmp( to_upper( tmp ), "NONE" ) == 0 ) { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; @@ -1150,10 +1153,12 @@ static void usage_dec( void ) fprintf( stdout, " default is OFF, if this option is not used\n" ); fprintf( stdout, "-force R : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" ); #endif - fprintf( stdout, "-otr tracking_type : head orientation tracking type: 'ref' or 'avg' (only for binaural rendering)\n" ); #ifdef FIX_I109_ORIENTATION_TRACKING + fprintf( stdout, "-otr tracking_type : head orientation tracking type: 'none', 'ref' or 'avg' (only for binaural rendering)\n" ); fprintf( stdout, "-rf File : Reference rotation specified by external trajectory file\n" ); fprintf( stdout, " works only in combination with -otr ref mode\n" ); +#else + fprintf( stdout, "-otr tracking_type : head orientation tracking type: 'ref' or 'avg' (only for binaural rendering)\n" ); #endif fprintf( stdout, "-render_config file : Renderer configuration file\n" ); fprintf( stdout, "-no_diegetic_pan : panning mono no dietic sound to stereo -1<= pan <=1,\n" ); diff --git a/apps/renderer.c b/apps/renderer.c index b083d22ba3..d254f6e126 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -236,7 +236,11 @@ static const CmdLnParser_Option cliOptions[] = { .id = CmdLnOptionId_orientationTracking, .match = "tracking_type", .matchShort = "otr", +#ifdef FIX_I109_ORIENTATION_TRACKING + .description = "Head orientation tracking type: 'none', 'ref' or 'avg' (only for BINAURAL and BINAURAL_ROOM)", +#else .description = "Head orientation tracking type: 'ref' or 'avg' (only for BINAURAL and BINAURAL_ROOM)", +#endif }, { .id = CmdlnOptionId_lfePosition, -- GitLab From 110840888ce49f7f93a0fa0468256424cddc9a5d Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Tue, 14 Feb 2023 14:03:16 +0530 Subject: [PATCH 064/375] Added fb_mixer optimisation --- lib_com/ivas_fb_mixer.c | 215 ++++++++++++++++++++++------------- lib_com/ivas_prot.h | 8 ++ lib_dec/ivas_spar_decoder.c | 8 ++ lib_enc/ivas_dirac_enc.c | 8 ++ lib_enc/ivas_ism_param_enc.c | 8 ++ lib_enc/ivas_mc_param_enc.c | 9 +- lib_enc/ivas_mcmasa_enc.c | 18 ++- lib_enc/ivas_sba_enc.c | 8 ++ lib_enc/ivas_spar_encoder.c | 10 +- 9 files changed, 207 insertions(+), 85 deletions(-) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 5787470e0f..517d91b39c 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -52,7 +52,11 @@ static void ivas_get_ld_fb_resp( float **ppIdeal_FRs_re, float **ppIdeal_FRs_im, static int16_t ivas_fb_mixer_get_band_diff_non48k( const int32_t sampling_rate, const float delay_ms ); static const float *ivas_get_cheby_ramp( const int16_t delay ); static void ivas_get_hanning_win( const int16_t len, float *pH_win ); +#ifdef SBA_BR_SWITCHING_CLEAN_UP +static ivas_error ivas_filterbank_setup( IVAS_FB_MIXER_HANDLE hFbMixer, const int32_t sampling_rate, const int16_t spar_reconfig_flag ); +#else static ivas_error ivas_filterbank_setup( IVAS_FB_MIXER_HANDLE hFbMixer, const int32_t sampling_rate ); +#endif static ivas_error ivas_fb_mixer_get_window( const int16_t fade_len, const int32_t sampling_rate, const float **pWindow ); @@ -175,6 +179,10 @@ ivas_error ivas_FB_mixer_open( IVAS_FB_MIXER_HANDLE *hFbMixer_out, /* i/o: FB mixer handle */ const int32_t sampling_rate, /* i : sampling rate */ IVAS_FB_CFG *fb_cfg /* i : FB config. handle */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + , + const int16_t spar_reconfig_flag +#endif ) { IVAS_FB_MIXER_HANDLE hFbMixer; @@ -185,24 +193,30 @@ ivas_error ivas_FB_mixer_open( error = IVAS_ERR_OK; frame_len = (int16_t) ( sampling_rate / FRAMES_PER_SEC ); - - - if ( ( hFbMixer = (IVAS_FB_MIXER_HANDLE) malloc( sizeof( IVAS_FB_MIXER_DATA ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); - } - - if ( fb_cfg->num_out_chans > 0 ) +#ifdef SBA_BR_SWITCHING_CLEAN_UP + hFbMixer = *hFbMixer_out; + if ( !spar_reconfig_flag ) { - if ( ( hFbMixer->pFb = (ivas_filterbank_t *) malloc( sizeof( ivas_filterbank_t ) ) ) == NULL ) +#endif + if ( ( hFbMixer = (IVAS_FB_MIXER_HANDLE) malloc( sizeof( IVAS_FB_MIXER_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); } + + if ( fb_cfg->num_out_chans > 0 ) + { + if ( ( hFbMixer->pFb = (ivas_filterbank_t *) malloc( sizeof( ivas_filterbank_t ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); + } + } + else + { + hFbMixer->pFb = NULL; + } +#ifdef SBA_BR_SWITCHING_CLEAN_UP } - else - { - hFbMixer->pFb = NULL; - } +#endif if ( fb_cfg->active_w_mixing == -1 ) { num_chs_alloc = 0; @@ -274,59 +288,67 @@ ivas_error ivas_FB_mixer_open( } } } - - if ( fb_cfg->num_out_chans > 0 ) +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) { - const int16_t *pActive_bins_per_band, *pActive_bins_per_band_abs, *pStart_offset, *pStart_offset_abs; +#endif + if ( fb_cfg->num_out_chans > 0 ) + { + const int16_t *pActive_bins_per_band, *pActive_bins_per_band_abs, *pStart_offset, *pStart_offset_abs; - num_bands = ivas_get_num_bands( sampling_rate ); + num_bands = ivas_get_num_bands( sampling_rate ); - ivas_get_active_bins( &pActive_bins_per_band, &pActive_bins_per_band_abs, &pStart_offset, &pStart_offset_abs, sampling_rate ); + ivas_get_active_bins( &pActive_bins_per_band, &pActive_bins_per_band_abs, &pStart_offset, &pStart_offset_abs, sampling_rate ); - if ( fb_cfg->active_w_mixing != -1 ) - { - for ( i = 0; i < num_bands; i++ ) + if ( fb_cfg->active_w_mixing != -1 ) { - if ( ( hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band[i] = (float *) malloc( sizeof( float ) * pActive_bins_per_band_abs[i] ) ) == NULL ) + for ( i = 0; i < num_bands; i++ ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); + if ( ( hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band[i] = (float *) malloc( sizeof( float ) * pActive_bins_per_band_abs[i] ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); + } } } - } - if ( sampling_rate != 48000 ) - { - int16_t num_diff_bands, start_diff_band_non48k; + if ( sampling_rate != 48000 ) + { + int16_t num_diff_bands, start_diff_band_non48k; - num_diff_bands = MAX_NUM_BANDS_DIFF_NON48K; - start_diff_band_non48k = num_bands - num_diff_bands; + num_diff_bands = MAX_NUM_BANDS_DIFF_NON48K; + start_diff_band_non48k = num_bands - num_diff_bands; - hFbMixer->num_diff_bands = num_diff_bands; + hFbMixer->num_diff_bands = num_diff_bands; - for ( j = start_diff_band_non48k; j < num_bands; j++ ) - { - if ( ( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j] = (float *) malloc( sizeof( float ) * pActive_bins_per_band[j] ) ) == NULL ) + for ( j = start_diff_band_non48k; j < num_bands; j++ ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); - } + if ( ( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j] = (float *) malloc( sizeof( float ) * pActive_bins_per_band[j] ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); + } - if ( ( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[1][j] = (float *) malloc( sizeof( float ) * pActive_bins_per_band[j] ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); + if ( ( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[1][j] = (float *) malloc( sizeof( float ) * pActive_bins_per_band[j] ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); + } } } } - } - else - { + else + { - /* ignore all the deeper filter bank stuff for now */ - hFbMixer->num_diff_bands = 0; + /* ignore all the deeper filter bank stuff for now */ + hFbMixer->num_diff_bands = 0; + } +#ifdef SBA_BR_SWITCHING_CLEAN_UP } - +#endif hFbMixer->fb_cfg = fb_cfg; - +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( ( error = ivas_filterbank_setup( hFbMixer, sampling_rate, spar_reconfig_flag ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_filterbank_setup( hFbMixer, sampling_rate ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -346,6 +368,10 @@ ivas_error ivas_FB_mixer_open( void ivas_FB_mixer_close( IVAS_FB_MIXER_HANDLE *hFbMixer_in, /* i/o: FB mixer handle */ const int32_t sampling_rate /* i : sampling rate in Hz */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + , + const int16_t spar_reconfig_flag +#endif ) { IVAS_FB_MIXER_HANDLE hFbMixer; @@ -404,50 +430,67 @@ void ivas_FB_mixer_close( free( hFbMixer->prior_mixer[0][0] ); hFbMixer->prior_mixer[0][0] = NULL; } - - if ( fb_cfg->num_out_chans > 0 ) +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) { - num_bands = hFbMixer->pFb->filterbank_num_bands; - - if ( fb_cfg->active_w_mixing != -1 ) +#endif + if ( fb_cfg->num_out_chans > 0 ) { - for ( i = 0; i < num_bands; i++ ) + num_bands = hFbMixer->pFb->filterbank_num_bands; + + if ( fb_cfg->active_w_mixing != -1 ) { - free( hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band[i] ); - hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band[i] = NULL; + for ( i = 0; i < num_bands; i++ ) + { + free( hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band[i] ); + hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band[i] = NULL; + } } - } - - if ( sampling_rate != 48000 ) - { - int16_t start_diff_band_non48k; - start_diff_band_non48k = num_bands - hFbMixer->num_diff_bands; - for ( j = start_diff_band_non48k; j < num_bands; j++ ) + if ( sampling_rate != 48000 ) { - free( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j] ); - hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j] = NULL; + int16_t start_diff_band_non48k; + start_diff_band_non48k = num_bands - hFbMixer->num_diff_bands; + + for ( j = start_diff_band_non48k; j < num_bands; j++ ) + { + free( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j] ); + hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j] = NULL; - free( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[1][j] ); - hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[1][j] = NULL; + free( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[1][j] ); + hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[1][j] = NULL; + } } } +#ifdef SBA_BR_SWITCHING_CLEAN_UP } - - if ( hFbMixer->pFb != NULL ) +#endif +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) { - free( hFbMixer->pFb ); - hFbMixer->pFb = NULL; +#endif + if ( hFbMixer->pFb != NULL ) + { + free( hFbMixer->pFb ); + hFbMixer->pFb = NULL; + } +#ifdef SBA_BR_SWITCHING_CLEAN_UP } - +#endif if ( hFbMixer->fb_cfg != NULL ) { free( hFbMixer->fb_cfg ); hFbMixer->fb_cfg = NULL; } - - free( hFbMixer ); - hFbMixer = NULL; +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) + { +#endif + free( hFbMixer ); + hFbMixer = NULL; +#ifdef SBA_BR_SWITCHING_CLEAN_UP + } +#endif } return; @@ -1014,7 +1057,12 @@ static void ivas_get_active_bins( static ivas_error ivas_filterbank_setup( IVAS_FB_MIXER_HANDLE hFbMixer, - const int32_t sampling_rate ) + const int32_t sampling_rate +#ifdef SBA_BR_SWITCHING_CLEAN_UP + , + const int16_t spar_reconfig_flag +#endif +) { int16_t i, j; const float *pAll_fb_fr[2]; @@ -1053,17 +1101,22 @@ static ivas_error ivas_filterbank_setup( hFbMixer->cross_fade_end_offset = pCfg->fade_len + pCfg->pcm_offset; hFbMixer->cross_fade_start_offset = hFbMixer->cross_fade_end_offset - pCfg->fade_len; hFbMixer->ana_window_offset = pCfg->fb_latency + pCfg->pcm_offset; - - if ( ( error = ivas_fb_mixer_get_window( pCfg->fb_latency, sampling_rate, &( hFbMixer->pAna_window ) ) ) != IVAS_ERR_OK ) +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) { - return error; - } +#endif + if ( ( error = ivas_fb_mixer_get_window( pCfg->fb_latency, sampling_rate, &( hFbMixer->pAna_window ) ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = ivas_fb_mixer_get_window( pCfg->fade_len, sampling_rate, &( hFbMixer->pFilterbank_cross_fade ) ) ) != IVAS_ERR_OK ) - { - return error; + if ( ( error = ivas_fb_mixer_get_window( pCfg->fade_len, sampling_rate, &( hFbMixer->pFilterbank_cross_fade ) ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef SBA_BR_SWITCHING_CLEAN_UP } - +#endif if ( pCfg->num_out_chans > 0 ) { ivas_filterbank_t *pFb = hFbMixer->pFb; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 89a548d6e1..774fad4b74 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5316,11 +5316,19 @@ ivas_error ivas_FB_mixer_open( IVAS_FB_MIXER_HANDLE *hFbMixer, /* i/o: FB mixer handle */ const int32_t sampling_rate, /* i : sampling rate */ IVAS_FB_CFG *fb_cfg /* i : FB config. handle */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + , + const int16_t spar_reconfig_flag +#endif ); void ivas_FB_mixer_close( IVAS_FB_MIXER_HANDLE *hFbMixer, /* i/o: FB mixer handle */ const int32_t sampling_rate /* i : sampling rate in Hz */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + , + const int16_t spar_reconfig_flag +#endif ); void ivas_fb_mixer_pcm_ingest( diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 119c4b1bc9..464df9285d 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -116,7 +116,11 @@ ivas_error ivas_spar_dec_open( fb_cfg->remix_order = remix_order_set[hSpar->hMdDec->spar_md_cfg.remix_unmix_order]; /* FB mixer handle */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( ( error = ivas_FB_mixer_open( &hSpar->hFbMixer, output_Fs, fb_cfg, spar_reconfig_flag ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_FB_mixer_open( &hSpar->hFbMixer, output_Fs, fb_cfg ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -217,7 +221,11 @@ void ivas_spar_dec_close( ivas_spar_td_decorr_dec_close( &hSpar->hTdDecorr ); /* FB mixer handle */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + ivas_FB_mixer_close( &hSpar->hFbMixer, output_Fs, spar_reconfig_flag ); +#else ivas_FB_mixer_close( &hSpar->hFbMixer, output_Fs ); +#endif #ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 92c2f80fad..fceb67d583 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -104,7 +104,11 @@ ivas_error ivas_dirac_enc_open( return error; } /* Allocate and initialize FB mixer handle */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -238,7 +242,11 @@ void ivas_dirac_enc_close( if ( hDirAC->hFbMixer != NULL ) { +#ifdef SBA_BR_SWITCHING_CLEAN_UP + ivas_FB_mixer_close( &hDirAC->hFbMixer, input_Fs, 0 ); +#else ivas_FB_mixer_close( &hDirAC->hFbMixer, input_Fs ); +#endif } for ( i = 0; i < DIRAC_MAX_ANA_CHANS; i++ ) diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index 98054cf51e..40f78939b9 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -281,7 +281,11 @@ ivas_error ivas_param_ism_enc_open( } /* Allocate and initialize FB mixer handle */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -322,7 +326,11 @@ void ivas_param_ism_enc_close( const int32_t input_Fs /* i : input sampling_rate */ ) { +#ifdef SBA_BR_SWITCHING_CLEAN_UP + ivas_FB_mixer_close( &hDirAC->hFbMixer, input_Fs, 0 ); +#else ivas_FB_mixer_close( &hDirAC->hFbMixer, input_Fs ); +#endif if ( hDirAC->hParamIsm != NULL ) { diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 5de51576e9..3921b3173a 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -146,7 +146,11 @@ ivas_error ivas_param_mc_enc_open( } /* Allocate and initialize FB mixer handle */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( ( error = ivas_FB_mixer_open( &( hParamMC->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_FB_mixer_open( &( hParamMC->hFbMixer ), input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -366,8 +370,11 @@ void ivas_param_mc_enc_close( const int32_t sampling_rate ) { ivas_param_mc_metadata_close( &hParamMC->hMetadataPMC ); - +#ifdef SBA_BR_SWITCHING_CLEAN_UP + ivas_FB_mixer_close( &hParamMC->hFbMixer, sampling_rate, 0 ); +#else ivas_FB_mixer_close( &hParamMC->hFbMixer, sampling_rate ); +#endif free( hParamMC ); diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index e456cb3b70..1b0c9d8c31 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -195,7 +195,11 @@ ivas_error ivas_mcmasa_enc_open( } /* Allocate and initialize FB mixer handle */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( ( error = ivas_FB_mixer_open( &( hMcMasa->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_FB_mixer_open( &( hMcMasa->hFbMixer ), input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -217,8 +221,11 @@ ivas_error ivas_mcmasa_enc_open( { return error; } - +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( ( error = ivas_FB_mixer_open( &( hMcMasa->hFbMixerLfe ), input_Fs, fb_cfgLfe, 0 ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_FB_mixer_open( &( hMcMasa->hFbMixerLfe ), input_Fs, fb_cfgLfe ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -465,12 +472,19 @@ void ivas_mcmasa_enc_close( free( hMcMasa->lfeAnaRingBuffer[i] ); } } - +#ifdef SBA_BR_SWITCHING_CLEAN_UP + ivas_FB_mixer_close( &hMcMasa->hFbMixer, input_Fs, 0 ); +#else ivas_FB_mixer_close( &hMcMasa->hFbMixer, input_Fs ); +#endif if ( !hMcMasa->separateChannelEnabled ) { +#ifdef SBA_BR_SWITCHING_CLEAN_UP + ivas_FB_mixer_close( &hMcMasa->hFbMixerLfe, input_Fs, 0 ); +#else ivas_FB_mixer_close( &hMcMasa->hFbMixerLfe, input_Fs ); +#endif } /* intensity 3-dim */ diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index 7bde5c3445..ee46e7d955 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -418,7 +418,11 @@ ivas_error ivas_sba_enc_reconfigure( // VE: TBV whether 'hFbMixer' can be reused if ( hDirAC->hFbMixer != NULL ) { +#ifndef SBA_BR_SWITCHING_CLEAN_UP ivas_FB_mixer_close( &( hDirAC->hFbMixer ), hEncoderConfig->input_Fs ); +#else + ivas_FB_mixer_close( &( hDirAC->hFbMixer ), hEncoderConfig->input_Fs, 0 ); +#endif hDirAC->hFbMixer = NULL; } @@ -492,7 +496,11 @@ ivas_error ivas_sba_enc_reconfigure( } /* Allocate and initialize FB mixer handle */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), hEncoderConfig->input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), hEncoderConfig->input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 4b818ac160..80bc9da9df 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -111,8 +111,12 @@ ivas_error ivas_spar_enc_open( ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_SPAR, nchan_inp, nchan_transport, active_w_mixing, input_Fs ); fb_cfg->remix_order = remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order]; - /* FB mixer handle */ +/* FB mixer handle */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( ( error = ivas_FB_mixer_open( &( hSpar->hFbMixer ), input_Fs, fb_cfg, spar_reconfig_flag ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_FB_mixer_open( &( hSpar->hFbMixer ), input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -282,7 +286,11 @@ void ivas_spar_enc_close( ivas_spar_covar_enc_close( &hSpar->hCovEnc, num_chans ); /* FB mixer handle */ +#ifdef SBA_BR_SWITCHING_CLEAN_UP + ivas_FB_mixer_close( &hSpar->hFbMixer, input_Fs, spar_reconfig_flag ); +#else ivas_FB_mixer_close( &hSpar->hFbMixer, input_Fs ); +#endif #ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { -- GitLab From e6a63766ac62fc392c39a0ac3c5612bee974459f Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Tue, 14 Feb 2023 16:56:51 +0530 Subject: [PATCH 065/375] Fb_mixer optimisation changes : set 2 --- lib_com/ivas_fb_mixer.c | 131 +++++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 62 deletions(-) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 517d91b39c..2f3ae8d981 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -1126,87 +1126,94 @@ static ivas_error ivas_filterbank_setup( pFb->fb_consts.pFilterbank_bins_start_offset = pAll_bins_start_offset; pFb->fb_bin_to_band.pFb_active_bins_per_band = pAll_bins_per_band_abs; pFb->fb_bin_to_band.pFb_start_bin_per_band = pAll_bins_start_offset_abs; +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) + { +#endif + /* Initialization for short stride Parameter calculation and SPAR CLDFB reconstruction */ + pFb->fb_bin_to_band.num_cldfb_bands = ( int16_t )( sampling_rate * INV_CLDFB_BANDWIDTH + 0.5f ); + /*pFb->fb_bin_to_band.cldfb_stride = ( int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX );*/ /* equals num_cldfb_bands*/ + pFb->fb_bin_to_band.short_stride = ( int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / 4 ); - /* Initialization for short stride Parameter calculation and SPAR CLDFB reconstruction */ - pFb->fb_bin_to_band.num_cldfb_bands = (int16_t) ( sampling_rate * INV_CLDFB_BANDWIDTH + 0.5f ); - /*pFb->fb_bin_to_band.cldfb_stride = ( int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX );*/ /* equals num_cldfb_bands*/ - pFb->fb_bin_to_band.short_stride = (int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / 4 ); - set_f( pFb->fb_bin_to_band.p_short_stride_bin_to_band, 0.0f, 2 * MDFT_FB_BANDS_240 ); - set_s( pFb->fb_bin_to_band.p_cldfb_map_to_spar_band, 0, CLDFB_NO_CHANNELS_MAX ); - set_s( pFb->fb_bin_to_band.p_spar_start_bands, 0, CLDFB_NO_CHANNELS_MAX ); + set_f( pFb->fb_bin_to_band.p_short_stride_bin_to_band, 0.0f, 2 * MDFT_FB_BANDS_240 ); + set_s( pFb->fb_bin_to_band.p_cldfb_map_to_spar_band, 0, CLDFB_NO_CHANNELS_MAX ); + set_s( pFb->fb_bin_to_band.p_spar_start_bands, 0, CLDFB_NO_CHANNELS_MAX ); - for ( j = 0; j < IVAS_MAX_NUM_FB_BANDS; j++ ) - { - pFb->fb_bin_to_band.p_short_stride_num_bins_per_band[j] = 0; /* aka num_active_bins per SPAR band */ - pFb->fb_bin_to_band.p_short_stride_start_bin_per_band[j] = 0; /* first considered bin index per SPAR band */ - pFb->fb_bin_to_band.pp_short_stride_bin_to_band[j] = NULL; - for ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) + for ( j = 0; j < IVAS_MAX_NUM_FB_BANDS; j++ ) { - pFb->fb_bin_to_band.pp_cldfb_weights_per_spar_band[i][j] = 0.0f; + pFb->fb_bin_to_band.p_short_stride_num_bins_per_band[j] = 0; /* aka num_active_bins per SPAR band */ + pFb->fb_bin_to_band.p_short_stride_start_bin_per_band[j] = 0; /* first considered bin index per SPAR band */ + pFb->fb_bin_to_band.pp_short_stride_bin_to_band[j] = NULL; + for ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) + { + pFb->fb_bin_to_band.pp_cldfb_weights_per_spar_band[i][j] = 0.0f; + } } - } - if ( sampling_rate == 48000 ) - { - for ( j = 0; j < pFb->filterbank_num_bands; j++ ) + if ( sampling_rate == 48000 ) { - pFb->fb_consts.ppFilterbank_FRs[0][j] = &pAll_fb_fr[0][offset]; - pFb->fb_consts.ppFilterbank_FRs[1][j] = &pAll_fb_fr[1][offset]; - offset += pFb->fb_consts.pFilterbank_bins_per_band[j]; + for ( j = 0; j < pFb->filterbank_num_bands; j++ ) + { + pFb->fb_consts.ppFilterbank_FRs[0][j] = &pAll_fb_fr[0][offset]; + pFb->fb_consts.ppFilterbank_FRs[1][j] = &pAll_fb_fr[1][offset]; + offset += pFb->fb_consts.pFilterbank_bins_per_band[j]; + } + + ivas_calculate_abs_fr( pFb, sampling_rate, pCfg->active_w_mixing ); } + else + { + float *ppFilterbank_FRs_re_temp[MAX_NUM_BANDS_DIFF_NON48K]; + float *ppFilterbank_FRs_im_temp[MAX_NUM_BANDS_DIFF_NON48K]; + int16_t active_bins_temp[MAX_NUM_BANDS_DIFF_NON48K]; + int16_t start_offset_temp[MAX_NUM_BANDS_DIFF_NON48K]; + int16_t num_diff_bands, start_diff_band_non48k; - ivas_calculate_abs_fr( pFb, sampling_rate, pCfg->active_w_mixing ); - } - else - { - float *ppFilterbank_FRs_re_temp[MAX_NUM_BANDS_DIFF_NON48K]; - float *ppFilterbank_FRs_im_temp[MAX_NUM_BANDS_DIFF_NON48K]; - int16_t active_bins_temp[MAX_NUM_BANDS_DIFF_NON48K]; - int16_t start_offset_temp[MAX_NUM_BANDS_DIFF_NON48K]; - int16_t num_diff_bands, start_diff_band_non48k; + num_diff_bands = MAX_NUM_BANDS_DIFF_NON48K; + start_diff_band_non48k = pFb->filterbank_num_bands - num_diff_bands; - num_diff_bands = MAX_NUM_BANDS_DIFF_NON48K; - start_diff_band_non48k = pFb->filterbank_num_bands - num_diff_bands; + pFb->fb_consts.pFilterbank_bins_per_band = pAll_bins_per_band; + pFb->fb_consts.pFilterbank_bins_start_offset = pAll_bins_start_offset; - pFb->fb_consts.pFilterbank_bins_per_band = pAll_bins_per_band; - pFb->fb_consts.pFilterbank_bins_start_offset = pAll_bins_start_offset; + for ( j = 0; j < pFb->filterbank_num_bands; j++ ) + { + int16_t num_active_bins = pFb->fb_consts.pFilterbank_bins_per_band[j]; - for ( j = 0; j < pFb->filterbank_num_bands; j++ ) - { - int16_t num_active_bins = pFb->fb_consts.pFilterbank_bins_per_band[j]; + if ( j < start_diff_band_non48k ) + { + pFb->fb_consts.ppFilterbank_FRs[0][j] = &pAll_fb_fr[0][offset]; + pFb->fb_consts.ppFilterbank_FRs[1][j] = &pAll_fb_fr[1][offset]; + } + else + { + mvr2r( &pAll_fb_fr[0][offset], pFb->fb_consts.ppFilterbank_FRs_non48k[0][j], num_active_bins ); + mvr2r( &pAll_fb_fr[1][offset], pFb->fb_consts.ppFilterbank_FRs_non48k[1][j], num_active_bins ); + } - if ( j < start_diff_band_non48k ) - { - pFb->fb_consts.ppFilterbank_FRs[0][j] = &pAll_fb_fr[0][offset]; - pFb->fb_consts.ppFilterbank_FRs[1][j] = &pAll_fb_fr[1][offset]; + offset += pAll_bins_per_band_48k[j]; } - else + + for ( j = start_diff_band_non48k; j < pFb->filterbank_num_bands; j++ ) { - mvr2r( &pAll_fb_fr[0][offset], pFb->fb_consts.ppFilterbank_FRs_non48k[0][j], num_active_bins ); - mvr2r( &pAll_fb_fr[1][offset], pFb->fb_consts.ppFilterbank_FRs_non48k[1][j], num_active_bins ); + ppFilterbank_FRs_re_temp[j - start_diff_band_non48k] = pFb->fb_consts.ppFilterbank_FRs_non48k[0][j]; + ppFilterbank_FRs_im_temp[j - start_diff_band_non48k] = pFb->fb_consts.ppFilterbank_FRs_non48k[1][j]; + active_bins_temp[j - start_diff_band_non48k] = pFb->fb_consts.pFilterbank_bins_per_band[j]; + start_offset_temp[j - start_diff_band_non48k] = pFb->fb_consts.pFilterbank_bins_start_offset[j]; } - offset += pAll_bins_per_band_48k[j]; - } + ivas_get_ld_fb_resp( ppFilterbank_FRs_re_temp, ppFilterbank_FRs_im_temp, ppFilterbank_FRs_re_temp, ppFilterbank_FRs_im_temp, + active_bins_temp, start_offset_temp, num_diff_bands, pCfg->fb_latency, sampling_rate ); - for ( j = start_diff_band_non48k; j < pFb->filterbank_num_bands; j++ ) - { - ppFilterbank_FRs_re_temp[j - start_diff_band_non48k] = pFb->fb_consts.ppFilterbank_FRs_non48k[0][j]; - ppFilterbank_FRs_im_temp[j - start_diff_band_non48k] = pFb->fb_consts.ppFilterbank_FRs_non48k[1][j]; - active_bins_temp[j - start_diff_band_non48k] = pFb->fb_consts.pFilterbank_bins_per_band[j]; - start_offset_temp[j - start_diff_band_non48k] = pFb->fb_consts.pFilterbank_bins_start_offset[j]; - } - - ivas_get_ld_fb_resp( ppFilterbank_FRs_re_temp, ppFilterbank_FRs_im_temp, ppFilterbank_FRs_re_temp, ppFilterbank_FRs_im_temp, - active_bins_temp, start_offset_temp, num_diff_bands, pCfg->fb_latency, sampling_rate ); + for ( j = start_diff_band_non48k; j < pFb->filterbank_num_bands; j++ ) + { + pFb->fb_consts.ppFilterbank_FRs[0][j] = (const float *) pFb->fb_consts.ppFilterbank_FRs_non48k[0][j]; + pFb->fb_consts.ppFilterbank_FRs[1][j] = (const float *) pFb->fb_consts.ppFilterbank_FRs_non48k[1][j]; + } - for ( j = start_diff_band_non48k; j < pFb->filterbank_num_bands; j++ ) - { - pFb->fb_consts.ppFilterbank_FRs[0][j] = (const float *) pFb->fb_consts.ppFilterbank_FRs_non48k[0][j]; - pFb->fb_consts.ppFilterbank_FRs[1][j] = (const float *) pFb->fb_consts.ppFilterbank_FRs_non48k[1][j]; + ivas_calculate_abs_fr( pFb, sampling_rate, pCfg->active_w_mixing ); } - - ivas_calculate_abs_fr( pFb, sampling_rate, pCfg->active_w_mixing ); +#ifdef SBA_BR_SWITCHING_CLEAN_UP } +#endif } return error; -- GitLab From e7b3fc0ab2d694ed376dee6f438b59456e776be9 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Tue, 14 Feb 2023 18:03:38 +0530 Subject: [PATCH 066/375] fb_mixer optimisation changes : set 3 --- lib_com/ivas_fb_mixer.c | 75 +++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 41 deletions(-) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 2f3ae8d981..3eb11ec384 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -193,6 +193,7 @@ ivas_error ivas_FB_mixer_open( error = IVAS_ERR_OK; frame_len = (int16_t) ( sampling_rate / FRAMES_PER_SEC ); + #ifdef SBA_BR_SWITCHING_CLEAN_UP hFbMixer = *hFbMixer_out; if ( !spar_reconfig_flag ) @@ -464,8 +465,7 @@ void ivas_FB_mixer_close( } #ifdef SBA_BR_SWITCHING_CLEAN_UP } -#endif -#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) { #endif @@ -1079,32 +1079,32 @@ static ivas_error ivas_filterbank_setup( set_s( hFbMixer->first_frame, 1, pCfg->num_out_chans ); set_s( hFbMixer->first_frame + pCfg->num_out_chans, 0, IVAS_SPAR_MAX_CH - pCfg->num_out_chans ); - - if ( pCfg->num_out_chans > 0 ) +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) { - hFbMixer->pFb->filterbank_num_bands = ivas_get_num_bands( sampling_rate ); +#endif + if ( pCfg->num_out_chans > 0 ) + { + hFbMixer->pFb->filterbank_num_bands = ivas_get_num_bands( sampling_rate ); - ivas_get_active_bins( &pAll_bins_per_band, &pAll_bins_per_band_abs, &pAll_bins_start_offset, &pAll_bins_start_offset_abs, sampling_rate ); + ivas_get_active_bins( &pAll_bins_per_band, &pAll_bins_per_band_abs, &pAll_bins_start_offset, &pAll_bins_start_offset_abs, sampling_rate ); - if ( pCfg->fb_latency == NS2SA( sampling_rate, DELAY_FB_1_NS ) ) - { - pAll_fb_fr[0] = ivas_fb_fr_12band_1ms_re; - pAll_fb_fr[1] = ivas_fb_fr_12band_1ms_im; - pAll_bins_per_band_48k = ivas_fb_bins_per_band_12band_1ms[0]; - } - else - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong FB in ivas_filterbank_setup()!" ); + if ( pCfg->fb_latency == NS2SA( sampling_rate, DELAY_FB_1_NS ) ) + { + pAll_fb_fr[0] = ivas_fb_fr_12band_1ms_re; + pAll_fb_fr[1] = ivas_fb_fr_12band_1ms_im; + pAll_bins_per_band_48k = ivas_fb_bins_per_band_12band_1ms[0]; + } + else + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong FB in ivas_filterbank_setup()!" ); + } } - } - hFbMixer->cross_fade_end_offset = pCfg->fade_len + pCfg->pcm_offset; - hFbMixer->cross_fade_start_offset = hFbMixer->cross_fade_end_offset - pCfg->fade_len; - hFbMixer->ana_window_offset = pCfg->fb_latency + pCfg->pcm_offset; -#ifdef SBA_BR_SWITCHING_CLEAN_UP - if ( !spar_reconfig_flag ) - { -#endif + hFbMixer->cross_fade_end_offset = pCfg->fade_len + pCfg->pcm_offset; + hFbMixer->cross_fade_start_offset = hFbMixer->cross_fade_end_offset - pCfg->fade_len; + hFbMixer->ana_window_offset = pCfg->fb_latency + pCfg->pcm_offset; + if ( ( error = ivas_fb_mixer_get_window( pCfg->fb_latency, sampling_rate, &( hFbMixer->pAna_window ) ) ) != IVAS_ERR_OK ) { return error; @@ -1114,22 +1114,16 @@ static ivas_error ivas_filterbank_setup( { return error; } -#ifdef SBA_BR_SWITCHING_CLEAN_UP - } -#endif - if ( pCfg->num_out_chans > 0 ) - { - ivas_filterbank_t *pFb = hFbMixer->pFb; - int16_t offset = 0; - - pFb->fb_consts.pFilterbank_bins_per_band = pAll_bins_per_band; - pFb->fb_consts.pFilterbank_bins_start_offset = pAll_bins_start_offset; - pFb->fb_bin_to_band.pFb_active_bins_per_band = pAll_bins_per_band_abs; - pFb->fb_bin_to_band.pFb_start_bin_per_band = pAll_bins_start_offset_abs; -#ifdef SBA_BR_SWITCHING_CLEAN_UP - if ( !spar_reconfig_flag ) + if ( pCfg->num_out_chans > 0 ) { -#endif + ivas_filterbank_t *pFb = hFbMixer->pFb; + int16_t offset = 0; + + pFb->fb_consts.pFilterbank_bins_per_band = pAll_bins_per_band; + pFb->fb_consts.pFilterbank_bins_start_offset = pAll_bins_start_offset; + pFb->fb_bin_to_band.pFb_active_bins_per_band = pAll_bins_per_band_abs; + pFb->fb_bin_to_band.pFb_start_bin_per_band = pAll_bins_start_offset_abs; + /* Initialization for short stride Parameter calculation and SPAR CLDFB reconstruction */ pFb->fb_bin_to_band.num_cldfb_bands = ( int16_t )( sampling_rate * INV_CLDFB_BANDWIDTH + 0.5f ); /*pFb->fb_bin_to_band.cldfb_stride = ( int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX );*/ /* equals num_cldfb_bands*/ @@ -1211,11 +1205,10 @@ static ivas_error ivas_filterbank_setup( ivas_calculate_abs_fr( pFb, sampling_rate, pCfg->active_w_mixing ); } -#ifdef SBA_BR_SWITCHING_CLEAN_UP } -#endif +#ifdef SBA_BR_SWITCHING_CLEAN_UP } - +#endif return error; } -- GitLab From c482aa65b6c7a35a71c920ba5a824736e900d050 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 15 Feb 2023 10:54:25 +0100 Subject: [PATCH 067/375] merge with main --- apps/decoder.c | 90 ++- apps/encoder.c | 31 +- apps/renderer.c | 9 + lib_com/common_api_types.h | 4 - lib_com/delay_comp.c | 2 +- lib_com/ivas_cnst.h | 19 +- lib_com/ivas_prot.h | 49 +- lib_com/options.h | 16 +- lib_dec/core_dec_init.c | 4 - lib_dec/ivas_core_dec.c | 23 + lib_dec/ivas_cpe_dec.c | 36 +- lib_dec/ivas_dec.c | 25 +- lib_dec/ivas_dirac_dec.c | 2 +- lib_dec/ivas_dirac_dec_binaural_functions.c | 22 +- lib_dec/ivas_init_dec.c | 79 ++- lib_dec/ivas_ism_param_dec.c | 10 - lib_dec/ivas_ism_renderer.c | 2 +- lib_dec/ivas_lfe_dec.c | 4 - lib_dec/ivas_mcmasa_dec.c | 8 - lib_dec/ivas_mct_dec.c | 42 +- lib_dec/ivas_post_proc.c | 11 + lib_dec/ivas_rom_dec.c | 22 +- lib_dec/ivas_rom_dec.h | 9 +- lib_dec/ivas_sba_dec.c | 21 +- lib_dec/ivas_sba_dirac_stereo_dec.c | 616 ++++++++++++++++---- lib_dec/ivas_spar_md_dec.c | 2 +- lib_dec/ivas_stat_dec.h | 16 +- lib_dec/ivas_stereo_dft_dec.c | 292 +++++++++- lib_dec/ivas_stereo_switching_dec.c | 19 +- lib_dec/lib_dec.c | 4 - lib_dec/lib_dec.h | 2 - lib_rend/ivas_binauralRenderer.c | 82 +-- lib_rend/ivas_binaural_reverb.c | 22 - lib_rend/ivas_crend.c | 28 +- lib_rend/ivas_hrtf.c | 11 +- lib_rend/ivas_lib_rend_internal.h | 4 - lib_rend/ivas_objectRenderer.c | 313 +++++++++- lib_rend/ivas_orient_trk.c | 14 +- lib_rend/ivas_reverb_utils.c | 45 -- lib_rend/ivas_rom_TdBinauralRenderer.c | 2 - lib_rend/ivas_rom_TdBinauralRenderer.h | 2 - lib_rend/ivas_rom_binauralRenderer.c | 48 -- lib_rend/ivas_rom_binauralRenderer.h | 21 - lib_rend/ivas_rotation.c | 6 +- lib_rend/ivas_stat_rend.h | 9 - lib_rend/lib_rend.c | 54 +- lib_util/hrtf_file_reader.c | 102 +++- lib_util/hrtf_file_reader.h | 4 - scripts/config/self_test.prm | 64 +- scripts/config/self_test_evs.prm | 8 +- scripts/pyaudio3dtools/audio3dtools.py | 4 + 51 files changed, 1605 insertions(+), 729 deletions(-) mode change 100644 => 100755 lib_dec/ivas_cpe_dec.c mode change 100644 => 100755 lib_dec/ivas_sba_dirac_stereo_dec.c mode change 100644 => 100755 lib_dec/ivas_stat_dec.h mode change 100644 => 100755 lib_dec/ivas_stereo_dft_dec.c diff --git a/apps/decoder.c b/apps/decoder.c index 1382884353..ac2eb7cfb3 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -102,10 +102,8 @@ typedef struct float FER; bool hrtfReaderEnabled; char *hrtfFileName; -#ifdef HRTF_BINARY_FILE bool hrtfCRendReaderEnabled; char *hrtfCRendFileName; -#endif IVAS_DEC_INPUT_FORMAT inputFormat; bool customLsOutputEnabled; char *customLsSetupFilename; @@ -475,7 +473,6 @@ int main( goto cleanup; } -#ifdef HRTF_BINARY_FILE IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF; IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ); @@ -501,7 +498,6 @@ int main( { fprintf( stderr, "\nError in loading HRTF binary file %s for parametric binauralizer \n\n", arg.hrtfCRendFileName ); } -#endif } /*-----------------------------------------------------------------* @@ -572,6 +568,11 @@ cleanup: IVAS_DEC_HRTF_HANDLE hHrtfTD; IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ); dealloc_HRTF_binary( hHrtfTD ); +#ifdef FIX_MEMORY_COUNTING_HRTF_BINARY_FILE + IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF; + IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ); + destroy_SetOfHRTF( hSetOfHRTF ); +#endif } IVAS_DEC_Close( &hIvasDec ); CustomLsReader_close( &hLsCustomReader ); @@ -623,6 +624,9 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config( char argv_to_upper[FILENAME_MAX]; strncpy( argv_to_upper, argv, sizeof( argv_to_upper ) - 1 ); +#ifdef FIX_343_TO_UPPER + argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; +#endif to_upper( argv_to_upper ); if ( strcmp( argv_to_upper, "EXT" ) == 0 ) /* external renderer */ @@ -701,7 +705,9 @@ static bool parseCmdlIVAS_dec( char argv_to_upper[FILENAME_MAX]; #ifdef DEBUGGING float ftmp; +#ifndef FIX_343_TO_UPPER char stmp[FILENAME_MAX]; +#endif arg->forcedRendMode = IVAS_DEC_FORCE_REND_UNFORCED; arg->forceSubframeBinauralization = false; @@ -737,10 +743,8 @@ static bool parseCmdlIVAS_dec( arg->hrtfReaderEnabled = false; arg->hrtfFileName = NULL; -#ifdef HRTF_BINARY_FILE arg->hrtfCRendReaderEnabled = false; arg->hrtfCRendFileName = NULL; -#endif arg->customLsOutputEnabled = false; arg->customLsSetupFilename = NULL; @@ -771,6 +775,9 @@ static bool parseCmdlIVAS_dec( while ( argv[i][0] == '-' ) { strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); +#ifdef FIX_343_TO_UPPER + argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; +#endif to_upper( argv_to_upper ); if ( strcmp( argv_to_upper, "-VOIP" ) == 0 ) @@ -778,13 +785,21 @@ static bool parseCmdlIVAS_dec( arg->voipMode = 1; i++; } +#ifdef FIX_343_TO_UPPER + else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=0" ) == 0 ) +#else else if ( strcmp( to_upper( argv[i] ), "-VOIP_HF_ONLY=0" ) == 0 ) +#endif { arg->voipMode = 1; arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP; i++; } +#ifdef FIX_343_TO_UPPER + else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=1" ) == 0 ) +#else else if ( strcmp( to_upper( argv[i] ), "-VOIP_HF_ONLY=1" ) == 0 ) +#endif { arg->voipMode = 1; arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF; @@ -857,8 +872,14 @@ static bool parseCmdlIVAS_dec( i++; if ( i < argc - 3 ) { +#ifdef FIX_343_TO_UPPER + strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); + argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; + arg->forcedRendMode = parseForcedRendModeDec( argv_to_upper ); +#else strncpy( stmp, argv[i], sizeof( stmp ) ); arg->forcedRendMode = parseForcedRendModeDec( stmp ); +#endif i++; } } @@ -911,10 +932,31 @@ static bool parseCmdlIVAS_dec( usage_dec(); return false; } + +#ifdef FIX_343_TO_UPPER + strncpy( argv_to_upper, argv[i + 1], sizeof( argv_to_upper ) - 1 ); + argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; + to_upper( argv_to_upper ); + + if ( strcmp( argv_to_upper, "REF" ) == 0 ) + { + arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; + } + else if ( strcmp( argv_to_upper, "AVG" ) == 0 ) + { + arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_AVG; + } + else + { + fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", argv[i + 1] ); + usage_dec(); + return false; + } +#else char tmp[4]; strcpy( tmp, argv[i + 1] ); #endif -#ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef FIX_I109_ORIENTATION_TRACKING // TODO @Philips needs merge with FIX_343_TO_UPPER char *tmp = to_upper( argv[i + 1] ); if ( strcmp( to_upper( tmp ), "NONE" ) == 0 ) { @@ -922,6 +964,7 @@ static bool parseCmdlIVAS_dec( } else if ( strcmp( to_upper( tmp ), "REF" ) == 0 ) #else + if ( strcmp( to_upper( tmp ), "REF" ) == 0 ) #endif { @@ -937,6 +980,7 @@ static bool parseCmdlIVAS_dec( usage_dec(); return false; } +#endif i += 2; } #ifdef FIX_I109_ORIENTATION_TRACKING @@ -980,6 +1024,33 @@ static bool parseCmdlIVAS_dec( return false; } +#ifdef FIX_343_TO_UPPER + strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); + argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; + if ( ( strcmp( argv_to_upper, "CENTER" ) == 0 ) || ( strchr( argv_to_upper, 'C' ) != NULL ) ) + { + arg->no_diegetic_pan = 0.f; + } + else if ( ( strcmp( argv_to_upper, "LEFT" ) == 0 ) || ( strchr( argv_to_upper, 'L' ) != NULL ) ) + { + arg->no_diegetic_pan = -1.f; + } + else if ( ( strcmp( argv_to_upper, "RIGHT" ) == 0 ) || ( strchr( argv_to_upper, 'R' ) != NULL ) ) + { + arg->no_diegetic_pan = 1.f; + } + else + { + arg->no_diegetic_pan = (float) atof( argv_to_upper ); + + if ( arg->no_diegetic_pan > 1.0f || arg->no_diegetic_pan < -1.0f ) + { + fprintf( stderr, "Error: Incorrect value for panning option argument specified: %s\n\n", argv[i] ); + usage_dec(); + return false; + } + } +#else char *param = to_upper( argv[i] ); if ( ( strcmp( param, "CENTER" ) == 0 ) || ( strchr( param, 'C' ) != NULL ) ) { @@ -1004,6 +1075,7 @@ static bool parseCmdlIVAS_dec( return false; } } +#endif i++; } @@ -1138,11 +1210,7 @@ static void usage_dec( void ) fprintf( stdout, " which of the two supported formats is in use.\n" ); fprintf( stdout, " default bitstream file format is G.192\n" ); fprintf( stdout, "-T File : Head rotation specified by external trajectory File\n" ); -#ifdef HRTF_BINARY_FILE fprintf( stdout, "-hrtf File : HRTF filter File used in BINAURAL output configuration\n" ); -#else - fprintf( stdout, "-hrtf File : HRTF filter File used in ISm format and BINAURAL output configuration\n" ); -#endif #ifdef DEBUGGING fprintf( stdout, "-force_subframe_bin : Forces parametric binauralizer code to use 5 ms time resolution even when\n" ); fprintf( stdout, " output time resolution is larger.\n" ); diff --git a/apps/encoder.c b/apps/encoder.c index b73e3d27f9..2aab6d5ae8 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -884,7 +884,11 @@ static bool parseCmdlIVAS_enc( while ( i < argc - 4 ) { strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); +#ifdef FIX_343_TO_UPPER + argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; +#endif to_upper( argv_to_upper ); + /*-----------------------------------------------------------------* * Bandwidth limitation *-----------------------------------------------------------------*/ @@ -894,6 +898,9 @@ static bool parseCmdlIVAS_enc( arg->max_bwidth_user = true; strncpy( stmp, argv[i + 1], sizeof( stmp ) - 1 ); +#ifdef FIX_343_TO_UPPER + stmp[sizeof( stmp ) - 1] = '\0'; +#endif to_upper( stmp ); if ( strcmp( stmp, "-NB" ) == 0 || strcmp( stmp, "NB" ) == 0 ) @@ -1081,7 +1088,9 @@ static bool parseCmdlIVAS_enc( if ( i < argc - 4 ) { strncpy( stmp, argv[i], sizeof( stmp ) ); - +#ifdef FIX_343_TO_UPPER + stmp[sizeof( stmp ) - 1] = '\0'; +#endif to_upper( argv[i] ); if ( strcmp( argv[i], "LO" ) == 0 ) { @@ -1369,6 +1378,25 @@ static bool parseCmdlIVAS_enc( if ( i < argc - 4 ) { +#ifdef FIX_343_TO_UPPER + if ( strcmp( argv[i], "5_1" ) == 0 ) + { + arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1; + } + else if ( strcmp( argv[i], "7_1" ) == 0 ) + { + arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_7_1; + } + else if ( strcmp( argv[i], "5_1_2" ) == 0 ) + { + arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_2; + } + else if ( strcmp( argv[i], "5_1_4" ) == 0 ) + { + arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_4; + } + else if ( strcmp( argv[i], "7_1_4" ) == 0 ) +#else if ( strcmp( to_upper( argv[i] ), "5_1" ) == 0 ) { arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1; @@ -1386,6 +1414,7 @@ static bool parseCmdlIVAS_enc( arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_4; } else if ( strcmp( to_upper( argv[i] ), "7_1_4" ) == 0 ) +#endif { arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_7_1_4; } diff --git a/apps/renderer.c b/apps/renderer.c index 3c88b9dd35..5936add157 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -504,6 +504,9 @@ static void setupWithSingleFormatInput( /* It is allowed on CLI to have no metadata for an ISM input - skip opening if string is empty or contains "NULL" */ char charBuf[FILENAME_MAX]; strncpy( charBuf, args.inMetadataFilePaths[i], min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1 ); +#ifdef FIX_343_TO_UPPER + charBuf[min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1] = '\0'; +#endif to_upper( charBuf ); if ( isEmptyString( args.inMetadataFilePaths[i] ) || strncmp( charBuf, "NULL", 4 ) == 0 ) { @@ -1177,6 +1180,9 @@ static bool parseInConfig( /* First check if input is being set to scene description file - this is not covered by parseAudioConfig(). */ strncpy( charBuf, inFormatStr, sizeof( charBuf ) - 1 ); +#ifdef FIX_343_TO_UPPER + charBuf[sizeof( charBuf ) - 1] = '\0'; +#endif to_upper( charBuf ); if ( strcmp( charBuf, "META" ) == 0 ) { @@ -1370,6 +1376,9 @@ static IVAS_REND_AudioConfig parseAudioConfig( charBuf[13] = '\0'; strncpy( charBuf, configString, sizeof( charBuf ) - 1 ); +#ifdef FIX_343_TO_UPPER + charBuf[sizeof( charBuf ) - 1] = '\0'; +#endif to_upper( charBuf ); if ( ( strcmp( charBuf, "MONO" ) == 0 ) || ( strcmp( charBuf, "HOA0" ) == 0 ) || ( strcmp( charBuf, "SBA0" ) == 0 ) ) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index a24e03f248..2a15165be0 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -87,14 +87,10 @@ typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; typedef struct ivas_masa_qmetadata_frame_struct *IVAS_MASA_QMETADATA_HANDLE; typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE; -#ifdef HRTF_BINARY_FILE typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE; -#endif -#ifdef HRTF_BINARY_FILE typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE; typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE; -#endif #ifdef DEBUGGING typedef enum diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index 32f2f47303..194b4b2919 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -55,7 +55,7 @@ int32_t get_delay( const int32_t io_fs, /* i : input/output sampling frequency */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ HANDLE_CLDFB_FILTER_BANK hCldfb, /* i : Handle of Cldfb analysis */ - const int32_t binaural_latency_ns /* i : binauralization delay in ns */ + const int32_t binaural_latency_ns /* i : binaural renderer HRTF delay in ns */ ) { int32_t delay = 0; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 00ff314258..5f408d4e4b 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -570,7 +570,13 @@ typedef enum #define NO_SYMB_GR_PRED_G 8 #define STEREO_DFT_RES_BW_MAX 66 /*Maximum number of bin for residual signal in each frame (res_cod_band_max == 6 in 48kHz)*/ + +#ifdef DFT_STEREO_SPAR_MIXING +#define SBA_DIRAC_STEREO_NUM_BANDS 12 +#else #define SBA_DIRAC_STEREO_NUM_BANDS 5 +#endif + #define SBA_DIRAC_NRG_SMOOTH_LONG 10 #define SBA_DIRAC_NRG_SMOOTH_SHORT 3 @@ -1358,16 +1364,12 @@ typedef enum #define BINAURAL_MAXBANDS 60 /* Max number of bands */ #define BINAURAL_CONVBANDS 50 /* Bands upto which convolution is performed */ -#ifdef HRTF_BINARY_FILE #define BINAURAL_NTAPS 7 -#endif #define BINAURAL_NTAPS_MAX 96 #define HRTF_SH_ORDER 3 #define HRTF_SH_CHANNELS 16 -#ifdef HRTF_BINARY_FILE #define HRTF_LS_CHANNELS 15 -#endif #define HRTF_NUM_BINS 60 #define REVERB_PREDELAY_MAX 20 /* Max input delay for reverb module */ #define GAIN_LFE 1.88364911f /* Gain applied to LFE during renderering */ @@ -1376,7 +1378,6 @@ typedef enum #define BINAURAL_COHERENCE_DIFFERENCE_BINS 9 /* Number of bins for direction-dependent diffuse-field binaural coherence */ -#ifdef HRTF_BINARY_FILE typedef enum { BINAURAL_INPUT_AUDIO_CONFIG_INVALID, @@ -1386,7 +1387,6 @@ typedef enum } BINAURAL_INPUT_AUDIO_CONFIG; -#endif #define HEADROT_ORDER 3 #define HEADROT_SHMAT_DIM ( ( HEADROT_ORDER + 1 ) * ( HEADROT_ORDER + 1 ) ) #define HEADROT_SHMAT_DIM2 ( HEADROT_SHMAT_DIM * HEADROT_SHMAT_DIM ) @@ -1409,16 +1409,9 @@ typedef enum #define SFX_SPAT_BIN_NUM_SUBSAMPLES 64 #define ITD_MEM_LEN (MAX_ITD + SFX_SPAT_BIN_SINC_M) #define L_SUBFRAME5MS_48k (L_FRAME48k/4) -#ifdef FIX_337_TDREND_INTP #define MAX_ANGULAR_STEP (1.0f) -#else -#define MAX_ANGULAR_STEP (15.0f) -#endif #define MAX_ANGULAR_STEP_INV ( 1.0f / MAX_ANGULAR_STEP ) #define MAX_INTERPOLATION_STEPS 12 -#ifndef FIX_310_TD_REND_DELAY -#define BINAURAL_TD_LATENCY_S 0.0f /* ITD fix removes TD renderer delay -- should be cleaned out */ -#endif /* ----- Enums - TD Renderer ----- */ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 48a0b94380..01634b60a6 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1059,6 +1059,10 @@ ivas_error stereo_dft_dec_create( const int32_t element_brate, /* i : element bitrate */ const int32_t output_Fs, /* i : output sampling rate */ const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ +#ifdef DFT_STEREO_SPAR_MIXING + , + const int16_t nchan_transport +#endif ); void stereo_dft_dec_reset( @@ -1098,10 +1102,17 @@ void stereo_dft_dec_synthesize( void stereo_dft_dec( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ Decoder_State *st0, /* i/o: decoder state structure */ - float DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* i/o: DFT buffers */ + float DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* i/o: DFT buffers */ float *input_mem, /* i/o: mem of buffer DFT analysis */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ +#ifdef DFT_STEREO_SPAR_MIXING + , + ivas_spar_md_dec_state_t *hMdDec, /* SPAR MD handle for upmixing */ + int16_t cross_fade_start_offset, /* i: SPAR mixer delay compensation */ + int32_t output_Fs, /* i: Fs for delay calculation */ + int16_t nchan_transport /* i: number of transpor channels */ +#endif ); void stereo_dft_res_ecu( @@ -3201,6 +3212,10 @@ void ivas_sba_dirac_stereo_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float output[CPE_CHANNELS][L_FRAME48k], /* o : output synthesis signal */ const int16_t output_frame /* i : output frame length per channel */ +#ifdef DFT_STEREO_SPAR_MIXING + , + const int16_t mcmasa +#endif ); void ivas_sba_dirac_stereo_config( @@ -3209,6 +3224,12 @@ void ivas_sba_dirac_stereo_config( void ivas_sba_dirac_stereo_smooth_parameters( STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: encoder DFT stereo handle */ +#ifdef DFT_STEREO_SPAR_MIXING + , + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ + int16_t cross_fade_start_offset, /* i: SPAR mixer delay compensation */ + int32_t output_Fs /* i: Fs for delay calculation */ +#endif ); ivas_error ivas_sba_get_hoa_dec_matrix( @@ -3312,26 +3333,18 @@ void ivas_dirac_dec( const int16_t i_sf ); -#ifdef HRTF_BINARY_FILE ivas_error ivas_dirac_dec_init_binaural_data( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ ); -#else -ivas_error ivas_dirac_dec_init_binaural_data( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); -#endif void ivas_dirac_dec_close_binaural_data( DIRAC_DEC_BIN_HANDLE *hBinaural /* i/o: decoder DirAC binaural data handle */ ); -#ifdef HRTF_BINARY_FILE ivas_error ivas_dirac_dec_binaural_copy_hrtfs( HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */ ); -#endif void ivas_dirac_dec_binaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -3347,11 +3360,9 @@ ivas_error ivas_binaural_reverb_open( const AUDIO_CONFIG output_config, /* i : output audio configuration */ const int32_t sampling_rate, /* i : sampling rate */ const RENDERER_TYPE renderer_type /* i : renderer type */ -#ifdef HRTF_BINARY_FILE , const HRTFS_FASTCONV_HANDLE hHrtfFastConv, /* i : FastConv HRTF handle */ const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ -#endif ); void ivas_binaural_reverb_close( @@ -4631,7 +4642,6 @@ void ivas_binaural_add_LFE( float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ ); -#ifdef HRTF_BINARY_FILE ivas_error ivas_HRTF_fastconv_binary_open( HRTFS_FASTCONV **hHrtfFastConv /* i/o: FASTCONV HRTF structure */ ); @@ -4647,7 +4657,6 @@ ivas_error ivas_HRTF_parambin_binary_open( void ivas_HRTF_parambin_binary_close( HRTFS_PARAMBIN **hHrtfParambin /* i/o: Parametric binauralizer HRTF structure */ ); -#endif void QuatToRotMat( const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ @@ -5098,7 +5107,7 @@ void DefaultBSplineModel( ); ivas_error ivas_td_binaural_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_td_binaural_close( @@ -5374,7 +5383,6 @@ int16_t ivas_get_num_bands_from_bw_idx( * Crend renderer *----------------------------------------------------------------------------------*/ -#ifdef HRTF_BINARY_FILE ivas_error ivas_HRTF_CRend_binary_open( HRTFS_CREND **hSetOfHRTF /* i/o: Set of HRTF handle */ @@ -5395,12 +5403,13 @@ ivas_error ivas_crend_init_from_hrtf_handle( HRTFS_HANDLE hrtf); #endif +#ifndef FIX_MEMORY_COUNTING_HRTF_BINARY_FILE ivas_error destroy_SetOfHRTF( HRTFS_CREND_HANDLE hSetOfHRTF /* i/o: Set of HRTF CRend handle */ ); - #endif + #ifndef FIX_197_CREND_INTERFACE ivas_error ivas_crend_init_from_rom( @@ -5437,9 +5446,7 @@ ivas_error ivas_rend_initCrend( const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, RENDER_CONFIG_DATA *hRendCfg, -#ifdef HRTF_BINARY_FILE HRTFS_CREND_HANDLE hSetOfHRTF, -#endif const int32_t output_Fs ); ivas_error ivas_rend_openCrend( @@ -5448,9 +5455,7 @@ ivas_error ivas_rend_openCrend( const IVAS_REND_AudioConfig outConfig, RENDER_CONFIG_DATA *hRendCfg, int16_t Opt_Headrotation, -#ifdef HRTF_BINARY_FILE HRTFS_CREND_HANDLE hSetOfHRTF, -#endif const int32_t output_Fs ); #ifdef FIX_197_CREND_INTERFACE @@ -5656,9 +5661,7 @@ void ivas_reverb_calc_color_levels( void ivas_reverb_prepare_cldfb_params( ivas_roomAcoustics_t *pInput_params, -#ifdef HRTF_BINARY_FILE const HRTFS_FASTCONV_HANDLE hHrtfFastConv, -#endif const AUDIO_CONFIG input_audio_config, const int16_t use_brir, const int32_t output_Fs, @@ -5728,7 +5731,7 @@ ivas_error ivas_orient_trk_GetTrackedRotation( #ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_Process( ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - IVAS_QUATERNION absRot, /* i : absolute head rotation */ + const IVAS_QUATERNION *absRot, /* i : absolute head rotation */ float updateRate, /* i : rotation update rate [Hz] */ IVAS_QUATERNION *pTrkRot /* o : tracked rotation */ ); diff --git a/lib_com/options.h b/lib_com/options.h index 88d9b64df4..82857904a0 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -147,15 +147,21 @@ #define SBA_BR_SWITCHING_RECONFIG /* Issue 114: Changes for SBA bitrate switching with reconfiguration for bitrates with different number of transport channels*/ #endif -#define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ -#define HRTF_BINARY_FILE /* HRTF filters' binary file used for binaural rendering. */ #define FIX_197_CREND_INTERFACE -#define FIX_301_PLC /* FhG: issue 301 - fix bug of missing update of overlap buffer for DFT-stereo PLC*/ -#define FIX_337_TDREND_INTP /* Issue 337: TD renderer interpolation threshold set too low */ -#define FIX_310_TD_REND_DELAY /* Adding HRTF delay being read from ROM/Binary file, fix rounding for delay compensation in renderer */ +#define FIX_MEMORY_COUNTING_HRTF_BINARY_FILE #define FIX_334_DEBUG_BE_STEREO_SWITCHING /* FhG: Fix non-BE issue for stereo switching when DEBUGGING is enabled */ +#define FIX_198_TDREND_INTERFACE /* Issue 198: Harmonize interface for TD renderer between decoder and external renderer */ + +#define DFT_STEREO_SPAR_MIXING +#ifdef DFT_STEREO_SPAR_MIXING +/*#define DFT_STEREO_SPAR_MIXING_DEBUG*/ /* more debugging output for DFT_STEREO_SPAR_MIXING_DEBUG */ +#define DISABLE_RES_CHANNELS_MCT /* decode only W and residual for Y when outputting to stereo */ +#endif + +#define FIX_343_TO_UPPER /* VA: issue 343: safeguard for function to_upper() */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index 6787968270..1e238fb52f 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -279,11 +279,7 @@ void open_decoder_LPD( st->last_core_bfi = ACELP_CORE; } -#ifdef FIX_301_PLC if ( ( ( st->element_mode != IVAS_CPE_DFT ) || ( st->element_mode == IVAS_CPE_DFT && st->prev_bfi ) ) && st->last_codec_mode == MODE1 && st->last_core == ACELP_CORE ) -#else - if ( st->element_mode != IVAS_CPE_DFT && st->last_codec_mode == MODE1 && st->last_core == ACELP_CORE ) -#endif { /* Switching from Mode 1 ACELP */ st->last_core_bfi = ACELP_CORE; diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 186a624f4d..3fb50b5ca6 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -441,7 +441,11 @@ ivas_error ivas_core_dec( *---------------------------------------------------------------------*/ /* save synth and output in case of SBA DirAC stereo output as core switching is done outside of core decoder */ +#ifdef DFT_STEREO_SPAR_MIXING + if ( sba_dirac_stereo_flag && st->element_mode != IVAS_CPE_MDCT && !( st->core_brate == SID_2k40 && st->cng_type == FD_CNG ) ) +#else if ( sba_dirac_stereo_flag && !( st->core_brate == SID_2k40 && st->cng_type == FD_CNG ) ) +#endif { mvr2r( synth[n], hSCE->save_synth, output_frame ); } @@ -660,7 +664,11 @@ ivas_error ivas_core_dec( } } +#ifdef DFT_STEREO_SPAR_MIXING + if ( sba_dirac_stereo_flag && st->element_mode != IVAS_CPE_MDCT ) +#else if ( sba_dirac_stereo_flag ) +#endif { /* for SBA DirAC stereo output DFT Stereo core switching and updates are done in ivas_sba_dirac_stereo_dec() as hCPE is not available at this point */ break; @@ -675,13 +683,28 @@ ivas_error ivas_core_dec( if ( st->element_mode != IVAS_CPE_DFT ) { +#ifdef DFT_STEREO_SPAR_MIXING + if ( st->element_mode != IVAS_CPE_MDCT || sba_dirac_stereo_flag ) +#else if ( st->element_mode != IVAS_CPE_MDCT ) +#endif { +#ifdef DFT_STEREO_SPAR_MIXING + ivas_post_proc( hSCE, hCPE, n, synth[n], NULL, output_frame, sba_dirac_stereo_flag ); +#else ivas_post_proc( hSCE, hCPE, n, synth[n], NULL, output_frame, 0 ); +#endif } /* update OLA buffers - needed for switching to DFT stereo */ +#ifdef DFT_STEREO_SPAR_MIXING + if ( !sba_dirac_stereo_flag ) + { + stereo_td2dft_update( hCPE, n, output[n], synth[n], hb_synth[n], output_frame ); + } +#else stereo_td2dft_update( hCPE, n, output[n], synth[n], hb_synth[n], output_frame ); +#endif } else /* IVAS_CPE_DFT */ { diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c old mode 100644 new mode 100755 index 972f1304f7..b656f9255b --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -361,7 +361,11 @@ ivas_error ivas_cpe_dec( if ( hCPE->element_mode != IVAS_CPE_DFT || ( hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) { +#ifdef DFT_STEREO_SPAR_MIXING + if ( ( error = ivas_core_dec( st_ivas, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB, NULL, st_ivas->sba_dirac_stereo_flag ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_core_dec( st_ivas, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB, NULL, 0 ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -406,7 +410,12 @@ ivas_error ivas_cpe_dec( } else { - stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0 ); + stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0 +#ifdef DFT_STEREO_SPAR_MIXING + , + 0, 0, 0, 0 +#endif + ); } /* synthesis iFFT */ @@ -454,8 +463,12 @@ ivas_error ivas_cpe_dec( /*----------------------------------------------------------------* * Synthesis synchronization between CPE modes *----------------------------------------------------------------*/ - - synchro_synthesis( ivas_total_brate, hCPE, output, output_frame, 0 ); +#ifdef DFT_STEREO_SPAR_MIXING + if ( !st_ivas->sba_dirac_stereo_flag ) +#endif + { + synchro_synthesis( ivas_total_brate, hCPE, output, output_frame, 0 ); + } if ( hCPE->element_mode == IVAS_CPE_MDCT && hCPE->nchan_out == 1 && ( is_DTXrate( ivas_total_brate ) == 0 || ( is_DTXrate( ivas_total_brate ) == 1 && is_DTXrate( st_ivas->hDecoderConfig->last_ivas_total_brate ) == 0 ) ) ) { @@ -670,7 +683,11 @@ ivas_error create_cpe_dec( for ( n = 0; n < CPE_CHANNELS; n++ ) { - if ( st_ivas->sba_dirac_stereo_flag ) + if ( st_ivas->sba_dirac_stereo_flag +#ifdef DFT_STEREO_SPAR_MIXING + && st_ivas->nchan_transport == 1 +#endif + ) { /* for SBA DirAC stereo output CPE element is only used for upmix, core coder is found in SCE element used for core decoding */ break; @@ -702,9 +719,18 @@ ivas_error create_cpe_dec( * DFT stereo initialization *-----------------------------------------------------------------*/ +#ifdef DFT_STEREO_SPAR_MIXING + if ( hCPE->element_mode == IVAS_CPE_DFT || ( st_ivas->sba_dirac_stereo_flag && hCPE->cpe_id == 0 ) ) +#else if ( hCPE->element_mode == IVAS_CPE_DFT || st_ivas->sba_dirac_stereo_flag ) +#endif { - if ( ( error = stereo_dft_dec_create( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, st_ivas->sba_dirac_stereo_flag ) ) != IVAS_ERR_OK ) + if ( ( error = stereo_dft_dec_create( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, st_ivas->sba_dirac_stereo_flag +#ifdef DFT_STEREO_SPAR_MIXING + , + st_ivas->nchan_transport +#endif + ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index e4a08b0540..384baa0bb2 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -305,7 +305,20 @@ ivas_error ivas_dec( if ( st_ivas->sba_dirac_stereo_flag ) { nchan_remapped = CPE_CHANNELS; - ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame ); + +#ifdef DFT_STEREO_SPAR_MIXING + if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + { + ivas_spar_dec_gen_umx_mat( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi ); + } +#endif + + ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame +#ifdef DFT_STEREO_SPAR_MIXING + , + st_ivas->ivas_format == MC_FORMAT +#endif + ); } else if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && ( ivas_total_brate > IVAS_SID_5k2 || ( ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE > 0 && st_ivas->hCPE[0]->nchan_out == 1 ) ) ) { @@ -360,6 +373,9 @@ ivas_error ivas_dec( } } else /* SBA_MODE_SPAR */ +#ifdef DFT_STEREO_SPAR_MIXING + if ( !st_ivas->sba_dirac_stereo_flag ) +#endif { ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ } @@ -536,7 +552,12 @@ ivas_error ivas_dec( if ( st_ivas->sba_dirac_stereo_flag ) /* use the flag to trigger the DFT upmix */ { - ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame ); + ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame +#ifdef DFT_STEREO_SPAR_MIXING + , + 1 +#endif + ); } /* HP filtering */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 1f528a7bce..2ce8ef0720 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1910,7 +1910,7 @@ void ivas_dirac_dec( { #ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, - st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], + &st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], (float) ( FRAMES_PER_SEC * ( sf2 - sf1 ) ), &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, st_ivas->hHeadTrackData->Rmat ); diff --git a/lib_dec/ivas_dirac_dec_binaural_functions.c b/lib_dec/ivas_dirac_dec_binaural_functions.c index 54ad7b5f04..8a44248c3b 100644 --- a/lib_dec/ivas_dirac_dec_binaural_functions.c +++ b/lib_dec/ivas_dirac_dec_binaural_functions.c @@ -86,16 +86,10 @@ static void matrixTransp2Mul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], f * Initialize parametric binaural renderer *------------------------------------------------------------------------*/ -#ifdef HRTF_BINARY_FILE ivas_error ivas_dirac_dec_init_binaural_data( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ ) -#else -ivas_error ivas_dirac_dec_init_binaural_data( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -#endif { DIRAC_DEC_BIN_HANDLE hBinaural; int16_t nBins; @@ -202,11 +196,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( } else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ { -#ifdef HRTF_BINARY_FILE mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hBinaural->earlyPartEneCorrection, nBins ); -#else - mvr2r( parametricEarlyPartEneCorrection, hBinaural->earlyPartEneCorrection, nBins ); -#endif /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ if ( hBinaural->hReverb != NULL && ( ( hBinaural->hReverb->numBins != nBins ) || @@ -220,7 +210,6 @@ ivas_error ivas_dirac_dec_init_binaural_data( { if ( hBinaural->useSubframeMode ) { -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, @@ -229,16 +218,12 @@ ivas_error ivas_dirac_dec_init_binaural_data( RENDERER_BINAURAL_PARAMETRIC_ROOM, st_ivas->hHrtfFastConv, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, st_ivas->hIntSetup.output_config, output_Fs, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) != IVAS_ERR_OK ) -#endif { return error; } } else { -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, nBins, CLDFB_NO_COL_MAX, @@ -248,9 +233,6 @@ ivas_error ivas_dirac_dec_init_binaural_data( RENDERER_BINAURAL_PARAMETRIC_ROOM, st_ivas->hHrtfFastConv, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, nBins, CLDFB_NO_COL_MAX, NULL, st_ivas->hIntSetup.output_config, output_Fs, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -330,7 +312,6 @@ void ivas_dirac_dec_close_binaural_data( return; } -#ifdef HRTF_BINARY_FILE /*------------------------------------------------------------------------- * ivas_dirac_dec_binaural_copy_hrtfs() * @@ -376,7 +357,6 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs( return IVAS_ERR_OK; } -#endif /*------------------------------------------------------------------------- * ivas_dirac_dec_binaural() @@ -577,7 +557,7 @@ static void ivas_dirac_dec_binaural_internal( if ( st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ) { #ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hHeadTrackData->Quaternions[firstSubframe], FRAMES_PER_SEC, &trackedHeadOrientation ); + ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, &st_ivas->hHeadTrackData->Quaternions[firstSubframe], FRAMES_PER_SEC, &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, Rmat ); #else QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[firstSubframe], Rmat ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index f64bf4fc5d..94239708f5 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -614,7 +614,6 @@ ivas_error ivas_init_decoder_front( { return error; } -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_HRTF_CRend_binary_open( &( st_ivas->hSetOfHRTF ) ) ) != IVAS_ERR_OK ) { return error; @@ -629,7 +628,6 @@ ivas_error ivas_init_decoder_front( { return error; } -#endif } /*-------------------------------------------------------------------* @@ -902,6 +900,9 @@ ivas_error ivas_init_decoder( ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); } +#ifdef DFT_STEREO_SPAR_MIXING + st_ivas->sba_dirac_stereo_flag = ( output_config == AUDIO_CONFIG_STEREO ); +#endif } else /* SBA_MODE_DIRAC */ { @@ -947,7 +948,11 @@ ivas_error ivas_init_decoder( } /* create CPE element for DFT Stereo like upmix */ - if ( st_ivas->sba_dirac_stereo_flag ) + if ( st_ivas->sba_dirac_stereo_flag +#ifdef DFT_STEREO_SPAR_MIXING + && st_ivas->nchan_transport == 1 +#endif + ) { if ( ( error = create_cpe_dec( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) { @@ -1196,7 +1201,6 @@ ivas_error ivas_init_decoder( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { -#ifdef HRTF_BINARY_FILE if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -1209,12 +1213,6 @@ ivas_error ivas_init_decoder( { return error; } -#else - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { @@ -1272,9 +1270,7 @@ ivas_error ivas_init_decoder( getRendAudioConfigFromIvasAudioConfig( st_ivas->intern_config ), getRendAudioConfigFromIvasAudioConfig( st_ivas->hDecoderConfig->output_config ), st_ivas->hRenderConfig, st_ivas->hDecoderConfig->Opt_Headrotation, -#ifdef HRTF_BINARY_FILE st_ivas->hSetOfHRTF, -#endif st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; @@ -1370,7 +1366,11 @@ ivas_error ivas_init_decoder( } /* CLDFB Interpolation weights */ - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR +#ifdef DFT_STEREO_SPAR_MIXING + && !st_ivas->sba_dirac_stereo_flag +#endif + ) { ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); } @@ -1596,11 +1596,9 @@ void ivas_initialize_handles_dec( st_ivas->hCrend = NULL; st_ivas->hHrtf = NULL; #endif -#ifdef HRTF_BINARY_FILE st_ivas->hSetOfHRTF = NULL; st_ivas->hHrtfFastConv = NULL; st_ivas->hHrtfParambin = NULL; -#endif st_ivas->hoa_dec_mtx = NULL; st_ivas->hHeadTrackData = NULL; @@ -1659,7 +1657,11 @@ void ivas_destroy_dec( if ( st_ivas->hCPE[i] != NULL ) { /* set pointer to NULL as core coder already deallocated in destroy_sce_dec() */ - if ( st_ivas->sba_dirac_stereo_flag ) + if ( st_ivas->sba_dirac_stereo_flag +#ifdef DFT_STEREO_SPAR_MIXING + && st_ivas->nchan_transport == 1 +#endif + ) { st_ivas->hCPE[i]->hCoreCoder[0] = NULL; st_ivas->hCPE[i]->hCoreCoder[1] = NULL; @@ -1808,11 +1810,12 @@ void ivas_destroy_dec( ivas_HRTF_binary_close( &st_ivas->hHrtfTD ); } -#ifdef HRTF_BINARY_FILE /* CRend binaural renderer handle */ if ( st_ivas->hSetOfHRTF != NULL ) { +#ifndef FIX_MEMORY_COUNTING_HRTF_BINARY_FILE destroy_SetOfHRTF( st_ivas->hSetOfHRTF ); +#endif ivas_HRTF_CRend_binary_close( &st_ivas->hSetOfHRTF ); } @@ -1827,7 +1830,6 @@ void ivas_destroy_dec( { ivas_HRTF_parambin_binary_close( &st_ivas->hHrtfParambin ); } -#endif /* Config. Renderer */ ivas_render_config_close( &( st_ivas->hRenderConfig ) ); @@ -1953,19 +1955,29 @@ void ivas_init_dec_get_num_cldfb_instances( case RENDERER_BINAURAL_FASTCONV_ROOM: if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { - *numCldfbAnalyses = st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans; - - if ( st_ivas->hOutSetup.is_loudspeaker_setup && st_ivas->renderer_type == RENDERER_DIRAC ) +#ifdef DFT_STEREO_SPAR_MIXING + if ( st_ivas->sba_dirac_stereo_flag ) { - *numCldfbSyntheses = st_ivas->hOutSetup.nchan_out_woLFE; - } - else if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA ) - { - *numCldfbSyntheses = st_ivas->hSpar->hFbMixer->fb_cfg->num_out_chans; + *numCldfbAnalyses = 0; + *numCldfbSyntheses = 0; } else +#endif { - *numCldfbSyntheses = MAX_OUTPUT_CHANNELS; + *numCldfbAnalyses = st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans; + + if ( st_ivas->hOutSetup.is_loudspeaker_setup && st_ivas->renderer_type == RENDERER_DIRAC ) + { + *numCldfbSyntheses = st_ivas->hOutSetup.nchan_out_woLFE; + } + else if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA ) + { + *numCldfbSyntheses = st_ivas->hSpar->hFbMixer->fb_cfg->num_out_chans; + } + else + { + *numCldfbSyntheses = MAX_OUTPUT_CHANNELS; + } } } else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) @@ -2101,7 +2113,6 @@ static ivas_error doSanityChecks_IVAS( } #endif -#ifdef HRTF_BINARY_FILE #ifdef DEBUGGING if ( ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) && ( ( st_ivas->ivas_format != MC_FORMAT && st_ivas->ivas_format != ISM_FORMAT ) || output_config != AUDIO_CONFIG_BINAURAL || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCT ) ) ) { @@ -2109,18 +2120,6 @@ static ivas_error doSanityChecks_IVAS( } #endif -#else - -#ifdef DEBUGGING - if ( ( st_ivas->hDecoderConfig->Opt_HRTF_binary || st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) && ( ( st_ivas->ivas_format != MC_FORMAT && st_ivas->ivas_format != ISM_FORMAT ) || output_config != AUDIO_CONFIG_BINAURAL || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCT ) ) ) -#else - if ( st_ivas->hDecoderConfig->Opt_HRTF_binary && ( ( st_ivas->ivas_format != MC_FORMAT && st_ivas->ivas_format != ISM_FORMAT ) || output_config != AUDIO_CONFIG_BINAURAL || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) ) ) -#endif - { - return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration: Time Domain object renderer not supported in this configuration" ); - } - -#endif #ifdef DEBUGGING if ( ( st_ivas->hHrtfTD != NULL && st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) ) diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 2b6d0b6876..f2f008ff37 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -1091,9 +1091,7 @@ static ivas_error ivas_ism_bitrate_switching( getRendAudioConfigFromIvasAudioConfig( st_ivas->hOutSetup.output_config ), st_ivas->hRenderConfig, st_ivas->hDecoderConfig->Opt_Headrotation, -#ifdef HRTF_BINARY_FILE st_ivas->hSetOfHRTF, -#endif st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; @@ -1115,12 +1113,8 @@ static ivas_error ivas_ism_bitrate_switching( if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL ) { /* open the parametric binaural renderer */ -#ifdef HRTF_BINARY_FILE ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ); ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ); -#else - ivas_dirac_dec_init_binaural_data( st_ivas ); -#endif /* Close the TD Binaural renderer */ if ( st_ivas->hBinRendererTd != NULL ) @@ -1146,12 +1140,8 @@ static ivas_error ivas_ism_bitrate_switching( if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM ) { /* open the parametric binaural renderer */ -#ifdef HRTF_BINARY_FILE ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ); ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ); -#else - ivas_dirac_dec_init_binaural_data( st_ivas ); -#endif /* close the crend binaural renderer */ #ifdef FIX_197_CREND_INTERFACE diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index eebaeec9c0..b83fd5114e 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -137,7 +137,7 @@ void ivas_ism_render( { #ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, - st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], + &st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], FRAMES_PER_SEC, &trackedHeadOrientation ); /* Calculate rotation matrix from the quaternion */ diff --git a/lib_dec/ivas_lfe_dec.c b/lib_dec/ivas_lfe_dec.c index 1487a27971..55a68d892b 100644 --- a/lib_dec/ivas_lfe_dec.c +++ b/lib_dec/ivas_lfe_dec.c @@ -437,11 +437,7 @@ ivas_error ivas_create_lfe_dec( lfe_addl_delay_s = block_offset_s - hLFE->lfe_block_delay_s; lfe_addl_delay_s = max( 0.0f, lfe_addl_delay_s ); -#ifdef FIX_FIX_I59 add_delay_sa = (int16_t) roundf( (float) binauralization_delay_ns * output_Fs / 1000000000.f ); -#else - add_delay_sa = NS2SA( output_Fs, binauralization_delay_ns + 0.5f ); -#endif hLFE->lfe_addl_delay = (int16_t) ( lfe_addl_delay_s * output_Fs ) + add_delay_sa; hLFE->lfe_block_delay_s += lfe_addl_delay_s + add_delay_sa / output_Fs; diff --git a/lib_dec/ivas_mcmasa_dec.c b/lib_dec/ivas_mcmasa_dec.c index 3af2ea2c3b..748f665dce 100644 --- a/lib_dec/ivas_mcmasa_dec.c +++ b/lib_dec/ivas_mcmasa_dec.c @@ -109,7 +109,6 @@ ivas_error ivas_mcmasa_dec_reconfig( if ( st_ivas->hDiracDecBin == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { /* open parametric binaural renderer */ -#ifdef HRTF_BINARY_FILE if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -119,9 +118,6 @@ ivas_error ivas_mcmasa_dec_reconfig( } if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -140,11 +136,7 @@ ivas_error ivas_mcmasa_dec_reconfig( { /* st_ivas->hDiracDecBin->useTdDecorr will change => close and re-open. */ ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 7b2fa2982c..9c8e640784 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -166,6 +166,20 @@ ivas_error ivas_mct_dec( /* MCT core decoder */ ivas_mct_core_dec( hMCT, st_ivas->hCPE, nCPE, output ); +#ifdef DISABLE_RES_CHANNELS_MCT + /* for sba to stereo output disable any further processing for TCs > 2 as it is not needed*/ + if ( st_ivas->sba_dirac_stereo_flag ) + { + for ( cpe_id = 1; cpe_id < nCPE; cpe_id++ ) + { + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; + } + } + } +#endif + /* MCT reconstruction and CoreCoder updates */ for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { @@ -225,8 +239,19 @@ ivas_error ivas_mct_dec( break; } +#ifdef DFT_STEREO_SPAR_MIXING + if ( st_ivas->sba_dirac_stereo_flag ) + { + ivas_post_proc( NULL, hCPE, n, synth[n], NULL, output_frame, 1 ); + } +#endif + /* Postprocessing for ACELP/MDCT core switching and synchronization */ +#ifdef DFT_STEREO_SPAR_MIXING + if ( ( error = core_switching_post_dec( sts[n], synth[n], output[cpe_id * CPE_CHANNELS + n], hCPE->output_mem[1], 0, output_frame, 0 /*core_switching_flag*/, st_ivas->sba_dirac_stereo_flag, -1, hCPE->last_element_mode ) ) != IVAS_ERR_OK ) +#else if ( ( error = core_switching_post_dec( sts[n], synth[n], output[cpe_id * CPE_CHANNELS + n], hCPE->output_mem[1], 0, output_frame, 0 /*core_switching_flag*/, 0, -1, hCPE->last_element_mode ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -247,7 +272,14 @@ ivas_error ivas_mct_dec( /* synthesis synchronization between stereo modes */ +#ifdef DFT_STEREO_SPAR_MIXING + if ( !st_ivas->sba_dirac_stereo_flag ) + { + synchro_synthesis( ivas_total_brate, hCPE, output + cpe_id * CPE_CHANNELS, output_frame, 0 ); + } +#else synchro_synthesis( ivas_total_brate, hCPE, output + cpe_id * CPE_CHANNELS, output_frame, 0 ); +#endif #ifdef DEBUG_PLOT for ( n = 0; n < CPE_CHANNELS; n++ ) @@ -1063,11 +1095,7 @@ static ivas_error ivas_mc_dec_reconfig( /* useTdDecorr may change => close and re-open */ ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1084,7 +1112,6 @@ static ivas_error ivas_mc_dec_reconfig( } else if ( st_ivas->hDiracDecBin == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) { -#ifdef HRTF_BINARY_FILE if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -1094,9 +1121,6 @@ static ivas_error ivas_mc_dec_reconfig( } if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1137,9 +1161,7 @@ static ivas_error ivas_mc_dec_reconfig( getRendAudioConfigFromIvasAudioConfig( st_ivas->intern_config ), getRendAudioConfigFromIvasAudioConfig( st_ivas->hDecoderConfig->output_config ), st_ivas->hRenderConfig, st_ivas->hDecoderConfig->Opt_Headrotation, -#ifdef HRTF_BINARY_FILE st_ivas->hSetOfHRTF, -#endif st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_dec/ivas_post_proc.c b/lib_dec/ivas_post_proc.c index 1104c9a378..849f4b79c0 100644 --- a/lib_dec/ivas_post_proc.c +++ b/lib_dec/ivas_post_proc.c @@ -81,7 +81,11 @@ void ivas_post_proc( output_Fs = sts[0]->output_Fs; +#ifdef DFT_STEREO_SPAR_MIXING + if ( ( sts[n]->element_mode != IVAS_CPE_DFT && !( sba_dirac_stereo_flag && sts[n]->element_mode != IVAS_CPE_MDCT ) ) || ( sts[n]->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) +#else if ( ( sts[n]->element_mode != IVAS_CPE_DFT && !sba_dirac_stereo_flag ) || ( sts[n]->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) +#endif { if ( sts[n]->hTcxLtpDec != NULL ) { @@ -102,6 +106,13 @@ void ivas_post_proc( mvr2r( sts[n]->prev_synth_buffer, sts[n]->hTcxDec->FBTCXdelayBuf, 0 ); mvr2r( sts[n]->delay_buf_out, sts[n]->hTcxDec->FBTCXdelayBuf + 0, delay_comp ); } +#ifdef DFT_STEREO_SPAR_MIXING + else if ( sba_dirac_stereo_flag && sts[n]->element_mode == IVAS_CPE_MDCT ) + { + int16_t numZeros = (int16_t) ( NS2SA( output_Fs, N_ZERO_MDCT_NS ) ); + mvr2r( sts[n]->hHQ_core->old_out + numZeros, sts[n]->hTcxDec->FBTCXdelayBuf, delay_comp ); + } +#endif tcx_ltp_post( sts[n], hTcxLtpDec, sts[n]->core, output_frame, NS2SA( output_Fs, ACELP_LOOK_NS ) + delay_comp, synth, sts[n]->hTcxDec->FBTCXdelayBuf ); } diff --git a/lib_dec/ivas_rom_dec.c b/lib_dec/ivas_rom_dec.c index 04e3461e99..e9e107e863 100644 --- a/lib_dec/ivas_rom_dec.c +++ b/lib_dec/ivas_rom_dec.c @@ -231,11 +231,31 @@ const int16_t cna_init_bands[MAX_CNA_NBANDS + 1] = 1, 4, 14, 33, 67, 171, 320 }; +#ifdef DFT_STEREO_SPAR_MIXING +const float max_smooth_gains1[SBA_DIRAC_STEREO_NUM_BANDS] = +{ + 0.98f, 0.97f, 0.95f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f +}; + +const float min_smooth_gains1[SBA_DIRAC_STEREO_NUM_BANDS] = +{ + 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f +}; + +const float max_smooth_gains2[SBA_DIRAC_STEREO_NUM_BANDS] = +{ + 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.9f, 0.9f, 0.9f}; + +const float min_smooth_gains2[SBA_DIRAC_STEREO_NUM_BANDS] = +{ + 0.5f, 0.5f, 0.5, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.3f, 0.3f, 0.3f +}; +#else const float max_smooth_gains[SBA_DIRAC_STEREO_NUM_BANDS] = { 0.98f, 0.97f, 0.95f, 0.9f, 0.9f }; - +#endif /*------------------------------------------------------------------------- * ECLVQ Stereo ROM tables diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h index 00995b1ebc..0f40b07c2a 100644 --- a/lib_dec/ivas_rom_dec.h +++ b/lib_dec/ivas_rom_dec.h @@ -70,8 +70,15 @@ extern const float dft_win232ms_48k[450]; extern const float dft_win_8k[70]; extern const int16_t cna_init_bands[MAX_CNA_NBANDS + 1]; -extern const float max_smooth_gains[SBA_DIRAC_STEREO_NUM_BANDS]; +#ifdef DFT_STEREO_SPAR_MIXING +extern const float min_smooth_gains1[SBA_DIRAC_STEREO_NUM_BANDS]; +extern const float max_smooth_gains1[SBA_DIRAC_STEREO_NUM_BANDS]; +extern const float min_smooth_gains2[SBA_DIRAC_STEREO_NUM_BANDS]; +extern const float max_smooth_gains2[SBA_DIRAC_STEREO_NUM_BANDS]; +#else +extern const float max_smooth_gains[SBA_DIRAC_STEREO_NUM_BANDS]; +#endif /*----------------------------------------------------------------------------------* * ECLVQ Stereo ROM tables diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index d48664be32..005aea5555 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -444,7 +444,6 @@ ivas_error ivas_sba_dec_reinit( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { -#ifdef HRTF_BINARY_FILE if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -457,12 +456,6 @@ ivas_error ivas_sba_dec_reinit( { return error; } -#else - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { @@ -509,9 +502,7 @@ ivas_error ivas_sba_dec_reinit( getRendAudioConfigFromIvasAudioConfig( st_ivas->hDecoderConfig->output_config ), st_ivas->hRenderConfig, t_ivas->hDecoderConfig->Opt_Headrotation, -#ifdef HRTF_BINARY_FILE st_ivas->hSetOfHRTF, -#endif st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; @@ -820,7 +811,6 @@ ivas_error ivas_sba_dec_reconfigure( #endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { -#ifdef HRTF_BINARY_FILE if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -833,13 +823,6 @@ ivas_error ivas_sba_dec_reconfigure( { return error; } -#else - /* open parametric binaural renderer */ - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } #ifdef SBA_BR_SWITCHING } @@ -929,6 +912,10 @@ ivas_error ivas_sba_dec_reconfigure( sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); ivas_spar_config( hDecoderConfig->ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->hSpar->core_nominal_brate, st_ivas->sid_format ); +#ifdef DFT_STEREO_SPAR_MIXING + st_ivas->sba_dirac_stereo_flag = ( hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ); +#endif + if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c old mode 100644 new mode 100755 index fc1c445d1e..bbd612b7ec --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -91,6 +91,10 @@ static int16_t ivas_sba_dirac_stereo_band_config( int16_t *band_limits, /* o : DFT band limits */ const int32_t output_Fs, /* i : output sampling rate */ const int16_t NFFT /* i : analysis/synthesis window length */ +#ifdef DFT_STEREO_SPAR_MIXING + , + const int16_t spar_flag /* i : SPAR or DirAC band grouping */ +#endif ) { int16_t i; @@ -98,6 +102,18 @@ static int16_t ivas_sba_dirac_stereo_band_config( int16_t nbands, num_cldfb_bands; nbands = SBA_DIRAC_STEREO_NUM_BANDS; + +#ifdef DFT_STEREO_SPAR_MIXING + if ( spar_flag ) + { + nbands = IVAS_MAX_NUM_BANDS; + } + else + { + nbands = 5; + } +#endif + num_cldfb_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); bins_per_cldfb_band = NFFT / ( 2 * num_cldfb_bands ); @@ -105,7 +121,23 @@ static int16_t ivas_sba_dirac_stereo_band_config( band_limits[0] = 1; for ( i = 1; i < nbands; i++ ) { +#ifdef DFT_STEREO_SPAR_MIXING + if ( spar_flag ) + { + band_limits[i] = DirAC_band_grouping_12[i] * bins_per_cldfb_band; + } + else + { + band_limits[i] = DirAC_band_grouping_5[i] * bins_per_cldfb_band; + } + if ( band_limits[i] >= NFFT / 2 ) + { + nbands = i; + break; + } +#else band_limits[i] = DirAC_band_grouping_5[i] * bins_per_cldfb_band; +#endif } band_limits[nbands] = NFFT / 2; @@ -159,32 +191,41 @@ static void map_params_dirac_to_stereo( float DFT[STEREO_DFT_BUF_MAX], /* i/o: DFT buffer */ const uint8_t b_wide_panning, /* i : flag indicating wider panning */ const int16_t L_frame /* i : core signal length */ - +#ifdef DFT_STEREO_SPAR_MIXING + , + const int16_t mcmasa +#endif ) { - int16_t i, b, k, block; + int16_t i, b, k; int16_t k_offset; - int16_t nbands, nBlocks, block_len; + int16_t nbands, nBlocks; + int16_t block; + int16_t block_len; int16_t azimuth[MAX_PARAM_SPATIAL_SUBFRAMES][SBA_DIRAC_STEREO_NUM_BANDS]; int16_t elevation[MAX_PARAM_SPATIAL_SUBFRAMES][SBA_DIRAC_STEREO_NUM_BANDS]; float diffuseness[SBA_DIRAC_STEREO_NUM_BANDS]; + float block_nrg[MAX_PARAM_SPATIAL_SUBFRAMES]; + float nrg_norm1, nrg_norm2; + float *pSynth; float surrCoh[SBA_DIRAC_STEREO_NUM_BANDS]; + float *pDFT; float subframe_band_nrg[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS]; float smooth_long_avg[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS]; float smooth_short_avg[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS]; - float block_nrg[MAX_PARAM_SPATIAL_SUBFRAMES]; - float nrg_norm1, nrg_norm2; + float *side_gain, *res_pred_gain; - float *pSynth, *pDFT; IVAS_QDIRECTION *q_direction; - nBlocks = MAX_PARAM_SPATIAL_SUBFRAMES; +#ifdef DFT_STEREO_SPAR_MIXING + nbands = hStereoDft->nbands; +#else nbands = SBA_DIRAC_STEREO_NUM_BANDS; +#endif k_offset = STEREO_DFT_OFFSET; side_gain = hStereoDft->side_gain + k_offset * STEREO_DFT_BAND_MAX; res_pred_gain = hStereoDft->res_pred_gain + k_offset * STEREO_DFT_BAND_MAX; - q_direction = &( hQMetaData->q_direction[0] ); /* gain smoothing factor */ @@ -233,99 +274,109 @@ static void map_params_dirac_to_stereo( } /* apply upper bounds depending on band */ +#ifdef DFT_STEREO_SPAR_MIXING + hStereoDft->smooth_fac[0][b] = max( hStereoDft->min_smooth_gains[b], min( hStereoDft->max_smooth_gains[b], hStereoDft->smooth_fac[0][b] ) ); + hStereoDft->smooth_fac[1][b] = max( hStereoDft->min_smooth_gains[b], min( hStereoDft->max_smooth_gains[b], hStereoDft->smooth_fac[1][b] ) ); +#else hStereoDft->smooth_fac[0][b] = min( max_smooth_gains[b], hStereoDft->smooth_fac[0][b] ); hStereoDft->smooth_fac[1][b] = min( max_smooth_gains[b], hStereoDft->smooth_fac[1][b] ); +#endif } pDFT += STEREO_DFT32MS_N_MAX; } - /* calculate block energies for side gain weighting (combine angles of 2 DirAC blocks to side gain for 1 DFT Stereo subframe; 4 blocks and 2 subframes overall) */ - pSynth = synth; - block_len = L_frame / nBlocks; - for ( block = 0; block < nBlocks; block++ ) - { - block_nrg[block] = 0.f; - for ( i = 0; i < block_len; i++ ) - { - block_nrg[block] += pSynth[i] * pSynth[i]; - } - block_nrg[block] = sqrtf( block_nrg[block] ); - pSynth += block_len; - } - nrg_norm1 = 1 / ( block_nrg[0] + block_nrg[1] + EPSILON ); - nrg_norm2 = 1 / ( block_nrg[2] + block_nrg[3] + EPSILON ); - - /* extract DirAC parameters from metadata */ - for ( b = 0; b < nbands; b++ ) +#ifdef DFT_STEREO_SPAR_MIXING + if ( mcmasa ) +#endif { - diffuseness[b] = 1.0f - q_direction->band_data[b].energy_ratio[0]; - if ( hQMetaData->surcoh_band_data != NULL ) - { - surrCoh[b] = hQMetaData->surcoh_band_data[b].surround_coherence[0] / 255.0f; - } - else - { - surrCoh[b] = 0.0f; - } - + /* calculate block energies for side gain weighting (combine angles of 2 DirAC blocks to side gain for 1 DFT Stereo subframe; 4 blocks and 2 subframes overall) */ + pSynth = synth; + block_len = L_frame / nBlocks; for ( block = 0; block < nBlocks; block++ ) { - int16_t block_metadata; - - if ( hQMetaData->useLowerRes ) - { - block_metadata = 0; - } - else - { - block_metadata = block; - } - if ( q_direction->band_data[b].azimuth[block_metadata] < 0.f ) + block_nrg[block] = 0.f; + for ( i = 0; i < block_len; i++ ) { - q_direction->band_data[b].azimuth[block_metadata] += 360.f; + block_nrg[block] += pSynth[i] * pSynth[i]; } - azimuth[block][b] = (int16_t) q_direction->band_data[b].azimuth[block_metadata]; - elevation[block][b] = (int16_t) q_direction->band_data[b].elevation[block_metadata]; + block_nrg[block] = sqrtf( block_nrg[block] ); + pSynth += block_len; } - } + nrg_norm1 = 1 / ( block_nrg[0] + block_nrg[1] + EPSILON ); + nrg_norm2 = 1 / ( block_nrg[2] + block_nrg[3] + EPSILON ); - /* map angles (azi, ele), surround coherence, and diffuseness to DFT Stereo side and prediction gains */ - for ( b = 0; b < hStereoDft->nbands; b++ ) - { - /* combine angles of first 2 blocks to side gain of first subframe */ - side_gain[b] = 0.f; - for ( block = 0; block < nBlocks / 2; block++ ) + /* extract DirAC parameters from metadata */ + for ( b = 0; b < nbands; b++ ) { - if ( b_wide_panning == 1 ) + diffuseness[b] = 1.0f - q_direction->band_data[b].energy_ratio[0]; + if ( hQMetaData->surcoh_band_data != NULL ) { - /* panning between left and ride, saturate at the stereo ls positions (+/- 30deg azi) */ - side_gain[b] += nrg_norm1 * block_nrg[block] * get_panning( azimuth[block][b], elevation[block][b] ); + surrCoh[b] = hQMetaData->surcoh_band_data[b].surround_coherence[0] / 255.0f; } else { - side_gain[b] += nrg_norm1 * block_nrg[block] * sinf( azimuth[block][b] * EVS_PI / 180 ) * cosf( elevation[block][b] * EVS_PI / 180 ); + surrCoh[b] = 0.0f; + } + + for ( block = 0; block < nBlocks; block++ ) + { + int16_t block_metadata; + + if ( hQMetaData->useLowerRes ) + { + block_metadata = 0; + } + else + { + block_metadata = block; + } + if ( q_direction->band_data[b].azimuth[block_metadata] < 0.f ) + { + q_direction->band_data[b].azimuth[block_metadata] += 360.f; + } + azimuth[block][b] = (int16_t) q_direction->band_data[b].azimuth[block_metadata]; + elevation[block][b] = (int16_t) q_direction->band_data[b].elevation[block_metadata]; } } - /* combine angles of last 2 blocks to side gain of second subframe */ - side_gain[b + STEREO_DFT_BAND_MAX] = 0.f; - for ( block = nBlocks / 2; block < nBlocks; block++ ) + /* map angles (azi, ele), surround coherence, and diffuseness to DFT Stereo side and prediction gains */ + for ( b = 0; b < hStereoDft->nbands; b++ ) { - if ( b_wide_panning == 1 ) + /* combine angles of first 2 blocks to side gain of first subframe */ + side_gain[b] = 0.f; + for ( block = 0; block < nBlocks / 2; block++ ) { - /* panning between left and ride, saturate at the stereo ls positions (+/- 30deg azi) */ - side_gain[b + STEREO_DFT_BAND_MAX] += nrg_norm2 * block_nrg[block] * get_panning( azimuth[block][b], elevation[block][b] ); + if ( b_wide_panning == 1 ) + { + /* panning between left and ride, saturate at the stereo ls positions (+/- 30deg azi) */ + side_gain[b] += nrg_norm1 * block_nrg[block] * get_panning( azimuth[block][b], elevation[block][b] ); + } + else + { + side_gain[b] += nrg_norm1 * block_nrg[block] * sinf( azimuth[block][b] * EVS_PI / 180 ) * cosf( elevation[block][b] * EVS_PI / 180 ); + } } - else + + /* combine angles of last 2 blocks to side gain of second subframe */ + side_gain[b + STEREO_DFT_BAND_MAX] = 0.f; + for ( block = nBlocks / 2; block < nBlocks; block++ ) { - side_gain[b + STEREO_DFT_BAND_MAX] += nrg_norm2 * block_nrg[block] * sinf( azimuth[block][b] * EVS_PI / 180 ) * cosf( elevation[block][b] * EVS_PI / 180 ); + if ( b_wide_panning == 1 ) + { + /* panning between left and ride, saturate at the stereo ls positions (+/- 30deg azi) */ + side_gain[b + STEREO_DFT_BAND_MAX] += nrg_norm2 * block_nrg[block] * get_panning( azimuth[block][b], elevation[block][b] ); + } + else + { + side_gain[b + STEREO_DFT_BAND_MAX] += nrg_norm2 * block_nrg[block] * sinf( azimuth[block][b] * EVS_PI / 180 ) * cosf( elevation[block][b] * EVS_PI / 180 ); + } } - } - side_gain[b] *= sqrtf( 1.f - diffuseness[b] ); - side_gain[b + STEREO_DFT_BAND_MAX] *= sqrtf( 1.f - diffuseness[b] ); - res_pred_gain[b] = diffuseness[b] * ( 1.0f - surrCoh[b] ); - res_pred_gain[b + STEREO_DFT_BAND_MAX] = diffuseness[b] * ( 1.0f - surrCoh[b] ); + side_gain[b] *= sqrtf( 1.f - diffuseness[b] ); + side_gain[b + STEREO_DFT_BAND_MAX] *= sqrtf( 1.f - diffuseness[b] ); + res_pred_gain[b] = diffuseness[b] * ( 1.0f - surrCoh[b] ); + res_pred_gain[b + STEREO_DFT_BAND_MAX] = diffuseness[b] * ( 1.0f - surrCoh[b] ); + } } hStereoDft->frame_nodata = 0; @@ -424,22 +475,66 @@ static void ivas_sba_dirac_stereo_upmix_hb( float hb_synth[L_FRAME48k], /* i : HB signal */ float hb_gain[NB_DIV], /* i : side gains for HB signal */ const int16_t output_frame /* i : output frame length per channel */ +#ifdef DFT_STEREO_SPAR_MIXING + , + const int16_t mcmasa, + const STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i : Stereo DFT handle for mixing matrix */ +#endif ) { int16_t i; - for ( i = 0; i < output_frame / 2; i++ ) +#ifdef DFT_STEREO_SPAR_MIXING + if ( !mcmasa ) { - hb_stereo_synth[0][i] = 0.5f * hb_synth[i] + 0.5f * hb_gain[0] * hb_synth[i]; - hb_stereo_synth[1][i] = 0.5f * hb_synth[i] - 0.5f * hb_gain[0] * hb_synth[i]; + for ( i = 0; i < output_frame / 2; i++ ) + { + float gp = hStereoDft->mixer_mat_smooth[0][0][8] + hStereoDft->mixer_mat_smooth[1][0][8] + + hStereoDft->mixer_mat_smooth[0][0][9] + hStereoDft->mixer_mat_smooth[1][0][9] + + hStereoDft->mixer_mat_smooth[0][0][10] + hStereoDft->mixer_mat_smooth[1][0][10] + + hStereoDft->mixer_mat_smooth[0][0][11] + hStereoDft->mixer_mat_smooth[1][0][11]; + + float gm = hStereoDft->mixer_mat_smooth[0][0][8] - hStereoDft->mixer_mat_smooth[1][0][8] + + hStereoDft->mixer_mat_smooth[0][0][9] - hStereoDft->mixer_mat_smooth[1][0][9] + + hStereoDft->mixer_mat_smooth[0][0][10] - hStereoDft->mixer_mat_smooth[1][0][10] + + hStereoDft->mixer_mat_smooth[0][0][11] - hStereoDft->mixer_mat_smooth[1][0][11]; + + hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * 0.25f * gp; + hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * 0.25f * gm; + } + for ( i = output_frame / 2; i < output_frame; i++ ) + { + float gp = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + + float gm = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + + hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * 0.25f * gp; + hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * 0.25f * gm; + } } - - for ( i = output_frame / 2; i < output_frame; i++ ) + else +#endif { - hb_stereo_synth[0][i] = 0.5f * hb_synth[i] + 0.5f * hb_gain[1] * hb_synth[i]; - hb_stereo_synth[1][i] = 0.5f * hb_synth[i] - 0.5f * hb_gain[1] * hb_synth[i]; + for ( i = 0; i < output_frame / 2; i++ ) + { + hb_stereo_synth[0][i] = 0.5f * hb_synth[i] + 0.5f * hb_gain[0] * hb_synth[i]; + hb_stereo_synth[1][i] = 0.5f * hb_synth[i] - 0.5f * hb_gain[0] * hb_synth[i]; + } + + for ( i = output_frame / 2; i < output_frame; i++ ) + { + hb_stereo_synth[0][i] = 0.5f * hb_synth[i] + 0.5f * hb_gain[1] * hb_synth[i]; + hb_stereo_synth[1][i] = 0.5f * hb_synth[i] - 0.5f * hb_gain[1] * hb_synth[i]; + } } + return; } @@ -454,6 +549,10 @@ static void ivas_sba_dirac_stereo_apply_td_stefi( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ float output[CPE_CHANNELS][L_FRAME48k], /* i/o: output synthesis signal */ const int16_t output_frame /* i : output frame length per channel */ +#ifdef DFT_STEREO_SPAR_MIXING + , + const int16_t spar_flag +#endif ) { int16_t i; @@ -462,7 +561,71 @@ static void ivas_sba_dirac_stereo_apply_td_stefi( float tmp; const float *win_dft; - if ( max( hStereoDft->td_gain[0], hStereoDft->td_gain[1] ) > 0 ) +#ifdef DFT_STEREO_SPAR_MIXING_DEBUG + + static FILE *f_stefi = 0; + + if ( f_stefi == 0 ) + { + f_stefi = fopen( "stefi.txt", "w" ); + } + +#endif + +#ifdef DFT_STEREO_SPAR_MIXING + if ( spar_flag ) + { + win_dft = hStereoDft->win32ms; + dftOvlLen = hStereoDft->dft32ms_ovl; + + float g_W_1, g_Y_1; + float g_W_2, g_Y_2; + float g_L, g_R; + float stefi_L, stefi_R; + + g_W_1 = ( hStereoDft->mixer_mat_smooth[0][1][8] + hStereoDft->mixer_mat_smooth[0][2][8] + hStereoDft->mixer_mat_smooth[0][3][8] ) + ( hStereoDft->mixer_mat_smooth[0][1][9] + hStereoDft->mixer_mat_smooth[0][2][9] + hStereoDft->mixer_mat_smooth[0][3][9] ) + ( hStereoDft->mixer_mat_smooth[0][1][10] + hStereoDft->mixer_mat_smooth[0][2][10] + hStereoDft->mixer_mat_smooth[0][3][10] ); + + g_Y_1 = ( hStereoDft->mixer_mat_smooth[1][1][8] + hStereoDft->mixer_mat_smooth[1][2][8] + hStereoDft->mixer_mat_smooth[1][3][8] ) + ( hStereoDft->mixer_mat_smooth[1][1][9] + hStereoDft->mixer_mat_smooth[1][2][9] + hStereoDft->mixer_mat_smooth[1][3][9] ) + ( hStereoDft->mixer_mat_smooth[1][1][10] + hStereoDft->mixer_mat_smooth[1][2][10] + hStereoDft->mixer_mat_smooth[1][3][10] ); + + g_W_2 = ( hStereoDft->mixer_mat_smooth[0][1][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][8 + IVAS_MAX_NUM_BANDS] ) + ( hStereoDft->mixer_mat_smooth[0][1][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][9 + IVAS_MAX_NUM_BANDS] ) + ( hStereoDft->mixer_mat_smooth[0][1][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][10 + IVAS_MAX_NUM_BANDS] ); + + g_Y_2 = ( hStereoDft->mixer_mat_smooth[1][1][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][8 + IVAS_MAX_NUM_BANDS] ) + ( hStereoDft->mixer_mat_smooth[1][1][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][9 + IVAS_MAX_NUM_BANDS] ) + ( hStereoDft->mixer_mat_smooth[1][1][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][10 + IVAS_MAX_NUM_BANDS] ); + + g_L = 0.16f * ( g_W_1 + g_W_2 - g_Y_1 - g_Y_2 ); + g_R = 0.16f * ( g_W_1 + g_W_2 + g_Y_1 + g_Y_2 ); + + for ( i = 0; i < dftOvlLen; i++ ) + { + win_in = win_dft[STEREO_DFT32MS_STEP * i] * win_dft[STEREO_DFT32MS_STEP * i]; + win_out = 1 - win_in; + + stefi_L = ( win_out * hStereoDft->g_L_prev + win_in * g_L ) * 0.5f * hStereoDft->hb_stefi_sig[i]; + stefi_R = ( win_out * hStereoDft->g_R_prev + win_in * g_R ) * 0.5f * hStereoDft->hb_stefi_sig[i]; + + output[0][i] += stefi_L; + output[1][i] += stefi_R; +#ifdef DFT_STEREO_SPAR_MIXING_DEBUG + fprintf( f_stefi, "%f %f\n", stefi_L, stefi_R ); +#endif + } + for ( i = dftOvlLen; i < output_frame; i++ ) + { + + stefi_L = g_L * 0.5f * hStereoDft->hb_stefi_sig[i]; + stefi_R = g_R * 0.5f * hStereoDft->hb_stefi_sig[i]; + + output[0][i] += stefi_L; + output[1][i] += stefi_R; +#ifdef DFT_STEREO_SPAR_MIXING_DEBUG + fprintf( f_stefi, "%f %f\n", stefi_L, stefi_R ); +#endif + } + hStereoDft->g_L_prev = g_L; + hStereoDft->g_R_prev = g_R; + } + else +#endif + if ( max( hStereoDft->td_gain[0], hStereoDft->td_gain[1] ) > 0 ) { win_dft = hStereoDft->win32ms; dftOvlLen = hStereoDft->dft32ms_ovl; @@ -475,12 +638,18 @@ static void ivas_sba_dirac_stereo_apply_td_stefi( output[0][i] += tmp; output[1][i] -= tmp; +#ifdef DFT_STEREO_SPAR_MIXING_DEBUG + fprintf( f_stefi, "%f %f\n", +tmp, -tmp ); +#endif } for ( i = dftOvlLen; i < output_frame; i++ ) { tmp = hStereoDft->td_gain[0] * 0.5f * hStereoDft->hb_stefi_sig[i]; output[0][i] += tmp; output[1][i] -= tmp; +#ifdef DFT_STEREO_SPAR_MIXING_DEBUG + fprintf( f_stefi, "%f %f\n", +tmp, -tmp ); +#endif } } @@ -496,35 +665,168 @@ static void ivas_sba_dirac_stereo_apply_td_stefi( void ivas_sba_dirac_stereo_smooth_parameters( STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: decoder DFT stereo handle */ +#ifdef DFT_STEREO_SPAR_MIXING + , + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ + int16_t cross_fade_start_offset, /* i: SPAR mixer delay compensation */ + int32_t output_Fs /* i: Fs for delay calculation */ +#endif ) { - int16_t k_offset, b; + +#ifdef DFT_STEREO_SPAR_MIXING + int16_t i, j, k, i_sf; +#endif + + int16_t b; + int16_t k_offset; float *side_gain, *prev_side_gain; float *res_pred_gain, *prev_res_pred_gain; k_offset = STEREO_DFT_OFFSET; - prev_side_gain = hStereoDft->side_gain; side_gain = hStereoDft->side_gain + k_offset * STEREO_DFT_BAND_MAX; prev_res_pred_gain = hStereoDft->res_pred_gain; res_pred_gain = hStereoDft->res_pred_gain + k_offset * STEREO_DFT_BAND_MAX; - /* Smoothing of side and prediction gains between ftrames */ - for ( b = hStereoDft->res_pred_band_min; b < hStereoDft->nbands; b++ ) +#ifdef DFT_STEREO_SPAR_MIXING + if ( !hMdDec ) +#endif { - if ( hStereoDft->attackPresent ) + /* Smoothing of side and prediction gains between ftrames */ + for ( b = hStereoDft->res_pred_band_min; b < hStereoDft->nbands; b++ ) { - res_pred_gain[b] *= 0.8f; - res_pred_gain[b + STEREO_DFT_BAND_MAX] *= 0.8f; + if ( hStereoDft->attackPresent ) + { + res_pred_gain[b] *= 0.8f; + res_pred_gain[b + STEREO_DFT_BAND_MAX] *= 0.8f; + } + else + { + side_gain[b] = hStereoDft->smooth_fac[0][b] * prev_side_gain[b] + ( 1.f - hStereoDft->smooth_fac[0][b] ) * side_gain[b]; + side_gain[b + STEREO_DFT_BAND_MAX] = hStereoDft->smooth_fac[1][b] * side_gain[b] + ( 1.f - hStereoDft->smooth_fac[1][b] ) * side_gain[b + STEREO_DFT_BAND_MAX]; + res_pred_gain[b] = hStereoDft->smooth_fac[0][b] * prev_res_pred_gain[b] + ( 1.f - hStereoDft->smooth_fac[0][b] ) * res_pred_gain[b]; + res_pred_gain[b + STEREO_DFT_BAND_MAX] = hStereoDft->smooth_fac[1][b] * res_pred_gain[b] + ( 1.f - hStereoDft->smooth_fac[1][b] ) * res_pred_gain[b + STEREO_DFT_BAND_MAX]; + } } - else + } + +#ifdef DFT_STEREO_SPAR_MIXING + if ( hMdDec != 0 ) + { + float xfade_start_ns; + int16_t xfade_delay_subframes; + int16_t i_hist; + +#ifdef DFT_STEREO_SPAR_MIXING_DEBUG + static FILE *f_smoothing = 0; + if ( f_smoothing == 0 ) { - side_gain[b] = hStereoDft->smooth_fac[0][b] * prev_side_gain[b] + ( 1.f - hStereoDft->smooth_fac[0][b] ) * side_gain[b]; - side_gain[b + STEREO_DFT_BAND_MAX] = hStereoDft->smooth_fac[1][b] * side_gain[b] + ( 1.f - hStereoDft->smooth_fac[1][b] ) * side_gain[b + STEREO_DFT_BAND_MAX]; - res_pred_gain[b] = hStereoDft->smooth_fac[0][b] * prev_res_pred_gain[b] + ( 1.f - hStereoDft->smooth_fac[0][b] ) * res_pred_gain[b]; - res_pred_gain[b + STEREO_DFT_BAND_MAX] = hStereoDft->smooth_fac[1][b] * res_pred_gain[b] + ( 1.f - hStereoDft->smooth_fac[1][b] ) * res_pred_gain[b + STEREO_DFT_BAND_MAX]; + f_smoothing = fopen( "stereo_param_smoothing.txt", "w" ); } - } +#endif + + xfade_start_ns = cross_fade_start_offset / (float) output_Fs * 1000000000.f - IVAS_FB_ENC_DELAY_NS; + xfade_delay_subframes = (int16_t) ( xfade_start_ns / ( FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ) ); + + i_hist = 4 - xfade_delay_subframes; + + for ( k = 0; k < 2; k++ ) + { + for ( i_sf = k * 2; i_sf < ( k + 1 ) * 2; i_sf++ ) + { + if ( hStereoDft->first_frame ) + { + for ( i = 0; i < 2; i++ ) + { + for ( j = 0; j < 4; j++ ) + { + for ( b = 0; b < hStereoDft->nbands; b++ ) + { + hStereoDft->mixer_mat_smooth[i][j][b + k * IVAS_MAX_NUM_BANDS] = hMdDec->mixer_mat[i][j][b]; + } + for ( ; b < IVAS_MAX_NUM_BANDS; b++ ) + { + hStereoDft->mixer_mat_smooth[i][j][b + k * IVAS_MAX_NUM_BANDS] = 0.f; + } + } + } + } + else + { + for ( i = 0; i < 2; i++ ) + { + for ( j = 0; j < 4; j++ ) + { + for ( b = 0; b < hStereoDft->nbands; b++ ) + { + float beta = hStereoDft->smooth_fac[k][b]; + hStereoDft->mixer_mat_smooth[i][j][b + k * IVAS_MAX_NUM_BANDS] = + beta * hStereoDft->mixer_mat_smooth[i][j][b + k * IVAS_MAX_NUM_BANDS] + ( 1 - beta ) * hMdDec->mixer_mat_prev[i_hist][i][j][b]; + +#ifdef DFT_STEREO_SPAR_MIXING_DEBUG + if ( i == 0 && j == 0 ) + { + fprintf( f_smoothing, "%d %f\n", b, beta ); + } +#endif + } + } + } + } // first_frame + + mvr2r( hMdDec->mixer_mat_prev[1][0][0], hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hMdDec->mixer_mat_prev[2][0][0], hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hMdDec->mixer_mat_prev[3][0][0], hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hMdDec->mixer_mat_prev[4][0][0], hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + + for ( i = 0; i < 2; i++ ) + { + for ( j = 0; j < 4; j++ ) + { + for ( b = 0; b < hStereoDft->nbands; b++ ) + { + hMdDec->mixer_mat_prev[4][i][j][b] = hMdDec->mixer_mat[i][j][b + i_sf * IVAS_MAX_NUM_BANDS]; + } + } + } + } // i_sf + } // k ( DFT block ) + hStereoDft->first_frame = 0; + +#ifdef DFT_STEREO_SPAR_MIXING_DEBUG + { + static FILE *f_mat = 0; + + if ( f_mat == 0 ) + f_mat = fopen( "mixer_mat_stereo_smooth", "w" ); + + for ( i = 0; i < 2; i++ ) + { + for ( j = 0; j < 4; j++ ) + { + for ( b = 0; b < 12; b++ ) + { + fprintf( f_mat, "%f\n", hStereoDft->mixer_mat_smooth[i][j][b] ); + } + } + } + + for ( i = 0; i < 2; i++ ) + { + for ( j = 0; j < 4; j++ ) + { + for ( b = 0; b < 12; b++ ) + { + fprintf( f_mat, "%f\n", hStereoDft->mixer_mat_smooth[i][j][b + IVAS_MAX_NUM_BANDS] ); + } + } + } + } // debug output +#endif + + } // hMdDec != 0 +#endif return; } @@ -540,6 +842,10 @@ void ivas_sba_dirac_stereo_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float output[CPE_CHANNELS][L_FRAME48k], /* i/o: output synthesis signal */ const int16_t output_frame /* i : output frame length per channel */ +#ifdef DFT_STEREO_SPAR_MIXING + , + const int16_t mcmasa +#endif ) { int16_t dtx_flag, fd_cng_flag; @@ -556,30 +862,86 @@ void ivas_sba_dirac_stereo_dec( hSCE = st_ivas->hSCE[0]; hCPE = st_ivas->hCPE[0]; hStereoDft = hCPE->hStereoDft; - dtx_flag = ( hSCE->hCoreCoder[0]->core_brate <= SID_2k40 ); - fd_cng_flag = ( dtx_flag && hSCE->hCoreCoder[0]->cng_type == FD_CNG ); +#ifdef DFT_STEREO_SPAR_MIXING + if ( st_ivas->nchan_transport > 1 && !mcmasa ) + { + dtx_flag = 0; + fd_cng_flag = 0; + } + else +#endif + { + dtx_flag = ( hSCE->hCoreCoder[0]->core_brate <= SID_2k40 ); + fd_cng_flag = ( dtx_flag && hSCE->hCoreCoder[0]->cng_type == FD_CNG ); + } + memOffset = NS2SA( output_frame * FRAMES_PER_SEC, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ); ivas_sba_dirac_stereo_config( hStereoDft->hConfig ); - hStereoDft->nbands = ivas_sba_dirac_stereo_band_config( hStereoDft->band_limits, st_ivas->hDecoderConfig->output_Fs, hStereoDft->NFFT ); + hStereoDft->nbands = ivas_sba_dirac_stereo_band_config( + hStereoDft->band_limits, + st_ivas->hDecoderConfig->output_Fs, + hStereoDft->NFFT +#ifdef DFT_STEREO_SPAR_MIXING + , + ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) +#endif + ); stereo_dft_dec_update( hStereoDft, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/ ); +#ifdef DFT_STEREO_SPAR_MIXING + if ( st_ivas->nchan_transport > 1 ) + { + stereo_dft_dec_analyze( hCPE, output[0], DFT, 0, output_frame, output_frame, DFT_STEREO_DEC_ANA_FB, 0, 0 ); + stereo_dft_dec_analyze( hCPE, output[1], DFT, 1, output_frame, output_frame, DFT_STEREO_DEC_ANA_FB, 0, 0 ); + hStereoDft->core_hist[0] = hCPE->hCoreCoder[0]->core; + } + else +#endif + { + /* nrg calculation for TD Stereo Filling, as done in ICBWE which is not used in this case */ + ivas_sba_dirac_stereo_compute_td_stefi_nrgs( hStereoDft, hSCE->save_hb_synth, hSCE->hCoreCoder[0]->core, output_frame, fd_cng_flag ); - /* nrg calculation for TD Stereo Filling, as done in ICBWE which is not used in this case */ - ivas_sba_dirac_stereo_compute_td_stefi_nrgs( hStereoDft, hSCE->save_hb_synth, hSCE->hCoreCoder[0]->core, output_frame, fd_cng_flag ); - - /* do DFT Stereo core switching (including DFT analysis) here as CPE element was not available in SCE decoder */ - mvr2r( hSCE->save_synth, tmp_synth, hSCE->hCoreCoder[0]->L_frame ); - stereo_dft_dec_core_switching( hCPE, output[0] /*hSCE->save_output*/, hSCE->save_synth, hSCE->save_hb_synth, DFT, output_frame, 0, dtx_flag ); + /* do DFT Stereo core switching (including DFT analysis) here as CPE element was not available in SCE decoder */ + mvr2r( hSCE->save_synth, tmp_synth, hSCE->hCoreCoder[0]->L_frame ); + stereo_dft_dec_core_switching( hCPE, output[0] /*hSCE->save_output*/, hSCE->save_synth, hSCE->save_hb_synth, DFT, output_frame, 0, dtx_flag ); - /* do updates here after skipping this in SCE decoder (needs to be done after core switching) */ - updt_dec_common( hSCE->hCoreCoder[0], NORMAL_HQ_CORE, -1, hSCE->save_synth ); + /* do updates here after skipping this in SCE decoder (needs to be done after core switching) */ + updt_dec_common( hSCE->hCoreCoder[0], NORMAL_HQ_CORE, -1, hSCE->save_synth ); + } /* mapping of DirAC parameters (azimuth, elevation, diffuseness) to DFT Stereo parameters (side gain, prediction gain) */ - map_params_dirac_to_stereo( hStereoDft, st_ivas->hQMetaData, tmp_synth, DFT[0], st_ivas->ivas_format == MC_FORMAT, hSCE->hCoreCoder[0]->L_frame ); + map_params_dirac_to_stereo( + hStereoDft, + st_ivas->hQMetaData, + tmp_synth, + DFT[0], + st_ivas->ivas_format == MC_FORMAT, +#ifdef DFT_STEREO_SPAR_MIXING + ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ) ? hSCE->hCoreCoder[0]->L_frame : output_frame, + ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ) +#else + hSCE->hCoreCoder[0]->L_frame +#endif + ); + +#ifdef DFT_STEREO_SPAR_MIXING + if ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) + { + set_f( hStereoDft->res_pred_gain, 1.f, 3 * STEREO_DFT_BAND_MAX ); + } +#endif /* DFT Stereo upmix */ - stereo_dft_dec( hStereoDft, hCPE->hCoreCoder[0], DFT, NULL, NULL, 1 /*st_ivas->sba_dirac_stereo_flag*/ ); + stereo_dft_dec( hStereoDft, hCPE->hCoreCoder[0], DFT, NULL, NULL, 1 /*st_ivas->sba_dirac_stereo_flag*/ +#ifdef DFT_STEREO_SPAR_MIXING + , + ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hMdDec : 0, + ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hFbMixer->cross_fade_start_offset : 0, + st_ivas->hDecoderConfig->output_Fs, + st_ivas->nchan_transport +#endif + ); /* DFT synthesis */ stereo_dft_dec_synthesize( hCPE, DFT, 0, output[0], output_frame ); @@ -592,23 +954,49 @@ void ivas_sba_dirac_stereo_dec( v_multc( output[1], 0.5f, output[1], output_frame ); /* delay HB synth */ - mvr2r( hSCE->save_hb_synth + output_frame - memOffset, tmp_buf, memOffset ); - mvr2r( hSCE->save_hb_synth, hSCE->save_hb_synth + memOffset, output_frame - memOffset ); - mvr2r( hSCE->prev_hb_synth, hSCE->save_hb_synth, memOffset ); - mvr2r( tmp_buf, hSCE->prev_hb_synth, memOffset ); +#ifdef DFT_STEREO_SPAR_MIXING + if ( st_ivas->nchan_transport == 1 ) +#endif + { + mvr2r( hSCE->save_hb_synth + output_frame - memOffset, tmp_buf, memOffset ); + mvr2r( hSCE->save_hb_synth, hSCE->save_hb_synth + memOffset, output_frame - memOffset ); + mvr2r( hSCE->prev_hb_synth, hSCE->save_hb_synth, memOffset ); + mvr2r( tmp_buf, hSCE->prev_hb_synth, memOffset ); + } if ( ( hCPE->hCoreCoder[0]->core == ACELP_CORE || hCPE->hCoreCoder[0]->last_core == ACELP_CORE ) && !fd_cng_flag ) { /* upmix ACELP BWE */ ivas_sba_dirac_stereo_compute_hb_gain( hStereoDft, hb_gain ); - ivas_sba_dirac_stereo_upmix_hb( hb_synth_stereo, hSCE->save_hb_synth, hb_gain, output_frame ); + +#ifdef DFT_STEREO_SPAR_MIXING + if ( st_ivas->nchan_transport == 1 ) +#endif + { + ivas_sba_dirac_stereo_upmix_hb( + hb_synth_stereo, + hSCE->save_hb_synth, + hb_gain, + output_frame +#ifdef DFT_STEREO_SPAR_MIXING + , + ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ), + hStereoDft +#endif + ); + } /* add HB to ACELP core */ v_add( output[0], hb_synth_stereo[0], output[0], output_frame ); v_add( output[1], hb_synth_stereo[1], output[1], output_frame ); /* apply TD Stereo Filling as is done in ICBWE */ - ivas_sba_dirac_stereo_apply_td_stefi( hStereoDft, output, output_frame ); + ivas_sba_dirac_stereo_apply_td_stefi( hStereoDft, output, output_frame +#ifdef DFT_STEREO_SPAR_MIXING + , + ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) +#endif + ); } return; diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index a9df2ff34b..cd14d7e132 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -631,7 +631,7 @@ void ivas_spar_md_dec_process( ivas_spar_dec_parse_md_bs( hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, st_ivas->hQMetaData->sba_inactive_mode ); -#ifdef DEBUG_SBA_MD_DUMP +#if 0 { char f_name[100]; int16_t num_bands = nB; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h old mode 100644 new mode 100755 index 59059fbcea..a8e1505498 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -230,6 +230,14 @@ typedef struct stereo_dft_dec_data_struct float smooth_buf[SBA_DIRAC_STEREO_NUM_BANDS][SBA_DIRAC_NRG_SMOOTH_LONG + 1]; float smooth_fac[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS]; +#ifdef DFT_STEREO_SPAR_MIXING + int16_t first_frame; + float mixer_mat_smooth[2][4][2 * IVAS_MAX_NUM_BANDS]; + float g_L_prev; + float g_R_prev; + const float *max_smooth_gains, *min_smooth_gains; +#endif + } STEREO_DFT_DEC_DATA, *STEREO_DFT_DEC_DATA_HANDLE; @@ -1280,7 +1288,6 @@ typedef struct ivas_binaural_rendering_conv_module_struct /* Fastconv binaural data structure */ -#ifdef HRTF_BINARY_FILE typedef struct ivas_hrtfs_fastconv_struct { float FASTCONV_HRIR_latency_s; @@ -1305,9 +1312,7 @@ typedef struct ivas_hrtfs_fastconv_struct float fastconvReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX]; } HRTFS_FASTCONV, *HRTFS_FASTCONV_HANDLE; -#endif -#ifdef HRTF_BINARY_FILE typedef struct ivas_hrtfs_parambin_struct { float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; @@ -1318,7 +1323,6 @@ typedef struct ivas_hrtfs_parambin_struct float parametricEarlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; } HRTFS_PARAMBIN, *HRTFS_PARAMBIN_HANDLE; -#endif typedef struct ivas_binaural_rendering_struct { @@ -1810,7 +1814,6 @@ typedef struct ivas_crend_state_t } CREND_DATA, *CREND_HANDLE; -#ifdef HRTF_BINARY_FILE /* htrfs from binary files. */ @@ -1840,7 +1843,6 @@ typedef struct ivas_hrtfs_file_header_t } ivas_hrtfs_file_header_t; -#endif /*----------------------------------------------------------------------------------* * LFE decoder structure @@ -1991,11 +1993,9 @@ typedef struct Decoder_Struct CREND_HANDLE hCrend; /* Convolution mixer renderer structure */ HRTFS_HANDLE hHrtf; /* HRTFs handle */ #endif -#ifdef HRTF_BINARY_FILE HRTFS_CREND_HANDLE hSetOfHRTF; /* Set of HRTFs handle (CRend) */ HRTFS_FASTCONV_HANDLE hHrtfFastConv; /* FASTCONV HRTF tables for binaural rendering */ HRTFS_PARAMBIN_HANDLE hHrtfParambin; /* HRTF tables for parametric binauralizer */ -#endif LSSETUP_CUSTOM_HANDLE hLsSetupCustom; /* Custom LS configuration handle */ float *hoa_dec_mtx; /* Pointer to decoder matrix for SBA */ HEAD_TRACK_DATA_HANDLE hHeadTrackData; /* Head tracking data structure */ diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c old mode 100644 new mode 100755 index e2eab3f3b2..3be3c59428 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -76,7 +76,12 @@ * Local function prototypes *-------------------------------------------------------------------------*/ -static void stereo_dft_dec_open( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, const int32_t output_Fs ); +static void stereo_dft_dec_open( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, const int32_t output_Fs +#ifdef DFT_STEREO_SPAR_MIXING + , + const int16_t nchan_transport +#endif +); static void stereo_dft_compute_td_stefi_params( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, const float samp_ratio ); @@ -252,6 +257,10 @@ ivas_error stereo_dft_dec_create( const int32_t element_brate, /* i : element bitrate */ const int32_t output_Fs, /* i : output sampling rate */ const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ +#ifdef DFT_STEREO_SPAR_MIXING + , + const int16_t nchan_transport +#endif ) { STEREO_DFT_DEC_DATA_HANDLE hStereoDft_loc; @@ -293,7 +302,12 @@ ivas_error stereo_dft_dec_create( stereo_dft_config( hStereoDft_loc->hConfig, element_brate, &tmpS, &tmpS ); } - stereo_dft_dec_open( hStereoDft_loc, output_Fs ); + stereo_dft_dec_open( hStereoDft_loc, output_Fs +#ifdef DFT_STEREO_SPAR_MIXING + , + nchan_transport +#endif + ); *hStereoDft = hStereoDft_loc; @@ -310,6 +324,10 @@ ivas_error stereo_dft_dec_create( static void stereo_dft_dec_open( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ const int32_t output_Fs /* i : output sampling rate */ +#ifdef DFT_STEREO_SPAR_MIXING + , + const int16_t nchan_transport +#endif ) { @@ -365,6 +383,19 @@ static void stereo_dft_dec_open( hStereoDft->hb_stefi_delay = NS2SA( output_Fs, STEREO_DFT_TD_STEFI_DELAY_NS ); +#ifdef DFT_STEREO_SPAR_MIXING + if ( nchan_transport > 2 ) + { + hStereoDft->min_smooth_gains = min_smooth_gains2; + hStereoDft->max_smooth_gains = max_smooth_gains2; + } + else + { + hStereoDft->min_smooth_gains = min_smooth_gains1; + hStereoDft->max_smooth_gains = max_smooth_gains1; + } +#endif + /* reset DFT stereo memories */ stereo_dft_dec_reset( hStereoDft ); @@ -383,6 +414,9 @@ void stereo_dft_dec_reset( ) { int16_t i; +#ifdef DFT_STEREO_SPAR_MIXING + int16_t j, b; +#endif /*Configuration*/ set_s( hStereoDft->prm_res, hStereoDft->hConfig->prm_res, STEREO_DFT_DEC_DFT_NB ); @@ -490,6 +524,23 @@ void stereo_dft_dec_reset( hStereoDft->ipd_xfade_counter = 0; hStereoDft->ipd_xfade_prev = 0.0f; +#ifdef DFT_STEREO_SPAR_MIXING + for ( b = 0; b < hStereoDft->nbands; b++ ) + { + for ( i = 0; i < 2; i++ ) + { + for ( j = 0; j < 4; j++ ) + { + hStereoDft->mixer_mat_smooth[i][j][b] = 0.0f; + } + } + } + hStereoDft->first_frame = 1; + hStereoDft->g_L_prev = 0.f; + hStereoDft->g_R_prev = 0.f; +#endif + + return; } @@ -1097,6 +1148,13 @@ void stereo_dft_dec( float *input_mem, /* i/o: mem of buffer DFT analysis */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ +#ifdef DFT_STEREO_SPAR_MIXING + , + ivas_spar_md_dec_state_t *hMdDec, /* i: SPAR MD handle for upmixing */ + int16_t cross_fade_start_offset, /* i: SPAR mixer delay compensation */ + int32_t output_Fs, /* i: Fs for delay calculation */ + int16_t nchan_transport /* i: number of transpor channels */ +#endif ) { int16_t i, k, b, N_div, stop; @@ -1104,6 +1162,9 @@ void stereo_dft_dec( float DFT_R[STEREO_DFT32MS_N_MAX]; float DFT_PRED_RES[STEREO_DFT32MS_N_32k]; float *pDFT_DMX; +#ifdef DFT_STEREO_SPAR_MIXING + float *pDFT_DMX1; +#endif float *pDFT_RES; float g, tmp; float *pPredGain; @@ -1127,6 +1188,10 @@ void stereo_dft_dec( HANDLE_FD_CNG_COM hFdCngCom = hFdCngDec->hFdCngCom; int16_t *cna_seed = &( hFdCngCom->seed ); +#ifdef DFT_STEREO_SPAR_MIXING + float DFT_W, DFT_Y; +#endif + output_frame = (int16_t) ( st0->output_Fs / FRAMES_PER_SEC ); /*------------------------------------------------------------------* @@ -1168,7 +1233,14 @@ void stereo_dft_dec( /* Smoothing for the current frame */ if ( sba_dirac_stereo_flag ) { - ivas_sba_dirac_stereo_smooth_parameters( hStereoDft ); + ivas_sba_dirac_stereo_smooth_parameters( hStereoDft +#ifdef DFT_STEREO_SPAR_MIXING + , + hMdDec, + cross_fade_start_offset, + output_Fs +#endif + ); } else { @@ -1193,6 +1265,13 @@ void stereo_dft_dec( { pDFT_DMX = DFT[0] + k * STEREO_DFT32MS_N_MAX; pDFT_RES = DFT[1] + k * STEREO_DFT32MS_N_MAX; +#ifdef DFT_STEREO_SPAR_MIXING + pDFT_DMX1 = 0; + if ( nchan_transport > 1 ) + { + pDFT_DMX1 = DFT[1] + k * STEREO_DFT32MS_N_MAX; + } +#endif /*Apply Stereo*/ if ( hStereoDft->hConfig->dmx_active ) @@ -1236,7 +1315,14 @@ void stereo_dft_dec( hStereoDft->past_DMX_pos = ( hStereoDft->past_DMX_pos + STEREO_DFT_PAST_MAX - 1 ) % STEREO_DFT_PAST_MAX; } +#ifdef DFT_STEREO_SPAR_MIXING + if ( !( sba_dirac_stereo_flag && nchan_transport >= 2 ) ) + { + stereo_dft_generate_res_pred( hStereoDft, samp_ratio, pDFT_DMX, DFT_PRED_RES, pPredGain, k, DFT[1] + k * STEREO_DFT32MS_N_MAX, &stop, st0->bfi ); + } +#else stereo_dft_generate_res_pred( hStereoDft, samp_ratio, pDFT_DMX, DFT_PRED_RES, pPredGain, k, DFT[1] + k * STEREO_DFT32MS_N_MAX, &stop, st0->bfi ); +#endif if ( hStereoDft->res_cod_band_max > 0 ) { @@ -1308,7 +1394,11 @@ void stereo_dft_dec( #endif /* No residual coding in inactive frames, instead pDFT_RES is used for the second channel */ +#ifdef DFT_STEREO_SPAR_MIXING + if ( b >= hStereoDft->res_cod_band_max && !hStereoDft->frame_sid_nodata && !( sba_dirac_stereo_flag && hMdDec ) ) +#else if ( b >= hStereoDft->res_cod_band_max && !hStereoDft->frame_sid_nodata ) +#endif { /*filter non-coded frequencies. It removes some MDCT frequency aliasing*/ for ( i = hStereoDft->band_limits[b]; i < hStereoDft->band_limits[b + 1]; i++ ) @@ -1358,10 +1448,206 @@ void stereo_dft_dec( } } } +#ifdef DFT_STEREO_SPAR_MIXING + else if ( sba_dirac_stereo_flag && hMdDec ) + { +#ifdef DFT_STEREO_SPAR_MIXING_DEBUG + { + static FILE *f_dmx = 0, *f_res = 0, *f_dmx1 = 0; + + if ( f_dmx == 0 ) + { + f_dmx = fopen( "dft_dmx.txt", "w" ); + f_res = fopen( "dft_pred_res.txt", "w" ); + if ( nchan_transport >= 2 ) + { + f_dmx1 = fopen( "dft_dmx1.txt", "w" ); + } + } + + if ( b == 0 ) + { + i = 0; + fprintf( f_dmx, "%d %f %f\n", i, pDFT_DMX[2 * i], pDFT_DMX[2 * i + 1] ); + if ( nchan_transport >= 2 ) + { + fprintf( f_dmx1, "%d %f %f\n", i, pDFT_DMX1[2 * i], pDFT_DMX1[2 * i + 1] ); + } + fprintf( f_res, "%d %f %f\n", i, 0.0f, 0.0f ); + } + for ( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) + { + fprintf( f_dmx, "%d %f %f\n", i, pDFT_DMX[2 * i], pDFT_DMX[2 * i + 1] ); + if ( nchan_transport >= 2 ) + { + fprintf( f_dmx1, "%d %f %f\n", i, pDFT_DMX1[2 * i], pDFT_DMX1[2 * i + 1] ); + } + fprintf( f_res, "%d %f %f\n", i, DFT_PRED_RES[2 * i], DFT_PRED_RES[2 * i + 1] ); + } + for ( ; i < hStereoDft->band_limits[b + 1]; i++ ) + { + fprintf( f_dmx, "%d %f %f\n", i, pDFT_DMX[2 * i], pDFT_DMX[2 * i + 1] ); + if ( nchan_transport >= 2 ) + { + fprintf( f_dmx1, "%d %f %f\n", i, pDFT_DMX1[2 * i], pDFT_DMX1[2 * i + 1] ); + } + fprintf( f_res, "%d %f %f\n", i, 0.0f, 0.0f ); + } + } +#endif + + if ( nchan_transport == 1 ) + { + if ( b == 0 ) + { + i = 0; + + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + + DFT_L[2 * i] = DFT_W + DFT_Y; + DFT_R[2 * i] = DFT_W - DFT_Y; + + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + + DFT_L[2 * i + 1] = DFT_W + DFT_Y; + DFT_R[2 * i + 1] = DFT_W - DFT_Y; + } + for ( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) + { + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + ( hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + ( hStereoDft->mixer_mat_smooth[1][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i]; + + DFT_L[2 * i] = DFT_W + DFT_Y; + DFT_R[2 * i] = DFT_W - DFT_Y; + + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + ( hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i + 1]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + ( hStereoDft->mixer_mat_smooth[1][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i + 1]; + + DFT_L[2 * i + 1] = DFT_W + DFT_Y; + DFT_R[2 * i + 1] = DFT_W - DFT_Y; + } + for ( ; i < hStereoDft->band_limits[b + 1]; i++ ) + { + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + + DFT_L[2 * i] = DFT_W + DFT_Y; + DFT_R[2 * i] = DFT_W - DFT_Y; + + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + + DFT_L[2 * i + 1] = DFT_W + DFT_Y; + DFT_R[2 * i + 1] = DFT_W - DFT_Y; + } + } + else if ( nchan_transport >= 2 ) + { + if ( b == 0 ) + { + i = 0; + + DFT_W = pDFT_DMX[2 * i]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + pDFT_DMX1[2 * i]; + + DFT_L[2 * i] = DFT_W + DFT_Y; + DFT_R[2 * i] = DFT_W - DFT_Y; + + DFT_W = pDFT_DMX[2 * i + 1]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + pDFT_DMX1[2 * i + 1]; + + DFT_L[2 * i + 1] = DFT_W + DFT_Y; + DFT_R[2 * i + 1] = DFT_W - DFT_Y; + } + for ( i = hStereoDft->band_limits[b]; i < hStereoDft->band_limits[b + 1]; i++ ) + { + DFT_W = pDFT_DMX[2 * i]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + pDFT_DMX1[2 * i]; + + DFT_L[2 * i] = DFT_W + DFT_Y; + DFT_R[2 * i] = DFT_W - DFT_Y; + + DFT_W = pDFT_DMX[2 * i + 1]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + pDFT_DMX1[2 * i + 1]; + + DFT_L[2 * i + 1] = DFT_W + DFT_Y; + DFT_R[2 * i + 1] = DFT_W - DFT_Y; + } + } + else + { + assert( "nhcan_transport must be 1 or 1!" ); + } + +#ifdef DFT_STEREO_SPAR_MIXING_DEBUG + { + static FILE *f_L = 0, *f_R = 0; + + if ( f_L == 0 ) + { + f_L = fopen( "dft_L.txt", "w" ); + f_R = fopen( "dft_R.txt", "w" ); + } + + if ( b == 0 ) + { + i = 0; + fprintf( f_L, "%d %f %f\n", i, DFT_L[2 * i], DFT_L[2 * i + 1] ); + fprintf( f_R, "%d %f %f\n", i, DFT_L[2 * i], DFT_L[2 * i + 1] ); + } + for ( i = hStereoDft->band_limits[b]; i < hStereoDft->band_limits[b + 1]; i++ ) + { + fprintf( f_L, "%d %f %f\n", i, DFT_L[2 * i], DFT_L[2 * i + 1] ); + fprintf( f_R, "%d %f %f\n", i, DFT_L[2 * i], DFT_L[2 * i + 1] ); + } + } +#endif + } +#endif else { + +#ifdef DFT_STEREO_SPAR_MIXING_DEBUG + { + static FILE *f_dmx = 0, *f_res = 0, *f_dmx1 = 0; + + if ( f_dmx == 0 ) + { + f_dmx = fopen( "dft_dmx.txt", "w" ); + f_res = fopen( "dft_pred_res.txt", "w" ); + if ( nchan_transport == 2 ) + { + f_dmx1 = fopen( "dft_dmx1.txt", "w" ); + } + } + + if ( b == 0 ) + { + i = 0; + fprintf( f_dmx, "%d %f %f\n", i, pDFT_DMX[2 * i], pDFT_DMX[2 * i + 1] ); + fprintf( f_dmx1, "%d %f %f\n", i, pDFT_DMX1[2 * i], pDFT_DMX1[2 * i + 1] ); + fprintf( f_res, "%d %f %f\n", i, 0.0f, 0.0f ); + } + for ( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) + { + fprintf( f_dmx, "%d %f %f\n", i, pDFT_DMX[2 * i], pDFT_DMX[2 * i + 1] ); + fprintf( f_dmx1, "%d %f %f\n", i, pDFT_DMX1[2 * i], pDFT_DMX1[2 * i + 1] ); + fprintf( f_res, "%d %f %f\n", i, DFT_PRED_RES[2 * i], DFT_PRED_RES[2 * i + 1] ); + } + for ( ; i < hStereoDft->band_limits[b + 1]; i++ ) + { + fprintf( f_dmx, "%d %f %f\n", i, pDFT_DMX[2 * i], pDFT_DMX[2 * i + 1] ); + fprintf( f_dmx1, "%d %f %f\n", i, pDFT_DMX1[2 * i], pDFT_DMX1[2 * i + 1] ); + fprintf( f_res, "%d %f %f\n", i, 0.0f, 0.0f ); + } + } +#endif + for ( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) { + tmp = g * pDFT_DMX[2 * i] + pDFT_RES[2 * i] + DFT_PRED_RES[2 * i]; DFT_L[2 * i] = pDFT_DMX[2 * i] + tmp; diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 44b47bc5cb..c8b373ce5c 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -421,7 +421,12 @@ 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 ) ) != IVAS_ERR_OK ) + if ( ( error = stereo_dft_dec_create( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, 0 +#ifdef DFT_STEREO_SPAR_MIXING + , + nchan_transport +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -1115,7 +1120,14 @@ void synchro_synthesis( delay_signal( output[0], output_frame, hCPE->hCoreCoder[0]->hTcxDec->FBTCXdelayBuf, delay_diff ); } +#ifdef DFT_STEREO_SPAR_MIXING + if ( hCPE->element_mode != IVAS_CPE_MDCT ) + { + ivas_post_proc( NULL, hCPE, 0, output[0], output, output_frame, sba_dirac_stereo_flag ); + } +#else ivas_post_proc( NULL, hCPE, 0, output[0], output, output_frame, sba_dirac_stereo_flag ); +#endif /* zero padding in order to synchronize the upmixed DFT stereo synthesis with the TD/MDCT stereo synthesis */ for ( n = 0; n < hCPE->nchan_out; n++ ) @@ -1182,7 +1194,10 @@ void synchro_synthesis( /*----------------------------------------------------------------* * TD/MDCT stereo synchro *----------------------------------------------------------------*/ - +#ifdef DFT_STEREO_SPAR_MIXING + if ( sba_dirac_stereo_flag ) + return; +#endif if ( hCPE->element_mode == IVAS_CPE_TD || hCPE->element_mode == IVAS_CPE_MDCT ) { /* handling of DFT->TD switching */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 3f109b92b4..93f1a944de 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1021,7 +1021,6 @@ ivas_error IVAS_DEC_GetHrtfHandle( } -#ifdef HRTF_BINARY_FILE /*---------------------------------------------------------------------* * IVAS_DEC_GetHrtfCRendHandle( ) * @@ -1042,9 +1041,7 @@ ivas_error IVAS_DEC_GetHrtfCRendHandle( return IVAS_ERR_OK; } -#endif -#ifdef HRTF_BINARY_FILE /*---------------------------------------------------------------------* * IVAS_DEC_GetHrtfFastConvHandle( ) * @@ -1086,7 +1083,6 @@ ivas_error IVAS_DEC_GetHrtfParamBinHandle( return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------* * IVAS_DEC_GetRenderConfig( ) diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 0f72c2976f..d2e7b5d98b 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -292,7 +292,6 @@ ivas_error IVAS_DEC_GetHrtfHandle( IVAS_DEC_HRTF_HANDLE *hHrtfTD /* o : HRTF handle */ ); -#ifdef HRTF_BINARY_FILE /*! r: error code */ ivas_error IVAS_DEC_GetHrtfCRendHandle( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ @@ -308,7 +307,6 @@ ivas_error IVAS_DEC_GetHrtfParamBinHandle( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin /* o : Parametric binauralizer HRTF handle */ ); -#endif /*! r: error code*/ ivas_error IVAS_DEC_GetRenderConfig( diff --git a/lib_rend/ivas_binauralRenderer.c b/lib_rend/ivas_binauralRenderer.c index 15b546e3fc..9fe44ae558 100644 --- a/lib_rend/ivas_binauralRenderer.c +++ b/lib_rend/ivas_binauralRenderer.c @@ -124,12 +124,8 @@ static ivas_error ivas_binRenderer_convModuleOpen( const int16_t renderer_type, const int16_t isLoudspeaker, const AUDIO_CONFIG input_config, - const RENDER_CONFIG_DATA *hRenderConfig -#ifdef HRTF_BINARY_FILE - , - const HRTFS_FASTCONV_HANDLE hHrtf -#endif -) + const RENDER_CONFIG_DATA *hRenderConfig, + const HRTFS_FASTCONV_HANDLE hHrtf ) { int16_t bandIdx, chIdx; BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; @@ -316,17 +312,10 @@ static ivas_error ivas_binRenderer_convModuleOpen( if ( isLoudspeaker ) { -#ifdef HRTF_BINARY_FILE hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = hHrtf->leftBRIRReal[bandIdx][tmp]; hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = hHrtf->leftBRIRImag[bandIdx][tmp]; hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = hHrtf->rightBRIRReal[bandIdx][tmp]; hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = hHrtf->rightBRIRImag[bandIdx][tmp]; -#else - hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = leftBRIRReal[bandIdx][tmp]; - hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = leftBRIRImag[bandIdx][tmp]; - hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = rightBRIRReal[bandIdx][tmp]; - hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = rightBRIRImag[bandIdx][tmp]; -#endif } #ifdef DEBUGGING else @@ -344,32 +333,18 @@ static ivas_error ivas_binRenderer_convModuleOpen( if ( isLoudspeaker ) { -#ifdef HRTF_BINARY_FILE hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = hHrtf->leftHRIRReal[bandIdx][tmp]; hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = hHrtf->leftHRIRImag[bandIdx][tmp]; hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = hHrtf->rightHRIRReal[bandIdx][tmp]; hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = hHrtf->rightHRIRImag[bandIdx][tmp]; -#else - hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = leftHRIRReal[bandIdx][tmp]; - hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = leftHRIRImag[bandIdx][tmp]; - hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = rightHRIRReal[bandIdx][tmp]; - hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = rightHRIRImag[bandIdx][tmp]; -#endif } else { /* HOA3 filter coefficients */ -#ifdef HRTF_BINARY_FILE hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = hHrtf->leftHRIRReal_HOA3[bandIdx][chIdx]; hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = hHrtf->leftHRIRImag_HOA3[bandIdx][chIdx]; hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = hHrtf->rightHRIRReal_HOA3[bandIdx][chIdx]; hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = hHrtf->rightHRIRImag_HOA3[bandIdx][chIdx]; -#else - hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = leftHRIRReal_HOA3[bandIdx][chIdx]; - hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = leftHRIRImag_HOA3[bandIdx][chIdx]; - hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = rightHRIRReal_HOA3[bandIdx][chIdx]; - hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = rightHRIRImag_HOA3[bandIdx][chIdx]; -#endif } } } @@ -380,7 +355,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( return IVAS_ERR_OK; } -#ifdef HRTF_BINARY_FILE /*-------------------------------------------------------------------------* * ivas_binaural_HRTF_open() * @@ -443,7 +417,6 @@ static ivas_error ivas_binaural_hrtf_open( return IVAS_ERR_OK; } -#endif /*-------------------------------------------------------------------------* * ivas_binaural_obtain_DMX() @@ -631,26 +604,20 @@ ivas_error ivas_binRenderer_open( hBinRenderer->render_lfe = 1; } -#ifdef HRTF_BINARY_FILE /* Load HRTF tables */ ivas_binaural_hrtf_open( &st_ivas->hHrtfFastConv ); -#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && ( st_ivas->hIntSetup.is_loudspeaker_setup == 0 ) ) { IVAS_OUTPUT_SETUP out_setup; /* Allocate memories and buffers needed for convolutional module in CICP19 */ -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, 1, AUDIO_CONFIG_7_1_4, st_ivas->hRenderConfig, st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, 1, AUDIO_CONFIG_7_1_4, st_ivas->hRenderConfig ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -666,82 +633,42 @@ ivas_error ivas_binRenderer_open( } hBinRenderer->hoa_dec_mtx = st_ivas->hoa_dec_mtx; -#ifdef HRTF_BINARY_FILE st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f ); -#else - st_ivas->binaural_latency_ns = (int32_t) ( FASTCONV_BRIR_latency_s * 1000000000.f ); -#endif } else { /* Allocate memories and buffers needed for convolutional module */ -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup, st_ivas->hIntSetup.output_config, st_ivas->hRenderConfig, st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup, st_ivas->hIntSetup.output_config, st_ivas->hRenderConfig ) ) != IVAS_ERR_OK ) -#endif { return error; } -#ifdef FIX_FIX_I59 if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { if ( hBinRenderer->ivas_format == MC_FORMAT ) { -#ifdef HRTF_BINARY_FILE st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HRIR_latency_s * 1000000000.f ); -#else - st_ivas->binaural_latency_ns = (int32_t) ( FASTCONV_HRIR_latency_s * 1000000000.f ); -#endif } else { -#ifdef HRTF_BINARY_FILE st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HOA3_latency_s * 1000000000.f ); -#else - st_ivas->binaural_latency_ns = (int32_t) ( FASTCONV_HOA3_latency_s * 1000000000.f ); -#endif } } else { /* same value for MC or HOA both use MC BRIR*/ -#ifdef HRTF_BINARY_FILE st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f ); -#else - st_ivas->binaural_latency_ns = (int32_t) ( FASTCONV_BRIR_latency_s * 1000000000.f ); -#endif - } -#else - if ( hBinRenderer->ivas_format == MC_FORMAT ) - { -#ifdef HRTF_BINARY_FILE - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HRIR_latency_s * 1000000000.f ); -#else - st_ivas->binaural_latency_ns = (int32_t) ( FASTCONV_HRIR_latency_s * 1000000000.f ); -#endif } - else - { -#ifdef HRTF_BINARY_FILE - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HOA3_latency_s * 1000000000.f ); -#else - st_ivas->binaural_latency_ns = (int32_t) ( FASTCONV_HOA3_latency_s * 1000000000.f ); -#endif - } -#endif } /* Allocate memories needed for reverb module */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) { -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_binaural_reverb_open( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots, @@ -751,9 +678,6 @@ ivas_error ivas_binRenderer_open( RENDERER_BINAURAL_FASTCONV_ROOM, st_ivas->hHrtfFastConv, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_binaural_reverb_open( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hIntSetup.output_config, st_ivas->hDecoderConfig->output_Fs, RENDERER_BINAURAL_FASTCONV_ROOM ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1079,7 +1003,7 @@ void ivas_binRenderer( { #ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, - hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], + &hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); diff --git a/lib_rend/ivas_binaural_reverb.c b/lib_rend/ivas_binaural_reverb.c index 3d4c9d6fe2..ccff4323af 100644 --- a/lib_rend/ivas_binaural_reverb.c +++ b/lib_rend/ivas_binaural_reverb.c @@ -376,11 +376,9 @@ ivas_error ivas_binaural_reverb_open( const AUDIO_CONFIG output_config, /* i : output audio configuration */ const int32_t sampling_rate, /* i : sampling rate */ const RENDERER_TYPE renderer_type /* i : renderer type */ -#ifdef HRTF_BINARY_FILE , const HRTFS_FASTCONV_HANDLE hHrtfFastConv, /* i : FastConv HRTF handle */ const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ -#endif ) { int16_t bin, chIdx, k, len; @@ -413,11 +411,7 @@ ivas_error ivas_binaural_reverb_open( { if ( !roomAcoustics->override ) { -#ifdef HRTF_BINARY_FILE revTimes = hHrtfFastConv->fastconvReverberationTimes; -#else - revTimes = fastconvReverberationTimes; -#endif } else { @@ -426,11 +420,7 @@ ivas_error ivas_binaural_reverb_open( } else { -#ifdef HRTF_BINARY_FILE revTimes = hHrtfParambin->parametricReverberationTimes; -#else - revTimes = parametricReverberationTimes; -#endif } for ( bin = 0; bin < hReverb->numBins; bin++ ) @@ -499,31 +489,19 @@ ivas_error ivas_binaural_reverb_open( { if ( !roomAcoustics->override ) { -#ifdef HRTF_BINARY_FILE ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, hHrtfFastConv->fastconvReverberationTimes, hHrtfFastConv->fastconvReverberationEneCorrections ); -#else - ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, fastconvReverberationTimes, fastconvReverberationEneCorrections ); -#endif ivas_binaural_reverb_setPreDelay( hReverb, 10 ); } else { -#ifdef HRTF_BINARY_FILE ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfFastConv, output_config, roomAcoustics->use_brir, sampling_rate, t60, ene ); -#else - ivas_reverb_prepare_cldfb_params( roomAcoustics, output_config, roomAcoustics->use_brir, sampling_rate, t60, ene ); -#endif ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, t60, ene ); ivas_binaural_reverb_setPreDelay( hReverb, (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ) ); } } else { -#ifdef HRTF_BINARY_FILE ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, hHrtfParambin->parametricReverberationTimes, hHrtfParambin->parametricReverberationEneCorrections ); -#else - ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, parametricReverberationTimes, parametricReverberationEneCorrections ); -#endif ivas_binaural_reverb_setPreDelay( hReverb, 10 ); } diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index fccc63b510..6186a96a51 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -669,7 +669,6 @@ ivas_error ivas_crend_init_from_rom( #endif #ifndef FIX_197_CREND_INTERFACE -#ifdef HRTF_BINARY_FILE /*------------------------------------------------------------------------- * ivas_crend_init_from_hrtf_handle() * @@ -818,9 +817,7 @@ ivas_error ivas_crend_init_from_hrtf_handle( } return IVAS_ERR_OK; } -#endif -#ifdef HRTF_BINARY_FILE /*------------------------------------------------------------------------- * ivas_crend_init_from_setofhrtf() * @@ -872,9 +869,9 @@ ivas_error ivas_crend_init_from_setofhrtf( return IVAS_ERR_OK; } -#endif #endif +#ifndef FIX_MEMORY_COUNTING_HRTF_BINARY_FILE /*---------------------------------------------------------------------* * destroy_HRTF() * @@ -930,7 +927,6 @@ static ivas_error destroy_HRTF( return IVAS_ERR_OK; } -#ifdef HRTF_BINARY_FILE /*---------------------------------------------------------------------* * destroy_SetOfHRTF() * @@ -952,7 +948,6 @@ ivas_error destroy_SetOfHRTF( } #endif - #ifndef FIX_197_CREND_INTERFACE /*------------------------------------------------------------------------- * ivas_crend_open() @@ -975,7 +970,6 @@ ivas_error ivas_crend_open( if ( ( st_ivas->hHrtf == NULL ) && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) { -#ifdef HRTF_BINARY_FILE if ( st_ivas->hSetOfHRTF != NULL ) { if ( ( error = ivas_crend_init_from_setofhrtf( st_ivas ) ) != IVAS_ERR_OK ) @@ -990,12 +984,6 @@ ivas_error ivas_crend_open( return error; } } -#else - if ( ( error = ivas_crend_init_from_rom( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } if ( ( hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) @@ -1479,9 +1467,7 @@ ivas_error ivas_rend_initCrend( const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, RENDER_CONFIG_DATA *hRendCfg, -#ifdef HRTF_BINARY_FILE HRTFS_CREND_HANDLE hSetOfHRTF, -#endif const int32_t output_Fs ) { int16_t i, j, tmp; @@ -1537,10 +1523,8 @@ ivas_error ivas_rend_initCrend( return IVAS_ERR_INTERNAL_FATAL; } -#ifdef HRTF_BINARY_FILE if ( hSetOfHRTF == NULL ) { -#endif if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { hHrtf->max_num_ir -= 1; /* subtract LFE */ @@ -1861,7 +1845,6 @@ ivas_error ivas_rend_initCrend( { return IVAS_ERROR( IVAS_ERR_INTERNAL, "Unsupported renderer type in Crend" ); } -#ifdef HRTF_BINARY_FILE } else { @@ -1987,7 +1970,6 @@ ivas_error ivas_rend_initCrend( return IVAS_ERROR( IVAS_ERR_INTERNAL, "Unsupported renderer type in Crend" ); } } -#endif pCrend->hHrtfCrend = hHrtf; @@ -2012,9 +1994,7 @@ ivas_error ivas_rend_openCrend( #ifdef FIX_197_CREND_INTERFACE int16_t Opt_Headrotation, #endif -#ifdef HRTF_BINARY_FILE HRTFS_CREND_HANDLE hSetOfHRTF, -#endif const int32_t output_Fs ) { /* TODO tmu : Based on ivas_crend_open() - could be harmonized / refactored */ @@ -2049,11 +2029,7 @@ ivas_error ivas_rend_openCrend( #ifdef FIX_197_CREND_INTERFACE if ( ( *pCrend )->hHrtfCrend == NULL ) { -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_rend_initCrend( *pCrend, inConfig, outConfig, hRendCfg, hSetOfHRTF, output_Fs ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_initCrend( *pCrend, inConfig, outConfig, hRendCfg, output_Fs ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2062,9 +2038,7 @@ ivas_error ivas_rend_openCrend( if ( pCrend->hHrtfCrend == NULL ) { if ( ( error = ivas_rend_initCrend( pCrend, inConfig, outConfig, hRendCfg, -#ifdef HRTF_BINARY_FILE hSetOfHRTF, -#endif output_Fs ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_rend/ivas_hrtf.c b/lib_rend/ivas_hrtf.c index 84efa1f13e..6e2483bba6 100644 --- a/lib_rend/ivas_hrtf.c +++ b/lib_rend/ivas_hrtf.c @@ -41,7 +41,6 @@ #include "ivas_error.h" #include "wmc_auto.h" - /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -211,9 +210,7 @@ void DefaultBSplineModel( HRTF_model_precalc( model ); -#ifdef FIX_310_TD_REND_DELAY HrFiltSet_p->latency_s = orange53_rom_latency_s; -#endif HrFiltSet_p->SampleRate = output_Fs; HrFiltSet_p->FiltLength = HrFiltSet_p->ModelParams.K; BSplineModelEvalAlloc( &HrFiltSet_p->ModelParams, &HrFiltSet_p->ModelEval ); @@ -263,7 +260,6 @@ void ivas_HRTF_binary_close( } -#ifdef HRTF_BINARY_FILE /*-----------------------------------------------------------------------* * ivas_HRTF_CRend_binary_open() * @@ -301,16 +297,16 @@ void ivas_HRTF_CRend_binary_close( return; } +#ifndef FIX_MEMORY_COUNTING_HRTF_BINARY_FILE destroy_SetOfHRTF( *hSetOfHRTF ); +#endif free( *hSetOfHRTF ); *hSetOfHRTF = NULL; return; } -#endif -#ifdef HRTF_BINARY_FILE /*-----------------------------------------------------------------------* * ivas_HRTF_fastconv_binary_open() * @@ -348,9 +344,7 @@ void ivas_HRTF_fastconv_binary_close( return; } -#endif -#ifdef HRTF_BINARY_FILE /*-----------------------------------------------------------------------* * ivas_HRTF_parambin_binary_open() * @@ -388,4 +382,3 @@ void ivas_HRTF_parambin_binary_close( return; } -#endif diff --git a/lib_rend/ivas_lib_rend_internal.h b/lib_rend/ivas_lib_rend_internal.h index c02c1ff3b4..ff94aeb398 100644 --- a/lib_rend/ivas_lib_rend_internal.h +++ b/lib_rend/ivas_lib_rend_internal.h @@ -81,9 +81,7 @@ ivas_error ivas_rend_openCrend( const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, RENDER_CONFIG_DATA *hRendCfg, -#ifdef HRTF_BINARY_FILE HRTFS_CREND_HANDLE hSetOfHRTF, -#endif const int32_t output_Fs ); ivas_error ivas_rend_initCrend( @@ -91,9 +89,7 @@ ivas_error ivas_rend_initCrend( const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, RENDER_CONFIG_DATA *hRendCfg, -#ifdef HRTF_BINARY_FILE HRTFS_CREND_HANDLE hSetOfHRTF, -#endif const int32_t output_Fs ); ivas_error ivas_rend_closeCrend( diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 2496b59089..6d8aa1708c 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -30,6 +30,7 @@ *******************************************************************************************************/ +#include "ivas_stat_rend.h" #include #include "options.h" #include "prot.h" @@ -60,6 +61,27 @@ static void TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE h const IVAS_FORMAT in_format, const ISM_METADATA_HANDLE *hIsmMetaData, float output[][L_FRAME48k] ); +#ifdef FIX_198_TDREND_INTERFACE +static ivas_error ivas_td_binaural_open_unwrap( TDREND_HRFILT_FiltSet_t **hHrtfTD, const int32_t output_Fs, const int16_t nchan_transport, const IVAS_FORMAT ivas_format, const AUDIO_CONFIG transport_config, const IVAS_OUTPUT_SETUP hTransSetup, BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, int32_t *binaural_latency_ns ); +static void ObjRenderIVASFrame_unwrap( RENDER_CONFIG_DATA *hRenderConfig, + const int16_t ini_frame, + CREND_WRAPPER_HANDLE hCrendWrapper, + AUDIO_CONFIG transport_config, + const int32_t output_Fs, + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, + const int16_t nchan_transport, + const int16_t lfe_idx, + IVAS_FORMAT ivas_format, + ISM_METADATA_HANDLE *hIsmMetaData, + const int16_t Opt_Headrotation, + const IVAS_QUATERNION *Quaternions, + float output[][L_FRAME48k], + const int16_t output_frame +#ifdef FIX_I109_ORIENTATION_TRACKING + , + ivas_orient_trk_state_t *pOTR +#endif +); /*---------------------------------------------------------------------* * ivas_td_binaural_open() @@ -71,7 +93,44 @@ ivas_error ivas_td_binaural_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { + return ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport, st_ivas->ivas_format, + st_ivas->transport_config, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); +} + + +/*---------------------------------------------------------------------* + * ivas_td_binaural_open_unwrap() + * + * Call TD open/init function without st_ivas + *---------------------------------------------------------------------*/ + +static ivas_error ivas_td_binaural_open_unwrap( + TDREND_HRFILT_FiltSet_t **hHrtfTD, /* i/o: HR filter model (from file or NULL) */ + const int32_t output_Fs, /* i : Output sampling rate */ + const int16_t nchan_transport, /* i : Number of channels */ + const IVAS_FORMAT ivas_format, /* i : IVAS format (ISM/MC) */ + const AUDIO_CONFIG transport_config, /* i : Transport configuration */ + const IVAS_OUTPUT_SETUP hTransSetup, /* i : Loudspeaker layout */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, /* o : TD renderer handle */ + int32_t *binaural_latency_ns /* i : Binauralization delay */ +) +#else +/*---------------------------------------------------------------------* + * ivas_td_binaural_open() + * + * Open and initialize TD Object binaural renderer + *---------------------------------------------------------------------*/ + +ivas_error ivas_td_binaural_open( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +#endif +{ +#ifdef FIX_198_TDREND_INTERFACE + BINAURAL_TD_OBJECT_RENDERER_HANDLE pBinRendTd; +#else BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; +#endif TDREND_PosType_t PosType; int16_t nS; int16_t SrcInd[MAX_NUM_TDREND_CHANNELS]; @@ -84,55 +143,105 @@ ivas_error ivas_td_binaural_open( error = IVAS_ERR_OK; +#ifdef FIX_198_TDREND_INTERFACE + if ( ( pBinRendTd = malloc( sizeof( BINAURAL_TD_OBJECT_RENDERER ) ) ) == NULL ) +#else if ( ( hBinRendererTd = malloc( sizeof( BINAURAL_TD_OBJECT_RENDERER ) ) ) == NULL ) +#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); } +#ifdef FIX_198_TDREND_INTERFACE + if ( ( pBinRendTd->TdRend_MixSpatSpec_p = malloc( sizeof( TDREND_MixSpatSpec_t ) ) ) == NULL ) +#else if ( ( hBinRendererTd->TdRend_MixSpatSpec_p = malloc( sizeof( TDREND_MixSpatSpec_t ) ) ) == NULL ) +#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); } +#ifdef FIX_198_TDREND_INTERFACE + if ( ( pBinRendTd->DirAtten_p = malloc( sizeof( TDREND_DirAtten_t ) ) ) == NULL ) +#else if ( ( hBinRendererTd->DirAtten_p = malloc( sizeof( TDREND_DirAtten_t ) ) ) == NULL ) +#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); } +#ifdef FIX_198_TDREND_INTERFACE + if ( ( pBinRendTd->Listener_p = malloc( sizeof( TDREND_MIX_Listener_t ) ) ) == NULL ) +#else if ( ( hBinRendererTd->Listener_p = malloc( sizeof( TDREND_MIX_Listener_t ) ) ) == NULL ) +#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); } +#ifdef FIX_198_TDREND_INTERFACE + pBinRendTd->NumOfSrcs = 0; + pBinRendTd->MaxSrcInd = -1; + + /* Mixer spatial setup */ + pBinRendTd->TdRend_MixSpatSpec_p->UseCommonDistAttenModel = TRUE; + pBinRendTd->TdRend_MixSpatSpec_p->DistAttenModel = 0; /* 0=Turned off, else use TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED */ +#else hBinRendererTd->NumOfSrcs = 0; hBinRendererTd->MaxSrcInd = -1; /* Mixer spatial setup */ hBinRendererTd->TdRend_MixSpatSpec_p->UseCommonDistAttenModel = TRUE; hBinRendererTd->TdRend_MixSpatSpec_p->DistAttenModel = 0; /* 0=Turned off, else use TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED */ +#endif +#ifdef FIX_198_TDREND_INTERFACE + TDREND_MIX_Init( pBinRendTd, hHrtfTD, pBinRendTd->TdRend_MixSpatSpec_p, output_Fs ); +#else TDREND_MIX_Init( hBinRendererTd, &st_ivas->hHrtfTD, hBinRendererTd->TdRend_MixSpatSpec_p, st_ivas->hDecoderConfig->output_Fs ); +#endif /* Set the attenuation (or can set MixSpatSpec.DistAttenModel above) */ +#ifdef FIX_198_TDREND_INTERFACE + TDREND_MIX_SetDistAttenModel( pBinRendTd, TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED ); +#else TDREND_MIX_SetDistAttenModel( hBinRendererTd, TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED ); +#endif /* Add sources to module and mixer, headphones */ PosType = TDREND_POSTYPE_ABSOLUTE; /* or TDREND_POSTYPE_RELATIVE_TO_LISTENER */ +#ifdef FIX_198_TDREND_INTERFACE + nchan_rend = nchan_transport; + if ( ( ivas_format == MC_FORMAT ) && ( transport_config != AUDIO_CONFIG_LS_CUSTOM ) ) +#else nchan_rend = st_ivas->nchan_transport; if ( st_ivas->ivas_format == MC_FORMAT ) +#endif { nchan_rend--; /* Skip LFE channel -- added to the others */ } for ( nS = 0; nS < nchan_rend; nS++ ) { +#ifdef FIX_198_TDREND_INTERFACE + if ( ( error = TDREND_MIX_AddSrc( pBinRendTd, &SrcInd[nS], PosType ) ) != IVAS_ERR_OK ) +#else if ( ( error = TDREND_MIX_AddSrc( hBinRendererTd, &SrcInd[nS], PosType ) ) != IVAS_ERR_OK ) +#endif { return error; } } +#ifdef FIX_198_TDREND_INTERFACE + if ( ivas_format == MC_FORMAT ) +#else if ( st_ivas->ivas_format == MC_FORMAT ) +#endif { +#ifdef FIX_198_TDREND_INTERFACE + switch ( transport_config ) +#else switch ( st_ivas->transport_config ) +#endif { case AUDIO_CONFIG_5_1: ls_azimuth = ls_azimuth_CICP6; @@ -155,15 +264,24 @@ ivas_error ivas_td_binaural_open( ls_elevation = ls_elevation_CICP19; break; case AUDIO_CONFIG_LS_CUSTOM: +#ifdef FIX_198_TDREND_INTERFACE + ls_azimuth = hTransSetup.ls_azimuth; + ls_elevation = hTransSetup.ls_elevation; +#else ls_azimuth = st_ivas->hTransSetup.ls_azimuth; ls_elevation = st_ivas->hTransSetup.ls_elevation; +#endif break; default: ls_azimuth = NULL; ls_elevation = NULL; } +#ifdef FIX_198_TDREND_INTERFACE + DirAtten_p = pBinRendTd->DirAtten_p; +#else DirAtten_p = hBinRendererTd->DirAtten_p; +#endif for ( nS = 0; nS < nchan_rend; nS++ ) { @@ -180,18 +298,26 @@ ivas_error ivas_td_binaural_open( DirAtten_p->ConeOuterAngle = 360.0f; DirAtten_p->ConeOuterGain = 1.0f; +#ifdef FIX_198_TDREND_INTERFACE + TDREND_MIX_SRC_SetPos( pBinRendTd, nS, Pos ); + TDREND_MIX_SRC_SetDir( pBinRendTd, nS, Dir ); + TDREND_MIX_SRC_SetPlayState( pBinRendTd, nS, TDREND_PLAYSTATUS_PLAYING ); + TDREND_MIX_SRC_SetDirAtten( pBinRendTd, nS, DirAtten_p ); +#else TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); TDREND_MIX_SRC_SetDir( hBinRendererTd, nS, Dir ); TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ); +#endif } } +#ifdef FIX_198_TDREND_INTERFACE + *hBinRendererTd = pBinRendTd; + *binaural_latency_ns = (int32_t) ( ( *hBinRendererTd )->HrFiltSet_p->latency_s * 1000000000.f ); +#else st_ivas->hBinRendererTd = hBinRendererTd; -#ifdef FIX_310_TD_REND_DELAY st_ivas->binaural_latency_ns = (int32_t) ( hBinRendererTd->HrFiltSet_p->latency_s * 1000000000.f ); -#else - st_ivas->binaural_latency_ns = (int32_t) ( BINAURAL_TD_LATENCY_S * 1000000000.f ); #endif return error; @@ -224,7 +350,68 @@ void ivas_td_binaural_close( return; } +#ifdef FIX_198_TDREND_INTERFACE +/*---------------------------------------------------------------------* + * ObjRenderIVASFrame() + * + * Receives the current frames for the object streams, updates metadata + * and renders the current frame. + *---------------------------------------------------------------------*/ +void ObjRenderIVASFrame( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ + const int16_t output_frame /* i : output frame length */ +) +{ + ObjRenderIVASFrame_unwrap( st_ivas->hRenderConfig, + st_ivas->ini_frame, + st_ivas->hCrendWrapper, + st_ivas->transport_config, + st_ivas->hDecoderConfig->output_Fs, + st_ivas->hBinRendererTd, + st_ivas->nchan_transport, + LFE_CHANNEL, + st_ivas->ivas_format, + st_ivas->hIsmMetaData, + st_ivas->hDecoderConfig->Opt_Headrotation, + ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, + output, + output_frame +#ifdef FIX_I109_ORIENTATION_TRACKING + , + ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->OrientationTracker : NULL +#endif + ); +} + +/*---------------------------------------------------------------------* + * ObjRenderIVASFrame_unwrap() + * + * Call ObjRenderIVASFrame without st_ivas. + *---------------------------------------------------------------------*/ + +static void ObjRenderIVASFrame_unwrap( + RENDER_CONFIG_DATA *hRenderConfig, /*i : Renderer configuration */ + const int16_t ini_frame, /*i : Initialization frame counter */ + CREND_WRAPPER_HANDLE hCrendWrapper, /*i : Crend wrapper handle */ + AUDIO_CONFIG transport_config, /*i : Transport configuration */ + const int32_t output_Fs, /*i : Output sampling rate */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /*i/o: TD binaural object renderer handle */ + const int16_t nchan_transport, /*i : Transport channels (ISms) */ + const int16_t lfe_idx, /*i : LFE channel index */ + IVAS_FORMAT ivas_format, /*i : IVAS format */ + ISM_METADATA_HANDLE *hIsmMetaData, /*i : ISM metadata handle */ + const int16_t Opt_Headrotation, /*i : Head rotation flag */ + const IVAS_QUATERNION *Quaternions, /*i : Head tracking data per subframe */ + float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ + const int16_t output_frame /* i : output frame length */ +#ifdef FIX_I109_ORIENTATION_TRACKING + , + ivas_orient_trk_state_t *pOTR /* i/o: orientation tracker handle */ +#endif +) +#else /*---------------------------------------------------------------------* * ObjRenderIVASFrame() * @@ -237,6 +424,7 @@ void ObjRenderIVASFrame( float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ ) +#endif { int16_t subframe_length; int16_t subframe_idx; @@ -246,13 +434,25 @@ void ObjRenderIVASFrame( #endif subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; +#ifdef FIX_198_TDREND_INTERFACE + if ( hRenderConfig != NULL ) +#else if ( st_ivas->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ +#endif { +#ifdef FIX_198_TDREND_INTERFACE + if ( hRenderConfig->roomAcoustics.late_reverb_on && ( ini_frame == 0 ) ) +#else if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on && ( st_ivas->ini_frame == 0 ) ) +#endif { #ifdef FIX_197_CREND_INTERFACE +#ifdef FIX_198_TDREND_INTERFACE + ivas_reverb_open( &hCrendWrapper->hCrend->hReverb, transport_config, NULL, hRenderConfig, output_Fs ); +#else ivas_reverb_open( &st_ivas->hCrendWrapper->hCrend->hReverb, st_ivas->transport_config, NULL, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ); +#endif #else ivas_reverb_open( &st_ivas->hCrend->hReverb, st_ivas->transport_config, NULL, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ); #endif @@ -260,12 +460,26 @@ void ObjRenderIVASFrame( } /* Update object position(s) */ +#ifdef FIX_198_TDREND_INTERFACE + TDREND_Update_object_positions( hBinRendererTd, nchan_transport, lfe_idx, ivas_format, hIsmMetaData, output ); +#else TDREND_Update_object_positions( st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, output ); +#endif for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { /* Update the listener's location/orientation */ #ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef FIX_198_TDREND_INTERFACE + if ( pOTR != NULL ) + { + if ( ivas_orient_trk_Process( pOTR, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ) != IVAS_ERR_OK ) + { + exit( -1 ); + } + } + TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( pOTR != NULL ) ? &trackedHeadOrientation : NULL ); +#else if ( st_ivas->hHeadTrackData != NULL ) { if ( ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hHeadTrackData->Quaternions[subframe_idx], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ) != IVAS_ERR_OK ) @@ -276,28 +490,53 @@ void ObjRenderIVASFrame( TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? &trackedHeadOrientation : NULL ); +#endif +#else +#ifdef FIX_198_TDREND_INTERFACE + TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL ); #else TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? &st_ivas->hHeadTrackData->Quaternions[subframe_idx] : NULL ); #endif +#endif +#ifdef FIX_198_TDREND_INTERFACE + if ( ( hRenderConfig != NULL ) && ( hRenderConfig->roomAcoustics.late_reverb_on ) ) +#else if ( ( st_ivas->hRenderConfig != NULL ) && ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) ) +#endif { #ifdef FIX_197_CREND_INTERFACE +#ifdef FIX_198_TDREND_INTERFACE + ivas_reverb_process( hCrendWrapper->hCrend->hReverb, transport_config, 0, output, reverb_signal, subframe_idx ); +#else ivas_reverb_process( st_ivas->hCrendWrapper->hCrend->hReverb, st_ivas->transport_config, 0, output, reverb_signal, subframe_idx ); +#endif #else ivas_reverb_process( st_ivas->hCrend->hReverb, st_ivas->transport_config, 0, output, reverb_signal, subframe_idx ); #endif } /* Render subframe */ +#ifdef FIX_198_TDREND_INTERFACE + TDREND_GetMix( hBinRendererTd, output, subframe_length, subframe_idx ); +#else TDREND_GetMix( st_ivas->hBinRendererTd, output, subframe_length, subframe_idx ); +#endif } +#ifdef FIX_198_TDREND_INTERFACE + if ( hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ +#else if ( st_ivas->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ +#endif { +#ifdef FIX_198_TDREND_INTERFACE + if ( hRenderConfig->roomAcoustics.late_reverb_on ) +#else if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) +#endif { /* add reverb to rendered signals */ v_add( reverb_signal[0], output[0], output[0], output_frame ); @@ -520,6 +759,7 @@ ivas_error ivas_rend_TDObjRendOpen( LSSETUP_CUSTOM_STRUCT *customLsInput, const int32_t outFs ) { +#ifndef FIX_198_TDREND_INTERFACE /* TODO tmu : Based on ivas_td_binaural_open() - could be harmonized / refactored - review error handling - review hHrtfTD init @@ -532,8 +772,34 @@ ivas_error ivas_rend_TDObjRendOpen( float Pos[3]; float Dir[3]; TDREND_DirAtten_t *DirAtten_p; +#endif +#ifdef FIX_198_TDREND_INTERFACE + int16_t nchan_transport; + AUDIO_CONFIG transport_config; + IVAS_FORMAT ivas_format; + IVAS_OUTPUT_SETUP hTransSetup; +#else int16_t nchan_rend; ivas_error error; +#endif + +#ifdef FIX_198_TDREND_INTERFACE + if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + { + getAudioConfigNumChannels( inConfig, &nchan_transport ); + } + else + { + nchan_transport = customLsInput->num_spk; + } + transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); + ivas_format = ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ? MC_FORMAT : ISM_FORMAT; + hTransSetup.ls_azimuth = customLsInput->ls_azimuth; + hTransSetup.ls_elevation = customLsInput->ls_elevation; + + return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, hTransSetup, &pTDRend->hBinRendererTd, + &pTDRend->binaural_latency_ns ); +#else error = IVAS_ERR_OK; @@ -649,13 +915,10 @@ ivas_error ivas_rend_TDObjRendOpen( pTDRend->hBinRendererTd = hBinRendererTd; -#ifdef FIX_310_TD_REND_DELAY pTDRend->binaural_latency_ns = (int32_t) ( hBinRendererTd->HrFiltSet_p->latency_s * 1000000000.f ); -#else - pTDRend->binaural_latency_ns = (int32_t) ( BINAURAL_TD_LATENCY_S * 1000000000.f ); -#endif return IVAS_ERR_OK; +#endif } /*---------------------------------------------------------------------* @@ -676,15 +939,24 @@ ivas_error ivas_rend_TDObjRenderFrame( float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ) { +#ifndef FIX_198_TDREND_INTERFACE int16_t subframe_length; int16_t subframe_idx; ISM_METADATA_HANDLE hIsmMetaData[1]; +#else + ISM_METADATA_FRAME hIsmMetaDataFrame; + ISM_METADATA_HANDLE hIsmMetaData[1]; +#endif int16_t lfe_idx; int16_t num_src; /* TODO tmu : pass down renderer config struct */ // float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; IVAS_FORMAT ivas_format; IVAS_REND_AudioConfigType inConfigType; +#ifdef FIX_198_TDREND_INTERFACE + AUDIO_CONFIG transport_config; + int32_t output_Fs; +#endif #ifdef FIX_I109_ORIENTATION_TRACKING IVAS_QUATERNION trackedHeadOrientation; @@ -694,6 +966,10 @@ ivas_error ivas_rend_TDObjRenderFrame( inConfigType = getAudioConfigType( inConfig ); lfe_idx = LFE_CHANNEL; +#ifdef FIX_198_TDREND_INTERFACE + hIsmMetaData[0] = NULL; +#endif + if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { ivas_format = MC_FORMAT; @@ -711,12 +987,33 @@ ivas_error ivas_rend_TDObjRenderFrame( { ivas_format = ISM_FORMAT; num_src = 1; +#ifdef FIX_198_TDREND_INTERFACE + hIsmMetaData[0] = &hIsmMetaDataFrame; +#else hIsmMetaData[0] = malloc( sizeof( ISM_METADATA_FRAME ) ); +#endif hIsmMetaData[0]->azimuth = currentPos->azimuth; hIsmMetaData[0]->elevation = currentPos->elevation; } +#ifndef FIX_198_TDREND_INTERFACE subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; +#endif + +#ifdef FIX_198_TDREND_INTERFACE + transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); + output_Fs = output_frame * 50; + + ObjRenderIVASFrame_unwrap( NULL, 1, NULL, transport_config, output_Fs, pTDRend->hBinRendererTd, num_src, lfe_idx, + ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, + output, output_frame + #ifdef FIX_I109_ORIENTATION_TRACKING + , + NULL // TODO @Philips check if orientation tracking already done before renderer calls this function + #endif + ); + +#else /* TODO tmu : pass down renderer config struct and decide what to do about ini_frame ? */ // if ( hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ @@ -773,6 +1070,8 @@ ivas_error ivas_rend_TDObjRenderFrame( // } // } + +#endif pop_wmops(); return IVAS_ERR_OK; diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 6420a40134..2e01d6b817 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -442,7 +442,7 @@ ivas_error ivas_orient_trk_SetAbsoluteOrientation( #ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_Process( ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - IVAS_QUATERNION absRot, /* i : absolute head rotation */ + const IVAS_QUATERNION *absRot, /* i : absolute head rotation */ float updateRate, /* i : rotation update rate [Hz] */ IVAS_QUATERNION *pTrkRot ) /* o : tracked rotation */ { @@ -464,34 +464,34 @@ ivas_error ivas_orient_trk_Process( switch ( pOTR->trackingType ) { case OTR_TRACKING_NONE: - *pTrkRot = absRot; + *pTrkRot = *absRot; break; case OTR_TRACKING_REF_ORIENT: /* Reset average orientation */ - pOTR->absAvgRot = absRot; + pOTR->absAvgRot = *absRot; /* Reset adaptation filter - start adaptation at center rate */ pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate ); /* Compute relative orientation = (absolute orientation) - (reference orientation) */ QuaternionInverse( pOTR->refRot, pTrkRot ); - QuaternionProduct( *pTrkRot, absRot, pTrkRot ); + QuaternionProduct( *pTrkRot, *absRot, pTrkRot ); break; case OTR_TRACKING_AVG_ORIENT: /* Compute average (low-pass filtered) absolute orientation */ - QuaternionSlerp( pOTR->absAvgRot, absRot, alpha, &pOTR->absAvgRot ); + QuaternionSlerp( pOTR->absAvgRot, *absRot, alpha, &pOTR->absAvgRot ); /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */ QuaternionInverse( pOTR->absAvgRot, pTrkRot ); - QuaternionProduct( *pTrkRot, absRot, pTrkRot ); + QuaternionProduct( *pTrkRot, *absRot, pTrkRot ); /* Adapt LPF constant based on orientation excursion relative to current mean: - low cutoff (slow adaptation) for small excursions (around center) - high cutoff (fast adaptation) for large excursions (off-center) */ - ang = QuaternionAngle( absRot, *pTrkRot ); + ang = QuaternionAngle( *absRot, *pTrkRot ); normalizedOrientation = ang * ang; relativeOrientationRate = sqrtf( normalizedOrientation ) / pOTR->adaptationAngle; diff --git a/lib_rend/ivas_reverb_utils.c b/lib_rend/ivas_reverb_utils.c index 20a3e2ac47..565fd46ff8 100644 --- a/lib_rend/ivas_reverb_utils.c +++ b/lib_rend/ivas_reverb_utils.c @@ -69,11 +69,7 @@ typedef struct cldfb_convolver_state float filter_states_im[BINAURAL_CONVBANDS][CLDFB_CONVOLVER_NTAPS_MAX]; } cldfb_convolver_state; -#ifdef HRTF_BINARY_FILE static void ivas_reverb_get_fastconv_hrtf_set_energies( const HRTFS_FASTCONV_HANDLE hHrtfFastConv, const AUDIO_CONFIG input_audio_config, const int16_t use_brir, const int32_t sampling_rate, float *avg_pwr_left, float *avg_pwr_right ); -#else -static void ivas_reverb_get_fastconv_hrtf_set_energies( const AUDIO_CONFIG input_audio_config, const int16_t use_brir, const int32_t sampling_rate, float *avg_pwr_left, float *avg_pwr_right ); -#endif /*-----------------------------------------------------------------------------------------* @@ -84,9 +80,7 @@ static void ivas_reverb_get_fastconv_hrtf_set_energies( const AUDIO_CONFIG input void ivas_reverb_prepare_cldfb_params( ivas_roomAcoustics_t *pInput_params, -#ifdef HRTF_BINARY_FILE const HRTFS_FASTCONV_HANDLE hHrtfFastConv, -#endif const AUDIO_CONFIG input_audio_config, const int16_t use_brir, const int32_t output_Fs, @@ -121,11 +115,7 @@ void ivas_reverb_prepare_cldfb_params( pOutput_ene[idx] *= expf( exp_argument ); } -#ifdef HRTF_BINARY_FILE ivas_reverb_get_fastconv_hrtf_set_energies( hHrtfFastConv, input_audio_config, use_brir, output_Fs, avg_pwr_left, avg_pwr_right ); -#else - ivas_reverb_get_fastconv_hrtf_set_energies( input_audio_config, use_brir, output_Fs, avg_pwr_left, avg_pwr_right ); -#endif for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { @@ -209,9 +199,7 @@ static void ivas_cldfb_convolver( *-----------------------------------------------------------------------------------------*/ static void get_IR_from_filter_taps( -#ifdef HRTF_BINARY_FILE const HRTFS_FASTCONV_HANDLE hHrtfFastConv, -#endif const int16_t hrtf_idx, const AUDIO_CONFIG input_audio_config, const int16_t use_brir, @@ -242,17 +230,10 @@ static void get_IR_from_filter_taps( { for ( band_idx = 0; band_idx < BINAURAL_CONVBANDS; band_idx++ ) { -#ifdef HRTF_BINARY_FILE convolver_state.filter_taps_left_re[band_idx] = hHrtfFastConv->leftHRIRReal_HOA3[band_idx][hrtf_idx]; convolver_state.filter_taps_left_im[band_idx] = hHrtfFastConv->leftHRIRImag_HOA3[band_idx][hrtf_idx]; convolver_state.filter_taps_right_re[band_idx] = hHrtfFastConv->rightHRIRReal_HOA3[band_idx][hrtf_idx]; convolver_state.filter_taps_right_im[band_idx] = hHrtfFastConv->rightHRIRImag_HOA3[band_idx][hrtf_idx]; -#else - convolver_state.filter_taps_left_re[band_idx] = leftHRIRReal_HOA3[band_idx][hrtf_idx]; - convolver_state.filter_taps_left_im[band_idx] = leftHRIRImag_HOA3[band_idx][hrtf_idx]; - convolver_state.filter_taps_right_re[band_idx] = rightHRIRReal_HOA3[band_idx][hrtf_idx]; - convolver_state.filter_taps_right_im[band_idx] = rightHRIRImag_HOA3[band_idx][hrtf_idx]; -#endif } } else @@ -283,34 +264,20 @@ static void get_IR_from_filter_taps( { for ( band_idx = 0; band_idx < BINAURAL_CONVBANDS; band_idx++ ) { -#ifdef HRTF_BINARY_FILE convolver_state.filter_taps_left_re[band_idx] = hHrtfFastConv->leftBRIRReal[band_idx][array_idx]; convolver_state.filter_taps_left_im[band_idx] = hHrtfFastConv->leftBRIRImag[band_idx][array_idx]; convolver_state.filter_taps_right_re[band_idx] = hHrtfFastConv->rightBRIRReal[band_idx][array_idx]; convolver_state.filter_taps_right_im[band_idx] = hHrtfFastConv->rightBRIRImag[band_idx][array_idx]; -#else - convolver_state.filter_taps_left_re[band_idx] = leftBRIRReal[band_idx][array_idx]; - convolver_state.filter_taps_left_im[band_idx] = leftBRIRImag[band_idx][array_idx]; - convolver_state.filter_taps_right_re[band_idx] = rightBRIRReal[band_idx][array_idx]; - convolver_state.filter_taps_right_im[band_idx] = rightBRIRImag[band_idx][array_idx]; -#endif } } else { for ( band_idx = 0; band_idx < BINAURAL_CONVBANDS; band_idx++ ) { -#ifdef HRTF_BINARY_FILE convolver_state.filter_taps_left_re[band_idx] = hHrtfFastConv->leftHRIRReal[band_idx][array_idx]; convolver_state.filter_taps_left_im[band_idx] = hHrtfFastConv->leftHRIRImag[band_idx][array_idx]; convolver_state.filter_taps_right_re[band_idx] = hHrtfFastConv->rightHRIRReal[band_idx][array_idx]; convolver_state.filter_taps_right_im[band_idx] = hHrtfFastConv->rightHRIRImag[band_idx][array_idx]; -#else - convolver_state.filter_taps_left_re[band_idx] = leftHRIRReal[band_idx][array_idx]; - convolver_state.filter_taps_left_im[band_idx] = leftHRIRImag[band_idx][array_idx]; - convolver_state.filter_taps_right_re[band_idx] = rightHRIRReal[band_idx][array_idx]; - convolver_state.filter_taps_right_im[band_idx] = rightHRIRImag[band_idx][array_idx]; -#endif } } } @@ -386,9 +353,7 @@ static void get_IR_from_filter_taps( static void ivas_reverb_get_cldfb_hrtf_set_properties( AUDIO_CONFIG input_audio_config, -#ifdef HRTF_BINARY_FILE const HRTFS_FASTCONV_HANDLE hHrtfFastConv, -#endif const int16_t use_brir, const int32_t sampling_rate, float *avg_pwr_left, @@ -432,11 +397,7 @@ static void ivas_reverb_get_cldfb_hrtf_set_properties( Loop over all the HRTFs available */ for ( hrtf_idx = 0; hrtf_idx < hrtf_count; hrtf_idx++ ) { -#ifdef HRTF_BINARY_FILE get_IR_from_filter_taps( hHrtfFastConv, hrtf_idx, input_audio_config, use_brir, sampling_rate, IR_length, current_HRTF_data_L, current_HRTF_data_R ); -#else - get_IR_from_filter_taps( hrtf_idx, input_audio_config, use_brir, sampling_rate, IR_length, current_HRTF_data_L, current_HRTF_data_R ); -#endif /* Perform forward FFT on both L/R channels */ fft_rel( current_HRTF_data_L, (int16_t) fft_size, (int16_t) log2_fft_size ); @@ -485,9 +446,7 @@ static void ivas_reverb_get_cldfb_hrtf_set_properties( *-----------------------------------------------------------------------------------------*/ static void ivas_reverb_get_fastconv_hrtf_set_energies( -#ifdef HRTF_BINARY_FILE const HRTFS_FASTCONV_HANDLE hHrtfFastConv, -#endif const AUDIO_CONFIG input_audio_config, const int16_t use_brir, const int32_t sampling_rate, @@ -511,11 +470,7 @@ static void ivas_reverb_get_fastconv_hrtf_set_energies( output_fc[freq_idx] = (float) ( ( 2 * freq_idx + 1 ) * cldfb_freq_halfstep ); } -#ifdef HRTF_BINARY_FILE ivas_reverb_get_cldfb_hrtf_set_properties( input_audio_config, hHrtfFastConv, use_brir, sampling_rate, avg_pwr_left_fft, avg_pwr_right_fft ); -#else - ivas_reverb_get_cldfb_hrtf_set_properties( input_audio_config, use_brir, sampling_rate, avg_pwr_left_fft, avg_pwr_right_fft ); -#endif ivas_reverb_interpolate_acoustic_data( FFT_SPECTRUM_SIZE, input_fc, avg_pwr_left_fft, avg_pwr_right_fft, CLDFB_NO_CHANNELS_MAX, output_fc, avg_pwr_left, avg_pwr_right ); diff --git a/lib_rend/ivas_rom_TdBinauralRenderer.c b/lib_rend/ivas_rom_TdBinauralRenderer.c index 50de3f253b..70daa6dff9 100644 --- a/lib_rend/ivas_rom_TdBinauralRenderer.c +++ b/lib_rend/ivas_rom_TdBinauralRenderer.c @@ -46,9 +46,7 @@ * TD Binaural rendering related ROM tables *------------------------------------------------------------------------*/ /* TD renderer HRTF default model Orange53 */ -#ifdef FIX_310_TD_REND_DELAY const float orange53_rom_latency_s = 0.000020834f; -#endif const int16_t orange53_rom_azimDim2[18] = { 1, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 1, }; diff --git a/lib_rend/ivas_rom_TdBinauralRenderer.h b/lib_rend/ivas_rom_TdBinauralRenderer.h index bbe970869b..ccb5362c9a 100644 --- a/lib_rend/ivas_rom_TdBinauralRenderer.h +++ b/lib_rend/ivas_rom_TdBinauralRenderer.h @@ -42,9 +42,7 @@ * TD Binaural rendering related ROM tables *------------------------------------------------------------------------*/ /* TD renderer HRTF default model Orange53 */ -#ifdef FIX_310_TD_REND_DELAY extern const float orange53_rom_latency_s; -#endif extern const int16_t orange53_rom_azimDim2[18]; extern const int16_t orange53_rom_azimDim3[18]; extern const int16_t orange53_rom_azim_start_idx[18]; diff --git a/lib_rend/ivas_rom_binauralRenderer.c b/lib_rend/ivas_rom_binauralRenderer.c index 9d6bbd543e..763777ad28 100644 --- a/lib_rend/ivas_rom_binauralRenderer.c +++ b/lib_rend/ivas_rom_binauralRenderer.c @@ -52,11 +52,7 @@ * Generated with Matlab version 9.3.0.713579 (R2017b) by MUXE6256 */ const float FASTCONV_HOA3_latency_s = 0.001979167f; -#ifdef HRTF_BINARY_FILE const float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]= -#else -const float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][16][7]= -#endif { { {-0.004181f, +0.093228f, +0.655506f, +0.048565f, -0.005834f, -0.005472f, -0.000066f}, @@ -960,11 +956,7 @@ const float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][16][7]= } }; -#ifdef HRTF_BINARY_FILE const float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]= -#else -const float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][16][7]= -#endif { { {-0.007849f, -0.189662f, +0.310868f, +0.002657f, -0.000617f, -0.002064f, +0.000079f}, @@ -1868,11 +1860,7 @@ const float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][16][7]= } }; -#ifdef HRTF_BINARY_FILE const float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]= -#else -const float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][16][7]= -#endif { { {-0.004181f, +0.093228f, +0.655506f, +0.048565f, -0.005834f, -0.005472f, -0.000066f}, @@ -2776,11 +2764,7 @@ const float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][16][7]= } }; -#ifdef HRTF_BINARY_FILE const float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]= -#else -const float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][16][7]= -#endif { { {-0.007849f, -0.189662f, +0.310868f, +0.002657f, -0.000617f, -0.002064f, +0.000079f}, @@ -3685,11 +3669,7 @@ const float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][16][7]= }; const float FASTCONV_HRIR_latency_s = 0.000666667f; -#ifdef HRTF_BINARY_FILE const float leftHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= -#else -const float leftHRIRReal[BINAURAL_CONVBANDS][15][7]= -#endif { { {+0.331798f, +0.500334f, +0.042057f, -0.000623f, -0.000260f}, @@ -4543,11 +4523,7 @@ const float leftHRIRReal[BINAURAL_CONVBANDS][15][7]= } }; -#ifdef HRTF_BINARY_FILE const float leftHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= -#else -const float leftHRIRImag[BINAURAL_CONVBANDS][15][7]= -#endif { { {-0.346479f, +0.553523f, -0.074098f, +0.001288f, +0.000309f}, @@ -5401,11 +5377,7 @@ const float leftHRIRImag[BINAURAL_CONVBANDS][15][7]= } }; -#ifdef HRTF_BINARY_FILE const float rightHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= -#else -const float rightHRIRReal[BINAURAL_CONVBANDS][15][7]= -#endif { { {+0.065097f, +0.755993f, -0.042308f, -0.016140f, -0.000353f}, @@ -6259,11 +6231,7 @@ const float rightHRIRReal[BINAURAL_CONVBANDS][15][7]= } }; -#ifdef HRTF_BINARY_FILE const float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= -#else -const float rightHRIRImag[BINAURAL_CONVBANDS][15][7]= -#endif { { {-0.179291f, +0.196331f, +0.055128f, -0.017382f, +0.000411f}, @@ -7649,11 +7617,7 @@ const float hrtfShCoeffsIm[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]= /* Binaural rendering data set based on BRIRs */ /* Tables derived from Mozart IIS BRIRs.*/ const float FASTCONV_BRIR_latency_s = 0.000937500f; -#ifdef HRTF_BINARY_FILE const float leftBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= -#else -const float leftBRIRReal[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]= -#endif { { { @@ -16757,11 +16721,7 @@ const float leftBRIRReal[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]= } }; -#ifdef HRTF_BINARY_FILE const float leftBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= -#else -const float leftBRIRImag[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]= -#endif { { { @@ -25865,11 +25825,7 @@ const float leftBRIRImag[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]= } }; -#ifdef HRTF_BINARY_FILE const float rightBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= -#else -const float rightBRIRReal[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]= -#endif { { { @@ -34973,11 +34929,7 @@ const float rightBRIRReal[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]= } }; -#ifdef HRTF_BINARY_FILE const float rightBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= -#else -const float rightBRIRImag[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]= -#endif { { { diff --git a/lib_rend/ivas_rom_binauralRenderer.h b/lib_rend/ivas_rom_binauralRenderer.h index f97883f9c3..939f6ef78f 100644 --- a/lib_rend/ivas_rom_binauralRenderer.h +++ b/lib_rend/ivas_rom_binauralRenderer.h @@ -44,29 +44,15 @@ /* Binaural rendering data set based on HRIRs */ extern const float FASTCONV_HRIR_latency_s; -#ifdef HRTF_BINARY_FILE extern float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; extern float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; extern float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; extern float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; -#else -extern float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][16][7]; -extern float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][16][7]; -extern float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][16][7]; -extern float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][16][7]; -#endif -#ifdef HRTF_BINARY_FILE extern float leftHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; extern float leftHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; extern float rightHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; extern float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; -#else -extern float leftHRIRReal[BINAURAL_CONVBANDS][15][7]; -extern float leftHRIRImag[BINAURAL_CONVBANDS][15][7]; -extern float rightHRIRReal[BINAURAL_CONVBANDS][15][7]; -extern float rightHRIRImag[BINAURAL_CONVBANDS][15][7]; -#endif extern float FASTCONV_HOA3_latency_s; extern float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; @@ -75,17 +61,10 @@ extern float hrtfShCoeffsIm[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; /* Binaural rendering data set based on BRIRs */ extern const float FASTCONV_BRIR_latency_s; -#ifdef HRTF_BINARY_FILE extern float leftBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; extern float leftBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; extern float rightBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; extern float rightBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; -#else -extern float leftBRIRReal[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]; -extern float leftBRIRImag[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]; -extern float rightBRIRReal[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]; -extern float rightBRIRImag[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]; -#endif /* Reverberation parameters based on BRIRs for fastconv */ extern float fastconvReverberationTimes[CLDFB_NO_CHANNELS_MAX]; diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 05bf6a930b..f657dd6672 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -351,7 +351,7 @@ void rotateFrame_shd( /* get next quaternion */ #ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, - hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], + &hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); @@ -464,7 +464,7 @@ void rotateFrame_sd( /* Get next quaternion and calculate rotation matrix */ #ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, - hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], + &hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); @@ -705,7 +705,7 @@ void rotateFrame_sd_cldfb( /* Get next quaternion and calculate rotation matrix */ #ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, - hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], + &hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, Rmat ); diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 4f6be735ff..94486943b5 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -786,9 +786,7 @@ typedef struct TDREND_HRFILT_FiltSet_struct ModelEval_t ModelEval; ModelParamsITD_t ModelParamsITD; TDREND_HRFILT_Method_t FilterMethod; /* HR filtering method */ -#ifdef FIX_310_TD_REND_DELAY float latency_s; -#endif } TDREND_HRFILT_FiltSet_t; @@ -940,8 +938,6 @@ typedef struct ivas_binaural_crend_wrapper_struct } CREND_WRAPPER, *CREND_WRAPPER_HANDLE; -#ifdef HRTF_BINARY_FILE - /* htrfs from binary files. */ typedef struct ivas_hrtfs_crend_structure @@ -970,9 +966,7 @@ typedef struct ivas_hrtfs_file_header_t } ivas_hrtfs_file_header_t; -#endif -#ifdef HRTF_BINARY_FILE typedef struct ivas_hrtfs_fastconv_struct { float FASTCONV_HRIR_latency_s; @@ -997,9 +991,7 @@ typedef struct ivas_hrtfs_fastconv_struct float fastconvReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX]; } HRTFS_FASTCONV, *HRTFS_FASTCONV_HANDLE; -#endif -#ifdef HRTF_BINARY_FILE typedef struct ivas_hrtfs_parambin_struct { float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; @@ -1010,7 +1002,6 @@ typedef struct ivas_hrtfs_parambin_struct float parametricEarlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; } HRTFS_PARAMBIN, *HRTFS_PARAMBIN_HANDLE; -#endif /*----------------------------------------------------------------------------------* * LFE decoder structure diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 05286106ef..d687b07d57 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1095,9 +1095,7 @@ static ivas_error setRendInputActiveIsm( #ifdef FIX_197_CREND_INTERFACE 0, #endif -#ifdef HRTF_BINARY_FILE NULL, -#endif *rendCtx.pOutSampleRate ); } if ( error != IVAS_ERR_OK ) @@ -1802,9 +1800,7 @@ static ivas_error initMcBinauralRendering( #ifdef FIX_197_CREND_INTERFACE 0, #endif -#ifdef HRTF_BINARY_FILE NULL, -#endif outSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -2077,15 +2073,11 @@ static ivas_error updateSbaPanGains( case IVAS_REND_AUDIO_CONFIG_BINAURAL: #ifdef FIX_197_CREND_INTERFACE error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, 0, -#ifdef HRTF_BINARY_FILE NULL, -#endif *rendCtx.pOutSampleRate ); #else error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, -#ifdef HRTF_BINARY_FILE NULL, -#endif *rendCtx.pOutSampleRate ); #endif break; @@ -2096,15 +2088,11 @@ static ivas_error updateSbaPanGains( } #ifdef FIX_197_CREND_INTERFACE error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, 0, -#ifdef HRTF_BINARY_FILE NULL, -#endif *rendCtx.pOutSampleRate ); #else error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, -#ifdef HRTF_BINARY_FILE NULL, -#endif *rendCtx.pOutSampleRate ); #endif break; @@ -2225,17 +2213,10 @@ static ivas_error initMasaDummyDecForMcOut( input_masa *inputMasa, IVAS_REND_Aud if ( decDummy->renderer_type == RENDERER_STEREO_PARAMETRIC ) { -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_dirac_dec_init_binaural_data( decDummy, NULL ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = ivas_dirac_dec_init_binaural_data( decDummy ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif decDummy->hDiracDecBin->useSubframeMode = 0; /* Todo Nokia: This will disappear in later work but needs to be this now. */ } @@ -2381,7 +2362,6 @@ static ivas_error initMasaDummyDecForBinauralOut( input_masa *inputMasa, IVAS_RE { return error; } -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &decDummy->hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; @@ -2391,12 +2371,6 @@ static ivas_error initMasaDummyDecForBinauralOut( input_masa *inputMasa, IVAS_RE { return error; } -#else - if ( ( error = ivas_dirac_dec_init_binaural_data( decDummy ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif decDummy->hDiracDecBin->useSubframeMode = 0; /* Todo Nokia: This will disappear in later work but needs to be this now. */ @@ -3412,9 +3386,7 @@ ivas_error IVAS_REND_GetDelay( */ int16_t i; int32_t latency_ns; -#ifdef FIX_310_TD_REND_DELAY int32_t max_latency_ns; -#endif /*-----------------------------------------------------------------* * Validate function arguments @@ -3427,9 +3399,7 @@ ivas_error IVAS_REND_GetDelay( *timeScale = hIvasRend->sampleRateOut; *nSamples = 0; -#ifdef FIX_310_TD_REND_DELAY max_latency_ns = 0; -#endif /* Compute the maximum delay across all inputs */ for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; i++ ) @@ -3443,11 +3413,7 @@ ivas_error IVAS_REND_GetDelay( latency_ns = max( hIvasRend->inputsIsm[i].crendWrapper.binaural_latency_ns, hIvasRend->inputsIsm[i].tdRendWrapper.binaural_latency_ns ); #endif -#ifdef FIX_310_TD_REND_DELAY max_latency_ns = max( max_latency_ns, latency_ns ); -#else - *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); -#endif } } @@ -3462,11 +3428,7 @@ ivas_error IVAS_REND_GetDelay( latency_ns = max( hIvasRend->inputsMc[i].crendWrapper.binaural_latency_ns, hIvasRend->inputsMc[i].tdRendWrapper.binaural_latency_ns ); #endif -#ifdef FIX_310_TD_REND_DELAY max_latency_ns = max( max_latency_ns, latency_ns ); -#else - *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); -#endif } } @@ -3479,11 +3441,7 @@ ivas_error IVAS_REND_GetDelay( #else latency_ns = hIvasRend->inputsSba[i].crendWrapper.binaural_latency_ns; #endif -#ifdef FIX_310_TD_REND_DELAY max_latency_ns = max( max_latency_ns, latency_ns ); -#else - *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); -#endif } } @@ -3492,17 +3450,11 @@ ivas_error IVAS_REND_GetDelay( if ( hIvasRend->inputsMasa[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { latency_ns = NS2SA( hIvasRend->sampleRateOut, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); -#ifdef FIX_310_TD_REND_DELAY max_latency_ns = max( max_latency_ns, latency_ns ); -#else - *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); -#endif } } -#ifdef FIX_310_TD_REND_DELAY *nSamples = (int16_t) roundf( (float) max_latency_ns * *timeScale / 1000000000.f ); -#endif return IVAS_ERR_OK; } @@ -4009,7 +3961,7 @@ static ivas_error rotateFrameMc( /* Get next quaternion and calculate rotation matrix */ #ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_Process( headRotData->hOrientationTracker, - headRotData->headPositions[subframe_idx], + &headRotData->headPositions[subframe_idx], (float) ( FRAMES_PER_SEC * RENDERER_HEAD_POSITIONS_PER_FRAME ), &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, Rmat ); @@ -4118,7 +4070,7 @@ static ivas_error rotateFrameSba( /* Get next quaternion and calculate rotation matrix */ #ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_Process( headRotData->hOrientationTracker, - headRotData->headPositions[subframe_idx], + &headRotData->headPositions[subframe_idx], (float) ( FRAMES_PER_SEC * RENDERER_HEAD_POSITIONS_PER_FRAME ), &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, Rmat ); @@ -4256,7 +4208,7 @@ static ivas_error renderIsmToBinauralRoom( { #ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_Process( headRotData->hOrientationTracker, - headRotData->headPositions[subframe_idx], + &headRotData->headPositions[subframe_idx], (float) ( FRAMES_PER_SEC ), &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, Rmat ); diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 21f2a2988d..c52b06d6f0 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -36,9 +36,7 @@ #include "prot.h" // VE: !!!!! #include "ivas_prot.h" // VE: !!!!! -#ifdef HRTF_BINARY_FILE #include "lib_dec.h" -#endif struct hrtfFileReader { @@ -120,8 +118,6 @@ void hrtfFileReader_close( } -#ifdef HRTF_BINARY_FILE - /*-------------------------------------------------------------------* * read_and_check_hrtf_binary_file_header() * @@ -176,10 +172,8 @@ static ivas_error check_hrtf_binary_header( ivas_hrtfs_header_t *hrtf_header ) { // Check the renderer type if ( ( hrtf_header->rend_type != RENDERER_BINAURAL_MIXER_CONV ) && ( hrtf_header->rend_type != RENDERER_BINAURAL_MIXER_CONV_ROOM ) && -#ifdef HRTF_BINARY_FILE ( hrtf_header->rend_type != RENDERER_BINAURAL_FASTCONV ) && ( hrtf_header->rend_type != RENDERER_BINAURAL_FASTCONV_ROOM ) && ( hrtf_header->rend_type != RENDERER_BINAURAL_PARAMETRIC ) && ( hrtf_header->rend_type != RENDERER_BINAURAL_PARAMETRIC_ROOM ) && -#endif ( hrtf_header->rend_type != RENDERER_BINAURAL_OBJECTS_TD ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Header of HRTF binary file not compliant (renderer type)" ); @@ -222,8 +216,6 @@ static ivas_error read_hrtf_binary_header( ivas_hrtfs_header_t *hrtf_header, FIL return IVAS_ERR_END_OF_FILE; } -#endif - /*-------------------------------------------------------------------* * LoadBSplineBinaryITD() @@ -298,9 +290,7 @@ static ivas_error LoadBSplineBinary( ModelParams_t *model; int16_t i, tmp; -#ifdef FIX_310_TD_REND_DELAY fread( &HrFiltSet_p->latency_s, sizeof( float ), 1, f_hrtf ); -#endif model = &( HrFiltSet_p->ModelParams ); @@ -439,7 +429,6 @@ static ivas_error TDREND_MIX_LoadHRTF( int16_t tmp; ivas_error error; -#ifdef HRTF_BINARY_FILE bool is_tdrend; ivas_error header_check_result; @@ -449,11 +438,9 @@ static ivas_error TDREND_MIX_LoadHRTF( int32_t hrtf_data_size_max; char *hrtf_data; -#endif error = IVAS_ERR_OK; -#ifdef HRTF_BINARY_FILE if ( ( header_check_result = read_and_check_hrtf_binary_file_header( &hrtfs_file_header, f_hrtf ) ) != IVAS_ERR_OK ) { @@ -501,7 +488,6 @@ static ivas_error TDREND_MIX_LoadHRTF( free( hrtf_data ); if ( is_tdrend ) -#endif { if ( fread( &tmp, 1, sizeof( int16_t ), f_hrtf ) == 0 ) { @@ -519,12 +505,10 @@ static ivas_error TDREND_MIX_LoadHRTF( error = LoadBSplineBinary( HrFiltSet_p, f_hrtf ); } } -#ifdef HRTF_BINARY_FILE else { return IVAS_ERROR( IVAS_ERR_INVALID_HRTF, "HR filter not found in binary file." ); } -#endif return error; } @@ -543,9 +527,7 @@ ivas_error load_HRTF_binary( { ivas_error error; -#ifdef HRTF_BINARY_FILE fseek( hrtfReader->file, 0, SEEK_SET ); -#endif error = TDREND_MIX_LoadHRTF( hrtfReader->file, hHrtf ); @@ -625,12 +607,10 @@ ivas_error dealloc_HRTF_binary( ivas_error error; error = IVAS_ERR_OK; -#ifdef HRTF_BINARY_FILE if ( hHrtf == NULL ) { return error; } -#endif if ( !hHrtf->ModelParams.modelROM ) { @@ -677,7 +657,6 @@ ivas_error dealloc_HRTF_binary( return error; } -#ifdef HRTF_BINARY_FILE /*------------------------------------------------------------------------- * ivas_hrtf_init() @@ -944,7 +923,6 @@ static ivas_error create_HRTF_from_rawdata( return IVAS_ERR_OK; } -#ifdef HRTF_BINARY_FILE static ivas_error init_fastconv_HRTF_handle( HRTFS_FASTCONV *hHrtf /* i/o: HRTF FastConv handle */ ) @@ -1272,10 +1250,8 @@ ivas_error load_fastconv_HRTF_from_binary( return IVAS_ERR_OK; } -#endif -#ifdef HRTF_BINARY_FILE static ivas_error create_parambin_HRTF_from_rawdata( HRTFS_PARAMBIN_HANDLE *hHRTF, /* i/o: Parametric binauralizer HRTF handle */ char *hrtf_data /* i : pointer to binary file */ @@ -1409,7 +1385,6 @@ ivas_error load_parambin_HRTF_from_binary( return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------* @@ -1514,4 +1489,81 @@ ivas_error create_SetOfHRTF_from_binary( return IVAS_ERR_OK; } + +#ifdef FIX_MEMORY_COUNTING_HRTF_BINARY_FILE +/*---------------------------------------------------------------------* + * destroy_HRTF() + * + * Destroy the HRTF CRend handle + *---------------------------------------------------------------------*/ + +static ivas_error destroy_HRTF( + HRTFS_HANDLE *hHRTF /* i/o: HRTF CRend handle */ +) +{ + uint16_t i, j; + + if ( *hHRTF != NULL && hHRTF != NULL ) + { + for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) + { + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + if ( ( *hHRTF )->pIndex_frequency_max[i][j] != NULL ) + { + free( ( *hHRTF )->pIndex_frequency_max[i][j] ); + } + if ( ( *hHRTF )->pOut_to_bin_re[i][j] != NULL ) + { + free( ( *hHRTF )->pOut_to_bin_re[i][j] ); + } + if ( ( *hHRTF )->pOut_to_bin_im[i][j] != NULL ) + { + free( ( *hHRTF )->pOut_to_bin_im[i][j] ); + } + } + } + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + if ( ( *hHRTF )->pIndex_frequency_max_diffuse[j] != NULL ) + { + free( ( *hHRTF )->pIndex_frequency_max_diffuse[j] ); + } + if ( ( *hHRTF )->pOut_to_bin_diffuse_re[j] != NULL ) + { + free( ( *hHRTF )->pOut_to_bin_diffuse_re[j] ); + } + if ( ( *hHRTF )->pOut_to_bin_diffuse_im[j] != NULL ) + { + free( ( *hHRTF )->pOut_to_bin_diffuse_im[j] ); + } + } + + free( *hHRTF ); + *hHRTF = NULL; + } + + return IVAS_ERR_OK; +} + +/*---------------------------------------------------------------------* + * destroy_SetOfHRTF() + * + * Destroy the HRTF data set. + *---------------------------------------------------------------------*/ + +ivas_error destroy_SetOfHRTF( + HRTFS_CREND_HANDLE hSetOfHRTF /* i/o: Set of HRTF CRend handle */ +) +{ + if ( hSetOfHRTF != NULL ) + { + destroy_HRTF( &( hSetOfHRTF->hHRTF_hrir_combined ) ); + destroy_HRTF( &( hSetOfHRTF->hHRTF_hrir_hoa3 ) ); + destroy_HRTF( &( hSetOfHRTF->hHRTF_brir_combined ) ); + } + + return IVAS_ERR_OK; +} + #endif diff --git a/lib_util/hrtf_file_reader.h b/lib_util/hrtf_file_reader.h index b446551150..3d9a901c24 100644 --- a/lib_util/hrtf_file_reader.h +++ b/lib_util/hrtf_file_reader.h @@ -73,7 +73,6 @@ ivas_error load_HRTF_binary( const hrtfFileReader *hrtfReader /* i/o: pointer to hrtfFileReader handle */ ); -#ifdef HRTF_BINARY_FILE /*---------------------------------------------------------------------* * create_SetOfHRTF_from_binary() * @@ -96,9 +95,7 @@ ivas_error destroy_SetOfHRTF( IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF /* i/o: Set of HRTF CRend handle */ ); -#endif -#ifdef HRTF_BINARY_FILE /*---------------------------------------------------------------------* * load_fastconv_HRTF_from_binary() * @@ -122,7 +119,6 @@ ivas_error load_parambin_HRTF_from_binary( const hrtfFileReader *hrtfReader /* i : pointer to hrtfFileReader handle */ ); -#endif /*---------------------------------------------------------------------* * dealloc_HRTF_binary() diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 8d485afccf..7f94afadb6 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -8,39 +8,17 @@ // (the easiest way how to achieve this is to use the name of the test vector itself, as shown below) -// DFT stereo at 13.2 kbps, 16kHz in, 16kHz out, DTX on, random FEC at 5% -../IVAS_cod -stereo 1 -dtx 13200 16 testv/stvST16n.pcm bit -../IVAS_dec -fec 5 STEREO 16 bit testv/stvST16n.pcm_DFT_13200_16-16_DTX_FEC5.tst - -// DFT stereo at 16.4 kbps, 32kHz in, 16kHz out, DTX on -../IVAS_cod -stereo 1 -dtx 16400 32 testv/stvST32n.pcm bit -../IVAS_dec STEREO 16 bit testv/stvST32n.pcm_DFT_16400_32-16_DTX.tst - -// DFT stereo at 24.4 kbps, 32kHz in, 32kHz out, DTX on, MONO out -../IVAS_cod -stereo 1 -dtx 24400 32 testv/stvST32n.pcm bit -../IVAS_dec MONO 32 bit testv/stvST32n.pcm_DFT_24400_32-32_DTX_MONO.tst - -// DFT stereo at 32 kbps, 32kHz in, 48kHz out, MONO out, 6% FEC pattern -../IVAS_cod -stereo 1 32000 32 testv/stvST32c.pcm bit -../IVAS_dec -fec testv/FEC_6pct.bin MONO 48 bit testv/stvST32c.pcm_DFT_32000_32-48_MONO_FEC6.tst - - -// TD stereo at 13.2 kbps, 16kHz in, 16kHz out, DTX on, random FEC at 5% -../IVAS_cod -stereo 2 -dtx 13200 16 testv/stvST16n.pcm bit -../IVAS_dec -fec 5 STEREO 16 bit testv/stvST16n.pcm_TD_13200_16-16_DTX_FEC5.tst - -// TD stereo at 16.4 kbps, 32kHz in, 16kHz out, DTX on -../IVAS_cod -stereo 2 -dtx 16400 32 testv/stvST32n.pcm bit -../IVAS_dec STEREO 16 bit testv/stvST32n.pcm_TD_16400_32-16_DTX.tst - -// TD stereo at 24.4 kbps, 32kHz in, 32kHz out, DTX on, MONO out -../IVAS_cod -stereo 2 -dtx 24400 32 testv/stvST32n.pcm bit -../IVAS_dec MONO 32 bit testv/stvST32n.pcm_TD_24400_32-32_DTX_MONO.tst +// Unified stereo at 13.2 kbps, 16kHz in, 16kHz out, DTX on, random FEC at 5% +../IVAS_cod -stereo -dtx 13200 16 testv/stvST16n.pcm bit +../IVAS_dec -fec 5 STEREO 16 bit testv/stvST16n.pcm_Unified_13200_16-16_DTX_FEC5.tst -// TD stereo at 32 kbps, 48kHz in, 32kHz out, random FEC at 5% -../IVAS_cod -stereo 2 32000 48 testv/stvST48c.pcm bit -../IVAS_dec -fec 5 STEREO 32 bit testv/stvST48c.pcm_TD_32000_48-32_FEC5.tst +// Unified stereo at 16.4 kbps, 32kHz in, 16kHz out, DTX on +../IVAS_cod -stereo -dtx 16400 32 testv/stvST32n.pcm bit +../IVAS_dec STEREO 16 bit testv/stvST32n.pcm_Unified_16400_32-16_DTX.tst +// Unified stereo at 32 kbps, 32kHz in, 48kHz out, MONO out, 6% FEC pattern +../IVAS_cod -stereo 32000 32 testv/stvST32c.pcm bit +../IVAS_dec -fec testv/FEC_6pct.bin MONO 48 bit testv/stvST32c.pcm_Unified_32000_32-48_MONO_FEC6.tst // unified stereo at 13.2 kbps, 16kHz in, 16kHz out ../IVAS_cod -stereo 13200 16 testv/stvST16c.pcm bit @@ -435,9 +413,9 @@ ../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.pcm bit ../IVAS_dec BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural.tst -// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Subframe, random FEC at 5% +// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.pcm bit -../IVAS_dec -fec 5 -force_subframe_bin BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Subframe_FEC5.tst +../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Subframe_FEC5.tst // SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation ../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.pcm bit @@ -483,9 +461,9 @@ ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit ../IVAS_dec BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom.tst -// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Subframe +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit -../IVAS_dec -force_subframe_bin BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Subframe.tst +../IVAS_dec BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Subframe.tst // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit @@ -631,9 +609,9 @@ ../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 24400 48 testv/stv_IVASMASA_1dir1TC.pcm bit ../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir1TC.pcm_24400_48-48_BinauralRoom.tst -// MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Subframe +// MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out ../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 24400 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec -force_subframe_bin BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir1TC.pcm_24400_48-48_BinauralRoom_Subframe.tst +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir1TC.pcm_24400_48-48_BinauralRoom_Subframe.tst // MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation ../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 24400 48 testv/stv_IVASMASA_1dir1TC.pcm bit @@ -655,9 +633,9 @@ ../IVAS_cod -masa 1 testv/stv_IVASMASA_2dir1TC.met 128000 48 testv/stv_IVASMASA_2dir1TC.pcm bit ../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv_IVASMASA_2dir1TC.pcm_128000_48-48_BINAURAL_FEC5.tst -// MASA 2dir 1TC at 128 kbps, 48kHz in, 48kHz out, BINAURAL out, Subframe +// MASA 2dir 1TC at 128 kbps, 48kHz in, 48kHz out, BINAURAL out ../IVAS_cod -masa 1 testv/stv_IVASMASA_2dir1TC.met 128000 48 testv/stv_IVASMASA_2dir1TC.pcm bit -../IVAS_dec -force_subframe_bin BINAURAL 48 bit testv/stv_IVASMASA_2dir1TC.pcm_128000_48-48_BINAURAL_Subframe.tst +../IVAS_dec BINAURAL 48 bit testv/stv_IVASMASA_2dir1TC.pcm_128000_48-48_BINAURAL_Subframe.tst // MASA 2dir 1TC at 128 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation ../IVAS_cod -masa 1 testv/stv_IVASMASA_2dir1TC.met 128000 48 testv/stv_IVASMASA_2dir1TC.pcm bit @@ -731,9 +709,9 @@ ../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 384000 48 testv/stv_IVASMASA_2dir2TC.pcm bit ../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_2dir2TC.pcm_384000_48-48_BinauralRoom.tst -// MASA 2dir 2TC at 384 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out, Subframe +// MASA 2dir 2TC at 384 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out ../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 384000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec -force_subframe_bin BINAURAL_ROOM 48 bit testv/stv_IVASMASA_2dir2TC.pcm_384000_48-48_BinauralRoom_Subframe.tst +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_2dir2TC.pcm_384000_48-48_BinauralRoom_Subframe.tst // MASA 2dir 2TC at 512 kbps, 48kHz in, 48kHz out, 5_1 out ../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 512000 48 testv/stv_IVASMASA_2dir2TC.pcm bit @@ -772,9 +750,9 @@ ../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit ../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_Binaural_FEC5.tst -// Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL out, Subframe +// Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL out ../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit -../IVAS_dec -force_subframe_bin BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_Binaural_Subframe.tst +../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_Binaural_Subframe.tst // Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation ../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit diff --git a/scripts/config/self_test_evs.prm b/scripts/config/self_test_evs.prm index a45a4a032e..b0013bc876 100644 --- a/scripts/config/self_test_evs.prm +++ b/scripts/config/self_test_evs.prm @@ -196,12 +196,12 @@ -// Codec switching A-B between (ACELP-only) 7.2 and 16.4 kbps, 16kHz in, 16kHz out -../IVAS_cod -force speech ../scripts/switchPaths/wb_low1.bin 16 testv/stv16n.pcm bit +// Codec switching A-B between 7.2 and 16.4 kbps, 16kHz in, 16kHz out +../IVAS_cod ../scripts/switchPaths/wb_low1.bin 16 testv/stv16n.pcm bit ../IVAS_dec 16 bit testv/stv16n_07_16k_16-16.tst -// Codec switching A-B between (MUSIC-only) 13.2 and 64 kbps, 16kHz in, 16kHz out -../IVAS_cod -force music ../scripts/switchPaths/wb_high1.bin 16 testv/stv16n.pcm bit +// Codec switching A-B between 13.2 and 64 kbps, 16kHz in, 16kHz out +../IVAS_cod ../scripts/switchPaths/wb_high1.bin 16 testv/stv16n.pcm bit ../IVAS_dec 16 bit testv/stv16n_13_64k_16-16.tst // Codec switching A-B between 5.9 and 64 kbps, 16kHz in, 16kHz out diff --git a/scripts/pyaudio3dtools/audio3dtools.py b/scripts/pyaudio3dtools/audio3dtools.py index a325a433b5..e6c03d7b73 100755 --- a/scripts/pyaudio3dtools/audio3dtools.py +++ b/scripts/pyaudio3dtools/audio3dtools.py @@ -194,6 +194,10 @@ def main(): handlers=[console_handler], ) logger.info("Audio3DTools") + logger.info( + "Attention: you are using an older version of the pyaudio3dtools scripts (not including ISM-> binaural reference renderer or loudness tool)" + ) + logger.info("For the newest version see branch python_scripts_updates") if args.list is True or args.long is True: logger.info("===Supported spatial audio formats===") -- GitLab From b820c048f8d24c1d2e10c5f5481e63a91bf19661 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Thu, 16 Feb 2023 00:16:05 +0100 Subject: [PATCH 068/375] merge 109/343 --- apps/decoder.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index aad664bea3..5217fab58f 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -956,7 +956,7 @@ static bool parseCmdlIVAS_dec( char tmp[4]; strcpy( tmp, argv[i + 1] ); #endif -#ifdef FIX_I109_ORIENTATION_TRACKING // TODO @Philips needs merge with FIX_343_TO_UPPER +#ifdef FIX_I109_ORIENTATION_TRACKING char *tmp = to_upper( argv[i + 1] ); if ( strcmp( to_upper( tmp ), "NONE" ) == 0 ) { @@ -964,10 +964,12 @@ static bool parseCmdlIVAS_dec( } else if ( strcmp( to_upper( tmp ), "REF" ) == 0 ) #else - - +#ifdef FIX_343_TO_UPPER + char tmp[4]; + strcpy( tmp, argv[i + 1] ); +#endif /* 343 */ if ( strcmp( to_upper( tmp ), "REF" ) == 0 ) -#endif +#endif /* 109 */ { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; } -- GitLab From 8cb56512029ad061789c376e639cd304098ea44d Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Thu, 16 Feb 2023 00:28:14 +0100 Subject: [PATCH 069/375] Revert "merge 109/343" This reverts commit b820c048f8d24c1d2e10c5f5481e63a91bf19661. --- apps/decoder.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 5217fab58f..aad664bea3 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -956,7 +956,7 @@ static bool parseCmdlIVAS_dec( char tmp[4]; strcpy( tmp, argv[i + 1] ); #endif -#ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef FIX_I109_ORIENTATION_TRACKING // TODO @Philips needs merge with FIX_343_TO_UPPER char *tmp = to_upper( argv[i + 1] ); if ( strcmp( to_upper( tmp ), "NONE" ) == 0 ) { @@ -964,12 +964,10 @@ static bool parseCmdlIVAS_dec( } else if ( strcmp( to_upper( tmp ), "REF" ) == 0 ) #else -#ifdef FIX_343_TO_UPPER - char tmp[4]; - strcpy( tmp, argv[i + 1] ); -#endif /* 343 */ + + if ( strcmp( to_upper( tmp ), "REF" ) == 0 ) -#endif /* 109 */ +#endif { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; } -- GitLab From 0bcb8dd2f9f96e34e0da0adb06eb6a5dcc42b6c6 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Thu, 16 Feb 2023 00:53:03 +0100 Subject: [PATCH 070/375] fix 109/343 conflicts --- apps/decoder.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index aad664bea3..7fac28c52c 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -932,6 +932,7 @@ static bool parseCmdlIVAS_dec( usage_dec(); return false; } +#else #ifdef FIX_343_TO_UPPER strncpy( argv_to_upper, argv[i + 1], sizeof( argv_to_upper ) - 1 ); @@ -956,18 +957,20 @@ static bool parseCmdlIVAS_dec( char tmp[4]; strcpy( tmp, argv[i + 1] ); #endif -#ifdef FIX_I109_ORIENTATION_TRACKING // TODO @Philips needs merge with FIX_343_TO_UPPER +#ifdef FIX_I109_ORIENTATION_TRACKING +#ifndef FIX_343_TO_UPPER + if ( strcmp( to_upper( tmp ), "NON" ) == 0 ) +#else char *tmp = to_upper( argv[i + 1] ); if ( strcmp( to_upper( tmp ), "NONE" ) == 0 ) +#endif { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; } else if ( strcmp( to_upper( tmp ), "REF" ) == 0 ) #else - - if ( strcmp( to_upper( tmp ), "REF" ) == 0 ) -#endif +#endif /* 109 */ { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; } @@ -981,7 +984,7 @@ static bool parseCmdlIVAS_dec( usage_dec(); return false; } -#endif +#endif /* n109 */ i += 2; } #ifdef FIX_I109_ORIENTATION_TRACKING -- GitLab From 788123e09b2307de27bbb389ff17e0c1b4a215b0 Mon Sep 17 00:00:00 2001 From: szczerba Date: Thu, 16 Feb 2023 09:47:05 +0100 Subject: [PATCH 071/375] Further merge-related fixes --- lib_com/ivas_prot.h | 2 +- lib_rend/ivas_objectRenderer.c | 14 +++++++------- lib_rend/ivas_orient_trk.c | 20 ++++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 01634b60a6..fb0b9d4450 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5731,7 +5731,7 @@ ivas_error ivas_orient_trk_GetTrackedRotation( #ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_Process( ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - const IVAS_QUATERNION *absRot, /* i : absolute head rotation */ + const IVAS_QUATERNION *pAbsRot, /* i : absolute head rotation */ float updateRate, /* i : rotation update rate [Hz] */ IVAS_QUATERNION *pTrkRot /* o : tracked rotation */ ); diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 6d8aa1708c..ddd4d06f9e 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -482,7 +482,7 @@ void ObjRenderIVASFrame( #else if ( st_ivas->hHeadTrackData != NULL ) { - if ( ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hHeadTrackData->Quaternions[subframe_idx], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ) != IVAS_ERR_OK ) + if ( ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, &st_ivas->hHeadTrackData->Quaternions[subframe_idx], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ) != IVAS_ERR_OK ) { exit( -1 ); } @@ -956,10 +956,10 @@ ivas_error ivas_rend_TDObjRenderFrame( #ifdef FIX_198_TDREND_INTERFACE AUDIO_CONFIG transport_config; int32_t output_Fs; -#endif - +#else #ifdef FIX_I109_ORIENTATION_TRACKING IVAS_QUATERNION trackedHeadOrientation; +#endif #endif push_wmops( "ivas_rend_TDObjRenderFrame" ); @@ -1007,10 +1007,10 @@ ivas_error ivas_rend_TDObjRenderFrame( ObjRenderIVASFrame_unwrap( NULL, 1, NULL, transport_config, output_Fs, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, output, output_frame - #ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef FIX_I109_ORIENTATION_TRACKING , - NULL // TODO @Philips check if orientation tracking already done before renderer calls this function - #endif + headRotData->hOrientationTracker // TODO @Philips check if orientation tracking already done before renderer calls this function +#endif ); #else @@ -1040,7 +1040,7 @@ ivas_error ivas_rend_TDObjRenderFrame( if ( headRotData->headRotEnabled ) { ivas_orient_trk_Process( headRotData->hOrientationTracker, - headRotData->headPositions[subframe_idx], + &headRotData->headPositions[subframe_idx], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ); } diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 2e01d6b817..22ffdf64cb 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -441,10 +441,10 @@ ivas_error ivas_orient_trk_SetAbsoluteOrientation( #ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_Process( - ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - const IVAS_QUATERNION *absRot, /* i : absolute head rotation */ - float updateRate, /* i : rotation update rate [Hz] */ - IVAS_QUATERNION *pTrkRot ) /* o : tracked rotation */ + ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ + const IVAS_QUATERNION *pAbsRot, /* i : absolute head rotation */ + float updateRate, /* i : rotation update rate [Hz] */ + IVAS_QUATERNION *pTrkRot ) /* o : tracked rotation */ { float normalizedOrientation; float relativeOrientationRate; @@ -464,34 +464,34 @@ ivas_error ivas_orient_trk_Process( switch ( pOTR->trackingType ) { case OTR_TRACKING_NONE: - *pTrkRot = *absRot; + *pTrkRot = *pAbsRot; break; case OTR_TRACKING_REF_ORIENT: /* Reset average orientation */ - pOTR->absAvgRot = *absRot; + pOTR->absAvgRot = *pAbsRot; /* Reset adaptation filter - start adaptation at center rate */ pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate ); /* Compute relative orientation = (absolute orientation) - (reference orientation) */ QuaternionInverse( pOTR->refRot, pTrkRot ); - QuaternionProduct( *pTrkRot, *absRot, pTrkRot ); + QuaternionProduct( *pTrkRot, *pAbsRot, pTrkRot ); break; case OTR_TRACKING_AVG_ORIENT: /* Compute average (low-pass filtered) absolute orientation */ - QuaternionSlerp( pOTR->absAvgRot, *absRot, alpha, &pOTR->absAvgRot ); + QuaternionSlerp( pOTR->absAvgRot, *pAbsRot, alpha, &pOTR->absAvgRot ); /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */ QuaternionInverse( pOTR->absAvgRot, pTrkRot ); - QuaternionProduct( *pTrkRot, *absRot, pTrkRot ); + QuaternionProduct( *pTrkRot, *pAbsRot, pTrkRot ); /* Adapt LPF constant based on orientation excursion relative to current mean: - low cutoff (slow adaptation) for small excursions (around center) - high cutoff (fast adaptation) for large excursions (off-center) */ - ang = QuaternionAngle( *absRot, *pTrkRot ); + ang = QuaternionAngle( *pAbsRot, *pTrkRot ); normalizedOrientation = ang * ang; relativeOrientationRate = sqrtf( normalizedOrientation ) / pOTR->adaptationAngle; -- GitLab From 0d8814817b957b1260adf9bea791658cd07d36f5 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 17 Feb 2023 12:47:38 +0100 Subject: [PATCH 072/375] - manual implementation of DISCRETE_ISM_DTX_CNG - all is BE, DiscISM DTX not tested yet --- lib_com/ivas_cnst.h | 11 +- lib_com/ivas_ism_config.c | 68 ++++++ lib_com/ivas_prot.h | 114 +++++++-- lib_com/ivas_stat_com.h | 8 + lib_com/options.h | 4 + lib_dec/ivas_dec.c | 8 + lib_dec/ivas_init_dec.c | 8 +- lib_dec/ivas_ism_dtx_dec.c | 72 ++++++ lib_dec/ivas_ism_metadata_dec.c | 411 +++++++++++++++++++++++++++++++- lib_dec/ivas_sce_dec.c | 24 ++ lib_dec/ivas_stat_dec.h | 3 + lib_enc/ivas_ism_dtx_enc.c | 194 +++++++++++++++ lib_enc/ivas_ism_enc.c | 50 +++- lib_enc/ivas_ism_metadata_enc.c | 213 +++++++++++++++++ lib_enc/ivas_stat_enc.h | 3 + 15 files changed, 1154 insertions(+), 37 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index d29a7d33fa..fab0fa0ab6 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -334,11 +334,20 @@ typedef enum #define PARAM_ISM_MAX_CHAN 16 #define PARAM_ISM_HYS_BUF_SIZE 10 +/* ISM DTX */ +#ifdef DISCRETE_ISM_DTX_CNG +#define ISM_DTX_COH_SCA_BITS 4 +#endif #ifdef PARAM_ISM_DTX_CNG -#define PARAM_ISM_DTX_COH_SCA_BITS 4 +#define PARAM_ISM_DTX_COH_SCA_BITS 4 // VE!!!!! to be removed #define PARAM_ISM_DTX_AZI_BITS 5 #define PARAM_ISM_DTX_ELE_BITS 4 #endif +#ifdef DISCRETE_ISM_DTX_CNG +#define ISM_DTX_ENER_BITS 4 +#define ISM_DTX_COH_SCA_BITS 4 +#endif + typedef enum { diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index b22d82a9da..3f4aa7ffd2 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -490,3 +490,71 @@ ISM_MODE ivas_ism_mode_select( return ism_mode; } + + +#ifdef DISCRETE_ISM_DTX_CNG +/*-------------------------------------------------------------------* + * update_last_metadata() + * + * Store last metadata values + *-------------------------------------------------------------------*/ + +void update_last_metadata( + const int16_t num_obj, /* i : number of objects */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t updt_flag[] /* i : last metadata update flag */ +) +{ + int16_t ch; + + for ( ch = 0; ch < num_obj; ch++ ) + { + if ( updt_flag[ch] == 1 ) + { + hIsmMeta[ch]->last_azimuth = hIsmMeta[ch]->azimuth; + hIsmMeta[ch]->last_elevation = hIsmMeta[ch]->elevation; + } + } + + return; +} + + +/*----------------------------------------------------------------* + * ivas_get_ism_sid_quan_bitbudget() + * + * Set quantization bits based on the number of coded objects + *----------------------------------------------------------------*/ + +/*! r: low resolution flag */ +int16_t ivas_get_ism_sid_quan_bitbudget( + const int16_t num_obj, /* i : number of objects */ + int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ + int16_t *nBits_elevation, /* o : number of Q bits for elevation */ + int16_t *nBits_ener, /* o : number of Q bits for energy */ + int16_t *nBits_coh, /* o : number of Q bits for coherence */ + int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ +) +{ + int16_t low_res_q; + + low_res_q = 0; + *nBits_azimuth = ISM_AZIMUTH_NBITS; + *nBits_elevation = ISM_ELEVATION_NBITS; + *nBits_ener = ISM_DTX_ENER_BITS; + *nBits_coh = ISM_DTX_COH_SCA_BITS; + *nBits_sce_id = 1; + + if ( num_obj >= 3 ) + { + low_res_q = 1; + *nBits_azimuth = PARAM_ISM_DTX_AZI_BITS; + *nBits_elevation = PARAM_ISM_DTX_ELE_BITS; + *nBits_ener = ISM_DTX_ENER_BITS - 1; + *nBits_coh = ISM_DTX_COH_SCA_BITS - 1; + *nBits_sce_id = 2; + } + + return low_res_q; +} +#endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 8c46ce6f2e..74feb3b6b5 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -834,9 +834,9 @@ float ism_dequant_meta( ); ivas_error set_ism_metadata( - ISM_METADATA_HANDLE hIsmMeta, /* i/o: ISM metadata handle */ - float azimuth, /* i : azimuth */ - float elevation /* i : elevation */ + ISM_METADATA_HANDLE hIsmMeta, /* i/o: ISM metadata handle */ + float azimuth, /* i : azimuth */ + float elevation /* i : elevation */ ); ivas_error create_ism_metadata_enc( @@ -878,6 +878,9 @@ ivas_error ivas_ism_metadata_dec( const int16_t bfi, /* i : bfi flag */ int16_t nb_bits_metadata[], /* o : number of metadata bits */ ISM_MODE ism_mode, /* i : ISM mode */ +#ifdef DISCRETE_ISM_DTX_CNG + int16_t *ism_dtx_hangover_cnt, /* i/o: DTX hangover counter */ +#endif const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ ); @@ -951,48 +954,109 @@ void ivas_param_ism_params_to_masa_param_mapping( *----------------------------------------------------------------------------------*/ ivas_error ivas_ism_dtx_open( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +#ifdef DISCRETE_ISM_DTX_CNG +/*! r: indication of DTX frame */ +int16_t ivas_ism_dtx_enc_COMMON( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + int16_t md_diff_flag[], /* o : metadata differential flag */ + int16_t *sid_flag /* o : indication of SID frame */ +); +#endif +/*! r: indication of DTX frame */ +int16_t ivas_ism_dtx_enc( + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + int16_t *sid_flag /* o : indication of SID frame */ ); ivas_error ivas_ism_dtx_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - int16_t *nb_bits_metadata /* o : number of metadata bits */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + int16_t *nb_bits_metadata /* o : number of metadata bits */ ); +#ifdef DISCRETE_ISM_DTX_CNG +void ivas_ism_metadata_sid_enc( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + const int16_t flag_noisy_speech, /* i : noisy speech flag */ + const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + const ISM_MODE ism_mode, /* i : ISM mode */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t sid_flag, /* i : indication of SID frame */ + const int16_t md_diff_flag[], /* i : metadata differental flag */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + int16_t nb_bits_metadata[] /* o : number of metadata bits */ +); +#endif // VE!!!!! + void ivas_param_ism_metadata_dtx_enc( - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - ISM_METADATA_HANDLE hIsmMeta[], /* i : ISM metadata handles */ - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + ISM_METADATA_HANDLE hIsmMeta[], /* i : ISM metadata handles */ + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ ); +#ifdef DISCRETE_ISM_DTX_CNG +ivas_error ivas_ism_metadata_sid_dec( + SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int16_t bfi, /* i : bfi flag */ + const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + const ISM_MODE ism_mode, /* i : ISM mode */ + int16_t *flag_noisy_speech, /* o : noisy speech flag */ + int16_t *sce_id_dtx, /* o : SCE DTX ID */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + int16_t nb_bits_metadata[] /* o : number of metadata bits */ +); +#endif // VE!!!!! + void ivas_param_ism_metadata_dtx_dec( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_ism_get_sce_id_dtx( - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t input_frame /* i : input frame length per channel */ + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t input_frame /* i : input frame length per channel */ ); void ivas_param_ism_compute_noisy_speech_flag( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); -/*! r: indication of DTX frame */ -int16_t ivas_ism_dtx_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - int16_t *sid_flag /* o : indication of SID frame */ +void ivas_ism_coh_estim_dtx_enc( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t input_frame /* i : input frame length */ ); -void ivas_ism_coh_estim_dtx_enc( - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t input_frame /* i : input frame length */ +#ifdef DISCRETE_ISM_DTX_CNG +void update_last_metadata( + const int16_t num_obj, /* i : number of objects */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t updt_flag[] /* i : last metadata update flag */ ); + +/*! r: low resolution flag */ +int16_t ivas_get_ism_sid_quan_bitbudget( + const int16_t num_obj, /* i : number of objects */ + int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ + int16_t *nBits_elevation, /* o : number of Q bits for elevation */ + int16_t *nBits_ener, /* o : number of Q bits for energy */ + int16_t *nBits_coh, /* o : number of Q bits for coherence */ + int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ +); +#endif #endif /*----------------------------------------------------------------------------------* diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 5c9b60aceb..d9fab42ab6 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -58,6 +58,14 @@ typedef struct int16_t last_elevation_idx; /* last frame index of coded elevation */ int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */ +#ifdef DISCRETE_ISM_DTX_CNG + float last_azimuth; /* last Q azimuth value */ + float last_elevation; /* last Q elevation value */ + + float last_true_azimuth; /* last true Q azimuth value */ + float last_true_elevation; /* last true Q elevation value */ +#endif + } ISM_METADATA_FRAME, *ISM_METADATA_HANDLE; diff --git a/lib_com/options.h b/lib_com/options.h index fe6c9fe2df..bccecd0420 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -177,6 +177,10 @@ #define SMOOTH_WITH_TRANS_DET #endif + +#define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ + + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index ec618917b7..2098e1f157 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -151,11 +151,19 @@ ivas_error ivas_dec( #endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { +#ifdef DISCRETE_ISM_DTX_CNG + ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, &( st_ivas->ism_dtx_hangover_cnt ), st_ivas->hDirAC->hParamIsm ); +#else ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); +#endif } else /* ISM_MODE_DISC */ { +#ifdef DISCRETE_ISM_DTX_CNG + ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, &( st_ivas->ism_dtx_hangover_cnt ), NULL ); +#else ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, NULL ); +#endif } for ( n = 0; n < st_ivas->nchan_transport; n++ ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 4e49799315..86fdf65309 100755 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -245,6 +245,11 @@ ivas_error ivas_dec_setup( case SID_MDCT_STEREO: st_ivas->element_mode_init = IVAS_CPE_MDCT; break; +#ifdef DISCRETE_ISM_DTX + case SID_ISM: + st_ivas->element_mode_init = IVAS_SCE; + break; +#endif case SID_MASA_1TC: st_ivas->element_mode_init = IVAS_SCE; st_ivas->nchan_transport = 1; @@ -422,8 +427,8 @@ static ivas_error ivas_read_format( break; case SID_ISM: st_ivas->ivas_format = ISM_FORMAT; +#ifndef DISCRETE_ISM_DTX #ifdef PARAM_ISM_DTX_CNG - if ( st_ivas->ism_mode == ISM_MODE_DISC ) { ivas_ism_dec_config( st_ivas, 1 ); /* currently DTX supported for 1 ISM when ISM Mode is DISC_ISM */ @@ -435,6 +440,7 @@ static ivas_error ivas_read_format( } #else ivas_ism_dec_config( st_ivas, 1 ); /* currently DTX supported for 1ISM only */ +#endif #endif break; case SID_MULTICHANNEL: diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index bd15569f9e..b040b93ac8 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -99,6 +99,10 @@ ivas_error ivas_ism_dtx_dec( { int16_t ch, pos, num_obj, num_obj_prev; int32_t ivas_total_brate; +#ifdef DISCRETE_ISM_DTX_CNG + int16_t md_diff_flag[MAX_NUM_OBJECTS]; + int16_t flag_noisy_speech, sce_id; +#endif ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -153,7 +157,66 @@ ivas_error ivas_ism_dtx_dec( } /* Metadata decoding and dequantization */ +#ifdef DISCRETE_ISM_DTX_CNG +#if 1 + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + ivas_param_ism_metadata_dtx_dec( st_ivas ); + } + else +#endif + { + ivas_ism_metadata_sid_dec( st_ivas->hSCE, ivas_total_brate, st_ivas->bfi, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, + &flag_noisy_speech, &sce_id, st_ivas->hIsmMetaData, nb_bits_metadata ); + + if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) + { + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + st_ivas->hDirAC->hParamIsm->flag_noisy_speech = flag_noisy_speech; + } + } + + if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) + { + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + st_ivas->hISMDTX.sce_id_dtx = sce_id; + } + else /* ism_mode == ISM_MODE_DISC */ + { + for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) + { + st_ivas->hSCE[ch]->hCoreCoder[0]->read_sid_info = 0; + } + st_ivas->hSCE[sce_id]->hCoreCoder[0]->read_sid_info = 1; + } + } + } +#else ivas_param_ism_metadata_dtx_dec( st_ivas ); +#endif + +#ifdef DISCRETE_ISM_DTX_CNG + set_s( md_diff_flag, 1, num_obj ); + //update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); // VE!!!!! + + st_ivas->ism_dtx_hangover_cnt = 0; + + if ( st_ivas->ism_mode != ISM_MODE_PARAM ) // VE!!!!! + { + /* set core_brate for all channels */ + for ( ch = 0; ch < num_obj; ch++ ) + { + st_ivas->hSCE[ch]->hCoreCoder[0]->core_brate = FRAME_NO_DATA; + } + + if ( ivas_total_brate == IVAS_SID_5k2 ) + { + st_ivas->hSCE[0]->hCoreCoder[0]->core_brate = SID_2k40; + } + } +#endif for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) { @@ -167,6 +230,15 @@ ivas_error ivas_ism_dtx_dec( ivas_ism_preprocessing( st_ivas, ch ); } } +#ifdef DISCRETE_ISM_DTX_CNG + else + { + for ( ch = 1; ch < st_ivas->nchan_transport; ch++ ) + { + nb_bits_metadata[ch] = nb_bits_metadata[0]; + } + } +#endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 94784e435c..814ccbffba 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -37,12 +37,95 @@ #include "ivas_rom_com.h" #include "prot.h" #include "ivas_stat_enc.h" +#ifdef DISCRETE_ISM_DTX_CNG +#include +#endif #ifdef DEBUGGING #include "debug.h" #endif #include "wmc_auto.h" +#ifdef DISCRETE_ISM_DTX_CNG +/*-------------------------------------------------------------------------* + * Local constants + *-------------------------------------------------------------------------*/ + +#define IVAS_ISM_DTX_HO_MAX 5 + +#define CNG_MD_MAX_DIFF_AZIMUTH 8 +#define CNG_MD_MAX_DIFF_ELEVATION 8 + + +/*-------------------------------------------------------------------* + * ism_metadata_smooth() + * + * Smooth the metadata evolution + *-------------------------------------------------------------------*/ + +static void ism_metadata_smooth( + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int16_t num_obj /* i : number of objects */ +) +{ + ISM_METADATA_HANDLE hIsmMetaData; + int16_t ch; + float diff; + + for ( ch = 0; ch < num_obj; ch++ ) + { + hIsmMetaData = hIsmMeta[ch]; + + /* smooth azimuth */ + diff = hIsmMetaData->last_true_azimuth - hIsmMetaData->last_azimuth; + + if ( diff > ISM_AZIMUTH_MAX ) + { + diff -= ( ISM_AZIMUTH_MAX - ISM_AZIMUTH_MIN ); + hIsmMetaData->last_azimuth += ( ISM_AZIMUTH_MAX - ISM_AZIMUTH_MIN ); + } + else if ( diff < ISM_AZIMUTH_MIN ) + { + diff += ( ISM_AZIMUTH_MAX - ISM_AZIMUTH_MIN ); + } + + if ( ism_total_brate > IVAS_SID_5k2 && fabsf( diff ) > IVAS_ISM_DTX_HO_MAX * CNG_MD_MAX_DIFF_AZIMUTH ) + { + /* skip the smoothing */ + } + else if ( fabsf( diff ) > CNG_MD_MAX_DIFF_AZIMUTH ) + { + hIsmMetaData->azimuth = hIsmMetaData->last_azimuth + sign( diff ) * CNG_MD_MAX_DIFF_AZIMUTH; + } + else if ( diff != 0 ) + { + hIsmMetaData->azimuth = hIsmMetaData->last_true_azimuth; + } + + if ( hIsmMetaData->azimuth > ISM_AZIMUTH_MAX ) + { + hIsmMetaData->azimuth -= ( ISM_AZIMUTH_MAX - ISM_AZIMUTH_MIN ); + } + + /* smooth elevation */ + diff = hIsmMetaData->last_true_elevation - hIsmMetaData->last_elevation; + + if ( ism_total_brate > IVAS_SID_5k2 && diff > IVAS_ISM_DTX_HO_MAX * CNG_MD_MAX_DIFF_ELEVATION ) + { + /* skip the smoothing */ + } + else if ( fabsf( diff ) > CNG_MD_MAX_DIFF_ELEVATION ) + { + hIsmMetaData->elevation = hIsmMetaData->last_elevation + sign( diff ) * CNG_MD_MAX_DIFF_ELEVATION; + } + } + + return; +} +#endif + + /*-------------------------------------------------------------------------* * ivas_ism_metadata_dec() * @@ -50,13 +133,16 @@ *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_dec( - const int32_t ism_total_brate, /* i : ISms total bitrate */ - int16_t *nchan_transport, /* o : number of transport channels */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ - const int16_t bfi, /* i : bfi flag */ - int16_t nb_bits_metadata[], /* o : number of metadata bits */ - ISM_MODE ism_mode, /* i : ISM mode */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ + int16_t *nchan_transport, /* o : number of transport channels */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ + const int16_t bfi, /* i : bfi flag */ + int16_t nb_bits_metadata[], /* o : number of metadata bits */ + ISM_MODE ism_mode, /* i : ISM mode */ +#ifdef DISCRETE_ISM_DTX_CNG + int16_t *ism_dtx_hangover_cnt, /* i/o: DTX hangover counter */ +#endif const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ ) { @@ -72,6 +158,9 @@ ivas_error ivas_ism_metadata_dec( int16_t localVAD[MAX_NUM_OBJECTS]; int16_t ism_imp[MAX_NUM_OBJECTS]; int16_t num_obj = 0, nbands, nblocks; +#ifdef DISCRETE_ISM_DTX_CNG + int16_t md_diff_flag[MAX_NUM_OBJECTS]; +#endif ivas_error error; error = IVAS_ERR_OK; @@ -359,6 +448,12 @@ ivas_error ivas_ism_metadata_dec( /* updates */ hIsmMetaData->last_azimuth_idx = idx_azimuth; hIsmMetaData->last_elevation_idx = idx_elevation; + +#ifdef DISCRETE_ISM_DTX_CNG + /* save for smoothing metadata evolution */ + hIsmMetaData->last_true_azimuth = hIsmMetaData->azimuth; + hIsmMetaData->last_true_elevation = hIsmMetaData->elevation; +#endif } /* save number of metadata bits read */ @@ -449,6 +544,14 @@ ivas_error ivas_ism_metadata_dec( } } +#ifdef DISCRETE_ISM_DTX_CNG + if ( *ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) + { + //ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); // VE!!!!! + } + *ism_dtx_hangover_cnt = min( ( *ism_dtx_hangover_cnt )++, IVAS_ISM_DTX_HO_MAX ); +#endif + /*----------------------------------------------------------------* * Configuration and decision about bitrates per channel *----------------------------------------------------------------*/ @@ -489,6 +592,10 @@ ivas_error ivas_ism_metadata_dec( } } + /*----------------------------------------------------------------* + * Set bitsream pointers + *----------------------------------------------------------------*/ + /* set the bitstream pointer to its original position */ st0->bit_stream = bstr_orig; st0->next_bit_pos = next_bit_pos_orig; @@ -499,6 +606,15 @@ ivas_error ivas_ism_metadata_dec( hSCE[ch]->hCoreCoder[0]->bit_stream = hSCE[ch - 1]->hCoreCoder[0]->bit_stream + ( hSCE[ch - 1]->hCoreCoder[0]->total_brate / FRAMES_PER_SEC ); } +#ifdef DISCRETE_ISM_DTX_CNG + /*----------------------------------------------------------------* + * Updates + *----------------------------------------------------------------*/ + + set_s( md_diff_flag, 1, num_obj ); + update_last_metadata( *nchan_transport, hIsmMeta, md_diff_flag ); +#endif + #ifdef PARAM_ISM_DTX_CNG for ( ch = 0; ch < *nchan_transport; ch++ ) { @@ -538,10 +654,291 @@ ivas_error create_ism_metadata_dec( st_ivas->hIsmMetaData[ch]->last_azimuth_idx = 0; st_ivas->hIsmMetaData[ch]->last_elevation_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); +#ifdef DISCRETE_ISM_DTX_CNG + st_ivas->hIsmMetaData[ch]->last_true_azimuth = 0; + st_ivas->hIsmMetaData[ch]->last_true_elevation = 0; +#endif + ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); +#ifdef DISCRETE_ISM_DTX_CNG + st_ivas->ism_dtx_hangover_cnt = IVAS_ISM_DTX_HO_MAX; +#endif + + return IVAS_ERR_OK; +} + + +#ifdef DISCRETE_ISM_DTX_CNG +/*-------------------------------------------------------------------* + * ivas_ism_dec_dequantize_DOA_dtx() + * + * + *-------------------------------------------------------------------*/ + +static void ivas_ism_dec_dequantize_DOA_dtx( + const int16_t azi_bits, + const int16_t ele_bits, + const int16_t azi_idx, + const int16_t ele_idx, + float *azi_val, + float *ele_val ) +{ + int16_t nbits, npoints, angle_spacing, az_alpha, ele_alpha, tmp_alpha; + + /* Step 1: Determine angle spacing/n_points based on minimum value among elevation/azimuth bits */ + nbits = min( azi_bits, ele_bits ); + + if ( nbits == ISM_ELEVATION_NBITS ) + { + angle_spacing = 5; + } + else + { + angle_spacing = (int16_t) ( ( 180.f / (float) ( 1 << nbits ) ) + 0.5f ); + } + + npoints = (int16_t) ( ( 90 / angle_spacing ) + 0.5f ); + + /* sanity check */ + if ( angle_spacing == 360 ) + { + assert( azi_idx == 0 ); + assert( ele_idx == 0 ); + + *azi_val = 0.f; + *ele_val = 0.f; + return; + } + + /* Get the azimuth and elevation values */ + ele_alpha = 2 * npoints - 1; + assert( ( 0 <= ele_idx ) && ( ele_idx < ele_alpha ) ); + *ele_val = (float) ( ( ele_idx - npoints ) * angle_spacing ); + + az_alpha = 4 * npoints - 1; + assert( ( 0 <= azi_idx ) && ( azi_idx < az_alpha ) ); + tmp_alpha = (int16_t) ( azi_idx * ( 360.f / az_alpha ) ); + + if ( tmp_alpha > 180.0f ) + { + *azi_val = ( (float) tmp_alpha ) - 360.0f; + } + else + { + *azi_val = (float) tmp_alpha; + } + + return; +} + + +/*-------------------------------------------------------------------* + * ivas_ism_metadata_sid_dec() + * + * Decode ISM metadata in SID frame + *-------------------------------------------------------------------*/ + +ivas_error ivas_ism_metadata_sid_dec( + SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int16_t bfi, /* i : bfi flag */ + const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels*/ + const ISM_MODE ism_mode, /* i : ISM mode */ + int16_t *flag_noisy_speech, /* o : noisy speech flag */ + int16_t *sce_id_dtx, /* o : SCE DTX ID */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + int16_t nb_bits_metadata[] /* o : number of metadata bits */ +) +{ + int16_t i, ch, nb_bits_start, last_bit_pos, low_res_q; + int16_t idx, idx_azimuth, idx_elevation; + int16_t nBits_azimuth, nBits_elevation, nBits_ener, nBits_coh, nBits_sce_id; + int16_t md_diff_flag[MAX_NUM_OBJECTS]; + ISM_MODE ism_mode_bstr; + DEC_CORE_HANDLE st0; + ISM_METADATA_HANDLE hIsmMetaData; + int16_t next_bit_pos_orig; + uint16_t bstr_meta[IVAS_SID_5k2 / FRAMES_PER_SEC], *bstr_orig; + + if ( ism_total_brate == FRAME_NO_DATA ) + { + ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); + + return IVAS_ERR_OK; + } + + /* initialization */ + st0 = hSCE[0]->hCoreCoder[0]; + + nb_bits_start = 0; + last_bit_pos = (int16_t) ( ( ism_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); + bstr_orig = st0->bit_stream; + next_bit_pos_orig = st0->next_bit_pos; + st0->next_bit_pos = 0; + + /* reverse the bitstream for easier reading of indices */ + for ( i = 0; i < min( MAX_BITS_METADATA, last_bit_pos ); i++ ) + { + bstr_meta[i] = st0->bit_stream[last_bit_pos - i]; + } + st0->bit_stream = bstr_meta; + st0->total_brate = ism_total_brate; /* needed for BER detection in get_next_indice() */ + + if ( !bfi ) + { + /* take into account padding bits as metadata bits to keep later bitrate checks valid */ + nb_bits_metadata[0] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; + + /*----------------------------------------------------------------* + * ISm common signaling + *----------------------------------------------------------------*/ + + /* number of objects was already read in ivas_ism_get_dtx_dec() */ + /* update the position in the bitstream */ + st0->next_bit_pos += num_obj; + + /* read SID metadata flag( one per object ) */ + for ( ch = 0; ch < num_obj; ch++ ) + { + md_diff_flag[ch] = get_next_indice( st0, 1 ); + } + + /*----------------------------------------------------------------* + * Set quantization bits based on the number of coded objects + *----------------------------------------------------------------*/ + + low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_ener, &nBits_coh, &nBits_sce_id ); + + /*----------------------------------------------------------------* + * Spatial parameters, loop over TCs - 1 + *----------------------------------------------------------------*/ + + *flag_noisy_speech = 0; + *sce_id_dtx = 0; + + /* write ISM mode flag to explicitly signal number of spatial parameters */ + if ( num_obj > 2 ) + { + idx = get_next_indice( st0, 1 ); + ism_mode_bstr = (ISM_MODE) ( idx + 1 ); + + if ( ism_mode_bstr != ism_mode ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\n!!! Error: Switching ISM mode in CNG not verified yet. Exiting.\n\n" ); + } + + if ( ism_mode_bstr == ISM_MODE_PARAM ) + { + /* read noisy speech flag */ + *flag_noisy_speech = get_next_indice( st0, 1 ); + } + } + + if ( nchan_transport > 1 ) + { + /* read sce id */ + *sce_id_dtx = get_next_indice( st0, nBits_sce_id ); + + /* decode the coherence */ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + if ( ch == *sce_id_dtx ) + { + hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = 1.0f; + continue; + } + + idx = get_next_indice( st0, nBits_coh ); + hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = (float) ( idx ) / (float) ( ( 1 << nBits_coh ) - 1 ); + } + } + else + { + *sce_id_dtx = 0; + } + + /*----------------------------------------------------------------* + * Metadata decoding and dequantization, loop over all objects + *----------------------------------------------------------------*/ + + for ( ch = 0; ch < num_obj; ch++ ) + { + hIsmMetaData = hIsmMeta[ch]; + + if ( md_diff_flag[ch] == 1 ) + { + if ( low_res_q ) + { + idx_azimuth = get_next_indice( st0, nBits_azimuth ); + idx_elevation = get_next_indice( st0, nBits_elevation ); + + ivas_ism_dec_dequantize_DOA_dtx( nBits_azimuth, nBits_elevation, idx_azimuth, idx_elevation, &( hIsmMetaData->azimuth ), &( hIsmMetaData->elevation ) ); + } + else + { + /* Azimuth decoding */ + idx_azimuth = get_next_indice( st0, nBits_azimuth ); + + /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ + if ( idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + { + idx_azimuth -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* +180° -> -180° */ + } + else if ( idx_azimuth < 0 ) + { + idx_azimuth += ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* -180° -> +180° */ + } + + /* +180° == -180° */ + if ( idx_azimuth == ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + { + idx_azimuth = 0; + } + + /* sanity check in case of FER or BER */ + if ( idx_azimuth < 0 || idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + { + idx_azimuth = hIsmMetaData->last_azimuth_idx; + } + + hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); + + /* Elevation decoding */ + idx_elevation = get_next_indice( st0, nBits_elevation ); + + /* sanity check in case of FER or BER */ + if ( idx_elevation < 0 || idx_elevation > ( 1 << ISM_ELEVATION_NBITS ) - 1 ) + { + idx_elevation = hIsmMetaData->last_elevation_idx; + } + + /* Elevation dequantization */ + hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); + } + + // VE: ToDo: this would not work well for switching from low_res_q to active frame coding + hIsmMetaData->last_azimuth_idx = idx_azimuth; + hIsmMetaData->last_elevation_idx = idx_elevation; + + /* save for smoothing metadata evolution */ + hIsmMetaData->last_true_azimuth = hIsmMetaData->azimuth; + hIsmMetaData->last_true_elevation = hIsmMetaData->elevation; + } + } + + /* set the bitstream pointer to its original position */ + st0->bit_stream = bstr_orig; + st0->next_bit_pos = next_bit_pos_orig; + } + + /* smooth the metadata evolution */ + ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); + return IVAS_ERR_OK; } +#endif diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index a09c0bb4e7..cdf6cbb875 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -82,6 +82,23 @@ ivas_error ivas_sce_dec( { st->cng_type = FD_CNG; /* TODO: move to init if possible */ } + +#ifdef DISCRETE_ISM_DTX_CNG + // VE!!!!! + if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_DISC && st_ivas->nchan_transport > 1 ) // VE!!!!! keep bitexactness for 1ISM case for now + { + if ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) + { + /* reset the bitstream to at least read the cng type and bandwidth for non transmitted SCE */ + st->bit_stream = st_ivas->hSCE[0]->hCoreCoder[0]->bit_stream; + st->cng_paramISM_flag = 1; + } + else + { + st->cng_paramISM_flag = 0; + } + } +#endif #endif /*------------------------------------------------------------------* @@ -98,6 +115,12 @@ ivas_error ivas_sce_dec( { st->total_brate = ivas_total_brate; } +#ifdef DISCRETE_ISM_DTX_CNG + else if ( !st_ivas->bfi && st_ivas->ivas_format != ISM_FORMAT && last_ivas_total_brate <= IVAS_SID_5k2 ) + { + st->total_brate = hSCE->element_brate - nb_bits_metadata * FRAMES_PER_SEC; + } +#else else if ( !st_ivas->bfi && ( last_ivas_total_brate <= SID_2k40 || last_ivas_total_brate == IVAS_SID_5k2 ) ) { #ifdef PARAM_ISM_DTX_CNG @@ -110,6 +133,7 @@ ivas_error ivas_sce_dec( st->total_brate = hSCE->element_brate - nb_bits_metadata * FRAMES_PER_SEC; #endif } +#endif /* read the bandwidth */ if ( st_ivas->bfi || st->total_brate <= SID_2k40 ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 3d9ed18351..3b0e99c4c2 100755 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1968,6 +1968,9 @@ typedef struct Decoder_Struct int16_t sba_planar; /* Ambisonic (SBA) planar flag */ int16_t sba_analysis_order; /* Ambisonic (SBA) order used for analysis and coding */ int16_t sba_dirac_stereo_flag; /* flag indicating stereo output for SBA DirAC modes with 1 TC */ +#ifdef DISCRETE_ISM_DTX_CNG + int16_t ism_dtx_hangover_cnt; /* hangover counter for ISM DTX decoder */ +#endif /* rendering modules */ RENDERER_TYPE renderer_type; /* renderer type */ diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index ab531bc291..fa652d1a07 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -41,7 +41,17 @@ #endif #include "wmc_auto.h" + #ifdef PARAM_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG +/*-----------------------------------------------------------------------* + * Local constants + *-----------------------------------------------------------------------*/ + +#define MD_MAX_DIFF_AZIMUTH 15 +#define MD_MAX_DIFF_ELEVATION 15 +#endif + /*-------------------------------------------------------------------* * ivas_ism_dtx_open() @@ -67,6 +77,9 @@ ivas_error ivas_ism_dtx_open( hISMDTX->dtx_flag = 0; hISMDTX->sce_id_dtx = 0; +#ifdef DISCRETE_ISM_DTX_CNG + hISMDTX->cnt_SID_ISM = -1; +#endif set_s( hISMDTX->dtx_speech_buffer_enc, 0, PARAM_ISM_HYS_BUF_SIZE ); @@ -83,6 +96,187 @@ ivas_error ivas_ism_dtx_open( } +#ifdef DISCRETE_ISM_DTX_CNG +/*-------------------------------------------------------------------* + * ivas_ism_get_dtx_enc() + * + * Analysis and decision about DTX in ISM format + *-------------------------------------------------------------------*/ + +/*! r: indication of DTX frame */ +int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + int16_t md_diff_flag[], /* o : metadata differential flag */ + int16_t *sid_flag /* o : indication of SID frame */ +) +{ + int16_t ch, dtx_flag; + int16_t nBits, nBits_MD_max; + int16_t nBits_azimuth, nBits_elevation, nBits_ener, nBits_coh, nBits_sce_id; + float lp_noise[MAX_NUM_OBJECTS], lp_noise_variation, lp_noise_mean; + + /*------------------------------------------------------------------* + * compute global ISM DTX flag + *-----------------------------------------------------------------*/ + + /* compute global ISM based on localVAD */ + dtx_flag = 1; + for ( ch = 0; ch < num_obj; ch++ ) + { + dtx_flag &= !vad_flag[ch]; + } + + /* compute global ISM based on long-term background noise */ + /* one of the channels is active -> no DTX */ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + lp_noise[ch] = hSCE[ch]->hCoreCoder[0]->lp_noise; + } + + lp_noise_variation = var( lp_noise, num_obj ); + lp_noise_mean = mean( lp_noise, num_obj ); + + if ( lp_noise_mean > 50 || ( lp_noise_mean > 10 && lp_noise_variation > 2 ) ) + { + // dtx_flag = 0; // VE!!!!! + } + + /*------------------------------------------------------------------* + * Reset the bitstream + *-----------------------------------------------------------------*/ + + if ( dtx_flag ) + { + /* reset the bitstream (IVAS format signaling was already written) */ + reset_indices_enc( hSCE[0]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); + } + + /*------------------------------------------------------------------* + * decide about SID metadata to be sent or not (per object) + * estimate the MD bit-budget consumption + *-----------------------------------------------------------------*/ + + if ( dtx_flag ) + { + ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_ener, &nBits_coh, &nBits_sce_id ); + + nBits = 0; + for ( ch = 0; ch < num_obj; ch++ ) + { + /* check difference between current and last metadata */ + md_diff_flag[ch] = 0; + if ( fabsf( hIsmMeta[ch]->azimuth - hIsmMeta[ch]->last_azimuth ) > MD_MAX_DIFF_AZIMUTH ) + { + md_diff_flag[ch] = 1; + } + + if ( fabsf( hIsmMeta[ch]->elevation - hIsmMeta[ch]->last_elevation ) > MD_MAX_DIFF_ELEVATION ) + { + md_diff_flag[ch] = 1; + } + + /* estimate SID metadata bit-budget */ + nBits++; /* number of objects */ + nBits++; /* SID metadata flag */ + if ( md_diff_flag[ch] == 1 ) + { + nBits += nBits_azimuth; + nBits += nBits_elevation; + } + } + + /* calculate maximum available MD bit-budget */ + nBits_MD_max = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; + nBits_MD_max -= SID_FORMAT_NBITS; + if ( nchan_transport > 1 ) + { + nBits_MD_max -= nBits_sce_id; + } + + for ( ch = 0; ch < nchan_transport - 1; ch++ ) + { + nBits_MD_max -= nBits_coh; /* coherence */ + } + + if ( num_obj > 3 ) + { + nBits_MD_max--; /* ism_mode flag */ + } + + /* too many metadata bits -> switch to active coding */ + if ( nBits > nBits_MD_max ) + { + dtx_flag = 0; + } + } + + /*------------------------------------------------------------------* + * set core_brate for all channels + * get 'sid_flag' value + *-----------------------------------------------------------------*/ + + *sid_flag = 0; + + if ( !dtx_flag ) + { + /* at least one of the channels is active -> no DTX */ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + hSCE[ch]->hCoreCoder[0]->core_brate = -1; + } + + hISMDTX->cnt_SID_ISM = -1; + + /* IVAS format signaling was erased in dtx() */ + if ( hSCE[0]->hCoreCoder[0]->hBstr->nb_bits_tot == 0 ) + { + push_indice( hSCE[0]->hCoreCoder[0]->hBstr, IND_IVAS_FORMAT, 2 /* == ISM format */, IVAS_FORMAT_SIGNALING_NBITS ); + } + } + else /* ism_dtx_flag == 1 */ + { + for ( ch = 0; ch < num_obj; ch++ ) + { + hSCE[ch]->hCoreCoder[0]->cng_type = FD_CNG; + } + + /* * update the global SID counter */ + hISMDTX->cnt_SID_ISM++; + if ( hISMDTX->cnt_SID_ISM >= hSCE[0]->hCoreCoder[0]->hDtxEnc->max_SID ) + { + /* adaptive SID update interval */ + hSCE[0]->hCoreCoder[0]->hDtxEnc->max_SID = hSCE[0]->hCoreCoder[0]->hDtxEnc->interval_SID; + hISMDTX->cnt_SID_ISM = 0; + } + + /* encode SID in one channel only */ + for ( ch = 0; ch < num_obj; ch++ ) + { + hSCE[ch]->hCoreCoder[0]->core_brate = FRAME_NO_DATA; + } + + if ( hISMDTX->cnt_SID_ISM == 0 ) + { + hSCE[hISMDTX->sce_id_dtx]->hCoreCoder[0]->core_brate = SID_2k40; + *sid_flag = 1; + } + } + + if ( dtx_flag == 1 && *sid_flag == 0 ) + { + set_s( md_diff_flag, 0, num_obj ); + } + + return dtx_flag; +} +#endif + + /*-------------------------------------------------------------------* * ivas_ism_dtx_enc() * diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 9f9637d95e..43268069ca 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -87,7 +87,12 @@ ivas_error ivas_ism_enc( int16_t localVAD_HE_SAD[1]; /* local HE VAD */ int16_t i, nBits; #ifdef PARAM_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG + int16_t num_obj, dtx_flag, sid_flag; + int16_t md_diff_flag[MAX_NUM_OBJECTS]; +#else int16_t dtx_flag, sid_flag; +#endif #endif ivas_error error; @@ -102,6 +107,19 @@ ivas_error ivas_ism_enc( #ifdef PARAM_ISM_DTX_CNG dtx_flag = 0; sid_flag = 0; + +#ifdef DISCRETE_ISM_DTX_CNG + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + num_obj = st_ivas->hDirAC->hParamIsm->num_obj; + } + else /* ism_mode == ISM_MODE_DISC */ + { + num_obj = st_ivas->nchan_transport; + } + + set_s( md_diff_flag, 1, num_obj ); +#endif #endif /*------------------------------------------------------------------* @@ -184,13 +202,24 @@ ivas_error ivas_ism_enc( * DTX analysis *-----------------------------------------------------------------*/ +#ifdef DISCRETE_ISM_DTX_CNG + if ( st_ivas->hEncoderConfig->Opt_DTX_ON && num_obj > 1 ) // VE!!!!! keep bitexactness for 1ISM case for now +#else if ( st_ivas->hEncoderConfig->Opt_DTX_ON && st_ivas->ism_mode == ISM_MODE_PARAM ) +#endif { /* compute the dominant sce_id using long term energy */ ivas_ism_get_sce_id_dtx( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->nchan_transport, input_frame ); /* analysis and decision about DTX */ - dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); +#ifdef DISCRETE_ISM_DTX_CNG + if ( st_ivas->ism_mode != ISM_MODE_PARAM ) + { + dtx_flag = ivas_ism_dtx_enc_COMMON( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); + } + else +#endif + dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); if ( sid_flag ) { @@ -199,7 +228,7 @@ ivas_error ivas_ism_enc( } #ifdef DEBUG_MODE_PARAM_ISM - dbgwrite( &( st_ivas->hISMDTX->flag_noisy_speech ), sizeof( int16_t ), 1, 1, "./res/ParamISM_noisy_speech_flag_enc.dat" ); + dbgwrite( &( st_ivas->hDirAC->hParamIsm->flag_noisy_speech ), sizeof( int16_t ), 1, 1, "./res/ParamISM_noisy_speech_flag_enc.dat" ); dbgwrite( &( st_ivas->hISMDTX->dtx_flag ), sizeof( int16_t ), 1, 1, "./res/ParamISM_DTX_CNG_flag_enc.dat" ); #endif } @@ -218,7 +247,14 @@ ivas_error ivas_ism_enc( if ( dtx_flag ) { - if ( sid_flag ) +#ifdef DISCRETE_ISM_DTX_CNG + if ( st_ivas->ism_mode != ISM_MODE_PARAM ) + { + ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm->flag_noisy_speech, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); + } + else +#endif + if ( sid_flag ) { ivas_param_ism_metadata_dtx_enc( st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, st_ivas->hIsmMetaData, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ); } @@ -265,6 +301,10 @@ ivas_error ivas_ism_enc( ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL ); } +#ifdef DISCRETE_ISM_DTX_CNG + update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); +#endif + /*----------------------------------------------------------------* * Write IVAS format signaling in SID frames *----------------------------------------------------------------*/ @@ -276,7 +316,11 @@ ivas_error ivas_ism_enc( ivas_write_format_sid( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr ); #ifdef PARAM_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG + if ( num_obj == 1 ) // VE!!!!! keep bitexactness for 1ISM case for now +#else if ( st_ivas->ism_mode != ISM_MODE_PARAM ) +#endif #endif { /* write unused bits */ diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 9aaa3af4b4..c06eeb9b86 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -764,9 +764,222 @@ ivas_error create_ism_metadata_enc( st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0; ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); + +#ifdef DISCRETE_ISM_DTX_CNG + st_ivas->hIsmMetaData[ch]->last_azimuth = 0.0f; + st_ivas->hIsmMetaData[ch]->last_elevation = 0.0f; +#endif } ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); return IVAS_ERR_OK; } + + +#ifdef DISCRETE_ISM_DTX_CNG +/*-------------------------------------------------------------------* + * ivas_ism_quantize_DOA_dtx() + * + * + *-------------------------------------------------------------------*/ + +static void ivas_ism_quantize_DOA_dtx( + const float azimuth, + const float elevation, + const int16_t azi_bits, + const int16_t ele_bits, + int16_t *azi_idx, + int16_t *ele_idx ) +{ + int16_t nbits, npoints, angle_spacing, az_alpha, ele_alpha; + float azi_val; + + /* Step 1: Determine angle spacing/n_points based on minimum value among elevation/azimuth bits */ + nbits = min( azi_bits, ele_bits ); + + if ( nbits == ISM_ELEVATION_NBITS ) + { + angle_spacing = 5; + } + else + { + angle_spacing = (int16_t) ( ( 180.f / (float) ( 1 << nbits ) ) + 0.5f ); + } + + npoints = (int16_t) ( ( 90 / angle_spacing ) + 0.5f ); + + /* Step 2: Quantize Elevation */ + ele_alpha = 2 * npoints - 1; + *ele_idx = (int16_t) ( ( elevation / angle_spacing ) + 0.5f ) + npoints; + if ( *ele_idx >= ele_alpha ) + { + *ele_idx = ele_alpha - 1; + } + assert( ( 0 <= *ele_idx ) && ( *ele_idx < ele_alpha ) ); + + /* Step 3: Quantize Azimuth */ + az_alpha = 4 * npoints - 1; + + /* Convert azimuth in {-180,180} into {0,360} before quantization */ + if ( azimuth >= 0 ) + { + azi_val = azimuth; + } + else + { + azi_val = azimuth + 360.f; + } + + /* Obtain the index of quantized azimuth values */ + *azi_idx = (int16_t) ( ( ( azi_val / 360.f ) * az_alpha ) + 0.5f ); + if ( *azi_idx == az_alpha ) + { + /*wrap around the azimuth angle*/ + *azi_idx = 0; + } + assert( ( 0 <= *azi_idx ) && ( *azi_idx < az_alpha ) ); + + return; +} + + +/*-------------------------------------------------------------------* + * ivas_ism_metadata_sid_enc() + * + * Quantize and encode ISM metadata in SID frame + *-------------------------------------------------------------------*/ + +void ivas_ism_metadata_sid_enc( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + const int16_t flag_noisy_speech, /* i : noisy speech flag */ + const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + const ISM_MODE ism_mode, /* i : ISM mode */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t sid_flag, /* i : indication of SID frame */ + const int16_t md_diff_flag[], /* i : metadata differental flag */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + int16_t nb_bits_metadata[] /* o : number of metadata bits */ +) +{ + int16_t i, ch, nBits, nBits_start, nBits_unused, low_res_q; + int16_t idx, idx_azimuth, idx_elevation; + int16_t nBits_azimuth, nBits_elevation, nBits_ener, nBits_coh, nBits_sce_id; + float valQ; + ISM_METADATA_HANDLE hIsmMetaData; + + if ( sid_flag ) + { + nBits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; + nBits -= SID_FORMAT_NBITS; + nBits_start = hBstr->nb_bits_tot; + + /*----------------------------------------------------------------* + * Write ISm common signaling + *----------------------------------------------------------------*/ + + /* write number of objects - unary coding */ + for ( ch = 1; ch < num_obj; ch++ ) + { + push_indice( hBstr, IND_ISM_NUM_OBJECTS, 1, 1 ); + } + push_indice( hBstr, IND_ISM_NUM_OBJECTS, 0, 1 ); + + /* write SID metadata flag (one per object) */ + for ( ch = 0; ch < num_obj; ch++ ) + { + push_indice( hBstr, IND_ISM_METADATA_FLAG, md_diff_flag[ch], 1 ); + } + + /*----------------------------------------------------------------* + * Set quantization bits based on the number of coded objects + *----------------------------------------------------------------*/ + + low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_ener, &nBits_coh, &nBits_sce_id ); + + /*----------------------------------------------------------------* + * Spatial parameters, loop over TCs - 1 + *----------------------------------------------------------------*/ + + /* write ISM mode flag to explicitly signal number of spatial parameters */ + if ( num_obj > 2 ) + { + if ( ism_mode == ISM_MODE_DISC ) + { + push_indice( hBstr, IND_ISM_VAD_FLAG, 0, 1 ); + } + else + { + push_indice( hBstr, IND_ISM_VAD_FLAG, 1, 1 ); + } + + if ( ism_mode == ISM_MODE_PARAM ) + { + /* write noisy speech flag */ + push_indice( hBstr, IND_ISM_NOISY_SPEECH_FLAG, flag_noisy_speech, 1 ); + } + } + + if ( nchan_transport > 1 ) + { + /* write sce id */ + push_indice( hBstr, IND_ISM_SCE_ID_DTX, hISMDTX->sce_id_dtx, nBits_sce_id ); + + /* quantize and write coherence */ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + if ( ch == hISMDTX->sce_id_dtx ) + { + continue; + } + + idx = (int16_t) ( hISMDTX->coh[ch] * ( ( 1 << nBits_coh ) - 1 ) + 0.5f ); + assert( ( idx >= 0 ) && ( idx <= ( ( 1 << nBits_coh ) - 1 ) ) ); + push_indice( hBstr, IND_ISM_DTX_COH_SCA, idx, nBits_coh ); + } + } + + /*----------------------------------------------------------------* + * Metadata quantization and coding, loop over all objects + *----------------------------------------------------------------*/ + + for ( ch = 0; ch < num_obj; ch++ ) + { + if ( md_diff_flag[ch] == 1 ) + { + hIsmMetaData = hIsmMeta[ch]; + + if ( low_res_q ) + { + ivas_ism_quantize_DOA_dtx( hIsmMetaData->azimuth, hIsmMetaData->elevation, nBits_azimuth, nBits_elevation, &idx_azimuth, &idx_elevation ); + } + else + { + idx_azimuth = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); + idx_elevation = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); + } + + push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, nBits_azimuth ); + push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, nBits_elevation ); + + hIsmMetaData->last_azimuth_idx = idx_azimuth; + hIsmMetaData->last_elevation_idx = idx_elevation; + } + } + + /* Write unused (padding) bits */ + nBits_unused = nBits - hBstr->nb_bits_tot; + while ( nBits_unused > 0 ) + { + i = min( nBits_unused, 16 ); + push_indice( hBstr, IND_UNUSED, 0, i ); + nBits_unused -= i; + } + + nb_bits_metadata[0] = hBstr->nb_bits_tot - nBits_start; + } + + return; +} +#endif diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 1f88d0c0c1..69125f91c3 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -561,6 +561,9 @@ typedef struct int16_t dtx_flag; int16_t sce_id_dtx; +#ifdef DISCRETE_ISM_DTX_CNG + int16_t cnt_SID_ISM; +#endif // VE!!!!! int16_t dtx_speech_buffer_enc[PARAM_ISM_HYS_BUF_SIZE]; float long_term_energy_stereo_dmx_enc[MAX_NUM_OBJECTS][PARAM_ISM_HYS_BUF_SIZE]; -- GitLab From 69f3add690f863e64f1ce780f74cab24a94d4038 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 17 Feb 2023 13:06:09 +0100 Subject: [PATCH 073/375] fixes to DiscISM DTX - first ~working version (tested 4ISMs with MD) --- lib_dec/ivas_init_dec.c | 2 +- lib_enc/ivas_init_enc.c | 4 ++++ lib_enc/ivas_ism_dtx_enc.c | 4 ++++ lib_enc/ivas_ism_enc.c | 15 ++++++++++++--- lib_enc/lib_enc.c | 17 +++++++++++------ 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 86fdf65309..cdd724cc2d 100755 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -427,7 +427,7 @@ static ivas_error ivas_read_format( break; case SID_ISM: st_ivas->ivas_format = ISM_FORMAT; -#ifndef DISCRETE_ISM_DTX +#ifndef DISCRETE_ISM_DTX_CNG #ifdef PARAM_ISM_DTX_CNG if ( st_ivas->ism_mode == ISM_MODE_DISC ) { diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 8995ebe92a..9301f43d80 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -443,7 +443,11 @@ ivas_error ivas_init_encoder( } #ifdef PARAM_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG + if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) +#else if ( st_ivas->hEncoderConfig->Opt_DTX_ON && st_ivas->ism_mode == ISM_MODE_PARAM ) +#endif { if ( ( error = ivas_ism_dtx_open( st_ivas ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index fa652d1a07..63e94c8ff9 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -486,7 +486,11 @@ void ivas_ism_coh_estim_dtx_enc( { Encoder_State *st, *st_id0; int16_t sce_id, i; +#ifdef DISCRETE_ISM_DTX_CNG + float acorr_ene[MAX_NUM_OBJECTS], xcorr_ene; +#else float acorr_ene[PARAM_ISM_MAX_DMX], xcorr_ene; +#endif if ( nchan_transport == 1 ) { diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 43268069ca..845c123d56 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -88,7 +88,7 @@ ivas_error ivas_ism_enc( int16_t i, nBits; #ifdef PARAM_ISM_DTX_CNG #ifdef DISCRETE_ISM_DTX_CNG - int16_t num_obj, dtx_flag, sid_flag; + int16_t num_obj, dtx_flag, sid_flag, flag_noisy_speech; int16_t md_diff_flag[MAX_NUM_OBJECTS]; #else int16_t dtx_flag, sid_flag; @@ -107,6 +107,7 @@ ivas_error ivas_ism_enc( #ifdef PARAM_ISM_DTX_CNG dtx_flag = 0; sid_flag = 0; + flag_noisy_speech = 0; #ifdef DISCRETE_ISM_DTX_CNG if ( st_ivas->ism_mode == ISM_MODE_PARAM ) @@ -228,7 +229,8 @@ ivas_error ivas_ism_enc( } #ifdef DEBUG_MODE_PARAM_ISM - dbgwrite( &( st_ivas->hDirAC->hParamIsm->flag_noisy_speech ), sizeof( int16_t ), 1, 1, "./res/ParamISM_noisy_speech_flag_enc.dat" ); + if ( st_ivas->hDirAC != NULL ) + dbgwrite( &( st_ivas->hDirAC->hParamIsm->flag_noisy_speech ), sizeof( int16_t ), 1, 1, "./res/ParamISM_noisy_speech_flag_enc.dat" ); dbgwrite( &( st_ivas->hISMDTX->dtx_flag ), sizeof( int16_t ), 1, 1, "./res/ParamISM_DTX_CNG_flag_enc.dat" ); #endif } @@ -243,6 +245,9 @@ ivas_error ivas_ism_enc( if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { ivas_param_ism_compute_noisy_speech_flag( st_ivas ); +#ifdef DISCRETE_ISM_DTX_CNG + flag_noisy_speech = st_ivas->hDirAC->hParamIsm->flag_noisy_speech; +#endif } if ( dtx_flag ) @@ -250,7 +255,7 @@ ivas_error ivas_ism_enc( #ifdef DISCRETE_ISM_DTX_CNG if ( st_ivas->ism_mode != ISM_MODE_PARAM ) { - ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm->flag_noisy_speech, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); + ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, flag_noisy_speech, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); } else #endif @@ -311,7 +316,11 @@ ivas_error ivas_ism_enc( st = st_ivas->hSCE[0]->hCoreCoder[0]; +#ifdef DISCRETE_ISM_DTX_CNG + if ( st->core_brate == SID_2k40 || sid_flag ) // VE!!!!! to be simplified +#else if ( st->core_brate == SID_2k40 ) +#endif { ivas_write_format_sid( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr ); diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 33f1d02437..613d6063c2 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -875,12 +875,15 @@ static ivas_error configureEncoder( #ifdef PARAM_ISM_DTX_CNG if ( hEncoderConfig->Opt_DTX_ON && hEncoderConfig->ivas_format != MONO_FORMAT && - ( ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp == 2 ) || // ToDo: see Issue 113 - ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp > 2 && hEncoderConfig->ivas_total_brate != IVAS_24k4 && hEncoderConfig->ivas_total_brate != IVAS_32k ) || // ParamISM - ( hEncoderConfig->ivas_format == MASA_FORMAT && hEncoderConfig->ivas_total_brate > IVAS_128k ) || // ToDo: remove the bitrate limitation - ( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_get_sba_num_TCs( hEncoderConfig->ivas_total_brate, 1 ) > 2 ) || // ToDo: support for 3+ TCs to be done - hEncoderConfig->ivas_format == MC_FORMAT // ToDo: TBD - ) ) + ( +#ifndef DISCRETE_ISM_DTX_CNG + ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp == 2 ) || // ToDo: see Issue 113 + ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp > 2 && hEncoderConfig->ivas_total_brate != IVAS_24k4 && hEncoderConfig->ivas_total_brate != IVAS_32k ) || // ParamISM +#endif + ( hEncoderConfig->ivas_format == MASA_FORMAT && hEncoderConfig->ivas_total_brate > IVAS_128k ) || // ToDo: remove the bitrate limitation + ( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_get_sba_num_TCs( hEncoderConfig->ivas_total_brate, 1 ) > 2 ) || // ToDo: support for 3+ TCs to be done + hEncoderConfig->ivas_format == MC_FORMAT // ToDo: TBD + ) ) #else if ( hEncoderConfig->Opt_DTX_ON && hEncoderConfig->ivas_format != MONO_FORMAT && ( ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp > 1 ) || // ToDo: see Issue 113 @@ -919,11 +922,13 @@ static ivas_error configureEncoder( return error; } +#ifndef DISCRETE_ISM_DTX_CNG #ifdef PARAM_ISM_DTX_CNG if ( hEncoderConfig->Opt_DTX_ON && ( hEncoderConfig->ivas_format == ISM_FORMAT ) && !( st_ivas->ism_mode == ISM_MODE_DISC && hEncoderConfig->nchan_inp == 1 ) && !( st_ivas->ism_mode == ISM_MODE_PARAM && ( hEncoderConfig->nchan_inp == 3 || hEncoderConfig->nchan_inp == 4 ) ) ) { return IVAS_ERROR( IVAS_ERR_UNKNOWN, "DTX is not supported in this IVAS format and element mode." ); } +#endif #endif if ( hEncoderConfig->ivas_format == MONO_FORMAT ) -- GitLab From d7729af74c8ffab709cb0fb5ff83921f466184d1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 17 Feb 2023 13:09:20 +0100 Subject: [PATCH 074/375] comments --- lib_dec/ivas_init_dec.c | 2 +- lib_dec/ivas_ism_dtx_dec.c | 2 +- lib_enc/ivas_ism_enc.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index cdd724cc2d..49434654bd 100755 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -245,7 +245,7 @@ ivas_error ivas_dec_setup( case SID_MDCT_STEREO: st_ivas->element_mode_init = IVAS_CPE_MDCT; break; -#ifdef DISCRETE_ISM_DTX +#ifdef DISCRETE_ISM_DTX_CNG case SID_ISM: st_ivas->element_mode_init = IVAS_SCE; break; diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index b040b93ac8..cc8d60254b 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -157,7 +157,7 @@ ivas_error ivas_ism_dtx_dec( } /* Metadata decoding and dequantization */ -#ifdef DISCRETE_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG // VE!!!!! to be harmonized #if 1 if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 845c123d56..e6dd7d0fba 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -213,7 +213,7 @@ ivas_error ivas_ism_enc( ivas_ism_get_sce_id_dtx( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->nchan_transport, input_frame ); /* analysis and decision about DTX */ -#ifdef DISCRETE_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG // VE!!!!! to be harmonized if ( st_ivas->ism_mode != ISM_MODE_PARAM ) { dtx_flag = ivas_ism_dtx_enc_COMMON( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); @@ -252,7 +252,7 @@ ivas_error ivas_ism_enc( if ( dtx_flag ) { -#ifdef DISCRETE_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG // VE!!!!! to be harmonized if ( st_ivas->ism_mode != ISM_MODE_PARAM ) { ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, flag_noisy_speech, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); -- GitLab From dcc1b70f1328b9d63a414e6a58499f75f39bc180 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Feb 2023 14:44:44 +0100 Subject: [PATCH 075/375] - harmonize MD quantization and coding - temporary switches MD_Q_PARAM_BE and MD_SMOOTH_PARAM_BE to keep ParamISM BE for the moment --- lib_com/ivas_cnst.h | 12 +- lib_com/ivas_ism_config.c | 4 - lib_com/ivas_prot.h | 13 +- lib_com/options.h | 4 +- lib_com/prot.h | 2 +- lib_dec/fd_cng_dec.c | 4 +- lib_dec/ivas_ism_dtx_dec.c | 55 ++-- lib_dec/ivas_ism_metadata_dec.c | 34 +- lib_dec/ivas_ism_param_dec.c | 3 +- lib_enc/ivas_ism_dtx_enc.c | 23 +- lib_enc/ivas_ism_enc.c | 26 +- lib_enc/ivas_ism_metadata_enc.c | 14 +- lib_enc/ivas_ism_param_enc.c | 3 +- scripts/config/self_test.prm | 345 +++++++++++---------- scripts/testv/stv_IVASMASA_1dir1TC.met | 3 - scripts/testv/stv_IVASMASA_1dir1TC.pcm | 3 - scripts/testv/stv_IVASMASA_1dir1TC_DTX.met | 3 - scripts/testv/stv_IVASMASA_1dir1TC_DTX.pcm | 3 - scripts/testv/stv_IVASMASA_1dir2TC.met | 3 - scripts/testv/stv_IVASMASA_1dir2TC.pcm | 3 - scripts/testv/stv_IVASMASA_1dir2TC_DTX.met | 3 - scripts/testv/stv_IVASMASA_1dir2TC_DTX.pcm | 3 - scripts/testv/stv_IVASMASA_2dir1TC.met | 3 - scripts/testv/stv_IVASMASA_2dir1TC.pcm | 3 - scripts/testv/stv_IVASMASA_2dir2TC.met | 3 - scripts/testv/stv_IVASMASA_2dir2TC.pcm | 3 - scripts/testv/test_FOA.wav | 3 - scripts/testv/test_HOA2.wav | 3 - scripts/testv/test_HOA3.wav | 3 - scripts/testv/test_ISM_1obj.wav | 3 - scripts/testv/test_ISM_2obj.wav | 3 - scripts/testv/test_ISM_3obj.wav | 3 - scripts/testv/test_ISM_4obj.wav | 3 - scripts/testv/test_MASA_1dir1TC.met | 3 - scripts/testv/test_MASA_1dir1TC.wav | 3 - scripts/testv/test_MASA_1dir2TC.met | 3 - scripts/testv/test_MASA_1dir2TC.wav | 3 - scripts/testv/test_MASA_2dir1TC.met | 3 - scripts/testv/test_MASA_2dir1TC.wav | 3 - scripts/testv/test_MASA_2dir2TC.met | 3 - scripts/testv/test_MASA_2dir2TC.wav | 3 - scripts/testv/test_MC51.wav | 3 - scripts/testv/test_MC51p2.wav | 3 - scripts/testv/test_MC51p4.wav | 3 - scripts/testv/test_MC71.wav | 3 - scripts/testv/test_MC71p4.wav | 3 - scripts/testv/test_mono.wav | 3 - scripts/testv/test_stereo.wav | 3 - 48 files changed, 303 insertions(+), 341 deletions(-) delete mode 100644 scripts/testv/stv_IVASMASA_1dir1TC.met delete mode 100644 scripts/testv/stv_IVASMASA_1dir1TC.pcm delete mode 100644 scripts/testv/stv_IVASMASA_1dir1TC_DTX.met delete mode 100644 scripts/testv/stv_IVASMASA_1dir1TC_DTX.pcm delete mode 100644 scripts/testv/stv_IVASMASA_1dir2TC.met delete mode 100644 scripts/testv/stv_IVASMASA_1dir2TC.pcm delete mode 100644 scripts/testv/stv_IVASMASA_1dir2TC_DTX.met delete mode 100644 scripts/testv/stv_IVASMASA_1dir2TC_DTX.pcm delete mode 100644 scripts/testv/stv_IVASMASA_2dir1TC.met delete mode 100644 scripts/testv/stv_IVASMASA_2dir1TC.pcm delete mode 100644 scripts/testv/stv_IVASMASA_2dir2TC.met delete mode 100644 scripts/testv/stv_IVASMASA_2dir2TC.pcm delete mode 100644 scripts/testv/test_FOA.wav delete mode 100644 scripts/testv/test_HOA2.wav delete mode 100644 scripts/testv/test_HOA3.wav delete mode 100644 scripts/testv/test_ISM_1obj.wav delete mode 100644 scripts/testv/test_ISM_2obj.wav delete mode 100644 scripts/testv/test_ISM_3obj.wav delete mode 100644 scripts/testv/test_ISM_4obj.wav delete mode 100644 scripts/testv/test_MASA_1dir1TC.met delete mode 100644 scripts/testv/test_MASA_1dir1TC.wav delete mode 100644 scripts/testv/test_MASA_1dir2TC.met delete mode 100644 scripts/testv/test_MASA_1dir2TC.wav delete mode 100644 scripts/testv/test_MASA_2dir1TC.met delete mode 100644 scripts/testv/test_MASA_2dir1TC.wav delete mode 100644 scripts/testv/test_MASA_2dir2TC.met delete mode 100644 scripts/testv/test_MASA_2dir2TC.wav delete mode 100644 scripts/testv/test_MC51.wav delete mode 100644 scripts/testv/test_MC51p2.wav delete mode 100644 scripts/testv/test_MC51p4.wav delete mode 100644 scripts/testv/test_MC71.wav delete mode 100644 scripts/testv/test_MC71p4.wav delete mode 100644 scripts/testv/test_mono.wav delete mode 100644 scripts/testv/test_stereo.wav diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index fab0fa0ab6..6edbb42cc9 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -335,11 +335,12 @@ typedef enum #define PARAM_ISM_HYS_BUF_SIZE 10 /* ISM DTX */ +#ifdef PARAM_ISM_DTX_CNG #ifdef DISCRETE_ISM_DTX_CNG #define ISM_DTX_COH_SCA_BITS 4 +#else +#define PARAM_ISM_DTX_COH_SCA_BITS 4 #endif -#ifdef PARAM_ISM_DTX_CNG -#define PARAM_ISM_DTX_COH_SCA_BITS 4 // VE!!!!! to be removed #define PARAM_ISM_DTX_AZI_BITS 5 #define PARAM_ISM_DTX_ELE_BITS 4 #endif @@ -362,10 +363,15 @@ enum { IND_ISM_NUM_OBJECTS, IND_ISM_METADATA_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS, - IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS, + IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS, /* in SID frames, it is "ism_mode" */ #ifdef PARAM_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG + IND_ISM_NOISY_SPEECH_FLAG = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS, + IND_ISM_SCE_ID_DTX, +#else IND_ISM_SCE_ID_DTX = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS, IND_ISM_NOISY_SPEECH_FLAG, +#endif IND_ISM_DTX_COH_SCA, #endif diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 3f4aa7ffd2..16c6c9243a 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -531,7 +531,6 @@ int16_t ivas_get_ism_sid_quan_bitbudget( const int16_t num_obj, /* i : number of objects */ int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ int16_t *nBits_elevation, /* o : number of Q bits for elevation */ - int16_t *nBits_ener, /* o : number of Q bits for energy */ int16_t *nBits_coh, /* o : number of Q bits for coherence */ int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ) @@ -541,7 +540,6 @@ int16_t ivas_get_ism_sid_quan_bitbudget( low_res_q = 0; *nBits_azimuth = ISM_AZIMUTH_NBITS; *nBits_elevation = ISM_ELEVATION_NBITS; - *nBits_ener = ISM_DTX_ENER_BITS; *nBits_coh = ISM_DTX_COH_SCA_BITS; *nBits_sce_id = 1; @@ -550,8 +548,6 @@ int16_t ivas_get_ism_sid_quan_bitbudget( low_res_q = 1; *nBits_azimuth = PARAM_ISM_DTX_AZI_BITS; *nBits_elevation = PARAM_ISM_DTX_ELE_BITS; - *nBits_ener = ISM_DTX_ENER_BITS - 1; - *nBits_coh = ISM_DTX_COH_SCA_BITS - 1; *nBits_sce_id = 2; } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 74feb3b6b5..9df513e4e1 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -968,6 +968,10 @@ int16_t ivas_ism_dtx_enc_COMMON( ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ int16_t md_diff_flag[], /* o : metadata differential flag */ int16_t *sid_flag /* o : indication of SID frame */ +#ifdef MD_Q_PARAM_BE + , + const ISM_MODE ism_mode +#endif ); #endif /*! r: indication of DTX frame */ @@ -994,14 +998,14 @@ void ivas_ism_metadata_sid_enc( BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ int16_t nb_bits_metadata[] /* o : number of metadata bits */ ); -#endif // VE!!!!! - +#else void ivas_param_ism_metadata_dtx_enc( BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ ISM_METADATA_HANDLE hIsmMeta[], /* i : ISM metadata handles */ ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ ); +#endif #ifdef DISCRETE_ISM_DTX_CNG ivas_error ivas_ism_metadata_sid_dec( @@ -1016,11 +1020,11 @@ ivas_error ivas_ism_metadata_sid_dec( ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ int16_t nb_bits_metadata[] /* o : number of metadata bits */ ); -#endif // VE!!!!! - +#else void ivas_param_ism_metadata_dtx_dec( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); +#endif void ivas_ism_get_sce_id_dtx( ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ @@ -1052,7 +1056,6 @@ int16_t ivas_get_ism_sid_quan_bitbudget( const int16_t num_obj, /* i : number of objects */ int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ int16_t *nBits_elevation, /* o : number of Q bits for elevation */ - int16_t *nBits_ener, /* o : number of Q bits for energy */ int16_t *nBits_coh, /* o : number of Q bits for coherence */ int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ); diff --git a/lib_com/options.h b/lib_com/options.h index bccecd0420..fc8b89be6e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -179,7 +179,9 @@ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ - +#define MD_Q_PARAM_BE +#define MD_SMOOTH_PARAM_BE +#define DTX_PARAM_BE /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_com/prot.h b/lib_com/prot.h index f47c2d65b2..4bb1dfbeb6 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -8523,7 +8523,7 @@ void generate_comfort_noise_dec_hf( HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ #ifdef PARAM_ISM_DTX_CNG , - int16_t cng_flag /*i: CNG Flag */ + const int16_t cng_flag /* i : CNG Flag */ #endif ); diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 314d0534a7..39b09921e9 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -1351,7 +1351,7 @@ void generate_comfort_noise_dec_hf( HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ #ifdef PARAM_ISM_DTX_CNG , - int16_t cng_coh_flag /* i: CNG Flag for coherence handling */ + const int16_t cng_coh_flag /* i : CNG Flag for coherence handling */ #endif ) { @@ -1369,7 +1369,7 @@ void generate_comfort_noise_dec_hf( { seed2 = &( hFdCngCom->seed3 ); - c1 = (float) sqrt( hFdCngCom->coherence ); + c1 = (float) sqrt( hFdCngCom->coherence ); // VE!!!!! all occurences of "(float) sqrt()" should be replaced by "sqrtf()" c2 = (float) sqrt( 1 - hFdCngCom->coherence ); } #endif diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index cc8d60254b..5ca201eec2 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -157,40 +157,31 @@ ivas_error ivas_ism_dtx_dec( } /* Metadata decoding and dequantization */ -#ifdef DISCRETE_ISM_DTX_CNG // VE!!!!! to be harmonized -#if 1 - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) +#ifdef DISCRETE_ISM_DTX_CNG + ivas_ism_metadata_sid_dec( st_ivas->hSCE, ivas_total_brate, st_ivas->bfi, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, + &flag_noisy_speech, &sce_id, st_ivas->hIsmMetaData, nb_bits_metadata ); + + if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) { - ivas_param_ism_metadata_dtx_dec( st_ivas ); + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + st_ivas->hDirAC->hParamIsm->flag_noisy_speech = flag_noisy_speech; + } } - else -#endif - { - ivas_ism_metadata_sid_dec( st_ivas->hSCE, ivas_total_brate, st_ivas->bfi, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, - &flag_noisy_speech, &sce_id, st_ivas->hIsmMetaData, nb_bits_metadata ); - if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) + if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) + { + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) - { - st_ivas->hDirAC->hParamIsm->flag_noisy_speech = flag_noisy_speech; - } + st_ivas->hISMDTX.sce_id_dtx = sce_id; } - - if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) + else /* ism_mode == ISM_MODE_DISC */ { - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) - { - st_ivas->hISMDTX.sce_id_dtx = sce_id; - } - else /* ism_mode == ISM_MODE_DISC */ + for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) { - for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) - { - st_ivas->hSCE[ch]->hCoreCoder[0]->read_sid_info = 0; - } - st_ivas->hSCE[sce_id]->hCoreCoder[0]->read_sid_info = 1; + st_ivas->hSCE[ch]->hCoreCoder[0]->read_sid_info = 0; } + st_ivas->hSCE[sce_id]->hCoreCoder[0]->read_sid_info = 1; } } #else @@ -199,7 +190,17 @@ ivas_error ivas_ism_dtx_dec( #ifdef DISCRETE_ISM_DTX_CNG set_s( md_diff_flag, 1, num_obj ); - //update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); // VE!!!!! + + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + for ( ch = 0; ch < num_obj; ch++ ) + { + st_ivas->hDirAC->azimuth_values[ch] = st_ivas->hIsmMetaData[ch]->azimuth; + st_ivas->hDirAC->elevation_values[ch] = st_ivas->hIsmMetaData[ch]->elevation; + } + } + + update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); st_ivas->ism_dtx_hangover_cnt = 0; diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 814ccbffba..6d53b3b5dc 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -547,7 +547,10 @@ ivas_error ivas_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG if ( *ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) { - //ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); // VE!!!!! +#ifdef MD_SMOOTH_PARAM_BE + if ( ism_mode != ISM_MODE_PARAM ) +#endif + ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); } *ism_dtx_hangover_cnt = min( ( *ism_dtx_hangover_cnt )++, IVAS_ISM_DTX_HO_MAX ); #endif @@ -757,7 +760,7 @@ ivas_error ivas_ism_metadata_sid_dec( { int16_t i, ch, nb_bits_start, last_bit_pos, low_res_q; int16_t idx, idx_azimuth, idx_elevation; - int16_t nBits_azimuth, nBits_elevation, nBits_ener, nBits_coh, nBits_sce_id; + int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; int16_t md_diff_flag[MAX_NUM_OBJECTS]; ISM_MODE ism_mode_bstr; DEC_CORE_HANDLE st0; @@ -767,7 +770,10 @@ ivas_error ivas_ism_metadata_sid_dec( if ( ism_total_brate == FRAME_NO_DATA ) { - ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); +#ifdef MD_SMOOTH_PARAM_BE + if ( ism_mode != ISM_MODE_PARAM ) +#endif + ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); return IVAS_ERR_OK; } @@ -812,7 +818,7 @@ ivas_error ivas_ism_metadata_sid_dec( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ - low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_ener, &nBits_coh, &nBits_sce_id ); + low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); /*----------------------------------------------------------------* * Spatial parameters, loop over TCs - 1 @@ -836,6 +842,7 @@ ivas_error ivas_ism_metadata_sid_dec( { /* read noisy speech flag */ *flag_noisy_speech = get_next_indice( st0, 1 ); + nBits_sce_id = 1; } } @@ -862,6 +869,11 @@ ivas_error ivas_ism_metadata_sid_dec( *sce_id_dtx = 0; } + if ( ism_mode == ISM_MODE_PARAM ) + { + hSCE[*sce_id_dtx]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = hSCE[!*sce_id_dtx]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence; + } + /*----------------------------------------------------------------* * Metadata decoding and dequantization, loop over all objects *----------------------------------------------------------------*/ @@ -922,8 +934,13 @@ ivas_error ivas_ism_metadata_sid_dec( } // VE: ToDo: this would not work well for switching from low_res_q to active frame coding - hIsmMetaData->last_azimuth_idx = idx_azimuth; - hIsmMetaData->last_elevation_idx = idx_elevation; +#ifdef MD_Q_PARAM_BE + if ( ism_mode != ISM_MODE_PARAM ) +#endif + { + hIsmMetaData->last_azimuth_idx = idx_azimuth; + hIsmMetaData->last_elevation_idx = idx_elevation; + } /* save for smoothing metadata evolution */ hIsmMetaData->last_true_azimuth = hIsmMetaData->azimuth; @@ -937,7 +954,10 @@ ivas_error ivas_ism_metadata_sid_dec( } /* smooth the metadata evolution */ - ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); +#ifdef MD_SMOOTH_PARAM_BE + if ( ism_mode != ISM_MODE_PARAM ) +#endif + ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 165dddb546..3b5d50837c 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -1130,7 +1130,7 @@ void ivas_param_ism_params_to_masa_param_mapping( return; } - +#ifndef DISCRETE_ISM_DTX_CNG #ifdef PARAM_ISM_DTX_CNG static void ivas_param_ism_dec_dequantize_DOA_dtx( int16_t azi_bits, @@ -1263,3 +1263,4 @@ void ivas_param_ism_metadata_dtx_dec( return; } #endif +#endif diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 63e94c8ff9..fc8867a5b0 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -113,11 +113,15 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ int16_t md_diff_flag[], /* o : metadata differential flag */ int16_t *sid_flag /* o : indication of SID frame */ +#ifdef MD_Q_PARAM_BE + , + const ISM_MODE ism_mode +#endif ) { int16_t ch, dtx_flag; int16_t nBits, nBits_MD_max; - int16_t nBits_azimuth, nBits_elevation, nBits_ener, nBits_coh, nBits_sce_id; + int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; float lp_noise[MAX_NUM_OBJECTS], lp_noise_variation, lp_noise_mean; /*------------------------------------------------------------------* @@ -126,7 +130,7 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end /* compute global ISM based on localVAD */ dtx_flag = 1; - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_transport; ch++ ) { dtx_flag &= !vad_flag[ch]; } @@ -163,7 +167,7 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end if ( dtx_flag ) { - ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_ener, &nBits_coh, &nBits_sce_id ); + ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); nBits = 0; for ( ch = 0; ch < num_obj; ch++ ) @@ -180,6 +184,13 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end md_diff_flag[ch] = 1; } +#ifdef MD_Q_PARAM_BE + if ( ism_mode == ISM_MODE_PARAM ) + { + md_diff_flag[ch] = 1; + } +#endif + /* estimate SID metadata bit-budget */ nBits++; /* number of objects */ nBits++; /* SID metadata flag */ @@ -240,7 +251,7 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end } else /* ism_dtx_flag == 1 */ { - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_transport; ch++ ) { hSCE[ch]->hCoreCoder[0]->cng_type = FD_CNG; } @@ -255,7 +266,7 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end } /* encode SID in one channel only */ - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_transport; ch++ ) { hSCE[ch]->hCoreCoder[0]->core_brate = FRAME_NO_DATA; } @@ -269,7 +280,7 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end if ( dtx_flag == 1 && *sid_flag == 0 ) { - set_s( md_diff_flag, 0, num_obj ); + set_s( md_diff_flag, 0, nchan_transport ); } return dtx_flag; diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index e6dd7d0fba..b2dfde3782 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -196,6 +196,12 @@ ivas_error ivas_ism_enc( } vad_flag[sce_id] = st->vad_flag; +#ifdef DTX_PARAM_BE + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + vad_flag[sce_id] = vad_flag_dtx[sce_id][0]; + } +#endif } #ifdef PARAM_ISM_DTX_CNG @@ -216,7 +222,12 @@ ivas_error ivas_ism_enc( #ifdef DISCRETE_ISM_DTX_CNG // VE!!!!! to be harmonized if ( st_ivas->ism_mode != ISM_MODE_PARAM ) { - dtx_flag = ivas_ism_dtx_enc_COMMON( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); + dtx_flag = ivas_ism_dtx_enc_COMMON( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag +#ifdef MD_Q_PARAM_BE + , + st_ivas->ism_mode +#endif + ); } else #endif @@ -252,17 +263,14 @@ ivas_error ivas_ism_enc( if ( dtx_flag ) { -#ifdef DISCRETE_ISM_DTX_CNG // VE!!!!! to be harmonized - if ( st_ivas->ism_mode != ISM_MODE_PARAM ) - { - ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, flag_noisy_speech, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); - } - else -#endif - if ( sid_flag ) +#ifdef DISCRETE_ISM_DTX_CNG + ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, flag_noisy_speech, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); +#else + if ( sid_flag ) { ivas_param_ism_metadata_dtx_enc( st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, st_ivas->hIsmMetaData, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ); } +#endif } else #endif diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index c06eeb9b86..dd57403d1e 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -865,7 +865,7 @@ void ivas_ism_metadata_sid_enc( { int16_t i, ch, nBits, nBits_start, nBits_unused, low_res_q; int16_t idx, idx_azimuth, idx_elevation; - int16_t nBits_azimuth, nBits_elevation, nBits_ener, nBits_coh, nBits_sce_id; + int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; float valQ; ISM_METADATA_HANDLE hIsmMetaData; @@ -896,7 +896,7 @@ void ivas_ism_metadata_sid_enc( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ - low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_ener, &nBits_coh, &nBits_sce_id ); + low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); /*----------------------------------------------------------------* * Spatial parameters, loop over TCs - 1 @@ -918,6 +918,7 @@ void ivas_ism_metadata_sid_enc( { /* write noisy speech flag */ push_indice( hBstr, IND_ISM_NOISY_SPEECH_FLAG, flag_noisy_speech, 1 ); + nBits_sce_id = 1; } } @@ -963,8 +964,13 @@ void ivas_ism_metadata_sid_enc( push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, nBits_azimuth ); push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, nBits_elevation ); - hIsmMetaData->last_azimuth_idx = idx_azimuth; - hIsmMetaData->last_elevation_idx = idx_elevation; +#ifdef MD_Q_PARAM_BE + if ( ism_mode != ISM_MODE_PARAM ) +#endif + { + hIsmMetaData->last_azimuth_idx = idx_azimuth; + hIsmMetaData->last_elevation_idx = idx_elevation; + } } } diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index d7e3a9a35d..09383db54b 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -400,6 +400,7 @@ void ivas_param_ism_enc( #ifdef PARAM_ISM_DTX_CNG +#ifndef DISCRETE_ISM_DTX_CNG static void ivas_param_ism_enc_quantize_DOA_dtx( float azimuth, float elevation, @@ -524,7 +525,7 @@ void ivas_param_ism_metadata_dtx_enc( return; } - +#endif /*-------------------------------------------------------------------* * ivas_param_ism_compute_noisy_speech_flag() diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index a007d937a1..96f6d7dfc3 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -157,11 +157,11 @@ ../IVAS_dec -fec 5 MONO 16 bit testv/stvST32n.pcm_Unified_32000_32-16_DTX_MONO_FEC5.tst // unified stereo at 32 kbps, 48kHz in, 48kHz out, bandwidth switching -../IVAS_cod -stereo -max_band testv/bwidth_cntl.txt 32000 48 testv/stvST48c.pcm bit +../IVAS_cod -stereo -max_band testv/bwidth_cntl.txt 32000 48 testv/stvST48c.wav bit ../IVAS_dec STEREO 48 bit testv/stvST48c.pcm_Unified_32000_48-48_bandwidth_sw.tst // unified stereo at 32 kbps, 48kHz in, 32kHz out, random FEC at 6% -../IVAS_cod -stereo -max_band FB 32000 48 testv/stvST48c.pcm bit +../IVAS_cod -stereo -max_band FB 32000 48 testv/stvST48c.wav bit ../IVAS_dec -fec testv/FEC_6pct.bin STEREO 32 bit testv/stvST48c.pcm_Unified_32000_48-32_FEC5.tst // unified stereo at 32 kbps, 48kHz in, 48kHz out, DTX on, random FEC at 5% @@ -214,7 +214,7 @@ ../IVAS_dec MONO 32 bit testv/stvST32c.pcm_MDCT_48000_32-32_MONO.tst // MDCT stereo at 128 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -stereo 128000 48 testv/stvST48c.pcm bit +../IVAS_cod -stereo 128000 48 testv/stvST48c.wav bit ../IVAS_dec MONO 48 bit testv/stvST32c.pcm_MDCT_128000_48-48_MONO.tst // MDCT stereo at 48 kbps, 48 kHz in, 48 kHz out, DTX on @@ -249,8 +249,10 @@ //../IVAS_cod -dtx -stereo ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stvST48n.pcm bit //../IVAS_dec MONO 48 bit testv/stvST48n.pcm_stereo_sw_48-48_DTX_MONO.tst + + // 1 ISm with metadata at 13.2 kbps, 48 kHz in, 48 kHz out, MONO out -../IVAS_cod -ism 1 testv/stvISM1.csv 13200 48 testv/stv1ISM48s.pcm bit +../IVAS_cod -ism 1 testv/stvISM1.csv 13200 48 testv/stv1ISM48s.wav bit ../IVAS_dec MONO 48 bit testv/stv1ISM48s.pcm_13200_48-48_MONO.tst // 1 ISm with metadata at 13.2 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL out, random FEC at 5% @@ -258,15 +260,15 @@ ../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv48n.pcm_13200_48-48_DTX_FEC5_BINAURAL.tst // 2 ISm with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, STEREO out -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 16400 48 testv/stv2ISM48s.pcm bit +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 16400 48 testv/stv2ISM48s.wav bit ../IVAS_dec STEREO 48 bit testv/stv2ISM48s.pcm_16400_48-48_STEREO.tst // 3 ISm with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, 7_1 out -../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.pcm bit +../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.wav bit ../IVAS_dec 7_1 48 bit testv/stv3ISM48s.pcm_24400_48-48_7_1.tst // 3 ISm with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, MONO out, random FEC at 5% -../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.pcm bit +../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.wav bit ../IVAS_dec -fec 5 MONO 48 bit testv/stv3ISM48s.pcm_24400_48-48_MONO_FEC5.tst // 1 ISm with metadata at 32 kbps, 32 kHz in, 32 kHz out, DTX on, MONO out @@ -274,107 +276,107 @@ ../IVAS_dec MONO 32 bit testv/stv32n.pcm_32000_32-32_DTX_MONO.tst // 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, FOA out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit ../IVAS_dec FOA 48 bit testv/stv4ISM48s.pcm_32000_48-48_FOA.tst // 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, STEREO out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit ../IVAS_dec STEREO 48 bit testv/stv4ISM48s.pcm_32000_48-48_STEREO.tst // 3 ISm with metadata at 48 kbps, 48 kHz in, 48 kHz out, MONO out -../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 48000 48 testv/stv3ISM48s.pcm bit +../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 48000 48 testv/stv3ISM48s.wav bit ../IVAS_dec MONO 48 bit testv/stv43ISM48s_48000_48-48_MONO.tst // 2 ISm with metadata at 64 kbps, 48 kHz in, 32 kHz out, 5_1 out -../IVAS_cod -max_band FB -ism 2 testv/stvISM1.csv testv/stvISM2.csv 64000 48 testv/stv2ISM48s.pcm bit +../IVAS_cod -max_band FB -ism 2 testv/stvISM1.csv testv/stvISM2.csv 64000 48 testv/stv2ISM48s.wav bit ../IVAS_dec 5_1 32 bit testv/stv2ISM48s.pcm_64000_48-32_5_1.tst // 4 ISm with metadata at 80 kbps, 48 kHz in, 48 kHz out, HOA2 out -../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 80000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 80000 48 testv/stv4ISM48s.wav bit ../IVAS_dec HOA2 48 bit testv/stv4ISM48s.pcm_80000_48-48_HOA2.tst // 4 ISm with metadata at 96 kbps, 48 kHz in, 48 kHz out, Custom LS setup out -../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 96000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 96000 48 testv/stv4ISM48s.wav bit ../IVAS_dec testv/ls_setup_16ch_8+4+4.txt 48 bit testv/stv4ISM48s.pcm_96000_48-48_MC_custom_setup.tst // 3 ISm with metadata at 128 kbps, 48 kHz in, 32 kHz out, HOA3 out, random FEC at 5% -../IVAS_cod -max_band FB -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 128000 48 testv/stv3ISM48s.pcm bit +../IVAS_cod -max_band FB -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 128000 48 testv/stv3ISM48s.wav bit ../IVAS_dec -fec 5 HOA3 32 bit testv/stv3ISM48s.pcm_128000_48-32_HOA3_FEC5.tst // 4 ISm with metadata at 160 kbps, 48 kHz in, 48 kHz out, STEREO out -../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 160000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 160000 48 testv/stv4ISM48s.wav bit ../IVAS_dec STEREO 48 bit testv/stv4ISM48s.pcm_160000_48-48_STEREO.tst // 2 ISm with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, BINAURAL out -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 16400 48 testv/stv2ISM48s.pcm bit +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 16400 48 testv/stv2ISM48s.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv2ISM48s.pcm_16400_48-48_binaural.tst // 3 ISm with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, BINAURAL out -../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.pcm bit +../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv3ISM48s.pcm_24400_48-48_binaural.tst // 2 ISm with metadata at 48 kbps, 48 kHz in, 48 kHz out, BINAURAL out, random FEC at 5% -../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 48000 48 testv/stv2ISM48s.pcm bit +../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 48000 48 testv/stv2ISM48s.wav bit ../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv2ISM48s.pcm_48000_48-48_binaural_FEC5.tst // 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, BINAURAL out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.pcm_32000_48-48_binaural.tst // 1 ISm with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out -../IVAS_cod -ism 1 testv/stvISM1.csv 16400 48 testv/stv1ISM48s.pcm bit +../IVAS_cod -ism 1 testv/stvISM1.csv 16400 48 testv/stv1ISM48s.wav bit ../IVAS_dec BINAURAL_ROOM 48 bit testv/stv1ISM48s.pcm_16400_48-48_binaural_room.tst // 2 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, EXTERNAL out -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 32000 48 testv/stv2ISM48s.pcm bit +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 32000 48 testv/stv2ISM48s.wav bit ../IVAS_dec EXT 48 bit testv/stv2ISM48s.pcm_32000_48-48_external.tst // 2 ISm with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out -../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv2ISM48s.pcm bit +../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv2ISM48s.wav bit ../IVAS_dec BINAURAL_ROOM 48 bit testv/stv2ISM48s.pcm_64000_48-48_binaural_room.tst // 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out, random FEC at 5% -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit ../IVAS_dec -fec 5 BINAURAL_ROOM 48 bit testv/stv4ISM48s.pcm_32000_48-48_binaural_room_FEC5.tst // 4 ISm with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv4ISM48s.wav bit ../IVAS_dec BINAURAL_ROOM 48 bit testv/stv4ISM48s.pcm_64000_48-48_binaural_room.tst // 1 ISm with metadata at 48 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out, head rotation, random FEC at 5% -../IVAS_cod -ism 1 testv/stvISM1.csv 48000 48 testv/stv1ISM48s.pcm bit +../IVAS_cod -ism 1 testv/stvISM1.csv 48000 48 testv/stv1ISM48s.wav bit ../IVAS_dec -fec 5 -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv1ISM48s.pcm_64000_48-48_binaural_room_HR.tst // 1 ISm with metadata at 96 kbps, 48 kHz in, 16 kHz out, TD BINAURAL out (Model from file) -../IVAS_cod -ism 1 testv/stvISM1.csv 96000 48 testv/stv1ISM48s.pcm bit +../IVAS_cod -ism 1 testv/stvISM1.csv 96000 48 testv/stv1ISM48s.wav bit ../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin BINAURAL 16 bit testv/stv2ISM48s.pcm_96000_48-16_TD_binaural.tst // 2 ISm with metadata at 160 kbps, 48 kHz in, 32 kHz out, TD BINAURAL out -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 160000 48 testv/stv2ISM48s.pcm bit +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 160000 48 testv/stv2ISM48s.wav bit ../IVAS_dec BINAURAL 32 bit testv/stv2ISM48s.pcm_160000_48-32_TD_binaural.tst // 3 ISm with metadata at 192 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out (Model from file) -../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 192000 48 testv/stv3ISM48s.pcm bit +../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 192000 48 testv/stv3ISM48s.wav bit ../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin BINAURAL 48 bit testv/stv3ISM48s.pcm_192000_48-48_TD_binaural.tst // 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TD_binaural.tst // 1 ISm with metadata at 80 kbps, 48 kHz in, 16 kHz out, TD BINAURAL out (Model from file), head rotation, random FEC at 5% -../IVAS_cod -ism 1 testv/stvISM1.csv 80000 48 testv/stv1ISM48s.pcm bit +../IVAS_cod -ism 1 testv/stvISM1.csv 80000 48 testv/stv1ISM48s.wav bit ../IVAS_dec -fec 5 -t testv/headrot_case00_3000_q.csv -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin BINAURAL 16 bit testv/stv2ISM48s.pcm_80000_48-16_TDHR_FEC5.tst // 2 ISm with metadata at 128 kbps, 48 kHz in, 32 kHz out, TD BINAURAL out (Model from file), head rotation -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 128000 48 testv/stv2ISM48s.pcm bit +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 128000 48 testv/stv2ISM48s.wav bit ../IVAS_dec -t testv/headrot_case01_3000_q.csv -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin BINAURAL 32 bit testv/stv2ISM48s.pcm_128000_48-32_TDHR.tst // 3 ISm with metadata at 192 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation, random FEC at 5% -../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 192000 48 testv/stv3ISM48s.pcm bit +../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 192000 48 testv/stv3ISM48s.wav bit ../IVAS_dec -fec 5 -t testv/headrot_case02_3000_q.csv BINAURAL 48 bit testv/stv3ISM48s.pcm_192000_48-48_TDHR_FEC5.tst // 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit ../IVAS_dec -t testv/headrot_case03_3000_q.csv BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR.tst // 1 ISm with metadata bitrate switching from 13.2 kbps to 128 kbps, 32 kHz in, 32 kHz out, mono out, DTX on @@ -382,9 +384,11 @@ ../IVAS_dec MONO 32 bit testv/stv32c.pcm_brate_sw_32-32_mono_dtx.tst // 4 ISm with metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.pcm_brate_sw_48-48_BINAURAL.tst + + // SBA at 13.2 kbps, 32kHz in, 32kHz out, HOA3 out ../IVAS_cod -sba 3 13200 32 testv/stv3OA32c.pcm bit ../IVAS_dec HOA3 32 bit testv/stv3OA32c.pcm_SBA_13200_32-32_HOA3.tst @@ -438,7 +442,7 @@ ../IVAS_dec BINAURAL_ROOM 32 bit testv/stvFOA32c.pcm_SBA_32000_32-32_BINAURAL_ROOM.tst // SBA at 32 kbps, 48kHz in, 48kHz out, MONO out, DTX -../IVAS_cod -dtx -sba 1 32000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -dtx -sba 1 32000 48 testv/stvFOA48c.wav bit ../IVAS_dec MONO 48 bit testv/stvFOA48c.pcm_SBA_32000_48-48_DTX_MONO.tst // SBA at 48 kbps, 32kHz in, 32kHz out, MONO out, random FEC at 5% @@ -478,19 +482,19 @@ ../IVAS_dec -fec 5 FOA 32 bit testv/stvFOA32c.pcm_SBA_64000_32-32_DTX_FOA.tst // SBA at 64 kbps, 48kHz in, 48kHz out, 5_1_4 out -../IVAS_cod -max_band FB -sba 1 64000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -max_band FB -sba 1 64000 48 testv/stvFOA48c.wav bit ../IVAS_dec 5_1_4 48 bit testv/stvFOA48c.pcm_SBA_64000_48-48_5_1_4.tst // SBA at 64 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -sba 1 64000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -sba 1 64000 48 testv/stvFOA48c.wav bit ../IVAS_dec 7_1_4 48 bit testv/stvFOA48c.pcm_SBA_64000_48-48_7_1_4.tst // SBA at 64 kpbs, 48kHz in, 48kHz out, BINAURAL out, DTX -../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.wav bit ../IVAS_dec BINAURAL 48 bit testv/stvFOA48c.pcm_SBA_64000_48-48_DTX_BINAURAL.tst // SBA at 64 kpbs, 48kHz in, 48kHz out, BINAURAL_ROOM out, DTX -../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.wav bit ../IVAS_dec BINAURAL_ROOM 48 bit testv/stvFOA48c.pcm_SBA_64000_48-48_DTX_BINAURAL_ROOM.tst // SBA at 80 kbps, 32kHz in, 32kHz out, HOA3 out @@ -510,7 +514,7 @@ ../IVAS_dec STEREO 32 bit testv/stvFOA32c.pcm_SBA_96000_32-32_STEREO.tst // SBA at 96 kbps, 48kHz in, 48kHz out, FOA out -../IVAS_cod -sba 1 96000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -sba 1 96000 48 testv/stvFOA48c.wav bit ../IVAS_dec FOA 48 bit testv/stvFOA48c.pcm_SBA_96000_48-48_FOA.tst // SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation @@ -518,11 +522,11 @@ ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot.tst // SBA at 192 kbps, 48kHz in, 48kHz out, HOA2 out, random FEC at 5% -../IVAS_cod -sba 3 192000 48 testv/stv3OA48c.pcm bit +../IVAS_cod -sba 3 192000 48 testv/stv3OA48c.wav bit ../IVAS_dec -fec 5 HOA2 48 bit testv/stv3OA48c.pcm_SBA_192000_48-48_HOA2_FEC5.tst // SBA at 48 kbps, 48kHz in, 48kHz out, DTX on, 5_1 out -../IVAS_cod -sba 3 -dtx 48000 48 testv/stv3OA48c.pcm bit +../IVAS_cod -sba 3 -dtx 48000 48 testv/stv3OA48c.wav bit ../IVAS_dec 5_1 48 bit testv/stv3OA48c.pcm_SBA_48000_48-48_DTX_5_1.tst // SBA at 160 kbps, 32kHz in, 32kHz out, FOA out @@ -530,15 +534,15 @@ ../IVAS_dec FOA 32 bit testv/stvFOA32c.pcm_SBA_160000_32-32_FOA.tst // SBA at 160 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out, random FEC at 5% -../IVAS_cod -sba 1 160000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -sba 1 160000 48 testv/stvFOA48c.wav bit ../IVAS_dec -fec 5 BINAURAL_ROOM 48 bit testv/stvFOA48c.pcm_SBA_160000_48-48_BINAURAL_ROOM_FEC5.tst // SBA at 160 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -sba 1 160000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -sba 1 160000 48 testv/stvFOA48c.wav bit ../IVAS_dec 5_1 48 bit testv/stvFOA48c.pcm_SBA_160000_48-48_5_1.tst // SBA at 192 kbps, 48kHz in, 48kHz out, Custom LS setup out -../IVAS_cod -sba 1 192000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -sba 1 192000 48 testv/stvFOA48c.wav bit ../IVAS_dec testv/ls_setup_16ch_8+4+4.txt 48 bit testv/stvFOA48c.pcm_SBA_192000_48-48_MC_custom_setup.tst // SBA at 256 kbps, 32kHz in, 32kHz out, FOA out @@ -550,7 +554,7 @@ ../IVAS_dec BINAURAL_ROOM 32 bit testv/stvFOA32c.pcm_SBA_256000_32-32_BINAURAL_ROOM.tst // SBA at 256 kbps, 48kHz in, 48kHz out, 7_1 out, random FEC at 5% -../IVAS_cod -sba 1 256000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -sba 1 256000 48 testv/stvFOA48c.wav bit ../IVAS_dec -fec 5 7_1 48 bit testv/stvFOA48c.pcm_SBA_256000_48-48_7_1_FEC5.tst // SBA 2OA at 384 kbps, 32kHz in, 32kHz out, STEREO out @@ -558,7 +562,7 @@ ../IVAS_dec STEREO 32 bit testv/stv2OA32c.pcm_SBA_384000_32-32_stereo.tst // SBA 3OA at 512 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -sba 3 512000 48 testv/stv3OA48c.pcm bit +../IVAS_cod -sba 3 512000 48 testv/stv3OA48c.wav bit ../IVAS_dec binaural 48 bit testv/stv3OA48c.pcm_SBA_512000_48-48_binaural.tst // SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 48kHz in, 48kHz out, BINAURAL out @@ -570,11 +574,11 @@ ../IVAS_dec FOA 48 bit testv/stv2OA48c.pcm_sw_48-48_FOA.tst // SBA 3OA bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, HOA3 out -../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.pcm bit +../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.wav bit ../IVAS_dec HOA3 48 bit testv/stv3OA48c.pcm_sw_48-48_HOA3.tst // SBA planar 3OA bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -sba -3 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv3OA48c.pcm bit +../IVAS_cod -sba -3 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv3OA48c.wav bit ../IVAS_dec 7_1_4 48 bit testv/stv3OA48c.pcm_sw_48-48_7_1_4.tst // SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 32kHz in, 32kHz out,DTX on, BINAURAL out @@ -585,349 +589,354 @@ ../IVAS_cod -dtx -sba 3 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv3OA32c.pcm bit ../IVAS_dec HOA3 32 bit testv/stv3OA32c.pcm_sw_32-32_DTX_HOA3.tst + + // MASA 1dir 1TC at 13.2 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 13200 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stv_IVASMASA_1dir1TC.pcm_13200_48-48_BINAURAL.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 13200 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv1MASA1TC48c.pcm_13200_48-48_BINAURAL.tst // MASA 1dir 1TC at 16.4 kbps, 48kHz in, 48kHz out, HOA3 out, random FEC at 5% -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 16400 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec -fec 5 HOA3 48 bit testv/stv_IVASMASA_1dir1TC.pcm_16400_48-48_HOA3_FEC5.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 16400 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec -fec 5 HOA3 48 bit testv/stv1MASA1TC48c.pcm_16400_48-48_HOA3_FEC5.tst // MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 24400 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir1TC.pcm_24400_48-48_BinauralRoom.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv1MASA1TC48c.pcm_24400_48-48_BinauralRoom.tst // MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 24400 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir1TC.pcm_24400_48-48_BinauralRoom_Subframe.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv1MASA1TC48c.pcm_24400_48-48_BinauralRoom_Subframe.tst // MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 24400 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir1TC.pcm_24400_48-48_BinauralRoom_Headrot.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv1MASA1TC48c.pcm_24400_48-48_BinauralRoom_Headrot.tst // MASA 1dir 1TC at 32 kbps, 48kHz in, 48kHz out, 7_1_4, random FEC at 5% -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 32000 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec -fec 5 7_1_4 48 bit testv/stv_IVASMASA_1dir1TC.pcm_32000_48-48_7_1_4_FEC5.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 32000 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec -fec 5 7_1_4 48 bit testv/stv1MASA1TC48c.pcm_32000_48-48_7_1_4_FEC5.tst // MASA 1dir 1TC at 48 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 48000 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec MONO 48 bit testv/stv_IVASMASA_1dir1TC.pcm_48000_48-48_MONO.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 48000 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec MONO 48 bit testv/stv1MASA1TC48c.pcm_48000_48-48_MONO.tst // MASA 1dir 1TC at 64 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 64000 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec STEREO 48 bit testv/stv_IVASMASA_1dir1TC.pcm_64000_48-48_STEREO.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 64000 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv1MASA1TC48c.pcm_64000_48-48_STEREO.tst // MASA 2dir 1TC at 128 kbps, 48kHz in, 48kHz out, BINAURAL out, random FEC at 5% -../IVAS_cod -masa 1 testv/stv_IVASMASA_2dir1TC.met 128000 48 testv/stv_IVASMASA_2dir1TC.pcm bit -../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv_IVASMASA_2dir1TC.pcm_128000_48-48_BINAURAL_FEC5.tst +../IVAS_cod -masa 1 testv/stv2MASA1TC48c.met 128000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv2MASA1TC48c.pcm_128000_48-48_BINAURAL_FEC5.tst // MASA 2dir 1TC at 128 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -masa 1 testv/stv_IVASMASA_2dir1TC.met 128000 48 testv/stv_IVASMASA_2dir1TC.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stv_IVASMASA_2dir1TC.pcm_128000_48-48_BINAURAL_Subframe.tst +../IVAS_cod -masa 1 testv/stv2MASA1TC48c.met 128000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv2MASA1TC48c.pcm_128000_48-48_BINAURAL_Subframe.tst // MASA 2dir 1TC at 128 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation -../IVAS_cod -masa 1 testv/stv_IVASMASA_2dir1TC.met 128000 48 testv/stv_IVASMASA_2dir1TC.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv_IVASMASA_2dir1TC.pcm_128000_48-48_BINAURAL_Headrot.tst +../IVAS_cod -masa 1 testv/stv2MASA1TC48c.met 128000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv2MASA1TC48c.pcm_128000_48-48_BINAURAL_Headrot.tst // MASA 1dir 2TC at 13.2 kbps, 48kHz in, 48kHz out, 5_1 out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 13200 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec -fec 5 5_1 48 bit testv/stv_IVASMASA_1dir2TC.pcm_13200_48-48_5_1_FEC5.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 13200 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec -fec 5 5_1 48 bit testv/stv2MASA1TC48c.pcm_13200_48-48_5_1_FEC5.tst // MASA 1dir 2TC at 16.4 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 16400 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_1dir2TC.pcm_16400_48-48_5_1.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 16400 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv2MASA1TC48c.pcm_16400_48-48_5_1.tst // MASA 1dir 2TC at 24.4 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 24400 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec STEREO 48 bit testv/stv_IVASMASA_1dir2TC.pcm_24400_48-48_STEREO.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 24400 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv2MASA1TC48c.pcm_24400_48-48_STEREO.tst // MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 32000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv2MASA1TC48c.pcm_32000_48-48_BinauralRoom.tst // MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 32000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv2MASA1TC48c.pcm_32000_48-48_BinauralRoom_Headrot.tst // MASA 1dir 2TC at 48 kbps, 48kHz in, 48kHz out, 7_1_4 out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 48000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec -fec 5 7_1_4 48 bit testv/stv_IVASMASA_1dir2TC.pcm_48000_48-48_7_1_4_FEC5.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 48000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec -fec 5 7_1_4 48 bit testv/stv2MASA1TC48c.pcm_48000_48-48_7_1_4_FEC5.tst // MASA 1dir 2TC at 80 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 80000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec STEREO 48 bit testv/stv_IVASMASA_1dir2TC.pcm_80000_48-48_STEREO.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 80000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv2MASA1TC48c.pcm_80000_48-48_STEREO.tst // MASA 1dir 2TC at 96 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 96000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec MONO 48 bit testv/stv_IVASMASA_1dir2TC.pcm_96000_48-48_MONO.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 96000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec MONO 48 bit testv/stv2MASA1TC48c.pcm_96000_48-48_MONO.tst // MASA 1dir 2TC at 160 kbps, 48kHz in, 48kHz out, HOA3 out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 160000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec -fec 5 HOA3 48 bit testv/stv_IVASMASA_1dir2TC.pcm_160000_48-48_HOA3_FEC5.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 160000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec -fec 5 HOA3 48 bit testv/stv2MASA1TC48c.pcm_160000_48-48_HOA3_FEC5.tst // MASA 1dir 2TC at 256 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 256000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_1dir2TC.pcm_256000_48-48_5_1.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 256000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv2MASA1TC48c.pcm_256000_48-48_5_1.tst // MASA 2dir 2TC at 48 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 48000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_2dir2TC.pcm_48000_48-48_5_1.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 48000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv2MASA2TC48c.pcm_48000_48-48_5_1.tst // MASA 2dir 2TC at 64 kbps, 48kHz in, 48kHz out, EXTERNAL out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 64000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec -fec 5 EXT 48 bit testv/stv_IVASMASA_2dir2TC.pcm_64000_48-48_external_FEC5.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 64000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec -fec 5 EXT 48 bit testv/stv2MASA2TC48c.pcm_64000_48-48_external_FEC5.tst // MASA 2dir 2TC at 64 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 64000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv_IVASMASA_2dir2TC.pcm_64000_48-48_BINAURAL_Headrot.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 64000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv2MASA2TC48c.pcm_64000_48-48_BINAURAL_Headrot.tst // MASA 2dir 2TC at 128 kbps, 48kHz in, 48kHz out, FOA out -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 128000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec FOA 48 bit testv/stv_IVASMASA_2dir2TC.pcm_128000_48-48_FOA.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 128000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec FOA 48 bit testv/stv2MASA2TC48c.pcm_128000_48-48_FOA.tst // MASA 2dir 2TC at 192 kbps, 48kHz in, 48kHz out, 5_1_4 out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 192000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec -fec 5 5_1_4 48 bit testv/stv_IVASMASA_2dir2TC.pcm_192000_48-48_5_1_4_FEC5.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 192000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec -fec 5 5_1_4 48 bit testv/stv2MASA2TC48c.pcm_192000_48-48_5_1_4_FEC5.tst // MASA 2dir 2TC at 384 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 384000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_2dir2TC.pcm_384000_48-48_BinauralRoom.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 384000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv2MASA2TC48c.pcm_384000_48-48_BinauralRoom.tst // MASA 2dir 2TC at 384 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 384000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_2dir2TC.pcm_384000_48-48_BinauralRoom_Subframe.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 384000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv2MASA2TC48c.pcm_384000_48-48_BinauralRoom_Subframe.tst // MASA 2dir 2TC at 512 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 512000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_2dir2TC.pcm_512000_48-48_5_1.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 512000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv2MASA2TC48c.pcm_512000_48-48_5_1.tst // MASA 1dir 1TC at 13.2 kbps, 48kHz in, 48kHz out, DTX on, 7_1_4 out -../IVAS_cod -dtx -masa 1 testv/stv_IVASMASA_1dir1TC_DTX.met 13200 48 testv/stv_IVASMASA_1dir1TC_DTX.pcm bit -../IVAS_dec 7_1_4 48 bit testv/stv_IVASMASA_1dir1TC_DTX.pcm_13200_48-48_DTX_7_1_4.tst +../IVAS_cod -dtx -masa 1 testv/stv1MASA1TC48n.met 13200 48 testv/stv1MASA1TC48n.pcm bit +../IVAS_dec 7_1_4 48 bit testv/stv1MASA1TC48n.pcm_13200_48-48_DTX_7_1_4.tst // MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, DTX on, 5_1 out -../IVAS_cod -dtx -masa 1 testv/stv_IVASMASA_1dir1TC_DTX.met 24400 48 testv/stv_IVASMASA_1dir1TC_DTX.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_1dir1TC_DTX.pcm_24400_48-48_DTX_5_1.tst +../IVAS_cod -dtx -masa 1 testv/stv1MASA1TC48n.met 24400 48 testv/stv1MASA1TC48n.pcm bit +../IVAS_dec 5_1 48 bit testv/stv1MASA1TC48n.pcm_24400_48-48_DTX_5_1.tst // MASA 1dir 2TC at 16.4 kbps, 48kHz in, 48kHz out, DTX on, 7_1_4 out -../IVAS_cod -dtx -masa 2 testv/stv_IVASMASA_1dir2TC_DTX.met 16400 48 testv/stv_IVASMASA_1dir2TC_DTX.pcm bit -../IVAS_dec 7_1_4 48 bit testv/stv_IVASMASA_1dir2TC_DTX.pcm_16400_48-48_DTX_7_1_4.tst +../IVAS_cod -dtx -masa 2 testv/stv1MASA2TC48n.met 16400 48 testv/stv1MASA2TC48n.pcm bit +../IVAS_dec 7_1_4 48 bit testv/stv1MASA2TC48n.pcm_16400_48-48_DTX_7_1_4.tst // MASA 1dir 2TC at 32.0 kbps, 48kHz in, 48kHz out, DTX on, 5_1 out -../IVAS_cod -dtx -masa 2 testv/stv_IVASMASA_1dir2TC_DTX.met 32000 48 testv/stv_IVASMASA_1dir2TC_DTX.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_1dir2TC_DTX.pcm_32000_48-48_DTX_5_1.tst +../IVAS_cod -dtx -masa 2 testv/stv1MASA2TC48n.met 32000 48 testv/stv1MASA2TC48n.pcm bit +../IVAS_dec 5_1 48 bit testv/stv1MASA2TC48n.pcm_32000_48-48_DTX_5_1.tst // MASA 1dir 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC_DTX.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv_IVASMASA_1dir1TC_DTX.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_1dir1TC_DTX.pcm_sw_48-48_5_1.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48n.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv1MASA1TC48n.pcm bit +../IVAS_dec 5_1 48 bit testv/stv1MASA1TC48n.pcm_sw_48-48_5_1.tst // MASA 1dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC_DTX.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv_IVASMASA_1dir2TC_DTX.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stv_IVASMASA_1dir2TC_DTX.pcm_sw_48-48_BINAURAL.tst +../IVAS_cod -masa 2 testv/stv1MASA2TC48n.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv1MASA2TC48n.pcm bit +../IVAS_dec BINAURAL 48 bit testv/stv1MASA2TC48n.pcm_sw_48-48_BINAURAL.tst + // Multi-channel 5_1 at 13.2 kbps, 48kHz in, 48kHz out -../IVAS_cod -mc 5_1 13200 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 13200 48 testv/stv51MC48c.wav bit ../IVAS_dec 5_1 48 bit testv/stv51MC48c.pcm_MC51_13200_48-48_5_1.tst // Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL out, random FEC at 5% -../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.wav bit ../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_Binaural_FEC5.tst // Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_Binaural_Subframe.tst // Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation -../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.wav bit ../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_Binaural_Headrot.tst // Multi-channel 5_1 at 48 kbps, 48kHz in, 48kHz out, random FEC at 5% -../IVAS_cod -mc 5_1 48000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 48000 48 testv/stv51MC48c.wav bit ../IVAS_dec -fec 5 5_1 48 bit testv/stv51MC48c.pcm_MC51_48000_48-48_5_1_FEC5.tst // Multi-channel 5_1 at 64 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_64000_48-48_Binaural.tst // Multi-channel 5_1 at 64 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation -../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit ../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_64000_48-48_Binaural_Headrot.tst // Multi-channel 5_1 at 64 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation -../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_64000_48-48_Binaural_room_Headrot.tst // Multi-channel 5_1 at 96 kbps, 48kHz in, 48kHz out, random FEC at 5% -../IVAS_cod -mc 5_1 96000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 96000 48 testv/stv51MC48c.wav bit ../IVAS_dec -fec 5 5_1 48 bit testv/stv51MC48c.pcm_MC51_96000_48-48_5_1_FEC5.tst // Multi-channel 5_1 at 128 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 5_1 128000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 128000 48 testv/stv51MC48c.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_128000_48-48_Binaural.tst // Multi-channel 5_1 at 128 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation -../IVAS_cod -mc 5_1 128000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 128000 48 testv/stv51MC48c.wav bit ../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_128000_48-48_Binaural_Headrot.tst // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, STEREO out, random FEC at 5% -../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit ../IVAS_dec -fec 5 STEREO 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_stereo_FEC5.tst // Multi-channel 5_1 at 192 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out -../IVAS_cod -mc 5_1 192000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 192000 48 testv/stv51MC48c.wav bit ../IVAS_dec BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_192000_48-48_BinauralRoom.tst // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit ../IVAS_dec MONO 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_mono.tst // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, head rotation -../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot.tst // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out -../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.wav bit ../IVAS_dec 5_1 48 bit testv/stv51MC48c.pcm_MC51_384000_48-48_5_1.tst // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_384000_48-48_Binaural.tst // Multi-channel 5_1 at 192 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -mc 5_1 192000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 192000 48 testv/stv51MC48c.wav bit ../IVAS_dec STEREO 48 bit testv/stv51MC48c.pcm_MC51_192000_48-48_stereo.tst // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.wav bit ../IVAS_dec 7_1_4 48 bit testv/stv51MC48c.pcm_MC51_384000_48-48_7_1_4.tst // Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.wav bit ../IVAS_dec MONO 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_MONO.tst // Multi-channel 7_1_4 at 48 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -mc 7_1_4 48000 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 48000 48 testv/stv714MC48c.wav bit ../IVAS_dec MONO 48 bit testv/stv714MC48c.pcm_MC714_48000_48-48_Mono.tst // Multi-channel 7_1_4 at 64 kbps, 48kHz in, 48kHz out, MONO out, random FEC at 5% -../IVAS_cod -mc 7_1_4 64000 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 64000 48 testv/stv714MC48c.wav bit ../IVAS_dec -fec 5 MONO 48 bit testv/stv714MC48c.pcm_MC714_64000_48-48_MONO_FEC5.tst // Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.wav bit ../IVAS_dec STEREO 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_Stereo.tst // Multi-channel 7_1_4 at 96 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.wav bit ../IVAS_dec STEREO 48 bit testv/stv714MC48c.pcm_MC714_96000_48-48_Stereo.tst // Multi-channel 7_1_4 at 96 kbps, 48kHz in, 48kHz out, 5_1 out, random FEC at 5% -../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.wav bit ../IVAS_dec -fec 5 5_1 48 bit testv/stv714MC48c.pcm_MC714_96000_48-48_5_1_FEC5.tst // Multi-channel 5_1_2 at 32 kbps, 48kHz in, 48kHz out, STEREO out, random FEC at 5% -../IVAS_cod -mc 5_1_2 32000 48 testv/stv512MC48c.pcm bit +../IVAS_cod -mc 5_1_2 32000 48 testv/stv512MC48c.wav bit ../IVAS_dec -fec 5 STEREO 48 bit testv/stv512MC48c.pcm_MC714_32000_48-48_Stereo.tst // Multi-channel 5_1_2 at 80 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -mc 5_1_2 80000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1_2 80000 48 testv/stv51MC48c.wav bit ../IVAS_dec 5_1 48 bit testv/stv512MC48c.pcm_MC512_80000_48-48_5_1.tst // Multi-channel 5_1_2 at 160 kbps, 48kHz in, 48kHz out, 5_1_2 out -../IVAS_cod -mc 5_1_2 160000 48 testv/stv512MC48c.pcm bit +../IVAS_cod -mc 5_1_2 160000 48 testv/stv512MC48c.wav bit ../IVAS_dec 5_1_2 48 bit testv/stv512MC48c.pcm_MC512_160000_48-48_5_1_2.tst // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, Custom LS setup out -../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit ../IVAS_dec testv/ls_setup_16ch_8+4+4.txt 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_MC_custom_setup.tst // Multi-channel 5_1 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit ../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_512000_48-48_MC_Config_renderer.tst // Multi-channel 5_1 at 512 kbps, 48kHz in, 32kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit ../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 32 bit testv/stv51MC48c.pcm_MC51_512000_48-32_MC_Config_renderer.tst // Multi-channel 5_1 at 512 kbps, 48kHz in, 16kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit ../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 16 bit testv/stv51MC48c.pcm_MC51_512000_48-16_MC_Config_renderer.tst // Multi-channel 5_1 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config hospital_patientroom -../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit ../IVAS_dec -render_config testv/config_hospital_patientroom.cfg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_512000_48-48_MC_Config_hospital_patientroom.tst // Multi-channel 5_1 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config recreation -../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit ../IVAS_dec -render_config testv/config_recreation.cfg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_512000_48-48_MC_Config_recreation.tst // Multi-channel 5_1_2 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 5_1_2 512000 48 testv/stv512MC48c.pcm bit +../IVAS_cod -mc 5_1_2 512000 48 testv/stv512MC48c.wav bit ../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 48 bit testv/stv512MC48c.pcm_MC512_512000_48-48_MC_Config_renderer.tst // Multi-channel 5_1_4 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.pcm bit +../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.wav bit ../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 48 bit testv/stv514MC48c.pcm_MC514_512000_48-48_MC_Config_renderer.tst // Multi-channel 7_1_4 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.wav bit ../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 48 bit testv/stv714MC48c.pcm_MC714_512000_48-48_MC_Config_renderer.tst // Multi-channel 5_1 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -mc 5_1 ../scripts/switchPaths/sw_mctech_5fr.bin 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 ../scripts/switchPaths/sw_mctech_5fr.bin 48 testv/stv51MC48c.wav bit ../IVAS_dec 7_1_4 48 bit testv/stv51MC48c.pcm_sw_48-48_7_1_4.tst // Multi-channel 5_1 bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, BINAURAL out, FEC at 10% -../IVAS_cod -mc 5_1 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv51MC48c.wav bit ../IVAS_dec -fec 10 BINAURAL 48 bit testv/stv51MC48c.pcm_sw_48-48_binaural_fec10.tst // Multi-channel 5_1_2 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 16kHz out, BINAURAL_ROOM out -../IVAS_cod -mc 5_1_2 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv512MC48c.pcm bit +../IVAS_cod -mc 5_1_2 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv512MC48c.wav bit ../IVAS_dec BINAURAL_ROOM 16 bit testv/stv512MC48c.pcm_sw_48-16_Binaural_room.tst // Multi-channel 7_1_4 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, HOA3 out -../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_mctech_5fr.bin 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_mctech_5fr.bin 48 testv/stv714MC48c.wav bit ../IVAS_dec HOA3 48 bit testv/stv51MC48c.pcm_sw_48-48_HOA3.tst // Multi-channel 7_1_4 bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 32kHz out, STEREO out, FEC at 5% -../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv714MC48c.wav bit ../IVAS_dec -FEC 5 STEREO 32 bit testv/stv714MC48c.pcm_sw_48-32_stereo.tst // Multi-channel 5_1_4 at 512 kbps, 48kHz in, 16kHz out, BINAURAL_ROOM out (Model from file) -../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.pcm bit +../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.wav bit ../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin BINAURAL_ROOM 16 bit testv/stv51MC48c.pcm_MC51_512000_48-16_MC_binaural_room.tst // Multi-channel 7_1_4 at 512 kbps, 48kHz in, 32kHz out, BINAURAL out (Model from file) -../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.wav bit ../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin BINAURAL 32 bit testv/stv714MC48c.pcm_MC714_512000_48-32_MC_binaural.tst // Multi-channel 5_1_4 at 512 kbps, 48kHz in, 48kHz out, BINAURAL out (Model from file) -../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.pcm bit +../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.wav bit ../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_512000_48-48_MC_binaural.tst // Multi-channel 7_1_4 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out (Model from file) -../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.wav bit ../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin BINAURAL_ROOM 48 bit testv/stv714MC48c.pcm_MC714_512000_48-48_MC_binaural_room.tst + // Stereo downmix to bit-exact EVS at 13200 kbps, 32kHz in, 32kHz out ../IVAS_cod -stereo_dmx_evs 13200 32 testv/stvST32c.pcm bit ../IVAS_dec 32 bit testv/stvST32c.pcm_StereoDmxEVS_13200_32-32.tst // Stereo downmix to bit-exact EVS at 24400 kbps, 48kHz in, 48kHz out -../IVAS_cod -stereo_dmx_evs 24400 48 testv/stvST48c.pcm bit +../IVAS_cod -stereo_dmx_evs 24400 48 testv/stvST48c.wav bit ../IVAS_dec 48 bit testv/stvST48c.pcm_StereoDmxEVS_24400_48-48.tst + // MDCT stereo at 48 kbps, 16 kHz in, 16 kHz out, DTX on, JBM Prof 5 ../IVAS_cod -stereo -dtx 48000 16 testv/stvST16n.pcm bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -Tracefile tracefile_dec -VOIP STEREO 16 netsimoutput testv/stvST16n.pcm_MDCT_48000_16-16_DTX_JBM5.tst // 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, FOA out, JBM Prof 5 -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -Tracefile tracefile_dec -VOIP FOA 48 netsimoutput testv/stv4ISM48s.pcm_32000_48-48_FOA_JBM5.tst @@ -937,6 +946,6 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit ../IVAS_dec -Tracefile tracefile_dec -VOIP HOA3 32 netsimoutput testv/stv3OA32c.pcm_SBA_80000_32-32_HOA3_JBM5.tst // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out, 7_1_4 out, JBM Prof 5 -../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -Tracefile tracefile_dec -VOIP 7_1_4 48 netsimoutput testv/stv51MC48c.pcm_MC51_384000_48-48_7_1_4_JBM5.tst diff --git a/scripts/testv/stv_IVASMASA_1dir1TC.met b/scripts/testv/stv_IVASMASA_1dir1TC.met deleted file mode 100644 index f2ce23bd20..0000000000 --- a/scripts/testv/stv_IVASMASA_1dir1TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6349efe3448d28979b80744bcdc29d57f1c025704939b42d7b913d7fc3f23ccc -size 102300 diff --git a/scripts/testv/stv_IVASMASA_1dir1TC.pcm b/scripts/testv/stv_IVASMASA_1dir1TC.pcm deleted file mode 100644 index 8f2bfc54e0..0000000000 --- a/scripts/testv/stv_IVASMASA_1dir1TC.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4dbbaa5c75c36bc74a100bc5721bc3cf2af4e22e2854a5b85c93532556afc776 -size 288000 diff --git a/scripts/testv/stv_IVASMASA_1dir1TC_DTX.met b/scripts/testv/stv_IVASMASA_1dir1TC_DTX.met deleted file mode 100644 index 945a81f0b4..0000000000 --- a/scripts/testv/stv_IVASMASA_1dir1TC_DTX.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:64b974b376ef0ca29da837d33173c621499d753800ebf5e5587019ee5db481bd -size 684728 diff --git a/scripts/testv/stv_IVASMASA_1dir1TC_DTX.pcm b/scripts/testv/stv_IVASMASA_1dir1TC_DTX.pcm deleted file mode 100644 index b642a34076..0000000000 --- a/scripts/testv/stv_IVASMASA_1dir1TC_DTX.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c45ab47c02eab6c5f9737749a0229c0bc4eed4b6ebe2cf8db077929ec1aa76a2 -size 1927680 diff --git a/scripts/testv/stv_IVASMASA_1dir2TC.met b/scripts/testv/stv_IVASMASA_1dir2TC.met deleted file mode 100644 index 00acdae539..0000000000 --- a/scripts/testv/stv_IVASMASA_1dir2TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5a1f87bfe360dbd221a94583aa68a58ef050e968a63351730d643f2dc2cac4e1 -size 204600 diff --git a/scripts/testv/stv_IVASMASA_1dir2TC.pcm b/scripts/testv/stv_IVASMASA_1dir2TC.pcm deleted file mode 100644 index 491e75f868..0000000000 --- a/scripts/testv/stv_IVASMASA_1dir2TC.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cd34c99b89d9c1ed3514c3f8e32faf6b82fbc8bf364bc464904fc1c745266350 -size 1152000 diff --git a/scripts/testv/stv_IVASMASA_1dir2TC_DTX.met b/scripts/testv/stv_IVASMASA_1dir2TC_DTX.met deleted file mode 100644 index f6e0e439a0..0000000000 --- a/scripts/testv/stv_IVASMASA_1dir2TC_DTX.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2ec41c82c305f075c67b51e1f0a6e97dfc272bafcfca64e38c902c9f0d2c4500 -size 684728 diff --git a/scripts/testv/stv_IVASMASA_1dir2TC_DTX.pcm b/scripts/testv/stv_IVASMASA_1dir2TC_DTX.pcm deleted file mode 100644 index 34f827e55b..0000000000 --- a/scripts/testv/stv_IVASMASA_1dir2TC_DTX.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:04fe84511787c1577f2886bae5ee440fd3a7692381e119dab714aed70ff16466 -size 3855360 diff --git a/scripts/testv/stv_IVASMASA_2dir1TC.met b/scripts/testv/stv_IVASMASA_2dir1TC.met deleted file mode 100644 index 6468877408..0000000000 --- a/scripts/testv/stv_IVASMASA_2dir1TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d125a4c4e3989ac55f9c2617f464431feae4ede9b2e15d087d3271c0a4a56303 -size 319800 diff --git a/scripts/testv/stv_IVASMASA_2dir1TC.pcm b/scripts/testv/stv_IVASMASA_2dir1TC.pcm deleted file mode 100644 index 7c7209de2d..0000000000 --- a/scripts/testv/stv_IVASMASA_2dir1TC.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5afc7014451a8599f8399e3a503a29b23d22843ef482c0a701d4c46f6329ebc4 -size 576000 diff --git a/scripts/testv/stv_IVASMASA_2dir2TC.met b/scripts/testv/stv_IVASMASA_2dir2TC.met deleted file mode 100644 index 1b62022af5..0000000000 --- a/scripts/testv/stv_IVASMASA_2dir2TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2eb412d646d7a32c77413dea54dc44cf45dc49e6d8c2de19abe4f4b93a91fa4a -size 159900 diff --git a/scripts/testv/stv_IVASMASA_2dir2TC.pcm b/scripts/testv/stv_IVASMASA_2dir2TC.pcm deleted file mode 100644 index ac8d4d341a..0000000000 --- a/scripts/testv/stv_IVASMASA_2dir2TC.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5d6c264295987b7db2a9a6a1352dd0b9c91a824fcc37c5631e0ba39e92df33f8 -size 576000 diff --git a/scripts/testv/test_FOA.wav b/scripts/testv/test_FOA.wav deleted file mode 100644 index fd654bb7ed..0000000000 --- a/scripts/testv/test_FOA.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9299bbe0637a72ab5419febfff4614066bda4ed8a58ffed19d068d17d4df46e0 -size 7680330 diff --git a/scripts/testv/test_HOA2.wav b/scripts/testv/test_HOA2.wav deleted file mode 100644 index e076c35ab8..0000000000 --- a/scripts/testv/test_HOA2.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:daa96c69bcf085746add3c41db6e2082e1c691c1bf5ad85a8a815b0155caffe4 -size 17280580 diff --git a/scripts/testv/test_HOA3.wav b/scripts/testv/test_HOA3.wav deleted file mode 100644 index 811f8b5803..0000000000 --- a/scripts/testv/test_HOA3.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fef816a7ca44d528ff6d56c431fbd81a82b4cae5c7bd86c7770493427e9d3ffc -size 30720930 diff --git a/scripts/testv/test_ISM_1obj.wav b/scripts/testv/test_ISM_1obj.wav deleted file mode 100644 index b75df181b2..0000000000 --- a/scripts/testv/test_ISM_1obj.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6ecc1d851c8c7f7ecf41e1b16abf01d35d37389584128537181add6f55530a9f -size 2880106 diff --git a/scripts/testv/test_ISM_2obj.wav b/scripts/testv/test_ISM_2obj.wav deleted file mode 100644 index a185618ec7..0000000000 --- a/scripts/testv/test_ISM_2obj.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:41825bb3378c8a9657bc3ae4dbebda7a54591f5a7aae6de7f4c6cf077e9c8df0 -size 5760106 diff --git a/scripts/testv/test_ISM_3obj.wav b/scripts/testv/test_ISM_3obj.wav deleted file mode 100644 index 2ce3343535..0000000000 --- a/scripts/testv/test_ISM_3obj.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:235749b6b4f6e76c4dccbd8d9ece32bf979ce8b77b7ca4402bb5ca8c159f8acc -size 8640130 diff --git a/scripts/testv/test_ISM_4obj.wav b/scripts/testv/test_ISM_4obj.wav deleted file mode 100644 index e50b2d5cbd..0000000000 --- a/scripts/testv/test_ISM_4obj.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:98bfb96a3b238a3e4004c07644932d35571f42d566f3278a6cf4bf6b080c1d1a -size 11520130 diff --git a/scripts/testv/test_MASA_1dir1TC.met b/scripts/testv/test_MASA_1dir1TC.met deleted file mode 100644 index f2ce23bd20..0000000000 --- a/scripts/testv/test_MASA_1dir1TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6349efe3448d28979b80744bcdc29d57f1c025704939b42d7b913d7fc3f23ccc -size 102300 diff --git a/scripts/testv/test_MASA_1dir1TC.wav b/scripts/testv/test_MASA_1dir1TC.wav deleted file mode 100644 index 9291feeee3..0000000000 --- a/scripts/testv/test_MASA_1dir1TC.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:54ea4543e4d6d43c312f1e461a75a3d8ce18e34bfb5777f15f2e494dd277d2e5 -size 288106 diff --git a/scripts/testv/test_MASA_1dir2TC.met b/scripts/testv/test_MASA_1dir2TC.met deleted file mode 100644 index 00acdae539..0000000000 --- a/scripts/testv/test_MASA_1dir2TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5a1f87bfe360dbd221a94583aa68a58ef050e968a63351730d643f2dc2cac4e1 -size 204600 diff --git a/scripts/testv/test_MASA_1dir2TC.wav b/scripts/testv/test_MASA_1dir2TC.wav deleted file mode 100644 index aefec77efe..0000000000 --- a/scripts/testv/test_MASA_1dir2TC.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ab7437cdf41e56338c93f5e593118a112a48bae5138be2cdd301eff5da59bb06 -size 1152106 diff --git a/scripts/testv/test_MASA_2dir1TC.met b/scripts/testv/test_MASA_2dir1TC.met deleted file mode 100644 index 6468877408..0000000000 --- a/scripts/testv/test_MASA_2dir1TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d125a4c4e3989ac55f9c2617f464431feae4ede9b2e15d087d3271c0a4a56303 -size 319800 diff --git a/scripts/testv/test_MASA_2dir1TC.wav b/scripts/testv/test_MASA_2dir1TC.wav deleted file mode 100644 index c80192b76b..0000000000 --- a/scripts/testv/test_MASA_2dir1TC.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b45ecb01efdc7a5d9877c9adcee2aad632ffde326dbc76554cb0452a78e3954d -size 576106 diff --git a/scripts/testv/test_MASA_2dir2TC.met b/scripts/testv/test_MASA_2dir2TC.met deleted file mode 100644 index 1b62022af5..0000000000 --- a/scripts/testv/test_MASA_2dir2TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2eb412d646d7a32c77413dea54dc44cf45dc49e6d8c2de19abe4f4b93a91fa4a -size 159900 diff --git a/scripts/testv/test_MASA_2dir2TC.wav b/scripts/testv/test_MASA_2dir2TC.wav deleted file mode 100644 index 0f72267ea0..0000000000 --- a/scripts/testv/test_MASA_2dir2TC.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a5a0379965053087ef1ce4775c85384e8c06aaa8161f12888f5e5c06d8612c1f -size 576106 diff --git a/scripts/testv/test_MC51.wav b/scripts/testv/test_MC51.wav deleted file mode 100644 index 334d819745..0000000000 --- a/scripts/testv/test_MC51.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3a077210fb3ab4f4a8f04ab37a7813e474f3dfb3dbd927b71484e03986cb042a -size 11520130 diff --git a/scripts/testv/test_MC51p2.wav b/scripts/testv/test_MC51p2.wav deleted file mode 100644 index e696a7dae6..0000000000 --- a/scripts/testv/test_MC51p2.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d056d0c1b412c1e8507872212f18bf333a91aac17358eae6a59c7a76f1bb0aaf -size 2304130 diff --git a/scripts/testv/test_MC51p4.wav b/scripts/testv/test_MC51p4.wav deleted file mode 100644 index 3d1c7812a4..0000000000 --- a/scripts/testv/test_MC51p4.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:eddaf145410ca04daba554a719c58ed391159c7d73e6ea140d2b5de250929366 -size 2880130 diff --git a/scripts/testv/test_MC71.wav b/scripts/testv/test_MC71.wav deleted file mode 100644 index 2a0b012ab0..0000000000 --- a/scripts/testv/test_MC71.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d0ac38ddb16b2ce9cbca27965c5aedaf1af857a6fdce340bc01322794311e92d -size 2304130 diff --git a/scripts/testv/test_MC71p4.wav b/scripts/testv/test_MC71p4.wav deleted file mode 100644 index 9d0c1e594e..0000000000 --- a/scripts/testv/test_MC71p4.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e1f3fa943f86082be69a774280379f179f4bd51f221ee7aad6471c0310a9f4ab -size 3456130 diff --git a/scripts/testv/test_mono.wav b/scripts/testv/test_mono.wav deleted file mode 100644 index b841d174c3..0000000000 --- a/scripts/testv/test_mono.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5daeac3fb92d487fc7ded7d1a4a9e6295d2f2f27f59f19dcdaeebaae01908a86 -size 1920106 diff --git a/scripts/testv/test_stereo.wav b/scripts/testv/test_stereo.wav deleted file mode 100644 index 70dc46062e..0000000000 --- a/scripts/testv/test_stereo.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e0de400200071a7b26de03eaef88b49efce7a5df813b971336ed17b90ba02aa2 -size 3840106 -- GitLab From 18cfa9274cb9cedda5b00f5867b6785ae5f567fc Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Feb 2023 15:42:46 +0100 Subject: [PATCH 076/375] harmonization of core decoder set-up --- lib_com/ivas_prot.h | 2 +- lib_dec/ivas_dec.c | 4 +-- lib_dec/ivas_ism_dtx_dec.c | 62 ++++++++++----------------------- lib_dec/ivas_ism_metadata_dec.c | 14 ++++---- lib_dec/ivas_sce_dec.c | 17 --------- lib_dec/ivas_stat_dec.h | 7 ++-- 6 files changed, 33 insertions(+), 73 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 9df513e4e1..4ece1a03b8 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -879,7 +879,7 @@ ivas_error ivas_ism_metadata_dec( int16_t nb_bits_metadata[], /* o : number of metadata bits */ ISM_MODE ism_mode, /* i : ISM mode */ #ifdef DISCRETE_ISM_DTX_CNG - int16_t *ism_dtx_hangover_cnt, /* i/o: DTX hangover counter */ + ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ #endif const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ ); diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 2098e1f157..d09ca85ad2 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -152,7 +152,7 @@ ivas_error ivas_dec( if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { #ifdef DISCRETE_ISM_DTX_CNG - ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, &( st_ivas->ism_dtx_hangover_cnt ), st_ivas->hDirAC->hParamIsm ); + ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ); #else ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); #endif @@ -160,7 +160,7 @@ ivas_error ivas_dec( else /* ISM_MODE_DISC */ { #ifdef DISCRETE_ISM_DTX_CNG - ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, &( st_ivas->ism_dtx_hangover_cnt ), NULL ); + ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL ); #else ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, NULL ); #endif diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 5ca201eec2..8862a38d28 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -61,9 +61,11 @@ static void ivas_ism_preprocessing( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; +#ifndef DISCRETE_ISM_DTX_CNG if ( ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) ) +#endif { - /* reset the bitstream to atleast read the cng type and bandwidth for non transmitted SCE */ + /* reset the bitstream to at least read the cng type and bandwidth for non transmitted SCE */ st->bit_stream = st_ivas->hSCE[0]->hCoreCoder[0]->bit_stream; if ( sce_id == st_ivas->hISMDTX.sce_id_dtx ) @@ -77,10 +79,12 @@ static void ivas_ism_preprocessing( st->cng_paramISM_flag = 1; } +#ifndef DISCRETE_ISM_DTX_CNG else { st->cng_paramISM_flag = 0; } +#endif return; } @@ -101,7 +105,7 @@ ivas_error ivas_ism_dtx_dec( int32_t ivas_total_brate; #ifdef DISCRETE_ISM_DTX_CNG int16_t md_diff_flag[MAX_NUM_OBJECTS]; - int16_t flag_noisy_speech, sce_id; + int16_t flag_noisy_speech, sce_id_dtx; #endif ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -159,30 +163,16 @@ ivas_error ivas_ism_dtx_dec( /* Metadata decoding and dequantization */ #ifdef DISCRETE_ISM_DTX_CNG ivas_ism_metadata_sid_dec( st_ivas->hSCE, ivas_total_brate, st_ivas->bfi, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, - &flag_noisy_speech, &sce_id, st_ivas->hIsmMetaData, nb_bits_metadata ); + &flag_noisy_speech, &sce_id_dtx, st_ivas->hIsmMetaData, nb_bits_metadata ); if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) { - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + if ( st_ivas->hDirAC != NULL ) { st_ivas->hDirAC->hParamIsm->flag_noisy_speech = flag_noisy_speech; } - } - if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) - { - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) - { - st_ivas->hISMDTX.sce_id_dtx = sce_id; - } - else /* ism_mode == ISM_MODE_DISC */ - { - for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) - { - st_ivas->hSCE[ch]->hCoreCoder[0]->read_sid_info = 0; - } - st_ivas->hSCE[sce_id]->hCoreCoder[0]->read_sid_info = 1; - } + st_ivas->hISMDTX.sce_id_dtx = sce_id_dtx; } #else ivas_param_ism_metadata_dtx_dec( st_ivas ); @@ -202,44 +192,30 @@ ivas_error ivas_ism_dtx_dec( update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); - st_ivas->ism_dtx_hangover_cnt = 0; - - if ( st_ivas->ism_mode != ISM_MODE_PARAM ) // VE!!!!! - { - /* set core_brate for all channels */ - for ( ch = 0; ch < num_obj; ch++ ) - { - st_ivas->hSCE[ch]->hCoreCoder[0]->core_brate = FRAME_NO_DATA; - } - - if ( ivas_total_brate == IVAS_SID_5k2 ) - { - st_ivas->hSCE[0]->hCoreCoder[0]->core_brate = SID_2k40; - } - } + st_ivas->hISMDTX.ism_dtx_hangover_cnt = 0; #endif for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) { +#ifdef DISCRETE_ISM_DTX_CNG + nb_bits_metadata[ch] = nb_bits_metadata[sce_id_dtx]; +#else nb_bits_metadata[ch] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; +#endif } +#ifdef DISCRETE_ISM_DTX_CNG + if ( !st_ivas->bfi ) +#else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) +#endif { for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) { ivas_ism_preprocessing( st_ivas, ch ); } } -#ifdef DISCRETE_ISM_DTX_CNG - else - { - for ( ch = 1; ch < st_ivas->nchan_transport; ch++ ) - { - nb_bits_metadata[ch] = nb_bits_metadata[0]; - } - } -#endif + return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 6d53b3b5dc..d9db83cdab 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -141,7 +141,7 @@ ivas_error ivas_ism_metadata_dec( int16_t nb_bits_metadata[], /* o : number of metadata bits */ ISM_MODE ism_mode, /* i : ISM mode */ #ifdef DISCRETE_ISM_DTX_CNG - int16_t *ism_dtx_hangover_cnt, /* i/o: DTX hangover counter */ + ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ #endif const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ ) @@ -545,14 +545,14 @@ ivas_error ivas_ism_metadata_dec( } #ifdef DISCRETE_ISM_DTX_CNG - if ( *ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) + if ( hISMDTX.ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) { #ifdef MD_SMOOTH_PARAM_BE if ( ism_mode != ISM_MODE_PARAM ) #endif ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); } - *ism_dtx_hangover_cnt = min( ( *ism_dtx_hangover_cnt )++, IVAS_ISM_DTX_HO_MAX ); + hISMDTX.ism_dtx_hangover_cnt = min( ( hISMDTX.ism_dtx_hangover_cnt )++, IVAS_ISM_DTX_HO_MAX ); #endif /*----------------------------------------------------------------* @@ -668,7 +668,7 @@ ivas_error create_ism_metadata_dec( ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); #ifdef DISCRETE_ISM_DTX_CNG - st_ivas->ism_dtx_hangover_cnt = IVAS_ISM_DTX_HO_MAX; + st_ivas->hISMDTX.ism_dtx_hangover_cnt = IVAS_ISM_DTX_HO_MAX; #endif return IVAS_ERR_OK; @@ -797,9 +797,6 @@ ivas_error ivas_ism_metadata_sid_dec( if ( !bfi ) { - /* take into account padding bits as metadata bits to keep later bitrate checks valid */ - nb_bits_metadata[0] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; - /*----------------------------------------------------------------* * ISm common signaling *----------------------------------------------------------------*/ @@ -948,6 +945,9 @@ ivas_error ivas_ism_metadata_sid_dec( } } + /* take into account padding bits as metadata bits to keep later bitrate checks valid */ + nb_bits_metadata[*sce_id_dtx] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; + /* set the bitstream pointer to its original position */ st0->bit_stream = bstr_orig; st0->next_bit_pos = next_bit_pos_orig; diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index cdf6cbb875..7afbe5dc03 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -82,23 +82,6 @@ ivas_error ivas_sce_dec( { st->cng_type = FD_CNG; /* TODO: move to init if possible */ } - -#ifdef DISCRETE_ISM_DTX_CNG - // VE!!!!! - if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_DISC && st_ivas->nchan_transport > 1 ) // VE!!!!! keep bitexactness for 1ISM case for now - { - if ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) - { - /* reset the bitstream to at least read the cng type and bandwidth for non transmitted SCE */ - st->bit_stream = st_ivas->hSCE[0]->hCoreCoder[0]->bit_stream; - st->cng_paramISM_flag = 1; - } - else - { - st->cng_paramISM_flag = 0; - } - } -#endif #endif /*------------------------------------------------------------------* diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 3b0e99c4c2..a6b3f975c5 100755 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -424,6 +424,10 @@ typedef struct int16_t dtx_flag; int16_t sce_id_dtx; +#ifdef DISCRETE_ISM_DTX_CNG + int16_t ism_dtx_hangover_cnt; /* hangover counter for ISM DTX decoder */ +#endif + } ISM_DTX_DATA_DEC; #endif @@ -1968,9 +1972,6 @@ typedef struct Decoder_Struct int16_t sba_planar; /* Ambisonic (SBA) planar flag */ int16_t sba_analysis_order; /* Ambisonic (SBA) order used for analysis and coding */ int16_t sba_dirac_stereo_flag; /* flag indicating stereo output for SBA DirAC modes with 1 TC */ -#ifdef DISCRETE_ISM_DTX_CNG - int16_t ism_dtx_hangover_cnt; /* hangover counter for ISM DTX decoder */ -#endif /* rendering modules */ RENDERER_TYPE renderer_type; /* renderer type */ -- GitLab From f9152c1a0a7615c76b7fcd39c241f2196973a551 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Feb 2023 15:59:20 +0100 Subject: [PATCH 077/375] changes and cleaning under DTX_PARAM_BE --- lib_com/ivas_prot.h | 4 ---- lib_dec/ivas_ism_dtx_dec.c | 1 - lib_enc/ivas_ism_dtx_enc.c | 11 ----------- lib_enc/ivas_ism_enc.c | 23 ++++++++++------------- 4 files changed, 10 insertions(+), 29 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 4ece1a03b8..a52cb8723a 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -968,10 +968,6 @@ int16_t ivas_ism_dtx_enc_COMMON( ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ int16_t md_diff_flag[], /* o : metadata differential flag */ int16_t *sid_flag /* o : indication of SID frame */ -#ifdef MD_Q_PARAM_BE - , - const ISM_MODE ism_mode -#endif ); #endif /*! r: indication of DTX frame */ diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 8862a38d28..85a0ee085c 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -216,7 +216,6 @@ ivas_error ivas_ism_dtx_dec( } } - return IVAS_ERR_OK; } #endif diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index fc8867a5b0..bd276f2206 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -113,10 +113,6 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ int16_t md_diff_flag[], /* o : metadata differential flag */ int16_t *sid_flag /* o : indication of SID frame */ -#ifdef MD_Q_PARAM_BE - , - const ISM_MODE ism_mode -#endif ) { int16_t ch, dtx_flag; @@ -184,13 +180,6 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end md_diff_flag[ch] = 1; } -#ifdef MD_Q_PARAM_BE - if ( ism_mode == ISM_MODE_PARAM ) - { - md_diff_flag[ch] = 1; - } -#endif - /* estimate SID metadata bit-budget */ nBits++; /* number of objects */ nBits++; /* SID metadata flag */ diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index b2dfde3782..3cca1e4099 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -196,12 +196,6 @@ ivas_error ivas_ism_enc( } vad_flag[sce_id] = st->vad_flag; -#ifdef DTX_PARAM_BE - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) - { - vad_flag[sce_id] = vad_flag_dtx[sce_id][0]; - } -#endif } #ifdef PARAM_ISM_DTX_CNG @@ -219,19 +213,22 @@ ivas_error ivas_ism_enc( ivas_ism_get_sce_id_dtx( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->nchan_transport, input_frame ); /* analysis and decision about DTX */ -#ifdef DISCRETE_ISM_DTX_CNG // VE!!!!! to be harmonized +#ifdef DISCRETE_ISM_DTX_CNG +#ifdef DTX_PARAM_BE if ( st_ivas->ism_mode != ISM_MODE_PARAM ) { - dtx_flag = ivas_ism_dtx_enc_COMMON( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag -#ifdef MD_Q_PARAM_BE - , - st_ivas->ism_mode #endif - ); + dtx_flag = ivas_ism_dtx_enc_COMMON( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); +#ifdef DTX_PARAM_BE } else -#endif + { dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); + } +#endif +#else + dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); +#endif if ( sid_flag ) { -- GitLab From 76e479a8d1d2429cc3ee445c8bf0f5505edef771 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Feb 2023 10:25:12 +0100 Subject: [PATCH 078/375] debugging files under DEBUG_MODE_PARAM_ISM --- lib_com/options.h | 4 ++-- lib_enc/ivas_ism_enc.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index fc8b89be6e..537a4c854f 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ +#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ @@ -67,7 +67,7 @@ /*#define DEBUG_MODE_DIRAC*/ /* output most important DIRAC parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_MDCT*/ /* output most important MDCT parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_PARAM_MC */ /* output Parametric MC paramters to the subdirectory "res/" */ -/*#define DEBUG_MODE_PARAM_ISM*/ /* output Parametric ISM paramters to the subdirectory "res/" */ +#define DEBUG_MODE_PARAM_ISM /* output Parametric ISM paramters to the subdirectory "res/" */ /*#define DEBUG_MODE_INFO_TWEAK*/ /* enable command line switch to specify subdirectory for debug info output inside "./res/" */ /*#define DEBUG_MODE_INFO_PLC */ /* define to output PLC related parameters */ /*#define DEBUG_MODE_INFO_ALLRAD*/ /* define to output generated HOA decoding mtx */ diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 3cca1e4099..3bae42eeaa 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -240,6 +240,8 @@ ivas_error ivas_ism_enc( if ( st_ivas->hDirAC != NULL ) dbgwrite( &( st_ivas->hDirAC->hParamIsm->flag_noisy_speech ), sizeof( int16_t ), 1, 1, "./res/ParamISM_noisy_speech_flag_enc.dat" ); dbgwrite( &( st_ivas->hISMDTX->dtx_flag ), sizeof( int16_t ), 1, 1, "./res/ParamISM_DTX_CNG_flag_enc.dat" ); + dbgwrite( &( st_ivas->hISMDTX->sce_id_dtx ), sizeof( int16_t ), 1, input_frame, "./res/sce_id_dtx" ); + dbgwrite( &( dtx_flag ), sizeof( int16_t ), 1, input_frame, "./res/dtx_flag" ); #endif } #endif -- GitLab From ba9f036823a23998e00983098ac6bc2f859f3fa9 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Feb 2023 17:49:24 +0100 Subject: [PATCH 079/375] =?UTF-8?q?-=20for=20DTX=20decision,=20use=20?= =?UTF-8?q?=E2=80=98vad=5Fflag=5Fdtx=E2=80=99=20instead=20of=20=E2=80=98va?= =?UTF-8?q?d=5Fflag=E2=80=99;=20under=20DISCRETE=5FISM=5FDTX=5FCNG;=20BE?= =?UTF-8?q?=20for=20paramISM,=20non-BE=20for=20discISM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib_enc/ivas_ism_enc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 3bae42eeaa..aca2fa9f1b 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -195,7 +195,16 @@ ivas_error ivas_ism_enc( return error; } - vad_flag[sce_id] = st->vad_flag; +#ifdef DISCRETE_ISM_DTX_CNG + if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) + { + vad_flag[sce_id] = vad_flag_dtx[sce_id][0]; + } + else +#endif + { + vad_flag[sce_id] = st->vad_flag; + } } #ifdef PARAM_ISM_DTX_CNG -- GitLab From 918014bcfeaf1aac1d84739824ca67ea13de0aed Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Feb 2023 18:15:53 +0100 Subject: [PATCH 080/375] deactivate DTX_PARAM_BE; non-BE for paramISM --- lib_com/ivas_prot.h | 6 ++++++ lib_com/options.h | 2 +- lib_enc/ivas_ism_dtx_enc.c | 10 +++++++--- lib_enc/ivas_ism_enc.c | 5 +++-- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c248646213..9cf3f0cfca 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -929,7 +929,11 @@ ivas_error ivas_ism_dtx_open( #ifdef DISCRETE_ISM_DTX_CNG /*! r: indication of DTX frame */ +#ifdef DTX_PARAM_BE int16_t ivas_ism_dtx_enc_COMMON( +#else +int16_t ivas_ism_dtx_enc( +#endif ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ const int16_t num_obj, /* i : number of objects */ @@ -940,11 +944,13 @@ int16_t ivas_ism_dtx_enc_COMMON( int16_t *sid_flag /* o : indication of SID frame */ ); #endif +#if ( !defined DISCRETE_ISM_DTX_CNG || defined DTX_PARAM_BE ) /*! r: indication of DTX frame */ int16_t ivas_ism_dtx_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ int16_t *sid_flag /* o : indication of SID frame */ ); +#endif ivas_error ivas_ism_dtx_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ diff --git a/lib_com/options.h b/lib_com/options.h index 73af6cd45a..e6156d6f9e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -184,7 +184,7 @@ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ #define MD_Q_PARAM_BE #define MD_SMOOTH_PARAM_BE -#define DTX_PARAM_BE +/*#define DTX_PARAM_BE*/ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 7b94e84dc0..aac58ff1cf 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -104,7 +104,11 @@ ivas_error ivas_ism_dtx_open( *-------------------------------------------------------------------*/ /*! r: indication of DTX frame */ -int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end +#ifdef DTX_PARAM_BE +int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end +#else +int16_t ivas_ism_dtx_enc( +#endif ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ const int16_t num_obj, /* i : number of objects */ @@ -276,7 +280,7 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end } #endif - +#if ( !defined DISCRETE_ISM_DTX_CNG || defined DTX_PARAM_BE ) /*-------------------------------------------------------------------* * ivas_ism_dtx_enc() * @@ -411,7 +415,7 @@ int16_t ivas_ism_dtx_enc( return dtx_flag; } - +#endif /*-------------------------------------------------------------------* * ivas_ism_get_sce_id_dtx() diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index aca2fa9f1b..8a0a97aab0 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -226,15 +226,16 @@ ivas_error ivas_ism_enc( #ifdef DTX_PARAM_BE if ( st_ivas->ism_mode != ISM_MODE_PARAM ) { -#endif dtx_flag = ivas_ism_dtx_enc_COMMON( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); -#ifdef DTX_PARAM_BE } else { dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); } +#else + dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); #endif + #else dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); #endif -- GitLab From 605e13eec0bc79a6d5eca34ea8a9aef4d09126cc Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Feb 2023 20:16:11 +0100 Subject: [PATCH 081/375] introduce UNIFY_MD_QUANTIZER --- lib_com/ivas_cnst.h | 11 +++++ lib_com/ivas_ism_config.c | 88 +++++++++++++++++++++++++++++++-- lib_com/ivas_prot.h | 21 ++++++++ lib_com/options.h | 1 + lib_dec/ivas_ism_metadata_dec.c | 34 +++++++++++-- lib_dec/ivas_ism_param_dec.c | 5 ++ lib_enc/ivas_ism_dtx_enc.c | 7 +++ lib_enc/ivas_ism_metadata_enc.c | 30 ++++++++++- lib_enc/ivas_ism_param_enc.c | 8 +++ 9 files changed, 197 insertions(+), 8 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index c45b4e6275..787ba95e27 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -340,9 +340,20 @@ typedef enum #else #define PARAM_ISM_DTX_COH_SCA_BITS 4 #endif +#if (defined DISCRETE_ISM_DTX_CNG && defined UNIFY_MD_QUANTIZER ) +#define ISM_DTX_AZI_BITS_HIGH 8 +#define ISM_DTX_ELE_BITS_HIGH 7 +#define ISM_Q_STEP_HIGH (ISM_Q_STEP / 2) +#define ISM_Q_STEP_BORDER_HIGH (ISM_Q_STEP_BORDER / 2) +#define ISM_DTX_AZI_BITS_LOW 6 +#define ISM_DTX_ELE_BITS_LOW 5 +#define ISM_Q_STEP_LOW (ISM_Q_STEP * 2) +#define ISM_Q_STEP_BORDER_LOW (ISM_Q_STEP_BORDER * 2) +#else #define PARAM_ISM_DTX_AZI_BITS 5 #define PARAM_ISM_DTX_ELE_BITS 4 #endif +#endif #ifdef DISCRETE_ISM_DTX_CNG #define ISM_DTX_ENER_BITS 4 #define ISM_DTX_COH_SCA_BITS 4 diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 16c6c9243a..30d16a04f2 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -359,12 +359,36 @@ int16_t ism_quant_meta( const float val, /* i : scalar value to quantize */ float *valQ, /* o : quantized value */ const float borders[], /* i : level borders */ - const int16_t cbsize /* i : codebook size */ +#ifdef UNIFY_MD_QUANTIZER + const float q_step, /* i : quantization step */ + const float q_step_border, /* i : quantization step at the border */ +#endif + const int16_t cbsize /* i : codebook size */ ) { int16_t idx, idx_start; float qlow, step; +#ifdef UNIFY_MD_QUANTIZER + if ( val <= borders[1] ) + { + qlow = borders[0]; + idx_start = 0; + step = q_step_border; + } + else if ( val <= borders[2] ) + { + qlow = borders[1]; + idx_start = (int16_t) ( ( borders[1] - borders[0] ) / q_step_border ); + step = q_step; + } + else + { + qlow = borders[2]; + idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ); + step = q_step_border; + } +#else if ( val <= borders[1] ) { qlow = borders[0]; @@ -383,6 +407,7 @@ int16_t ism_quant_meta( idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / ISM_Q_STEP_BORDER ); step = ISM_Q_STEP_BORDER; } +#endif idx = idx_start + (int16_t) max( 0.f, min( cbsize - 1, ( ( val - qlow ) / step + 0.5f ) ) ); *valQ = ( idx - idx_start ) * step + qlow; @@ -401,12 +426,36 @@ int16_t ism_quant_meta( float ism_dequant_meta( const int16_t idx, /* i : quantizer index */ const float borders[], /* i : level borders */ - const int16_t cbsize /* i : codebook size */ +#ifdef UNIFY_MD_QUANTIZER + const float q_step, /* i : quantization step */ + const float q_step_border, /* i : quantization step at the border */ +#endif + const int16_t cbsize /* i : codebook size */ ) { int16_t idx_start; float qlow, step, valQ; +#ifdef UNIFY_MD_QUANTIZER + if ( idx <= ( borders[1] - borders[0] ) / q_step_border ) + { + qlow = borders[0]; + idx_start = 0; + step = q_step_border; + } + else if ( idx <= cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ) + { + qlow = borders[1]; + idx_start = (int16_t) ( ( borders[1] - borders[0] ) / q_step_border ); + step = q_step; + } + else + { + qlow = borders[2]; + idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ); + step = q_step_border; + } +#else if ( idx <= ( borders[1] - borders[0] ) / ISM_Q_STEP_BORDER ) { qlow = borders[0]; @@ -425,6 +474,7 @@ float ism_dequant_meta( idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / ISM_Q_STEP_BORDER ); step = ISM_Q_STEP_BORDER; } +#endif valQ = ( idx - idx_start ) * step + qlow; @@ -439,8 +489,7 @@ float ism_dequant_meta( * ---------------------------------------------------------------*/ void ivas_param_ism_config( - PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: IVAS Param ISM Config Structure */ -) + PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: IVAS Param ISM Config Structure */ ) { int16_t i, num_obj; @@ -526,6 +575,36 @@ void update_last_metadata( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ +#ifdef UNIFY_MD_QUANTIZER +void ivas_get_ism_sid_quan_bitbudget( + const int16_t num_obj, /* i : number of objects */ + int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ + int16_t *nBits_elevation, /* o : number of Q bits for elevation */ + float *q_step, /* o : quantization step */ + float *q_step_border, /* o : quantization step at the border */ + int16_t *nBits_coh, /* o : number of Q bits for coherence */ + int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ +) +{ + *nBits_azimuth = ISM_DTX_AZI_BITS_HIGH; + *nBits_elevation = ISM_DTX_ELE_BITS_HIGH; + *q_step = ISM_Q_STEP_HIGH; + *q_step_border = ISM_Q_STEP_BORDER_HIGH; + *nBits_coh = ISM_DTX_COH_SCA_BITS; + *nBits_sce_id = 1; + + if ( num_obj >= 3 ) + { + *nBits_azimuth = ISM_DTX_AZI_BITS_LOW; + *nBits_elevation = ISM_DTX_ELE_BITS_LOW; + *q_step = ISM_Q_STEP_LOW; + *q_step_border = ISM_Q_STEP_BORDER_LOW; + *nBits_sce_id = 2; + } + + return; +} +#else /*! r: low resolution flag */ int16_t ivas_get_ism_sid_quan_bitbudget( const int16_t num_obj, /* i : number of objects */ @@ -554,3 +633,4 @@ int16_t ivas_get_ism_sid_quan_bitbudget( return low_res_q; } #endif +#endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 9cf3f0cfca..380a945d86 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -793,6 +793,10 @@ int16_t ism_quant_meta( const float val, /* i : scalar value to quantize */ float *valQ, /* o : quantized value */ const float borders[], /* i : level borders */ +#ifdef UNIFY_MD_QUANTIZER + const float q_step, /* i : quantization step */ + const float q_step_border, /* i : quantization step at the border */ +#endif const int16_t cbsize /* i : codebook size */ ); @@ -800,6 +804,10 @@ int16_t ism_quant_meta( float ism_dequant_meta( const int16_t idx, /* i : quantizer index */ const float borders[], /* i : level borders */ +#ifdef UNIFY_MD_QUANTIZER + const float q_step, /* i : quantization step */ + const float q_step_border, /* i : quantization step at the border */ +#endif const int16_t cbsize /* i : codebook size */ ); @@ -1023,6 +1031,18 @@ void update_last_metadata( const int16_t updt_flag[] /* i : last metadata update flag */ ); +#ifdef UNIFY_MD_QUANTIZER +/*! r: low resolution flag */ +void ivas_get_ism_sid_quan_bitbudget( + const int16_t num_obj, /* i : number of objects */ + int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ + int16_t *nBits_elevation, /* o : number of Q bits for elevation */ + float *q_step, /* o : quantization step */ + float *q_step_border, /* o : quantization step at the border */ + int16_t *nBits_coh, /* o : number of Q bits for coherence */ + int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ +); +#else /*! r: low resolution flag */ int16_t ivas_get_ism_sid_quan_bitbudget( const int16_t num_obj, /* i : number of objects */ @@ -1033,6 +1053,7 @@ int16_t ivas_get_ism_sid_quan_bitbudget( ); #endif #endif +#endif /*----------------------------------------------------------------------------------* * DFT Stereo prototypes diff --git a/lib_com/options.h b/lib_com/options.h index e6156d6f9e..ceb443d363 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -185,6 +185,7 @@ #define MD_Q_PARAM_BE #define MD_SMOOTH_PARAM_BE /*#define DTX_PARAM_BE*/ +#define UNIFY_MD_QUANTIZER /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index d9db83cdab..dc453f678a 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -376,7 +376,11 @@ ivas_error ivas_ism_metadata_dec( } else /* ISM_MODE_DISC */ { +#ifdef UNIFY_MD_QUANTIZER + hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); +#else hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); +#endif } /*----------------------------------------------------------------* @@ -438,7 +442,11 @@ ivas_error ivas_ism_metadata_dec( } else /* ISM_MODE_DISC */ { +#ifdef UNIFY_MD_QUANTIZER + hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#else hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); +#endif } /*----------------------------------------------------------------* @@ -611,7 +619,7 @@ ivas_error ivas_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG /*----------------------------------------------------------------* - * Updates + * Updates *----------------------------------------------------------------*/ set_s( md_diff_flag, 1, num_obj ); @@ -676,6 +684,7 @@ ivas_error create_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG +#ifndef UNIFY_MD_QUANTIZER /*-------------------------------------------------------------------* * ivas_ism_dec_dequantize_DOA_dtx() * @@ -737,7 +746,7 @@ static void ivas_ism_dec_dequantize_DOA_dtx( return; } - +#endif /*-------------------------------------------------------------------* * ivas_ism_metadata_sid_dec() @@ -758,7 +767,12 @@ ivas_error ivas_ism_metadata_sid_dec( int16_t nb_bits_metadata[] /* o : number of metadata bits */ ) { +#ifdef UNIFY_MD_QUANTIZER + int16_t i, ch, nb_bits_start, last_bit_pos; + float q_step, q_step_border; +#else int16_t i, ch, nb_bits_start, last_bit_pos, low_res_q; +#endif int16_t idx, idx_azimuth, idx_elevation; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; int16_t md_diff_flag[MAX_NUM_OBJECTS]; @@ -815,7 +829,11 @@ ivas_error ivas_ism_metadata_sid_dec( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ +#ifdef UNIFY_MD_QUANTIZER + ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); +#else low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); +#endif /*----------------------------------------------------------------* * Spatial parameters, loop over TCs - 1 @@ -881,6 +899,7 @@ ivas_error ivas_ism_metadata_sid_dec( if ( md_diff_flag[ch] == 1 ) { +#ifndef UNIFY_MD_QUANTIZER if ( low_res_q ) { idx_azimuth = get_next_indice( st0, nBits_azimuth ); @@ -889,10 +908,12 @@ ivas_error ivas_ism_metadata_sid_dec( ivas_ism_dec_dequantize_DOA_dtx( nBits_azimuth, nBits_elevation, idx_azimuth, idx_elevation, &( hIsmMetaData->azimuth ), &( hIsmMetaData->elevation ) ); } else +#endif { /* Azimuth decoding */ idx_azimuth = get_next_indice( st0, nBits_azimuth ); +#ifndef UNIFY_MD_QUANTIZER // VE!!!!! TBV /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ if ( idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) { @@ -916,9 +937,13 @@ ivas_error ivas_ism_metadata_sid_dec( } hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); +#else + hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << nBits_azimuth ); +#endif /* Elevation decoding */ idx_elevation = get_next_indice( st0, nBits_elevation ); +#ifndef UNIFY_MD_QUANTIZER /* sanity check in case of FER or BER */ if ( idx_elevation < 0 || idx_elevation > ( 1 << ISM_ELEVATION_NBITS ) - 1 ) @@ -928,9 +953,12 @@ ivas_error ivas_ism_metadata_sid_dec( /* Elevation dequantization */ hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); +#else + hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << nBits_elevation ); +#endif } - // VE: ToDo: this would not work well for switching from low_res_q to active frame coding + // VE!!!!! verify for switching from low_res_q to active frame coding #ifdef MD_Q_PARAM_BE if ( ism_mode != ISM_MODE_PARAM ) #endif diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index f8672e4abf..d08618e9cd 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -63,8 +63,13 @@ static void ivas_param_ism_dec_dequant_DOA( /* Get the azimuth and elevation values */ for ( i = 0; i < hParamIsm->num_obj; i++ ) { +#ifdef UNIFY_MD_QUANTIZER + hDirAC->azimuth_values[i] = ism_dequant_meta( hParamIsm->azi_index[i], ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); + hDirAC->elevation_values[i] = ism_dequant_meta( hParamIsm->ele_index[i], ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#else hDirAC->azimuth_values[i] = ism_dequant_meta( hParamIsm->azi_index[i], ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); hDirAC->elevation_values[i] = ism_dequant_meta( hParamIsm->ele_index[i], ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); +#endif } return; diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index aac58ff1cf..a37820264b 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -123,6 +123,9 @@ int16_t ivas_ism_dtx_enc( int16_t nBits, nBits_MD_max; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; float lp_noise[MAX_NUM_OBJECTS], lp_noise_variation, lp_noise_mean; +#ifdef UNIFY_MD_QUANTIZER + float tmp1, tmp2; +#endif /*------------------------------------------------------------------* * compute global ISM DTX flag @@ -167,7 +170,11 @@ int16_t ivas_ism_dtx_enc( if ( dtx_flag ) { +#ifdef UNIFY_MD_QUANTIZER + ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &tmp1, &tmp2, &nBits_coh, &nBits_sce_id ); +#else ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); +#endif nBits = 0; for ( ch = 0; ch < num_obj; ch++ ) diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index dd57403d1e..f44088ea6c 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -215,8 +215,13 @@ ivas_error ivas_ism_metadata_enc( if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { /* send metadata even in inactive segments when noise is audible and metadata are changing */ +#ifdef UNIFY_MD_QUANTIZER + diff = (int16_t) fabsf( hIsmMeta[ch]->azimuth - ism_dequant_meta( hIsmMeta[ch]->last_azimuth_idx, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ) ); + diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->elevation - ism_dequant_meta( hIsmMeta[ch]->last_elevation_idx, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ) ) ); +#else diff = (int16_t) fabsf( hIsmMeta[ch]->azimuth - ism_dequant_meta( hIsmMeta[ch]->last_azimuth_idx, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ) ); diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->elevation - ism_dequant_meta( hIsmMeta[ch]->last_elevation_idx, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ) ) ); +#endif if ( hSCE[ch]->hCoreCoder[0]->lp_noise > 15 && diff >= 10 ) { @@ -324,7 +329,11 @@ ivas_error ivas_ism_metadata_enc( /* Azimuth quantization (quantize azimuth to the AZIMUTH_NBITS-bit index */ if ( ism_mode == ISM_MODE_DISC ) { +#ifdef UNIFY_MD_QUANTIZER + idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); +#else idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); +#endif } else if ( ism_mode == ISM_MODE_PARAM ) { @@ -430,7 +439,11 @@ ivas_error ivas_ism_metadata_enc( /* Elevation quantization (quantize azimuth to the ELEVATION_NBITS-bit index */ if ( ism_mode == ISM_MODE_DISC ) { +#ifdef UNIFY_MD_QUANTIZER + idx_elevation_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#else idx_elevation_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); +#endif } else /* ISM_MODE_PARAM */ { @@ -778,6 +791,7 @@ ivas_error create_ism_metadata_enc( #ifdef DISCRETE_ISM_DTX_CNG +#ifndef UNIFY_MD_QUANTIZER /*-------------------------------------------------------------------* * ivas_ism_quantize_DOA_dtx() * @@ -842,7 +856,7 @@ static void ivas_ism_quantize_DOA_dtx( return; } - +#endif /*-------------------------------------------------------------------* * ivas_ism_metadata_sid_enc() @@ -863,7 +877,12 @@ void ivas_ism_metadata_sid_enc( int16_t nb_bits_metadata[] /* o : number of metadata bits */ ) { +#ifdef UNIFY_MD_QUANTIZER + int16_t i, ch, nBits, nBits_start, nBits_unused; + float q_step, q_step_border; +#else int16_t i, ch, nBits, nBits_start, nBits_unused, low_res_q; +#endif int16_t idx, idx_azimuth, idx_elevation; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; float valQ; @@ -896,7 +915,11 @@ void ivas_ism_metadata_sid_enc( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ +#ifdef UNIFY_MD_QUANTIZER + ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); +#else low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); +#endif /*----------------------------------------------------------------* * Spatial parameters, loop over TCs - 1 @@ -951,6 +974,10 @@ void ivas_ism_metadata_sid_enc( { hIsmMetaData = hIsmMeta[ch]; +#ifdef UNIFY_MD_QUANTIZER + idx_azimuth = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, q_step, q_step_border, 1 << nBits_azimuth ); + idx_elevation = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, q_step, q_step_border, 1 << nBits_elevation ); +#else if ( low_res_q ) { ivas_ism_quantize_DOA_dtx( hIsmMetaData->azimuth, hIsmMetaData->elevation, nBits_azimuth, nBits_elevation, &idx_azimuth, &idx_elevation ); @@ -960,6 +987,7 @@ void ivas_ism_metadata_sid_enc( idx_azimuth = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); idx_elevation = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); } +#endif push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, nBits_azimuth ); push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, nBits_elevation ); diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index 09383db54b..be8c8135bd 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -162,10 +162,18 @@ static void ivas_param_ism_enc_quantize_DOA( for ( i = 0; i < num_obj; i++ ) { /* Quantize the elevation and obtain quantized elevation value and index */ +#ifdef UNIFY_MD_QUANTIZER + ele_idx = ism_quant_meta( hIsmMetaData[i]->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#else ele_idx = ism_quant_meta( hIsmMetaData[i]->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); +#endif /* Obtain the index of quantized azimuth values */ +#ifdef UNIFY_MD_QUANTIZER + azi_idx = ism_quant_meta( hIsmMetaData[i]->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); +#else azi_idx = ism_quant_meta( hIsmMetaData[i]->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); +#endif /*Replace azimuth with quantized values */ hIsmMetaData[i]->azimuth = valQ; -- GitLab From 1f1ddfbbe4c933e1dd4056267861ff2466d2cea1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 22 Feb 2023 09:15:25 +0100 Subject: [PATCH 082/375] deactivate MD_Q_PARAM_BE and MD_SMOOTH_PARAM_BE; not BE for paramISM --- lib_com/options.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index ceb443d363..c7b99b4a7e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ @@ -182,8 +182,8 @@ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ -#define MD_Q_PARAM_BE -#define MD_SMOOTH_PARAM_BE +/*#define MD_Q_PARAM_BE*/ +/*#define MD_SMOOTH_PARAM_BE*/ /*#define DTX_PARAM_BE*/ #define UNIFY_MD_QUANTIZER -- GitLab From 7625d3be4c6230d04b19b46dc782f9ac0df2e8d6 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 22 Feb 2023 11:38:37 +0100 Subject: [PATCH 083/375] fixes + tuning in MD quantization --- lib_dec/ivas_ism_metadata_dec.c | 27 ++++++++++++++++++++------- lib_enc/ivas_ism_dtx_enc.c | 4 ++-- lib_enc/ivas_ism_metadata_enc.c | 14 ++++++++++++++ 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index dc453f678a..f884981cad 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -53,8 +53,8 @@ #define IVAS_ISM_DTX_HO_MAX 5 -#define CNG_MD_MAX_DIFF_AZIMUTH 8 -#define CNG_MD_MAX_DIFF_ELEVATION 8 +#define CNG_MD_MAX_DIFF_AZIMUTH 5 +#define CNG_MD_MAX_DIFF_ELEVATION 5 /*-------------------------------------------------------------------* @@ -72,7 +72,7 @@ static void ism_metadata_smooth( ISM_METADATA_HANDLE hIsmMetaData; int16_t ch; float diff; - + return; for ( ch = 0; ch < num_obj; ch++ ) { hIsmMetaData = hIsmMeta[ch]; @@ -913,7 +913,7 @@ ivas_error ivas_ism_metadata_sid_dec( /* Azimuth decoding */ idx_azimuth = get_next_indice( st0, nBits_azimuth ); -#ifndef UNIFY_MD_QUANTIZER // VE!!!!! TBV +#ifndef UNIFY_MD_QUANTIZER /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ if ( idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) { @@ -938,7 +938,7 @@ ivas_error ivas_ism_metadata_sid_dec( hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); #else - hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << nBits_azimuth ); + hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, q_step, q_step_border, 1 << nBits_azimuth ); #endif /* Elevation decoding */ @@ -954,17 +954,30 @@ ivas_error ivas_ism_metadata_sid_dec( /* Elevation dequantization */ hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); #else - hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << nBits_elevation ); + hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, q_step, q_step_border, 1 << nBits_elevation ); #endif } - // VE!!!!! verify for switching from low_res_q to active frame coding #ifdef MD_Q_PARAM_BE if ( ism_mode != ISM_MODE_PARAM ) #endif { +#ifdef UNIFY_MD_QUANTIZER + /* update last indexes to correspond to active frames coding */ + if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) + { + hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); + hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); + } + else + { + hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); + hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); + } +#else hIsmMetaData->last_azimuth_idx = idx_azimuth; hIsmMetaData->last_elevation_idx = idx_elevation; +#endif } /* save for smoothing metadata evolution */ diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index a37820264b..830dfae810 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -48,8 +48,8 @@ * Local constants *-----------------------------------------------------------------------*/ -#define MD_MAX_DIFF_AZIMUTH 15 -#define MD_MAX_DIFF_ELEVATION 15 +#define MD_MAX_DIFF_AZIMUTH 10 +#define MD_MAX_DIFF_ELEVATION 10 #endif diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index f44088ea6c..3d34debc51 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -996,8 +996,22 @@ void ivas_ism_metadata_sid_enc( if ( ism_mode != ISM_MODE_PARAM ) #endif { +#ifdef UNIFY_MD_QUANTIZER + /* update last indexes to correspond to active frames coding */ + if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) + { + hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); + hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); + } + else + { + hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); + hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); + } +#else hIsmMetaData->last_azimuth_idx = idx_azimuth; hIsmMetaData->last_elevation_idx = idx_elevation; +#endif } } } -- GitLab From 8364fb0dd9f11bec5d916157c029880cbb9882ff Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 22 Feb 2023 11:42:31 +0100 Subject: [PATCH 084/375] remove "return" leftover --- lib_dec/ivas_ism_metadata_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index f884981cad..04cf53574a 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -72,7 +72,7 @@ static void ism_metadata_smooth( ISM_METADATA_HANDLE hIsmMetaData; int16_t ch; float diff; - return; + for ( ch = 0; ch < num_obj; ch++ ) { hIsmMetaData = hIsmMeta[ch]; -- GitLab From a128918ee2bcca2c0173174943c7ba75a7c6149c Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 22 Feb 2023 11:50:10 +0100 Subject: [PATCH 085/375] address two VE comments --- lib_dec/ivas_dec.c | 6 +++--- lib_enc/ivas_ism_dtx_enc.c | 6 +++--- lib_enc/ivas_stat_enc.h | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 1e4dd9c4c7..a0c3e4a650 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -400,9 +400,9 @@ ivas_error ivas_dec( } else /* SBA_MODE_SPAR */ if ( !st_ivas->sba_dirac_stereo_flag ) - { - ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ - } + { + ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ + } } else if ( st_ivas->ivas_format == MC_FORMAT ) { diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 830dfae810..f7d6fc52c7 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -79,9 +79,9 @@ ivas_error ivas_ism_dtx_open( hISMDTX->sce_id_dtx = 0; #ifdef DISCRETE_ISM_DTX_CNG hISMDTX->cnt_SID_ISM = -1; -#endif - +#else set_s( hISMDTX->dtx_speech_buffer_enc, 0, PARAM_ISM_HYS_BUF_SIZE ); +#endif for ( i = 0; i < MAX_NUM_OBJECTS; i++ ) { @@ -105,7 +105,7 @@ ivas_error ivas_ism_dtx_open( /*! r: indication of DTX frame */ #ifdef DTX_PARAM_BE -int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end +int16_t ivas_ism_dtx_enc_COMMON( #else int16_t ivas_ism_dtx_enc( #endif diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 60dc09fb11..5943591ee1 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -562,8 +562,9 @@ typedef struct #ifdef DISCRETE_ISM_DTX_CNG int16_t cnt_SID_ISM; -#endif // VE!!!!! +#else int16_t dtx_speech_buffer_enc[PARAM_ISM_HYS_BUF_SIZE]; +#endif float long_term_energy_stereo_dmx_enc[MAX_NUM_OBJECTS][PARAM_ISM_HYS_BUF_SIZE]; float coh[MAX_NUM_OBJECTS]; -- GitLab From 214a3f59c07655558ecaa1936111b9d21667e991 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 22 Feb 2023 12:18:26 +0100 Subject: [PATCH 086/375] reapply FIX_103_RA_PARAMS_PARAM_BIN_REND since function moved to another file --- lib_rend/ivas_reverb.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index a3d55584b4..f4c098984b 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1884,6 +1884,28 @@ ivas_error ivas_binaural_reverb_open( } } + +#ifdef FIX_103_RA_PARAMS_PARAM_BIN_REND + if ( ( roomAcoustics ) && ( roomAcoustics->override ) ) + { + ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfFastConv, output_config, roomAcoustics->use_brir, sampling_rate, t60, ene ); + ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, t60, ene ); + ivas_binaural_reverb_setPreDelay( hReverb, (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ) ); + } + else + { + if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, hHrtfFastConv->fastconvReverberationTimes, hHrtfFastConv->fastconvReverberationEneCorrections ); + ivas_binaural_reverb_setPreDelay( hReverb, 10 ); + } + else + { + ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, hHrtfParambin->parametricReverberationTimes, hHrtfParambin->parametricReverberationEneCorrections ); + ivas_binaural_reverb_setPreDelay( hReverb, 10 ); + } + } +#else if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { if ( !roomAcoustics->override ) @@ -1904,6 +1926,7 @@ ivas_error ivas_binaural_reverb_open( ivas_binaural_reverb_setPreDelay( hReverb, 10 ); } +#endif return IVAS_ERR_OK; } -- GitLab From eed45821f3ac89f01329b464e6d21378ab7436ac Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 22 Feb 2023 12:19:31 +0100 Subject: [PATCH 087/375] enable DTX for 1ISM; under DISCRETE_ISM_DTX_CNG --- lib_dec/ivas_ism_dtx_dec.c | 2 ++ lib_dec/ivas_ism_metadata_dec.c | 2 ++ lib_enc/ivas_ism_enc.c | 12 ++++++------ lib_enc/ivas_ism_metadata_enc.c | 2 ++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 85a0ee085c..c4d35cbf9d 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -110,12 +110,14 @@ ivas_error ivas_ism_dtx_dec( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; +#ifndef DISCRETE_ISM_DTX_CNG if ( st_ivas->nchan_transport == 1 ) { nb_bits_metadata[0] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; return IVAS_ERR_OK; } +#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 04cf53574a..64f8ea926a 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -167,6 +167,7 @@ ivas_error ivas_ism_metadata_dec( push_wmops( "ism_meta_dec" ); +#ifndef DISCRETE_ISM_DTX_CNG if ( ism_total_brate == IVAS_SID_5k2 || ism_total_brate == FRAME_NO_DATA ) { /* no metadata decoding in CNG */ @@ -189,6 +190,7 @@ ivas_error ivas_ism_metadata_dec( pop_wmops(); return error; } +#endif /* initialization */ st0 = hSCE[0]->hCoreCoder[0]; diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 8a0a97aab0..4fcf96e629 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -85,7 +85,9 @@ ivas_error ivas_ism_enc( float Etot_LR[1]; /* total energy; correlation shift */ float lf_E[1][2 * VOIC_BINS]; /* per bin spectrum energy in lf */ int16_t localVAD_HE_SAD[1]; /* local HE VAD */ +#ifndef DISCRETE_ISM_DTX_CNG int16_t i, nBits; +#endif #ifdef PARAM_ISM_DTX_CNG #ifdef DISCRETE_ISM_DTX_CNG int16_t num_obj, dtx_flag, sid_flag, flag_noisy_speech; @@ -213,7 +215,7 @@ ivas_error ivas_ism_enc( *-----------------------------------------------------------------*/ #ifdef DISCRETE_ISM_DTX_CNG - if ( st_ivas->hEncoderConfig->Opt_DTX_ON && num_obj > 1 ) // VE!!!!! keep bitexactness for 1ISM case for now + if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) #else if ( st_ivas->hEncoderConfig->Opt_DTX_ON && st_ivas->ism_mode == ISM_MODE_PARAM ) #endif @@ -334,19 +336,16 @@ ivas_error ivas_ism_enc( st = st_ivas->hSCE[0]->hCoreCoder[0]; #ifdef DISCRETE_ISM_DTX_CNG - if ( st->core_brate == SID_2k40 || sid_flag ) // VE!!!!! to be simplified + if ( sid_flag ) #else if ( st->core_brate == SID_2k40 ) #endif { ivas_write_format_sid( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr ); +#ifndef DISCRETE_ISM_DTX_CNG #ifdef PARAM_ISM_DTX_CNG -#ifdef DISCRETE_ISM_DTX_CNG - if ( num_obj == 1 ) // VE!!!!! keep bitexactness for 1ISM case for now -#else if ( st_ivas->ism_mode != ISM_MODE_PARAM ) -#endif #endif { /* write unused bits */ @@ -358,6 +357,7 @@ ivas_error ivas_ism_enc( nBits -= i; } } +#endif } /*------------------------------------------------------------------* diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 3d34debc51..99aba8b0b0 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -184,6 +184,7 @@ ivas_error ivas_ism_metadata_enc( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: incorrect ISM mode" ); } +#ifndef DISCRETE_ISM_DTX_CNG if ( num_obj == 1 && ( hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) && ism_mode == ISM_MODE_DISC ) { /* no metadata encoding in CNG */ @@ -191,6 +192,7 @@ ivas_error ivas_ism_metadata_enc( return error; } +#endif /* initialization */ ism_metadata_flag_global = 0; -- GitLab From 9ec0c0f4207e6c968339cfde9e33a546f468407e Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 22 Feb 2023 14:34:34 +0100 Subject: [PATCH 088/375] fixes for bitrate switching in DTX; changes are within DISCRETE_ISM_DTX_CNG; BE in non-switching conditions --- lib_com/ivas_prot.h | 3 +++ lib_dec/ivas_init_dec.c | 4 ++++ lib_dec/ivas_ism_dec.c | 29 ++++++++++++++++++++++++++++- lib_dec/ivas_ism_dtx_dec.c | 26 +++++++++++++++++++++++++- lib_dec/ivas_ism_metadata_dec.c | 6 +----- lib_enc/ivas_ism_dtx_enc.c | 2 ++ 6 files changed, 63 insertions(+), 7 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index f7024fa0c0..431a4e09ec 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -886,6 +886,9 @@ ivas_error ivas_ism_enc_config( ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef DISCRETE_ISM_DTX_CNG + const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ +#endif const int16_t num_obj /* i : number of objects in the bitstream */ ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 64e72e0625..df6e4cb6e8 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -109,7 +109,11 @@ ivas_error ivas_dec_setup( k--; } +#ifdef DISCRETE_ISM_DTX_CNG + ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, num_obj ); +#else ivas_ism_dec_config( st_ivas, num_obj ); +#endif } else if ( st_ivas->ivas_format == SBA_FORMAT ) { diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 6f07130d1d..a26b25153e 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -207,11 +207,16 @@ static ivas_error ivas_ism_bitrate_switching( /*! r : ISM format mode */ ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t num_obj /* i : number of objects in the bitstream */ +#ifdef DISCRETE_ISM_DTX_CNG + const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ +#endif + const int16_t num_obj /* i : number of objects in the bitstream */ ) { int32_t ivas_total_brate; +#ifndef DISCRETE_ISM_DTX_CNG ISM_MODE last_ism_mode; +#endif ivas_error error; int16_t nchan_transport_old; @@ -219,8 +224,10 @@ ivas_error ivas_ism_dec_config( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; +#ifndef DISCRETE_ISM_DTX_CNG /* store last frame ISM mode */ last_ism_mode = st_ivas->ism_mode; +#endif /* Assumes that num of input objects are constant */ nchan_transport_old = num_obj; @@ -248,7 +255,9 @@ ivas_error ivas_ism_dec_config( if ( st_ivas->ini_active_frame != 0 ) { /* ISM bit-rate switching */ +#ifndef DISCRETE_ISM_DTX_CNG if ( st_ivas->hDecoderConfig->last_ivas_total_brate != IVAS_SID_5k2 && st_ivas->hDecoderConfig->last_ivas_total_brate != FRAME_NO_DATA ) +#endif { if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hDecoderConfig->ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) ) { @@ -259,6 +268,23 @@ ivas_error ivas_ism_dec_config( } else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { +#ifdef DISCRETE_ISM_DTX_CNG + st_ivas->nchan_transport = num_obj; + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + st_ivas->nchan_transport = 2; + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) + { + st_ivas->hDecoderConfig->nchan_out = num_obj; + } + } + + /* ISM mode switching */ + if ( st_ivas->ism_mode != last_ism_mode ) + { + ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, num_obj ); + } +#else #ifdef PARAM_ISM_DTX_CNG if ( last_ism_mode == ISM_MODE_PARAM ) { @@ -269,6 +295,7 @@ ivas_error ivas_ism_dec_config( { st_ivas->nchan_transport = num_obj; } +#endif } switch ( num_obj ) diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index c4d35cbf9d..dbf7462e41 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -67,6 +67,9 @@ static void ivas_ism_preprocessing( { /* reset the bitstream to at least read the cng type and bandwidth for non transmitted SCE */ st->bit_stream = st_ivas->hSCE[0]->hCoreCoder[0]->bit_stream; +#ifdef DISCRETE_ISM_DTX_CNG + st->next_bit_pos = 0; /* note: needed in paramISM -> discISM switching */ +#endif if ( sce_id == st_ivas->hISMDTX.sce_id_dtx ) { @@ -106,6 +109,7 @@ ivas_error ivas_ism_dtx_dec( #ifdef DISCRETE_ISM_DTX_CNG int16_t md_diff_flag[MAX_NUM_OBJECTS]; int16_t flag_noisy_speech, sce_id_dtx; + ISM_MODE last_ism_mode; #endif ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -128,9 +132,9 @@ ivas_error ivas_ism_dtx_dec( num_obj_prev = st_ivas->nchan_transport; } - /* read number of objects */ if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { + /* read number of objects */ num_obj = 1; pos = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); @@ -139,6 +143,9 @@ ivas_error ivas_ism_dtx_dec( ( num_obj )++; pos--; } +#ifdef DISCRETE_ISM_DTX_CNG + pos--; +#endif if ( num_obj != num_obj_prev ) { @@ -146,6 +153,22 @@ ivas_error ivas_ism_dtx_dec( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong number of objects signalled!" ); } +#ifdef DISCRETE_ISM_DTX_CNG + last_ism_mode = st_ivas->ism_mode; + + /* read ism_mode */ + if ( num_obj > 2 ) + { + pos -= num_obj; /* SID metadata flags */ + + short idx = get_indice( st_ivas->hSCE[0]->hCoreCoder[0], pos, 1 ); + + ISM_MODE ism_mode_bstr = (ISM_MODE) ( idx + 1 ); + st_ivas->ism_mode = ism_mode_bstr; + } + + ivas_ism_dec_config( st_ivas, last_ism_mode, num_obj ); +#else ivas_ism_dec_config( st_ivas, num_obj ); if ( st_ivas->ism_mode == ISM_MODE_PARAM ) @@ -156,6 +179,7 @@ ivas_error ivas_ism_dtx_dec( { st_ivas->nchan_transport = num_obj; } +#endif } else { diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 64f8ea926a..e9d5638763 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -849,11 +849,7 @@ ivas_error ivas_ism_metadata_sid_dec( { idx = get_next_indice( st0, 1 ); ism_mode_bstr = (ISM_MODE) ( idx + 1 ); - - if ( ism_mode_bstr != ism_mode ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\n!!! Error: Switching ISM mode in CNG not verified yet. Exiting.\n\n" ); - } + /* note: ISM mode was already read and used for configuration in in ivas_ism_dtx_dec() */ if ( ism_mode_bstr == ISM_MODE_PARAM ) { diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index f7d6fc52c7..7a37ee9df3 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -239,6 +239,7 @@ int16_t ivas_ism_dtx_enc( for ( ch = 0; ch < nchan_transport; ch++ ) { hSCE[ch]->hCoreCoder[0]->core_brate = -1; + set_bw( IVAS_SCE, hSCE[ch]->element_brate, hSCE[ch]->hCoreCoder[0], MODE1 ); } hISMDTX->cnt_SID_ISM = -1; @@ -246,6 +247,7 @@ int16_t ivas_ism_dtx_enc( /* IVAS format signaling was erased in dtx() */ if ( hSCE[0]->hCoreCoder[0]->hBstr->nb_bits_tot == 0 ) { + /* replicate ivas_write_format() */ push_indice( hSCE[0]->hCoreCoder[0]->hBstr, IND_IVAS_FORMAT, 2 /* == ISM format */, IVAS_FORMAT_SIGNALING_NBITS ); } } -- GitLab From 198d7cb3ef8b15b440605ce4be2b8b5c2319767d Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Wed, 22 Feb 2023 16:41:42 +0200 Subject: [PATCH 089/375] Fix of MASA audio and meta asynchrony of issue #350 --- apps/decoder.c | 22 +++++ lib_com/common_api_types.h | 4 + lib_com/delay_comp.c | 14 +++ lib_com/ivas_cnst.h | 8 ++ lib_com/options.h | 1 + lib_dec/ivas_dirac_dec.c | 91 ++++++++++++++++++ lib_dec/ivas_masa_dec.c | 156 +++++++++++++++++++++++++++++++ lib_dec/ivas_stat_dec.h | 18 ++++ lib_dec/lib_dec.c | 10 +- lib_dec/lib_dec.h | 8 +- lib_enc/ivas_masa_enc.c | 13 +++ lib_enc/ivas_stat_enc.h | 2 + lib_util/masa_file_writer.c | 177 ++++++++++++++++++++++++++++++++++-- lib_util/masa_file_writer.h | 15 ++- 14 files changed, 528 insertions(+), 11 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 1d991b8ad3..ca37696914 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1309,15 +1309,24 @@ static ivas_error initOnFirstGoodFrame( /* If outputting MASA, open output file and write metadata for initial bad frames */ else if ( *pBsFormat == IVAS_DEC_BS_MASA ) { +#ifdef FIX_350_MASA_DELAY_COMP + if ( ( error = MasaFileWriter_open( arg.outputWavFilename, arg.delayCompensationEnabled, ppMasaWriter ) ) != IVAS_ERR_OK ) +#else if ( ( error = MasaFileWriter_open( arg.outputWavFilename, ppMasaWriter ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nError: Error opening MASA decoded metadata file %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); return error; } /* Duplicate good first frame metadata to fill the beginning of stream. */ +#ifdef FIX_350_MASA_DELAY_COMP + MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL; + if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK ) +#else IVAS_MASA_QMETADATA_HANDLE qMetadata = NULL; if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &qMetadata ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); return error; @@ -1325,7 +1334,11 @@ static ivas_error initOnFirstGoodFrame( for ( int16_t j = 0; j < numInitialBadFrames; ++j ) { +#ifdef FIX_350_MASA_DELAY_COMP + if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) +#else if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, qMetadata ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); return error; @@ -1546,14 +1559,23 @@ static ivas_error decodeG192( } else if ( bsFormat == IVAS_DEC_BS_MASA ) { +#ifdef FIX_350_MASA_DELAY_COMP + MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; + if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK ) +#else IVAS_MASA_QMETADATA_HANDLE qMetadata; if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &qMetadata ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } +#ifdef FIX_350_MASA_DELAY_COMP + if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) +#else if ( ( error = MasaFileWriter_writeFrame( masaWriter, qMetadata ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index d03a0b7f81..85a730480b 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -86,7 +86,11 @@ typedef struct } IVAS_QUATERNION; typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; +#ifdef FIX_350_MASA_DELAY_COMP +typedef struct ivas_masa_decoder_ext_out_meta_struct *MASA_DECODER_EXT_OUT_META_HANDLE; +#else typedef struct ivas_masa_qmetadata_frame_struct *IVAS_MASA_QMETADATA_HANDLE; +#endif typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE; typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE; diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index 194b4b2919..e9db7b80fc 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -69,6 +69,13 @@ int32_t get_delay( else /* IVAS */ { delay = IVAS_ENC_DELAY_NS; + +#ifdef FIX_350_MASA_DELAY_COMP + if ( ivas_format == MASA_FORMAT ) + { + delay = 0; /* All delay is compensated in the decoder with MASA */ + } +#endif } if ( ivas_format == SBA_FORMAT ) @@ -102,6 +109,13 @@ int32_t get_delay( /* compensate for binauralization delay */ delay += binaural_latency_ns; + +#ifdef FIX_350_MASA_DELAY_COMP + if ( ivas_format == MASA_FORMAT ) + { + delay += IVAS_ENC_DELAY_NS; /* Compensate also the encoder delay in the decoder with MASA */ + } +#endif } } diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 09134774c0..f839b7836a 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -935,6 +935,10 @@ typedef enum #define DELAY_DIRAC_SPAR_ENC_CMP_NS 500000L /* here we may set the 24 samples (at 48 kHz) additional delay to something else, leave as is for now*/ #define DELAY_DIRAC_PARAM_DEC_SFR 2 /* Delay to be compensation for DirAC parameters in the decoder (subframes) */ +#ifdef FIX_350_MASA_DELAY_COMP +#define DELAY_MASA_PARAM_DEC_SFR 2 /* Delay to be compensation for MASA parameters in the decoder (subframes) */ +#endif + #define DIRAC_SLOT_NS 1250000L /* time duration of a time slot, 1.25ms (==DELAY_RENERER_NS/MAX_PARAM_SPATIAL_SUBFRAMES) */ #define DIRAC_SLOT_ENC_NS 5000000L @@ -1106,7 +1110,11 @@ enum #define MASA_MAXIMUM_CODING_SUBBANDS 24 #define MASA_MAXIMUM_DIRECTIONS 2 #define MASA_MAX_TRANSPORT_CHANNELS 2 + +#ifndef FIX_350_MASA_DELAY_COMP #define MASA_ENC_DELAY_SLOTS 7 +#endif + #define MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS 5 #define MASA_DELTA_AZI_DCT0 30 diff --git a/lib_com/options.h b/lib_com/options.h index 4ccaf4bdaa..a8472eccfb 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -180,6 +180,7 @@ #define SMOOTH_WITH_TRANS_DET #endif +#define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index f3090415ae..2aaf9d9286 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -776,10 +776,22 @@ ivas_error ivas_dirac_dec_config( hDirAC->dirac_read_idx = 0; hDirAC->spar_to_dirac_write_idx = 0; +#ifdef FIX_350_MASA_DELAY_COMP + if ( st_ivas->mc_mode == MC_MODE_MCMASA ) + { + hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; + } + else if ( st_ivas->ivas_format == MASA_FORMAT ) + { + hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; + hDirAC->dirac_bs_md_write_idx = DELAY_MASA_PARAM_DEC_SFR; + } +#else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) { hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; } +#endif else { int16_t num_slots_in_subfr; @@ -1512,8 +1524,45 @@ void ivas_qmetadata_to_dirac( if ( hMasa != NULL && ivas_total_brate > IVAS_SID_5k2 ) { +#ifdef FIX_350_MASA_DELAY_COMP + int16_t meta_write_index; band_mapping = hMasa->data.band_mapping; + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) + { + meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; + + for ( band = 0; band < hMasa->config.numCodingBands; ++band ) + { + for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) + { + hDirAC->azimuth[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; + hDirAC->elevation[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; + hDirAC->energy_ratio1[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; + hDirAC->diffuseness_vector[meta_write_index][b] = 1.0f - q_direction->band_data[band].energy_ratio[block]; + + if ( q_direction->coherence_band_data != NULL ) + { + hDirAC->spreadCoherence[meta_write_index][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; + } + else + { + hDirAC->spreadCoherence[meta_write_index][b] = 0.0f; + } + + if ( hQMetaData->surcoh_band_data != NULL ) + { + hDirAC->surroundingCoherence[meta_write_index][b] = hQMetaData->surcoh_band_data[band].surround_coherence[block] / 255.0f; + } + else + { + hDirAC->surroundingCoherence[meta_write_index][b] = 0.0f; + } + } + } + } +#else + band_mapping = hMasa->data.band_mapping; for ( band = 0; band < hMasa->config.numCodingBands; ++band ) { for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) @@ -1545,10 +1594,37 @@ void ivas_qmetadata_to_dirac( } } } +#endif if ( hQMetaData->no_directions == 2 ) { q_direction = &( hQMetaData->q_direction[1] ); +#ifdef FIX_350_MASA_DELAY_COMP + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) + { + meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; + + for ( band = 0; band < hMasa->config.numCodingBands; ++band ) + { + for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) + { + hDirAC->azimuth2[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; + hDirAC->elevation2[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; + hDirAC->energy_ratio2[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; + hDirAC->diffuseness_vector[meta_write_index][b] -= q_direction->band_data[band].energy_ratio[block]; + + if ( q_direction->coherence_band_data != NULL ) + { + hDirAC->spreadCoherence2[meta_write_index][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; + } + else + { + hDirAC->spreadCoherence2[meta_write_index][b] = 0.0f; + } + } + } + } +#else for ( band = 0; band < hMasa->config.numCodingBands; ++band ) { for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) @@ -1571,7 +1647,22 @@ void ivas_qmetadata_to_dirac( } } } +#endif + } +#ifdef FIX_350_MASA_DELAY_COMP + else if ( hDirAC->azimuth2 != NULL && hDirAC->elevation2 != NULL && hDirAC->energy_ratio2 != NULL && hDirAC->spreadCoherence2 != NULL ) + { + /* zero out old dir2 data */ + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) + { + meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; + set_s( hDirAC->azimuth2[meta_write_index], 0, hDirAC->num_freq_bands ); + set_s( hDirAC->elevation2[meta_write_index], 0, hDirAC->num_freq_bands ); + set_zero( hDirAC->energy_ratio2[meta_write_index], hDirAC->num_freq_bands ); + set_zero( hDirAC->spreadCoherence2[meta_write_index], hDirAC->num_freq_bands ); + } } +#endif } else /* SBA mode/SID/Zero frame*/ { diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 18d42cb910..5803a2467e 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -48,6 +48,9 @@ * Local constants *-----------------------------------------------------------------------*/ #define SPAR_META_DELAY_SUBFRAMES 2 /* Number of subframes to delay the SPAR metadata */ +#ifdef FIX_350_MASA_DELAY_COMP +#define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 ) /* Spherical index corresponding to front direction for setting as default value */ +#endif /*-----------------------------------------------------------------------* * Local function prototypes @@ -57,6 +60,9 @@ static int16_t quantize_theta( float x, int16_t no_cb, float *xhat ); static uint16_t index_theta_phi_16( float theta, float phi, SPHERICAL_GRID_DATA *Sph_Grid16 ); static int16_t quantize_phi_masa( float phi, int16_t flag_delta, float *phi_hat, const int16_t n ); static void index_16bits( IVAS_QMETADATA_HANDLE hQMetaData, SPHERICAL_GRID_DATA *Sph_Grid16 ); +#ifdef FIX_350_MASA_DELAY_COMP +static void create_masa_ext_out_meta( MASA_DECODER *hMasa, IVAS_QMETADATA_HANDLE hQMetaData, const int16_t nchan_transport ); +#endif static void replicate_subframes( IVAS_QMETADATA_HANDLE hQMetaData ); @@ -306,6 +312,12 @@ ivas_error ivas_masa_decode( } } +#ifdef FIX_350_MASA_DELAY_COMP + if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) + { + create_masa_ext_out_meta( hMasa, hQMetaData, st_ivas->nchan_transport ); + } +#endif return error /* *nb_bits_read*/; } @@ -339,10 +351,16 @@ ivas_error ivas_masa_dec_open( { hMasa->data.sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ); generate_gridEq( hMasa->data.sph_grid16 ); +#ifdef FIX_350_MASA_DELAY_COMP + hMasa->data.extOutMeta = (MASA_DECODER_EXT_OUT_META *) malloc( sizeof( MASA_DECODER_EXT_OUT_META ) ); +#endif } else { hMasa->data.sph_grid16 = NULL; +#ifdef FIX_350_MASA_DELAY_COMP + hMasa->data.extOutMeta = NULL; +#endif } if ( st_ivas->mc_mode == MC_MODE_MCMASA ) @@ -377,6 +395,13 @@ void ivas_masa_dec_close( hMasa->data.sph_grid16 = NULL; } +#ifdef FIX_350_MASA_DELAY_COMP + if ( hMasa->data.extOutMeta != NULL ) + { + free( hMasa->data.extOutMeta ); + hMasa->data.extOutMeta = NULL; + } +#endif if ( hMasa->hMasaLfeSynth != NULL ) { if ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer != NULL ) @@ -1357,3 +1382,134 @@ static void compute_foa_cov_matrix( return; } + +#ifdef FIX_350_MASA_DELAY_COMP +static void create_masa_ext_out_meta( MASA_DECODER *hMasa, IVAS_QMETADATA_HANDLE hQMetaData, const int16_t nchan_transport ) +{ + const uint8_t ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */ + int16_t i, sf, b_old, b_new, dir; + MASA_DECRIPTIVE_META *descMeta; + int16_t *bandMap; + uint8_t numCodingBands; + uint8_t numDirections; + MASA_DECODER_EXT_OUT_META *extOutMeta; + + numDirections = hMasa->config.numberOfDirections; + numCodingBands = hMasa->config.numCodingBands; + bandMap = hMasa->data.band_mapping; + extOutMeta = hMasa->data.extOutMeta; + descMeta = &hMasa->data.extOutMeta->descriptiveMeta; + + /* Construct descriptive meta */ + for ( i = 0; i < 8; i++ ) + { + descMeta->formatDescriptor[i] = ivasmasaFormatDescriptor[i]; + } + descMeta->numberOfDirections = numDirections - 1; + descMeta->numberOfChannels = (uint8_t) ( nchan_transport - 1 ); + /* Following correspond to "unknown" values until transmission is implemented */ + descMeta->sourceFormat = 0x0u; + descMeta->transportDefinition = 0x0u; + descMeta->channelAngle = 0x0u; + descMeta->channelDistance = 0x0u; + descMeta->channelLayout = 0x0u; + + /* Construct spatial metadata from qmetadata */ + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + for ( dir = 0; dir < numDirections; dir++ ) + { + /* Spherical index */ + for ( b_old = 0; b_old < numCodingBands; b_old++ ) + { + for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) + { + extOutMeta->directionIndex[dir][sf][b_new] = hQMetaData->q_direction[dir].band_data[b_old].spherical_index[sf]; + } + } + + /* Direct-to-total ratio */ + for ( b_old = 0; b_old < numCodingBands; b_old++ ) + { + for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) + { + extOutMeta->directToTotalRatio[dir][sf][b_new] = (uint8_t) floorf( hQMetaData->q_direction[dir].band_data[b_old].energy_ratio[sf] * UINT8_MAX ); + } + } + + /* Spread coherence */ + if ( hQMetaData->q_direction[dir].coherence_band_data != NULL ) + { + for ( b_old = 0; b_old < numCodingBands; b_old++ ) + { + for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) + { + extOutMeta->spreadCoherence[dir][sf][b_new] = hQMetaData->q_direction[dir].coherence_band_data[b_old].spread_coherence[sf]; + } + } + } + else + { + for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) + { + extOutMeta->spreadCoherence[dir][sf][i] = 0; + } + } + } + + /* Fill second direction with zero energy data for EXT output */ + if ( numDirections == 1 ) + { + for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) + { + extOutMeta->directionIndex[1][sf][i] = SPH_IDX_FRONT; + } + + for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) + { + extOutMeta->directToTotalRatio[1][sf][i] = 0; + } + + for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) + { + extOutMeta->spreadCoherence[1][sf][i] = 0; + } + } + + /* Common spatial meta */ + /* Diffuse-to-total ratio = 1 - sum(direct-to-total ratios) */ + for ( b_old = 0; b_old < numCodingBands; b_old++ ) + { + for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) + { + extOutMeta->diffuseToTotalRatio[sf][b_new] = UINT8_MAX; + for ( dir = 0; dir < numDirections; dir++ ) + { + extOutMeta->diffuseToTotalRatio[sf][b_new] -= (uint8_t) floorf( hQMetaData->q_direction[dir].band_data[b_old].energy_ratio[sf] * UINT8_MAX ); + } + } + } + + /* Surround coherence */ + if ( hQMetaData->surcoh_band_data != NULL ) + { + for ( b_old = 0; b_old < numCodingBands; b_old++ ) + { + for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) + { + extOutMeta->surroundCoherence[sf][b_new] = hQMetaData->surcoh_band_data[b_old].surround_coherence[sf]; + } + } + } + else + { + for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) + { + extOutMeta->surroundCoherence[sf][i] = 0; + } + } + } + + return; +} +#endif diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 1ceba1e3fd..1d5200e666 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1098,11 +1098,29 @@ typedef struct ivas_mcmasa_lfe_synth_struct } MCMASA_LFE_SYNTH_DATA, *MCMASA_LFE_SYNTH_DATA_HANDLE; +#ifdef FIX_350_MASA_DELAY_COMP +typedef struct ivas_masa_decoder_ext_out_meta_struct +{ + MASA_DECRIPTIVE_META descriptiveMeta; + + uint16_t directionIndex[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + uint8_t directToTotalRatio[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + uint8_t spreadCoherence[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + + uint8_t surroundCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + uint8_t diffuseToTotalRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + +} MASA_DECODER_EXT_OUT_META; +#endif + typedef struct ivas_masa_decoder_data_struct { int16_t band_mapping[MASA_FREQUENCY_BANDS + 1]; SPHERICAL_GRID_DATA *sph_grid16; +#ifdef FIX_350_MASA_DELAY_COMP + MASA_DECODER_EXT_OUT_META *extOutMeta; +#endif float dir_decode_quality; } MASA_DECODER_DATA; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index a1fee7f0fd..2ccda3457c 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -857,8 +857,12 @@ ivas_error IVAS_DEC_GetObjectMetadata( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetMasaMetadata( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ +#ifdef FIX_350_MASA_DELAY_COMP + MASA_DECODER_EXT_OUT_META_HANDLE *hMasaExtOutMeta /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ +#else IVAS_MASA_QMETADATA_HANDLE *hMasaMetadata /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ +#endif ) { if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) @@ -871,7 +875,11 @@ ivas_error IVAS_DEC_GetMasaMetadata( return IVAS_ERR_WRONG_MODE; } +#ifdef FIX_350_MASA_DELAY_COMP + *hMasaExtOutMeta = hIvasDec->st_ivas->hMasa->data.extOutMeta; +#else *hMasaMetadata = hIvasDec->st_ivas->hQMetaData; +#endif return IVAS_ERR_OK; } diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index d3035af0b5..3917286c49 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -170,8 +170,12 @@ ivas_error IVAS_DEC_GetObjectMetadata( /*! r: error code */ ivas_error IVAS_DEC_GetMasaMetadata( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_MASA_QMETADATA_HANDLE *hMasaMetadata /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ +#ifdef FIX_350_MASA_DELAY_COMP + MASA_DECODER_EXT_OUT_META_HANDLE *hMasaExtOutMeta /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ +#else + IVAS_MASA_QMETADATA_HANDLE *hMasaMetadata /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ +#endif ); /*! r: error code */ diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index f358a8ba2e..006b6f4273 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -119,6 +119,7 @@ ivas_error ivas_masa_enc_open( mvs2s( DirAC_block_grouping, hMasa->config.block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); mvs2s( MASA_band_grouping_24, hMasa->config.band_grouping, MASA_FREQUENCY_BANDS + 1 ); +#ifndef FIX_350_MASA_DELAY_COMP if ( hEncoderConfig->ivas_format == MASA_FORMAT ) { for ( i = 0; i < st_ivas->nchan_transport; i++ ) @@ -127,6 +128,7 @@ ivas_error ivas_masa_enc_open( set_f( hMasa->data.delay_buffer[i], 0.0f, MASA_ENC_DELAY_SLOTS * CLDFB_NO_CHANNELS_MAX ); } } +#endif hMasa->data.onset_detector_1 = 0.0f; hMasa->data.onset_detector_2 = 0.0f; @@ -159,6 +161,7 @@ void ivas_masa_enc_close( deleteCldfb( &( hMasa->data.cldfbAnaEnc[i] ) ); } +#ifndef FIX_350_MASA_DELAY_COMP if ( ivas_format == MASA_FORMAT ) { for ( i = 0; i < nchan_transport; i++ ) @@ -167,6 +170,7 @@ void ivas_masa_enc_close( hMasa->data.delay_buffer[i] = NULL; } } +#endif free( hMasa ); @@ -397,6 +401,12 @@ void ivas_masa_estimate_energy( for ( ts = mrange[0]; ts < mrange[1]; ts++ ) { +#ifdef FIX_350_MASA_DELAY_COMP + for ( i = 0; i < nchan_transport; i++ ) + { + cldfbAnalysis_ts( &( data_f[i][l_ts * ts] ), Input_RealBuffer[i], Input_ImagBuffer[i], l_ts, hMasa->data.cldfbAnaEnc[i] ); + } +#else if ( ts < MASA_ENC_DELAY_SLOTS ) { for ( i = 0; i < nchan_transport; i++ ) @@ -411,6 +421,7 @@ void ivas_masa_estimate_energy( cldfbAnalysis_ts( &( data_f[i][l_ts * ( ts - MASA_ENC_DELAY_SLOTS )] ), Input_RealBuffer[i], Input_ImagBuffer[i], l_ts, hMasa->data.cldfbAnaEnc[i] ); } } +#endif for ( band_m_idx = 0; band_m_idx < MASA_FREQUENCY_BANDS; band_m_idx++ ) { @@ -438,10 +449,12 @@ void ivas_masa_estimate_energy( } } +#ifndef FIX_350_MASA_DELAY_COMP for ( i = 0; i < nchan_transport; i++ ) { mvr2r( &data_f[i][input_frame - MASA_ENC_DELAY_SLOTS * maxBin], &( hMasa->data.delay_buffer[i][0] ), MASA_ENC_DELAY_SLOTS * maxBin ); } +#endif return; } diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 8a96430129..295141281f 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -743,7 +743,9 @@ typedef struct ivas_masa_encoder_data_struct float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; int16_t num_Cldfb_instances; HANDLE_CLDFB_FILTER_BANK cldfbAnaEnc[MAX_NUM_ENC_CLDFB_INSTANCES]; +#ifndef FIX_350_MASA_DELAY_COMP float *delay_buffer[MASA_MAX_TRANSPORT_CHANNELS]; +#endif int16_t band_mapping[MASA_FREQUENCY_BANDS + 1]; uint8_t twoDirBands[MASA_FREQUENCY_BANDS]; float importanceWeight[MASA_FREQUENCY_BANDS]; diff --git a/lib_util/masa_file_writer.c b/lib_util/masa_file_writer.c index 3b4df4f1c9..079ef9238e 100644 --- a/lib_util/masa_file_writer.c +++ b/lib_util/masa_file_writer.c @@ -32,25 +32,44 @@ #include "masa_file_writer.h" #include "ivas_stat_com.h" +#ifdef FIX_350_MASA_DELAY_COMP +#include "ivas_stat_dec.h" +#endif #include "ivas_cnst.h" #include #include #include #include +#ifdef FIX_350_MASA_DELAY_COMP +typedef struct masaMetaDelayStorage +{ + MASA_DECRIPTIVE_META descriptiveMeta; + uint16_t directionIndex[MASA_MAXIMUM_DIRECTIONS][DELAY_MASA_PARAM_DEC_SFR][MASA_FREQUENCY_BANDS]; + uint8_t directToTotalRatio[MASA_MAXIMUM_DIRECTIONS][DELAY_MASA_PARAM_DEC_SFR][MASA_FREQUENCY_BANDS]; + uint8_t spreadCoherence[MASA_MAXIMUM_DIRECTIONS][DELAY_MASA_PARAM_DEC_SFR][MASA_FREQUENCY_BANDS]; + uint8_t surroundCoherence[DELAY_MASA_PARAM_DEC_SFR][MASA_FREQUENCY_BANDS]; + uint8_t diffuseToTotalRatio[DELAY_MASA_PARAM_DEC_SFR][MASA_FREQUENCY_BANDS]; + +} MASA_META_DELAY_STORAGE; +#endif struct MasaFileWriter { FILE *file; char *file_path; +#ifdef FIX_350_MASA_DELAY_COMP + MASA_META_DELAY_STORAGE *delayStorage; +#endif }; /*-----------------------------------------------------------------------* * Local constants *-----------------------------------------------------------------------*/ +#ifndef FIX_350_MASA_DELAY_COMP #define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 ) /* Spherical index corresponding to front direction for setting as default value */ - +#endif /*-----------------------------------------------------------------------* * Local functions @@ -75,16 +94,76 @@ static void getExtMasaMetadataFileName( return; } +#ifdef FIX_350_MASA_DELAY_COMP +static void delayMasaMetadata( + MASA_DECODER_EXT_OUT_META_HANDLE extOutMeta, /* i/o : New input metadata which is inplace replaced with delayed metadata frame */ + MASA_META_DELAY_STORAGE *delayStorage /* i/o : Storage for 10 ms of metadata and related descriptive metadata */ +) +{ + int16_t dir, sf, band; + uint16_t temp; + uint8_t currentNumberOfDirections; + + /* Move meta to delay and output. Always use two directions as the metadata is prepared to contain zero energy second direction + * if there is 1dir meta. */ + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES - DELAY_MASA_PARAM_DEC_SFR; sf++ ) + { + for ( band = 0; band < MASA_FREQUENCY_BANDS; band++ ) + { + for ( dir = 0; dir < MASA_MAXIMUM_DIRECTIONS; dir++ ) + { + temp = delayStorage->directionIndex[dir][sf][band]; + delayStorage->directionIndex[dir][sf][band] = extOutMeta->directionIndex[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band]; + extOutMeta->directionIndex[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->directionIndex[dir][sf][band]; + extOutMeta->directionIndex[dir][sf][band] = temp; + + temp = delayStorage->directToTotalRatio[dir][sf][band]; + delayStorage->directToTotalRatio[dir][sf][band] = extOutMeta->directToTotalRatio[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band]; + extOutMeta->directToTotalRatio[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->directToTotalRatio[dir][sf][band]; + extOutMeta->directToTotalRatio[dir][sf][band] = temp; + + temp = delayStorage->spreadCoherence[dir][sf][band]; + delayStorage->spreadCoherence[dir][sf][band] = extOutMeta->spreadCoherence[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band]; + extOutMeta->spreadCoherence[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->spreadCoherence[dir][sf][band]; + extOutMeta->spreadCoherence[dir][sf][band] = temp; + } + + temp = delayStorage->surroundCoherence[sf][band]; + delayStorage->surroundCoherence[sf][band] = extOutMeta->surroundCoherence[sf + DELAY_MASA_PARAM_DEC_SFR][band]; + extOutMeta->surroundCoherence[sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->surroundCoherence[sf][band]; + extOutMeta->surroundCoherence[sf][band] = temp; + + temp = delayStorage->diffuseToTotalRatio[sf][band]; + delayStorage->diffuseToTotalRatio[sf][band] = extOutMeta->diffuseToTotalRatio[sf + DELAY_MASA_PARAM_DEC_SFR][band]; + extOutMeta->diffuseToTotalRatio[sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->diffuseToTotalRatio[sf][band]; + extOutMeta->diffuseToTotalRatio[sf][band] = temp; + } + } + + /* Finalize descriptive meta by using new frame except for number of directions which is the larger of the two */ + currentNumberOfDirections = extOutMeta->descriptiveMeta.numberOfDirections; + if ( delayStorage->descriptiveMeta.numberOfDirections > extOutMeta->descriptiveMeta.numberOfDirections ) + { + extOutMeta->descriptiveMeta.numberOfDirections = delayStorage->descriptiveMeta.numberOfDirections; + } + delayStorage->descriptiveMeta.numberOfDirections = currentNumberOfDirections; + + return; +} +#endif /*---------------------------------------------------------------------* - * MasaFileWriter_writeFrame() + * MasaFileWriter_open() * * *---------------------------------------------------------------------*/ ivas_error MasaFileWriter_open( - const char *outputWavFilename, /* i : name of the output audio file */ - MasaFileWriter **masaWriter /* o : MasaFileWriter handle */ + const char *outputWavFilename, /* i : name of the output audio file */ +#ifdef FIX_350_MASA_DELAY_COMP + const bool delayCompensationEnabled, /* i : is delay compensation enabled */ +#endif + MasaFileWriter **masaWriter /* o : MasaFileWriter handle */ ) { MasaFileWriter *self; @@ -110,6 +189,13 @@ ivas_error MasaFileWriter_open( self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); strcpy( self->file_path, filePath ); +#ifdef FIX_350_MASA_DELAY_COMP + if ( !delayCompensationEnabled ) + { + self->delayStorage = calloc( sizeof(MASA_META_DELAY_STORAGE), 1 ); + } +#endif + *masaWriter = self; return IVAS_ERR_OK; @@ -123,8 +209,12 @@ ivas_error MasaFileWriter_open( *---------------------------------------------------------------------*/ ivas_error MasaFileWriter_writeFrame( - MasaFileWriter *self, /* i/o: MasaFileWriter handle */ - IVAS_MASA_QMETADATA_HANDLE hMasaQMetadata /* i/o: MASA qMetadata handle to be written */ + MasaFileWriter *self, /* i/o: MasaFileWriter handle */ +#ifdef FIX_350_MASA_DELAY_COMP + MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta /* i/o: MASA ext out meta handle to be written */ +#else + IVAS_MASA_QMETADATA_HANDLE hMasaQMetadata /* i/o: MASA qMetadata handle to be written */ +#endif ) { if ( self == NULL ) @@ -132,6 +222,11 @@ ivas_error MasaFileWriter_writeFrame( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } +#ifdef FIX_350_MASA_DELAY_COMP + uint16_t descMetaTemp = 0; + int16_t i, sf, dir, numDirections; + uint8_t writeTempOther[MASA_FREQUENCY_BANDS]; +#else const uint8_t ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */ uint16_t descMetaTemp = 0; int16_t i, sf, b_old, b_new, dir; @@ -147,7 +242,45 @@ ivas_error MasaFileWriter_writeFrame( numCodingBands = hMasaQMetadata->numCodingBands; bandMap = hMasaQMetadata->bandMap; nchan_transport = hMasaQMetadata->nchan_transport; +#endif + +#ifdef FIX_350_MASA_DELAY_COMP + /* If delay storage has been reserved, then we are in the normal mode for the decoder + * (i.e., no delay compensation for PCM) which means that metadata should be delayed + * by two subframes (10 ms). Descriptive metadata is a combined result. */ + if ( self->delayStorage ) + { + delayMasaMetadata( hMasaExtOutMeta, self->delayStorage ); + } + numDirections = hMasaExtOutMeta->descriptiveMeta.numberOfDirections + 1; + + if ( fwrite( &( hMasaExtOutMeta->descriptiveMeta.formatDescriptor ), sizeof( uint8_t ), 8, self->file ) != 8 ) + { + return IVAS_ERR_FAILED_FILE_WRITE; + } + + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.numberOfDirections << 15u; + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.numberOfChannels << 14u; + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.sourceFormat << 12u; + if ( hMasaExtOutMeta->descriptiveMeta.sourceFormat == 0x0 || hMasaExtOutMeta->descriptiveMeta.sourceFormat == 0x1 ) + { + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.transportDefinition << 9u; + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.channelAngle << 6u; + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.channelDistance; + } + else if ( hMasaExtOutMeta->descriptiveMeta.sourceFormat == 0x2 ) + { + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.channelLayout << 9u; + /* 9 LSB remain at zero */ + } + else if ( hMasaExtOutMeta->descriptiveMeta.sourceFormat == 0x3 ) + { + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.transportDefinition << 9u; + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.channelAngle << 6u; + /* 6 LSB remain at zero */ + } +#else /* Construct descriptive meta */ for ( i = 0; i < 8; i++ ) { @@ -187,6 +320,7 @@ ivas_error MasaFileWriter_writeFrame( descMetaTemp += descMeta.channelAngle << 6u; /* 6 LSB remain at zero */ } +#endif if ( fwrite( &( descMetaTemp ), sizeof( uint16_t ), 1, self->file ) != 1 ) { @@ -198,6 +332,9 @@ ivas_error MasaFileWriter_writeFrame( for ( dir = 0; dir < numDirections; dir++ ) { /* Spherical index */ +#ifdef FIX_350_MASA_DELAY_COMP + if ( fwrite( hMasaExtOutMeta->directionIndex[dir][sf], sizeof( uint16_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) +#else for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) { writeTempIndex[i] = SPH_IDX_FRONT; @@ -212,11 +349,15 @@ ivas_error MasaFileWriter_writeFrame( } if ( fwrite( writeTempIndex, sizeof( uint16_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) +#endif { return IVAS_ERR_FAILED_FILE_WRITE; } /* Direct-to-total ratio */ +#ifdef FIX_350_MASA_DELAY_COMP + if ( fwrite( hMasaExtOutMeta->directToTotalRatio[dir][sf], sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) +#else for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) { writeTempOther[i] = 0; @@ -231,11 +372,15 @@ ivas_error MasaFileWriter_writeFrame( } if ( fwrite( writeTempOther, sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) +#endif { return IVAS_ERR_FAILED_FILE_WRITE; } /* Spread coherence */ +#ifdef FIX_350_MASA_DELAY_COMP + if ( fwrite( hMasaExtOutMeta->spreadCoherence[dir][sf], sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) +#else for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) { writeTempOther[i] = 0; @@ -253,6 +398,7 @@ ivas_error MasaFileWriter_writeFrame( } if ( fwrite( writeTempOther, sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) +#endif { return IVAS_ERR_FAILED_FILE_WRITE; } @@ -260,6 +406,9 @@ ivas_error MasaFileWriter_writeFrame( /* Common spatial meta */ /* Diffuse-to-total ratio = 1 - sum(direct-to-total ratios) */ +#ifdef FIX_350_MASA_DELAY_COMP + if ( fwrite( hMasaExtOutMeta->diffuseToTotalRatio[sf], sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) +#else for ( b_new = 0; b_new < MASA_FREQUENCY_BANDS; b_new++ ) { writeTempOther[b_new] = UINT8_MAX; @@ -278,11 +427,16 @@ ivas_error MasaFileWriter_writeFrame( } if ( fwrite( writeTempOther, sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) +#endif { return IVAS_ERR_FAILED_FILE_WRITE; } /* Surround coherence */ +#ifdef FIX_350_MASA_DELAY_COMP + if ( fwrite( hMasaExtOutMeta->surroundCoherence[sf], sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) +#else + /* Surround coherence */ for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) { writeTempOther[i] = 0; @@ -300,16 +454,24 @@ ivas_error MasaFileWriter_writeFrame( } if ( fwrite( writeTempOther, sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) +#endif { return IVAS_ERR_FAILED_FILE_WRITE; } /* Remainder-to-total ratio */ /* This is zero after codec */ +#ifdef FIX_350_MASA_DELAY_COMP + for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) + { + writeTempOther[i] = 0u; + } +#else for ( b_new = 0; b_new < MASA_FREQUENCY_BANDS; b_new++ ) { writeTempOther[b_new] = 0u; } +#endif if ( fwrite( writeTempOther, sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) { @@ -338,6 +500,9 @@ void MasaFileWriter_close( fclose( ( *selfPtr )->file ); free( ( *selfPtr )->file_path ); +#ifdef FIX_350_MASA_DELAY_COMP + free( ( *selfPtr )->delayStorage ); +#endif free( *selfPtr ); *selfPtr = NULL; diff --git a/lib_util/masa_file_writer.h b/lib_util/masa_file_writer.h index 29b4dd1b3f..b440bb5e2e 100644 --- a/lib_util/masa_file_writer.h +++ b/lib_util/masa_file_writer.h @@ -34,6 +34,10 @@ #define IVAS_MASA_FILE_WRITER_H #include +#include "options.h" +#ifdef FIX_350_MASA_DELAY_COMP +#include +#endif #include "common_api_types.h" #include "ivas_error.h" @@ -43,12 +47,19 @@ typedef struct MasaFileWriter MasaFileWriter; ivas_error MasaFileWriter_open( const char *outputWavFilename, /* i : name of the output audio file */ - MasaFileWriter **masaWriter /* o : MasaFileWriter handle */ +#ifdef FIX_350_MASA_DELAY_COMP + const bool delayCompensationEnabled, /* i : is delay compensation enabled */ +#endif + MasaFileWriter **masaWriter /* o : MasaFileWriter handle */ ); ivas_error MasaFileWriter_writeFrame( - MasaFileWriter *self, /* i/o: MasaFileWriter handle */ + MasaFileWriter *self, /* i/o: MasaFileWriter handle */ +#ifdef FIX_350_MASA_DELAY_COMP + MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta /* i/o: MASA ext out meta handle to be written */ +#else IVAS_MASA_QMETADATA_HANDLE hMasaQMetadata /* i/o: MASA qMetadata handle to be written */ +#endif ); void MasaFileWriter_close( -- GitLab From 59ea3dba8bd581f3804f08a1e1bab4bdbebf6282 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Wed, 22 Feb 2023 17:09:29 +0200 Subject: [PATCH 090/375] Run clang format --- lib_util/masa_file_writer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_util/masa_file_writer.c b/lib_util/masa_file_writer.c index 079ef9238e..5e1068b199 100644 --- a/lib_util/masa_file_writer.c +++ b/lib_util/masa_file_writer.c @@ -159,11 +159,11 @@ static void delayMasaMetadata( *---------------------------------------------------------------------*/ ivas_error MasaFileWriter_open( - const char *outputWavFilename, /* i : name of the output audio file */ + const char *outputWavFilename, /* i : name of the output audio file */ #ifdef FIX_350_MASA_DELAY_COMP const bool delayCompensationEnabled, /* i : is delay compensation enabled */ #endif - MasaFileWriter **masaWriter /* o : MasaFileWriter handle */ + MasaFileWriter **masaWriter /* o : MasaFileWriter handle */ ) { MasaFileWriter *self; @@ -192,7 +192,7 @@ ivas_error MasaFileWriter_open( #ifdef FIX_350_MASA_DELAY_COMP if ( !delayCompensationEnabled ) { - self->delayStorage = calloc( sizeof(MASA_META_DELAY_STORAGE), 1 ); + self->delayStorage = calloc( sizeof( MASA_META_DELAY_STORAGE ), 1 ); } #endif @@ -209,7 +209,7 @@ ivas_error MasaFileWriter_open( *---------------------------------------------------------------------*/ ivas_error MasaFileWriter_writeFrame( - MasaFileWriter *self, /* i/o: MasaFileWriter handle */ + MasaFileWriter *self, /* i/o: MasaFileWriter handle */ #ifdef FIX_350_MASA_DELAY_COMP MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta /* i/o: MASA ext out meta handle to be written */ #else -- GitLab From 604544d39530a20c9607816429806710d62b19e9 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Wed, 22 Feb 2023 16:37:18 +0100 Subject: [PATCH 091/375] fix the build-time warnings of unused parameters when the flag FIX_350_MASA_DELAY_COMP is active --- lib_com/ivas_prot.h | 5 ++++- lib_enc/ivas_init_enc.c | 4 ++++ lib_enc/ivas_masa_enc.c | 5 ++++- lib_enc/ivas_mcmasa_enc.c | 4 ++++ lib_enc/ivas_mct_enc.c | 8 ++++++++ 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 9a69f81882..972f5ecaa4 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4462,9 +4462,12 @@ ivas_error ivas_masa_enc_open( ); void ivas_masa_enc_close( - MASA_ENCODER_HANDLE hMasa, /* i/o: MASA metadata structure */ + MASA_ENCODER_HANDLE hMasa /* i/o: MASA metadata structure */ + #ifndef FIX_350_MASA_DELAY_COMP + , const int16_t nchan_transport, /* i : Number of transport channels */ const IVAS_FORMAT ivas_format /* i : IVAS format */ + #endif ); void ivas_masa_enc_reconfigure( diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 8995ebe92a..6a753847cf 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -974,7 +974,11 @@ void ivas_destroy_enc( /* MASA handle */ if ( st_ivas->hMasa != NULL ) { +#ifdef FIX_350_MASA_DELAY_COMP + ivas_masa_enc_close( st_ivas->hMasa ); +#else ivas_masa_enc_close( st_ivas->hMasa, st_ivas->nchan_transport, ivas_format ); +#endif st_ivas->hMasa = NULL; } diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 006b6f4273..0836afa3d1 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -149,9 +149,12 @@ ivas_error ivas_masa_enc_open( *-----------------------------------------------------------------------*/ void ivas_masa_enc_close( - MASA_ENCODER_HANDLE hMasa, /* i/o: MASA metadata structure */ + MASA_ENCODER_HANDLE hMasa /* i/o: MASA metadata structure */ +#ifndef FIX_350_MASA_DELAY_COMP + , const int16_t nchan_transport, /* i : Number of transport channels */ const IVAS_FORMAT ivas_format /* i : IVAS format */ +#endif ) { int16_t i; diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index e456cb3b70..a4affbe598 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -418,7 +418,11 @@ ivas_error ivas_mcmasa_enc_reconfig( /* bitrate changed, may need to do something */ /* brute-force solution: close McMASA and re-instantiate with new settings */ +#ifdef FIX_350_MASA_DELAY_COMP + ivas_masa_enc_close( st_ivas->hMasa ); +#else ivas_masa_enc_close( st_ivas->hMasa, st_ivas->nchan_transport, st_ivas->hEncoderConfig->ivas_format ); +#endif ivas_mcmasa_enc_close( st_ivas->hMcMasa, st_ivas->hEncoderConfig->input_Fs ); /* Determine if to separate some channels from the analysis */ diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 5da41e279e..fd8d1939b7 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -621,7 +621,11 @@ static ivas_error ivas_mc_enc_reconfig( if ( st_ivas->hMasa != NULL ) { +#ifdef FIX_350_MASA_DELAY_COMP + ivas_masa_enc_close( st_ivas->hMasa ); +#else ivas_masa_enc_close( st_ivas->hMasa, nchan_transport_old, MC_FORMAT ); +#endif st_ivas->hMasa = NULL; } @@ -654,7 +658,11 @@ static ivas_error ivas_mc_enc_reconfig( } if ( st_ivas->hMasa != NULL ) { +#ifdef FIX_350_MASA_DELAY_COMP + ivas_masa_enc_close( st_ivas->hMasa ); +#else ivas_masa_enc_close( st_ivas->hMasa, nchan_transport_old, MC_FORMAT ); +#endif st_ivas->hMasa = NULL; } -- GitLab From 5455d28af05c67caba2cf5c71e56451ae34e052b Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 23 Feb 2023 13:32:47 +0100 Subject: [PATCH 092/375] fix leftover merge artefact in ivas_stat_rend.h and whitespace changes to avoid merge conflicts --- lib_dec/ivas_stat_dec.h | 2 ++ lib_rend/ivas_crend.c | 1 + lib_rend/ivas_orient_trk.c | 4 ++++ lib_rend/ivas_rotation.c | 3 +++ lib_rend/ivas_stat_rend.h | 4 +--- lib_rend/lib_rend.h | 8 ++++---- lib_util/head_rotation_file_reader.c | 1 + 7 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index ff1e567e78..04bf534e41 100755 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1762,6 +1762,7 @@ typedef struct ivas_reverb_state_t } REVERB_DATA, *REVERB_HANDLE; + #ifndef FIX_I109_ORIENTATION_TRACKING typedef struct ivas_orient_trk_state_t { @@ -1791,6 +1792,7 @@ typedef struct ivas_orient_trk_state_t } ivas_orient_trk_state_t; #endif + /* Main Crend structure */ typedef struct ivas_crend_state_t { diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 31fd20240d..fadb082f5c 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -2187,6 +2187,7 @@ ivas_error ivas_rend_openCrend( hCrend->hTrack = NULL; } #endif + if ( ( hRendCfg != NULL ) && ( hRendCfg->roomAcoustics.late_reverb_on ) ) { if ( ( error = ivas_reverb_open( &( hCrend->hReverb ), diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 22ffdf64cb..dc889b7d08 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -53,6 +53,7 @@ /* TODO relate to frame rate - assumed here 50Hz, i.e. 20ms frame length */ #define OTR_UPDATE_RATE ( 50.0f ) /* rate of the Process() calls [Hz]; 1x per IVAS frame */ + /*------------------------------------------------------------------------------------------* * Local functions *------------------------------------------------------------------------------------------*/ @@ -303,6 +304,7 @@ void ivas_orient_trk_Init( /* Track relative to a reference orientation */ pOTR->trackingType = OTR_TRACKING_REF_ORIENT; #endif + /* configuration parameters */ pOTR->centerAdaptationRate = 1.0f / 30.0f; pOTR->offCenterAdaptationRate = 1.0f / 8.0f; @@ -433,6 +435,7 @@ ivas_error ivas_orient_trk_SetAbsoluteOrientation( } #endif + /*-------------------------------------------------------------------* * ivas_orient_trk_Process() * @@ -643,6 +646,7 @@ ivas_error ivas_orient_trk_Process( return IVAS_ERR_OK; } + /*-------------------------------------------------------------------* * ivas_orient_trk_GetTrackedOrientation() * diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index f657dd6672..4772d9afe0 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -70,12 +70,14 @@ ivas_error ivas_headTrack_open( ( *hHeadTrackData )->lrSwitchedCurrent = 0; ( *hHeadTrackData )->lrSwitchedNext = 0; #ifdef FIX_I109_ORIENTATION_TRACKING + if ( ( ( *hHeadTrackData )->OrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); } ivas_orient_trk_Init( ( *hHeadTrackData )->OrientationTracker ); #endif + /* Initialise Rmat_prev to I, Rmat will be computed later */ for ( i = 0; i < 3; i++ ) { @@ -215,6 +217,7 @@ void Quat2Euler( } #endif + /*------------------------------------------------------------------------- * rotateAziEle() * diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 2799b251e2..3770346c19 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -209,8 +209,6 @@ typedef struct float lfeOutputGains[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; } IVAS_REND_LfeRouting; -<<<<<<< HEAD -======= #ifdef FIX_197_CREND_INTERFACE_LIB_REND_H typedef struct @@ -219,7 +217,6 @@ typedef struct IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; } IVAS_REND_HeadRotData; ->>>>>>> main #endif /*----------------------------------------------------------------------------------* @@ -720,6 +717,7 @@ typedef struct ivas_orient_trk_state_t } ivas_orient_trk_state_t; #endif + /*----------------------------------------------------------------------------------* * TD ISm Object Renderer structure *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 3637fa87fb..c5a8ce6343 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -270,13 +270,13 @@ ivas_error IVAS_REND_InitConfig( ); int16_t IVAS_REND_GetRenderConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ - const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ ); int16_t IVAS_REND_FeedRenderConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ - const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ ); ivas_error IVAS_REND_SetHeadRotation( diff --git a/lib_util/head_rotation_file_reader.c b/lib_util/head_rotation_file_reader.c index 8be293c89a..92e2acfd52 100644 --- a/lib_util/head_rotation_file_reader.c +++ b/lib_util/head_rotation_file_reader.c @@ -157,6 +157,7 @@ ivas_error HeadRotationFileReading( } #endif + /*-----------------------------------------------------------------------* * HeadRotationFileReader_close() * -- GitLab From 0b014d8a18ed5b966aac8b86936289537a8b73c4 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 23 Feb 2023 13:38:40 +0100 Subject: [PATCH 093/375] preemptively accept FIX_343_TO_UPPER to avoid merge conflicts --- apps/decoder.c | 56 ----------------------------------------------- apps/encoder.c | 26 ---------------------- apps/renderer.c | 6 ----- lib_com/options.h | 1 - 4 files changed, 89 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 7fac28c52c..ddc9cedd4a 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -624,9 +624,7 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config( char argv_to_upper[FILENAME_MAX]; strncpy( argv_to_upper, argv, sizeof( argv_to_upper ) - 1 ); -#ifdef FIX_343_TO_UPPER argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; -#endif to_upper( argv_to_upper ); if ( strcmp( argv_to_upper, "EXT" ) == 0 ) /* external renderer */ @@ -705,9 +703,6 @@ static bool parseCmdlIVAS_dec( char argv_to_upper[FILENAME_MAX]; #ifdef DEBUGGING float ftmp; -#ifndef FIX_343_TO_UPPER - char stmp[FILENAME_MAX]; -#endif arg->forcedRendMode = IVAS_DEC_FORCE_REND_UNFORCED; arg->forceSubframeBinauralization = false; @@ -775,9 +770,7 @@ static bool parseCmdlIVAS_dec( while ( argv[i][0] == '-' ) { strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); -#ifdef FIX_343_TO_UPPER argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; -#endif to_upper( argv_to_upper ); if ( strcmp( argv_to_upper, "-VOIP" ) == 0 ) @@ -785,21 +778,13 @@ static bool parseCmdlIVAS_dec( arg->voipMode = 1; i++; } -#ifdef FIX_343_TO_UPPER else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=0" ) == 0 ) -#else - else if ( strcmp( to_upper( argv[i] ), "-VOIP_HF_ONLY=0" ) == 0 ) -#endif { arg->voipMode = 1; arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP; i++; } -#ifdef FIX_343_TO_UPPER else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=1" ) == 0 ) -#else - else if ( strcmp( to_upper( argv[i] ), "-VOIP_HF_ONLY=1" ) == 0 ) -#endif { arg->voipMode = 1; arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF; @@ -872,14 +857,9 @@ static bool parseCmdlIVAS_dec( i++; if ( i < argc - 3 ) { -#ifdef FIX_343_TO_UPPER strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; arg->forcedRendMode = parseForcedRendModeDec( argv_to_upper ); -#else - strncpy( stmp, argv[i], sizeof( stmp ) ); - arg->forcedRendMode = parseForcedRendModeDec( stmp ); -#endif i++; } } @@ -934,7 +914,6 @@ static bool parseCmdlIVAS_dec( } #else -#ifdef FIX_343_TO_UPPER strncpy( argv_to_upper, argv[i + 1], sizeof( argv_to_upper ) - 1 ); argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; to_upper( argv_to_upper ); @@ -953,17 +932,9 @@ static bool parseCmdlIVAS_dec( usage_dec(); return false; } -#else - char tmp[4]; - strcpy( tmp, argv[i + 1] ); -#endif #ifdef FIX_I109_ORIENTATION_TRACKING -#ifndef FIX_343_TO_UPPER - if ( strcmp( to_upper( tmp ), "NON" ) == 0 ) -#else char *tmp = to_upper( argv[i + 1] ); if ( strcmp( to_upper( tmp ), "NONE" ) == 0 ) -#endif { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; } @@ -1028,7 +999,6 @@ static bool parseCmdlIVAS_dec( return false; } -#ifdef FIX_343_TO_UPPER strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; if ( ( strcmp( argv_to_upper, "CENTER" ) == 0 ) || ( strchr( argv_to_upper, 'C' ) != NULL ) ) @@ -1054,32 +1024,6 @@ static bool parseCmdlIVAS_dec( return false; } } -#else - char *param = to_upper( argv[i] ); - if ( ( strcmp( param, "CENTER" ) == 0 ) || ( strchr( param, 'C' ) != NULL ) ) - { - arg->no_diegetic_pan = 0.f; - } - else if ( ( strcmp( param, "LEFT" ) == 0 ) || ( strchr( param, 'L' ) != NULL ) ) - { - arg->no_diegetic_pan = -1.f; - } - else if ( ( strcmp( param, "RIGHT" ) == 0 ) || ( strchr( param, 'R' ) != NULL ) ) - { - arg->no_diegetic_pan = 1.f; - } - else - { - arg->no_diegetic_pan = (float) atof( param ); - - if ( arg->no_diegetic_pan > 1.0f || arg->no_diegetic_pan < -1.0f ) - { - fprintf( stderr, "Error: Incorrect value for panning option argument specified!\n\n" ); - usage_dec(); - return false; - } - } -#endif i++; } diff --git a/apps/encoder.c b/apps/encoder.c index 2aab6d5ae8..09baa814ae 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -884,9 +884,7 @@ static bool parseCmdlIVAS_enc( while ( i < argc - 4 ) { strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); -#ifdef FIX_343_TO_UPPER argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; -#endif to_upper( argv_to_upper ); /*-----------------------------------------------------------------* @@ -898,9 +896,7 @@ static bool parseCmdlIVAS_enc( arg->max_bwidth_user = true; strncpy( stmp, argv[i + 1], sizeof( stmp ) - 1 ); -#ifdef FIX_343_TO_UPPER stmp[sizeof( stmp ) - 1] = '\0'; -#endif to_upper( stmp ); if ( strcmp( stmp, "-NB" ) == 0 || strcmp( stmp, "NB" ) == 0 ) @@ -1088,9 +1084,7 @@ static bool parseCmdlIVAS_enc( if ( i < argc - 4 ) { strncpy( stmp, argv[i], sizeof( stmp ) ); -#ifdef FIX_343_TO_UPPER stmp[sizeof( stmp ) - 1] = '\0'; -#endif to_upper( argv[i] ); if ( strcmp( argv[i], "LO" ) == 0 ) { @@ -1378,7 +1372,6 @@ static bool parseCmdlIVAS_enc( if ( i < argc - 4 ) { -#ifdef FIX_343_TO_UPPER if ( strcmp( argv[i], "5_1" ) == 0 ) { arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1; @@ -1396,25 +1389,6 @@ static bool parseCmdlIVAS_enc( arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_4; } else if ( strcmp( argv[i], "7_1_4" ) == 0 ) -#else - if ( strcmp( to_upper( argv[i] ), "5_1" ) == 0 ) - { - arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1; - } - else if ( strcmp( to_upper( argv[i] ), "7_1" ) == 0 ) - { - arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_7_1; - } - else if ( strcmp( to_upper( argv[i] ), "5_1_2" ) == 0 ) - { - arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_2; - } - else if ( strcmp( to_upper( argv[i] ), "5_1_4" ) == 0 ) - { - arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_4; - } - else if ( strcmp( to_upper( argv[i] ), "7_1_4" ) == 0 ) -#endif { arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_7_1_4; } diff --git a/apps/renderer.c b/apps/renderer.c index 5936add157..97be6af109 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -504,9 +504,7 @@ static void setupWithSingleFormatInput( /* It is allowed on CLI to have no metadata for an ISM input - skip opening if string is empty or contains "NULL" */ char charBuf[FILENAME_MAX]; strncpy( charBuf, args.inMetadataFilePaths[i], min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1 ); -#ifdef FIX_343_TO_UPPER charBuf[min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1] = '\0'; -#endif to_upper( charBuf ); if ( isEmptyString( args.inMetadataFilePaths[i] ) || strncmp( charBuf, "NULL", 4 ) == 0 ) { @@ -1180,9 +1178,7 @@ static bool parseInConfig( /* First check if input is being set to scene description file - this is not covered by parseAudioConfig(). */ strncpy( charBuf, inFormatStr, sizeof( charBuf ) - 1 ); -#ifdef FIX_343_TO_UPPER charBuf[sizeof( charBuf ) - 1] = '\0'; -#endif to_upper( charBuf ); if ( strcmp( charBuf, "META" ) == 0 ) { @@ -1376,9 +1372,7 @@ static IVAS_REND_AudioConfig parseAudioConfig( charBuf[13] = '\0'; strncpy( charBuf, configString, sizeof( charBuf ) - 1 ); -#ifdef FIX_343_TO_UPPER charBuf[sizeof( charBuf ) - 1] = '\0'; -#endif to_upper( charBuf ); if ( ( strcmp( charBuf, "MONO" ) == 0 ) || ( strcmp( charBuf, "HOA0" ) == 0 ) || ( strcmp( charBuf, "SBA0" ) == 0 ) ) diff --git a/lib_com/options.h b/lib_com/options.h index c0cca55010..fe0df43683 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -165,7 +165,6 @@ #define DISABLE_RES_CHANNELS_MCT /* decode only W and residual for Y when outputting to stereo */ #endif -#define FIX_343_TO_UPPER /* VA: issue 343: safeguard for function to_upper() */ /* ################## End DEVELOPMENT switches ######################### */ -- GitLab From fad6163a2e9ccb9d53d31e2854615baa2c2adec5 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 23 Feb 2023 13:47:28 +0100 Subject: [PATCH 094/375] preemptively accept FIX_198_TDREND_INTERFACE to avoid merge conflicts --- lib_com/options.h | 1 - lib_rend/ivas_objectRenderer.c | 378 --------------------------------- 2 files changed, 379 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index fe0df43683..54393ead8e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -156,7 +156,6 @@ #define FIX_MEMORY_COUNTING_HRTF_BINARY_FILE #define FIX_334_DEBUG_BE_STEREO_SWITCHING /* FhG: Fix non-BE issue for stereo switching when DEBUGGING is enabled */ -#define FIX_198_TDREND_INTERFACE /* Issue 198: Harmonize interface for TD renderer between decoder and external renderer */ #define DFT_STEREO_SPAR_MIXING #ifdef DFT_STEREO_SPAR_MIXING diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index ddd4d06f9e..dc5e536bc0 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -61,7 +61,6 @@ static void TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE h const IVAS_FORMAT in_format, const ISM_METADATA_HANDLE *hIsmMetaData, float output[][L_FRAME48k] ); -#ifdef FIX_198_TDREND_INTERFACE static ivas_error ivas_td_binaural_open_unwrap( TDREND_HRFILT_FiltSet_t **hHrtfTD, const int32_t output_Fs, const int16_t nchan_transport, const IVAS_FORMAT ivas_format, const AUDIO_CONFIG transport_config, const IVAS_OUTPUT_SETUP hTransSetup, BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, int32_t *binaural_latency_ns ); static void ObjRenderIVASFrame_unwrap( RENDER_CONFIG_DATA *hRenderConfig, const int16_t ini_frame, @@ -114,23 +113,8 @@ static ivas_error ivas_td_binaural_open_unwrap( BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, /* o : TD renderer handle */ int32_t *binaural_latency_ns /* i : Binauralization delay */ ) -#else -/*---------------------------------------------------------------------* - * ivas_td_binaural_open() - * - * Open and initialize TD Object binaural renderer - *---------------------------------------------------------------------*/ - -ivas_error ivas_td_binaural_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -#endif { -#ifdef FIX_198_TDREND_INTERFACE BINAURAL_TD_OBJECT_RENDERER_HANDLE pBinRendTd; -#else - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; -#endif TDREND_PosType_t PosType; int16_t nS; int16_t SrcInd[MAX_NUM_TDREND_CHANNELS]; @@ -143,105 +127,55 @@ ivas_error ivas_td_binaural_open( error = IVAS_ERR_OK; -#ifdef FIX_198_TDREND_INTERFACE if ( ( pBinRendTd = malloc( sizeof( BINAURAL_TD_OBJECT_RENDERER ) ) ) == NULL ) -#else - if ( ( hBinRendererTd = malloc( sizeof( BINAURAL_TD_OBJECT_RENDERER ) ) ) == NULL ) -#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); } -#ifdef FIX_198_TDREND_INTERFACE if ( ( pBinRendTd->TdRend_MixSpatSpec_p = malloc( sizeof( TDREND_MixSpatSpec_t ) ) ) == NULL ) -#else - if ( ( hBinRendererTd->TdRend_MixSpatSpec_p = malloc( sizeof( TDREND_MixSpatSpec_t ) ) ) == NULL ) -#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); } -#ifdef FIX_198_TDREND_INTERFACE if ( ( pBinRendTd->DirAtten_p = malloc( sizeof( TDREND_DirAtten_t ) ) ) == NULL ) -#else - if ( ( hBinRendererTd->DirAtten_p = malloc( sizeof( TDREND_DirAtten_t ) ) ) == NULL ) -#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); } -#ifdef FIX_198_TDREND_INTERFACE if ( ( pBinRendTd->Listener_p = malloc( sizeof( TDREND_MIX_Listener_t ) ) ) == NULL ) -#else - if ( ( hBinRendererTd->Listener_p = malloc( sizeof( TDREND_MIX_Listener_t ) ) ) == NULL ) -#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); } -#ifdef FIX_198_TDREND_INTERFACE pBinRendTd->NumOfSrcs = 0; pBinRendTd->MaxSrcInd = -1; /* Mixer spatial setup */ pBinRendTd->TdRend_MixSpatSpec_p->UseCommonDistAttenModel = TRUE; pBinRendTd->TdRend_MixSpatSpec_p->DistAttenModel = 0; /* 0=Turned off, else use TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED */ -#else - hBinRendererTd->NumOfSrcs = 0; - hBinRendererTd->MaxSrcInd = -1; - /* Mixer spatial setup */ - hBinRendererTd->TdRend_MixSpatSpec_p->UseCommonDistAttenModel = TRUE; - hBinRendererTd->TdRend_MixSpatSpec_p->DistAttenModel = 0; /* 0=Turned off, else use TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED */ -#endif - -#ifdef FIX_198_TDREND_INTERFACE TDREND_MIX_Init( pBinRendTd, hHrtfTD, pBinRendTd->TdRend_MixSpatSpec_p, output_Fs ); -#else - TDREND_MIX_Init( hBinRendererTd, &st_ivas->hHrtfTD, hBinRendererTd->TdRend_MixSpatSpec_p, st_ivas->hDecoderConfig->output_Fs ); -#endif /* Set the attenuation (or can set MixSpatSpec.DistAttenModel above) */ -#ifdef FIX_198_TDREND_INTERFACE TDREND_MIX_SetDistAttenModel( pBinRendTd, TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED ); -#else - TDREND_MIX_SetDistAttenModel( hBinRendererTd, TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED ); -#endif /* Add sources to module and mixer, headphones */ PosType = TDREND_POSTYPE_ABSOLUTE; /* or TDREND_POSTYPE_RELATIVE_TO_LISTENER */ -#ifdef FIX_198_TDREND_INTERFACE nchan_rend = nchan_transport; if ( ( ivas_format == MC_FORMAT ) && ( transport_config != AUDIO_CONFIG_LS_CUSTOM ) ) -#else - nchan_rend = st_ivas->nchan_transport; - if ( st_ivas->ivas_format == MC_FORMAT ) -#endif { nchan_rend--; /* Skip LFE channel -- added to the others */ } for ( nS = 0; nS < nchan_rend; nS++ ) { -#ifdef FIX_198_TDREND_INTERFACE if ( ( error = TDREND_MIX_AddSrc( pBinRendTd, &SrcInd[nS], PosType ) ) != IVAS_ERR_OK ) -#else - if ( ( error = TDREND_MIX_AddSrc( hBinRendererTd, &SrcInd[nS], PosType ) ) != IVAS_ERR_OK ) -#endif { return error; } } -#ifdef FIX_198_TDREND_INTERFACE if ( ivas_format == MC_FORMAT ) -#else - if ( st_ivas->ivas_format == MC_FORMAT ) -#endif { -#ifdef FIX_198_TDREND_INTERFACE switch ( transport_config ) -#else - switch ( st_ivas->transport_config ) -#endif { case AUDIO_CONFIG_5_1: ls_azimuth = ls_azimuth_CICP6; @@ -264,24 +198,15 @@ ivas_error ivas_td_binaural_open( ls_elevation = ls_elevation_CICP19; break; case AUDIO_CONFIG_LS_CUSTOM: -#ifdef FIX_198_TDREND_INTERFACE ls_azimuth = hTransSetup.ls_azimuth; ls_elevation = hTransSetup.ls_elevation; -#else - ls_azimuth = st_ivas->hTransSetup.ls_azimuth; - ls_elevation = st_ivas->hTransSetup.ls_elevation; -#endif break; default: ls_azimuth = NULL; ls_elevation = NULL; } -#ifdef FIX_198_TDREND_INTERFACE DirAtten_p = pBinRendTd->DirAtten_p; -#else - DirAtten_p = hBinRendererTd->DirAtten_p; -#endif for ( nS = 0; nS < nchan_rend; nS++ ) { @@ -298,27 +223,15 @@ ivas_error ivas_td_binaural_open( DirAtten_p->ConeOuterAngle = 360.0f; DirAtten_p->ConeOuterGain = 1.0f; -#ifdef FIX_198_TDREND_INTERFACE TDREND_MIX_SRC_SetPos( pBinRendTd, nS, Pos ); TDREND_MIX_SRC_SetDir( pBinRendTd, nS, Dir ); TDREND_MIX_SRC_SetPlayState( pBinRendTd, nS, TDREND_PLAYSTATUS_PLAYING ); TDREND_MIX_SRC_SetDirAtten( pBinRendTd, nS, DirAtten_p ); -#else - TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); - TDREND_MIX_SRC_SetDir( hBinRendererTd, nS, Dir ); - TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); - TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ); -#endif } } -#ifdef FIX_198_TDREND_INTERFACE *hBinRendererTd = pBinRendTd; *binaural_latency_ns = (int32_t) ( ( *hBinRendererTd )->HrFiltSet_p->latency_s * 1000000000.f ); -#else - st_ivas->hBinRendererTd = hBinRendererTd; - st_ivas->binaural_latency_ns = (int32_t) ( hBinRendererTd->HrFiltSet_p->latency_s * 1000000000.f ); -#endif return error; } @@ -350,7 +263,6 @@ void ivas_td_binaural_close( return; } -#ifdef FIX_198_TDREND_INTERFACE /*---------------------------------------------------------------------* * ObjRenderIVASFrame() * @@ -411,20 +323,6 @@ static void ObjRenderIVASFrame_unwrap( ivas_orient_trk_state_t *pOTR /* i/o: orientation tracker handle */ #endif ) -#else -/*---------------------------------------------------------------------* - * ObjRenderIVASFrame() - * - * Receives the current frames for the object streams, updates metadata - * and renders the current frame. - *---------------------------------------------------------------------*/ - -void ObjRenderIVASFrame( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ - const int16_t output_frame /* i : output frame length */ -) -#endif { int16_t subframe_length; int16_t subframe_idx; @@ -434,25 +332,13 @@ void ObjRenderIVASFrame( #endif subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; -#ifdef FIX_198_TDREND_INTERFACE if ( hRenderConfig != NULL ) -#else - if ( st_ivas->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ -#endif { -#ifdef FIX_198_TDREND_INTERFACE if ( hRenderConfig->roomAcoustics.late_reverb_on && ( ini_frame == 0 ) ) -#else - if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on && ( st_ivas->ini_frame == 0 ) ) -#endif { #ifdef FIX_197_CREND_INTERFACE -#ifdef FIX_198_TDREND_INTERFACE ivas_reverb_open( &hCrendWrapper->hCrend->hReverb, transport_config, NULL, hRenderConfig, output_Fs ); -#else - ivas_reverb_open( &st_ivas->hCrendWrapper->hCrend->hReverb, st_ivas->transport_config, NULL, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ); -#endif #else ivas_reverb_open( &st_ivas->hCrend->hReverb, st_ivas->transport_config, NULL, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ); #endif @@ -460,17 +346,12 @@ void ObjRenderIVASFrame( } /* Update object position(s) */ -#ifdef FIX_198_TDREND_INTERFACE TDREND_Update_object_positions( hBinRendererTd, nchan_transport, lfe_idx, ivas_format, hIsmMetaData, output ); -#else - TDREND_Update_object_positions( st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, output ); -#endif for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { /* Update the listener's location/orientation */ #ifdef FIX_I109_ORIENTATION_TRACKING -#ifdef FIX_198_TDREND_INTERFACE if ( pOTR != NULL ) { if ( ivas_orient_trk_Process( pOTR, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ) != IVAS_ERR_OK ) @@ -480,63 +361,25 @@ void ObjRenderIVASFrame( } TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( pOTR != NULL ) ? &trackedHeadOrientation : NULL ); #else - if ( st_ivas->hHeadTrackData != NULL ) - { - if ( ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, &st_ivas->hHeadTrackData->Quaternions[subframe_idx], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ) != IVAS_ERR_OK ) - { - exit( -1 ); - } - } - TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, - st_ivas->hDecoderConfig->Opt_Headrotation, - ( st_ivas->hHeadTrackData != NULL ) ? &trackedHeadOrientation : NULL ); -#endif -#else -#ifdef FIX_198_TDREND_INTERFACE TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL ); -#else - TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, - st_ivas->hDecoderConfig->Opt_Headrotation, - ( st_ivas->hHeadTrackData != NULL ) ? &st_ivas->hHeadTrackData->Quaternions[subframe_idx] : NULL ); -#endif #endif -#ifdef FIX_198_TDREND_INTERFACE if ( ( hRenderConfig != NULL ) && ( hRenderConfig->roomAcoustics.late_reverb_on ) ) -#else - if ( ( st_ivas->hRenderConfig != NULL ) && ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) ) -#endif { #ifdef FIX_197_CREND_INTERFACE -#ifdef FIX_198_TDREND_INTERFACE ivas_reverb_process( hCrendWrapper->hCrend->hReverb, transport_config, 0, output, reverb_signal, subframe_idx ); -#else - ivas_reverb_process( st_ivas->hCrendWrapper->hCrend->hReverb, st_ivas->transport_config, 0, output, reverb_signal, subframe_idx ); -#endif #else ivas_reverb_process( st_ivas->hCrend->hReverb, st_ivas->transport_config, 0, output, reverb_signal, subframe_idx ); #endif } /* Render subframe */ -#ifdef FIX_198_TDREND_INTERFACE TDREND_GetMix( hBinRendererTd, output, subframe_length, subframe_idx ); -#else - TDREND_GetMix( st_ivas->hBinRendererTd, output, subframe_length, subframe_idx ); -#endif } -#ifdef FIX_198_TDREND_INTERFACE if ( hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ -#else - if ( st_ivas->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ -#endif { -#ifdef FIX_198_TDREND_INTERFACE if ( hRenderConfig->roomAcoustics.late_reverb_on ) -#else - if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) -#endif { /* add reverb to rendered signals */ v_add( reverb_signal[0], output[0], output[0], output_frame ); @@ -759,31 +602,11 @@ ivas_error ivas_rend_TDObjRendOpen( LSSETUP_CUSTOM_STRUCT *customLsInput, const int32_t outFs ) { -#ifndef FIX_198_TDREND_INTERFACE - /* TODO tmu : Based on ivas_td_binaural_open() - could be harmonized / refactored - - review error handling - - review hHrtfTD init - */ - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; - TDREND_PosType_t PosType; - int16_t nS; - int16_t SrcInd[MAX_NUM_TDREND_CHANNELS]; - const float *ls_azimuth, *ls_elevation; - float Pos[3]; - float Dir[3]; - TDREND_DirAtten_t *DirAtten_p; -#endif -#ifdef FIX_198_TDREND_INTERFACE int16_t nchan_transport; AUDIO_CONFIG transport_config; IVAS_FORMAT ivas_format; IVAS_OUTPUT_SETUP hTransSetup; -#else - int16_t nchan_rend; - ivas_error error; -#endif -#ifdef FIX_198_TDREND_INTERFACE if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { getAudioConfigNumChannels( inConfig, &nchan_transport ); @@ -799,126 +622,6 @@ ivas_error ivas_rend_TDObjRendOpen( return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); -#else - - error = IVAS_ERR_OK; - - if ( ( hBinRendererTd = malloc( sizeof( BINAURAL_TD_OBJECT_RENDERER ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); - } - if ( ( hBinRendererTd->TdRend_MixSpatSpec_p = malloc( sizeof( TDREND_MixSpatSpec_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); - } - if ( ( hBinRendererTd->DirAtten_p = malloc( sizeof( TDREND_DirAtten_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); - } - if ( ( hBinRendererTd->Listener_p = malloc( sizeof( TDREND_MIX_Listener_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); - } - - if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) - { - getAudioConfigNumChannels( inConfig, &nchan_rend ); - if ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) - { - nchan_rend--; /* Skip LFE channel -- added to the others */ - } - } - else - { - nchan_rend = customLsInput->num_spk; - } - - hBinRendererTd->NumOfSrcs = 0; - hBinRendererTd->MaxSrcInd = -1; - - /* Mixer spatial setup */ - hBinRendererTd->TdRend_MixSpatSpec_p->UseCommonDistAttenModel = TRUE; - hBinRendererTd->TdRend_MixSpatSpec_p->DistAttenModel = 0; /* 0=Turned off, else use TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED */ - - TDREND_MIX_Init( hBinRendererTd, &pTDRend->hHrtfTD, hBinRendererTd->TdRend_MixSpatSpec_p, outFs ); - - /* Set the attenuation (or can set MixSpatSpec.DistAttenModel above) */ - TDREND_MIX_SetDistAttenModel( hBinRendererTd, TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED ); - - /* Add sources to module and mixer, headphones */ - PosType = TDREND_POSTYPE_ABSOLUTE; /* or TDREND_POSTYPE_RELATIVE_TO_LISTENER */ - - for ( nS = 0; nS < nchan_rend; nS++ ) - { - if ( ( error = TDREND_MIX_AddSrc( hBinRendererTd, &SrcInd[nS], PosType ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) - { - switch ( inConfig ) - { - case IVAS_REND_AUDIO_CONFIG_5_1: - ls_azimuth = ls_azimuth_CICP6; - ls_elevation = ls_elevation_CICP6; - break; - case IVAS_REND_AUDIO_CONFIG_7_1: - ls_azimuth = ls_azimuth_CICP12; - ls_elevation = ls_elevation_CICP12; - break; - case IVAS_REND_AUDIO_CONFIG_5_1_2: - ls_azimuth = ls_azimuth_CICP14; - ls_elevation = ls_elevation_CICP14; - break; - case IVAS_REND_AUDIO_CONFIG_5_1_4: - ls_azimuth = ls_azimuth_CICP16; - ls_elevation = ls_elevation_CICP16; - break; - case IVAS_REND_AUDIO_CONFIG_7_1_4: - ls_azimuth = ls_azimuth_CICP19; - ls_elevation = ls_elevation_CICP19; - break; - case IVAS_REND_AUDIO_CONFIG_LS_CUSTOM: - ls_azimuth = customLsInput->ls_azimuth; - ls_elevation = customLsInput->ls_elevation; - break; - default: - ls_azimuth = NULL; - ls_elevation = NULL; - } - - DirAtten_p = hBinRendererTd->DirAtten_p; - - for ( nS = 0; nS < nchan_rend; nS++ ) - { - /* Set source positions according to loudspeaker layout */ - Pos[0] = cosf( ls_elevation[nS] * PI_OVER_180 ) * cosf( ls_azimuth[nS] * PI_OVER_180 ); - Pos[1] = cosf( ls_elevation[nS] * PI_OVER_180 ) * sinf( ls_azimuth[nS] * PI_OVER_180 ); - Pos[2] = sinf( ls_elevation[nS] * PI_OVER_180 ); - Dir[0] = 1.0f; - Dir[1] = 0.0f; - Dir[2] = 0.0f; - - /* Source directivity info */ - DirAtten_p->ConeInnerAngle = 360.0f; - DirAtten_p->ConeOuterAngle = 360.0f; - DirAtten_p->ConeOuterGain = 1.0f; - - TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); - TDREND_MIX_SRC_SetDir( hBinRendererTd, nS, Dir ); - TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); - TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ); - } - } - - pTDRend->hBinRendererTd = hBinRendererTd; - - pTDRend->binaural_latency_ns = (int32_t) ( hBinRendererTd->HrFiltSet_p->latency_s * 1000000000.f ); - - return IVAS_ERR_OK; -#endif } /*---------------------------------------------------------------------* @@ -939,36 +642,22 @@ ivas_error ivas_rend_TDObjRenderFrame( float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ) { -#ifndef FIX_198_TDREND_INTERFACE - int16_t subframe_length; - int16_t subframe_idx; - ISM_METADATA_HANDLE hIsmMetaData[1]; -#else ISM_METADATA_FRAME hIsmMetaDataFrame; ISM_METADATA_HANDLE hIsmMetaData[1]; -#endif int16_t lfe_idx; int16_t num_src; /* TODO tmu : pass down renderer config struct */ // float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; IVAS_FORMAT ivas_format; IVAS_REND_AudioConfigType inConfigType; -#ifdef FIX_198_TDREND_INTERFACE AUDIO_CONFIG transport_config; int32_t output_Fs; -#else -#ifdef FIX_I109_ORIENTATION_TRACKING - IVAS_QUATERNION trackedHeadOrientation; -#endif -#endif push_wmops( "ivas_rend_TDObjRenderFrame" ); inConfigType = getAudioConfigType( inConfig ); lfe_idx = LFE_CHANNEL; -#ifdef FIX_198_TDREND_INTERFACE hIsmMetaData[0] = NULL; -#endif if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { @@ -987,20 +676,12 @@ ivas_error ivas_rend_TDObjRenderFrame( { ivas_format = ISM_FORMAT; num_src = 1; -#ifdef FIX_198_TDREND_INTERFACE hIsmMetaData[0] = &hIsmMetaDataFrame; -#else - hIsmMetaData[0] = malloc( sizeof( ISM_METADATA_FRAME ) ); -#endif hIsmMetaData[0]->azimuth = currentPos->azimuth; hIsmMetaData[0]->elevation = currentPos->elevation; } -#ifndef FIX_198_TDREND_INTERFACE - subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; -#endif -#ifdef FIX_198_TDREND_INTERFACE transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); output_Fs = output_frame * 50; @@ -1013,65 +694,6 @@ ivas_error ivas_rend_TDObjRenderFrame( #endif ); -#else - - /* TODO tmu : pass down renderer config struct and decide what to do about ini_frame ? */ - // if ( hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ - // { - // if ( hRenderConfig->roomAcoustics.late_reverb_on && ( st_ivas->ini_frame == 0 ) ) - // { - // ivas_reverb_open( &pTDRend->hCrend->hReverb, pTDRend->transport_config, NULL, pTDRend->hRenderConfig, pTDRend->hDecoderConfig->output_Fs ); - // } - // } - - /* Update object position(s) */ - TDREND_Update_object_positions( pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, output ); - - /* TODO tmu : needs a refactor / better approach */ - if ( ivas_format == ISM_FORMAT ) - { - free( hIsmMetaData[0] ); - } - - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) - { - /* Update the listener's location/orientation */ -#ifdef FIX_I109_ORIENTATION_TRACKING - if ( headRotData->headRotEnabled ) - { - ivas_orient_trk_Process( headRotData->hOrientationTracker, - &headRotData->headPositions[subframe_idx], - FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, - &trackedHeadOrientation ); - } - TDREND_Update_listener_orientation( pTDRend->hBinRendererTd, headRotData->headRotEnabled, ( headRotData != NULL ) ? &trackedHeadOrientation : NULL ); -#else - TDREND_Update_listener_orientation( pTDRend->hBinRendererTd, headRotData->headRotEnabled, ( headRotData != NULL ) ? &headRotData->headPositions[subframe_idx] : NULL ); -#endif - - /* TODO tmu : pass down renderer config struct */ - // if ( ( hRenderConfig != NULL ) && ( hRenderConfig->roomAcoustics.late_reverb_on ) ) - // { - // ivas_reverb_process( hCrend->hReverb, transport_config, 0, output, reverb_signal, subframe_idx ); - // } - - /* Render subframe */ - TDREND_GetMix( pTDRend->hBinRendererTd, output, subframe_length, subframe_idx ); - } - - /* TODO tmu : pass down renderer config struct */ - // if ( pTDRend->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ - // { - // if ( pTDRend->hRenderConfig->roomAcoustics.late_reverb_on ) - // { - // /* add reverb to rendered signals */ - // v_add( reverb_signal[0], output[0], output[0], output_frame ); - // v_add( reverb_signal[1], output[1], output[1], output_frame ); - // } - // } - - -#endif pop_wmops(); return IVAS_ERR_OK; -- GitLab From 60ef3077b92b3832e6be2f92933f69bdd73d2192 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Thu, 23 Feb 2023 15:34:13 +0100 Subject: [PATCH 095/375] Enable reverb for TD renderer for ISM, 5.1 and 7.1 with headtracking enabled for IVAS_rend - under FIX_330_ENABLE_TD_RENDERER_REVERB_REND define - Also fix bug affecting TD renderer reverb introduced in commit c5de9c9a --- lib_com/options.h | 2 + lib_dec/ivas_init_dec.c | 14 + lib_dec/ivas_objectRenderer_internal.c | 9 +- lib_dec/ivas_stat_dec.h | 7 +- lib_rend/ivas_objectRenderer.c | 62 ++++- lib_rend/ivas_prot_rend.h | 9 + lib_rend/ivas_reverb.c | 11 + lib_rend/lib_rend.c | 367 ++++++++++++++++++------- 8 files changed, 370 insertions(+), 111 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9a6a9d4c5b..18e4f48b55 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -145,6 +145,8 @@ #define LOW_RATE_TRANS_CORE_CODER /* Eri: Activate low-rate-encoding-of-transients contribution for core coder, affects MC, MASA and SBA */ #define FIX_197_CREND_INTERFACE #define FIX_329_ENABLE_TD_RENDERER_REVERB_MC /* Eri: Enable reverb for TD renderer for 5.1 and 7.1 with headtracking enabled for IVAS_dec */ +#define FIX_330_ENABLE_TD_RENDERER_REVERB_REND /* Eri: Enable reverb for TD renderer for ISM, 5.1 and 7.1 with headtracking enabled for IVAS_rend */ + #define FIX_347_DTX_CRASH /* FhG: Fix crash that can happen with DTX */ #define DISABLE_RES_CHANNELS_MCT /* decode only W and residual for Y when outputting to stereo */ #define FIX_107_5MS_SUBFRAME_RENDERING diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 7f28bc4226..c0b5a9805f 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1210,6 +1210,12 @@ ivas_error ivas_init_decoder( if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) { +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_config, NULL, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } +#else #ifdef FIX_197_CREND_INTERFACE #ifdef FIX_329_ENABLE_TD_RENDERER_REVERB_MC if ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper ) ) != IVAS_ERR_OK ) @@ -1226,6 +1232,7 @@ ivas_error ivas_init_decoder( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); } +#endif } } else if ( st_ivas->renderer_type == RENDERER_MC ) @@ -1579,6 +1586,9 @@ void ivas_initialize_handles_dec( st_ivas->hMonoDmxRenderer = NULL; #ifdef FIX_197_CREND_INTERFACE st_ivas->hCrendWrapper = NULL; +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + st_ivas->hReverb = NULL; +#endif #else st_ivas->hCrend = NULL; st_ivas->hHrtf = NULL; @@ -1745,6 +1755,10 @@ void ivas_destroy_dec( #else ivas_crend_close( st_ivas ); #endif +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + /* Reverb handle */ + ivas_reverb_close( &st_ivas->hReverb ); +#endif /* LS config converter handle */ ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index d2f08ffdd6..09db6fabfb 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -71,13 +71,20 @@ void ivas_td_binaural_renderer( const int16_t output_frame /* i : output frame length */ ) { +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + ivas_td_binaural_renderer_unwrap( st_ivas->hReverb, +#else ivas_td_binaural_renderer_unwrap( st_ivas->hRenderConfig, st_ivas->ini_frame, #ifdef FIX_197_CREND_INTERFACE st_ivas->hCrendWrapper, #else st_ivas->hCrend, +#endif #endif st_ivas->transport_config, - st_ivas->hDecoderConfig->output_Fs, st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, +#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + st_ivas->hDecoderConfig->output_Fs, +#endif + st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, output, output_frame ); } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 7c6ac19f7e..574a96abc9 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1217,10 +1217,13 @@ typedef struct Decoder_Struct MONO_DOWNMIX_RENDERER_HANDLE hMonoDmxRenderer; /* Mono downmix structure */ #ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE hCrendWrapper; -#else +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + REVERB_HANDLE hReverb; /* Reverb handle */ +#endif +#else CREND_HANDLE hCrend; /* Convolution mixer renderer structure */ HRTFS_HANDLE hHrtf; /* HRTFs handle */ -#endif +#endif HRTFS_CREND_HANDLE hSetOfHRTF; /* Set of HRTFs handle (CRend) */ HRTFS_FASTCONV_HANDLE hHrtfFastConv; /* FASTCONV HRTF tables for binaural rendering */ HRTFS_PARAMBIN_HANDLE hHrtfParambin; /* HRTF tables for parametric binauralizer */ diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index b60967e7f7..69a8c88219 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -221,15 +221,21 @@ void ivas_td_binaural_close( *---------------------------------------------------------------------*/ void ivas_td_binaural_renderer_unwrap( - RENDER_CONFIG_DATA *hRenderConfig, /* i : Renderer configuration */ - const int16_t ini_frame, /* i : Initialization frame counter */ +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + REVERB_HANDLE hReverb, /* i : reverb handle */ +#else + RENDER_CONFIG_DATA *hRenderConfig, /* i : Renderer configuration */ + const int16_t ini_frame, /* i : Initialization frame counter */ #ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE hCrendWrapper, /* i : Crend wrapper handle */ #else CREND_HANDLE hCrend, /* i : Crend handle */ #endif - AUDIO_CONFIG transport_config, /* i : Transport configuration */ - const int32_t output_Fs, /* i : Output sampling rate */ +#endif + AUDIO_CONFIG transport_config, /* i : Transport configuration */ +#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + const int32_t output_Fs, /* i : Output sampling rate */ +#endif BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ const int16_t nchan_transport, /* i : Transport channels (ISms) */ const int16_t lfe_idx, /* i : LFE channel index */ @@ -246,6 +252,7 @@ void ivas_td_binaural_renderer_unwrap( float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; +#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( hRenderConfig != NULL ) { @@ -263,6 +270,7 @@ void ivas_td_binaural_renderer_unwrap( output_Fs ); } } +#endif /* Update object position(s) */ TDREND_Update_object_positions( hBinRendererTd, nchan_transport, lfe_idx, ivas_format, hIsmMetaData, output ); @@ -272,11 +280,19 @@ void ivas_td_binaural_renderer_unwrap( /* Update the listener's location/orientation */ TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL ); +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + if ( ( hReverb != NULL ) && ( hReverb->pConfig.roomAcoustics.late_reverb_on ) ) +#else if ( ( hRenderConfig != NULL ) && ( hRenderConfig->roomAcoustics.late_reverb_on ) ) +#endif { ivas_reverb_process( #ifdef FIX_197_CREND_INTERFACE +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + hReverb, +#else hCrendWrapper->hCrend->hReverb, +#endif #else hCrend->hReverb, #endif @@ -286,6 +302,7 @@ void ivas_td_binaural_renderer_unwrap( reverb_signal, subframe_idx ); +#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND ivas_reverb_process( #ifdef FIX_197_CREND_INTERFACE hCrendWrapper->hCrend->hReverb, @@ -297,15 +314,26 @@ void ivas_td_binaural_renderer_unwrap( output, reverb_signal, subframe_idx ); +#endif } /* Render subframe */ TDREND_GetMix( hBinRendererTd, output, subframe_length, subframe_idx ); } + +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + if ( hReverb != NULL ) +#else if ( hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ +#endif { + +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + if ( hReverb != NULL ) +#else if ( hRenderConfig->roomAcoustics.late_reverb_on ) +#endif { /* add reverb to rendered signals */ v_add( reverb_signal[0], output[0], output[0], output_frame ); @@ -577,20 +605,27 @@ ivas_error ivas_td_binaural_renderer_ext( const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ - const int16_t output_frame, /* i : output frame length */ - float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + const REVERB_HANDLE reverb, /* i : reverb handle */ +#endif + const int16_t output_frame, /* i : output frame length */ + float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ) { ISM_METADATA_FRAME hIsmMetaDataFrame; ISM_METADATA_HANDLE hIsmMetaData[1]; int16_t lfe_idx; int16_t num_src; +#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND /* TODO tmu : pass down renderer config struct */ // float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; +#endif IVAS_FORMAT ivas_format; IVAS_REND_AudioConfigType inConfigType; AUDIO_CONFIG transport_config; +#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND int32_t output_Fs; +#endif push_wmops( "ivas_td_binaural_renderer_ext" ); @@ -601,6 +636,9 @@ ivas_error ivas_td_binaural_renderer_ext( if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { ivas_format = MC_FORMAT; +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); +#endif if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { getAudioConfigNumChannels( inConfig, &num_src ); @@ -615,22 +653,32 @@ ivas_error ivas_td_binaural_renderer_ext( { ivas_format = ISM_FORMAT; num_src = 1; +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + transport_config = AUDIO_CONFIG_ISM1; +#endif hIsmMetaData[0] = &hIsmMetaDataFrame; hIsmMetaData[0]->azimuth = currentPos->azimuth; hIsmMetaData[0]->elevation = currentPos->elevation; } +#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND #ifdef FIX_197_CREND_INTERFACE transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); #else transport_config = rendAudioConfigToIvasAudioConfig( inConfig ); #endif output_Fs = output_frame * 50; - +#endif +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + ivas_td_binaural_renderer_unwrap( reverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, + ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, + output, output_frame ); +#else ivas_td_binaural_renderer_unwrap( NULL, 1, NULL, transport_config, output_Fs, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, output, output_frame ); +#endif pop_wmops(); diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 8a6cb1a2f9..a2e14a35f1 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -216,15 +216,21 @@ void ivas_HRTF_CRend_binary_close( *----------------------------------------------------------------------------------*/ void ivas_td_binaural_renderer_unwrap( +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + REVERB_HANDLE hReverb, /* i : reverb handle */ +#else RENDER_CONFIG_DATA *hRenderConfig, /* i : Renderer configuration */ const int16_t ini_frame, /* i : Initialization frame counter */ #ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE hCrendWrapper, /* i : Crend wrapper handle */ #else CREND_HANDLE hCrend, /* i : Crend handle */ +#endif #endif AUDIO_CONFIG transport_config, /* i : Transport configuration */ +#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND const int32_t output_Fs, /* i : Output sampling rate */ +#endif BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ const int16_t nchan_transport, /* i : Transport channels (ISms) */ const int16_t lfe_idx, /* i : LFE channel index */ @@ -242,6 +248,9 @@ ivas_error ivas_td_binaural_renderer_ext( const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + const REVERB_HANDLE reverb, /* i : reverb handle */ +#endif const int16_t output_frame, /* i : output frame length */ float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ); diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index a3d55584b4..3911c36601 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1175,6 +1175,17 @@ ivas_error ivas_reverb_open( /* set up reverb acoustic data on the basis of HRTF data and renderer config */ set_reverb_acoustic_data( ¶ms, input_audio_config, hHrtf, &hRenderConfig->roomAcoustics, subframe_len, nr_fc_input, nr_fc_fft_filter ); +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + /* set reverb acoustic configuration based on renderer config */ +#ifdef DEBUGGING + pState->pConfig.renderer_type_override = hRenderConfig->renderer_type_override; +#endif + pState->pConfig.roomAcoustics.override = hRenderConfig->roomAcoustics.override; + pState->pConfig.roomAcoustics.use_brir = hRenderConfig->roomAcoustics.use_brir; + pState->pConfig.roomAcoustics.late_reverb_on = hRenderConfig->roomAcoustics.late_reverb_on; + pState->pConfig.roomAcoustics.nBands = hRenderConfig->roomAcoustics.nBands; +#endif + /* set up input downmix */ pState->dmx_gain = calc_dmx_gain(); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 8f868bd58f..788c439e62 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -117,6 +117,9 @@ typedef struct TDREND_WRAPPER tdRendWrapper; #ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE crendWrapper; +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + REVERB_HANDLE reverb; +#endif #else CREND_WRAPPER crendWrapper; #endif @@ -146,6 +149,9 @@ typedef struct TDREND_WRAPPER tdRendWrapper; #ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE crendWrapper; +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + REVERB_HANDLE reverb; +#endif #else CREND_WRAPPER crendWrapper; #endif @@ -1062,6 +1068,9 @@ static ivas_error setRendInputActiveIsm( inputIsm->previousPos = defaultObjectPosition(); #ifdef FIX_197_CREND_INTERFACE inputIsm->crendWrapper = NULL; +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + inputIsm->reverb = NULL; +#endif #else inputIsm->crendWrapper = defaultCrendWrapper(); #endif @@ -1075,19 +1084,38 @@ static ivas_error setRendInputActiveIsm( } else if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) { - error = ivas_rend_openCrend( &inputIsm->crendWrapper, - AUDIO_CONFIG_7_1_4, +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + if ( hRendCfg != NULL && hRendCfg->roomAcoustics.use_brir == 0 && hRendCfg->roomAcoustics.late_reverb_on ) + { + error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, NULL, *rendCtx.pOutSampleRate ); + if ( ( error = ivas_reverb_open( &( inputIsm->reverb ), + getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, + hRendCfg, + *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { +#endif + error = ivas_rend_openCrend( &inputIsm->crendWrapper, + AUDIO_CONFIG_7_1_4, #ifdef FIX_197_CREND_INTERFACE - getIvasAudioConfigFromRendAudioConfig( outConfig ), + getIvasAudioConfigFromRendAudioConfig( outConfig ), #else rendAudioConfigToIvasAudioConfig( outConfig ), #endif - hRendCfg, + hRendCfg, #ifdef FIX_197_CREND_INTERFACE - 0, + 0, +#endif + NULL, + *rendCtx.pOutSampleRate ); +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + } #endif - NULL, - *rendCtx.pOutSampleRate ); } if ( error != IVAS_ERR_OK ) { @@ -1115,6 +1143,12 @@ static void clearInputIsm( { ivas_rend_closeCrend( &inputIsm->crendWrapper ); } +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + if ( inputIsm->reverb != NULL ) + { + ivas_reverb_close( &inputIsm->reverb ); + } +#endif if ( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) { ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); @@ -1754,6 +1788,12 @@ static ivas_error initMcBinauralRendering( { ivas_rend_closeCrend( &inputMc->crendWrapper ); } +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + if ( inputMc->reverb != NULL ) + { + ivas_reverb_close( &inputMc->reverb ); + } +#endif if ( inputMc->efapInWrapper.hEfap != NULL ) { efap_free_data( &inputMc->efapInWrapper.hEfap ); @@ -1783,6 +1823,19 @@ static ivas_error initMcBinauralRendering( { return error; } +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + if ( hRendCfg != NULL && hRendCfg->roomAcoustics.use_brir == 0 && hRendCfg->roomAcoustics.late_reverb_on ) + { + if ( ( error = ivas_reverb_open( &( inputMc->reverb ), + getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, + hRendCfg, + outSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif } { @@ -1893,6 +1946,9 @@ static ivas_error setRendInputActiveMc( inputMc->tdRendWrapper = defaultTdRendWrapper(); #ifdef FIX_197_CREND_INTERFACE inputMc->crendWrapper = NULL; +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + inputMc->reverb = NULL; +#endif #else inputMc->crendWrapper = defaultCrendWrapper(); #endif @@ -1937,6 +1993,12 @@ static void clearInputMc( { ivas_rend_closeCrend( &inputMc->crendWrapper ); } +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + if ( inputMc->reverb != NULL ) + { + ivas_reverb_close( &inputMc->reverb ); + } +#endif if ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) { ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); @@ -2699,6 +2761,9 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsIsm[i].crendWrapper = NULL; #else hIvasRend->inputsIsm[i].crendWrapper.hCrend = NULL; +#endif +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + hIvasRend->inputsIsm[i].reverb = NULL; #endif hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; } @@ -2710,6 +2775,9 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsMc[i].crendWrapper = NULL; #else hIvasRend->inputsMc[i].crendWrapper.hCrend = NULL; +#endif +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + hIvasRend->inputsMc[i].reverb = NULL; #endif hIvasRend->inputsMc[i].tdRendWrapper.hBinRendererTd = NULL; } @@ -4182,6 +4250,9 @@ static ivas_error renderIsmToBinaural( NULL, ismInput->base.ctx.pHeadRotData, &ismInput->currentPos, +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + ismInput->reverb, +#endif outAudio.config.numSamplesPerChannel, tmpTDRendBuffer ) ) != IVAS_ERR_OK ) { @@ -4204,7 +4275,11 @@ static ivas_error renderIsmToBinauralRoom( int16_t subframe_idx, subframe_len; int16_t tmp; rotation_matrix Rmat; +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; +#else float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; +#endif IVAS_QUATERNION quat; ivas_error error; pan_vector currentPanGains; @@ -4218,94 +4293,132 @@ static ivas_error renderIsmToBinauralRoom( headRotData = ismInput->base.ctx.pHeadRotData; rotatedPos = defaultObjectPosition(); - if ( headRotData->headRotEnabled ) +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + if ( ismInput->reverb != NULL && ismInput->reverb->pConfig.roomAcoustics.use_brir == 0 && ismInput->reverb->pConfig.roomAcoustics.late_reverb_on == 1 && headRotData->headRotEnabled ) { - subframe_len = ismInput->base.inputBuffer.config.numSamplesPerChannel / RENDERER_HEAD_POSITIONS_PER_FRAME; - // for ( subframe_idx = 0; subframe_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; subframe_idx++ ) - for ( subframe_idx = 0; subframe_idx < 1; subframe_idx++ ) - { - quat.w = headRotData->headPositions[subframe_idx].w; - quat.x = headRotData->headPositions[subframe_idx].x; - quat.y = headRotData->headPositions[subframe_idx].y; - quat.z = headRotData->headPositions[subframe_idx].z; + copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer ); - QuatToRotMat( quat, Rmat ); + /* TODO tmu : missing: interpolation between positions, 5ms rendering */ + if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, + ismInput->base.inConfig, + NULL, + ismInput->base.ctx.pHeadRotData, + &ismInput->currentPos, +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + ismInput->reverb, +#endif + outAudio.config.numSamplesPerChannel, + tmpRendBuffer ) ) != IVAS_ERR_OK ) + { + return error; } - (void) subframe_len; // avoid warning - } - - /* TODO tmu : missing: interpolation between positions, 5ms rendering */ - /* TODO(sgi): Possible optimization: less processing needed if position didn't change */ - /* TODO tmu2sgi: needs a lot of cleanup, we could also add rot_gains_prev to ismInput and use that */ - /* previous position gains */ - if ( headRotData->headRotEnabled ) - { - rotateAziEle( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &azi_rot, &ele_rot, ismInput->rot_mat_prev, 0 ); - rotatedPos.azimuth = (float) azi_rot; - rotatedPos.elevation = (float) ele_rot; } - if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, - ( headRotData->headRotEnabled ) ? rotatedPos.azimuth : ismInput->previousPos.azimuth, - ( headRotData->headRotEnabled ) ? rotatedPos.elevation : ismInput->previousPos.elevation, - previousPanGains ) ) != IVAS_ERR_OK ) + else { - return error; - } +#endif - /* current position gains */ - if ( headRotData->headRotEnabled ) - { - rotateAziEle( ismInput->currentPos.azimuth, ismInput->currentPos.elevation, &azi_rot, &ele_rot, Rmat, 0 ); - rotatedPos.azimuth = (float) azi_rot; - rotatedPos.elevation = (float) ele_rot; - } - if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, - ( headRotData->headRotEnabled ) ? rotatedPos.azimuth : ismInput->currentPos.azimuth, - ( headRotData->headRotEnabled ) ? rotatedPos.elevation : ismInput->currentPos.elevation, - currentPanGains ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( headRotData->headRotEnabled ) + { + subframe_len = ismInput->base.inputBuffer.config.numSamplesPerChannel / RENDERER_HEAD_POSITIONS_PER_FRAME; + // for ( subframe_idx = 0; subframe_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; subframe_idx++ ) + for ( subframe_idx = 0; subframe_idx < 1; subframe_idx++ ) + { + quat.w = headRotData->headPositions[subframe_idx].w; + quat.x = headRotData->headPositions[subframe_idx].x; + quat.y = headRotData->headPositions[subframe_idx].y; + quat.z = headRotData->headPositions[subframe_idx].z; - for ( i = 0; i < 3; i++ ) - { - mvr2r( Rmat[i], ismInput->rot_mat_prev[i], 3 ); - } + QuatToRotMat( quat, Rmat ); + } + (void) subframe_len; // avoid warning + } - /* intermediate rendering to 7_1_4 */ - tmpMcBuffer = ismInput->base.inputBuffer; - getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ); - tmpMcBuffer.config.numChannels = tmp; - tmpMcBuffer.data = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( float ) ); - set_zero( tmpMcBuffer.data, tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels ); + /* TODO tmu : missing: interpolation between positions, 5ms rendering */ + /* TODO(sgi): Possible optimization: less processing needed if position didn't change */ + /* TODO tmu2sgi: needs a lot of cleanup, we could also add rot_gains_prev to ismInput and use that */ + /* previous position gains */ + if ( headRotData->headRotEnabled ) + { + rotateAziEle( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &azi_rot, &ele_rot, ismInput->rot_mat_prev, 0 ); + rotatedPos.azimuth = (float) azi_rot; + rotatedPos.elevation = (float) ele_rot; + } + if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, + ( headRotData->headRotEnabled ) ? rotatedPos.azimuth : ismInput->previousPos.azimuth, + ( headRotData->headRotEnabled ) ? rotatedPos.elevation : ismInput->previousPos.elevation, + previousPanGains ) ) != IVAS_ERR_OK ) + { + return error; + } - renderBufferChannelLerp( ismInput->base.inputBuffer, 0, currentPanGains, previousPanGains, tmpMcBuffer ); + /* current position gains */ + if ( headRotData->headRotEnabled ) + { + rotateAziEle( ismInput->currentPos.azimuth, ismInput->currentPos.elevation, &azi_rot, &ele_rot, Rmat, 0 ); + rotatedPos.azimuth = (float) azi_rot; + rotatedPos.elevation = (float) ele_rot; + } + if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, + ( headRotData->headRotEnabled ) ? rotatedPos.azimuth : ismInput->currentPos.azimuth, + ( headRotData->headRotEnabled ) ? rotatedPos.elevation : ismInput->currentPos.elevation, + currentPanGains ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( i = 0; i < 3; i++ ) + { + mvr2r( Rmat[i], ismInput->rot_mat_prev[i], 3 ); + } + + /* intermediate rendering to 7_1_4 */ + tmpMcBuffer = ismInput->base.inputBuffer; + getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ); + tmpMcBuffer.config.numChannels = tmp; + tmpMcBuffer.data = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( float ) ); + set_zero( tmpMcBuffer.data, tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels ); + renderBufferChannelLerp( ismInput->base.inputBuffer, 0, currentPanGains, previousPanGains, tmpMcBuffer ); + +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + copyBufferTo2dArray( tmpMcBuffer, tmpRendBuffer ); +#else copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); +#endif - ivas_rend_crendProcess( + ivas_rend_crendProcess( #ifdef FIX_197_CREND_INTERFACE - ismInput->crendWrapper, + ismInput->crendWrapper, #else &ismInput->crendWrapper, #endif - AUDIO_CONFIG_7_1_4, - AUDIO_CONFIG_BINAURAL_ROOM, + AUDIO_CONFIG_7_1_4, + AUDIO_CONFIG_BINAURAL_ROOM, #ifdef FIX_197_CREND_INTERFACE - NULL, - NULL, - NULL, - NULL, + NULL, + NULL, + NULL, + NULL, #endif +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + tmpRendBuffer, +#else tmpCrendBuffer, - *ismInput->base.ctx.pOutSampleRate ); +#endif + *ismInput->base.ctx.pOutSampleRate ); +#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); +#endif + free( tmpMcBuffer.data ); +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + } + accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); +#else accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); - - free( tmpMcBuffer.data ); - +#endif pop_wmops(); return IVAS_ERR_OK; @@ -4570,6 +4683,9 @@ static ivas_error renderMcToBinaural( &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, NULL, +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + mcInput->reverb, +#endif mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { @@ -4639,59 +4755,108 @@ static ivas_error renderMcToBinauralRoom( const IVAS_REND_AudioConfig outConfig, IVAS_REND_AudioBuffer outAudio ) { +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + int8_t headRotEnabled; + float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + IVAS_REND_AudioConfig inConfig; +#else float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; +#endif ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; push_wmops( "renderMcToBinauralRoom" ); - /* apply rotation */ - if ( mcInput->base.ctx.pHeadRotData->headRotEnabled ) - { - tmpRotBuffer = mcInput->base.inputBuffer; - tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); - set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + headRotEnabled = mcInput->base.ctx.pHeadRotData->headRotEnabled; + inConfig = mcInput->base.inConfig; - rotateFrameMc( mcInput->base.inputBuffer, - mcInput->base.inConfig, - mcInput->customLsInput, - mcInput->base.ctx.pHeadRotData, - mcInput->rot_gains_prev, - mcInput->efapInWrapper.hEfap, - tmpRotBuffer ); + if ( ( mcInput->reverb != NULL && mcInput->reverb->pConfig.roomAcoustics.use_brir == 0 && mcInput->reverb->pConfig.roomAcoustics.late_reverb_on == 1 ) && ( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) || ( headRotEnabled && ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ) ) ) + { + copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); - copyBufferTo2dArray( tmpRotBuffer, tmpCrendBuffer ); - free( tmpRotBuffer.data ); + if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, + mcInput->base.inConfig, + &mcInput->customLsInput, + mcInput->base.ctx.pHeadRotData, + NULL, + mcInput->reverb, + mcInput->base.inputBuffer.config.numSamplesPerChannel, + tmpRendBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } } else { + + /* apply rotation */ + if ( headRotEnabled ) +#else + /* apply rotation */ + if ( mcInput->base.ctx.pHeadRotData->headRotEnabled ) +#endif + { + tmpRotBuffer = mcInput->base.inputBuffer; + tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); + set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); + + rotateFrameMc( mcInput->base.inputBuffer, + mcInput->base.inConfig, + mcInput->customLsInput, + mcInput->base.ctx.pHeadRotData, + mcInput->rot_gains_prev, + mcInput->efapInWrapper.hEfap, + tmpRotBuffer ); + +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + copyBufferTo2dArray( tmpRotBuffer, tmpRendBuffer ); +#else + copyBufferTo2dArray( tmpRotBuffer, tmpCrendBuffer ); +#endif + free( tmpRotBuffer.data ); + } + else + { +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); +#else copyBufferTo2dArray( mcInput->base.inputBuffer, tmpCrendBuffer ); - } +#endif + } - /* call CREND */ - if ( ( error = ivas_rend_crendProcess( + /* call CREND */ + if ( ( error = ivas_rend_crendProcess( #ifdef FIX_197_CREND_INTERFACE - mcInput->crendWrapper, - getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), - getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, - NULL, - NULL, - NULL, + mcInput->crendWrapper, + getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), + getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, + NULL, + NULL, + NULL, #else &mcInput->crendWrapper, rendAudioConfigToIvasAudioConfig( mcInput->base.inConfig ), rendAudioConfigToIvasAudioConfig( outConfig ), #endif +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND + tmpRendBuffer, +#else tmpCrendBuffer, - *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; +#endif + *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND } + accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); +#else accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); - +#endif /* TODO tmu : needs delay compensation */ renderLfeToBinaural( mcInput, outAudio ); -- GitLab From d5e8d27423ca7f6bd1bb03a43735bb2c6149d72f Mon Sep 17 00:00:00 2001 From: hsd Date: Thu, 23 Feb 2023 16:44:02 +0100 Subject: [PATCH 096/375] [add] OTR_REFERENCE_VECTOR_TRACKING feature --- Workspace_msvc/lib_util.vcxproj | 2 + apps/decoder.c | 107 ++- apps/renderer.c | 77 ++ lib_com/common_api_types.h | 7 + lib_com/ivas_cnst.h | 12 +- lib_com/ivas_prot.h | 8 + lib_com/options.h | 9 + lib_dec/ivas_init_dec.c | 14 + lib_dec/ivas_stat_dec.h | 1 - lib_dec/lib_dec.c | 27 + lib_dec/lib_dec.h | 8 + lib_rend/ivas_objectRenderer.c | 14 +- lib_rend/ivas_objectRenderer_sfx.c | 8 + lib_rend/ivas_orient_trk.c | 214 +++++ lib_rend/lib_rend.c | 31 + lib_rend/lib_rend.h | 10 +- lib_util/vector3_pair_file_reader.c | 166 ++++ lib_util/vector3_pair_file_reader.h | 89 ++ scripts/config/self_test.prm | 8 + scripts/trajectories/const000-Vector3.csv | 4 + .../trajectories/full-circle-4s-Vector3.csv | 200 +++++ .../full-circle-4s-ccw-Vector3.csv | 200 +++++ scripts/trajectories/full-circle-4s-ccw.csv | 800 ++++++++++++++++++ scripts/trajectories/full-circle-4s.csv | 800 ++++++++++++++++++ ...ull-circle-with-up-and-down-4s-Vector3.csv | 200 +++++ ...circle-with-up-and-down-4s-ccw-Vector3.csv | 200 +++++ .../full-circle-with-up-and-down-4s-ccw.csv | 800 ++++++++++++++++++ .../full-circle-with-up-and-down-4s.csv | 800 ++++++++++++++++++ tests/renderer/test_renderer.py | 86 ++ tests/renderer/utils.py | 24 +- 30 files changed, 4919 insertions(+), 7 deletions(-) create mode 100644 lib_util/vector3_pair_file_reader.c create mode 100644 lib_util/vector3_pair_file_reader.h create mode 100644 scripts/trajectories/const000-Vector3.csv create mode 100644 scripts/trajectories/full-circle-4s-Vector3.csv create mode 100644 scripts/trajectories/full-circle-4s-ccw-Vector3.csv create mode 100644 scripts/trajectories/full-circle-4s-ccw.csv create mode 100644 scripts/trajectories/full-circle-4s.csv create mode 100644 scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv create mode 100644 scripts/trajectories/full-circle-with-up-and-down-4s-ccw-Vector3.csv create mode 100644 scripts/trajectories/full-circle-with-up-and-down-4s-ccw.csv create mode 100644 scripts/trajectories/full-circle-with-up-and-down-4s.csv diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index 32bebc7536..5b5e5f30cc 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -146,6 +146,7 @@ + @@ -167,6 +168,7 @@ + diff --git a/apps/decoder.c b/apps/decoder.c index 7fac28c52c..d3bd41ec98 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -43,6 +43,9 @@ #include "ls_custom_file_reader.h" #include "hrtf_file_reader.h" #include "head_rotation_file_reader.h" +#ifdef OTR_REFERENCE_VECTOR_TRACKING +#include "vector3_pair_file_reader.h" +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #include "jbm_file_writer.h" #include "evs_rtp_payload.h" #ifdef DEBUGGING @@ -73,6 +76,10 @@ static #define IVAS_PUBLIC_ORIENT_TRK_NONE ( 0 ) #define IVAS_PUBLIC_ORIENT_TRK_REF ( 1 ) #define IVAS_PUBLIC_ORIENT_TRK_AVG ( 2 ) +#ifdef OTR_REFERENCE_VECTOR_TRACKING +#define IVAS_PUBLIC_ORIENT_TRK_REF_VEC ( 3 ) +#define IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV ( 4 ) +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #else #define IVAS_PUBLIC_ORIENT_TRK_REF 0 #define IVAS_PUBLIC_ORIENT_TRK_AVG 1 @@ -94,6 +101,10 @@ typedef struct bool enableReferenceRotation; char *refrotTrajFileName; #endif +#ifdef OTR_REFERENCE_VECTOR_TRACKING + bool enableReferenceVectorTracking; + char *referenceVectorTrajFileName; +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #ifdef SUPPORT_JBM_TRACEFILE char *jbmTraceFilename; #endif @@ -131,7 +142,11 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); #ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef OTR_REFERENCE_VECTOR_TRACKING +static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, HeadRotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); +#else /* OTR_REFERENCE_VECTOR_TRACKING */ static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, HeadRotFileReader *refRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); +#endif #else static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); #endif @@ -163,6 +178,9 @@ int main( #ifdef FIX_I109_ORIENTATION_TRACKING HeadRotFileReader *refRotReader = NULL; #endif +#ifdef OTR_REFERENCE_VECTOR_TRACKING + Vector3PairFileReader *referenceVectorReader = NULL; +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ ivas_error error = IVAS_ERR_UNKNOWN; int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; RenderConfigReader *renderConfigReader = NULL; @@ -269,6 +287,19 @@ int main( } } #endif +#ifdef OTR_REFERENCE_VECTOR_TRACKING + /*------------------------------------------------------------------------------------------* + * Open reference vector trajectory file + *------------------------------------------------------------------------------------------*/ + if ( arg.enableReferenceVectorTracking ) + { + if ( ( error = Vector3PairFileReader_open( arg.referenceVectorTrajFileName, &referenceVectorReader ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: Can't open reference vector trajectory file %s \n\n", arg.referenceVectorTrajFileName ); + goto cleanup; + } + } +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ /*------------------------------------------------------------------------------------------* * Open custom loudspeaker layout file @@ -518,7 +549,11 @@ int main( else { #ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef OTR_REFERENCE_VECTOR_TRACKING + error = decodeG192( arg, hBsReader, headRotReader, refRotReader, referenceVectorReader, hIvasDec, pcmBuf ); +#else error = decodeG192( arg, hBsReader, headRotReader, refRotReader, hIvasDec, pcmBuf ); +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #else error = decodeG192( arg, hBsReader, headRotReader, hIvasDec, pcmBuf ); #endif @@ -581,7 +616,9 @@ cleanup: #ifdef FIX_I109_ORIENTATION_TRACKING HeadRotationFileReader_close( &refRotReader ); #endif - +#ifdef OTR_REFERENCE_VECTOR_TRACKING + Vector3PairFileReader_close( &referenceVectorReader ); +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ RenderConfigReader_close( &renderConfigReader ); if ( BS_Reader_Close( &hBsReader ) != IVAS_ERR_OK ) @@ -728,6 +765,10 @@ static bool parseCmdlIVAS_dec( arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; arg->enableReferenceRotation = false; arg->headrotTrajFileName = NULL; +#ifdef OTR_REFERENCE_VECTOR_TRACKING + arg->enableReferenceVectorTracking = false; + arg->referenceVectorTrajFileName = NULL; +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #else arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; #endif @@ -947,6 +988,16 @@ static bool parseCmdlIVAS_dec( { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_AVG; } +#ifdef OTR_REFERENCE_VECTOR_TRACKING + else if ( strcmp( argv_to_upper, "REF_VEC" ) == 0 ) + { + arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF_VEC; + } + else if ( strcmp( argv_to_upper, "REF_VEC_LEV" ) == 0 ) + { + arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV; + } +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ else { fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", argv[i + 1] ); @@ -954,7 +1005,7 @@ static bool parseCmdlIVAS_dec( return false; } #else - char tmp[4]; + char tmp[11]; strcpy( tmp, argv[i + 1] ); #endif #ifdef FIX_I109_ORIENTATION_TRACKING @@ -978,6 +1029,16 @@ static bool parseCmdlIVAS_dec( { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_AVG; } +#ifdef OTR_REFERENCE_VECTOR_TRACKING + else if ( strcmp( to_upper( tmp ), "REF_VEC" ) == 0 ) + { + arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF_VEC; + } + else if ( strcmp( to_upper( tmp ), "REF_VEC_LEV" ) == 0 ) + { + arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV; + } +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ else { fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", tmp ); @@ -1004,6 +1065,23 @@ static bool parseCmdlIVAS_dec( i++; } #endif +#ifdef OTR_REFERENCE_VECTOR_TRACKING + else if ( strcmp( argv_to_upper, "-RVF" ) == 0 ) + { + arg->enableReferenceVectorTracking = true; + i++; + + if ( argc - i <= 4 || argv[i][0] == '-' ) + { + fprintf( stderr, "Error: reference vector trajectory file name not specified!\n\n" ); + usage_dec(); + return false; + } + + arg->referenceVectorTrajFileName = argv[i]; + i++; + } +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ else if ( strcmp( argv_to_upper, "-RENDER_CONFIG" ) == 0 ) { arg->renderConfigEnabled = true; @@ -1232,6 +1310,10 @@ static void usage_dec( void ) #else fprintf( stdout, "-otr tracking_type : head orientation tracking type: 'ref' or 'avg' (only for binaural rendering)\n" ); #endif +#ifdef OTR_REFERENCE_VECTOR_TRACKING + fprintf( stdout, "-rvf File : Reference vector specified by external trajectory file\n" ); + fprintf( stdout, " works only in combination with -otr ref_vec and ref_vec_lev modes\n" ); +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ fprintf( stdout, "-render_config file : Renderer configuration file\n" ); fprintf( stdout, "-no_diegetic_pan : panning mono no dietic sound to stereo -1<= pan <=1,\n" ); fprintf( stdout, " left or l or 1->left, right or r or -1->right, center or c or 0->middle\n" ); @@ -1429,6 +1511,9 @@ static ivas_error decodeG192( HeadRotFileReader *headRotReader, #ifdef FIX_I109_ORIENTATION_TRACKING HeadRotFileReader *refRotReader, +#ifdef OTR_REFERENCE_VECTOR_TRACKING + Vector3PairFileReader *referenceVectorReader, +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #endif IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ) @@ -1564,6 +1649,24 @@ static ivas_error decodeG192( goto cleanup; } } +#ifdef OTR_REFERENCE_VECTOR_TRACKING + /* reference vector */ + if ( arg.enableReferenceVectorTracking ) + { + IVAS_VECTOR3 listenerPosition, referencePosition; + if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPosition, &referencePosition ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError %s while reading listener and reference positions from %s\n", IVAS_DEC_GetErrorMessage( error ), Vector3PairFileReader_getFilePath( referenceVectorReader ) ); + goto cleanup; + } + + if ( ( error = IVAS_DEC_FeedRefVectorData( hIvasDec, listenerPosition, referencePosition ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedRefVectorData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #endif /* Run decoder for one frame (get rendered output) */ if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamples ) ) != IVAS_ERR_OK ) diff --git a/apps/renderer.c b/apps/renderer.c index 5936add157..5706c418c4 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -44,6 +44,9 @@ #include "cmdln_parser.h" #include "common_api_types.h" #include "head_rotation_file_reader.h" +#ifdef OTR_REFERENCE_VECTOR_TRACKING +#include "vector3_pair_file_reader.h" +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #include "hrtf_file_reader.h" #include "ism_file_reader.h" #include "lib_rend.h" @@ -125,6 +128,9 @@ typedef struct int16_t numInMetadataFiles; char headRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; #ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef OTR_REFERENCE_VECTOR_TRACKING + char referenceVectorFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ char referenceRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; #endif char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; @@ -163,6 +169,9 @@ typedef enum CmdLnOptionId_inputMetadata, CmdLnOptionId_listFormats, CmdLnOptionId_inputGain, +#ifdef OTR_REFERENCE_VECTOR_TRACKING + CmdLnOptionId_referenceVectorFile, +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ } CmdLnOptionId; static const CmdLnParser_Option cliOptions[] = { @@ -237,7 +246,11 @@ static const CmdLnParser_Option cliOptions[] = { .match = "tracking_type", .matchShort = "otr", #ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef OTR_REFERENCE_VECTOR_TRACKING + .description = "Head orientation tracking type: 'none', 'ref', 'avg' or `ref_vec` or `ref_vec_lev` (only for BINAURAL and BINAURAL_ROOM)", +#else .description = "Head orientation tracking type: 'none', 'ref' or 'avg' (only for BINAURAL and BINAURAL_ROOM)", +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #else .description = "Head orientation tracking type: 'ref' or 'avg' (only for BINAURAL and BINAURAL_ROOM)", #endif @@ -276,6 +289,14 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "l", .description = "List supported audio formats", }, +#ifdef OTR_REFERENCE_VECTOR_TRACKING + { + .id = CmdLnOptionId_referenceVectorFile, + .match = "reference_vector_file", + .matchShort = "rvf", + .description = "Reference vector trajectory file for simulation of head tracking (only for BINAURAL and BINAURAL_ROOM outputs)", + }, +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ }; static const int32_t numCliOptions = sizeof( cliOptions ) / sizeof( CmdLnParser_Option ); @@ -539,6 +560,9 @@ int main( IVAS_REND_HANDLE hIvasRend; HeadRotFileReader *headRotReader = NULL; #ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef OTR_REFERENCE_VECTOR_TRACKING + Vector3PairFileReader *referenceVectorReader = NULL; +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ HeadRotFileReader *referenceRotReader = NULL; #endif hrtfFileReader *hrtfFileReader = NULL; @@ -591,6 +615,9 @@ int main( #endif convert_backslash( args.headRotationFilePath ); #ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef OTR_REFERENCE_VECTOR_TRACKING + convert_backslash( args.referenceVectorFilePath ); +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ convert_backslash( args.referenceRotationFilePath ); #endif convert_backslash( args.inLfePanningMatrixFile ); @@ -613,6 +640,16 @@ int main( exit( -1 ); } } +#ifdef OTR_REFERENCE_VECTOR_TRACKING + if ( !isEmptyString( args.referenceVectorFilePath ) ) + { + if ( Vector3PairFileReader_open( args.referenceVectorFilePath, &referenceVectorReader ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error opening file: %s\n", args.referenceVectorFilePath ); + exit( -1 ); + } + } +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #endif if ( !isEmptyString( args.customHrtfFilePath ) ) @@ -941,6 +978,22 @@ int main( } #ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef OTR_REFERENCE_VECTOR_TRACKING + if ( referenceVectorReader != NULL ) + { + IVAS_VECTOR3 listenerPos, refPos; + if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPos, &refPos ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + if ( ( error = IVAS_REND_SetReferenceVector( hIvasRend, listenerPos, refPos ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + } +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ /* Read from reference rotation trajectory file if specified */ if ( referenceRotReader != NULL ) { @@ -1120,6 +1173,9 @@ int main( AudioFileWriter_close( &audioWriter ); HeadRotationFileReader_close( &headRotReader ); #ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef OTR_REFERENCE_VECTOR_TRACKING + Vector3PairFileReader_close( &referenceVectorReader ); +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ HeadRotationFileReader_close( &referenceRotReader ); #endif hrtfFileReader_close( &hrtfFileReader ); @@ -1360,6 +1416,18 @@ static bool parseOrientationTracking( { *tracking_type = IVAS_ORIENT_TRK_AVG; } +#ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef OTR_REFERENCE_VECTOR_TRACKING + else if ( strcmp( value, "REF_VEC" ) == 0 ) + { + *tracking_type = IVAS_ORIENT_TRK_REF_VEC; + } + else if ( strcmp( value, "REF_VEC_LEV" ) == 0 ) + { + *tracking_type = IVAS_ORIENT_TRK_REF_VEC_LEV; + } +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ +#endif else { fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", value ); @@ -1580,6 +1648,9 @@ static CmdlnArgs defaultArgs( clearString( args.headRotationFilePath ); #ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef OTR_REFERENCE_VECTOR_TRACKING + clearString( args.referenceVectorFilePath ); +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ clearString( args.referenceRotationFilePath ); #endif clearString( args.customHrtfFilePath ); @@ -1665,6 +1736,12 @@ static void parseOption( strncpy( args->headRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; #ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef OTR_REFERENCE_VECTOR_TRACKING + case CmdLnOptionId_referenceVectorFile: + assert( numOptionValues == 1 ); + strncpy( args->referenceVectorFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); + break; +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ case CmdLnOptionId_refRotFile: assert( numOptionValues == 1 ); strncpy( args->referenceRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 2a15165be0..408d14f24d 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -83,6 +83,13 @@ typedef struct } IVAS_QUATERNION; +#ifdef OTR_REFERENCE_VECTOR_TRACKING +typedef struct +{ + float x, y, z; +} IVAS_VECTOR3; +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ + typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; typedef struct ivas_masa_qmetadata_frame_struct *IVAS_MASA_QMETADATA_HANDLE; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 5f408d4e4b..3395d6002d 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1462,6 +1462,10 @@ typedef enum #define IVAS_ORIENT_TRK_NONE 0 #define IVAS_ORIENT_TRK_REF 1 #define IVAS_ORIENT_TRK_AVG 2 +#ifdef OTR_REFERENCE_VECTOR_TRACKING +#define IVAS_ORIENT_TRK_REF_VEC 3 +#define IVAS_ORIENT_TRK_REF_VEC_LEV 4 +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #else #define IVAS_ORIENT_TRK_REF 0 #define IVAS_ORIENT_TRK_AVG 1 @@ -1476,7 +1480,13 @@ typedef enum #endif OTR_TRACKING_REF_ORIENT = IVAS_ORIENT_TRK_REF, /* track orientation relative to external reference orientation (default: no rotation) */ OTR_TRACKING_AVG_ORIENT = IVAS_ORIENT_TRK_AVG /* track orientation relative to average orientation */ - +#ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef OTR_REFERENCE_VECTOR_TRACKING + , + OTR_TRACKING_REF_VEC = IVAS_ORIENT_TRK_REF_VEC, /* track orientation relative to external reference vector */ + OTR_TRACKING_REF_VEC_LEV = IVAS_ORIENT_TRK_REF_VEC_LEV /* track orientation relative to level component of external reference vector */ +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ +#endif } OTR_TRACKING_T; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 206b6e4f0a..bc55b95454 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5750,6 +5750,14 @@ ivas_error ivas_orient_trk_GetTrackedRotation( ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ IVAS_QUATERNION *pRotation /* i/o : processed rotation */ ); + +#ifdef OTR_REFERENCE_VECTOR_TRACKING +ivas_error ivas_orient_trk_SetReferenceVector( + ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ +); +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #endif #ifdef FIX_I109_ORIENTATION_TRACKING diff --git a/lib_com/options.h b/lib_com/options.h index c0cca55010..7aefebb064 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,6 +168,15 @@ #define FIX_343_TO_UPPER /* VA: issue 343: safeguard for function to_upper() */ +#ifdef FIX_I109_ORIENTATION_TRACKING +#define OTR_REFERENCE_VECTOR_TRACKING /* FhG: enables the reference position orientation tracking mode */ +#endif +#define TD_REND_FIX_DIV_BY_ZERO /* FhG: avoid division by zero in sincResample fn */ +#ifndef FIX_198_TDREND_INTERFACE +#define TD_REND_FIX_MSAN /* FhG: fixes uninitialized read in ivas_rend_TDObjRendOpen */ +#endif +#define TD_TDREND_FIX_NULLPTR_ACCESS /* FhG: avoid nullptr access in ivas_rend_TDObjRendOpen */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index ab2b52b600..e1faf69d30 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -757,6 +757,20 @@ ivas_error ivas_init_decoder( { ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_ORIENT ); } +#ifdef OTR_REFERENCE_VECTOR_TRACKING + else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_REF_VEC ) + { + ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_VEC ); + } + else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_REF_VEC_LEV ) + { + ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_VEC_LEV ); + } + else + { + return IVAS_ERR_WRONG_MODE; + } +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ } #endif diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index ff1e567e78..f833b8a922 100755 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1363,7 +1363,6 @@ typedef struct ivas_orient_trk_state_t IVAS_QUATERNION absAvgRot; /* average absolute orientation */ IVAS_QUATERNION refRot; /* reference orientation */ IVAS_QUATERNION trkRot; /* tracked rotation */ - } ivas_orient_trk_state_t; #endif diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 93f1a944de..4f1bb97a1f 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -943,6 +943,33 @@ ivas_error IVAS_DEC_FeedRefRotData( return IVAS_ERR_OK; } + +#ifdef OTR_REFERENCE_VECTOR_TRACKING +/*---------------------------------------------------------------------* + * IVAS_DEC_FeedRefVectorData( ) + * + * Feed the decoder with a reference vector spanning from listenerPos + * to refPos. Only available in OTR_TRACKING_REF_POS and + * OTR_TRACKING_REF_POS_LEV modes. + *---------------------------------------------------------------------*/ + +ivas_error IVAS_DEC_FeedRefVectorData( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ +) +{ + ivas_orient_trk_state_t *pOtr; + + if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hHeadTrackData == NULL || hIvasDec->st_ivas->hHeadTrackData->OrientationTracker == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + pOtr = hIvasDec->st_ivas->hHeadTrackData->OrientationTracker; + return ivas_orient_trk_SetReferenceVector( pOtr, listenerPos, refPos ); +} +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #endif /*---------------------------------------------------------------------* diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index d2e7b5d98b..b956f46eac 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -186,6 +186,14 @@ ivas_error IVAS_DEC_FeedRefRotData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION rotation /* i : reference rotation data */ ); +#ifdef OTR_REFERENCE_VECTOR_TRACKING +/*! r: error code */ +ivas_error IVAS_DEC_FeedRefVectorData( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ +); +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #endif /*! r: error code */ diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index ddd4d06f9e..86612a34fc 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -794,8 +794,16 @@ ivas_error ivas_rend_TDObjRendOpen( } transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); ivas_format = ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ? MC_FORMAT : ISM_FORMAT; +#ifdef TD_TDREND_FIX_NULLPTR_ACCESS + if ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + { + hTransSetup.ls_azimuth = customLsInput->ls_azimuth; + hTransSetup.ls_elevation = customLsInput->ls_elevation; + } +#else hTransSetup.ls_azimuth = customLsInput->ls_azimuth; hTransSetup.ls_elevation = customLsInput->ls_elevation; +#endif /* TD_TDREND_FIX_NULLPTR_ACCESS */ return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); @@ -917,6 +925,10 @@ ivas_error ivas_rend_TDObjRendOpen( pTDRend->binaural_latency_ns = (int32_t) ( hBinRendererTd->HrFiltSet_p->latency_s * 1000000000.f ); +#ifdef TD_REND_FIX_MSAN + TDREND_Clear_Update_flags( hBinRendererTd ); +#endif /* TD_REND_FIX_MSAN */ + return IVAS_ERR_OK; #endif } @@ -1011,7 +1023,7 @@ ivas_error ivas_rend_TDObjRenderFrame( , headRotData->hOrientationTracker // TODO @Philips check if orientation tracking already done before renderer calls this function #endif - ); + ); #else diff --git a/lib_rend/ivas_objectRenderer_sfx.c b/lib_rend/ivas_objectRenderer_sfx.c index 7a9ddd6b85..bba639b0c0 100644 --- a/lib_rend/ivas_objectRenderer_sfx.c +++ b/lib_rend/ivas_objectRenderer_sfx.c @@ -181,6 +181,14 @@ static void sincResample( const float *p_sinc_forward; const float *p_sinc_backward; +#ifdef TD_REND_FIX_DIV_BY_ZERO + /* avoid division by 0 */ + if ( 0 == length_out ) + { + return; + } +#endif /* TD_REND_FIX_DIV_BY_ZERO */ + /* Compute fractional time step */ t_step = (float) ( length_in ) / (float) ( length_out ); t_frac = 0; diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 22ffdf64cb..f71009829a 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -102,6 +102,34 @@ void QuaternionInverse( const IVAS_QUATERNION q, IVAS_QUATERNION *const result ); +#ifdef OTR_REFERENCE_VECTOR_TRACKING +float QuaternionLength( + const IVAS_QUATERNION q ); + +IVAS_VECTOR3 VectorSubtract( + const IVAS_VECTOR3 p1, + const IVAS_VECTOR3 p2 ); + +IVAS_VECTOR3 VectorCrossProduct( + const IVAS_VECTOR3 p1, + const IVAS_VECTOR3 p2 ); + +float VectorDotProduct( + const IVAS_VECTOR3 p1, + const IVAS_VECTOR3 p2 ); + +float VectorLength( + const IVAS_VECTOR3 p ); + +IVAS_VECTOR3 VectorNormalize( + const IVAS_VECTOR3 p ); + +void VectorRotationToQuaternion( + const IVAS_VECTOR3 p1, + const IVAS_VECTOR3 p2, + IVAS_QUATERNION *const result ); +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ + /*------------------------------------------------------------------------------------------* * Quaternion product *------------------------------------------------------------------------------------------*/ @@ -236,6 +264,112 @@ void QuaternionInverse( QuaternionDivision( *r, dot_product, r ); } +#ifdef OTR_REFERENCE_VECTOR_TRACKING +/*------------------------------------------------------------------------------------------* + * Computes the length of a quaternion + *------------------------------------------------------------------------------------------*/ +float QuaternionLength( + const IVAS_QUATERNION q ) +{ + return sqrtf( q.w * q.w + q.x * q.x + q.y * q.y + q.z * q.z ); +} + +/*------------------------------------------------------------------------------------------* + * Computes the difference of two vectors + *------------------------------------------------------------------------------------------*/ +IVAS_VECTOR3 VectorSubtract( + const IVAS_VECTOR3 p1, + const IVAS_VECTOR3 p2 ) +{ + IVAS_VECTOR3 result; + result.x = p1.x - p2.x; + result.y = p1.y - p2.y; + result.z = p1.z - p2.z; + return result; +} + +/*------------------------------------------------------------------------------------------* + * Computes the cross product of two vectors + *------------------------------------------------------------------------------------------*/ +IVAS_VECTOR3 VectorCrossProduct( + const IVAS_VECTOR3 p1, + const IVAS_VECTOR3 p2 ) +{ + IVAS_VECTOR3 result; + result.x = p1.y * p2.z - p1.z * p2.y; + result.y = p1.z * p2.x - p1.x * p2.z; + result.z = p1.x * p2.y - p1.y * p2.x; + return result; +} + +/*------------------------------------------------------------------------------------------* + * Computes the dot product of two vectors + *------------------------------------------------------------------------------------------*/ +float VectorDotProduct( + const IVAS_VECTOR3 p1, + const IVAS_VECTOR3 p2 ) +{ + return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z; +} + +/*------------------------------------------------------------------------------------------* + * Computes the length of a vector + *------------------------------------------------------------------------------------------*/ +float VectorLength( + const IVAS_VECTOR3 p ) +{ + return sqrtf( p.x * p.x + p.y * p.y + p.z * p.z ); +} + +/*------------------------------------------------------------------------------------------* + * Normalizes a vector + *------------------------------------------------------------------------------------------*/ +IVAS_VECTOR3 VectorNormalize( + const IVAS_VECTOR3 p ) +{ + IVAS_VECTOR3 result; + const float length = VectorLength( p ); + result.x = p.x / length; + result.y = p.y / length; + result.z = p.z / length; + return result; +} + +/*------------------------------------------------------------------------------------------* + * Computes a quaternion representing the rotation from vector p1 to vector p2 + *------------------------------------------------------------------------------------------*/ +void VectorRotationToQuaternion( + const IVAS_VECTOR3 p1, + const IVAS_VECTOR3 p2, + IVAS_QUATERNION *const r ) +{ + float dot_product; + IVAS_VECTOR3 cross_product, p1_normalized, p2_normalized; + + p1_normalized = VectorNormalize( p1 ); + p2_normalized = VectorNormalize( p2 ); + cross_product = VectorCrossProduct( p1_normalized, p2_normalized ); + dot_product = VectorDotProduct( p1_normalized, p2_normalized ); + + if ( dot_product < -0.999999 ) + { + /* happens when the p1 vector is parallel to p2, but direction is flipped */ + r->w = 0.0f; + r->x = 0.0f; + r->y = 0.0f; + r->z = 1.0f; + } + else + { + /* all regular cases */ + r->x = cross_product.x; + r->y = cross_product.y; + r->z = cross_product.z; + r->w = 1.0 + dot_product; + } + QuaternionNormalize( *r, r ); +} +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #else static float ClipAngle( const float angle, @@ -312,6 +446,9 @@ void ivas_orient_trk_Init( pOTR->alpha = sinf( PI2 * pOTR->offCenterAdaptationRate / OTR_UPDATE_RATE ); /* start adaptation at off-center rate = fastest rate */ #ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef OTR_REFERENCE_VECTOR_TRACKING + pOTR->trkRot = identity; +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ pOTR->absAvgRot = identity; /* Use frontal and horiontal orientation as reference orientation, unless/until overridden */ pOTR->refRot = identity; @@ -393,6 +530,14 @@ ivas_error ivas_orient_trk_GetMainOrientation( case OTR_TRACKING_AVG_ORIENT: *pOrientation = pOTR->absAvgRot; break; +#ifdef OTR_REFERENCE_VECTOR_TRACKING + case OTR_TRACKING_REF_VEC: + *pOrientation = pOTR->refRot; + break; + case OTR_TRACKING_REF_VEC_LEV: + *pOrientation = pOTR->refRot; + break; +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ } return IVAS_ERR_OK; } @@ -411,6 +556,59 @@ ivas_error ivas_orient_trk_GetTrackedRotation( return IVAS_ERR_OK; } + +#ifdef OTR_REFERENCE_VECTOR_TRACKING +ivas_error ivas_orient_trk_SetReferenceVector( + ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ +) +{ + IVAS_VECTOR3 acousticFrontVector, ivasForwardVector; + float acousticFrontVectorLength; + + if ( pOTR == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + switch ( pOTR->trackingType ) + { + case OTR_TRACKING_REF_ORIENT: + case OTR_TRACKING_AVG_ORIENT: + return IVAS_ERR_WRONG_MODE; + case OTR_TRACKING_NONE: + case OTR_TRACKING_REF_VEC: + acousticFrontVector = VectorSubtract( listenerPos, refPos ); + break; + case OTR_TRACKING_REF_VEC_LEV: + { + IVAS_VECTOR3 listenerPosLevel, refPosLevel; + /* ignore the height difference between listener position and reference position */ + listenerPosLevel.z = refPosLevel.z = listenerPos.z; + listenerPosLevel.x = listenerPos.x; + listenerPosLevel.y = listenerPos.y; + refPosLevel.x = refPos.x; + refPosLevel.y = refPos.y; + acousticFrontVector = VectorSubtract( listenerPosLevel, refPosLevel ); + } + } + + acousticFrontVectorLength = VectorLength( acousticFrontVector ); + /* if the length is zero, the user has entered insensible listener and reference positions */ + if ( acousticFrontVectorLength < 0.0001f ) + { + return IVAS_ERR_WRONG_PARAMS; + } + + ivasForwardVector.x = -1.0f; + ivasForwardVector.y = 0.0f; + ivasForwardVector.z = 0.0f; + VectorRotationToQuaternion( acousticFrontVector, ivasForwardVector, &pOTR->refRot ); + + return IVAS_ERR_OK; +} +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #else /*-------------------------------------------------------------------* * ivas_orient_trk_SetAbsoluteOrientation() @@ -453,6 +651,9 @@ ivas_error ivas_orient_trk_Process( float alpha = pOTR->alpha; float ang; ivas_error result; +#ifdef OTR_REFERENCE_VECTOR_TRACKING + IVAS_QUATERNION refRot_absRot_product; +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ if ( pOTR == NULL || pTrkRot == NULL ) { @@ -515,7 +716,20 @@ ivas_error ivas_orient_trk_Process( /* Compute filter coefficient corresponding to desired cutoff frequency */ pOTR->alpha = sinf( 2.0f * EVS_PI * cutoffFrequency / updateRate ); break; +#ifdef OTR_REFERENCE_VECTOR_TRACKING + case OTR_TRACKING_REF_VEC: + case OTR_TRACKING_REF_VEC_LEV: + { + /* This processing step of the OTR_TRACKING_REF_POS/OTR_TRACKING_REF_POS_LEVEL is identical */ + QuaternionProduct( pOTR->refRot, *pAbsRot, &refRot_absRot_product ); + pTrkRot->w = refRot_absRot_product.w; + pTrkRot->x = refRot_absRot_product.x; + pTrkRot->y = refRot_absRot_product.y; + pTrkRot->z = refRot_absRot_product.z; + break; + } +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ default: result = IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Non-supported orientation tracking adaptation type" ); break; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index b040fbeb72..80bf5d5a30 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3779,6 +3779,14 @@ ivas_error IVAS_REND_SetOrientationTrackingMode( case IVAS_ORIENT_TRK_REF: mode = OTR_TRACKING_REF_ORIENT; break; +#ifdef OTR_REFERENCE_VECTOR_TRACKING + case IVAS_ORIENT_TRK_REF_VEC: + mode = OTR_TRACKING_REF_VEC; + break; + case IVAS_ORIENT_TRK_REF_VEC_LEV: + mode = OTR_TRACKING_REF_VEC_LEV; + break; +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ case IVAS_ORIENT_TRK_NONE: default: mode = OTR_TRACKING_NONE; @@ -3837,6 +3845,29 @@ ivas_error IVAS_REND_GetTrackedRotation( return IVAS_ERR_OK; } + +#ifdef OTR_REFERENCE_VECTOR_TRACKING +/*---------------------------------------------------------------------* + * IVAS_REND_SetReferenceVector( ) + * + * Sets a reference vector spanning from listenerPos to refPos. Only + * available in OTR_TRACKING_REF_POS and OTR_TRACKING_REF_POS_LEV modes. + *---------------------------------------------------------------------*/ + +ivas_error IVAS_REND_SetReferenceVector( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ +) +{ + if ( hIvasRend == NULL || hIvasRend->headRotData.hOrientationTracker == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + return ivas_orient_trk_SetReferenceVector( hIvasRend->headRotData.hOrientationTracker, listenerPos, refPos ); +} +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #endif /* Take one channel from input buffer and copy it to each channel diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 3637fa87fb..fff13205b3 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -304,7 +304,15 @@ ivas_error IVAS_REND_GetTrackedRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ IVAS_QUATERNION *pRotation /* i/o: Quaternion pointer for processed rotation */ ); -#endif + +#ifdef OTR_REFERENCE_VECTOR_TRACKING +ivas_error IVAS_REND_SetReferenceVector( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ +); +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ +#endif /* FIX_I109_ORIENTATION_TRACKING */ ivas_error IVAS_REND_GetSamples( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ diff --git a/lib_util/vector3_pair_file_reader.c b/lib_util/vector3_pair_file_reader.c new file mode 100644 index 0000000000..1b8a95bc88 --- /dev/null +++ b/lib_util/vector3_pair_file_reader.c @@ -0,0 +1,166 @@ +/****************************************************************************************************** + + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "vector3_pair_file_reader.h" +#include +#include +#include +#include +#include "prot.h" +#include "options.h" /* only included to get access to the feature-defines */ + +#ifdef OTR_REFERENCE_VECTOR_TRACKING + +struct Vector3PairFileReader +{ + FILE *trajFile; + char *file_path; +}; + +/*-----------------------------------------------------------------------* + * Vector3PairFileReader_open() + * + * Allocate and initialize reader + *-----------------------------------------------------------------------*/ + +ivas_error Vector3PairFileReader_open( + const char *trajFilePath, /* i : trajectory file name */ + Vector3PairFileReader **vector3PairReader /* o : Vector3PairFileReader handle */ +) +{ + Vector3PairFileReader *self; + FILE *trajFile; + + /* Open trajectory file */ + if ( strlen( trajFilePath ) < 1 ) + { + return IVAS_ERR_FAILED_FILE_OPEN; + } + + trajFile = fopen( trajFilePath, "r" ); + + if ( !trajFile ) + { + return IVAS_ERR_FAILED_FILE_OPEN; + } + + self = calloc( sizeof( Vector3PairFileReader ), 1 ); + self->trajFile = trajFile; + self->file_path = calloc( sizeof( char ), strlen( trajFilePath ) + 1 ); + strcpy( self->file_path, trajFilePath ); + + *vector3PairReader = self; + + return IVAS_ERR_OK; +} + + +/*-----------------------------------------------------------------------* + * Vector3PairFileReader_read() + * + * Read one line of values from the trajectory file + *-----------------------------------------------------------------------*/ + +ivas_error Vector3PairFileReader_read( + Vector3PairFileReader *vector3PairReader, /* i/o: Vector3PairFileReader handle */ + IVAS_VECTOR3 *pFirst, /* o : first x,y,z position in the line */ + IVAS_VECTOR3 *pSecond /* o : second x,y,z position in the line */ +) +{ + float x1, y1, z1, x2, y2, z2; + + if ( vector3PairReader == NULL || pFirst == NULL || pSecond == NULL ) + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + + if ( 6 != fscanf( vector3PairReader->trajFile, "%f,%f,%f,%f,%f,%f", &x1, &y1, &z1, &x2, &y2, &z2 ) ) + { + if ( feof( vector3PairReader->trajFile ) ) + { + rewind( vector3PairReader->trajFile ); + return Vector3PairFileReader_read( vector3PairReader, pFirst, pSecond ); + } + return IVAS_ERR_FAILED_FILE_PARSE; + } + + pFirst->x = x1; + pFirst->y = y1; + pFirst->z = z1; + pSecond->x = x2; + pSecond->y = y2; + pSecond->z = z2; + + return IVAS_ERR_OK; +} + +/*-----------------------------------------------------------------------* + * Vector3PairFileReader_close() + * + * Deallocates memory for the Head-Tracking reader + *-----------------------------------------------------------------------*/ + +void Vector3PairFileReader_close( + Vector3PairFileReader **reader /* i/o: Vector3PairFileReader handle */ +) +{ + if ( reader == NULL || *reader == NULL ) + { + return; + } + + fclose( ( *reader )->trajFile ); + free( ( *reader )->file_path ); + free( *reader ); + *reader = NULL; + + return; +} + + +/*-----------------------------------------------------------------------* + * Vector3PairFileReader_getFilePath() + * + * + *-----------------------------------------------------------------------*/ + +const char *Vector3PairFileReader_getFilePath( + Vector3PairFileReader *reader /* i/o: Vector3PairFileReader handle */ +) +{ + if ( reader == NULL ) + { + return NULL; + } + + return reader->file_path; +} + +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ diff --git a/lib_util/vector3_pair_file_reader.h b/lib_util/vector3_pair_file_reader.h new file mode 100644 index 0000000000..a2fd706fc2 --- /dev/null +++ b/lib_util/vector3_pair_file_reader.h @@ -0,0 +1,89 @@ +/****************************************************************************************************** + + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef IVAS_V3PAIR_FILE_READER_H +#define IVAS_V3PAIR_FILE_READER_H + +#include "common_api_types.h" +#include "ivas_error.h" +#include "options.h" /* only included to get access to the feature-defines */ + +#ifdef OTR_REFERENCE_VECTOR_TRACKING + +typedef struct Vector3PairFileReader Vector3PairFileReader; + +/*-----------------------------------------------------------------------* + * Vector3PairFileReader_open() + * + * Allocate and initialize Head-Tracking handle + *-----------------------------------------------------------------------*/ + +ivas_error Vector3PairFileReader_open( + const char *trajFilePath, /* i : trajectory file name */ + Vector3PairFileReader **vector3PairReader /* o : Vector3PairFileReader handle */ +); + +/*-----------------------------------------------------------------------* + * Vector3PairFileReader_read() + * + * Read one line of values from the trajectory file + *-----------------------------------------------------------------------*/ + +ivas_error Vector3PairFileReader_read( + Vector3PairFileReader *vector3PairReader, /* i/o: Vector3PairFileReader handle */ + IVAS_VECTOR3 *pFirst, /* o : first x,y,z position in the line */ + IVAS_VECTOR3 *pSecond /* o : second x,y,z position in the line */ +); + +/*-----------------------------------------------------------------------* + * Vector3PairFileReader_close() + * + * Deallocates memory for the handle + *-----------------------------------------------------------------------*/ + +void Vector3PairFileReader_close( + Vector3PairFileReader **vector3PairReader /* i/o: Vector3PairFileReader handle */ +); + +/*-----------------------------------------------------------------------* + * Vector3PairFileReader_getFilePath() + * + * + *-----------------------------------------------------------------------*/ + +const char *Vector3PairFileReader_getFilePath( + Vector3PairFileReader *vector3PairReader /* i/o: Vector3PairFileReader handle */ +); + +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ + +#endif /* IVAS_V3PAIR_FILE_READER_H */ diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 7f94afadb6..af6ed5de18 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -473,6 +473,14 @@ //../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit //../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrAvg.tst +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit +../IVAS_dec -t trajectories/full-circle-4s.csv -rvf trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPos.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking in level mode +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit +../IVAS_dec -t trajectories/full-circle-with-up-and-down-4s.csv -rvf trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPosLev.tst + // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.pcm bit ../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_DTX_Binaural_FEC5.tst diff --git a/scripts/trajectories/const000-Vector3.csv b/scripts/trajectories/const000-Vector3.csv new file mode 100644 index 0000000000..f47ae12e5d --- /dev/null +++ b/scripts/trajectories/const000-Vector3.csv @@ -0,0 +1,4 @@ +0.0, 0.0, 0.0, 1.0, 0.0, 0.0 +0.0, 0.0, 0.0, 1.0, 0.0, 0.0 +0.0, 0.0, 0.0, 1.0, 0.0, 0.0 +0.0, 0.0, 0.0, 1.0, 0.0, 0.0 diff --git a/scripts/trajectories/full-circle-4s-Vector3.csv b/scripts/trajectories/full-circle-4s-Vector3.csv new file mode 100644 index 0000000000..38a3505239 --- /dev/null +++ b/scripts/trajectories/full-circle-4s-Vector3.csv @@ -0,0 +1,200 @@ +0.0000,0.0000,0.0000,0.9995,-0.0314,0.0000 +0.0000,0.0000,0.0000,0.9980,-0.0628,0.0000 +0.0000,0.0000,0.0000,0.9956,-0.0941,0.0000 +0.0000,0.0000,0.0000,0.9921,-0.1253,0.0000 +0.0000,0.0000,0.0000,0.9877,-0.1564,0.0000 +0.0000,0.0000,0.0000,0.9823,-0.1874,0.0000 +0.0000,0.0000,0.0000,0.9759,-0.2181,0.0000 +0.0000,0.0000,0.0000,0.9686,-0.2487,0.0000 +0.0000,0.0000,0.0000,0.9603,-0.2790,0.0000 +0.0000,0.0000,0.0000,0.9511,-0.3090,0.0000 +0.0000,0.0000,0.0000,0.9409,-0.3387,0.0000 +0.0000,0.0000,0.0000,0.9298,-0.3681,0.0000 +0.0000,0.0000,0.0000,0.9178,-0.3971,0.0000 +0.0000,0.0000,0.0000,0.9048,-0.4258,0.0000 +0.0000,0.0000,0.0000,0.8910,-0.4540,0.0000 +0.0000,0.0000,0.0000,0.8763,-0.4818,0.0000 +0.0000,0.0000,0.0000,0.8607,-0.5090,0.0000 +0.0000,0.0000,0.0000,0.8443,-0.5358,0.0000 +0.0000,0.0000,0.0000,0.8271,-0.5621,0.0000 +0.0000,0.0000,0.0000,0.8090,-0.5878,0.0000 +0.0000,0.0000,0.0000,0.7902,-0.6129,0.0000 +0.0000,0.0000,0.0000,0.7705,-0.6374,0.0000 +0.0000,0.0000,0.0000,0.7501,-0.6613,0.0000 +0.0000,0.0000,0.0000,0.7290,-0.6845,0.0000 +0.0000,0.0000,0.0000,0.7071,-0.7071,0.0000 +0.0000,0.0000,0.0000,0.6845,-0.7290,0.0000 +0.0000,0.0000,0.0000,0.6613,-0.7501,0.0000 +0.0000,0.0000,0.0000,0.6374,-0.7705,0.0000 +0.0000,0.0000,0.0000,0.6129,-0.7902,0.0000 +0.0000,0.0000,0.0000,0.5878,-0.8090,0.0000 +0.0000,0.0000,0.0000,0.5621,-0.8271,0.0000 +0.0000,0.0000,0.0000,0.5358,-0.8443,0.0000 +0.0000,0.0000,0.0000,0.5090,-0.8607,0.0000 +0.0000,0.0000,0.0000,0.4818,-0.8763,0.0000 +0.0000,0.0000,0.0000,0.4540,-0.8910,0.0000 +0.0000,0.0000,0.0000,0.4258,-0.9048,0.0000 +0.0000,0.0000,0.0000,0.3971,-0.9178,0.0000 +0.0000,0.0000,0.0000,0.3681,-0.9298,0.0000 +0.0000,0.0000,0.0000,0.3387,-0.9409,0.0000 +0.0000,0.0000,0.0000,0.3090,-0.9511,0.0000 +0.0000,0.0000,0.0000,0.2790,-0.9603,0.0000 +0.0000,0.0000,0.0000,0.2487,-0.9686,0.0000 +0.0000,0.0000,0.0000,0.2181,-0.9759,0.0000 +0.0000,0.0000,0.0000,0.1874,-0.9823,0.0000 +0.0000,0.0000,0.0000,0.1564,-0.9877,0.0000 +0.0000,0.0000,0.0000,0.1253,-0.9921,0.0000 +0.0000,0.0000,0.0000,0.0941,-0.9956,0.0000 +0.0000,0.0000,0.0000,0.0628,-0.9980,0.0000 +0.0000,0.0000,0.0000,0.0314,-0.9995,0.0000 +0.0000,0.0000,0.0000,-0.0000,-1.0000,0.0000 +0.0000,0.0000,0.0000,-0.0314,-0.9995,0.0000 +0.0000,0.0000,0.0000,-0.0628,-0.9980,0.0000 +0.0000,0.0000,0.0000,-0.0941,-0.9956,0.0000 +0.0000,0.0000,0.0000,-0.1253,-0.9921,0.0000 +0.0000,0.0000,0.0000,-0.1564,-0.9877,0.0000 +0.0000,0.0000,0.0000,-0.1874,-0.9823,0.0000 +0.0000,0.0000,0.0000,-0.2181,-0.9759,0.0000 +0.0000,0.0000,0.0000,-0.2487,-0.9686,0.0000 +0.0000,0.0000,0.0000,-0.2790,-0.9603,0.0000 +0.0000,0.0000,0.0000,-0.3090,-0.9511,0.0000 +0.0000,0.0000,0.0000,-0.3387,-0.9409,0.0000 +0.0000,0.0000,0.0000,-0.3681,-0.9298,0.0000 +0.0000,0.0000,0.0000,-0.3971,-0.9178,0.0000 +0.0000,0.0000,0.0000,-0.4258,-0.9048,0.0000 +0.0000,0.0000,0.0000,-0.4540,-0.8910,0.0000 +0.0000,0.0000,0.0000,-0.4818,-0.8763,0.0000 +0.0000,0.0000,0.0000,-0.5090,-0.8607,0.0000 +0.0000,0.0000,0.0000,-0.5358,-0.8443,0.0000 +0.0000,0.0000,0.0000,-0.5621,-0.8271,0.0000 +0.0000,0.0000,0.0000,-0.5878,-0.8090,0.0000 +0.0000,0.0000,0.0000,-0.6129,-0.7902,0.0000 +0.0000,0.0000,0.0000,-0.6374,-0.7705,0.0000 +0.0000,0.0000,0.0000,-0.6613,-0.7501,0.0000 +0.0000,0.0000,0.0000,-0.6845,-0.7290,0.0000 +0.0000,0.0000,0.0000,-0.7071,-0.7071,0.0000 +0.0000,0.0000,0.0000,-0.7290,-0.6845,0.0000 +0.0000,0.0000,0.0000,-0.7501,-0.6613,0.0000 +0.0000,0.0000,0.0000,-0.7705,-0.6374,0.0000 +0.0000,0.0000,0.0000,-0.7902,-0.6129,0.0000 +0.0000,0.0000,0.0000,-0.8090,-0.5878,0.0000 +0.0000,0.0000,0.0000,-0.8271,-0.5621,0.0000 +0.0000,0.0000,0.0000,-0.8443,-0.5358,0.0000 +0.0000,0.0000,0.0000,-0.8607,-0.5090,0.0000 +0.0000,0.0000,0.0000,-0.8763,-0.4818,0.0000 +0.0000,0.0000,0.0000,-0.8910,-0.4540,0.0000 +0.0000,0.0000,0.0000,-0.9048,-0.4258,0.0000 +0.0000,0.0000,0.0000,-0.9178,-0.3971,0.0000 +0.0000,0.0000,0.0000,-0.9298,-0.3681,0.0000 +0.0000,0.0000,0.0000,-0.9409,-0.3387,0.0000 +0.0000,0.0000,0.0000,-0.9511,-0.3090,0.0000 +0.0000,0.0000,0.0000,-0.9603,-0.2790,0.0000 +0.0000,0.0000,0.0000,-0.9686,-0.2487,0.0000 +0.0000,0.0000,0.0000,-0.9759,-0.2181,0.0000 +0.0000,0.0000,0.0000,-0.9823,-0.1874,0.0000 +0.0000,0.0000,0.0000,-0.9877,-0.1564,0.0000 +0.0000,0.0000,0.0000,-0.9921,-0.1253,0.0000 +0.0000,0.0000,0.0000,-0.9956,-0.0941,0.0000 +0.0000,0.0000,0.0000,-0.9980,-0.0628,0.0000 +0.0000,0.0000,0.0000,-0.9995,-0.0314,0.0000 +0.0000,0.0000,0.0000,-1.0000,0.0000,0.0000 +0.0000,0.0000,0.0000,-0.9995,0.0314,0.0000 +0.0000,0.0000,0.0000,-0.9980,0.0628,0.0000 +0.0000,0.0000,0.0000,-0.9956,0.0941,0.0000 +0.0000,0.0000,0.0000,-0.9921,0.1253,0.0000 +0.0000,0.0000,0.0000,-0.9877,0.1564,0.0000 +0.0000,0.0000,0.0000,-0.9823,0.1874,0.0000 +0.0000,0.0000,0.0000,-0.9759,0.2181,0.0000 +0.0000,0.0000,0.0000,-0.9686,0.2487,0.0000 +0.0000,0.0000,0.0000,-0.9603,0.2790,0.0000 +0.0000,0.0000,0.0000,-0.9511,0.3090,0.0000 +0.0000,0.0000,0.0000,-0.9409,0.3387,0.0000 +0.0000,0.0000,0.0000,-0.9298,0.3681,0.0000 +0.0000,0.0000,0.0000,-0.9178,0.3971,0.0000 +0.0000,0.0000,0.0000,-0.9048,0.4258,0.0000 +0.0000,0.0000,0.0000,-0.8910,0.4540,0.0000 +0.0000,0.0000,0.0000,-0.8763,0.4818,0.0000 +0.0000,0.0000,0.0000,-0.8607,0.5090,0.0000 +0.0000,0.0000,0.0000,-0.8443,0.5358,0.0000 +0.0000,0.0000,0.0000,-0.8271,0.5621,0.0000 +0.0000,0.0000,0.0000,-0.8090,0.5878,0.0000 +0.0000,0.0000,0.0000,-0.7902,0.6129,0.0000 +0.0000,0.0000,0.0000,-0.7705,0.6374,0.0000 +0.0000,0.0000,0.0000,-0.7501,0.6613,0.0000 +0.0000,0.0000,0.0000,-0.7290,0.6845,0.0000 +0.0000,0.0000,0.0000,-0.7071,0.7071,0.0000 +0.0000,0.0000,0.0000,-0.6845,0.7290,0.0000 +0.0000,0.0000,0.0000,-0.6613,0.7501,0.0000 +0.0000,0.0000,0.0000,-0.6374,0.7705,0.0000 +0.0000,0.0000,0.0000,-0.6129,0.7902,0.0000 +0.0000,0.0000,0.0000,-0.5878,0.8090,0.0000 +0.0000,0.0000,0.0000,-0.5621,0.8271,0.0000 +0.0000,0.0000,0.0000,-0.5358,0.8443,0.0000 +0.0000,0.0000,0.0000,-0.5090,0.8607,0.0000 +0.0000,0.0000,0.0000,-0.4818,0.8763,0.0000 +0.0000,0.0000,0.0000,-0.4540,0.8910,0.0000 +0.0000,0.0000,0.0000,-0.4258,0.9048,0.0000 +0.0000,0.0000,0.0000,-0.3971,0.9178,0.0000 +0.0000,0.0000,0.0000,-0.3681,0.9298,0.0000 +0.0000,0.0000,0.0000,-0.3387,0.9409,0.0000 +0.0000,0.0000,0.0000,-0.3090,0.9511,0.0000 +0.0000,0.0000,0.0000,-0.2790,0.9603,0.0000 +0.0000,0.0000,0.0000,-0.2487,0.9686,0.0000 +0.0000,0.0000,0.0000,-0.2181,0.9759,0.0000 +0.0000,0.0000,0.0000,-0.1874,0.9823,0.0000 +0.0000,0.0000,0.0000,-0.1564,0.9877,0.0000 +0.0000,0.0000,0.0000,-0.1253,0.9921,0.0000 +0.0000,0.0000,0.0000,-0.0941,0.9956,0.0000 +0.0000,0.0000,0.0000,-0.0628,0.9980,0.0000 +0.0000,0.0000,0.0000,-0.0314,0.9995,0.0000 +0.0000,0.0000,0.0000,0.0000,1.0000,0.0000 +0.0000,0.0000,0.0000,0.0314,0.9995,0.0000 +0.0000,0.0000,0.0000,0.0628,0.9980,0.0000 +0.0000,0.0000,0.0000,0.0941,0.9956,0.0000 +0.0000,0.0000,0.0000,0.1253,0.9921,0.0000 +0.0000,0.0000,0.0000,0.1564,0.9877,0.0000 +0.0000,0.0000,0.0000,0.1874,0.9823,0.0000 +0.0000,0.0000,0.0000,0.2181,0.9759,0.0000 +0.0000,0.0000,0.0000,0.2487,0.9686,0.0000 +0.0000,0.0000,0.0000,0.2790,0.9603,0.0000 +0.0000,0.0000,0.0000,0.3090,0.9511,0.0000 +0.0000,0.0000,0.0000,0.3387,0.9409,0.0000 +0.0000,0.0000,0.0000,0.3681,0.9298,0.0000 +0.0000,0.0000,0.0000,0.3971,0.9178,0.0000 +0.0000,0.0000,0.0000,0.4258,0.9048,0.0000 +0.0000,0.0000,0.0000,0.4540,0.8910,0.0000 +0.0000,0.0000,0.0000,0.4818,0.8763,0.0000 +0.0000,0.0000,0.0000,0.5090,0.8607,0.0000 +0.0000,0.0000,0.0000,0.5358,0.8443,0.0000 +0.0000,0.0000,0.0000,0.5621,0.8271,0.0000 +0.0000,0.0000,0.0000,0.5878,0.8090,0.0000 +0.0000,0.0000,0.0000,0.6129,0.7902,0.0000 +0.0000,0.0000,0.0000,0.6374,0.7705,0.0000 +0.0000,0.0000,0.0000,0.6613,0.7501,0.0000 +0.0000,0.0000,0.0000,0.6845,0.7290,0.0000 +0.0000,0.0000,0.0000,0.7071,0.7071,0.0000 +0.0000,0.0000,0.0000,0.7290,0.6845,0.0000 +0.0000,0.0000,0.0000,0.7501,0.6613,0.0000 +0.0000,0.0000,0.0000,0.7705,0.6374,0.0000 +0.0000,0.0000,0.0000,0.7902,0.6129,0.0000 +0.0000,0.0000,0.0000,0.8090,0.5878,0.0000 +0.0000,0.0000,0.0000,0.8271,0.5621,0.0000 +0.0000,0.0000,0.0000,0.8443,0.5358,0.0000 +0.0000,0.0000,0.0000,0.8607,0.5090,0.0000 +0.0000,0.0000,0.0000,0.8763,0.4818,0.0000 +0.0000,0.0000,0.0000,0.8910,0.4540,0.0000 +0.0000,0.0000,0.0000,0.9048,0.4258,0.0000 +0.0000,0.0000,0.0000,0.9178,0.3971,0.0000 +0.0000,0.0000,0.0000,0.9298,0.3681,0.0000 +0.0000,0.0000,0.0000,0.9409,0.3387,0.0000 +0.0000,0.0000,0.0000,0.9511,0.3090,0.0000 +0.0000,0.0000,0.0000,0.9603,0.2790,0.0000 +0.0000,0.0000,0.0000,0.9686,0.2487,0.0000 +0.0000,0.0000,0.0000,0.9759,0.2181,0.0000 +0.0000,0.0000,0.0000,0.9823,0.1874,0.0000 +0.0000,0.0000,0.0000,0.9877,0.1564,0.0000 +0.0000,0.0000,0.0000,0.9921,0.1253,0.0000 +0.0000,0.0000,0.0000,0.9956,0.0941,0.0000 +0.0000,0.0000,0.0000,0.9980,0.0628,0.0000 +0.0000,0.0000,0.0000,0.9995,0.0314,0.0000 +0.0000,0.0000,0.0000,1.0000,-0.0000,0.0000 diff --git a/scripts/trajectories/full-circle-4s-ccw-Vector3.csv b/scripts/trajectories/full-circle-4s-ccw-Vector3.csv new file mode 100644 index 0000000000..37b2904ea4 --- /dev/null +++ b/scripts/trajectories/full-circle-4s-ccw-Vector3.csv @@ -0,0 +1,200 @@ +0.0000,0.0000,0.0000,0.9995,0.0314,0.0000 +0.0000,0.0000,0.0000,0.9980,0.0628,0.0000 +0.0000,0.0000,0.0000,0.9956,0.0941,0.0000 +0.0000,0.0000,0.0000,0.9921,0.1253,0.0000 +0.0000,0.0000,0.0000,0.9877,0.1564,0.0000 +0.0000,0.0000,0.0000,0.9823,0.1874,0.0000 +0.0000,0.0000,0.0000,0.9759,0.2181,0.0000 +0.0000,0.0000,0.0000,0.9686,0.2487,0.0000 +0.0000,0.0000,0.0000,0.9603,0.2790,0.0000 +0.0000,0.0000,0.0000,0.9511,0.3090,0.0000 +0.0000,0.0000,0.0000,0.9409,0.3387,0.0000 +0.0000,0.0000,0.0000,0.9298,0.3681,0.0000 +0.0000,0.0000,0.0000,0.9178,0.3971,0.0000 +0.0000,0.0000,0.0000,0.9048,0.4258,0.0000 +0.0000,0.0000,0.0000,0.8910,0.4540,0.0000 +0.0000,0.0000,0.0000,0.8763,0.4818,0.0000 +0.0000,0.0000,0.0000,0.8607,0.5090,0.0000 +0.0000,0.0000,0.0000,0.8443,0.5358,0.0000 +0.0000,0.0000,0.0000,0.8271,0.5621,0.0000 +0.0000,0.0000,0.0000,0.8090,0.5878,0.0000 +0.0000,0.0000,0.0000,0.7902,0.6129,0.0000 +0.0000,0.0000,0.0000,0.7705,0.6374,0.0000 +0.0000,0.0000,0.0000,0.7501,0.6613,0.0000 +0.0000,0.0000,0.0000,0.7290,0.6845,0.0000 +0.0000,0.0000,0.0000,0.7071,0.7071,0.0000 +0.0000,0.0000,0.0000,0.6845,0.7290,0.0000 +0.0000,0.0000,0.0000,0.6613,0.7501,0.0000 +0.0000,0.0000,0.0000,0.6374,0.7705,0.0000 +0.0000,0.0000,0.0000,0.6129,0.7902,0.0000 +0.0000,0.0000,0.0000,0.5878,0.8090,0.0000 +0.0000,0.0000,0.0000,0.5621,0.8271,0.0000 +0.0000,0.0000,0.0000,0.5358,0.8443,0.0000 +0.0000,0.0000,0.0000,0.5090,0.8607,0.0000 +0.0000,0.0000,0.0000,0.4818,0.8763,0.0000 +0.0000,0.0000,0.0000,0.4540,0.8910,0.0000 +0.0000,0.0000,0.0000,0.4258,0.9048,0.0000 +0.0000,0.0000,0.0000,0.3971,0.9178,0.0000 +0.0000,0.0000,0.0000,0.3681,0.9298,0.0000 +0.0000,0.0000,0.0000,0.3387,0.9409,0.0000 +0.0000,0.0000,0.0000,0.3090,0.9511,0.0000 +0.0000,0.0000,0.0000,0.2790,0.9603,0.0000 +0.0000,0.0000,0.0000,0.2487,0.9686,0.0000 +0.0000,0.0000,0.0000,0.2181,0.9759,0.0000 +0.0000,0.0000,0.0000,0.1874,0.9823,0.0000 +0.0000,0.0000,0.0000,0.1564,0.9877,0.0000 +0.0000,0.0000,0.0000,0.1253,0.9921,0.0000 +0.0000,0.0000,0.0000,0.0941,0.9956,0.0000 +0.0000,0.0000,0.0000,0.0628,0.9980,0.0000 +0.0000,0.0000,0.0000,0.0314,0.9995,0.0000 +0.0000,0.0000,0.0000,-0.0000,1.0000,0.0000 +0.0000,0.0000,0.0000,-0.0314,0.9995,0.0000 +0.0000,0.0000,0.0000,-0.0628,0.9980,0.0000 +0.0000,0.0000,0.0000,-0.0941,0.9956,0.0000 +0.0000,0.0000,0.0000,-0.1253,0.9921,0.0000 +0.0000,0.0000,0.0000,-0.1564,0.9877,0.0000 +0.0000,0.0000,0.0000,-0.1874,0.9823,0.0000 +0.0000,0.0000,0.0000,-0.2181,0.9759,0.0000 +0.0000,0.0000,0.0000,-0.2487,0.9686,0.0000 +0.0000,0.0000,0.0000,-0.2790,0.9603,0.0000 +0.0000,0.0000,0.0000,-0.3090,0.9511,0.0000 +0.0000,0.0000,0.0000,-0.3387,0.9409,0.0000 +0.0000,0.0000,0.0000,-0.3681,0.9298,0.0000 +0.0000,0.0000,0.0000,-0.3971,0.9178,0.0000 +0.0000,0.0000,0.0000,-0.4258,0.9048,0.0000 +0.0000,0.0000,0.0000,-0.4540,0.8910,0.0000 +0.0000,0.0000,0.0000,-0.4818,0.8763,0.0000 +0.0000,0.0000,0.0000,-0.5090,0.8607,0.0000 +0.0000,0.0000,0.0000,-0.5358,0.8443,0.0000 +0.0000,0.0000,0.0000,-0.5621,0.8271,0.0000 +0.0000,0.0000,0.0000,-0.5878,0.8090,0.0000 +0.0000,0.0000,0.0000,-0.6129,0.7902,0.0000 +0.0000,0.0000,0.0000,-0.6374,0.7705,0.0000 +0.0000,0.0000,0.0000,-0.6613,0.7501,0.0000 +0.0000,0.0000,0.0000,-0.6845,0.7290,0.0000 +0.0000,0.0000,0.0000,-0.7071,0.7071,0.0000 +0.0000,0.0000,0.0000,-0.7290,0.6845,0.0000 +0.0000,0.0000,0.0000,-0.7501,0.6613,0.0000 +0.0000,0.0000,0.0000,-0.7705,0.6374,0.0000 +0.0000,0.0000,0.0000,-0.7902,0.6129,0.0000 +0.0000,0.0000,0.0000,-0.8090,0.5878,0.0000 +0.0000,0.0000,0.0000,-0.8271,0.5621,0.0000 +0.0000,0.0000,0.0000,-0.8443,0.5358,0.0000 +0.0000,0.0000,0.0000,-0.8607,0.5090,0.0000 +0.0000,0.0000,0.0000,-0.8763,0.4818,0.0000 +0.0000,0.0000,0.0000,-0.8910,0.4540,0.0000 +0.0000,0.0000,0.0000,-0.9048,0.4258,0.0000 +0.0000,0.0000,0.0000,-0.9178,0.3971,0.0000 +0.0000,0.0000,0.0000,-0.9298,0.3681,0.0000 +0.0000,0.0000,0.0000,-0.9409,0.3387,0.0000 +0.0000,0.0000,0.0000,-0.9511,0.3090,0.0000 +0.0000,0.0000,0.0000,-0.9603,0.2790,0.0000 +0.0000,0.0000,0.0000,-0.9686,0.2487,0.0000 +0.0000,0.0000,0.0000,-0.9759,0.2181,0.0000 +0.0000,0.0000,0.0000,-0.9823,0.1874,0.0000 +0.0000,0.0000,0.0000,-0.9877,0.1564,0.0000 +0.0000,0.0000,0.0000,-0.9921,0.1253,0.0000 +0.0000,0.0000,0.0000,-0.9956,0.0941,0.0000 +0.0000,0.0000,0.0000,-0.9980,0.0628,0.0000 +0.0000,0.0000,0.0000,-0.9995,0.0314,0.0000 +0.0000,0.0000,0.0000,-1.0000,-0.0000,0.0000 +0.0000,0.0000,0.0000,-0.9995,-0.0314,0.0000 +0.0000,0.0000,0.0000,-0.9980,-0.0628,0.0000 +0.0000,0.0000,0.0000,-0.9956,-0.0941,0.0000 +0.0000,0.0000,0.0000,-0.9921,-0.1253,0.0000 +0.0000,0.0000,0.0000,-0.9877,-0.1564,0.0000 +0.0000,0.0000,0.0000,-0.9823,-0.1874,0.0000 +0.0000,0.0000,0.0000,-0.9759,-0.2181,0.0000 +0.0000,0.0000,0.0000,-0.9686,-0.2487,0.0000 +0.0000,0.0000,0.0000,-0.9603,-0.2790,0.0000 +0.0000,0.0000,0.0000,-0.9511,-0.3090,0.0000 +0.0000,0.0000,0.0000,-0.9409,-0.3387,0.0000 +0.0000,0.0000,0.0000,-0.9298,-0.3681,0.0000 +0.0000,0.0000,0.0000,-0.9178,-0.3971,0.0000 +0.0000,0.0000,0.0000,-0.9048,-0.4258,0.0000 +0.0000,0.0000,0.0000,-0.8910,-0.4540,0.0000 +0.0000,0.0000,0.0000,-0.8763,-0.4818,0.0000 +0.0000,0.0000,0.0000,-0.8607,-0.5090,0.0000 +0.0000,0.0000,0.0000,-0.8443,-0.5358,0.0000 +0.0000,0.0000,0.0000,-0.8271,-0.5621,0.0000 +0.0000,0.0000,0.0000,-0.8090,-0.5878,0.0000 +0.0000,0.0000,0.0000,-0.7902,-0.6129,0.0000 +0.0000,0.0000,0.0000,-0.7705,-0.6374,0.0000 +0.0000,0.0000,0.0000,-0.7501,-0.6613,0.0000 +0.0000,0.0000,0.0000,-0.7290,-0.6845,0.0000 +0.0000,0.0000,0.0000,-0.7071,-0.7071,0.0000 +0.0000,0.0000,0.0000,-0.6845,-0.7290,0.0000 +0.0000,0.0000,0.0000,-0.6613,-0.7501,0.0000 +0.0000,0.0000,0.0000,-0.6374,-0.7705,0.0000 +0.0000,0.0000,0.0000,-0.6129,-0.7902,0.0000 +0.0000,0.0000,0.0000,-0.5878,-0.8090,0.0000 +0.0000,0.0000,0.0000,-0.5621,-0.8271,0.0000 +0.0000,0.0000,0.0000,-0.5358,-0.8443,0.0000 +0.0000,0.0000,0.0000,-0.5090,-0.8607,0.0000 +0.0000,0.0000,0.0000,-0.4818,-0.8763,0.0000 +0.0000,0.0000,0.0000,-0.4540,-0.8910,0.0000 +0.0000,0.0000,0.0000,-0.4258,-0.9048,0.0000 +0.0000,0.0000,0.0000,-0.3971,-0.9178,0.0000 +0.0000,0.0000,0.0000,-0.3681,-0.9298,0.0000 +0.0000,0.0000,0.0000,-0.3387,-0.9409,0.0000 +0.0000,0.0000,0.0000,-0.3090,-0.9511,0.0000 +0.0000,0.0000,0.0000,-0.2790,-0.9603,0.0000 +0.0000,0.0000,0.0000,-0.2487,-0.9686,0.0000 +0.0000,0.0000,0.0000,-0.2181,-0.9759,0.0000 +0.0000,0.0000,0.0000,-0.1874,-0.9823,0.0000 +0.0000,0.0000,0.0000,-0.1564,-0.9877,0.0000 +0.0000,0.0000,0.0000,-0.1253,-0.9921,0.0000 +0.0000,0.0000,0.0000,-0.0941,-0.9956,0.0000 +0.0000,0.0000,0.0000,-0.0628,-0.9980,0.0000 +0.0000,0.0000,0.0000,-0.0314,-0.9995,0.0000 +0.0000,0.0000,0.0000,0.0000,-1.0000,0.0000 +0.0000,0.0000,0.0000,0.0314,-0.9995,0.0000 +0.0000,0.0000,0.0000,0.0628,-0.9980,0.0000 +0.0000,0.0000,0.0000,0.0941,-0.9956,0.0000 +0.0000,0.0000,0.0000,0.1253,-0.9921,0.0000 +0.0000,0.0000,0.0000,0.1564,-0.9877,0.0000 +0.0000,0.0000,0.0000,0.1874,-0.9823,0.0000 +0.0000,0.0000,0.0000,0.2181,-0.9759,0.0000 +0.0000,0.0000,0.0000,0.2487,-0.9686,0.0000 +0.0000,0.0000,0.0000,0.2790,-0.9603,0.0000 +0.0000,0.0000,0.0000,0.3090,-0.9511,0.0000 +0.0000,0.0000,0.0000,0.3387,-0.9409,0.0000 +0.0000,0.0000,0.0000,0.3681,-0.9298,0.0000 +0.0000,0.0000,0.0000,0.3971,-0.9178,0.0000 +0.0000,0.0000,0.0000,0.4258,-0.9048,0.0000 +0.0000,0.0000,0.0000,0.4540,-0.8910,0.0000 +0.0000,0.0000,0.0000,0.4818,-0.8763,0.0000 +0.0000,0.0000,0.0000,0.5090,-0.8607,0.0000 +0.0000,0.0000,0.0000,0.5358,-0.8443,0.0000 +0.0000,0.0000,0.0000,0.5621,-0.8271,0.0000 +0.0000,0.0000,0.0000,0.5878,-0.8090,0.0000 +0.0000,0.0000,0.0000,0.6129,-0.7902,0.0000 +0.0000,0.0000,0.0000,0.6374,-0.7705,0.0000 +0.0000,0.0000,0.0000,0.6613,-0.7501,0.0000 +0.0000,0.0000,0.0000,0.6845,-0.7290,0.0000 +0.0000,0.0000,0.0000,0.7071,-0.7071,0.0000 +0.0000,0.0000,0.0000,0.7290,-0.6845,0.0000 +0.0000,0.0000,0.0000,0.7501,-0.6613,0.0000 +0.0000,0.0000,0.0000,0.7705,-0.6374,0.0000 +0.0000,0.0000,0.0000,0.7902,-0.6129,0.0000 +0.0000,0.0000,0.0000,0.8090,-0.5878,0.0000 +0.0000,0.0000,0.0000,0.8271,-0.5621,0.0000 +0.0000,0.0000,0.0000,0.8443,-0.5358,0.0000 +0.0000,0.0000,0.0000,0.8607,-0.5090,0.0000 +0.0000,0.0000,0.0000,0.8763,-0.4818,0.0000 +0.0000,0.0000,0.0000,0.8910,-0.4540,0.0000 +0.0000,0.0000,0.0000,0.9048,-0.4258,0.0000 +0.0000,0.0000,0.0000,0.9178,-0.3971,0.0000 +0.0000,0.0000,0.0000,0.9298,-0.3681,0.0000 +0.0000,0.0000,0.0000,0.9409,-0.3387,0.0000 +0.0000,0.0000,0.0000,0.9511,-0.3090,0.0000 +0.0000,0.0000,0.0000,0.9603,-0.2790,0.0000 +0.0000,0.0000,0.0000,0.9686,-0.2487,0.0000 +0.0000,0.0000,0.0000,0.9759,-0.2181,0.0000 +0.0000,0.0000,0.0000,0.9823,-0.1874,0.0000 +0.0000,0.0000,0.0000,0.9877,-0.1564,0.0000 +0.0000,0.0000,0.0000,0.9921,-0.1253,0.0000 +0.0000,0.0000,0.0000,0.9956,-0.0941,0.0000 +0.0000,0.0000,0.0000,0.9980,-0.0628,0.0000 +0.0000,0.0000,0.0000,0.9995,-0.0314,0.0000 +0.0000,0.0000,0.0000,1.0000,0.0000,0.0000 diff --git a/scripts/trajectories/full-circle-4s-ccw.csv b/scripts/trajectories/full-circle-4s-ccw.csv new file mode 100644 index 0000000000..13eeae28e1 --- /dev/null +++ b/scripts/trajectories/full-circle-4s-ccw.csv @@ -0,0 +1,800 @@ +0.9999,0.0000,0.0000,0.0157 +0.9999,0.0000,0.0000,0.0157 +0.9999,0.0000,0.0000,0.0157 +0.9999,0.0000,0.0000,0.0157 +0.9995,0.0000,0.0000,0.0314 +0.9995,0.0000,0.0000,0.0314 +0.9995,0.0000,0.0000,0.0314 +0.9995,0.0000,0.0000,0.0314 +0.9989,0.0000,0.0000,0.0471 +0.9989,0.0000,0.0000,0.0471 +0.9989,0.0000,0.0000,0.0471 +0.9989,0.0000,0.0000,0.0471 +0.9980,0.0000,0.0000,0.0628 +0.9980,0.0000,0.0000,0.0628 +0.9980,0.0000,0.0000,0.0628 +0.9980,0.0000,0.0000,0.0628 +0.9969,0.0000,0.0000,0.0785 +0.9969,0.0000,0.0000,0.0785 +0.9969,0.0000,0.0000,0.0785 +0.9969,0.0000,0.0000,0.0785 +0.9956,0.0000,0.0000,0.0941 +0.9956,0.0000,0.0000,0.0941 +0.9956,0.0000,0.0000,0.0941 +0.9956,0.0000,0.0000,0.0941 +0.9940,0.0000,0.0000,0.1097 +0.9940,0.0000,0.0000,0.1097 +0.9940,0.0000,0.0000,0.1097 +0.9940,0.0000,0.0000,0.1097 +0.9921,0.0000,0.0000,0.1253 +0.9921,0.0000,0.0000,0.1253 +0.9921,0.0000,0.0000,0.1253 +0.9921,0.0000,0.0000,0.1253 +0.9900,0.0000,0.0000,0.1409 +0.9900,0.0000,0.0000,0.1409 +0.9900,0.0000,0.0000,0.1409 +0.9900,0.0000,0.0000,0.1409 +0.9877,0.0000,0.0000,0.1564 +0.9877,0.0000,0.0000,0.1564 +0.9877,0.0000,0.0000,0.1564 +0.9877,0.0000,0.0000,0.1564 +0.9851,0.0000,0.0000,0.1719 +0.9851,0.0000,0.0000,0.1719 +0.9851,0.0000,0.0000,0.1719 +0.9851,0.0000,0.0000,0.1719 +0.9823,0.0000,0.0000,0.1874 +0.9823,0.0000,0.0000,0.1874 +0.9823,0.0000,0.0000,0.1874 +0.9823,0.0000,0.0000,0.1874 +0.9792,0.0000,0.0000,0.2028 +0.9792,0.0000,0.0000,0.2028 +0.9792,0.0000,0.0000,0.2028 +0.9792,0.0000,0.0000,0.2028 +0.9759,0.0000,0.0000,0.2181 +0.9759,0.0000,0.0000,0.2181 +0.9759,0.0000,0.0000,0.2181 +0.9759,0.0000,0.0000,0.2181 +0.9724,0.0000,0.0000,0.2334 +0.9724,0.0000,0.0000,0.2334 +0.9724,0.0000,0.0000,0.2334 +0.9724,0.0000,0.0000,0.2334 +0.9686,0.0000,0.0000,0.2487 +0.9686,0.0000,0.0000,0.2487 +0.9686,0.0000,0.0000,0.2487 +0.9686,0.0000,0.0000,0.2487 +0.9646,0.0000,0.0000,0.2639 +0.9646,0.0000,0.0000,0.2639 +0.9646,0.0000,0.0000,0.2639 +0.9646,0.0000,0.0000,0.2639 +0.9603,0.0000,0.0000,0.2790 +0.9603,0.0000,0.0000,0.2790 +0.9603,0.0000,0.0000,0.2790 +0.9603,0.0000,0.0000,0.2790 +0.9558,0.0000,0.0000,0.2940 +0.9558,0.0000,0.0000,0.2940 +0.9558,0.0000,0.0000,0.2940 +0.9558,0.0000,0.0000,0.2940 +0.9511,0.0000,0.0000,0.3090 +0.9511,0.0000,0.0000,0.3090 +0.9511,0.0000,0.0000,0.3090 +0.9511,0.0000,0.0000,0.3090 +0.9461,0.0000,0.0000,0.3239 +0.9461,0.0000,0.0000,0.3239 +0.9461,0.0000,0.0000,0.3239 +0.9461,0.0000,0.0000,0.3239 +0.9409,0.0000,0.0000,0.3387 +0.9409,0.0000,0.0000,0.3387 +0.9409,0.0000,0.0000,0.3387 +0.9409,0.0000,0.0000,0.3387 +0.9354,0.0000,0.0000,0.3535 +0.9354,0.0000,0.0000,0.3535 +0.9354,0.0000,0.0000,0.3535 +0.9354,0.0000,0.0000,0.3535 +0.9298,0.0000,0.0000,0.3681 +0.9298,0.0000,0.0000,0.3681 +0.9298,0.0000,0.0000,0.3681 +0.9298,0.0000,0.0000,0.3681 +0.9239,0.0000,0.0000,0.3827 +0.9239,0.0000,0.0000,0.3827 +0.9239,0.0000,0.0000,0.3827 +0.9239,0.0000,0.0000,0.3827 +0.9178,0.0000,0.0000,0.3971 +0.9178,0.0000,0.0000,0.3971 +0.9178,0.0000,0.0000,0.3971 +0.9178,0.0000,0.0000,0.3971 +0.9114,0.0000,0.0000,0.4115 +0.9114,0.0000,0.0000,0.4115 +0.9114,0.0000,0.0000,0.4115 +0.9114,0.0000,0.0000,0.4115 +0.9048,0.0000,0.0000,0.4258 +0.9048,0.0000,0.0000,0.4258 +0.9048,0.0000,0.0000,0.4258 +0.9048,0.0000,0.0000,0.4258 +0.8980,0.0000,0.0000,0.4399 +0.8980,0.0000,0.0000,0.4399 +0.8980,0.0000,0.0000,0.4399 +0.8980,0.0000,0.0000,0.4399 +0.8910,0.0000,0.0000,0.4540 +0.8910,0.0000,0.0000,0.4540 +0.8910,0.0000,0.0000,0.4540 +0.8910,0.0000,0.0000,0.4540 +0.8838,0.0000,0.0000,0.4679 +0.8838,0.0000,0.0000,0.4679 +0.8838,0.0000,0.0000,0.4679 +0.8838,0.0000,0.0000,0.4679 +0.8763,0.0000,0.0000,0.4818 +0.8763,0.0000,0.0000,0.4818 +0.8763,0.0000,0.0000,0.4818 +0.8763,0.0000,0.0000,0.4818 +0.8686,0.0000,0.0000,0.4955 +0.8686,0.0000,0.0000,0.4955 +0.8686,0.0000,0.0000,0.4955 +0.8686,0.0000,0.0000,0.4955 +0.8607,0.0000,0.0000,0.5090 +0.8607,0.0000,0.0000,0.5090 +0.8607,0.0000,0.0000,0.5090 +0.8607,0.0000,0.0000,0.5090 +0.8526,0.0000,0.0000,0.5225 +0.8526,0.0000,0.0000,0.5225 +0.8526,0.0000,0.0000,0.5225 +0.8526,0.0000,0.0000,0.5225 +0.8443,0.0000,0.0000,0.5358 +0.8443,0.0000,0.0000,0.5358 +0.8443,0.0000,0.0000,0.5358 +0.8443,0.0000,0.0000,0.5358 +0.8358,0.0000,0.0000,0.5490 +0.8358,0.0000,0.0000,0.5490 +0.8358,0.0000,0.0000,0.5490 +0.8358,0.0000,0.0000,0.5490 +0.8271,0.0000,0.0000,0.5621 +0.8271,0.0000,0.0000,0.5621 +0.8271,0.0000,0.0000,0.5621 +0.8271,0.0000,0.0000,0.5621 +0.8181,0.0000,0.0000,0.5750 +0.8181,0.0000,0.0000,0.5750 +0.8181,0.0000,0.0000,0.5750 +0.8181,0.0000,0.0000,0.5750 +0.8090,0.0000,0.0000,0.5878 +0.8090,0.0000,0.0000,0.5878 +0.8090,0.0000,0.0000,0.5878 +0.8090,0.0000,0.0000,0.5878 +0.7997,0.0000,0.0000,0.6004 +0.7997,0.0000,0.0000,0.6004 +0.7997,0.0000,0.0000,0.6004 +0.7997,0.0000,0.0000,0.6004 +0.7902,0.0000,0.0000,0.6129 +0.7902,0.0000,0.0000,0.6129 +0.7902,0.0000,0.0000,0.6129 +0.7902,0.0000,0.0000,0.6129 +0.7804,0.0000,0.0000,0.6252 +0.7804,0.0000,0.0000,0.6252 +0.7804,0.0000,0.0000,0.6252 +0.7804,0.0000,0.0000,0.6252 +0.7705,0.0000,0.0000,0.6374 +0.7705,0.0000,0.0000,0.6374 +0.7705,0.0000,0.0000,0.6374 +0.7705,0.0000,0.0000,0.6374 +0.7604,0.0000,0.0000,0.6494 +0.7604,0.0000,0.0000,0.6494 +0.7604,0.0000,0.0000,0.6494 +0.7604,0.0000,0.0000,0.6494 +0.7501,0.0000,0.0000,0.6613 +0.7501,0.0000,0.0000,0.6613 +0.7501,0.0000,0.0000,0.6613 +0.7501,0.0000,0.0000,0.6613 +0.7396,0.0000,0.0000,0.6730 +0.7396,0.0000,0.0000,0.6730 +0.7396,0.0000,0.0000,0.6730 +0.7396,0.0000,0.0000,0.6730 +0.7290,0.0000,0.0000,0.6845 +0.7290,0.0000,0.0000,0.6845 +0.7290,0.0000,0.0000,0.6845 +0.7290,0.0000,0.0000,0.6845 +0.7181,0.0000,0.0000,0.6959 +0.7181,0.0000,0.0000,0.6959 +0.7181,0.0000,0.0000,0.6959 +0.7181,0.0000,0.0000,0.6959 +0.7071,0.0000,0.0000,0.7071 +0.7071,0.0000,0.0000,0.7071 +0.7071,0.0000,0.0000,0.7071 +0.7071,0.0000,0.0000,0.7071 +0.6959,0.0000,0.0000,0.7181 +0.6959,0.0000,0.0000,0.7181 +0.6959,0.0000,0.0000,0.7181 +0.6959,0.0000,0.0000,0.7181 +0.6845,0.0000,0.0000,0.7290 +0.6845,0.0000,0.0000,0.7290 +0.6845,0.0000,0.0000,0.7290 +0.6845,0.0000,0.0000,0.7290 +0.6730,0.0000,0.0000,0.7396 +0.6730,0.0000,0.0000,0.7396 +0.6730,0.0000,0.0000,0.7396 +0.6730,0.0000,0.0000,0.7396 +0.6613,0.0000,0.0000,0.7501 +0.6613,0.0000,0.0000,0.7501 +0.6613,0.0000,0.0000,0.7501 +0.6613,0.0000,0.0000,0.7501 +0.6494,0.0000,0.0000,0.7604 +0.6494,0.0000,0.0000,0.7604 +0.6494,0.0000,0.0000,0.7604 +0.6494,0.0000,0.0000,0.7604 +0.6374,0.0000,0.0000,0.7705 +0.6374,0.0000,0.0000,0.7705 +0.6374,0.0000,0.0000,0.7705 +0.6374,0.0000,0.0000,0.7705 +0.6252,0.0000,0.0000,0.7804 +0.6252,0.0000,0.0000,0.7804 +0.6252,0.0000,0.0000,0.7804 +0.6252,0.0000,0.0000,0.7804 +0.6129,0.0000,0.0000,0.7902 +0.6129,0.0000,0.0000,0.7902 +0.6129,0.0000,0.0000,0.7902 +0.6129,0.0000,0.0000,0.7902 +0.6004,0.0000,0.0000,0.7997 +0.6004,0.0000,0.0000,0.7997 +0.6004,0.0000,0.0000,0.7997 +0.6004,0.0000,0.0000,0.7997 +0.5878,0.0000,0.0000,0.8090 +0.5878,0.0000,0.0000,0.8090 +0.5878,0.0000,0.0000,0.8090 +0.5878,0.0000,0.0000,0.8090 +0.5750,0.0000,0.0000,0.8181 +0.5750,0.0000,0.0000,0.8181 +0.5750,0.0000,0.0000,0.8181 +0.5750,0.0000,0.0000,0.8181 +0.5621,0.0000,0.0000,0.8271 +0.5621,0.0000,0.0000,0.8271 +0.5621,0.0000,0.0000,0.8271 +0.5621,0.0000,0.0000,0.8271 +0.5490,0.0000,0.0000,0.8358 +0.5490,0.0000,0.0000,0.8358 +0.5490,0.0000,0.0000,0.8358 +0.5490,0.0000,0.0000,0.8358 +0.5358,0.0000,0.0000,0.8443 +0.5358,0.0000,0.0000,0.8443 +0.5358,0.0000,0.0000,0.8443 +0.5358,0.0000,0.0000,0.8443 +0.5225,0.0000,0.0000,0.8526 +0.5225,0.0000,0.0000,0.8526 +0.5225,0.0000,0.0000,0.8526 +0.5225,0.0000,0.0000,0.8526 +0.5090,0.0000,0.0000,0.8607 +0.5090,0.0000,0.0000,0.8607 +0.5090,0.0000,0.0000,0.8607 +0.5090,0.0000,0.0000,0.8607 +0.4955,0.0000,0.0000,0.8686 +0.4955,0.0000,0.0000,0.8686 +0.4955,0.0000,0.0000,0.8686 +0.4955,0.0000,0.0000,0.8686 +0.4818,0.0000,0.0000,0.8763 +0.4818,0.0000,0.0000,0.8763 +0.4818,0.0000,0.0000,0.8763 +0.4818,0.0000,0.0000,0.8763 +0.4679,0.0000,0.0000,0.8838 +0.4679,0.0000,0.0000,0.8838 +0.4679,0.0000,0.0000,0.8838 +0.4679,0.0000,0.0000,0.8838 +0.4540,0.0000,0.0000,0.8910 +0.4540,0.0000,0.0000,0.8910 +0.4540,0.0000,0.0000,0.8910 +0.4540,0.0000,0.0000,0.8910 +0.4399,0.0000,0.0000,0.8980 +0.4399,0.0000,0.0000,0.8980 +0.4399,0.0000,0.0000,0.8980 +0.4399,0.0000,0.0000,0.8980 +0.4258,0.0000,0.0000,0.9048 +0.4258,0.0000,0.0000,0.9048 +0.4258,0.0000,0.0000,0.9048 +0.4258,0.0000,0.0000,0.9048 +0.4115,0.0000,0.0000,0.9114 +0.4115,0.0000,0.0000,0.9114 +0.4115,0.0000,0.0000,0.9114 +0.4115,0.0000,0.0000,0.9114 +0.3971,0.0000,0.0000,0.9178 +0.3971,0.0000,0.0000,0.9178 +0.3971,0.0000,0.0000,0.9178 +0.3971,0.0000,0.0000,0.9178 +0.3827,0.0000,0.0000,0.9239 +0.3827,0.0000,0.0000,0.9239 +0.3827,0.0000,0.0000,0.9239 +0.3827,0.0000,0.0000,0.9239 +0.3681,0.0000,0.0000,0.9298 +0.3681,0.0000,0.0000,0.9298 +0.3681,0.0000,0.0000,0.9298 +0.3681,0.0000,0.0000,0.9298 +0.3535,0.0000,0.0000,0.9354 +0.3535,0.0000,0.0000,0.9354 +0.3535,0.0000,0.0000,0.9354 +0.3535,0.0000,0.0000,0.9354 +0.3387,0.0000,0.0000,0.9409 +0.3387,0.0000,0.0000,0.9409 +0.3387,0.0000,0.0000,0.9409 +0.3387,0.0000,0.0000,0.9409 +0.3239,0.0000,0.0000,0.9461 +0.3239,0.0000,0.0000,0.9461 +0.3239,0.0000,0.0000,0.9461 +0.3239,0.0000,0.0000,0.9461 +0.3090,0.0000,0.0000,0.9511 +0.3090,0.0000,0.0000,0.9511 +0.3090,0.0000,0.0000,0.9511 +0.3090,0.0000,0.0000,0.9511 +0.2940,0.0000,0.0000,0.9558 +0.2940,0.0000,0.0000,0.9558 +0.2940,0.0000,0.0000,0.9558 +0.2940,0.0000,0.0000,0.9558 +0.2790,0.0000,0.0000,0.9603 +0.2790,0.0000,0.0000,0.9603 +0.2790,0.0000,0.0000,0.9603 +0.2790,0.0000,0.0000,0.9603 +0.2639,0.0000,0.0000,0.9646 +0.2639,0.0000,0.0000,0.9646 +0.2639,0.0000,0.0000,0.9646 +0.2639,0.0000,0.0000,0.9646 +0.2487,0.0000,0.0000,0.9686 +0.2487,0.0000,0.0000,0.9686 +0.2487,0.0000,0.0000,0.9686 +0.2487,0.0000,0.0000,0.9686 +0.2334,0.0000,0.0000,0.9724 +0.2334,0.0000,0.0000,0.9724 +0.2334,0.0000,0.0000,0.9724 +0.2334,0.0000,0.0000,0.9724 +0.2181,0.0000,0.0000,0.9759 +0.2181,0.0000,0.0000,0.9759 +0.2181,0.0000,0.0000,0.9759 +0.2181,0.0000,0.0000,0.9759 +0.2028,0.0000,0.0000,0.9792 +0.2028,0.0000,0.0000,0.9792 +0.2028,0.0000,0.0000,0.9792 +0.2028,0.0000,0.0000,0.9792 +0.1874,0.0000,0.0000,0.9823 +0.1874,0.0000,0.0000,0.9823 +0.1874,0.0000,0.0000,0.9823 +0.1874,0.0000,0.0000,0.9823 +0.1719,0.0000,0.0000,0.9851 +0.1719,0.0000,0.0000,0.9851 +0.1719,0.0000,0.0000,0.9851 +0.1719,0.0000,0.0000,0.9851 +0.1564,0.0000,0.0000,0.9877 +0.1564,0.0000,0.0000,0.9877 +0.1564,0.0000,0.0000,0.9877 +0.1564,0.0000,0.0000,0.9877 +0.1409,0.0000,0.0000,0.9900 +0.1409,0.0000,0.0000,0.9900 +0.1409,0.0000,0.0000,0.9900 +0.1409,0.0000,0.0000,0.9900 +0.1253,0.0000,0.0000,0.9921 +0.1253,0.0000,0.0000,0.9921 +0.1253,0.0000,0.0000,0.9921 +0.1253,0.0000,0.0000,0.9921 +0.1097,0.0000,0.0000,0.9940 +0.1097,0.0000,0.0000,0.9940 +0.1097,0.0000,0.0000,0.9940 +0.1097,0.0000,0.0000,0.9940 +0.0941,0.0000,0.0000,0.9956 +0.0941,0.0000,0.0000,0.9956 +0.0941,0.0000,0.0000,0.9956 +0.0941,0.0000,0.0000,0.9956 +0.0785,0.0000,0.0000,0.9969 +0.0785,0.0000,0.0000,0.9969 +0.0785,0.0000,0.0000,0.9969 +0.0785,0.0000,0.0000,0.9969 +0.0628,0.0000,0.0000,0.9980 +0.0628,0.0000,0.0000,0.9980 +0.0628,0.0000,0.0000,0.9980 +0.0628,0.0000,0.0000,0.9980 +0.0471,0.0000,0.0000,0.9989 +0.0471,0.0000,0.0000,0.9989 +0.0471,0.0000,0.0000,0.9989 +0.0471,0.0000,0.0000,0.9989 +0.0314,0.0000,0.0000,0.9995 +0.0314,0.0000,0.0000,0.9995 +0.0314,0.0000,0.0000,0.9995 +0.0314,0.0000,0.0000,0.9995 +0.0157,0.0000,0.0000,0.9999 +0.0157,0.0000,0.0000,0.9999 +0.0157,0.0000,0.0000,0.9999 +0.0157,0.0000,0.0000,0.9999 +-0.0000,0.0000,0.0000,1.0000 +-0.0000,0.0000,0.0000,1.0000 +-0.0000,0.0000,0.0000,1.0000 +-0.0000,0.0000,0.0000,1.0000 +-0.0157,0.0000,0.0000,0.9999 +-0.0157,0.0000,0.0000,0.9999 +-0.0157,0.0000,0.0000,0.9999 +-0.0157,0.0000,0.0000,0.9999 +-0.0314,0.0000,0.0000,0.9995 +-0.0314,0.0000,0.0000,0.9995 +-0.0314,0.0000,0.0000,0.9995 +-0.0314,0.0000,0.0000,0.9995 +-0.0471,0.0000,0.0000,0.9989 +-0.0471,0.0000,0.0000,0.9989 +-0.0471,0.0000,0.0000,0.9989 +-0.0471,0.0000,0.0000,0.9989 +-0.0628,0.0000,0.0000,0.9980 +-0.0628,0.0000,0.0000,0.9980 +-0.0628,0.0000,0.0000,0.9980 +-0.0628,0.0000,0.0000,0.9980 +-0.0785,0.0000,0.0000,0.9969 +-0.0785,0.0000,0.0000,0.9969 +-0.0785,0.0000,0.0000,0.9969 +-0.0785,0.0000,0.0000,0.9969 +-0.0941,0.0000,0.0000,0.9956 +-0.0941,0.0000,0.0000,0.9956 +-0.0941,0.0000,0.0000,0.9956 +-0.0941,0.0000,0.0000,0.9956 +-0.1097,0.0000,0.0000,0.9940 +-0.1097,0.0000,0.0000,0.9940 +-0.1097,0.0000,0.0000,0.9940 +-0.1097,0.0000,0.0000,0.9940 +-0.1253,0.0000,0.0000,0.9921 +-0.1253,0.0000,0.0000,0.9921 +-0.1253,0.0000,0.0000,0.9921 +-0.1253,0.0000,0.0000,0.9921 +-0.1409,0.0000,0.0000,0.9900 +-0.1409,0.0000,0.0000,0.9900 +-0.1409,0.0000,0.0000,0.9900 +-0.1409,0.0000,0.0000,0.9900 +-0.1564,0.0000,0.0000,0.9877 +-0.1564,0.0000,0.0000,0.9877 +-0.1564,0.0000,0.0000,0.9877 +-0.1564,0.0000,0.0000,0.9877 +-0.1719,0.0000,0.0000,0.9851 +-0.1719,0.0000,0.0000,0.9851 +-0.1719,0.0000,0.0000,0.9851 +-0.1719,0.0000,0.0000,0.9851 +-0.1874,0.0000,0.0000,0.9823 +-0.1874,0.0000,0.0000,0.9823 +-0.1874,0.0000,0.0000,0.9823 +-0.1874,0.0000,0.0000,0.9823 +-0.2028,0.0000,0.0000,0.9792 +-0.2028,0.0000,0.0000,0.9792 +-0.2028,0.0000,0.0000,0.9792 +-0.2028,0.0000,0.0000,0.9792 +-0.2181,0.0000,0.0000,0.9759 +-0.2181,0.0000,0.0000,0.9759 +-0.2181,0.0000,0.0000,0.9759 +-0.2181,0.0000,0.0000,0.9759 +-0.2334,0.0000,0.0000,0.9724 +-0.2334,0.0000,0.0000,0.9724 +-0.2334,0.0000,0.0000,0.9724 +-0.2334,0.0000,0.0000,0.9724 +-0.2487,0.0000,0.0000,0.9686 +-0.2487,0.0000,0.0000,0.9686 +-0.2487,0.0000,0.0000,0.9686 +-0.2487,0.0000,0.0000,0.9686 +-0.2639,0.0000,0.0000,0.9646 +-0.2639,0.0000,0.0000,0.9646 +-0.2639,0.0000,0.0000,0.9646 +-0.2639,0.0000,0.0000,0.9646 +-0.2790,0.0000,0.0000,0.9603 +-0.2790,0.0000,0.0000,0.9603 +-0.2790,0.0000,0.0000,0.9603 +-0.2790,0.0000,0.0000,0.9603 +-0.2940,0.0000,0.0000,0.9558 +-0.2940,0.0000,0.0000,0.9558 +-0.2940,0.0000,0.0000,0.9558 +-0.2940,0.0000,0.0000,0.9558 +-0.3090,0.0000,0.0000,0.9511 +-0.3090,0.0000,0.0000,0.9511 +-0.3090,0.0000,0.0000,0.9511 +-0.3090,0.0000,0.0000,0.9511 +-0.3239,0.0000,0.0000,0.9461 +-0.3239,0.0000,0.0000,0.9461 +-0.3239,0.0000,0.0000,0.9461 +-0.3239,0.0000,0.0000,0.9461 +-0.3387,0.0000,0.0000,0.9409 +-0.3387,0.0000,0.0000,0.9409 +-0.3387,0.0000,0.0000,0.9409 +-0.3387,0.0000,0.0000,0.9409 +-0.3535,0.0000,0.0000,0.9354 +-0.3535,0.0000,0.0000,0.9354 +-0.3535,0.0000,0.0000,0.9354 +-0.3535,0.0000,0.0000,0.9354 +-0.3681,0.0000,0.0000,0.9298 +-0.3681,0.0000,0.0000,0.9298 +-0.3681,0.0000,0.0000,0.9298 +-0.3681,0.0000,0.0000,0.9298 +-0.3827,0.0000,0.0000,0.9239 +-0.3827,0.0000,0.0000,0.9239 +-0.3827,0.0000,0.0000,0.9239 +-0.3827,0.0000,0.0000,0.9239 +-0.3971,0.0000,0.0000,0.9178 +-0.3971,0.0000,0.0000,0.9178 +-0.3971,0.0000,0.0000,0.9178 +-0.3971,0.0000,0.0000,0.9178 +-0.4115,0.0000,0.0000,0.9114 +-0.4115,0.0000,0.0000,0.9114 +-0.4115,0.0000,0.0000,0.9114 +-0.4115,0.0000,0.0000,0.9114 +-0.4258,0.0000,0.0000,0.9048 +-0.4258,0.0000,0.0000,0.9048 +-0.4258,0.0000,0.0000,0.9048 +-0.4258,0.0000,0.0000,0.9048 +-0.4399,0.0000,0.0000,0.8980 +-0.4399,0.0000,0.0000,0.8980 +-0.4399,0.0000,0.0000,0.8980 +-0.4399,0.0000,0.0000,0.8980 +-0.4540,0.0000,0.0000,0.8910 +-0.4540,0.0000,0.0000,0.8910 +-0.4540,0.0000,0.0000,0.8910 +-0.4540,0.0000,0.0000,0.8910 +-0.4679,0.0000,0.0000,0.8838 +-0.4679,0.0000,0.0000,0.8838 +-0.4679,0.0000,0.0000,0.8838 +-0.4679,0.0000,0.0000,0.8838 +-0.4818,0.0000,0.0000,0.8763 +-0.4818,0.0000,0.0000,0.8763 +-0.4818,0.0000,0.0000,0.8763 +-0.4818,0.0000,0.0000,0.8763 +-0.4955,0.0000,0.0000,0.8686 +-0.4955,0.0000,0.0000,0.8686 +-0.4955,0.0000,0.0000,0.8686 +-0.4955,0.0000,0.0000,0.8686 +-0.5090,0.0000,0.0000,0.8607 +-0.5090,0.0000,0.0000,0.8607 +-0.5090,0.0000,0.0000,0.8607 +-0.5090,0.0000,0.0000,0.8607 +-0.5225,0.0000,0.0000,0.8526 +-0.5225,0.0000,0.0000,0.8526 +-0.5225,0.0000,0.0000,0.8526 +-0.5225,0.0000,0.0000,0.8526 +-0.5358,0.0000,0.0000,0.8443 +-0.5358,0.0000,0.0000,0.8443 +-0.5358,0.0000,0.0000,0.8443 +-0.5358,0.0000,0.0000,0.8443 +-0.5490,0.0000,0.0000,0.8358 +-0.5490,0.0000,0.0000,0.8358 +-0.5490,0.0000,0.0000,0.8358 +-0.5490,0.0000,0.0000,0.8358 +-0.5621,0.0000,0.0000,0.8271 +-0.5621,0.0000,0.0000,0.8271 +-0.5621,0.0000,0.0000,0.8271 +-0.5621,0.0000,0.0000,0.8271 +-0.5750,0.0000,0.0000,0.8181 +-0.5750,0.0000,0.0000,0.8181 +-0.5750,0.0000,0.0000,0.8181 +-0.5750,0.0000,0.0000,0.8181 +-0.5878,0.0000,0.0000,0.8090 +-0.5878,0.0000,0.0000,0.8090 +-0.5878,0.0000,0.0000,0.8090 +-0.5878,0.0000,0.0000,0.8090 +-0.6004,0.0000,0.0000,0.7997 +-0.6004,0.0000,0.0000,0.7997 +-0.6004,0.0000,0.0000,0.7997 +-0.6004,0.0000,0.0000,0.7997 +-0.6129,0.0000,0.0000,0.7902 +-0.6129,0.0000,0.0000,0.7902 +-0.6129,0.0000,0.0000,0.7902 +-0.6129,0.0000,0.0000,0.7902 +-0.6252,0.0000,0.0000,0.7804 +-0.6252,0.0000,0.0000,0.7804 +-0.6252,0.0000,0.0000,0.7804 +-0.6252,0.0000,0.0000,0.7804 +-0.6374,0.0000,0.0000,0.7705 +-0.6374,0.0000,0.0000,0.7705 +-0.6374,0.0000,0.0000,0.7705 +-0.6374,0.0000,0.0000,0.7705 +-0.6494,0.0000,0.0000,0.7604 +-0.6494,0.0000,0.0000,0.7604 +-0.6494,0.0000,0.0000,0.7604 +-0.6494,0.0000,0.0000,0.7604 +-0.6613,0.0000,0.0000,0.7501 +-0.6613,0.0000,0.0000,0.7501 +-0.6613,0.0000,0.0000,0.7501 +-0.6613,0.0000,0.0000,0.7501 +-0.6730,0.0000,0.0000,0.7396 +-0.6730,0.0000,0.0000,0.7396 +-0.6730,0.0000,0.0000,0.7396 +-0.6730,0.0000,0.0000,0.7396 +-0.6845,0.0000,0.0000,0.7290 +-0.6845,0.0000,0.0000,0.7290 +-0.6845,0.0000,0.0000,0.7290 +-0.6845,0.0000,0.0000,0.7290 +-0.6959,0.0000,0.0000,0.7181 +-0.6959,0.0000,0.0000,0.7181 +-0.6959,0.0000,0.0000,0.7181 +-0.6959,0.0000,0.0000,0.7181 +-0.7071,0.0000,0.0000,0.7071 +-0.7071,0.0000,0.0000,0.7071 +-0.7071,0.0000,0.0000,0.7071 +-0.7071,0.0000,0.0000,0.7071 +-0.7181,0.0000,0.0000,0.6959 +-0.7181,0.0000,0.0000,0.6959 +-0.7181,0.0000,0.0000,0.6959 +-0.7181,0.0000,0.0000,0.6959 +-0.7290,0.0000,0.0000,0.6845 +-0.7290,0.0000,0.0000,0.6845 +-0.7290,0.0000,0.0000,0.6845 +-0.7290,0.0000,0.0000,0.6845 +-0.7396,0.0000,0.0000,0.6730 +-0.7396,0.0000,0.0000,0.6730 +-0.7396,0.0000,0.0000,0.6730 +-0.7396,0.0000,0.0000,0.6730 +-0.7501,0.0000,0.0000,0.6613 +-0.7501,0.0000,0.0000,0.6613 +-0.7501,0.0000,0.0000,0.6613 +-0.7501,0.0000,0.0000,0.6613 +-0.7604,0.0000,0.0000,0.6494 +-0.7604,0.0000,0.0000,0.6494 +-0.7604,0.0000,0.0000,0.6494 +-0.7604,0.0000,0.0000,0.6494 +-0.7705,0.0000,0.0000,0.6374 +-0.7705,0.0000,0.0000,0.6374 +-0.7705,0.0000,0.0000,0.6374 +-0.7705,0.0000,0.0000,0.6374 +-0.7804,0.0000,0.0000,0.6252 +-0.7804,0.0000,0.0000,0.6252 +-0.7804,0.0000,0.0000,0.6252 +-0.7804,0.0000,0.0000,0.6252 +-0.7902,0.0000,0.0000,0.6129 +-0.7902,0.0000,0.0000,0.6129 +-0.7902,0.0000,0.0000,0.6129 +-0.7902,0.0000,0.0000,0.6129 +-0.7997,0.0000,0.0000,0.6004 +-0.7997,0.0000,0.0000,0.6004 +-0.7997,0.0000,0.0000,0.6004 +-0.7997,0.0000,0.0000,0.6004 +-0.8090,0.0000,0.0000,0.5878 +-0.8090,0.0000,0.0000,0.5878 +-0.8090,0.0000,0.0000,0.5878 +-0.8090,0.0000,0.0000,0.5878 +-0.8182,0.0000,0.0000,0.5750 +-0.8182,0.0000,0.0000,0.5750 +-0.8182,0.0000,0.0000,0.5750 +-0.8182,0.0000,0.0000,0.5750 +-0.8271,0.0000,0.0000,0.5621 +-0.8271,0.0000,0.0000,0.5621 +-0.8271,0.0000,0.0000,0.5621 +-0.8271,0.0000,0.0000,0.5621 +-0.8358,0.0000,0.0000,0.5490 +-0.8358,0.0000,0.0000,0.5490 +-0.8358,0.0000,0.0000,0.5490 +-0.8358,0.0000,0.0000,0.5490 +-0.8443,0.0000,0.0000,0.5358 +-0.8443,0.0000,0.0000,0.5358 +-0.8443,0.0000,0.0000,0.5358 +-0.8443,0.0000,0.0000,0.5358 +-0.8526,0.0000,0.0000,0.5225 +-0.8526,0.0000,0.0000,0.5225 +-0.8526,0.0000,0.0000,0.5225 +-0.8526,0.0000,0.0000,0.5225 +-0.8607,0.0000,0.0000,0.5090 +-0.8607,0.0000,0.0000,0.5090 +-0.8607,0.0000,0.0000,0.5090 +-0.8607,0.0000,0.0000,0.5090 +-0.8686,0.0000,0.0000,0.4955 +-0.8686,0.0000,0.0000,0.4955 +-0.8686,0.0000,0.0000,0.4955 +-0.8686,0.0000,0.0000,0.4955 +-0.8763,0.0000,0.0000,0.4818 +-0.8763,0.0000,0.0000,0.4818 +-0.8763,0.0000,0.0000,0.4818 +-0.8763,0.0000,0.0000,0.4818 +-0.8838,0.0000,0.0000,0.4679 +-0.8838,0.0000,0.0000,0.4679 +-0.8838,0.0000,0.0000,0.4679 +-0.8838,0.0000,0.0000,0.4679 +-0.8910,0.0000,0.0000,0.4540 +-0.8910,0.0000,0.0000,0.4540 +-0.8910,0.0000,0.0000,0.4540 +-0.8910,0.0000,0.0000,0.4540 +-0.8980,0.0000,0.0000,0.4399 +-0.8980,0.0000,0.0000,0.4399 +-0.8980,0.0000,0.0000,0.4399 +-0.8980,0.0000,0.0000,0.4399 +-0.9048,0.0000,0.0000,0.4258 +-0.9048,0.0000,0.0000,0.4258 +-0.9048,0.0000,0.0000,0.4258 +-0.9048,0.0000,0.0000,0.4258 +-0.9114,0.0000,0.0000,0.4115 +-0.9114,0.0000,0.0000,0.4115 +-0.9114,0.0000,0.0000,0.4115 +-0.9114,0.0000,0.0000,0.4115 +-0.9178,0.0000,0.0000,0.3971 +-0.9178,0.0000,0.0000,0.3971 +-0.9178,0.0000,0.0000,0.3971 +-0.9178,0.0000,0.0000,0.3971 +-0.9239,0.0000,0.0000,0.3827 +-0.9239,0.0000,0.0000,0.3827 +-0.9239,0.0000,0.0000,0.3827 +-0.9239,0.0000,0.0000,0.3827 +-0.9298,0.0000,0.0000,0.3681 +-0.9298,0.0000,0.0000,0.3681 +-0.9298,0.0000,0.0000,0.3681 +-0.9298,0.0000,0.0000,0.3681 +-0.9354,0.0000,0.0000,0.3535 +-0.9354,0.0000,0.0000,0.3535 +-0.9354,0.0000,0.0000,0.3535 +-0.9354,0.0000,0.0000,0.3535 +-0.9409,0.0000,0.0000,0.3387 +-0.9409,0.0000,0.0000,0.3387 +-0.9409,0.0000,0.0000,0.3387 +-0.9409,0.0000,0.0000,0.3387 +-0.9461,0.0000,0.0000,0.3239 +-0.9461,0.0000,0.0000,0.3239 +-0.9461,0.0000,0.0000,0.3239 +-0.9461,0.0000,0.0000,0.3239 +-0.9511,0.0000,0.0000,0.3090 +-0.9511,0.0000,0.0000,0.3090 +-0.9511,0.0000,0.0000,0.3090 +-0.9511,0.0000,0.0000,0.3090 +-0.9558,0.0000,0.0000,0.2940 +-0.9558,0.0000,0.0000,0.2940 +-0.9558,0.0000,0.0000,0.2940 +-0.9558,0.0000,0.0000,0.2940 +-0.9603,0.0000,0.0000,0.2790 +-0.9603,0.0000,0.0000,0.2790 +-0.9603,0.0000,0.0000,0.2790 +-0.9603,0.0000,0.0000,0.2790 +-0.9646,0.0000,0.0000,0.2639 +-0.9646,0.0000,0.0000,0.2639 +-0.9646,0.0000,0.0000,0.2639 +-0.9646,0.0000,0.0000,0.2639 +-0.9686,0.0000,0.0000,0.2487 +-0.9686,0.0000,0.0000,0.2487 +-0.9686,0.0000,0.0000,0.2487 +-0.9686,0.0000,0.0000,0.2487 +-0.9724,0.0000,0.0000,0.2334 +-0.9724,0.0000,0.0000,0.2334 +-0.9724,0.0000,0.0000,0.2334 +-0.9724,0.0000,0.0000,0.2334 +-0.9759,0.0000,0.0000,0.2181 +-0.9759,0.0000,0.0000,0.2181 +-0.9759,0.0000,0.0000,0.2181 +-0.9759,0.0000,0.0000,0.2181 +-0.9792,0.0000,0.0000,0.2028 +-0.9792,0.0000,0.0000,0.2028 +-0.9792,0.0000,0.0000,0.2028 +-0.9792,0.0000,0.0000,0.2028 +-0.9823,0.0000,0.0000,0.1874 +-0.9823,0.0000,0.0000,0.1874 +-0.9823,0.0000,0.0000,0.1874 +-0.9823,0.0000,0.0000,0.1874 +-0.9851,0.0000,0.0000,0.1719 +-0.9851,0.0000,0.0000,0.1719 +-0.9851,0.0000,0.0000,0.1719 +-0.9851,0.0000,0.0000,0.1719 +-0.9877,0.0000,0.0000,0.1564 +-0.9877,0.0000,0.0000,0.1564 +-0.9877,0.0000,0.0000,0.1564 +-0.9877,0.0000,0.0000,0.1564 +-0.9900,0.0000,0.0000,0.1409 +-0.9900,0.0000,0.0000,0.1409 +-0.9900,0.0000,0.0000,0.1409 +-0.9900,0.0000,0.0000,0.1409 +-0.9921,0.0000,0.0000,0.1253 +-0.9921,0.0000,0.0000,0.1253 +-0.9921,0.0000,0.0000,0.1253 +-0.9921,0.0000,0.0000,0.1253 +-0.9940,0.0000,0.0000,0.1097 +-0.9940,0.0000,0.0000,0.1097 +-0.9940,0.0000,0.0000,0.1097 +-0.9940,0.0000,0.0000,0.1097 +-0.9956,0.0000,0.0000,0.0941 +-0.9956,0.0000,0.0000,0.0941 +-0.9956,0.0000,0.0000,0.0941 +-0.9956,0.0000,0.0000,0.0941 +-0.9969,0.0000,0.0000,0.0785 +-0.9969,0.0000,0.0000,0.0785 +-0.9969,0.0000,0.0000,0.0785 +-0.9969,0.0000,0.0000,0.0785 +-0.9980,0.0000,0.0000,0.0628 +-0.9980,0.0000,0.0000,0.0628 +-0.9980,0.0000,0.0000,0.0628 +-0.9980,0.0000,0.0000,0.0628 +-0.9989,0.0000,0.0000,0.0471 +-0.9989,0.0000,0.0000,0.0471 +-0.9989,0.0000,0.0000,0.0471 +-0.9989,0.0000,0.0000,0.0471 +-0.9995,0.0000,0.0000,0.0314 +-0.9995,0.0000,0.0000,0.0314 +-0.9995,0.0000,0.0000,0.0314 +-0.9995,0.0000,0.0000,0.0314 +-0.9999,0.0000,0.0000,0.0157 +-0.9999,0.0000,0.0000,0.0157 +-0.9999,0.0000,0.0000,0.0157 +-0.9999,0.0000,0.0000,0.0157 +1.0000,0.0000,0.0000,0.0000 +1.0000,0.0000,0.0000,0.0000 +1.0000,0.0000,0.0000,0.0000 +1.0000,0.0000,0.0000,0.0000 diff --git a/scripts/trajectories/full-circle-4s.csv b/scripts/trajectories/full-circle-4s.csv new file mode 100644 index 0000000000..4174a531b7 --- /dev/null +++ b/scripts/trajectories/full-circle-4s.csv @@ -0,0 +1,800 @@ +0.9999,0.0000,0.0000,-0.0157 +0.9999,0.0000,0.0000,-0.0157 +0.9999,0.0000,0.0000,-0.0157 +0.9999,0.0000,0.0000,-0.0157 +0.9995,0.0000,0.0000,-0.0314 +0.9995,0.0000,0.0000,-0.0314 +0.9995,0.0000,0.0000,-0.0314 +0.9995,0.0000,0.0000,-0.0314 +0.9989,0.0000,0.0000,-0.0471 +0.9989,0.0000,0.0000,-0.0471 +0.9989,0.0000,0.0000,-0.0471 +0.9989,0.0000,0.0000,-0.0471 +0.9980,0.0000,0.0000,-0.0628 +0.9980,0.0000,0.0000,-0.0628 +0.9980,0.0000,0.0000,-0.0628 +0.9980,0.0000,0.0000,-0.0628 +0.9969,0.0000,0.0000,-0.0785 +0.9969,0.0000,0.0000,-0.0785 +0.9969,0.0000,0.0000,-0.0785 +0.9969,0.0000,0.0000,-0.0785 +0.9956,0.0000,0.0000,-0.0941 +0.9956,0.0000,0.0000,-0.0941 +0.9956,0.0000,0.0000,-0.0941 +0.9956,0.0000,0.0000,-0.0941 +0.9940,0.0000,0.0000,-0.1097 +0.9940,0.0000,0.0000,-0.1097 +0.9940,0.0000,0.0000,-0.1097 +0.9940,0.0000,0.0000,-0.1097 +0.9921,0.0000,0.0000,-0.1253 +0.9921,0.0000,0.0000,-0.1253 +0.9921,0.0000,0.0000,-0.1253 +0.9921,0.0000,0.0000,-0.1253 +0.9900,0.0000,0.0000,-0.1409 +0.9900,0.0000,0.0000,-0.1409 +0.9900,0.0000,0.0000,-0.1409 +0.9900,0.0000,0.0000,-0.1409 +0.9877,0.0000,0.0000,-0.1564 +0.9877,0.0000,0.0000,-0.1564 +0.9877,0.0000,0.0000,-0.1564 +0.9877,0.0000,0.0000,-0.1564 +0.9851,0.0000,0.0000,-0.1719 +0.9851,0.0000,0.0000,-0.1719 +0.9851,0.0000,0.0000,-0.1719 +0.9851,0.0000,0.0000,-0.1719 +0.9823,0.0000,0.0000,-0.1874 +0.9823,0.0000,0.0000,-0.1874 +0.9823,0.0000,0.0000,-0.1874 +0.9823,0.0000,0.0000,-0.1874 +0.9792,0.0000,0.0000,-0.2028 +0.9792,0.0000,0.0000,-0.2028 +0.9792,0.0000,0.0000,-0.2028 +0.9792,0.0000,0.0000,-0.2028 +0.9759,0.0000,0.0000,-0.2181 +0.9759,0.0000,0.0000,-0.2181 +0.9759,0.0000,0.0000,-0.2181 +0.9759,0.0000,0.0000,-0.2181 +0.9724,0.0000,0.0000,-0.2334 +0.9724,0.0000,0.0000,-0.2334 +0.9724,0.0000,0.0000,-0.2334 +0.9724,0.0000,0.0000,-0.2334 +0.9686,0.0000,0.0000,-0.2487 +0.9686,0.0000,0.0000,-0.2487 +0.9686,0.0000,0.0000,-0.2487 +0.9686,0.0000,0.0000,-0.2487 +0.9646,0.0000,0.0000,-0.2639 +0.9646,0.0000,0.0000,-0.2639 +0.9646,0.0000,0.0000,-0.2639 +0.9646,0.0000,0.0000,-0.2639 +0.9603,0.0000,0.0000,-0.2790 +0.9603,0.0000,0.0000,-0.2790 +0.9603,0.0000,0.0000,-0.2790 +0.9603,0.0000,0.0000,-0.2790 +0.9558,0.0000,0.0000,-0.2940 +0.9558,0.0000,0.0000,-0.2940 +0.9558,0.0000,0.0000,-0.2940 +0.9558,0.0000,0.0000,-0.2940 +0.9511,0.0000,0.0000,-0.3090 +0.9511,0.0000,0.0000,-0.3090 +0.9511,0.0000,0.0000,-0.3090 +0.9511,0.0000,0.0000,-0.3090 +0.9461,0.0000,0.0000,-0.3239 +0.9461,0.0000,0.0000,-0.3239 +0.9461,0.0000,0.0000,-0.3239 +0.9461,0.0000,0.0000,-0.3239 +0.9409,0.0000,0.0000,-0.3387 +0.9409,0.0000,0.0000,-0.3387 +0.9409,0.0000,0.0000,-0.3387 +0.9409,0.0000,0.0000,-0.3387 +0.9354,0.0000,0.0000,-0.3535 +0.9354,0.0000,0.0000,-0.3535 +0.9354,0.0000,0.0000,-0.3535 +0.9354,0.0000,0.0000,-0.3535 +0.9298,0.0000,0.0000,-0.3681 +0.9298,0.0000,0.0000,-0.3681 +0.9298,0.0000,0.0000,-0.3681 +0.9298,0.0000,0.0000,-0.3681 +0.9239,0.0000,0.0000,-0.3827 +0.9239,0.0000,0.0000,-0.3827 +0.9239,0.0000,0.0000,-0.3827 +0.9239,0.0000,0.0000,-0.3827 +0.9178,0.0000,0.0000,-0.3971 +0.9178,0.0000,0.0000,-0.3971 +0.9178,0.0000,0.0000,-0.3971 +0.9178,0.0000,0.0000,-0.3971 +0.9114,0.0000,0.0000,-0.4115 +0.9114,0.0000,0.0000,-0.4115 +0.9114,0.0000,0.0000,-0.4115 +0.9114,0.0000,0.0000,-0.4115 +0.9048,0.0000,0.0000,-0.4258 +0.9048,0.0000,0.0000,-0.4258 +0.9048,0.0000,0.0000,-0.4258 +0.9048,0.0000,0.0000,-0.4258 +0.8980,0.0000,0.0000,-0.4399 +0.8980,0.0000,0.0000,-0.4399 +0.8980,0.0000,0.0000,-0.4399 +0.8980,0.0000,0.0000,-0.4399 +0.8910,0.0000,0.0000,-0.4540 +0.8910,0.0000,0.0000,-0.4540 +0.8910,0.0000,0.0000,-0.4540 +0.8910,0.0000,0.0000,-0.4540 +0.8838,0.0000,0.0000,-0.4679 +0.8838,0.0000,0.0000,-0.4679 +0.8838,0.0000,0.0000,-0.4679 +0.8838,0.0000,0.0000,-0.4679 +0.8763,0.0000,0.0000,-0.4818 +0.8763,0.0000,0.0000,-0.4818 +0.8763,0.0000,0.0000,-0.4818 +0.8763,0.0000,0.0000,-0.4818 +0.8686,0.0000,0.0000,-0.4955 +0.8686,0.0000,0.0000,-0.4955 +0.8686,0.0000,0.0000,-0.4955 +0.8686,0.0000,0.0000,-0.4955 +0.8607,0.0000,0.0000,-0.5090 +0.8607,0.0000,0.0000,-0.5090 +0.8607,0.0000,0.0000,-0.5090 +0.8607,0.0000,0.0000,-0.5090 +0.8526,0.0000,0.0000,-0.5225 +0.8526,0.0000,0.0000,-0.5225 +0.8526,0.0000,0.0000,-0.5225 +0.8526,0.0000,0.0000,-0.5225 +0.8443,0.0000,0.0000,-0.5358 +0.8443,0.0000,0.0000,-0.5358 +0.8443,0.0000,0.0000,-0.5358 +0.8443,0.0000,0.0000,-0.5358 +0.8358,0.0000,0.0000,-0.5490 +0.8358,0.0000,0.0000,-0.5490 +0.8358,0.0000,0.0000,-0.5490 +0.8358,0.0000,0.0000,-0.5490 +0.8271,0.0000,0.0000,-0.5621 +0.8271,0.0000,0.0000,-0.5621 +0.8271,0.0000,0.0000,-0.5621 +0.8271,0.0000,0.0000,-0.5621 +0.8181,0.0000,0.0000,-0.5750 +0.8181,0.0000,0.0000,-0.5750 +0.8181,0.0000,0.0000,-0.5750 +0.8181,0.0000,0.0000,-0.5750 +0.8090,0.0000,0.0000,-0.5878 +0.8090,0.0000,0.0000,-0.5878 +0.8090,0.0000,0.0000,-0.5878 +0.8090,0.0000,0.0000,-0.5878 +0.7997,0.0000,0.0000,-0.6004 +0.7997,0.0000,0.0000,-0.6004 +0.7997,0.0000,0.0000,-0.6004 +0.7997,0.0000,0.0000,-0.6004 +0.7902,0.0000,0.0000,-0.6129 +0.7902,0.0000,0.0000,-0.6129 +0.7902,0.0000,0.0000,-0.6129 +0.7902,0.0000,0.0000,-0.6129 +0.7804,0.0000,0.0000,-0.6252 +0.7804,0.0000,0.0000,-0.6252 +0.7804,0.0000,0.0000,-0.6252 +0.7804,0.0000,0.0000,-0.6252 +0.7705,0.0000,0.0000,-0.6374 +0.7705,0.0000,0.0000,-0.6374 +0.7705,0.0000,0.0000,-0.6374 +0.7705,0.0000,0.0000,-0.6374 +0.7604,0.0000,0.0000,-0.6494 +0.7604,0.0000,0.0000,-0.6494 +0.7604,0.0000,0.0000,-0.6494 +0.7604,0.0000,0.0000,-0.6494 +0.7501,0.0000,0.0000,-0.6613 +0.7501,0.0000,0.0000,-0.6613 +0.7501,0.0000,0.0000,-0.6613 +0.7501,0.0000,0.0000,-0.6613 +0.7396,0.0000,0.0000,-0.6730 +0.7396,0.0000,0.0000,-0.6730 +0.7396,0.0000,0.0000,-0.6730 +0.7396,0.0000,0.0000,-0.6730 +0.7290,0.0000,0.0000,-0.6845 +0.7290,0.0000,0.0000,-0.6845 +0.7290,0.0000,0.0000,-0.6845 +0.7290,0.0000,0.0000,-0.6845 +0.7181,0.0000,0.0000,-0.6959 +0.7181,0.0000,0.0000,-0.6959 +0.7181,0.0000,0.0000,-0.6959 +0.7181,0.0000,0.0000,-0.6959 +0.7071,0.0000,0.0000,-0.7071 +0.7071,0.0000,0.0000,-0.7071 +0.7071,0.0000,0.0000,-0.7071 +0.7071,0.0000,0.0000,-0.7071 +0.6959,0.0000,0.0000,-0.7181 +0.6959,0.0000,0.0000,-0.7181 +0.6959,0.0000,0.0000,-0.7181 +0.6959,0.0000,0.0000,-0.7181 +0.6845,0.0000,0.0000,-0.7290 +0.6845,0.0000,0.0000,-0.7290 +0.6845,0.0000,0.0000,-0.7290 +0.6845,0.0000,0.0000,-0.7290 +0.6730,0.0000,0.0000,-0.7396 +0.6730,0.0000,0.0000,-0.7396 +0.6730,0.0000,0.0000,-0.7396 +0.6730,0.0000,0.0000,-0.7396 +0.6613,0.0000,0.0000,-0.7501 +0.6613,0.0000,0.0000,-0.7501 +0.6613,0.0000,0.0000,-0.7501 +0.6613,0.0000,0.0000,-0.7501 +0.6494,0.0000,0.0000,-0.7604 +0.6494,0.0000,0.0000,-0.7604 +0.6494,0.0000,0.0000,-0.7604 +0.6494,0.0000,0.0000,-0.7604 +0.6374,0.0000,0.0000,-0.7705 +0.6374,0.0000,0.0000,-0.7705 +0.6374,0.0000,0.0000,-0.7705 +0.6374,0.0000,0.0000,-0.7705 +0.6252,0.0000,0.0000,-0.7804 +0.6252,0.0000,0.0000,-0.7804 +0.6252,0.0000,0.0000,-0.7804 +0.6252,0.0000,0.0000,-0.7804 +0.6129,0.0000,0.0000,-0.7902 +0.6129,0.0000,0.0000,-0.7902 +0.6129,0.0000,0.0000,-0.7902 +0.6129,0.0000,0.0000,-0.7902 +0.6004,0.0000,0.0000,-0.7997 +0.6004,0.0000,0.0000,-0.7997 +0.6004,0.0000,0.0000,-0.7997 +0.6004,0.0000,0.0000,-0.7997 +0.5878,0.0000,0.0000,-0.8090 +0.5878,0.0000,0.0000,-0.8090 +0.5878,0.0000,0.0000,-0.8090 +0.5878,0.0000,0.0000,-0.8090 +0.5750,0.0000,0.0000,-0.8181 +0.5750,0.0000,0.0000,-0.8181 +0.5750,0.0000,0.0000,-0.8181 +0.5750,0.0000,0.0000,-0.8181 +0.5621,0.0000,0.0000,-0.8271 +0.5621,0.0000,0.0000,-0.8271 +0.5621,0.0000,0.0000,-0.8271 +0.5621,0.0000,0.0000,-0.8271 +0.5490,0.0000,0.0000,-0.8358 +0.5490,0.0000,0.0000,-0.8358 +0.5490,0.0000,0.0000,-0.8358 +0.5490,0.0000,0.0000,-0.8358 +0.5358,0.0000,0.0000,-0.8443 +0.5358,0.0000,0.0000,-0.8443 +0.5358,0.0000,0.0000,-0.8443 +0.5358,0.0000,0.0000,-0.8443 +0.5225,0.0000,0.0000,-0.8526 +0.5225,0.0000,0.0000,-0.8526 +0.5225,0.0000,0.0000,-0.8526 +0.5225,0.0000,0.0000,-0.8526 +0.5090,0.0000,0.0000,-0.8607 +0.5090,0.0000,0.0000,-0.8607 +0.5090,0.0000,0.0000,-0.8607 +0.5090,0.0000,0.0000,-0.8607 +0.4955,0.0000,0.0000,-0.8686 +0.4955,0.0000,0.0000,-0.8686 +0.4955,0.0000,0.0000,-0.8686 +0.4955,0.0000,0.0000,-0.8686 +0.4818,0.0000,0.0000,-0.8763 +0.4818,0.0000,0.0000,-0.8763 +0.4818,0.0000,0.0000,-0.8763 +0.4818,0.0000,0.0000,-0.8763 +0.4679,0.0000,0.0000,-0.8838 +0.4679,0.0000,0.0000,-0.8838 +0.4679,0.0000,0.0000,-0.8838 +0.4679,0.0000,0.0000,-0.8838 +0.4540,0.0000,0.0000,-0.8910 +0.4540,0.0000,0.0000,-0.8910 +0.4540,0.0000,0.0000,-0.8910 +0.4540,0.0000,0.0000,-0.8910 +0.4399,0.0000,0.0000,-0.8980 +0.4399,0.0000,0.0000,-0.8980 +0.4399,0.0000,0.0000,-0.8980 +0.4399,0.0000,0.0000,-0.8980 +0.4258,0.0000,0.0000,-0.9048 +0.4258,0.0000,0.0000,-0.9048 +0.4258,0.0000,0.0000,-0.9048 +0.4258,0.0000,0.0000,-0.9048 +0.4115,0.0000,0.0000,-0.9114 +0.4115,0.0000,0.0000,-0.9114 +0.4115,0.0000,0.0000,-0.9114 +0.4115,0.0000,0.0000,-0.9114 +0.3971,0.0000,0.0000,-0.9178 +0.3971,0.0000,0.0000,-0.9178 +0.3971,0.0000,0.0000,-0.9178 +0.3971,0.0000,0.0000,-0.9178 +0.3827,0.0000,0.0000,-0.9239 +0.3827,0.0000,0.0000,-0.9239 +0.3827,0.0000,0.0000,-0.9239 +0.3827,0.0000,0.0000,-0.9239 +0.3681,0.0000,0.0000,-0.9298 +0.3681,0.0000,0.0000,-0.9298 +0.3681,0.0000,0.0000,-0.9298 +0.3681,0.0000,0.0000,-0.9298 +0.3535,0.0000,0.0000,-0.9354 +0.3535,0.0000,0.0000,-0.9354 +0.3535,0.0000,0.0000,-0.9354 +0.3535,0.0000,0.0000,-0.9354 +0.3387,0.0000,0.0000,-0.9409 +0.3387,0.0000,0.0000,-0.9409 +0.3387,0.0000,0.0000,-0.9409 +0.3387,0.0000,0.0000,-0.9409 +0.3239,0.0000,0.0000,-0.9461 +0.3239,0.0000,0.0000,-0.9461 +0.3239,0.0000,0.0000,-0.9461 +0.3239,0.0000,0.0000,-0.9461 +0.3090,0.0000,0.0000,-0.9511 +0.3090,0.0000,0.0000,-0.9511 +0.3090,0.0000,0.0000,-0.9511 +0.3090,0.0000,0.0000,-0.9511 +0.2940,0.0000,0.0000,-0.9558 +0.2940,0.0000,0.0000,-0.9558 +0.2940,0.0000,0.0000,-0.9558 +0.2940,0.0000,0.0000,-0.9558 +0.2790,0.0000,0.0000,-0.9603 +0.2790,0.0000,0.0000,-0.9603 +0.2790,0.0000,0.0000,-0.9603 +0.2790,0.0000,0.0000,-0.9603 +0.2639,0.0000,0.0000,-0.9646 +0.2639,0.0000,0.0000,-0.9646 +0.2639,0.0000,0.0000,-0.9646 +0.2639,0.0000,0.0000,-0.9646 +0.2487,0.0000,0.0000,-0.9686 +0.2487,0.0000,0.0000,-0.9686 +0.2487,0.0000,0.0000,-0.9686 +0.2487,0.0000,0.0000,-0.9686 +0.2334,0.0000,0.0000,-0.9724 +0.2334,0.0000,0.0000,-0.9724 +0.2334,0.0000,0.0000,-0.9724 +0.2334,0.0000,0.0000,-0.9724 +0.2181,0.0000,0.0000,-0.9759 +0.2181,0.0000,0.0000,-0.9759 +0.2181,0.0000,0.0000,-0.9759 +0.2181,0.0000,0.0000,-0.9759 +0.2028,0.0000,0.0000,-0.9792 +0.2028,0.0000,0.0000,-0.9792 +0.2028,0.0000,0.0000,-0.9792 +0.2028,0.0000,0.0000,-0.9792 +0.1874,0.0000,0.0000,-0.9823 +0.1874,0.0000,0.0000,-0.9823 +0.1874,0.0000,0.0000,-0.9823 +0.1874,0.0000,0.0000,-0.9823 +0.1719,0.0000,0.0000,-0.9851 +0.1719,0.0000,0.0000,-0.9851 +0.1719,0.0000,0.0000,-0.9851 +0.1719,0.0000,0.0000,-0.9851 +0.1564,0.0000,0.0000,-0.9877 +0.1564,0.0000,0.0000,-0.9877 +0.1564,0.0000,0.0000,-0.9877 +0.1564,0.0000,0.0000,-0.9877 +0.1409,0.0000,0.0000,-0.9900 +0.1409,0.0000,0.0000,-0.9900 +0.1409,0.0000,0.0000,-0.9900 +0.1409,0.0000,0.0000,-0.9900 +0.1253,0.0000,0.0000,-0.9921 +0.1253,0.0000,0.0000,-0.9921 +0.1253,0.0000,0.0000,-0.9921 +0.1253,0.0000,0.0000,-0.9921 +0.1097,0.0000,0.0000,-0.9940 +0.1097,0.0000,0.0000,-0.9940 +0.1097,0.0000,0.0000,-0.9940 +0.1097,0.0000,0.0000,-0.9940 +0.0941,0.0000,0.0000,-0.9956 +0.0941,0.0000,0.0000,-0.9956 +0.0941,0.0000,0.0000,-0.9956 +0.0941,0.0000,0.0000,-0.9956 +0.0785,0.0000,0.0000,-0.9969 +0.0785,0.0000,0.0000,-0.9969 +0.0785,0.0000,0.0000,-0.9969 +0.0785,0.0000,0.0000,-0.9969 +0.0628,0.0000,0.0000,-0.9980 +0.0628,0.0000,0.0000,-0.9980 +0.0628,0.0000,0.0000,-0.9980 +0.0628,0.0000,0.0000,-0.9980 +0.0471,0.0000,0.0000,-0.9989 +0.0471,0.0000,0.0000,-0.9989 +0.0471,0.0000,0.0000,-0.9989 +0.0471,0.0000,0.0000,-0.9989 +0.0314,0.0000,0.0000,-0.9995 +0.0314,0.0000,0.0000,-0.9995 +0.0314,0.0000,0.0000,-0.9995 +0.0314,0.0000,0.0000,-0.9995 +0.0157,0.0000,0.0000,-0.9999 +0.0157,0.0000,0.0000,-0.9999 +0.0157,0.0000,0.0000,-0.9999 +0.0157,0.0000,0.0000,-0.9999 +-0.0000,0.0000,0.0000,-1.0000 +-0.0000,0.0000,0.0000,-1.0000 +-0.0000,0.0000,0.0000,-1.0000 +-0.0000,0.0000,0.0000,-1.0000 +-0.0157,0.0000,0.0000,-0.9999 +-0.0157,0.0000,0.0000,-0.9999 +-0.0157,0.0000,0.0000,-0.9999 +-0.0157,0.0000,0.0000,-0.9999 +-0.0314,0.0000,0.0000,-0.9995 +-0.0314,0.0000,0.0000,-0.9995 +-0.0314,0.0000,0.0000,-0.9995 +-0.0314,0.0000,0.0000,-0.9995 +-0.0471,0.0000,0.0000,-0.9989 +-0.0471,0.0000,0.0000,-0.9989 +-0.0471,0.0000,0.0000,-0.9989 +-0.0471,0.0000,0.0000,-0.9989 +-0.0628,0.0000,0.0000,-0.9980 +-0.0628,0.0000,0.0000,-0.9980 +-0.0628,0.0000,0.0000,-0.9980 +-0.0628,0.0000,0.0000,-0.9980 +-0.0785,0.0000,0.0000,-0.9969 +-0.0785,0.0000,0.0000,-0.9969 +-0.0785,0.0000,0.0000,-0.9969 +-0.0785,0.0000,0.0000,-0.9969 +-0.0941,0.0000,0.0000,-0.9956 +-0.0941,0.0000,0.0000,-0.9956 +-0.0941,0.0000,0.0000,-0.9956 +-0.0941,0.0000,0.0000,-0.9956 +-0.1097,0.0000,0.0000,-0.9940 +-0.1097,0.0000,0.0000,-0.9940 +-0.1097,0.0000,0.0000,-0.9940 +-0.1097,0.0000,0.0000,-0.9940 +-0.1253,0.0000,0.0000,-0.9921 +-0.1253,0.0000,0.0000,-0.9921 +-0.1253,0.0000,0.0000,-0.9921 +-0.1253,0.0000,0.0000,-0.9921 +-0.1409,0.0000,0.0000,-0.9900 +-0.1409,0.0000,0.0000,-0.9900 +-0.1409,0.0000,0.0000,-0.9900 +-0.1409,0.0000,0.0000,-0.9900 +-0.1564,0.0000,0.0000,-0.9877 +-0.1564,0.0000,0.0000,-0.9877 +-0.1564,0.0000,0.0000,-0.9877 +-0.1564,0.0000,0.0000,-0.9877 +-0.1719,0.0000,0.0000,-0.9851 +-0.1719,0.0000,0.0000,-0.9851 +-0.1719,0.0000,0.0000,-0.9851 +-0.1719,0.0000,0.0000,-0.9851 +-0.1874,0.0000,0.0000,-0.9823 +-0.1874,0.0000,0.0000,-0.9823 +-0.1874,0.0000,0.0000,-0.9823 +-0.1874,0.0000,0.0000,-0.9823 +-0.2028,0.0000,0.0000,-0.9792 +-0.2028,0.0000,0.0000,-0.9792 +-0.2028,0.0000,0.0000,-0.9792 +-0.2028,0.0000,0.0000,-0.9792 +-0.2181,0.0000,0.0000,-0.9759 +-0.2181,0.0000,0.0000,-0.9759 +-0.2181,0.0000,0.0000,-0.9759 +-0.2181,0.0000,0.0000,-0.9759 +-0.2334,0.0000,0.0000,-0.9724 +-0.2334,0.0000,0.0000,-0.9724 +-0.2334,0.0000,0.0000,-0.9724 +-0.2334,0.0000,0.0000,-0.9724 +-0.2487,0.0000,0.0000,-0.9686 +-0.2487,0.0000,0.0000,-0.9686 +-0.2487,0.0000,0.0000,-0.9686 +-0.2487,0.0000,0.0000,-0.9686 +-0.2639,0.0000,0.0000,-0.9646 +-0.2639,0.0000,0.0000,-0.9646 +-0.2639,0.0000,0.0000,-0.9646 +-0.2639,0.0000,0.0000,-0.9646 +-0.2790,0.0000,0.0000,-0.9603 +-0.2790,0.0000,0.0000,-0.9603 +-0.2790,0.0000,0.0000,-0.9603 +-0.2790,0.0000,0.0000,-0.9603 +-0.2940,0.0000,0.0000,-0.9558 +-0.2940,0.0000,0.0000,-0.9558 +-0.2940,0.0000,0.0000,-0.9558 +-0.2940,0.0000,0.0000,-0.9558 +-0.3090,0.0000,0.0000,-0.9511 +-0.3090,0.0000,0.0000,-0.9511 +-0.3090,0.0000,0.0000,-0.9511 +-0.3090,0.0000,0.0000,-0.9511 +-0.3239,0.0000,0.0000,-0.9461 +-0.3239,0.0000,0.0000,-0.9461 +-0.3239,0.0000,0.0000,-0.9461 +-0.3239,0.0000,0.0000,-0.9461 +-0.3387,0.0000,0.0000,-0.9409 +-0.3387,0.0000,0.0000,-0.9409 +-0.3387,0.0000,0.0000,-0.9409 +-0.3387,0.0000,0.0000,-0.9409 +-0.3535,0.0000,0.0000,-0.9354 +-0.3535,0.0000,0.0000,-0.9354 +-0.3535,0.0000,0.0000,-0.9354 +-0.3535,0.0000,0.0000,-0.9354 +-0.3681,0.0000,0.0000,-0.9298 +-0.3681,0.0000,0.0000,-0.9298 +-0.3681,0.0000,0.0000,-0.9298 +-0.3681,0.0000,0.0000,-0.9298 +-0.3827,0.0000,0.0000,-0.9239 +-0.3827,0.0000,0.0000,-0.9239 +-0.3827,0.0000,0.0000,-0.9239 +-0.3827,0.0000,0.0000,-0.9239 +-0.3971,0.0000,0.0000,-0.9178 +-0.3971,0.0000,0.0000,-0.9178 +-0.3971,0.0000,0.0000,-0.9178 +-0.3971,0.0000,0.0000,-0.9178 +-0.4115,0.0000,0.0000,-0.9114 +-0.4115,0.0000,0.0000,-0.9114 +-0.4115,0.0000,0.0000,-0.9114 +-0.4115,0.0000,0.0000,-0.9114 +-0.4258,0.0000,0.0000,-0.9048 +-0.4258,0.0000,0.0000,-0.9048 +-0.4258,0.0000,0.0000,-0.9048 +-0.4258,0.0000,0.0000,-0.9048 +-0.4399,0.0000,0.0000,-0.8980 +-0.4399,0.0000,0.0000,-0.8980 +-0.4399,0.0000,0.0000,-0.8980 +-0.4399,0.0000,0.0000,-0.8980 +-0.4540,0.0000,0.0000,-0.8910 +-0.4540,0.0000,0.0000,-0.8910 +-0.4540,0.0000,0.0000,-0.8910 +-0.4540,0.0000,0.0000,-0.8910 +-0.4679,0.0000,0.0000,-0.8838 +-0.4679,0.0000,0.0000,-0.8838 +-0.4679,0.0000,0.0000,-0.8838 +-0.4679,0.0000,0.0000,-0.8838 +-0.4818,0.0000,0.0000,-0.8763 +-0.4818,0.0000,0.0000,-0.8763 +-0.4818,0.0000,0.0000,-0.8763 +-0.4818,0.0000,0.0000,-0.8763 +-0.4955,0.0000,0.0000,-0.8686 +-0.4955,0.0000,0.0000,-0.8686 +-0.4955,0.0000,0.0000,-0.8686 +-0.4955,0.0000,0.0000,-0.8686 +-0.5090,0.0000,0.0000,-0.8607 +-0.5090,0.0000,0.0000,-0.8607 +-0.5090,0.0000,0.0000,-0.8607 +-0.5090,0.0000,0.0000,-0.8607 +-0.5225,0.0000,0.0000,-0.8526 +-0.5225,0.0000,0.0000,-0.8526 +-0.5225,0.0000,0.0000,-0.8526 +-0.5225,0.0000,0.0000,-0.8526 +-0.5358,0.0000,0.0000,-0.8443 +-0.5358,0.0000,0.0000,-0.8443 +-0.5358,0.0000,0.0000,-0.8443 +-0.5358,0.0000,0.0000,-0.8443 +-0.5490,0.0000,0.0000,-0.8358 +-0.5490,0.0000,0.0000,-0.8358 +-0.5490,0.0000,0.0000,-0.8358 +-0.5490,0.0000,0.0000,-0.8358 +-0.5621,0.0000,0.0000,-0.8271 +-0.5621,0.0000,0.0000,-0.8271 +-0.5621,0.0000,0.0000,-0.8271 +-0.5621,0.0000,0.0000,-0.8271 +-0.5750,0.0000,0.0000,-0.8181 +-0.5750,0.0000,0.0000,-0.8181 +-0.5750,0.0000,0.0000,-0.8181 +-0.5750,0.0000,0.0000,-0.8181 +-0.5878,0.0000,0.0000,-0.8090 +-0.5878,0.0000,0.0000,-0.8090 +-0.5878,0.0000,0.0000,-0.8090 +-0.5878,0.0000,0.0000,-0.8090 +-0.6004,0.0000,0.0000,-0.7997 +-0.6004,0.0000,0.0000,-0.7997 +-0.6004,0.0000,0.0000,-0.7997 +-0.6004,0.0000,0.0000,-0.7997 +-0.6129,0.0000,0.0000,-0.7902 +-0.6129,0.0000,0.0000,-0.7902 +-0.6129,0.0000,0.0000,-0.7902 +-0.6129,0.0000,0.0000,-0.7902 +-0.6252,0.0000,0.0000,-0.7804 +-0.6252,0.0000,0.0000,-0.7804 +-0.6252,0.0000,0.0000,-0.7804 +-0.6252,0.0000,0.0000,-0.7804 +-0.6374,0.0000,0.0000,-0.7705 +-0.6374,0.0000,0.0000,-0.7705 +-0.6374,0.0000,0.0000,-0.7705 +-0.6374,0.0000,0.0000,-0.7705 +-0.6494,0.0000,0.0000,-0.7604 +-0.6494,0.0000,0.0000,-0.7604 +-0.6494,0.0000,0.0000,-0.7604 +-0.6494,0.0000,0.0000,-0.7604 +-0.6613,0.0000,0.0000,-0.7501 +-0.6613,0.0000,0.0000,-0.7501 +-0.6613,0.0000,0.0000,-0.7501 +-0.6613,0.0000,0.0000,-0.7501 +-0.6730,0.0000,0.0000,-0.7396 +-0.6730,0.0000,0.0000,-0.7396 +-0.6730,0.0000,0.0000,-0.7396 +-0.6730,0.0000,0.0000,-0.7396 +-0.6845,0.0000,0.0000,-0.7290 +-0.6845,0.0000,0.0000,-0.7290 +-0.6845,0.0000,0.0000,-0.7290 +-0.6845,0.0000,0.0000,-0.7290 +-0.6959,0.0000,0.0000,-0.7181 +-0.6959,0.0000,0.0000,-0.7181 +-0.6959,0.0000,0.0000,-0.7181 +-0.6959,0.0000,0.0000,-0.7181 +-0.7071,0.0000,0.0000,-0.7071 +-0.7071,0.0000,0.0000,-0.7071 +-0.7071,0.0000,0.0000,-0.7071 +-0.7071,0.0000,0.0000,-0.7071 +-0.7181,0.0000,0.0000,-0.6959 +-0.7181,0.0000,0.0000,-0.6959 +-0.7181,0.0000,0.0000,-0.6959 +-0.7181,0.0000,0.0000,-0.6959 +-0.7290,0.0000,0.0000,-0.6845 +-0.7290,0.0000,0.0000,-0.6845 +-0.7290,0.0000,0.0000,-0.6845 +-0.7290,0.0000,0.0000,-0.6845 +-0.7396,0.0000,0.0000,-0.6730 +-0.7396,0.0000,0.0000,-0.6730 +-0.7396,0.0000,0.0000,-0.6730 +-0.7396,0.0000,0.0000,-0.6730 +-0.7501,0.0000,0.0000,-0.6613 +-0.7501,0.0000,0.0000,-0.6613 +-0.7501,0.0000,0.0000,-0.6613 +-0.7501,0.0000,0.0000,-0.6613 +-0.7604,0.0000,0.0000,-0.6494 +-0.7604,0.0000,0.0000,-0.6494 +-0.7604,0.0000,0.0000,-0.6494 +-0.7604,0.0000,0.0000,-0.6494 +-0.7705,0.0000,0.0000,-0.6374 +-0.7705,0.0000,0.0000,-0.6374 +-0.7705,0.0000,0.0000,-0.6374 +-0.7705,0.0000,0.0000,-0.6374 +-0.7804,0.0000,0.0000,-0.6252 +-0.7804,0.0000,0.0000,-0.6252 +-0.7804,0.0000,0.0000,-0.6252 +-0.7804,0.0000,0.0000,-0.6252 +-0.7902,0.0000,0.0000,-0.6129 +-0.7902,0.0000,0.0000,-0.6129 +-0.7902,0.0000,0.0000,-0.6129 +-0.7902,0.0000,0.0000,-0.6129 +-0.7997,0.0000,0.0000,-0.6004 +-0.7997,0.0000,0.0000,-0.6004 +-0.7997,0.0000,0.0000,-0.6004 +-0.7997,0.0000,0.0000,-0.6004 +-0.8090,0.0000,0.0000,-0.5878 +-0.8090,0.0000,0.0000,-0.5878 +-0.8090,0.0000,0.0000,-0.5878 +-0.8090,0.0000,0.0000,-0.5878 +-0.8182,0.0000,0.0000,-0.5750 +-0.8182,0.0000,0.0000,-0.5750 +-0.8182,0.0000,0.0000,-0.5750 +-0.8182,0.0000,0.0000,-0.5750 +-0.8271,0.0000,0.0000,-0.5621 +-0.8271,0.0000,0.0000,-0.5621 +-0.8271,0.0000,0.0000,-0.5621 +-0.8271,0.0000,0.0000,-0.5621 +-0.8358,0.0000,0.0000,-0.5490 +-0.8358,0.0000,0.0000,-0.5490 +-0.8358,0.0000,0.0000,-0.5490 +-0.8358,0.0000,0.0000,-0.5490 +-0.8443,0.0000,0.0000,-0.5358 +-0.8443,0.0000,0.0000,-0.5358 +-0.8443,0.0000,0.0000,-0.5358 +-0.8443,0.0000,0.0000,-0.5358 +-0.8526,0.0000,0.0000,-0.5225 +-0.8526,0.0000,0.0000,-0.5225 +-0.8526,0.0000,0.0000,-0.5225 +-0.8526,0.0000,0.0000,-0.5225 +-0.8607,0.0000,0.0000,-0.5090 +-0.8607,0.0000,0.0000,-0.5090 +-0.8607,0.0000,0.0000,-0.5090 +-0.8607,0.0000,0.0000,-0.5090 +-0.8686,0.0000,0.0000,-0.4955 +-0.8686,0.0000,0.0000,-0.4955 +-0.8686,0.0000,0.0000,-0.4955 +-0.8686,0.0000,0.0000,-0.4955 +-0.8763,0.0000,0.0000,-0.4818 +-0.8763,0.0000,0.0000,-0.4818 +-0.8763,0.0000,0.0000,-0.4818 +-0.8763,0.0000,0.0000,-0.4818 +-0.8838,0.0000,0.0000,-0.4679 +-0.8838,0.0000,0.0000,-0.4679 +-0.8838,0.0000,0.0000,-0.4679 +-0.8838,0.0000,0.0000,-0.4679 +-0.8910,0.0000,0.0000,-0.4540 +-0.8910,0.0000,0.0000,-0.4540 +-0.8910,0.0000,0.0000,-0.4540 +-0.8910,0.0000,0.0000,-0.4540 +-0.8980,0.0000,0.0000,-0.4399 +-0.8980,0.0000,0.0000,-0.4399 +-0.8980,0.0000,0.0000,-0.4399 +-0.8980,0.0000,0.0000,-0.4399 +-0.9048,0.0000,0.0000,-0.4258 +-0.9048,0.0000,0.0000,-0.4258 +-0.9048,0.0000,0.0000,-0.4258 +-0.9048,0.0000,0.0000,-0.4258 +-0.9114,0.0000,0.0000,-0.4115 +-0.9114,0.0000,0.0000,-0.4115 +-0.9114,0.0000,0.0000,-0.4115 +-0.9114,0.0000,0.0000,-0.4115 +-0.9178,0.0000,0.0000,-0.3971 +-0.9178,0.0000,0.0000,-0.3971 +-0.9178,0.0000,0.0000,-0.3971 +-0.9178,0.0000,0.0000,-0.3971 +-0.9239,0.0000,0.0000,-0.3827 +-0.9239,0.0000,0.0000,-0.3827 +-0.9239,0.0000,0.0000,-0.3827 +-0.9239,0.0000,0.0000,-0.3827 +-0.9298,0.0000,0.0000,-0.3681 +-0.9298,0.0000,0.0000,-0.3681 +-0.9298,0.0000,0.0000,-0.3681 +-0.9298,0.0000,0.0000,-0.3681 +-0.9354,0.0000,0.0000,-0.3535 +-0.9354,0.0000,0.0000,-0.3535 +-0.9354,0.0000,0.0000,-0.3535 +-0.9354,0.0000,0.0000,-0.3535 +-0.9409,0.0000,0.0000,-0.3387 +-0.9409,0.0000,0.0000,-0.3387 +-0.9409,0.0000,0.0000,-0.3387 +-0.9409,0.0000,0.0000,-0.3387 +-0.9461,0.0000,0.0000,-0.3239 +-0.9461,0.0000,0.0000,-0.3239 +-0.9461,0.0000,0.0000,-0.3239 +-0.9461,0.0000,0.0000,-0.3239 +-0.9511,0.0000,0.0000,-0.3090 +-0.9511,0.0000,0.0000,-0.3090 +-0.9511,0.0000,0.0000,-0.3090 +-0.9511,0.0000,0.0000,-0.3090 +-0.9558,0.0000,0.0000,-0.2940 +-0.9558,0.0000,0.0000,-0.2940 +-0.9558,0.0000,0.0000,-0.2940 +-0.9558,0.0000,0.0000,-0.2940 +-0.9603,0.0000,0.0000,-0.2790 +-0.9603,0.0000,0.0000,-0.2790 +-0.9603,0.0000,0.0000,-0.2790 +-0.9603,0.0000,0.0000,-0.2790 +-0.9646,0.0000,0.0000,-0.2639 +-0.9646,0.0000,0.0000,-0.2639 +-0.9646,0.0000,0.0000,-0.2639 +-0.9646,0.0000,0.0000,-0.2639 +-0.9686,0.0000,0.0000,-0.2487 +-0.9686,0.0000,0.0000,-0.2487 +-0.9686,0.0000,0.0000,-0.2487 +-0.9686,0.0000,0.0000,-0.2487 +-0.9724,0.0000,0.0000,-0.2334 +-0.9724,0.0000,0.0000,-0.2334 +-0.9724,0.0000,0.0000,-0.2334 +-0.9724,0.0000,0.0000,-0.2334 +-0.9759,0.0000,0.0000,-0.2181 +-0.9759,0.0000,0.0000,-0.2181 +-0.9759,0.0000,0.0000,-0.2181 +-0.9759,0.0000,0.0000,-0.2181 +-0.9792,0.0000,0.0000,-0.2028 +-0.9792,0.0000,0.0000,-0.2028 +-0.9792,0.0000,0.0000,-0.2028 +-0.9792,0.0000,0.0000,-0.2028 +-0.9823,0.0000,0.0000,-0.1874 +-0.9823,0.0000,0.0000,-0.1874 +-0.9823,0.0000,0.0000,-0.1874 +-0.9823,0.0000,0.0000,-0.1874 +-0.9851,0.0000,0.0000,-0.1719 +-0.9851,0.0000,0.0000,-0.1719 +-0.9851,0.0000,0.0000,-0.1719 +-0.9851,0.0000,0.0000,-0.1719 +-0.9877,0.0000,0.0000,-0.1564 +-0.9877,0.0000,0.0000,-0.1564 +-0.9877,0.0000,0.0000,-0.1564 +-0.9877,0.0000,0.0000,-0.1564 +-0.9900,0.0000,0.0000,-0.1409 +-0.9900,0.0000,0.0000,-0.1409 +-0.9900,0.0000,0.0000,-0.1409 +-0.9900,0.0000,0.0000,-0.1409 +-0.9921,0.0000,0.0000,-0.1253 +-0.9921,0.0000,0.0000,-0.1253 +-0.9921,0.0000,0.0000,-0.1253 +-0.9921,0.0000,0.0000,-0.1253 +-0.9940,0.0000,0.0000,-0.1097 +-0.9940,0.0000,0.0000,-0.1097 +-0.9940,0.0000,0.0000,-0.1097 +-0.9940,0.0000,0.0000,-0.1097 +-0.9956,0.0000,0.0000,-0.0941 +-0.9956,0.0000,0.0000,-0.0941 +-0.9956,0.0000,0.0000,-0.0941 +-0.9956,0.0000,0.0000,-0.0941 +-0.9969,0.0000,0.0000,-0.0785 +-0.9969,0.0000,0.0000,-0.0785 +-0.9969,0.0000,0.0000,-0.0785 +-0.9969,0.0000,0.0000,-0.0785 +-0.9980,0.0000,0.0000,-0.0628 +-0.9980,0.0000,0.0000,-0.0628 +-0.9980,0.0000,0.0000,-0.0628 +-0.9980,0.0000,0.0000,-0.0628 +-0.9989,0.0000,0.0000,-0.0471 +-0.9989,0.0000,0.0000,-0.0471 +-0.9989,0.0000,0.0000,-0.0471 +-0.9989,0.0000,0.0000,-0.0471 +-0.9995,0.0000,0.0000,-0.0314 +-0.9995,0.0000,0.0000,-0.0314 +-0.9995,0.0000,0.0000,-0.0314 +-0.9995,0.0000,0.0000,-0.0314 +-0.9999,0.0000,0.0000,-0.0157 +-0.9999,0.0000,0.0000,-0.0157 +-0.9999,0.0000,0.0000,-0.0157 +-0.9999,0.0000,0.0000,-0.0157 +1.0000,0.0000,0.0000,-0.0000 +1.0000,0.0000,0.0000,-0.0000 +1.0000,0.0000,0.0000,-0.0000 +1.0000,0.0000,0.0000,-0.0000 diff --git a/scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv b/scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv new file mode 100644 index 0000000000..8fe2d2fe05 --- /dev/null +++ b/scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv @@ -0,0 +1,200 @@ +0.0000,0.0000,0.0000,0.7012,-0.0220,-0.7126 +0.0000,0.0000,0.0000,0.7057,-0.0444,-0.7071 +0.0000,0.0000,0.0000,0.7095,-0.0671,-0.7015 +0.0000,0.0000,0.0000,0.7125,-0.0900,-0.6959 +0.0000,0.0000,0.0000,0.7147,-0.1132,-0.6903 +0.0000,0.0000,0.0000,0.7161,-0.1366,-0.6845 +0.0000,0.0000,0.0000,0.7166,-0.1602,-0.6788 +0.0000,0.0000,0.0000,0.7164,-0.1839,-0.6730 +0.0000,0.0000,0.0000,0.7153,-0.2078,-0.6672 +0.0000,0.0000,0.0000,0.7134,-0.2318,-0.6613 +0.0000,0.0000,0.0000,0.7106,-0.2558,-0.6554 +0.0000,0.0000,0.0000,0.7070,-0.2799,-0.6494 +0.0000,0.0000,0.0000,0.7025,-0.3040,-0.6435 +0.0000,0.0000,0.0000,0.6972,-0.3281,-0.6374 +0.0000,0.0000,0.0000,0.6910,-0.3521,-0.6314 +0.0000,0.0000,0.0000,0.6839,-0.3760,-0.6252 +0.0000,0.0000,0.0000,0.6760,-0.3998,-0.6191 +0.0000,0.0000,0.0000,0.6671,-0.4234,-0.6129 +0.0000,0.0000,0.0000,0.6575,-0.4468,-0.6067 +0.0000,0.0000,0.0000,0.6470,-0.4700,-0.6004 +0.0000,0.0000,0.0000,0.6356,-0.4930,-0.5941 +0.0000,0.0000,0.0000,0.6234,-0.5157,-0.5878 +0.0000,0.0000,0.0000,0.6103,-0.5380,-0.5814 +0.0000,0.0000,0.0000,0.5964,-0.5601,-0.5750 +0.0000,0.0000,0.0000,0.5817,-0.5817,-0.5686 +0.0000,0.0000,0.0000,0.5662,-0.6029,-0.5621 +0.0000,0.0000,0.0000,0.5499,-0.6237,-0.5556 +0.0000,0.0000,0.0000,0.5328,-0.6440,-0.5490 +0.0000,0.0000,0.0000,0.5149,-0.6638,-0.5424 +0.0000,0.0000,0.0000,0.4963,-0.6831,-0.5358 +0.0000,0.0000,0.0000,0.4769,-0.7018,-0.5292 +0.0000,0.0000,0.0000,0.4569,-0.7199,-0.5225 +0.0000,0.0000,0.0000,0.4361,-0.7374,-0.5158 +0.0000,0.0000,0.0000,0.4147,-0.7543,-0.5090 +0.0000,0.0000,0.0000,0.3926,-0.7705,-0.5023 +0.0000,0.0000,0.0000,0.3698,-0.7860,-0.4955 +0.0000,0.0000,0.0000,0.3465,-0.8007,-0.4886 +0.0000,0.0000,0.0000,0.3226,-0.8148,-0.4818 +0.0000,0.0000,0.0000,0.2981,-0.8280,-0.4749 +0.0000,0.0000,0.0000,0.2731,-0.8405,-0.4679 +0.0000,0.0000,0.0000,0.2476,-0.8522,-0.4610 +0.0000,0.0000,0.0000,0.2216,-0.8630,-0.4540 +0.0000,0.0000,0.0000,0.1951,-0.8730,-0.4470 +0.0000,0.0000,0.0000,0.1683,-0.8821,-0.4399 +0.0000,0.0000,0.0000,0.1410,-0.8904,-0.4329 +0.0000,0.0000,0.0000,0.1134,-0.8977,-0.4258 +0.0000,0.0000,0.0000,0.0855,-0.9041,-0.4187 +0.0000,0.0000,0.0000,0.0572,-0.9096,-0.4115 +0.0000,0.0000,0.0000,0.0287,-0.9142,-0.4043 +0.0000,0.0000,0.0000,-0.0000,-0.9178,-0.3971 +0.0000,0.0000,0.0000,-0.0289,-0.9204,-0.3899 +0.0000,0.0000,0.0000,-0.0580,-0.9221,-0.3827 +0.0000,0.0000,0.0000,-0.0872,-0.9227,-0.3754 +0.0000,0.0000,0.0000,-0.1165,-0.9224,-0.3681 +0.0000,0.0000,0.0000,-0.1459,-0.9212,-0.3608 +0.0000,0.0000,0.0000,-0.1753,-0.9189,-0.3535 +0.0000,0.0000,0.0000,-0.2047,-0.9156,-0.3461 +0.0000,0.0000,0.0000,-0.2340,-0.9113,-0.3387 +0.0000,0.0000,0.0000,-0.2632,-0.9060,-0.3313 +0.0000,0.0000,0.0000,-0.2924,-0.8998,-0.3239 +0.0000,0.0000,0.0000,-0.3213,-0.8925,-0.3165 +0.0000,0.0000,0.0000,-0.3501,-0.8843,-0.3090 +0.0000,0.0000,0.0000,-0.3787,-0.8750,-0.3015 +0.0000,0.0000,0.0000,-0.4070,-0.8648,-0.2940 +0.0000,0.0000,0.0000,-0.4350,-0.8536,-0.2865 +0.0000,0.0000,0.0000,-0.4626,-0.8415,-0.2790 +0.0000,0.0000,0.0000,-0.4899,-0.8284,-0.2714 +0.0000,0.0000,0.0000,-0.5168,-0.8144,-0.2639 +0.0000,0.0000,0.0000,-0.5433,-0.7995,-0.2563 +0.0000,0.0000,0.0000,-0.5693,-0.7836,-0.2487 +0.0000,0.0000,0.0000,-0.5948,-0.7669,-0.2411 +0.0000,0.0000,0.0000,-0.6198,-0.7492,-0.2334 +0.0000,0.0000,0.0000,-0.6442,-0.7307,-0.2258 +0.0000,0.0000,0.0000,-0.6681,-0.7114,-0.2181 +0.0000,0.0000,0.0000,-0.6913,-0.6913,-0.2105 +0.0000,0.0000,0.0000,-0.7138,-0.6703,-0.2028 +0.0000,0.0000,0.0000,-0.7357,-0.6486,-0.1951 +0.0000,0.0000,0.0000,-0.7569,-0.6261,-0.1874 +0.0000,0.0000,0.0000,-0.7773,-0.6029,-0.1797 +0.0000,0.0000,0.0000,-0.7970,-0.5790,-0.1719 +0.0000,0.0000,0.0000,-0.8159,-0.5545,-0.1642 +0.0000,0.0000,0.0000,-0.8339,-0.5292,-0.1564 +0.0000,0.0000,0.0000,-0.8512,-0.5034,-0.1487 +0.0000,0.0000,0.0000,-0.8676,-0.4769,-0.1409 +0.0000,0.0000,0.0000,-0.8831,-0.4499,-0.1331 +0.0000,0.0000,0.0000,-0.8977,-0.4224,-0.1253 +0.0000,0.0000,0.0000,-0.9114,-0.3944,-0.1175 +0.0000,0.0000,0.0000,-0.9242,-0.3659,-0.1097 +0.0000,0.0000,0.0000,-0.9360,-0.3370,-0.1019 +0.0000,0.0000,0.0000,-0.9468,-0.3076,-0.0941 +0.0000,0.0000,0.0000,-0.9567,-0.2779,-0.0863 +0.0000,0.0000,0.0000,-0.9656,-0.2479,-0.0785 +0.0000,0.0000,0.0000,-0.9735,-0.2176,-0.0706 +0.0000,0.0000,0.0000,-0.9803,-0.1870,-0.0628 +0.0000,0.0000,0.0000,-0.9862,-0.1562,-0.0549 +0.0000,0.0000,0.0000,-0.9910,-0.1252,-0.0471 +0.0000,0.0000,0.0000,-0.9948,-0.0940,-0.0393 +0.0000,0.0000,0.0000,-0.9975,-0.0628,-0.0314 +0.0000,0.0000,0.0000,-0.9992,-0.0314,-0.0236 +0.0000,0.0000,0.0000,-0.9999,0.0000,-0.0157 +0.0000,0.0000,0.0000,-0.9995,0.0314,-0.0079 +0.0000,0.0000,0.0000,-0.9980,0.0628,0.0000 +0.0000,0.0000,0.0000,-0.9955,0.0941,0.0079 +0.0000,0.0000,0.0000,-0.9920,0.1253,0.0157 +0.0000,0.0000,0.0000,-0.9874,0.1564,0.0236 +0.0000,0.0000,0.0000,-0.9818,0.1873,0.0314 +0.0000,0.0000,0.0000,-0.9752,0.2180,0.0393 +0.0000,0.0000,0.0000,-0.9675,0.2484,0.0471 +0.0000,0.0000,0.0000,-0.9588,0.2786,0.0550 +0.0000,0.0000,0.0000,-0.9492,0.3084,0.0628 +0.0000,0.0000,0.0000,-0.9385,0.3379,0.0706 +0.0000,0.0000,0.0000,-0.9269,0.3670,0.0785 +0.0000,0.0000,0.0000,-0.9143,0.3957,0.0863 +0.0000,0.0000,0.0000,-0.9008,0.4239,0.0941 +0.0000,0.0000,0.0000,-0.8864,0.4516,0.1019 +0.0000,0.0000,0.0000,-0.8710,0.4788,0.1097 +0.0000,0.0000,0.0000,-0.8548,0.5055,0.1175 +0.0000,0.0000,0.0000,-0.8377,0.5316,0.1253 +0.0000,0.0000,0.0000,-0.8197,0.5571,0.1331 +0.0000,0.0000,0.0000,-0.8009,0.5819,0.1409 +0.0000,0.0000,0.0000,-0.7814,0.6061,0.1487 +0.0000,0.0000,0.0000,-0.7610,0.6296,0.1564 +0.0000,0.0000,0.0000,-0.7399,0.6523,0.1642 +0.0000,0.0000,0.0000,-0.7181,0.6744,0.1719 +0.0000,0.0000,0.0000,-0.6956,0.6956,0.1797 +0.0000,0.0000,0.0000,-0.6724,0.7161,0.1874 +0.0000,0.0000,0.0000,-0.6486,0.7357,0.1951 +0.0000,0.0000,0.0000,-0.6242,0.7545,0.2028 +0.0000,0.0000,0.0000,-0.5992,0.7725,0.2105 +0.0000,0.0000,0.0000,-0.5736,0.7895,0.2181 +0.0000,0.0000,0.0000,-0.5476,0.8057,0.2258 +0.0000,0.0000,0.0000,-0.5210,0.8210,0.2334 +0.0000,0.0000,0.0000,-0.4940,0.8354,0.2411 +0.0000,0.0000,0.0000,-0.4666,0.8488,0.2487 +0.0000,0.0000,0.0000,-0.4388,0.8612,0.2563 +0.0000,0.0000,0.0000,-0.4107,0.8728,0.2639 +0.0000,0.0000,0.0000,-0.3822,0.8833,0.2714 +0.0000,0.0000,0.0000,-0.3535,0.8929,0.2790 +0.0000,0.0000,0.0000,-0.3245,0.9014,0.2865 +0.0000,0.0000,0.0000,-0.2954,0.9090,0.2940 +0.0000,0.0000,0.0000,-0.2660,0.9156,0.3015 +0.0000,0.0000,0.0000,-0.2365,0.9212,0.3090 +0.0000,0.0000,0.0000,-0.2069,0.9258,0.3165 +0.0000,0.0000,0.0000,-0.1773,0.9293,0.3239 +0.0000,0.0000,0.0000,-0.1476,0.9319,0.3313 +0.0000,0.0000,0.0000,-0.1179,0.9335,0.3387 +0.0000,0.0000,0.0000,-0.0883,0.9340,0.3461 +0.0000,0.0000,0.0000,-0.0587,0.9336,0.3535 +0.0000,0.0000,0.0000,-0.0293,0.9322,0.3608 +0.0000,0.0000,0.0000,0.0000,0.9298,0.3681 +0.0000,0.0000,0.0000,0.0291,0.9264,0.3754 +0.0000,0.0000,0.0000,0.0580,0.9221,0.3827 +0.0000,0.0000,0.0000,0.0867,0.9168,0.3899 +0.0000,0.0000,0.0000,0.1150,0.9105,0.3971 +0.0000,0.0000,0.0000,0.1431,0.9033,0.4043 +0.0000,0.0000,0.0000,0.1708,0.8953,0.4115 +0.0000,0.0000,0.0000,0.1981,0.8863,0.4187 +0.0000,0.0000,0.0000,0.2250,0.8764,0.4258 +0.0000,0.0000,0.0000,0.2515,0.8657,0.4329 +0.0000,0.0000,0.0000,0.2775,0.8541,0.4399 +0.0000,0.0000,0.0000,0.3030,0.8417,0.4470 +0.0000,0.0000,0.0000,0.3280,0.8284,0.4540 +0.0000,0.0000,0.0000,0.3524,0.8144,0.4610 +0.0000,0.0000,0.0000,0.3763,0.7997,0.4679 +0.0000,0.0000,0.0000,0.3995,0.7841,0.4749 +0.0000,0.0000,0.0000,0.4222,0.7679,0.4818 +0.0000,0.0000,0.0000,0.4441,0.7510,0.4886 +0.0000,0.0000,0.0000,0.4654,0.7334,0.4955 +0.0000,0.0000,0.0000,0.4860,0.7152,0.5023 +0.0000,0.0000,0.0000,0.5059,0.6964,0.5090 +0.0000,0.0000,0.0000,0.5251,0.6769,0.5158 +0.0000,0.0000,0.0000,0.5435,0.6570,0.5225 +0.0000,0.0000,0.0000,0.5611,0.6365,0.5292 +0.0000,0.0000,0.0000,0.5780,0.6155,0.5358 +0.0000,0.0000,0.0000,0.5940,0.5940,0.5424 +0.0000,0.0000,0.0000,0.6093,0.5721,0.5490 +0.0000,0.0000,0.0000,0.6237,0.5499,0.5556 +0.0000,0.0000,0.0000,0.6373,0.5272,0.5621 +0.0000,0.0000,0.0000,0.6500,0.5042,0.5686 +0.0000,0.0000,0.0000,0.6619,0.4809,0.5750 +0.0000,0.0000,0.0000,0.6729,0.4573,0.5814 +0.0000,0.0000,0.0000,0.6831,0.4335,0.5878 +0.0000,0.0000,0.0000,0.6924,0.4095,0.5941 +0.0000,0.0000,0.0000,0.7008,0.3852,0.6004 +0.0000,0.0000,0.0000,0.7083,0.3609,0.6067 +0.0000,0.0000,0.0000,0.7150,0.3364,0.6129 +0.0000,0.0000,0.0000,0.7207,0.3119,0.6191 +0.0000,0.0000,0.0000,0.7256,0.2873,0.6252 +0.0000,0.0000,0.0000,0.7296,0.2627,0.6314 +0.0000,0.0000,0.0000,0.7328,0.2381,0.6374 +0.0000,0.0000,0.0000,0.7351,0.2136,0.6435 +0.0000,0.0000,0.0000,0.7365,0.1891,0.6494 +0.0000,0.0000,0.0000,0.7371,0.1648,0.6554 +0.0000,0.0000,0.0000,0.7368,0.1406,0.6613 +0.0000,0.0000,0.0000,0.7357,0.1165,0.6672 +0.0000,0.0000,0.0000,0.7338,0.0927,0.6730 +0.0000,0.0000,0.0000,0.7311,0.0691,0.6788 +0.0000,0.0000,0.0000,0.7275,0.0458,0.6845 +0.0000,0.0000,0.0000,0.7232,0.0227,0.6903 +0.0000,0.0000,0.0000,0.7181,-0.0000,0.6959 diff --git a/scripts/trajectories/full-circle-with-up-and-down-4s-ccw-Vector3.csv b/scripts/trajectories/full-circle-with-up-and-down-4s-ccw-Vector3.csv new file mode 100644 index 0000000000..6310889020 --- /dev/null +++ b/scripts/trajectories/full-circle-with-up-and-down-4s-ccw-Vector3.csv @@ -0,0 +1,200 @@ +0.0000,0.0000,0.0000,0.7012,0.0220,0.7126 +0.0000,0.0000,0.0000,0.7057,0.0444,0.7071 +0.0000,0.0000,0.0000,0.7095,0.0671,0.7015 +0.0000,0.0000,0.0000,0.7125,0.0900,0.6959 +0.0000,0.0000,0.0000,0.7147,0.1132,0.6903 +0.0000,0.0000,0.0000,0.7161,0.1366,0.6845 +0.0000,0.0000,0.0000,0.7166,0.1602,0.6788 +0.0000,0.0000,0.0000,0.7164,0.1839,0.6730 +0.0000,0.0000,0.0000,0.7153,0.2078,0.6672 +0.0000,0.0000,0.0000,0.7134,0.2318,0.6613 +0.0000,0.0000,0.0000,0.7106,0.2558,0.6554 +0.0000,0.0000,0.0000,0.7070,0.2799,0.6494 +0.0000,0.0000,0.0000,0.7025,0.3040,0.6435 +0.0000,0.0000,0.0000,0.6972,0.3281,0.6374 +0.0000,0.0000,0.0000,0.6910,0.3521,0.6314 +0.0000,0.0000,0.0000,0.6839,0.3760,0.6252 +0.0000,0.0000,0.0000,0.6760,0.3998,0.6191 +0.0000,0.0000,0.0000,0.6671,0.4234,0.6129 +0.0000,0.0000,0.0000,0.6575,0.4468,0.6067 +0.0000,0.0000,0.0000,0.6470,0.4700,0.6004 +0.0000,0.0000,0.0000,0.6356,0.4930,0.5941 +0.0000,0.0000,0.0000,0.6234,0.5157,0.5878 +0.0000,0.0000,0.0000,0.6103,0.5380,0.5814 +0.0000,0.0000,0.0000,0.5964,0.5601,0.5750 +0.0000,0.0000,0.0000,0.5817,0.5817,0.5686 +0.0000,0.0000,0.0000,0.5662,0.6029,0.5621 +0.0000,0.0000,0.0000,0.5499,0.6237,0.5556 +0.0000,0.0000,0.0000,0.5328,0.6440,0.5490 +0.0000,0.0000,0.0000,0.5149,0.6638,0.5424 +0.0000,0.0000,0.0000,0.4963,0.6831,0.5358 +0.0000,0.0000,0.0000,0.4769,0.7018,0.5292 +0.0000,0.0000,0.0000,0.4569,0.7199,0.5225 +0.0000,0.0000,0.0000,0.4361,0.7374,0.5158 +0.0000,0.0000,0.0000,0.4147,0.7543,0.5090 +0.0000,0.0000,0.0000,0.3926,0.7705,0.5023 +0.0000,0.0000,0.0000,0.3698,0.7860,0.4955 +0.0000,0.0000,0.0000,0.3465,0.8007,0.4886 +0.0000,0.0000,0.0000,0.3226,0.8148,0.4818 +0.0000,0.0000,0.0000,0.2981,0.8280,0.4749 +0.0000,0.0000,0.0000,0.2731,0.8405,0.4679 +0.0000,0.0000,0.0000,0.2476,0.8522,0.4610 +0.0000,0.0000,0.0000,0.2216,0.8630,0.4540 +0.0000,0.0000,0.0000,0.1951,0.8730,0.4470 +0.0000,0.0000,0.0000,0.1683,0.8821,0.4399 +0.0000,0.0000,0.0000,0.1410,0.8904,0.4329 +0.0000,0.0000,0.0000,0.1134,0.8977,0.4258 +0.0000,0.0000,0.0000,0.0855,0.9041,0.4187 +0.0000,0.0000,0.0000,0.0572,0.9096,0.4115 +0.0000,0.0000,0.0000,0.0287,0.9142,0.4043 +0.0000,0.0000,0.0000,-0.0000,0.9178,0.3971 +0.0000,0.0000,0.0000,-0.0289,0.9204,0.3899 +0.0000,0.0000,0.0000,-0.0580,0.9221,0.3827 +0.0000,0.0000,0.0000,-0.0872,0.9227,0.3754 +0.0000,0.0000,0.0000,-0.1165,0.9224,0.3681 +0.0000,0.0000,0.0000,-0.1459,0.9212,0.3608 +0.0000,0.0000,0.0000,-0.1753,0.9189,0.3535 +0.0000,0.0000,0.0000,-0.2047,0.9156,0.3461 +0.0000,0.0000,0.0000,-0.2340,0.9113,0.3387 +0.0000,0.0000,0.0000,-0.2632,0.9060,0.3313 +0.0000,0.0000,0.0000,-0.2924,0.8998,0.3239 +0.0000,0.0000,0.0000,-0.3213,0.8925,0.3165 +0.0000,0.0000,0.0000,-0.3501,0.8843,0.3090 +0.0000,0.0000,0.0000,-0.3787,0.8750,0.3015 +0.0000,0.0000,0.0000,-0.4070,0.8648,0.2940 +0.0000,0.0000,0.0000,-0.4350,0.8536,0.2865 +0.0000,0.0000,0.0000,-0.4626,0.8415,0.2790 +0.0000,0.0000,0.0000,-0.4899,0.8284,0.2714 +0.0000,0.0000,0.0000,-0.5168,0.8144,0.2639 +0.0000,0.0000,0.0000,-0.5433,0.7995,0.2563 +0.0000,0.0000,0.0000,-0.5693,0.7836,0.2487 +0.0000,0.0000,0.0000,-0.5948,0.7669,0.2411 +0.0000,0.0000,0.0000,-0.6198,0.7492,0.2334 +0.0000,0.0000,0.0000,-0.6442,0.7307,0.2258 +0.0000,0.0000,0.0000,-0.6681,0.7114,0.2181 +0.0000,0.0000,0.0000,-0.6913,0.6913,0.2105 +0.0000,0.0000,0.0000,-0.7138,0.6703,0.2028 +0.0000,0.0000,0.0000,-0.7357,0.6486,0.1951 +0.0000,0.0000,0.0000,-0.7569,0.6261,0.1874 +0.0000,0.0000,0.0000,-0.7773,0.6029,0.1797 +0.0000,0.0000,0.0000,-0.7970,0.5790,0.1719 +0.0000,0.0000,0.0000,-0.8159,0.5545,0.1642 +0.0000,0.0000,0.0000,-0.8339,0.5292,0.1564 +0.0000,0.0000,0.0000,-0.8512,0.5034,0.1487 +0.0000,0.0000,0.0000,-0.8676,0.4769,0.1409 +0.0000,0.0000,0.0000,-0.8831,0.4499,0.1331 +0.0000,0.0000,0.0000,-0.8977,0.4224,0.1253 +0.0000,0.0000,0.0000,-0.9114,0.3944,0.1175 +0.0000,0.0000,0.0000,-0.9242,0.3659,0.1097 +0.0000,0.0000,0.0000,-0.9360,0.3370,0.1019 +0.0000,0.0000,0.0000,-0.9468,0.3076,0.0941 +0.0000,0.0000,0.0000,-0.9567,0.2779,0.0863 +0.0000,0.0000,0.0000,-0.9656,0.2479,0.0785 +0.0000,0.0000,0.0000,-0.9735,0.2176,0.0706 +0.0000,0.0000,0.0000,-0.9803,0.1870,0.0628 +0.0000,0.0000,0.0000,-0.9862,0.1562,0.0549 +0.0000,0.0000,0.0000,-0.9910,0.1252,0.0471 +0.0000,0.0000,0.0000,-0.9948,0.0940,0.0393 +0.0000,0.0000,0.0000,-0.9975,0.0628,0.0314 +0.0000,0.0000,0.0000,-0.9992,0.0314,0.0236 +0.0000,0.0000,0.0000,-0.9999,-0.0000,0.0157 +0.0000,0.0000,0.0000,-0.9995,-0.0314,0.0079 +0.0000,0.0000,0.0000,-0.9980,-0.0628,-0.0000 +0.0000,0.0000,0.0000,-0.9955,-0.0941,-0.0079 +0.0000,0.0000,0.0000,-0.9920,-0.1253,-0.0157 +0.0000,0.0000,0.0000,-0.9874,-0.1564,-0.0236 +0.0000,0.0000,0.0000,-0.9818,-0.1873,-0.0314 +0.0000,0.0000,0.0000,-0.9752,-0.2180,-0.0393 +0.0000,0.0000,0.0000,-0.9675,-0.2484,-0.0471 +0.0000,0.0000,0.0000,-0.9588,-0.2786,-0.0550 +0.0000,0.0000,0.0000,-0.9492,-0.3084,-0.0628 +0.0000,0.0000,0.0000,-0.9385,-0.3379,-0.0706 +0.0000,0.0000,0.0000,-0.9269,-0.3670,-0.0785 +0.0000,0.0000,0.0000,-0.9143,-0.3957,-0.0863 +0.0000,0.0000,0.0000,-0.9008,-0.4239,-0.0941 +0.0000,0.0000,0.0000,-0.8864,-0.4516,-0.1019 +0.0000,0.0000,0.0000,-0.8710,-0.4788,-0.1097 +0.0000,0.0000,0.0000,-0.8548,-0.5055,-0.1175 +0.0000,0.0000,0.0000,-0.8377,-0.5316,-0.1253 +0.0000,0.0000,0.0000,-0.8197,-0.5571,-0.1331 +0.0000,0.0000,0.0000,-0.8009,-0.5819,-0.1409 +0.0000,0.0000,0.0000,-0.7814,-0.6061,-0.1487 +0.0000,0.0000,0.0000,-0.7610,-0.6296,-0.1564 +0.0000,0.0000,0.0000,-0.7399,-0.6523,-0.1642 +0.0000,0.0000,0.0000,-0.7181,-0.6744,-0.1719 +0.0000,0.0000,0.0000,-0.6956,-0.6956,-0.1797 +0.0000,0.0000,0.0000,-0.6724,-0.7161,-0.1874 +0.0000,0.0000,0.0000,-0.6486,-0.7357,-0.1951 +0.0000,0.0000,0.0000,-0.6242,-0.7545,-0.2028 +0.0000,0.0000,0.0000,-0.5992,-0.7725,-0.2105 +0.0000,0.0000,0.0000,-0.5736,-0.7895,-0.2181 +0.0000,0.0000,0.0000,-0.5476,-0.8057,-0.2258 +0.0000,0.0000,0.0000,-0.5210,-0.8210,-0.2334 +0.0000,0.0000,0.0000,-0.4940,-0.8354,-0.2411 +0.0000,0.0000,0.0000,-0.4666,-0.8488,-0.2487 +0.0000,0.0000,0.0000,-0.4388,-0.8612,-0.2563 +0.0000,0.0000,0.0000,-0.4107,-0.8728,-0.2639 +0.0000,0.0000,0.0000,-0.3822,-0.8833,-0.2714 +0.0000,0.0000,0.0000,-0.3535,-0.8929,-0.2790 +0.0000,0.0000,0.0000,-0.3245,-0.9014,-0.2865 +0.0000,0.0000,0.0000,-0.2954,-0.9090,-0.2940 +0.0000,0.0000,0.0000,-0.2660,-0.9156,-0.3015 +0.0000,0.0000,0.0000,-0.2365,-0.9212,-0.3090 +0.0000,0.0000,0.0000,-0.2069,-0.9258,-0.3165 +0.0000,0.0000,0.0000,-0.1773,-0.9293,-0.3239 +0.0000,0.0000,0.0000,-0.1476,-0.9319,-0.3313 +0.0000,0.0000,0.0000,-0.1179,-0.9335,-0.3387 +0.0000,0.0000,0.0000,-0.0883,-0.9340,-0.3461 +0.0000,0.0000,0.0000,-0.0587,-0.9336,-0.3535 +0.0000,0.0000,0.0000,-0.0293,-0.9322,-0.3608 +0.0000,0.0000,0.0000,0.0000,-0.9298,-0.3681 +0.0000,0.0000,0.0000,0.0291,-0.9264,-0.3754 +0.0000,0.0000,0.0000,0.0580,-0.9221,-0.3827 +0.0000,0.0000,0.0000,0.0867,-0.9168,-0.3899 +0.0000,0.0000,0.0000,0.1150,-0.9105,-0.3971 +0.0000,0.0000,0.0000,0.1431,-0.9033,-0.4043 +0.0000,0.0000,0.0000,0.1708,-0.8953,-0.4115 +0.0000,0.0000,0.0000,0.1981,-0.8863,-0.4187 +0.0000,0.0000,0.0000,0.2250,-0.8764,-0.4258 +0.0000,0.0000,0.0000,0.2515,-0.8657,-0.4329 +0.0000,0.0000,0.0000,0.2775,-0.8541,-0.4399 +0.0000,0.0000,0.0000,0.3030,-0.8417,-0.4470 +0.0000,0.0000,0.0000,0.3280,-0.8284,-0.4540 +0.0000,0.0000,0.0000,0.3524,-0.8144,-0.4610 +0.0000,0.0000,0.0000,0.3763,-0.7997,-0.4679 +0.0000,0.0000,0.0000,0.3995,-0.7841,-0.4749 +0.0000,0.0000,0.0000,0.4222,-0.7679,-0.4818 +0.0000,0.0000,0.0000,0.4441,-0.7510,-0.4886 +0.0000,0.0000,0.0000,0.4654,-0.7334,-0.4955 +0.0000,0.0000,0.0000,0.4860,-0.7152,-0.5023 +0.0000,0.0000,0.0000,0.5059,-0.6964,-0.5090 +0.0000,0.0000,0.0000,0.5251,-0.6769,-0.5158 +0.0000,0.0000,0.0000,0.5435,-0.6570,-0.5225 +0.0000,0.0000,0.0000,0.5611,-0.6365,-0.5292 +0.0000,0.0000,0.0000,0.5780,-0.6155,-0.5358 +0.0000,0.0000,0.0000,0.5940,-0.5940,-0.5424 +0.0000,0.0000,0.0000,0.6093,-0.5721,-0.5490 +0.0000,0.0000,0.0000,0.6237,-0.5499,-0.5556 +0.0000,0.0000,0.0000,0.6373,-0.5272,-0.5621 +0.0000,0.0000,0.0000,0.6500,-0.5042,-0.5686 +0.0000,0.0000,0.0000,0.6619,-0.4809,-0.5750 +0.0000,0.0000,0.0000,0.6729,-0.4573,-0.5814 +0.0000,0.0000,0.0000,0.6831,-0.4335,-0.5878 +0.0000,0.0000,0.0000,0.6924,-0.4095,-0.5941 +0.0000,0.0000,0.0000,0.7008,-0.3852,-0.6004 +0.0000,0.0000,0.0000,0.7083,-0.3609,-0.6067 +0.0000,0.0000,0.0000,0.7150,-0.3364,-0.6129 +0.0000,0.0000,0.0000,0.7207,-0.3119,-0.6191 +0.0000,0.0000,0.0000,0.7256,-0.2873,-0.6252 +0.0000,0.0000,0.0000,0.7296,-0.2627,-0.6314 +0.0000,0.0000,0.0000,0.7328,-0.2381,-0.6374 +0.0000,0.0000,0.0000,0.7351,-0.2136,-0.6435 +0.0000,0.0000,0.0000,0.7365,-0.1891,-0.6494 +0.0000,0.0000,0.0000,0.7371,-0.1648,-0.6554 +0.0000,0.0000,0.0000,0.7368,-0.1406,-0.6613 +0.0000,0.0000,0.0000,0.7357,-0.1165,-0.6672 +0.0000,0.0000,0.0000,0.7338,-0.0927,-0.6730 +0.0000,0.0000,0.0000,0.7311,-0.0691,-0.6788 +0.0000,0.0000,0.0000,0.7275,-0.0458,-0.6845 +0.0000,0.0000,0.0000,0.7232,-0.0227,-0.6903 +0.0000,0.0000,0.0000,0.7181,0.0000,-0.6959 diff --git a/scripts/trajectories/full-circle-with-up-and-down-4s-ccw.csv b/scripts/trajectories/full-circle-with-up-and-down-4s-ccw.csv new file mode 100644 index 0000000000..1e4a316720 --- /dev/null +++ b/scripts/trajectories/full-circle-with-up-and-down-4s-ccw.csv @@ -0,0 +1,800 @@ +0.9223,-0.0000,-0.3863,0.0119 +0.9223,-0.0000,-0.3863,0.0119 +0.9223,-0.0000,-0.3863,0.0119 +0.9223,-0.0000,-0.3863,0.0119 +0.9235,-0.0000,-0.3828,0.0240 +0.9235,-0.0000,-0.3828,0.0240 +0.9235,-0.0000,-0.3828,0.0240 +0.9235,-0.0000,-0.3828,0.0240 +0.9245,-0.0000,-0.3794,0.0363 +0.9245,-0.0000,-0.3794,0.0363 +0.9245,-0.0000,-0.3794,0.0363 +0.9245,-0.0000,-0.3794,0.0363 +0.9253,-0.0000,-0.3760,0.0486 +0.9253,-0.0000,-0.3760,0.0486 +0.9253,-0.0000,-0.3760,0.0486 +0.9253,-0.0000,-0.3760,0.0486 +0.9259,-0.0000,-0.3727,0.0611 +0.9259,-0.0000,-0.3727,0.0611 +0.9259,-0.0000,-0.3727,0.0611 +0.9259,-0.0000,-0.3727,0.0611 +0.9263,-0.0000,-0.3695,0.0737 +0.9263,-0.0000,-0.3695,0.0737 +0.9263,-0.0000,-0.3695,0.0737 +0.9263,-0.0000,-0.3695,0.0737 +0.9265,-0.0000,-0.3663,0.0865 +0.9265,-0.0000,-0.3663,0.0865 +0.9265,-0.0000,-0.3663,0.0865 +0.9265,-0.0000,-0.3663,0.0865 +0.9264,-0.0000,-0.3632,0.0993 +0.9264,-0.0000,-0.3632,0.0993 +0.9264,-0.0000,-0.3632,0.0993 +0.9264,-0.0000,-0.3632,0.0993 +0.9261,-0.0000,-0.3602,0.1122 +0.9261,-0.0000,-0.3602,0.1122 +0.9261,-0.0000,-0.3602,0.1122 +0.9261,-0.0000,-0.3602,0.1122 +0.9256,-0.0000,-0.3572,0.1252 +0.9256,-0.0000,-0.3572,0.1252 +0.9256,-0.0000,-0.3572,0.1252 +0.9256,-0.0000,-0.3572,0.1252 +0.9248,-0.0000,-0.3543,0.1383 +0.9248,-0.0000,-0.3543,0.1383 +0.9248,-0.0000,-0.3543,0.1383 +0.9248,-0.0000,-0.3543,0.1383 +0.9239,-0.0000,-0.3515,0.1515 +0.9239,-0.0000,-0.3515,0.1515 +0.9239,-0.0000,-0.3515,0.1515 +0.9239,-0.0000,-0.3515,0.1515 +0.9226,-0.0000,-0.3487,0.1648 +0.9226,-0.0000,-0.3487,0.1648 +0.9226,-0.0000,-0.3487,0.1648 +0.9226,-0.0000,-0.3487,0.1648 +0.9212,-0.0000,-0.3460,0.1781 +0.9212,-0.0000,-0.3460,0.1781 +0.9212,-0.0000,-0.3460,0.1781 +0.9212,-0.0000,-0.3460,0.1781 +0.9195,-0.0000,-0.3433,0.1914 +0.9195,-0.0000,-0.3433,0.1914 +0.9195,-0.0000,-0.3433,0.1914 +0.9195,-0.0000,-0.3433,0.1914 +0.9176,-0.0000,-0.3407,0.2049 +0.9176,-0.0000,-0.3407,0.2049 +0.9176,-0.0000,-0.3407,0.2049 +0.9176,-0.0000,-0.3407,0.2049 +0.9154,-0.0000,-0.3382,0.2183 +0.9154,-0.0000,-0.3382,0.2183 +0.9154,-0.0000,-0.3382,0.2183 +0.9154,-0.0000,-0.3382,0.2183 +0.9130,-0.0000,-0.3357,0.2319 +0.9130,-0.0000,-0.3357,0.2319 +0.9130,-0.0000,-0.3357,0.2319 +0.9130,-0.0000,-0.3357,0.2319 +0.9104,-0.0000,-0.3332,0.2454 +0.9104,-0.0000,-0.3332,0.2454 +0.9104,-0.0000,-0.3332,0.2454 +0.9104,-0.0000,-0.3332,0.2454 +0.9075,-0.0000,-0.3308,0.2590 +0.9075,-0.0000,-0.3308,0.2590 +0.9075,-0.0000,-0.3308,0.2590 +0.9075,-0.0000,-0.3308,0.2590 +0.9043,-0.0000,-0.3285,0.2726 +0.9043,-0.0000,-0.3285,0.2726 +0.9043,-0.0000,-0.3285,0.2726 +0.9043,-0.0000,-0.3285,0.2726 +0.9009,-0.0000,-0.3262,0.2862 +0.9009,-0.0000,-0.3262,0.2862 +0.9009,-0.0000,-0.3262,0.2862 +0.9009,-0.0000,-0.3262,0.2862 +0.8973,-0.0000,-0.3240,0.2998 +0.8973,-0.0000,-0.3240,0.2998 +0.8973,-0.0000,-0.3240,0.2998 +0.8973,-0.0000,-0.3240,0.2998 +0.8934,-0.0000,-0.3218,0.3134 +0.8934,-0.0000,-0.3218,0.3134 +0.8934,-0.0000,-0.3218,0.3134 +0.8934,-0.0000,-0.3218,0.3134 +0.8893,-0.0000,-0.3197,0.3271 +0.8893,-0.0000,-0.3197,0.3271 +0.8893,-0.0000,-0.3197,0.3271 +0.8893,-0.0000,-0.3197,0.3271 +0.8849,-0.0000,-0.3176,0.3407 +0.8849,-0.0000,-0.3176,0.3407 +0.8849,-0.0000,-0.3176,0.3407 +0.8849,-0.0000,-0.3176,0.3407 +0.8803,-0.0000,-0.3156,0.3543 +0.8803,-0.0000,-0.3156,0.3543 +0.8803,-0.0000,-0.3156,0.3543 +0.8803,-0.0000,-0.3156,0.3543 +0.8754,-0.0000,-0.3136,0.3678 +0.8754,-0.0000,-0.3136,0.3678 +0.8754,-0.0000,-0.3136,0.3678 +0.8754,-0.0000,-0.3136,0.3678 +0.8703,-0.0000,-0.3116,0.3814 +0.8703,-0.0000,-0.3116,0.3814 +0.8703,-0.0000,-0.3116,0.3814 +0.8703,-0.0000,-0.3116,0.3814 +0.8650,-0.0000,-0.3097,0.3949 +0.8650,-0.0000,-0.3097,0.3949 +0.8650,-0.0000,-0.3097,0.3949 +0.8650,-0.0000,-0.3097,0.3949 +0.8593,-0.0000,-0.3079,0.4083 +0.8593,-0.0000,-0.3079,0.4083 +0.8593,-0.0000,-0.3079,0.4083 +0.8593,-0.0000,-0.3079,0.4083 +0.8535,-0.0000,-0.3061,0.4217 +0.8535,-0.0000,-0.3061,0.4217 +0.8535,-0.0000,-0.3061,0.4217 +0.8535,-0.0000,-0.3061,0.4217 +0.8474,-0.0000,-0.3043,0.4351 +0.8474,-0.0000,-0.3043,0.4351 +0.8474,-0.0000,-0.3043,0.4351 +0.8474,-0.0000,-0.3043,0.4351 +0.8410,-0.0000,-0.3026,0.4484 +0.8410,-0.0000,-0.3026,0.4484 +0.8410,-0.0000,-0.3026,0.4484 +0.8410,-0.0000,-0.3026,0.4484 +0.8344,-0.0000,-0.3010,0.4617 +0.8344,-0.0000,-0.3010,0.4617 +0.8344,-0.0000,-0.3010,0.4617 +0.8344,-0.0000,-0.3010,0.4617 +0.8276,-0.0000,-0.2993,0.4748 +0.8276,-0.0000,-0.2993,0.4748 +0.8276,-0.0000,-0.2993,0.4748 +0.8276,-0.0000,-0.2993,0.4748 +0.8205,-0.0000,-0.2978,0.4879 +0.8205,-0.0000,-0.2978,0.4879 +0.8205,-0.0000,-0.2978,0.4879 +0.8205,-0.0000,-0.2978,0.4879 +0.8132,-0.0000,-0.2962,0.5010 +0.8132,-0.0000,-0.2962,0.5010 +0.8132,-0.0000,-0.2962,0.5010 +0.8132,-0.0000,-0.2962,0.5010 +0.8056,-0.0000,-0.2947,0.5139 +0.8056,-0.0000,-0.2947,0.5139 +0.8056,-0.0000,-0.2947,0.5139 +0.8056,-0.0000,-0.2947,0.5139 +0.7978,-0.0000,-0.2932,0.5267 +0.7978,-0.0000,-0.2932,0.5267 +0.7978,-0.0000,-0.2932,0.5267 +0.7978,-0.0000,-0.2932,0.5267 +0.7898,-0.0000,-0.2918,0.5395 +0.7898,-0.0000,-0.2918,0.5395 +0.7898,-0.0000,-0.2918,0.5395 +0.7898,-0.0000,-0.2918,0.5395 +0.7815,-0.0000,-0.2904,0.5521 +0.7815,-0.0000,-0.2904,0.5521 +0.7815,-0.0000,-0.2904,0.5521 +0.7815,-0.0000,-0.2904,0.5521 +0.7730,-0.0000,-0.2891,0.5647 +0.7730,-0.0000,-0.2891,0.5647 +0.7730,-0.0000,-0.2891,0.5647 +0.7730,-0.0000,-0.2891,0.5647 +0.7643,-0.0000,-0.2878,0.5771 +0.7643,-0.0000,-0.2878,0.5771 +0.7643,-0.0000,-0.2878,0.5771 +0.7643,-0.0000,-0.2878,0.5771 +0.7553,-0.0000,-0.2865,0.5894 +0.7553,-0.0000,-0.2865,0.5894 +0.7553,-0.0000,-0.2865,0.5894 +0.7553,-0.0000,-0.2865,0.5894 +0.7461,-0.0000,-0.2853,0.6016 +0.7461,-0.0000,-0.2853,0.6016 +0.7461,-0.0000,-0.2853,0.6016 +0.7461,-0.0000,-0.2853,0.6016 +0.7367,-0.0000,-0.2841,0.6136 +0.7367,-0.0000,-0.2841,0.6136 +0.7367,-0.0000,-0.2841,0.6136 +0.7367,-0.0000,-0.2841,0.6136 +0.7271,-0.0000,-0.2830,0.6255 +0.7271,-0.0000,-0.2830,0.6255 +0.7271,-0.0000,-0.2830,0.6255 +0.7271,-0.0000,-0.2830,0.6255 +0.7172,-0.0000,-0.2819,0.6373 +0.7172,-0.0000,-0.2819,0.6373 +0.7172,-0.0000,-0.2819,0.6373 +0.7172,-0.0000,-0.2819,0.6373 +0.7071,-0.0000,-0.2808,0.6490 +0.7071,-0.0000,-0.2808,0.6490 +0.7071,-0.0000,-0.2808,0.6490 +0.7071,-0.0000,-0.2808,0.6490 +0.6968,-0.0000,-0.2798,0.6604 +0.6968,-0.0000,-0.2798,0.6604 +0.6968,-0.0000,-0.2798,0.6604 +0.6968,-0.0000,-0.2798,0.6604 +0.6863,-0.0000,-0.2788,0.6718 +0.6863,-0.0000,-0.2788,0.6718 +0.6863,-0.0000,-0.2788,0.6718 +0.6863,-0.0000,-0.2788,0.6718 +0.6756,-0.0000,-0.2779,0.6829 +0.6756,-0.0000,-0.2779,0.6829 +0.6756,-0.0000,-0.2779,0.6829 +0.6756,-0.0000,-0.2779,0.6829 +0.6646,-0.0000,-0.2769,0.6940 +0.6646,-0.0000,-0.2769,0.6940 +0.6646,-0.0000,-0.2769,0.6940 +0.6646,-0.0000,-0.2769,0.6940 +0.6535,-0.0000,-0.2761,0.7048 +0.6535,-0.0000,-0.2761,0.7048 +0.6535,-0.0000,-0.2761,0.7048 +0.6535,-0.0000,-0.2761,0.7048 +0.6422,-0.0000,-0.2752,0.7155 +0.6422,-0.0000,-0.2752,0.7155 +0.6422,-0.0000,-0.2752,0.7155 +0.6422,-0.0000,-0.2752,0.7155 +0.6306,-0.0000,-0.2744,0.7260 +0.6306,-0.0000,-0.2744,0.7260 +0.6306,-0.0000,-0.2744,0.7260 +0.6306,-0.0000,-0.2744,0.7260 +0.6189,-0.0000,-0.2737,0.7363 +0.6189,-0.0000,-0.2737,0.7363 +0.6189,-0.0000,-0.2737,0.7363 +0.6189,-0.0000,-0.2737,0.7363 +0.6069,-0.0000,-0.2730,0.7464 +0.6069,-0.0000,-0.2730,0.7464 +0.6069,-0.0000,-0.2730,0.7464 +0.6069,-0.0000,-0.2730,0.7464 +0.5948,-0.0000,-0.2723,0.7563 +0.5948,-0.0000,-0.2723,0.7563 +0.5948,-0.0000,-0.2723,0.7563 +0.5948,-0.0000,-0.2723,0.7563 +0.5825,-0.0000,-0.2716,0.7661 +0.5825,-0.0000,-0.2716,0.7661 +0.5825,-0.0000,-0.2716,0.7661 +0.5825,-0.0000,-0.2716,0.7661 +0.5700,-0.0000,-0.2710,0.7756 +0.5700,-0.0000,-0.2710,0.7756 +0.5700,-0.0000,-0.2710,0.7756 +0.5700,-0.0000,-0.2710,0.7756 +0.5574,-0.0000,-0.2705,0.7850 +0.5574,-0.0000,-0.2705,0.7850 +0.5574,-0.0000,-0.2705,0.7850 +0.5574,-0.0000,-0.2705,0.7850 +0.5445,-0.0000,-0.2700,0.7941 +0.5445,-0.0000,-0.2700,0.7941 +0.5445,-0.0000,-0.2700,0.7941 +0.5445,-0.0000,-0.2700,0.7941 +0.5315,-0.0000,-0.2695,0.8030 +0.5315,-0.0000,-0.2695,0.8030 +0.5315,-0.0000,-0.2695,0.8030 +0.5315,-0.0000,-0.2695,0.8030 +0.5184,-0.0000,-0.2691,0.8117 +0.5184,-0.0000,-0.2691,0.8117 +0.5184,-0.0000,-0.2691,0.8117 +0.5184,-0.0000,-0.2691,0.8117 +0.5050,-0.0000,-0.2687,0.8202 +0.5050,-0.0000,-0.2687,0.8202 +0.5050,-0.0000,-0.2687,0.8202 +0.5050,-0.0000,-0.2687,0.8202 +0.4915,-0.0000,-0.2684,0.8285 +0.4915,-0.0000,-0.2684,0.8285 +0.4915,-0.0000,-0.2684,0.8285 +0.4915,-0.0000,-0.2684,0.8285 +0.4779,-0.0000,-0.2682,0.8365 +0.4779,-0.0000,-0.2682,0.8365 +0.4779,-0.0000,-0.2682,0.8365 +0.4779,-0.0000,-0.2682,0.8365 +0.4640,-0.0000,-0.2680,0.8443 +0.4640,-0.0000,-0.2680,0.8443 +0.4640,-0.0000,-0.2680,0.8443 +0.4640,-0.0000,-0.2680,0.8443 +0.4501,-0.0000,-0.2678,0.8519 +0.4501,-0.0000,-0.2678,0.8519 +0.4501,-0.0000,-0.2678,0.8519 +0.4501,-0.0000,-0.2678,0.8519 +0.4360,-0.0000,-0.2677,0.8592 +0.4360,-0.0000,-0.2677,0.8592 +0.4360,-0.0000,-0.2677,0.8592 +0.4360,-0.0000,-0.2677,0.8592 +0.4218,-0.0000,-0.2677,0.8663 +0.4218,-0.0000,-0.2677,0.8663 +0.4218,-0.0000,-0.2677,0.8663 +0.4218,-0.0000,-0.2677,0.8663 +0.4074,-0.0000,-0.2677,0.8731 +0.4074,-0.0000,-0.2677,0.8731 +0.4074,-0.0000,-0.2677,0.8731 +0.4074,-0.0000,-0.2677,0.8731 +0.3929,-0.0000,-0.2678,0.8797 +0.3929,-0.0000,-0.2678,0.8797 +0.3929,-0.0000,-0.2678,0.8797 +0.3929,-0.0000,-0.2678,0.8797 +0.3783,-0.0000,-0.2680,0.8860 +0.3783,-0.0000,-0.2680,0.8860 +0.3783,-0.0000,-0.2680,0.8860 +0.3783,-0.0000,-0.2680,0.8860 +0.3635,-0.0000,-0.2683,0.8921 +0.3635,-0.0000,-0.2683,0.8921 +0.3635,-0.0000,-0.2683,0.8921 +0.3635,-0.0000,-0.2683,0.8921 +0.3487,-0.0000,-0.2687,0.8979 +0.3487,-0.0000,-0.2687,0.8979 +0.3487,-0.0000,-0.2687,0.8979 +0.3487,-0.0000,-0.2687,0.8979 +0.3337,-0.0000,-0.2692,0.9034 +0.3337,-0.0000,-0.2692,0.9034 +0.3337,-0.0000,-0.2692,0.9034 +0.3337,-0.0000,-0.2692,0.9034 +0.3186,-0.0000,-0.2698,0.9087 +0.3186,-0.0000,-0.2698,0.9087 +0.3186,-0.0000,-0.2698,0.9087 +0.3186,-0.0000,-0.2698,0.9087 +0.3034,-0.0000,-0.2705,0.9136 +0.3034,-0.0000,-0.2705,0.9136 +0.3034,-0.0000,-0.2705,0.9136 +0.3034,-0.0000,-0.2705,0.9136 +0.2882,-0.0000,-0.2714,0.9183 +0.2882,-0.0000,-0.2714,0.9183 +0.2882,-0.0000,-0.2714,0.9183 +0.2882,-0.0000,-0.2714,0.9183 +0.2728,-0.0000,-0.2725,0.9227 +0.2728,-0.0000,-0.2725,0.9227 +0.2728,-0.0000,-0.2725,0.9227 +0.2728,-0.0000,-0.2725,0.9227 +0.2573,-0.0000,-0.2738,0.9267 +0.2573,-0.0000,-0.2738,0.9267 +0.2573,-0.0000,-0.2738,0.9267 +0.2573,-0.0000,-0.2738,0.9267 +0.2418,-0.0000,-0.2753,0.9305 +0.2418,-0.0000,-0.2753,0.9305 +0.2418,-0.0000,-0.2753,0.9305 +0.2418,-0.0000,-0.2753,0.9305 +0.2262,-0.0000,-0.2771,0.9339 +0.2262,-0.0000,-0.2771,0.9339 +0.2262,-0.0000,-0.2771,0.9339 +0.2262,-0.0000,-0.2771,0.9339 +0.2105,-0.0000,-0.2792,0.9369 +0.2105,-0.0000,-0.2792,0.9369 +0.2105,-0.0000,-0.2792,0.9369 +0.2105,-0.0000,-0.2792,0.9369 +0.1947,-0.0000,-0.2818,0.9395 +0.1947,-0.0000,-0.2818,0.9395 +0.1947,-0.0000,-0.2818,0.9395 +0.1947,-0.0000,-0.2818,0.9395 +0.1789,-0.0000,-0.2848,0.9417 +0.1789,-0.0000,-0.2848,0.9417 +0.1789,-0.0000,-0.2848,0.9417 +0.1789,-0.0000,-0.2848,0.9417 +0.1630,-0.0000,-0.2886,0.9435 +0.1630,-0.0000,-0.2886,0.9435 +0.1630,-0.0000,-0.2886,0.9435 +0.1630,-0.0000,-0.2886,0.9435 +0.1471,-0.0000,-0.2933,0.9446 +0.1471,-0.0000,-0.2933,0.9446 +0.1471,-0.0000,-0.2933,0.9446 +0.1471,-0.0000,-0.2933,0.9446 +0.1312,-0.0000,-0.2991,0.9452 +0.1312,-0.0000,-0.2991,0.9452 +0.1312,-0.0000,-0.2991,0.9452 +0.1312,-0.0000,-0.2991,0.9452 +0.1152,-0.0000,-0.3067,0.9448 +0.1152,-0.0000,-0.3067,0.9448 +0.1152,-0.0000,-0.3067,0.9448 +0.1152,-0.0000,-0.3067,0.9448 +0.0991,-0.0000,-0.3167,0.9433 +0.0991,-0.0000,-0.3167,0.9433 +0.0991,-0.0000,-0.3167,0.9433 +0.0991,-0.0000,-0.3167,0.9433 +0.0831,-0.0000,-0.3307,0.9401 +0.0831,-0.0000,-0.3307,0.9401 +0.0831,-0.0000,-0.3307,0.9401 +0.0831,-0.0000,-0.3307,0.9401 +0.0670,-0.0000,-0.3514,0.9338 +0.0670,-0.0000,-0.3514,0.9338 +0.0670,-0.0000,-0.3514,0.9338 +0.0670,-0.0000,-0.3514,0.9338 +0.0510,-0.0000,-0.3848,0.9216 +0.0510,-0.0000,-0.3848,0.9216 +0.0510,-0.0000,-0.3848,0.9216 +0.0510,-0.0000,-0.3848,0.9216 +0.0351,-0.0000,-0.4473,0.8937 +0.0351,-0.0000,-0.4473,0.8937 +0.0351,-0.0000,-0.4473,0.8937 +0.0351,-0.0000,-0.4473,0.8937 +0.0196,-0.0000,-0.6000,0.7997 +0.0196,-0.0000,-0.6000,0.7997 +0.0196,-0.0000,-0.6000,0.7997 +0.0196,-0.0000,-0.6000,0.7997 +0.0079,-0.0000,-1.0000,-0.0001 +0.0079,-0.0000,-1.0000,-0.0001 +0.0079,-0.0000,-1.0000,-0.0001 +0.0079,-0.0000,-1.0000,-0.0001 +0.0162,-0.0000,-0.2425,-0.9700 +0.0162,-0.0000,-0.2425,-0.9700 +0.0162,-0.0000,-0.2425,-0.9700 +0.0162,-0.0000,-0.2425,-0.9700 +0.0314,-0.0000,0.0000,-0.9995 +0.0314,-0.0000,0.0000,-0.9995 +0.0314,-0.0000,0.0000,-0.9995 +0.0314,-0.0000,0.0000,-0.9995 +0.0473,-0.0000,0.0831,-0.9954 +0.0473,-0.0000,0.0831,-0.9954 +0.0473,-0.0000,0.0831,-0.9954 +0.0473,-0.0000,0.0831,-0.9954 +0.0633,-0.0000,0.1241,-0.9902 +0.0633,-0.0000,0.1241,-0.9902 +0.0633,-0.0000,0.1241,-0.9902 +0.0633,-0.0000,0.1241,-0.9902 +0.0793,-0.0000,0.1485,-0.9857 +0.0793,-0.0000,0.1485,-0.9857 +0.0793,-0.0000,0.1485,-0.9857 +0.0793,-0.0000,0.1485,-0.9857 +0.0954,-0.0000,0.1646,-0.9817 +0.0954,-0.0000,0.1646,-0.9817 +0.0954,-0.0000,0.1646,-0.9817 +0.0954,-0.0000,0.1646,-0.9817 +0.1114,-0.0000,0.1762,-0.9780 +0.1114,-0.0000,0.1762,-0.9780 +0.1114,-0.0000,0.1762,-0.9780 +0.1114,-0.0000,0.1762,-0.9780 +0.1275,-0.0000,0.1848,-0.9745 +0.1275,-0.0000,0.1848,-0.9745 +0.1275,-0.0000,0.1848,-0.9745 +0.1275,-0.0000,0.1848,-0.9745 +0.1435,-0.0000,0.1915,-0.9709 +0.1435,-0.0000,0.1915,-0.9709 +0.1435,-0.0000,0.1915,-0.9709 +0.1435,-0.0000,0.1915,-0.9709 +0.1594,-0.0000,0.1970,-0.9674 +0.1594,-0.0000,0.1970,-0.9674 +0.1594,-0.0000,0.1970,-0.9674 +0.1594,-0.0000,0.1970,-0.9674 +0.1753,-0.0000,0.2014,-0.9637 +0.1753,-0.0000,0.2014,-0.9637 +0.1753,-0.0000,0.2014,-0.9637 +0.1753,-0.0000,0.2014,-0.9637 +0.1912,-0.0000,0.2052,-0.9599 +0.1912,-0.0000,0.2052,-0.9599 +0.1912,-0.0000,0.2052,-0.9599 +0.1912,-0.0000,0.2052,-0.9599 +0.2070,-0.0000,0.2085,-0.9559 +0.2070,-0.0000,0.2085,-0.9559 +0.2070,-0.0000,0.2085,-0.9559 +0.2070,-0.0000,0.2085,-0.9559 +0.2227,-0.0000,0.2113,-0.9517 +0.2227,-0.0000,0.2113,-0.9517 +0.2227,-0.0000,0.2113,-0.9517 +0.2227,-0.0000,0.2113,-0.9517 +0.2384,-0.0000,0.2138,-0.9473 +0.2384,-0.0000,0.2138,-0.9473 +0.2384,-0.0000,0.2138,-0.9473 +0.2384,-0.0000,0.2138,-0.9473 +0.2540,-0.0000,0.2161,-0.9428 +0.2540,-0.0000,0.2161,-0.9428 +0.2540,-0.0000,0.2161,-0.9428 +0.2540,-0.0000,0.2161,-0.9428 +0.2695,-0.0000,0.2181,-0.9380 +0.2695,-0.0000,0.2181,-0.9380 +0.2695,-0.0000,0.2181,-0.9380 +0.2695,-0.0000,0.2181,-0.9380 +0.2849,-0.0000,0.2200,-0.9330 +0.2849,-0.0000,0.2200,-0.9330 +0.2849,-0.0000,0.2200,-0.9330 +0.2849,-0.0000,0.2200,-0.9330 +0.3002,-0.0000,0.2217,-0.9277 +0.3002,-0.0000,0.2217,-0.9277 +0.3002,-0.0000,0.2217,-0.9277 +0.3002,-0.0000,0.2217,-0.9277 +0.3155,-0.0000,0.2233,-0.9223 +0.3155,-0.0000,0.2233,-0.9223 +0.3155,-0.0000,0.2233,-0.9223 +0.3155,-0.0000,0.2233,-0.9223 +0.3306,-0.0000,0.2248,-0.9166 +0.3306,-0.0000,0.2248,-0.9166 +0.3306,-0.0000,0.2248,-0.9166 +0.3306,-0.0000,0.2248,-0.9166 +0.3457,-0.0000,0.2263,-0.9107 +0.3457,-0.0000,0.2263,-0.9107 +0.3457,-0.0000,0.2263,-0.9107 +0.3457,-0.0000,0.2263,-0.9107 +0.3606,-0.0000,0.2277,-0.9045 +0.3606,-0.0000,0.2277,-0.9045 +0.3606,-0.0000,0.2277,-0.9045 +0.3606,-0.0000,0.2277,-0.9045 +0.3754,-0.0000,0.2290,-0.8981 +0.3754,-0.0000,0.2290,-0.8981 +0.3754,-0.0000,0.2290,-0.8981 +0.3754,-0.0000,0.2290,-0.8981 +0.3901,-0.0000,0.2303,-0.8915 +0.3901,-0.0000,0.2303,-0.8915 +0.3901,-0.0000,0.2303,-0.8915 +0.3901,-0.0000,0.2303,-0.8915 +0.4047,-0.0000,0.2315,-0.8847 +0.4047,-0.0000,0.2315,-0.8847 +0.4047,-0.0000,0.2315,-0.8847 +0.4047,-0.0000,0.2315,-0.8847 +0.4192,-0.0000,0.2327,-0.8776 +0.4192,-0.0000,0.2327,-0.8776 +0.4192,-0.0000,0.2327,-0.8776 +0.4192,-0.0000,0.2327,-0.8776 +0.4335,-0.0000,0.2339,-0.8703 +0.4335,-0.0000,0.2339,-0.8703 +0.4335,-0.0000,0.2339,-0.8703 +0.4335,-0.0000,0.2339,-0.8703 +0.4477,-0.0000,0.2351,-0.8627 +0.4477,-0.0000,0.2351,-0.8627 +0.4477,-0.0000,0.2351,-0.8627 +0.4477,-0.0000,0.2351,-0.8627 +0.4617,-0.0000,0.2362,-0.8550 +0.4617,-0.0000,0.2362,-0.8550 +0.4617,-0.0000,0.2362,-0.8550 +0.4617,-0.0000,0.2362,-0.8550 +0.4756,-0.0000,0.2374,-0.8470 +0.4756,-0.0000,0.2374,-0.8470 +0.4756,-0.0000,0.2374,-0.8470 +0.4756,-0.0000,0.2374,-0.8470 +0.4894,-0.0000,0.2385,-0.8388 +0.4894,-0.0000,0.2385,-0.8388 +0.4894,-0.0000,0.2385,-0.8388 +0.4894,-0.0000,0.2385,-0.8388 +0.5030,-0.0000,0.2396,-0.8304 +0.5030,-0.0000,0.2396,-0.8304 +0.5030,-0.0000,0.2396,-0.8304 +0.5030,-0.0000,0.2396,-0.8304 +0.5164,-0.0000,0.2408,-0.8218 +0.5164,-0.0000,0.2408,-0.8218 +0.5164,-0.0000,0.2408,-0.8218 +0.5164,-0.0000,0.2408,-0.8218 +0.5297,-0.0000,0.2419,-0.8130 +0.5297,-0.0000,0.2419,-0.8130 +0.5297,-0.0000,0.2419,-0.8130 +0.5297,-0.0000,0.2419,-0.8130 +0.5428,-0.0000,0.2431,-0.8039 +0.5428,-0.0000,0.2431,-0.8039 +0.5428,-0.0000,0.2431,-0.8039 +0.5428,-0.0000,0.2431,-0.8039 +0.5558,-0.0000,0.2442,-0.7947 +0.5558,-0.0000,0.2442,-0.7947 +0.5558,-0.0000,0.2442,-0.7947 +0.5558,-0.0000,0.2442,-0.7947 +0.5685,-0.0000,0.2454,-0.7852 +0.5685,-0.0000,0.2454,-0.7852 +0.5685,-0.0000,0.2454,-0.7852 +0.5685,-0.0000,0.2454,-0.7852 +0.5811,-0.0000,0.2465,-0.7756 +0.5811,-0.0000,0.2465,-0.7756 +0.5811,-0.0000,0.2465,-0.7756 +0.5811,-0.0000,0.2465,-0.7756 +0.5936,-0.0000,0.2477,-0.7657 +0.5936,-0.0000,0.2477,-0.7657 +0.5936,-0.0000,0.2477,-0.7657 +0.5936,-0.0000,0.2477,-0.7657 +0.6058,-0.0000,0.2489,-0.7557 +0.6058,-0.0000,0.2489,-0.7557 +0.6058,-0.0000,0.2489,-0.7557 +0.6058,-0.0000,0.2489,-0.7557 +0.6179,-0.0000,0.2501,-0.7455 +0.6179,-0.0000,0.2501,-0.7455 +0.6179,-0.0000,0.2501,-0.7455 +0.6179,-0.0000,0.2501,-0.7455 +0.6297,-0.0000,0.2513,-0.7351 +0.6297,-0.0000,0.2513,-0.7351 +0.6297,-0.0000,0.2513,-0.7351 +0.6297,-0.0000,0.2513,-0.7351 +0.6414,-0.0000,0.2525,-0.7245 +0.6414,-0.0000,0.2525,-0.7245 +0.6414,-0.0000,0.2525,-0.7245 +0.6414,-0.0000,0.2525,-0.7245 +0.6528,-0.0000,0.2538,-0.7137 +0.6528,-0.0000,0.2538,-0.7137 +0.6528,-0.0000,0.2538,-0.7137 +0.6528,-0.0000,0.2538,-0.7137 +0.6641,-0.0000,0.2550,-0.7028 +0.6641,-0.0000,0.2550,-0.7028 +0.6641,-0.0000,0.2550,-0.7028 +0.6641,-0.0000,0.2550,-0.7028 +0.6752,-0.0000,0.2563,-0.6917 +0.6752,-0.0000,0.2563,-0.6917 +0.6752,-0.0000,0.2563,-0.6917 +0.6752,-0.0000,0.2563,-0.6917 +0.6860,-0.0000,0.2576,-0.6804 +0.6860,-0.0000,0.2576,-0.6804 +0.6860,-0.0000,0.2576,-0.6804 +0.6860,-0.0000,0.2576,-0.6804 +0.6967,-0.0000,0.2590,-0.6690 +0.6967,-0.0000,0.2590,-0.6690 +0.6967,-0.0000,0.2590,-0.6690 +0.6967,-0.0000,0.2590,-0.6690 +0.7071,-0.0000,0.2603,-0.6575 +0.7071,-0.0000,0.2603,-0.6575 +0.7071,-0.0000,0.2603,-0.6575 +0.7071,-0.0000,0.2603,-0.6575 +0.7173,-0.0000,0.2617,-0.6457 +0.7173,-0.0000,0.2617,-0.6457 +0.7173,-0.0000,0.2617,-0.6457 +0.7173,-0.0000,0.2617,-0.6457 +0.7273,-0.0000,0.2631,-0.6339 +0.7273,-0.0000,0.2631,-0.6339 +0.7273,-0.0000,0.2631,-0.6339 +0.7273,-0.0000,0.2631,-0.6339 +0.7371,-0.0000,0.2645,-0.6219 +0.7371,-0.0000,0.2645,-0.6219 +0.7371,-0.0000,0.2645,-0.6219 +0.7371,-0.0000,0.2645,-0.6219 +0.7467,-0.0000,0.2659,-0.6097 +0.7467,-0.0000,0.2659,-0.6097 +0.7467,-0.0000,0.2659,-0.6097 +0.7467,-0.0000,0.2659,-0.6097 +0.7560,-0.0000,0.2674,-0.5974 +0.7560,-0.0000,0.2674,-0.5974 +0.7560,-0.0000,0.2674,-0.5974 +0.7560,-0.0000,0.2674,-0.5974 +0.7651,-0.0000,0.2689,-0.5851 +0.7651,-0.0000,0.2689,-0.5851 +0.7651,-0.0000,0.2689,-0.5851 +0.7651,-0.0000,0.2689,-0.5851 +0.7740,-0.0000,0.2705,-0.5725 +0.7740,-0.0000,0.2705,-0.5725 +0.7740,-0.0000,0.2705,-0.5725 +0.7740,-0.0000,0.2705,-0.5725 +0.7826,-0.0000,0.2720,-0.5599 +0.7826,-0.0000,0.2720,-0.5599 +0.7826,-0.0000,0.2720,-0.5599 +0.7826,-0.0000,0.2720,-0.5599 +0.7910,-0.0000,0.2736,-0.5472 +0.7910,-0.0000,0.2736,-0.5472 +0.7910,-0.0000,0.2736,-0.5472 +0.7910,-0.0000,0.2736,-0.5472 +0.7992,-0.0000,0.2752,-0.5343 +0.7992,-0.0000,0.2752,-0.5343 +0.7992,-0.0000,0.2752,-0.5343 +0.7992,-0.0000,0.2752,-0.5343 +0.8072,-0.0000,0.2769,-0.5214 +0.8072,-0.0000,0.2769,-0.5214 +0.8072,-0.0000,0.2769,-0.5214 +0.8072,-0.0000,0.2769,-0.5214 +0.8149,-0.0000,0.2786,-0.5083 +0.8149,-0.0000,0.2786,-0.5083 +0.8149,-0.0000,0.2786,-0.5083 +0.8149,-0.0000,0.2786,-0.5083 +0.8223,-0.0000,0.2803,-0.4952 +0.8223,-0.0000,0.2803,-0.4952 +0.8223,-0.0000,0.2803,-0.4952 +0.8223,-0.0000,0.2803,-0.4952 +0.8295,-0.0000,0.2820,-0.4820 +0.8295,-0.0000,0.2820,-0.4820 +0.8295,-0.0000,0.2820,-0.4820 +0.8295,-0.0000,0.2820,-0.4820 +0.8365,-0.0000,0.2838,-0.4687 +0.8365,-0.0000,0.2838,-0.4687 +0.8365,-0.0000,0.2838,-0.4687 +0.8365,-0.0000,0.2838,-0.4687 +0.8433,-0.0000,0.2857,-0.4553 +0.8433,-0.0000,0.2857,-0.4553 +0.8433,-0.0000,0.2857,-0.4553 +0.8433,-0.0000,0.2857,-0.4553 +0.8497,-0.0000,0.2875,-0.4419 +0.8497,-0.0000,0.2875,-0.4419 +0.8497,-0.0000,0.2875,-0.4419 +0.8497,-0.0000,0.2875,-0.4419 +0.8560,-0.0000,0.2894,-0.4284 +0.8560,-0.0000,0.2894,-0.4284 +0.8560,-0.0000,0.2894,-0.4284 +0.8560,-0.0000,0.2894,-0.4284 +0.8620,-0.0000,0.2913,-0.4148 +0.8620,-0.0000,0.2913,-0.4148 +0.8620,-0.0000,0.2913,-0.4148 +0.8620,-0.0000,0.2913,-0.4148 +0.8677,-0.0000,0.2933,-0.4012 +0.8677,-0.0000,0.2933,-0.4012 +0.8677,-0.0000,0.2933,-0.4012 +0.8677,-0.0000,0.2933,-0.4012 +0.8732,-0.0000,0.2953,-0.3876 +0.8732,-0.0000,0.2953,-0.3876 +0.8732,-0.0000,0.2953,-0.3876 +0.8732,-0.0000,0.2953,-0.3876 +0.8785,-0.0000,0.2974,-0.3739 +0.8785,-0.0000,0.2974,-0.3739 +0.8785,-0.0000,0.2974,-0.3739 +0.8785,-0.0000,0.2974,-0.3739 +0.8835,-0.0000,0.2995,-0.3602 +0.8835,-0.0000,0.2995,-0.3602 +0.8835,-0.0000,0.2995,-0.3602 +0.8835,-0.0000,0.2995,-0.3602 +0.8883,-0.0000,0.3016,-0.3465 +0.8883,-0.0000,0.3016,-0.3465 +0.8883,-0.0000,0.3016,-0.3465 +0.8883,-0.0000,0.3016,-0.3465 +0.8928,-0.0000,0.3038,-0.3327 +0.8928,-0.0000,0.3038,-0.3327 +0.8928,-0.0000,0.3038,-0.3327 +0.8928,-0.0000,0.3038,-0.3327 +0.8970,-0.0000,0.3060,-0.3189 +0.8970,-0.0000,0.3060,-0.3189 +0.8970,-0.0000,0.3060,-0.3189 +0.8970,-0.0000,0.3060,-0.3189 +0.9010,-0.0000,0.3083,-0.3051 +0.9010,-0.0000,0.3083,-0.3051 +0.9010,-0.0000,0.3083,-0.3051 +0.9010,-0.0000,0.3083,-0.3051 +0.9048,-0.0000,0.3106,-0.2913 +0.9048,-0.0000,0.3106,-0.2913 +0.9048,-0.0000,0.3106,-0.2913 +0.9048,-0.0000,0.3106,-0.2913 +0.9083,-0.0000,0.3130,-0.2776 +0.9083,-0.0000,0.3130,-0.2776 +0.9083,-0.0000,0.3130,-0.2776 +0.9083,-0.0000,0.3130,-0.2776 +0.9116,-0.0000,0.3154,-0.2638 +0.9116,-0.0000,0.3154,-0.2638 +0.9116,-0.0000,0.3154,-0.2638 +0.9116,-0.0000,0.3154,-0.2638 +0.9146,-0.0000,0.3179,-0.2500 +0.9146,-0.0000,0.3179,-0.2500 +0.9146,-0.0000,0.3179,-0.2500 +0.9146,-0.0000,0.3179,-0.2500 +0.9174,-0.0000,0.3204,-0.2363 +0.9174,-0.0000,0.3204,-0.2363 +0.9174,-0.0000,0.3204,-0.2363 +0.9174,-0.0000,0.3204,-0.2363 +0.9199,-0.0000,0.3229,-0.2226 +0.9199,-0.0000,0.3229,-0.2226 +0.9199,-0.0000,0.3229,-0.2226 +0.9199,-0.0000,0.3229,-0.2226 +0.9222,-0.0000,0.3256,-0.2089 +0.9222,-0.0000,0.3256,-0.2089 +0.9222,-0.0000,0.3256,-0.2089 +0.9222,-0.0000,0.3256,-0.2089 +0.9242,-0.0000,0.3282,-0.1952 +0.9242,-0.0000,0.3282,-0.1952 +0.9242,-0.0000,0.3282,-0.1952 +0.9242,-0.0000,0.3282,-0.1952 +0.9260,-0.0000,0.3309,-0.1817 +0.9260,-0.0000,0.3309,-0.1817 +0.9260,-0.0000,0.3309,-0.1817 +0.9260,-0.0000,0.3309,-0.1817 +0.9276,-0.0000,0.3337,-0.1681 +0.9276,-0.0000,0.3337,-0.1681 +0.9276,-0.0000,0.3337,-0.1681 +0.9276,-0.0000,0.3337,-0.1681 +0.9289,-0.0000,0.3366,-0.1546 +0.9289,-0.0000,0.3366,-0.1546 +0.9289,-0.0000,0.3366,-0.1546 +0.9289,-0.0000,0.3366,-0.1546 +0.9300,-0.0000,0.3395,-0.1412 +0.9300,-0.0000,0.3395,-0.1412 +0.9300,-0.0000,0.3395,-0.1412 +0.9300,-0.0000,0.3395,-0.1412 +0.9308,-0.0000,0.3424,-0.1279 +0.9308,-0.0000,0.3424,-0.1279 +0.9308,-0.0000,0.3424,-0.1279 +0.9308,-0.0000,0.3424,-0.1279 +0.9314,-0.0000,0.3454,-0.1146 +0.9314,-0.0000,0.3454,-0.1146 +0.9314,-0.0000,0.3454,-0.1146 +0.9314,-0.0000,0.3454,-0.1146 +0.9318,-0.0000,0.3485,-0.1015 +0.9318,-0.0000,0.3485,-0.1015 +0.9318,-0.0000,0.3485,-0.1015 +0.9318,-0.0000,0.3485,-0.1015 +0.9320,-0.0000,0.3516,-0.0884 +0.9320,-0.0000,0.3516,-0.0884 +0.9320,-0.0000,0.3516,-0.0884 +0.9320,-0.0000,0.3516,-0.0884 +0.9319,-0.0000,0.3548,-0.0754 +0.9319,-0.0000,0.3548,-0.0754 +0.9319,-0.0000,0.3548,-0.0754 +0.9319,-0.0000,0.3548,-0.0754 +0.9316,-0.0000,0.3581,-0.0625 +0.9316,-0.0000,0.3581,-0.0625 +0.9316,-0.0000,0.3581,-0.0625 +0.9316,-0.0000,0.3581,-0.0625 +0.9311,-0.0000,0.3614,-0.0498 +0.9311,-0.0000,0.3614,-0.0498 +0.9311,-0.0000,0.3614,-0.0498 +0.9311,-0.0000,0.3614,-0.0498 +0.9303,-0.0000,0.3648,-0.0371 +0.9303,-0.0000,0.3648,-0.0371 +0.9303,-0.0000,0.3648,-0.0371 +0.9303,-0.0000,0.3648,-0.0371 +0.9294,-0.0000,0.3683,-0.0246 +0.9294,-0.0000,0.3683,-0.0246 +0.9294,-0.0000,0.3683,-0.0246 +0.9294,-0.0000,0.3683,-0.0246 +0.9282,-0.0000,0.3718,-0.0122 +0.9282,-0.0000,0.3718,-0.0122 +0.9282,-0.0000,0.3718,-0.0122 +0.9282,-0.0000,0.3718,-0.0122 +0.9269,0.0000,0.3754,0.0000 +0.9269,0.0000,0.3754,0.0000 +0.9269,0.0000,0.3754,0.0000 +0.9269,0.0000,0.3754,0.0000 diff --git a/scripts/trajectories/full-circle-with-up-and-down-4s.csv b/scripts/trajectories/full-circle-with-up-and-down-4s.csv new file mode 100644 index 0000000000..31692f4673 --- /dev/null +++ b/scripts/trajectories/full-circle-with-up-and-down-4s.csv @@ -0,0 +1,800 @@ +0.9223,-0.0000,0.3863,-0.0119 +0.9223,-0.0000,0.3863,-0.0119 +0.9223,-0.0000,0.3863,-0.0119 +0.9223,-0.0000,0.3863,-0.0119 +0.9235,-0.0000,0.3828,-0.0240 +0.9235,-0.0000,0.3828,-0.0240 +0.9235,-0.0000,0.3828,-0.0240 +0.9235,-0.0000,0.3828,-0.0240 +0.9245,-0.0000,0.3794,-0.0363 +0.9245,-0.0000,0.3794,-0.0363 +0.9245,-0.0000,0.3794,-0.0363 +0.9245,-0.0000,0.3794,-0.0363 +0.9253,-0.0000,0.3760,-0.0486 +0.9253,-0.0000,0.3760,-0.0486 +0.9253,-0.0000,0.3760,-0.0486 +0.9253,-0.0000,0.3760,-0.0486 +0.9259,-0.0000,0.3727,-0.0611 +0.9259,-0.0000,0.3727,-0.0611 +0.9259,-0.0000,0.3727,-0.0611 +0.9259,-0.0000,0.3727,-0.0611 +0.9263,-0.0000,0.3695,-0.0737 +0.9263,-0.0000,0.3695,-0.0737 +0.9263,-0.0000,0.3695,-0.0737 +0.9263,-0.0000,0.3695,-0.0737 +0.9265,-0.0000,0.3663,-0.0865 +0.9265,-0.0000,0.3663,-0.0865 +0.9265,-0.0000,0.3663,-0.0865 +0.9265,-0.0000,0.3663,-0.0865 +0.9264,-0.0000,0.3632,-0.0993 +0.9264,-0.0000,0.3632,-0.0993 +0.9264,-0.0000,0.3632,-0.0993 +0.9264,-0.0000,0.3632,-0.0993 +0.9261,-0.0000,0.3602,-0.1122 +0.9261,-0.0000,0.3602,-0.1122 +0.9261,-0.0000,0.3602,-0.1122 +0.9261,-0.0000,0.3602,-0.1122 +0.9256,-0.0000,0.3572,-0.1252 +0.9256,-0.0000,0.3572,-0.1252 +0.9256,-0.0000,0.3572,-0.1252 +0.9256,-0.0000,0.3572,-0.1252 +0.9248,-0.0000,0.3543,-0.1383 +0.9248,-0.0000,0.3543,-0.1383 +0.9248,-0.0000,0.3543,-0.1383 +0.9248,-0.0000,0.3543,-0.1383 +0.9239,-0.0000,0.3515,-0.1515 +0.9239,-0.0000,0.3515,-0.1515 +0.9239,-0.0000,0.3515,-0.1515 +0.9239,-0.0000,0.3515,-0.1515 +0.9226,-0.0000,0.3487,-0.1648 +0.9226,-0.0000,0.3487,-0.1648 +0.9226,-0.0000,0.3487,-0.1648 +0.9226,-0.0000,0.3487,-0.1648 +0.9212,-0.0000,0.3460,-0.1781 +0.9212,-0.0000,0.3460,-0.1781 +0.9212,-0.0000,0.3460,-0.1781 +0.9212,-0.0000,0.3460,-0.1781 +0.9195,-0.0000,0.3433,-0.1914 +0.9195,-0.0000,0.3433,-0.1914 +0.9195,-0.0000,0.3433,-0.1914 +0.9195,-0.0000,0.3433,-0.1914 +0.9176,-0.0000,0.3407,-0.2049 +0.9176,-0.0000,0.3407,-0.2049 +0.9176,-0.0000,0.3407,-0.2049 +0.9176,-0.0000,0.3407,-0.2049 +0.9154,-0.0000,0.3382,-0.2183 +0.9154,-0.0000,0.3382,-0.2183 +0.9154,-0.0000,0.3382,-0.2183 +0.9154,-0.0000,0.3382,-0.2183 +0.9130,-0.0000,0.3357,-0.2319 +0.9130,-0.0000,0.3357,-0.2319 +0.9130,-0.0000,0.3357,-0.2319 +0.9130,-0.0000,0.3357,-0.2319 +0.9104,-0.0000,0.3332,-0.2454 +0.9104,-0.0000,0.3332,-0.2454 +0.9104,-0.0000,0.3332,-0.2454 +0.9104,-0.0000,0.3332,-0.2454 +0.9075,-0.0000,0.3308,-0.2590 +0.9075,-0.0000,0.3308,-0.2590 +0.9075,-0.0000,0.3308,-0.2590 +0.9075,-0.0000,0.3308,-0.2590 +0.9043,-0.0000,0.3285,-0.2726 +0.9043,-0.0000,0.3285,-0.2726 +0.9043,-0.0000,0.3285,-0.2726 +0.9043,-0.0000,0.3285,-0.2726 +0.9009,-0.0000,0.3262,-0.2862 +0.9009,-0.0000,0.3262,-0.2862 +0.9009,-0.0000,0.3262,-0.2862 +0.9009,-0.0000,0.3262,-0.2862 +0.8973,-0.0000,0.3240,-0.2998 +0.8973,-0.0000,0.3240,-0.2998 +0.8973,-0.0000,0.3240,-0.2998 +0.8973,-0.0000,0.3240,-0.2998 +0.8934,-0.0000,0.3218,-0.3134 +0.8934,-0.0000,0.3218,-0.3134 +0.8934,-0.0000,0.3218,-0.3134 +0.8934,-0.0000,0.3218,-0.3134 +0.8893,-0.0000,0.3197,-0.3271 +0.8893,-0.0000,0.3197,-0.3271 +0.8893,-0.0000,0.3197,-0.3271 +0.8893,-0.0000,0.3197,-0.3271 +0.8849,-0.0000,0.3176,-0.3407 +0.8849,-0.0000,0.3176,-0.3407 +0.8849,-0.0000,0.3176,-0.3407 +0.8849,-0.0000,0.3176,-0.3407 +0.8803,-0.0000,0.3156,-0.3543 +0.8803,-0.0000,0.3156,-0.3543 +0.8803,-0.0000,0.3156,-0.3543 +0.8803,-0.0000,0.3156,-0.3543 +0.8754,-0.0000,0.3136,-0.3678 +0.8754,-0.0000,0.3136,-0.3678 +0.8754,-0.0000,0.3136,-0.3678 +0.8754,-0.0000,0.3136,-0.3678 +0.8703,-0.0000,0.3116,-0.3814 +0.8703,-0.0000,0.3116,-0.3814 +0.8703,-0.0000,0.3116,-0.3814 +0.8703,-0.0000,0.3116,-0.3814 +0.8650,-0.0000,0.3097,-0.3949 +0.8650,-0.0000,0.3097,-0.3949 +0.8650,-0.0000,0.3097,-0.3949 +0.8650,-0.0000,0.3097,-0.3949 +0.8593,-0.0000,0.3079,-0.4083 +0.8593,-0.0000,0.3079,-0.4083 +0.8593,-0.0000,0.3079,-0.4083 +0.8593,-0.0000,0.3079,-0.4083 +0.8535,-0.0000,0.3061,-0.4217 +0.8535,-0.0000,0.3061,-0.4217 +0.8535,-0.0000,0.3061,-0.4217 +0.8535,-0.0000,0.3061,-0.4217 +0.8474,-0.0000,0.3043,-0.4351 +0.8474,-0.0000,0.3043,-0.4351 +0.8474,-0.0000,0.3043,-0.4351 +0.8474,-0.0000,0.3043,-0.4351 +0.8410,-0.0000,0.3026,-0.4484 +0.8410,-0.0000,0.3026,-0.4484 +0.8410,-0.0000,0.3026,-0.4484 +0.8410,-0.0000,0.3026,-0.4484 +0.8344,-0.0000,0.3010,-0.4617 +0.8344,-0.0000,0.3010,-0.4617 +0.8344,-0.0000,0.3010,-0.4617 +0.8344,-0.0000,0.3010,-0.4617 +0.8276,-0.0000,0.2993,-0.4748 +0.8276,-0.0000,0.2993,-0.4748 +0.8276,-0.0000,0.2993,-0.4748 +0.8276,-0.0000,0.2993,-0.4748 +0.8205,-0.0000,0.2978,-0.4879 +0.8205,-0.0000,0.2978,-0.4879 +0.8205,-0.0000,0.2978,-0.4879 +0.8205,-0.0000,0.2978,-0.4879 +0.8132,-0.0000,0.2962,-0.5010 +0.8132,-0.0000,0.2962,-0.5010 +0.8132,-0.0000,0.2962,-0.5010 +0.8132,-0.0000,0.2962,-0.5010 +0.8056,-0.0000,0.2947,-0.5139 +0.8056,-0.0000,0.2947,-0.5139 +0.8056,-0.0000,0.2947,-0.5139 +0.8056,-0.0000,0.2947,-0.5139 +0.7978,-0.0000,0.2932,-0.5267 +0.7978,-0.0000,0.2932,-0.5267 +0.7978,-0.0000,0.2932,-0.5267 +0.7978,-0.0000,0.2932,-0.5267 +0.7898,-0.0000,0.2918,-0.5395 +0.7898,-0.0000,0.2918,-0.5395 +0.7898,-0.0000,0.2918,-0.5395 +0.7898,-0.0000,0.2918,-0.5395 +0.7815,-0.0000,0.2904,-0.5521 +0.7815,-0.0000,0.2904,-0.5521 +0.7815,-0.0000,0.2904,-0.5521 +0.7815,-0.0000,0.2904,-0.5521 +0.7730,-0.0000,0.2891,-0.5647 +0.7730,-0.0000,0.2891,-0.5647 +0.7730,-0.0000,0.2891,-0.5647 +0.7730,-0.0000,0.2891,-0.5647 +0.7643,-0.0000,0.2878,-0.5771 +0.7643,-0.0000,0.2878,-0.5771 +0.7643,-0.0000,0.2878,-0.5771 +0.7643,-0.0000,0.2878,-0.5771 +0.7553,-0.0000,0.2865,-0.5894 +0.7553,-0.0000,0.2865,-0.5894 +0.7553,-0.0000,0.2865,-0.5894 +0.7553,-0.0000,0.2865,-0.5894 +0.7461,-0.0000,0.2853,-0.6016 +0.7461,-0.0000,0.2853,-0.6016 +0.7461,-0.0000,0.2853,-0.6016 +0.7461,-0.0000,0.2853,-0.6016 +0.7367,-0.0000,0.2841,-0.6136 +0.7367,-0.0000,0.2841,-0.6136 +0.7367,-0.0000,0.2841,-0.6136 +0.7367,-0.0000,0.2841,-0.6136 +0.7271,-0.0000,0.2830,-0.6255 +0.7271,-0.0000,0.2830,-0.6255 +0.7271,-0.0000,0.2830,-0.6255 +0.7271,-0.0000,0.2830,-0.6255 +0.7172,-0.0000,0.2819,-0.6373 +0.7172,-0.0000,0.2819,-0.6373 +0.7172,-0.0000,0.2819,-0.6373 +0.7172,-0.0000,0.2819,-0.6373 +0.7071,-0.0000,0.2808,-0.6490 +0.7071,-0.0000,0.2808,-0.6490 +0.7071,-0.0000,0.2808,-0.6490 +0.7071,-0.0000,0.2808,-0.6490 +0.6968,-0.0000,0.2798,-0.6604 +0.6968,-0.0000,0.2798,-0.6604 +0.6968,-0.0000,0.2798,-0.6604 +0.6968,-0.0000,0.2798,-0.6604 +0.6863,-0.0000,0.2788,-0.6718 +0.6863,-0.0000,0.2788,-0.6718 +0.6863,-0.0000,0.2788,-0.6718 +0.6863,-0.0000,0.2788,-0.6718 +0.6756,-0.0000,0.2779,-0.6829 +0.6756,-0.0000,0.2779,-0.6829 +0.6756,-0.0000,0.2779,-0.6829 +0.6756,-0.0000,0.2779,-0.6829 +0.6646,-0.0000,0.2769,-0.6940 +0.6646,-0.0000,0.2769,-0.6940 +0.6646,-0.0000,0.2769,-0.6940 +0.6646,-0.0000,0.2769,-0.6940 +0.6535,-0.0000,0.2761,-0.7048 +0.6535,-0.0000,0.2761,-0.7048 +0.6535,-0.0000,0.2761,-0.7048 +0.6535,-0.0000,0.2761,-0.7048 +0.6422,-0.0000,0.2752,-0.7155 +0.6422,-0.0000,0.2752,-0.7155 +0.6422,-0.0000,0.2752,-0.7155 +0.6422,-0.0000,0.2752,-0.7155 +0.6306,-0.0000,0.2744,-0.7260 +0.6306,-0.0000,0.2744,-0.7260 +0.6306,-0.0000,0.2744,-0.7260 +0.6306,-0.0000,0.2744,-0.7260 +0.6189,-0.0000,0.2737,-0.7363 +0.6189,-0.0000,0.2737,-0.7363 +0.6189,-0.0000,0.2737,-0.7363 +0.6189,-0.0000,0.2737,-0.7363 +0.6069,-0.0000,0.2730,-0.7464 +0.6069,-0.0000,0.2730,-0.7464 +0.6069,-0.0000,0.2730,-0.7464 +0.6069,-0.0000,0.2730,-0.7464 +0.5948,-0.0000,0.2723,-0.7563 +0.5948,-0.0000,0.2723,-0.7563 +0.5948,-0.0000,0.2723,-0.7563 +0.5948,-0.0000,0.2723,-0.7563 +0.5825,-0.0000,0.2716,-0.7661 +0.5825,-0.0000,0.2716,-0.7661 +0.5825,-0.0000,0.2716,-0.7661 +0.5825,-0.0000,0.2716,-0.7661 +0.5700,-0.0000,0.2710,-0.7756 +0.5700,-0.0000,0.2710,-0.7756 +0.5700,-0.0000,0.2710,-0.7756 +0.5700,-0.0000,0.2710,-0.7756 +0.5574,-0.0000,0.2705,-0.7850 +0.5574,-0.0000,0.2705,-0.7850 +0.5574,-0.0000,0.2705,-0.7850 +0.5574,-0.0000,0.2705,-0.7850 +0.5445,-0.0000,0.2700,-0.7941 +0.5445,-0.0000,0.2700,-0.7941 +0.5445,-0.0000,0.2700,-0.7941 +0.5445,-0.0000,0.2700,-0.7941 +0.5315,-0.0000,0.2695,-0.8030 +0.5315,-0.0000,0.2695,-0.8030 +0.5315,-0.0000,0.2695,-0.8030 +0.5315,-0.0000,0.2695,-0.8030 +0.5184,-0.0000,0.2691,-0.8117 +0.5184,-0.0000,0.2691,-0.8117 +0.5184,-0.0000,0.2691,-0.8117 +0.5184,-0.0000,0.2691,-0.8117 +0.5050,-0.0000,0.2687,-0.8202 +0.5050,-0.0000,0.2687,-0.8202 +0.5050,-0.0000,0.2687,-0.8202 +0.5050,-0.0000,0.2687,-0.8202 +0.4915,-0.0000,0.2684,-0.8285 +0.4915,-0.0000,0.2684,-0.8285 +0.4915,-0.0000,0.2684,-0.8285 +0.4915,-0.0000,0.2684,-0.8285 +0.4779,-0.0000,0.2682,-0.8365 +0.4779,-0.0000,0.2682,-0.8365 +0.4779,-0.0000,0.2682,-0.8365 +0.4779,-0.0000,0.2682,-0.8365 +0.4640,-0.0000,0.2680,-0.8443 +0.4640,-0.0000,0.2680,-0.8443 +0.4640,-0.0000,0.2680,-0.8443 +0.4640,-0.0000,0.2680,-0.8443 +0.4501,-0.0000,0.2678,-0.8519 +0.4501,-0.0000,0.2678,-0.8519 +0.4501,-0.0000,0.2678,-0.8519 +0.4501,-0.0000,0.2678,-0.8519 +0.4360,-0.0000,0.2677,-0.8592 +0.4360,-0.0000,0.2677,-0.8592 +0.4360,-0.0000,0.2677,-0.8592 +0.4360,-0.0000,0.2677,-0.8592 +0.4218,-0.0000,0.2677,-0.8663 +0.4218,-0.0000,0.2677,-0.8663 +0.4218,-0.0000,0.2677,-0.8663 +0.4218,-0.0000,0.2677,-0.8663 +0.4074,-0.0000,0.2677,-0.8731 +0.4074,-0.0000,0.2677,-0.8731 +0.4074,-0.0000,0.2677,-0.8731 +0.4074,-0.0000,0.2677,-0.8731 +0.3929,-0.0000,0.2678,-0.8797 +0.3929,-0.0000,0.2678,-0.8797 +0.3929,-0.0000,0.2678,-0.8797 +0.3929,-0.0000,0.2678,-0.8797 +0.3783,-0.0000,0.2680,-0.8860 +0.3783,-0.0000,0.2680,-0.8860 +0.3783,-0.0000,0.2680,-0.8860 +0.3783,-0.0000,0.2680,-0.8860 +0.3635,-0.0000,0.2683,-0.8921 +0.3635,-0.0000,0.2683,-0.8921 +0.3635,-0.0000,0.2683,-0.8921 +0.3635,-0.0000,0.2683,-0.8921 +0.3487,-0.0000,0.2687,-0.8979 +0.3487,-0.0000,0.2687,-0.8979 +0.3487,-0.0000,0.2687,-0.8979 +0.3487,-0.0000,0.2687,-0.8979 +0.3337,-0.0000,0.2692,-0.9034 +0.3337,-0.0000,0.2692,-0.9034 +0.3337,-0.0000,0.2692,-0.9034 +0.3337,-0.0000,0.2692,-0.9034 +0.3186,-0.0000,0.2698,-0.9087 +0.3186,-0.0000,0.2698,-0.9087 +0.3186,-0.0000,0.2698,-0.9087 +0.3186,-0.0000,0.2698,-0.9087 +0.3034,-0.0000,0.2705,-0.9136 +0.3034,-0.0000,0.2705,-0.9136 +0.3034,-0.0000,0.2705,-0.9136 +0.3034,-0.0000,0.2705,-0.9136 +0.2882,-0.0000,0.2714,-0.9183 +0.2882,-0.0000,0.2714,-0.9183 +0.2882,-0.0000,0.2714,-0.9183 +0.2882,-0.0000,0.2714,-0.9183 +0.2728,-0.0000,0.2725,-0.9227 +0.2728,-0.0000,0.2725,-0.9227 +0.2728,-0.0000,0.2725,-0.9227 +0.2728,-0.0000,0.2725,-0.9227 +0.2573,-0.0000,0.2738,-0.9267 +0.2573,-0.0000,0.2738,-0.9267 +0.2573,-0.0000,0.2738,-0.9267 +0.2573,-0.0000,0.2738,-0.9267 +0.2418,-0.0000,0.2753,-0.9305 +0.2418,-0.0000,0.2753,-0.9305 +0.2418,-0.0000,0.2753,-0.9305 +0.2418,-0.0000,0.2753,-0.9305 +0.2262,-0.0000,0.2771,-0.9339 +0.2262,-0.0000,0.2771,-0.9339 +0.2262,-0.0000,0.2771,-0.9339 +0.2262,-0.0000,0.2771,-0.9339 +0.2105,-0.0000,0.2792,-0.9369 +0.2105,-0.0000,0.2792,-0.9369 +0.2105,-0.0000,0.2792,-0.9369 +0.2105,-0.0000,0.2792,-0.9369 +0.1947,-0.0000,0.2818,-0.9395 +0.1947,-0.0000,0.2818,-0.9395 +0.1947,-0.0000,0.2818,-0.9395 +0.1947,-0.0000,0.2818,-0.9395 +0.1789,-0.0000,0.2848,-0.9417 +0.1789,-0.0000,0.2848,-0.9417 +0.1789,-0.0000,0.2848,-0.9417 +0.1789,-0.0000,0.2848,-0.9417 +0.1630,-0.0000,0.2886,-0.9435 +0.1630,-0.0000,0.2886,-0.9435 +0.1630,-0.0000,0.2886,-0.9435 +0.1630,-0.0000,0.2886,-0.9435 +0.1471,-0.0000,0.2933,-0.9446 +0.1471,-0.0000,0.2933,-0.9446 +0.1471,-0.0000,0.2933,-0.9446 +0.1471,-0.0000,0.2933,-0.9446 +0.1312,-0.0000,0.2991,-0.9452 +0.1312,-0.0000,0.2991,-0.9452 +0.1312,-0.0000,0.2991,-0.9452 +0.1312,-0.0000,0.2991,-0.9452 +0.1152,-0.0000,0.3067,-0.9448 +0.1152,-0.0000,0.3067,-0.9448 +0.1152,-0.0000,0.3067,-0.9448 +0.1152,-0.0000,0.3067,-0.9448 +0.0991,-0.0000,0.3167,-0.9433 +0.0991,-0.0000,0.3167,-0.9433 +0.0991,-0.0000,0.3167,-0.9433 +0.0991,-0.0000,0.3167,-0.9433 +0.0831,-0.0000,0.3307,-0.9401 +0.0831,-0.0000,0.3307,-0.9401 +0.0831,-0.0000,0.3307,-0.9401 +0.0831,-0.0000,0.3307,-0.9401 +0.0670,-0.0000,0.3514,-0.9338 +0.0670,-0.0000,0.3514,-0.9338 +0.0670,-0.0000,0.3514,-0.9338 +0.0670,-0.0000,0.3514,-0.9338 +0.0510,-0.0000,0.3848,-0.9216 +0.0510,-0.0000,0.3848,-0.9216 +0.0510,-0.0000,0.3848,-0.9216 +0.0510,-0.0000,0.3848,-0.9216 +0.0351,-0.0000,0.4473,-0.8937 +0.0351,-0.0000,0.4473,-0.8937 +0.0351,-0.0000,0.4473,-0.8937 +0.0351,-0.0000,0.4473,-0.8937 +0.0196,-0.0000,0.6000,-0.7997 +0.0196,-0.0000,0.6000,-0.7997 +0.0196,-0.0000,0.6000,-0.7997 +0.0196,-0.0000,0.6000,-0.7997 +0.0079,0.0000,1.0000,0.0001 +0.0079,0.0000,1.0000,0.0001 +0.0079,0.0000,1.0000,0.0001 +0.0079,0.0000,1.0000,0.0001 +0.0162,0.0000,0.2425,0.9700 +0.0162,0.0000,0.2425,0.9700 +0.0162,0.0000,0.2425,0.9700 +0.0162,0.0000,0.2425,0.9700 +0.0314,-0.0000,-0.0000,0.9995 +0.0314,-0.0000,-0.0000,0.9995 +0.0314,-0.0000,-0.0000,0.9995 +0.0314,-0.0000,-0.0000,0.9995 +0.0473,-0.0000,-0.0831,0.9954 +0.0473,-0.0000,-0.0831,0.9954 +0.0473,-0.0000,-0.0831,0.9954 +0.0473,-0.0000,-0.0831,0.9954 +0.0633,-0.0000,-0.1241,0.9902 +0.0633,-0.0000,-0.1241,0.9902 +0.0633,-0.0000,-0.1241,0.9902 +0.0633,-0.0000,-0.1241,0.9902 +0.0793,-0.0000,-0.1485,0.9857 +0.0793,-0.0000,-0.1485,0.9857 +0.0793,-0.0000,-0.1485,0.9857 +0.0793,-0.0000,-0.1485,0.9857 +0.0954,-0.0000,-0.1646,0.9817 +0.0954,-0.0000,-0.1646,0.9817 +0.0954,-0.0000,-0.1646,0.9817 +0.0954,-0.0000,-0.1646,0.9817 +0.1114,-0.0000,-0.1762,0.9780 +0.1114,-0.0000,-0.1762,0.9780 +0.1114,-0.0000,-0.1762,0.9780 +0.1114,-0.0000,-0.1762,0.9780 +0.1275,-0.0000,-0.1848,0.9745 +0.1275,-0.0000,-0.1848,0.9745 +0.1275,-0.0000,-0.1848,0.9745 +0.1275,-0.0000,-0.1848,0.9745 +0.1435,-0.0000,-0.1915,0.9709 +0.1435,-0.0000,-0.1915,0.9709 +0.1435,-0.0000,-0.1915,0.9709 +0.1435,-0.0000,-0.1915,0.9709 +0.1594,-0.0000,-0.1970,0.9674 +0.1594,-0.0000,-0.1970,0.9674 +0.1594,-0.0000,-0.1970,0.9674 +0.1594,-0.0000,-0.1970,0.9674 +0.1753,-0.0000,-0.2014,0.9637 +0.1753,-0.0000,-0.2014,0.9637 +0.1753,-0.0000,-0.2014,0.9637 +0.1753,-0.0000,-0.2014,0.9637 +0.1912,-0.0000,-0.2052,0.9599 +0.1912,-0.0000,-0.2052,0.9599 +0.1912,-0.0000,-0.2052,0.9599 +0.1912,-0.0000,-0.2052,0.9599 +0.2070,-0.0000,-0.2085,0.9559 +0.2070,-0.0000,-0.2085,0.9559 +0.2070,-0.0000,-0.2085,0.9559 +0.2070,-0.0000,-0.2085,0.9559 +0.2227,-0.0000,-0.2113,0.9517 +0.2227,-0.0000,-0.2113,0.9517 +0.2227,-0.0000,-0.2113,0.9517 +0.2227,-0.0000,-0.2113,0.9517 +0.2384,-0.0000,-0.2138,0.9473 +0.2384,-0.0000,-0.2138,0.9473 +0.2384,-0.0000,-0.2138,0.9473 +0.2384,-0.0000,-0.2138,0.9473 +0.2540,-0.0000,-0.2161,0.9428 +0.2540,-0.0000,-0.2161,0.9428 +0.2540,-0.0000,-0.2161,0.9428 +0.2540,-0.0000,-0.2161,0.9428 +0.2695,-0.0000,-0.2181,0.9380 +0.2695,-0.0000,-0.2181,0.9380 +0.2695,-0.0000,-0.2181,0.9380 +0.2695,-0.0000,-0.2181,0.9380 +0.2849,-0.0000,-0.2200,0.9330 +0.2849,-0.0000,-0.2200,0.9330 +0.2849,-0.0000,-0.2200,0.9330 +0.2849,-0.0000,-0.2200,0.9330 +0.3002,-0.0000,-0.2217,0.9277 +0.3002,-0.0000,-0.2217,0.9277 +0.3002,-0.0000,-0.2217,0.9277 +0.3002,-0.0000,-0.2217,0.9277 +0.3155,-0.0000,-0.2233,0.9223 +0.3155,-0.0000,-0.2233,0.9223 +0.3155,-0.0000,-0.2233,0.9223 +0.3155,-0.0000,-0.2233,0.9223 +0.3306,-0.0000,-0.2248,0.9166 +0.3306,-0.0000,-0.2248,0.9166 +0.3306,-0.0000,-0.2248,0.9166 +0.3306,-0.0000,-0.2248,0.9166 +0.3457,-0.0000,-0.2263,0.9107 +0.3457,-0.0000,-0.2263,0.9107 +0.3457,-0.0000,-0.2263,0.9107 +0.3457,-0.0000,-0.2263,0.9107 +0.3606,-0.0000,-0.2277,0.9045 +0.3606,-0.0000,-0.2277,0.9045 +0.3606,-0.0000,-0.2277,0.9045 +0.3606,-0.0000,-0.2277,0.9045 +0.3754,-0.0000,-0.2290,0.8981 +0.3754,-0.0000,-0.2290,0.8981 +0.3754,-0.0000,-0.2290,0.8981 +0.3754,-0.0000,-0.2290,0.8981 +0.3901,-0.0000,-0.2303,0.8915 +0.3901,-0.0000,-0.2303,0.8915 +0.3901,-0.0000,-0.2303,0.8915 +0.3901,-0.0000,-0.2303,0.8915 +0.4047,-0.0000,-0.2315,0.8847 +0.4047,-0.0000,-0.2315,0.8847 +0.4047,-0.0000,-0.2315,0.8847 +0.4047,-0.0000,-0.2315,0.8847 +0.4192,-0.0000,-0.2327,0.8776 +0.4192,-0.0000,-0.2327,0.8776 +0.4192,-0.0000,-0.2327,0.8776 +0.4192,-0.0000,-0.2327,0.8776 +0.4335,-0.0000,-0.2339,0.8703 +0.4335,-0.0000,-0.2339,0.8703 +0.4335,-0.0000,-0.2339,0.8703 +0.4335,-0.0000,-0.2339,0.8703 +0.4477,-0.0000,-0.2351,0.8627 +0.4477,-0.0000,-0.2351,0.8627 +0.4477,-0.0000,-0.2351,0.8627 +0.4477,-0.0000,-0.2351,0.8627 +0.4617,-0.0000,-0.2362,0.8550 +0.4617,-0.0000,-0.2362,0.8550 +0.4617,-0.0000,-0.2362,0.8550 +0.4617,-0.0000,-0.2362,0.8550 +0.4756,-0.0000,-0.2374,0.8470 +0.4756,-0.0000,-0.2374,0.8470 +0.4756,-0.0000,-0.2374,0.8470 +0.4756,-0.0000,-0.2374,0.8470 +0.4894,-0.0000,-0.2385,0.8388 +0.4894,-0.0000,-0.2385,0.8388 +0.4894,-0.0000,-0.2385,0.8388 +0.4894,-0.0000,-0.2385,0.8388 +0.5030,-0.0000,-0.2396,0.8304 +0.5030,-0.0000,-0.2396,0.8304 +0.5030,-0.0000,-0.2396,0.8304 +0.5030,-0.0000,-0.2396,0.8304 +0.5164,-0.0000,-0.2408,0.8218 +0.5164,-0.0000,-0.2408,0.8218 +0.5164,-0.0000,-0.2408,0.8218 +0.5164,-0.0000,-0.2408,0.8218 +0.5297,-0.0000,-0.2419,0.8130 +0.5297,-0.0000,-0.2419,0.8130 +0.5297,-0.0000,-0.2419,0.8130 +0.5297,-0.0000,-0.2419,0.8130 +0.5428,-0.0000,-0.2431,0.8039 +0.5428,-0.0000,-0.2431,0.8039 +0.5428,-0.0000,-0.2431,0.8039 +0.5428,-0.0000,-0.2431,0.8039 +0.5558,-0.0000,-0.2442,0.7947 +0.5558,-0.0000,-0.2442,0.7947 +0.5558,-0.0000,-0.2442,0.7947 +0.5558,-0.0000,-0.2442,0.7947 +0.5685,-0.0000,-0.2454,0.7852 +0.5685,-0.0000,-0.2454,0.7852 +0.5685,-0.0000,-0.2454,0.7852 +0.5685,-0.0000,-0.2454,0.7852 +0.5811,-0.0000,-0.2465,0.7756 +0.5811,-0.0000,-0.2465,0.7756 +0.5811,-0.0000,-0.2465,0.7756 +0.5811,-0.0000,-0.2465,0.7756 +0.5936,-0.0000,-0.2477,0.7657 +0.5936,-0.0000,-0.2477,0.7657 +0.5936,-0.0000,-0.2477,0.7657 +0.5936,-0.0000,-0.2477,0.7657 +0.6058,-0.0000,-0.2489,0.7557 +0.6058,-0.0000,-0.2489,0.7557 +0.6058,-0.0000,-0.2489,0.7557 +0.6058,-0.0000,-0.2489,0.7557 +0.6179,-0.0000,-0.2501,0.7455 +0.6179,-0.0000,-0.2501,0.7455 +0.6179,-0.0000,-0.2501,0.7455 +0.6179,-0.0000,-0.2501,0.7455 +0.6297,-0.0000,-0.2513,0.7351 +0.6297,-0.0000,-0.2513,0.7351 +0.6297,-0.0000,-0.2513,0.7351 +0.6297,-0.0000,-0.2513,0.7351 +0.6414,-0.0000,-0.2525,0.7245 +0.6414,-0.0000,-0.2525,0.7245 +0.6414,-0.0000,-0.2525,0.7245 +0.6414,-0.0000,-0.2525,0.7245 +0.6528,-0.0000,-0.2538,0.7137 +0.6528,-0.0000,-0.2538,0.7137 +0.6528,-0.0000,-0.2538,0.7137 +0.6528,-0.0000,-0.2538,0.7137 +0.6641,-0.0000,-0.2550,0.7028 +0.6641,-0.0000,-0.2550,0.7028 +0.6641,-0.0000,-0.2550,0.7028 +0.6641,-0.0000,-0.2550,0.7028 +0.6752,-0.0000,-0.2563,0.6917 +0.6752,-0.0000,-0.2563,0.6917 +0.6752,-0.0000,-0.2563,0.6917 +0.6752,-0.0000,-0.2563,0.6917 +0.6860,-0.0000,-0.2576,0.6804 +0.6860,-0.0000,-0.2576,0.6804 +0.6860,-0.0000,-0.2576,0.6804 +0.6860,-0.0000,-0.2576,0.6804 +0.6967,-0.0000,-0.2590,0.6690 +0.6967,-0.0000,-0.2590,0.6690 +0.6967,-0.0000,-0.2590,0.6690 +0.6967,-0.0000,-0.2590,0.6690 +0.7071,-0.0000,-0.2603,0.6575 +0.7071,-0.0000,-0.2603,0.6575 +0.7071,-0.0000,-0.2603,0.6575 +0.7071,-0.0000,-0.2603,0.6575 +0.7173,-0.0000,-0.2617,0.6457 +0.7173,-0.0000,-0.2617,0.6457 +0.7173,-0.0000,-0.2617,0.6457 +0.7173,-0.0000,-0.2617,0.6457 +0.7273,-0.0000,-0.2631,0.6339 +0.7273,-0.0000,-0.2631,0.6339 +0.7273,-0.0000,-0.2631,0.6339 +0.7273,-0.0000,-0.2631,0.6339 +0.7371,-0.0000,-0.2645,0.6219 +0.7371,-0.0000,-0.2645,0.6219 +0.7371,-0.0000,-0.2645,0.6219 +0.7371,-0.0000,-0.2645,0.6219 +0.7467,-0.0000,-0.2659,0.6097 +0.7467,-0.0000,-0.2659,0.6097 +0.7467,-0.0000,-0.2659,0.6097 +0.7467,-0.0000,-0.2659,0.6097 +0.7560,-0.0000,-0.2674,0.5974 +0.7560,-0.0000,-0.2674,0.5974 +0.7560,-0.0000,-0.2674,0.5974 +0.7560,-0.0000,-0.2674,0.5974 +0.7651,-0.0000,-0.2689,0.5851 +0.7651,-0.0000,-0.2689,0.5851 +0.7651,-0.0000,-0.2689,0.5851 +0.7651,-0.0000,-0.2689,0.5851 +0.7740,-0.0000,-0.2705,0.5725 +0.7740,-0.0000,-0.2705,0.5725 +0.7740,-0.0000,-0.2705,0.5725 +0.7740,-0.0000,-0.2705,0.5725 +0.7826,-0.0000,-0.2720,0.5599 +0.7826,-0.0000,-0.2720,0.5599 +0.7826,-0.0000,-0.2720,0.5599 +0.7826,-0.0000,-0.2720,0.5599 +0.7910,-0.0000,-0.2736,0.5472 +0.7910,-0.0000,-0.2736,0.5472 +0.7910,-0.0000,-0.2736,0.5472 +0.7910,-0.0000,-0.2736,0.5472 +0.7992,-0.0000,-0.2752,0.5343 +0.7992,-0.0000,-0.2752,0.5343 +0.7992,-0.0000,-0.2752,0.5343 +0.7992,-0.0000,-0.2752,0.5343 +0.8072,-0.0000,-0.2769,0.5214 +0.8072,-0.0000,-0.2769,0.5214 +0.8072,-0.0000,-0.2769,0.5214 +0.8072,-0.0000,-0.2769,0.5214 +0.8149,-0.0000,-0.2786,0.5083 +0.8149,-0.0000,-0.2786,0.5083 +0.8149,-0.0000,-0.2786,0.5083 +0.8149,-0.0000,-0.2786,0.5083 +0.8223,-0.0000,-0.2803,0.4952 +0.8223,-0.0000,-0.2803,0.4952 +0.8223,-0.0000,-0.2803,0.4952 +0.8223,-0.0000,-0.2803,0.4952 +0.8295,-0.0000,-0.2820,0.4820 +0.8295,-0.0000,-0.2820,0.4820 +0.8295,-0.0000,-0.2820,0.4820 +0.8295,-0.0000,-0.2820,0.4820 +0.8365,-0.0000,-0.2838,0.4687 +0.8365,-0.0000,-0.2838,0.4687 +0.8365,-0.0000,-0.2838,0.4687 +0.8365,-0.0000,-0.2838,0.4687 +0.8433,-0.0000,-0.2857,0.4553 +0.8433,-0.0000,-0.2857,0.4553 +0.8433,-0.0000,-0.2857,0.4553 +0.8433,-0.0000,-0.2857,0.4553 +0.8497,-0.0000,-0.2875,0.4419 +0.8497,-0.0000,-0.2875,0.4419 +0.8497,-0.0000,-0.2875,0.4419 +0.8497,-0.0000,-0.2875,0.4419 +0.8560,-0.0000,-0.2894,0.4284 +0.8560,-0.0000,-0.2894,0.4284 +0.8560,-0.0000,-0.2894,0.4284 +0.8560,-0.0000,-0.2894,0.4284 +0.8620,-0.0000,-0.2913,0.4148 +0.8620,-0.0000,-0.2913,0.4148 +0.8620,-0.0000,-0.2913,0.4148 +0.8620,-0.0000,-0.2913,0.4148 +0.8677,-0.0000,-0.2933,0.4012 +0.8677,-0.0000,-0.2933,0.4012 +0.8677,-0.0000,-0.2933,0.4012 +0.8677,-0.0000,-0.2933,0.4012 +0.8732,-0.0000,-0.2953,0.3876 +0.8732,-0.0000,-0.2953,0.3876 +0.8732,-0.0000,-0.2953,0.3876 +0.8732,-0.0000,-0.2953,0.3876 +0.8785,-0.0000,-0.2974,0.3739 +0.8785,-0.0000,-0.2974,0.3739 +0.8785,-0.0000,-0.2974,0.3739 +0.8785,-0.0000,-0.2974,0.3739 +0.8835,-0.0000,-0.2995,0.3602 +0.8835,-0.0000,-0.2995,0.3602 +0.8835,-0.0000,-0.2995,0.3602 +0.8835,-0.0000,-0.2995,0.3602 +0.8883,-0.0000,-0.3016,0.3465 +0.8883,-0.0000,-0.3016,0.3465 +0.8883,-0.0000,-0.3016,0.3465 +0.8883,-0.0000,-0.3016,0.3465 +0.8928,-0.0000,-0.3038,0.3327 +0.8928,-0.0000,-0.3038,0.3327 +0.8928,-0.0000,-0.3038,0.3327 +0.8928,-0.0000,-0.3038,0.3327 +0.8970,-0.0000,-0.3060,0.3189 +0.8970,-0.0000,-0.3060,0.3189 +0.8970,-0.0000,-0.3060,0.3189 +0.8970,-0.0000,-0.3060,0.3189 +0.9010,-0.0000,-0.3083,0.3051 +0.9010,-0.0000,-0.3083,0.3051 +0.9010,-0.0000,-0.3083,0.3051 +0.9010,-0.0000,-0.3083,0.3051 +0.9048,-0.0000,-0.3106,0.2913 +0.9048,-0.0000,-0.3106,0.2913 +0.9048,-0.0000,-0.3106,0.2913 +0.9048,-0.0000,-0.3106,0.2913 +0.9083,-0.0000,-0.3130,0.2776 +0.9083,-0.0000,-0.3130,0.2776 +0.9083,-0.0000,-0.3130,0.2776 +0.9083,-0.0000,-0.3130,0.2776 +0.9116,-0.0000,-0.3154,0.2638 +0.9116,-0.0000,-0.3154,0.2638 +0.9116,-0.0000,-0.3154,0.2638 +0.9116,-0.0000,-0.3154,0.2638 +0.9146,-0.0000,-0.3179,0.2500 +0.9146,-0.0000,-0.3179,0.2500 +0.9146,-0.0000,-0.3179,0.2500 +0.9146,-0.0000,-0.3179,0.2500 +0.9174,-0.0000,-0.3204,0.2363 +0.9174,-0.0000,-0.3204,0.2363 +0.9174,-0.0000,-0.3204,0.2363 +0.9174,-0.0000,-0.3204,0.2363 +0.9199,-0.0000,-0.3229,0.2226 +0.9199,-0.0000,-0.3229,0.2226 +0.9199,-0.0000,-0.3229,0.2226 +0.9199,-0.0000,-0.3229,0.2226 +0.9222,-0.0000,-0.3256,0.2089 +0.9222,-0.0000,-0.3256,0.2089 +0.9222,-0.0000,-0.3256,0.2089 +0.9222,-0.0000,-0.3256,0.2089 +0.9242,-0.0000,-0.3282,0.1952 +0.9242,-0.0000,-0.3282,0.1952 +0.9242,-0.0000,-0.3282,0.1952 +0.9242,-0.0000,-0.3282,0.1952 +0.9260,-0.0000,-0.3309,0.1817 +0.9260,-0.0000,-0.3309,0.1817 +0.9260,-0.0000,-0.3309,0.1817 +0.9260,-0.0000,-0.3309,0.1817 +0.9276,-0.0000,-0.3337,0.1681 +0.9276,-0.0000,-0.3337,0.1681 +0.9276,-0.0000,-0.3337,0.1681 +0.9276,-0.0000,-0.3337,0.1681 +0.9289,-0.0000,-0.3366,0.1546 +0.9289,-0.0000,-0.3366,0.1546 +0.9289,-0.0000,-0.3366,0.1546 +0.9289,-0.0000,-0.3366,0.1546 +0.9300,-0.0000,-0.3395,0.1412 +0.9300,-0.0000,-0.3395,0.1412 +0.9300,-0.0000,-0.3395,0.1412 +0.9300,-0.0000,-0.3395,0.1412 +0.9308,-0.0000,-0.3424,0.1279 +0.9308,-0.0000,-0.3424,0.1279 +0.9308,-0.0000,-0.3424,0.1279 +0.9308,-0.0000,-0.3424,0.1279 +0.9314,-0.0000,-0.3454,0.1146 +0.9314,-0.0000,-0.3454,0.1146 +0.9314,-0.0000,-0.3454,0.1146 +0.9314,-0.0000,-0.3454,0.1146 +0.9318,-0.0000,-0.3485,0.1015 +0.9318,-0.0000,-0.3485,0.1015 +0.9318,-0.0000,-0.3485,0.1015 +0.9318,-0.0000,-0.3485,0.1015 +0.9320,-0.0000,-0.3516,0.0884 +0.9320,-0.0000,-0.3516,0.0884 +0.9320,-0.0000,-0.3516,0.0884 +0.9320,-0.0000,-0.3516,0.0884 +0.9319,-0.0000,-0.3548,0.0754 +0.9319,-0.0000,-0.3548,0.0754 +0.9319,-0.0000,-0.3548,0.0754 +0.9319,-0.0000,-0.3548,0.0754 +0.9316,-0.0000,-0.3581,0.0625 +0.9316,-0.0000,-0.3581,0.0625 +0.9316,-0.0000,-0.3581,0.0625 +0.9316,-0.0000,-0.3581,0.0625 +0.9311,-0.0000,-0.3614,0.0498 +0.9311,-0.0000,-0.3614,0.0498 +0.9311,-0.0000,-0.3614,0.0498 +0.9311,-0.0000,-0.3614,0.0498 +0.9303,-0.0000,-0.3648,0.0371 +0.9303,-0.0000,-0.3648,0.0371 +0.9303,-0.0000,-0.3648,0.0371 +0.9303,-0.0000,-0.3648,0.0371 +0.9294,-0.0000,-0.3683,0.0246 +0.9294,-0.0000,-0.3683,0.0246 +0.9294,-0.0000,-0.3683,0.0246 +0.9294,-0.0000,-0.3683,0.0246 +0.9282,-0.0000,-0.3718,0.0122 +0.9282,-0.0000,-0.3718,0.0122 +0.9282,-0.0000,-0.3718,0.0122 +0.9282,-0.0000,-0.3718,0.0122 +0.9269,-0.0000,-0.3754,-0.0000 +0.9269,-0.0000,-0.3754,-0.0000 +0.9269,-0.0000,-0.3754,-0.0000 +0.9269,-0.0000,-0.3754,-0.0000 diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index d2a96f300a..a96fd08b33 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -96,6 +96,92 @@ def test_ambisonics_binaural_headrotation_refrotequal(test_info, in_fmt, out_fmt } ) +# This test compares rendering with: +# ref: head rotation trajectory file (OTR=NONE) +# cut: identical head rotation trajectory file as ref but in addition a constant +# reference vector in the looking direction of the coordinate system (OTR=REF_POS) +@pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_binaural_headrotation_refveczero(test_info, in_fmt, out_fmt, trj_file): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refveczero", + "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv") + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), + "refvec_file": HR_TRAJECTORY_DIR.joinpath("const000-Vector3.csv") + } + ) + +# This test compares rendering with: +# ref: no head rotation (OTR=NONE) +# cut: rendering with head rotation and a ref vector which moves in the +# looking-direction of the head rotation and therefore compensates it (OTR=REF_POS) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_binaural_headrotation_refvecequal(test_info, in_fmt, out_fmt): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refvecequal", + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s.csv"), + "refvec_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s-Vector3.csv") + } + ) + +# This test compares rendering with: +# ref: a head rotation trajectory with elevation (OTR=NONE) +# cut: a static head rotation and a reference position trajectory which moves +# in a way that produces the same acoustic output as the ref head rot trajectory (OTR=REF_POS) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_binaural_headrotation_refvec_rotating(test_info, in_fmt, out_fmt): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refvec_rotating", + "trj_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s.csv"), + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"), + "refvec_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s-ccw-Vector3.csv") + } + ) + +# This test compares rendering with: +# ref: a reference position trajectory with elevation and REF_POS_LEV OTR mode (OTR=REF_POS_LEV) +# cut: a reference position trajectory without the elevation and REF_POS OTR mode (OTR=REF_POS) +# Since the only difference between REF_POS_LEV and REF_POS is that *LEV ignores +# the height difference in positions, the output must be binary equivalent. +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_binaural_headrotation_refveclev_vs_refvec(test_info, in_fmt, out_fmt): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refveclevel", + "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"), + "refveclev_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s-Vector3.csv"), + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"), + "refvec_file": HR_TRAJECTORY_DIR.joinpath("full-circle-4s-Vector3.csv") + } + ) + """ Multichannel """ diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index 90a3353007..7a98dff300 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -107,6 +107,8 @@ def run_renderer( trj_file: Optional[str] = None, name_extension: Optional[str] = None, refrot_file: Optional[str] = None, + refvec_file: Optional[str] = None, + refveclev_file: Optional[str] = None, output_path_base: str = OUTPUT_PATH_CUT, binary_suffix: str = "", is_comparetest: Optional[bool] = False, @@ -122,6 +124,18 @@ def run_renderer( else: refrot_name = "" + if refvec_file is not None: + refvec_name = f"_{refvec_file.stem}" + else: + refvec_name = "" + + if refveclev_file is not None: + refveclev_name = f"_{refveclev_file.stem}" + else: + refveclev_name = "" + + + if not isinstance(out_fmt, str): out_name = f"{out_fmt.stem}" else: @@ -142,7 +156,7 @@ def run_renderer( in_file = FORMAT_TO_FILE[in_fmt] in_name = in_fmt - out_file = str(output_path_base.joinpath(f"{in_name}_to_{out_name}{trj_name}{refrot_name}{name_extension}.wav")) + out_file = str(output_path_base.joinpath(f"{in_name}_to_{out_name}{trj_name}{refrot_name}{refvec_name}{refveclev_name}{name_extension}.wav")) cmd = RENDERER_CMD[:] cmd[2] = str(in_file) @@ -162,6 +176,14 @@ def run_renderer( cmd.extend(["-rf", str(refrot_file)]) cmd.extend(["-otr", "ref"]) + if refvec_file is not None: + cmd.extend(["-rvf", str(refvec_file)]) + cmd.extend(["-otr", "ref_vec"]) + + if refveclev_file is not None: + cmd.extend(["-rvf", str(refveclev_file)]) + cmd.extend(["-otr", "ref_vec_lev"]) + run_cmd(cmd) return pyaudio3dtools.audiofile.readfile(out_file) -- GitLab From f12c7a5a87f78423730c060acac27dde9f6a32eb Mon Sep 17 00:00:00 2001 From: hsd Date: Thu, 23 Feb 2023 17:10:06 +0100 Subject: [PATCH 097/375] [remove] TD_REND_FIX_MSAN flag - issue has been resolved with recent merge from main --- lib_com/options.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index a5f2b4d2d5..b5fd112316 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -167,9 +167,6 @@ #define OTR_REFERENCE_VECTOR_TRACKING /* FhG: enables the reference position orientation tracking mode */ #endif #define TD_REND_FIX_DIV_BY_ZERO /* FhG: avoid division by zero in sincResample fn */ -#ifndef FIX_198_TDREND_INTERFACE -#define TD_REND_FIX_MSAN /* FhG: fixes uninitialized read in ivas_rend_TDObjRendOpen */ -#endif #define TD_TDREND_FIX_NULLPTR_ACCESS /* FhG: avoid nullptr access in ivas_rend_TDObjRendOpen */ /* ################## End DEVELOPMENT switches ######################### */ -- GitLab From ef8999bc85726342126de60c9f68a4ccb5369fbb Mon Sep 17 00:00:00 2001 From: Andrea Eichenseer Date: Thu, 23 Feb 2023 22:40:05 +0100 Subject: [PATCH 098/375] CNG fixes (force noise estimation for active frames, force FD_CNG for DiscISM) under DISC_CNG. --- lib_com/options.h | 1 + lib_dec/fd_cng_dec.c | 12 ++++++++++++ lib_dec/ivas_sce_dec.c | 4 ++++ lib_dec/ivas_tcx_core_dec.c | 4 ++++ 4 files changed, 21 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index f3ca408f40..83f7fb2123 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -164,6 +164,7 @@ /*#define MD_SMOOTH_PARAM_BE*/ /*#define DTX_PARAM_BE*/ #define UNIFY_MD_QUANTIZER +#define DISC_CNG /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 39b09921e9..4cf3b3c12b 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -414,6 +414,7 @@ void ApplyFdCng( hFdCngCom->sid_frame_counter = 0; /* set noise estimation inactive during concealment, as no update with noise generated by concealment should be performed. */ /* set noise estimation inactive when we have bit errors, as no update with noise generated by corrupt frame (biterror) should be performed. */ +#ifndef DISC_CNG if ( concealWholeFrame == 0 && ( timeDomainInput == NULL || ( *timeDomainInput( -FLT_MAX ) && @@ -423,6 +424,17 @@ void ApplyFdCng( !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || ( st->element_mode == IVAS_CPE_TD ) ) && ( !st->BER_detect ) ) +#else /* ensure that the noise estimation is always performed outside of a CNG part (ISM only) */ + if ( concealWholeFrame == 0 && + ( timeDomainInput == NULL || + ( *timeDomainInput( -FLT_MAX ) && + *( timeDomainInput + hFdCngCom->frameSize - 1 ) < FLT_MAX && + *( timeDomainInput + hFdCngCom->frameSize - 1 ) > ( -FLT_MAX ) ) ) && + ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && hFdCngDec->flag_dtx_mode ) || !st->VAD || !st->cng_paramISM_flag ) && + !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || + ( st->element_mode == IVAS_CPE_TD ) ) && + ( !st->BER_detect ) ) +#endif { /* Perform noise estimation at the decoder */ perform_noise_estimation_dec( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 7afbe5dc03..7d887fed87 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -78,7 +78,11 @@ ivas_error ivas_sce_dec( last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate; #ifdef PARAM_ISM_DTX_CNG +#ifdef DISC_CNG + if ( st_ivas->ivas_format == ISM_FORMAT ) +#else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) +#endif { st->cng_type = FD_CNG; /* TODO: move to init if possible */ } diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 378ddec9aa..fcca5f53dc 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -730,7 +730,11 @@ void stereo_tcx_core_dec( if ( st->element_mode != IVAS_CPE_TD ) { #ifdef PARAM_ISM_DTX_CNG +#ifndef DISC_CNG if ( ivas_format == ISM_FORMAT && ism_mode == ISM_MODE_PARAM ) +#else + if ( ivas_format == ISM_FORMAT ) +#endif { float buffer[L_FRAME16k]; lerp( signal_outFB, buffer, st->L_frame, hTcxDec->L_frameTCX ); -- GitLab From f1c7a0e5c9cd054fcbd98ce801f08f1831900cc1 Mon Sep 17 00:00:00 2001 From: hsd Date: Fri, 24 Feb 2023 08:34:16 +0100 Subject: [PATCH 099/375] [cleanup] REF_POS* OTR modes have been renamed to REF_VEC and these comments were missed in the refactoring --- tests/renderer/test_renderer.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index a96fd08b33..eec053a1aa 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -99,7 +99,7 @@ def test_ambisonics_binaural_headrotation_refrotequal(test_info, in_fmt, out_fmt # This test compares rendering with: # ref: head rotation trajectory file (OTR=NONE) # cut: identical head rotation trajectory file as ref but in addition a constant -# reference vector in the looking direction of the coordinate system (OTR=REF_POS) +# reference vector in the looking direction of the coordinate system (OTR=REF_VEC) @pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) @@ -121,7 +121,7 @@ def test_ambisonics_binaural_headrotation_refveczero(test_info, in_fmt, out_fmt, # This test compares rendering with: # ref: no head rotation (OTR=NONE) # cut: rendering with head rotation and a ref vector which moves in the -# looking-direction of the head rotation and therefore compensates it (OTR=REF_POS) +# looking-direction of the head rotation and therefore compensates it (OTR=REF_VEC) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_binaural_headrotation_refvecequal(test_info, in_fmt, out_fmt): @@ -141,7 +141,7 @@ def test_ambisonics_binaural_headrotation_refvecequal(test_info, in_fmt, out_fmt # This test compares rendering with: # ref: a head rotation trajectory with elevation (OTR=NONE) # cut: a static head rotation and a reference position trajectory which moves -# in a way that produces the same acoustic output as the ref head rot trajectory (OTR=REF_POS) +# in a way that produces the same acoustic output as the ref head rot trajectory (OTR=REF_VEC) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_binaural_headrotation_refvec_rotating(test_info, in_fmt, out_fmt): @@ -160,9 +160,9 @@ def test_ambisonics_binaural_headrotation_refvec_rotating(test_info, in_fmt, out ) # This test compares rendering with: -# ref: a reference position trajectory with elevation and REF_POS_LEV OTR mode (OTR=REF_POS_LEV) -# cut: a reference position trajectory without the elevation and REF_POS OTR mode (OTR=REF_POS) -# Since the only difference between REF_POS_LEV and REF_POS is that *LEV ignores +# ref: a reference position trajectory with elevation and REF_VEC_LEV OTR mode (OTR=REF_VEC_LEV) +# cut: a reference position trajectory without the elevation and REF_VEC OTR mode (OTR=REF_VEC) +# Since the only difference between REF_VEC_LEV and REF_VEC is that *LEV ignores # the height difference in positions, the output must be binary equivalent. @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) -- GitLab From d8efbebb168531b2404f73a593d6c8f84c93fc0b Mon Sep 17 00:00:00 2001 From: hsd Date: Fri, 24 Feb 2023 08:34:22 +0100 Subject: [PATCH 100/375] [add] multichannel reference vector test condition --- tests/renderer/test_renderer.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index eec053a1aa..fd228e0d21 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -221,6 +221,27 @@ def test_multichannel_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), ) +# This test compares rendering with: +# ref: a head rotation trajectory with elevation (OTR=NONE) +# cut: a static head rotation and a reference position trajectory which moves +# in a way that produces the same acoustic output as the ref head rot trajectory (OTR=REF_VEC) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) +def test_multichannel_binaural_headrotation_refvec_rotating(test_info, in_fmt, out_fmt): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refvec_rotating", + "trj_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s.csv"), + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"), + "refvec_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s-ccw-Vector3.csv") + } + ) + """ ISM """ -- GitLab From 3e71a499b4121906f3b6bf5f8337aa399e99b4f5 Mon Sep 17 00:00:00 2001 From: hsd Date: Fri, 24 Feb 2023 08:34:30 +0100 Subject: [PATCH 101/375] [add] ism reference vector test condition --- tests/renderer/test_renderer.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index fd228e0d21..9c5143e808 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -290,6 +290,33 @@ def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): in_meta_files=in_meta_files, ) +# This test compares rendering with: +# ref: a head rotation trajectory with elevation (OTR=NONE) +# cut: a static head rotation and a reference position trajectory which moves +# in a way that produces the same acoustic output as the ref head rot trajectory (OTR=REF_VEC) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) +def test_ism_binaural_headrotation_refvec_rotating(test_info, in_fmt, out_fmt): + try: + in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt] + except: + in_meta_files = None + + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refvec_rotating", + "trj_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s.csv"), + "in_meta_files": in_meta_files + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"), + "refvec_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s-ccw-Vector3.csv"), + "in_meta_files": in_meta_files + } + ) """ MASA """ -- GitLab From aa86e88bfad51c29a95eda2d2648d83af08f18b6 Mon Sep 17 00:00:00 2001 From: hsd Date: Fri, 24 Feb 2023 09:02:47 +0100 Subject: [PATCH 102/375] [fix] exclude mono and stereo since they're not supported --- tests/renderer/test_renderer.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index 9c5143e808..2a09faa9f5 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -228,6 +228,9 @@ def test_multichannel_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) def test_multichannel_binaural_headrotation_refvec_rotating(test_info, in_fmt, out_fmt): + if in_fmt in ["MONO", "STEREO"]: + pytest.skip("MONO or STEREO to Binaural rendering unsupported") + compare_renderer_args( test_info, in_fmt, -- GitLab From 01a6505662528a8a34b105bb1d228bd9de1a0254 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Fri, 24 Feb 2023 09:12:32 +0100 Subject: [PATCH 103/375] pass down orientation tracking struct for TD Object Renderer again - missing after FIX_198_TDREND_INTERFACE --- lib_dec/ivas_objectRenderer_internal.c | 17 ++++++++++-- lib_rend/ivas_objectRenderer.c | 37 +++++++++++++++++++++++--- lib_rend/ivas_prot_rend.h | 4 +++ 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index d2f08ffdd6..56986724f2 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -78,6 +78,19 @@ void ivas_td_binaural_renderer( st_ivas->hCrend, #endif st_ivas->transport_config, - st_ivas->hDecoderConfig->output_Fs, st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, - st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, output, output_frame ); + st_ivas->hDecoderConfig->output_Fs, + st_ivas->hBinRendererTd, + st_ivas->nchan_transport, + LFE_CHANNEL, + st_ivas->ivas_format, + st_ivas->hIsmMetaData, + st_ivas->hDecoderConfig->Opt_Headrotation, + ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, + output, + output_frame +#ifdef FIX_I109_ORIENTATION_TRACKING + , + st_ivas->hHeadTrackData->OrientationTracker +#endif + ); } diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index ce5dfe1ffa..7fcae1c0cc 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -240,6 +240,10 @@ void ivas_td_binaural_renderer_unwrap( const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ +#ifdef FIX_I109_ORIENTATION_TRACKING + , + ivas_orient_trk_state_t *pOTR /* i/o: orientation tracker handle */ +#endif ) { int16_t subframe_length; @@ -274,7 +278,18 @@ void ivas_td_binaural_renderer_unwrap( for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { /* Update the listener's location/orientation */ +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( pOTR != NULL ) + { + if ( ivas_orient_trk_Process( pOTR, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ) != IVAS_ERR_OK ) + { + exit( -1 ); + } + } + TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( pOTR != NULL ) ? &trackedHeadOrientation : NULL ); +#else TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL ); +#endif if ( ( hRenderConfig != NULL ) && ( hRenderConfig->roomAcoustics.late_reverb_on ) ) { @@ -632,9 +647,25 @@ ivas_error ivas_td_binaural_renderer_ext( #endif output_Fs = output_frame * 50; - ivas_td_binaural_renderer_unwrap( NULL, 1, NULL, transport_config, output_Fs, pTDRend->hBinRendererTd, num_src, lfe_idx, - ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, - output, output_frame ); + ivas_td_binaural_renderer_unwrap( NULL, + 1, + NULL, + transport_config, + output_Fs, + pTDRend->hBinRendererTd, + num_src, + lfe_idx, + ivas_format, + hIsmMetaData, + headRotData->headRotEnabled, + ( headRotData != NULL ) ? headRotData->headPositions : NULL, + output, + output_frame +#ifdef FIX_I109_ORIENTATION_TRACKING + , + headRotData->hOrientationTracker +#endif + ); pop_wmops(); diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index a05b0d470b..4712ccbf67 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -234,6 +234,10 @@ void ivas_td_binaural_renderer_unwrap( const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ +#ifdef FIX_I109_ORIENTATION_TRACKING + , + ivas_orient_trk_state_t *pOTR /* i/o: orientation tracker handle */ +#endif ); ivas_error ivas_td_binaural_renderer_ext( -- GitLab From 8eee193940d7371abe549ffe5e48543ac3f05f12 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Fri, 24 Feb 2023 10:25:58 +0200 Subject: [PATCH 104/375] Implementation of contribution 28 - adaptive transport audio signals for head tracked param-bin --- lib_com/options.h | 4 +- lib_dec/ivas_stat_dec.h | 4 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 95 ++++++++++++++++++++ lib_rend/ivas_hrtf.c | 7 ++ lib_rend/ivas_stat_rend.h | 5 ++ 5 files changed, 112 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9a6a9d4c5b..2b0f55cf35 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -143,7 +143,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define LOW_RATE_TRANS_CORE_CODER /* Eri: Activate low-rate-encoding-of-transients contribution for core coder, affects MC, MASA and SBA */ -#define FIX_197_CREND_INTERFACE +#define FIX_197_CREND_INTERFACE #define FIX_329_ENABLE_TD_RENDERER_REVERB_MC /* Eri: Enable reverb for TD renderer for 5.1 and 7.1 with headtracking enabled for IVAS_dec */ #define FIX_347_DTX_CRASH /* FhG: Fix crash that can happen with DTX */ #define DISABLE_RES_CHANNELS_MCT /* decode only W and residual for Y when outputting to stereo */ @@ -158,6 +158,8 @@ #define SMOOTH_WITH_TRANS_DET #endif +#define NOKIA_ADAPTIVE_BINAURAL_PROTOS + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 7c6ac19f7e..06b5775093 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1217,10 +1217,10 @@ typedef struct Decoder_Struct MONO_DOWNMIX_RENDERER_HANDLE hMonoDmxRenderer; /* Mono downmix structure */ #ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE hCrendWrapper; -#else +#else CREND_HANDLE hCrend; /* Convolution mixer renderer structure */ HRTFS_HANDLE hHrtf; /* HRTFs handle */ -#endif +#endif HRTFS_CREND_HANDLE hSetOfHRTF; /* Set of HRTFs handle (CRend) */ HRTFS_FASTCONV_HANDLE hHrtfFastConv; /* FASTCONV HRTF tables for binaural rendering */ HRTFS_PARAMBIN_HANDLE hHrtfParambin; /* HRTF tables for parametric binauralizer */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 020dd27cfa..a0a0f75efb 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -54,6 +54,14 @@ #define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN ( 2.0f ) #define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR ( 3.0f ) +#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS +#define ADAPT_HTPROTO_IIR_FAC 0.95f +#define ADAPT_HTPROTO_ILD_LIM_DB0 1.0f +#define ADAPT_HTPROTO_ILD_LIM_DB1 4.0f +#define ADAPT_HTPROTO_ROT_LIM_0 0.4f +#define ADAPT_HTPROTO_ROT_LIM_1 0.8f +#endif + /*------------------------------------------------------------------------- * Local function prototypes *------------------------------------------------------------------------*/ @@ -68,6 +76,10 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( Decoder_Struc static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float output_f[][L_FRAME48k], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const uint8_t numInputChannels, const uint8_t firstSlot, const uint8_t slotEnd ); +#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS +static void adaptTransportSignalsHeadtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, const uint8_t nBins, float Rmat[3][3] ); +#endif + static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, const uint8_t nBins, float Rmat[3][3] ); static void formulate2x2MixingMatrix( float Ein1, float Ein2, float CinRe, float CinIm, float Eout1, float Eout2, float CoutRe, float CoutIm, float Q[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], const float regularizationFactor ); @@ -562,6 +574,10 @@ static void ivas_dirac_dec_binaural_internal( if ( nchan_transport == 2 ) { +#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS + adaptTransportSignalsHeadtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, firstSlot, slotEnd, nBins, Rmat ); +#endif + ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( st_ivas->hHeadTrackData, Cldfb_ImagBuffer_in, Cldfb_RealBuffer_in, firstSlot, slotEnd, nBins, Rmat ); } } @@ -1332,6 +1348,85 @@ static void ivas_dirac_dec_binaural_process_output( } +#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS +static void adaptTransportSignalsHeadtracked( + HEAD_TRACK_DATA_HANDLE hHeadTrackData, + float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const uint8_t firstSlot, + const uint8_t slotEnd, + const uint8_t nBins, + float Rmat[3][3] ) +{ + int16_t slot, ch, bin, louderCh; + float re[2], im[2], ILD, mono_factor_ILD, mono_factor_rotation, mono_factor, y_val; + float proc_re[2], proc_im[2], sum_re, sum_im, ene_proc, ene_target, mf; + + /* Determine head-orientation-based mono factor. + Rmat[1][1] entry informs how close the ears are aligned according to transport signals. */ + y_val = 1.0f - fabsf( Rmat[1][1] ); + mono_factor_rotation = ( y_val - ADAPT_HTPROTO_ROT_LIM_0 ) / ( ADAPT_HTPROTO_ROT_LIM_1 - ADAPT_HTPROTO_ROT_LIM_0 ); + mono_factor_rotation = fmaxf( 0.0f, fminf( 1.0f, mono_factor_rotation ) ); + + /* Adapt transport signals in frequency bands */ + for ( slot = firstSlot; slot < slotEnd; slot++ ) + { + float eqVal[60]; + for ( bin = 0; bin < nBins; bin++ ) + { + /* Determine channel energies */ + for ( ch = 0; ch < 2; ch++ ) + { + re[ch] = inRe[ch][slot][bin]; + im[ch] = inIm[ch][slot][bin]; + + hHeadTrackData->chEneIIR[ch][bin] *= ADAPT_HTPROTO_IIR_FAC; + hHeadTrackData->chEneIIR[ch][bin] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * ( ( re[ch] * re[ch] ) + ( im[ch] * im[ch] ) ); + } + + /* Determine ILD */ + ILD = fabsf( 10.0f * log10f( fmaxf( 1e-12f, hHeadTrackData->chEneIIR[0][bin] ) / fmaxf( 1e-12f, hHeadTrackData->chEneIIR[1][bin] ) ) ); + louderCh = ( hHeadTrackData->chEneIIR[1][bin] > hHeadTrackData->chEneIIR[0][bin] ); + + /* Determine ILD-based mono factor */ + mono_factor_ILD = ( ILD - ADAPT_HTPROTO_ILD_LIM_DB0 ) / ( ADAPT_HTPROTO_ILD_LIM_DB1 - ADAPT_HTPROTO_ILD_LIM_DB0 ); + mono_factor_ILD = fmaxf( 0.0f, fminf( 1.0f, mono_factor_ILD ) ); + + /* Combine mono factors */ + mono_factor = mono_factor_ILD * mono_factor_rotation; + + /* Mix original audio and sum signal according to determined mono factor */ + sum_re = re[0] + re[1]; + sum_im = im[0] + im[1]; + for ( ch = 0; ch < 2; ch++ ) + { + mf = ( ch == louderCh ) ? 0.0f : mono_factor; + + proc_re[ch] = mf * sum_re + ( 1.0f - mf ) * re[ch]; + proc_im[ch] = mf * sum_im + ( 1.0f - mf ) * im[ch]; + + hHeadTrackData->procChEneIIR[ch][bin] *= ADAPT_HTPROTO_IIR_FAC; + hHeadTrackData->procChEneIIR[ch][bin] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * ( ( proc_re[ch] * proc_re[ch] ) + ( proc_im[ch] * proc_im[ch] ) ); + } + + /* Equalize */ + ene_target = hHeadTrackData->chEneIIR[0][bin] + hHeadTrackData->chEneIIR[1][bin]; + ene_proc = hHeadTrackData->procChEneIIR[0][bin] + hHeadTrackData->procChEneIIR[1][bin]; + eqVal[bin] = fminf( 4.0f, sqrtf( ene_target / fmaxf( 1e-12f, ene_proc ) ) ); + + for ( ch = 0; ch < 2; ch++ ) + { + inRe[ch][slot][bin] = proc_re[ch] * eqVal[bin]; + inIm[ch][slot][bin] = proc_im[ch] * eqVal[bin]; + } + } + } + + return; +} +#endif + + static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], diff --git a/lib_rend/ivas_hrtf.c b/lib_rend/ivas_hrtf.c index b53c636932..5a38af5514 100644 --- a/lib_rend/ivas_hrtf.c +++ b/lib_rend/ivas_hrtf.c @@ -235,5 +235,12 @@ ivas_error ivas_headTrack_open( ( *hHeadTrackData )->Rmat_prev[i][i] = 1.0f; } +#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS + set_zero( ( *hHeadTrackData )->chEneIIR[0], CLDFB_NO_CHANNELS_MAX ); + set_zero( ( *hHeadTrackData )->chEneIIR[1], CLDFB_NO_CHANNELS_MAX ); + set_zero( ( *hHeadTrackData )->procChEneIIR[0], CLDFB_NO_CHANNELS_MAX ); + set_zero( ( *hHeadTrackData )->procChEneIIR[1], CLDFB_NO_CHANNELS_MAX ); +#endif + return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 586a43c4f8..a00b3db4f0 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -245,6 +245,11 @@ typedef struct ivas_binaural_head_track_struct uint8_t lrSwitchedCurrent; float lrSwitchInterpVal; +#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS + float chEneIIR[2][CLDFB_NO_CHANNELS_MAX]; + float procChEneIIR[2][CLDFB_NO_CHANNELS_MAX]; +#endif + int16_t shd_rot_max_order; } HEAD_TRACK_DATA, *HEAD_TRACK_DATA_HANDLE; -- GitLab From b99cfc179ac67ce242ed142bbdb51b61e0502118 Mon Sep 17 00:00:00 2001 From: hsd Date: Fri, 24 Feb 2023 11:43:00 +0100 Subject: [PATCH 105/375] [mod] disabled self_test configs which test the new OTR tracking modes since these do not yet exist on main --- scripts/config/self_test.prm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 879cbd16f7..2fea55188f 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -474,12 +474,12 @@ //../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrAvg.tst // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit -../IVAS_dec -t trajectories/full-circle-4s.csv -rvf trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPos.tst +//../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit +//../IVAS_dec -t trajectories/full-circle-4s.csv -rvf trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPos.tst // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking in level mode -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit -../IVAS_dec -t trajectories/full-circle-with-up-and-down-4s.csv -rvf trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPosLev.tst +//../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit +//../IVAS_dec -t trajectories/full-circle-with-up-and-down-4s.csv -rvf trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPosLev.tst // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.pcm bit -- GitLab From 0abd16f8b34d6491413eb882f07d7575c22e012e Mon Sep 17 00:00:00 2001 From: hsd Date: Fri, 24 Feb 2023 11:44:35 +0100 Subject: [PATCH 106/375] [maintenance] clang-format --- lib_rend/ivas_rotation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 347e7331f8..6d78a07453 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -67,7 +67,7 @@ ivas_error ivas_headTrack_open( ( *hHeadTrackData )->lrSwitchedCurrent = 0; ( *hHeadTrackData )->lrSwitchedNext = 0; #ifdef FIX_I109_ORIENTATION_TRACKING - + if ( ( ( *hHeadTrackData )->OrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); -- GitLab From 74b62091888f0d05aa9b9546740feffd8cc9487b Mon Sep 17 00:00:00 2001 From: Andrea Eichenseer Date: Fri, 24 Feb 2023 12:01:52 +0100 Subject: [PATCH 107/375] Missing declaration of flag_noisy_speech when DISCRETE_ISM_DTX_CNG is inactive. --- lib_enc/ivas_ism_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 4fcf96e629..02456f2d03 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -93,7 +93,7 @@ ivas_error ivas_ism_enc( int16_t num_obj, dtx_flag, sid_flag, flag_noisy_speech; int16_t md_diff_flag[MAX_NUM_OBJECTS]; #else - int16_t dtx_flag, sid_flag; + int16_t dtx_flag, sid_flag, flag_noisy_speech; #endif #endif ivas_error error; -- GitLab From 8631ede83d3154fb84dc92422446681ec59b8b8e Mon Sep 17 00:00:00 2001 From: hsd Date: Fri, 24 Feb 2023 12:12:46 +0100 Subject: [PATCH 108/375] [fix] nullptr access in case st_ivas->hHeadTrackData is NULL --- lib_dec/ivas_objectRenderer_internal.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 56986724f2..f881afc668 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -71,6 +71,11 @@ void ivas_td_binaural_renderer( const int16_t output_frame /* i : output frame length */ ) { +#ifdef FIX_I109_ORIENTATION_TRACKING + ivas_orient_trk_state_t *pOtr = NULL; + if(st_ivas->hHeadTrackData != NULL) + pOtr = st_ivas->hHeadTrackData->OrientationTracker; +#endif ivas_td_binaural_renderer_unwrap( st_ivas->hRenderConfig, st_ivas->ini_frame, #ifdef FIX_197_CREND_INTERFACE st_ivas->hCrendWrapper, @@ -90,7 +95,7 @@ void ivas_td_binaural_renderer( output_frame #ifdef FIX_I109_ORIENTATION_TRACKING , - st_ivas->hHeadTrackData->OrientationTracker + pOtr #endif ); } -- GitLab From badeade26f637d9f3d1e5375fe9979b929bd740f Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Fri, 24 Feb 2023 14:07:50 +0200 Subject: [PATCH 109/375] Implementation of contribution 30 - adaptive regularization for param-bin --- lib_com/options.h | 2 + lib_rend/ivas_dirac_dec_binaural_functions.c | 95 ++++++++++++++++++++ lib_rend/ivas_stat_rend.h | 3 + 3 files changed, 100 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 9a6a9d4c5b..2efc55d1fc 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,6 +158,8 @@ #define SMOOTH_WITH_TRANS_DET #endif +#define NOKIA_PARAMBIN_REQULARIZATION /* Nokia: Contribution - Configured reqularization factor for parametric binauralizer. */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 020dd27cfa..0bfa43a1c3 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -80,6 +80,9 @@ static void matrixMul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Ai static void matrixTransp2Mul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); +#ifdef NOKIA_PARAMBIN_REQULARIZATION +static float configure_reqularization_factor( const IVAS_FORMAT ivas_format, const int32_t ivas_brate ); +#endif /*------------------------------------------------------------------------- * ivas_dirac_dec_init_binaural_data() @@ -283,6 +286,10 @@ ivas_error ivas_dirac_dec_init_binaural_data( ivas_td_decorr_dec_close( &( hBinaural->hTdDecorr ) ); } +#ifdef NOKIA_PARAMBIN_REQULARIZATION + hBinaural->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); +#endif + st_ivas->hDiracDecBin = hBinaural; return IVAS_ERR_OK; @@ -1079,11 +1086,19 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( CrEneR = 0.0f; /* Formulate main processing matrix M */ +#ifdef NOKIA_PARAMBIN_REQULARIZATION + formulate2x2MixingMatrix( h->ChEne[0][bin], h->ChEne[1][bin], + h->ChCrossRe[bin], h->ChCrossIm[bin], + h->ChEneOut[0][bin], h->ChEneOut[1][bin], + h->ChCrossReOut[bin], h->ChCrossImOut[bin], + prototypeMtx, Mre, Mim, h->reqularizationFactor ); +#else formulate2x2MixingMatrix( h->ChEne[0][bin], h->ChEne[1][bin], h->ChCrossRe[bin], h->ChCrossIm[bin], h->ChEneOut[0][bin], h->ChEneOut[1][bin], h->ChCrossReOut[bin], h->ChCrossImOut[bin], prototypeMtx, Mre, Mim, 1.0f ); +#endif /* Load estimated covariance matrix to the [2][2] matrix form */ CxRe[0][0] = h->ChEne[0][bin]; @@ -1869,3 +1884,83 @@ static void hrtfShGetHrtf( return; } + + +#ifdef NOKIA_PARAMBIN_REQULARIZATION +/*------------------------------------------------------------------------- + * configure_reqularization_factor() + * + * Configure regularization factor for the mixing matrix generation of the + * parametric binauralizer using IVAS codec format and current bitrate. + *------------------------------------------------------------------------*/ + +/*! r: Configured reqularization factor value to be set. */ +static float configure_reqularization_factor( + const IVAS_FORMAT ivas_format, /* i: IVAS codec format in use */ + const int32_t ivas_brate ) /* i: Current IVAS bitrate */ +{ + float reqularizationFactor; + reqularizationFactor = 1.0f; /* Default value */ + + if ( ivas_format == MASA_FORMAT ) + { + if ( ivas_brate >= IVAS_256k ) + { + reqularizationFactor = 0.2f; + } + else if ( ivas_brate == IVAS_192k ) + { + reqularizationFactor = 0.3f; + } + else if ( ivas_brate == IVAS_160k ) + { + reqularizationFactor = 0.4f; + } + else if ( ivas_brate == IVAS_128k ) + { + reqularizationFactor = 0.5f; + } + else if ( ivas_brate == IVAS_96k ) + { + reqularizationFactor = 0.6f; + } + else if ( ivas_brate >= IVAS_64k ) + { + reqularizationFactor = 0.8f; + } + else + { + reqularizationFactor = 1.0f; + } + } + + if ( ivas_format == MC_FORMAT ) /* This is always McMASA for parametric binauralizer. */ + { + if ( ivas_brate >= IVAS_96k ) + { + reqularizationFactor = 0.3f; + } + else if ( ivas_brate >= IVAS_80k ) + { + reqularizationFactor = 0.5f; + } + else if ( ivas_brate >= IVAS_64k ) + { + reqularizationFactor = 0.7f; + } + else if ( ivas_brate >= IVAS_48k ) + { + reqularizationFactor = 0.8f; + } + else + { + reqularizationFactor = 1.0f; + } + } + + /* For SBA and parametric ISM, currently in default value of 1.0f. */ + + return reqularizationFactor; +} +#endif + diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 586a43c4f8..ff431cb504 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -140,6 +140,9 @@ typedef struct ivas_dirac_dec_binaural_data_structure uint16_t useSubframeMode; /* 0 = process in 20 ms frames, 1 = process in 5 ms subframes */ uint16_t useTdDecorr; ivas_td_decorr_state_t *hTdDecorr; +#ifdef NOKIA_PARAMBIN_REQULARIZATION + float reqularizationFactor; +#endif } DIRAC_DEC_BIN_DATA, *DIRAC_DEC_BIN_HANDLE; -- GitLab From 2bf733f4db7e997293847bd664ada66fb7f2876c Mon Sep 17 00:00:00 2001 From: hsd Date: Fri, 24 Feb 2023 13:22:36 +0100 Subject: [PATCH 110/375] [maintenance] clang-format --- lib_dec/ivas_objectRenderer_internal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index f881afc668..7f11f8e3b5 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -72,9 +72,9 @@ void ivas_td_binaural_renderer( ) { #ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_state_t *pOtr = NULL; - if(st_ivas->hHeadTrackData != NULL) - pOtr = st_ivas->hHeadTrackData->OrientationTracker; + ivas_orient_trk_state_t *pOtr = NULL; + if ( st_ivas->hHeadTrackData != NULL ) + pOtr = st_ivas->hHeadTrackData->OrientationTracker; #endif ivas_td_binaural_renderer_unwrap( st_ivas->hRenderConfig, st_ivas->ini_frame, #ifdef FIX_197_CREND_INTERFACE -- GitLab From a4dabfe686f2d73ac3808412c6630bf51380a32d Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 24 Feb 2023 16:19:20 +0100 Subject: [PATCH 111/375] fix compilation with DISC_CNG being disabled --- lib_com/ivas_prot.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 02777f4290..f8177afc39 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -509,8 +509,8 @@ void stereo_tcx_core_dec( , const IVAS_FORMAT ivas_format /* i : IVAS format */ #ifndef DISC_CNG - const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM) */ - #endif + ,const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM) */ +#endif #endif ); -- GitLab From fcbc1c12f210597a2d606aca5452be9cf1528360 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Sat, 25 Feb 2023 01:23:12 +0100 Subject: [PATCH 112/375] Repair compilation without #FIX_I109 --- apps/renderer.c | 36 ++++++++++++++++++++++++++++++------ lib_rend/ivas_hrtf.c | 36 ------------------------------------ lib_rend/ivas_stat_rend.h | 30 ------------------------------ 3 files changed, 30 insertions(+), 72 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index b2047f4a12..7b039a122c 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -901,16 +901,28 @@ int main( #ifdef FIX_I109_ORIENTATION_TRACKING for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) { - HeadRotationFileReading( headRotReader, &quatBuffer[i] ); + if ( HeadRotationFileReading( headRotReader, &quatBuffer[i] ) != IVAS_ERR_OK ) + { + fprintf(stderr, "Error in Head Rotation File Reading.\r\n"); + exit(-1); + } } #else HeadRotationFileReading( headRotReader, quatBuffer, frame ); #endif - IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer ); + if ( IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer ) != IVAS_ERR_OK ) + { + fprintf(stderr, "Error setting Head Rotation.\r\n"); + exit(-1); + } } else { - IVAS_REND_SetHeadRotation( hIvasRend, NULL ); + if ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_OK ) + { + fprintf(stderr, "Error setting Head Rotation.\r\n"); + exit(-1); + } } #ifdef FIX_I109_ORIENTATION_TRACKING @@ -918,8 +930,16 @@ int main( if ( referenceRotReader != NULL ) { IVAS_QUATERNION quaternion; - HeadRotationFileReading( referenceRotReader, &quaternion ); - IVAS_REND_SetReferenceRotation( hIvasRend, quaternion ); + if ( HeadRotationFileReading( referenceRotReader, &quaternion ) != IVAS_ERR_OK ) + { + fprintf(stderr, "Error in Head Rotation File Reading.\r\n"); + exit(-1); + } + if ( IVAS_REND_SetReferenceRotation( hIvasRend, quaternion ) != IVAS_ERR_OK ) + { + fprintf(stderr, "Error setting Reference Rotation.\r\n"); + exit(-1); + } } #endif @@ -1000,7 +1020,11 @@ int main( } } - IVAS_REND_GetSamples( hIvasRend, outBuffer ); + if ( IVAS_REND_GetSamples( hIvasRend, outBuffer ) != IVAS_ERR_OK ) + { + fprintf(stderr, "Error in getting samples\n"); + exit( -1 ); + } int16_t num_out_channels; num_out_channels = outBuffer.config.numChannels; diff --git a/lib_rend/ivas_hrtf.c b/lib_rend/ivas_hrtf.c index 597270c458..d1ffa14d96 100644 --- a/lib_rend/ivas_hrtf.c +++ b/lib_rend/ivas_hrtf.c @@ -203,39 +203,3 @@ void ivas_HRTF_parambin_binary_close( return; } - -#ifndef FIX_I109_ORIENTATION_TRACKING -/*-----------------------------------------------------------------------* - * ivas_headTrack_open() - * - * Allocate and initialize Head-Tracking handle - *-----------------------------------------------------------------------*/ - -ivas_error ivas_headTrack_open( - HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* o : head track handle */ -) -{ - int16_t i; - - /* Allocate Head-Tracking handle */ - if ( ( *hHeadTrackData = (HEAD_TRACK_DATA_HANDLE) malloc( sizeof( HEAD_TRACK_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for head-tracking memory\n" ) ); - } - - /* Initialization */ - ( *hHeadTrackData )->num_quaternions = 0; - ( *hHeadTrackData )->lrSwitchInterpVal = 0.0f; - ( *hHeadTrackData )->lrSwitchedCurrent = 0; - ( *hHeadTrackData )->lrSwitchedNext = 0; - - /* Initialise Rmat_prev to I, Rmat will be computed later */ - for ( i = 0; i < 3; i++ ) - { - set_zero( ( *hHeadTrackData )->Rmat_prev[i], 3 ); - ( *hHeadTrackData )->Rmat_prev[i][i] = 1.0f; - } - - return IVAS_ERR_OK; -} -#endif diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 9b6285dd66..5f9c89ef7e 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -410,36 +410,6 @@ typedef struct ivas_reverb_state_t } REVERB_DATA, *REVERB_HANDLE; -#ifndef FIX_I109_ORIENTATION_TRACKING - -typedef struct ivas_orient_trk_state_t -{ - OTR_TRACKING_T trackingType; - float centerAdaptationRate; - float offCenterAdaptationRate; - float adaptationAngle; - - float alpha; - - float absYaw; /* absolute orientation */ - float absPitch; - float absRoll; - - float absAvgYaw; /* average absolute orientation */ - float absAvgPitch; - float absAvgRoll; - - float refYaw; /* reference orientation */ - float refPitch; - float refRoll; - - float trkYaw; /* tracked orientation */ - float trkPitch; - float trkRoll; - -} ivas_orient_trk_state_t; -#endif - /*----------------------------------------------------------------------------------* * TD ISm Object Renderer structure -- GitLab From cd112bf41b0b5b3aac3088d0a7290032e931e684 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Sat, 25 Feb 2023 02:16:31 +0100 Subject: [PATCH 113/375] fixed renderer errors, BUT error handling needs implementation re-enabled --- apps/renderer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 7b039a122c..3d585eb470 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -654,6 +654,7 @@ int main( /* === Configure === */ if ( ( error = IVAS_REND_InitConfig( hIvasRend, strlen( args.renderConfigFilePath ) != 0 ) ) != IVAS_ERR_OK ) { + fprintf( stderr, "Error in Renderer Config Init\n" ); exit( -1 ); } @@ -861,7 +862,7 @@ int main( if ( !args.quietModeEnabled ) { - fprintf( stdout, "\n------ Running the renderer ------\n\n" ); + fprintf( stdout, "\n------ Running the rondoror ------\n\n" ); fprintf( stdout, "Frames processed: " ); } else @@ -913,7 +914,7 @@ int main( if ( IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer ) != IVAS_ERR_OK ) { fprintf(stderr, "Error setting Head Rotation.\r\n"); - exit(-1); + //exit(-1); } } else @@ -921,7 +922,7 @@ int main( if ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_OK ) { fprintf(stderr, "Error setting Head Rotation.\r\n"); - exit(-1); + //exit(-1); } } -- GitLab From c49a73996247179b98ba3aadcf70708c755a8450 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Sat, 25 Feb 2023 03:05:35 +0100 Subject: [PATCH 114/375] enabled head rotation error checking except for the NULL case --- apps/renderer.c | 10 +++++----- lib_rend/lib_rend.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 3d585eb470..5c72bd3346 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -913,16 +913,16 @@ int main( #endif if ( IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer ) != IVAS_ERR_OK ) { - fprintf(stderr, "Error setting Head Rotation.\r\n"); - //exit(-1); + fprintf( stderr, "Error setting Head Rotation\n" ); + exit(-1); } } else { - if ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_OK ) + if ( ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_OK ) && ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_INVALID_OUTPUT_FORMAT) ) { - fprintf(stderr, "Error setting Head Rotation.\r\n"); - //exit(-1); + fprintf( stderr, "Error setting Head Rotation\n" ); + exit(-1); } } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 86b1c313ab..7c784c545a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3912,7 +3912,7 @@ ivas_error IVAS_REND_SetHeadRotation( if ( getAudioConfigType( hIvasRend->outputConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) { /* Head rotation can be set only with binaural output */ - return IVAS_ERR_METADATA_NOT_EXPECTED; + return IVAS_ERR_INVALID_OUTPUT_FORMAT; } if ( headRot == NULL ) -- GitLab From 9717c5bf05076ed4d2f863e98d4234a505d75e07 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Sat, 25 Feb 2023 03:55:18 +0100 Subject: [PATCH 115/375] appease CLANG --- apps/renderer.c | 20 ++++++++++---------- lib_dec/ivas_objectRenderer_internal.c | 6 +++--- lib_rend/ivas_hrtf.c | 1 - lib_rend/ivas_rotation.c | 1 - 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 5c72bd3346..fbe6d9987b 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -904,8 +904,8 @@ int main( { if ( HeadRotationFileReading( headRotReader, &quatBuffer[i] ) != IVAS_ERR_OK ) { - fprintf(stderr, "Error in Head Rotation File Reading.\r\n"); - exit(-1); + fprintf( stderr, "Error in Head Rotation File Reading.\r\n" ); + exit( -1 ); } } #else @@ -914,15 +914,15 @@ int main( if ( IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer ) != IVAS_ERR_OK ) { fprintf( stderr, "Error setting Head Rotation\n" ); - exit(-1); + exit( -1 ); } } else { - if ( ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_OK ) && ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_INVALID_OUTPUT_FORMAT) ) + if ( ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_OK ) && ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) { fprintf( stderr, "Error setting Head Rotation\n" ); - exit(-1); + exit( -1 ); } } @@ -933,13 +933,13 @@ int main( IVAS_QUATERNION quaternion; if ( HeadRotationFileReading( referenceRotReader, &quaternion ) != IVAS_ERR_OK ) { - fprintf(stderr, "Error in Head Rotation File Reading.\r\n"); - exit(-1); + fprintf( stderr, "Error in Head Rotation File Reading.\r\n" ); + exit( -1 ); } if ( IVAS_REND_SetReferenceRotation( hIvasRend, quaternion ) != IVAS_ERR_OK ) { - fprintf(stderr, "Error setting Reference Rotation.\r\n"); - exit(-1); + fprintf( stderr, "Error setting Reference Rotation.\r\n" ); + exit( -1 ); } } #endif @@ -1023,7 +1023,7 @@ int main( if ( IVAS_REND_GetSamples( hIvasRend, outBuffer ) != IVAS_ERR_OK ) { - fprintf(stderr, "Error in getting samples\n"); + fprintf( stderr, "Error in getting samples\n" ); exit( -1 ); } diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index f881afc668..b39be1c69c 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -72,9 +72,9 @@ void ivas_td_binaural_renderer( ) { #ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_state_t *pOtr = NULL; - if(st_ivas->hHeadTrackData != NULL) - pOtr = st_ivas->hHeadTrackData->OrientationTracker; + ivas_orient_trk_state_t *pOtr = NULL; + if(st_ivas->hHeadTrackData != NULL) + pOtr = st_ivas->hHeadTrackData->OrientationTracker; #endif ivas_td_binaural_renderer_unwrap( st_ivas->hRenderConfig, st_ivas->ini_frame, #ifdef FIX_197_CREND_INTERFACE diff --git a/lib_rend/ivas_hrtf.c b/lib_rend/ivas_hrtf.c index d1ffa14d96..e411d3bbbf 100644 --- a/lib_rend/ivas_hrtf.c +++ b/lib_rend/ivas_hrtf.c @@ -202,4 +202,3 @@ void ivas_HRTF_parambin_binary_close( return; } - diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 347e7331f8..90354497a0 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -67,7 +67,6 @@ ivas_error ivas_headTrack_open( ( *hHeadTrackData )->lrSwitchedCurrent = 0; ( *hHeadTrackData )->lrSwitchedNext = 0; #ifdef FIX_I109_ORIENTATION_TRACKING - if ( ( ( *hHeadTrackData )->OrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); -- GitLab From 5855167bc142559b267fd16780bae859edd4bb93 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Sat, 25 Feb 2023 04:04:54 +0100 Subject: [PATCH 116/375] encore --- lib_dec/ivas_objectRenderer_internal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index b39be1c69c..79dd9901ea 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -73,7 +73,7 @@ void ivas_td_binaural_renderer( { #ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_state_t *pOtr = NULL; - if(st_ivas->hHeadTrackData != NULL) + if( st_ivas->hHeadTrackData != NULL ) pOtr = st_ivas->hHeadTrackData->OrientationTracker; #endif ivas_td_binaural_renderer_unwrap( st_ivas->hRenderConfig, st_ivas->ini_frame, -- GitLab From 72b457e524365fa926ea03b45c6f31ebc7d852f8 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Sat, 25 Feb 2023 04:10:25 +0100 Subject: [PATCH 117/375] encore 2 --- lib_dec/ivas_objectRenderer_internal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 79dd9901ea..7f11f8e3b5 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -73,7 +73,7 @@ void ivas_td_binaural_renderer( { #ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_state_t *pOtr = NULL; - if( st_ivas->hHeadTrackData != NULL ) + if ( st_ivas->hHeadTrackData != NULL ) pOtr = st_ivas->hHeadTrackData->OrientationTracker; #endif ivas_td_binaural_renderer_unwrap( st_ivas->hRenderConfig, st_ivas->ini_frame, -- GitLab From 3a833e96bca6fb5c3da5046ac35334b4a3226f13 Mon Sep 17 00:00:00 2001 From: Andrea Eichenseer Date: Mon, 27 Feb 2023 18:13:11 +0100 Subject: [PATCH 118/375] Fix non-BE issues by removing cng_paramISM_flag from ApplyFdCng(). --- lib_dec/fd_cng_dec.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 4cf3b3c12b..39b09921e9 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -414,7 +414,6 @@ void ApplyFdCng( hFdCngCom->sid_frame_counter = 0; /* set noise estimation inactive during concealment, as no update with noise generated by concealment should be performed. */ /* set noise estimation inactive when we have bit errors, as no update with noise generated by corrupt frame (biterror) should be performed. */ -#ifndef DISC_CNG if ( concealWholeFrame == 0 && ( timeDomainInput == NULL || ( *timeDomainInput( -FLT_MAX ) && @@ -424,17 +423,6 @@ void ApplyFdCng( !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || ( st->element_mode == IVAS_CPE_TD ) ) && ( !st->BER_detect ) ) -#else /* ensure that the noise estimation is always performed outside of a CNG part (ISM only) */ - if ( concealWholeFrame == 0 && - ( timeDomainInput == NULL || - ( *timeDomainInput( -FLT_MAX ) && - *( timeDomainInput + hFdCngCom->frameSize - 1 ) < FLT_MAX && - *( timeDomainInput + hFdCngCom->frameSize - 1 ) > ( -FLT_MAX ) ) ) && - ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && hFdCngDec->flag_dtx_mode ) || !st->VAD || !st->cng_paramISM_flag ) && - !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || - ( st->element_mode == IVAS_CPE_TD ) ) && - ( !st->BER_detect ) ) -#endif { /* Perform noise estimation at the decoder */ perform_noise_estimation_dec( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); -- GitLab From 8408a13a9c069db408cf60099e4b880ee80f200c Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Tue, 28 Feb 2023 19:08:59 +0530 Subject: [PATCH 119/375] Address review comments:set 1 --- lib_com/ivas_fb_mixer.c | 229 +++++++++++++++++------------------- lib_dec/ivas_sba_dec.c | 13 +- lib_dec/ivas_spar_decoder.c | 95 +++++++-------- lib_enc/ivas_spar_encoder.c | 97 ++++++++------- 4 files changed, 195 insertions(+), 239 deletions(-) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 3eb11ec384..fa2f9af7fe 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -52,11 +52,7 @@ static void ivas_get_ld_fb_resp( float **ppIdeal_FRs_re, float **ppIdeal_FRs_im, static int16_t ivas_fb_mixer_get_band_diff_non48k( const int32_t sampling_rate, const float delay_ms ); static const float *ivas_get_cheby_ramp( const int16_t delay ); static void ivas_get_hanning_win( const int16_t len, float *pH_win ); -#ifdef SBA_BR_SWITCHING_CLEAN_UP -static ivas_error ivas_filterbank_setup( IVAS_FB_MIXER_HANDLE hFbMixer, const int32_t sampling_rate, const int16_t spar_reconfig_flag ); -#else static ivas_error ivas_filterbank_setup( IVAS_FB_MIXER_HANDLE hFbMixer, const int32_t sampling_rate ); -#endif static ivas_error ivas_fb_mixer_get_window( const int16_t fade_len, const int32_t sampling_rate, const float **pWindow ); @@ -346,14 +342,18 @@ ivas_error ivas_FB_mixer_open( #endif hFbMixer->fb_cfg = fb_cfg; #ifdef SBA_BR_SWITCHING_CLEAN_UP - if ( ( error = ivas_filterbank_setup( hFbMixer, sampling_rate, spar_reconfig_flag ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_filterbank_setup( hFbMixer, sampling_rate ) ) != IVAS_ERR_OK ) -#endif + set_s( hFbMixer->first_frame, 1, hFbMixer->fb_cfg->num_out_chans ); + set_s( hFbMixer->first_frame + hFbMixer->fb_cfg->num_out_chans, 0, IVAS_SPAR_MAX_CH - hFbMixer->fb_cfg->num_out_chans ); + if ( !spar_reconfig_flag ) { - return error; +#endif + if ( ( error = ivas_filterbank_setup( hFbMixer, sampling_rate ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef SBA_BR_SWITCHING_CLEAN_UP } - +#endif *hFbMixer_out = hFbMixer; return error; @@ -463,12 +463,6 @@ void ivas_FB_mixer_close( } } } -#ifdef SBA_BR_SWITCHING_CLEAN_UP - } - - if ( !spar_reconfig_flag ) - { -#endif if ( hFbMixer->pFb != NULL ) { free( hFbMixer->pFb ); @@ -1058,10 +1052,6 @@ static void ivas_get_active_bins( static ivas_error ivas_filterbank_setup( IVAS_FB_MIXER_HANDLE hFbMixer, const int32_t sampling_rate -#ifdef SBA_BR_SWITCHING_CLEAN_UP - , - const int16_t spar_reconfig_flag -#endif ) { int16_t i, j; @@ -1075,140 +1065,133 @@ static ivas_error ivas_filterbank_setup( IVAS_FB_CFG *pCfg = hFbMixer->fb_cfg; error = IVAS_ERR_OK; - +#ifndef SBA_BR_SWITCHING_CLEAN_UP set_s( hFbMixer->first_frame, 1, pCfg->num_out_chans ); set_s( hFbMixer->first_frame + pCfg->num_out_chans, 0, IVAS_SPAR_MAX_CH - pCfg->num_out_chans ); - -#ifdef SBA_BR_SWITCHING_CLEAN_UP - if ( !spar_reconfig_flag ) - { #endif - if ( pCfg->num_out_chans > 0 ) - { - hFbMixer->pFb->filterbank_num_bands = ivas_get_num_bands( sampling_rate ); - - ivas_get_active_bins( &pAll_bins_per_band, &pAll_bins_per_band_abs, &pAll_bins_start_offset, &pAll_bins_start_offset_abs, sampling_rate ); - - if ( pCfg->fb_latency == NS2SA( sampling_rate, DELAY_FB_1_NS ) ) - { - pAll_fb_fr[0] = ivas_fb_fr_12band_1ms_re; - pAll_fb_fr[1] = ivas_fb_fr_12band_1ms_im; - pAll_bins_per_band_48k = ivas_fb_bins_per_band_12band_1ms[0]; - } - else - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong FB in ivas_filterbank_setup()!" ); - } - } + if ( pCfg->num_out_chans > 0 ) + { + hFbMixer->pFb->filterbank_num_bands = ivas_get_num_bands( sampling_rate ); - hFbMixer->cross_fade_end_offset = pCfg->fade_len + pCfg->pcm_offset; - hFbMixer->cross_fade_start_offset = hFbMixer->cross_fade_end_offset - pCfg->fade_len; - hFbMixer->ana_window_offset = pCfg->fb_latency + pCfg->pcm_offset; + ivas_get_active_bins( &pAll_bins_per_band, &pAll_bins_per_band_abs, &pAll_bins_start_offset, &pAll_bins_start_offset_abs, sampling_rate ); - if ( ( error = ivas_fb_mixer_get_window( pCfg->fb_latency, sampling_rate, &( hFbMixer->pAna_window ) ) ) != IVAS_ERR_OK ) + if ( pCfg->fb_latency == NS2SA( sampling_rate, DELAY_FB_1_NS ) ) { - return error; + pAll_fb_fr[0] = ivas_fb_fr_12band_1ms_re; + pAll_fb_fr[1] = ivas_fb_fr_12band_1ms_im; + pAll_bins_per_band_48k = ivas_fb_bins_per_band_12band_1ms[0]; } - - if ( ( error = ivas_fb_mixer_get_window( pCfg->fade_len, sampling_rate, &( hFbMixer->pFilterbank_cross_fade ) ) ) != IVAS_ERR_OK ) + else { - return error; + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong FB in ivas_filterbank_setup()!" ); } - if ( pCfg->num_out_chans > 0 ) - { - ivas_filterbank_t *pFb = hFbMixer->pFb; - int16_t offset = 0; + } - pFb->fb_consts.pFilterbank_bins_per_band = pAll_bins_per_band; - pFb->fb_consts.pFilterbank_bins_start_offset = pAll_bins_start_offset; - pFb->fb_bin_to_band.pFb_active_bins_per_band = pAll_bins_per_band_abs; - pFb->fb_bin_to_band.pFb_start_bin_per_band = pAll_bins_start_offset_abs; + hFbMixer->cross_fade_end_offset = pCfg->fade_len + pCfg->pcm_offset; + hFbMixer->cross_fade_start_offset = hFbMixer->cross_fade_end_offset - pCfg->fade_len; + hFbMixer->ana_window_offset = pCfg->fb_latency + pCfg->pcm_offset; + + if ( ( error = ivas_fb_mixer_get_window( pCfg->fb_latency, sampling_rate, &( hFbMixer->pAna_window ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_fb_mixer_get_window( pCfg->fade_len, sampling_rate, &( hFbMixer->pFilterbank_cross_fade ) ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( pCfg->num_out_chans > 0 ) + { + ivas_filterbank_t *pFb = hFbMixer->pFb; + int16_t offset = 0; + + pFb->fb_consts.pFilterbank_bins_per_band = pAll_bins_per_band; + pFb->fb_consts.pFilterbank_bins_start_offset = pAll_bins_start_offset; + pFb->fb_bin_to_band.pFb_active_bins_per_band = pAll_bins_per_band_abs; + pFb->fb_bin_to_band.pFb_start_bin_per_band = pAll_bins_start_offset_abs; - /* Initialization for short stride Parameter calculation and SPAR CLDFB reconstruction */ - pFb->fb_bin_to_band.num_cldfb_bands = ( int16_t )( sampling_rate * INV_CLDFB_BANDWIDTH + 0.5f ); - /*pFb->fb_bin_to_band.cldfb_stride = ( int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX );*/ /* equals num_cldfb_bands*/ - pFb->fb_bin_to_band.short_stride = ( int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / 4 ); + /* Initialization for short stride Parameter calculation and SPAR CLDFB reconstruction */ + pFb->fb_bin_to_band.num_cldfb_bands = ( int16_t )( sampling_rate * INV_CLDFB_BANDWIDTH + 0.5f ); + /*pFb->fb_bin_to_band.cldfb_stride = ( int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX );*/ /* equals num_cldfb_bands*/ + pFb->fb_bin_to_band.short_stride = ( int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / 4 ); - set_f( pFb->fb_bin_to_band.p_short_stride_bin_to_band, 0.0f, 2 * MDFT_FB_BANDS_240 ); - set_s( pFb->fb_bin_to_band.p_cldfb_map_to_spar_band, 0, CLDFB_NO_CHANNELS_MAX ); - set_s( pFb->fb_bin_to_band.p_spar_start_bands, 0, CLDFB_NO_CHANNELS_MAX ); + set_f( pFb->fb_bin_to_band.p_short_stride_bin_to_band, 0.0f, 2 * MDFT_FB_BANDS_240 ); + set_s( pFb->fb_bin_to_band.p_cldfb_map_to_spar_band, 0, CLDFB_NO_CHANNELS_MAX ); + set_s( pFb->fb_bin_to_band.p_spar_start_bands, 0, CLDFB_NO_CHANNELS_MAX ); - for ( j = 0; j < IVAS_MAX_NUM_FB_BANDS; j++ ) + for ( j = 0; j < IVAS_MAX_NUM_FB_BANDS; j++ ) + { + pFb->fb_bin_to_band.p_short_stride_num_bins_per_band[j] = 0; /* aka num_active_bins per SPAR band */ + pFb->fb_bin_to_band.p_short_stride_start_bin_per_band[j] = 0; /* first considered bin index per SPAR band */ + pFb->fb_bin_to_band.pp_short_stride_bin_to_band[j] = NULL; + for ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) { - pFb->fb_bin_to_band.p_short_stride_num_bins_per_band[j] = 0; /* aka num_active_bins per SPAR band */ - pFb->fb_bin_to_band.p_short_stride_start_bin_per_band[j] = 0; /* first considered bin index per SPAR band */ - pFb->fb_bin_to_band.pp_short_stride_bin_to_band[j] = NULL; - for ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - pFb->fb_bin_to_band.pp_cldfb_weights_per_spar_band[i][j] = 0.0f; - } + pFb->fb_bin_to_band.pp_cldfb_weights_per_spar_band[i][j] = 0.0f; } - if ( sampling_rate == 48000 ) + } + if ( sampling_rate == 48000 ) + { + for ( j = 0; j < pFb->filterbank_num_bands; j++ ) { - for ( j = 0; j < pFb->filterbank_num_bands; j++ ) - { - pFb->fb_consts.ppFilterbank_FRs[0][j] = &pAll_fb_fr[0][offset]; - pFb->fb_consts.ppFilterbank_FRs[1][j] = &pAll_fb_fr[1][offset]; - offset += pFb->fb_consts.pFilterbank_bins_per_band[j]; - } - - ivas_calculate_abs_fr( pFb, sampling_rate, pCfg->active_w_mixing ); + pFb->fb_consts.ppFilterbank_FRs[0][j] = &pAll_fb_fr[0][offset]; + pFb->fb_consts.ppFilterbank_FRs[1][j] = &pAll_fb_fr[1][offset]; + offset += pFb->fb_consts.pFilterbank_bins_per_band[j]; } - else - { - float *ppFilterbank_FRs_re_temp[MAX_NUM_BANDS_DIFF_NON48K]; - float *ppFilterbank_FRs_im_temp[MAX_NUM_BANDS_DIFF_NON48K]; - int16_t active_bins_temp[MAX_NUM_BANDS_DIFF_NON48K]; - int16_t start_offset_temp[MAX_NUM_BANDS_DIFF_NON48K]; - int16_t num_diff_bands, start_diff_band_non48k; - num_diff_bands = MAX_NUM_BANDS_DIFF_NON48K; - start_diff_band_non48k = pFb->filterbank_num_bands - num_diff_bands; + ivas_calculate_abs_fr( pFb, sampling_rate, pCfg->active_w_mixing ); + } + else + { + float *ppFilterbank_FRs_re_temp[MAX_NUM_BANDS_DIFF_NON48K]; + float *ppFilterbank_FRs_im_temp[MAX_NUM_BANDS_DIFF_NON48K]; + int16_t active_bins_temp[MAX_NUM_BANDS_DIFF_NON48K]; + int16_t start_offset_temp[MAX_NUM_BANDS_DIFF_NON48K]; + int16_t num_diff_bands, start_diff_band_non48k; - pFb->fb_consts.pFilterbank_bins_per_band = pAll_bins_per_band; - pFb->fb_consts.pFilterbank_bins_start_offset = pAll_bins_start_offset; + num_diff_bands = MAX_NUM_BANDS_DIFF_NON48K; + start_diff_band_non48k = pFb->filterbank_num_bands - num_diff_bands; - for ( j = 0; j < pFb->filterbank_num_bands; j++ ) - { - int16_t num_active_bins = pFb->fb_consts.pFilterbank_bins_per_band[j]; + pFb->fb_consts.pFilterbank_bins_per_band = pAll_bins_per_band; + pFb->fb_consts.pFilterbank_bins_start_offset = pAll_bins_start_offset; - if ( j < start_diff_band_non48k ) - { - pFb->fb_consts.ppFilterbank_FRs[0][j] = &pAll_fb_fr[0][offset]; - pFb->fb_consts.ppFilterbank_FRs[1][j] = &pAll_fb_fr[1][offset]; - } - else - { - mvr2r( &pAll_fb_fr[0][offset], pFb->fb_consts.ppFilterbank_FRs_non48k[0][j], num_active_bins ); - mvr2r( &pAll_fb_fr[1][offset], pFb->fb_consts.ppFilterbank_FRs_non48k[1][j], num_active_bins ); - } + for ( j = 0; j < pFb->filterbank_num_bands; j++ ) + { + int16_t num_active_bins = pFb->fb_consts.pFilterbank_bins_per_band[j]; - offset += pAll_bins_per_band_48k[j]; + if ( j < start_diff_band_non48k ) + { + pFb->fb_consts.ppFilterbank_FRs[0][j] = &pAll_fb_fr[0][offset]; + pFb->fb_consts.ppFilterbank_FRs[1][j] = &pAll_fb_fr[1][offset]; } - - for ( j = start_diff_band_non48k; j < pFb->filterbank_num_bands; j++ ) + else { - ppFilterbank_FRs_re_temp[j - start_diff_band_non48k] = pFb->fb_consts.ppFilterbank_FRs_non48k[0][j]; - ppFilterbank_FRs_im_temp[j - start_diff_band_non48k] = pFb->fb_consts.ppFilterbank_FRs_non48k[1][j]; - active_bins_temp[j - start_diff_band_non48k] = pFb->fb_consts.pFilterbank_bins_per_band[j]; - start_offset_temp[j - start_diff_band_non48k] = pFb->fb_consts.pFilterbank_bins_start_offset[j]; + mvr2r( &pAll_fb_fr[0][offset], pFb->fb_consts.ppFilterbank_FRs_non48k[0][j], num_active_bins ); + mvr2r( &pAll_fb_fr[1][offset], pFb->fb_consts.ppFilterbank_FRs_non48k[1][j], num_active_bins ); } - ivas_get_ld_fb_resp( ppFilterbank_FRs_re_temp, ppFilterbank_FRs_im_temp, ppFilterbank_FRs_re_temp, ppFilterbank_FRs_im_temp, - active_bins_temp, start_offset_temp, num_diff_bands, pCfg->fb_latency, sampling_rate ); + offset += pAll_bins_per_band_48k[j]; + } - for ( j = start_diff_band_non48k; j < pFb->filterbank_num_bands; j++ ) - { - pFb->fb_consts.ppFilterbank_FRs[0][j] = (const float *) pFb->fb_consts.ppFilterbank_FRs_non48k[0][j]; - pFb->fb_consts.ppFilterbank_FRs[1][j] = (const float *) pFb->fb_consts.ppFilterbank_FRs_non48k[1][j]; - } + for ( j = start_diff_band_non48k; j < pFb->filterbank_num_bands; j++ ) + { + ppFilterbank_FRs_re_temp[j - start_diff_band_non48k] = pFb->fb_consts.ppFilterbank_FRs_non48k[0][j]; + ppFilterbank_FRs_im_temp[j - start_diff_band_non48k] = pFb->fb_consts.ppFilterbank_FRs_non48k[1][j]; + active_bins_temp[j - start_diff_band_non48k] = pFb->fb_consts.pFilterbank_bins_per_band[j]; + start_offset_temp[j - start_diff_band_non48k] = pFb->fb_consts.pFilterbank_bins_start_offset[j]; + } - ivas_calculate_abs_fr( pFb, sampling_rate, pCfg->active_w_mixing ); + ivas_get_ld_fb_resp( ppFilterbank_FRs_re_temp, ppFilterbank_FRs_im_temp, ppFilterbank_FRs_re_temp, ppFilterbank_FRs_im_temp, + active_bins_temp, start_offset_temp, num_diff_bands, pCfg->fb_latency, sampling_rate ); + + for ( j = start_diff_band_non48k; j < pFb->filterbank_num_bands; j++ ) + { + pFb->fb_consts.ppFilterbank_FRs[0][j] = (const float *) pFb->fb_consts.ppFilterbank_FRs_non48k[0][j]; + pFb->fb_consts.ppFilterbank_FRs[1][j] = (const float *) pFb->fb_consts.ppFilterbank_FRs_non48k[1][j]; } + + ivas_calculate_abs_fr( pFb, sampling_rate, pCfg->active_w_mixing ); } -#ifdef SBA_BR_SWITCHING_CLEAN_UP } -#endif return error; } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 1ea5cc1a92..87888b627a 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -719,16 +719,8 @@ ivas_error ivas_sba_dec_reconfigure( #else if ( hSpar != NULL ) { - if ( hDecoderConfig->ivas_total_brate == PCA_BRATE && sba_order_internal == 1 ) - { - if ( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for PCA decoder" ); - } - - ivas_pca_dec_init( hSpar->hPCA ); - } - else if ( hSpar->hPCA != NULL ) + if ( ( hSpar->hPCA != NULL ) + && ( ( hDecoderConfig->ivas_total_brate != PCA_BRATE) || (sba_order_internal != 1 ) ) ) { free( st_ivas->hSpar->hPCA ); hSpar->hPCA = NULL; @@ -972,7 +964,6 @@ ivas_error ivas_sba_dec_reconfigure( vbap_free_data( &( st_ivas->hVBAPdata ) ); } } - if ( st_ivas->hDirAC != NULL && st_ivas->sba_mode == SBA_MODE_SPAR ) { mvs2s( st_ivas->hDirAC->dirac_to_spar_md_bands, st_ivas->hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 464df9285d..2cf540d20d 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -124,30 +124,23 @@ ivas_error ivas_spar_dec_open( { return error; } -#ifdef SBA_BR_SWITCHING_CLEAN_UP - if ( !spar_reconfig_flag ) + /* AGC handle */ + if ( ( error = ivas_spar_agc_dec_open( &hSpar->hAgcDec, output_Fs ) ) != IVAS_ERR_OK ) { -#endif - /* AGC handle */ - if ( ( error = ivas_spar_agc_dec_open( &hSpar->hAgcDec, output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; + } - /* PCA handle */ - hSpar->hPCA = NULL; - if ( st_ivas->hDecoderConfig->ivas_total_brate == PCA_BRATE && sba_order_internal == 1 ) + /* PCA handle */ + hSpar->hPCA = NULL; + if ( st_ivas->hDecoderConfig->ivas_total_brate == PCA_BRATE && sba_order_internal == 1 ) + { + if ( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL ) { - if ( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for PCA decoder" ); - } - - ivas_pca_dec_init( hSpar->hPCA ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for PCA decoder" ); } -#ifdef SBA_BR_SWITCHING_CLEAN_UP + + ivas_pca_dec_init( hSpar->hPCA ); } -#endif /* mixer_mat intitialization */ for ( i = 0; i < num_channels_internal; i++ ) { @@ -164,35 +157,29 @@ ivas_error ivas_spar_dec_open( } } hSpar->i_subframe = 0; -#ifdef SBA_BR_SWITCHING_CLEAN_UP - if ( !spar_reconfig_flag ) - { -#endif - /*-----------------------------------------------------------------* - * Configuration - set SPAR high-level parameters - *-----------------------------------------------------------------*/ - ivas_spar_config( st_ivas->hDecoderConfig->ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, st_ivas->sid_format ); + /*-----------------------------------------------------------------* + * Configuration - set SPAR high-level parameters + *-----------------------------------------------------------------*/ - switch ( sba_order_internal ) - { - case 1: - st_ivas->transport_config = AUDIO_CONFIG_FOA; - break; - case 2: - st_ivas->transport_config = AUDIO_CONFIG_HOA2; - break; - case 3: - st_ivas->transport_config = AUDIO_CONFIG_HOA3; - break; - } - - ivas_output_init( &( st_ivas->hTransSetup ), st_ivas->transport_config ); + ivas_spar_config( st_ivas->hDecoderConfig->ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, st_ivas->sid_format ); - st_ivas->hSpar = hSpar; -#ifdef SBA_BR_SWITCHING_CLEAN_UP + switch ( sba_order_internal ) + { + case 1: + st_ivas->transport_config = AUDIO_CONFIG_FOA; + break; + case 2: + st_ivas->transport_config = AUDIO_CONFIG_HOA2; + break; + case 3: + st_ivas->transport_config = AUDIO_CONFIG_HOA3; + break; } -#endif + + ivas_output_init( &( st_ivas->hTransSetup ), st_ivas->transport_config ); + + st_ivas->hSpar = hSpar; return error; } @@ -226,20 +213,20 @@ void ivas_spar_dec_close( #else ivas_FB_mixer_close( &hSpar->hFbMixer, output_Fs ); #endif + + /* AGC */ + ivas_spar_agc_dec_close( &hSpar->hAgcDec ); + + /* PCA */ + if ( hSpar->hPCA != NULL ) + { + free( hSpar->hPCA ); + hSpar->hPCA = NULL; + } #ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { #endif - /* AGC */ - ivas_spar_agc_dec_close( &hSpar->hAgcDec ); - - /* PCA */ - if ( hSpar->hPCA != NULL ) - { - free( hSpar->hPCA ); - hSpar->hPCA = NULL; - } - free( hSpar ); hSpar = NULL; #ifdef SBA_BR_SWITCHING_CLEAN_UP diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 80bc9da9df..2ad33ef525 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -126,57 +126,51 @@ ivas_error ivas_spar_enc_open( { return error; } -#ifdef SBA_BR_SWITCHING_CLEAN_UP - /* initialization */ - hSpar->hMdEnc->table_idx = -1; - if ( !spar_reconfig_flag ) + /* Transient Detector handle */ + if ( ( error = ivas_spar_transient_det_open( &( hSpar->hTranDet ), input_Fs ) ) != IVAS_ERR_OK ) { -#endif - /* Transient Detector handle */ - if ( ( error = ivas_spar_transient_det_open( &( hSpar->hTranDet ), input_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; + } + + /* initialization */ + hSpar->hMdEnc->table_idx = -1; /* AGC handle */ #ifdef DEBUG_AGC_ENCODER_CMD_OPTION - hSpar->AGC_Enable = ivas_agc_enc_get_flag( hEncoderConfig->Opt_AGC_ON, nchan_transport ); + hSpar->AGC_Enable = ivas_agc_enc_get_flag( hEncoderConfig->Opt_AGC_ON, nchan_transport ); #else hSpar->AGC_Enable = ivas_agc_enc_get_flag( nchan_transport ); #endif - hSpar->hAgcEnc = NULL; - if ( hSpar->AGC_Enable ) + hSpar->hAgcEnc = NULL; + if ( hSpar->AGC_Enable ) + { + if ( ( error = ivas_spar_agc_enc_open( &hSpar->hAgcEnc, input_Fs, nchan_inp ) ) != IVAS_ERR_OK ) { - if ( ( error = ivas_spar_agc_enc_open( &hSpar->hAgcEnc, input_Fs, nchan_inp ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; } - /* PCA handle */ - hSpar->hPCA = NULL; - if ( hEncoderConfig->Opt_PCA_ON ) + } + + /* PCA handle */ + hSpar->hPCA = NULL; + if ( hEncoderConfig->Opt_PCA_ON ) + { + if ( ( hSpar->hPCA = (PCA_ENC_STATE *) malloc( sizeof( PCA_ENC_STATE ) ) ) == NULL ) { - if ( ( hSpar->hPCA = (PCA_ENC_STATE *) malloc( sizeof( PCA_ENC_STATE ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR PCA encoder" ); - } - ivas_pca_enc_init( hSpar->hPCA ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR PCA encoder" ); } -#ifndef SBA_BR_SWITCHING_CLEAN_UP - /* initialization */ - hSpar->hMdEnc->table_idx = -1; -#endif - /*-----------------------------------------------------------------* - * Configuration - set SPAR high-level parameters - *-----------------------------------------------------------------*/ - - ivas_spar_config( hEncoderConfig->ivas_total_brate, min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), - &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, -1 ); -#ifdef SBA_BR_SWITCHING_CLEAN_UP + ivas_pca_enc_init( hSpar->hPCA ); } -#endif + + /* initialization */ + hSpar->hMdEnc->table_idx = -1; + + /*-----------------------------------------------------------------* + * Configuration - set SPAR high-level parameters + *-----------------------------------------------------------------*/ + ivas_spar_config( hEncoderConfig->ivas_total_brate, min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), + &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, -1 ); if ( st_ivas->nchan_transport == 1 ) { hEncoderConfig->element_mode_init = IVAS_SCE; @@ -229,10 +223,11 @@ ivas_error ivas_spar_enc_open( * Final assignment *-----------------------------------------------------------------*/ - st_ivas->hSpar = hSpar; + #ifdef SBA_BR_SWITCHING_CLEAN_UP } #endif + st_ivas->hSpar = hSpar; return error; } @@ -291,23 +286,23 @@ void ivas_spar_enc_close( #else ivas_FB_mixer_close( &hSpar->hFbMixer, input_Fs ); #endif + + /* Trans Det handle */ + ivas_spar_transient_det_close( &hSpar->hTranDet ); + + /* AGC */ + ivas_spar_agc_enc_close( &hSpar->hAgcEnc ); + + /* PCA */ + if ( hSpar->hPCA != NULL ) + { + free( hSpar->hPCA ); + hSpar->hPCA = NULL; + } #ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { #endif - /* Trans Det handle */ - ivas_spar_transient_det_close( &hSpar->hTranDet ); - - /* AGC */ - ivas_spar_agc_enc_close( &hSpar->hAgcEnc ); - - /* PCA */ - if ( hSpar->hPCA != NULL ) - { - free( hSpar->hPCA ); - hSpar->hPCA = NULL; - } - free( hSpar ); hSpar = NULL; #ifdef SBA_BR_SWITCHING_CLEAN_UP -- GitLab From 687170eb3f1ab0800ac1279e2b082f2460e5f5f3 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Tue, 28 Feb 2023 15:28:25 +0100 Subject: [PATCH 120/375] commenting out future tests wasn't good enough --- scripts/config/self_test.prm | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 4b51a91cfb..93a0acce18 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -378,10 +378,6 @@ ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit ../IVAS_dec -t testv/headrot_case03_3000_q.csv BINAURAL 48 bit testv/stv4ISM48s.wav_256000_48-48_TDHR.tst -// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation, Orientation tracking -//../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.pcm bit -//../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR_OtrAvg.tst - // 1 ISm with metadata bitrate switching from 13.2 kbps to 128 kbps, 32 kHz in, 32 kHz out, mono out, DTX on ../IVAS_cod -dtx -ism 1 testv/stvISM1.csv ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv32c.wav bit ../IVAS_dec MONO 32 bit testv/stv32c.wav_brate_sw_32-32_mono_dtx.tst @@ -428,10 +424,6 @@ ../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit ../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_Binaural_Headrot.tst -// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation, Orientation tracking -//../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.pcm bit -//../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot_OtrAvg.tst - // SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.wav bit ../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_FEC5.tst @@ -476,10 +468,6 @@ ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Headrot.tst -// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking -//../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit -//../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrAvg.tst - // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit ../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural_FEC5.tst @@ -536,10 +524,6 @@ ../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.wav_SBA_128000_32-32_Binaural_room_Headrot.tst -// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking -//../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.pcm bit -//../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_OtrAvg.tst - // SBA at 192 kbps, 48kHz in, 48kHz out, HOA2 out, random FEC at 5% ../IVAS_cod -sba 3 192000 48 testv/stv3OA48c.wav bit ../IVAS_dec -fec 5 HOA2 48 bit testv/stv3OA48c.wav_SBA_192000_48-48_HOA2_FEC5.tst @@ -674,10 +658,6 @@ ../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom_Headrot.tst -// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking -//../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -//../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_OtrAvg.tst - // MASA 1dir 2TC at 48 kbps, 48kHz in, 48kHz out, 7_1_4 out, random FEC at 5% ../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 48000 48 testv/stv1MASA2TC48c.wav bit ../IVAS_dec -fec 5 7_1_4 48 bit testv/stv1MASA2TC48c.wav_48000_48-48_7_1_4_FEC5.tst @@ -816,10 +796,6 @@ ../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv51MC48c.wav_MC51_256000_48-48_BinauralRoom_Headrot.tst -// Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, head rotation, Orientation tracking -//../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit -//../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot_OtrAvg.tst - // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out ../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.wav bit ../IVAS_dec 5_1 48 bit testv/stv51MC48c.wav_MC51_384000_48-48_5_1.tst -- GitLab From 6e18482381e693225057d91e1b2505ae1b01dda5 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Wed, 1 Mar 2023 11:38:07 +0530 Subject: [PATCH 121/375] Reverting one change --- lib_enc/ivas_spar_encoder.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 2ad33ef525..557748be0b 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -126,13 +126,18 @@ ivas_error ivas_spar_enc_open( { return error; } - - /* Transient Detector handle */ - if ( ( error = ivas_spar_transient_det_open( &( hSpar->hTranDet ), input_Fs ) ) != IVAS_ERR_OK ) +#ifdef SBA_BR_SWITCHING_CLEAN_UP + if ( !spar_reconfig_flag ) { - return error; +#endif + /* Transient Detector handle */ + if ( ( error = ivas_spar_transient_det_open( &( hSpar->hTranDet ), input_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef SBA_BR_SWITCHING_CLEAN_UP } - +#endif /* initialization */ hSpar->hMdEnc->table_idx = -1; @@ -286,10 +291,10 @@ void ivas_spar_enc_close( #else ivas_FB_mixer_close( &hSpar->hFbMixer, input_Fs ); #endif - +#ifndef SBA_BR_SWITCHING_CLEAN_UP /* Trans Det handle */ ivas_spar_transient_det_close( &hSpar->hTranDet ); - +#endif /* AGC */ ivas_spar_agc_enc_close( &hSpar->hAgcEnc ); @@ -302,6 +307,8 @@ void ivas_spar_enc_close( #ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { + /* Trans Det handle */ + ivas_spar_transient_det_close( &hSpar->hTranDet ); #endif free( hSpar ); hSpar = NULL; -- GitLab From b62d99abf4de0531a716d6c79c62bdf4707a31d5 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 1 Mar 2023 09:08:27 +0100 Subject: [PATCH 122/375] - "const" to function input parameters - define local function as static --- lib_com/prot.h | 84 ++++++++++++++--------------- lib_com/tns_base.c | 60 ++++++++++----------- lib_dec/fd_cng_dec.c | 10 +++- lib_dec/ivas_stereo_mdct_core_dec.c | 2 + 4 files changed, 81 insertions(+), 75 deletions(-) diff --git a/lib_com/prot.h b/lib_com/prot.h index f9ec0e4b9f..16d069759f 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -8663,17 +8663,13 @@ void ApplyFdCng( const int16_t concealWholeFrame, /* i : binary flag indicating frame loss */ const int16_t is_music ); -void perform_noise_estimation_dec( - const float *timeDomainInput, - float *power_spectrum, - HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: FD_CNG structure */ - const int16_t element_mode, /* i : element mode type */ - const int16_t bwidth, /* i : audio bandwidth */ - const int16_t L_frame, /* i : frame length at internal Fs */ - const int16_t last_L_frame, /* i : frame length of the last frame at internal Fs */ - const int32_t last_core_brate, /* i : previous frame core bitrate */ - const int16_t VAD /* i : VAD flag in the decoder */ +void generate_comfort_noise_dec( + float **bufferReal, /* o : Real part of input bands */ + float **bufferImag, /* o : Imaginary part of input bands */ + Decoder_State *st, /* i/o: decoder state structure */ + const int16_t nchan_out /* i : number of output channels */ ); + /*! r: CNG energy */ float cng_energy( const int16_t element_mode, /* i : element mode */ @@ -8777,40 +8773,40 @@ void ReadFromBitstream( int16_t **pStream, int16_t *pnSize ); -void const *GetTnsFilterOrder( void const *p, int16_t index, int16_t *pValue ); -void *SetTnsFilterOrder( void *p, int16_t index, int16_t value ); -void const *GetNumOfTnsFilters( void const *p, int16_t index, int16_t *pValue ); -void *SetNumOfTnsFilters( void *p, int16_t index, int16_t value ); -void const *GetTnsEnabled( void const *p, int16_t index, int16_t *pValue ); -void *SetTnsEnabled( void *p, int16_t index, int16_t value ); -void const *GetTnsEnabledSingleFilter( void const *p, int16_t index, int16_t *pValue ); -void *SetTnsEnabledSingleFilter( void *p, int16_t index, int16_t value ); -void const *GetTnsFilterCoeff( void const *p, int16_t index, int16_t *pValue ); -void *SetTnsFilterCoeff( void *p, int16_t index, int16_t value ); - -void const *GetTnsOnWhite( void const *p, int16_t index, int16_t *pValue ); -void *SetTnsOnWhite( void *p, int16_t index, int16_t value ); - -int16_t GetSWBTCX10TnsFilterCoeffBits( int16_t value, int16_t index ); -int16_t EncodeSWBTCX10TnsFilterCoeff( int16_t value, int16_t index ); -int16_t DecodeSWBTCX10TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue ); -int16_t GetSWBTCX20TnsFilterCoeffBits( int16_t value, int16_t index ); -int16_t EncodeSWBTCX20TnsFilterCoeff( int16_t value, int16_t index ); -int16_t DecodeSWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue ); - -int16_t GetWBTCX20TnsFilterCoeffBits( int16_t value, int16_t index ); -int16_t EncodeWBTCX20TnsFilterCoeff( int16_t, int16_t index ); -int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue ); - -int16_t GetTnsFilterOrderBitsSWBTCX10( int16_t value, int16_t index ); -int16_t EncodeTnsFilterOrderSWBTCX10( int16_t value, int16_t index ); -int16_t DecodeTnsFilterOrderSWBTCX10( Decoder_State *st, int16_t index, int16_t *pValue ); -int16_t GetTnsFilterOrderBitsSWBTCX20( int16_t value, int16_t index ); -int16_t EncodeTnsFilterOrderSWBTCX20( int16_t value, int16_t index ); -int16_t DecodeTnsFilterOrderSWBTCX20( Decoder_State *st, int16_t index, int16_t *pValue ); -int16_t GetTnsFilterOrderBits( int16_t value, int16_t index ); -int16_t EncodeTnsFilterOrder( int16_t value, int16_t index ); -int16_t DecodeTnsFilterOrder( Decoder_State *st, int16_t index, int16_t *pValue ); +void const *GetTnsFilterOrder( void const *p, const int16_t index, int16_t *pValue ); +void *SetTnsFilterOrder( void *p, const int16_t index, const int16_t value ); +void const *GetNumOfTnsFilters( void const *p, const int16_t index, int16_t *pValue ); +void *SetNumOfTnsFilters( void *p, const int16_t index, const int16_t value ); +void const *GetTnsEnabled( void const *p, const int16_t index, int16_t *pValue ); +void *SetTnsEnabled( void *p, const int16_t index, const int16_t value ); +void const *GetTnsEnabledSingleFilter( void const *p, const int16_t index, int16_t *pValue ); +void *SetTnsEnabledSingleFilter( void *p, const int16_t index, const int16_t value ); +void const *GetTnsFilterCoeff( void const *p, const int16_t index, int16_t *pValue ); +void *SetTnsFilterCoeff( void *p, const int16_t index, const int16_t value ); + +void const *GetTnsOnWhite( void const *p, const int16_t index, int16_t *pValue ); +void *SetTnsOnWhite( void *p, const int16_t index, const int16_t value ); + +int16_t GetSWBTCX10TnsFilterCoeffBits( const int16_t value, const int16_t index ); +int16_t EncodeSWBTCX10TnsFilterCoeff( const int16_t value, const int16_t index ); +int16_t DecodeSWBTCX10TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue ); +int16_t GetSWBTCX20TnsFilterCoeffBits( const int16_t value, const int16_t index ); +int16_t EncodeSWBTCX20TnsFilterCoeff( const int16_t value, const int16_t index ); +int16_t DecodeSWBTCX20TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue ); + +int16_t GetWBTCX20TnsFilterCoeffBits( const int16_t value, const int16_t index ); +int16_t EncodeWBTCX20TnsFilterCoeff( const int16_t, const int16_t index ); +int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue ); + +int16_t GetTnsFilterOrderBitsSWBTCX10( const int16_t value, const int16_t index ); +int16_t EncodeTnsFilterOrderSWBTCX10( const int16_t value, const int16_t index ); +int16_t DecodeTnsFilterOrderSWBTCX10( Decoder_State *st, const int16_t index, int16_t *pValue ); +int16_t GetTnsFilterOrderBitsSWBTCX20( const int16_t value, const int16_t index ); +int16_t EncodeTnsFilterOrderSWBTCX20( const int16_t value, const int16_t index ); +int16_t DecodeTnsFilterOrderSWBTCX20( Decoder_State *st, const int16_t index, int16_t *pValue ); +int16_t GetTnsFilterOrderBits( const int16_t value, const int16_t index ); +int16_t EncodeTnsFilterOrder( const int16_t value, const int16_t index ); +int16_t DecodeTnsFilterOrder( Decoder_State *st, const int16_t index, int16_t *pValue ); void ResetTnsData( STnsData *pTnsData ); diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index 881d7845ca..20e679c316 100644 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -287,67 +287,67 @@ static int16_t DecodeUsingTable( Decoder_State *st, int16_t *pValue, const Codin /* TNS filter coefficients */ -void const *GetTnsFilterCoeff( void const *p, int16_t index, int16_t *pValue ) +void const *GetTnsFilterCoeff( void const *p, const int16_t index, int16_t *pValue ) { *pValue = ( (int16_t const *) p )[index] + INDEX_SHIFT; return NULL; } -void *SetTnsFilterCoeff( void *p, int16_t index, int16_t value ) +void *SetTnsFilterCoeff( void *p, const int16_t index, const int16_t value ) { ( (int16_t *) p )[index] = value - INDEX_SHIFT; return NULL; } -int16_t GetSWBTCX20TnsFilterCoeffBits( int16_t value, int16_t index ) +int16_t GetSWBTCX20TnsFilterCoeffBits( const int16_t value, const int16_t index ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return GetBitsFromTable( value, codesTnsCoeffSWBTCX20[index], nTnsCoeffCodes ); } -int16_t EncodeSWBTCX20TnsFilterCoeff( int16_t value, int16_t index ) +int16_t EncodeSWBTCX20TnsFilterCoeff( const int16_t value, const int16_t index ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return EncodeUsingTable( value, codesTnsCoeffSWBTCX20[index], nTnsCoeffCodes ); } -int16_t DecodeSWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue ) +int16_t DecodeSWBTCX20TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return DecodeUsingTable( st, pValue, codesTnsCoeffSWBTCX20[index], nTnsCoeffCodes ); } -int16_t GetSWBTCX10TnsFilterCoeffBits( int16_t value, int16_t index ) +int16_t GetSWBTCX10TnsFilterCoeffBits( const int16_t value, const int16_t index ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return GetBitsFromTable( value, codesTnsCoeffSWBTCX10[index], nTnsCoeffCodes ); } -int16_t EncodeSWBTCX10TnsFilterCoeff( int16_t value, int16_t index ) +int16_t EncodeSWBTCX10TnsFilterCoeff( const int16_t value, const int16_t index ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return EncodeUsingTable( value, codesTnsCoeffSWBTCX10[index], nTnsCoeffCodes ); } -int16_t DecodeSWBTCX10TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue ) +int16_t DecodeSWBTCX10TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return DecodeUsingTable( st, pValue, codesTnsCoeffSWBTCX10[index], nTnsCoeffCodes ); } -int16_t GetWBTCX20TnsFilterCoeffBits( int16_t value, int16_t index ) +int16_t GetWBTCX20TnsFilterCoeffBits( const int16_t value, const int16_t index ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return GetBitsFromTable( value, codesTnsCoeffWBTCX20[index], nTnsCoeffCodes ); } -int16_t EncodeWBTCX20TnsFilterCoeff( int16_t value, int16_t index ) +int16_t EncodeWBTCX20TnsFilterCoeff( const int16_t value, const int16_t index ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return EncodeUsingTable( value, codesTnsCoeffWBTCX20[index], nTnsCoeffCodes ); } -int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue ) +int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return DecodeUsingTable( st, pValue, codesTnsCoeffWBTCX20[index], nTnsCoeffCodes ); @@ -356,67 +356,67 @@ int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t * /* TNS filter order */ -void const *GetTnsFilterOrder( void const *p, int16_t index, int16_t *pValue ) +void const *GetTnsFilterOrder( void const *p, const int16_t index, int16_t *pValue ) { *pValue = ( (STnsFilter const *) p )[index].order; return ( (STnsFilter const *) p )[index].coefIndex; } -void *SetTnsFilterOrder( void *p, int16_t index, int16_t value ) +void *SetTnsFilterOrder( void *p, const int16_t index, const int16_t value ) { ( (STnsFilter *) p )[index].order = value; return ( (STnsFilter *) p )[index].coefIndex; } -int16_t GetTnsFilterOrderBitsSWBTCX20( int16_t value, int16_t index ) +int16_t GetTnsFilterOrderBitsSWBTCX20( const int16_t value, const int16_t index ) { (void) index; return GetBitsFromTable( value - 1, codesTnsOrderTCX20, nTnsOrderCodes ); } -int16_t EncodeTnsFilterOrderSWBTCX20( int16_t value, int16_t index ) +int16_t EncodeTnsFilterOrderSWBTCX20( const int16_t value, const int16_t index ) { (void) index; return EncodeUsingTable( value - 1, codesTnsOrderTCX20, nTnsOrderCodes ); } -int16_t DecodeTnsFilterOrderSWBTCX20( Decoder_State *st, int16_t index, int16_t *pValue ) +int16_t DecodeTnsFilterOrderSWBTCX20( Decoder_State *st, const int16_t index, int16_t *pValue ) { (void) index; return DecodeUsingTable( st, pValue, codesTnsOrderTCX20, nTnsOrderCodes ); } -int16_t GetTnsFilterOrderBitsSWBTCX10( int16_t value, int16_t index ) +int16_t GetTnsFilterOrderBitsSWBTCX10( const int16_t value, const int16_t index ) { (void) index; return GetBitsFromTable( value - 1, codesTnsOrderTCX10, nTnsOrderCodes ); } -int16_t EncodeTnsFilterOrderSWBTCX10( int16_t value, int16_t index ) +int16_t EncodeTnsFilterOrderSWBTCX10( const int16_t value, const int16_t index ) { (void) index; return EncodeUsingTable( value - 1, codesTnsOrderTCX10, nTnsOrderCodes ); } -int16_t DecodeTnsFilterOrderSWBTCX10( Decoder_State *st, int16_t index, int16_t *pValue ) +int16_t DecodeTnsFilterOrderSWBTCX10( Decoder_State *st, const int16_t index, int16_t *pValue ) { (void) index; return DecodeUsingTable( st, pValue, codesTnsOrderTCX10, nTnsOrderCodes ); } -int16_t GetTnsFilterOrderBits( int16_t value, int16_t index ) +int16_t GetTnsFilterOrderBits( const int16_t value, const int16_t index ) { (void) index; return GetBitsFromTable( value - 1, codesTnsOrder, nTnsOrderCodes ); } -int16_t EncodeTnsFilterOrder( int16_t value, int16_t index ) +int16_t EncodeTnsFilterOrder( const int16_t value, const int16_t index ) { (void) index; return EncodeUsingTable( value - 1, codesTnsOrder, nTnsOrderCodes ); } -int16_t DecodeTnsFilterOrder( Decoder_State *st, int16_t index, int16_t *pValue ) +int16_t DecodeTnsFilterOrder( Decoder_State *st, const int16_t index, int16_t *pValue ) { (void) index; return DecodeUsingTable( st, pValue, codesTnsOrder, nTnsOrderCodes ); @@ -424,13 +424,13 @@ int16_t DecodeTnsFilterOrder( Decoder_State *st, int16_t index, int16_t *pValue /* Number of TNS filters */ -void const *GetNumOfTnsFilters( void const *p, int16_t index, int16_t *pValue ) +void const *GetNumOfTnsFilters( void const *p, const int16_t index, int16_t *pValue ) { *pValue = (int16_t) abs( ( (STnsData const *) p )[index].nFilters ); return ( (STnsData const *) p )[index].filter; } -void *SetNumOfTnsFilters( void *p, int16_t index, int16_t value ) +void *SetNumOfTnsFilters( void *p, const int16_t index, const int16_t value ) { ( (STnsData *) p )[index].nFilters = (int16_t) abs( value ); return ( (STnsData *) p )[index].filter; @@ -438,13 +438,13 @@ void *SetNumOfTnsFilters( void *p, int16_t index, int16_t value ) /* TNS enabled/disabled flag */ -void const *GetTnsEnabled( void const *p, int16_t index, int16_t *pValue ) +void const *GetTnsEnabled( void const *p, const int16_t index, int16_t *pValue ) { *pValue = ( (STnsData const *) p )[index].nFilters != 0 ? 1 : 0; return NULL; } -void *SetTnsEnabled( void *p, int16_t index, int16_t value ) +void *SetTnsEnabled( void *p, const int16_t index, const int16_t value ) { (void) p, (void) index, (void) value; return NULL; @@ -452,25 +452,25 @@ void *SetTnsEnabled( void *p, int16_t index, int16_t value ) /* TNS on whitened spectra flag */ -void const *GetTnsOnWhite( void const *p, int16_t index, int16_t *pValue ) +void const *GetTnsOnWhite( void const *p, const int16_t index, int16_t *pValue ) { *pValue = ( (STnsData const *) p )[index].tnsOnWhitenedSpectra > 0 ? 1 : 0; return NULL; } -void *SetTnsOnWhite( void *p, int16_t index, int16_t value ) +void *SetTnsOnWhite( void *p, const int16_t index, const int16_t value ) { ( (STnsData *) p )[index].tnsOnWhitenedSpectra = value; return NULL; } -void const *GetTnsEnabledSingleFilter( void const *p, int16_t index, int16_t *pValue ) +void const *GetTnsEnabledSingleFilter( void const *p, const int16_t index, int16_t *pValue ) { *pValue = ( (STnsData const *) p )[index].nFilters != 0 ? 1 : 0; return ( (STnsData const *) p )[index].filter; } -void *SetTnsEnabledSingleFilter( void *p, int16_t index, int16_t value ) +void *SetTnsEnabledSingleFilter( void *p, const int16_t index, const int16_t value ) { ( (STnsData *) p )[index].nFilters = value; return ( (STnsData *) p )[index].filter; diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 971841e26a..200ca7bcc7 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -58,6 +58,14 @@ #define CNA_ACT_DN_FACT 0.7 /* downward updating factor for CNA during active frames */ #define FIRST_CNA_NOISE_UPD_FRAMES 5 /* minimum number of CN initialization frames */ + +/*------------------------------------------------------------------- + * Local fucntions declarations + *-------------------------------------------------------------------*/ + +static void perform_noise_estimation_dec( const float *timeDomainInput, float *power_spectrum, HANDLE_FD_CNG_DEC hFdCngDec, const int16_t element_mode, const int16_t bwidth, const int16_t L_frame, const int16_t last_L_frame, const int32_t last_core_brate, const int16_t VAD ); + + /*------------------------------------------------------------------- * createFdCngDec() * @@ -619,7 +627,7 @@ void ApplyFdCng( * Perform noise estimation at the decoder *-------------------------------------------------------------------*/ -void perform_noise_estimation_dec( +static void perform_noise_estimation_dec( const float *timeDomainInput, float *power_spectrum, HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: FD_CNG structure containing all buffers and variables */ diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index eb7c2df9db..651f6402c6 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -649,4 +649,6 @@ static void run_min_stats( /* restore VAD (see above) */ st->VAD = save_VAD[ch]; } + + return; } -- GitLab From 1278eea70e281d61f99f4b4820a579b2fb6e1ba6 Mon Sep 17 00:00:00 2001 From: szczerba Date: Wed, 1 Mar 2023 12:09:27 +0100 Subject: [PATCH 123/375] Orientation tracking refactoring --- lib_dec/ivas_binRenderer_internal.c | 12 ----- lib_dec/ivas_dirac_dec.c | 11 ----- lib_dec/ivas_ism_renderer.c | 12 ----- lib_dec/ivas_objectRenderer_internal.c | 4 -- lib_dec/lib_dec.c | 4 ++ lib_rend/ivas_dirac_dec_binaural_functions.c | 8 ---- lib_rend/ivas_objectRenderer.c | 22 --------- lib_rend/ivas_orient_trk.c | 20 ++++----- lib_rend/ivas_prot_rend.h | 6 +-- lib_rend/ivas_rotation.c | 33 -------------- lib_rend/lib_rend.c | 47 +++----------------- 11 files changed, 20 insertions(+), 159 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index d61b488e1b..9c7e07734e 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -989,9 +989,6 @@ void ivas_binRenderer( { int16_t chIdx, k; int16_t numTimeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; -#ifdef FIX_I109_ORIENTATION_TRACKING - IVAS_QUATERNION trackedHeadOrientation; -#endif push_wmops( "fastconv_binaural_rendering" ); @@ -1014,16 +1011,7 @@ void ivas_binRenderer( /* Rotation in SHD (HOA3) */ if ( hHeadTrackData->shd_rot_max_order == -1 ) { -#ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, - &hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], - FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, - &trackedHeadOrientation ); - QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); -#else QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); -#endif - rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, 3 ); } else if ( hHeadTrackData->shd_rot_max_order > 0 ) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 3aa3edb0d1..f46815a4b6 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1810,9 +1810,6 @@ void ivas_dirac_dec( float *reference_power, *reference_power_smooth; float *onset_filter, *onset_filter_subframe, *p_onset_filter = NULL; uint16_t coherence_flag; -#ifdef FIX_I109_ORIENTATION_TRACKING - IVAS_QUATERNION trackedHeadOrientation; -#endif push_wmops( "ivas_dirac_dec" ); @@ -1879,15 +1876,7 @@ void ivas_dirac_dec( if ( st_ivas->hHeadTrackData ) { -#ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, - &st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], - (float) ( FRAMES_PER_SEC * ( sf2 - sf1 ) ), - &trackedHeadOrientation ); - QuatToRotMat( trackedHeadOrientation, st_ivas->hHeadTrackData->Rmat ); -#else QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], st_ivas->hHeadTrackData->Rmat ); -#endif p_Rmat = &st_ivas->hHeadTrackData->Rmat[0][0]; diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 3e2c027eca..a965a0ffed 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -110,9 +110,6 @@ void ivas_ism_render( int16_t num_objects, nchan_out_woLFE, lfe_index; int16_t azimuth, elevation; float Rmat[3][3]; -#ifdef FIX_I109_ORIENTATION_TRACKING - IVAS_QUATERNION trackedHeadOrientation; -#endif num_objects = st_ivas->nchan_transport; nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; @@ -136,17 +133,8 @@ void ivas_ism_render( if ( st_ivas->hHeadTrackData != NULL && st_ivas->hHeadTrackData->num_quaternions >= 0 ) { -#ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, - &st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], - FRAMES_PER_SEC, - &trackedHeadOrientation ); - /* Calculate rotation matrix from the quaternion */ - QuatToRotMat( trackedHeadOrientation, Rmat ); -#else /* Calculate rotation matrix from the quaternion */ QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], Rmat ); -#endif } for ( i = 0; i < num_objects; i++ ) diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 7f11f8e3b5..b9fade9290 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -93,9 +93,5 @@ void ivas_td_binaural_renderer( ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, output, output_frame -#ifdef FIX_I109_ORIENTATION_TRACKING - , - pOtr -#endif ); } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index b9db571d2b..cd19fe9d52 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -911,10 +911,14 @@ ivas_error IVAS_DEC_FeedHeadTrackData( /* Move head-tracking data to the decoder handle */ for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { +#ifdef FIX_I109_ORIENTATION_TRACKING + ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, orientation[i], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, hHeadTrackData->Quaternions ); +#else hHeadTrackData->Quaternions[i].w = orientation[i].w; hHeadTrackData->Quaternions[i].x = orientation[i].x; hHeadTrackData->Quaternions[i].y = orientation[i].y; hHeadTrackData->Quaternions[i].z = orientation[i].z; +#endif } hIvasDec->st_ivas->hHeadTrackData->num_quaternions = 0; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index bc8e3351f0..020dd27cfa 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -426,9 +426,6 @@ static void ivas_dirac_dec_binaural_internal( uint8_t firstSlot, slotEnd; int16_t max_band_decorr; DIFFUSE_DISTRIBUTION_DATA diffuseDistData; -#ifdef FIX_I109_ORIENTATION_TRACKING - IVAS_QUATERNION trackedHeadOrientation; -#endif firstSlot = firstSubframe * ( CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ); slotEnd = ( firstSubframe + nSubframes ) * ( CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ); @@ -561,12 +558,7 @@ static void ivas_dirac_dec_binaural_internal( if ( st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ) { -#ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, &st_ivas->hHeadTrackData->Quaternions[firstSubframe], FRAMES_PER_SEC, &trackedHeadOrientation ); - QuatToRotMat( trackedHeadOrientation, Rmat ); -#else QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[firstSubframe], Rmat ); -#endif if ( nchan_transport == 2 ) { diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 7fcae1c0cc..b0f5295ded 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -240,18 +240,11 @@ void ivas_td_binaural_renderer_unwrap( const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ -#ifdef FIX_I109_ORIENTATION_TRACKING - , - ivas_orient_trk_state_t *pOTR /* i/o: orientation tracker handle */ -#endif ) { int16_t subframe_length; int16_t subframe_idx; float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; -#ifdef FIX_I109_ORIENTATION_TRACKING - IVAS_QUATERNION trackedHeadOrientation; -#endif subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; if ( hRenderConfig != NULL ) @@ -278,18 +271,7 @@ void ivas_td_binaural_renderer_unwrap( for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { /* Update the listener's location/orientation */ -#ifdef FIX_I109_ORIENTATION_TRACKING - if ( pOTR != NULL ) - { - if ( ivas_orient_trk_Process( pOTR, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ) != IVAS_ERR_OK ) - { - exit( -1 ); - } - } - TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( pOTR != NULL ) ? &trackedHeadOrientation : NULL ); -#else TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL ); -#endif if ( ( hRenderConfig != NULL ) && ( hRenderConfig->roomAcoustics.late_reverb_on ) ) { @@ -661,10 +643,6 @@ ivas_error ivas_td_binaural_renderer_ext( ( headRotData != NULL ) ? headRotData->headPositions : NULL, output, output_frame -#ifdef FIX_I109_ORIENTATION_TRACKING - , - headRotData->hOrientationTracker -#endif ); pop_wmops(); diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 70a14b1797..9a8aba83f7 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -444,10 +444,10 @@ ivas_error ivas_orient_trk_SetAbsoluteOrientation( #ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_Process( - ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - const IVAS_QUATERNION *pAbsRot, /* i : absolute head rotation */ - float updateRate, /* i : rotation update rate [Hz] */ - IVAS_QUATERNION *pTrkRot ) /* o : tracked rotation */ + ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ + IVAS_QUATERNION absRot, /* i : absolute head rotation */ + float updateRate, /* i : rotation update rate [Hz] */ + IVAS_QUATERNION *pTrkRot ) /* o : tracked rotation */ { float normalizedOrientation; float relativeOrientationRate; @@ -467,34 +467,34 @@ ivas_error ivas_orient_trk_Process( switch ( pOTR->trackingType ) { case OTR_TRACKING_NONE: - *pTrkRot = *pAbsRot; + *pTrkRot = absRot; break; case OTR_TRACKING_REF_ORIENT: /* Reset average orientation */ - pOTR->absAvgRot = *pAbsRot; + pOTR->absAvgRot = absRot; /* Reset adaptation filter - start adaptation at center rate */ pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate ); /* Compute relative orientation = (absolute orientation) - (reference orientation) */ QuaternionInverse( pOTR->refRot, pTrkRot ); - QuaternionProduct( *pTrkRot, *pAbsRot, pTrkRot ); + QuaternionProduct( *pTrkRot, absRot, pTrkRot ); break; case OTR_TRACKING_AVG_ORIENT: /* Compute average (low-pass filtered) absolute orientation */ - QuaternionSlerp( pOTR->absAvgRot, *pAbsRot, alpha, &pOTR->absAvgRot ); + QuaternionSlerp( pOTR->absAvgRot, absRot, alpha, &pOTR->absAvgRot ); /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */ QuaternionInverse( pOTR->absAvgRot, pTrkRot ); - QuaternionProduct( *pTrkRot, *pAbsRot, pTrkRot ); + QuaternionProduct( *pTrkRot, absRot, pTrkRot ); /* Adapt LPF constant based on orientation excursion relative to current mean: - low cutoff (slow adaptation) for small excursions (around center) - high cutoff (fast adaptation) for large excursions (off-center) */ - ang = QuaternionAngle( *pAbsRot, *pTrkRot ); + ang = QuaternionAngle( absRot, *pTrkRot ); normalizedOrientation = ang * ang; relativeOrientationRate = sqrtf( normalizedOrientation ) / pOTR->adaptationAngle; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 4712ccbf67..88da5dd674 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -234,10 +234,6 @@ void ivas_td_binaural_renderer_unwrap( const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ -#ifdef FIX_I109_ORIENTATION_TRACKING - , - ivas_orient_trk_state_t *pOTR /* i/o: orientation tracker handle */ -#endif ); ivas_error ivas_td_binaural_renderer_ext( @@ -913,7 +909,7 @@ ivas_error ivas_orient_trk_GetTrackedRotation( #ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_Process( ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - const IVAS_QUATERNION *pAbsRot, /* i : absolute head rotation */ + IVAS_QUATERNION absRot, /* i : absolute head rotation */ float updateRate, /* i : rotation update rate [Hz] */ IVAS_QUATERNION *pTrkRot /* o : tracked rotation */ ); diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 90354497a0..71133994d5 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -283,9 +283,6 @@ void rotateFrame_shd( float SHrotmat_prev[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM]; float SHrotmat[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM]; float cross_fade[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; -#ifdef FIX_I109_ORIENTATION_TRACKING - IVAS_QUATERNION trackedHeadOrientation; -#endif shd_rot_max_order = hTransSetup.ambisonics_order; @@ -303,15 +300,7 @@ void rotateFrame_shd( } /* get next quaternion */ -#ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, - &hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], - FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, - &trackedHeadOrientation ); - QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); -#else QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); -#endif /* calculate ambisonics rotation matrices for the previous and current frames */ SHrotmatgen( SHrotmat_prev, hHeadTrackData->Rmat_prev, shd_rot_max_order ); @@ -400,9 +389,6 @@ void rotateFrame_sd( float gains_prev[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; float output_tmp[MAX_CICP_CHANNELS][L_FRAME48k]; float cross_fade[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; -#ifdef FIX_I109_ORIENTATION_TRACKING - IVAS_QUATERNION trackedHeadOrientation; -#endif push_wmops( "rotateFrame_sd" ); @@ -416,15 +402,7 @@ void rotateFrame_sd( } /* Get next quaternion and calculate rotation matrix */ -#ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, - &hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], - FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, - &trackedHeadOrientation ); - QuatToRotMat( trackedHeadOrientation, hHeadTrackData->Rmat ); -#else QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); -#endif for ( ch_in = 0; ch_in < nchan; ch_in++ ) { @@ -639,9 +617,6 @@ void rotateFrame_sd_cldfb( float *p_real, *p_imag; int16_t nInChannels; int16_t isPlanar; -#ifdef FIX_I109_ORIENTATION_TRACKING - IVAS_QUATERNION trackedHeadOrientation; -#endif push_wmops( "rotateFrame_sd_cldfb" ); @@ -657,15 +632,7 @@ void rotateFrame_sd_cldfb( } /* Get next quaternion and calculate rotation matrix */ -#ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, - &hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], - FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, - &trackedHeadOrientation ); - QuatToRotMat( trackedHeadOrientation, Rmat ); -#else QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], Rmat ); -#endif /* rotation of Euler angles */ for ( n = 0; n < nInChannels; n++ ) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 7c784c545a..0145f1163c 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3924,7 +3924,11 @@ ivas_error IVAS_REND_SetHeadRotation( hIvasRend->headRotData.headRotEnabled = 1; for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) { +#ifdef FIX_I109_ORIENTATION_TRACKING + ivas_orient_trk_Process( hIvasRend->headRotData.hOrientationTracker, headRot[i], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hIvasRend->headRotData.headPositions[i] ); +#else hIvasRend->headRotData.headPositions[i] = headRot[i]; +#endif } } @@ -4123,9 +4127,6 @@ static ivas_error rotateFrameMc( rotation_matrix Rmat; rotation_gains gains; float tmp_gains[MAX_INPUT_CHANNELS]; -#ifdef FIX_I109_ORIENTATION_TRACKING - IVAS_QUATERNION trackedHeadOrientation; -#endif push_wmops( "rotateFrameMc" ); @@ -4152,15 +4153,7 @@ static ivas_error rotateFrameMc( for ( subframe_idx = 0; subframe_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; subframe_idx++ ) { /* Get next quaternion and calculate rotation matrix */ -#ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_Process( headRotData->hOrientationTracker, - &headRotData->headPositions[subframe_idx], - (float) ( FRAMES_PER_SEC * RENDERER_HEAD_POSITIONS_PER_FRAME ), - &trackedHeadOrientation ); - QuatToRotMat( trackedHeadOrientation, Rmat ); -#else QuatToRotMat( headRotData->headPositions[subframe_idx], Rmat ); -#endif for ( ch_in = 0; ch_in < nchan; ch_in++ ) { @@ -4242,9 +4235,6 @@ static ivas_error rotateFrameSba( rotation_matrix Rmat; float tmpRot[2 * HEADROT_ORDER + 1]; rotation_gains gains; -#ifdef FIX_I109_ORIENTATION_TRACKING - IVAS_QUATERNION trackedHeadOrientation; -#endif push_wmops( "rotateFrameSba" ); @@ -4261,15 +4251,7 @@ static ivas_error rotateFrameSba( } /* Get next quaternion and calculate rotation matrix */ -#ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_Process( headRotData->hOrientationTracker, - &headRotData->headPositions[subframe_idx], - (float) ( FRAMES_PER_SEC * RENDERER_HEAD_POSITIONS_PER_FRAME ), - &trackedHeadOrientation ); - QuatToRotMat( trackedHeadOrientation, Rmat ); -#else QuatToRotMat( headRotData->headPositions[subframe_idx], Rmat ); -#endif /* calculate ambisonics rotation matrices for the previous and current frames */ SHrotmatgen( gains, Rmat, shd_rot_max_order ); @@ -4375,18 +4357,12 @@ static ivas_error renderIsmToBinauralRoom( int16_t tmp; rotation_matrix Rmat; float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; -#ifndef FIX_I109_ORIENTATION_TRACKING - IVAS_QUATERNION quat; -#endif ivas_error error; pan_vector currentPanGains; pan_vector previousPanGains; IVAS_REND_AudioBuffer tmpMcBuffer; IVAS_REND_AudioObjectPosition rotatedPos; const IVAS_REND_HeadRotData *headRotData; -#ifdef FIX_I109_ORIENTATION_TRACKING - IVAS_QUATERNION trackedHeadOrientation; -#endif push_wmops( "renderIsmToBinauralRoom" ); @@ -4399,20 +4375,7 @@ static ivas_error renderIsmToBinauralRoom( // for ( subframe_idx = 0; subframe_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; subframe_idx++ ) for ( subframe_idx = 0; subframe_idx < 1; subframe_idx++ ) { -#ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_Process( headRotData->hOrientationTracker, - &headRotData->headPositions[subframe_idx], - (float) ( FRAMES_PER_SEC ), - &trackedHeadOrientation ); - QuatToRotMat( trackedHeadOrientation, Rmat ); -#else - quat.w = headRotData->headPositions[subframe_idx].w; - quat.x = headRotData->headPositions[subframe_idx].x; - quat.y = headRotData->headPositions[subframe_idx].y; - quat.z = headRotData->headPositions[subframe_idx].z; - - QuatToRotMat( quat, Rmat ); -#endif + QuatToRotMat( headRotData->headPositions[subframe_idx], Rmat ); } (void) subframe_len; // avoid warning } -- GitLab From 8d2db8e97133b168c5aab59f1faca435e8377dc9 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Wed, 1 Mar 2023 16:54:56 +0530 Subject: [PATCH 124/375] Address review comments:set 2 --- lib_dec/ivas_sba_dec.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 87888b627a..a548cd0bef 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -891,7 +891,8 @@ ivas_error ivas_sba_dec_reconfigure( } #ifdef SBA_BR_SWITCHING_RECONFIG #ifdef SBA_BR_SWITCHING_CLEAN_UP - if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( sba_mode_old != st_ivas->sba_mode ) || ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) + if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( sba_mode_old != st_ivas->sba_mode ) || ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) + && (( (hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) ) ) { DIRAC_CONFIG_FLAG flag_config; flag_config = DIRAC_OPEN; @@ -908,6 +909,29 @@ ivas_error ivas_sba_dec_reconfigure( return error; } } + if ( ( ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) ) && ( ( sba_mode_old != st_ivas->sba_mode ) && ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) ) + { + /* if ( st_ivas->hDirAC != NULL && st_ivas->sba_mode == SBA_MODE_SPAR ) + { + mvs2s( st_ivas->hDirAC->dirac_to_spar_md_bands, st_ivas->hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); + st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; + }*/ + if ( st_ivas->hDirAC != NULL ) + { + ivas_dirac_dec_close( st_ivas->hDirAC ); + st_ivas->hDirAC = NULL; + } + if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) != IVAS_ERR_OK ) + { + return error; + } + int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; + + st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); + + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, ( int16_t )( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); + } #else if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( sba_mode_old != st_ivas->sba_mode ) ) { @@ -951,6 +975,7 @@ ivas_error ivas_sba_dec_reconfigure( #endif #endif #ifdef SBA_BR_SWITCHING + else if ( st_ivas->renderer_type == RENDERER_DISABLE || ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode != SBA_MODE_SPAR ) ) { if ( st_ivas->hDirAC != NULL ) -- GitLab From 125196112c8e10968d720358f8d0028ce363fea7 Mon Sep 17 00:00:00 2001 From: szczerba Date: Wed, 1 Mar 2023 12:38:31 +0100 Subject: [PATCH 125/375] Orientation tracking refactoring --- lib_dec/lib_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index cd19fe9d52..29f1ff2a8c 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -912,7 +912,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { #ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, orientation[i], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, hHeadTrackData->Quaternions ); + ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, orientation[i], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hHeadTrackData->Quaternions[i] ); #else hHeadTrackData->Quaternions[i].w = orientation[i].w; hHeadTrackData->Quaternions[i].x = orientation[i].x; -- GitLab From d1d8d66d3a26cf502730cfbe97fe8ecb24649857 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 1 Mar 2023 15:13:43 +0100 Subject: [PATCH 126/375] clenaup --- lib_dec/ivas_corecoder_dec_reconfig.c | 13 ++++++------- lib_enc/ivas_corecoder_enc_reconfig.c | 7 +++++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index bb2b753181..b539f9c385 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -33,11 +33,7 @@ #include "options.h" #include "ivas_cnst.h" #include "ivas_prot.h" -#include "ivas_rom_com.h" -#include "ivas_stat_enc.h" #include "prot.h" -#include -#include #include #ifdef DEBUGGING #include "debug.h" @@ -74,9 +70,9 @@ ivas_error ivas_corecoder_dec_reconfig( hDecoderConfig = st_ivas->hDecoderConfig; ivas_total_brate = hDecoderConfig->ivas_total_brate; + output_frame = (int16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); error = IVAS_ERR_OK; - output_frame = (int16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); if ( st_ivas->ivas_format == MC_FORMAT ) { last_mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */ @@ -85,6 +81,7 @@ ivas_error ivas_corecoder_dec_reconfig( { last_mc_mode = MC_MODE_NONE; } + /*-----------------------------------------------------------------* * Allocate, initalize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ @@ -119,6 +116,7 @@ ivas_error ivas_corecoder_dec_reconfig( for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { st_ivas->hCPE[cpe_id]->element_brate = brate_CPE; + /* prepare bitstream buffers */ for ( n = 0; n < CPE_CHANNELS; n++ ) { @@ -139,7 +137,6 @@ ivas_error ivas_corecoder_dec_reconfig( nSCE_existing = min( nSCE_old, st_ivas->nSCE ); nCPE_existing = min( nCPE_old, st_ivas->nCPE ); - // VE: TBV - try to reuse the CoreCoder /* destroy superfluous core coder elements */ for ( sce_id = st_ivas->nSCE; sce_id < nSCE_old; sce_id++ ) { @@ -192,6 +189,7 @@ ivas_error ivas_corecoder_dec_reconfig( for ( cpe_id = 0; cpe_id < nCPE_existing; cpe_id++ ) { st_ivas->hCPE[cpe_id]->element_brate = brate_CPE; + /* prepare bitstream buffers */ for ( n = 0; n < CPE_CHANNELS; n++ ) { @@ -271,7 +269,6 @@ ivas_error ivas_corecoder_dec_reconfig( return error; } - // VE: TBV - just reset for now set_f( st_ivas->hCPE[0]->hStereoDft->buff_LBTCX_mem, 0, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hSCE[0]->hCoreCoder[0]; /* don't allocate unnecessary core coder, simply point to core coder of SCE element */ @@ -512,10 +509,12 @@ ivas_error ivas_cldfb_dec_reconfig( } } } + /* CLDFB Interpolation weights */ if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( numCldfbAnalyses_old != numCldfbAnalyses || numCldfbSyntheses_old != numCldfbSyntheses || nchan_transport_old != st_ivas->nchan_transport ) ) { ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); } + return IVAS_ERR_OK; } diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index e8486d7738..3f2534745a 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -30,15 +30,14 @@ *******************************************************************************************************/ -#include #include #include "options.h" #include "ivas_cnst.h" #include "prot.h" #include "ivas_prot.h" -#include "ivas_stat_enc.h" #ifdef DEBUGGING #include "debug.h" +#include #endif #include "wmc_auto.h" @@ -97,6 +96,7 @@ ivas_error ivas_corecoder_enc_reconfig( for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { st_ivas->hCPE[cpe_id]->element_brate = brate_CPE; + /* prepare bitstream buffers */ for ( n = 0; n < CPE_CHANNELS; n++ ) { @@ -120,11 +120,13 @@ ivas_error ivas_corecoder_enc_reconfig( nchan_transport_old_real = nchan_transport_old; nchan_transport_real = st_ivas->nchan_transport; + /* in SCE+CPE McMASA nchan_transport is still 2, fix the numbers */ if ( hEncoderConfig->ivas_format == MC_FORMAT && last_mc_mode == MC_MODE_MCMASA ) { nchan_transport_old_real = nSCE_old + CPE_CHANNELS * nCPE_old; } + if ( hEncoderConfig->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) { nchan_transport_real = st_ivas->nSCE + CPE_CHANNELS * st_ivas->nCPE; @@ -282,6 +284,7 @@ ivas_error ivas_corecoder_enc_reconfig( for ( cpe_id = 0; cpe_id < nCPE_existing; cpe_id++ ) { st_ivas->hCPE[cpe_id]->element_brate = brate_CPE; + /* prepare bitstream buffers */ for ( n = 0; n < CPE_CHANNELS; n++ ) { -- GitLab From c7203ef7e0a02d88333dc536975541153d8d7771 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 1 Mar 2023 18:01:37 +0100 Subject: [PATCH 127/375] typos in comments --- lib_dec/hq_lr_dec.c | 2 +- lib_dec/ivas_corecoder_dec_reconfig.c | 2 +- lib_dec/ivas_sba_dec.c | 6 ++++-- lib_enc/hq_lr_enc.c | 2 +- lib_enc/ivas_corecoder_enc_reconfig.c | 2 +- lib_enc/ivas_dirac_enc.c | 2 +- lib_enc/ivas_sba_enc.c | 15 ++++++++------- 7 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index 81f4c1b284..774720844c 100644 --- a/lib_dec/hq_lr_dec.c +++ b/lib_dec/hq_lr_dec.c @@ -238,7 +238,7 @@ void hq_lr_dec( if ( flag_spt == 1 ) { - /* initalize the desired parameters for SPT */ + /* initialize the desired parameters for SPT */ spt_shorten_domain_band_save( bands, band_start, band_end, band_width, org_band_start, org_band_end, org_band_width ); spt_shorten_domain_pre( band_start, band_end, hHQ_core->prev_SWB_peak_pos, bands, bwe_br, new_band_start, new_band_end, new_band_width ); spt_shorten_domain_set_dec( st, p2a_flags, new_band_start, new_band_end, new_band_width, bands, band_start, band_end, band_width, &bit_budget ); diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index b539f9c385..492339d6d6 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -83,7 +83,7 @@ ivas_error ivas_corecoder_dec_reconfig( } /*-----------------------------------------------------------------* - * Allocate, initalize, and configure SCE/CPE/MCT handles + * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ /* remove dummy CPE element for DFT stereo-like upmix */ diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 98fad8c094..d200d467cf 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -103,7 +103,7 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); /*-----------------------------------------------------------------* - * Allocate, initalize, and configure SBA handles + * Allocate, initialize, and configure SBA handles *-----------------------------------------------------------------*/ if ( st_ivas->sba_mode != SBA_MODE_SPAR ) @@ -282,6 +282,7 @@ ivas_error ivas_sba_dec_reconfigure( { ivas_binRenderer_close( &st_ivas->hBinRenderer ); } + if ( st_ivas->renderer_type != old_renderer_type ) { if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) @@ -304,6 +305,7 @@ ivas_error ivas_sba_dec_reconfigure( { ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); } + if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( sba_mode_old != st_ivas->sba_mode ) ) { DIRAC_CONFIG_FLAG flag_config; @@ -344,7 +346,7 @@ ivas_error ivas_sba_dec_reconfigure( } /*-----------------------------------------------------------------* - * Allocate, initalize, and configure SCE/CPE/MCT handles + * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ); diff --git a/lib_enc/hq_lr_enc.c b/lib_enc/hq_lr_enc.c index 9401a1bb57..e43baef59d 100644 --- a/lib_enc/hq_lr_enc.c +++ b/lib_enc/hq_lr_enc.c @@ -320,7 +320,7 @@ void hq_lr_enc( if ( flag_spt == 1 ) { - /* initalize the desired parameters for SPT */ + /* initialize the desired parameters for SPT */ spt_shorten_domain_band_save( bands, band_start, band_end, band_width, org_band_start, org_band_end, org_band_width ); spt_shorten_domain_pre( band_start, band_end, hHQ_core->prev_SWB_peak_pos, bands, bwe_br, new_band_start, new_band_end, new_band_width ); spt_shorten_domain_set( hBstr, hHQ_core, t_audio, p2a_flags, new_band_start, new_band_end, new_band_width, bands, band_start, band_end, band_width, &bit_budget ); diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index 3f2534745a..f419425104 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -45,7 +45,7 @@ /*-------------------------------------------------------------------* * ivas_corecoder_enc_reconfig() * - * Allocate, initalize, and configure SCE/CPE/MCT handles in case of bitrate switching + * Allocate, initialize, and configure SCE/CPE/MCT handles in case of bitrate switching *-------------------------------------------------------------------*/ ivas_error ivas_corecoder_enc_reconfig( diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 92c2f80fad..0ab9f666cf 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -118,7 +118,7 @@ ivas_error ivas_dirac_enc_open( } dirac_slot_ns = DIRAC_SLOT_ENC_NS; - /* initalize delay for SPAR/DirAC delay synchronization */ + /* initialize delay for SPAR/DirAC delay synchronization */ if ( st_ivas->sba_mode == SBA_MODE_DIRAC ) { hDirAC->num_samples_synchro_delay = NS2SA( input_Fs, IVAS_FB_ENC_DELAY_NS ); diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index 2af2cf76fa..30454a4afd 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -106,7 +106,7 @@ ivas_error ivas_sba_enc_reconfigure( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ) { - int16_t nSCE_old, nCPE_old, nchan_transport_old; + int16_t n, nSCE_old, nCPE_old, nchan_transport_old; int32_t ivas_total_brate; ivas_error error; ENCODER_CONFIG_HANDLE hEncoderConfig; @@ -137,7 +137,7 @@ ivas_error ivas_sba_enc_reconfigure( analysis_order_old = ivas_sba_get_analysis_order( hEncoderConfig->last_ivas_total_brate, hEncoderConfig->sba_order ); if ( analysis_order_old != st_ivas->sba_analysis_order ) { - int16_t n, i, n_old; + int16_t i, n_old; float **old_mem_hp20_in; n_old = ivas_sba_get_nchan_metadata( analysis_order_old ); @@ -268,8 +268,10 @@ ivas_error ivas_sba_enc_reconfigure( { return error; } + /*Initialization*/ hSpar->hMdEnc->table_idx = -1; + /* FB mixer handle */ ivas_FB_mixer_close( &hSpar->hFbMixer, hEncoderConfig->input_Fs ); @@ -312,11 +314,9 @@ ivas_error ivas_sba_enc_reconfigure( } } - /* initalize delay for SPAR/DirAC delay synchronization */ + /* initialize delay for SPAR/DirAC delay synchronization */ if ( ( st_ivas->sba_mode == SBA_MODE_DIRAC ) && ( ( sba_mode_old != st_ivas->sba_mode ) || ( nchan_transport_old != st_ivas->nchan_transport ) ) ) { - int16_t n; - if ( hDirAC->num_samples_synchro_delay == 0 ) { hDirAC->num_samples_synchro_delay = NS2SA( hEncoderConfig->input_Fs, IVAS_FB_ENC_DELAY_NS ); @@ -337,7 +337,7 @@ ivas_error ivas_sba_enc_reconfigure( } else { - for ( int16_t n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) + for ( n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) { if ( hDirAC->sba_synchro_buffer[n] != NULL ) { @@ -356,8 +356,9 @@ ivas_error ivas_sba_enc_reconfigure( mvs2s( hDirAC->dirac_to_spar_md_bands, hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); hSpar->enc_param_start_band = hDirAC->hConfig->enc_param_start_band; } + /*-----------------------------------------------------------------* - * Allocate, initalize, and configure SCE/CPE/MCT handles + * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ); -- GitLab From b22db8975660f20b88318f0e1c77d7a94586063a Mon Sep 17 00:00:00 2001 From: hsd Date: Wed, 1 Mar 2023 18:18:49 +0100 Subject: [PATCH 128/375] [cleanup] comments where missed when renaming the OTR *REF_POS tracking modes to *REF_VEC [ci-skip] --- lib_rend/ivas_orient_trk.c | 2 +- lib_rend/lib_rend.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 9f478c627a..5fe3398687 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -723,7 +723,7 @@ ivas_error ivas_orient_trk_Process( case OTR_TRACKING_REF_VEC: case OTR_TRACKING_REF_VEC_LEV: { - /* This processing step of the OTR_TRACKING_REF_POS/OTR_TRACKING_REF_POS_LEVEL is identical */ + /* This processing step of the OTR_TRACKING_REF_VEC/OTR_TRACKING_REF_VEC_LEVEL is identical */ QuaternionProduct( pOTR->refRot, *pAbsRot, &refRot_absRot_product ); pTrkRot->w = refRot_absRot_product.w; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index aaa24c60dd..bfa38a71a5 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4024,7 +4024,7 @@ ivas_error IVAS_REND_GetTrackedRotation( * IVAS_REND_SetReferenceVector( ) * * Sets a reference vector spanning from listenerPos to refPos. Only - * available in OTR_TRACKING_REF_POS and OTR_TRACKING_REF_POS_LEV modes. + * available in OTR_TRACKING_REF_VEC and OTR_TRACKING_REF_VEC_LEV modes. *---------------------------------------------------------------------*/ ivas_error IVAS_REND_SetReferenceVector( -- GitLab From bba691bd7818f5853a2b8b4166fd7e4fe6355ff8 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Fri, 3 Mar 2023 00:19:17 +0100 Subject: [PATCH 129/375] typo --- apps/renderer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/renderer.c b/apps/renderer.c index fa3a3d21ee..2485c5a057 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -909,7 +909,7 @@ int main( if ( !args.quietModeEnabled ) { - fprintf( stdout, "\n------ Running the rondoror ------\n\n" ); + fprintf( stdout, "\n------ Running the renderer ------\n\n" ); fprintf( stdout, "Frames processed: " ); } else -- GitLab From e96871af3e0032fb1b8f8f66966c65174fe65852 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Fri, 3 Mar 2023 01:16:54 +0100 Subject: [PATCH 130/375] remove Quat2Euler from header definition file --- lib_rend/ivas_orient_trk.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 70a14b1797..e9718b937c 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -462,6 +462,14 @@ ivas_error ivas_orient_trk_Process( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + /* check for Euler angle signaling */ + //if ( pOTR->refRot.w == -3.0f ) + //{ + // // convert to quaternion + // // port https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles + + //} + result = IVAS_ERR_OK; switch ( pOTR->trackingType ) -- GitLab From 8e0894b5e6a6643f95f7f3cf7cf18486142319b7 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Fri, 3 Mar 2023 01:49:50 +0100 Subject: [PATCH 131/375] function prototype for Euler2Quat --- lib_rend/ivas_orient_trk.c | 22 +++++++++++++++------- lib_rend/ivas_prot_rend.h | 11 +++++++++++ lib_rend/ivas_rotation.c | 24 ++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 7 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index e9718b937c..5ef7ded17d 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -30,6 +30,7 @@ *******************************************************************************************************/ +#include "common_api_types.h" #include #include "options.h" #include "ivas_prot.h" @@ -456,19 +457,26 @@ ivas_error ivas_orient_trk_Process( float alpha = pOTR->alpha; float ang; ivas_error result; + IVAS_QUATERNION quat; if ( pOTR == NULL || pTrkRot == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + quat.w = 0.0f; + quat.x = 0.0f; + quat.y = 0.0f; + quat.z = 0.0f; /* check for Euler angle signaling */ - //if ( pOTR->refRot.w == -3.0f ) - //{ - // // convert to quaternion - // // port https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles - - //} + if ( pOTR->refRot.w == -3.0f ) + { + Euler2Quat(pOTR->refRot.x, pOTR->refRot.y, pOTR->refRot.z, &quat); + } + else + { + quat = pOTR->refRot; + } result = IVAS_ERR_OK; @@ -486,7 +494,7 @@ ivas_error ivas_orient_trk_Process( pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate ); /* Compute relative orientation = (absolute orientation) - (reference orientation) */ - QuaternionInverse( pOTR->refRot, pTrkRot ); + QuaternionInverse( quat, pTrkRot ); QuaternionProduct( *pTrkRot, *pAbsRot, pTrkRot ); break; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 4712ccbf67..ccf929a359 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -796,12 +796,23 @@ void ivas_headTrack_close( ); #endif +#ifndef FIX_I109_ORIENTATION_TRACKING void Quat2Euler( const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ float *yaw, /* o : yaw */ float *pitch, /* o : pitch */ float *roll /* o : roll */ ); +#endif + +#ifdef FIX_I109_ORIENTATION_TRACKING +void Euler2Quat( + const float yaw, /* i : yaw */ + const float pitch, /* i : pitch */ + const float roll, /* i : roll */ + IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ +); +#endif void QuatToRotMat( const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 90354497a0..15b4f66421 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -213,6 +213,30 @@ void Quat2Euler( } #endif +#ifdef FIX_I109_ORIENTATION_TRACKING +/*------------------------------------------------------------------------- + * Euler2Quat() + * + * Quaternion handling: calculate corresponding Euler angles + *------------------------------------------------------------------------*/ + +void Euler2Quat( + const float yaw, /* i : yaw */ + const float pitch, /* i : pitch */ + const float roll, /* i : roll */ + IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ +) +{ + // @TODO implementation here + quat->w = -3.0f; + quat->x = yaw; + quat->y = pitch; + quat->z = roll; + + return; +} +#endif + /*------------------------------------------------------------------------- * rotateAziEle() -- GitLab From 17e2c2ad708b505fe2329df8e6c54472c9f45597 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Fri, 3 Mar 2023 01:59:34 +0100 Subject: [PATCH 132/375] implementation of Euler2Quat --- lib_rend/ivas_rotation.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 15b4f66421..8ff48c1104 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -227,11 +227,17 @@ void Euler2Quat( IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ ) { - // @TODO implementation here - quat->w = -3.0f; - quat->x = yaw; - quat->y = pitch; - quat->z = roll; + float cr = cos( roll * 0.5f ); + float sr = sin( roll * 0.5f ); + float cp = cos( pitch * 0.5f ); + float sp = sin( pitch * 0.5f ); + float cy = cos( yaw * 0.5f ); + float sy = sin( yaw * 0.5f ); + + quat->w = cr * cp * cy + sr * sp * sy; + quat->x = sr * cp * cy - cr * sp * sy; + quat->y = cr * sp * cy + sr * cp * sy; + quat->z = cr * cp * sy - sr * sp * cy; return; } -- GitLab From 642e358a7aa7599f1ca9be8585543465b87591d0 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Fri, 3 Mar 2023 02:06:19 +0100 Subject: [PATCH 133/375] cosmetics --- lib_rend/ivas_prot_rend.h | 8 ++++---- lib_rend/ivas_rotation.c | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index ccf929a359..000d1c905b 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -807,10 +807,10 @@ void Quat2Euler( #ifdef FIX_I109_ORIENTATION_TRACKING void Euler2Quat( - const float yaw, /* i : yaw */ - const float pitch, /* i : pitch */ - const float roll, /* i : roll */ - IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ + const float yaw, /* i : yaw */ + const float pitch, /* i : pitch */ + const float roll, /* i : roll */ + IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ ); #endif diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 8ff48c1104..ddcb059bfc 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -217,14 +217,14 @@ void Quat2Euler( /*------------------------------------------------------------------------- * Euler2Quat() * - * Quaternion handling: calculate corresponding Euler angles + * Calculate corresponding Quaternion from Euler angles *------------------------------------------------------------------------*/ void Euler2Quat( - const float yaw, /* i : yaw */ - const float pitch, /* i : pitch */ - const float roll, /* i : roll */ - IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ + const float yaw, /* i : yaw */ + const float pitch, /* i : pitch */ + const float roll, /* i : roll */ + IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ ) { float cr = cos( roll * 0.5f ); -- GitLab From 874a29c85cf6bdc3fb042517c6d6f6a754cf69ad Mon Sep 17 00:00:00 2001 From: vaclav Date: Sun, 5 Mar 2023 14:54:12 +0100 Subject: [PATCH 134/375] - add TUNE_360_OBJECT_WITH_NOISE (switch under development) --- lib_com/options.h | 5 ++++- lib_enc/ivas_core_enc.c | 2 ++ lib_enc/ivas_ism_dtx_enc.c | 7 +++++++ lib_enc/ivas_ism_enc.c | 37 +++++++++++++++++++++++++++++++++ lib_enc/ivas_ism_metadata_enc.c | 6 ++++++ 5 files changed, 56 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 43483973b3..fbb764cae6 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ +#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ @@ -168,6 +168,9 @@ #define UNIFY_MD_QUANTIZER #define DISC_CNG +#define TUNE_360_OBJECT_WITH_NOISE // VA: issue 360: consider objects being speech+noise for active speech coding */ + + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index e53033ab98..002e499f4b 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -448,6 +448,8 @@ ivas_error ivas_core_enc( dbgwrite( &st->sp_aud_decision1, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "sp_aud_decision1", n, id, ENC ) ); dbgwrite( &st->sp_aud_decision2, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "sp_aud_decision2", n, id, ENC ) ); + dbgwrite( &st->lp_noise, sizeof( float ), 1, input_frame, fname( debug_dir, "lp_noise", n, id, ENC ) ); + #if ( defined DEBUG_MODE_ACELP ) || ( defined DEBUG_MODE_TCX ) if ( st->coder_type == INACTIVE || st->coder_type == UNVOICED ) { diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 7a37ee9df3..353145fcd5 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -127,6 +127,13 @@ int16_t ivas_ism_dtx_enc( float tmp1, tmp2; #endif +#ifdef TUNE_360_OBJECT_WITH_NOISE + for ( ch = 0; ch < nchan_transport; ch++ ) + { + hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; + } +#endif + /*------------------------------------------------------------------* * compute global ISM DTX flag *-----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 02456f2d03..e3a8227a3f 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -434,6 +434,43 @@ ivas_error ivas_ism_enc( } #endif + +#ifdef PARAM_ISM_DTX_CNG +#ifdef DEBUG_MODE_INFO + if ( dtx_flag ) + { + float tmpF; + int16_t id, n; + + n = 0; + for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) + { + if ( sce_id != st_ivas->hISMDTX->sce_id_dtx ) + { + st = st_ivas->hSCE[sce_id]->hCoreCoder[0]; + id = st->id_element; + + dbgwrite( &st->core, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "core", n, id, ENC ) ); + dbgwrite( &st->extl, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "extl", n, id, ENC ) ); + dbgwrite( &st->bwidth, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "bwidth", n, id, ENC ) ); + tmpF = st->total_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "total_brate", n, id, ENC ) ); + tmpF = st->core_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "core_brate", n, id, ENC ) ); + tmpF = st->extl_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "extl_brate", n, id, ENC ) ); + + dbgwrite( &st->coder_type, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "coder_type", n, id, ENC ) ); + dbgwrite( &st->coder_type_raw, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "coder_type_raw", n, id, ENC ) ); + dbgwrite( &st->vad_flag, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "vad_flag", n, id, ENC ) ); + dbgwrite( &st->localVAD, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "localVAD", n, id, ENC ) ); + + dbgwrite( &st->lp_noise, sizeof( float ), 1, input_frame, fname( debug_dir, "lp_noise", n, id, ENC ) ); + } + } + } +#endif +#endif pop_wmops(); return error; diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 99aba8b0b0..851ffc65c2 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -212,6 +212,9 @@ ivas_error ivas_ism_metadata_enc( } else if ( ism_mode == ISM_MODE_DISC ) { +#ifdef TUNE_360_OBJECT_WITH_NOISE + hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10; +#else hIsmMeta[ch]->ism_metadata_flag = localVAD[ch]; if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) @@ -230,6 +233,7 @@ ivas_error ivas_ism_metadata_enc( hIsmMeta[ch]->ism_metadata_flag = 1; } } +#endif if ( hSCE[ch]->hCoreCoder[0]->tcxonly ) { @@ -245,6 +249,7 @@ ivas_error ivas_ism_metadata_enc( rate_ism_importance( nchan_transport, hIsmMeta, hSCE, ism_imp ); +#ifndef TUNE_360_OBJECT_WITH_NOISE /* relax the importance decision in "stereo" coding for noisy audio */ if ( ism_mode == ISM_MODE_DISC && num_obj == 2 ) { @@ -264,6 +269,7 @@ ivas_error ivas_ism_metadata_enc( } } } +#endif /*----------------------------------------------------------------* * Write ISm common signaling -- GitLab From d1f57ac896c64e99f9c69cb718bdd8aaf70aab97 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Mon, 6 Mar 2023 12:03:11 +0530 Subject: [PATCH 135/375] Added a fix for an error while testing : set 1 --- lib_dec/ivas_sba_dec.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index a548cd0bef..617bbfb64c 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -792,6 +792,7 @@ ivas_error ivas_sba_dec_reconfigure( hDirAC = st_ivas->hDirAC; } + #ifndef SBA_BR_SWITCHING_RECONFIG if ( hDirAC != NULL ) #else @@ -891,7 +892,7 @@ ivas_error ivas_sba_dec_reconfigure( } #ifdef SBA_BR_SWITCHING_RECONFIG #ifdef SBA_BR_SWITCHING_CLEAN_UP - if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( sba_mode_old != st_ivas->sba_mode ) || ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) + if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( sba_mode_old != st_ivas->sba_mode ) || ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) && (( (hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) ) ) { DIRAC_CONFIG_FLAG flag_config; @@ -909,21 +910,19 @@ ivas_error ivas_sba_dec_reconfigure( return error; } } - if ( ( ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) ) && ( ( sba_mode_old != st_ivas->sba_mode ) && ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) ) + if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { - /* if ( st_ivas->hDirAC != NULL && st_ivas->sba_mode == SBA_MODE_SPAR ) + if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) != IVAS_ERR_OK ) { - mvs2s( st_ivas->hDirAC->dirac_to_spar_md_bands, st_ivas->hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); - st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; - }*/ + return error; + } + } + if ( ( ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) ) && ( ( sba_mode_old != st_ivas->sba_mode ) && ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) ) + { if ( st_ivas->hDirAC != NULL ) { ivas_dirac_dec_close( st_ivas->hDirAC ); st_ivas->hDirAC = NULL; - } - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) != IVAS_ERR_OK ) - { - return error; } int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; -- GitLab From ff365e2f14f405b98353d7858a98b42437da9ada Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Mon, 6 Mar 2023 12:55:39 +0530 Subject: [PATCH 136/375] Added new test cases for AGC for SBA BR switching --- tests/conftest.py | 15 +++++++++++++++ tests/test_sba_bs_enc.py | 18 +++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 9896c4908f..ef5f46ffc9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -450,7 +450,22 @@ def test_vector_path(request) -> str: path = str(path.resolve()) return path + +@pytest.fixture(scope="session") +def br_switch_file_path(request) -> str: + """ + Return base directory of test vector files. + """ + if request.config.option.test_vector_path: + return request.config.option.test_vector_path + here = Path(__file__).parent.resolve() + + path = here.joinpath("../scripts/switchPaths") + + path = str(path.resolve()) + + return path @pytest.fixture(scope="session") def reference_path(request) -> str: diff --git a/tests/test_sba_bs_enc.py b/tests/test_sba_bs_enc.py index 2b659432c2..411f8089bb 100644 --- a/tests/test_sba_bs_enc.py +++ b/tests/test_sba_bs_enc.py @@ -53,7 +53,7 @@ dtx_set = ['0', '1'] dict_fsample_bw = {'48': '3', '32': '2', '16': '1'} dict_bw_idx = {'FB': '3', 'SWB': '2', 'WB': '1'} dict_bw_tag = {'SWB': '_ForceSWB', 'WB': '_ForceWB'} -ivas_br_FOA = ['32000', '64000', '96000', '160000', '256000', '384000', '512000'] +ivas_br_FOA = ['32000','64000', '96000', '160000', '256000', '384000', '512000','sw_24k4_256k.bin'] ivas_br_HOA2 = ['256000', '384000', '512000'] ivas_br_HOA3 = ['256000', '384000', '512000'] @@ -111,6 +111,7 @@ def test_bypass_enc( ref_encoder_path, reference_path, dut_base_path, + None, tag, fs, ivas_br, @@ -155,6 +156,7 @@ def test_sba_enc_system( dut_base_path, ref_encoder_path, ref_decoder_path, + br_switch_file_path, update_ref, keep_files, ivas_br, @@ -166,7 +168,9 @@ def test_sba_enc_system( if dtx == '1' and ivas_br not in ['32000', '64000']: # skip high bitrates for DTX until DTX issue is resolved pytest.skip() - + if ivas_br == 'sw_24k4_256k.bin' and agc != 1: + pytest.skip() + tag = tag + fs + 'c' max_bw = "FB" bypass = -1 @@ -185,6 +189,7 @@ def test_sba_enc_system( ref_encoder_path, reference_path, dut_base_path, + br_switch_file_path, tag, fs, ivas_br, @@ -250,6 +255,7 @@ def test_spar_hoa2_enc_system( ref_encoder_path, reference_path, dut_base_path, + None, tag, fs, ivas_br, @@ -314,6 +320,7 @@ def test_spar_hoa3_enc_system( ref_encoder_path, reference_path, dut_base_path, + None, tag, fs, ivas_br, @@ -368,7 +375,8 @@ def test_sba_enc_BWforce_system( if dtx == '1' and ivas_br not in ['32000', '64000']: # skip high bitrates for DTX until DTX issue is resolved pytest.skip() - + if ivas_br == 'sw_24k4_256k.bin': + pytest.skip() fs = sample_rate_bw_idx[0] bw = sample_rate_bw_idx[1] tag = tag + fs + 'c' @@ -384,6 +392,7 @@ def test_sba_enc_BWforce_system( ref_encoder_path, reference_path, dut_base_path, + None, tag, fs, ivas_br, @@ -422,6 +431,7 @@ def sba_enc( ref_encoder_path, reference_path, dut_base_path, + br_switch_file_path, tag, sampling_rate, ivas_br, @@ -450,6 +460,8 @@ def sba_enc( tag = tag + dict_bw_tag[ivas_max_bw] tag_out = f"{tag}_ivasbr{ivas_br[:-3]}k_DTX{dtx}" + if ivas_br == 'sw_24k4_256k.bin': + ivas_br = f"{br_switch_file_path}/sw_24k4_256k.bin" short_tag_ext = "" if agc != -1: short_tag_ext += f'_AGC{agc}' -- GitLab From 843414cb202b59a50a723de9e2df40da6af0bd12 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Mon, 6 Mar 2023 13:23:36 +0530 Subject: [PATCH 137/375] Clang formatting added --- lib_com/ivas_fb_mixer.c | 13 +++++++------ lib_dec/ivas_sba_dec.c | 12 +++++------- lib_dec/ivas_spar_decoder.c | 8 +++++--- lib_enc/ivas_sba_enc.c | 6 ++++-- lib_enc/ivas_spar_encoder.c | 24 +++++++++++++----------- 5 files changed, 34 insertions(+), 29 deletions(-) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index fa2f9af7fe..62f16bbb94 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -1051,8 +1051,7 @@ static void ivas_get_active_bins( static ivas_error ivas_filterbank_setup( IVAS_FB_MIXER_HANDLE hFbMixer, - const int32_t sampling_rate -) + const int32_t sampling_rate ) { int16_t i, j; const float *pAll_fb_fr[2]; @@ -1069,6 +1068,7 @@ static ivas_error ivas_filterbank_setup( set_s( hFbMixer->first_frame, 1, pCfg->num_out_chans ); set_s( hFbMixer->first_frame + pCfg->num_out_chans, 0, IVAS_SPAR_MAX_CH - pCfg->num_out_chans ); #endif + if ( pCfg->num_out_chans > 0 ) { hFbMixer->pFb->filterbank_num_bands = ivas_get_num_bands( sampling_rate ); @@ -1100,6 +1100,7 @@ static ivas_error ivas_filterbank_setup( { return error; } + if ( pCfg->num_out_chans > 0 ) { ivas_filterbank_t *pFb = hFbMixer->pFb; @@ -1111,10 +1112,9 @@ static ivas_error ivas_filterbank_setup( pFb->fb_bin_to_band.pFb_start_bin_per_band = pAll_bins_start_offset_abs; /* Initialization for short stride Parameter calculation and SPAR CLDFB reconstruction */ - pFb->fb_bin_to_band.num_cldfb_bands = ( int16_t )( sampling_rate * INV_CLDFB_BANDWIDTH + 0.5f ); + pFb->fb_bin_to_band.num_cldfb_bands = (int16_t) ( sampling_rate * INV_CLDFB_BANDWIDTH + 0.5f ); /*pFb->fb_bin_to_band.cldfb_stride = ( int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX );*/ /* equals num_cldfb_bands*/ - pFb->fb_bin_to_band.short_stride = ( int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / 4 ); - + pFb->fb_bin_to_band.short_stride = (int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / 4 ); set_f( pFb->fb_bin_to_band.p_short_stride_bin_to_band, 0.0f, 2 * MDFT_FB_BANDS_240 ); set_s( pFb->fb_bin_to_band.p_cldfb_map_to_spar_band, 0, CLDFB_NO_CHANNELS_MAX ); set_s( pFb->fb_bin_to_band.p_spar_start_bands, 0, CLDFB_NO_CHANNELS_MAX ); @@ -1181,7 +1181,7 @@ static ivas_error ivas_filterbank_setup( } ivas_get_ld_fb_resp( ppFilterbank_FRs_re_temp, ppFilterbank_FRs_im_temp, ppFilterbank_FRs_re_temp, ppFilterbank_FRs_im_temp, - active_bins_temp, start_offset_temp, num_diff_bands, pCfg->fb_latency, sampling_rate ); + active_bins_temp, start_offset_temp, num_diff_bands, pCfg->fb_latency, sampling_rate ); for ( j = start_diff_band_non48k; j < pFb->filterbank_num_bands; j++ ) { @@ -1192,6 +1192,7 @@ static ivas_error ivas_filterbank_setup( ivas_calculate_abs_fr( pFb, sampling_rate, pCfg->active_w_mixing ); } } + return error; } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 617bbfb64c..9cfb32414a 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -659,6 +659,7 @@ ivas_error ivas_sba_dec_reconfigure( #ifndef SBA_BR_SWITCHING_CLEAN_UP if ( hSpar != NULL && nchan_transport_old != ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) ) { + // VE: dirty patch -> reconfiguration of SPAR modules should be used instead !! IVAS_FB_CFG *fb_cfg; int16_t active_w_mixing; @@ -719,8 +720,7 @@ ivas_error ivas_sba_dec_reconfigure( #else if ( hSpar != NULL ) { - if ( ( hSpar->hPCA != NULL ) - && ( ( hDecoderConfig->ivas_total_brate != PCA_BRATE) || (sba_order_internal != 1 ) ) ) + if ( ( hSpar->hPCA != NULL ) && ( ( hDecoderConfig->ivas_total_brate != PCA_BRATE ) || ( sba_order_internal != 1 ) ) ) { free( st_ivas->hSpar->hPCA ); hSpar->hPCA = NULL; @@ -792,7 +792,6 @@ ivas_error ivas_sba_dec_reconfigure( hDirAC = st_ivas->hDirAC; } - #ifndef SBA_BR_SWITCHING_RECONFIG if ( hDirAC != NULL ) #else @@ -892,8 +891,7 @@ ivas_error ivas_sba_dec_reconfigure( } #ifdef SBA_BR_SWITCHING_RECONFIG #ifdef SBA_BR_SWITCHING_CLEAN_UP - if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( sba_mode_old != st_ivas->sba_mode ) || ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) - && (( (hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) ) ) + if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( sba_mode_old != st_ivas->sba_mode ) || ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) && ( ( ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) ) ) { DIRAC_CONFIG_FLAG flag_config; flag_config = DIRAC_OPEN; @@ -917,7 +915,7 @@ ivas_error ivas_sba_dec_reconfigure( return error; } } - if ( ( ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) ) && ( ( sba_mode_old != st_ivas->sba_mode ) && ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) ) + if ( ( ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) ) && ( ( sba_mode_old != st_ivas->sba_mode ) && ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) ) { if ( st_ivas->hDirAC != NULL ) { @@ -974,7 +972,6 @@ ivas_error ivas_sba_dec_reconfigure( #endif #endif #ifdef SBA_BR_SWITCHING - else if ( st_ivas->renderer_type == RENDERER_DISABLE || ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode != SBA_MODE_SPAR ) ) { if ( st_ivas->hDirAC != NULL ) @@ -988,6 +985,7 @@ ivas_error ivas_sba_dec_reconfigure( vbap_free_data( &( st_ivas->hVBAPdata ) ); } } + if ( st_ivas->hDirAC != NULL && st_ivas->sba_mode == SBA_MODE_SPAR ) { mvs2s( st_ivas->hDirAC->dirac_to_spar_md_bands, st_ivas->hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 2cf540d20d..af5d1531d2 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -141,6 +141,7 @@ ivas_error ivas_spar_dec_open( ivas_pca_dec_init( hSpar->hPCA ); } + /* mixer_mat intitialization */ for ( i = 0; i < num_channels_internal; i++ ) { @@ -158,9 +159,9 @@ ivas_error ivas_spar_dec_open( } hSpar->i_subframe = 0; - /*-----------------------------------------------------------------* - * Configuration - set SPAR high-level parameters - *-----------------------------------------------------------------*/ + /*-----------------------------------------------------------------* + * Configuration - set SPAR high-level parameters + *-----------------------------------------------------------------*/ ivas_spar_config( st_ivas->hDecoderConfig->ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, st_ivas->sid_format ); @@ -180,6 +181,7 @@ ivas_error ivas_spar_dec_open( ivas_output_init( &( st_ivas->hTransSetup ), st_ivas->transport_config ); st_ivas->hSpar = hSpar; + return error; } diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index ee46e7d955..526af9d513 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -355,6 +355,7 @@ ivas_error ivas_sba_enc_reconfigure( st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, hEncoderConfig->sba_order ); #ifdef SBA_BR_SWITCHING st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); + if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { if ( st_ivas->hSpar == NULL ) @@ -576,8 +577,8 @@ ivas_error ivas_sba_enc_reconfigure( } #endif /*-----------------------------------------------------------------* - * Allocate, initalize, and configure SCE/CPE/MCT handles - *-----------------------------------------------------------------*/ + * Allocate, initalize, and configure SCE/CPE/MCT handles + *-----------------------------------------------------------------*/ ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ); @@ -602,5 +603,6 @@ ivas_error ivas_sba_enc_reconfigure( } #endif } + return error; } diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 557748be0b..34b83b29a2 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -141,7 +141,7 @@ ivas_error ivas_spar_enc_open( /* initialization */ hSpar->hMdEnc->table_idx = -1; - /* AGC handle */ + /* AGC handle */ #ifdef DEBUG_AGC_ENCODER_CMD_OPTION hSpar->AGC_Enable = ivas_agc_enc_get_flag( hEncoderConfig->Opt_AGC_ON, nchan_transport ); #else @@ -156,7 +156,6 @@ ivas_error ivas_spar_enc_open( return error; } } - /* PCA handle */ hSpar->hPCA = NULL; if ( hEncoderConfig->Opt_PCA_ON ) @@ -172,10 +171,12 @@ ivas_error ivas_spar_enc_open( hSpar->hMdEnc->table_idx = -1; /*-----------------------------------------------------------------* - * Configuration - set SPAR high-level parameters - *-----------------------------------------------------------------*/ + * Configuration - set SPAR high-level parameters + *-----------------------------------------------------------------*/ + ivas_spar_config( hEncoderConfig->ivas_total_brate, min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), - &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, -1 ); + &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, -1 ); + if ( st_ivas->nchan_transport == 1 ) { hEncoderConfig->element_mode_init = IVAS_SCE; @@ -224,15 +225,17 @@ ivas_error ivas_spar_enc_open( hSpar->hFrontVad = NULL; } - /*-----------------------------------------------------------------* - * Final assignment - *-----------------------------------------------------------------*/ - #ifdef SBA_BR_SWITCHING_CLEAN_UP } #endif + + /*-----------------------------------------------------------------* + * Final assignment + *-----------------------------------------------------------------*/ + st_ivas->hSpar = hSpar; + return error; } @@ -290,8 +293,7 @@ void ivas_spar_enc_close( ivas_FB_mixer_close( &hSpar->hFbMixer, input_Fs, spar_reconfig_flag ); #else ivas_FB_mixer_close( &hSpar->hFbMixer, input_Fs ); -#endif -#ifndef SBA_BR_SWITCHING_CLEAN_UP + /* Trans Det handle */ ivas_spar_transient_det_close( &hSpar->hTranDet ); #endif -- GitLab From bddfcdb1510bcea311f3493b3421ade332d6a9d5 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 6 Mar 2023 09:48:55 +0100 Subject: [PATCH 138/375] issue 360: consider objects being speech+noise for active speech coding; under TUNE_360_OBJECT_WITH_NOISE --- lib_com/options.h | 2 +- lib_enc/ivas_ism_metadata_enc.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 45406dadb9..ab3d15040e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -162,8 +162,8 @@ #define BINAURALIZATION_DELAY_REPORT /* VA: Issue 255 - Changes the way the decoder delay is reported */ #define FIX_351_HRTF_COMMAND /* VA: Issue 354 - improve "-hrtf" command-line option */ - #define FIX_94_VERIFY_WAV_NUM_CHANNELS /* FhG: Issue 94 - Check if number of channels in input wav file matches encoder/renderer configuration */ +#define TUNE_360_OBJECT_WITH_NOISE /* VA: issue 360: consider objects being speech+noise for active speech coding */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 9aaa3af4b4..2171729472 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -210,6 +210,9 @@ ivas_error ivas_ism_metadata_enc( } else if ( ism_mode == ISM_MODE_DISC ) { +#ifdef TUNE_360_OBJECT_WITH_NOISE + hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10; +#else hIsmMeta[ch]->ism_metadata_flag = localVAD[ch]; if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) @@ -223,6 +226,7 @@ ivas_error ivas_ism_metadata_enc( hIsmMeta[ch]->ism_metadata_flag = 1; } } +#endif if ( hSCE[ch]->hCoreCoder[0]->tcxonly ) { @@ -238,6 +242,7 @@ ivas_error ivas_ism_metadata_enc( rate_ism_importance( nchan_transport, hIsmMeta, hSCE, ism_imp ); +#ifndef TUNE_360_OBJECT_WITH_NOISE /* relax the importance decision in "stereo" coding for noisy audio */ if ( ism_mode == ISM_MODE_DISC && num_obj == 2 ) { @@ -257,7 +262,7 @@ ivas_error ivas_ism_metadata_enc( } } } - +#endif /*----------------------------------------------------------------* * Write ISm common signaling *----------------------------------------------------------------*/ -- GitLab From 325eaa1278900b8f4152dbd9cf82591da2b6c058 Mon Sep 17 00:00:00 2001 From: hsd Date: Mon, 6 Mar 2023 12:47:19 +0100 Subject: [PATCH 139/375] [remove] TD_REND_FIX_DIV_BY_ZERO. Once/If UBSAN builds will be added, this will show up again and can be fixed by the experts. --- lib_com/options.h | 1 - lib_rend/ivas_objectRenderer_sfx.c | 7 ------- 2 files changed, 8 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 70a48b1ed2..1546c4087f 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,7 +170,6 @@ #ifdef FIX_I109_ORIENTATION_TRACKING #define OTR_REFERENCE_VECTOR_TRACKING /* FhG: enables the reference position orientation tracking mode */ #endif -#define TD_REND_FIX_DIV_BY_ZERO /* FhG: avoid division by zero in sincResample fn */ #define TD_TDREND_FIX_NULLPTR_ACCESS /* FhG: avoid nullptr access in ivas_rend_TDObjRendOpen */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_rend/ivas_objectRenderer_sfx.c b/lib_rend/ivas_objectRenderer_sfx.c index e66ce89167..10f5ef91f0 100644 --- a/lib_rend/ivas_objectRenderer_sfx.c +++ b/lib_rend/ivas_objectRenderer_sfx.c @@ -182,13 +182,6 @@ static void sincResample( const float *p_sinc_forward; const float *p_sinc_backward; -#ifdef TD_REND_FIX_DIV_BY_ZERO - /* avoid division by 0 */ - if ( 0 == length_out ) - { - return; - } -#endif /* TD_REND_FIX_DIV_BY_ZERO */ /* Compute fractional time step */ t_step = (float) ( length_in ) / (float) ( length_out ); -- GitLab From 27270f5b41064ca752b7eb2fd454388e024a205a Mon Sep 17 00:00:00 2001 From: hsd Date: Mon, 6 Mar 2023 12:48:13 +0100 Subject: [PATCH 140/375] [remove] TD_TDREND_FIX_NULLPTR_ACCESS. Once/If UBSAN builds will be added, this will show up again and can be fixed by the experts. --- lib_com/options.h | 1 - lib_rend/ivas_objectRenderer.c | 8 -------- 2 files changed, 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 1546c4087f..31bf264760 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,7 +170,6 @@ #ifdef FIX_I109_ORIENTATION_TRACKING #define OTR_REFERENCE_VECTOR_TRACKING /* FhG: enables the reference position orientation tracking mode */ #endif -#define TD_TDREND_FIX_NULLPTR_ACCESS /* FhG: avoid nullptr access in ivas_rend_TDObjRendOpen */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index ce1ff2bd6c..7fcae1c0cc 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -575,16 +575,8 @@ ivas_error ivas_td_binaural_open_ext( transport_config = rendAudioConfigToIvasAudioConfig( inConfig ); #endif ivas_format = ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ? MC_FORMAT : ISM_FORMAT; -#ifdef TD_TDREND_FIX_NULLPTR_ACCESS - if ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) - { - hTransSetup.ls_azimuth = customLsInput->ls_azimuth; - hTransSetup.ls_elevation = customLsInput->ls_elevation; - } -#else hTransSetup.ls_azimuth = customLsInput->ls_azimuth; hTransSetup.ls_elevation = customLsInput->ls_elevation; -#endif /* TD_TDREND_FIX_NULLPTR_ACCESS */ return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); } -- GitLab From f73558f1fbd7780fd2792fee4db3c65e6a19fa6a Mon Sep 17 00:00:00 2001 From: hsd Date: Mon, 6 Mar 2023 14:18:02 +0100 Subject: [PATCH 141/375] [fix] call SetReferenceRotation before SetHeadRotation. Ohterwise the reference rotation gets applied one frame too late --- apps/decoder.c | 54 ++++++++++++++++++++++++++++++++----------------- apps/renderer.c | 36 ++++++++++++++++----------------- 2 files changed, 54 insertions(+), 36 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 40ac02238e..dcd5cf62e8 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1509,6 +1509,42 @@ static ivas_error decodeG192( goto cleanup; } +#ifdef FIX_I109_ORIENTATION_TRACKING + /* Reference rotation */ + if ( arg.enableReferenceRotation ) + { + IVAS_QUATERNION quaternion; + if ( ( error = HeadRotationFileReading( refRotReader, &quaternion ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) ); + goto cleanup; + } + + if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } +#endif +#ifdef FIX_I109_ORIENTATION_TRACKING + /* Reference rotation */ + if ( arg.enableReferenceRotation ) + { + IVAS_QUATERNION quaternion; + if ( ( error = HeadRotationFileReading( refRotReader, &quaternion ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) ); + goto cleanup; + } + + if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } +#endif /* Head-tracking input simulation */ if ( arg.enableHeadRotation ) { @@ -1538,24 +1574,6 @@ static ivas_error decodeG192( } } -#ifdef FIX_I109_ORIENTATION_TRACKING - /* Reference rotation */ - if ( arg.enableReferenceRotation ) - { - IVAS_QUATERNION quaternion; - if ( ( error = HeadRotationFileReading( refRotReader, &quaternion ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) ); - goto cleanup; - } - - if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } -#endif /* Run decoder for one frame (get rendered output) */ if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamples ) ) != IVAS_ERR_OK ) { diff --git a/apps/renderer.c b/apps/renderer.c index fa3a3d21ee..fef1e65eba 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -942,6 +942,24 @@ int main( ObjectPositionBuffer mtdBuffer; IsmPositionProvider_getNextFrame( positionProvider, &mtdBuffer ); +#ifdef FIX_I109_ORIENTATION_TRACKING + /* Read from reference rotation trajectory file if specified */ + if ( referenceRotReader != NULL ) + { + IVAS_QUATERNION quaternion; + if ( HeadRotationFileReading( referenceRotReader, &quaternion ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error in Head Rotation File Reading.\r\n" ); + exit( -1 ); + } + if ( IVAS_REND_SetReferenceRotation( hIvasRend, quaternion ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error setting Reference Rotation.\r\n" ); + exit( -1 ); + } + } +#endif + /* Read from head rotation trajectory file if specified */ if ( headRotReader != NULL ) { @@ -973,24 +991,6 @@ int main( } } -#ifdef FIX_I109_ORIENTATION_TRACKING - /* Read from reference rotation trajectory file if specified */ - if ( referenceRotReader != NULL ) - { - IVAS_QUATERNION quaternion; - if ( HeadRotationFileReading( referenceRotReader, &quaternion ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error in Head Rotation File Reading.\r\n" ); - exit( -1 ); - } - if ( IVAS_REND_SetReferenceRotation( hIvasRend, quaternion ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error setting Reference Rotation.\r\n" ); - exit( -1 ); - } - } -#endif - for ( i = 0; i < args.inConfig.numMultiChannelBuses; ++i ) { if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, mcIds[i], &numChannels ) ) != IVAS_ERR_OK ) -- GitLab From 31e89e335d81b1cc13dfef345ac029d481ab4b37 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Mon, 6 Mar 2023 18:59:01 +0530 Subject: [PATCH 142/375] Resolving build warnings : set 1 --- lib_dec/ivas_sba_dec.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 9c2a0fb476..9c70347af5 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -64,7 +64,9 @@ ivas_error ivas_sba_dec_reconfigure( int32_t ivas_total_brate, last_ivas_total_brate; DECODER_CONFIG_HANDLE hDecoderConfig; ivas_error error; - +#ifdef SBA_BR_SWITCHING_CLEAN_UP + int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; +#endif error = IVAS_ERR_OK; hDecoderConfig = st_ivas->hDecoderConfig; @@ -73,7 +75,7 @@ ivas_error ivas_sba_dec_reconfigure( sba_mode_old = ivas_sba_mode_select( last_ivas_total_brate ); st_ivas->sba_mode = sba_mode_old; - + /*-----------------------------------------------------------------* * Set SBA high-level parameters * Save old SBA high-level parameters @@ -133,9 +135,9 @@ ivas_error ivas_sba_dec_reconfigure( SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); - nchan_internal = ivas_sba_get_nchan_metadata( sba_order_internal ); + #ifndef SBA_BR_SWITCHING_CLEAN_UP - + nchan_internal = ivas_sba_get_nchan_metadata( sba_order_internal ); if ( hSpar != NULL && nchan_transport_old != ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) ) { // VE: dirty patch -> reconfiguration of SPAR modules should be used instead !! @@ -376,7 +378,7 @@ ivas_error ivas_sba_dec_reconfigure( ivas_dirac_dec_close( st_ivas->hDirAC ); st_ivas->hDirAC = NULL; } - int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; + st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); -- GitLab From b24077f7e42fd2948a49088e7adfdc6c13832c3d Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Mon, 6 Mar 2023 15:06:18 +0100 Subject: [PATCH 143/375] [fix] add reverb only if late_reverb_on flag is 1 --- lib_rend/ivas_objectRenderer.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 69a8c88219..57390d3f91 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -323,23 +323,23 @@ void ivas_td_binaural_renderer_unwrap( #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND - if ( hReverb != NULL ) + if ( ( hReverb != NULL ) && ( hReverb->pConfig.roomAcoustics.late_reverb_on ) ) + { + /* add reverb to rendered signals */ + v_add( reverb_signal[0], output[0], output[0], output_frame ); + v_add( reverb_signal[1], output[1], output[1], output_frame ); + } #else if ( hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ -#endif { - -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND - if ( hReverb != NULL ) -#else if ( hRenderConfig->roomAcoustics.late_reverb_on ) -#endif { /* add reverb to rendered signals */ v_add( reverb_signal[0], output[0], output[0], output_frame ); v_add( reverb_signal[1], output[1], output[1], output_frame ); } } +#endif return; } -- GitLab From 8f2cd9672ea3066a4cd8beb5607d3bd749a8ee3b Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Mon, 6 Mar 2023 19:39:44 +0530 Subject: [PATCH 144/375] Resolving pipeline warnings : set 2 --- lib_dec/ivas_sba_dec.c | 2 +- lib_enc/ivas_spar_encoder.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 9c70347af5..fbb69d487a 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -127,7 +127,7 @@ ivas_error ivas_sba_dec_reconfigure( else { #ifdef SBA_BR_SWITCHING_CLEAN_UP - int16_t sba_order_internal, nchan_internal; + int16_t sba_order_internal; #else int16_t i, sba_order_internal, nchan_internal; DIRAC_DEC_HANDLE hDirAC = st_ivas->hDirAC; diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 956ea3fae8..79cb801361 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -220,11 +220,15 @@ ivas_error ivas_spar_enc_open( if ( ( error = init_encoder( hSpar->hCoreCoderVAD, 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1 ) ) != IVAS_ERR_OK ) #endif { - hSpar->hCoreCoderVAD = NULL; - hSpar->hFrontVad = NULL; + return error; } } + else + { + hSpar->hCoreCoderVAD = NULL; + hSpar->hFrontVad = NULL; + } #ifdef SBA_BR_SWITCHING_CLEAN_UP } #endif -- GitLab From 043ba83ed4304e17da70b68990be8ddbfed197c3 Mon Sep 17 00:00:00 2001 From: Andrea Eichenseer Date: Mon, 6 Mar 2023 16:43:05 +0100 Subject: [PATCH 145/375] Rename cng_paramISM_flag to cng_ism_flag. BE. --- lib_dec/acelp_core_dec.c | 6 +++--- lib_dec/fd_cng_dec.c | 12 ++++++------ lib_dec/init_dec.c | 2 +- lib_dec/ivas_ism_dtx_dec.c | 4 ++-- lib_dec/ivas_ism_metadata_dec.c | 2 +- lib_dec/stat_dec.h | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index 571311ed12..9608d03002 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -534,7 +534,7 @@ ivas_error acelp_core_dec( } #ifdef PARAM_ISM_DTX_CNG if ( !st->read_sid_info ) - // if (!st->read_sid_info && st->cng_paramISM_flag) /* read_sid_info can only be 0 in ParamISM mode */ + // if (!st->read_sid_info && st->cng_ism_flag) /* read_sid_info can only be 0 in ParamISM mode */ { float noise_lvl_highest; @@ -1132,7 +1132,7 @@ ivas_error acelp_core_dec( } #ifdef PARAM_ISM_DTX_CNG - if ( st->element_mode != IVAS_CPE_TD && !st->cng_paramISM_flag ) + if ( st->element_mode != IVAS_CPE_TD && !st->cng_ism_flag ) #else if ( st->element_mode != IVAS_CPE_TD ) #endif @@ -1312,7 +1312,7 @@ ivas_error acelp_core_dec( if ( ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && ( st->cng_type == FD_CNG ) && ( st->hFdCngDec->hFdCngCom->numCoreBands < st->cldfbSyn->no_channels ) ) { #ifdef PARAM_ISM_DTX_CNG - generate_comfort_noise_dec_hf( realBuffer, imagBuffer, st->hFdCngDec->hFdCngCom, st->cng_paramISM_flag ); + generate_comfort_noise_dec_hf( realBuffer, imagBuffer, st->hFdCngDec->hFdCngCom, st->cng_ism_flag ); #else generate_comfort_noise_dec_hf( realBuffer, imagBuffer, st->hFdCngDec->hFdCngCom ); #endif diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 39b09921e9..0e2cea8acb 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -1086,7 +1086,7 @@ void generate_comfort_noise_dec( seed2 = &( hFdCngCom->seed2 ); #ifdef PARAM_ISM_DTX_CNG - if ( ( st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 ) || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) + if ( ( st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 ) || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) #else if ( st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 ) #endif @@ -1100,7 +1100,7 @@ void generate_comfort_noise_dec( if ( hFdCngCom->startBand == 0 ) { #ifdef PARAM_ISM_DTX_CNG - if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) + if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) #else if ( st->element_mode == IVAS_CPE_MDCT ) #endif @@ -1129,7 +1129,7 @@ void generate_comfort_noise_dec( { /* Real part in FFT bins */ #ifdef PARAM_ISM_DTX_CNG - if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) + if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) #else if ( st->element_mode == IVAS_CPE_MDCT ) #endif @@ -1147,7 +1147,7 @@ void generate_comfort_noise_dec( /* Imaginary part in FFT bins */ #ifdef PARAM_ISM_DTX_CNG - if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) + if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) #else if ( st->element_mode == IVAS_CPE_MDCT ) #endif @@ -1229,7 +1229,7 @@ void generate_comfort_noise_dec( { /* Real part in CLDFB band */ #ifdef PARAM_ISM_DTX_CNG - if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) + if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) #else if ( st->element_mode == IVAS_CPE_MDCT ) #endif @@ -1246,7 +1246,7 @@ void generate_comfort_noise_dec( /* Imaginary part in CLDFB band */ #ifdef PARAM_ISM_DTX_CNG - if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) + if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) #else if ( st->element_mode == IVAS_CPE_MDCT ) #endif diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 402fdc78f5..af8c938b0f 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -739,7 +739,7 @@ ivas_error init_decoder( st->cna_dirac_flag = 0; st->cng_sba_flag = 0; #ifdef PARAM_ISM_DTX_CNG - st->cng_paramISM_flag = 0; + st->cng_ism_flag = 0; st->read_sid_info = 1; /* by default read the sid info from bitstream */ #endif diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index dbf7462e41..6dc9b9845d 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -80,12 +80,12 @@ static void ivas_ism_preprocessing( st->read_sid_info = 0; /* do not read the sid info from bitstream but use the estimated noise */ } - st->cng_paramISM_flag = 1; + st->cng_ism_flag = 1; } #ifndef DISCRETE_ISM_DTX_CNG else { - st->cng_paramISM_flag = 0; + st->cng_ism_flag = 0; } #endif diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index e9d5638763..fdd5f61e81 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -631,7 +631,7 @@ ivas_error ivas_ism_metadata_dec( #ifdef PARAM_ISM_DTX_CNG for ( ch = 0; ch < *nchan_transport; ch++ ) { - hSCE[ch]->hCoreCoder[0]->cng_paramISM_flag = 0; + hSCE[ch]->hCoreCoder[0]->cng_ism_flag = 0; } #endif diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 0950b529f6..65e4e362ef 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1346,7 +1346,7 @@ typedef struct Decoder_State MCT_CHAN_MODE mct_chan_mode; #ifdef PARAM_ISM_DTX_CNG - int16_t cng_paramISM_flag; /* CNG in Param-ISM flag */ + int16_t cng_ism_flag; /* CNG in Param-ISM flag */ int16_t read_sid_info; /* For ParamISM, use the transmitted noise */ #endif -- GitLab From c9b5b081103dff63d1e72d312f355879a301635a Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 6 Mar 2023 18:55:09 +0100 Subject: [PATCH 146/375] - accept UNIFY_MD_QUANTIZER - remove MD_Q_PARAM_BE, MD_SMOOTH_PARAM_BE, and DTX_PARAM_BE --- lib_com/ivas_cnst.h | 2 +- lib_com/ivas_ism_config.c | 90 ++-------------- lib_com/ivas_prot.h | 22 +--- lib_com/options.h | 10 +- lib_dec/ivas_ism_metadata_dec.c | 184 +++----------------------------- lib_dec/ivas_ism_param_dec.c | 5 - lib_enc/ivas_ism_dtx_enc.c | 14 +-- lib_enc/ivas_ism_enc.c | 12 --- lib_enc/ivas_ism_metadata_enc.c | 128 ++-------------------- lib_enc/ivas_ism_param_enc.c | 8 -- 10 files changed, 39 insertions(+), 436 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index f93872a707..905a01ef2b 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -340,7 +340,7 @@ typedef enum #else #define PARAM_ISM_DTX_COH_SCA_BITS 4 #endif -#if (defined DISCRETE_ISM_DTX_CNG && defined UNIFY_MD_QUANTIZER ) +#ifdef DISCRETE_ISM_DTX_CNG #define ISM_DTX_AZI_BITS_HIGH 8 #define ISM_DTX_ELE_BITS_HIGH 7 #define ISM_Q_STEP_HIGH (ISM_Q_STEP / 2) diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 30d16a04f2..f762d4d88b 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -356,20 +356,17 @@ void ivas_ism_reset_metadata_API( /*! r: index of the winning codeword */ int16_t ism_quant_meta( - const float val, /* i : scalar value to quantize */ - float *valQ, /* o : quantized value */ - const float borders[], /* i : level borders */ -#ifdef UNIFY_MD_QUANTIZER + const float val, /* i : scalar value to quantize */ + float *valQ, /* o : quantized value */ + const float borders[], /* i : level borders */ const float q_step, /* i : quantization step */ const float q_step_border, /* i : quantization step at the border */ -#endif - const int16_t cbsize /* i : codebook size */ + const int16_t cbsize /* i : codebook size */ ) { int16_t idx, idx_start; float qlow, step; -#ifdef UNIFY_MD_QUANTIZER if ( val <= borders[1] ) { qlow = borders[0]; @@ -388,26 +385,6 @@ int16_t ism_quant_meta( idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ); step = q_step_border; } -#else - if ( val <= borders[1] ) - { - qlow = borders[0]; - idx_start = 0; - step = ISM_Q_STEP_BORDER; - } - else if ( val <= borders[2] ) - { - qlow = borders[1]; - idx_start = (int16_t) ( ( borders[1] - borders[0] ) / ISM_Q_STEP_BORDER ); - step = ISM_Q_STEP; - } - else - { - qlow = borders[2]; - idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / ISM_Q_STEP_BORDER ); - step = ISM_Q_STEP_BORDER; - } -#endif idx = idx_start + (int16_t) max( 0.f, min( cbsize - 1, ( ( val - qlow ) / step + 0.5f ) ) ); *valQ = ( idx - idx_start ) * step + qlow; @@ -424,19 +401,16 @@ int16_t ism_quant_meta( /*! r: dequantized value */ float ism_dequant_meta( - const int16_t idx, /* i : quantizer index */ - const float borders[], /* i : level borders */ -#ifdef UNIFY_MD_QUANTIZER + const int16_t idx, /* i : quantizer index */ + const float borders[], /* i : level borders */ const float q_step, /* i : quantization step */ const float q_step_border, /* i : quantization step at the border */ -#endif - const int16_t cbsize /* i : codebook size */ + const int16_t cbsize /* i : codebook size */ ) { int16_t idx_start; float qlow, step, valQ; -#ifdef UNIFY_MD_QUANTIZER if ( idx <= ( borders[1] - borders[0] ) / q_step_border ) { qlow = borders[0]; @@ -455,26 +429,6 @@ float ism_dequant_meta( idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ); step = q_step_border; } -#else - if ( idx <= ( borders[1] - borders[0] ) / ISM_Q_STEP_BORDER ) - { - qlow = borders[0]; - idx_start = 0; - step = ISM_Q_STEP_BORDER; - } - else if ( idx <= cbsize - 1 - ( borders[3] - borders[2] ) / ISM_Q_STEP_BORDER ) - { - qlow = borders[1]; - idx_start = (int16_t) ( ( borders[1] - borders[0] ) / ISM_Q_STEP_BORDER ); - step = ISM_Q_STEP; - } - else - { - qlow = borders[2]; - idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / ISM_Q_STEP_BORDER ); - step = ISM_Q_STEP_BORDER; - } -#endif valQ = ( idx - idx_start ) * step + qlow; @@ -575,7 +529,6 @@ void update_last_metadata( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ -#ifdef UNIFY_MD_QUANTIZER void ivas_get_ism_sid_quan_bitbudget( const int16_t num_obj, /* i : number of objects */ int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ @@ -604,33 +557,4 @@ void ivas_get_ism_sid_quan_bitbudget( return; } -#else -/*! r: low resolution flag */ -int16_t ivas_get_ism_sid_quan_bitbudget( - const int16_t num_obj, /* i : number of objects */ - int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ - int16_t *nBits_elevation, /* o : number of Q bits for elevation */ - int16_t *nBits_coh, /* o : number of Q bits for coherence */ - int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ -) -{ - int16_t low_res_q; - - low_res_q = 0; - *nBits_azimuth = ISM_AZIMUTH_NBITS; - *nBits_elevation = ISM_ELEVATION_NBITS; - *nBits_coh = ISM_DTX_COH_SCA_BITS; - *nBits_sce_id = 1; - - if ( num_obj >= 3 ) - { - low_res_q = 1; - *nBits_azimuth = PARAM_ISM_DTX_AZI_BITS; - *nBits_elevation = PARAM_ISM_DTX_ELE_BITS; - *nBits_sce_id = 2; - } - - return low_res_q; -} -#endif #endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index f8177afc39..abf5400b76 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -777,10 +777,8 @@ int16_t ism_quant_meta( const float val, /* i : scalar value to quantize */ float *valQ, /* o : quantized value */ const float borders[], /* i : level borders */ -#ifdef UNIFY_MD_QUANTIZER const float q_step, /* i : quantization step */ const float q_step_border, /* i : quantization step at the border */ -#endif const int16_t cbsize /* i : codebook size */ ); @@ -788,10 +786,8 @@ int16_t ism_quant_meta( float ism_dequant_meta( const int16_t idx, /* i : quantizer index */ const float borders[], /* i : level borders */ -#ifdef UNIFY_MD_QUANTIZER const float q_step, /* i : quantization step */ const float q_step_border, /* i : quantization step at the border */ -#endif const int16_t cbsize /* i : codebook size */ ); @@ -924,11 +920,7 @@ ivas_error ivas_ism_dtx_open( #ifdef DISCRETE_ISM_DTX_CNG /*! r: indication of DTX frame */ -#ifdef DTX_PARAM_BE -int16_t ivas_ism_dtx_enc_COMMON( -#else int16_t ivas_ism_dtx_enc( -#endif ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ const int16_t num_obj, /* i : number of objects */ @@ -938,8 +930,7 @@ int16_t ivas_ism_dtx_enc( int16_t md_diff_flag[], /* o : metadata differential flag */ int16_t *sid_flag /* o : indication of SID frame */ ); -#endif -#if ( !defined DISCRETE_ISM_DTX_CNG || defined DTX_PARAM_BE ) +#else /*! r: indication of DTX frame */ int16_t ivas_ism_dtx_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ @@ -1018,7 +1009,6 @@ void update_last_metadata( const int16_t updt_flag[] /* i : last metadata update flag */ ); -#ifdef UNIFY_MD_QUANTIZER /*! r: low resolution flag */ void ivas_get_ism_sid_quan_bitbudget( const int16_t num_obj, /* i : number of objects */ @@ -1029,16 +1019,6 @@ void ivas_get_ism_sid_quan_bitbudget( int16_t *nBits_coh, /* o : number of Q bits for coherence */ int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ); -#else -/*! r: low resolution flag */ -int16_t ivas_get_ism_sid_quan_bitbudget( - const int16_t num_obj, /* i : number of objects */ - int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ - int16_t *nBits_elevation, /* o : number of Q bits for elevation */ - int16_t *nBits_coh, /* o : number of Q bits for coherence */ - int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ -); -#endif #endif #endif diff --git a/lib_com/options.h b/lib_com/options.h index fbb764cae6..de1517b668 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ @@ -67,7 +67,7 @@ /*#define DEBUG_MODE_DIRAC*/ /* output most important DIRAC parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_MDCT*/ /* output most important MDCT parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_PARAM_MC */ /* output Parametric MC paramters to the subdirectory "res/" */ -#define DEBUG_MODE_PARAM_ISM /* output Parametric ISM paramters to the subdirectory "res/" */ +/*#define DEBUG_MODE_PARAM_ISM*/ /* output Parametric ISM paramters to the subdirectory "res/" */ /*#define DEBUG_MODE_INFO_TWEAK*/ /* enable command line switch to specify subdirectory for debug info output inside "./res/" */ /*#define DEBUG_MODE_INFO_PLC */ /* define to output PLC related parameters */ /*#define DEBUG_MODE_INFO_ALLRAD*/ /* define to output generated HOA decoding mtx */ @@ -160,15 +160,11 @@ #define SMOOTH_WITH_TRANS_DET #endif +#define TUNE_360_OBJECT_WITH_NOISE /* VA: issue 360: consider objects being speech+noise for active speech coding */ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ -/*#define MD_Q_PARAM_BE*/ -/*#define MD_SMOOTH_PARAM_BE*/ -/*#define DTX_PARAM_BE*/ -#define UNIFY_MD_QUANTIZER #define DISC_CNG -#define TUNE_360_OBJECT_WITH_NOISE // VA: issue 360: consider objects being speech+noise for active speech coding */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index e9d5638763..9ba2254f4f 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -378,11 +378,7 @@ ivas_error ivas_ism_metadata_dec( } else /* ISM_MODE_DISC */ { -#ifdef UNIFY_MD_QUANTIZER hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); -#else - hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); -#endif } /*----------------------------------------------------------------* @@ -444,11 +440,7 @@ ivas_error ivas_ism_metadata_dec( } else /* ISM_MODE_DISC */ { -#ifdef UNIFY_MD_QUANTIZER hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#else - hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); -#endif } /*----------------------------------------------------------------* @@ -557,10 +549,7 @@ ivas_error ivas_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG if ( hISMDTX.ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) { -#ifdef MD_SMOOTH_PARAM_BE - if ( ism_mode != ISM_MODE_PARAM ) -#endif - ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); + ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); } hISMDTX.ism_dtx_hangover_cnt = min( ( hISMDTX.ism_dtx_hangover_cnt )++, IVAS_ISM_DTX_HO_MAX ); #endif @@ -686,70 +675,6 @@ ivas_error create_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG -#ifndef UNIFY_MD_QUANTIZER -/*-------------------------------------------------------------------* - * ivas_ism_dec_dequantize_DOA_dtx() - * - * - *-------------------------------------------------------------------*/ - -static void ivas_ism_dec_dequantize_DOA_dtx( - const int16_t azi_bits, - const int16_t ele_bits, - const int16_t azi_idx, - const int16_t ele_idx, - float *azi_val, - float *ele_val ) -{ - int16_t nbits, npoints, angle_spacing, az_alpha, ele_alpha, tmp_alpha; - - /* Step 1: Determine angle spacing/n_points based on minimum value among elevation/azimuth bits */ - nbits = min( azi_bits, ele_bits ); - - if ( nbits == ISM_ELEVATION_NBITS ) - { - angle_spacing = 5; - } - else - { - angle_spacing = (int16_t) ( ( 180.f / (float) ( 1 << nbits ) ) + 0.5f ); - } - - npoints = (int16_t) ( ( 90 / angle_spacing ) + 0.5f ); - - /* sanity check */ - if ( angle_spacing == 360 ) - { - assert( azi_idx == 0 ); - assert( ele_idx == 0 ); - - *azi_val = 0.f; - *ele_val = 0.f; - return; - } - - /* Get the azimuth and elevation values */ - ele_alpha = 2 * npoints - 1; - assert( ( 0 <= ele_idx ) && ( ele_idx < ele_alpha ) ); - *ele_val = (float) ( ( ele_idx - npoints ) * angle_spacing ); - - az_alpha = 4 * npoints - 1; - assert( ( 0 <= azi_idx ) && ( azi_idx < az_alpha ) ); - tmp_alpha = (int16_t) ( azi_idx * ( 360.f / az_alpha ) ); - - if ( tmp_alpha > 180.0f ) - { - *azi_val = ( (float) tmp_alpha ) - 360.0f; - } - else - { - *azi_val = (float) tmp_alpha; - } - - return; -} -#endif - /*-------------------------------------------------------------------* * ivas_ism_metadata_sid_dec() * @@ -769,12 +694,8 @@ ivas_error ivas_ism_metadata_sid_dec( int16_t nb_bits_metadata[] /* o : number of metadata bits */ ) { -#ifdef UNIFY_MD_QUANTIZER int16_t i, ch, nb_bits_start, last_bit_pos; float q_step, q_step_border; -#else - int16_t i, ch, nb_bits_start, last_bit_pos, low_res_q; -#endif int16_t idx, idx_azimuth, idx_elevation; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; int16_t md_diff_flag[MAX_NUM_OBJECTS]; @@ -786,10 +707,7 @@ ivas_error ivas_ism_metadata_sid_dec( if ( ism_total_brate == FRAME_NO_DATA ) { -#ifdef MD_SMOOTH_PARAM_BE - if ( ism_mode != ISM_MODE_PARAM ) -#endif - ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); + ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); return IVAS_ERR_OK; } @@ -831,11 +749,7 @@ ivas_error ivas_ism_metadata_sid_dec( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ -#ifdef UNIFY_MD_QUANTIZER ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); -#else - low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); -#endif /*----------------------------------------------------------------* * Spatial parameters, loop over TCs - 1 @@ -897,85 +811,24 @@ ivas_error ivas_ism_metadata_sid_dec( if ( md_diff_flag[ch] == 1 ) { -#ifndef UNIFY_MD_QUANTIZER - if ( low_res_q ) - { - idx_azimuth = get_next_indice( st0, nBits_azimuth ); - idx_elevation = get_next_indice( st0, nBits_elevation ); + /* Azimuth decoding */ + idx_azimuth = get_next_indice( st0, nBits_azimuth ); + hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, q_step, q_step_border, 1 << nBits_azimuth ); - ivas_ism_dec_dequantize_DOA_dtx( nBits_azimuth, nBits_elevation, idx_azimuth, idx_elevation, &( hIsmMetaData->azimuth ), &( hIsmMetaData->elevation ) ); - } - else -#endif - { - /* Azimuth decoding */ - idx_azimuth = get_next_indice( st0, nBits_azimuth ); + /* Elevation decoding */ + idx_elevation = get_next_indice( st0, nBits_elevation ); + hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, q_step, q_step_border, 1 << nBits_elevation ); -#ifndef UNIFY_MD_QUANTIZER - /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ - if ( idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - { - idx_azimuth -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* +180° -> -180° */ - } - else if ( idx_azimuth < 0 ) - { - idx_azimuth += ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* -180° -> +180° */ - } - - /* +180° == -180° */ - if ( idx_azimuth == ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - { - idx_azimuth = 0; - } - - /* sanity check in case of FER or BER */ - if ( idx_azimuth < 0 || idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - { - idx_azimuth = hIsmMetaData->last_azimuth_idx; - } - - hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); -#else - hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, q_step, q_step_border, 1 << nBits_azimuth ); -#endif - - /* Elevation decoding */ - idx_elevation = get_next_indice( st0, nBits_elevation ); -#ifndef UNIFY_MD_QUANTIZER - - /* sanity check in case of FER or BER */ - if ( idx_elevation < 0 || idx_elevation > ( 1 << ISM_ELEVATION_NBITS ) - 1 ) - { - idx_elevation = hIsmMetaData->last_elevation_idx; - } - - /* Elevation dequantization */ - hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); -#else - hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, q_step, q_step_border, 1 << nBits_elevation ); -#endif + /* update last indexes to correspond to active frames coding */ + if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) + { + hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); + hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); } - -#ifdef MD_Q_PARAM_BE - if ( ism_mode != ISM_MODE_PARAM ) -#endif + else { -#ifdef UNIFY_MD_QUANTIZER - /* update last indexes to correspond to active frames coding */ - if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) - { - hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); - hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); - } - else - { - hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); - hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); - } -#else - hIsmMetaData->last_azimuth_idx = idx_azimuth; - hIsmMetaData->last_elevation_idx = idx_elevation; -#endif + hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); + hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); } /* save for smoothing metadata evolution */ @@ -993,10 +846,7 @@ ivas_error ivas_ism_metadata_sid_dec( } /* smooth the metadata evolution */ -#ifdef MD_SMOOTH_PARAM_BE - if ( ism_mode != ISM_MODE_PARAM ) -#endif - ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); + ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index d08618e9cd..4c15a93a53 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -63,13 +63,8 @@ static void ivas_param_ism_dec_dequant_DOA( /* Get the azimuth and elevation values */ for ( i = 0; i < hParamIsm->num_obj; i++ ) { -#ifdef UNIFY_MD_QUANTIZER hDirAC->azimuth_values[i] = ism_dequant_meta( hParamIsm->azi_index[i], ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); hDirAC->elevation_values[i] = ism_dequant_meta( hParamIsm->ele_index[i], ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#else - hDirAC->azimuth_values[i] = ism_dequant_meta( hParamIsm->azi_index[i], ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); - hDirAC->elevation_values[i] = ism_dequant_meta( hParamIsm->ele_index[i], ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); -#endif } return; diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 353145fcd5..064754783d 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -104,11 +104,7 @@ ivas_error ivas_ism_dtx_open( *-------------------------------------------------------------------*/ /*! r: indication of DTX frame */ -#ifdef DTX_PARAM_BE -int16_t ivas_ism_dtx_enc_COMMON( -#else int16_t ivas_ism_dtx_enc( -#endif ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ const int16_t num_obj, /* i : number of objects */ @@ -123,9 +119,7 @@ int16_t ivas_ism_dtx_enc( int16_t nBits, nBits_MD_max; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; float lp_noise[MAX_NUM_OBJECTS], lp_noise_variation, lp_noise_mean; -#ifdef UNIFY_MD_QUANTIZER float tmp1, tmp2; -#endif #ifdef TUNE_360_OBJECT_WITH_NOISE for ( ch = 0; ch < nchan_transport; ch++ ) @@ -177,11 +171,7 @@ int16_t ivas_ism_dtx_enc( if ( dtx_flag ) { -#ifdef UNIFY_MD_QUANTIZER ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &tmp1, &tmp2, &nBits_coh, &nBits_sce_id ); -#else - ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); -#endif nBits = 0; for ( ch = 0; ch < num_obj; ch++ ) @@ -294,9 +284,7 @@ int16_t ivas_ism_dtx_enc( return dtx_flag; } -#endif - -#if ( !defined DISCRETE_ISM_DTX_CNG || defined DTX_PARAM_BE ) +#else /*-------------------------------------------------------------------* * ivas_ism_dtx_enc() * diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index e3a8227a3f..3c6f4c1e5b 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -225,19 +225,7 @@ ivas_error ivas_ism_enc( /* analysis and decision about DTX */ #ifdef DISCRETE_ISM_DTX_CNG -#ifdef DTX_PARAM_BE - if ( st_ivas->ism_mode != ISM_MODE_PARAM ) - { - dtx_flag = ivas_ism_dtx_enc_COMMON( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); - } - else - { - dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); - } -#else dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); -#endif - #else dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); #endif diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 851ffc65c2..070f6ba7d0 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -220,13 +220,8 @@ ivas_error ivas_ism_metadata_enc( if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { /* send metadata even in inactive segments when noise is audible and metadata are changing */ -#ifdef UNIFY_MD_QUANTIZER diff = (int16_t) fabsf( hIsmMeta[ch]->azimuth - ism_dequant_meta( hIsmMeta[ch]->last_azimuth_idx, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ) ); diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->elevation - ism_dequant_meta( hIsmMeta[ch]->last_elevation_idx, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ) ) ); -#else - diff = (int16_t) fabsf( hIsmMeta[ch]->azimuth - ism_dequant_meta( hIsmMeta[ch]->last_azimuth_idx, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ) ); - diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->elevation - ism_dequant_meta( hIsmMeta[ch]->last_elevation_idx, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ) ) ); -#endif if ( hSCE[ch]->hCoreCoder[0]->lp_noise > 15 && diff >= 10 ) { @@ -337,11 +332,7 @@ ivas_error ivas_ism_metadata_enc( /* Azimuth quantization (quantize azimuth to the AZIMUTH_NBITS-bit index */ if ( ism_mode == ISM_MODE_DISC ) { -#ifdef UNIFY_MD_QUANTIZER idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); -#else - idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); -#endif } else if ( ism_mode == ISM_MODE_PARAM ) { @@ -447,11 +438,7 @@ ivas_error ivas_ism_metadata_enc( /* Elevation quantization (quantize azimuth to the ELEVATION_NBITS-bit index */ if ( ism_mode == ISM_MODE_DISC ) { -#ifdef UNIFY_MD_QUANTIZER idx_elevation_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#else - idx_elevation_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); -#endif } else /* ISM_MODE_PARAM */ { @@ -799,73 +786,6 @@ ivas_error create_ism_metadata_enc( #ifdef DISCRETE_ISM_DTX_CNG -#ifndef UNIFY_MD_QUANTIZER -/*-------------------------------------------------------------------* - * ivas_ism_quantize_DOA_dtx() - * - * - *-------------------------------------------------------------------*/ - -static void ivas_ism_quantize_DOA_dtx( - const float azimuth, - const float elevation, - const int16_t azi_bits, - const int16_t ele_bits, - int16_t *azi_idx, - int16_t *ele_idx ) -{ - int16_t nbits, npoints, angle_spacing, az_alpha, ele_alpha; - float azi_val; - - /* Step 1: Determine angle spacing/n_points based on minimum value among elevation/azimuth bits */ - nbits = min( azi_bits, ele_bits ); - - if ( nbits == ISM_ELEVATION_NBITS ) - { - angle_spacing = 5; - } - else - { - angle_spacing = (int16_t) ( ( 180.f / (float) ( 1 << nbits ) ) + 0.5f ); - } - - npoints = (int16_t) ( ( 90 / angle_spacing ) + 0.5f ); - - /* Step 2: Quantize Elevation */ - ele_alpha = 2 * npoints - 1; - *ele_idx = (int16_t) ( ( elevation / angle_spacing ) + 0.5f ) + npoints; - if ( *ele_idx >= ele_alpha ) - { - *ele_idx = ele_alpha - 1; - } - assert( ( 0 <= *ele_idx ) && ( *ele_idx < ele_alpha ) ); - - /* Step 3: Quantize Azimuth */ - az_alpha = 4 * npoints - 1; - - /* Convert azimuth in {-180,180} into {0,360} before quantization */ - if ( azimuth >= 0 ) - { - azi_val = azimuth; - } - else - { - azi_val = azimuth + 360.f; - } - - /* Obtain the index of quantized azimuth values */ - *azi_idx = (int16_t) ( ( ( azi_val / 360.f ) * az_alpha ) + 0.5f ); - if ( *azi_idx == az_alpha ) - { - /*wrap around the azimuth angle*/ - *azi_idx = 0; - } - assert( ( 0 <= *azi_idx ) && ( *azi_idx < az_alpha ) ); - - return; -} -#endif - /*-------------------------------------------------------------------* * ivas_ism_metadata_sid_enc() * @@ -885,12 +805,8 @@ void ivas_ism_metadata_sid_enc( int16_t nb_bits_metadata[] /* o : number of metadata bits */ ) { -#ifdef UNIFY_MD_QUANTIZER int16_t i, ch, nBits, nBits_start, nBits_unused; float q_step, q_step_border; -#else - int16_t i, ch, nBits, nBits_start, nBits_unused, low_res_q; -#endif int16_t idx, idx_azimuth, idx_elevation; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; float valQ; @@ -923,11 +839,7 @@ void ivas_ism_metadata_sid_enc( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ -#ifdef UNIFY_MD_QUANTIZER ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); -#else - low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); -#endif /*----------------------------------------------------------------* * Spatial parameters, loop over TCs - 1 @@ -982,44 +894,22 @@ void ivas_ism_metadata_sid_enc( { hIsmMetaData = hIsmMeta[ch]; -#ifdef UNIFY_MD_QUANTIZER idx_azimuth = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, q_step, q_step_border, 1 << nBits_azimuth ); idx_elevation = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, q_step, q_step_border, 1 << nBits_elevation ); -#else - if ( low_res_q ) - { - ivas_ism_quantize_DOA_dtx( hIsmMetaData->azimuth, hIsmMetaData->elevation, nBits_azimuth, nBits_elevation, &idx_azimuth, &idx_elevation ); - } - else - { - idx_azimuth = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); - idx_elevation = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); - } -#endif push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, nBits_azimuth ); push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, nBits_elevation ); -#ifdef MD_Q_PARAM_BE - if ( ism_mode != ISM_MODE_PARAM ) -#endif + /* update last indexes to correspond to active frames coding */ + if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) { -#ifdef UNIFY_MD_QUANTIZER - /* update last indexes to correspond to active frames coding */ - if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) - { - hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); - hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); - } - else - { - hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); - hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); - } -#else - hIsmMetaData->last_azimuth_idx = idx_azimuth; - hIsmMetaData->last_elevation_idx = idx_elevation; -#endif + hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); + hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); + } + else + { + hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); + hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); } } } diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index be8c8135bd..6a950f7046 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -162,18 +162,10 @@ static void ivas_param_ism_enc_quantize_DOA( for ( i = 0; i < num_obj; i++ ) { /* Quantize the elevation and obtain quantized elevation value and index */ -#ifdef UNIFY_MD_QUANTIZER ele_idx = ism_quant_meta( hIsmMetaData[i]->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#else - ele_idx = ism_quant_meta( hIsmMetaData[i]->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); -#endif /* Obtain the index of quantized azimuth values */ -#ifdef UNIFY_MD_QUANTIZER azi_idx = ism_quant_meta( hIsmMetaData[i]->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); -#else - azi_idx = ism_quant_meta( hIsmMetaData[i]->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); -#endif /*Replace azimuth with quantized values */ hIsmMetaData[i]->azimuth = valQ; -- GitLab From 41d3661c95739a625fc31061011d55c222b0b05a Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 6 Mar 2023 19:04:17 +0100 Subject: [PATCH 147/375] resolve comments --- lib_dec/ivas_sce_dec.c | 2 +- lib_enc/ivas_ism_dtx_enc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index afa7bbac3e..4e9afe9a82 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -84,7 +84,7 @@ ivas_error ivas_sce_dec( if ( st_ivas->ism_mode == ISM_MODE_PARAM ) #endif { - st->cng_type = FD_CNG; /* TODO: move to init if possible */ + st->cng_type = FD_CNG; } #endif diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 064754783d..55c8edd835 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -149,9 +149,9 @@ int16_t ivas_ism_dtx_enc( lp_noise_variation = var( lp_noise, num_obj ); lp_noise_mean = mean( lp_noise, num_obj ); - if ( lp_noise_mean > 50 || ( lp_noise_mean > 10 && lp_noise_variation > 2 ) ) + if ( lp_noise_mean > 50 || ( lp_noise_mean > 25 && lp_noise_variation > 32 ) ) { - // dtx_flag = 0; // VE!!!!! + dtx_flag = 0; } /*------------------------------------------------------------------* -- GitLab From bae9b7abf8aab448b48092ea6805855fb7de47da Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Tue, 7 Mar 2023 08:34:34 +0100 Subject: [PATCH 148/375] issue 362: replace "\s" with "[[:space:]]" in the sed regex for POSIX-compliant version for mac --- scripts/prepare_instrumentation.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index 17179fc57c..c748f19aca 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -106,8 +106,8 @@ find $targetdir -name "*.[ch]" -exec sed -i.bak -e "s/\(0x[0-9a-fA-F]*\)UL/\(\(u "tools/$system/wmc_tool" -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" >> /dev/null # automatically enable #define WMOPS in options.h -sed -i.bak -e "s/\/\*\s*\(#define\s*WMOPS\)\s*\*\//\1/g" $targetdir/lib_com/options.h -sed -i.bak -e "s/\/\/\s*\(#define\s*WMOPS\)/\1/g" $targetdir/lib_com/options.h +sed -i.bak -e "s/\/\*[[:space:]]*\(#define[[:space:]]*WMOPS\)[[:space:]]*\*\//\1/g" $targetdir/lib_com/options.h +sed -i.bak -e "s/\/\/[[:space:]]*\(#define[[:space:]]*WMOPS\)/\1/g" $targetdir/lib_com/options.h # return to start dir cd "$currdir" -- GitLab From 826f05f83310afa425c8d70f548c65f8985c3bcb Mon Sep 17 00:00:00 2001 From: hsd Date: Tue, 7 Mar 2023 10:00:07 +0100 Subject: [PATCH 149/375] [fix] removed duplicated HeadRotationFileReading block, thx2szczerba --- apps/decoder.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index dcd5cf62e8..0612c9b2a5 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1509,24 +1509,6 @@ static ivas_error decodeG192( goto cleanup; } -#ifdef FIX_I109_ORIENTATION_TRACKING - /* Reference rotation */ - if ( arg.enableReferenceRotation ) - { - IVAS_QUATERNION quaternion; - if ( ( error = HeadRotationFileReading( refRotReader, &quaternion ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) ); - goto cleanup; - } - - if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } -#endif #ifdef FIX_I109_ORIENTATION_TRACKING /* Reference rotation */ if ( arg.enableReferenceRotation ) -- GitLab From 9be23381048a10fbc2ba0a68c1a86b343fc6a7f8 Mon Sep 17 00:00:00 2001 From: szczerba Date: Tue, 7 Mar 2023 10:49:22 +0100 Subject: [PATCH 150/375] Cleanup --- apps/decoder.c | 32 +++++++++++++------------- lib_dec/ivas_objectRenderer_internal.c | 8 +------ lib_rend/ivas_objectRenderer.c | 3 +-- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 0612c9b2a5..671d702b84 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1510,22 +1510,22 @@ static ivas_error decodeG192( } #ifdef FIX_I109_ORIENTATION_TRACKING - /* Reference rotation */ - if ( arg.enableReferenceRotation ) - { - IVAS_QUATERNION quaternion; - if ( ( error = HeadRotationFileReading( refRotReader, &quaternion ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) ); - goto cleanup; - } - - if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } + /* Reference rotation */ + if ( arg.enableReferenceRotation ) + { + IVAS_QUATERNION quaternion; + if ( ( error = HeadRotationFileReading( refRotReader, &quaternion ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) ); + goto cleanup; + } + + if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } #endif /* Head-tracking input simulation */ if ( arg.enableHeadRotation ) diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index b9fade9290..921c56e6e6 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -71,11 +71,6 @@ void ivas_td_binaural_renderer( const int16_t output_frame /* i : output frame length */ ) { -#ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_state_t *pOtr = NULL; - if ( st_ivas->hHeadTrackData != NULL ) - pOtr = st_ivas->hHeadTrackData->OrientationTracker; -#endif ivas_td_binaural_renderer_unwrap( st_ivas->hRenderConfig, st_ivas->ini_frame, #ifdef FIX_197_CREND_INTERFACE st_ivas->hCrendWrapper, @@ -92,6 +87,5 @@ void ivas_td_binaural_renderer( st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, output, - output_frame - ); + output_frame ); } diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index b0f5295ded..4276568519 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -642,8 +642,7 @@ ivas_error ivas_td_binaural_renderer_ext( headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, output, - output_frame - ); + output_frame ); pop_wmops(); -- GitLab From e1c2ab7d0ce47a750d96cfa4f1b4e327b7f4b01e Mon Sep 17 00:00:00 2001 From: hsd Date: Tue, 7 Mar 2023 13:59:44 +0100 Subject: [PATCH 151/375] [remove] commented-out self-test configs, since they still got executed --- scripts/config/self_test.prm | 8 -------- 1 file changed, 8 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 5385df27a7..223ac0352c 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -476,14 +476,6 @@ ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Headrot.tst -// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking -//../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit -//../IVAS_dec -t trajectories/full-circle-4s.csv -rvf trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPos.tst - -// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking in level mode -//../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit -//../IVAS_dec -t trajectories/full-circle-with-up-and-down-4s.csv -rvf trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPosLev.tst - // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit ../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural_FEC5.tst -- GitLab From 022bf68ede317a8f484c20d11a188638bc049f3b Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Tue, 7 Mar 2023 16:39:34 +0200 Subject: [PATCH 152/375] Setup build job for nokia windows runner --- .gitlab-ci.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6d00b37f0a..ac6409a847 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -156,6 +156,11 @@ stages: tags: - ivas-linux +.build-job-windows: + stage: build + timeout: "4 minutes" + tags: + - nokia-windows-runner # template for test jobs on linux that need the TESTV_DIR .test-job-linux-needs-testv-dir: @@ -172,6 +177,12 @@ stages: exit_codes: - 123 +.build-job-windows-with-check-for-warnings: + extends: .build-job-windows + stage: build + allow_failure: + exit_codes: + - 123 # --------------------------------------------------------------- @@ -262,6 +273,16 @@ build-codec-sanitizers-linux: - *print-common-info - bash ci/build_codec_sanitizers_linux.sh +build-codec-windows-cmake: + extends: + - .build-job-windows-with-check-for-warnings + - .rules-basis + script: + - *print-common-info + - cmake -G "Visual Studio 15 2017" . -Bbuild + - cmake --build build -j16 | Out-File -FilePath $BUILD_OUTPUT + - ("& python ci/check_for_warnings.py '$BUILD_OUTPUT'", "exit $LASTEXITCODE") | Invoke-Expression + # --------------------------------------------------------------- # Test jobs for merge requests # --------------------------------------------------------------- -- GitLab From 3f6a636da3339d2f73a0b5596be5aae89179e17e Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Tue, 7 Mar 2023 16:43:19 +0200 Subject: [PATCH 153/375] Disable rules-basis for windows build for testing --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ac6409a847..8e75aa72b1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -276,7 +276,7 @@ build-codec-sanitizers-linux: build-codec-windows-cmake: extends: - .build-job-windows-with-check-for-warnings - - .rules-basis + #- .rules-basis script: - *print-common-info - cmake -G "Visual Studio 15 2017" . -Bbuild -- GitLab From 1e32cf7b88f691fa82cfde38e0d3bed496f299d9 Mon Sep 17 00:00:00 2001 From: Andrea Eichenseer Date: Tue, 7 Mar 2023 16:26:16 +0100 Subject: [PATCH 154/375] Merge DISC_CNG into DISCRETE_ISM_DTX_CNG. --- lib_com/ivas_prot.h | 2 +- lib_com/options.h | 1 - lib_dec/ivas_core_dec.c | 2 +- lib_dec/ivas_sce_dec.c | 2 +- lib_dec/ivas_tcx_core_dec.c | 4 ++-- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index abf5400b76..05d8c65021 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -508,7 +508,7 @@ void stereo_tcx_core_dec( #ifdef PARAM_ISM_DTX_CNG , const IVAS_FORMAT ivas_format /* i : IVAS format */ -#ifndef DISC_CNG +#ifndef DISCRETE_ISM_DTX_CNG ,const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM) */ #endif #endif diff --git a/lib_com/options.h b/lib_com/options.h index 5ae1b00642..cf48509f6a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,7 +168,6 @@ #define TUNE_360_OBJECT_WITH_NOISE /* VA: issue 360: consider objects being speech+noise for active speech coding */ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ -#define DISC_CNG diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 258be15b02..cb2244504f 100755 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -347,7 +347,7 @@ ivas_error ivas_core_dec( /* TCX decoder */ #ifdef PARAM_ISM_DTX_CNG stereo_tcx_core_dec( st, frameMode[n], output[n], synth[n], pitch_buf[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format -#ifndef DISC_CNG +#ifndef DISCRETE_ISM_DTX_CNG , st_ivas == NULL ? 0 : st_ivas->ism_mode #endif diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 4e9afe9a82..02601d1ba1 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -78,7 +78,7 @@ ivas_error ivas_sce_dec( last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate; #ifdef PARAM_ISM_DTX_CNG -#ifdef DISC_CNG +#ifdef DISCRETE_ISM_DTX_CNG if ( st_ivas->ivas_format == ISM_FORMAT ) #else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index e91c910781..e2c2229a21 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -164,7 +164,7 @@ void stereo_tcx_core_dec( #ifdef PARAM_ISM_DTX_CNG , const IVAS_FORMAT ivas_format /* i : IVAS format */ -#ifndef DISC_CNG +#ifndef DISCRETE_ISM_DTX_CNG , const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM) */ #endif @@ -733,7 +733,7 @@ void stereo_tcx_core_dec( if ( st->element_mode != IVAS_CPE_TD ) { #ifdef PARAM_ISM_DTX_CNG -#ifndef DISC_CNG +#ifndef DISCRETE_ISM_DTX_CNG if ( ivas_format == ISM_FORMAT && ism_mode == ISM_MODE_PARAM ) #else if ( ivas_format == ISM_FORMAT ) -- GitLab From 94dc06dddc6d977fd76b272d980bbe38261a2241 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Tue, 7 Mar 2023 17:26:48 +0200 Subject: [PATCH 155/375] Add windows version of print-common-info --- .gitlab-ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8e75aa72b1..501bd1a8b4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -49,6 +49,13 @@ stages: echo "Commit time was $CI_COMMIT_TIMESTAMP" date | xargs echo "System time is" +.print-common-info-windows: &print-common-info-windows + - | + echo "Printing common information for build job." + echo "Current job is run on commit $CI_COMMIT_SHA" + echo "Commit time was $CI_COMMIT_TIMESTAMP" + ("echo 'System time is'", "Get-Date -Format 'dddd dd/MM/yyyy HH:mm K'") | Invoke-Expression + .get-previous-merge-commit-sha: &get-previous-merge-commit-sha - previous_merge_commit=$(git --no-pager log --merges HEAD~1 -n 1 --pretty=format:%H) @@ -278,7 +285,7 @@ build-codec-windows-cmake: - .build-job-windows-with-check-for-warnings #- .rules-basis script: - - *print-common-info + - *print-common-info-windows - cmake -G "Visual Studio 15 2017" . -Bbuild - cmake --build build -j16 | Out-File -FilePath $BUILD_OUTPUT - ("& python ci/check_for_warnings.py '$BUILD_OUTPUT'", "exit $LASTEXITCODE") | Invoke-Expression -- GitLab From ee9406e73ddf4782ac9fd2441c7ac73c8ee4f205 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Tue, 7 Mar 2023 17:33:02 +0200 Subject: [PATCH 156/375] Change windows tag, enable rules-basis for win build --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 501bd1a8b4..0a54c09297 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -167,7 +167,7 @@ stages: stage: build timeout: "4 minutes" tags: - - nokia-windows-runner + - ivas-windows # template for test jobs on linux that need the TESTV_DIR .test-job-linux-needs-testv-dir: @@ -283,7 +283,7 @@ build-codec-sanitizers-linux: build-codec-windows-cmake: extends: - .build-job-windows-with-check-for-warnings - #- .rules-basis + - .rules-basis script: - *print-common-info-windows - cmake -G "Visual Studio 15 2017" . -Bbuild -- GitLab From 0d67d76c7e7f9c2cb3ef6744a358f9619671a2c3 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Tue, 7 Mar 2023 18:26:15 +0100 Subject: [PATCH 157/375] re-enable and fix quat2euler --- lib_rend/ivas_orient_trk.c | 52 ++++++++++++++++++++++++++++---------- lib_rend/ivas_prot_rend.h | 2 -- lib_rend/ivas_rotation.c | 24 ++++++++++-------- 3 files changed, 53 insertions(+), 25 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 5ef7ded17d..b0865c9322 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -457,25 +457,40 @@ ivas_error ivas_orient_trk_Process( float alpha = pOTR->alpha; float ang; ivas_error result; - IVAS_QUATERNION quat; + IVAS_QUATERNION refQuat, trkQuat; + IVAS_QUATERNION trkEuler; if ( pOTR == NULL || pTrkRot == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - quat.w = 0.0f; - quat.x = 0.0f; - quat.y = 0.0f; - quat.z = 0.0f; + refQuat.w = 0.0f; + refQuat.x = 0.0f; + refQuat.y = 0.0f; + refQuat.z = 0.0f; /* check for Euler angle signaling */ if ( pOTR->refRot.w == -3.0f ) { - Euler2Quat(pOTR->refRot.x, pOTR->refRot.y, pOTR->refRot.z, &quat); + Euler2Quat(pOTR->refRot.x, pOTR->refRot.y, pOTR->refRot.z, &refQuat); } else { - quat = pOTR->refRot; + refQuat = pOTR->refRot; + } + + trkQuat.w = 0.0f; + trkQuat.x = 0.0f; + trkQuat.y = 0.0f; + trkQuat.z = 0.0f; + /* check for Euler angle signaling */ + if ( pTrkRot->w == -3.0f ) + { + Euler2Quat(pTrkRot->x, pTrkRot->y, pTrkRot->z, &trkQuat); + } + else + { + trkQuat = *pTrkRot; } result = IVAS_ERR_OK; @@ -483,7 +498,7 @@ ivas_error ivas_orient_trk_Process( switch ( pOTR->trackingType ) { case OTR_TRACKING_NONE: - *pTrkRot = *pAbsRot; + trkQuat = *pAbsRot; break; case OTR_TRACKING_REF_ORIENT: @@ -494,8 +509,8 @@ ivas_error ivas_orient_trk_Process( pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate ); /* Compute relative orientation = (absolute orientation) - (reference orientation) */ - QuaternionInverse( quat, pTrkRot ); - QuaternionProduct( *pTrkRot, *pAbsRot, pTrkRot ); + QuaternionInverse( refQuat, &trkQuat ); + QuaternionProduct( trkQuat, *pAbsRot, &trkQuat ); break; case OTR_TRACKING_AVG_ORIENT: @@ -503,8 +518,8 @@ ivas_error ivas_orient_trk_Process( QuaternionSlerp( pOTR->absAvgRot, *pAbsRot, alpha, &pOTR->absAvgRot ); /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */ - QuaternionInverse( pOTR->absAvgRot, pTrkRot ); - QuaternionProduct( *pTrkRot, *pAbsRot, pTrkRot ); + QuaternionInverse( pOTR->absAvgRot, &trkQuat ); + QuaternionProduct( trkQuat, *pAbsRot, &trkQuat ); /* Adapt LPF constant based on orientation excursion relative to current mean: - low cutoff (slow adaptation) for small excursions (around center) @@ -542,7 +557,18 @@ ivas_error ivas_orient_trk_Process( if ( result == IVAS_ERR_OK ) { - pOTR->trkRot = *pTrkRot; + pOTR->trkRot = trkQuat; + + if ( pTrkRot->w == -3.0f ) + { + Quat2Euler(trkQuat, &trkEuler.x, &trkEuler.y, &trkEuler.z); + trkEuler.w = -3.0f; + *pTrkRot = trkEuler; + } + else + { + *pTrkRot = trkQuat; + } } return result; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 000d1c905b..d22977452b 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -796,14 +796,12 @@ void ivas_headTrack_close( ); #endif -#ifndef FIX_I109_ORIENTATION_TRACKING void Quat2Euler( const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ float *yaw, /* o : yaw */ float *pitch, /* o : pitch */ float *roll /* o : roll */ ); -#endif #ifdef FIX_I109_ORIENTATION_TRACKING void Euler2Quat( diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index ddcb059bfc..d98138126b 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -176,7 +176,6 @@ void QuatToRotMat( return; } -#ifndef FIX_I109_ORIENTATION_TRACKING /*------------------------------------------------------------------------- * Quat2Euler() * @@ -204,14 +203,19 @@ void Quat2Euler( * pitch: rotate scene in the median plane, increase elevation with positive values * roll: rotate scene from the right ear to the top */ - *yaw = quat.z; +#ifdef FIX_I109_ORIENTATION_TRACKING + *yaw = quat.x; + *pitch = quat.y; + *roll = quat.z; +#else + *yaw = quat.z; *pitch = quat.y; - *roll = quat.x; + *roll = quat.x; +#endif } return; } -#endif #ifdef FIX_I109_ORIENTATION_TRACKING /*------------------------------------------------------------------------- @@ -227,12 +231,12 @@ void Euler2Quat( IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ ) { - float cr = cos( roll * 0.5f ); - float sr = sin( roll * 0.5f ); - float cp = cos( pitch * 0.5f ); - float sp = sin( pitch * 0.5f ); - float cy = cos( yaw * 0.5f ); - float sy = sin( yaw * 0.5f ); + float cr = cosf( roll * 0.5f ); + float sr = sinf( roll * 0.5f ); + float cp = cosf( pitch * 0.5f ); + float sp = sinf( pitch * 0.5f ); + float cy = cosf( yaw * 0.5f ); + float sy = sinf( yaw * 0.5f ); quat->w = cr * cp * cy + sr * sp * sy; quat->x = sr * cp * cy - cr * sp * sy; -- GitLab From 0ea486611c209693e0050f56c9dd5fe084760938 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Tue, 7 Mar 2023 22:39:09 +0100 Subject: [PATCH 158/375] Euler processing correct in degrees - all internal processign in ivas_orient_trk_Process() now done in Quat - output in Eulers in quasi-quaternion format when necessary - Euler angles assumed in degrees, conversion to and from radians added --- lib_rend/ivas_orient_trk.c | 40 ++++++++++++++++++++-------- lib_rend/ivas_prot_rend.h | 4 +++ lib_rend/ivas_rotation.c | 53 ++++++++++++++++++++++++++++---------- 3 files changed, 72 insertions(+), 25 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index b0865c9322..2b8d332d93 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -457,7 +457,7 @@ ivas_error ivas_orient_trk_Process( float alpha = pOTR->alpha; float ang; ivas_error result; - IVAS_QUATERNION refQuat, trkQuat; + IVAS_QUATERNION refQuat, absQuat, trkQuat; IVAS_QUATERNION trkEuler; if ( pOTR == NULL || pTrkRot == NULL ) @@ -472,13 +472,27 @@ ivas_error ivas_orient_trk_Process( /* check for Euler angle signaling */ if ( pOTR->refRot.w == -3.0f ) { - Euler2Quat(pOTR->refRot.x, pOTR->refRot.y, pOTR->refRot.z, &refQuat); + Euler2Quat(deg2rad( pOTR->refRot.x ), deg2rad( pOTR->refRot.y ), deg2rad( pOTR->refRot.z ), &refQuat); } else { refQuat = pOTR->refRot; } + absQuat.w = 0.0f; + absQuat.x = 0.0f; + absQuat.y = 0.0f; + absQuat.z = 0.0f; + /* check for Euler angle signaling */ + if ( pAbsRot->w == -3.0f ) + { + Euler2Quat(deg2rad( pAbsRot->x ), deg2rad( pAbsRot->y ), deg2rad( pAbsRot->z ), &absQuat); + } + else + { + absQuat = *pAbsRot; + } + trkQuat.w = 0.0f; trkQuat.x = 0.0f; trkQuat.y = 0.0f; @@ -486,7 +500,7 @@ ivas_error ivas_orient_trk_Process( /* check for Euler angle signaling */ if ( pTrkRot->w == -3.0f ) { - Euler2Quat(pTrkRot->x, pTrkRot->y, pTrkRot->z, &trkQuat); + Euler2Quat(deg2rad( pTrkRot->x ), deg2rad( pTrkRot->y ), deg2rad( pTrkRot->z ), &trkQuat); } else { @@ -498,34 +512,34 @@ ivas_error ivas_orient_trk_Process( switch ( pOTR->trackingType ) { case OTR_TRACKING_NONE: - trkQuat = *pAbsRot; + trkQuat = absQuat; break; case OTR_TRACKING_REF_ORIENT: /* Reset average orientation */ - pOTR->absAvgRot = *pAbsRot; + pOTR->absAvgRot = absQuat; /* Reset adaptation filter - start adaptation at center rate */ pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate ); /* Compute relative orientation = (absolute orientation) - (reference orientation) */ QuaternionInverse( refQuat, &trkQuat ); - QuaternionProduct( trkQuat, *pAbsRot, &trkQuat ); + QuaternionProduct( trkQuat, absQuat, &trkQuat ); break; case OTR_TRACKING_AVG_ORIENT: /* Compute average (low-pass filtered) absolute orientation */ - QuaternionSlerp( pOTR->absAvgRot, *pAbsRot, alpha, &pOTR->absAvgRot ); + QuaternionSlerp( pOTR->absAvgRot, absQuat, alpha, &pOTR->absAvgRot ); /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */ QuaternionInverse( pOTR->absAvgRot, &trkQuat ); - QuaternionProduct( trkQuat, *pAbsRot, &trkQuat ); + QuaternionProduct( trkQuat, absQuat, &trkQuat ); /* Adapt LPF constant based on orientation excursion relative to current mean: - low cutoff (slow adaptation) for small excursions (around center) - high cutoff (fast adaptation) for large excursions (off-center) */ - ang = QuaternionAngle( *pAbsRot, *pTrkRot ); + ang = QuaternionAngle( absQuat, *pTrkRot ); normalizedOrientation = ang * ang; relativeOrientationRate = sqrtf( normalizedOrientation ) / pOTR->adaptationAngle; @@ -558,10 +572,14 @@ ivas_error ivas_orient_trk_Process( if ( result == IVAS_ERR_OK ) { pOTR->trkRot = trkQuat; + pOTR->refRot = refQuat; - if ( pTrkRot->w == -3.0f ) + if ( ( pTrkRot->w == -3.0f) || ( pAbsRot->w == -3.0f ) ) { - Quat2Euler(trkQuat, &trkEuler.x, &trkEuler.y, &trkEuler.z); + Quat2Euler( trkQuat, &trkEuler.z, &trkEuler.y, &trkEuler.x ); + trkEuler.x = rad2deg( trkEuler.x ); + trkEuler.y = rad2deg( trkEuler.y ); + trkEuler.z = rad2deg( trkEuler.z ); trkEuler.w = -3.0f; *pTrkRot = trkEuler; } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index d22977452b..73c3025b0c 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -810,6 +810,10 @@ void Euler2Quat( const float roll, /* i : roll */ IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ ); + +float deg2rad( float degrees ); + +float rad2deg( float radians ); #endif void QuatToRotMat( diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index d98138126b..d6f1f5fe09 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -127,7 +127,11 @@ void QuatToRotMat( * Euler angles instead of quaternions. In this case, all the w values must * be set to -3.0 in the trajectory file to signal switching to Euler angles. * The x,y, and z components of the quaternion are then interpreted as +#ifdef FIX_I109_ORIENTATION_TRACKING * yaw-pitch-roll. +#else // see below: "Euler angles in R_X(roll)*R_Y(pitch)*R_Z(yaw) convention" + * roll-pitch-yaw. +#endif */ if ( quat.w != -3.0 ) { @@ -179,21 +183,27 @@ void QuatToRotMat( /*------------------------------------------------------------------------- * Quat2Euler() * - * Quaternion handling: calculate corresponding Euler angles + * Quaternion handling: calculate corresponding Euler angles in radians *------------------------------------------------------------------------*/ void Quat2Euler( const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ - float *yaw, /* o : yaw */ - float *pitch, /* o : pitch */ - float *roll /* o : roll */ + float *yaw, /* o : yaw (z) */ + float *pitch, /* o : pitch (y) */ + float *roll /* o : roll (x) */ ) { if ( quat.w != -3.0 ) { +#ifdef FIX_I109_ORIENTATION_TRACKING + *roll = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); + *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) ); + *yaw = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) ); +#else // bug: x and z swapped *yaw = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) ); *roll = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) ); +#endif } else { @@ -203,15 +213,9 @@ void Quat2Euler( * pitch: rotate scene in the median plane, increase elevation with positive values * roll: rotate scene from the right ear to the top */ -#ifdef FIX_I109_ORIENTATION_TRACKING - *yaw = quat.x; - *pitch = quat.y; - *roll = quat.z; -#else *yaw = quat.z; *pitch = quat.y; *roll = quat.x; -#endif } return; @@ -221,13 +225,13 @@ void Quat2Euler( /*------------------------------------------------------------------------- * Euler2Quat() * - * Calculate corresponding Quaternion from Euler angles + * Calculate corresponding Quaternion from Euler angles in radians *------------------------------------------------------------------------*/ void Euler2Quat( - const float yaw, /* i : yaw */ - const float pitch, /* i : pitch */ - const float roll, /* i : roll */ + const float roll, /* i : roll (x) */ + const float pitch, /* i : pitch (y) */ + const float yaw, /* i : yaw (z) */ IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ ) { @@ -245,6 +249,27 @@ void Euler2Quat( return; } + +/*------------------------------------------------------------------------- + * rad2deg() + * + * Return angle in radians from degrees + *------------------------------------------------------------------------*/ +float deg2rad( float degrees ) +{ + return PI2 * degrees / 360.0f; +} + +/*------------------------------------------------------------------------- + * deg2rad() + * + * Return angle in degrees from radians + *------------------------------------------------------------------------*/ +float rad2deg( float radians ) +{ + return 360.0f * radians / PI2; +} + #endif -- GitLab From d4ed5521972c0a902a30a293bd36d7c22c883a8c Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Wed, 8 Mar 2023 08:52:25 +0530 Subject: [PATCH 159/375] Resolving clang format error --- lib_dec/ivas_sba_dec.c | 8 ++++---- lib_enc/ivas_spar_encoder.c | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index fbb69d487a..5e603cfe9d 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -75,7 +75,7 @@ ivas_error ivas_sba_dec_reconfigure( sba_mode_old = ivas_sba_mode_select( last_ivas_total_brate ); st_ivas->sba_mode = sba_mode_old; - + /*-----------------------------------------------------------------* * Set SBA high-level parameters * Save old SBA high-level parameters @@ -135,7 +135,7 @@ ivas_error ivas_sba_dec_reconfigure( SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); - + #ifndef SBA_BR_SWITCHING_CLEAN_UP nchan_internal = ivas_sba_get_nchan_metadata( sba_order_internal ); if ( hSpar != NULL && nchan_transport_old != ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) ) @@ -378,11 +378,11 @@ ivas_error ivas_sba_dec_reconfigure( ivas_dirac_dec_close( st_ivas->hDirAC ); st_ivas->hDirAC = NULL; } - + st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); - ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, ( int16_t )( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); } #else diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 79cb801361..786bd29a96 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -217,17 +217,16 @@ ivas_error ivas_spar_enc_open( #ifdef PARAM_ISM_DTX_CNG if ( ( error = init_encoder( hSpar->hCoreCoderVAD, 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) #else - if ( ( error = init_encoder( hSpar->hCoreCoderVAD, 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1 ) ) != IVAS_ERR_OK ) + if ( ( error = init_encoder( hSpar->hCoreCoderVAD, 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1 ) ) != IVAS_ERR_OK ) #endif { return error; } - } else { - hSpar->hCoreCoderVAD = NULL; - hSpar->hFrontVad = NULL; + hSpar->hCoreCoderVAD = NULL; + hSpar->hFrontVad = NULL; } #ifdef SBA_BR_SWITCHING_CLEAN_UP } -- GitLab From 9271b6d97bdd2d07cb78d3b69e9de9e35a827fca Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Wed, 8 Mar 2023 09:00:58 +0530 Subject: [PATCH 160/375] Resolving pipeline warning :set 3 --- lib_dec/ivas_sba_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 5e603cfe9d..b8c9782ffb 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -347,7 +347,7 @@ ivas_error ivas_sba_dec_reconfigure( ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); } #ifdef SBA_BR_SWITCHING_CLEAN_UP - if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( sba_mode_old != st_ivas->sba_mode ) || ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) && ( ( ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) ) ) + if ( ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( sba_mode_old != st_ivas->sba_mode ) || ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) ) && ( ( ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) ) ) { DIRAC_CONFIG_FLAG flag_config; flag_config = DIRAC_OPEN; -- GitLab From b540aca6e75d6c458fc213d741f6bc25e5803936 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Wed, 8 Mar 2023 09:35:05 +0530 Subject: [PATCH 161/375] Resolve pipeline error : set 4 --- lib_dec/ivas_sba_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index b8c9782ffb..c89f7aca17 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -347,7 +347,7 @@ ivas_error ivas_sba_dec_reconfigure( ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); } #ifdef SBA_BR_SWITCHING_CLEAN_UP - if ( ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( sba_mode_old != st_ivas->sba_mode ) || ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) ) && ( ( ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) ) ) + if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( sba_mode_old != st_ivas->sba_mode ) || ( ( st_ivas->sba_mode == SBA_MODE_SPAR ) && ( ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) ) ) { DIRAC_CONFIG_FLAG flag_config; flag_config = DIRAC_OPEN; -- GitLab From 268ccc5cc5694a6dc1fdd5066d777d56bdc9aa65 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Wed, 8 Mar 2023 09:43:05 +0530 Subject: [PATCH 162/375] Added clang formatting for the changes added --- lib_dec/ivas_sba_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index c89f7aca17..ea5e2656eb 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -347,7 +347,7 @@ ivas_error ivas_sba_dec_reconfigure( ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); } #ifdef SBA_BR_SWITCHING_CLEAN_UP - if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( sba_mode_old != st_ivas->sba_mode ) || ( ( st_ivas->sba_mode == SBA_MODE_SPAR ) && ( ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) ) ) + if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( sba_mode_old != st_ivas->sba_mode ) || ( ( st_ivas->sba_mode == SBA_MODE_SPAR ) && ( ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) ) ) { DIRAC_CONFIG_FLAG flag_config; flag_config = DIRAC_OPEN; -- GitLab From 1771b40dc6d5b981813b568d05a8d41f8d54976e Mon Sep 17 00:00:00 2001 From: hsd Date: Wed, 8 Mar 2023 07:49:22 +0100 Subject: [PATCH 163/375] [fix] adapt OTR_TRACKING_REF_VEC* mode to use ne w refQuat, absQuat, trkQuat variables (otherwise the results get overwritten in the result == IVAS_ERR_OK block) --- lib_rend/ivas_orient_trk.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index ebf5ed4a4c..a7e47f422a 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -657,9 +657,6 @@ ivas_error ivas_orient_trk_Process( ivas_error result; IVAS_QUATERNION refQuat, absQuat, trkQuat; IVAS_QUATERNION trkEuler; -#ifdef OTR_REFERENCE_VECTOR_TRACKING - IVAS_QUATERNION refRot_absRot_product; -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ if ( pOTR == NULL || pTrkRot == NULL ) { @@ -769,12 +766,7 @@ ivas_error ivas_orient_trk_Process( case OTR_TRACKING_REF_VEC_LEV: { /* This processing step of the OTR_TRACKING_REF_VEC/OTR_TRACKING_REF_VEC_LEVEL is identical */ - QuaternionProduct( pOTR->refRot, *pAbsRot, &refRot_absRot_product ); - - pTrkRot->w = refRot_absRot_product.w; - pTrkRot->x = refRot_absRot_product.x; - pTrkRot->y = refRot_absRot_product.y; - pTrkRot->z = refRot_absRot_product.z; + QuaternionProduct( refQuat, absQuat, &trkQuat ); break; } #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -- GitLab From e7d9b5795327b38bffc5a63857202a569acd8eda Mon Sep 17 00:00:00 2001 From: szczerba Date: Wed, 8 Mar 2023 09:53:36 +0100 Subject: [PATCH 164/375] Avoiding clang complaints --- lib_rend/lib_rend.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index b74cd297e1..a2820214b3 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4539,12 +4539,12 @@ static ivas_error renderIsmToBinauralRoom( &trackedHeadOrientation ); QuatToRotMat( trackedHeadOrientation, Rmat ); #else - quat.w = headRotData->headPositions[subframe_idx].w; - quat.x = headRotData->headPositions[subframe_idx].x; - quat.y = headRotData->headPositions[subframe_idx].y; - quat.z = headRotData->headPositions[subframe_idx].z; + quat.w = headRotData->headPositions[subframe_idx].w; + quat.x = headRotData->headPositions[subframe_idx].x; + quat.y = headRotData->headPositions[subframe_idx].y; + quat.z = headRotData->headPositions[subframe_idx].z; - QuatToRotMat( quat, Rmat ); + QuatToRotMat( quat, Rmat ); #endif } (void) subframe_len; // avoid warning -- GitLab From 099e1d3e3bce2c5940e32dd596716b72ba730eda Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Wed, 8 Mar 2023 11:10:29 +0200 Subject: [PATCH 165/375] Add msbuild job --- .gitlab-ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0a54c09297..2fc79fcc20 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -290,6 +290,15 @@ build-codec-windows-cmake: - cmake --build build -j16 | Out-File -FilePath $BUILD_OUTPUT - ("& python ci/check_for_warnings.py '$BUILD_OUTPUT'", "exit $LASTEXITCODE") | Invoke-Expression +build-codec-windows-msbuild: + extends: + - .build-job-windows-with-check-for-warnings + - .rules-basis + script: + - *print-common-info-windows + - MSBuild.exe .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Debug | tee $BUILD_OUTPUT + - ("& python ci/check_for_warnings.py '$BUILD_OUTPUT'", "exit $LASTEXITCODE") | Invoke-Expression + # --------------------------------------------------------------- # Test jobs for merge requests # --------------------------------------------------------------- -- GitLab From 3ee1c2154730f065be0e550c668afaee6c911d62 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 8 Mar 2023 11:23:29 +0100 Subject: [PATCH 166/375] harmonize euler2quat declaration and function --- lib_rend/ivas_prot_rend.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 561af30aff..49dadd271d 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -806,18 +806,18 @@ void ivas_headTrack_close( #endif void Quat2Euler( - const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ - float *yaw, /* o : yaw */ - float *pitch, /* o : pitch */ - float *roll /* o : roll */ + const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ + float *yaw, /* o : yaw (z) */ + float *pitch, /* o : pitch (y) */ + float *roll /* o : roll (x) */ ); #ifdef FIX_I109_ORIENTATION_TRACKING void Euler2Quat( - const float yaw, /* i : yaw */ - const float pitch, /* i : pitch */ - const float roll, /* i : roll */ - IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ + const float roll, /* i : roll (x) */ + const float pitch, /* i : pitch (y) */ + const float yaw, /* i : yaw (z) */ + IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ ); float deg2rad( float degrees ); -- GitLab From 1f352872529d8323aa75d2039eb258bd296b5d19 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 8 Mar 2023 11:56:32 +0100 Subject: [PATCH 167/375] simplify decision logic --- lib_rend/ivas_orient_trk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index a7e47f422a..a6d0dd61a5 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -780,7 +780,7 @@ ivas_error ivas_orient_trk_Process( pOTR->trkRot = trkQuat; pOTR->refRot = refQuat; - if ( ( pTrkRot->w == -3.0f) || ( pAbsRot->w == -3.0f ) ) + if ( pAbsRot->w == -3.0f ) { Quat2Euler( trkQuat, &trkEuler.z, &trkEuler.y, &trkEuler.x ); trkEuler.x = rad2deg( trkEuler.x ); -- GitLab From 7830d38b3f8934de43bd8ee251dc3e10cba7e673 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 8 Mar 2023 12:07:48 +0100 Subject: [PATCH 168/375] convert reference rotation in ivas_orient_trk_init --- lib_rend/ivas_orient_trk.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index a6d0dd61a5..5a72d317ff 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -509,7 +509,17 @@ ivas_error ivas_orient_trk_SetReferenceRotation( { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - pOTR->refRot = refRot; + + /* check for Euler angle signaling */ + if ( refRot.w == -3.0f ) + { + Euler2Quat(deg2rad( refRot.x ), deg2rad( refRot.y ), deg2rad( refRot.z ), &pOTR->refRot ); + } + else + { + pOTR->refRot = refRot; + } + return IVAS_ERR_OK; } @@ -655,7 +665,7 @@ ivas_error ivas_orient_trk_Process( float alpha = pOTR->alpha; float ang; ivas_error result; - IVAS_QUATERNION refQuat, absQuat, trkQuat; + IVAS_QUATERNION absQuat, trkQuat; IVAS_QUATERNION trkEuler; if ( pOTR == NULL || pTrkRot == NULL ) @@ -663,20 +673,6 @@ ivas_error ivas_orient_trk_Process( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - refQuat.w = 0.0f; - refQuat.x = 0.0f; - refQuat.y = 0.0f; - refQuat.z = 0.0f; - /* check for Euler angle signaling */ - if ( pOTR->refRot.w == -3.0f ) - { - Euler2Quat(deg2rad( pOTR->refRot.x ), deg2rad( pOTR->refRot.y ), deg2rad( pOTR->refRot.z ), &refQuat); - } - else - { - refQuat = pOTR->refRot; - } - absQuat.w = 0.0f; absQuat.x = 0.0f; absQuat.y = 0.0f; @@ -721,7 +717,7 @@ ivas_error ivas_orient_trk_Process( pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate ); /* Compute relative orientation = (absolute orientation) - (reference orientation) */ - QuaternionInverse( refQuat, &trkQuat ); + QuaternionInverse( pOTR->refRot, &trkQuat ); QuaternionProduct( trkQuat, absQuat, &trkQuat ); break; @@ -737,7 +733,7 @@ ivas_error ivas_orient_trk_Process( - low cutoff (slow adaptation) for small excursions (around center) - high cutoff (fast adaptation) for large excursions (off-center) */ - ang = QuaternionAngle( absQuat, *pTrkRot ); + ang = QuaternionAngle( absQuat, trkQuat ); normalizedOrientation = ang * ang; relativeOrientationRate = sqrtf( normalizedOrientation ) / pOTR->adaptationAngle; @@ -766,7 +762,7 @@ ivas_error ivas_orient_trk_Process( case OTR_TRACKING_REF_VEC_LEV: { /* This processing step of the OTR_TRACKING_REF_VEC/OTR_TRACKING_REF_VEC_LEVEL is identical */ - QuaternionProduct( refQuat, absQuat, &trkQuat ); + QuaternionProduct( pOTR->refRot, absQuat, &trkQuat ); break; } #endif /* OTR_REFERENCE_VECTOR_TRACKING */ @@ -778,7 +774,6 @@ ivas_error ivas_orient_trk_Process( if ( result == IVAS_ERR_OK ) { pOTR->trkRot = trkQuat; - pOTR->refRot = refQuat; if ( pAbsRot->w == -3.0f ) { -- GitLab From 6fee008f4a9f540e108e6ee509a896e96de38da6 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 8 Mar 2023 12:07:48 +0100 Subject: [PATCH 169/375] convert reference rotation in ivas_orient_trk_SetReferenceRotation --- lib_rend/ivas_orient_trk.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index a6d0dd61a5..5a72d317ff 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -509,7 +509,17 @@ ivas_error ivas_orient_trk_SetReferenceRotation( { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - pOTR->refRot = refRot; + + /* check for Euler angle signaling */ + if ( refRot.w == -3.0f ) + { + Euler2Quat(deg2rad( refRot.x ), deg2rad( refRot.y ), deg2rad( refRot.z ), &pOTR->refRot ); + } + else + { + pOTR->refRot = refRot; + } + return IVAS_ERR_OK; } @@ -655,7 +665,7 @@ ivas_error ivas_orient_trk_Process( float alpha = pOTR->alpha; float ang; ivas_error result; - IVAS_QUATERNION refQuat, absQuat, trkQuat; + IVAS_QUATERNION absQuat, trkQuat; IVAS_QUATERNION trkEuler; if ( pOTR == NULL || pTrkRot == NULL ) @@ -663,20 +673,6 @@ ivas_error ivas_orient_trk_Process( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - refQuat.w = 0.0f; - refQuat.x = 0.0f; - refQuat.y = 0.0f; - refQuat.z = 0.0f; - /* check for Euler angle signaling */ - if ( pOTR->refRot.w == -3.0f ) - { - Euler2Quat(deg2rad( pOTR->refRot.x ), deg2rad( pOTR->refRot.y ), deg2rad( pOTR->refRot.z ), &refQuat); - } - else - { - refQuat = pOTR->refRot; - } - absQuat.w = 0.0f; absQuat.x = 0.0f; absQuat.y = 0.0f; @@ -721,7 +717,7 @@ ivas_error ivas_orient_trk_Process( pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate ); /* Compute relative orientation = (absolute orientation) - (reference orientation) */ - QuaternionInverse( refQuat, &trkQuat ); + QuaternionInverse( pOTR->refRot, &trkQuat ); QuaternionProduct( trkQuat, absQuat, &trkQuat ); break; @@ -737,7 +733,7 @@ ivas_error ivas_orient_trk_Process( - low cutoff (slow adaptation) for small excursions (around center) - high cutoff (fast adaptation) for large excursions (off-center) */ - ang = QuaternionAngle( absQuat, *pTrkRot ); + ang = QuaternionAngle( absQuat, trkQuat ); normalizedOrientation = ang * ang; relativeOrientationRate = sqrtf( normalizedOrientation ) / pOTR->adaptationAngle; @@ -766,7 +762,7 @@ ivas_error ivas_orient_trk_Process( case OTR_TRACKING_REF_VEC_LEV: { /* This processing step of the OTR_TRACKING_REF_VEC/OTR_TRACKING_REF_VEC_LEVEL is identical */ - QuaternionProduct( refQuat, absQuat, &trkQuat ); + QuaternionProduct( pOTR->refRot, absQuat, &trkQuat ); break; } #endif /* OTR_REFERENCE_VECTOR_TRACKING */ @@ -778,7 +774,6 @@ ivas_error ivas_orient_trk_Process( if ( result == IVAS_ERR_OK ) { pOTR->trkRot = trkQuat; - pOTR->refRot = refQuat; if ( pAbsRot->w == -3.0f ) { -- GitLab From 1c005b6909c234870c7a3e4a4c66665d8bc6b91c Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 8 Mar 2023 12:51:57 +0100 Subject: [PATCH 170/375] see if CI will let us get away without quat inits --- lib_rend/ivas_orient_trk.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 5a72d317ff..5eaff413d9 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -673,10 +673,6 @@ ivas_error ivas_orient_trk_Process( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - absQuat.w = 0.0f; - absQuat.x = 0.0f; - absQuat.y = 0.0f; - absQuat.z = 0.0f; /* check for Euler angle signaling */ if ( pAbsRot->w == -3.0f ) { @@ -687,10 +683,6 @@ ivas_error ivas_orient_trk_Process( absQuat = *pAbsRot; } - trkQuat.w = 0.0f; - trkQuat.x = 0.0f; - trkQuat.y = 0.0f; - trkQuat.z = 0.0f; /* check for Euler angle signaling */ if ( pTrkRot->w == -3.0f ) { -- GitLab From 2c6fdebfc4fa870a08e30305845fdacb2aacd73a Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 8 Mar 2023 14:13:06 +0100 Subject: [PATCH 171/375] remove unnecessary conversion of pTrkRot --- lib_rend/ivas_orient_trk.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 5eaff413d9..d63decba09 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -683,16 +683,6 @@ ivas_error ivas_orient_trk_Process( absQuat = *pAbsRot; } - /* check for Euler angle signaling */ - if ( pTrkRot->w == -3.0f ) - { - Euler2Quat(deg2rad( pTrkRot->x ), deg2rad( pTrkRot->y ), deg2rad( pTrkRot->z ), &trkQuat); - } - else - { - trkQuat = *pTrkRot; - } - result = IVAS_ERR_OK; switch ( pOTR->trackingType ) -- GitLab From 6d9fcc64ec3e1960c01021a582560740336b2642 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 8 Mar 2023 14:23:54 +0100 Subject: [PATCH 172/375] using constants in deg2rad / rad2deg --- lib_rend/ivas_rotation.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index d6f1f5fe09..409626de0b 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -30,6 +30,7 @@ *******************************************************************************************************/ +#include "ivas_cnst.h" #include #include #include "options.h" @@ -257,7 +258,7 @@ void Euler2Quat( *------------------------------------------------------------------------*/ float deg2rad( float degrees ) { - return PI2 * degrees / 360.0f; + return PI_OVER_180 * degrees; } /*------------------------------------------------------------------------- @@ -267,7 +268,7 @@ float deg2rad( float degrees ) *------------------------------------------------------------------------*/ float rad2deg( float radians ) { - return 360.0f * radians / PI2; + return _180_OVER_PI * radians; } #endif -- GitLab From 89d2564b8637ec5dd92dd3802b57bc38f7015d7a Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 8 Mar 2023 14:49:37 +0100 Subject: [PATCH 173/375] CLANG appeasal --- lib_rend/ivas_orient_trk.c | 6 +++--- lib_rend/ivas_rotation.c | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index d63decba09..cf5a4b3028 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -513,13 +513,13 @@ ivas_error ivas_orient_trk_SetReferenceRotation( /* check for Euler angle signaling */ if ( refRot.w == -3.0f ) { - Euler2Quat(deg2rad( refRot.x ), deg2rad( refRot.y ), deg2rad( refRot.z ), &pOTR->refRot ); + Euler2Quat( deg2rad( refRot.x ), deg2rad( refRot.y ), deg2rad( refRot.z ), &pOTR->refRot ); } else { pOTR->refRot = refRot; } - + return IVAS_ERR_OK; } @@ -676,7 +676,7 @@ ivas_error ivas_orient_trk_Process( /* check for Euler angle signaling */ if ( pAbsRot->w == -3.0f ) { - Euler2Quat(deg2rad( pAbsRot->x ), deg2rad( pAbsRot->y ), deg2rad( pAbsRot->z ), &absQuat); + Euler2Quat( deg2rad( pAbsRot->x ), deg2rad( pAbsRot->y ), deg2rad( pAbsRot->z ), &absQuat ); } else { diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 409626de0b..7735fa3f59 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -214,9 +214,9 @@ void Quat2Euler( * pitch: rotate scene in the median plane, increase elevation with positive values * roll: rotate scene from the right ear to the top */ - *yaw = quat.z; + *yaw = quat.z; *pitch = quat.y; - *roll = quat.x; + *roll = quat.x; } return; @@ -230,10 +230,10 @@ void Quat2Euler( *------------------------------------------------------------------------*/ void Euler2Quat( - const float roll, /* i : roll (x) */ - const float pitch, /* i : pitch (y) */ - const float yaw, /* i : yaw (z) */ - IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ + const float roll, /* i : roll (x) */ + const float pitch, /* i : pitch (y) */ + const float yaw, /* i : yaw (z) */ + IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ ) { float cr = cosf( roll * 0.5f ); -- GitLab From 79ec90400233721adfc202e858e4820685681d97 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 8 Mar 2023 14:54:28 +0100 Subject: [PATCH 174/375] fix crash at highest DTX bitrates --- lib_enc/ivas_ism_enc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 3c6f4c1e5b..ae55f4879c 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -417,6 +417,7 @@ ivas_error ivas_ism_enc( { st_ivas->hSCE[sce_id]->hCoreCoder[0]->last_core = st_ivas->hSCE[st_ivas->hISMDTX->sce_id_dtx]->hCoreCoder[0]->last_core; st_ivas->hSCE[sce_id]->hCoreCoder[0]->last_core_brate = st_ivas->hSCE[st_ivas->hISMDTX->sce_id_dtx]->hCoreCoder[0]->core_brate; + st_ivas->hSCE[sce_id]->hCoreCoder[0]->last_L_frame = st_ivas->hSCE[st_ivas->hISMDTX->sce_id_dtx]->hCoreCoder[0]->last_L_frame; } } } -- GitLab From 7c7349d15a1ab40b4f830248190e03b2d852650f Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 8 Mar 2023 15:14:56 +0100 Subject: [PATCH 175/375] revert Quat2Euler x-z swap --- lib_rend/ivas_rotation.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 7735fa3f59..3c8f7ece46 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -196,15 +196,9 @@ void Quat2Euler( { if ( quat.w != -3.0 ) { -#ifdef FIX_I109_ORIENTATION_TRACKING *roll = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) ); *yaw = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) ); -#else // bug: x and z swapped - *yaw = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); - *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) ); - *roll = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) ); -#endif } else { -- GitLab From a8f5f41389dcb7c7510fb20aa9ea3cc3a8bd8ee4 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 8 Mar 2023 15:17:26 +0100 Subject: [PATCH 176/375] - support of bitrate switching in OMASA format; under OMASA_BRATE_SW --- lib_com/ivas_ism_config.c | 28 ++ lib_com/ivas_omasa_com.c | 41 +++ lib_com/ivas_prot.h | 38 ++- lib_com/options.h | 2 + lib_dec/ivas_corecoder_dec_reconfig.c | 2 + lib_dec/ivas_cpe_dec.c | 4 +- lib_dec/ivas_init_dec.c | 39 ++- lib_dec/ivas_ism_metadata_dec.c | 23 +- lib_dec/ivas_ism_renderer.c | 12 +- lib_dec/ivas_masa_dec.c | 45 +-- lib_dec/ivas_omasa_dec.c | 285 ++++++++++++++++++- lib_dec/ivas_stereo_switching_dec.c | 4 + lib_enc/ivas_corecoder_enc_reconfig.c | 16 +- lib_enc/ivas_cpe_enc.c | 6 +- lib_enc/ivas_enc.c | 11 + lib_enc/ivas_ism_metadata_enc.c | 8 +- lib_enc/ivas_masa_enc.c | 6 + lib_enc/ivas_omasa_enc.c | 121 +++++++- lib_rend/ivas_dirac_dec_binaural_functions.c | 4 +- 19 files changed, 628 insertions(+), 67 deletions(-) diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 06ccd94a31..c329344804 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -586,3 +586,31 @@ ISM_MODE ivas_ism_mode_select( return ism_mode; } + + +#ifdef OMASA_BRATE_SW +/*------------------------------------------------------------------------- + * ivas_ism_metadata_close() + * + * Deallocate ISM metadata handles + *-------------------------------------------------------------------------*/ + +void ivas_ism_metadata_close( + ISM_METADATA_HANDLE *hIsmMetaData, /* i/o: ISM metadata handles */ + const int16_t first_idx /* i : index of first handle to deallocate */ +) +{ + int16_t n; + + for ( n = first_idx; n < MAX_NUM_OBJECTS; n++ ) + { + if ( hIsmMetaData[n] != NULL ) + { + free( hIsmMetaData[n] ); + hIsmMetaData[n] = NULL; + } + } + + return; +} +#endif diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index a14b4c908c..71a452dadd 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -169,6 +169,47 @@ ISM_MODE ivas_omasa_ism_mode_select( } +#ifdef OMASA_BRATE_SW +/*--------------------------------------------------------------- + * ivas_set_omasa_TC() + * + * set number of transport channels in OMASA format + * ---------------------------------------------------------------*/ + +void ivas_set_omasa_TC( + const ISM_MODE ism_mode, /* i : ISM mode */ + const int16_t nchan_ism, /* i : number of input ISMs */ + int16_t *nSCE, /* o : number of SCEs */ + int16_t *nCPE /* o : number of CPEs */ +) +{ + switch ( ism_mode ) + { + case ISM_MASA_MODE_PARAM: + *nCPE = 1; + *nSCE = 0; + break; + case ISM_MASA_MODE_ONE_OBJ: + *nCPE = 1; + *nSCE = 1; + break; + case ISM_MASA_MODE_DISC: + *nCPE = 1; + *nSCE = nchan_ism; + break; + case ISM_MODE_NONE: + *nCPE = 1; + *nSCE = 0; + break; + default: + break; + } + + return; +} +#endif + + #ifdef OMASA_BRATE /*--------------------------------------------------------------- * ivas_interformat_brate() diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b20eb35e3b..fb117e8e81 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -799,9 +799,16 @@ float ism_dequant_meta( ivas_error set_ism_metadata( ISM_METADATA_HANDLE hIsmMeta, /* i/o: ISM metadata handle */ float azimuth, /* i : azimuth */ - float elevation /* i : elevation */ + float elevation /* i : elevation */ ); +#ifdef OMASA_BRATE_SW +void ivas_ism_metadata_close( // VE: use it also at the encoder + ISM_METADATA_HANDLE *hIsmMetaData, /* i/o: ISM metadata handles */ + const int16_t first_idx /* i : index of first handle to deallocate */ +); +#endif + ivas_error create_ism_metadata_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const int16_t n_ISms, /* i : number of objects */ @@ -5024,13 +5031,23 @@ void ivas_omasa_enc_close( const int16_t nchan_ism /* i : number of objects */ ); +#ifdef OMASA_BRATE_SW +ivas_error ivas_omasa_enc_config( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +ivas_error ivas_omasa_dec_config( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); +#endif + void ivas_omasa_set_config( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */ const int32_t input_Fs /* i : Input sample rate */ #ifdef OMASA_DIFFUSE_ISM_MERGE , - ISM_MODE ismMode /* i : ISM mode */ + const ISM_MODE ismMode /* i : ISM mode */ #endif ); @@ -5061,7 +5078,7 @@ void ivas_set_surplus_brate_enc( void ivas_set_surplus_brate_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - int32_t *ism_total_brate /* i : ISM total bit-rate */ + int32_t *ism_total_brate /* i : ISM total bitrate */ ); void set_ism_importance_interformat( @@ -5097,6 +5114,15 @@ ISM_MODE ivas_omasa_ism_mode_select( const int16_t nchan_ism /* i : number of input ISM's */ ); +#ifdef OMASA_BRATE_SW +void ivas_set_omasa_TC( + const ISM_MODE ism_mode, /* i : ISM mode */ + const int16_t nchan_ism, /* i : number of input ISMs */ + int16_t *nSCE, /* o : number of SCEs */ + int16_t *nCPE /* o : number of CPEs */ +); +#endif + void ivas_merge_masa_transports( float data_in_f1[][L_FRAME48k], /* i : Transport audio signals 1 */ float data_in_f2[][L_FRAME48k], /* i : Transport audio signals 2 */ @@ -5109,6 +5135,12 @@ ivas_error ivas_masa_ism_data_open( Decoder_Struct* st_ivas /* i/o: IVAS decoder handle */ ); +#ifdef OMASA_BRATE_SW +void ivas_masa_ism_data_close( + MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */ +); +#endif + void preProcessStereoTransportsForMovedObjects( Decoder_Struct* st_ivas, float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], diff --git a/lib_com/options.h b/lib_com/options.h index d0fda9cf9f..710803fcbc 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -181,6 +181,8 @@ #define FIX_4OBJ_128 /* VA: fix to 4 ISMs 24 kbps case: when all objects are HIGH_IMP, keep 24 kbps bitrate, otherwise increase the 24 kbps bitrate */ +#define OMASA_BRATE_SW /* VA: support of bitrate switching in OMASA format */ + #endif /* MASA_AND_OBJECTS */ diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index bb2b753181..5317781d55 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -512,10 +512,12 @@ ivas_error ivas_cldfb_dec_reconfig( } } } + /* CLDFB Interpolation weights */ if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( numCldfbAnalyses_old != numCldfbAnalyses || numCldfbSyntheses_old != numCldfbSyntheses || nchan_transport_old != st_ivas->nchan_transport ) ) { ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); } + return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index eab7b7c340..545dc8fbb3 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -176,7 +176,6 @@ ivas_error ivas_cpe_dec( #ifdef MASA_AND_OBJECTS } #endif - } else { @@ -711,10 +710,11 @@ ivas_error create_cpe_dec( { #ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == STEREO_FORMAT || st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || + ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) || st_ivas->sba_dirac_stereo_flag ) #else if ( st_ivas->ivas_format == STEREO_FORMAT || st_ivas->ivas_format == MASA_FORMAT || -#endif ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) || st_ivas->sba_dirac_stereo_flag ) +#endif { if ( ( hCPE->input_mem[i] = (float *) malloc( sizeof( float ) * NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ) ) == NULL ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index f530e8ecce..2d5a3168f2 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -71,7 +71,9 @@ ivas_error ivas_dec_setup( int32_t ivas_total_brate; ivas_error error; #ifdef MASA_AND_OBJECTS +#ifndef OMASA_BRATE_SW int32_t cpe_brate; +#endif #endif error = IVAS_ERR_OK; @@ -159,6 +161,12 @@ ivas_error ivas_dec_setup( /* reconfigure in case a change of operation mode is detected */ if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) ) { +#ifdef OMASA_BRATE_SW + if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( st_ivas->ini_active_frame == 0 && ivas_total_brate != FRAME_NO_DATA && ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->nCPE == 1 ) { st_ivas->hCPE[0]->nchan_out = 1; @@ -170,6 +178,7 @@ ivas_error ivas_dec_setup( return error; } } +#endif } } } @@ -177,8 +186,8 @@ ivas_error ivas_dec_setup( else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { st_ivas->nchan_transport = 2; /* always 2 MASA transport channels */ - /* for the DISC mode the number of objects are written at the end of the bitstream, in the MASA metadata*/ + /* for the DISC mode the number of objects are written at the end of the bitstream, in the MASA metadata */ st_ivas->nchan_ism = 2 * st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 1] + st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 2] + 1; st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); @@ -187,6 +196,12 @@ ivas_error ivas_dec_setup( /* reconfigure in case a change of operation mode is detected */ if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) ) { +#ifdef OMASA_BRATE_SW + if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } +#else cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); if ( st_ivas->ini_active_frame == 0 && ivas_total_brate != FRAME_NO_DATA && ( cpe_brate < MASA_STEREO_MIN_BITRATE ) && st_ivas->nCPE == 1 ) { @@ -196,6 +211,7 @@ ivas_error ivas_dec_setup( { return error; } +#endif } } } @@ -1051,10 +1067,17 @@ ivas_error ivas_init_decoder( reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] ); #ifdef OMASA_BRATE +#ifdef OMASA_BRATE_SW + if ( ( error = create_ism_metadata_dec( st_ivas, 1, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( st_ivas->hIsmMetaData[0] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); } +#endif #endif } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) @@ -1740,7 +1763,11 @@ void ivas_destroy_dec( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) { +#ifdef OMASA_BRATE_SW + int16_t i; +#else int16_t i, n; +#endif /* CLDFB handles */ for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) @@ -1807,6 +1834,9 @@ void ivas_destroy_dec( } /* ISM metadata handles */ +#ifdef OMASA_BRATE_SW + ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); +#else for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) { if ( st_ivas->hIsmMetaData[n] != NULL ) @@ -1815,6 +1845,7 @@ void ivas_destroy_dec( st_ivas->hIsmMetaData[n] = NULL; } } +#endif /* ISm renderer handle */ if ( st_ivas->hIsmRendererData != NULL ) @@ -1902,8 +1933,12 @@ void ivas_destroy_dec( free( st_ivas->hMonoDmxRenderer ); st_ivas->hMonoDmxRenderer = NULL; } + #ifdef MASA_AND_OBJECTS /* MASA ISM structure */ +#ifdef OMASA_BRATE_SW + ivas_masa_ism_data_close( &st_ivas->hMasaIsmData ); +#else if ( st_ivas->hMasaIsmData != NULL ) { if ( st_ivas->hMasaIsmData->delayBuffer != NULL ) @@ -1919,6 +1954,8 @@ void ivas_destroy_dec( st_ivas->hMasaIsmData = NULL; } #endif +#endif + /* Head track data handle */ if ( st_ivas->hHeadTrackData != NULL ) { diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index e72d691768..5e404c0ff9 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -596,10 +596,10 @@ ivas_error ivas_ism_metadata_dec( * Create, allocate, initialize and configure IVAS decoder ISM handles *-------------------------------------------------------------------------*/ -ivas_error create_ism_metadata_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t n_ISms, /* i : number of objects */ - int32_t element_brate_tmp[] /* o : element bitrate per object */ +ivas_error create_ism_metadata_dec( // VE: rename to ivas_ism_metadata_dec_create + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t n_ISms, /* i : number of objects */ + int32_t element_brate_tmp[] /* o : element bitrate per object */ ) { int16_t ch; @@ -624,12 +624,19 @@ ivas_error create_ism_metadata_dec( ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } - ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL +#ifdef OMASA_BRATE_SW + if ( element_brate_tmp != NULL ) + { +#endif + ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL #ifdef MASA_AND_OBJECTS - , - 0 + , + 0 +#endif + ); +#ifdef OMASA_BRATE_SW + } #endif - ); return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index ef890a7482..30a32e03a6 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -252,10 +252,10 @@ void ivas_ism_get_stereo_gains( #ifdef MASA_AND_OBJECTS /*-------------------------------------------------------------------------* - * ivas_masa_ism_separate_object_renderer_open() - * - * Open structures, reserve memory, and init values. - *-------------------------------------------------------------------------*/ +* ivas_masa_ism_separate_object_renderer_open() +* + * Open structures, reserve memory, and init values. + *-------------------------------------------------------------------------*/ ivas_error ivas_masa_ism_separate_object_renderer_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ @@ -266,10 +266,9 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( if ( ( st_ivas->hIsmRendererData = (ISM_RENDERER_HANDLE) malloc( sizeof( ISM_RENDERER_DATA ) ) ) == NULL ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISM renderer \n" ) ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM renderer \n" ) ); } - for ( i = 0; i < MAX_NUM_OBJECTS; i++ ) { set_f( st_ivas->hIsmRendererData->prev_gains[i], 0.0f, MAX_OUTPUT_CHANNELS ); @@ -296,6 +295,7 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); } + for ( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ ) { if ( ( st_ivas->hMasaIsmData->delayBuffer[i] = (float *) malloc( st_ivas->hMasaIsmData->delayBuffer_size * sizeof( float ) ) ) == NULL ) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index f45b1527ff..6cd00b03e8 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -419,10 +419,12 @@ ivas_error ivas_masa_decode( } } } + if ( st_ivas->hDirAC != NULL ) { ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, ivas_total_brate, SBA_MODE_NONE, 0 ); } + #ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { @@ -433,6 +435,7 @@ ivas_error ivas_masa_decode( return error; } } + if ( st_ivas->hDirAC != NULL ) { #ifndef OMASA_BRATE @@ -461,7 +464,9 @@ ivas_error ivas_masa_decode( } } #endif + st->next_bit_pos = next_bit_pos_orig; + #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT ) { @@ -581,45 +586,6 @@ ivas_error ivas_masa_dec_open( return IVAS_ERR_OK; } -#ifdef MASA_AND_OBJECTS -/*-------------------------------------------------------------------* - * ivas_masa_ism_data_open() - * - * - *-------------------------------------------------------------------*/ - -ivas_error ivas_masa_ism_data_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ -) -{ - MASA_ISM_DATA_HANDLE hMasaIsmData; - int16_t ch, bin; - - if ( ( hMasaIsmData = (MASA_ISM_DATA_HANDLE) malloc( sizeof( MASA_ISM_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA ISM data\n" ) ); - } - - for ( bin = 0; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) - { - for ( ch = 0; ch < 2; ch++ ) - { - hMasaIsmData->ismPreprocMatrix[ch][ch][bin] = 1.0f; - hMasaIsmData->ismPreprocMatrix[1 - ch][ch][bin] = 0.0f; - hMasaIsmData->eneMoveIIR[ch][bin] = 0.0f; - hMasaIsmData->enePreserveIIR[ch][bin] = 0.0f; - } - hMasaIsmData->preprocEneTarget[bin] = 0.0f; - hMasaIsmData->preprocEneRealized[bin] = 0.0f; - } - hMasaIsmData->objectsMoved = 0; - hMasaIsmData->delayBuffer = NULL; - st_ivas->hMasaIsmData = hMasaIsmData; - - return IVAS_ERR_OK; -} -#endif - /*-----------------------------------------------------------------------* * ivas_masa_dec_close() @@ -1374,6 +1340,7 @@ ivas_error ivas_masa_dec_reconfigure( } } } + #ifdef MASA_AND_OBJECTS ism_total_brate = 0; if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 5ca00ff79e..98e7b7eeee 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -35,11 +35,294 @@ #include "ivas_cnst.h" #include "ivas_prot.h" #include "prot.h" +#ifdef OMASA_BRATE_SW +#include "ivas_rom_com.h" +#endif #ifdef DEBUGGING #include "debug.h" #endif +#ifdef MASA_AND_OBJECTS +/*-------------------------------------------------------------------* + * ivas_masa_ism_data_open() + * + * Allocate and initialize MASA_ISM rendering handle + *-------------------------------------------------------------------*/ + +ivas_error ivas_masa_ism_data_open( + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +) +{ + MASA_ISM_DATA_HANDLE hMasaIsmData; + int16_t ch, bin; + + if ( ( hMasaIsmData = (MASA_ISM_DATA_HANDLE) malloc( sizeof( MASA_ISM_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA ISM data\n" ) ); + } + + for ( bin = 0; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) + { + for ( ch = 0; ch < 2; ch++ ) + { + hMasaIsmData->ismPreprocMatrix[ch][ch][bin] = 1.0f; + hMasaIsmData->ismPreprocMatrix[1 - ch][ch][bin] = 0.0f; + hMasaIsmData->eneMoveIIR[ch][bin] = 0.0f; + hMasaIsmData->enePreserveIIR[ch][bin] = 0.0f; + } + hMasaIsmData->preprocEneTarget[bin] = 0.0f; + hMasaIsmData->preprocEneRealized[bin] = 0.0f; + } + + hMasaIsmData->objectsMoved = 0; + hMasaIsmData->delayBuffer = NULL; + st_ivas->hMasaIsmData = hMasaIsmData; + + return IVAS_ERR_OK; +} + + +#ifdef OMASA_BRATE_SW +/*-------------------------------------------------------------------* + * ivas_masa_ism_data_close() + * + * Deallocate MASA_ISM rendering handle + *-------------------------------------------------------------------*/ + +void ivas_masa_ism_data_close( + MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */ +) +{ + int16_t i; + + if ( hMasaIsmData == NULL || *hMasaIsmData == NULL ) + { + return; + } + + if ( ( *hMasaIsmData )->delayBuffer != NULL ) + { + for ( i = 0; i < ( *hMasaIsmData )->delayBuffer_nchan; i++ ) + { + free( ( *hMasaIsmData )->delayBuffer[i] ); + } + free( ( *hMasaIsmData )->delayBuffer ); + ( *hMasaIsmData )->delayBuffer = NULL; + } + + free( *hMasaIsmData ); + *hMasaIsmData = NULL; + + return; +} +#endif +#endif + + +#ifdef OMASA_BRATE_SW +/*--------------------------------------------------------------------------* + * ivas_omasa_dec_config() + * + * oMASA decoder configuration + *--------------------------------------------------------------------------*/ + +ivas_error ivas_omasa_dec_config( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + int16_t k, n, sce_id, nSCE_old, nchan_hp20_old, numCldfbAnalyses_old, numCldfbSyntheses_old, n_MD; + int32_t ivas_total_brate, ism_total_brate, cpe_brate; + IVAS_FORMAT ivas_format_old; + ISM_MODE ism_mode_old; + ivas_error error; + + /* initializations */ + error = IVAS_ERR_OK; + ism_total_brate = 0; + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + + /* save previous frame parameters */ + ism_mode_old = ivas_omasa_ism_mode_select( st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->nchan_ism ); + st_ivas->ism_mode = ism_mode_old; + + ivas_format_old = st_ivas->ivas_format; + if ( ism_mode_old == ISM_MASA_MODE_PARAM || ism_mode_old == ISM_MASA_MODE_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_DISC ) + { + st_ivas->ivas_format = MASA_ISM_FORMAT; + } + ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + nSCE_old = st_ivas->nSCE; + nchan_hp20_old = getNumChanSynthesis( st_ivas ); + + /* reconstruct parameters */ + st_ivas->ivas_format = ivas_format_old; + if ( st_ivas->ivas_format == MASA_FORMAT ) + { + st_ivas->nchan_ism = 0; + } + + /* set ism_mode of current frame */ + st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); + + /* MASA reconfig. */ + cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); + if ( st_ivas->ini_active_frame == 0 && ivas_total_brate != FRAME_NO_DATA && ( cpe_brate < MASA_STEREO_MIN_BITRATE ) && st_ivas->nCPE == 1 ) + { + st_ivas->hCPE[0]->nchan_out = 1; + } + else if ( ( error = ivas_masa_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* OMASA reconfig. */ + if ( st_ivas->hMasaIsmData == NULL && st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + if ( ( error = ivas_masa_ism_data_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + ivas_set_omasa_TC( st_ivas->ism_mode, st_ivas->nchan_ism, &st_ivas->nSCE, &st_ivas->nCPE ); + + /* re-configure hp20 memories */ + if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* reconfigure core-coders for ISMs */ + if ( st_ivas->ivas_format == MASA_FORMAT ) + { + if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, 1, 2, 0, -1, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + k = 0; + while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) + { + k++; + } + + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + ism_total_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; + } + + if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, 1, 2, 0, sep_object_brate[k - 2][st_ivas->nSCE - 1], ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + + if ( ism_mode_old != st_ivas->ism_mode ) + { + /* ISM MD reconfig. */ + n_MD = 0; + + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + n_MD = 1; + + if ( st_ivas->hIsmMetaData[0] == NULL ) + { + if ( ( error = create_ism_metadata_dec( st_ivas, 1, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + n_MD = st_ivas->nchan_ism; + + ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); + + if ( ( error = create_ism_metadata_dec( st_ivas, st_ivas->nchan_ism, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + ivas_ism_metadata_close( st_ivas->hIsmMetaData, n_MD ); + + /* CLDFB instances */ + if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, 2, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) + { + return error; + } + + st_ivas->hCPE[0]->element_brate = ivas_total_brate - ism_total_brate; + + /* objects renderer reconfig. */ + if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) + { + if ( st_ivas->hIsmRendererData == NULL ) + { + if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + for ( n = 1; n < st_ivas->hMasaIsmData->delayBuffer_nchan; n++ ) + { + free( st_ivas->hMasaIsmData->delayBuffer[n] ); + } + + st_ivas->hMasaIsmData->delayBuffer_nchan = 1; + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + float tmp[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; + + st_ivas->hMasaIsmData->delayBuffer_nchan = st_ivas->nchan_ism; + + mvr2r( st_ivas->hMasaIsmData->delayBuffer[0], tmp, st_ivas->hMasaIsmData->delayBuffer_size ); + free( st_ivas->hMasaIsmData->delayBuffer[0] ); + free( st_ivas->hMasaIsmData->delayBuffer ); + if ( ( st_ivas->hMasaIsmData->delayBuffer = (float **) malloc( st_ivas->hMasaIsmData->delayBuffer_nchan * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); + } + + for ( n = 0; n < st_ivas->hMasaIsmData->delayBuffer_nchan; n++ ) + { + if ( ( st_ivas->hMasaIsmData->delayBuffer[n] = (float *) malloc( st_ivas->hMasaIsmData->delayBuffer_size * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); + } + set_zero( st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size ); + } + mvr2r( tmp, st_ivas->hMasaIsmData->delayBuffer[0], st_ivas->hMasaIsmData->delayBuffer_size ); + } + } + else if ( st_ivas->ism_mode != ISM_MASA_MODE_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) + { + for ( n = 0; n < st_ivas->hMasaIsmData->delayBuffer_nchan; n++ ) + { + free( st_ivas->hMasaIsmData->delayBuffer[n] ); + } + free( st_ivas->hMasaIsmData->delayBuffer ); + st_ivas->hMasaIsmData->delayBuffer = NULL; + + free( st_ivas->hIsmRendererData ); + st_ivas->hIsmRendererData = NULL; + } + } + + return error; +} +#endif + + #ifdef OMASA_BRATE /*--------------------------------------------------------------------------* * ivas_set_surplus_brate_dec() @@ -49,7 +332,7 @@ void ivas_set_surplus_brate_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - int32_t *ism_total_brate /* i/o: ISM total bit-rate */ + int32_t *ism_total_brate /* i/o: ISM total bitrate */ ) { int16_t n, bits_ism, bits_element[MAX_NUM_OBJECTS]; diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 20d03915c2..45257627a8 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -880,7 +880,11 @@ ivas_error stereo_memory_dec( * Bitrate switching in MASA format *---------------------------------------------------------------*/ +#ifdef OMASA_BRATE_SW + if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) && nchan_transport == 2 ) +#else if ( ivas_format == MASA_FORMAT && nchan_transport == 2 ) +#endif { if ( hCPE->nchan_out == 1 ) { diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index e8486d7738..27c855ec6f 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -230,7 +230,7 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hStereoMdct = NULL; } - /* create missing core coder elements and set element bitrates for alrady existing ones */ + /* create missing core coder elements and set element bitrates for already existing ones */ if ( st_ivas->nSCE > 0 ) { nSCE_existing = min( nSCE_old, st_ivas->nSCE ); @@ -250,7 +250,11 @@ ivas_error ivas_corecoder_enc_reconfig( } /* propagate input audio buffers */ +#ifdef OMASA_BRATE_SW + if ( n_CoreCoder_existing > sce_id && hEncoderConfig->ivas_format != MASA_ISM_FORMAT ) +#else if ( n_CoreCoder_existing > sce_id ) +#endif { mvr2r( input_buff[sce_id], st_ivas->hSCE[sce_id]->hCoreCoder[0]->input_buff, len_inp_memory ); } @@ -259,7 +263,11 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list + sce_id * MAX_NUM_INDICES; /* only reset indices if it is not the first index list, this already contains the IVAS format bits */ +#ifdef OMASA_BRATE_SW + if ( sce_id > 0 || hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) +#else if ( sce_id > 0 ) +#endif { reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); } @@ -289,7 +297,13 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->total_brate = st_ivas->hCPE[cpe_id]->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list + ( cpe_id * CPE_CHANNELS + n + st_ivas->nSCE ) * MAX_NUM_INDICES; +#ifdef OMASA_BRATE_SW + if ( ( cpe_id * CPE_CHANNELS + n > 0 ) || + ( st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->nSCE > 0 ) || + ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 ) ) +#else if ( cpe_id * CPE_CHANNELS + n > 0 || ( st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->nSCE > 0 ) ) +#endif { reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); } diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index cf69b1e333..ab4567ad6f 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -268,7 +268,11 @@ ivas_error ivas_cpe_enc( if ( hCPE->element_mode != IVAS_CPE_MDCT && ( hCPE->element_brate != hCPE->last_element_brate || hCPE->last_element_mode != hCPE->element_mode || - sts[0]->ini_frame == 0 || sts[0]->last_core_brate <= SID_2k40 ) ) /* If the last frame was SID or NO_DATA, we need to run stereo_dft_config here since VAD decision is not known yet */ + sts[0]->ini_frame == 0 || +#ifdef OMASA_BRATE_SW + ( ivas_total_brate != st_ivas->hEncoderConfig->last_ivas_total_brate ) || +#endif + sts[0]->last_core_brate <= SID_2k40 ) ) /* If the last frame was SID or NO_DATA, we need to run stereo_dft_config here since VAD decision is not known yet */ { if ( st_ivas->hQMetaData != NULL ) { diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index a3adbda9b6..fef6c63211 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -300,7 +300,14 @@ ivas_error ivas_enc( float data_separated_object[L_FRAME48k]; int16_t idx_separated_object; +#ifdef OMASA_BRATE_SW + if ( ( error = ivas_omasa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } +#else ivas_masa_enc_reconfigure( st_ivas ); +#endif hMetaData = st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; @@ -315,6 +322,9 @@ ivas_error ivas_enc( set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); #ifdef OMASA_BRATE +#ifdef OMASA_BRATE_SW + idx_separated_object = 0; +#else /* Configure MASA encoder based on frame parameters */ if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { @@ -332,6 +342,7 @@ ivas_error ivas_enc( #endif ); } +#endif /* Estimate TF-tile energy for the input MASA stream */ ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[hEncoderConfig->nchan_ism] ), input_frame, st_ivas->nchan_transport ); diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 43c498bcd0..88a782ccbe 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -958,11 +958,13 @@ ivas_error create_ism_metadata_enc( { int16_t ch, nchan_transport; - // VE: this part of the code is better to be moved to a separate function, e.g. ivas_set_omasa_TC() #ifdef MASA_AND_OBJECTS nchan_transport = st_ivas->nchan_transport; if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { +#ifdef OMASA_BRATE_SW + ivas_set_omasa_TC( st_ivas->ism_mode, n_ISms, &st_ivas->nSCE, &st_ivas->nCPE ); +#else switch ( st_ivas->ism_mode ) { case ISM_MASA_MODE_PARAM: @@ -985,6 +987,7 @@ ivas_error create_ism_metadata_enc( default: break; } +#endif } else { @@ -1041,12 +1044,13 @@ ivas_error create_ism_metadata_enc( ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } + #ifdef MASA_AND_OBJECTS if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { - ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, 1, NULL, NULL, NULL, element_brate_tmp, NULL, NULL, 1 ); + ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, 1, NULL, NULL, NULL, element_brate_tmp, NULL, NULL, 1 ); // VE: nchan_transport ????? } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index f31badf9b3..ac8380a503 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -707,6 +707,7 @@ ivas_error ivas_masa_enc_config( } } #endif + ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, hQMetaData, &st_ivas->hEncoderConfig->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE #ifdef MASA_AND_OBJECTS @@ -714,6 +715,7 @@ ivas_error ivas_masa_enc_config( ivas_format, st_ivas->ism_mode, ism_total_brate #endif ); + hQMetaData->is_masa_ivas_format = 1; #ifdef MASA_AND_OBJECTS @@ -747,6 +749,7 @@ ivas_error ivas_masa_enc_config( #ifdef MASA_AND_OBJECTS } #endif + /* Setup importance weights for two-direction band selection. */ if ( hMasa->config.numberOfDirections == 2 ) { @@ -1977,6 +1980,7 @@ void ivas_masa_enc_reconfigure( #endif ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; + #ifdef MASA_AND_OBJECTS ism_total_brate = 0; if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) @@ -1987,6 +1991,7 @@ void ivas_masa_enc_reconfigure( } } #endif + if ( ivas_total_brate != st_ivas->hEncoderConfig->last_ivas_total_brate ) { for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) @@ -2043,6 +2048,7 @@ void ivas_masa_enc_reconfigure( return; } + #ifdef MASA_AND_OBJECTS #ifdef OMASA_DIFFUSE_ISM_MERGE /*-------------------------------------------------------------------* diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index b7fe8ee27e..e739410ffb 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -230,6 +230,123 @@ void ivas_omasa_enc_close( } +#ifdef OMASA_BRATE_SW +/*--------------------------------------------------------------------------* + * ivas_omasa_enc_config() + * + * oMASA encoder configuration + *--------------------------------------------------------------------------*/ + +ivas_error ivas_omasa_enc_config( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +) +{ + int16_t k, sce_id, nSCE_old; + int32_t ivas_total_brate, ism_total_brate; + ISM_MODE ism_mode_old; + ENCODER_CONFIG_HANDLE hEncoderConfig; + ivas_error error; + + error = IVAS_ERR_OK; + hEncoderConfig = st_ivas->hEncoderConfig; + ivas_total_brate = hEncoderConfig->ivas_total_brate; + + + //ivas_masa_enc_reconfigure( st_ivas ); // VE: might not be needed + + + ism_mode_old = st_ivas->ism_mode; + nSCE_old = st_ivas->nSCE; + + st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, hEncoderConfig->nchan_ism ); + st_ivas->nchan_transport = 2; + + /* reconfiguration in case of bitrate switching */ + if ( hEncoderConfig->last_ivas_total_brate != ivas_total_brate ) + { + ivas_set_omasa_TC( st_ivas->ism_mode, hEncoderConfig->nchan_ism, &st_ivas->nSCE, &st_ivas->nCPE ); + + k = 0; + while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) + { + k++; + } + + ism_total_brate = 0; + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + ism_total_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; + } + + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) // VE!!!!! + { + ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, 1, NULL, NULL, NULL, NULL, NULL, NULL, 1 ); + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nSCE, NULL, NULL, NULL, NULL, NULL, NULL, 1 ); + } + + /* reconfigure core-coders for ISMs */ + if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, 1, 2, sep_object_brate[k - 2][st_ivas->nSCE - 1], ivas_total_brate - ism_total_brate, MC_MODE_NONE ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* re-write IVAS format signalling - actual 'ism_mode' was not known before */ + if ( st_ivas->nSCE > 0 ) + { + reset_indices_enc( st_ivas->hSCE[0]->hCoreCoder[0]->hBstr, st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->next_ind ); + } + else + { + reset_indices_enc( st_ivas->hCPE[0]->hCoreCoder[0]->hBstr, st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->next_ind ); + } + + ivas_write_format( st_ivas ); + + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hOMasa == NULL ) + { + if ( ( error = ivas_omasa_enc_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hOMasa != NULL ) + { + ivas_omasa_enc_close( st_ivas->hOMasa, st_ivas->hEncoderConfig->nchan_ism ); + st_ivas->hOMasa = NULL; + } + + st_ivas->hCPE[0]->element_brate = ivas_total_brate - ism_total_brate; + + if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) + { + hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; + } + else + { + hEncoderConfig->element_mode_init = IVAS_CPE_DFT; + } + } + + /* Configure MASA encoder based on frame parameters */ + if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) + { + /* Configure oMASA analysis based on MASA config */ + ivas_omasa_set_config( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hEncoderConfig->input_Fs, st_ivas->ism_mode ); + } + + return error; +} +#endif + + /*--------------------------------------------------------------------------* * ivas_omasa_set_config() * @@ -242,7 +359,7 @@ void ivas_omasa_set_config( const int32_t input_Fs /* i : Input sample rate */ #ifdef OMASA_DIFFUSE_ISM_MERGE , - ISM_MODE ismMode /* i : ISM mode */ + const ISM_MODE ismMode /* i : ISM mode */ #endif ) { @@ -673,7 +790,7 @@ void ivas_set_surplus_brate_enc( 0 #endif ); - /* note: ISM st->total_brate is iset in ivas_sce_enc() */ + /* note: ISM st->total_brate is set in ivas_sce_enc() */ } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 72ac9311c5..89bff9f74a 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1038,8 +1038,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric { #ifdef MASA_AND_OBJECTS float spectrumModVal; + + idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ - spectrumModVal = ( 1.0f - surCoh ) + surCoh * surCohEne[min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 )]; + spectrumModVal = ( 1.0f - surCoh ) + surCoh * surCohEne[idx]; diffEne *= spectrumModVal; #else idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); -- GitLab From c6dff3185d41b20d53ec8d74c5e29f5c3cf1638a Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 8 Mar 2023 15:42:22 +0100 Subject: [PATCH 177/375] add error returns --- lib_com/ivas_prot.h | 7 ++-- lib_dec/ivas_ism_dec.c | 67 +++++++++++++++++++++++++++------ lib_dec/ivas_ism_metadata_dec.c | 11 +++++- lib_dec/ivas_mct_dec.c | 23 ++++++++--- lib_dec/ivas_sba_dec.c | 16 ++++++-- lib_enc/ivas_ism_enc.c | 11 +++++- lib_enc/ivas_ism_metadata_enc.c | 19 +++++++--- lib_enc/ivas_mct_enc.c | 5 ++- lib_enc/ivas_sba_enc.c | 10 ++++- 9 files changed, 133 insertions(+), 36 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 4335929d8c..893cb3e33b 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -786,9 +786,9 @@ float ism_dequant_meta( ); ivas_error set_ism_metadata( - ISM_METADATA_HANDLE hIsmMeta, /* i/o: ISM metadata handle */ - float azimuth, /* i : azimuth */ - float elevation /* i : elevation */ + ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ + const float azimuth, /* i : azimuth value */ + const float elevation /* i : elevation value */ ); ivas_error create_ism_metadata_enc( @@ -3150,6 +3150,7 @@ ivas_error ivas_cldfb_dec_reconfig( int16_t numCldfbAnalyses_old, /* i : number of CLDFB analysis instances in previous frame */ const int16_t numCldfbSyntheses_old /* i : number of CLDFB synthesis instances in previous frame */ ); + /*! r: Ambisonic (SBA) order */ int16_t ivas_sba_get_order( const int16_t nb_channels, /* i : Number of ambisonic channels */ diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 6f07130d1d..65f657a2e3 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -62,14 +62,34 @@ static ivas_error ivas_ism_bitrate_switching( nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; - ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); + if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } + st_ivas->nSCE = st_ivas->nchan_transport; - ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, 0, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ); + /*-----------------------------------------------------------------* + * Allocate, initialize, and configure SCE/CPE/MCT handles + *-----------------------------------------------------------------*/ - ivas_hp20_dec_reconfig( st_ivas, nchan_transport_old ); + if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, 0, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + { + return error; + } + + /*-----------------------------------------------------------------* + * HP20 memories + *-----------------------------------------------------------------*/ + + if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_transport_old ) ) != IVAS_ERR_OK ) + { + return error; + } - /* Initialize the needed renderer struct and destroy the unnecessary renderer struct */ + /*-----------------------------------------------------------------* + * Initialize the needed renderer struct and destroy the unnecessary renderer struct + *-----------------------------------------------------------------*/ /* select the renderer */ ivas_renderer_select( st_ivas ); @@ -102,7 +122,10 @@ static ivas_error ivas_ism_bitrate_switching( ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); /* Open the TD Binaural renderer */ - ivas_td_binaural_open( st_ivas ); + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } else { @@ -112,7 +135,11 @@ static ivas_error ivas_ism_bitrate_switching( free( st_ivas->hIsmRendererData ); st_ivas->hIsmRendererData = NULL; } - ivas_ism_renderer_open( st_ivas ); + + if ( ( error = ivas_ism_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM ) @@ -132,6 +159,7 @@ static ivas_error ivas_ism_bitrate_switching( { return error; } + st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; #else ivas_crend_open( st_ivas ); @@ -144,13 +172,23 @@ static ivas_error ivas_ism_bitrate_switching( /* switching from Discrete ISM to ParamISM */ /* Allocate and initialize the ParamISM struct */ - ivas_param_ism_dec_open( st_ivas ); + if ( ( error = ivas_param_ism_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL ) { /* open the parametric binaural renderer */ - ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ); - ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ); + if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } /* Close the TD Binaural renderer */ if ( st_ivas->hBinRendererTd != NULL ) @@ -176,8 +214,15 @@ static ivas_error ivas_ism_bitrate_switching( if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM ) { /* open the parametric binaural renderer */ - ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ); - ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ); + if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } /* close the crend binaural renderer */ #ifdef FIX_197_CREND_INTERFACE diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 94784e435c..acbe4463a4 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -455,7 +455,10 @@ ivas_error ivas_ism_metadata_dec( if ( !bfi ) { - ivas_ism_config( ism_total_brate, *nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ); + if ( ( error = ivas_ism_config( ism_total_brate, *nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) + { + return error; + } for ( ch = 0; ch < *nchan_transport; ch++ ) { @@ -525,6 +528,7 @@ ivas_error create_ism_metadata_dec( ) { int16_t ch; + ivas_error error; /* allocate ISm metadata handles */ for ( ch = 0; ch < MAX_NUM_OBJECTS; ch++ ) @@ -541,7 +545,10 @@ ivas_error create_ism_metadata_dec( ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } - ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); + if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 1623aad023..681f3bd363 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -730,6 +730,7 @@ static ivas_error ivas_mc_dec_reconfig( { ivas_param_mc_dec_close( &st_ivas->hParamMC ); st_ivas->hParamMC = NULL; + /* remove ls conversion if it was allocated by ParamMC */ ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); } @@ -774,7 +775,10 @@ static ivas_error ivas_mc_dec_reconfig( } else { - ivas_param_mc_dec_reconfig( st_ivas ); + if ( ( error = ivas_param_mc_dec_reconfig( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } /* De-allocate McMasa-related handles */ @@ -966,15 +970,24 @@ static ivas_error ivas_mc_dec_reconfig( } } - /* re-configure hp20 memories */ - ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ); /*-----------------------------------------------------------------* - * CLDFB instances + * re-configure HP20 memories *-----------------------------------------------------------------*/ - ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ); + if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) + { + return error; + } + /*-----------------------------------------------------------------* + * CLDFB instances + *-----------------------------------------------------------------*/ + + if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) + { + return error; + } /*-----------------------------------------------------------------* * Allocate the LFE handle that is coded seperately after the allocation of the core coders diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index d200d467cf..e48362cc73 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -349,20 +349,28 @@ ivas_error ivas_sba_dec_reconfigure( * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ - ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ); + if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + { + return error; + } /*-----------------------------------------------------------------* * HP20 memories *-----------------------------------------------------------------*/ - ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ); + if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) + { + return error; + } /*-----------------------------------------------------------------* * CLDFB instances *-----------------------------------------------------------------*/ - ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ); - + if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) + { + return error; + } return error; } diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 9f9637d95e..85b8e0c4aa 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -415,8 +415,15 @@ ivas_error ivas_ism_enc_config( st_ivas->nSCE = st_ivas->nchan_transport; st_ivas->nCPE = 0; - ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); - ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ); + if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) + { + return error; + } if ( st_ivas->ism_mode == ISM_MODE_PARAM && last_ism_mode == ISM_MODE_DISC ) { diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 2171729472..a4407147ec 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -65,11 +65,11 @@ * Set metadata of for one ISM *-------------------------------------------------------------------------*/ -/*! r: 0 if success */ ivas_error set_ism_metadata( - ISM_METADATA_HANDLE hIsmMeta, - float azimuth, - float elevation ) + ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ + const float azimuth, /* i : azimuth value */ + const float elevation /* i : elevation value */ +) { if ( hIsmMeta == NULL ) { @@ -694,7 +694,10 @@ ivas_error ivas_ism_metadata_enc( * Configuration and decision about bitrates per channel *----------------------------------------------------------------*/ - ivas_ism_config( ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ); + if ( ( error = ivas_ism_config( ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) + { + return error; + } for ( ch = 0; ch < num_obj; ch++ ) { @@ -740,6 +743,7 @@ ivas_error create_ism_metadata_enc( ) { int16_t ch, nchan_transport; + ivas_error error; if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { @@ -771,7 +775,10 @@ ivas_error create_ism_metadata_enc( ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } - ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); + if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } return IVAS_ERR_OK; } diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index eb7975c1c1..38e87f5b54 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -645,7 +645,10 @@ static ivas_error ivas_mc_enc_reconfig( } else { - ivas_param_mc_enc_reconfig( st_ivas ); + if ( ( error = ivas_param_mc_enc_reconfig( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } /* De-allocate McMasa-related handles */ diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index 30454a4afd..0f543fe528 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -349,7 +349,10 @@ ivas_error ivas_sba_enc_reconfigure( } } - ivas_dirac_enc_reconfigure( st_ivas ); + if ( ( error = ivas_dirac_enc_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { @@ -361,7 +364,10 @@ ivas_error ivas_sba_enc_reconfigure( * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ - ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ); + if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) + { + return error; + } } return error; -- GitLab From 8a2144d9c1ea9eda8f55e139940122c7b9ed8a12 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 8 Mar 2023 15:46:46 +0100 Subject: [PATCH 178/375] sync to main --- lib_rend/ivas_rotation.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 3c8f7ece46..7735fa3f59 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -196,9 +196,15 @@ void Quat2Euler( { if ( quat.w != -3.0 ) { +#ifdef FIX_I109_ORIENTATION_TRACKING *roll = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) ); *yaw = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) ); +#else // bug: x and z swapped + *yaw = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); + *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) ); + *roll = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) ); +#endif } else { -- GitLab From 18f00132afb3373da021e77f964fe40e0faab3d0 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 8 Mar 2023 15:52:08 +0100 Subject: [PATCH 179/375] formatting --- lib_com/ivas_prot.h | 59 +++++++++++++++++++++++++-------- lib_dec/ivas_init_dec.c | 2 +- lib_dec/ivas_ism_metadata_dec.c | 6 ++-- lib_enc/ivas_init_enc.c | 2 +- lib_enc/ivas_ism_metadata_enc.c | 13 ++++---- lib_enc/lib_enc.c | 2 +- 6 files changed, 58 insertions(+), 26 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 893cb3e33b..b82a97dd03 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -785,19 +785,19 @@ float ism_dequant_meta( const int16_t cbsize /* i : codebook size */ ); -ivas_error set_ism_metadata( +ivas_error ivas_set_ism_metadata( ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ const float azimuth, /* i : azimuth value */ const float elevation /* i : elevation value */ ); -ivas_error create_ism_metadata_enc( +ivas_error ivas_ism_metadata_enc_create( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const int16_t n_ISms, /* i : number of objects */ int32_t element_brate_tmp[] /* o : element bitrate per object */ ); -ivas_error create_ism_metadata_dec( +ivas_error ivas_ism_metadata_dec_create( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t n_ISms, /* i : number of objects */ int32_t element_brate_tmp[] /* o : element bitrate per object */ @@ -1288,9 +1288,9 @@ int16_t adapt_GR_rpg1_ief( /*! r: number of bits written */ int16_t write_GR1( BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ - const int16_t ind, /* i : bitstream index */ - const int16_t *in, /* i : input vector */ - const int16_t len /* i : vector length */ + const int16_t ind, /* i : bitstream index */ + const int16_t *in, /* i : input vector */ + const int16_t len /* i : vector length */ ); /*! r: number of bits written */ @@ -2837,7 +2837,7 @@ void ivas_mct_dec_mct( void apply_MCT_dec( MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ Decoder_State **sts, /* i/o: decoder state structure */ - float *x[MCT_MAX_CHANNELS][NB_DIV] /* i/o: decoded and dequan. spect. input to MCT */ + float *x[MCT_MAX_CHANNELS][NB_DIV] /* i/o: decoded and dequan. spect. input to MCT */ ); void mctStereoIGF_dec( @@ -3114,6 +3114,7 @@ void ivas_dirac_param_est_enc( const SBA_MODE sba_mode ); + /*----------------------------------------------------------------------------------* * SBA format prototypes *----------------------------------------------------------------------------------*/ @@ -3920,11 +3921,41 @@ void ivas_spar_bitrate_dist( const int16_t bwidth /* i : audio bandwidth */ ); -void ivas_mdct( const float *pIn, float *pOut, const int16_t length ); -void ivas_dct_windowing( const int16_t fade_len, const int16_t full_len, const int16_t dct_len, const int16_t zero_pad_len, const float *pWindow_coeffs, const int16_t frame_len, float *pOut_buf, float *pBuffer_prev, float *pTemp_lfe ); -void ivas_tda( const float *pIn, float *pOut, const int16_t length ); -void ivas_imdct( const float *pIn, float *pOut, const int16_t length ); -void ivas_itda( const float *re, float *pOut, const int16_t length ); +void ivas_mdct( + const float *pIn, + float *pOut, + const int16_t length +); + +void ivas_dct_windowing( + const int16_t fade_len, + const int16_t full_len, + const int16_t dct_len, + const int16_t zero_pad_len, + const float *pWindow_coeffs, + const int16_t frame_len, + float *pOut_buf, + float *pBuffer_prev, + float *pTemp_lfe +); + +void ivas_tda( + const float *pIn, + float *pOut, + const int16_t length +); + +void ivas_imdct( + const float *pIn, + float *pOut, + const int16_t length +); + +void ivas_itda( + const float *re, + float *pOut, + const int16_t length +); void ivas_spar_get_cldfb_gains( SPAR_DEC_HANDLE hSpar, @@ -4159,8 +4190,8 @@ void ivas_transient_det_close( void ivas_transient_det_process( ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ float *pIn_pcm, /* i : input audio channels */ - const int16_t frame_len, /* i : frame length in samples */ - int16_t transient_det[2] /* o: transient det outputs */ + const int16_t frame_len, /* i : frame length in samples */ + int16_t transient_det[2] /* o : transient det outputs */ ); #else int16_t ivas_transient_det_process( diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index f4764893f1..04ee216672 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -822,7 +822,7 @@ ivas_error ivas_init_decoder( } } - if ( ( error = create_ism_metadata_dec( st_ivas, st_ivas->nSCE, element_brate_tmp ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nSCE, element_brate_tmp ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index acbe4463a4..53c1e9d2e9 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -516,12 +516,12 @@ ivas_error ivas_ism_metadata_dec( /*------------------------------------------------------------------------- - * create_ism_metadata_dec() + * ivas_ism_metadata_dec_create() * - * Create, allocate, initialize and configure IVAS decoder ISM handles + * Create, allocate, initialize and configure IVAS decoder ISM metadata handles *-------------------------------------------------------------------------*/ -ivas_error create_ism_metadata_dec( +ivas_error ivas_ism_metadata_dec_create( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t n_ISms, /* i : number of objects */ int32_t element_brate_tmp[] /* o : element bitrate per object */ diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 9293e1a4ab..1d49b37096 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -409,7 +409,7 @@ ivas_error ivas_init_encoder( st_ivas->ism_mode = ivas_ism_mode_select( hEncoderConfig->nchan_inp, ivas_total_brate ); - if ( ( error = create_ism_metadata_enc( st_ivas, hEncoderConfig->nchan_inp, element_brate_tmp ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_metadata_enc_create( st_ivas, hEncoderConfig->nchan_inp, element_brate_tmp ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index a4407147ec..2c7150b6c3 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -60,12 +60,12 @@ /*-------------------------------------------------------------------------* - * set_ism_metadata() + * ivas_set_ism_metadata() * - * Set metadata of for one ISM + * Set metadata of one ISM MD handle *-------------------------------------------------------------------------*/ -ivas_error set_ism_metadata( +ivas_error ivas_set_ism_metadata( ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ const float azimuth, /* i : azimuth value */ const float elevation /* i : elevation value */ @@ -138,6 +138,7 @@ static void rate_ism_importance( return; } + /*-------------------------------------------------------------------------* * ivas_ism_metadata_enc() * @@ -731,12 +732,12 @@ ivas_error ivas_ism_metadata_enc( } /*------------------------------------------------------------------------- - * create_ism_metadata_enc() + * ivas_ism_metadata_enc_create() * - * Create, allocate, initialize and configure IVAS encoder ISM handles + * Create, allocate, initialize and configure IVAS encoder ISM metadata handles *-------------------------------------------------------------------------*/ -ivas_error create_ism_metadata_enc( +ivas_error ivas_ism_metadata_enc_create( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const int16_t n_ISms, /* i : number of objects */ int32_t element_brate_tmp[] /* o : element bitrate per object */ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 0678cbf8e0..7ed8d4f2ec 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -426,7 +426,7 @@ ivas_error IVAS_ENC_FeedObjectMetadata( return IVAS_ERR_INDEX_OUT_OF_BOUNDS; } - error = set_ism_metadata( hIvasEnc->st_ivas->hIsmMetaData[ismIndex], metadata.azimuth, metadata.elevation ); + error = ivas_set_ism_metadata( hIvasEnc->st_ivas->hIsmMetaData[ismIndex], metadata.azimuth, metadata.elevation ); if ( error != IVAS_ERR_OK ) { return error; -- GitLab From 571964853eff10781dcee652cbd6a5543109d497 Mon Sep 17 00:00:00 2001 From: rhb Date: Wed, 8 Mar 2023 16:08:54 +0100 Subject: [PATCH 180/375] first implementation of low-delay SBA-to-mono --- lib_com/ivas_prot.h | 3 + lib_com/options.h | 2 + lib_dec/ivas_cpe_dec.c | 4 + lib_dec/ivas_dec.c | 4 + lib_dec/ivas_init_dec.c | 8 ++ lib_dec/ivas_output_config.c | 10 ++- lib_dec/ivas_sba_dirac_stereo_dec.c | 121 +++++++++++++++++++++------- lib_dec/ivas_sce_dec.c | 0 lib_dec/ivas_stereo_dft_dec.c | 105 +++++++++++++++++------- 9 files changed, 197 insertions(+), 60 deletions(-) mode change 100644 => 100755 lib_com/ivas_prot.h mode change 100644 => 100755 lib_dec/ivas_cpe_dec.c mode change 100644 => 100755 lib_dec/ivas_dec.c mode change 100644 => 100755 lib_dec/ivas_init_dec.c mode change 100644 => 100755 lib_dec/ivas_output_config.c mode change 100644 => 100755 lib_dec/ivas_sba_dirac_stereo_dec.c mode change 100644 => 100755 lib_dec/ivas_sce_dec.c mode change 100644 => 100755 lib_dec/ivas_stereo_dft_dec.c diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h old mode 100644 new mode 100755 index 4335929d8c..b430846d05 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1115,6 +1115,9 @@ void stereo_dft_dec( float *input_mem, /* i/o: mem of buffer DFT analysis */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ const int16_t sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ +#ifdef SBA2MONO + const int16_t sba_mono_flag, /* i : signal mono output for SBA DirAC */ +#endif ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ const int32_t output_Fs, /* i : Fs for delay calculation */ diff --git a/lib_com/options.h b/lib_com/options.h index 25da1d2ad3..334755ac0a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,6 +168,8 @@ #define FIX_94_VERIFY_WAV_NUM_CHANNELS /* FhG: Issue 94 - Check if number of channels in input wav file matches encoder/renderer configuration */ #define ISM_HIGHEST_BITRATE /* VA: Issue 284: Update highest bitrate limit in ISM format */ +#define SBA2MONO /* FhG: Issue 365: Adapt processing of SBA mono output to be in line with stereo output (less delay, lower complexity) */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c old mode 100644 new mode 100755 index ddd4ae363f..17d2efd516 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -405,7 +405,11 @@ ivas_error ivas_cpe_dec( } else { +#ifdef SBA2MONO + stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0 ); +#else stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0 ); +#endif } /* synthesis iFFT */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c old mode 100644 new mode 100755 index de8dde9828..ede1af7dfc --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -385,7 +385,11 @@ ivas_error ivas_dec( ivas_dirac_dec( st_ivas, output, nchan_remapped, NULL, NULL, -1 ); } } +#ifdef SBA2MONO + else if ( !st_ivas->sba_dirac_stereo_flag && nchan_out != 1 ) +#else else if ( !st_ivas->sba_dirac_stereo_flag ) +#endif { ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c old mode 100644 new mode 100755 index f4764893f1..a424561f21 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -903,7 +903,11 @@ ivas_error ivas_init_decoder( ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); } +#ifdef SBA2MONO + st_ivas->sba_dirac_stereo_flag = ( output_config == AUDIO_CONFIG_STEREO || ( output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) ); +#else st_ivas->sba_dirac_stereo_flag = ( output_config == AUDIO_CONFIG_STEREO ); +#endif } else /* SBA_MODE_DIRAC */ { @@ -1368,7 +1372,11 @@ ivas_error ivas_init_decoder( } /* CLDFB Interpolation weights */ +#ifdef SBA2MONO + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && !st_ivas->sba_dirac_stereo_flag && st_ivas->hDecoderConfig->nchan_out != 1 ) +#else if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && !st_ivas->sba_dirac_stereo_flag ) +#endif { ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); } diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c old mode 100644 new mode 100755 index f38e810ce3..75e1a0f812 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -303,7 +303,11 @@ void ivas_renderer_select( *renderer_type = RENDERER_DIRAC; if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && - ( output_config != AUDIO_CONFIG_5_1 && output_config != AUDIO_CONFIG_5_1_2 && output_config != AUDIO_CONFIG_5_1_4 && output_config != AUDIO_CONFIG_7_1 && output_config != AUDIO_CONFIG_7_1_4 && output_config != AUDIO_CONFIG_LS_CUSTOM ) ) +#ifdef SBA2MONO + ( output_config != AUDIO_CONFIG_5_1 && output_config != AUDIO_CONFIG_5_1_2 && output_config != AUDIO_CONFIG_5_1_4 && output_config != AUDIO_CONFIG_7_1 && output_config != AUDIO_CONFIG_7_1_4 && output_config != AUDIO_CONFIG_LS_CUSTOM && output_config != AUDIO_CONFIG_MONO && output_config != AUDIO_CONFIG_STEREO ) ) +#else + ( output_config != AUDIO_CONFIG_5_1 && output_config != AUDIO_CONFIG_5_1_2 && output_config != AUDIO_CONFIG_5_1_4 && output_config != AUDIO_CONFIG_7_1 && output_config != AUDIO_CONFIG_7_1_4 && output_config != AUDIO_CONFIG_LS_CUSTOM ) ) +#endif { if ( output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_FOA ) { @@ -320,7 +324,11 @@ void ivas_renderer_select( st_ivas->renderer_type = RENDERER_SBA_LINEAR_DEC; } else if ( ( st_ivas->ivas_format == MASA_FORMAT && output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) || +#ifdef SBA2MONO + ( st_ivas->ivas_format == SBA_FORMAT && ( output_config == AUDIO_CONFIG_STEREO || output_config == AUDIO_CONFIG_MONO ) ) ) +#else ( st_ivas->ivas_format == SBA_FORMAT && output_config == AUDIO_CONFIG_STEREO && st_ivas->nchan_transport == 1 ) ) +#endif { *renderer_type = RENDERER_DISABLE; } diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c old mode 100644 new mode 100755 index e184654eaa..c388675ec1 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -453,6 +453,9 @@ static void ivas_sba_dirac_stereo_upmix_hb( float hb_gain[NB_DIV], /* i : side gains for HB signal */ const int16_t output_frame, /* i : output frame length per channel */ const int16_t mcmasa, /* i : McMASA flag */ +#ifdef SBA2MONO + const int16_t sba_mono_flag, /* i : flag for mono output */ +#endif const STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i : Stereo DFT handle for mixing matrix */ ) { @@ -460,36 +463,60 @@ static void ivas_sba_dirac_stereo_upmix_hb( if ( !mcmasa ) { - for ( i = 0; i < output_frame / 2; i++ ) +#ifdef SBA2MONO + if ( sba_mono_flag ) { - float gp = hStereoDft->mixer_mat_smooth[0][0][8] + hStereoDft->mixer_mat_smooth[1][0][8] + - hStereoDft->mixer_mat_smooth[0][0][9] + hStereoDft->mixer_mat_smooth[1][0][9] + - hStereoDft->mixer_mat_smooth[0][0][10] + hStereoDft->mixer_mat_smooth[1][0][10] + - hStereoDft->mixer_mat_smooth[0][0][11] + hStereoDft->mixer_mat_smooth[1][0][11]; - - float gm = hStereoDft->mixer_mat_smooth[0][0][8] - hStereoDft->mixer_mat_smooth[1][0][8] + - hStereoDft->mixer_mat_smooth[0][0][9] - hStereoDft->mixer_mat_smooth[1][0][9] + - hStereoDft->mixer_mat_smooth[0][0][10] - hStereoDft->mixer_mat_smooth[1][0][10] + - hStereoDft->mixer_mat_smooth[0][0][11] - hStereoDft->mixer_mat_smooth[1][0][11]; - - hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * 0.25f * gp; - hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * 0.25f * gm; + for ( i = 0; i < output_frame / 2; i++ ) + { + float gp = hStereoDft->mixer_mat_smooth[0][0][8] + hStereoDft->mixer_mat_smooth[0][0][9] + + hStereoDft->mixer_mat_smooth[0][0][10] + hStereoDft->mixer_mat_smooth[0][0][11]; + + hb_stereo_synth[0][i] = hb_synth[i] * 0.25f * gp; + } + for ( i = output_frame / 2; i < output_frame; i++ ) + { + float gp = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS]; + + hb_stereo_synth[0][i] = hb_synth[i] * 0.25f * gp; + } } - for ( i = output_frame / 2; i < output_frame; i++ ) + else { - float gp = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; - - float gm = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; - - hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * 0.25f * gp; - hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * 0.25f * gm; +#endif + for ( i = 0; i < output_frame / 2; i++ ) + { + float gp = hStereoDft->mixer_mat_smooth[0][0][8] + hStereoDft->mixer_mat_smooth[1][0][8] + + hStereoDft->mixer_mat_smooth[0][0][9] + hStereoDft->mixer_mat_smooth[1][0][9] + + hStereoDft->mixer_mat_smooth[0][0][10] + hStereoDft->mixer_mat_smooth[1][0][10] + + hStereoDft->mixer_mat_smooth[0][0][11] + hStereoDft->mixer_mat_smooth[1][0][11]; + + float gm = hStereoDft->mixer_mat_smooth[0][0][8] - hStereoDft->mixer_mat_smooth[1][0][8] + + hStereoDft->mixer_mat_smooth[0][0][9] - hStereoDft->mixer_mat_smooth[1][0][9] + + hStereoDft->mixer_mat_smooth[0][0][10] - hStereoDft->mixer_mat_smooth[1][0][10] + + hStereoDft->mixer_mat_smooth[0][0][11] - hStereoDft->mixer_mat_smooth[1][0][11]; + + hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * 0.25f * gp; + hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * 0.25f * gm; + } + for ( i = output_frame / 2; i < output_frame; i++ ) + { + float gp = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + + float gm = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + + hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * 0.25f * gp; + hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * 0.25f * gm; + } +#ifdef SBA2MONO } +#endif } else { @@ -732,6 +759,9 @@ void ivas_sba_dirac_stereo_dec( ) { int16_t dtx_flag, fd_cng_flag; +#ifdef SBA2MONO + int16_t sba_mono_flag; +#endif int16_t memOffset; float tmp_buf[NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; float tmp_synth[L_FRAME16k]; @@ -756,6 +786,9 @@ void ivas_sba_dirac_stereo_dec( dtx_flag = ( hSCE->hCoreCoder[0]->core_brate <= SID_2k40 ); fd_cng_flag = ( dtx_flag && hSCE->hCoreCoder[0]->cng_type == FD_CNG ); } +#ifdef SBA2MONO + sba_mono_flag = ( st_ivas->hDecoderConfig->nchan_out == 1 ) ? 1 : 0; +#endif memOffset = NS2SA( output_frame * FRAMES_PER_SEC, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ); @@ -794,20 +827,39 @@ void ivas_sba_dirac_stereo_dec( } /* DFT Stereo upmix */ +#ifdef SBA2MONO + stereo_dft_dec( hStereoDft, hCPE->hCoreCoder[0], DFT, NULL, NULL, 1 /*st_ivas->sba_dirac_stereo_flag*/, sba_mono_flag, +#else stereo_dft_dec( hStereoDft, hCPE->hCoreCoder[0], DFT, NULL, NULL, 1, /*st_ivas->sba_dirac_stereo_flag*/ +#endif ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hMdDec : 0, ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hFbMixer->cross_fade_start_offset : 0, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport ); /* DFT synthesis */ stereo_dft_dec_synthesize( hCPE, DFT, 0, output[0], output_frame ); +#ifdef SBA2MONO + if ( !sba_mono_flag ) + { + stereo_dft_dec_synthesize( hCPE, DFT, 1, output[1], output_frame ); + } +#else stereo_dft_dec_synthesize( hCPE, DFT, 1, output[1], output_frame ); +#endif synchro_synthesis( st_ivas->hDecoderConfig->ivas_total_brate, hCPE, output, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/ ); /* output scaling */ +#ifdef SBA2MONO + if ( !sba_mono_flag ) + { + v_multc( output[0], 0.5f, output[0], output_frame ); + v_multc( output[1], 0.5f, output[1], output_frame ); + } +#else v_multc( output[0], 0.5f, output[0], output_frame ); v_multc( output[1], 0.5f, output[1], output_frame ); +#endif /* delay HB synth */ if ( st_ivas->nchan_transport == 1 ) @@ -824,15 +876,26 @@ void ivas_sba_dirac_stereo_dec( ivas_sba_dirac_stereo_compute_hb_gain( hStereoDft, hb_gain ); ivas_sba_dirac_stereo_upmix_hb( hb_synth_stereo, hSCE->save_hb_synth, hb_gain, output_frame, +#ifdef SBA2MONO + ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ), sba_mono_flag, hStereoDft ); +#else ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ), hStereoDft ); +#endif /* add HB to ACELP core */ v_add( output[0], hb_synth_stereo[0], output[0], output_frame ); - v_add( output[1], hb_synth_stereo[1], output[1], output_frame ); +#ifdef SBA2MONO + if ( !sba_mono_flag ) + { +#endif + v_add( output[1], hb_synth_stereo[1], output[1], output_frame ); - /* apply TD Stereo Filling as is done in ICBWE */ - ivas_sba_dirac_stereo_apply_td_stefi( hStereoDft, output, output_frame, ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) ); + /* apply TD Stereo Filling as is done in ICBWE */ + ivas_sba_dirac_stereo_apply_td_stefi( hStereoDft, output, output_frame, (st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa) ); +#ifdef SBA2MONO + } +#endif } return; diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c old mode 100644 new mode 100755 diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c old mode 100644 new mode 100755 index f1cbf180bd..0d9b079f2a --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -1126,6 +1126,9 @@ void stereo_dft_dec( float *input_mem, /* i/o: mem of buffer DFT analysis */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ const int16_t sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ +#ifdef SBA2MONO + const int16_t sba_mono_flag, /* i : signal mono output for SBA DirAC */ +#endif ivas_spar_md_dec_state_t *hMdDec, /* i : SPAR MD handle for upmixing */ const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ const int32_t output_Fs, /* i : Fs for delay calculation */ @@ -1410,50 +1413,92 @@ void stereo_dft_dec( if ( nchan_transport == 1 ) { - if ( b == 0 ) +#ifdef SBA2MONO + if ( sba_mono_flag ) { - i = 0; + if ( b == 0 ) + { + i = 0; - DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; - DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + DFT_L[2 * i] = DFT_W; + DFT_R[2 * i] = 0.f; - DFT_L[2 * i] = DFT_W + DFT_Y; - DFT_R[2 * i] = DFT_W - DFT_Y; + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + DFT_L[2 * i + 1] = DFT_W; + DFT_R[2 * i + 1] = 0.f; + } + for ( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) + { + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + (hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS]) * DFT_PRED_RES[2 * i]; + DFT_L[2 * i] = DFT_W; + DFT_R[2 * i] = 0.f; - DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; - DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + (hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS]) * DFT_PRED_RES[2 * i + 1]; + DFT_L[2 * i + 1] = DFT_W; + DFT_R[2 * i + 1] = 0.f; + } + for ( ; i < hStereoDft->band_limits[b + 1]; i++ ) + { + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + DFT_L[2 * i] = DFT_W; + DFT_R[2 * i] = 0.f; - DFT_L[2 * i + 1] = DFT_W + DFT_Y; - DFT_R[2 * i + 1] = DFT_W - DFT_Y; + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + DFT_L[2 * i + 1] = DFT_W; + DFT_R[2 * i + 1] = 0.f; + } } - for ( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) + else { - DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + ( hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i]; - DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + ( hStereoDft->mixer_mat_smooth[1][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i]; +#endif + if ( b == 0 ) + { + i = 0; - DFT_L[2 * i] = DFT_W + DFT_Y; - DFT_R[2 * i] = DFT_W - DFT_Y; + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; - DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + ( hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i + 1]; - DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + ( hStereoDft->mixer_mat_smooth[1][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i + 1]; + DFT_L[2 * i] = DFT_W + DFT_Y; + DFT_R[2 * i] = DFT_W - DFT_Y; - DFT_L[2 * i + 1] = DFT_W + DFT_Y; - DFT_R[2 * i + 1] = DFT_W - DFT_Y; - } - for ( ; i < hStereoDft->band_limits[b + 1]; i++ ) - { - DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; - DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; - DFT_L[2 * i] = DFT_W + DFT_Y; - DFT_R[2 * i] = DFT_W - DFT_Y; + DFT_L[2 * i + 1] = DFT_W + DFT_Y; + DFT_R[2 * i + 1] = DFT_W - DFT_Y; + } + for ( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) + { + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + (hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS]) * DFT_PRED_RES[2 * i]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + (hStereoDft->mixer_mat_smooth[1][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][b + k * IVAS_MAX_NUM_BANDS]) * DFT_PRED_RES[2 * i]; - DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; - DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + DFT_L[2 * i] = DFT_W + DFT_Y; + DFT_R[2 * i] = DFT_W - DFT_Y; - DFT_L[2 * i + 1] = DFT_W + DFT_Y; - DFT_R[2 * i + 1] = DFT_W - DFT_Y; + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + (hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS]) * DFT_PRED_RES[2 * i + 1]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + (hStereoDft->mixer_mat_smooth[1][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][b + k * IVAS_MAX_NUM_BANDS]) * DFT_PRED_RES[2 * i + 1]; + + DFT_L[2 * i + 1] = DFT_W + DFT_Y; + DFT_R[2 * i + 1] = DFT_W - DFT_Y; + } + for ( ; i < hStereoDft->band_limits[b + 1]; i++ ) + { + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + + DFT_L[2 * i] = DFT_W + DFT_Y; + DFT_R[2 * i] = DFT_W - DFT_Y; + + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + + DFT_L[2 * i + 1] = DFT_W + DFT_Y; + DFT_R[2 * i + 1] = DFT_W - DFT_Y; + } +#ifdef SBA2MONO } +#endif } else if ( nchan_transport >= 2 ) { -- GitLab From a69924e44536283e20e46511b4233da3c37d6d66 Mon Sep 17 00:00:00 2001 From: rhb Date: Wed, 8 Mar 2023 17:06:50 +0100 Subject: [PATCH 181/375] some optimization for ACELP HB processing --- lib_dec/ivas_sba_dirac_stereo_dec.c | 96 +++++++++++++++++++---------- 1 file changed, 65 insertions(+), 31 deletions(-) diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index c388675ec1..719bef5782 100755 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -455,66 +455,100 @@ static void ivas_sba_dirac_stereo_upmix_hb( const int16_t mcmasa, /* i : McMASA flag */ #ifdef SBA2MONO const int16_t sba_mono_flag, /* i : flag for mono output */ + const int16_t bwidth, /* i : bandwidth of signal */ #endif const STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i : Stereo DFT handle for mixing matrix */ ) { int16_t i; +#ifdef SBA2MONO + float gp, gm; + float gain_fac; +#endif if ( !mcmasa ) { #ifdef SBA2MONO + gain_fac = ( bwidth == FB ) ? 0.25f : 0.33f; /* last matrix element zero for SWB, divide by 3 instead of 4*/ if ( sba_mono_flag ) { + gp = hStereoDft->mixer_mat_smooth[0][0][8] + hStereoDft->mixer_mat_smooth[0][0][9] + + hStereoDft->mixer_mat_smooth[0][0][10] + hStereoDft->mixer_mat_smooth[0][0][11]; for ( i = 0; i < output_frame / 2; i++ ) { - float gp = hStereoDft->mixer_mat_smooth[0][0][8] + hStereoDft->mixer_mat_smooth[0][0][9] + - hStereoDft->mixer_mat_smooth[0][0][10] + hStereoDft->mixer_mat_smooth[0][0][11]; - - hb_stereo_synth[0][i] = hb_synth[i] * 0.25f * gp; + hb_stereo_synth[0][i] = hb_synth[i] * gain_fac * gp; } + gp = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS]; for ( i = output_frame / 2; i < output_frame; i++ ) { - float gp = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS]; - - hb_stereo_synth[0][i] = hb_synth[i] * 0.25f * gp; + hb_stereo_synth[0][i] = hb_synth[i] * gain_fac * gp; } } else { -#endif - for ( i = 0; i < output_frame / 2; i++ ) - { - float gp = hStereoDft->mixer_mat_smooth[0][0][8] + hStereoDft->mixer_mat_smooth[1][0][8] + - hStereoDft->mixer_mat_smooth[0][0][9] + hStereoDft->mixer_mat_smooth[1][0][9] + - hStereoDft->mixer_mat_smooth[0][0][10] + hStereoDft->mixer_mat_smooth[1][0][10] + - hStereoDft->mixer_mat_smooth[0][0][11] + hStereoDft->mixer_mat_smooth[1][0][11]; + gp = hStereoDft->mixer_mat_smooth[0][0][8] + hStereoDft->mixer_mat_smooth[1][0][8] + + hStereoDft->mixer_mat_smooth[0][0][9] + hStereoDft->mixer_mat_smooth[1][0][9] + + hStereoDft->mixer_mat_smooth[0][0][10] + hStereoDft->mixer_mat_smooth[1][0][10] + + hStereoDft->mixer_mat_smooth[0][0][11] + hStereoDft->mixer_mat_smooth[1][0][11]; - float gm = hStereoDft->mixer_mat_smooth[0][0][8] - hStereoDft->mixer_mat_smooth[1][0][8] + - hStereoDft->mixer_mat_smooth[0][0][9] - hStereoDft->mixer_mat_smooth[1][0][9] + - hStereoDft->mixer_mat_smooth[0][0][10] - hStereoDft->mixer_mat_smooth[1][0][10] + - hStereoDft->mixer_mat_smooth[0][0][11] - hStereoDft->mixer_mat_smooth[1][0][11]; + gm = hStereoDft->mixer_mat_smooth[0][0][8] - hStereoDft->mixer_mat_smooth[1][0][8] + + hStereoDft->mixer_mat_smooth[0][0][9] - hStereoDft->mixer_mat_smooth[1][0][9] + + hStereoDft->mixer_mat_smooth[0][0][10] - hStereoDft->mixer_mat_smooth[1][0][10] + + hStereoDft->mixer_mat_smooth[0][0][11] - hStereoDft->mixer_mat_smooth[1][0][11]; + for ( i = 0; i < output_frame / 2; i++ ) + { hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * 0.25f * gp; hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * 0.25f * gm; } - for ( i = output_frame / 2; i < output_frame; i++ ) - { - float gp = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; - float gm = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + gp = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + gm = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + + for ( i = output_frame / 2; i < output_frame; i++ ) + { hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * 0.25f * gp; hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * 0.25f * gm; } -#ifdef SBA2MONO + } +#else + for ( i = 0; i < output_frame / 2; i++ ) + { + float gp = hStereoDft->mixer_mat_smooth[0][0][8] + hStereoDft->mixer_mat_smooth[1][0][8] + + hStereoDft->mixer_mat_smooth[0][0][9] + hStereoDft->mixer_mat_smooth[1][0][9] + + hStereoDft->mixer_mat_smooth[0][0][10] + hStereoDft->mixer_mat_smooth[1][0][10] + + hStereoDft->mixer_mat_smooth[0][0][11] + hStereoDft->mixer_mat_smooth[1][0][11]; + + float gm = hStereoDft->mixer_mat_smooth[0][0][8] - hStereoDft->mixer_mat_smooth[1][0][8] + + hStereoDft->mixer_mat_smooth[0][0][9] - hStereoDft->mixer_mat_smooth[1][0][9] + + hStereoDft->mixer_mat_smooth[0][0][10] - hStereoDft->mixer_mat_smooth[1][0][10] + + hStereoDft->mixer_mat_smooth[0][0][11] - hStereoDft->mixer_mat_smooth[1][0][11]; + + hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * 0.25f * gp; + hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * 0.25f * gm; + } + for ( i = output_frame / 2; i < output_frame; i++ ) + { + float gp = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + + float gm = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + + hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * 0.25f * gp; + hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * 0.25f * gm; } #endif } @@ -877,7 +911,7 @@ void ivas_sba_dirac_stereo_dec( ivas_sba_dirac_stereo_upmix_hb( hb_synth_stereo, hSCE->save_hb_synth, hb_gain, output_frame, #ifdef SBA2MONO - ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ), sba_mono_flag, hStereoDft ); + ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ), sba_mono_flag, hSCE->hCoreCoder[0]->bwidth, hStereoDft ); #else ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ), hStereoDft ); #endif -- GitLab From 39ef324fb0208f46526a0eef345d02104631a18f Mon Sep 17 00:00:00 2001 From: hsd Date: Wed, 8 Mar 2023 17:50:50 +0100 Subject: [PATCH 182/375] [fix] set reference vector/rot before set headrotation gets called, otherwise there's one frame of delay in the processing which lets the bit exactness tests fails --- apps/renderer.c | 50 ++++++++++++++++--------------------------------- 1 file changed, 16 insertions(+), 34 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 7206d14585..9437204ee6 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -980,6 +980,22 @@ int main( IsmPositionProvider_getNextFrame( positionProvider, &mtdBuffer ); #ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef OTR_REFERENCE_VECTOR_TRACKING + if ( referenceVectorReader != NULL ) + { + IVAS_VECTOR3 listenerPos, refPos; + if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPos, &refPos ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + if ( ( error = IVAS_REND_SetReferenceVector( hIvasRend, listenerPos, refPos ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + } +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ /* Read from reference rotation trajectory file if specified */ if ( referenceRotReader != NULL ) { @@ -1028,40 +1044,6 @@ int main( } } -#ifdef FIX_I109_ORIENTATION_TRACKING -#ifdef OTR_REFERENCE_VECTOR_TRACKING - if ( referenceVectorReader != NULL ) - { - IVAS_VECTOR3 listenerPos, refPos; - if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPos, &refPos ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); - } - if ( ( error = IVAS_REND_SetReferenceVector( hIvasRend, listenerPos, refPos ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); - } - } -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ - /* Read from reference rotation trajectory file if specified */ - if ( referenceRotReader != NULL ) - { - IVAS_QUATERNION quaternion; - if ( HeadRotationFileReading( referenceRotReader, &quaternion ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error in Head Rotation File Reading.\r\n" ); - exit( -1 ); - } - if ( IVAS_REND_SetReferenceRotation( hIvasRend, quaternion ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error setting Reference Rotation.\r\n" ); - exit( -1 ); - } - } -#endif - for ( i = 0; i < args.inConfig.numMultiChannelBuses; ++i ) { if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, mcIds[i], &numChannels ) ) != IVAS_ERR_OK ) -- GitLab From f30e323c2015252305920e66cbe094e94c5c7648 Mon Sep 17 00:00:00 2001 From: hsd Date: Wed, 8 Mar 2023 19:18:37 +0100 Subject: [PATCH 183/375] [fix] set reference vector/rot before set headrotation gets called, otherwise there's one frame of delay in the processing --- apps/decoder.c | 56 ++++++++++++++++---------------------------------- 1 file changed, 18 insertions(+), 38 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index ce81d3a904..6788953ee8 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1585,6 +1585,24 @@ static ivas_error decodeG192( } #ifdef FIX_I109_ORIENTATION_TRACKING +#ifdef OTR_REFERENCE_VECTOR_TRACKING + /* reference vector */ + if ( arg.enableReferenceVectorTracking ) + { + IVAS_VECTOR3 listenerPosition, referencePosition; + if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPosition, &referencePosition ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError %s while reading listener and reference positions from %s\n", IVAS_DEC_GetErrorMessage( error ), Vector3PairFileReader_getFilePath( referenceVectorReader ) ); + goto cleanup; + } + + if ( ( error = IVAS_DEC_FeedRefVectorData( hIvasDec, listenerPosition, referencePosition ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedRefVectorData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ /* Reference rotation */ if ( arg.enableReferenceRotation ) { @@ -1630,44 +1648,6 @@ static ivas_error decodeG192( goto cleanup; } } - -#ifdef FIX_I109_ORIENTATION_TRACKING - /* Reference rotation */ - if ( arg.enableReferenceRotation ) - { - IVAS_QUATERNION quaternion; - if ( ( error = HeadRotationFileReading( refRotReader, &quaternion ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) ); - goto cleanup; - } - - if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } -#ifdef OTR_REFERENCE_VECTOR_TRACKING - /* reference vector */ - if ( arg.enableReferenceVectorTracking ) - { - IVAS_VECTOR3 listenerPosition, referencePosition; - if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPosition, &referencePosition ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError %s while reading listener and reference positions from %s\n", IVAS_DEC_GetErrorMessage( error ), Vector3PairFileReader_getFilePath( referenceVectorReader ) ); - goto cleanup; - } - - if ( ( error = IVAS_DEC_FeedRefVectorData( hIvasDec, listenerPosition, referencePosition ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedRefVectorData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#endif - /* Run decoder for one frame (get rendered output) */ if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamples ) ) != IVAS_ERR_OK ) { -- GitLab From 87e89954c845eefa2f6caa31302aa050a912a887 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 8 Mar 2023 20:58:32 +0100 Subject: [PATCH 184/375] wrapped angles for deg/rad vv. conversion --- lib_rend/ivas_orient_trk.c | 13 +++++++------ lib_rend/ivas_rotation.c | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index cf5a4b3028..a5a1e95268 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -759,12 +759,13 @@ ivas_error ivas_orient_trk_Process( if ( pAbsRot->w == -3.0f ) { - Quat2Euler( trkQuat, &trkEuler.z, &trkEuler.y, &trkEuler.x ); - trkEuler.x = rad2deg( trkEuler.x ); - trkEuler.y = rad2deg( trkEuler.y ); - trkEuler.z = rad2deg( trkEuler.z ); - trkEuler.w = -3.0f; - *pTrkRot = trkEuler; + //Quat2Euler( trkQuat, &trkEuler.z, &trkEuler.y, &trkEuler.x ); + //trkEuler.x = rad2deg( trkEuler.x ); + //trkEuler.y = rad2deg( trkEuler.y ); + //trkEuler.z = rad2deg( trkEuler.z ); + //trkEuler.w = -3.0f; + //*pTrkRot = trkEuler; + *pTrkRot = trkQuat; } else { diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 7735fa3f59..44b58909fb 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -258,6 +258,15 @@ void Euler2Quat( *------------------------------------------------------------------------*/ float deg2rad( float degrees ) { + if ( degrees > 180.0f ) + { + degrees = degrees - 360.0f; + } + if ( degrees < -180.0f ) + { + degrees = degrees + 360.0f; + } + return PI_OVER_180 * degrees; } @@ -268,6 +277,15 @@ float deg2rad( float degrees ) *------------------------------------------------------------------------*/ float rad2deg( float radians ) { + if ( radians > EVS_PI ) + { + radians = radians - PI2; + } + if ( radians < -EVS_PI ) + { + radians = radians + PI2; + } + return _180_OVER_PI * radians; } -- GitLab From 3cfeb247688487474f8ea2565c96a241852666b1 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 8 Mar 2023 21:30:43 +0100 Subject: [PATCH 185/375] clang to the rescue --- lib_rend/ivas_orient_trk.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index a5a1e95268..cf5a4b3028 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -759,13 +759,12 @@ ivas_error ivas_orient_trk_Process( if ( pAbsRot->w == -3.0f ) { - //Quat2Euler( trkQuat, &trkEuler.z, &trkEuler.y, &trkEuler.x ); - //trkEuler.x = rad2deg( trkEuler.x ); - //trkEuler.y = rad2deg( trkEuler.y ); - //trkEuler.z = rad2deg( trkEuler.z ); - //trkEuler.w = -3.0f; - //*pTrkRot = trkEuler; - *pTrkRot = trkQuat; + Quat2Euler( trkQuat, &trkEuler.z, &trkEuler.y, &trkEuler.x ); + trkEuler.x = rad2deg( trkEuler.x ); + trkEuler.y = rad2deg( trkEuler.y ); + trkEuler.z = rad2deg( trkEuler.z ); + trkEuler.w = -3.0f; + *pTrkRot = trkEuler; } else { -- GitLab From 3a83b608f7f520a958a175bdb135b92e16f7962b Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 8 Mar 2023 21:32:38 +0100 Subject: [PATCH 186/375] forgot to check in file --- lib_rend/ivas_rotation.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 44b58909fb..3ede2e3500 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -258,11 +258,11 @@ void Euler2Quat( *------------------------------------------------------------------------*/ float deg2rad( float degrees ) { - if ( degrees > 180.0f ) + if ( degrees >= 180.0f ) { degrees = degrees - 360.0f; } - if ( degrees < -180.0f ) + if ( degrees <= -180.0f ) { degrees = degrees + 360.0f; } @@ -277,11 +277,11 @@ float deg2rad( float degrees ) *------------------------------------------------------------------------*/ float rad2deg( float radians ) { - if ( radians > EVS_PI ) + if ( radians >= EVS_PI ) { radians = radians - PI2; } - if ( radians < -EVS_PI ) + if ( radians <= -EVS_PI ) { radians = radians + PI2; } -- GitLab From afe79562e230fdc4a899df14e2fb7bbff5c67ee0 Mon Sep 17 00:00:00 2001 From: szczerba Date: Wed, 8 Mar 2023 21:59:33 +0100 Subject: [PATCH 187/375] Conversion back to Euler angles removed from orientation tracker, no Euler input anymore for QuatToRotMat function --- lib_rend/ivas_orient_trk.c | 38 +++++++------------------- lib_rend/ivas_prot_rend.h | 18 ++++++------- lib_rend/ivas_rotation.c | 55 +++++++++++++++++++------------------- 3 files changed, 44 insertions(+), 67 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 994fbe822a..bc685c704a 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -367,7 +367,7 @@ void VectorRotationToQuaternion( r->x = cross_product.x; r->y = cross_product.y; r->z = cross_product.z; - r->w = 1.0 + dot_product; + r->w = 1.0f + dot_product; } QuaternionNormalize( *r, r ); } @@ -665,8 +665,7 @@ ivas_error ivas_orient_trk_Process( float alpha = pOTR->alpha; float ang; ivas_error result; - IVAS_QUATERNION absQuat, trkQuat; - IVAS_QUATERNION trkEuler; + IVAS_QUATERNION absQuat; if ( pOTR == NULL || pTrkRot == NULL ) { @@ -688,7 +687,7 @@ ivas_error ivas_orient_trk_Process( switch ( pOTR->trackingType ) { case OTR_TRACKING_NONE: - trkQuat = absQuat; + pOTR->trkRot = absQuat; break; case OTR_TRACKING_REF_ORIENT: @@ -699,8 +698,8 @@ ivas_error ivas_orient_trk_Process( pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate ); /* Compute relative orientation = (absolute orientation) - (reference orientation) */ - QuaternionInverse( pOTR->refRot, &trkQuat ); - QuaternionProduct( trkQuat, absQuat, &trkQuat ); + QuaternionInverse( pOTR->refRot, &pOTR->trkRot ); + QuaternionProduct( pOTR->trkRot, absQuat, &pOTR->trkRot ); break; case OTR_TRACKING_AVG_ORIENT: @@ -708,14 +707,14 @@ ivas_error ivas_orient_trk_Process( QuaternionSlerp( pOTR->absAvgRot, absQuat, alpha, &pOTR->absAvgRot ); /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */ - QuaternionInverse( pOTR->absAvgRot, &trkQuat ); - QuaternionProduct( trkQuat, absQuat, &trkQuat ); + QuaternionInverse( pOTR->absAvgRot, &pOTR->trkRot ); + QuaternionProduct( pOTR->trkRot, absQuat, &pOTR->trkRot ); /* Adapt LPF constant based on orientation excursion relative to current mean: - low cutoff (slow adaptation) for small excursions (around center) - high cutoff (fast adaptation) for large excursions (off-center) */ - ang = QuaternionAngle( absQuat, trkQuat ); + ang = QuaternionAngle( absQuat, pOTR->trkRot ); normalizedOrientation = ang * ang; relativeOrientationRate = sqrtf( normalizedOrientation ) / pOTR->adaptationAngle; @@ -744,7 +743,7 @@ ivas_error ivas_orient_trk_Process( case OTR_TRACKING_REF_VEC_LEV: { /* This processing step of the OTR_TRACKING_REF_VEC/OTR_TRACKING_REF_VEC_LEVEL is identical */ - QuaternionProduct( pOTR->refRot, absQuat, &trkQuat ); + QuaternionProduct( pOTR->refRot, absQuat, &pOTR->trkRot ); break; } #endif /* OTR_REFERENCE_VECTOR_TRACKING */ @@ -753,25 +752,6 @@ ivas_error ivas_orient_trk_Process( break; } - if ( result == IVAS_ERR_OK ) - { - pOTR->trkRot = trkQuat; - - if ( absRot.w == -3.0f ) - { - Quat2Euler( trkQuat, &trkEuler.z, &trkEuler.y, &trkEuler.x ); - trkEuler.x = rad2deg( trkEuler.x ); - trkEuler.y = rad2deg( trkEuler.y ); - trkEuler.z = rad2deg( trkEuler.z ); - trkEuler.w = -3.0f; - *pTrkRot = trkEuler; - } - else - { - *pTrkRot = trkQuat; - } - } - return result; } #else diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index dcf78e7984..25dfa078cc 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -799,16 +799,7 @@ ivas_error ivas_headTrack_open( void ivas_headTrack_close( HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* i/o: head track handle */ ); -#endif -void Quat2Euler( - const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ - float *yaw, /* o : yaw (z) */ - float *pitch, /* o : pitch (y) */ - float *roll /* o : roll (x) */ -); - -#ifdef FIX_I109_ORIENTATION_TRACKING void Euler2Quat( const float roll, /* i : roll (x) */ const float pitch, /* i : pitch (y) */ @@ -818,9 +809,16 @@ void Euler2Quat( float deg2rad( float degrees ); -float rad2deg( float radians ); +#else +void Quat2Euler( + const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ + float *yaw, /* o : yaw (z) */ + float *pitch, /* o : pitch (y) */ + float *roll /* o : roll (x) */ +); #endif + void QuatToRotMat( const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ float Rmat[3][3] /* o : real-space rotation matrix for this rotation */ diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 3e30b7952e..e946654a07 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -120,6 +120,29 @@ void QuatToRotMat( ) { float s1, s2, s3, c1, c2, c3; + +#ifdef FIX_I109_ORIENTATION_TRACKING + c1 = cosf( quat.z / _180_OVER_PI ); + c2 = cosf( quat.y / _180_OVER_PI ); + c3 = cosf( quat.x / _180_OVER_PI ); + + s1 = sinf( quat.z / _180_OVER_PI ); + s2 = sinf( -quat.y / _180_OVER_PI ); + s3 = sinf( quat.x / _180_OVER_PI ); + + Rmat[0][0] = c2 * c3; + Rmat[0][1] = -c2 * s3; + Rmat[0][2] = s2; + + Rmat[1][0] = c1 * s3 + c3 * s1 * s2; + Rmat[1][1] = c1 * c3 - s1 * s2 * s3; + Rmat[1][2] = -c2 * s1; + + Rmat[2][0] = s1 * s3 - c1 * c3 * s2; + Rmat[2][1] = c3 * s1 + c1 * s2 * s3; + Rmat[2][2] = c1 * c2; +#else + #ifdef DEBUGGING /* PrintQuat( quat ); */ #endif @@ -177,10 +200,12 @@ void QuatToRotMat( Rmat[2][1] = c3 * s1 + c1 * s2 * s3; Rmat[2][2] = c1 * c2; } +#endif return; } +#ifndef FIX_I109_ORIENTATION_TRACKING /*------------------------------------------------------------------------- * Quat2Euler() * @@ -196,15 +221,9 @@ void Quat2Euler( { if ( quat.w != -3.0 ) { -#ifdef FIX_I109_ORIENTATION_TRACKING - *roll = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); - *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) ); - *yaw = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) ); -#else // bug: x and z swapped *yaw = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) ); *roll = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) ); -#endif } else { @@ -221,6 +240,7 @@ void Quat2Euler( return; } +#endif #ifdef FIX_I109_ORIENTATION_TRACKING /*------------------------------------------------------------------------- @@ -252,7 +272,7 @@ void Euler2Quat( } /*------------------------------------------------------------------------- - * rad2deg() + * deg2rad() * * Return angle in radians from degrees *------------------------------------------------------------------------*/ @@ -269,29 +289,8 @@ float deg2rad( float degrees ) return PI_OVER_180 * degrees; } - -/*------------------------------------------------------------------------- - * deg2rad() - * - * Return angle in degrees from radians - *------------------------------------------------------------------------*/ -float rad2deg( float radians ) -{ - if ( radians >= EVS_PI ) - { - radians = radians - PI2; - } - if ( radians <= -EVS_PI ) - { - radians = radians + PI2; - } - - return _180_OVER_PI * radians; -} - #endif - /*------------------------------------------------------------------------- * rotateAziEle() * -- GitLab From c1604c895b3ec950e7d94282e2a3d44cbf9a64a7 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 8 Mar 2023 22:11:35 +0100 Subject: [PATCH 188/375] while instead of if --- lib_rend/ivas_rotation.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 3ede2e3500..d3f6bec381 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -258,11 +258,11 @@ void Euler2Quat( *------------------------------------------------------------------------*/ float deg2rad( float degrees ) { - if ( degrees >= 180.0f ) + while ( degrees >= 180.0f ) { degrees = degrees - 360.0f; } - if ( degrees <= -180.0f ) + while ( degrees <= -180.0f ) { degrees = degrees + 360.0f; } @@ -277,11 +277,11 @@ float deg2rad( float degrees ) *------------------------------------------------------------------------*/ float rad2deg( float radians ) { - if ( radians >= EVS_PI ) + while ( radians >= EVS_PI ) { radians = radians - PI2; } - if ( radians <= -EVS_PI ) + while ( radians <= -EVS_PI ) { radians = radians + PI2; } -- GitLab From ea81af1c30ca0555b4ee8b8861e4ee715861d4e1 Mon Sep 17 00:00:00 2001 From: hsd Date: Wed, 8 Mar 2023 22:58:40 +0100 Subject: [PATCH 189/375] [mod] unified processing of the reference vector modes with OTR_TRACKING_REF_ORIENT --- lib_rend/ivas_orient_trk.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index cf5a4b3028..918b47f232 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -537,20 +537,16 @@ ivas_error ivas_orient_trk_GetMainOrientation( case OTR_TRACKING_NONE: *pOrientation = IdentityQuaternion(); break; +#ifdef OTR_REFERENCE_VECTOR_TRACKING + case OTR_TRACKING_REF_VEC: + case OTR_TRACKING_REF_VEC_LEV: +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ case OTR_TRACKING_REF_ORIENT: *pOrientation = pOTR->refRot; break; case OTR_TRACKING_AVG_ORIENT: *pOrientation = pOTR->absAvgRot; break; -#ifdef OTR_REFERENCE_VECTOR_TRACKING - case OTR_TRACKING_REF_VEC: - *pOrientation = pOTR->refRot; - break; - case OTR_TRACKING_REF_VEC_LEV: - *pOrientation = pOTR->refRot; - break; -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ } return IVAS_ERR_OK; } @@ -587,10 +583,9 @@ ivas_error ivas_orient_trk_SetReferenceVector( switch ( pOTR->trackingType ) { + case OTR_TRACKING_NONE: case OTR_TRACKING_REF_ORIENT: case OTR_TRACKING_AVG_ORIENT: - return IVAS_ERR_WRONG_MODE; - case OTR_TRACKING_NONE: case OTR_TRACKING_REF_VEC: acousticFrontVector = VectorSubtract( listenerPos, refPos ); break; @@ -617,8 +612,7 @@ ivas_error ivas_orient_trk_SetReferenceVector( ivasForwardVector.x = -1.0f; ivasForwardVector.y = 0.0f; ivasForwardVector.z = 0.0f; - VectorRotationToQuaternion( acousticFrontVector, ivasForwardVector, &pOTR->refRot ); - + VectorRotationToQuaternion( ivasForwardVector, acousticFrontVector, &pOTR->refRot ); return IVAS_ERR_OK; } #endif /* OTR_REFERENCE_VECTOR_TRACKING */ @@ -690,7 +684,10 @@ ivas_error ivas_orient_trk_Process( case OTR_TRACKING_NONE: trkQuat = absQuat; break; - +#ifdef OTR_REFERENCE_VECTOR_TRACKING + case OTR_TRACKING_REF_VEC: + case OTR_TRACKING_REF_VEC_LEV: +#endif /* OTR_REFERENCE_VECTOR_TRACKING */ case OTR_TRACKING_REF_ORIENT: /* Reset average orientation */ pOTR->absAvgRot = absQuat; @@ -739,15 +736,6 @@ ivas_error ivas_orient_trk_Process( /* Compute filter coefficient corresponding to desired cutoff frequency */ pOTR->alpha = sinf( 2.0f * EVS_PI * cutoffFrequency / updateRate ); break; -#ifdef OTR_REFERENCE_VECTOR_TRACKING - case OTR_TRACKING_REF_VEC: - case OTR_TRACKING_REF_VEC_LEV: - { - /* This processing step of the OTR_TRACKING_REF_VEC/OTR_TRACKING_REF_VEC_LEVEL is identical */ - QuaternionProduct( pOTR->refRot, absQuat, &trkQuat ); - break; - } -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ default: result = IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Non-supported orientation tracking adaptation type" ); break; -- GitLab From 105938cc681fe183f967cc0814f0d99d918bd289 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 9 Mar 2023 08:36:34 +0100 Subject: [PATCH 190/375] editorial improvements --- lib_com/ivas_fb_mixer.c | 22 ++++++++++++++++------ lib_com/ivas_prot.h | 12 ++++++------ lib_dec/ivas_sba_dec.c | 11 +++++++++-- lib_dec/ivas_spar_decoder.c | 14 +++++++++----- lib_enc/ivas_mc_param_enc.c | 1 + lib_enc/ivas_mcmasa_enc.c | 2 ++ lib_enc/ivas_sba_enc.c | 22 ++++++++++++---------- lib_enc/ivas_spar_encoder.c | 21 +++++++++++++++------ 8 files changed, 70 insertions(+), 35 deletions(-) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 62f16bbb94..2116032627 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -177,7 +177,7 @@ ivas_error ivas_FB_mixer_open( IVAS_FB_CFG *fb_cfg /* i : FB config. handle */ #ifdef SBA_BR_SWITCHING_CLEAN_UP , - const int16_t spar_reconfig_flag + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ #endif ) { @@ -192,6 +192,7 @@ ivas_error ivas_FB_mixer_open( #ifdef SBA_BR_SWITCHING_CLEAN_UP hFbMixer = *hFbMixer_out; + if ( !spar_reconfig_flag ) { #endif @@ -214,6 +215,7 @@ ivas_error ivas_FB_mixer_open( #ifdef SBA_BR_SWITCHING_CLEAN_UP } #endif + if ( fb_cfg->active_w_mixing == -1 ) { num_chs_alloc = 0; @@ -258,6 +260,7 @@ ivas_error ivas_FB_mixer_open( { num_chs_alloc = fb_cfg->num_in_chans; } + for ( i = 0; i < num_chs_alloc; i++ ) { if ( ( hFbMixer->ppFilterbank_prior_input[i] = (float *) malloc( sizeof( float ) * fb_cfg->prior_input_length ) ) == NULL ) @@ -285,6 +288,7 @@ ivas_error ivas_FB_mixer_open( } } } + #ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { @@ -340,10 +344,12 @@ ivas_error ivas_FB_mixer_open( #ifdef SBA_BR_SWITCHING_CLEAN_UP } #endif + hFbMixer->fb_cfg = fb_cfg; #ifdef SBA_BR_SWITCHING_CLEAN_UP set_s( hFbMixer->first_frame, 1, hFbMixer->fb_cfg->num_out_chans ); set_s( hFbMixer->first_frame + hFbMixer->fb_cfg->num_out_chans, 0, IVAS_SPAR_MAX_CH - hFbMixer->fb_cfg->num_out_chans ); + if ( !spar_reconfig_flag ) { #endif @@ -354,6 +360,7 @@ ivas_error ivas_FB_mixer_open( #ifdef SBA_BR_SWITCHING_CLEAN_UP } #endif + *hFbMixer_out = hFbMixer; return error; @@ -367,11 +374,11 @@ ivas_error ivas_FB_mixer_open( *------------------------------------------------------------------------*/ void ivas_FB_mixer_close( - IVAS_FB_MIXER_HANDLE *hFbMixer_in, /* i/o: FB mixer handle */ - const int32_t sampling_rate /* i : sampling rate in Hz */ + IVAS_FB_MIXER_HANDLE *hFbMixer_in, /* i/o: FB mixer handle */ + const int32_t sampling_rate /* i : sampling rate in Hz */ #ifdef SBA_BR_SWITCHING_CLEAN_UP , - const int16_t spar_reconfig_flag + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ #endif ) { @@ -431,6 +438,7 @@ void ivas_FB_mixer_close( free( hFbMixer->prior_mixer[0][0] ); hFbMixer->prior_mixer[0][0] = NULL; } + #ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { @@ -471,11 +479,13 @@ void ivas_FB_mixer_close( #ifdef SBA_BR_SWITCHING_CLEAN_UP } #endif + if ( hFbMixer->fb_cfg != NULL ) { free( hFbMixer->fb_cfg ); hFbMixer->fb_cfg = NULL; } + #ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { @@ -847,8 +857,8 @@ static int16_t ivas_calculate_abs_fr( float short_stride_nrg = 0.0f; float cldfb_nrg = 0.0f; int16_t short_stride = pFb->fb_bin_to_band.short_stride; - const int16_t num_bins_per_short_stride_bin = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); - const int16_t num_bins_per_cldfb_band = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); + const int16_t num_bins_per_short_stride_bin = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); + const int16_t num_bins_per_cldfb_band = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); float short_stride_max_per_spar_band = 1e-9f; /*loop over all stored Filter Bank Response MDFT coefficients*/ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 361cc8e0a5..9d58810857 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3750,7 +3750,7 @@ void FdCngDecodeDiracMDCTStereoSID( ivas_error ivas_spar_enc_open( Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ #ifdef SBA_BR_SWITCHING_CLEAN_UP - ,const int16_t spar_reconfig_flag + ,const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ #endif ); @@ -3759,7 +3759,7 @@ void ivas_spar_enc_close( const int32_t input_Fs, /* i : input sampling rate */ const int16_t nchan_inp /* i : number of input channels */ #ifdef SBA_BR_SWITCHING_CLEAN_UP - ,const int16_t spar_reconfig_flag + ,const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ #endif ); @@ -3775,7 +3775,7 @@ ivas_error ivas_spar_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ #ifdef SBA_BR_SWITCHING_CLEAN_UP , - const int16_t spar_reconfig_flag + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ #endif ); @@ -3784,7 +3784,7 @@ void ivas_spar_dec_close( const int32_t output_Fs /* i : output sampling rate */ #ifdef SBA_BR_SWITCHING_CLEAN_UP , - const int16_t spar_reconfig_flag + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ #endif ); @@ -4939,7 +4939,7 @@ ivas_error ivas_FB_mixer_open( IVAS_FB_CFG *fb_cfg /* i : FB config. handle */ #ifdef SBA_BR_SWITCHING_CLEAN_UP , - const int16_t spar_reconfig_flag + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ #endif ); @@ -4948,7 +4948,7 @@ void ivas_FB_mixer_close( const int32_t sampling_rate /* i : sampling rate in Hz */ #ifdef SBA_BR_SWITCHING_CLEAN_UP , - const int16_t spar_reconfig_flag + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ #endif ); diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index ea5e2656eb..18a54132c7 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -62,11 +62,13 @@ ivas_error ivas_sba_dec_reconfigure( int16_t sba_dirac_stereo_flag_old; SBA_MODE sba_mode_old; int32_t ivas_total_brate, last_ivas_total_brate; + RENDERER_TYPE old_renderer_type; DECODER_CONFIG_HANDLE hDecoderConfig; ivas_error error; #ifdef SBA_BR_SWITCHING_CLEAN_UP int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; #endif + error = IVAS_ERR_OK; hDecoderConfig = st_ivas->hDecoderConfig; @@ -205,6 +207,7 @@ ivas_error ivas_sba_dec_reconfigure( free( st_ivas->hSpar->hPCA ); hSpar->hPCA = NULL; } + if ( nchan_transport_old != ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) ) { @@ -224,6 +227,7 @@ ivas_error ivas_sba_dec_reconfigure( return error; } } + hSpar = st_ivas->hSpar; st_ivas->sba_dirac_stereo_flag = 0; #endif @@ -298,7 +302,6 @@ ivas_error ivas_sba_dec_reconfigure( /* renderer might have changed */ intern_config_old = st_ivas->intern_config; - RENDERER_TYPE old_renderer_type; old_renderer_type = st_ivas->renderer_type; ivas_renderer_select( st_ivas ); @@ -346,10 +349,12 @@ ivas_error ivas_sba_dec_reconfigure( { ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); } + #ifdef SBA_BR_SWITCHING_CLEAN_UP if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( sba_mode_old != st_ivas->sba_mode ) || ( ( st_ivas->sba_mode == SBA_MODE_SPAR ) && ( ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) ) ) { DIRAC_CONFIG_FLAG flag_config; + flag_config = DIRAC_OPEN; if ( st_ivas->hDirAC != NULL ) { @@ -359,11 +364,13 @@ ivas_error ivas_sba_dec_reconfigure( flag_config = DIRAC_RECONFIGURE; } } + if ( ( error = ivas_dirac_dec_config( st_ivas, flag_config ) ) != IVAS_ERR_OK ) { return error; } } + if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) != IVAS_ERR_OK ) @@ -371,6 +378,7 @@ ivas_error ivas_sba_dec_reconfigure( return error; } } + if ( ( ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) ) && ( ( sba_mode_old != st_ivas->sba_mode ) && ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) ) { if ( st_ivas->hDirAC != NULL ) @@ -379,7 +387,6 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->hDirAC = NULL; } - st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 43a7bbeb8c..7515300681 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -61,10 +61,10 @@ static void ivas_spar_dec_MD( Decoder_Struct *st_ivas, Decoder_State *st0 ); *------------------------------------------------------------------------*/ ivas_error ivas_spar_dec_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ #ifdef SBA_BR_SWITCHING_CLEAN_UP , - const int16_t spar_reconfig_flag + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ #endif ) { @@ -80,6 +80,7 @@ ivas_error ivas_spar_dec_open( num_channels_internal = ivas_sba_get_nchan_metadata( sba_order_internal ); #ifdef SBA_BR_SWITCHING_CLEAN_UP hSpar = st_ivas->hSpar; + if ( !spar_reconfig_flag ) { #endif @@ -91,6 +92,7 @@ ivas_error ivas_spar_dec_open( #ifdef SBA_BR_SWITCHING_CLEAN_UP } #endif + output_Fs = st_ivas->hDecoderConfig->output_Fs; /* TD decorr. */ @@ -125,6 +127,7 @@ ivas_error ivas_spar_dec_open( { return error; } + /* AGC handle */ if ( ( error = ivas_spar_agc_dec_open( &hSpar->hAgcDec, output_Fs ) ) != IVAS_ERR_OK ) { @@ -194,11 +197,11 @@ ivas_error ivas_spar_dec_open( *------------------------------------------------------------------------*/ void ivas_spar_dec_close( - SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ - const int32_t output_Fs /* i : output sampling rate */ + SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ + const int32_t output_Fs /* i : output sampling rate */ #ifdef SBA_BR_SWITCHING_CLEAN_UP , - const int16_t spar_reconfig_flag + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ #endif ) { @@ -226,6 +229,7 @@ void ivas_spar_dec_close( free( hSpar->hPCA ); hSpar->hPCA = NULL; } + #ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 0726f5ec68..9b1241f234 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -368,6 +368,7 @@ void ivas_param_mc_enc_close( const int32_t sampling_rate ) { ivas_param_mc_metadata_close( &hParamMC->hMetadataPMC ); + #ifdef SBA_BR_SWITCHING_CLEAN_UP ivas_FB_mixer_close( &hParamMC->hFbMixer, sampling_rate, 0 ); #else diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index 02399be40a..7cae277f9a 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -220,6 +220,7 @@ ivas_error ivas_mcmasa_enc_open( { return error; } + #ifdef SBA_BR_SWITCHING_CLEAN_UP if ( ( error = ivas_FB_mixer_open( &( hMcMasa->hFbMixerLfe ), input_Fs, fb_cfgLfe, 0 ) ) != IVAS_ERR_OK ) #else @@ -469,6 +470,7 @@ void ivas_mcmasa_enc_close( free( hMcMasa->lfeAnaRingBuffer[i] ); } } + #ifdef SBA_BR_SWITCHING_CLEAN_UP ivas_FB_mixer_close( &hMcMasa->hFbMixer, input_Fs, 0 ); #else diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index 0dec59f6e2..85afc96e77 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -106,13 +106,12 @@ ivas_error ivas_sba_enc_reconfigure( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ) { - int16_t nSCE_old, nCPE_old, nchan_transport_old; + int16_t n, nSCE_old, nCPE_old, nchan_transport_old; int32_t ivas_total_brate; ivas_error error; ENCODER_CONFIG_HANDLE hEncoderConfig; error = IVAS_ERR_OK; - hEncoderConfig = st_ivas->hEncoderConfig; ivas_total_brate = hEncoderConfig->ivas_total_brate; @@ -124,23 +123,25 @@ ivas_error ivas_sba_enc_reconfigure( #ifdef SBA_HPF_TUNING_ENC int16_t analysis_order_old; #endif +#ifdef SBA_BR_SWITCHING_CLEAN_UP + int16_t spar_reconfig_flag; + spar_reconfig_flag = 0; +#endif nchan_transport_old = st_ivas->nchan_transport; nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; sba_mode_old = st_ivas->sba_mode; -#ifdef SBA_BR_SWITCHING_CLEAN_UP - int16_t spar_reconfig_flag; - spar_reconfig_flag = 0; -#endif + st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, hEncoderConfig->sba_order ); st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); #ifdef SBA_HPF_TUNING_ENC analysis_order_old = ivas_sba_get_analysis_order( hEncoderConfig->last_ivas_total_brate, hEncoderConfig->sba_order ); + if ( analysis_order_old != st_ivas->sba_analysis_order ) { - int16_t n, i, n_old; + int16_t i, n_old; float **old_mem_hp20_in; n_old = ivas_sba_get_nchan_metadata( analysis_order_old ); @@ -223,8 +224,9 @@ ivas_error ivas_sba_enc_reconfigure( ivas_spar_config( ivas_total_brate, min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->hSpar->core_nominal_brate, -1 ); + #ifdef SBA_BR_SWITCHING_CLEAN_UP - for ( int16_t n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) + for ( n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) { if ( hDirAC->sba_synchro_buffer[n] != NULL ) { @@ -328,7 +330,6 @@ ivas_error ivas_sba_enc_reconfigure( } // VE: TBV - populate 'hSpar->hFrontVad' with 'hCoreCoder[0]' instead of resetting it to init-state? - #endif } } @@ -353,7 +354,6 @@ ivas_error ivas_sba_enc_reconfigure( return error; } } - int16_t n; if ( hDirAC->num_samples_synchro_delay == 0 ) { @@ -413,6 +413,7 @@ ivas_error ivas_sba_enc_reconfigure( #endif } + ivas_dirac_enc_reconfigure( st_ivas ); if ( st_ivas->sba_mode == SBA_MODE_SPAR ) @@ -420,6 +421,7 @@ ivas_error ivas_sba_enc_reconfigure( mvs2s( hDirAC->dirac_to_spar_md_bands, hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); hSpar->enc_param_start_band = hDirAC->hConfig->enc_param_start_band; } + /*-----------------------------------------------------------------* * Allocate, initalize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 786bd29a96..b156c524d2 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -58,10 +58,10 @@ static ivas_error ivas_spar_enc_process( Encoder_Struct *st_ivas, const ENCODER_ *------------------------------------------------------------------------*/ ivas_error ivas_spar_enc_open( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ #ifdef SBA_BR_SWITCHING_CLEAN_UP , - const int16_t spar_reconfig_flag + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ #endif ) { @@ -77,6 +77,7 @@ ivas_error ivas_spar_enc_open( error = IVAS_ERR_OK; #ifdef SBA_BR_SWITCHING_CLEAN_UP hSpar = st_ivas->hSpar; + if ( !spar_reconfig_flag ) { #endif @@ -88,6 +89,7 @@ ivas_error ivas_spar_enc_open( #ifdef SBA_BR_SWITCHING_CLEAN_UP } #endif + input_Fs = hEncoderConfig->input_Fs; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); nchan_inp = ivas_sba_get_nchan_metadata( sba_order_internal ); @@ -126,6 +128,7 @@ ivas_error ivas_spar_enc_open( { return error; } + #ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { @@ -138,6 +141,7 @@ ivas_error ivas_spar_enc_open( #ifdef SBA_BR_SWITCHING_CLEAN_UP } #endif + /* initialization */ hSpar->hMdEnc->table_idx = -1; @@ -189,6 +193,7 @@ ivas_error ivas_spar_enc_open( /*-----------------------------------------------------------------* * Allocate and initialize Front-VAD handle *-----------------------------------------------------------------*/ + #ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { @@ -249,16 +254,17 @@ ivas_error ivas_spar_enc_open( *------------------------------------------------------------------------*/ void ivas_spar_enc_close( - SPAR_ENC_HANDLE hSpar, /* i/o: SPAR encoder handle */ - const int32_t input_Fs, /* i : input sampling rate */ - const int16_t nchan_inp /* i : number of input channels */ + SPAR_ENC_HANDLE hSpar, /* i/o: SPAR encoder handle */ + const int32_t input_Fs, /* i : input sampling rate */ + const int16_t nchan_inp /* i : number of input channels */ #ifdef SBA_BR_SWITCHING_CLEAN_UP , - const int16_t spar_reconfig_flag + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ #endif ) { int16_t num_chans; + if ( hSpar != NULL ) { #ifdef SBA_BR_SWITCHING_CLEAN_UP @@ -281,6 +287,7 @@ void ivas_spar_enc_close( #ifdef SBA_BR_SWITCHING_CLEAN_UP } #endif + num_chans = hSpar->hFbMixer->fb_cfg->num_in_chans; assert( num_chans <= nchan_inp ); @@ -299,6 +306,7 @@ void ivas_spar_enc_close( /* Trans Det handle */ ivas_transient_det_close( &hSpar->hTranDet ); #endif + /* AGC */ ivas_spar_agc_enc_close( &hSpar->hAgcEnc ); @@ -308,6 +316,7 @@ void ivas_spar_enc_close( free( hSpar->hPCA ); hSpar->hPCA = NULL; } + #ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { -- GitLab From 907e7767a644eb87d2de0646fd45b663d4548dd6 Mon Sep 17 00:00:00 2001 From: malenov Date: Thu, 9 Mar 2023 10:25:05 +0100 Subject: [PATCH 191/375] call update_mem() before update_wmops() due to update_cnt++ --- apps/decoder.c | 4 ++-- apps/encoder.c | 2 +- apps/renderer.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 0e246ca1ec..09f9339db9 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1573,8 +1573,8 @@ static ivas_error decodeG192( #endif } #ifdef WMOPS - update_wmops(); update_mem(); + update_wmops(); #endif } @@ -2074,8 +2074,8 @@ static ivas_error decodeVoIP( systemTime_ms += 20; #ifdef WMOPS - update_wmops(); update_mem(); + update_wmops(); #endif } diff --git a/apps/encoder.c b/apps/encoder.c index 48cdb8f4bd..5fb6100034 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -778,8 +778,8 @@ int main( } #ifdef WMOPS - update_wmops(); update_mem(); + update_wmops(); #endif } diff --git a/apps/renderer.c b/apps/renderer.c index 6a9d7ccfc3..e7088a4316 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1021,8 +1021,8 @@ int main( } #ifdef WMOPS - update_wmops(); update_mem(); + update_wmops(); #endif } -- GitLab From a72050aa3a88f21820a8063a7e0027e950e07c57 Mon Sep 17 00:00:00 2001 From: malenov Date: Thu, 9 Mar 2023 10:26:09 +0100 Subject: [PATCH 192/375] re-factor update_mem() for better clarity --- lib_debug/wmc_auto.c | 98 ++++++++++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 40 deletions(-) diff --git a/lib_debug/wmc_auto.c b/lib_debug/wmc_auto.c index 112336225f..44787af10e 100644 --- a/lib_debug/wmc_auto.c +++ b/lib_debug/wmc_auto.c @@ -1361,11 +1361,11 @@ void mem_free( const char *func_name, int func_lineno, void *ptr ) void update_mem( void ) { int i, j, flag_alloc = -1, i_record; - int32_t size_current_intra_frame_heap; + int size_current_intra_frame_heap; int *list_current_intra_frame_heap = NULL, n_items_current_intra_frame_heap; allocator_record *ptr_record; - /* process the heap allocation call tree */ + /* process the heap allocation call tree and prepare lists of intra-frame and inter-frame heap memory blocks for this frame */ n_items_current_intra_frame_heap = 0; size_current_intra_frame_heap = 0; for ( i = 0; i < heap_allocation_call_tree_size; i++ ) @@ -1393,7 +1393,7 @@ void update_mem( void ) memset( list_current_intra_frame_heap, -1, heap_allocation_call_tree_size * sizeof( int ) ); } - /* zero index doesn't have sign to determine whether it's allocated or de-allocated -> we need to search the list */ + /* zero index doesn't have sign to determine whether it's allocated or de-allocated -> we need to search the list */ if ( i_record == 0 ) { flag_alloc = 1; @@ -1413,23 +1413,7 @@ void update_mem( void ) list_current_intra_frame_heap[n_items_current_intra_frame_heap++] = i_record; size_current_intra_frame_heap += ptr_record->block_size; - /* check, if this is the new worst-case */ - if ( size_current_intra_frame_heap > size_wc_intra_frame_heap ) - { - if ( n_items_current_intra_frame_heap >= max_items_wc_intra_frame_heap ) - { - /* resize list, if needed */ - max_items_wc_intra_frame_heap = n_items_current_intra_frame_heap + MAX_NUM_RECORDS_REALLOC_STEP; - list_wc_intra_frame_heap = realloc( list_wc_intra_frame_heap, max_items_wc_intra_frame_heap * sizeof( int ) ); - } - - /* save to wc list */ - memmove( list_wc_intra_frame_heap, list_current_intra_frame_heap, n_items_current_intra_frame_heap * sizeof( int ) ); - n_items_wc_intra_frame_heap = n_items_current_intra_frame_heap; - size_wc_intra_frame_heap = size_current_intra_frame_heap; - location_wc_intra_frame_heap = update_cnt; - ptr_record->wc_heap_size_intra_frame = ptr_record->block_size; - } + /* no need to re-size the list -> the initially allocated size should be large enough */ } else { @@ -1480,23 +1464,6 @@ void update_mem( void ) list_current_inter_frame_heap[n_items_current_inter_frame_heap++] = i_record; size_current_inter_frame_heap += ptr_record->block_size; - - /* check, if this is the new worst-case */ - if ( size_current_inter_frame_heap > size_wc_inter_frame_heap ) - { - if ( n_items_current_inter_frame_heap >= max_items_wc_inter_frame_heap ) - { - /* resize list, if needed */ - max_items_wc_inter_frame_heap = n_items_current_inter_frame_heap + MAX_NUM_RECORDS_REALLOC_STEP; - list_wc_inter_frame_heap = realloc( list_wc_inter_frame_heap, max_items_wc_inter_frame_heap * sizeof( int ) ); - } - - memmove( list_wc_inter_frame_heap, list_current_inter_frame_heap, n_items_current_inter_frame_heap * sizeof( int ) ); - n_items_wc_inter_frame_heap = n_items_current_inter_frame_heap; - size_wc_inter_frame_heap = size_current_inter_frame_heap; - location_wc_inter_frame_heap = update_cnt; - ptr_record->wc_heap_size_inter_frame = ptr_record->block_size; - } } else { @@ -1519,9 +1486,60 @@ void update_mem( void ) } } + /* check, if this is the new worst-case for intra-frame heap memory */ + if ( size_current_intra_frame_heap > size_wc_intra_frame_heap ) + { + if ( n_items_current_intra_frame_heap >= max_items_wc_intra_frame_heap ) + { + /* resize the list, if needed */ + max_items_wc_intra_frame_heap = n_items_current_intra_frame_heap + MAX_NUM_RECORDS_REALLOC_STEP; + list_wc_intra_frame_heap = realloc( list_wc_intra_frame_heap, max_items_wc_intra_frame_heap * sizeof( int ) ); + } + + /* copy current-frame list to worst-case list */ + memmove( list_wc_intra_frame_heap, list_current_intra_frame_heap, n_items_current_intra_frame_heap * sizeof( int ) ); + n_items_wc_intra_frame_heap = n_items_current_intra_frame_heap; + size_wc_intra_frame_heap = size_current_intra_frame_heap; + location_wc_intra_frame_heap = update_cnt; + + /* update the wc numbers in all individual records */ + for ( i = 0; i < n_items_wc_intra_frame_heap; i++ ) + { + i_record = list_wc_intra_frame_heap[i]; + ptr_record = &( allocation_list[i_record] ); + ptr_record->wc_heap_size_intra_frame = ptr_record->block_size; + } + } + + /* check, if this is the new worst-case for inter-frame heap memory */ + if ( size_current_inter_frame_heap > size_wc_inter_frame_heap ) + { + if ( n_items_current_inter_frame_heap >= max_items_wc_inter_frame_heap ) + { + /* resize list, if needed */ + max_items_wc_inter_frame_heap = n_items_current_inter_frame_heap + MAX_NUM_RECORDS_REALLOC_STEP; + list_wc_inter_frame_heap = realloc( list_wc_inter_frame_heap, max_items_wc_inter_frame_heap * sizeof( int ) ); + } + + /* copy current-frame list to worst-case list */ + memmove( list_wc_inter_frame_heap, list_current_inter_frame_heap, n_items_current_inter_frame_heap * sizeof( int ) ); + n_items_wc_inter_frame_heap = n_items_current_inter_frame_heap; + size_wc_inter_frame_heap = size_current_inter_frame_heap; + location_wc_inter_frame_heap = update_cnt; + + /* update the wc numbers in all individual records */ + for ( i = 0; i < n_items_wc_inter_frame_heap; i++ ) + { + i_record = list_wc_inter_frame_heap[i]; + ptr_record = &( allocation_list[i_record] ); + ptr_record->wc_heap_size_inter_frame = ptr_record->block_size; + } + } + /* reset heap allocation call tree */ heap_allocation_call_tree_size = 0; + /* de-allocate list of intra-frame heap memory blocks in the current fraeme - it's needed only inside this function */ if ( list_current_intra_frame_heap ) { free( list_current_intra_frame_heap ); @@ -1665,7 +1683,7 @@ static void mem_count_summary( void ) continue; } ptr_record = &( allocation_list[index_record] ); - ptr_record->noccurances = 1; /* reset the counter because som blocks may be both, intra-frame and inter-frame */ + ptr_record->noccurances = 1; /* reset the counter as some blocks may have been both, intra-frame and inter-frame */ for ( j = i + 1; j < n_items_wc_inter_frame_heap; j++ ) { index = list_wc_inter_frame_heap[j]; @@ -1684,7 +1702,7 @@ static void mem_count_summary( void ) } /* Print Header */ - sprintf( buf, format_str, "Function Name", "Line", "Type", "Function Parameters", "Maximum Size", "Usage" ); + sprintf( buf, format_str, "Function Name", "Line", "Type", "Function Parameters", "Memory Size", "Usage" ); puts( buf ); length = strlen( buf ); sprintf( buf, "%0*d\n", (int) length - 1, 0 ); @@ -1719,7 +1737,7 @@ static void mem_count_summary( void ) sprintf( line_str, "%d", ptr_record->lineno ); /* prepare average usage & memory size strings */ - sprintf( usage_str, "%d%%", (int) ( ( (float) ptr_record->total_used_size / ( ptr_record->total_block_size + 1 ) ) * 100.0f ) ); + sprintf( usage_str, "%d%%", (int) ( ( (float) ptr_record->total_used_size / ( ptr_record->total_block_size + 0.1f ) ) * 100.0f + 0.5f ) ); if ( ptr_record->noccurances > 1 ) { -- GitLab From a39e0f1f7e2642ae675d492d62904d18553b3c3c Mon Sep 17 00:00:00 2001 From: szczerba Date: Thu, 9 Mar 2023 10:54:10 +0100 Subject: [PATCH 193/375] QuatToRotMat update correction (wrong input mode) --- lib_rend/ivas_rotation.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 52858fdb80..8f236a64c8 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -122,25 +122,17 @@ void QuatToRotMat( float s1, s2, s3, c1, c2, c3; #ifdef FIX_I109_ORIENTATION_TRACKING - c1 = cosf( quat.z / _180_OVER_PI ); - c2 = cosf( quat.y / _180_OVER_PI ); - c3 = cosf( quat.x / _180_OVER_PI ); + Rmat[0][0] = quat.w * quat.w + quat.x * quat.x - quat.y * quat.y - quat.z * quat.z; + Rmat[0][1] = 2.0f * ( quat.x * quat.y - quat.w * quat.z ); + Rmat[0][2] = 2.0f * ( quat.x * quat.z + quat.w * quat.y ); - s1 = sinf( quat.z / _180_OVER_PI ); - s2 = sinf( -quat.y / _180_OVER_PI ); - s3 = sinf( quat.x / _180_OVER_PI ); + Rmat[1][0] = 2.0f * ( quat.x * quat.y + quat.w * quat.z ); + Rmat[1][1] = quat.w * quat.w - quat.x * quat.x + quat.y * quat.y - quat.z * quat.z; + Rmat[1][2] = 2.0f * ( quat.y * quat.z - quat.w * quat.x ); - Rmat[0][0] = c2 * c3; - Rmat[0][1] = -c2 * s3; - Rmat[0][2] = s2; - - Rmat[1][0] = c1 * s3 + c3 * s1 * s2; - Rmat[1][1] = c1 * c3 - s1 * s2 * s3; - Rmat[1][2] = -c2 * s1; - - Rmat[2][0] = s1 * s3 - c1 * c3 * s2; - Rmat[2][1] = c3 * s1 + c1 * s2 * s3; - Rmat[2][2] = c1 * c2; + Rmat[2][0] = 2.0f * ( quat.x * quat.z - quat.w * quat.y ); + Rmat[2][1] = 2.0f * ( quat.y * quat.z + quat.w * quat.x ); + Rmat[2][2] = quat.w * quat.w - quat.x * quat.x - quat.y * quat.y + quat.z * quat.z; #else #ifdef DEBUGGING -- GitLab From 7546d0553cf364f881275a15ccd7e695623ea3e9 Mon Sep 17 00:00:00 2001 From: szczerba Date: Thu, 9 Mar 2023 10:57:20 +0100 Subject: [PATCH 194/375] Unused variables cleanup --- lib_rend/ivas_rotation.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 8f236a64c8..f1bbabdab1 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -119,8 +119,6 @@ void QuatToRotMat( float Rmat[3][3] /* o : real-space rotation matrix for this rotation */ ) { - float s1, s2, s3, c1, c2, c3; - #ifdef FIX_I109_ORIENTATION_TRACKING Rmat[0][0] = quat.w * quat.w + quat.x * quat.x - quat.y * quat.y - quat.z * quat.z; Rmat[0][1] = 2.0f * ( quat.x * quat.y - quat.w * quat.z ); @@ -134,6 +132,7 @@ void QuatToRotMat( Rmat[2][1] = 2.0f * ( quat.y * quat.z + quat.w * quat.x ); Rmat[2][2] = quat.w * quat.w - quat.x * quat.x - quat.y * quat.y + quat.z * quat.z; #else + float s1, s2, s3, c1, c2, c3; #ifdef DEBUGGING /* PrintQuat( quat ); */ -- GitLab From c7cc7d9a5216ce6ee24a431936a028aace6d78e3 Mon Sep 17 00:00:00 2001 From: szczerba Date: Thu, 9 Mar 2023 11:04:45 +0100 Subject: [PATCH 195/375] Missing assignment --- lib_rend/ivas_orient_trk.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index bc685c704a..49748ae85b 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -752,6 +752,10 @@ ivas_error ivas_orient_trk_Process( break; } + if ( result == IVAS_ERR_OK ) + { + *pTrkRot = pOTR->trkRot; + } return result; } #else -- GitLab From 718f59c918aade943e9695ff27345edfc4e13479 Mon Sep 17 00:00:00 2001 From: szczerba Date: Thu, 9 Mar 2023 11:23:55 +0100 Subject: [PATCH 196/375] Euler to quaternion conversion moved out of orientation tracking processing --- lib_dec/lib_dec.c | 10 ++++++++++ lib_rend/ivas_orient_trk.c | 25 +++++++------------------ lib_rend/lib_rend.c | 19 ++++++++++++++++--- 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index ab81c62206..faf2ddc204 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -906,7 +906,11 @@ ivas_error IVAS_DEC_FeedHeadTrackData( HEAD_TRACK_DATA_HANDLE hHeadTrackData; int16_t i; +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || orientation == NULL ) +#else if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) +#endif { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -922,6 +926,12 @@ ivas_error IVAS_DEC_FeedHeadTrackData( for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { #ifdef FIX_I109_ORIENTATION_TRACKING + /* check for Euler angle signaling */ + if ( orientation[i].w == -3.0f ) + { + Euler2Quat( deg2rad( orientation[i].x ), deg2rad( orientation[i].y ), deg2rad( orientation[i].z ), &orientation[i] ); + } + ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, orientation[i], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hHeadTrackData->Quaternions[i] ); #else hHeadTrackData->Quaternions[i].w = orientation[i].w; diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 49748ae85b..f8eaca2e23 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -665,56 +665,45 @@ ivas_error ivas_orient_trk_Process( float alpha = pOTR->alpha; float ang; ivas_error result; - IVAS_QUATERNION absQuat; if ( pOTR == NULL || pTrkRot == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - /* check for Euler angle signaling */ - if ( absRot.w == -3.0f ) - { - Euler2Quat( deg2rad( absRot.x ), deg2rad( absRot.y ), deg2rad( absRot.z ), &absQuat ); - } - else - { - absQuat = absRot; - } - result = IVAS_ERR_OK; switch ( pOTR->trackingType ) { case OTR_TRACKING_NONE: - pOTR->trkRot = absQuat; + pOTR->trkRot = absRot; break; case OTR_TRACKING_REF_ORIENT: /* Reset average orientation */ - pOTR->absAvgRot = absQuat; + pOTR->absAvgRot = absRot; /* Reset adaptation filter - start adaptation at center rate */ pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate ); /* Compute relative orientation = (absolute orientation) - (reference orientation) */ QuaternionInverse( pOTR->refRot, &pOTR->trkRot ); - QuaternionProduct( pOTR->trkRot, absQuat, &pOTR->trkRot ); + QuaternionProduct( pOTR->trkRot, absRot, &pOTR->trkRot ); break; case OTR_TRACKING_AVG_ORIENT: /* Compute average (low-pass filtered) absolute orientation */ - QuaternionSlerp( pOTR->absAvgRot, absQuat, alpha, &pOTR->absAvgRot ); + QuaternionSlerp( pOTR->absAvgRot, absRot, alpha, &pOTR->absAvgRot ); /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */ QuaternionInverse( pOTR->absAvgRot, &pOTR->trkRot ); - QuaternionProduct( pOTR->trkRot, absQuat, &pOTR->trkRot ); + QuaternionProduct( pOTR->trkRot, absRot, &pOTR->trkRot ); /* Adapt LPF constant based on orientation excursion relative to current mean: - low cutoff (slow adaptation) for small excursions (around center) - high cutoff (fast adaptation) for large excursions (off-center) */ - ang = QuaternionAngle( absQuat, pOTR->trkRot ); + ang = QuaternionAngle( absRot, pOTR->trkRot ); normalizedOrientation = ang * ang; relativeOrientationRate = sqrtf( normalizedOrientation ) / pOTR->adaptationAngle; @@ -743,7 +732,7 @@ ivas_error ivas_orient_trk_Process( case OTR_TRACKING_REF_VEC_LEV: { /* This processing step of the OTR_TRACKING_REF_VEC/OTR_TRACKING_REF_VEC_LEVEL is identical */ - QuaternionProduct( pOTR->refRot, absQuat, &pOTR->trkRot ); + QuaternionProduct( pOTR->refRot, absRot, &pOTR->trkRot ); break; } #endif /* OTR_REFERENCE_VECTOR_TRACKING */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 7e0b2997bc..dc8fe6f510 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3017,7 +3017,7 @@ static IVAS_REND_InputId makeInputId( /* Put config type in second byte (from LSB), put index + 1 in first byte * * Index is incremented here so that a valid ID can never be 0. */ - return (IVAS_REND_InputId) ( ( ( (uint32_t) getAudioConfigType( config ) ) << 8 ) | ( inputIndex + 1 ) ); + return ( IVAS_REND_InputId )( ( ( (uint32_t) getAudioConfigType( config ) ) << 8 ) | ( inputIndex + 1 ) ); } static ivas_error getInputById( @@ -3642,7 +3642,7 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsMasa[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { - latency_ns = NS2SA( hIvasRend->sampleRateOut, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); + latency_ns = NS2SA( hIvasRend->sampleRateOut, ( int32_t )( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); max_latency_ns = max( max_latency_ns, latency_ns ); } } @@ -3967,6 +3967,9 @@ ivas_error IVAS_REND_SetHeadRotation( ) { int16_t i; +#ifdef FIX_I109_ORIENTATION_TRACKING + IVAS_QUATERNION rotQuat; +#endif /*-----------------------------------------------------------------* * Validate function arguments @@ -3993,7 +3996,17 @@ ivas_error IVAS_REND_SetHeadRotation( for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) { #ifdef FIX_I109_ORIENTATION_TRACKING - ivas_orient_trk_Process( hIvasRend->headRotData.hOrientationTracker, headRot[i], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hIvasRend->headRotData.headPositions[i] ); + /* check for Euler angle signaling */ + if ( headRot[i].w == -3.0f ) + { + Euler2Quat( deg2rad( headRot[i].x ), deg2rad( headRot[i].y ), deg2rad( headRot[i].z ), &rotQuat ); + } + else + { + rotQuat = headRot[i]; + } + + ivas_orient_trk_Process( hIvasRend->headRotData.hOrientationTracker, rotQuat, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hIvasRend->headRotData.headPositions[i] ); #else hIvasRend->headRotData.headPositions[i] = headRot[i]; #endif -- GitLab From 655369fb1de135c9d64afefabe80dc925aa312bb Mon Sep 17 00:00:00 2001 From: rhb Date: Thu, 9 Mar 2023 11:35:41 +0100 Subject: [PATCH 197/375] fix crashes for 1 TC modes with DTX --- lib_dec/ivas_sce_dec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index ac948a59c4..c95701edac 100755 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -364,7 +364,11 @@ ivas_error create_sce_dec( return error; } +#ifdef SBA2MONO + if ( st_ivas->ivas_format == SBA_FORMAT && ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) ) ) +#else if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) +#endif { if ( ( error = openCldfb( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) { -- GitLab From 7f797b83dc8e2185955d585bff871c344764778d Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 9 Mar 2023 11:57:57 +0100 Subject: [PATCH 198/375] limit the DTX usage in background noise to lower bitrates similarly as in other IVAS formats; under FIX_DTX_BRATE_LIMIT --- lib_com/ivas_prot.h | 3 +++ lib_com/options.h | 2 +- lib_enc/ivas_ism_dtx_enc.c | 25 +++++++++++++++++++++++-- lib_enc/ivas_ism_enc.c | 4 ++++ 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 05d8c65021..e3fcf0696d 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -923,6 +923,9 @@ ivas_error ivas_ism_dtx_open( int16_t ivas_ism_dtx_enc( ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ +#ifdef FIX_DTX_BRATE_LIMIT + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ +#endif const int16_t num_obj, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ diff --git a/lib_com/options.h b/lib_com/options.h index 4f1a1d42ba..fdfd92f70a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,7 +170,7 @@ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ - +#define FIX_DTX_BRATE_LIMIT /* VA: limit the DTX usage in background noise to lower bitrates similarly as in other IVAS formats */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 0dc1cce8a8..93c45d6eea 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -105,8 +105,11 @@ ivas_error ivas_ism_dtx_open( /*! r: indication of DTX frame */ int16_t ivas_ism_dtx_enc( - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ +#ifdef FIX_DTX_BRATE_LIMIT + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ +#endif const int16_t num_obj, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ @@ -119,6 +122,9 @@ int16_t ivas_ism_dtx_enc( int16_t nBits, nBits_MD_max; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; float lp_noise[MAX_NUM_OBJECTS], lp_noise_variation, lp_noise_mean; +#ifdef FIX_DTX_BRATE_LIMIT + float lp_noise_max; +#endif float tmp1, tmp2; /* initialization */ @@ -153,6 +159,21 @@ int16_t ivas_ism_dtx_enc( dtx_flag = 0; } + +#ifdef FIX_DTX_BRATE_LIMIT + /* default DTX is applied at lower bitrates; otherwise DTX is applied only in silence */ + maximum( lp_noise, num_obj, &lp_noise_max ); + + if ( !( ( num_obj == 1 && ivas_total_brate <= IVAS_24k4 ) || + ( num_obj == 2 && ivas_total_brate <= IVAS_48k ) || + ( num_obj == 3 && ivas_total_brate <= IVAS_80k ) || + ( num_obj == 4 && ivas_total_brate <= IVAS_96k ) || + lp_noise_max < 15 ) ) + { + dtx_flag = 0; + } +#endif + /*------------------------------------------------------------------* * Reset the bitstream *-----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index ae55f4879c..f51db8ceb6 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -225,7 +225,11 @@ ivas_error ivas_ism_enc( /* analysis and decision about DTX */ #ifdef DISCRETE_ISM_DTX_CNG +#ifdef FIX_DTX_BRATE_LIMIT + dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->hEncoderConfig->ivas_total_brate, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); +#else dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); +#endif #else dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); #endif -- GitLab From 1968f2420b166a60528ac31ab49cf291c4f45f45 Mon Sep 17 00:00:00 2001 From: rhb Date: Thu, 9 Mar 2023 12:15:30 +0100 Subject: [PATCH 199/375] fix msan error --- lib_dec/ivas_dec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index ede1af7dfc..e6683ffed1 100755 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -308,7 +308,11 @@ ivas_error ivas_dec( nchan_remapped = st_ivas->nchan_transport; if ( st_ivas->sba_dirac_stereo_flag ) { +#ifdef SBA2MONO + nchan_remapped = nchan_out; +#else nchan_remapped = CPE_CHANNELS; +#endif if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { -- GitLab From dd65968e163b12850597bccd5459994eeba8e8b6 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 9 Mar 2023 12:46:49 +0100 Subject: [PATCH 200/375] - fix compilation warning when SBA_BR_SWITCHING_CLEAN_UP is disabled - clean out remaining ToDo comments --- lib_enc/ivas_sba_enc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index 85afc96e77..8513745435 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -106,7 +106,10 @@ ivas_error ivas_sba_enc_reconfigure( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ) { - int16_t n, nSCE_old, nCPE_old, nchan_transport_old; +#ifdef SBA_BR_SWITCHING_CLEAN_UP + int16_t n; +#endif + int16_t nSCE_old, nCPE_old, nchan_transport_old; int32_t ivas_total_brate; ivas_error error; ENCODER_CONFIG_HANDLE hEncoderConfig; @@ -218,8 +221,6 @@ ivas_error ivas_sba_enc_reconfigure( { return error; } - - // VE: TBV - populate 'hSpar->hFrontVad' with 'hCoreCoder[0]' instead of resetting it to init-state? } ivas_spar_config( ivas_total_brate, min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), @@ -259,13 +260,11 @@ ivas_error ivas_sba_enc_reconfigure( hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; } - /*TODO : Verify if full SPAR close and open can be used instead of submodules close and open */ if ( ( sba_mode_old != st_ivas->sba_mode ) || ( nchan_transport_old != st_ivas->nchan_transport ) ) { /* FB mixer handle */ if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { - // VE: TBV whether 'hFbMixer' can be reused if ( hDirAC->hFbMixer != NULL ) { #ifndef SBA_BR_SWITCHING_CLEAN_UP @@ -278,7 +277,6 @@ ivas_error ivas_sba_enc_reconfigure( if ( sba_mode_old == SBA_MODE_SPAR ) { - // VE: dirty patch -> reconfiguration of SPAR MD, TD_decorr, FbMixer modules should be used instead !! #ifndef SBA_BR_SWITCHING_CLEAN_UP IVAS_FB_CFG *fb_cfg; int16_t nchan_internal, sba_order_internal; @@ -328,8 +326,6 @@ ivas_error ivas_sba_enc_reconfigure( { return error; } - - // VE: TBV - populate 'hSpar->hFrontVad' with 'hCoreCoder[0]' instead of resetting it to init-state? #endif } } -- GitLab From 4ec0b4493247fa575a35312ca7d429d5aa905a32 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 9 Mar 2023 12:47:51 +0100 Subject: [PATCH 201/375] clang format --- lib_com/ivas_fb_mixer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 2116032627..a141b761d3 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -857,8 +857,8 @@ static int16_t ivas_calculate_abs_fr( float short_stride_nrg = 0.0f; float cldfb_nrg = 0.0f; int16_t short_stride = pFb->fb_bin_to_band.short_stride; - const int16_t num_bins_per_short_stride_bin = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); - const int16_t num_bins_per_cldfb_band = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); + const int16_t num_bins_per_short_stride_bin = ( const int16_t ) ( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); + const int16_t num_bins_per_cldfb_band = ( const int16_t ) ( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); float short_stride_max_per_spar_band = 1e-9f; /*loop over all stored Filter Bank Response MDFT coefficients*/ -- GitLab From 37e426f053028396d28cab44c240a348999a5186 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 9 Mar 2023 12:54:05 +0100 Subject: [PATCH 202/375] clang format --- lib_com/ivas_fb_mixer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index a141b761d3..c3389288de 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -857,8 +857,8 @@ static int16_t ivas_calculate_abs_fr( float short_stride_nrg = 0.0f; float cldfb_nrg = 0.0f; int16_t short_stride = pFb->fb_bin_to_band.short_stride; - const int16_t num_bins_per_short_stride_bin = ( const int16_t ) ( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); - const int16_t num_bins_per_cldfb_band = ( const int16_t ) ( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); + const int16_t num_bins_per_short_stride_bin = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); + const int16_t num_bins_per_cldfb_band = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); float short_stride_max_per_spar_band = 1e-9f; /*loop over all stored Filter Bank Response MDFT coefficients*/ -- GitLab From 1a55422e5ee08742f78f39bbe7825fbdff5c0087 Mon Sep 17 00:00:00 2001 From: rhb Date: Thu, 9 Mar 2023 14:00:40 +0100 Subject: [PATCH 203/375] fix crashes in rate switching modes --- lib_dec/ivas_corecoder_dec_reconfig.c | 4 ++++ 1 file changed, 4 insertions(+) mode change 100644 => 100755 lib_dec/ivas_corecoder_dec_reconfig.c diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c old mode 100644 new mode 100755 index bb2b753181..7b91755b70 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -513,7 +513,11 @@ ivas_error ivas_cldfb_dec_reconfig( } } /* CLDFB Interpolation weights */ +#ifdef SBA2MONO + if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( numCldfbAnalyses_old != numCldfbAnalyses || numCldfbSyntheses_old != numCldfbSyntheses || nchan_transport_old != st_ivas->nchan_transport ) && numCldfbAnalyses != 0 && numCldfbSyntheses != 0 ) +#else if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( numCldfbAnalyses_old != numCldfbAnalyses || numCldfbSyntheses_old != numCldfbSyntheses || nchan_transport_old != st_ivas->nchan_transport ) ) +#endif { ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); } -- GitLab From 7b4d489f17fba5c6386f2413708afd021c817000 Mon Sep 17 00:00:00 2001 From: malenov Date: Thu, 9 Mar 2023 14:09:04 +0100 Subject: [PATCH 204/375] print 0 instead of 107374.182 in the WMOPS printout when update_cnt is 0 --- lib_debug/wmc_auto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_debug/wmc_auto.c b/lib_debug/wmc_auto.c index 44787af10e..141052e5bd 100644 --- a/lib_debug/wmc_auto.c +++ b/lib_debug/wmc_auto.c @@ -381,7 +381,7 @@ void print_wmops( void ) } fprintf( stdout, sfmts, "---------------", "------", "------", "------", "------" ); - fprintf( stdout, dfmts, "total", (float) update_cnt, FAC * min_cnt, FAC * max_cnt, update_cnt == 0 ? 0 : FAC * ops_cnt / update_cnt ); + fprintf( stdout, dfmts, "total", (float) update_cnt, update_cnt == 0 ? 0 : FAC * min_cnt, FAC * max_cnt, update_cnt == 0 ? 0 : FAC * ops_cnt / update_cnt ); fprintf( stdout, "\n" ); #ifdef WMOPS_WC_FRAME_ANALYSIS -- GitLab From b3afc6c18370aaf5cf2e7253f27a0bbf83c42394 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 9 Mar 2023 14:38:06 +0100 Subject: [PATCH 205/375] review of error returns --- lib_com/ivas_prot.h | 2 +- lib_dec/ivas_dec.c | 10 +- lib_dec/ivas_mct_dec.c | 9 +- lib_dec/ivas_objectRenderer_internal.c | 19 +- lib_rend/ivas_crend.c | 31 +- lib_rend/ivas_objectRenderer.c | 69 ++-- lib_rend/ivas_orient_trk.c | 23 +- lib_rend/ivas_prot_rend.h | 16 +- lib_rend/lib_rend.c | 416 ++++++++++++++----------- 9 files changed, 346 insertions(+), 249 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b82a97dd03..0ca55b5a6c 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4930,7 +4930,7 @@ ivas_error ivas_td_binaural_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -void ivas_td_binaural_renderer( +ivas_error ivas_td_binaural_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index de8dde9828..ca4666ae76 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -215,7 +215,10 @@ ivas_error ivas_dec( /* Binaural rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { - ivas_td_binaural_renderer( st_ivas, output, output_frame ); + if ( ( ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { @@ -451,7 +454,10 @@ ivas_error ivas_dec( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { - ivas_td_binaural_renderer( st_ivas, output, output_frame ); + if ( ( ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } ivas_binaural_add_LFE( st_ivas, output_frame, output ); } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 681f3bd363..332455974c 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -671,13 +671,14 @@ ivas_error ivas_mc_dec_config( *-------------------------------------------------------------------------*/ static ivas_error ivas_mc_dec_reconfig( - Decoder_Struct *st_ivas /* i/o: IVAS encoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { int16_t nchan_transport_old, nSCE_old, nCPE_old, sba_dirac_stereo_flag_old, nchan_hp20_old; int16_t numCldfbAnalyses_old, numCldfbSyntheses_old; int32_t new_brate_SCE, new_brate_CPE, ivas_total_brate; RENDERER_TYPE renderer_type_old; + Decoder_State *st; ivas_error error; MC_MODE mc_mode, last_mc_mode; @@ -877,7 +878,7 @@ static ivas_error ivas_mc_dec_reconfig( set correct mct_chan_mode and init missing static mem (IGF, HQ) and some config (TNS) do it here since it is _very_ MC specific */ if ( last_mc_mode == MC_MODE_MCT && st_ivas->mc_mode == MC_MODE_PARAMMC && st_ivas->nchan_transport > CPE_CHANNELS ) { - Decoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1]; + st = st_ivas->hCPE[1]->hCoreCoder[1]; if ( st_ivas->nchan_transport == 3 ) { @@ -927,7 +928,7 @@ static ivas_error ivas_mc_dec_reconfig( #ifdef DEBUGGING assert( st_ivas->hCPE[1] != NULL ); #endif - Decoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1]; + st = st_ivas->hCPE[1]->hCoreCoder[1]; st->mct_chan_mode = MCT_CHAN_MODE_LFE; st->hTcxCfg->fIsTNSAllowed = 0; } @@ -957,7 +958,7 @@ static ivas_error ivas_mc_dec_reconfig( if ( last_mc_mode == MC_MODE_MCT && st_ivas->mc_mode == MC_MODE_PARAMMC && st_ivas->nchan_transport > CPE_CHANNELS ) { - Decoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1]; + st = st_ivas->hCPE[1]->hCoreCoder[1]; /* TCX-LTP */ if ( st->hTcxLtpDec == NULL ) diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 09db6fabfb..8780b4ea98 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -65,26 +65,27 @@ ivas_error ivas_td_binaural_open( * and renders the current frame. *---------------------------------------------------------------------*/ -void ivas_td_binaural_renderer( +ivas_error ivas_td_binaural_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ ) { + return ivas_td_binaural_renderer_unwrap( #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND - ivas_td_binaural_renderer_unwrap( st_ivas->hReverb, + st_ivas->hReverb, #else - ivas_td_binaural_renderer_unwrap( st_ivas->hRenderConfig, st_ivas->ini_frame, + st_ivas->hRenderConfig, st_ivas->ini_frame, #ifdef FIX_197_CREND_INTERFACE - st_ivas->hCrendWrapper, + st_ivas->hCrendWrapper, #else - st_ivas->hCrend, + st_ivas->hCrend, #endif #endif - st_ivas->transport_config, + st_ivas->transport_config, #ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND - st_ivas->hDecoderConfig->output_Fs, + st_ivas->hDecoderConfig->output_Fs, #endif - st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, - st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, output, output_frame ); + st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, + st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, output, output_frame ); } diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 00a8d4a135..caf9a562d5 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1400,10 +1400,12 @@ static ivas_error ivas_rend_initCrend( { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Encountered unsupported input config in Crend" ); } + if ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Encountered unsupported output type in Crend" ); } + if ( hHrtf == NULL ) { if ( ivas_hrtf_open( &hHrtf ) != IVAS_ERR_OK ) @@ -1903,14 +1905,17 @@ ivas_error ivas_rend_initCrendWrapper( CREND_WRAPPER_HANDLE *pCrend ) { int16_t i; + if ( pCrend == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer handle" ); } + if ( ( *pCrend = (CREND_WRAPPER_HANDLE) malloc( sizeof( CREND_WRAPPER ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); } + ( *pCrend )->binaural_latency_ns = 0; ( *pCrend )->hCrend = NULL; ( *pCrend )->hHrtfCrend = NULL; @@ -2173,6 +2178,7 @@ ivas_error ivas_rend_openCrend( #else pCrend->hCrend = hCrend; #endif + return IVAS_ERR_OK; } @@ -2355,9 +2361,17 @@ static ivas_error ivas_rend_crendConvolver( float *pFreq_filt_re, *pFreq_filt_im; float pOut[L_FRAME48k * 2]; float tmp_out_re[L_FRAME48k], tmp_out_im[L_FRAME48k]; + ivas_error error; + + if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) + { + return error; + } - getAudioConfigNumChannels( inConfig, &nchan_in ); - getAudioConfigNumChannels( outConfig, &nchan_out ); + if ( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) + { + return error; + } subframe_length = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES; @@ -2528,7 +2542,11 @@ ivas_error ivas_rend_crendProcess( #endif inConfigType = getAudioConfigType( inRendConfig ); - getAudioConfigNumChannels( outRendConfig, &nchan_out ); + + if ( ( error = getAudioConfigNumChannels( outRendConfig, &nchan_out ) ) != IVAS_ERR_OK ) + { + return error; + } output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); #ifdef FIX_197_CREND_INTERFACE @@ -2554,7 +2572,12 @@ ivas_error ivas_rend_crendProcess( /* get current subframe quaternion and convert to euler angles */ Quat2Euler( hHeadTrackData->Quaternions[subframe_idx], &( pCrend->hCrend->m_fYaw ), &( pCrend->hCrend->m_fPitch ), &( pCrend->hCrend->m_fRoll ) ); ivas_orient_trk_SetAbsoluteOrientation( pCrend->hCrend->hTrack, pCrend->hCrend->m_fYaw, pCrend->hCrend->m_fPitch, pCrend->hCrend->m_fRoll ); - ivas_orient_trk_Process( pCrend->hCrend->hTrack ); + + if ( ( error = ivas_orient_trk_Process( pCrend->hCrend->hTrack ) ) != IVAS_ERR_OK ) + { + return error; + } + ivas_orient_trk_GetTrackedOrientation( pCrend->hCrend->hTrack, &( pCrend->hCrend->m_fYaw ), &( pCrend->hCrend->m_fPitch ), &( pCrend->hCrend->m_fRoll ) ); } diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 57390d3f91..a8be0b5ba3 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -102,10 +102,16 @@ ivas_error ivas_td_binaural_open_unwrap( pBinRendTd->TdRend_MixSpatSpec_p->UseCommonDistAttenModel = TRUE; pBinRendTd->TdRend_MixSpatSpec_p->DistAttenModel = 0; /* 0=Turned off, else use TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED */ - TDREND_MIX_Init( pBinRendTd, hHrtfTD, pBinRendTd->TdRend_MixSpatSpec_p, output_Fs ); + if ( ( error = TDREND_MIX_Init( pBinRendTd, hHrtfTD, pBinRendTd->TdRend_MixSpatSpec_p, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } /* Set the attenuation (or can set MixSpatSpec.DistAttenModel above) */ - TDREND_MIX_SetDistAttenModel( pBinRendTd, TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED ); + if ( ( error = TDREND_MIX_SetDistAttenModel( pBinRendTd, TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED ) ) != IVAS_ERR_OK ) + { + return error; + } /* Add sources to module and mixer, headphones */ PosType = TDREND_POSTYPE_ABSOLUTE; /* or TDREND_POSTYPE_RELATIVE_TO_LISTENER */ @@ -220,7 +226,7 @@ void ivas_td_binaural_close( * Call ivas_td_binaural_renderer() without st_ivas. *---------------------------------------------------------------------*/ -void ivas_td_binaural_renderer_unwrap( +ivas_error ivas_td_binaural_renderer_unwrap( #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND REVERB_HANDLE hReverb, /* i : reverb handle */ #else @@ -250,6 +256,7 @@ void ivas_td_binaural_renderer_unwrap( int16_t subframe_length; int16_t subframe_idx; float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; + ivas_error error; subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; #ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND @@ -286,21 +293,20 @@ void ivas_td_binaural_renderer_unwrap( if ( ( hRenderConfig != NULL ) && ( hRenderConfig->roomAcoustics.late_reverb_on ) ) #endif { - ivas_reverb_process( + if ( ( error = ivas_reverb_process( #ifdef FIX_197_CREND_INTERFACE #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND - hReverb, + hReverb, #else - hCrendWrapper->hCrend->hReverb, + hCrendWrapper->hCrend->hReverb, #endif #else - hCrend->hReverb, + hCrend->hReverb, #endif - transport_config, - 0, - output, - reverb_signal, - subframe_idx ); + transport_config, 0, output, reverb_signal, subframe_idx ) ) != IVAS_ERR_OK ) + { + return error; + } #ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND ivas_reverb_process( @@ -318,7 +324,10 @@ void ivas_td_binaural_renderer_unwrap( } /* Render subframe */ - TDREND_GetMix( hBinRendererTd, output, subframe_length, subframe_idx ); + if ( ( error = TDREND_GetMix( hBinRendererTd, output, subframe_length, subframe_idx ) ) != IVAS_ERR_OK ) + { + return error; + } } @@ -341,7 +350,7 @@ void ivas_td_binaural_renderer_unwrap( } #endif - return; + return IVAS_ERR_OK; } @@ -569,15 +578,20 @@ ivas_error ivas_td_binaural_open_ext( AUDIO_CONFIG transport_config; IVAS_FORMAT ivas_format; IVAS_OUTPUT_SETUP hTransSetup; + ivas_error error; if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { - getAudioConfigNumChannels( inConfig, &nchan_transport ); + if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_transport ) ) != IVAS_ERR_OK ) + { + return error; + } } else { nchan_transport = customLsInput->num_spk; } + #ifdef FIX_197_CREND_INTERFACE transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); #else @@ -598,7 +612,6 @@ ivas_error ivas_td_binaural_open_ext( * and renders the current frame. *---------------------------------------------------------------------*/ -/*! r: TD Renderer result code. */ ivas_error ivas_td_binaural_renderer_ext( const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ const IVAS_REND_AudioConfig inConfig, /* i : Input audio configuration */ @@ -623,6 +636,7 @@ ivas_error ivas_td_binaural_renderer_ext( IVAS_FORMAT ivas_format; IVAS_REND_AudioConfigType inConfigType; AUDIO_CONFIG transport_config; + ivas_error error; #ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND int32_t output_Fs; #endif @@ -641,7 +655,10 @@ ivas_error ivas_td_binaural_renderer_ext( #endif if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { - getAudioConfigNumChannels( inConfig, &num_src ); + if ( ( error = getAudioConfigNumChannels( inConfig, &num_src ) ) != IVAS_ERR_OK ) + { + return error; + } } else { @@ -661,7 +678,6 @@ ivas_error ivas_td_binaural_renderer_ext( hIsmMetaData[0]->elevation = currentPos->elevation; } - #ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND #ifdef FIX_197_CREND_INTERFACE transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); @@ -671,13 +687,18 @@ ivas_error ivas_td_binaural_renderer_ext( output_Fs = output_frame * 50; #endif #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND - ivas_td_binaural_renderer_unwrap( reverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, - ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, - output, output_frame ); + if ( ( error = ivas_td_binaural_renderer_unwrap( reverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, + ( headRotData != NULL ) ? headRotData->headPositions : NULL, output, output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } #else - ivas_td_binaural_renderer_unwrap( NULL, 1, NULL, transport_config, output_Fs, pTDRend->hBinRendererTd, num_src, lfe_idx, - ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, - output, output_frame ); + if ( ( error = error = ivas_td_binaural_renderer_unwrap( NULL, 1, NULL, transport_config, output_Fs, pTDRend->hBinRendererTd, num_src, lfe_idx, + ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, + output, output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } #endif pop_wmops(); diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 4b72c16ce6..4eec8ecd56 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -133,6 +133,8 @@ void ivas_orient_trk_Init( pOTR->trkYaw = 0.0f; pOTR->trkPitch = 0.0f; pOTR->trkRoll = 0.0f; + + return; } @@ -142,12 +144,13 @@ void ivas_orient_trk_Init( * *-------------------------------------------------------------------*/ -ivas_error ivas_orient_trk_SetTrackingType( +void ivas_orient_trk_SetTrackingType( ivas_orient_trk_state_t *pOTR, - OTR_TRACKING_T trackingType ) + const OTR_TRACKING_T trackingType ) { pOTR->trackingType = trackingType; - return IVAS_ERR_OK; + + return; } @@ -157,18 +160,18 @@ ivas_error ivas_orient_trk_SetTrackingType( * *-------------------------------------------------------------------*/ -ivas_error ivas_orient_trk_SetAbsoluteOrientation( +void ivas_orient_trk_SetAbsoluteOrientation( ivas_orient_trk_state_t *pOTR, - float yaw, - float pitch, - float roll ) + const float yaw, + const float pitch, + const float roll ) { /* TODO implement condition checks */ pOTR->absYaw = yaw; pOTR->absPitch = pitch; pOTR->absRoll = roll; - return IVAS_ERR_OK; + return; } @@ -299,7 +302,7 @@ ivas_error ivas_orient_trk_Process( * *-------------------------------------------------------------------*/ -ivas_error ivas_orient_trk_GetTrackedOrientation( +void ivas_orient_trk_GetTrackedOrientation( ivas_orient_trk_state_t *pOTR, float *yaw, float *pitch, @@ -309,5 +312,5 @@ ivas_error ivas_orient_trk_GetTrackedOrientation( *pitch = pOTR->trkPitch; *roll = pOTR->trkRoll; - return IVAS_ERR_OK; + return; } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index a2e14a35f1..df254e0286 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -215,7 +215,7 @@ void ivas_HRTF_CRend_binary_close( * TD object renderer *----------------------------------------------------------------------------------*/ -void ivas_td_binaural_renderer_unwrap( +ivas_error ivas_td_binaural_renderer_unwrap( #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND REVERB_HANDLE hReverb, /* i : reverb handle */ #else @@ -883,23 +883,23 @@ void ivas_orient_trk_Init( ivas_orient_trk_state_t *pOTR ); -ivas_error ivas_orient_trk_SetTrackingType( +void ivas_orient_trk_SetTrackingType( ivas_orient_trk_state_t *pOTR, - OTR_TRACKING_T trackingType + const OTR_TRACKING_T trackingType ); -ivas_error ivas_orient_trk_SetAbsoluteOrientation( +void ivas_orient_trk_SetAbsoluteOrientation( ivas_orient_trk_state_t *pOTR, - float yaw, - float pitch, - float roll + const float yaw, + const float pitch, + const float roll ); ivas_error ivas_orient_trk_Process( ivas_orient_trk_state_t *pOTR ); -ivas_error ivas_orient_trk_GetTrackedOrientation( +void ivas_orient_trk_GetTrackedOrientation( ivas_orient_trk_state_t *pOTR, float *yaw, float *pitch, diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e1349374b7..50acff2bb5 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -840,14 +840,17 @@ static ivas_error initEfap( { return error; } + if ( ( error = getSpeakerElevations( pEfapWrapper->speakerConfig, &elevations ) ) != IVAS_ERR_OK ) { return error; } + if ( ( error = getNumNonLfeChannelsInSpeakerLayout( pEfapWrapper->speakerConfig, &numNonLfeChannels ) ) != IVAS_ERR_OK ) { return error; } + if ( ( error = efap_init_data( &pEfapWrapper->hEfap, azimuths, elevations, numNonLfeChannels, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; @@ -1081,19 +1084,22 @@ static ivas_error setRendInputActiveIsm( error = IVAS_ERR_OK; if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL ) { - error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, NULL, *rendCtx.pOutSampleRate ); + if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } } else if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) { #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( hRendCfg != NULL && hRendCfg->roomAcoustics.use_brir == 0 && hRendCfg->roomAcoustics.late_reverb_on ) { - error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, NULL, *rendCtx.pOutSampleRate ); - if ( ( error = ivas_reverb_open( &( inputIsm->reverb ), - getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, - hRendCfg, - *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_reverb_open( &( inputIsm->reverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -1101,27 +1107,24 @@ static ivas_error setRendInputActiveIsm( else { #endif - error = ivas_rend_openCrend( &inputIsm->crendWrapper, - AUDIO_CONFIG_7_1_4, + if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, #ifdef FIX_197_CREND_INTERFACE - getIvasAudioConfigFromRendAudioConfig( outConfig ), + getIvasAudioConfigFromRendAudioConfig( outConfig ), #else - rendAudioConfigToIvasAudioConfig( outConfig ), + rendAudioConfigToIvasAudioConfig( outConfig ), #endif - hRendCfg, + hRendCfg, #ifdef FIX_197_CREND_INTERFACE - 0, + 0, #endif - NULL, - *rendCtx.pOutSampleRate ); + NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND } #endif } - if ( error != IVAS_ERR_OK ) - { - return error; - } return IVAS_ERR_OK; } @@ -1144,17 +1147,21 @@ static void clearInputIsm( { ivas_rend_closeCrend( &inputIsm->crendWrapper ); } + #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( inputIsm->reverb != NULL ) { ivas_reverb_close( &inputIsm->reverb ); } #endif + if ( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) { ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); inputIsm->tdRendWrapper.hHrtfTD = NULL; } + + return; } static void copyLsConversionMatrixToPanMatrix( @@ -1270,10 +1277,12 @@ static ivas_error initMcPanGainsWithEfap( { return error; } + if ( ( error = getSpeakerAzimuths( inputMc->base.inConfig, &spkAzi ) ) != IVAS_ERR_OK ) { return error; } + if ( ( error = getSpeakerElevations( inputMc->base.inConfig, &spkEle ) ) != IVAS_ERR_OK ) { return error; @@ -1433,6 +1442,7 @@ static ivas_error initMcPanGainsWithStereoLookup( { return error; } + for ( readIdx = 0, writeIdx = 0; writeIdx < numInChannels; ++readIdx, ++writeIdx ) { if ( skipSideSpeakers && readIdx == 4 ) @@ -1465,14 +1475,17 @@ static bool configsAreEqual( { return false; } + if ( customLsA.num_lfe != customLsB.num_lfe ) { return false; } + if ( customLsA.is_planar_setup != customLsB.is_planar_setup ) { return false; } + for ( i = 0; i < customLsA.num_spk; ++i ) { /* Compare to nearest degree (hence the int cast) */ @@ -1659,10 +1672,12 @@ static ivas_error updateMcPanGainsForAmbiOut( { return error; } + if ( ( error = getSpeakerAzimuths( inputMc->base.inConfig, &spkAzi ) ) != IVAS_ERR_OK ) { return error; } + if ( ( error = getSpeakerElevations( inputMc->base.inConfig, &spkEle ) ) != IVAS_ERR_OK ) { return error; @@ -1781,6 +1796,7 @@ static ivas_error initMcBinauralRendering( ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); inputMc->tdRendWrapper.hHrtfTD = NULL; } + #ifdef FIX_197_CREND_INTERFACE if ( inputMc->crendWrapper != NULL ) #else @@ -1789,12 +1805,14 @@ static ivas_error initMcBinauralRendering( { ivas_rend_closeCrend( &inputMc->crendWrapper ); } + #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( inputMc->reverb != NULL ) { ivas_reverb_close( &inputMc->reverb ); } #endif + if ( inputMc->efapInWrapper.hEfap != NULL ) { efap_free_data( &inputMc->efapInWrapper.hEfap ); @@ -1824,14 +1842,11 @@ static ivas_error initMcBinauralRendering( { return error; } + #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( hRendCfg != NULL && hRendCfg->roomAcoustics.use_brir == 0 && hRendCfg->roomAcoustics.late_reverb_on ) { - if ( ( error = ivas_reverb_open( &( inputMc->reverb ), - getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, - hRendCfg, - outSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open( &( inputMc->reverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -1842,8 +1857,7 @@ static ivas_error initMcBinauralRendering( { if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, #ifdef FIX_197_CREND_INTERFACE - ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) ? AUDIO_CONFIG_7_1_4 : getIvasAudioConfigFromRendAudioConfig( inConfig ), - getIvasAudioConfigFromRendAudioConfig( outConfig ), + ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) ? AUDIO_CONFIG_7_1_4 : getIvasAudioConfigFromRendAudioConfig( inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), #else ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) ? AUDIO_CONFIG_7_1_4 : rendAudioConfigToIvasAudioConfig( inConfig ), rendAudioConfigToIvasAudioConfig( outConfig ), @@ -1852,8 +1866,7 @@ static ivas_error initMcBinauralRendering( #ifdef FIX_197_CREND_INTERFACE 0, #endif - NULL, - outSampleRate ) ) != IVAS_ERR_OK ) + NULL, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -1862,10 +1875,13 @@ static ivas_error initMcBinauralRendering( /* Initialise the EFAP handle for rotation on input layout */ if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM && inputMc->base.ctx.pHeadRotData->headRotEnabled ) { - initEfap( &inputMc->efapInWrapper, inConfig, NULL ); + if ( ( error = initEfap( &inputMc->efapInWrapper, inConfig, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } } - return error; + return IVAS_ERR_OK; } static lfe_routing defaultLfeRouting( @@ -1986,6 +2002,7 @@ static void clearInputMc( { efap_free_data( &inputMc->efapInWrapper.hEfap ); } + #ifdef FIX_197_CREND_INTERFACE if ( inputMc->crendWrapper != NULL ) #else @@ -1994,12 +2011,14 @@ static void clearInputMc( { ivas_rend_closeCrend( &inputMc->crendWrapper ); } + #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( inputMc->reverb != NULL ) { ivas_reverb_close( &inputMc->reverb ); } #endif + if ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) { ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); @@ -2152,6 +2171,7 @@ static ivas_error updateSbaPanGains( { return error; } + error = ivas_rend_openCrend( &inputSba->crendWrapper, AUDIO_CONFIG_7_1_4, #ifdef FIX_197_CREND_INTERFACE @@ -2442,6 +2462,7 @@ static ivas_error initMasaDummyDecForBinauralOut( { return error; } + if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &decDummy->hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; @@ -2496,13 +2517,8 @@ static ivas_error updateMasaDummyDec( default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } - /* Check error here to keep switch statement more compact */ - if ( error != IVAS_ERR_OK ) - { - return error; - } - return IVAS_ERR_OK; + return error; } static DecoderDummy *initDecoderDummy( @@ -2686,6 +2702,8 @@ static void freeDecoderDummy( free( pDecDummy ); pDecDummy = NULL; + + return; } static void clearInputMasa( @@ -2697,6 +2715,8 @@ static void clearInputMasa( initRendInputBase( &inputMasa->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx ); freeDecoderDummy( &inputMasa->decDummy ); + + return; } ivas_error IVAS_REND_Open( @@ -2717,10 +2737,12 @@ ivas_error IVAS_REND_Open( { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + if ( ( error = validateOutputAudioConfig( outConfig ) ) != IVAS_ERR_OK ) { return error; } + if ( ( error = validateOutputSampleRate( outputSampleRate, outConfig ) ) != IVAS_ERR_OK ) { return error; @@ -2748,13 +2770,20 @@ ivas_error IVAS_REND_Open( { return error; } - initLimiter( &hIvasRend->hLimiter, numOutChannels, outputSampleRate ); + + if ( ( error = initLimiter( &hIvasRend->hLimiter, numOutChannels, outputSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } /* Initialize headrotation data */ initHeadRotation( hIvasRend ); /* Initialize EFAP */ - initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ); + if ( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK ) + { + return error; + } /* Initialize inputs */ for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) @@ -2770,6 +2799,7 @@ ivas_error IVAS_REND_Open( #endif hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; } + for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); @@ -2784,6 +2814,7 @@ ivas_error IVAS_REND_Open( #endif hIvasRend->inputsMc[i].tdRendWrapper.hBinRendererTd = NULL; } + for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); @@ -2793,6 +2824,7 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsSba[i].crendWrapper.hCrend = NULL; #endif } + for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsMasa[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); @@ -2840,11 +2872,13 @@ static ivas_error validateCustomLsLayout( { return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; } + /* There must be at least one speaker or LFE in the layout */ if ( layout.num_spk + layout.num_lfe <= 0 ) { return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; } + /* LFE indices must be positive */ for ( i = 0; i < layout.num_lfe; ++i ) { @@ -2874,11 +2908,13 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + if ( hIvasRend->outputConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { /* Specifying details of custom speaker layout only makes sense if output config is set to custom speaker layout */ return IVAS_ERR_INVALID_OUTPUT_FORMAT; } + if ( ( error = validateCustomLsLayout( layout ) ) != IVAS_ERR_OK ) { return error; @@ -2891,10 +2927,17 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( { return error; } - initLimiter( &hIvasRend->hLimiter, numOutChannels, hIvasRend->sampleRateOut ); + + if ( ( error = initLimiter( &hIvasRend->hLimiter, numOutChannels, hIvasRend->sampleRateOut ) ) != IVAS_ERR_OK ) + { + return error; + } /* Re-initialize EFAP - output layout has changed or has been fully defined for the first time */ - initEfap( &hIvasRend->efapOutWrapper, hIvasRend->outputConfig, &hIvasRend->customLsOut ); + if ( ( error = initEfap( &hIvasRend->efapOutWrapper, hIvasRend->outputConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK ) + { + return error; + } /* Re-initialize panning gains for each active MC input, This includes re-initializing * LFE handling for the new output layout, which means custom LFE handling is overwritten, @@ -2920,11 +2963,13 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) { inputSba = &hIvasRend->inputsSba[i]; + if ( inputSba->base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { /* Input inactive, skip. */ continue; } + if ( ( error = updateSbaPanGains( inputSba, hIvasRend->outputConfig, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) { return error; @@ -2954,16 +2999,14 @@ ivas_error IVAS_REND_NumOutChannels( { case IVAS_REND_AUDIO_CONFIG_LS_CUSTOM: *numOutChannels = hIvasRend->customLsOut.num_spk + hIvasRend->customLsOut.num_lfe; - error = IVAS_ERR_OK; break; default: - error = getAudioConfigNumChannels( hIvasRend->outputConfig, numOutChannels ); + if ( ( error = getAudioConfigNumChannels( hIvasRend->outputConfig, numOutChannels ) ) != IVAS_ERR_OK ) + { + return error; + } break; } - if ( error != IVAS_ERR_OK ) - { - return error; - } return IVAS_ERR_OK; } @@ -3272,7 +3315,10 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( inputMc->lfeRouting = defaultLfeRouting( inputMc->base.inConfig, inputMc->customLsInput, hIvasRend->outputConfig, *inputMc->base.ctx.pCustomLsOut ); - initEfap( &inputMc->efapInWrapper, inputMc->base.inConfig, &inputMc->customLsInput ); + if ( ( error = initEfap( &inputMc->efapInWrapper, inputMc->base.inConfig, &inputMc->customLsInput ) ) != IVAS_ERR_OK ) + { + return error; + } if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) { @@ -4031,6 +4077,8 @@ static void renderBufferChannelLerp( } } } + + return; } /* Take one channel from input buffer and copy it to each channel @@ -4068,19 +4116,26 @@ static ivas_error rotateFrameMc( rotation_matrix Rmat; rotation_gains gains; float tmp_gains[MAX_INPUT_CHANNELS]; + ivas_error error; push_wmops( "rotateFrameMc" ); if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { - getAudioConfigNumChannels( inConfig, &nchan ); + if ( ( error = getAudioConfigNumChannels( inConfig, &nchan ) ) != IVAS_ERR_OK ) + { + return error; + } } else { nchan = inCustomLs.num_spk + inCustomLs.num_lfe; } - getMcConfigValues( inConfig, inCustomLs, &ls_azimuth, &ls_elevation, &lfe_idx, &is_planar_setup ); + if ( ( error = getMcConfigValues( inConfig, inCustomLs, &ls_azimuth, &ls_elevation, &lfe_idx, &is_planar_setup ) ) != IVAS_ERR_OK ) + { + return error; + } /* initialize gains to passthrough */ for ( ch_in = 0; ch_in < nchan; ch_in++ ) @@ -4176,10 +4231,14 @@ static ivas_error rotateFrameSba( rotation_matrix Rmat; float tmpRot[2 * HEADROT_ORDER + 1]; rotation_gains gains; + ivas_error error; push_wmops( "rotateFrameSba" ); - getAmbisonicsOrder( inConfig, &shd_rot_max_order ); + if ( ( error = getAmbisonicsOrder( inConfig, &shd_rot_max_order ) ) != IVAS_ERR_OK ) + { + return error; + } /* subframe loop */ subframe_len = inAudio.config.numSamplesPerChannel / RENDERER_HEAD_POSITIONS_PER_FRAME; @@ -4371,6 +4430,7 @@ static ivas_error renderIsmToBinauralRoom( rotatedPos.azimuth = (float) azi_rot; rotatedPos.elevation = (float) ele_rot; } + if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, ( headRotData->headRotEnabled ) ? rotatedPos.azimuth : ismInput->previousPos.azimuth, ( headRotData->headRotEnabled ) ? rotatedPos.elevation : ismInput->previousPos.elevation, @@ -4386,6 +4446,7 @@ static ivas_error renderIsmToBinauralRoom( rotatedPos.azimuth = (float) azi_rot; rotatedPos.elevation = (float) ele_rot; } + if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, ( headRotData->headRotEnabled ) ? rotatedPos.azimuth : ismInput->currentPos.azimuth, ( headRotData->headRotEnabled ) ? rotatedPos.elevation : ismInput->currentPos.elevation, @@ -4401,7 +4462,12 @@ static ivas_error renderIsmToBinauralRoom( /* intermediate rendering to 7_1_4 */ tmpMcBuffer = ismInput->base.inputBuffer; - getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ); + + if ( ( error = getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) + { + return error; + } + tmpMcBuffer.config.numChannels = tmp; tmpMcBuffer.data = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpMcBuffer.data, tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels ); @@ -4415,26 +4481,25 @@ static ivas_error renderIsmToBinauralRoom( #endif - ivas_rend_crendProcess( + if ( ( error = ivas_rend_crendProcess( #ifdef FIX_197_CREND_INTERFACE - ismInput->crendWrapper, + ismInput->crendWrapper, #else - &ismInput->crendWrapper, + &ismInput->crendWrapper, #endif - AUDIO_CONFIG_7_1_4, - AUDIO_CONFIG_BINAURAL_ROOM, + AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM, #ifdef FIX_197_CREND_INTERFACE - NULL, - NULL, - NULL, - NULL, + NULL, NULL, NULL, NULL, #endif #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND - tmpRendBuffer, + tmpRendBuffer, #else - tmpCrendBuffer, + tmpCrendBuffer, #endif - *ismInput->base.ctx.pOutSampleRate ); + *ismInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); @@ -4486,6 +4551,7 @@ static ivas_error renderIsmToMc( { return error; } + // TODO tmu review when #215 is resolved if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, (int16_t) floorf( ismInput->previousPos.azimuth + 0.5f ), @@ -4495,6 +4561,7 @@ static ivas_error renderIsmToMc( return error; } } + /* Assume num channels in audio buffer to be 1. * This should have been validated in IVAS_REND_FeedInputAudio() */ renderBufferChannelLerp( ismInput->base.inputBuffer, 0, currentPanGains, previousPanGains, outAudio ); @@ -4625,6 +4692,7 @@ static ivas_error renderActiveInputsIsm( /* Skip inactive inputs */ continue; } + if ( ( error = renderInputIsm( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) { return error; @@ -4691,7 +4759,6 @@ static ivas_error renderMcToBinaural( int8_t headRotEnabled; float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; IVAS_REND_AudioConfig inConfig; - ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; @@ -4728,13 +4795,16 @@ static ivas_error renderMcToBinaural( tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); - rotateFrameMc( mcInput->base.inputBuffer, - mcInput->base.inConfig, - mcInput->customLsInput, - mcInput->base.ctx.pHeadRotData, - mcInput->rot_gains_prev, - mcInput->efapInWrapper.hEfap, - tmpRotBuffer ); + if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, + mcInput->base.inConfig, + mcInput->customLsInput, + mcInput->base.ctx.pHeadRotData, + mcInput->rot_gains_prev, + mcInput->efapInWrapper.hEfap, + tmpRotBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } copyBufferTo2dArray( tmpRotBuffer, tmpRendBuffer ); free( tmpRotBuffer.data ); @@ -4745,23 +4815,16 @@ static ivas_error renderMcToBinaural( } /* call CREND */ - if ( ( error = ivas_rend_crendProcess( #ifdef FIX_197_CREND_INTERFACE - mcInput->crendWrapper, - getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), - getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, - NULL, - NULL, - NULL, + mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, NULL, NULL, NULL, #else &mcInput->crendWrapper, rendAudioConfigToIvasAudioConfig( mcInput->base.inConfig ), rendAudioConfigToIvasAudioConfig( outConfig ), #endif - tmpRendBuffer, - *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -4770,7 +4833,10 @@ static ivas_error renderMcToBinaural( accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); /* TODO tmu : needs delay compensation */ - renderLfeToBinaural( mcInput, outAudio ); + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + { + return error; + } pop_wmops(); @@ -4789,7 +4855,6 @@ static ivas_error renderMcToBinauralRoom( #else float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; #endif - ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; @@ -4829,13 +4894,16 @@ static ivas_error renderMcToBinauralRoom( tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); - rotateFrameMc( mcInput->base.inputBuffer, - mcInput->base.inConfig, - mcInput->customLsInput, - mcInput->base.ctx.pHeadRotData, - mcInput->rot_gains_prev, - mcInput->efapInWrapper.hEfap, - tmpRotBuffer ); + if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, + mcInput->base.inConfig, + mcInput->customLsInput, + mcInput->base.ctx.pHeadRotData, + mcInput->rot_gains_prev, + mcInput->efapInWrapper.hEfap, + tmpRotBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND copyBufferTo2dArray( tmpRotBuffer, tmpRendBuffer ); @@ -4856,13 +4924,8 @@ static ivas_error renderMcToBinauralRoom( /* call CREND */ if ( ( error = ivas_rend_crendProcess( #ifdef FIX_197_CREND_INTERFACE - mcInput->crendWrapper, - getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), - getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, - NULL, - NULL, - NULL, + mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, NULL, NULL, NULL, #else &mcInput->crendWrapper, rendAudioConfigToIvasAudioConfig( mcInput->base.inConfig ), @@ -4886,7 +4949,10 @@ static ivas_error renderMcToBinauralRoom( #endif /* TODO tmu : needs delay compensation */ - renderLfeToBinaural( mcInput, outAudio ); + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + { + return error; + } pop_wmops(); @@ -4920,18 +4986,20 @@ static ivas_error renderMcCustomLsToBinauralRoom( tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); - rotateFrameMc( mcInput->base.inputBuffer, - mcInput->base.inConfig, - mcInput->customLsInput, - mcInput->base.ctx.pHeadRotData, - mcInput->rot_gains_prev, - mcInput->efapInWrapper.hEfap, - tmpRotBuffer ); + if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->rot_gains_prev, mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } } /* intermediate conversion to 7_1_4 */ tmpMcBuffer = mcInput->base.inputBuffer; - getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ); + + if ( ( error = getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) + { + return error; + } + tmpMcBuffer.config.numChannels = (int16_t) tmp; tmpMcBuffer.data = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpMcBuffer.data, tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels ); @@ -4946,20 +5014,13 @@ static ivas_error renderMcCustomLsToBinauralRoom( /* call CREND */ if ( ( error = ivas_rend_crendProcess( #ifdef FIX_197_CREND_INTERFACE - mcInput->crendWrapper, - AUDIO_CONFIG_7_1_4, - getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, - NULL, - NULL, - NULL, + mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, #else &mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, rendAudioConfigToIvasAudioConfig( outConfig ), #endif - tmpCrendBuffer, - *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -4967,7 +5028,10 @@ static ivas_error renderMcCustomLsToBinauralRoom( accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); /* TODO tmu : needs delay compensation */ - renderLfeToBinaural( mcInput, outAudio ); + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + { + return error; + } if ( headRotEnabled ) { @@ -4980,7 +5044,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( return IVAS_ERR_OK; } -static ivas_error renderMcToMc( +static void renderMcToMc( const input_mc *mcInput, IVAS_REND_AudioBuffer outAudio ) { @@ -4998,10 +5062,10 @@ static ivas_error renderMcToMc( pop_wmops(); - return IVAS_ERR_OK; + return; } -static ivas_error renderMcToSba( +static void renderMcToSba( const input_mc *mcInput, IVAS_REND_AudioBuffer outAudio ) { @@ -5019,7 +5083,7 @@ static ivas_error renderMcToSba( pop_wmops(); - return IVAS_ERR_OK; + return; } static ivas_error renderInputMc( @@ -5030,6 +5094,8 @@ static ivas_error renderInputMc( ivas_error error; IVAS_REND_AudioBuffer inAudio; + error = IVAS_ERR_OK; + inAudio = mcInput->base.inputBuffer; if ( mcInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) @@ -5048,10 +5114,10 @@ static ivas_error renderInputMc( switch ( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - error = renderMcToMc( mcInput, outAudio ); + renderMcToMc( mcInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - error = renderMcToSba( mcInput, outAudio ); + renderMcToSba( mcInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) @@ -5077,13 +5143,7 @@ static ivas_error renderInputMc( return IVAS_ERR_INVALID_OUTPUT_FORMAT; } - /* Check error here to keep switch statement more compact */ - if ( error != IVAS_ERR_OK ) - { - return error; - } - - return IVAS_ERR_OK; + return error; } static ivas_error renderActiveInputsMc( @@ -5111,7 +5171,7 @@ static ivas_error renderActiveInputsMc( return IVAS_ERR_OK; } -static ivas_error renderSbaToMc( +static void renderSbaToMc( const input_sba *sbaInput, IVAS_REND_AudioBuffer outAudio ) { @@ -5129,10 +5189,10 @@ static ivas_error renderSbaToMc( pop_wmops(); - return IVAS_ERR_OK; + return; } -static ivas_error renderSbaToSba( +static void renderSbaToSba( const input_sba *sbaInput, IVAS_REND_AudioBuffer outAudio ) { @@ -5150,7 +5210,7 @@ static ivas_error renderSbaToSba( pop_wmops(); - return IVAS_ERR_OK; + return; } static ivas_error renderSbaToBinaural( @@ -5172,14 +5232,12 @@ static ivas_error renderSbaToBinaural( tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); /* copy input for in-place rotation */ - mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, - tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); + mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); - rotateFrameSba( sbaInput->base.inputBuffer, - sbaInput->base.inConfig, - sbaInput->base.ctx.pHeadRotData, - sbaInput->rot_gains_prev, - tmpRotBuffer ); + if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->rot_gains_prev, tmpRotBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } copyBufferTo2dArray( tmpRotBuffer, tmpCrendBuffer ); free( tmpRotBuffer.data ); @@ -5192,20 +5250,13 @@ static ivas_error renderSbaToBinaural( /* call CREND */ if ( ( error = ivas_rend_crendProcess( #ifdef FIX_197_CREND_INTERFACE - sbaInput->crendWrapper, - getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), - getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, - NULL, - NULL, - NULL, + sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, #else &sbaInput->crendWrapper, rendAudioConfigToIvasAudioConfig( sbaInput->base.inConfig ), rendAudioConfigToIvasAudioConfig( outConfig ), #endif - tmpCrendBuffer, - *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -5226,7 +5277,6 @@ static ivas_error renderSbaToBinauralRoom( int16_t i; int16_t tmp; float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; IVAS_REND_AudioBuffer tmpMcBuffer; @@ -5243,15 +5293,24 @@ static ivas_error renderSbaToBinauralRoom( { tmpRotBuffer = sbaInput->base.inputBuffer; tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); + /* copy input for in-place rotation */ mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); - rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->rot_gains_prev, tmpRotBuffer ); + if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->rot_gains_prev, tmpRotBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } } /* intermediate rendering to 7_1_4 */ tmpMcBuffer = sbaInput->base.inputBuffer; - getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ); + + if ( ( error = getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) + { + return error; + } + tmpMcBuffer.config.numChannels = (int16_t) tmp; tmpMcBuffer.data = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpMcBuffer.data, tmpMcBuffer.config.numChannels * tmpMcBuffer.config.numSamplesPerChannel ); @@ -5267,20 +5326,14 @@ static ivas_error renderSbaToBinauralRoom( /* call CREND */ if ( ( error = ivas_rend_crendProcess( #ifdef FIX_197_CREND_INTERFACE - sbaInput->crendWrapper, - AUDIO_CONFIG_7_1_4, - getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, - NULL, - NULL, - NULL, + sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, NULL, NULL, NULL, #else &sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, rendAudioConfigToIvasAudioConfig( outConfig ), #endif - tmpCrendBuffer, - *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -5306,6 +5359,8 @@ static ivas_error renderInputSba( ivas_error error; IVAS_REND_AudioBuffer inAudio; + error = IVAS_ERR_OK; + inAudio = sbaInput->base.inputBuffer; if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) @@ -5324,10 +5379,10 @@ static ivas_error renderInputSba( switch ( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - error = renderSbaToMc( sbaInput, outAudio ); + renderSbaToMc( sbaInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - error = renderSbaToSba( sbaInput, outAudio ); + renderSbaToSba( sbaInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) @@ -5346,13 +5401,7 @@ static ivas_error renderInputSba( return IVAS_ERR_INVALID_OUTPUT_FORMAT; } - /* Check error here to keep switch statement more compact */ - if ( error != IVAS_ERR_OK ) - { - return error; - } - - return IVAS_ERR_OK; + return error; } static ivas_error renderActiveInputsSba( @@ -5416,7 +5465,7 @@ static void copyMasaMetadataToDiracRenderer( return; } -static ivas_error renderMasaToMc( +static void renderMasaToMc( input_masa *masaInput, IVAS_REND_AudioBuffer outAudio ) { @@ -5437,10 +5486,10 @@ static ivas_error renderMasaToMc( accumulate2dArrayToBuffer( tmpBuffer, &outAudio ); - return IVAS_ERR_OK; + return; } -static ivas_error renderMasaToSba( +static void renderMasaToSba( input_masa *masaInput, IVAS_REND_AudioBuffer outAudio ) { @@ -5453,10 +5502,10 @@ static ivas_error renderMasaToSba( accumulate2dArrayToBuffer( tmpBuffer, &outAudio ); - return IVAS_ERR_OK; + return; } -static ivas_error renderMasaToBinaural( +static void renderMasaToBinaural( input_masa *masaInput, IVAS_REND_AudioBuffer outAudio ) { @@ -5469,7 +5518,7 @@ static ivas_error renderMasaToBinaural( accumulate2dArrayToBuffer( tmpBuffer, &outAudio ); - return IVAS_ERR_OK; + return; } static ivas_error renderInputMasa( @@ -5477,7 +5526,6 @@ static ivas_error renderInputMasa( const IVAS_REND_AudioConfig outConfig, IVAS_REND_AudioBuffer outAudio ) { - ivas_error error; IVAS_REND_AudioBuffer inAudio; if ( !masaInput->metadataHasBeenFed ) @@ -5503,20 +5551,20 @@ static ivas_error renderInputMasa( switch ( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - error = renderMasaToMc( masaInput, outAudio ); + renderMasaToMc( masaInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - error = renderMasaToSba( masaInput, outAudio ); + renderMasaToSba( masaInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) { case IVAS_REND_AUDIO_CONFIG_BINAURAL: - error = renderMasaToBinaural( masaInput, outAudio ); + renderMasaToBinaural( masaInput, outAudio ); break; /* ToDo */ // case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: - // error = renderMasaToBinauralRoom( masaInput, outConfig, outAudio ); + // renderMasaToBinauralRoom( masaInput, outConfig, outAudio ); // break; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; @@ -5526,12 +5574,6 @@ static ivas_error renderInputMasa( return IVAS_ERR_INVALID_OUTPUT_FORMAT; } - /* Check error here to keep switch statement more compact */ - if ( error != IVAS_ERR_OK ) - { - return error; - } - return IVAS_ERR_OK; } -- GitLab From ab0b1bdfe53d26b1af05962da3e48d1c1593a73c Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 9 Mar 2023 14:42:25 +0100 Subject: [PATCH 206/375] Update (C) year in scripts files --- .../Table_Format_Converter/generate_tables_from_rom_to_bin.c | 2 +- .../Table_Format_Converter/table_format_converter_readme.txt | 2 +- .../generate_crend_ivas_tables_from_sofa.c | 2 +- .../ivas_crend_binaural_filter_design.c | 2 +- .../ivas_crend_binaural_filter_design.h | 2 +- .../mixer_conv_sofa_to_rom_table_converter_readme.txt | 2 +- scripts/binauralRenderer_interface/resolve_build_dep.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c b/scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c index a0e2ddd94c..a7d4391c75 100644 --- a/scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c +++ b/scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other diff --git a/scripts/binauralRenderer_interface/Table_Format_Converter/table_format_converter_readme.txt b/scripts/binauralRenderer_interface/Table_Format_Converter/table_format_converter_readme.txt index 391ad644e9..dda6738a9a 100644 --- a/scripts/binauralRenderer_interface/Table_Format_Converter/table_format_converter_readme.txt +++ b/scripts/binauralRenderer_interface/Table_Format_Converter/table_format_converter_readme.txt @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other diff --git a/scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c b/scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c index 0aae3c6cab..3f847f83cf 100644 --- a/scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c +++ b/scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. diff --git a/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.c b/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.c index 456997b5a1..7e9658bd80 100644 --- a/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.c +++ b/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.c @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. diff --git a/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.h b/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.h index 9b8fdbcde9..28d3c12250 100644 --- a/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.h +++ b/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.h @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. diff --git a/scripts/binauralRenderer_interface/mixer_conv_sofa_to_rom_table_converter_readme.txt b/scripts/binauralRenderer_interface/mixer_conv_sofa_to_rom_table_converter_readme.txt index ead4b2d437..73314c5cd5 100644 --- a/scripts/binauralRenderer_interface/mixer_conv_sofa_to_rom_table_converter_readme.txt +++ b/scripts/binauralRenderer_interface/mixer_conv_sofa_to_rom_table_converter_readme.txt @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other diff --git a/scripts/binauralRenderer_interface/resolve_build_dep.py b/scripts/binauralRenderer_interface/resolve_build_dep.py index 5a1a823033..a251e7fe32 100644 --- a/scripts/binauralRenderer_interface/resolve_build_dep.py +++ b/scripts/binauralRenderer_interface/resolve_build_dep.py @@ -1,5 +1,5 @@ """ - (C) 2022 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. -- GitLab From 33a075197966180d8af1be1d4cfe0a9e3b8be678 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 9 Mar 2023 15:19:17 +0100 Subject: [PATCH 207/375] clang format --- lib_dec/ivas_ism_dec.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 65f657a2e3..0bda9f5ae0 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -88,8 +88,8 @@ static ivas_error ivas_ism_bitrate_switching( } /*-----------------------------------------------------------------* - * Initialize the needed renderer struct and destroy the unnecessary renderer struct - *-----------------------------------------------------------------*/ + * Initialize the needed renderer struct and destroy the unnecessary renderer struct + *-----------------------------------------------------------------*/ /* select the renderer */ ivas_renderer_select( st_ivas ); @@ -105,10 +105,13 @@ static ivas_error ivas_ism_bitrate_switching( efap_free_data( &st_ivas->hEFAPdata ); } + /*-----------------------------------------------------------------* + * Switching between ParamISM and DiscISM + *-----------------------------------------------------------------*/ + + /* switching from ParamISM to DiscISM */ if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM ) { - /* switching from ParamISM to DiscISM */ - /* Deallocate the ParamISM struct */ if ( st_ivas->hDirAC != NULL ) { @@ -167,10 +170,9 @@ static ivas_error ivas_ism_bitrate_switching( } } + /* switching from Discrete ISM to ParamISM */ if ( st_ivas->ism_mode == ISM_MODE_PARAM && last_ism_mode == ISM_MODE_DISC ) { - /* switching from Discrete ISM to ParamISM */ - /* Allocate and initialize the ParamISM struct */ if ( ( error = ivas_param_ism_dec_open( st_ivas ) ) != IVAS_ERR_OK ) { -- GitLab From 1de9422f4dd80c7aa0dfb31c363cf3158b92c086 Mon Sep 17 00:00:00 2001 From: rhb Date: Thu, 9 Mar 2023 17:11:36 +0100 Subject: [PATCH 208/375] more fixes for SBA-to-mono and SBA-to-stereo bitrate switching --- lib_dec/ivas_corecoder_dec_reconfig.c | 14 ++++++++++++++ lib_dec/ivas_sba_dec.c | 7 +++++++ 2 files changed, 21 insertions(+) mode change 100644 => 100755 lib_dec/ivas_sba_dec.c diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index 7b91755b70..559552c230 100755 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -149,6 +149,13 @@ ivas_error ivas_corecoder_dec_reconfig( for ( cpe_id = st_ivas->nCPE; cpe_id < nCPE_old; cpe_id++ ) { +#ifdef SBA2MONO + /* don't deallocate first CPE in case of mono/stereo output of 1 TC SBA */ + if ( cpe_id == 0 && st_ivas->sba_dirac_stereo_flag ) + { + continue; + } +#endif destroy_cpe_dec( st_ivas->hCPE[cpe_id] ); st_ivas->hCPE[cpe_id] = NULL; } @@ -188,6 +195,13 @@ ivas_error ivas_corecoder_dec_reconfig( return error; } } +#ifdef SBA2MONO + if ( st_ivas->sba_dirac_stereo_flag && st_ivas->nchan_transport == 1 && nchan_transport_old > 1 ) + { + st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hSCE[0]->hCoreCoder[0]; /* don't allocate unnecessary core coder, simply point to core coder of SCE element */ + st_ivas->hCPE[0]->hCoreCoder[1] = NULL; + } +#endif for ( cpe_id = 0; cpe_id < nCPE_existing; cpe_id++ ) { diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c old mode 100644 new mode 100755 index 98fad8c094..16503f8082 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -215,11 +215,18 @@ ivas_error ivas_sba_dec_reconfigure( hSpar = st_ivas->hSpar; } + +#ifndef SBA2MONO st_ivas->sba_dirac_stereo_flag = 0; +#endif sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); ivas_spar_config( ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, st_ivas->sid_format ); +#ifdef SBA2MONO + st_ivas->sba_dirac_stereo_flag = ( hDecoderConfig->output_config == AUDIO_CONFIG_STEREO || (hDecoderConfig->output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) ); +#endif + if ( hDirAC == NULL && st_ivas->sba_mode == SBA_MODE_DIRAC ) { if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) -- GitLab From b6de7037e3977b01a16324ca3718ac9dbc1d7e91 Mon Sep 17 00:00:00 2001 From: Andrea Eichenseer Date: Thu, 9 Mar 2023 18:17:24 +0100 Subject: [PATCH 209/375] Force ACELP noise estimation to run for first 100 frames to avoid all-zero CNG. Switch FORCE_EST, affects ISM modes. --- lib_com/options.h | 3 +++ lib_dec/fd_cng_dec.c | 12 ++++++++++++ lib_dec/init_dec.c | 3 +++ lib_dec/ivas_sce_dec.c | 6 ++++++ lib_dec/stat_dec.h | 3 +++ 5 files changed, 27 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index fdfd92f70a..e72b0eb958 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,6 +171,9 @@ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ #define FIX_DTX_BRATE_LIMIT /* VA: limit the DTX usage in background noise to lower bitrates similarly as in other IVAS formats */ +#ifdef DISCRETE_ISM_DTX_CNG +#define FORCE_EST /* FhG: force ACELP noise estimation in ISM mode for first 100 frames to prevent all-zero CNG */ +#endif /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index a715618f11..de51d3e522 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -413,6 +413,7 @@ void ApplyFdCng( hFdCngCom->sid_frame_counter = 0; /* set noise estimation inactive during concealment, as no update with noise generated by concealment should be performed. */ /* set noise estimation inactive when we have bit errors, as no update with noise generated by corrupt frame (biterror) should be performed. */ +#ifndef FORCE_EST if ( concealWholeFrame == 0 && ( timeDomainInput == NULL || ( *timeDomainInput( -FLT_MAX ) && @@ -422,6 +423,17 @@ void ApplyFdCng( !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || ( st->element_mode == IVAS_CPE_TD ) ) && ( !st->BER_detect ) ) +#else + if ( concealWholeFrame == 0 && + ( timeDomainInput == NULL || + ( *timeDomainInput( -FLT_MAX ) && + *( timeDomainInput + hFdCngCom->frameSize - 1 ) < FLT_MAX && + *( timeDomainInput + hFdCngCom->frameSize - 1 ) > ( -FLT_MAX ) ) ) && + ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && hFdCngDec->flag_dtx_mode ) || !st->VAD || ( st->ini_frame < 100 && st->is_ism_mode ) ) && + !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || + ( st->element_mode == IVAS_CPE_TD ) ) && + ( !st->BER_detect ) ) +#endif { /* Perform noise estimation at the decoder */ perform_noise_estimation_dec( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index af8c938b0f..523d505acd 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -742,6 +742,9 @@ ivas_error init_decoder( st->cng_ism_flag = 0; st->read_sid_info = 1; /* by default read the sid info from bitstream */ #endif +#ifdef FORCE_EST + st->is_ism_mode = 0; +#endif return error; diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 02601d1ba1..805c83e6e8 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -374,6 +374,12 @@ ivas_error create_sce_dec( { return error; } +#ifdef FORCE_EST + if ( st_ivas->ivas_format == ISM_FORMAT ) + { + st->is_ism_mode = 1; + } +#endif if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) { diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 65e4e362ef..7c6972b7f5 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1349,6 +1349,9 @@ typedef struct Decoder_State int16_t cng_ism_flag; /* CNG in Param-ISM flag */ int16_t read_sid_info; /* For ParamISM, use the transmitted noise */ #endif +#ifdef FORCE_EST + int16_t is_ism_mode; /* Indicator if codec operates in ISM mode */ +#endif } Decoder_State, *DEC_CORE_HANDLE; -- GitLab From e9b0928220c987d570c36e9fc5f2844ceee49bd0 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 9 Mar 2023 22:42:18 +0100 Subject: [PATCH 210/375] fix parameters declarations as reported by Ericsson --- lib_dec/ivas_ism_dtx_dec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 6dc9b9845d..1e7323ff70 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -109,7 +109,8 @@ ivas_error ivas_ism_dtx_dec( #ifdef DISCRETE_ISM_DTX_CNG int16_t md_diff_flag[MAX_NUM_OBJECTS]; int16_t flag_noisy_speech, sce_id_dtx; - ISM_MODE last_ism_mode; + ISM_MODE last_ism_mode, ism_mode_bstr; + int16_t idx; #endif ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -161,9 +162,8 @@ ivas_error ivas_ism_dtx_dec( { pos -= num_obj; /* SID metadata flags */ - short idx = get_indice( st_ivas->hSCE[0]->hCoreCoder[0], pos, 1 ); - - ISM_MODE ism_mode_bstr = (ISM_MODE) ( idx + 1 ); + idx = get_indice( st_ivas->hSCE[0]->hCoreCoder[0], pos, 1 ); + ism_mode_bstr = (ISM_MODE) ( idx + 1 ); st_ivas->ism_mode = ism_mode_bstr; } -- GitLab From ab2dd41ffc8468bba120efe90317fb5597f1d6d1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 10 Mar 2023 10:49:42 +0100 Subject: [PATCH 211/375] avoid allocation of TD-CNG handle at the encoder --- lib_enc/init_enc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 683356c6c0..2dda2b4a78 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -467,7 +467,11 @@ ivas_error init_encoder( *-----------------------------------------------------------------*/ #ifdef PARAM_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG + if ( ( ( idchan == 0 && st->Opt_DTX_ON && st->element_mode != IVAS_CPE_MDCT ) || st->element_mode == EVS_MONO ) && !( ism_mode == ISM_MODE_PARAM || ism_mode == ISM_MODE_DISC ) ) +#else if ( ( ( idchan == 0 && st->Opt_DTX_ON && st->element_mode != IVAS_CPE_MDCT ) || st->element_mode == EVS_MONO ) && !( ism_mode == ISM_MODE_PARAM ) ) +#endif #else if ( ( ( idchan == 0 && st->Opt_DTX_ON && st->element_mode != IVAS_CPE_MDCT ) || st->element_mode == EVS_MONO ) ) #endif -- GitLab From 412077bee189fa3d2ed43fb730c14c181f1f2d9d Mon Sep 17 00:00:00 2001 From: malenov Date: Fri, 10 Mar 2023 11:53:04 +0100 Subject: [PATCH 212/375] Do not multiply by noccurences in the memory printout under MEM_COUNT_DETAILS --- lib_debug/wmc_auto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_debug/wmc_auto.c b/lib_debug/wmc_auto.c index 141052e5bd..029640a1db 100644 --- a/lib_debug/wmc_auto.c +++ b/lib_debug/wmc_auto.c @@ -1654,7 +1654,7 @@ static void mem_count_summary( void ) if ( ptr_record->noccurances > 1 ) { - sprintf( size_str, "%dx%d %s", ptr_record->noccurances, (int) ( ( ptr_record->noccurances * ptr_record->wc_heap_size_intra_frame ) >> Stat_Cnt_Size ), Count_Unit[Stat_Cnt_Size] ); + sprintf( size_str, "%dx%d %s", ptr_record->noccurances, (int) ( ptr_record->wc_heap_size_intra_frame >> Stat_Cnt_Size ), Count_Unit[Stat_Cnt_Size] ); } else { @@ -1741,7 +1741,7 @@ static void mem_count_summary( void ) if ( ptr_record->noccurances > 1 ) { - sprintf( size_str, "%dx%d %s", ptr_record->noccurances, (int) ( ( ptr_record->noccurances * ptr_record->wc_heap_size_inter_frame ) >> Stat_Cnt_Size ), Count_Unit[Stat_Cnt_Size] ); + sprintf( size_str, "%dx%d %s", ptr_record->noccurances, (int) ( ptr_record->wc_heap_size_inter_frame >> Stat_Cnt_Size ), Count_Unit[Stat_Cnt_Size] ); } else { -- GitLab From a1cad8f9988e3e8bdb3eaee2fe304f7c47d7781a Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 10 Mar 2023 12:20:41 +0100 Subject: [PATCH 213/375] error code returns for MASA/McMASA malloc() --- lib_com/ivas_prot.h | 2 +- lib_dec/ivas_masa_dec.c | 61 ++++++++++++++++++++++++++++++--------- lib_enc/ivas_enc.c | 12 ++++++-- lib_enc/ivas_masa_enc.c | 10 +++++-- lib_enc/ivas_mcmasa_enc.c | 55 ++++++++++++++++++++++++++++------- 5 files changed, 108 insertions(+), 32 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index f8d6d5ac18..2e663d7c71 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4484,7 +4484,7 @@ ivas_error ivas_masa_dec_reconfigure( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -void ivas_masa_encode( +ivas_error ivas_masa_encode( MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder structure */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 28c25de4a3..b8b7b74ffc 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -68,7 +68,7 @@ static void replicate_subframes( IVAS_QMETADATA_HANDLE hQMetaData ); static void restore_lowbitrate_masa( IVAS_QMETADATA_HANDLE hQMetaData, const int16_t low_bitrate_mode, const int16_t numCodingBands ); -static void init_lfe_synth_data( Decoder_Struct *st_ivas, MASA_DECODER_HANDLE hMasa ); +static ivas_error init_lfe_synth_data( Decoder_Struct *st_ivas, MASA_DECODER_HANDLE hMasa ); static void compute_foa_cov_matrix( float foaCov[FOA_CHANNELS][FOA_CHANNELS], float inCov[FOA_CHANNELS][FOA_CHANNELS], float mixMtx[FOA_CHANNELS][FOA_CHANNELS] ); @@ -314,6 +314,7 @@ ivas_error ivas_masa_decode( create_masa_ext_out_meta( hMasa, hQMetaData, st_ivas->nchan_transport ); } #endif + return error /* *nb_bits_read*/; } @@ -329,6 +330,9 @@ ivas_error ivas_masa_dec_open( ) { MASA_DECODER_HANDLE hMasa; + ivas_error error; + + error = IVAS_ERR_OK; if ( ( hMasa = (MASA_DECODER_HANDLE) malloc( sizeof( MASA_DECODER ) ) ) == NULL ) { @@ -345,10 +349,17 @@ ivas_error ivas_masa_dec_open( /* Create spherical grid only for external output */ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { - hMasa->data.sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ); + if ( ( hMasa->data.sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } + generate_gridEq( hMasa->data.sph_grid16 ); #ifdef FIX_350_MASA_DELAY_COMP - hMasa->data.extOutMeta = (MASA_DECODER_EXT_OUT_META *) malloc( sizeof( MASA_DECODER_EXT_OUT_META ) ); + if ( ( hMasa->data.extOutMeta = (MASA_DECODER_EXT_OUT_META *) malloc( sizeof( MASA_DECODER_EXT_OUT_META ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } #endif } else @@ -361,7 +372,7 @@ ivas_error ivas_masa_dec_open( if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { - init_lfe_synth_data( st_ivas, hMasa ); + error = init_lfe_synth_data( st_ivas, hMasa ); } else { @@ -370,7 +381,7 @@ ivas_error ivas_masa_dec_open( st_ivas->hMasa = hMasa; - return IVAS_ERR_OK; + return error; } @@ -398,6 +409,7 @@ void ivas_masa_dec_close( hMasa->data.extOutMeta = NULL; } #endif + if ( hMasa->hMasaLfeSynth != NULL ) { if ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer != NULL ) @@ -811,7 +823,7 @@ static void restore_lowbitrate_masa( } -static void init_lfe_synth_data( +static ivas_error init_lfe_synth_data( Decoder_Struct *st_ivas, /* i : IVAS decoder struct */ MASA_DECODER_HANDLE hMasa /* i/o: MASA decoder structure */ ) @@ -822,7 +834,10 @@ static void init_lfe_synth_data( output_Fs = st_ivas->hDecoderConfig->output_Fs; output_config = st_ivas->hDecoderConfig->output_config; - hMasa->hMasaLfeSynth = (MCMASA_LFE_SYNTH_DATA_HANDLE) malloc( sizeof( MCMASA_LFE_SYNTH_DATA ) ); + if ( ( hMasa->hMasaLfeSynth = (MCMASA_LFE_SYNTH_DATA_HANDLE) malloc( sizeof( MCMASA_LFE_SYNTH_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } hMasa->hMasaLfeSynth->transportEneSmooth = 0.0f; hMasa->hMasaLfeSynth->protoLfeEneSmooth = 0.0f; @@ -846,7 +861,10 @@ static void init_lfe_synth_data( /* Ring buffer for the filterbank of the LFE synthesis. * The filterbank is using moving average lowpass filter with the crossover of 120 Hz. */ bufferSize = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES ); - hMasa->hMasaLfeSynth->lfeSynthRingBuffer = (float *) malloc( bufferSize * sizeof( float ) ); + if ( ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } set_zero( hMasa->hMasaLfeSynth->lfeSynthRingBuffer, bufferSize ); hMasa->hMasaLfeSynth->ringBufferLoPointer = 0; hMasa->hMasaLfeSynth->ringBufferHiPointer = bufferSize / 2; @@ -856,7 +874,10 @@ static void init_lfe_synth_data( /* Ring buffer for additional lowpass filter for the LFE signal. * Moving average lowpass filter with the crossover of 240 Hz. */ bufferSize /= 2; - hMasa->hMasaLfeSynth->lfeSynthRingBuffer2 = (float *) malloc( bufferSize * sizeof( float ) ); + if ( ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2 = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } set_zero( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2, bufferSize ); hMasa->hMasaLfeSynth->ringBufferLoPointer2 = 0; hMasa->hMasaLfeSynth->lowpassSum2 = 0.0f; @@ -864,13 +885,19 @@ static void init_lfe_synth_data( /* Delay buffer for matching the delay of the lowpass filter */ bufferSize /= 2; /* The delay of the moving average lowpass filter is bufferSize / 2 */ - hMasa->hMasaLfeSynth->delayBuffer_syncLp = (float *) malloc( bufferSize * sizeof( float ) ); + if ( ( hMasa->hMasaLfeSynth->delayBuffer_syncLp = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } set_zero( hMasa->hMasaLfeSynth->delayBuffer_syncLp, bufferSize ); hMasa->hMasaLfeSynth->delayBuffer_syncLp_size = bufferSize; /* Delay buffer for syncing with DirAC rendering */ bufferSize = NS2SA( output_Fs, IVAS_FB_DEC_DELAY_NS ) - hMasa->hMasaLfeSynth->ringBufferSize / 2 - hMasa->hMasaLfeSynth->ringBufferSize2 / 2; - hMasa->hMasaLfeSynth->delayBuffer_syncDirAC = (float *) malloc( bufferSize * sizeof( float ) ); + if ( ( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } set_zero( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC, bufferSize ); hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size = bufferSize; @@ -889,7 +916,10 @@ static void init_lfe_synth_data( /* Delay buffer for syncing with DirAC rendering */ bufferSize = NS2SA( output_Fs, IVAS_FB_DEC_DELAY_NS ); - hMasa->hMasaLfeSynth->delayBuffer_syncDirAC = (float *) malloc( bufferSize * sizeof( float ) ); + if ( ( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } set_zero( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC, bufferSize ); hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size = bufferSize; @@ -905,7 +935,7 @@ static void init_lfe_synth_data( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC = NULL; } - return; + return IVAS_ERR_OK; } @@ -1378,7 +1408,10 @@ static void compute_foa_cov_matrix( } #ifdef FIX_350_MASA_DELAY_COMP -static void create_masa_ext_out_meta( MASA_DECODER *hMasa, IVAS_QMETADATA_HANDLE hQMetaData, const int16_t nchan_transport ) +static void create_masa_ext_out_meta( + MASA_DECODER *hMasa, + IVAS_QMETADATA_HANDLE hQMetaData, + const int16_t nchan_transport ) { const uint8_t ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */ int16_t i, sf, b_old, b_new, dir; diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 5392fc8331..0500a8e775 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -237,8 +237,11 @@ ivas_error ivas_enc( ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); - ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, - ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 ); + if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, + ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 ) ) != IVAS_ERR_OK ) + { + return error; + } } } else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) @@ -330,7 +333,10 @@ ivas_error ivas_enc( ivas_mcmasa_enc( st_ivas->hMcMasa, st_ivas->hQMetaData, st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport, nchan_inp ); - ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, 0, -1 ); + if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, 0, -1 ) ) != IVAS_ERR_OK ) + { + return error; + } if ( st_ivas->hMcMasa->separateChannelEnabled ) { diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index c2b6b5423b..dca9be4010 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -187,7 +187,7 @@ void ivas_masa_enc_close( * main MASA encoder function *-----------------------------------------------------------------------*/ -void ivas_masa_encode( +ivas_error ivas_masa_encode( MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder structure */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ @@ -226,7 +226,11 @@ void ivas_masa_encode( if ( Opt_DTX_ON ) { - h_orig_metadata = (MASA_DIRECTIONAL_SPATIAL_META *) malloc( MASA_MAXIMUM_DIRECTIONS * sizeof( MASA_DIRECTIONAL_SPATIAL_META ) ); + if ( ( h_orig_metadata = (MASA_DIRECTIONAL_SPATIAL_META *) malloc( MASA_MAXIMUM_DIRECTIONS * sizeof( MASA_DIRECTIONAL_SPATIAL_META ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA encoder\n" ) ); + } + for ( i = 0; i < MASA_MAXIMUM_DIRECTIONS; i++ ) { for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) @@ -368,7 +372,7 @@ void ivas_masa_encode( hQMetaData->no_directions = numberOfDirectionsQMetaData; } - return; + return IVAS_ERR_OK; } diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index 6ac686b01e..153bc3ecad 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -110,7 +110,7 @@ ivas_error ivas_mcmasa_enc_open( assert( st_ivas->hMasa != NULL && "MASA encoder handle is not present" ); hMasa = st_ivas->hMasa; - if ( NULL == ( hMcMasa = (MCMASA_ENC_HANDLE) malloc( sizeof( MCMASA_ENC_DATA ) ) ) ) + if ( ( hMcMasa = (MCMASA_ENC_HANDLE) malloc( sizeof( MCMASA_ENC_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); } @@ -207,9 +207,16 @@ ivas_error ivas_mcmasa_enc_open( if ( hMcMasa->separateChannelEnabled ) { /* TD Energy calculation with LP */ - hMcMasa->delay_buffer_lfe[0] = (float *) malloc( NS2SA( input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_ENC_NS ) * sizeof( float ) ); + if ( ( hMcMasa->delay_buffer_lfe[0] = (float *) malloc( NS2SA( input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_ENC_NS ) * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } set_zero( hMcMasa->delay_buffer_lfe[0], NS2SA( input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_ENC_NS ) ); - hMcMasa->delay_buffer_lfe[1] = (float *) malloc( NS2SA( input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_ENC_NS ) * sizeof( float ) ); + + if ( ( hMcMasa->delay_buffer_lfe[1] = (float *) malloc( NS2SA( input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_ENC_NS ) * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } set_zero( hMcMasa->delay_buffer_lfe[1], NS2SA( input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_ENC_NS ) ); hMcMasa->hFbMixerLfe = NULL; } @@ -243,7 +250,10 @@ ivas_error ivas_mcmasa_enc_open( bufferSize = (int16_t) ( ( input_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES ); for ( i = 0; i < 2; i++ ) { - hMcMasa->lfeAnaRingBuffer[i] = (float *) malloc( bufferSize * sizeof( float ) ); + if ( ( hMcMasa->lfeAnaRingBuffer[i] = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } set_zero( hMcMasa->lfeAnaRingBuffer[i], bufferSize ); hMcMasa->lowpassSum[i] = 0.0f; } @@ -257,33 +267,56 @@ ivas_error ivas_mcmasa_enc_open( /* intensity 3-dim */ for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - hMcMasa->direction_vector_m[i] = (float **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ); + if ( ( hMcMasa->direction_vector_m[i] = (float **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { - hMcMasa->direction_vector_m[i][j] = (float *) malloc( hMcMasa->nbands * sizeof( float ) ); + if ( ( hMcMasa->direction_vector_m[i][j] = (float *) malloc( hMcMasa->nbands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } } } hMcMasa->no_col_avg_diff = (int8_t) ( DIRAC_NO_COL_AVG_DIFF_NS / dirac_slot_ns ); for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - hMcMasa->buffer_intensity_real[i] = (float **) malloc( hMcMasa->no_col_avg_diff * sizeof( float * ) ); + if ( ( hMcMasa->buffer_intensity_real[i] = (float **) malloc( hMcMasa->no_col_avg_diff * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } + for ( j = 0; j < hMcMasa->no_col_avg_diff; j++ ) { - hMcMasa->buffer_intensity_real[i][j] = (float *) malloc( hMcMasa->nbands * sizeof( float ) ); + if ( ( hMcMasa->buffer_intensity_real[i][j] = (float *) malloc( hMcMasa->nbands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } set_zero( hMcMasa->buffer_intensity_real[i][j], hMcMasa->nbands ); } } - hMcMasa->buffer_intensity_real_vert = (float **) malloc( hMcMasa->no_col_avg_diff * sizeof( float * ) ); + if ( ( hMcMasa->buffer_intensity_real_vert = (float **) malloc( hMcMasa->no_col_avg_diff * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } + for ( j = 0; j < hMcMasa->no_col_avg_diff; j++ ) { - hMcMasa->buffer_intensity_real_vert[j] = (float *) malloc( hMcMasa->nbands * sizeof( float ) ); + if ( ( hMcMasa->buffer_intensity_real_vert[j] = (float *) malloc( hMcMasa->nbands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } set_zero( hMcMasa->buffer_intensity_real_vert[j], hMcMasa->nbands ); } - hMcMasa->buffer_energy = (float *) malloc( hMcMasa->nbands * hMcMasa->no_col_avg_diff * sizeof( float ) ); + if ( ( hMcMasa->buffer_energy = (float *) malloc( hMcMasa->nbands * hMcMasa->no_col_avg_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } set_zero( hMcMasa->buffer_energy, hMcMasa->nbands * hMcMasa->no_col_avg_diff ); if ( st_ivas->hEncoderConfig->mc_input_setup == MC_LS_SETUP_5_1 ) -- GitLab From 2549b216dc5b3962d49dcec9d3fc412916239327 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Fri, 10 Mar 2023 14:05:03 +0200 Subject: [PATCH 214/375] Fix build warnings created by FIX_350_MASA_DELAY_COMP --- lib_util/masa_file_writer.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib_util/masa_file_writer.c b/lib_util/masa_file_writer.c index 6daa2d2092..5667968ece 100644 --- a/lib_util/masa_file_writer.c +++ b/lib_util/masa_file_writer.c @@ -100,7 +100,6 @@ static void delayMasaMetadata( ) { int16_t dir, sf, band; - uint16_t temp; uint8_t currentNumberOfDirections; /* Move meta to delay and output. Always use two directions as the metadata is prepared to contain zero energy second direction @@ -109,33 +108,35 @@ static void delayMasaMetadata( { for ( band = 0; band < MASA_FREQUENCY_BANDS; band++ ) { + uint16_t temp_u16; + uint8_t temp_u8; for ( dir = 0; dir < MASA_MAXIMUM_DIRECTIONS; dir++ ) { - temp = delayStorage->directionIndex[dir][sf][band]; + temp_u16 = delayStorage->directionIndex[dir][sf][band]; delayStorage->directionIndex[dir][sf][band] = extOutMeta->directionIndex[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band]; extOutMeta->directionIndex[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->directionIndex[dir][sf][band]; - extOutMeta->directionIndex[dir][sf][band] = temp; + extOutMeta->directionIndex[dir][sf][band] = temp_u16; - temp = delayStorage->directToTotalRatio[dir][sf][band]; + temp_u8 = delayStorage->directToTotalRatio[dir][sf][band]; delayStorage->directToTotalRatio[dir][sf][band] = extOutMeta->directToTotalRatio[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band]; extOutMeta->directToTotalRatio[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->directToTotalRatio[dir][sf][band]; - extOutMeta->directToTotalRatio[dir][sf][band] = temp; + extOutMeta->directToTotalRatio[dir][sf][band] = temp_u8; - temp = delayStorage->spreadCoherence[dir][sf][band]; + temp_u8 = delayStorage->spreadCoherence[dir][sf][band]; delayStorage->spreadCoherence[dir][sf][band] = extOutMeta->spreadCoherence[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band]; extOutMeta->spreadCoherence[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->spreadCoherence[dir][sf][band]; - extOutMeta->spreadCoherence[dir][sf][band] = temp; + extOutMeta->spreadCoherence[dir][sf][band] = temp_u8; } - temp = delayStorage->surroundCoherence[sf][band]; + temp_u8 = delayStorage->surroundCoherence[sf][band]; delayStorage->surroundCoherence[sf][band] = extOutMeta->surroundCoherence[sf + DELAY_MASA_PARAM_DEC_SFR][band]; extOutMeta->surroundCoherence[sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->surroundCoherence[sf][band]; - extOutMeta->surroundCoherence[sf][band] = temp; + extOutMeta->surroundCoherence[sf][band] = temp_u8; - temp = delayStorage->diffuseToTotalRatio[sf][band]; + temp_u8 = delayStorage->diffuseToTotalRatio[sf][band]; delayStorage->diffuseToTotalRatio[sf][band] = extOutMeta->diffuseToTotalRatio[sf + DELAY_MASA_PARAM_DEC_SFR][band]; extOutMeta->diffuseToTotalRatio[sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->diffuseToTotalRatio[sf][band]; - extOutMeta->diffuseToTotalRatio[sf][band] = temp; + extOutMeta->diffuseToTotalRatio[sf][band] = temp_u8; } } -- GitLab From a5cf21b745c56561f7212db01e8321b0278a3a78 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 10 Mar 2023 14:21:35 +0100 Subject: [PATCH 215/375] error code returns for other malloc() cases --- lib_com/cldfb.c | 9 +- lib_com/fd_cng_com.c | 4 +- lib_com/ivas_prot.h | 8 +- lib_com/ivas_qmetadata_com.c | 82 +++-- lib_com/wi.c | 4 +- lib_dec/fd_cng_dec.c | 3 +- lib_dec/ivas_dirac_dec.c | 347 +++++++++++++++++----- lib_dec/ivas_dirac_decorr_dec.c | 94 ++++-- lib_dec/ivas_dirac_onsets_dec.c | 14 +- lib_dec/ivas_dirac_output_synthesis_cov.c | 35 ++- lib_dec/ivas_dirac_output_synthesis_dec.c | 97 ++++-- lib_dec/ivas_init_dec.c | 5 +- lib_dec/ivas_ism_param_dec.c | 107 +++++-- lib_dec/ivas_mc_param_dec.c | 205 +++++++++---- lib_dec/ivas_out_setup_conversion.c | 21 +- lib_dec/ivas_vbap.c | 106 +++++-- lib_dec/jbm_jb4_circularbuffer.c | 19 +- lib_dec/jbm_jb4_circularbuffer.h | 2 +- lib_dec/jbm_jb4_inputbuffer.c | 25 +- lib_dec/jbm_jb4_inputbuffer.h | 7 +- lib_dec/jbm_jb4_jmf.c | 48 ++- lib_dec/jbm_jb4_jmf.h | 6 +- lib_dec/jbm_jb4sb.c | 76 +++-- lib_dec/jbm_jb4sb.h | 6 +- lib_dec/jbm_pcmdsp_apa.c | 18 +- lib_dec/jbm_pcmdsp_apa.h | 4 +- lib_dec/jbm_pcmdsp_fifo.c | 21 +- lib_dec/jbm_pcmdsp_fifo.h | 4 +- lib_dec/lib_dec.c | 11 +- lib_enc/fd_cng_enc.c | 3 +- lib_enc/ivas_dirac_enc.c | 31 +- lib_rend/ivas_limiter.c | 5 +- lib_rend/ivas_objectRenderer_mix.c | 60 +++- lib_rend/ivas_objectRenderer_sources.c | 10 +- lib_rend/ivas_prot_rend.h | 5 - lib_rend/ivas_render_config.c | 3 +- lib_rend/lib_rend.c | 5 +- 37 files changed, 1070 insertions(+), 440 deletions(-) diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 61539e2355..931fbc723b 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -706,8 +706,7 @@ ivas_error openCldfb( HANDLE_CLDFB_FILTER_BANK hs; int16_t buf_len; - hs = (HANDLE_CLDFB_FILTER_BANK) malloc( sizeof( CLDFB_FILTER_BANK ) ); - if ( hs == NULL ) + if ( ( hs = (HANDLE_CLDFB_FILTER_BANK) malloc( sizeof( CLDFB_FILTER_BANK ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB" ); } @@ -728,8 +727,7 @@ ivas_error openCldfb( buf_len = hs->p_filter_length; } - hs->cldfb_state = (float *) malloc( buf_len * sizeof( float ) ); - if ( hs->cldfb_state == NULL ) + if ( ( hs->cldfb_state = (float *) malloc( buf_len * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB" ); } @@ -1148,8 +1146,7 @@ ivas_error cldfb_save_memory( hs->memory_length = hs->p_filter_length; } - hs->memory = (float *) malloc( hs->memory_length * sizeof( float ) ); - if ( hs->memory == NULL ) + if ( ( hs->memory = (float *) malloc( hs->memory_length * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB\n" ); } diff --git a/lib_com/fd_cng_com.c b/lib_com/fd_cng_com.c index 0203cd4fb7..f2dbf746b6 100644 --- a/lib_com/fd_cng_com.c +++ b/lib_com/fd_cng_com.c @@ -68,9 +68,7 @@ ivas_error createFdCngCom( HANDLE_FD_CNG_COM hs; /* Allocate memory */ - hs = (HANDLE_FD_CNG_COM) malloc( sizeof( FD_CNG_COM ) ); - - if ( hs == NULL ) + if ( ( hs = (HANDLE_FD_CNG_COM) malloc( sizeof( FD_CNG_COM ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FD CNG COM" ); } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 2e663d7c71..6711b998c9 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3346,7 +3346,7 @@ void computeDiffuseness( float *diffuseness ); -void ivas_dirac_dec_onset_detection_open( +ivas_error ivas_dirac_dec_onset_detection_open( const int16_t num_channels, const int16_t num_freq_bands, const int16_t max_band_decorr, @@ -3362,7 +3362,7 @@ void ivas_dirac_dec_onset_detection_process( DIRAC_ONSET_DETECTION_STATE h_dirac_onset_detection_state ); -void ivas_dirac_dec_decorr_open( +ivas_error ivas_dirac_dec_decorr_open( DIRAC_DECORR_PARAMS **ph_freq_domain_decorr_ap_params, DIRAC_DECORR_STATE **ph_freq_domain_decorr_ap_state, const int16_t num_freq_bands, @@ -3395,7 +3395,7 @@ void ivas_dirac_dec_decorr_close( ); -void ivas_dirac_dec_output_synthesis_open( +ivas_error ivas_dirac_dec_output_synthesis_open( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const RENDERER_TYPE renderer_type, /* i : renderer type */ const int16_t nchan_transport, /* i : number of transport channels */ @@ -3672,7 +3672,7 @@ int16_t svd( const int16_t nChannelsC /* i : number of columns in the matrix to be decomposed */ ); -void ivas_dirac_dec_output_synthesis_cov_open( +ivas_error ivas_dirac_dec_output_synthesis_cov_open( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: handle for the covariance synthesis state */ const int16_t max_band_decorr, /* i : uppermost frequency band where decorrelation is applied */ diff --git a/lib_com/ivas_qmetadata_com.c b/lib_com/ivas_qmetadata_com.c index 4f1fe47a1e..0f2491bad3 100644 --- a/lib_com/ivas_qmetadata_com.c +++ b/lib_com/ivas_qmetadata_com.c @@ -98,9 +98,8 @@ ivas_error ivas_qmetadata_allocate_memory( const int16_t coherence_flag /* i : new coherence coding status */ ) { - int16_t dir; + int16_t j, dir; uint8_t do_realloc; - uint8_t reservationFailed = 0; #ifdef DEBUGGING assert( hQMetaData != NULL ); @@ -126,68 +125,63 @@ ivas_error ivas_qmetadata_allocate_memory( hQMetaData->no_directions = ndirs; hQMetaData->coherence_flag = coherence_flag; - hQMetaData->q_direction = (IVAS_QDIRECTION *) malloc( sizeof( IVAS_QDIRECTION ) * ndirs ); - reservationFailed = hQMetaData->q_direction == NULL; + if ( ( hQMetaData->q_direction = (IVAS_QDIRECTION *) malloc( sizeof( IVAS_QDIRECTION ) * ndirs ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for Q MetaData" ); + } + - if ( !reservationFailed ) + for ( dir = 0; dir < hQMetaData->no_directions; dir++ ) { - for ( dir = 0; dir < hQMetaData->no_directions; dir++ ) + hQMetaData->q_direction[dir].cfg.nbands = nbands; + if ( nbands == 0 ) { - hQMetaData->q_direction[dir].cfg.nbands = nbands; - if ( nbands == 0 ) - { - hQMetaData->q_direction[dir].band_data = NULL; - } - else + hQMetaData->q_direction[dir].band_data = NULL; + } + else + { + if ( ( hQMetaData->q_direction[dir].band_data = (IVAS_QDIRECTION_BAND_DATA *) malloc( sizeof( IVAS_QDIRECTION_BAND_DATA ) * hQMetaData->q_direction[dir].cfg.nbands ) ) == NULL ) { - hQMetaData->q_direction[dir].band_data = (IVAS_QDIRECTION_BAND_DATA *) malloc( sizeof( IVAS_QDIRECTION_BAND_DATA ) * hQMetaData->q_direction[dir].cfg.nbands ); - { - int16_t j; - for ( j = 0; j < nbands; j++ ) - { - set_zero( hQMetaData->q_direction[dir].band_data[j].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); - set_zero( hQMetaData->q_direction[dir].band_data[j].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); - } - } - - - reservationFailed |= hQMetaData->q_direction[dir].band_data == NULL; + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for Q MetaData" ); } - if ( coherence_flag ) + for ( j = 0; j < nbands; j++ ) { - hQMetaData->q_direction[dir].coherence_band_data = (IVAS_QDIRECTION_BAND_COHERENCE_DATA *) malloc( sizeof( IVAS_QDIRECTION_BAND_COHERENCE_DATA ) * hQMetaData->q_direction[dir].cfg.nbands ); - reservationFailed |= hQMetaData->q_direction[dir].coherence_band_data == NULL; + set_zero( hQMetaData->q_direction[dir].band_data[j].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); + set_zero( hQMetaData->q_direction[dir].band_data[j].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); } - else - { - hQMetaData->q_direction[dir].coherence_band_data = NULL; - } - - /* These default values are set here to get them conveniently in one place */ - hQMetaData->q_direction[dir].cfg.nblocks = MAX_PARAM_SPATIAL_SUBFRAMES; - hQMetaData->q_direction[dir].cfg.search_effort = 3; - hQMetaData->q_direction[dir].cfg.start_band = 0; - hQMetaData->q_direction[dir].cfg.mc_ls_setup = MC_LS_SETUP_INVALID; } if ( coherence_flag ) { - hQMetaData->surcoh_band_data = (IVAS_SURROUND_COHERENCE_BAND_DATA *) malloc( sizeof( IVAS_SURROUND_COHERENCE_BAND_DATA ) * hQMetaData->q_direction[0].cfg.nbands ); - reservationFailed |= hQMetaData->surcoh_band_data == NULL; + hQMetaData->q_direction[dir].coherence_band_data = (IVAS_QDIRECTION_BAND_COHERENCE_DATA *) malloc( sizeof( IVAS_QDIRECTION_BAND_COHERENCE_DATA ) * hQMetaData->q_direction[dir].cfg.nbands ); } else { - hQMetaData->surcoh_band_data = NULL; + hQMetaData->q_direction[dir].coherence_band_data = NULL; } + + /* These default values are set here to get them conveniently in one place */ + hQMetaData->q_direction[dir].cfg.nblocks = MAX_PARAM_SPATIAL_SUBFRAMES; + hQMetaData->q_direction[dir].cfg.search_effort = 3; + hQMetaData->q_direction[dir].cfg.start_band = 0; + hQMetaData->q_direction[dir].cfg.mc_ls_setup = MC_LS_SETUP_INVALID; } - } - if ( reservationFailed ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Q MetaData\n" ) ); + if ( coherence_flag ) + { + if ( ( hQMetaData->surcoh_band_data = (IVAS_SURROUND_COHERENCE_BAND_DATA *) malloc( sizeof( IVAS_SURROUND_COHERENCE_BAND_DATA ) * hQMetaData->q_direction[0].cfg.nbands ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for Q MetaData" ); + } + } + else + { + hQMetaData->surcoh_band_data = NULL; + } } + return IVAS_ERR_OK; } diff --git a/lib_com/wi.c b/lib_com/wi.c index 7710f75789..7ec30010fe 100644 --- a/lib_com/wi.c +++ b/lib_com/wi.c @@ -73,9 +73,7 @@ ivas_error DTFS_new( int16_t i; DTFS_STRUCTURE *dtfs = NULL; - dtfs = (DTFS_STRUCTURE *) malloc( sizeof( DTFS_STRUCTURE ) ); - - if ( dtfs == NULL ) + if ( ( dtfs = (DTFS_STRUCTURE *) malloc( sizeof( DTFS_STRUCTURE ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DTFS (SC-VBR) structure\n" ) ); } diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 200ca7bcc7..515188369c 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -83,8 +83,7 @@ ivas_error createFdCngDec( *hFdCngDec = NULL; /* Allocate memory */ - hs = (HANDLE_FD_CNG_DEC) malloc( sizeof( FD_CNG_DEC ) ); - if ( hs == NULL ) + if ( ( hs = (HANDLE_FD_CNG_DEC) malloc( sizeof( FD_CNG_DEC ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for FD CNG DEC structure" ); } diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 14b8d91aff..649cd43b5c 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -51,7 +51,7 @@ * Local function prototypes *-----------------------------------------------------------------------*/ -static void ivas_dirac_alloc_mem( DIRAC_DEC_HANDLE hDirAC, const RENDERER_TYPE renderer_type, DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ); +static ivas_error ivas_dirac_alloc_mem( DIRAC_DEC_HANDLE hDirAC, const RENDERER_TYPE renderer_type, DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ); static void ivas_dirac_free_mem( DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ); @@ -297,7 +297,10 @@ 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->frequency_axis = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + 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" ) ); + } set_f( hDirAC->frequency_axis, 0.0f, hDirAC->num_freq_bands ); ivas_dirac_dec_get_frequency_axis( hDirAC->frequency_axis, output_Fs, hDirAC->num_freq_bands ); @@ -307,7 +310,10 @@ ivas_error ivas_dirac_dec_config( { if ( ( flag_config == DIRAC_RECONFIGURE && hDirAC->masa_stereo_type_detect == NULL ) || flag_config == DIRAC_OPEN ) { - hDirAC->masa_stereo_type_detect = (MASA_STEREO_TYPE_DETECT *) malloc( sizeof( MASA_STEREO_TYPE_DETECT ) ); + if ( ( hDirAC->masa_stereo_type_detect = (MASA_STEREO_TYPE_DETECT *) malloc( sizeof( MASA_STEREO_TYPE_DETECT ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } ivas_masa_init_stereotype_detection( hDirAC->masa_stereo_type_detect ); } @@ -375,22 +381,34 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { num_outputs_dir_old = hDirAC->num_outputs_dir; - hDirAC->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_dir ); + if ( ( hDirAC->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_dir ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } num_outputs_diff_old = hDirAC->num_outputs_diff; - hDirAC->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_diff ); + if ( ( hDirAC->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } if ( hDirAC->num_outputs_dir != num_outputs_dir_old && flag_config == DIRAC_RECONFIGURE ) { free( hDirAC->proto_index_dir ); - hDirAC->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_dir ); + if ( ( hDirAC->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_dir ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } set_s( hDirAC->proto_index_dir, 0, hDirAC->num_outputs_dir ); if ( hDirAC->num_outputs_diff != num_outputs_diff_old && flag_config == DIRAC_RECONFIGURE ) { free( hDirAC->proto_index_diff ); - hDirAC->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_diff ); + if ( ( hDirAC->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } set_s( hDirAC->proto_index_diff, 0, hDirAC->num_outputs_diff ); @@ -510,14 +528,20 @@ ivas_error ivas_dirac_dec_config( /* direct/diffuse responses */ if ( flag_config == DIRAC_OPEN ) { - hDirAC->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirAC->num_outputs_dir ); + if ( ( hDirAC->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirAC->num_outputs_dir ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } /* reallocate static memory */ else if ( flag_config == DIRAC_RECONFIGURE && hDirAC->num_outputs_dir != num_outputs_dir_old ) { free( hDirAC->diffuse_response_function ); hDirAC->diffuse_response_function = NULL; - hDirAC->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirAC->num_outputs_dir ); + if ( ( hDirAC->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirAC->num_outputs_dir ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } if ( ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) || ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) || ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) ) @@ -535,13 +559,19 @@ ivas_error ivas_dirac_dec_config( { if ( flag_config == DIRAC_OPEN ) { - hDirAC->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirAC->num_outputs_diff * sizeof( float ) ); + if ( ( hDirAC->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } else if ( flag_config == DIRAC_RECONFIGURE && hDirAC->hoa_encoder && ( hDirAC->num_outputs_diff != num_outputs_diff_old ) ) { free( hDirAC->hoa_encoder ); hDirAC->hoa_encoder = NULL; - hDirAC->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirAC->num_outputs_diff * sizeof( float ) ); + if ( ( hDirAC->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } set_f( hDirAC->hoa_encoder, 0.0f, nchan_out_woLFE * hDirAC->num_outputs_diff ); compute_hoa_encoder_mtx( ls_azimuth, ls_elevation, hDirAC->hoa_encoder, hDirAC->num_outputs_diff, hDirAC->hOutSetup.ambisonics_order ); @@ -623,15 +653,18 @@ ivas_error ivas_dirac_dec_config( if ( ( flag_config == DIRAC_OPEN && hDirAC->proto_signal_decorr_on ) || ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->proto_signal_decorr_on && !proto_signal_decorr_on_old ) ) ) { - ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), - &( hDirAC->h_freq_domain_decorr_ap_state ), - hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, - hDirAC->frequency_axis, - nchan_transport > 2 ? 4 : nchan_transport, - output_Fs ); + if ( ( error = ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), + &( hDirAC->h_freq_domain_decorr_ap_state ), + hDirAC->num_freq_bands, + hDirAC->num_outputs_diff, + hDirAC->num_protos_diff, + hDirAC->synthesisConf, + hDirAC->frequency_axis, + nchan_transport > 2 ? 4 : nchan_transport, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } } else if ( flag_config == DIRAC_RECONFIGURE && ( !hDirAC->proto_signal_decorr_on && proto_signal_decorr_on_old ) ) { @@ -644,28 +677,38 @@ ivas_error ivas_dirac_dec_config( /* close and reopen the decorrelator */ ivas_dirac_dec_decorr_close( &hDirAC->h_freq_domain_decorr_ap_params, &hDirAC->h_freq_domain_decorr_ap_state ); - ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), - &( hDirAC->h_freq_domain_decorr_ap_state ), - hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, - hDirAC->frequency_axis, - nchan_transport > 2 ? 4 : nchan_transport, - output_Fs ); + if ( ( error = ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), + &( hDirAC->h_freq_domain_decorr_ap_state ), + hDirAC->num_freq_bands, + hDirAC->num_outputs_diff, + hDirAC->num_protos_diff, + hDirAC->synthesisConf, + hDirAC->frequency_axis, + nchan_transport > 2 ? 4 : nchan_transport, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } } } /* output synthesis */ if ( flag_config == DIRAC_OPEN ) { - ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs ); + if ( ( ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } hDirAC->h_output_synthesis_psd_params.use_onset_filters = hDirAC->proto_signal_decorr_on; } else if ( ( flag_config == DIRAC_RECONFIGURE ) && ( ( nchan_transport != nchan_transport_old ) || ( hDirAC->num_outputs_diff != num_outputs_diff_old ) ) ) { ivas_dirac_dec_output_synthesis_close( hDirAC ); - ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs ); + + if ( ( ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } hDirAC->h_output_synthesis_psd_params.use_onset_filters = hDirAC->proto_signal_decorr_on; } @@ -690,13 +733,19 @@ ivas_error ivas_dirac_dec_config( { if ( flag_config == DIRAC_OPEN || ( flag_config == DIRAC_RECONFIGURE && hDirAC->proto_frame_f == NULL ) ) { - hDirAC->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirAC->num_protos_diff * hDirAC->num_freq_bands ); + if ( ( hDirAC->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirAC->num_protos_diff * hDirAC->num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } else if ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->num_protos_diff != num_protos_diff_old ) ) { proto_frame_f_old = hDirAC->proto_frame_f; free( proto_frame_f_old ); - hDirAC->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirAC->num_protos_diff * hDirAC->num_freq_bands ); + if ( ( hDirAC->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirAC->num_protos_diff * hDirAC->num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } } @@ -713,13 +762,19 @@ ivas_error ivas_dirac_dec_config( { for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { - hDirAC->buffer_intensity_real[i][j] = (float *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); + if ( ( hDirAC->buffer_intensity_real[i][j] = (float *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->buffer_intensity_real[i][j], 0.0f, CLDFB_NO_CHANNELS_MAX ); } } if ( hDirAC->buffer_energy == NULL ) { - hDirAC->buffer_energy = (float *) malloc( DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); + if ( ( hDirAC->buffer_energy = (float *) malloc( DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } set_f( hDirAC->buffer_energy, 0.0f, DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX ); } @@ -751,7 +806,10 @@ ivas_error ivas_dirac_dec_config( { ivas_dirac_free_mem( &( hDirAC->stack_mem ) ); } - ivas_dirac_alloc_mem( hDirAC, st_ivas->renderer_type, &( hDirAC->stack_mem ) ); + if ( ( error = ivas_dirac_alloc_mem( hDirAC, st_ivas->renderer_type, &( hDirAC->stack_mem ) ) ) != IVAS_ERR_OK ) + { + return error; + } mvs2s( DirAC_block_grouping, hDirAC->block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); @@ -801,45 +859,121 @@ ivas_error ivas_dirac_dec_config( } } - hDirAC->azimuth = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); - hDirAC->elevation = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); - hDirAC->diffuseness_vector = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); - hDirAC->energy_ratio1 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); - hDirAC->spreadCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); - hDirAC->surroundingCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); + if ( ( hDirAC->azimuth = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->elevation = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->diffuseness_vector = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->energy_ratio1 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->spreadCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->surroundingCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { - hDirAC->azimuth[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + if ( ( hDirAC->azimuth[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_s( hDirAC->azimuth[i], 0, hDirAC->num_freq_bands ); - hDirAC->elevation[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + + if ( ( hDirAC->elevation[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_s( hDirAC->elevation[i], 0, hDirAC->num_freq_bands ); - hDirAC->diffuseness_vector[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->diffuseness_vector[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->diffuseness_vector[i], 1.0f, hDirAC->num_freq_bands ); - hDirAC->energy_ratio1[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + if ( ( hDirAC->energy_ratio1[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->energy_ratio1[i], 0.0f, hDirAC->num_freq_bands ); - hDirAC->spreadCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->spreadCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->spreadCoherence[i], 0.0f, hDirAC->num_freq_bands ); - hDirAC->surroundingCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->surroundingCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->surroundingCoherence[i], 0.0f, hDirAC->num_freq_bands ); } if ( st_ivas->ivas_format == MASA_FORMAT ) { - hDirAC->azimuth2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); - hDirAC->elevation2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); - hDirAC->energy_ratio2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); - hDirAC->spreadCoherence2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); + if ( ( hDirAC->azimuth2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->elevation2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->energy_ratio2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->spreadCoherence2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { - hDirAC->azimuth2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + if ( ( hDirAC->azimuth2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_s( hDirAC->azimuth2[i], 0, hDirAC->num_freq_bands ); - hDirAC->elevation2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + + if ( ( hDirAC->elevation2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_s( hDirAC->elevation2[i], 0, hDirAC->num_freq_bands ); - hDirAC->energy_ratio2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + if ( ( hDirAC->energy_ratio2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->energy_ratio2[i], 0.0f, hDirAC->num_freq_bands ); - hDirAC->spreadCoherence2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->spreadCoherence2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->spreadCoherence2[i], 0.0f, hDirAC->num_freq_bands ); } } @@ -1103,7 +1237,7 @@ void ivas_dirac_dec_close( * Allocate stack memory for DirAC renderer *------------------------------------------------------------------------*/ -static void ivas_dirac_alloc_mem( +static ivas_error ivas_dirac_alloc_mem( DIRAC_DEC_HANDLE hDirAC, const RENDERER_TYPE renderer_type, DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ) @@ -1130,17 +1264,35 @@ static void ivas_dirac_alloc_mem( hDirAC_mem->frame_dec_f = NULL; if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - hDirAC_mem->cy_auto_dir_smooth = (float *) malloc( sizeof( float ) * size ); + if ( ( hDirAC_mem->cy_auto_dir_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } set_zero( hDirAC_mem->cy_auto_dir_smooth, size ); - hDirAC_mem->proto_power_smooth = (float *) malloc( sizeof( float ) * size ); + + if ( ( hDirAC_mem->proto_power_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } set_zero( hDirAC_mem->proto_power_smooth, size ); - hDirAC_mem->proto_power_diff_smooth = (float *) malloc( sizeof( float ) * size ); + + if ( ( hDirAC_mem->proto_power_diff_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } set_zero( hDirAC_mem->proto_power_diff_smooth, size ); - hDirAC_mem->direct_responses_square = (float *) malloc( sizeof( float ) * size ); + + if ( ( hDirAC_mem->direct_responses_square = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } set_zero( hDirAC_mem->direct_responses_square, size ); if ( hDirAC->proto_signal_decorr_on && ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) ) { - hDirAC_mem->frame_dec_f = (float *) malloc( sizeof( float ) * 2 * num_outputs_diff * num_freq_bands ); + if ( ( hDirAC_mem->frame_dec_f = (float *) malloc( sizeof( float ) * 2 * num_outputs_diff * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } } hDirAC->h_output_synthesis_psd_state.proto_power_smooth = hDirAC_mem->proto_power_smooth; @@ -1149,23 +1301,36 @@ static void ivas_dirac_alloc_mem( hDirAC->h_output_synthesis_psd_state.direct_responses_square = hDirAC_mem->direct_responses_square; /* Target and smoothed nrg factors/gains */ - hDirAC_mem->cy_cross_dir_smooth = (float *) malloc( sizeof( float ) * size ); + if ( ( hDirAC_mem->cy_cross_dir_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } set_zero( hDirAC_mem->cy_cross_dir_smooth, size ); + if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * size ); + if ( ( hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } set_zero( hDirAC_mem->cy_auto_diff_smooth, size ); } else { - hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands_diff ); + if ( ( hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } set_zero( hDirAC_mem->cy_auto_diff_smooth, num_outputs_diff * num_freq_bands_diff ); } hDirAC->h_output_synthesis_psd_state.cy_cross_dir_smooth = hDirAC_mem->cy_cross_dir_smooth; hDirAC->h_output_synthesis_psd_state.cy_auto_diff_smooth = hDirAC_mem->cy_auto_diff_smooth; /*Responses (gains/factors)*/ - hDirAC_mem->direct_responses = (float *) malloc( sizeof( float ) * size ); + if ( ( hDirAC_mem->direct_responses = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } set_zero( hDirAC_mem->direct_responses, size ); hDirAC->h_output_synthesis_psd_state.direct_responses = hDirAC_mem->direct_responses; @@ -1174,16 +1339,26 @@ static void ivas_dirac_alloc_mem( hDirAC_mem->proto_diffuse_buffer_f = NULL; if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) { - hDirAC_mem->proto_direct_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_protos_dir * num_freq_bands ); + if ( ( hDirAC_mem->proto_direct_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_protos_dir * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + if ( hDirAC->proto_signal_decorr_on ) { if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { - hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * size ); + if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } else { - hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_outputs_diff * num_freq_bands ); + if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_outputs_diff * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } } } @@ -1195,8 +1370,15 @@ static void ivas_dirac_alloc_mem( hDirAC_mem->diffuse_power_factor = NULL; if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) { - hDirAC_mem->direct_power_factor = (float *) malloc( sizeof( float ) * num_freq_bands ); - hDirAC_mem->diffuse_power_factor = (float *) malloc( sizeof( float ) * num_freq_bands ); + if ( ( hDirAC_mem->direct_power_factor = (float *) malloc( sizeof( float ) * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + + if ( ( hDirAC_mem->diffuse_power_factor = (float *) malloc( sizeof( float ) * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } hDirAC->h_output_synthesis_psd_state.direct_power_factor = hDirAC_mem->direct_power_factor; hDirAC->h_output_synthesis_psd_state.diffuse_power_factor = hDirAC_mem->diffuse_power_factor; @@ -1207,10 +1389,16 @@ static void ivas_dirac_alloc_mem( { if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) { - hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ); + if ( ( hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } if ( hDirAC->proto_signal_decorr_on ) { - hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands ); + if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } } } @@ -1218,15 +1406,22 @@ static void ivas_dirac_alloc_mem( { if ( num_protos_dir > 2 ) { - hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 5 * num_freq_bands ); + if ( ( hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 5 * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } + if ( hDirAC->proto_signal_decorr_on ) { - hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ); + if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } } - return; + return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_dirac_decorr_dec.c b/lib_dec/ivas_dirac_decorr_dec.c index 2d82bb0a3a..bcaa6cf2a1 100644 --- a/lib_dec/ivas_dirac_decorr_dec.c +++ b/lib_dec/ivas_dirac_decorr_dec.c @@ -70,10 +70,10 @@ static void lattice2allpass( const int16_t filter_length, const float *lattice_c /*------------------------------------------------------------------------- * ivas_dirac_dec_decorr_open() * - * + * Allocate and initialize TD decorrelator decoder handle *------------------------------------------------------------------------*/ -void ivas_dirac_dec_decorr_open( +ivas_error ivas_dirac_dec_decorr_open( DIRAC_DECORR_PARAMS **ph_freq_domain_decorr_ap_params, DIRAC_DECORR_STATE **ph_freq_domain_decorr_ap_state, const int16_t num_freq_bands, @@ -91,6 +91,7 @@ void ivas_dirac_dec_decorr_open( int16_t split_frequencies_bands[DIRAC_DECORR_NUM_SPLIT_BANDS + 1] = { 0, 0, 0, 23768 }; int16_t *split_freq_ptr; float cur_lattice_delta_phi, lattice_coeffs[2 * DIRAC_MAX_DECORR_FILTER_LEN]; + ivas_error error; /* pointers to structs for allocation */ DIRAC_DECORR_PARAMS *freq_domain_decorr_ap_params = NULL; @@ -101,8 +102,15 @@ void ivas_dirac_dec_decorr_open( *-----------------------------------------------------------------*/ /* allocate structs */ - freq_domain_decorr_ap_params = (DIRAC_DECORR_PARAMS *) malloc( sizeof( DIRAC_DECORR_PARAMS ) ); - freq_domain_decorr_ap_state = (DIRAC_DECORR_STATE *) malloc( sizeof( DIRAC_DECORR_STATE ) ); + if ( ( freq_domain_decorr_ap_params = (DIRAC_DECORR_PARAMS *) malloc( sizeof( DIRAC_DECORR_PARAMS ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } + + if ( ( freq_domain_decorr_ap_state = (DIRAC_DECORR_STATE *) malloc( sizeof( DIRAC_DECORR_STATE ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } /*-----------------------------------------------------------------* * check input parameters @@ -164,7 +172,6 @@ void ivas_dirac_dec_decorr_open( } } - /*-----------------------------------------------------------------* * open sub-modules *-----------------------------------------------------------------*/ @@ -173,21 +180,17 @@ void ivas_dirac_dec_decorr_open( if ( synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { /*Onset detector up to Nyquist and not only up to max_band_decorr*/ - ivas_dirac_dec_onset_detection_open( - num_protos_diff, - num_freq_bands, - num_freq_bands, - &freq_domain_decorr_ap_params->h_onset_detection_power_params, - &freq_domain_decorr_ap_state->h_onset_detection_power_state ); + if ( ( error = ivas_dirac_dec_onset_detection_open( num_protos_diff, num_freq_bands, num_freq_bands, &freq_domain_decorr_ap_params->h_onset_detection_power_params, &freq_domain_decorr_ap_state->h_onset_detection_power_state ) ) != IVAS_ERR_OK ) + { + return error; + } } else { - ivas_dirac_dec_onset_detection_open( - num_protos_diff, - num_freq_bands, - freq_domain_decorr_ap_params->max_band_decorr, - &freq_domain_decorr_ap_params->h_onset_detection_power_params, - &freq_domain_decorr_ap_state->h_onset_detection_power_state ); + if ( ( error = ivas_dirac_dec_onset_detection_open( num_protos_diff, num_freq_bands, freq_domain_decorr_ap_params->max_band_decorr, &freq_domain_decorr_ap_params->h_onset_detection_power_params, &freq_domain_decorr_ap_state->h_onset_detection_power_state ) ) != IVAS_ERR_OK ) + { + return error; + } } /*-----------------------------------------------------------------* @@ -215,7 +218,10 @@ void ivas_dirac_dec_decorr_open( } } - freq_domain_decorr_ap_params->split_frequency_bands = (int16_t *) malloc( sizeof( int16_t ) * ( freq_domain_decorr_ap_params->num_split_frequency_bands + 1 ) ); + if ( ( freq_domain_decorr_ap_params->split_frequency_bands = (int16_t *) malloc( sizeof( int16_t ) * ( freq_domain_decorr_ap_params->num_split_frequency_bands + 1 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } mvs2s( &split_frequencies_bands[0], freq_domain_decorr_ap_params->split_frequency_bands, freq_domain_decorr_ap_params->num_split_frequency_bands + 1 ); /* calc buffer size and allocate arrays */ @@ -232,18 +238,50 @@ void ivas_dirac_dec_decorr_open( if ( num_outputs_diff > 0 ) { buffer_size_decorr = ( ap_pre_delay[split_band_index_start] + ap_filter_length[split_band_index_start] ); - freq_domain_decorr_ap_state->decorr_buffer = (float *) malloc( sizeof( float ) * 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr ); + if ( ( freq_domain_decorr_ap_state->decorr_buffer = (float *) malloc( sizeof( float ) * 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } set_f( freq_domain_decorr_ap_state->decorr_buffer, 0.0f, 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr ); - freq_domain_decorr_ap_params->filter_coeff_num_real = (float *) malloc( sizeof( float ) * ( ap_filter_length[split_band_index_start] + 1 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); - freq_domain_decorr_ap_params->filter_coeff_den_real = (float *) malloc( sizeof( float ) * ( ap_filter_length[split_band_index_start] + 1 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); - freq_domain_decorr_ap_params->phase_coeff_real = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); - freq_domain_decorr_ap_params->phase_coeff_imag = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); - freq_domain_decorr_ap_state->direct_energy_smooth = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); - freq_domain_decorr_ap_state->reverb_energy_smooth = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); + if ( ( freq_domain_decorr_ap_params->filter_coeff_num_real = (float *) malloc( sizeof( float ) * ( ap_filter_length[split_band_index_start] + 1 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } - freq_domain_decorr_ap_params->pre_delay = (int16_t *) malloc( sizeof( int16_t ) * freq_domain_decorr_ap_params->num_split_frequency_bands ); - freq_domain_decorr_ap_params->filter_length = (int16_t *) malloc( sizeof( int16_t ) * freq_domain_decorr_ap_params->num_split_frequency_bands ); + if ( ( freq_domain_decorr_ap_params->filter_coeff_den_real = (float *) malloc( sizeof( float ) * ( ap_filter_length[split_band_index_start] + 1 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } + + if ( ( freq_domain_decorr_ap_params->phase_coeff_real = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } + + if ( ( freq_domain_decorr_ap_params->phase_coeff_imag = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } + + if ( ( freq_domain_decorr_ap_state->direct_energy_smooth = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } + + if ( ( freq_domain_decorr_ap_state->reverb_energy_smooth = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } + + if ( ( freq_domain_decorr_ap_params->pre_delay = (int16_t *) malloc( sizeof( int16_t ) * freq_domain_decorr_ap_params->num_split_frequency_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } + if ( ( freq_domain_decorr_ap_params->filter_length = (int16_t *) malloc( sizeof( int16_t ) * freq_domain_decorr_ap_params->num_split_frequency_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } set_f( freq_domain_decorr_ap_state->direct_energy_smooth, 0.0f, freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); set_f( freq_domain_decorr_ap_state->reverb_energy_smooth, 0.0f, freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); @@ -280,7 +318,7 @@ void ivas_dirac_dec_decorr_open( *ph_freq_domain_decorr_ap_params = freq_domain_decorr_ap_params; *ph_freq_domain_decorr_ap_state = freq_domain_decorr_ap_state; - return; + return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_dirac_onsets_dec.c b/lib_dec/ivas_dirac_onsets_dec.c index 050ec5acdd..c094b45ff6 100644 --- a/lib_dec/ivas_dirac_onsets_dec.c +++ b/lib_dec/ivas_dirac_onsets_dec.c @@ -51,7 +51,7 @@ * onset detection *------------------------------------------------------------------------*/ -void ivas_dirac_dec_onset_detection_open( +ivas_error ivas_dirac_dec_onset_detection_open( const int16_t num_protos_diff, const int16_t num_freq_bands, const int16_t max_band_decorr, @@ -69,14 +69,20 @@ void ivas_dirac_dec_onset_detection_open( dirac_onset_detection_params->max_band_decorr = max_band_decorr; /* memory allocation */ - dirac_onset_detection_state->onset_detector_1 = (float *) malloc( sizeof( float ) * num_protos_diff * dirac_onset_detection_params->max_band_decorr ); - dirac_onset_detection_state->onset_detector_2 = (float *) malloc( sizeof( float ) * num_protos_diff * dirac_onset_detection_params->max_band_decorr ); + if ( ( dirac_onset_detection_state->onset_detector_1 = (float *) malloc( sizeof( float ) * num_protos_diff * dirac_onset_detection_params->max_band_decorr ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for onset detection\n" ) ); + } + if ( ( dirac_onset_detection_state->onset_detector_2 = (float *) malloc( sizeof( float ) * num_protos_diff * dirac_onset_detection_params->max_band_decorr ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for onset detection\n" ) ); + } /* init to zero */ set_zero( dirac_onset_detection_state->onset_detector_1, num_protos_diff * dirac_onset_detection_params->max_band_decorr ); set_zero( dirac_onset_detection_state->onset_detector_2, num_protos_diff * dirac_onset_detection_params->max_band_decorr ); - return; + return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index 79560aae63..6a79d4563a 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -58,7 +58,7 @@ * Sets up the state and parameters for the Covariance Synthesis *-------------------------------------------------------------------*/ -void ivas_dirac_dec_output_synthesis_cov_open( +ivas_error ivas_dirac_dec_output_synthesis_cov_open( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: hanlde for the covariance synthesis state */ const int16_t max_band_decorr, /* i : uppermost frequency band where decorrelation is applied */ @@ -80,15 +80,27 @@ void ivas_dirac_dec_output_synthesis_cov_open( /* buffer length and interpolator */ h_dirac_output_synthesis_params->alpha_synthesis = NULL; - h_dirac_output_synthesis_params->proto_matrix = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ); + if ( ( h_dirac_output_synthesis_params->proto_matrix = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); + } /* cov buffers */ for ( idx = 0; idx < num_param_bands; idx++ ) { - h_dirac_output_synthesis_state->cx_old[idx] = (float *) malloc( nchan_in * nchan_in * sizeof( float ) ); - h_dirac_output_synthesis_state->cy_old[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ); - h_dirac_output_synthesis_state->mixing_matrix_old[idx] = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ); + if ( ( h_dirac_output_synthesis_state->cx_old[idx] = (float *) malloc( nchan_in * nchan_in * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); + } + if ( ( h_dirac_output_synthesis_state->cy_old[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); + } + if ( ( h_dirac_output_synthesis_state->mixing_matrix_old[idx] = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); + } set_zero( h_dirac_output_synthesis_state->cx_old[idx], nchan_in * nchan_in ); set_zero( h_dirac_output_synthesis_state->cy_old[idx], nchan_out * nchan_out ); set_zero( h_dirac_output_synthesis_state->mixing_matrix_old[idx], nchan_out * nchan_in ); @@ -101,7 +113,10 @@ void ivas_dirac_dec_output_synthesis_cov_open( } for ( idx = 0; idx < num_param_bands_residual; idx++ ) { - h_dirac_output_synthesis_state->mixing_matrix_res_old[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ); + if ( ( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); + } set_zero( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx], nchan_out * nchan_out ); } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) @@ -114,7 +129,11 @@ void ivas_dirac_dec_output_synthesis_cov_open( *-----------------------------------------------------------------*/ /* compute interpolator */ - h_dirac_output_synthesis_params->interpolator = (float *) malloc( interp_length * sizeof( float ) ); + if ( ( h_dirac_output_synthesis_params->interpolator = (float *) malloc( interp_length * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); + } + for ( idx = 1; idx <= interp_length; ++idx ) { h_dirac_output_synthesis_params->interpolator[idx - 1] = (float) idx / (float) interp_length; @@ -122,7 +141,7 @@ void ivas_dirac_dec_output_synthesis_cov_open( mvr2r( proto_matrix, h_dirac_output_synthesis_params->proto_matrix, nchan_in * nchan_out ); - return; + return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index 5cf1c8b2da..3541bc5cfe 100644 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -86,7 +86,7 @@ static void normalizePanningGains( float *direct_response, const int16_t num_cha * *------------------------------------------------------------------------*/ -void ivas_dirac_dec_output_synthesis_open( +ivas_error ivas_dirac_dec_output_synthesis_open( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ RENDERER_TYPE renderer_type, /* i : renderer type */ const int16_t nchan_transport, /* i : number of transport channels*/ @@ -126,22 +126,34 @@ void ivas_dirac_dec_output_synthesis_open( dirac_output_synthesis_state->diffuse_responses_square = NULL; if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) { - dirac_output_synthesis_state->diffuse_responses_square = (float *) malloc( 2 * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->diffuse_responses_square = (float *) malloc( 2 * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } else if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - dirac_output_synthesis_state->diffuse_responses_square = (float *) malloc( hDirAC->hOutSetup.nchan_out_woLFE * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->diffuse_responses_square = (float *) malloc( hDirAC->hOutSetup.nchan_out_woLFE * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } /* prototype power buffers */ dirac_output_synthesis_state->proto_power_smooth_prev = NULL; if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - dirac_output_synthesis_state->proto_power_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_protos_dir * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->proto_power_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_protos_dir * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } if ( dirac_output_synthesis_params->max_band_decorr > 0 && ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) ) { - dirac_output_synthesis_state->proto_power_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->hOutSetup.nchan_out_woLFE * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->proto_power_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->hOutSetup.nchan_out_woLFE * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } else { @@ -149,41 +161,74 @@ void ivas_dirac_dec_output_synthesis_open( } /* buffer length and interpolator */ - dirac_output_synthesis_params->interpolator = (float *) malloc( hDirAC->subframe_nbslots * sizeof( float ) ); + if ( ( dirac_output_synthesis_params->interpolator = (float *) malloc( hDirAC->subframe_nbslots * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } /* target PSD buffers */ - dirac_output_synthesis_state->cy_cross_dir_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->cy_cross_dir_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { dirac_output_synthesis_state->cy_auto_dir_smooth_prev = NULL; - dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } else { - dirac_output_synthesis_state->cy_auto_dir_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->cy_auto_dir_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { - dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } else { - dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_diff * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } } /* direct and diffuse gain buffers */ - dirac_output_synthesis_state->gains_dir_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->gains_dir_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } else if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD && hDirAC->synthesisConf != DIRAC_SYNTHESIS_MONO ) { - dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_diff * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } else { - dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } /*-----------------------------------------------------------------* @@ -194,15 +239,27 @@ void ivas_dirac_dec_output_synthesis_open( if ( !( renderer_type == RENDERER_BINAURAL_PARAMETRIC || renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) ) { computeAlphaSynthesis( temp_alpha_synthesis, DIRAC_AVG_LENGTH_SYNTH_MS, DIRAC_ALPHA_MAX, &dirac_output_synthesis_params->numAlphas, hDirAC->slot_size, hDirAC->num_freq_bands, hDirAC->frequency_axis, output_Fs ); - dirac_output_synthesis_params->alpha_synthesis = (float *) malloc( dirac_output_synthesis_params->numAlphas * sizeof( float ) ); + if ( ( dirac_output_synthesis_params->alpha_synthesis = (float *) malloc( dirac_output_synthesis_params->numAlphas * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } mvr2r( temp_alpha_synthesis, dirac_output_synthesis_params->alpha_synthesis, dirac_output_synthesis_params->numAlphas ); computeAlphaSynthesis( temp_alpha_synthesis, DIRAC_AVG_LENGTH_SYNTH_MS_FAST, DIRAC_ALPHA_MAX_FAST, &dirac_output_synthesis_params->numAlphasFast, hDirAC->slot_size, hDirAC->num_freq_bands, hDirAC->frequency_axis, output_Fs ); - dirac_output_synthesis_params->alpha_synthesis_fast = (float *) malloc( dirac_output_synthesis_params->numAlphasFast * sizeof( float ) ); + if ( ( dirac_output_synthesis_params->alpha_synthesis_fast = (float *) malloc( dirac_output_synthesis_params->numAlphasFast * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } mvr2r( temp_alpha_synthesis, dirac_output_synthesis_params->alpha_synthesis_fast, dirac_output_synthesis_params->numAlphasFast ); - dirac_output_synthesis_state->reference_power_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); - dirac_output_synthesis_state->direction_smoothness_prev = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->reference_power_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } + if ( ( dirac_output_synthesis_state->direction_smoothness_prev = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } set_zero( dirac_output_synthesis_state->reference_power_smooth_prev, hDirAC->num_freq_bands ); set_zero( dirac_output_synthesis_state->direction_smoothness_prev, hDirAC->num_freq_bands ); } @@ -276,7 +333,7 @@ void ivas_dirac_dec_output_synthesis_open( dirac_output_synthesis_params->diffuse_compensation_factor_decorr = 0.f; } - return; + return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 949646f10d..25813f34b2 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1381,7 +1381,10 @@ ivas_error ivas_init_decoder( * Allocate and initialize limiter struct *-----------------------------------------------------------------*/ - st_ivas->hLimiter = ivas_limiter_open( hDecoderConfig->nchan_out, output_Fs ); + if ( ( st_ivas->hLimiter = ivas_limiter_open( hDecoderConfig->nchan_out, output_Fs ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to open limiter handle" ); + } return error; } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index dea3e6d6f8..81a4744726 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -516,34 +516,105 @@ ivas_error ivas_param_ism_dec_open( if ( ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM ) ) { hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; - hDirAC->azimuth = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); - hDirAC->elevation = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); - hDirAC->azimuth2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); - hDirAC->elevation2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); - hDirAC->energy_ratio1 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); - hDirAC->spreadCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); - hDirAC->energy_ratio2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); - hDirAC->spreadCoherence2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); - hDirAC->surroundingCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); + if ( ( hDirAC->azimuth = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + + if ( ( hDirAC->elevation = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + + if ( ( hDirAC->azimuth2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + + if ( ( hDirAC->elevation2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + + if ( ( hDirAC->energy_ratio1 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + + if ( ( hDirAC->spreadCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + + if ( ( hDirAC->energy_ratio2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + + if ( ( hDirAC->spreadCoherence2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + + if ( ( hDirAC->surroundingCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { - hDirAC->azimuth[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + if ( ( hDirAC->azimuth[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_s( hDirAC->azimuth[i], 0, hDirAC->num_freq_bands ); - hDirAC->elevation[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + + if ( ( hDirAC->elevation[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_s( hDirAC->elevation[i], 0, hDirAC->num_freq_bands ); - hDirAC->azimuth2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + + if ( ( hDirAC->azimuth2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_s( hDirAC->azimuth2[i], 0, hDirAC->num_freq_bands ); - hDirAC->elevation2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + + if ( ( hDirAC->elevation2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_s( hDirAC->elevation2[i], 0, hDirAC->num_freq_bands ); - hDirAC->energy_ratio1[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->energy_ratio1[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_f( hDirAC->energy_ratio1[i], 0.0f, hDirAC->num_freq_bands ); - hDirAC->spreadCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->spreadCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_f( hDirAC->spreadCoherence[i], 0.0f, hDirAC->num_freq_bands ); - hDirAC->energy_ratio2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->energy_ratio2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_f( hDirAC->energy_ratio2[i], 0.0f, hDirAC->num_freq_bands ); - hDirAC->spreadCoherence2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->spreadCoherence2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_f( hDirAC->spreadCoherence2[i], 0.0f, hDirAC->num_freq_bands ); - hDirAC->surroundingCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->surroundingCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_f( hDirAC->surroundingCoherence[i], 0.0f, hDirAC->num_freq_bands ); } } diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 803ccdf86c..6bfddc78e6 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -96,7 +96,7 @@ static void param_mc_compute_interpolator( const uint16_t bAttackPresent, const static void param_mc_set_num_synth_bands( const int32_t output_Fs, PARAM_MC_DEC_HANDLE hParamMC ); -static void param_mc_get_diff_proto_info( const float *proto_mtx, const uint16_t nchan_transport, const uint16_t nchan_out_cov, PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info ); +static ivas_error param_mc_get_diff_proto_info( const float *proto_mtx, const uint16_t nchan_transport, const uint16_t nchan_out_cov, PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info ); static void ivas_param_mc_mc2sba_cldfb( IVAS_OUTPUT_SETUP hTransSetup, float *hoa_encoder, const int16_t slot_idx, float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], const int16_t nBands, const float gain_lfe ); @@ -231,8 +231,14 @@ ivas_error ivas_param_mc_dec_open( ivas_param_mc_metadata_open( mc_ls_setup, hTransportSetup.index_lfe[0], ivas_total_brate, hParamMC->hMetadataPMC ); /* init arrays for quantized parameters */ - hParamMC->icc_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) ); - hParamMC->icld_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( float ) ); + if ( ( hParamMC->icc_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + if ( ( hParamMC->icld_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } set_f( hParamMC->icld_q, PARAM_MC_DEFAULT_MIN_ILD, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); set_f( hParamMC->icc_q, 0.0f, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); @@ -280,11 +286,16 @@ ivas_error ivas_param_mc_dec_open( /* convert the ls conv dmx matrix into column order matrix format (nchan_out_cldfb x nchan_out) */ if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) { - hParamMC->ls_conv_dmx_matrix = (float *) malloc( nchan_out_transport * nchan_out_cov * sizeof( float ) ); + if ( ( hParamMC->ls_conv_dmx_matrix = (float *) malloc( nchan_out_transport * nchan_out_cov * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + for ( k = 0; k < nchan_out_transport; k++ ) { mvr2r( st_ivas->hLsSetUpConversion->dmxMtx[k], &hParamMC->ls_conv_dmx_matrix[k * nchan_out_cov], nchan_out_cov ); } + /* convert ParamMC parameter bands to SFB */ if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) { @@ -302,7 +313,10 @@ ivas_error ivas_param_mc_dec_open( } } - hParamMC->proto_matrix_int = (float *) malloc( nchan_out_transport * nchan_transport * sizeof( float ) ); + if ( ( hParamMC->proto_matrix_int = (float *) malloc( nchan_out_transport * nchan_transport * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } mvr2r( ivas_param_mc_conf[config_index].dmx_fac, hParamMC->proto_matrix_int, nchan_transport * nchan_out_transport ); if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) @@ -347,9 +361,15 @@ ivas_error ivas_param_mc_dec_open( else { hParamMC->num_outputs_diff = nchan_out_cov; - hParamMC->diff_proto_info = (PARAM_MC_DIFF_PROTO_INFO *) malloc( sizeof( PARAM_MC_DIFF_PROTO_INFO ) ); + if ( ( hParamMC->diff_proto_info = (PARAM_MC_DIFF_PROTO_INFO *) malloc( sizeof( PARAM_MC_DIFF_PROTO_INFO ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } - param_mc_get_diff_proto_info( proto_matrix, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ); + if ( ( error = param_mc_get_diff_proto_info( proto_matrix, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ) ) != IVAS_ERR_OK ) + { + return error; + } /* decorrelation */ hParamMC->h_freq_domain_decorr_ap_params = NULL; @@ -357,15 +377,18 @@ ivas_error ivas_param_mc_dec_open( ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, hParamMC->num_freq_bands ); - ivas_dirac_dec_decorr_open( &( hParamMC->h_freq_domain_decorr_ap_params ), - &( hParamMC->h_freq_domain_decorr_ap_state ), - hParamMC->num_freq_bands, - hParamMC->num_outputs_diff, - hParamMC->diff_proto_info->num_protos_diff, - DIRAC_SYNTHESIS_COV_MC_LS, - frequency_axis, - nchan_transport, - output_Fs ); + if ( ( error = ivas_dirac_dec_decorr_open( &( hParamMC->h_freq_domain_decorr_ap_params ), + &( hParamMC->h_freq_domain_decorr_ap_state ), + hParamMC->num_freq_bands, + hParamMC->num_outputs_diff, + hParamMC->diff_proto_info->num_protos_diff, + DIRAC_SYNTHESIS_COV_MC_LS, + frequency_axis, + nchan_transport, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } hParamMC->h_output_synthesis_params.use_onset_filters = 0; hParamMC->max_band_decorr = hParamMC->h_freq_domain_decorr_ap_params->max_band_decorr; @@ -384,21 +407,27 @@ ivas_error ivas_param_mc_dec_open( } /* output synthesis */ - ivas_dirac_dec_output_synthesis_cov_open( &( hParamMC->h_output_synthesis_params ), - &( hParamMC->h_output_synthesis_cov_state ), - hParamMC->max_band_decorr, - PARAM_MC_MAX_NSLOTS, - hParamMC->hMetadataPMC->num_parameter_bands, - max_param_band_residual, - nchan_transport, - nchan_out_cov, - proto_matrix ); + if ( ( error = ivas_dirac_dec_output_synthesis_cov_open( &( hParamMC->h_output_synthesis_params ), + &( hParamMC->h_output_synthesis_cov_state ), + hParamMC->max_band_decorr, + PARAM_MC_MAX_NSLOTS, + hParamMC->hMetadataPMC->num_parameter_bands, + max_param_band_residual, + nchan_transport, + nchan_out_cov, + proto_matrix ) ) != IVAS_ERR_OK ) + { + return error; + } /* Head rotation */ if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) && st_ivas->hDecoderConfig->Opt_Headrotation ) { - hParamMC->hoa_encoder = (float *) malloc( st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS * sizeof( float ) ); + if ( ( hParamMC->hoa_encoder = (float *) malloc( st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } compute_hoa_encoder_mtx( st_ivas->hTransSetup.ls_azimuth, st_ivas->hTransSetup.ls_elevation, hParamMC->hoa_encoder, st_ivas->hTransSetup.nchan_out_woLFE, HEAD_ROTATION_HOA_ORDER ); } @@ -408,8 +437,15 @@ ivas_error ivas_param_mc_dec_open( if ( hParamMC->max_band_decorr > 0 ) { - hParamMC->proto_frame_f = (float *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( float ) ); - hParamMC->proto_frame_dec_f = (float *) malloc( 2 * nchan_out_cov * hParamMC->num_freq_bands * sizeof( float ) ); + if ( ( hParamMC->proto_frame_f = (float *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + + if ( ( hParamMC->proto_frame_dec_f = (float *) malloc( 2 * nchan_out_cov * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } } else { @@ -616,8 +652,14 @@ ivas_error ivas_param_mc_dec_reconfig( /* init arrays for the quantized parameters */ - hParamMC->icc_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) ); - hParamMC->icld_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( float ) ); + if ( ( hParamMC->icc_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + if ( ( hParamMC->icld_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } set_f( hParamMC->icld_q, PARAM_MC_DEFAULT_MIN_ILD, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); set_f( hParamMC->icc_q, 0.0f, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); @@ -696,7 +738,10 @@ ivas_error ivas_param_mc_dec_reconfig( /* convert the ls conv dmx matrix into column order matrix format (nchan_out_cldfb x nchan_out) */ free( hParamMC->ls_conv_dmx_matrix ); - hParamMC->ls_conv_dmx_matrix = (float *) malloc( nchan_out_transport * nchan_out_cov * sizeof( float ) ); + if ( ( hParamMC->ls_conv_dmx_matrix = (float *) malloc( nchan_out_transport * nchan_out_cov * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } for ( k = 0; k < nchan_out_transport; k++ ) { mvr2r( st_ivas->hLsSetUpConversion->dmxMtx[k], &hParamMC->ls_conv_dmx_matrix[k * nchan_out_cov], nchan_out_cov ); @@ -718,7 +763,10 @@ ivas_error ivas_param_mc_dec_reconfig( if ( nchan_transport_old != nchan_transport ) { free( hParamMC->proto_matrix_int ); - hParamMC->proto_matrix_int = (float *) malloc( nchan_out_transport * nchan_transport * sizeof( float ) ); + if ( ( hParamMC->proto_matrix_int = (float *) malloc( nchan_out_transport * nchan_transport * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } mvr2r( ivas_param_mc_conf[config_index].dmx_fac, hParamMC->proto_matrix_int, nchan_transport * nchan_out_transport ); } @@ -789,9 +837,15 @@ ivas_error ivas_param_mc_dec_reconfig( } hParamMC->num_outputs_diff = nchan_out_cov; - hParamMC->diff_proto_info = (PARAM_MC_DIFF_PROTO_INFO *) malloc( sizeof( PARAM_MC_DIFF_PROTO_INFO ) ); + if ( ( hParamMC->diff_proto_info = (PARAM_MC_DIFF_PROTO_INFO *) malloc( sizeof( PARAM_MC_DIFF_PROTO_INFO ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } - param_mc_get_diff_proto_info( proto_matrix, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ); + if ( ( param_mc_get_diff_proto_info( proto_matrix, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ) ) != IVAS_ERR_OK ) + { + return error; + } /* decorrelation */ hParamMC->h_freq_domain_decorr_ap_params = NULL; @@ -799,15 +853,18 @@ ivas_error ivas_param_mc_dec_reconfig( ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, hParamMC->num_freq_bands ); - ivas_dirac_dec_decorr_open( &( hParamMC->h_freq_domain_decorr_ap_params ), - &( hParamMC->h_freq_domain_decorr_ap_state ), - hParamMC->num_freq_bands, - hParamMC->num_outputs_diff, - hParamMC->diff_proto_info->num_protos_diff, - DIRAC_SYNTHESIS_COV_MC_LS, - frequency_axis, - nchan_transport, - output_Fs ); + if ( ( error = ivas_dirac_dec_decorr_open( &( hParamMC->h_freq_domain_decorr_ap_params ), + &( hParamMC->h_freq_domain_decorr_ap_state ), + hParamMC->num_freq_bands, + hParamMC->num_outputs_diff, + hParamMC->diff_proto_info->num_protos_diff, + DIRAC_SYNTHESIS_COV_MC_LS, + frequency_axis, + nchan_transport, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } hParamMC->h_output_synthesis_params.use_onset_filters = 0; hParamMC->max_band_decorr = hParamMC->h_freq_domain_decorr_ap_params->max_band_decorr; @@ -842,16 +899,20 @@ ivas_error ivas_param_mc_dec_reconfig( float tmp_buf[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; set_zero( tmp_buf, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); + /* output synthesis */ - ivas_dirac_dec_output_synthesis_cov_open( &( hParamMC->h_output_synthesis_params ), - &( hParamMC->h_output_synthesis_cov_state ), - hParamMC->max_band_decorr, - PARAM_MC_MAX_NSLOTS, - hParamMC->hMetadataPMC->num_parameter_bands, - max_param_band_residual, - nchan_transport, - nchan_out_cov, - proto_matrix ); + if ( ( error = ivas_dirac_dec_output_synthesis_cov_open( &( hParamMC->h_output_synthesis_params ), + &( hParamMC->h_output_synthesis_cov_state ), + hParamMC->max_band_decorr, + PARAM_MC_MAX_NSLOTS, + hParamMC->hMetadataPMC->num_parameter_bands, + max_param_band_residual, + nchan_transport, + nchan_out_cov, + proto_matrix ) ) != IVAS_ERR_OK ) + { + return error; + } ivas_dirac_dec_output_synthesis_cov_init( &( hParamMC->h_output_synthesis_cov_state ), nchan_transport, nchan_out_cov, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual ); @@ -898,7 +959,10 @@ ivas_error ivas_param_mc_dec_reconfig( if ( hParamMC->max_band_decorr > 0 && nchan_transport_old != nchan_transport ) { free( hParamMC->proto_frame_f ); - hParamMC->proto_frame_f = (float *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( float ) ); + if ( ( hParamMC->proto_frame_f = (float *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } set_zero( hParamMC->proto_frame_f, 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands ); } @@ -2575,7 +2639,7 @@ static void param_mc_set_num_synth_bands( * calculated the diffuse prototype information *-------------------------------------------------------------------------*/ -static void param_mc_get_diff_proto_info( +static ivas_error param_mc_get_diff_proto_info( const float *proto_mtx, /* i : protoype matrix for the synthesis */ const uint16_t nchan_transport, /* i : number of transport channels */ const uint16_t nchan_out_cov, /* i : number if output channels of the covariance synthesis */ @@ -2591,9 +2655,16 @@ static void param_mc_get_diff_proto_info( /* Initializations */ max_num_src_chan = 0; set_zero( proto_fac, MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS ); - p_diff_proto_info->proto_index_diff = (int16_t *) malloc( nchan_out_cov * sizeof( int16_t ) ); + if ( ( p_diff_proto_info->proto_index_diff = (int16_t *) malloc( nchan_out_cov * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } set_s( p_diff_proto_info->proto_index_diff, 0, nchan_out_cov ); - p_diff_proto_info->num_source_chan_diff = (int16_t *) malloc( nchan_out_cov * sizeof( int16_t ) ); + + if ( ( p_diff_proto_info->num_source_chan_diff = (int16_t *) malloc( nchan_out_cov * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } set_s( p_diff_proto_info->num_source_chan_diff, 0, nchan_out_cov ); /* we have at least one prototype, copy the first one */ @@ -2653,15 +2724,27 @@ static void param_mc_get_diff_proto_info( } /* set up the prototype info struct */ - p_diff_proto_info->source_chan_idx = (int16_t **) malloc( p_diff_proto_info->num_protos_diff * sizeof( int16_t * ) ); - p_diff_proto_info->proto_fac = (float **) malloc( p_diff_proto_info->num_protos_diff * sizeof( float * ) ); + if ( ( p_diff_proto_info->source_chan_idx = (int16_t **) malloc( p_diff_proto_info->num_protos_diff * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + if ( ( p_diff_proto_info->proto_fac = (float **) malloc( p_diff_proto_info->num_protos_diff * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } for ( cur_diff_proto = 0; cur_diff_proto < p_diff_proto_info->num_protos_diff; cur_diff_proto++ ) { float *proto_fac_ptr; - p_diff_proto_info->source_chan_idx[cur_diff_proto] = (int16_t *) malloc( max_num_src_chan * sizeof( int16_t ) ); - p_diff_proto_info->proto_fac[cur_diff_proto] = (float *) malloc( max_num_src_chan * sizeof( float ) ); + if ( ( p_diff_proto_info->source_chan_idx[cur_diff_proto] = (int16_t *) malloc( max_num_src_chan * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + if ( ( p_diff_proto_info->proto_fac[cur_diff_proto] = (float *) malloc( max_num_src_chan * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } proto_fac_ptr = proto_fac + cur_diff_proto; for ( cur_transport_ch = 0; cur_transport_ch < nchan_transport; cur_transport_ch++ ) @@ -2676,7 +2759,7 @@ static void param_mc_get_diff_proto_info( } } - return; + return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index 787ceaaf44..225a1c85b5 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -332,8 +332,14 @@ ivas_error ivas_ls_setup_conversion_open( hLsSetUpConversion->sfbCnt = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); for ( chIdx = 0; chIdx < outChannels; chIdx++ ) { - hLsSetUpConversion->targetEnergyPrev[chIdx] = (float *) malloc( ( hLsSetUpConversion->sfbCnt ) * sizeof( float ) ); - hLsSetUpConversion->dmxEnergyPrev[chIdx] = (float *) malloc( ( hLsSetUpConversion->sfbCnt ) * sizeof( float ) ); + if ( ( hLsSetUpConversion->targetEnergyPrev[chIdx] = (float *) malloc( ( hLsSetUpConversion->sfbCnt ) * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); + } + if ( ( hLsSetUpConversion->dmxEnergyPrev[chIdx] = (float *) malloc( ( hLsSetUpConversion->sfbCnt ) * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); + } set_f( hLsSetUpConversion->targetEnergyPrev[chIdx], 0.0f, hLsSetUpConversion->sfbCnt ); set_f( hLsSetUpConversion->dmxEnergyPrev[chIdx], 0.0f, hLsSetUpConversion->sfbCnt ); } @@ -348,8 +354,15 @@ ivas_error ivas_ls_setup_conversion_open( inChannels = st_ivas->nchan_transport; /*Initialization of MDCT bands with TCX20 resolution */ ivas_lssetupconversion_mdct_init_bands( output_frame, TCX_20_CORE, &hLsSetUpConversion->sfbOffset[0], &hLsSetUpConversion->sfbCnt ); - hLsSetUpConversion->targetEnergyPrev[0] = (float *) malloc( ( MAX_SFB + 2 ) * sizeof( float ) ); - hLsSetUpConversion->dmxEnergyPrev[0] = (float *) malloc( ( MAX_SFB + 2 ) * sizeof( float ) ); + if ( ( hLsSetUpConversion->targetEnergyPrev[0] = (float *) malloc( ( MAX_SFB + 2 ) * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); + } + if ( ( hLsSetUpConversion->dmxEnergyPrev[0] = (float *) malloc( ( MAX_SFB + 2 ) * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); + } + for ( chIdx = 1; chIdx < MAX_CICP_CHANNELS; chIdx++ ) { hLsSetUpConversion->targetEnergyPrev[chIdx] = NULL; diff --git a/lib_dec/ivas_vbap.c b/lib_dec/ivas_vbap.c index 9c595ea1fe..cda52c1aec 100644 --- a/lib_dec/ivas_vbap.c +++ b/lib_dec/ivas_vbap.c @@ -127,13 +127,13 @@ static int16_t determine_virtual_surface_triplets( const int16_t num_speaker_nod static void determine_initial_search_indices( const int16_t num_triplets, const float triplet_azidegs[VBAP_MAX_NUM_TRIPLETS], int16_t initial_search_indices[VBAP_NUM_SEARCH_SECTORS] ); -static void determine_connections( const int16_t num_speaker_nodes, const VBAP_SPEAKER_NODE *speaker_node_data, int16_t connections[][2], const int16_t max_num_connections, int16_t *group1_count, int16_t *group2_start, int16_t *group2_count ); +static ivas_error determine_connections( const int16_t num_speaker_nodes, const VBAP_SPEAKER_NODE *speaker_node_data, int16_t connections[][2], const int16_t max_num_connections, int16_t *group1_count, int16_t *group2_start, int16_t *group2_count ); static void formulate_horizontal_connections( const VBAP_SPEAKER_NODE *speaker_node_data, const int16_t num_speaker_nodes, int16_t connections[][2], int16_t *connection_write_index ); -static void get_half_sphere_connection_options( const VBAP_SPEAKER_NODE *speaker_node_data, const enum SpeakerNodeGroup group, const int16_t num_speaker_nodes, const int16_t num_non_crossing_planes, const float *non_crossing_plane_elevation_deg, ConnectionOption **connection_options_pr, int16_t *num_connection_options ); +static ivas_error get_half_sphere_connection_options( const VBAP_SPEAKER_NODE *speaker_node_data, const enum SpeakerNodeGroup group, const int16_t num_speaker_nodes, const int16_t num_non_crossing_planes, const float *non_crossing_plane_elevation_deg, ConnectionOption **connection_options_pr, int16_t *num_connection_options ); -static void formulate_half_sphere_connections( const VBAP_SPEAKER_NODE *speaker_node_data, const int16_t num_speaker_nodes, const enum SpeakerNodeGroup group, int16_t connections[][2], int16_t *connection_write_index, const int16_t max_num_connections, const int16_t num_non_crossing_planes, const float *non_crossing_plane_elevation_deg ); +static ivas_error formulate_half_sphere_connections( const VBAP_SPEAKER_NODE *speaker_node_data, const int16_t num_speaker_nodes, const enum SpeakerNodeGroup group, int16_t connections[][2], int16_t *connection_write_index, const int16_t max_num_connections, const int16_t num_non_crossing_planes, const float *non_crossing_plane_elevation_deg ); static int16_t determine_non_crossing_planes( const int16_t num_speaker_nodes, const VBAP_SPEAKER_NODE *node_data, float *non_crossing_plane_elevation_deg ); @@ -173,6 +173,7 @@ ivas_error vbap_init_data( float speaker_node_ele_deg_internal[VBAP_MAX_NUM_SPEAKER_NODES]; VBAP_SPEAKER_NODE speaker_node_data[VBAP_MAX_NUM_SPEAKER_NODES]; VBAP_DATA *vbap; + ivas_error error; push_wmops( "vbap_init" ); @@ -184,6 +185,7 @@ ivas_error vbap_init_data( /* TODO: are these two paths correct behaviour or should and error be returned ? */ return IVAS_ERR_OK; } + if ( !speaker_node_azi_deg || !speaker_node_ele_deg ) { hVBAPdata = NULL; @@ -206,7 +208,6 @@ ivas_error vbap_init_data( vbap->num_speaker_nodes = num_speaker_nodes; vbap->num_speaker_nodes_internal = num_speaker_nodes; - /* Check if the speaker node setup needs a virtual top or bottom node (function also increments vbap->num_speaker_nodes_internal when necessary) */ virtual_bottom_type = check_need_of_virtual_speaker_node( vbap, speaker_node_azi_deg, speaker_node_ele_deg, SPEAKER_NODE_BOTTOM_HALF ); @@ -220,7 +221,10 @@ ivas_error vbap_init_data( if ( is_success && virtual_bottom_type != NO_VIRTUAL_SPEAKER_NODE ) { - vbap->bottom_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); + if ( ( vbap->bottom_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VBAP data\n" ) ); + } set_zero( vbap->bottom_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->bottom_virtual_speaker_node_division_gains != NULL; speaker_node_azi_deg_internal[vbap->bottom_virtual_speaker_node_index] = 0.0f; @@ -229,7 +233,10 @@ ivas_error vbap_init_data( if ( is_success && virtual_top_type != NO_VIRTUAL_SPEAKER_NODE ) { - vbap->top_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); + if ( ( vbap->top_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VBAP data\n" ) ); + } set_zero( vbap->top_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->top_virtual_speaker_node_division_gains != NULL; speaker_node_azi_deg_internal[vbap->top_virtual_speaker_node_index] = 0.0f; @@ -238,7 +245,10 @@ ivas_error vbap_init_data( if ( is_success && virtual_back_type != NO_VIRTUAL_SPEAKER_NODE ) { - vbap->back_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); + if ( ( vbap->back_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VBAP data\n" ) ); + } set_zero( vbap->back_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->back_virtual_speaker_node_division_gains != NULL; speaker_node_azi_deg_internal[vbap->back_virtual_speaker_node_index] = 180.0f; @@ -250,7 +260,10 @@ ivas_error vbap_init_data( /* Allocate and determine node-node connections */ max_num_connections = ( vbap->num_speaker_nodes_internal - 2 ) * 3; /* Theoretical maximum */ - determine_connections( vbap->num_speaker_nodes_internal, speaker_node_data, connections, max_num_connections, &connection_group1_count, &connection_group2_start, &connection_group2_count ); + if ( ( error = determine_connections( vbap->num_speaker_nodes_internal, speaker_node_data, connections, max_num_connections, &connection_group1_count, &connection_group2_start, &connection_group2_count ) ) != IVAS_ERR_OK ) + { + return error; + } /* Allocate and determine virtual surface speaker node triplets */ if ( is_success ) @@ -286,12 +299,20 @@ ivas_error vbap_init_data( break; } } - vbap->search_struct[0].triplets = (VBAP_VS_TRIPLET *) malloc( ( ( speaker_nodes_group1_internal - 2 ) * 2 - ( max( 0, ( speaker_nodes_horiz_internal - 2 ) ) ) ) * sizeof( VBAP_VS_TRIPLET ) ); + + if ( ( vbap->search_struct[0].triplets = (VBAP_VS_TRIPLET *) malloc( ( ( speaker_nodes_group1_internal - 2 ) * 2 - ( max( 0, ( speaker_nodes_horiz_internal - 2 ) ) ) ) * sizeof( VBAP_VS_TRIPLET ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VBAP data\n" ) ); + } is_success &= vbap->search_struct[0].triplets != NULL; + if ( speaker_nodes_group2_internal > 0 ) { vbap->num_search_structs = 2; - vbap->search_struct[1].triplets = (VBAP_VS_TRIPLET *) malloc( ( ( speaker_nodes_group2_internal - 2 ) * 2 - ( max( 0, ( speaker_nodes_horiz_internal - 2 ) ) ) ) * sizeof( VBAP_VS_TRIPLET ) ); + if ( ( vbap->search_struct[1].triplets = (VBAP_VS_TRIPLET *) malloc( ( ( speaker_nodes_group2_internal - 2 ) * 2 - ( max( 0, ( speaker_nodes_horiz_internal - 2 ) ) ) ) * sizeof( VBAP_VS_TRIPLET ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VBAP data\n" ) ); + } is_success &= vbap->search_struct[1].triplets != NULL; } else @@ -1201,7 +1222,7 @@ static void determine_initial_search_indices( * Determine all valid connections between all speaker nodes *-------------------------------------------------------------------------*/ -static void determine_connections( +static ivas_error determine_connections( const int16_t num_speaker_nodes, /* i : number of speaker nodes */ const VBAP_SPEAKER_NODE *speaker_node_data, /* i : speaker node data */ int16_t connections[][2], /* o : vector of connections */ @@ -1215,6 +1236,7 @@ static void determine_connections( int16_t c; int16_t connection_write_index = 0; float non_crossing_plane_elevation_deg[VBAP_MAX_PLANES]; + ivas_error error; set_f( non_crossing_plane_elevation_deg, 0.0f, VBAP_MAX_PLANES ); @@ -1230,20 +1252,31 @@ static void determine_connections( /* Process in different mode based on the grouping. It is enough to check for first node. */ if ( speaker_node_data[0].group == SPEAKER_NODE_ALL ) { - formulate_half_sphere_connections( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_ALL, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg ); + if ( ( error = formulate_half_sphere_connections( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_ALL, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg ) ) != IVAS_ERR_OK ) + { + return error; + } } else { /* The node-node connections are determined in three stages: bottom, horizontal, and top. */ - formulate_half_sphere_connections( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_BOTTOM_HALF, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg ); + if ( ( error = formulate_half_sphere_connections( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_BOTTOM_HALF, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg ) ) != IVAS_ERR_OK ) + { + return error; + } *group2_start = connection_write_index; + formulate_horizontal_connections( speaker_node_data, num_speaker_nodes, connections, &connection_write_index ); *group1_count = connection_write_index; - formulate_half_sphere_connections( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_TOP_HALF, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg ); + + if ( ( error = formulate_half_sphere_connections( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_TOP_HALF, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg ) ) != IVAS_ERR_OK ) + { + return error; + } *group2_count = connection_write_index - *group2_start; } - return; + return IVAS_ERR_OK; } @@ -1446,7 +1479,7 @@ static int16_t check_plane_crossing( * Get list of all potential connections at the half-sphere *-------------------------------------------------------------------------*/ -static void get_half_sphere_connection_options( +static ivas_error get_half_sphere_connection_options( const VBAP_SPEAKER_NODE *speaker_node_data, /* i : speaker node data */ const enum SpeakerNodeGroup group, /* i : speaker node group */ const int16_t num_speaker_nodes, /* i : number of speaker nodes */ @@ -1472,7 +1505,11 @@ static void get_half_sphere_connection_options( } /* Init memory for connection options */ - c_options = (ConnectionOption *) malloc( sizeof( ConnectionOption ) * max_num_connection_options ); + if ( ( c_options = (ConnectionOption *) malloc( sizeof( ConnectionOption ) * max_num_connection_options ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VBAP data\n" ) ); + } + for ( c = 0; c < max_num_connection_options; c++ ) { c_options[c].chA = -1; @@ -1527,7 +1564,11 @@ static void get_half_sphere_connection_options( /* Init memory for reordered connection options and order by arc_weighted, * which informs of the preference order of the connections in case they cross */ - c_options_reorder = (ConnectionOption *) malloc( sizeof( ConnectionOption ) * ( *num_connection_options ) ); + if ( ( c_options_reorder = (ConnectionOption *) malloc( sizeof( ConnectionOption ) * ( *num_connection_options ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VBAP data\n" ) ); + } + for ( c = 0; c < *num_connection_options; c++ ) { float min_arc_weighted; @@ -1554,16 +1595,17 @@ static void get_half_sphere_connection_options( *connection_options_pr = c_options_reorder; free( c_options ); - return; + return IVAS_ERR_OK; } + /*-------------------------------------------------------------------------* * formulate_half_sphere_connections() * * Formulate half-sphere connections *-------------------------------------------------------------------------*/ -static void formulate_half_sphere_connections( +static ivas_error formulate_half_sphere_connections( const VBAP_SPEAKER_NODE *speaker_node_data, /* i : speaker node data */ const int16_t num_speaker_nodes, /* i : number of speaker nodes */ const enum SpeakerNodeGroup group, /* i : speaker node group */ @@ -1590,19 +1632,23 @@ static void formulate_half_sphere_connections( ConnectionOption *connection_options; int16_t num_connection_options; int16_t half_sphere_first_connection; + ivas_error error; half_sphere_first_connection = *connection_write_index; /* Obtain all connection options (i.e., channel pairs) at the half sphere. The function orders them * in terms of which connection to keep if two connections would cross each other. */ - get_half_sphere_connection_options( - speaker_node_data, - group, - num_speaker_nodes, - num_non_crossing_planes, - non_crossing_plane_elevation_deg, - &connection_options, - &num_connection_options ); + if ( ( error = get_half_sphere_connection_options( + speaker_node_data, + group, + num_speaker_nodes, + num_non_crossing_planes, + non_crossing_plane_elevation_deg, + &connection_options, + &num_connection_options ) ) != IVAS_ERR_OK ) + { + return error; + } set_f( connection_arc, 0.0f, max_num_connections ); for ( c = 0; c < max_num_connections; c++ ) @@ -1698,8 +1744,10 @@ static void formulate_half_sphere_connections( } c_opt++; } + free( connection_options ); - return; + + return IVAS_ERR_OK; } diff --git a/lib_dec/jbm_jb4_circularbuffer.c b/lib_dec/jbm_jb4_circularbuffer.c index e272e21aa1..e68b3e170e 100644 --- a/lib_dec/jbm_jb4_circularbuffer.c +++ b/lib_dec/jbm_jb4_circularbuffer.c @@ -70,9 +70,14 @@ struct JB4_CIRCULARBUFFER /* Creates a circular buffer (FIFO) */ -int16_t JB4_CIRCULARBUFFER_Create( JB4_CIRCULARBUFFER_HANDLE *ph ) +ivas_error JB4_CIRCULARBUFFER_Create( JB4_CIRCULARBUFFER_HANDLE *ph ) { - JB4_CIRCULARBUFFER_HANDLE h = malloc( sizeof( struct JB4_CIRCULARBUFFER ) ); + JB4_CIRCULARBUFFER_HANDLE h; + + if ( ( h = malloc( sizeof( struct JB4_CIRCULARBUFFER ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } h->data = NULL; h->capacity = 0; @@ -81,7 +86,7 @@ int16_t JB4_CIRCULARBUFFER_Create( JB4_CIRCULARBUFFER_HANDLE *ph ) *ph = h; - return 0; + return IVAS_ERR_OK; } @@ -119,13 +124,17 @@ int16_t JB4_CIRCULARBUFFER_Init( { /* keep one element free to be able to decide between full/empty buffer */ ++capacity; - h->data = malloc( capacity * sizeof( JB4_CIRCULARBUFFER_ELEMENT ) ); + + if ( ( h->data = malloc( capacity * sizeof( JB4_CIRCULARBUFFER_ELEMENT ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } h->capacity = capacity; h->writePos = 0; h->readPos = 0; - return 0; + return IVAS_ERR_OK; } diff --git a/lib_dec/jbm_jb4_circularbuffer.h b/lib_dec/jbm_jb4_circularbuffer.h index 0891cdfd11..e14144b329 100644 --- a/lib_dec/jbm_jb4_circularbuffer.h +++ b/lib_dec/jbm_jb4_circularbuffer.h @@ -47,7 +47,7 @@ typedef struct JB4_CIRCULARBUFFER *JB4_CIRCULARBUFFER_HANDLE; typedef int32_t JB4_CIRCULARBUFFER_ELEMENT; -int16_t JB4_CIRCULARBUFFER_Create( JB4_CIRCULARBUFFER_HANDLE *ph ); +ivas_error JB4_CIRCULARBUFFER_Create( JB4_CIRCULARBUFFER_HANDLE *ph ); void JB4_CIRCULARBUFFER_Destroy( JB4_CIRCULARBUFFER_HANDLE *ph ); diff --git a/lib_dec/jbm_jb4_inputbuffer.c b/lib_dec/jbm_jb4_inputbuffer.c index 8cec3bdf61..925e35dfff 100644 --- a/lib_dec/jbm_jb4_inputbuffer.c +++ b/lib_dec/jbm_jb4_inputbuffer.c @@ -67,10 +67,15 @@ struct JB4_INPUTBUFFER /* Creates a input buffer */ -int16_t JB4_INPUTBUFFER_Create( +ivas_error JB4_INPUTBUFFER_Create( JB4_INPUTBUFFER_HANDLE *ph ) { - JB4_INPUTBUFFER_HANDLE h = malloc( sizeof( struct JB4_INPUTBUFFER ) ); + JB4_INPUTBUFFER_HANDLE h; + + if ( ( h = malloc( sizeof( struct JB4_INPUTBUFFER ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } h->data = NULL; h->capacity = 0; @@ -80,7 +85,7 @@ int16_t JB4_INPUTBUFFER_Create( *ph = h; - return 0; + return IVAS_ERR_OK; } @@ -99,8 +104,12 @@ void JB4_INPUTBUFFER_Destroy( { return; } + if ( h->data ) + { free( h->data ); + } + free( h ); *ph = NULL; @@ -109,7 +118,7 @@ void JB4_INPUTBUFFER_Destroy( /* Initializes a input buffer with a fixed maximum allowed number of elements */ -int16_t JB4_INPUTBUFFER_Init( +ivas_error JB4_INPUTBUFFER_Init( JB4_INPUTBUFFER_HANDLE h, uint16_t capacity, int16_t ( *compareFunction )( const JB4_INPUTBUFFER_ELEMENT first, const JB4_INPUTBUFFER_ELEMENT second, bool *replaceWithNewElementIfEqual ) ) @@ -117,13 +126,17 @@ int16_t JB4_INPUTBUFFER_Init( /* keep one element free to be able to decide between full/empty buffer */ ++capacity; - h->data = malloc( capacity * sizeof( JB4_INPUTBUFFER_ELEMENT ) ); + if ( ( h->data = malloc( capacity * sizeof( JB4_INPUTBUFFER_ELEMENT ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } + h->capacity = capacity; h->writePos = 0; h->readPos = 0; h->compareFunction = compareFunction; - return 0; + return IVAS_ERR_OK; } diff --git a/lib_dec/jbm_jb4_inputbuffer.h b/lib_dec/jbm_jb4_inputbuffer.h index 7af58a31d3..6087ecb207 100644 --- a/lib_dec/jbm_jb4_inputbuffer.h +++ b/lib_dec/jbm_jb4_inputbuffer.h @@ -48,14 +48,11 @@ typedef struct JB4_INPUTBUFFER *JB4_INPUTBUFFER_HANDLE; typedef void *JB4_INPUTBUFFER_ELEMENT; -int16_t JB4_INPUTBUFFER_Create( JB4_INPUTBUFFER_HANDLE *ph ); +ivas_error JB4_INPUTBUFFER_Create( JB4_INPUTBUFFER_HANDLE *ph ); void JB4_INPUTBUFFER_Destroy( JB4_INPUTBUFFER_HANDLE *ph ); -int16_t JB4_INPUTBUFFER_Init( - JB4_INPUTBUFFER_HANDLE h, - uint16_t capacity, - int16_t ( *compareFunction )( const JB4_INPUTBUFFER_ELEMENT newElement, const JB4_INPUTBUFFER_ELEMENT arrayElement, bool *replaceWithNewElementIfEqual ) ); +ivas_error JB4_INPUTBUFFER_Init( JB4_INPUTBUFFER_HANDLE h, uint16_t capacity, int16_t ( *compareFunction )( const JB4_INPUTBUFFER_ELEMENT newElement, const JB4_INPUTBUFFER_ELEMENT arrayElement, bool *replaceWithNewElementIfEqual ) ); int16_t JB4_INPUTBUFFER_Enque( JB4_INPUTBUFFER_HANDLE h, JB4_INPUTBUFFER_ELEMENT element, JB4_INPUTBUFFER_ELEMENT *replacedElement ); diff --git a/lib_dec/jbm_jb4_jmf.c b/lib_dec/jbm_jb4_jmf.c index 8ec24046f0..85e9980e6e 100644 --- a/lib_dec/jbm_jb4_jmf.c +++ b/lib_dec/jbm_jb4_jmf.c @@ -84,19 +84,35 @@ struct JB4_JMF /** helper function to add an entry at back of the buffer */ -static void JB4_JMF_pushBack( JB4_JMF_HANDLE h, int32_t delay, int32_t offset, uint32_t time ); +static void JB4_JMF_pushBack( JB4_JMF_HANDLE h, const int32_t delay, const int32_t offset, const uint32_t time ); + /** helper function to remove an entry from the front of the buffer */ static void JB4_JMF_popFront( JB4_JMF_HANDLE h ); -int16_t JB4_JMF_Create( +ivas_error JB4_JMF_Create( JB4_JMF_HANDLE *ph ) { - JB4_JMF_HANDLE h = malloc( sizeof( struct JB4_JMF ) ); + JB4_JMF_HANDLE h; + ivas_error error; + + if ( ( h = malloc( sizeof( struct JB4_JMF ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } - JB4_CIRCULARBUFFER_Create( &h->fifo ); - JB4_CIRCULARBUFFER_Create( &h->offsetFifo ); - JB4_CIRCULARBUFFER_Create( &h->timeStampFifo ); + if ( ( error = JB4_CIRCULARBUFFER_Create( &h->fifo ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( ( JB4_CIRCULARBUFFER_Create( &h->offsetFifo ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( ( JB4_CIRCULARBUFFER_Create( &h->timeStampFifo ) ) != IVAS_ERR_OK ) + { + return error; + } h->timeScale = 1000; h->consideredFraction = 1000; @@ -108,7 +124,7 @@ int16_t JB4_JMF_Create( *ph = h; - return 0; + return IVAS_ERR_OK; } @@ -141,10 +157,10 @@ void JB4_JMF_Destroy( /* function to set the window size of the fifo and the fraction which will be considered */ int16_t JB4_JMF_Init( JB4_JMF_HANDLE h, - int16_t timeScale, - uint16_t windowSize, - uint16_t windowDuration, - uint16_t consideredFraction ) + const int16_t timeScale, + const uint16_t windowSize, + const uint16_t windowDuration, + const uint16_t consideredFraction ) { /* check parameters */ @@ -175,8 +191,8 @@ int16_t JB4_JMF_Init( /* function to calculate delay for the current packet */ int16_t JB4_JMF_PushPacket( JB4_JMF_HANDLE h, - uint32_t sysTime, - uint32_t rtpTimeStamp ) + const uint32_t sysTime, + const uint32_t rtpTimeStamp ) { int32_t rtpTimeDiff, sysTimeDiff; int32_t offset, delay; @@ -267,9 +283,9 @@ int16_t JB4_JMF_MinOffset( /* helper function to add entry at back of the buffer */ static void JB4_JMF_pushBack( JB4_JMF_HANDLE h, - int32_t delay, - int32_t offset, - uint32_t time ) + const int32_t delay, + const int32_t offset, + const uint32_t time ) { int32_t minTime, maxTime; uint32_t duration; diff --git a/lib_dec/jbm_jb4_jmf.h b/lib_dec/jbm_jb4_jmf.h index 745d61ce92..5efff7cd5e 100644 --- a/lib_dec/jbm_jb4_jmf.h +++ b/lib_dec/jbm_jb4_jmf.h @@ -45,13 +45,13 @@ /** handle for jitter measure fifo - a fifo used for windowed measure of network status */ typedef struct JB4_JMF *JB4_JMF_HANDLE; -int16_t JB4_JMF_Create( JB4_JMF_HANDLE *ph ); +ivas_error JB4_JMF_Create( JB4_JMF_HANDLE *ph ); void JB4_JMF_Destroy( JB4_JMF_HANDLE *ph ); -int16_t JB4_JMF_Init( JB4_JMF_HANDLE h, int16_t timeScale, uint16_t windowSize, uint16_t windowDuration, uint16_t consideredFraction ); +int16_t JB4_JMF_Init( JB4_JMF_HANDLE h, const int16_t timeScale, const uint16_t windowSize, const uint16_t windowDuration, const uint16_t consideredFraction ); -int16_t JB4_JMF_PushPacket( JB4_JMF_HANDLE h, uint32_t sysTime, uint32_t rtpTimeStamp ); +int16_t JB4_JMF_PushPacket( JB4_JMF_HANDLE h, const uint32_t sysTime, const uint32_t rtpTimeStamp ); int16_t JB4_JMF_Jitter( const JB4_JMF_HANDLE h, uint32_t *jitter ); diff --git a/lib_dec/jbm_jb4sb.c b/lib_dec/jbm_jb4sb.c index 07d6acce93..755187b640 100644 --- a/lib_dec/jbm_jb4sb.c +++ b/lib_dec/jbm_jb4sb.c @@ -61,7 +61,7 @@ #define MAXOFFSET 10 /*! Calculates the difference between two RTP timestamps - the diff is positive, if B 'later', negative otherwise */ -static int32_t JB4_rtpTimeStampDiff( uint32_t tsA, uint32_t tsB ); +static int32_t JB4_rtpTimeStampDiff( const uint32_t tsA, const uint32_t tsB ); /* function to calculate different options for the target playout delay */ static void JB4_targetPlayoutDelay( const JB4_HANDLE h, uint32_t *targetMin, uint32_t *targetMax, uint32_t *targetDtx, uint32_t *targetStartUp ); /*! function to do playout adaptation before playing the next data unit */ @@ -88,18 +88,18 @@ static int16_t JB4_inspectBufferForDropping( const JB4_HANDLE h, bool *dropEarly /* function to look into the buffer and check if it makes sense to drop a data unit during DTX */ static int16_t JB4_checkDtxDropping( const JB4_HANDLE h ); /*! function to estimate the short term jitter */ -static void JB4_estimateShortTermJitter( JB4_HANDLE h, uint32_t rcvTime, uint32_t rtpTimeStamp ); +static void JB4_estimateShortTermJitter( JB4_HANDLE h, const uint32_t rcvTime, const uint32_t rtpTimeStamp ); /*! function to pop a data unit from the buffer */ -static void JB4_popFromBuffer( JB4_HANDLE h, uint32_t sysTime, JB4_DATAUNIT_HANDLE *pDataUnit ); +static void JB4_popFromBuffer( JB4_HANDLE h, const uint32_t sysTime, JB4_DATAUNIT_HANDLE *pDataUnit ); /*! function to drop a data unit from the buffer - updates nShrinked */ static void JB4_dropFromBuffer( JB4_HANDLE h ); /*! function to calculate the playout delay based on the current jitter */ /*! @param[in] playTime the system time when the data unit will be played * @param[in] timeStamp the time stamp of the data unit to played * @param[out] delay the calculated playout delay */ -static int16_t JB4_playoutDelay( const JB4_HANDLE h, uint32_t playTime, uint32_t rtpTimeStamp, uint32_t *delay ); +static int16_t JB4_playoutDelay( const JB4_HANDLE h, const uint32_t playTime, const uint32_t rtpTimeStamp, uint32_t *delay ); /*! function to update lastPlayoutDelay and lastTargetTime after popFromBuffer() */ -static void JB4_updateLastTimingMembers( JB4_HANDLE h, uint32_t playTime, uint32_t rtpTimeStamp ); +static void JB4_updateLastTimingMembers( JB4_HANDLE h, const uint32_t playTime, const uint32_t rtpTimeStamp ); /*! function to compare the RTP time stamps of two data units: newElement==arrayElement ? 0 : (newElement>arrayElement ? +1 : -1) */ static int16_t JB4_inputBufferCompareFunction( const JB4_INPUTBUFFER_ELEMENT newElement, const JB4_INPUTBUFFER_ELEMENT arrayElement, bool *replaceWithNewElementIfEqual ); @@ -207,6 +207,7 @@ ivas_error JB4_Create( { int16_t iter; JB4_HANDLE h; + ivas_error error; if ( ( h = malloc( sizeof( struct JB4 ) ) ) == NULL ) { @@ -228,12 +229,23 @@ ivas_error JB4_Create( /* internal configuration values - do not change!!! */ h->timeScale = 0; h->frameDuration = 0; + /* jitter buffer configuration values: done in JB4_Init() */ /* short term jitter evaluation */ - JB4_JMF_Create( &h->stJmf ); - JB4_CIRCULARBUFFER_Create( &h->stJitterFifo ); - JB4_CIRCULARBUFFER_Create( &h->stTimeStampFifo ); + if ( ( error = JB4_JMF_Create( &h->stJmf ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( ( error = JB4_CIRCULARBUFFER_Create( &h->stJitterFifo ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( ( error = JB4_CIRCULARBUFFER_Create( &h->stTimeStampFifo ) ) != IVAS_ERR_OK ) + { + return error; + } h->stJitter = 0; + /* jitter buffer data */ h->firstDataUnitPopped = false; h->prevPopSysTime = 0; @@ -266,11 +278,18 @@ ivas_error JB4_Create( move32(); /* members to store the data units */ - JB4_INPUTBUFFER_Create( &h->inputBuffer ); + if ( ( error = JB4_INPUTBUFFER_Create( &h->inputBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } + /* allocate memory for data units */ for ( iter = 0; iter < MAX_JBM_SLOTS; ++iter ) { - h->memorySlots[iter].data = malloc( MAX_AU_SIZE ); + if ( ( h->memorySlots[iter].data = malloc( MAX_AU_SIZE ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JB4 structure\n" ) ); + } h->freeMemorySlots[iter] = &h->memorySlots[iter]; } h->nFreeMemorySlots = MAX_JBM_SLOTS; @@ -314,12 +333,13 @@ void JB4_Destroy( } -int16_t JB4_Init( +ivas_error JB4_Init( JB4_HANDLE h, - int16_t safetyMargin ) + const int16_t safetyMargin ) { uint16_t ltJmfSize, stFifoSize, stJmfSize, stJmfAllowedLateLoss; uint16_t inputBufferCapacity; + ivas_error error; /* internal timescale is 1000, frame duration is 20ms */ h->timeScale = 1000; /* ms */ @@ -340,9 +360,13 @@ int16_t JB4_Init( JB4_JMF_Init( h->stJmf, h->timeScale, stJmfSize, h->timeScale /* 1s */, (uint16_t) ( 1000 - stJmfAllowedLateLoss ) ); inputBufferCapacity = MAX_JBM_SLOTS - 2; - JB4_INPUTBUFFER_Init( h->inputBuffer, inputBufferCapacity, JB4_inputBufferCompareFunction ); - return 0; + if ( ( error = JB4_INPUTBUFFER_Init( h->inputBuffer, inputBufferCapacity, JB4_inputBufferCompareFunction ) ) != IVAS_ERR_OK ) + { + return error; + } + + return IVAS_ERR_OK; } @@ -383,7 +407,7 @@ void JB4_FreeDataUnit( int16_t JB4_PushDataUnit( JB4_HANDLE h, JB4_DATAUNIT_HANDLE dataUnit, - uint32_t rcvTime ) + const uint32_t rcvTime ) { JB4_DATAUNIT_HANDLE droppedDataUnit = NULL; @@ -551,8 +575,8 @@ int16_t JB4_FECoffset( int16_t JB4_PopDataUnit( JB4_HANDLE h, - uint32_t sysTime, - uint32_t extBufferedTime, + const uint32_t sysTime, + const uint32_t extBufferedTime, JB4_DATAUNIT_HANDLE *pDataUnit, uint32_t *scale, uint32_t *maxScaling ) @@ -574,8 +598,8 @@ int16_t JB4_PopDataUnit( /* Calculates the difference between two RTP timestamps - the diff is positive, if B 'later', negative otherwise */ static int32_t JB4_rtpTimeStampDiff( - uint32_t tsA, - uint32_t tsB ) + const uint32_t tsA, + const uint32_t tsB ) { int32_t ret; /* do not dare to inline this function, casting to int32_t is important here! */ @@ -1058,8 +1082,8 @@ static int16_t JB4_checkDtxDropping( /* function to estimate the short term jitter */ static void JB4_estimateShortTermJitter( JB4_HANDLE h, - uint32_t rcvTime, - uint32_t rtpTimeStamp ) + const uint32_t rcvTime, + const uint32_t rtpTimeStamp ) { uint32_t jitter, duration, maxDuration; int32_t minTime, maxTime; @@ -1121,7 +1145,7 @@ static void JB4_estimateShortTermJitter( /* function to pop a data unit from the buffer */ static void JB4_popFromBuffer( JB4_HANDLE h, - uint32_t sysTime, + const uint32_t sysTime, JB4_DATAUNIT_HANDLE *pDataUnit ) { JB4_DATAUNIT_HANDLE nextDataUnit; @@ -1430,8 +1454,8 @@ static void JB4_dropFromBuffer( /* function to calculate the playout delay based on the current jitter */ static int16_t JB4_playoutDelay( const JB4_HANDLE h, - uint32_t playTime, - uint32_t rtpTimeStamp, + const uint32_t playTime, + const uint32_t rtpTimeStamp, uint32_t *delay ) { int32_t minOffTicks; @@ -1450,8 +1474,8 @@ static int16_t JB4_playoutDelay( /* function to update lastPlayoutDelay and lastTargetTime after popFromBuffer() */ static void JB4_updateLastTimingMembers( JB4_HANDLE h, - uint32_t playTime, - uint32_t rtpTimeStamp ) + const uint32_t playTime, + const uint32_t rtpTimeStamp ) { int32_t minOffTicks; diff --git a/lib_dec/jbm_jb4sb.h b/lib_dec/jbm_jb4sb.h index 6b31111670..54b873b006 100644 --- a/lib_dec/jbm_jb4sb.h +++ b/lib_dec/jbm_jb4sb.h @@ -85,15 +85,15 @@ ivas_error JB4_Create( JB4_HANDLE *ph ); void JB4_Destroy( JB4_HANDLE *ph ); -int16_t JB4_Init( JB4_HANDLE h, int16_t safetyMargin ); +ivas_error JB4_Init( JB4_HANDLE h, const int16_t safetyMargin ); JB4_DATAUNIT_HANDLE JB4_AllocDataUnit( JB4_HANDLE h ); void JB4_FreeDataUnit( JB4_HANDLE h, JB4_DATAUNIT_HANDLE dataUnit ); -int16_t JB4_PushDataUnit( JB4_HANDLE h, JB4_DATAUNIT_HANDLE dataUnit, uint32_t rcvTime ); +int16_t JB4_PushDataUnit( JB4_HANDLE h, JB4_DATAUNIT_HANDLE dataUnit, const uint32_t rcvTime ); -int16_t JB4_PopDataUnit( JB4_HANDLE h, uint32_t sysTime, uint32_t extBufferedTime, JB4_DATAUNIT_HANDLE *pDataUnit, uint32_t *scale, uint32_t *maxScaling ); +int16_t JB4_PopDataUnit( JB4_HANDLE h, const uint32_t sysTime, const uint32_t extBufferedTime, JB4_DATAUNIT_HANDLE *pDataUnit, uint32_t *scale, uint32_t *maxScaling ); int16_t JB4_getFECoffset( JB4_HANDLE h ); diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index c09a21e790..c816a9d9c8 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -139,9 +139,9 @@ static bool extend_frm( apa_state_t *ps, const int16_t frm_in[], int16_t frm_out *---------------------------------------------------------------------*/ /* Allocates memory for state struct and initializes elements. */ -uint8_t apa_init( +ivas_error apa_init( apa_state_t **pps, - int32_t num_channels ) + const int32_t num_channels ) { apa_state_t *ps = NULL; @@ -152,22 +152,22 @@ uint8_t apa_init( } /* allocate state struct */ - ps = (apa_state_t *) malloc( sizeof( apa_state_t ) ); - if ( !ps ) + if ( ( ps = (apa_state_t *) malloc( sizeof( apa_state_t ) ) ) == NULL ) { - return 2; + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); } + ps->num_channels = (uint16_t) num_channels; ps->buf_out_capacity = (uint16_t) ( APA_BUF_PER_CHANNEL * num_channels ); - ps->buf_out = malloc( sizeof( float ) * ps->buf_out_capacity ); - if ( !ps->buf_out ) + if ( ( ps->buf_out = malloc( sizeof( float ) * ps->buf_out_capacity ) ) == NULL ) { - return 2; + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); } + apa_reset( ps ); *pps = ps; - return 0; + return IVAS_ERR_OK; } diff --git a/lib_dec/jbm_pcmdsp_apa.h b/lib_dec/jbm_pcmdsp_apa.h index 2f0da13e99..543042f53b 100644 --- a/lib_dec/jbm_pcmdsp_apa.h +++ b/lib_dec/jbm_pcmdsp_apa.h @@ -91,8 +91,8 @@ typedef struct apa_state_t *PCMDSP_APA_HANDLE; /*! Allocates memory for state struct and initializes elements. * @return 0 on success, 1 on failure */ -uint8_t apa_init( apa_state_t **s, - int32_t num_channels ); +ivas_error apa_init( apa_state_t **s, + const int32_t num_channels ); /*! Sets state variables to initial value. */ void apa_reset( apa_state_t *s ); diff --git a/lib_dec/jbm_pcmdsp_fifo.c b/lib_dec/jbm_pcmdsp_fifo.c index 522da30dde..81e833e5e5 100644 --- a/lib_dec/jbm_pcmdsp_fifo.c +++ b/lib_dec/jbm_pcmdsp_fifo.c @@ -48,10 +48,15 @@ /* Creates a FIFO. */ -int16_t pcmdsp_fifo_create( +ivas_error pcmdsp_fifo_create( PCMDSP_FIFO_HANDLE *ph ) { - PCMDSP_FIFO_HANDLE h = malloc( sizeof( struct PCMDSP_FIFO ) ); + PCMDSP_FIFO_HANDLE h; + + if ( ( h = malloc( sizeof( struct PCMDSP_FIFO ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } h->size = 0; h->capacity = 0; @@ -63,7 +68,7 @@ int16_t pcmdsp_fifo_create( *ph = h; - return 0; + return IVAS_ERR_OK; } @@ -95,7 +100,7 @@ void pcmdsp_fifo_destroy( } /* Initializes the FIFO with a fixed maximum allowed number audio samples. */ -int16_t pcmdsp_fifo_init( +ivas_error pcmdsp_fifo_init( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel, uint16_t nChannels, @@ -106,12 +111,16 @@ int16_t pcmdsp_fifo_init( h->capacity = nSamplesPerChannel; h->nBytesPerSampleSet = nChannels * nBytesPerSample; nDataBytes = nSamplesPerChannel * h->nBytesPerSampleSet; - h->dataBegin = malloc( nDataBytes ); + if ( ( h->dataBegin = malloc( nDataBytes ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } + h->dataEnd = h->dataBegin + nDataBytes; h->dataWriteIterator = h->dataBegin; h->dataReadIterator = h->dataBegin; - return 0; + return IVAS_ERR_OK; } diff --git a/lib_dec/jbm_pcmdsp_fifo.h b/lib_dec/jbm_pcmdsp_fifo.h index faa482e695..13ffd146f8 100644 --- a/lib_dec/jbm_pcmdsp_fifo.h +++ b/lib_dec/jbm_pcmdsp_fifo.h @@ -66,11 +66,11 @@ struct PCMDSP_FIFO typedef struct PCMDSP_FIFO *PCMDSP_FIFO_HANDLE; -int16_t pcmdsp_fifo_create( PCMDSP_FIFO_HANDLE *ph ); +ivas_error pcmdsp_fifo_create( PCMDSP_FIFO_HANDLE *ph ); void pcmdsp_fifo_destroy( PCMDSP_FIFO_HANDLE *ph ); -int16_t pcmdsp_fifo_init( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel, uint16_t nChannels, uint16_t nBytesPerSample ); +ivas_error pcmdsp_fifo_init( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel, uint16_t nChannels, uint16_t nBytesPerSample ); int16_t pcmdsp_fifo_write( PCMDSP_FIFO_HANDLE h, const uint8_t *samples, uint16_t nSamplesPerChannel ); diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 237fc0c0ca..95f7dca8a7 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -547,9 +547,9 @@ ivas_error IVAS_DEC_EnableVoIP( { return error; } - if ( JB4_Init( hIvasDec->hVoIP->hJBM, jbmSafetyMargin ) != 0 ) + if ( ( error = JB4_Init( hIvasDec->hVoIP->hJBM, jbmSafetyMargin ) ) != IVAS_ERR_OK ) { - return IVAS_ERR_FAILED_ALLOC; + return error; } if ( hDecoderConfig->output_Fs == 8000 ) @@ -577,13 +577,12 @@ ivas_error IVAS_DEC_EnableVoIP( return IVAS_ERR_INIT_ERROR; } - if ( apa_init( &hIvasDec->hVoIP->hTimeScaler, - hDecoderConfig->nchan_out ) != 0 || + if ( apa_init( &hIvasDec->hVoIP->hTimeScaler, hDecoderConfig->nchan_out ) != IVAS_ERR_OK || apa_set_rate( hIvasDec->hVoIP->hTimeScaler, hDecoderConfig->output_Fs ) != 0 || apa_set_complexity_options( hIvasDec->hVoIP->hTimeScaler, wss, css ) != 0 || apa_set_quality( hIvasDec->hVoIP->hTimeScaler, 1, 4, 4 ) != 0 || - pcmdsp_fifo_create( &hIvasDec->hVoIP->hFifoAfterTimeScaler ) != 0 || - pcmdsp_fifo_init( hIvasDec->hVoIP->hFifoAfterTimeScaler, (uint16_t) ( hDecoderConfig->output_Fs * 4 / FRAMES_PER_SEC ) /* 4 frames */, hDecoderConfig->nchan_out, sizeof( int16_t ) ) != 0 ) + pcmdsp_fifo_create( &hIvasDec->hVoIP->hFifoAfterTimeScaler ) != IVAS_ERR_OK || + pcmdsp_fifo_init( hIvasDec->hVoIP->hFifoAfterTimeScaler, (uint16_t) ( hDecoderConfig->output_Fs * 4 / FRAMES_PER_SEC ) /* 4 frames */, hDecoderConfig->nchan_out, sizeof( int16_t ) ) != IVAS_ERR_OK ) { return IVAS_ERR_INIT_ERROR; } diff --git a/lib_enc/fd_cng_enc.c b/lib_enc/fd_cng_enc.c index a17369923c..5789f0dfd9 100644 --- a/lib_enc/fd_cng_enc.c +++ b/lib_enc/fd_cng_enc.c @@ -66,8 +66,7 @@ ivas_error createFdCngEnc( *hFdCngEnc = NULL; /* Allocate memory */ - hs = (HANDLE_FD_CNG_ENC) malloc( sizeof( FD_CNG_ENC ) ); - if ( hs == NULL ) + if ( ( hs = (HANDLE_FD_CNG_ENC) malloc( sizeof( FD_CNG_ENC ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for FD CNG ENC structure" ); } diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index be61dd1d0f..a143ff37d2 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -129,7 +129,10 @@ ivas_error ivas_dirac_enc_open( for ( i = 0; i < DIRAC_MAX_ANA_CHANS; i++ ) { - hDirAC->sba_synchro_buffer[i] = (float *) malloc( hDirAC->num_samples_synchro_delay * sizeof( float ) ); + if ( ( hDirAC->sba_synchro_buffer[i] = (float *) malloc( hDirAC->num_samples_synchro_delay * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_zero( hDirAC->sba_synchro_buffer[i], hDirAC->num_samples_synchro_delay ); } } @@ -146,11 +149,17 @@ ivas_error ivas_dirac_enc_open( /* intensity 3-dim */ for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - hDirAC->direction_vector_m[i] = (float **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ); + if ( ( hDirAC->direction_vector_m[i] = (float **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { - hDirAC->direction_vector_m[i][j] = (float *) malloc( DIRAC_MAX_NBANDS * sizeof( float ) ); + if ( ( hDirAC->direction_vector_m[i][j] = (float *) malloc( DIRAC_MAX_NBANDS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->direction_vector_m[i][j], 0.0f, DIRAC_MAX_NBANDS ); } } @@ -158,14 +167,24 @@ ivas_error ivas_dirac_enc_open( hDirAC->no_col_avg_diff = (int16_t) ( DIRAC_NO_COL_AVG_DIFF_NS / dirac_slot_ns ); for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - hDirAC->buffer_intensity_real[i] = (float **) malloc( hDirAC->no_col_avg_diff * sizeof( float * ) ); + if ( ( hDirAC->buffer_intensity_real[i] = (float **) malloc( hDirAC->no_col_avg_diff * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } for ( j = 0; j < hDirAC->no_col_avg_diff; j++ ) { - hDirAC->buffer_intensity_real[i][j] = (float *) malloc( DIRAC_MAX_NBANDS * sizeof( float ) ); + if ( ( hDirAC->buffer_intensity_real[i][j] = (float *) malloc( DIRAC_MAX_NBANDS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->buffer_intensity_real[i][j], 0.0f, DIRAC_MAX_NBANDS ); } } - hDirAC->buffer_energy = (float *) malloc( DIRAC_MAX_NBANDS * hDirAC->no_col_avg_diff * sizeof( float ) ); + + if ( ( hDirAC->buffer_energy = (float *) malloc( DIRAC_MAX_NBANDS * hDirAC->no_col_avg_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->buffer_energy, 0.0f, DIRAC_MAX_NBANDS * hDirAC->no_col_avg_diff ); if ( st_ivas->hQMetaData->useLowerRes ) diff --git a/lib_rend/ivas_limiter.c b/lib_rend/ivas_limiter.c index 9ea9192e2e..28c272bc0c 100644 --- a/lib_rend/ivas_limiter.c +++ b/lib_rend/ivas_limiter.c @@ -114,7 +114,10 @@ IVAS_LIMITER_HANDLE ivas_limiter_open( return NULL; } - hLimiter = malloc( sizeof( IVAS_LIMITER ) ); + if ( ( hLimiter = malloc( sizeof( IVAS_LIMITER ) ) ) == NULL ) + { + return NULL; + } hLimiter->max_num_channels = max_num_channels; hLimiter->num_channels = max_num_channels; diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index 9da9c2750c..509d22d320 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -35,6 +35,7 @@ #include "prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_TdBinauralRenderer.h" +#include "ivas_error.h" #include "wmc_auto.h" #ifdef DEBUGGING #include "debug.h" @@ -53,7 +54,7 @@ * Local functions *-------------------------------------------------------------------------*/ -static void DefaultBSplineModel( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, const int32_t output_Fs ); +static ivas_error DefaultBSplineModel( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, const int32_t output_Fs ); /*-------------------------------------------------------------------* @@ -193,6 +194,7 @@ ivas_error TDREND_MIX_Init( const int32_t output_Fs /* i : Output sampling rate */ ) { + ivas_error error; hBinRendererTd->Gain = 1.0f; @@ -225,7 +227,10 @@ ivas_error TDREND_MIX_Init( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); } - DefaultBSplineModel( hBinRendererTd->HrFiltSet_p, output_Fs ); + if ( ( error = DefaultBSplineModel( hBinRendererTd->HrFiltSet_p, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } *hHrtfTD = hBinRendererTd->HrFiltSet_p; } else @@ -340,15 +345,22 @@ ivas_error TDREND_MIX_AddSrc( * Allocate the B Spline HR Filter model. --------------------------------------------------------------------*/ -void BSplineModelEvalAlloc( +static ivas_error BSplineModelEvalAlloc( ModelParams_t *model, /* i : Model parameters */ ModelEval_t *modelEval /* i/o: Model evaluation structure */ ) { - modelEval->hrfModL = (float *) malloc( model->K * sizeof( float ) ); - modelEval->hrfModR = (float *) malloc( model->K * sizeof( float ) ); + if ( ( modelEval->hrfModL = (float *) malloc( model->K * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); + } - return; + if ( ( modelEval->hrfModR = (float *) malloc( model->K * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); + } + + return IVAS_ERR_OK; } @@ -358,7 +370,7 @@ void BSplineModelEvalAlloc( * Init default HRTF model --------------------------------------------------------------------*/ -static void DefaultBSplineModel( +static ivas_error DefaultBSplineModel( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* o : Loaded HR filter set */ const int32_t output_Fs /* i : Output sampling rate */ ) @@ -366,6 +378,7 @@ static void DefaultBSplineModel( ModelParams_t *model; ModelParamsITD_t *modelITD; int16_t i, j; + ivas_error error; HrFiltSet_p->FilterMethod = TDREND_HRFILT_Method_BSplineModel; model = &( HrFiltSet_p->ModelParams ); @@ -402,11 +415,24 @@ static void DefaultBSplineModel( model->elevKSeq = (const float *) orange53_rom_elevKSeq; model->elevBsShape = (const float *) orange53_rom_elevBsShape; - model->azimBsShape = (const float **) malloc( model->num_unique_azim_splines * sizeof( float * ) ); + if ( ( model->azimBsShape = (const float **) malloc( model->num_unique_azim_splines * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); + } + model->azimBsShape[0] = (const float *) orange53_rom_azimBsShape; - model->azimKSeq = (float **) malloc( 18 * sizeof( float * ) ); - model->azimKSeq[0] = (float *) malloc( 2 * sizeof( float * ) ); - model->azimKSeq[17] = (float *) malloc( 2 * sizeof( float * ) ); + if ( ( model->azimKSeq = (float **) malloc( 18 * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); + } + if ( ( model->azimKSeq[0] = (float *) malloc( 2 * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); + } + if ( ( model->azimKSeq[17] = (float *) malloc( 2 * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); + } model->azimKSeq[0][0] = 0.0f; model->azimKSeq[17][0] = 0.0f; model->azimKSeq[0][1] = 360.0f; @@ -414,7 +440,10 @@ static void DefaultBSplineModel( for ( i = 1; i < 17; i++ ) { - model->azimKSeq[i] = (float *) malloc( model->azimDim2[i] * sizeof( float * ) ); /* azimDim2[i] = 91, i=2..15 */ + if ( ( model->azimKSeq[i] = (float *) malloc( model->azimDim2[i] * sizeof( float * ) ) ) == NULL ) /* azimDim2[i] = 91, i=2..15 */ + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); + } for ( j = 0; j < model->azimDim2[i]; j++ ) { model->azimKSeq[i][j] = (float) orange53_rom_azimSegSamples[0] * j; @@ -499,7 +528,10 @@ static void DefaultBSplineModel( HrFiltSet_p->SampleRate = output_Fs; HrFiltSet_p->FiltLength = HrFiltSet_p->ModelParams.K; - BSplineModelEvalAlloc( &HrFiltSet_p->ModelParams, &HrFiltSet_p->ModelEval ); + if ( ( error = BSplineModelEvalAlloc( &HrFiltSet_p->ModelParams, &HrFiltSet_p->ModelEval ) ) != IVAS_ERR_OK ) + { + return error; + } - return; + return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 694764979d..d524228812 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -193,11 +193,11 @@ static ivas_error TDREND_SRC_REND_Alloc( *SrcRend_pp = NULL; /* Allocate the TDREND_SRC_REND_t variable */ - SrcRend_p = (TDREND_SRC_REND_t *) malloc( sizeof( TDREND_SRC_REND_t ) ); - if ( SrcRend_p == NULL ) + if ( ( SrcRend_p = (TDREND_SRC_REND_t *) malloc( sizeof( TDREND_SRC_REND_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "SrcRend_p allocation error\n" ) ); } + *SrcRend_pp = SrcRend_p; return IVAS_ERR_OK; @@ -389,8 +389,7 @@ static ivas_error TDREND_SRC_SPATIAL_Alloc( *SrcSpatial_pp = NULL; /* Allocate the TDREND_SRC_t variable */ - SrcSpatial_p = (TDREND_SRC_SPATIAL_t *) malloc( sizeof( TDREND_SRC_SPATIAL_t ) ); - if ( SrcSpatial_p == NULL ) + if ( ( SrcSpatial_p = (TDREND_SRC_SPATIAL_t *) malloc( sizeof( TDREND_SRC_SPATIAL_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "TDREND_SRC_SPATIAL_t allocation error\n" ) ); } @@ -601,8 +600,7 @@ ivas_error TDREND_SRC_Alloc( *Src_pp = NULL; /* Allocate the TDREND_SRC_t variable */ - Src_p = (TDREND_SRC_t *) malloc( sizeof( TDREND_SRC_t ) ); - if ( Src_p == NULL ) + if ( ( Src_p = (TDREND_SRC_t *) malloc( sizeof( TDREND_SRC_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, " TDREND_SRC_Alloc: Allocation error\n" ) ); } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index df254e0286..9e92e45d57 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -300,11 +300,6 @@ void TDREND_Update_object_positions( float output[][L_FRAME48k] /* i/o: SCE/MC channels */ ); -void BSplineModelEvalAlloc( - ModelParams_t *model, /* i : Model parameters */ - ModelEval_t *modelEval /* i/o: Model evaluation structure */ -); - void BSplineModelEvalDealloc( ModelParams_t *model, /* i : Model parameters */ ModelEval_t *modelEval /* i : Model evaluation structure */ diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index 405ae8d72f..ccee4ffe72 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -61,8 +61,7 @@ ivas_error ivas_render_config_open( ) { /* Allocate HR filter set for headphones configuration */ - *hRenderConfig = (RENDER_CONFIG_HANDLE) malloc( sizeof( RENDER_CONFIG_DATA ) ); - if ( *hRenderConfig == NULL ) + if ( ( *hRenderConfig = (RENDER_CONFIG_HANDLE) malloc( sizeof( RENDER_CONFIG_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer configuration!" ); } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 50acff2bb5..d0e33a2d83 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -571,10 +571,9 @@ static ivas_error initLimiter( ivas_limiter_close( phLimiter ); } - *phLimiter = ivas_limiter_open( (int16_t) numChannels, sampleRate ); - if ( *phLimiter == NULL ) + if ( ( *phLimiter = ivas_limiter_open( numChannels, sampleRate ) ) == NULL ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to open limiter" ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to open limiter handle" ); } return IVAS_ERR_OK; -- GitLab From bdaf96c7884dfb172b21fc03db89d17d9f087824 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Fri, 10 Mar 2023 15:25:57 +0200 Subject: [PATCH 216/375] Force utf8 encoding for the windows build output files --- .gitlab-ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2fc79fcc20..b946d39a72 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -286,8 +286,10 @@ build-codec-windows-cmake: - .rules-basis script: - *print-common-info-windows + - $winoutdata = $null - cmake -G "Visual Studio 15 2017" . -Bbuild - - cmake --build build -j16 | Out-File -FilePath $BUILD_OUTPUT + - cmake --build build -j16 | tee -variable winoutdata + - $winoutdata | Out-File $BUILD_OUTPUT -Encoding Utf8 - ("& python ci/check_for_warnings.py '$BUILD_OUTPUT'", "exit $LASTEXITCODE") | Invoke-Expression build-codec-windows-msbuild: @@ -296,7 +298,9 @@ build-codec-windows-msbuild: - .rules-basis script: - *print-common-info-windows - - MSBuild.exe .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Debug | tee $BUILD_OUTPUT + - $winoutdata = $null + - MSBuild.exe .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Debug | tee -variable winoutdata + - $winoutdata | Out-File $BUILD_OUTPUT -Encoding Utf8 - ("& python ci/check_for_warnings.py '$BUILD_OUTPUT'", "exit $LASTEXITCODE") | Invoke-Expression # --------------------------------------------------------------- -- GitLab From c868709c41f3a7cb0fddcf80169e9fa863f2042b Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Mon, 13 Mar 2023 12:33:36 +0100 Subject: [PATCH 217/375] issue 371: when delay compensation is disabled, the reporting print-out has a division-by-zero since a required variable is not properly assigned --- apps/decoder.c | 16 ++++++++++++++++ lib_com/options.h | 1 + 2 files changed, 17 insertions(+) diff --git a/apps/decoder.c b/apps/decoder.c index af9a847aab..aee3759a21 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1181,6 +1181,21 @@ static ivas_error initOnFirstGoodFrame( ivas_error error = IVAS_ERR_UNKNOWN; /* Now delay, number of output channels and frame size are known */ +#ifdef FIX_371_DELAY_REPORT + if ( ( error = IVAS_DEC_GetDelay( hIvasDec, pFullDelayNumSamples, delayTimeScale ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); + return error; + } + if ( !arg.delayCompensationEnabled ) + { +#ifdef BINAURALIZATION_DELAY_REPORT + pFullDelayNumSamples[0] = 0; +#else + *pFullDelayNumSamples = 0; +#endif + } +#else if ( arg.delayCompensationEnabled ) { if ( ( error = IVAS_DEC_GetDelay( hIvasDec, pFullDelayNumSamples, delayTimeScale ) ) != IVAS_ERR_OK ) @@ -1197,6 +1212,7 @@ static ivas_error initOnFirstGoodFrame( *pFullDelayNumSamples = 0; #endif } +#endif #ifdef BINAURALIZATION_DELAY_REPORT *pRemainingDelayNumSamples = pFullDelayNumSamples[0]; #else diff --git a/lib_com/options.h b/lib_com/options.h index 5fd4b3d2a6..758913fc97 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,6 +168,7 @@ #define ISM_HIGHEST_BITRATE /* VA: Issue 284: Update highest bitrate limit in ISM format */ #define TUNE_360_OBJECT_WITH_NOISE /* VA: issue 360: consider objects being speech+noise for active speech coding */ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ +#define FIX_371_DELAY_REPORT /* Issue 371: div. by zero with -no_delay_cmp */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ -- GitLab From 7b16a271c4e5d00d98850e3db0e54de36642f21c Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Mon, 13 Mar 2023 16:40:56 +0100 Subject: [PATCH 218/375] lib_rend: check validity of I/O config --- lib_com/ivas_error.h | 31 +++++++++++++++++++------------ lib_com/options.h | 1 + lib_rend/lib_rend.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 12 deletions(-) diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index 735086a7c1..b384e8dee5 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -86,6 +86,9 @@ typedef enum IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT, IVAS_ERR_ISM_INVALID_METADATA_VALUE, IVAS_ERR_INVALID_MASA_FORMAT_METADATA_FILE, +#ifdef FIX_372_LIB_REND_VALIDATE_IO + IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED, +#endif #ifdef DEBUGGING IVAS_ERR_INVALID_FORCE_MODE, #ifdef DEBUG_AGC_ENCODER_CMD_OPTION @@ -145,18 +148,7 @@ typedef enum static inline const char *ivas_error_to_string( ivas_error error_code ) { - /* For error categories that are likely to still have many changes to - * specific error codes, return one string per category */ - if ( ( error_code & 0xF000 ) == 0x1000 ) - { - return "API error"; - } - if ( ( error_code & 0xF000 ) == 0x2000 ) - { - return "data error"; - } - - /* For categories that are unlikely to change, use more specific strings */ + /* Try to match to a specific string */ switch ( error_code ) { case IVAS_ERR_OK: @@ -179,6 +171,10 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) return "Wrong number of channels"; case IVAS_ERR_INVALID_BUFFER_SIZE: return "Invalid buffer size"; +#ifdef FIX_372_LIB_REND_VALIDATE_IO + case IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED: + return "Unsupported input/output config pair"; +#endif case IVAS_ERR_FAILED_FILE_OPEN: return "File open error"; case IVAS_ERR_FAILED_FILE_WRITE: @@ -193,6 +189,17 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) break; } + /* For error categories that are likely to still have many changes to + * specific error codes, return one string per category */ + if ( ( error_code & 0xF000 ) == 0x1000 ) + { + return "API error"; + } + if ( ( error_code & 0xF000 ) == 0x2000 ) + { + return "data error"; + } + return "Unknown error"; } diff --git a/lib_com/options.h b/lib_com/options.h index 5fd4b3d2a6..940d3857fa 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,6 +168,7 @@ #define ISM_HIGHEST_BITRATE /* VA: Issue 284: Update highest bitrate limit in ISM format */ #define TUNE_360_OBJECT_WITH_NOISE /* VA: issue 360: consider objects being speech+noise for active speech coding */ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ +#define FIX_372_LIB_REND_VALIDATE_IO /* FhG: Issue 372: IVAS_rend segfaults with unsupported I/O configs - add validation checks of I/O config */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index d0e33a2d83..8a4807c8fc 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1050,6 +1050,21 @@ static CREND_WRAPPER defaultCrendWrapper( return w; } +#ifdef FIX_372_LIB_REND_VALIDATE_IO +static bool isIoConfigPairSupported( IVAS_REND_AudioConfig inConfig, IVAS_REND_AudioConfig outConfig ) +{ + /* Rendering mono or stereo to binaural is not supported */ + if ( ( inConfig == IVAS_REND_AUDIO_CONFIG_MONO || inConfig == IVAS_REND_AUDIO_CONFIG_STEREO ) && + getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) + { + return false; + } + + /* If not returned so far, config pair is supported */ + return true; +} +#endif + static ivas_error setRendInputActiveIsm( void *input, const IVAS_REND_AudioConfig inConfig, @@ -1065,6 +1080,13 @@ static ivas_error setRendInputActiveIsm( rendCtx = inputIsm->base.ctx; outConfig = *rendCtx.pOutConfig; +#ifdef FIX_372_LIB_REND_VALIDATE_IO + if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + { + return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + } +#endif + initRendInputBase( &inputIsm->base, inConfig, id, rendCtx ); inputIsm->currentPos = defaultObjectPosition(); @@ -1956,6 +1978,13 @@ static ivas_error setRendInputActiveMc( rendCtx = inputMc->base.ctx; outConfig = *rendCtx.pOutConfig; +#ifdef FIX_372_LIB_REND_VALIDATE_IO + if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + { + return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + } +#endif + initRendInputBase( &inputMc->base, inConfig, id, rendCtx ); setZeroPanMatrix( inputMc->panGains ); inputMc->customLsInput = defaultCustomLs(); @@ -2216,6 +2245,13 @@ static ivas_error setRendInputActiveSba( rendCtx = inputSba->base.ctx; outConfig = *rendCtx.pOutConfig; +#ifdef FIX_372_LIB_REND_VALIDATE_IO + if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + { + return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + } +#endif + initRendInputBase( &inputSba->base, inConfig, id, rendCtx ); setZeroPanMatrix( inputSba->hoaDecMtx ); #ifdef FIX_197_CREND_INTERFACE @@ -2618,6 +2654,13 @@ static ivas_error setRendInputActiveMasa( outConfig = *rendCtx.pOutConfig; (void) hRendCfg; /* Suppress warning */ +#ifdef FIX_372_LIB_REND_VALIDATE_IO + if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + { + return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + } +#endif + initRendInputBase( &inputMasa->base, inConfig, id, rendCtx ); if ( ( error = getAudioConfigNumChannels( inConfig, &numInChannels ) ) != IVAS_ERR_OK ) -- GitLab From e8a2a3cb416b30e932707eb8682a36edd459e94d Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Wed, 15 Mar 2023 08:34:06 +0100 Subject: [PATCH 219/375] Correct bug from merge with TUNE_360_OBJECT_WITH_NOISE --- lib_enc/ivas_ism_metadata_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index ee43fee5fe..07b3b2d718 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -262,7 +262,7 @@ ivas_error ivas_ism_metadata_enc( #ifdef TD5 #ifdef TUNE_360_OBJECT_WITH_NOISE /* In case of low level noise for low bitrate inactive frames, do not sent metadata */ - if ( localVAD[ch] == 0 && !( hSCE[ch]->hCoreCoder[0]->tcxonly ) && ( hSCE[ch]->hCoreCoder[0]->lp_noise <= 15 ) ) + if ( localVAD[ch] == 0 && !( hSCE[ch]->hCoreCoder[0]->tcxonly ) && ( hSCE[ch]->hCoreCoder[0]->lp_noise <= 10 ) ) { hIsmMeta[ch]->ism_metadata_flag = 0; } -- GitLab From 47a7d1f894fe5ae0d26dee4fbab5f1084c011c9f Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Wed, 15 Mar 2023 13:12:00 +0100 Subject: [PATCH 220/375] Updated wave file headers in testv with CopyAudio -F WAVE-NOEX --- scripts/testv/stv16c.wav | 2 +- scripts/testv/stv16n.wav | 2 +- scripts/testv/stv1ISM48s.wav | 2 +- scripts/testv/stv1MASA1TC48c.wav | 2 +- scripts/testv/stv1MASA1TC48n.wav | 2 +- scripts/testv/stv1MASA2TC48c.wav | 2 +- scripts/testv/stv1MASA2TC48n.wav | 4 ++-- scripts/testv/stv2ISM48s.wav | 2 +- scripts/testv/stv2MASA1TC48c.wav | 2 +- scripts/testv/stv2MASA2TC48c.wav | 2 +- scripts/testv/stv2OA32c.wav | 4 ++-- scripts/testv/stv2OA48c.wav | 4 ++-- scripts/testv/stv32c.wav | 4 ++-- scripts/testv/stv32n.wav | 2 +- scripts/testv/stv3ISM48s.wav | 4 ++-- scripts/testv/stv3OA32c.wav | 4 ++-- scripts/testv/stv3OA48c.wav | 4 ++-- scripts/testv/stv48c.wav | 2 +- scripts/testv/stv48n.wav | 2 +- scripts/testv/stv4ISM48n.wav | 4 ++-- scripts/testv/stv4ISM48s.wav | 4 ++-- scripts/testv/stv512MC48c.wav | 4 ++-- scripts/testv/stv514MC48c.wav | 4 ++-- scripts/testv/stv51MC48c.wav | 4 ++-- scripts/testv/stv714MC48c.wav | 4 ++-- scripts/testv/stv71MC48c.wav | 4 ++-- scripts/testv/stv8c.wav | 2 +- scripts/testv/stv8n.wav | 2 +- scripts/testv/stvFOA16c.wav | 4 ++-- scripts/testv/stvFOA32c.wav | 4 ++-- scripts/testv/stvFOA48c.wav | 4 ++-- scripts/testv/stvST16c.wav | 2 +- scripts/testv/stvST16n.wav | 2 +- scripts/testv/stvST32c.wav | 2 +- scripts/testv/stvST32n.wav | 2 +- scripts/testv/stvST48c.wav | 2 +- scripts/testv/stvST48n.wav | 2 +- 37 files changed, 54 insertions(+), 54 deletions(-) diff --git a/scripts/testv/stv16c.wav b/scripts/testv/stv16c.wav index 6923cea4ed..ad1748040b 100644 --- a/scripts/testv/stv16c.wav +++ b/scripts/testv/stv16c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:787f5198da219f4a449b2269d9f2a7c592abdbc9554a991b8b9656d53aac1884 +oid sha256:a00096069190d206e293ad526bcd3422ec2b4b192a8b32d083d42051b5a5de47 size 640108 diff --git a/scripts/testv/stv16n.wav b/scripts/testv/stv16n.wav index dd94fc0e63..837dccc273 100644 --- a/scripts/testv/stv16n.wav +++ b/scripts/testv/stv16n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:831f2439e3d728595e3583fea053a5f7130e5f09b69832e686b76a69d93bbcee +oid sha256:afc5f4dcac8c8e0d32951bc9543fc2b2c8027b1bfbc7c685669582ccd9abf277 size 620908 diff --git a/scripts/testv/stv1ISM48s.wav b/scripts/testv/stv1ISM48s.wav index ddcd5d3324..077ccb2571 100644 --- a/scripts/testv/stv1ISM48s.wav +++ b/scripts/testv/stv1ISM48s.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c6914081054030a4a99ab3556f86ecd817b477a132df8d837a8b11568debd49e +oid sha256:49a9e2129463dbd158f2d6fa3abebca00d9edaea42820684233db191d5dad8b1 size 2880106 diff --git a/scripts/testv/stv1MASA1TC48c.wav b/scripts/testv/stv1MASA1TC48c.wav index 60c2de7967..949e2669be 100644 --- a/scripts/testv/stv1MASA1TC48c.wav +++ b/scripts/testv/stv1MASA1TC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e9d4810b9aeee2f374c77ab3a0377c478e49e52d9e81b9ec2a01ddd0e8a0f8d4 +oid sha256:c7eb4652468f8d6f07ab7d8b9c068fc13494b8ed2fa4d860dade52aa7cecec5a size 288106 diff --git a/scripts/testv/stv1MASA1TC48n.wav b/scripts/testv/stv1MASA1TC48n.wav index 541ded9f6d..923742bfaa 100644 --- a/scripts/testv/stv1MASA1TC48n.wav +++ b/scripts/testv/stv1MASA1TC48n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c0a85059ba982f249e77391188a0d030acf6853fe326ab5ade480239ce80f07f +oid sha256:84638d44e5305c8bd8457fc2aa90523c42fc7647a09524e34445d5f6c5c481be size 1927786 diff --git a/scripts/testv/stv1MASA2TC48c.wav b/scripts/testv/stv1MASA2TC48c.wav index aefec77efe..e78eaaf8cd 100644 --- a/scripts/testv/stv1MASA2TC48c.wav +++ b/scripts/testv/stv1MASA2TC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ab7437cdf41e56338c93f5e593118a112a48bae5138be2cdd301eff5da59bb06 +oid sha256:d79ff440508f837ef35a3a36c9e2404cec04611640f0d69e84f4b35143c3017d size 1152106 diff --git a/scripts/testv/stv1MASA2TC48n.wav b/scripts/testv/stv1MASA2TC48n.wav index d5e9d955b2..23963a15eb 100644 --- a/scripts/testv/stv1MASA2TC48n.wav +++ b/scripts/testv/stv1MASA2TC48n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8f745778ed4fa70a704f530049022827696fc4e0dd3389a4076a8658ed514926 -size 3855404 +oid sha256:814ad588d549ece43026533fdb2192256278917066d6270769703f5c36a7fade +size 3855466 diff --git a/scripts/testv/stv2ISM48s.wav b/scripts/testv/stv2ISM48s.wav index a945db6b00..db51f5720d 100644 --- a/scripts/testv/stv2ISM48s.wav +++ b/scripts/testv/stv2ISM48s.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:777052eddbd7cb2ddcf4539a064368efcb6c5155e08ce42fa7a508d98dd5f8c5 +oid sha256:5a16c6148966f722325c4fbc20777ad7c94bf849d298d7ed25ad7bc8499954e9 size 5760106 diff --git a/scripts/testv/stv2MASA1TC48c.wav b/scripts/testv/stv2MASA1TC48c.wav index 43096765fd..bb8d2d428a 100644 --- a/scripts/testv/stv2MASA1TC48c.wav +++ b/scripts/testv/stv2MASA1TC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ccf03f372e4836c9d5ef71d75cf92a00642a13f77464e7c0fcf5f46c961a7f8d +oid sha256:94d8db1ba2638f0e2e48f0603dccb90106d8928b2c50ce6158e1497aa1ba104a size 576106 diff --git a/scripts/testv/stv2MASA2TC48c.wav b/scripts/testv/stv2MASA2TC48c.wav index 0f72267ea0..1bde39ce1b 100644 --- a/scripts/testv/stv2MASA2TC48c.wav +++ b/scripts/testv/stv2MASA2TC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a5a0379965053087ef1ce4775c85384e8c06aaa8161f12888f5e5c06d8612c1f +oid sha256:69df548c36d384f9deef8435f0ed74ab80fe1b83f120c6d80a980e368aea52ea size 576106 diff --git a/scripts/testv/stv2OA32c.wav b/scripts/testv/stv2OA32c.wav index 071c4866e0..8bc06922a1 100644 --- a/scripts/testv/stv2OA32c.wav +++ b/scripts/testv/stv2OA32c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d608b108d8e38750d78f1691ed92cac2e92f48a86a4488a3dab9a893cfa6ecf2 -size 11520436 +oid sha256:9b4630a1d1b2eef4ecdccfe5dfc43ec887a4336befcc2bd4fc9d404b0a684d26 +size 11520412 diff --git a/scripts/testv/stv2OA48c.wav b/scripts/testv/stv2OA48c.wav index 6ba780a84a..56dfc9299a 100644 --- a/scripts/testv/stv2OA48c.wav +++ b/scripts/testv/stv2OA48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ef0935e08a571a9e88f2257e64c45394633252766a0fb91da582eabf5537a49e -size 17280580 +oid sha256:91dfa70f7631edf213272cc9018efee2cc3ece30eae9257c5e988f484c44b352 +size 17280556 diff --git a/scripts/testv/stv32c.wav b/scripts/testv/stv32c.wav index 1267f189de..66794c23ad 100644 --- a/scripts/testv/stv32c.wav +++ b/scripts/testv/stv32c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9babeb07a95e9e23068a9c15eea1996a7c366e6000cf8347ce70661631e04ec4 -size 1389700 +oid sha256:1e7ef9d294c85c14f248c2a523a50120d35c0e177fa1306ade3749dcf6cd7e31 +size 1389604 diff --git a/scripts/testv/stv32n.wav b/scripts/testv/stv32n.wav index 888bbe819c..044dd1323c 100644 --- a/scripts/testv/stv32n.wav +++ b/scripts/testv/stv32n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:acbf022e8fbaafb811c14f75f78ec503ef8a1529ce4b04eabbb00c5066635592 +oid sha256:652407ff19fff28722585f407e75ae9167cbcb5395aa78b6312c3a73ab503562 size 1241706 diff --git a/scripts/testv/stv3ISM48s.wav b/scripts/testv/stv3ISM48s.wav index 12f31ee40a..a046111b61 100644 --- a/scripts/testv/stv3ISM48s.wav +++ b/scripts/testv/stv3ISM48s.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ac91a0d2d1584c52799d7fb52eaa2741df9c6927f94f9d5293dd214938f18a50 -size 8640130 +oid sha256:1babc1ea08f62a24e69056a115add114abac4282dbec561d024d01e49eea94a0 +size 8640106 diff --git a/scripts/testv/stv3OA32c.wav b/scripts/testv/stv3OA32c.wav index 88c473707d..64269b4e28 100644 --- a/scripts/testv/stv3OA32c.wav +++ b/scripts/testv/stv3OA32c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7376200d96aafc156cd4f9907e0b727e1e04921bfcbdb580ac8ff58fea4a60d6 -size 20480674 +oid sha256:7ee2b33382da36318b00636a66937e8bc14d7e53b899108d181a9986a43fabd3 +size 20480650 diff --git a/scripts/testv/stv3OA48c.wav b/scripts/testv/stv3OA48c.wav index 39a208555f..691ff55766 100644 --- a/scripts/testv/stv3OA48c.wav +++ b/scripts/testv/stv3OA48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3d1bf1ccd3a2d59b8fd768df58c49f9abd2b090664745256eec7d23aa0ea8c70 -size 30720930 +oid sha256:e18ea0e4976e72f7dce34fb73282cad7a9a9cb4a1ae51669c3f801a05829bcc3 +size 30720906 diff --git a/scripts/testv/stv48c.wav b/scripts/testv/stv48c.wav index d6df0e8fe2..c139c6f603 100644 --- a/scripts/testv/stv48c.wav +++ b/scripts/testv/stv48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2a2553784fc796c20b2f7d12e159661e9a480438b0ca71bfaf613757c841a1bb +oid sha256:13f1bc32c60290409cff1c43e59f7a67eb237f6d091056d12c1aaa8df35e5369 size 1920106 diff --git a/scripts/testv/stv48n.wav b/scripts/testv/stv48n.wav index 040040fadc..f3db208973 100644 --- a/scripts/testv/stv48n.wav +++ b/scripts/testv/stv48n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:621ec6a05e4e5064bd2f5699129e81335ac64f257e3dee293b0245ac1adcdb6b +oid sha256:9d7faeeb23a6d7b25428d209045c654734b177ca7ee53a47b4451fd8209c4821 size 1862506 diff --git a/scripts/testv/stv4ISM48n.wav b/scripts/testv/stv4ISM48n.wav index 5294260a0f..f1b2e468a9 100644 --- a/scripts/testv/stv4ISM48n.wav +++ b/scripts/testv/stv4ISM48n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b48c4030982641afcaa0c61182f35d6648e2bea4a952d9430f710989e4e4646c -size 7680044 +oid sha256:55b28ce1a9e0a11467f4e8f65617c8a91b4d5c95787fae55acb05e7a04c0fa06 +size 7680106 diff --git a/scripts/testv/stv4ISM48s.wav b/scripts/testv/stv4ISM48s.wav index faffedc961..dd5a103631 100644 --- a/scripts/testv/stv4ISM48s.wav +++ b/scripts/testv/stv4ISM48s.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:361001b64a7ff11a22267df08ccd261728b9a455c2c4860f84f99ce2dc6dd485 -size 11520130 +oid sha256:87290924284f0456d47b8f54b06eee09924065f64ce0b1dc69f4f08cd961778a +size 11520106 diff --git a/scripts/testv/stv512MC48c.wav b/scripts/testv/stv512MC48c.wav index a0c66dc86c..4d0707ab3c 100644 --- a/scripts/testv/stv512MC48c.wav +++ b/scripts/testv/stv512MC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0f2bcf911eda4dc1069e113d82f2e72b0849db5fb28ebdd619a59971f16fc909 -size 2304130 +oid sha256:e22928134c5a58f5d1c10661210c0ea5563f48e17707188e54e8037057ce4847 +size 2304106 diff --git a/scripts/testv/stv514MC48c.wav b/scripts/testv/stv514MC48c.wav index 22d0c6e0ab..8297f462b9 100644 --- a/scripts/testv/stv514MC48c.wav +++ b/scripts/testv/stv514MC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6ca93376cae09017177a1a49e2d7d006f5bf61c4c94b9e466dedee6e03a45efb -size 2880130 +oid sha256:2c5ae3276862a1baf2b458a60914a34b2b46ea7d61d1dc39a29f6c03191e50da +size 2880106 diff --git a/scripts/testv/stv51MC48c.wav b/scripts/testv/stv51MC48c.wav index 7c98cc83d3..4264079a4e 100644 --- a/scripts/testv/stv51MC48c.wav +++ b/scripts/testv/stv51MC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:377961aefebcea8dd87e5a63af8c17f6b0db588f328cee9ae6db5be95e23cd05 -size 11520130 +oid sha256:e5e4c1925a8f61001f2be17a342de00b1a99736da268af00074729cd51e03fc6 +size 11520106 diff --git a/scripts/testv/stv714MC48c.wav b/scripts/testv/stv714MC48c.wav index 53c36268d0..2bfc196ed4 100644 --- a/scripts/testv/stv714MC48c.wav +++ b/scripts/testv/stv714MC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6fa104a2015be912ea80d015ddb0a42774edea137bc9427954767efcae5e0b1c -size 3456130 +oid sha256:6c7f1ce805925b870173d4386c69bc06c952a087066fa2e4558c35ef7e8cb368 +size 3456106 diff --git a/scripts/testv/stv71MC48c.wav b/scripts/testv/stv71MC48c.wav index 2a0b012ab0..6f3a0fcdcd 100644 --- a/scripts/testv/stv71MC48c.wav +++ b/scripts/testv/stv71MC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d0ac38ddb16b2ce9cbca27965c5aedaf1af857a6fdce340bc01322794311e92d -size 2304130 +oid sha256:063ba273747d89a8a53ebf398022ccb6748eaed2bda270fb6db8d355ab97b06a +size 2304106 diff --git a/scripts/testv/stv8c.wav b/scripts/testv/stv8c.wav index 0ee4ea2b7a..d02c6b0c06 100644 --- a/scripts/testv/stv8c.wav +++ b/scripts/testv/stv8c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8659d17c088387b59f3a02e698c5dd32746f541493d68be1883a217f4d1b08cf +oid sha256:52fcd799f6d904644ca56a3d263d087c2f10f8d88685259123cc5610447b7152 size 320108 diff --git a/scripts/testv/stv8n.wav b/scripts/testv/stv8n.wav index 66e042366e..2505d88cc4 100644 --- a/scripts/testv/stv8n.wav +++ b/scripts/testv/stv8n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d872103d81dcdf846105cdacdb33fc02cbae02104e2c77ff5ff6d985f409b81f +oid sha256:d0a99305a411b6600581b5ab0503adc2cc2f55f3ddecc049ed4ae9ee29255dcd size 310508 diff --git a/scripts/testv/stvFOA16c.wav b/scripts/testv/stvFOA16c.wav index 996ada1bcd..27766f5e36 100644 --- a/scripts/testv/stvFOA16c.wav +++ b/scripts/testv/stvFOA16c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:30a766e574f03b20403b873443b837497a685c0c5ac28c5ac51c95ef226385fa -size 2560202 +oid sha256:2cfc44c7bf4a91e9d40fddb88079404635f8944dca8a0163b96367a9d74d3a51 +size 2560178 diff --git a/scripts/testv/stvFOA32c.wav b/scripts/testv/stvFOA32c.wav index 3a681bfa80..ae8d4a707b 100644 --- a/scripts/testv/stvFOA32c.wav +++ b/scripts/testv/stvFOA32c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:47176066fc373347564bc28ff56d8d9d52745ab7dd631ce4e051f81dff6908e5 -size 5120266 +oid sha256:e3c6f35a4a03e571f13ee676af9dde729bd8e726a9fb9aad4b75aca4eb83a0a9 +size 5120242 diff --git a/scripts/testv/stvFOA48c.wav b/scripts/testv/stvFOA48c.wav index ade8e3343d..79fd9645dc 100644 --- a/scripts/testv/stvFOA48c.wav +++ b/scripts/testv/stvFOA48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9c5da22f3ab1bd9681fff74a77f8ff543f1565f93a5c573125db8820c267376f -size 7680330 +oid sha256:6e784c1569b26708dbe128df4aac9b7e4e10bebb13306137f7c15bf330117353 +size 7680306 diff --git a/scripts/testv/stvST16c.wav b/scripts/testv/stvST16c.wav index e46f2e6f5d..2470b15e68 100644 --- a/scripts/testv/stvST16c.wav +++ b/scripts/testv/stvST16c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:350c8b0d4c11d2e994158be287c07fda1eef6fd6f92aaf769a7f8529c88f16d0 +oid sha256:229707f998f454b1c0a689dad939b44f4fc5104d84b0ea031f4d39f2c0f19be4 size 1280110 diff --git a/scripts/testv/stvST16n.wav b/scripts/testv/stvST16n.wav index 63afe4f14b..845192ba02 100644 --- a/scripts/testv/stvST16n.wav +++ b/scripts/testv/stvST16n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:40d28848ee6fc8442738662e5cda78473fb099314aab49440afcfd68286d280d +oid sha256:a47ebd30497532f19eea0c5729ece4960d744d1a0888ac3f896a045f96bf001c size 1241710 diff --git a/scripts/testv/stvST32c.wav b/scripts/testv/stvST32c.wav index 876c0e558b..0dc61163d5 100644 --- a/scripts/testv/stvST32c.wav +++ b/scripts/testv/stvST32c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:12737393e0bbcdb7b6d9d6dbef79984feac3ff5313daa97a6a8793d3e26099ba +oid sha256:8762888049ed00319d4a1168d4b6a3d539009676a70555f5352968511c8c052c size 2560106 diff --git a/scripts/testv/stvST32n.wav b/scripts/testv/stvST32n.wav index 6d77c6892d..34e9a90bbe 100644 --- a/scripts/testv/stvST32n.wav +++ b/scripts/testv/stvST32n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3642b2bce81ea794457655886f56bca58fb0b1431ed7ac52f1a27f8388c75eb4 +oid sha256:e7e0128d55b459e66b8d0623f396c1b564a512c04477cf050f6d944983a4da38 size 2483306 diff --git a/scripts/testv/stvST48c.wav b/scripts/testv/stvST48c.wav index 250770d61f..e379b8cc2e 100644 --- a/scripts/testv/stvST48c.wav +++ b/scripts/testv/stvST48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cc028e71c94b43068dcc2c7557277ad1989ee20e7a6d8dd6fd30d70d384d56b3 +oid sha256:3c5d4729b3e427009012673e814db2c30618a69aa94e9b7d7e3b3d6b06fa269d size 3840106 diff --git a/scripts/testv/stvST48n.wav b/scripts/testv/stvST48n.wav index 8dd24e4ca0..e63ecb6742 100644 --- a/scripts/testv/stvST48n.wav +++ b/scripts/testv/stvST48n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ac4262d08b5e45e8ce8da4456740d1e7224aa25b0e3e3088381cb91436cec31f +oid sha256:4c24334e1b020ede64b871ab39c23760db8427d3a9f751739979006d7565d588 size 3724906 -- GitLab From 8e8efd9533084cb222a1ed3c79ec77d0113936bb Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Wed, 15 Mar 2023 16:29:18 +0100 Subject: [PATCH 221/375] Further reduce wav header by using -I --- scripts/testv/stv16c.wav | 4 ++-- scripts/testv/stv16n.wav | 4 ++-- scripts/testv/stv1ISM48s.wav | 4 ++-- scripts/testv/stv1MASA1TC48c.wav | 4 ++-- scripts/testv/stv1MASA1TC48n.wav | 4 ++-- scripts/testv/stv1MASA2TC48c.wav | 4 ++-- scripts/testv/stv1MASA2TC48n.wav | 4 ++-- scripts/testv/stv2ISM48s.wav | 4 ++-- scripts/testv/stv2MASA1TC48c.wav | 4 ++-- scripts/testv/stv2MASA2TC48c.wav | 4 ++-- scripts/testv/stv2OA32c.wav | 4 ++-- scripts/testv/stv2OA48c.wav | 4 ++-- scripts/testv/stv32c.wav | 4 ++-- scripts/testv/stv32n.wav | 4 ++-- scripts/testv/stv3ISM48s.wav | 4 ++-- scripts/testv/stv3OA32c.wav | 4 ++-- scripts/testv/stv3OA48c.wav | 4 ++-- scripts/testv/stv48c.wav | 4 ++-- scripts/testv/stv48n.wav | 4 ++-- scripts/testv/stv4ISM48n.wav | 4 ++-- scripts/testv/stv4ISM48s.wav | 4 ++-- scripts/testv/stv512MC48c.wav | 4 ++-- scripts/testv/stv514MC48c.wav | 4 ++-- scripts/testv/stv51MC48c.wav | 4 ++-- scripts/testv/stv714MC48c.wav | 4 ++-- scripts/testv/stv71MC48c.wav | 4 ++-- scripts/testv/stv8c.wav | 4 ++-- scripts/testv/stv8n.wav | 4 ++-- scripts/testv/stvFOA16c.wav | 4 ++-- scripts/testv/stvFOA32c.wav | 4 ++-- scripts/testv/stvFOA48c.wav | 4 ++-- scripts/testv/stvST16c.wav | 4 ++-- scripts/testv/stvST16n.wav | 4 ++-- scripts/testv/stvST32c.wav | 4 ++-- scripts/testv/stvST32n.wav | 4 ++-- scripts/testv/stvST48c.wav | 4 ++-- scripts/testv/stvST48n.wav | 4 ++-- 37 files changed, 74 insertions(+), 74 deletions(-) diff --git a/scripts/testv/stv16c.wav b/scripts/testv/stv16c.wav index ad1748040b..d107fe711d 100644 --- a/scripts/testv/stv16c.wav +++ b/scripts/testv/stv16c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a00096069190d206e293ad526bcd3422ec2b4b192a8b32d083d42051b5a5de47 -size 640108 +oid sha256:61f9eca5dafeb46a6aa29c82a8252ebb4ffd4e7a7255f5a4653d8335e685872e +size 640046 diff --git a/scripts/testv/stv16n.wav b/scripts/testv/stv16n.wav index 837dccc273..9a9c8798e5 100644 --- a/scripts/testv/stv16n.wav +++ b/scripts/testv/stv16n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:afc5f4dcac8c8e0d32951bc9543fc2b2c8027b1bfbc7c685669582ccd9abf277 -size 620908 +oid sha256:7d0ac0846c3046d91843b390fbef3a0180dac92b7d53e4079b3541d43b8af188 +size 620846 diff --git a/scripts/testv/stv1ISM48s.wav b/scripts/testv/stv1ISM48s.wav index 077ccb2571..da05075565 100644 --- a/scripts/testv/stv1ISM48s.wav +++ b/scripts/testv/stv1ISM48s.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:49a9e2129463dbd158f2d6fa3abebca00d9edaea42820684233db191d5dad8b1 -size 2880106 +oid sha256:dfd1f55af3964c73b423efe64c7400c02ea3c5f289bf347b019350fe3165bcf3 +size 2880044 diff --git a/scripts/testv/stv1MASA1TC48c.wav b/scripts/testv/stv1MASA1TC48c.wav index 949e2669be..263f109000 100644 --- a/scripts/testv/stv1MASA1TC48c.wav +++ b/scripts/testv/stv1MASA1TC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c7eb4652468f8d6f07ab7d8b9c068fc13494b8ed2fa4d860dade52aa7cecec5a -size 288106 +oid sha256:2409df48bf501463db0e468aeeee11e5aa866f0adf91ef714a7c6fc506235aa1 +size 288044 diff --git a/scripts/testv/stv1MASA1TC48n.wav b/scripts/testv/stv1MASA1TC48n.wav index 923742bfaa..1b0012d886 100644 --- a/scripts/testv/stv1MASA1TC48n.wav +++ b/scripts/testv/stv1MASA1TC48n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:84638d44e5305c8bd8457fc2aa90523c42fc7647a09524e34445d5f6c5c481be -size 1927786 +oid sha256:81065ed959b13b8c2a4bb1a05ef14095f523912bc3007fdd172cce87a8398046 +size 1927724 diff --git a/scripts/testv/stv1MASA2TC48c.wav b/scripts/testv/stv1MASA2TC48c.wav index e78eaaf8cd..982e69fb20 100644 --- a/scripts/testv/stv1MASA2TC48c.wav +++ b/scripts/testv/stv1MASA2TC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d79ff440508f837ef35a3a36c9e2404cec04611640f0d69e84f4b35143c3017d -size 1152106 +oid sha256:1bd8440cbf857f9376d053f780572213964c32a267f325948f3a3a02805dc998 +size 1152044 diff --git a/scripts/testv/stv1MASA2TC48n.wav b/scripts/testv/stv1MASA2TC48n.wav index 23963a15eb..f25eb24353 100644 --- a/scripts/testv/stv1MASA2TC48n.wav +++ b/scripts/testv/stv1MASA2TC48n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:814ad588d549ece43026533fdb2192256278917066d6270769703f5c36a7fade -size 3855466 +oid sha256:97f1a7a43012ce166b929df59bd756f5d96433ea00ce0a1005380368c01619a0 +size 3855404 diff --git a/scripts/testv/stv2ISM48s.wav b/scripts/testv/stv2ISM48s.wav index db51f5720d..02de53114d 100644 --- a/scripts/testv/stv2ISM48s.wav +++ b/scripts/testv/stv2ISM48s.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5a16c6148966f722325c4fbc20777ad7c94bf849d298d7ed25ad7bc8499954e9 -size 5760106 +oid sha256:e042a1a219fcd4f8a82d1d200071139b76c749d97a7b627774431ba961486b2c +size 5760044 diff --git a/scripts/testv/stv2MASA1TC48c.wav b/scripts/testv/stv2MASA1TC48c.wav index bb8d2d428a..afe705b0b1 100644 --- a/scripts/testv/stv2MASA1TC48c.wav +++ b/scripts/testv/stv2MASA1TC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:94d8db1ba2638f0e2e48f0603dccb90106d8928b2c50ce6158e1497aa1ba104a -size 576106 +oid sha256:0d500a55bcc63dda1fd93329bcef272a21eb49731ceb0a60e546ef02e07cdd9b +size 576044 diff --git a/scripts/testv/stv2MASA2TC48c.wav b/scripts/testv/stv2MASA2TC48c.wav index 1bde39ce1b..e159c4f9ae 100644 --- a/scripts/testv/stv2MASA2TC48c.wav +++ b/scripts/testv/stv2MASA2TC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:69df548c36d384f9deef8435f0ed74ab80fe1b83f120c6d80a980e368aea52ea -size 576106 +oid sha256:60a713ed1b97cf94b16849806951ef83d8f41c8ee455b267ec0a292c695cbbc1 +size 576044 diff --git a/scripts/testv/stv2OA32c.wav b/scripts/testv/stv2OA32c.wav index 8bc06922a1..86d288de72 100644 --- a/scripts/testv/stv2OA32c.wav +++ b/scripts/testv/stv2OA32c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b4630a1d1b2eef4ecdccfe5dfc43ec887a4336befcc2bd4fc9d404b0a684d26 -size 11520412 +oid sha256:1824c3afe43861b2ed1e4ff94591932f34bb1885d96796e282d3839906e50aed +size 11520350 diff --git a/scripts/testv/stv2OA48c.wav b/scripts/testv/stv2OA48c.wav index 56dfc9299a..24bb1f0872 100644 --- a/scripts/testv/stv2OA48c.wav +++ b/scripts/testv/stv2OA48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:91dfa70f7631edf213272cc9018efee2cc3ece30eae9257c5e988f484c44b352 -size 17280556 +oid sha256:f573744bd97ad3dcb8e86c39d1770725a34f3c43c37c62c26d670a7f722a880e +size 17280494 diff --git a/scripts/testv/stv32c.wav b/scripts/testv/stv32c.wav index 66794c23ad..640532cc12 100644 --- a/scripts/testv/stv32c.wav +++ b/scripts/testv/stv32c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e7ef9d294c85c14f248c2a523a50120d35c0e177fa1306ade3749dcf6cd7e31 -size 1389604 +oid sha256:00089d67aa513a9f6b2f73526e94d5c32437c6944ec6467072dc27ccaa1f5080 +size 1389542 diff --git a/scripts/testv/stv32n.wav b/scripts/testv/stv32n.wav index 044dd1323c..6a23d99d6e 100644 --- a/scripts/testv/stv32n.wav +++ b/scripts/testv/stv32n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:652407ff19fff28722585f407e75ae9167cbcb5395aa78b6312c3a73ab503562 -size 1241706 +oid sha256:1a92be333a359a77ec70324815d71282398dede88e59ac19a31f8d18913c0505 +size 1241644 diff --git a/scripts/testv/stv3ISM48s.wav b/scripts/testv/stv3ISM48s.wav index a046111b61..c52500f610 100644 --- a/scripts/testv/stv3ISM48s.wav +++ b/scripts/testv/stv3ISM48s.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1babc1ea08f62a24e69056a115add114abac4282dbec561d024d01e49eea94a0 -size 8640106 +oid sha256:2a29dfd720edab2367f86c394d4abc9f641596d50697539be70cdfe178d2a28d +size 8640044 diff --git a/scripts/testv/stv3OA32c.wav b/scripts/testv/stv3OA32c.wav index 64269b4e28..07cda52674 100644 --- a/scripts/testv/stv3OA32c.wav +++ b/scripts/testv/stv3OA32c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7ee2b33382da36318b00636a66937e8bc14d7e53b899108d181a9986a43fabd3 -size 20480650 +oid sha256:bdd1fd31b318bef4439a35baf2252c8edabb826198c75d705095b68dfa288fb0 +size 20480588 diff --git a/scripts/testv/stv3OA48c.wav b/scripts/testv/stv3OA48c.wav index 691ff55766..960d9e2019 100644 --- a/scripts/testv/stv3OA48c.wav +++ b/scripts/testv/stv3OA48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e18ea0e4976e72f7dce34fb73282cad7a9a9cb4a1ae51669c3f801a05829bcc3 -size 30720906 +oid sha256:7ce54b1708a76f34eeedc40b01e806cb92d32b0813e8ac23bfceaaa8d25262e6 +size 30720844 diff --git a/scripts/testv/stv48c.wav b/scripts/testv/stv48c.wav index c139c6f603..1be5a1dc3c 100644 --- a/scripts/testv/stv48c.wav +++ b/scripts/testv/stv48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:13f1bc32c60290409cff1c43e59f7a67eb237f6d091056d12c1aaa8df35e5369 -size 1920106 +oid sha256:59f39e02d601b453170cde1e49d50e58b58ff5154ba54c75fc5d79f4964d1e48 +size 1920044 diff --git a/scripts/testv/stv48n.wav b/scripts/testv/stv48n.wav index f3db208973..2d79cee520 100644 --- a/scripts/testv/stv48n.wav +++ b/scripts/testv/stv48n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9d7faeeb23a6d7b25428d209045c654734b177ca7ee53a47b4451fd8209c4821 -size 1862506 +oid sha256:3c774e6fe4e22274ef72552901c4b4870d56d825fa67e8e3e59a30cc0a44dbfa +size 1862444 diff --git a/scripts/testv/stv4ISM48n.wav b/scripts/testv/stv4ISM48n.wav index f1b2e468a9..0ca6e5f3f5 100644 --- a/scripts/testv/stv4ISM48n.wav +++ b/scripts/testv/stv4ISM48n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:55b28ce1a9e0a11467f4e8f65617c8a91b4d5c95787fae55acb05e7a04c0fa06 -size 7680106 +oid sha256:74697fcb6241db1bed87121244c09a3499ea4024cdf15d279feafbedbca6123a +size 7680044 diff --git a/scripts/testv/stv4ISM48s.wav b/scripts/testv/stv4ISM48s.wav index dd5a103631..de034819ea 100644 --- a/scripts/testv/stv4ISM48s.wav +++ b/scripts/testv/stv4ISM48s.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:87290924284f0456d47b8f54b06eee09924065f64ce0b1dc69f4f08cd961778a -size 11520106 +oid sha256:70433aebd892f38df31f12f10e71caaa1e794c64abb7d3e75fe895676e63609e +size 11520044 diff --git a/scripts/testv/stv512MC48c.wav b/scripts/testv/stv512MC48c.wav index 4d0707ab3c..e21644a5d9 100644 --- a/scripts/testv/stv512MC48c.wav +++ b/scripts/testv/stv512MC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e22928134c5a58f5d1c10661210c0ea5563f48e17707188e54e8037057ce4847 -size 2304106 +oid sha256:3be0c6dccbf26f8755200683bba42553eb36feed297110e289afcec32e0c8459 +size 2304044 diff --git a/scripts/testv/stv514MC48c.wav b/scripts/testv/stv514MC48c.wav index 8297f462b9..113cd6219a 100644 --- a/scripts/testv/stv514MC48c.wav +++ b/scripts/testv/stv514MC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2c5ae3276862a1baf2b458a60914a34b2b46ea7d61d1dc39a29f6c03191e50da -size 2880106 +oid sha256:d2097dd80fa69f239689b06a62a44eb592bf2fe699e549347ae4567c1b690170 +size 2880044 diff --git a/scripts/testv/stv51MC48c.wav b/scripts/testv/stv51MC48c.wav index 4264079a4e..e5f4bae7d4 100644 --- a/scripts/testv/stv51MC48c.wav +++ b/scripts/testv/stv51MC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e5e4c1925a8f61001f2be17a342de00b1a99736da268af00074729cd51e03fc6 -size 11520106 +oid sha256:daccececb4336a7f2492185767d108dbc5594a7d6e2841d861f43ef44437a377 +size 11520044 diff --git a/scripts/testv/stv714MC48c.wav b/scripts/testv/stv714MC48c.wav index 2bfc196ed4..cabcb790b0 100644 --- a/scripts/testv/stv714MC48c.wav +++ b/scripts/testv/stv714MC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6c7f1ce805925b870173d4386c69bc06c952a087066fa2e4558c35ef7e8cb368 -size 3456106 +oid sha256:da62e19b166089efae2f22e68d76b82d3295d15785a4967465a04bc1c75b0462 +size 3456044 diff --git a/scripts/testv/stv71MC48c.wav b/scripts/testv/stv71MC48c.wav index 6f3a0fcdcd..72b3337e59 100644 --- a/scripts/testv/stv71MC48c.wav +++ b/scripts/testv/stv71MC48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:063ba273747d89a8a53ebf398022ccb6748eaed2bda270fb6db8d355ab97b06a -size 2304106 +oid sha256:3fb15d0c109c41d5e629b2e15a47be72ca8d209919ac39f79a7947e9cd2e5e02 +size 2304044 diff --git a/scripts/testv/stv8c.wav b/scripts/testv/stv8c.wav index d02c6b0c06..5f3b0ed4d9 100644 --- a/scripts/testv/stv8c.wav +++ b/scripts/testv/stv8c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:52fcd799f6d904644ca56a3d263d087c2f10f8d88685259123cc5610447b7152 -size 320108 +oid sha256:722081dcfaaee1c04254b0bde8436c73748a44f6760067907194a1ba24b199d7 +size 320046 diff --git a/scripts/testv/stv8n.wav b/scripts/testv/stv8n.wav index 2505d88cc4..2b35ec4dba 100644 --- a/scripts/testv/stv8n.wav +++ b/scripts/testv/stv8n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d0a99305a411b6600581b5ab0503adc2cc2f55f3ddecc049ed4ae9ee29255dcd -size 310508 +oid sha256:223e9f5353c49163803abedf97d557436d025f445fe9de4508c9559ca15b330b +size 310446 diff --git a/scripts/testv/stvFOA16c.wav b/scripts/testv/stvFOA16c.wav index 27766f5e36..cb67e8b371 100644 --- a/scripts/testv/stvFOA16c.wav +++ b/scripts/testv/stvFOA16c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2cfc44c7bf4a91e9d40fddb88079404635f8944dca8a0163b96367a9d74d3a51 -size 2560178 +oid sha256:6725a5d2647516071033f83f385dc7dfe4ff6719d493b1b682ec0274c1347e93 +size 2560116 diff --git a/scripts/testv/stvFOA32c.wav b/scripts/testv/stvFOA32c.wav index ae8d4a707b..661a97a3dc 100644 --- a/scripts/testv/stvFOA32c.wav +++ b/scripts/testv/stvFOA32c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e3c6f35a4a03e571f13ee676af9dde729bd8e726a9fb9aad4b75aca4eb83a0a9 -size 5120242 +oid sha256:273308e57de4c5f3ef2eeed164b0a9f34ba86ab05ca533ee5ee8a76528c01abe +size 5120180 diff --git a/scripts/testv/stvFOA48c.wav b/scripts/testv/stvFOA48c.wav index 79fd9645dc..7ece23b084 100644 --- a/scripts/testv/stvFOA48c.wav +++ b/scripts/testv/stvFOA48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6e784c1569b26708dbe128df4aac9b7e4e10bebb13306137f7c15bf330117353 -size 7680306 +oid sha256:45a1dd6c4fe6802e98821657337b453d5dab2fe32089c675637b9d23cfe74c8d +size 7680244 diff --git a/scripts/testv/stvST16c.wav b/scripts/testv/stvST16c.wav index 2470b15e68..3fb9ec0b3b 100644 --- a/scripts/testv/stvST16c.wav +++ b/scripts/testv/stvST16c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:229707f998f454b1c0a689dad939b44f4fc5104d84b0ea031f4d39f2c0f19be4 -size 1280110 +oid sha256:11a2f5887fe2407df03128634188d8aef6d3f76b52db14a1f834dbb98b7dd52e +size 1280048 diff --git a/scripts/testv/stvST16n.wav b/scripts/testv/stvST16n.wav index 845192ba02..74c80dca93 100644 --- a/scripts/testv/stvST16n.wav +++ b/scripts/testv/stvST16n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a47ebd30497532f19eea0c5729ece4960d744d1a0888ac3f896a045f96bf001c -size 1241710 +oid sha256:60a8cfa5abf4e052840fea0054fec5331465149747fd7bc7eadab18b62d864f1 +size 1241648 diff --git a/scripts/testv/stvST32c.wav b/scripts/testv/stvST32c.wav index 0dc61163d5..68a4a1fa33 100644 --- a/scripts/testv/stvST32c.wav +++ b/scripts/testv/stvST32c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8762888049ed00319d4a1168d4b6a3d539009676a70555f5352968511c8c052c -size 2560106 +oid sha256:1182294e7c3ba44e854219698e6a3c209e24345ab2e5e4296fce38029324f374 +size 2560044 diff --git a/scripts/testv/stvST32n.wav b/scripts/testv/stvST32n.wav index 34e9a90bbe..7da590907d 100644 --- a/scripts/testv/stvST32n.wav +++ b/scripts/testv/stvST32n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e7e0128d55b459e66b8d0623f396c1b564a512c04477cf050f6d944983a4da38 -size 2483306 +oid sha256:a6edbfd26681fa42f377891761ad79f97029a3380bc644e47bff1803c7904ff9 +size 2483244 diff --git a/scripts/testv/stvST48c.wav b/scripts/testv/stvST48c.wav index e379b8cc2e..df554e6521 100644 --- a/scripts/testv/stvST48c.wav +++ b/scripts/testv/stvST48c.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3c5d4729b3e427009012673e814db2c30618a69aa94e9b7d7e3b3d6b06fa269d -size 3840106 +oid sha256:40929eb3eb266ed78c16daa2a9c987745fe8e005a577f2dd81264ffda845c118 +size 3840044 diff --git a/scripts/testv/stvST48n.wav b/scripts/testv/stvST48n.wav index e63ecb6742..cb2d8c4fc3 100644 --- a/scripts/testv/stvST48n.wav +++ b/scripts/testv/stvST48n.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c24334e1b020ede64b871ab39c23760db8427d3a9f751739979006d7565d588 -size 3724906 +oid sha256:6074a3a3b88c7868f62c9bcf7df56e4a8fd25ffed059886846220efc4fbc0992 +size 3724844 -- GitLab From b991f4de2917a985b2427488859e0739d084e39d Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Wed, 15 Mar 2023 17:29:30 +0200 Subject: [PATCH 222/375] Computational optimization by reducing tf-resolution --- lib_com/options.h | 1 + lib_rend/ivas_dirac_dec_binaural_functions.c | 129 ++++++++++++++++++- lib_rend/ivas_stat_rend.h | 5 + 3 files changed, 133 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2b0f55cf35..254774af6e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,6 +159,7 @@ #endif #define NOKIA_ADAPTIVE_BINAURAL_PROTOS +#define NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT /* enable adaptive binaural prototype complexity optimizations */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index a0a0f75efb..073b56dedd 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -40,6 +40,8 @@ #include "ivas_cnst.h" #include "ivas_rom_binauralRenderer.h" #include "ivas_rom_rend.h" +#include "ivas_rom_com.h" + #ifdef DEBUGGING #include "debug.h" #endif @@ -55,11 +57,17 @@ #define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR ( 3.0f ) #ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS +#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT +/* powf(0.95f, 4.0f) for sub-frame smoothing instead of CLDFB slot */ +#define ADAPT_HTPROTO_IIR_FAC 0.81450625f +#else #define ADAPT_HTPROTO_IIR_FAC 0.95f +#endif + #define ADAPT_HTPROTO_ILD_LIM_DB0 1.0f #define ADAPT_HTPROTO_ILD_LIM_DB1 4.0f -#define ADAPT_HTPROTO_ROT_LIM_0 0.4f -#define ADAPT_HTPROTO_ROT_LIM_1 0.8f +#define ADAPT_HTPROTO_ROT_LIM_0 0.4f +#define ADAPT_HTPROTO_ROT_LIM_1 0.8f #endif /*------------------------------------------------------------------------- @@ -77,8 +85,12 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( Decoder_Struc static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float output_f[][L_FRAME48k], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const uint8_t numInputChannels, const uint8_t firstSlot, const uint8_t slotEnd ); #ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS +#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT +static void adaptTransportSignalsHeadtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, float Rmat[3][3] ); +#else static void adaptTransportSignalsHeadtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, const uint8_t nBins, float Rmat[3][3] ); #endif +#endif static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, const uint8_t nBins, float Rmat[3][3] ); @@ -575,7 +587,11 @@ static void ivas_dirac_dec_binaural_internal( if ( nchan_transport == 2 ) { #ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS +#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT + adaptTransportSignalsHeadtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, firstSlot, slotEnd, Rmat ); +#else adaptTransportSignalsHeadtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, firstSlot, slotEnd, nBins, Rmat ); +#endif #endif ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( st_ivas->hHeadTrackData, Cldfb_ImagBuffer_in, Cldfb_RealBuffer_in, firstSlot, slotEnd, nBins, Rmat ); @@ -1355,12 +1371,19 @@ static void adaptTransportSignalsHeadtracked( float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, +#ifndef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT const uint8_t nBins, +#endif float Rmat[3][3] ) { int16_t slot, ch, bin, louderCh; +#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT + float ILD, mono_factor_ILD, mono_factor_rotation, mono_factor, y_val, ene_proc, ene_target; + uint8_t n_slots_per_sf, sf_idx, n_sf; +#else float re[2], im[2], ILD, mono_factor_ILD, mono_factor_rotation, mono_factor, y_val; float proc_re[2], proc_im[2], sum_re, sum_im, ene_proc, ene_target, mf; +#endif /* Determine head-orientation-based mono factor. Rmat[1][1] entry informs how close the ears are aligned according to transport signals. */ @@ -1369,9 +1392,110 @@ static void adaptTransportSignalsHeadtracked( mono_factor_rotation = fmaxf( 0.0f, fminf( 1.0f, mono_factor_rotation ) ); /* Adapt transport signals in frequency bands */ +#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT + /* optimization grouping CLDFB bins into MASA bands (they are readily available in ROM and suitable for the task) AND group CLDFB slots into sub-frames */ + n_slots_per_sf = CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; + n_sf = ( slotEnd - firstSlot ) / n_slots_per_sf; + + for ( sf_idx = 0; sf_idx < n_sf; sf_idx++ ) + { + float eqVal; + uint8_t start_slot, stop_slot; + int16_t band_idx, bin_lo, bin_hi; + + start_slot = firstSlot + sf_idx * n_slots_per_sf; + stop_slot = start_slot + n_slots_per_sf; + + for ( band_idx = 0; band_idx < MASA_FREQUENCY_BANDS; band_idx++ ) + { + float ch_nrg[2]; /* storage for input signal channel energies */ + bin_lo = MASA_band_grouping_24[band_idx]; + bin_hi = MASA_band_grouping_24[band_idx + 1]; + + for ( ch = 0; ch < 2; ch++ ) + { + ch_nrg[ch] = 0.0f; + for ( slot = start_slot; slot < stop_slot; slot++ ) + { + for ( bin = bin_lo; bin < bin_hi; bin++ ) + { + ch_nrg[ch] += ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ) + ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + } + } + hHeadTrackData->chEneIIR[ch][band_idx] *= ADAPT_HTPROTO_IIR_FAC; + hHeadTrackData->chEneIIR[ch][band_idx] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * ch_nrg[ch]; + } + + /* Determine ILD */ + ILD = fabsf( 10.0f * log10f( fmaxf( 1e-12f, hHeadTrackData->chEneIIR[0][band_idx] ) / fmaxf( 1e-12f, hHeadTrackData->chEneIIR[1][band_idx] ) ) ); + if ( hHeadTrackData->chEneIIR[1][band_idx] > hHeadTrackData->chEneIIR[0][band_idx] ) + { + louderCh = 1; + } + else + { + louderCh = 0; + } + + /* Determine ILD-based mono factor */ + mono_factor_ILD = ( ILD - ADAPT_HTPROTO_ILD_LIM_DB0 ) / ( ADAPT_HTPROTO_ILD_LIM_DB1 - ADAPT_HTPROTO_ILD_LIM_DB0 ); + mono_factor_ILD = fmaxf( 0.0f, fminf( 1.0f, mono_factor_ILD ) ); + + /* Combine mono factors */ + mono_factor = mono_factor_ILD * mono_factor_rotation; + + /* Mix original audio and sum signal according to determined mono factor */ + for ( ch = 0; ch < 2; ch++ ) + { + if ( ch != louderCh ) + { + float band_nrg = 0.0f; + + for ( slot = start_slot; slot < stop_slot; slot++ ) + { + for ( bin = bin_lo; bin < bin_hi; bin++ ) + { + /* mono sum signal with the computed weight + rest from the original channel */ + inRe[ch][slot][bin] = mono_factor * ( inRe[0][slot][bin] + inRe[1][slot][bin] ) + ( 1.0f - mono_factor ) * inRe[ch][slot][bin]; + inIm[ch][slot][bin] = mono_factor * ( inIm[0][slot][bin] + inIm[1][slot][bin] ) + ( 1.0f - mono_factor ) * inIm[ch][slot][bin]; + band_nrg += ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ) + ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + } + } + hHeadTrackData->procChEneIIR[ch][band_idx] *= ADAPT_HTPROTO_IIR_FAC; + hHeadTrackData->procChEneIIR[ch][band_idx] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * band_nrg; + } + else + { + /* processed signal is input. use the original channel, so no need to compute new signals or signal energy */ + hHeadTrackData->procChEneIIR[ch][band_idx] *= ADAPT_HTPROTO_IIR_FAC; + hHeadTrackData->procChEneIIR[ch][band_idx] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * ch_nrg[ch]; + } + } + + /* Equalize */ + ene_target = hHeadTrackData->chEneIIR[0][band_idx] + hHeadTrackData->chEneIIR[1][band_idx]; + ene_proc = hHeadTrackData->procChEneIIR[0][band_idx] + hHeadTrackData->procChEneIIR[1][band_idx]; + eqVal = fminf( 4.0f, sqrtf( ene_target / fmaxf( 1e-12f, ene_proc ) ) ); + + for ( slot = start_slot; slot < stop_slot; slot++ ) + { + for ( ch = 0; ch < 2; ch++ ) + { + for ( bin = bin_lo; bin < bin_hi; bin++ ) + { + inRe[ch][slot][bin] *= eqVal; + inIm[ch][slot][bin] *= eqVal; + } + } + } + } + } +#else + /* original contribution */ for ( slot = firstSlot; slot < slotEnd; slot++ ) { float eqVal[60]; + for ( bin = 0; bin < nBins; bin++ ) { /* Determine channel energies */ @@ -1421,6 +1545,7 @@ static void adaptTransportSignalsHeadtracked( } } } +#endif return; } diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index a00b3db4f0..51d6ef37ef 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -246,8 +246,13 @@ typedef struct ivas_binaural_head_track_struct float lrSwitchInterpVal; #ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS +#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT + float chEneIIR[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ + float procChEneIIR[2][MASA_FREQUENCY_BANDS]; +#else float chEneIIR[2][CLDFB_NO_CHANNELS_MAX]; float procChEneIIR[2][CLDFB_NO_CHANNELS_MAX]; +#endif #endif int16_t shd_rot_max_order; -- GitLab From 84348e6b498619aa81079157fb07062f0faeb940 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Wed, 15 Mar 2023 18:05:42 +0100 Subject: [PATCH 223/375] Added support of extended metadata and headtracking in external renderer --- apps/decoder.c | 2 +- apps/renderer.c | 73 +++++++++++++++++++++++++++- lib_com/common_api_types.h | 5 ++ lib_dec/lib_dec.c | 8 +-- lib_dec/lib_dec.h | 2 +- lib_rend/ivas_objectRenderer.c | 5 ++ lib_rend/lib_rend.c | 13 ++++- lib_rend/lib_rend.h | 5 ++ lib_util/head_rotation_file_reader.c | 8 +-- lib_util/head_rotation_file_reader.h | 2 +- 10 files changed, 109 insertions(+), 14 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 4d2d659d4e..875e3304a1 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1384,7 +1384,7 @@ static ivas_error decodeG192( uint16_t numObj = 0; IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; #ifdef TD5 - float Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES][3] = { 0 }; /* Initialization needed for gcc */ + IVAS_POSITION Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; #endif IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; diff --git a/apps/renderer.c b/apps/renderer.c index 72696b556d..a90e47083f 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -517,6 +517,9 @@ int main( int32_t delayTimeScale = 0; int16_t i, numChannels; ivas_error error = IVAS_ERR_OK; +#ifdef TD5 + IVAS_POSITION Pos[RENDERER_HEAD_POSITIONS_PER_FRAME]; +#endif #ifdef WMOPS reset_wmops(); @@ -645,19 +648,31 @@ int main( } /* === Configure === */ +#ifdef TD5 + 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 ) +#else if ( ( error = IVAS_REND_InitConfig( hIvasRend, strlen( args.renderConfigFilePath ) != 0 ) ) != IVAS_ERR_OK ) { exit( -1 ); } +#endif if ( args.renderConfigFilePath[0] != '\0' ) { IVAS_RENDER_CONFIG_DATA renderConfig; /* sanity check */ +#ifdef TD5 + if ( ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) && ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL ) ) +#else if ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) +#endif { +#ifdef TD5 + fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL or BINAURAL_ROOM is used as output. Exiting. \n" ); +#else fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output. Exiting. \n" ); +#endif exit( -1 ); } @@ -889,16 +904,20 @@ int main( { IVAS_QUATERNION quatBuffer[RENDERER_HEAD_POSITIONS_PER_FRAME]; #ifdef TD5 - float Pos[RENDERER_HEAD_POSITIONS_PER_FRAME][3]; HeadRotationFileReading( headRotReader, quatBuffer, Pos ); + IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer, Pos ); #else HeadRotationFileReading( headRotReader, quatBuffer, frame ); -#endif IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer ); +#endif } else { +#ifdef TD5 + IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ); +#else IVAS_REND_SetHeadRotation( hIvasRend, NULL ); +#endif } for ( i = 0; i < args.inConfig.numMultiChannelBuses; ++i ) @@ -1720,6 +1739,11 @@ void getMetadataFromFileReader( objectMetadataBuffer->positions[objIdx].azimuth = ismMetadata.azimuth; objectMetadataBuffer->positions[objIdx].elevation = ismMetadata.elevation; +#ifdef TD5 + objectMetadataBuffer->positions[objIdx].radius = ismMetadata.radius; + objectMetadataBuffer->positions[objIdx].yaw = ismMetadata.yaw; + objectMetadataBuffer->positions[objIdx].pitch = ismMetadata.pitch; +#endif return; } @@ -1774,6 +1798,11 @@ static void IsmPositionProvider_getNextFrame( { objectMetadataBuffer->positions[objIdx].azimuth = 0.0f; objectMetadataBuffer->positions[objIdx].elevation = 0.0f; +#ifdef TD5 + objectMetadataBuffer->positions[objIdx].radius = 1.0f; + objectMetadataBuffer->positions[objIdx].yaw = 0.0f; + objectMetadataBuffer->positions[objIdx].pitch = 0.0f; +#endif } /* Wrap azimuth to lie within (-180, 180] range */ @@ -1788,6 +1817,20 @@ static void IsmPositionProvider_getNextFrame( /* Clamp elevation to lie within [-90, 90] range (can't be wrapped easily) */ objectMetadataBuffer->positions[objIdx].elevation = min( max( objectMetadataBuffer->positions[objIdx].elevation, -90 ), 90 ); +#ifdef TD5 + /* Wrap yaw to lie within (-180, 180] range */ + while ( objectMetadataBuffer->positions[objIdx].yaw < 0.0f ) + { + objectMetadataBuffer->positions[objIdx].yaw += 360.0f; + } + while ( objectMetadataBuffer->positions[objIdx].yaw >= 360.0f ) + { + objectMetadataBuffer->positions[objIdx].yaw -= 360.0f; + } + + /* Clamp pitch to lie within [-90, 90] range (can't be wrapped easily) */ + objectMetadataBuffer->positions[objIdx].pitch = min( max( objectMetadataBuffer->positions[objIdx].pitch, -90 ), 90 ); +#endif } ++positionProvider->frameCounter; @@ -2049,6 +2092,32 @@ static void parseObjectPosition( exit( -1 ); } +#ifdef TD5 + readNextMetadataChunk( line, "," ); + position->radius = strtof( line, &endptr ); + + if ( *endptr != '\0' ) + { + fprintf( stderr, "Error reading metadata\n" ); + exit( -1 ); + } + + readNextMetadataChunk( line, "\n" ); + position->yaw = strtof( line, &endptr ); + if ( *endptr != '\0' ) + { + fprintf( stderr, "Error reading metadata\n" ); + exit( -1 ); + } + + readNextMetadataChunk( line, "\n" ); + position->pitch = strtof( line, &endptr ); + if ( *endptr != '\0' ) + { + fprintf( stderr, "Error reading metadata\n" ); + exit( -1 ); + } +#endif return; } diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index b2820f792c..dc1df1b5f0 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -123,6 +123,11 @@ typedef struct { float azimuth; float elevation; +#ifdef TD5 + float radius; + float yaw; + float pitch; +#endif } IVAS_REND_AudioObjectPosition; typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index b4f03c8cc6..7dbcc7e5c6 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -915,7 +915,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ #ifdef TD5 IVAS_QUATERNION *orientation, /* i : head-tracking data, listener orientation */ - float Pos[4][3] /* i : listener position */ + IVAS_POSITION *Pos /* i : listener position */ #else IVAS_QUATERNION *orientation /* i : head-tracking data, listener orientation */ #endif @@ -944,9 +944,9 @@ ivas_error IVAS_DEC_FeedHeadTrackData( hHeadTrackData->Quaternions[i].y = orientation[i].y; hHeadTrackData->Quaternions[i].z = orientation[i].z; #ifdef TD5 - hHeadTrackData->Pos[i].x = Pos[i][0]; - hHeadTrackData->Pos[i].y = Pos[i][1]; - hHeadTrackData->Pos[i].z = Pos[i][2]; + hHeadTrackData->Pos[i].x = Pos[i].x; + hHeadTrackData->Pos[i].y = Pos[i].y; + hHeadTrackData->Pos[i].z = Pos[i].z; #endif } diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index c1cfad3580..570d3f1f09 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -187,7 +187,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ #ifdef TD5 IVAS_QUATERNION *orientation, /* i : head-tracking data */ - float Pos[4][3] /* i : listener position */ + IVAS_POSITION *Pos /* i : listener position */ #else IVAS_QUATERNION *orientation /* i : head-tracking data */ #endif diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 7666059421..099d9aae38 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -744,6 +744,11 @@ ivas_error ivas_td_binaural_renderer_ext( hIsmMetaData[0] = &hIsmMetaDataFrame; hIsmMetaData[0]->azimuth = currentPos->azimuth; hIsmMetaData[0]->elevation = currentPos->elevation; +#ifdef TD5 + hIsmMetaData[0]->yaw = currentPos->yaw; + hIsmMetaData[0]->pitch = currentPos->pitch; + hIsmMetaData[0]->radius = currentPos->radius; +#endif } #ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 1056f45e5a..21cab52a73 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3988,6 +3988,9 @@ int16_t IVAS_REND_FeedRenderConfig( } hRenderConfig = hIvasRend->hRendererConfig; +#ifdef TD5 + mvr2r(renderConfig.directivity, hRenderConfig->directivity, 3); +#endif #ifdef DEBUGGING hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) @@ -4020,8 +4023,13 @@ int16_t IVAS_REND_FeedRenderConfig( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_SetHeadRotation( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ +#ifdef TD5 + const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME], /* i : head orientations for next rendering call */ + const IVAS_POSITION Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ +#else const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : head positions for next rendering call */ +#endif ) { int16_t i; @@ -4051,6 +4059,9 @@ ivas_error IVAS_REND_SetHeadRotation( for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) { hIvasRend->headRotData.headPositions[i] = headRot[i]; +#ifdef TD5 + hIvasRend->headRotData.Pos[i] = Pos[i]; +#endif } } diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 6db5fd91dc..579dda711f 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -244,7 +244,12 @@ int16_t IVAS_REND_FeedRenderConfig( ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ +#ifdef TD5 + const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME], /* i : head orientations for next rendering call */ + const IVAS_POSITION Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ +#else const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : head positions for next rendering call */ +#endif ); ivas_error IVAS_REND_GetSamples( diff --git a/lib_util/head_rotation_file_reader.c b/lib_util/head_rotation_file_reader.c index 2ef75e3488..d3a1018644 100644 --- a/lib_util/head_rotation_file_reader.c +++ b/lib_util/head_rotation_file_reader.c @@ -95,7 +95,7 @@ ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ IVAS_QUATERNION *Quaternions, /* o : head-tracking data, listener orientation */ #ifdef TD5 - float Pos[4][3] /* o : listener position */ + IVAS_POSITION *Pos /* o : listener position */ #else const int32_t frame_dec /* i : decoded frame number */ #endif @@ -141,9 +141,9 @@ ivas_error HeadRotationFileReading( Quaternions[i].y = y; Quaternions[i].z = z; #ifdef TD5 - Pos[i][0] = posx; - Pos[i][1] = posy; - Pos[i][2] = posz; + Pos[i].x = posx; + Pos[i].y = posy; + Pos[i].z = posz; #endif } diff --git a/lib_util/head_rotation_file_reader.h b/lib_util/head_rotation_file_reader.h index 20e503f11d..6fa05caef1 100644 --- a/lib_util/head_rotation_file_reader.h +++ b/lib_util/head_rotation_file_reader.h @@ -61,7 +61,7 @@ ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ IVAS_QUATERNION *Quaternions, /* o : head-tracking data */ #ifdef TD5 - float Pos[4][3] /* o : listener position */ + IVAS_POSITION *Pos /* o : listener position */ #else const int32_t frame_dec /* i : decoded frame number */ #endif -- GitLab From d458cf3b6c6b688b662cab09369ede1b730fc20f Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Wed, 15 Mar 2023 19:14:35 +0100 Subject: [PATCH 224/375] Clang format --- apps/decoder.c | 2 +- apps/renderer.c | 48 +++++++++++++------------- lib_dec/ivas_objectRenderer_internal.c | 3 +- lib_enc/ivas_ism_metadata_enc.c | 8 ++--- lib_rend/ivas_objectRenderer.c | 6 ++-- lib_rend/lib_rend.c | 6 ++-- 6 files changed, 36 insertions(+), 37 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 875e3304a1..e808721f14 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1384,7 +1384,7 @@ static ivas_error decodeG192( uint16_t numObj = 0; IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; #ifdef TD5 - IVAS_POSITION Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; + IVAS_POSITION Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; #endif IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; diff --git a/apps/renderer.c b/apps/renderer.c index a90e47083f..00875cc4e3 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -657,43 +657,43 @@ int main( } #endif - if ( args.renderConfigFilePath[0] != '\0' ) - { - IVAS_RENDER_CONFIG_DATA renderConfig; + if ( args.renderConfigFilePath[0] != '\0' ) + { + IVAS_RENDER_CONFIG_DATA renderConfig; - /* sanity check */ + /* sanity check */ #ifdef TD5 - if ( ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) && ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL ) ) + if ( ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) && ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL ) ) #else if ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) #endif - { + { #ifdef TD5 - fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL or BINAURAL_ROOM is used as output. Exiting. \n" ); + fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL or BINAURAL_ROOM is used as output. Exiting. \n" ); #else fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output. Exiting. \n" ); #endif - exit( -1 ); - } + exit( -1 ); + } - if ( ( error = IVAS_REND_GetRenderConfig( hIvasRend, &renderConfig ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_GetRenderConfig failed\n" ); - exit( -1 ); - } + if ( ( error = IVAS_REND_GetRenderConfig( hIvasRend, &renderConfig ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_GetRenderConfig failed\n" ); + exit( -1 ); + } - if ( RenderConfigReader_read( renderConfigReader, &renderConfig ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Failed to read renderer configuration from file %s\n", args.renderConfigFilePath ); - exit( -1 ); - } + if ( RenderConfigReader_read( renderConfigReader, &renderConfig ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Failed to read renderer configuration from file %s\n", args.renderConfigFilePath ); + exit( -1 ); + } - if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed\n" ); - exit( -1 ); + if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed\n" ); + exit( -1 ); + } } - } /* Set up output custom layout configuration */ if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index c43efeece8..57ffe7e549 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -95,8 +95,7 @@ ivas_error ivas_td_binaural_renderer( #ifdef TD5 st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, output, output_frame ); -#else +#else st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, output, output_frame ); #endif - } diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 07b3b2d718..3472de0c5a 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -84,10 +84,10 @@ ivas_error ivas_set_ism_metadata( ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ const float azimuth, /* i : azimuth value */ #ifdef TD5 - const float elevation, /* i : elevation */ - float radius_meta, /* i : radius */ - float yaw, /* i : yaw */ - float pitch /* i : pitch */ + const float elevation, /* i : elevation */ + float radius_meta, /* i : radius */ + float yaw, /* i : yaw */ + float pitch /* i : pitch */ #else const float elevation /* i : elevation value */ #endif diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 099d9aae38..90ef392088 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -761,12 +761,12 @@ ivas_error ivas_td_binaural_renderer_ext( #endif #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( ( error = ivas_td_binaural_renderer_unwrap( reverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, - ( headRotData != NULL ) ? headRotData->headPositions : NULL, + ( headRotData != NULL ) ? headRotData->headPositions : NULL, #ifdef TD5 ( headRotData != NULL ) ? headRotData->Pos : NULL, output, output_frame ) ) != IVAS_ERR_OK ) #else output, output_frame ) ) != IVAS_ERR_OK ) -#endif +#endif { return error; } @@ -777,7 +777,7 @@ ivas_error ivas_td_binaural_renderer_ext( ( headRotData != NULL ) ? headRotData->Pos : NULL, output, output_frame ) ) != IVAS_ERR_OK ) #else output, output_frame ) ) != IVAS_ERR_OK ) -#endif +#endif { return error; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 21cab52a73..426993c094 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1123,7 +1123,7 @@ static ivas_error setRendInputActiveIsm( if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif +#endif { return error; } @@ -3989,7 +3989,7 @@ int16_t IVAS_REND_FeedRenderConfig( hRenderConfig = hIvasRend->hRendererConfig; #ifdef TD5 - mvr2r(renderConfig.directivity, hRenderConfig->directivity, 3); + mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 ); #endif #ifdef DEBUGGING hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; @@ -4023,7 +4023,7 @@ int16_t IVAS_REND_FeedRenderConfig( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_SetHeadRotation( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ #ifdef TD5 const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME], /* i : head orientations for next rendering call */ const IVAS_POSITION Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ -- GitLab From 7e925d3f7d7006c431930f68c7495758dc9b2e4a Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 16 Mar 2023 16:15:50 +1100 Subject: [PATCH 225/375] Fix for issue 376 --- lib_com/options.h | 2 ++ lib_rend/lib_rend.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 940d3857fa..298fe1391f 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,6 +170,8 @@ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ #define FIX_372_LIB_REND_VALIDATE_IO /* FhG: Issue 372: IVAS_rend segfaults with unsupported I/O configs - add validation checks of I/O config */ +#define FIX_376_SBA_ROTATE /*DLB: Fix for issue 376*/ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 8a4807c8fc..7a1c4f4f30 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4321,7 +4321,18 @@ static ivas_error rotateFrameSba( ( 1 - headRotData->crossfade[i] ) * gains_prev[n][m] * ( *readPtr ); } } +#ifdef FIX_376_SBA_ROTATE + /* write back the result */ + for ( n = m1; n < m2; n++ ) + { + writePtr = getSmplPtr( outAudio, n, subframe_idx * subframe_len + i ); + ( *writePtr ) = tmpRot[n - m1]; + } + m1 = m2; + m2 += 2 * ( l + 1 ) + 1; +#endif } +#ifndef FIX_376_SBA_ROTATE /* write back the result */ for ( n = m1; n < m2; n++ ) { @@ -4330,6 +4341,7 @@ static ivas_error rotateFrameSba( } m1 = m2; m2 += 2 * ( l + 1 ) + 1; +#endif } /*unoptimized code for reference (full matrix multiplication)*/ -- GitLab From 5a699affbd8e6b3c55685d24d6fd8a7aab219a72 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Thu, 16 Mar 2023 10:29:37 +0200 Subject: [PATCH 226/375] Fix lower sampling rates --- lib_rend/ivas_dirac_dec_binaural_functions.c | 24 ++++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 073b56dedd..013fb026c9 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -84,13 +84,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( Decoder_Struc static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float output_f[][L_FRAME48k], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const uint8_t numInputChannels, const uint8_t firstSlot, const uint8_t slotEnd ); -#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS -#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT -static void adaptTransportSignalsHeadtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, float Rmat[3][3] ); -#else static void adaptTransportSignalsHeadtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, const uint8_t nBins, float Rmat[3][3] ); -#endif -#endif static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, const uint8_t nBins, float Rmat[3][3] ); @@ -586,13 +580,7 @@ static void ivas_dirac_dec_binaural_internal( if ( nchan_transport == 2 ) { -#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS -#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT - adaptTransportSignalsHeadtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, firstSlot, slotEnd, Rmat ); -#else adaptTransportSignalsHeadtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, firstSlot, slotEnd, nBins, Rmat ); -#endif -#endif ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( st_ivas->hHeadTrackData, Cldfb_ImagBuffer_in, Cldfb_RealBuffer_in, firstSlot, slotEnd, nBins, Rmat ); } @@ -1380,6 +1368,7 @@ static void adaptTransportSignalsHeadtracked( #ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT float ILD, mono_factor_ILD, mono_factor_rotation, mono_factor, y_val, ene_proc, ene_target; uint8_t n_slots_per_sf, sf_idx, n_sf; + int16_t max_band; #else float re[2], im[2], ILD, mono_factor_ILD, mono_factor_rotation, mono_factor, y_val; float proc_re[2], proc_im[2], sum_re, sum_im, ene_proc, ene_target, mf; @@ -1397,6 +1386,12 @@ static void adaptTransportSignalsHeadtracked( n_slots_per_sf = CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; n_sf = ( slotEnd - firstSlot ) / n_slots_per_sf; + max_band = 0; + while ( max_band < MASA_FREQUENCY_BANDS && MASA_band_grouping_24[max_band] < nBins ) + { + max_band++; + } + for ( sf_idx = 0; sf_idx < n_sf; sf_idx++ ) { float eqVal; @@ -1406,12 +1401,11 @@ static void adaptTransportSignalsHeadtracked( start_slot = firstSlot + sf_idx * n_slots_per_sf; stop_slot = start_slot + n_slots_per_sf; - for ( band_idx = 0; band_idx < MASA_FREQUENCY_BANDS; band_idx++ ) + for ( band_idx = 0; band_idx < max_band; band_idx++ ) { float ch_nrg[2]; /* storage for input signal channel energies */ bin_lo = MASA_band_grouping_24[band_idx]; - bin_hi = MASA_band_grouping_24[band_idx + 1]; - + bin_hi = min( MASA_band_grouping_24[band_idx + 1], (int16_t) nBins ); for ( ch = 0; ch < 2; ch++ ) { ch_nrg[ch] = 0.0f; -- GitLab From e3e2df4792d688e30bba373ac8a2ba7f30119244 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Thu, 16 Mar 2023 13:12:19 +0200 Subject: [PATCH 227/375] Enable nBins without flag --- lib_rend/ivas_dirac_dec_binaural_functions.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 013fb026c9..0fa759bed4 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1359,9 +1359,7 @@ static void adaptTransportSignalsHeadtracked( float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, -#ifndef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT const uint8_t nBins, -#endif float Rmat[3][3] ) { int16_t slot, ch, bin, louderCh; -- GitLab From d5acb9ae3f17e63ebc0ca27ca025f055a3c8edd5 Mon Sep 17 00:00:00 2001 From: szczerba Date: Thu, 16 Mar 2023 12:22:49 +0100 Subject: [PATCH 228/375] Fix for a merge glitch --- lib_rend/ivas_orient_trk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index df8f117a44..a408cf284a 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -478,9 +478,9 @@ void ivas_orient_trk_Init( pOTR->trkYaw = 0.0f; pOTR->trkPitch = 0.0f; pOTR->trkRoll = 0.0f; -#endif return; +#endif } -- GitLab From 7a222b8e257c7e1cc30f56a8191a1951de892cf6 Mon Sep 17 00:00:00 2001 From: szczerba Date: Thu, 16 Mar 2023 13:27:02 +0100 Subject: [PATCH 229/375] Cleanup --- lib_rend/ivas_crend.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 9520928d36..c109c56072 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1976,7 +1976,9 @@ ivas_error ivas_rend_openCrend( const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg, #ifdef FIX_197_CREND_INTERFACE +#ifndef FIX_I109_ORIENTATION_TRACKING int16_t Opt_Headrotation, +#endif #endif HRTFS_CREND_HANDLE hSetOfHRTF, const int32_t output_Fs ) -- GitLab From 16398292c377537f0079eedb4ff4ff6ded4e15a0 Mon Sep 17 00:00:00 2001 From: szczerba Date: Thu, 16 Mar 2023 16:19:33 +0100 Subject: [PATCH 230/375] Restoring unused openCrend function parameter --- lib_rend/ivas_crend.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index c109c56072..9520928d36 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1976,9 +1976,7 @@ ivas_error ivas_rend_openCrend( const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg, #ifdef FIX_197_CREND_INTERFACE -#ifndef FIX_I109_ORIENTATION_TRACKING int16_t Opt_Headrotation, -#endif #endif HRTFS_CREND_HANDLE hSetOfHRTF, const int32_t output_Fs ) -- GitLab From 05addaab89543ec5e84fbccd79742324f81dc701 Mon Sep 17 00:00:00 2001 From: szczerba Date: Thu, 16 Mar 2023 16:25:08 +0100 Subject: [PATCH 231/375] To suppress unused parameter warning --- lib_rend/ivas_crend.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 9520928d36..84f3fb87ea 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -2142,6 +2142,7 @@ ivas_error ivas_rend_openCrend( #ifndef FIX_I109_ORIENTATION_TRACKING if ( Opt_Headrotation ) #else + (void) Opt_Headrotation; if ( false ) /* TODO tmu : check renderer headrotation flag */ #endif { -- GitLab From 87fac8a6383de78778d1a4a09a98feb7e478eeb9 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Thu, 16 Mar 2023 17:01:13 +0100 Subject: [PATCH 232/375] Fixes for flexible reading of metadata in META format for external renderer --- apps/renderer.c | 38 +++++++++++++++++--------------------- lib_rend/lib_rend.c | 5 +++++ 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 00875cc4e3..3fcf5a0eeb 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -2065,36 +2065,31 @@ static void parseObjectPosition( uint16_t *positionDuration ) { char *endptr; +#ifdef TD5 + int16_t read_values; + float meta_prm[7] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f }; readNextMetadataChunk( line, "," ); *positionDuration = (uint16_t) strtol( line, &endptr, 10 ); + readNextMetadataChunk( line, "\n" ); - if ( *endptr != '\0' ) - { - fprintf( stderr, "Error reading metadata\n" ); - exit( -1 ); - } - - readNextMetadataChunk( line, "," ); - position->azimuth = strtof( line, &endptr ); + read_values = (int16_t) sscanf( line, "%f,%f,%f,%f,%f,%f,%f", &meta_prm[0], &meta_prm[1], &meta_prm[2], &meta_prm[3], &meta_prm[4], &meta_prm[5], &meta_prm[6] ); - if ( *endptr != '\0' ) + if ( read_values < 2 ) { fprintf( stderr, "Error reading metadata\n" ); exit( -1 ); } - readNextMetadataChunk( line, "\n" ); - position->elevation = strtof( line, &endptr ); - if ( *endptr != '\0' ) - { - fprintf( stderr, "Error reading metadata\n" ); - exit( -1 ); - } + position->azimuth = meta_prm[0]; + position->elevation = meta_prm[1]; + position->radius = meta_prm[2]; + position->yaw = meta_prm[5]; + position->pitch = meta_prm[6]; +#else -#ifdef TD5 readNextMetadataChunk( line, "," ); - position->radius = strtof( line, &endptr ); + *positionDuration = (uint16_t) strtol( line, &endptr, 10 ); if ( *endptr != '\0' ) { @@ -2102,8 +2097,9 @@ static void parseObjectPosition( exit( -1 ); } - readNextMetadataChunk( line, "\n" ); - position->yaw = strtof( line, &endptr ); + readNextMetadataChunk( line, "," ); + position->azimuth = strtof( line, &endptr ); + if ( *endptr != '\0' ) { fprintf( stderr, "Error reading metadata\n" ); @@ -2111,7 +2107,7 @@ static void parseObjectPosition( } readNextMetadataChunk( line, "\n" ); - position->pitch = strtof( line, &endptr ); + position->elevation = strtof( line, &endptr ); if ( *endptr != '\0' ) { fprintf( stderr, "Error reading metadata\n" ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 09be168ecb..d45c2f5f78 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1005,6 +1005,11 @@ static IVAS_REND_AudioObjectPosition defaultObjectPosition( pos.azimuth = 0.0f; pos.elevation = 0.0f; +#ifdef TD5 + pos.radius = 1.0f; + pos.yaw = 0.0f; + pos.pitch = 0.0f; +#endif return pos; } -- GitLab From 530f5975d73d35b44f0a83d34d905e56671cb8cf Mon Sep 17 00:00:00 2001 From: szczerba Date: Thu, 16 Mar 2023 17:04:13 +0100 Subject: [PATCH 233/375] cleanup: formatting update (clang) --- lib_rend/ivas_rotation.c | 3 +-- lib_rend/lib_rend.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index ab69b24530..0c991c79e7 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -268,8 +268,7 @@ void Euler2Quat( * Converts degrees to normalized radians *------------------------------------------------------------------------*/ float deg2rad( - float degrees -) + float degrees ) { while ( degrees >= 180.0f ) { diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 025acc1860..89e25285af 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3102,7 +3102,7 @@ static IVAS_REND_InputId makeInputId( /* Put config type in second byte (from LSB), put index + 1 in first byte * * Index is incremented here so that a valid ID can never be 0. */ - return ( IVAS_REND_InputId )( ( ( (uint32_t) getAudioConfigType( config ) ) << 8 ) | ( inputIndex + 1 ) ); + return (IVAS_REND_InputId) ( ( ( (uint32_t) getAudioConfigType( config ) ) << 8 ) | ( inputIndex + 1 ) ); } static ivas_error getInputById( @@ -3730,7 +3730,7 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsMasa[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { - latency_ns = NS2SA( hIvasRend->sampleRateOut, ( int32_t )( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); + latency_ns = NS2SA( hIvasRend->sampleRateOut, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); max_latency_ns = max( max_latency_ns, latency_ns ); } } -- GitLab From 8f88afc0522a9cf8ec3688c62e1ca78e9607223f Mon Sep 17 00:00:00 2001 From: rhb Date: Thu, 16 Mar 2023 17:08:09 +0100 Subject: [PATCH 234/375] fix asan error connected to CPE de-/allocation during bitrate switching --- lib_dec/ivas_corecoder_dec_reconfig.c | 40 +++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index 559552c230..06ec5921b5 100755 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -90,8 +90,13 @@ ivas_error ivas_corecoder_dec_reconfig( *-----------------------------------------------------------------*/ /* remove dummy CPE element for DFT stereo-like upmix */ +#ifdef SBA2MONO + if ( ( st_ivas->ivas_format == SBA_FORMAT && sba_dirac_stereo_flag_old && nchan_transport_old == 1 && ( !st_ivas->sba_dirac_stereo_flag || st_ivas->nchan_transport > 1 ) ) || + ( st_ivas->ivas_format == MC_FORMAT && last_mc_mode == MC_MODE_MCMASA && sba_dirac_stereo_flag_old && nchan_transport_old == 1 && ( !st_ivas->sba_dirac_stereo_flag || st_ivas->nchan_transport > 1 ) ) ) +#else if ( ( st_ivas->ivas_format == SBA_FORMAT && sba_dirac_stereo_flag_old && !st_ivas->sba_dirac_stereo_flag ) || ( st_ivas->ivas_format == MC_FORMAT && last_mc_mode == MC_MODE_MCMASA && sba_dirac_stereo_flag_old && !st_ivas->sba_dirac_stereo_flag ) ) +#endif { st_ivas->hCPE[0]->hCoreCoder[0] = NULL; st_ivas->hCPE[0]->hCoreCoder[1] = NULL; @@ -150,9 +155,19 @@ ivas_error ivas_corecoder_dec_reconfig( for ( cpe_id = st_ivas->nCPE; cpe_id < nCPE_old; cpe_id++ ) { #ifdef SBA2MONO - /* don't deallocate first CPE in case of mono/stereo output of 1 TC SBA */ - if ( cpe_id == 0 && st_ivas->sba_dirac_stereo_flag ) + /* don't deallocate first CPE in case of mono/stereo output of 1 TC SBA, only deallocate core coder */ + if ( cpe_id == 0 && st_ivas->sba_dirac_stereo_flag && sba_dirac_stereo_flag_old ) { + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + if ( st_ivas->hCPE[cpe_id]->hCoreCoder[n] != NULL ) + { + destroy_core_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + + free( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + st_ivas->hCPE[cpe_id]->hCoreCoder[n] = NULL; + } + } continue; } #endif @@ -196,7 +211,7 @@ ivas_error ivas_corecoder_dec_reconfig( } } #ifdef SBA2MONO - if ( st_ivas->sba_dirac_stereo_flag && st_ivas->nchan_transport == 1 && nchan_transport_old > 1 ) + if ( st_ivas->sba_dirac_stereo_flag && sba_dirac_stereo_flag_old && st_ivas->nchan_transport == 1 && nSCE_old == 0 ) { st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hSCE[0]->hCoreCoder[0]; /* don't allocate unnecessary core coder, simply point to core coder of SCE element */ st_ivas->hCPE[0]->hCoreCoder[1] = NULL; @@ -280,10 +295,29 @@ ivas_error ivas_corecoder_dec_reconfig( if ( ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_dirac_stereo_flag && !sba_dirac_stereo_flag_old ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->sba_dirac_stereo_flag && !sba_dirac_stereo_flag_old ) ) { +#ifdef SBA2MONO + /* if at least one CPE is already available, only allocate DFT Stereo struct */ + if ( st_ivas->nCPE > 0 ) + { + if ( ( error = stereo_dft_dec_create( &(st_ivas->hCPE[0]->hStereoDft ), st_ivas->hCPE[0]->element_brate, st_ivas->hDecoderConfig->output_Fs, st_ivas->sba_dirac_stereo_flag, st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) + { + return error; + } + } + /* otherwise create extra dummy CPE */ + else + { + if ( ( error = create_cpe_dec( st_ivas, 0, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#else if ( ( error = create_cpe_dec( st_ivas, 0, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) { return error; } +#endif // VE: TBV - just reset for now set_f( st_ivas->hCPE[0]->hStereoDft->buff_LBTCX_mem, 0, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); -- GitLab From 4e377afd6b369de8231c5459d2d1f5b91ee70de7 Mon Sep 17 00:00:00 2001 From: szczerba Date: Thu, 16 Mar 2023 17:19:10 +0100 Subject: [PATCH 235/375] cleanup: formatting update (clang) --- lib_rend/ivas_objectRenderer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 7ec5e4aa52..61c78083a9 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -689,13 +689,13 @@ ivas_error ivas_td_binaural_renderer_ext( #endif #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( ( error = ivas_td_binaural_renderer_unwrap( reverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, - ( headRotData != NULL ) ? headRotData->headPositions : NULL, output, output_frame ) ) != IVAS_ERR_OK ) + ( headRotData != NULL ) ? headRotData->headPositions : NULL, output, output_frame ) ) != IVAS_ERR_OK ) { return error; } #else if ( ( error = ivas_td_binaural_renderer_unwrap( NULL, 1, NULL, transport_config, output_Fs, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, - ( headRotData != NULL ) ? headRotData->headPositions : NULL, output, output_frame ) ) != IVAS_ERR_OK ) + ( headRotData != NULL ) ? headRotData->headPositions : NULL, output, output_frame ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From c1eb8dbb226b3018a110c3712b8b75bdad9d0e7f Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 16 Mar 2023 21:06:46 +0100 Subject: [PATCH 236/375] [cleanup] accept SBA_BR_SWITCHING_CLEAN_UP --- lib_com/ivas_fb_mixer.c | 28 ------- lib_com/ivas_prot.h | 12 --- lib_com/options.h | 1 - lib_dec/ivas_init_dec.c | 8 -- lib_dec/ivas_sba_dec.c | 150 ----------------------------------- lib_dec/ivas_spar_decoder.c | 20 ----- lib_enc/ivas_dirac_enc.c | 8 -- lib_enc/ivas_init_enc.c | 8 -- lib_enc/ivas_ism_param_enc.c | 8 -- lib_enc/ivas_mc_param_enc.c | 8 -- lib_enc/ivas_mcmasa_enc.c | 16 ---- lib_enc/ivas_sba_enc.c | 102 ------------------------ lib_enc/ivas_spar_encoder.c | 35 -------- 13 files changed, 404 deletions(-) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index c3389288de..4543955cee 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -175,10 +175,8 @@ ivas_error ivas_FB_mixer_open( IVAS_FB_MIXER_HANDLE *hFbMixer_out, /* i/o: FB mixer handle */ const int32_t sampling_rate, /* i : sampling rate */ IVAS_FB_CFG *fb_cfg /* i : FB config. handle */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP , const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ -#endif ) { IVAS_FB_MIXER_HANDLE hFbMixer; @@ -190,12 +188,10 @@ ivas_error ivas_FB_mixer_open( frame_len = (int16_t) ( sampling_rate / FRAMES_PER_SEC ); -#ifdef SBA_BR_SWITCHING_CLEAN_UP hFbMixer = *hFbMixer_out; if ( !spar_reconfig_flag ) { -#endif if ( ( hFbMixer = (IVAS_FB_MIXER_HANDLE) malloc( sizeof( IVAS_FB_MIXER_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); @@ -212,9 +208,7 @@ ivas_error ivas_FB_mixer_open( { hFbMixer->pFb = NULL; } -#ifdef SBA_BR_SWITCHING_CLEAN_UP } -#endif if ( fb_cfg->active_w_mixing == -1 ) { @@ -289,10 +283,8 @@ ivas_error ivas_FB_mixer_open( } } -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { -#endif if ( fb_cfg->num_out_chans > 0 ) { const int16_t *pActive_bins_per_band, *pActive_bins_per_band_abs, *pStart_offset, *pStart_offset_abs; @@ -341,25 +333,19 @@ ivas_error ivas_FB_mixer_open( /* ignore all the deeper filter bank stuff for now */ hFbMixer->num_diff_bands = 0; } -#ifdef SBA_BR_SWITCHING_CLEAN_UP } -#endif hFbMixer->fb_cfg = fb_cfg; -#ifdef SBA_BR_SWITCHING_CLEAN_UP set_s( hFbMixer->first_frame, 1, hFbMixer->fb_cfg->num_out_chans ); set_s( hFbMixer->first_frame + hFbMixer->fb_cfg->num_out_chans, 0, IVAS_SPAR_MAX_CH - hFbMixer->fb_cfg->num_out_chans ); if ( !spar_reconfig_flag ) { -#endif if ( ( error = ivas_filterbank_setup( hFbMixer, sampling_rate ) ) != IVAS_ERR_OK ) { return error; } -#ifdef SBA_BR_SWITCHING_CLEAN_UP } -#endif *hFbMixer_out = hFbMixer; @@ -376,10 +362,8 @@ ivas_error ivas_FB_mixer_open( void ivas_FB_mixer_close( IVAS_FB_MIXER_HANDLE *hFbMixer_in, /* i/o: FB mixer handle */ const int32_t sampling_rate /* i : sampling rate in Hz */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP , const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ -#endif ) { IVAS_FB_MIXER_HANDLE hFbMixer; @@ -439,10 +423,8 @@ void ivas_FB_mixer_close( hFbMixer->prior_mixer[0][0] = NULL; } -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { -#endif if ( fb_cfg->num_out_chans > 0 ) { num_bands = hFbMixer->pFb->filterbank_num_bands; @@ -476,9 +458,7 @@ void ivas_FB_mixer_close( free( hFbMixer->pFb ); hFbMixer->pFb = NULL; } -#ifdef SBA_BR_SWITCHING_CLEAN_UP } -#endif if ( hFbMixer->fb_cfg != NULL ) { @@ -486,15 +466,11 @@ void ivas_FB_mixer_close( hFbMixer->fb_cfg = NULL; } -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { -#endif free( hFbMixer ); hFbMixer = NULL; -#ifdef SBA_BR_SWITCHING_CLEAN_UP } -#endif } return; @@ -1074,10 +1050,6 @@ static ivas_error ivas_filterbank_setup( IVAS_FB_CFG *pCfg = hFbMixer->fb_cfg; error = IVAS_ERR_OK; -#ifndef SBA_BR_SWITCHING_CLEAN_UP - set_s( hFbMixer->first_frame, 1, pCfg->num_out_chans ); - set_s( hFbMixer->first_frame + pCfg->num_out_chans, 0, IVAS_SPAR_MAX_CH - pCfg->num_out_chans ); -#endif if ( pCfg->num_out_chans > 0 ) { diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 6711b998c9..c77c7e03d6 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3751,18 +3751,14 @@ void FdCngDecodeDiracMDCTStereoSID( ivas_error ivas_spar_enc_open( Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP ,const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ -#endif ); void ivas_spar_enc_close( SPAR_ENC_HANDLE hSpar, /* i/o: SPAR encoder handle */ const int32_t input_Fs, /* i : input sampling rate */ const int16_t nchan_inp /* i : number of input channels */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP ,const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ -#endif ); ivas_error ivas_spar_enc( @@ -3775,19 +3771,15 @@ ivas_error ivas_spar_enc( ivas_error ivas_spar_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP , const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ -#endif ); void ivas_spar_dec_close( SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ const int32_t output_Fs /* i : output sampling rate */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP , const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ -#endif ); ivas_error ivas_spar_dec( @@ -4972,19 +4964,15 @@ ivas_error ivas_FB_mixer_open( IVAS_FB_MIXER_HANDLE *hFbMixer, /* i/o: FB mixer handle */ const int32_t sampling_rate, /* i : sampling rate */ IVAS_FB_CFG *fb_cfg /* i : FB config. handle */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP , const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ -#endif ); void ivas_FB_mixer_close( IVAS_FB_MIXER_HANDLE *hFbMixer, /* i/o: FB mixer handle */ const int32_t sampling_rate /* i : sampling rate in Hz */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP , const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ -#endif ); void ivas_fb_mixer_pcm_ingest( diff --git a/lib_com/options.h b/lib_com/options.h index 298fe1391f..5120a1bc0b 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -141,7 +141,6 @@ #define DISABLE_ADAP_RES_COD_TMP /* temporary fix for IVAS-403, disables adaptive residual coding */ /*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define SBA_BR_SWITCHING_CLEAN_UP /*Issue 114: Clean up changes for the SBA reconfiguation functions*/ #define LOW_RATE_TRANS_CORE_CODER /* Eri: Activate low-rate-encoding-of-transients contribution for core coder, affects MC, MASA and SBA */ #define FIX_197_CREND_INTERFACE #define FIX_329_ENABLE_TD_RENDERER_REVERB_MC /* Eri: Enable reverb for TD renderer for 5.1 and 7.1 with headtracking enabled for IVAS_dec */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 25813f34b2..e6c5f28a21 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -863,11 +863,7 @@ ivas_error ivas_init_decoder( { if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_spar_dec_open( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1727,11 +1723,7 @@ void ivas_destroy_dec( /* Spar handle */ if ( st_ivas->hSpar != NULL ) { -#ifdef SBA_BR_SWITCHING_CLEAN_UP ivas_spar_dec_close( st_ivas->hSpar, st_ivas->hDecoderConfig->output_Fs, 0 ); -#else - ivas_spar_dec_close( st_ivas->hSpar, st_ivas->hDecoderConfig->output_Fs ); -#endif st_ivas->hSpar = NULL; } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 525e775eb9..76ac3578f9 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -65,9 +65,7 @@ ivas_error ivas_sba_dec_reconfigure( RENDERER_TYPE old_renderer_type; DECODER_CONFIG_HANDLE hDecoderConfig; ivas_error error; -#ifdef SBA_BR_SWITCHING_CLEAN_UP int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; -#endif error = IVAS_ERR_OK; @@ -112,11 +110,7 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->sba_mode != SBA_MODE_SPAR ) { -#ifndef SBA_BR_SWITCHING_CLEAN_UP - ivas_spar_dec_close( st_ivas->hSpar, hDecoderConfig->output_Fs ); -#else ivas_spar_dec_close( st_ivas->hSpar, hDecoderConfig->output_Fs, 0 ); -#endif st_ivas->hSpar = NULL; if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, -1 ) ) != IVAS_ERR_OK ) @@ -128,78 +122,11 @@ ivas_error ivas_sba_dec_reconfigure( } else { -#ifdef SBA_BR_SWITCHING_CLEAN_UP int16_t sba_order_internal; -#else - int16_t i, sba_order_internal, nchan_internal; - DIRAC_DEC_HANDLE hDirAC = st_ivas->hDirAC; -#endif SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); -#ifndef SBA_BR_SWITCHING_CLEAN_UP - nchan_internal = ivas_sba_get_nchan_metadata( sba_order_internal ); - if ( hSpar != NULL && nchan_transport_old != ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) ) - { - // VE: dirty patch -> reconfiguration of SPAR modules should be used instead !! - IVAS_FB_CFG *fb_cfg; - int16_t active_w_mixing; - - /* MD handle */ - ivas_spar_md_dec_close( &hSpar->hMdDec ); - - if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, nchan_internal, sba_order_internal, st_ivas->sid_format ) ) != IVAS_ERR_OK ) - { - return error; - } - hSpar->hMdDec->td_decorr_flag = 1; - hSpar->hMdDec->table_idx = -1; - - /* TD decorr. */ - ivas_td_decorr_dec_close( &hSpar->hTdDecorr ); - - if ( ( error = ivas_td_decorr_dec_open( &hSpar->hTdDecorr, hDecoderConfig->output_Fs, nchan_internal, 1 ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* FB mixer handle */ - ivas_FB_mixer_close( &hSpar->hFbMixer, hDecoderConfig->output_Fs ); - - /* set FB config. */ - active_w_mixing = -1; - if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_SPAR, nchan_internal, nchan_internal, active_w_mixing, hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - fb_cfg->pcm_offset = NS2SA( hDecoderConfig->output_Fs, DELAY_FB_1_NS + IVAS_ENC_DELAY_NS + IVAS_DEC_DELAY_NS ); - fb_cfg->remix_order = remix_order_set[hSpar->hMdDec->spar_md_cfg.remix_unmix_order]; - - /* FB mixer handle */ - if ( ( error = ivas_FB_mixer_open( &hSpar->hFbMixer, hDecoderConfig->output_Fs, fb_cfg ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* mixer_mat intitialization */ - for ( i = 0; i < nchan_internal; i++ ) - { - for ( int16_t j = 0; j < nchan_internal; j++ ) - { - for ( int16_t b = 0; b < IVAS_MAX_NUM_BANDS; b++ ) - { - hSpar->hMdDec->mixer_mat[i][j][b] = 0.0f; - for ( int16_t i_ts = 0; i_ts < ( MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); i_ts++ ) - { - hSpar->hMdDec->mixer_mat_prev[i_ts][i][j][b] = 0.0f; - } - } - } - } - hSpar->i_subframe = 0; - } -#else if ( hSpar != NULL ) { if ( ( hSpar->hPCA != NULL ) && ( ( hDecoderConfig->ivas_total_brate != PCA_BRATE ) || ( sba_order_internal != 1 ) ) ) @@ -230,61 +157,6 @@ ivas_error ivas_sba_dec_reconfigure( hSpar = st_ivas->hSpar; st_ivas->sba_dirac_stereo_flag = 0; -#endif -#ifndef SBA_BR_SWITCHING_CLEAN_UP - /* PCA handle */ - if ( hSpar != NULL ) - { - if ( hDecoderConfig->ivas_total_brate == PCA_BRATE && sba_order_internal == 1 ) - { - if ( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for PCA decoder" ); - } - - ivas_pca_dec_init( hSpar->hPCA ); - } - else if ( hSpar->hPCA != NULL ) - { - free( st_ivas->hSpar->hPCA ); - hSpar->hPCA = NULL; - } - } - - if ( hSpar == NULL && st_ivas->sba_mode == SBA_MODE_SPAR ) - { - if ( ( error = ivas_spar_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - hSpar = st_ivas->hSpar; - } - st_ivas->sba_dirac_stereo_flag = 0; - - sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); - ivas_spar_config( ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, st_ivas->sid_format ); - - if ( hDirAC == NULL && st_ivas->sba_mode == SBA_MODE_DIRAC ) - { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - hDirAC = st_ivas->hDirAC; - } - - if ( hDirAC != NULL && sba_mode_old == st_ivas->sba_mode ) - { - ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE_MODE ); - } - - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } if ( st_ivas->nchan_transport == 1 ) @@ -351,7 +223,6 @@ ivas_error ivas_sba_dec_reconfigure( ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); } -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( sba_mode_old != st_ivas->sba_mode ) || ( ( st_ivas->sba_mode == SBA_MODE_SPAR ) && ( ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) ) ) { DIRAC_CONFIG_FLAG flag_config; @@ -393,27 +264,6 @@ ivas_error ivas_sba_dec_reconfigure( ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); } -#else - if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( sba_mode_old != st_ivas->sba_mode ) ) - { - DIRAC_CONFIG_FLAG flag_config; - - flag_config = DIRAC_OPEN; - if ( st_ivas->hDirAC != NULL ) - { - flag_config = DIRAC_RECONFIGURE; - if ( sba_mode_old != st_ivas->sba_mode && st_ivas->sba_mode != SBA_MODE_SPAR ) - { - flag_config = DIRAC_RECONFIGURE_MODE; - } - } - - if ( ( error = ivas_dirac_dec_config( st_ivas, flag_config ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif else if ( st_ivas->renderer_type == RENDERER_DISABLE || ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode != SBA_MODE_SPAR ) ) { diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 7515300681..dbab951140 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -62,10 +62,8 @@ static void ivas_spar_dec_MD( Decoder_Struct *st_ivas, Decoder_State *st0 ); ivas_error ivas_spar_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP , const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ -#endif ) { SPAR_DEC_HANDLE hSpar; @@ -78,20 +76,16 @@ ivas_error ivas_spar_dec_open( error = IVAS_ERR_OK; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); num_channels_internal = ivas_sba_get_nchan_metadata( sba_order_internal ); -#ifdef SBA_BR_SWITCHING_CLEAN_UP hSpar = st_ivas->hSpar; if ( !spar_reconfig_flag ) { -#endif /* SPAR decoder handle */ if ( ( hSpar = (SPAR_DEC_HANDLE) malloc( sizeof( SPAR_DEC_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR decoder" ); } -#ifdef SBA_BR_SWITCHING_CLEAN_UP } -#endif output_Fs = st_ivas->hDecoderConfig->output_Fs; @@ -119,11 +113,7 @@ ivas_error ivas_spar_dec_open( fb_cfg->remix_order = remix_order_set[hSpar->hMdDec->spar_md_cfg.remix_unmix_order]; /* FB mixer handle */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( ( error = ivas_FB_mixer_open( &hSpar->hFbMixer, output_Fs, fb_cfg, spar_reconfig_flag ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_FB_mixer_open( &hSpar->hFbMixer, output_Fs, fb_cfg ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -199,10 +189,8 @@ ivas_error ivas_spar_dec_open( void ivas_spar_dec_close( SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ const int32_t output_Fs /* i : output sampling rate */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP , const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ -#endif ) { if ( hSpar != NULL ) @@ -214,11 +202,7 @@ void ivas_spar_dec_close( ivas_td_decorr_dec_close( &hSpar->hTdDecorr ); /* FB mixer handle */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP ivas_FB_mixer_close( &hSpar->hFbMixer, output_Fs, spar_reconfig_flag ); -#else - ivas_FB_mixer_close( &hSpar->hFbMixer, output_Fs ); -#endif /* AGC */ ivas_spar_agc_dec_close( &hSpar->hAgcDec ); @@ -230,15 +214,11 @@ void ivas_spar_dec_close( hSpar->hPCA = NULL; } -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { -#endif free( hSpar ); hSpar = NULL; -#ifdef SBA_BR_SWITCHING_CLEAN_UP } -#endif } return; diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index a143ff37d2..61edd0b9a9 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -104,11 +104,7 @@ ivas_error ivas_dirac_enc_open( return error; } /* Allocate and initialize FB mixer handle */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -261,11 +257,7 @@ void ivas_dirac_enc_close( if ( hDirAC->hFbMixer != NULL ) { -#ifdef SBA_BR_SWITCHING_CLEAN_UP ivas_FB_mixer_close( &hDirAC->hFbMixer, input_Fs, 0 ); -#else - ivas_FB_mixer_close( &hDirAC->hFbMixer, input_Fs ); -#endif } for ( i = 0; i < DIRAC_MAX_ANA_CHANS; i++ ) diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index cce80138cb..c729511e70 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -462,11 +462,7 @@ ivas_error ivas_init_encoder( if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( ( error = ivas_spar_enc_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_spar_enc_open( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -966,11 +962,7 @@ void ivas_destroy_enc( /* SPAR handle */ if ( st_ivas->hSpar != NULL ) { -#ifdef SBA_BR_SWITCHING_CLEAN_UP ivas_spar_enc_close( st_ivas->hSpar, st_ivas->hEncoderConfig->input_Fs, nchan_inp, 0 ); -#else - ivas_spar_enc_close( st_ivas->hSpar, st_ivas->hEncoderConfig->input_Fs, nchan_inp ); -#endif st_ivas->hSpar = NULL; } diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index ef66df5a90..2397e68eaf 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -281,11 +281,7 @@ ivas_error ivas_param_ism_enc_open( } /* Allocate and initialize FB mixer handle */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -324,11 +320,7 @@ void ivas_param_ism_enc_close( const int32_t input_Fs /* i : input sampling_rate */ ) { -#ifdef SBA_BR_SWITCHING_CLEAN_UP ivas_FB_mixer_close( &hDirAC->hFbMixer, input_Fs, 0 ); -#else - ivas_FB_mixer_close( &hDirAC->hFbMixer, input_Fs ); -#endif if ( hDirAC->hParamIsm != NULL ) { diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 9b1241f234..e51887d455 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -146,11 +146,7 @@ ivas_error ivas_param_mc_enc_open( } /* Allocate and initialize FB mixer handle */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( ( error = ivas_FB_mixer_open( &( hParamMC->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_FB_mixer_open( &( hParamMC->hFbMixer ), input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -369,11 +365,7 @@ void ivas_param_mc_enc_close( { ivas_param_mc_metadata_close( &hParamMC->hMetadataPMC ); -#ifdef SBA_BR_SWITCHING_CLEAN_UP ivas_FB_mixer_close( &hParamMC->hFbMixer, sampling_rate, 0 ); -#else - ivas_FB_mixer_close( &hParamMC->hFbMixer, sampling_rate ); -#endif free( hParamMC ); diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index 153bc3ecad..b79f4b62e4 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -194,11 +194,7 @@ ivas_error ivas_mcmasa_enc_open( } /* Allocate and initialize FB mixer handle */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( ( error = ivas_FB_mixer_open( &( hMcMasa->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_FB_mixer_open( &( hMcMasa->hFbMixer ), input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -228,11 +224,7 @@ ivas_error ivas_mcmasa_enc_open( return error; } -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( ( error = ivas_FB_mixer_open( &( hMcMasa->hFbMixerLfe ), input_Fs, fb_cfgLfe, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_FB_mixer_open( &( hMcMasa->hFbMixerLfe ), input_Fs, fb_cfgLfe ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -508,19 +500,11 @@ void ivas_mcmasa_enc_close( } } -#ifdef SBA_BR_SWITCHING_CLEAN_UP ivas_FB_mixer_close( &hMcMasa->hFbMixer, input_Fs, 0 ); -#else - ivas_FB_mixer_close( &hMcMasa->hFbMixer, input_Fs ); -#endif if ( !hMcMasa->separateChannelEnabled ) { -#ifdef SBA_BR_SWITCHING_CLEAN_UP ivas_FB_mixer_close( &hMcMasa->hFbMixerLfe, input_Fs, 0 ); -#else - ivas_FB_mixer_close( &hMcMasa->hFbMixerLfe, input_Fs ); -#endif } /* intensity 3-dim */ diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index e878d74183..d9cd39f7c0 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -123,11 +123,9 @@ ivas_error ivas_sba_enc_reconfigure( #ifdef SBA_HPF_TUNING_ENC int16_t analysis_order_old; #endif -#ifdef SBA_BR_SWITCHING_CLEAN_UP int16_t spar_reconfig_flag; spar_reconfig_flag = 0; -#endif nchan_transport_old = st_ivas->nchan_transport; nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; @@ -210,11 +208,7 @@ ivas_error ivas_sba_enc_reconfigure( { if ( st_ivas->hSpar == NULL ) { -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( ( error = ivas_spar_enc_open( st_ivas, spar_reconfig_flag ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_spar_enc_open( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -223,7 +217,6 @@ ivas_error ivas_sba_enc_reconfigure( ivas_spar_config( ivas_total_brate, min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->hSpar->core_nominal_brate, -1 ); -#ifdef SBA_BR_SWITCHING_CLEAN_UP for ( n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) { if ( hDirAC->sba_synchro_buffer[n] != NULL ) @@ -233,16 +226,11 @@ ivas_error ivas_sba_enc_reconfigure( } } hDirAC->num_samples_synchro_delay = 0; -#endif } else { -#ifdef SBA_BR_SWITCHING_CLEAN_UP ivas_spar_enc_close( st_ivas->hSpar, hEncoderConfig->input_Fs, hEncoderConfig->nchan_inp, spar_reconfig_flag ); -#else - ivas_spar_enc_close( st_ivas->hSpar, hEncoderConfig->input_Fs, hEncoderConfig->nchan_inp ); -#endif st_ivas->hSpar = NULL; } @@ -264,60 +252,12 @@ ivas_error ivas_sba_enc_reconfigure( { if ( hDirAC->hFbMixer != NULL ) { -#ifndef SBA_BR_SWITCHING_CLEAN_UP - ivas_FB_mixer_close( &( hDirAC->hFbMixer ), hEncoderConfig->input_Fs ); -#else ivas_FB_mixer_close( &( hDirAC->hFbMixer ), hEncoderConfig->input_Fs, 0 ); -#endif hDirAC->hFbMixer = NULL; } if ( sba_mode_old == SBA_MODE_SPAR ) { -#ifndef SBA_BR_SWITCHING_CLEAN_UP - IVAS_FB_CFG *fb_cfg; - int16_t nchan_internal, sba_order_internal; - int16_t table_idx, active_w_mixing; - - sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); - nchan_internal = ivas_sba_get_nchan_metadata( sba_order_internal ); - - /* Covar. State handle */ - ivas_spar_covar_enc_close( &hSpar->hCovEnc, hSpar->hFbMixer->fb_cfg->num_in_chans ); - - /* MD handle */ - ivas_spar_md_enc_close( &hSpar->hMdEnc ); - - if ( ( error = ivas_spar_md_enc_open( &( hSpar->hMdEnc ), hEncoderConfig, sba_order_internal ) ) != IVAS_ERR_OK ) - { - return error; - } - - /*Initialization*/ - hSpar->hMdEnc->table_idx = -1; - - /* FB mixer handle */ - ivas_FB_mixer_close( &hSpar->hFbMixer, hEncoderConfig->input_Fs ); - - table_idx = ivas_get_spar_table_idx( ivas_total_brate, sba_order_internal, SPAR_CONFIG_BW, NULL, NULL ); - active_w_mixing = ivas_spar_br_table_consts[table_idx].active_w; - if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_SPAR, nchan_internal, st_ivas->nchan_transport, active_w_mixing, hEncoderConfig->input_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - fb_cfg->remix_order = remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order]; - - if ( ( error = ivas_FB_mixer_open( &( hSpar->hFbMixer ), hEncoderConfig->input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* Covar. State handle */ - if ( ( error = ivas_spar_covar_enc_open( &( hSpar->hCovEnc ), hSpar->hFbMixer->pFb, hEncoderConfig->input_Fs, nchan_internal ) ) != IVAS_ERR_OK ) - { - return error; - } -#else spar_reconfig_flag = 1; ivas_spar_enc_close( st_ivas->hSpar, hEncoderConfig->input_Fs, hEncoderConfig->nchan_inp, spar_reconfig_flag ); @@ -325,7 +265,6 @@ ivas_error ivas_sba_enc_reconfigure( { return error; } -#endif } } else @@ -340,11 +279,7 @@ ivas_error ivas_sba_enc_reconfigure( } /* Allocate and initialize FB mixer handle */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), hEncoderConfig->input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), hEncoderConfig->input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -368,43 +303,6 @@ ivas_error ivas_sba_enc_reconfigure( } } } -#ifndef SBA_BR_SWITCHING_CLEAN_UP - /* initialize delay for SPAR/DirAC delay synchronization */ - if ( ( st_ivas->sba_mode == SBA_MODE_DIRAC ) && ( ( sba_mode_old != st_ivas->sba_mode ) || ( nchan_transport_old != st_ivas->nchan_transport ) ) ) - { - if ( hDirAC->num_samples_synchro_delay == 0 ) - { - hDirAC->num_samples_synchro_delay = NS2SA( hEncoderConfig->input_Fs, IVAS_FB_ENC_DELAY_NS ); - - for ( n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) - { - if ( ( hDirAC->sba_synchro_buffer[n] = (float *) malloc( hDirAC->num_samples_synchro_delay * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hDirAC synchro buffer\n" ) ); - } - set_zero( hDirAC->sba_synchro_buffer[n], hDirAC->num_samples_synchro_delay ); - } - for ( ; n < DIRAC_MAX_ANA_CHANS; n++ ) - { - hDirAC->sba_synchro_buffer[n] = NULL; - } - } - } - else - { - for ( n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) - { - if ( hDirAC->sba_synchro_buffer[n] != NULL ) - { - free( hDirAC->sba_synchro_buffer[n] ); - hDirAC->sba_synchro_buffer[n] = NULL; - } - } - hDirAC->num_samples_synchro_delay = 0; - } - - -#endif } if ( ( error = ivas_dirac_enc_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index b156c524d2..e5ed9ff9ff 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -59,10 +59,8 @@ static ivas_error ivas_spar_enc_process( Encoder_Struct *st_ivas, const ENCODER_ ivas_error ivas_spar_enc_open( Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP , const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ -#endif ) { SPAR_ENC_HANDLE hSpar; @@ -75,20 +73,16 @@ ivas_error ivas_spar_enc_open( hEncoderConfig = st_ivas->hEncoderConfig; error = IVAS_ERR_OK; -#ifdef SBA_BR_SWITCHING_CLEAN_UP hSpar = st_ivas->hSpar; if ( !spar_reconfig_flag ) { -#endif /* SPAR encoder handle */ if ( ( hSpar = (SPAR_ENC_HANDLE) malloc( sizeof( SPAR_ENC_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR encoder" ); } -#ifdef SBA_BR_SWITCHING_CLEAN_UP } -#endif input_Fs = hEncoderConfig->input_Fs; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); @@ -114,11 +108,7 @@ ivas_error ivas_spar_enc_open( fb_cfg->remix_order = remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order]; /* FB mixer handle */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( ( error = ivas_FB_mixer_open( &( hSpar->hFbMixer ), input_Fs, fb_cfg, spar_reconfig_flag ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_FB_mixer_open( &( hSpar->hFbMixer ), input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -129,18 +119,14 @@ ivas_error ivas_spar_enc_open( return error; } -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { -#endif /* Transient Detector handle */ if ( ( error = ivas_transient_det_open( &( hSpar->hTranDet ), input_Fs ) ) != IVAS_ERR_OK ) { return error; } -#ifdef SBA_BR_SWITCHING_CLEAN_UP } -#endif /* initialization */ hSpar->hMdEnc->table_idx = -1; @@ -194,10 +180,8 @@ ivas_error ivas_spar_enc_open( * Allocate and initialize Front-VAD handle *-----------------------------------------------------------------*/ -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { -#endif hSpar->front_vad_flag = 0; hSpar->front_vad_dtx_flag = 0; hSpar->force_front_vad = 0; @@ -233,9 +217,7 @@ ivas_error ivas_spar_enc_open( hSpar->hCoreCoderVAD = NULL; hSpar->hFrontVad = NULL; } -#ifdef SBA_BR_SWITCHING_CLEAN_UP } -#endif /*-----------------------------------------------------------------* * Final assignment @@ -257,20 +239,16 @@ void ivas_spar_enc_close( SPAR_ENC_HANDLE hSpar, /* i/o: SPAR encoder handle */ const int32_t input_Fs, /* i : input sampling rate */ const int16_t nchan_inp /* i : number of input channels */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP , const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ -#endif ) { int16_t num_chans; if ( hSpar != NULL ) { -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { -#endif /* core-coder-VAD handle */ if ( hSpar->hCoreCoderVAD != NULL ) { @@ -284,9 +262,7 @@ void ivas_spar_enc_close( front_vad_destroy( &hSpar->hFrontVad ); hSpar->hFrontVad = NULL; } -#ifdef SBA_BR_SWITCHING_CLEAN_UP } -#endif num_chans = hSpar->hFbMixer->fb_cfg->num_in_chans; assert( num_chans <= nchan_inp ); @@ -298,14 +274,7 @@ void ivas_spar_enc_close( ivas_spar_covar_enc_close( &hSpar->hCovEnc, num_chans ); /* FB mixer handle */ -#ifdef SBA_BR_SWITCHING_CLEAN_UP ivas_FB_mixer_close( &hSpar->hFbMixer, input_Fs, spar_reconfig_flag ); -#else - ivas_FB_mixer_close( &hSpar->hFbMixer, input_Fs ); - - /* Trans Det handle */ - ivas_transient_det_close( &hSpar->hTranDet ); -#endif /* AGC */ ivas_spar_agc_enc_close( &hSpar->hAgcEnc ); @@ -317,17 +286,13 @@ void ivas_spar_enc_close( hSpar->hPCA = NULL; } -#ifdef SBA_BR_SWITCHING_CLEAN_UP if ( !spar_reconfig_flag ) { /* Trans Det handle */ ivas_transient_det_close( &hSpar->hTranDet ); -#endif free( hSpar ); hSpar = NULL; -#ifdef SBA_BR_SWITCHING_CLEAN_UP } -#endif } return; -- GitLab From d86d7699aa3c5b49c57f9fe0ca0b3ba62e78b3f7 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 16 Mar 2023 21:07:35 +0100 Subject: [PATCH 237/375] [cleanup] accept LOW_RATE_TRANS_CORE_CODER --- lib_com/ivas_prot.h | 5 ----- lib_com/options.h | 1 - lib_enc/ivas_core_pre_proc_front.c | 9 --------- lib_enc/ivas_cpe_enc.c | 8 -------- lib_enc/ivas_ism_enc.c | 8 -------- lib_enc/ivas_sce_enc.c | 11 ----------- 6 files changed, 42 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c77c7e03d6..8982d3d4d6 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -202,12 +202,7 @@ ivas_error pre_proc_front_ivas( const int16_t front_vad_flag, /* i : front-VAD flag to overwrite VAD decision */ const int16_t force_front_vad, /* i : flag to force VAD decision */ const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ -#ifdef LOW_RATE_TRANS_CORE_CODER const int32_t ivas_total_brate /* i : IVAS total bitrate */ -#else - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const int16_t ivas_format /* i : IVAS format */ -#endif ); ivas_error pre_proc_ivas( diff --git a/lib_com/options.h b/lib_com/options.h index 5120a1bc0b..27cd0adef4 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -141,7 +141,6 @@ #define DISABLE_ADAP_RES_COD_TMP /* temporary fix for IVAS-403, disables adaptive residual coding */ /*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define LOW_RATE_TRANS_CORE_CODER /* Eri: Activate low-rate-encoding-of-transients contribution for core coder, affects MC, MASA and SBA */ #define FIX_197_CREND_INTERFACE #define FIX_329_ENABLE_TD_RENDERER_REVERB_MC /* Eri: Enable reverb for TD renderer for 5.1 and 7.1 with headtracking enabled for IVAS_dec */ #define FIX_330_ENABLE_TD_RENDERER_REVERB_REND /* Eri: Enable reverb for TD renderer for ISM, 5.1 and 7.1 with headtracking enabled for IVAS_rend */ diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index 000fbab33e..971d47c0f9 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -107,12 +107,7 @@ ivas_error pre_proc_front_ivas( const int16_t front_vad_flag, /* i : front-VAD flag to overwrite VAD decision */ const int16_t force_front_vad, /* i : flag to force VAD decision */ const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ -#ifdef LOW_RATE_TRANS_CORE_CODER const int32_t ivas_total_brate /* i : IVAS total bitrate - for setting the DTX */ -#else - const int32_t ivas_total_brate, /* i : IVAS total bitrate - for setting the DTX */ - const int16_t ivas_format /* i : IVAS format */ -#endif ) { @@ -811,11 +806,7 @@ ivas_error pre_proc_front_ivas( } } /* Switch to ACELP for non-harmonic transient signals */ -#ifdef LOW_RATE_TRANS_CORE_CODER else if ( ( ( element_mode >= IVAS_CPE_DFT && element_brate <= IVAS_16k4 ) || ( element_mode == IVAS_SCE && element_brate < SCE_SMC_THR ) ) && ( loc_harm[0] != 1 ) && smc_dec == MUSIC ) -#else - else if ( ( ( ivas_format == STEREO_FORMAT && element_brate <= IVAS_16k4 ) || ( ivas_format == ISM_FORMAT && element_brate < SCE_SMC_THR ) ) && ( loc_harm[0] != 1 ) && smc_dec == MUSIC ) -#endif { if ( element_mode == IVAS_SCE ) { diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 8339b03399..323d99ae3a 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -429,19 +429,11 @@ ivas_error ivas_cpe_enc( for ( n = 0; n < n_CoreChannels; n++ ) { -#ifdef LOW_RATE_TRANS_CORE_CODER error = pre_proc_front_ivas( NULL, hCPE, hCPE->element_brate, nb_bits_metadata, input_frame, n, old_inp_12k8[n], old_inp_16k[n], &ener[n], &relE[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], &vad_hover_flag[n], &attack_flag[n], realBuffer[n], imagBuffer[n], old_wsp[n], pitch_fr[n], voicing_fr[n], &loc_harm[n], &cor_map_sum[n], &vad_flag_dtx[n], enerBuffer[n], fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, ivas_total_brate ); -#else - error = pre_proc_front_ivas( NULL, hCPE, hCPE->element_brate, nb_bits_metadata, input_frame, n, old_inp_12k8[n], old_inp_16k[n], - &ener[n], &relE[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], - &vad_hover_flag[n], &attack_flag[n], realBuffer[n], imagBuffer[n], old_wsp[n], pitch_fr[n], voicing_fr[n], &loc_harm[n], &cor_map_sum[n], &vad_flag_dtx[n], enerBuffer[n], - fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, - ivas_total_brate, st_ivas->hEncoderConfig->ivas_format ); -#endif if ( error != IVAS_ERR_OK ) { return error; diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 85b8e0c4aa..7cfe962bc7 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -158,19 +158,11 @@ ivas_error ivas_ism_enc( * Front Pre-processing *----------------------------------------------------------------*/ -#ifdef LOW_RATE_TRANS_CORE_CODER error = pre_proc_front_ivas( hSCE, NULL, hSCE->element_brate, nb_bits_metadata[sce_id], input_frame, 0, old_inp_12k8[sce_id][0], old_inp_16k[sce_id][0], &ener[sce_id][0], &relE[sce_id][0], A[sce_id][0], Aw[sce_id][0], epsP[sce_id][0], lsp_new[sce_id][0], lsp_mid[sce_id][0], &vad_hover_flag[sce_id][0], &attack_flag[sce_id][0], realBuffer[sce_id][0], imagBuffer[sce_id][0], old_wsp[sce_id][0], pitch_fr[sce_id][0], voicing_fr[sce_id][0], &loc_harm[sce_id][0], &cor_map_sum[sce_id][0], &vad_flag_dtx[sce_id][0], enerBuffer[sce_id][0], fft_buff[sce_id][0], A[sce_id][0], lsp_new[sce_id][0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, 0, 0, 0, 0, st_ivas->hEncoderConfig->ivas_total_brate ); -#else - error = pre_proc_front_ivas( hSCE, NULL, hSCE->element_brate, nb_bits_metadata[sce_id], input_frame, 0, old_inp_12k8[sce_id][0], old_inp_16k[sce_id][0], - &ener[sce_id][0], &relE[sce_id][0], A[sce_id][0], Aw[sce_id][0], epsP[sce_id][0], lsp_new[sce_id][0], lsp_mid[sce_id][0], - &vad_hover_flag[sce_id][0], &attack_flag[sce_id][0], realBuffer[sce_id][0], imagBuffer[sce_id][0], old_wsp[sce_id][0], pitch_fr[sce_id][0], voicing_fr[sce_id][0], &loc_harm[sce_id][0], &cor_map_sum[sce_id][0], &vad_flag_dtx[sce_id][0], enerBuffer[sce_id][0], - fft_buff[sce_id][0], A[sce_id][0], lsp_new[sce_id][0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, 0, 0, 0, 0, - st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->hEncoderConfig->ivas_format ); -#endif if ( error != IVAS_ERR_OK ) { return error; diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 195fc01cf7..48bea12e53 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -180,21 +180,12 @@ ivas_error ivas_sce_enc( * Front Pre-processing *----------------------------------------------------------------*/ -#ifdef LOW_RATE_TRANS_CORE_CODER error = pre_proc_front_ivas( hSCE, NULL, hSCE->element_brate, nb_bits_metadata, input_frame, 0, old_inp_12k8[0], old_inp_16k[0], &ener[0], &relE[0], A[0], Aw[0], epsP[0], lsp_new[0], lsp_mid[0], &vad_hover_flag[0], &attack_flag[0], realBuffer[0], imagBuffer[0], old_wsp[0], pitch_fr[0], voicing_fr[0], &loc_harm[0], &cor_map_sum[0], &vad_flag_dtx[0], enerBuffer[0], fft_buff[0], A[0], lsp_new[0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, flag_16k_smc, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, st_ivas->hEncoderConfig->ivas_total_brate ); -#else - error = pre_proc_front_ivas( hSCE, NULL, hSCE->element_brate, nb_bits_metadata, input_frame, 0, old_inp_12k8[0], old_inp_16k[0], - &ener[0], &relE[0], A[0], Aw[0], epsP[0], lsp_new[0], lsp_mid[0], - &vad_hover_flag[0], &attack_flag[0], realBuffer[0], imagBuffer[0], old_wsp[0], pitch_fr[0], voicing_fr[0], &loc_harm[0], &cor_map_sum[0], &vad_flag_dtx[0], enerBuffer[0], - fft_buff[0], A[0], lsp_new[0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, flag_16k_smc, - st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, - st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->hEncoderConfig->ivas_format ); -#endif if ( error != IVAS_ERR_OK ) { return error; @@ -260,10 +251,8 @@ ivas_error ivas_sce_enc( hSCE->last_element_brate = hSCE->element_brate; -#ifdef LOW_RATE_TRANS_CORE_CODER /* Store previous attack detection flag */ st->hTranDet->transientDetector.prev_bIsAttackPresent = st->hTranDet->transientDetector.bIsAttackPresent; -#endif #ifdef DEBUG_MODE_INFO { -- GitLab From 7873f6f38c620d83f8d9f4ca0b6ec051a16cf326 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 16 Mar 2023 21:09:07 +0100 Subject: [PATCH 238/375] [cleanup] accept FIX_197_CREND_INTERFACE --- lib_com/options.h | 1 - lib_dec/ivas_binRenderer_internal.c | 4 - lib_dec/ivas_dec.c | 8 - lib_dec/ivas_init_dec.c | 20 - lib_dec/ivas_ism_dec.c | 13 - lib_dec/ivas_mct_dec.c | 28 - lib_dec/ivas_objectRenderer_internal.c | 4 - lib_dec/ivas_stat_dec.h | 5 - lib_rend/ivas_crend.c | 1341 ------------------------ lib_rend/ivas_objectRenderer.c | 24 - lib_rend/ivas_prot_rend.h | 32 - lib_rend/lib_rend.c | 178 ---- 12 files changed, 1658 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 27cd0adef4..c7b6ebec04 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -141,7 +141,6 @@ #define DISABLE_ADAP_RES_COD_TMP /* temporary fix for IVAS-403, disables adaptive residual coding */ /*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define FIX_197_CREND_INTERFACE #define FIX_329_ENABLE_TD_RENDERER_REVERB_MC /* Eri: Enable reverb for TD renderer for 5.1 and 7.1 with headtracking enabled for IVAS_dec */ #define FIX_330_ENABLE_TD_RENDERER_REVERB_REND /* Eri: Enable reverb for TD renderer for ISM, 5.1 and 7.1 with headtracking enabled for IVAS_rend */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 9fcb85ac0c..a0cd77d987 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -866,7 +866,6 @@ void ivas_binaural_add_LFE( if ( render_lfe ) { -#ifdef FIX_197_CREND_INTERFACE #ifdef FIX_329_ENABLE_TD_RENDERER_REVERB_MC if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { @@ -878,9 +877,6 @@ void ivas_binaural_add_LFE( } #else gain = ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hHrtfCrend != NULL ) ) ? st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe : GAIN_LFE; -#endif -#else - gain = st_ivas->hHrtf != NULL ? st_ivas->hHrtf->gain_lfe : GAIN_LFE; #endif for ( idx_lfe = 0; idx_lfe < st_ivas->hIntSetup.num_lfe; idx_lfe++ ) { diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index ca4666ae76..38486a340b 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -222,14 +222,10 @@ ivas_error ivas_dec( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { -#ifdef FIX_197_CREND_INTERFACE if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM, NULL, NULL, NULL, NULL, output, output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#else - ivas_crend_process( st_ivas, output ); -#endif ivas_binaural_add_LFE( st_ivas, output_frame, output ); } #ifdef DEBUGGING @@ -433,14 +429,10 @@ ivas_error ivas_dec( /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { -#ifdef FIX_197_CREND_INTERFACE if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hHeadTrackData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, output, output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#else - ivas_crend_process( st_ivas, output ); -#endif ivas_binaural_add_LFE( st_ivas, output_frame, output ); } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index e6c5f28a21..83cd4f471b 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1228,7 +1228,6 @@ ivas_error ivas_init_decoder( return error; } #else -#ifdef FIX_197_CREND_INTERFACE #ifdef FIX_329_ENABLE_TD_RENDERER_REVERB_MC if ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper ) ) != IVAS_ERR_OK ) #else @@ -1237,9 +1236,6 @@ ivas_error ivas_init_decoder( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); } if ( ( st_ivas->hCrendWrapper->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) -#endif -#else - if ( ( st_ivas->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) #endif { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); @@ -1263,7 +1259,6 @@ ivas_error ivas_init_decoder( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { -#ifdef FIX_197_CREND_INTERFACE if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->ivas_format == MC_FORMAT && st_ivas->hDecoderConfig->Opt_Headrotation ) { if ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth, st_ivas->hIntSetup.ls_elevation, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) @@ -1279,12 +1274,6 @@ ivas_error ivas_init_decoder( } st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; -#else - if ( ivas_crend_open( st_ivas ) != IVAS_ERR_OK ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "ivas_crend_open failed" ); - } -#endif } if ( st_ivas->ivas_format == ISM_FORMAT && @@ -1590,14 +1579,9 @@ void ivas_initialize_handles_dec( st_ivas->hIsmRendererData = NULL; st_ivas->hBinRendererTd = NULL; st_ivas->hMonoDmxRenderer = NULL; -#ifdef FIX_197_CREND_INTERFACE st_ivas->hCrendWrapper = NULL; #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND st_ivas->hReverb = NULL; -#endif -#else - st_ivas->hCrend = NULL; - st_ivas->hHrtf = NULL; #endif st_ivas->hSetOfHRTF = NULL; st_ivas->hHrtfFastConv = NULL; @@ -1756,11 +1740,7 @@ void ivas_destroy_dec( ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); /* Crend handle */ -#ifdef FIX_197_CREND_INTERFACE ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); -#else - ivas_crend_close( st_ivas ); -#endif #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND /* Reverb handle */ ivas_reverb_close( &st_ivas->hReverb ); diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 0bda9f5ae0..6babce65b4 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -151,7 +151,6 @@ static ivas_error ivas_ism_bitrate_switching( ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); /* Open Crend Binaural renderer */ -#ifdef FIX_197_CREND_INTERFACE if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, @@ -164,9 +163,6 @@ static ivas_error ivas_ism_bitrate_switching( } st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; -#else - ivas_crend_open( st_ivas ); -#endif } } @@ -227,16 +223,7 @@ static ivas_error ivas_ism_bitrate_switching( } /* close the crend binaural renderer */ -#ifdef FIX_197_CREND_INTERFACE ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); -#else - ivas_crend_close( st_ivas ); - - if ( st_ivas->hHrtf != NULL ) - { - st_ivas->hHrtf = NULL; - } -#endif } } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 332455974c..9107453f35 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1070,17 +1070,9 @@ static ivas_error ivas_mc_dec_reconfig( ivas_binRenderer_close( &st_ivas->hBinRenderer ); } -#ifdef FIX_197_CREND_INTERFACE if ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend != NULL ) && ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD || st_ivas->hRenderConfig->roomAcoustics.late_reverb_on == 0 ) ) ) -#else - if ( st_ivas->hCrend != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD || st_ivas->hRenderConfig->roomAcoustics.late_reverb_on == 0 ) ) ) -#endif { -#ifdef FIX_197_CREND_INTERFACE ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); -#else - ivas_crend_close( st_ivas ); -#endif } if ( st_ivas->hBinRendererTd != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) ) @@ -1136,7 +1128,6 @@ static ivas_error ivas_mc_dec_reconfig( return error; } -#ifdef FIX_197_CREND_INTERFACE if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) { #ifdef FIX_329_ENABLE_TD_RENDERER_REVERB_MC @@ -1156,17 +1147,7 @@ static ivas_error ivas_mc_dec_reconfig( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); } } -#else - if ( st_ivas->hCrend == NULL && st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) - { - if ( ( st_ivas->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); - } - } -#endif } -#ifdef FIX_197_CREND_INTERFACE else if ( st_ivas->hCrendWrapper == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) { if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), @@ -1180,15 +1161,6 @@ static ivas_error ivas_mc_dec_reconfig( } st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; } -#else - else if ( st_ivas->hCrend == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) - { - if ( ivas_crend_open( st_ivas ) != IVAS_ERR_OK ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "ivas_crend_open failed" ); - } - } -#endif } /* mono/stereo */ else if ( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 8780b4ea98..d42578017f 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -76,11 +76,7 @@ ivas_error ivas_td_binaural_renderer( st_ivas->hReverb, #else st_ivas->hRenderConfig, st_ivas->ini_frame, -#ifdef FIX_197_CREND_INTERFACE st_ivas->hCrendWrapper, -#else - st_ivas->hCrend, -#endif #endif st_ivas->transport_config, #ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 4157438f80..70a3805cfc 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1238,14 +1238,9 @@ typedef struct Decoder_Struct EFAP_HANDLE hEFAPdata; /* EFAP structure */ VBAP_HANDLE hVBAPdata; /* VBAP structure */ MONO_DOWNMIX_RENDERER_HANDLE hMonoDmxRenderer; /* Mono downmix structure */ -#ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE hCrendWrapper; #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND REVERB_HANDLE hReverb; /* Reverb handle */ -#endif -#else - CREND_HANDLE hCrend; /* Convolution mixer renderer structure */ - HRTFS_HANDLE hHrtf; /* HRTFs handle */ #endif HRTFS_CREND_HANDLE hSetOfHRTF; /* Set of HRTFs handle (CRend) */ HRTFS_FASTCONV_HANDLE hHrtfFastConv; /* FASTCONV HRTF tables for binaural rendering */ diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index caf9a562d5..4da404e721 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -148,1222 +148,11 @@ static ivas_error ivas_hrtf_close( } -#ifndef FIX_197_CREND_INTERFACE -/*------------------------------------------------------------------------- - * ivas_crend_init_from_rom() - * - * Allocate and initialize crend renderer handle - *------------------------------------------------------------------------*/ - -ivas_error ivas_crend_init_from_rom( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -{ - int16_t i, j, tmp; - int32_t output_Fs; - AUDIO_CONFIG intern_config; - HRTFS_HANDLE hHrtf; - -#ifdef FIX_197_CREND_INTERFACE - hHrtf = st_ivas->hCrendWrapper->hHrtfCrend; -#else - hHrtf = st_ivas->hHrtf; -#endif - - output_Fs = st_ivas->hDecoderConfig->output_Fs; - - intern_config = st_ivas->intern_config; - - if ( intern_config == AUDIO_CONFIG_BINAURAL || intern_config == AUDIO_CONFIG_BINAURAL_ROOM ) - { - return IVAS_ERR_INTERNAL_FATAL; - } - - if ( hHrtf == NULL ) - { - if ( ivas_hrtf_open( &hHrtf ) != IVAS_ERR_OK ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for HRTF handle" ); - } - } - - hHrtf->max_num_ir = audioCfg2channels( intern_config ); - - if ( hHrtf->max_num_ir <= 0 ) - { - return IVAS_ERR_INTERNAL_FATAL; - } - - /* Do all error checks up front so that the nested if later is easier */ - if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Encountered unsupported renderer type" ); - } - - if ( intern_config != AUDIO_CONFIG_5_1 && intern_config != AUDIO_CONFIG_5_1_2 && intern_config != AUDIO_CONFIG_5_1_4 && - intern_config != AUDIO_CONFIG_7_1 && intern_config != AUDIO_CONFIG_7_1_4 && - intern_config != AUDIO_CONFIG_FOA && intern_config != AUDIO_CONFIG_HOA2 && intern_config != AUDIO_CONFIG_HOA3 ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Encountered unsupported transport config in Crend" ); - } - - if ( ( ( st_ivas->hRenderConfig != NULL ) && !st_ivas->hRenderConfig->roomAcoustics.use_brir ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV ) ) - { - if ( intern_config == AUDIO_CONFIG_5_1 || intern_config == AUDIO_CONFIG_5_1_2 || intern_config == AUDIO_CONFIG_5_1_4 || - intern_config == AUDIO_CONFIG_7_1 || intern_config == AUDIO_CONFIG_7_1_4 ) - { - hHrtf->max_num_ir -= 1; /* subtract LFE */ - hHrtf->gain_lfe = GAIN_LFE; - - if ( output_Fs == 48000 ) - { - hHrtf->latency_s = CRendBin_Combined_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_Combined_HRIR_max_num_iterations_48kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_Combined_HRIR_index_frequency_max_diffuse_48kHz; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_HRIR_num_iterations_diffuse_48kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_48kHz[j]; - } - } - else if ( output_Fs == 32000 ) - { - hHrtf->latency_s = CRendBin_Combined_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_Combined_HRIR_max_num_iterations_32kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_Combined_HRIR_index_frequency_max_diffuse_32kHz; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_HRIR_num_iterations_diffuse_32kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_32kHz[j]; - } - } - else if ( output_Fs == 16000 ) - { - hHrtf->latency_s = CRendBin_Combined_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_Combined_HRIR_max_num_iterations_16kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_Combined_HRIR_index_frequency_max_diffuse_16kHz; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_HRIR_num_iterations_diffuse_16kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_16kHz[j]; - } - } - else - { - return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); - } - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - if ( intern_config == AUDIO_CONFIG_5_1 ) - { - tmp = channelIndex_CICP6[i]; - } - else if ( intern_config == AUDIO_CONFIG_7_1 ) - { - tmp = channelIndex_CICP12[i]; - } - else if ( intern_config == AUDIO_CONFIG_5_1_2 ) - { - tmp = channelIndex_CICP14[i]; - } - else if ( intern_config == AUDIO_CONFIG_5_1_4 ) - { - tmp = channelIndex_CICP16[i]; - } - else if ( intern_config == AUDIO_CONFIG_7_1_4 ) - { - tmp = channelIndex_CICP19[i]; - } - else - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Channel configuration not specified!\n\n" ); - } - - if ( output_Fs == 48000 ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_HRIR_inv_diffuse_weight_48kHz[tmp]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_48kHz[tmp][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_48kHz[tmp][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_48kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_HRIR_coeff_im_48kHz[tmp][j]; - } - } - else if ( output_Fs == 32000 ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_HRIR_inv_diffuse_weight_32kHz[tmp]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_32kHz[tmp][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_32kHz[tmp][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_32kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_HRIR_coeff_im_32kHz[tmp][j]; - } - } - else if ( output_Fs == 16000 ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_HRIR_inv_diffuse_weight_16kHz[tmp]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_16kHz[tmp][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_16kHz[tmp][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_16kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_HRIR_coeff_im_16kHz[tmp][j]; - } - } - else - { - return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); - } - } - } - else if ( intern_config == AUDIO_CONFIG_FOA || intern_config == AUDIO_CONFIG_HOA2 || intern_config == AUDIO_CONFIG_HOA3 ) - { - if ( output_Fs == 48000 ) - { - hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_48kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_48kHz; - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz[i]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_48kHz[i][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[i][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_48kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_48kHz[i][j]; - } - } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_48kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_48kHz[j]; - } - } - else if ( output_Fs == 32000 ) - { - hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_32kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_32kHz; - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz[i]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_32kHz[i][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[i][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_32kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_32kHz[i][j]; - } - } - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_32kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_32kHz[j]; - } - } - else if ( output_Fs == 16000 ) - { - hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_16kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_16kHz; - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz[i]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_16kHz[i][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[i][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_16kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_16kHz[i][j]; - } - } - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_16kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz[j]; - } - } - else - { - return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); - } - } - } - else if ( ( ( st_ivas->hRenderConfig != NULL ) && st_ivas->hRenderConfig->roomAcoustics.use_brir ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) - { - if ( intern_config == AUDIO_CONFIG_5_1 || intern_config == AUDIO_CONFIG_5_1_2 || intern_config == AUDIO_CONFIG_5_1_4 || - intern_config == AUDIO_CONFIG_7_1 || intern_config == AUDIO_CONFIG_7_1_4 ) - { - hHrtf->max_num_ir -= 1; /* subtract LFE */ - hHrtf->gain_lfe = GAIN_LFE; - - if ( output_Fs == 48000 ) - { - hHrtf->latency_s = CRendBin_Combined_BRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_Combined_BRIR_max_num_iterations_48kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_Combined_BRIR_index_frequency_max_diffuse_48kHz; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_48kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_48kHz[j]; - } - } - else if ( output_Fs == 32000 ) - { - hHrtf->latency_s = CRendBin_Combined_BRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_Combined_BRIR_max_num_iterations_32kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_Combined_BRIR_index_frequency_max_diffuse_32kHz; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_32kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_32kHz[j]; - } - } - else if ( output_Fs == 16000 ) - { - hHrtf->latency_s = CRendBin_Combined_BRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_Combined_BRIR_max_num_iterations_16kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_Combined_BRIR_index_frequency_max_diffuse_16kHz; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_16kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_16kHz[j]; - } - } - else - { - return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); - } - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - if ( intern_config == AUDIO_CONFIG_5_1 ) - { - tmp = channelIndex_CICP6[i]; - } - else if ( intern_config == AUDIO_CONFIG_7_1 ) - { - tmp = channelIndex_CICP12[i]; - } - else if ( intern_config == AUDIO_CONFIG_5_1_2 ) - { - tmp = channelIndex_CICP14[i]; - } - else if ( intern_config == AUDIO_CONFIG_5_1_4 ) - { - tmp = channelIndex_CICP16[i]; - } - else if ( intern_config == AUDIO_CONFIG_7_1_4 ) - { - tmp = channelIndex_CICP19[i]; - } - else - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Channel configuration not specified!\n\n" ); - } - - if ( output_Fs == 48000 ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz[tmp]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_48kHz[tmp][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[tmp][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_48kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_BRIR_coeff_im_48kHz[tmp][j]; - } - } - else if ( output_Fs == 32000 ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz[tmp]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_32kHz[tmp][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[tmp][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_32kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_BRIR_coeff_im_32kHz[tmp][j]; - } - } - else if ( output_Fs == 16000 ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz[tmp]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_16kHz[tmp][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[tmp][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_16kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_BRIR_coeff_im_16kHz[tmp][j]; - } - } - else - { - return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); - } - } - } - else if ( intern_config == AUDIO_CONFIG_FOA || intern_config == AUDIO_CONFIG_HOA2 || intern_config == AUDIO_CONFIG_HOA3 ) - { - if ( output_Fs == 48000 ) - { - hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_48kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_48kHz; - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz[i]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_48kHz[i][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[i][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_48kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_48kHz[i][j]; - } - } - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_48kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_48kHz[j]; - } - } - else if ( output_Fs == 32000 ) - { - hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_32kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_32kHz; - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz[i]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_32kHz[i][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[i][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_32kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_32kHz[i][j]; - } - } - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_32kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_32kHz[j]; - } - } - else if ( output_Fs == 16000 ) - { - hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_16kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_16kHz; - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz[i]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_16kHz[i][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[i][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_16kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_16kHz[i][j]; - } - } - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_16kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz[j]; - } - } - else - { - return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); - } - } - else - { - return IVAS_ERROR( IVAS_ERR_INTERNAL, "Unsupported intern_config type in Crend" ); - } - } - else - { - return IVAS_ERROR( IVAS_ERR_INTERNAL, "Unsupported renderer type in Crend" ); - } - -#ifdef FIX_197_CREND_INTERFACE - st_ivas->hCrendWrapper->hHrtfCrend = hHrtf; -#else - st_ivas->hHrtf = hHrtf; -#endif - - return IVAS_ERR_OK; -} -#endif - -#ifndef FIX_197_CREND_INTERFACE -/*------------------------------------------------------------------------- - * ivas_crend_init_from_hrtf_handle() - * - * Allocate and initialize Crend HRTF handle from external file - *------------------------------------------------------------------------*/ - -ivas_error ivas_crend_init_from_hrtf_handle( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - HRTFS_HANDLE hrtf ) -{ - int16_t i, j, as_lfe_filter; - const int16_t *hchannelIndex = NULL; - AUDIO_CONFIG transport_config; - - if ( st_ivas == NULL ) - { - return IVAS_ERR_INTERNAL; - } - - if ( hrtf == NULL ) - { - return IVAS_ERR_INVALID_HRTF; - } - - if ( st_ivas->hHrtf != NULL ) - { - ivas_hrtf_close( &st_ivas->hHrtf ); - } - - if ( ivas_hrtf_open( &( st_ivas->hHrtf ) ) != IVAS_ERR_OK ) - { - return IVAS_ERR_INTERNAL; - } - - if ( st_ivas->hHrtf != NULL ) - { - st_ivas->hHrtf->latency_s = hrtf->latency_s; - // st_ivas->hHrtf->max_num_ir->max_ir_len = hrtf->max_ir_len; - st_ivas->hHrtf->max_num_iterations = hrtf->max_num_iterations; - st_ivas->hHrtf->gain_lfe = hrtf->gain_lfe; - // st_ivas->hHrtf->crend_hr_gain_foa_to_bin = hrtf->crend_hr_gain_foa_to_bin; - st_ivas->hHrtf->max_num_ir = 0; - st_ivas->hIntSetup.nchan_out_woLFE = 0; - st_ivas->hIntSetup.num_lfe = 0; - st_ivas->hIntSetup.nchan_out_woLFE = 0; - - transport_config = st_ivas->intern_config == AUDIO_CONFIG_INVALID ? st_ivas->transport_config : st_ivas->intern_config; - - switch ( transport_config ) - { - case AUDIO_CONFIG_5_1: - st_ivas->hHrtf->max_num_ir = 5; - st_ivas->hHrtf->gain_lfe = GAIN_LFE; - st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->hHrtf->max_num_ir; - st_ivas->hIntSetup.num_lfe = 1; - hchannelIndex = (const int16_t *) &channelIndex_CICP6; - break; - case AUDIO_CONFIG_7_1: - st_ivas->hHrtf->max_num_ir = 7; - st_ivas->hHrtf->gain_lfe = GAIN_LFE; - st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->hHrtf->max_num_ir; - st_ivas->hIntSetup.num_lfe = 1; - hchannelIndex = (const int16_t *) &channelIndex_CICP12; - break; - case AUDIO_CONFIG_5_1_2: - st_ivas->hHrtf->max_num_ir = 7; - st_ivas->hHrtf->gain_lfe = GAIN_LFE; - st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->hHrtf->max_num_ir; - st_ivas->hIntSetup.num_lfe = 1; - hchannelIndex = (const int16_t *) &channelIndex_CICP14; - break; - case AUDIO_CONFIG_5_1_4: - st_ivas->hHrtf->max_num_ir = 9; - st_ivas->hHrtf->gain_lfe = GAIN_LFE; - st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->hHrtf->max_num_ir; - st_ivas->hIntSetup.num_lfe = 1; - hchannelIndex = (const int16_t *) &channelIndex_CICP16; - break; - case AUDIO_CONFIG_7_1_4: - st_ivas->hHrtf->max_num_ir = 11; - st_ivas->hHrtf->gain_lfe = GAIN_LFE; - st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->hHrtf->max_num_ir; - st_ivas->hIntSetup.num_lfe = 1; - hchannelIndex = (const int16_t *) &channelIndex_CICP19; - break; - case AUDIO_CONFIG_FOA: - st_ivas->hIntSetup.ambisonics_order = 1; - st_ivas->hHrtf->max_num_ir = 4; - break; - case AUDIO_CONFIG_HOA2: - st_ivas->hIntSetup.ambisonics_order = 2; - st_ivas->hHrtf->max_num_ir = 9; - break; - case AUDIO_CONFIG_HOA3: - st_ivas->hIntSetup.ambisonics_order = 3; - st_ivas->hHrtf->max_num_ir = 16; - break; - default: - break; - } - - as_lfe_filter = 0; - if ( ( st_ivas->hHrtf->max_num_ir != hrtf->max_num_ir ) && ( st_ivas->hHrtf->max_num_ir + 1 == hrtf->max_num_ir ) ) - { - as_lfe_filter = 1; - hchannelIndex = NULL; - } - - if ( st_ivas->hHrtf->max_num_ir == 0 ) - { - return IVAS_ERR_INTERNAL; - } - - for ( i = 0; i < st_ivas->hHrtf->max_num_ir; i++ ) - { - int16_t tmp = i; - if ( hchannelIndex != NULL ) - { - tmp = hchannelIndex[i]; - } - if ( as_lfe_filter ) - { - if ( tmp > 2 ) - { - tmp++; - } - } - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - st_ivas->hHrtf->pOut_to_bin_re[i][j] = hrtf->pOut_to_bin_re[tmp][j]; - st_ivas->hHrtf->pOut_to_bin_im[i][j] = hrtf->pOut_to_bin_im[tmp][j]; - st_ivas->hHrtf->num_iterations[i][j] = hrtf->num_iterations[tmp][j]; - st_ivas->hHrtf->pIndex_frequency_max[i][j] = hrtf->pIndex_frequency_max[tmp][j]; - } - st_ivas->hHrtf->inv_diffuse_weight[i] = hrtf->inv_diffuse_weight[tmp]; - } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - st_ivas->hHrtf->pOut_to_bin_diffuse_re[j] = hrtf->pOut_to_bin_diffuse_re[j]; - st_ivas->hHrtf->pOut_to_bin_diffuse_im[j] = hrtf->pOut_to_bin_diffuse_im[j]; - st_ivas->hHrtf->num_iterations_diffuse[j] = hrtf->num_iterations_diffuse[j]; - st_ivas->hHrtf->pIndex_frequency_max_diffuse[j] = hrtf->pIndex_frequency_max_diffuse[j]; - } - st_ivas->hHrtf->index_frequency_max_diffuse = hrtf->index_frequency_max_diffuse; - } - return IVAS_ERR_OK; -} - -/*------------------------------------------------------------------------- - * ivas_crend_init_from_setofhrtf() - * - * Allocate and initialize crend renderer handle - *------------------------------------------------------------------------*/ - -ivas_error ivas_crend_init_from_setofhrtf( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -{ - ivas_error error; - AUDIO_CONFIG transport_config; - - transport_config = st_ivas->intern_config == AUDIO_CONFIG_INVALID ? st_ivas->transport_config : st_ivas->intern_config; - switch ( transport_config ) - { - case AUDIO_CONFIG_5_1: - case AUDIO_CONFIG_5_1_2: - case AUDIO_CONFIG_5_1_4: - case AUDIO_CONFIG_7_1: - case AUDIO_CONFIG_7_1_4: - if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) - { - if ( ( error = ivas_crend_init_from_hrtf_handle( st_ivas, st_ivas->hSetOfHRTF->hHRTF_brir_combined ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - if ( ( error = ivas_crend_init_from_hrtf_handle( st_ivas, st_ivas->hSetOfHRTF->hHRTF_hrir_combined ) ) != IVAS_ERR_OK ) - { - return error; - } - } - break; - case AUDIO_CONFIG_FOA: - case AUDIO_CONFIG_HOA2: - case AUDIO_CONFIG_HOA3: - if ( ( error = ivas_crend_init_from_hrtf_handle( st_ivas, st_ivas->hSetOfHRTF->hHRTF_hrir_hoa3 ) ) != IVAS_ERR_OK ) - { - return error; - } - break; - default: - return IVAS_ERR_INTERNAL; - } - - return IVAS_ERR_OK; -} - -#endif - -#ifndef FIX_197_CREND_INTERFACE -/*------------------------------------------------------------------------- - * ivas_crend_open() - * - * Allocate and initialize Crend renderer handle - *------------------------------------------------------------------------*/ - -ivas_error ivas_crend_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -{ - int16_t i, subframe_length; - int16_t max_total_ir_len; - HRTFS_HANDLE hHrtf; - CREND_HANDLE hCrend; - ivas_error error; - - error = IVAS_ERR_OK; - subframe_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES; - - if ( ( st_ivas->hHrtf == NULL ) && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) - { - if ( st_ivas->hSetOfHRTF != NULL ) - { - if ( ( error = ivas_crend_init_from_setofhrtf( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - if ( ( error = ivas_crend_init_from_rom( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - - if ( ( hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer handle" ); - } - - hCrend->lfe_delay_line = NULL; - - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) - { - hCrend->freq_buffer_re[i] = NULL; - hCrend->freq_buffer_im[i] = NULL; - } - - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - hCrend->prev_out_buffer[i] = NULL; - } - - hCrend->freq_buffer_re_diffuse = NULL; - hCrend->freq_buffer_im_diffuse = NULL; - hCrend->hReverb = NULL; - hCrend->delay_line_rw_index = 0; - hCrend->diffuse_delay_line_rw_index = 0; - hCrend->hTrack = NULL; - hCrend->m_fYaw = 0; - hCrend->m_fPitch = 0; - hCrend->m_fRoll = 0; - - hHrtf = st_ivas->hHrtf; - - if ( ( hHrtf != NULL ) && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) - { - max_total_ir_len = hHrtf->max_num_iterations * subframe_length; - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - if ( ( hCrend->freq_buffer_re[i] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_f( hCrend->freq_buffer_re[i], 0, max_total_ir_len ); - - if ( ( hCrend->freq_buffer_im[i] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_f( hCrend->freq_buffer_im[i], 0, max_total_ir_len ); - } - - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - if ( ( hCrend->prev_out_buffer[i] = (float *) malloc( sizeof( float ) * subframe_length ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_f( hCrend->prev_out_buffer[i], 0, subframe_length ); - } - - max_total_ir_len = hHrtf->num_iterations_diffuse[0] * subframe_length; - - if ( max_total_ir_len > 0 ) - { - if ( ( hCrend->freq_buffer_re_diffuse = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_f( hCrend->freq_buffer_re_diffuse, 0, max_total_ir_len ); - - if ( ( hCrend->freq_buffer_im_diffuse = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_f( hCrend->freq_buffer_im_diffuse, 0, max_total_ir_len ); - } - else - { - hCrend->freq_buffer_re_diffuse = NULL; - hCrend->freq_buffer_im_diffuse = NULL; - } - - max_total_ir_len = (int16_t) ( hHrtf->latency_s * st_ivas->hDecoderConfig->output_Fs + 0.5f ) + subframe_length; - if ( max_total_ir_len > 0 ) - { - if ( ( hCrend->lfe_delay_line = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_f( hCrend->lfe_delay_line, 0, max_total_ir_len ); - } - else - { - hCrend->lfe_delay_line = NULL; - } - - if ( st_ivas->hDecoderConfig->Opt_Headrotation ) - { - if ( ( hCrend->hTrack = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); - } - - ivas_orient_trk_Init( hCrend->hTrack ); - } - else - { - hCrend->hTrack = NULL; - } - - if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->ivas_format == MC_FORMAT && st_ivas->hDecoderConfig->Opt_Headrotation ) - { - if ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth, st_ivas->hIntSetup.ls_elevation, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( ( st_ivas->hRenderConfig != NULL ) && st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) ) - { - if ( ( error = ivas_reverb_open( &( hCrend->hReverb ), st_ivas->intern_config, hHrtf, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - hCrend->hReverb = NULL; - } - - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtf->latency_s * 1000000000.f ); - } - - st_ivas->hCrend = hCrend; - - return error; -} -#endif - -#ifndef FIX_197_CREND_INTERFACE - -/*------------------------------------------------------------------------- - * ivas_crend_close() - * - * Deallocate Crend renderer handle - *------------------------------------------------------------------------*/ - -ivas_error ivas_crend_close( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -{ - int16_t i; - - if ( st_ivas->hHrtf != NULL ) - { - ivas_hrtf_close( &st_ivas->hHrtf ); - } - - if ( st_ivas->hCrend != NULL ) - { - if ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) - { - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) - { - if ( st_ivas->hCrend->freq_buffer_re[i] != NULL ) - { - free( st_ivas->hCrend->freq_buffer_re[i] ); - st_ivas->hCrend->freq_buffer_re[i] = NULL; - } - if ( st_ivas->hCrend->freq_buffer_im[i] != NULL ) - { - free( st_ivas->hCrend->freq_buffer_im[i] ); - st_ivas->hCrend->freq_buffer_im[i] = NULL; - } - } - - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - if ( st_ivas->hCrend->prev_out_buffer[i] != NULL ) - { - free( st_ivas->hCrend->prev_out_buffer[i] ); - st_ivas->hCrend->prev_out_buffer[i] = NULL; - } - } - - if ( st_ivas->hCrend->lfe_delay_line != NULL ) - { - free( st_ivas->hCrend->lfe_delay_line ); - st_ivas->hCrend->lfe_delay_line = NULL; - } - - if ( st_ivas->hCrend->freq_buffer_re_diffuse != NULL ) - { - free( st_ivas->hCrend->freq_buffer_re_diffuse ); - st_ivas->hCrend->freq_buffer_re_diffuse = NULL; - } - - if ( st_ivas->hCrend->freq_buffer_im_diffuse != NULL ) - { - free( st_ivas->hCrend->freq_buffer_im_diffuse ); - st_ivas->hCrend->freq_buffer_im_diffuse = NULL; - } - - if ( st_ivas->hCrend->hTrack != NULL ) - { - free( st_ivas->hCrend->hTrack ); - st_ivas->hCrend->hTrack = NULL; - } - } - - ivas_reverb_close( &st_ivas->hCrend->hReverb ); - - free( st_ivas->hCrend ); - st_ivas->hCrend = NULL; - } - - return IVAS_ERR_OK; -} -#endif - -#ifndef FIX_197_CREND_INTERFACE - -/*-----------------------------------------------------------------------------------------* - * Function ivas_crend_convolver() - * - * Convolver block - *-----------------------------------------------------------------------------------------*/ - -static ivas_error ivas_crend_convolver( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float pcm_in[][L_FRAME48k], - float pcm_out[][L_FRAME48k], - const int16_t i_ts ) -{ - float *pIn; - float *pFreq_buf_re; - float *pFreq_buf_im; - float *pFreq_filt_re; - float *pFreq_filt_im; - int16_t i, j, k, m, nchan_out, subframe_length, nchan_intern, idx_in; - float pOut[L_FRAME48k * 2]; - float tmp_out_re[L_FRAME48k], tmp_out_im[L_FRAME48k]; - int16_t offset, offset_in, offset_diffuse; - int32_t output_Fs; - - nchan_intern = audioCfg2channels( st_ivas->intern_config ); - nchan_out = st_ivas->hDecoderConfig->nchan_out; - output_Fs = st_ivas->hDecoderConfig->output_Fs; - subframe_length = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES; - - offset = st_ivas->hCrend->delay_line_rw_index * subframe_length; /* subframe_length * ( st_ivas->hHrtf->max_num_iterations - 1 ); */ - offset_diffuse = st_ivas->hCrend->diffuse_delay_line_rw_index * subframe_length; /* subframe_length *( st_ivas->hHrtf->num_iterations_diffuse[0] - 1 ); */ - - if ( st_ivas->hHrtf->num_iterations_diffuse[0] > 0 ) - { - set_zero( &st_ivas->hCrend->freq_buffer_re_diffuse[offset_diffuse], subframe_length ); - set_zero( &st_ivas->hCrend->freq_buffer_im_diffuse[offset_diffuse], subframe_length ); - } - - i = 0; - for ( idx_in = 0; idx_in < nchan_intern; idx_in++ ) - { - pIn = &pcm_in[idx_in][i_ts * subframe_length]; - if ( st_ivas->hIntSetup.index_lfe[0] != idx_in ) - { - if ( st_ivas->hHrtf->num_iterations_diffuse[0] > 0 ) - { - pFreq_buf_re = &st_ivas->hCrend->freq_buffer_re_diffuse[offset_diffuse]; - pFreq_buf_im = &st_ivas->hCrend->freq_buffer_im_diffuse[offset_diffuse]; - pFreq_filt_re = &st_ivas->hCrend->freq_buffer_re[i][offset]; - pFreq_filt_im = &st_ivas->hCrend->freq_buffer_im[i][offset]; - - for ( k = 0; k < st_ivas->hHrtf->index_frequency_max_diffuse; k++ ) - { - pFreq_buf_re[k] += pFreq_filt_re[k] * st_ivas->hHrtf->inv_diffuse_weight[i]; - pFreq_buf_im[k] += pFreq_filt_im[k] * st_ivas->hHrtf->inv_diffuse_weight[i]; - } - } - - pFreq_buf_re = &st_ivas->hCrend->freq_buffer_re[i][offset]; - pFreq_buf_im = &st_ivas->hCrend->freq_buffer_im[i][offset]; - - ivas_mdft( pIn, pFreq_buf_re, pFreq_buf_im, subframe_length, subframe_length ); - i++; - } - } - - for ( j = 0; j < nchan_out; j++ ) - { - set_zero( tmp_out_re, subframe_length ); - set_zero( tmp_out_im, subframe_length ); - - i = 0; - for ( idx_in = 0; idx_in < nchan_intern; idx_in++ ) - { - if ( idx_in != st_ivas->hIntSetup.index_lfe[0] ) - { - offset = 0; - for ( m = 0; m < st_ivas->hHrtf->num_iterations[i][j]; m++ ) - { - offset_in = ( st_ivas->hCrend->delay_line_rw_index + st_ivas->hHrtf->max_num_iterations - st_ivas->hHrtf->num_iterations[i][j] + m + 1 ); - offset_in = offset_in % ( st_ivas->hHrtf->max_num_iterations ); - offset_in = offset_in * subframe_length; - pFreq_buf_re = &st_ivas->hCrend->freq_buffer_re[i][offset_in]; - pFreq_buf_im = &st_ivas->hCrend->freq_buffer_im[i][offset_in]; - pFreq_filt_re = &st_ivas->hHrtf->pOut_to_bin_re[i][j][offset]; - pFreq_filt_im = &st_ivas->hHrtf->pOut_to_bin_im[i][j][offset]; - - for ( k = 0; k < st_ivas->hHrtf->pIndex_frequency_max[i][j][m]; k++ ) - { - tmp_out_re[k] += pFreq_buf_re[k] * pFreq_filt_re[k] - pFreq_buf_im[k] * pFreq_filt_im[k]; - tmp_out_im[k] += pFreq_buf_re[k] * pFreq_filt_im[k] + pFreq_buf_im[k] * pFreq_filt_re[k]; - } - offset = offset + k; - } - i++; - } - } - - offset = 0; - for ( m = 0; m < st_ivas->hHrtf->num_iterations_diffuse[j]; m++ ) - { - offset_diffuse = ( st_ivas->hCrend->diffuse_delay_line_rw_index + m + 1 ); - offset_diffuse = offset_diffuse % st_ivas->hHrtf->num_iterations_diffuse[0]; - offset_diffuse = offset_diffuse * subframe_length; - pFreq_buf_re = &st_ivas->hCrend->freq_buffer_re_diffuse[offset_diffuse]; - pFreq_buf_im = &st_ivas->hCrend->freq_buffer_im_diffuse[offset_diffuse]; - pFreq_filt_re = &st_ivas->hHrtf->pOut_to_bin_diffuse_re[j][offset]; - pFreq_filt_im = &st_ivas->hHrtf->pOut_to_bin_diffuse_im[j][offset]; - - for ( k = 0; k < st_ivas->hHrtf->pIndex_frequency_max_diffuse[j][m]; k++ ) - { - tmp_out_re[k] += pFreq_buf_re[k] * pFreq_filt_re[k] - pFreq_buf_im[k] * pFreq_filt_im[k]; - tmp_out_im[k] += pFreq_buf_re[k] * pFreq_filt_im[k] + pFreq_buf_im[k] * pFreq_filt_re[k]; - } - offset = offset + k; - } - - ivas_imdft( tmp_out_re, tmp_out_im, pOut, subframe_length ); - - pFreq_buf_re = &pcm_out[j][i_ts * subframe_length]; - for ( k = 0; k < subframe_length; k++ ) - { - pFreq_buf_re[k] = pOut[k] + st_ivas->hCrend->prev_out_buffer[j][k]; - st_ivas->hCrend->prev_out_buffer[j][k] = pOut[k + subframe_length]; - } - } - - st_ivas->hCrend->delay_line_rw_index++; - st_ivas->hCrend->delay_line_rw_index = st_ivas->hCrend->delay_line_rw_index % ( st_ivas->hHrtf->max_num_iterations ); - if ( st_ivas->hHrtf->num_iterations_diffuse[0] > 0 ) - { - st_ivas->hCrend->diffuse_delay_line_rw_index++; - st_ivas->hCrend->diffuse_delay_line_rw_index = st_ivas->hCrend->diffuse_delay_line_rw_index % ( st_ivas->hHrtf->num_iterations_diffuse[0] ); - } - - return IVAS_ERR_OK; -} -#endif - -#ifndef FIX_197_CREND_INTERFACE - -/*-----------------------------------------------------------------------------------------* - * Function ivas_crend_process() - * - * Process call for IVAS Crend renderer - *-----------------------------------------------------------------------------------------*/ - -ivas_error ivas_crend_process( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float output[][L_FRAME48k] /* i/o: input/output audio channels */ -) -{ - int16_t i, nchan_out, output_frame; - int16_t subframe_len, subframe_idx; - float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k]; - AUDIO_CONFIG intern_config; - ivas_error error; - - push_wmops( "ivas_crend_process" ); - - intern_config = st_ivas->intern_config; - nchan_out = st_ivas->hDecoderConfig->nchan_out; - output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - subframe_len = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; - - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) - { - if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ) - { - /* Orientation tracking */ - if ( st_ivas->hCrend->hTrack != NULL ) - { - if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_AVG ) - { - ivas_orient_trk_SetTrackingType( st_ivas->hCrend->hTrack, OTR_TRACKING_AVG_ORIENT ); - } - else - { - ivas_orient_trk_SetTrackingType( st_ivas->hCrend->hTrack, OTR_TRACKING_REF_ORIENT ); - } - /* get current subframe quaternion and convert to euler angles */ - Quat2Euler( st_ivas->hHeadTrackData->Quaternions[subframe_idx], &( st_ivas->hCrend->m_fYaw ), &( st_ivas->hCrend->m_fPitch ), &( st_ivas->hCrend->m_fRoll ) ); - ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hCrend->hTrack, st_ivas->hCrend->m_fYaw, st_ivas->hCrend->m_fPitch, st_ivas->hCrend->m_fRoll ); - ivas_orient_trk_Process( st_ivas->hCrend->hTrack ); - ivas_orient_trk_GetTrackedOrientation( st_ivas->hCrend->hTrack, &( st_ivas->hCrend->m_fYaw ), &( st_ivas->hCrend->m_fPitch ), &( st_ivas->hCrend->m_fRoll ) ); - } - - /* Rotation in SHD for: - MC with elevation (5_1_2 / 5_1_4 / 7_1_4) -> BINAURAL - SBA SPAR -> BINAURAL or BINAURAL_ROOM - */ - if ( intern_config == AUDIO_CONFIG_FOA || intern_config == AUDIO_CONFIG_HOA2 || intern_config == AUDIO_CONFIG_HOA3 ) - { - rotateFrame_shd( st_ivas->hHeadTrackData, output, subframe_len, st_ivas->hIntSetup, subframe_idx ); - } - /* Rotation in SD for MC -> BINAURAL_ROOM */ - else if ( st_ivas->ivas_format != ISM_FORMAT && st_ivas->hIntSetup.is_loudspeaker_setup ) - { - rotateFrame_sd( st_ivas->hHeadTrackData, output, subframe_len, st_ivas->hIntSetup, st_ivas->hEFAPdata, subframe_idx ); - } - } - - if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) - { - if ( ( intern_config == AUDIO_CONFIG_FOA ) || ( intern_config == AUDIO_CONFIG_HOA2 ) || ( intern_config == AUDIO_CONFIG_HOA3 ) || - ( intern_config == AUDIO_CONFIG_5_1 ) || ( intern_config == AUDIO_CONFIG_7_1 ) || - ( intern_config == AUDIO_CONFIG_5_1_2 ) || ( intern_config == AUDIO_CONFIG_5_1_4 ) || ( intern_config == AUDIO_CONFIG_7_1_4 ) ) - { - ivas_crend_convolver( st_ivas, output, pcm_tmp, subframe_idx ); - if ( st_ivas->hCrend->hReverb != NULL ) - { - if ( ( error = ivas_reverb_process( st_ivas->hCrend->hReverb, intern_config, 1, output, pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - else - { - return IVAS_ERR_INVALID_INPUT_FORMAT; - } - } - else - { - return IVAS_ERR_INTERNAL_FATAL; - } - } - /* move to output */ - for ( i = 0; i < nchan_out; i++ ) - { - mvr2r( pcm_tmp[i], output[i], output_frame ); - } - pop_wmops(); - return IVAS_ERR_OK; -} -#endif /*------------------------------------------------------------------------- @@ -1416,17 +205,10 @@ static ivas_error ivas_rend_initCrend( /* set BRIR flag */ use_brir = false; -#ifdef FIX_197_CREND_INTERFACE if ( ( ( hRendCfg != NULL ) && hRendCfg->roomAcoustics.use_brir ) || ( ( hRendCfg == NULL ) && ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) ) ) { use_brir = true; } -#else - if ( ( hRendCfg != NULL && hRendCfg->roomAcoustics.use_brir ) || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) - { - use_brir = true; - } -#endif if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) @@ -1893,7 +675,6 @@ static ivas_error ivas_rend_initCrend( return IVAS_ERR_OK; } -#ifdef FIX_197_CREND_INTERFACE #ifdef FIX_329_ENABLE_TD_RENDERER_REVERB_MC /*------------------------------------------------------------------------- * ivas_rend_initCrendWrapper() @@ -1951,7 +732,6 @@ ivas_error ivas_rend_initCrendWrapper( return IVAS_ERR_OK; } #endif -#endif /*------------------------------------------------------------------------- * ivas_rend_openCrend() * @@ -1959,17 +739,11 @@ ivas_error ivas_rend_initCrendWrapper( *------------------------------------------------------------------------*/ ivas_error ivas_rend_openCrend( -#ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE *pCrend, -#else - CREND_WRAPPER *pCrend, -#endif const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg, -#ifdef FIX_197_CREND_INTERFACE int16_t Opt_Headrotation, -#endif HRTFS_CREND_HANDLE hSetOfHRTF, const int32_t output_Fs ) { @@ -1981,7 +755,6 @@ ivas_error ivas_rend_openCrend( ivas_error error; error = IVAS_ERR_OK; -#ifdef FIX_197_CREND_INTERFACE #ifdef FIX_329_ENABLE_TD_RENDERER_REVERB_MC if ( ( error = ivas_rend_initCrendWrapper( pCrend ) ) != IVAS_ERR_OK ) { @@ -2004,12 +777,10 @@ ivas_error ivas_rend_openCrend( ( *pCrend )->hCrend = NULL; ( *pCrend )->hHrtfCrend = NULL; } -#endif #endif subframe_length = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES; -#ifdef FIX_197_CREND_INTERFACE if ( ( *pCrend )->hHrtfCrend == NULL ) { if ( ( error = ivas_rend_initCrend( *pCrend, inConfig, outConfig, hRendCfg, hSetOfHRTF, output_Fs ) ) != IVAS_ERR_OK ) @@ -2017,15 +788,6 @@ ivas_error ivas_rend_openCrend( return error; } } -#else - if ( pCrend->hHrtfCrend == NULL ) - { - if ( ( error = ivas_rend_initCrend( pCrend, inConfig, outConfig, hRendCfg, hSetOfHRTF, output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif #ifndef FIX_329_ENABLE_TD_RENDERER_REVERB_MC @@ -2059,11 +821,7 @@ ivas_error ivas_rend_openCrend( #endif -#ifdef FIX_197_CREND_INTERFACE hHrtf = ( *pCrend )->hHrtfCrend; -#else - hHrtf = pCrend->hHrtfCrend; -#endif if ( hHrtf != NULL ) { @@ -2128,11 +886,7 @@ ivas_error ivas_rend_openCrend( { hCrend->lfe_delay_line = NULL; } -#ifdef FIX_197_CREND_INTERFACE if ( Opt_Headrotation ) -#else - if ( false ) /* TODO tmu : check renderer headrotation flag */ -#endif { if ( ( hCrend->hTrack = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) { @@ -2150,11 +904,7 @@ ivas_error ivas_rend_openCrend( { if ( ( error = ivas_reverb_open( &( hCrend->hReverb ), inConfig, -#ifdef FIX_197_CREND_INTERFACE ( *pCrend )->hHrtfCrend, -#else - pCrend->hHrtfCrend, -#endif hRendCfg, output_Fs ) ) != IVAS_ERR_OK ) { @@ -2166,18 +916,10 @@ ivas_error ivas_rend_openCrend( hCrend->hReverb = NULL; } -#ifdef FIX_197_CREND_INTERFACE ( *pCrend )->binaural_latency_ns = (int32_t) ( ( *pCrend )->hHrtfCrend->latency_s * 1000000000.f ); -#else - pCrend->binaural_latency_ns = (int32_t) ( pCrend->hHrtfCrend->latency_s * 1000000000.f ); -#endif } -#ifdef FIX_197_CREND_INTERFACE ( *pCrend )->hCrend = hCrend; -#else - pCrend->hCrend = hCrend; -#endif return IVAS_ERR_OK; } @@ -2188,17 +930,11 @@ ivas_error ivas_rend_openCrend( * Deallocate Crend renderer handle *------------------------------------------------------------------------*/ -#ifdef FIX_197_CREND_INTERFACE void ivas_rend_closeCrend( CREND_WRAPPER_HANDLE *pCrend ) -#else -ivas_error ivas_rend_closeCrend( - CREND_WRAPPER *pCrend ) -#endif { int16_t i; -#ifdef FIX_197_CREND_INTERFACE if ( pCrend == NULL ) { return; @@ -2271,69 +1007,6 @@ ivas_error ivas_rend_closeCrend( *pCrend = NULL; } return; -#else - if ( pCrend->hHrtfCrend != NULL ) - { - ivas_hrtf_close( &pCrend->hHrtfCrend ); - } - - if ( pCrend->hCrend != NULL ) - { - - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) - { - if ( pCrend->hCrend->freq_buffer_re[i] != NULL ) - { - free( pCrend->hCrend->freq_buffer_re[i] ); - pCrend->hCrend->freq_buffer_re[i] = NULL; - } - if ( pCrend->hCrend->freq_buffer_im[i] != NULL ) - { - free( pCrend->hCrend->freq_buffer_im[i] ); - pCrend->hCrend->freq_buffer_im[i] = NULL; - } - } - - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - if ( pCrend->hCrend->prev_out_buffer[i] != NULL ) - { - free( pCrend->hCrend->prev_out_buffer[i] ); - pCrend->hCrend->prev_out_buffer[i] = NULL; - } - } - - if ( pCrend->hCrend->lfe_delay_line != NULL ) - { - free( pCrend->hCrend->lfe_delay_line ); - pCrend->hCrend->lfe_delay_line = NULL; - } - - if ( pCrend->hCrend->freq_buffer_re_diffuse != NULL ) - { - free( pCrend->hCrend->freq_buffer_re_diffuse ); - pCrend->hCrend->freq_buffer_re_diffuse = NULL; - } - - if ( pCrend->hCrend->freq_buffer_im_diffuse != NULL ) - { - free( pCrend->hCrend->freq_buffer_im_diffuse ); - pCrend->hCrend->freq_buffer_im_diffuse = NULL; - } - - if ( pCrend->hCrend->hTrack != NULL ) - { - free( pCrend->hCrend->hTrack ); - pCrend->hCrend->hTrack = NULL; - } - - ivas_reverb_close( &pCrend->hCrend->hReverb ); - - free( pCrend->hCrend ); - pCrend->hCrend = NULL; - } - return IVAS_ERR_OK; -#endif } /*-----------------------------------------------------------------------------------------* @@ -2508,20 +1181,14 @@ ivas_error ivas_rend_crendProcess( const CREND_WRAPPER *pCrend, const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig, -#ifdef FIX_197_CREND_INTERFACE DECODER_CONFIG_HANDLE hDecoderConfig, HEAD_TRACK_DATA_HANDLE hHeadTrackData, IVAS_OUTPUT_SETUP_HANDLE hIntSetup, EFAP_HANDLE hEFAPdata, -#endif float output[][L_FRAME48k], /* i/o: input/output audio channels */ const int32_t output_Fs ) { -#ifdef FIX_197_CREND_INTERFACE int16_t i, subframe_idx, output_frame, subframe_len; -#else - int16_t i, subframe_idx, output_frame; -#endif int16_t nchan_out; float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k]; AUDIO_CONFIG in_config; @@ -2535,11 +1202,7 @@ ivas_error ivas_rend_crendProcess( inRendConfig = getRendAudioConfigFromIvasAudioConfig( inConfig ); outRendConfig = getRendAudioConfigFromIvasAudioConfig( outConfig ); -#ifdef FIX_197_CREND_INTERFACE in_config = getIvasAudioConfigFromRendAudioConfig( inRendConfig ); -#else - in_config = rendAudioConfigToIvasAudioConfig( inRendConfig ); -#endif inConfigType = getAudioConfigType( inRendConfig ); @@ -2549,12 +1212,9 @@ ivas_error ivas_rend_crendProcess( } output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); -#ifdef FIX_197_CREND_INTERFACE subframe_len = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; -#endif for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { -#ifdef FIX_197_CREND_INTERFACE if ( hDecoderConfig && hDecoderConfig->Opt_Headrotation && hHeadTrackData && hHeadTrackData->num_quaternions >= 0 ) { /* Orientation tracking */ @@ -2595,7 +1255,6 @@ ivas_error ivas_rend_crendProcess( rotateFrame_sd( hHeadTrackData, output, subframe_len, *hIntSetup, hEFAPdata, subframe_idx ); } } -#endif if ( ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index a8be0b5ba3..dfa504c07f 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -232,11 +232,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( #else RENDER_CONFIG_DATA *hRenderConfig, /* i : Renderer configuration */ const int16_t ini_frame, /* i : Initialization frame counter */ -#ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE hCrendWrapper, /* i : Crend wrapper handle */ -#else - CREND_HANDLE hCrend, /* i : Crend handle */ -#endif #endif AUDIO_CONFIG transport_config, /* i : Transport configuration */ #ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND @@ -266,11 +262,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( if ( hRenderConfig->roomAcoustics.late_reverb_on && ( ini_frame == 0 ) ) { ivas_reverb_open( -#ifdef FIX_197_CREND_INTERFACE &hCrendWrapper->hCrend->hReverb, -#else - &hCrend->hReverb, -#endif transport_config, NULL, hRenderConfig, @@ -294,14 +286,10 @@ ivas_error ivas_td_binaural_renderer_unwrap( #endif { if ( ( error = ivas_reverb_process( -#ifdef FIX_197_CREND_INTERFACE #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND hReverb, #else hCrendWrapper->hCrend->hReverb, -#endif -#else - hCrend->hReverb, #endif transport_config, 0, output, reverb_signal, subframe_idx ) ) != IVAS_ERR_OK ) { @@ -310,11 +298,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( #ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND ivas_reverb_process( -#ifdef FIX_197_CREND_INTERFACE hCrendWrapper->hCrend->hReverb, -#else - hCrend->hReverb, -#endif transport_config, 0, output, @@ -592,11 +576,7 @@ ivas_error ivas_td_binaural_open_ext( nchan_transport = customLsInput->num_spk; } -#ifdef FIX_197_CREND_INTERFACE transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); -#else - transport_config = rendAudioConfigToIvasAudioConfig( inConfig ); -#endif ivas_format = ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ? MC_FORMAT : ISM_FORMAT; hTransSetup.ls_azimuth = customLsInput->ls_azimuth; hTransSetup.ls_elevation = customLsInput->ls_elevation; @@ -679,11 +659,7 @@ ivas_error ivas_td_binaural_renderer_ext( } #ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND -#ifdef FIX_197_CREND_INTERFACE transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); -#else - transport_config = rendAudioConfigToIvasAudioConfig( inConfig ); -#endif output_Fs = output_frame * 50; #endif #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 9e92e45d57..12a3f27736 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -54,11 +54,7 @@ ivas_error getAudioConfigNumChannels( int16_t *numChannels ); -#ifdef FIX_197_CREND_INTERFACE AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( -#else -AUDIO_CONFIG rendAudioConfigToIvasAudioConfig( -#endif IVAS_REND_AudioConfig rendConfig ); IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( @@ -221,11 +217,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( #else RENDER_CONFIG_DATA *hRenderConfig, /* i : Renderer configuration */ const int16_t ini_frame, /* i : Initialization frame counter */ -#ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE hCrendWrapper, /* i : Crend wrapper handle */ -#else - CREND_HANDLE hCrend, /* i : Crend handle */ -#endif #endif AUDIO_CONFIG transport_config, /* i : Transport configuration */ #ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND @@ -484,28 +476,17 @@ void TDREND_firfilt( *----------------------------------------------------------------------------------*/ ivas_error ivas_rend_openCrend( -#ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE *pCrend, -#else - CREND_WRAPPER *pCrend, -#endif const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg, -#ifdef FIX_197_CREND_INTERFACE int16_t Opt_Headrotation, -#endif HRTFS_CREND_HANDLE hSetOfHRTF, const int32_t output_Fs ); -#ifdef FIX_197_CREND_INTERFACE void ivas_rend_closeCrend( CREND_WRAPPER_HANDLE *pCrend ); -#else -ivas_error ivas_rend_closeCrend( - CREND_WRAPPER *pCrend ); -#endif #ifdef FIX_329_ENABLE_TD_RENDERER_REVERB_MC ivas_error ivas_rend_initCrendWrapper( @@ -516,27 +497,14 @@ ivas_error ivas_rend_crendProcess( const CREND_WRAPPER *pCrend, const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig, -#ifdef FIX_197_CREND_INTERFACE DECODER_CONFIG_HANDLE hDecoderConfig, HEAD_TRACK_DATA_HANDLE hHeadTrackData, IVAS_OUTPUT_SETUP_HANDLE hIntSetup, EFAP_HANDLE hEFAPdata, -#endif float output[][L_FRAME48k], /* i/o: input/output audio channels */ const int32_t output_Fs ); -#ifndef FIX_197_CREND_INTERFACE - -ivas_error ivas_crend_init_from_setofhrtf( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); - -ivas_error ivas_crend_init_from_hrtf_handle( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - HRTFS_HANDLE hrtf); - -#endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 7a1c4f4f30..ffa09574c8 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -115,13 +115,9 @@ typedef struct IVAS_REND_AudioObjectPosition currentPos; IVAS_REND_AudioObjectPosition previousPos; TDREND_WRAPPER tdRendWrapper; -#ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE crendWrapper; #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND REVERB_HANDLE reverb; -#endif -#else - CREND_WRAPPER crendWrapper; #endif rotation_matrix rot_mat_prev; } input_ism; @@ -147,13 +143,9 @@ typedef struct LSSETUP_CUSTOM_STRUCT customLsInput; EFAP_WRAPPER efapInWrapper; TDREND_WRAPPER tdRendWrapper; -#ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE crendWrapper; #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND REVERB_HANDLE reverb; -#endif -#else - CREND_WRAPPER crendWrapper; #endif rotation_gains rot_gains_prev; lfe_routing lfeRouting; @@ -163,11 +155,7 @@ typedef struct { input_base base; pan_matrix hoaDecMtx; -#ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE crendWrapper; -#else - CREND_WRAPPER crendWrapper; -#endif rotation_gains rot_gains_prev; } input_sba; @@ -329,11 +317,7 @@ static int32_t limitRendererOutput( * *-------------------------------------------------------------------*/ -#ifdef FIX_197_CREND_INTERFACE AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( -#else -AUDIO_CONFIG rendAudioConfigToIvasAudioConfig( -#endif IVAS_REND_AudioConfig rendConfig ) { switch ( rendConfig ) @@ -1091,13 +1075,9 @@ static ivas_error setRendInputActiveIsm( inputIsm->currentPos = defaultObjectPosition(); inputIsm->previousPos = defaultObjectPosition(); -#ifdef FIX_197_CREND_INTERFACE inputIsm->crendWrapper = NULL; #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND inputIsm->reverb = NULL; -#endif -#else - inputIsm->crendWrapper = defaultCrendWrapper(); #endif inputIsm->tdRendWrapper = defaultTdRendWrapper(); initRotMatrix( inputIsm->rot_mat_prev ); @@ -1129,15 +1109,9 @@ static ivas_error setRendInputActiveIsm( { #endif if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, -#ifdef FIX_197_CREND_INTERFACE getIvasAudioConfigFromRendAudioConfig( outConfig ), -#else - rendAudioConfigToIvasAudioConfig( outConfig ), -#endif hRendCfg, -#ifdef FIX_197_CREND_INTERFACE 0, -#endif NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -1160,11 +1134,7 @@ static void clearInputIsm( initRendInputBase( &inputIsm->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx ); /* Free input's internal handles */ -#ifdef FIX_197_CREND_INTERFACE if ( inputIsm->crendWrapper != NULL ) -#else - if ( inputIsm->crendWrapper.hCrend != NULL ) -#endif { ivas_rend_closeCrend( &inputIsm->crendWrapper ); } @@ -1249,13 +1219,8 @@ static ivas_error initMcPanGainsWithConversionMapping( AUDIO_CONFIG ivasConfigIn, ivasConfigOut; int16_t i; -#ifdef FIX_197_CREND_INTERFACE ivasConfigIn = getIvasAudioConfigFromRendAudioConfig( inputMc->base.inConfig ); ivasConfigOut = getIvasAudioConfigFromRendAudioConfig( outConfig ); -#else - ivasConfigIn = rendAudioConfigToIvasAudioConfig( inputMc->base.inConfig ); - ivasConfigOut = rendAudioConfigToIvasAudioConfig( outConfig ); -#endif /* Find conversion mapping for current I/O config pair. * Stay with default panning matrix if conversion_matrix is NULL */ @@ -1818,11 +1783,7 @@ static ivas_error initMcBinauralRendering( inputMc->tdRendWrapper.hHrtfTD = NULL; } -#ifdef FIX_197_CREND_INTERFACE if ( inputMc->crendWrapper != NULL ) -#else - if ( inputMc->crendWrapper.hCrend != NULL ) -#endif { ivas_rend_closeCrend( &inputMc->crendWrapper ); } @@ -1877,16 +1838,9 @@ static ivas_error initMcBinauralRendering( { if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, -#ifdef FIX_197_CREND_INTERFACE ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) ? AUDIO_CONFIG_7_1_4 : getIvasAudioConfigFromRendAudioConfig( inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), -#else - ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) ? AUDIO_CONFIG_7_1_4 : rendAudioConfigToIvasAudioConfig( inConfig ), - rendAudioConfigToIvasAudioConfig( outConfig ), -#endif hRendCfg, -#ifdef FIX_197_CREND_INTERFACE 0, -#endif NULL, outSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -1989,13 +1943,9 @@ static ivas_error setRendInputActiveMc( setZeroPanMatrix( inputMc->panGains ); inputMc->customLsInput = defaultCustomLs(); inputMc->tdRendWrapper = defaultTdRendWrapper(); -#ifdef FIX_197_CREND_INTERFACE inputMc->crendWrapper = NULL; #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND inputMc->reverb = NULL; -#endif -#else - inputMc->crendWrapper = defaultCrendWrapper(); #endif initRotGains( inputMc->rot_gains_prev ); inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); @@ -2031,11 +1981,7 @@ static void clearInputMc( efap_free_data( &inputMc->efapInWrapper.hEfap ); } -#ifdef FIX_197_CREND_INTERFACE if ( inputMc->crendWrapper != NULL ) -#else - if ( inputMc->crendWrapper.hCrend != NULL ) -#endif { ivas_rend_closeCrend( &inputMc->crendWrapper ); } @@ -2083,11 +2029,7 @@ static ivas_error initSbaPanGainsForMcOut( case IVAS_REND_AUDIO_CONFIG_MONO: hOutSetup.ls_azimuth = ls_azimuth_CICP1; hOutSetup.ls_elevation = ls_elevation_CICP1; -#ifdef FIX_197_CREND_INTERFACE ivas_output_init( &hOutSetup, getIvasAudioConfigFromRendAudioConfig( outConfig ) ); -#else - ivas_output_init( &hOutSetup, rendAudioConfigToIvasAudioConfig( outConfig ) ); -#endif break; case IVAS_REND_AUDIO_CONFIG_STEREO: case IVAS_REND_AUDIO_CONFIG_5_1: @@ -2095,11 +2037,7 @@ static ivas_error initSbaPanGainsForMcOut( case IVAS_REND_AUDIO_CONFIG_5_1_2: case IVAS_REND_AUDIO_CONFIG_5_1_4: case IVAS_REND_AUDIO_CONFIG_7_1_4: -#ifdef FIX_197_CREND_INTERFACE ivas_output_init( &hOutSetup, getIvasAudioConfigFromRendAudioConfig( outConfig ) ); -#else - ivas_output_init( &hOutSetup, rendAudioConfigToIvasAudioConfig( outConfig ) ); -#endif break; case IVAS_REND_AUDIO_CONFIG_LS_CUSTOM: ivas_ls_custom_setup( &hOutSetup, outSetupCustom ); @@ -2180,17 +2118,10 @@ static ivas_error updateSbaPanGains( { case IVAS_REND_AUDIO_CONFIG_BINAURAL: error = ivas_rend_openCrend( &inputSba->crendWrapper, -#ifdef FIX_197_CREND_INTERFACE getIvasAudioConfigFromRendAudioConfig( inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), -#else - rendAudioConfigToIvasAudioConfig( inConfig ), - rendAudioConfigToIvasAudioConfig( outConfig ), -#endif hRendCfg, -#ifdef FIX_197_CREND_INTERFACE 0, -#endif NULL, *rendCtx.pOutSampleRate ); break; @@ -2202,15 +2133,9 @@ static ivas_error updateSbaPanGains( error = ivas_rend_openCrend( &inputSba->crendWrapper, AUDIO_CONFIG_7_1_4, -#ifdef FIX_197_CREND_INTERFACE getIvasAudioConfigFromRendAudioConfig( outConfig ), -#else - rendAudioConfigToIvasAudioConfig( outConfig ), -#endif hRendCfg, -#ifdef FIX_197_CREND_INTERFACE 0, -#endif NULL, *rendCtx.pOutSampleRate ); break; @@ -2254,11 +2179,7 @@ static ivas_error setRendInputActiveSba( initRendInputBase( &inputSba->base, inConfig, id, rendCtx ); setZeroPanMatrix( inputSba->hoaDecMtx ); -#ifdef FIX_197_CREND_INTERFACE inputSba->crendWrapper = NULL; -#else - inputSba->crendWrapper = defaultCrendWrapper(); -#endif initRotGains( inputSba->rot_gains_prev ); if ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) @@ -2279,11 +2200,7 @@ static void clearInputSba( initRendInputBase( &inputSba->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx ); /* Free input's internal handles */ -#ifdef FIX_197_CREND_INTERFACE if ( inputSba->crendWrapper != NULL ) -#else - if ( inputSba->crendWrapper.hCrend != NULL ) -#endif { ivas_rend_closeCrend( &inputSba->crendWrapper ); } @@ -2303,11 +2220,7 @@ static ivas_error initMasaDummyDecForMcOut( DecoderDummy *decDummy; decDummy = inputMasa->decDummy; -#ifdef FIX_197_CREND_INTERFACE output_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); -#else - output_config = rendAudioConfigToIvasAudioConfig( outConfig ); -#endif decDummy->hDecoderConfig->output_config = output_config; decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ @@ -2392,11 +2305,7 @@ static ivas_error initMasaDummyDecForSbaOut( decDummy = inputMasa->decDummy; -#ifdef FIX_197_CREND_INTERFACE output_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); -#else - output_config = rendAudioConfigToIvasAudioConfig( outConfig ); -#endif decDummy->hDecoderConfig->output_config = output_config; decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ @@ -2463,11 +2372,7 @@ static ivas_error initMasaDummyDecForBinauralOut( decDummy = inputMasa->decDummy; -#ifdef FIX_197_CREND_INTERFACE output_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); -#else - output_config = rendAudioConfigToIvasAudioConfig( outConfig ); -#endif decDummy->hDecoderConfig->output_config = output_config; output_config = decDummy->hDecoderConfig->output_config; @@ -2581,12 +2486,7 @@ static DecoderDummy *initDecoderDummy( decDummy->hBinRenderer = NULL; decDummy->hEFAPdata = NULL; -#ifdef FIX_197_CREND_INTERFACE decDummy->hCrendWrapper = NULL; -#else - decDummy->hHrtf = NULL; - decDummy->hCrend = NULL; -#endif decDummy->hHrtfTD = NULL; decDummy->hSpar = NULL; decDummy->hoa_dec_mtx = NULL; @@ -2594,11 +2494,7 @@ static DecoderDummy *initDecoderDummy( decDummy->hMasa = NULL; decDummy->hDiracDecBin = NULL; decDummy->hQMetaData = NULL; -#ifdef FIX_197_CREND_INTERFACE decDummy->hDecoderConfig->output_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); -#else - decDummy->hDecoderConfig->output_config = rendAudioConfigToIvasAudioConfig( outConfig ); -#endif decDummy->nchan_transport = numTransChannels; if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) @@ -2831,11 +2727,7 @@ ivas_error IVAS_REND_Open( for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); -#ifdef FIX_197_CREND_INTERFACE hIvasRend->inputsIsm[i].crendWrapper = NULL; -#else - hIvasRend->inputsIsm[i].crendWrapper.hCrend = NULL; -#endif #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND hIvasRend->inputsIsm[i].reverb = NULL; #endif @@ -2846,11 +2738,7 @@ ivas_error IVAS_REND_Open( { initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); hIvasRend->inputsMc[i].efapInWrapper.hEfap = NULL; -#ifdef FIX_197_CREND_INTERFACE hIvasRend->inputsMc[i].crendWrapper = NULL; -#else - hIvasRend->inputsMc[i].crendWrapper.hCrend = NULL; -#endif #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND hIvasRend->inputsMc[i].reverb = NULL; #endif @@ -2860,11 +2748,7 @@ ivas_error IVAS_REND_Open( for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); -#ifdef FIX_197_CREND_INTERFACE hIvasRend->inputsSba[i].crendWrapper = NULL; -#else - hIvasRend->inputsSba[i].crendWrapper.hCrend = NULL; -#endif } for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) @@ -3645,13 +3529,8 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsIsm[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { -#ifdef FIX_197_CREND_INTERFACE latency_ns = max( ( hIvasRend->inputsIsm[i].crendWrapper != NULL ) ? hIvasRend->inputsIsm[i].crendWrapper->binaural_latency_ns : 0, hIvasRend->inputsIsm[i].tdRendWrapper.binaural_latency_ns ); -#else - latency_ns = max( hIvasRend->inputsIsm[i].crendWrapper.binaural_latency_ns, - hIvasRend->inputsIsm[i].tdRendWrapper.binaural_latency_ns ); -#endif max_latency_ns = max( max_latency_ns, latency_ns ); } } @@ -3660,13 +3539,8 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsMc[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { -#ifdef FIX_197_CREND_INTERFACE latency_ns = max( ( hIvasRend->inputsMc[i].crendWrapper != NULL ) ? hIvasRend->inputsMc[i].crendWrapper->binaural_latency_ns : 0, hIvasRend->inputsMc[i].tdRendWrapper.binaural_latency_ns ); -#else - latency_ns = max( hIvasRend->inputsMc[i].crendWrapper.binaural_latency_ns, - hIvasRend->inputsMc[i].tdRendWrapper.binaural_latency_ns ); -#endif max_latency_ns = max( max_latency_ns, latency_ns ); } } @@ -3675,11 +3549,7 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsSba[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { -#ifdef FIX_197_CREND_INTERFACE latency_ns = ( hIvasRend->inputsSba[i].crendWrapper != NULL ) ? hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns : 0; -#else - latency_ns = hIvasRend->inputsSba[i].crendWrapper.binaural_latency_ns; -#endif max_latency_ns = max( max_latency_ns, latency_ns ); } } @@ -3876,7 +3746,6 @@ ivas_error IVAS_REND_InitConfig( hIvasRend->rendererConfigEnabled = 0; } -#ifdef FIX_197_CREND_INTERFACE if ( rendererConfigEnabled ) { if ( ( error = ivas_render_config_open( &( hIvasRend->hRendererConfig ) ) ) != IVAS_ERR_OK ) @@ -3893,17 +3762,6 @@ ivas_error IVAS_REND_InitConfig( { hIvasRend->hRendererConfig = NULL; } -#else - if ( ( error = ivas_render_config_open( &( hIvasRend->hRendererConfig ) ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( ivas_render_config_init_from_rom( &hIvasRend->hRendererConfig, hIvasRend->rendererConfigEnabled ) != IVAS_ERR_OK ) - { - return IVAS_ERR_INTERNAL_FATAL; - } -#endif return IVAS_ERR_OK; } @@ -4536,15 +4394,9 @@ static ivas_error renderIsmToBinauralRoom( if ( ( error = ivas_rend_crendProcess( -#ifdef FIX_197_CREND_INTERFACE ismInput->crendWrapper, -#else - &ismInput->crendWrapper, -#endif AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM, -#ifdef FIX_197_CREND_INTERFACE NULL, NULL, NULL, NULL, -#endif #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND tmpRendBuffer, #else @@ -4870,14 +4722,8 @@ static ivas_error renderMcToBinaural( /* call CREND */ if ( ( error = ivas_rend_crendProcess( -#ifdef FIX_197_CREND_INTERFACE mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, -#else - &mcInput->crendWrapper, - rendAudioConfigToIvasAudioConfig( mcInput->base.inConfig ), - rendAudioConfigToIvasAudioConfig( outConfig ), -#endif tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -4977,14 +4823,8 @@ static ivas_error renderMcToBinauralRoom( /* call CREND */ if ( ( error = ivas_rend_crendProcess( -#ifdef FIX_197_CREND_INTERFACE mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, -#else - &mcInput->crendWrapper, - rendAudioConfigToIvasAudioConfig( mcInput->base.inConfig ), - rendAudioConfigToIvasAudioConfig( outConfig ), -#endif #ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND tmpRendBuffer, #else @@ -5067,13 +4907,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( /* call CREND */ if ( ( error = ivas_rend_crendProcess( -#ifdef FIX_197_CREND_INTERFACE mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, -#else - &mcInput->crendWrapper, - AUDIO_CONFIG_7_1_4, - rendAudioConfigToIvasAudioConfig( outConfig ), -#endif tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -5303,13 +5137,7 @@ static ivas_error renderSbaToBinaural( /* call CREND */ if ( ( error = ivas_rend_crendProcess( -#ifdef FIX_197_CREND_INTERFACE sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, -#else - &sbaInput->crendWrapper, - rendAudioConfigToIvasAudioConfig( sbaInput->base.inConfig ), - rendAudioConfigToIvasAudioConfig( outConfig ), -#endif tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -5379,14 +5207,8 @@ static ivas_error renderSbaToBinauralRoom( /* call CREND */ if ( ( error = ivas_rend_crendProcess( -#ifdef FIX_197_CREND_INTERFACE sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, -#else - &sbaInput->crendWrapper, - AUDIO_CONFIG_7_1_4, - rendAudioConfigToIvasAudioConfig( outConfig ), -#endif tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; -- GitLab From 4794fcd6ec5e048a6aefa69a7b943c35a3749a4d Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 16 Mar 2023 21:09:59 +0100 Subject: [PATCH 239/375] [cleanup] accept FIX_329_ENABLE_TD_RENDERER_REVERB_MC --- lib_com/options.h | 1 - lib_dec/ivas_binRenderer_internal.c | 4 --- lib_dec/ivas_init_dec.c | 8 ----- lib_dec/ivas_mct_dec.c | 6 ---- lib_rend/ivas_crend.c | 50 ----------------------------- lib_rend/ivas_prot_rend.h | 2 -- 6 files changed, 71 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c7b6ebec04..efb224e691 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -141,7 +141,6 @@ #define DISABLE_ADAP_RES_COD_TMP /* temporary fix for IVAS-403, disables adaptive residual coding */ /*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define FIX_329_ENABLE_TD_RENDERER_REVERB_MC /* Eri: Enable reverb for TD renderer for 5.1 and 7.1 with headtracking enabled for IVAS_dec */ #define FIX_330_ENABLE_TD_RENDERER_REVERB_REND /* Eri: Enable reverb for TD renderer for ISM, 5.1 and 7.1 with headtracking enabled for IVAS_rend */ #define FIX_347_DTX_CRASH /* FhG: Fix crash that can happen with DTX */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index a0cd77d987..e27fc42db5 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -866,7 +866,6 @@ void ivas_binaural_add_LFE( if ( render_lfe ) { -#ifdef FIX_329_ENABLE_TD_RENDERER_REVERB_MC if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { gain = GAIN_LFE; @@ -875,9 +874,6 @@ void ivas_binaural_add_LFE( { gain = ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hHrtfCrend != NULL ) ) ? st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe : GAIN_LFE; } -#else - gain = ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hHrtfCrend != NULL ) ) ? st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe : GAIN_LFE; -#endif for ( idx_lfe = 0; idx_lfe < st_ivas->hIntSetup.num_lfe; idx_lfe++ ) { v_multc( output_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], gain, output_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_frame ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 83cd4f471b..b2aecc4d2e 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1228,15 +1228,7 @@ ivas_error ivas_init_decoder( return error; } #else -#ifdef FIX_329_ENABLE_TD_RENDERER_REVERB_MC if ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper ) ) != IVAS_ERR_OK ) -#else - if ( ( st_ivas->hCrendWrapper = (CREND_WRAPPER_HANDLE) malloc( sizeof( CREND_WRAPPER ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); - } - if ( ( st_ivas->hCrendWrapper->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) -#endif { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 9107453f35..af3749d980 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1130,18 +1130,12 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) { -#ifdef FIX_329_ENABLE_TD_RENDERER_REVERB_MC if ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper ) ) != IVAS_ERR_OK ) -#else - if ( ( st_ivas->hCrendWrapper = (CREND_WRAPPER_HANDLE) malloc( sizeof( CREND_WRAPPER ) ) ) == NULL ) -#endif { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); } -#ifdef FIX_329_ENABLE_TD_RENDERER_REVERB_MC st_ivas->hCrendWrapper->hCrend = NULL; st_ivas->hCrendWrapper->hHrtfCrend = NULL; -#endif if ( ( st_ivas->hCrendWrapper->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 4da404e721..9ea32ba1e3 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -675,7 +675,6 @@ static ivas_error ivas_rend_initCrend( return IVAS_ERR_OK; } -#ifdef FIX_329_ENABLE_TD_RENDERER_REVERB_MC /*------------------------------------------------------------------------- * ivas_rend_initCrendWrapper() * @@ -731,7 +730,6 @@ ivas_error ivas_rend_initCrendWrapper( return IVAS_ERR_OK; } -#endif /*------------------------------------------------------------------------- * ivas_rend_openCrend() * @@ -755,29 +753,11 @@ ivas_error ivas_rend_openCrend( ivas_error error; error = IVAS_ERR_OK; -#ifdef FIX_329_ENABLE_TD_RENDERER_REVERB_MC if ( ( error = ivas_rend_initCrendWrapper( pCrend ) ) != IVAS_ERR_OK ) { return error; } hCrend = ( *pCrend )->hCrend; -#else - if ( pCrend == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); - } - - if ( *pCrend == NULL ) - { - if ( ( *pCrend = (CREND_WRAPPER_HANDLE) malloc( sizeof( CREND_WRAPPER ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); - } - ( *pCrend )->binaural_latency_ns = 0; - ( *pCrend )->hCrend = NULL; - ( *pCrend )->hHrtfCrend = NULL; - } -#endif subframe_length = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES; @@ -789,36 +769,6 @@ ivas_error ivas_rend_openCrend( } } -#ifndef FIX_329_ENABLE_TD_RENDERER_REVERB_MC - - if ( ( hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer handle" ); - } - - hCrend->lfe_delay_line = NULL; - - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) - { - hCrend->freq_buffer_re[i] = NULL; - hCrend->freq_buffer_im[i] = NULL; - } - - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - hCrend->prev_out_buffer[i] = NULL; - } - - hCrend->freq_buffer_re_diffuse = NULL; - hCrend->freq_buffer_im_diffuse = NULL; - hCrend->hReverb = NULL; - hCrend->delay_line_rw_index = 0; - hCrend->diffuse_delay_line_rw_index = 0; - hCrend->hTrack = NULL; - hCrend->m_fYaw = 0; - hCrend->m_fPitch = 0; - hCrend->m_fRoll = 0; -#endif hHrtf = ( *pCrend )->hHrtfCrend; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 12a3f27736..f90d781c33 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -488,10 +488,8 @@ ivas_error ivas_rend_openCrend( void ivas_rend_closeCrend( CREND_WRAPPER_HANDLE *pCrend ); -#ifdef FIX_329_ENABLE_TD_RENDERER_REVERB_MC ivas_error ivas_rend_initCrendWrapper( CREND_WRAPPER_HANDLE *pCrend ); -#endif ivas_error ivas_rend_crendProcess( const CREND_WRAPPER *pCrend, -- GitLab From 4f7bb9eb7195381c2fa3299487d1fd5a99354710 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 16 Mar 2023 21:10:54 +0100 Subject: [PATCH 240/375] [cleanup] accept FIX_330_ENABLE_TD_RENDERER_REVERB_REND --- lib_com/options.h | 1 - lib_dec/ivas_init_dec.c | 11 ---- lib_dec/ivas_objectRenderer_internal.c | 8 --- lib_dec/ivas_stat_dec.h | 2 - lib_rend/ivas_objectRenderer.c | 79 -------------------------- lib_rend/ivas_prot_rend.h | 11 ---- lib_rend/ivas_reverb.c | 2 - lib_rend/lib_rend.c | 77 ------------------------- 8 files changed, 191 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index efb224e691..479b2a829b 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -141,7 +141,6 @@ #define DISABLE_ADAP_RES_COD_TMP /* temporary fix for IVAS-403, disables adaptive residual coding */ /*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define FIX_330_ENABLE_TD_RENDERER_REVERB_REND /* Eri: Enable reverb for TD renderer for ISM, 5.1 and 7.1 with headtracking enabled for IVAS_rend */ #define FIX_347_DTX_CRASH /* FhG: Fix crash that can happen with DTX */ #define DISABLE_RES_CHANNELS_MCT /* decode only W and residual for Y when outputting to stereo */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index b2aecc4d2e..e66e5915d8 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1222,17 +1222,10 @@ ivas_error ivas_init_decoder( if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) { -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_config, NULL, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper ) ) != IVAS_ERR_OK ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); - } -#endif } } else if ( st_ivas->renderer_type == RENDERER_MC ) @@ -1572,9 +1565,7 @@ void ivas_initialize_handles_dec( st_ivas->hBinRendererTd = NULL; st_ivas->hMonoDmxRenderer = NULL; st_ivas->hCrendWrapper = NULL; -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND st_ivas->hReverb = NULL; -#endif st_ivas->hSetOfHRTF = NULL; st_ivas->hHrtfFastConv = NULL; st_ivas->hHrtfParambin = NULL; @@ -1733,10 +1724,8 @@ void ivas_destroy_dec( /* Crend handle */ ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND /* Reverb handle */ ivas_reverb_close( &st_ivas->hReverb ); -#endif /* LS config converter handle */ ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index d42578017f..77e3586784 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -72,16 +72,8 @@ ivas_error ivas_td_binaural_renderer( ) { return ivas_td_binaural_renderer_unwrap( -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND st_ivas->hReverb, -#else - st_ivas->hRenderConfig, st_ivas->ini_frame, - st_ivas->hCrendWrapper, -#endif st_ivas->transport_config, -#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND - st_ivas->hDecoderConfig->output_Fs, -#endif st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, output, output_frame ); } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 70a3805cfc..1cef5cb3c0 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1239,9 +1239,7 @@ typedef struct Decoder_Struct VBAP_HANDLE hVBAPdata; /* VBAP structure */ MONO_DOWNMIX_RENDERER_HANDLE hMonoDmxRenderer; /* Mono downmix structure */ CREND_WRAPPER_HANDLE hCrendWrapper; -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND REVERB_HANDLE hReverb; /* Reverb handle */ -#endif HRTFS_CREND_HANDLE hSetOfHRTF; /* Set of HRTFs handle (CRend) */ HRTFS_FASTCONV_HANDLE hHrtfFastConv; /* FASTCONV HRTF tables for binaural rendering */ HRTFS_PARAMBIN_HANDLE hHrtfParambin; /* HRTF tables for parametric binauralizer */ diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index dfa504c07f..9ae3014938 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -227,17 +227,8 @@ void ivas_td_binaural_close( *---------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer_unwrap( -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND REVERB_HANDLE hReverb, /* i : reverb handle */ -#else - RENDER_CONFIG_DATA *hRenderConfig, /* i : Renderer configuration */ - const int16_t ini_frame, /* i : Initialization frame counter */ - CREND_WRAPPER_HANDLE hCrendWrapper, /* i : Crend wrapper handle */ -#endif AUDIO_CONFIG transport_config, /* i : Transport configuration */ -#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND - const int32_t output_Fs, /* i : Output sampling rate */ -#endif BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ const int16_t nchan_transport, /* i : Transport channels (ISms) */ const int16_t lfe_idx, /* i : LFE channel index */ @@ -255,21 +246,6 @@ ivas_error ivas_td_binaural_renderer_unwrap( ivas_error error; subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; -#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND - if ( hRenderConfig != NULL ) - { - - if ( hRenderConfig->roomAcoustics.late_reverb_on && ( ini_frame == 0 ) ) - { - ivas_reverb_open( - &hCrendWrapper->hCrend->hReverb, - transport_config, - NULL, - hRenderConfig, - output_Fs ); - } - } -#endif /* Update object position(s) */ TDREND_Update_object_positions( hBinRendererTd, nchan_transport, lfe_idx, ivas_format, hIsmMetaData, output ); @@ -279,32 +255,15 @@ ivas_error ivas_td_binaural_renderer_unwrap( /* Update the listener's location/orientation */ TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL ); -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( ( hReverb != NULL ) && ( hReverb->pConfig.roomAcoustics.late_reverb_on ) ) -#else - if ( ( hRenderConfig != NULL ) && ( hRenderConfig->roomAcoustics.late_reverb_on ) ) -#endif { if ( ( error = ivas_reverb_process( -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND hReverb, -#else - hCrendWrapper->hCrend->hReverb, -#endif transport_config, 0, output, reverb_signal, subframe_idx ) ) != IVAS_ERR_OK ) { return error; } -#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND - ivas_reverb_process( - hCrendWrapper->hCrend->hReverb, - transport_config, - 0, - output, - reverb_signal, - subframe_idx ); -#endif } /* Render subframe */ @@ -315,24 +274,12 @@ ivas_error ivas_td_binaural_renderer_unwrap( } -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( ( hReverb != NULL ) && ( hReverb->pConfig.roomAcoustics.late_reverb_on ) ) { /* add reverb to rendered signals */ v_add( reverb_signal[0], output[0], output[0], output_frame ); v_add( reverb_signal[1], output[1], output[1], output_frame ); } -#else - if ( hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ - { - if ( hRenderConfig->roomAcoustics.late_reverb_on ) - { - /* add reverb to rendered signals */ - v_add( reverb_signal[0], output[0], output[0], output_frame ); - v_add( reverb_signal[1], output[1], output[1], output_frame ); - } - } -#endif return IVAS_ERR_OK; } @@ -598,9 +545,7 @@ ivas_error ivas_td_binaural_renderer_ext( const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND const REVERB_HANDLE reverb, /* i : reverb handle */ -#endif const int16_t output_frame, /* i : output frame length */ float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ) @@ -609,17 +554,10 @@ ivas_error ivas_td_binaural_renderer_ext( ISM_METADATA_HANDLE hIsmMetaData[1]; int16_t lfe_idx; int16_t num_src; -#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND - /* TODO tmu : pass down renderer config struct */ - // float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; -#endif IVAS_FORMAT ivas_format; IVAS_REND_AudioConfigType inConfigType; AUDIO_CONFIG transport_config; ivas_error error; -#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND - int32_t output_Fs; -#endif push_wmops( "ivas_td_binaural_renderer_ext" ); @@ -630,9 +568,7 @@ ivas_error ivas_td_binaural_renderer_ext( if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { ivas_format = MC_FORMAT; -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); -#endif if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { if ( ( error = getAudioConfigNumChannels( inConfig, &num_src ) ) != IVAS_ERR_OK ) @@ -650,32 +586,17 @@ ivas_error ivas_td_binaural_renderer_ext( { ivas_format = ISM_FORMAT; num_src = 1; -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND transport_config = AUDIO_CONFIG_ISM1; -#endif hIsmMetaData[0] = &hIsmMetaDataFrame; hIsmMetaData[0]->azimuth = currentPos->azimuth; hIsmMetaData[0]->elevation = currentPos->elevation; } -#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND - transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); - output_Fs = output_frame * 50; -#endif -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( ( error = ivas_td_binaural_renderer_unwrap( reverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, output, output_frame ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = error = ivas_td_binaural_renderer_unwrap( NULL, 1, NULL, transport_config, output_Fs, pTDRend->hBinRendererTd, num_src, lfe_idx, - ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, - output, output_frame ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif pop_wmops(); diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index f90d781c33..ea3db32259 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -212,17 +212,8 @@ void ivas_HRTF_CRend_binary_close( *----------------------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer_unwrap( -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND REVERB_HANDLE hReverb, /* i : reverb handle */ -#else - RENDER_CONFIG_DATA *hRenderConfig, /* i : Renderer configuration */ - const int16_t ini_frame, /* i : Initialization frame counter */ - CREND_WRAPPER_HANDLE hCrendWrapper, /* i : Crend wrapper handle */ -#endif AUDIO_CONFIG transport_config, /* i : Transport configuration */ -#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND - const int32_t output_Fs, /* i : Output sampling rate */ -#endif BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ const int16_t nchan_transport, /* i : Transport channels (ISms) */ const int16_t lfe_idx, /* i : LFE channel index */ @@ -240,9 +231,7 @@ ivas_error ivas_td_binaural_renderer_ext( const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND const REVERB_HANDLE reverb, /* i : reverb handle */ -#endif const int16_t output_frame, /* i : output frame length */ float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ); diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 3911c36601..ec5bd928d2 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1175,7 +1175,6 @@ ivas_error ivas_reverb_open( /* set up reverb acoustic data on the basis of HRTF data and renderer config */ set_reverb_acoustic_data( ¶ms, input_audio_config, hHrtf, &hRenderConfig->roomAcoustics, subframe_len, nr_fc_input, nr_fc_fft_filter ); -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND /* set reverb acoustic configuration based on renderer config */ #ifdef DEBUGGING pState->pConfig.renderer_type_override = hRenderConfig->renderer_type_override; @@ -1184,7 +1183,6 @@ ivas_error ivas_reverb_open( pState->pConfig.roomAcoustics.use_brir = hRenderConfig->roomAcoustics.use_brir; pState->pConfig.roomAcoustics.late_reverb_on = hRenderConfig->roomAcoustics.late_reverb_on; pState->pConfig.roomAcoustics.nBands = hRenderConfig->roomAcoustics.nBands; -#endif /* set up input downmix */ pState->dmx_gain = calc_dmx_gain(); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ffa09574c8..eae8c6d0d0 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -116,9 +116,7 @@ typedef struct IVAS_REND_AudioObjectPosition previousPos; TDREND_WRAPPER tdRendWrapper; CREND_WRAPPER_HANDLE crendWrapper; -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND REVERB_HANDLE reverb; -#endif rotation_matrix rot_mat_prev; } input_ism; @@ -144,9 +142,7 @@ typedef struct EFAP_WRAPPER efapInWrapper; TDREND_WRAPPER tdRendWrapper; CREND_WRAPPER_HANDLE crendWrapper; -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND REVERB_HANDLE reverb; -#endif rotation_gains rot_gains_prev; lfe_routing lfeRouting; } input_mc; @@ -1076,9 +1072,7 @@ static ivas_error setRendInputActiveIsm( inputIsm->currentPos = defaultObjectPosition(); inputIsm->previousPos = defaultObjectPosition(); inputIsm->crendWrapper = NULL; -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND inputIsm->reverb = NULL; -#endif inputIsm->tdRendWrapper = defaultTdRendWrapper(); initRotMatrix( inputIsm->rot_mat_prev ); @@ -1092,7 +1086,6 @@ static ivas_error setRendInputActiveIsm( } else if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) { -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( hRendCfg != NULL && hRendCfg->roomAcoustics.use_brir == 0 && hRendCfg->roomAcoustics.late_reverb_on ) { if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) @@ -1107,7 +1100,6 @@ static ivas_error setRendInputActiveIsm( } else { -#endif if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, @@ -1116,9 +1108,7 @@ static ivas_error setRendInputActiveIsm( { return error; } -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND } -#endif } return IVAS_ERR_OK; @@ -1139,12 +1129,10 @@ static void clearInputIsm( ivas_rend_closeCrend( &inputIsm->crendWrapper ); } -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( inputIsm->reverb != NULL ) { ivas_reverb_close( &inputIsm->reverb ); } -#endif if ( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) { @@ -1788,12 +1776,10 @@ static ivas_error initMcBinauralRendering( ivas_rend_closeCrend( &inputMc->crendWrapper ); } -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( inputMc->reverb != NULL ) { ivas_reverb_close( &inputMc->reverb ); } -#endif if ( inputMc->efapInWrapper.hEfap != NULL ) { @@ -1825,7 +1811,6 @@ static ivas_error initMcBinauralRendering( return error; } -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( hRendCfg != NULL && hRendCfg->roomAcoustics.use_brir == 0 && hRendCfg->roomAcoustics.late_reverb_on ) { if ( ( error = ivas_reverb_open( &( inputMc->reverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) @@ -1833,7 +1818,6 @@ static ivas_error initMcBinauralRendering( return error; } } -#endif } { @@ -1944,9 +1928,7 @@ static ivas_error setRendInputActiveMc( inputMc->customLsInput = defaultCustomLs(); inputMc->tdRendWrapper = defaultTdRendWrapper(); inputMc->crendWrapper = NULL; -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND inputMc->reverb = NULL; -#endif initRotGains( inputMc->rot_gains_prev ); inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); @@ -1986,12 +1968,10 @@ static void clearInputMc( ivas_rend_closeCrend( &inputMc->crendWrapper ); } -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( inputMc->reverb != NULL ) { ivas_reverb_close( &inputMc->reverb ); } -#endif if ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) { @@ -2728,9 +2708,7 @@ ivas_error IVAS_REND_Open( { initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); hIvasRend->inputsIsm[i].crendWrapper = NULL; -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND hIvasRend->inputsIsm[i].reverb = NULL; -#endif hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; } @@ -2739,9 +2717,7 @@ ivas_error IVAS_REND_Open( initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); hIvasRend->inputsMc[i].efapInWrapper.hEfap = NULL; hIvasRend->inputsMc[i].crendWrapper = NULL; -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND hIvasRend->inputsMc[i].reverb = NULL; -#endif hIvasRend->inputsMc[i].tdRendWrapper.hBinRendererTd = NULL; } @@ -4246,9 +4222,7 @@ static ivas_error renderIsmToBinaural( NULL, ismInput->base.ctx.pHeadRotData, &ismInput->currentPos, -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND ismInput->reverb, -#endif outAudio.config.numSamplesPerChannel, tmpTDRendBuffer ) ) != IVAS_ERR_OK ) { @@ -4271,11 +4245,7 @@ static ivas_error renderIsmToBinauralRoom( int16_t subframe_idx, subframe_len; int16_t tmp; rotation_matrix Rmat; -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; -#else - float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; -#endif IVAS_QUATERNION quat; ivas_error error; pan_vector currentPanGains; @@ -4289,7 +4259,6 @@ static ivas_error renderIsmToBinauralRoom( headRotData = ismInput->base.ctx.pHeadRotData; rotatedPos = defaultObjectPosition(); -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND if ( ismInput->reverb != NULL && ismInput->reverb->pConfig.roomAcoustics.use_brir == 0 && ismInput->reverb->pConfig.roomAcoustics.late_reverb_on == 1 && headRotData->headRotEnabled ) { copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer ); @@ -4300,21 +4269,16 @@ static ivas_error renderIsmToBinauralRoom( NULL, ismInput->base.ctx.pHeadRotData, &ismInput->currentPos, -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND ismInput->reverb, -#endif outAudio.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { return error; } -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); -#endif } else { -#endif if ( headRotData->headRotEnabled ) { @@ -4386,37 +4350,23 @@ static ivas_error renderIsmToBinauralRoom( renderBufferChannelLerp( ismInput->base.inputBuffer, 0, currentPanGains, previousPanGains, tmpMcBuffer ); -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND copyBufferTo2dArray( tmpMcBuffer, tmpRendBuffer ); -#else - copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); -#endif if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM, NULL, NULL, NULL, NULL, -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND tmpRendBuffer, -#else - tmpCrendBuffer, -#endif *ismInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); -#else - accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); -#endif free( tmpMcBuffer.data ); -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND } -#endif pop_wmops(); return IVAS_ERR_OK; @@ -4683,9 +4633,7 @@ static ivas_error renderMcToBinaural( &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, NULL, -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND mcInput->reverb, -#endif mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { @@ -4748,19 +4696,14 @@ static ivas_error renderMcToBinauralRoom( const IVAS_REND_AudioConfig outConfig, IVAS_REND_AudioBuffer outAudio ) { -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND int8_t headRotEnabled; float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; IVAS_REND_AudioConfig inConfig; -#else - float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; -#endif ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; push_wmops( "renderMcToBinauralRoom" ); -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND headRotEnabled = mcInput->base.ctx.pHeadRotData->headRotEnabled; inConfig = mcInput->base.inConfig; @@ -4785,10 +4728,6 @@ static ivas_error renderMcToBinauralRoom( /* apply rotation */ if ( headRotEnabled ) -#else - /* apply rotation */ - if ( mcInput->base.ctx.pHeadRotData->headRotEnabled ) -#endif { tmpRotBuffer = mcInput->base.inputBuffer; tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); @@ -4805,42 +4744,26 @@ static ivas_error renderMcToBinauralRoom( return error; } -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND copyBufferTo2dArray( tmpRotBuffer, tmpRendBuffer ); -#else - copyBufferTo2dArray( tmpRotBuffer, tmpCrendBuffer ); -#endif free( tmpRotBuffer.data ); } else { -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); -#else - copyBufferTo2dArray( mcInput->base.inputBuffer, tmpCrendBuffer ); -#endif } /* call CREND */ if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND tmpRendBuffer, -#else - tmpCrendBuffer, -#endif *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } -#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND } accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); -#else - accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); -#endif /* TODO tmu : needs delay compensation */ if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) -- GitLab From 2342c56db814dc8be36f2c786bb5d6a46404c18f Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 16 Mar 2023 21:11:44 +0100 Subject: [PATCH 241/375] [cleanup] accept FIX_347_DTX_CRASH --- lib_com/options.h | 1 - lib_dec/ivas_core_dec.c | 8 -------- 2 files changed, 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 479b2a829b..be8fe4ee1a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -142,7 +142,6 @@ /*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define FIX_347_DTX_CRASH /* FhG: Fix crash that can happen with DTX */ #define DISABLE_RES_CHANNELS_MCT /* decode only W and residual for Y when outputting to stereo */ #define FIX_107_5MS_SUBFRAME_RENDERING #define REMOVE_FORCE_SUBFRAME_BIN /* Issue 355: remove obsolete "-force_subframe_bin" command-line option. */ diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 49429e0381..929e8187e7 100755 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -240,11 +240,7 @@ ivas_error ivas_core_dec( hCPE->hStereoCng->flag_cna_fade = 0; } -#ifdef FIX_347_DTX_CRASH if ( sba_dirac_stereo_flag && hSCE && sts[0]->total_brate <= SID_2k40 && sts[0]->cng_type == FD_CNG ) -#else - if ( sba_dirac_stereo_flag && sts[0]->total_brate <= SID_2k40 && sts[0]->cng_type == FD_CNG ) -#endif { save_hb_synth = hSCE->save_hb_synth; } @@ -461,11 +457,7 @@ ivas_error ivas_core_dec( /* for FD-CNG we need the delay compensation in the synth, so do this afterwards */ -#ifdef FIX_347_DTX_CRASH if ( sba_dirac_stereo_flag && hSCE && st->core_brate == SID_2k40 && st->cng_type == FD_CNG ) -#else - if ( sba_dirac_stereo_flag && st->core_brate == SID_2k40 && st->cng_type == FD_CNG ) -#endif { mvr2r( synth[n], hSCE->save_synth, output_frame ); } -- GitLab From 49049c0db14974020471565c59bdc4ec8ed1cdd7 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 16 Mar 2023 21:12:29 +0100 Subject: [PATCH 242/375] [cleanup] accept DISABLE_RES_CHANNELS_MCT --- lib_com/options.h | 1 - lib_dec/ivas_mct_dec.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index be8fe4ee1a..b45f22db61 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -142,7 +142,6 @@ /*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define DISABLE_RES_CHANNELS_MCT /* decode only W and residual for Y when outputting to stereo */ #define FIX_107_5MS_SUBFRAME_RENDERING #define REMOVE_FORCE_SUBFRAME_BIN /* Issue 355: remove obsolete "-force_subframe_bin" command-line option. */ diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index af3749d980..1e34ef397a 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -166,7 +166,6 @@ ivas_error ivas_mct_dec( /* MCT core decoder */ ivas_mct_core_dec( hMCT, st_ivas->hCPE, nCPE, output ); -#ifdef DISABLE_RES_CHANNELS_MCT /* for sba to stereo output disable any further processing for TCs > 2 as it is not needed*/ if ( st_ivas->sba_dirac_stereo_flag ) { @@ -178,7 +177,6 @@ ivas_error ivas_mct_dec( } } } -#endif /* MCT reconstruction and CoreCoder updates */ for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) -- GitLab From 8acccbbbb27060e3cb1346c3a52c959be388df9f Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 16 Mar 2023 21:13:32 +0100 Subject: [PATCH 243/375] [cleanup] accept REMOVE_FORCE_SUBFRAME_BIN, FIX_107_5MS_SUBFRAME_RENDERING --- apps/decoder.c | 33 -------------------- lib_com/options.h | 2 -- lib_dec/ivas_init_dec.c | 14 --------- lib_dec/ivas_stat_dec.h | 3 -- lib_dec/lib_dec.c | 16 ---------- lib_dec/lib_dec.h | 6 ---- lib_rend/ivas_dirac_dec_binaural_functions.c | 15 --------- lib_rend/lib_rend.c | 11 ------- 8 files changed, 100 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index af9a847aab..40f6b47b23 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -104,9 +104,6 @@ typedef struct char *renderConfigFilename; #ifdef DEBUGGING -#ifndef REMOVE_FORCE_SUBFRAME_BIN - bool forceSubframeBinauralization; -#endif IVAS_DEC_FORCED_REND_MODE forcedRendMode; #ifdef DEBUG_FOA_AGC FILE *agcBitstream; /* temporary */ @@ -303,23 +300,7 @@ int main( * Configure the decoder *------------------------------------------------------------------------------------------*/ -#ifdef REMOVE_FORCE_SUBFRAME_BIN - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled ) ) != IVAS_ERR_OK ) -#else -#ifdef DEBUGGING -#ifdef FIX_351_HRTF_COMMAND - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled, arg.forceSubframeBinauralization ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.forceSubframeBinauralization ) ) != IVAS_ERR_OK ) -#endif -#else -#ifdef FIX_351_HRTF_COMMAND if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation ) ) != IVAS_ERR_OK ) -#endif -#endif -#endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -710,9 +691,6 @@ static bool parseCmdlIVAS_dec( float ftmp; arg->forcedRendMode = IVAS_DEC_FORCE_REND_UNFORCED; -#ifndef REMOVE_FORCE_SUBFRAME_BIN - arg->forceSubframeBinauralization = false; -#endif #ifdef DEBUG_FOA_AGC arg->agcBitstream = NULL; #endif @@ -864,13 +842,6 @@ static bool parseCmdlIVAS_dec( i++; } } -#ifndef REMOVE_FORCE_SUBFRAME_BIN - else if ( strcmp( argv_to_upper, "-FORCE_SUBFRAME_BIN" ) == 0 ) /* Force binauralization to subframe (5 ms) resolution */ - { - arg->forceSubframeBinauralization = true; - i++; - } -#endif #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK /*-----------------------------------------------------------------* @@ -1120,10 +1091,6 @@ static void usage_dec( void ) fprintf( stdout, "-T File : Head rotation specified by external trajectory File\n" ); fprintf( stdout, "-hrtf File : HRTF filter File used in BINAURAL output configuration\n" ); #ifdef DEBUGGING -#ifndef REMOVE_FORCE_SUBFRAME_BIN - fprintf( stdout, "-force_subframe_bin : Forces parametric binauralizer code to use 5 ms time resolution even when\n" ); - fprintf( stdout, " output time resolution is larger.\n" ); -#endif fprintf( stdout, "-FEC X : Insert frame erasures, X = 0-10 is the percentage\n" ); fprintf( stdout, " of erased frames, or X may be the name of binary file or \n" ); fprintf( stdout, " file with G192 headers indicating GOOD FRAME or BAD FRAME\n" ); diff --git a/lib_com/options.h b/lib_com/options.h index b45f22db61..e482b2189e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -142,8 +142,6 @@ /*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define FIX_107_5MS_SUBFRAME_RENDERING -#define REMOVE_FORCE_SUBFRAME_BIN /* Issue 355: remove obsolete "-force_subframe_bin" command-line option. */ #define PARAM_ISM_DTX_CNG /* FhG: contribution 9 - DTX-CNG for ParamISM */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index e66e5915d8..1c1a44ea53 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2053,20 +2053,6 @@ static ivas_error doSanityChecks_IVAS( } #ifdef DEBUGGING -#ifndef REMOVE_FORCE_SUBFRAME_BIN - if ( st_ivas->hDecoderConfig->forceSubframeBinauralization ) - { - /* Note about resolution of Binaural Renderers: * - * - Parametric Binaural Renderer: 20 ms by default, can be forced to subframe (5 ms) resolution * - * - FastConv Binaural Renderer: 5 ms by default * - * - TD objects Binaural Renderer: 20 ms by default */ - - if ( !( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM ) || !( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MC_FORMAT || st_ivas->ivas_format == ISM_FORMAT ) ) - { - return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Wrong set-up: Forced subframe resolution parametric binauralization activated for non-binaural output." ); - } - } -#endif if ( ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) && ( ( st_ivas->ivas_format != MC_FORMAT && st_ivas->ivas_format != ISM_FORMAT ) || output_config != AUDIO_CONFIG_BINAURAL || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCT ) ) ) { return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration: Time Domain object renderer not supported in this configuration" ); diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 1cef5cb3c0..fa61493818 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1154,9 +1154,6 @@ typedef struct decoder_config_structure /* temp. development parameters */ #ifdef DEBUGGING -#ifndef REMOVE_FORCE_SUBFRAME_BIN - int16_t forceSubframeBinauralization; /* Flag for forcing Parametric binauralizer to subframe mode */ -#endif int16_t force_rend; /* forced TD/CLDFB binaural renderer (for ISM and MC) */ #endif diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 95f7dca8a7..d10b6d79d5 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -225,11 +225,6 @@ static void init_decoder_config( hDecoderConfig->Opt_Headrotation = 0; #ifdef FIX_351_HRTF_COMMAND hDecoderConfig->Opt_RendConfigCustom = 0; -#endif -#ifndef REMOVE_FORCE_SUBFRAME_BIN -#ifdef DEBUGGING - hDecoderConfig->forceSubframeBinauralization = 0; -#endif #endif hDecoderConfig->orientation_tracking = orientation_tracking; hDecoderConfig->no_diegetic_pan = no_diegetic_pan; @@ -399,12 +394,6 @@ ivas_error IVAS_DEC_Configure( , const int16_t renderConfigEnabled /* i : enable Renderer config. file for binaural output */ #endif -#ifndef REMOVE_FORCE_SUBFRAME_BIN -#ifdef DEBUGGING - , - const int16_t forceSubframeBinauralization /* i : enable subframe binauralization */ -#endif -#endif ) { Decoder_Struct *st_ivas; @@ -450,11 +439,6 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->nchan_out = audioCfg2channels( hDecoderConfig->output_config ); } -#ifndef REMOVE_FORCE_SUBFRAME_BIN -#ifdef DEBUGGING - hDecoderConfig->forceSubframeBinauralization = forceSubframeBinauralization; -#endif -#endif hDecoderConfig->Opt_LsCustom = customLsOutputEnabled; hDecoderConfig->Opt_Headrotation = enableHeadRotation; hDecoderConfig->Opt_HRTF_binary = hrtfReaderEnabled; diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 36dab5c1f9..c0d74b077b 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -134,12 +134,6 @@ ivas_error IVAS_DEC_Configure( ,const int16_t renderConfigEnabled /* i : enable Renderer config. file for binaural output */ #endif -#ifndef REMOVE_FORCE_SUBFRAME_BIN -#ifdef DEBUGGING - , - const int16_t forceSubframeBinauralization /* i : enable subframe binauralization */ -#endif -#endif ); void IVAS_DEC_Close( diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 020dd27cfa..ebd7c737a2 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -139,22 +139,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( set_zero( hBinaural->ChCrossImOutPrev, nBins ); hBinaural->renderStereoOutputInsteadOfBinaural = 0; -#ifdef FIX_107_5MS_SUBFRAME_RENDERING hBinaural->useSubframeMode = 1; -#else - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) /* Use subframe-mode with SPAR, since the metadata is not in sync on a frame level */ - { - hBinaural->useSubframeMode = 1; - } - else - { -#ifdef DEBUGGING - hBinaural->useSubframeMode = st_ivas->hDecoderConfig->forceSubframeBinauralization; -#else - hBinaural->useSubframeMode = 0; /* Default to 20 ms mode. */ -#endif - } -#endif hBinaural->useTdDecorr = 0; if ( st_ivas->ivas_format == SBA_FORMAT ) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index eae8c6d0d0..63b79cf2af 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2237,9 +2237,6 @@ static ivas_error initMasaDummyDecForMcOut( { return error; } -#ifndef FIX_107_5MS_SUBFRAME_RENDERING - decDummy->hDiracDecBin->useSubframeMode = 0; /* Todo Nokia: This will disappear in later work but needs to be this now. */ -#endif } numCldfbAnalyses = decDummy->nchan_transport; @@ -2372,11 +2369,6 @@ static ivas_error initMasaDummyDecForBinauralOut( } decDummy->ivas_format = MASA_FORMAT; decDummy->transport_config = AUDIO_CONFIG_INVALID; -#ifndef REMOVE_FORCE_SUBFRAME_BIN -#ifdef DEBUGGING - decDummy->hDecoderConfig->forceSubframeBinauralization = 0; -#endif -#endif if ( ( error = ivas_dirac_dec_open( decDummy ) ) != IVAS_ERR_OK ) { @@ -2393,9 +2385,6 @@ static ivas_error initMasaDummyDecForBinauralOut( return error; } -#ifndef FIX_107_5MS_SUBFRAME_RENDERING - decDummy->hDiracDecBin->useSubframeMode = 0; /* Todo Nokia: This will disappear in later work but needs to be this now. */ -#endif for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { -- GitLab From 7e2c9ae2534c5f482584c47853506ff6b7265cfa Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 16 Mar 2023 21:14:24 +0100 Subject: [PATCH 244/375] [cleanup] accept PARAM_ISM_DTX_CNG --- lib_com/ivas_cnst.h | 8 ---- lib_com/ivas_prot.h | 4 -- lib_com/options.h | 1 - lib_com/prot.h | 4 -- lib_dec/acelp_core_dec.c | 14 ------ lib_dec/fd_cng_dec.c | 37 ---------------- lib_dec/init_dec.c | 2 - lib_dec/ivas_core_dec.c | 4 -- lib_dec/ivas_dec.c | 2 - lib_dec/ivas_init_dec.c | 6 --- lib_dec/ivas_ism_dec.c | 2 - lib_dec/ivas_ism_dtx_dec.c | 2 - lib_dec/ivas_ism_metadata_dec.c | 2 - lib_dec/ivas_ism_param_dec.c | 77 --------------------------------- lib_dec/ivas_sce_dec.c | 10 ----- lib_dec/ivas_stat_dec.h | 4 -- lib_dec/ivas_tcx_core_dec.c | 6 --- lib_dec/stat_dec.h | 2 - lib_enc/acelp_core_enc.c | 4 -- lib_enc/fd_cng_enc.c | 4 -- lib_enc/init_enc.c | 6 --- lib_enc/ivas_cpe_enc.c | 4 -- lib_enc/ivas_init_enc.c | 6 --- lib_enc/ivas_ism_dtx_enc.c | 2 - lib_enc/ivas_ism_enc.c | 45 ------------------- lib_enc/ivas_ism_param_enc.c | 2 - lib_enc/ivas_sce_enc.c | 4 -- lib_enc/ivas_spar_encoder.c | 4 -- lib_enc/ivas_stat_enc.h | 4 -- lib_enc/ivas_tcx_core_enc.c | 4 -- lib_enc/lib_enc.c | 11 ----- lib_enc/rst_enc.c | 4 -- 32 files changed, 291 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 04e11c4656..b382b66600 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -333,11 +333,9 @@ typedef enum #define PARAM_ISM_MAX_CHAN 16 #define PARAM_ISM_HYS_BUF_SIZE 10 -#ifdef PARAM_ISM_DTX_CNG #define PARAM_ISM_DTX_COH_SCA_BITS 4 #define PARAM_ISM_DTX_AZI_BITS 5 #define PARAM_ISM_DTX_ELE_BITS 4 -#endif typedef enum { @@ -353,18 +351,12 @@ enum IND_ISM_NUM_OBJECTS, IND_ISM_METADATA_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS, IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS, -#ifdef PARAM_ISM_DTX_CNG IND_ISM_SCE_ID_DTX = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS, IND_ISM_NOISY_SPEECH_FLAG, IND_ISM_DTX_COH_SCA, -#endif /* ------------- loop for objects -------------- */ -#ifdef PARAM_ISM_DTX_CNG TAG_ISM_LOOP_START = IND_ISM_DTX_COH_SCA + MAX_NUM_OBJECTS, -#else - TAG_ISM_LOOP_START = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS, - #endif IND_ISM_AZIMUTH_DIFF_FLAG = TAG_ISM_LOOP_START, IND_ISM_AZIMUTH = TAG_ISM_LOOP_START, IND_ISM_ELEVATION_DIFF_FLAG = TAG_ISM_LOOP_START, diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 8982d3d4d6..9ed187ca42 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -500,11 +500,9 @@ void stereo_tcx_core_dec( const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ const int16_t nchan_out /* i : number of output channels */ -#ifdef PARAM_ISM_DTX_CNG , const IVAS_FORMAT ivas_format, /* i : IVAS format */ const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM) */ -#endif ); void stereo_tcx_init_dec( @@ -892,7 +890,6 @@ void ivas_param_ism_params_to_masa_param_mapping( ); -#ifdef PARAM_ISM_DTX_CNG /*----------------------------------------------------------------------------------* * ISM DTX prototypes *----------------------------------------------------------------------------------*/ @@ -940,7 +937,6 @@ void ivas_ism_coh_estim_dtx_enc( const int16_t nchan_transport, /* i : number of transport channels */ const int16_t input_frame /* i : input frame length */ ); -#endif /*----------------------------------------------------------------------------------* * DFT Stereo prototypes diff --git a/lib_com/options.h b/lib_com/options.h index e482b2189e..fa106a83c5 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -143,7 +143,6 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define PARAM_ISM_DTX_CNG /* FhG: contribution 9 - DTX-CNG for ParamISM */ #define FIX_331_SBA_HBR_HOA_FIXES /* DLB: issue 331 - fix addressing low frequency stuttering with HOA inputs at high bitrates */ #ifdef FIX_331_SBA_HBR_HOA_FIXES diff --git a/lib_com/prot.h b/lib_com/prot.h index 16d069759f..69cc4e0d32 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -2229,10 +2229,8 @@ ivas_error init_encoder( const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ const int16_t interval_SID, /* i : interval for SID update */ const int16_t vad_only_flag /* i : flag to indicate front-VAD structure */ -#ifdef PARAM_ISM_DTX_CNG , const ISM_MODE ism_mode /* i : ISM mode */ -#endif ); void LPDmem_enc_init( @@ -8524,10 +8522,8 @@ void generate_comfort_noise_dec_hf( float **bufferReal, /* o : Real part of input bands */ float **bufferImag, /* o : Imaginary part of input bands */ HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ -#ifdef PARAM_ISM_DTX_CNG , const int16_t cng_flag /*i : CNG Flag */ -#endif ); void generate_masking_noise( diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index 571311ed12..b0d30e88dd 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -512,11 +512,7 @@ ivas_error acelp_core_dec( } else { -#ifdef PARAM_ISM_DTX_CNG if ( st->core_brate == SID_2k40 && st->element_mode != IVAS_CPE_MDCT && st->read_sid_info ) -#else - if ( st->core_brate == SID_2k40 && st->element_mode != IVAS_CPE_MDCT ) -#endif { FdCng_decodeSID( st ); *sid_bw = 0; @@ -532,7 +528,6 @@ ivas_error acelp_core_dec( } ApplyFdCng( syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); } -#ifdef PARAM_ISM_DTX_CNG if ( !st->read_sid_info ) // if (!st->read_sid_info && st->cng_paramISM_flag) /* read_sid_info can only be 0 in ParamISM mode */ { @@ -544,7 +539,6 @@ ivas_error acelp_core_dec( st->hFdCngDec->hFdCngCom->cngNoiseLevel[b] = noise_lvl_highest; } } -#endif generate_comfort_noise_dec( NULL, NULL, st, nchan_out ); @@ -1131,11 +1125,7 @@ ivas_error acelp_core_dec( st->lp_noise = st->hFdCngDec->lp_noise; } -#ifdef PARAM_ISM_DTX_CNG if ( st->element_mode != IVAS_CPE_TD && !st->cng_paramISM_flag ) -#else - if ( st->element_mode != IVAS_CPE_TD ) -#endif { /*Noise estimate*/ ApplyFdCng( syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); @@ -1311,11 +1301,7 @@ ivas_error acelp_core_dec( /*WB/SWB-FD_CNG*/ if ( ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && ( st->cng_type == FD_CNG ) && ( st->hFdCngDec->hFdCngCom->numCoreBands < st->cldfbSyn->no_channels ) ) { -#ifdef PARAM_ISM_DTX_CNG generate_comfort_noise_dec_hf( realBuffer, imagBuffer, st->hFdCngDec->hFdCngCom, st->cng_paramISM_flag ); -#else - generate_comfort_noise_dec_hf( realBuffer, imagBuffer, st->hFdCngDec->hFdCngCom ); -#endif if ( st->hFdCngDec->hFdCngCom->regularStopBand < st->cldfbSyn->no_channels ) { diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 515188369c..0620b09d5f 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -1091,11 +1091,7 @@ void generate_comfort_noise_dec( c2 = (float) sqrt( 1 - hFdCngCom->coherence ); seed2 = &( hFdCngCom->seed2 ); -#ifdef PARAM_ISM_DTX_CNG if ( ( st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 ) || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) -#else - if ( st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 ) -#endif { seed2 = &( hFdCngCom->seed3 ); } @@ -1105,11 +1101,7 @@ void generate_comfort_noise_dec( if ( hFdCngCom->startBand == 0 ) { -#ifdef PARAM_ISM_DTX_CNG if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) -#else - if ( st->element_mode == IVAS_CPE_MDCT ) -#endif { rand_gauss( &tmp1, seed ); rand_gauss( &tmp2, seed2 ); @@ -1134,11 +1126,7 @@ void generate_comfort_noise_dec( for ( ; ptr_level < cngNoiseLevel + hFdCngCom->stopFFTbin - hFdCngCom->startBand; ptr_level++ ) { /* Real part in FFT bins */ -#ifdef PARAM_ISM_DTX_CNG if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) -#else - if ( st->element_mode == IVAS_CPE_MDCT ) -#endif { rand_gauss( &tmp1, seed ); rand_gauss( &tmp2, seed2 ); @@ -1152,11 +1140,7 @@ void generate_comfort_noise_dec( ptr_r += 2; /* Imaginary part in FFT bins */ -#ifdef PARAM_ISM_DTX_CNG if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) -#else - if ( st->element_mode == IVAS_CPE_MDCT ) -#endif { rand_gauss( &tmp1, seed ); rand_gauss( &tmp2, seed2 ); @@ -1234,11 +1218,7 @@ void generate_comfort_noise_dec( for ( i = 0; i < hFdCngCom->numSlots; i++ ) { /* Real part in CLDFB band */ -#ifdef PARAM_ISM_DTX_CNG if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) -#else - if ( st->element_mode == IVAS_CPE_MDCT ) -#endif { rand_gauss( &tmp1, seed ); rand_gauss( &tmp2, seed2 ); @@ -1251,11 +1231,7 @@ void generate_comfort_noise_dec( bufferReal[i][j] *= (float) sqrt( ( scaleCldfb * *ptr_level ) * 0.5f ); /* Imaginary part in CLDFB band */ -#ifdef PARAM_ISM_DTX_CNG if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) -#else - if ( st->element_mode == IVAS_CPE_MDCT ) -#endif { rand_gauss( &tmp1, seed ); rand_gauss( &tmp2, seed2 ); @@ -1355,10 +1331,8 @@ void generate_comfort_noise_dec_hf( float **bufferReal, /* o : Real part of input bands */ float **bufferImag, /* o : Imaginary part of input bands */ HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ -#ifdef PARAM_ISM_DTX_CNG , const int16_t cng_coh_flag /* i : CNG Flag for coherence handling */ -#endif ) { int16_t i, j; @@ -1367,7 +1341,6 @@ void generate_comfort_noise_dec_hf( int16_t *seed = &( hFdCngCom->seed ); float scale = CLDFB_SCALING / hFdCngCom->scalingFactor; -#ifdef PARAM_ISM_DTX_CNG int16_t *seed2 = &( hFdCngCom->seed ); float tmp1, tmp2, c1 = 0.f, c2 = 0.f; @@ -1378,7 +1351,6 @@ void generate_comfort_noise_dec_hf( c1 = (float) sqrt( hFdCngCom->coherence ); c2 = (float) sqrt( 1 - hFdCngCom->coherence ); } -#endif ptr_level = hFdCngCom->cngNoiseLevel + hFdCngCom->stopFFTbin - hFdCngCom->startBand; /* @@ -1391,7 +1363,6 @@ void generate_comfort_noise_dec_hf( { for ( i = 0; i < hFdCngCom->numSlots; i++ ) { -#ifdef PARAM_ISM_DTX_CNG if ( cng_coh_flag ) { /* Real part in CLDFB band */ @@ -1415,14 +1386,6 @@ void generate_comfort_noise_dec_hf( rand_gauss( &bufferImag[i][j], seed ); bufferImag[i][j] *= (float) sqrt( ( scale * *ptr_level ) * 0.5f ); } -#else - /* Real part in CLDFB band */ - rand_gauss( &bufferReal[i][j], seed ); - bufferReal[i][j] *= (float) sqrt( ( scale * *ptr_level ) * 0.5f ); - /* Imaginary part in CLDFB band */ - rand_gauss( &bufferImag[i][j], seed ); - bufferImag[i][j] *= (float) sqrt( ( scale * *ptr_level ) * 0.5f ); -#endif } ptr_level++; } diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 402fdc78f5..ca3c88b8d1 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -738,10 +738,8 @@ ivas_error init_decoder( st->tdm_LRTD_flag = 0; st->cna_dirac_flag = 0; st->cng_sba_flag = 0; -#ifdef PARAM_ISM_DTX_CNG st->cng_paramISM_flag = 0; st->read_sid_info = 1; /* by default read the sid info from bitstream */ -#endif return error; diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 929e8187e7..f1a897351f 100755 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -341,11 +341,7 @@ ivas_error ivas_core_dec( if ( ( st->core == TCX_20_CORE || st->core == TCX_10_CORE ) && st->element_mode != IVAS_CPE_MDCT ) { /* TCX decoder */ -#ifdef PARAM_ISM_DTX_CNG stereo_tcx_core_dec( st, frameMode[n], output[n], synth[n], pitch_buf[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format, st_ivas == NULL ? 0 : st_ivas->ism_mode ); -#else - stereo_tcx_core_dec( st, frameMode[n], output[n], synth[n], pitch_buf[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out ); -#endif } if ( st->core == HQ_CORE ) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 38486a340b..b51eacd1ba 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -140,7 +140,6 @@ ivas_error ivas_dec( else if ( st_ivas->ivas_format == ISM_FORMAT ) { /* Metadata decoding and configuration */ -#ifdef PARAM_ISM_DTX_CNG if ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) { if ( ( error = ivas_ism_dtx_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) @@ -149,7 +148,6 @@ ivas_error ivas_dec( } } else -#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 1c1a44ea53..70768d6e0f 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -402,7 +402,6 @@ static ivas_error ivas_read_format( break; case SID_ISM: st_ivas->ivas_format = ISM_FORMAT; -#ifdef PARAM_ISM_DTX_CNG if ( st_ivas->ism_mode == ISM_MODE_DISC ) { @@ -413,9 +412,6 @@ static ivas_error ivas_read_format( { ivas_ism_dec_config( st_ivas, st_ivas->nSCE ); /* for Param-ISM, we need to generate 2 TCs */ } -#else - ivas_ism_dec_config( st_ivas, 1 ); /* currently DTX supported for 1ISM only */ -#endif break; case SID_MULTICHANNEL: st_ivas->ivas_format = MC_FORMAT; @@ -837,12 +833,10 @@ ivas_error ivas_init_decoder( reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); } -#ifdef PARAM_ISM_DTX_CNG if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { st_ivas->hSCE[1]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed3 = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed2; } -#endif } else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) { diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 6babce65b4..28a36d36d4 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -293,13 +293,11 @@ ivas_error ivas_ism_dec_config( } else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { -#ifdef PARAM_ISM_DTX_CNG if ( last_ism_mode == ISM_MODE_PARAM ) { nchan_transport_old = MAX_PARAM_ISM_WAVE; } else -#endif { st_ivas->nchan_transport = num_obj; } diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index bd15569f9e..b9d00792df 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -40,7 +40,6 @@ #include "wmc_auto.h" -#ifdef PARAM_ISM_DTX_CNG /*-------------------------------------------------------------------* * ivas_ism_preprocessing() * @@ -170,4 +169,3 @@ ivas_error ivas_ism_dtx_dec( return IVAS_ERR_OK; } -#endif diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 53c1e9d2e9..b60f66bdfb 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -502,12 +502,10 @@ ivas_error ivas_ism_metadata_dec( hSCE[ch]->hCoreCoder[0]->bit_stream = hSCE[ch - 1]->hCoreCoder[0]->bit_stream + ( hSCE[ch - 1]->hCoreCoder[0]->total_brate / FRAMES_PER_SEC ); } -#ifdef PARAM_ISM_DTX_CNG for ( ch = 0; ch < *nchan_transport; ch++ ) { hSCE[ch]->hCoreCoder[0]->cng_paramISM_flag = 0; } -#endif pop_wmops(); diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 81a4744726..43ae3cf072 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -158,9 +158,7 @@ static void ivas_ism_get_proto_matrix( static void ivas_param_ism_compute_mixing_matrix( DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ -#ifdef PARAM_ISM_DTX_CNG ISM_DTX_DATA_DEC hISMDTX, /* i : ISM DTX handle */ -#endif float Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float direct_response[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN], @@ -188,11 +186,7 @@ static void ivas_param_ism_compute_mixing_matrix( assert( ( hDirAC->hParamIsm->num_obj == 3 ) || ( hDirAC->hParamIsm->num_obj == 4 ) ); assert( nchan_transport == 2 ); -#ifdef PARAM_ISM_DTX_CNG if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) -#else - if ( hDirAC->hParamIsm->flag_noisy_speech ) -#endif { num_wave = hDirAC->hParamIsm->num_obj; } @@ -214,11 +208,7 @@ static void ivas_param_ism_compute_mixing_matrix( { set_zero( cy_diag_tmp[w], nchan_out_woLFE ); -#ifdef PARAM_ISM_DTX_CNG if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) -#else - if ( hDirAC->hParamIsm->flag_noisy_speech ) -#endif { dir_res_ptr = direct_response[w]; } @@ -257,11 +247,7 @@ static void ivas_param_ism_compute_mixing_matrix( set_zero( cy_diag, nchan_out_woLFE ); for ( w = 0; w < num_wave; w++ ) { -#ifdef PARAM_ISM_DTX_CNG if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) -#else - if ( hDirAC->hParamIsm->flag_noisy_speech ) -#endif { direct_power[w] = ( 1.0f / hDirAC->hParamIsm->num_obj ) * ref_power; } @@ -619,9 +605,7 @@ ivas_error ivas_param_ism_dec_open( } } -#ifdef PARAM_ISM_DTX_CNG st_ivas->hISMDTX.dtx_flag = 0; -#endif st_ivas->hDirAC = hDirAC; @@ -817,9 +801,7 @@ void ivas_param_ism_dec( { int16_t ch, nchan_transport, nchan_out, nchan_out_woLFE, i; int16_t subframe_idx, slot_idx, index_slot, bin_idx; -#ifdef PARAM_ISM_DTX_CNG int32_t ivas_total_brate; -#endif /* CLDFB Input Buffers */ float Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; @@ -856,9 +838,7 @@ void ivas_param_ism_dec( nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; } -#ifdef PARAM_ISM_DTX_CNG ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; -#endif hSetup = st_ivas->hIntSetup; @@ -866,7 +846,6 @@ void ivas_param_ism_dec( /* Frame-level Processing */ /* De-quantization */ -#ifdef PARAM_ISM_DTX_CNG if ( !( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) ) { ivas_param_ism_dec_dequant_DOA( hDirAC ); @@ -877,10 +856,6 @@ void ivas_param_ism_dec( { st_ivas->hISMDTX.dtx_flag = 1; } -#else - ivas_param_ism_dec_dequant_DOA( hDirAC ); - ivas_param_ism_dec_dequant_powrat( hDirAC ); -#endif /* obtain the direct response using EFAP */ if ( !( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) ) @@ -943,11 +918,7 @@ void ivas_param_ism_dec( } /* Compute mixing matrix */ -#ifdef PARAM_ISM_DTX_CNG ivas_param_ism_compute_mixing_matrix( hDirAC, st_ivas->hISMDTX, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, direct_response, nchan_transport, nchan_out_woLFE, 0, CLDFB_NO_COL_MAX, mixing_matrix ); -#else - ivas_param_ism_compute_mixing_matrix( hDirAC, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, direct_response, nchan_transport, nchan_out_woLFE, 0, CLDFB_NO_COL_MAX, mixing_matrix ); -#endif /* subframe loop for synthesis*/ for ( subframe_idx = 0; subframe_idx < hDirAC->nb_subframes; subframe_idx++ ) @@ -1053,14 +1024,11 @@ void ivas_param_ism_params_to_masa_param_mapping( int16_t azimuth[2]; int16_t elevation[2]; float power_ratio[2]; -#ifdef PARAM_ISM_DTX_CNG int32_t ivas_total_brate; -#endif hDirAC = st_ivas->hDirAC; nBins = hDirAC->num_freq_bands; -#ifdef PARAM_ISM_DTX_CNG ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; if ( !( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) ) @@ -1073,14 +1041,9 @@ void ivas_param_ism_params_to_masa_param_mapping( { st_ivas->hISMDTX.dtx_flag = 1; } -#else - ivas_param_ism_dec_dequant_DOA( hDirAC ); - ivas_param_ism_dec_dequant_powrat( hDirAC ); -#endif if ( hDirAC->hParamIsm->num_obj > 1 ) { -#ifdef PARAM_ISM_DTX_CNG if ( st_ivas->hISMDTX.dtx_flag ) { float energy_ratio; @@ -1142,44 +1105,6 @@ void ivas_param_ism_params_to_masa_param_mapping( } } } -#else - hDirAC->numSimultaneousDirections = 2; - for ( band_idx = 0; band_idx < hDirAC->hParamIsm->nbands; band_idx++ ) - { - brange[0] = hDirAC->hParamIsm->band_grouping[band_idx]; - brange[1] = hDirAC->hParamIsm->band_grouping[band_idx + 1]; - - azimuth[0] = (int16_t) roundf( hDirAC->azimuth_values[hDirAC->hParamIsm->obj_indices[band_idx][0][0]] ); - elevation[0] = (int16_t) roundf( hDirAC->elevation_values[hDirAC->hParamIsm->obj_indices[band_idx][0][0]] ); - power_ratio[0] = hDirAC->power_ratios[band_idx][0][0]; - - azimuth[1] = (int16_t) roundf( hDirAC->azimuth_values[hDirAC->hParamIsm->obj_indices[band_idx][0][1]] ); - elevation[1] = (int16_t) roundf( hDirAC->elevation_values[hDirAC->hParamIsm->obj_indices[band_idx][0][1]] ); - power_ratio[1] = hDirAC->power_ratios[band_idx][0][1]; - - for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) - { - for ( bin_idx = brange[0]; bin_idx < brange[1]; bin_idx++ ) - { - hDirAC->azimuth[sf_idx][bin_idx] = azimuth[0]; - hDirAC->elevation[sf_idx][bin_idx] = elevation[0]; - hDirAC->energy_ratio1[sf_idx][bin_idx] = power_ratio[0]; - hDirAC->azimuth2[sf_idx][bin_idx] = azimuth[1]; - hDirAC->elevation2[sf_idx][bin_idx] = elevation[1]; - hDirAC->energy_ratio2[sf_idx][bin_idx] = power_ratio[1]; - } - } - } - for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) - { - for ( bin_idx = 0; bin_idx < nBins; bin_idx++ ) - { - hDirAC->spreadCoherence[sf_idx][bin_idx] = 0.0f; - hDirAC->spreadCoherence2[sf_idx][bin_idx] = 0.0f; - hDirAC->surroundingCoherence[sf_idx][bin_idx] = 0.0; - } - } -#endif } else { @@ -1203,7 +1128,6 @@ void ivas_param_ism_params_to_masa_param_mapping( } -#ifdef PARAM_ISM_DTX_CNG static void ivas_param_ism_dec_dequantize_DOA_dtx( int16_t azi_bits, int16_t ele_bits, @@ -1334,4 +1258,3 @@ void ivas_param_ism_metadata_dtx_dec( return; } -#endif diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index ac948a59c4..228a6e7b3a 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -77,12 +77,10 @@ ivas_error ivas_sce_dec( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate; -#ifdef PARAM_ISM_DTX_CNG if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { st->cng_type = FD_CNG; /* TODO: move to init if possible */ } -#endif /*------------------------------------------------------------------* * Read audio bandwidth info @@ -100,15 +98,11 @@ ivas_error ivas_sce_dec( } else if ( !st_ivas->bfi && ( last_ivas_total_brate <= SID_2k40 || last_ivas_total_brate == IVAS_SID_5k2 ) ) { -#ifdef PARAM_ISM_DTX_CNG /* check if this is indeed needed? */ if ( st_ivas->ivas_format != ISM_FORMAT ) { st->total_brate = hSCE->element_brate - nb_bits_metadata * FRAMES_PER_SEC; } -#else - st->total_brate = hSCE->element_brate - nb_bits_metadata * FRAMES_PER_SEC; -#endif } /* read the bandwidth */ @@ -229,11 +223,7 @@ ivas_error ivas_sce_dec( * Decoder *----------------------------------------------------------------*/ -#ifdef PARAM_ISM_DTX_CNG if ( ( error = ivas_core_dec( st_ivas, hSCE, NULL, NULL, 1, output, outputHB, NULL, st_ivas->sba_dirac_stereo_flag ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_core_dec( NULL, hSCE, NULL, NULL, 1, output, outputHB, NULL, st_ivas->sba_dirac_stereo_flag ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index fa61493818..5243763844 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -382,7 +382,6 @@ typedef struct stereo_icbwe_dec_data_structure } STEREO_ICBWE_DEC_DATA, *STEREO_ICBWE_DEC_HANDLE; -#ifdef PARAM_ISM_DTX_CNG /*----------------------------------------------------------------------------------* * ISM DTX structure *----------------------------------------------------------------------------------*/ @@ -393,7 +392,6 @@ typedef struct int16_t sce_id_dtx; } ISM_DTX_DATA_DEC; -#endif /*----------------------------------------------------------------------------------* * DirAC decoder structure @@ -1203,9 +1201,7 @@ typedef struct Decoder_Struct /* multichannel modules */ ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS]; /* ISM metadata handles (storage for one frame of read ISM metadata) */ -#ifdef PARAM_ISM_DTX_CNG ISM_DTX_DATA_DEC hISMDTX; /* ISM DTX structure */ -#endif ISM_RENDERER_HANDLE hIsmRendererData; /* ISM renderer handle */ DIRAC_DEC_HANDLE hDirAC; /* DirAC handle */ SPAR_DEC_HANDLE hSpar; /* SPAR handle */ diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 378ddec9aa..b8d96233db 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -161,11 +161,9 @@ void stereo_tcx_core_dec( const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ const int16_t nchan_out /* i : number of output channels */ -#ifdef PARAM_ISM_DTX_CNG , const IVAS_FORMAT ivas_format, /* i : IVAS format */ const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM) */ -#endif ) { int16_t i, k; @@ -729,7 +727,6 @@ void stereo_tcx_core_dec( if ( st->element_mode != IVAS_CPE_TD ) { -#ifdef PARAM_ISM_DTX_CNG if ( ivas_format == ISM_FORMAT && ism_mode == ISM_MODE_PARAM ) { float buffer[L_FRAME16k]; @@ -740,9 +737,6 @@ void stereo_tcx_core_dec( { ApplyFdCng( signal_out, NULL, NULL, NULL, st, st->bfi, 0 ); } -#else - ApplyFdCng( signal_out, NULL, NULL, NULL, st, st->bfi, 0 ); -#endif } /* Generate additional comfort noise to mask potential coding artefacts */ diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 0950b529f6..9ba901352c 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1345,10 +1345,8 @@ typedef struct Decoder_State /* MCT Channel mode indication: LFE, ignore channel? */ MCT_CHAN_MODE mct_chan_mode; -#ifdef PARAM_ISM_DTX_CNG int16_t cng_paramISM_flag; /* CNG in Param-ISM flag */ int16_t read_sid_info; /* For ParamISM, use the transmitted noise */ -#endif } Decoder_State, *DEC_CORE_HANDLE; diff --git a/lib_enc/acelp_core_enc.c b/lib_enc/acelp_core_enc.c index 272d36fb9c..48cdb5c536 100644 --- a/lib_enc/acelp_core_enc.c +++ b/lib_enc/acelp_core_enc.c @@ -314,17 +314,13 @@ ivas_error acelp_core_enc( if ( st->core_brate == SID_2k40 ) { -#ifdef PARAM_ISM_DTX_CNG if ( st->hTdCngEnc != NULL ) { -#endif tmpF = cng_energy( st->element_mode, st->bwidth, st->hDtxEnc->CNG_mode, st->hTdCngEnc->CNG_att, exc, st->L_frame ); i = (int16_t) ( ( tmpF + 2.0f ) * STEP_SID ); i = min( max( i, 0 ), 127 ); st->hTdCngEnc->old_enr_index = i; -#ifdef PARAM_ISM_DTX_CNG } -#endif } } diff --git a/lib_enc/fd_cng_enc.c b/lib_enc/fd_cng_enc.c index 5789f0dfd9..e43b65d56a 100644 --- a/lib_enc/fd_cng_enc.c +++ b/lib_enc/fd_cng_enc.c @@ -708,18 +708,14 @@ void generate_comfort_noise_enc( /* Perform STFT synthesis */ SynthesisSTFT( fftBuffer, timeDomainOutput, hFdCngCom->olapBufferSynth, hFdCngCom->olapWinSyn, tcx_transition, hFdCngCom, -1, -1 ); -#ifdef PARAM_ISM_DTX_CNG if ( st->hTdCngEnc != NULL ) { -#endif /* update CNG excitation energy for LP_CNG */ /* calculate the residual signal energy */ enr = cng_energy( st->element_mode, st->bwidth, st->hDtxEnc->CNG_mode, st->hTdCngEnc->CNG_att, hFdCngCom->exc_cng, hFdCngCom->frameSize ); st->hTdCngEnc->lp_ener = (float) ( 0.8f * st->hTdCngEnc->lp_ener + 0.2f * pow( 2.0f, enr ) ); -#ifdef PARAM_ISM_DTX_CNG } -#endif /* Overlap-add when previous frame is active */ if ( st->last_core_brate > SID_2k40 && st->codec_mode == MODE2 ) diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 683356c6c0..7019beca8e 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -59,10 +59,8 @@ ivas_error init_encoder( const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ const int16_t interval_SID, /* i : interval for SID update */ const int16_t vad_only_flag /* i : flag to indicate front-VAD structure */ -#ifdef PARAM_ISM_DTX_CNG , const ISM_MODE ism_mode /* i : ISM mode */ -#endif ) { int16_t i; @@ -466,11 +464,7 @@ ivas_error init_encoder( * LP-CNG *-----------------------------------------------------------------*/ -#ifdef PARAM_ISM_DTX_CNG if ( ( ( idchan == 0 && st->Opt_DTX_ON && st->element_mode != IVAS_CPE_MDCT ) || st->element_mode == EVS_MONO ) && !( ism_mode == ISM_MODE_PARAM ) ) -#else - if ( ( ( idchan == 0 && st->Opt_DTX_ON && st->element_mode != IVAS_CPE_MDCT ) || st->element_mode == EVS_MONO ) ) -#endif { if ( ( st->hTdCngEnc = (TD_CNG_ENC_HANDLE) malloc( sizeof( TD_CNG_ENC_DATA ) ) ) == NULL ) { diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 323d99ae3a..f9b787ac56 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -832,11 +832,7 @@ ivas_error create_cpe_enc( st->mct_chan_mode = MCT_CHAN_MODE_LFE; } -#ifdef PARAM_ISM_DTX_CNG if ( ( error = init_encoder( st, n, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) -#else - if ( ( error = init_encoder( st, n, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index c729511e70..2fadc22637 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -276,10 +276,8 @@ void ivas_initialize_handles_enc( st_ivas->hIsmMetaData[i] = NULL; } -#ifdef PARAM_ISM_DTX_CNG /* ISM DTX handle */ st_ivas->hISMDTX = NULL; -#endif /* Q Metadata handle */ st_ivas->hQMetaData = NULL; @@ -437,7 +435,6 @@ ivas_error ivas_init_encoder( } } -#ifdef PARAM_ISM_DTX_CNG if ( st_ivas->hEncoderConfig->Opt_DTX_ON && st_ivas->ism_mode == ISM_MODE_PARAM ) { if ( ( error = ivas_ism_dtx_open( st_ivas ) ) != IVAS_ERR_OK ) @@ -445,7 +442,6 @@ ivas_error ivas_init_encoder( return error; } } -#endif } else if ( ivas_format == SBA_FORMAT || ivas_format == MASA_FORMAT ) { @@ -933,14 +929,12 @@ void ivas_destroy_enc( } } -#ifdef PARAM_ISM_DTX_CNG /* ISM DTX Handle */ if ( st_ivas->hISMDTX != NULL ) { free( st_ivas->hISMDTX ); st_ivas->hISMDTX = NULL; } -#endif /* Q Metadata handle */ ivas_qmetadata_close( &( st_ivas->hQMetaData ) ); diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 2fea85e44a..fe358f6c90 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -41,7 +41,6 @@ #endif #include "wmc_auto.h" -#ifdef PARAM_ISM_DTX_CNG /*-------------------------------------------------------------------* * ivas_ism_dtx_open() @@ -333,4 +332,3 @@ void ivas_ism_coh_estim_dtx_enc( return; } -#endif diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 7cfe962bc7..14b52bd0ee 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -86,9 +86,7 @@ ivas_error ivas_ism_enc( float lf_E[1][2 * VOIC_BINS]; /* per bin spectrum energy in lf */ int16_t localVAD_HE_SAD[1]; /* local HE VAD */ int16_t i, nBits; -#ifdef PARAM_ISM_DTX_CNG int16_t dtx_flag, sid_flag; -#endif ivas_error error; push_wmops( "ivas_ism_enc" ); @@ -99,10 +97,8 @@ ivas_error ivas_ism_enc( error = IVAS_ERR_OK; -#ifdef PARAM_ISM_DTX_CNG dtx_flag = 0; sid_flag = 0; -#endif /*------------------------------------------------------------------* * Preprocesing @@ -171,7 +167,6 @@ ivas_error ivas_ism_enc( vad_flag[sce_id] = st->vad_flag; } -#ifdef PARAM_ISM_DTX_CNG /*------------------------------------------------------------------* * DTX analysis *-----------------------------------------------------------------*/ @@ -195,14 +190,12 @@ ivas_error ivas_ism_enc( dbgwrite( &( st_ivas->hISMDTX->dtx_flag ), sizeof( int16_t ), 1, 1, "./res/ParamISM_DTX_CNG_flag_enc.dat" ); #endif } -#endif /*------------------------------------------------------------------* * Analysis of objects, configuration and decision about bitrates per channel * Metadata quantization and encoding *-----------------------------------------------------------------*/ -#ifdef PARAM_ISM_DTX_CNG if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { ivas_param_ism_compute_noisy_speech_flag( st_ivas ); @@ -216,40 +209,8 @@ ivas_error ivas_ism_enc( } } else -#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { -#ifndef PARAM_ISM_DTX_CNG - /* Move the Noisy speech buffer */ - for ( i = 0; i < ( PARAM_ISM_HYS_BUF_SIZE - 1 ); i++ ) - { - st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i] = st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i + 1]; - } - - /* For the current frame, make a decision based on some core-coder flags */ - if ( st_ivas->hSCE[0]->hCoreCoder[0]->flag_noisy_speech_snr && st_ivas->hSCE[1]->hCoreCoder[0]->flag_noisy_speech_snr ) - { - if ( st_ivas->hSCE[0]->hCoreCoder[0]->vad_flag || st_ivas->hSCE[1]->hCoreCoder[0]->vad_flag ) - { - st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i] = 0; - } - else - { - st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i] = 1; - } - } - else - { - st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i] = 0; - } - - /* Do a decision based on hysterisis */ - st_ivas->hDirAC->hParamIsm->flag_noisy_speech = 1; - for ( i = 0; i < PARAM_ISM_HYS_BUF_SIZE; i++ ) - { - st_ivas->hDirAC->hParamIsm->flag_noisy_speech = st_ivas->hDirAC->hParamIsm->flag_noisy_speech && st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i]; - } -#endif ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); } else /* ISM_MODE_DISC */ @@ -267,9 +228,7 @@ ivas_error ivas_ism_enc( { ivas_write_format_sid( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr ); -#ifdef PARAM_ISM_DTX_CNG if ( st_ivas->ism_mode != ISM_MODE_PARAM ) -#endif { /* write unused bits */ nBits = ( IVAS_SID_5k2 - SID_2k40 ) / 50 - SID_FORMAT_NBITS; @@ -321,9 +280,7 @@ ivas_error ivas_ism_enc( * Encoder *----------------------------------------------------------------*/ -#ifdef PARAM_ISM_DTX_CNG if ( !dtx_flag || ( dtx_flag && sce_id == st_ivas->hISMDTX->sce_id_dtx ) ) -#endif { if ( ( error = ivas_core_enc( hSCE, NULL, NULL, 1, old_inp_12k8[sce_id], old_inp_16k[sce_id], ener[sce_id], A[sce_id], Aw[sce_id], epsP[sce_id], lsp_new[sce_id], lsp_mid[sce_id], vad_hover_flag[sce_id], attack_flag[sce_id], realBuffer[sce_id], imagBuffer[sce_id], old_wsp[sce_id], loc_harm[sce_id], cor_map_sum[sce_id], vad_flag_dtx[sce_id], enerBuffer[sce_id], fft_buff[sce_id], 0, ISM_FORMAT, 0 ) ) != IVAS_ERR_OK ) { @@ -342,7 +299,6 @@ ivas_error ivas_ism_enc( st->hTranDet->transientDetector.prev_bIsAttackPresent = st->hTranDet->transientDetector.bIsAttackPresent; } -#ifdef PARAM_ISM_DTX_CNG if ( dtx_flag ) { for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) @@ -354,7 +310,6 @@ ivas_error ivas_ism_enc( } } } -#endif pop_wmops(); diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index 2397e68eaf..fb69537bc2 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -399,7 +399,6 @@ void ivas_param_ism_enc( } -#ifdef PARAM_ISM_DTX_CNG static void ivas_param_ism_enc_quantize_DOA_dtx( float azimuth, float elevation, @@ -572,4 +571,3 @@ void ivas_param_ism_compute_noisy_speech_flag( return; } -#endif diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 48bea12e53..c8577a85ba 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -332,11 +332,7 @@ ivas_error create_sce_enc( st->total_brate = hSCE->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; -#ifdef PARAM_ISM_DTX_CNG if ( ( error = init_encoder( st, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) -#else - if ( ( error = init_encoder( st, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index e5ed9ff9ff..d773a9ed61 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -203,11 +203,7 @@ ivas_error ivas_spar_enc_open( hSpar->hCoreCoderVAD->total_brate = hEncoderConfig->ivas_total_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ hSpar->hCoreCoderVAD->mct_chan_mode = MCT_CHAN_MODE_IGNORE; -#ifdef PARAM_ISM_DTX_CNG if ( ( error = init_encoder( hSpar->hCoreCoderVAD, 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) -#else - if ( ( error = init_encoder( hSpar->hCoreCoderVAD, 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1 ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index e450990254..8949dac71a 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -550,7 +550,6 @@ typedef struct ivas_stereo_classifier_data_structure } STEREO_CLASSIF_DATA, *STEREO_CLASSIF_HANDLE; -#ifdef PARAM_ISM_DTX_CNG /*----------------------------------------------------------------------------------* * ISM DTX structure *----------------------------------------------------------------------------------*/ @@ -566,7 +565,6 @@ typedef struct float coh[MAX_NUM_OBJECTS]; } ISM_DTX_DATA, *ISM_DTX_HANDLE; -#endif /*----------------------------------------------------------------------------------* * Front-VAD structure @@ -1071,9 +1069,7 @@ typedef struct /* multichannel modules */ ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS]; /* ISM metadata handles (storage for one frame of read ISM metadata) */ -#ifdef PARAM_ISM_DTX_CNG ISM_DTX_HANDLE hISMDTX; /* ISM DTX handle */ -#endif DIRAC_ENC_HANDLE hDirAC; /* DirAC data handle */ SPAR_ENC_HANDLE hSpar; /* SPAR encoder handle */ MASA_ENCODER_HANDLE hMasa; /* MASA encoder data and configuration */ diff --git a/lib_enc/ivas_tcx_core_enc.c b/lib_enc/ivas_tcx_core_enc.c index 3971c6740e..40a97cc33e 100644 --- a/lib_enc/ivas_tcx_core_enc.c +++ b/lib_enc/ivas_tcx_core_enc.c @@ -457,11 +457,7 @@ void stereo_tcx_core_enc( mvr2r( lsp_q, st->lsp_old, M ); } -#ifdef PARAM_ISM_DTX_CNG if ( st->Opt_DTX_ON && !st->tcxonly && st->hTdCngEnc != NULL ) -#else - if ( st->Opt_DTX_ON && !st->tcxonly ) -#endif { /* update CNG parameters in active frames */ if ( st->bwidth == NB && st->enableTcxLpc && st->core != ACELP_CORE ) diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 7ed8d4f2ec..373a6f7950 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -873,7 +873,6 @@ static ivas_error configureEncoder( return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "8kHz input sampling rate is not supported in IVAS." ); } -#ifdef PARAM_ISM_DTX_CNG if ( hEncoderConfig->Opt_DTX_ON && hEncoderConfig->ivas_format != MONO_FORMAT && ( ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp == 2 ) || // ToDo: see Issue 113 ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp > 2 && hEncoderConfig->ivas_total_brate != IVAS_24k4 && hEncoderConfig->ivas_total_brate != IVAS_32k ) || // ParamISM @@ -881,14 +880,6 @@ static ivas_error configureEncoder( ( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_get_sba_num_TCs( hEncoderConfig->ivas_total_brate, 1 ) > 2 ) || // ToDo: support for 3+ TCs to be done hEncoderConfig->ivas_format == MC_FORMAT // ToDo: TBD ) ) -#else - if ( hEncoderConfig->Opt_DTX_ON && hEncoderConfig->ivas_format != MONO_FORMAT && - ( ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp > 1 ) || // ToDo: see Issue 113 - ( hEncoderConfig->ivas_format == MASA_FORMAT && hEncoderConfig->ivas_total_brate > IVAS_128k ) || // ToDo: remove the bitrate limitation - ( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_get_sba_num_TCs( hEncoderConfig->ivas_total_brate, 1 ) > 2 ) || // ToDo: support for 3+ TCs to be done - hEncoderConfig->ivas_format == MC_FORMAT // ToDo: TBD - ) ) -#endif { return IVAS_ERROR( IVAS_ERR_DTX_NOT_SUPPORTED, "DTX is not supported in this IVAS format and element mode." ); } @@ -919,12 +910,10 @@ static ivas_error configureEncoder( return error; } -#ifdef PARAM_ISM_DTX_CNG if ( hEncoderConfig->Opt_DTX_ON && ( hEncoderConfig->ivas_format == ISM_FORMAT ) && !( st_ivas->ism_mode == ISM_MODE_DISC && hEncoderConfig->nchan_inp == 1 ) && !( st_ivas->ism_mode == ISM_MODE_PARAM && ( hEncoderConfig->nchan_inp == 3 || hEncoderConfig->nchan_inp == 4 ) ) ) { return IVAS_ERROR( IVAS_ERR_UNKNOWN, "DTX is not supported in this IVAS format and element mode." ); } -#endif if ( hEncoderConfig->ivas_format == MONO_FORMAT ) { diff --git a/lib_enc/rst_enc.c b/lib_enc/rst_enc.c index 2f19c41665..3a20418759 100644 --- a/lib_enc/rst_enc.c +++ b/lib_enc/rst_enc.c @@ -84,15 +84,11 @@ void CNG_reset_enc( set_f( voice_factors, 1.0, NB_SUBFR16k ); -#ifdef PARAM_ISM_DTX_CNG if ( st->hTdCngEnc != NULL ) { -#endif /* Reset active frame counter */ st->hTdCngEnc->act_cnt2 = 0; -#ifdef PARAM_ISM_DTX_CNG } -#endif /* deactivate bass post-filter */ st->bpf_off = 1; -- GitLab From ba7f2f7983ce5ba0a13b46a53a50adb4e391643d Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 16 Mar 2023 21:16:46 +0100 Subject: [PATCH 245/375] [cleanup] accept FIX_331_SBA_HBR_HOA_FIXES, COV_SMOOTH_TUNING, SBA_HPF_TUNING_ENC, SMOOTH_WITH_TRANS_DET --- lib_com/ivas_cov_smooth.c | 33 --------------------------------- lib_com/ivas_prot.h | 16 ---------------- lib_com/ivas_transient_det.c | 29 ----------------------------- lib_com/options.h | 6 ------ lib_dec/ivas_spar_decoder.c | 19 ------------------- lib_enc/ivas_enc.c | 2 -- lib_enc/ivas_enc_cov_handler.c | 8 -------- lib_enc/ivas_init_enc.c | 4 ---- lib_enc/ivas_sba_enc.c | 4 ---- lib_enc/ivas_spar_encoder.c | 8 -------- 10 files changed, 129 deletions(-) diff --git a/lib_com/ivas_cov_smooth.c b/lib_com/ivas_cov_smooth.c index 57f74fb70e..48ca292e8e 100644 --- a/lib_com/ivas_cov_smooth.c +++ b/lib_com/ivas_cov_smooth.c @@ -39,9 +39,7 @@ #include "wmc_auto.h" #include "prot.h" -#ifdef SMOOTH_WITH_TRANS_DET #define BAND_SMOOTH_REST_START_IDX ( 2 ) -#endif /*-----------------------------------------------------------------------------------------* * Function ivas_set_up_cov_smoothing() * @@ -53,18 +51,14 @@ static void ivas_set_up_cov_smoothing( ivas_filterbank_t *pFb, const float max_update_rate, const int16_t min_pool_size -#ifdef COV_SMOOTH_TUNING , const int16_t nchan_inp /* i : number of input channels */ -#endif ) { int16_t j, k; -#ifdef COV_SMOOTH_TUNING if ( nchan_inp <= FOA_CHANNELS ) { -#endif for ( j = 0; j < pFb->filterbank_num_bands; j++ ) { float update_factor; @@ -83,7 +77,6 @@ static void ivas_set_up_cov_smoothing( } } -#ifdef COV_SMOOTH_TUNING } else { @@ -107,7 +100,6 @@ static void ivas_set_up_cov_smoothing( } } } -#endif hCovState->prior_bank_idx = -1; return; @@ -153,10 +145,8 @@ ivas_error ivas_spar_covar_smooth_enc_open( } ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size -#ifdef COV_SMOOTH_TUNING , nchan_inp -#endif ); *hCovState_out = hCovState; @@ -218,25 +208,18 @@ static void ivas_compute_smooth_cov( const int16_t start_band, const int16_t end_band, const int16_t num_ch, -#ifdef SMOOTH_WITH_TRANS_DET const int16_t transient_det[2] -#else - const int16_t transient_det -#endif ) { int16_t i, j, k; int16_t prev_idx = hCovState->prior_bank_idx; float factor = 0; -#ifdef SMOOTH_WITH_TRANS_DET int16_t sm_b; int16_t non_sm_b_idx; sm_b = BAND_SMOOTH_REST_START_IDX; -#endif assert( end_band <= pFb->filterbank_num_bands ); -#ifdef SMOOTH_WITH_TRANS_DET if ( prev_idx == -1 || transient_det[1] == 1 ) { for ( i = 0; i < num_ch; i++ ) @@ -277,18 +260,6 @@ static void ivas_compute_smooth_cov( } } } -#else - if ( prev_idx == -1 || transient_det == 1 ) - { - for ( i = 0; i < num_ch; i++ ) - { - for ( k = start_band; k < end_band; k++ ) - { - pCov_buf[i][i][k] += ( hCovState->pSmoothing_factor[k] * fac ); - } - } - } -#endif else if ( prev_idx == 0 ) { for ( i = 0; i < num_ch; i++ ) @@ -329,11 +300,7 @@ void ivas_cov_smooth_process( const int16_t start_band, const int16_t end_band, const int16_t num_ch, -#ifdef SMOOTH_WITH_TRANS_DET const int16_t transient_det[2] -#else - const int16_t transient_det -#endif ) { int16_t i, j; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 9ed187ca42..c5b7cef5db 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4140,11 +4140,7 @@ void ivas_enc_cov_handler_process( const int16_t end_band, const int16_t nchan_inp, const int16_t dtx_vad, -#ifdef SMOOTH_WITH_TRANS_DET const int16_t transient_det[2] -#else - const int16_t transient_det -#endif ); ivas_error ivas_spar_covar_smooth_enc_open( @@ -4166,11 +4162,7 @@ void ivas_cov_smooth_process( const int16_t start_band, const int16_t end_band, const int16_t num_ch, -#ifdef SMOOTH_WITH_TRANS_DET const int16_t transient_det[2] -#else - const int16_t transient_det -#endif ); /* Transient detector module */ @@ -4183,20 +4175,12 @@ void ivas_transient_det_close( ivas_trans_det_state_t **hTranDet /* i/o: Transient detector handle */ ); -#ifdef SMOOTH_WITH_TRANS_DET void ivas_transient_det_process( ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ float *pIn_pcm, /* i : input audio channels */ const int16_t frame_len, /* i : frame length in samples */ int16_t transient_det[2] /* o : transient det outputs */ ); -#else -int16_t ivas_transient_det_process( - ivas_trans_det_state_t *hTranDet, /* i/o: Transient detector handle */ - float *pIn_pcm, /* i : input audio channels */ - const int16_t frame_len /* i : frame length in samples */ -); -#endif void ivas_td_decorr_get_ducking_gains( ivas_trans_det_state_t *hTranDet, /* i/o: Transient detector handle */ diff --git a/lib_com/ivas_transient_det.c b/lib_com/ivas_transient_det.c index e2f2dfb766..1e8f53c7ca 100644 --- a/lib_com/ivas_transient_det.c +++ b/lib_com/ivas_transient_det.c @@ -211,43 +211,17 @@ void ivas_transient_det_close( * * Transient detection process call *-----------------------------------------------------------------------------------------*/ -#ifdef SMOOTH_WITH_TRANS_DET void ivas_transient_det_process( ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ float *pIn_pcm, /* i : input audio channels */ const int16_t frame_len, /* i : frame length in samples */ int16_t transient_det[2] /* o: transient det outputs */ ) -#else -int16_t ivas_transient_det_process( - ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ - float *pIn_pcm, /* i : input audio channels */ - const int16_t frame_len /* i : frame length in samples */ -) -#endif { -#ifdef SMOOTH_WITH_TRANS_DET float in_duck_gain[L_FRAME48k]; int16_t num_sf, sf, sf_samp, idx; -#else - int16_t trans; -#endif float mem = hTranDet->in_duck_gain; -#ifndef SMOOTH_WITH_TRANS_DET - ivas_td_decorr_get_ducking_gains( hTranDet, pIn_pcm, NULL, NULL, frame_len, IVAS_TDET_ONLY ); - - if ( mem - hTranDet->in_duck_gain > IVAS_TDET_PARM_TRANS_THR ) - { - trans = 1; - } - else - { - trans = 0; - } - - return trans; -#else ivas_td_decorr_get_ducking_gains( hTranDet, pIn_pcm, in_duck_gain, NULL, frame_len, IVAS_TDET_ONLY ); transient_det[0] = 0; @@ -270,7 +244,6 @@ int16_t ivas_transient_det_process( } return; -#endif } @@ -344,9 +317,7 @@ void ivas_td_decorr_get_ducking_gains( for ( i = 0; i < frame_len; i++ ) { in_duck_gain = ivas_calc_duck_gain( in_duck_gain, in_duck_coeff, e_slow[i], e_fast[i], duck_mult_fac ); -#ifdef SMOOTH_WITH_TRANS_DET pIn_duck_gains[i] = in_duck_gain; -#endif } hTranDet->in_duck_gain = in_duck_gain; } diff --git a/lib_com/options.h b/lib_com/options.h index fa106a83c5..4db9738caa 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -144,13 +144,7 @@ -#define FIX_331_SBA_HBR_HOA_FIXES /* DLB: issue 331 - fix addressing low frequency stuttering with HOA inputs at high bitrates */ -#ifdef FIX_331_SBA_HBR_HOA_FIXES -#define COV_SMOOTH_TUNING -#define SBA_HPF_TUNING_ENC /*#define SBA_HPF_TUNING_DEC*/ -#define SMOOTH_WITH_TRANS_DET -#endif #define BINAURALIZATION_DELAY_REPORT /* VA: Issue 255 - Changes the way the decoder delay is reported */ #define FIX_351_HRTF_COMMAND /* VA: Issue 354 - improve "-hrtf" command-line option */ diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index dbab951140..6bf8b57f4c 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -806,28 +806,18 @@ void ivas_spar_get_parameters( weight = ivas_spar_get_cldfb_slot_gain( hSpar, hDecoderConfig, ts, &ts0, &ts1, &weight_20ms ); -#ifdef COV_SMOOTH_TUNING split_band = SPAR_DIRAC_SPLIT_START_BAND; -#else - split_band = hSpar->hMdDec->spar_md.num_bands; -#endif for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) { for ( out_ch = 0; out_ch < num_ch_out; out_ch++ ) { -#ifndef COV_SMOOTH_TUNING - for ( in_ch = 0; in_ch < num_ch_in; in_ch++ ) - { -#endif if ( split_band < IVAS_MAX_NUM_BANDS /* 20ms cross-fade for Transport channels in all frequency bands */ && ( 0 == ivas_is_res_channel( out_ch, hSpar->hMdDec->spar_md_cfg.nchan_transport ) ) /* sub-frame processing for missing channels in all frequency bands*/ ) { -#ifdef COV_SMOOTH_TUNING for ( in_ch = 0; in_ch < num_ch_in; in_ch++ ) { -#endif if ( hSpar->i_subframe > 3 ) { par_mat[out_ch][in_ch][spar_band] = ( 1.0f - weight ) * hSpar->hMdDec->mixer_mat_prev[ts0][out_ch][in_ch][spar_band] + @@ -837,26 +827,17 @@ void ivas_spar_get_parameters( { par_mat[out_ch][in_ch][spar_band] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][spar_band]; } -#ifdef COV_SMOOTH_TUNING } -#endif } else { -#ifdef COV_SMOOTH_TUNING for ( in_ch = 0; in_ch < num_ch_in; in_ch++ ) { -#endif /* 20ms Transport channel reconstruction with matching encoder/decoder processing */ int16_t prev_idx = SPAR_DIRAC_SPLIT_START_BAND < IVAS_MAX_NUM_BANDS ? 1 : 0; /* if SPAR_DIRAC_SPLIT_START_BAND == IVAS_MAX_NUM_BANDS, then the sub-frame mixer_mat delay line is not active */ par_mat[out_ch][in_ch][spar_band] = ( 1.0f - weight_20ms ) * hSpar->hMdDec->mixer_mat_prev[prev_idx][out_ch][in_ch][spar_band] + weight_20ms * hSpar->hMdDec->mixer_mat[out_ch][in_ch][spar_band]; -#ifdef COV_SMOOTH_TUNING } -#endif } -#ifndef COV_SMOOTH_TUNING - } -#endif } } diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 0500a8e775..aff410fcab 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -132,13 +132,11 @@ ivas_error ivas_enc( /* bypass EVS coding in float precision, emulating EVS encoder/decoder delay */ for ( i = 0; i < n; i++ ) { -#ifdef SBA_HPF_TUNING_ENC if ( ( ivas_format == SBA_FORMAT ) && ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) { hp20( data_f[HOA_keep_ind[i]], input_frame, st_ivas->mem_hp20_in[i], input_Fs ); } else -#endif if ( !( ivas_format == MC_FORMAT && i == LFE_CHANNEL ) ) /*TODO: is the HPF needed for LFE channel? */ { hp20( data_f[i], input_frame, st_ivas->mem_hp20_in[i], input_Fs ); diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index b70c05e962..1b366b86e8 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -150,11 +150,7 @@ void ivas_enc_cov_handler_process( const int16_t end_band, const int16_t num_ch, const int16_t dtx_vad, -#ifdef SMOOTH_WITH_TRANS_DET const int16_t transient_det[2] -#else - const int16_t transient_det -#endif ) { int16_t i, j; @@ -218,11 +214,7 @@ void ivas_enc_cov_handler_process( } else { -#ifdef SMOOTH_WITH_TRANS_DET if ( ( transient_det[0] == 0 ) && ( transient_det[1] == 0 ) ) -#else - if ( transient_det == 0 ) -#endif { ivas_cov_smooth_process( hCovEnc->pCov_dtx_state, cov_dtx_real, pFb, start_band, end_band, num_ch, transient_det ); hCovEnc->prior_dtx_present = 1; diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 2fadc22637..766caa1519 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -184,11 +184,7 @@ int16_t getNumChanAnalysis( n = st_ivas->nSCE + CPE_CHANNELS * st_ivas->nCPE; if ( st_ivas->hEncoderConfig->ivas_format == SBA_FORMAT ) { -#ifdef SBA_HPF_TUNING_ENC n = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order ); -#else - n = DIRAC_MAX_ANA_CHANS; -#endif } else if ( st_ivas->hEncoderConfig->ivas_format == MC_FORMAT && ( st_ivas->mc_mode == MC_MODE_PARAMMC || st_ivas->mc_mode == MC_MODE_MCMASA ) ) { diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index d9cd39f7c0..11d9c3540f 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -120,9 +120,7 @@ ivas_error ivas_sba_enc_reconfigure( DIRAC_ENC_HANDLE hDirAC = st_ivas->hDirAC; SPAR_ENC_HANDLE hSpar; SBA_MODE sba_mode_old; -#ifdef SBA_HPF_TUNING_ENC int16_t analysis_order_old; -#endif int16_t spar_reconfig_flag; spar_reconfig_flag = 0; @@ -134,7 +132,6 @@ ivas_error ivas_sba_enc_reconfigure( st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, hEncoderConfig->sba_order ); st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); -#ifdef SBA_HPF_TUNING_ENC analysis_order_old = ivas_sba_get_analysis_order( hEncoderConfig->last_ivas_total_brate, hEncoderConfig->sba_order ); if ( analysis_order_old != st_ivas->sba_analysis_order ) @@ -202,7 +199,6 @@ ivas_error ivas_sba_enc_reconfigure( old_mem_hp20_in = NULL; } } -#endif if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index d773a9ed61..5b81d91ea2 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -391,11 +391,7 @@ static ivas_error ivas_spar_enc_process( float pcm_tmp[IVAS_SPAR_MAX_CH][L_FRAME48k * 2]; float *p_pcm_tmp[IVAS_SPAR_MAX_CH]; int16_t i, j, b, i_ts, input_frame, dtx_vad; -#ifdef SMOOTH_WITH_TRANS_DET int16_t transient_det[2]; -#else - int16_t transient_det; -#endif int32_t ivas_total_brate, input_Fs; float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; @@ -438,15 +434,11 @@ static ivas_error ivas_spar_enc_process( * Transient detector *-----------------------------------------------------------------------------------------*/ -#ifdef SMOOTH_WITH_TRANS_DET ivas_transient_det_process( hSpar->hTranDet, data_f[0], input_frame, transient_det ); if ( sba_order == 1 ) { transient_det[1] = transient_det[0]; } -#else - transient_det = ivas_transient_det_process( hSpar->hTranDet, data_f[0], input_frame ); -#endif /* store previous input samples for W in local buffer */ assert( num_del_samples <= IVAS_FB_1MS_48K_SAMP ); -- GitLab From 61e8811388678bb1edcd183dbda152fb12864c4e Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 16 Mar 2023 21:17:36 +0100 Subject: [PATCH 246/375] [cleanup] accept FIX_351_HRTF_COMMAND --- apps/decoder.c | 8 -------- lib_com/options.h | 1 - lib_dec/ivas_stat_dec.h | 2 -- lib_dec/lib_dec.c | 8 -------- lib_dec/lib_dec.h | 2 -- 5 files changed, 21 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 40f6b47b23..fbb8922261 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -219,7 +219,6 @@ int main( if ( arg.hrtfReaderEnabled ) { -#ifdef FIX_351_HRTF_COMMAND /* sanity check */ if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) { @@ -227,13 +226,10 @@ int main( fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" ); goto cleanup; } -#endif if ( ( error = hrtfFileReader_open( arg.hrtfFileName, &hrtfReader ) ) != IVAS_ERR_OK ) { -#ifdef FIX_351_HRTF_COMMAND arg.hrtfReaderEnabled = false; -#endif fprintf( stderr, "\nError: Can't open HRTF binary file %s \n\n", arg.hrtfFileName ); goto cleanup; } @@ -245,14 +241,12 @@ int main( if ( arg.enableHeadRotation ) { -#ifdef FIX_351_HRTF_COMMAND /* sanity check */ if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) { fprintf( stderr, "\nError: Head-rotation file file cannot be used in this output configuration.\n\n" ); goto cleanup; } -#endif if ( ( error = HeadRotationFileReader_open( arg.headrotTrajFileName, &headRotReader ) ) != IVAS_ERR_OK ) { @@ -280,14 +274,12 @@ int main( if ( arg.renderConfigEnabled ) { -#ifdef FIX_351_HRTF_COMMAND /* sanity check */ if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) { fprintf( stderr, "\nError: Renderer configuration file cannot be used in this output configuration.\n\n" ); goto cleanup; } -#endif if ( ( error = RenderConfigReader_open( arg.renderConfigFilename, &renderConfigReader ) ) != IVAS_ERR_OK ) { diff --git a/lib_com/options.h b/lib_com/options.h index 4db9738caa..b579595759 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -147,7 +147,6 @@ /*#define SBA_HPF_TUNING_DEC*/ #define BINAURALIZATION_DELAY_REPORT /* VA: Issue 255 - Changes the way the decoder delay is reported */ -#define FIX_351_HRTF_COMMAND /* VA: Issue 354 - improve "-hrtf" command-line option */ #define FIX_94_VERIFY_WAV_NUM_CHANNELS /* FhG: Issue 94 - Check if number of channels in input wav file matches encoder/renderer configuration */ #define ISM_HIGHEST_BITRATE /* VA: Issue 284: Update highest bitrate limit in ISM format */ #define TUNE_360_OBJECT_WITH_NOISE /* VA: issue 360: consider objects being speech+noise for active speech coding */ diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 5243763844..c4c37754fa 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1143,9 +1143,7 @@ typedef struct decoder_config_structure int16_t Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ int16_t Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ int16_t Opt_Headrotation; /* indicates whether head-rotation is used */ -#ifdef FIX_351_HRTF_COMMAND int16_t Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */ -#endif int16_t orientation_tracking; /* indicates orientation tracking type */ float no_diegetic_pan; int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index d10b6d79d5..2fba6491d4 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -223,9 +223,7 @@ static void init_decoder_config( hDecoderConfig->Opt_LsCustom = 0; hDecoderConfig->Opt_HRTF_binary = 0; hDecoderConfig->Opt_Headrotation = 0; -#ifdef FIX_351_HRTF_COMMAND hDecoderConfig->Opt_RendConfigCustom = 0; -#endif hDecoderConfig->orientation_tracking = orientation_tracking; hDecoderConfig->no_diegetic_pan = no_diegetic_pan; @@ -390,10 +388,8 @@ ivas_error IVAS_DEC_Configure( const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation /* i : enable head rotation for binaural output */ -#ifdef FIX_351_HRTF_COMMAND , const int16_t renderConfigEnabled /* i : enable Renderer config. file for binaural output */ -#endif ) { Decoder_Struct *st_ivas; @@ -442,9 +438,7 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->Opt_LsCustom = customLsOutputEnabled; hDecoderConfig->Opt_Headrotation = enableHeadRotation; hDecoderConfig->Opt_HRTF_binary = hrtfReaderEnabled; -#ifdef FIX_351_HRTF_COMMAND hDecoderConfig->Opt_RendConfigCustom = renderConfigEnabled; -#endif /* Set decoder parameters to initial values */ if ( ( error = ivas_init_decoder_front( st_ivas ) ) != IVAS_ERR_OK ) @@ -1924,7 +1918,6 @@ static ivas_error printConfigInfo_dec( get_channel_config( st_ivas->hDecoderConfig->output_config, &config_str[0] ); fprintf( stdout, "Output configuration: %s\n", config_str ); -#ifdef FIX_351_HRTF_COMMAND if ( st_ivas->hDecoderConfig->Opt_HRTF_binary ) { fprintf( stdout, "HRIR/BRIR file: ON\n" ); @@ -1934,7 +1927,6 @@ static ivas_error printConfigInfo_dec( { fprintf( stdout, "Renderer config. file: ON\n" ); } -#endif if ( st_ivas->hDecoderConfig->Opt_Headrotation ) { diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index c0d74b077b..e9aba91f9e 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -130,9 +130,7 @@ ivas_error IVAS_DEC_Configure( const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation /* i : enable head rotation for binaural output */ -#ifdef FIX_351_HRTF_COMMAND ,const int16_t renderConfigEnabled /* i : enable Renderer config. file for binaural output */ -#endif ); -- GitLab From 465ceeaa78b307f025d117ac42fb7e2074ae4311 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 16 Mar 2023 21:18:32 +0100 Subject: [PATCH 247/375] [cleanup] accept FIX_94_VERIFY_WAV_NUM_CHANNELS --- apps/encoder.c | 19 ----------------- apps/renderer.c | 28 ------------------------- lib_com/ivas_error.h | 2 -- lib_com/options.h | 1 - lib_enc/lib_enc.c | 2 -- lib_enc/lib_enc.h | 2 -- lib_util/audio_file_reader.c | 40 ------------------------------------ lib_util/audio_file_reader.h | 10 --------- 8 files changed, 104 deletions(-) diff --git a/apps/encoder.c b/apps/encoder.c index 5fb6100034..274c4099ab 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -213,23 +213,6 @@ int main( goto cleanup; } -#ifndef FIX_94_VERIFY_WAV_NUM_CHANNELS - /*------------------------------------------------------------------------------------------* - * Open input audio file - *------------------------------------------------------------------------------------------*/ - int32_t inFileSampleRate = 0; - if ( AudioFileReader_open( &audioReader, arg.inputWavFilename, &inFileSampleRate ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nCan't open %s\n\n", arg.inputWavFilename ); - goto cleanup; - } - if ( inFileSampleRate != 0 && /* inFileSampleRate will remain zero if input file is raw PCM */ - inFileSampleRate != arg.inputFs ) - { - fprintf( stderr, "Sampling rate mismatch: %d Hz requested, but %d Hz found in file %s\n", arg.inputFs, inFileSampleRate, arg.inputWavFilename ); - goto cleanup; - } -#endif /*------------------------------------------------------------------------------------------* * Open output bitstream file @@ -452,7 +435,6 @@ int main( goto cleanup; } -#ifdef FIX_94_VERIFY_WAV_NUM_CHANNELS /*------------------------------------------------------------------------------------------* * Open input audio file *------------------------------------------------------------------------------------------*/ @@ -511,7 +493,6 @@ int main( fprintf( stderr, "\nError: %s\n", ivas_error_to_string( error ) ); goto cleanup; } -#endif /*------------------------------------------------------------------------------------------* * Open input metadata files diff --git a/apps/renderer.c b/apps/renderer.c index e7088a4316..1c9601b590 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -565,7 +565,6 @@ int main( setupWithSingleFormatInput( args, audioFilePath, positionProvider, masaReaders ); } -#ifdef FIX_94_VERIFY_WAV_NUM_CHANNELS if ( AudioFileReader_open( &audioReader, audioFilePath ) != IVAS_ERR_OK ) { fprintf( stderr, "Error opening file: %s\n", audioFilePath ); @@ -609,28 +608,6 @@ int main( fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } -#else - int32_t inFileSampleRate = 0; - if ( AudioFileReader_open( &audioReader, audioFilePath, &inFileSampleRate ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error opening file: %s\n", audioFilePath ); - exit( -1 ); - } - if ( args.sampleRate == 0 && inFileSampleRate == 0 ) - { - fprintf( stderr, "Sampling rate must be specified on command line when using raw PCM input\n" ); - exit( -1 ); - } - if ( args.sampleRate != 0 && inFileSampleRate != 0 && args.sampleRate != inFileSampleRate ) - { - fprintf( stderr, "Sampling rate mismatch: %d Hz requested, but %d Hz found in file %s\n", args.sampleRate, inFileSampleRate, args.inputFilePath ); - exit( -1 ); - } - if ( args.sampleRate == 0 ) - { - args.sampleRate = inFileSampleRate; - } -#endif const int16_t frameSize_smpls = (int16_t) ( 20 * args.sampleRate / 1000 ); IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS] = { 0 }; @@ -798,12 +775,7 @@ int main( const int16_t totalNumInChannels = getTotalNumInChannels( hIvasRend, mcIds, ismIds, sbaIds, masaIds ); -#ifdef FIX_94_VERIFY_WAV_NUM_CHANNELS if ( inFileNumChannels != 0 /* inFileNumChannels is 0 with raw PCM input */ && totalNumInChannels != inFileNumChannels ) -#else - if ( AudioFileReader_getNumChannels( audioReader ) != 0 /* If input file is raw PCM, audio reader has no info about number of channels */ - && totalNumInChannels != AudioFileReader_getNumChannels( audioReader ) ) -#endif { fprintf( stderr, "Number of channels in input file does not match selected configuration\n" ); exit( -1 ); diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index b384e8dee5..a0fe708361 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -123,10 +123,8 @@ typedef enum IVAS_ERR_BITSTREAM_WRITER_INVALID_FORMAT, IVAS_ERR_BITSTREAM_READER_INVALID_DATA, IVAS_ERR_BITSTREAM_READER_INVALID_FORMAT, -#ifdef FIX_94_VERIFY_WAV_NUM_CHANNELS IVAS_ERR_NO_FILE_OPEN, IVAS_ERR_SAMPLING_RATE_UNKNOWN, -#endif /*----------------------------------------* * renderer (lib_rend only) * diff --git a/lib_com/options.h b/lib_com/options.h index b579595759..4ce0b05847 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -147,7 +147,6 @@ /*#define SBA_HPF_TUNING_DEC*/ #define BINAURALIZATION_DELAY_REPORT /* VA: Issue 255 - Changes the way the decoder delay is reported */ -#define FIX_94_VERIFY_WAV_NUM_CHANNELS /* FhG: Issue 94 - Check if number of channels in input wav file matches encoder/renderer configuration */ #define ISM_HIGHEST_BITRATE /* VA: Issue 284: Update highest bitrate limit in ISM format */ #define TUNE_360_OBJECT_WITH_NOISE /* VA: issue 360: consider objects being speech+noise for active speech coding */ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 373a6f7950..6beb889d00 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -983,7 +983,6 @@ static int16_t getInputBufferSize( return (int16_t) ( st_ivas->hEncoderConfig->input_Fs * st_ivas->hEncoderConfig->nchan_inp / FRAMES_PER_SEC ); } -#ifdef FIX_94_VERIFY_WAV_NUM_CHANNELS /*---------------------------------------------------------------------* * IVAS_ENC_GetNumInChannels() * @@ -1008,7 +1007,6 @@ ivas_error IVAS_ENC_GetNumInChannels( return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------* diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index 7430822642..9c16e69c75 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -298,13 +298,11 @@ ivas_error IVAS_ENC_GetDelay( int16_t *delay /* o : encoder delay */ ); -#ifdef FIX_94_VERIFY_WAV_NUM_CHANNELS /*! r: encoder error code */ ivas_error IVAS_ENC_GetNumInChannels( const IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ int16_t *numInChannels /* o : total number of samples expected in the input buffer for current encoder configuration */ ); -#endif /*! r: encoder error code */ ivas_error IVAS_ENC_GetInputBufferSize( diff --git a/lib_util/audio_file_reader.c b/lib_util/audio_file_reader.c index c7feefd7b7..f124c11169 100644 --- a/lib_util/audio_file_reader.c +++ b/lib_util/audio_file_reader.c @@ -40,9 +40,7 @@ struct AudioFileReader { FILE *rawFile; WAVEFILEIN *wavFile; -#ifdef FIX_94_VERIFY_WAV_NUM_CHANNELS uint32_t samplingRate; -#endif int16_t numChannels; }; @@ -58,25 +56,12 @@ static int8_t AudioFileReader_open_raw( static int8_t AudioFileReader_open_wav( AudioFileReader *self, const char *fileName -#ifndef FIX_94_VERIFY_WAV_NUM_CHANNELS - , - int32_t *sampleRate -#endif ) { -#ifdef FIX_94_VERIFY_WAV_NUM_CHANNELS uint32_t samplesInFile; -#else - uint32_t sampleRate_, samplesInFile; -#endif int16_t bps; -#ifdef FIX_94_VERIFY_WAV_NUM_CHANNELS self->wavFile = OpenWav( fileName, &self->samplingRate, &self->numChannels, &samplesInFile, &bps ); -#else - self->wavFile = OpenWav( fileName, &sampleRate_, &self->numChannels, &samplesInFile, &bps ); - *sampleRate = sampleRate_; -#endif if ( !self->wavFile ) { @@ -92,10 +77,6 @@ static int8_t AudioFileReader_open_wav( ivas_error AudioFileReader_open( AudioFileReader **audioReader, /* o : AudioFileReader handle */ const char *fileName /* i : path to wav/raw pcm file */ -#ifndef FIX_94_VERIFY_WAV_NUM_CHANNELS - , - int32_t *sampleRate /* o : sample rate of wav file, unused with pcm */ -#endif ) { AudioFileReader *self; @@ -118,18 +99,12 @@ ivas_error AudioFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } self = calloc( sizeof( AudioFileReader ), 1 ); -#ifdef FIX_94_VERIFY_WAV_NUM_CHANNELS self->samplingRate = 0; -#endif self->numChannels = 0; if ( fileNameLen > wavSuffixLen && strncmp( fileName + fileNameLen - wavSuffixLen, wavSuffix, wavSuffixLen ) == 0 ) { retCode = AudioFileReader_open_wav( self, fileName -#ifndef FIX_94_VERIFY_WAV_NUM_CHANNELS - , - sampleRate -#endif ); } else @@ -206,7 +181,6 @@ ivas_error AudioFileReader_read( return error; } -#ifdef FIX_94_VERIFY_WAV_NUM_CHANNELS ivas_error AudioFileReader_getSamplingRate( AudioFileReader *self, int32_t *samplingRate ) @@ -257,17 +231,3 @@ ivas_error AudioFileReader_getNumChannels( return IVAS_ERR_OK; } -#else -/*! r: number of channels of the opened file */ -int16_t AudioFileReader_getNumChannels( - AudioFileReader *self /* i/o: AudioFileReader handle */ -) -{ - if ( self != NULL ) - { - return self->numChannels; - } - - return 0; -} -#endif diff --git a/lib_util/audio_file_reader.h b/lib_util/audio_file_reader.h index a944c85dc1..0fd4da5ac7 100644 --- a/lib_util/audio_file_reader.h +++ b/lib_util/audio_file_reader.h @@ -43,9 +43,6 @@ typedef struct AudioFileReader AudioFileReader; ivas_error AudioFileReader_open( AudioFileReader **audioReader, /* o : AudioFileReader handle */ const char *fileName /* i : path to wav/raw pcm file */ -#ifndef FIX_94_VERIFY_WAV_NUM_CHANNELS - ,int32_t *sampleRate /* o : sample rate of wav file, unused with pcm */ -#endif ); ivas_error AudioFileReader_read( @@ -55,7 +52,6 @@ ivas_error AudioFileReader_read( int16_t *numSamplesRead /* i : number of samples actualy read */ ); -#ifdef FIX_94_VERIFY_WAV_NUM_CHANNELS /*! r: ivas error - in particular, IVAS_ERR_SAMPLING_RATE_UNKNOWN if the opened file has no sampling rate metadata */ ivas_error AudioFileReader_getSamplingRate( AudioFileReader *self, /* i/o: AudioFileReader handle */ @@ -67,12 +63,6 @@ ivas_error AudioFileReader_getNumChannels( AudioFileReader *self, /* i/o: AudioFileReader handle */ int16_t * numChannels /* o : number fo channels in opened audio file */ ); -#else -/*! r: number of channels of the opened file */ -int16_t AudioFileReader_getNumChannels( - AudioFileReader *self /* i/o: AudioFileReader handle */ -); -#endif void AudioFileReader_close( AudioFileReader **selfPtr /* i/o: pointer to AudioFileReader handle */ -- GitLab From ad24c98c512a37f057fd180401b616d69a4a787a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 16 Mar 2023 21:19:21 +0100 Subject: [PATCH 248/375] [cleanup] accept ISM_HIGHEST_BITRATE --- apps/encoder.c | 5 ----- lib_com/options.h | 1 - lib_enc/lib_enc.c | 7 ------- 3 files changed, 13 deletions(-) diff --git a/apps/encoder.c b/apps/encoder.c index 274c4099ab..1e0fb3e524 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -1621,7 +1621,6 @@ static void usage_enc( void ) fprintf( stdout, " *VBR mode (average bitrate),\n" ); fprintf( stdout, " for AMR-WB IO modes R = (6600, 8850, 12650, 14250, 15850, 18250,\n" ); fprintf( stdout, " 19850, 23050, 23850) \n" ); -#ifdef ISM_HIGHEST_BITRATE fprintf( stdout, " for IVAS stereo R = (13200, 16400, 24400, 32000, 48000, 64000, 80000, \n" ); fprintf( stdout, " 96000, 128000, 160000, 192000, 256000) \n" ); fprintf( stdout, " for IVAS ISM R = 13200 for 1 ISM, 16400 for 1 ISM and 2 ISM, \n" ); @@ -1629,10 +1628,6 @@ static void usage_enc( void ) fprintf( stdout, " for 2 ISM, 3 ISM and 4 ISM also 160000, 192000, 256000) \n" ); fprintf( stdout, " for 3 ISM and 4 ISM also 384000 \n" ); fprintf( stdout, " for 4 ISM also 512000 \n" ); -#else - fprintf( stdout, " for IVAS stereo & ISm R =(13200, 16400, 24400, 32000, 48000, 64000, 80000, \n" ); - fprintf( stdout, " 96000, 128000, 160000, 192000, 256000) \n" ); -#endif fprintf( stdout, " for IVAS SBA, MASA, MC R=(13200, 16400, 24400, 32000, 48000, 64000, 80000, \n" ); fprintf( stdout, " 96000, 128000, 160000, 192000, 256000, 384000, 512000) \n" ); fprintf( stdout, " Alternatively, R can be a bitrate switching file which consists of R values\n" ); diff --git a/lib_com/options.h b/lib_com/options.h index 4ce0b05847..1b39ef7591 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -147,7 +147,6 @@ /*#define SBA_HPF_TUNING_DEC*/ #define BINAURALIZATION_DELAY_REPORT /* VA: Issue 255 - Changes the way the decoder delay is reported */ -#define ISM_HIGHEST_BITRATE /* VA: Issue 284: Update highest bitrate limit in ISM format */ #define TUNE_360_OBJECT_WITH_NOISE /* VA: issue 360: consider objects being speech+noise for active speech coding */ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ #define FIX_372_LIB_REND_VALIDATE_IO /* FhG: Issue 372: IVAS_rend segfaults with unsupported I/O configs - add validation checks of I/O config */ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 6beb889d00..ff63f604b6 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -1972,7 +1972,6 @@ static ivas_error sanitizeBandwidth( static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig ) { -#ifdef ISM_HIGHEST_BITRATE if ( hEncoderConfig->ivas_total_brate > IVAS_128k && hEncoderConfig->nchan_inp == 1 ) { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too high bitrate for 1 ISM specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); @@ -1987,12 +1986,6 @@ static ivas_error sanitizeBitrateISM( { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too high bitrate for 3 ISM specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } -#else - if ( hEncoderConfig->ivas_total_brate > IVAS_256k ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too high bitrate for ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); - } -#endif if ( hEncoderConfig->ivas_total_brate < IVAS_16k4 && hEncoderConfig->nchan_inp == 2 ) { -- GitLab From 61e8704704a5c3f7a4a5a49f1b15d0e271a1d5c4 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 16 Mar 2023 21:20:02 +0100 Subject: [PATCH 249/375] [cleanup] accept FIX_372_LIB_REND_VALIDATE_IO --- lib_com/ivas_error.h | 4 ---- lib_com/options.h | 1 - lib_rend/lib_rend.c | 10 ---------- 3 files changed, 15 deletions(-) diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index a0fe708361..9438ad44a1 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -86,9 +86,7 @@ typedef enum IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT, IVAS_ERR_ISM_INVALID_METADATA_VALUE, IVAS_ERR_INVALID_MASA_FORMAT_METADATA_FILE, -#ifdef FIX_372_LIB_REND_VALIDATE_IO IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED, -#endif #ifdef DEBUGGING IVAS_ERR_INVALID_FORCE_MODE, #ifdef DEBUG_AGC_ENCODER_CMD_OPTION @@ -169,10 +167,8 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) return "Wrong number of channels"; case IVAS_ERR_INVALID_BUFFER_SIZE: return "Invalid buffer size"; -#ifdef FIX_372_LIB_REND_VALIDATE_IO case IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED: return "Unsupported input/output config pair"; -#endif case IVAS_ERR_FAILED_FILE_OPEN: return "File open error"; case IVAS_ERR_FAILED_FILE_WRITE: diff --git a/lib_com/options.h b/lib_com/options.h index 1b39ef7591..950a2f28eb 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,7 +149,6 @@ #define BINAURALIZATION_DELAY_REPORT /* VA: Issue 255 - Changes the way the decoder delay is reported */ #define TUNE_360_OBJECT_WITH_NOISE /* VA: issue 360: consider objects being speech+noise for active speech coding */ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ -#define FIX_372_LIB_REND_VALIDATE_IO /* FhG: Issue 372: IVAS_rend segfaults with unsupported I/O configs - add validation checks of I/O config */ #define FIX_376_SBA_ROTATE /*DLB: Fix for issue 376*/ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 63b79cf2af..8ad381584b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1030,7 +1030,6 @@ static CREND_WRAPPER defaultCrendWrapper( return w; } -#ifdef FIX_372_LIB_REND_VALIDATE_IO static bool isIoConfigPairSupported( IVAS_REND_AudioConfig inConfig, IVAS_REND_AudioConfig outConfig ) { /* Rendering mono or stereo to binaural is not supported */ @@ -1043,7 +1042,6 @@ static bool isIoConfigPairSupported( IVAS_REND_AudioConfig inConfig, IVAS_REND_A /* If not returned so far, config pair is supported */ return true; } -#endif static ivas_error setRendInputActiveIsm( void *input, @@ -1060,12 +1058,10 @@ static ivas_error setRendInputActiveIsm( rendCtx = inputIsm->base.ctx; outConfig = *rendCtx.pOutConfig; -#ifdef FIX_372_LIB_REND_VALIDATE_IO if ( !isIoConfigPairSupported( inConfig, outConfig ) ) { return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } -#endif initRendInputBase( &inputIsm->base, inConfig, id, rendCtx ); @@ -1916,12 +1912,10 @@ static ivas_error setRendInputActiveMc( rendCtx = inputMc->base.ctx; outConfig = *rendCtx.pOutConfig; -#ifdef FIX_372_LIB_REND_VALIDATE_IO if ( !isIoConfigPairSupported( inConfig, outConfig ) ) { return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } -#endif initRendInputBase( &inputMc->base, inConfig, id, rendCtx ); setZeroPanMatrix( inputMc->panGains ); @@ -2150,12 +2144,10 @@ static ivas_error setRendInputActiveSba( rendCtx = inputSba->base.ctx; outConfig = *rendCtx.pOutConfig; -#ifdef FIX_372_LIB_REND_VALIDATE_IO if ( !isIoConfigPairSupported( inConfig, outConfig ) ) { return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } -#endif initRendInputBase( &inputSba->base, inConfig, id, rendCtx ); setZeroPanMatrix( inputSba->hoaDecMtx ); @@ -2519,12 +2511,10 @@ static ivas_error setRendInputActiveMasa( outConfig = *rendCtx.pOutConfig; (void) hRendCfg; /* Suppress warning */ -#ifdef FIX_372_LIB_REND_VALIDATE_IO if ( !isIoConfigPairSupported( inConfig, outConfig ) ) { return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } -#endif initRendInputBase( &inputMasa->base, inConfig, id, rendCtx ); -- GitLab From 34104faccd47f26e0f51813764db5d278b524e7c Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 16 Mar 2023 21:27:33 +0100 Subject: [PATCH 250/375] [cleanup] formatting --- lib_com/ivas_cov_smooth.c | 16 ++++-------- lib_dec/ivas_dec.c | 3 +-- lib_dec/ivas_ism_param_dec.c | 2 +- lib_dec/ivas_spar_decoder.c | 42 +++++++++++++++--------------- lib_dec/ivas_stat_dec.h | 4 +-- lib_enc/ivas_core_pre_proc_front.c | 2 +- lib_enc/ivas_enc.c | 3 +-- lib_enc/ivas_enc_cov_handler.c | 3 +-- lib_enc/ivas_ism_enc.c | 3 +-- lib_enc/ivas_spar_encoder.c | 2 +- lib_rend/ivas_crend.c | 8 ------ lib_rend/ivas_objectRenderer.c | 11 ++++---- lib_util/audio_file_reader.c | 6 ++--- 13 files changed, 42 insertions(+), 63 deletions(-) diff --git a/lib_com/ivas_cov_smooth.c b/lib_com/ivas_cov_smooth.c index 48ca292e8e..35ce6b8546 100644 --- a/lib_com/ivas_cov_smooth.c +++ b/lib_com/ivas_cov_smooth.c @@ -50,8 +50,7 @@ static void ivas_set_up_cov_smoothing( ivas_cov_smooth_state_t *hCovState, ivas_filterbank_t *pFb, const float max_update_rate, - const int16_t min_pool_size - , + const int16_t min_pool_size, const int16_t nchan_inp /* i : number of input channels */ ) { @@ -76,7 +75,6 @@ static void ivas_set_up_cov_smoothing( hCovState->pSmoothing_factor[j] = max_update_rate; } } - } else { @@ -144,10 +142,8 @@ ivas_error ivas_spar_covar_smooth_enc_open( } } - ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size - , - nchan_inp - ); + ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size, + nchan_inp ); *hCovState_out = hCovState; @@ -208,8 +204,7 @@ static void ivas_compute_smooth_cov( const int16_t start_band, const int16_t end_band, const int16_t num_ch, - const int16_t transient_det[2] -) + const int16_t transient_det[2] ) { int16_t i, j, k; int16_t prev_idx = hCovState->prior_bank_idx; @@ -300,8 +295,7 @@ void ivas_cov_smooth_process( const int16_t start_band, const int16_t end_band, const int16_t num_ch, - const int16_t transient_det[2] -) + const int16_t transient_det[2] ) { int16_t i, j; int16_t num_bands = end_band - start_band; diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index b51eacd1ba..45f31e9f84 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -147,8 +147,7 @@ ivas_error ivas_dec( return error; } } - else - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 43ae3cf072..f34aa023f6 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -157,7 +157,7 @@ static void ivas_ism_get_proto_matrix( static void ivas_param_ism_compute_mixing_matrix( - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ + DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ ISM_DTX_DATA_DEC hISMDTX, /* i : ISM DTX handle */ float Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 6bf8b57f4c..53c60c3d34 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -811,33 +811,33 @@ void ivas_spar_get_parameters( { for ( out_ch = 0; out_ch < num_ch_out; out_ch++ ) { - if ( split_band < IVAS_MAX_NUM_BANDS - /* 20ms cross-fade for Transport channels in all frequency bands */ - && ( 0 == ivas_is_res_channel( out_ch, hSpar->hMdDec->spar_md_cfg.nchan_transport ) ) /* sub-frame processing for missing channels in all frequency bands*/ - ) + if ( split_band < IVAS_MAX_NUM_BANDS + /* 20ms cross-fade for Transport channels in all frequency bands */ + && ( 0 == ivas_is_res_channel( out_ch, hSpar->hMdDec->spar_md_cfg.nchan_transport ) ) /* sub-frame processing for missing channels in all frequency bands*/ + ) + { + for ( in_ch = 0; in_ch < num_ch_in; in_ch++ ) { - for ( in_ch = 0; in_ch < num_ch_in; in_ch++ ) + if ( hSpar->i_subframe > 3 ) { - if ( hSpar->i_subframe > 3 ) - { - par_mat[out_ch][in_ch][spar_band] = ( 1.0f - weight ) * hSpar->hMdDec->mixer_mat_prev[ts0][out_ch][in_ch][spar_band] + - weight * hSpar->hMdDec->mixer_mat_prev[ts1][out_ch][in_ch][spar_band]; - } - else - { - par_mat[out_ch][in_ch][spar_band] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][spar_band]; - } + par_mat[out_ch][in_ch][spar_band] = ( 1.0f - weight ) * hSpar->hMdDec->mixer_mat_prev[ts0][out_ch][in_ch][spar_band] + + weight * hSpar->hMdDec->mixer_mat_prev[ts1][out_ch][in_ch][spar_band]; } - } - else - { - for ( in_ch = 0; in_ch < num_ch_in; in_ch++ ) + else { - /* 20ms Transport channel reconstruction with matching encoder/decoder processing */ - int16_t prev_idx = SPAR_DIRAC_SPLIT_START_BAND < IVAS_MAX_NUM_BANDS ? 1 : 0; /* if SPAR_DIRAC_SPLIT_START_BAND == IVAS_MAX_NUM_BANDS, then the sub-frame mixer_mat delay line is not active */ - par_mat[out_ch][in_ch][spar_band] = ( 1.0f - weight_20ms ) * hSpar->hMdDec->mixer_mat_prev[prev_idx][out_ch][in_ch][spar_band] + weight_20ms * hSpar->hMdDec->mixer_mat[out_ch][in_ch][spar_band]; + par_mat[out_ch][in_ch][spar_band] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][spar_band]; } } + } + else + { + for ( in_ch = 0; in_ch < num_ch_in; in_ch++ ) + { + /* 20ms Transport channel reconstruction with matching encoder/decoder processing */ + int16_t prev_idx = SPAR_DIRAC_SPLIT_START_BAND < IVAS_MAX_NUM_BANDS ? 1 : 0; /* if SPAR_DIRAC_SPLIT_START_BAND == IVAS_MAX_NUM_BANDS, then the sub-frame mixer_mat delay line is not active */ + par_mat[out_ch][in_ch][spar_band] = ( 1.0f - weight_20ms ) * hSpar->hMdDec->mixer_mat_prev[prev_idx][out_ch][in_ch][spar_band] + weight_20ms * hSpar->hMdDec->mixer_mat[out_ch][in_ch][spar_band]; + } + } } } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index c4c37754fa..51d825c0fb 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1143,8 +1143,8 @@ typedef struct decoder_config_structure int16_t Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ int16_t Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ int16_t Opt_Headrotation; /* indicates whether head-rotation is used */ - int16_t Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */ - int16_t orientation_tracking; /* indicates orientation tracking type */ + int16_t Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */ + int16_t orientation_tracking; /* indicates orientation tracking type */ float no_diegetic_pan; int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index 971d47c0f9..6e2f6b6db2 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -107,7 +107,7 @@ ivas_error pre_proc_front_ivas( const int16_t front_vad_flag, /* i : front-VAD flag to overwrite VAD decision */ const int16_t force_front_vad, /* i : flag to force VAD decision */ const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ - const int32_t ivas_total_brate /* i : IVAS total bitrate - for setting the DTX */ + const int32_t ivas_total_brate /* i : IVAS total bitrate - for setting the DTX */ ) { diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index aff410fcab..1e4ba82207 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -136,8 +136,7 @@ ivas_error ivas_enc( { hp20( data_f[HOA_keep_ind[i]], input_frame, st_ivas->mem_hp20_in[i], input_Fs ); } - else - if ( !( ivas_format == MC_FORMAT && i == LFE_CHANNEL ) ) /*TODO: is the HPF needed for LFE channel? */ + else if ( !( ivas_format == MC_FORMAT && i == LFE_CHANNEL ) ) /*TODO: is the HPF needed for LFE channel? */ { hp20( data_f[i], input_frame, st_ivas->mem_hp20_in[i], input_Fs ); } diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index 1b366b86e8..23d0bdd0e5 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -150,8 +150,7 @@ void ivas_enc_cov_handler_process( const int16_t end_band, const int16_t num_ch, const int16_t dtx_vad, - const int16_t transient_det[2] -) + const int16_t transient_det[2] ) { int16_t i, j; int16_t dtx_cov_flag; diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 14b52bd0ee..497f47e386 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -208,8 +208,7 @@ ivas_error ivas_ism_enc( ivas_param_ism_metadata_dtx_enc( st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, st_ivas->hIsmMetaData, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ); } } - else - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); } diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 5b81d91ea2..7b2155d767 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -107,7 +107,7 @@ ivas_error ivas_spar_enc_open( ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_SPAR, nchan_inp, nchan_transport, active_w_mixing, input_Fs ); fb_cfg->remix_order = remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order]; -/* FB mixer handle */ + /* FB mixer handle */ if ( ( error = ivas_FB_mixer_open( &( hSpar->hFbMixer ), input_Fs, fb_cfg, spar_reconfig_flag ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 9ea32ba1e3..74f26ad907 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -148,13 +148,6 @@ static ivas_error ivas_hrtf_close( } - - - - - - - /*------------------------------------------------------------------------- * initCrend_from_rom() * @@ -770,7 +763,6 @@ ivas_error ivas_rend_openCrend( } - hHrtf = ( *pCrend )->hHrtfCrend; if ( hHrtf != NULL ) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 9ae3014938..9041a016b1 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -227,8 +227,8 @@ void ivas_td_binaural_close( *---------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer_unwrap( - REVERB_HANDLE hReverb, /* i : reverb handle */ - AUDIO_CONFIG transport_config, /* i : Transport configuration */ + REVERB_HANDLE hReverb, /* i : reverb handle */ + AUDIO_CONFIG transport_config, /* i : Transport configuration */ BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ const int16_t nchan_transport, /* i : Transport channels (ISms) */ const int16_t lfe_idx, /* i : LFE channel index */ @@ -263,7 +263,6 @@ ivas_error ivas_td_binaural_renderer_unwrap( { return error; } - } /* Render subframe */ @@ -545,9 +544,9 @@ ivas_error ivas_td_binaural_renderer_ext( const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ - const REVERB_HANDLE reverb, /* i : reverb handle */ - const int16_t output_frame, /* i : output frame length */ - float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ + const REVERB_HANDLE reverb, /* i : reverb handle */ + const int16_t output_frame, /* i : output frame length */ + float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ) { ISM_METADATA_FRAME hIsmMetaDataFrame; diff --git a/lib_util/audio_file_reader.c b/lib_util/audio_file_reader.c index f124c11169..4f6bd0c34d 100644 --- a/lib_util/audio_file_reader.c +++ b/lib_util/audio_file_reader.c @@ -55,8 +55,7 @@ static int8_t AudioFileReader_open_raw( static int8_t AudioFileReader_open_wav( AudioFileReader *self, - const char *fileName -) + const char *fileName ) { uint32_t samplesInFile; int16_t bps; @@ -104,8 +103,7 @@ ivas_error AudioFileReader_open( if ( fileNameLen > wavSuffixLen && strncmp( fileName + fileNameLen - wavSuffixLen, wavSuffix, wavSuffixLen ) == 0 ) { - retCode = AudioFileReader_open_wav( self, fileName - ); + retCode = AudioFileReader_open_wav( self, fileName ); } else { -- GitLab From 4818c7da1e85bcb1d190a199ee6007230a9b7144 Mon Sep 17 00:00:00 2001 From: szczerba Date: Fri, 17 Mar 2023 12:12:19 +0100 Subject: [PATCH 251/375] Null position pointer handling --- lib_util/head_rotation_file_reader.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib_util/head_rotation_file_reader.c b/lib_util/head_rotation_file_reader.c index 3dab8a5b01..98a89ef3bb 100644 --- a/lib_util/head_rotation_file_reader.c +++ b/lib_util/head_rotation_file_reader.c @@ -132,11 +132,6 @@ ivas_error HeadRotationFileReading( return IVAS_ERR_FAILED_FILE_PARSE; } - if ( read_values == 7 && pPos == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - ( headRotReader->frameCounter )++; pQuaternion->w = w; @@ -144,9 +139,12 @@ ivas_error HeadRotationFileReading( pQuaternion->y = y; pQuaternion->z = z; #ifdef TD5 - pPos->x = posx; - pPos->y = posy; - pPos->z = posz; + if ( pPos != NULL ) + { + pPos->x = posx; + pPos->y = posy; + pPos->z = posz; + } #endif return IVAS_ERR_OK; -- GitLab From e32c5f1b80cf2e922fe76b4bb955b35542bdaee0 Mon Sep 17 00:00:00 2001 From: szczerba Date: Fri, 17 Mar 2023 13:14:08 +0100 Subject: [PATCH 252/375] Fix for the botched merge --- apps/renderer.c | 50 ++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 833ac7cd4d..46102c54b6 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -716,49 +716,49 @@ int main( 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 ) #else if ( ( error = IVAS_REND_InitConfig( hIvasRend, strlen( args.renderConfigFilePath ) != 0 ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "Error in Renderer Config Init\n" ); exit( -1 ); } -#endif - if ( args.renderConfigFilePath[0] != '\0' ) - { - IVAS_RENDER_CONFIG_DATA renderConfig; + if ( args.renderConfigFilePath[0] != '\0' ) + { + IVAS_RENDER_CONFIG_DATA renderConfig; - /* sanity check */ + /* sanity check */ #ifdef TD5 - if ( ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) && ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL ) ) + if ( ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) && ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL ) ) #else if ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) #endif - { + { #ifdef TD5 - fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL or BINAURAL_ROOM is used as output. Exiting. \n" ); + fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL or BINAURAL_ROOM is used as output. Exiting. \n" ); #else fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output. Exiting. \n" ); #endif - exit( -1 ); - } + exit( -1 ); + } - if ( ( error = IVAS_REND_GetRenderConfig( hIvasRend, &renderConfig ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_GetRenderConfig failed\n" ); - exit( -1 ); - } + if ( ( error = IVAS_REND_GetRenderConfig( hIvasRend, &renderConfig ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_GetRenderConfig failed\n" ); + exit( -1 ); + } - if ( RenderConfigReader_read( renderConfigReader, &renderConfig ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Failed to read renderer configuration from file %s\n", args.renderConfigFilePath ); - exit( -1 ); - } + if ( RenderConfigReader_read( renderConfigReader, &renderConfig ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Failed to read renderer configuration from file %s\n", args.renderConfigFilePath ); + exit( -1 ); + } - if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed\n" ); - exit( -1 ); - } + if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed\n" ); + exit( -1 ); } + } #ifdef FIX_I109_ORIENTATION_TRACKING if ( IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientationTracking ) ) -- GitLab From 565736146b5d71659c787edef2a77bf1d957ce82 Mon Sep 17 00:00:00 2001 From: szczerba Date: Fri, 17 Mar 2023 13:54:48 +0100 Subject: [PATCH 253/375] Fix for the botched merge --- lib_rend/ivas_objectRenderer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 2d1901288a..4a72b76384 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -455,11 +455,12 @@ void TDREND_Update_object_positions( Dir[1] = 0.0f; Dir[2] = 0.0f; +#endif /* Source directivity info */ DirAtten_p->ConeInnerAngle = 360.0f; DirAtten_p->ConeOuterAngle = 360.0f; DirAtten_p->ConeOuterGain = 1.0f; -#endif + TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ); TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); -- GitLab From ebf161d450908dba93a242fa61172d0125b9eb9c Mon Sep 17 00:00:00 2001 From: szczerba Date: Fri, 17 Mar 2023 13:57:58 +0100 Subject: [PATCH 254/375] cleanup: formatting update (clang) --- lib_util/head_rotation_file_reader.c | 6 +++--- lib_util/head_rotation_file_reader.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_util/head_rotation_file_reader.c b/lib_util/head_rotation_file_reader.c index 98a89ef3bb..a7ef6b04ea 100644 --- a/lib_util/head_rotation_file_reader.c +++ b/lib_util/head_rotation_file_reader.c @@ -95,10 +95,10 @@ ivas_error HeadRotationFileReader_open( ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ #ifdef TD5 - IVAS_QUATERNION *pQuaternion, /* o : head-tracking data */ - IVAS_POSITION *pPos /* o : listener position */ + IVAS_QUATERNION *pQuaternion, /* o : head-tracking data */ + IVAS_POSITION *pPos /* o : listener position */ #else - IVAS_QUATERNION *pQuaternion /* o : head-tracking data */ + IVAS_QUATERNION *pQuaternion /* o : head-tracking data */ #endif ) { diff --git a/lib_util/head_rotation_file_reader.h b/lib_util/head_rotation_file_reader.h index 127dd3a9fc..2a995f15f6 100644 --- a/lib_util/head_rotation_file_reader.h +++ b/lib_util/head_rotation_file_reader.h @@ -61,10 +61,10 @@ ivas_error HeadRotationFileReader_open( ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ #ifdef TD5 - IVAS_QUATERNION *pQuaternion, /* o : head-tracking data */ - IVAS_POSITION *pPos /* o : listener position */ + IVAS_QUATERNION *pQuaternion, /* o : head-tracking data */ + IVAS_POSITION *pPos /* o : listener position */ #else - IVAS_QUATERNION *pQuaternion /* o : head-tracking data */ + IVAS_QUATERNION *pQuaternion /* o : head-tracking data */ #endif ); #else -- GitLab From 0d5596b59f5e1a67b3c3974c277ec1157e22b0f8 Mon Sep 17 00:00:00 2001 From: hsd Date: Fri, 17 Mar 2023 14:25:30 +0100 Subject: [PATCH 255/375] [add] TD5_FIX_INVALID_MEMORY_ACCESS flag. Resolves segfault in case IVAS_REND_InitConfig gets initialized with rendererConfigEnabled:=false && ISM are being rendered. --- lib_com/options.h | 1 + lib_rend/ivas_objectRenderer.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index a33ea2f8d7..73615a0257 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -150,6 +150,7 @@ #define FIX_372_LIB_REND_VALIDATE_IO /* FhG: Issue 372: IVAS_rend segfaults with unsupported I/O configs - add validation checks of I/O config */ #define FIX_376_SBA_ROTATE /*DLB: Fix for issue 376*/ #define TD5 /* Eri: Contribution 17: Extended metadata for 6 DoF rendering in TD renderer */ +#define TD5_FIX_INVALID_MEMORY_ACCESS /* FhG: Resolves segfault in case IVAS_REND_InitConfig gets initialized with rendererConfigEnabled:=false && ISM are being rendered */ #ifdef FIX_I109_ORIENTATION_TRACKING #define OTR_REFERENCE_VECTOR_TRACKING /* FhG: enables the reference position orientation tracking mode */ diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 4a72b76384..d18d3c5f47 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -201,9 +201,24 @@ ivas_error ivas_td_binaural_open_unwrap( if ( ivas_format == ISM_FORMAT ) { DirAtten_p = pBinRendTd->DirAtten_p; +#ifdef TD5_FIX_INVALID_MEMORY_ACCESS + if(NULL == directivity) + { + DirAtten_p->ConeInnerAngle = 360.0f; /* Front cone */ + DirAtten_p->ConeOuterAngle = 360.0f; /* Back cone */ + DirAtten_p->ConeOuterGain = 1.0f; /* Back attenuation */ + } + else + { + DirAtten_p->ConeInnerAngle = directivity[0]; + DirAtten_p->ConeOuterAngle = directivity[1]; + DirAtten_p->ConeOuterGain = directivity[2]; + } +#else DirAtten_p->ConeInnerAngle = directivity[0]; DirAtten_p->ConeOuterAngle = directivity[1]; DirAtten_p->ConeOuterGain = directivity[2]; +#endif for ( nS = 0; nS < nchan_rend; nS++ ) { @@ -575,6 +590,9 @@ ivas_error ivas_td_binaural_open_ext( IVAS_FORMAT ivas_format; IVAS_OUTPUT_SETUP hTransSetup; ivas_error error; +#ifdef TD5_FIX_INVALID_MEMORY_ACCESS + float* directivity = NULL; +#endif if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { @@ -594,7 +612,13 @@ ivas_error ivas_td_binaural_open_ext( hTransSetup.ls_elevation = customLsInput->ls_elevation; #ifdef TD5 +#ifdef TD5_FIX_INVALID_MEMORY_ACCESS + if(NULL != hRendCfg) + directivity = hRendCfg->directivity; + return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, directivity, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); +#else return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, hRendCfg->directivity, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); +#endif #else return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); #endif -- GitLab From 40372f79bb7f5f6fd3e5f1830e03c5607b68d4d4 Mon Sep 17 00:00:00 2001 From: hsd Date: Fri, 17 Mar 2023 14:27:05 +0100 Subject: [PATCH 256/375] [cleanup] clang-format --- lib_util/head_rotation_file_reader.c | 2 +- lib_util/head_rotation_file_reader.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_util/head_rotation_file_reader.c b/lib_util/head_rotation_file_reader.c index a7ef6b04ea..500fdd2b7a 100644 --- a/lib_util/head_rotation_file_reader.c +++ b/lib_util/head_rotation_file_reader.c @@ -155,7 +155,7 @@ ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ IVAS_QUATERNION *Quaternions, /* o : head-tracking data, listener orientation */ #ifdef TD5 - IVAS_POSITION *Pos /* o : listener position */ + IVAS_POSITION *Pos /* o : listener position */ #else const int32_t frame_dec /* i : decoded frame number */ #endif diff --git a/lib_util/head_rotation_file_reader.h b/lib_util/head_rotation_file_reader.h index 2a995f15f6..d735423e2c 100644 --- a/lib_util/head_rotation_file_reader.h +++ b/lib_util/head_rotation_file_reader.h @@ -72,7 +72,7 @@ ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ IVAS_QUATERNION *Quaternions, /* o : head-tracking data */ #ifdef TD5 - IVAS_POSITION *Pos /* o : listener position */ + IVAS_POSITION *Pos /* o : listener position */ #else const int32_t frame_dec /* i : decoded frame number */ #endif -- GitLab From da1228bb10560c47dbc62f140663db983f4e785e Mon Sep 17 00:00:00 2001 From: hsd Date: Fri, 17 Mar 2023 14:34:51 +0100 Subject: [PATCH 257/375] [cleanup] clang-format --- lib_rend/ivas_objectRenderer.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index d18d3c5f47..270da74b5c 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -202,17 +202,17 @@ ivas_error ivas_td_binaural_open_unwrap( { DirAtten_p = pBinRendTd->DirAtten_p; #ifdef TD5_FIX_INVALID_MEMORY_ACCESS - if(NULL == directivity) + if ( NULL == directivity ) { - DirAtten_p->ConeInnerAngle = 360.0f; /* Front cone */ - DirAtten_p->ConeOuterAngle = 360.0f; /* Back cone */ - DirAtten_p->ConeOuterGain = 1.0f; /* Back attenuation */ + DirAtten_p->ConeInnerAngle = 360.0f; /* Front cone */ + DirAtten_p->ConeOuterAngle = 360.0f; /* Back cone */ + DirAtten_p->ConeOuterGain = 1.0f; /* Back attenuation */ } else { - DirAtten_p->ConeInnerAngle = directivity[0]; - DirAtten_p->ConeOuterAngle = directivity[1]; - DirAtten_p->ConeOuterGain = directivity[2]; + DirAtten_p->ConeInnerAngle = directivity[0]; + DirAtten_p->ConeOuterAngle = directivity[1]; + DirAtten_p->ConeOuterGain = directivity[2]; } #else DirAtten_p->ConeInnerAngle = directivity[0]; @@ -591,7 +591,7 @@ ivas_error ivas_td_binaural_open_ext( IVAS_OUTPUT_SETUP hTransSetup; ivas_error error; #ifdef TD5_FIX_INVALID_MEMORY_ACCESS - float* directivity = NULL; + float *directivity = NULL; #endif if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) @@ -613,8 +613,8 @@ ivas_error ivas_td_binaural_open_ext( #ifdef TD5 #ifdef TD5_FIX_INVALID_MEMORY_ACCESS - if(NULL != hRendCfg) - directivity = hRendCfg->directivity; + if ( NULL != hRendCfg ) + directivity = hRendCfg->directivity; return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, directivity, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); #else return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, hRendCfg->directivity, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); -- GitLab From 0df79b886eb4af5649ccad04811f26fc41b99f76 Mon Sep 17 00:00:00 2001 From: szczerba Date: Fri, 17 Mar 2023 14:51:06 +0100 Subject: [PATCH 258/375] [Cleanup] removal of unused parameter from ivas_rend_openCrend function --- lib_dec/ivas_init_dec.c | 5 +++++ lib_dec/ivas_ism_dec.c | 2 ++ lib_dec/ivas_mct_dec.c | 5 ++++- lib_rend/ivas_crend.c | 2 ++ lib_rend/ivas_prot_rend.h | 2 ++ lib_rend/lib_rend.c | 8 ++++++++ 6 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 244060fb6d..a3a48030a9 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1278,8 +1278,13 @@ ivas_error ivas_init_decoder( } } +#ifdef FIX_I109_ORIENTATION_TRACKING + if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, + st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->Opt_Headrotation, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 28a36d36d4..5fd1c879f1 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -155,7 +155,9 @@ static ivas_error ivas_ism_bitrate_switching( st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, +#ifndef FIX_I109_ORIENTATION_TRACKING st_ivas->hDecoderConfig->Opt_Headrotation, +#endif st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 1e34ef397a..96a535f427 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1145,7 +1145,10 @@ static ivas_error ivas_mc_dec_reconfig( if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, - st_ivas->hRenderConfig, st_ivas->hDecoderConfig->Opt_Headrotation, + st_ivas->hRenderConfig, +#ifndef FIX_I109_ORIENTATION_TRACKING + st_ivas->hDecoderConfig->Opt_Headrotation, +#endif st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 6fa03ba7dd..f9673656f1 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -733,7 +733,9 @@ ivas_error ivas_rend_openCrend( const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg, +#ifndef FIX_I109_ORIENTATION_TRACKING int16_t Opt_Headrotation, +#endif HRTFS_CREND_HANDLE hSetOfHRTF, const int32_t output_Fs ) { diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index a01d9ccbcc..2b0e67e5f4 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -493,7 +493,9 @@ ivas_error ivas_rend_openCrend( const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg, +#ifndef FIX_I109_ORIENTATION_TRACKING int16_t Opt_Headrotation, +#endif HRTFS_CREND_HANDLE hSetOfHRTF, const int32_t output_Fs ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 1c84149ef1..a69393e10e 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1137,7 +1137,9 @@ static ivas_error setRendInputActiveIsm( if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, +#ifndef FIX_I109_ORIENTATION_TRACKING 0, +#endif NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -1862,7 +1864,9 @@ static ivas_error initMcBinauralRendering( if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) ? AUDIO_CONFIG_7_1_4 : getIvasAudioConfigFromRendAudioConfig( inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, +#ifndef FIX_I109_ORIENTATION_TRACKING 0, +#endif NULL, outSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -2137,7 +2141,9 @@ static ivas_error updateSbaPanGains( getIvasAudioConfigFromRendAudioConfig( inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, +#ifndef FIX_I109_ORIENTATION_TRACKING 0, +#endif NULL, *rendCtx.pOutSampleRate ); break; @@ -2151,7 +2157,9 @@ static ivas_error updateSbaPanGains( AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, +#ifndef FIX_I109_ORIENTATION_TRACKING 0, +#endif NULL, *rendCtx.pOutSampleRate ); break; -- GitLab From a927622ace85f1f604b6b8acc39d75646a9872fe Mon Sep 17 00:00:00 2001 From: hsd Date: Fri, 17 Mar 2023 15:14:47 +0100 Subject: [PATCH 259/375] [add] Vector3Pair trajectory file to ensure that a constant positional offset between listener and reference (10, in all axis) gets correctly compensated in REF_VEC otr mode --- ...p-and-down-4s-fixed-pos-offset-Vector3.csv | 200 ++++++++++++++++++ tests/renderer/test_renderer.py | 23 ++ 2 files changed, 223 insertions(+) create mode 100644 scripts/trajectories/full-circle-with-up-and-down-4s-fixed-pos-offset-Vector3.csv diff --git a/scripts/trajectories/full-circle-with-up-and-down-4s-fixed-pos-offset-Vector3.csv b/scripts/trajectories/full-circle-with-up-and-down-4s-fixed-pos-offset-Vector3.csv new file mode 100644 index 0000000000..c858131d94 --- /dev/null +++ b/scripts/trajectories/full-circle-with-up-and-down-4s-fixed-pos-offset-Vector3.csv @@ -0,0 +1,200 @@ +10.0000,10.0000,10.0000,10.7012,9.9780,9.2874 +10.0000,10.0000,10.0000,10.7057,9.9556,9.2929 +10.0000,10.0000,10.0000,10.7095,9.9329,9.2985 +10.0000,10.0000,10.0000,10.7125,9.9100,9.3041 +10.0000,10.0000,10.0000,10.7147,9.8868,9.3097 +10.0000,10.0000,10.0000,10.7161,9.8634,9.3155 +10.0000,10.0000,10.0000,10.7166,9.8398,9.3212 +10.0000,10.0000,10.0000,10.7164,9.8161,9.3270 +10.0000,10.0000,10.0000,10.7153,9.7922,9.3328 +10.0000,10.0000,10.0000,10.7134,9.7682,9.3387 +10.0000,10.0000,10.0000,10.7106,9.7442,9.3446 +10.0000,10.0000,10.0000,10.7070,9.7201,9.3506 +10.0000,10.0000,10.0000,10.7025,9.6960,9.3565 +10.0000,10.0000,10.0000,10.6972,9.6719,9.3626 +10.0000,10.0000,10.0000,10.6910,9.6479,9.3686 +10.0000,10.0000,10.0000,10.6839,9.6240,9.3748 +10.0000,10.0000,10.0000,10.6760,9.6002,9.3809 +10.0000,10.0000,10.0000,10.6671,9.5766,9.3871 +10.0000,10.0000,10.0000,10.6575,9.5532,9.3933 +10.0000,10.0000,10.0000,10.6470,9.5300,9.3996 +10.0000,10.0000,10.0000,10.6356,9.5070,9.4059 +10.0000,10.0000,10.0000,10.6234,9.4843,9.4122 +10.0000,10.0000,10.0000,10.6103,9.4620,9.4186 +10.0000,10.0000,10.0000,10.5964,9.4399,9.4250 +10.0000,10.0000,10.0000,10.5817,9.4183,9.4314 +10.0000,10.0000,10.0000,10.5662,9.3971,9.4379 +10.0000,10.0000,10.0000,10.5499,9.3763,9.4444 +10.0000,10.0000,10.0000,10.5328,9.3560,9.4510 +10.0000,10.0000,10.0000,10.5149,9.3362,9.4576 +10.0000,10.0000,10.0000,10.4963,9.3169,9.4642 +10.0000,10.0000,10.0000,10.4769,9.2982,9.4708 +10.0000,10.0000,10.0000,10.4569,9.2801,9.4775 +10.0000,10.0000,10.0000,10.4361,9.2626,9.4842 +10.0000,10.0000,10.0000,10.4147,9.2457,9.4910 +10.0000,10.0000,10.0000,10.3926,9.2295,9.4977 +10.0000,10.0000,10.0000,10.3698,9.2140,9.5045 +10.0000,10.0000,10.0000,10.3465,9.1993,9.5114 +10.0000,10.0000,10.0000,10.3226,9.1852,9.5182 +10.0000,10.0000,10.0000,10.2981,9.1720,9.5251 +10.0000,10.0000,10.0000,10.2731,9.1595,9.5321 +10.0000,10.0000,10.0000,10.2476,9.1478,9.5390 +10.0000,10.0000,10.0000,10.2216,9.1370,9.5460 +10.0000,10.0000,10.0000,10.1951,9.1270,9.5530 +10.0000,10.0000,10.0000,10.1683,9.1179,9.5601 +10.0000,10.0000,10.0000,10.1410,9.1096,9.5671 +10.0000,10.0000,10.0000,10.1134,9.1023,9.5742 +10.0000,10.0000,10.0000,10.0855,9.0959,9.5813 +10.0000,10.0000,10.0000,10.0572,9.0904,9.5885 +10.0000,10.0000,10.0000,10.0287,9.0858,9.5957 +10.0000,10.0000,10.0000,10.0000,9.0822,9.6029 +10.0000,10.0000,10.0000,9.9711,9.0796,9.6101 +10.0000,10.0000,10.0000,9.9420,9.0779,9.6173 +10.0000,10.0000,10.0000,9.9128,9.0773,9.6246 +10.0000,10.0000,10.0000,9.8835,9.0776,9.6319 +10.0000,10.0000,10.0000,9.8541,9.0788,9.6392 +10.0000,10.0000,10.0000,9.8247,9.0811,9.6465 +10.0000,10.0000,10.0000,9.7953,9.0844,9.6539 +10.0000,10.0000,10.0000,9.7660,9.0887,9.6613 +10.0000,10.0000,10.0000,9.7368,9.0940,9.6687 +10.0000,10.0000,10.0000,9.7076,9.1002,9.6761 +10.0000,10.0000,10.0000,9.6787,9.1075,9.6835 +10.0000,10.0000,10.0000,9.6499,9.1157,9.6910 +10.0000,10.0000,10.0000,9.6213,9.1250,9.6985 +10.0000,10.0000,10.0000,9.5930,9.1352,9.7060 +10.0000,10.0000,10.0000,9.5650,9.1464,9.7135 +10.0000,10.0000,10.0000,9.5374,9.1585,9.7210 +10.0000,10.0000,10.0000,9.5101,9.1716,9.7286 +10.0000,10.0000,10.0000,9.4832,9.1856,9.7361 +10.0000,10.0000,10.0000,9.4567,9.2005,9.7437 +10.0000,10.0000,10.0000,9.4307,9.2164,9.7513 +10.0000,10.0000,10.0000,9.4052,9.2331,9.7589 +10.0000,10.0000,10.0000,9.3802,9.2508,9.7666 +10.0000,10.0000,10.0000,9.3558,9.2693,9.7742 +10.0000,10.0000,10.0000,9.3319,9.2886,9.7819 +10.0000,10.0000,10.0000,9.3087,9.3087,9.7895 +10.0000,10.0000,10.0000,9.2862,9.3297,9.7972 +10.0000,10.0000,10.0000,9.2643,9.3514,9.8049 +10.0000,10.0000,10.0000,9.2431,9.3739,9.8126 +10.0000,10.0000,10.0000,9.2227,9.3971,9.8203 +10.0000,10.0000,10.0000,9.2030,9.4210,9.8281 +10.0000,10.0000,10.0000,9.1841,9.4455,9.8358 +10.0000,10.0000,10.0000,9.1661,9.4708,9.8436 +10.0000,10.0000,10.0000,9.1488,9.4966,9.8513 +10.0000,10.0000,10.0000,9.1324,9.5231,9.8591 +10.0000,10.0000,10.0000,9.1169,9.5501,9.8669 +10.0000,10.0000,10.0000,9.1023,9.5776,9.8747 +10.0000,10.0000,10.0000,9.0886,9.6056,9.8825 +10.0000,10.0000,10.0000,9.0758,9.6341,9.8903 +10.0000,10.0000,10.0000,9.0640,9.6630,9.8981 +10.0000,10.0000,10.0000,9.0532,9.6924,9.9059 +10.0000,10.0000,10.0000,9.0433,9.7221,9.9137 +10.0000,10.0000,10.0000,9.0344,9.7521,9.9215 +10.0000,10.0000,10.0000,9.0265,9.7824,9.9294 +10.0000,10.0000,10.0000,9.0197,9.8130,9.9372 +10.0000,10.0000,10.0000,9.0138,9.8438,9.9451 +10.0000,10.0000,10.0000,9.0090,9.8748,9.9529 +10.0000,10.0000,10.0000,9.0052,9.9060,9.9607 +10.0000,10.0000,10.0000,9.0025,9.9372,9.9686 +10.0000,10.0000,10.0000,9.0008,9.9686,9.9764 +10.0000,10.0000,10.0000,9.0001,10.0000,9.9843 +10.0000,10.0000,10.0000,9.0005,10.0314,9.9921 +10.0000,10.0000,10.0000,9.0020,10.0628,10.0000 +10.0000,10.0000,10.0000,9.0045,10.0941,10.0079 +10.0000,10.0000,10.0000,9.0080,10.1253,10.0157 +10.0000,10.0000,10.0000,9.0126,10.1564,10.0236 +10.0000,10.0000,10.0000,9.0182,10.1873,10.0314 +10.0000,10.0000,10.0000,9.0248,10.2180,10.0393 +10.0000,10.0000,10.0000,9.0325,10.2484,10.0471 +10.0000,10.0000,10.0000,9.0412,10.2786,10.0550 +10.0000,10.0000,10.0000,9.0508,10.3084,10.0628 +10.0000,10.0000,10.0000,9.0615,10.3379,10.0706 +10.0000,10.0000,10.0000,9.0731,10.3670,10.0785 +10.0000,10.0000,10.0000,9.0857,10.3957,10.0863 +10.0000,10.0000,10.0000,9.0992,10.4239,10.0941 +10.0000,10.0000,10.0000,9.1136,10.4516,10.1019 +10.0000,10.0000,10.0000,9.1290,10.4788,10.1097 +10.0000,10.0000,10.0000,9.1452,10.5055,10.1175 +10.0000,10.0000,10.0000,9.1623,10.5316,10.1253 +10.0000,10.0000,10.0000,9.1803,10.5571,10.1331 +10.0000,10.0000,10.0000,9.1991,10.5819,10.1409 +10.0000,10.0000,10.0000,9.2186,10.6061,10.1487 +10.0000,10.0000,10.0000,9.2390,10.6296,10.1564 +10.0000,10.0000,10.0000,9.2601,10.6523,10.1642 +10.0000,10.0000,10.0000,9.2819,10.6744,10.1719 +10.0000,10.0000,10.0000,9.3044,10.6956,10.1797 +10.0000,10.0000,10.0000,9.3276,10.7161,10.1874 +10.0000,10.0000,10.0000,9.3514,10.7357,10.1951 +10.0000,10.0000,10.0000,9.3758,10.7545,10.2028 +10.0000,10.0000,10.0000,9.4008,10.7725,10.2105 +10.0000,10.0000,10.0000,9.4264,10.7895,10.2181 +10.0000,10.0000,10.0000,9.4524,10.8057,10.2258 +10.0000,10.0000,10.0000,9.4790,10.8210,10.2334 +10.0000,10.0000,10.0000,9.5060,10.8354,10.2411 +10.0000,10.0000,10.0000,9.5334,10.8488,10.2487 +10.0000,10.0000,10.0000,9.5612,10.8612,10.2563 +10.0000,10.0000,10.0000,9.5893,10.8728,10.2639 +10.0000,10.0000,10.0000,9.6178,10.8833,10.2714 +10.0000,10.0000,10.0000,9.6465,10.8929,10.2790 +10.0000,10.0000,10.0000,9.6755,10.9014,10.2865 +10.0000,10.0000,10.0000,9.7046,10.9090,10.2940 +10.0000,10.0000,10.0000,9.7340,10.9156,10.3015 +10.0000,10.0000,10.0000,9.7635,10.9212,10.3090 +10.0000,10.0000,10.0000,9.7931,10.9258,10.3165 +10.0000,10.0000,10.0000,9.8227,10.9293,10.3239 +10.0000,10.0000,10.0000,9.8524,10.9319,10.3313 +10.0000,10.0000,10.0000,9.8821,10.9335,10.3387 +10.0000,10.0000,10.0000,9.9117,10.9340,10.3461 +10.0000,10.0000,10.0000,9.9413,10.9336,10.3535 +10.0000,10.0000,10.0000,9.9707,10.9322,10.3608 +10.0000,10.0000,10.0000,10.0000,10.9298,10.3681 +10.0000,10.0000,10.0000,10.0291,10.9264,10.3754 +10.0000,10.0000,10.0000,10.0580,10.9221,10.3827 +10.0000,10.0000,10.0000,10.0867,10.9168,10.3899 +10.0000,10.0000,10.0000,10.1150,10.9105,10.3971 +10.0000,10.0000,10.0000,10.1431,10.9033,10.4043 +10.0000,10.0000,10.0000,10.1708,10.8953,10.4115 +10.0000,10.0000,10.0000,10.1981,10.8863,10.4187 +10.0000,10.0000,10.0000,10.2250,10.8764,10.4258 +10.0000,10.0000,10.0000,10.2515,10.8657,10.4329 +10.0000,10.0000,10.0000,10.2775,10.8541,10.4399 +10.0000,10.0000,10.0000,10.3030,10.8417,10.4470 +10.0000,10.0000,10.0000,10.3280,10.8284,10.4540 +10.0000,10.0000,10.0000,10.3524,10.8144,10.4610 +10.0000,10.0000,10.0000,10.3763,10.7997,10.4679 +10.0000,10.0000,10.0000,10.3995,10.7841,10.4749 +10.0000,10.0000,10.0000,10.4222,10.7679,10.4818 +10.0000,10.0000,10.0000,10.4441,10.7510,10.4886 +10.0000,10.0000,10.0000,10.4654,10.7334,10.4955 +10.0000,10.0000,10.0000,10.4860,10.7152,10.5023 +10.0000,10.0000,10.0000,10.5059,10.6964,10.5090 +10.0000,10.0000,10.0000,10.5251,10.6769,10.5158 +10.0000,10.0000,10.0000,10.5435,10.6570,10.5225 +10.0000,10.0000,10.0000,10.5611,10.6365,10.5292 +10.0000,10.0000,10.0000,10.5780,10.6155,10.5358 +10.0000,10.0000,10.0000,10.5940,10.5940,10.5424 +10.0000,10.0000,10.0000,10.6093,10.5721,10.5490 +10.0000,10.0000,10.0000,10.6237,10.5499,10.5556 +10.0000,10.0000,10.0000,10.6373,10.5272,10.5621 +10.0000,10.0000,10.0000,10.6500,10.5042,10.5686 +10.0000,10.0000,10.0000,10.6619,10.4809,10.5750 +10.0000,10.0000,10.0000,10.6729,10.4573,10.5814 +10.0000,10.0000,10.0000,10.6831,10.4335,10.5878 +10.0000,10.0000,10.0000,10.6924,10.4095,10.5941 +10.0000,10.0000,10.0000,10.7008,10.3852,10.6004 +10.0000,10.0000,10.0000,10.7083,10.3609,10.6067 +10.0000,10.0000,10.0000,10.7150,10.3364,10.6129 +10.0000,10.0000,10.0000,10.7207,10.3119,10.6191 +10.0000,10.0000,10.0000,10.7256,10.2873,10.6252 +10.0000,10.0000,10.0000,10.7296,10.2627,10.6314 +10.0000,10.0000,10.0000,10.7328,10.2381,10.6374 +10.0000,10.0000,10.0000,10.7351,10.2136,10.6435 +10.0000,10.0000,10.0000,10.7365,10.1891,10.6494 +10.0000,10.0000,10.0000,10.7371,10.1648,10.6554 +10.0000,10.0000,10.0000,10.7368,10.1406,10.6613 +10.0000,10.0000,10.0000,10.7357,10.1165,10.6672 +10.0000,10.0000,10.0000,10.7338,10.0927,10.6730 +10.0000,10.0000,10.0000,10.7311,10.0691,10.6788 +10.0000,10.0000,10.0000,10.7275,10.0458,10.6845 +10.0000,10.0000,10.0000,10.7232,10.0227,10.6903 +10.0000,10.0000,10.0000,10.7181,10.0000,10.6959 diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index 2a09faa9f5..690f495c7f 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -159,6 +159,29 @@ def test_ambisonics_binaural_headrotation_refvec_rotating(test_info, in_fmt, out } ) +# This test compares rendering with: +# ref: a head rotation trajectory with elevation (OTR=NONE) +# cut: a static head rotation and a reference position trajectory which moves +# in a way that produces the same acoustic output as the ref head rot trajectory (OTR=REF_VEC) +# which also contains a fixed position offset between listener and reference position (which +# gets compensated in the REF_VEV OTR modes) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_binaural_headrotation_refvec_rotating_fixed_pos_offset(test_info, in_fmt, out_fmt): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refvec_rotating", + "trj_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s-ccw.csv"), + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"), + "refvec_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s-fixed-pos-offset-Vector3.csv") + } + ) + # This test compares rendering with: # ref: a reference position trajectory with elevation and REF_VEC_LEV OTR mode (OTR=REF_VEC_LEV) # cut: a reference position trajectory without the elevation and REF_VEC OTR mode (OTR=REF_VEC) -- GitLab From ddd110c7ad299a0d808b5513acec1791305a5e87 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Fri, 17 Mar 2023 15:40:15 +0100 Subject: [PATCH 260/375] turn off bandwidth detection for MCT under DISABLE_BWD_MCT --- lib_com/ivas_prot.h | 2 ++ lib_com/options.h | 1 + lib_enc/bw_detect.c | 3 ++- lib_enc/ivas_mct_core_enc.c | 11 +++++++---- lib_enc/ivas_mct_enc.c | 9 ++++++++- lib_enc/ivas_mdct_core_enc.c | 14 +++++++++++++- 6 files changed, 33 insertions(+), 7 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 8ec50b98a0..273e2ae434 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -2713,7 +2713,9 @@ void ivas_mct_core_enc( CPE_ENC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE encoder structures */ const int16_t nChannels, /* i : number of channels to be coded */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ +#ifndef DISABLE_BWD_MCT const int16_t switch_bw, /* i : flag bandwidth switch occurance */ +#endif const int16_t lfe_bits, /* i : bits spent for LFE */ const int16_t sba_order /* i : Ambisonic (SBA) order */ ); diff --git a/lib_com/options.h b/lib_com/options.h index 1dd2d2e218..d82a439c99 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -152,6 +152,7 @@ #define FIX_372_LIB_REND_VALIDATE_IO /* FhG: Issue 372: IVAS_rend segfaults with unsupported I/O configs - add validation checks of I/O config */ #define FIX_376_SBA_ROTATE /*DLB: Fix for issue 376*/ #define TD5 /* Eri: Contribution 17: Extended metadata for 6 DoF rendering in TD renderer */ +#define DISABLE_BWD_MCT /* FhG: Disable bandwidth detection for MCT*/ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_enc/bw_detect.c b/lib_enc/bw_detect.c index 5f46910c57..c23741adf9 100644 --- a/lib_enc/bw_detect.c +++ b/lib_enc/bw_detect.c @@ -647,7 +647,7 @@ void set_bw_stereo( return; } - +#ifndef DISABLE_BWD_MCT /*-------------------------------------------------------------------* * set_bw_mct() * @@ -698,3 +698,4 @@ int16_t set_bw_mct( return bw_changed; } +#endif \ No newline at end of file diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 5cbcb57daf..c442882107 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -194,9 +194,11 @@ void ivas_mct_core_enc( CPE_ENC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE encoder structures */ const int16_t nChannels, /* i : number of channels to be coded */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const int16_t switch_bw, /* i : flag bandwidth switch occurance */ - const int16_t lfe_bits, /* i : bits spent for LFE */ - const int16_t sba_order /* i : Ambisonic (SBA) order */ +#ifndef DISABLE_BWD_MCT + const int16_t switch_bw, /* i : flag bandwidth switch occurance */ +#endif + const int16_t lfe_bits, /* i : bits spent for LFE */ + const int16_t sba_order /* i : Ambisonic (SBA) order */ ) { int16_t ch, ch_core, nSubframes, L_subframeTCX; @@ -278,12 +280,13 @@ void ivas_mct_core_enc( { ch_core = ch * CPE_CHANNELS; +#ifndef DISABLE_BWD_MCT if ( switch_bw ) { initMdctStereoEncData( hMCT->hBlockData[ch]->hStereoMdct, ivas_format, sts[ch_core]->element_mode, sts[ch_core]->element_brate, sts[ch_core]->bwidth, sts[ch_core]->igf, sts[ch_core]->hIGFEnc->igfData.igfInfo.grid, 0 ); } - +#endif if ( sts[ch_core]->igf ) { /* calculate the igf start band from the igf start line */ diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 707e74e329..4a4505f786 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -109,7 +109,9 @@ ivas_error ivas_mct_enc( CPE_ENC_HANDLE hCPE; float mdst_spectrum_long[MCT_MAX_BLOCKS][CPE_CHANNELS][L_FRAME48k]; float orig_spectrum_long[MCT_MAX_BLOCKS][CPE_CHANNELS][L_FRAME48k]; +#ifndef DISABLE_BWD_MCT int16_t switch_bw; +#endif IVAS_FORMAT ivas_format; int16_t max_bwidth; int32_t ivas_total_brate; @@ -160,8 +162,10 @@ ivas_error ivas_mct_enc( } } +#ifndef DISABLE_BWD_MCT /* set coded audio band-width */ switch_bw = set_bw_mct( st_ivas->hCPE, st_ivas->nCPE ); +#endif /* pre-processing */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) @@ -173,7 +177,10 @@ ivas_error ivas_mct_enc( } /* joint MCT encoding */ - ivas_mct_core_enc( ivas_format, hMCT, st_ivas->hCPE, hMCT->nchan_out_woLFE + hMCT->num_lfe, ivas_total_brate, switch_bw, + ivas_mct_core_enc( ivas_format, hMCT, st_ivas->hCPE, hMCT->nchan_out_woLFE + hMCT->num_lfe, ivas_total_brate, +#ifndef DISABLE_BWD_MCT + switch_bw, +#endif ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) ? (int16_t) st_ivas->hLFE->lfe_bits : 0, st_ivas->hEncoderConfig->sba_order ); /* Spectrum quantization and coding */ diff --git a/lib_enc/ivas_mdct_core_enc.c b/lib_enc/ivas_mdct_core_enc.c index 626dcf2631..7287537c72 100644 --- a/lib_enc/ivas_mdct_core_enc.c +++ b/lib_enc/ivas_mdct_core_enc.c @@ -685,7 +685,8 @@ void ivas_mdct_core_whitening_enc( core_signal_analysis_high_bitrate( new_samples[ch] + L_INP_MEM, T_op[ch], NULL, NULL, st, mdst_spectrum[ch], tnsSize[ch], tnsBits[ch], param_core[ch], <pBits[ch], windowedSignal[ch], st->L_frame, st->hTcxEnc->L_frameTCX, hCPE->last_element_mode, 0 ); - /* BWD in MDCT domain */ +/* BWD in MDCT domain */ +#ifndef DISABLE_BWD_MCT if ( st->hTcxEnc->transform_type[0] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) { if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) @@ -693,6 +694,17 @@ void ivas_mdct_core_whitening_enc( bw_detect( st, NULL, st->hTcxEnc->spectrum[0], NULL ); } } +#else + if ( ( st->hTcxEnc->transform_type[0] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) && !mct_on ) + { + + bw_detect( st, NULL, st->hTcxEnc->spectrum[0], NULL ); + } + else if ( mct_on ) + { + st->bwidth = st->max_bwidth; + } +#endif if ( st->last_core == ACELP_CORE ) /* reset past kernel info */ { -- GitLab From c15a98c88cb005d59f21532efdf6b2e379f91f47 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Fri, 17 Mar 2023 16:14:48 +0100 Subject: [PATCH 261/375] fix end of line issue --- lib_enc/bw_detect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/bw_detect.c b/lib_enc/bw_detect.c index c23741adf9..c709cc3b2f 100644 --- a/lib_enc/bw_detect.c +++ b/lib_enc/bw_detect.c @@ -698,4 +698,4 @@ int16_t set_bw_mct( return bw_changed; } -#endif \ No newline at end of file +#endif -- GitLab From 6d4b7ea192c831af553bb3210e4c8029fccf05c7 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Mar 2023 10:17:27 +0100 Subject: [PATCH 262/375] add error codes for orientation tracking --- apps/renderer.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 46102c54b6..9a3986a77c 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -761,7 +761,7 @@ int main( } #ifdef FIX_I109_ORIENTATION_TRACKING - if ( IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientationTracking ) ) + if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientationTracking ) ) != IVAS_ERR_OK ) { return error; } @@ -988,17 +988,18 @@ int main( { IVAS_QUATERNION quaternion; #ifdef TD5 - if ( HeadRotationFileReading( referenceRotReader, &quaternion, NULL ) != IVAS_ERR_OK ) + if ( ( error = HeadRotationFileReading( referenceRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK ) #else if ( HeadRotationFileReading( referenceRotReader, &quaternion ) != IVAS_ERR_OK ) #endif { - fprintf( stderr, "Error in Head Rotation File Reading.\r\n" ); + fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } - if ( IVAS_REND_SetReferenceRotation( hIvasRend, quaternion ) != IVAS_ERR_OK ) + + if ( ( error = IVAS_REND_SetReferenceRotation( hIvasRend, quaternion ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error setting Reference Rotation.\r\n" ); + fprintf( stderr, "Error setting Reference Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } } @@ -1008,16 +1009,17 @@ int main( if ( headRotReader != NULL ) { IVAS_QUATERNION quatBuffer[RENDERER_HEAD_POSITIONS_PER_FRAME]; + #ifdef FIX_I109_ORIENTATION_TRACKING for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) { #ifdef TD5 - if ( HeadRotationFileReading( headRotReader, &quatBuffer[i], &Pos[i] ) != IVAS_ERR_OK ) + if ( ( error = HeadRotationFileReading( headRotReader, &quatBuffer[i], &Pos[i] ) ) != IVAS_ERR_OK ) #else if ( HeadRotationFileReading( headRotReader, &quatBuffer[i] ) != IVAS_ERR_OK ) #endif { - fprintf( stderr, "Error in Head Rotation File Reading.\r\n" ); + fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } } @@ -1029,24 +1031,24 @@ int main( #endif #endif #ifdef TD5 - if ( IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer, Pos ) != IVAS_ERR_OK ) + if ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer, Pos ) ) != IVAS_ERR_OK ) #else if ( IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer ) != IVAS_ERR_OK ) #endif { - fprintf( stderr, "Error setting Head Rotation\n" ); + fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } } else { #ifdef TD5 - if ( ( IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ) != IVAS_ERR_OK ) && ( IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ) != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) + if ( ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ) ) != IVAS_ERR_OK ) && ( IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ) != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) // VE: TBC #else if ( ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_OK ) && ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) #endif { - fprintf( stderr, "Error setting Head Rotation\n" ); + fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } } -- GitLab From 93c37bbd73e17ecc2156fdf360462e308938e2d4 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Mar 2023 10:37:28 +0100 Subject: [PATCH 263/375] comments/formatting within MD5 --- lib_com/ivas_prot.h | 6 ++-- lib_dec/ivas_ism_metadata_dec.c | 45 ++++++++++++++++++++---------- lib_dec/lib_dec.c | 4 +-- lib_enc/ivas_ism_metadata_enc.c | 49 ++++++++++++++++++++------------- lib_enc/ivas_stat_enc.h | 7 ++--- lib_enc/lib_enc.c | 1 + 6 files changed, 69 insertions(+), 43 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index a0506e7473..194559ee79 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -783,9 +783,9 @@ ivas_error ivas_set_ism_metadata( const float azimuth, /* i : azimuth value */ #ifdef TD5 const float elevation, /* i : elevation value */ - float radius_meta, /* i : radius */ - float yaw, /* i : yaw */ - float pitch /* i : pitch */ + const float radius_meta, /* i : radius */ + const float yaw, /* i : yaw */ + const float pitch /* i : pitch */ #else const float elevation /* i : elevation value */ #endif diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 7c8946fc43..4b604c3b8c 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -42,13 +42,15 @@ #endif #include "wmc_auto.h" -/* Local Functions */ + #ifdef TD5 /*-----------------------------------------------------------------------* * Local functions *-----------------------------------------------------------------------*/ + static void decode_angle_indices( DEC_CORE_HANDLE st0, ISM_METADATA_ANGLE_HANDLE angle, int16_t *flag_abs_azimuth ); -int16_t decode_radius( DEC_CORE_HANDLE st0, int16_t *last_radius_idx, int16_t *flag_abs_radius ); + +static int16_t decode_radius( DEC_CORE_HANDLE st0, int16_t *last_radius_idx, int16_t *flag_abs_radius ); #endif /*-------------------------------------------------------------------------* @@ -172,12 +174,15 @@ ivas_error ivas_ism_metadata_dec( /* IVAS_fmToDo: more work needed when the number of transported objects is not constant */ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong number of objects signalled!" ); } + #ifdef TD5 + /* read extended metadata presence flag */ if ( ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) { ism_extended_metadata_flag = get_next_indice( st0, ISM_EXTENDED_METADATA_BITS ); } #endif + /* Read ISm present flags (one per object) */ for ( ch = 0; ch < *nchan_transport; ch++ ) { @@ -241,6 +246,7 @@ ivas_error ivas_ism_metadata_dec( flag_abs_orientation = 0; flag_abs_radius = 0; #endif + if ( hIsmMeta[ch]->ism_metadata_flag ) { #ifdef TD5 @@ -631,18 +637,26 @@ ivas_error ivas_ism_metadata_dec_create( return IVAS_ERR_OK; } + #ifdef TD5 +/*------------------------------------------------------------------------- + * decode_angle_indices() + * + * Decoding of an angle + *-------------------------------------------------------------------------*/ + static void decode_angle_indices( DEC_CORE_HANDLE st0, /* i/o: bitstream handle */ ISM_METADATA_ANGLE_HANDLE angle, /* i/o: angle handle */ int16_t *flag_abs_azimuth /* o : Azimuth encoding mode */ ) { + int16_t idx_azimuth, nbits_diff_azimuth, diff, sgn; + int16_t idx_elevation, nbits_diff_elevation; + /*----------------------------------------------------------------* * Azimuth decoding and dequantization *----------------------------------------------------------------*/ - int16_t idx_azimuth, nbits_diff_azimuth, diff, sgn; - int16_t idx_elevation, nbits_diff_elevation; /* Decode azimuth index */ if ( get_next_indice( st0, 1 ) == 1 ) /* azimuth_abs_flag */ @@ -759,28 +773,32 @@ static void decode_angle_indices( { idx_elevation = angle->last_elevation_idx; } + /*----------------------------------------------------------------* * Final updates *----------------------------------------------------------------*/ - /* updates */ angle->last_azimuth_idx = idx_azimuth; angle->last_elevation_idx = idx_elevation; + return; } -int16_t decode_radius( + +/*------------------------------------------------------------------------- + * decode_radius() + * + * Radius decoding and dequantization + *-------------------------------------------------------------------------*/ + +static int16_t decode_radius( DEC_CORE_HANDLE st0, /* i/o: bitstream handle */ int16_t *last_radius_idx, /* i/o: last radius index */ int16_t *flag_abs_radius /* o : Radius encoding mode */ ) { - /*----------------------------------------------------------------* - * Radius decoding and dequantization - *----------------------------------------------------------------*/ int16_t idx_radius, nbits_diff_radius, diff, sgn; - /* Decode radius index */ if ( get_next_indice( st0, 1 ) == 1 ) /* elevation_abs_flag */ { @@ -829,12 +847,9 @@ int16_t decode_radius( idx_radius = *last_radius_idx; } - /*----------------------------------------------------------------* - * Final updates - *----------------------------------------------------------------*/ - - /* updates */ + /* Final updates */ *last_radius_idx = idx_radius; + return idx_radius; } #endif diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index da9c6efae4..3dd712b934 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -890,10 +890,10 @@ ivas_error IVAS_DEC_GetMasaMetadata( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_FeedHeadTrackData( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ #ifdef TD5 IVAS_QUATERNION *orientation, /* i : head-tracking data, listener orientation */ - IVAS_POSITION *Pos /* i : listener position */ + IVAS_POSITION *Pos /* i : listener position */ #else IVAS_QUATERNION *orientation /* i : head-tracking data, listener orientation */ #endif diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 3472de0c5a..c10eda7640 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -70,6 +70,7 @@ * Local functions *-----------------------------------------------------------------------*/ static void encode_angle_indices( BSTR_ENC_HANDLE hBstr, ISM_METADATA_ANGLE_HANDLE angle, const int16_t last_ism_metadata_flag, const int16_t ini_frame, const int16_t idx_azimuth_abs, const int16_t idx_elevation_abs, int16_t *flag_abs_azimuth, int16_t *flag_abs_elevation ); + static void encode_radius( BSTR_ENC_HANDLE hBstr, int16_t *last_radius_idx, int16_t *radius_diff_cnt, const int16_t last_ism_metadata_flag, const int16_t idx_radius_abs, int16_t *flag_abs_radius ); #endif @@ -84,10 +85,10 @@ ivas_error ivas_set_ism_metadata( ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ const float azimuth, /* i : azimuth value */ #ifdef TD5 - const float elevation, /* i : elevation */ - float radius_meta, /* i : radius */ - float yaw, /* i : yaw */ - float pitch /* i : pitch */ + const float elevation, /* i : elevation */ + const float radius_meta, /* i : radius */ + const float yaw, /* i : yaw */ + const float pitch /* i : pitch */ #else const float elevation /* i : elevation value */ #endif @@ -108,6 +109,7 @@ ivas_error ivas_set_ism_metadata( hIsmMeta->yaw = yaw; hIsmMeta->pitch = pitch; #endif + return IVAS_ERR_OK; } @@ -246,7 +248,6 @@ ivas_error ivas_ism_metadata_enc( set_s( flag_abs_radius, 0, num_obj ); #endif - /*----------------------------------------------------------------* * Set Metadata presence / importance flag *----------------------------------------------------------------*/ @@ -352,12 +353,15 @@ ivas_error ivas_ism_metadata_enc( push_indice( hBstr, IND_ISM_NUM_OBJECTS, 1, 1 ); } push_indice( hBstr, IND_ISM_NUM_OBJECTS, 0, 1 ); + #ifdef TD5 + /* write extended metadata presence flag */ if ( ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) { push_indice( hBstr, IND_ISM_EXTENDED_FLAG, ism_extended_metadata_flag, ISM_EXTENDED_METADATA_BITS ); } #endif + /* write ISm metadata flag (one per object) */ for ( ch = 0; ch < nchan_transport; ch++ ) { @@ -406,11 +410,11 @@ ivas_error ivas_ism_metadata_enc( if ( hIsmMeta[ch]->ism_metadata_flag ) { - #ifdef TD5 /*----------------------------------------------------------------* * Obtain quantizer indices for azimuth and elevation *----------------------------------------------------------------*/ + if ( ism_mode == ISM_MODE_DISC ) { idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); @@ -433,6 +437,7 @@ ivas_error ivas_ism_metadata_enc( encode_angle_indices( hBstr, &( hIsmMetaData->angle[1] ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_azimuth_abs, idx_elevation_abs, &flag_abs_azimuth_orientation[ch], &flag_abs_elevation[ch] ); encode_radius( hBstr, &hIsmMetaData->last_radius_idx, &hIsmMetaData->radius_diff_cnt, hIsmMetaData->last_ism_metadata_flag, idx_radius_abs, &flag_abs_radius[ch] ); } + /* save number of metadata bits written */ if ( ism_mode == ISM_MODE_DISC ) { @@ -860,6 +865,7 @@ ivas_error ivas_ism_metadata_enc( return error; } + /*------------------------------------------------------------------------- * ivas_ism_metadata_enc_create() * @@ -926,7 +932,14 @@ ivas_error ivas_ism_metadata_enc_create( return IVAS_ERR_OK; } + #ifdef TD5 +/*------------------------------------------------------------------------- + * encode_radius() + * + * Radius index encoding + *-------------------------------------------------------------------------*/ + static void encode_radius( BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ int16_t *last_radius_idx, /* i/o: last radius index */ @@ -938,14 +951,8 @@ static void encode_radius( { int16_t idx_radius, nbits_diff_radius, diff; - - /*----------------------------------------------------------------* - * Radius index encoding - *----------------------------------------------------------------*/ idx_radius = idx_radius_abs; - nbits_diff_radius = 0; - *flag_abs_radius = 0; /* differential coding by default */ if ( *radius_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ @@ -1023,17 +1030,23 @@ static void encode_radius( push_indice( hBstr, IND_ISM_RADIUS, idx_radius, nbits_diff_radius ); } - /*----------------------------------------------------------------* - * Updates - *----------------------------------------------------------------*/ + /* Updates */ *last_radius_idx = idx_radius_abs; + return; } + +/*----------------------------------------------------------------* + * encode_angle_indices() + * + * Encoding of an angle + *----------------------------------------------------------------*/ + static void encode_angle_indices( BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ ISM_METADATA_ANGLE_HANDLE angle, /* i/o: angle handle */ - const int16_t last_ism_metadata_flag, /* last frame ism_metadata_flag */ + const int16_t last_ism_metadata_flag, /* i : last frame ism_metadata_flag */ const int16_t ini_frame, /* i : initialization frames counter */ const int16_t idx_azimuth_abs, /* i : Azimuth index */ const int16_t idx_elevation_abs, /* i : Elevation index */ @@ -1044,7 +1057,6 @@ static void encode_angle_indices( int16_t idx_azimuth, nbits_diff_azimuth, diff; int16_t idx_elevation, nbits_diff_elevation; - /*----------------------------------------------------------------* * Azimuth index encoding *----------------------------------------------------------------*/ @@ -1145,10 +1157,9 @@ static void encode_angle_indices( /*----------------------------------------------------------------* * Elevation index encoding *----------------------------------------------------------------*/ - idx_elevation = idx_elevation_abs; + idx_elevation = idx_elevation_abs; nbits_diff_elevation = 0; - *flag_abs_elevation = 0; /* differential coding by default */ if ( angle->elevation_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ || last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 896dc0563b..1256955e87 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1013,6 +1013,9 @@ typedef struct encoder_config_structure int16_t sba_order; /* Ambisonic (SBA) order */ int16_t sba_planar; /* Ambisonic (SBA) planar flag */ MC_LS_SETUP mc_input_setup; /* multichannel input ls setup */ +#ifdef TD5 + int16_t ism_extended_metadata_flag; /* flag indicating extended metadata encoding, including radius and orientation (yaw, pitch) in ISM format */ +#endif int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ @@ -1027,10 +1030,6 @@ typedef struct encoder_config_structure int16_t Opt_SC_VBR; /* flag indicating SC-VBR mode */ int16_t last_Opt_SC_VBR; /* flag indicating prev frame's SC-VBR mode */ -#ifdef TD5 - int16_t ism_extended_metadata_flag; /* flag indicating whether extended metadata encoding, including radius and orientation (yaw, pitch) */ -#endif - /* temp. development parameters */ int16_t Opt_PCA_ON; /* flag indicating PCA operation in SBA */ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 3742dbcfdc..a63788356b 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -2013,6 +2013,7 @@ static ivas_error sanitizeBitrateISM( { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 4 ISM specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } + #ifdef TD5 if ( hEncoderConfig->ivas_total_brate < ISM_EXTENDED_METADATA_BRATE && hEncoderConfig->ism_extended_metadata_flag == 1 ) { -- GitLab From 1d70aebbf790c48e57580cb6b0206b4311b64d4b Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Mar 2023 10:42:55 +0100 Subject: [PATCH 264/375] comments/formal issues in ivas_orient_trk.c --- lib_rend/ivas_orient_trk.c | 224 +++++++++++++++++++++---------------- 1 file changed, 130 insertions(+), 94 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 58ae7fd457..750b10ae44 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -60,94 +60,31 @@ *------------------------------------------------------------------------------------------*/ #ifdef FIX_I109_ORIENTATION_TRACKING - /*------------------------------------------------------------------------------------------* - * Declarations + * IdentityQuaternion() + * + * *------------------------------------------------------------------------------------------*/ -static IVAS_QUATERNION IdentityQuaternion( - void ); - -void QuaternionProduct( - const IVAS_QUATERNION q1, - const IVAS_QUATERNION q2, - IVAS_QUATERNION *const result ); - -float QuaternionDotProduct( - const IVAS_QUATERNION q1, - const IVAS_QUATERNION q2 ); - -void QuaternionDivision( - const IVAS_QUATERNION q, - const float d, - IVAS_QUATERNION *const result ); - -void QuaternionNormalize( - const IVAS_QUATERNION q, - IVAS_QUATERNION *const result ); - -void QuaternionSlerp( - const IVAS_QUATERNION q1, - const IVAS_QUATERNION q2, - const float t, - IVAS_QUATERNION *const result ); - -void QuaternionConjugate( - const IVAS_QUATERNION q, - IVAS_QUATERNION *const result ); - -float QuaternionAngle( - const IVAS_QUATERNION q1, - const IVAS_QUATERNION q2 ); - -void QuaternionInverse( - const IVAS_QUATERNION q, - IVAS_QUATERNION *const result ); - -#ifdef OTR_REFERENCE_VECTOR_TRACKING -float QuaternionLength( - const IVAS_QUATERNION q ); - -IVAS_VECTOR3 VectorSubtract( - const IVAS_VECTOR3 p1, - const IVAS_VECTOR3 p2 ); - -IVAS_VECTOR3 VectorCrossProduct( - const IVAS_VECTOR3 p1, - const IVAS_VECTOR3 p2 ); - -float VectorDotProduct( - const IVAS_VECTOR3 p1, - const IVAS_VECTOR3 p2 ); - -float VectorLength( - const IVAS_VECTOR3 p ); - -IVAS_VECTOR3 VectorNormalize( - const IVAS_VECTOR3 p ); - -void VectorRotationToQuaternion( - const IVAS_VECTOR3 p1, - const IVAS_VECTOR3 p2, - IVAS_QUATERNION *const result ); -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ - -/*------------------------------------------------------------------------------------------* - * Quaternion product - *------------------------------------------------------------------------------------------*/ static IVAS_QUATERNION IdentityQuaternion( void ) { IVAS_QUATERNION q; + q.w = 1.0f; q.x = q.y = q.z = 0.0f; + return q; } + /*------------------------------------------------------------------------------------------* + * QuaternionProduct() + * * Quaternion product *------------------------------------------------------------------------------------------*/ -void QuaternionProduct( + +static void QuaternionProduct( const IVAS_QUATERNION q1, const IVAS_QUATERNION q2, IVAS_QUATERNION *const r ) @@ -159,21 +96,30 @@ void QuaternionProduct( tmp.z = q1.w * q2.z + q1.x * q2.y - q1.y * q2.x + q1.z * q2.w; *r = tmp; + + return; } /*------------------------------------------------------------------------------------------* + * QuaternionDotProduct() + * * Quaternion dot product *------------------------------------------------------------------------------------------*/ -float QuaternionDotProduct( + +static float QuaternionDotProduct( const IVAS_QUATERNION q1, const IVAS_QUATERNION q2 ) { return q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w; } + /*------------------------------------------------------------------------------------------* + * QuaternionDivision() + * * Divides a quaternion by a scalar *------------------------------------------------------------------------------------------*/ + void QuaternionDivision( const IVAS_QUATERNION q, const float d, @@ -183,34 +129,49 @@ void QuaternionDivision( r->x = q.x / d; r->y = q.y / d; r->z = q.z / d; + + return; } + /*------------------------------------------------------------------------------------------* + * QuaternionNormalize() + * * Normalizes a quaternion *------------------------------------------------------------------------------------------*/ -void QuaternionNormalize( + +static void QuaternionNormalize( const IVAS_QUATERNION q, IVAS_QUATERNION *const r ) { QuaternionDivision( q, sqrtf( QuaternionDotProduct( q, q ) ), r ); + + return; } + /*------------------------------------------------------------------------------------------* + * QuaternionSlerp() + * * Computes a spherical linear interpolation between two quaternions *------------------------------------------------------------------------------------------*/ -void QuaternionSlerp( + +static void QuaternionSlerp( const IVAS_QUATERNION q1, const IVAS_QUATERNION q2, const float t, IVAS_QUATERNION *const r ) { float angle, denom, s, s2; + s = QuaternionDotProduct( q1, q2 ); + if ( fabsf( s ) >= 1.0f ) { *r = q2; return; } + angle = acosf( s ); denom = sinf( angle ); @@ -222,12 +183,18 @@ void QuaternionSlerp( r->w = ( q1.w * s + q2.w * s2 ) / denom; QuaternionNormalize( *r, r ); + + return; } + /*------------------------------------------------------------------------------------------* + * QuaternionConjugate() + * * Computes a quaternion conjugate *------------------------------------------------------------------------------------------*/ -void QuaternionConjugate( + +static void QuaternionConjugate( const IVAS_QUATERNION q, IVAS_QUATERNION *const r ) { @@ -235,27 +202,39 @@ void QuaternionConjugate( r->x = -q.x; r->y = -q.y; r->z = -q.z; + + return; } + /*------------------------------------------------------------------------------------------* + * QuaternionAngle() + * * Computes an angle between two quaternions *------------------------------------------------------------------------------------------*/ -float QuaternionAngle( + +static float QuaternionAngle( const IVAS_QUATERNION q1, const IVAS_QUATERNION q2 ) { IVAS_QUATERNION q12; float angle; + QuaternionConjugate( q1, &q12 ); QuaternionProduct( q12, q2, &q12 ); angle = 2.0f * atan2f( sqrtf( q12.x * q12.x + q12.y * q12.y + q12.z * q12.z ), q12.w ); + return angle; } + /*------------------------------------------------------------------------------------------* + * QuaternionInverse() + * * Computes an inverse quaternion *------------------------------------------------------------------------------------------*/ -void QuaternionInverse( + +static void QuaternionInverse( const IVAS_QUATERNION q, IVAS_QUATERNION *const r ) { @@ -264,36 +243,39 @@ void QuaternionInverse( dot_product = QuaternionDotProduct( q, q ); QuaternionConjugate( q, r ); QuaternionDivision( *r, dot_product, r ); -} -#ifdef OTR_REFERENCE_VECTOR_TRACKING -/*------------------------------------------------------------------------------------------* - * Computes the length of a quaternion - *------------------------------------------------------------------------------------------*/ -float QuaternionLength( - const IVAS_QUATERNION q ) -{ - return sqrtf( q.w * q.w + q.x * q.x + q.y * q.y + q.z * q.z ); + return; } + +#ifdef OTR_REFERENCE_VECTOR_TRACKING /*------------------------------------------------------------------------------------------* + * VectorSubtract() + * * Computes the difference of two vectors *------------------------------------------------------------------------------------------*/ -IVAS_VECTOR3 VectorSubtract( + +static IVAS_VECTOR3 VectorSubtract( const IVAS_VECTOR3 p1, const IVAS_VECTOR3 p2 ) { IVAS_VECTOR3 result; + result.x = p1.x - p2.x; result.y = p1.y - p2.y; result.z = p1.z - p2.z; + return result; } + /*------------------------------------------------------------------------------------------* + * VectorCrossProduct() + * * Computes the cross product of two vectors *------------------------------------------------------------------------------------------*/ -IVAS_VECTOR3 VectorCrossProduct( + +static IVAS_VECTOR3 VectorCrossProduct( const IVAS_VECTOR3 p1, const IVAS_VECTOR3 p2 ) { @@ -301,46 +283,66 @@ IVAS_VECTOR3 VectorCrossProduct( result.x = p1.y * p2.z - p1.z * p2.y; result.y = p1.z * p2.x - p1.x * p2.z; result.z = p1.x * p2.y - p1.y * p2.x; + return result; } + /*------------------------------------------------------------------------------------------* + * VectorDotProduct( + * * Computes the dot product of two vectors *------------------------------------------------------------------------------------------*/ -float VectorDotProduct( + +static float VectorDotProduct( const IVAS_VECTOR3 p1, const IVAS_VECTOR3 p2 ) { return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z; } + /*------------------------------------------------------------------------------------------* + * VectorLength() + * * Computes the length of a vector *------------------------------------------------------------------------------------------*/ -float VectorLength( + +static float VectorLength( const IVAS_VECTOR3 p ) { return sqrtf( p.x * p.x + p.y * p.y + p.z * p.z ); } + /*------------------------------------------------------------------------------------------* + * VectorNormalize() + * * Normalizes a vector *------------------------------------------------------------------------------------------*/ -IVAS_VECTOR3 VectorNormalize( + +static IVAS_VECTOR3 VectorNormalize( const IVAS_VECTOR3 p ) { IVAS_VECTOR3 result; + const float length = VectorLength( p ); + result.x = p.x / length; result.y = p.y / length; result.z = p.z / length; + return result; } + /*------------------------------------------------------------------------------------------* + * VectorRotationToQuaternion() + * * Computes a quaternion representing the rotation from vector p1 to vector p2 *------------------------------------------------------------------------------------------*/ -void VectorRotationToQuaternion( + +static void VectorRotationToQuaternion( const IVAS_VECTOR3 p1, const IVAS_VECTOR3 p2, IVAS_QUATERNION *const r ) @@ -369,7 +371,10 @@ void VectorRotationToQuaternion( r->z = cross_product.z; r->w = 1.0f + dot_product; } + QuaternionNormalize( *r, r ); + + return; } #endif /* OTR_REFERENCE_VECTOR_TRACKING */ #else @@ -513,6 +518,12 @@ void ivas_orient_trk_SetTrackingType( #endif #ifdef FIX_I109_ORIENTATION_TRACKING +/*-------------------------------------------------------------------* + * ivas_orient_trk_SetReferenceRotation() + * + * + *-------------------------------------------------------------------*/ + ivas_error ivas_orient_trk_SetReferenceRotation( ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ IVAS_QUATERNION refRot ) /* i : reference rotation */ @@ -535,6 +546,13 @@ ivas_error ivas_orient_trk_SetReferenceRotation( return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * ivas_orient_trk_GetMainOrientation() + * + * + *-------------------------------------------------------------------*/ + ivas_error ivas_orient_trk_GetMainOrientation( ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ IVAS_QUATERNION *pOrientation /* i/o : average/reference orientation */ @@ -560,9 +578,17 @@ ivas_error ivas_orient_trk_GetMainOrientation( *pOrientation = pOTR->absAvgRot; break; } + return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * ivas_orient_trk_GetTrackedRotation() + * + * + *-------------------------------------------------------------------*/ + ivas_error ivas_orient_trk_GetTrackedRotation( ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ IVAS_QUATERNION *pRotation /* i/o : processed rotation */ @@ -578,7 +604,14 @@ ivas_error ivas_orient_trk_GetTrackedRotation( return IVAS_ERR_OK; } + #ifdef OTR_REFERENCE_VECTOR_TRACKING +/*-------------------------------------------------------------------* + * ivas_orient_trk_SetReferenceVector() + * + * + *-------------------------------------------------------------------*/ + ivas_error ivas_orient_trk_SetReferenceVector( ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ const IVAS_VECTOR3 listenerPos, /* i : Listener position */ @@ -604,6 +637,7 @@ ivas_error ivas_orient_trk_SetReferenceVector( case OTR_TRACKING_REF_VEC_LEV: { IVAS_VECTOR3 listenerPosLevel, refPosLevel; + /* ignore the height difference between listener position and reference position */ listenerPosLevel.z = refPosLevel.z = listenerPos.z; listenerPosLevel.x = listenerPos.x; @@ -615,6 +649,7 @@ ivas_error ivas_orient_trk_SetReferenceVector( } acousticFrontVectorLength = VectorLength( acousticFrontVector ); + /* if the length is zero, the user has entered insensible listener and reference positions */ if ( acousticFrontVectorLength < 0.0001f ) { @@ -625,6 +660,7 @@ ivas_error ivas_orient_trk_SetReferenceVector( ivasForwardVector.y = 0.0f; ivasForwardVector.z = 0.0f; VectorRotationToQuaternion( ivasForwardVector, acousticFrontVector, &pOTR->refRot ); + return IVAS_ERR_OK; } #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -- GitLab From 51e20eecf83f0a0523b5030cee4b0d25197cc1b9 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Mar 2023 10:58:29 +0100 Subject: [PATCH 265/375] address a ToDo comment --- lib_rend/ivas_orient_trk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 750b10ae44..ec367f3657 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -50,9 +50,7 @@ #define MAX_TRACKED_ANGLE_AVG_ORIENT PI_OVER_2 #define MAX_TRACKED_ANGLE_REF_ORIENT EVS_PI - -/* TODO relate to frame rate - assumed here 50Hz, i.e. 20ms frame length */ -#define OTR_UPDATE_RATE ( 50.0f ) /* rate of the Process() calls [Hz]; 1x per IVAS frame */ +#define OTR_UPDATE_RATE (float) FRAMES_PER_SEC /* rate of the Process() calls [Hz]; 1x per IVAS frame */ /*------------------------------------------------------------------------------------------* -- GitLab From d36437a72c05f65ec03593fde2df49d98fbcf677 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Mar 2023 11:00:41 +0100 Subject: [PATCH 266/375] fix MSVC warning C4701: potentially uninitialized local variable 'acousticFrontVector' used --- lib_rend/ivas_orient_trk.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index ec367f3657..4990063435 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -617,6 +617,7 @@ ivas_error ivas_orient_trk_SetReferenceVector( ) { IVAS_VECTOR3 acousticFrontVector, ivasForwardVector; + IVAS_VECTOR3 listenerPosLevel, refPosLevel; float acousticFrontVectorLength; if ( pOTR == NULL ) @@ -633,9 +634,6 @@ ivas_error ivas_orient_trk_SetReferenceVector( acousticFrontVector = VectorSubtract( listenerPos, refPos ); break; case OTR_TRACKING_REF_VEC_LEV: - { - IVAS_VECTOR3 listenerPosLevel, refPosLevel; - /* ignore the height difference between listener position and reference position */ listenerPosLevel.z = refPosLevel.z = listenerPos.z; listenerPosLevel.x = listenerPos.x; @@ -643,7 +641,9 @@ ivas_error ivas_orient_trk_SetReferenceVector( refPosLevel.x = refPos.x; refPosLevel.y = refPos.y; acousticFrontVector = VectorSubtract( listenerPosLevel, refPosLevel ); - } + break; + default: + return IVAS_ERR_WRONG_PARAMS; } acousticFrontVectorLength = VectorLength( acousticFrontVector ); -- GitLab From 4970f2bec41e664360222a930926f290eb860592 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Mar 2023 11:22:09 +0100 Subject: [PATCH 267/375] add more error codes for orientation tracking --- lib_dec/ivas_init_dec.c | 25 +++++++++--- lib_rend/ivas_orient_trk.c | 34 +++++++++------- lib_rend/ivas_prot_rend.h | 32 +++++++-------- lib_rend/ivas_rotation.c | 7 +++- lib_rend/lib_rend.c | 81 +++++++++++++++++++++++++++++++------- 5 files changed, 127 insertions(+), 52 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index a3a48030a9..db95d1ee4e 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -757,24 +757,39 @@ ivas_error ivas_init_decoder( { if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_NONE ) { - ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_NONE ); + if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_NONE ) ) != IVAS_ERR_OK ) + { + return error; + } } else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_AVG ) { - ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_AVG_ORIENT ); + if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_AVG_ORIENT ) ) != IVAS_ERR_OK ) + { + return error; + } } else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_REF ) { - ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_ORIENT ); + if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_ORIENT ) ) != IVAS_ERR_OK ) + { + return error; + } } #ifdef OTR_REFERENCE_VECTOR_TRACKING else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_REF_VEC ) { - ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_VEC ); + if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_VEC ) ) != IVAS_ERR_OK ) + { + return error; + } } else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_REF_VEC_LEV ) { - ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_VEC_LEV ); + if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_VEC_LEV ) ) != IVAS_ERR_OK ) + { + return error; + } } else { diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 4990063435..4d32f5606c 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -495,8 +495,9 @@ void ivas_orient_trk_Init( #ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_SetTrackingType( - ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - const OTR_TRACKING_T trackingType ) /* i/o : orientation tracking type */ + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + const OTR_TRACKING_T trackingType /* i/o: orientation tracking type */ +) { if ( pOTR == NULL ) { @@ -523,8 +524,9 @@ void ivas_orient_trk_SetTrackingType( *-------------------------------------------------------------------*/ ivas_error ivas_orient_trk_SetReferenceRotation( - ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - IVAS_QUATERNION refRot ) /* i : reference rotation */ + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + const IVAS_QUATERNION refRot /* i : reference rotation */ +) { if ( pOTR == NULL ) { @@ -552,8 +554,8 @@ ivas_error ivas_orient_trk_SetReferenceRotation( *-------------------------------------------------------------------*/ ivas_error ivas_orient_trk_GetMainOrientation( - ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - IVAS_QUATERNION *pOrientation /* i/o : average/reference orientation */ + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + IVAS_QUATERNION *pOrientation /* i/o: average/reference orientation */ ) { if ( pOTR == NULL || pOrientation == NULL ) @@ -588,8 +590,8 @@ ivas_error ivas_orient_trk_GetMainOrientation( *-------------------------------------------------------------------*/ ivas_error ivas_orient_trk_GetTrackedRotation( - ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - IVAS_QUATERNION *pRotation /* i/o : processed rotation */ + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + IVAS_QUATERNION *pRotation /* i/o: processed rotation */ ) { if ( pOTR == NULL || pRotation == NULL ) @@ -611,9 +613,9 @@ ivas_error ivas_orient_trk_GetTrackedRotation( *-------------------------------------------------------------------*/ ivas_error ivas_orient_trk_SetReferenceVector( - ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - const IVAS_VECTOR3 listenerPos, /* i : Listener position */ - const IVAS_VECTOR3 refPos /* i : Reference position */ + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ ) { IVAS_VECTOR3 acousticFrontVector, ivasForwardVector; @@ -693,10 +695,11 @@ void ivas_orient_trk_SetAbsoluteOrientation( #ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_Process( - ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - IVAS_QUATERNION absRot, /* i : absolute head rotation */ - float updateRate, /* i : rotation update rate [Hz] */ - IVAS_QUATERNION *pTrkRot ) /* o : tracked rotation */ + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + IVAS_QUATERNION absRot, /* i : absolute head rotation */ + float updateRate, /* i : rotation update rate [Hz] */ + IVAS_QUATERNION *pTrkRot /* o : tracked rotation */ +) { float normalizedOrientation; float relativeOrientationRate; @@ -779,6 +782,7 @@ ivas_error ivas_orient_trk_Process( { *pTrkRot = pOTR->trkRot; } + return result; } #else diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 2b0e67e5f4..33359eee8c 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -877,7 +877,7 @@ ivas_error ivas_orient_trk_Init( #else void ivas_orient_trk_Init( #endif - ivas_orient_trk_state_t *pOTR /* i/o : orientation tracker handle */ + ivas_orient_trk_state_t *pOTR /* i/o: orientation tracker handle */ ); #ifdef FIX_I109_ORIENTATION_TRACKING @@ -885,41 +885,41 @@ ivas_error ivas_orient_trk_SetTrackingType( #else void ivas_orient_trk_SetTrackingType( #endif - ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - const OTR_TRACKING_T trackingType /* i : orientation tracking type */ + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + const OTR_TRACKING_T trackingType /* i : orientation tracking type */ ); #ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_SetReferenceRotation( - ivas_orient_trk_state_t *pOTR, /* i/o : orientatoin trakcer handle */ - IVAS_QUATERNION refRot /* i : reference rotation */ + ivas_orient_trk_state_t *pOTR, /* i/o: orientatoin trakcer handle */ + const IVAS_QUATERNION refRot /* i : reference rotation */ ); #ifdef OTR_REFERENCE_VECTOR_TRACKING ivas_error ivas_orient_trk_SetReferenceVector( - ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - const IVAS_VECTOR3 listenerPos, /* i : Listener position */ - const IVAS_VECTOR3 refPos /* i : Reference position */ + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ ); #endif /* OTR_REFERENCE_VECTOR_TRACKING */ ivas_error ivas_orient_trk_GetMainOrientation( - ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - IVAS_QUATERNION *pOrientation /* i/o : average/reference orientation */ + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + IVAS_QUATERNION *pOrientation /* i/o: average/reference orientation */ ); ivas_error ivas_orient_trk_GetTrackedRotation( - ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - IVAS_QUATERNION *pRotation /* i/o : processed rotation */ + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + IVAS_QUATERNION *pRotation /* i/o: processed rotation */ ); #endif #ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_Process( - ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - IVAS_QUATERNION absRot, /* i : absolute head rotation */ - float updateRate, /* i : rotation update rate [Hz] */ - IVAS_QUATERNION *pTrkRot /* o : tracked rotation */ + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + IVAS_QUATERNION absRot, /* i : absolute head rotation */ + float updateRate, /* i : rotation update rate [Hz] */ + IVAS_QUATERNION *pTrkRot /* o : tracked rotation */ ); #else diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 0c991c79e7..3a1d28f6cc 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -55,6 +55,7 @@ ivas_error ivas_headTrack_open( ) { int16_t i; + ivas_error error; /* Allocate Head-Tracking handle */ if ( ( *hHeadTrackData = (HEAD_TRACK_DATA_HANDLE) malloc( sizeof( HEAD_TRACK_DATA ) ) ) == NULL ) @@ -72,7 +73,11 @@ ivas_error ivas_headTrack_open( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); } - ivas_orient_trk_Init( ( *hHeadTrackData )->OrientationTracker ); + + if ( ( error = ivas_orient_trk_Init( ( *hHeadTrackData )->OrientationTracker ) ) != IVAS_ERR_OK ) + { + return error; + } #endif /* Initialise Rmat_prev to I, Rmat will be computed later */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index a69393e10e..8059c53346 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -910,6 +910,7 @@ static void initHeadRotation( { int16_t i, crossfade_len; float tmp; + ivas_error error; /* Head rotation is enabled by default */ hIvasRend->headRotData.headRotEnabled = 1; @@ -933,7 +934,11 @@ static void initHeadRotation( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); } - ivas_orient_trk_Init( hIvasRend->headRotData.hOrientationTracker ); + + if ( ( error = ivas_orient_trk_Init( hIvasRend->headRotData.hOrientationTracker ) ) != IVAS_ERR_OK ) + { + return error; + } return IVAS_ERR_OK; #else @@ -3953,13 +3958,21 @@ ivas_error IVAS_REND_SetHeadRotation( return IVAS_ERR_OK; } + #ifdef FIX_I109_ORIENTATION_TRACKING +/*-------------------------------------------------------------------* + * IVAS_REND_SetOrientationTrackingMode() + * + * + *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_SetOrientationTrackingMode( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const uint8_t otrMode /* i : Orientation tracking mode */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const uint8_t otrMode /* i : Orientation tracking mode */ ) { OTR_TRACKING_T mode; + ivas_error error; if ( hIvasRend == NULL ) { @@ -3988,59 +4001,97 @@ ivas_error IVAS_REND_SetOrientationTrackingMode( break; } - ivas_orient_trk_SetTrackingType( hIvasRend->headRotData.hOrientationTracker, mode ); + if ( ( error = ivas_orient_trk_SetTrackingType( hIvasRend->headRotData.hOrientationTracker, mode ) ) != IVAS_ERR_OK ) + { + return error; + } return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_SetReferenceRotation() + * + * + *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_SetReferenceRotation( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_QUATERNION refRot /* i : Reference rotation */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_QUATERNION refRot /* i : Reference rotation */ ) { - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ + ivas_error error; + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - ivas_orient_trk_SetReferenceRotation( hIvasRend->headRotData.hOrientationTracker, refRot ); + + if ( ( error = ivas_orient_trk_SetReferenceRotation( hIvasRend->headRotData.hOrientationTracker, refRot ) ) != IVAS_ERR_OK ) + { + return error; + } return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_GetMainOrientation() + * + * + *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_GetMainOrientation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ IVAS_QUATERNION *pOrientation /* i/o: Quaternion pointer for main orientation */ ) { + ivas_error error; + if ( hIvasRend == NULL || pOrientation == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - ivas_orient_trk_GetMainOrientation( hIvasRend->headRotData.hOrientationTracker, pOrientation ); + if ( ( error = ivas_orient_trk_GetMainOrientation( hIvasRend->headRotData.hOrientationTracker, pOrientation ) ) != IVAS_ERR_OK ) + { + return error; + } return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_GetTrackedRotation() + * + * + *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_GetTrackedRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ IVAS_QUATERNION *pRotation /* i/o: Quaternion pointer processed rotation */ ) { + ivas_error error; + if ( hIvasRend == NULL || pRotation == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - ivas_orient_trk_GetTrackedRotation( hIvasRend->headRotData.hOrientationTracker, pRotation ); + if ( ( error = ivas_orient_trk_GetTrackedRotation( hIvasRend->headRotData.hOrientationTracker, pRotation ) ) != IVAS_ERR_OK ) + { + return error; + } return IVAS_ERR_OK; } + #ifdef OTR_REFERENCE_VECTOR_TRACKING /*---------------------------------------------------------------------* * IVAS_REND_SetReferenceVector( ) @@ -4050,9 +4101,9 @@ ivas_error IVAS_REND_GetTrackedRotation( *---------------------------------------------------------------------*/ ivas_error IVAS_REND_SetReferenceVector( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_VECTOR3 listenerPos, /* i : Listener position */ - const IVAS_VECTOR3 refPos /* i : Reference position */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ ) { if ( hIvasRend == NULL || hIvasRend->headRotData.hOrientationTracker == NULL ) -- GitLab From c6c0d900c05d1c7ce15b1d9c19a2d72cf242e70e Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Mar 2023 11:41:35 +0100 Subject: [PATCH 268/375] fix test warnings --- lib_rend/ivas_orient_trk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 4d32f5606c..af71cbf543 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -118,7 +118,7 @@ static float QuaternionDotProduct( * Divides a quaternion by a scalar *------------------------------------------------------------------------------------------*/ -void QuaternionDivision( +static void QuaternionDivision( const IVAS_QUATERNION q, const float d, IVAS_QUATERNION *const r ) @@ -134,7 +134,7 @@ void QuaternionDivision( /*------------------------------------------------------------------------------------------* * QuaternionNormalize() - * + * * Normalizes a quaternion *------------------------------------------------------------------------------------------*/ -- GitLab From 41fa578372d92b704ebc5656743d8a1f0da9177f Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Mar 2023 12:11:04 +0100 Subject: [PATCH 269/375] updates within FIX_371_DELAY_REPORT --- apps/decoder.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/decoder.c b/apps/decoder.c index aee3759a21..52fae6ca4e 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1187,6 +1187,7 @@ static ivas_error initOnFirstGoodFrame( fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); return error; } + if ( !arg.delayCompensationEnabled ) { #ifdef BINAURALIZATION_DELAY_REPORT @@ -1644,7 +1645,11 @@ static ivas_error decodeG192( if ( delayNumSamples_orig[2] > 0 ) { printf( "HRIR/BRIR delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[2] / (float) delayTimeScale, delayNumSamples_orig[2], delayTimeScale ); +#ifdef FIX_371_DELAY_REPORT + printf( "Total delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * ( delayNumSamples_orig[1] + delayNumSamples_orig[2] ) / (float) delayTimeScale, delayNumSamples_orig[1] + delayNumSamples_orig[2], delayTimeScale ); +#else printf( "Total delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[0] / (float) delayTimeScale, delayNumSamples_orig[0], delayTimeScale ); +#endif } #else fprintf( stdout, "\nDecoder delay: %-5u [samples] - Timescale: %5u\n", delayNumSamples_orig, delayTimeScale ); @@ -2145,7 +2150,11 @@ static ivas_error decodeVoIP( if ( delayNumSamples_orig[2] > 0 ) { printf( "HRIR/BRIR delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[2] / (float) delayTimeScale, delayNumSamples_orig[2], delayTimeScale ); +#ifdef FIX_371_DELAY_REPORT + printf( "Total delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * ( delayNumSamples_orig[1] + delayNumSamples_orig[2] ) / (float) delayTimeScale, delayNumSamples_orig[1] + delayNumSamples_orig[2], delayTimeScale ); +#else printf( "Total delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[0] / (float) delayTimeScale, delayNumSamples_orig[0], delayTimeScale ); +#endif } #else printf( "\nDecoder delay: %5u [samples] - Timescale: %5u\n", delayNumSamples_orig, delayTimeScale ); -- GitLab From 6854d8d5493701ac4727eccadbf9248b34f9741b Mon Sep 17 00:00:00 2001 From: malenov Date: Mon, 20 Mar 2023 12:20:22 +0100 Subject: [PATCH 270/375] do not count DROM of ivas_rom_TdBinauralRenderer.c --- lib_rend/ivas_rom_TdBinauralRenderer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib_rend/ivas_rom_TdBinauralRenderer.c b/lib_rend/ivas_rom_TdBinauralRenderer.c index 70daa6dff9..4b56fb4883 100644 --- a/lib_rend/ivas_rom_TdBinauralRenderer.c +++ b/lib_rend/ivas_rom_TdBinauralRenderer.c @@ -41,6 +41,7 @@ #include "ivas_cnst.h" #include "wmc_auto.h" +#define WMC_TOOL_SKIP /*------------------------------------------------------------------------- * TD Binaural rendering related ROM tables @@ -12456,4 +12457,6 @@ const uint32_t orange53_rom_ITD_elevBsShape[28] = { 0x3ebda12f,0x3f12f685,0x3f2aaaab, }; +#undef WMC_TOOL_SKIP + /* clang-format on */ -- GitLab From 319b2a0d7c3fea7b472103534066b7991c3ead84 Mon Sep 17 00:00:00 2001 From: malenov Date: Mon, 20 Mar 2023 12:43:18 +0100 Subject: [PATCH 271/375] do not count data ROM of ivas_rom_binauralRenderer.c --- lib_rend/ivas_rom_binauralRenderer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_rend/ivas_rom_binauralRenderer.c b/lib_rend/ivas_rom_binauralRenderer.c index 763777ad28..9708bac83a 100644 --- a/lib_rend/ivas_rom_binauralRenderer.c +++ b/lib_rend/ivas_rom_binauralRenderer.c @@ -41,6 +41,8 @@ /* clang-format off */ +#define WMC_TOOL_SKIP + /*------------------------------------------------------------------------- * Binaural rendering related ROM tables *------------------------------------------------------------------------*/ @@ -44077,4 +44079,6 @@ const float parametricEarlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX] = 0.016350f, 0.042709f, 0.077337f, 0.066238f, 0.042046f, 0.020017f, 0.007896f, 0.002947f, 0.000932f, 0.000152f }; +#undef WMC_TOOL_SKIP + /* clang-format on */ -- GitLab From cd731c72aa49fe562c4a5ab971e7c11969055b95 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Mar 2023 16:47:39 +0100 Subject: [PATCH 272/375] more editorial changes within MD5 --- lib_com/ivas_ism_config.c | 2 ++ lib_com/ivas_rom_com.h | 5 ++--- lib_com/ivas_stat_com.h | 4 ++++ lib_dec/ivas_ism_dec.c | 1 - lib_dec/ivas_ism_metadata_dec.c | 1 + lib_dec/lib_dec.h | 2 +- lib_enc/ivas_ism_enc.c | 1 - lib_enc/ivas_ism_metadata_enc.c | 11 ++++++++--- lib_enc/lib_enc.c | 3 +++ lib_rend/ivas_stat_rend.h | 1 + lib_util/ism_file_reader.c | 4 ++-- 11 files changed, 24 insertions(+), 11 deletions(-) diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index d6b0999f7e..efacf7cca4 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -340,6 +340,7 @@ void ivas_ism_reset_metadata( hIsmMeta->pitch = 0.0f; hIsmMeta->radius = 1.0f; #endif + return; } @@ -348,6 +349,7 @@ void ivas_ism_reset_metadata( * * Reset ISm metadata parameters *-------------------------------------------------------------------*/ + void ivas_ism_reset_metadata_API( ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle */ ) diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index f6a9cb6ef1..a095c9e4b4 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -317,9 +317,8 @@ extern const float McMASA_LFEGain_vectors[64]; extern const float ism_azimuth_borders[4]; extern const float ism_elevation_borders[4]; -#ifdef TD5 -extern const float ism_radius_borders[4]; -#endif // TD5 + + /*----------------------------------------------------------------------------------* * Param ISM ROM tables *----------------------------------------------------------------------------------*/ diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 244ba7ff76..5a45575b0a 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -43,6 +43,7 @@ /*----------------------------------------------------------------------------------* * Declaration of ISm common (encoder & decoder) structure *----------------------------------------------------------------------------------*/ + #ifdef TD5 typedef struct { @@ -50,8 +51,10 @@ typedef struct int16_t azimuth_diff_cnt; /* FEC counter of consecutive differentially azimuth coded frames */ int16_t last_elevation_idx; /* last frame index of coded elevation */ int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */ + } ISM_METADATA_ANGLE, *ISM_METADATA_ANGLE_HANDLE; #endif + /* ISM metadata handle (storage for one frame of read ISM metadata) */ typedef struct { @@ -73,6 +76,7 @@ typedef struct int16_t last_elevation_idx; /* last frame index of coded elevation */ int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */ #endif + } ISM_METADATA_FRAME, *ISM_METADATA_HANDLE; diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 5fd1c879f1..cae696e938 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -240,7 +240,6 @@ static ivas_error ivas_ism_bitrate_switching( * - reconfigure the ISM format decoder *-------------------------------------------------------------------------*/ -/*! r : ISM format mode */ ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t num_obj /* i : number of objects in the bitstream */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 4b604c3b8c..372fa15248 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -265,6 +265,7 @@ ivas_error ivas_ism_metadata_dec( hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); + /* radius/raw/pitch dequantization */ if ( ism_extended_metadata_flag ) { decode_angle_indices( st0, &( hIsmMetaData->angle[1] ), &flag_abs_orientation ); diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index e115ecd198..0e7d8042d8 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -215,7 +215,7 @@ ivas_error IVAS_DEC_VoIP_FeedFrame( /*! r: error code */ ivas_error IVAS_DEC_VoIP_GetSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ + uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ const uint32_t systemTimestamp_ms /* i : current system timestamp */ #ifdef SUPPORT_JBM_TRACEFILE diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 42f877aa17..51295cba6e 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -331,7 +331,6 @@ ivas_error ivas_ism_enc( * - reconfigure the ISM format encoder *-------------------------------------------------------------------------*/ -/*! r : ISM format mode */ ivas_error ivas_ism_enc_config( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ) diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index c10eda7640..33ba03a907 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -65,10 +65,12 @@ #define INTER_OBJECT_PARAM_CHECK ( ( ISM_FEC_MAX / 2 ) - 2 ) /* note: constant must be less than (ISM_FEC_MAX / number of coded parameters) */ + #ifdef TD5 /*-----------------------------------------------------------------------* - * Local functions + * Local function declarations *-----------------------------------------------------------------------*/ + static void encode_angle_indices( BSTR_ENC_HANDLE hBstr, ISM_METADATA_ANGLE_HANDLE angle, const int16_t last_ism_metadata_flag, const int16_t ini_frame, const int16_t idx_azimuth_abs, const int16_t idx_elevation_abs, int16_t *flag_abs_azimuth, int16_t *flag_abs_elevation ); static void encode_radius( BSTR_ENC_HANDLE hBstr, int16_t *last_radius_idx, int16_t *radius_diff_cnt, const int16_t last_ism_metadata_flag, const int16_t idx_radius_abs, int16_t *flag_abs_radius ); @@ -412,7 +414,7 @@ ivas_error ivas_ism_metadata_enc( { #ifdef TD5 /*----------------------------------------------------------------* - * Obtain quantizer indices for azimuth and elevation + * Quantize and encode azimuth and elevation *----------------------------------------------------------------*/ if ( ism_mode == ISM_MODE_DISC ) @@ -428,7 +430,10 @@ ivas_error ivas_ism_metadata_enc( encode_angle_indices( hBstr, &( hIsmMetaData->angle[0] ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_azimuth_abs, idx_elevation_abs, &flag_abs_azimuth[ch], &flag_abs_elevation[ch] ); - /* Encode orientation and radius, if above certain bit rate etc, discrete ISM */ + /*----------------------------------------------------------------* + * Quantize and encode radius, yaw, and pitch + *----------------------------------------------------------------*/ + if ( ism_mode == ISM_MODE_DISC && ism_extended_metadata_flag ) { idx_azimuth_abs = ism_quant_meta( hIsmMetaData->yaw, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index a63788356b..a2ea72e9a6 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -2278,6 +2278,9 @@ static void init_encoder_config( hEncoderConfig->stereo_dmx_evs = 0; hEncoderConfig->sba_order = 0; hEncoderConfig->sba_planar = 0; +#ifdef TD5 + hEncoderConfig->ism_extended_metadata_flag = 0; +#endif #ifdef DEBUGGING hEncoderConfig->stereo_mode_cmdl = 0; hEncoderConfig->force = -1; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 9dafb5fb65..96deb7dc37 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -336,6 +336,7 @@ typedef struct ivas_render_config_t #ifdef TD5 float directivity[3]; #endif + } RENDER_CONFIG_DATA, *RENDER_CONFIG_HANDLE; typedef struct ivas_rev_delay_line_t diff --git a/lib_util/ism_file_reader.c b/lib_util/ism_file_reader.c index b6166af95b..d25686fd1d 100644 --- a/lib_util/ism_file_reader.c +++ b/lib_util/ism_file_reader.c @@ -95,13 +95,13 @@ IsmFileReader *IsmFileReader_open( /*! r: error code */ ivas_error IsmFileReader_readNextFrame( IsmFileReader *self, /* i/o: IsmFileReader handle */ - IVAS_ISM_METADATA *ismMetadata /* o ISM : metadata read from the opened file */ + IVAS_ISM_METADATA *ismMetadata /* o : ISM metadata read from the opened file */ ) { char char_buff[META_LINE_LENGTH]; float meta_prm[NUM_ISM_METADATA_PER_LINE]; #ifdef TD5 - float meta_prm_default[NUM_ISM_METADATA_PER_LINE] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f }; + const float meta_prm_default[NUM_ISM_METADATA_PER_LINE] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f }; #endif char *char_ptr; int16_t i; -- GitLab From 83c367f3434f4e018e3ceb350bc2f954d8fd965c Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Mar 2023 18:37:23 +0100 Subject: [PATCH 273/375] revision of *_close() functions --- lib_com/ivas_fb_mixer.c | 14 ++- lib_com/ivas_mc_param_com.c | 1 - lib_com/ivas_prot.h | 47 +++++----- lib_com/prot.h | 14 ++- lib_dec/fd_cng_dec.c | 9 +- lib_dec/ivas_agc_dec.c | 24 ++--- lib_dec/ivas_dirac_dec.c | 20 +++-- lib_dec/ivas_dirac_output_synthesis_cov.c | 1 - lib_dec/ivas_init_dec.c | 70 +++++---------- lib_dec/ivas_ism_dec.c | 6 +- lib_dec/ivas_ism_param_dec.c | 15 +++- lib_dec/ivas_lfe_dec.c | 20 +++-- lib_dec/ivas_masa_dec.c | 15 +++- lib_dec/ivas_mc_param_dec.c | 4 +- lib_dec/ivas_mcmasa_dec.c | 5 +- lib_dec/ivas_mct_dec.c | 51 ++--------- lib_dec/ivas_sba_dec.c | 25 ++---- lib_dec/ivas_spar_decoder.c | 50 +++++------ lib_dec/ivas_spar_md_dec.c | 8 +- lib_dec/ivas_stat_dec.h | 1 + lib_dec/ivas_tcx_core_dec.c | 27 +++--- lib_enc/init_enc.c | 5 +- lib_enc/ivas_agc_enc.c | 24 ++--- lib_enc/ivas_corecoder_enc_reconfig.c | 3 +- lib_enc/ivas_dirac_enc.c | 17 +++- lib_enc/ivas_enc_cov_handler.c | 16 ++-- lib_enc/ivas_init_enc.c | 60 +++---------- lib_enc/ivas_ism_enc.c | 3 +- lib_enc/ivas_ism_param_enc.c | 29 +++--- lib_enc/ivas_lfe_enc.c | 22 +++-- lib_enc/ivas_masa_enc.c | 18 ++-- lib_enc/ivas_mc_param_enc.c | 22 +++-- lib_enc/ivas_mcmasa_enc.c | 64 ++++++++------ lib_enc/ivas_mct_enc.c | 93 +++++++------------- lib_enc/ivas_sba_enc.c | 6 +- lib_enc/ivas_spar_encoder.c | 87 +++++++++--------- lib_enc/ivas_spar_md_enc.c | 14 +-- lib_enc/ivas_stereo_dmx_evs.c | 16 ++-- lib_rend/ivas_crend.c | 16 ++-- lib_rend/ivas_dirac_dec_binaural_functions.c | 2 +- lib_rend/ivas_hrtf.c | 1 - lib_rend/ivas_rotation.c | 22 +++-- lib_rend/lib_rend.c | 43 +++------ 43 files changed, 460 insertions(+), 550 deletions(-) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 4543955cee..2bf849b410 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -174,9 +174,8 @@ ivas_error ivas_fb_set_cfg( ivas_error ivas_FB_mixer_open( IVAS_FB_MIXER_HANDLE *hFbMixer_out, /* i/o: FB mixer handle */ const int32_t sampling_rate, /* i : sampling rate */ - IVAS_FB_CFG *fb_cfg /* i : FB config. handle */ - , - const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ + IVAS_FB_CFG *fb_cfg, /* i : FB config. handle */ + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ) { IVAS_FB_MIXER_HANDLE hFbMixer; @@ -361,9 +360,8 @@ ivas_error ivas_FB_mixer_open( void ivas_FB_mixer_close( IVAS_FB_MIXER_HANDLE *hFbMixer_in, /* i/o: FB mixer handle */ - const int32_t sampling_rate /* i : sampling rate in Hz */ - , - const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ + const int32_t sampling_rate, /* i : sampling rate in Hz */ + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ) { IVAS_FB_MIXER_HANDLE hFbMixer; @@ -833,8 +831,8 @@ static int16_t ivas_calculate_abs_fr( float short_stride_nrg = 0.0f; float cldfb_nrg = 0.0f; int16_t short_stride = pFb->fb_bin_to_band.short_stride; - const int16_t num_bins_per_short_stride_bin = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); - const int16_t num_bins_per_cldfb_band = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); + const int16_t num_bins_per_short_stride_bin = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); + const int16_t num_bins_per_cldfb_band = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); float short_stride_max_per_spar_band = 1e-9f; /*loop over all stored Filter Bank Response MDFT coefficients*/ diff --git a/lib_com/ivas_mc_param_com.c b/lib_com/ivas_mc_param_com.c index c6cfe0ed8f..acf7a8eae2 100644 --- a/lib_com/ivas_mc_param_com.c +++ b/lib_com/ivas_mc_param_com.c @@ -141,7 +141,6 @@ void ivas_param_mc_metadata_open( ivas_param_mc_default_icc_map( hMetadataPMC->icc_mapping_conf, hMetadataPMC->icc_mapping[i] ); } - /* init remaining flags and indices */ hMetadataPMC->param_frame_idx = 0; hMetadataPMC->flag_use_adaptive_icc_map = 0; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 194559ee79..4d5b3adc7d 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -124,7 +124,7 @@ void destroy_cpe_enc( ); void ivas_mct_enc_close( - MCT_ENC_HANDLE hMCT /* i/o: MCT encoder structure */ + MCT_ENC_HANDLE *hMCT /* i/o: MCT encoder structure */ ); ivas_error ivas_corecoder_enc_reconfig( @@ -289,7 +289,7 @@ ivas_error stereo_dmx_evs_init_encoder( ); void stereo_dmx_evs_close_encoder( - STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS /* i/o: Stereo downmix for EVS encoder handle */ + STEREO_DMX_EVS_ENC_HANDLE *hStereoDmxEVS /* i/o: Stereo downmix for EVS encoder handle */ ); ivas_error ivas_dec( @@ -499,8 +499,7 @@ void stereo_tcx_core_dec( const int16_t last_element_mode, /* i : last element mode */ const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ - const int16_t nchan_out /* i : number of output channels */ - , + const int16_t nchan_out, /* i : number of output channels */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM) */ ); @@ -860,7 +859,7 @@ void ivas_param_ism_enc( ); void ivas_param_ism_enc_close( - DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ + DIRAC_ENC_HANDLE *hDirAC, /* i/o: encoder DirAC handle */ const int32_t input_Fs /* i : input sampling_rate */ ); @@ -888,7 +887,7 @@ ivas_error ivas_param_ism_dec_open( ); void ivas_param_ism_dec_close( - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ + DIRAC_DEC_HANDLE *hDirAC, /* i/o: decoder DirAC handle */ const AUDIO_CONFIG output_config /* i : output audio configuration */ ); @@ -3244,7 +3243,7 @@ ivas_error ivas_dirac_enc_reconfigure( ); void ivas_dirac_enc_close( - DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ + DIRAC_ENC_HANDLE *hDirAC, /* i/o: encoder DirAC handle */ const int32_t input_Fs /* i : input sampling_rate */ ); @@ -3296,7 +3295,7 @@ ivas_error ivas_dirac_dec_config( ); void ivas_dirac_dec_close( - DIRAC_DEC_HANDLE hDirAC /* i/o: decoder DirAC handle */ + DIRAC_DEC_HANDLE *hDirAC /* i/o: decoder DirAC handle */ ); void ivas_dirac_dec_read_BS( @@ -3524,7 +3523,7 @@ ivas_error ivas_param_mc_enc_reconfig( ); void ivas_param_mc_enc_close( - PARAM_MC_ENC_HANDLE hParamMC, /* i/o: Parametric MC encoder handle */ + PARAM_MC_ENC_HANDLE *hParamMC, /* i/o: Parametric MC encoder handle */ const int32_t input_Fs /* i : input sampling rate */ ); @@ -3758,10 +3757,10 @@ ivas_error ivas_spar_enc_open( ); void ivas_spar_enc_close( - SPAR_ENC_HANDLE hSpar, /* i/o: SPAR encoder handle */ + SPAR_ENC_HANDLE *hSpar, /* i/o: SPAR encoder handle */ const int32_t input_Fs, /* i : input sampling rate */ - const int16_t nchan_inp /* i : number of input channels */ - ,const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ + const int16_t nchan_inp, /* i : number of input channels */ + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); ivas_error ivas_spar_enc( @@ -3773,15 +3772,13 @@ ivas_error ivas_spar_enc( ); ivas_error ivas_spar_dec_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ - , + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); void ivas_spar_dec_close( - SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ - const int32_t output_Fs /* i : output sampling rate */ - , + SPAR_DEC_HANDLE *hSpar, /* i/o: SPAR decoder handle */ + const int32_t output_Fs, /* i : output sampling rate */ const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); @@ -4429,7 +4426,7 @@ ivas_error ivas_masa_dec_open( ); void ivas_masa_dec_close( - MASA_DECODER_HANDLE hMasa /* i/o: MASA metadata structure */ + MASA_DECODER_HANDLE *hMasa /* i/o: MASA metadata structure */ ); ivas_error ivas_masa_decode( @@ -4447,7 +4444,7 @@ ivas_error ivas_masa_enc_open( ); void ivas_masa_enc_close( - MASA_ENCODER_HANDLE hMasa /* i/o: MASA metadata structure */ + MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure */ #ifndef FIX_350_MASA_DELAY_COMP , const int16_t nchan_transport, /* i : Number of transport channels */ @@ -4735,7 +4732,7 @@ ivas_error ivas_mcmasa_enc_open( ); void ivas_mcmasa_enc_close( - MCMASA_ENC_HANDLE hMcMasa, /* i/o: encoder McMASA handle */ + MCMASA_ENC_HANDLE *hMcMasa, /* i/o: encoder McMASA handle */ const int32_t input_Fs /* i : input sampling rate */ ); @@ -4858,7 +4855,7 @@ ivas_error ivas_create_lfe_enc( ); void ivas_lfe_enc_close( - LFE_ENC_HANDLE hLFE /* i/o: LFE encoder handle */ + LFE_ENC_HANDLE *hLFE /* i/o: LFE encoder handle */ ); void ivas_lfe_enc( @@ -4875,7 +4872,7 @@ ivas_error ivas_create_lfe_dec( ); void ivas_lfe_dec_close( - LFE_DEC_HANDLE hLFE /* i/o: LFE encoder handle */ + LFE_DEC_HANDLE *hLFE /* i/o: LFE encoder handle */ ); void ivas_lfe_dec( @@ -4950,15 +4947,13 @@ ivas_error ivas_fb_set_cfg( ivas_error ivas_FB_mixer_open( IVAS_FB_MIXER_HANDLE *hFbMixer, /* i/o: FB mixer handle */ const int32_t sampling_rate, /* i : sampling rate */ - IVAS_FB_CFG *fb_cfg /* i : FB config. handle */ - , + IVAS_FB_CFG *fb_cfg, /* i : FB config. handle */ const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); void ivas_FB_mixer_close( IVAS_FB_MIXER_HANDLE *hFbMixer, /* i/o: FB mixer handle */ - const int32_t sampling_rate /* i : sampling rate in Hz */ - , + const int32_t sampling_rate, /* i : sampling rate in Hz */ const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); diff --git a/lib_com/prot.h b/lib_com/prot.h index 69cc4e0d32..4c20c392d4 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -2228,9 +2228,8 @@ ivas_error init_encoder( const int16_t idchan, /* i : channel ID */ const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ const int16_t interval_SID, /* i : interval for SID update */ - const int16_t vad_only_flag /* i : flag to indicate front-VAD structure */ - , - const ISM_MODE ism_mode /* i : ISM mode */ + const int16_t vad_only_flag, /* i : flag to indicate front-VAD structure */ + const ISM_MODE ism_mode /* i : ISM mode */ ); void LPDmem_enc_init( @@ -8519,11 +8518,10 @@ void generate_comfort_noise_dec( ); void generate_comfort_noise_dec_hf( - float **bufferReal, /* o : Real part of input bands */ - float **bufferImag, /* o : Imaginary part of input bands */ - HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ - , - const int16_t cng_flag /*i : CNG Flag */ + float **bufferReal, /* o : Real part of input bands */ + float **bufferImag, /* o : Imaginary part of input bands */ + HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ + const int16_t cng_flag /*i : CNG Flag */ ); void generate_masking_noise( diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 0620b09d5f..1d4b2ccf90 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -1328,11 +1328,10 @@ void generate_comfort_noise_dec( *-------------------------------------------------------------------*/ void generate_comfort_noise_dec_hf( - float **bufferReal, /* o : Real part of input bands */ - float **bufferImag, /* o : Imaginary part of input bands */ - HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ - , - const int16_t cng_coh_flag /* i : CNG Flag for coherence handling */ + float **bufferReal, /* o : Real part of input bands */ + float **bufferImag, /* o : Imaginary part of input bands */ + HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ + const int16_t cng_coh_flag /* i : CNG Flag for coherence handling */ ) { int16_t i, j; diff --git a/lib_dec/ivas_agc_dec.c b/lib_dec/ivas_agc_dec.c index 1397ce1111..c874b297be 100644 --- a/lib_dec/ivas_agc_dec.c +++ b/lib_dec/ivas_agc_dec.c @@ -142,22 +142,24 @@ void ivas_spar_agc_dec_close( { ivas_agc_dec_state_t *hAgc; + if ( hAgcDec != NULL || *hAgcDec != NULL ) + { + return; + } + hAgc = *hAgcDec; - if ( hAgc != NULL ) - { - free( hAgc->agc_com.winFunc ); - hAgc->agc_com.winFunc = NULL; + free( hAgc->agc_com.winFunc ); + hAgc->agc_com.winFunc = NULL; - free( hAgc->gain_state ); - hAgc->gain_state = NULL; + free( hAgc->gain_state ); + hAgc->gain_state = NULL; - free( hAgc->gain_data ); - hAgc->gain_data = NULL; + free( hAgc->gain_data ); + hAgc->gain_data = NULL; - free( hAgc ); - *hAgcDec = NULL; - } + free( hAgc ); + *hAgcDec = NULL; return; } diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 1f8de9cb38..4d3d1adb3c 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -593,10 +593,11 @@ ivas_error ivas_dirac_dec_config( if ( hDirAC->panningConf == DIRAC_PANNING_VBAP ) { - if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata ) + if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata != NULL ) { vbap_free_data( &( st_ivas->hVBAPdata ) ); } + if ( ( error = vbap_init_data( &( st_ivas->hVBAPdata ), ls_azimuth, ls_elevation, nchan_out_woLFE ) ) != IVAS_ERR_OK ) { return error; @@ -604,13 +605,13 @@ ivas_error ivas_dirac_dec_config( } else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) { - if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata ) + if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata != NULL ) { vbap_free_data( &( st_ivas->hVBAPdata ) ); } hDirAC->hoa_decoder = NULL; } - else if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata ) + else if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata != NULL ) { vbap_free_data( &( st_ivas->hVBAPdata ) ); } @@ -1002,10 +1003,18 @@ ivas_error ivas_dirac_dec_config( *------------------------------------------------------------------------*/ void ivas_dirac_dec_close( - DIRAC_DEC_HANDLE hDirAC /* i/o: decoder DirAC handle */ + DIRAC_DEC_HANDLE *hDirAC_out /* i/o: decoder DirAC handle */ ) { int16_t i, j; + DIRAC_DEC_HANDLE hDirAC; + + if ( hDirAC_out == NULL || *hDirAC_out == NULL ) + { + return; + } + + hDirAC = *hDirAC_out; /* Config & CLDFB */ if ( hDirAC->hConfig != NULL ) @@ -1225,7 +1234,8 @@ void ivas_dirac_dec_close( ivas_dirac_free_mem( &( hDirAC->stack_mem ) ); - free( hDirAC ); + free( *hDirAC_out ); + *hDirAC_out = NULL; return; } diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index 6a79d4563a..a2fc9ee821 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -190,7 +190,6 @@ void ivas_dirac_dec_output_synthesis_cov_close( DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state /* i/o: handle for the covariance synthesis state */ ) { - int16_t idx; /*-----------------------------------------------------------------* diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index db95d1ee4e..ff90170946 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -753,6 +753,10 @@ ivas_error ivas_init_decoder( } #ifdef FIX_I109_ORIENTATION_TRACKING + /*-----------------------------------------------------------------* + * Set head/orientation tracking + *-----------------------------------------------------------------*/ + if ( st_ivas->hDecoderConfig->Opt_Headrotation ) { if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_NONE ) @@ -1644,7 +1648,6 @@ void ivas_destroy_dec( if ( st_ivas->cldfbAnaDec[i] != NULL ) { deleteCldfb( &( st_ivas->cldfbAnaDec[i] ) ); - st_ivas->cldfbAnaDec[i] = NULL; } } @@ -1653,7 +1656,6 @@ void ivas_destroy_dec( if ( st_ivas->cldfbSynDec[i] != NULL ) { deleteCldfb( &( st_ivas->cldfbSynDec[i] ) ); - st_ivas->cldfbSynDec[i] = NULL; } } @@ -1684,11 +1686,7 @@ void ivas_destroy_dec( } /* LFE handle */ - if ( st_ivas->hLFE != NULL ) - { - ivas_lfe_dec_close( st_ivas->hLFE ); - st_ivas->hLFE = NULL; - } + ivas_lfe_dec_close( &( st_ivas->hLFE ) ); /* HP20 filter handles */ if ( st_ivas->mem_hp20_out != NULL ) @@ -1712,7 +1710,7 @@ void ivas_destroy_dec( } } - /* ISm renderer handle */ + /* ISM renderer handle */ if ( st_ivas->hIsmRendererData != NULL ) { free( st_ivas->hIsmRendererData ); @@ -1720,26 +1718,18 @@ void ivas_destroy_dec( } /* DirAC handle */ - if ( st_ivas->hDirAC != NULL ) + if ( st_ivas->ivas_format == ISM_FORMAT ) { - if ( st_ivas->ivas_format == ISM_FORMAT ) - { - ivas_param_ism_dec_close( st_ivas->hDirAC, st_ivas->hDecoderConfig->output_config ); - } - else - { - ivas_dirac_dec_close( st_ivas->hDirAC ); - } - st_ivas->hDirAC = NULL; + ivas_param_ism_dec_close( &( st_ivas->hDirAC ), st_ivas->hDecoderConfig->output_config ); } - - /* Spar handle */ - if ( st_ivas->hSpar != NULL ) + else { - ivas_spar_dec_close( st_ivas->hSpar, st_ivas->hDecoderConfig->output_Fs, 0 ); - st_ivas->hSpar = NULL; + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); } + /* SPAR handle */ + ivas_spar_dec_close( &( st_ivas->hSpar ), st_ivas->hDecoderConfig->output_Fs, 0 ); + /* HOA decoder matrix */ if ( st_ivas->hoa_dec_mtx != NULL ) { @@ -1747,6 +1737,9 @@ void ivas_destroy_dec( st_ivas->hoa_dec_mtx = NULL; } + /* MASA decoder structure */ + ivas_masa_dec_close( &( st_ivas->hMasa ) ); + /* Qmetadata handle */ ivas_qmetadata_close( &st_ivas->hQMetaData ); @@ -1770,6 +1763,7 @@ void ivas_destroy_dec( /* Crend handle */ ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); + /* Reverb handle */ ivas_reverb_close( &st_ivas->hReverb ); @@ -1783,13 +1777,6 @@ void ivas_destroy_dec( st_ivas->hLsSetupCustom = NULL; } - /* MASA decoder structure */ - if ( st_ivas->hMasa != NULL ) - { - ivas_masa_dec_close( st_ivas->hMasa ); - st_ivas->hMasa = NULL; - } - /* Downmix structure */ if ( st_ivas->hMonoDmxRenderer != NULL ) { @@ -1798,15 +1785,15 @@ void ivas_destroy_dec( } /* Head track data handle */ - if ( st_ivas->hHeadTrackData != NULL ) - { #ifdef FIX_I109_ORIENTATION_TRACKING - ivas_headTrack_close( &st_ivas->hHeadTrackData ); + ivas_headTrack_close( &st_ivas->hHeadTrackData ); #else + if ( st_ivas->hHeadTrackData != NULL ) + { free( st_ivas->hHeadTrackData ); st_ivas->hHeadTrackData = NULL; -#endif } +#endif /* Time Domain binaural renderer handle */ if ( st_ivas->hBinRendererTd != NULL ) @@ -1821,22 +1808,13 @@ void ivas_destroy_dec( } /* CRend binaural renderer handle */ - if ( st_ivas->hSetOfHRTF != NULL ) - { - ivas_HRTF_CRend_binary_close( &st_ivas->hSetOfHRTF ); - } + ivas_HRTF_CRend_binary_close( &st_ivas->hSetOfHRTF ); /* Fastconv HRTF filters */ - if ( st_ivas->hHrtfFastConv != NULL ) - { - ivas_HRTF_fastconv_binary_close( &st_ivas->hHrtfFastConv ); - } + ivas_HRTF_fastconv_binary_close( &st_ivas->hHrtfFastConv ); /* Parametric binauralizer HRTF filters */ - if ( st_ivas->hHrtfParambin != NULL ) - { - ivas_HRTF_parambin_binary_close( &st_ivas->hHrtfParambin ); - } + ivas_HRTF_parambin_binary_close( &st_ivas->hHrtfParambin ); /* Config. Renderer */ ivas_render_config_close( &( st_ivas->hRenderConfig ) ); diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index cae696e938..51ea82bfe1 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -113,11 +113,7 @@ static ivas_error ivas_ism_bitrate_switching( if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM ) { /* Deallocate the ParamISM struct */ - if ( st_ivas->hDirAC != NULL ) - { - ivas_param_ism_dec_close( st_ivas->hDirAC, st_ivas->hDecoderConfig->output_config ); - st_ivas->hDirAC = NULL; - } + ivas_param_ism_dec_close( &( st_ivas->hDirAC ), st_ivas->hDecoderConfig->output_config ); if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL ) { diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index f34aa023f6..acf62ba1a7 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -621,11 +621,19 @@ ivas_error ivas_param_ism_dec_open( *-------------------------------------------------------------------------*/ void ivas_param_ism_dec_close( - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ - AUDIO_CONFIG output_config /* i : output audio configuration */ + DIRAC_DEC_HANDLE *hDirAC_out, /* i/o: decoder DirAC handle */ + AUDIO_CONFIG output_config /* i : output audio configuration */ ) { int16_t i; + DIRAC_DEC_HANDLE hDirAC; + + if ( hDirAC_out == NULL || *hDirAC_out == NULL ) + { + return; + } + + hDirAC = *hDirAC_out; /* Config & CLDFB */ if ( hDirAC->hParamIsm != NULL ) @@ -782,7 +790,8 @@ void ivas_param_ism_dec_close( hDirAC->hParamIsmRendering = NULL; } - free( hDirAC ); + free( *hDirAC_out ); + *hDirAC_out = NULL; return; } diff --git a/lib_dec/ivas_lfe_dec.c b/lib_dec/ivas_lfe_dec.c index 55a68d892b..5c250286ee 100644 --- a/lib_dec/ivas_lfe_dec.c +++ b/lib_dec/ivas_lfe_dec.c @@ -477,19 +477,25 @@ ivas_error ivas_create_lfe_dec( *-------------------------------------------------------------------------*/ void ivas_lfe_dec_close( - LFE_DEC_HANDLE hLFE /* i/o: LFE decoder handle */ + LFE_DEC_HANDLE *hLFE /* i/o: LFE decoder handle */ ) { - free( hLFE->pWindow_state ); - hLFE->pWindow_state = NULL; + if ( hLFE == NULL || *hLFE == NULL ) + { + return; + } - if ( hLFE->lfe_delay_buf != NULL ) + free( ( *hLFE )->pWindow_state ); + ( *hLFE )->pWindow_state = NULL; + + if ( ( *hLFE )->lfe_delay_buf != NULL ) { - free( hLFE->lfe_delay_buf ); - hLFE->lfe_delay_buf = NULL; + free( ( *hLFE )->lfe_delay_buf ); + ( *hLFE )->lfe_delay_buf = NULL; } - free( hLFE ); + free( ( *hLFE ) ); + ( *hLFE ) = NULL; return; } diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index b8b7b74ffc..e28b317408 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -392,9 +392,18 @@ ivas_error ivas_masa_dec_open( *-----------------------------------------------------------------------*/ void ivas_masa_dec_close( - MASA_DECODER_HANDLE hMasa /* i/o: MASA metadata structure */ + MASA_DECODER_HANDLE *hMasa_out /* i/o: MASA metadata structure */ ) { + MASA_DECODER_HANDLE hMasa; + + if ( hMasa_out == NULL || *hMasa_out == NULL ) + { + return; + } + + hMasa = *hMasa_out; + /* Free spherical grid memory if in use */ if ( hMasa->data.sph_grid16 != NULL ) { @@ -436,8 +445,8 @@ void ivas_masa_dec_close( hMasa->hMasaLfeSynth = NULL; } - free( hMasa ); - hMasa = NULL; + free( *hMasa_out ); + *hMasa_out = NULL; return; } diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 6bfddc78e6..a6637ed1f2 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1124,8 +1124,8 @@ void ivas_param_mc_dec_close( hParamMC->hoa_encoder = NULL; } - free( hParamMC ); - hParamMC = NULL; + free( *hParamMC_out ); + *hParamMC_out = NULL; return; } diff --git a/lib_dec/ivas_mcmasa_dec.c b/lib_dec/ivas_mcmasa_dec.c index f6d159083b..3ef12f3094 100644 --- a/lib_dec/ivas_mcmasa_dec.c +++ b/lib_dec/ivas_mcmasa_dec.c @@ -58,10 +58,7 @@ ivas_error ivas_mcmasa_dec_reconfig( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; /* close the old MASA instance */ - if ( st_ivas->hMasa != NULL ) - { - ivas_masa_dec_close( st_ivas->hMasa ); - } + ivas_masa_dec_close( &( st_ivas->hMasa ) ); /* get new McMASA settings */ ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 96a535f427..553cdf2a1b 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -728,24 +728,14 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hParamMC != NULL ) { ivas_param_mc_dec_close( &st_ivas->hParamMC ); - st_ivas->hParamMC = NULL; /* remove ls conversion if it was allocated by ParamMC */ ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); } /* De-allocate McMasa-related handles */ - if ( st_ivas->hMasa != NULL ) - { - ivas_masa_dec_close( st_ivas->hMasa ); - st_ivas->hMasa = NULL; - } - - if ( st_ivas->hQMetaData != NULL ) - { - ivas_qmetadata_close( &st_ivas->hQMetaData ); - st_ivas->hQMetaData = NULL; - } + ivas_masa_dec_close( &( st_ivas->hMasa ) ); + ivas_qmetadata_close( &st_ivas->hQMetaData ); /* init LS conversion if the renderer type asks for it */ if ( st_ivas->renderer_type == RENDERER_MC && st_ivas->hLsSetUpConversion == NULL ) @@ -781,32 +771,18 @@ static ivas_error ivas_mc_dec_reconfig( } /* De-allocate McMasa-related handles */ - if ( st_ivas->hMasa != NULL ) - { - ivas_masa_dec_close( st_ivas->hMasa ); - st_ivas->hMasa = NULL; - } - - if ( st_ivas->hQMetaData != NULL ) - { - ivas_qmetadata_close( &st_ivas->hQMetaData ); - st_ivas->hQMetaData = NULL; - } + ivas_masa_dec_close( &( st_ivas->hMasa ) ); + ivas_qmetadata_close( &st_ivas->hQMetaData ); if ( last_mc_mode == MC_MODE_MCT ) { if ( st_ivas->hMCT != NULL && st_ivas->nchan_transport <= CPE_CHANNELS ) { ivas_mct_dec_close( &st_ivas->hMCT ); - st_ivas->hMCT = NULL; } /* LFE handle */ - if ( st_ivas->hLFE != NULL ) - { - ivas_lfe_dec_close( st_ivas->hLFE ); - st_ivas->hLFE = NULL; - } + ivas_lfe_dec_close( &( st_ivas->hLFE ) ); } } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) @@ -840,18 +816,10 @@ static ivas_error ivas_mc_dec_reconfig( if ( last_mc_mode == MC_MODE_MCT ) { - if ( st_ivas->hMCT != NULL ) - { - ivas_mct_dec_close( &st_ivas->hMCT ); - st_ivas->hMCT = NULL; - } + ivas_mct_dec_close( &st_ivas->hMCT ); /* LFE handle */ - if ( st_ivas->hLFE != NULL ) - { - ivas_lfe_dec_close( st_ivas->hLFE ); - st_ivas->hLFE = NULL; - } + ivas_lfe_dec_close( &( st_ivas->hLFE ) ); } } @@ -1046,10 +1014,9 @@ static ivas_error ivas_mc_dec_reconfig( } } } - else if ( ( st_ivas->renderer_type == RENDERER_DISABLE ) && ( st_ivas->hDirAC != NULL ) ) + else if ( st_ivas->renderer_type == RENDERER_DISABLE && st_ivas->hDirAC != NULL ) { - ivas_dirac_dec_close( st_ivas->hDirAC ); - st_ivas->hDirAC = NULL; + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); } } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 76ac3578f9..745ea1b9ba 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -47,7 +47,7 @@ #include "wmc_auto.h" /*-------------------------------------------------------------------* - * ivas_sba_dec_decoder() + * ivas_sba_dec_reconfigure() * * Reconfigure IVAS SBA decoder *-------------------------------------------------------------------*/ @@ -110,8 +110,7 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->sba_mode != SBA_MODE_SPAR ) { - ivas_spar_dec_close( st_ivas->hSpar, hDecoderConfig->output_Fs, 0 ); - st_ivas->hSpar = NULL; + ivas_spar_dec_close( &( st_ivas->hSpar ), hDecoderConfig->output_Fs, 0 ); if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, -1 ) ) != IVAS_ERR_OK ) { @@ -138,13 +137,14 @@ ivas_error ivas_sba_dec_reconfigure( if ( nchan_transport_old != ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) ) { - ivas_spar_dec_close( st_ivas->hSpar, hDecoderConfig->output_Fs, 1 ); + ivas_spar_dec_close( &( st_ivas->hSpar ), hDecoderConfig->output_Fs, 1 ); if ( ( error = ivas_spar_dec_open( st_ivas, 1 ) ) != IVAS_ERR_OK ) { return error; } } + ivas_spar_config( ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, st_ivas->sid_format ); } else @@ -253,11 +253,7 @@ ivas_error ivas_sba_dec_reconfigure( if ( ( ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) ) && ( ( sba_mode_old != st_ivas->sba_mode ) && ( st_ivas->sba_mode == SBA_MODE_SPAR ) ) ) { - if ( st_ivas->hDirAC != NULL ) - { - ivas_dirac_dec_close( st_ivas->hDirAC ); - st_ivas->hDirAC = NULL; - } + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); @@ -267,16 +263,9 @@ ivas_error ivas_sba_dec_reconfigure( else if ( st_ivas->renderer_type == RENDERER_DISABLE || ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode != SBA_MODE_SPAR ) ) { - if ( st_ivas->hDirAC != NULL ) - { - ivas_dirac_dec_close( st_ivas->hDirAC ); - st_ivas->hDirAC = NULL; - } + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); - if ( st_ivas->hVBAPdata != NULL ) - { - vbap_free_data( &( st_ivas->hVBAPdata ) ); - } + vbap_free_data( &( st_ivas->hVBAPdata ) ); } if ( st_ivas->hDirAC != NULL && st_ivas->sba_mode == SBA_MODE_SPAR ) diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 53c60c3d34..01e4db2ed4 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -61,8 +61,7 @@ static void ivas_spar_dec_MD( Decoder_Struct *st_ivas, Decoder_State *st0 ); *------------------------------------------------------------------------*/ ivas_error ivas_spar_dec_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ - , + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ) { @@ -187,38 +186,39 @@ ivas_error ivas_spar_dec_open( *------------------------------------------------------------------------*/ void ivas_spar_dec_close( - SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ - const int32_t output_Fs /* i : output sampling rate */ - , + SPAR_DEC_HANDLE *hSpar, /* i/o: SPAR decoder handle */ + const int32_t output_Fs, /* i : output sampling rate */ const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ) { - if ( hSpar != NULL ) + if ( *hSpar == NULL || hSpar == NULL ) { - /* MD handle */ - ivas_spar_md_dec_close( &hSpar->hMdDec ); + return; + } - /* TD decorrelator handle */ - ivas_td_decorr_dec_close( &hSpar->hTdDecorr ); + /* MD handle */ + ivas_spar_md_dec_close( &( *hSpar )->hMdDec ); - /* FB mixer handle */ - ivas_FB_mixer_close( &hSpar->hFbMixer, output_Fs, spar_reconfig_flag ); + /* TD decorrelator handle */ + ivas_td_decorr_dec_close( &( *hSpar )->hTdDecorr ); - /* AGC */ - ivas_spar_agc_dec_close( &hSpar->hAgcDec ); + /* FB mixer handle */ + ivas_FB_mixer_close( &( *hSpar )->hFbMixer, output_Fs, spar_reconfig_flag ); - /* PCA */ - if ( hSpar->hPCA != NULL ) - { - free( hSpar->hPCA ); - hSpar->hPCA = NULL; - } + /* AGC */ + ivas_spar_agc_dec_close( &( *hSpar )->hAgcDec ); - if ( !spar_reconfig_flag ) - { - free( hSpar ); - hSpar = NULL; - } + /* PCA */ + if ( ( *hSpar )->hPCA != NULL ) + { + free( ( *hSpar )->hPCA ); + ( *hSpar )->hPCA = NULL; + } + + if ( !spar_reconfig_flag ) + { + free( ( *hSpar ) ); + ( *hSpar ) = NULL; } return; diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index ff6f858d31..3b47d6500e 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -305,6 +305,7 @@ static void ivas_spar_md_dec_matrix_close( free( hMdDecoder->spar_md.band_coeffs ); hMdDecoder->spar_md.band_coeffs = NULL; } + if ( hMdDecoder->mixer_mat != NULL ) { for ( i = 0; i < num_channels; i++ ) @@ -418,11 +419,8 @@ void ivas_spar_md_dec_close( ivas_spar_md_dec_matrix_close( hMdDecoder, num_channels ); - if ( *hMdDec != NULL ) - { - free( *hMdDec ); - *hMdDec = NULL; - } + free( *hMdDec ); + *hMdDec = NULL; return; } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 51d825c0fb..a2becebe42 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -805,6 +805,7 @@ typedef struct ivas_spar_md_dec_state_t int16_t table_idx; int16_t dtx_vad; int16_t spar_hoa_md_flag; + } ivas_spar_md_dec_state_t; diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index b8d96233db..fc3e1db99d 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -150,20 +150,19 @@ void stereo_tcx_init_dec( *-------------------------------------------------------------------*/ void stereo_tcx_core_dec( - Decoder_State *st, /* i/o: decoder state structure */ - const FRAME_MODE frameMode, /* i : Decoder frame mode */ - float *signal_out, /* o : synthesis @internal_Fs */ - float *signal_outFB, /* o : synthesis @output_Fs */ - float pitch_buf[], /* o : floating pitch for each subframe */ - const int16_t sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ - STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */ - const int16_t last_element_mode, /* i : last element mode */ - const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ - STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ - const int16_t nchan_out /* i : number of output channels */ - , - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM) */ + Decoder_State *st, /* i/o: decoder state structure */ + const FRAME_MODE frameMode, /* i : Decoder frame mode */ + float *signal_out, /* o : synthesis @internal_Fs */ + float *signal_outFB, /* o : synthesis @output_Fs */ + float pitch_buf[], /* o : floating pitch for each subframe */ + const int16_t sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ + STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */ + const int16_t last_element_mode, /* i : last element mode */ + const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ + STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ + const int16_t nchan_out, /* i : number of output channels */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM)*/ ) { int16_t i, k; diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 7019beca8e..ed927f0f13 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -58,9 +58,8 @@ ivas_error init_encoder( const int16_t idchan, /* i : channel ID */ const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ const int16_t interval_SID, /* i : interval for SID update */ - const int16_t vad_only_flag /* i : flag to indicate front-VAD structure */ - , - const ISM_MODE ism_mode /* i : ISM mode */ + const int16_t vad_only_flag, /* i : flag to indicate front-VAD structure */ + const ISM_MODE ism_mode /* i : ISM mode */ ) { int16_t i; diff --git a/lib_enc/ivas_agc_enc.c b/lib_enc/ivas_agc_enc.c index f98c22b97e..83dbdad1e1 100644 --- a/lib_enc/ivas_agc_enc.c +++ b/lib_enc/ivas_agc_enc.c @@ -195,22 +195,24 @@ void ivas_spar_agc_enc_close( { ivas_agc_enc_state_t *hAgc; + if ( hAgcEnc == NULL || *hAgcEnc == NULL ) + { + return; + } + hAgc = *hAgcEnc; - if ( hAgc != NULL ) - { - free( hAgc->agc_com.winFunc ); - hAgc->agc_com.winFunc = NULL; + free( hAgc->agc_com.winFunc ); + hAgc->agc_com.winFunc = NULL; - free( hAgc->gain_state ); - hAgc->gain_state = NULL; + free( hAgc->gain_state ); + hAgc->gain_state = NULL; - free( hAgc->gain_data ); - hAgc->gain_data = NULL; + free( hAgc->gain_data ); + hAgc->gain_data = NULL; - free( hAgc ); - hAgc = NULL; - } + free( *hAgcEnc ); + *hAgcEnc = NULL; return; } diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index f419425104..e9d6968f1b 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -221,8 +221,7 @@ ivas_error ivas_corecoder_enc_reconfig( if ( st_ivas->nCPE <= 1 && st_ivas->hMCT != NULL ) { - ivas_mct_enc_close( st_ivas->hMCT ); - st_ivas->hMCT = NULL; + ivas_mct_enc_close( &( st_ivas->hMCT ) ); } /* special case, if we have MCT now and had a single CPE before, remove the MDCT Stereo handles */ diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 61edd0b9a9..43bc94fb04 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -245,15 +245,23 @@ ivas_error ivas_dirac_enc_reconfigure( /*------------------------------------------------------------------------- * ivas_dirac_enc_close() * - * Close DirAC + * Close DirAC encoder handle *------------------------------------------------------------------------*/ void ivas_dirac_enc_close( - DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ - const int32_t input_Fs /* i : input sampling rate */ + DIRAC_ENC_HANDLE *hDirAC_out, /* i/o: encoder DirAC handle */ + const int32_t input_Fs /* i : input sampling rate */ ) { int16_t i, j; + DIRAC_ENC_HANDLE hDirAC; + + if ( hDirAC_out == NULL || *hDirAC_out == NULL ) + { + return; + } + + hDirAC = *hDirAC_out; if ( hDirAC->hFbMixer != NULL ) { @@ -303,7 +311,8 @@ void ivas_dirac_enc_close( hDirAC->hConfig = NULL; } - free( hDirAC ); + free( *hDirAC_out ); + *hDirAC_out = NULL; return; } diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index 23d0bdd0e5..e117cfc5a5 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -117,17 +117,19 @@ void ivas_spar_covar_enc_close( { ivas_enc_cov_handler_state_t *hCovState; + if ( hCovEnc == NULL || *hCovEnc == NULL ) + { + return; + } + hCovState = *hCovEnc; - if ( hCovState != NULL ) - { - ivas_spar_covar_smooth_enc_close( &hCovState->pCov_state, nchan_inp ); + ivas_spar_covar_smooth_enc_close( &hCovState->pCov_state, nchan_inp ); - ivas_spar_covar_smooth_enc_close( &hCovState->pCov_dtx_state, nchan_inp ); + ivas_spar_covar_smooth_enc_close( &hCovState->pCov_dtx_state, nchan_inp ); - free( hCovState ); - hCovState = NULL; - } + free( *hCovEnc ); + *hCovEnc = NULL; return; } diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 766caa1519..b51e5d597c 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -936,71 +936,39 @@ void ivas_destroy_enc( ivas_qmetadata_close( &( st_ivas->hQMetaData ) ); /* DirAC handle */ - if ( st_ivas->hDirAC != NULL ) + if ( ivas_format == ISM_FORMAT ) { - if ( ivas_format == ISM_FORMAT ) - { - ivas_param_ism_enc_close( st_ivas->hDirAC, st_ivas->hEncoderConfig->input_Fs ); - } - else - { - ivas_dirac_enc_close( st_ivas->hDirAC, st_ivas->hEncoderConfig->input_Fs ); - } - st_ivas->hDirAC = NULL; + ivas_param_ism_enc_close( &( st_ivas->hDirAC ), st_ivas->hEncoderConfig->input_Fs ); } - - /* SPAR handle */ - if ( st_ivas->hSpar != NULL ) + else { - ivas_spar_enc_close( st_ivas->hSpar, st_ivas->hEncoderConfig->input_Fs, nchan_inp, 0 ); - st_ivas->hSpar = NULL; + ivas_dirac_enc_close( &( st_ivas->hDirAC ), st_ivas->hEncoderConfig->input_Fs ); } + /* SPAR handle */ + ivas_spar_enc_close( &( st_ivas->hSpar ), st_ivas->hEncoderConfig->input_Fs, nchan_inp, 0 ); + /* MASA handle */ - if ( st_ivas->hMasa != NULL ) - { #ifdef FIX_350_MASA_DELAY_COMP - ivas_masa_enc_close( st_ivas->hMasa ); + ivas_masa_enc_close( &( st_ivas->hMasa ) ); #else - ivas_masa_enc_close( st_ivas->hMasa, st_ivas->nchan_transport, ivas_format ); + ivas_masa_enc_close( &( st_ivas->hMasa ), st_ivas->nchan_transport, ivas_format ); #endif - st_ivas->hMasa = NULL; - } /* MCT handle */ - if ( st_ivas->hMCT != NULL ) - { - ivas_mct_enc_close( st_ivas->hMCT ); - st_ivas->hMCT = NULL; - } + ivas_mct_enc_close( &( st_ivas->hMCT ) ); /* Parametric MC handle */ - if ( st_ivas->hParamMC != NULL ) - { - ivas_param_mc_enc_close( st_ivas->hParamMC, st_ivas->hEncoderConfig->input_Fs ); - st_ivas->hParamMC = NULL; - } + ivas_param_mc_enc_close( &( st_ivas->hParamMC ), st_ivas->hEncoderConfig->input_Fs ); /* Multi-channel MASA handle */ - if ( st_ivas->hMcMasa != NULL ) - { - ivas_mcmasa_enc_close( st_ivas->hMcMasa, st_ivas->hEncoderConfig->input_Fs ); - st_ivas->hMcMasa = NULL; - } + ivas_mcmasa_enc_close( &( st_ivas->hMcMasa ), st_ivas->hEncoderConfig->input_Fs ); /* Stereo downmix for EVS encoder handle */ - if ( st_ivas->hStereoDmxEVS != NULL ) - { - stereo_dmx_evs_close_encoder( st_ivas->hStereoDmxEVS ); - st_ivas->hStereoDmxEVS = NULL; - } + stereo_dmx_evs_close_encoder( &( st_ivas->hStereoDmxEVS ) ); /* LFE handle */ - if ( st_ivas->hLFE != NULL ) - { - ivas_lfe_enc_close( st_ivas->hLFE ); - st_ivas->hLFE = NULL; - } + ivas_lfe_enc_close( &( st_ivas->hLFE ) ); /* Encoder configuration handle */ if ( st_ivas->hEncoderConfig != NULL ) diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 51295cba6e..ead873af0c 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -390,8 +390,7 @@ ivas_error ivas_ism_enc_config( if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM ) { /* Deallocate the memory used by ParamISM when switch to Discrete ISM */ - ivas_param_ism_enc_close( st_ivas->hDirAC, st_ivas->hEncoderConfig->input_Fs ); - st_ivas->hDirAC = NULL; + ivas_param_ism_enc_close( &( st_ivas->hDirAC ), st_ivas->hEncoderConfig->input_Fs ); } } diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index fb69537bc2..cde2327968 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -312,23 +312,29 @@ ivas_error ivas_param_ism_enc_open( /*-------------------------------------------------------------------------* * ivas_param_ism_enc_close() * - * Close Param ISM handle + * Close Param ISM encoder handle *-------------------------------------------------------------------------*/ void ivas_param_ism_enc_close( - DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ - const int32_t input_Fs /* i : input sampling_rate */ + DIRAC_ENC_HANDLE *hDirAC, /* i/o: encoder DirAC handle */ + const int32_t input_Fs /* i : input sampling_rate */ ) { - ivas_FB_mixer_close( &hDirAC->hFbMixer, input_Fs, 0 ); + if ( hDirAC == NULL || *hDirAC == NULL ) + { + return; + } - if ( hDirAC->hParamIsm != NULL ) + ivas_FB_mixer_close( &( *hDirAC )->hFbMixer, input_Fs, 0 ); + + if ( ( *hDirAC )->hParamIsm != NULL ) { - free( hDirAC->hParamIsm ); - hDirAC->hParamIsm = NULL; + free( ( *hDirAC )->hParamIsm ); + ( *hDirAC )->hParamIsm = NULL; } - free( hDirAC ); + free( ( *hDirAC ) ); + ( *hDirAC ) = NULL; return; } @@ -388,6 +394,7 @@ void ivas_param_ism_enc( } } } + /* Quantize DOAs */ ivas_param_ism_enc_quantize_DOA( st_ivas->hIsmMetaData, hParamIsm ); @@ -465,10 +472,10 @@ static void ivas_param_ism_enc_quantize_DOA_dtx( *-------------------------------------------------------------------------*/ void ivas_param_ism_metadata_dtx_enc( - BSTR_ENC_HANDLE hBstr, /* i/o : bitstream handle */ - ISM_METADATA_HANDLE hIsmMeta[], /* i : ISM metadata handles */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + ISM_METADATA_HANDLE hIsmMeta[], /* i : ISM metadata handles */ ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ + PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ ) { int16_t i, nBits, nBits_unused; diff --git a/lib_enc/ivas_lfe_enc.c b/lib_enc/ivas_lfe_enc.c index fc16c279ee..a14424774f 100644 --- a/lib_enc/ivas_lfe_enc.c +++ b/lib_enc/ivas_lfe_enc.c @@ -460,21 +460,27 @@ ivas_error ivas_create_lfe_enc( *-------------------------------------------------------------------------*/ void ivas_lfe_enc_close( - LFE_ENC_HANDLE hLFE /* i/o: LFE encoder handle */ + LFE_ENC_HANDLE *hLFE /* i/o: LFE encoder handle */ ) { - if ( hLFE->old_wtda_audio != NULL ) + if ( hLFE == NULL || *hLFE == NULL ) { - free( hLFE->old_wtda_audio ); - hLFE->old_wtda_audio = NULL; + return; } - if ( hLFE->pWindow_state ) + + if ( ( *hLFE )->old_wtda_audio != NULL ) + { + free( ( *hLFE )->old_wtda_audio ); + ( *hLFE )->old_wtda_audio = NULL; + } + if ( ( *hLFE )->pWindow_state ) { - free( hLFE->pWindow_state ); - hLFE->pWindow_state = NULL; + free( ( *hLFE )->pWindow_state ); + ( *hLFE )->pWindow_state = NULL; } - free( hLFE ); + free( ( *hLFE ) ); + ( *hLFE ) = NULL; return; } diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index dca9be4010..b930714017 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -149,7 +149,7 @@ ivas_error ivas_masa_enc_open( *-----------------------------------------------------------------------*/ void ivas_masa_enc_close( - MASA_ENCODER_HANDLE hMasa /* i/o: MASA metadata structure */ + MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure */ #ifndef FIX_350_MASA_DELAY_COMP , const int16_t nchan_transport, /* i : Number of transport channels */ @@ -159,9 +159,14 @@ void ivas_masa_enc_close( { int16_t i; - for ( i = 0; i < hMasa->data.num_Cldfb_instances; i++ ) + if ( hMasa == NULL || *hMasa == NULL ) + { + return; + } + + for ( i = 0; i < ( *hMasa )->data.num_Cldfb_instances; i++ ) { - deleteCldfb( &( hMasa->data.cldfbAnaEnc[i] ) ); + deleteCldfb( &( ( *hMasa )->data.cldfbAnaEnc[i] ) ); } #ifndef FIX_350_MASA_DELAY_COMP @@ -169,13 +174,14 @@ void ivas_masa_enc_close( { for ( i = 0; i < nchan_transport; i++ ) { - free( hMasa->data.delay_buffer[i] ); - hMasa->data.delay_buffer[i] = NULL; + free( ( *hMasa )->data.delay_buffer[i] ); + ( *hMasa )->data.delay_buffer[i] = NULL; } } #endif - free( hMasa ); + free( ( *hMasa ) ); + ( *hMasa ) = NULL; return; } diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index e51887d455..db9945d0ce 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -360,14 +360,20 @@ ivas_error ivas_param_mc_enc_reconfig( *------------------------------------------------------------------------*/ void ivas_param_mc_enc_close( - PARAM_MC_ENC_HANDLE hParamMC, /* i/o: Parametric MC encoder handle */ + PARAM_MC_ENC_HANDLE *hParamMC, /* i/o: Parametric MC encoder handle */ const int32_t sampling_rate ) { - ivas_param_mc_metadata_close( &hParamMC->hMetadataPMC ); + if ( hParamMC == NULL || *hParamMC == NULL ) + { + return; + } + + ivas_param_mc_metadata_close( &( *hParamMC )->hMetadataPMC ); - ivas_FB_mixer_close( &hParamMC->hFbMixer, sampling_rate, 0 ); + ivas_FB_mixer_close( &( *hParamMC )->hFbMixer, sampling_rate, 0 ); - free( hParamMC ); + free( ( *hParamMC ) ); + ( *hParamMC ) = NULL; return; } @@ -380,10 +386,10 @@ void ivas_param_mc_enc_close( *------------------------------------------------------------------------*/ void ivas_param_mc_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ - float data_f[][L_FRAME48k], /* i/o: input: CICP6, CICP12, CICP14, CICP16 or CICP19 MC data */ - const int16_t input_frame /* i : input frame length */ + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ + float data_f[][L_FRAME48k], /* i/o: input: CICP6, CICP12, CICP14, CICP16 or CICP19 MC data */ + const int16_t input_frame /* i : input frame length */ ) { int16_t k; diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index b79f4b62e4..866e4e176c 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -451,11 +451,11 @@ ivas_error ivas_mcmasa_enc_reconfig( /* brute-force solution: close McMASA and re-instantiate with new settings */ #ifdef FIX_350_MASA_DELAY_COMP - ivas_masa_enc_close( st_ivas->hMasa ); + ivas_masa_enc_close( &( st_ivas->hMasa ) ); #else - ivas_masa_enc_close( st_ivas->hMasa, st_ivas->nchan_transport, st_ivas->hEncoderConfig->ivas_format ); + ivas_masa_enc_close( &( st_ivas->hMasa ), st_ivas->nchan_transport, st_ivas->hEncoderConfig->ivas_format ); #endif - ivas_mcmasa_enc_close( st_ivas->hMcMasa, st_ivas->hEncoderConfig->input_Fs ); + ivas_mcmasa_enc_close( &( st_ivas->hMcMasa ), st_ivas->hEncoderConfig->input_Fs ); /* Determine if to separate some channels from the analysis */ ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( st_ivas->hEncoderConfig->element_mode_init ), ivas_total_brate ); @@ -483,28 +483,33 @@ ivas_error ivas_mcmasa_enc_reconfig( *--------------------------------------------------------------------------*/ void ivas_mcmasa_enc_close( - MCMASA_ENC_HANDLE hMcMasa, /* i/o: encoder McMASA handle */ - const int32_t input_Fs /* i : input sampling rate */ + MCMASA_ENC_HANDLE *hMcMasa, /* i/o: encoder McMASA handle */ + const int32_t input_Fs /* i : input sampling rate */ ) { int16_t i, j; - if ( hMcMasa->separateChannelEnabled ) + if ( hMcMasa == NULL || *hMcMasa == NULL ) { - free( hMcMasa->delay_buffer_lfe[0] ); - free( hMcMasa->delay_buffer_lfe[1] ); + return; + } + + if ( ( *hMcMasa )->separateChannelEnabled ) + { + free( ( *hMcMasa )->delay_buffer_lfe[0] ); + free( ( *hMcMasa )->delay_buffer_lfe[1] ); for ( i = 0; i < 2; i++ ) { - free( hMcMasa->lfeAnaRingBuffer[i] ); + free( ( *hMcMasa )->lfeAnaRingBuffer[i] ); } } - ivas_FB_mixer_close( &hMcMasa->hFbMixer, input_Fs, 0 ); + ivas_FB_mixer_close( &( *hMcMasa )->hFbMixer, input_Fs, 0 ); - if ( !hMcMasa->separateChannelEnabled ) + if ( !( *hMcMasa )->separateChannelEnabled ) { - ivas_FB_mixer_close( &hMcMasa->hFbMixerLfe, input_Fs, 0 ); + ivas_FB_mixer_close( &( *hMcMasa )->hFbMixerLfe, input_Fs, 0 ); } /* intensity 3-dim */ @@ -512,35 +517,36 @@ void ivas_mcmasa_enc_close( { for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { - free( hMcMasa->direction_vector_m[i][j] ); - hMcMasa->direction_vector_m[i][j] = NULL; + free( ( *hMcMasa )->direction_vector_m[i][j] ); + ( *hMcMasa )->direction_vector_m[i][j] = NULL; } - for ( j = 0; j < hMcMasa->no_col_avg_diff; j++ ) + for ( j = 0; j < ( *hMcMasa )->no_col_avg_diff; j++ ) { - free( hMcMasa->buffer_intensity_real[i][j] ); - hMcMasa->buffer_intensity_real[i][j] = NULL; + free( ( *hMcMasa )->buffer_intensity_real[i][j] ); + ( *hMcMasa )->buffer_intensity_real[i][j] = NULL; } - free( hMcMasa->buffer_intensity_real[i] ); - hMcMasa->buffer_intensity_real[i] = NULL; + free( ( *hMcMasa )->buffer_intensity_real[i] ); + ( *hMcMasa )->buffer_intensity_real[i] = NULL; - free( hMcMasa->direction_vector_m[i] ); - hMcMasa->direction_vector_m[i] = NULL; + free( ( *hMcMasa )->direction_vector_m[i] ); + ( *hMcMasa )->direction_vector_m[i] = NULL; } - for ( j = 0; j < hMcMasa->no_col_avg_diff; j++ ) + for ( j = 0; j < ( *hMcMasa )->no_col_avg_diff; j++ ) { - free( hMcMasa->buffer_intensity_real_vert[j] ); - hMcMasa->buffer_intensity_real_vert[j] = NULL; + free( ( *hMcMasa )->buffer_intensity_real_vert[j] ); + ( *hMcMasa )->buffer_intensity_real_vert[j] = NULL; } - free( hMcMasa->buffer_intensity_real_vert ); - hMcMasa->buffer_intensity_real_vert = NULL; + free( ( *hMcMasa )->buffer_intensity_real_vert ); + ( *hMcMasa )->buffer_intensity_real_vert = NULL; - free( hMcMasa->buffer_energy ); - hMcMasa->buffer_energy = NULL; + free( ( *hMcMasa )->buffer_energy ); + ( *hMcMasa )->buffer_energy = NULL; - free( hMcMasa ); + free( ( *hMcMasa ) ); + ( *hMcMasa ) = NULL; return; } diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 707e74e329..a9ce8e3aba 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -499,29 +499,35 @@ ivas_error mct_enc_reconfigure( *-------------------------------------------------------------------------*/ void ivas_mct_enc_close( - MCT_ENC_HANDLE hMCT /* i/o: MCT encoder structure */ + MCT_ENC_HANDLE *hMCT /* i/o: MCT encoder structure */ ) { int16_t n, maxBlocks; - maxBlocks = hMCT->nchan_out_woLFE / 2; + if ( hMCT == NULL || *hMCT == NULL ) + { + return; + } + + maxBlocks = ( *hMCT )->nchan_out_woLFE / 2; for ( n = 0; n < maxBlocks; n++ ) { - if ( hMCT->hBlockData[n] != NULL ) + if ( ( *hMCT )->hBlockData[n] != NULL ) { - if ( hMCT->hBlockData[n]->hStereoMdct != NULL ) + if ( ( *hMCT )->hBlockData[n]->hStereoMdct != NULL ) { - free( hMCT->hBlockData[n]->hStereoMdct ); - hMCT->hBlockData[n]->hStereoMdct = NULL; + free( ( *hMCT )->hBlockData[n]->hStereoMdct ); + ( *hMCT )->hBlockData[n]->hStereoMdct = NULL; } - free( hMCT->hBlockData[n] ); - hMCT->hBlockData[n] = NULL; + free( ( *hMCT )->hBlockData[n] ); + ( *hMCT )->hBlockData[n] = NULL; } } - free( hMCT ); + free( ( *hMCT ) ); + ( *hMCT ) = NULL; return; } @@ -608,34 +614,18 @@ static ivas_error ivas_mc_enc_reconfig( } /*De-allocate handles for other MC modes*/ - if ( st_ivas->hParamMC != NULL ) - { - ivas_param_mc_enc_close( st_ivas->hParamMC, st_ivas->hEncoderConfig->input_Fs ); - st_ivas->hParamMC = NULL; - } + ivas_param_mc_enc_close( &( st_ivas->hParamMC ), st_ivas->hEncoderConfig->input_Fs ); /* De-allocate McMasa-related handles */ - if ( st_ivas->hMcMasa != NULL ) - { - ivas_mcmasa_enc_close( st_ivas->hMcMasa, st_ivas->hEncoderConfig->input_Fs ); - st_ivas->hMcMasa = NULL; - } + ivas_mcmasa_enc_close( &( st_ivas->hMcMasa ), st_ivas->hEncoderConfig->input_Fs ); - if ( st_ivas->hMasa != NULL ) - { #ifdef FIX_350_MASA_DELAY_COMP - ivas_masa_enc_close( st_ivas->hMasa ); + ivas_masa_enc_close( &( st_ivas->hMasa ) ); #else - ivas_masa_enc_close( st_ivas->hMasa, nchan_transport_old, MC_FORMAT ); + ivas_masa_enc_close( &( st_ivas->hMasa ), nchan_transport_old, MC_FORMAT ); #endif - st_ivas->hMasa = NULL; - } - if ( st_ivas->hQMetaData != NULL ) - { - ivas_qmetadata_close( &st_ivas->hQMetaData ); - st_ivas->hQMetaData = NULL; - } + ivas_qmetadata_close( &st_ivas->hQMetaData ); } } else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) @@ -656,39 +646,30 @@ static ivas_error ivas_mc_enc_reconfig( } /* De-allocate McMasa-related handles */ - if ( st_ivas->hMcMasa != NULL ) - { - ivas_mcmasa_enc_close( st_ivas->hMcMasa, st_ivas->hEncoderConfig->input_Fs ); - st_ivas->hMcMasa = NULL; - } + ivas_mcmasa_enc_close( &( st_ivas->hMcMasa ), st_ivas->hEncoderConfig->input_Fs ); + if ( st_ivas->hMasa != NULL ) { #ifdef FIX_350_MASA_DELAY_COMP - ivas_masa_enc_close( st_ivas->hMasa ); + ivas_masa_enc_close( &( st_ivas->hMasa ) ); #else - ivas_masa_enc_close( st_ivas->hMasa, nchan_transport_old, MC_FORMAT ); + ivas_masa_enc_close( &( st_ivas->hMasa ), nchan_transport_old, MC_FORMAT ); #endif st_ivas->hMasa = NULL; } - if ( st_ivas->hQMetaData != NULL ) - { - ivas_qmetadata_close( &st_ivas->hQMetaData ); - st_ivas->hQMetaData = NULL; - } + ivas_qmetadata_close( &st_ivas->hQMetaData ); /* De-allocate MCT handle if last mode was MCT */ - if ( last_mc_mode == MC_MODE_MCT && st_ivas->hMCT != NULL && st_ivas->nchan_transport <= CPE_CHANNELS ) + if ( last_mc_mode == MC_MODE_MCT && st_ivas->nchan_transport <= CPE_CHANNELS ) { - ivas_mct_enc_close( st_ivas->hMCT ); - st_ivas->hMCT = NULL; + ivas_mct_enc_close( &( st_ivas->hMCT ) ); } if ( last_mc_mode == MC_MODE_MCT && st_ivas->hLFE != NULL ) { /* LFE handle */ - ivas_lfe_enc_close( st_ivas->hLFE ); - st_ivas->hLFE = NULL; + ivas_lfe_enc_close( &( st_ivas->hLFE ) ); } } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) @@ -721,26 +702,14 @@ static ivas_error ivas_mc_enc_reconfig( } } - if ( st_ivas->hParamMC != NULL ) - { - ivas_param_mc_enc_close( st_ivas->hParamMC, st_ivas->hEncoderConfig->input_Fs ); - st_ivas->hParamMC = NULL; - } + ivas_param_mc_enc_close( &( st_ivas->hParamMC ), st_ivas->hEncoderConfig->input_Fs ); if ( last_mc_mode == MC_MODE_MCT ) { /* LFE handle */ - if ( st_ivas->hLFE != NULL ) - { - ivas_lfe_enc_close( st_ivas->hLFE ); - st_ivas->hLFE = NULL; - } + ivas_lfe_enc_close( &( st_ivas->hLFE ) ); - if ( st_ivas->hMCT != NULL ) - { - ivas_mct_enc_close( st_ivas->hMCT ); - st_ivas->hMCT = NULL; - } + ivas_mct_enc_close( &( st_ivas->hMCT ) ); } } diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index 11d9c3540f..d3aab0a6e8 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -225,9 +225,7 @@ ivas_error ivas_sba_enc_reconfigure( } else { - ivas_spar_enc_close( st_ivas->hSpar, hEncoderConfig->input_Fs, hEncoderConfig->nchan_inp, spar_reconfig_flag ); - - st_ivas->hSpar = NULL; + ivas_spar_enc_close( &( st_ivas->hSpar ), hEncoderConfig->input_Fs, hEncoderConfig->nchan_inp, spar_reconfig_flag ); } hSpar = st_ivas->hSpar; @@ -255,7 +253,7 @@ ivas_error ivas_sba_enc_reconfigure( if ( sba_mode_old == SBA_MODE_SPAR ) { spar_reconfig_flag = 1; - ivas_spar_enc_close( st_ivas->hSpar, hEncoderConfig->input_Fs, hEncoderConfig->nchan_inp, spar_reconfig_flag ); + ivas_spar_enc_close( &( st_ivas->hSpar ), hEncoderConfig->input_Fs, hEncoderConfig->nchan_inp, spar_reconfig_flag ); if ( ( error = ivas_spar_enc_open( st_ivas, spar_reconfig_flag ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 7b2155d767..c659979d2b 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -58,8 +58,7 @@ static ivas_error ivas_spar_enc_process( Encoder_Struct *st_ivas, const ENCODER_ *------------------------------------------------------------------------*/ ivas_error ivas_spar_enc_open( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ - , + Encoder_Struct *st_ivas, /* i/o: IVAS encoder handle */ const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ) { @@ -232,65 +231,67 @@ ivas_error ivas_spar_enc_open( *------------------------------------------------------------------------*/ void ivas_spar_enc_close( - SPAR_ENC_HANDLE hSpar, /* i/o: SPAR encoder handle */ - const int32_t input_Fs, /* i : input sampling rate */ - const int16_t nchan_inp /* i : number of input channels */ - , + SPAR_ENC_HANDLE *hSpar, /* i/o: SPAR encoder handle */ + const int32_t input_Fs, /* i : input sampling rate */ + const int16_t nchan_inp, /* i : number of input channels */ const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ) { int16_t num_chans; - if ( hSpar != NULL ) + if ( hSpar == NULL || *hSpar == NULL ) { - if ( !spar_reconfig_flag ) + return; + } + + if ( !spar_reconfig_flag ) + { + /* core-coder-VAD handle */ + if ( ( *hSpar )->hCoreCoderVAD != NULL ) { - /* core-coder-VAD handle */ - if ( hSpar->hCoreCoderVAD != NULL ) - { - destroy_core_enc( hSpar->hCoreCoderVAD ); - hSpar->hCoreCoderVAD = NULL; - } + destroy_core_enc( ( *hSpar )->hCoreCoderVAD ); + ( *hSpar )->hCoreCoderVAD = NULL; + } - /* front-VAD handle */ - if ( hSpar->hFrontVad != NULL ) - { - front_vad_destroy( &hSpar->hFrontVad ); - hSpar->hFrontVad = NULL; - } + /* front-VAD handle */ + if ( ( *hSpar )->hFrontVad != NULL ) + { + front_vad_destroy( &( *hSpar )->hFrontVad ); + ( *hSpar )->hFrontVad = NULL; } + } - num_chans = hSpar->hFbMixer->fb_cfg->num_in_chans; - assert( num_chans <= nchan_inp ); + num_chans = ( *hSpar )->hFbMixer->fb_cfg->num_in_chans; + assert( num_chans <= nchan_inp ); - /* MD handle */ - ivas_spar_md_enc_close( &hSpar->hMdEnc ); + /* MD handle */ + ivas_spar_md_enc_close( &( *hSpar )->hMdEnc ); - /* Covar. State handle */ - ivas_spar_covar_enc_close( &hSpar->hCovEnc, num_chans ); + /* Covar. State handle */ + ivas_spar_covar_enc_close( &( *hSpar )->hCovEnc, num_chans ); - /* FB mixer handle */ - ivas_FB_mixer_close( &hSpar->hFbMixer, input_Fs, spar_reconfig_flag ); + /* FB mixer handle */ + ivas_FB_mixer_close( &( *hSpar )->hFbMixer, input_Fs, spar_reconfig_flag ); - /* AGC */ - ivas_spar_agc_enc_close( &hSpar->hAgcEnc ); + /* AGC */ + ivas_spar_agc_enc_close( &( *hSpar )->hAgcEnc ); - /* PCA */ - if ( hSpar->hPCA != NULL ) - { - free( hSpar->hPCA ); - hSpar->hPCA = NULL; - } + /* PCA */ + if ( ( *hSpar )->hPCA != NULL ) + { + free( ( *hSpar )->hPCA ); + ( *hSpar )->hPCA = NULL; + } - if ( !spar_reconfig_flag ) - { - /* Trans Det handle */ - ivas_transient_det_close( &hSpar->hTranDet ); - free( hSpar ); - hSpar = NULL; - } + if ( !spar_reconfig_flag ) + { + /* Trans Det handle */ + ivas_transient_det_close( &( *hSpar )->hTranDet ); + free( ( *hSpar ) ); + ( *hSpar ) = NULL; } + return; } diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index bcc6718e9a..645f690ac0 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -225,6 +225,11 @@ void ivas_spar_md_enc_close( int16_t num_channels, i, j; ivas_spar_md_enc_state_t *hMdEnc; + if ( hMdEnc_in == NULL || *hMdEnc_in == NULL ) + { + return; + } + hMdEnc = *hMdEnc_in; num_channels = hMdEnc->num_umx_ch; @@ -250,7 +255,6 @@ void ivas_spar_md_enc_close( { for ( i = 0; i < num_channels; i++ ) { - for ( j = 0; j < num_channels; j++ ) { free( hMdEnc->cov_real[i][j] ); @@ -264,7 +268,6 @@ void ivas_spar_md_enc_close( { for ( i = 0; i < num_channels; i++ ) { - for ( j = 0; j < num_channels; j++ ) { free( hMdEnc->cov_dtx_real[i][j] ); @@ -288,11 +291,8 @@ void ivas_spar_md_enc_close( free( hMdEnc->mixer_mat_local ); } - if ( hMdEnc != NULL ) - { - free( hMdEnc ); - hMdEnc = NULL; - } + free( *hMdEnc_in ); + *hMdEnc_in = NULL; return; } diff --git a/lib_enc/ivas_stereo_dmx_evs.c b/lib_enc/ivas_stereo_dmx_evs.c index 052970fa70..a5c0fe147f 100644 --- a/lib_enc/ivas_stereo_dmx_evs.c +++ b/lib_enc/ivas_stereo_dmx_evs.c @@ -946,16 +946,22 @@ ivas_error stereo_dmx_evs_init_encoder( *-------------------------------------------------------------------*/ void stereo_dmx_evs_close_encoder( - STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS /* i/o: Stereo downmix for EVS encoder handle */ + STEREO_DMX_EVS_ENC_HANDLE *hStereoDmxEVS /* i/o: Stereo downmix for EVS encoder handle */ ) { - if ( hStereoDmxEVS->hPOC != NULL ) + if ( hStereoDmxEVS == NULL || *hStereoDmxEVS == NULL ) { - free( hStereoDmxEVS->hPOC ); - hStereoDmxEVS->hPOC = NULL; + return; } - free( hStereoDmxEVS ); + if ( ( *hStereoDmxEVS )->hPOC != NULL ) + { + free( ( *hStereoDmxEVS )->hPOC ); + ( *hStereoDmxEVS )->hPOC = NULL; + } + + free( ( *hStereoDmxEVS ) ); + ( *hStereoDmxEVS ) = NULL; return; } diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index f9673656f1..c4941b610c 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -831,11 +831,7 @@ ivas_error ivas_rend_openCrend( if ( ( hRendCfg != NULL ) && ( hRendCfg->roomAcoustics.late_reverb_on ) ) { - if ( ( error = ivas_reverb_open( &( hCrend->hReverb ), - inConfig, - ( *pCrend )->hHrtfCrend, - hRendCfg, - output_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open( &( hCrend->hReverb ), inConfig, ( *pCrend )->hHrtfCrend, hRendCfg, output_Fs ) ) != IVAS_ERR_OK ) { return error; } @@ -853,6 +849,7 @@ ivas_error ivas_rend_openCrend( return IVAS_ERR_OK; } + /*------------------------------------------------------------------------- * ivas_crend_close() * @@ -864,12 +861,7 @@ void ivas_rend_closeCrend( { int16_t i; - if ( pCrend == NULL ) - { - return; - } - - if ( *pCrend == NULL ) + if ( pCrend == NULL || *pCrend == NULL ) { return; } @@ -935,9 +927,11 @@ void ivas_rend_closeCrend( free( *pCrend ); *pCrend = NULL; } + return; } + /*-----------------------------------------------------------------------------------------* * Function ivas_crend_convolver() * diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index ebd7c737a2..58de4819e8 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -284,7 +284,7 @@ void ivas_dirac_dec_close_binaural_data( DIRAC_DEC_BIN_HANDLE *hBinaural /* i/o: decoder DirAC binaural data handle */ ) { - if ( *hBinaural == NULL ) + if ( hBinaural == NULL || *hBinaural == NULL ) { return; } diff --git a/lib_rend/ivas_hrtf.c b/lib_rend/ivas_hrtf.c index e411d3bbbf..2b1f16d025 100644 --- a/lib_rend/ivas_hrtf.c +++ b/lib_rend/ivas_hrtf.c @@ -116,7 +116,6 @@ void ivas_HRTF_CRend_binary_close( return; } - free( *hSetOfHRTF ); *hSetOfHRTF = NULL; diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 3a1d28f6cc..9b3c741ceb 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -90,6 +90,7 @@ ivas_error ivas_headTrack_open( return IVAS_ERR_OK; } + #ifdef FIX_I109_ORIENTATION_TRACKING /*-----------------------------------------------------------------------* * ivas_headTrack_close() @@ -101,18 +102,25 @@ void ivas_headTrack_close( HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* i/o: head track handle */ ) { - if ( hHeadTrackData != NULL ) + if ( hHeadTrackData != NULL || *hHeadTrackData != NULL ) { - if ( ( *hHeadTrackData )->OrientationTracker != NULL ) - { - free( ( *hHeadTrackData )->OrientationTracker ); - } - free( ( *hHeadTrackData ) ); - *hHeadTrackData = NULL; + return; + } + + if ( ( *hHeadTrackData )->OrientationTracker != NULL ) + { + free( ( *hHeadTrackData )->OrientationTracker ); + ( *hHeadTrackData )->OrientationTracker = NULL; } + + free( ( *hHeadTrackData ) ); + *hHeadTrackData = NULL; + + return; } #endif + /*---------------------------------------------------------------------------------- * QuatToRotMat() * diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 8059c53346..eda2982689 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1165,15 +1165,10 @@ static void clearInputIsm( initRendInputBase( &inputIsm->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx ); /* Free input's internal handles */ - if ( inputIsm->crendWrapper != NULL ) - { - ivas_rend_closeCrend( &inputIsm->crendWrapper ); - } - if ( inputIsm->reverb != NULL ) - { - ivas_reverb_close( &inputIsm->reverb ); - } + ivas_rend_closeCrend( &inputIsm->crendWrapper ); + + ivas_reverb_close( &inputIsm->reverb ); if ( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) { @@ -1812,15 +1807,9 @@ static ivas_error initMcBinauralRendering( inputMc->tdRendWrapper.hHrtfTD = NULL; } - if ( inputMc->crendWrapper != NULL ) - { - ivas_rend_closeCrend( &inputMc->crendWrapper ); - } + ivas_rend_closeCrend( &inputMc->crendWrapper ); - if ( inputMc->reverb != NULL ) - { - ivas_reverb_close( &inputMc->reverb ); - } + ivas_reverb_close( &inputMc->reverb ); if ( inputMc->efapInWrapper.hEfap != NULL ) { @@ -2008,15 +1997,9 @@ static void clearInputMc( efap_free_data( &inputMc->efapInWrapper.hEfap ); } - if ( inputMc->crendWrapper != NULL ) - { - ivas_rend_closeCrend( &inputMc->crendWrapper ); - } + ivas_rend_closeCrend( &inputMc->crendWrapper ); - if ( inputMc->reverb != NULL ) - { - ivas_reverb_close( &inputMc->reverb ); - } + ivas_reverb_close( &inputMc->reverb ); if ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) { @@ -2227,10 +2210,7 @@ static void clearInputSba( initRendInputBase( &inputSba->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx ); /* Free input's internal handles */ - if ( inputSba->crendWrapper != NULL ) - { - ivas_rend_closeCrend( &inputSba->crendWrapper ); - } + ivas_rend_closeCrend( &inputSba->crendWrapper ); return; } @@ -2608,6 +2588,7 @@ static void freeDecoderDummy( { free( pDecDummy->hDecoderConfig ); } + if ( pDecDummy->hHeadTrackData != NULL ) { #ifdef FIX_I109_ORIENTATION_TRACKING @@ -2640,11 +2621,7 @@ static void freeDecoderDummy( } /* DirAC handle */ - if ( pDecDummy->hDirAC != NULL ) - { - ivas_dirac_dec_close( pDecDummy->hDirAC ); - pDecDummy->hDirAC = NULL; - } + ivas_dirac_dec_close( &( pDecDummy->hDirAC ) ); /* Qmetadata handle */ ivas_qmetadata_close( &pDecDummy->hQMetaData ); -- GitLab From bcd461391c00769702031d1c8143e4c84c8ac149 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Mar 2023 18:44:40 +0100 Subject: [PATCH 274/375] introduce function ivas_ism_metadata_close( ) --- lib_com/ivas_ism_config.c | 32 ++++++++++++++++++++++++++++++++ lib_com/ivas_prot.h | 4 ++++ lib_dec/ivas_init_dec.c | 11 ++--------- lib_enc/ivas_init_enc.c | 9 +-------- 4 files changed, 39 insertions(+), 17 deletions(-) diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index d6b0999f7e..88c3f10dac 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -37,6 +37,7 @@ #include "rom_com.h" #include "prot.h" #include "ivas_prot.h" +#include "ivas_stat_com.h" #include "ivas_rom_com.h" #ifdef DEBUGGING #include "debug.h" @@ -348,6 +349,7 @@ void ivas_ism_reset_metadata( * * Reset ISm metadata parameters *-------------------------------------------------------------------*/ + void ivas_ism_reset_metadata_API( ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle */ ) @@ -500,3 +502,33 @@ ISM_MODE ivas_ism_mode_select( return ism_mode; } + + +/*--------------------------------------------------------------- + * ivas_ism_metadata_close() + * + * Deallocate ISM metadata handles + * ---------------------------------------------------------------*/ + +void ivas_ism_metadata_close( + ISM_METADATA_HANDLE hIsmMetaData[] /* i/o : object metadata handles */ +) +{ + int16_t n; + + if ( hIsmMetaData == NULL || hIsmMetaData == NULL ) + { + return; + } + + for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) + { + if ( hIsmMetaData[n] != NULL ) + { + free( hIsmMetaData[n] ); + hIsmMetaData[n] = NULL; + } + } + + return; +} diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 194559ee79..6a099204cf 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -864,6 +864,10 @@ void ivas_param_ism_enc_close( const int32_t input_Fs /* i : input sampling_rate */ ); +void ivas_ism_metadata_close( + ISM_METADATA_HANDLE hIsmMetaData[] /* i/o : object metadata handles */ +); + void ivas_param_ism_stereo_dmx( Encoder_Struct *st_ivas, /* i : IVAS encoder structure */ float data[MAX_NUM_OBJECTS][L_FRAME48k], /* i/o: input signal/stereo dmx */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index db95d1ee4e..dea66168f4 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1636,7 +1636,7 @@ void ivas_destroy_dec( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) { - int16_t i, n; + int16_t i; /* CLDFB handles */ for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) @@ -1703,14 +1703,7 @@ void ivas_destroy_dec( } /* ISM metadata handles */ - for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) - { - if ( st_ivas->hIsmMetaData[n] != NULL ) - { - free( st_ivas->hIsmMetaData[n] ); - st_ivas->hIsmMetaData[n] = NULL; - } - } + ivas_ism_metadata_close( st_ivas->hIsmMetaData ); /* ISm renderer handle */ if ( st_ivas->hIsmRendererData != NULL ) diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 766caa1519..9acdf0d30a 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -916,14 +916,7 @@ void ivas_destroy_enc( } /* ISM metadata handles */ - for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) - { - if ( st_ivas->hIsmMetaData[n] != NULL ) - { - free( st_ivas->hIsmMetaData[n] ); - st_ivas->hIsmMetaData[n] = NULL; - } - } + ivas_ism_metadata_close( st_ivas->hIsmMetaData ); /* ISM DTX Handle */ if ( st_ivas->hISMDTX != NULL ) -- GitLab From af94597efd4bbdb1b84465feebf2f0bebcb8a143 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Mar 2023 18:45:58 +0100 Subject: [PATCH 275/375] rename file --- lib_com/{ivas_ism_config.c => ivas_ism_com.c} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lib_com/{ivas_ism_config.c => ivas_ism_com.c} (100%) diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_com.c similarity index 100% rename from lib_com/ivas_ism_config.c rename to lib_com/ivas_ism_com.c -- GitLab From 0bd10c431e8693961104cda1e2c035566e4ad1f9 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Mar 2023 18:46:44 +0100 Subject: [PATCH 276/375] rename file --- Workspace_msvc/lib_com.vcxproj | 2 +- Workspace_msvc/lib_com.vcxproj.filters | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index d55896b03c..23aa2ae3f0 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -244,9 +244,9 @@ + - diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters index baa1700361..7b6854e718 100644 --- a/Workspace_msvc/lib_com.vcxproj.filters +++ b/Workspace_msvc/lib_com.vcxproj.filters @@ -379,9 +379,6 @@ common_evs_c - - common_ivas_c - common_ivas_c @@ -466,6 +463,9 @@ common_ivas_c + + common_ivas_c + -- GitLab From c59c4f16a4c07ee8a4065a13b060ae2ee8c29533 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Mar 2023 18:55:34 +0100 Subject: [PATCH 277/375] remove obsolete assignments --- lib_com/cldfb.c | 17 ++++++++++------- lib_com/prot.h | 4 ++-- lib_dec/init_dec.c | 4 ++-- lib_dec/ivas_corecoder_dec_reconfig.c | 3 --- lib_dec/ivas_init_dec.c | 8 ++++---- lib_enc/init_enc.c | 24 +++++++----------------- lib_enc/ivas_init_enc.c | 8 ++++---- lib_rend/lib_rend.c | 2 -- 8 files changed, 29 insertions(+), 41 deletions(-) diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 931fbc723b..1490703aee 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -883,16 +883,19 @@ void deleteCldfb( { HANDLE_CLDFB_FILTER_BANK hs = *h_cldfb; - if ( hs ) + if ( h_cldfb == NULL || *h_cldfb == NULL ) { - if ( hs->cldfb_state ) - { - free( hs->cldfb_state ); - } - free( hs ); - *h_cldfb = NULL; + return; } + if ( hs->cldfb_state ) + { + free( hs->cldfb_state ); + } + + free( hs ); + *h_cldfb = NULL; + return; } diff --git a/lib_com/prot.h b/lib_com/prot.h index 4c20c392d4..de6c521048 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -2236,7 +2236,7 @@ void LPDmem_enc_init( LPD_state_HANDLE hLPDmem /* i/o: LP memories */ ); -void destroy_encoder( +void destroy_cldfb_encoder( Encoder_State *st /* i/o: state structure */ ); ivas_error evs_enc( @@ -5120,7 +5120,7 @@ ivas_error init_decoder( const MC_MODE mc_mode /* i : MC mode */ ); -void destroy_decoder( +void destroy_cldfb_decoder( Decoder_State *st /* o : Decoder static variables structure */ ); diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index ca3c88b8d1..a8c24a11f5 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -770,12 +770,12 @@ void reset_preecho_dec( /*----------------------------------------------------------------------* - * destroy_decoder() + * destroy_cldfb_decoder() * * Free memory which was allocated in init_decoder() *----------------------------------------------------------------------*/ -void destroy_decoder( +void destroy_cldfb_decoder( Decoder_State *st /* o : Decoder static variables structure */ ) { diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index 492339d6d6..a066164da4 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -453,7 +453,6 @@ ivas_error ivas_cldfb_dec_reconfig( if ( st_ivas->ivas_format == SBA_FORMAT && nchan_transport_old == 1 && numCldfbAnalyses_old == 2 && st_ivas->nchan_transport > 1 ) { deleteCldfb( &( st_ivas->cldfbAnaDec[1] ) ); - st_ivas->cldfbAnaDec[1] = NULL; numCldfbAnalyses_old--; } @@ -473,7 +472,6 @@ ivas_error ivas_cldfb_dec_reconfig( for ( i = numCldfbAnalyses; i < numCldfbAnalyses_old; i++ ) { deleteCldfb( &( st_ivas->cldfbAnaDec[i] ) ); - st_ivas->cldfbAnaDec[i] = NULL; } } else if ( numCldfbAnalyses_old < numCldfbAnalyses ) @@ -495,7 +493,6 @@ ivas_error ivas_cldfb_dec_reconfig( for ( i = numCldfbSyntheses; i < numCldfbSyntheses_old; i++ ) { deleteCldfb( &( st_ivas->cldfbSynDec[i] ) ); - st_ivas->cldfbSynDec[i] = NULL; } } else if ( numCldfbSyntheses_old < numCldfbSyntheses ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index d392bdd912..c57b33e6d2 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1420,7 +1420,7 @@ void destroy_core_dec( DEC_CORE_HANDLE hCoreCoder /* i/o: core decoder structure */ ) { - destroy_decoder( hCoreCoder ); + destroy_cldfb_decoder( hCoreCoder ); if ( hCoreCoder->hGSCDec != NULL ) { @@ -1685,9 +1685,6 @@ void ivas_destroy_dec( } } - /* LFE handle */ - ivas_lfe_dec_close( &( st_ivas->hLFE ) ); - /* HP20 filter handles */ if ( st_ivas->mem_hp20_out != NULL ) { @@ -1739,6 +1736,9 @@ void ivas_destroy_dec( /* MCT handle */ ivas_mct_dec_close( &st_ivas->hMCT ); + /* LFE handle */ + ivas_lfe_dec_close( &( st_ivas->hLFE ) ); + /* Parametric MC handle */ ivas_param_mc_dec_close( &st_ivas->hParamMC ); diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index ed927f0f13..d3cc3f1743 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -862,32 +862,22 @@ void LPDmem_enc_init( return; } + + /*-----------------------------------------------------------------------* - * destroy_encoder() + * destroy_cldfb_encoder() * * Free memory which was allocated in init_encoder() *-----------------------------------------------------------------------*/ -void destroy_encoder( +void destroy_cldfb_encoder( Encoder_State *st /* i/o: Encoder static variables structure */ ) { - if ( st->cldfbSynTd != NULL ) - { - deleteCldfb( &st->cldfbSynTd ); - } - - if ( st->cldfbAnaEnc != NULL ) - { - deleteCldfb( &st->cldfbAnaEnc ); - } - - if ( st->hFdCngEnc != NULL ) - { - deleteFdCngEnc( &st->hFdCngEnc ); - } + deleteCldfb( &st->cldfbSynTd ); + deleteCldfb( &st->cldfbAnaEnc ); - /* Close Core */ + deleteFdCngEnc( &st->hFdCngEnc ); return; } diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 2f6c5199d8..80f58bd99f 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -725,7 +725,7 @@ void destroy_core_enc( ENC_CORE_HANDLE hCoreCoder /* i/o: core encoder structure */ ) { - destroy_encoder( hCoreCoder ); + destroy_cldfb_encoder( hCoreCoder ); if ( hCoreCoder->hSignalBuf != NULL ) { @@ -951,6 +951,9 @@ void ivas_destroy_enc( /* MCT handle */ ivas_mct_enc_close( &( st_ivas->hMCT ) ); + /* LFE handle */ + ivas_lfe_enc_close( &( st_ivas->hLFE ) ); + /* Parametric MC handle */ ivas_param_mc_enc_close( &( st_ivas->hParamMC ), st_ivas->hEncoderConfig->input_Fs ); @@ -960,9 +963,6 @@ void ivas_destroy_enc( /* Stereo downmix for EVS encoder handle */ stereo_dmx_evs_close_encoder( &( st_ivas->hStereoDmxEVS ) ); - /* LFE handle */ - ivas_lfe_enc_close( &( st_ivas->hLFE ) ); - /* Encoder configuration handle */ if ( st_ivas->hEncoderConfig != NULL ) { diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index eda2982689..95e87ec4ef 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2607,7 +2607,6 @@ static void freeDecoderDummy( if ( pDecDummy->cldfbAnaDec[i] != NULL ) { deleteCldfb( &( pDecDummy->cldfbAnaDec[i] ) ); - pDecDummy->cldfbAnaDec[i] = NULL; } } @@ -2616,7 +2615,6 @@ static void freeDecoderDummy( if ( pDecDummy->cldfbSynDec[i] != NULL ) { deleteCldfb( &( pDecDummy->cldfbSynDec[i] ) ); - pDecDummy->cldfbSynDec[i] = NULL; } } -- GitLab From 53af49c3227de71e070cf785bd52422ced14ef6e Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Mar 2023 19:13:24 +0100 Subject: [PATCH 278/375] clang-format --- lib_com/ivas_fb_mixer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 2bf849b410..3e0d68049a 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -831,8 +831,8 @@ static int16_t ivas_calculate_abs_fr( float short_stride_nrg = 0.0f; float cldfb_nrg = 0.0f; int16_t short_stride = pFb->fb_bin_to_band.short_stride; - const int16_t num_bins_per_short_stride_bin = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); - const int16_t num_bins_per_cldfb_band = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); + const int16_t num_bins_per_short_stride_bin = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); + const int16_t num_bins_per_cldfb_band = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); float short_stride_max_per_spar_band = 1e-9f; /*loop over all stored Filter Bank Response MDFT coefficients*/ -- GitLab From fb2788bc69fda14c84f8f33941deac92d8f9b9e5 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Mar 2023 19:28:48 +0100 Subject: [PATCH 279/375] fix ASAN failures --- lib_dec/ivas_agc_dec.c | 4 ++-- lib_rend/ivas_rotation.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_agc_dec.c b/lib_dec/ivas_agc_dec.c index c874b297be..72ae68a57b 100644 --- a/lib_dec/ivas_agc_dec.c +++ b/lib_dec/ivas_agc_dec.c @@ -142,7 +142,7 @@ void ivas_spar_agc_dec_close( { ivas_agc_dec_state_t *hAgc; - if ( hAgcDec != NULL || *hAgcDec != NULL ) + if ( hAgcDec == NULL || *hAgcDec == NULL ) { return; } @@ -158,7 +158,7 @@ void ivas_spar_agc_dec_close( free( hAgc->gain_data ); hAgc->gain_data = NULL; - free( hAgc ); + free( *hAgcDec ); *hAgcDec = NULL; return; diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 9b3c741ceb..2a45c6d61a 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -102,7 +102,7 @@ void ivas_headTrack_close( HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* i/o: head track handle */ ) { - if ( hHeadTrackData != NULL || *hHeadTrackData != NULL ) + if ( hHeadTrackData == NULL || *hHeadTrackData == NULL ) { return; } -- GitLab From 5925dc7100cd0dd56ce35885f8eb06011298d64d Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Mar 2023 11:00:15 +0100 Subject: [PATCH 280/375] make 'nchan_ism' parameter part of st_ivas/hEncoderConfig; under NCHAN_ISM_PARAMETER --- lib_com/ivas_ism_config.c | 45 ++++++++++------ lib_com/ivas_prot.h | 35 +++++++++---- lib_com/ivas_stat_com.h | 2 + lib_com/options.h | 1 + lib_dec/ivas_dec.c | 13 +++++ lib_dec/ivas_init_dec.c | 20 +++++--- lib_dec/ivas_ism_dec.c | 53 +++++++++++++++++-- lib_dec/ivas_ism_dtx_dec.c | 45 ++++++++++------ lib_dec/ivas_ism_metadata_dec.c | 68 ++++++++++++++---------- lib_dec/ivas_ism_param_dec.c | 67 ++++++++++++++++++++++++ lib_dec/ivas_ism_renderer.c | 12 +++-- lib_dec/ivas_sba_rendering_internal.c | 4 +- lib_dec/ivas_stat_dec.h | 3 ++ lib_enc/ivas_ism_dtx_enc.c | 22 ++++---- lib_enc/ivas_ism_enc.c | 32 ++++++++---- lib_enc/ivas_ism_metadata_enc.c | 59 ++++++++++++--------- lib_enc/ivas_ism_param_enc.c | 74 +++++++++++++++++++++++++++ lib_enc/ivas_stat_enc.h | 3 ++ lib_enc/lib_enc.c | 6 +++ 19 files changed, 433 insertions(+), 131 deletions(-) diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 15c1d32da3..e8ffa3b228 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -87,15 +87,15 @@ static void bitbudget_to_brate( *-------------------------------------------------------------------*/ ivas_error ivas_ism_config( - const int32_t ism_total_brate, /* i : ISms total bitrate */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t num_obj, /* i : number of objects */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - const int16_t localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ - const int16_t ism_imp[], /* i : ISM importance flags */ - int32_t element_brate[], /* o : element bitrate per object */ - int32_t total_brate[], /* o : total bitrate per object */ - int16_t nb_bits_metadata[] /* i/o: number of metadata bits */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t nchan_ism, /* i : number of objects */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ + const int16_t ism_imp[], /* i : ISM importance flags */ + int32_t element_brate[], /* o : element bitrate per object */ + int32_t total_brate[], /* o : total bitrate per object */ + int16_t nb_bits_metadata[] /* i/o: number of metadata bits */ ) { int16_t ch; @@ -137,7 +137,7 @@ ivas_error ivas_ism_config( nb_bits_metadata[0] += ISM_EXTENDED_METADATA_BITS; } #endif - nb_bits_metadata[0] += n_ISms * ISM_METADATA_FLAG_BITS + num_obj; + nb_bits_metadata[0] += n_ISms * ISM_METADATA_FLAG_BITS + nchan_ism; for ( ch = 0; ch < n_ISms; ch++ ) { @@ -453,12 +453,23 @@ float ism_dequant_meta( * ---------------------------------------------------------------*/ void ivas_param_ism_config( - PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: IVAS Param ISM Config Structure */ ) + PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: IVAS Param ISM Config Structure */ +#ifdef NCHAN_ISM_PARAMETER + , + const int16_t nchan_obj /* i : number of ISM channels */ +#endif +) { +#ifdef NCHAN_ISM_PARAMETER + int16_t i; + + hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; +#else int16_t i, num_obj; hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; num_obj = hParamIsm->num_obj; +#endif for ( i = 0; i < hParamIsm->nbands; i++ ) { @@ -466,7 +477,11 @@ void ivas_param_ism_config( } /* for elevation zero compute the max azi quantization indices */ +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < nchan_obj; i++ ) +#else for ( i = 0; i < num_obj; i++ ) +#endif { hParamIsm->last_az_diff[i] = 0; hParamIsm->last_az_sgn[i] = 1; @@ -513,14 +528,14 @@ ISM_MODE ivas_ism_mode_select( *-------------------------------------------------------------------*/ void update_last_metadata( - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ const int16_t updt_flag[] /* i : last metadata update flag */ ) { int16_t ch; - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { if ( updt_flag[ch] == 1 ) { @@ -540,7 +555,7 @@ void update_last_metadata( *----------------------------------------------------------------*/ void ivas_get_ism_sid_quan_bitbudget( - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ int16_t *nBits_elevation, /* o : number of Q bits for elevation */ float *q_step, /* o : quantization step */ @@ -556,7 +571,7 @@ void ivas_get_ism_sid_quan_bitbudget( *nBits_coh = ISM_DTX_COH_SCA_BITS; *nBits_sce_id = 1; - if ( num_obj >= 3 ) + if ( nchan_ism >= 3 ) { *nBits_azimuth = ISM_DTX_AZI_BITS_LOW; *nBits_elevation = ISM_DTX_ELE_BITS_LOW; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 43b5140a3c..266efebdd9 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -747,8 +747,8 @@ void dtx_read_padding_bits( ivas_error ivas_ism_config( const int32_t ism_total_brate, /* i : ISms total bitrate */ - const int16_t num_trans_ch, /* i : number of trans channels */ - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t nchan_ism, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ const int16_t localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ const int16_t ism_imp[], /* i : ISM importance flags */ @@ -818,6 +818,9 @@ ivas_error ivas_ism_enc( ivas_error ivas_ism_metadata_enc( const int32_t ism_total_brate, /* i : ISms total bitrate */ +#ifdef NCHAN_ISM_PARAMETER + const int16_t nchan_ism, /* i : number of ISM channels */ +#endif const int16_t nchan_transport, /* i : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ @@ -835,6 +838,9 @@ ivas_error ivas_ism_metadata_enc( ivas_error ivas_ism_metadata_dec( const int32_t ism_total_brate, /* i : ISms total bitrate */ +#ifdef NCHAN_ISM_PARAMETER + const int16_t nchan_ism, /* i : number of ISM channels */ +#endif int16_t *nchan_transport, /* o : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ @@ -881,6 +887,10 @@ void ivas_param_ism_stereo_dmx( void ivas_param_ism_config( PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: IVAS Param ISM Config Structure */ +#ifdef NCHAN_ISM_PARAMETER + , + const int16_t nchan_ism /* i : number of ISM channels */ +#endif ); ivas_error ivas_ism_enc_config( @@ -888,11 +898,14 @@ ivas_error ivas_ism_enc_config( ); ivas_error ivas_ism_dec_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #ifdef DISCRETE_ISM_DTX_CNG - const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ + , + const ISM_MODE last_ism_mode /* i/o: last ISM mode */ +#endif +#ifndef NCHAN_ISM_PARAMETER + ,const int16_t num_obj /* i : number of objects in the bitstream */ #endif - const int16_t num_obj /* i : number of objects in the bitstream */ ); ivas_error ivas_param_ism_dec_open( @@ -930,7 +943,7 @@ int16_t ivas_ism_dtx_enc( #ifdef FIX_DTX_BRATE_LIMIT const int32_t ivas_total_brate, /* i : IVAS total bitrate */ #endif - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ @@ -954,7 +967,7 @@ ivas_error ivas_ism_dtx_dec( void ivas_ism_metadata_sid_enc( ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ const int16_t flag_noisy_speech, /* i : noisy speech flag */ - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ const ISM_MODE ism_mode, /* i : ISM mode */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ @@ -977,7 +990,7 @@ void ivas_ism_metadata_sid_dec( SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ const int32_t ism_total_brate, /* i : ISms total bitrate */ const int16_t bfi, /* i : bfi flag */ - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ const ISM_MODE ism_mode, /* i : ISM mode */ int16_t *flag_noisy_speech, /* o : noisy speech flag */ @@ -1011,13 +1024,13 @@ void ivas_ism_coh_estim_dtx_enc( #ifdef DISCRETE_ISM_DTX_CNG void update_last_metadata( - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ const int16_t updt_flag[] /* i : last metadata update flag */ ); void ivas_get_ism_sid_quan_bitbudget( - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ int16_t *nBits_elevation, /* o : number of Q bits for elevation */ float *q_step, /* o : quantization step */ @@ -4709,7 +4722,7 @@ void ivas_ism2sba( float buffer_td[][L_FRAME48k], /* i/o: TD signal buffers */ ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ const ISM_METADATA_HANDLE hIsmMetaData[], /* i : object metadata */ - const int16_t num_objects, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t output_frame, /* i : output frame length per channel */ const int16_t sba_order /* i : SBA order */ ); diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 6a17263696..197927b084 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -155,7 +155,9 @@ typedef struct ivas_param_ism_data_structure int16_t nbands; int16_t nblocks[MAX_PARAM_ISM_NBANDS]; int16_t band_grouping[MAX_PARAM_ISM_NBANDS + 1]; +#ifndef NCHAN_ISM_PARAMETER int16_t num_obj; +#endif int16_t azi_index[MAX_NUM_OBJECTS]; int16_t ele_index[MAX_NUM_OBJECTS]; diff --git a/lib_com/options.h b/lib_com/options.h index d61448db6d..d9eec46fce 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -161,6 +161,7 @@ #ifdef DISCRETE_ISM_DTX_CNG #define FORCE_EST /* FhG: force ACELP noise estimation in ISM mode for first 100 frames to prevent all-zero CNG */ #endif +#define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index a0d31a58c9..ce74c66c39 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -149,8 +149,13 @@ ivas_error ivas_dec( } else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { + // VE: call ivas_ism_metadata_dec() with 'st_ivas' - TBD #ifdef DISCRETE_ISM_DTX_CNG +#ifdef NCHAN_ISM_PARAMETER + if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -161,7 +166,11 @@ ivas_error ivas_dec( else /* ISM_MODE_DISC */ { #ifdef DISCRETE_ISM_DTX_CNG +#ifdef NCHAN_ISM_PARAMETER + if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -220,7 +229,11 @@ ivas_error ivas_dec( else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { /* Convert to Ambisonics; used also for ISM->HOA3->binaural rendering */ +#ifdef NCHAN_ISM_PARAMETER + ivas_ism2sba( output, st_ivas->hIsmRendererData, st_ivas->hIsmMetaData, st_ivas->nchan_ism, output_frame, st_ivas->hIntSetup.ambisonics_order ); +#else ivas_ism2sba( output, st_ivas->hIsmRendererData, st_ivas->hIsmMetaData, st_ivas->nchan_transport, output_frame, st_ivas->hIntSetup.ambisonics_order ); +#endif } /* Binaural rendering */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 3d249949ee..cec550028d 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -66,7 +66,7 @@ ivas_error ivas_dec_setup( ) { int16_t k, idx, num_bits_read; - int16_t num_obj, element_mode_flag; + int16_t nchan_ism, element_mode_flag; Decoder_State *st; int32_t ivas_total_brate; ivas_error error; @@ -102,21 +102,29 @@ ivas_error ivas_dec_setup( { /* read the number of objects */ st_ivas->nchan_transport = 1; - num_obj = 1; + nchan_ism = 1; k = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ); - while ( st_ivas->bit_stream[k] && num_obj < MAX_NUM_OBJECTS ) + while ( st_ivas->bit_stream[k] && nchan_ism < MAX_NUM_OBJECTS ) { - num_obj++; + nchan_ism++; k--; } +#ifdef NCHAN_ISM_PARAMETER + st_ivas->nchan_ism = nchan_ism; +#endif + #ifdef DISCRETE_ISM_DTX_CNG - if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, num_obj ) ) != IVAS_ERR_OK ) +#ifdef NCHAN_ISM_PARAMETER + if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nchan_ism ) ) != IVAS_ERR_OK ) +#endif { return error; } #else - ivas_ism_dec_config( st_ivas, num_obj ); + ivas_ism_dec_config( st_ivas, nchan_ism ); #endif } else if ( st_ivas->ivas_format == SBA_FORMAT ) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 79d7e72f8d..e73cde5d54 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -49,8 +49,11 @@ static ivas_error ivas_ism_bitrate_switching( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nchan_transport_old, /* i : last number of transport channels */ - const ISM_MODE last_ism_mode, /* i : last ISM mode */ - const int16_t num_obj /* i : number of objects in the bitstream */ + const ISM_MODE last_ism_mode /* i : last ISM mode */ +#ifndef NCHAN_ISM_PARAMETER + , + const int16_t num_obj /* i : number of objects in the bitstream */ +#endif ) { ivas_error error; @@ -62,7 +65,11 @@ static ivas_error ivas_ism_bitrate_switching( nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; +#ifdef NCHAN_ISM_PARAMETER + if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -242,11 +249,15 @@ static ivas_error ivas_ism_bitrate_switching( /*! r : ISM format mode */ ivas_error ivas_ism_dec_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #ifdef DISCRETE_ISM_DTX_CNG - const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ + , + const ISM_MODE last_ism_mode /* i/o: last ISM mode */ #endif +#ifndef NCHAN_ISM_PARAMETER + , const int16_t num_obj /* i : number of objects in the bitstream */ +#endif ) { int32_t ivas_total_brate; @@ -266,7 +277,11 @@ ivas_error ivas_ism_dec_config( #endif /* Assumes that num of input objects are constant */ +#ifdef NCHAN_ISM_PARAMETER + nchan_transport_old = st_ivas->nchan_ism; +#else nchan_transport_old = num_obj; +#endif if ( last_ism_mode == ISM_MODE_PARAM ) { @@ -276,15 +291,25 @@ ivas_error ivas_ism_dec_config( if ( !st_ivas->bfi && ivas_total_brate != IVAS_SID_5k2 && ivas_total_brate != FRAME_NO_DATA ) { /* select ISM format mode */ +#ifdef NCHAN_ISM_PARAMETER + st_ivas->ism_mode = ivas_ism_mode_select( st_ivas->nchan_ism, ivas_total_brate ); + + st_ivas->nchan_transport = st_ivas->nchan_ism; +#else st_ivas->ism_mode = ivas_ism_mode_select( num_obj, ivas_total_brate ); st_ivas->nchan_transport = num_obj; +#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { st_ivas->nchan_transport = 2; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { +#ifdef NCHAN_ISM_PARAMETER + st_ivas->hDecoderConfig->nchan_out = st_ivas->nchan_ism; +#else st_ivas->hDecoderConfig->nchan_out = num_obj; +#endif } } @@ -297,7 +322,11 @@ ivas_error ivas_ism_dec_config( { if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hDecoderConfig->ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) ) { +#ifdef NCHAN_ISM_PARAMETER + if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, num_obj ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -308,20 +337,32 @@ ivas_error ivas_ism_dec_config( else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { #ifdef DISCRETE_ISM_DTX_CNG +#ifdef NCHAN_ISM_PARAMETER + st_ivas->nchan_transport = st_ivas->nchan_ism; +#else st_ivas->nchan_transport = num_obj; +#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { st_ivas->nchan_transport = 2; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { +#ifdef NCHAN_ISM_PARAMETER + st_ivas->hDecoderConfig->nchan_out = st_ivas->nchan_ism; +#else st_ivas->hDecoderConfig->nchan_out = num_obj; +#endif } } /* ISM mode switching */ if ( st_ivas->ism_mode != last_ism_mode ) { +#ifdef NCHAN_ISM_PARAMETER + if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, num_obj ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -338,7 +379,11 @@ ivas_error ivas_ism_dec_config( #endif } +#ifdef NCHAN_ISM_PARAMETER + switch ( st_ivas->nchan_ism ) +#else switch ( num_obj ) +#endif { case 1: st_ivas->transport_config = AUDIO_CONFIG_ISM1; diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 8e022feae1..cb4d1752d2 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -103,7 +103,7 @@ ivas_error ivas_ism_dtx_dec( int16_t *nb_bits_metadata /* o : number of metadata bits */ ) { - int16_t ch, pos, num_obj, num_obj_prev; + int16_t ch, pos, nchan_ism, nchan_ism_prev; int32_t ivas_total_brate; #ifdef DISCRETE_ISM_DTX_CNG int16_t md_diff_flag[MAX_NUM_OBJECTS]; @@ -123,31 +123,38 @@ ivas_error ivas_ism_dtx_dec( } #endif +#ifdef NCHAN_ISM_PARAMETER + nchan_ism_prev = st_ivas->nchan_ism; +#else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - num_obj_prev = st_ivas->hDirAC->hParamIsm->num_obj; + nchan_ism_prev = st_ivas->hDirAC->hParamIsm->num_obj; } else /* ism_mode == ISM_MODE_DISC */ { - num_obj_prev = st_ivas->nchan_transport; + nchan_ism_prev = st_ivas->nchan_transport; } +#endif if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { /* read number of objects */ - num_obj = 1; + nchan_ism = 1; pos = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); - while ( get_indice( st_ivas->hSCE[0]->hCoreCoder[0], pos, 1 ) == 1 && num_obj < MAX_NUM_OBJECTS ) + while ( get_indice( st_ivas->hSCE[0]->hCoreCoder[0], pos, 1 ) == 1 && nchan_ism < MAX_NUM_OBJECTS ) { - ( num_obj )++; + ( nchan_ism )++; pos--; } +#ifdef NCHAN_ISM_PARAMETER + st_ivas->nchan_ism = nchan_ism; +#endif #ifdef DISCRETE_ISM_DTX_CNG pos--; #endif - if ( num_obj != num_obj_prev ) + if ( nchan_ism != nchan_ism_prev ) { /* IVAS_fmToDo: more work needed when the number of transported objects is not constant */ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong number of objects signalled!" ); @@ -157,40 +164,44 @@ ivas_error ivas_ism_dtx_dec( last_ism_mode = st_ivas->ism_mode; /* read ism_mode */ - if ( num_obj > 2 ) + if ( nchan_ism > 2 ) { - pos -= num_obj; /* SID metadata flags */ + pos -= nchan_ism; /* SID metadata flags */ idx = get_indice( st_ivas->hSCE[0]->hCoreCoder[0], pos, 1 ); ism_mode_bstr = (ISM_MODE) ( idx + 1 ); st_ivas->ism_mode = ism_mode_bstr; } - if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, num_obj ) ) != IVAS_ERR_OK ) +#ifdef NCHAN_ISM_PARAMETER + if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, nchan_ism ) ) != IVAS_ERR_OK ) +#endif { return error; } #else - ivas_ism_dec_config( st_ivas, num_obj ); + ivas_ism_dec_config( st_ivas, nchan_ism ); if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - st_ivas->hDirAC->hParamIsm->num_obj = num_obj; + st_ivas->hDirAC->hParamIsm->num_obj = nchan_ism; } else /* ism_mode == ISM_MODE_DISC */ { - st_ivas->nchan_transport = num_obj; + st_ivas->nchan_transport = nchan_ism; } #endif } else { - num_obj = num_obj_prev; + nchan_ism = nchan_ism_prev; } /* Metadata decoding and dequantization */ #ifdef DISCRETE_ISM_DTX_CNG - ivas_ism_metadata_sid_dec( st_ivas->hSCE, ivas_total_brate, st_ivas->bfi, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, + ivas_ism_metadata_sid_dec( st_ivas->hSCE, ivas_total_brate, st_ivas->bfi, nchan_ism, st_ivas->nchan_transport, st_ivas->ism_mode, &flag_noisy_speech, &sce_id_dtx, st_ivas->hIsmMetaData, nb_bits_metadata ); if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) @@ -207,11 +218,11 @@ ivas_error ivas_ism_dtx_dec( #endif #ifdef DISCRETE_ISM_DTX_CNG - set_s( md_diff_flag, 1, num_obj ); + set_s( md_diff_flag, 1, nchan_ism ); if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { st_ivas->hDirAC->azimuth_values[ch] = st_ivas->hIsmMetaData[ch]->azimuth; st_ivas->hDirAC->elevation_values[ch] = st_ivas->hIsmMetaData[ch]->elevation; diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index ed7338a63e..e636cecc1b 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -74,14 +74,14 @@ int16_t decode_radius( DEC_CORE_HANDLE st0, int16_t *last_radius_idx, int16_t *f static void ism_metadata_smooth( ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ const int32_t ism_total_brate, /* i : ISms total bitrate */ - const int16_t num_obj /* i : number of objects */ + const int16_t nchan_ism /* i : number of objects */ ) { ISM_METADATA_HANDLE hIsmMetaData; int16_t ch; float diff; - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMetaData = hIsmMeta[ch]; @@ -141,7 +141,10 @@ static void ism_metadata_smooth( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_dec( - const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ +#ifdef NCHAN_ISM_PARAMETER + const int16_t nchan_ism, /* i : number of ISM channels */ +#endif int16_t *nchan_transport, /* o : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ @@ -178,7 +181,11 @@ ivas_error ivas_ism_metadata_dec( int16_t nchan_transport_prev, ism_metadata_flag_global; int16_t localVAD[MAX_NUM_OBJECTS]; int16_t ism_imp[MAX_NUM_OBJECTS]; - int16_t num_obj = 0, nbands, nblocks; +#ifdef NCHAN_ISM_PARAMETER + int16_t nbands, nblocks; +#else + int16_t nchan_ism = 0, nbands, nblocks; +#endif #ifdef DISCRETE_ISM_DTX_CNG int16_t md_diff_flag[MAX_NUM_OBJECTS]; #endif @@ -238,22 +245,31 @@ ivas_error ivas_ism_metadata_dec( * Read ISm common signaling *----------------------------------------------------------------*/ +#ifdef NCHAN_ISM_PARAMETER + /* number of objects was read in ivas_dec_setup() */ + st0->next_bit_pos += nchan_ism; +#else /* read number of objects */ - num_obj = 1; - while ( get_next_indice( st0, 1 ) == 1 && num_obj < MAX_NUM_OBJECTS ) + nchan_ism = 1; + while ( get_next_indice( st0, 1 ) == 1 && nchan_ism < MAX_NUM_OBJECTS ) { - ( num_obj )++; + ( nchan_ism )++; } +#endif - ism_mode = ivas_ism_mode_select( num_obj, ism_total_brate ); + ism_mode = ivas_ism_mode_select( nchan_ism, ism_total_brate ); if ( ism_mode == ISM_MODE_PARAM ) { - hParamIsm->num_obj = num_obj; +#ifdef NCHAN_ISM_PARAMETER + *nchan_transport = MAX_PARAM_ISM_WAVE; +#else + hParamIsm->num_obj = nchan_ism; +#endif } else if ( ism_mode == ISM_MODE_DISC ) { - *nchan_transport = num_obj; + *nchan_transport = nchan_ism; } if ( *nchan_transport != nchan_transport_prev ) @@ -284,7 +300,7 @@ ivas_error ivas_ism_metadata_dec( ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; } - for ( ; ch < num_obj; ch++ ) + for ( ; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->ism_metadata_flag = 1; ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; @@ -317,7 +333,7 @@ ivas_error ivas_ism_metadata_dec( nb_bits_start = st0->next_bit_pos; } - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMetaData = hIsmMeta[ch]; if ( ism_mode == ISM_MODE_DISC ) @@ -587,7 +603,7 @@ ivas_error ivas_ism_metadata_dec( { hIsmMeta[ch]->ism_metadata_flag = hIsmMeta[ch]->last_ism_metadata_flag; } - for ( ; ch < num_obj; ch++ ) + for ( ; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; } @@ -596,7 +612,7 @@ ivas_error ivas_ism_metadata_dec( if ( ism_mode == ISM_MODE_PARAM ) { - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch] + hParamIsm->last_az_sgn[ch] * hParamIsm->last_az_diff[ch]; /*hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch] % hParamIsm->az_alpha[ch];*/ @@ -618,7 +634,7 @@ ivas_error ivas_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG if ( hISMDTX.ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) { - ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); + ism_metadata_smooth( hIsmMeta, ism_total_brate, nchan_ism ); } hISMDTX.ism_dtx_hangover_cnt = min( ( hISMDTX.ism_dtx_hangover_cnt )++, IVAS_ISM_DTX_HO_MAX ); #endif @@ -629,7 +645,7 @@ ivas_error ivas_ism_metadata_dec( if ( !bfi ) { - if ( ( error = ivas_ism_config( ism_total_brate, *nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_config( ism_total_brate, *nchan_transport, nchan_ism, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) { return error; } @@ -651,7 +667,7 @@ ivas_error ivas_ism_metadata_dec( hSCE[ch]->hCoreCoder[0]->total_brate = total_brate[ch]; } - for ( ; ch < num_obj; ch++ ) + for ( ; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; } @@ -685,7 +701,7 @@ ivas_error ivas_ism_metadata_dec( * Updates *----------------------------------------------------------------*/ - set_s( md_diff_flag, 1, num_obj ); + set_s( md_diff_flag, 1, nchan_ism ); update_last_metadata( *nchan_transport, hIsmMeta, md_diff_flag ); #endif @@ -976,7 +992,7 @@ void ivas_ism_metadata_sid_dec( SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ const int32_t ism_total_brate, /* i : ISms total bitrate */ const int16_t bfi, /* i : bfi flag */ - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels*/ const ISM_MODE ism_mode, /* i : ISM mode */ int16_t *flag_noisy_speech, /* o : noisy speech flag */ @@ -998,7 +1014,7 @@ void ivas_ism_metadata_sid_dec( if ( ism_total_brate == FRAME_NO_DATA ) { - ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); + ism_metadata_smooth( hIsmMeta, ism_total_brate, nchan_ism ); return; } @@ -1028,10 +1044,10 @@ void ivas_ism_metadata_sid_dec( /* number of objects was already read in ivas_ism_get_dtx_dec() */ /* update the position in the bitstream */ - st0->next_bit_pos += num_obj; + st0->next_bit_pos += nchan_ism; /* read SID metadata flag( one per object ) */ - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { md_diff_flag[ch] = get_next_indice( st0, 1 ); } @@ -1040,7 +1056,7 @@ void ivas_ism_metadata_sid_dec( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ - ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); + ivas_get_ism_sid_quan_bitbudget( nchan_ism, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); /*----------------------------------------------------------------* * Spatial parameters, loop over TCs - 1 @@ -1050,7 +1066,7 @@ void ivas_ism_metadata_sid_dec( *sce_id_dtx = 0; /* write ISM mode flag to explicitly signal number of spatial parameters */ - if ( num_obj > 2 ) + if ( nchan_ism > 2 ) { idx = get_next_indice( st0, 1 ); ism_mode_bstr = (ISM_MODE) ( idx + 1 ); @@ -1096,7 +1112,7 @@ void ivas_ism_metadata_sid_dec( * Metadata decoding and dequantization, loop over all objects *----------------------------------------------------------------*/ - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMetaData = hIsmMeta[ch]; @@ -1137,7 +1153,7 @@ void ivas_ism_metadata_sid_dec( } /* smooth the metadata evolution */ - ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); + ism_metadata_smooth( hIsmMeta, ism_total_brate, nchan_ism ); return; } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 693249b699..f772e31b4a 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -51,6 +51,10 @@ static void ivas_param_ism_dec_dequant_DOA( DIRAC_DEC_HANDLE hDirAC /* i/o: decoder DirAC handle */ +#ifdef NCHAN_ISM_PARAMETER + , + const int16_t nchan_ism /* i : number of ISM channels */ +#endif ) { int16_t i; @@ -58,10 +62,18 @@ static void ivas_param_ism_dec_dequant_DOA( hParamIsm = hDirAC->hParamIsm; +#ifdef NCHAN_ISM_PARAMETER + assert( nchan_ism <= MAX_NUM_OBJECTS ); +#else assert( hParamIsm->num_obj <= MAX_NUM_OBJECTS ); +#endif /* Get the azimuth and elevation values */ +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < nchan_ism; i++ ) +#else for ( i = 0; i < hParamIsm->num_obj; i++ ) +#endif { hDirAC->azimuth_values[i] = ism_dequant_meta( hParamIsm->azi_index[i], ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); hDirAC->elevation_values[i] = ism_dequant_meta( hParamIsm->ele_index[i], ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); @@ -157,6 +169,9 @@ static void ivas_ism_get_proto_matrix( static void ivas_param_ism_compute_mixing_matrix( +#ifdef NCHAN_ISM_PARAMETER + const int16_t nchan_ism, /* i : number of ISM channels */ +#endif DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ ISM_DTX_DATA_DEC hISMDTX, /* i : ISM DTX handle */ float Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -183,12 +198,20 @@ static void ivas_param_ism_compute_mixing_matrix( proto_matrix = hDirAC->hParamIsmRendering->proto_matrix; +#ifdef NCHAN_ISM_PARAMETER + assert( ( nchan_ism == 3 ) || ( nchan_ism == 4 ) ); +#else assert( ( hDirAC->hParamIsm->num_obj == 3 ) || ( hDirAC->hParamIsm->num_obj == 4 ) ); +#endif assert( nchan_transport == 2 ); if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) { +#ifdef NCHAN_ISM_PARAMETER + num_wave = nchan_ism; +#else num_wave = hDirAC->hParamIsm->num_obj; +#endif } else { @@ -249,7 +272,11 @@ static void ivas_param_ism_compute_mixing_matrix( { if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) { +#ifdef NCHAN_ISM_PARAMETER + direct_power[w] = ( 1.0f / nchan_ism ) * ref_power; +#else direct_power[w] = ( 1.0f / hDirAC->hParamIsm->num_obj ) * ref_power; +#endif } else { @@ -426,6 +453,9 @@ ivas_error ivas_param_ism_dec_open( output_config = st_ivas->hDecoderConfig->output_config; nchan_out = st_ivas->hDecoderConfig->nchan_out; +#ifdef NCHAN_ISM_PARAMETER + ivas_param_ism_config( hDirAC->hParamIsm, st_ivas->nchan_ism ); +#else if ( output_config == AUDIO_CONFIG_EXTERNAL ) { hDirAC->hParamIsm->num_obj = nchan_out; @@ -435,6 +465,7 @@ ivas_error ivas_param_ism_dec_open( hDirAC->hParamIsm->num_obj = MAX_NUM_OBJECTS; } ivas_param_ism_config( hDirAC->hParamIsm ); +#endif /*-----------------------------------------------------------------* * set input parameters @@ -466,7 +497,11 @@ ivas_error ivas_param_ism_dec_open( if ( output_config == AUDIO_CONFIG_EXTERNAL ) { /* nchan_out is essential for memory initialization for CLDFB Synthesis */ +#ifdef NCHAN_ISM_PARAMETER + st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->nchan_ism; +#else st_ivas->hIntSetup.nchan_out_woLFE = hDirAC->hParamIsm->num_obj; +#endif st_ivas->hIntSetup.is_loudspeaker_setup = 1; } @@ -828,7 +863,11 @@ void ivas_param_ism_dec( nchan_transport = st_ivas->nchan_transport; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { +#ifdef NCHAN_ISM_PARAMETER + nchan_out = st_ivas->nchan_ism; +#else nchan_out = st_ivas->hDirAC->hParamIsm->num_obj; +#endif nchan_out_woLFE = nchan_out; st_ivas->hDecoderConfig->nchan_out = nchan_out; } @@ -848,7 +887,11 @@ void ivas_param_ism_dec( /* De-quantization */ if ( !( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) ) { +#ifdef NCHAN_ISM_PARAMETER + ivas_param_ism_dec_dequant_DOA( hDirAC, st_ivas->nchan_ism ); +#else ivas_param_ism_dec_dequant_DOA( hDirAC ); +#endif ivas_param_ism_dec_dequant_powrat( hDirAC ); st_ivas->hISMDTX.dtx_flag = 0; } @@ -860,7 +903,11 @@ void ivas_param_ism_dec( /* obtain the direct response using EFAP */ if ( !( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) ) { +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < st_ivas->nchan_ism; i++ ) +#else for ( i = 0; i < hDirAC->hParamIsm->num_obj; i++ ) +#endif { efap_determine_gains( st_ivas->hEFAPdata, direct_response[i], hDirAC->azimuth_values[i], hDirAC->elevation_values[i], EFAP_MODE_EFAP ); } @@ -869,7 +916,11 @@ void ivas_param_ism_dec( { int16_t j; +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < st_ivas->nchan_ism; i++ ) +#else for ( i = 0; i < hDirAC->hParamIsm->num_obj; i++ ) +#endif { for ( j = 0; j < nchan_out_woLFE; j++ ) { @@ -918,7 +969,11 @@ void ivas_param_ism_dec( } /* Compute mixing matrix */ +#ifdef NCHAN_ISM_PARAMETER + ivas_param_ism_compute_mixing_matrix( st_ivas->nchan_ism, hDirAC, st_ivas->hISMDTX, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, direct_response, nchan_transport, nchan_out_woLFE, 0, CLDFB_NO_COL_MAX, mixing_matrix ); +#else ivas_param_ism_compute_mixing_matrix( hDirAC, st_ivas->hISMDTX, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, direct_response, nchan_transport, nchan_out_woLFE, 0, CLDFB_NO_COL_MAX, mixing_matrix ); +#endif /* subframe loop for synthesis*/ for ( subframe_idx = 0; subframe_idx < hDirAC->nb_subframes; subframe_idx++ ) @@ -987,7 +1042,11 @@ void ivas_param_ism_dec( ivas_param_ism_update_mixing_matrix( hDirAC, mixing_matrix, nchan_transport, nchan_out_woLFE ); /* store MetaData parameters */ +#ifdef NCHAN_ISM_PARAMETER + for ( ch = 0; ch < st_ivas->nchan_ism; ch++ ) +#else for ( ch = 0; ch < hDirAC->hParamIsm->num_obj; ch++ ) +#endif { if ( st_ivas->hDirAC->azimuth_values[ch] > 180.0f ) { @@ -1033,7 +1092,11 @@ void ivas_param_ism_params_to_masa_param_mapping( if ( !( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) ) { +#ifdef NCHAN_ISM_PARAMETER + ivas_param_ism_dec_dequant_DOA( hDirAC, st_ivas->nchan_ism ); +#else ivas_param_ism_dec_dequant_DOA( hDirAC ); +#endif ivas_param_ism_dec_dequant_powrat( hDirAC ); st_ivas->hISMDTX.dtx_flag = 0; } @@ -1042,7 +1105,11 @@ void ivas_param_ism_params_to_masa_param_mapping( st_ivas->hISMDTX.dtx_flag = 1; } +#ifdef NCHAN_ISM_PARAMETER + if ( st_ivas->nchan_ism > 1 ) +#else if ( hDirAC->hParamIsm->num_obj > 1 ) +#endif { if ( st_ivas->hISMDTX.dtx_flag ) { diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index a965a0ffed..a5bdcc4100 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -107,11 +107,15 @@ void ivas_ism_render( float tmp_output_f[MAX_OUTPUT_CHANNELS][L_FRAME48k]; float gains[MAX_NUM_OBJECTS][MAX_OUTPUT_CHANNELS]; float g1, g2; - int16_t num_objects, nchan_out_woLFE, lfe_index; + int16_t nchan_ism, nchan_out_woLFE, lfe_index; int16_t azimuth, elevation; float Rmat[3][3]; - num_objects = st_ivas->nchan_transport; +#ifdef NCHAN_ISM_PARAMETER + nchan_ism = st_ivas->nchan_ism; +#else + nchan_ism = st_ivas->nchan_transport; +#endif nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; lfe_index = 0; @@ -121,7 +125,7 @@ void ivas_ism_render( set_f( tmp_output_f[j], 0.0f, output_frame ); } - for ( i = 0; i < num_objects; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { mvr2r( output_f[i], input_f[i], output_frame ); } @@ -137,7 +141,7 @@ void ivas_ism_render( QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], Rmat ); } - for ( i = 0; i < num_objects; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { if ( st_ivas->intern_config == AUDIO_CONFIG_STEREO ) { diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index bd799f9d5f..a80986b39e 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -282,7 +282,7 @@ void ivas_ism2sba( float buffer_td[][L_FRAME48k], /* i/o: TD signal buffers */ ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ const ISM_METADATA_HANDLE hIsmMetaData[], /* i : object metadata */ - const int16_t num_objects, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t output_frame, /* i : output frame length per channel */ const int16_t sba_order /* i : Ambisonic (SBA) order */ ) @@ -304,7 +304,7 @@ void ivas_ism2sba( set_zero( buffer_tmp[j], output_frame ); } - for ( i = 0; i < num_objects; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { // TODO tmu review when #215 is resolved azimuth = (int16_t) floorf( hIsmMetaData[i]->azimuth + 0.5f ); diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 9b8cf1b2df..720fd1c9e4 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1214,6 +1214,9 @@ typedef struct Decoder_Struct LFE_DEC_HANDLE hLFE; /* LFE handle */ ISM_MODE ism_mode; /* ISM format mode */ +#ifdef NCHAN_ISM_PARAMETER + int16_t nchan_ism; /* number of ISM channels */ +#endif SBA_MODE sba_mode; /* SBA format mode */ MC_MODE mc_mode; /* MC format mode */ int16_t sba_order; /* Ambisonic (SBA) order */ diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index f7633c8a9e..23c592ea91 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -109,7 +109,7 @@ int16_t ivas_ism_dtx_enc( #ifdef FIX_DTX_BRATE_LIMIT const int32_t ivas_total_brate, /* i : IVAS total bitrate */ #endif - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ @@ -150,8 +150,8 @@ int16_t ivas_ism_dtx_enc( lp_noise[ch] = hSCE[ch]->hCoreCoder[0]->lp_noise; } - lp_noise_variation = var( lp_noise, num_obj ); - lp_noise_mean = mean( lp_noise, num_obj ); + lp_noise_variation = var( lp_noise, nchan_ism ); + lp_noise_mean = mean( lp_noise, nchan_ism ); if ( lp_noise_mean > 50 || ( lp_noise_mean > 25 && lp_noise_variation > 32 ) ) { @@ -161,12 +161,12 @@ int16_t ivas_ism_dtx_enc( #ifdef FIX_DTX_BRATE_LIMIT /* default DTX is applied at lower bitrates; otherwise DTX is applied only in silence */ - maximum( lp_noise, num_obj, &lp_noise_max ); + maximum( lp_noise, nchan_ism, &lp_noise_max ); - if ( !( ( num_obj == 1 && ivas_total_brate <= IVAS_24k4 ) || - ( num_obj == 2 && ivas_total_brate <= IVAS_48k ) || - ( num_obj == 3 && ivas_total_brate <= IVAS_80k ) || - ( num_obj == 4 && ivas_total_brate <= IVAS_96k ) || + if ( !( ( nchan_ism == 1 && ivas_total_brate <= IVAS_24k4 ) || + ( nchan_ism == 2 && ivas_total_brate <= IVAS_48k ) || + ( nchan_ism == 3 && ivas_total_brate <= IVAS_80k ) || + ( nchan_ism == 4 && ivas_total_brate <= IVAS_96k ) || lp_noise_max < 15 ) ) { dtx_flag = 0; @@ -190,10 +190,10 @@ int16_t ivas_ism_dtx_enc( if ( dtx_flag ) { - ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &tmp1, &tmp2, &nBits_coh, &nBits_sce_id ); + ivas_get_ism_sid_quan_bitbudget( nchan_ism, &nBits_azimuth, &nBits_elevation, &tmp1, &tmp2, &nBits_coh, &nBits_sce_id ); nBits = 0; - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { /* check difference between current and last metadata */ md_diff_flag[ch] = 0; @@ -230,7 +230,7 @@ int16_t ivas_ism_dtx_enc( nBits_MD_max -= nBits_coh; /* coherence */ } - if ( num_obj > 3 ) + if ( nchan_ism > 3 ) { nBits_MD_max--; /* ism_mode flag */ } diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 6c68b300ec..fa5e6115f1 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -86,7 +86,7 @@ ivas_error ivas_ism_enc( float lf_E[1][2 * VOIC_BINS]; /* per bin spectrum energy in lf */ int16_t localVAD_HE_SAD[1]; /* local HE VAD */ #ifdef DISCRETE_ISM_DTX_CNG - int16_t num_obj, dtx_flag, sid_flag, flag_noisy_speech; + int16_t nchan_ism, dtx_flag, sid_flag, flag_noisy_speech; int16_t md_diff_flag[MAX_NUM_OBJECTS]; #else int16_t dtx_flag, sid_flag, flag_noisy_speech; @@ -107,16 +107,19 @@ ivas_error ivas_ism_enc( flag_noisy_speech = 0; #ifdef DISCRETE_ISM_DTX_CNG +#ifdef NCHAN_ISM_PARAMETER + nchan_ism = st_ivas->hEncoderConfig->nchan_ism; +#else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - num_obj = st_ivas->hDirAC->hParamIsm->num_obj; + nchan_ism = st_ivas->hDirAC->hParamIsm->num_obj; } else /* ism_mode == ISM_MODE_DISC */ { - num_obj = st_ivas->nchan_transport; + nchan_ism = st_ivas->nchan_transport; } - - set_s( md_diff_flag, 1, num_obj ); +#endif + set_s( md_diff_flag, 1, nchan_ism ); #endif /*------------------------------------------------------------------* @@ -211,9 +214,9 @@ ivas_error ivas_ism_enc( /* analysis and decision about DTX */ #ifdef DISCRETE_ISM_DTX_CNG #ifdef FIX_DTX_BRATE_LIMIT - dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->hEncoderConfig->ivas_total_brate, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); + dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->hEncoderConfig->ivas_total_brate, nchan_ism, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); #else - dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); + dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, nchan_ism, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); #endif #else dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); @@ -250,7 +253,7 @@ ivas_error ivas_ism_enc( if ( dtx_flag ) { #ifdef DISCRETE_ISM_DTX_CNG - ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, flag_noisy_speech, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); + ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, flag_noisy_speech, nchan_ism, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); #else if ( sid_flag ) { @@ -260,8 +263,13 @@ ivas_error ivas_ism_enc( } else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { + // VE: call ivas_ism_metadata_enc() with 'st_ivas' - TBD #ifdef TD5 - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); + ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, +#ifdef NCHAN_ISM_PARAMETER + st_ivas->hEncoderConfig->nchan_ism, +#endif + st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #else ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); #endif @@ -269,7 +277,11 @@ ivas_error ivas_ism_enc( else /* ISM_MODE_DISC */ { #ifdef TD5 - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); + ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, +#ifdef NCHAN_ISM_PARAMETER + st_ivas->hEncoderConfig->nchan_ism, +#endif + st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #else ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL ); #endif diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 664e2270f4..e8beca67b5 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -172,7 +172,10 @@ static void rate_ism_importance( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_enc( - const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ +#ifdef NCHAN_ISM_PARAMETER + const int16_t nchan_ism, /* i : number of ISM channels */ +#endif const int16_t nchan_transport, /* i : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ @@ -208,28 +211,34 @@ ivas_error ivas_ism_metadata_enc( int32_t element_brate[MAX_NUM_OBJECTS], total_brate[MAX_NUM_OBJECTS]; int16_t ism_metadata_flag_global; int16_t ism_imp[MAX_NUM_OBJECTS]; - int16_t num_obj, nbands, nblocks; +#ifdef NCHAN_ISM_PARAMETER + int16_t nbands, nblocks; +#else + int16_t nchan_ism, nbands, nblocks; +#endif ivas_error error; error = IVAS_ERR_OK; push_wmops( "ism_meta_enc" ); +#ifndef NCHAN_ISM_PARAMETER if ( ism_mode == ISM_MODE_PARAM ) { - num_obj = hParamIsm->num_obj; + nchan_ism = hParamIsm->num_obj; } else if ( ism_mode == ISM_MODE_DISC ) { - num_obj = nchan_transport; + nchan_ism = nchan_transport; } else { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: incorrect ISM mode" ); } +#endif #ifndef DISCRETE_ISM_DTX_CNG - if ( num_obj == 1 && ( hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) && ism_mode == ISM_MODE_DISC ) + if ( nchan_ism == 1 && ( hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) && ism_mode == ISM_MODE_DISC ) { /* no metadata encoding in CNG */ pop_wmops(); @@ -241,11 +250,11 @@ ivas_error ivas_ism_metadata_enc( /* initialization */ ism_metadata_flag_global = 0; set_s( nb_bits_metadata, 0, nchan_transport ); - set_s( flag_abs_azimuth, 0, num_obj ); - set_s( flag_abs_elevation, 0, num_obj ); + set_s( flag_abs_azimuth, 0, nchan_ism ); + set_s( flag_abs_elevation, 0, nchan_ism ); #ifdef TD5 - set_s( flag_abs_azimuth_orientation, 0, num_obj ); - set_s( flag_abs_radius, 0, num_obj ); + set_s( flag_abs_azimuth_orientation, 0, nchan_ism ); + set_s( flag_abs_radius, 0, nchan_ism ); #endif @@ -253,7 +262,7 @@ ivas_error ivas_ism_metadata_enc( * Set Metadata presence / importance flag *----------------------------------------------------------------*/ - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { if ( ism_mode == ISM_MODE_PARAM ) { @@ -329,13 +338,13 @@ ivas_error ivas_ism_metadata_enc( #ifndef TUNE_360_OBJECT_WITH_NOISE /* relax the importance decision in "stereo" coding for noisy audio */ - if ( ism_mode == ISM_MODE_DISC && num_obj == 2 ) + if ( ism_mode == ISM_MODE_DISC && nchan_ism == 2 ) { float diff_F; if ( hIsmMeta[0]->ism_metadata_flag ^ hIsmMeta[1]->ism_metadata_flag ) { - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { diff_F = hSCE[ch]->hCoreCoder[0]->lp_speech - hSCE[ch]->hCoreCoder[0]->lp_noise; @@ -354,7 +363,7 @@ ivas_error ivas_ism_metadata_enc( *----------------------------------------------------------------*/ /* write number of objects - unary coding */ - for ( ch = 1; ch < num_obj; ch++ ) + for ( ch = 1; ch < nchan_ism; ch++ ) { push_indice( hBstr, IND_ISM_NUM_OBJECTS, 1, 1 ); } @@ -371,7 +380,7 @@ ivas_error ivas_ism_metadata_enc( push_indice( hBstr, IND_ISM_METADATA_FLAG, ism_imp[ch], ISM_METADATA_FLAG_BITS ); } - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; } @@ -403,7 +412,7 @@ ivas_error ivas_ism_metadata_enc( nb_bits_start = hBstr->nb_bits_tot; } - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMetaData = hIsmMeta[ch]; if ( ism_mode == ISM_MODE_DISC ) @@ -700,7 +709,7 @@ ivas_error ivas_ism_metadata_enc( *----------------------------------------------------------------*/ i = 0; - while ( i == 0 || i < num_obj / INTER_OBJECT_PARAM_CHECK ) + while ( i == 0 || i < nchan_ism / INTER_OBJECT_PARAM_CHECK ) { int16_t num, abs_num, abs_first, abs_next, pos_zero; #ifdef TD5 @@ -709,7 +718,7 @@ ivas_error ivas_ism_metadata_enc( int16_t abs_matrice[INTER_OBJECT_PARAM_CHECK * 2]; #endif - num = min( INTER_OBJECT_PARAM_CHECK, num_obj - i * INTER_OBJECT_PARAM_CHECK ); + num = min( INTER_OBJECT_PARAM_CHECK, nchan_ism - i * INTER_OBJECT_PARAM_CHECK ); i++; set_s( abs_matrice, 0, INTER_OBJECT_PARAM_CHECK * ISM_NUM_PARAM ); @@ -831,12 +840,12 @@ ivas_error ivas_ism_metadata_enc( * Configuration and decision about bitrates per channel *----------------------------------------------------------------*/ - if ( ( error = ivas_ism_config( ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_config( ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) { return error; } - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; } @@ -1292,7 +1301,7 @@ static void encode_angle_indices( void ivas_ism_metadata_sid_enc( ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ const int16_t flag_noisy_speech, /* i : noisy speech flag */ - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ const ISM_MODE ism_mode, /* i : ISM mode */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ @@ -1320,14 +1329,14 @@ void ivas_ism_metadata_sid_enc( *----------------------------------------------------------------*/ /* write number of objects - unary coding */ - for ( ch = 1; ch < num_obj; ch++ ) + for ( ch = 1; ch < nchan_ism; ch++ ) { push_indice( hBstr, IND_ISM_NUM_OBJECTS, 1, 1 ); } push_indice( hBstr, IND_ISM_NUM_OBJECTS, 0, 1 ); /* write SID metadata flag (one per object) */ - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { push_indice( hBstr, IND_ISM_METADATA_FLAG, md_diff_flag[ch], 1 ); } @@ -1336,14 +1345,14 @@ void ivas_ism_metadata_sid_enc( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ - ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); + ivas_get_ism_sid_quan_bitbudget( nchan_ism, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); /*----------------------------------------------------------------* * Spatial parameters, loop over TCs - 1 *----------------------------------------------------------------*/ /* write ISM mode flag to explicitly signal number of spatial parameters */ - if ( num_obj > 2 ) + if ( nchan_ism > 2 ) { if ( ism_mode == ISM_MODE_DISC ) { @@ -1385,7 +1394,7 @@ void ivas_ism_metadata_sid_enc( * Metadata quantization and coding, loop over all objects *----------------------------------------------------------------*/ - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { if ( md_diff_flag[ch] == 1 ) { diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index f76646fdca..16f234b839 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -47,16 +47,27 @@ static void ivas_param_ism_compute_obj_parameters( +#ifdef NCHAN_ISM_PARAMETER + const int16_t nchan_ism, /* i : number of ISM channels */ +#endif float reference_power_obj[MAX_NUM_OBJECTS][PARAM_ISM_MDFT_NO_SLOTS][DIRAC_NO_FB_BANDS_MAX], /* i : Reference power */ PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: Param ISM Enc Handle */ ) { +#ifdef NCHAN_ISM_PARAMETER + int16_t i, b, m, br, mr; +#else int16_t i, b, m, br, mr, num_obj; +#endif int16_t brange_start, brange_end, mrange_start, mrange_end, time_merge_fac; float power_ratios_m[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS]; +#ifdef NCHAN_ISM_PARAMETER + assert( nchan_ism == 3 || nchan_ism == 4 ); +#else num_obj = hParamIsm->num_obj; assert( num_obj == 3 || num_obj == 4 ); +#endif for ( b = 0; b < hParamIsm->nbands; b++ ) { @@ -81,7 +92,11 @@ static void ivas_param_ism_compute_obj_parameters( /* for each object, sum up reference power within current T/F tile */ +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < nchan_ism; i++ ) +#else for ( i = 0; i < num_obj; i++ ) +#endif { for ( mr = mrange_start; mr < mrange_end; mr++ ) { @@ -103,7 +118,12 @@ static void ivas_param_ism_compute_obj_parameters( index_1 = 1; index_2 = 0; } + +#ifdef NCHAN_ISM_PARAMETER + for ( i = 2; i < nchan_ism; i++ ) +#else for ( i = 2; i < num_obj; i++ ) +#endif { if ( ref_power_local[i] > ref_power_local[index_1] ) { @@ -149,17 +169,30 @@ static void ivas_param_ism_compute_obj_parameters( static void ivas_param_ism_enc_quantize_DOA( +#ifdef NCHAN_ISM_PARAMETER + const int16_t nchan_ism, /* i : number of ISM channels */ +#endif ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata */ PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: Param ISM encoder handle */ ) { +#ifdef NCHAN_ISM_PARAMETER + int16_t i, azi_idx, ele_idx; +#else int16_t i, azi_idx, ele_idx, num_obj; +#endif float valQ; +#ifndef NCHAN_ISM_PARAMETER num_obj = hParamIsm->num_obj; +#endif /* Loop over objects */ +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < nchan_ism; i++ ) +#else for ( i = 0; i < num_obj; i++ ) +#endif { /* Quantize the elevation and obtain quantized elevation value and index */ ele_idx = ism_quant_meta( hIsmMetaData[i]->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); @@ -191,7 +224,11 @@ void ivas_param_ism_stereo_dmx( const int16_t input_frame /* i : Length of input frame */ ) { +#ifdef NCHAN_ISM_PARAMETER + int16_t i, j; +#else int16_t i, j, num_obj; +#endif float alpha, azi_shift, tmp, tmp_1; float cardioid_left[MAX_NUM_OBJECTS], cardioid_right[MAX_NUM_OBJECTS]; float stereo_dmx[2][L_FRAME48k]; @@ -202,14 +239,20 @@ void ivas_param_ism_stereo_dmx( /*Initialization*/ alpha = 0.5; azi_shift = 0; +#ifndef NCHAN_ISM_PARAMETER num_obj = st_ivas->hDirAC->hParamIsm->num_obj; +#endif /* Set the stereo dmx to zero */ set_zero( stereo_dmx[0], L_FRAME48k ); set_zero( stereo_dmx[1], L_FRAME48k ); /* Loop over all objects */ +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < st_ivas->hEncoderConfig->nchan_ism; i++ ) +#else for ( i = 0; i < num_obj; i++ ) +#endif { hIsmMetaData = st_ivas->hIsmMetaData[i]; @@ -271,8 +314,10 @@ ivas_error ivas_param_ism_enc_open( input_Fs = st_ivas->hEncoderConfig->input_Fs; +#ifndef NCHAN_ISM_PARAMETER /* Assign the number of objects */ hDirAC->hParamIsm->num_obj = st_ivas->hEncoderConfig->nchan_inp; +#endif /* set FB config. */ if ( ( error = ivas_fb_set_cfg( &fb_cfg, ISM_FORMAT, SBA_MODE_NONE, st_ivas->hEncoderConfig->nchan_inp, 0, 0, input_Fs ) ) != IVAS_ERR_OK ) @@ -286,7 +331,11 @@ ivas_error ivas_param_ism_enc_open( return error; } +#ifdef NCHAN_ISM_PARAMETER + ivas_param_ism_config( hDirAC->hParamIsm, st_ivas->hEncoderConfig->nchan_inp ); +#else ivas_param_ism_config( hDirAC->hParamIsm ); +#endif /* Assign memories for Band and Block grouping */ hDirAC->hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; @@ -347,6 +396,9 @@ void ivas_param_ism_enc( ) { int16_t i, j, ts, l_ts; +#ifdef NCHAN_ISM_PARAMETER + int16_t nchan_ism; +#endif int16_t num_time_slots; float *pcm_in[MAX_NUM_OBJECTS]; float fb_RealBuffer[MAX_NUM_OBJECTS][DIRAC_NO_FB_BANDS_MAX]; @@ -357,6 +409,9 @@ void ivas_param_ism_enc( DIRAC_ENC_HANDLE hDirAC; PARAM_ISM_CONFIG_HANDLE hParamIsm; +#ifdef NCHAN_ISM_PARAMETER + nchan_ism = st_ivas->hEncoderConfig->nchan_ism; +#endif hDirAC = st_ivas->hDirAC; hParamIsm = hDirAC->hParamIsm; @@ -365,7 +420,11 @@ void ivas_param_ism_enc( l_ts = input_frame / PARAM_ISM_MDFT_NO_SLOTS; num_time_slots = PARAM_ISM_MDFT_NO_SLOTS; +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < nchan_ism; i++ ) +#else for ( i = 0; i < hParamIsm->num_obj; i++ ) +#endif { pcm_in[i] = &data[i][0]; @@ -374,12 +433,18 @@ void ivas_param_ism_enc( p_fb_RealBuffer[i] = &fb_RealBuffer[i][0]; p_fb_ImagBuffer[i] = &fb_ImagBuffer[i][0]; } + for ( ts = 0; ts < num_time_slots; ts++ ) { ivas_fb_mixer_get_windowed_fr( hDirAC->hFbMixer, pcm_in, p_fb_RealBuffer, p_fb_ImagBuffer, l_ts, l_ts ); + ivas_fb_mixer_update_prior_input( hDirAC->hFbMixer, pcm_in, l_ts ); +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < nchan_ism; i++ ) +#else for ( i = 0; i < hParamIsm->num_obj; i++ ) +#endif { pcm_in[i] += l_ts; for ( j = 0; j < DIRAC_NO_FB_BANDS_MAX; j++ ) @@ -388,11 +453,20 @@ void ivas_param_ism_enc( } } } + /* Quantize DOAs */ +#ifdef NCHAN_ISM_PARAMETER + ivas_param_ism_enc_quantize_DOA( nchan_ism, st_ivas->hIsmMetaData, hParamIsm ); +#else ivas_param_ism_enc_quantize_DOA( st_ivas->hIsmMetaData, hParamIsm ); +#endif /* Compute object indices and power ratios */ +#ifdef NCHAN_ISM_PARAMETER + ivas_param_ism_compute_obj_parameters( nchan_ism, reference_power_obj, hParamIsm ); +#else ivas_param_ism_compute_obj_parameters( reference_power_obj, hParamIsm ); +#endif pop_wmops(); return; diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index fc7c0b76a6..e81c967ad9 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1014,6 +1014,9 @@ typedef struct encoder_config_structure int16_t element_mode_init; /* element mode used at initialization */ int16_t stereo_dmx_evs; /* flag to indicate that stereo downmix for EVS encoder */ +#ifdef NCHAN_ISM_PARAMETER + int16_t nchan_ism; /* number of ISM channels */ +#endif int16_t sba_order; /* Ambisonic (SBA) order */ int16_t sba_planar; /* Ambisonic (SBA) planar flag */ MC_LS_SETUP mc_input_setup; /* multichannel input ls setup */ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index fbb87cf056..b249f85317 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -391,6 +391,9 @@ ivas_error IVAS_ENC_ConfigureForObjects( st_ivas->hEncoderConfig->ivas_format = ISM_FORMAT; st_ivas->hEncoderConfig->element_mode_init = IVAS_SCE; st_ivas->hEncoderConfig->nchan_inp = numObjects; +#ifdef NCHAN_ISM_PARAMETER + st_ivas->hEncoderConfig->nchan_ism = numObjects; +#endif #ifdef TD5 st_ivas->hEncoderConfig->ism_extended_metadata_flag = ism_extended_metadata; #endif @@ -2280,6 +2283,9 @@ static void init_encoder_config( hEncoderConfig->var_SID_rate_flag = 1; hEncoderConfig->mc_input_setup = MC_LS_SETUP_INVALID; hEncoderConfig->stereo_dmx_evs = 0; +#ifdef NCHAN_ISM_PARAMETER + hEncoderConfig->nchan_ism = 0; +#endif hEncoderConfig->sba_order = 0; hEncoderConfig->sba_planar = 0; #ifdef DEBUGGING -- GitLab From 8c11aaaf1c2ca3b87fbfda361e0ebd43870dea8f Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Mar 2023 11:16:39 +0100 Subject: [PATCH 281/375] issue 380 - fix metadata recovery in ParamISM BFI; under FIX_380_BFI_PARAMISM --- lib_com/options.h | 5 ++++- lib_dec/ivas_ism_metadata_dec.c | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8f87cd3fd2..395e2540a7 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -154,9 +154,12 @@ #define FIX_371_DELAY_REPORT /* Issue 371: div. by zero with -no_delay_cmp */ #ifdef FIX_I109_ORIENTATION_TRACKING -#define OTR_REFERENCE_VECTOR_TRACKING /* FhG: enables the reference position orientation tracking mode */ +#define OTR_REFERENCE_VECTOR_TRACKING /* FhG: enables the reference position orientation tracking mode */ #endif +#define FIX_380_BFI_PARAMISM /* VA: issue 380 - fix metadata recovery in ParamISM BFI */ + + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 7c8946fc43..37b01f9315 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -488,12 +488,26 @@ ivas_error ivas_ism_metadata_dec( } else /* BFI */ { +#ifdef FIX_380_BFI_PARAMISM + /* "num_obj", "hIsmMeta->azimuth" and "hIsmMeta->elevation" are recycled from the last frame */ + if ( ism_mode == ISM_MODE_PARAM ) + { + num_obj = hParamIsm->num_obj; + } + else if ( ism_mode == ISM_MODE_DISC ) + { + num_obj = *nchan_transport; + } + + for ( ch = 0; ch < num_obj; ch++ ) +#else /* "*nISms", "hIsmMeta->azimuth" and "hIsmMeta->elevation" are recycled from the last frame */ for ( ch = 0; ch < *nchan_transport; ch++ ) { hIsmMeta[ch]->ism_metadata_flag = hIsmMeta[ch]->last_ism_metadata_flag; } for ( ; ch < num_obj; ch++ ) +#endif { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; } @@ -504,12 +518,17 @@ ivas_error ivas_ism_metadata_dec( { for ( ch = 0; ch < num_obj; ch++ ) { +#ifdef FIX_380_BFI_PARAMISM + hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch] + hParamIsm->last_az_sgn[ch] * hParamIsm->last_az_diff[ch]; + hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch] + hParamIsm->last_el_sgn[ch] * hParamIsm->last_el_diff[ch]; +#else hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch] + hParamIsm->last_az_sgn[ch] * hParamIsm->last_az_diff[ch]; /*hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch] % hParamIsm->az_alpha[ch];*/ hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch]; hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch] + hParamIsm->last_el_sgn[ch] * hParamIsm->last_el_diff[ch]; /*hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch] % hParamIsm->ele_alpha;*/ hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch]; +#endif #ifdef TD5 hIsmMeta[ch]->angle[0].last_azimuth_idx = hParamIsm->azi_index[ch]; hIsmMeta[ch]->angle[0].last_elevation_idx = hParamIsm->ele_index[ch]; @@ -558,7 +577,6 @@ ivas_error ivas_ism_metadata_dec( { for ( ch = 0; ch < *nchan_transport; ch++ ) { - hSCE[ch]->element_brate = hSCE[ch]->last_element_brate; hSCE[ch]->hCoreCoder[0]->total_brate = hSCE[ch]->hCoreCoder[0]->last_total_brate; } -- GitLab From 47c0ea208b3c596a6866f15a2f16b016c5bd26e8 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Mar 2023 11:48:30 +0100 Subject: [PATCH 282/375] - rename parameter under FORCE_EST - replace constant 2 by MAX_PARAM_ISM_WAVE --- lib_dec/fd_cng_dec.c | 2 +- lib_dec/init_dec.c | 2 +- lib_dec/ivas_init_dec.c | 8 ++++++-- lib_dec/ivas_ism_dec.c | 4 ++-- lib_dec/ivas_sce_dec.c | 6 ------ lib_dec/stat_dec.h | 6 +++--- lib_enc/ivas_ism_enc.c | 2 +- lib_enc/ivas_ism_metadata_enc.c | 2 +- lib_enc/ivas_ism_param_enc.c | 4 ++-- 9 files changed, 17 insertions(+), 19 deletions(-) diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index dcbf58c1dc..9edf92f806 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -436,7 +436,7 @@ void ApplyFdCng( ( *timeDomainInput( -FLT_MAX ) && *( timeDomainInput + hFdCngCom->frameSize - 1 ) < FLT_MAX && *( timeDomainInput + hFdCngCom->frameSize - 1 ) > ( -FLT_MAX ) ) ) && - ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && hFdCngDec->flag_dtx_mode ) || !st->VAD || ( st->ini_frame < 100 && st->is_ism_mode ) ) && + ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && hFdCngDec->flag_dtx_mode ) || !st->VAD || ( st->ini_frame < 100 && st->is_ism_format ) ) && !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || ( st->element_mode == IVAS_CPE_TD ) ) && ( !st->BER_detect ) ) diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index ff96a8e324..0e9c3c2e50 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -741,7 +741,7 @@ ivas_error init_decoder( st->cng_ism_flag = 0; st->read_sid_info = 1; /* by default read the sid info from bitstream */ #ifdef FORCE_EST - st->is_ism_mode = 0; + st->is_ism_format = 0; #endif diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index cec550028d..188c946323 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -862,8 +862,8 @@ ivas_error ivas_init_decoder( if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - st_ivas->nchan_transport = 2; - st_ivas->nSCE = 2; + st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; + st_ivas->nSCE = MAX_PARAM_ISM_WAVE; if ( ( error = ivas_param_ism_dec_open( st_ivas ) ) != IVAS_ERR_OK ) { @@ -884,6 +884,10 @@ ivas_error ivas_init_decoder( } reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); + +#ifdef FORCE_EST + st_ivas->hSCE[sce_id]->hCoreCoder[0]->is_ism_format = 1; +#endif } if ( st_ivas->ism_mode == ISM_MODE_PARAM ) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index e73cde5d54..31ddc89ccf 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -302,7 +302,7 @@ ivas_error ivas_ism_dec_config( #endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - st_ivas->nchan_transport = 2; + st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { #ifdef NCHAN_ISM_PARAMETER @@ -344,7 +344,7 @@ ivas_error ivas_ism_dec_config( #endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - st_ivas->nchan_transport = 2; + st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { #ifdef NCHAN_ISM_PARAMETER diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index fb0548b0d5..47ee06d466 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -364,12 +364,6 @@ ivas_error create_sce_dec( { return error; } -#ifdef FORCE_EST - if ( st_ivas->ivas_format == ISM_FORMAT ) - { - st->is_ism_mode = 1; - } -#endif if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) { diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 9285e6efb6..5563bfd7f7 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1345,10 +1345,10 @@ typedef struct Decoder_State /* MCT Channel mode indication: LFE, ignore channel? */ MCT_CHAN_MODE mct_chan_mode; - int16_t cng_ism_flag; /* CNG in Param-ISM flag */ - int16_t read_sid_info; /* For ParamISM, use the transmitted noise */ + int16_t cng_ism_flag; /* CNG in Param-ISM flag */ + int16_t read_sid_info; /* For ParamISM, use the transmitted noise */ #ifdef FORCE_EST - int16_t is_ism_mode; /* Indicator if codec operates in ISM mode */ + int16_t is_ism_format; /* Indication whether the codec operates in ISM format */ #endif } Decoder_State, *DEC_CORE_HANDLE; diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index fa5e6115f1..57fdb7631e 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -466,7 +466,7 @@ ivas_error ivas_ism_enc_config( /* Reset and Initialize */ if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - st_ivas->nchan_transport = 2; + st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; } else { diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index e8beca67b5..e534bf0704 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -893,7 +893,7 @@ ivas_error ivas_ism_metadata_enc_create( if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - nchan_transport = 2; + nchan_transport = MAX_PARAM_ISM_WAVE; } else { diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index 16f234b839..998c24e691 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -120,9 +120,9 @@ static void ivas_param_ism_compute_obj_parameters( } #ifdef NCHAN_ISM_PARAMETER - for ( i = 2; i < nchan_ism; i++ ) + for ( i = MAX_PARAM_ISM_WAVE; i < nchan_ism; i++ ) #else - for ( i = 2; i < num_obj; i++ ) + for ( i = MAX_PARAM_ISM_WAVE; i < num_obj; i++ ) #endif { if ( ref_power_local[i] > ref_power_local[index_1] ) -- GitLab From cba58af85d4c232e9bcbf337cdb099c915fc368a Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Mar 2023 12:22:13 +0100 Subject: [PATCH 283/375] apply decoder MD smoothing in paramISM also for objects 3 and 4; under FIX_MD_SMOOTH_PARAMISM --- lib_com/options.h | 1 + lib_dec/ivas_ism_dtx_dec.c | 4 ++++ lib_dec/ivas_ism_metadata_dec.c | 4 ++++ lib_enc/ivas_ism_enc.c | 8 ++++++-- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index d9eec46fce..42ed47d1d6 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,6 +160,7 @@ #define FIX_DTX_BRATE_LIMIT /* VA: limit the DTX usage in background noise to lower bitrates similarly as in other IVAS formats */ #ifdef DISCRETE_ISM_DTX_CNG #define FORCE_EST /* FhG: force ACELP noise estimation in ISM mode for first 100 frames to prevent all-zero CNG */ +#define FIX_MD_SMOOTH_PARAMISM /* VA: apply decoder MD smoothing in paramISM also for objects 3 and 4 */ #endif #define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index cb4d1752d2..40669be913 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -229,7 +229,11 @@ ivas_error ivas_ism_dtx_dec( } } +#ifdef FIX_MD_SMOOTH_PARAMISM + update_last_metadata( nchan_ism, st_ivas->hIsmMetaData, md_diff_flag ); +#else update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); +#endif st_ivas->hISMDTX.ism_dtx_hangover_cnt = 0; #endif diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index e636cecc1b..50594d44ff 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -702,7 +702,11 @@ ivas_error ivas_ism_metadata_dec( *----------------------------------------------------------------*/ set_s( md_diff_flag, 1, nchan_ism ); +#ifdef FIX_MD_SMOOTH_PARAMISM + update_last_metadata( nchan_ism, hIsmMeta, md_diff_flag ); +#else update_last_metadata( *nchan_transport, hIsmMeta, md_diff_flag ); +#endif #endif for ( ch = 0; ch < *nchan_transport; ch++ ) diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 57fdb7631e..f887517f9c 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -267,7 +267,7 @@ ivas_error ivas_ism_enc( #ifdef TD5 ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, #ifdef NCHAN_ISM_PARAMETER - st_ivas->hEncoderConfig->nchan_ism, + nchan_ism, #endif st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #else @@ -279,7 +279,7 @@ ivas_error ivas_ism_enc( #ifdef TD5 ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, #ifdef NCHAN_ISM_PARAMETER - st_ivas->hEncoderConfig->nchan_ism, + nchan_ism, #endif st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #else @@ -288,7 +288,11 @@ ivas_error ivas_ism_enc( } #ifdef DISCRETE_ISM_DTX_CNG +#ifdef FIX_MD_SMOOTH_PARAMISM + update_last_metadata( nchan_ism, st_ivas->hIsmMetaData, md_diff_flag ); +#else update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); +#endif #endif /*----------------------------------------------------------------* -- GitLab From 4d437be201a367701673c85744146df4e02cfb6c Mon Sep 17 00:00:00 2001 From: malenov Date: Tue, 21 Mar 2023 12:30:57 +0100 Subject: [PATCH 284/375] do not count data ROM of ivas_rom_binaural_crend_head.c --- lib_rend/ivas_rom_binaural_crend_head.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_rend/ivas_rom_binaural_crend_head.c b/lib_rend/ivas_rom_binaural_crend_head.c index a57d780378..56a9a9ef53 100644 --- a/lib_rend/ivas_rom_binaural_crend_head.c +++ b/lib_rend/ivas_rom_binaural_crend_head.c @@ -47,6 +47,7 @@ #include "cnst.h" #include "ivas_cnst.h" +#define WMC_TOOL_SKIP /********************** CRendBin_Combined_HRIR **********************/ #ifdef FIX_BINAURAL_DELAY_PRECISION @@ -6923,3 +6924,4 @@ const float CRendBin_Combined_BRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS][252 0.050578f, 0.012222f, 0.020049f, -0.020057f, -0.032135f, -0.002553f, -0.037541f, -0.023567f, -0.008392f, -0.012215f, 0.001644f, -0.001142f, 0.000540f, 0.001404f, -0.027979f, -0.022362f, -0.012091f, -0.022963f, 0.009075f, 0.010977f, -0.007069f, -0.000183f, -0.022228f, -0.001348f, 0.006548f, -0.003034f} }; +#undef WMC_TOOL_SKIP -- GitLab From aa6aa774ba98e154c277b9aa33a28d858a0421e3 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Mar 2023 13:32:57 +0100 Subject: [PATCH 285/375] rename remaining comments 'ISm' -> 'ISM' --- apps/decoder.c | 2 +- apps/encoder.c | 2 +- apps/renderer.c | 2 +- lib_com/ivas_cnst.h | 6 +++--- lib_com/ivas_ism_com.c | 32 ++++++++++++++++-------------- lib_com/ivas_prot.h | 8 ++++---- lib_com/ivas_stat_com.h | 2 +- lib_dec/ivas_decision_matrix_dec.c | 4 ++-- lib_dec/ivas_init_dec.c | 2 +- lib_dec/ivas_ism_metadata_dec.c | 14 ++++++------- lib_dec/ivas_sce_dec.c | 2 +- lib_dec/lib_dec.c | 5 ++--- lib_dec/lib_dec.h | 5 ++--- lib_enc/ivas_decision_matrix_enc.c | 4 ++-- lib_enc/ivas_init_enc.c | 2 +- lib_enc/ivas_ism_metadata_enc.c | 14 ++++++------- lib_enc/lib_enc.c | 4 ++-- lib_rend/ivas_objectRenderer.c | 12 +++++------ lib_rend/ivas_prot_rend.h | 8 ++++---- lib_rend/ivas_rom_rend.c | 2 +- lib_rend/ivas_stat_rend.h | 2 +- lib_util/ism_file_reader.c | 2 +- lib_util/ism_file_writer.c | 2 +- lib_util/ism_file_writer.h | 2 +- 24 files changed, 69 insertions(+), 71 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 9c4329f32f..cdfa57ff0b 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1714,7 +1714,7 @@ static ivas_error decodeG192( } } - /* Write ISm metadata to external file(s) */ + /* Write ISM metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) diff --git a/apps/encoder.c b/apps/encoder.c index 17cec67a34..ff6f461838 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -706,7 +706,7 @@ int main( } #endif - /* Read ISm input metadata */ + /* Read ISM input metadata */ for ( i = 0; i < numIsmInputs; ++i ) { if ( ismReaders[i] == NULL ) diff --git a/apps/renderer.c b/apps/renderer.c index 9a3986a77c..5e8ca98e9c 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1918,7 +1918,7 @@ void getMetadataFromFileReader( if ( ( error = IsmFileReader_readNextFrame( ismReader, &ismMetadata ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nError (%s) while reading ism metadata from: %s\n\n", ivas_error_to_string( error ), IsmFileReader_getFilePath( ismReader ) ); + fprintf( stderr, "\nError (%s) while reading ISM metadata from: %s\n\n", ivas_error_to_string( error ), IsmFileReader_getFilePath( ismReader ) ); exit( -1 ); } diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index a1716d0741..60c9b7fdc7 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -293,7 +293,7 @@ typedef enum /*----------------------------------------------------------------------------------* - * ISm Constants + * ISM Constants *----------------------------------------------------------------------------------*/ #define ISM_NB_BITS_METADATA_NOMINAL ( ( SCE_CORE_16k_LOW_LIMIT - ACELP_16k_LOW_LIMIT ) / FRAMES_PER_SEC ) /* nominal number of metadata bits - used for configuration of Core-Coder modules */ @@ -353,13 +353,13 @@ typedef enum } ISM_MODE; -/* ISm metadata bitstream */ +/* ISM metadata bitstream */ enum { IND_ISM_NUM_OBJECTS, #ifdef TD5 IND_ISM_EXTENDED_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS, - IND_ISM_METADATA_FLAG = IND_ISM_EXTENDED_FLAG + MAX_NUM_OBJECTS, /* EN2VE: Is this not supposed to be in the loop part below, since it is one per ISm? */ + IND_ISM_METADATA_FLAG = IND_ISM_EXTENDED_FLAG + MAX_NUM_OBJECTS, /* EN2VE: Is this not supposed to be in the loop part below, since it is one per ISM? */ #else IND_ISM_METADATA_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS, #endif diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index 078cc053b5..f8eaa8d05f 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -51,7 +51,7 @@ #define FRMS_PER_SECOND ( 1000000000 / FRAME_SIZE_NS ) -#define BRATE_ISM_INACTIVE 2450 /* CoreCoder bitrate in ISm inactive frames */ +#define BRATE_ISM_INACTIVE 2450 /* CoreCoder bitrate in ISM inactive frames */ #define BITS_ISM_INACTIVE ( BRATE_ISM_INACTIVE / FRMS_PER_SECOND ) #define BETA_ISM_LOW_IMP 0.6f @@ -88,15 +88,15 @@ static void bitbudget_to_brate( *-------------------------------------------------------------------*/ ivas_error ivas_ism_config( - const int32_t ism_total_brate, /* i : ISms total bitrate */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t num_obj, /* i : number of objects */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - const int16_t localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ - const int16_t ism_imp[], /* i : ISM importance flags */ - int32_t element_brate[], /* o : element bitrate per object */ - int32_t total_brate[], /* o : total bitrate per object */ - int16_t nb_bits_metadata[] /* i/o: number of metadata bits */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t num_obj, /* i : number of objects */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ + const int16_t ism_imp[], /* i : ISM importance flags */ + int32_t element_brate[], /* o : element bitrate per object */ + int32_t total_brate[], /* o : total bitrate per object */ + int16_t nb_bits_metadata[] /* i/o: number of metadata bits */ ) { int16_t ch; @@ -129,7 +129,7 @@ ivas_error ivas_ism_config( bits_element[n_ISms - 1] += bits_ism % n_ISms; bitbudget_to_brate( bits_element, element_brate, n_ISms ); - /* count ISm common signaling bits */ + /* count ISM common signaling bits */ if ( hIsmMeta != NULL ) { #ifdef TD5 @@ -296,7 +296,7 @@ ivas_error ivas_ism_config( #ifdef DEBUGGING if ( bits_CoreCoder[ch] == SID_2k40 / FRAMES_PER_SEC ) { - printf( "\nWarning: ISm bitbudget equal to SID!\n" ); + printf( "\nWarning: ISM bitbudget equal to SID!\n" ); } #endif break; @@ -315,7 +315,7 @@ ivas_error ivas_ism_config( tmpL = sum_l( total_brate, n_ISms ) + bits_side * FRMS_PER_SECOND; if ( sum_l( element_brate, n_ISms ) != tmpL ) { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\nError: Mismatch in ISm bit-budget distribution. Exiting!\n" ); + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\nError: Mismatch in ISM bit-budget distribution. Exiting!\n" ); } } #endif @@ -327,7 +327,7 @@ ivas_error ivas_ism_config( /*-------------------------------------------------------------------* * ivas_ism_reset_metadata() * - * Reset ISm metadata parameters + * Reset ISM metadata parameters *-------------------------------------------------------------------*/ void ivas_ism_reset_metadata( @@ -345,10 +345,11 @@ void ivas_ism_reset_metadata( return; } + /*-------------------------------------------------------------------* * ivas_ism_reset_metadata_API() * - * Reset ISm metadata parameters + * Reset ISM metadata parameters *-------------------------------------------------------------------*/ void ivas_ism_reset_metadata_API( @@ -361,6 +362,7 @@ void ivas_ism_reset_metadata_API( return; } + /*-------------------------------------------------------------------* * ism_quant_meta() * diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c981f51c2c..bdbdf847eb 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -739,11 +739,11 @@ void dtx_read_padding_bits( /*----------------------------------------------------------------------------------* - * ISm prototypes + * ISM prototypes *----------------------------------------------------------------------------------*/ ivas_error ivas_ism_config( - const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ const int16_t num_trans_ch, /* i : number of trans channels */ const int16_t num_obj, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ @@ -810,7 +810,7 @@ ivas_error ivas_ism_enc( ); ivas_error ivas_ism_metadata_enc( - const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ const int16_t nchan_transport, /* i : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ @@ -827,7 +827,7 @@ ivas_error ivas_ism_metadata_enc( ); ivas_error ivas_ism_metadata_dec( - const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ int16_t *nchan_transport, /* o : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 5a45575b0a..7e3326af23 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -41,7 +41,7 @@ /*----------------------------------------------------------------------------------* - * Declaration of ISm common (encoder & decoder) structure + * Declaration of ISM common (encoder & decoder) structure *----------------------------------------------------------------------------------*/ #ifdef TD5 diff --git a/lib_dec/ivas_decision_matrix_dec.c b/lib_dec/ivas_decision_matrix_dec.c index 2a99953d23..e5be65ae24 100644 --- a/lib_dec/ivas_decision_matrix_dec.c +++ b/lib_dec/ivas_decision_matrix_dec.c @@ -134,7 +134,7 @@ void ivas_decision_matrix_dec( } else if ( st->element_mode == IVAS_SCE && st->low_rate_mode ) { - /* ISm Low-rate mode -> always WB, ACELP core, IC coder_type */ + /* ISM Low-rate mode -> always WB, ACELP core, IC coder_type */ st->core = ACELP_CORE; } else if ( st->element_mode == IVAS_CPE_MDCT ) @@ -167,7 +167,7 @@ void ivas_decision_matrix_dec( { if ( st->element_mode == IVAS_SCE && st->low_rate_mode ) { - /* ISm Low-rate mode */ + /* ISM Low-rate mode */ st->bwidth = WB; st->coder_type = INACTIVE; *sharpFlag = 0; diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index c57b33e6d2..aeddb3b1b0 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2038,7 +2038,7 @@ static ivas_error doSanityChecks_IVAS( /* Verify ISM output configuration */ if ( output_config == AUDIO_CONFIG_INVALID ) { - return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for ISm" ); + return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for ISM" ); } } else if ( st_ivas->ivas_format == SBA_FORMAT ) diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 372fa15248..49161c5d44 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -56,11 +56,11 @@ static int16_t decode_radius( DEC_CORE_HANDLE st0, int16_t *last_radius_idx, int /*-------------------------------------------------------------------------* * ivas_ism_metadata_dec() * - * decode and dequantize ISm metadata + * decode and dequantize ISM metadata *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_dec( - const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ int16_t *nchan_transport, /* o : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ @@ -148,7 +148,7 @@ ivas_error ivas_ism_metadata_dec( if ( !bfi ) { /*----------------------------------------------------------------* - * Read ISm common signaling + * Read ISM common signaling *----------------------------------------------------------------*/ /* read number of objects */ @@ -183,7 +183,7 @@ ivas_error ivas_ism_metadata_dec( } #endif - /* Read ISm present flags (one per object) */ + /* Read ISM present flags (one per object) */ for ( ch = 0; ch < *nchan_transport; ch++ ) { ism_imp[ch] = get_next_indice( st0, ISM_METADATA_FLAG_BITS ); @@ -575,7 +575,7 @@ ivas_error ivas_ism_metadata_dec( st0->bit_stream = bstr_orig; st0->next_bit_pos = next_bit_pos_orig; - /* set bitstream pointers for each ISm */ + /* set bitstream pointers for each ISM */ for ( ch = 1; ch < *nchan_transport; ch++ ) { hSCE[ch]->hCoreCoder[0]->bit_stream = hSCE[ch - 1]->hCoreCoder[0]->bit_stream + ( hSCE[ch - 1]->hCoreCoder[0]->total_brate / FRAMES_PER_SEC ); @@ -607,12 +607,12 @@ ivas_error ivas_ism_metadata_dec_create( int16_t ch; ivas_error error; - /* allocate ISm metadata handles */ + /* allocate ISM metadata handles */ for ( ch = 0; ch < MAX_NUM_OBJECTS; ch++ ) { if ( ( st_ivas->hIsmMetaData[ch] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISM MetaData\n" ) ); } st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0; diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 228a6e7b3a..87a7659992 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -114,7 +114,7 @@ ivas_error ivas_sce_dec( { if ( st->low_rate_mode ) { - /* ISm Low-rate mode -> always WB */ + /* ISM Low-rate mode -> always WB */ st->bwidth = WB; } else if ( hSCE->element_brate < MIN_BRATE_SWB_SCE ) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 3dd712b934..61c9494e30 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -387,9 +387,8 @@ ivas_error IVAS_DEC_Configure( const IVAS_DEC_AUDIO_CONFIG outputFormat, /* i : output format */ const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ - const int16_t enableHeadRotation /* i : enable head rotation for binaural output */ - , - const int16_t renderConfigEnabled /* i : enable Renderer config. file for binaural output */ + const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ + const int16_t renderConfigEnabled /* i : enable Renderer config. file for binaural output */ ) { Decoder_Struct *st_ivas; diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 0e7d8042d8..a717e0002e 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -129,9 +129,8 @@ ivas_error IVAS_DEC_Configure( const IVAS_DEC_AUDIO_CONFIG outputFormat, /* i : output format */ const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ - const int16_t enableHeadRotation /* i : enable head rotation for binaural output */ - ,const int16_t renderConfigEnabled /* i : enable Renderer config. file for binaural output */ - + const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ + const int16_t renderConfigEnabled /* i : enable Renderer config. file for binaural output */ ); void IVAS_DEC_Close( diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index 7b4685251f..b894932958 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -114,7 +114,7 @@ void ivas_decision_matrix_enc( if ( st->element_mode == IVAS_SCE && st->low_rate_mode ) { - /* ISm low-rate mode */ + /* ISM low-rate mode */ st->core = ACELP_CORE; st->coder_type = INACTIVE; } @@ -391,7 +391,7 @@ void ivas_signaling_enc( } else if ( st->element_mode == IVAS_SCE && st->low_rate_mode ) { - /* ISm Low-rate mode -> do nothing -> always WB, ACELP core, IC coder_type */ + /* ISM Low-rate mode -> do nothing -> always WB, ACELP core, IC coder_type */ } else if ( ( st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 ) || st->core_brate <= SID_2k40 ) { diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 80f58bd99f..83161e761f 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -266,7 +266,7 @@ void ivas_initialize_handles_enc( st_ivas->mem_hp20_in = NULL; - /* ISm metadata handles */ + /* ISM metadata handles */ for ( i = 0; i < MAX_NUM_OBJECTS; i++ ) { st_ivas->hIsmMetaData[i] = NULL; diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 33ba03a907..7ce4132321 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -119,7 +119,7 @@ ivas_error ivas_set_ism_metadata( /*-------------------------------------------------------------------------* * rate_ism_importance() * - * Rate importance of particular ISm streams + * Rate importance of particular ISM streams *-------------------------------------------------------------------------*/ static void rate_ism_importance( @@ -176,7 +176,7 @@ static void rate_ism_importance( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_enc( - const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ const int16_t nchan_transport, /* i : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ @@ -319,7 +319,7 @@ ivas_error ivas_ism_metadata_enc( } /*----------------------------------------------------------------* - * Rate importance of particular ISm streams + * Rate importance of particular ISM streams *----------------------------------------------------------------*/ rate_ism_importance( nchan_transport, hIsmMeta, hSCE, ism_imp ); @@ -346,7 +346,7 @@ ivas_error ivas_ism_metadata_enc( } #endif /*----------------------------------------------------------------* - * Write ISm common signaling + * Write ISM common signaling *----------------------------------------------------------------*/ /* write number of objects - unary coding */ @@ -364,7 +364,7 @@ ivas_error ivas_ism_metadata_enc( } #endif - /* write ISm metadata flag (one per object) */ + /* write ISM metadata flag (one per object) */ for ( ch = 0; ch < nchan_transport; ch++ ) { push_indice( hBstr, IND_ISM_METADATA_FLAG, ism_imp[ch], ISM_METADATA_FLAG_BITS ); @@ -899,12 +899,12 @@ ivas_error ivas_ism_metadata_enc_create( st_ivas->nSCE = nchan_transport; st_ivas->nCPE = 0; - /* allocate ISm metadata handles */ + /* allocate ISM metadata handles */ for ( ch = 0; ch < n_ISms; ch++ ) { if ( ( st_ivas->hIsmMetaData[ch] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISM MetaData\n" ) ); } #ifdef TD5 diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index a2ea72e9a6..a7b252c9d8 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -1537,11 +1537,11 @@ static ivas_error printConfigInfo_enc( { if ( hEncoderConfig->ivas_total_brate <= ACELP_32k && hEncoderConfig->nchan_inp > 2 ) { - fprintf( stdout, "IVAS format: Param-ISm (%i streams)\n", hEncoderConfig->nchan_inp ); + fprintf( stdout, "IVAS format: Param-ISM (%i streams)\n", hEncoderConfig->nchan_inp ); } else { - fprintf( stdout, "IVAS format: ISm (%i streams)\n", hEncoderConfig->nchan_inp ); + fprintf( stdout, "IVAS format: ISM (%i streams)\n", hEncoderConfig->nchan_inp ); } } else if ( hEncoderConfig->ivas_format == SBA_FORMAT ) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 270da74b5c..0c1b219fe5 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -65,7 +65,7 @@ ivas_error ivas_td_binaural_open_unwrap( const IVAS_FORMAT ivas_format, /* i : IVAS format (ISM/MC) */ const AUDIO_CONFIG transport_config, /* i : Transport configuration */ #ifdef TD5 - const float *directivity, /* i : Directivity pattern (used for ISm) */ + const float *directivity, /* i : Directivity pattern (used for ISM) */ #endif const IVAS_OUTPUT_SETUP hTransSetup, /* i : Loudspeaker layout */ BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, /* o : TD renderer handle */ @@ -267,10 +267,10 @@ void ivas_td_binaural_close( *---------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer_unwrap( - REVERB_HANDLE hReverb, /* i : reverb handle */ + REVERB_HANDLE hReverb, /* i : reverb handle */ AUDIO_CONFIG transport_config, /* i : Transport configuration */ BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ - const int16_t nchan_transport, /* i : Transport channels (ISms) */ + const int16_t nchan_transport, /* i : Transport channels (ISMs) */ const int16_t lfe_idx, /* i : LFE channel index */ IVAS_FORMAT ivas_format, /* i : IVAS format */ ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ @@ -304,9 +304,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( if ( ( hReverb != NULL ) && ( hReverb->pConfig.roomAcoustics.late_reverb_on ) ) { - if ( ( error = ivas_reverb_process( - hReverb, - transport_config, 0, output, reverb_signal, subframe_idx ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_process( hReverb, transport_config, 0, output, reverb_signal, subframe_idx ) ) != IVAS_ERR_OK ) { return error; } @@ -339,7 +337,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( ivas_error TDREND_GetMix( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - float output[][L_FRAME48k], /* i/o: ISm object synth / rendered output in 0,1 */ + float output[][L_FRAME48k], /* i/o: ISM object synth / rendered output in 0,1 */ const int16_t subframe_length, /* i/o: subframe length */ const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ ) diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 33359eee8c..7fe1a4858f 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -212,10 +212,10 @@ void ivas_HRTF_CRend_binary_close( *----------------------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer_unwrap( - REVERB_HANDLE hReverb, /* i : reverb handle */ + REVERB_HANDLE hReverb, /* i : reverb handle */ AUDIO_CONFIG transport_config, /* i : Transport configuration */ BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ - const int16_t nchan_transport, /* i : Transport channels (ISms) */ + const int16_t nchan_transport, /* i : Transport channels (ISMs) */ const int16_t lfe_idx, /* i : LFE channel index */ IVAS_FORMAT ivas_format, /* i : IVAS format */ ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ @@ -246,7 +246,7 @@ ivas_error ivas_td_binaural_open_unwrap( const IVAS_FORMAT ivas_format, /* i : IVAS format (ISM/MC) */ const AUDIO_CONFIG transport_config, /* i : Transport configuration */ #ifdef TD5 - const float *directivity, /* i : Directivity pattern (used for ISm) */ + const float *directivity, /* i : Directivity pattern (used for ISM) */ #endif const IVAS_OUTPUT_SETUP hTransSetup, /* i : Loudspeaker layout */ BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, /* o : TD renderer handle */ @@ -270,7 +270,7 @@ void ivas_td_binaural_close( ivas_error TDREND_GetMix( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - float output[][L_FRAME48k], /* i/o: ISm object synth / rendered output in 0,1 */ + float output[][L_FRAME48k], /* i/o: ISM object synth / rendered output in 0,1 */ const int16_t subframe_length, /* i/o: subframe length */ const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ ); diff --git a/lib_rend/ivas_rom_rend.c b/lib_rend/ivas_rom_rend.c index 0dfdaf0d28..dd8ca99d80 100644 --- a/lib_rend/ivas_rom_rend.c +++ b/lib_rend/ivas_rom_rend.c @@ -104,7 +104,7 @@ const float diffuseFieldCoherenceDifferenceZ[BINAURAL_COHERENCE_DIFFERENCE_BINS] /*----------------------------------------------------------------------------------* - * TD ISm binaural renderer ROM tables + * TD ISM binaural renderer ROM tables *----------------------------------------------------------------------------------*/ const int16_t HRTF_MODEL_N_CPTS_VAR[HRTF_MODEL_N_SECTIONS] = diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 96deb7dc37..13c6084b2d 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -419,7 +419,7 @@ typedef struct ivas_reverb_state_t /*----------------------------------------------------------------------------------* - * TD ISm Object Renderer structure + * TD ISM Object Renderer structure *----------------------------------------------------------------------------------*/ typedef struct diff --git a/lib_util/ism_file_reader.c b/lib_util/ism_file_reader.c index d25686fd1d..d60a7c1984 100644 --- a/lib_util/ism_file_reader.c +++ b/lib_util/ism_file_reader.c @@ -59,7 +59,7 @@ struct IsmFileReader *---------------------------------------------------------------------*/ IsmFileReader *IsmFileReader_open( - const char *filePath /* i : path to ism metadata file */ + const char *filePath /* i : path to ISM metadata file */ ) { IsmFileReader *self; diff --git a/lib_util/ism_file_writer.c b/lib_util/ism_file_writer.c index 7c9227a65c..870cf33586 100644 --- a/lib_util/ism_file_writer.c +++ b/lib_util/ism_file_writer.c @@ -56,7 +56,7 @@ struct IsmFileWriter /*! r: error code */ ivas_error IsmFileWriter_open( const char *filePathWav, /* i : path to output file */ - const int16_t obj_num, /* i : ISm number */ + const int16_t obj_num, /* i : number of ISM channels */ IsmFileWriter **ismWriter /* o : IsmFileWriter handle */ ) { diff --git a/lib_util/ism_file_writer.h b/lib_util/ism_file_writer.h index 24b4c58bd4..d9f731e87e 100644 --- a/lib_util/ism_file_writer.h +++ b/lib_util/ism_file_writer.h @@ -43,7 +43,7 @@ typedef struct IsmFileWriter IsmFileWriter; /*! r: error code */ ivas_error IsmFileWriter_open( const char *filePathWav, /* i : path to output file */ - const int16_t obj_num, /* i : ISm number */ + const int16_t obj_num, /* i : number of ISM channels */ IsmFileWriter **ismWriter /* o : IsmFileReader handle */ ); -- GitLab From afad5e2e9dbe01d95c603136b839ab82f14e3a53 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Tue, 21 Mar 2023 13:58:36 +0100 Subject: [PATCH 286/375] fix issue 373: MSAN error in decoding MASA to EXT. issue caused by missing init at lower sampling rates --- lib_com/ivas_cnst.h | 3 +++ lib_com/ivas_masa_com.c | 26 ++++++++++++++++++++++++++ lib_com/ivas_prot.h | 3 +++ lib_com/options.h | 1 + lib_dec/ivas_masa_dec.c | 12 ++++++++++++ lib_enc/ivas_masa_enc.c | 4 ++++ lib_util/masa_file_writer.c | 2 ++ 7 files changed, 51 insertions(+) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index a1716d0741..905972e44e 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -942,6 +942,9 @@ typedef enum #ifdef FIX_350_MASA_DELAY_COMP #define DELAY_MASA_PARAM_DEC_SFR 2 /* Delay to be compensation for MASA parameters in the decoder (subframes) */ +#ifdef FIX_373_MASA_DELAY_COMP_MSAN +#define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 ) /* Spherical index corresponding to front direction for setting as default value */ +#endif #endif #define DIRAC_SLOT_NS 1250000L /* time duration of a time slot, 1.25ms (==DELAY_RENERER_NS/MAX_PARAM_SPATIAL_SUBFRAMES) */ diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 86f7676378..bd0336ad43 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -314,6 +314,10 @@ void masa_sample_rate_band_correction( int16_t *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ const int32_t sampling_rate /* i : Sampling rate */ +#ifdef FIX_373_MASA_DELAY_COMP_MSAN + , + MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ +#endif ) { uint8_t band, sf; @@ -386,6 +390,28 @@ void masa_sample_rate_band_correction( hQMetaData->twoDirBands[band] = 0; } } +#ifdef FIX_373_MASA_DELAY_COMP_MSAN + if ( hExtOutMeta != NULL ) + { + /* in decoder, zero the EXT out MASA meta buffer */ + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + for ( band = config->numCodingBands; band < MASA_FREQUENCY_BANDS; band++ ) + { + hExtOutMeta->directionIndex[0][sf][band] = SPH_IDX_FRONT; + hExtOutMeta->directToTotalRatio[0][sf][band] = 0u; + hExtOutMeta->spreadCoherence[0][sf][band] = 0u; + + hExtOutMeta->directionIndex[1][sf][band] = SPH_IDX_FRONT; + hExtOutMeta->directToTotalRatio[1][sf][band] = 0u; + hExtOutMeta->spreadCoherence[1][sf][band] = 0u; + + hExtOutMeta->surroundCoherence[sf][band] = 0u; + hExtOutMeta->diffuseToTotalRatio[sf][band] = UINT8_MAX; + } + } + } +#endif return; } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index a0506e7473..dccf26abd2 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4534,6 +4534,9 @@ void masa_sample_rate_band_correction( int16_t *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ const int32_t sampling_rate /* i : sampling rate */ +#ifdef FIX_373_MASA_DELAY_COMP_MSAN + , MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ +#endif ); void invdct4_transform( diff --git a/lib_com/options.h b/lib_com/options.h index 8f87cd3fd2..219f2c1935 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -152,6 +152,7 @@ #define TD5 /* Eri: Contribution 17: Extended metadata for 6 DoF rendering in TD renderer */ #define TD5_FIX_INVALID_MEMORY_ACCESS /* FhG: Resolves segfault in case IVAS_REND_InitConfig gets initialized with rendererConfigEnabled:=false && ISM are being rendered */ #define FIX_371_DELAY_REPORT /* Issue 371: div. by zero with -no_delay_cmp */ +#define FIX_373_MASA_DELAY_COMP_MSAN /* Nokia: Issue 373: MASA audio/meta delay compensation. MSAN bugfix */ #ifdef FIX_I109_ORIENTATION_TRACKING #define OTR_REFERENCE_VECTOR_TRACKING /* FhG: enables the reference position orientation tracking mode */ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index b8b7b74ffc..0f134a581a 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -492,7 +492,19 @@ static ivas_error ivas_masa_dec_config( ivas_set_qmetadata_maxbit_req( st_ivas->hQMetaData, st_ivas->ivas_format ); +#ifdef FIX_373_MASA_DELAY_COMP_MSAN + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) + { + /* need to apply the sampling rate correction also for the EXT output MASA meta buffer */ + masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, st_ivas->hDecoderConfig->output_Fs, hMasa->data.extOutMeta ); + } + else + { + masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, st_ivas->hDecoderConfig->output_Fs, NULL ); + } +#else masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, st_ivas->hDecoderConfig->output_Fs ); +#endif return error; } diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index dca9be4010..67f74fec63 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -589,7 +589,11 @@ ivas_error ivas_masa_enc_config( ivas_set_qmetadata_maxbit_req( hQMetaData, ivas_format ); +#ifdef FIX_373_MASA_DELAY_COMP_MSAN + masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, st_ivas->hEncoderConfig->input_Fs, NULL ); +#else masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, st_ivas->hEncoderConfig->input_Fs ); +#endif /* Transmit stereo signals using a mono downmix at lowest bitrates */ if ( ivas_format == MASA_FORMAT && st_ivas->nCPE == 1 && st_ivas->hCPE[0]->hStereoDft != NULL && st_ivas->hCPE[0]->hStereoDft->hConfig != NULL ) diff --git a/lib_util/masa_file_writer.c b/lib_util/masa_file_writer.c index 5667968ece..74429f9185 100644 --- a/lib_util/masa_file_writer.c +++ b/lib_util/masa_file_writer.c @@ -67,8 +67,10 @@ struct MasaFileWriter *-----------------------------------------------------------------------*/ #ifndef FIX_350_MASA_DELAY_COMP +#ifndef FIX_373_MASA_DELAY_COMP_MSAN #define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 ) /* Spherical index corresponding to front direction for setting as default value */ #endif +#endif /*-----------------------------------------------------------------------* * Local functions -- GitLab From 107abba5f19d9baa12d46afa21acaceea2645236 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Mar 2023 14:03:35 +0100 Subject: [PATCH 287/375] editorial improvements in reverb module --- lib_rend/ivas_objectRenderer.c | 6 +- lib_rend/ivas_prot_rend.h | 10 +- lib_rend/ivas_reverb.c | 175 +++++++++++++++++---------------- 3 files changed, 96 insertions(+), 95 deletions(-) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 0c1b219fe5..99b61c5f69 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -267,12 +267,12 @@ void ivas_td_binaural_close( *---------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer_unwrap( - REVERB_HANDLE hReverb, /* i : reverb handle */ - AUDIO_CONFIG transport_config, /* i : Transport configuration */ + const REVERB_HANDLE hReverb, /* i : reverb handle */ + const AUDIO_CONFIG transport_config, /* i : Transport configuration */ BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ const int16_t nchan_transport, /* i : Transport channels (ISMs) */ const int16_t lfe_idx, /* i : LFE channel index */ - IVAS_FORMAT ivas_format, /* i : IVAS format */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ const int16_t Opt_Headrotation, /* i : Head rotation flag */ const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 7fe1a4858f..5bbdea22dd 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -212,12 +212,12 @@ void ivas_HRTF_CRend_binary_close( *----------------------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer_unwrap( - REVERB_HANDLE hReverb, /* i : reverb handle */ - AUDIO_CONFIG transport_config, /* i : Transport configuration */ + const REVERB_HANDLE hReverb, /* i : reverb handle */ + const AUDIO_CONFIG transport_config, /* i : Transport configuration */ BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ const int16_t nchan_transport, /* i : Transport channels (ISMs) */ const int16_t lfe_idx, /* i : LFE channel index */ - IVAS_FORMAT ivas_format, /* i : IVAS format */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ const int16_t Opt_Headrotation, /* i : Head rotation flag */ const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ @@ -581,12 +581,12 @@ void ivas_reverb_close( ); ivas_error ivas_reverb_process( - REVERB_HANDLE hReverb, /* i/o: reverb state */ + const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const AUDIO_CONFIG input_audio_config, /* i : reverb. input audio configuration */ const int16_t mix_signals, /* i : add reverb to output signal */ float pcm_in[][L_FRAME48k], /* i : the PCM audio to apply reverb on */ float pcm_out[][L_FRAME48k], /* o : the PCM audio with reverb applied */ - const int16_t i_ts + const int16_t i_ts /* i : subframe index */ ); void ivas_rev_delay_line_init( diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index ec5bd928d2..7dc05cff09 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -675,34 +675,34 @@ static ivas_error calc_jot_t60_coeffs( *-----------------------------------------------------------------------------------------*/ static ivas_error initialize_reverb_filters( - REVERB_HANDLE pState ) + REVERB_HANDLE hReverb ) { ivas_error error; error = IVAS_ERR_OK; /* init correlation and coloration filters */ - if ( ( error = ivas_reverb_t2f_f2t_init( &pState->fft_filter_ols, pState->fft_size, pState->fft_subblock_size ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_t2f_f2t_init( &hReverb->fft_filter_ols, hReverb->fft_size, hReverb->fft_subblock_size ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = ivas_reverb_fft_filter_init( &pState->fft_filter_correl_0, pState->fft_size ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_fft_filter_init( &hReverb->fft_filter_correl_0, hReverb->fft_size ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = ivas_reverb_fft_filter_init( &pState->fft_filter_correl_1, pState->fft_size ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_fft_filter_init( &hReverb->fft_filter_correl_1, hReverb->fft_size ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = ivas_reverb_fft_filter_init( &pState->fft_filter_color_0, pState->fft_size ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_fft_filter_init( &hReverb->fft_filter_color_0, hReverb->fft_size ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = ivas_reverb_fft_filter_init( &pState->fft_filter_color_1, pState->fft_size ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_fft_filter_init( &hReverb->fft_filter_color_1, hReverb->fft_size ) ) != IVAS_ERR_OK ) { return error; } @@ -718,13 +718,13 @@ static ivas_error initialize_reverb_filters( *-----------------------------------------------------------------------------------------*/ static ivas_error set_t60_filter( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, const uint16_t branch, const uint16_t nr_taps, const float coefA[], const float coefB[] ) { - if ( branch >= pState->nr_of_branches ) + if ( branch >= hReverb->nr_of_branches ) { return IVAS_ERR_INTERNAL; } @@ -734,7 +734,7 @@ static ivas_error set_t60_filter( return IVAS_ERR_INTERNAL; } - ivas_reverb_iir_filt_set( &( pState->t60[branch] ), nr_taps, coefA, coefB ); + ivas_reverb_iir_filt_set( &( hReverb->t60[branch] ), nr_taps, coefA, coefB ); return IVAS_ERR_OK; } @@ -747,16 +747,16 @@ static ivas_error set_t60_filter( *-----------------------------------------------------------------------------------------*/ static ivas_error set_feedback_delay( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, const uint16_t branch, const int16_t fb_delay ) { - if ( branch >= pState->nr_of_branches ) + if ( branch >= hReverb->nr_of_branches ) { return IVAS_ERR_INTERNAL; } - pState->delay_line[branch].Delay = fb_delay; + hReverb->delay_line[branch].Delay = fb_delay; return IVAS_ERR_OK; } @@ -769,19 +769,19 @@ static ivas_error set_feedback_delay( *-----------------------------------------------------------------------------------------*/ static ivas_error set_feedback_gain( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, const uint16_t branch, const float *pGain ) { uint16_t gain_idx; - if ( branch >= pState->nr_of_branches ) + if ( branch >= hReverb->nr_of_branches ) { return IVAS_ERR_INTERNAL; } - for ( gain_idx = 0; gain_idx < pState->nr_of_branches; gain_idx++ ) + for ( gain_idx = 0; gain_idx < hReverb->nr_of_branches; gain_idx++ ) { - pState->gain_matrix[branch][gain_idx] = pGain[gain_idx]; + hReverb->gain_matrix[branch][gain_idx] = pGain[gain_idx]; } return IVAS_ERR_OK; @@ -795,7 +795,7 @@ static ivas_error set_feedback_gain( *-----------------------------------------------------------------------------------------*/ static ivas_error set_correl_fft_filter( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, const uint16_t channel, rv_fftwf_type_complex *pSpectrum ) { @@ -806,11 +806,11 @@ static ivas_error set_correl_fft_filter( if ( channel == 0 ) { - ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( pSpectrum, pState->fft_filter_correl_0.fft_spectrum, pState->fft_filter_correl_0.fft_size ); + ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( pSpectrum, hReverb->fft_filter_correl_0.fft_spectrum, hReverb->fft_filter_correl_0.fft_size ); } else { - ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( pSpectrum, pState->fft_filter_correl_1.fft_spectrum, pState->fft_filter_correl_1.fft_size ); + ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( pSpectrum, hReverb->fft_filter_correl_1.fft_spectrum, hReverb->fft_filter_correl_1.fft_size ); } return IVAS_ERR_OK; @@ -824,7 +824,7 @@ static ivas_error set_correl_fft_filter( *-----------------------------------------------------------------------------------------*/ static ivas_error set_color_fft_filter( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, const uint16_t channel, rv_fftwf_type_complex *pSpectrum ) { @@ -835,11 +835,11 @@ static ivas_error set_color_fft_filter( if ( channel == 0 ) { - ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( pSpectrum, pState->fft_filter_color_0.fft_spectrum, pState->fft_filter_color_0.fft_size ); + ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( pSpectrum, hReverb->fft_filter_color_0.fft_spectrum, hReverb->fft_filter_color_0.fft_size ); } else { - ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( pSpectrum, pState->fft_filter_color_1.fft_spectrum, pState->fft_filter_color_1.fft_size ); + ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( pSpectrum, hReverb->fft_filter_color_1.fft_spectrum, hReverb->fft_filter_color_1.fft_size ); } return IVAS_ERR_OK; @@ -853,7 +853,7 @@ static ivas_error set_color_fft_filter( *-----------------------------------------------------------------------------------------*/ static ivas_error set_mixer_level( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, const uint16_t channel, const float level[] ) { @@ -863,9 +863,9 @@ static ivas_error set_mixer_level( return IVAS_ERR_INTERNAL; } - for ( branch_idx = 0; branch_idx < pState->nr_of_branches; branch_idx++ ) + for ( branch_idx = 0; branch_idx < hReverb->nr_of_branches; branch_idx++ ) { - pState->mixer[channel][branch_idx] = level[branch_idx]; + hReverb->mixer[channel][branch_idx] = level[branch_idx]; } return IVAS_ERR_OK; @@ -879,7 +879,7 @@ static ivas_error set_mixer_level( *-----------------------------------------------------------------------------------------*/ static void clear_buffers( - REVERB_HANDLE pState ) + REVERB_HANDLE hReverb ) { int16_t branch_idx; ivas_rev_iir_filter_t *iirFilter; @@ -887,15 +887,15 @@ static void clear_buffers( for ( branch_idx = 0; branch_idx < IVAS_REV_MAX_NR_BRANCHES; branch_idx++ ) { - delay_line = &( pState->delay_line[branch_idx] ); + delay_line = &( hReverb->delay_line[branch_idx] ); set_f( delay_line->pBuffer, 0, delay_line->MaxDelay ); delay_line->BufferPos = 0; - iirFilter = &( pState->t60[branch_idx] ); + iirFilter = &( hReverb->t60[branch_idx] ); set_f( iirFilter->pBuffer, 0, iirFilter->MaxTaps ); } - ivas_reverb_t2f_f2t_ClearHistory( &pState->fft_filter_ols ); + ivas_reverb_t2f_f2t_ClearHistory( &hReverb->fft_filter_ols ); return; } @@ -908,31 +908,31 @@ static void clear_buffers( *-----------------------------------------------------------------------------------------*/ static void set_fft_and_datablock_sizes( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, const int16_t subframe_len ) { - pState->full_block_size = subframe_len; + hReverb->full_block_size = subframe_len; if ( subframe_len == L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES ) { - pState->fft_size = IVAS_REVERB_FFT_SIZE_48K; - pState->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_48K; + hReverb->fft_size = IVAS_REVERB_FFT_SIZE_48K; + hReverb->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_48K; } else if ( subframe_len == L_FRAME32k / MAX_PARAM_SPATIAL_SUBFRAMES ) { - pState->fft_size = IVAS_REVERB_FFT_SIZE_32K; - pState->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_32K; + hReverb->fft_size = IVAS_REVERB_FFT_SIZE_32K; + hReverb->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_32K; } else if ( subframe_len == L_FRAME16k / MAX_PARAM_SPATIAL_SUBFRAMES ) { - pState->fft_size = IVAS_REVERB_FFT_SIZE_16K; - pState->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_16K; + hReverb->fft_size = IVAS_REVERB_FFT_SIZE_16K; + hReverb->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_16K; } else { assert( 0 ); /* unsupported block size */ } - pState->fft_subblock_size = subframe_len / pState->num_fft_subblocks; + hReverb->fft_subblock_size = subframe_len / hReverb->num_fft_subblocks; return; } @@ -1030,7 +1030,7 @@ static void set_reverb_acoustic_data( *-----------------------------------------------------------------------------------------*/ static ivas_error setup_FDN_branches( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, ivas_reverb_params_t *pParams ) { int16_t nr_coefs, branch_idx, channel_idx; @@ -1041,12 +1041,12 @@ static ivas_error setup_FDN_branches( /* initialize feedback branches */ for ( branch_idx = 0; branch_idx < IVAS_REV_MAX_NR_BRANCHES; branch_idx++ ) { - ivas_rev_delay_line_init( &( pState->delay_line[branch_idx] ), pState->loop_delay_buffer[branch_idx], init_loop_delay[branch_idx], pParams->pLoop_delays[branch_idx] ); - ivas_reverb_iir_filt_init( &( pState->t60[branch_idx] ), IVAS_REV_MAX_IIR_FILTER_LENGTH ); - pState->mixer[0][branch_idx] = 0.0f; - pState->mixer[1][branch_idx] = 0.0f; + ivas_rev_delay_line_init( &( hReverb->delay_line[branch_idx] ), hReverb->loop_delay_buffer[branch_idx], init_loop_delay[branch_idx], pParams->pLoop_delays[branch_idx] ); + ivas_reverb_iir_filt_init( &( hReverb->t60[branch_idx] ), IVAS_REV_MAX_IIR_FILTER_LENGTH ); + hReverb->mixer[0][branch_idx] = 0.0f; + hReverb->mixer[1][branch_idx] = 0.0f; } - clear_buffers( pState ); + clear_buffers( hReverb ); nr_coefs = pParams->t60_filter_order + 1; if ( IVAS_REV_MAX_IIR_FILTER_LENGTH < nr_coefs ) @@ -1060,17 +1060,17 @@ static ivas_error setup_FDN_branches( pCoef_a = &pParams->pT60_filter_coeff[2 * nr_coefs * branch_idx + nr_coefs]; pCoef_b = &pParams->pT60_filter_coeff[2 * nr_coefs * branch_idx]; - if ( ( error = set_t60_filter( pState, branch_idx, nr_coefs, pCoef_a, pCoef_b ) ) != IVAS_ERR_OK ) + if ( ( error = set_t60_filter( hReverb, branch_idx, nr_coefs, pCoef_a, pCoef_b ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = set_feedback_delay( pState, branch_idx, pParams->pLoop_delays[branch_idx] ) ) != IVAS_ERR_OK ) + if ( ( error = set_feedback_delay( hReverb, branch_idx, pParams->pLoop_delays[branch_idx] ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = set_feedback_gain( pState, branch_idx, &( pParams->pLoop_feedback_matrix[branch_idx * pParams->nr_loops] ) ) ) != IVAS_ERR_OK ) + if ( ( error = set_feedback_gain( hReverb, branch_idx, &( pParams->pLoop_feedback_matrix[branch_idx * pParams->nr_loops] ) ) ) != IVAS_ERR_OK ) { return error; } @@ -1079,7 +1079,7 @@ static ivas_error setup_FDN_branches( for ( channel_idx = 0; channel_idx < pParams->nr_outputs; channel_idx++ ) { - if ( ( error = set_mixer_level( pState, channel_idx, &( pParams->pLoop_extract_matrix[channel_idx * pParams->nr_loops] ) ) ) != IVAS_ERR_OK ) + if ( ( error = set_mixer_level( hReverb, channel_idx, &( pParams->pLoop_extract_matrix[channel_idx * pParams->nr_loops] ) ) ) != IVAS_ERR_OK ) { return error; } @@ -1310,27 +1310,27 @@ void ivas_reverb_close( *-----------------------------------------------------------------------------------------*/ static void post_fft_filter( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, float *p0, float *p1, float *pBuffer_0, float *pBuffer_1 ) { - if ( pState->do_corr_filter ) + if ( hReverb->do_corr_filter ) { - ivas_reverb_t2f_f2t_in( &pState->fft_filter_ols, p0, p1, pBuffer_0, pBuffer_1 ); - ivas_reverb_fft_filter_ComplexMul( &pState->fft_filter_correl_0, pBuffer_0 ); - ivas_reverb_fft_filter_ComplexMul( &pState->fft_filter_correl_1, pBuffer_1 ); - ivas_reverb_fft_filter_CrossMix( pBuffer_0, pBuffer_1, pState->fft_filter_correl_0.fft_size ); + ivas_reverb_t2f_f2t_in( &hReverb->fft_filter_ols, p0, p1, pBuffer_0, pBuffer_1 ); + ivas_reverb_fft_filter_ComplexMul( &hReverb->fft_filter_correl_0, pBuffer_0 ); + ivas_reverb_fft_filter_ComplexMul( &hReverb->fft_filter_correl_1, pBuffer_1 ); + ivas_reverb_fft_filter_CrossMix( pBuffer_0, pBuffer_1, hReverb->fft_filter_correl_0.fft_size ); } else { - ivas_reverb_t2f_f2t_in( &pState->fft_filter_ols, p0, p1, pBuffer_0, pBuffer_1 ); + ivas_reverb_t2f_f2t_in( &hReverb->fft_filter_ols, p0, p1, pBuffer_0, pBuffer_1 ); } - ivas_reverb_fft_filter_ComplexMul( &pState->fft_filter_color_0, pBuffer_0 ); - ivas_reverb_fft_filter_ComplexMul( &pState->fft_filter_color_1, pBuffer_1 ); - ivas_reverb_t2f_f2t_out( &pState->fft_filter_ols, pBuffer_0, pBuffer_1, p0, p1 ); + ivas_reverb_fft_filter_ComplexMul( &hReverb->fft_filter_color_0, pBuffer_0 ); + ivas_reverb_fft_filter_ComplexMul( &hReverb->fft_filter_color_1, pBuffer_1 ); + ivas_reverb_t2f_f2t_out( &hReverb->fft_filter_ols, pBuffer_0, pBuffer_1, p0, p1 ); return; } @@ -1343,14 +1343,14 @@ static void post_fft_filter( *-----------------------------------------------------------------------------------------*/ static void reverb_block( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, float *pInput, float *pOut0, float *pOut1 ) { - uint16_t nr_branches = pState->nr_of_branches; - uint16_t bsize = pState->full_block_size; + uint16_t nr_branches = hReverb->nr_of_branches; + uint16_t bsize = hReverb->full_block_size; uint16_t inner_bsize = INNER_BLK_SIZE; uint16_t i, j, k, ns, branch_idx, blk_idx, start_sample_idx; @@ -1382,12 +1382,12 @@ static void reverb_block( for ( i = 0; i < nr_branches; i++ ) { float *pOutput_i = &ppOutput[i][0]; - float mixer_0_i = pState->mixer[0][i]; - float mixer_1_i = pState->mixer[1][i]; + float mixer_0_i = hReverb->mixer[0][i]; + float mixer_1_i = hReverb->mixer[1][i]; /* output and feedback are same, get sample from delay line ... */ - ivas_rev_delay_line_get_sample_blk( &( pState->delay_line[i] ), inner_bsize, pTemp ); - ivas_reverb_iir_filt_2taps_feed_blk( &( pState->t60[i] ), inner_bsize, pTemp, ppOutput[i] ); + ivas_rev_delay_line_get_sample_blk( &( hReverb->delay_line[i] ), inner_bsize, pTemp ); + ivas_reverb_iir_filt_2taps_feed_blk( &( hReverb->t60[i] ), inner_bsize, pTemp, ppOutput[i] ); for ( ns = 0; ns < inner_bsize; ns++ ) { pO0[ns] += pOutput_i[ns] * mixer_0_i; /* mixer ch 0 */ @@ -1406,7 +1406,7 @@ static void reverb_block( for ( j = 0; j < nr_branches; j++ ) { - float gain_matrix_j_i = pState->gain_matrix[j][i]; + float gain_matrix_j_i = hReverb->gain_matrix[j][i]; float *pOutput = &ppOutput[j][0]; for ( ns = 0; ns < inner_bsize; ns++ ) { @@ -1414,15 +1414,15 @@ static void reverb_block( } } - ivas_rev_delay_line_feed_sample_blk( &( pState->delay_line[i] ), inner_bsize, pFeedback_input ); + ivas_rev_delay_line_feed_sample_blk( &( hReverb->delay_line[i] ), inner_bsize, pFeedback_input ); } } /* Applying FFT filter to each sub-frame */ - for ( blk_idx = 0; blk_idx < pState->num_fft_subblocks; blk_idx++ ) + for ( blk_idx = 0; blk_idx < hReverb->num_fft_subblocks; blk_idx++ ) { - start_sample_idx = blk_idx * pState->fft_subblock_size; - post_fft_filter( pState, pOut0 + start_sample_idx, pOut1 + start_sample_idx, pFFT_buf[0], pFFT_buf[1] ); + start_sample_idx = blk_idx * hReverb->fft_subblock_size; + post_fft_filter( hReverb, pOut0 + start_sample_idx, pOut1 + start_sample_idx, pFFT_buf[0], pFFT_buf[1] ); } return; @@ -1436,14 +1436,14 @@ static void reverb_block( *-----------------------------------------------------------------------------------------*/ static ivas_error downmix_input_block( - REVERB_HANDLE pState, + const REVERB_HANDLE hReverb, float pcm_in[][L_FRAME48k], const AUDIO_CONFIG input_audio_config, float *pPcm_out, const int16_t input_offset ) { int16_t i, s, nchan_transport; - float dmx_gain = pState->dmx_gain; + float dmx_gain = hReverb->dmx_gain; switch ( input_audio_config ) { @@ -1459,7 +1459,7 @@ static ivas_error downmix_input_block( case AUDIO_CONFIG_ISM4: { nchan_transport = audioCfg2channels( input_audio_config ); - for ( s = 0; s < pState->full_block_size; s++ ) + for ( s = 0; s < hReverb->full_block_size; s++ ) { float temp = pcm_in[0][input_offset + s]; for ( i = 1; i < nchan_transport; i++ ) @@ -1475,7 +1475,7 @@ static ivas_error downmix_input_block( case AUDIO_CONFIG_HOA2: case AUDIO_CONFIG_HOA3: { - for ( s = 0; s < pState->full_block_size; s++ ) + for ( s = 0; s < hReverb->full_block_size; s++ ) { pPcm_out[s] = dmx_gain * pcm_in[0][input_offset + s]; } @@ -1497,35 +1497,35 @@ static ivas_error downmix_input_block( *-----------------------------------------------------------------------------------------*/ static void predelay_block( - REVERB_HANDLE pState, + const REVERB_HANDLE hReverb, float *pInput, float *pOutput ) { uint16_t i, idx, n_samples, blk_size; - uint16_t max_blk_size = (uint16_t) pState->predelay_line.Delay; + uint16_t max_blk_size = (uint16_t) hReverb->predelay_line.Delay; if ( max_blk_size < 2 ) { if ( max_blk_size == 0 ) /* zero-length delay line: just copy the data from input to output */ { - for ( i = 0; i < pState->full_block_size; i++ ) + for ( i = 0; i < hReverb->full_block_size; i++ ) { pOutput[i] = pInput[i]; } } else /* 1-sample length delay line: feed the data sample-by-sample */ { - for ( i = 0; i < pState->full_block_size; i++ ) + for ( i = 0; i < hReverb->full_block_size; i++ ) { - pOutput[i] = ivas_rev_delay_line_get_sample( &( pState->predelay_line ) ); - ivas_rev_delay_line_feed_sample( &( pState->predelay_line ), pInput[i] ); + pOutput[i] = ivas_rev_delay_line_get_sample( &( hReverb->predelay_line ) ); + ivas_rev_delay_line_feed_sample( &( hReverb->predelay_line ), pInput[i] ); } } } else /* multiple-sample length delay line: use block processing */ { idx = 0; - n_samples = pState->full_block_size; + n_samples = hReverb->full_block_size; while ( n_samples > 0 ) { blk_size = n_samples; @@ -1533,8 +1533,8 @@ static void predelay_block( { blk_size = max_blk_size; } - ivas_rev_delay_line_get_sample_blk( &( pState->predelay_line ), blk_size, &pOutput[idx] ); - ivas_rev_delay_line_feed_sample_blk( &( pState->predelay_line ), blk_size, &pInput[idx] ); + ivas_rev_delay_line_get_sample_blk( &( hReverb->predelay_line ), blk_size, &pOutput[idx] ); + ivas_rev_delay_line_feed_sample_blk( &( hReverb->predelay_line ), blk_size, &pInput[idx] ); idx += blk_size; n_samples -= blk_size; } @@ -1551,7 +1551,7 @@ static void predelay_block( *-----------------------------------------------------------------------------------------*/ static void mix_output_block( - REVERB_HANDLE pState, + const REVERB_HANDLE hReverb, const float *pInL, const float *pInR, float *pOutL, @@ -1559,7 +1559,7 @@ static void mix_output_block( { uint16_t i; - for ( i = 0; i < pState->full_block_size; i++ ) + for ( i = 0; i < hReverb->full_block_size; i++ ) { pOutL[i] += pInL[i]; pOutR[i] += pInR[i]; @@ -1576,12 +1576,13 @@ static void mix_output_block( *-----------------------------------------------------------------------------------------*/ ivas_error ivas_reverb_process( - REVERB_HANDLE hReverb, /* i/o: reverb state */ + const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const AUDIO_CONFIG input_audio_config, /* i : reverb. input audio configuration */ const int16_t mix_signals, /* i : add reverb to output signal */ float pcm_in[][L_FRAME48k], /* i : the PCM audio to apply reverb on */ float pcm_out[][L_FRAME48k], /* o : the PCM audio with reverb applied */ - const int16_t i_ts ) + const int16_t i_ts /* i : subframe index */ +) { float tmp0[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES], tmp1[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES], tmp2[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; ivas_error error; -- GitLab From 39bb0e61e852d6ae7e437be391e29957c0bcc082 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Mar 2023 14:39:42 +0100 Subject: [PATCH 288/375] harmonize handle/parameter name --- lib_dec/ivas_stat_dec.h | 2 +- lib_rend/ivas_objectRenderer.c | 18 ++--- lib_rend/ivas_prot_rend.h | 8 +- lib_rend/lib_rend.c | 132 +++++++++++---------------------- 4 files changed, 59 insertions(+), 101 deletions(-) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index a2becebe42..d8c0f65349 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1051,7 +1051,7 @@ typedef struct ivas_binaural_rendering_struct /* Convolution module structure */ BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; - /* Variables related to reverb module */ + /* Variables related to reverberator module */ float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; REVERB_STRUCT_HANDLE hReverb; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 99b61c5f69..67b73db6a6 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -267,10 +267,10 @@ void ivas_td_binaural_close( *---------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer_unwrap( - const REVERB_HANDLE hReverb, /* i : reverb handle */ + const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const AUDIO_CONFIG transport_config, /* i : Transport configuration */ BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ - const int16_t nchan_transport, /* i : Transport channels (ISMs) */ + const int16_t num_src, /* i : number of sources to render */ const int16_t lfe_idx, /* i : LFE channel index */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ @@ -291,7 +291,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; /* Update object position(s) */ - TDREND_Update_object_positions( hBinRendererTd, nchan_transport, lfe_idx, ivas_format, hIsmMetaData, output ); + TDREND_Update_object_positions( hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, output ); for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { @@ -302,7 +302,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL ); #endif - if ( ( hReverb != NULL ) && ( hReverb->pConfig.roomAcoustics.late_reverb_on ) ) + if ( hReverb != NULL && hReverb->pConfig.roomAcoustics.late_reverb_on ) { if ( ( error = ivas_reverb_process( hReverb, transport_config, 0, output, reverb_signal, subframe_idx ) ) != IVAS_ERR_OK ) { @@ -318,7 +318,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( } - if ( ( hReverb != NULL ) && ( hReverb->pConfig.roomAcoustics.late_reverb_on ) ) + if ( hReverb != NULL && hReverb->pConfig.roomAcoustics.late_reverb_on ) { /* add reverb to rendered signals */ v_add( reverb_signal[0], output[0], output[0], output_frame ); @@ -426,7 +426,7 @@ static void TDREND_Clear_Update_flags( void TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o : TD Renderer handle */ - const int16_t numSources, /* i : Number of sources to render */ + const int16_t num_src, /* i : number of sources to render */ const int16_t lfe_idx, /* i : Input LFE index */ const IVAS_FORMAT in_format, /* i : Format of input sources */ const ISM_METADATA_HANDLE *hIsmMetaData, /* i : Input metadata for ISM objects */ @@ -443,7 +443,7 @@ void TDREND_Update_object_positions( /* For each source, write the frame data to the source object*/ c_indx = 0; - for ( nS = 0; nS < numSources; nS++ ) + for ( nS = 0; nS < num_src; nS++ ) { if ( !( in_format == MC_FORMAT && nS == lfe_idx ) ) /* Skip LFE for MC */ { @@ -636,7 +636,7 @@ ivas_error ivas_td_binaural_renderer_ext( const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ - const REVERB_HANDLE reverb, /* i : reverb handle */ + const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const int16_t output_frame, /* i : output frame length */ float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ) @@ -688,7 +688,7 @@ ivas_error ivas_td_binaural_renderer_ext( #endif } - if ( ( error = ivas_td_binaural_renderer_unwrap( reverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, + if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, #ifdef TD5 ( headRotData != NULL ) ? headRotData->Pos : NULL, output, output_frame ) ) != IVAS_ERR_OK ) diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 5bbdea22dd..4c79280a86 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -212,10 +212,10 @@ void ivas_HRTF_CRend_binary_close( *----------------------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer_unwrap( - const REVERB_HANDLE hReverb, /* i : reverb handle */ + const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const AUDIO_CONFIG transport_config, /* i : Transport configuration */ BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ - const int16_t nchan_transport, /* i : Transport channels (ISMs) */ + const int16_t num_src, /* i : number of sources to render */ const int16_t lfe_idx, /* i : LFE channel index */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ @@ -234,7 +234,7 @@ ivas_error ivas_td_binaural_renderer_ext( const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ - const REVERB_HANDLE reverb, /* i : reverb handle */ + const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const int16_t output_frame, /* i : output frame length */ float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ); @@ -288,7 +288,7 @@ void TDREND_Update_listener_orientation( void TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o : TD Renderer handle */ - const int16_t numSources, /* i : Number of sources to render */ + const int16_t num_src, /* i : number of sources to render */ const int16_t lfe_idx, /* i : Input LFE index */ const IVAS_FORMAT in_format, /* i : Format of input sources */ const ISM_METADATA_HANDLE *hIsmMetaData, /* i : Input metadata for ISM objects */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 95e87ec4ef..919eddb52a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -116,7 +116,7 @@ typedef struct IVAS_REND_AudioObjectPosition previousPos; TDREND_WRAPPER tdRendWrapper; CREND_WRAPPER_HANDLE crendWrapper; - REVERB_HANDLE reverb; + REVERB_HANDLE hReverb; rotation_matrix rot_mat_prev; } input_ism; @@ -142,7 +142,7 @@ typedef struct EFAP_WRAPPER efapInWrapper; TDREND_WRAPPER tdRendWrapper; CREND_WRAPPER_HANDLE crendWrapper; - REVERB_HANDLE reverb; + REVERB_HANDLE hReverb; rotation_gains rot_gains_prev; lfe_routing lfeRouting; } input_mc; @@ -1103,7 +1103,7 @@ static ivas_error setRendInputActiveIsm( inputIsm->currentPos = defaultObjectPosition(); inputIsm->previousPos = defaultObjectPosition(); inputIsm->crendWrapper = NULL; - inputIsm->reverb = NULL; + inputIsm->hReverb = NULL; inputIsm->tdRendWrapper = defaultTdRendWrapper(); initRotMatrix( inputIsm->rot_mat_prev ); @@ -1132,16 +1132,14 @@ static ivas_error setRendInputActiveIsm( return error; } - if ( ( error = ivas_reverb_open( &( inputIsm->reverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } } else { - if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, - getIvasAudioConfigFromRendAudioConfig( outConfig ), - hRendCfg, + if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, #ifndef FIX_I109_ORIENTATION_TRACKING 0, #endif @@ -1168,7 +1166,7 @@ static void clearInputIsm( ivas_rend_closeCrend( &inputIsm->crendWrapper ); - ivas_reverb_close( &inputIsm->reverb ); + ivas_reverb_close( &inputIsm->hReverb ); if ( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) { @@ -1809,7 +1807,7 @@ static ivas_error initMcBinauralRendering( ivas_rend_closeCrend( &inputMc->crendWrapper ); - ivas_reverb_close( &inputMc->reverb ); + ivas_reverb_close( &inputMc->hReverb ); if ( inputMc->efapInWrapper.hEfap != NULL ) { @@ -1847,7 +1845,7 @@ static ivas_error initMcBinauralRendering( if ( hRendCfg != NULL && hRendCfg->roomAcoustics.use_brir == 0 && hRendCfg->roomAcoustics.late_reverb_on ) { - if ( ( error = ivas_reverb_open( &( inputMc->reverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -1855,9 +1853,7 @@ static ivas_error initMcBinauralRendering( } { - if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, - ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) ? AUDIO_CONFIG_7_1_4 : getIvasAudioConfigFromRendAudioConfig( inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - hRendCfg, + if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) ? AUDIO_CONFIG_7_1_4 : getIvasAudioConfigFromRendAudioConfig( inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, #ifndef FIX_I109_ORIENTATION_TRACKING 0, #endif @@ -1962,7 +1958,7 @@ static ivas_error setRendInputActiveMc( inputMc->customLsInput = defaultCustomLs(); inputMc->tdRendWrapper = defaultTdRendWrapper(); inputMc->crendWrapper = NULL; - inputMc->reverb = NULL; + inputMc->hReverb = NULL; initRotGains( inputMc->rot_gains_prev ); inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); @@ -1999,7 +1995,7 @@ static void clearInputMc( ivas_rend_closeCrend( &inputMc->crendWrapper ); - ivas_reverb_close( &inputMc->reverb ); + ivas_reverb_close( &inputMc->hReverb ); if ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) { @@ -2734,7 +2730,7 @@ ivas_error IVAS_REND_Open( { initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); hIvasRend->inputsIsm[i].crendWrapper = NULL; - hIvasRend->inputsIsm[i].reverb = NULL; + hIvasRend->inputsIsm[i].hReverb = NULL; hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; } @@ -2743,7 +2739,7 @@ ivas_error IVAS_REND_Open( initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); hIvasRend->inputsMc[i].efapInWrapper.hEfap = NULL; hIvasRend->inputsMc[i].crendWrapper = NULL; - hIvasRend->inputsMc[i].reverb = NULL; + hIvasRend->inputsMc[i].hReverb = NULL; hIvasRend->inputsMc[i].tdRendWrapper.hBinRendererTd = NULL; } @@ -3755,9 +3751,9 @@ ivas_error IVAS_REND_InitConfig( return error; } - if ( ivas_render_config_init_from_rom( &hIvasRend->hRendererConfig, hIvasRend->rendererConfigEnabled ) != IVAS_ERR_OK ) + if ( ( error = ivas_render_config_init_from_rom( &hIvasRend->hRendererConfig, hIvasRend->rendererConfigEnabled ) ) != IVAS_ERR_OK ) { - return IVAS_ERR_INTERNAL_FATAL; + return error; } } else @@ -4434,7 +4430,7 @@ static ivas_error renderIsmToBinaural( NULL, ismInput->base.ctx.pHeadRotData, &ismInput->currentPos, - ismInput->reverb, + ismInput->hReverb, outAudio.config.numSamplesPerChannel, tmpTDRendBuffer ) ) != IVAS_ERR_OK ) { @@ -4471,7 +4467,7 @@ static ivas_error renderIsmToBinauralRoom( headRotData = ismInput->base.ctx.pHeadRotData; rotatedPos = defaultObjectPosition(); - if ( ismInput->reverb != NULL && ismInput->reverb->pConfig.roomAcoustics.use_brir == 0 && ismInput->reverb->pConfig.roomAcoustics.late_reverb_on == 1 && headRotData->headRotEnabled ) + if ( ismInput->hReverb != NULL && ismInput->hReverb->pConfig.roomAcoustics.use_brir == 0 && ismInput->hReverb->pConfig.roomAcoustics.late_reverb_on == 1 && headRotData->headRotEnabled ) { copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer ); @@ -4481,7 +4477,7 @@ static ivas_error renderIsmToBinauralRoom( NULL, ismInput->base.ctx.pHeadRotData, &ismInput->currentPos, - ismInput->reverb, + ismInput->hReverb, outAudio.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { @@ -4564,13 +4560,8 @@ static ivas_error renderIsmToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpRendBuffer ); - - if ( ( error = ivas_rend_crendProcess( - ismInput->crendWrapper, - AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM, - NULL, NULL, NULL, NULL, - tmpRendBuffer, - *ismInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM, + NULL, NULL, NULL, NULL, tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -4657,6 +4648,7 @@ static ivas_error renderIsmToSba( { return error; } + if ( ( error = getAmbisonicsOrder( outConfig, &ambiOrderOut ) ) != IVAS_ERR_OK ) { return error; @@ -4711,7 +4703,6 @@ static ivas_error renderInputIsm( /* Apply input gain to new audio */ v_multc( inAudio.data, ismInput->base.gain, inAudio.data, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); - switch ( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: @@ -4835,19 +4826,12 @@ static ivas_error renderMcToBinaural( headRotEnabled = mcInput->base.ctx.pHeadRotData->headRotEnabled; inConfig = mcInput->base.inConfig; - if ( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) || - ( headRotEnabled && ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ) ) + if ( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) || ( headRotEnabled && ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ) ) { copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); - if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, - mcInput->base.inConfig, - &mcInput->customLsInput, - mcInput->base.ctx.pHeadRotData, - NULL, - mcInput->reverb, - mcInput->base.inputBuffer.config.numSamplesPerChannel, - tmpRendBuffer ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, NULL, + mcInput->hReverb, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { return error; } @@ -4861,13 +4845,8 @@ static ivas_error renderMcToBinaural( tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); - if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, - mcInput->base.inConfig, - mcInput->customLsInput, - mcInput->base.ctx.pHeadRotData, - mcInput->rot_gains_prev, - mcInput->efapInWrapper.hEfap, - tmpRotBuffer ) ) != IVAS_ERR_OK ) + if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, + mcInput->rot_gains_prev, mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { return error; } @@ -4881,10 +4860,8 @@ static ivas_error renderMcToBinaural( } /* call CREND */ - if ( ( error = ivas_rend_crendProcess( - mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, - tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, NULL, NULL, NULL, tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -4919,25 +4896,18 @@ static ivas_error renderMcToBinauralRoom( headRotEnabled = mcInput->base.ctx.pHeadRotData->headRotEnabled; inConfig = mcInput->base.inConfig; - if ( ( mcInput->reverb != NULL && mcInput->reverb->pConfig.roomAcoustics.use_brir == 0 && mcInput->reverb->pConfig.roomAcoustics.late_reverb_on == 1 ) && ( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) || ( headRotEnabled && ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ) ) ) + if ( ( mcInput->hReverb != NULL && mcInput->hReverb->pConfig.roomAcoustics.use_brir == 0 && mcInput->hReverb->pConfig.roomAcoustics.late_reverb_on == 1 ) && ( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) || ( headRotEnabled && ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ) ) ) { copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); - if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, - mcInput->base.inConfig, - &mcInput->customLsInput, - mcInput->base.ctx.pHeadRotData, - NULL, - mcInput->reverb, - mcInput->base.inputBuffer.config.numSamplesPerChannel, - tmpRendBuffer ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, + NULL, mcInput->hReverb, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { return error; } } else { - /* apply rotation */ if ( headRotEnabled ) { @@ -4945,13 +4915,8 @@ static ivas_error renderMcToBinauralRoom( tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); - if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, - mcInput->base.inConfig, - mcInput->customLsInput, - mcInput->base.ctx.pHeadRotData, - mcInput->rot_gains_prev, - mcInput->efapInWrapper.hEfap, - tmpRotBuffer ) ) != IVAS_ERR_OK ) + if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, + mcInput->rot_gains_prev, mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { return error; } @@ -4965,17 +4930,14 @@ static ivas_error renderMcToBinauralRoom( } /* call CREND */ - if ( ( error = ivas_rend_crendProcess( - mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, - tmpRendBuffer, - *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, NULL, NULL, NULL, tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } } - accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); + accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); /* TODO tmu : needs delay compensation */ if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) @@ -5029,7 +4991,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( return error; } - tmpMcBuffer.config.numChannels = (int16_t) tmp; + tmpMcBuffer.config.numChannels = tmp; tmpMcBuffer.data = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpMcBuffer.data, tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels ); @@ -5041,9 +5003,8 @@ static ivas_error renderMcCustomLsToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); /* call CREND */ - if ( ( error = ivas_rend_crendProcess( - mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, - tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, + tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -5271,9 +5232,8 @@ static ivas_error renderSbaToBinaural( } /* call CREND */ - if ( ( error = ivas_rend_crendProcess( - sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, - tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -5328,7 +5288,7 @@ static ivas_error renderSbaToBinauralRoom( return error; } - tmpMcBuffer.config.numChannels = (int16_t) tmp; + tmpMcBuffer.config.numChannels = tmp; tmpMcBuffer.data = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpMcBuffer.data, tmpMcBuffer.config.numChannels * tmpMcBuffer.config.numSamplesPerChannel ); @@ -5341,10 +5301,8 @@ static ivas_error renderSbaToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); /* call CREND */ - if ( ( error = ivas_rend_crendProcess( - sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, - tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -5592,7 +5550,7 @@ static ivas_error renderActiveInputsMasa( IVAS_REND_HANDLE hIvasRend, IVAS_REND_AudioBuffer outAudio ) { - int32_t i; + int16_t i; input_masa *pCurrentInput; ivas_error error; -- GitLab From 4e9578746c599881fb86924011a89783f920dc2d Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Mar 2023 14:57:27 +0100 Subject: [PATCH 289/375] editorial improvements in lib_rend.c --- lib_rend/lib_rend.c | 104 ++++++++++++-------------------------------- 1 file changed, 29 insertions(+), 75 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 919eddb52a..1dc1c1f956 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -954,6 +954,8 @@ static void closeHeadRotation( { free( hIvasRend->headRotData.hOrientationTracker ); } + + return; } #endif @@ -1065,7 +1067,9 @@ static CREND_WRAPPER defaultCrendWrapper( return w; } -static bool isIoConfigPairSupported( IVAS_REND_AudioConfig inConfig, IVAS_REND_AudioConfig outConfig ) +static bool isIoConfigPairSupported( + IVAS_REND_AudioConfig inConfig, + IVAS_REND_AudioConfig outConfig ) { /* Rendering mono or stereo to binaural is not supported */ if ( ( inConfig == IVAS_REND_AUDIO_CONFIG_MONO || inConfig == IVAS_REND_AUDIO_CONFIG_STEREO ) && @@ -1224,6 +1228,8 @@ static void fillIdentityPanMatrix( { panMatrix[i][i] = 1.0f; } + + return; } static ivas_error initMcPanGainsWithIdentMatrix( @@ -1248,8 +1254,7 @@ static ivas_error initMcPanGainsWithConversionMapping( * Stay with default panning matrix if conversion_matrix is NULL */ for ( i = 0; i < LS_SETUP_CONVERSION_NUM_MAPPINGS; ++i ) { - if ( ls_conversion_mapping[i].input_config == ivasConfigIn && - ls_conversion_mapping[i].output_config == ivasConfigOut ) + if ( ls_conversion_mapping[i].input_config == ivasConfigIn && ls_conversion_mapping[i].output_config == ivasConfigOut ) { /* Mapping found with valid matrix - copy */ if ( ls_conversion_mapping[i].conversion_matrix != NULL ) @@ -1881,7 +1886,7 @@ static lfe_routing defaultLfeRouting( const IVAS_REND_AudioConfig outConfig, const LSSETUP_CUSTOM_STRUCT customLsOut ) { - int32_t i; + int16_t i; lfe_routing routing; /* Set all output gains to zero, then route each input LFE consecutively to the next available output LFE. */ @@ -2473,7 +2478,7 @@ static DecoderDummy *initDecoderDummy( decDummy = malloc( sizeof( DecoderDummy ) ); decDummy->hDecoderConfig = malloc( sizeof( DECODER_CONFIG ) ); decDummy->hDecoderConfig->output_Fs = sampleRate; - decDummy->hDecoderConfig->nchan_out = (int16_t) numOutChannels; + decDummy->hDecoderConfig->nchan_out = numOutChannels; decDummy->hDecoderConfig->Opt_Headrotation = 0; decDummy->hBinRenderer = NULL; @@ -2557,7 +2562,7 @@ static ivas_error setRendInputActiveMasa( { return error; } - inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, (int16_t) numInChannels, outConfig, 0 ); + inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0 ); inputMasa->metadataHasBeenFed = false; if ( ( error = updateMasaDummyDec( inputMasa, outConfig ) ) != IVAS_ERR_OK ) @@ -2662,10 +2667,7 @@ ivas_error IVAS_REND_Open( ivas_error error; int16_t numOutChannels; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( phIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -2824,10 +2826,7 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( input_mc *inputMc; input_sba *inputSba; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -2909,10 +2908,7 @@ ivas_error IVAS_REND_NumOutChannels( { ivas_error error; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL || numOutChannels == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -3135,10 +3131,7 @@ ivas_error IVAS_REND_AddInput( ivas_error ( *activateInput )( void *, IVAS_REND_AudioConfig, IVAS_REND_InputId, RENDER_CONFIG_DATA * ); int32_t inputIndex; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL || inputId == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -3207,10 +3200,7 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( input_mc *inputMc; ivas_error error; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -3276,10 +3266,7 @@ ivas_error IVAS_REND_SetInputGain( input_base *inputBase; ivas_error error; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -3313,10 +3300,7 @@ ivas_error IVAS_REND_SetInputLfeMtx( input_mc *pInputMc; ivas_error error; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -3367,10 +3351,7 @@ ivas_error IVAS_REND_SetInputLfePos( input_mc *pInputMc; ivas_error error; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -3416,10 +3397,7 @@ ivas_error IVAS_REND_RemoveInput( ivas_error error; input_base *inputBase; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -3467,10 +3445,7 @@ ivas_error IVAS_REND_GetInputNumChannels( ivas_error error; const input_base *pInput; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL || numChannels == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -3509,10 +3484,7 @@ ivas_error IVAS_REND_GetDelay( int32_t latency_ns; int32_t max_latency_ns; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL || nSamples == NULL || timeScale == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -3583,10 +3555,7 @@ ivas_error IVAS_REND_FeedInputAudio( input_base *inputBase; int16_t numInputChannels; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL || inputAudio.data == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -3650,10 +3619,7 @@ ivas_error IVAS_REND_FeedInputObjectMetadata( input_ism *inputIsm; ivas_error error; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -3694,10 +3660,7 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( input_base *inputBase; input_masa *inputMasa; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -3881,10 +3844,7 @@ ivas_error IVAS_REND_SetHeadRotation( IVAS_QUATERNION rotQuat; #endif - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -4224,7 +4184,7 @@ static ivas_error rotateFrameMc( /* initialize gains to passthrough */ for ( ch_in = 0; ch_in < nchan; ch_in++ ) { - set_zero( gains[ch_in], (int16_t) nchan ); + set_zero( gains[ch_in], nchan ); gains[ch_in][ch_in] = 1.f; } @@ -5586,10 +5546,7 @@ ivas_error IVAS_REND_GetSamples( ivas_error error; int16_t numOutChannels; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL || outAudio.data == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -5667,10 +5624,7 @@ void IVAS_REND_Close( uint16_t i; IVAS_REND_HANDLE hIvasRend; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( phIvasRend == NULL || *phIvasRend == NULL ) { return; -- GitLab From 04726acdbfebfc59dd66604e76a2705ab4e428e0 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Tue, 21 Mar 2023 16:34:24 +0100 Subject: [PATCH 290/375] remove unused file lib_debug/segsnr.c unused file gives a warning on the windows runner --- lib_debug/segsnr.c | 105 --------------------------------------------- 1 file changed, 105 deletions(-) delete mode 100644 lib_debug/segsnr.c diff --git a/lib_debug/segsnr.c b/lib_debug/segsnr.c deleted file mode 100644 index 5e5cee48b0..0000000000 --- a/lib_debug/segsnr.c +++ /dev/null @@ -1,105 +0,0 @@ -/****************************************************************************************************** - - (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository. All Rights Reserved. - - This software is protected by copyright law and by international treaties. - The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository retain full ownership rights in their respective contributions in - the software. This notice grants no license of any kind, including but not limited to patent - license, nor is any license granted by implication, estoppel or otherwise. - - Contributors are required to enter into the IVAS codec Public Collaboration agreement before making - contributions. - - This software is provided "AS IS", without any express or implied warranties. The software is in the - development stage. It is intended exclusively for experts who have experience with such software and - solely for the purpose of inspection. All implied warranties of non-infringement, merchantability - and fitness for a particular purpose are hereby disclaimed and excluded. - - Any dispute, controversy or claim arising under or in relation to providing this software shall be - submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in - accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and - the United Nations Convention on Contracts on the International Sales of Goods. - -*******************************************************************************************************/ - -#include -#ifdef DEBUGGING -#include "debug.h" -#endif -#include "wmc_auto.h" -#include -#include "options.h" -#include "prot.h" - -#define WMC_TOOL_SKIP - -#ifdef OUTPUT_SNR -/*_____________________________________________________________________ - | | - | FUNCTION NAME segsnr | - | Computes the segmential signal-to-noise ratio between the | - | signal x and its estimate xe of length n samples. The segment | - | length is nseg samples. | - | - | INPUT - | x[0:n-1] Signal of n samples. - | xe[0:n-1] Estimated signal of n samples. - | n Signal length. - | nseg Segment length, must be a submultiple of n. - | - | RETURN VALUE - | snr Segmential signal to noise ratio in dB. - |_____________________________________________________________________| -*/ - -float segsnr( float x[], float xe[], int16_t n, int16_t nseg ) -{ - float snr = 0.0f; - float signal, noise, error, fac; - int16_t i, j; - LOOP( 1 ); - for ( i = 0; i < n; i += nseg ) - { - signal = 1e-6f; - MOVE( 2 ); - noise = 1e-6f; - LOOP( 1 ); - for ( j = 0; j < nseg; j++ ) - { - signal += ( *x ) * ( *x ); - MAC( 1 ); - error = *x++ - *xe++; - ADD( 1 ); - noise += error * error; - MAC( 1 ); - } - snr += (float) log10( signal / noise ); - TRANS( 1 ); - DIV( 1 ); - ADD( 1 ); - } - fac = ( (float) ( 10 * nseg ) ) / (float) n; - DIV( 1 ); - MULT( 1 ); - snr = fac * snr; - MULT( 1 ); - ADD( 1 ); - BRANCH( 1 ); - if ( snr < -99.0f ) - { - snr = -99.0f; - MOVE( 1 ); - } - return ( snr ); -} -#endif - -#undef WMC_TOOL_SKIP -- GitLab From 9a1a78818ccb112a8d62ef7ce8f161391239fec0 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Tue, 21 Mar 2023 18:57:39 +0100 Subject: [PATCH 291/375] proposed fix for FIX_MDCT_STEREO_BWD_TCX10 --- lib_com/options.h | 6 ++++-- lib_enc/bw_detect.c | 6 ++++++ lib_enc/ivas_mdct_core_enc.c | 18 ++++++++++++------ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index b20e6db5d1..13af4a7942 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,9 +153,11 @@ #define TD5_FIX_INVALID_MEMORY_ACCESS /* FhG: Resolves segfault in case IVAS_REND_InitConfig gets initialized with rendererConfigEnabled:=false && ISM are being rendered */ #ifdef FIX_I109_ORIENTATION_TRACKING -#define OTR_REFERENCE_VECTOR_TRACKING /* FhG: enables the reference position orientation tracking mode */ +#define OTR_REFERENCE_VECTOR_TRACKING /* FhG: enables the reference position orientation tracking mode */ #endif -#define DISABLE_BWD_MCT /* FhG: Disable bandwidth detection for MCT*/ +//#define DISABLE_BWD_MCT /* FhG: Disable bandwidth detection for MCT*/ +#define FIX_MDCT_STEREO_BWD_TCX10 /* FhG: enables bw detection also for TCX10 frames */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_enc/bw_detect.c b/lib_enc/bw_detect.c index c709cc3b2f..a212048bae 100644 --- a/lib_enc/bw_detect.c +++ b/lib_enc/bw_detect.c @@ -173,8 +173,14 @@ void bw_detect( } else { +#ifndef FIX_MDCT_STEREO_BWD_TCX10 bin_width *= (int16_t) ( ( st->input_Fs / FRAMES_PER_SEC ) / BWD_TOTAL_WIDTH ); mvr2r( spectrum, spect, (int16_t) ( st->input_Fs / FRAMES_PER_SEC ) ); +#else + assert( st->core != ACELP_CORE ); + bin_width *= (int16_t) ( ( st->input_Fs / ( FRAMES_PER_SEC * st->core ) ) / BWD_TOTAL_WIDTH ); + mvr2r( spectrum, spect, (int16_t) ( st->input_Fs / ( FRAMES_PER_SEC * st->core ) ) ); +#endif } /*---------------------------------------------------------------------* * compute energy per spectral bins diff --git a/lib_enc/ivas_mdct_core_enc.c b/lib_enc/ivas_mdct_core_enc.c index 7287537c72..c3a75784b5 100644 --- a/lib_enc/ivas_mdct_core_enc.c +++ b/lib_enc/ivas_mdct_core_enc.c @@ -687,6 +687,7 @@ void ivas_mdct_core_whitening_enc( /* BWD in MDCT domain */ #ifndef DISABLE_BWD_MCT +#ifndef FIX_MDCT_STEREO_BWD_TCX10 if ( st->hTcxEnc->transform_type[0] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) { if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) @@ -695,15 +696,20 @@ void ivas_mdct_core_whitening_enc( } } #else - if ( ( st->hTcxEnc->transform_type[0] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) && !mct_on ) + if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) { + nSubframes = ( st->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; - bw_detect( st, NULL, st->hTcxEnc->spectrum[0], NULL ); - } - else if ( mct_on ) - { - st->bwidth = st->max_bwidth; + for ( n = 0; n < nSubframes; n++ ) + { + bw_detect( st, NULL, st->hTcxEnc->spectrum[n], NULL ); + if ( nSubframes == NB_DIV && n == 0 ) + { + st->last_input_bwidth = st->input_bwidth; + } + } } +#endif #endif if ( st->last_core == ACELP_CORE ) /* reset past kernel info */ -- GitLab From 9aeb16ac0545fd7ed30d84fa5775aea4244a9571 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Wed, 22 Mar 2023 16:00:16 +0100 Subject: [PATCH 292/375] exit with correct exit code for windows build jobs also replace 'build -j16' with 'build -j' --- .gitlab-ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b946d39a72..082cf40cab 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -288,9 +288,10 @@ build-codec-windows-cmake: - *print-common-info-windows - $winoutdata = $null - cmake -G "Visual Studio 15 2017" . -Bbuild - - cmake --build build -j16 | tee -variable winoutdata + - cmake --build build -j | tee -variable winoutdata - $winoutdata | Out-File $BUILD_OUTPUT -Encoding Utf8 - - ("& python ci/check_for_warnings.py '$BUILD_OUTPUT'", "exit $LASTEXITCODE") | Invoke-Expression + - ("& python ci/check_for_warnings.py '$BUILD_OUTPUT'") | Invoke-Expression + - ("exit $LASTEXITCODE") | Invoke-Expression build-codec-windows-msbuild: extends: @@ -301,7 +302,8 @@ build-codec-windows-msbuild: - $winoutdata = $null - MSBuild.exe .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Debug | tee -variable winoutdata - $winoutdata | Out-File $BUILD_OUTPUT -Encoding Utf8 - - ("& python ci/check_for_warnings.py '$BUILD_OUTPUT'", "exit $LASTEXITCODE") | Invoke-Expression + - ("& python ci/check_for_warnings.py '$BUILD_OUTPUT'") | Invoke-Expression + - ("exit $LASTEXITCODE") | Invoke-Expression # --------------------------------------------------------------- # Test jobs for merge requests -- GitLab From 6f3c26e1dae98b3e42d4230e2be4af5b25d6ebb9 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Thu, 23 Mar 2023 11:05:28 +0100 Subject: [PATCH 293/375] fix for BWD and transients under BWD_COUNT_FIX --- lib_com/options.h | 2 +- lib_com/prot.h | 5 ++ lib_enc/amr_wb_enc.c | 7 ++- lib_enc/bw_detect.c | 99 ++++++++++++++++++++++++------ lib_enc/ivas_core_pre_proc_front.c | 7 ++- lib_enc/ivas_mdct_core_enc.c | 7 ++- lib_enc/pre_proc.c | 7 ++- 7 files changed, 110 insertions(+), 24 deletions(-) mode change 100644 => 100755 lib_enc/amr_wb_enc.c mode change 100644 => 100755 lib_enc/bw_detect.c mode change 100644 => 100755 lib_enc/ivas_core_pre_proc_front.c mode change 100644 => 100755 lib_enc/ivas_mdct_core_enc.c mode change 100644 => 100755 lib_enc/pre_proc.c diff --git a/lib_com/options.h b/lib_com/options.h index 13af4a7942..3bbf378873 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,7 +157,7 @@ #endif //#define DISABLE_BWD_MCT /* FhG: Disable bandwidth detection for MCT*/ #define FIX_MDCT_STEREO_BWD_TCX10 /* FhG: enables bw detection also for TCX10 frames */ - +#define BWD_COUNT_FIX /* FhG/Dolby: fix for issue of reacting to sudden transiensts in SBA/MCT modes */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 69cc4e0d32..cf67c188fc 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -3828,8 +3828,13 @@ void bw_detect( const float signal_in[], /* i : input signal */ float *spectrum, /* i : MDCT spectrum */ const float *enerBuffer /* i : energy buffer */ +#ifdef BWD_COUNT_FIX + , + const int16_t mct_on /* i : flag MCT mode */ +#endif ); + void set_bw( const int16_t element_mode, /* i : element mode */ const int32_t element_brate, /* i : element bitrate */ diff --git a/lib_enc/amr_wb_enc.c b/lib_enc/amr_wb_enc.c old mode 100644 new mode 100755 index 80520d4c38..8e9879b0ef --- a/lib_enc/amr_wb_enc.c +++ b/lib_enc/amr_wb_enc.c @@ -342,7 +342,12 @@ void amr_wb_enc( * WB, SWB and FB bandwidth detector *----------------------------------------------------------------*/ - bw_detect( st, st->input, NULL, NULL ); + bw_detect( st, st->input, NULL, NULL +#ifdef BWD_COUNT_FIX + , + 0 +#endif + ); /* in AMR_WB IO, limit the maximum band-width to WB */ if ( st->bwidth > WB ) diff --git a/lib_enc/bw_detect.c b/lib_enc/bw_detect.c old mode 100644 new mode 100755 index a212048bae..40dd0e180d --- a/lib_enc/bw_detect.c +++ b/lib_enc/bw_detect.c @@ -57,6 +57,9 @@ #define BWD_COUNT_MAX 100 #define BWD_COUNT_WIDER_BW 10 +#ifdef BWD_COUNT_FIX +#define BWD_COUNT_WIDER_BW_MDCT 0 +#endif #define CLDFB_ENER_OFFSET 1.6f @@ -71,6 +74,10 @@ void bw_detect( const float signal_in[], /* i : input signal */ float *spectrum, /* i : MDCT spectrum */ const float *enerBuffer /* i : energy buffer */ +#ifdef BWD_COUNT_FIX + , + const int16_t mct_on /* i : flag MCT mode */ +#endif ) { int16_t i, j, k, bw_max, bin_width, n_bins; @@ -396,50 +403,104 @@ void bw_detect( *---------------------------------------------------------------------*/ /* switching to a higher BW */ - if ( st->last_input_bwidth == NB ) +#ifdef BWD_COUNT_FIX + if ( st->element_mode == IVAS_CPE_MDCT && ( st->element_brate > IVAS_64k || mct_on ) ) { - if ( st->count_WB > BWD_COUNT_WIDER_BW ) + if ( st->last_input_bwidth == NB ) { - st->input_bwidth = WB; - st->count_WB = BWD_COUNT_MAX; + if ( st->count_WB > BWD_COUNT_WIDER_BW_MDCT ) + { + st->input_bwidth = WB; + st->count_WB = BWD_COUNT_MAX; - if ( st->count_SWB > BWD_COUNT_WIDER_BW ) + if ( st->count_SWB > BWD_COUNT_WIDER_BW_MDCT ) + { + st->input_bwidth = SWB; + st->count_SWB = BWD_COUNT_MAX; + + if ( st->count_FB > BWD_COUNT_WIDER_BW_MDCT ) + { + st->input_bwidth = FB; + st->count_FB = BWD_COUNT_MAX; + } + } + } + } + + if ( st->last_input_bwidth == WB && st->input_Fs > 16000 ) + { + if ( st->count_SWB > BWD_COUNT_WIDER_BW_MDCT ) { st->input_bwidth = SWB; st->count_SWB = BWD_COUNT_MAX; - if ( st->count_FB > BWD_COUNT_WIDER_BW ) + if ( st->count_FB > BWD_COUNT_WIDER_BW_MDCT ) { st->input_bwidth = FB; st->count_FB = BWD_COUNT_MAX; } } } - } - if ( st->last_input_bwidth == WB && st->input_Fs > 16000 ) - { - if ( st->count_SWB > BWD_COUNT_WIDER_BW ) + if ( st->last_input_bwidth == SWB && st->input_Fs > 32000 ) { - st->input_bwidth = SWB; - st->count_SWB = BWD_COUNT_MAX; - - if ( st->count_FB > BWD_COUNT_WIDER_BW ) + if ( st->count_FB > BWD_COUNT_WIDER_BW_MDCT ) { st->input_bwidth = FB; st->count_FB = BWD_COUNT_MAX; } } } - - if ( st->last_input_bwidth == SWB && st->input_Fs > 32000 ) + else { - if ( st->count_FB > BWD_COUNT_WIDER_BW ) +#endif + if ( st->last_input_bwidth == NB ) + { + if ( st->count_WB > BWD_COUNT_WIDER_BW ) + { + st->input_bwidth = WB; + st->count_WB = BWD_COUNT_MAX; + + if ( st->count_SWB > BWD_COUNT_WIDER_BW ) + { + st->input_bwidth = SWB; + st->count_SWB = BWD_COUNT_MAX; + + if ( st->count_FB > BWD_COUNT_WIDER_BW ) + { + st->input_bwidth = FB; + st->count_FB = BWD_COUNT_MAX; + } + } + } + } + + if ( st->last_input_bwidth == WB && st->input_Fs > 16000 ) + { + if ( st->count_SWB > BWD_COUNT_WIDER_BW ) + { + st->input_bwidth = SWB; + st->count_SWB = BWD_COUNT_MAX; + + if ( st->count_FB > BWD_COUNT_WIDER_BW ) + { + st->input_bwidth = FB; + st->count_FB = BWD_COUNT_MAX; + } + } + } + + if ( st->last_input_bwidth == SWB && st->input_Fs > 32000 ) { - st->input_bwidth = FB; - st->count_FB = BWD_COUNT_MAX; + if ( st->count_FB > BWD_COUNT_WIDER_BW ) + { + st->input_bwidth = FB; + st->count_FB = BWD_COUNT_MAX; + } } +#ifdef BWD_COUNT_FIX } +#endif /* switching to a lower BW */ if ( st->last_input_bwidth == FB ) diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c old mode 100644 new mode 100755 index 6e2f6b6db2..33587035ec --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -486,7 +486,12 @@ ivas_error pre_proc_front_ivas( if ( st->idchan == 0 && element_mode != IVAS_CPE_MDCT ) { - bw_detect( st, st->input, NULL, enerBuffer ); + bw_detect( st, st->input, NULL, enerBuffer +#ifdef BWD_COUNT_FIX + , + 0 +#endif + ); } if ( element_mode != IVAS_CPE_MDCT ) /* in MDCT stereo, set_bw_stereo() is used instead */ diff --git a/lib_enc/ivas_mdct_core_enc.c b/lib_enc/ivas_mdct_core_enc.c old mode 100644 new mode 100755 index c3a75784b5..d9f5f7225a --- a/lib_enc/ivas_mdct_core_enc.c +++ b/lib_enc/ivas_mdct_core_enc.c @@ -702,7 +702,12 @@ void ivas_mdct_core_whitening_enc( for ( n = 0; n < nSubframes; n++ ) { - bw_detect( st, NULL, st->hTcxEnc->spectrum[n], NULL ); + bw_detect( st, NULL, st->hTcxEnc->spectrum[n], NULL +#ifdef BWD_COUNT_FIX + , + mct_on +#endif + ); if ( nSubframes == NB_DIV && n == 0 ) { st->last_input_bwidth = st->input_bwidth; diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c old mode 100644 new mode 100755 index 300cb79787..eb9099be00 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -219,7 +219,12 @@ void pre_proc( * NB/WB/SWB/FB bandwidth detector *----------------------------------------------------------------*/ - bw_detect( st, st->input, NULL, enerBuffer ); + bw_detect( st, st->input, NULL, enerBuffer +#ifdef BWD_COUNT_FIX + , + 0 +#endif + ); /*----------------------------------------------------------------* * Noise energy down-ward update and total noise energy estimation -- GitLab From 728022f697b5f358b134af95a888c90e46e27b4f Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 24 Mar 2023 11:27:50 +0100 Subject: [PATCH 294/375] clang-format --- lib_com/prot.h | 8 ++++---- lib_dec/fd_cng_dec.c | 8 ++++---- lib_dec/ivas_ism_metadata_dec.c | 2 +- lib_dec/ivas_tcx_core_dec.c | 6 +++--- lib_enc/ivas_ism_metadata_enc.c | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib_com/prot.h b/lib_com/prot.h index 5bcc4c950d..687442cb12 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -2229,7 +2229,7 @@ ivas_error init_encoder( const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ const int16_t interval_SID, /* i : interval for SID update */ const int16_t vad_only_flag, /* i : flag to indicate front-VAD structure */ - const ISM_MODE ism_mode /* i : ISM mode */ + const ISM_MODE ism_mode /* i : ISM mode */ ); void LPDmem_enc_init( @@ -8518,10 +8518,10 @@ void generate_comfort_noise_dec( ); void generate_comfort_noise_dec_hf( - float **bufferReal, /* o : Real part of input bands */ - float **bufferImag, /* o : Imaginary part of input bands */ + float **bufferReal, /* o : Real part of input bands */ + float **bufferImag, /* o : Imaginary part of input bands */ HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - const int16_t cng_flag /* i : CNG Flag */ + const int16_t cng_flag /* i : CNG Flag */ ); void generate_masking_noise( diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 65662e5fa8..b9d1920f39 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -1340,10 +1340,10 @@ void generate_comfort_noise_dec( *-------------------------------------------------------------------*/ void generate_comfort_noise_dec_hf( - float **bufferReal, /* o : Real part of input bands */ - float **bufferImag, /* o : Imaginary part of input bands */ - HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - const int16_t cng_coh_flag /* i : CNG Flag for coherence handling */ + float **bufferReal, /* o : Real part of input bands */ + float **bufferImag, /* o : Imaginary part of input bands */ + HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ + const int16_t cng_coh_flag /* i : CNG Flag for coherence handling */ ) { int16_t i, j; diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index bc17d7a6cc..635245fb6f 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -143,7 +143,7 @@ static void ism_metadata_smooth( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_dec( - const int32_t ism_total_brate, /* i : ISM total bitrate */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ #ifdef NCHAN_ISM_PARAMETER const int16_t nchan_ism, /* i : number of ISM channels */ #endif diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 40c562a3b2..56059bd29d 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -160,11 +160,11 @@ void stereo_tcx_core_dec( const int16_t last_element_mode, /* i : last element mode */ const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ - const int16_t nchan_out, /* i : number of output channels */ - const IVAS_FORMAT ivas_format /* i : IVAS format */ + const int16_t nchan_out, /* i : number of output channels */ + const IVAS_FORMAT ivas_format /* i : IVAS format */ #ifndef DISCRETE_ISM_DTX_CNG , - const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM)*/ + const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM)*/ #endif ) { diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 60b3001087..6e8409e862 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -87,7 +87,7 @@ ivas_error ivas_set_ism_metadata( ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ const float azimuth, /* i : azimuth value */ #ifdef TD5 - const float elevation, /* i : elevation */ + const float elevation, /* i : elevation */ const float radius_meta, /* i : radius */ const float yaw, /* i : yaw */ const float pitch /* i : pitch */ @@ -176,7 +176,7 @@ static void rate_ism_importance( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_enc( - const int32_t ism_total_brate, /* i : ISM total bitrate */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ #ifdef NCHAN_ISM_PARAMETER const int16_t nchan_ism, /* i : number of ISM channels */ #endif -- GitLab From d96a6fc284f3e7bd178009ad4e7dd88f31387159 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 24 Mar 2023 11:39:46 +0100 Subject: [PATCH 295/375] fix compilation warnings --- lib_dec/ivas_ism_metadata_dec.c | 5 ++--- lib_dec/ivas_ism_param_dec.c | 7 +++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 635245fb6f..f8ee085dc9 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -663,7 +663,7 @@ ivas_error ivas_ism_metadata_dec( { ism_metadata_smooth( hIsmMeta, ism_total_brate, nchan_ism ); } - hISMDTX.ism_dtx_hangover_cnt = min( ( hISMDTX.ism_dtx_hangover_cnt )++, IVAS_ISM_DTX_HO_MAX ); + hISMDTX.ism_dtx_hangover_cnt = min( hISMDTX.ism_dtx_hangover_cnt++, IVAS_ISM_DTX_HO_MAX ); #endif /*----------------------------------------------------------------* @@ -1039,7 +1039,7 @@ void ivas_ism_metadata_sid_dec( int16_t nb_bits_metadata[] /* o : number of metadata bits */ ) { - int16_t i, ch, nb_bits_start, last_bit_pos; + int16_t i, ch, last_bit_pos; float q_step, q_step_border; int16_t idx, idx_azimuth, idx_elevation; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; @@ -1060,7 +1060,6 @@ void ivas_ism_metadata_sid_dec( /* initialization */ st0 = hSCE[0]->hCoreCoder[0]; - nb_bits_start = 0; last_bit_pos = (int16_t) ( ( ism_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); bstr_orig = st0->bit_stream; next_bit_pos_orig = st0->next_bit_pos; diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index c697275b37..3595ad3261 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -422,7 +422,9 @@ ivas_error ivas_param_ism_dec_open( IVAS_OUTPUT_SETUP hOutSetup; AUDIO_CONFIG output_config; int32_t output_Fs; +#ifndef NCHAN_ISM_PARAMETER int16_t nchan_out; +#endif ivas_error error; error = IVAS_ERR_OK; @@ -451,11 +453,12 @@ ivas_error ivas_param_ism_dec_open( output_Fs = st_ivas->hDecoderConfig->output_Fs; output_config = st_ivas->hDecoderConfig->output_config; - nchan_out = st_ivas->hDecoderConfig->nchan_out; - #ifdef NCHAN_ISM_PARAMETER + ivas_param_ism_config( hDirAC->hParamIsm, st_ivas->nchan_ism ); #else + nchan_out = st_ivas->hDecoderConfig->nchan_out; + if ( output_config == AUDIO_CONFIG_EXTERNAL ) { hDirAC->hParamIsm->num_obj = nchan_out; -- GitLab From 2891b7a7723fe0889671459e298c9ac4c360e524 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 24 Mar 2023 12:25:58 +0100 Subject: [PATCH 296/375] fix compilation warning --- lib_dec/ivas_ism_metadata_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index f8ee085dc9..39467ada1e 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -662,8 +662,8 @@ ivas_error ivas_ism_metadata_dec( if ( hISMDTX.ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) { ism_metadata_smooth( hIsmMeta, ism_total_brate, nchan_ism ); + hISMDTX.ism_dtx_hangover_cnt += 1; } - hISMDTX.ism_dtx_hangover_cnt = min( hISMDTX.ism_dtx_hangover_cnt++, IVAS_ISM_DTX_HO_MAX ); #endif /*----------------------------------------------------------------* -- GitLab From 0ec50da40610b0536b94e299fa9237593c67b4a1 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Fri, 24 Mar 2023 14:03:27 +0100 Subject: [PATCH 297/375] cleanup and merge fixes under define FIX_MDCT_BASED_BWD --- lib_com/options.h | 4 +--- lib_com/prot.h | 2 +- lib_enc/amr_wb_enc.c | 2 +- lib_enc/bw_detect.c | 13 ++++++------- lib_enc/ivas_core_pre_proc_front.c | 2 +- lib_enc/ivas_mct_enc.c | 10 +--------- lib_enc/ivas_mdct_core_enc.c | 6 ++---- lib_enc/pre_proc.c | 2 +- 8 files changed, 14 insertions(+), 27 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 0bccd3b107..96361e3b89 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,11 +157,9 @@ #ifdef FIX_I109_ORIENTATION_TRACKING #define OTR_REFERENCE_VECTOR_TRACKING /* FhG: enables the reference position orientation tracking mode */ #endif -//#define DISABLE_BWD_MCT /* FhG: Disable bandwidth detection for MCT*/ -#define FIX_MDCT_STEREO_BWD_TCX10 /* FhG: enables bw detection also for TCX10 frames */ -#define BWD_COUNT_FIX /* FhG/Dolby: fix for issue of reacting to sudden transiensts in SBA/MCT modes */ #define FIX_380_BFI_PARAMISM /* VA: issue 380 - fix metadata recovery in ParamISM BFI */ +#define FIX_MDCT_BASED_BWD /* FhG: fixes for BWD for issues with reaction to transients for MDCT-stereo and MCT */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 8d625fde56..fc1dcad992 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -3827,7 +3827,7 @@ void bw_detect( const float signal_in[], /* i : input signal */ float *spectrum, /* i : MDCT spectrum */ const float *enerBuffer /* i : energy buffer */ -#ifdef BWD_COUNT_FIX +#ifdef FIX_MDCT_BASED_BWD , const int16_t mct_on /* i : flag MCT mode */ #endif diff --git a/lib_enc/amr_wb_enc.c b/lib_enc/amr_wb_enc.c index 8e9879b0ef..88b3faa5d6 100755 --- a/lib_enc/amr_wb_enc.c +++ b/lib_enc/amr_wb_enc.c @@ -343,7 +343,7 @@ void amr_wb_enc( *----------------------------------------------------------------*/ bw_detect( st, st->input, NULL, NULL -#ifdef BWD_COUNT_FIX +#ifdef FIX_MDCT_BASED_BWD , 0 #endif diff --git a/lib_enc/bw_detect.c b/lib_enc/bw_detect.c index 40dd0e180d..c08a703c42 100755 --- a/lib_enc/bw_detect.c +++ b/lib_enc/bw_detect.c @@ -57,7 +57,7 @@ #define BWD_COUNT_MAX 100 #define BWD_COUNT_WIDER_BW 10 -#ifdef BWD_COUNT_FIX +#ifdef FIX_MDCT_BASED_BWD #define BWD_COUNT_WIDER_BW_MDCT 0 #endif @@ -74,7 +74,7 @@ void bw_detect( const float signal_in[], /* i : input signal */ float *spectrum, /* i : MDCT spectrum */ const float *enerBuffer /* i : energy buffer */ -#ifdef BWD_COUNT_FIX +#ifdef FIX_MDCT_BASED_BWD , const int16_t mct_on /* i : flag MCT mode */ #endif @@ -180,7 +180,7 @@ void bw_detect( } else { -#ifndef FIX_MDCT_STEREO_BWD_TCX10 +#ifndef FIX_MDCT_BASED_BWD bin_width *= (int16_t) ( ( st->input_Fs / FRAMES_PER_SEC ) / BWD_TOTAL_WIDTH ); mvr2r( spectrum, spect, (int16_t) ( st->input_Fs / FRAMES_PER_SEC ) ); #else @@ -403,7 +403,7 @@ void bw_detect( *---------------------------------------------------------------------*/ /* switching to a higher BW */ -#ifdef BWD_COUNT_FIX +#ifdef FIX_MDCT_BASED_BWD if ( st->element_mode == IVAS_CPE_MDCT && ( st->element_brate > IVAS_64k || mct_on ) ) { if ( st->last_input_bwidth == NB ) @@ -498,7 +498,7 @@ void bw_detect( st->count_FB = BWD_COUNT_MAX; } } -#ifdef BWD_COUNT_FIX +#ifdef FIX_MDCT_BASED_BWD } #endif @@ -714,7 +714,7 @@ void set_bw_stereo( return; } -#ifndef DISABLE_BWD_MCT + /*-------------------------------------------------------------------* * set_bw_mct() * @@ -765,4 +765,3 @@ int16_t set_bw_mct( return bw_changed; } -#endif diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index 33587035ec..85eba72f00 100755 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -487,7 +487,7 @@ ivas_error pre_proc_front_ivas( if ( st->idchan == 0 && element_mode != IVAS_CPE_MDCT ) { bw_detect( st, st->input, NULL, enerBuffer -#ifdef BWD_COUNT_FIX +#ifdef FIX_MDCT_BASED_BWD , 0 #endif diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 746b1cae4e..b66a2c5733 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -109,9 +109,7 @@ ivas_error ivas_mct_enc( CPE_ENC_HANDLE hCPE; float mdst_spectrum_long[MCT_MAX_BLOCKS][CPE_CHANNELS][L_FRAME48k]; float orig_spectrum_long[MCT_MAX_BLOCKS][CPE_CHANNELS][L_FRAME48k]; -#ifndef DISABLE_BWD_MCT int16_t switch_bw; -#endif IVAS_FORMAT ivas_format; int16_t max_bwidth; int32_t ivas_total_brate; @@ -162,10 +160,8 @@ ivas_error ivas_mct_enc( } } -#ifndef DISABLE_BWD_MCT /* set coded audio band-width */ switch_bw = set_bw_mct( st_ivas->hCPE, st_ivas->nCPE ); -#endif /* pre-processing */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) @@ -177,11 +173,7 @@ ivas_error ivas_mct_enc( } /* joint MCT encoding */ - ivas_mct_core_enc( ivas_format, hMCT, st_ivas->hCPE, hMCT->nchan_out_woLFE + hMCT->num_lfe, ivas_total_brate, -#ifndef DISABLE_BWD_MCT - switch_bw, -#endif - ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) ? (int16_t) st_ivas->hLFE->lfe_bits : 0, st_ivas->hEncoderConfig->sba_order ); + ivas_mct_core_enc( ivas_format, hMCT, st_ivas->hCPE, hMCT->nchan_out_woLFE + hMCT->num_lfe, ivas_total_brate, switch_bw, ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) ? (int16_t) st_ivas->hLFE->lfe_bits : 0, st_ivas->hEncoderConfig->sba_order ); /* Spectrum quantization and coding */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) diff --git a/lib_enc/ivas_mdct_core_enc.c b/lib_enc/ivas_mdct_core_enc.c index d9f5f7225a..152f264295 100755 --- a/lib_enc/ivas_mdct_core_enc.c +++ b/lib_enc/ivas_mdct_core_enc.c @@ -686,8 +686,7 @@ void ivas_mdct_core_whitening_enc( core_signal_analysis_high_bitrate( new_samples[ch] + L_INP_MEM, T_op[ch], NULL, NULL, st, mdst_spectrum[ch], tnsSize[ch], tnsBits[ch], param_core[ch], <pBits[ch], windowedSignal[ch], st->L_frame, st->hTcxEnc->L_frameTCX, hCPE->last_element_mode, 0 ); /* BWD in MDCT domain */ -#ifndef DISABLE_BWD_MCT -#ifndef FIX_MDCT_STEREO_BWD_TCX10 +#ifndef FIX_MDCT_BASED_BWD if ( st->hTcxEnc->transform_type[0] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) { if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) @@ -703,7 +702,7 @@ void ivas_mdct_core_whitening_enc( for ( n = 0; n < nSubframes; n++ ) { bw_detect( st, NULL, st->hTcxEnc->spectrum[n], NULL -#ifdef BWD_COUNT_FIX +#ifdef FIX_MDCT_BASED_BWD , mct_on #endif @@ -714,7 +713,6 @@ void ivas_mdct_core_whitening_enc( } } } -#endif #endif if ( st->last_core == ACELP_CORE ) /* reset past kernel info */ diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c index eb9099be00..bbeba48a16 100755 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -220,7 +220,7 @@ void pre_proc( *----------------------------------------------------------------*/ bw_detect( st, st->input, NULL, enerBuffer -#ifdef BWD_COUNT_FIX +#ifdef FIX_MDCT_BASED_BWD , 0 #endif -- GitLab From 9cf62c09e7fa765d01cb02a99ad2978664b09134 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 24 Mar 2023 15:26:42 +0100 Subject: [PATCH 298/375] merge FIX_DTX_BRATE_LIMIT, FORCE_EST and FIX_MD_SMOOTH_PARAMISM into DISCRETE_ISM_DTX_CNG --- lib_com/ivas_prot.h | 2 -- lib_com/options.h | 6 ------ lib_dec/fd_cng_dec.c | 2 +- lib_dec/init_dec.c | 2 +- lib_dec/ivas_init_dec.c | 2 +- lib_dec/ivas_ism_dtx_dec.c | 4 ---- lib_dec/ivas_ism_metadata_dec.c | 5 +---- lib_dec/stat_dec.h | 2 +- lib_enc/ivas_ism_dtx_enc.c | 12 +++--------- lib_enc/ivas_ism_enc.c | 8 -------- 10 files changed, 8 insertions(+), 37 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 6a07bd7835..1b70d43bb5 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -943,9 +943,7 @@ ivas_error ivas_ism_dtx_open( int16_t ivas_ism_dtx_enc( ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ -#ifdef FIX_DTX_BRATE_LIMIT const int32_t ivas_total_brate, /* i : IVAS total bitrate */ -#endif const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ diff --git a/lib_com/options.h b/lib_com/options.h index eb023f54a7..2ed001b78a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,13 +159,7 @@ #endif #define FIX_380_BFI_PARAMISM /* VA: issue 380 - fix metadata recovery in ParamISM BFI */ - #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ -#define FIX_DTX_BRATE_LIMIT /* VA: limit the DTX usage in background noise to lower bitrates similarly as in other IVAS formats */ -#ifdef DISCRETE_ISM_DTX_CNG -#define FORCE_EST /* FhG: force ACELP noise estimation in ISM mode for first 100 frames to prevent all-zero CNG */ -#define FIX_MD_SMOOTH_PARAMISM /* VA: apply decoder MD smoothing in paramISM also for objects 3 and 4 */ -#endif #define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index b9d1920f39..ab9465a93a 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -420,7 +420,7 @@ void ApplyFdCng( hFdCngCom->sid_frame_counter = 0; /* set noise estimation inactive during concealment, as no update with noise generated by concealment should be performed. */ /* set noise estimation inactive when we have bit errors, as no update with noise generated by corrupt frame (biterror) should be performed. */ -#ifndef FORCE_EST +#ifndef DISCRETE_ISM_DTX_CNG if ( concealWholeFrame == 0 && ( timeDomainInput == NULL || ( *timeDomainInput( -FLT_MAX ) && diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 1666e8b304..34ee7a3cec 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -740,7 +740,7 @@ ivas_error init_decoder( st->cng_sba_flag = 0; st->cng_ism_flag = 0; st->read_sid_info = 1; /* by default read the sid info from bitstream */ -#ifdef FORCE_EST +#ifdef DISCRETE_ISM_DTX_CNG st->is_ism_format = 0; #endif diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 1b920609ff..ca20d75b15 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -904,7 +904,7 @@ ivas_error ivas_init_decoder( reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); -#ifdef FORCE_EST +#ifdef DISCRETE_ISM_DTX_CNG st_ivas->hSCE[sce_id]->hCoreCoder[0]->is_ism_format = 1; #endif } diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 40669be913..6834c868d2 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -229,11 +229,7 @@ ivas_error ivas_ism_dtx_dec( } } -#ifdef FIX_MD_SMOOTH_PARAMISM update_last_metadata( nchan_ism, st_ivas->hIsmMetaData, md_diff_flag ); -#else - update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); -#endif st_ivas->hISMDTX.ism_dtx_hangover_cnt = 0; #endif diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 39467ada1e..25f500b7fc 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -728,11 +728,8 @@ ivas_error ivas_ism_metadata_dec( *----------------------------------------------------------------*/ set_s( md_diff_flag, 1, nchan_ism ); -#ifdef FIX_MD_SMOOTH_PARAMISM + update_last_metadata( nchan_ism, hIsmMeta, md_diff_flag ); -#else - update_last_metadata( *nchan_transport, hIsmMeta, md_diff_flag ); -#endif #endif for ( ch = 0; ch < *nchan_transport; ch++ ) diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 5563bfd7f7..1a82d45587 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1347,7 +1347,7 @@ typedef struct Decoder_State int16_t cng_ism_flag; /* CNG in Param-ISM flag */ int16_t read_sid_info; /* For ParamISM, use the transmitted noise */ -#ifdef FORCE_EST +#ifdef DISCRETE_ISM_DTX_CNG int16_t is_ism_format; /* Indication whether the codec operates in ISM format */ #endif diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 23c592ea91..542519bf7a 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -104,11 +104,9 @@ ivas_error ivas_ism_dtx_open( /*! r: indication of DTX frame */ int16_t ivas_ism_dtx_enc( - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ -#ifdef FIX_DTX_BRATE_LIMIT - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ -#endif + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ @@ -121,9 +119,7 @@ int16_t ivas_ism_dtx_enc( int16_t nBits, nBits_MD_max; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; float lp_noise[MAX_NUM_OBJECTS], lp_noise_variation, lp_noise_mean; -#ifdef FIX_DTX_BRATE_LIMIT float lp_noise_max; -#endif float tmp1, tmp2; /* initialization */ @@ -159,7 +155,6 @@ int16_t ivas_ism_dtx_enc( } -#ifdef FIX_DTX_BRATE_LIMIT /* default DTX is applied at lower bitrates; otherwise DTX is applied only in silence */ maximum( lp_noise, nchan_ism, &lp_noise_max ); @@ -171,7 +166,6 @@ int16_t ivas_ism_dtx_enc( { dtx_flag = 0; } -#endif /*------------------------------------------------------------------* * Reset the bitstream diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index e1d456c9e6..b30919043f 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -213,11 +213,7 @@ ivas_error ivas_ism_enc( /* analysis and decision about DTX */ #ifdef DISCRETE_ISM_DTX_CNG -#ifdef FIX_DTX_BRATE_LIMIT dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->hEncoderConfig->ivas_total_brate, nchan_ism, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); -#else - dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, nchan_ism, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); -#endif #else dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); #endif @@ -288,11 +284,7 @@ ivas_error ivas_ism_enc( } #ifdef DISCRETE_ISM_DTX_CNG -#ifdef FIX_MD_SMOOTH_PARAMISM update_last_metadata( nchan_ism, st_ivas->hIsmMetaData, md_diff_flag ); -#else - update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); -#endif #endif /*----------------------------------------------------------------* -- GitLab From d9f3c80a1dad5ecb9e08dd15fe62495925fa0755 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 24 Mar 2023 16:11:17 +0100 Subject: [PATCH 299/375] reduction of code size --- lib_enc/bw_detect.c | 124 +++++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 72 deletions(-) diff --git a/lib_enc/bw_detect.c b/lib_enc/bw_detect.c index 40dd0e180d..f815e7d67b 100755 --- a/lib_enc/bw_detect.c +++ b/lib_enc/bw_detect.c @@ -87,6 +87,15 @@ void bw_detect( const float *pt, *pt1; float max_NB, max_WB, max_SWB, max_FB, mean_NB, mean_WB, mean_SWB, mean_FB; int16_t cldfb_bin_width = 4; +#ifdef BWD_COUNT_FIX + int16_t bwd_count_wider_bw; + + bwd_count_wider_bw = BWD_COUNT_WIDER_BW; + if ( st->element_mode == IVAS_CPE_MDCT && ( st->element_brate > IVAS_64k || mct_on ) ) + { + bwd_count_wider_bw = BWD_COUNT_WIDER_BW_MDCT; + } +#endif if ( st->input_Fs > 8000 ) { @@ -403,104 +412,75 @@ void bw_detect( *---------------------------------------------------------------------*/ /* switching to a higher BW */ -#ifdef BWD_COUNT_FIX - if ( st->element_mode == IVAS_CPE_MDCT && ( st->element_brate > IVAS_64k || mct_on ) ) - { - if ( st->last_input_bwidth == NB ) - { - if ( st->count_WB > BWD_COUNT_WIDER_BW_MDCT ) - { - st->input_bwidth = WB; - st->count_WB = BWD_COUNT_MAX; - - if ( st->count_SWB > BWD_COUNT_WIDER_BW_MDCT ) - { - st->input_bwidth = SWB; - st->count_SWB = BWD_COUNT_MAX; - - if ( st->count_FB > BWD_COUNT_WIDER_BW_MDCT ) - { - st->input_bwidth = FB; - st->count_FB = BWD_COUNT_MAX; - } - } - } - } - - if ( st->last_input_bwidth == WB && st->input_Fs > 16000 ) - { - if ( st->count_SWB > BWD_COUNT_WIDER_BW_MDCT ) - { - st->input_bwidth = SWB; - st->count_SWB = BWD_COUNT_MAX; - - if ( st->count_FB > BWD_COUNT_WIDER_BW_MDCT ) - { - st->input_bwidth = FB; - st->count_FB = BWD_COUNT_MAX; - } - } - } - - if ( st->last_input_bwidth == SWB && st->input_Fs > 32000 ) - { - if ( st->count_FB > BWD_COUNT_WIDER_BW_MDCT ) - { - st->input_bwidth = FB; - st->count_FB = BWD_COUNT_MAX; - } - } - } - else + if ( st->last_input_bwidth == NB ) { +#ifdef BWD_COUNT_FIX + if ( st->count_WB > bwd_count_wider_bw ) +#else + if ( st->count_WB > BWD_COUNT_WIDER_BW ) #endif - if ( st->last_input_bwidth == NB ) { - if ( st->count_WB > BWD_COUNT_WIDER_BW ) - { - st->input_bwidth = WB; - st->count_WB = BWD_COUNT_MAX; - - if ( st->count_SWB > BWD_COUNT_WIDER_BW ) - { - st->input_bwidth = SWB; - st->count_SWB = BWD_COUNT_MAX; - - if ( st->count_FB > BWD_COUNT_WIDER_BW ) - { - st->input_bwidth = FB; - st->count_FB = BWD_COUNT_MAX; - } - } - } - } + st->input_bwidth = WB; + st->count_WB = BWD_COUNT_MAX; - if ( st->last_input_bwidth == WB && st->input_Fs > 16000 ) - { +#ifdef BWD_COUNT_FIX + if ( st->count_SWB > bwd_count_wider_bw ) +#else if ( st->count_SWB > BWD_COUNT_WIDER_BW ) +#endif { st->input_bwidth = SWB; st->count_SWB = BWD_COUNT_MAX; +#ifdef BWD_COUNT_FIX + if ( st->count_FB > bwd_count_wider_bw ) +#else if ( st->count_FB > BWD_COUNT_WIDER_BW ) +#endif { st->input_bwidth = FB; st->count_FB = BWD_COUNT_MAX; } } } + } - if ( st->last_input_bwidth == SWB && st->input_Fs > 32000 ) + if ( st->last_input_bwidth == WB && st->input_Fs > 16000 ) + { +#ifdef BWD_COUNT_FIX + if ( st->count_SWB > bwd_count_wider_bw ) +#else + if ( st->count_SWB > BWD_COUNT_WIDER_BW ) +#endif { + st->input_bwidth = SWB; + st->count_SWB = BWD_COUNT_MAX; + +#ifdef BWD_COUNT_FIX + if ( st->count_FB > bwd_count_wider_bw ) +#else if ( st->count_FB > BWD_COUNT_WIDER_BW ) +#endif { st->input_bwidth = FB; st->count_FB = BWD_COUNT_MAX; } } -#ifdef BWD_COUNT_FIX } + + if ( st->last_input_bwidth == SWB && st->input_Fs > 32000 ) + { +#ifdef BWD_COUNT_FIX + if ( st->count_FB > bwd_count_wider_bw ) +#else + if ( st->count_FB > BWD_COUNT_WIDER_BW ) #endif + { + st->input_bwidth = FB; + st->count_FB = BWD_COUNT_MAX; + } + } + /* switching to a lower BW */ if ( st->last_input_bwidth == FB ) -- GitLab From b4c3b563f9e6e18cffdf1b91cc3c7a34a70e06a6 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 08:33:43 +0200 Subject: [PATCH 300/375] temporarily deactivate NCHAN_ISM_PARAMETER --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2ed001b78a..e540b74da5 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,7 @@ #define FIX_380_BFI_PARAMISM /* VA: issue 380 - fix metadata recovery in ParamISM BFI */ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ -#define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ +//#define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ /* ################## End DEVELOPMENT switches ######################### */ -- GitLab From 00498e1628136d363327c9a95e8dcea87676568f Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 09:07:40 +0200 Subject: [PATCH 301/375] - activate again DISCRETE_ISM_DTX_CNG + fix compilation warnings when it is not activated --- lib_com/options.h | 2 +- lib_dec/ivas_ism_metadata_dec.c | 2 +- lib_enc/ivas_ism_enc.c | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 5d88009f73..c054a9b5a7 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,7 @@ #define FIX_380_BFI_PARAMISM /* VA: issue 380 - fix metadata recovery in ParamISM BFI */ #define FIX_MDCT_BASED_BWD /* FhG: fixes for BWD for issues with reaction to transients for MDCT-stereo and MCT */ -//#define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ +#define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ #define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 25f500b7fc..d610af012a 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -216,7 +216,7 @@ ivas_error ivas_ism_metadata_dec( #endif pop_wmops(); - return error; + return IVAS_ERR_OK; } #endif diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 484c56a57f..8aa4d41623 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -90,9 +90,10 @@ ivas_error ivas_ism_enc( int16_t md_diff_flag[MAX_NUM_OBJECTS]; #else #ifdef NCHAN_ISM_PARAMETER - int16_t nchan_ism; -#endif + int16_t nchan_ism, dtx_flag, sid_flag; +#else int16_t dtx_flag, sid_flag, flag_noisy_speech; +#endif int16_t i, nBits; #endif ivas_error error; @@ -107,7 +108,9 @@ ivas_error ivas_ism_enc( dtx_flag = 0; sid_flag = 0; +#if ( !defined NCHAN_ISM_PARAMETER || defined DISCRETE_ISM_DTX_CNG ) flag_noisy_speech = 0; +#endif #ifdef NCHAN_ISM_PARAMETER nchan_ism = st_ivas->hEncoderConfig->nchan_ism; -- GitLab From 958f8709c143becd0c50c07ffd5411d824c452bb Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 09:18:49 +0200 Subject: [PATCH 302/375] - temporarily disable TD5 and TD5_FIX_INVALID_MEMORY_ACCESS +fix compilation when they are disabled --- lib_com/options.h | 4 ++-- lib_dec/ivas_ism_metadata_dec.c | 10 ++++++++++ lib_enc/ivas_ism_enc.c | 12 ++++++++++-- lib_enc/ivas_ism_metadata_enc.c | 10 ++++++++++ lib_rend/ivas_objectRenderer.c | 3 +++ 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c054a9b5a7..c4a191657f 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,8 +149,8 @@ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ #define FIX_372_LIB_REND_VALIDATE_IO /* FhG: Issue 372: IVAS_rend segfaults with unsupported I/O configs - add validation checks of I/O config */ #define FIX_376_SBA_ROTATE /*DLB: Fix for issue 376*/ -#define TD5 /* Eri: Contribution 17: Extended metadata for 6 DoF rendering in TD renderer */ -#define TD5_FIX_INVALID_MEMORY_ACCESS /* FhG: Resolves segfault in case IVAS_REND_InitConfig gets initialized with rendererConfigEnabled:=false && ISM are being rendered */ +//#define TD5 /* Eri: Contribution 17: Extended metadata for 6 DoF rendering in TD renderer */ +//#define TD5_FIX_INVALID_MEMORY_ACCESS /* FhG: Resolves segfault in case IVAS_REND_InitConfig gets initialized with rendererConfigEnabled:=false && ISM are being rendered */ #define FIX_371_DELAY_REPORT /* Issue 371: div. by zero with -no_delay_cmp */ #define FIX_373_MASA_DELAY_COMP_MSAN /* Nokia: Issue 373: MASA audio/meta delay compensation. MSAN bugfix */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index d610af012a..bc563a64da 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -1163,13 +1163,23 @@ void ivas_ism_metadata_sid_dec( /* update last indexes to correspond to active frames coding */ if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) { +#ifdef MD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); +#else + hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); + hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); +#endif } else { +#ifdef MD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); +#else + hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); + hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); +#endif } /* save for smoothing metadata evolution */ diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 8aa4d41623..230f0b8da1 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -277,7 +277,11 @@ ivas_error ivas_ism_enc( #endif st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #else - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); + ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, +#ifdef NCHAN_ISM_PARAMETER + nchan_ism, +#endif + st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); #endif } else /* ISM_MODE_DISC */ @@ -289,7 +293,11 @@ ivas_error ivas_ism_enc( #endif st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #else - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL ); + ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, +#ifdef NCHAN_ISM_PARAMETER + nchan_ism, +#endif + st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL ); #endif } diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 6e8409e862..231d32c0aa 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -1425,13 +1425,23 @@ void ivas_ism_metadata_sid_enc( /* update last indexes to correspond to active frames coding */ if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) { +#ifdef MD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); +#else + hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); + hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); +#endif } else { +#ifdef MD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); +#else + hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); + hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); +#endif } } } diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 67b73db6a6..67f73fab30 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -612,7 +612,10 @@ ivas_error ivas_td_binaural_open_ext( #ifdef TD5 #ifdef TD5_FIX_INVALID_MEMORY_ACCESS if ( NULL != hRendCfg ) + { directivity = hRendCfg->directivity; + } + return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, directivity, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); #else return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, hRendCfg->directivity, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); -- GitLab From 55d6565496dc1a82ac6e4f70581be06b5cf21702 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 09:23:24 +0200 Subject: [PATCH 303/375] activate again TD5 and TD5_FIX_INVALID_MEMORY_ACCESS --- lib_com/options.h | 4 ++-- lib_dec/ivas_ism_metadata_dec.c | 4 ++-- lib_enc/ivas_ism_metadata_enc.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c4a191657f..c054a9b5a7 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,8 +149,8 @@ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ #define FIX_372_LIB_REND_VALIDATE_IO /* FhG: Issue 372: IVAS_rend segfaults with unsupported I/O configs - add validation checks of I/O config */ #define FIX_376_SBA_ROTATE /*DLB: Fix for issue 376*/ -//#define TD5 /* Eri: Contribution 17: Extended metadata for 6 DoF rendering in TD renderer */ -//#define TD5_FIX_INVALID_MEMORY_ACCESS /* FhG: Resolves segfault in case IVAS_REND_InitConfig gets initialized with rendererConfigEnabled:=false && ISM are being rendered */ +#define TD5 /* Eri: Contribution 17: Extended metadata for 6 DoF rendering in TD renderer */ +#define TD5_FIX_INVALID_MEMORY_ACCESS /* FhG: Resolves segfault in case IVAS_REND_InitConfig gets initialized with rendererConfigEnabled:=false && ISM are being rendered */ #define FIX_371_DELAY_REPORT /* Issue 371: div. by zero with -no_delay_cmp */ #define FIX_373_MASA_DELAY_COMP_MSAN /* Nokia: Issue 373: MASA audio/meta delay compensation. MSAN bugfix */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index bc563a64da..99f94fa536 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -1163,7 +1163,7 @@ void ivas_ism_metadata_sid_dec( /* update last indexes to correspond to active frames coding */ if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) { -#ifdef MD5 +#ifdef TD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); #else @@ -1173,7 +1173,7 @@ void ivas_ism_metadata_sid_dec( } else { -#ifdef MD5 +#ifdef TD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); #else diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 231d32c0aa..1540e35ce4 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -1425,7 +1425,7 @@ void ivas_ism_metadata_sid_enc( /* update last indexes to correspond to active frames coding */ if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) { -#ifdef MD5 +#ifdef TD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); #else @@ -1435,7 +1435,7 @@ void ivas_ism_metadata_sid_enc( } else { -#ifdef MD5 +#ifdef TD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); #else -- GitLab From ab138199ee23eac747df077c871ae69a9cb529e4 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 09:52:02 +0200 Subject: [PATCH 304/375] fix uninitialized error if 'md_diff_flag' --- lib_enc/ivas_ism_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 230f0b8da1..25ce78ff2e 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -125,8 +125,8 @@ ivas_error ivas_ism_enc( nchan_ism = st_ivas->nchan_transport; } #endif - set_s( md_diff_flag, 1, nchan_ism ); #endif + set_s( md_diff_flag, 1, nchan_ism ); /*------------------------------------------------------------------* * Preprocesing -- GitLab From 45da254d6bb8914ac507b238d85260b430e21ce7 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 12:32:38 +0200 Subject: [PATCH 305/375] fix MSAN error --- lib_dec/ivas_ism_dtx_dec.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 9faeceb733..1a4325f528 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -242,13 +242,16 @@ ivas_error ivas_ism_dtx_dec( st_ivas->hISMDTX.ism_dtx_hangover_cnt = 0; #endif - for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) + if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) { + for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) + { #ifdef DISCRETE_ISM_DTX_CNG - nb_bits_metadata[ch] = nb_bits_metadata[sce_id_dtx]; + nb_bits_metadata[ch] = nb_bits_metadata[sce_id_dtx]; #else - nb_bits_metadata[ch] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; + nb_bits_metadata[ch] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; #endif + } } #ifdef DISCRETE_ISM_DTX_CNG -- GitLab From dc332722e0240a9848ba887261bdd5661f11816e Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 12:37:03 +0200 Subject: [PATCH 306/375] comment --- lib_dec/ivas_ism_dtx_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 1a4325f528..ef52c082b7 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -262,7 +262,7 @@ ivas_error ivas_ism_dtx_dec( { for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) { - ivas_ism_preprocessing( st_ivas, ch ); + ivas_ism_preprocessing( st_ivas, ch ); // VE: after the acceptance of switches, replace the function call by its content } } -- GitLab From a71848d71b2847cece763e7adb790a31e125bbc6 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 13:07:19 +0200 Subject: [PATCH 307/375] fix one more MSAN error --- lib_enc/ivas_ism_dtx_enc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 542519bf7a..3839a42a9d 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -146,8 +146,8 @@ int16_t ivas_ism_dtx_enc( lp_noise[ch] = hSCE[ch]->hCoreCoder[0]->lp_noise; } - lp_noise_variation = var( lp_noise, nchan_ism ); - lp_noise_mean = mean( lp_noise, nchan_ism ); + lp_noise_variation = var( lp_noise, nchan_transport ); + lp_noise_mean = mean( lp_noise, nchan_transport ); if ( lp_noise_mean > 50 || ( lp_noise_mean > 25 && lp_noise_variation > 32 ) ) { @@ -156,7 +156,7 @@ int16_t ivas_ism_dtx_enc( /* default DTX is applied at lower bitrates; otherwise DTX is applied only in silence */ - maximum( lp_noise, nchan_ism, &lp_noise_max ); + maximum( lp_noise, nchan_transport, &lp_noise_max ); if ( !( ( nchan_ism == 1 && ivas_total_brate <= IVAS_24k4 ) || ( nchan_ism == 2 && ivas_total_brate <= IVAS_48k ) || -- GitLab From f27942d3093637f687418c1a83350915ecdd20ac Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 13:22:49 +0000 Subject: [PATCH 308/375] Update self_test.prm --- scripts/config/self_test.prm | 198 +++++++++++++++++++---------------- 1 file changed, 110 insertions(+), 88 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 223ac0352c..22f891d761 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -161,19 +161,19 @@ ../IVAS_dec STEREO 48 bit testv/stvST48c.wav_stereo_32000_48-48_bandwidth_sw.tst // stereo at 32 kbps, 48kHz in, 32kHz out, random FEC at 6% -../IVAS_cod -stereo -max_band FB 32000 48 testv/stvST48c.wav bit +../IVAS_cod -stereo 32000 48 testv/stvST48c.wav bit ../IVAS_dec -fec testv/FEC_6pct.bin STEREO 32 bit testv/stvST48c.wav_stereo_32000_48-32_FEC5.tst // stereo at 32 kbps, 48kHz in, 48kHz out, DTX on, random FEC at 5% -../IVAS_cod -stereo -dtx -max_band FB 32000 48 testv/stvST48n.wav bit +../IVAS_cod -stereo -dtx 32000 48 testv/stvST48n.wav bit ../IVAS_dec -fec 5 STEREO 48 bit testv/stvST48n.wav_stereo_32000_48-48_DTX_FEC5.tst // stereo at 32 kbps, 48kHz in, 48kHz out, DTX on, MONO out, random FEC at 5% -../IVAS_cod -stereo -dtx -max_band FB 32000 48 testv/stvST48n.wav bit +../IVAS_cod -stereo -dtx 32000 48 testv/stvST48n.wav bit ../IVAS_dec -fec 5 MONO 48 bit testv/stvST48n.wav_stereo_32000_48-48_DTX_MONO_FEC5.tst // stereo at 32 kbps, 48kHz in, 16kHz out, DTX on, MONO out, random FEC at 5% -../IVAS_cod -stereo -dtx -max_band FB 32000 48 testv/stvST48n.wav bit +../IVAS_cod -stereo -dtx 32000 48 testv/stvST48n.wav bit ../IVAS_dec -fec 5 MONO 16 bit testv/stvST48n.wav_stereo_32000_48-16_DTX_MONO_FEC5.tst // stereo at 48 kbps, 16kHz in, 16kHz out @@ -250,153 +250,175 @@ -// 1 ISm with metadata at 13.2 kbps, 48 kHz in, 48 kHz out, MONO out +// 1 ISM with metadata at 13.2 kbps, 48 kHz in, 48 kHz out, MONO out ../IVAS_cod -ism 1 testv/stvISM1.csv 13200 48 testv/stv1ISM48s.wav bit ../IVAS_dec MONO 48 bit testv/stv1ISM48s.wav_13200_48-48_MONO.tst -// 1 ISm with metadata at 13.2 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL out, random FEC at 5% +// 1 ISM with metadata at 13.2 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -dtx -ism 1 testv/stvISM1.csv 13200 48 testv/stv48n.wav bit ../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv48n.wav_13200_48-48_DTX_FEC5_BINAURAL.tst -// 2 ISm with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, STEREO out +// 2 ISM with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, STEREO out ../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 16400 48 testv/stv2ISM48s.wav bit ../IVAS_dec STEREO 48 bit testv/stv2ISM48s.wav_16400_48-48_STEREO.tst -// 3 ISm with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, 7_1 out +// 2 ISM with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, BINAURAL out +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 16400 48 testv/stv2ISM48s.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv2ISM48s.wav_16400_48-48_binaural.tst + +// 1 ISM with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out +../IVAS_cod -ism 1 testv/stvISM1.csv 16400 48 testv/stv1ISM48s.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv1ISM48s.wav_16400_48-48_binaural_room.tst + +// 3 ISM with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, 7_1 out ../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.wav bit ../IVAS_dec 7_1 48 bit testv/stv3ISM48s.wav_24400_48-48_7_1.tst -// 3 ISm with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, MONO out, random FEC at 5% +// 3 ISM with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, MONO out, random FEC at 5% ../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.wav bit ../IVAS_dec -fec 5 MONO 48 bit testv/stv3ISM48s.wav_24400_48-48_MONO_FEC5.tst -// 1 ISm with metadata at 32 kbps, 32 kHz in, 32 kHz out, DTX on, MONO out +// 3 ISM with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, BINAURAL out +../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv3ISM48s.wav_24400_48-48_binaural.tst + +// 1 ISM with metadata at 32 kbps, 32 kHz in, 32 kHz out, DTX on, MONO out ../IVAS_cod -dtx -ism 1 testv/stvISM1.csv 32000 32 testv/stv32n.wav bit ../IVAS_dec MONO 32 bit testv/stv32n.wav_32000_32-32_DTX_MONO.tst -// 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, FOA out +// 4 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, FOA out ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit ../IVAS_dec FOA 48 bit testv/stv4ISM48s.wav_32000_48-48_FOA.tst -// 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, STEREO out +// 4 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, STEREO out ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit ../IVAS_dec STEREO 48 bit testv/stv4ISM48s.wav_32000_48-48_STEREO.tst -// 3 ISm with metadata at 48 kbps, 48 kHz in, 48 kHz out, MONO out -../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 48000 48 testv/stv3ISM48s.wav bit -../IVAS_dec MONO 48 bit testv/stv43ISM48s_48000_48-48_MONO.tst - -// 2 ISm with metadata at 64 kbps, 48 kHz in, 32 kHz out, 5_1 out -../IVAS_cod -max_band FB -ism 2 testv/stvISM1.csv testv/stvISM2.csv 64000 48 testv/stv2ISM48s.wav bit -../IVAS_dec 5_1 32 bit testv/stv2ISM48s.wav_64000_48-32_5_1.tst - -// 4 ISm with metadata at 80 kbps, 48 kHz in, 48 kHz out, HOA2 out -../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 80000 48 testv/stv4ISM48s.wav bit -../IVAS_dec HOA2 48 bit testv/stv4ISM48s.wav_80000_48-48_HOA2.tst - -// 4 ISm with metadata at 96 kbps, 48 kHz in, 48 kHz out, Custom LS setup out -../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 96000 48 testv/stv4ISM48s.wav bit -../IVAS_dec testv/ls_setup_16ch_8+4+4.txt 48 bit testv/stv4ISM48s.wav_96000_48-48_MC_custom_setup.tst - -// 3 ISm with metadata at 128 kbps, 48 kHz in, 32 kHz out, HOA3 out, random FEC at 5% -../IVAS_cod -max_band FB -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 128000 48 testv/stv3ISM48s.wav bit -../IVAS_dec -fec 5 HOA3 32 bit testv/stv3ISM48s.wav_128000_48-32_HOA3_FEC5.tst - -// 4 ISm with metadata at 160 kbps, 48 kHz in, 48 kHz out, STEREO out -../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 160000 48 testv/stv4ISM48s.wav bit -../IVAS_dec STEREO 48 bit testv/stv4ISM48s.wav_160000_48-48_STEREO.tst - -// 2 ISm with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, BINAURAL out -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 16400 48 testv/stv2ISM48s.wav bit -../IVAS_dec BINAURAL 48 bit testv/stv2ISM48s.wav_16400_48-48_binaural.tst - -// 3 ISm with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, BINAURAL out -../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.wav bit -../IVAS_dec BINAURAL 48 bit testv/stv3ISM48s.wav_24400_48-48_binaural.tst - -// 2 ISm with metadata at 48 kbps, 48 kHz in, 48 kHz out, BINAURAL out, random FEC at 5% -../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 48000 48 testv/stv2ISM48s.wav bit -../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv2ISM48s.wav_48000_48-48_binaural_FEC5.tst - -// 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, BINAURAL out +// 4 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, BINAURAL out ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.wav_32000_48-48_binaural.tst -// 1 ISm with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out -../IVAS_cod -ism 1 testv/stvISM1.csv 16400 48 testv/stv1ISM48s.wav bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv1ISM48s.wav_16400_48-48_binaural_room.tst +// 4 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL out +../IVAS_cod -dtx -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48n.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv4ISM48n.wav_32000_48-48_DTX_BINAURAL.tst + +// 2 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, DTX on, HOA2 out +../IVAS_cod -dtx -ism 2 testv/stvISM1.csv testv/stvISM2.csv 32000 48 testv/stvST48c.wav bit +../IVAS_dec HOA2 48 bit testv/stv2ST48c.wav_32000_48-48_DTX_HOA2.tst + -// 2 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, EXTERNAL out +// 2 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, EXTERNAL out ../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 32000 48 testv/stv2ISM48s.wav bit ../IVAS_dec EXT 48 bit testv/stv2ISM48s.wav_32000_48-48_external.tst -// 2 ISm with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out +// 2 ISM with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out ../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv2ISM48s.wav bit ../IVAS_dec BINAURAL_ROOM 48 bit testv/stv2ISM48s.wav_64000_48-48_binaural_room.tst -// 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out, random FEC at 5% +// 4 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out, random FEC at 5% ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit ../IVAS_dec -fec 5 BINAURAL_ROOM 48 bit testv/stv4ISM48s.wav_32000_48-48_binaural_room_FEC5.tst -// 4 ISm with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv4ISM48s.wav bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv4ISM48s.wav_64000_48-48_binaural_room.tst +// 3 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, MONO out +../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 48000 48 testv/stv3ISM48s.wav bit +../IVAS_dec MONO 48 bit testv/stv43ISM48s_48000_48-48_MONO.tst + +// 4 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL out +../IVAS_cod -dtx -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48n.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv4ISM48n.wav_32000_48-48_DTX_BINAURAL.tst + +// 4 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL ROOM out, random FEC at 5% +../IVAS_cod -dtx -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 48000 48 testv/stv4ISM48n.wav bit +../IVAS_dec -fec 5 BINAURAL_ROOM 48 bit testv/stv4ISM48n.wav_48000_48-48_DTX_TD_binaural_room_FEC5.tst + +// 2 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, BINAURAL out, random FEC at 5% +../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 48000 48 testv/stv2ISM48s.wav bit +../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv2ISM48s.wav_48000_48-48_binaural_FEC5.tst -// 1 ISm with metadata at 48 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out, head rotation, random FEC at 5% +// 1 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out, head rotation, random FEC at 5% ../IVAS_cod -ism 1 testv/stvISM1.csv 48000 48 testv/stv1ISM48s.wav bit ../IVAS_dec -fec 5 -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv1ISM48s.wav_64000_48-48_binaural_room_HR.tst -// 1 ISm with metadata at 96 kbps, 48 kHz in, 16 kHz out, TD BINAURAL out (Model from file) -../IVAS_cod -ism 1 testv/stvISM1.csv 96000 48 testv/stv1ISM48s.wav bit -../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin BINAURAL 16 bit testv/stv2ISM48s.wav_96000_48-16_TD_binaural.tst +// 2 ISM with metadata at 64 kbps, 48 kHz in, 32 kHz out, 5_1 out +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 64000 48 testv/stv2ISM48s.wav bit +../IVAS_dec 5_1 32 bit testv/stv2ISM48s.wav_64000_48-32_5_1.tst -// 2 ISm with metadata at 160 kbps, 48 kHz in, 32 kHz out, TD BINAURAL out -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 160000 48 testv/stv2ISM48s.wav bit -../IVAS_dec BINAURAL 32 bit testv/stv2ISM48s.wav_160000_48-32_TD_binaural.tst +// 4 ISM with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv4ISM48s.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv4ISM48s.wav_64000_48-48_binaural_room.tst -// 3 ISm with metadata at 192 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out (Model from file) -../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 192000 48 testv/stv3ISM48s.wav bit -../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin BINAURAL 48 bit testv/stv3ISM48s.wav_192000_48-48_TD_binaural.tst +// 2 ISM with metadata at 80 kbps, 48 kHz in, 48 kHz out, DTX on, stereo out +../IVAS_cod -dtx -ism 2 testv/stvISM1.csv testv/stvISM2.csv 80000 48 testv/stvST48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv2ST48c.wav_80000_48-48_DTX_STEREO.tst -// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit -../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.wav_256000_48-48_TD_binaural.tst +// 4 ISM with metadata at 80 kbps, 48 kHz in, 48 kHz out, HOA2 out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 80000 48 testv/stv4ISM48s.wav bit +../IVAS_dec HOA2 48 bit testv/stv4ISM48s.wav_80000_48-48_HOA2.tst -// 1 ISm with metadata at 80 kbps, 48 kHz in, 16 kHz out, TD BINAURAL out (Model from file), head rotation, random FEC at 5% +// 1 ISM with metadata at 80 kbps, 48 kHz in, 16 kHz out, BINAURAL out (Model from file), head rotation, random FEC at 5% ../IVAS_cod -ism 1 testv/stvISM1.csv 80000 48 testv/stv1ISM48s.wav bit -../IVAS_dec -fec 5 -t testv/headrot_case00_3000_q.csv -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin BINAURAL 16 bit testv/stv2ISM48s.wav_80000_48-16_TDHR_FEC5.tst +../IVAS_dec -fec 5 -t testv/headrot_case00_3000_q.csv -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin BINAURAL 16 bit testv/stv2ISM48s.wav_80000_48-16_binaural_file_TDHR_FEC5.tst -// 2 ISm with metadata at 128 kbps, 48 kHz in, 32 kHz out, TD BINAURAL out (Model from file), head rotation +// 4 ISM with metadata at 96 kbps, 48 kHz in, 48 kHz out, Custom LS setup out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 96000 48 testv/stv4ISM48s.wav bit +../IVAS_dec testv/ls_setup_16ch_8+4+4.txt 48 bit testv/stv4ISM48s.wav_96000_48-48_MC_custom_setup.tst + +// 1 ISM with metadata at 96 kbps, 48 kHz in, 16 kHz out, BINAURAL out (Model from file) +../IVAS_cod -ism 1 testv/stvISM1.csv 96000 48 testv/stv1ISM48s.wav bit +../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin BINAURAL 16 bit testv/stv2ISM48s.wav_96000_48-16_binaural.tst + +// 3 ISM with metadata at 128 kbps, 48 kHz in, 32 kHz out, HOA3 out, random FEC at 5% +../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 128000 48 testv/stv3ISM48s.wav bit +../IVAS_dec -fec 5 HOA3 32 bit testv/stv3ISM48s.wav_128000_48-32_HOA3_FEC5.tst + + +// 2 ISM with metadata at 128 kbps, 48 kHz in, 32 kHz out, BINAURAL out (Model from file), head rotation ../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 128000 48 testv/stv2ISM48s.wav bit -../IVAS_dec -t testv/headrot_case01_3000_q.csv -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin BINAURAL 32 bit testv/stv2ISM48s.wav_128000_48-32_TDHR.tst +../IVAS_dec -t testv/headrot_case01_3000_q.csv -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin BINAURAL 32 bit testv/stv2ISM48s.wav_128000_48-32_binaural_file_TDHR.tst + +// 4 ISM with metadata at 160 kbps, 48 kHz in, 48 kHz out, STEREO out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 160000 48 testv/stv4ISM48s.wav bit +../IVAS_dec STEREO 48 bit testv/stv4ISM48s.wav_160000_48-48_STEREO.tst -// 3 ISm with metadata at 192 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation, random FEC at 5% +// 2 ISM with metadata at 160 kbps, 48 kHz in, 32 kHz out, BINAURAL out +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 160000 48 testv/stv2ISM48s.wav bit +../IVAS_dec BINAURAL 32 bit testv/stv2ISM48s.wav_160000_48-32_binaural.tst + +// 3 ISM with metadata at 192 kbps, 48 kHz in, 48 kHz out, BINAURAL out (Model from file) +../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 192000 48 testv/stv3ISM48s.wav bit +../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin BINAURAL 48 bit testv/stv3ISM48s.wav_192000_48-48_binaural)file.tst + +// 3 ISM with metadata at 192 kbps, 48 kHz in, 48 kHz out, BINAURAL out, head rotation, random FEC at 5% ../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 192000 48 testv/stv3ISM48s.wav bit -../IVAS_dec -fec 5 -t testv/headrot_case02_3000_q.csv BINAURAL 48 bit testv/stv3ISM48s.wav_192000_48-48_TDHR_FEC5.tst +../IVAS_dec -fec 5 -t testv/headrot_case02_3000_q.csv BINAURAL 48 bit testv/stv3ISM48s.wav_192000_48-48_binaural_file_TDHR_FEC5.tst -// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation +// 4 ISM with metadata at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit -../IVAS_dec -t testv/headrot_case03_3000_q.csv BINAURAL 48 bit testv/stv4ISM48s.wav_256000_48-48_TDHR.tst +../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.wav_256000_48-48_binaural.tst -// 3 ISm with metadata at 384 kbps, 48 kHz in, 32 kHz out, 7_1_4 out +// 4 ISM with metadata at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out, head rotation +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit +../IVAS_dec -t testv/headrot_case03_3000_q.csv BINAURAL 48 bit testv/stv4ISM48s.wav_256000_48-48_binaural_file_TDHR.tst + +// 3 ISM with metadata at 384 kbps, 48 kHz in, 32 kHz out, 7_1_4 out ../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 384000 48 testv/stv3ISM48s.wav bit ../IVAS_dec 7_1_4 32 bit testv/stv3ISM48s.wav_384000_48-32_7_1_4.tst -// 4 ISm with metadata at 512 kbps, 48 kHz in, 48 kHz out, 5_1 +// 4 ISM with metadata at 512 kbps, 48 kHz in, 48 kHz out, 5_1 ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 512000 48 testv/stv4ISM48s.wav bit ../IVAS_dec 5_1 48 bit testv/stv4ISM48s.wav_512000_48-48_5_1.tst -// 1 ISm with metadata bitrate switching from 13.2 kbps to 128 kbps, 32 kHz in, 32 kHz out, mono out, DTX on +// 1 ISM with metadata bitrate switching from 13.2 kbps to 128 kbps, 32 kHz in, 32 kHz out, mono out, DTX on ../IVAS_cod -dtx -ism 1 testv/stvISM1.csv ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv32c.wav bit ../IVAS_dec MONO 32 bit testv/stv32c.wav_brate_sw_32-32_mono_dtx.tst -// 4 ISm with metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out +// 4 ISM with metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.wav bit -../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.wav_brate_sw_48-48_BINAURAL.tst +../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.wav_brate_sw_48-48_binaural.tst -// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, DTX on, TD BINAURAL out -../IVAS_cod -dtx -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48n.wav bit -../IVAS_dec BINAURAL 48 bit testv/stv4ISM48n.wav_256000_48-48_DTX_TD_binaural.tst +// 4 ISm with/without metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, DTX on, HOA3 out +../IVAS_cod -dtx -ism 4 testv/stvISM1.csv NULL NULL testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.wav bit +../IVAS_dec HOA3 48 bit testv/stv4ISM48s.wav_brate_sw_48-48_DTX_hoa3.tst @@ -493,7 +515,7 @@ ../IVAS_dec -fec 5 FOA 32 bit testv/stvFOA32c.wav_SBA_64000_32-32_DTX_FOA.tst // SBA at 64 kbps, 48kHz in, 48kHz out, 5_1_4 out -../IVAS_cod -max_band FB -sba 1 64000 48 testv/stvFOA48c.wav bit +../IVAS_cod -sba 1 64000 48 testv/stvFOA48c.wav bit ../IVAS_dec 5_1_4 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_5_1_4.tst // SBA at 64 kbps, 48kHz in, 48kHz out, 7_1_4 out -- GitLab From bdd78bcbc55cd5288fcefc95ef16d8d4b428e80f Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 13:29:42 +0000 Subject: [PATCH 309/375] Update self_test.prm --- scripts/config/self_test.prm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 22f891d761..f26fba423a 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -416,7 +416,7 @@ ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.wav_brate_sw_48-48_binaural.tst -// 4 ISm with/without metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, DTX on, HOA3 out +// 4 ISm with and without metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, DTX on, HOA3 out ../IVAS_cod -dtx -ism 4 testv/stvISM1.csv NULL NULL testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.wav bit ../IVAS_dec HOA3 48 bit testv/stv4ISM48s.wav_brate_sw_48-48_DTX_hoa3.tst -- GitLab From 76a671d8df432d6f0b8ed707e6109c412746f337 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 19:58:20 +0200 Subject: [PATCH 310/375] simplify ivas_ism_metadata_enc() --- lib_com/ivas_prot.h | 4 -- lib_enc/ivas_ism_enc.c | 53 ++++++++++++--------- lib_enc/ivas_ism_metadata_enc.c | 84 ++++++++++----------------------- 3 files changed, 55 insertions(+), 86 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 6eb61455e3..020f685d86 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -839,13 +839,9 @@ ivas_error ivas_ism_metadata_enc( #else const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ #endif -#ifdef MASA_AND_OBJECTS - , - const int16_t n_ism /* i : number of objects */ #ifdef OMASA_BRATE ,const float lp_noise_CPE /* i : LP filterend total noise estimation */ #endif -#endif ); ivas_error ivas_ism_metadata_dec( diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index f7e5c8e04b..4d0943b76f 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -89,7 +89,7 @@ ivas_error ivas_ism_enc( int16_t dtx_flag, sid_flag; ivas_error error; #ifdef MASA_AND_OBJECTS - int16_t n; + int16_t nchan_transport; #endif push_wmops( "ivas_ism_enc" ); @@ -102,13 +102,21 @@ ivas_error ivas_ism_enc( dtx_flag = 0; sid_flag = 0; +#ifdef MASA_AND_OBJECTS + nchan_transport = st_ivas->nchan_transport; + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + nchan_transport = st_ivas->hEncoderConfig->nchan_ism; + } +#endif + /*------------------------------------------------------------------* * Preprocesing *-----------------------------------------------------------------*/ /* in ISM format: st_ivas->nchan_transport = st_ivas->nSCE */ #ifdef MASA_AND_OBJECTS - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + for ( sce_id = 0; sce_id < nchan_transport; sce_id++ ) #else for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) #endif @@ -223,16 +231,16 @@ ivas_error ivas_ism_enc( #else st_ivas->hEncoderConfig->ivas_total_brate, #endif - st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag #ifdef MASA_AND_OBJECTS - , - st_ivas->nSCE + nchan_transport, +#else + st_ivas->nchan_transport, +#endif + st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag #ifdef OMASA_BRATE , -1 #endif -#endif - ) ) != IVAS_ERR_OK ) { return error; @@ -244,7 +252,13 @@ ivas_error ivas_ism_enc( #else st_ivas->hEncoderConfig->ivas_total_brate, #endif - st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm +#ifdef MASA_AND_OBJECTS + nchan_transport, +#else + st_ivas->nchan_transport, +#endif + + st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm #ifdef MASA_AND_OBJECTS , st_ivas->nSCE @@ -284,11 +298,11 @@ ivas_error ivas_ism_enc( ism_total_brate_ref = ism_total_brate; // VE: change the interface of the following function and call it with 'st_ivas' only - if ( ( error = ivas_ism_metadata_enc( &ism_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, + if ( ( error = ivas_ism_metadata_enc( &ism_total_brate, nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, #ifdef TD5 st_ivas->hEncoderConfig->ism_extended_metadata_flag, #endif - st_ivas->nSCE, st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0 ) ) != IVAS_ERR_OK ) + st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -298,7 +312,7 @@ ivas_error ivas_ism_enc( st_ivas->hCPE[0]->brate_surplus = ism_total_brate_ref - ism_total_brate; } #else - if ( ( error = ivas_ism_metadata_enc( ism_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->nSCE, + if ( ( error = ivas_ism_metadata_enc( ism_total_brate, nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, #ifdef TD5 , st_ivas->hEncoderConfig->ism_extended_metadata_flag #endif @@ -313,7 +327,6 @@ ivas_error ivas_ism_enc( , st_ivas->hEncoderConfig->ism_extended_metadata_flag #endif - ) ) != IVAS_ERR_OK ) { return error; @@ -347,17 +360,9 @@ ivas_error ivas_ism_enc( /*------------------------------------------------------------------* * CoreCoders encoding *-----------------------------------------------------------------*/ -#ifdef MASA_AND_OBJECTS - if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - n = st_ivas->nSCE; - } - else - { - n = st_ivas->nchan_transport; - } - for ( sce_id = 0; sce_id < n; sce_id++ ) +#ifdef MASA_AND_OBJECTS + for ( sce_id = 0; sce_id < nchan_transport; sce_id++ ) #else for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) #endif @@ -416,7 +421,11 @@ ivas_error ivas_ism_enc( if ( dtx_flag ) { +#ifdef MASA_AND_OBJECTS + for ( sce_id = 0; sce_id < nchan_transport; sce_id++ ) +#else for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) +#endif { if ( sce_id != st_ivas->hISMDTX->sce_id_dtx ) { diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index f4138e1b56..72c933c595 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -194,14 +194,10 @@ ivas_error ivas_ism_metadata_enc( #else const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ #endif -#ifdef MASA_AND_OBJECTS - , - const int16_t n_ism /* i : number of objects */ #ifdef OMASA_BRATE , const float lp_noise_CPE #endif -#endif ) { #ifdef TD5 @@ -226,9 +222,7 @@ ivas_error ivas_ism_metadata_enc( int16_t ism_imp[MAX_NUM_OBJECTS]; int16_t num_obj, nbands, nblocks; ivas_error error; -#ifdef MASA_AND_OBJECTS - int16_t n_ch; -#endif + error = IVAS_ERR_OK; push_wmops( "ism_meta_enc" ); @@ -244,7 +238,7 @@ ivas_error ivas_ism_metadata_enc( #ifdef MASA_AND_OBJECTS else if ( ism_mode == ISM_MASA_MODE_DISC ) { - num_obj = n_ism; + num_obj = nchan_transport; } #endif else @@ -275,22 +269,13 @@ ivas_error ivas_ism_metadata_enc( #endif #ifdef OMASA_BRATE - if ( ism_mode == ISM_MASA_MODE_DISC ) - { - n_ch = num_obj; - } - else - { - n_ch = nchan_transport; - } - if ( ism_mode == ISM_MASA_MODE_DISC ) { /*----------------------------------------------------------------* * Rate importance of particular ISM streams in combined format coding *----------------------------------------------------------------*/ - set_ism_importance_interformat( *ism_total_brate, n_ch, hIsmMeta, hSCE, lp_noise_CPE, ism_imp ); + set_ism_importance_interformat( *ism_total_brate, nchan_transport, hIsmMeta, hSCE, lp_noise_CPE, ism_imp ); } else #endif @@ -366,53 +351,40 @@ ivas_error ivas_ism_metadata_enc( #endif } } - } - /*----------------------------------------------------------------* - * Rate importance of particular ISM streams - *----------------------------------------------------------------*/ -#ifdef MASA_AND_OBJECTS - if ( ism_mode == ISM_MASA_MODE_DISC ) - { - n_ch = num_obj; - } - else - { - n_ch = nchan_transport; - } - - rate_ism_importance( n_ch, hIsmMeta, hSCE, ism_imp ); + /*----------------------------------------------------------------* + * Rate importance of particular ISM streams + *----------------------------------------------------------------*/ -#else - rate_ism_importance( nchan_transport, hIsmMeta, hSCE, ism_imp ); -#endif + rate_ism_importance( nchan_transport, hIsmMeta, hSCE, ism_imp ); #ifndef TUNE_360_OBJECT_WITH_NOISE - /* relax the importance decision in "stereo" coding for noisy audio */ + /* relax the importance decision in "stereo" coding for noisy audio */ #ifdef MASA_AND_OBJECTS - if ( ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) && num_obj == 2 ) + if ( ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) && num_obj == 2 ) #else - if ( ism_mode == ISM_MODE_DISC && num_obj == 2 ) + if ( ism_mode == ISM_MODE_DISC && num_obj == 2 ) #endif - { - float diff_F; - - if ( hIsmMeta[0]->ism_metadata_flag ^ hIsmMeta[1]->ism_metadata_flag ) { - for ( ch = 0; ch < num_obj; ch++ ) - { - diff_F = hSCE[ch]->hCoreCoder[0]->lp_speech - hSCE[ch]->hCoreCoder[0]->lp_noise; + float diff_F; - if ( hIsmMeta[ch]->ism_metadata_flag == 0 && diff_F < 25.0f ) + if ( hIsmMeta[0]->ism_metadata_flag ^ hIsmMeta[1]->ism_metadata_flag ) + { + for ( ch = 0; ch < num_obj; ch++ ) { - hIsmMeta[ch]->ism_metadata_flag = 1; - ism_imp[ch] = ISM_LOW_IMP; + diff_F = hSCE[ch]->hCoreCoder[0]->lp_speech - hSCE[ch]->hCoreCoder[0]->lp_noise; + + if ( hIsmMeta[ch]->ism_metadata_flag == 0 && diff_F < 25.0f ) + { + hIsmMeta[ch]->ism_metadata_flag = 1; + ism_imp[ch] = ISM_LOW_IMP; + } } } } - } #endif + } /*----------------------------------------------------------------* * Write ISM common signaling @@ -433,7 +405,7 @@ ivas_error ivas_ism_metadata_enc( #endif #ifdef TD5 -/* write extended metadata presence flag */ + /* write extended metadata presence flag */ #ifdef OMASA_BRATE #ifdef FIX_TD5_IN_OMASA if ( ism_mode == ISM_MODE_DISC && *ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) @@ -449,11 +421,7 @@ ivas_error ivas_ism_metadata_enc( #endif /* write ISM metadata flag (one per object) */ -#ifdef MASA_AND_OBJECTS - for ( ch = 0; ch < n_ch; ch++ ) -#else for ( ch = 0; ch < nchan_transport; ch++ ) -#endif { #ifdef OMASA_BRATE if ( ism_mode == ISM_MASA_MODE_DISC ) @@ -481,11 +449,7 @@ ivas_error ivas_ism_metadata_enc( #endif { /* write VAD flag */ -#ifdef MASA_AND_OBJECTS - for ( ch = 0; ch < n_ch; ch++ ) -#else for ( ch = 0; ch < nchan_transport; ch++ ) -#endif { #ifdef OMASA_BRATE if ( ism_mode == ISM_MASA_MODE_DISC ) @@ -1039,7 +1003,7 @@ ivas_error ivas_ism_metadata_enc( } #ifdef MASA_AND_OBJECTS - for ( ch = 0; ch < n_ch; ch++ ) + for ( ch = 0; ch < nchan_transport; ch++ ) { #ifdef OMASA_BRATE hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; -- GitLab From 57f8d915239a52280a6b2ce400e19bb0667bfa79 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 20:25:34 +0200 Subject: [PATCH 311/375] addition of OMASA_BRATE_SW - solves MSAN error in OMASA bitrate switching --- lib_enc/ivas_init_enc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 89820ff179..bd333e20ea 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -610,6 +610,13 @@ ivas_error ivas_init_encoder( return error; } +#ifdef OMASA_BRATE_SW + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + set_f( st_ivas->hQMetaData->masa_to_total_energy_ratio[i], 0, MASA_FREQUENCY_BANDS ); + } +#endif + if ( ( error = ivas_masa_enc_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; -- GitLab From af44c6f21647b583151280c7247a25524e3f5436 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Tue, 28 Mar 2023 09:09:59 +0200 Subject: [PATCH 312/375] clean up obsolete define --- lib_enc/ivas_mct_core_enc.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index c442882107..5cbcb57daf 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -194,11 +194,9 @@ void ivas_mct_core_enc( CPE_ENC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE encoder structures */ const int16_t nChannels, /* i : number of channels to be coded */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ -#ifndef DISABLE_BWD_MCT - const int16_t switch_bw, /* i : flag bandwidth switch occurance */ -#endif - const int16_t lfe_bits, /* i : bits spent for LFE */ - const int16_t sba_order /* i : Ambisonic (SBA) order */ + const int16_t switch_bw, /* i : flag bandwidth switch occurance */ + const int16_t lfe_bits, /* i : bits spent for LFE */ + const int16_t sba_order /* i : Ambisonic (SBA) order */ ) { int16_t ch, ch_core, nSubframes, L_subframeTCX; @@ -280,13 +278,12 @@ void ivas_mct_core_enc( { ch_core = ch * CPE_CHANNELS; -#ifndef DISABLE_BWD_MCT if ( switch_bw ) { initMdctStereoEncData( hMCT->hBlockData[ch]->hStereoMdct, ivas_format, sts[ch_core]->element_mode, sts[ch_core]->element_brate, sts[ch_core]->bwidth, sts[ch_core]->igf, sts[ch_core]->hIGFEnc->igfData.igfInfo.grid, 0 ); } -#endif + if ( sts[ch_core]->igf ) { /* calculate the igf start band from the igf start line */ -- GitLab From 09a1f44f81dee688c757a857c454fd32c7b1b2e1 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Tue, 28 Mar 2023 17:12:43 +0300 Subject: [PATCH 313/375] Detect potential MASA metadata framing asynchrony and reduce the quality degradation by modifying the metadata --- lib_com/ivas_cnst.h | 9 +- lib_com/ivas_prot.h | 56 ++--- lib_com/options.h | 1 + lib_dec/lib_dec.h | 2 +- lib_enc/ivas_enc.c | 9 +- lib_enc/ivas_masa_enc.c | 446 +++++++++++++++++++++++++++++++++++++++- lib_enc/ivas_stat_enc.h | 14 ++ 7 files changed, 500 insertions(+), 37 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 3f48b0b43e..79f5c9032c 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -357,7 +357,7 @@ typedef enum #define ISM_Q_STEP_LOW (ISM_Q_STEP * 2) #define ISM_Q_STEP_BORDER_LOW (ISM_Q_STEP_BORDER * 2) #else -#define PARAM_ISM_DTX_AZI_BITS 5 +#define PARAM_ISM_DTX_AZI_BITS 5 #define PARAM_ISM_DTX_ELE_BITS 4 #endif @@ -1214,6 +1214,13 @@ typedef enum MASA_STEREO_DOWNMIX } MASA_TRANSPORT_SIGNAL_TYPE; +#ifdef FIX_382_MASA_META_FRAMING_ASYNC +typedef enum +{ + MASA_FRAME_1SF, + MASA_FRAME_4SF +} MASA_FRAME_MODE; +#endif /*----------------------------------------------------------------------------------* * Multichannel format diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index e8597bbf3c..a7e95b4ebc 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -793,7 +793,7 @@ ivas_error ivas_set_ism_metadata( const float pitch /* i : pitch */ #else const float elevation /* i : elevation value */ -#endif +#endif ); ivas_error ivas_ism_metadata_enc_create( @@ -4025,40 +4025,40 @@ void ivas_spar_bitrate_dist( const int16_t bwidth /* i : audio bandwidth */ ); -void ivas_mdct( - const float *pIn, - float *pOut, - const int16_t length +void ivas_mdct( + const float *pIn, + float *pOut, + const int16_t length ); -void ivas_dct_windowing( - const int16_t fade_len, - const int16_t full_len, - const int16_t dct_len, - const int16_t zero_pad_len, - const float *pWindow_coeffs, - const int16_t frame_len, - float *pOut_buf, - float *pBuffer_prev, - float *pTemp_lfe +void ivas_dct_windowing( + const int16_t fade_len, + const int16_t full_len, + const int16_t dct_len, + const int16_t zero_pad_len, + const float *pWindow_coeffs, + const int16_t frame_len, + float *pOut_buf, + float *pBuffer_prev, + float *pTemp_lfe ); -void ivas_tda( - const float *pIn, - float *pOut, - const int16_t length +void ivas_tda( + const float *pIn, + float *pOut, + const int16_t length ); -void ivas_imdct( - const float *pIn, - float *pOut, - const int16_t length +void ivas_imdct( + const float *pIn, + float *pOut, + const int16_t length ); -void ivas_itda( - const float *re, - float *pOut, - const int16_t length +void ivas_itda( + const float *re, + float *pOut, + const int16_t length ); void ivas_spar_get_cldfb_gains( @@ -4282,7 +4282,7 @@ void ivas_transient_det_close( ivas_trans_det_state_t **hTranDet /* i/o: Transient detector handle */ ); -void ivas_transient_det_process( +void ivas_transient_det_process( ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ float *pIn_pcm, /* i : input audio channels */ const int16_t frame_len, /* i : frame length in samples */ diff --git a/lib_com/options.h b/lib_com/options.h index c054a9b5a7..45ae98fcc3 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,6 +163,7 @@ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ #define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ +#define FIX_382_MASA_META_FRAMING_ASYNC /* Nokia: Issue 382: detect potential MASA metadata framing offset */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index a717e0002e..03f71e44ec 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -176,7 +176,7 @@ ivas_error IVAS_DEC_GetMasaMetadata( /*! r: error code */ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -#ifdef TD5 +#ifdef TD5 IVAS_QUATERNION *orientation, /* i : head-tracking data */ IVAS_POSITION *Pos /* i : listener position */ #else diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 1e4ba82207..535a1196ab 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -227,13 +227,16 @@ ivas_error ivas_enc( } else { +#ifdef FIX_382_MASA_META_FRAMING_ASYNC + ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); /* energy-estimation uses TF-resolution: 4x24 */ +#endif if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; } - - ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); - +#ifndef FIX_382_MASA_META_FRAMING_ASYNC + ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); /* energy-estimation uses TF-resolution: 4x24 */ +#endif if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 337753925c..ec8e3fe799 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -31,8 +31,8 @@ *******************************************************************************************************/ #include -#include "options.h" #include +#include "options.h" #include "ivas_cnst.h" #include "ivas_prot.h" #include "ivas_rom_com.h" @@ -40,6 +40,10 @@ #include "wmc_auto.h" #include "prot.h" +#ifdef FIX_382_MASA_META_FRAMING_ASYNC +#include +#endif + /*-----------------------------------------------------------------------* * Local function prototypes *-----------------------------------------------------------------------*/ @@ -60,6 +64,17 @@ static int16_t encode_lfe_to_total_energy_ratio( MASA_ENCODER_HANDLE hMasa, BSTR static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); +#ifdef FIX_382_MASA_META_FRAMING_ASYNC +static void average_masa_metadata( MASA_ENCODER_HANDLE hMasa ); + +static void copy_masa_metadata_subframe( MASA_METADATA_HANDLE hMetaFrom, const uint8_t sfFrom, MASA_METADATA_HANDLE hMetaTo, const uint8_t sfTo ); + +static void copy_masa_metadata( MASA_METADATA_HANDLE hMetaFrom, MASA_METADATA_HANDLE hMetaTo ); + +static uint8_t are_masa_subframes_similar( MASA_METADATA_HANDLE frame1, const uint8_t sf1_idx, MASA_METADATA_HANDLE frame2, const uint8_t sf2_idx ); + +static void detect_framing_async( MASA_ENCODER_HANDLE hMasa ); +#endif /*-----------------------------------------------------------------------* * Local constants @@ -136,6 +151,13 @@ ivas_error ivas_masa_enc_open( set_zero( hMasa->data.lfeToTotalEnergyRatio, MAX_PARAM_SPATIAL_SUBFRAMES ); hMasa->data.prevq_lfeToTotalEnergyRatio = 0.0f; hMasa->data.prevq_lfeIndex = 0; + +#ifdef FIX_382_MASA_META_FRAMING_ASYNC + hMasa->data.sync_state.prev_sim_stop = 0; + hMasa->data.sync_state.prev_offset = 0; + hMasa->data.sync_state.frame_mode = MASA_FRAME_4SF; +#endif + st_ivas->hMasa = hMasa; return error; @@ -506,6 +528,15 @@ ivas_error ivas_masa_enc_config( if ( ivas_format == MASA_FORMAT ) { +#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 */ + average_masa_metadata( hMasa ); + } +#endif + /* Inspect metadata for parameter changes that affect coding. */ detect_metadata_composition( hMasa, &joinedSubframes, &coherencePresent, &isActualTwoDir ); hMasa->config.joinedSubframes = joinedSubframes; @@ -514,7 +545,7 @@ ivas_error ivas_masa_enc_config( } else if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) { - /* For mcMASA, these are set only once as this function is called only once. */ + /* For McMASA, these are set only once as this function is called only once. */ hMasa->config.joinedSubframes = 0; hMasa->config.numberOfDirections = 1; } @@ -709,9 +740,10 @@ static void combine_freqbands_and_subframes( if ( numCodingBands < MASA_FREQUENCY_BANDS ) { + /* reduce metadata *frequency* resolution. time resolution is not touched */ for ( i = 0; i < numDirections; i++ ) { - for ( j = 0; j < numSf; j++ ) + for ( j = 0; j < numSf; j++ ) /* NB: for numSf==1, operates only on first sub-frame */ { for ( k = 0; k < MASA_FREQUENCY_BANDS; k++ ) { @@ -785,7 +817,7 @@ static void combine_freqbands_and_subframes( } } } - else if ( mergeRatiosOverSubframes ) + else if ( mergeRatiosOverSubframes ) /* keep frequency resolution */ { for ( j = 0; j < numSf; j++ ) { @@ -1092,11 +1124,18 @@ static void detect_metadata_composition( ) { MASA_METADATA_FRAME *hMeta; +#ifdef FIX_382_MASA_META_FRAMING_ASYNC + int8_t sf, band, dir, numDir; +#else int16_t sf, band, dir, numDir; +#endif int16_t nSubFrames; uint8_t dirValid[2] = { FALSE }; uint8_t cohPresent = FALSE; uint8_t sfDiffer = FALSE; +#ifdef FIX_382_MASA_META_FRAMING_ASYNC + uint8_t sfSimilar; +#endif hMeta = &( hMasa->masaMetadata ); numDir = hMeta->descriptive_meta.numberOfDirections + 1; @@ -1161,6 +1200,16 @@ static void detect_metadata_composition( } /* Check if data over subframes is identical. Check is done by comparing to first subframe. */ +#ifdef FIX_382_MASA_META_FRAMING_ASYNC + sfSimilar = TRUE; + sf = 1; + while ( ( sfSimilar == TRUE ) && ( sf < MAX_PARAM_SPATIAL_SUBFRAMES ) ) + { + sfSimilar = are_masa_subframes_similar( hMeta, 0, hMeta, sf ); + sf++; + } + sfDiffer = sfSimilar == TRUE ? FALSE : TRUE; +#else dir = 0; while ( sfDiffer == FALSE && dir < numDir ) { @@ -1207,6 +1256,7 @@ static void detect_metadata_composition( } dir++; } +#endif /* Further checks can be done with just one subframe if they are identical */ nSubFrames = sfDiffer == TRUE ? MAX_PARAM_SPATIAL_SUBFRAMES : 1; @@ -1750,3 +1800,391 @@ void ivas_masa_enc_reconfigure( return; } + +#ifdef FIX_382_MASA_META_FRAMING_ASYNC +/*-------------------------------------------------------------------* + * average_masa_metadata() + * + * Average MASA metadata frame subframe contents: applies aggregation over time + *-------------------------------------------------------------------*/ +static void average_masa_metadata( + MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder handle */ +) +{ + int16_t i, j, k; + float azi_rad, ele_rad; + uint8_t numDirections; + MASA_METADATA_HANDLE hMeta; + + hMeta = &( hMasa->masaMetadata ); + + /* use the nominal values without data-adaptivity */ + numDirections = hMeta->descriptive_meta.numberOfDirections + 1; + + /* azi/ele/nrg into vectors for each sub-frame and band */ + for ( i = 0; i < numDirections; i++ ) + { + for ( k = 0; k < MASA_FREQUENCY_BANDS; k++ ) + { + float x_sum, y_sum, z_sum, energy_sum, vec_len, spread_coh_sum, surr_coh_sum; + + x_sum = 0.0f; + y_sum = 0.0f; + z_sum = 0.0f; + energy_sum = 0.0f; + spread_coh_sum = 0.0f; + surr_coh_sum = 0.0f; + for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + azi_rad = hMeta->directional_meta[i].azimuth[j][k] / 180.0f * EVS_PI; + ele_rad = hMeta->directional_meta[i].elevation[j][k] / 180.0f * EVS_PI; + vec_len = hMeta->directional_meta[i].energy_ratio[j][k] * hMasa->data.energy[j][k]; + + /* energy-weighted sum over subframes */ + x_sum += cosf( azi_rad ) * cosf( ele_rad ) * vec_len; + y_sum += sinf( azi_rad ) * cosf( ele_rad ) * vec_len; + z_sum += sinf( ele_rad ) * vec_len; + + energy_sum += hMasa->data.energy[j][k]; + + spread_coh_sum += hMeta->directional_meta[i].spread_coherence[j][k] * hMasa->data.energy[j][k]; + if ( i == 0 ) + { + /* this is in common metadata and not in each direction */ + surr_coh_sum += hMeta->common_meta.surround_coherence[j][k] * hMasa->data.energy[j][k]; + } + } + + /* the data from the combined sub-frames is written into the first sub-frame band */ + j = 0; + hMeta->directional_meta[i].azimuth[j][k] = atan2f( y_sum, x_sum ) / EVS_PI * 180.0f; + hMeta->directional_meta[i].elevation[j][k] = atan2f( z_sum, sqrtf( x_sum * x_sum + y_sum * y_sum ) ) / EVS_PI * 180.0f; + + vec_len = sqrtf( x_sum * x_sum + y_sum * y_sum + z_sum * z_sum ); + hMeta->directional_meta[i].energy_ratio[j][k] = vec_len / ( energy_sum + EPSILON ); + + hMeta->directional_meta[i].spread_coherence[j][k] = spread_coh_sum / ( energy_sum + EPSILON ); + if ( i == 0 ) + { + hMeta->common_meta.surround_coherence[j][k] = surr_coh_sum / ( energy_sum + EPSILON ); + } + + /* copy the same value to all subframes */ + for ( j = 1; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + hMeta->directional_meta[i].azimuth[j][k] = hMeta->directional_meta[i].azimuth[0][k]; + hMeta->directional_meta[i].elevation[j][k] = hMeta->directional_meta[i].elevation[0][k]; + hMeta->directional_meta[i].energy_ratio[j][k] = hMeta->directional_meta[i].energy_ratio[0][k]; + hMeta->directional_meta[i].spread_coherence[j][k] = hMeta->directional_meta[i].spread_coherence[0][k]; + if ( i == 0 ) + { + hMeta->common_meta.surround_coherence[j][k] = hMeta->common_meta.surround_coherence[0][k]; + } + } + } + } + + for ( k = 0; k < MASA_FREQUENCY_BANDS; k++ ) + { + for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + if ( numDirections == 2 ) + { + hMeta->common_meta.diffuse_to_total_ratio[j][k] = max( 0.0f, 1.0f - hMeta->directional_meta[1].energy_ratio[j][k] - hMeta->directional_meta[0].energy_ratio[j][k] ); + } + else + { + hMeta->common_meta.diffuse_to_total_ratio[j][k] = max( 0.0f, 1.0f - hMeta->directional_meta[0].energy_ratio[j][k] ); + } + hMeta->common_meta.remainder_to_total_ratio[j][k] = 0.0f; + } + } +} + +/*-------------------------------------------------------------------* + * copy_masa_metadata_subframe() + * + * Copy MASA metadata frame subframe contents + *-------------------------------------------------------------------*/ + +static void copy_masa_metadata_subframe( + MASA_METADATA_HANDLE hMetaFrom, /* i : MASA frame metdata to be copied */ + const uint8_t sfFrom, /* i : subframe index of the copy source */ + MASA_METADATA_HANDLE hMetaTo, /* o : MASA frame metadata copy destination */ + const uint8_t sfTo /* i : subframe index of the copy target */ +) +{ + uint8_t dir; + /* directional metadata */ + for ( dir = 0; dir < MASA_MAXIMUM_DIRECTIONS; dir++ ) + { + mvr2r( hMetaFrom->directional_meta[dir].azimuth[sfFrom], hMetaTo->directional_meta[dir].azimuth[sfTo], MASA_FREQUENCY_BANDS ); + mvr2r( hMetaFrom->directional_meta[dir].elevation[sfFrom], hMetaTo->directional_meta[dir].elevation[sfTo], MASA_FREQUENCY_BANDS ); + mvr2r( hMetaFrom->directional_meta[dir].energy_ratio[sfFrom], hMetaTo->directional_meta[dir].energy_ratio[sfTo], MASA_FREQUENCY_BANDS ); + mvr2r( hMetaFrom->directional_meta[dir].spread_coherence[sfFrom], hMetaTo->directional_meta[dir].spread_coherence[sfTo], MASA_FREQUENCY_BANDS ); + } + + /* common metadata */ + mvr2r( hMetaFrom->common_meta.diffuse_to_total_ratio[sfFrom], hMetaTo->common_meta.diffuse_to_total_ratio[sfTo], MASA_FREQUENCY_BANDS ); + mvr2r( hMetaFrom->common_meta.surround_coherence[sfFrom], hMetaTo->common_meta.surround_coherence[sfTo], MASA_FREQUENCY_BANDS ); + mvr2r( hMetaFrom->common_meta.remainder_to_total_ratio[sfFrom], hMetaTo->common_meta.remainder_to_total_ratio[sfTo], MASA_FREQUENCY_BANDS ); +} + +/*-------------------------------------------------------------------* + * copy_masa_metadata() + * + * Copy MASA metada frame contents + *-------------------------------------------------------------------*/ + +static void copy_masa_metadata( + MASA_METADATA_HANDLE hMetaFrom, /* i : MASA frame metadata to be copied */ + MASA_METADATA_HANDLE hMetaTo /* o : MASA frame metadata copy destination */ +) +{ + uint8_t sf; + + /* descriptive metadata */ + memcpy( hMetaTo->descriptive_meta.formatDescriptor, hMetaFrom->descriptive_meta.formatDescriptor, sizeof( hMetaFrom->descriptive_meta.formatDescriptor ) ); + + hMetaTo->descriptive_meta.numberOfDirections = hMetaFrom->descriptive_meta.numberOfDirections; + hMetaTo->descriptive_meta.numberOfChannels = hMetaFrom->descriptive_meta.numberOfChannels; + hMetaTo->descriptive_meta.sourceFormat = hMetaFrom->descriptive_meta.sourceFormat; + hMetaTo->descriptive_meta.transportDefinition = hMetaFrom->descriptive_meta.transportDefinition; + hMetaTo->descriptive_meta.channelAngle = hMetaFrom->descriptive_meta.channelAngle; + hMetaTo->descriptive_meta.channelDistance = hMetaFrom->descriptive_meta.channelDistance; + hMetaTo->descriptive_meta.channelLayout = hMetaFrom->descriptive_meta.channelLayout; + + /* directional and common metadata */ + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + copy_masa_metadata_subframe( hMetaFrom, sf, hMetaTo, sf ); + } +} + +/*-------------------------------------------------------------------* + * are_masa_subframes_similar() + * + * Compare the similarity of MASA metadata in two sub-frames + *-------------------------------------------------------------------*/ + +static uint8_t are_masa_subframes_similar( + MASA_METADATA_HANDLE frame1, /* i : MASA metadata frame 1 */ + const uint8_t sf1_idx, /* i : index of the subframe of frame1 to inspect */ + MASA_METADATA_HANDLE frame2, /* i : MASA metadata frame 2 */ + const uint8_t sf2_idx /* o : index of the subframe of frame2 to inspect */ +) +{ + uint8_t num_dir; + uint8_t dir; + uint8_t band_idx; + uint8_t sf_differ; + + num_dir = frame1->descriptive_meta.numberOfDirections; + dir = 0; + band_idx = 0; + sf_differ = FALSE; + + if ( num_dir != frame2->descriptive_meta.numberOfDirections ) + { + sf_differ = TRUE; + } + else + { + /* check per-direction metadata */ + dir = 0; + band_idx = 0; + + while ( ( sf_differ == FALSE ) && ( dir <= num_dir ) ) + { + band_idx = 0; + while ( ( sf_differ == FALSE ) && ( band_idx < MASA_FREQUENCY_BANDS ) ) + { + float azi_dif; + azi_dif = fabsf( frame1->directional_meta[dir].azimuth[sf1_idx][band_idx] - frame2->directional_meta[dir].azimuth[sf2_idx][band_idx] ); + azi_dif = azi_dif > 180.0f ? 360.0f - azi_dif : azi_dif; + + if ( azi_dif > MASA_ANGLE_TOLERANCE ) + { + sf_differ = TRUE; + break; + } + + if ( fabsf( frame1->directional_meta[dir].elevation[sf1_idx][band_idx] - frame2->directional_meta[dir].elevation[sf2_idx][band_idx] ) > MASA_ANGLE_TOLERANCE ) + { + sf_differ = TRUE; + break; + } + + if ( fabsf( frame1->directional_meta[dir].energy_ratio[sf1_idx][band_idx] - frame2->directional_meta[dir].energy_ratio[sf2_idx][band_idx] ) > MASA_RATIO_TOLERANCE ) + { + sf_differ = TRUE; + break; + } + + if ( fabsf( frame1->directional_meta[dir].spread_coherence[sf1_idx][band_idx] - frame2->directional_meta[dir].spread_coherence[sf2_idx][band_idx] ) > MASA_COHERENCE_TOLERANCE ) + { + sf_differ = TRUE; + break; + } + + band_idx++; + } + dir++; + } + + /* check the common metadata */ + while ( ( sf_differ == FALSE ) && ( band_idx < MASA_FREQUENCY_BANDS ) ) + { + if ( fabsf( frame1->common_meta.surround_coherence[sf1_idx][band_idx] - frame2->common_meta.surround_coherence[sf2_idx][band_idx] ) > MASA_COHERENCE_TOLERANCE ) + { + sf_differ = TRUE; + break; + } + + band_idx++; + } + } + + /* TODO: a nicer negation */ + if ( sf_differ ) + { + return FALSE; + } + else + { + return TRUE; + } +} + +/*-------------------------------------------------------------------* + * detect_framing_async() + * + * Compare the similarity of MASA metadata in two sub-frames + * Analysis result is stored in hMasa->data.sync_state, and + * potentially hMasa->masaMetadata is modified + *-------------------------------------------------------------------*/ + +static void detect_framing_async( + MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder structure */ +) +{ + MASA_METADATA_HANDLE current_meta; + MASA_METADATA_HANDLE previous_meta; + MASA_SYNC_HANDLE sync_state; + MASA_FRAME_MODE frame_mode; + uint8_t n_sim_start, n_sim_stop, sf_idx; + uint8_t found_offset; + + current_meta = &( hMasa->masaMetadata ); /* metadata from current frame */ + sync_state = &( hMasa->data.sync_state ); /* synchronization structure */ + previous_meta = &( sync_state->previous_metadata ); + + /* check current frame, how many are similar from the start and from the end */ + n_sim_start = 1; + for ( sf_idx = n_sim_start; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + { + if ( are_masa_subframes_similar( current_meta, 0, current_meta, sf_idx ) == TRUE ) + { + n_sim_start = sf_idx + 1; + } + else + { + break; + } + } + + /* number of similar sub-frames starting from the end of the frame */ + if ( n_sim_start == MAX_PARAM_SPATIAL_SUBFRAMES ) /* shortcut */ + { + n_sim_stop = n_sim_start; + } + else + { + n_sim_stop = 1; + for ( sf_idx = 2; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + { + /* we need to check only the two middle sub-frames, as all being the same would have taken the shortcut above */ + if ( are_masa_subframes_similar( current_meta, MAX_PARAM_SPATIAL_SUBFRAMES - 1, current_meta, MAX_PARAM_SPATIAL_SUBFRAMES - sf_idx ) == TRUE ) + { + n_sim_stop = sf_idx; + } + else + { + break; + } + } + } + + frame_mode = MASA_FRAME_4SF; /* default mode: 4sf */ + if ( sync_state->prev_offset > MAX_PARAM_SPATIAL_SUBFRAMES - 2 ) + { + /* earlier offset was large => reset the offset */ + found_offset = 0; + } + else + { + /* keep previous offset unless something else is found. alternatively, we could reset always */ + found_offset = sync_state->prev_offset; + } + + if ( ( n_sim_start == MAX_PARAM_SPATIAL_SUBFRAMES ) && ( n_sim_stop == MAX_PARAM_SPATIAL_SUBFRAMES ) ) + { + /* full frame consists of similar sub-frames */ + frame_mode = MASA_FRAME_1SF; + if ( ( sync_state->prev_sim_stop != 0 ) && ( are_masa_subframes_similar( current_meta, 0, previous_meta, MAX_PARAM_SPATIAL_SUBFRAMES - 1 ) == TRUE ) ) + { + /* > 4 sub-frames of similar data */ + if ( sync_state->prev_sim_stop < 3 ) + { + /* can nicely align the framing with the earlier data and a small offset */ + found_offset = sync_state->prev_sim_stop; + } + else + { + /* too many similar sub-frames to determine the offset accurately => keep earlier value */ + found_offset = sync_state->prev_offset; + } + } + else + { + /* earlier window was different => reset the offset */ + found_offset = 0; + } + } + else if ( n_sim_stop == 3 ) + { + /* first sub-frame different that the rest 3 + => make a risky guess that the future sf would be the same too and we're in an offset case */ + frame_mode = MASA_FRAME_1SF; + found_offset = 3; + } + else if ( ( sync_state->prev_sim_stop > 0 ) && ( are_masa_subframes_similar( current_meta, 0, previous_meta, MAX_PARAM_SPATIAL_SUBFRAMES - 1 ) == TRUE ) ) + { + /* seeing data similar to past */ + if ( ( n_sim_start > 1 ) && ( n_sim_start + sync_state->prev_sim_stop >= MAX_PARAM_SPATIAL_SUBFRAMES ) ) + { + /* with the past, would have at least one long frame similar subframes */ + frame_mode = MASA_FRAME_1SF; + + if ( sync_state->prev_offset == 0 ) + { + found_offset = min( 2, sync_state->prev_sim_stop ); + } + else + { + found_offset = sync_state->prev_offset; + } + } + } + + /* keep the original contents of the frame, but then perform interpolation later */ + /* just copy current frame to storage */ + copy_masa_metadata( current_meta, previous_meta ); + + sync_state->prev_sim_stop = n_sim_stop; + sync_state->prev_offset = found_offset; + sync_state->frame_mode = frame_mode; + +} +#endif + diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index a56f6423d3..c6dc6b35ca 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_382_MASA_META_FRAMING_ASYNC +/* structure storing MASA framing sync detection and compensation data */ +typedef struct ivas_masa_sync_struct +{ + MASA_METADATA_FRAME previous_metadata; + uint8_t prev_sim_stop; + uint8_t prev_offset; + MASA_FRAME_MODE frame_mode; +} MASA_SYNC_STATE, *MASA_SYNC_HANDLE; +#endif + typedef struct ivas_masa_encoder_data_struct { float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; @@ -759,6 +770,9 @@ typedef struct ivas_masa_encoder_data_struct float onset_detector_1; float onset_detector_2; +#ifdef FIX_382_MASA_META_FRAMING_ASYNC + MASA_SYNC_STATE sync_state; +#endif } MASA_ENCODER_DATA; typedef struct ivas_masa_encoder_struct -- GitLab From 69090cd6c7d06e7e6ed200797e1477fb2e653eda Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 28 Mar 2023 16:31:49 +0200 Subject: [PATCH 314/375] - simplifications in ivas_dec() - add error returns --- lib_dec/ivas_dec.c | 91 ++++++++++++++++++++++++++--------------- lib_dec/ivas_init_dec.c | 15 +++++-- lib_enc/ivas_ism_enc.c | 24 ++++++----- 3 files changed, 84 insertions(+), 46 deletions(-) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 871e454605..c53b8b68a9 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -451,7 +451,7 @@ ivas_error ivas_dec( } } - /* MASA decoding */ + /* MASA metadata decoding */ if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { return error; @@ -462,7 +462,25 @@ ivas_error ivas_dec( st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); - /* Audio signal decoding */ +#ifdef OMASA_UPDATES + /* set ISM parameters */ + int16_t nchan_ism, nchan_transport_ism; + nchan_ism = st_ivas->nchan_ism; + nchan_transport_ism = st_ivas->nchan_ism; + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + { + nchan_ism = 1; + nchan_transport_ism = 1; + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + { + nchan_ism = 0; + nchan_transport_ism = 1; + } +#endif + + /* decode ISM metadata */ +#ifndef OMASA_UPDATES #ifdef OMASA_UPDATES if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) #else @@ -471,10 +489,7 @@ ivas_error ivas_dec( { if ( st_ivas->nSCE == 1 ) { - if ( ( error = ivas_sce_dec( st_ivas, 0, &output[2], output_frame, nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) - { - return error; - } + ivas_sce_dec( st_ivas, 0, &output[2], output_frame, nb_bits_metadata[1] ); } else { @@ -484,24 +499,19 @@ ivas_error ivas_dec( } } else - { -#ifdef OMASA_UPDATES - int16_t nchan_ism = st_ivas->nchan_ism; - if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) - { - nchan_ism = 1; - } +#else + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) #endif - - /* decode ISM format */ + { + /* decode ISM metadata */ #ifdef NCHAN_ISM_PARAMETER if ( ( error = ivas_ism_metadata_dec( ism_total_brate, #ifdef OMASA_UPDATES - nchan_ism, + nchan_ism, &nchan_transport_ism, #else - st_ivas->nchan_ism, + st_ivas->nchan_ism, &( st_ivas->nSCE ), #endif - &( st_ivas->nSCE ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, st_ivas->hISMDTX, NULL ) ) != IVAS_ERR_OK ) + st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, st_ivas->hISMDTX, NULL ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_ism_metadata_dec( ism_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, NULL, NULL ) ) != IVAS_ERR_OK ) #endif @@ -509,19 +519,7 @@ ivas_error ivas_dec( return error; } - for ( n = 0; n < st_ivas->nSCE - 1; n++ ) - { - if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, sum_s( &nb_bits_metadata[1], st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) - { - return error; - } - + // VE: move the following updates into ivas_ism_metadata_dec() #ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { @@ -531,7 +529,7 @@ ivas_error ivas_dec( st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); } } - else + else /* ISM_MASA_MODE_MASA_ONE_OBJ */ { st_ivas->hMasaIsmData->azimuth_separated_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->azimuth + 0.5f ); st_ivas->hMasaIsmData->elevation_separated_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->elevation + 0.5f ); @@ -543,8 +541,35 @@ ivas_error ivas_dec( st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); } #endif + +#ifndef OMASA_UPDATES + for ( n = 0; n < st_ivas->nSCE - 1; n++ ) + { + if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, sum_s( &nb_bits_metadata[1], st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif } +#ifdef OMASA_UPDATES + /* decode ISM channels */ + for ( n = 0; n < nchan_transport_ism; n++ ) + { + if ( ( error = ivas_sce_dec( st_ivas, n, &output[st_ivas->nchan_transport + n], output_frame, nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif + + /* decode MASA channels */ if ( ( error = ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { return error; @@ -575,7 +600,7 @@ ivas_error ivas_dec( for ( n = 0; n < st_ivas->nchan_ism; n++ ) { - mvr2r( output[n + 2], data_separated_objects[n], output_frame ); + mvr2r( output[2 + n], data_separated_objects[n], output_frame ); v_multc( data_separated_objects[n], gain, data_separated_objects[n], output_frame ); } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 329e62f932..e9300d6cf6 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1132,7 +1132,10 @@ ivas_error ivas_init_decoder( #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { - ivas_qmetadata_open( &( st_ivas->hQMetaData ) ); + if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) + { + return error; + } k = 0; ism_total_brate = 0; @@ -1150,7 +1153,10 @@ ivas_error ivas_init_decoder( st_ivas->nSCE = 1; ism_total_brate = sep_object_brate[k - 2][0]; - create_sce_dec( st_ivas, 0, ism_total_brate ); + if ( ( error = create_sce_dec( st_ivas, 0, ism_total_brate ) ) != IVAS_ERR_OK ) + { + return error; + } reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] ); @@ -1221,7 +1227,10 @@ ivas_error ivas_init_decoder( if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MONO_DOWNMIX ) { - ivas_dirac_dec_open( st_ivas ); + if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } if ( ( error = create_cpe_dec( st_ivas, 0, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 3abaa72637..acdf2b4a5b 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -98,7 +98,7 @@ ivas_error ivas_ism_enc( #endif ivas_error error; #ifdef MASA_AND_OBJECTS - int16_t i, nchan_transport; + int16_t i, nchan_transport_ism; #endif push_wmops( "ivas_ism_enc" ); @@ -132,18 +132,18 @@ ivas_error ivas_ism_enc( set_s( md_diff_flag, 1, nchan_ism ); #ifdef MASA_AND_OBJECTS - nchan_transport = st_ivas->nchan_transport; + nchan_transport_ism = st_ivas->nchan_transport; #ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { - nchan_transport = 1; + nchan_transport_ism = 1; nchan_ism = 1; } else #endif if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { - nchan_transport = st_ivas->hEncoderConfig->nchan_ism; + nchan_transport_ism = st_ivas->hEncoderConfig->nchan_ism; } #endif @@ -151,10 +151,10 @@ ivas_error ivas_ism_enc( * Preprocesing *-----------------------------------------------------------------*/ - /* in ISM format: st_ivas->nchan_transport = st_ivas->nSCE */ #ifdef MASA_AND_OBJECTS - for ( sce_id = 0; sce_id < nchan_transport; sce_id++ ) + for ( sce_id = 0; sce_id < nchan_transport_ism; sce_id++ ) #else + /* in ISM format: st_ivas->nchan_transport = st_ivas->nSCE */ for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) #endif { @@ -303,7 +303,7 @@ ivas_error ivas_ism_enc( nchan_ism, #endif #ifdef MASA_AND_OBJECTS - nchan_transport, + nchan_transport_ism, #else st_ivas->nchan_transport, #endif @@ -352,7 +352,7 @@ ivas_error ivas_ism_enc( nchan_ism, #endif #ifdef MASA_AND_OBJECTS - nchan_transport, + nchan_transport_ism, #else st_ivas->nchan_transport, #endif @@ -411,7 +411,7 @@ ivas_error ivas_ism_enc( *-----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS - for ( sce_id = 0; sce_id < nchan_transport; sce_id++ ) + for ( sce_id = 0; sce_id < nchan_transport_ism; sce_id++ ) #else for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) #endif @@ -471,7 +471,7 @@ ivas_error ivas_ism_enc( if ( dtx_flag ) { #ifdef MASA_AND_OBJECTS - for ( sce_id = 0; sce_id < nchan_transport; sce_id++ ) + for ( sce_id = 0; sce_id < nchan_transport_ism; sce_id++ ) #else for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) #endif @@ -493,7 +493,11 @@ ivas_error ivas_ism_enc( int16_t id, n; n = 0; +#ifdef MASA_AND_OBJECTS + for ( sce_id = 0; sce_id < nchan_transport_ism; sce_id++ ) +#else for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) +#endif { if ( sce_id != st_ivas->hISMDTX->sce_id_dtx ) { -- GitLab From 60715ab59244564e9b8dbf28f4feaf645b170c19 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 28 Mar 2023 18:20:08 +0200 Subject: [PATCH 315/375] decoder BR switching updates --- lib_dec/ivas_init_dec.c | 15 +++++----- lib_dec/ivas_ism_dec.c | 14 +++++----- lib_dec/ivas_omasa_dec.c | 60 ++++++++++++++++++++++++++++++++++++++-- lib_enc/ivas_init_enc.c | 5 ++-- lib_enc/ivas_omasa_enc.c | 8 ++++-- 5 files changed, 80 insertions(+), 22 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index e9300d6cf6..6b55ee6a0b 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1160,6 +1160,12 @@ ivas_error ivas_init_decoder( reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] ); +#ifdef OMASA_BRATE_SW + if ( ( error = ivas_ism_metadata_dec_create( st_ivas, 1, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } +#else #ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { @@ -1172,23 +1178,17 @@ ivas_error ivas_init_decoder( } else { -#ifdef OMASA_BRATE_SW - if ( ( error = ivas_ism_metadata_dec_create( st_ivas, 1, NULL ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( st_ivas->hIsmMetaData[0] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); } -#endif } #else if ( ( st_ivas->hIsmMetaData[0] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); } +#endif #endif } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) @@ -1535,6 +1535,7 @@ ivas_error ivas_init_decoder( } #ifdef OMASA_UPDATES + // VE: introduce a new renderer_type for this case if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL ) { /* Use td renderer for the objects in DISC mode */ diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index b6f33df845..1c908998a4 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -52,7 +52,7 @@ static ivas_error ivas_ism_bitrate_switching( const ISM_MODE last_ism_mode /* i : last ISM mode */ #ifndef NCHAN_ISM_PARAMETER , - const int16_t num_obj /* i : number of objects in the bitstream */ + const int16_t num_obj /* i : number of objects in the bitstream */ #endif ) { @@ -71,14 +71,14 @@ static ivas_error ivas_ism_bitrate_switching( , 0 #endif - ) ) != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL + if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL #ifdef MASA_AND_OBJECTS , 0 #endif -) ) != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) #endif { return error; @@ -209,7 +209,7 @@ static ivas_error ivas_ism_bitrate_switching( ivas_td_binaural_close( &st_ivas->hBinRendererTd ); } - if ( st_ivas->hHrtfTD != NULL ) + if ( st_ivas->hHrtfTD != NULL ) // VE: this looks suspicious { st_ivas->hHrtfTD = NULL; } @@ -261,7 +261,7 @@ ivas_error ivas_ism_dec_config( #endif #ifndef NCHAN_ISM_PARAMETER , - const int16_t num_obj /* i : number of objects in the bitstream */ + const int16_t num_obj /* i : number of objects in the bitstream */ #endif ) { @@ -334,11 +334,11 @@ ivas_error ivas_ism_dec_config( #endif { return error; + } } } } } - } else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { #ifdef DISCRETE_ISM_DTX_CNG diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index c3f1d35fdc..8ef1dbf26e 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -35,6 +35,9 @@ #include "ivas_cnst.h" #include "ivas_prot.h" #include "prot.h" +#ifdef OMASA_UPDATES +#include "ivas_prot_rend.h" +#endif #ifdef OMASA_BRATE_SW #include "ivas_rom_com.h" #endif @@ -147,7 +150,6 @@ ivas_error ivas_omasa_dec_config( ivas_error error; /* initializations */ - error = IVAS_ERR_OK; ism_total_brate = 0; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -229,13 +231,16 @@ ivas_error ivas_omasa_dec_config( } } - if ( ism_mode_old != st_ivas->ism_mode ) { /* ISM MD reconfig. */ n_MD = 0; +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#endif { n_MD = 1; @@ -270,7 +275,11 @@ ivas_error ivas_omasa_dec_config( st_ivas->hCPE[0]->element_brate = ivas_total_brate - ism_total_brate; /* objects renderer reconfig. */ +#ifdef OMASA_UPDATES + if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) +#else if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) +#endif { if ( st_ivas->hIsmRendererData == NULL ) { @@ -279,7 +288,11 @@ ivas_error ivas_omasa_dec_config( return error; } } +#ifdef OMASA_UPDATES + else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#else else if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#endif { for ( n = 1; n < st_ivas->hMasaIsmData->delayBuffer_nchan; n++ ) { @@ -313,8 +326,13 @@ ivas_error ivas_omasa_dec_config( mvr2r( tmp, st_ivas->hMasaIsmData->delayBuffer[0], st_ivas->hMasaIsmData->delayBuffer_size ); } } +#ifdef OMASA_UPDATES + else if ( st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) +#else else if ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) +#endif { + // VE: use ivas_masa_ism_data_close() instead? for ( n = 0; n < st_ivas->hMasaIsmData->delayBuffer_nchan; n++ ) { free( st_ivas->hMasaIsmData->delayBuffer[n] ); @@ -325,9 +343,45 @@ ivas_error ivas_omasa_dec_config( free( st_ivas->hIsmRendererData ); st_ivas->hIsmRendererData = NULL; } + +#ifdef OMASA_UPDATES + // VE: introduce a new renderer_type for this case + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) + { + /* Use td renderer for the objects in DISC mode */ + error = ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_ism, st_ivas->ivas_format, + st_ivas->transport_config, +#ifdef TD5 + st_ivas->hRenderConfig->directivity, +#endif + st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); + if ( ( error ) != IVAS_ERR_OK ) + { + return error; + } + + /* Reserve memory for delay buffer */ + if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + if ( st_ivas->hBinRendererTd != NULL ) + { + ivas_td_binaural_close( &st_ivas->hBinRendererTd ); + } + + if ( st_ivas->hHrtfTD != NULL ) // VE: this is copied from ivas_ism_bitrate_switching() but a review is needed + { + st_ivas->hHrtfTD = NULL; + } + } +#endif } - return error; + return IVAS_ERR_OK; } #endif diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 8b8c4bfd4f..1fd102c07c 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -633,10 +633,11 @@ ivas_error ivas_init_encoder( return error; } } + #ifdef OMASA_UPDATES - if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO && ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM) ) + if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO && ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM ) ) #else - if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) + if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) #endif { st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 4f9148e228..2ec461d5f9 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -232,11 +232,9 @@ ivas_error ivas_omasa_enc_config( ENCODER_CONFIG_HANDLE hEncoderConfig; ivas_error error; - error = IVAS_ERR_OK; hEncoderConfig = st_ivas->hEncoderConfig; ivas_total_brate = hEncoderConfig->ivas_total_brate; - //ivas_masa_enc_reconfigure( st_ivas ); // VE: might not be needed @@ -311,7 +309,11 @@ ivas_error ivas_omasa_enc_config( st_ivas->hCPE[0]->element_brate = ivas_total_brate - ism_total_brate; +#ifdef OMASA_UPDATES + if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO && ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM ) ) +#else if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) +#endif { hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; } @@ -333,7 +335,7 @@ ivas_error ivas_omasa_enc_config( ivas_omasa_set_config( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hEncoderConfig->input_Fs, st_ivas->ism_mode ); } - return error; + return IVAS_ERR_OK; } #endif -- GitLab From fd62e881c4956ea826ae27751040ac8e6f6a597d Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 28 Mar 2023 19:55:46 +0200 Subject: [PATCH 316/375] fix decoder BR switching --- lib_dec/ivas_cpe_dec.c | 9 ++++----- lib_dec/ivas_omasa_dec.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 92b0668072..b52c2ea054 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -249,11 +249,9 @@ ivas_error ivas_cpe_dec( nb_bits -= SID_FORMAT_NBITS; sts[1]->bit_stream -= SID_FORMAT_NBITS; } -#ifdef MASA_AND_OBJECTS - if ( ( ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) || - ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( cpe_brate < MASA_STEREO_MIN_BITRATE ) ) ) && - ivas_total_brate > IVAS_SID_5k2 ) +#ifdef MASA_AND_OBJECTS + if ( ( ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) || ( st_ivas->ivas_format == MASA_ISM_FORMAT && cpe_brate < MASA_STEREO_MIN_BITRATE ) ) && ivas_total_brate > IVAS_SID_5k2 ) #else if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && ivas_total_brate > IVAS_SID_5k2 ) #endif @@ -373,6 +371,7 @@ ivas_error ivas_cpe_dec( /*----------------------------------------------------------------* * Core codec configuration *----------------------------------------------------------------*/ + for ( n = 0; n < n_channels; n++ ) { /* set ACELP12k8 / ACELP16k flag for flexible ACELP core */ @@ -1116,7 +1115,7 @@ static void read_stereo_mode_and_bwidth( { /* read stereo technology info */ #ifdef OMASA_UPDATES - if ( ( hCPE->element_brate < MIN_BRATE_MDCT_STEREO && st_ivas->hMCT == NULL ) || ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM && hCPE->element_brate == IVAS_48k) ) + if ( ( hCPE->element_brate < MIN_BRATE_MDCT_STEREO && st_ivas->hMCT == NULL ) || ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM && hCPE->element_brate == IVAS_48k ) ) #else if ( hCPE->element_brate < MIN_BRATE_MDCT_STEREO && st_ivas->hMCT == NULL ) #endif diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 8ef1dbf26e..52812b6fb3 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -187,6 +187,16 @@ ivas_error ivas_omasa_dec_config( return error; } + // VE!!!!!: verification needed, see comment "/* Todo: Nokia make for MASA_ISM*/" in ivas_masa_dec_reconfigure() + if ( cpe_brate < MASA_STEREO_MIN_BITRATE ) + { + st_ivas->hCPE[0]->nchan_out = 1; + } + else + { + st_ivas->hCPE[0]->nchan_out = 2; + } + /* OMASA reconfig. */ if ( st_ivas->hMasaIsmData == NULL && st_ivas->ivas_format == MASA_ISM_FORMAT ) { -- GitLab From 3e1b75f32fbb12501afd072933b7eba1cd49823b Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Wed, 29 Mar 2023 08:00:32 +0200 Subject: [PATCH 317/375] clang formatting fix --- lib_enc/ivas_masa_enc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index ec8e3fe799..b094e5a761 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -2184,7 +2184,5 @@ static void detect_framing_async( sync_state->prev_sim_stop = n_sim_stop; sync_state->prev_offset = found_offset; sync_state->frame_mode = frame_mode; - } #endif - -- GitLab From 4afc35589b870d1a8c460f67ed65c1460224bfb4 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Wed, 29 Mar 2023 09:23:50 +0200 Subject: [PATCH 318/375] cleanup define related to FIX_MDCT_BASED_BWD changes --- lib_com/ivas_prot.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index e8597bbf3c..72975e1f9f 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -2808,9 +2808,7 @@ void ivas_mct_core_enc( CPE_ENC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE encoder structures */ const int16_t nChannels, /* i : number of channels to be coded */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ -#ifndef DISABLE_BWD_MCT const int16_t switch_bw, /* i : flag bandwidth switch occurance */ -#endif const int16_t lfe_bits, /* i : bits spent for LFE */ const int16_t sba_order /* i : Ambisonic (SBA) order */ ); -- GitLab From 9acedd205d185c1146e03188a94d1483f76e8396 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 29 Mar 2023 12:54:43 +0200 Subject: [PATCH 319/375] re-add orientation tracking to self_test.prm --- scripts/config/self_test.prm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index f26fba423a..635a3beb1d 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -408,6 +408,10 @@ ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 512000 48 testv/stv4ISM48s.wav bit ../IVAS_dec 5_1 48 bit testv/stv4ISM48s.wav_512000_48-48_5_1.tst +// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation, Orientation tracking +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR_OtrAvg.tst + // 1 ISM with metadata bitrate switching from 13.2 kbps to 128 kbps, 32 kHz in, 32 kHz out, mono out, DTX on ../IVAS_cod -dtx -ism 1 testv/stvISM1.csv ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv32c.wav bit ../IVAS_dec MONO 32 bit testv/stv32c.wav_brate_sw_32-32_mono_dtx.tst @@ -454,6 +458,10 @@ ../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit ../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_Binaural_Headrot.tst +// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot_OtrAvg.tst + // SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.wav bit ../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_FEC5.tst @@ -498,6 +506,10 @@ ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Headrot.tst +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrAvg.tst + // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit ../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural_FEC5.tst @@ -554,6 +566,10 @@ ../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.wav_SBA_128000_32-32_Binaural_room_Headrot.tst +// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_OtrAvg.tst + // SBA at 192 kbps, 48kHz in, 48kHz out, HOA2 out, random FEC at 5% ../IVAS_cod -sba 3 192000 48 testv/stv3OA48c.wav bit ../IVAS_dec -fec 5 HOA2 48 bit testv/stv3OA48c.wav_SBA_192000_48-48_HOA2_FEC5.tst @@ -688,6 +704,10 @@ ../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom_Headrot.tst +// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_OtrAvg.tst + // MASA 1dir 2TC at 48 kbps, 48kHz in, 48kHz out, 7_1_4 out, random FEC at 5% ../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 48000 48 testv/stv1MASA2TC48c.wav bit ../IVAS_dec -fec 5 7_1_4 48 bit testv/stv1MASA2TC48c.wav_48000_48-48_7_1_4_FEC5.tst @@ -826,6 +846,10 @@ ../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv51MC48c.wav_MC51_256000_48-48_BinauralRoom_Headrot.tst +// Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, head rotation, Orientation tracking +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot_OtrAvg.tst + // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out ../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.wav bit ../IVAS_dec 5_1 48 bit testv/stv51MC48c.wav_MC51_384000_48-48_5_1.tst -- GitLab From a83cfab5936b427e52782134783b6dc81035becd Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 29 Mar 2023 13:15:35 +0200 Subject: [PATCH 320/375] add otr cases --- scripts/config/self_test.prm | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 635a3beb1d..7c40bec790 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -425,7 +425,6 @@ ../IVAS_dec HOA3 48 bit testv/stv4ISM48s.wav_brate_sw_48-48_DTX_hoa3.tst - // SBA at 13.2 kbps, 32kHz in, 32kHz out, HOA3 out ../IVAS_cod -sba 3 13200 32 testv/stv3OA32c.wav bit ../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_SBA_13200_32-32_HOA3.tst -- GitLab From 9a2ff2e04307cd279895aaefb6d2b0d2775086dd Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 29 Mar 2023 13:58:45 +0200 Subject: [PATCH 321/375] add the reference vector test from FhG --- scripts/config/self_test.prm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 7c40bec790..984c0cc0f9 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -509,6 +509,14 @@ ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit ../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrAvg.tst +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t trajectories/full-circle-4s.csv -rvf trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPos.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking in level mode +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t trajectories/full-circle-with-up-and-down-4s.csv -rvf trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPosLev.tst + // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit ../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural_FEC5.tst -- GitLab From 0cdb3f71c6ebebcf1a0dc408f796e687da55f1bb Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 29 Mar 2023 14:05:58 +0200 Subject: [PATCH 322/375] add three "VE:" comments; formal improvements --- lib_enc/ivas_masa_enc.c | 79 ++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 33 deletions(-) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index b094e5a761..83381b7df5 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -41,7 +41,7 @@ #include "prot.h" #ifdef FIX_382_MASA_META_FRAMING_ASYNC -#include +#include // VE: please remove it #endif /*-----------------------------------------------------------------------* @@ -54,9 +54,9 @@ static void combine_directions( MASA_ENCODER_HANDLE hMasa ); static void find_n_largest( const float *input, int16_t *largestIndices, const int16_t numElements, const int16_t numLargest ); -static void move_metadata_to_qmetadata( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMeta ); +static void move_metadata_to_qmetadata( const MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMeta ); -static void detect_metadata_composition( MASA_ENCODER_HANDLE hMasa, uint8_t *joinedSubframes, uint8_t *coherencePresent, uint8_t *isTwoDir ); +static void detect_metadata_composition( const MASA_ENCODER_HANDLE hMasa, uint8_t *joinedSubframes, uint8_t *coherencePresent, uint8_t *isTwoDir ); static void compensate_energy_ratios( MASA_ENCODER_HANDLE hMasa ); @@ -65,13 +65,13 @@ static int16_t encode_lfe_to_total_energy_ratio( MASA_ENCODER_HANDLE hMasa, BSTR static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); #ifdef FIX_382_MASA_META_FRAMING_ASYNC -static void average_masa_metadata( MASA_ENCODER_HANDLE hMasa ); +static void average_masa_metadata( MASA_METADATA_FRAME *masaMetadata, float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] ); -static void copy_masa_metadata_subframe( MASA_METADATA_HANDLE hMetaFrom, const uint8_t sfFrom, MASA_METADATA_HANDLE hMetaTo, const uint8_t sfTo ); +static void copy_masa_metadata_subframe( const MASA_METADATA_HANDLE hMetaFrom, const uint8_t sfFrom, MASA_METADATA_HANDLE hMetaTo, const uint8_t sfTo ); -static void copy_masa_metadata( MASA_METADATA_HANDLE hMetaFrom, MASA_METADATA_HANDLE hMetaTo ); +static void copy_masa_metadata( const MASA_METADATA_HANDLE hMetaFrom, MASA_METADATA_HANDLE hMetaTo ); -static uint8_t are_masa_subframes_similar( MASA_METADATA_HANDLE frame1, const uint8_t sf1_idx, MASA_METADATA_HANDLE frame2, const uint8_t sf2_idx ); +static uint8_t are_masa_subframes_similar( const MASA_METADATA_HANDLE frame1, const uint8_t sf1_idx, const MASA_METADATA_HANDLE frame2, const uint8_t sf2_idx ); static void detect_framing_async( MASA_ENCODER_HANDLE hMasa ); #endif @@ -533,7 +533,7 @@ ivas_error ivas_masa_enc_config( if ( hMasa->data.sync_state.frame_mode == MASA_FRAME_1SF && hMasa->data.sync_state.prev_offset != 0 ) { /* average over sub-frames */ - average_masa_metadata( hMasa ); + average_masa_metadata( &( hMasa->masaMetadata ), hMasa->data.energy ); } #endif @@ -1045,7 +1045,7 @@ static void find_n_largest( static void move_metadata_to_qmetadata( - MASA_ENCODER_HANDLE hMasa, + const MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMeta ) { int16_t dir, sf, band; @@ -1117,10 +1117,10 @@ static void move_metadata_to_qmetadata( /* This function studies parametric MASA metadata to provide information for codec configuration */ static void detect_metadata_composition( - MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder data */ - uint8_t *joinedSubframes, /* o : Result of subframe composition */ - uint8_t *coherencePresent, /* o : Result of coherence presence */ - uint8_t *isTwoDir /* o : Result of two direction check */ + const MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder data */ + uint8_t *joinedSubframes, /* o : Result of subframe composition */ + uint8_t *coherencePresent, /* o : Result of coherence presence */ + uint8_t *isTwoDir /* o : Result of two direction check */ ) { MASA_METADATA_FRAME *hMeta; @@ -1801,22 +1801,21 @@ void ivas_masa_enc_reconfigure( return; } + #ifdef FIX_382_MASA_META_FRAMING_ASYNC /*-------------------------------------------------------------------* * average_masa_metadata() * * Average MASA metadata frame subframe contents: applies aggregation over time *-------------------------------------------------------------------*/ + static void average_masa_metadata( - MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder handle */ -) + MASA_METADATA_FRAME *hMeta, + float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] ) { int16_t i, j, k; float azi_rad, ele_rad; uint8_t numDirections; - MASA_METADATA_HANDLE hMeta; - - hMeta = &( hMasa->masaMetadata ); /* use the nominal values without data-adaptivity */ numDirections = hMeta->descriptive_meta.numberOfDirections + 1; @@ -1838,20 +1837,20 @@ static void average_masa_metadata( { azi_rad = hMeta->directional_meta[i].azimuth[j][k] / 180.0f * EVS_PI; ele_rad = hMeta->directional_meta[i].elevation[j][k] / 180.0f * EVS_PI; - vec_len = hMeta->directional_meta[i].energy_ratio[j][k] * hMasa->data.energy[j][k]; + vec_len = hMeta->directional_meta[i].energy_ratio[j][k] * energy[j][k]; /* energy-weighted sum over subframes */ x_sum += cosf( azi_rad ) * cosf( ele_rad ) * vec_len; y_sum += sinf( azi_rad ) * cosf( ele_rad ) * vec_len; z_sum += sinf( ele_rad ) * vec_len; - energy_sum += hMasa->data.energy[j][k]; + energy_sum += energy[j][k]; - spread_coh_sum += hMeta->directional_meta[i].spread_coherence[j][k] * hMasa->data.energy[j][k]; + spread_coh_sum += hMeta->directional_meta[i].spread_coherence[j][k] * energy[j][k]; if ( i == 0 ) { /* this is in common metadata and not in each direction */ - surr_coh_sum += hMeta->common_meta.surround_coherence[j][k] * hMasa->data.energy[j][k]; + surr_coh_sum += hMeta->common_meta.surround_coherence[j][k] * energy[j][k]; } } @@ -1899,8 +1898,11 @@ static void average_masa_metadata( hMeta->common_meta.remainder_to_total_ratio[j][k] = 0.0f; } } + + return; } + /*-------------------------------------------------------------------* * copy_masa_metadata_subframe() * @@ -1908,13 +1910,14 @@ static void average_masa_metadata( *-------------------------------------------------------------------*/ static void copy_masa_metadata_subframe( - MASA_METADATA_HANDLE hMetaFrom, /* i : MASA frame metdata to be copied */ - const uint8_t sfFrom, /* i : subframe index of the copy source */ - MASA_METADATA_HANDLE hMetaTo, /* o : MASA frame metadata copy destination */ - const uint8_t sfTo /* i : subframe index of the copy target */ + const MASA_METADATA_HANDLE hMetaFrom, /* i : MASA frame metdata to be copied */ + const uint8_t sfFrom, /* i : subframe index of the copy source */ + MASA_METADATA_HANDLE hMetaTo, /* o : MASA frame metadata copy destination */ + const uint8_t sfTo /* i : subframe index of the copy target */ ) { uint8_t dir; + /* directional metadata */ for ( dir = 0; dir < MASA_MAXIMUM_DIRECTIONS; dir++ ) { @@ -1928,8 +1931,11 @@ static void copy_masa_metadata_subframe( mvr2r( hMetaFrom->common_meta.diffuse_to_total_ratio[sfFrom], hMetaTo->common_meta.diffuse_to_total_ratio[sfTo], MASA_FREQUENCY_BANDS ); mvr2r( hMetaFrom->common_meta.surround_coherence[sfFrom], hMetaTo->common_meta.surround_coherence[sfTo], MASA_FREQUENCY_BANDS ); mvr2r( hMetaFrom->common_meta.remainder_to_total_ratio[sfFrom], hMetaTo->common_meta.remainder_to_total_ratio[sfTo], MASA_FREQUENCY_BANDS ); + + return; } + /*-------------------------------------------------------------------* * copy_masa_metadata() * @@ -1937,13 +1943,14 @@ static void copy_masa_metadata_subframe( *-------------------------------------------------------------------*/ static void copy_masa_metadata( - MASA_METADATA_HANDLE hMetaFrom, /* i : MASA frame metadata to be copied */ - MASA_METADATA_HANDLE hMetaTo /* o : MASA frame metadata copy destination */ + const MASA_METADATA_HANDLE hMetaFrom, /* i : MASA frame metadata to be copied */ + MASA_METADATA_HANDLE hMetaTo /* o : MASA frame metadata copy destination */ ) { uint8_t sf; /* descriptive metadata */ + // VE: please do not use memcpy() and replace by mvr2r() etc. memcpy( hMetaTo->descriptive_meta.formatDescriptor, hMetaFrom->descriptive_meta.formatDescriptor, sizeof( hMetaFrom->descriptive_meta.formatDescriptor ) ); hMetaTo->descriptive_meta.numberOfDirections = hMetaFrom->descriptive_meta.numberOfDirections; @@ -1959,8 +1966,11 @@ static void copy_masa_metadata( { copy_masa_metadata_subframe( hMetaFrom, sf, hMetaTo, sf ); } + + return; } + /*-------------------------------------------------------------------* * are_masa_subframes_similar() * @@ -1968,10 +1978,10 @@ static void copy_masa_metadata( *-------------------------------------------------------------------*/ static uint8_t are_masa_subframes_similar( - MASA_METADATA_HANDLE frame1, /* i : MASA metadata frame 1 */ - const uint8_t sf1_idx, /* i : index of the subframe of frame1 to inspect */ - MASA_METADATA_HANDLE frame2, /* i : MASA metadata frame 2 */ - const uint8_t sf2_idx /* o : index of the subframe of frame2 to inspect */ + const MASA_METADATA_HANDLE frame1, /* i : MASA metadata frame 1 */ + const uint8_t sf1_idx, /* i : index of the subframe of frame1 to inspect */ + const MASA_METADATA_HANDLE frame2, /* i : MASA metadata frame 2 */ + const uint8_t sf2_idx /* o : index of the subframe of frame2 to inspect */ ) { uint8_t num_dir; @@ -2045,7 +2055,7 @@ static uint8_t are_masa_subframes_similar( } } - /* TODO: a nicer negation */ + /* TODO: a nicer negation */ // VE: ?? if ( sf_differ ) { return FALSE; @@ -2056,6 +2066,7 @@ static uint8_t are_masa_subframes_similar( } } + /*-------------------------------------------------------------------* * detect_framing_async() * @@ -2184,5 +2195,7 @@ static void detect_framing_async( sync_state->prev_sim_stop = n_sim_stop; sync_state->prev_offset = found_offset; sync_state->frame_mode = frame_mode; + + return; } #endif -- GitLab From f8eebc9709f4df3108d916d14865f839d719d806 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Wed, 29 Mar 2023 14:34:02 +0200 Subject: [PATCH 323/375] remove memcpy() --- lib_enc/ivas_masa_enc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 83381b7df5..dccd38100a 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -40,9 +40,6 @@ #include "wmc_auto.h" #include "prot.h" -#ifdef FIX_382_MASA_META_FRAMING_ASYNC -#include // VE: please remove it -#endif /*-----------------------------------------------------------------------* * Local function prototypes @@ -1947,11 +1944,13 @@ static void copy_masa_metadata( MASA_METADATA_HANDLE hMetaTo /* o : MASA frame metadata copy destination */ ) { - uint8_t sf; + uint8_t sf, byte_idx; /* descriptive metadata */ - // VE: please do not use memcpy() and replace by mvr2r() etc. - memcpy( hMetaTo->descriptive_meta.formatDescriptor, hMetaFrom->descriptive_meta.formatDescriptor, sizeof( hMetaFrom->descriptive_meta.formatDescriptor ) ); + for ( byte_idx = 0; byte_idx < 8; byte_idx++ ) + { + hMetaTo->descriptive_meta.formatDescriptor[byte_idx] = hMetaFrom->descriptive_meta.formatDescriptor[byte_idx]; + } hMetaTo->descriptive_meta.numberOfDirections = hMetaFrom->descriptive_meta.numberOfDirections; hMetaTo->descriptive_meta.numberOfChannels = hMetaFrom->descriptive_meta.numberOfChannels; -- GitLab From bf7f20704d5ba039bcf6bc9809f5579270eced6c Mon Sep 17 00:00:00 2001 From: hsd Date: Wed, 29 Mar 2023 15:24:14 +0200 Subject: [PATCH 324/375] Updated paths to files from the trajectories folder thx2sagnowski --- scripts/config/self_test.prm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 984c0cc0f9..84581809fe 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -511,11 +511,11 @@ // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t trajectories/full-circle-4s.csv -rvf trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPos.tst +../IVAS_dec -t ../scripts/trajectories/full-circle-4s.csv -rvf ../scripts/trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPos.tst // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking in level mode ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t trajectories/full-circle-with-up-and-down-4s.csv -rvf trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPosLev.tst +../IVAS_dec -t ../scripts/trajectories/full-circle-with-up-and-down-4s.csv -rvf ../scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPosLev.tst // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit -- GitLab From 865a4b9f1794096d4178274cd49464c223fb593e Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 29 Mar 2023 21:31:19 +0200 Subject: [PATCH 325/375] [cleanup] accept FIX_I109_ORIENTATION_TRACKING --- apps/decoder.c | 57 ------- apps/renderer.c | 47 ------ lib_com/ivas_cnst.h | 11 -- lib_com/options.h | 3 - lib_dec/ivas_init_dec.c | 15 -- lib_dec/ivas_ism_dec.c | 3 - lib_dec/ivas_mct_dec.c | 3 - lib_dec/lib_dec.c | 13 -- lib_dec/lib_dec.h | 2 - lib_rend/ivas_crend.c | 27 --- lib_rend/ivas_orient_trk.c | 238 --------------------------- lib_rend/ivas_prot_rend.h | 42 ----- lib_rend/ivas_rotation.c | 104 ------------ lib_rend/ivas_stat_rend.h | 33 ---- lib_rend/lib_rend.c | 40 ----- lib_rend/lib_rend.h | 2 - lib_util/audio_file_writer.c | 4 - lib_util/head_rotation_file_reader.c | 61 ------- lib_util/head_rotation_file_reader.h | 12 -- 19 files changed, 717 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 2b7268854a..fe6456defe 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -72,7 +72,6 @@ static #define MAX_NUM_OUTPUT_CHANNELS 16 #define MAX_OUTPUT_PCM_BUFFER_SIZE ( MAX_NUM_OUTPUT_CHANNELS * MAX_FRAME_SIZE ) -#ifdef FIX_I109_ORIENTATION_TRACKING #define IVAS_PUBLIC_ORIENT_TRK_NONE ( 0 ) #define IVAS_PUBLIC_ORIENT_TRK_REF ( 1 ) #define IVAS_PUBLIC_ORIENT_TRK_AVG ( 2 ) @@ -80,10 +79,6 @@ static #define IVAS_PUBLIC_ORIENT_TRK_REF_VEC ( 3 ) #define IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV ( 4 ) #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#else -#define IVAS_PUBLIC_ORIENT_TRK_REF 0 -#define IVAS_PUBLIC_ORIENT_TRK_AVG 1 -#endif typedef struct { @@ -97,10 +92,8 @@ typedef struct bool voipMode; bool enableHeadRotation; char *headrotTrajFileName; -#ifdef FIX_I109_ORIENTATION_TRACKING bool enableReferenceRotation; char *refrotTrajFileName; -#endif #ifdef OTR_REFERENCE_VECTOR_TRACKING bool enableReferenceVectorTracking; char *referenceVectorTrajFileName; @@ -140,15 +133,11 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); -#ifdef FIX_I109_ORIENTATION_TRACKING #ifdef OTR_REFERENCE_VECTOR_TRACKING static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, HeadRotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); #else /* OTR_REFERENCE_VECTOR_TRACKING */ static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, HeadRotFileReader *refRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); #endif -#else -static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); -#endif static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); #ifdef DEBUGGING static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); @@ -174,9 +163,7 @@ int main( LsCustomFileReader *hLsCustomReader = NULL; hrtfFileReader *hrtfReader = NULL; HeadRotFileReader *headRotReader = NULL; -#ifdef FIX_I109_ORIENTATION_TRACKING HeadRotFileReader *refRotReader = NULL; -#endif #ifdef OTR_REFERENCE_VECTOR_TRACKING Vector3PairFileReader *referenceVectorReader = NULL; #endif /* OTR_REFERENCE_VECTOR_TRACKING */ @@ -289,7 +276,6 @@ int main( } } -#ifdef FIX_I109_ORIENTATION_TRACKING /*------------------------------------------------------------------------------------------* * Open reference rotation file *------------------------------------------------------------------------------------------*/ @@ -301,7 +287,6 @@ int main( goto cleanup; } } -#endif #ifdef OTR_REFERENCE_VECTOR_TRACKING /*------------------------------------------------------------------------------------------* * Open reference vector trajectory file @@ -572,15 +557,11 @@ int main( } else { -#ifdef FIX_I109_ORIENTATION_TRACKING #ifdef OTR_REFERENCE_VECTOR_TRACKING error = decodeG192( arg, hBsReader, headRotReader, refRotReader, referenceVectorReader, hIvasDec, pcmBuf ); #else error = decodeG192( arg, hBsReader, headRotReader, refRotReader, hIvasDec, pcmBuf ); #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#else - error = decodeG192( arg, hBsReader, headRotReader, hIvasDec, pcmBuf ); -#endif } if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE ) @@ -636,9 +617,7 @@ cleanup: CustomLsReader_close( &hLsCustomReader ); hrtfFileReader_close( &hrtfReader ); HeadRotationFileReader_close( &headRotReader ); -#ifdef FIX_I109_ORIENTATION_TRACKING HeadRotationFileReader_close( &refRotReader ); -#endif #ifdef OTR_REFERENCE_VECTOR_TRACKING Vector3PairFileReader_close( &referenceVectorReader ); #endif /* OTR_REFERENCE_VECTOR_TRACKING */ @@ -778,7 +757,6 @@ static bool parseCmdlIVAS_dec( arg->enableHeadRotation = false; arg->headrotTrajFileName = NULL; -#ifdef FIX_I109_ORIENTATION_TRACKING arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; arg->enableReferenceRotation = false; arg->headrotTrajFileName = NULL; @@ -786,9 +764,6 @@ static bool parseCmdlIVAS_dec( arg->enableReferenceVectorTracking = false; arg->referenceVectorTrajFileName = NULL; #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#else - arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; -#endif #ifdef SUPPORT_JBM_TRACEFILE arg->jbmTraceFilename = NULL; @@ -963,26 +938,16 @@ static bool parseCmdlIVAS_dec( } else if ( strcmp( argv_to_upper, "-OTR" ) == 0 ) { -#ifndef FIX_I109_ORIENTATION_TRACKING - if ( strlen( argv[i + 1] ) > 3 ) - { - fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", argv[i + 1] ); - usage_dec(); - return false; - } -#endif strncpy( argv_to_upper, argv[i + 1], sizeof( argv_to_upper ) - 1 ); argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; to_upper( argv_to_upper ); -#ifdef FIX_I109_ORIENTATION_TRACKING if ( strcmp( argv_to_upper, "NONE" ) == 0 ) { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; } else -#endif if ( strcmp( argv_to_upper, "REF" ) == 0 ) { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; @@ -1009,7 +974,6 @@ static bool parseCmdlIVAS_dec( } i += 2; } -#ifdef FIX_I109_ORIENTATION_TRACKING else if ( strcmp( argv_to_upper, "-RF" ) == 0 ) { arg->enableReferenceRotation = true; @@ -1025,7 +989,6 @@ static bool parseCmdlIVAS_dec( arg->refrotTrajFileName = argv[i]; i++; } -#endif #ifdef OTR_REFERENCE_VECTOR_TRACKING else if ( strcmp( argv_to_upper, "-RVF" ) == 0 ) { @@ -1235,13 +1198,9 @@ static void usage_dec( void ) fprintf( stdout, " default is OFF, if this option is not used\n" ); fprintf( stdout, "-force R : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" ); #endif -#ifdef FIX_I109_ORIENTATION_TRACKING fprintf( stdout, "-otr tracking_type : head orientation tracking type: 'none', 'ref' or 'avg' (only for binaural rendering)\n" ); fprintf( stdout, "-rf File : Reference rotation specified by external trajectory file\n" ); fprintf( stdout, " works only in combination with -otr ref mode\n" ); -#else - fprintf( stdout, "-otr tracking_type : head orientation tracking type: 'ref' or 'avg' (only for binaural rendering)\n" ); -#endif #ifdef OTR_REFERENCE_VECTOR_TRACKING fprintf( stdout, "-rvf File : Reference vector specified by external trajectory file\n" ); fprintf( stdout, " works only in combination with -otr ref_vec and ref_vec_lev modes\n" ); @@ -1479,12 +1438,10 @@ static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, -#ifdef FIX_I109_ORIENTATION_TRACKING HeadRotFileReader *refRotReader, #ifdef OTR_REFERENCE_VECTOR_TRACKING Vector3PairFileReader *referenceVectorReader, #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#endif IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ) @@ -1584,7 +1541,6 @@ static ivas_error decodeG192( goto cleanup; } -#ifdef FIX_I109_ORIENTATION_TRACKING #ifdef OTR_REFERENCE_VECTOR_TRACKING /* reference vector */ if ( arg.enableReferenceVectorTracking ) @@ -1623,13 +1579,11 @@ static ivas_error decodeG192( goto cleanup; } } -#endif /* Head-tracking input simulation */ if ( arg.enableHeadRotation ) { IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; -#ifdef FIX_I109_ORIENTATION_TRACKING for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { #ifdef TD5 @@ -1642,17 +1596,6 @@ static ivas_error decodeG192( goto cleanup; } } -#else -#ifdef TD5 - if ( ( error = HeadRotationFileReading( headRotReader, Quaternions, Pos ) ) != IVAS_ERR_OK ) -#else - if ( ( error = HeadRotationFileReading( headRotReader, Quaternions, frame ) ) != IVAS_ERR_OK ) -#endif - { - fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( headRotReader ) ); - goto cleanup; - } -#endif #ifdef TD5 if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions, Pos ) ) != IVAS_ERR_OK ) diff --git a/apps/renderer.c b/apps/renderer.c index 5e8ca98e9c..e28063ff2e 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -133,12 +133,10 @@ typedef struct char inMetadataFilePaths[RENDERER_MAX_ISM_INPUTS][RENDERER_MAX_CLI_ARG_LENGTH]; int16_t numInMetadataFiles; char headRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; -#ifdef FIX_I109_ORIENTATION_TRACKING #ifdef OTR_REFERENCE_VECTOR_TRACKING char referenceVectorFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; #endif /* OTR_REFERENCE_VECTOR_TRACKING */ char referenceRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; -#endif char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; int8_t orientationTracking; @@ -251,15 +249,11 @@ static const CmdLnParser_Option cliOptions[] = { .id = CmdLnOptionId_orientationTracking, .match = "tracking_type", .matchShort = "otr", -#ifdef FIX_I109_ORIENTATION_TRACKING #ifdef OTR_REFERENCE_VECTOR_TRACKING .description = "Head orientation tracking type: 'none', 'ref', 'avg' or `ref_vec` or `ref_vec_lev` (only for BINAURAL and BINAURAL_ROOM)", #else .description = "Head orientation tracking type: 'none', 'ref' or 'avg' (only for BINAURAL and BINAURAL_ROOM)", #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#else - .description = "Head orientation tracking type: 'ref' or 'avg' (only for BINAURAL and BINAURAL_ROOM)", -#endif }, { .id = CmdlnOptionId_lfePosition, @@ -529,12 +523,10 @@ int main( { IVAS_REND_HANDLE hIvasRend; HeadRotFileReader *headRotReader = NULL; -#ifdef FIX_I109_ORIENTATION_TRACKING #ifdef OTR_REFERENCE_VECTOR_TRACKING Vector3PairFileReader *referenceVectorReader = NULL; #endif /* OTR_REFERENCE_VECTOR_TRACKING */ HeadRotFileReader *referenceRotReader = NULL; -#endif hrtfFileReader *hrtfFileReader = NULL; IsmPositionProvider *positionProvider; RenderConfigReader *renderConfigReader = NULL; @@ -579,20 +571,11 @@ int main( convert_backslash( args.inputFilePath ); convert_backslash( args.outputFilePath ); -#ifndef FIX_I109_ORIENTATION_TRACKING - /* disable 'refrotequal' test cases */ - if ( strstr( args.headRotationFilePath, "azi_plus_2-ele_plus_2-every-100-frames.csv" ) != NULL ) - { - memset( args.headRotationFilePath, '\0', sizeof( args.headRotationFilePath ) ); - } -#endif convert_backslash( args.headRotationFilePath ); -#ifdef FIX_I109_ORIENTATION_TRACKING #ifdef OTR_REFERENCE_VECTOR_TRACKING convert_backslash( args.referenceVectorFilePath ); #endif /* OTR_REFERENCE_VECTOR_TRACKING */ convert_backslash( args.referenceRotationFilePath ); -#endif convert_backslash( args.inLfePanningMatrixFile ); if ( !isEmptyString( args.headRotationFilePath ) ) @@ -604,7 +587,6 @@ int main( } } -#ifdef FIX_I109_ORIENTATION_TRACKING if ( !isEmptyString( args.referenceRotationFilePath ) ) { if ( HeadRotationFileReader_open( args.referenceRotationFilePath, &referenceRotReader ) != IVAS_ERR_OK ) @@ -623,7 +605,6 @@ int main( } } #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#endif if ( !isEmptyString( args.customHrtfFilePath ) ) { @@ -760,12 +741,10 @@ int main( } } -#ifdef FIX_I109_ORIENTATION_TRACKING if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientationTracking ) ) != IVAS_ERR_OK ) { return error; } -#endif /* Set up output custom layout configuration */ if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) @@ -966,7 +945,6 @@ int main( ObjectPositionBuffer mtdBuffer; IsmPositionProvider_getNextFrame( positionProvider, &mtdBuffer ); -#ifdef FIX_I109_ORIENTATION_TRACKING #ifdef OTR_REFERENCE_VECTOR_TRACKING if ( referenceVectorReader != NULL ) { @@ -1003,14 +981,12 @@ int main( exit( -1 ); } } -#endif /* Read from head rotation trajectory file if specified */ if ( headRotReader != NULL ) { IVAS_QUATERNION quatBuffer[RENDERER_HEAD_POSITIONS_PER_FRAME]; -#ifdef FIX_I109_ORIENTATION_TRACKING for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) { #ifdef TD5 @@ -1023,13 +999,6 @@ int main( exit( -1 ); } } -#else -#ifdef TD5 - HeadRotationFileReading( headRotReader, quatBuffer, Pos ); -#else - HeadRotationFileReading( headRotReader, quatBuffer, frame ); -#endif -#endif #ifdef TD5 if ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer, Pos ) ) != IVAS_ERR_OK ) #else @@ -1226,12 +1195,10 @@ int main( AudioFileReader_close( &audioReader ); AudioFileWriter_close( &audioWriter ); HeadRotationFileReader_close( &headRotReader ); -#ifdef FIX_I109_ORIENTATION_TRACKING #ifdef OTR_REFERENCE_VECTOR_TRACKING Vector3PairFileReader_close( &referenceVectorReader ); #endif /* OTR_REFERENCE_VECTOR_TRACKING */ HeadRotationFileReader_close( &referenceRotReader ); -#endif hrtfFileReader_close( &hrtfFileReader ); IVAS_REND_Close( &hIvasRend ); IsmPositionProvider_close( positionProvider ); @@ -1457,15 +1424,11 @@ static bool parseOrientationTracking( to_upper( value ); -#ifdef FIX_I109_ORIENTATION_TRACKING if ( strcmp( value, "NONE" ) == 0 ) { *tracking_type = IVAS_ORIENT_TRK_NONE; } else if ( strcmp( value, "REF" ) == 0 ) -#else - if ( strcmp( value, "REF" ) == 0 ) -#endif { *tracking_type = IVAS_ORIENT_TRK_REF; } @@ -1473,7 +1436,6 @@ static bool parseOrientationTracking( { *tracking_type = IVAS_ORIENT_TRK_AVG; } -#ifdef FIX_I109_ORIENTATION_TRACKING #ifdef OTR_REFERENCE_VECTOR_TRACKING else if ( strcmp( value, "REF_VEC" ) == 0 ) { @@ -1484,7 +1446,6 @@ static bool parseOrientationTracking( *tracking_type = IVAS_ORIENT_TRK_REF_VEC_LEV; } #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#endif else { fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", value ); @@ -1702,20 +1663,14 @@ static CmdlnArgs defaultArgs( args.numInMetadataFiles = 0; clearString( args.headRotationFilePath ); -#ifdef FIX_I109_ORIENTATION_TRACKING #ifdef OTR_REFERENCE_VECTOR_TRACKING clearString( args.referenceVectorFilePath ); #endif /* OTR_REFERENCE_VECTOR_TRACKING */ clearString( args.referenceRotationFilePath ); -#endif clearString( args.customHrtfFilePath ); clearString( args.renderConfigFilePath ); -#ifdef FIX_I109_ORIENTATION_TRACKING args.orientationTracking = IVAS_ORIENT_TRK_NONE; -#else - args.orientationTracking = IVAS_ORIENT_TRK_REF; -#endif args.noDiegeticPan = 0.0f; args.delayCompensationEnabled = true; @@ -1790,7 +1745,6 @@ static void parseOption( assert( numOptionValues == 1 ); strncpy( args->headRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; -#ifdef FIX_I109_ORIENTATION_TRACKING #ifdef OTR_REFERENCE_VECTOR_TRACKING case CmdLnOptionId_referenceVectorFile: assert( numOptionValues == 1 ); @@ -1801,7 +1755,6 @@ static void parseOption( assert( numOptionValues == 1 ); strncpy( args->referenceRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; -#endif case CmdLnOptionId_customHrtfFile: assert( numOptionValues == 1 ); strncpy( args->customHrtfFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 3f48b0b43e..e97939b8a6 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1508,7 +1508,6 @@ typedef enum *----------------------------------------------------------------------------------*/ /* Orientation tracking types */ -#ifdef FIX_I109_ORIENTATION_TRACKING #define IVAS_ORIENT_TRK_NONE 0 #define IVAS_ORIENT_TRK_REF 1 #define IVAS_ORIENT_TRK_AVG 2 @@ -1516,27 +1515,17 @@ typedef enum #define IVAS_ORIENT_TRK_REF_VEC 3 #define IVAS_ORIENT_TRK_REF_VEC_LEV 4 #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#else -#define IVAS_ORIENT_TRK_REF 0 -#define IVAS_ORIENT_TRK_AVG 1 -#endif typedef enum { -#ifdef FIX_I109_ORIENTATION_TRACKING OTR_TRACKING_NONE = IVAS_ORIENT_TRK_NONE, -#else - OTR_TRACKING_NONE = IVAS_ORIENT_TRK_REF-1, -#endif OTR_TRACKING_REF_ORIENT = IVAS_ORIENT_TRK_REF, /* track orientation relative to external reference orientation (default: no rotation) */ OTR_TRACKING_AVG_ORIENT = IVAS_ORIENT_TRK_AVG /* track orientation relative to average orientation */ -#ifdef FIX_I109_ORIENTATION_TRACKING #ifdef OTR_REFERENCE_VECTOR_TRACKING , OTR_TRACKING_REF_VEC = IVAS_ORIENT_TRK_REF_VEC, /* track orientation relative to external reference vector */ OTR_TRACKING_REF_VEC_LEV = IVAS_ORIENT_TRK_REF_VEC_LEV /* track orientation relative to level component of external reference vector */ #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#endif } OTR_TRACKING_T; diff --git a/lib_com/options.h b/lib_com/options.h index c054a9b5a7..86f892db4a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -141,7 +141,6 @@ #define DISABLE_ADAP_RES_COD_TMP /* temporary fix for IVAS-403, disables adaptive residual coding */ /*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define FIX_I109_ORIENTATION_TRACKING /* Issue 109: Harmonize head and orientation tracking */ /*#define SBA_HPF_TUNING_DEC*/ #define BINAURALIZATION_DELAY_REPORT /* VA: Issue 255 - Changes the way the decoder delay is reported */ @@ -154,9 +153,7 @@ #define FIX_371_DELAY_REPORT /* Issue 371: div. by zero with -no_delay_cmp */ #define FIX_373_MASA_DELAY_COMP_MSAN /* Nokia: Issue 373: MASA audio/meta delay compensation. MSAN bugfix */ -#ifdef FIX_I109_ORIENTATION_TRACKING #define OTR_REFERENCE_VECTOR_TRACKING /* FhG: enables the reference position orientation tracking mode */ -#endif #define FIX_380_BFI_PARAMISM /* VA: issue 380 - fix metadata recovery in ParamISM BFI */ #define FIX_MDCT_BASED_BWD /* FhG: fixes for BWD for issues with reaction to transients for MDCT-stereo and MCT */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index bc0a69ae56..53b3216157 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -787,7 +787,6 @@ ivas_error ivas_init_decoder( } } -#ifdef FIX_I109_ORIENTATION_TRACKING /*-----------------------------------------------------------------* * Set head/orientation tracking *-----------------------------------------------------------------*/ @@ -836,7 +835,6 @@ ivas_error ivas_init_decoder( } #endif /* OTR_REFERENCE_VECTOR_TRACKING */ } -#endif /*-----------------------------------------------------------------* * Allocate and initialize SCE/CPE and other handles @@ -1336,13 +1334,8 @@ ivas_error ivas_init_decoder( } } -#ifdef FIX_I109_ORIENTATION_TRACKING if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, - st_ivas->hRenderConfig, st_ivas->hDecoderConfig->Opt_Headrotation, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1817,15 +1810,7 @@ void ivas_destroy_dec( } /* Head track data handle */ -#ifdef FIX_I109_ORIENTATION_TRACKING ivas_headTrack_close( &st_ivas->hHeadTrackData ); -#else - if ( st_ivas->hHeadTrackData != NULL ) - { - free( st_ivas->hHeadTrackData ); - st_ivas->hHeadTrackData = NULL; - } -#endif /* Time Domain binaural renderer handle */ if ( st_ivas->hBinRendererTd != NULL ) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 5e0b475e3e..e6571e83d9 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -158,9 +158,6 @@ static ivas_error ivas_ism_bitrate_switching( st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, -#ifndef FIX_I109_ORIENTATION_TRACKING - st_ivas->hDecoderConfig->Opt_Headrotation, -#endif st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 553cdf2a1b..8c53538dec 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1113,9 +1113,6 @@ static ivas_error ivas_mc_dec_reconfig( st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, -#ifndef FIX_I109_ORIENTATION_TRACKING - st_ivas->hDecoderConfig->Opt_Headrotation, -#endif st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 61c9494e30..bcbf60a9d3 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -901,11 +901,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( HEAD_TRACK_DATA_HANDLE hHeadTrackData; int16_t i; -#ifdef FIX_I109_ORIENTATION_TRACKING if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || orientation == NULL ) -#else - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) -#endif { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -920,7 +916,6 @@ ivas_error IVAS_DEC_FeedHeadTrackData( /* Move head-tracking data to the decoder handle */ for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { -#ifdef FIX_I109_ORIENTATION_TRACKING /* check for Euler angle signaling */ if ( orientation[i].w == -3.0f ) { @@ -928,12 +923,6 @@ ivas_error IVAS_DEC_FeedHeadTrackData( } ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, orientation[i], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hHeadTrackData->Quaternions[i] ); -#else - hHeadTrackData->Quaternions[i].w = orientation[i].w; - hHeadTrackData->Quaternions[i].x = orientation[i].x; - hHeadTrackData->Quaternions[i].y = orientation[i].y; - hHeadTrackData->Quaternions[i].z = orientation[i].z; -#endif #ifdef TD5 hHeadTrackData->Pos[i].x = Pos[i].x; hHeadTrackData->Pos[i].y = Pos[i].y; @@ -946,7 +935,6 @@ ivas_error IVAS_DEC_FeedHeadTrackData( return IVAS_ERR_OK; } -#ifdef FIX_I109_ORIENTATION_TRACKING /*---------------------------------------------------------------------* * IVAS_DEC_FeedRefRotData( ) * @@ -1001,7 +989,6 @@ ivas_error IVAS_DEC_FeedRefVectorData( return ivas_orient_trk_SetReferenceVector( pOtr, listenerPos, refPos ); } #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#endif /*---------------------------------------------------------------------* * IVAS_DEC_FeedCustomLsData( ) diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index a717e0002e..db22b6a5c0 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -184,7 +184,6 @@ ivas_error IVAS_DEC_FeedHeadTrackData( #endif ); -#ifdef FIX_I109_ORIENTATION_TRACKING /*! r: error code */ ivas_error IVAS_DEC_FeedRefRotData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ @@ -198,7 +197,6 @@ ivas_error IVAS_DEC_FeedRefVectorData( const IVAS_VECTOR3 refPos /* i : Reference position */ ); #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#endif /*! r: error code */ ivas_error IVAS_DEC_VoIP_FeedFrame( diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index c4941b610c..c05ae7c262 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -733,9 +733,6 @@ ivas_error ivas_rend_openCrend( const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg, -#ifndef FIX_I109_ORIENTATION_TRACKING - int16_t Opt_Headrotation, -#endif HRTFS_CREND_HANDLE hSetOfHRTF, const int32_t output_Fs ) { @@ -1141,30 +1138,6 @@ ivas_error ivas_rend_crendProcess( if ( hDecoderConfig && hDecoderConfig->Opt_Headrotation && hHeadTrackData && hHeadTrackData->num_quaternions >= 0 ) { /* Orientation tracking */ -#ifndef FIX_I109_ORIENTATION_TRACKING - if ( pCrend->hCrend->hTrack != NULL ) - { - if ( hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_AVG ) - { - ivas_orient_trk_SetTrackingType( pCrend->hCrend->hTrack, OTR_TRACKING_AVG_ORIENT ); - } - else - { - ivas_orient_trk_SetTrackingType( pCrend->hCrend->hTrack, OTR_TRACKING_REF_ORIENT ); - } - - /* get current subframe quaternion and convert to euler angles */ - Quat2Euler( hHeadTrackData->Quaternions[subframe_idx], &( pCrend->hCrend->m_fYaw ), &( pCrend->hCrend->m_fPitch ), &( pCrend->hCrend->m_fRoll ) ); - ivas_orient_trk_SetAbsoluteOrientation( pCrend->hCrend->hTrack, pCrend->hCrend->m_fYaw, pCrend->hCrend->m_fPitch, pCrend->hCrend->m_fRoll ); - - if ( ( error = ivas_orient_trk_Process( pCrend->hCrend->hTrack ) ) != IVAS_ERR_OK ) - { - return error; - } - - ivas_orient_trk_GetTrackedOrientation( pCrend->hCrend->hTrack, &( pCrend->hCrend->m_fYaw ), &( pCrend->hCrend->m_fPitch ), &( pCrend->hCrend->m_fRoll ) ); - } -#endif /* Rotation in SHD for: MC with elevation (5_1_2 / 5_1_4 / 7_1_4) -> BINAURAL diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index af71cbf543..b78809a759 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -57,7 +57,6 @@ * Local functions *------------------------------------------------------------------------------------------*/ -#ifdef FIX_I109_ORIENTATION_TRACKING /*------------------------------------------------------------------------------------------* * IdentityQuaternion() * @@ -375,45 +374,6 @@ static void VectorRotationToQuaternion( return; } #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#else -static float ClipAngle( - const float angle, - const float min_angle, - const float max_angle ) -{ - float result = angle; - - /* wrap angle modulo 2*pi into range of [-pi, pi> radians */ - /* 'while' assumed to use comparison to 0 */ - while ( result > EVS_PI ) - { - result -= PI2; - } - /* 'while' assumed to use comparison to 0 */ - while ( result <= -EVS_PI ) - { - result += PI2; - } - - /* Next, clip angle into range */ - /* 'if' assumed to use comparison to 0 */ - if ( result < min_angle ) - { - result = min_angle; - } - else - { - /* 'if' assumed to use comparison to 0 */ - if ( result > max_angle ) - { - result = max_angle; - } - } - - return result; -} - -#endif /*-------------------------------------------------------------------* * ivas_orient_trk_Init() @@ -421,14 +381,9 @@ static float ClipAngle( * *-------------------------------------------------------------------*/ -#ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_Init( -#else -void ivas_orient_trk_Init( -#endif ivas_orient_trk_state_t *pOTR ) /* i/o : orientation tracker handle */ { -#ifdef FIX_I109_ORIENTATION_TRACKING IVAS_QUATERNION identity; if ( pOTR == NULL ) @@ -438,10 +393,6 @@ void ivas_orient_trk_Init( identity.w = 1.0f; identity.x = identity.y = identity.z = 0.0f; -#else - /* Track relative to a reference orientation */ - pOTR->trackingType = OTR_TRACKING_REF_ORIENT; -#endif /* configuration parameters */ pOTR->centerAdaptationRate = 1.0f / 30.0f; @@ -451,7 +402,6 @@ void ivas_orient_trk_Init( /* initial adaptivity filter coefficient, will be auto-adapted */ pOTR->alpha = sinf( PI2 * pOTR->offCenterAdaptationRate / OTR_UPDATE_RATE ); /* start adaptation at off-center rate = fastest rate */ -#ifdef FIX_I109_ORIENTATION_TRACKING #ifdef OTR_REFERENCE_VECTOR_TRACKING pOTR->trkRot = identity; #endif /* OTR_REFERENCE_VECTOR_TRACKING */ @@ -463,27 +413,6 @@ void ivas_orient_trk_Init( pOTR->trackingType = OTR_TRACKING_NONE; return IVAS_ERR_OK; -#else - pOTR->absYaw = 0.0f; - pOTR->absPitch = 0.0f; - pOTR->absRoll = 0.0f; - - pOTR->absAvgYaw = 0.0f; - pOTR->absAvgPitch = 0.0f; - pOTR->absAvgRoll = 0.0f; - - /* Use frontal and horiontal orientation as reference orientation, - unless/until overridden by ivas_orient_trk_SetAbsoluteOrientation() */ - pOTR->refYaw = 0.0f; - pOTR->refPitch = 0.0f; - pOTR->refRoll = 0.0f; - - pOTR->trkYaw = 0.0f; - pOTR->trkPitch = 0.0f; - pOTR->trkRoll = 0.0f; - - return; -#endif } @@ -493,7 +422,6 @@ void ivas_orient_trk_Init( * *-------------------------------------------------------------------*/ -#ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_SetTrackingType( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ const OTR_TRACKING_T trackingType /* i/o: orientation tracking type */ @@ -507,16 +435,7 @@ ivas_error ivas_orient_trk_SetTrackingType( return IVAS_ERR_OK; } -#else -void ivas_orient_trk_SetTrackingType( - ivas_orient_trk_state_t *pOTR, /* i/o : orientation tracker handle */ - const OTR_TRACKING_T trackingType ) /* i/o : orientation tracking type */ -{ - pOTR->trackingType = trackingType; -} -#endif -#ifdef FIX_I109_ORIENTATION_TRACKING /*-------------------------------------------------------------------* * ivas_orient_trk_SetReferenceRotation() * @@ -664,27 +583,6 @@ ivas_error ivas_orient_trk_SetReferenceVector( return IVAS_ERR_OK; } #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#else -/*-------------------------------------------------------------------* - * ivas_orient_trk_SetAbsoluteOrientation() - * - * - *-------------------------------------------------------------------*/ - -void ivas_orient_trk_SetAbsoluteOrientation( - ivas_orient_trk_state_t *pOTR, - const float yaw, - const float pitch, - const float roll ) -{ - /* TODO implement condition checks */ - pOTR->absYaw = yaw; - pOTR->absPitch = pitch; - pOTR->absRoll = roll; - - return; -} -#endif /*-------------------------------------------------------------------* @@ -693,7 +591,6 @@ void ivas_orient_trk_SetAbsoluteOrientation( * *-------------------------------------------------------------------*/ -#ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_Process( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ IVAS_QUATERNION absRot, /* i : absolute head rotation */ @@ -785,138 +682,3 @@ ivas_error ivas_orient_trk_Process( return result; } -#else -ivas_error ivas_orient_trk_Process( - ivas_orient_trk_state_t *pOTR ) -{ - float yaw; - float pitch; - float roll; - - if ( pOTR->trackingType == OTR_TRACKING_AVG_ORIENT ) - { - float normalizedOrientation; - float relativeOrientationRate; - float rateRange; - float cutoffFrequency; - float alpha = pOTR->alpha; - - /* Copy absolute orientation as input to compute further on */ - yaw = pOTR->absYaw; - pitch = pOTR->absPitch; - roll = pOTR->absRoll; - - /* Compute average (low-pass filtered) absolute orientation */ - pOTR->absAvgYaw = ( 1.0f - alpha ) * pOTR->absAvgYaw + alpha * yaw; - pOTR->absAvgPitch = ( 1.0f - alpha ) * pOTR->absAvgPitch + alpha * pitch; - pOTR->absAvgRoll = ( 1.0f - alpha ) * pOTR->absAvgRoll + alpha * roll; - - /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */ - yaw -= pOTR->absAvgYaw; - pitch -= pOTR->absAvgPitch; - roll -= pOTR->absAvgRoll; - - /* Clip tracked relative orientation to avoid wrap around */ - yaw = ClipAngle( yaw, -MAX_TRACKED_ANGLE_AVG_ORIENT, MAX_TRACKED_ANGLE_AVG_ORIENT ); - pitch = ClipAngle( pitch, -MAX_TRACKED_ANGLE_AVG_ORIENT, MAX_TRACKED_ANGLE_AVG_ORIENT ); - roll = ClipAngle( roll, -MAX_TRACKED_ANGLE_AVG_ORIENT, MAX_TRACKED_ANGLE_AVG_ORIENT ); - - /* Store relative orientation result as output */ - pOTR->trkYaw = yaw; - pOTR->trkPitch = pitch; - pOTR->trkRoll = roll; - - /* Reconstruct the mean absolute orientation, compensating for non-linear computation of relative orientation: - take absolute orientation and subtract the *clipped* mean relative orientation */ - pOTR->absAvgYaw = pOTR->absYaw - yaw; - pOTR->absAvgPitch = pOTR->absPitch - pitch; - pOTR->absAvgRoll = pOTR->absRoll - roll; - - /* Adapt LPF constant based on orientation excursion relative to current mean: - - low cutoff (slow adaptation) for small excursions (around center) - - high cutoff (fast adaptation) for large excursions (off-center) - */ - - normalizedOrientation = yaw * yaw; - normalizedOrientation += pitch * pitch; - normalizedOrientation += roll * roll; - - relativeOrientationRate = sqrtf( normalizedOrientation ) / pOTR->adaptationAngle; - /* 'if' assumed to perform comparison to 0 */ - if ( relativeOrientationRate > 1.0f ) - { - relativeOrientationRate = 1.0f; - } - - /* Compute range of the adaptation rate between center = lower rate and off-center = higher rate */ - rateRange = pOTR->offCenterAdaptationRate - pOTR->centerAdaptationRate; - /* 'if' assumed to perform comparison to 0 */ - if ( rateRange < 0.0f ) - { - rateRange = 0.0f; - } - - /* Compute adaptivity cutoff frequency: interpolate between minimum (center) and maximum (off-center) values */ - cutoffFrequency = pOTR->centerAdaptationRate + ( relativeOrientationRate * rateRange ); - - /* Compute filter coefficient corresponding to desired cutoff frequency */ - pOTR->alpha = sinf( 2.0f * EVS_PI * cutoffFrequency / OTR_UPDATE_RATE ); - } - else - { - /* 'if' assumed to perform comparison to 0 */ - if ( pOTR->trackingType == OTR_TRACKING_REF_ORIENT ) - { - /* Reset average orientation */ - pOTR->absAvgYaw = pOTR->absYaw; - pOTR->absAvgPitch = pOTR->absPitch; - pOTR->absAvgRoll = pOTR->absRoll; - - /* Reset adaptation filter - start adaptation at center rate */ - pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / OTR_UPDATE_RATE ); - - /* Copy absolute orientation as input to compute further on */ - yaw = pOTR->absYaw; - pitch = pOTR->absPitch; - roll = pOTR->absRoll; - - /* Compute relative orientation = (absolute orientation) - (reference orientation) */ - yaw -= pOTR->refYaw; - pitch -= pOTR->refPitch; - roll -= pOTR->refRoll; - - /* Clip computed relative orientation to avoid wrap around and store as output */ - pOTR->trkYaw = ClipAngle( yaw, -MAX_TRACKED_ANGLE_REF_ORIENT, MAX_TRACKED_ANGLE_REF_ORIENT ); - pOTR->trkPitch = ClipAngle( pitch, -MAX_TRACKED_ANGLE_REF_ORIENT, MAX_TRACKED_ANGLE_REF_ORIENT ); - pOTR->trkRoll = ClipAngle( roll, -MAX_TRACKED_ANGLE_REF_ORIENT, MAX_TRACKED_ANGLE_REF_ORIENT ); - } - - else - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Non-supported orientation tracking adaptation type" ); - } - } - - return IVAS_ERR_OK; -} - - -/*-------------------------------------------------------------------* - * ivas_orient_trk_GetTrackedOrientation() - * - * - *-------------------------------------------------------------------*/ - -void ivas_orient_trk_GetTrackedOrientation( - ivas_orient_trk_state_t *pOTR, - float *yaw, - float *pitch, - float *roll ) -{ - *yaw = pOTR->trkYaw; - *pitch = pOTR->trkPitch; - *roll = pOTR->trkRoll; - - return; -} -#endif diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 4c79280a86..d16f231564 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -493,9 +493,6 @@ ivas_error ivas_rend_openCrend( const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg, -#ifndef FIX_I109_ORIENTATION_TRACKING - int16_t Opt_Headrotation, -#endif HRTFS_CREND_HANDLE hSetOfHRTF, const int32_t output_Fs ); @@ -771,7 +768,6 @@ ivas_error ivas_headTrack_open( HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* o : head track handle */ ); -#ifdef FIX_I109_ORIENTATION_TRACKING void ivas_headTrack_close( HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* i/o: head track handle */ ); @@ -785,14 +781,6 @@ void Euler2Quat( float deg2rad( float degrees ); -#else -void Quat2Euler( - const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ - float *yaw, /* o : yaw (z) */ - float *pitch, /* o : pitch (y) */ - float *roll /* o : roll (x) */ -); -#endif void QuatToRotMat( @@ -872,24 +860,15 @@ ivas_error ivas_render_config_init_from_rom( * Orientation tracking *----------------------------------------------------------------------------------*/ -#ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_Init( -#else -void ivas_orient_trk_Init( -#endif ivas_orient_trk_state_t *pOTR /* i/o: orientation tracker handle */ ); -#ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_SetTrackingType( -#else -void ivas_orient_trk_SetTrackingType( -#endif ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ const OTR_TRACKING_T trackingType /* i : orientation tracking type */ ); -#ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_SetReferenceRotation( ivas_orient_trk_state_t *pOTR, /* i/o: orientatoin trakcer handle */ const IVAS_QUATERNION refRot /* i : reference rotation */ @@ -912,9 +891,7 @@ ivas_error ivas_orient_trk_GetTrackedRotation( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ IVAS_QUATERNION *pRotation /* i/o: processed rotation */ ); -#endif -#ifdef FIX_I109_ORIENTATION_TRACKING ivas_error ivas_orient_trk_Process( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ IVAS_QUATERNION absRot, /* i : absolute head rotation */ @@ -922,25 +899,6 @@ ivas_error ivas_orient_trk_Process( IVAS_QUATERNION *pTrkRot /* o : tracked rotation */ ); -#else -void ivas_orient_trk_SetAbsoluteOrientation( - ivas_orient_trk_state_t *pOTR, - const float yaw, - const float pitch, - const float roll -); - -ivas_error ivas_orient_trk_Process( - ivas_orient_trk_state_t *pOTR -); - -void ivas_orient_trk_GetTrackedOrientation( - ivas_orient_trk_state_t *pOTR, - float *yaw, - float *pitch, - float *roll -); -#endif /* clang-format on */ #endif /* IVAS_PROT_REND_H */ diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 2a45c6d61a..0386a49c7d 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -68,7 +68,6 @@ ivas_error ivas_headTrack_open( ( *hHeadTrackData )->lrSwitchInterpVal = 0.0f; ( *hHeadTrackData )->lrSwitchedCurrent = 0; ( *hHeadTrackData )->lrSwitchedNext = 0; -#ifdef FIX_I109_ORIENTATION_TRACKING if ( ( ( *hHeadTrackData )->OrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); @@ -78,7 +77,6 @@ ivas_error ivas_headTrack_open( { return error; } -#endif /* Initialise Rmat_prev to I, Rmat will be computed later */ for ( i = 0; i < 3; i++ ) @@ -91,7 +89,6 @@ ivas_error ivas_headTrack_open( } -#ifdef FIX_I109_ORIENTATION_TRACKING /*-----------------------------------------------------------------------* * ivas_headTrack_close() * @@ -118,7 +115,6 @@ void ivas_headTrack_close( return; } -#endif /*---------------------------------------------------------------------------------- @@ -132,7 +128,6 @@ void QuatToRotMat( float Rmat[3][3] /* o : real-space rotation matrix for this rotation */ ) { -#ifdef FIX_I109_ORIENTATION_TRACKING Rmat[0][0] = quat.w * quat.w + quat.x * quat.x - quat.y * quat.y - quat.z * quat.z; Rmat[0][1] = 2.0f * ( quat.x * quat.y - quat.w * quat.z ); Rmat[0][2] = 2.0f * ( quat.x * quat.z + quat.w * quat.y ); @@ -144,109 +139,11 @@ void QuatToRotMat( Rmat[2][0] = 2.0f * ( quat.x * quat.z - quat.w * quat.y ); Rmat[2][1] = 2.0f * ( quat.y * quat.z + quat.w * quat.x ); Rmat[2][2] = quat.w * quat.w - quat.x * quat.x - quat.y * quat.y + quat.z * quat.z; -#else - float s1, s2, s3, c1, c2, c3; - -#ifdef DEBUGGING - /* PrintQuat( quat ); */ -#endif - - /* For debugging purposes we can also calculate the rotation matrix from - * Euler angles instead of quaternions. In this case, all the w values must - * be set to -3.0 in the trajectory file to signal switching to Euler angles. - * The x,y, and z components of the quaternion are then interpreted as -#ifdef FIX_I109_ORIENTATION_TRACKING - * yaw-pitch-roll. -#else // see below: "Euler angles in R_X(roll)*R_Y(pitch)*R_Z(yaw) convention" - * roll-pitch-yaw. -#endif - */ - if ( quat.w != -3.0 ) - { - Rmat[0][0] = quat.w * quat.w + quat.x * quat.x - quat.y * quat.y - quat.z * quat.z; - Rmat[0][1] = 2.0f * ( quat.x * quat.y - quat.w * quat.z ); - Rmat[0][2] = 2.0f * ( quat.x * quat.z + quat.w * quat.y ); - - Rmat[1][0] = 2.0f * ( quat.x * quat.y + quat.w * quat.z ); - Rmat[1][1] = quat.w * quat.w - quat.x * quat.x + quat.y * quat.y - quat.z * quat.z; - Rmat[1][2] = 2.0f * ( quat.y * quat.z - quat.w * quat.x ); - - Rmat[2][0] = 2.0f * ( quat.x * quat.z - quat.w * quat.y ); - Rmat[2][1] = 2.0f * ( quat.y * quat.z + quat.w * quat.x ); - Rmat[2][2] = quat.w * quat.w - quat.x * quat.x - quat.y * quat.y + quat.z * quat.z; - } - else - { - /* Euler angles in R_X(roll)*R_Y(pitch)*R_Z(yaw) convention - * - * yaw: rotate scene counter-clockwise in the horizontal plane - * pitch: rotate scene in the median plane, increase elevation with positive values - * roll: rotate scene from the right ear to the top - */ - - c1 = cosf( quat.z / _180_OVER_PI ); - c2 = cosf( quat.y / _180_OVER_PI ); - c3 = cosf( quat.x / _180_OVER_PI ); - - s1 = sinf( quat.z / _180_OVER_PI ); - s2 = sinf( -quat.y / _180_OVER_PI ); - s3 = sinf( quat.x / _180_OVER_PI ); - - Rmat[0][0] = c2 * c3; - Rmat[0][1] = -c2 * s3; - Rmat[0][2] = s2; - - Rmat[1][0] = c1 * s3 + c3 * s1 * s2; - Rmat[1][1] = c1 * c3 - s1 * s2 * s3; - Rmat[1][2] = -c2 * s1; - - Rmat[2][0] = s1 * s3 - c1 * c3 * s2; - Rmat[2][1] = c3 * s1 + c1 * s2 * s3; - Rmat[2][2] = c1 * c2; - } -#endif return; } -#ifndef FIX_I109_ORIENTATION_TRACKING -/*------------------------------------------------------------------------- - * Quat2Euler() - * - * Quaternion handling: calculate corresponding Euler angles in radians - *------------------------------------------------------------------------*/ -void Quat2Euler( - const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ - float *yaw, /* o : yaw (z) */ - float *pitch, /* o : pitch (y) */ - float *roll /* o : roll (x) */ -) -{ - if ( quat.w != -3.0 ) - { - *yaw = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); - *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) ); - *roll = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) ); - } - else - { - /* Euler angles in R_X(roll)*R_Y(pitch)*R_Z(yaw) convention - * - * yaw: rotate scene counter-clockwise in the horizontal plane - * pitch: rotate scene in the median plane, increase elevation with positive values - * roll: rotate scene from the right ear to the top - */ - *yaw = quat.z; - *pitch = quat.y; - *roll = quat.x; - } - - return; -} -#endif - -#ifdef FIX_I109_ORIENTATION_TRACKING /*------------------------------------------------------------------------- * Euler2Quat() * @@ -294,7 +191,6 @@ float deg2rad( return PI_OVER_180 * degrees; } -#endif /*------------------------------------------------------------------------- * rotateAziEle() diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 13c6084b2d..c0f12ef209 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -225,7 +225,6 @@ typedef struct EFAP * Orientation tracking structure *----------------------------------------------------------------------------------*/ -#ifdef FIX_I109_ORIENTATION_TRACKING typedef struct ivas_orient_trk_state_t { OTR_TRACKING_T trackingType; @@ -239,34 +238,6 @@ typedef struct ivas_orient_trk_state_t IVAS_QUATERNION trkRot; /* tracked rotation */ } ivas_orient_trk_state_t; -#else -typedef struct ivas_orient_trk_state_t -{ - OTR_TRACKING_T trackingType; - float centerAdaptationRate; - float offCenterAdaptationRate; - float adaptationAngle; - - float alpha; - - float absYaw; /* absolute orientation */ - float absPitch; - float absRoll; - - float absAvgYaw; /* average absolute orientation */ - float absAvgPitch; - float absAvgRoll; - - float refYaw; /* reference orientation */ - float refPitch; - float refRoll; - - float trkYaw; /* tracked orientation */ - float trkPitch; - float trkRoll; - -} ivas_orient_trk_state_t; -#endif /*----------------------------------------------------------------------------------* * Head rotation data structure @@ -280,9 +251,7 @@ typedef struct IVAS_POSITION Pos[RENDERER_HEAD_POSITIONS_PER_FRAME]; #endif float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; -#ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_state_t *hOrientationTracker; -#endif } IVAS_REND_HeadRotData; @@ -301,9 +270,7 @@ typedef struct ivas_binaural_head_track_struct float lrSwitchInterpVal; int16_t shd_rot_max_order; -#ifdef FIX_I109_ORIENTATION_TRACKING ivas_orient_trk_state_t *OrientationTracker; -#endif } HEAD_TRACK_DATA, *HEAD_TRACK_DATA_HANDLE; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 1dc1c1f956..dc3911125f 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -901,11 +901,7 @@ static ivas_error getEfapGains( return IVAS_ERR_OK; } -#ifdef FIX_I109_ORIENTATION_TRACKING static ivas_error initHeadRotation( -#else -static void initHeadRotation( -#endif IVAS_REND_HANDLE hIvasRend ) { int16_t i, crossfade_len; @@ -929,7 +925,6 @@ static void initHeadRotation( hIvasRend->headRotData.headPositions[i] = quaternionInit(); } -#ifdef FIX_I109_ORIENTATION_TRACKING if ( ( hIvasRend->headRotData.hOrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); @@ -941,12 +936,8 @@ static void initHeadRotation( } return IVAS_ERR_OK; -#else - return; -#endif } -#ifdef FIX_I109_ORIENTATION_TRACKING static void closeHeadRotation( IVAS_REND_HANDLE hIvasRend ) { @@ -957,7 +948,6 @@ static void closeHeadRotation( return; } -#endif static void initRotMatrix( rotation_matrix rot_mat ) @@ -1144,9 +1134,6 @@ static ivas_error setRendInputActiveIsm( else { if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, -#ifndef FIX_I109_ORIENTATION_TRACKING - 0, -#endif NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -1859,9 +1846,6 @@ static ivas_error initMcBinauralRendering( { if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) ? AUDIO_CONFIG_7_1_4 : getIvasAudioConfigFromRendAudioConfig( inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, -#ifndef FIX_I109_ORIENTATION_TRACKING - 0, -#endif NULL, outSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -2130,9 +2114,6 @@ static ivas_error updateSbaPanGains( getIvasAudioConfigFromRendAudioConfig( inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, -#ifndef FIX_I109_ORIENTATION_TRACKING - 0, -#endif NULL, *rendCtx.pOutSampleRate ); break; @@ -2146,9 +2127,6 @@ static ivas_error updateSbaPanGains( AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, -#ifndef FIX_I109_ORIENTATION_TRACKING - 0, -#endif NULL, *rendCtx.pOutSampleRate ); break; @@ -2508,10 +2486,8 @@ static DecoderDummy *initDecoderDummy( decDummy->hHeadTrackData->lrSwitchInterpVal = 0.0f; decDummy->hHeadTrackData->lrSwitchedCurrent = 0; decDummy->hHeadTrackData->lrSwitchedNext = 0; -#ifdef FIX_I109_ORIENTATION_TRACKING decDummy->hHeadTrackData->OrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ); ivas_orient_trk_Init( decDummy->hHeadTrackData->OrientationTracker ); -#endif } else { @@ -2592,12 +2568,10 @@ static void freeDecoderDummy( if ( pDecDummy->hHeadTrackData != NULL ) { -#ifdef FIX_I109_ORIENTATION_TRACKING if ( pDecDummy->hHeadTrackData->OrientationTracker != NULL ) { free( pDecDummy->hHeadTrackData->OrientationTracker ); } -#endif free( pDecDummy->hHeadTrackData ); } ivas_render_config_close( &pDecDummy->hRenderConfig ); @@ -2712,14 +2686,10 @@ ivas_error IVAS_REND_Open( } /* Initialize headrotation data */ -#ifdef FIX_I109_ORIENTATION_TRACKING if ( ( error = initHeadRotation( hIvasRend ) ) != IVAS_ERR_OK ) { return error; } -#else - initHeadRotation( hIvasRend ); -#endif /* Initialize EFAP */ if ( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK ) @@ -3840,9 +3810,7 @@ ivas_error IVAS_REND_SetHeadRotation( ) { int16_t i; -#ifdef FIX_I109_ORIENTATION_TRACKING IVAS_QUATERNION rotQuat; -#endif /* Validate function arguments */ if ( hIvasRend == NULL ) @@ -3865,7 +3833,6 @@ ivas_error IVAS_REND_SetHeadRotation( hIvasRend->headRotData.headRotEnabled = 1; for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) { -#ifdef FIX_I109_ORIENTATION_TRACKING /* check for Euler angle signaling */ if ( headRot[i].w == -3.0f ) { @@ -3877,9 +3844,6 @@ ivas_error IVAS_REND_SetHeadRotation( } ivas_orient_trk_Process( hIvasRend->headRotData.hOrientationTracker, rotQuat, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hIvasRend->headRotData.headPositions[i] ); -#else - hIvasRend->headRotData.headPositions[i] = headRot[i]; -#endif #ifdef TD5 hIvasRend->headRotData.Pos[i] = Pos[i]; #endif @@ -3890,7 +3854,6 @@ ivas_error IVAS_REND_SetHeadRotation( } -#ifdef FIX_I109_ORIENTATION_TRACKING /*-------------------------------------------------------------------* * IVAS_REND_SetOrientationTrackingMode() * @@ -4045,7 +4008,6 @@ ivas_error IVAS_REND_SetReferenceVector( return ivas_orient_trk_SetReferenceVector( hIvasRend->headRotData.hOrientationTracker, listenerPos, refPos ); } #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#endif /*-------------------------------------------------------------------* @@ -5659,9 +5621,7 @@ void IVAS_REND_Close( ivas_limiter_close( &hIvasRend->hLimiter ); -#ifdef FIX_I109_ORIENTATION_TRACKING closeHeadRotation( hIvasRend ); -#endif free( hIvasRend ); *phIvasRend = NULL; diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index b313bea5c1..3bd575adc2 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -252,7 +252,6 @@ ivas_error IVAS_REND_SetHeadRotation( #endif ); -#ifdef FIX_I109_ORIENTATION_TRACKING ivas_error IVAS_REND_SetOrientationTrackingMode( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const uint8_t otrMode /* i : Orientation tracking mode */ @@ -280,7 +279,6 @@ ivas_error IVAS_REND_SetReferenceVector( const IVAS_VECTOR3 refPos /* i : Reference position */ ); #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#endif /* FIX_I109_ORIENTATION_TRACKING */ ivas_error IVAS_REND_GetSamples( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ diff --git a/lib_util/audio_file_writer.c b/lib_util/audio_file_writer.c index b27a8ceca6..81084dbd95 100644 --- a/lib_util/audio_file_writer.c +++ b/lib_util/audio_file_writer.c @@ -98,11 +98,7 @@ ivas_error AudioFileWriter_open( int8_t retCode; -#ifdef FIX_I109_ORIENTATION_TRACKING if ( ( fileNameLen > wavSuffixLen ) && ( strncmp( fileName + fileNameLen - wavSuffixLen, wavSuffix, wavSuffixLen ) == 0 ) ) -#else - if ( fileNameLen > wavSuffixLen && strncmp( fileName + fileNameLen - wavSuffixLen, wavSuffix, wavSuffixLen ) == 0 ) -#endif { retCode = AudioFileWriter_open_wav( self, fileName, sampleRate, numChannels ); } diff --git a/lib_util/head_rotation_file_reader.c b/lib_util/head_rotation_file_reader.c index 500fdd2b7a..b8f81d318d 100644 --- a/lib_util/head_rotation_file_reader.c +++ b/lib_util/head_rotation_file_reader.c @@ -91,7 +91,6 @@ ivas_error HeadRotationFileReader_open( * Read values from the trajectory file *-----------------------------------------------------------------------*/ -#ifdef FIX_I109_ORIENTATION_TRACKING ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ #ifdef TD5 @@ -150,66 +149,6 @@ ivas_error HeadRotationFileReading( return IVAS_ERR_OK; } -#else -ivas_error HeadRotationFileReading( - HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ - IVAS_QUATERNION *Quaternions, /* o : head-tracking data, listener orientation */ -#ifdef TD5 - IVAS_POSITION *Pos /* o : listener position */ -#else - const int32_t frame_dec /* i : decoded frame number */ -#endif -) -{ - uint16_t i; - float w, x, y, z; -#ifdef TD5 - float posx, posy, posz; - int32_t read_values; - - posx = 0.0f; - posy = 0.0f; - posz = 0.0f; -#endif - - for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { -#ifdef TD5 - read_values = fscanf( headRotReader->trajFile, "%f,%f,%f,%f,%f,%f,%f", &w, &x, &y, &z, &posx, &posy, &posz ); - if ( ( read_values != 4 ) && ( read_values != 7 ) ) /* Allow either orientation (4) or orientation+position (4+3) */ -#else - if ( 4 != fscanf( headRotReader->trajFile, "%f,%f,%f,%f", &w, &x, &y, &z ) ) -#endif - { - if ( feof( headRotReader->trajFile ) ) - { - rewind( headRotReader->trajFile ); - headRotReader->fileRewind = true; -#ifdef TD5 - return HeadRotationFileReading( headRotReader, Quaternions, Pos ); -#else - return HeadRotationFileReading( headRotReader, Quaternions, frame_dec ); -#endif - } - return IVAS_ERR_FAILED_FILE_PARSE; - } - - ( headRotReader->frameCounter )++; - - Quaternions[i].w = w; - Quaternions[i].x = x; - Quaternions[i].y = y; - Quaternions[i].z = z; -#ifdef TD5 - Pos[i].x = posx; - Pos[i].y = posy; - Pos[i].z = posz; -#endif - } - - return IVAS_ERR_OK; -} -#endif /*-----------------------------------------------------------------------* diff --git a/lib_util/head_rotation_file_reader.h b/lib_util/head_rotation_file_reader.h index d735423e2c..a4b87c6750 100644 --- a/lib_util/head_rotation_file_reader.h +++ b/lib_util/head_rotation_file_reader.h @@ -57,7 +57,6 @@ ivas_error HeadRotationFileReader_open( * Read values from the trajectory file *-----------------------------------------------------------------------*/ -#ifdef FIX_I109_ORIENTATION_TRACKING ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ #ifdef TD5 @@ -67,17 +66,6 @@ ivas_error HeadRotationFileReading( IVAS_QUATERNION *pQuaternion /* o : head-tracking data */ #endif ); -#else -ivas_error HeadRotationFileReading( - HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ - IVAS_QUATERNION *Quaternions, /* o : head-tracking data */ -#ifdef TD5 - IVAS_POSITION *Pos /* o : listener position */ -#else - const int32_t frame_dec /* i : decoded frame number */ -#endif -); -#endif /*-----------------------------------------------------------------------* * HeadRotationFileReader_close() -- GitLab From 94bbfb7ddd3af03d1b543570e18207f6a04d9d3e Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 29 Mar 2023 21:32:03 +0200 Subject: [PATCH 326/375] [cleanup] accept BINAURALIZATION_DELAY_REPORT --- apps/decoder.c | 50 -------------------------------------------- lib_com/delay_comp.c | 8 ------- lib_com/options.h | 1 - lib_com/prot.h | 4 ---- lib_dec/lib_dec.c | 4 ---- lib_enc/lib_enc.c | 4 ---- 6 files changed, 71 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index fe6456defe..02da1fb01f 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1263,11 +1263,7 @@ static ivas_error initOnFirstGoodFrame( if ( !arg.delayCompensationEnabled ) { -#ifdef BINAURALIZATION_DELAY_REPORT pFullDelayNumSamples[0] = 0; -#else - *pFullDelayNumSamples = 0; -#endif } #else if ( arg.delayCompensationEnabled ) @@ -1280,18 +1276,10 @@ static ivas_error initOnFirstGoodFrame( } else { -#ifdef BINAURALIZATION_DELAY_REPORT pFullDelayNumSamples[0] = 0; -#else - *pFullDelayNumSamples = 0; -#endif } #endif -#ifdef BINAURALIZATION_DELAY_REPORT *pRemainingDelayNumSamples = pFullDelayNumSamples[0]; -#else - *pRemainingDelayNumSamples = *pFullDelayNumSamples; -#endif if ( ( error = IVAS_DEC_GetNumOutputChannels( hIvasDec, pNumOutChannels ) ) != IVAS_ERR_OK ) { @@ -1459,11 +1447,7 @@ static ivas_error decodeG192( int16_t numInitialBadFrames = 0; /* Number of bad frames received until first good frame is decoded */ int16_t nOutChannels = 0; int16_t delayNumSamples = -1; -#ifdef BINAURALIZATION_DELAY_REPORT int16_t delayNumSamples_orig[3]; /* stores: overall delay, dec+rend delay, and binauralization delay */ -#else - int16_t delayNumSamples_orig = 0; -#endif int16_t nOutSamples = 0; int32_t delayTimeScale = 0; ivas_error error = IVAS_ERR_UNKNOWN; @@ -1489,9 +1473,7 @@ static ivas_error decodeG192( fprintf( stdout, "\n-- Start the decoder (quiet mode) --\n\n" ); } -#ifdef BINAURALIZATION_DELAY_REPORT delayNumSamples_orig[0] = -1; -#endif #ifdef WMOPS reset_stack(); @@ -1631,11 +1613,7 @@ static ivas_error decodeG192( arg, numInitialBadFrames, nOutSamples, -#ifdef BINAURALIZATION_DELAY_REPORT delayNumSamples_orig, -#else - &delayNumSamples_orig, -#endif &delayNumSamples, &delayTimeScale, &bsFormat, @@ -1749,13 +1727,8 @@ static ivas_error decodeG192( * Add zeros at the end to have equal length of synthesized signals *------------------------------------------------------------------------------------------*/ -#ifdef BINAURALIZATION_DELAY_REPORT memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK ) -#else - memset( pcmBuf, 0, delayNumSamples_orig * nOutChannels * sizeof( int16_t ) ); - if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig * nOutChannels ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) ); goto cleanup; @@ -1767,7 +1740,6 @@ static ivas_error decodeG192( if ( !arg.quietModeEnabled ) { -#ifdef BINAURALIZATION_DELAY_REPORT printf( "\n\nDecoder+renderer delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[1] / (float) delayTimeScale, delayNumSamples_orig[1], delayTimeScale ); if ( delayNumSamples_orig[2] > 0 ) @@ -1779,9 +1751,6 @@ static ivas_error decodeG192( printf( "Total delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[0] / (float) delayTimeScale, delayNumSamples_orig[0], delayTimeScale ); #endif } -#else - fprintf( stdout, "\nDecoder delay: %-5u [samples] - Timescale: %5u\n", delayNumSamples_orig, delayTimeScale ); -#endif } /* Print output metadata file name(s) */ @@ -1970,11 +1939,7 @@ static ivas_error decodeVoIP( #endif JbmOffsetFileWriter *jbmOffsetWriter = NULL; -#ifdef BINAURALIZATION_DELAY_REPORT int16_t delayNumSamples_orig[3]; /* stores: overall delay, dec+rend delay, and binauralization delay */ -#else - int16_t delayNumSamples_orig = -1; -#endif int16_t delayNumSamples = -1; int32_t delayTimeScale = -1; @@ -1994,9 +1959,7 @@ static ivas_error decodeVoIP( ismWriters[i] = NULL; } -#ifdef BINAURALIZATION_DELAY_REPORT delayNumSamples_orig[0] = -1; -#endif rtpdumpDepacker.rtpdump = NULL; switch ( arg.inputFormat ) @@ -2193,11 +2156,7 @@ static ivas_error decodeVoIP( arg, numInitialBadFrames, nOutSamples, -#ifdef BINAURALIZATION_DELAY_REPORT delayNumSamples_orig, -#else - &delayNumSamples_orig, -#endif &delayNumSamples, &delayTimeScale, &bsFormat, @@ -2254,13 +2213,8 @@ static ivas_error decodeVoIP( * Add zeros at the end to have equal length of synthesized signals *------------------------------------------------------------------------------------------*/ -#ifdef BINAURALIZATION_DELAY_REPORT memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK ) -#else - memset( pcmBuf, 0, delayNumSamples_orig * nOutChannels * sizeof( int16_t ) ); - if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig * nOutChannels ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) ); goto cleanup; @@ -2272,7 +2226,6 @@ static ivas_error decodeVoIP( if ( !arg.quietModeEnabled ) { -#ifdef BINAURALIZATION_DELAY_REPORT printf( "\n\nDecoder+renderer delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[1] / (float) delayTimeScale, delayNumSamples_orig[1], delayTimeScale ); if ( delayNumSamples_orig[2] > 0 ) @@ -2284,9 +2237,6 @@ static ivas_error decodeVoIP( printf( "Total delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[0] / (float) delayTimeScale, delayNumSamples_orig[0], delayTimeScale ); #endif } -#else - printf( "\nDecoder delay: %5u [samples] - Timescale: %5u\n", delayNumSamples_orig, delayTimeScale ); -#endif } /*------------------------------------------------------------------------------------------* diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index 9f8c1c7b9b..b96798815e 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -55,10 +55,6 @@ int32_t get_delay( const int32_t io_fs, /* i : input/output sampling frequency */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ HANDLE_CLDFB_FILTER_BANK hCldfb /* i : Handle of Cldfb analysis */ -#ifndef BINAURALIZATION_DELAY_REPORT - , - const int32_t binaural_latency_ns /* i : binaural renderer HRTF delay in ns */ -#endif ) { int32_t delay = 0; @@ -110,10 +106,6 @@ int32_t get_delay( delay += IVAS_FB_DEC_DELAY_NS; } -#ifndef BINAURALIZATION_DELAY_REPORT - /* compensate for binauralization delay */ - delay += binaural_latency_ns; -#endif #ifdef FIX_350_MASA_DELAY_COMP if ( ivas_format == MASA_FORMAT ) diff --git a/lib_com/options.h b/lib_com/options.h index 86f892db4a..bc1db07c2b 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -143,7 +143,6 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ /*#define SBA_HPF_TUNING_DEC*/ -#define BINAURALIZATION_DELAY_REPORT /* VA: Issue 255 - Changes the way the decoder delay is reported */ #define TUNE_360_OBJECT_WITH_NOISE /* VA: issue 360: consider objects being speech+noise for active speech coding */ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ #define FIX_372_LIB_REND_VALIDATE_IO /* FhG: Issue 372: IVAS_rend segfaults with unsupported I/O configs - add validation checks of I/O config */ diff --git a/lib_com/prot.h b/lib_com/prot.h index c8f69fe832..e89037076e 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -681,10 +681,6 @@ int32_t get_delay( const int32_t io_fs, /* i : input/output sampling frequency */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ HANDLE_CLDFB_FILTER_BANK hCldfb /* i : Handle of Cldfb analysis */ -#ifndef BINAURALIZATION_DELAY_REPORT - , - const int32_t binaural_latency_ns /* i : binauralization delay in ns */ -#endif ); void decision_matrix_enc( diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index bcbf60a9d3..2939b352c6 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1256,13 +1256,9 @@ ivas_error IVAS_DEC_GetDelay( st_ivas = hIvasDec->st_ivas; hDecoderConfig = st_ivas->hDecoderConfig; -#ifdef BINAURALIZATION_DELAY_REPORT nSamples[1] = NS2SA( hDecoderConfig->output_Fs, get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0] ) ); nSamples[2] = (int16_t) roundf( (float) st_ivas->binaural_latency_ns * hDecoderConfig->output_Fs / 1000000000.f ); nSamples[0] = nSamples[1] + nSamples[2]; -#else - *nSamples = (int16_t) roundf( (float) get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], st_ivas->binaural_latency_ns ) * hDecoderConfig->output_Fs / 1000000000.f ); -#endif *timeScale = hDecoderConfig->output_Fs; diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 50052cda3c..6f5af7c231 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -978,11 +978,7 @@ ivas_error IVAS_ENC_GetDelay( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef BINAURALIZATION_DELAY_REPORT *delay = NS2SA( hEncoderConfig->input_Fs, get_delay( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL ) ); -#else - *delay = NS2SA( hEncoderConfig->input_Fs, get_delay( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL, 0 ) ); -#endif *delay *= hEncoderConfig->nchan_inp; -- GitLab From 5f300f7af316e2ee1c31371e91fd612502517ae4 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 29 Mar 2023 21:33:08 +0200 Subject: [PATCH 327/375] [cleanup] accept TUNE_360_OBJECT_WITH_NOISE --- lib_com/options.h | 1 - lib_enc/ivas_ism_metadata_enc.c | 63 --------------------------------- 2 files changed, 64 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index bc1db07c2b..caa19025cc 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -143,7 +143,6 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ /*#define SBA_HPF_TUNING_DEC*/ -#define TUNE_360_OBJECT_WITH_NOISE /* VA: issue 360: consider objects being speech+noise for active speech coding */ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ #define FIX_372_LIB_REND_VALIDATE_IO /* FhG: Issue 372: IVAS_rend segfaults with unsupported I/O configs - add validation checks of I/O config */ #define FIX_376_SBA_ROTATE /*DLB: Fix for issue 376*/ diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 1540e35ce4..640ee49fbf 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -196,11 +196,7 @@ ivas_error ivas_ism_metadata_enc( ) { #ifdef TD5 -#ifdef TUNE_360_OBJECT_WITH_NOISE int16_t i, ch, nb_bits_start = 0; -#else - int16_t i, ch, nb_bits_start = 0, diff; -#endif int16_t idx_azimuth_abs = 0, flag_abs_azimuth[MAX_NUM_OBJECTS]; int16_t idx_elevation_abs = 0, flag_abs_elevation[MAX_NUM_OBJECTS]; int16_t flag_abs_azimuth_orientation[MAX_NUM_OBJECTS]; @@ -274,7 +270,6 @@ ivas_error ivas_ism_metadata_enc( else if ( ism_mode == ISM_MODE_DISC ) { #ifdef TD5 -#ifdef TUNE_360_OBJECT_WITH_NOISE #ifdef DISCRETE_ISM_DTX_CNG hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10; #else @@ -285,44 +280,7 @@ ivas_error ivas_ism_metadata_enc( } #endif #else - if ( hIsmMeta[ch]->ism_metadata_flag ) - { - /* at highest bitrates (with TCX core only) metadata are sent also for inactive frames */ - if ( localVAD[ch] == 0 && !( hSCE[ch]->hCoreCoder[0]->tcxonly ) ) - { - /* send metadata even in inactive segments when noise is audible and metadata are changing */ - diff = (int16_t) fabsf( hIsmMeta[ch]->azimuth - ism_dequant_meta( hIsmMeta[ch]->angle[0].last_azimuth_idx, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ) ); - diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->elevation - ism_dequant_meta( hIsmMeta[ch]->angle[0].last_elevation_idx, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ) ) ); - if ( ism_total_brate >= ISM_EXTENDED_METADATA_BRATE && ism_extended_metadata_flag ) - { - diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->yaw - ism_dequant_meta( hIsmMeta[ch]->angle[1].last_azimuth_idx, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ) ) ); - diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->pitch - ism_dequant_meta( hIsmMeta[ch]->angle[1].last_elevation_idx, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ) ) ); - } - if ( !( hSCE[ch]->hCoreCoder[0]->lp_noise > 15 && diff >= 10 ) ) - { - hIsmMeta[ch]->ism_metadata_flag = 0; - } - } - } -#endif -#else -#ifdef TUNE_360_OBJECT_WITH_NOISE hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10; -#else - hIsmMeta[ch]->ism_metadata_flag = localVAD[ch]; - - if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) - { - /* send metadata even in inactive segments when noise is audible and metadata are changing */ - diff = (int16_t) fabsf( hIsmMeta[ch]->azimuth - ism_dequant_meta( hIsmMeta[ch]->last_azimuth_idx, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ) ); - diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->elevation - ism_dequant_meta( hIsmMeta[ch]->last_elevation_idx, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ) ) ); - - if ( hSCE[ch]->hCoreCoder[0]->lp_noise > 15 && diff >= 10 ) - { - hIsmMeta[ch]->ism_metadata_flag = 1; - } - } -#endif if ( hSCE[ch]->hCoreCoder[0]->tcxonly ) { @@ -339,27 +297,6 @@ ivas_error ivas_ism_metadata_enc( rate_ism_importance( nchan_transport, hIsmMeta, hSCE, ism_imp ); -#ifndef TUNE_360_OBJECT_WITH_NOISE - /* relax the importance decision in "stereo" coding for noisy audio */ - if ( ism_mode == ISM_MODE_DISC && nchan_ism == 2 ) - { - float diff_F; - - if ( hIsmMeta[0]->ism_metadata_flag ^ hIsmMeta[1]->ism_metadata_flag ) - { - for ( ch = 0; ch < nchan_ism; ch++ ) - { - diff_F = hSCE[ch]->hCoreCoder[0]->lp_speech - hSCE[ch]->hCoreCoder[0]->lp_noise; - - if ( hIsmMeta[ch]->ism_metadata_flag == 0 && diff_F < 25.0f ) - { - hIsmMeta[ch]->ism_metadata_flag = 1; - ism_imp[ch] = ISM_LOW_IMP; - } - } - } - } -#endif /*----------------------------------------------------------------* * Write ISM common signaling -- GitLab From dcdae3bbaa93c152e7f05ae1ff84cbc6f5fb24d4 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 29 Mar 2023 21:35:58 +0200 Subject: [PATCH 328/375] [cleanup] accept FIX_372_LIB_REND_VALIDATE_IO --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index caa19025cc..646e28712f 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -144,7 +144,6 @@ /*#define SBA_HPF_TUNING_DEC*/ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ -#define FIX_372_LIB_REND_VALIDATE_IO /* FhG: Issue 372: IVAS_rend segfaults with unsupported I/O configs - add validation checks of I/O config */ #define FIX_376_SBA_ROTATE /*DLB: Fix for issue 376*/ #define TD5 /* Eri: Contribution 17: Extended metadata for 6 DoF rendering in TD renderer */ #define TD5_FIX_INVALID_MEMORY_ACCESS /* FhG: Resolves segfault in case IVAS_REND_InitConfig gets initialized with rendererConfigEnabled:=false && ISM are being rendered */ -- GitLab From 2f1c8b423206927973fe5a12fae4930581488edf Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 29 Mar 2023 21:36:32 +0200 Subject: [PATCH 329/375] [cleanup] accept FIX_376_SBA_ROTATE --- lib_com/options.h | 1 - lib_rend/lib_rend.c | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 646e28712f..fd3ec5b506 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -144,7 +144,6 @@ /*#define SBA_HPF_TUNING_DEC*/ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ -#define FIX_376_SBA_ROTATE /*DLB: Fix for issue 376*/ #define TD5 /* Eri: Contribution 17: Extended metadata for 6 DoF rendering in TD renderer */ #define TD5_FIX_INVALID_MEMORY_ACCESS /* FhG: Resolves segfault in case IVAS_REND_InitConfig gets initialized with rendererConfigEnabled:=false && ISM are being rendered */ #define FIX_371_DELAY_REPORT /* Issue 371: div. by zero with -no_delay_cmp */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index dc3911125f..4e6ec67da7 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4285,7 +4285,6 @@ static ivas_error rotateFrameSba( ( 1 - headRotData->crossfade[i] ) * gains_prev[n][m] * ( *readPtr ); } } -#ifdef FIX_376_SBA_ROTATE /* write back the result */ for ( n = m1; n < m2; n++ ) { @@ -4294,18 +4293,7 @@ static ivas_error rotateFrameSba( } m1 = m2; m2 += 2 * ( l + 1 ) + 1; -#endif - } -#ifndef FIX_376_SBA_ROTATE - /* write back the result */ - for ( n = m1; n < m2; n++ ) - { - writePtr = getSmplPtr( outAudio, n, subframe_idx * subframe_len + i ); - ( *writePtr ) = tmpRot[n - m1]; } - m1 = m2; - m2 += 2 * ( l + 1 ) + 1; -#endif } /*unoptimized code for reference (full matrix multiplication)*/ -- GitLab From de26f332467a66f533d2a042a8c46ad983ab884a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 29 Mar 2023 21:37:43 +0200 Subject: [PATCH 330/375] [cleanup] accept TD5_FIX_INVALID_MEMORY_ACCESS TD5 --- apps/decoder.c | 22 -- apps/encoder.c | 15 -- apps/renderer.c | 65 ----- lib_com/common_api_types.h | 8 - lib_com/ivas_cnst.h | 8 - lib_com/ivas_ism_com.c | 4 - lib_com/ivas_prot.h | 8 - lib_com/ivas_stat_com.h | 9 - lib_com/options.h | 2 - lib_dec/ivas_ism_metadata_dec.c | 190 --------------- lib_dec/ivas_objectRenderer_internal.c | 9 - lib_dec/lib_dec.c | 14 -- lib_dec/lib_dec.h | 4 - lib_enc/ivas_ism_enc.c | 16 -- lib_enc/ivas_ism_metadata_enc.c | 316 ------------------------- lib_enc/ivas_stat_enc.h | 2 - lib_enc/lib_enc.c | 14 -- lib_enc/lib_enc.h | 4 - lib_rend/ivas_objectRenderer.c | 77 ------ lib_rend/ivas_objectRenderer_hrFilt.c | 7 - lib_rend/ivas_objectRenderer_sfx.c | 8 - lib_rend/ivas_objectRenderer_sources.c | 14 -- lib_rend/ivas_objectRenderer_vec.c | 17 -- lib_rend/ivas_prot_rend.h | 18 -- lib_rend/ivas_render_config.c | 2 - lib_rend/ivas_stat_rend.h | 6 - lib_rend/lib_rend.c | 22 -- lib_rend/lib_rend.h | 4 - lib_util/head_rotation_file_reader.c | 16 -- lib_util/head_rotation_file_reader.h | 4 - lib_util/ism_file_reader.c | 23 -- lib_util/ism_file_writer.c | 11 - lib_util/render_config_reader.c | 2 - 33 files changed, 941 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 02da1fb01f..7eb003fbe4 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -444,17 +444,9 @@ int main( IVAS_RENDER_CONFIG_DATA renderConfig; /* sanity check */ -#ifdef TD5 if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL ) -#else - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) -#endif { -#ifdef TD5 fprintf( stderr, "\nExternal Renderer Config is supported only for BINAURAL and BINAURAL_ROOM. Exiting. \n\n" ); -#else - fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output. Exiting. \n\n" ); -#endif goto cleanup; } @@ -1453,9 +1445,7 @@ static ivas_error decodeG192( ivas_error error = IVAS_ERR_UNKNOWN; uint16_t numObj = 0; IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; -#ifdef TD5 IVAS_POSITION Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; -#endif IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) @@ -1545,11 +1535,7 @@ static ivas_error decodeG192( if ( arg.enableReferenceRotation ) { IVAS_QUATERNION quaternion; -#ifdef TD5 if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK ) -#else - if ( ( error = HeadRotationFileReading( refRotReader, &quaternion ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) ); goto cleanup; @@ -1568,22 +1554,14 @@ static ivas_error decodeG192( for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { -#ifdef TD5 if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) -#else - if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i] ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( headRotReader ) ); goto cleanup; } } -#ifdef TD5 if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions, Pos ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; diff --git a/apps/encoder.c b/apps/encoder.c index ff6f461838..aae2e1e88e 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -126,9 +126,7 @@ typedef struct #endif #endif bool pca; -#ifdef TD5 bool ism_extended_metadata; -#endif } EncArguments; @@ -381,11 +379,7 @@ int main( } break; case IVAS_ENC_INPUT_ISM: -#ifdef TD5 if ( ( error = IVAS_ENC_ConfigureForObjects( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.ism.numObjects, arg.ism_extended_metadata ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_ENC_ConfigureForObjects( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.ism.numObjects ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nIVAS_ENC_ConfigureForObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; @@ -883,9 +877,7 @@ static void initArgStruct( EncArguments *arg ) arg->caConfig = IVAS_ENC_GetDefaultChannelAwareConfig(); arg->ca_config_file = NULL; arg->mimeOutput = false; -#ifdef TD5 arg->ism_extended_metadata = false; -#endif #ifdef DEBUGGING arg->forcedMode = IVAS_ENC_FORCE_UNFORCED; @@ -1273,13 +1265,11 @@ static bool parseCmdlIVAS_enc( if ( i < argc - 4 ) { -#ifdef TD5 if ( argv[i][0] == '+' ) { argv[i]++; arg->ism_extended_metadata = true; } -#endif if ( !is_digits_only( argv[i] ) ) { fprintf( stderr, "Error: Number of ISM channels must be an integer number!\n\n" ); @@ -1660,14 +1650,9 @@ static void usage_enc( void ) fprintf( stdout, "EVS mono is default, for IVAS choose one of the following: -stereo, -ism, -sba, -masa, -mc\n" ); fprintf( stdout, "-stereo [Mode] : Stereo format, default is unified stereo \n" ); fprintf( stdout, " optional for Mode: 1: DFT Stereo, 2: TD Stereo, 3: MDCT Stereo\n" ); -#ifdef TD5 fprintf( stdout, "-ism (+)Ch Files : ISM format \n" ); fprintf( stdout, " where Ch specifies the number of ISMs (1-4)\n" ); fprintf( stdout, " where positive (+) means extended metadata format is used (including orientation and radius) \n" ); -#else - fprintf( stdout, "-ism Channels Files : ISM format \n" ); - fprintf( stdout, " where Channels specifies the number of ISMs (1-4)\n" ); -#endif fprintf( stdout, " and Files specify input files containing metadata, one file per object\n" ); fprintf( stdout, " (use NULL for no input metadata)\n" ); fprintf( stdout, "-sba +/-Order : Scene Based Audio input format (Ambisonics ACN/SN3D),\n" ); diff --git a/apps/renderer.c b/apps/renderer.c index e28063ff2e..d4671ae656 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -550,9 +550,7 @@ int main( int32_t delayTimeScale = 0; int16_t i, numChannels; ivas_error error = IVAS_ERR_OK; -#ifdef TD5 IVAS_POSITION Pos[RENDERER_HEAD_POSITIONS_PER_FRAME]; -#endif #ifdef WMOPS reset_wmops(); @@ -693,11 +691,7 @@ int main( } /* === Configure === */ -#ifdef TD5 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 ) -#else - if ( ( error = IVAS_REND_InitConfig( hIvasRend, strlen( args.renderConfigFilePath ) != 0 ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "Error in Renderer Config Init\n" ); exit( -1 ); @@ -708,17 +702,9 @@ int main( IVAS_RENDER_CONFIG_DATA renderConfig; /* sanity check */ -#ifdef TD5 if ( ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) && ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL ) ) -#else - if ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) -#endif { -#ifdef TD5 fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL or BINAURAL_ROOM is used as output. Exiting. \n" ); -#else - fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output. Exiting. \n" ); -#endif exit( -1 ); } @@ -965,11 +951,7 @@ int main( if ( referenceRotReader != NULL ) { IVAS_QUATERNION quaternion; -#ifdef TD5 if ( ( error = HeadRotationFileReading( referenceRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK ) -#else - if ( HeadRotationFileReading( referenceRotReader, &quaternion ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -989,21 +971,13 @@ int main( for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) { -#ifdef TD5 if ( ( error = HeadRotationFileReading( headRotReader, &quatBuffer[i], &Pos[i] ) ) != IVAS_ERR_OK ) -#else - if ( HeadRotationFileReading( headRotReader, &quatBuffer[i] ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } } -#ifdef TD5 if ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer, Pos ) ) != IVAS_ERR_OK ) -#else - if ( IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -1011,11 +985,7 @@ int main( } else { -#ifdef TD5 if ( ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ) ) != IVAS_ERR_OK ) && ( IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ) != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) // VE: TBC -#else - if ( ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_OK ) && ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) -#endif { fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -1877,11 +1847,9 @@ void getMetadataFromFileReader( objectMetadataBuffer->positions[objIdx].azimuth = ismMetadata.azimuth; objectMetadataBuffer->positions[objIdx].elevation = ismMetadata.elevation; -#ifdef TD5 objectMetadataBuffer->positions[objIdx].radius = ismMetadata.radius; objectMetadataBuffer->positions[objIdx].yaw = ismMetadata.yaw; objectMetadataBuffer->positions[objIdx].pitch = ismMetadata.pitch; -#endif return; } @@ -1936,11 +1904,9 @@ static void IsmPositionProvider_getNextFrame( { objectMetadataBuffer->positions[objIdx].azimuth = 0.0f; objectMetadataBuffer->positions[objIdx].elevation = 0.0f; -#ifdef TD5 objectMetadataBuffer->positions[objIdx].radius = 1.0f; objectMetadataBuffer->positions[objIdx].yaw = 0.0f; objectMetadataBuffer->positions[objIdx].pitch = 0.0f; -#endif } /* Wrap azimuth to lie within (-180, 180] range */ @@ -1955,7 +1921,6 @@ static void IsmPositionProvider_getNextFrame( /* Clamp elevation to lie within [-90, 90] range (can't be wrapped easily) */ objectMetadataBuffer->positions[objIdx].elevation = min( max( objectMetadataBuffer->positions[objIdx].elevation, -90 ), 90 ); -#ifdef TD5 /* Wrap yaw to lie within (-180, 180] range */ while ( objectMetadataBuffer->positions[objIdx].yaw < 0.0f ) { @@ -1968,7 +1933,6 @@ static void IsmPositionProvider_getNextFrame( /* Clamp pitch to lie within [-90, 90] range (can't be wrapped easily) */ objectMetadataBuffer->positions[objIdx].pitch = min( max( objectMetadataBuffer->positions[objIdx].pitch, -90 ), 90 ); -#endif } ++positionProvider->frameCounter; @@ -2203,7 +2167,6 @@ static void parseObjectPosition( uint16_t *positionDuration ) { char *endptr; -#ifdef TD5 int16_t read_values; float meta_prm[7] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f }; @@ -2224,34 +2187,6 @@ static void parseObjectPosition( position->radius = meta_prm[2]; position->yaw = meta_prm[5]; position->pitch = meta_prm[6]; -#else - - readNextMetadataChunk( line, "," ); - *positionDuration = (uint16_t) strtol( line, &endptr, 10 ); - - if ( *endptr != '\0' ) - { - fprintf( stderr, "Error reading metadata\n" ); - exit( -1 ); - } - - readNextMetadataChunk( line, "," ); - position->azimuth = strtof( line, &endptr ); - - if ( *endptr != '\0' ) - { - fprintf( stderr, "Error reading metadata\n" ); - exit( -1 ); - } - - readNextMetadataChunk( line, "\n" ); - position->elevation = strtof( line, &endptr ); - if ( *endptr != '\0' ) - { - fprintf( stderr, "Error reading metadata\n" ); - exit( -1 ); - } -#endif return; } diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 0ca4d6b461..24811daca1 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -78,10 +78,8 @@ typedef struct _IVAS_ISM_METADATA float radius; float spread; float gainFactor; -#ifdef TD5 float yaw; float pitch; -#endif } IVAS_ISM_METADATA; typedef struct @@ -97,13 +95,11 @@ typedef struct } IVAS_VECTOR3; #endif /* OTR_REFERENCE_VECTOR_TRACKING */ -#ifdef TD5 typedef struct { float x, y, z; } IVAS_POSITION; -#endif typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; #ifdef FIX_350_MASA_DELAY_COMP @@ -130,11 +126,9 @@ typedef struct { float azimuth; float elevation; -#ifdef TD5 float radius; float yaw; float pitch; -#endif } IVAS_REND_AudioObjectPosition; typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG @@ -156,9 +150,7 @@ typedef struct _IVAS_RENDER_CONFIG IVAS_RENDER_TYPE_OVERRIDE renderer_type_override; #endif IVAS_ROOM_ACOUSTICS_CONFIG_DATA room_acoustics; -#ifdef TD5 float directivity[3]; -#endif } IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE; typedef struct _IVAS_LS_CUSTOM_LAYOUT diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index e97939b8a6..7f434feccd 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -320,13 +320,11 @@ typedef enum #define ISM_Q_STEP 2.5f #define ISM_Q_STEP_BORDER 5.0f -#ifdef TD5 #define ISM_RADIUS_NBITS 6 #define ISM_RADIUS_MIN 0.0f #define ISM_RADIUS_DELTA 0.25f /* Max radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */ #define ISM_EXTENDED_METADATA_BRATE IVAS_64k #define ISM_EXTENDED_METADATA_BITS 1 -#endif /* Parametric ISM */ #define MAX_PARAM_ISM_NBANDS 11 @@ -374,12 +372,8 @@ typedef enum enum { IND_ISM_NUM_OBJECTS, -#ifdef TD5 IND_ISM_EXTENDED_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS, IND_ISM_METADATA_FLAG = IND_ISM_EXTENDED_FLAG + MAX_NUM_OBJECTS, /* EN2VE: Is this not supposed to be in the loop part below, since it is one per ISM? */ -#else - IND_ISM_METADATA_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS, -#endif IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS, #ifdef DISCRETE_ISM_DTX_CNG IND_ISM_NOISY_SPEECH_FLAG = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS, @@ -396,10 +390,8 @@ enum IND_ISM_AZIMUTH = TAG_ISM_LOOP_START, IND_ISM_ELEVATION_DIFF_FLAG = TAG_ISM_LOOP_START, IND_ISM_ELEVATION = TAG_ISM_LOOP_START, -#ifdef TD5 IND_ISM_RADIUS_DIFF_FLAG = TAG_ISM_LOOP_START, IND_ISM_RADIUS = TAG_ISM_LOOP_START, -#endif TAG_ISM_LOOP_END = TAG_ISM_LOOP_START + 100, /* IVAS_fmToDo: to be reviewed once the final metadata are defined */ /* --------- end of loop for objects ----------- */ diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index cdcb3a9b1c..297e2cfb45 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -132,12 +132,10 @@ ivas_error ivas_ism_config( /* count ISM common signaling bits */ if ( hIsmMeta != NULL ) { -#ifdef TD5 if ( ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) { nb_bits_metadata[0] += ISM_EXTENDED_METADATA_BITS; } -#endif nb_bits_metadata[0] += n_ISms * ISM_METADATA_FLAG_BITS + nchan_ism; for ( ch = 0; ch < n_ISms; ch++ ) @@ -336,11 +334,9 @@ void ivas_ism_reset_metadata( { hIsmMeta->azimuth = 0.0f; hIsmMeta->elevation = 0.0f; -#ifdef TD5 hIsmMeta->yaw = 0.0f; hIsmMeta->pitch = 0.0f; hIsmMeta->radius = 1.0f; -#endif return; } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 72975e1f9f..f4adee3cb1 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -786,14 +786,10 @@ float ism_dequant_meta( ivas_error ivas_set_ism_metadata( ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ const float azimuth, /* i : azimuth value */ -#ifdef TD5 const float elevation, /* i : elevation value */ const float radius_meta, /* i : radius */ const float yaw, /* i : yaw */ const float pitch /* i : pitch */ -#else - const float elevation /* i : elevation value */ -#endif ); ivas_error ivas_ism_metadata_enc_create( @@ -827,12 +823,8 @@ ivas_error ivas_ism_metadata_enc( int16_t nb_bits_metadata[], /* o : number of metadata bits */ const int16_t localVAD[], /* i : VAD flag */ const int16_t ism_mode, /* i : ISM mode */ -#ifdef TD5 const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ const int16_t ism_extended_metadata_flag /* i : Extended metadata flag */ -#else - const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ -#endif ); ivas_error ivas_ism_metadata_dec( diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index b445ac6f04..eedb65dbf3 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -44,7 +44,6 @@ * Declaration of ISM common (encoder & decoder) structure *----------------------------------------------------------------------------------*/ -#ifdef TD5 typedef struct { int16_t last_azimuth_idx; /* last frame index of coded azimuth */ @@ -53,7 +52,6 @@ typedef struct int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */ } ISM_METADATA_ANGLE, *ISM_METADATA_ANGLE_HANDLE; -#endif /* ISM metadata handle (storage for one frame of read ISM metadata) */ typedef struct @@ -63,19 +61,12 @@ typedef struct float azimuth; /* azimuth value read from the input metadata file */ float elevation; /* azimuth value read from the input metadata file */ -#ifdef TD5 float radius; float yaw; /* azimuth orientation value read from the input metadata file */ float pitch; /* elevation orientation value read from the input metadata file */ ISM_METADATA_ANGLE angle[2]; /* Angle structs for [0] azimuth/elevation and [1] yaw/pitch */ int16_t last_radius_idx; /* last frame index of coded radius */ int16_t radius_diff_cnt; /* FEC counter of consecutive differentially radius coded frames */ -#else - int16_t last_azimuth_idx; /* last frame index of coded azimuth */ - int16_t azimuth_diff_cnt; /* FEC counter of consecutive differentially azimuth coded frames */ - int16_t last_elevation_idx; /* last frame index of coded elevation */ - int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */ -#endif #ifdef DISCRETE_ISM_DTX_CNG float last_azimuth; /* MD smoothing in DTX- last Q azimuth value */ diff --git a/lib_com/options.h b/lib_com/options.h index fd3ec5b506..ea487c3f23 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -144,8 +144,6 @@ /*#define SBA_HPF_TUNING_DEC*/ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ -#define TD5 /* Eri: Contribution 17: Extended metadata for 6 DoF rendering in TD renderer */ -#define TD5_FIX_INVALID_MEMORY_ACCESS /* FhG: Resolves segfault in case IVAS_REND_InitConfig gets initialized with rendererConfigEnabled:=false && ISM are being rendered */ #define FIX_371_DELAY_REPORT /* Issue 371: div. by zero with -no_delay_cmp */ #define FIX_373_MASA_DELAY_COMP_MSAN /* Nokia: Issue 373: MASA audio/meta delay compensation. MSAN bugfix */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 99f94fa536..f8a5bea72b 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -46,7 +46,6 @@ #include "wmc_auto.h" -#ifdef TD5 /*-----------------------------------------------------------------------* * Local functions *-----------------------------------------------------------------------*/ @@ -54,7 +53,6 @@ static void decode_angle_indices( DEC_CORE_HANDLE st0, ISM_METADATA_ANGLE_HANDLE angle, int16_t *flag_abs_azimuth ); static int16_t decode_radius( DEC_CORE_HANDLE st0, int16_t *last_radius_idx, int16_t *flag_abs_radius ); -#endif #ifdef DISCRETE_ISM_DTX_CNG /*-------------------------------------------------------------------------* @@ -159,24 +157,15 @@ ivas_error ivas_ism_metadata_dec( const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ ) { -#ifdef TD5 int16_t ch, nb_bits_start = 0, last_bit_pos; int16_t idx_radius; -#else - int16_t ch, nb_bits_start = 0, last_bit_pos, sgn, diff; -#endif int32_t element_brate[MAX_NUM_OBJECTS], total_brate[MAX_NUM_OBJECTS]; DEC_CORE_HANDLE st0; -#ifdef TD5 int16_t ism_extended_metadata_flag; int16_t flag_abs_radius; int16_t flag_abs_orientation; int16_t idx_azimuth, flag_abs_azimuth; int16_t idx_elevation; -#else - int16_t idx_azimuth, nbits_diff_azimuth, flag_abs_azimuth; - int16_t idx_elevation, nbits_diff_elevation; -#endif int16_t next_bit_pos_orig; uint16_t i, bstr_meta[MAX_BITS_METADATA], *bstr_orig; ISM_METADATA_HANDLE hIsmMetaData; @@ -229,9 +218,7 @@ ivas_error ivas_ism_metadata_dec( bstr_orig = st0->bit_stream; next_bit_pos_orig = st0->next_bit_pos; st0->next_bit_pos = 0; -#ifdef TD5 ism_extended_metadata_flag = 0; -#endif /* reverse the bitstream for easier reading of indices */ for ( i = 0; i < min( MAX_BITS_METADATA, last_bit_pos ); i++ ) @@ -280,13 +267,11 @@ ivas_error ivas_ism_metadata_dec( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong number of objects signalled!" ); } -#ifdef TD5 /* read extended metadata presence flag */ if ( ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) { ism_extended_metadata_flag = get_next_indice( st0, ISM_EXTENDED_METADATA_BITS ); } -#endif /* Read ISM present flags (one per object) */ for ( ch = 0; ch < *nchan_transport; ch++ ) @@ -347,14 +332,11 @@ ivas_error ivas_ism_metadata_dec( } flag_abs_azimuth = 0; -#ifdef TD5 flag_abs_orientation = 0; flag_abs_radius = 0; -#endif if ( hIsmMeta[ch]->ism_metadata_flag ) { -#ifdef TD5 decode_angle_indices( st0, &( hIsmMetaData->angle[0] ), &flag_abs_azimuth ); idx_azimuth = hIsmMetaData->angle[0].last_azimuth_idx; idx_elevation = hIsmMetaData->angle[0].last_elevation_idx; @@ -388,156 +370,6 @@ ivas_error ivas_ism_metadata_dec( hIsmMetaData->radius = 1.0f; } } -#else - /*----------------------------------------------------------------* - * Azimuth decoding and dequantization - *----------------------------------------------------------------*/ - - /* Decode azimuth index */ - if ( get_next_indice( st0, 1 ) == 1 ) /* azimuth_abs_flag */ - { - idx_azimuth = get_next_indice( st0, ISM_AZIMUTH_NBITS ); - flag_abs_azimuth = 1; - } - else - { - diff = 0; - sgn = 1; - - if ( get_next_indice( st0, 1 ) == 0 ) - { - nbits_diff_azimuth = 1; - } - else - { - nbits_diff_azimuth = 1; - - if ( get_next_indice( st0, 1 ) == 1 ) /* negative sign */ - { - sgn = -1; - } - - nbits_diff_azimuth++; - - /* read until the stop bit */ - while ( ( nbits_diff_azimuth < ISM_AZIMUTH_NBITS - 1 ) && ( get_next_indice( st0, 1 ) == 1 ) ) - { - diff++; - nbits_diff_azimuth++; - } - - if ( nbits_diff_azimuth < ISM_AZIMUTH_NBITS - 1 ) - { - /* count stop bit */ - nbits_diff_azimuth++; - } - } - - idx_azimuth = hIsmMetaData->last_azimuth_idx + sgn * diff; - } - - /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ - if ( idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - { - idx_azimuth -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* +180° -> -180° */ - } - else if ( idx_azimuth < 0 ) - { - idx_azimuth += ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* -180° -> +180° */ - } - - /* +180° == -180° */ - if ( idx_azimuth == ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - { - idx_azimuth = 0; - } - - /* sanity check in case of FER or BER */ - if ( idx_azimuth < 0 || idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - { - idx_azimuth = hIsmMetaData->last_azimuth_idx; - } - - /* Azimuth dequantization */ - if ( ism_mode == ISM_MODE_PARAM ) - { - hParamIsm->azi_index[ch] = idx_azimuth; - } - else /* ISM_MODE_DISC */ - { - hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); - } - - /*----------------------------------------------------------------* - * Elevation decoding and dequantization - *----------------------------------------------------------------*/ - - /* Decode elevation index */ - if ( flag_abs_azimuth == 0 && get_next_indice( st0, 1 ) == 1 ) /* elevation_abs_flag */ - { - idx_elevation = get_next_indice( st0, ISM_ELEVATION_NBITS ); - } - else - { - diff = 0; - sgn = 1; - - if ( get_next_indice( st0, 1 ) == 0 ) - { - nbits_diff_elevation = 1; - } - else - { - nbits_diff_elevation = 1; - - if ( get_next_indice( st0, 1 ) == 1 ) /* negative sign */ - { - sgn = -1; - } - - nbits_diff_elevation++; - - /* read until the stop bit */ - while ( ( nbits_diff_elevation < ISM_ELEVATION_NBITS ) && ( get_next_indice( st0, 1 ) == 1 ) ) - { - diff++; - nbits_diff_elevation++; - } - - if ( nbits_diff_elevation < ISM_ELEVATION_NBITS ) - { - /* count stop bit */ - nbits_diff_elevation++; - } - } - - idx_elevation = hIsmMetaData->last_elevation_idx + sgn * diff; - } - - /* sanity check in case of FER or BER */ - if ( idx_elevation < 0 || idx_elevation > ( 1 << ISM_ELEVATION_NBITS ) - 1 ) - { - idx_elevation = hIsmMetaData->last_elevation_idx; - } - - /* Elevation dequantization */ - if ( ism_mode == ISM_MODE_PARAM ) - { - hParamIsm->ele_index[ch] = idx_elevation; - } - else /* ISM_MODE_DISC */ - { - hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); - } - - /*----------------------------------------------------------------* - * Final updates - *----------------------------------------------------------------*/ - - /* updates */ - hIsmMetaData->last_azimuth_idx = idx_azimuth; - hIsmMetaData->last_elevation_idx = idx_elevation; -#endif #ifdef DISCRETE_ISM_DTX_CNG /* save for smoothing metadata evolution */ hIsmMetaData->last_true_azimuth = hIsmMetaData->azimuth; @@ -647,13 +479,8 @@ ivas_error ivas_ism_metadata_dec( /*hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch] % hParamIsm->ele_alpha;*/ hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch]; #endif -#ifdef TD5 hIsmMeta[ch]->angle[0].last_azimuth_idx = hParamIsm->azi_index[ch]; hIsmMeta[ch]->angle[0].last_elevation_idx = hParamIsm->ele_index[ch]; -#else - hIsmMeta[ch]->last_azimuth_idx = hParamIsm->azi_index[ch]; - hIsmMeta[ch]->last_elevation_idx = hParamIsm->ele_index[ch]; -#endif } } } @@ -767,16 +594,11 @@ ivas_error ivas_ism_metadata_dec_create( } st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0; -#ifdef TD5 st_ivas->hIsmMetaData[ch]->angle[0].last_azimuth_idx = 0; st_ivas->hIsmMetaData[ch]->angle[0].last_elevation_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); st_ivas->hIsmMetaData[ch]->angle[1].last_azimuth_idx = 0; st_ivas->hIsmMetaData[ch]->angle[1].last_elevation_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); st_ivas->hIsmMetaData[ch]->last_radius_idx = 8; /* Init to radius 1.0 */ -#else - st_ivas->hIsmMetaData[ch]->last_azimuth_idx = 0; - st_ivas->hIsmMetaData[ch]->last_elevation_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); -#endif #ifdef DISCRETE_ISM_DTX_CNG st_ivas->hIsmMetaData[ch]->last_true_azimuth = 0; @@ -799,7 +621,6 @@ ivas_error ivas_ism_metadata_dec_create( } -#ifdef TD5 /*------------------------------------------------------------------------- * decode_angle_indices() * @@ -1013,7 +834,6 @@ static int16_t decode_radius( return idx_radius; } -#endif #ifdef DISCRETE_ISM_DTX_CNG @@ -1163,23 +983,13 @@ void ivas_ism_metadata_sid_dec( /* update last indexes to correspond to active frames coding */ if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) { -#ifdef TD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); -#else - hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); - hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); -#endif } else { -#ifdef TD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); -#else - hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); - hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); -#endif } /* save for smoothing metadata evolution */ diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index d06a2b8f5b..f1c1fc04f2 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -53,13 +53,8 @@ ivas_error ivas_td_binaural_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { -#ifdef TD5 return ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport, st_ivas->ivas_format, st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); -#else - return ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport, st_ivas->ivas_format, - st_ivas->transport_config, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); -#endif } @@ -80,10 +75,6 @@ ivas_error ivas_td_binaural_renderer( st_ivas->hReverb, st_ivas->transport_config, st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, -#ifdef TD5 st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, output, output_frame ); -#else - st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, output, output_frame ); -#endif } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 2939b352c6..ff0b5ab59a 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -833,13 +833,9 @@ ivas_error IVAS_DEC_GetObjectMetadata( { metadata->azimuth = hIsmMeta->azimuth; metadata->elevation = hIsmMeta->elevation; -#ifdef TD5 metadata->radius = hIsmMeta->radius; metadata->yaw = hIsmMeta->yaw; metadata->pitch = hIsmMeta->pitch; -#else - metadata->radius = 0.f; -#endif metadata->spread = 0.f; metadata->gainFactor = 1.f; } @@ -890,12 +886,8 @@ ivas_error IVAS_DEC_GetMasaMetadata( ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -#ifdef TD5 IVAS_QUATERNION *orientation, /* i : head-tracking data, listener orientation */ IVAS_POSITION *Pos /* i : listener position */ -#else - IVAS_QUATERNION *orientation /* i : head-tracking data, listener orientation */ -#endif ) { HEAD_TRACK_DATA_HANDLE hHeadTrackData; @@ -923,11 +915,9 @@ ivas_error IVAS_DEC_FeedHeadTrackData( } ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, orientation[i], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hHeadTrackData->Quaternions[i] ); -#ifdef TD5 hHeadTrackData->Pos[i].x = Pos[i].x; hHeadTrackData->Pos[i].y = Pos[i].y; hHeadTrackData->Pos[i].z = Pos[i].z; -#endif } hIvasDec->st_ivas->hHeadTrackData->num_quaternions = 0; @@ -1172,9 +1162,7 @@ ivas_error IVAS_DEC_GetRenderConfig( mvr2r( hRCin->roomAcoustics.pFc_input, hRCout->room_acoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->room_acoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( hRCin->roomAcoustics.pAcoustic_dsr, hRCout->room_acoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); -#ifdef TD5 mvr2r( hRCin->directivity, hRCout->directivity, 3 ); -#endif return IVAS_ERR_OK; } @@ -1219,9 +1207,7 @@ ivas_error IVAS_DEC_FeedRenderConfig( mvr2r( renderConfig.room_acoustics.pFc_input, hRenderConfig->roomAcoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); mvr2r( renderConfig.room_acoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( renderConfig.room_acoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); -#ifdef TD5 mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 ); -#endif return IVAS_ERR_OK; } diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index db22b6a5c0..91bbc2f8e9 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -176,12 +176,8 @@ ivas_error IVAS_DEC_GetMasaMetadata( /*! r: error code */ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -#ifdef TD5 IVAS_QUATERNION *orientation, /* i : head-tracking data */ IVAS_POSITION *Pos /* i : listener position */ -#else - IVAS_QUATERNION *orientation /* i : head-tracking data */ -#endif ); /*! r: error code */ diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 25ce78ff2e..f073609b8a 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -270,35 +270,19 @@ ivas_error ivas_ism_enc( else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { // VE: call ivas_ism_metadata_enc() with 'st_ivas' - TBD -#ifdef TD5 ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, #ifdef NCHAN_ISM_PARAMETER nchan_ism, #endif st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); -#else - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, -#ifdef NCHAN_ISM_PARAMETER - nchan_ism, -#endif - st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); -#endif } else /* ISM_MODE_DISC */ { -#ifdef TD5 ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, #ifdef NCHAN_ISM_PARAMETER nchan_ism, #endif st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); -#else - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, -#ifdef NCHAN_ISM_PARAMETER - nchan_ism, -#endif - st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL ); -#endif } #ifdef DISCRETE_ISM_DTX_CNG diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 640ee49fbf..da1a568a94 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -49,24 +49,17 @@ * Local constants *-----------------------------------------------------------------------*/ -#ifdef TD5 #define ISM_NUM_PARAM 5 /* number of coded metadata parameters */ -#else -#define ISM_NUM_PARAM 2 /* number of coded metadata parameters */ -#endif #define ISM_MAX_AZIMUTH_DIFF_IDX ( ISM_AZIMUTH_NBITS - 1 /*zero*/ - 1 /*sign*/ ) #define ISM_MAX_ELEVATION_DIFF_IDX ( ISM_ELEVATION_NBITS - 1 /*zero*/ - 1 /*sign*/ ) -#ifdef TD5 #define ISM_MAX_RADIUS_DIFF_IDX ( ISM_RADIUS_NBITS - 1 /*zero*/ - 1 /*sign*/ ) -#endif #define ISM_FEC_MAX 10 #define INTER_OBJECT_PARAM_CHECK ( ( ISM_FEC_MAX / 2 ) - 2 ) /* note: constant must be less than (ISM_FEC_MAX / number of coded parameters) */ -#ifdef TD5 /*-----------------------------------------------------------------------* * Local function declarations *-----------------------------------------------------------------------*/ @@ -75,7 +68,6 @@ static void encode_angle_indices( BSTR_ENC_HANDLE hBstr, ISM_METADATA_ANGLE_HAND static void encode_radius( BSTR_ENC_HANDLE hBstr, int16_t *last_radius_idx, int16_t *radius_diff_cnt, const int16_t last_ism_metadata_flag, const int16_t idx_radius_abs, int16_t *flag_abs_radius ); -#endif /*-------------------------------------------------------------------------* * ivas_set_ism_metadata() @@ -86,14 +78,10 @@ static void encode_radius( BSTR_ENC_HANDLE hBstr, int16_t *last_radius_idx, int1 ivas_error ivas_set_ism_metadata( ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ const float azimuth, /* i : azimuth value */ -#ifdef TD5 const float elevation, /* i : elevation */ const float radius_meta, /* i : radius */ const float yaw, /* i : yaw */ const float pitch /* i : pitch */ -#else - const float elevation /* i : elevation value */ -#endif ) { if ( hIsmMeta == NULL ) @@ -106,11 +94,9 @@ ivas_error ivas_set_ism_metadata( /* save read metadata parameters to the internal codec structure */ hIsmMeta->azimuth = azimuth; hIsmMeta->elevation = elevation; -#ifdef TD5 hIsmMeta->radius = radius_meta; hIsmMeta->yaw = yaw; hIsmMeta->pitch = pitch; -#endif return IVAS_ERR_OK; } @@ -187,25 +173,15 @@ ivas_error ivas_ism_metadata_enc( int16_t nb_bits_metadata[], /* o : number of metadata bits */ const int16_t localVAD[], /* i : VAD flag */ const int16_t ism_mode, /* i : ISM mode */ -#ifdef TD5 const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Enc Handle */ const int16_t ism_extended_metadata_flag /* i : Extended metadata flag */ -#else - const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ -#endif ) { -#ifdef TD5 int16_t i, ch, nb_bits_start = 0; int16_t idx_azimuth_abs = 0, flag_abs_azimuth[MAX_NUM_OBJECTS]; int16_t idx_elevation_abs = 0, flag_abs_elevation[MAX_NUM_OBJECTS]; int16_t flag_abs_azimuth_orientation[MAX_NUM_OBJECTS]; int16_t idx_radius_abs = 0, flag_abs_radius[MAX_NUM_OBJECTS]; -#else - int16_t i, ch, nb_bits_start = 0, diff; - int16_t idx_azimuth, idx_azimuth_abs = 0, flag_abs_azimuth[MAX_NUM_OBJECTS], nbits_diff_azimuth; - int16_t idx_elevation, idx_elevation_abs = 0, flag_abs_elevation[MAX_NUM_OBJECTS], nbits_diff_elevation; -#endif float valQ; ISM_METADATA_HANDLE hIsmMetaData; int32_t element_brate[MAX_NUM_OBJECTS], total_brate[MAX_NUM_OBJECTS]; @@ -252,10 +228,8 @@ ivas_error ivas_ism_metadata_enc( set_s( nb_bits_metadata, 0, nchan_transport ); set_s( flag_abs_azimuth, 0, nchan_ism ); set_s( flag_abs_elevation, 0, nchan_ism ); -#ifdef TD5 set_s( flag_abs_azimuth_orientation, 0, nchan_ism ); set_s( flag_abs_radius, 0, nchan_ism ); -#endif /*----------------------------------------------------------------* * Set Metadata presence / importance flag @@ -269,7 +243,6 @@ ivas_error ivas_ism_metadata_enc( } else if ( ism_mode == ISM_MODE_DISC ) { -#ifdef TD5 #ifdef DISCRETE_ISM_DTX_CNG hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10; #else @@ -278,15 +251,6 @@ ivas_error ivas_ism_metadata_enc( { hIsmMeta[ch]->ism_metadata_flag = 0; } -#endif -#else - hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10; - - if ( hSCE[ch]->hCoreCoder[0]->tcxonly ) - { - /* at highest bitrates (with TCX core only) metadata are sent in every frame */ - hIsmMeta[ch]->ism_metadata_flag = 1; - } #endif } } @@ -309,13 +273,11 @@ ivas_error ivas_ism_metadata_enc( } push_indice( hBstr, IND_ISM_NUM_OBJECTS, 0, 1 ); -#ifdef TD5 /* write extended metadata presence flag */ if ( ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) { push_indice( hBstr, IND_ISM_EXTENDED_FLAG, ism_extended_metadata_flag, ISM_EXTENDED_METADATA_BITS ); } -#endif /* write ISM metadata flag (one per object) */ for ( ch = 0; ch < nchan_transport; ch++ ) @@ -365,7 +327,6 @@ ivas_error ivas_ism_metadata_enc( if ( hIsmMeta[ch]->ism_metadata_flag ) { -#ifdef TD5 /*----------------------------------------------------------------* * Quantize and encode azimuth and elevation *----------------------------------------------------------------*/ @@ -401,252 +362,6 @@ ivas_error ivas_ism_metadata_enc( { nb_bits_metadata[ch] = hBstr->nb_bits_tot - nb_bits_start; } -#else - /*----------------------------------------------------------------* - * Azimuth quantization and encoding - *----------------------------------------------------------------*/ - - /* Azimuth quantization (quantize azimuth to the AZIMUTH_NBITS-bit index */ - if ( ism_mode == ISM_MODE_DISC ) - { - idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); - } - else if ( ism_mode == ISM_MODE_PARAM ) - { - idx_azimuth_abs = hParamIsm->azi_index[ch]; - } - idx_azimuth = idx_azimuth_abs; - - nbits_diff_azimuth = 0; - - flag_abs_azimuth[ch] = 0; /* differential coding by default */ - if ( hIsmMetaData->azimuth_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ - || hIsmMetaData->last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ - ) - { - flag_abs_azimuth[ch] = 1; - } - - /* try differential coding */ - if ( flag_abs_azimuth[ch] == 0 ) - { - diff = idx_azimuth_abs - hIsmMetaData->last_azimuth_idx; - - /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ - if ( abs( diff ) > ( ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - ISM_MAX_AZIMUTH_DIFF_IDX ) - { - if ( diff > 0 ) - { - diff -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; - } - else - { - diff += ( 1 << ISM_AZIMUTH_NBITS ) - 1; - } - } - - if ( diff == 0 ) - { - idx_azimuth = 0; - nbits_diff_azimuth = 1; - } - else if ( ABSVAL( diff ) < ISM_MAX_AZIMUTH_DIFF_IDX ) /* when diff bits >= abs bits, prefer abs */ - { - idx_azimuth = 1 << 1; - nbits_diff_azimuth = 1; - - if ( diff < 0 ) - { - idx_azimuth += 1; /* negative sign */ - diff *= -1; - } - else - { - idx_azimuth += 0; /* positive sign */ - } - - idx_azimuth = idx_azimuth << diff; - nbits_diff_azimuth++; - - /* unary coding of "diff */ - idx_azimuth += ( ( 1 << diff ) - 1 ); - nbits_diff_azimuth += diff; - - if ( nbits_diff_azimuth < ISM_AZIMUTH_NBITS - 1 ) - { - /* add stop bit - only for codewords shorter than ISM_AZIMUTH_NBITS */ - idx_azimuth = idx_azimuth << 1; - nbits_diff_azimuth++; - } - } - else - { - flag_abs_azimuth[ch] = 1; - } - } - - /* update counter */ - if ( flag_abs_azimuth[ch] == 0 ) - { - hIsmMetaData->azimuth_diff_cnt++; - hIsmMetaData->elevation_diff_cnt = min( hIsmMetaData->elevation_diff_cnt, ISM_FEC_MAX ); - } - else - { - hIsmMetaData->azimuth_diff_cnt = 0; - } - - /* Write azimuth */ - push_indice( hBstr, IND_ISM_AZIMUTH_DIFF_FLAG, flag_abs_azimuth[ch], 1 ); - - if ( flag_abs_azimuth[ch] ) - { - push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, ISM_AZIMUTH_NBITS ); - } - else - { - push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, nbits_diff_azimuth ); - } - - /*----------------------------------------------------------------* - * Elevation quantization and encoding - *----------------------------------------------------------------*/ - - /* Elevation quantization (quantize azimuth to the ELEVATION_NBITS-bit index */ - if ( ism_mode == ISM_MODE_DISC ) - { - idx_elevation_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); - } - else /* ISM_MODE_PARAM */ - { - idx_elevation_abs = hParamIsm->ele_index[ch]; - } - idx_elevation = idx_elevation_abs; - - nbits_diff_elevation = 0; - - flag_abs_elevation[ch] = 0; /* differential coding by default */ - if ( hIsmMetaData->elevation_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ - || hIsmMetaData->last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ - ) - { - flag_abs_elevation[ch] = 1; - } - - /* note: elevation is coded starting from the second frame only (it is meaningless in the init_frame) */ - if ( hSCE[0]->hCoreCoder[0]->ini_frame == 0 ) - { - flag_abs_elevation[ch] = 1; - hIsmMetaData->last_elevation_idx = idx_elevation_abs; - } - - diff = idx_elevation_abs - hIsmMetaData->last_elevation_idx; - - /* avoid absolute coding of elevation if absolute coding was already used for azimuth */ - if ( flag_abs_azimuth[ch] == 1 ) - { - int16_t diff_orig = diff; - - flag_abs_elevation[ch] = 0; - - - if ( diff >= 0 ) - { - diff = min( diff, ISM_MAX_ELEVATION_DIFF_IDX ); - } - else - { - diff = -1 * min( -diff, ISM_MAX_ELEVATION_DIFF_IDX ); - } - - if ( hIsmMetaData->last_ism_metadata_flag == 0 || abs( diff_orig - diff ) > ISM_MAX_ELEVATION_DIFF_IDX ) - { - hIsmMetaData->elevation_diff_cnt = ISM_FEC_MAX - 1; - } - } - - /* try differential coding */ - if ( flag_abs_elevation[ch] == 0 ) - { - if ( diff == 0 ) - { - idx_elevation = 0; - nbits_diff_elevation = 1; - } - else if ( ABSVAL( diff ) <= ISM_MAX_ELEVATION_DIFF_IDX ) - { - idx_elevation = 1 << 1; - nbits_diff_elevation = 1; - - if ( diff < 0 ) - { - idx_elevation += 1; /* negative sign */ - diff *= -1; - } - else - { - idx_elevation += 0; /* positive sign */ - } - - idx_elevation = idx_elevation << diff; - nbits_diff_elevation++; - - /* unary coding of "diff */ - idx_elevation += ( ( 1 << diff ) - 1 ); - nbits_diff_elevation += diff; - - if ( nbits_diff_elevation < ISM_ELEVATION_NBITS ) - { - /* add stop bit */ - idx_elevation = idx_elevation << 1; - nbits_diff_elevation++; - } - } - else - { - flag_abs_elevation[ch] = 1; - } - } - - /* update counter */ - if ( flag_abs_elevation[ch] == 0 ) - { - hIsmMetaData->elevation_diff_cnt++; - hIsmMetaData->elevation_diff_cnt = min( hIsmMetaData->elevation_diff_cnt, ISM_FEC_MAX ); - } - else - { - hIsmMetaData->elevation_diff_cnt = 0; - } - - /* Write elevation */ - if ( flag_abs_azimuth[ch] == 0 ) /* do not write "flag_abs_elevation" if "flag_abs_azimuth == 1" */ - { - push_indice( hBstr, IND_ISM_ELEVATION_DIFF_FLAG, flag_abs_elevation[ch], 1 ); - } - - if ( flag_abs_elevation[ch] ) - { - push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, ISM_ELEVATION_NBITS ); - } - else - { - push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, nbits_diff_elevation ); - } - - /*----------------------------------------------------------------* - * Updates - *----------------------------------------------------------------*/ - - hIsmMetaData->last_azimuth_idx = idx_azimuth_abs; - hIsmMetaData->last_elevation_idx = idx_elevation_abs; - - /* save number of metadata bits written */ - if ( ism_mode == ISM_MODE_DISC ) - { - nb_bits_metadata[ch] = hBstr->nb_bits_tot - nb_bits_start; - } -#endif } } @@ -659,11 +374,7 @@ ivas_error ivas_ism_metadata_enc( while ( i == 0 || i < nchan_ism / INTER_OBJECT_PARAM_CHECK ) { int16_t num, abs_num, abs_first, abs_next, pos_zero; -#ifdef TD5 int16_t abs_matrice[INTER_OBJECT_PARAM_CHECK * ISM_NUM_PARAM]; -#else - int16_t abs_matrice[INTER_OBJECT_PARAM_CHECK * 2]; -#endif num = min( INTER_OBJECT_PARAM_CHECK, nchan_ism - i * INTER_OBJECT_PARAM_CHECK ); i++; @@ -711,20 +422,12 @@ ivas_error ivas_ism_metadata_enc( if ( abs_next % ISM_NUM_PARAM == 0 ) { -#ifdef TD5 hIsmMeta[ch]->angle[0].azimuth_diff_cnt = abs_num - 1; -#else - hIsmMeta[ch]->azimuth_diff_cnt = abs_num - 1; -#endif } if ( abs_next % ISM_NUM_PARAM == 1 ) { -#ifdef TD5 hIsmMeta[ch]->angle[0].elevation_diff_cnt = abs_num - 1; -#else - hIsmMeta[ch]->elevation_diff_cnt = abs_num - 1; -#endif /*hIsmMeta[ch]->elevation_diff_cnt = min( hIsmMeta[ch]->elevation_diff_cnt, ISM_FEC_MAX );*/ } @@ -860,7 +563,6 @@ ivas_error ivas_ism_metadata_enc_create( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISM MetaData\n" ) ); } -#ifdef TD5 st_ivas->hIsmMetaData[ch]->angle[0].last_azimuth_idx = 0; st_ivas->hIsmMetaData[ch]->angle[0].azimuth_diff_cnt = ISM_FEC_MAX; st_ivas->hIsmMetaData[ch]->angle[0].last_elevation_idx = 0; @@ -871,12 +573,6 @@ ivas_error ivas_ism_metadata_enc_create( st_ivas->hIsmMetaData[ch]->angle[1].azimuth_diff_cnt = ISM_FEC_MAX - 2; st_ivas->hIsmMetaData[ch]->angle[1].last_elevation_idx = 0; st_ivas->hIsmMetaData[ch]->angle[1].elevation_diff_cnt = ISM_FEC_MAX - 2; -#else - st_ivas->hIsmMetaData[ch]->last_azimuth_idx = 0; - st_ivas->hIsmMetaData[ch]->azimuth_diff_cnt = ISM_FEC_MAX; - st_ivas->hIsmMetaData[ch]->last_elevation_idx = 0; - st_ivas->hIsmMetaData[ch]->elevation_diff_cnt = ISM_FEC_MAX - 1; -#endif st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0; ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); @@ -896,7 +592,6 @@ ivas_error ivas_ism_metadata_enc_create( } -#ifdef TD5 /*------------------------------------------------------------------------- * encode_radius() * @@ -1241,7 +936,6 @@ static void encode_angle_indices( return; } -#endif #ifdef DISCRETE_ISM_DTX_CNG @@ -1362,23 +1056,13 @@ void ivas_ism_metadata_sid_enc( /* update last indexes to correspond to active frames coding */ if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) { -#ifdef TD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); -#else - hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); - hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); -#endif } else { -#ifdef TD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); -#else - hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); - hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); -#endif } } } diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index a56f6423d3..598a618ee8 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1020,9 +1020,7 @@ typedef struct encoder_config_structure int16_t sba_order; /* Ambisonic (SBA) order */ int16_t sba_planar; /* Ambisonic (SBA) planar flag */ MC_LS_SETUP mc_input_setup; /* multichannel input ls setup */ -#ifdef TD5 int16_t ism_extended_metadata_flag; /* flag indicating extended metadata encoding, including radius and orientation (yaw, pitch) in ISM format */ -#endif int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 6f5af7c231..dfc467b7a9 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -366,12 +366,8 @@ ivas_error IVAS_ENC_ConfigureForObjects( const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ -#ifdef TD5 const uint16_t numObjects, /* i : number of objects to be encoded */ const bool ism_extended_metadata /* i : Extended metadata used (true/false), where extended metadata includes radius and orientation */ -#else - const uint16_t numObjects /* i : number of objects to be encoded */ -#endif ) { Encoder_Struct *st_ivas; @@ -394,9 +390,7 @@ ivas_error IVAS_ENC_ConfigureForObjects( #ifdef NCHAN_ISM_PARAMETER st_ivas->hEncoderConfig->nchan_ism = numObjects; #endif -#ifdef TD5 st_ivas->hEncoderConfig->ism_extended_metadata_flag = ism_extended_metadata; -#endif hIvasEnc->maxBandwidthUser = max_bwidth_user; error = configureEncoder( hIvasEnc, inputFs, bitrate, maxBandwidth, dtxConfig, IVAS_ENC_GetDefaultChannelAwareConfig() ); @@ -436,11 +430,7 @@ ivas_error IVAS_ENC_FeedObjectMetadata( return IVAS_ERR_INDEX_OUT_OF_BOUNDS; } -#ifdef TD5 error = ivas_set_ism_metadata( hIvasEnc->st_ivas->hIsmMetaData[ismIndex], metadata.azimuth, metadata.elevation, metadata.radius, metadata.yaw, metadata.pitch ); -#else - error = ivas_set_ism_metadata( hIvasEnc->st_ivas->hIsmMetaData[ismIndex], metadata.azimuth, metadata.elevation ); -#endif if ( error != IVAS_ERR_OK ) { @@ -2018,12 +2008,10 @@ static ivas_error sanitizeBitrateISM( return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 4 ISM specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } -#ifdef TD5 if ( hEncoderConfig->ivas_total_brate < ISM_EXTENDED_METADATA_BRATE && hEncoderConfig->ism_extended_metadata_flag == 1 ) { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for extended metadata format specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } -#endif return IVAS_ERR_OK; } @@ -2285,9 +2273,7 @@ static void init_encoder_config( #endif hEncoderConfig->sba_order = 0; hEncoderConfig->sba_planar = 0; -#ifdef TD5 hEncoderConfig->ism_extended_metadata_flag = 0; -#endif #ifdef DEBUGGING hEncoderConfig->stereo_mode_cmdl = 0; hEncoderConfig->force = -1; diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index 37fd4b4dee..349c41ebef 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -180,12 +180,8 @@ ivas_error IVAS_ENC_ConfigureForObjects( const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ -#ifdef TD5 const uint16_t numObjects, /* i : number of objects to be encoded */ const bool ism_extended_metadata /* i : Extended metadata used (true/false), where extended metadata includes radius and orientation */ -#else - const uint16_t numObjects /* i : number of objects to be encoded */ -#endif ); /*! r: error code */ diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 67f73fab30..b3add4dad3 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -48,9 +48,7 @@ *---------------------------------------------------------------------*/ static void TDREND_Clear_Update_flags( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd ); -#ifdef TD5 static void angles_to_vec( const float radius, const float azimuth, const float elevation, float *vec ); -#endif /*---------------------------------------------------------------------* * ivas_td_binaural_open_unwrap() @@ -64,9 +62,7 @@ ivas_error ivas_td_binaural_open_unwrap( const int16_t nchan_transport, /* i : Number of channels */ const IVAS_FORMAT ivas_format, /* i : IVAS format (ISM/MC) */ const AUDIO_CONFIG transport_config, /* i : Transport configuration */ -#ifdef TD5 const float *directivity, /* i : Directivity pattern (used for ISM) */ -#endif const IVAS_OUTPUT_SETUP hTransSetup, /* i : Loudspeaker layout */ BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, /* o : TD renderer handle */ int32_t *binaural_latency_ns /* i : Binauralization delay */ @@ -175,13 +171,7 @@ ivas_error ivas_td_binaural_open_unwrap( for ( nS = 0; nS < nchan_rend; nS++ ) { /* Set source positions according to loudspeaker layout */ -#ifdef TD5 angles_to_vec( 1.0f, ls_azimuth[nS], ls_elevation[nS], Pos ); -#else - Pos[0] = cosf( ls_elevation[nS] * PI_OVER_180 ) * cosf( ls_azimuth[nS] * PI_OVER_180 ); - Pos[1] = cosf( ls_elevation[nS] * PI_OVER_180 ) * sinf( ls_azimuth[nS] * PI_OVER_180 ); - Pos[2] = sinf( ls_elevation[nS] * PI_OVER_180 ); -#endif Dir[0] = 1.0f; Dir[1] = 0.0f; Dir[2] = 0.0f; @@ -197,11 +187,9 @@ ivas_error ivas_td_binaural_open_unwrap( TDREND_MIX_SRC_SetDirAtten( pBinRendTd, nS, DirAtten_p ); } } -#ifdef TD5 if ( ivas_format == ISM_FORMAT ) { DirAtten_p = pBinRendTd->DirAtten_p; -#ifdef TD5_FIX_INVALID_MEMORY_ACCESS if ( NULL == directivity ) { DirAtten_p->ConeInnerAngle = 360.0f; /* Front cone */ @@ -214,18 +202,12 @@ ivas_error ivas_td_binaural_open_unwrap( DirAtten_p->ConeOuterAngle = directivity[1]; DirAtten_p->ConeOuterGain = directivity[2]; } -#else - DirAtten_p->ConeInnerAngle = directivity[0]; - DirAtten_p->ConeOuterAngle = directivity[1]; - DirAtten_p->ConeOuterGain = directivity[2]; -#endif for ( nS = 0; nS < nchan_rend; nS++ ) { TDREND_MIX_SRC_SetDirAtten( pBinRendTd, nS, DirAtten_p ); } } -#endif *hBinRendererTd = pBinRendTd; *binaural_latency_ns = (int32_t) ( ( *hBinRendererTd )->HrFiltSet_p->latency_s * 1000000000.f ); @@ -276,9 +258,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ const int16_t Opt_Headrotation, /* i : Head rotation flag */ const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ -#ifdef TD5 const IVAS_POSITION *Pos, /* i : Listener position data per subframe */ -#endif float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ ) @@ -296,11 +276,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { /* Update the listener's location/orientation */ -#ifdef TD5 TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL, ( Pos != NULL ) ? &Pos[subframe_idx] : NULL ); -#else - TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL ); -#endif if ( hReverb != NULL && hReverb->pConfig.roomAcoustics.late_reverb_on ) { @@ -457,18 +433,8 @@ void TDREND_Update_object_positions( /* Update the source positions */ /* Source position and direction */ -#ifdef TD5 angles_to_vec( hIsmMetaData[nS]->radius, hIsmMetaData[nS]->azimuth, hIsmMetaData[nS]->elevation, Pos ); angles_to_vec( 1.0f, hIsmMetaData[nS]->yaw, hIsmMetaData[nS]->pitch, Dir ); -#else - Pos[0] = cosf( hIsmMetaData[nS]->elevation * PI_OVER_180 ) * cosf( hIsmMetaData[nS]->azimuth * PI_OVER_180 ); - Pos[1] = cosf( hIsmMetaData[nS]->elevation * PI_OVER_180 ) * sinf( hIsmMetaData[nS]->azimuth * PI_OVER_180 ); - Pos[2] = sinf( hIsmMetaData[nS]->elevation * PI_OVER_180 ); - Dir[0] = 1.0f; - Dir[1] = 0.0f; - Dir[2] = 0.0f; - -#endif /* Source directivity info */ DirAtten_p->ConeInnerAngle = 360.0f; DirAtten_p->ConeOuterAngle = 360.0f; @@ -495,29 +461,14 @@ void TDREND_Update_object_positions( void TDREND_Update_listener_orientation( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const int16_t headRotEnabled, /* i : Headrotation flag */ -#ifdef TD5 const IVAS_QUATERNION *headPosition, /* i : Listener orientation */ const IVAS_POSITION *Pos /* i : Listener Position */ -#else - const IVAS_QUATERNION *headPosition /* i : Head Position */ -#endif ) { -#ifndef TD5 - float Pos[3]; -#endif float FrontVec[3]; float UpVec[3]; float Rmat[3][3]; -#ifdef TD5 float Pos_p[3]; -#else - /* Update the listener's location/orientation */ - /* Listener at the origin */ - Pos[0] = 0.0f; - Pos[1] = 0.0f; - Pos[2] = 0.0f; -#endif if ( headRotEnabled ) { @@ -531,12 +482,10 @@ void TDREND_Update_listener_orientation( UpVec[0] = Rmat[2][0]; UpVec[1] = Rmat[2][1]; UpVec[2] = Rmat[2][2]; -#ifdef TD5 /* Input position */ Pos_p[0] = ( *Pos ).x; Pos_p[1] = ( *Pos ).y; Pos_p[2] = ( *Pos ).z; -#endif } else { @@ -548,20 +497,14 @@ void TDREND_Update_listener_orientation( UpVec[0] = 0.0f; UpVec[1] = 0.0f; UpVec[2] = 1.0f; -#ifdef TD5 /* Listener at the origin */ Pos_p[0] = 0.0f; Pos_p[1] = 0.0f; Pos_p[2] = 0.0f; -#endif } /* Set the listener position and orientation:*/ -#ifdef TD5 TDREND_MIX_LIST_SetPos( hBinRendererTd, Pos_p ); -#else - TDREND_MIX_LIST_SetPos( hBinRendererTd, Pos ); -#endif TDREND_MIX_LIST_SetOrient( hBinRendererTd, FrontVec, UpVec ); return; @@ -577,9 +520,7 @@ void TDREND_Update_listener_orientation( ivas_error ivas_td_binaural_open_ext( TDREND_WRAPPER *pTDRend, IVAS_REND_AudioConfig inConfig, -#ifdef TD5 RENDER_CONFIG_DATA *hRendCfg, /* i : Renderer configuration */ -#endif LSSETUP_CUSTOM_STRUCT *customLsInput, const int32_t outFs ) { @@ -588,9 +529,7 @@ ivas_error ivas_td_binaural_open_ext( IVAS_FORMAT ivas_format; IVAS_OUTPUT_SETUP hTransSetup; ivas_error error; -#ifdef TD5_FIX_INVALID_MEMORY_ACCESS float *directivity = NULL; -#endif if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { @@ -609,20 +548,12 @@ ivas_error ivas_td_binaural_open_ext( hTransSetup.ls_azimuth = customLsInput->ls_azimuth; hTransSetup.ls_elevation = customLsInput->ls_elevation; -#ifdef TD5 -#ifdef TD5_FIX_INVALID_MEMORY_ACCESS if ( NULL != hRendCfg ) { directivity = hRendCfg->directivity; } return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, directivity, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); -#else - return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, hRendCfg->directivity, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); -#endif -#else - return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); -#endif } @@ -684,20 +615,14 @@ ivas_error ivas_td_binaural_renderer_ext( hIsmMetaData[0] = &hIsmMetaDataFrame; hIsmMetaData[0]->azimuth = currentPos->azimuth; hIsmMetaData[0]->elevation = currentPos->elevation; -#ifdef TD5 hIsmMetaData[0]->yaw = currentPos->yaw; hIsmMetaData[0]->pitch = currentPos->pitch; hIsmMetaData[0]->radius = currentPos->radius; -#endif } if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, -#ifdef TD5 ( headRotData != NULL ) ? headRotData->Pos : NULL, output, output_frame ) ) != IVAS_ERR_OK ) -#else - output, output_frame ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -707,7 +632,6 @@ ivas_error ivas_td_binaural_renderer_ext( return IVAS_ERR_OK; } -#ifdef TD5 /*---------------------------------------------------------------------* * angles_to_vec() * @@ -727,4 +651,3 @@ static void angles_to_vec( return; } -#endif diff --git a/lib_rend/ivas_objectRenderer_hrFilt.c b/lib_rend/ivas_objectRenderer_hrFilt.c index d28abdba30..91b018b148 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt.c +++ b/lib_rend/ivas_objectRenderer_hrFilt.c @@ -69,20 +69,13 @@ ivas_error TDREND_REND_RenderSourceHRFilt( { float LeftOutputFrame[L_SPATIAL_SUBFR_48k]; float RightOutputFrame[L_SPATIAL_SUBFR_48k]; -#ifdef TD5 float Gain; Gain = ( *Src_p->SrcRend_p->DirGain_p ) * ( *Src_p->SrcRend_p->DistGain_p ); -#endif TDREND_Apply_ITD( Src_p->InputFrame_p, LeftOutputFrame, RightOutputFrame, &Src_p->previtd, Src_p->itd, Src_p->mem_itd, subframe_length ); -#ifdef TD5 TDREND_firfilt( LeftOutputFrame, Src_p->hrf_left_prev, hrf_left_delta, intp_count, Src_p->mem_hrf_left, subframe_length, Src_p->filterlength, Gain ); TDREND_firfilt( RightOutputFrame, Src_p->hrf_right_prev, hrf_right_delta, intp_count, Src_p->mem_hrf_right, subframe_length, Src_p->filterlength, Gain ); -#else - TDREND_firfilt( LeftOutputFrame, Src_p->hrf_left_prev, hrf_left_delta, intp_count, Src_p->mem_hrf_left, subframe_length, Src_p->filterlength ); - TDREND_firfilt( RightOutputFrame, Src_p->hrf_right_prev, hrf_right_delta, intp_count, Src_p->mem_hrf_right, subframe_length, Src_p->filterlength ); -#endif /* Copy to accumulative output frame */ v_add( LeftOutputFrame, output_buf[0], output_buf[0], subframe_length ); diff --git a/lib_rend/ivas_objectRenderer_sfx.c b/lib_rend/ivas_objectRenderer_sfx.c index 72493b0501..c6645f783a 100644 --- a/lib_rend/ivas_objectRenderer_sfx.c +++ b/lib_rend/ivas_objectRenderer_sfx.c @@ -235,12 +235,8 @@ void TDREND_firfilt( const int16_t intp_count, /* i : interpolation count */ float *mem, /* i/o: filter memory */ const int16_t subframe_length, /* i : Length of signal */ -#ifdef TD5 const int16_t filterlength, /* i : Filter length */ const float Gain /* i : Gain */ -#else - const int16_t filterlength /* i : Filter length */ -#endif ) { float buffer[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 + L_SUBFRAME5MS_48k]; @@ -266,11 +262,7 @@ void TDREND_firfilt( { tmp += ( *p_filter++ ) * ( *p_tmp-- ); } -#ifdef TD5 signal[i] = tmp * Gain; -#else - signal[i] = tmp; -#endif if ( i < intp_count ) { diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 2a13efc24c..4449945711 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -266,9 +266,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( TDREND_MIX_Listener_t *Listener_p; TDREND_HRFILT_FiltSet_t *HrFiltSet_p; float ListRelPos[3], ListRelDist; -#ifdef TD5 float ListRelPosAbs[3]; /* Relative position, ignoring orientation of listener */ -#endif float Azim, Elev; float hrf_left[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; float hrf_right[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; @@ -290,22 +288,14 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( break; case TDREND_POSTYPE_ABSOLUTE: /* Absolute position */ -#ifdef TD5 TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos, ListRelPosAbs ); -#else - TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos ); -#endif break; default: /* Illegal position type */ #ifdef DEBUGGING printf( "Warning! TDREND_SRC_REND_UpdateFiltersFromSpatialParams: Invalid position type. Assuming absolute position!\n" ); #endif /* Assume absolute position */ -#ifdef TD5 TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos, ListRelPosAbs ); -#else - TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos ); -#endif break; } @@ -331,11 +321,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( *SrcRend_p->DirGain_p = 1.0f; if ( SrcSpatial_p->DirAttenEnabled ) { -#ifdef TD5 *SrcRend_p->DirGain_p = TDREND_SRC_SPATIAL_GetDirGain( &SrcSpatial_p->DirAtten, SrcSpatial_p->Front_p, ListRelPosAbs ); -#else - *SrcRend_p->DirGain_p = TDREND_SRC_SPATIAL_GetDirGain( &SrcSpatial_p->DirAtten, SrcSpatial_p->Front_p, ListRelPos ); -#endif } /* Distance gain */ diff --git a/lib_rend/ivas_objectRenderer_vec.c b/lib_rend/ivas_objectRenderer_vec.c index f17d769821..0b04e4b877 100644 --- a/lib_rend/ivas_objectRenderer_vec.c +++ b/lib_rend/ivas_objectRenderer_vec.c @@ -111,33 +111,16 @@ void TDREND_SPATIAL_VecMapToNewCoordSystem( const float *DirVec_p, /* i : Direction vector */ const float *UpVec_p, /* i : Up vector */ const float *RightVec_p, /* i : Right vector */ -#ifdef TD5 float *MappedVec_p, /* o : Transformed vector */ float *LisRelPosAbs /* o : Transformed vector ignoring orientation */ -#else - float *MappedVec_p /* o : Transformed vector */ -#endif ) { -#ifdef TD5 v_sub( Vec_p, TranslVec_p, LisRelPosAbs, 3 ); /* Evalute the relative Vec in the coordinates of the Orientation vectors, */ /* which form an orthonormal basis */ MappedVec_p[0] = dotp( LisRelPosAbs, DirVec_p, 3 ); MappedVec_p[1] = dotp( LisRelPosAbs, RightVec_p, 3 ); MappedVec_p[2] = dotp( LisRelPosAbs, UpVec_p, 3 ); -#else - float RelVec[3]; - - /* Evaluate Vec relative to the new origin given by TranslVec */ - v_sub( Vec_p, TranslVec_p, RelVec, 3 ); - - /* Evalute the relative Vec in the coordinates of the Orientation vectors, */ - /* which form an orthonormal basis */ - MappedVec_p[0] = dotp( RelVec, DirVec_p, 3 ); - MappedVec_p[1] = dotp( RelVec, RightVec_p, 3 ); - MappedVec_p[2] = dotp( RelVec, UpVec_p, 3 ); -#endif return; } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index d16f231564..7fe8392ba9 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -221,9 +221,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ const int16_t Opt_Headrotation, /* i : Head rotation flag */ const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ -#ifdef TD5 const IVAS_POSITION *Pos, /* i : Listener position data per subframe */ -#endif float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ ); @@ -245,9 +243,7 @@ ivas_error ivas_td_binaural_open_unwrap( const int16_t nchan_transport, /* i : Number of channels */ const IVAS_FORMAT ivas_format, /* i : IVAS format (ISM/MC) */ const AUDIO_CONFIG transport_config, /* i : Transport configuration */ -#ifdef TD5 const float *directivity, /* i : Directivity pattern (used for ISM) */ -#endif const IVAS_OUTPUT_SETUP hTransSetup, /* i : Loudspeaker layout */ BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, /* o : TD renderer handle */ int32_t *binaural_latency_ns /* i : Binauralization delay */ @@ -256,9 +252,7 @@ ivas_error ivas_td_binaural_open_unwrap( ivas_error ivas_td_binaural_open_ext( TDREND_WRAPPER *pTDRend, const IVAS_REND_AudioConfig inConfig, -#ifdef TD5 RENDER_CONFIG_DATA *hRendCfg, /* i : Renderer configuration */ -#endif LSSETUP_CUSTOM_STRUCT *customLsInput, const int32_t output_Fs ); @@ -278,12 +272,8 @@ ivas_error TDREND_GetMix( void TDREND_Update_listener_orientation( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const int16_t headRotEnabled, /* i : Headrotation flag */ -#ifdef TD5 const IVAS_QUATERNION *headPosition, /* i : Listener orientation */ const IVAS_POSITION *Pos /* i : Listener Position */ -#else - const IVAS_QUATERNION *headPosition /* i : Head Position */ -#endif ); void TDREND_Update_object_positions( @@ -404,12 +394,8 @@ void TDREND_SPATIAL_VecMapToNewCoordSystem( const float *DirVec_p, /* i : Direction vector */ const float *UpVec_p, /* i : Up vector */ const float *RightVec_p, /* i : Right vector */ -#ifdef TD5 float *MappedVec_p, /* o : Transformed vector */ float *LisRelPosAbs /* o : Transformed vector ignoring orientation */ -#else - float *MappedVec_p /* o : Transformed vector */ -#endif ); /*! r: Flag if the orientation has been updated */ @@ -475,12 +461,8 @@ void TDREND_firfilt( const int16_t intp_count, /* i : interpolation count */ float *mem, /* i/o: filter memory */ const int16_t subframe_length, /* i : Length of signal */ -#ifdef TD5 const int16_t filterlength, /* i : Filter length */ const float Gain /* i : Gain */ -#else - const int16_t filterlength /* i : Filter length */ -#endif ); diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index 2fdbeff0eb..efd866ccec 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -126,11 +126,9 @@ ivas_error ivas_render_config_init_from_rom( mvr2r( ivas_reverb_default_RT60, ( *hRenderConfig )->roomAcoustics.pAcoustic_rt60, IVAS_REVERB_DEFAULT_N_BANDS ); mvr2r( ivas_reverb_default_DSR, ( *hRenderConfig )->roomAcoustics.pAcoustic_dsr, IVAS_REVERB_DEFAULT_N_BANDS ); -#ifdef TD5 ( *hRenderConfig )->directivity[0] = 360.0f; /* Front cone */ ( *hRenderConfig )->directivity[1] = 360.0f; /* Back cone */ ( *hRenderConfig )->directivity[2] = 1.0f; /* Back attenuation */ -#endif return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index c0f12ef209..226b9fcd32 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -247,9 +247,7 @@ typedef struct { int8_t headRotEnabled; IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; -#ifdef TD5 IVAS_POSITION Pos[RENDERER_HEAD_POSITIONS_PER_FRAME]; -#endif float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; ivas_orient_trk_state_t *hOrientationTracker; @@ -259,9 +257,7 @@ typedef struct ivas_binaural_head_track_struct { int16_t num_quaternions; IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; -#ifdef TD5 IVAS_POSITION Pos[MAX_PARAM_SPATIAL_SUBFRAMES]; -#endif float Rmat[3][3]; float Rmat_prev[3][3]; @@ -300,9 +296,7 @@ typedef struct ivas_render_config_t ivas_renderTypeOverride renderer_type_override; #endif ivas_roomAcoustics_t roomAcoustics; -#ifdef TD5 float directivity[3]; -#endif } RENDER_CONFIG_DATA, *RENDER_CONFIG_HANDLE; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 4e6ec67da7..50f5a83581 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1007,11 +1007,9 @@ static IVAS_REND_AudioObjectPosition defaultObjectPosition( pos.azimuth = 0.0f; pos.elevation = 0.0f; -#ifdef TD5 pos.radius = 1.0f; pos.yaw = 0.0f; pos.pitch = 0.0f; -#endif return pos; } @@ -1104,11 +1102,7 @@ static ivas_error setRendInputActiveIsm( error = IVAS_ERR_OK; if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL ) { -#ifdef TD5 if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1117,11 +1111,7 @@ static ivas_error setRendInputActiveIsm( { if ( hRendCfg != NULL && hRendCfg->roomAcoustics.use_brir == 0 && hRendCfg->roomAcoustics.late_reverb_on ) { -#ifdef TD5 if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1826,11 +1816,7 @@ static ivas_error initMcBinauralRendering( // if ( initTDRend ) { -#ifdef TD5 if ( ( error = ivas_td_binaural_open_ext( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_td_binaural_open_ext( &inputMc->tdRendWrapper, inConfig, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -3765,9 +3751,7 @@ int16_t IVAS_REND_FeedRenderConfig( } hRenderConfig = hIvasRend->hRendererConfig; -#ifdef TD5 mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 ); -#endif #ifdef DEBUGGING hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) @@ -3801,12 +3785,8 @@ int16_t IVAS_REND_FeedRenderConfig( ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ -#ifdef TD5 const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME], /* i : head orientations for next rendering call */ const IVAS_POSITION Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ -#else - const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : head positions for next rendering call */ -#endif ) { int16_t i; @@ -3844,9 +3824,7 @@ ivas_error IVAS_REND_SetHeadRotation( } ivas_orient_trk_Process( hIvasRend->headRotData.hOrientationTracker, rotQuat, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hIvasRend->headRotData.headPositions[i] ); -#ifdef TD5 hIvasRend->headRotData.Pos[i] = Pos[i]; -#endif } } diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 3bd575adc2..b1f7361fec 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -244,12 +244,8 @@ int16_t IVAS_REND_FeedRenderConfig( ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ -#ifdef TD5 const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME], /* i : head orientations for next rendering call */ const IVAS_POSITION Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ -#else - const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : head positions for next rendering call */ -#endif ); ivas_error IVAS_REND_SetOrientationTrackingMode( diff --git a/lib_util/head_rotation_file_reader.c b/lib_util/head_rotation_file_reader.c index b8f81d318d..fcc822cb76 100644 --- a/lib_util/head_rotation_file_reader.c +++ b/lib_util/head_rotation_file_reader.c @@ -93,40 +93,26 @@ ivas_error HeadRotationFileReader_open( ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ -#ifdef TD5 IVAS_QUATERNION *pQuaternion, /* o : head-tracking data */ IVAS_POSITION *pPos /* o : listener position */ -#else - IVAS_QUATERNION *pQuaternion /* o : head-tracking data */ -#endif ) { float w, x, y, z; -#ifdef TD5 float posx, posy, posz; int32_t read_values; posx = 0.0f; posy = 0.0f; posz = 0.0f; -#endif -#ifdef TD5 read_values = fscanf( headRotReader->trajFile, "%f,%f,%f,%f,%f,%f,%f", &w, &x, &y, &z, &posx, &posy, &posz ); if ( ( read_values != 4 ) && ( read_values != 7 ) ) /* Allow either orientation (4) or orientation+position (4+3) */ -#else - if ( 4 != fscanf( headRotReader->trajFile, "%f,%f,%f,%f", &w, &x, &y, &z ) ) -#endif { if ( feof( headRotReader->trajFile ) ) { rewind( headRotReader->trajFile ); headRotReader->fileRewind = true; -#ifdef TD5 return HeadRotationFileReading( headRotReader, pQuaternion, pPos ); -#else - return HeadRotationFileReading( headRotReader, pQuaternion ); -#endif } return IVAS_ERR_FAILED_FILE_PARSE; } @@ -137,14 +123,12 @@ ivas_error HeadRotationFileReading( pQuaternion->x = x; pQuaternion->y = y; pQuaternion->z = z; -#ifdef TD5 if ( pPos != NULL ) { pPos->x = posx; pPos->y = posy; pPos->z = posz; } -#endif return IVAS_ERR_OK; } diff --git a/lib_util/head_rotation_file_reader.h b/lib_util/head_rotation_file_reader.h index a4b87c6750..ac4117180b 100644 --- a/lib_util/head_rotation_file_reader.h +++ b/lib_util/head_rotation_file_reader.h @@ -59,12 +59,8 @@ ivas_error HeadRotationFileReader_open( ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ -#ifdef TD5 IVAS_QUATERNION *pQuaternion, /* o : head-tracking data */ IVAS_POSITION *pPos /* o : listener position */ -#else - IVAS_QUATERNION *pQuaternion /* o : head-tracking data */ -#endif ); /*-----------------------------------------------------------------------* diff --git a/lib_util/ism_file_reader.c b/lib_util/ism_file_reader.c index d60a7c1984..702c90c0f6 100644 --- a/lib_util/ism_file_reader.c +++ b/lib_util/ism_file_reader.c @@ -37,12 +37,8 @@ #define META_LINE_LENGTH 200 /* max number of characters at one line of metadata input/output file */ -#ifdef TD5 #define NUM_ISM_METADATA_PER_LINE 7 /* Number of ISM metadata per line in a metadata file */ #define NUM_MIN_ISM_METADATA 2 /* Minimum number of metadata parameters (azimuth and elevation) */ -#else -#define NUM_ISM_METADATA_PER_LINE 5 /* Number of ISM metadata per line in a metadata file */ -#endif struct IsmFileReader @@ -100,20 +96,16 @@ ivas_error IsmFileReader_readNextFrame( { char char_buff[META_LINE_LENGTH]; float meta_prm[NUM_ISM_METADATA_PER_LINE]; -#ifdef TD5 const float meta_prm_default[NUM_ISM_METADATA_PER_LINE] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f }; -#endif char *char_ptr; int16_t i; FILE *file; -#ifdef TD5 /* Set default metadata parameters */ for ( i = 0; i < NUM_ISM_METADATA_PER_LINE; i++ ) { meta_prm[i] = meta_prm_default[i]; } -#endif if ( ismMetadata == NULL || self->file == NULL ) { @@ -143,34 +135,21 @@ ivas_error IsmFileReader_readNextFrame( meta_prm[i++] = (float) atof( char_ptr ); } -#ifdef TD5 /* Check if minimum number of metadata values were read. Additional values are ignored. */ if ( i < NUM_MIN_ISM_METADATA ) -#else - if ( i != NUM_ISM_METADATA_PER_LINE ) -#endif { /* Not enough values provided in one line */ return IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT; } -#ifndef TD5 - if ( char_ptr != NULL ) - { - /* Too many values provided in one line */ - return IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT; - } -#endif ismMetadata->azimuth = meta_prm[0]; ismMetadata->elevation = meta_prm[1]; ismMetadata->radius = meta_prm[2]; ismMetadata->spread = meta_prm[3]; ismMetadata->gainFactor = meta_prm[4]; -#ifdef TD5 ismMetadata->yaw = meta_prm[5]; ismMetadata->pitch = meta_prm[6]; -#endif /* verify whether the read metadata values are in an expected range */ if ( ismMetadata->azimuth > 180 || ismMetadata->azimuth < -180 ) @@ -197,7 +176,6 @@ ivas_error IsmFileReader_readNextFrame( { return IVAS_ERR_ISM_INVALID_METADATA_VALUE; } -#ifdef TD5 if ( ismMetadata->yaw > 180 || ismMetadata->yaw < -180 ) { return IVAS_ERR_ISM_INVALID_METADATA_VALUE; @@ -207,7 +185,6 @@ ivas_error IsmFileReader_readNextFrame( { return IVAS_ERR_ISM_INVALID_METADATA_VALUE; } -#endif return IVAS_ERR_OK; } diff --git a/lib_util/ism_file_writer.c b/lib_util/ism_file_writer.c index 870cf33586..b29386282b 100644 --- a/lib_util/ism_file_writer.c +++ b/lib_util/ism_file_writer.c @@ -36,9 +36,6 @@ #define META_LINE_LENGTH 200 /* max number of characters at one line of metadata input/output file */ -#ifndef TD5 -#define NUM_ISM_METADATA_PER_LINE 5 /* Number of ISM metadata per line in a metadata file */ -#endif struct IsmFileWriter @@ -118,17 +115,9 @@ ivas_error IsmFileWriter_writeFrame( /* IVAS_fmToDo: work in progress; currently position_azimuth, position_elevation, position_radius, spread, gain_factor */ #ifdef FIX_293_EXT_RENDERER_CLI -#ifdef TD5 sprintf( char_buff, "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f,%+07.2f,%+06.2f\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor, ismMetadata.yaw, ismMetadata.pitch ); -#else - sprintf( char_buff, "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor ); -#endif #endif -#ifdef TD5 snprintf( char_buff, sizeof( char_buff ), "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f,%+07.2f,%+06.2f\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor, ismMetadata.yaw, ismMetadata.pitch ); -#else - snprintf( char_buff, sizeof( char_buff ), "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor ); -#endif if ( file ) { diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 907d148a6e..54f2d012ce 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -522,7 +522,6 @@ ivas_error RenderConfigReader_read( errorHandler( pValue, ERROR_VALUE_INVALID ); } } -#ifdef TD5 else if ( strcmp( item, "DIRECTIVITY" ) == 0 ) { if ( read_vector( pValue, 3, hRenderConfig->directivity ) ) @@ -530,7 +529,6 @@ ivas_error RenderConfigReader_read( errorHandler( item, ERROR_VALUE_INVALID ); } } -#endif #ifdef DEBUGGING else { -- GitLab From 1cbc09dbf400833ac709e3ab9213134af751772c Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 29 Mar 2023 21:39:26 +0200 Subject: [PATCH 331/375] [cleanup] accept FIX_371_DELAY_REPORT --- apps/decoder.c | 23 ----------------------- lib_com/options.h | 1 - 2 files changed, 24 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 7eb003fbe4..9560751228 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1246,7 +1246,6 @@ static ivas_error initOnFirstGoodFrame( ivas_error error = IVAS_ERR_UNKNOWN; /* Now delay, number of output channels and frame size are known */ -#ifdef FIX_371_DELAY_REPORT if ( ( error = IVAS_DEC_GetDelay( hIvasDec, pFullDelayNumSamples, delayTimeScale ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); @@ -1257,20 +1256,6 @@ static ivas_error initOnFirstGoodFrame( { pFullDelayNumSamples[0] = 0; } -#else - if ( arg.delayCompensationEnabled ) - { - if ( ( error = IVAS_DEC_GetDelay( hIvasDec, pFullDelayNumSamples, delayTimeScale ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); - return error; - } - } - else - { - pFullDelayNumSamples[0] = 0; - } -#endif *pRemainingDelayNumSamples = pFullDelayNumSamples[0]; if ( ( error = IVAS_DEC_GetNumOutputChannels( hIvasDec, pNumOutChannels ) ) != IVAS_ERR_OK ) @@ -1723,11 +1708,7 @@ static ivas_error decodeG192( if ( delayNumSamples_orig[2] > 0 ) { printf( "HRIR/BRIR delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[2] / (float) delayTimeScale, delayNumSamples_orig[2], delayTimeScale ); -#ifdef FIX_371_DELAY_REPORT printf( "Total delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * ( delayNumSamples_orig[1] + delayNumSamples_orig[2] ) / (float) delayTimeScale, delayNumSamples_orig[1] + delayNumSamples_orig[2], delayTimeScale ); -#else - printf( "Total delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[0] / (float) delayTimeScale, delayNumSamples_orig[0], delayTimeScale ); -#endif } } @@ -2209,11 +2190,7 @@ static ivas_error decodeVoIP( if ( delayNumSamples_orig[2] > 0 ) { printf( "HRIR/BRIR delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[2] / (float) delayTimeScale, delayNumSamples_orig[2], delayTimeScale ); -#ifdef FIX_371_DELAY_REPORT printf( "Total delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * ( delayNumSamples_orig[1] + delayNumSamples_orig[2] ) / (float) delayTimeScale, delayNumSamples_orig[1] + delayNumSamples_orig[2], delayTimeScale ); -#else - printf( "Total delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[0] / (float) delayTimeScale, delayNumSamples_orig[0], delayTimeScale ); -#endif } } diff --git a/lib_com/options.h b/lib_com/options.h index ea487c3f23..a90cf9d56c 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -144,7 +144,6 @@ /*#define SBA_HPF_TUNING_DEC*/ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ -#define FIX_371_DELAY_REPORT /* Issue 371: div. by zero with -no_delay_cmp */ #define FIX_373_MASA_DELAY_COMP_MSAN /* Nokia: Issue 373: MASA audio/meta delay compensation. MSAN bugfix */ #define OTR_REFERENCE_VECTOR_TRACKING /* FhG: enables the reference position orientation tracking mode */ -- GitLab From 3fb4027d8aebd59ed772ec9b6240245fde2d106a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 29 Mar 2023 21:46:13 +0200 Subject: [PATCH 332/375] [cleanup] merge FIX_373_MASA_DELAY_COMP_MSAN into FIX_373_MASA_DELAY_COMP --- lib_com/ivas_cnst.h | 2 -- lib_com/ivas_masa_com.c | 4 ++-- lib_com/ivas_prot.h | 2 +- lib_com/options.h | 1 - lib_dec/ivas_masa_dec.c | 2 +- lib_enc/ivas_masa_enc.c | 2 +- lib_util/masa_file_writer.c | 2 -- 7 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 7f434feccd..76b19f5fc1 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -956,10 +956,8 @@ typedef enum #ifdef FIX_350_MASA_DELAY_COMP #define DELAY_MASA_PARAM_DEC_SFR 2 /* Delay to be compensation for MASA parameters in the decoder (subframes) */ -#ifdef FIX_373_MASA_DELAY_COMP_MSAN #define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 ) /* Spherical index corresponding to front direction for setting as default value */ #endif -#endif #define DIRAC_SLOT_NS 1250000L /* time duration of a time slot, 1.25ms (==DELAY_RENERER_NS/MAX_PARAM_SPATIAL_SUBFRAMES) */ #define DIRAC_SLOT_ENC_NS 5000000L diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index bd0336ad43..5bfbd00939 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -314,7 +314,7 @@ void masa_sample_rate_band_correction( int16_t *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ const int32_t sampling_rate /* i : Sampling rate */ -#ifdef FIX_373_MASA_DELAY_COMP_MSAN +#ifdef FIX_373_MASA_DELAY_COMP , MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ #endif @@ -390,7 +390,7 @@ void masa_sample_rate_band_correction( hQMetaData->twoDirBands[band] = 0; } } -#ifdef FIX_373_MASA_DELAY_COMP_MSAN +#ifdef FIX_373_MASA_DELAY_COMP if ( hExtOutMeta != NULL ) { /* in decoder, zero the EXT out MASA meta buffer */ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index f4adee3cb1..c51321d667 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4619,7 +4619,7 @@ void masa_sample_rate_band_correction( int16_t *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ const int32_t sampling_rate /* i : sampling rate */ -#ifdef FIX_373_MASA_DELAY_COMP_MSAN +#ifdef FIX_373_MASA_DELAY_COMP , MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ #endif ); diff --git a/lib_com/options.h b/lib_com/options.h index a90cf9d56c..84bde4b7e7 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -144,7 +144,6 @@ /*#define SBA_HPF_TUNING_DEC*/ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ -#define FIX_373_MASA_DELAY_COMP_MSAN /* Nokia: Issue 373: MASA audio/meta delay compensation. MSAN bugfix */ #define OTR_REFERENCE_VECTOR_TRACKING /* FhG: enables the reference position orientation tracking mode */ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 5b0223a9be..9e2540e968 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -501,7 +501,7 @@ static ivas_error ivas_masa_dec_config( ivas_set_qmetadata_maxbit_req( st_ivas->hQMetaData, st_ivas->ivas_format ); -#ifdef FIX_373_MASA_DELAY_COMP_MSAN +#ifdef FIX_373_MASA_DELAY_COMP if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { /* need to apply the sampling rate correction also for the EXT output MASA meta buffer */ diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 337753925c..3655c1994a 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -595,7 +595,7 @@ ivas_error ivas_masa_enc_config( ivas_set_qmetadata_maxbit_req( hQMetaData, ivas_format ); -#ifdef FIX_373_MASA_DELAY_COMP_MSAN +#ifdef FIX_373_MASA_DELAY_COMP masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, st_ivas->hEncoderConfig->input_Fs, NULL ); #else masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, st_ivas->hEncoderConfig->input_Fs ); diff --git a/lib_util/masa_file_writer.c b/lib_util/masa_file_writer.c index 74429f9185..5667968ece 100644 --- a/lib_util/masa_file_writer.c +++ b/lib_util/masa_file_writer.c @@ -67,10 +67,8 @@ struct MasaFileWriter *-----------------------------------------------------------------------*/ #ifndef FIX_350_MASA_DELAY_COMP -#ifndef FIX_373_MASA_DELAY_COMP_MSAN #define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 ) /* Spherical index corresponding to front direction for setting as default value */ #endif -#endif /*-----------------------------------------------------------------------* * Local functions -- GitLab From ae6f33c731c7e19c8146596fdbc3392be1fb740a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 29 Mar 2023 21:48:14 +0200 Subject: [PATCH 333/375] [cleanup] accept OTR_REFERENCE_VECTOR_TRACKING --- apps/decoder.c | 32 ----------------------------- apps/renderer.c | 28 ------------------------- lib_com/common_api_types.h | 2 -- lib_com/ivas_cnst.h | 4 ---- lib_com/options.h | 1 - lib_dec/ivas_init_dec.c | 2 -- lib_dec/lib_dec.c | 2 -- lib_dec/lib_dec.h | 2 -- lib_rend/ivas_orient_trk.c | 10 --------- lib_rend/ivas_prot_rend.h | 2 -- lib_rend/lib_rend.c | 4 ---- lib_rend/lib_rend.h | 2 -- lib_util/vector3_pair_file_reader.c | 2 -- lib_util/vector3_pair_file_reader.h | 2 -- 14 files changed, 95 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 9560751228..43e8750c7a 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -42,9 +42,7 @@ #include "ls_custom_file_reader.h" #include "hrtf_file_reader.h" #include "head_rotation_file_reader.h" -#ifdef OTR_REFERENCE_VECTOR_TRACKING #include "vector3_pair_file_reader.h" -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #include "jbm_file_writer.h" #include "evs_rtp_payload.h" #ifdef DEBUGGING @@ -75,10 +73,8 @@ static #define IVAS_PUBLIC_ORIENT_TRK_NONE ( 0 ) #define IVAS_PUBLIC_ORIENT_TRK_REF ( 1 ) #define IVAS_PUBLIC_ORIENT_TRK_AVG ( 2 ) -#ifdef OTR_REFERENCE_VECTOR_TRACKING #define IVAS_PUBLIC_ORIENT_TRK_REF_VEC ( 3 ) #define IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV ( 4 ) -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ typedef struct { @@ -94,10 +90,8 @@ typedef struct char *headrotTrajFileName; bool enableReferenceRotation; char *refrotTrajFileName; -#ifdef OTR_REFERENCE_VECTOR_TRACKING bool enableReferenceVectorTracking; char *referenceVectorTrajFileName; -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #ifdef SUPPORT_JBM_TRACEFILE char *jbmTraceFilename; #endif @@ -133,11 +127,7 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); -#ifdef OTR_REFERENCE_VECTOR_TRACKING static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, HeadRotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); -#else /* OTR_REFERENCE_VECTOR_TRACKING */ -static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, HeadRotFileReader *refRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); -#endif static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); #ifdef DEBUGGING static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); @@ -164,9 +154,7 @@ int main( hrtfFileReader *hrtfReader = NULL; HeadRotFileReader *headRotReader = NULL; HeadRotFileReader *refRotReader = NULL; -#ifdef OTR_REFERENCE_VECTOR_TRACKING Vector3PairFileReader *referenceVectorReader = NULL; -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ ivas_error error = IVAS_ERR_UNKNOWN; int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; RenderConfigReader *renderConfigReader = NULL; @@ -287,7 +275,6 @@ int main( goto cleanup; } } -#ifdef OTR_REFERENCE_VECTOR_TRACKING /*------------------------------------------------------------------------------------------* * Open reference vector trajectory file *------------------------------------------------------------------------------------------*/ @@ -299,7 +286,6 @@ int main( goto cleanup; } } -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ /*------------------------------------------------------------------------------------------* * Open custom loudspeaker layout file @@ -549,11 +535,7 @@ int main( } else { -#ifdef OTR_REFERENCE_VECTOR_TRACKING error = decodeG192( arg, hBsReader, headRotReader, refRotReader, referenceVectorReader, hIvasDec, pcmBuf ); -#else - error = decodeG192( arg, hBsReader, headRotReader, refRotReader, hIvasDec, pcmBuf ); -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ } if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE ) @@ -610,9 +592,7 @@ cleanup: hrtfFileReader_close( &hrtfReader ); HeadRotationFileReader_close( &headRotReader ); HeadRotationFileReader_close( &refRotReader ); -#ifdef OTR_REFERENCE_VECTOR_TRACKING Vector3PairFileReader_close( &referenceVectorReader ); -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ RenderConfigReader_close( &renderConfigReader ); if ( BS_Reader_Close( &hBsReader ) != IVAS_ERR_OK ) @@ -752,10 +732,8 @@ static bool parseCmdlIVAS_dec( arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; arg->enableReferenceRotation = false; arg->headrotTrajFileName = NULL; -#ifdef OTR_REFERENCE_VECTOR_TRACKING arg->enableReferenceVectorTracking = false; arg->referenceVectorTrajFileName = NULL; -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #ifdef SUPPORT_JBM_TRACEFILE arg->jbmTraceFilename = NULL; @@ -948,7 +926,6 @@ static bool parseCmdlIVAS_dec( { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_AVG; } -#ifdef OTR_REFERENCE_VECTOR_TRACKING else if ( strcmp( argv_to_upper, "REF_VEC" ) == 0 ) { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF_VEC; @@ -957,7 +934,6 @@ static bool parseCmdlIVAS_dec( { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV; } -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ else { fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", argv[i + 1] ); @@ -981,7 +957,6 @@ static bool parseCmdlIVAS_dec( arg->refrotTrajFileName = argv[i]; i++; } -#ifdef OTR_REFERENCE_VECTOR_TRACKING else if ( strcmp( argv_to_upper, "-RVF" ) == 0 ) { arg->enableReferenceVectorTracking = true; @@ -997,7 +972,6 @@ static bool parseCmdlIVAS_dec( arg->referenceVectorTrajFileName = argv[i]; i++; } -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ else if ( strcmp( argv_to_upper, "-RENDER_CONFIG" ) == 0 ) { arg->renderConfigEnabled = true; @@ -1193,10 +1167,8 @@ static void usage_dec( void ) fprintf( stdout, "-otr tracking_type : head orientation tracking type: 'none', 'ref' or 'avg' (only for binaural rendering)\n" ); fprintf( stdout, "-rf File : Reference rotation specified by external trajectory file\n" ); fprintf( stdout, " works only in combination with -otr ref mode\n" ); -#ifdef OTR_REFERENCE_VECTOR_TRACKING fprintf( stdout, "-rvf File : Reference vector specified by external trajectory file\n" ); fprintf( stdout, " works only in combination with -otr ref_vec and ref_vec_lev modes\n" ); -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ fprintf( stdout, "-render_config file : Renderer configuration file\n" ); fprintf( stdout, "-no_diegetic_pan : panning mono no dietic sound to stereo -1<= pan <=1,\n" ); fprintf( stdout, " left or l or 1->left, right or r or -1->right, center or c or 0->middle\n" ); @@ -1404,9 +1376,7 @@ static ivas_error decodeG192( BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, HeadRotFileReader *refRotReader, -#ifdef OTR_REFERENCE_VECTOR_TRACKING Vector3PairFileReader *referenceVectorReader, -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ) @@ -1498,7 +1468,6 @@ static ivas_error decodeG192( goto cleanup; } -#ifdef OTR_REFERENCE_VECTOR_TRACKING /* reference vector */ if ( arg.enableReferenceVectorTracking ) { @@ -1515,7 +1484,6 @@ static ivas_error decodeG192( goto cleanup; } } -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ /* Reference rotation */ if ( arg.enableReferenceRotation ) { diff --git a/apps/renderer.c b/apps/renderer.c index d4671ae656..c2fb6add8a 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -42,9 +42,7 @@ #include "cmdl_tools.h" #include "cmdln_parser.h" #include "head_rotation_file_reader.h" -#ifdef OTR_REFERENCE_VECTOR_TRACKING #include "vector3_pair_file_reader.h" -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #include "hrtf_file_reader.h" #include "ism_file_reader.h" #include "ls_custom_file_reader.h" @@ -133,9 +131,7 @@ typedef struct char inMetadataFilePaths[RENDERER_MAX_ISM_INPUTS][RENDERER_MAX_CLI_ARG_LENGTH]; int16_t numInMetadataFiles; char headRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; -#ifdef OTR_REFERENCE_VECTOR_TRACKING char referenceVectorFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ char referenceRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; @@ -173,9 +169,7 @@ typedef enum CmdLnOptionId_inputMetadata, CmdLnOptionId_listFormats, CmdLnOptionId_inputGain, -#ifdef OTR_REFERENCE_VECTOR_TRACKING CmdLnOptionId_referenceVectorFile, -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ } CmdLnOptionId; static const CmdLnParser_Option cliOptions[] = { @@ -249,11 +243,7 @@ static const CmdLnParser_Option cliOptions[] = { .id = CmdLnOptionId_orientationTracking, .match = "tracking_type", .matchShort = "otr", -#ifdef OTR_REFERENCE_VECTOR_TRACKING .description = "Head orientation tracking type: 'none', 'ref', 'avg' or `ref_vec` or `ref_vec_lev` (only for BINAURAL and BINAURAL_ROOM)", -#else - .description = "Head orientation tracking type: 'none', 'ref' or 'avg' (only for BINAURAL and BINAURAL_ROOM)", -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ }, { .id = CmdlnOptionId_lfePosition, @@ -289,14 +279,12 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "l", .description = "List supported audio formats", }, -#ifdef OTR_REFERENCE_VECTOR_TRACKING { .id = CmdLnOptionId_referenceVectorFile, .match = "reference_vector_file", .matchShort = "rvf", .description = "Reference vector trajectory file for simulation of head tracking (only for BINAURAL and BINAURAL_ROOM outputs)", }, -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ }; @@ -523,9 +511,7 @@ int main( { IVAS_REND_HANDLE hIvasRend; HeadRotFileReader *headRotReader = NULL; -#ifdef OTR_REFERENCE_VECTOR_TRACKING Vector3PairFileReader *referenceVectorReader = NULL; -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ HeadRotFileReader *referenceRotReader = NULL; hrtfFileReader *hrtfFileReader = NULL; IsmPositionProvider *positionProvider; @@ -570,9 +556,7 @@ int main( convert_backslash( args.inputFilePath ); convert_backslash( args.outputFilePath ); convert_backslash( args.headRotationFilePath ); -#ifdef OTR_REFERENCE_VECTOR_TRACKING convert_backslash( args.referenceVectorFilePath ); -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ convert_backslash( args.referenceRotationFilePath ); convert_backslash( args.inLfePanningMatrixFile ); @@ -593,7 +577,6 @@ int main( exit( -1 ); } } -#ifdef OTR_REFERENCE_VECTOR_TRACKING if ( !isEmptyString( args.referenceVectorFilePath ) ) { if ( Vector3PairFileReader_open( args.referenceVectorFilePath, &referenceVectorReader ) != IVAS_ERR_OK ) @@ -602,7 +585,6 @@ int main( exit( -1 ); } } -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ if ( !isEmptyString( args.customHrtfFilePath ) ) { @@ -931,7 +913,6 @@ int main( ObjectPositionBuffer mtdBuffer; IsmPositionProvider_getNextFrame( positionProvider, &mtdBuffer ); -#ifdef OTR_REFERENCE_VECTOR_TRACKING if ( referenceVectorReader != NULL ) { IVAS_VECTOR3 listenerPos, refPos; @@ -946,7 +927,6 @@ int main( exit( -1 ); } } -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ /* Read from reference rotation trajectory file if specified */ if ( referenceRotReader != NULL ) { @@ -1165,9 +1145,7 @@ int main( AudioFileReader_close( &audioReader ); AudioFileWriter_close( &audioWriter ); HeadRotationFileReader_close( &headRotReader ); -#ifdef OTR_REFERENCE_VECTOR_TRACKING Vector3PairFileReader_close( &referenceVectorReader ); -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ HeadRotationFileReader_close( &referenceRotReader ); hrtfFileReader_close( &hrtfFileReader ); IVAS_REND_Close( &hIvasRend ); @@ -1406,7 +1384,6 @@ static bool parseOrientationTracking( { *tracking_type = IVAS_ORIENT_TRK_AVG; } -#ifdef OTR_REFERENCE_VECTOR_TRACKING else if ( strcmp( value, "REF_VEC" ) == 0 ) { *tracking_type = IVAS_ORIENT_TRK_REF_VEC; @@ -1415,7 +1392,6 @@ static bool parseOrientationTracking( { *tracking_type = IVAS_ORIENT_TRK_REF_VEC_LEV; } -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ else { fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", value ); @@ -1633,9 +1609,7 @@ static CmdlnArgs defaultArgs( args.numInMetadataFiles = 0; clearString( args.headRotationFilePath ); -#ifdef OTR_REFERENCE_VECTOR_TRACKING clearString( args.referenceVectorFilePath ); -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ clearString( args.referenceRotationFilePath ); clearString( args.customHrtfFilePath ); clearString( args.renderConfigFilePath ); @@ -1715,12 +1689,10 @@ static void parseOption( assert( numOptionValues == 1 ); strncpy( args->headRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; -#ifdef OTR_REFERENCE_VECTOR_TRACKING case CmdLnOptionId_referenceVectorFile: assert( numOptionValues == 1 ); strncpy( args->referenceVectorFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ case CmdLnOptionId_refRotFile: assert( numOptionValues == 1 ); strncpy( args->referenceRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 24811daca1..3e012a6f99 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -88,12 +88,10 @@ typedef struct } IVAS_QUATERNION; -#ifdef OTR_REFERENCE_VECTOR_TRACKING typedef struct { float x, y, z; } IVAS_VECTOR3; -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ typedef struct { diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 76b19f5fc1..8f0059d092 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1501,21 +1501,17 @@ typedef enum #define IVAS_ORIENT_TRK_NONE 0 #define IVAS_ORIENT_TRK_REF 1 #define IVAS_ORIENT_TRK_AVG 2 -#ifdef OTR_REFERENCE_VECTOR_TRACKING #define IVAS_ORIENT_TRK_REF_VEC 3 #define IVAS_ORIENT_TRK_REF_VEC_LEV 4 -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ typedef enum { OTR_TRACKING_NONE = IVAS_ORIENT_TRK_NONE, OTR_TRACKING_REF_ORIENT = IVAS_ORIENT_TRK_REF, /* track orientation relative to external reference orientation (default: no rotation) */ OTR_TRACKING_AVG_ORIENT = IVAS_ORIENT_TRK_AVG /* track orientation relative to average orientation */ -#ifdef OTR_REFERENCE_VECTOR_TRACKING , OTR_TRACKING_REF_VEC = IVAS_ORIENT_TRK_REF_VEC, /* track orientation relative to external reference vector */ OTR_TRACKING_REF_VEC_LEV = IVAS_ORIENT_TRK_REF_VEC_LEV /* track orientation relative to level component of external reference vector */ -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ } OTR_TRACKING_T; diff --git a/lib_com/options.h b/lib_com/options.h index 84bde4b7e7..0348622c64 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -145,7 +145,6 @@ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ -#define OTR_REFERENCE_VECTOR_TRACKING /* FhG: enables the reference position orientation tracking mode */ #define FIX_380_BFI_PARAMISM /* VA: issue 380 - fix metadata recovery in ParamISM BFI */ #define FIX_MDCT_BASED_BWD /* FhG: fixes for BWD for issues with reaction to transients for MDCT-stereo and MCT */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 53b3216157..5c19eca256 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -814,7 +814,6 @@ ivas_error ivas_init_decoder( return error; } } -#ifdef OTR_REFERENCE_VECTOR_TRACKING else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_REF_VEC ) { if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_VEC ) ) != IVAS_ERR_OK ) @@ -833,7 +832,6 @@ ivas_error ivas_init_decoder( { return IVAS_ERR_WRONG_MODE; } -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ } /*-----------------------------------------------------------------* diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index ff0b5ab59a..f103935c99 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -953,7 +953,6 @@ ivas_error IVAS_DEC_FeedRefRotData( return IVAS_ERR_OK; } -#ifdef OTR_REFERENCE_VECTOR_TRACKING /*---------------------------------------------------------------------* * IVAS_DEC_FeedRefVectorData( ) * @@ -978,7 +977,6 @@ ivas_error IVAS_DEC_FeedRefVectorData( pOtr = hIvasDec->st_ivas->hHeadTrackData->OrientationTracker; return ivas_orient_trk_SetReferenceVector( pOtr, listenerPos, refPos ); } -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ /*---------------------------------------------------------------------* * IVAS_DEC_FeedCustomLsData( ) diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 91bbc2f8e9..e1e5bfe9f4 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -185,14 +185,12 @@ ivas_error IVAS_DEC_FeedRefRotData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION rotation /* i : reference rotation data */ ); -#ifdef OTR_REFERENCE_VECTOR_TRACKING /*! r: error code */ ivas_error IVAS_DEC_FeedRefVectorData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const IVAS_VECTOR3 listenerPos, /* i : Listener position */ const IVAS_VECTOR3 refPos /* i : Reference position */ ); -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ /*! r: error code */ ivas_error IVAS_DEC_VoIP_FeedFrame( diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index b78809a759..63d863c4b6 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -245,7 +245,6 @@ static void QuaternionInverse( } -#ifdef OTR_REFERENCE_VECTOR_TRACKING /*------------------------------------------------------------------------------------------* * VectorSubtract() * @@ -373,7 +372,6 @@ static void VectorRotationToQuaternion( return; } -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ /*-------------------------------------------------------------------* * ivas_orient_trk_Init() @@ -402,9 +400,7 @@ ivas_error ivas_orient_trk_Init( /* initial adaptivity filter coefficient, will be auto-adapted */ pOTR->alpha = sinf( PI2 * pOTR->offCenterAdaptationRate / OTR_UPDATE_RATE ); /* start adaptation at off-center rate = fastest rate */ -#ifdef OTR_REFERENCE_VECTOR_TRACKING pOTR->trkRot = identity; -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ pOTR->absAvgRot = identity; /* Use frontal and horiontal orientation as reference orientation, unless/until overridden */ pOTR->refRot = identity; @@ -486,10 +482,8 @@ ivas_error ivas_orient_trk_GetMainOrientation( case OTR_TRACKING_NONE: *pOrientation = IdentityQuaternion(); break; -#ifdef OTR_REFERENCE_VECTOR_TRACKING case OTR_TRACKING_REF_VEC: case OTR_TRACKING_REF_VEC_LEV: -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ case OTR_TRACKING_REF_ORIENT: *pOrientation = pOTR->refRot; break; @@ -524,7 +518,6 @@ ivas_error ivas_orient_trk_GetTrackedRotation( } -#ifdef OTR_REFERENCE_VECTOR_TRACKING /*-------------------------------------------------------------------* * ivas_orient_trk_SetReferenceVector() * @@ -582,7 +575,6 @@ ivas_error ivas_orient_trk_SetReferenceVector( return IVAS_ERR_OK; } -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ /*-------------------------------------------------------------------* @@ -618,10 +610,8 @@ ivas_error ivas_orient_trk_Process( case OTR_TRACKING_NONE: pOTR->trkRot = absRot; break; -#ifdef OTR_REFERENCE_VECTOR_TRACKING case OTR_TRACKING_REF_VEC: case OTR_TRACKING_REF_VEC_LEV: -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ case OTR_TRACKING_REF_ORIENT: /* Reset average orientation */ pOTR->absAvgRot = absRot; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 7fe8392ba9..938e8de02c 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -856,13 +856,11 @@ ivas_error ivas_orient_trk_SetReferenceRotation( const IVAS_QUATERNION refRot /* i : reference rotation */ ); -#ifdef OTR_REFERENCE_VECTOR_TRACKING ivas_error ivas_orient_trk_SetReferenceVector( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ const IVAS_VECTOR3 listenerPos, /* i : Listener position */ const IVAS_VECTOR3 refPos /* i : Reference position */ ); -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ ivas_error ivas_orient_trk_GetMainOrientation( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 50f5a83581..51a54889a8 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3859,14 +3859,12 @@ ivas_error IVAS_REND_SetOrientationTrackingMode( case IVAS_ORIENT_TRK_REF: mode = OTR_TRACKING_REF_ORIENT; break; -#ifdef OTR_REFERENCE_VECTOR_TRACKING case IVAS_ORIENT_TRK_REF_VEC: mode = OTR_TRACKING_REF_VEC; break; case IVAS_ORIENT_TRK_REF_VEC_LEV: mode = OTR_TRACKING_REF_VEC_LEV; break; -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ case IVAS_ORIENT_TRK_NONE: default: mode = OTR_TRACKING_NONE; @@ -3964,7 +3962,6 @@ ivas_error IVAS_REND_GetTrackedRotation( } -#ifdef OTR_REFERENCE_VECTOR_TRACKING /*---------------------------------------------------------------------* * IVAS_REND_SetReferenceVector( ) * @@ -3985,7 +3982,6 @@ ivas_error IVAS_REND_SetReferenceVector( return ivas_orient_trk_SetReferenceVector( hIvasRend->headRotData.hOrientationTracker, listenerPos, refPos ); } -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ /*-------------------------------------------------------------------* diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index b1f7361fec..99b33dc381 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -268,13 +268,11 @@ ivas_error IVAS_REND_GetTrackedRotation( IVAS_QUATERNION *pRotation /* i/o: Quaternion pointer for processed rotation */ ); -#ifdef OTR_REFERENCE_VECTOR_TRACKING ivas_error IVAS_REND_SetReferenceVector( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_VECTOR3 listenerPos, /* i : Listener position */ const IVAS_VECTOR3 refPos /* i : Reference position */ ); -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ ivas_error IVAS_REND_GetSamples( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ diff --git a/lib_util/vector3_pair_file_reader.c b/lib_util/vector3_pair_file_reader.c index 1b8a95bc88..628f3c2c38 100644 --- a/lib_util/vector3_pair_file_reader.c +++ b/lib_util/vector3_pair_file_reader.c @@ -38,7 +38,6 @@ #include "prot.h" #include "options.h" /* only included to get access to the feature-defines */ -#ifdef OTR_REFERENCE_VECTOR_TRACKING struct Vector3PairFileReader { @@ -163,4 +162,3 @@ const char *Vector3PairFileReader_getFilePath( return reader->file_path; } -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ diff --git a/lib_util/vector3_pair_file_reader.h b/lib_util/vector3_pair_file_reader.h index a2fd706fc2..4ab687848c 100644 --- a/lib_util/vector3_pair_file_reader.h +++ b/lib_util/vector3_pair_file_reader.h @@ -37,7 +37,6 @@ #include "ivas_error.h" #include "options.h" /* only included to get access to the feature-defines */ -#ifdef OTR_REFERENCE_VECTOR_TRACKING typedef struct Vector3PairFileReader Vector3PairFileReader; @@ -84,6 +83,5 @@ const char *Vector3PairFileReader_getFilePath( Vector3PairFileReader *vector3PairReader /* i/o: Vector3PairFileReader handle */ ); -#endif /* OTR_REFERENCE_VECTOR_TRACKING */ #endif /* IVAS_V3PAIR_FILE_READER_H */ -- GitLab From 5fe6524e6903cbc73da854b4c6729cd0c8882a8e Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 29 Mar 2023 21:48:53 +0200 Subject: [PATCH 334/375] [cleanup] accept FIX_380_BFI_PARAMISM --- lib_com/options.h | 1 - lib_dec/ivas_ism_metadata_dec.c | 18 ------------------ 2 files changed, 19 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 0348622c64..11116e6225 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -146,7 +146,6 @@ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ -#define FIX_380_BFI_PARAMISM /* VA: issue 380 - fix metadata recovery in ParamISM BFI */ #define FIX_MDCT_BASED_BWD /* FhG: fixes for BWD for issues with reaction to transients for MDCT-stereo and MCT */ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ #define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index f8a5bea72b..75b9164e1d 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -437,7 +437,6 @@ ivas_error ivas_ism_metadata_dec( } else /* BFI */ { -#ifdef FIX_380_BFI_PARAMISM #ifndef NCHAN_ISM_PARAMETER /* "nchan_ism", "hIsmMeta->azimuth" and "hIsmMeta->elevation" are recycled from the last frame */ if ( ism_mode == ISM_MODE_PARAM ) @@ -450,14 +449,6 @@ ivas_error ivas_ism_metadata_dec( } #endif for ( ch = 0; ch < nchan_ism; ch++ ) -#else - /* "*nISms", "hIsmMeta->azimuth" and "hIsmMeta->elevation" are recycled from the last frame */ - for ( ch = 0; ch < *nchan_transport; ch++ ) - { - hIsmMeta[ch]->ism_metadata_flag = hIsmMeta[ch]->last_ism_metadata_flag; - } - for ( ; ch < nchan_ism; ch++ ) -#endif { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; } @@ -468,17 +459,8 @@ ivas_error ivas_ism_metadata_dec( { for ( ch = 0; ch < nchan_ism; ch++ ) { -#ifdef FIX_380_BFI_PARAMISM hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch] + hParamIsm->last_az_sgn[ch] * hParamIsm->last_az_diff[ch]; hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch] + hParamIsm->last_el_sgn[ch] * hParamIsm->last_el_diff[ch]; -#else - hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch] + hParamIsm->last_az_sgn[ch] * hParamIsm->last_az_diff[ch]; - /*hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch] % hParamIsm->az_alpha[ch];*/ - hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch]; - hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch] + hParamIsm->last_el_sgn[ch] * hParamIsm->last_el_diff[ch]; - /*hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch] % hParamIsm->ele_alpha;*/ - hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch]; -#endif hIsmMeta[ch]->angle[0].last_azimuth_idx = hParamIsm->azi_index[ch]; hIsmMeta[ch]->angle[0].last_elevation_idx = hParamIsm->ele_index[ch]; } -- GitLab From ae97a5d4be1f15a076cf36d1d53bdfd91d08542a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 29 Mar 2023 21:56:36 +0200 Subject: [PATCH 335/375] formatting --- apps/decoder.c | 9 ++++----- lib_dec/lib_dec.c | 2 +- lib_enc/ivas_ism_metadata_enc.c | 24 ++++++++++++------------ lib_enc/lib_enc.c | 4 ++-- lib_rend/ivas_objectRenderer.c | 22 +++++++++++----------- lib_rend/ivas_objectRenderer_sfx.c | 4 ++-- lib_rend/ivas_objectRenderer_vec.c | 4 ++-- lib_rend/lib_rend.c | 2 +- lib_util/head_rotation_file_reader.c | 5 ++--- lib_util/head_rotation_file_reader.h | 4 ++-- lib_util/ism_file_reader.c | 6 +++--- lib_util/vector3_pair_file_reader.c | 1 - 12 files changed, 42 insertions(+), 45 deletions(-) mode change 100755 => 100644 lib_enc/lib_enc.c diff --git a/apps/decoder.c b/apps/decoder.c index 43e8750c7a..e883144987 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -70,9 +70,9 @@ static #define MAX_NUM_OUTPUT_CHANNELS 16 #define MAX_OUTPUT_PCM_BUFFER_SIZE ( MAX_NUM_OUTPUT_CHANNELS * MAX_FRAME_SIZE ) -#define IVAS_PUBLIC_ORIENT_TRK_NONE ( 0 ) -#define IVAS_PUBLIC_ORIENT_TRK_REF ( 1 ) -#define IVAS_PUBLIC_ORIENT_TRK_AVG ( 2 ) +#define IVAS_PUBLIC_ORIENT_TRK_NONE ( 0 ) +#define IVAS_PUBLIC_ORIENT_TRK_REF ( 1 ) +#define IVAS_PUBLIC_ORIENT_TRK_AVG ( 2 ) #define IVAS_PUBLIC_ORIENT_TRK_REF_VEC ( 3 ) #define IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV ( 4 ) @@ -917,8 +917,7 @@ static bool parseCmdlIVAS_dec( { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; } - else - if ( strcmp( argv_to_upper, "REF" ) == 0 ) + else if ( strcmp( argv_to_upper, "REF" ) == 0 ) { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index f103935c99..f95f18ae19 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -885,7 +885,7 @@ ivas_error IVAS_DEC_GetMasaMetadata( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_FeedHeadTrackData( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION *orientation, /* i : head-tracking data, listener orientation */ IVAS_POSITION *Pos /* i : listener position */ ) diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index da1a568a94..5b45d909f1 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -53,7 +53,7 @@ #define ISM_MAX_AZIMUTH_DIFF_IDX ( ISM_AZIMUTH_NBITS - 1 /*zero*/ - 1 /*sign*/ ) #define ISM_MAX_ELEVATION_DIFF_IDX ( ISM_ELEVATION_NBITS - 1 /*zero*/ - 1 /*sign*/ ) -#define ISM_MAX_RADIUS_DIFF_IDX ( ISM_RADIUS_NBITS - 1 /*zero*/ - 1 /*sign*/ ) +#define ISM_MAX_RADIUS_DIFF_IDX ( ISM_RADIUS_NBITS - 1 /*zero*/ - 1 /*sign*/ ) #define ISM_FEC_MAX 10 @@ -78,10 +78,10 @@ static void encode_radius( BSTR_ENC_HANDLE hBstr, int16_t *last_radius_idx, int1 ivas_error ivas_set_ism_metadata( ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ const float azimuth, /* i : azimuth value */ - const float elevation, /* i : elevation */ - const float radius_meta, /* i : radius */ - const float yaw, /* i : yaw */ - const float pitch /* i : pitch */ + const float elevation, /* i : elevation */ + const float radius_meta, /* i : radius */ + const float yaw, /* i : yaw */ + const float pitch /* i : pitch */ ) { if ( hIsmMeta == NULL ) @@ -166,13 +166,13 @@ ivas_error ivas_ism_metadata_enc( #ifdef NCHAN_ISM_PARAMETER const int16_t nchan_ism, /* i : number of ISM channels */ #endif - const int16_t nchan_transport, /* i : number of transport channels */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - int16_t nb_bits_metadata[], /* o : number of metadata bits */ - const int16_t localVAD[], /* i : VAD flag */ - const int16_t ism_mode, /* i : ISM mode */ + const int16_t nchan_transport, /* i : number of transport channels */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + int16_t nb_bits_metadata[], /* o : number of metadata bits */ + const int16_t localVAD[], /* i : VAD flag */ + const int16_t ism_mode, /* i : ISM mode */ const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Enc Handle */ const int16_t ism_extended_metadata_flag /* i : Extended metadata flag */ ) diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c old mode 100755 new mode 100644 index dfc467b7a9..ebc2551ce2 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -366,8 +366,8 @@ ivas_error IVAS_ENC_ConfigureForObjects( const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ - const uint16_t numObjects, /* i : number of objects to be encoded */ - const bool ism_extended_metadata /* i : Extended metadata used (true/false), where extended metadata includes radius and orientation */ + const uint16_t numObjects, /* i : number of objects to be encoded */ + const bool ism_extended_metadata /* i : Extended metadata used (true/false), where extended metadata includes radius and orientation */ ) { Encoder_Struct *st_ivas; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index b3add4dad3..ed36fa26b1 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -57,12 +57,12 @@ static void angles_to_vec( const float radius, const float azimuth, const float *---------------------------------------------------------------------*/ ivas_error ivas_td_binaural_open_unwrap( - TDREND_HRFILT_FiltSet_t **hHrtfTD, /* i/o: HR filter model (from file or NULL) */ - const int32_t output_Fs, /* i : Output sampling rate */ - const int16_t nchan_transport, /* i : Number of channels */ - const IVAS_FORMAT ivas_format, /* i : IVAS format (ISM/MC) */ - const AUDIO_CONFIG transport_config, /* i : Transport configuration */ - const float *directivity, /* i : Directivity pattern (used for ISM) */ + TDREND_HRFILT_FiltSet_t **hHrtfTD, /* i/o: HR filter model (from file or NULL) */ + const int32_t output_Fs, /* i : Output sampling rate */ + const int16_t nchan_transport, /* i : Number of channels */ + const IVAS_FORMAT ivas_format, /* i : IVAS format (ISM/MC) */ + const AUDIO_CONFIG transport_config, /* i : Transport configuration */ + const float *directivity, /* i : Directivity pattern (used for ISM) */ const IVAS_OUTPUT_SETUP hTransSetup, /* i : Loudspeaker layout */ BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, /* o : TD renderer handle */ int32_t *binaural_latency_ns /* i : Binauralization delay */ @@ -258,9 +258,9 @@ ivas_error ivas_td_binaural_renderer_unwrap( ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ const int16_t Opt_Headrotation, /* i : Head rotation flag */ const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ - const IVAS_POSITION *Pos, /* i : Listener position data per subframe */ - float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ - const int16_t output_frame /* i : output frame length */ + const IVAS_POSITION *Pos, /* i : Listener position data per subframe */ + float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ + const int16_t output_frame /* i : output frame length */ ) { int16_t subframe_length; @@ -461,8 +461,8 @@ void TDREND_Update_object_positions( void TDREND_Update_listener_orientation( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const int16_t headRotEnabled, /* i : Headrotation flag */ - const IVAS_QUATERNION *headPosition, /* i : Listener orientation */ - const IVAS_POSITION *Pos /* i : Listener Position */ + const IVAS_QUATERNION *headPosition, /* i : Listener orientation */ + const IVAS_POSITION *Pos /* i : Listener Position */ ) { float FrontVec[3]; diff --git a/lib_rend/ivas_objectRenderer_sfx.c b/lib_rend/ivas_objectRenderer_sfx.c index c6645f783a..98f45a5dd9 100644 --- a/lib_rend/ivas_objectRenderer_sfx.c +++ b/lib_rend/ivas_objectRenderer_sfx.c @@ -235,8 +235,8 @@ void TDREND_firfilt( const int16_t intp_count, /* i : interpolation count */ float *mem, /* i/o: filter memory */ const int16_t subframe_length, /* i : Length of signal */ - const int16_t filterlength, /* i : Filter length */ - const float Gain /* i : Gain */ + const int16_t filterlength, /* i : Filter length */ + const float Gain /* i : Gain */ ) { float buffer[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 + L_SUBFRAME5MS_48k]; diff --git a/lib_rend/ivas_objectRenderer_vec.c b/lib_rend/ivas_objectRenderer_vec.c index 0b04e4b877..061b790e1b 100644 --- a/lib_rend/ivas_objectRenderer_vec.c +++ b/lib_rend/ivas_objectRenderer_vec.c @@ -111,8 +111,8 @@ void TDREND_SPATIAL_VecMapToNewCoordSystem( const float *DirVec_p, /* i : Direction vector */ const float *UpVec_p, /* i : Up vector */ const float *RightVec_p, /* i : Right vector */ - float *MappedVec_p, /* o : Transformed vector */ - float *LisRelPosAbs /* o : Transformed vector ignoring orientation */ + float *MappedVec_p, /* o : Transformed vector */ + float *LisRelPosAbs /* o : Transformed vector ignoring orientation */ ) { v_sub( Vec_p, TranslVec_p, LisRelPosAbs, 3 ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 51a54889a8..37851cf1ab 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3784,7 +3784,7 @@ int16_t IVAS_REND_FeedRenderConfig( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_SetHeadRotation( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME], /* i : head orientations for next rendering call */ const IVAS_POSITION Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ ) diff --git a/lib_util/head_rotation_file_reader.c b/lib_util/head_rotation_file_reader.c index fcc822cb76..02f14be924 100644 --- a/lib_util/head_rotation_file_reader.c +++ b/lib_util/head_rotation_file_reader.c @@ -93,8 +93,8 @@ ivas_error HeadRotationFileReader_open( ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ - IVAS_QUATERNION *pQuaternion, /* o : head-tracking data */ - IVAS_POSITION *pPos /* o : listener position */ + IVAS_QUATERNION *pQuaternion, /* o : head-tracking data */ + IVAS_POSITION *pPos /* o : listener position */ ) { float w, x, y, z; @@ -134,7 +134,6 @@ ivas_error HeadRotationFileReading( } - /*-----------------------------------------------------------------------* * HeadRotationFileReader_close() * diff --git a/lib_util/head_rotation_file_reader.h b/lib_util/head_rotation_file_reader.h index ac4117180b..4794aeba45 100644 --- a/lib_util/head_rotation_file_reader.h +++ b/lib_util/head_rotation_file_reader.h @@ -59,8 +59,8 @@ ivas_error HeadRotationFileReader_open( ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ - IVAS_QUATERNION *pQuaternion, /* o : head-tracking data */ - IVAS_POSITION *pPos /* o : listener position */ + IVAS_QUATERNION *pQuaternion, /* o : head-tracking data */ + IVAS_POSITION *pPos /* o : listener position */ ); /*-----------------------------------------------------------------------* diff --git a/lib_util/ism_file_reader.c b/lib_util/ism_file_reader.c index 702c90c0f6..b27d0e9e78 100644 --- a/lib_util/ism_file_reader.c +++ b/lib_util/ism_file_reader.c @@ -36,9 +36,9 @@ #include -#define META_LINE_LENGTH 200 /* max number of characters at one line of metadata input/output file */ -#define NUM_ISM_METADATA_PER_LINE 7 /* Number of ISM metadata per line in a metadata file */ -#define NUM_MIN_ISM_METADATA 2 /* Minimum number of metadata parameters (azimuth and elevation) */ +#define META_LINE_LENGTH 200 /* max number of characters at one line of metadata input/output file */ +#define NUM_ISM_METADATA_PER_LINE 7 /* Number of ISM metadata per line in a metadata file */ +#define NUM_MIN_ISM_METADATA 2 /* Minimum number of metadata parameters (azimuth and elevation) */ struct IsmFileReader diff --git a/lib_util/vector3_pair_file_reader.c b/lib_util/vector3_pair_file_reader.c index 628f3c2c38..9e03358b91 100644 --- a/lib_util/vector3_pair_file_reader.c +++ b/lib_util/vector3_pair_file_reader.c @@ -161,4 +161,3 @@ const char *Vector3PairFileReader_getFilePath( return reader->file_path; } - -- GitLab From 1b51d02b1f78c926e486cf48f01c79fdd6542681 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 29 Mar 2023 21:57:40 +0200 Subject: [PATCH 336/375] whitespace --- lib_com/options.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 11116e6225..3c6e1aa960 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -144,8 +144,6 @@ /*#define SBA_HPF_TUNING_DEC*/ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ - - #define FIX_MDCT_BASED_BWD /* FhG: fixes for BWD for issues with reaction to transients for MDCT-stereo and MCT */ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ #define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ -- GitLab From 4bb5e4ac11f9c58f107dd92c18046299a57bfe63 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Thu, 30 Mar 2023 02:40:52 +0200 Subject: [PATCH 337/375] add test for render config file --- tests/renderer/constants.py | 4 ++++ tests/renderer/test_renderer.py | 18 ++++++++++++++++++ tests/renderer/utils.py | 9 +++++++++ 3 files changed, 31 insertions(+) diff --git a/tests/renderer/constants.py b/tests/renderer/constants.py index 3625a9307e..e29696adec 100644 --- a/tests/renderer/constants.py +++ b/tests/renderer/constants.py @@ -193,6 +193,10 @@ HR_TRAJECTORIES_TO_TEST = [ "rotate_yaw_pitch_roll1", ] +CONFIG_FILES_TO_TEST = [ + "just_reverb" +] + """ Per-testcase xfail SNR thresholds (dB) """ pass_snr = dict() # not relevant for tests anymore, should be deprecated soon _pass_snr = { diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index 690f495c7f..00ea239714 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -56,6 +56,24 @@ def test_ambisonics_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): ) +# Test compares rendering with render config file containing just reverb defaults against rendering without config file. +# These should be binary equivalent. +@pytest.mark.parametrize("config_file", CONFIG_FILES_TO_TEST) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) +def test_ambisonics_binaural_headrotation_defaultrenderconfig(test_info, in_fmt, out_fmt, config_file): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "defaultrenderconfig" + }, + cut_kwargs={ + "config_file": TESTV_DIR.joinpath(f"{config_file}.cfg") + } + ) + # Test compares rendering with just a trajectory file against rendering with a trajectory file + a zero ref rotation. # These should be binary equivalent. @pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index 7a98dff300..d0e0b22f7a 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -109,6 +109,7 @@ def run_renderer( refrot_file: Optional[str] = None, refvec_file: Optional[str] = None, refveclev_file: Optional[str] = None, + config_file: Optional[str] = None, output_path_base: str = OUTPUT_PATH_CUT, binary_suffix: str = "", is_comparetest: Optional[bool] = False, @@ -134,6 +135,11 @@ def run_renderer( else: refveclev_name = "" + if config_file is not None: + config_name = f"_{config_file.stem}" + else: + refveclev_name = "" + if not isinstance(out_fmt, str): @@ -184,6 +190,9 @@ def run_renderer( cmd.extend(["-rvf", str(refveclev_file)]) cmd.extend(["-otr", "ref_vec_lev"]) + if config_file is not None: + cmd.extend(["-rc", str(config_file)]) + run_cmd(cmd) return pyaudio3dtools.audiofile.readfile(out_file) -- GitLab From dd7a8f5dd4c9b958cada3f571344ffd24a76d1ab Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Thu, 30 Mar 2023 02:56:27 +0200 Subject: [PATCH 338/375] add render-config-name to output file name --- tests/renderer/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index d0e0b22f7a..3b24015e68 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -162,7 +162,7 @@ def run_renderer( in_file = FORMAT_TO_FILE[in_fmt] in_name = in_fmt - out_file = str(output_path_base.joinpath(f"{in_name}_to_{out_name}{trj_name}{refrot_name}{refvec_name}{refveclev_name}{name_extension}.wav")) + out_file = str(output_path_base.joinpath(f"{in_name}_to_{out_name}{trj_name}{refrot_name}{refvec_name}{refveclev_name}{config_name}{name_extension}.wav")) cmd = RENDERER_CMD[:] cmd[2] = str(in_file) -- GitLab From e81b9d7ef23b8fa5dbc2621353c7ffc98f45147c Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Thu, 30 Mar 2023 02:58:37 +0200 Subject: [PATCH 339/375] copy/paste typo --- tests/renderer/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index 3b24015e68..d2af91f60c 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -138,7 +138,7 @@ def run_renderer( if config_file is not None: config_name = f"_{config_file.stem}" else: - refveclev_name = "" + config_name = "" -- GitLab From 37dc2143ffca1aea2388df5d67915eba261ce2db Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 30 Mar 2023 09:44:59 +0200 Subject: [PATCH 340/375] - update readme.txt and usage_dec() - print out orientation tracking type - add sanity checks for usage of reference rotation file and reference vector trajectory file --- apps/decoder.c | 58 +++++++++++++++++++++++++++++++++++------------ lib_dec/lib_dec.c | 19 ++++++++++++++++ readme.txt | 20 ++++++++++------ 3 files changed, 76 insertions(+), 21 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index e883144987..d2260713c2 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -267,19 +267,50 @@ int main( /*------------------------------------------------------------------------------------------* * Open reference rotation file *------------------------------------------------------------------------------------------*/ + if ( arg.enableReferenceRotation ) { + /* sanity check */ + if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) + { + fprintf( stderr, "\nError: Reference rotation file cannot be used in this output configuration.\n\n" ); + goto cleanup; + } + + /* sanity check */ + if ( arg.orientation_tracking != IVAS_PUBLIC_ORIENT_TRK_REF ) + { + fprintf( stderr, "\nError: Reference rotation file can be used in '-otr ref' mode only.\n\n" ); + goto cleanup; + } + if ( ( error = HeadRotationFileReader_open( arg.refrotTrajFileName, &refRotReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Can't open reference rotation file %s \n\n", arg.refrotTrajFileName ); goto cleanup; } } + /*------------------------------------------------------------------------------------------* * Open reference vector trajectory file *------------------------------------------------------------------------------------------*/ + if ( arg.enableReferenceVectorTracking ) { + /* sanity check */ + if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) + { + fprintf( stderr, "\nError: Reference vector trajectory file cannot be used in this output configuration.\n\n" ); + goto cleanup; + } + + /* sanity check */ + if ( arg.orientation_tracking != IVAS_PUBLIC_ORIENT_TRK_REF_VEC && arg.orientation_tracking != IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV ) + { + fprintf( stderr, "\nError: Reference trajectory file can be used in '-otr ref_vec' or '-otr ref_vec_lev' mode only.\n\n" ); + goto cleanup; + } + if ( ( error = Vector3PairFileReader_open( arg.referenceVectorTrajFileName, &referenceVectorReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Can't open reference vector trajectory file %s \n\n", arg.referenceVectorTrajFileName ); @@ -873,9 +904,7 @@ static bool parseCmdlIVAS_dec( } #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK - /*-----------------------------------------------------------------* - * Define additional subfolder for debug info output in ./res - *-----------------------------------------------------------------*/ + /* Define additional subfolder for debug info output in ./res */ else if ( strcmp( argv_to_upper, "-INFO" ) == 0 ) { extern char infoFolder[FILENAME_MAX]; @@ -1153,8 +1182,19 @@ static void usage_dec( void ) fprintf( stdout, " Format files, the magic word in the mime file is used to determine\n" ); fprintf( stdout, " which of the two supported formats is in use.\n" ); fprintf( stdout, " default bitstream file format is G.192\n" ); - fprintf( stdout, "-T File : Head rotation specified by external trajectory File\n" ); fprintf( stdout, "-hrtf File : HRTF filter File used in BINAURAL output configuration\n" ); + fprintf( stdout, "-T File : Head rotation specified by external trajectory File\n" ); + fprintf( stdout, "-otr tracking_type : Head orientation tracking type: 'none', 'ref', 'avg', 'ref_vec' \n" ); + fprintf( stdout, " or 'ref_vec_lev' (only for binaural rendering)\n" ); + fprintf( stdout, "-rf File : Reference rotation specified by external trajectory file\n" ); + fprintf( stdout, " works only in combination with '-otr ref' mode \n" ); + fprintf( stdout, "-rvf File : Reference vector specified by external trajectory file\n" ); + fprintf( stdout, " works only in combination with '-otr ref_vec' and 'ref_vec_lev' modes\n" ); + fprintf( stdout, "-render_config File : Renderer configuration File\n" ); + fprintf( stdout, "-no_diegetic_pan : panning mono non-diegetic sound to stereo -1<= pan <=1,\n" ); + fprintf( stdout, " left or l or 1->left, right or r or -1->right, center or c or 0->middle\n" ); + fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); + fprintf( stdout, " default is deactivated\n" ); #ifdef DEBUGGING fprintf( stdout, "-FEC X : Insert frame erasures, X = 0-10 is the percentage\n" ); fprintf( stdout, " of erased frames, or X may be the name of binary file or \n" ); @@ -1163,16 +1203,6 @@ static void usage_dec( void ) fprintf( stdout, " default is OFF, if this option is not used\n" ); fprintf( stdout, "-force R : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" ); #endif - fprintf( stdout, "-otr tracking_type : head orientation tracking type: 'none', 'ref' or 'avg' (only for binaural rendering)\n" ); - fprintf( stdout, "-rf File : Reference rotation specified by external trajectory file\n" ); - fprintf( stdout, " works only in combination with -otr ref mode\n" ); - fprintf( stdout, "-rvf File : Reference vector specified by external trajectory file\n" ); - fprintf( stdout, " works only in combination with -otr ref_vec and ref_vec_lev modes\n" ); - fprintf( stdout, "-render_config file : Renderer configuration file\n" ); - fprintf( stdout, "-no_diegetic_pan : panning mono no dietic sound to stereo -1<= pan <=1,\n" ); - fprintf( stdout, " left or l or 1->left, right or r or -1->right, center or c or 0->middle\n" ); - fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); - fprintf( stdout, " default is deactivated\n" ); #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK fprintf( stdout, "-info : specify subfolder name for debug output\n" ); diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index f95f18ae19..0497a0a713 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1990,6 +1990,25 @@ static ivas_error printConfigInfo_dec( { fprintf( stdout, "Head rotation: ON\n" ); } + + if ( st_ivas->hDecoderConfig->orientation_tracking != IVAS_ORIENT_TRK_NONE ) + { + switch ( st_ivas->hDecoderConfig->orientation_tracking ) + { + case IVAS_ORIENT_TRK_AVG: + fprintf( stdout, "Orientation tracking: AVG\n" ); + break; + case IVAS_ORIENT_TRK_REF: + fprintf( stdout, "Orientation tracking: REF\n" ); + break; + case IVAS_ORIENT_TRK_REF_VEC: + fprintf( stdout, "Orientation tracking: REF_VEC\n" ); + break; + case IVAS_ORIENT_TRK_REF_VEC_LEV: + fprintf( stdout, "Orientation tracking: REF_VEC_LEV\n" ); + break; + } + } } return IVAS_ERR_OK; diff --git a/readme.txt b/readme.txt index eeaea0f84a..c566c78ea2 100644 --- a/readme.txt +++ b/readme.txt @@ -255,20 +255,26 @@ Options: Format files, the magic word in the mime file is used to determine which of the two supported formats is in use. default bitstream file format is G.192 --T File : Head rotation specified by external trajectory File -hrtf File : HRTF filter File used in ISm format and BINAURAL output configuration +-T File : Head rotation specified by external trajectory File +-otr tracking_type : Head orientation tracking type: 'none', 'ref', 'avg', 'ref_vec' + or 'ref_vec_lev' (only for binaural rendering) +-rf File : Reference rotation specified by external trajectory file + works only in combination with '-otr ref' mode +-rvf File : Reference vector specified by external trajectory file + works only in combination with '-otr ref_vec' and 'ref_vec_lev' modes +-render_config File : Renderer configuration option File +-no_diegetic_pan : panning mono non-diegetic sound to stereo -1<= pan <=1, + left or l or 1->left, right or r or -1->right, center or c or 0->middle +-q : Quiet mode, no frame counter + default is deactivated -FEC X : Insert frame erasures, X = 0-10 is the percentage of erased frames, or X may be the name of binary file or file with G192 headers indicating GOOD FRAME or BAD FRAME containing FEC pattern (short values of 0 (good) or 1 (bad)) default is OFF, if this option is not used -force R : Force specific binaural rendering mode, R = (TDREND, CLDFBREND), --otr tracking_type : head orientation tracking type: 'ref' or 'avg' (only for binaural rendering) --render_config File : Renderer configuration option File --no_diegetic_pan : panning mono no dietic sound to stereo -1<= pan <=1, - left or l or 1->left, right or r or -1->right, center or c or 0->middle --q : Quiet mode, no frame counter - default is deactivated + MULTICHANNEL LOUDSPEAKER INPUT / OUTPUT CONFIGURATIONS -- GitLab From c95c5c6f07c9766c34fa8e280ad1833393aefc29 Mon Sep 17 00:00:00 2001 From: rhb Date: Thu, 30 Mar 2023 14:36:08 +0200 Subject: [PATCH 341/375] fix gain overshoot in ACELP HB for SWB and also apply SWB changes to stereo --- lib_dec/ivas_sba_dirac_stereo_dec.c | 50 ++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index 719bef5782..464fde49c6 100755 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -469,17 +469,25 @@ static void ivas_sba_dirac_stereo_upmix_hb( if ( !mcmasa ) { #ifdef SBA2MONO - gain_fac = ( bwidth == FB ) ? 0.25f : 0.33f; /* last matrix element zero for SWB, divide by 3 instead of 4*/ + gain_fac = ( bwidth == FB ) ? 0.25f : 0.33f; /* last matrix element not used for SWB, divide by 3 instead of 4*/ if ( sba_mono_flag ) { gp = hStereoDft->mixer_mat_smooth[0][0][8] + hStereoDft->mixer_mat_smooth[0][0][9] + - hStereoDft->mixer_mat_smooth[0][0][10] + hStereoDft->mixer_mat_smooth[0][0][11]; + hStereoDft->mixer_mat_smooth[0][0][10]; + if ( bwidth == FB ) + { + gp += hStereoDft->mixer_mat_smooth[0][0][11]; + } for ( i = 0; i < output_frame / 2; i++ ) { hb_stereo_synth[0][i] = hb_synth[i] * gain_fac * gp; } gp = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS]; + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS]; + if ( bwidth == FB ) + { + gp += hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS]; + } for ( i = output_frame / 2; i < output_frame; i++ ) { hb_stereo_synth[0][i] = hb_synth[i] * gain_fac * gp; @@ -489,34 +497,46 @@ static void ivas_sba_dirac_stereo_upmix_hb( { gp = hStereoDft->mixer_mat_smooth[0][0][8] + hStereoDft->mixer_mat_smooth[1][0][8] + hStereoDft->mixer_mat_smooth[0][0][9] + hStereoDft->mixer_mat_smooth[1][0][9] + - hStereoDft->mixer_mat_smooth[0][0][10] + hStereoDft->mixer_mat_smooth[1][0][10] + - hStereoDft->mixer_mat_smooth[0][0][11] + hStereoDft->mixer_mat_smooth[1][0][11]; + hStereoDft->mixer_mat_smooth[0][0][10] + hStereoDft->mixer_mat_smooth[1][0][10]; + if ( bwidth == FB ) + { + gp += hStereoDft->mixer_mat_smooth[0][0][11] + hStereoDft->mixer_mat_smooth[1][0][11]; + } gm = hStereoDft->mixer_mat_smooth[0][0][8] - hStereoDft->mixer_mat_smooth[1][0][8] + hStereoDft->mixer_mat_smooth[0][0][9] - hStereoDft->mixer_mat_smooth[1][0][9] + - hStereoDft->mixer_mat_smooth[0][0][10] - hStereoDft->mixer_mat_smooth[1][0][10] + - hStereoDft->mixer_mat_smooth[0][0][11] - hStereoDft->mixer_mat_smooth[1][0][11]; + hStereoDft->mixer_mat_smooth[0][0][10] - hStereoDft->mixer_mat_smooth[1][0][10]; + if ( bwidth == FB ) + { + gm += hStereoDft->mixer_mat_smooth[0][0][11] - hStereoDft->mixer_mat_smooth[1][0][11]; + } for ( i = 0; i < output_frame / 2; i++ ) { - hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * 0.25f * gp; - hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * 0.25f * gm; + hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * gain_fac * gp; + hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * gain_fac * gm; } gp = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS]; + if ( bwidth == FB ) + { + gp += hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + } gm = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS]; + if ( bwidth == FB ) + { + gm += hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + } for ( i = output_frame / 2; i < output_frame; i++ ) { - hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * 0.25f * gp; - hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * 0.25f * gm; + hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * gain_fac * gp; + hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * gain_fac * gm; } } #else -- GitLab From 957de910adc3546ddceb5aab90b9e62a78f35815 Mon Sep 17 00:00:00 2001 From: rhb Date: Thu, 30 Mar 2023 17:53:21 +0200 Subject: [PATCH 342/375] address some minor issues --- lib_dec/ivas_dec.c | 18 ++++++++++++++++++ lib_dec/ivas_init_dec.c | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 4b2e860be8..bfe74db452 100755 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -347,6 +347,24 @@ ivas_error ivas_dec( if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { +#ifdef SBA2MONO + ivas_agc_dec_process( st_ivas->hSpar->hAgcDec, output, output, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); + + if ( st_ivas->hSpar->hPCA != NULL ) + { + int16_t num_in_ingest; + if ( st_ivas->hSpar->hMdDec->td_decorr_flag ) + { + num_in_ingest = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order );; + } + else + { + num_in_ingest = st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport; + } + ivas_pca_dec( st_ivas->hSpar->hPCA, output_frame, num_in_ingest, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, output ); + } + +#endif ivas_spar_dec_gen_umx_mat( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi ); } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index a355f95b38..f7f6ba4173 100755 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1033,7 +1033,11 @@ ivas_error ivas_init_decoder( } /* create CPE element for DFT Stereo like upmix */ +#ifdef SBA2MONO + if ( st_ivas->sba_dirac_stereo_flag && st_ivas->nCPE == 0 ) +#else if ( st_ivas->sba_dirac_stereo_flag && st_ivas->nchan_transport == 1 ) +#endif { if ( ( error = create_cpe_dec( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) { -- GitLab From eba4f1a9886ea156aac79f5b5dde57b3caf85e64 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Fri, 31 Mar 2023 15:24:53 +0200 Subject: [PATCH 343/375] replace non-existing flag FIX_373_MASA_DELAY_COMP with FIX_350_MASA_DELAY_COMP --- lib_com/ivas_masa_com.c | 4 ++-- lib_com/ivas_prot.h | 2 +- lib_dec/ivas_masa_dec.c | 2 +- lib_enc/ivas_masa_enc.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 5bfbd00939..3a53b2c682 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -314,7 +314,7 @@ void masa_sample_rate_band_correction( int16_t *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ const int32_t sampling_rate /* i : Sampling rate */ -#ifdef FIX_373_MASA_DELAY_COMP +#ifdef FIX_350_MASA_DELAY_COMP , MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ #endif @@ -390,7 +390,7 @@ void masa_sample_rate_band_correction( hQMetaData->twoDirBands[band] = 0; } } -#ifdef FIX_373_MASA_DELAY_COMP +#ifdef FIX_350_MASA_DELAY_COMP if ( hExtOutMeta != NULL ) { /* in decoder, zero the EXT out MASA meta buffer */ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c51321d667..04866530c1 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4619,7 +4619,7 @@ void masa_sample_rate_band_correction( int16_t *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ const int32_t sampling_rate /* i : sampling rate */ -#ifdef FIX_373_MASA_DELAY_COMP +#ifdef FIX_350_MASA_DELAY_COMP , MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ #endif ); diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 9e2540e968..3c7e490cbc 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -501,7 +501,7 @@ static ivas_error ivas_masa_dec_config( ivas_set_qmetadata_maxbit_req( st_ivas->hQMetaData, st_ivas->ivas_format ); -#ifdef FIX_373_MASA_DELAY_COMP +#ifdef FIX_350_MASA_DELAY_COMP if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { /* need to apply the sampling rate correction also for the EXT output MASA meta buffer */ diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 37b5d0845f..fbb7af9ab4 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -623,7 +623,7 @@ ivas_error ivas_masa_enc_config( ivas_set_qmetadata_maxbit_req( hQMetaData, ivas_format ); -#ifdef FIX_373_MASA_DELAY_COMP +#ifdef FIX_350_MASA_DELAY_COMP masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, st_ivas->hEncoderConfig->input_Fs, NULL ); #else masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, st_ivas->hEncoderConfig->input_Fs ); -- GitLab From 678ce25c5dfecbcaeaf167f23e35a5205ffba328 Mon Sep 17 00:00:00 2001 From: rhb Date: Fri, 31 Mar 2023 17:29:31 +0200 Subject: [PATCH 344/375] add function for setting sba_dirac_stereo_flag --- lib_com/ivas_prot.h | 6 +++++ lib_dec/ivas_init_dec.c | 10 +++++++- lib_dec/ivas_mcmasa_dec.c | 4 +++ lib_dec/ivas_mct_dec.c | 4 +++ lib_dec/ivas_sba_dec.c | 6 ++++- lib_dec/ivas_sba_dirac_stereo_dec.c | 40 +++++++++++++++++++++++++++++ 6 files changed, 68 insertions(+), 2 deletions(-) mode change 100644 => 100755 lib_dec/ivas_mcmasa_dec.c mode change 100644 => 100755 lib_dec/ivas_mct_dec.c diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 54b2f50a07..c1e7cb9e2b 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3304,6 +3304,12 @@ void ivas_sba_dirac_stereo_config( STEREO_DFT_CONFIG_DATA_HANDLE hConfig /* o : DFT stereo configuration */ ); +#ifdef SBA2MONO +int16_t ivas_get_sba_dirac_stereo_flag( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); +#endif + void ivas_sba_dirac_stereo_smooth_parameters( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: encoder DFT stereo handle */ ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index f7f6ba4173..e53218d3e7 100755 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -984,7 +984,7 @@ ivas_error ivas_init_decoder( st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); } #ifdef SBA2MONO - st_ivas->sba_dirac_stereo_flag = ( output_config == AUDIO_CONFIG_STEREO || ( output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) ); + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); #else st_ivas->sba_dirac_stereo_flag = ( output_config == AUDIO_CONFIG_STEREO ); #endif @@ -996,7 +996,11 @@ ivas_error ivas_init_decoder( return error; } +#ifdef SBA2MONO + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); +#else st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && output_config == AUDIO_CONFIG_STEREO ); +#endif } } @@ -1166,7 +1170,11 @@ ivas_error ivas_init_decoder( return error; } +#ifdef SBA2MONO + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); +#else st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && output_config == AUDIO_CONFIG_STEREO ); +#endif if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MCMASA_MONO_STEREO ) { diff --git a/lib_dec/ivas_mcmasa_dec.c b/lib_dec/ivas_mcmasa_dec.c old mode 100644 new mode 100755 index 3ef12f3094..d075bf61da --- a/lib_dec/ivas_mcmasa_dec.c +++ b/lib_dec/ivas_mcmasa_dec.c @@ -76,7 +76,11 @@ ivas_error ivas_mcmasa_dec_reconfig( return error; } +#ifdef SBA2MONO + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); +#else st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && st_ivas->hOutSetup.output_config == AUDIO_CONFIG_STEREO ); +#endif if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MCMASA_MONO_STEREO ) { diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c old mode 100644 new mode 100755 index 8c53538dec..f39951e087 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -707,7 +707,11 @@ static ivas_error ivas_mc_dec_reconfig( { nchan_hp20_old = nchan_transport_old; } +#ifdef SBA2MONO + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); +#else st_ivas->sba_dirac_stereo_flag = 0; /* needs to be after getNumChanSynthesis() */ +#endif /* renderer might have changed, reselect */ renderer_type_old = st_ivas->renderer_type; diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 5bc6adb5bd..bf905457e0 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -117,7 +117,11 @@ ivas_error ivas_sba_dec_reconfigure( return error; } +#ifdef SBA2MONO + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); +#else st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ); +#endif } else { @@ -157,7 +161,7 @@ ivas_error ivas_sba_dec_reconfigure( hSpar = st_ivas->hSpar; #ifdef SBA2MONO - st_ivas->sba_dirac_stereo_flag = (hDecoderConfig->output_config == AUDIO_CONFIG_STEREO || (hDecoderConfig->output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1)); + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); #else st_ivas->sba_dirac_stereo_flag = 0; #endif diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index 464fde49c6..fb39673e62 100755 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -45,6 +45,46 @@ #include "wmc_auto.h" +#ifdef SBA2MONO +/*-------------------------------------------------------------------* + * ivas_get_sba_dirac_stereo_flag() + * + * Set sba_dirac_stereo_flag + *-------------------------------------------------------------------*/ + +int16_t ivas_get_sba_dirac_stereo_flag( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + int16_t sba_dirac_stereo_flag; + AUDIO_CONFIG output_config; + + sba_dirac_stereo_flag = 0; + output_config = st_ivas->hDecoderConfig->output_config; + + if ( st_ivas->ivas_format == SBA_FORMAT || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) + { + if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + { + if ( output_config == AUDIO_CONFIG_STEREO || (output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1) ) + { + sba_dirac_stereo_flag = 1; + } + } + else + { + if ( st_ivas->nchan_transport == 1 && output_config == AUDIO_CONFIG_STEREO ) + { + sba_dirac_stereo_flag = 1; + } + } + } + + return sba_dirac_stereo_flag; +} +#endif + + /*-------------------------------------------------------------------* * ivas_sba_dirac_stereo_config() * -- GitLab From 4658aaf9bbae5d680c6dd58c8740cd0c09d8a322 Mon Sep 17 00:00:00 2001 From: rhb Date: Fri, 31 Mar 2023 17:53:05 +0200 Subject: [PATCH 345/375] clang format --- lib_dec/ivas_corecoder_dec_reconfig.c | 2 +- lib_dec/ivas_dec.c | 3 ++- lib_dec/ivas_output_config.c | 4 +-- lib_dec/ivas_sba_dirac_stereo_dec.c | 36 +++++++++++++-------------- lib_dec/ivas_stereo_dft_dec.c | 22 ++++++++-------- 5 files changed, 34 insertions(+), 33 deletions(-) mode change 100755 => 100644 lib_dec/ivas_corecoder_dec_reconfig.c mode change 100755 => 100644 lib_dec/ivas_dec.c mode change 100755 => 100644 lib_dec/ivas_output_config.c mode change 100755 => 100644 lib_dec/ivas_sba_dirac_stereo_dec.c mode change 100755 => 100644 lib_dec/ivas_stereo_dft_dec.c diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c old mode 100755 new mode 100644 index 883e97475e..62579d35d7 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -297,7 +297,7 @@ ivas_error ivas_corecoder_dec_reconfig( /* if at least one CPE is already available, only allocate DFT Stereo struct */ if ( st_ivas->nCPE > 0 ) { - if ( ( error = stereo_dft_dec_create( &(st_ivas->hCPE[0]->hStereoDft ), st_ivas->hCPE[0]->element_brate, st_ivas->hDecoderConfig->output_Fs, st_ivas->sba_dirac_stereo_flag, st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) + if ( ( error = stereo_dft_dec_create( &( st_ivas->hCPE[0]->hStereoDft ), st_ivas->hCPE[0]->element_brate, st_ivas->hDecoderConfig->output_Fs, st_ivas->sba_dirac_stereo_flag, st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c old mode 100755 new mode 100644 index bfe74db452..2185322025 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -355,7 +355,8 @@ ivas_error ivas_dec( int16_t num_in_ingest; if ( st_ivas->hSpar->hMdDec->td_decorr_flag ) { - num_in_ingest = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order );; + num_in_ingest = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order ); + ; } else { diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c old mode 100755 new mode 100644 index 75e1a0f812..f522a3217d --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -304,9 +304,9 @@ void ivas_renderer_select( if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && #ifdef SBA2MONO - ( output_config != AUDIO_CONFIG_5_1 && output_config != AUDIO_CONFIG_5_1_2 && output_config != AUDIO_CONFIG_5_1_4 && output_config != AUDIO_CONFIG_7_1 && output_config != AUDIO_CONFIG_7_1_4 && output_config != AUDIO_CONFIG_LS_CUSTOM && output_config != AUDIO_CONFIG_MONO && output_config != AUDIO_CONFIG_STEREO ) ) + ( output_config != AUDIO_CONFIG_5_1 && output_config != AUDIO_CONFIG_5_1_2 && output_config != AUDIO_CONFIG_5_1_4 && output_config != AUDIO_CONFIG_7_1 && output_config != AUDIO_CONFIG_7_1_4 && output_config != AUDIO_CONFIG_LS_CUSTOM && output_config != AUDIO_CONFIG_MONO && output_config != AUDIO_CONFIG_STEREO ) ) #else - ( output_config != AUDIO_CONFIG_5_1 && output_config != AUDIO_CONFIG_5_1_2 && output_config != AUDIO_CONFIG_5_1_4 && output_config != AUDIO_CONFIG_7_1 && output_config != AUDIO_CONFIG_7_1_4 && output_config != AUDIO_CONFIG_LS_CUSTOM ) ) + ( output_config != AUDIO_CONFIG_5_1 && output_config != AUDIO_CONFIG_5_1_2 && output_config != AUDIO_CONFIG_5_1_4 && output_config != AUDIO_CONFIG_7_1 && output_config != AUDIO_CONFIG_7_1_4 && output_config != AUDIO_CONFIG_LS_CUSTOM ) ) #endif { if ( output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_FOA ) diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c old mode 100755 new mode 100644 index fb39673e62..82ccaceea9 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -53,7 +53,7 @@ *-------------------------------------------------------------------*/ int16_t ivas_get_sba_dirac_stereo_flag( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { int16_t sba_dirac_stereo_flag; @@ -66,7 +66,7 @@ int16_t ivas_get_sba_dirac_stereo_flag( { if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { - if ( output_config == AUDIO_CONFIG_STEREO || (output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1) ) + if ( output_config == AUDIO_CONFIG_STEREO || ( output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) ) { sba_dirac_stereo_flag = 1; } @@ -494,10 +494,10 @@ static void ivas_sba_dirac_stereo_upmix_hb( const int16_t output_frame, /* i : output frame length per channel */ const int16_t mcmasa, /* i : McMASA flag */ #ifdef SBA2MONO - const int16_t sba_mono_flag, /* i : flag for mono output */ - const int16_t bwidth, /* i : bandwidth of signal */ + const int16_t sba_mono_flag, /* i : flag for mono output */ + const int16_t bwidth, /* i : bandwidth of signal */ #endif - const STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i : Stereo DFT handle for mixing matrix */ + const STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i : Stereo DFT handle for mixing matrix */ ) { int16_t i; @@ -583,14 +583,14 @@ static void ivas_sba_dirac_stereo_upmix_hb( for ( i = 0; i < output_frame / 2; i++ ) { float gp = hStereoDft->mixer_mat_smooth[0][0][8] + hStereoDft->mixer_mat_smooth[1][0][8] + - hStereoDft->mixer_mat_smooth[0][0][9] + hStereoDft->mixer_mat_smooth[1][0][9] + - hStereoDft->mixer_mat_smooth[0][0][10] + hStereoDft->mixer_mat_smooth[1][0][10] + - hStereoDft->mixer_mat_smooth[0][0][11] + hStereoDft->mixer_mat_smooth[1][0][11]; + hStereoDft->mixer_mat_smooth[0][0][9] + hStereoDft->mixer_mat_smooth[1][0][9] + + hStereoDft->mixer_mat_smooth[0][0][10] + hStereoDft->mixer_mat_smooth[1][0][10] + + hStereoDft->mixer_mat_smooth[0][0][11] + hStereoDft->mixer_mat_smooth[1][0][11]; float gm = hStereoDft->mixer_mat_smooth[0][0][8] - hStereoDft->mixer_mat_smooth[1][0][8] + - hStereoDft->mixer_mat_smooth[0][0][9] - hStereoDft->mixer_mat_smooth[1][0][9] + - hStereoDft->mixer_mat_smooth[0][0][10] - hStereoDft->mixer_mat_smooth[1][0][10] + - hStereoDft->mixer_mat_smooth[0][0][11] - hStereoDft->mixer_mat_smooth[1][0][11]; + hStereoDft->mixer_mat_smooth[0][0][9] - hStereoDft->mixer_mat_smooth[1][0][9] + + hStereoDft->mixer_mat_smooth[0][0][10] - hStereoDft->mixer_mat_smooth[1][0][10] + + hStereoDft->mixer_mat_smooth[0][0][11] - hStereoDft->mixer_mat_smooth[1][0][11]; hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * 0.25f * gp; hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * 0.25f * gm; @@ -598,14 +598,14 @@ static void ivas_sba_dirac_stereo_upmix_hb( for ( i = output_frame / 2; i < output_frame; i++ ) { float gp = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; float gm = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + - hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * 0.25f * gp; hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * 0.25f * gm; @@ -986,7 +986,7 @@ void ivas_sba_dirac_stereo_dec( v_add( output[1], hb_synth_stereo[1], output[1], output_frame ); /* apply TD Stereo Filling as is done in ICBWE */ - ivas_sba_dirac_stereo_apply_td_stefi( hStereoDft, output, output_frame, (st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa) ); + ivas_sba_dirac_stereo_apply_td_stefi( hStereoDft, output, output_frame, ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) ); #ifdef SBA2MONO } #endif diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c old mode 100755 new mode 100644 index 0d9b079f2a..769f6016b4 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -1127,12 +1127,12 @@ void stereo_dft_dec( STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ const int16_t sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ #ifdef SBA2MONO - const int16_t sba_mono_flag, /* i : signal mono output for SBA DirAC */ + const int16_t sba_mono_flag, /* i : signal mono output for SBA DirAC */ #endif - ivas_spar_md_dec_state_t *hMdDec, /* i : SPAR MD handle for upmixing */ - const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ - const int32_t output_Fs, /* i : Fs for delay calculation */ - const int16_t nchan_transport /* i : number of transpor channels */ + ivas_spar_md_dec_state_t *hMdDec, /* i : SPAR MD handle for upmixing */ + const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ + const int32_t output_Fs, /* i : Fs for delay calculation */ + const int16_t nchan_transport /* i : number of transpor channels */ ) { int16_t i, k, b, N_div, stop; @@ -1430,11 +1430,11 @@ void stereo_dft_dec( } for ( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) { - DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + (hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS]) * DFT_PRED_RES[2 * i]; + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + ( hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i]; DFT_L[2 * i] = DFT_W; DFT_R[2 * i] = 0.f; - DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + (hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS]) * DFT_PRED_RES[2 * i + 1]; + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + ( hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i + 1]; DFT_L[2 * i + 1] = DFT_W; DFT_R[2 * i + 1] = 0.f; } @@ -1470,14 +1470,14 @@ void stereo_dft_dec( } for ( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) { - DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + (hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS]) * DFT_PRED_RES[2 * i]; - DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + (hStereoDft->mixer_mat_smooth[1][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][b + k * IVAS_MAX_NUM_BANDS]) * DFT_PRED_RES[2 * i]; + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + ( hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + ( hStereoDft->mixer_mat_smooth[1][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i]; DFT_L[2 * i] = DFT_W + DFT_Y; DFT_R[2 * i] = DFT_W - DFT_Y; - DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + (hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS]) * DFT_PRED_RES[2 * i + 1]; - DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + (hStereoDft->mixer_mat_smooth[1][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][b + k * IVAS_MAX_NUM_BANDS]) * DFT_PRED_RES[2 * i + 1]; + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + ( hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i + 1]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + ( hStereoDft->mixer_mat_smooth[1][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i + 1]; DFT_L[2 * i + 1] = DFT_W + DFT_Y; DFT_R[2 * i + 1] = DFT_W - DFT_Y; -- GitLab From ef8970d96e6ef7cc6974b530e37d2811e8e825a5 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 3 Apr 2023 09:12:08 +0200 Subject: [PATCH 346/375] white spaces --- lib_enc/ivas_cpe_enc.c | 2 +- lib_enc/ivas_omasa_enc.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 128c63b114..0b0d03cd09 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -289,7 +289,7 @@ ivas_error ivas_cpe_enc( { #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_NONE ) - { + { stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, (int32_t) ( 0.70f * st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); } else diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 2ec461d5f9..ef87fd21e4 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -948,7 +948,6 @@ static void ivas_omasa_param_est_enc( float intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; float direction_vector[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; float diffuseness_vector[MASA_FREQUENCY_BANDS]; - int16_t band_m_idx, block_m_idx; float renormalization_factor_diff[MASA_FREQUENCY_BANDS]; float norm_tmp; @@ -958,7 +957,6 @@ static void ivas_omasa_param_est_enc( num_freq_bands = hOMasa->nbands; l_ts = input_frame / CLDFB_NO_COL_MAX; - /* Need to initialize renormalization_factors, and variables to be normalized */ set_zero( renormalization_factor_diff, hOMasa->nbands ); set_zero( diffuseness_m, hOMasa->nbands ); @@ -1282,7 +1280,6 @@ static void ivas_omasa_dmx( } } - return; } -- GitLab From a6786399666a636b12605fed878db379a9e7ee49 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 3 Apr 2023 10:47:56 +0200 Subject: [PATCH 347/375] fix memory deallocation in bitrate switching --- lib_dec/ivas_omasa_dec.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 6d9e3df5f4..2389512da3 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -158,7 +158,11 @@ ivas_error ivas_omasa_dec_config( st_ivas->ism_mode = ism_mode_old; ivas_format_old = st_ivas->ivas_format; +#ifdef OMASA_UPDATES + if ( ism_mode_old == ISM_MASA_MODE_MASA_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_PARAM_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_DISC ) +#else if ( ism_mode_old == ISM_MASA_MODE_PARAM || ism_mode_old == ISM_MASA_MODE_PARAM_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_DISC ) +#endif { st_ivas->ivas_format = MASA_ISM_FORMAT; } @@ -342,16 +346,7 @@ ivas_error ivas_omasa_dec_config( else if ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) #endif { - // VE: use ivas_masa_ism_data_close() instead? - for ( n = 0; n < st_ivas->hMasaIsmData->delayBuffer_nchan; n++ ) - { - free( st_ivas->hMasaIsmData->delayBuffer[n] ); - } - free( st_ivas->hMasaIsmData->delayBuffer ); - st_ivas->hMasaIsmData->delayBuffer = NULL; - - free( st_ivas->hIsmRendererData ); - st_ivas->hIsmRendererData = NULL; + ivas_masa_ism_data_close( &( st_ivas->hMasaIsmData ) ); } #ifdef OMASA_UPDATES -- GitLab From e05ea4c7a9380d06ddd3d7dde4476368cb1f37fc Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 3 Apr 2023 11:28:37 +0200 Subject: [PATCH 348/375] remove obsolete callings of ivas_masa_ism_separate_object_renderer_open() --- lib_dec/ivas_init_dec.c | 12 --------- lib_dec/ivas_omasa_dec.c | 57 +++------------------------------------- 2 files changed, 3 insertions(+), 66 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 035cc5f430..88200f017d 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1238,18 +1238,6 @@ ivas_error ivas_init_decoder( { reset_indices_dec( st_ivas->hCPE[0]->hCoreCoder[n] ); } - -#ifdef OMASA_UPDATES - if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#else - if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#endif - { - if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } } #endif else if ( st_ivas->ivas_format == MC_FORMAT ) diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 2389512da3..52e1dc0ea1 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -143,7 +143,7 @@ ivas_error ivas_omasa_dec_config( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { - int16_t k, n, sce_id, nSCE_old, nchan_hp20_old, numCldfbAnalyses_old, numCldfbSyntheses_old, n_MD; + int16_t k, sce_id, nSCE_old, nchan_hp20_old, numCldfbAnalyses_old, numCldfbSyntheses_old, n_MD; int32_t ivas_total_brate, ism_total_brate, cpe_brate; IVAS_FORMAT ivas_format_old; ISM_MODE ism_mode_old; @@ -290,60 +290,9 @@ ivas_error ivas_omasa_dec_config( /* objects renderer reconfig. */ #ifdef OMASA_UPDATES - if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) + if ( st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) #else - if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#endif - { - if ( st_ivas->hIsmRendererData == NULL ) - { - if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#ifdef OMASA_UPDATES - else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - else if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#endif - { - for ( n = 1; n < st_ivas->hMasaIsmData->delayBuffer_nchan; n++ ) - { - free( st_ivas->hMasaIsmData->delayBuffer[n] ); - } - - st_ivas->hMasaIsmData->delayBuffer_nchan = 1; - } - else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - float tmp[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; - - st_ivas->hMasaIsmData->delayBuffer_nchan = st_ivas->nchan_ism; - - mvr2r( st_ivas->hMasaIsmData->delayBuffer[0], tmp, st_ivas->hMasaIsmData->delayBuffer_size ); - free( st_ivas->hMasaIsmData->delayBuffer[0] ); - free( st_ivas->hMasaIsmData->delayBuffer ); - if ( ( st_ivas->hMasaIsmData->delayBuffer = (float **) malloc( st_ivas->hMasaIsmData->delayBuffer_nchan * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); - } - - for ( n = 0; n < st_ivas->hMasaIsmData->delayBuffer_nchan; n++ ) - { - if ( ( st_ivas->hMasaIsmData->delayBuffer[n] = (float *) malloc( st_ivas->hMasaIsmData->delayBuffer_size * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); - } - set_zero( st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size ); - } - mvr2r( tmp, st_ivas->hMasaIsmData->delayBuffer[0], st_ivas->hMasaIsmData->delayBuffer_size ); - } - } -#ifdef OMASA_UPDATES - else if ( st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) -#else - else if ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) + if ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) #endif { ivas_masa_ism_data_close( &( st_ivas->hMasaIsmData ) ); -- GitLab From f9afcb5446fdb626ded2b6234aeb73293c0a2110 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 3 Apr 2023 11:48:15 +0200 Subject: [PATCH 349/375] fix memory deallocation in bitrate switching --- lib_dec/ivas_init_dec.c | 4 ++-- lib_dec/ivas_omasa_dec.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 88200f017d..60e024383f 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1517,7 +1517,7 @@ ivas_error ivas_init_decoder( // VE: introduce a new renderer_type for this case if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL ) { - /* Use td renderer for the objects in DISC mode */ + /* Allocate TD renderer for the objects in DISC mode */ error = ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_ism, st_ivas->ivas_format, st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); if ( ( error ) != IVAS_ERR_OK ) @@ -1525,7 +1525,7 @@ ivas_error ivas_init_decoder( return error; } - /* Reserve memory for delay buffer */ + /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 52e1dc0ea1..b32a76b431 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -302,7 +302,7 @@ ivas_error ivas_omasa_dec_config( // VE: introduce a new renderer_type for this case if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) { - /* Use td renderer for the objects in DISC mode */ + /* Allocate TD renderer for the objects in DISC mode */ if ( ( error = ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_ism, st_ivas->ivas_format, st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ) ) != IVAS_ERR_OK ) @@ -310,7 +310,7 @@ ivas_error ivas_omasa_dec_config( return error; } - /* Reserve memory for delay buffer */ + /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; @@ -318,6 +318,7 @@ ivas_error ivas_omasa_dec_config( } else { + /* TD renderer handle */ if ( st_ivas->hBinRendererTd != NULL ) { ivas_td_binaural_close( &st_ivas->hBinRendererTd ); @@ -327,6 +328,13 @@ ivas_error ivas_omasa_dec_config( { st_ivas->hHrtfTD = NULL; } + + /* ISM renderer handle */ + if ( st_ivas->hIsmRendererData != NULL ) + { + free( st_ivas->hIsmRendererData ); + st_ivas->hIsmRendererData = NULL; + } } #endif } -- GitLab From 26a34518f96c44647368b9abb3e13b050823a6c0 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 3 Apr 2023 12:51:11 +0200 Subject: [PATCH 350/375] - use native instead of wrapper functions for TD renderer - re-activate FIX_350_MASA_DELAY_COMP and FIX_382_MASA_META_FRAMING_ASYNC - compilation fixes when MASA_AND_OBJECTS is disabled --- lib_com/options.h | 4 +-- lib_dec/ivas_dec.c | 4 +-- lib_dec/ivas_init_dec.c | 8 +----- lib_dec/ivas_ism_metadata_dec.c | 2 ++ lib_dec/ivas_objectRenderer_internal.c | 37 +++++++++++++++++++++----- lib_dec/ivas_omasa_dec.c | 4 +-- lib_enc/ivas_ism_enc.c | 6 ++++- lib_enc/ivas_ism_metadata_enc.c | 2 +- lib_enc/ivas_masa_enc.c | 14 +++++----- 9 files changed, 52 insertions(+), 29 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 7eb9eb4f35..6d0f913e0e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -144,12 +144,12 @@ #define FIX_103_RA_PARAMS_PARAM_BIN_REND /* Issue 103: Digest room acoustics parameters for Parametric Binaural Renderer*/ /*#define SBA_HPF_TUNING_DEC*/ -//#define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ +#define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ #define FIX_MDCT_BASED_BWD /* FhG: fixes for BWD for issues with reaction to transients for MDCT-stereo and MCT */ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ #define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ -//#define FIX_382_MASA_META_FRAMING_ASYNC /* Nokia: Issue 382: detect potential MASA metadata framing offset */ +#define FIX_382_MASA_META_FRAMING_ASYNC /* Nokia: Issue 382: detect potential MASA metadata framing offset */ #define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ #ifdef MASA_AND_OBJECTS diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 4ceb3d5019..10147488c0 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -607,9 +607,7 @@ ivas_error ivas_dec( ivas_dirac_dec_binaural( st_ivas, output, st_ivas->nchan_transport ); - if ( ( error = ivas_td_binaural_renderer_unwrap( st_ivas->hReverb, st_ivas->transport_config, st_ivas->hBinRendererTd, st_ivas->nchan_ism, LFE_CHANNEL, st_ivas->ivas_format, - st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, - ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, data_separated_objects, output_frame ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_renderer( st_ivas, data_separated_objects, output_frame ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 60e024383f..e8fccfb9cf 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1518,9 +1518,7 @@ ivas_error ivas_init_decoder( if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL ) { /* Allocate TD renderer for the objects in DISC mode */ - error = ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_ism, st_ivas->ivas_format, - st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); - if ( ( error ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -1865,11 +1863,7 @@ void ivas_destroy_dec( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) { -#ifdef OMASA_BRATE_SW int16_t i; -#else - int16_t i, n; -#endif /* CLDFB handles */ for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 4a0c8eb4f7..c28478b0ab 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -180,7 +180,9 @@ ivas_error ivas_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG int16_t md_diff_flag[MAX_NUM_OBJECTS]; #endif +#ifdef MASA_AND_OBJECTS ivas_error error; +#endif push_wmops( "ism_meta_dec" ); diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index f1c1fc04f2..2b24b08398 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -53,8 +53,22 @@ ivas_error ivas_td_binaural_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { +#ifdef MASA_AND_OBJECTS + int16_t num_src; + + num_src = st_ivas->nchan_transport; + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + num_src = st_ivas->nchan_ism; + } + + return ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, num_src, st_ivas->ivas_format, + st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); +#else + return ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport, st_ivas->ivas_format, st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); +#endif } @@ -71,10 +85,21 @@ ivas_error ivas_td_binaural_renderer( const int16_t output_frame /* i : output frame length */ ) { - return ivas_td_binaural_renderer_unwrap( - st_ivas->hReverb, - st_ivas->transport_config, - st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, - st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, - ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, output, output_frame ); +#ifdef MASA_AND_OBJECTS + int16_t num_src; + + num_src = st_ivas->nchan_transport; + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + num_src = st_ivas->nchan_ism; + } + + return ivas_td_binaural_renderer_unwrap( st_ivas->hReverb, st_ivas->transport_config, st_ivas->hBinRendererTd, num_src, LFE_CHANNEL, st_ivas->ivas_format, + st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, + ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, output, output_frame ); +#else + return ivas_td_binaural_renderer_unwrap( st_ivas->hReverb, st_ivas->transport_config, st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, + st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, + ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, output, output_frame ); +#endif } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index b32a76b431..1afaa4696b 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -303,9 +303,7 @@ ivas_error ivas_omasa_dec_config( if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) { /* Allocate TD renderer for the objects in DISC mode */ - if ( ( error = ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_ism, st_ivas->ivas_format, - st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, - &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 093b653a93..60dfcf7acc 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -355,7 +355,11 @@ ivas_error ivas_ism_enc( } #else - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, ); + ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, +#ifdef NCHAN_ISM_PARAMETER + nchan_ism, +#endif + st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #endif } diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 1c84021747..3bf642b85b 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -312,7 +312,7 @@ ivas_error ivas_ism_metadata_enc( #ifdef MASA_AND_OBJECTS if ( ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) && nchan_ism == 2 ) #else - if ( ism_mode == ISM_MODE_DISC && num_obj == 2 ) + if ( ism_mode == ISM_MODE_DISC && nchan_ism == 2 ) #endif { float diff_F; diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 7c85b6188f..28989065a2 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -85,16 +85,16 @@ static void remove_sep_obj( int16_t *diff_idx, const int16_t nchan_ism, const in static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); #endif -#ifdef FIX_382_MASA_META_FRAMING_ASYNC -static void average_masa_metadata( MASA_METADATA_FRAME *masaMetadata, float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] ); +#ifndef MASA_AND_OBJECTS +static void combine_directions( MASA_ENCODER_HANDLE hMasa ); +#endif -static void copy_masa_metadata_subframe( const MASA_METADATA_HANDLE hMetaFrom, const uint8_t sfFrom, MASA_METADATA_HANDLE hMetaTo, const uint8_t sfTo ); +#ifdef FIX_382_MASA_META_FRAMING_ASYNC +static void detect_framing_async( MASA_ENCODER_HANDLE hMasa ); -static void copy_masa_metadata( const MASA_METADATA_HANDLE hMetaFrom, MASA_METADATA_HANDLE hMetaTo ); +static void average_masa_metadata( MASA_METADATA_FRAME *hMeta, float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] ); static uint8_t are_masa_subframes_similar( const MASA_METADATA_HANDLE frame1, const uint8_t sf1_idx, const MASA_METADATA_HANDLE frame2, const uint8_t sf2_idx ); - -static void detect_framing_async( MASA_ENCODER_HANDLE hMasa ); #endif /*-----------------------------------------------------------------------* @@ -1644,10 +1644,12 @@ static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format +#ifdef MASA_AND_OBJECTS #ifndef OMASA_UPDATES , const ISM_MODE ism_mode #endif +#endif ) { int16_t sf; -- GitLab From cea27718456a826df71ee1badd569f7e61d1b92b Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 4 Apr 2023 15:16:26 +1000 Subject: [PATCH 351/375] minor change to PCA decoder call --- lib_dec/ivas_dec.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 2185322025..f89a64bf3e 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -352,17 +352,7 @@ ivas_error ivas_dec( if ( st_ivas->hSpar->hPCA != NULL ) { - int16_t num_in_ingest; - if ( st_ivas->hSpar->hMdDec->td_decorr_flag ) - { - num_in_ingest = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order ); - ; - } - else - { - num_in_ingest = st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport; - } - ivas_pca_dec( st_ivas->hSpar->hPCA, output_frame, num_in_ingest, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, output ); + ivas_pca_dec( st_ivas->hSpar->hPCA, output_frame, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, output ); } #endif -- GitLab From 3645ec6d798e89ce08082538297e77e1fcfbc2c8 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 4 Apr 2023 09:17:37 +0200 Subject: [PATCH 352/375] Issue 386: Resolve ToDo comments in CoreCoder reconfig.; under FIX_386_CORECODER_RECONFIG --- lib_com/ivas_prot.h | 6 ++++ lib_com/options.h | 3 +- lib_dec/ivas_corecoder_dec_reconfig.c | 7 ++++ lib_dec/ivas_init_dec.c | 4 +++ lib_dec/ivas_sba_dec.c | 50 +++++++++++++++++++++++++++ lib_enc/ivas_corecoder_enc_reconfig.c | 4 +++ 6 files changed, 73 insertions(+), 1 deletion(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 04866530c1..64d08afe8a 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3225,6 +3225,12 @@ void ivas_sba_config( int16_t *element_mode /* o : element mode of the core coder */ ); +#ifdef FIX_386_CORECODER_RECONFIG +void ivas_sba_set_cna_cng_flag( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); +#endif + ivas_error ivas_sba_dec_reconfigure( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); diff --git a/lib_com/options.h b/lib_com/options.h index f0f86f814d..8b4fad8454 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -148,8 +148,9 @@ #define FIX_MDCT_BASED_BWD /* FhG: fixes for BWD for issues with reaction to transients for MDCT-stereo and MCT */ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ #define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ - #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. */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index a066164da4..4723532dae 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -297,6 +297,12 @@ ivas_error ivas_corecoder_dec_reconfig( * Set CNA/CNG flags *-----------------------------------------------------------------*/ +#ifdef FIX_386_CORECODER_RECONFIG + if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) + { + ivas_sba_set_cna_cng_flag( st_ivas ); + } +#else /// VE: this could be merged with part of ivas_init_decoder() if ( st_ivas->ivas_format == SBA_FORMAT ) { @@ -329,6 +335,7 @@ ivas_error ivas_corecoder_dec_reconfig( } } } +#endif /* special case, if the decoder goes from 1TC DTX to 2TC active frame (in case the bitstream started with an SBA SID frame), allocate DTX memories */ if ( hDecoderConfig->last_ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE >= 1 ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 5c19eca256..b5f251945f 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1049,6 +1049,9 @@ ivas_error ivas_init_decoder( } /* set CNA/CNG flags */ +#ifdef FIX_386_CORECODER_RECONFIG + ivas_sba_set_cna_cng_flag( st_ivas ); +#else if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->nchan_transport == 1 ) { st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 0; /* Todo: Check if these can be enabled */ @@ -1067,6 +1070,7 @@ ivas_error ivas_init_decoder( st_ivas->hCPE[0]->hCoreCoder[n]->cng_sba_flag = 1; } } +#endif } else if ( st_ivas->ivas_format == MC_FORMAT ) { diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 745ea1b9ba..68b9909ea5 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -46,6 +46,56 @@ #endif #include "wmc_auto.h" + +#ifdef FIX_386_CORECODER_RECONFIG +/*-------------------------------------------------------------------* + * ivas_sba_set_cna_cng_flag() + * + * Set CNA/CNG flags in IVAS SBA decoder + *-------------------------------------------------------------------*/ + +void ivas_sba_set_cna_cng_flag( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + int16_t n, cpe_id; + + if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->nchan_transport == 1 ) + { + /* skip as done in init function */ + /* st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 0; */ /* Todo: Check if these can be enabled */ + /* st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 0; */ + } + else if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) ) + { + st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 1; + st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1; + } + else if ( st_ivas->nchan_transport == 2 ) + { + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + st_ivas->hCPE[0]->hCoreCoder[n]->cna_dirac_flag = 0; /* Todo: Check if these can be enabled */ + st_ivas->hCPE[0]->hCoreCoder[n]->cng_sba_flag = 1; + } + } + else + { + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cna_dirac_flag = 0; + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cng_sba_flag = 0; + } + } + } + + return; +} +#endif + + /*-------------------------------------------------------------------* * ivas_sba_dec_reconfigure() * diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index e9d6968f1b..cfe3a1badf 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -211,7 +211,11 @@ ivas_error ivas_corecoder_enc_reconfig( { if ( n_CoreCoder_existing > cpe_id * CPE_CHANNELS + n ) { +#ifdef FIX_386_CORECODER_RECONFIG + mvr2r( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_buff, input_buff[( cpe_id - st_ivas->nCPE ) * CPE_CHANNELS + n], len_inp_memory ); +#else mvr2r( st_ivas->hCPE[cpe_id]->hCoreCoder[0]->input_buff, input_buff[( cpe_id - st_ivas->nCPE ) * CPE_CHANNELS + n], len_inp_memory ); /* TODO VoiceAge: Please check if this should be hCoreCoder[n] */ +#endif } } -- GitLab From 5353d292e59657b8268c79cd45cc18c5d9f3c4df Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 4 Apr 2023 11:18:13 +0200 Subject: [PATCH 353/375] wrap contribution additions in switch --- lib_rend/ivas_dirac_dec_binaural_functions.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 0fa759bed4..a0691caca8 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -40,7 +40,9 @@ #include "ivas_cnst.h" #include "ivas_rom_binauralRenderer.h" #include "ivas_rom_rend.h" +#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS #include "ivas_rom_com.h" +#endif #ifdef DEBUGGING #include "debug.h" @@ -84,7 +86,9 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( Decoder_Struc static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float output_f[][L_FRAME48k], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const uint8_t numInputChannels, const uint8_t firstSlot, const uint8_t slotEnd ); +#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS static void adaptTransportSignalsHeadtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, const uint8_t nBins, float Rmat[3][3] ); +#endif static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, const uint8_t nBins, float Rmat[3][3] ); @@ -580,7 +584,9 @@ static void ivas_dirac_dec_binaural_internal( if ( nchan_transport == 2 ) { +#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS adaptTransportSignalsHeadtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, firstSlot, slotEnd, nBins, Rmat ); +#endif ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( st_ivas->hHeadTrackData, Cldfb_ImagBuffer_in, Cldfb_RealBuffer_in, firstSlot, slotEnd, nBins, Rmat ); } -- GitLab From 07a7b6986623df5250e16f9132925b87b70aee1c Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 4 Apr 2023 14:04:48 +0300 Subject: [PATCH 354/375] Apply clang format patch. --- lib_rend/ivas_dirac_dec_binaural_functions.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 336083e9af..b27462d649 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1948,4 +1948,3 @@ static float configure_reqularization_factor( return reqularizationFactor; } #endif - -- GitLab From b769df669a980a8120cb4bd222f89fd0ba55e80e Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 4 Apr 2023 14:11:04 +0200 Subject: [PATCH 355/375] [fix] crash with headtracking - out of bounds write (array size was changed to MASA_FREQUENCY_BANDS instead of CLDFB_NO_CHANNELS_MAX under _OPT switch) --- lib_rend/ivas_hrtf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib_rend/ivas_hrtf.c b/lib_rend/ivas_hrtf.c index 5a38af5514..3f5fc08f98 100644 --- a/lib_rend/ivas_hrtf.c +++ b/lib_rend/ivas_hrtf.c @@ -236,10 +236,17 @@ ivas_error ivas_headTrack_open( } #ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS +#ifdef NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT + set_zero( ( *hHeadTrackData )->chEneIIR[0], MASA_FREQUENCY_BANDS ); + set_zero( ( *hHeadTrackData )->chEneIIR[1], MASA_FREQUENCY_BANDS ); + set_zero( ( *hHeadTrackData )->procChEneIIR[0], MASA_FREQUENCY_BANDS ); + set_zero( ( *hHeadTrackData )->procChEneIIR[1], MASA_FREQUENCY_BANDS ); +#else set_zero( ( *hHeadTrackData )->chEneIIR[0], CLDFB_NO_CHANNELS_MAX ); set_zero( ( *hHeadTrackData )->chEneIIR[1], CLDFB_NO_CHANNELS_MAX ); set_zero( ( *hHeadTrackData )->procChEneIIR[0], CLDFB_NO_CHANNELS_MAX ); set_zero( ( *hHeadTrackData )->procChEneIIR[1], CLDFB_NO_CHANNELS_MAX ); +#endif #endif return IVAS_ERR_OK; -- GitLab From 59cf37d1b8f4c462069bee5e876a48246c552904 Mon Sep 17 00:00:00 2001 From: Auto Commit Date: Tue, 4 Apr 2023 11:17:26 -0400 Subject: [PATCH 356/375] first tuning version, vaclav find it takes off too much ambiance --- Workspace_msvc/decoder.vcxproj | 6 ++--- Workspace_msvc/encoder.vcxproj | 8 +++---- Workspace_msvc/lib_com.vcxproj | 8 +++---- Workspace_msvc/lib_debug.vcxproj | 8 +++---- Workspace_msvc/lib_dec.vcxproj | 8 +++---- Workspace_msvc/lib_enc.vcxproj | 8 +++---- Workspace_msvc/lib_rend.vcxproj | 8 +++---- Workspace_msvc/lib_util.vcxproj | 8 +++---- Workspace_msvc/renderer.vcxproj | 8 +++---- lib_com/ivas_prot.h | 13 +++++++++++ lib_com/ivas_stereo_td_bit_alloc.c | 24 +++++++++++++++----- lib_com/options.h | 7 +++--- lib_dec/ivas_cpe_dec.c | 6 ++++- lib_dec/ivas_stereo_td_dec.c | 10 ++++++++- lib_enc/ivas_cpe_enc.c | 22 ++++++++++++++----- lib_enc/ivas_omasa_enc.c | 2 +- lib_enc/ivas_stereo_classifier.c | 13 +++++++++++ lib_enc/ivas_stereo_td_analysis.c | 12 +++++++++- lib_enc/ivas_stereo_td_enc.c | 35 ++++++++++++++++++++++-------- 19 files changed, 152 insertions(+), 62 deletions(-) diff --git a/Workspace_msvc/decoder.vcxproj b/Workspace_msvc/decoder.vcxproj index e59992847c..f0016965e0 100644 --- a/Workspace_msvc/decoder.vcxproj +++ b/Workspace_msvc/decoder.vcxproj @@ -14,18 +14,18 @@ decoder {E3DCBC31-7FC9-D127-E000-529F8460D5FD} decoder - 10.0.17763.0 + 10.0 Application - v141 + v142 false MultiByte Application - v141 + v142 false MultiByte diff --git a/Workspace_msvc/encoder.vcxproj b/Workspace_msvc/encoder.vcxproj index bcfe92a4db..fc7e189560 100644 --- a/Workspace_msvc/encoder.vcxproj +++ b/Workspace_msvc/encoder.vcxproj @@ -18,24 +18,24 @@ encoder {B3FC9DFC-7268-8660-7C0D-B60BAF02C554} encoder - 10.0.17763.0 + 10.0 Application - v141 + v142 false MultiByte Application - v141 + v142 false MultiByte Application - v141 + v142 false MultiByte diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 78ed7bb39d..ed8012c4d3 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -17,24 +17,24 @@ {39EC200D-7795-4FF8-B214-B24EDA5526AE} common - 10.0.17763.0 + 10.0 StaticLibrary - v141 + v142 false MultiByte StaticLibrary - v141 + v142 false MultiByte StaticLibrary - v141 + v142 false MultiByte diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj index 3b648fae04..6a5e102b0c 100644 --- a/Workspace_msvc/lib_debug.vcxproj +++ b/Workspace_msvc/lib_debug.vcxproj @@ -17,22 +17,22 @@ {54509728-928B-44D9-A118-A6F92F08B34F} debug - 10.0.17763.0 + 10.0 StaticLibrary - v141 + v142 MultiByte StaticLibrary - v141 + v142 MultiByte StaticLibrary - v141 + v142 MultiByte true diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index dd2ed44443..facb2d3bc3 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -18,24 +18,24 @@ lib_dec {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} evs_dec - 10.0.17763.0 + 10.0 StaticLibrary - v141 + v142 false MultiByte StaticLibrary - v141 + v142 false MultiByte StaticLibrary - v141 + v142 false MultiByte diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj index af7ca35b12..eede51cfde 100644 --- a/Workspace_msvc/lib_enc.vcxproj +++ b/Workspace_msvc/lib_enc.vcxproj @@ -18,24 +18,24 @@ lib_enc {824DA4CF-06F0-45C9-929A-8792F0E19C3E} evs_enc - 10.0.17763.0 + 10.0 StaticLibrary - v141 + v142 false MultiByte StaticLibrary - v141 + v142 false MultiByte StaticLibrary - v141 + v142 false MultiByte diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index 865652649a..1cb397d10f 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -18,24 +18,24 @@ lib_rend {718DE063-A18B-BB72-9150-62B892E6FFA6} evs_dec - 10.0.17763.0 + 10.0 StaticLibrary - v141 + v142 false MultiByte StaticLibrary - v141 + v142 false MultiByte StaticLibrary - v141 + v142 false MultiByte diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index 5b5e5f30cc..d1a1a8d818 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -17,22 +17,22 @@ {2FA8F384-0775-F3B7-F8C3-85209222FC70} utility - 10.0.17763.0 + 10.0 StaticLibrary - v141 + v142 MultiByte StaticLibrary - v141 + v142 MultiByte StaticLibrary - v141 + v142 MultiByte true diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj index 94ad9f774e..d90b4a6251 100644 --- a/Workspace_msvc/renderer.vcxproj +++ b/Workspace_msvc/renderer.vcxproj @@ -18,24 +18,24 @@ renderer {12B4C8A5-1E06-4E30-B443-D1F916F52B47} renderer - 10.0.17763.0 + 10.0 Application - v141 + v142 false MultiByte Application - v141 + v142 false MultiByte Application - v141 + v142 false MultiByte diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index bfae9aa4a6..56ec490530 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1766,6 +1766,9 @@ int16_t select_stereo_mode( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int32_t ivas_total_brate /* i : IVAS total brate */ +#ifdef OMASA_TUNING + ,const int16_t isOmasa /* i : Flag to indicate that Omasa is present */ +#endif ); void stereo_classifier_init( @@ -1851,6 +1854,10 @@ void tdm_configure_dec( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t *tdm_ratio_idx, /* o : ratio index */ const int16_t nb_bits_metadata /* i : number of metadata bits */ +#ifdef OMASA_TUNING + ,const int16_t IsOmasa /* i : flag that indicate the presence of Omasa*/ +#endif + ); void tdm_upmix_plain( @@ -1904,6 +1911,9 @@ void tdm_configure_enc( const int16_t tdm_ratio_idx_SM, /* i : ratio index in SM mode */ const int16_t attack_flag, /* i : Primary channel attack flag */ const int16_t nb_bits_metadata /* i : number of metadata bits */ +#ifdef OMASA_TUNING + ,const int16_t IsOmasa /* i : flag that indicate the presence of Omasa*/ +#endif ); ivas_error signaling_enc_secondary( @@ -1927,6 +1937,9 @@ void tdm_bit_alloc( const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const int16_t coder_type0, /* i : coder type (temporary in the encoder, from bitstream in decoder) */ const int16_t tdm_inst_ratio_idx /* i : instantaneous correlation ratio index */ +#ifdef OMASA_TUNING + ,const int16_t IsOmasa /* i : Flag that indicates presence of OMASA */ +#endif ); void td_stereo_param_updt( diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index 8b93558b21..b6d3f214b3 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -88,6 +88,9 @@ void tdm_bit_alloc( const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const int16_t coder_type0, /* i : coder type (temporary in the encoder, from bitstream in decoder) */ const int16_t tdm_inst_ratio_idx_ref /* i : instantaneous correlation ratio idx */ +#ifdef OMASA_TUNING + ,const int16_t IsOmasa /* i : Flag that indicates presence of OMASA */ +#endif ) { int16_t idx, four_subfr_fcb, two_subfr_fcb; @@ -136,7 +139,12 @@ void tdm_bit_alloc( *total_brate_sec = tdm_bit_allc_tbl[idx][coder_type]; /* secondary channel bitrate allocation based on the energy scaling ratio */ +#ifdef OMASA_TUNING + if ( (IsOmasa == 0 && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || + ( IsOmasa == 1 && coder_type > UNVOICED ) ) +#else if ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) +#endif { bit_rate_diff = (float) ( element_brate_wo_meta - 2 * *total_brate_sec ); @@ -404,11 +412,11 @@ void tdm_bit_alloc( } *total_brate_sec += ( fast_FCB_rates_2sfr[idx] - tmp_rate ); } - /* prevent 2.4 kb/s and 2.8 kb/s as they are reserved bitrates for DTX and VBR */ - if ( *total_brate_sec == PPP_NELP_2k80 || *total_brate_sec == SID_2k40 ) - { - *total_brate_sec += 100; - } + ///* prevent 2.4 kb/s and 2.8 kb/s as they are reserved bitrates for DTX and VBR */ + //if ( *total_brate_sec == PPP_NELP_2k80 || *total_brate_sec == SID_2k40 ) + //{ + // *total_brate_sec += 100; + //} /* To prevent 13.2 kb/s for primary channel as some bitstream issues arrise with it */ if ( element_brate_wo_meta - *total_brate_sec == ACELP_13k20 ) @@ -416,7 +424,11 @@ void tdm_bit_alloc( *total_brate_sec += 100; } } - + /* prevent 2.4 kb/s and 2.8 kb/s as they are reserved bitrates for DTX and VBR */ + if ( *total_brate_sec == PPP_NELP_2k80 || *total_brate_sec == SID_2k40 ) + { + *total_brate_sec += 100; + } *total_brate_pri = element_brate_wo_meta - *total_brate_sec; return; diff --git a/lib_com/options.h b/lib_com/options.h index d0718997f5..b4d5642711 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,12 +58,12 @@ #ifdef DEBUGGING -/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ +#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO -/*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ +#define DEBUG_MODE_ACELP /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_DFT */ /* output most important DFT stereo parameters to the subdirectory "res/" */ -/*#define DEBUG_MODE_TD*/ /* output most important TD stereo parameters to the subdirectory "res/ */ +#define DEBUG_MODE_TD /* output most important TD stereo parameters to the subdirectory "res/ */ /*#define DEBUG_MODE_DIRAC*/ /* output most important DIRAC parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_MDCT*/ /* output most important MDCT parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_PARAM_MC */ /* output Parametric MC paramters to the subdirectory "res/" */ @@ -172,6 +172,7 @@ #define OMASA_BRATE_SW /* VA: support of bitrate switching in OMASA format */ #define FIX_TD5_IN_OMASA // do not transmit extended MD in OMASA +#define OMASA_TUNING #endif /* MASA_AND_OBJECTS */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index b52c2ea054..d699511690 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -413,7 +413,11 @@ ivas_error ivas_cpe_dec( { if ( !st_ivas->bfi ) { - tdm_configure_dec( hCPE, &tdm_ratio_idx, nb_bits_metadata ); + tdm_configure_dec( hCPE, &tdm_ratio_idx, nb_bits_metadata +#ifdef OMASA_TUNING + , (st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_24k4)) +#endif + ); sts[1]->bit_stream = sts[0]->bit_stream + ( sts[0]->total_brate / FRAMES_PER_SEC ); } diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index 31b66044c6..7cfa3d92fd 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -87,6 +87,10 @@ void tdm_configure_dec( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t *tdm_ratio_idx, /* o : ratio index */ const int16_t nb_bits_metadata /* i : number of metadata bits */ +#ifdef OMASA_TUNING + ,const int16_t IsOmasa /* i : flag that indicate the presence of Omasa*/ +#endif + ) { STEREO_TD_DEC_DATA_HANDLE hStereoTD; @@ -308,7 +312,11 @@ void tdm_configure_dec( tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, - sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx ); + sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx +#ifdef OMASA_TUNING + ,IsOmasa +#endif + ); #else tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx ); #endif diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 128c63b114..53a30ce4d5 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -169,12 +169,20 @@ ivas_error ivas_cpe_enc( #ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM && ivas_total_brate == IVAS_48k ) { - hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, IVAS_32k ); + hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, IVAS_32k +#ifdef OMASA_TUNING + ,st_ivas->hOMasa!=NULL +#endif + ); } else { #endif - hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate ); + hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate +#ifdef OMASA_TUNING + ,st_ivas->hOMasa!=NULL +#endif + ); #ifdef OMASA_UPDATES } #endif @@ -579,7 +587,11 @@ ivas_error ivas_cpe_enc( { tdm_ol_pitch_comparison( hCPE, pitch_fr, voicing_fr ); - tdm_configure_enc( hCPE, Etot_last, tdm_SM_or_LRTD_Pri, tdm_ratio_idx, tdm_ratio_idx_SM, attack_flag[0], nb_bits_metadata ); + tdm_configure_enc( hCPE, Etot_last, tdm_SM_or_LRTD_Pri, tdm_ratio_idx, tdm_ratio_idx_SM, attack_flag[0], nb_bits_metadata +#ifdef OMASA_TUNING + ,st_ivas->hOMasa != NULL +#endif + ); if ( hEncoderConfig->Opt_DTX_ON ) { @@ -784,7 +796,7 @@ ivas_error ivas_cpe_enc( dbgwrite( &n, 2, 1, input_frame, "res/TCA_idx_NCShift" ); dbgwrite( &n, 2, 1, input_frame, "res/TCA_idx_ica_gD" ); n = -1; - dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); + //dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); } else if ( hCPE->element_mode == IVAS_CPE_TD ) { @@ -801,7 +813,7 @@ ivas_error ivas_cpe_enc( else if ( hCPE->element_mode == IVAS_CPE_MDCT ) { n = -2; - dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); + //dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); } { diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 2ec461d5f9..b853638840 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -892,7 +892,7 @@ void ivas_set_surplus_brate_enc( if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) #else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + if (1)// st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) #endif { tmpF += st_ivas->hSCE[0]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[1] * 50 ); diff --git a/lib_enc/ivas_stereo_classifier.c b/lib_enc/ivas_stereo_classifier.c index b2e3373404..36f06ccadc 100644 --- a/lib_enc/ivas_stereo_classifier.c +++ b/lib_enc/ivas_stereo_classifier.c @@ -90,6 +90,9 @@ int16_t select_stereo_mode( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int32_t ivas_total_brate /* i : IVAS total brate */ +#ifdef OMASA_TUNING + ,const int16_t isOmasa /* i : Flag to indicate that Omasa is present */ +#endif ) { int16_t element_mode; @@ -209,6 +212,16 @@ int16_t select_stereo_mode( set_f( hStereoClassif->xtalk_fv, -1.0f, SSC_MAX_NFEA ); } } +#ifdef OMASA_TUNING + else if ( element_mode == IVAS_CPE_TD && isOmasa ) + { + if ( ( hStereoClassif->lrtd_mode == 1 || hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 1 ) && ( hCPE->element_brate - 50 * FRAMES_PER_SEC + hCPE->brate_surplus + hCPE->brate_surplus < 15000 ) ) + { + hStereoClassif->lrtd_mode = 0; + hStereoClassif->prev_lrtd_mode = 0; + } + } +#endif #ifdef DEBUG_MODE_TD diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index d2d72c1534..70aaf2ebed 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -229,7 +229,17 @@ int16_t stereo_tdm_ener_analysis( hStereoTD->prev_fr_LRTD_TD_dec = 0; } } - + //if ( hCPE->hStereoTD != NULL ) + //{ + + // if ( /*hStereoClassif->lrtd_mode == 1*/ hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 1 && hCPE->element_brate - 50 * FRAMES_PER_SEC + hCPE->brate_surplus < 12600 ) + // { + // //hStereoClassif->xtalk_decision = 0; + // //hStereoClassif->lrtd_mode = 0; + // hCPE->hStereoTD->prev_fr_LRTD_TD_dec = 0; + // //hCPE->hStereoClassif->lrtd_mode = 0; + // } + //} side_can_change = 0; /* update LRTD->DFT stereo hangover counters */ diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 2105b351b3..2f34424f70 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -283,8 +283,8 @@ ivas_error stereo_set_tdm( dbgwrite( &tmp, 2, 1, 320, "res/inst_ratio_L" ); dbgwrite( &ftmp, 4, 1, 320, "res/ratio_L" ); dbgwrite( &tmp, 2, 1, 320, "res/tdm_low_rate_mode" ); - dbgwrite( &tmp, 2, 1, 320, "res/tdm_lp_reuse_flag" ); - dbgwrite( &tmp, 2, 1, 320, "res/mod_ct.enx" ); + //dbgwrite( &tmp, 2, 1, 320, "res/tdm_lp_reuse_flag" ); + //dbgwrite( &tmp, 2, 1, 320, "res/mod_ct.enx" ); } #endif hCPE->hCoreCoder[0]->tdm_LRTD_flag = 0; @@ -309,6 +309,9 @@ void tdm_configure_enc( const int16_t tdm_ratio_idx_SM, /* i : ratio index in SM mode */ const int16_t attack_flag, /* i : Primary channel attack flag */ const int16_t nb_bits_metadata /* i : number of metadata bits */ +#ifdef OMASA_TUNING + ,const int16_t IsOmasa /* i : flag that indicate the presence of Omasa*/ +#endif ) { int16_t tdm_ratio_bit_alloc_idx, mod_ct; @@ -420,11 +423,21 @@ void tdm_configure_enc( } #ifdef MASA_AND_OBJECTS - if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12600 ) + if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12000 ) { - sts[1]->coder_type = INACTIVE; - hStereoTD->tdm_Pitch_reuse_flag = 0; + if ( sts[1]->coder_type == UNVOICED) + { + sts[1]->coder_type = GENERIC; + } hStereoTD->tdm_lp_reuse_flag = 1; +#ifdef OMASA_TUNING + if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 6000 && hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 0 ) +#else + if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12000 /*&& hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 0*/ ) +#endif + { + sts[1]->coder_type = INACTIVE; + } } if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 14700 ) @@ -473,7 +486,11 @@ void tdm_configure_enc( tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, - sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx ); + sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx +#ifdef OMASA_TUNING + ,IsOmasa +#endif + ); #else tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx ); #endif @@ -539,9 +556,9 @@ void tdm_configure_enc( } #ifdef DEBUG_MODE_TD - dbgwrite( &hStereoTD->tdm_low_rate_mode, 2, 1, 320, "res/tdm_low_rate_mode" ); - dbgwrite( &hStereoTD->tdm_lp_reuse_flag, 2, 1, 320, "res/tdm_lp_reuse_flag" ); - dbgwrite( &mod_ct, 2, 1, 320, "res/mod_ct.enx" ); + dbgwrite( &hStereoTD->tdm_low_rate_mode, 2, 1, 320, "res/tdm_low_rate_mode_c" ); + dbgwrite( &hStereoTD->tdm_lp_reuse_flag, 2, 1, 320, "res/tdm_lp_reuse_flag_c" ); + dbgwrite( &mod_ct, 2, 1, 320, "res/mod_ct.enc" ); #endif /*----------------------------------------------------------------* * Updates -- GitLab From 4a0548280de8a0e9cffdaf4f544d5b738fa909d5 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 5 Apr 2023 08:04:24 +0000 Subject: [PATCH 357/375] Update self_test.prm --- scripts/config/self_test.prm | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 84581809fe..70f0ef6b36 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -306,15 +306,10 @@ ../IVAS_cod -dtx -ism 2 testv/stvISM1.csv testv/stvISM2.csv 32000 48 testv/stvST48c.wav bit ../IVAS_dec HOA2 48 bit testv/stv2ST48c.wav_32000_48-48_DTX_HOA2.tst - // 2 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, EXTERNAL out ../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 32000 48 testv/stv2ISM48s.wav bit ../IVAS_dec EXT 48 bit testv/stv2ISM48s.wav_32000_48-48_external.tst -// 2 ISM with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out -../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv2ISM48s.wav bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv2ISM48s.wav_64000_48-48_binaural_room.tst - // 4 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out, random FEC at 5% ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit ../IVAS_dec -fec 5 BINAURAL_ROOM 48 bit testv/stv4ISM48s.wav_32000_48-48_binaural_room_FEC5.tst @@ -323,10 +318,6 @@ ../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 48000 48 testv/stv3ISM48s.wav bit ../IVAS_dec MONO 48 bit testv/stv43ISM48s_48000_48-48_MONO.tst -// 4 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL out -../IVAS_cod -dtx -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48n.wav bit -../IVAS_dec BINAURAL 48 bit testv/stv4ISM48n.wav_32000_48-48_DTX_BINAURAL.tst - // 4 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL ROOM out, random FEC at 5% ../IVAS_cod -dtx -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 48000 48 testv/stv4ISM48n.wav bit ../IVAS_dec -fec 5 BINAURAL_ROOM 48 bit testv/stv4ISM48n.wav_48000_48-48_DTX_TD_binaural_room_FEC5.tst @@ -339,6 +330,10 @@ ../IVAS_cod -ism 1 testv/stvISM1.csv 48000 48 testv/stv1ISM48s.wav bit ../IVAS_dec -fec 5 -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv1ISM48s.wav_64000_48-48_binaural_room_HR.tst +// 2 ISM with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out +../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv2ISM48s.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv2ISM48s.wav_64000_48-48_binaural_room.tst + // 2 ISM with metadata at 64 kbps, 48 kHz in, 32 kHz out, 5_1 out ../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 64000 48 testv/stv2ISM48s.wav bit ../IVAS_dec 5_1 32 bit testv/stv2ISM48s.wav_64000_48-32_5_1.tst @@ -371,7 +366,6 @@ ../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 128000 48 testv/stv3ISM48s.wav bit ../IVAS_dec -fec 5 HOA3 32 bit testv/stv3ISM48s.wav_128000_48-32_HOA3_FEC5.tst - // 2 ISM with metadata at 128 kbps, 48 kHz in, 32 kHz out, BINAURAL out (Model from file), head rotation ../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 128000 48 testv/stv2ISM48s.wav bit ../IVAS_dec -t testv/headrot_case01_3000_q.csv -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin BINAURAL 32 bit testv/stv2ISM48s.wav_128000_48-32_binaural_file_TDHR.tst -- GitLab From 902c4f33417abce037f57b9c5c6b791735ee8d8a Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 5 Apr 2023 16:56:42 +0200 Subject: [PATCH 358/375] fix crashes in native MASA decoder; changes are within OMASA_BRATE_SW --- lib_dec/ivas_dec.c | 4 ++++ lib_dec/ivas_init_dec.c | 23 ++++++++++++------- lib_dec/ivas_masa_dec.c | 8 +++++++ lib_dec/ivas_omasa_dec.c | 48 +++++++++------------------------------- lib_dec/ivas_stat_dec.h | 3 +++ 5 files changed, 40 insertions(+), 46 deletions(-) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 10147488c0..0b590f3ef9 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -900,6 +900,10 @@ ivas_error ivas_dec( st_ivas->ini_active_frame++; } +#ifdef OMASA_BRATE_SW + st_ivas->last_ivas_format = st_ivas->ivas_format; +#endif + #ifdef DEBUG_MODE_INFO dbgwrite( &st_ivas->bfi, sizeof( int16_t ), 1, output_frame, "res/bfi" ); dbgwrite( &st_ivas->BER_detect, sizeof( int16_t ), 1, output_frame, "res/BER_detect" ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index e8fccfb9cf..a97da59693 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -181,18 +181,25 @@ ivas_error ivas_dec_setup( if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) ) { #ifdef OMASA_BRATE_SW - if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#else - if ( st_ivas->ini_active_frame == 0 && ivas_total_brate != FRAME_NO_DATA && ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->nCPE == 1 ) + if ( st_ivas->last_ivas_format == MASA_FORMAT ) { - st_ivas->hCPE[0]->nchan_out = 1; +#endif + if ( st_ivas->ini_active_frame == 0 && ivas_total_brate != FRAME_NO_DATA && ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->nCPE == 1 ) + { + st_ivas->hCPE[0]->nchan_out = 1; + } + else + { + if ( ( error = ivas_masa_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#ifdef OMASA_BRATE_SW } else { - if ( ( error = ivas_masa_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 9d6e1d9612..31acee4924 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1478,6 +1478,14 @@ ivas_error ivas_masa_dec_reconfigure( #endif ); +#ifdef OMASA_BRATE_SW + if ( st_ivas->ivas_format == MASA_FORMAT ) + { + st_ivas->nchan_ism = 0; + st_ivas->ism_mode = ISM_MODE_NONE; + } +#endif + return error; } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 1afaa4696b..036b72a939 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -145,7 +145,6 @@ ivas_error ivas_omasa_dec_config( { int16_t k, sce_id, nSCE_old, nchan_hp20_old, numCldfbAnalyses_old, numCldfbSyntheses_old, n_MD; int32_t ivas_total_brate, ism_total_brate, cpe_brate; - IVAS_FORMAT ivas_format_old; ISM_MODE ism_mode_old; ivas_error error; @@ -157,26 +156,10 @@ ivas_error ivas_omasa_dec_config( ism_mode_old = ivas_omasa_ism_mode_select( st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->nchan_ism ); st_ivas->ism_mode = ism_mode_old; - ivas_format_old = st_ivas->ivas_format; -#ifdef OMASA_UPDATES - if ( ism_mode_old == ISM_MASA_MODE_MASA_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_PARAM_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_DISC ) -#else - if ( ism_mode_old == ISM_MASA_MODE_PARAM || ism_mode_old == ISM_MASA_MODE_PARAM_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_DISC ) -#endif - { - st_ivas->ivas_format = MASA_ISM_FORMAT; - } ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); nSCE_old = st_ivas->nSCE; nchan_hp20_old = getNumChanSynthesis( st_ivas ); - /* reconstruct parameters */ - st_ivas->ivas_format = ivas_format_old; - if ( st_ivas->ivas_format == MASA_FORMAT ) - { - st_ivas->nchan_ism = 0; - } - /* set ism_mode of current frame */ st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); @@ -191,7 +174,6 @@ ivas_error ivas_omasa_dec_config( return error; } - // VE!!!!!: verification needed, see comment "/* Todo: Nokia make for MASA_ISM*/" in ivas_masa_dec_reconfigure() if ( cpe_brate < MASA_STEREO_MIN_BITRATE ) { st_ivas->hCPE[0]->nchan_out = 1; @@ -219,30 +201,20 @@ ivas_error ivas_omasa_dec_config( } /* reconfigure core-coders for ISMs */ - if ( st_ivas->ivas_format == MASA_FORMAT ) + k = 0; + while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) { - if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, 1, 2, 0, -1, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) - { - return error; - } + k++; } - else - { - k = 0; - while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) - { - k++; - } - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) - { - ism_total_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; - } + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + ism_total_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; + } - if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, 1, 2, 0, sep_object_brate[k - 2][st_ivas->nSCE - 1], ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, 1, 2, 0, sep_object_brate[k - 2][st_ivas->nSCE - 1], ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) + { + return error; } if ( ism_mode_old != st_ivas->ism_mode ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index dd9aa2c94f..e1297e9381 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1218,6 +1218,9 @@ typedef struct Decoder_Struct DECODER_CONFIG_HANDLE hDecoderConfig; /* Decoder configuration structure */ IVAS_FORMAT ivas_format; /* IVAS format */ +#ifdef OMASA_BRATE_SW + IVAS_FORMAT last_ivas_format; /* last frame IVAS format */ +#endif int16_t sid_format; /* IVAS format indicator from SID frame */ int16_t nchan_transport; /* number of transport channels */ IVAS_OUTPUT_SETUP hOutSetup; /* output setup structure */ -- GitLab From 02723cade9388c4f42476be12fa63646749095c1 Mon Sep 17 00:00:00 2001 From: Auto Commit Date: Wed, 5 Apr 2023 14:32:35 -0400 Subject: [PATCH 359/375] as tested in the short AB test --- lib_com/ivas_prot.h | 6 +++--- lib_com/ivas_stereo_td_bit_alloc.c | 18 +++++++----------- lib_enc/ivas_cpe_enc.c | 18 +++++++----------- lib_enc/ivas_stereo_classifier.c | 14 -------------- lib_enc/ivas_stereo_td_analysis.c | 24 +++++++++++++----------- lib_enc/ivas_stereo_td_enc.c | 4 ++-- 6 files changed, 32 insertions(+), 52 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 56ec490530..ae82f8b2b6 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1766,9 +1766,6 @@ int16_t select_stereo_mode( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int32_t ivas_total_brate /* i : IVAS total brate */ -#ifdef OMASA_TUNING - ,const int16_t isOmasa /* i : Flag to indicate that Omasa is present */ -#endif ); void stereo_classifier_init( @@ -1833,6 +1830,9 @@ int16_t stereo_tdm_ener_analysis( const int16_t input_frame, /* i : Number of samples */ int16_t *tdm_SM_or_LRTD_Pri, /* o : channel combination scheme flag in TD stereo OR LRTD primary channel */ int16_t *tdm_ratio_idx_SM /* o : TDM ratio index for SM mode */ +#ifdef OMASA_TUNING + ,const int16_t isOmasa /* i : Flag to indicate that Omasa is present */ +#endif ); void stereo_tdm_downmix( diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index b6d3f214b3..b0ae12ecd8 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -140,7 +140,8 @@ void tdm_bit_alloc( /* secondary channel bitrate allocation based on the energy scaling ratio */ #ifdef OMASA_TUNING - if ( (IsOmasa == 0 && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || + if ( (IsOmasa == 0 && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) + || ( IsOmasa == 1 && coder_type > UNVOICED ) ) #else if ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) @@ -412,11 +413,11 @@ void tdm_bit_alloc( } *total_brate_sec += ( fast_FCB_rates_2sfr[idx] - tmp_rate ); } - ///* prevent 2.4 kb/s and 2.8 kb/s as they are reserved bitrates for DTX and VBR */ - //if ( *total_brate_sec == PPP_NELP_2k80 || *total_brate_sec == SID_2k40 ) - //{ - // *total_brate_sec += 100; - //} + /* prevent 2.4 kb/s and 2.8 kb/s as they are reserved bitrates for DTX and VBR */ + if ( *total_brate_sec == PPP_NELP_2k80 || *total_brate_sec == SID_2k40 ) + { + *total_brate_sec += 100; + } /* To prevent 13.2 kb/s for primary channel as some bitstream issues arrise with it */ if ( element_brate_wo_meta - *total_brate_sec == ACELP_13k20 ) @@ -424,11 +425,6 @@ void tdm_bit_alloc( *total_brate_sec += 100; } } - /* prevent 2.4 kb/s and 2.8 kb/s as they are reserved bitrates for DTX and VBR */ - if ( *total_brate_sec == PPP_NELP_2k80 || *total_brate_sec == SID_2k40 ) - { - *total_brate_sec += 100; - } *total_brate_pri = element_brate_wo_meta - *total_brate_sec; return; diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 53a30ce4d5..6800966f99 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -169,20 +169,12 @@ ivas_error ivas_cpe_enc( #ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM && ivas_total_brate == IVAS_48k ) { - hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, IVAS_32k -#ifdef OMASA_TUNING - ,st_ivas->hOMasa!=NULL -#endif - ); + hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, IVAS_32k ); } else { #endif - hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate -#ifdef OMASA_TUNING - ,st_ivas->hOMasa!=NULL -#endif - ); + hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate ); #ifdef OMASA_UPDATES } #endif @@ -421,7 +413,11 @@ ivas_error ivas_cpe_enc( else if ( hCPE->element_mode == IVAS_CPE_TD ) { /* Determine the energy ratio between the 2 channels */ - tdm_ratio_idx = stereo_tdm_ener_analysis( hCPE, input_frame, &tdm_SM_or_LRTD_Pri, &tdm_ratio_idx_SM ); + tdm_ratio_idx = stereo_tdm_ener_analysis( hCPE, input_frame, &tdm_SM_or_LRTD_Pri, &tdm_ratio_idx_SM +#ifdef OMASA_TUNING + , st_ivas->hOMasa != NULL +#endif + ); /* Compute the downmix signal based on the ratio index */ stereo_tdm_downmix( hCPE->hStereoTD, sts[0]->input, sts[1]->input, input_frame, tdm_ratio_idx, ( ( hCPE->hStereoTD->tdm_LRTD_flag == 0 ) ? tdm_SM_or_LRTD_Pri : 0 ), tdm_ratio_idx_SM ); diff --git a/lib_enc/ivas_stereo_classifier.c b/lib_enc/ivas_stereo_classifier.c index 36f06ccadc..8e20c13c8a 100644 --- a/lib_enc/ivas_stereo_classifier.c +++ b/lib_enc/ivas_stereo_classifier.c @@ -90,9 +90,6 @@ int16_t select_stereo_mode( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int32_t ivas_total_brate /* i : IVAS total brate */ -#ifdef OMASA_TUNING - ,const int16_t isOmasa /* i : Flag to indicate that Omasa is present */ -#endif ) { int16_t element_mode; @@ -212,17 +209,6 @@ int16_t select_stereo_mode( set_f( hStereoClassif->xtalk_fv, -1.0f, SSC_MAX_NFEA ); } } -#ifdef OMASA_TUNING - else if ( element_mode == IVAS_CPE_TD && isOmasa ) - { - if ( ( hStereoClassif->lrtd_mode == 1 || hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 1 ) && ( hCPE->element_brate - 50 * FRAMES_PER_SEC + hCPE->brate_surplus + hCPE->brate_surplus < 15000 ) ) - { - hStereoClassif->lrtd_mode = 0; - hStereoClassif->prev_lrtd_mode = 0; - } - } -#endif - #ifdef DEBUG_MODE_TD dbgwrite( &hStereoClassif->unclr_decision, sizeof( int16_t ), 1, L_FRAME16k, "res/unclr_decision.enc" ); diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index 70aaf2ebed..97522ef861 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -115,6 +115,9 @@ int16_t stereo_tdm_ener_analysis( const int16_t input_frame, /* i : Number of samples */ int16_t *tdm_SM_or_LRTD_Pri, /* o : channel combination scheme flag in TD stereo OR LRTD primary channel */ int16_t *tdm_ratio_idx_SM /* o : TDM ratio index for SM mode */ +#ifdef OMASA_TUNING + ,const int16_t isOmasa /* i : Flag to indicate that Omasa is present */ +#endif ) { float rms_R, rms_L; @@ -194,7 +197,16 @@ int16_t stereo_tdm_ener_analysis( * When the energies of channels are low enough, compute the ratio * of L and R needed to create new mono/side signals *----------------------------------------------------------------*/ +#ifdef OMASA_TUNING + if ( isOmasa ) + { + if ( ( hCPE->hStereoClassif->lrtd_mode == 1 || hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 1 ) && ( hCPE->element_brate - 50 * FRAMES_PER_SEC + hCPE->brate_surplus + hCPE->brate_surplus < 15000 ) ) + { + hStereoTD->prev_fr_LRTD_TD_dec = 0; + } + } +#endif rms_thd = RMS_MIN; if ( hCPE->hStereoClassif->lrtd_mode == 1 ) { @@ -229,17 +241,7 @@ int16_t stereo_tdm_ener_analysis( hStereoTD->prev_fr_LRTD_TD_dec = 0; } } - //if ( hCPE->hStereoTD != NULL ) - //{ - - // if ( /*hStereoClassif->lrtd_mode == 1*/ hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 1 && hCPE->element_brate - 50 * FRAMES_PER_SEC + hCPE->brate_surplus < 12600 ) - // { - // //hStereoClassif->xtalk_decision = 0; - // //hStereoClassif->lrtd_mode = 0; - // hCPE->hStereoTD->prev_fr_LRTD_TD_dec = 0; - // //hCPE->hStereoClassif->lrtd_mode = 0; - // } - //} + side_can_change = 0; /* update LRTD->DFT stereo hangover counters */ diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 2f34424f70..6e13ec2075 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -431,9 +431,9 @@ void tdm_configure_enc( } hStereoTD->tdm_lp_reuse_flag = 1; #ifdef OMASA_TUNING - if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 6000 && hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 0 ) + if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 11000 ) #else - if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12000 /*&& hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 0*/ ) + if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12000 ) #endif { sts[1]->coder_type = INACTIVE; -- GitLab From decf39b51e47a0f89f63473bc7eb56cc9a50b6ad Mon Sep 17 00:00:00 2001 From: Ke Zhao Date: Thu, 6 Apr 2023 11:55:22 +1000 Subject: [PATCH 360/375] Assign latency_ns the delay value in nanoseconds --- lib_rend/lib_rend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 37851cf1ab..e97ae461cf 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3484,7 +3484,7 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsMasa[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { - latency_ns = NS2SA( hIvasRend->sampleRateOut, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); + latency_ns = (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ); max_latency_ns = max( max_latency_ns, latency_ns ); } } -- GitLab From 9046cd3263dd4db3edcba5f70de5cf4139d8b43a Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Thu, 6 Apr 2023 09:28:33 +0300 Subject: [PATCH 361/375] Fix issue 389 by removing the sample rate assignment. --- apps/renderer.c | 2 ++ lib_com/options.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/apps/renderer.c b/apps/renderer.c index c2fb6add8a..7fb3e0e009 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -645,7 +645,9 @@ int main( fprintf( stderr, "Sampling rate must be specified on command line when using raw PCM input\n" ); exit( -1 ); } +#ifndef FIX_389_EXT_REND_PCM_SR args.sampleRate = inFileSampleRate; +#endif break; default: fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); diff --git a/lib_com/options.h b/lib_com/options.h index 6d97909f18..6b0779ba40 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,6 +153,8 @@ #define SBA2MONO /* FhG: Issue 365: Adapt processing of SBA mono output to be in line with stereo output (less delay, lower complexity) */ +#define FIX_389_EXT_REND_PCM_SR /* Nokia: Issue 389: Fix assignment of sample rate with PCM input. */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif -- GitLab From 7e8c467e1a4897b17a32d8def98d819934b2acb4 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Thu, 6 Apr 2023 09:48:05 +0300 Subject: [PATCH 362/375] Fix issue 390 by changing the MASA metadata copying in external renderer to use the metadata write pointers. --- lib_com/options.h | 2 ++ lib_rend/lib_rend.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 6d97909f18..47e0a5ba15 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,6 +153,8 @@ #define SBA2MONO /* FhG: Issue 365: Adapt processing of SBA mono output to be in line with stereo output (less delay, lower complexity) */ +#define FIX_390_EXT_REND_MASA_META_COPY /* Nokia: Issue 390: Fixes MASA metadata copying to renderer. */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 37851cf1ab..70170d7a5b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2222,6 +2222,9 @@ static ivas_error initMasaDummyDecForMcOut( { return error; } +#ifdef FIX_390_EXT_REND_MASA_META_COPY + decDummy->hDirAC->dirac_bs_md_write_idx = 0; +#endif if ( decDummy->renderer_type == RENDERER_STEREO_PARAMETRIC ) { @@ -2298,6 +2301,9 @@ static ivas_error initMasaDummyDecForSbaOut( { return error; } +#ifdef FIX_390_EXT_REND_MASA_META_COPY + decDummy->hDirAC->dirac_bs_md_write_idx = 0; +#endif numCldfbAnalyses = decDummy->nchan_transport; numCldfbSyntheses = decDummy->hDecoderConfig->nchan_out; @@ -2366,6 +2372,9 @@ static ivas_error initMasaDummyDecForBinauralOut( { return error; } +#ifdef FIX_390_EXT_REND_MASA_META_COPY + decDummy->hDirAC->dirac_bs_md_write_idx = 0; +#endif if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &decDummy->hHrtfParambin ) ) != IVAS_ERR_OK ) { @@ -5287,33 +5296,61 @@ static void copyMasaMetadataToDiracRenderer( DIRAC_DEC_HANDLE hDirAC ) { int16_t band, sf, bin; +#ifdef FIX_390_EXT_REND_MASA_META_COPY + int16_t meta_write_index; +#endif hDirAC->numSimultaneousDirections = meta->descriptive_meta.numberOfDirections + 1; for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { +#ifdef FIX_390_EXT_REND_MASA_META_COPY + meta_write_index = ( hDirAC->dirac_bs_md_write_idx + sf ) % hDirAC->dirac_md_buffer_length; +#endif + for ( band = 0; band < MASA_MAXIMUM_CODING_SUBBANDS; band++ ) { for ( bin = MASA_band_grouping_24[band]; bin < MASA_band_grouping_24[band + 1]; bin++ ) { +#ifdef FIX_390_EXT_REND_MASA_META_COPY + hDirAC->azimuth[meta_write_index][bin] = (int16_t) meta->directional_meta[0].azimuth[sf][band]; + hDirAC->elevation[meta_write_index][bin] = (int16_t) meta->directional_meta[0].elevation[sf][band]; + hDirAC->energy_ratio1[meta_write_index][bin] = meta->directional_meta[0].energy_ratio[sf][band]; + hDirAC->diffuseness_vector[meta_write_index][bin] = 1.0f - meta->directional_meta[0].energy_ratio[sf][band]; + hDirAC->spreadCoherence[meta_write_index][bin] = meta->directional_meta[0].spread_coherence[sf][band]; + hDirAC->surroundingCoherence[meta_write_index][bin] = meta->common_meta.surround_coherence[sf][band]; +#else hDirAC->azimuth[sf][bin] = (int16_t) meta->directional_meta[0].azimuth[sf][band]; hDirAC->elevation[sf][bin] = (int16_t) meta->directional_meta[0].elevation[sf][band]; hDirAC->energy_ratio1[sf][bin] = meta->directional_meta[0].energy_ratio[sf][band]; hDirAC->diffuseness_vector[sf][bin] = 1.0f - meta->directional_meta[0].energy_ratio[sf][band]; hDirAC->spreadCoherence[sf][bin] = meta->directional_meta[0].spread_coherence[sf][band]; hDirAC->surroundingCoherence[sf][bin] = meta->common_meta.surround_coherence[sf][band]; +#endif if ( hDirAC->numSimultaneousDirections == 2 ) { +#ifdef FIX_390_EXT_REND_MASA_META_COPY + hDirAC->azimuth2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].azimuth[sf][band]; + hDirAC->elevation2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].elevation[sf][band]; + hDirAC->energy_ratio2[meta_write_index][bin] = meta->directional_meta[1].energy_ratio[sf][band]; + hDirAC->diffuseness_vector[meta_write_index][bin] -= meta->directional_meta[1].energy_ratio[sf][band]; + hDirAC->spreadCoherence2[meta_write_index][bin] = meta->directional_meta[1].spread_coherence[sf][band]; +#else hDirAC->azimuth2[sf][bin] = (int16_t) meta->directional_meta[1].azimuth[sf][band]; hDirAC->elevation2[sf][bin] = (int16_t) meta->directional_meta[1].elevation[sf][band]; hDirAC->energy_ratio2[sf][bin] = meta->directional_meta[1].energy_ratio[sf][band]; hDirAC->diffuseness_vector[sf][bin] -= meta->directional_meta[1].energy_ratio[sf][band]; hDirAC->spreadCoherence2[sf][bin] = meta->directional_meta[1].spread_coherence[sf][band]; +#endif } } } } +#ifdef FIX_390_EXT_REND_MASA_META_COPY + + hDirAC->dirac_bs_md_write_idx = ( hDirAC->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hDirAC->dirac_md_buffer_length; +#endif return; } -- GitLab From ff5314ab3351a768ecb5d1ebfa5b4535e6542b0b Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 6 Apr 2023 08:49:50 +0200 Subject: [PATCH 363/375] fixes for bitrate switching and MC output config. --- lib_dec/ivas_dec.c | 2 +- lib_dec/ivas_init_dec.c | 23 +++++++++----- lib_dec/ivas_omasa_dec.c | 68 ++++++++++++++++++++++++++++------------ 3 files changed, 64 insertions(+), 29 deletions(-) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index ecfa303713..c0deb07a1a 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -603,7 +603,7 @@ ivas_error ivas_dec( ivas_masa_ism_set_edited_objects( st_ivas ); /* Rendering */ - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { #ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 792521c573..c26a94f2dc 100755 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1541,19 +1541,26 @@ ivas_error ivas_init_decoder( } #ifdef OMASA_UPDATES - // VE: introduce a new renderer_type for this case - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL ) + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { - /* Allocate TD renderer for the objects in DISC mode */ - if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + // VE: introduce a new renderer_type for this case + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL ) { - return error; + /* Allocate TD renderer for the objects in DISC mode */ + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } - /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ - if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + // VE: introduce a new renderer_type for this case + if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) { - return error; + /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ + if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } } #endif diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 036b72a939..a688e0062f 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -271,39 +271,67 @@ ivas_error ivas_omasa_dec_config( } #ifdef OMASA_UPDATES - // VE: introduce a new renderer_type for this case - if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) { - /* Allocate TD renderer for the objects in DISC mode */ - if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { - return error; - } + /* Allocate TD renderer for the objects in DISC mode */ + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } - /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ - if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ + if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else { - return error; + /* TD renderer handle */ + if ( st_ivas->hBinRendererTd != NULL ) + { + ivas_td_binaural_close( &st_ivas->hBinRendererTd ); + } + + if ( st_ivas->hHrtfTD != NULL ) // VE: this is copied from ivas_ism_bitrate_switching() but a review is needed + { + st_ivas->hHrtfTD = NULL; + } + + /* ISM renderer handle */ + if ( st_ivas->hIsmRendererData != NULL ) + { + free( st_ivas->hIsmRendererData ); + st_ivas->hIsmRendererData = NULL; + } } } - else + + if ( st_ivas->renderer_type == RENDERER_DIRAC ) { - /* TD renderer handle */ - if ( st_ivas->hBinRendererTd != NULL ) + if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) { - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); + return error; } - if ( st_ivas->hHrtfTD != NULL ) // VE: this is copied from ivas_ism_bitrate_switching() but a review is needed + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { - st_ivas->hHrtfTD = NULL; + /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ + if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } - - /* ISM renderer handle */ - if ( st_ivas->hIsmRendererData != NULL ) + else { - free( st_ivas->hIsmRendererData ); - st_ivas->hIsmRendererData = NULL; + /* ISM renderer handle */ + if ( st_ivas->hIsmRendererData != NULL ) + { + free( st_ivas->hIsmRendererData ); + st_ivas->hIsmRendererData = NULL; + } } } #endif -- GitLab From 94238233699d8d248d285412fe15606cf6b68fad Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Thu, 6 Apr 2023 10:01:29 +0200 Subject: [PATCH 364/375] Added fixes for issue 379 under FIX_379_EXT_METADATA and FIX_379_ANGLE --- apps/renderer.c | 5 + lib_com/ivas_cnst.h | 17 +- lib_com/ivas_prot.h | 8 +- lib_com/ivas_stat_com.h | 25 +- lib_com/options.h | 3 + lib_dec/ivas_dec.c | 32 +++ lib_dec/ivas_init_dec.c | 4 + lib_dec/ivas_ism_metadata_dec.c | 273 ++++++++++++++++++++- lib_dec/ivas_stat_dec.h | 5 + lib_dec/lib_dec.c | 8 + lib_enc/ivas_ism_metadata_enc.c | 318 ++++++++++++++++++++++++- lib_enc/lib_enc.c | 34 +++ lib_rend/ivas_objectRenderer_sources.c | 6 +- lib_util/ism_file_reader.c | 13 + 14 files changed, 729 insertions(+), 22 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index c2fb6add8a..62132c754a 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -965,7 +965,12 @@ int main( } else { +#ifdef FIX_379_EXT_METADATA + error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ); + if ( ( error != IVAS_ERR_OK ) && ( error != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) // VE: TBC +#else if ( ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ) ) != IVAS_ERR_OK ) && ( IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ) != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) // VE: TBC +#endif { fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 1da32f2145..d7674b4373 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -320,11 +320,14 @@ typedef enum #define ISM_Q_STEP 2.5f #define ISM_Q_STEP_BORDER 5.0f -#define ISM_RADIUS_NBITS 6 -#define ISM_RADIUS_MIN 0.0f -#define ISM_RADIUS_DELTA 0.25f /* Max radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */ -#define ISM_EXTENDED_METADATA_BRATE IVAS_64k -#define ISM_EXTENDED_METADATA_BITS 1 +#define ISM_RADIUS_NBITS 6 +#define ISM_RADIUS_MIN 0.0f +#define ISM_RADIUS_DELTA 0.25f /* Max radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */ +#define ISM_EXTENDED_METADATA_BRATE IVAS_64k +#define ISM_EXTENDED_METADATA_BITS 1 +#ifdef FIX_379_EXT_METADATA +#define ISM_METADATA_RS_MAX_FRAMES 5 /* Number of frames with opposite extended metadata flags before switching */ +#endif /* Parametric ISM */ #define MAX_PARAM_ISM_NBANDS 11 @@ -373,7 +376,11 @@ enum { IND_ISM_NUM_OBJECTS, IND_ISM_EXTENDED_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS, +#ifdef FIX_379_EXT_METADATA + IND_ISM_METADATA_FLAG, +#else IND_ISM_METADATA_FLAG = IND_ISM_EXTENDED_FLAG + MAX_NUM_OBJECTS, /* EN2VE: Is this not supposed to be in the loop part below, since it is one per ISM? */ +#endif IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS, #ifdef DISCRETE_ISM_DTX_CNG IND_ISM_NOISY_SPEECH_FLAG = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS, diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 2aab3dd7ee..21ea995a84 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -836,12 +836,18 @@ ivas_error ivas_ism_metadata_dec( ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ const int16_t bfi, /* i : bfi flag */ - int16_t nb_bits_metadata[], /* o : number of metadata bits */ + int16_t nb_bits_metadata[], /* o : number of metadata bits */ ISM_MODE ism_mode, /* i : ISM mode */ #ifdef DISCRETE_ISM_DTX_CNG ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ #endif +#ifdef FIX_379_EXT_METADATA + const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ + int16_t *ism_extended_metadata_flag, /* i/o: Extended metadata active in renderer */ + int16_t *ism_extmeta_cnt /* i/o: Number of change frames observed */ +#else const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ +#endif ); diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index eedb65dbf3..041a589ee3 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -43,7 +43,15 @@ /*----------------------------------------------------------------------------------* * Declaration of ISM common (encoder & decoder) structure *----------------------------------------------------------------------------------*/ - +#ifdef FIX_379_ANGLE +typedef struct +{ + int16_t last_angle1_idx; /* last frame index of coded azimuth/yaw */ + int16_t angle1_diff_cnt; /* FEC counter of consecutive differentially azimuth/yaw coded frames */ + int16_t last_angle2_idx; /* last frame index of coded elevation/pitch */ + int16_t angle2_diff_cnt; /* FEC counter of consecutive differentially elevation/pitch coded frames */ +} ISM_METADATA_ANGLE, *ISM_METADATA_ANGLE_HANDLE; +#else typedef struct { int16_t last_azimuth_idx; /* last frame index of coded azimuth */ @@ -52,7 +60,7 @@ typedef struct int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */ } ISM_METADATA_ANGLE, *ISM_METADATA_ANGLE_HANDLE; - +#endif /* ISM metadata handle (storage for one frame of read ISM metadata) */ typedef struct { @@ -62,11 +70,16 @@ typedef struct float azimuth; /* azimuth value read from the input metadata file */ float elevation; /* azimuth value read from the input metadata file */ float radius; - float yaw; /* azimuth orientation value read from the input metadata file */ - float pitch; /* elevation orientation value read from the input metadata file */ + float yaw; /* azimuth orientation value read from the input metadata file */ + float pitch; /* elevation orientation value read from the input metadata file */ +#ifdef FIX_379_ANGLE + ISM_METADATA_ANGLE position_angle; /* Angle structs for azimuth and elevation */ + ISM_METADATA_ANGLE orientation_angle; /* Angle structs for yaw and pitch */ +#else ISM_METADATA_ANGLE angle[2]; /* Angle structs for [0] azimuth/elevation and [1] yaw/pitch */ - int16_t last_radius_idx; /* last frame index of coded radius */ - int16_t radius_diff_cnt; /* FEC counter of consecutive differentially radius coded frames */ +#endif + int16_t last_radius_idx; /* last frame index of coded radius */ + int16_t radius_diff_cnt; /* FEC counter of consecutive differentially radius coded frames */ #ifdef DISCRETE_ISM_DTX_CNG float last_azimuth; /* MD smoothing in DTX- last Q azimuth value */ diff --git a/lib_com/options.h b/lib_com/options.h index 6d97909f18..43de30fbeb 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -152,6 +152,9 @@ #define FIX_382_MASA_META_FRAMING_ASYNC /* Nokia: Issue 382: detect potential MASA metadata framing offset */ #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 */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index f89a64bf3e..8eb822a32e 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -152,38 +152,70 @@ ivas_error ivas_dec( // VE: call ivas_ism_metadata_dec() with 'st_ivas' - TBD #ifdef DISCRETE_ISM_DTX_CNG #ifdef NCHAN_ISM_PARAMETER +#ifdef FIX_379_EXT_METADATA + if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ) ) != IVAS_ERR_OK ) +#endif +#else +#ifdef FIX_379_EXT_METADATA + if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ) ) != IVAS_ERR_OK ) +#endif #endif { return error; } #else #ifdef NCHAN_ISM_PARAMETER +#ifdef FIX_379_EXT_METADATA + ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ); +#else ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); +#endif +#else +#ifdef FIX_379_EXT_METADATA + ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ); #else ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); #endif +#endif #endif } else /* ISM_MODE_DISC */ { #ifdef DISCRETE_ISM_DTX_CNG #ifdef NCHAN_ISM_PARAMETER +#ifdef FIX_379_EXT_METADATA + if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL ) ) != IVAS_ERR_OK ) +#endif +#else +#ifdef FIX_379_EXT_METADATA + if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL ) ) != IVAS_ERR_OK ) +#endif #endif { return error; } #else #ifdef NCHAN_ISM_PARAMETER +#ifdef FIX_379_EXT_METADATA + ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ); +#else ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, NULL ); +#endif +#else +#ifdef FIX_379_EXT_METADATA + ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ); #else ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, NULL ); #endif +#endif #endif } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index e53218d3e7..73f2acb2db 100755 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -888,6 +888,10 @@ ivas_error ivas_init_decoder( st_ivas->nSCE = st_ivas->nchan_transport; /* "st_ivas->nchan_transport" is known from ivas_dec_setup */ st_ivas->nCPE = 0; +#ifdef FIX_379_EXT_METADATA + st_ivas->ism_extmeta_active = -1; + st_ivas->ism_extmeta_cnt = 0; +#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 75b9164e1d..feccbc9766 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -154,18 +154,35 @@ ivas_error ivas_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ #endif +#ifdef FIX_379_EXT_METADATA + const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ + int16_t *ism_extmeta_active, /* i/o: Extended metadata active in renderer*/ + int16_t *ism_extmeta_cnt /* i/o: Number of change frames observed*/ +#else const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ +#endif ) { int16_t ch, nb_bits_start = 0, last_bit_pos; int16_t idx_radius; int32_t element_brate[MAX_NUM_OBJECTS], total_brate[MAX_NUM_OBJECTS]; DEC_CORE_HANDLE st0; +#ifdef FIX_379_EXT_METADATA + int16_t ism_extmeta_bitstream; + float yaw, pitch, radius; +#else int16_t ism_extended_metadata_flag; +#endif int16_t flag_abs_radius; int16_t flag_abs_orientation; +#ifdef FIX_379_ANGLE + int16_t flag_abs_position; + int16_t idx_angle1; + int16_t idx_angle2; +#else int16_t idx_azimuth, flag_abs_azimuth; int16_t idx_elevation; +#endif int16_t next_bit_pos_orig; uint16_t i, bstr_meta[MAX_BITS_METADATA], *bstr_orig; ISM_METADATA_HANDLE hIsmMetaData; @@ -218,7 +235,11 @@ ivas_error ivas_ism_metadata_dec( bstr_orig = st0->bit_stream; next_bit_pos_orig = st0->next_bit_pos; st0->next_bit_pos = 0; +#ifdef FIX_379_EXT_METADATA + ism_extmeta_bitstream = 0; +#else ism_extended_metadata_flag = 0; +#endif /* reverse the bitstream for easier reading of indices */ for ( i = 0; i < min( MAX_BITS_METADATA, last_bit_pos ); i++ ) @@ -270,8 +291,29 @@ ivas_error ivas_ism_metadata_dec( /* read extended metadata presence flag */ if ( ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) { +#ifdef FIX_379_EXT_METADATA + ism_extmeta_bitstream = get_next_indice( st0, ISM_EXTENDED_METADATA_BITS ); +#else ism_extended_metadata_flag = get_next_indice( st0, ISM_EXTENDED_METADATA_BITS ); +#endif } +#ifdef FIX_379_EXT_METADATA + /* Apply hysteresis in case rate switching causes fluctuation in presence of extended metadata */ + if ( *ism_extmeta_active == -1 || *ism_extmeta_active == ism_extmeta_bitstream ) /* If first frame or bitstream matches internal state */ + { + *ism_extmeta_active = ism_extmeta_bitstream; + *ism_extmeta_cnt = 0; + } + else + { + ( *ism_extmeta_cnt )++; + if ( *ism_extmeta_cnt == ISM_METADATA_RS_MAX_FRAMES ) /* ISM_METADATA_RS_MAX_FRAMES change frames observed - update state */ + { + *ism_extmeta_active = ism_extmeta_bitstream; + *ism_extmeta_cnt = 0; + } + } +#endif /* Read ISM present flags (one per object) */ for ( ch = 0; ch < *nchan_transport; ch++ ) @@ -330,44 +372,102 @@ ivas_error ivas_ism_metadata_dec( { nb_bits_start = st0->next_bit_pos; } - +#ifdef FIX_379_ANGLE + flag_abs_position = 0; +#else flag_abs_azimuth = 0; +#endif flag_abs_orientation = 0; flag_abs_radius = 0; if ( hIsmMeta[ch]->ism_metadata_flag ) { +#ifdef FIX_379_ANGLE + decode_angle_indices( st0, &( hIsmMetaData->position_angle ), &flag_abs_position ); + idx_angle1 = hIsmMetaData->position_angle.last_angle1_idx; + idx_angle2 = hIsmMetaData->position_angle.last_angle2_idx; +#else decode_angle_indices( st0, &( hIsmMetaData->angle[0] ), &flag_abs_azimuth ); idx_azimuth = hIsmMetaData->angle[0].last_azimuth_idx; idx_elevation = hIsmMetaData->angle[0].last_elevation_idx; - +#endif /* Azimuth/Elevation dequantization */ if ( ism_mode == ISM_MODE_PARAM ) { +#ifdef FIX_379_ANGLE + hParamIsm->azi_index[ch] = idx_angle1; + hParamIsm->ele_index[ch] = idx_angle2; +#else hParamIsm->azi_index[ch] = idx_azimuth; hParamIsm->ele_index[ch] = idx_elevation; +#endif } else /* ISM_MODE_DISC */ { +#ifdef FIX_379_ANGLE + hIsmMetaData->azimuth = ism_dequant_meta( idx_angle1, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); + hIsmMetaData->elevation = ism_dequant_meta( idx_angle2, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#else hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#endif /* radius/raw/pitch dequantization */ +#ifdef FIX_379_EXT_METADATA + if ( ism_extmeta_bitstream ) +#else if ( ism_extended_metadata_flag ) +#endif { +#ifdef FIX_379_ANGLE + decode_angle_indices( st0, &( hIsmMetaData->orientation_angle ), &flag_abs_orientation ); + idx_angle1 = hIsmMetaData->orientation_angle.last_angle1_idx; + idx_angle2 = hIsmMetaData->orientation_angle.last_angle2_idx; +#else decode_angle_indices( st0, &( hIsmMetaData->angle[1] ), &flag_abs_orientation ); idx_azimuth = hIsmMetaData->angle[1].last_azimuth_idx; idx_elevation = hIsmMetaData->angle[1].last_elevation_idx; - +#endif +#ifdef FIX_379_EXT_METADATA +#ifdef FIX_379_ANGLE + yaw = ism_dequant_meta( idx_angle1, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); + pitch = ism_dequant_meta( idx_angle2, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#else + yaw = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); + pitch = ism_dequant_meta( idx_elevation, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#endif +#else hIsmMetaData->yaw = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); hIsmMetaData->pitch = ism_dequant_meta( idx_elevation, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#endif idx_radius = decode_radius( st0, &hIsmMetaData->last_radius_idx, &flag_abs_radius ); +#ifdef FIX_379_EXT_METADATA + radius = usdequant( idx_radius, ISM_RADIUS_MIN, ISM_RADIUS_DELTA ); +#else hIsmMetaData->radius = usdequant( idx_radius, ISM_RADIUS_MIN, ISM_RADIUS_DELTA ); +#endif +#ifdef FIX_379_EXT_METADATA + if ( *ism_extmeta_active == 1 ) + { + hIsmMetaData->yaw = yaw; + hIsmMetaData->pitch = pitch; + hIsmMetaData->radius = radius; + } +#endif } else { +#ifdef FIX_379_EXT_METADATA + if ( *ism_extmeta_active == 0 ) + { + hIsmMetaData->yaw = 0.0f; + hIsmMetaData->pitch = 0.0f; + hIsmMetaData->radius = 1.0f; + } +#else hIsmMetaData->radius = 1.0f; +#endif } } #ifdef DISCRETE_ISM_DTX_CNG @@ -461,8 +561,13 @@ ivas_error ivas_ism_metadata_dec( { hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch] + hParamIsm->last_az_sgn[ch] * hParamIsm->last_az_diff[ch]; hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch] + hParamIsm->last_el_sgn[ch] * hParamIsm->last_el_diff[ch]; +#ifdef FIX_379_ANGLE + hIsmMeta[ch]->position_angle.last_angle1_idx = hParamIsm->azi_index[ch]; + hIsmMeta[ch]->position_angle.last_angle2_idx = hParamIsm->ele_index[ch]; +#else hIsmMeta[ch]->angle[0].last_azimuth_idx = hParamIsm->azi_index[ch]; hIsmMeta[ch]->angle[0].last_elevation_idx = hParamIsm->ele_index[ch]; +#endif } } } @@ -576,10 +681,17 @@ ivas_error ivas_ism_metadata_dec_create( } st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0; +#ifdef FIX_379_ANGLE + st_ivas->hIsmMetaData[ch]->position_angle.last_angle1_idx = 0; + st_ivas->hIsmMetaData[ch]->position_angle.last_angle2_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); + st_ivas->hIsmMetaData[ch]->orientation_angle.last_angle1_idx = 0; + st_ivas->hIsmMetaData[ch]->orientation_angle.last_angle2_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); +#else st_ivas->hIsmMetaData[ch]->angle[0].last_azimuth_idx = 0; st_ivas->hIsmMetaData[ch]->angle[0].last_elevation_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); st_ivas->hIsmMetaData[ch]->angle[1].last_azimuth_idx = 0; st_ivas->hIsmMetaData[ch]->angle[1].last_elevation_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); +#endif st_ivas->hIsmMetaData[ch]->last_radius_idx = 8; /* Init to radius 1.0 */ #ifdef DISCRETE_ISM_DTX_CNG @@ -608,6 +720,148 @@ ivas_error ivas_ism_metadata_dec_create( * * Decoding of an angle *-------------------------------------------------------------------------*/ +#ifdef FIX_379_ANGLE + +static void decode_angle_indices( + DEC_CORE_HANDLE st0, /* i/o: bitstream handle */ + ISM_METADATA_ANGLE_HANDLE angle, /* i/o: angle handle */ + int16_t *flag_abs_angle1 /* o : Azimuth/yaw encoding mode */ +) +{ + int16_t idx_angle1, nbits_diff_angle1, diff, sgn; + int16_t idx_angle2, nbits_diff_angle2; + + /*----------------------------------------------------------------* + * Azimuth/yaw decoding and dequantization + *----------------------------------------------------------------*/ + + /* Decode azimuth/yaw index */ + if ( get_next_indice( st0, 1 ) == 1 ) /* azimuth_abs_flag */ + { + idx_angle1 = get_next_indice( st0, ISM_AZIMUTH_NBITS ); + *flag_abs_angle1 = 1; + } + else + { + diff = 0; + sgn = 1; + + if ( get_next_indice( st0, 1 ) == 0 ) + { + nbits_diff_angle1 = 1; + } + else + { + nbits_diff_angle1 = 1; + + if ( get_next_indice( st0, 1 ) == 1 ) /* negative sign */ + { + sgn = -1; + } + + nbits_diff_angle1++; + + /* read until the stop bit */ + while ( ( nbits_diff_angle1 < ISM_AZIMUTH_NBITS - 1 ) && ( get_next_indice( st0, 1 ) == 1 ) ) + { + diff++; + nbits_diff_angle1++; + } + + if ( nbits_diff_angle1 < ISM_AZIMUTH_NBITS - 1 ) + { + /* count stop bit */ + nbits_diff_angle1++; + } + } + idx_angle1 = angle->last_angle1_idx + sgn * diff; + } + + /* azimuth/yaw is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ + if ( idx_angle1 > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + { + idx_angle1 -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* +180° -> -180° */ + } + else if ( idx_angle1 < 0 ) + { + idx_angle1 += ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* -180° -> +180° */ + } + + /* +180° == -180° */ + if ( idx_angle1 == ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + { + idx_angle1 = 0; + } + + /* sanity check in case of FER or BER */ + if ( idx_angle1 < 0 || idx_angle1 > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + { + idx_angle1 = angle->last_angle1_idx; + } + + /*----------------------------------------------------------------* + * Elevation/pitch decoding and dequantization + *----------------------------------------------------------------*/ + + /* Decode elevation/pitch index */ + if ( *flag_abs_angle1 == 0 && get_next_indice( st0, 1 ) == 1 ) /* elevation_abs_flag */ + { + idx_angle2 = get_next_indice( st0, ISM_ELEVATION_NBITS ); + } + else + { + diff = 0; + sgn = 1; + + if ( get_next_indice( st0, 1 ) == 0 ) + { + nbits_diff_angle2 = 1; + } + else + { + nbits_diff_angle2 = 1; + + if ( get_next_indice( st0, 1 ) == 1 ) /* negative sign */ + { + sgn = -1; + } + + nbits_diff_angle2++; + + /* read until the stop bit */ + while ( ( nbits_diff_angle2 < ISM_ELEVATION_NBITS ) && ( get_next_indice( st0, 1 ) == 1 ) ) + { + diff++; + nbits_diff_angle2++; + } + + if ( nbits_diff_angle2 < ISM_ELEVATION_NBITS ) + { + /* count stop bit */ + nbits_diff_angle2++; + } + } + + idx_angle2 = angle->last_angle2_idx + sgn * diff; + } + + /* sanity check in case of FER or BER */ + if ( idx_angle2 < 0 || idx_angle2 > ( 1 << ISM_ELEVATION_NBITS ) - 1 ) + { + idx_angle2 = angle->last_angle2_idx; + } + + /*----------------------------------------------------------------* + * Final updates + *----------------------------------------------------------------*/ + + angle->last_angle1_idx = idx_angle1; + angle->last_angle2_idx = idx_angle2; + + return; +} + +#else static void decode_angle_indices( DEC_CORE_HANDLE st0, /* i/o: bitstream handle */ @@ -748,6 +1002,8 @@ static void decode_angle_indices( return; } +#endif + /*------------------------------------------------------------------------- * decode_radius() @@ -965,13 +1221,24 @@ void ivas_ism_metadata_sid_dec( /* update last indexes to correspond to active frames coding */ if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) { +#ifdef FIX_379_ANGLE + hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); + hIsmMetaData->position_angle.last_angle2_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); +#else hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); +#endif } else { +#ifdef FIX_379_ANGLE + hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); + hIsmMetaData->position_angle.last_angle2_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); +#else hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); + +#endif } /* save for smoothing metadata evolution */ diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index ab95c31b5e..3bfd806bdf 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1252,6 +1252,11 @@ typedef struct Decoder_Struct int32_t noClipping; /* number of clipped samples */ #endif int32_t last_active_ivas_total_brate; +#ifdef FIX_379_EXT_METADATA + int16_t ism_extmeta_active; /* Extended metadata active in decoder */ + int16_t ism_extmeta_cnt; /* Change frame counter for extended metadata */ +#endif + } Decoder_Struct; /* clang-format on */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 0497a0a713..a1410c482e 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -825,9 +825,17 @@ ivas_error IVAS_DEC_GetObjectMetadata( { metadata->azimuth = 0.f; metadata->elevation = 0.f; +#ifdef FIX_379_EXT_METADATA + metadata->radius = 1.f; + metadata->spread = 0.f; + metadata->gainFactor = 1.f; + metadata->yaw = 0.f; + metadata->pitch = 0.f; +#else metadata->radius = 0.f; metadata->spread = 0.f; metadata->gainFactor = 1.f; +#endif } else { diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 5b45d909f1..d34479ad2d 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -64,7 +64,11 @@ * Local function declarations *-----------------------------------------------------------------------*/ +#ifdef FIX_379_ANGLE +static void encode_angle_indices( BSTR_ENC_HANDLE hBstr, ISM_METADATA_ANGLE_HANDLE angle, const int16_t last_ism_metadata_flag, const int16_t ini_frame, const int16_t idx_angle1_abs, const int16_t idx_angle2_abs, int16_t *flag_abs_angle1, int16_t *flag_abs_angle2 ); +#else static void encode_angle_indices( BSTR_ENC_HANDLE hBstr, ISM_METADATA_ANGLE_HANDLE angle, const int16_t last_ism_metadata_flag, const int16_t ini_frame, const int16_t idx_azimuth_abs, const int16_t idx_elevation_abs, int16_t *flag_abs_azimuth, int16_t *flag_abs_elevation ); +#endif static void encode_radius( BSTR_ENC_HANDLE hBstr, int16_t *last_radius_idx, int16_t *radius_diff_cnt, const int16_t last_ism_metadata_flag, const int16_t idx_radius_abs, int16_t *flag_abs_radius ); @@ -178,9 +182,18 @@ ivas_error ivas_ism_metadata_enc( ) { int16_t i, ch, nb_bits_start = 0; +#ifdef FIX_379_ANGLE + int16_t flag_abs_azimuth[MAX_NUM_OBJECTS]; + int16_t flag_abs_elevation[MAX_NUM_OBJECTS]; + int16_t idx_angle1_abs = 0; + int16_t idx_angle2_abs = 0; + int16_t flag_abs_yaw[MAX_NUM_OBJECTS]; + int16_t flag_abs_pitch[MAX_NUM_OBJECTS]; +#else int16_t idx_azimuth_abs = 0, flag_abs_azimuth[MAX_NUM_OBJECTS]; int16_t idx_elevation_abs = 0, flag_abs_elevation[MAX_NUM_OBJECTS]; int16_t flag_abs_azimuth_orientation[MAX_NUM_OBJECTS]; +#endif int16_t idx_radius_abs = 0, flag_abs_radius[MAX_NUM_OBJECTS]; float valQ; ISM_METADATA_HANDLE hIsmMetaData; @@ -228,7 +241,12 @@ ivas_error ivas_ism_metadata_enc( set_s( nb_bits_metadata, 0, nchan_transport ); set_s( flag_abs_azimuth, 0, nchan_ism ); set_s( flag_abs_elevation, 0, nchan_ism ); +#ifdef FIX_379_ANGLE + set_s( flag_abs_yaw, 0, nchan_ism ); + set_s( flag_abs_pitch, 0, nchan_ism ); +#else set_s( flag_abs_azimuth_orientation, 0, nchan_ism ); +#endif set_s( flag_abs_radius, 0, nchan_ism ); /*----------------------------------------------------------------* @@ -333,27 +351,48 @@ ivas_error ivas_ism_metadata_enc( if ( ism_mode == ISM_MODE_DISC ) { +#ifdef FIX_379_ANGLE + idx_angle1_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); + idx_angle2_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#else idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); idx_elevation_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#endif } else /* ISM_MODE_PARAM */ { +#ifdef FIX_379_ANGLE + idx_angle1_abs = hParamIsm->azi_index[ch]; + idx_angle2_abs = hParamIsm->ele_index[ch]; +#else idx_azimuth_abs = hParamIsm->azi_index[ch]; idx_elevation_abs = hParamIsm->ele_index[ch]; +#endif } - +#ifdef FIX_379_ANGLE + encode_angle_indices( hBstr, &( hIsmMetaData->position_angle ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_angle1_abs, idx_angle2_abs, &flag_abs_azimuth[ch], &flag_abs_elevation[ch] ); +#else encode_angle_indices( hBstr, &( hIsmMetaData->angle[0] ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_azimuth_abs, idx_elevation_abs, &flag_abs_azimuth[ch], &flag_abs_elevation[ch] ); - +#endif /*----------------------------------------------------------------* * Quantize and encode radius, yaw, and pitch *----------------------------------------------------------------*/ if ( ism_mode == ISM_MODE_DISC && ism_extended_metadata_flag ) { +#ifdef FIX_379_ANGLE + idx_angle1_abs = ism_quant_meta( hIsmMetaData->yaw, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); + idx_angle2_abs = ism_quant_meta( hIsmMetaData->pitch, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#else idx_azimuth_abs = ism_quant_meta( hIsmMetaData->yaw, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); idx_elevation_abs = ism_quant_meta( hIsmMetaData->pitch, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#endif idx_radius_abs = usquant( hIsmMetaData->radius, &valQ, ISM_RADIUS_MIN, ISM_RADIUS_DELTA, 1 << ISM_RADIUS_NBITS ); +#ifdef FIX_379_ANGLE + encode_angle_indices( hBstr, &( hIsmMetaData->orientation_angle ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_angle1_abs, idx_angle2_abs, &flag_abs_yaw[ch], &flag_abs_pitch[ch] ); +#else encode_angle_indices( hBstr, &( hIsmMetaData->angle[1] ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_azimuth_abs, idx_elevation_abs, &flag_abs_azimuth_orientation[ch], &flag_abs_elevation[ch] ); +#endif encode_radius( hBstr, &hIsmMetaData->last_radius_idx, &hIsmMetaData->radius_diff_cnt, hIsmMetaData->last_ism_metadata_flag, idx_radius_abs, &flag_abs_radius[ch] ); } @@ -422,12 +461,20 @@ ivas_error ivas_ism_metadata_enc( if ( abs_next % ISM_NUM_PARAM == 0 ) { +#ifdef FIX_379_ANGLE + hIsmMeta[ch]->position_angle.angle1_diff_cnt = abs_num - 1; +#else hIsmMeta[ch]->angle[0].azimuth_diff_cnt = abs_num - 1; +#endif } if ( abs_next % ISM_NUM_PARAM == 1 ) { +#ifdef FIX_379_ANGLE + hIsmMeta[ch]->position_angle.angle2_diff_cnt = abs_num - 1; +#else hIsmMeta[ch]->angle[0].elevation_diff_cnt = abs_num - 1; +#endif /*hIsmMeta[ch]->elevation_diff_cnt = min( hIsmMeta[ch]->elevation_diff_cnt, ISM_FEC_MAX );*/ } @@ -562,17 +609,27 @@ ivas_error ivas_ism_metadata_enc_create( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISM MetaData\n" ) ); } - +#ifdef FIX_379_ANGLE + st_ivas->hIsmMetaData[ch]->position_angle.last_angle1_idx = 0; + st_ivas->hIsmMetaData[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; + st_ivas->hIsmMetaData[ch]->position_angle.last_angle2_idx = 0; + st_ivas->hIsmMetaData[ch]->position_angle.angle2_diff_cnt = ISM_FEC_MAX - 1; + st_ivas->hIsmMetaData[ch]->orientation_angle.last_angle1_idx = 0; + st_ivas->hIsmMetaData[ch]->orientation_angle.angle1_diff_cnt = ISM_FEC_MAX - 2; + st_ivas->hIsmMetaData[ch]->orientation_angle.last_angle2_idx = 0; + st_ivas->hIsmMetaData[ch]->orientation_angle.angle2_diff_cnt = ISM_FEC_MAX - 2; +#else st_ivas->hIsmMetaData[ch]->angle[0].last_azimuth_idx = 0; st_ivas->hIsmMetaData[ch]->angle[0].azimuth_diff_cnt = ISM_FEC_MAX; st_ivas->hIsmMetaData[ch]->angle[0].last_elevation_idx = 0; st_ivas->hIsmMetaData[ch]->angle[0].elevation_diff_cnt = ISM_FEC_MAX - 1; - st_ivas->hIsmMetaData[ch]->last_radius_idx = 0; - st_ivas->hIsmMetaData[ch]->radius_diff_cnt = ISM_FEC_MAX - 2; st_ivas->hIsmMetaData[ch]->angle[1].last_azimuth_idx = 0; st_ivas->hIsmMetaData[ch]->angle[1].azimuth_diff_cnt = ISM_FEC_MAX - 2; st_ivas->hIsmMetaData[ch]->angle[1].last_elevation_idx = 0; st_ivas->hIsmMetaData[ch]->angle[1].elevation_diff_cnt = ISM_FEC_MAX - 2; +#endif + st_ivas->hIsmMetaData[ch]->last_radius_idx = 0; + st_ivas->hIsmMetaData[ch]->radius_diff_cnt = ISM_FEC_MAX - 2; st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0; ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); @@ -700,6 +757,244 @@ static void encode_radius( * * Encoding of an angle *----------------------------------------------------------------*/ +#ifdef FIX_379_ANGLE +static void encode_angle_indices( + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + ISM_METADATA_ANGLE_HANDLE angle, /* i/o: angle handle */ + const int16_t last_ism_metadata_flag, /* i : last frame ism_metadata_flag */ + const int16_t ini_frame, /* i : initialization frames counter */ + const int16_t idx_angle1_abs, /* i : Azimuth index */ + const int16_t idx_angle2_abs, /* i : Elevation index */ + int16_t *flag_abs_angle1, /* o : Azimuth/yaw encoding mode */ + int16_t *flag_abs_angle2 /* o : Elevation/pitch encoding mode */ +) +{ + int16_t idx_angle1, nbits_diff_angle1, diff; + int16_t idx_angle2, nbits_diff_angle2; + + /*----------------------------------------------------------------* + * Azimuth/yaw index encoding + *----------------------------------------------------------------*/ + + idx_angle1 = idx_angle1_abs; + + nbits_diff_angle1 = 0; + + *flag_abs_angle1 = 0; /* differential coding by default */ + if ( angle->angle1_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ + || last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ + ) + { + *flag_abs_angle1 = 1; + } + + /* try differential coding */ + if ( *flag_abs_angle1 == 0 ) + { + diff = idx_angle1_abs - angle->last_angle1_idx; + + /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ + if ( abs( diff ) > ( ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - ISM_MAX_AZIMUTH_DIFF_IDX ) + { + if ( diff > 0 ) + { + diff -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; + } + else + { + diff += ( 1 << ISM_AZIMUTH_NBITS ) - 1; + } + } + + if ( diff == 0 ) + { + idx_angle1 = 0; + nbits_diff_angle1 = 1; + } + else if ( ABSVAL( diff ) < ISM_MAX_AZIMUTH_DIFF_IDX ) /* when diff bits >= abs bits, prefer abs */ + { + idx_angle1 = 1 << 1; + nbits_diff_angle1 = 1; + + if ( diff < 0 ) + { + idx_angle1 += 1; /* negative sign */ + diff *= -1; + } + else + { + idx_angle1 += 0; /* positive sign */ + } + + idx_angle1 = idx_angle1 << diff; + nbits_diff_angle1++; + + /* unary coding of "diff */ + idx_angle1 += ( ( 1 << diff ) - 1 ); + nbits_diff_angle1 += diff; + + if ( nbits_diff_angle1 < ISM_AZIMUTH_NBITS - 1 ) + { + /* add stop bit - only for codewords shorter than ISM_AZIMUTH_NBITS */ + idx_angle1 = idx_angle1 << 1; + nbits_diff_angle1++; + } + } + else + { + *flag_abs_angle1 = 1; + } + } + + /* update counter */ + if ( *flag_abs_angle1 == 0 ) + { + angle->angle1_diff_cnt++; + angle->angle2_diff_cnt = min( angle->angle2_diff_cnt, ISM_FEC_MAX ); + } + else + { + angle->angle1_diff_cnt = 0; + } + + /* Write azimuth/yaw */ + push_indice( hBstr, IND_ISM_AZIMUTH_DIFF_FLAG, *flag_abs_angle1, 1 ); + + if ( *flag_abs_angle1 ) + { + push_indice( hBstr, IND_ISM_AZIMUTH, idx_angle1, ISM_AZIMUTH_NBITS ); + } + else + { + push_indice( hBstr, IND_ISM_AZIMUTH, idx_angle1, nbits_diff_angle1 ); + } + + /*----------------------------------------------------------------* + * Elevation/pitch index encoding + *----------------------------------------------------------------*/ + + idx_angle2 = idx_angle2_abs; + nbits_diff_angle2 = 0; + *flag_abs_angle2 = 0; /* differential coding by default */ + if ( angle->angle2_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ + || last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ + ) + { + *flag_abs_angle2 = 1; + } + + /* note: elevation/pitch is coded starting from the second frame only (it is meaningless in the init_frame) */ + if ( ini_frame == 0 ) + { + *flag_abs_angle2 = 1; + angle->last_angle2_idx = idx_angle2_abs; + } + + diff = idx_angle2_abs - angle->last_angle2_idx; + + /* avoid absolute coding of elevation/pitch if absolute coding was already used for azimuth/yaw */ + if ( *flag_abs_angle1 == 1 ) + { + int16_t diff_orig = diff; + + *flag_abs_angle2 = 0; + + + if ( diff >= 0 ) + { + diff = min( diff, ISM_MAX_ELEVATION_DIFF_IDX ); + } + else + { + diff = -1 * min( -diff, ISM_MAX_ELEVATION_DIFF_IDX ); + } + + if ( last_ism_metadata_flag == 0 || abs( diff_orig - diff ) > ISM_MAX_ELEVATION_DIFF_IDX ) + { + angle->angle2_diff_cnt = ISM_FEC_MAX - 1; + } + } + + /* try differential coding */ + if ( *flag_abs_angle2 == 0 ) + { + if ( diff == 0 ) + { + idx_angle2 = 0; + nbits_diff_angle2 = 1; + } + else if ( ABSVAL( diff ) <= ISM_MAX_ELEVATION_DIFF_IDX ) + { + idx_angle2 = 1 << 1; + nbits_diff_angle2 = 1; + + if ( diff < 0 ) + { + idx_angle2 += 1; /* negative sign */ + diff *= -1; + } + else + { + idx_angle2 += 0; /* positive sign */ + } + + idx_angle2 = idx_angle2 << diff; + nbits_diff_angle2++; + + /* unary coding of "diff */ + idx_angle2 += ( ( 1 << diff ) - 1 ); + nbits_diff_angle2 += diff; + + if ( nbits_diff_angle2 < ISM_ELEVATION_NBITS ) + { + /* add stop bit */ + idx_angle2 = idx_angle2 << 1; + nbits_diff_angle2++; + } + } + else + { + *flag_abs_angle2 = 1; + } + } + + /* update counter */ + if ( *flag_abs_angle2 == 0 ) + { + angle->angle2_diff_cnt++; + angle->angle2_diff_cnt = min( angle->angle2_diff_cnt, ISM_FEC_MAX ); + } + else + { + angle->angle2_diff_cnt = 0; + } + + /* Write elevation */ + if ( *flag_abs_angle1 == 0 ) /* do not write "flag_abs_elevation/pitch" if "flag_abs_azimuth/yaw == 1" */ + { + push_indice( hBstr, IND_ISM_ELEVATION_DIFF_FLAG, *flag_abs_angle2, 1 ); + } + + if ( *flag_abs_angle2 ) + { + push_indice( hBstr, IND_ISM_ELEVATION, idx_angle2, ISM_ELEVATION_NBITS ); + } + else + { + push_indice( hBstr, IND_ISM_ELEVATION, idx_angle2, nbits_diff_angle2 ); + } + + /*----------------------------------------------------------------* + * Updates + *----------------------------------------------------------------*/ + + angle->last_angle1_idx = idx_angle1_abs; + angle->last_angle2_idx = idx_angle2_abs; + + return; +} + +#else static void encode_angle_indices( BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ @@ -936,7 +1231,7 @@ static void encode_angle_indices( return; } - +#endif #ifdef DISCRETE_ISM_DTX_CNG /*-------------------------------------------------------------------* @@ -1056,13 +1351,24 @@ void ivas_ism_metadata_sid_enc( /* update last indexes to correspond to active frames coding */ if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) { +#ifdef FIX_379_ANGLE + hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); + hIsmMetaData->position_angle.last_angle2_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); + +#else hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); +#endif } else { +#ifdef FIX_379_ANGLE + hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); + hIsmMetaData->position_angle.last_angle2_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); +#else hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); +#endif } } } diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index ebc2551ce2..d9bd9d688f 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -61,6 +61,9 @@ struct IVAS_ENC bool ismMetadataProvided[MAX_NUM_OBJECTS]; bool maxBandwidthUser; /* Was a specific max bandwith selected by the user? */ IVAS_ENC_BANDWIDTH newBandwidthApi; /* maximum encoded bandwidth, as set on API level */ +#ifdef FIX_379_EXT_METADATA + bool extMetadataApi; /* External metadata requested, to be checked against current bit rate */ +#endif }; /*---------------------------------------------------------------------* @@ -75,7 +78,11 @@ static int16_t getInputBufferSize( const Encoder_Struct *st_ivas ); static ivas_error doCommonConfigureChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error doCommonSetterChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error sanitizeBandwidth( const IVAS_ENC_HANDLE hIvasEnc ); +#ifdef FIX_379_EXT_METADATA +static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig, const IVAS_ENC_HANDLE hIvasEnc ); +#else static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig ); +#endif static void init_encoder_config( ENCODER_CONFIG_HANDLE hEncoderConfig ); static void resetIsmMetadataProvidedFlags( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error bandwidthApiToInternal( const IVAS_ENC_BANDWIDTH maxBandwidth, int16_t *internalMaxBandwidth ); @@ -391,6 +398,9 @@ ivas_error IVAS_ENC_ConfigureForObjects( st_ivas->hEncoderConfig->nchan_ism = numObjects; #endif st_ivas->hEncoderConfig->ism_extended_metadata_flag = ism_extended_metadata; +#ifdef FIX_379_EXT_METADATA + hIvasEnc->extMetadataApi = ( ism_extended_metadata == 1 ); +#endif hIvasEnc->maxBandwidthUser = max_bwidth_user; error = configureEncoder( hIvasEnc, inputFs, bitrate, maxBandwidth, dtxConfig, IVAS_ENC_GetDefaultChannelAwareConfig() ); @@ -781,7 +791,11 @@ static ivas_error configureEncoder( } else if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { +#ifdef FIX_379_EXT_METADATA + if ( ( error = sanitizeBitrateISM( hEncoderConfig, hIvasEnc ) ) != IVAS_ERR_OK ) +#else if ( ( error = sanitizeBitrateISM( hEncoderConfig ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -1737,7 +1751,11 @@ static ivas_error setBitrate( if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { +#ifdef FIX_379_EXT_METADATA + if ( ( error = sanitizeBitrateISM( hEncoderConfig, hIvasEnc ) ) != IVAS_ERR_OK ) +#else if ( ( error = sanitizeBitrateISM( hEncoderConfig ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -1976,7 +1994,12 @@ static ivas_error sanitizeBandwidth( *---------------------------------------------------------------------*/ static ivas_error sanitizeBitrateISM( +#ifdef FIX_379_EXT_METADATA + const ENCODER_CONFIG_HANDLE hEncoderConfig, + const IVAS_ENC_HANDLE hIvasEnc ) +#else const ENCODER_CONFIG_HANDLE hEncoderConfig ) +#endif { if ( hEncoderConfig->ivas_total_brate > IVAS_128k && hEncoderConfig->nchan_inp == 1 ) { @@ -2008,10 +2031,21 @@ static ivas_error sanitizeBitrateISM( return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 4 ISM specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } +#ifdef FIX_379_EXT_METADATA + if ( hIvasEnc->extMetadataApi ) + { + hEncoderConfig->ism_extended_metadata_flag = ( hEncoderConfig->ivas_total_brate >= ISM_EXTENDED_METADATA_BRATE ); + } + else + { + hEncoderConfig->ism_extended_metadata_flag = 0; + } +#else if ( hEncoderConfig->ivas_total_brate < ISM_EXTENDED_METADATA_BRATE && hEncoderConfig->ism_extended_metadata_flag == 1 ) { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for extended metadata format specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } +#endif return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 4449945711..b14db0b7c2 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -96,7 +96,7 @@ ivas_error TDREND_MIX_SRC_SetPos( /*-------------------------------------------------------------------* * TDREND_MIX_SRC_SetDir() * - * Set source direciton + * Set source direction --------------------------------------------------------------------*/ ivas_error TDREND_MIX_SRC_SetDir( @@ -460,7 +460,11 @@ static void TDREND_SRC_SPATIAL_Init( SrcSpatial_p->DistAttenEnabled = FALSE; SrcSpatial_p->DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED; SrcSpatial_p->DistAtten.RefDist = 1.0f; +#ifdef FIX_379_EXT_METADATA + SrcSpatial_p->DistAtten.MaxDist = 15.75f; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ +#else SrcSpatial_p->DistAtten.MaxDist = 10.0f; +#endif SrcSpatial_p->DistAtten.RollOffFactor = 1.0f; return; diff --git a/lib_util/ism_file_reader.c b/lib_util/ism_file_reader.c index b27d0e9e78..0aeca6d6a0 100644 --- a/lib_util/ism_file_reader.c +++ b/lib_util/ism_file_reader.c @@ -135,12 +135,21 @@ ivas_error IsmFileReader_readNextFrame( meta_prm[i++] = (float) atof( char_ptr ); } +#ifdef FIX_379_EXT_METADATA + /* Verify the number of metadata values. */ + if ( i < NUM_MIN_ISM_METADATA || char_ptr != NULL ) + { + /* Invalid number of metadata parameters (2-7 supported) */ + return IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT; + } +#else /* Check if minimum number of metadata values were read. Additional values are ignored. */ if ( i < NUM_MIN_ISM_METADATA ) { /* Not enough values provided in one line */ return IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT; } +#endif ismMetadata->azimuth = meta_prm[0]; @@ -162,7 +171,11 @@ ivas_error IsmFileReader_readNextFrame( return IVAS_ERR_ISM_INVALID_METADATA_VALUE; } +#ifdef FIX_379_EXT_METADATA + if ( ismMetadata->radius < 0 ) /* Negative radius not supported. Max quantized radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */ +#else if ( ismMetadata->radius < 0 ) // Ivas_fmToDo: to be reviewed +#endif { return IVAS_ERR_ISM_INVALID_METADATA_VALUE; } -- GitLab From 9cf7497a09ead8261d236fb17243e65487a50cda Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Thu, 6 Apr 2023 10:19:18 +0200 Subject: [PATCH 365/375] Issue-24 remove LFE processing from MCT --- lib_com/bitstream.c | 3 +- lib_com/core_com_config.c | 34 +++++- lib_com/ivas_cnst.h | 12 +- lib_com/ivas_mct_com.c | 23 +++- lib_com/ivas_prot.h | 14 +++ lib_com/options.h | 5 +- lib_com/prot.h | 47 +++++--- lib_com/tcx_utils.c | 46 ++++++-- lib_dec/core_dec_init.c | 22 +++- lib_dec/core_dec_switch.c | 14 ++- lib_dec/dec_tcx.c | 70 ++++++++++-- lib_dec/er_util.c | 8 +- lib_dec/init_dec.c | 36 +++++- lib_dec/ivas_cpe_dec.c | 10 +- lib_dec/ivas_dec.c | 2 + lib_dec/ivas_init_dec.c | 9 +- lib_dec/ivas_mct_core_dec.c | 38 +++++-- lib_dec/ivas_mct_dec.c | 117 +++++++++++++++++-- lib_dec/ivas_mct_dec_mct.c | 64 +++++++++-- lib_dec/ivas_mdct_core_dec.c | 97 ++++++++++++---- lib_dec/ivas_out_setup_conversion.c | 16 ++- lib_dec/ivas_stat_dec.h | 11 +- lib_dec/ivas_stereo_mdct_core_dec.c | 24 +++- lib_dec/ivas_stereo_switching_dec.c | 3 +- lib_dec/ivas_tcx_core_dec.c | 22 +++- lib_dec/tonalMDCTconcealment.c | 39 +++++-- lib_enc/bw_detect.c | 20 +++- lib_enc/cod_tcx.c | 45 +++++++- lib_enc/core_enc_init.c | 7 +- lib_enc/core_enc_switch.c | 21 +++- lib_enc/evs_enc.c | 7 +- lib_enc/ext_sig_ana.c | 68 +++++++++-- lib_enc/hq_core_enc.c | 7 +- lib_enc/init_enc.c | 18 ++- lib_enc/ivas_core_enc.c | 10 +- lib_enc/ivas_corecoder_enc_reconfig.c | 16 ++- lib_enc/ivas_cpe_enc.c | 31 +++++- lib_enc/ivas_mct_core_enc.c | 99 +++++++++++++--- lib_enc/ivas_mct_enc.c | 155 +++++++++++++++++++++++--- lib_enc/ivas_mct_enc_mct.c | 152 ++++++++++++++++++++----- lib_enc/ivas_mdct_core_enc.c | 153 ++++++++++++++++++++----- lib_enc/ivas_stat_enc.h | 5 +- lib_enc/ivas_stereo_mdct_core_enc.c | 12 +- lib_enc/ivas_stereo_switching_enc.c | 7 +- lib_enc/ivas_tcx_core_enc.c | 14 ++- lib_enc/pre_proc.c | 7 +- lib_enc/transient_detection.c | 9 +- lib_enc/updt_enc.c | 7 +- 48 files changed, 1392 insertions(+), 264 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index e5f72590a6..f8e70061bf 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -833,12 +833,13 @@ static ivas_error write_indices_element( /* restore previous pointer position */ pt_stream_loc = pt_stream_backup; } - +#ifndef ISSUE_24_CLEANUP_MCT_LFE /* TODO implemented only for MCT for now */ if ( ( st_ivas->hEncoderConfig->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_MCT ) && ( element_id * CPE_CHANNELS + n == LFE_CHANNEL ) ) { continue; } +#endif #ifdef ENABLE_BITRATE_VERIFICATION total_nb_bits = #endif diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index 120d0876d1..d138fe1a1e 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -247,16 +247,21 @@ int16_t getResq( *-------------------------------------------------------------------*/ int16_t getTnsAllowed( - const int32_t total_brate, /* i : total bitrate */ - const int16_t igf, /* i : flag indicating IGF activity*/ - const int16_t element_mode, /* i : IVAS element mode */ + const int32_t total_brate, /* i : total bitrate */ + const int16_t igf, /* i : flag indicating IGF activity*/ + const int16_t element_mode /* i : IVAS element mode */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , const MCT_CHAN_MODE mct_chan_mode /* i : MCT channel mode */ +#endif ) { int16_t tnsAllowed = 0; +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( mct_chan_mode != MCT_CHAN_MODE_LFE ) { +#endif if ( igf ) { if ( total_brate > HQ_16k40 || ( ( total_brate > HQ_13k20 ) && element_mode == IVAS_CPE_DFT ) ) @@ -268,7 +273,9 @@ int16_t getTnsAllowed( { tnsAllowed = 1; } +#ifndef ISSUE_24_CLEANUP_MCT_LFE } +#endif return tnsAllowed; } @@ -411,16 +418,21 @@ int16_t getIgfPresent( const int16_t element_mode, /* i : IVAS element mode */ const int32_t total_brate, /* i : total bitrate */ const int16_t bwidth, /* i : audio bandwidth */ - const int16_t rf_mode, /* i : flag to signal the RF mode */ + const int16_t rf_mode /* i : flag to signal the RF mode */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , const int16_t mct_chan_mode /* i : MCT channel mode */ +#endif ) { int16_t igfPresent = 0; +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( mct_chan_mode == MCT_CHAN_MODE_LFE ) { return igfPresent; } +#endif if ( bwidth == SWB ) { @@ -808,8 +820,11 @@ void init_tcx_cfg( const int16_t infoIGFStopFreq, const int16_t element_mode, const int16_t ini_frame, - const int16_t MCT_flag, + const int16_t MCT_flag +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , const MCT_CHAN_MODE mct_chan_mode /* i : MDCT channel mode */ +#endif ) { int16_t i; @@ -840,13 +855,20 @@ void init_tcx_cfg( /* set number of coded lines */ hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( bwidth ); +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( mct_chan_mode == MCT_CHAN_MODE_LFE ) { hTcxCfg->tcx_coded_lines = MCT_LFE_MAX_LINE; } +#endif /* TNS in TCX */ hTcxCfg->pCurrentTnsConfig = NULL; - hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, igf, element_mode, mct_chan_mode ); + hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, igf, element_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + mct_chan_mode +#endif + ); if ( hTcxCfg->fIsTNSAllowed ) { diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 1da32f2145..af56594872 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1277,17 +1277,25 @@ typedef enum #define BITRATE_MCT_RATIO_RANGE ( 1 << NBBITS_MCT_RATIO ) /* Range of the coded bitrate distribution ratio */ #define LFE_BITS 180 - +#ifndef ISSUE_24_CLEANUP_MCT_LFE #define MCT_LFE_MAX_LINE 24 +#endif #define MCT_NUM_BLOCK_DATA_BITS 4 +#ifndef ISSUE_24_CLEANUP_MCT_LFE typedef enum { MCT_CHAN_MODE_REGULAR, MCT_CHAN_MODE_LFE, MCT_CHAN_MODE_IGNORE } MCT_CHAN_MODE; - +#else +typedef enum +{ + MCT_CHAN_MODE_REGULAR, + MCT_CHAN_MODE_IGNORE +} MCT_CHAN_MODE; +#endif /*----------------------------------------------------------------------------------* * Parametric MC Constants diff --git a/lib_com/ivas_mct_com.c b/lib_com/ivas_mct_com.c index 5ef4d29478..5a6eafed5b 100644 --- a/lib_com/ivas_mct_com.c +++ b/lib_com/ivas_mct_com.c @@ -66,11 +66,13 @@ void splitAvailableBitsMCT( int16_t min_chan_bits[MCT_MAX_CHANNELS], min_bits_tot, remaining_bits; int16_t core[MCT_MAX_CHANNELS]; MCT_CHAN_MODE mct_chan_mode[MCT_MAX_CHANNELS]; +#ifndef ISSUE_24_CLEANUP_MCT_LFE int16_t num_lfe; int16_t lfe_channel; num_lfe = 0; lfe_channel = -1; +#endif min_bits_tot = 0; for ( i = 0; i < nchan; i++ ) @@ -85,18 +87,23 @@ void splitAvailableBitsMCT( mct_chan_mode[i] = ( (Decoder_State *) sts[i] )->mct_chan_mode; core[i] = ( (Decoder_State *) sts[i] )->core; } - +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( mct_chan_mode[i] == MCT_CHAN_MODE_LFE ) { num_lfe++; lfe_channel = i; assert( lfe_channel == LFE_CHANNEL ); } +#endif } for ( i = 0; i < nchan; i++ ) { - if ( mct_chan_mode[i] != MCT_CHAN_MODE_LFE && mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + mct_chan_mode[i] != MCT_CHAN_MODE_LFE && +#endif + mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) { min_chan_bits[i] = 0; @@ -128,7 +135,11 @@ void splitAvailableBitsMCT( bits_frame_channel = &( (Decoder_State *) sts[i] )->bits_frame_channel; } - if ( mct_chan_mode[i] != MCT_CHAN_MODE_LFE && mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + mct_chan_mode[i] != MCT_CHAN_MODE_LFE && +#endif + mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) { assert( split_ratio[i] >= 1 && split_ratio[i] < BITRATE_MCT_RATIO_RANGE ); *bits_frame_channel = split_ratio[i] * remaining_bits / BITRATE_MCT_RATIO_RANGE + min_chan_bits[i]; @@ -162,7 +173,11 @@ void splitAvailableBitsMCT( bits_frame_channel = &( (Decoder_State *) sts[i] )->bits_frame_channel; } - if ( mct_chan_mode[i] != MCT_CHAN_MODE_LFE && mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + mct_chan_mode[i] != MCT_CHAN_MODE_LFE && +#endif + mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) { *bits_frame_channel -= diff * split_ratio[i] / BITRATE_MCT_RATIO_RANGE; *bits_frame_channel = max( min_chan_bits[i], *bits_frame_channel ); diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 2aab3dd7ee..55ddf5aabc 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -2227,7 +2227,9 @@ void decoder_tcx_imdct( float synthFB[], const int16_t bfi, /* i : Bad frame indicator */ const int16_t frame_cnt, /* i : frame counter in the super frame */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE const int16_t isLFE, /* i : is LFE */ +#endif const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ ); @@ -2792,7 +2794,9 @@ void ivas_mdct_core_whitening_enc( int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* o : size of TNS */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to parameter array */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE int16_t *LFE_off, /* o : flag if LFE has content */ +#endif const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ const int16_t nChannels /* i : total number of coded channels */ ); @@ -2810,7 +2814,9 @@ void ivas_mct_core_enc( void ivas_mdct_quant_coder( CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE const int16_t LFE_off, /* i : flag if LFE has content */ +#endif int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* i : bits needed for TNS parameters */ int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* i : size of TNS */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to parameter array */ @@ -2861,7 +2867,9 @@ void ivas_mdct_dec_side_bits_frame_channel( int16_t param_lpc[MCT_MAX_CHANNELS][NPRM_LPC_NEW], /* o : lpc_parameters */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to param buffer */ Decoder_State *st0, /* i : pointer to bitstream handle */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE int16_t *LFE_off, /* o : flag if LFE has content */ +#endif int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* o : number of bits for TNS */ int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i/o: parameters buffer */ const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ @@ -2881,7 +2889,9 @@ void ivas_mct_side_bits( void ivas_mdct_core_invQ( CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE const int16_t LFE_off, /* i : flag if LFE content */ +#endif int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* i : number of TNS bits */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to param buffer */ int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* i : lpc parameters */ @@ -2899,14 +2909,18 @@ void ivas_mdct_core_reconstruct( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ float *x[][NB_DIV], /* i/o: pointers to synthesis @internal_FS */ float signal_outFB[CPE_CHANNELS][L_FRAME_PLUS], /* o : synthesis @output_FS */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE const int16_t LFE_off, /* i : flag if LFE content */ +#endif int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */ const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void ivas_mdct_core_tns_ns( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE const int16_t LFE_off, /* i : flag if LFE has content */ +#endif int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : two entries for each channel in TCX10 */ STnsData tnsData[CPE_CHANNELS][NB_DIV], /* o : TNS parameter */ float *x[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */ diff --git a/lib_com/options.h b/lib_com/options.h index 6d97909f18..756d78e97b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -64,7 +64,7 @@ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_DFT*/ /* output most important DFT stereo parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TD*/ /* output most important TD stereo parameters to the subdirectory "res/ */ -/*#define DEBUG_MODE_DIRAC*/ /* output most important DIRAC parameters to the subdirectory "res/" */ +//#define DEBUG_MODE_DIRAC /* output most important DIRAC parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_MDCT*/ /* output most important MDCT parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_PARAM_MC */ /* output Parametric MC paramters to the subdirectory "res/" */ /*#define DEBUG_MODE_PARAM_ISM*/ /* output Parametric ISM paramters to the subdirectory "res/" */ @@ -153,6 +153,9 @@ #define SBA2MONO /* FhG: Issue 365: Adapt processing of SBA mono output to be in line with stereo output (less delay, lower complexity) */ +#define ISSUE_24_CLEANUP_MCT_LFE /* Issue 24: Cleanup LFE path withing MCT */ + + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_com/prot.h b/lib_com/prot.h index e89037076e..eb5537941b 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -7150,8 +7150,11 @@ void WindowSignal( int16_t *L_frame, /* i/o: frame length */ float out[], /* o : output windowed signal */ const int16_t truncate_aldo, /* i : nonzero to truncate long ALDO slope */ - const int16_t fullband, /* i : fullband flag */ - const int16_t isLfe /* i : LFE flag */ + const int16_t fullband /* i : fullband flag */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + const int16_t isLfe /* i : LFE flag */ +#endif ); void HBAutocorrelation( @@ -7304,8 +7307,11 @@ void tcx_get_windows( const float **left_win, /* o : left overlap window */ int16_t *right_overlap, /* o : right overlap length */ const float **right_win, /* o : right overlap window */ - const int16_t fullband, /* i : fullband flag */ - const int16_t isLfe /* i : LFE flag */ + const int16_t fullband /* i : fullband flag */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + const int16_t isLfe /* i : LFE flag */ +#endif ); void tcx_windowing_analysis( @@ -9492,11 +9498,15 @@ void TonalMDCTConceal_SaveTimeSignal( const int16_t numSamples ); void TonalMDCTConceal_Detect( - const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ - const float pitchLag, /*IN */ - int16_t *umIndices, /*OUT*/ - const PsychoacousticParameters *psychParamsCurrent, /*IN*/ - const int16_t isLfe ); + const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ + const float pitchLag, /*IN */ + int16_t *umIndices, /*OUT*/ + const PsychoacousticParameters *psychParamsCurrent /*IN*/ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + const int16_t isLfe +#endif +); void TonalMDCTConceal_Apply( TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ @@ -9628,10 +9638,13 @@ int16_t getTcxonly( ); int16_t getTnsAllowed( - const int32_t total_brate, /* i : total bitrate */ - const int16_t igf, /* i : flag indicating IGF activity*/ - const int16_t element_mode, /* i : IVAS element mode */ + const int32_t total_brate, /* i : total bitrate */ + const int16_t igf, /* i : flag indicating IGF activity*/ + const int16_t element_mode /* i : IVAS element mode */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , const MCT_CHAN_MODE mct_chan_mode /* i : MCT channel mode */ +#endif ); int16_t getCtxHm( @@ -9673,8 +9686,11 @@ int16_t getIgfPresent( const int16_t element_mode, /* i : IVAS element mode */ const int32_t total_brate, /* i : total bitrate */ const int16_t bwidth, /* i : audio bandwidth */ - const int16_t rf_mode, /* i : flag to signal the RF mode */ + const int16_t rf_mode /* i : flag to signal the RF mode */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , const int16_t mct_chan_mode /* i : MCT channel mode */ +#endif ); int16_t getCnaPresent( @@ -9971,6 +9987,9 @@ void init_tcx_cfg( const int16_t infoIGFStopFreq, const int16_t element_mode, const int16_t ini_frame, - const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , const MCT_CHAN_MODE mct_chan_mode /* i : MCT channel mode */ +#endif ); diff --git a/lib_com/tcx_utils.c b/lib_com/tcx_utils.c index 07618c7cd2..7eede5ae65 100644 --- a/lib_com/tcx_utils.c +++ b/lib_com/tcx_utils.c @@ -59,16 +59,20 @@ void tcx_get_windows( const float **left_win, /* o : left overlap window */ int16_t *right_overlap, /* o : right overlap length */ const float **right_win, /* o : right overlap window */ - const int16_t fullband, /* i : fullband flag */ - const int16_t isLfe /* i : LFE flag */ + const int16_t fullband /* i : fullband flag */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + const int16_t isLfe /* i : LFE flag */ +#endif ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE /* LFE is only FULL_OVERLAP*/ if ( isLfe ) { assert( left_mode == FULL_OVERLAP && right_mode == FULL_OVERLAP ); } - +#endif if ( !fullband ) { /* Left part */ @@ -91,6 +95,7 @@ void tcx_get_windows( } else if ( left_mode == FULL_OVERLAP ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( isLfe ) { *left_overlap = hTcxCfg->tcx_mdct_window_length; @@ -98,9 +103,12 @@ void tcx_get_windows( } else { +#endif *left_overlap = hTcxCfg->tcx_mdct_window_length; *left_win = hTcxCfg->tcx_aldo_window_1_trunc; +#ifndef ISSUE_24_CLEANUP_MCT_LFE } +#endif } else { @@ -121,6 +129,7 @@ void tcx_get_windows( } else if ( right_mode == FULL_OVERLAP ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( isLfe ) { *right_overlap = hTcxCfg->tcx_mdct_window_length; @@ -128,9 +137,12 @@ void tcx_get_windows( } else { +#endif *right_overlap = hTcxCfg->tcx_mdct_window_delay; *right_win = hTcxCfg->tcx_aldo_window_2; +#ifndef ISSUE_24_CLEANUP_MCT_LFE } +#endif } else { @@ -164,6 +176,7 @@ void tcx_get_windows( } else if ( left_mode == FULL_OVERLAP ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( isLfe ) { *left_overlap = hTcxCfg->tcx_mdct_window_lengthFB; @@ -171,9 +184,12 @@ void tcx_get_windows( } else { +#endif *left_overlap = hTcxCfg->tcx_mdct_window_lengthFB; *left_win = hTcxCfg->tcx_aldo_window_1_FB_trunc; +#ifndef ISSUE_24_CLEANUP_MCT_LFE } +#endif } else { @@ -199,6 +215,7 @@ void tcx_get_windows( } else if ( right_mode == FULL_OVERLAP ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( isLfe ) { *right_overlap = hTcxCfg->tcx_mdct_window_lengthFB; @@ -206,9 +223,12 @@ void tcx_get_windows( } else { +#endif *right_overlap = hTcxCfg->tcx_mdct_window_delayFB; *right_win = hTcxCfg->tcx_aldo_window_2_FB; +#ifndef ISSUE_24_CLEANUP_MCT_LFE } +#endif } else { @@ -276,8 +296,11 @@ void WindowSignal( int16_t *L_frame, /* i/o: frame length */ float out[], /* o : output windowed signal */ const int16_t truncate_aldo, /* i : nonzero to truncate long ALDO slope */ - const int16_t fullband, /* i : fullband flag */ - const int16_t isLfe /* i : LFE flag */ + const int16_t fullband /* i : fullband flag */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + const int16_t isLfe /* i : LFE flag */ +#endif ) { int16_t l, r; @@ -288,7 +311,12 @@ void WindowSignal( * Init * *-----------------------------------------------------------*/ - tcx_get_windows( hTcxCfg, left_overlap_mode, right_overlap_mode, &l, &left_win, &r, &right_win, fullband, isLfe ); + tcx_get_windows( hTcxCfg, left_overlap_mode, right_overlap_mode, &l, &left_win, &r, &right_win, fullband +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + isLfe +#endif + ); /* Init lengths */ @@ -314,7 +342,11 @@ void WindowSignal( tcx_windowing_analysis( in - l / 2 + offset, *L_frame, l, left_win, r, right_win, out ); - if ( left_overlap_mode == FULL_OVERLAP && truncate_aldo && !isLfe ) + if ( left_overlap_mode == FULL_OVERLAP && truncate_aldo +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && !isLfe +#endif + ) { /* fade truncated ALDO window to avoid discontinuities */ if ( !fullband ) diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index 1e238fb52f..6d6ebeef86 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -190,7 +190,12 @@ void open_decoder_LPD( { if ( !is_init || st->element_mode != IVAS_CPE_MDCT ) { - init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->output_Fs, st->L_frame, st->bwidth, st->hTcxDec->L_frameTCX, st->fscale, encoderLookahead, encoderLookaheadFB, st->preemph_fac, st->tcxonly, st->rf_flag, st->igf, st->hIGFDec->infoIGFStopFreq, st->element_mode, st->ini_frame, MCT_flag, st->mct_chan_mode ); + init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->output_Fs, st->L_frame, st->bwidth, st->hTcxDec->L_frameTCX, st->fscale, encoderLookahead, encoderLookaheadFB, st->preemph_fac, st->tcxonly, st->rf_flag, st->igf, st->hIGFDec->infoIGFStopFreq, st->element_mode, st->ini_frame, MCT_flag +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); } else { @@ -670,10 +675,19 @@ void open_decoder_LPD( st->last_tns_active = 0; st->second_last_tns_active = 0; st->second_last_core = -1; - /* TODO: also apply for MCT modes, once issue #24 is solved */ - if ( st->hTcxCfg != NULL && !MCT_flag && st->element_mode != EVS_MONO ) + + if ( st->hTcxCfg != NULL && +#ifndef ISSUE_24_CLEANUP_MCT_LFE + !MCT_flag && +#endif + st->element_mode != EVS_MONO ) { - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( is_init ? total_brate : st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode, st->mct_chan_mode ); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( is_init ? total_brate : st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); } if ( hTcxDec != NULL ) { diff --git a/lib_dec/core_dec_switch.c b/lib_dec/core_dec_switch.c index a092255a38..b02d0a78f5 100644 --- a/lib_dec/core_dec_switch.c +++ b/lib_dec/core_dec_switch.c @@ -91,7 +91,12 @@ void mode_switch_decoder_LPD( switchWB = 1; /*force init when coming from MODE1*/ } - st->igf = getIgfPresent( st->element_mode, total_brate, bwidth, st->rf_flag, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, total_brate, bwidth, st->rf_flag +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); if ( st->hIGFDec != NULL ) { @@ -140,7 +145,12 @@ void mode_switch_decoder_LPD( if ( st->hTcxCfg != NULL ) { st->hTcxCfg->pCurrentTnsConfig = NULL; - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, st->igf, st->element_mode, st->mct_chan_mode ); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, st->igf, st->element_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); } if ( st->hTcxCfg->fIsTNSAllowed && st->hIGFDec != NULL && st->hTcxCfg != NULL ) diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index 9c81725894..fbdd150217 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -107,7 +107,11 @@ void decoder_tcx( decoder_tcx_tns( st, L_frame_glob, L_spec, L_frame, L_frameTCX, &x[0], fUseTns, &tnsData, bfi, frame_cnt, 0 ); decoder_tcx_imdct( st, L_frame_glob, L_frameTCX_glob, L_spec, tcx_offset, tcx_offsetFB, L_frame, L_frameTCX, left_rect, &x[0], &xn_buf[0], MDCT_IV, - fUseTns, &synth[0], &synthFB[0], bfi, frame_cnt, 0, sba_dirac_stereo_flag ); + fUseTns, &synth[0], &synthFB[0], bfi, frame_cnt, +#ifndef ISSUE_24_CLEANUP_MCT_LFE + 0, +#endif + sba_dirac_stereo_flag ); return; } @@ -335,7 +339,12 @@ void IMDCT( v_multc( old_syn_overl, hTcxDec->conceal_eof_gain * st->last_concealed_gain_syn_deemph, old_syn_overl, overlap ); } - if ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 || st->mct_chan_mode == MCT_CHAN_MODE_LFE ) && ( st->tcxonly ) ) + if ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 +#ifndef ISSUE_24_CLEANUP_MCT_LFE + || st->mct_chan_mode == MCT_CHAN_MODE_LFE +#endif + ) && + ( st->tcxonly ) ) { /* Mode decision in PLC @@ -354,7 +363,9 @@ void IMDCT( if ( ( !bfi && hTcxCfg->tcx_last_overlap_mode != FULL_OVERLAP ) || ( bfi && ( hTcxCfg->tcx_last_overlap_mode != FULL_OVERLAP ) && ( hTcxCfg->tcx_curr_overlap_mode != FULL_OVERLAP ) ) ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE assert( st->mct_chan_mode != MCT_CHAN_MODE_LFE ); +#endif /* minimum or half overlap, two transforms, grouping into one window */ L_win = L_frame >> 1; L_ola = ( hTcxCfg->tcx_last_overlap_mode == MIN_OVERLAP ) ? tcx_mdct_window_min_length : tcx_mdct_window_half_length; @@ -392,7 +403,11 @@ void IMDCT( /* To assure that no garbage values are passed to overlap */ set_zero( xn_buf + L_frame + tcx_offset + ( L_ola >> 1 ), overlap - tcx_offset - ( L_ola >> 1 ) ); } - else if ( !bfi && ( frame_cnt == 0 ) && ( hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + else if ( !bfi && ( frame_cnt == 0 ) && ( hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && st->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { /* special overlap attempt, two transforms, grouping into one window */ @@ -553,7 +568,13 @@ void IMDCT( /* Window and overlap-add past frame if past frame is TCX */ if ( ( frame_cnt != 0 ) || ( st->last_core_bfi > ACELP_CORE ) ) { - if ( ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 || st->mct_chan_mode == MCT_CHAN_MODE_LFE ) && ( st->tcxonly ) ) || ( hTcxCfg->tcx_last_overlap_mode == TRANSITION_OVERLAP ) ) + if ( ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 +#ifndef ISSUE_24_CLEANUP_MCT_LFE + || st->mct_chan_mode == MCT_CHAN_MODE_LFE +#endif + ) && + ( st->tcxonly ) ) || + ( hTcxCfg->tcx_last_overlap_mode == TRANSITION_OVERLAP ) ) { if ( !bfi && ( frame_cnt > 0 ) && ( index == 0 ) && ( hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) && ( st->last_core != ACELP_CORE ) ) { @@ -616,7 +637,11 @@ void IMDCT( } } - if ( !aldo && ( ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && frame_cnt > 0 ) || L_frameTCX != ( hTcxDec->L_frameTCX >> 1 ) ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( !aldo && ( ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && frame_cnt > 0 ) || L_frameTCX != ( hTcxDec->L_frameTCX >> 1 ) ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && st->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { /* Compute windowed synthesis in case of switching to ALDO windows in next frame */ mvr2r( xn_buf + L_frame - nz, old_out, nz + overlap ); @@ -1557,9 +1582,11 @@ void decoder_tcx_imdct( const int16_t fUseTns, /* i : flag that is set if TNS data is present */ float synth[], /* i/o: synth[-M..L_frame] */ float synthFB[], - const int16_t bfi, /* i : Bad frame indicator */ - const int16_t frame_cnt, /* i : frame counter in the super frame */ - const int16_t isLFE, /* i : is LFE */ + const int16_t bfi, /* i : Bad frame indicator */ + const int16_t frame_cnt, /* i : frame counter in the super frame */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + const int16_t isLFE, /* i : is LFE */ +#endif const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ ) { @@ -1591,7 +1618,11 @@ void decoder_tcx_imdct( hTcxCfg->tcx_last_overlap_mode = hTcxCfg->tcx_curr_overlap_mode; } - if ( !isLFE && st->igf ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + !isLFE && +#endif + st->igf ) { proc = st->hIGFDec->flatteningTrigger; @@ -1689,7 +1720,18 @@ void decoder_tcx_imdct( if ( st->element_mode != IVAS_CPE_DFT && !sba_dirac_stereo_flag ) { - IMDCT( xn_bufFB, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, xn_buf, st->mct_chan_mode == MCT_CHAN_MODE_LFE ? hTcxCfg->tcx_mdct_window : hTcxCfg->tcx_aldo_window_1_trunc, st->mct_chan_mode == MCT_CHAN_MODE_LFE ? hTcxCfg->tcx_mdct_window : hTcxCfg->tcx_aldo_window_2, hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index, + IMDCT( xn_bufFB, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, xn_buf, +#ifndef ISSUE_24_CLEANUP_MCT_LFE + st->mct_chan_mode == MCT_CHAN_MODE_LFE ? hTcxCfg->tcx_mdct_window : hTcxCfg->tcx_aldo_window_1_trunc, +#else + hTcxCfg->tcx_aldo_window_1_trunc, +#endif +#ifndef ISSUE_24_CLEANUP_MCT_LFE + st->mct_chan_mode == MCT_CHAN_MODE_LFE ? hTcxCfg->tcx_mdct_window : hTcxCfg->tcx_aldo_window_2, +#else + hTcxCfg->tcx_aldo_window_2, +#endif + hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index, kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_outLB, 0, st, 0, acelp_zir ); } @@ -1709,7 +1751,13 @@ void decoder_tcx_imdct( if ( st->element_mode != EVS_MONO ) { - IMDCT( x_tmp, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, xn_bufFB, st->mct_chan_mode == MCT_CHAN_MODE_LFE ? hTcxCfg->tcx_mdct_windowFB : hTcxCfg->tcx_aldo_window_1_FB_trunc, st->mct_chan_mode == MCT_CHAN_MODE_LFE ? hTcxCfg->tcx_mdct_windowFB : hTcxCfg->tcx_aldo_window_2_FB, hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index, + IMDCT( x_tmp, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, xn_bufFB, +#ifndef ISSUE_24_CLEANUP_MCT_LFE + st->mct_chan_mode == MCT_CHAN_MODE_LFE ? hTcxCfg->tcx_mdct_windowFB : hTcxCfg->tcx_aldo_window_1_FB_trunc, st->mct_chan_mode == MCT_CHAN_MODE_LFE ? hTcxCfg->tcx_mdct_windowFB : hTcxCfg->tcx_aldo_window_2_FB, +#else + hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, +#endif + hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index, kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out, 1, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir ); } else diff --git a/lib_dec/er_util.c b/lib_dec/er_util.c index 809b0134d9..75f553f1e8 100644 --- a/lib_dec/er_util.c +++ b/lib_dec/er_util.c @@ -318,8 +318,12 @@ int16_t GetPLCModeDecision( { TonalMDCTConceal_Detect( st->hTonalMDCTConc, ( hTcxDec->tcxltp_last_gain_unmodified > 0 ) ? st->old_fpitch : 0, &numIndices, - ( st->element_mode == IVAS_CPE_MDCT ? &( st->hTcxCfg->psychParamsTCX20 ) : st->hTcxCfg->psychParamsCurrent ), - st->mct_chan_mode == MCT_CHAN_MODE_LFE ); + ( st->element_mode == IVAS_CPE_MDCT ? &( st->hTcxCfg->psychParamsTCX20 ) : st->hTcxCfg->psychParamsCurrent ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode == MCT_CHAN_MODE_LFE +#endif + ); if ( ( numIndices > 10 ) || ( ( numIndices > 5 ) && ( fabs( hTcxDec->tcxltp_third_last_pitch - hTcxDec->tcxltp_second_last_pitch ) < 0.5f ) ) || ( ( numIndices > 0 ) && ( ( st->last_good <= UNVOICED_TRANSITION ) || ( hTcxDec->tcxltp_last_gain_unmodified <= 0.4f ) ) && ( fabs( hTcxDec->tcxltp_third_last_pitch - hTcxDec->tcxltp_second_last_pitch ) < 0.5f ) ) ) { diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 34ee7a3cec..97aa4a0fc8 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -326,7 +326,11 @@ ivas_error init_decoder( set_f( st->old_synth_sw, 0.0f, NS2SA( 48000, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS ) ); } - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT || st->element_mode == IVAS_SCE || st->element_mode == EVS_MONO ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT || st->element_mode == IVAS_SCE || st->element_mode == EVS_MONO ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && st->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { if ( ( st->hHQ_core = (HQ_DEC_HANDLE) malloc( sizeof( HQ_DEC_DATA ) ) ) == NULL ) { @@ -519,17 +523,21 @@ ivas_error init_decoder( } /* open synthesis for output sampling rate */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) { +#endif if ( ( error = openCldfb( &st->cldfbSyn, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) { return error; } +#ifndef ISSUE_24_CLEANUP_MCT_LFE } else { st->cldfbSyn = NULL; } +#endif st->cldfbSynHB = NULL; @@ -585,7 +593,11 @@ ivas_error init_decoder( *-----------------------------------------------------------------*/ /* TCX-LTP */ - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && st->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { if ( ( st->hTcxLtpDec = (TCX_LTP_DEC_HANDLE) malloc( sizeof( TCX_LTP_DEC_DATA ) ) ) == NULL ) { @@ -598,7 +610,7 @@ ivas_error init_decoder( } /* TCX core */ - // VE: reduction possible for MCT_CHAN_MODE_LFE channel - see I1-172 + if ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) { if ( ( st->hTcxDec = (TCX_DEC_HANDLE) malloc( sizeof( TCX_DEC_DATA ) ) ) == NULL ) @@ -617,7 +629,11 @@ ivas_error init_decoder( } /* TCX config. data structure */ - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && st->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { if ( ( st->hTcxCfg = (TCX_CONFIG_HANDLE) malloc( sizeof( TCX_config ) ) ) == NULL ) { @@ -630,7 +646,11 @@ ivas_error init_decoder( } /* Tonal MDCT concealment data structure */ - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && st->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { if ( ( st->hTonalMDCTConc = (TonalMDCTConcealPtr) malloc( sizeof( TonalMDCTConceal_INSTANCE ) ) ) == NULL ) { @@ -646,7 +666,11 @@ ivas_error init_decoder( * IGF *-----------------------------------------------------------------*/ - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && st->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { if ( ( st->hIGFDec = (IGF_DEC_INSTANCE_HANDLE) malloc( sizeof( IGFDEC_INSTANCE ) ) ) == NULL ) { diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 17d2efd516..5156aad08c 100755 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -691,10 +691,12 @@ ivas_error create_cpe_dec( st->total_brate = hCPE->element_brate / ( CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT && ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) { st->mct_chan_mode = MCT_CHAN_MODE_LFE; } +#endif if ( ( error = init_decoder( st, n, st_ivas->mc_mode ) ) != IVAS_ERR_OK ) { @@ -835,8 +837,12 @@ void destroy_cpe_dec( int16_t n; Decoder_State *st; - /* make sure we deallocate a potential distinct hTcxCfg for a MCT LFE channel (can only happen in rs) */ - if ( hCPE->hCoreCoder[1] != NULL && hCPE->hCoreCoder[1]->mct_chan_mode == MCT_CHAN_MODE_LFE && hCPE->hCoreCoder[1]->hTcxCfg != hCPE->hCoreCoder[0]->hTcxCfg ) + /* make sure we deallocate a potential distinct hTcxCfg for a MCT LFE channel (can only happen in rs) */ /*TODO Check this again with LFE clean up!*/ + if ( hCPE->hCoreCoder[1] != NULL +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && hCPE->hCoreCoder[1]->mct_chan_mode == MCT_CHAN_MODE_LFE +#endif + && hCPE->hCoreCoder[1]->hTcxCfg != hCPE->hCoreCoder[0]->hTcxCfg ) { hCPE->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index f89a64bf3e..abd01771c0 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -445,10 +445,12 @@ ivas_error ivas_dec( /* LFE channel decoder */ if ( st_ivas->mc_mode == MC_MODE_MCT ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st_ivas->hCPE[1]->hCoreCoder[1]->hTcxCfg == NULL ) { st_ivas->hCPE[1]->hCoreCoder[1]->hTcxCfg = st_ivas->hCPE[1]->hCoreCoder[0]->hTcxCfg; } +#endif ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output_lfe_ch ); } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index e53218d3e7..f3e09c99ff 100755 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1396,13 +1396,14 @@ ivas_error ivas_init_decoder( return error; } +#ifndef ISSUE_24_CLEANUP_MCT_LFE /* reuse core-coder buffers for LFE decoder */ cpe_id = LFE_CHANNEL / CPE_CHANNELS; n = LFE_CHANNEL % CPE_CHANNELS; st_ivas->hLFE->prevsynth_buf = &st_ivas->hCPE[cpe_id]->hCoreCoder[n]->old_synth_sw[0]; st_ivas->hLFE->prior_out_buffer = &st_ivas->hCPE[cpe_id]->hCoreCoder[n]->previoussynth[0]; - +#endif set_zero( st_ivas->hLFE->prevsynth_buf, LFE_PLC_BUFLEN ); set_zero( st_ivas->hLFE->prior_out_buffer, L_FRAME48k ); } @@ -1562,7 +1563,11 @@ void destroy_core_dec( hCoreCoder->hTcxDec = NULL; } - if ( hCoreCoder->hTcxCfg != NULL && hCoreCoder->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( hCoreCoder->hTcxCfg != NULL +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && hCoreCoder->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { free( hCoreCoder->hTcxCfg ); hCoreCoder->hTcxCfg = NULL; diff --git a/lib_dec/ivas_mct_core_dec.c b/lib_dec/ivas_mct_core_dec.c index 7e11b23c9a..5222d39b64 100644 --- a/lib_dec/ivas_mct_core_dec.c +++ b/lib_dec/ivas_mct_core_dec.c @@ -70,7 +70,11 @@ void ivas_mct_side_bits( Decoder_State *st, *sts[MCT_MAX_CHANNELS]; nf_side_bits = 0; - nChannels = hMCT->nchan_out_woLFE + hMCT->num_lfe; + nChannels = hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ; /*initializations */ for ( cpe_id = 0, i = 0; cpe_id < nCPE; cpe_id++ ) @@ -88,7 +92,11 @@ void ivas_mct_side_bits( for ( ch = 0; ch < nChannels; ch++ ) { st = sts[ch]; - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE || st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + st->mct_chan_mode == MCT_CHAN_MODE_LFE || +#endif + st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -108,15 +116,17 @@ void ivas_mct_side_bits( availableBits = 0; ivas_mct_dec_mct( hMCT, sts, nChannels ); - /* availableBits = ((hMCT->mc_bitrate/50) - sts[0]->next_bit_pos); - availableBits -= NBBITS_MCT_RATIO * nChannels;*/ /*read channel bitrate ratios from bitstream*/ for ( ch = 0; ch < nChannels; ch++ ) { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && hMCT->LFE_off ) || st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && hMCT->LFE_off ) || +#endif + st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { chBitRatios[ch] = 0; st->bits_frame_channel = 0; @@ -189,7 +199,11 @@ void ivas_mct_core_dec( * Initializations *--------------------------------------------------------------------------------*/ - nChannels = hMCT->nchan_out_woLFE + hMCT->num_lfe; + nChannels = hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ; /*initializations */ for ( cpe_id = 0, i = 0; cpe_id < nCPE; cpe_id++ ) @@ -203,7 +217,11 @@ void ivas_mct_core_dec( for ( ch = 0, i = 0; ch < nChannels; ch++ ) { - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || +#endif + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -232,7 +250,11 @@ void ivas_mct_core_dec( { st = sts[ch]; - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) /*indicates LFE */ + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + st->mct_chan_mode == MCT_CHAN_MODE_LFE || +#endif + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) /*indicates LFE */ { continue; } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index f39951e087..9073af83ea 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -106,10 +106,12 @@ ivas_error ivas_mct_dec( } } +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( !st_ivas->bfi ) { hMCT->LFE_off = 0; /* in case of PLC, stick to LFE_off of previous frame; otherwise, the update happens in ivas_mdct_dec_side_bits_frame_channel() */ } +#endif for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { @@ -131,9 +133,14 @@ ivas_error ivas_mct_dec( if ( !st_ivas->bfi ) { - ivas_mdct_dec_side_bits_frame_channel( st_ivas->hCPE[cpe_id], param_lpc[cpe_id], p_param[cpe_id], st_ivas->hCPE[0]->hCoreCoder[0], - &hMCT->LFE_off, nTnsBitsTCX10[cpe_id], param[cpe_id], 1, +#ifndef ISSUE_24_CLEANUP_MCT_LFE + ivas_mdct_dec_side_bits_frame_channel( st_ivas->hCPE[cpe_id], param_lpc[cpe_id], p_param[cpe_id], st_ivas->hCPE[0]->hCoreCoder[0], &hMCT->LFE_off, nTnsBitsTCX10[cpe_id], param[cpe_id], 1, ( ( cpe_id + 1 ) * CPE_CHANNELS > st_ivas->nchan_transport ) ); +#else + ivas_mdct_dec_side_bits_frame_channel( st_ivas->hCPE[cpe_id], param_lpc[cpe_id], p_param[cpe_id], st_ivas->hCPE[0]->hCoreCoder[0], nTnsBitsTCX10[cpe_id], param[cpe_id], 1, + ( ( cpe_id + 1 ) * CPE_CHANNELS > hMCT->nchan_out_woLFE ) ); +#endif + st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect; st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect; @@ -156,7 +163,13 @@ ivas_error ivas_mct_dec( set_zero( x[n][1], L_FRAME48k / 2 ); } - ivas_mdct_core_invQ( st_ivas->hCPE[cpe_id], hMCT->LFE_off, nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], + ivas_mdct_core_invQ( st_ivas->hCPE[cpe_id] +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + hMCT->LFE_off +#endif + , + nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], fUseTns[cpe_id], tnsData[cpe_id], x, x, Aq[cpe_id], NULL, 1 ); st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect; @@ -189,7 +202,11 @@ ivas_error ivas_mct_dec( x[n][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2]; } - ivas_mdct_core_tns_ns( hCPE, hMCT->LFE_off, fUseTns[cpe_id], tnsData[cpe_id], x, Aq[cpe_id], 1 ); + ivas_mdct_core_tns_ns( hCPE, +#ifndef ISSUE_24_CLEANUP_MCT_LFE + hMCT->LFE_off, +#endif + fUseTns[cpe_id], tnsData[cpe_id], x, Aq[cpe_id], 1 ); } if ( st_ivas->renderer_type == RENDERER_MC ) @@ -224,7 +241,11 @@ ivas_error ivas_mct_dec( x[n][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2]; } - ivas_mdct_core_reconstruct( hCPE, x, synth, hMCT->LFE_off, fUseTns[cpe_id], 1 ); + ivas_mdct_core_reconstruct( hCPE, x, synth, +#ifndef ISSUE_24_CLEANUP_MCT_LFE + hMCT->LFE_off, +#endif + fUseTns[cpe_id], 1 ); /*----------------------------------------------------------------* * CoreCoder Post-processing and updates @@ -232,10 +253,12 @@ ivas_error ivas_mct_dec( for ( n = 0; n < CPE_CHANNELS; n++ ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( sts[n]->mct_chan_mode == MCT_CHAN_MODE_LFE ) { break; } +#endif if ( st_ivas->sba_dirac_stereo_flag ) { @@ -277,6 +300,23 @@ ivas_error ivas_mct_dec( } #endif } +#ifdef ISSUE_24_CLEANUP_MCT_LFE + /* move channels after LFE to correct output for multi-channel MCT */ + if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) + { + float tmp[L_FRAME48k]; + + /*save center channel output*/ + mvr2r( output[hMCT->nchan_out_woLFE - 1], tmp, output_frame ); + + for ( n = hMCT->nchan_out_woLFE - 1; n >= LFE_CHANNEL; n-- ) + { + mvr2r( output[n - 1], output[n + 1], output_frame ); + } + mvr2r( tmp, output[LFE_CHANNEL - 1], output_frame ); + set_zero( output[LFE_CHANNEL], output_frame ); + } +#endif #ifdef DEBUG_MODE_INFO for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) @@ -312,7 +352,7 @@ ivas_error create_mct_dec( int16_t max_blocks; int16_t cpe_id; - /*-----------------------------------------------------------------* + /*--------------------------------------------------------- --------* * Allocate MCT handle *-----------------------------------------------------------------*/ @@ -326,6 +366,7 @@ ivas_error create_mct_dec( *-----------------------------------------------------------------*/ /* Determine active channels */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) { hMCT->num_lfe = st_ivas->hTransSetup.num_lfe; @@ -341,6 +382,16 @@ ivas_error create_mct_dec( hMCT->num_lfe = 0; hMCT->nchan_out_woLFE = st_ivas->nchan_transport; } +#else + if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) || st_ivas->ivas_format == SBA_FORMAT ) + { + hMCT->nchan_out_woLFE = st_ivas->nchan_transport; + } + else if ( st_ivas->mc_mode == MC_MODE_MCT ) + { + hMCT->nchan_out_woLFE = st_ivas->nchan_transport - st_ivas->hTransSetup.num_lfe; + } +#endif else { assert( !"IVAS format currently not supported for MCT" ); @@ -354,14 +405,21 @@ ivas_error create_mct_dec( for ( n = 0; n < CPE_CHANNELS; n++ ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( ( hMCT->num_lfe > 0 ) && ( ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_LFE; } +#endif } } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE + hMCT->num_lfe ) % 2 ) + if ( ( hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ) % + 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } @@ -441,6 +499,7 @@ ivas_error mct_dec_reconfigure( if ( b_nchan_change ) { /* Determine active channels */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) { hMCT->num_lfe = st_ivas->hTransSetup.num_lfe; @@ -456,6 +515,16 @@ ivas_error mct_dec_reconfigure( hMCT->num_lfe = 0; hMCT->nchan_out_woLFE = st_ivas->nchan_transport; } +#else + if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) || st_ivas->ivas_format == SBA_FORMAT ) + { + hMCT->nchan_out_woLFE = st_ivas->nchan_transport; + } + else if ( st_ivas->mc_mode == MC_MODE_MCT ) + { + hMCT->nchan_out_woLFE = st_ivas->nchan_transport - st_ivas->hTransSetup.num_lfe; + } +#endif else { assert( !"IVAS format currently not supported for MCT" ); @@ -468,15 +537,22 @@ ivas_error mct_dec_reconfigure( for ( n = 0; n < CPE_CHANNELS; n++ ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( ( hMCT->num_lfe > 0 ) && ( ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_LFE; } +#endif } } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE + hMCT->num_lfe ) % 2 ) + if ( ( hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ) % + 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } @@ -493,10 +569,19 @@ ivas_error mct_dec_reconfigure( st->total_brate = st_ivas->hCPE[cpe_id]->element_brate; - if ( !( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) ) + if ( !( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) || +#endif + ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) ) { st->bits_frame_nominal = (int16_t) ( st_ivas->hCPE[cpe_id]->element_brate / FRAMES_PER_SEC ); - st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); if ( st->igf ) { IGFDecSetMode( st->hIGFDec, st_ivas->hCPE[cpe_id]->element_brate, st->bwidth, st->element_mode, -1, -1, st->rf_flag ); @@ -891,8 +976,14 @@ static ivas_error ivas_mc_dec_reconfig( } } - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( ivas_total_brate, st->igf, st->element_mode, st->mct_chan_mode ); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( ivas_total_brate, st->igf, st->element_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); } +#ifndef ISSUE_24_CLEANUP_MCT_LFE else if ( last_mc_mode == MC_MODE_PARAMMC && st_ivas->mc_mode == MC_MODE_MCT && nchan_transport_old > 2 ) { #ifdef DEBUGGING @@ -902,7 +993,7 @@ static ivas_error ivas_mc_dec_reconfig( st->mct_chan_mode = MCT_CHAN_MODE_LFE; st->hTcxCfg->fIsTNSAllowed = 0; } - +#endif if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { uint8_t separateChannelEnabled; @@ -985,9 +1076,11 @@ static ivas_error ivas_mc_dec_reconfig( return error; } +#ifndef ISSUE_24_CLEANUP_MCT_LFE /* reuse core-coder buffers for LFE decoder */ st_ivas->hLFE->prevsynth_buf = &st_ivas->hCPE[1]->hCoreCoder[1]->old_synth_sw[0]; st_ivas->hLFE->prior_out_buffer = &st_ivas->hCPE[1]->hCoreCoder[1]->previoussynth[0]; +#endif set_zero( st_ivas->hLFE->prevsynth_buf, LFE_PLC_BUFLEN ); set_zero( st_ivas->hLFE->prior_out_buffer, L_FRAME48k ); diff --git a/lib_dec/ivas_mct_dec_mct.c b/lib_dec/ivas_mct_dec_mct.c index 7177785984..68a846b876 100644 --- a/lib_dec/ivas_mct_dec_mct.c +++ b/lib_dec/ivas_mct_dec_mct.c @@ -49,8 +49,11 @@ static void indexToChannelPair( MCT_DEC_BLOCK_DATA_HANDLE hBlock, const int16_t nChannels, - const int16_t pairIdx, + const int16_t pairIdx +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , Decoder_State **sts /* i/o: decoder state structure */ +#endif ) { int16_t ch1, ch2; @@ -60,10 +63,12 @@ static void indexToChannelPair( { for ( ch1 = 0; ch1 < ch2; ch1++ ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( sts[ch1]->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch2]->mct_chan_mode == MCT_CHAN_MODE_LFE ) { continue; } +#endif if ( tmpIdx == pairIdx ) { @@ -105,7 +110,11 @@ void ivas_mct_dec_mct( /*first get core and overlap info for all channels*/ for ( ch = 0; ch < nchan; ch++ ) { - if ( ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) && hMCT->currBlockDataCnt && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) && +#endif + hMCT->currBlockDataCnt && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { hMCT->mc_global_ild[ch] = get_next_indice( sts[0], SMDCT_GLOBAL_ILD_BITS ); } @@ -119,7 +128,11 @@ void ivas_mct_dec_mct( { for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE && +#endif + sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { hMCT->lowE_ch[ch] = get_next_indice( sts[0], 1 ); } @@ -128,7 +141,11 @@ void ivas_mct_dec_mct( for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE && +#endif + sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { nchan_active++; } @@ -141,7 +158,12 @@ void ivas_mct_dec_mct( /*get channel pair index from BS*/ channelPairIndex = get_next_indice( sts[0], hMCT->bitsChannelPairIndex ); - indexToChannelPair( hBlock, nchan, channelPairIndex, sts ); + indexToChannelPair( hBlock, nchan, channelPairIndex +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + sts +#endif + ); /*point to decoder states of actual channels to read block pair bits*/ p_st[0] = sts[hBlock->ch1]; @@ -170,7 +192,12 @@ static void applyGlobalILD( int16_t nSubframes, L_subframeTCX; float qratio; - for ( ch = 0; ch < ( hMCT->nchan_out_woLFE + hMCT->num_lfe ); ch++ ) + for ( ch = 0; ch < ( hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ); + ch++ ) { nSubframes = ( sts[ch]->core == TCX_20_CORE ) ? 1 : NB_DIV; L_subframeTCX = sts[ch]->hTcxDec->L_frameTCX / nSubframes; @@ -252,7 +279,11 @@ void mctStereoIGF_dec( float *p_x[CPE_CHANNELS][NB_DIV]; int16_t singleChEle[MCT_MAX_CHANNELS]; - set_s( singleChEle, 1, ( hMCT->nchan_out_woLFE + hMCT->num_lfe ) ); + set_s( singleChEle, 1, ( hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ) ); for ( b = 0; b < hMCT->currBlockDataCnt; b++ ) { @@ -305,9 +336,18 @@ void mctStereoIGF_dec( } - if ( sum_s( singleChEle, ( hMCT->nchan_out_woLFE + hMCT->num_lfe ) ) != 0 ) + if ( sum_s( singleChEle, ( hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ) ) != 0 ) { - for ( ch = 0; ch < ( hMCT->nchan_out_woLFE + hMCT->num_lfe ); ch++ ) + for ( ch = 0; ch < ( hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ); + ch++ ) { if ( singleChEle[ch] ) { @@ -316,7 +356,11 @@ void mctStereoIGF_dec( { continue; } - if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE || st->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + || st->mct_chan_mode == MCT_CHAN_MODE_LFE +#endif + ) { continue; } diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 7763290f87..83aac5cbc1 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -162,22 +162,26 @@ static void dec_prm_tcx_sidebits( getTCXWindowing( st->core, st->last_core, st->element_mode, st->hTcxCfg, st0 ); st->hTcxDec->kernel_type[0] = st->hTcxDec->kernel_type[1] = MDCT_IV; +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->element_mode == IVAS_CPE_MDCT && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) { +#endif st->hTcxDec->kernel_type[0] = get_next_indice( st0, st->last_core_from_bs != ACELP_CORE ? 2 : 1 ); if ( st->core == TCX_10_CORE ) { st->hTcxDec->kernel_type[1] = 2 * ( st->hTcxDec->kernel_type[0] & 1 ) + get_next_indice( st0, 1 ); } +#ifndef ISSUE_24_CLEANUP_MCT_LFE } + if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) { st->hTcxCfg->tcx_curr_overlap_mode = FULL_OVERLAP; st->hTcxCfg->tcx_last_overlap_mode = FULL_OVERLAP; st->hTcxCfg->last_aldo = 0; } - +#endif if ( st->core == TCX_20_CORE ) { st->transform_type[0] = st->transform_type[1] = TCX_20; @@ -294,11 +298,13 @@ static void dec_prm_tcx_spec( *-----------------------------------------------------------------*/ void ivas_mdct_dec_side_bits_frame_channel( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - int16_t param_lpc[MCT_MAX_CHANNELS][NPRM_LPC_NEW], /* o : lpc_parameters */ - int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to param buffer */ - Decoder_State *st0, /* i : pointer to bitstream handle */ - int16_t *LFE_off, /* o : flag if LFE has content */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + int16_t param_lpc[MCT_MAX_CHANNELS][NPRM_LPC_NEW], /* o : lpc_parameters */ + int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to param buffer */ + Decoder_State *st0, /* i : pointer to bitstream handle */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + int16_t *LFE_off, /* o : flag if LFE has content */ +#endif int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* o : number of bits for TNS */ int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i/o: parameters buffer */ const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ @@ -340,11 +346,14 @@ void ivas_mdct_dec_side_bits_frame_channel( continue; } st = sts[ch]; +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) { *LFE_off = get_next_indice( st0, 1 ); } - else if ( MCT_flag ) + else +#endif + if ( MCT_flag ) { tmp = get_next_indice( st0, 1 ); if ( tmp ) @@ -362,7 +371,11 @@ void ivas_mdct_dec_side_bits_frame_channel( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && *LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) +#else + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) +#endif { sts[ch]->coder_type = INACTIVE; sts[ch]->side_bits_frame_channel = 0; @@ -390,7 +403,11 @@ void ivas_mdct_dec_side_bits_frame_channel( { st = sts[ch]; +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && *LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) +#else + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) +#endif { skipped_first_channel = 1; continue; @@ -404,7 +421,11 @@ void ivas_mdct_dec_side_bits_frame_channel( param_lpc[0][0] = get_next_indice( st0, 1 ) << 1; /* read low br mode flag (if it is possible to be non-zero) */ - if ( sts[0]->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) || sts[1]->mct_chan_mode == MCT_CHAN_MODE_LFE ) ) + if ( sts[0]->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + || sts[1]->mct_chan_mode == MCT_CHAN_MODE_LFE +#endif + ) ) { sns_low_br_mode = get_next_indice( st0, 1 ); } @@ -433,8 +454,10 @@ void ivas_mdct_dec_side_bits_frame_channel( *-----------------------------------------------------------------*/ void ivas_mdct_core_invQ( - CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ - const int16_t LFE_off, /* i : flag if LFE content */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + const int16_t LFE_off, /* i : flag if LFE content */ +#endif int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* i : number of TNS bits */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to param buffer */ int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* i : lpc parameters */ @@ -521,7 +544,11 @@ void ivas_mdct_core_invQ( { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) /* indicates LFE with no content, or odd number of channels */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) +#else + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) +#endif { st->total_brate = st->bits_frame_channel; continue; @@ -575,12 +602,13 @@ void ivas_mdct_core_invQ( /* PLC: [Common: mode decision] * PLC: Decide which Concealment to use. Update pitch lags if needed */ st->core = GetPLCModeDecision( st ); - +#ifndef ISSUE_24_CLEANUP_MCT_LFE /*disable ACELP_PLC for LFE channel */ if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) { st->core = st->last_core; } +#endif } if ( ( !st->bfi || st->hTcxCfg->psychParamsCurrent == NULL ) && st->core > ACELP_CORE ) @@ -670,7 +698,11 @@ void ivas_mdct_core_invQ( { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) /* indicates LFE with no content, or odd number of channels */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) +#else + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) +#endif { set_f( x[ch][0], 0.f, st->hTcxCfg->tcx_coded_lines ); /* usually set in decoder_tcx_invQ(), needed for concealment */ @@ -727,10 +759,12 @@ void ivas_mdct_core_invQ( } } +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) /*indicates LFE with no content*/ { set_f( &x[ch][0][MCT_LFE_MAX_LINE], 0.f, st->hTcxCfg->tcx_coded_lines - MCT_LFE_MAX_LINE ); } +#endif } pop_wmops(); @@ -748,9 +782,11 @@ void ivas_mdct_core_reconstruct( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ float *x[][NB_DIV], /* i/o: synthesis @internal_FS */ float signal_outFB[CPE_CHANNELS][L_FRAME_PLUS], /* o : synthesis @output_FS */ - const int16_t LFE_off, /* i : flag if LFE content */ - int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */ - const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + const int16_t LFE_off, /* i : flag if LFE content */ +#endif + int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ) { int16_t ch, k, bfi; @@ -772,7 +808,9 @@ void ivas_mdct_core_reconstruct( int16_t pitch[CPE_CHANNELS][NB_SUBFR16k]; float pit_gain[CPE_CHANNELS][NB_SUBFR16k]; +#ifndef ISSUE_24_CLEANUP_MCT_LFE int16_t isLFE; +#endif int16_t skip_decoding; set_f( xn_buf, 0, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX ); @@ -787,16 +825,21 @@ void ivas_mdct_core_reconstruct( st = sts[ch]; skip_decoding = 0; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) /* indicates LFE with no content, or odd number of channels */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) +#else + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) +#endif { skip_decoding = 1; } - +#ifndef ISSUE_24_CLEANUP_MCT_LFE isLFE = 0; if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) { isLFE = 1; } +#endif nSubframes[ch] = ( st->core == TCX_20_CORE ) ? 1 : NB_DIV; synth = synth_buf + st->hTcxDec->old_synth_len; @@ -822,7 +865,11 @@ void ivas_mdct_core_reconstruct( decoder_tcx_imdct( st, L_frame_global[ch], L_frame_globalTCX[ch], L_spec[ch], tcx_offset[ch], tcx_offsetFB[ch], L_frame[ch], L_frameTCX[ch], left_rect[ch], &x[ch][k][0], xn_buf, ( ( hCPE->nchan_out == 1 && st->hTcxDec->kernel_type[k] == MDST_IV ) || st->hTcxCfg->tcx_last_overlap_mode == TRANSITION_OVERLAP ) ? MDCT_IV : st->hTcxDec->kernel_type[k], - fUseTns[ch][k], &synth[k * L_frame[ch]], &synthFB[k * L_frameTCX[ch]], bfi, k, isLFE, 0 ); + fUseTns[ch][k], &synth[k * L_frame[ch]], &synthFB[k * L_frameTCX[ch]], bfi, k, +#ifndef ISSUE_24_CLEANUP_MCT_LFE + isLFE, +#endif + 0 ); } else { @@ -968,8 +1015,10 @@ void ivas_mdct_core_reconstruct( *-----------------------------------------------------------------*/ void ivas_mdct_core_tns_ns( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - const int16_t LFE_off, /* i : flag if LFE has content */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + const int16_t LFE_off, /* i : flag if LFE has content */ +#endif int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : two entries for each channel in TCX10 */ STnsData tnsData[CPE_CHANNELS][NB_DIV], /* o : TNS parameter */ float *x[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */ @@ -1006,7 +1055,11 @@ void ivas_mdct_core_tns_ns( L_frameTCX_glob[ch] = st->hTcxDec->L_frameTCX / nSubframes[ch]; L_spec[ch] = st->hTcxCfg->tcx_coded_lines / nSubframes[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) || ( st->bfi && st->core == ACELP_CORE ) ) /* indicates LFE with no content, or odd number of channels */ + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || +#endif + ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) || ( st->bfi && st->core == ACELP_CORE ) ) /* indicates LFE with no content, or odd number of channels */ { if ( st->hTonalMDCTConc != NULL ) { diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index 225a1c85b5..b396fa415c 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -600,7 +600,13 @@ void ivas_ls_setup_conversion_process_mdct( { dmxCoeff = hLsSetUpConversion->dmxMtx[chInIdx][chOutIdx]; - if ( !( chInIdx == LFE_CHANNEL && st_ivas->hMCT->LFE_off ) && mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + !( chInIdx == LFE_CHANNEL && st_ivas->hMCT->LFE_off ) && +#else + chInIdx != LFE_CHANNEL && +#endif + mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE ) { /* Step 1: Compute the target energy and DMX signal (possible since we have all signals in TCX20 resolution) */ if ( dmxCoeff ) @@ -693,7 +699,13 @@ void ivas_ls_setup_conversion_process_mdct( /* Step 4: Perform equalization */ for ( chInIdx = 0; chInIdx < inChannels; chInIdx++ ) { - if ( !( chInIdx == LFE_CHANNEL && st_ivas->hMCT->LFE_off ) && mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + !( chInIdx == LFE_CHANNEL && st_ivas->hMCT->LFE_off ) && +#else + chInIdx != LFE_CHANNEL && +#endif + mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE ) { if ( transform_type[chInIdx][0] == TCX_20 ) { diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index ab95c31b5e..0153fd5465 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -954,10 +954,13 @@ typedef struct mct_dec_data_structure int16_t chBitRatios[MCT_MAX_CHANNELS]; int16_t lowE_ch[MCT_MAX_CHANNELS]; /* note: pointer to local parameter */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE int16_t LFE_off; +#endif uint16_t mc_global_ild[MCT_MAX_CHANNELS]; /* note: pointer to local parameter */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE int16_t num_lfe; - +#endif } MCT_DEC_DATA, *MCT_DEC_HANDLE; @@ -973,9 +976,15 @@ typedef struct ivas_lfe_dec_data_structure int16_t lfe_dec_indices_coeffs_tbl[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; float lfe_block_delay_s; int16_t lfe_prior_buf_len; +#ifndef ISSUE_24_CLEANUP_MCT_LFE float *prior_out_buffer; float *prevsynth_buf; +#else + float prior_out_buffer[L_FRAME48k]; + + float prevsynth_buf[LFE_PLC_BUFLEN]; +#endif float *lfe_delay_buf; int16_t lfe_addl_delay; int16_t bfi_count; diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index 651f6402c6..ab8844c8e8 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -221,7 +221,11 @@ void stereo_mdct_core_dec( if ( !bfi ) { - ivas_mdct_dec_side_bits_frame_channel( hCPE, param_lpc, p_param, hCPE->hCoreCoder[0], NULL, nTnsBitsTCX10, param, 0, 0 ); + ivas_mdct_dec_side_bits_frame_channel( hCPE, param_lpc, p_param, hCPE->hCoreCoder[0], +#ifndef ISSUE_24_CLEANUP_MCT_LFE + NULL, +#endif + nTnsBitsTCX10, param, 0, 0 ); if ( sts[0]->igf ) { @@ -252,7 +256,11 @@ void stereo_mdct_core_dec( } } - ivas_mdct_core_invQ( hCPE, 0, nTnsBitsTCX10, p_param, param_lpc, param, fUseTns, tnsData, x_0, x, Aq, ms_mask, 0 ); + ivas_mdct_core_invQ( hCPE, +#ifndef ISSUE_24_CLEANUP_MCT_LFE + 0, +#endif + nTnsBitsTCX10, p_param, param_lpc, param, fUseTns, tnsData, x_0, x, Aq, ms_mask, 0 ); for ( ch = 0; ch < nChannels; ch++ ) { @@ -345,7 +353,11 @@ void stereo_mdct_core_dec( stereo_decoder_tcx( hCPE->hStereoMdct, ms_mask, x_0[1], x[0], x[1], &hCPE->hStereoMdct->mdct_stereo_mode[0], sts[0]->core, sts[1]->core, sts[0]->igf, L_frameTCX[0], L_frameTCX[1], 0, sts[0]->last_core, sts[1]->last_core, 0 ); } - ivas_mdct_core_tns_ns( hCPE, 0, fUseTns, tnsData, x, Aq, 0 ); + ivas_mdct_core_tns_ns( hCPE, +#ifndef ISSUE_24_CLEANUP_MCT_LFE + 0, +#endif + fUseTns, tnsData, x, Aq, 0 ); if ( st_ivas->renderer_type == RENDERER_MC_PARAMMC && ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) { @@ -359,7 +371,11 @@ void stereo_mdct_core_dec( apply_dmx_weights( hCPE, x, sts[0]->transform_type, sts[1]->transform_type ); } - ivas_mdct_core_reconstruct( hCPE, x, signal_outFB_tmp, 0, fUseTns, 0 ); + ivas_mdct_core_reconstruct( hCPE, x, signal_outFB_tmp, +#ifndef ISSUE_24_CLEANUP_MCT_LFE + 0, +#endif + fUseTns, 0 ); mvr2r( signal_out_tmp[0], signal_out[0], L_FRAME48k ); mvr2r( signal_out_tmp[1], signal_out[1], L_FRAME48k ); diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 2e98d358f8..144f7950e9 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -969,12 +969,13 @@ ivas_error stereo_memory_dec( for ( i = 0; i < CPE_CHANNELS; ++i ) { deleteFdCngDec( &hCPE->hCoreCoder[i]->hFdCngDec ); - +#ifndef ISSUE_24_CLEANUP_MCT_LFE /* deallocate CLDFB synthesis for LFE channel */ if ( hCPE->hCoreCoder[i]->mct_chan_mode == MCT_CHAN_MODE_LFE ) { deleteCldfb( &hCPE->hCoreCoder[i]->cldfbSyn ); } +#endif } } else diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 56059bd29d..b5dcfd2bbe 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -95,11 +95,25 @@ void stereo_tcx_init_dec( st->hTcxCfg->ctx_hm = getCtxHm( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->rf_flag ); st->hTcxCfg->resq = getResq( st->bits_frame_nominal * FRAMES_PER_SEC ); hTcxDec->tcx_lpc_shaped_ari = getTcxLpcShapedAri( st->bits_frame_nominal * FRAMES_PER_SEC, st->rf_flag, st->element_mode ); - st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag, st->mct_chan_mode ); - /* TODO: also apply for MCT modes, once issue #24 is solved */ - if ( !MCT_flag && st->element_mode != EVS_MONO ) + st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); + + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + !MCT_flag && +#endif + st->element_mode != EVS_MONO ) { - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode, st->mct_chan_mode ); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); } if ( hTcxLtpDec != NULL ) { diff --git a/lib_dec/tonalMDCTconcealment.c b/lib_dec/tonalMDCTconcealment.c index cb27b57ebf..81fa9fdf90 100644 --- a/lib_dec/tonalMDCTconcealment.c +++ b/lib_dec/tonalMDCTconcealment.c @@ -386,15 +386,24 @@ static void CalcMDXT( const TonalMDCTConcealPtr hTonalMDCTConc, const char type, const float *timeSignal, - float *mdxtOutput, - const int16_t isLfe ) + float *mdxtOutput +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + const int16_t isLfe +#endif +) { float windowedTimeSignal[L_FRAME_PLUS + 2 * L_MDCT_OVLP_MAX]; int16_t left_overlap, right_overlap; int16_t L_frame; L_frame = hTonalMDCTConc->nSamples; - WindowSignal( hTonalMDCTConc->tcx_cfg, hTonalMDCTConc->tcx_cfg->tcx_offsetFB, FULL_OVERLAP, FULL_OVERLAP, &left_overlap, &right_overlap, timeSignal, &L_frame, windowedTimeSignal, 1, 1, isLfe ); + WindowSignal( hTonalMDCTConc->tcx_cfg, hTonalMDCTConc->tcx_cfg->tcx_offsetFB, FULL_OVERLAP, FULL_OVERLAP, &left_overlap, &right_overlap, timeSignal, &L_frame, windowedTimeSignal, 1, 1 +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + isLfe +#endif + ); if ( type == 'S' ) { @@ -413,8 +422,12 @@ void TonalMDCTConceal_Detect( const TonalMDCTConcealPtr hTonalMDCTConc, const float pitchLag, int16_t *numIndices, - const PsychoacousticParameters *psychParamsCurrent, - const int16_t isLfe ) + const PsychoacousticParameters *psychParamsCurrent +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + const int16_t isLfe +#endif +) { float secondLastMDST[L_FRAME_MAX]; /* 32 bits are required */ float secondLastMDCT[L_FRAME_MAX]; /* 32 bits are required */ @@ -431,10 +444,18 @@ void TonalMDCTConceal_Detect( { if ( !hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) { - CalcMDXT( hTonalMDCTConc, 'S', hTonalMDCTConc->secondLastPcmOut, secondLastMDST, - isLfe ); - CalcMDXT( hTonalMDCTConc, 'C', hTonalMDCTConc->secondLastPcmOut, secondLastMDCT, - isLfe ); + CalcMDXT( hTonalMDCTConc, 'S', hTonalMDCTConc->secondLastPcmOut, secondLastMDST +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + isLfe +#endif + ); + CalcMDXT( hTonalMDCTConc, 'C', hTonalMDCTConc->secondLastPcmOut, secondLastMDCT +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + isLfe +#endif + ); hTonalMDCTConc->nNonZeroSamples = 0; for ( i = 0; i < hTonalMDCTConc->nSamples; i++ ) { diff --git a/lib_enc/bw_detect.c b/lib_enc/bw_detect.c index 8ca63d28f2..810527e0ef 100755 --- a/lib_enc/bw_detect.c +++ b/lib_enc/bw_detect.c @@ -671,6 +671,7 @@ void set_bw_stereo( if ( hCPE->element_mode == IVAS_CPE_MDCT ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE /* do not check bandwidth in LFE channel */ if ( sts[0]->mct_chan_mode == MCT_CHAN_MODE_LFE ) { @@ -691,6 +692,19 @@ void set_bw_stereo( sts[0]->bwidth = max( sts[0]->input_bwidth, sts[1]->input_bwidth ); sts[1]->bwidth = max( sts[0]->input_bwidth, sts[1]->input_bwidth ); } +#else + /* ensure that both CPE channels have the same audio band-width */ + if ( sts[0]->input_bwidth == sts[1]->input_bwidth ) + { + sts[0]->bwidth = sts[0]->input_bwidth; + sts[1]->bwidth = sts[0]->input_bwidth; + } + else + { + sts[0]->bwidth = max( sts[0]->input_bwidth, sts[1]->input_bwidth ); + sts[1]->bwidth = max( sts[0]->input_bwidth, sts[1]->input_bwidth ); + } +#endif } sts[0]->bwidth = max( sts[0]->bwidth, WB ); @@ -723,7 +737,11 @@ int16_t set_bw_mct( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = hCPE[cpe_id]->hCoreCoder[ch]; - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE || st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + st->mct_chan_mode == MCT_CHAN_MODE_LFE || +#endif + st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } diff --git a/lib_enc/cod_tcx.c b/lib_enc/cod_tcx.c index 8c647be38a..ee948998a1 100644 --- a/lib_enc/cod_tcx.c +++ b/lib_enc/cod_tcx.c @@ -73,7 +73,12 @@ void HBAutocorrelation( * Windowing * *-----------------------------------------------------------*/ - WindowSignal( hTcxCfg, hTcxCfg->tcx_offset, left_overlap_mode, right_overlap_mode, &left_overlap, &right_overlap, speech, &L_frame, xn_buf, 1, 0, 0 ); + WindowSignal( hTcxCfg, hTcxCfg->tcx_offset, left_overlap_mode, right_overlap_mode, &left_overlap, &right_overlap, speech, &L_frame, xn_buf, 1, 0 +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + 0 +#endif + ); /*-----------------------------------------------------------* * Autocorrelation * @@ -134,11 +139,15 @@ void TNSAnalysisStereo( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; - +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) +#else + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) +#endif { continue; } + hTcxEnc = st->hTcxEnc; nSubframes = ( hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; @@ -382,8 +391,11 @@ void TNSAnalysisStereo( /* individual decision for each channel */ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) +#else + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) +#endif { continue; } @@ -465,10 +477,15 @@ void TNSAnalysisStereo( /* we have the decision, set filter data accordingly */ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) +#else + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) +#endif { continue; } + nSubframes = ( sts[ch]->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; for ( k = 0; k < nSubframes; k++ ) @@ -501,10 +518,15 @@ void TNSAnalysisStereo( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) +#else + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) +#endif { continue; } + nSubframes = ( st->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; for ( k = 0; k < nSubframes; k++ ) @@ -970,11 +992,12 @@ void EstimateStereoTCXNoiseLevel( { fac_ns_q = param_core[ch] + n * NPRM_DIV + 1; maxNfCalcBw = min( noiseFillingBorder[ch][n], (int16_t) ( hTcxEnc->measuredBwRatio * (float) L_frame[ch][n] + 0.5f ) ); +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) { maxNfCalcBw = min( maxNfCalcBw, MCT_LFE_MAX_LINE ); } - +#endif if ( ( total_brate >= HQ_96k && ( st->element_mode <= IVAS_SCE || st->bwidth < SWB ) ) || total_brate > IVAS_192k ) { fac_ns[ch][n] = 0.0f; @@ -2107,7 +2130,12 @@ void coder_tcx( if ( st->hTcxCfg->tcx_last_overlap_mode == TRANSITION_OVERLAP ) { - WindowSignal( hTcxCfg, hTcxCfg->tcx_offsetFB, hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_frame, win, 1, 1, 0 ); + WindowSignal( hTcxCfg, hTcxCfg->tcx_offsetFB, hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_frame, win, 1, 1 +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + 0 +#endif + ); /* Compute MDCT for xn_buf[] */ TCX_MDCT( win, spectrum, left_overlap, L_frame - ( left_overlap + right_overlap ) / 2, right_overlap, st->element_mode ); @@ -2116,7 +2144,12 @@ void coder_tcx( { wtda( st->hTcxEnc->new_speech_TCX, win, NULL, hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode, L_frame ); - WindowSignal( hTcxCfg, hTcxCfg->tcx_offsetFB, hTcxCfg->tcx_last_overlap_mode == ALDO_WINDOW ? FULL_OVERLAP : hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode == ALDO_WINDOW ? FULL_OVERLAP : hTcxCfg->tcx_curr_overlap_mode, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_frame, winMDST, 1, 1, 0 ); + WindowSignal( hTcxCfg, hTcxCfg->tcx_offsetFB, hTcxCfg->tcx_last_overlap_mode == ALDO_WINDOW ? FULL_OVERLAP : hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode == ALDO_WINDOW ? FULL_OVERLAP : hTcxCfg->tcx_curr_overlap_mode, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_frame, winMDST, 1, 1 +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + 0 +#endif + ); edct( win, spectrum, L_frame, st->element_mode ); diff --git a/lib_enc/core_enc_init.c b/lib_enc/core_enc_init.c index a87bfefb87..f89f4a132c 100644 --- a/lib_enc/core_enc_init.c +++ b/lib_enc/core_enc_init.c @@ -261,7 +261,12 @@ static void init_tcx( hTcxEnc->spectrum[0] = hTcxEnc->spectrum_long; hTcxEnc->spectrum[1] = hTcxEnc->spectrum_long + N_TCX10_MAX; - init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, st->fscale, st->encoderLookahead_enc, st->encoderLookahead_FB, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag, st->mct_chan_mode ); + init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, st->fscale, st->encoderLookahead_enc, st->encoderLookahead_FB, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); /* Init TCX target bits correction factor */ hTcxEnc->tcx_target_bits_fac = 1.0f; diff --git a/lib_enc/core_enc_switch.c b/lib_enc/core_enc_switch.c index 14fcac3894..806afd273b 100644 --- a/lib_enc/core_enc_switch.c +++ b/lib_enc/core_enc_switch.c @@ -95,7 +95,12 @@ void core_coder_mode_switch( st->bits_frame_nominal = (int16_t) ( (float) st->L_frame / (float) st->fscale * (float) FSCALE_DENOM / 128.0f * (float) st->total_brate / 100.0f + 0.49f ); - st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); /* switch IGF configuration */ if ( st->igf ) @@ -112,7 +117,12 @@ void core_coder_mode_switch( hTcxEnc->tcx_lpc_shaped_ari = getTcxLpcShapedAri( st->total_brate, st->rf_mode, st->element_mode ); st->hTcxCfg->tcxRateLoopOpt = ( st->hTcxCfg->resq && !st->tcxonly ) ? 1 : st->hTcxCfg->tcxRateLoopOpt; - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->total_brate, st->igf, st->element_mode, st->mct_chan_mode ); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->total_brate, st->igf, st->element_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); if ( st->hTcxCfg->fIsTNSAllowed ) { @@ -151,7 +161,12 @@ void core_coder_mode_switch( } else { - st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); init_coder_ace_plus( st, last_total_brate, MCT_flag ); } diff --git a/lib_enc/evs_enc.c b/lib_enc/evs_enc.c index b90f10359b..44c34a2bd7 100644 --- a/lib_enc/evs_enc.c +++ b/lib_enc/evs_enc.c @@ -686,7 +686,12 @@ static void configure_core_coder( } } - st->igf = getIgfPresent( 0, st->total_brate, st->bwidth, st->rf_mode, st->mct_chan_mode ); + st->igf = getIgfPresent( 0, st->total_brate, st->bwidth, st->rf_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); if ( st->core_brate != SID_2k40 && st->core_brate != FRAME_NO_DATA ) { diff --git a/lib_enc/ext_sig_ana.c b/lib_enc/ext_sig_ana.c index 9e1ad869ab..0588f0ddf1 100644 --- a/lib_enc/ext_sig_ana.c +++ b/lib_enc/ext_sig_ana.c @@ -215,8 +215,10 @@ void core_signal_analysis_high_bitrate( if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) { +#endif wtda( hTcxEnc->new_speech_TCX, tcx20Win, NULL, overlap_mode[frameno], overlap_mode[frameno + 1], L_frameTCX ); if ( windowed_samples != NULL ) /* store overlap data for later */ @@ -225,6 +227,7 @@ void core_signal_analysis_high_bitrate( windowed_samples[0] = (float) overlap_mode[frameno]; windowed_samples[1] = (float) overlap_mode[frameno + 1]; } +#ifndef ISSUE_24_CLEANUP_MCT_LFE } else { @@ -233,17 +236,27 @@ void core_signal_analysis_high_bitrate( st->element_mode != IVAS_CPE_MDCT /* truncate_aldo */, 1, 1 ); } - +#endif if ( st->element_mode != IVAS_CPE_MDCT ) { /* Windowing of the 2xTCX5 subframes or 1xTCX10 or 1xTCX20 */ - WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno], overlap_mode[frameno + 1] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, mdstWin, 1, 1, 0 ); + WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno], overlap_mode[frameno + 1] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, mdstWin, 1, 1 +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + 0 +#endif + ); } } else { /* Windowing of the 2xTCX5 subframes or 1xTCX10 or 1xTCX20 */ - WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno], overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, tcx20Win, st->element_mode != IVAS_CPE_MDCT, 1, 0 ); + WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno], overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, tcx20Win, st->element_mode != IVAS_CPE_MDCT, 1 +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + 0 +#endif + ); if ( windowed_samples != NULL ) /* save windowed speech_TCX samples */ { @@ -282,8 +295,15 @@ void core_signal_analysis_high_bitrate( for ( i = 0; i < 2; i++ ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE assert( st->mct_chan_mode != MCT_CHAN_MODE_LFE ); - WindowSignal( st->hTcxCfg, folding_offset, i == 0 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, i == 1 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, &left_overlap, &right_overlap, tcx20Win + i * tcx5SizeFB, &L_subframe, tcx5Win, st->element_mode != IVAS_CPE_MDCT, 1, 0 ); +#endif + WindowSignal( st->hTcxCfg, folding_offset, i == 0 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, i == 1 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, &left_overlap, &right_overlap, tcx20Win + i * tcx5SizeFB, &L_subframe, tcx5Win, st->element_mode != IVAS_CPE_MDCT, 1 +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + 0 +#endif + ); TCX_MDCT( tcx5Win, hTcxEnc->spectrum[frameno] + i * tcx5SizeFB, left_overlap, L_subframe - ( left_overlap + right_overlap ) / 2, right_overlap, st->element_mode ); @@ -298,7 +318,11 @@ void core_signal_analysis_high_bitrate( { assert( transform_type[frameno] == TCX_10 || transform_type[frameno] == TCX_20 ); - if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && st->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { edct( tcx20Win, hTcxEnc->spectrum[frameno], L_subframe, st->element_mode ); @@ -323,12 +347,13 @@ void core_signal_analysis_high_bitrate( { v_multc( hTcxEnc->spectrum[frameno] + L_FRAME16k / nSubframes, (float) ( st->bwidth_sw_cnt ) / (float) BWS_TRAN_PERIOD, hTcxEnc->spectrum[frameno] + L_FRAME16k / nSubframes, L_subframe - L_FRAME16k / nSubframes ); } - +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) { set_f( &hTcxEnc->spectrum[frameno][MCT_LFE_MAX_LINE], 0.f, L_subframe - MCT_LFE_MAX_LINE ); st->hTcxCfg->tcx_coded_lines = MCT_LFE_MAX_LINE; } +#endif if ( st->element_mode != IVAS_CPE_MDCT ) { @@ -345,14 +370,23 @@ void core_signal_analysis_high_bitrate( { L_subframe = L_frameTCX / nSubframes; - if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && st->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { wtda_ext( hTcxEnc->new_speech_TCX, mdstWin, overlap_mode[frameno], overlap_mode[frameno + 1], L_frameTCX, 3 ); } else { /* Windowing for the MDST */ - WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno], overlap_mode[frameno + 1] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, mdstWin, 0, 1, st->mct_chan_mode == MCT_CHAN_MODE_LFE ); + WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno], overlap_mode[frameno + 1] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, mdstWin, 0, 1 +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode == MCT_CHAN_MODE_LFE +#endif + ); } if ( transform_type[frameno] == TCX_5 ) @@ -383,8 +417,15 @@ void core_signal_analysis_high_bitrate( for ( i = 0; i < 2; i++ ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE assert( st->mct_chan_mode != MCT_CHAN_MODE_LFE ); - WindowSignal( st->hTcxCfg, folding_offset, i == 0 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, i == 1 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, &left_overlap, &right_overlap, mdstWin + i * tcx5SizeFB, &L_subframe, tcx5Win, 0, 1, 0 ); +#endif + WindowSignal( st->hTcxCfg, folding_offset, i == 0 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, i == 1 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, &left_overlap, &right_overlap, mdstWin + i * tcx5SizeFB, &L_subframe, tcx5Win, 0, 1 +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + 0 +#endif + ); TCX_MDST( tcx5Win, mdst_spectrum[frameno] + i * tcx5SizeFB, left_overlap, L_subframe - ( left_overlap + right_overlap ) / 2, right_overlap, st->element_mode ); /* high-band gain control in case of BWS */ @@ -396,7 +437,11 @@ void core_signal_analysis_high_bitrate( } else /* transform_type[frameno] != TCX_5 */ { - if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && st->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { edst( mdstWin, mdst_spectrum[frameno], L_subframe, st->element_mode ); @@ -421,11 +466,12 @@ void core_signal_analysis_high_bitrate( v_multc( mdst_spectrum[frameno] + L_FRAME16k / nSubframes, (float) ( st->bwidth_sw_cnt ) / (float) BWS_TRAN_PERIOD, mdst_spectrum[frameno] + L_FRAME16k / nSubframes, L_subframe - L_FRAME16k / nSubframes ); } } - +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) { set_f( &mdst_spectrum[frameno][MCT_LFE_MAX_LINE], 0.f, L_subframe - MCT_LFE_MAX_LINE ); } +#endif } if ( st->element_mode != IVAS_CPE_MDCT ) diff --git a/lib_enc/hq_core_enc.c b/lib_enc/hq_core_enc.c index 4bc332fd5e..43b5ebd68c 100644 --- a/lib_enc/hq_core_enc.c +++ b/lib_enc/hq_core_enc.c @@ -116,7 +116,12 @@ void hq_core_enc( left_overlap = -1; right_overlap = -1; - WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, TRANSITION_OVERLAP, FULL_OVERLAP, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_spec, wtda_audio, 1, 1, 0 ); + WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, TRANSITION_OVERLAP, FULL_OVERLAP, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_spec, wtda_audio, 1, 1 +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + 0 +#endif + ); TCX_MDCT( wtda_audio, t_audio, left_overlap, L_spec - ( left_overlap + right_overlap ) / 2, right_overlap, st->element_mode ); diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 16b1cf0c29..d73434c15f 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -731,7 +731,11 @@ ivas_error init_encoder( * IGF *-----------------------------------------------------------------*/ - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && st->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { if ( ( st->hIGFEnc = (IGF_ENC_INSTANCE_HANDLE) malloc( sizeof( IGF_ENC_INSTANCE ) ) ) == NULL ) { @@ -751,7 +755,12 @@ ivas_error init_encoder( if ( st->codec_mode == MODE2 || st->element_mode > EVS_MONO ) { - st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); } else { @@ -805,9 +814,10 @@ ivas_error init_encoder( /*-----------------------------------------------------------------* * Transient detector *-----------------------------------------------------------------*/ - +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) { +#endif if ( ( st->hTranDet = (TRAN_DET_HANDLE) malloc( sizeof( TRAN_DET_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Transient Detection\n" ) ); @@ -821,11 +831,13 @@ ivas_error init_encoder( { InitTransientDetection( (int16_t) ( st->input_Fs / FRAMES_PER_SEC ), NS2SA( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet, 0 ); } +#ifndef ISSUE_24_CLEANUP_MCT_LFE } else { st->hTranDet = NULL; } +#endif /*-----------------------------------------------------------------* * IVAS parameters diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 002e499f4b..0c85ca186d 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -259,7 +259,15 @@ ivas_error ivas_core_enc( if ( MCT_flag ) { ivas_mdct_core_whitening_enc( hCPE, old_inp_16k, old_wsp, pitch_buf, hMCT->p_mdst_spectrum_long[cpe_id], hMCT->tnsBits[cpe_id], hMCT->p_orig_spectrum_long[cpe_id], - hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, &hMCT->LFE_off, 1, hMCT->nchan_out_woLFE + hMCT->num_lfe ); + hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, +#ifndef ISSUE_24_CLEANUP_MCT_LFE + &hMCT->LFE_off, +#endif + 1, hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ); } else { diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index e9d6968f1b..213e48071c 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -377,8 +377,12 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hCoreCoder[n]->igf = getIgfPresent( st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, st_ivas->hCPE[0]->hCoreCoder[n]->bits_frame_nominal * FRAMES_PER_SEC, st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, - st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode, - st_ivas->hCPE[0]->hCoreCoder[n]->mct_chan_mode ); + st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st_ivas->hCPE[0]->hCoreCoder[n]->mct_chan_mode +#endif + ); if ( st_ivas->hCPE[0]->hCoreCoder[n]->igf ) { @@ -445,8 +449,12 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hCoreCoder[n]->igf = getIgfPresent( st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, st_ivas->hCPE[0]->hCoreCoder[n]->bits_frame_nominal * FRAMES_PER_SEC, st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, - st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode, - st_ivas->hCPE[0]->hCoreCoder[n]->mct_chan_mode ); + st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st_ivas->hCPE[0]->hCoreCoder[n]->mct_chan_mode +#endif + ); if ( st_ivas->hCPE[0]->hCoreCoder[n]->igf ) { diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index f9b787ac56..184a867cd1 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -154,7 +154,14 @@ ivas_error ivas_cpe_enc( } mvr2r( data_f_ch0, sts[0]->input, input_frame ); +#ifdef ISSUE_24_CLEANUP_MCT_LFE + if ( data_f_ch1 != NULL ) /*this may happen for cases with odd number of channels*/ + { + mvr2r( data_f_ch1, sts[1]->input, input_frame ); + } +#else mvr2r( data_f_ch1, sts[1]->input, input_frame ); +#endif /*----------------------------------------------------------------* * Stereo technology selection @@ -296,12 +303,27 @@ ivas_error ivas_cpe_enc( { if ( st_ivas->hMCT ) { +#ifdef ISSUE_24_CLEANUP_MCT_LFE + int16_t lfe_bits; + lfe_bits = ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ? st_ivas->hLFE->lfe_bits : 0 ); +#endif sts[n]->total_brate = hCPE->element_brate; +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( sts[n]->mct_chan_mode != MCT_CHAN_MODE_LFE ) { +#endif sts[n]->bits_frame_nominal = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC ); - sts[n]->bits_frame_channel = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC - ( st_ivas->hMCT->num_lfe == FALSE ? 0 : LFE_BITS ) - nb_bits_metadata ) / st_ivas->hMCT->nchan_out_woLFE ); + sts[n]->bits_frame_channel = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC - +#ifndef ISSUE_24_CLEANUP_MCT_LFE + ( st_ivas->hMCT->num_lfe == FALSE ? 0 : LFE_BITS ) - +#else + lfe_bits - +#endif + nb_bits_metadata ) / + st_ivas->hMCT->nchan_out_woLFE ); +#ifndef ISSUE_24_CLEANUP_MCT_LFE } +#endif } else { @@ -660,10 +682,14 @@ ivas_error ivas_cpe_enc( /* Store previous attack detection flag */ for ( n = 0; n < CPE_CHANNELS; n++ ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( sts[n]->mct_chan_mode != MCT_CHAN_MODE_LFE ) { +#endif sts[n]->hTranDet->transientDetector.prev_bIsAttackPresent = sts[n]->hTranDet->transientDetector.bIsAttackPresent; +#ifndef ISSUE_24_CLEANUP_MCT_LFE } +#endif } #ifdef DEBUG_MODE_INFO @@ -827,11 +853,12 @@ ivas_error create_cpe_enc( copy_encoder_config( st_ivas, st, 1 ); st->total_brate = hCPE->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT && ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) { st->mct_chan_mode = MCT_CHAN_MODE_LFE; } - +#endif if ( ( error = init_encoder( st, n, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 5cbcb57daf..c2c2e284c2 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -51,7 +51,9 @@ *----------------------------------------------------------*/ static void FindChannelRatio( - MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ +#endif Encoder_State **sts, /* i/o: encoder state structure */ int16_t chBitRatios[MCT_MAX_CHANNELS], /* o : bit-disctribution channel ratios */ const int16_t nChannels /* i : number of channels to be coded */ @@ -69,7 +71,11 @@ static void FindChannelRatio( sum_nrg = 0; for ( i = 0; i < nChannels; i++ ) { - if ( sts[i]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[i]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( sts[i]->mct_chan_mode != MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && sts[i]->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { sum_nrg += nrg[i]; } @@ -78,7 +84,11 @@ static void FindChannelRatio( for ( i = 0; i < nChannels; i++ ) { - if ( sts[i]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[i]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( sts[i]->mct_chan_mode != MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && sts[i]->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { chRatio = nrg[i] * sum_nrg; chBitRatios[i] = min( BITRATE_MCT_RATIO_RANGE - 1, max( 1, (uint16_t) ( BITRATE_MCT_RATIO_RANGE * chRatio + 0.5f ) ) ); @@ -87,15 +97,17 @@ static void FindChannelRatio( { chBitRatios[i] = 0; } +#ifndef ISSUE_24_CLEANUP_MCT_LFE else if ( hMCT->num_lfe ) { assert( sts[i]->mct_chan_mode == MCT_CHAN_MODE_LFE ); chBitRatios[i] = !hMCT->LFE_off; } +#endif } #ifdef DEBUG_MODE_MDCT - for ( i = 0; i < nchan; i++ ) + for ( i = 0; i < nChannels; i++ ) { dbgwrite( &chBitRatios[i], sizeof( int16_t ), 1, 1, "./res/chBitRatio" ); /* dbgwrite(&chRatio[i], sizeof(float),1,1,"./res/chRatio");*/ @@ -237,6 +249,8 @@ void ivas_mct_core_enc( total_side_bits = 0; nCPE = nChannels / CPE_CHANNELS; + + /*in case of odd number of channels*/ if ( ( nCPE * CPE_CHANNELS ) != nChannels ) { nCPE++; @@ -255,7 +269,11 @@ void ivas_mct_core_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { sts[i] = hCPE[cpe_id]->hCoreCoder[ch]; - if ( hCPE[cpe_id]->hCoreCoder[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE || hCPE[cpe_id]->hCoreCoder[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( hCPE[cpe_id]->hCoreCoder[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + || hCPE[cpe_id]->hCoreCoder[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE +#endif + ) { i++; continue; @@ -304,7 +322,11 @@ void ivas_mct_core_enc( { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && hMCT->LFE_off ) || st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && hMCT->LFE_off ) || +#endif + st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -332,7 +354,11 @@ void ivas_mct_core_enc( for ( ch = 0; ch < nChannels; ch++ ) { - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || +#endif + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -379,7 +405,11 @@ void ivas_mct_core_enc( for ( ch = 0; ch < nChannels; ch++ ) { st = sts[ch]; - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || +#endif + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -411,7 +441,11 @@ void ivas_mct_core_enc( for ( ch = 0; ch < nChannels; ch++ ) { st = sts[ch]; - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || +#endif + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -432,7 +466,11 @@ void ivas_mct_core_enc( for ( ch = 0; ch < nChannels; ch++ ) { st = sts[ch]; - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || +#endif + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -445,7 +483,11 @@ void ivas_mct_core_enc( { st = sts[ch]; - if ( ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) && hMCT->LFE_off ) || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) && hMCT->LFE_off ) || +#endif + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -460,7 +502,11 @@ void ivas_mct_core_enc( write_mct_bitstream( sts, hMCT, nChannels ); - FindChannelRatio( hMCT, sts, chBitRatios, nChannels ); + FindChannelRatio( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + hMCT, +#endif + sts, chBitRatios, nChannels ); nAvailBits = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - NBITS_BWIDTH - hMCT->nBitsMCT - lfe_bits ); @@ -488,13 +534,21 @@ void ivas_mct_core_enc( /*substract bits needed for the bitrate ratios */ for ( ch = 0; ch < nChannels; ch++ ) { - if ( ( ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) && hMCT->LFE_off ) || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + ( ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) && hMCT->LFE_off ) || +#endif + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } nAvailBits -= NBBITS_MCT_RATIO; } - nAvailBits -= total_side_bits + ( hMCT->num_lfe ? 1 : 0 ) + hMCT->nchan_out_woLFE; /* if MC 1 extra bit that was initially send to signal LFE_off */ + nAvailBits -= total_side_bits +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + ( hMCT->num_lfe ? 1 : 0 ) +#endif + + hMCT->nchan_out_woLFE; /* if MC 1 extra bit that was initially send to signal LFE_off */ #ifdef DEBUG_MODE_MDCT dbgwrite( &nAvailBits, sizeof( int16_t ), 1, 1, "./res/availBits" ); @@ -508,7 +562,11 @@ void ivas_mct_core_enc( for ( ch = 0; ch < nChannels; ch++ ) { - if ( ( ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) && hMCT->LFE_off ) || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + ( ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) && hMCT->LFE_off ) || +#endif + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -531,15 +589,18 @@ void ivas_mct_core_enc( { continue; } - +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( !( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) && hMCT->LFE_off ) ) /* indicates LFE with no content */ { +#endif st->total_brate = ( st->bits_frame_channel + st->side_bits_frame_channel ) * FRAMES_PER_SEC; #ifdef DEBUGGING total_brate += st->total_brate; #endif +#ifndef ISSUE_24_CLEANUP_MCT_LFE } +#endif } #ifdef DEBUGGING if ( hCPE[cpe_id]->hMetaData != NULL ) @@ -551,7 +612,11 @@ void ivas_mct_core_enc( #ifdef DEBUGGING format_bits = ( ivas_format == MC_FORMAT ? IVAS_FORMAT_SIGNALING_NBITS + MC_LS_SETUP_BITS : IVAS_FORMAT_SIGNALING_NBITS_SBA + SBA_ORDER_BITS + SBA_PLANAR_BITS ); - mct_bits += hMCT->nBitsMCT + ( hMCT->num_lfe ? 1 : 0 ) + hMCT->nchan_out_woLFE; + mct_bits += hMCT->nBitsMCT +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + ( hMCT->num_lfe ? 1 : 0 ) +#endif + + hMCT->nchan_out_woLFE; assert( ( total_brate + ( NBITS_BWIDTH + format_bits + mct_bits + sba_meta + lfe_bits ) * FRAMES_PER_SEC ) == ivas_total_brate ); #endif diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index b66a2c5733..75191d0a41 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -90,7 +90,61 @@ static void set_mct_enc_params( return; } +/*-------------------------------------------------------------------* + * map_input_to_cpe_channels() + * + * for MC_MODE map input channels to cpe channels + * mid channel (ch==2) is mapped to last odd-channel CPE + * all channels after LFE are mapped to cpe_id=1 and onwards + * E.g. for 5_1 and for 3 CPEs: + * cpe_id 0: L=data[0] R=data[1] + * cpe_id 1: L=data[4] R=data[5] + * cpe_id 2: L=data[2] (mid) R=NULL + *-------------------------------------------------------------------*/ +#ifdef ISSUE_24_CLEANUP_MCT_LFE +static void map_input_to_cpe_channels( + const Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + float *pdata[MAX_INPUT_CHANNELS], /* o: mapped input pointers */ + float data[MCT_MAX_CHANNELS][L_FRAME48k] /* i: input channel data */ +) +{ + int16_t i, n; + + i = 0; + for ( n = 0; n < LFE_CHANNEL - 1; n++ ) + { + pdata[i] = data[n]; + i++; + } + + if ( st_ivas->hEncoderConfig->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) + { + for ( n = LFE_CHANNEL + 1; n < st_ivas->nchan_transport; n++ ) + { + pdata[i] = data[n]; + i++; + } + pdata[i] = data[LFE_CHANNEL - 1]; + } + else + { + for ( ; n < st_ivas->nchan_transport; n++ ) + { + pdata[i] = data[n]; + i++; + } + } + + /* odd channel CPE*/ + if ( ( st_ivas->nchan_transport < st_ivas->nCPE * CPE_CHANNELS ) || ( st_ivas->mc_mode == MC_MODE_MCT && st_ivas->hMCT->nchan_out_woLFE < st_ivas->nCPE * CPE_CHANNELS ) ) + { + pdata[st_ivas->nCPE * CPE_CHANNELS - 1] = NULL; + } + + return; +} +#endif /*-------------------------------------------------------------------* * ivas_mct_enc() * @@ -114,6 +168,9 @@ ivas_error ivas_mct_enc( int16_t max_bwidth; int32_t ivas_total_brate; ivas_error error; +#ifdef ISSUE_24_CLEANUP_MCT_LFE + float *pdata[MAX_INPUT_CHANNELS]; +#endif error = IVAS_ERR_OK; @@ -143,11 +200,22 @@ ivas_error ivas_mct_enc( hMCT->p_orig_spectrum_long[cpe_id][n] = orig_spectrum_long[cpe_id][n]; hCPE->hCoreCoder[n]->input_bwidth = hCPE->hCoreCoder[n]->last_input_bwidth; /* updated in BWD */ hCPE->hCoreCoder[n]->bwidth = hCPE->hCoreCoder[n]->last_bwidth; /* updated in BWD */ +#ifdef ISSUE_24_CLEANUP_MCT_LFE + /* reset channel mode from previous state*/ + if ( ( hCPE->cpe_id * CPE_CHANNELS + n ) >= hMCT->nchan_out_woLFE ) + { + hCPE->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; + } + else + { + hCPE->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; + } +#endif } } - +#ifndef ISSUE_24_CLEANUP_MCT_LFE hMCT->LFE_off = 1; /* disable LFE coding by default for the moment */ - +#endif /* reconfiguration in case of bitrate switching */ if ( ivas_total_brate != st_ivas->hEncoderConfig->last_ivas_total_brate ) { @@ -163,24 +231,45 @@ ivas_error ivas_mct_enc( /* set coded audio band-width */ switch_bw = set_bw_mct( st_ivas->hCPE, st_ivas->nCPE ); +#ifdef ISSUE_24_CLEANUP_MCT_LFE + /*for MC and MCT remove pointer to LFE input that has been processed seperately */ + map_input_to_cpe_channels( st_ivas, pdata, data ); +#endif /* pre-processing */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { +#ifdef ISSUE_24_CLEANUP_MCT_LFE + if ( ( error = ivas_cpe_enc( st_ivas, cpe_id, pdata[cpe_id * CPE_CHANNELS], pdata[cpe_id * CPE_CHANNELS + 1], input_frame, nb_bits_metadata ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_cpe_enc( st_ivas, cpe_id, data[cpe_id * CPE_CHANNELS], data[cpe_id * CPE_CHANNELS + 1], input_frame, nb_bits_metadata ) ) != IVAS_ERR_OK ) +#endif { return error; } } /* joint MCT encoding */ - ivas_mct_core_enc( ivas_format, hMCT, st_ivas->hCPE, hMCT->nchan_out_woLFE + hMCT->num_lfe, ivas_total_brate, switch_bw, ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) ? (int16_t) st_ivas->hLFE->lfe_bits : 0, st_ivas->hEncoderConfig->sba_order ); + ivas_mct_core_enc( ivas_format, hMCT, st_ivas->hCPE, +#ifndef ISSUE_24_CLEANUP_MCT_LFE + hMCT->nchan_out_woLFE + hMCT->num_lfe +#else + hMCT->nchan_out_woLFE +#endif + , + ivas_total_brate, switch_bw, + ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) ? (int16_t) st_ivas->hLFE->lfe_bits : 0, + st_ivas->hEncoderConfig->sba_order ); /* Spectrum quantization and coding */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { hCPE = st_ivas->hCPE[cpe_id]; - ivas_mdct_quant_coder( hCPE, hMCT->LFE_off, hMCT->tnsBits[cpe_id], hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], 1 ); + ivas_mdct_quant_coder( hCPE, +#ifndef ISSUE_24_CLEANUP_MCT_LFE + hMCT->LFE_off, +#endif + hMCT->tnsBits[cpe_id], hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], 1 ); /* update input samples buffer (as done in ivas_cpe_enc() for other than MCT coding) */ for ( n = 0; n < CPE_CHANNELS; n++ ) @@ -235,23 +324,30 @@ ivas_error create_mct_enc( if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) { hMCT->nchan_out_woLFE = st_ivas->hEncoderConfig->nchan_inp - 1; /* LFE channel is coded separately */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE hMCT->num_lfe = TRUE; +#endif } else if ( ivas_format == SBA_FORMAT ) { hMCT->nchan_out_woLFE = ivas_get_sba_num_TCs( ivas_total_brate, st_ivas->sba_analysis_order ); - +#ifndef ISSUE_24_CLEANUP_MCT_LFE hMCT->num_lfe = FALSE; +#endif } else if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) { hMCT->nchan_out_woLFE = ivas_param_mc_getNumTransportChannels( ivas_total_brate, st_ivas->hEncoderConfig->mc_input_setup ); +#ifndef ISSUE_24_CLEANUP_MCT_LFE hMCT->num_lfe = FALSE; +#endif } else if ( ivas_format == SBA_FORMAT ) { hMCT->nchan_out_woLFE = ivas_sba_get_nchan( st_ivas->sba_analysis_order, st_ivas->hEncoderConfig->sba_planar ); +#ifndef ISSUE_24_CLEANUP_MCT_LFE hMCT->num_lfe = FALSE; +#endif } else { @@ -260,21 +356,27 @@ ivas_error create_mct_enc( cp_bitrate = ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS; - /* indicate LFE for appropriate core-coder channel */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { for ( n = 0; n < CPE_CHANNELS; n++ ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( ( hMCT->num_lfe > 0 ) && ( ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_LFE; } +#endif } } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE + hMCT->num_lfe ) % 2 ) + if ( ( hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ) % + 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } @@ -360,17 +462,23 @@ ivas_error mct_enc_reconfigure( if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) { hMCT->nchan_out_woLFE = st_ivas->hEncoderConfig->nchan_inp - 1; /* LFE channel is coded separately */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE hMCT->num_lfe = TRUE; +#endif } else if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) { hMCT->nchan_out_woLFE = ivas_param_mc_getNumTransportChannels( ivas_total_brate, st_ivas->hEncoderConfig->mc_input_setup ); +#ifndef ISSUE_24_CLEANUP_MCT_LFE hMCT->num_lfe = FALSE; +#endif } else if ( ivas_format == SBA_FORMAT ) { hMCT->nchan_out_woLFE = st_ivas->nchan_transport; +#ifndef ISSUE_24_CLEANUP_MCT_LFE hMCT->num_lfe = FALSE; +#endif } else { @@ -380,22 +488,28 @@ ivas_error mct_enc_reconfigure( cp_bitrate = ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS; - /* indicate LFE for appropriate core-coder channel */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { st_ivas->hCPE[cpe_id]->element_brate = cp_bitrate; for ( n = 0; n < CPE_CHANNELS; n++ ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( ( hMCT->num_lfe > 0 ) && ( ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_LFE; } +#endif } } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE + hMCT->num_lfe ) % 2 ) + if ( ( hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ) % + 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } @@ -412,10 +526,19 @@ ivas_error mct_enc_reconfigure( st->total_brate = st_ivas->hCPE[cpe_id]->element_brate; - if ( !( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) ) + if ( !( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) || +#endif + ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) ) { st->bits_frame_nominal = (int16_t) ( st_ivas->hCPE[cpe_id]->element_brate / FRAMES_PER_SEC ); - st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); if ( st->igf ) { IGFEncSetMode( st->hIGFEnc, st_ivas->hCPE[cpe_id]->element_brate, st->bwidth, st->element_mode, st->rf_mode ); @@ -763,10 +886,16 @@ static ivas_error ivas_mc_enc_reconfig( } } - st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); /* set last core to TCX20 */ st->last_core = TCX_20_CORE; } +#ifndef ISSUE_24_CLEANUP_MCT_LFE else if ( last_mc_mode == MC_MODE_PARAMMC && st_ivas->mc_mode == MC_MODE_MCT && nchan_transport_old > 2 ) { #ifdef DEBUGGING @@ -774,7 +903,7 @@ static ivas_error ivas_mc_enc_reconfig( #endif st_ivas->hCPE[1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_LFE; } - +#endif if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { ivas_mcmasa_split_brate( st_ivas->hMcMasa->separateChannelEnabled, st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &new_brate_SCE, &new_brate_CPE ); diff --git a/lib_enc/ivas_mct_enc_mct.c b/lib_enc/ivas_mct_enc_mct.c index ee0c529b8b..9c0e43caa0 100644 --- a/lib_enc/ivas_mct_enc_mct.c +++ b/lib_enc/ivas_mct_enc_mct.c @@ -62,7 +62,11 @@ void getChannelEnergies( for ( ch = 0; ch < nchan; ch++ ) { st = sts[ch]; - if ( st->mct_chan_mode != MCT_CHAN_MODE_IGNORE && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( st->mct_chan_mode != MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && st->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { nSubframes = ( st->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; L_subframe = st->hTcxEnc->L_frameTCX / nSubframes; @@ -156,7 +160,11 @@ static void getCorrelationMatrix( int16_t ch1, ch2, n, nchan; float tmp; - nchan = hMCT->nchan_out_woLFE + hMCT->num_lfe; + nchan = hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ; /* correlation */ for ( ch1 = 0; ch1 < nchan; ch1++ ) @@ -166,8 +174,12 @@ static void getCorrelationMatrix( xCorrMatrix[ch1][ch2] = 0; if ( sts[ch1]->core == sts[ch2]->core && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_LFE && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_LFE && + sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { int16_t nSubframes = ( sts[ch1]->core == TCX_20_CORE ? 1 : NB_DIV ); int16_t L_subframe = sts[ch1]->hTcxEnc->L_frameTCX / nSubframes; @@ -225,9 +237,19 @@ static void getBestCorrelation( *_ch2 = -1; *max_corr = 0.f; - for ( ch1 = 0; ch1 < ( hMCT->nchan_out_woLFE + hMCT->num_lfe ); ch1++ ) + for ( ch1 = 0; ch1 < ( hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ); + ch1++ ) { - for ( ch2 = ch1 + 1; ch2 < ( hMCT->nchan_out_woLFE + hMCT->num_lfe ); ch2++ ) + for ( ch2 = ch1 + 1; ch2 < ( hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ); + ch2++ ) { if ( fabsf( *max_corr ) < fabsf( xCorrMatrix[ch1][ch2] ) ) { @@ -308,13 +330,27 @@ static void updateCorrelationMatrix( int16_t ch1, ch2, n; /* correlation: */ - for ( ch1 = 0; ch1 < ( hMCT->nchan_out_woLFE + hMCT->num_lfe ); ch1++ ) + for ( ch1 = 0; ch1 < ( hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ); + ch1++ ) { - for ( ch2 = ch1; ch2 < ( hMCT->nchan_out_woLFE + hMCT->num_lfe ); ch2++ ) + for ( ch2 = ch1; ch2 < ( hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ); + ch2++ ) { if ( sts[ch1]->core == sts[ch2]->core && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_LFE && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_LFE && + sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { int16_t nSubframes = ( sts[ch1]->core == TCX_20_CORE ? 1 : NB_DIV ); @@ -341,8 +377,11 @@ static void updateCorrelationMatrix( static int16_t channelPairToIndex( const int16_t chIdx1, const int16_t chIdx2, - const int16_t nChannels, + const int16_t nChannels +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , Encoder_State **sts /* i/o: encoder state structure */ +#endif ) { int16_t ch1, ch2; @@ -354,11 +393,12 @@ static int16_t channelPairToIndex( { for ( ch1 = 0; ch1 < ch2; ch1++ ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( sts[ch1]->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch2]->mct_chan_mode == MCT_CHAN_MODE_LFE ) { continue; } - +#endif if ( ch1 == chIdx1 && ch2 == chIdx2 ) { return pairIdx; @@ -398,7 +438,11 @@ static void getGlobalILD( /*calculate total energy without LFE*/ for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { meanE += nrg[ch]; cnt++; @@ -410,7 +454,11 @@ static void getGlobalILD( meanE = max( meanE / cnt, EPSILON ); for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { nSubframes = ( sts[ch]->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; L_subframe = sts[ch]->hTcxEnc->L_frameTCX / nSubframes; @@ -483,11 +531,19 @@ void apply_MCT_enc( /*Determine active channels*/ for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { count_active_ch++; } +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) +#else + else +#endif { hMCT->mc_global_ild[ch] = 0; } @@ -508,8 +564,16 @@ void apply_MCT_enc( { for ( ch1 = 0; ch1 < ch2; ch1++ ) { - if ( sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_LFE && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + && + sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { sumCorrDiff += fabsf( hMCT->lastxCorrMatrix[ch1][ch2] - xCorrMatrix[ch1][ch2] ); } @@ -600,8 +664,12 @@ void apply_MCT_enc( } /* calculate all related values: */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE assert( sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_LFE && sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_LFE ); +#else + assert( sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ); +#endif getBlockValues( sts, ch1, ch2, hMCT->hBlockData[currBlockDataCnt], mdst_spectrum, inv_spectrum, inv_mdst_spectrum ); @@ -686,7 +754,11 @@ void apply_MCT_enc( for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE +#endif + ) { if ( ( !cpEle[ch] ) || hMCT->currBlockDataCnt == 0 ) { @@ -771,7 +843,11 @@ void write_mct_bitstream( /* first write core info and overlap mode for all channels */ for ( ch = 0; ch < nchan; ch++ ) { - if ( ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) && hMCT->currBlockDataCnt && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) && +#endif + hMCT->currBlockDataCnt && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { push_next_indice( hBstr, hMCT->mc_global_ild[ch], SMDCT_GLOBAL_ILD_BITS ); } @@ -781,7 +857,11 @@ void write_mct_bitstream( { for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE && +#endif + sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { push_next_indice( hBstr, hMCT->lowE_ch[ch], 1 ); } @@ -794,7 +874,12 @@ void write_mct_bitstream( hBlock = hMCT->hBlockData[pair]; /*calculate channel pair index and write it to BS*/ - channelPairIndex = channelPairToIndex( hBlock->ch1, hBlock->ch2, nchan, sts ); + channelPairIndex = channelPairToIndex( hBlock->ch1, hBlock->ch2, nchan +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + sts +#endif + ); push_next_indice( hBstr, channelPairIndex, hMCT->bitsChannelPairIndex ); /*point to encoder states of actual channels to write block pair bits*/ @@ -838,7 +923,11 @@ void mctStereoIGF_enc( int16_t singleChEle[MCT_MAX_CHANNELS]; L_subframeTCX = 0; /* to avoid compilation warning */ - set_s( singleChEle, 1, hMCT->nchan_out_woLFE + hMCT->num_lfe ); + set_s( singleChEle, 1, hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ); for ( b = 0; b < hMCT->currBlockDataCnt; b++ ) { @@ -889,15 +978,28 @@ void mctStereoIGF_enc( } /* channel elements that are coded separately detected */ - if ( sum_s( singleChEle, ( hMCT->nchan_out_woLFE + hMCT->num_lfe ) ) != 0 ) + if ( sum_s( singleChEle, ( hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ) ) != 0 ) { - for ( ch = 0; ch < ( hMCT->nchan_out_woLFE + hMCT->num_lfe ); ch++ ) + for ( ch = 0; ch < ( hMCT->nchan_out_woLFE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + + hMCT->num_lfe +#endif + ); + ch++ ) { if ( singleChEle[ch] ) { st = sts[ch]; - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE || st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + st->mct_chan_mode == MCT_CHAN_MODE_LFE || +#endif + st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } diff --git a/lib_enc/ivas_mdct_core_enc.c b/lib_enc/ivas_mdct_core_enc.c index ef9264d5df..62223d9005 100755 --- a/lib_enc/ivas_mdct_core_enc.c +++ b/lib_enc/ivas_mdct_core_enc.c @@ -88,16 +88,19 @@ static void enc_prm_pre_mdct( { writeTCXWindowing( hBstr, st->hTcxCfg->tcx_last_overlap_mode ); } - +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->element_mode == IVAS_CPE_MDCT && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) { +#endif push_next_indice( hBstr, st->hTcxEnc->kernel_type[0], st->last_core != ACELP_CORE ? 2 : 1 ); if ( st->core == TCX_10_CORE ) { assert( ( st->hTcxEnc->kernel_type[0] & 1 ) == ( st->hTcxEnc->kernel_type[1] >> 1 ) ); push_next_indice( hBstr, st->hTcxEnc->kernel_type[1] & 1, 1 ); } +#ifndef ISSUE_24_CLEANUP_MCT_LFE } +#endif st->glr_reset = 0; #ifdef DEBUG_PLOT_BITS @@ -288,7 +291,12 @@ static void kernel_switch_update_transforms( int16_t i, leftOverlap = 0, rightOverlap = 0; const float *left_win, *right_win; - tcx_get_windows( hTcxCfg, (int16_t) windowedTimeSignal[0], (int16_t) windowedTimeSignal[1], &leftOverlap, &left_win, &rightOverlap, &right_win, 1, 0 ); + tcx_get_windows( hTcxCfg, (int16_t) windowedTimeSignal[0], (int16_t) windowedTimeSignal[1], &leftOverlap, &left_win, &rightOverlap, &right_win, 1 +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + 0 +#endif + ); if ( speech_TCX != NULL && tcxTransType != TCX_20 && (int16_t) windowedTimeSignal[0] == FULL_OVERLAP && s - leftOverlap > minWindowLen ) { for ( i = minWindowLen; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ @@ -311,7 +319,12 @@ static void kernel_switch_update_transforms( s = hTcxCfg->tcx5SizeFB; /* obtain 1st TCX5 again */ nSubframes *= 2; - WindowSignal( hTcxCfg, leftOverlap / 2, RECTANGULAR_OVERLAP, MIN_OVERLAP, &leftOverlap, &rightOverlap, windowedTimeSignal + 2, &s, tcx5Win, 0, 1, 0 ); + WindowSignal( hTcxCfg, leftOverlap / 2, RECTANGULAR_OVERLAP, MIN_OVERLAP, &leftOverlap, &rightOverlap, windowedTimeSignal + 2, &s, tcx5Win, 0, 1 +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + 0 +#endif + ); kernel_switch_trafo( tcx5Win, sigR, leftOverlap, s /* L_subfr. */ - ( leftOverlap + rightOverlap ) / 2, rightOverlap, kernelType ); if ( kernelType & 1 ) /* 2nd TCX5 is kernelType 3 */ @@ -576,9 +589,11 @@ void ivas_mdct_core_whitening_enc( int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* o : number of tns parameters put into prm */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to the parameter table */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - int16_t *LFE_off, /* o : flag if LFE has zero content */ - const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ - const int16_t nChannels /* i : total number of coded channels */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + int16_t *LFE_off, /* o : flag if LFE has zero content */ +#endif + const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ + const int16_t nChannels /* i : total number of coded channels */ ) { int16_t n, ch, nSubframes, L_subframe, L_subframeTCX, tcx_subframe_coded_lines; @@ -612,10 +627,14 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) { +#endif stereo_tcx_init_enc( sts[ch] ); +#ifndef ISSUE_24_CLEANUP_MCT_LFE } +#endif set_s( tnsSize[ch], 0, 2 ); set_s( tnsBits[ch], 0, 2 ); @@ -655,10 +674,14 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) { +#endif SetTCXModeInfo( st, st->hTranDet, &st->hTcxCfg->tcx_curr_overlap_mode ); +#ifndef ISSUE_24_CLEANUP_MCT_LFE } +#endif } } @@ -672,12 +695,14 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; - +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) +#else + if ( ( hCPE->cpe_id * CPE_CHANNELS + ch ) >= nChannels ) +#endif { continue; } - SetCurrentPsychParams( st->core, 0, st->hTcxCfg ); /* tcx ltp analysis on the 12.8kHz weighted speech, saves preproc resampling to sr_core */ @@ -689,13 +714,21 @@ void ivas_mdct_core_whitening_enc( #ifndef FIX_MDCT_BASED_BWD if ( st->hTcxEnc->transform_type[0] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) { +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) +#else + if ( st->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) +#endif { bw_detect( st, NULL, st->hTcxEnc->spectrum[0], NULL ); } } #else +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) +#else + if ( st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) +#endif { nSubframes = ( st->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; @@ -820,7 +853,11 @@ void ivas_mdct_core_whitening_enc( { TCX_ENC_HANDLE hTcxEncCh = sts[ch]->hTcxEnc; - if ( ( hCPE->cpe_id * CPE_CHANNELS + ch ) >= nChannels || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( ( hCPE->cpe_id * CPE_CHANNELS + ch ) >= nChannels +#ifndef ISSUE_24_CLEANUP_MCT_LFE + || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE +#endif + ) { hTcxEncCh->kernel_symmetry_past = hTcxEncCh->kernel_type[0] = 0; @@ -849,7 +886,11 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - if ( ( hCPE->cpe_id * CPE_CHANNELS + ch ) >= nChannels || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( ( hCPE->cpe_id * CPE_CHANNELS + ch ) >= nChannels +#ifndef ISSUE_24_CLEANUP_MCT_LFE + || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE +#endif + ) { continue; } @@ -894,7 +935,11 @@ void ivas_mdct_core_whitening_enc( } /* MCT: detect whether there are silent channels and set mct_chan_mode accordingly */ - if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE && mct_on ) + if ( +#ifndef ISSUE_24_CLEANUP_MCT_LFE + st->mct_chan_mode != MCT_CHAN_MODE_LFE && +#endif + mct_on ) { chE_tot = sum_f( chE, NB_DIV ); @@ -911,7 +956,11 @@ void ivas_mdct_core_whitening_enc( } /* set low br mode, if possible. Can later be discarded, depending on the stereo mode used for SNS parameter decoding */ - if ( hCPE->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) || sts[1]->mct_chan_mode == MCT_CHAN_MODE_LFE ) ) + if ( hCPE->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + || sts[1]->mct_chan_mode == MCT_CHAN_MODE_LFE +#endif + ) ) { sns_low_br_mode = !sts[0]->sp_aud_decision0; } @@ -938,7 +987,11 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { param_lpc[ch][0] = ch; - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE +#endif + ) { continue; } @@ -961,7 +1014,11 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE +#endif + ) { continue; } @@ -989,7 +1046,11 @@ void ivas_mdct_core_whitening_enc( /* first deinterleave once more */ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE +#endif + ) { continue; } @@ -1010,7 +1071,11 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE +#ifndef ISSUE_24_CLEANUP_MCT_LFE + || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE +#endif + ) { continue; } @@ -1032,8 +1097,9 @@ void ivas_mdct_core_whitening_enc( } } } - - /*check whether LFE channel is active*/ +#ifndef ISSUE_24_CLEANUP_MCT_LFE +/*check whether LFE channel is active*/ +#endif for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { /*no need to write last channel bit in case of odd channels*/ @@ -1046,12 +1112,15 @@ void ivas_mdct_core_whitening_enc( if ( mct_on ) /* signal bits should be written only for MCT*/ { +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) { assert( *LFE_off == 1 ); push_next_indice( hBstr, *LFE_off, 1 ); } - else if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + else +#endif + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { push_next_indice( hBstr, 1, 1 ); } @@ -1068,7 +1137,11 @@ void ivas_mdct_core_whitening_enc( { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( *LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) +#else + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) +#endif { st->side_bits_frame_channel = 0; /*dummy initialization to prevent range coder crashing in case all channels are silent and bits are distributed to channel 0 */ @@ -1113,7 +1186,11 @@ void ivas_mdct_core_whitening_enc( { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( *LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) +#else + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) +#endif { skipped_first_channel = 1; continue; @@ -1127,7 +1204,11 @@ void ivas_mdct_core_whitening_enc( { push_next_indice( hBstr, param_lpc[0][0] >> 1, 1 ); - if ( st->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) || sts[1]->mct_chan_mode == MCT_CHAN_MODE_LFE ) ) + if ( st->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + || sts[1]->mct_chan_mode == MCT_CHAN_MODE_LFE +#endif + ) ) { /* write classifier decision to signal low br mode for SNS encoding, for all other configs, low_br mode is not possible */ push_next_indice( hBstr, sns_low_br_mode, 1 ); @@ -1142,7 +1223,11 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( *LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) +#else + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) +#endif { continue; } @@ -1168,8 +1253,10 @@ void ivas_mdct_core_whitening_enc( *---------------------------------------------------------------*/ void ivas_mdct_quant_coder( - CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */ - const int16_t LFE_off, /* i : flag if LFE is inactive */ + CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE + const int16_t LFE_off, /* i : flag if LFE is inactive */ +#endif int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* i : bits needed for TNS parameters */ int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* i : size of TNS */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to parameter array */ @@ -1215,7 +1302,11 @@ void ivas_mdct_quant_coder( st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) +#else + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) +#endif { ignore_chan[ch] = 1; continue; @@ -1275,7 +1366,11 @@ void ivas_mdct_quant_coder( { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) +#else + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) +#endif { /*Enable appropriate upadte of tcx_curr_overlap_mode even for uncoded channel index 1*/ L_frameTCX[ch][0] = ( st->core == TCX_10_CORE ) ? st->hTcxEnc->L_frameTCX >> 1 : st->hTcxEnc->L_frameTCX; @@ -1302,7 +1397,11 @@ void ivas_mdct_quant_coder( * Generate Bitstream *---------------------------------------------------------------*/ - if ( ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) +#ifndef ISSUE_24_CLEANUP_MCT_LFE + if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) +#else + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) +#endif { continue; } diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 868c31ffe0..6638a89488 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -941,11 +941,14 @@ typedef struct mct_enc_data_structure float lastxCorrMatrix[MCT_MAX_CHANNELS][MCT_MAX_CHANNELS]; int16_t lowE_ch[MCT_MAX_CHANNELS]; +#ifndef ISSUE_24_CLEANUP_MCT_LFE int16_t LFE_off; +#endif uint16_t mc_global_ild[MCT_MAX_CHANNELS]; int16_t nBitsMCT; /* number of bits spent on mct side info */ +#ifndef ISSUE_24_CLEANUP_MCT_LFE int16_t num_lfe; - +#endif /* pointers to local buffers */ float *p_mdst_spectrum_long[MCT_MAX_BLOCKS][CPE_CHANNELS]; float *p_orig_spectrum_long[MCT_MAX_BLOCKS][CPE_CHANNELS]; diff --git a/lib_enc/ivas_stereo_mdct_core_enc.c b/lib_enc/ivas_stereo_mdct_core_enc.c index 9500da4fb9..fa9b108f00 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc.c +++ b/lib_enc/ivas_stereo_mdct_core_enc.c @@ -235,7 +235,11 @@ void stereo_mdct_core_enc( *---------------------------------------------------------------*/ ivas_mdct_core_whitening_enc( hCPE, new_samples, old_wsp, pitch_buf, p_mdst_spectrum_long, - tnsBits, p_orig_spectrum_long, tnsSize, p_param, hBstr, NULL, 0, CPE_CHANNELS ); + tnsBits, p_orig_spectrum_long, tnsSize, p_param, hBstr, +#ifndef ISSUE_24_CLEANUP_MCT_LFE + NULL, +#endif + 0, CPE_CHANNELS ); for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { @@ -449,7 +453,11 @@ void stereo_mdct_core_enc( } #endif - ivas_mdct_quant_coder( hCPE, 0, tnsBits, tnsSize, p_param, 0 ); + ivas_mdct_quant_coder( hCPE, +#ifndef ISSUE_24_CLEANUP_MCT_LFE + 0, +#endif + tnsBits, tnsSize, p_param, 0 ); pop_wmops(); diff --git a/lib_enc/ivas_stereo_switching_enc.c b/lib_enc/ivas_stereo_switching_enc.c index 1be9af224e..0e6fe1496b 100644 --- a/lib_enc/ivas_stereo_switching_enc.c +++ b/lib_enc/ivas_stereo_switching_enc.c @@ -526,7 +526,12 @@ ivas_error stereo_memory_enc( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hIGFEnc\n" ) ); } - st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); /* allocate and initialize MDCT stereo structure */ if ( ( hCPE->hStereoMdct = (STEREO_MDCT_ENC_DATA_HANDLE) malloc( sizeof( STEREO_MDCT_ENC_DATA ) ) ) == NULL ) diff --git a/lib_enc/ivas_tcx_core_enc.c b/lib_enc/ivas_tcx_core_enc.c index 40a97cc33e..3bda423fad 100644 --- a/lib_enc/ivas_tcx_core_enc.c +++ b/lib_enc/ivas_tcx_core_enc.c @@ -99,10 +99,20 @@ void stereo_tcx_init_enc( st->hTcxCfg->ctx_hm = getCtxHm( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->rf_mode ); st->hTcxCfg->resq = getResq( st->bits_frame_nominal * FRAMES_PER_SEC ); st->hTcxEnc->tcx_lpc_shaped_ari = getTcxLpcShapedAri( st->bits_frame_nominal * FRAMES_PER_SEC, st->rf_mode, st->element_mode ); - st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); if ( st->element_mode != EVS_MONO ) { - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode, st->mct_chan_mode ); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + st->mct_chan_mode +#endif + ); } st->core_brate = st->total_brate; diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c index bbeba48a16..feb0df75ca 100755 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -621,7 +621,12 @@ void pre_proc( st->gamma = GAMMA16k; } - st->igf = getIgfPresent( EVS_MONO, st->total_brate, st->bwidth, st->rf_mode, MCT_CHAN_MODE_REGULAR ); /* TBV: needs checking */ + st->igf = getIgfPresent( EVS_MONO, st->total_brate, st->bwidth, st->rf_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + MCT_CHAN_MODE_REGULAR +#endif + ); } st->coder_type = st->coder_type_raw; diff --git a/lib_enc/transient_detection.c b/lib_enc/transient_detection.c index 91106686c0..83f9e2e7a0 100644 --- a/lib_enc/transient_detection.c +++ b/lib_enc/transient_detection.c @@ -324,17 +324,18 @@ void SetTCXModeInfo( hTcxEnc->tcxMode = NO_TCX; } } - +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) { hTcxEnc->tcxMode = TCX_20; *tcxModeOverlap = FULL_OVERLAP; st->hTcxCfg->tcx_last_overlap_mode = st->hTcxCfg->tcx_curr_overlap_mode; } - - +#endif +#ifndef ISSUE_24_CLEANUP_MCT_LFE if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) { +#endif /* set the left window overlap */ if ( st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE ) { @@ -403,7 +404,9 @@ void SetTCXModeInfo( hTcxEnc->tfm_mem = 0.75f; } } +#ifndef ISSUE_24_CLEANUP_MCT_LFE } +#endif /* for the ACELP -> TCX transition frames use full right window overlap */ if ( ( st->hTcxCfg->tcx_last_overlap_mode == TRANSITION_OVERLAP ) && ( *tcxModeOverlap == ALDO_WINDOW ) ) diff --git a/lib_enc/updt_enc.c b/lib_enc/updt_enc.c index cc2d5fce36..b194de06d5 100644 --- a/lib_enc/updt_enc.c +++ b/lib_enc/updt_enc.c @@ -408,7 +408,12 @@ void updt_enc_common( st->gamma = GAMMA16k; } - st->igf = getIgfPresent( EVS_MONO, st->total_brate, st->bwidth, st->rf_mode, MCT_CHAN_MODE_REGULAR ); + st->igf = getIgfPresent( EVS_MONO, st->total_brate, st->bwidth, st->rf_mode +#ifndef ISSUE_24_CLEANUP_MCT_LFE + , + MCT_CHAN_MODE_REGULAR +#endif + ); } /* update FER clas */ -- GitLab From 78545b82b34d295b0e957107b7fe117fb4050a4e Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 11 Apr 2023 18:03:06 +1000 Subject: [PATCH 366/375] fix for issue 392 --- apps/renderer.c | 4 ++++ lib_com/options.h | 1 + lib_rend/lib_rend.c | 16 ++++++++++++++-- lib_rend/lib_rend.h | 8 ++++++-- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 7fb3e0e009..00b6c4c82a 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/options.h b/lib_com/options.h index c4d0aebd2b..f7073d3d6c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,6 +159,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*/ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 5a4d31d313..3307b9f087 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 = ( outAudioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) || ( outAudioConfig == IVAS_REND_AUDIO_CONFIG_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 c253d58f924060de64dcb336f720e70f334afcd2 Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 11 Apr 2023 18:34:01 +1000 Subject: [PATCH 367/375] fix for issue 392, using BIN type enum for if check --- lib_rend/lib_rend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 3307b9f087..3d2420632d 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3669,7 +3669,7 @@ ivas_error IVAS_REND_InitConfig( #ifdef FIX_392_LATE_REVERB bool rendererConfigEnabled; - rendererConfigEnabled = ( outAudioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) || ( outAudioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL ); + rendererConfigEnabled = ( getAudioConfigType( outAudioConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ); #endif if ( rendererConfigEnabled ) -- GitLab From 1b9e750b9f24208e15e8d8cd64547d222226a14c Mon Sep 17 00:00:00 2001 From: Auto Commit Date: Tue, 11 Apr 2023 06:49:44 -0400 Subject: [PATCH 368/375] just remove option2 as it didn't show significative improvement --- lib_com/ivas_stereo_td_bit_alloc.c | 2 +- lib_enc/ivas_stereo_classifier.c | 1 - lib_enc/ivas_stereo_td_enc.c | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index b0ae12ecd8..5daaf61e12 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -139,7 +139,7 @@ void tdm_bit_alloc( *total_brate_sec = tdm_bit_allc_tbl[idx][coder_type]; /* secondary channel bitrate allocation based on the energy scaling ratio */ -#ifdef OMASA_TUNING +#if defined OMASA_TUNING if ( (IsOmasa == 0 && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || ( IsOmasa == 1 && coder_type > UNVOICED ) ) diff --git a/lib_enc/ivas_stereo_classifier.c b/lib_enc/ivas_stereo_classifier.c index 8e20c13c8a..534dc2189c 100644 --- a/lib_enc/ivas_stereo_classifier.c +++ b/lib_enc/ivas_stereo_classifier.c @@ -209,7 +209,6 @@ int16_t select_stereo_mode( set_f( hStereoClassif->xtalk_fv, -1.0f, SSC_MAX_NFEA ); } } - #ifdef DEBUG_MODE_TD dbgwrite( &hStereoClassif->unclr_decision, sizeof( int16_t ), 1, L_FRAME16k, "res/unclr_decision.enc" ); dbgwrite( &hStereoClassif->xtalk_decision, sizeof( int16_t ), 1, L_FRAME16k, "res/xtalk_decision.enc" ); diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 6e13ec2075..11da8f6404 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -430,6 +430,7 @@ void tdm_configure_enc( sts[1]->coder_type = GENERIC; } hStereoTD->tdm_lp_reuse_flag = 1; + #ifdef OMASA_TUNING if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 11000 ) #else -- GitLab From 4f30e166afc2d359b756ece40a960aa29014dae2 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 11 Apr 2023 16:19:47 +0200 Subject: [PATCH 369/375] - rename compilation switch OMASA_TUNING to OMASA_TUNING_TD_STEREO - revert changes in MSVC project files --- Workspace_msvc/decoder.vcxproj | 6 +++--- Workspace_msvc/encoder.vcxproj | 8 ++++---- Workspace_msvc/lib_com.vcxproj | 8 ++++---- Workspace_msvc/lib_debug.vcxproj | 8 ++++---- Workspace_msvc/lib_dec.vcxproj | 8 ++++---- Workspace_msvc/lib_enc.vcxproj | 8 ++++---- Workspace_msvc/lib_rend.vcxproj | 8 ++++---- Workspace_msvc/lib_util.vcxproj | 8 ++++---- Workspace_msvc/renderer.vcxproj | 8 ++++---- lib_com/ivas_prot.h | 16 ++++++++-------- lib_com/ivas_stereo_td_bit_alloc.c | 11 +++++------ lib_com/options.h | 2 +- lib_dec/ivas_cpe_dec.c | 9 +++++---- lib_dec/ivas_stereo_td_dec.c | 12 +++++++----- lib_enc/ivas_cpe_enc.c | 10 ++++++---- lib_enc/ivas_stereo_td_analysis.c | 10 ++++++---- lib_enc/ivas_stereo_td_enc.c | 16 +++++++++------- 17 files changed, 82 insertions(+), 74 deletions(-) diff --git a/Workspace_msvc/decoder.vcxproj b/Workspace_msvc/decoder.vcxproj index f0016965e0..e59992847c 100644 --- a/Workspace_msvc/decoder.vcxproj +++ b/Workspace_msvc/decoder.vcxproj @@ -14,18 +14,18 @@ decoder {E3DCBC31-7FC9-D127-E000-529F8460D5FD} decoder - 10.0 + 10.0.17763.0 Application - v142 + v141 false MultiByte Application - v142 + v141 false MultiByte diff --git a/Workspace_msvc/encoder.vcxproj b/Workspace_msvc/encoder.vcxproj index fc7e189560..bcfe92a4db 100644 --- a/Workspace_msvc/encoder.vcxproj +++ b/Workspace_msvc/encoder.vcxproj @@ -18,24 +18,24 @@ encoder {B3FC9DFC-7268-8660-7C0D-B60BAF02C554} encoder - 10.0 + 10.0.17763.0 Application - v142 + v141 false MultiByte Application - v142 + v141 false MultiByte Application - v142 + v141 false MultiByte diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index ed8012c4d3..78ed7bb39d 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -17,24 +17,24 @@ {39EC200D-7795-4FF8-B214-B24EDA5526AE} common - 10.0 + 10.0.17763.0 StaticLibrary - v142 + v141 false MultiByte StaticLibrary - v142 + v141 false MultiByte StaticLibrary - v142 + v141 false MultiByte diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj index 6a5e102b0c..3b648fae04 100644 --- a/Workspace_msvc/lib_debug.vcxproj +++ b/Workspace_msvc/lib_debug.vcxproj @@ -17,22 +17,22 @@ {54509728-928B-44D9-A118-A6F92F08B34F} debug - 10.0 + 10.0.17763.0 StaticLibrary - v142 + v141 MultiByte StaticLibrary - v142 + v141 MultiByte StaticLibrary - v142 + v141 MultiByte true diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index facb2d3bc3..dd2ed44443 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -18,24 +18,24 @@ lib_dec {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} evs_dec - 10.0 + 10.0.17763.0 StaticLibrary - v142 + v141 false MultiByte StaticLibrary - v142 + v141 false MultiByte StaticLibrary - v142 + v141 false MultiByte diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj index eede51cfde..af7ca35b12 100644 --- a/Workspace_msvc/lib_enc.vcxproj +++ b/Workspace_msvc/lib_enc.vcxproj @@ -18,24 +18,24 @@ lib_enc {824DA4CF-06F0-45C9-929A-8792F0E19C3E} evs_enc - 10.0 + 10.0.17763.0 StaticLibrary - v142 + v141 false MultiByte StaticLibrary - v142 + v141 false MultiByte StaticLibrary - v142 + v141 false MultiByte diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index 1cb397d10f..865652649a 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -18,24 +18,24 @@ lib_rend {718DE063-A18B-BB72-9150-62B892E6FFA6} evs_dec - 10.0 + 10.0.17763.0 StaticLibrary - v142 + v141 false MultiByte StaticLibrary - v142 + v141 false MultiByte StaticLibrary - v142 + v141 false MultiByte diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index d1a1a8d818..5b5e5f30cc 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -17,22 +17,22 @@ {2FA8F384-0775-F3B7-F8C3-85209222FC70} utility - 10.0 + 10.0.17763.0 StaticLibrary - v142 + v141 MultiByte StaticLibrary - v142 + v141 MultiByte StaticLibrary - v142 + v141 MultiByte true diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj index d90b4a6251..94ad9f774e 100644 --- a/Workspace_msvc/renderer.vcxproj +++ b/Workspace_msvc/renderer.vcxproj @@ -18,24 +18,24 @@ renderer {12B4C8A5-1E06-4E30-B443-D1F916F52B47} renderer - 10.0 + 10.0.17763.0 Application - v142 + v141 false MultiByte Application - v142 + v141 false MultiByte Application - v142 + v141 false MultiByte diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 61a40222ed..0964ffe870 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1825,8 +1825,8 @@ int16_t stereo_tdm_ener_analysis( const int16_t input_frame, /* i : Number of samples */ int16_t *tdm_SM_or_LRTD_Pri, /* o : channel combination scheme flag in TD stereo OR LRTD primary channel */ int16_t *tdm_ratio_idx_SM /* o : TDM ratio index for SM mode */ -#ifdef OMASA_TUNING - ,const int16_t isOmasa /* i : Flag to indicate that Omasa is present */ +#ifdef OMASA_TUNING_TD_STEREO + ,const int16_t isOmasa /* i : flag that indicates OMASA format */ #endif ); @@ -1849,8 +1849,8 @@ void tdm_configure_dec( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t *tdm_ratio_idx, /* o : ratio index */ const int16_t nb_bits_metadata /* i : number of metadata bits */ -#ifdef OMASA_TUNING - ,const int16_t IsOmasa /* i : flag that indicate the presence of Omasa*/ +#ifdef OMASA_TUNING_TD_STEREO + ,const int16_t IsOmasa /* i : flag that indicates OMASA format */ #endif ); @@ -1906,8 +1906,8 @@ void tdm_configure_enc( const int16_t tdm_ratio_idx_SM, /* i : ratio index in SM mode */ const int16_t attack_flag, /* i : Primary channel attack flag */ const int16_t nb_bits_metadata /* i : number of metadata bits */ -#ifdef OMASA_TUNING - ,const int16_t IsOmasa /* i : flag that indicate the presence of Omasa*/ +#ifdef OMASA_TUNING_TD_STEREO + ,const int16_t IsOmasa /* i : flag that indicates OMASA format */ #endif ); @@ -1932,8 +1932,8 @@ void tdm_bit_alloc( const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const int16_t coder_type0, /* i : coder type (temporary in the encoder, from bitstream in decoder) */ const int16_t tdm_inst_ratio_idx /* i : instantaneous correlation ratio index */ -#ifdef OMASA_TUNING - ,const int16_t IsOmasa /* i : Flag that indicates presence of OMASA */ +#ifdef OMASA_TUNING_TD_STEREO + ,const int16_t IsOmasa /* i : flag that indicates OMASA format */ #endif ); diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index 5daaf61e12..ac56cd6537 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -88,8 +88,9 @@ void tdm_bit_alloc( const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const int16_t coder_type0, /* i : coder type (temporary in the encoder, from bitstream in decoder) */ const int16_t tdm_inst_ratio_idx_ref /* i : instantaneous correlation ratio idx */ -#ifdef OMASA_TUNING - ,const int16_t IsOmasa /* i : Flag that indicates presence of OMASA */ +#ifdef OMASA_TUNING_TD_STEREO + , + const int16_t IsOmasa /* i : flag that indicates OMASA format */ #endif ) { @@ -139,10 +140,8 @@ void tdm_bit_alloc( *total_brate_sec = tdm_bit_allc_tbl[idx][coder_type]; /* secondary channel bitrate allocation based on the energy scaling ratio */ -#if defined OMASA_TUNING - if ( (IsOmasa == 0 && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) - || - ( IsOmasa == 1 && coder_type > UNVOICED ) ) +#ifdef OMASA_TUNING_TD_STEREO + if ( ( IsOmasa == 0 && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || ( IsOmasa == 1 && coder_type > UNVOICED ) ) #else if ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) #endif diff --git a/lib_com/options.h b/lib_com/options.h index ce6430957f..024ea86156 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,7 +159,7 @@ #define OMASA_UPDATES /* Nokia: Updates to the OMASA processing */ #define OMASA_BRATE_SW /* VA: support of bitrate switching in OMASA format */ #define FIX_TD5_IN_OMASA // do not transmit extended MD in OMASA -#define OMASA_TUNING +#define OMASA_TUNING_TD_STEREO /* VA: tuning of TD stereo in OMASA format */ #endif /* MASA_AND_OBJECTS */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index f42dfe42e7..d1495e7f91 100755 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -413,11 +413,12 @@ ivas_error ivas_cpe_dec( { if ( !st_ivas->bfi ) { - tdm_configure_dec( hCPE, &tdm_ratio_idx, nb_bits_metadata -#ifdef OMASA_TUNING - , (st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_24k4)) + tdm_configure_dec( hCPE, &tdm_ratio_idx, nb_bits_metadata +#ifdef OMASA_TUNING_TD_STEREO + , + ( st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_24k4 ) ) #endif - ); + ); sts[1]->bit_stream = sts[0]->bit_stream + ( sts[0]->total_brate / FRAMES_PER_SEC ); } diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index 7cfa3d92fd..e613e8ea2e 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -87,8 +87,9 @@ void tdm_configure_dec( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t *tdm_ratio_idx, /* o : ratio index */ const int16_t nb_bits_metadata /* i : number of metadata bits */ -#ifdef OMASA_TUNING - ,const int16_t IsOmasa /* i : flag that indicate the presence of Omasa*/ +#ifdef OMASA_TUNING_TD_STEREO + , + const int16_t IsOmasa /* i : flag that indicates OMASA format*/ #endif ) @@ -313,10 +314,11 @@ void tdm_configure_dec( hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx -#ifdef OMASA_TUNING - ,IsOmasa +#ifdef OMASA_TUNING_TD_STEREO + , + IsOmasa #endif - ); + ); #else tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx ); #endif diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 0865e2b281..422d7f9156 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -414,8 +414,9 @@ ivas_error ivas_cpe_enc( { /* Determine the energy ratio between the 2 channels */ tdm_ratio_idx = stereo_tdm_ener_analysis( hCPE, input_frame, &tdm_SM_or_LRTD_Pri, &tdm_ratio_idx_SM -#ifdef OMASA_TUNING - , st_ivas->hOMasa != NULL +#ifdef OMASA_TUNING_TD_STEREO + , + st_ivas->hOMasa != NULL #endif ); @@ -584,8 +585,9 @@ ivas_error ivas_cpe_enc( tdm_ol_pitch_comparison( hCPE, pitch_fr, voicing_fr ); tdm_configure_enc( hCPE, Etot_last, tdm_SM_or_LRTD_Pri, tdm_ratio_idx, tdm_ratio_idx_SM, attack_flag[0], nb_bits_metadata -#ifdef OMASA_TUNING - ,st_ivas->hOMasa != NULL +#ifdef OMASA_TUNING_TD_STEREO + , + st_ivas->hOMasa != NULL #endif ); diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index 97522ef861..5ef8001b7a 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -115,8 +115,9 @@ int16_t stereo_tdm_ener_analysis( const int16_t input_frame, /* i : Number of samples */ int16_t *tdm_SM_or_LRTD_Pri, /* o : channel combination scheme flag in TD stereo OR LRTD primary channel */ int16_t *tdm_ratio_idx_SM /* o : TDM ratio index for SM mode */ -#ifdef OMASA_TUNING - ,const int16_t isOmasa /* i : Flag to indicate that Omasa is present */ +#ifdef OMASA_TUNING_TD_STEREO + , + const int16_t isOmasa /* i : flag that indicates OMASA format */ #endif ) { @@ -197,8 +198,9 @@ int16_t stereo_tdm_ener_analysis( * When the energies of channels are low enough, compute the ratio * of L and R needed to create new mono/side signals *----------------------------------------------------------------*/ -#ifdef OMASA_TUNING - if ( isOmasa ) + +#ifdef OMASA_TUNING_TD_STEREO + if ( isOmasa ) { if ( ( hCPE->hStereoClassif->lrtd_mode == 1 || hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 1 ) && ( hCPE->element_brate - 50 * FRAMES_PER_SEC + hCPE->brate_surplus + hCPE->brate_surplus < 15000 ) ) diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 11da8f6404..82e3f4bdfd 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -309,8 +309,9 @@ void tdm_configure_enc( const int16_t tdm_ratio_idx_SM, /* i : ratio index in SM mode */ const int16_t attack_flag, /* i : Primary channel attack flag */ const int16_t nb_bits_metadata /* i : number of metadata bits */ -#ifdef OMASA_TUNING - ,const int16_t IsOmasa /* i : flag that indicate the presence of Omasa*/ +#ifdef OMASA_TUNING_TD_STEREO + , + const int16_t IsOmasa /* i : flag that indicates OMASA format */ #endif ) { @@ -425,13 +426,13 @@ void tdm_configure_enc( #ifdef MASA_AND_OBJECTS if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12000 ) { - if ( sts[1]->coder_type == UNVOICED) + if ( sts[1]->coder_type == UNVOICED ) { sts[1]->coder_type = GENERIC; } hStereoTD->tdm_lp_reuse_flag = 1; -#ifdef OMASA_TUNING +#ifdef OMASA_TUNING_TD_STEREO if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 11000 ) #else if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12000 ) @@ -488,10 +489,11 @@ void tdm_configure_enc( hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx -#ifdef OMASA_TUNING - ,IsOmasa +#ifdef OMASA_TUNING_TD_STEREO + , + IsOmasa #endif - ); + ); #else tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx ); #endif -- GitLab From 8a2f604e7760c9df9a2bede0ecc1a3a486a99760 Mon Sep 17 00:00:00 2001 From: knj Date: Tue, 11 Apr 2023 17:01:19 +0200 Subject: [PATCH 370/375] fix clicks in ism dtx for cng to TCX transitions --- lib_com/options.h | 2 ++ lib_com/prot.h | 3 +++ lib_dec/core_switching_dec.c | 17 ++++++++++++----- lib_dec/evs_dec.c | 4 ++++ lib_dec/ivas_core_dec.c | 4 ++++ lib_dec/ivas_mct_dec.c | 4 ++++ 6 files changed, 29 insertions(+), 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index f7073d3d6c..98fbab5f9c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -161,6 +161,8 @@ #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 */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_com/prot.h b/lib_com/prot.h index e89037076e..babd1ff9f7 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -5860,6 +5860,9 @@ ivas_error core_switching_post_dec( float *synth, /* i/o: output synthesis */ float *output, /* i/o: LB synth/upsampled LB synth */ float output_mem[], /* i : OLA memory from last TCX/HQ frame */ +#ifdef FIX_ISM_DTX_CLICKS + const IVAS_FORMAT ivas_format, /* i : IVAS format */ +#endif const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ const int16_t output_frame, /* i : frame length */ const int16_t core_switching_flag, /* i : ACELP->HQ switching frame flag */ diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index c2a3955afb..a83e97c53c 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -51,7 +51,7 @@ *---------------------------------------------------------------------*/ static void core_switch_lb_upsamp( Decoder_State *st, float *output ); -static void smoothTransitionMdctStereoDtx( float synth[], const int16_t output_frame, const int16_t delay_comp ); +static void smoothTransitionDtxToTcx( float synth[], const int16_t output_frame, const int16_t delay_comp ); /*---------------------------------------------------------------------* * core_switching_pre_dec() @@ -556,6 +556,9 @@ ivas_error core_switching_post_dec( float *synth, /* i/o: output synthesis */ float *output, /* i/o: LB synth/upsampled LB synth */ float output_mem[], /* i : OLA memory from last TCX/HQ frame */ +#ifdef FIX_ISM_DTX_CLICKS + const IVAS_FORMAT ivas_format, /* i : IVAS format */ +#endif const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ const int16_t output_frame, /* i : frame length */ const int16_t core_switching_flag, /* i : ACELP->HQ switching flag */ @@ -677,10 +680,14 @@ ivas_error core_switching_post_dec( synth[i + delay_comp] = ( synth[i + delay_comp] * i + ( tmpDelta - i ) * st->previoussynth[i + delay_comp] ) / tmpDelta; } +#ifdef FIX_ISM_DTX_CLICKS + if ( ( st->element_mode == IVAS_CPE_MDCT || ( ivas_format == ISM_FORMAT && st->core == TCX_20_CORE /* <- means TCX in general, TCX10 is forbidden after ACELP */ ) ) && st->last_core_brate <= SID_2k40 && st->core_brate > SID_2k40 ) +#else if ( st->element_mode == IVAS_CPE_MDCT && st->last_core_brate <= SID_2k40 && st->core_brate > SID_2k40 ) +#endif { /* smooth transitions to avoid pops in car noise items */ - smoothTransitionMdctStereoDtx( synth, output_frame, delay_comp ); + smoothTransitionDtxToTcx( synth, output_frame, delay_comp ); } /* Reset memories of CLDFBs */ @@ -1245,16 +1252,16 @@ static void core_switch_lb_upsamp( } /*---------------------------------------------------------------------* - * smoothTransitionMdctStereoDtx() + * smoothTransitionDtxToTcx() * - * apply smoothing to the transition part for MDCT-Stereo DTX + * apply smoothing to the transition part for inactive to active transitions in DTX *---------------------------------------------------------------------*/ #define TRANSITION_SMOOTHING_LEN_16k 15 #define TRANSITION_SMOOTHING_LEN_32k 31 #define TRANSITION_SMOOTHING_LEN_48k 47 -static void smoothTransitionMdctStereoDtx( +static void smoothTransitionDtxToTcx( float synth[], /* i/o: synthesis */ const int16_t output_frame, /* i : output frame length */ const int16_t delay_comp /* i : delay compensation in samples */ diff --git a/lib_dec/evs_dec.c b/lib_dec/evs_dec.c index 2391430237..0dbc0feafc 100644 --- a/lib_dec/evs_dec.c +++ b/lib_dec/evs_dec.c @@ -276,7 +276,11 @@ ivas_error evs_dec( * Postprocessing for ACELP/MDCT core switching *---------------------------------------------------------------------*/ +#ifdef FIX_ISM_DTX_CLICKS + if ( ( error = core_switching_post_dec( st, synth, NULL, NULL, 0, MONO_FORMAT, output_frame, core_switching_flag, 0, -1, EVS_MONO ) ) != IVAS_ERR_OK ) +#else if ( ( error = core_switching_post_dec( st, synth, NULL, NULL, 0, output_frame, core_switching_flag, 0, -1, EVS_MONO ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 0811f9957a..bf13dee06f 100755 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -451,7 +451,11 @@ ivas_error ivas_core_dec( mvr2r( synth[n], hSCE->save_synth, output_frame ); } +#ifdef FIX_ISM_DTX_CLICKS + if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, ( st_ivas != NULL ) ? st_ivas->ivas_format : UNDEFINED_FORMAT, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE ) ) != IVAS_ERR_OK ) +#else if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index f39951e087..eeecd4d8fa 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -243,7 +243,11 @@ ivas_error ivas_mct_dec( } /* Postprocessing for ACELP/MDCT core switching and synchronization */ +#ifdef FIX_ISM_DTX_CLICKS + if ( ( error = core_switching_post_dec( sts[n], synth[n], output[cpe_id * CPE_CHANNELS + n], hCPE->output_mem[1], st_ivas->ivas_format, 0, output_frame, 0 /*core_switching_flag*/, st_ivas->sba_dirac_stereo_flag, -1, hCPE->last_element_mode ) ) != IVAS_ERR_OK ) +#else if ( ( error = core_switching_post_dec( sts[n], synth[n], output[cpe_id * CPE_CHANNELS + n], hCPE->output_mem[1], 0, output_frame, 0 /*core_switching_flag*/, st_ivas->sba_dirac_stereo_flag, -1, hCPE->last_element_mode ) ) != IVAS_ERR_OK ) +#endif { return error; } -- GitLab From f03a62cfc3d54ffa62f2379e10761bc8c370c88b Mon Sep 17 00:00:00 2001 From: knj Date: Wed, 12 Apr 2023 08:50:08 +0200 Subject: [PATCH 371/375] apply clang-format patch from pipeline --- lib_com/prot.h | 10 +++++----- lib_dec/core_switching_dec.c | 10 +++++----- lib_dec/ivas_core_dec.c | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) mode change 100755 => 100644 lib_dec/ivas_core_dec.c diff --git a/lib_com/prot.h b/lib_com/prot.h index babd1ff9f7..51d1cb1e20 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -5856,12 +5856,12 @@ void core_switching_post_enc( ); ivas_error core_switching_post_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float *synth, /* i/o: output synthesis */ - float *output, /* i/o: LB synth/upsampled LB synth */ - float output_mem[], /* i : OLA memory from last TCX/HQ frame */ + Decoder_State *st, /* i/o: decoder state structure */ + float *synth, /* i/o: output synthesis */ + float *output, /* i/o: LB synth/upsampled LB synth */ + float output_mem[], /* i : OLA memory from last TCX/HQ frame */ #ifdef FIX_ISM_DTX_CLICKS - const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ #endif const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ const int16_t output_frame, /* i : frame length */ diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index a83e97c53c..fc331a2e9f 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -552,12 +552,12 @@ ivas_error core_switching_pre_dec( *---------------------------------------------------------------------*/ ivas_error core_switching_post_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float *synth, /* i/o: output synthesis */ - float *output, /* i/o: LB synth/upsampled LB synth */ - float output_mem[], /* i : OLA memory from last TCX/HQ frame */ + Decoder_State *st, /* i/o: decoder state structure */ + float *synth, /* i/o: output synthesis */ + float *output, /* i/o: LB synth/upsampled LB synth */ + float output_mem[], /* i : OLA memory from last TCX/HQ frame */ #ifdef FIX_ISM_DTX_CLICKS - const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ #endif const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ const int16_t output_frame, /* i : frame length */ diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c old mode 100755 new mode 100644 index bf13dee06f..05c1f41727 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -452,7 +452,7 @@ ivas_error ivas_core_dec( } #ifdef FIX_ISM_DTX_CLICKS - if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, ( st_ivas != NULL ) ? st_ivas->ivas_format : UNDEFINED_FORMAT, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE ) ) != IVAS_ERR_OK ) + if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, ( st_ivas != NULL ) ? st_ivas->ivas_format : UNDEFINED_FORMAT, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE ) ) != IVAS_ERR_OK ) #else if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE ) ) != IVAS_ERR_OK ) #endif -- GitLab From b1ab3124544707213d20ac021b128c6dcadaa99a Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 12 Apr 2023 11:46:50 +0000 Subject: [PATCH 372/375] Update ivas_modes.json: include ISM DTX test-cases --- scripts/config/ivas_modes.json | 131 +++++++++++++++++++++++++++++++-- 1 file changed, 125 insertions(+), 6 deletions(-) diff --git a/scripts/config/ivas_modes.json b/scripts/config/ivas_modes.json index a2adaa4ccf..0e4ef469d9 100644 --- a/scripts/config/ivas_modes.json +++ b/scripts/config/ivas_modes.json @@ -1968,6 +1968,68 @@ 256000 ] } + }, + "ISM2_b{bitrate}_dtx_{bandwidth}_cbr": { + "encmodeoption": [ + "-dtx", + "-ism", + "2" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "EXT": [] + }, + "in_config": "ISM2", + "table_name": "ISM2@{table_bitrate} kbps DTX {bandwidth}", + "nummetadata": 2, + "metadatafilenames": [ + "test_ISM_trajectory{mdi}.csv" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 16400, + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000 + ], + "swb": [ + 16400, + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000 + ], + "fb": [ + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000 + ] + } } }, "ISM3": { @@ -2058,14 +2120,41 @@ "bitrates": { "wb": [ 24400, - 32000 + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000 ], "swb": [ 24400, - 32000 + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000 ], "fb": [ - 32000 + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000 ] } } @@ -2161,14 +2250,44 @@ "bitrates": { "wb": [ 24400, - 32000 + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000, + 512000 ], "swb": [ 24400, - 32000 + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000, + 512000 ], "fb": [ - 32000 + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000, + 512000 ] } } -- GitLab From 046f164c9c133e0ec9c76864e42a003b303662f9 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Thu, 13 Apr 2023 11:49:51 +0200 Subject: [PATCH 373/375] remove obsolete MCT constant LFE_BITS --- lib_com/ivas_cnst.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 045946f479..0b326ba8a5 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1283,8 +1283,8 @@ typedef enum #define NBBITS_MCT_RATIO 4 #define BITRATE_MCT_RATIO_RANGE ( 1 << NBBITS_MCT_RATIO ) /* Range of the coded bitrate distribution ratio */ -#define LFE_BITS 180 #ifndef ISSUE_24_CLEANUP_MCT_LFE +#define LFE_BITS 180 #define MCT_LFE_MAX_LINE 24 #endif #define MCT_NUM_BLOCK_DATA_BITS 4 -- GitLab From a549631458682069a49e80d79c5a1d076fccadb5 Mon Sep 17 00:00:00 2001 From: knj Date: Tue, 18 Apr 2023 09:34:13 +0200 Subject: [PATCH 374/375] adjust timeouts and starting times for sanitizer test schedule A - ISM4 test exceeds timeout now that DTX modes have been added --- .gitlab-ci.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 082cf40cab..71ff18eb92 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -783,13 +783,13 @@ codec-comparison-on-main-push: .sanitizer-test-schedule-A: extends: - .sanitizer-test-template - timeout: 2 hours 30 minutes sanitizer-test-mono: extends: .sanitizer-test-schedule-A rules: - if: $SANITIZER_SCHEDULE_A + timeout: 2 hour script: - *update-ltv-repo - python3 ci/run_scheduled_sanitizer_test.py mono mono --tests $SANITIZER_TESTS @@ -799,7 +799,8 @@ sanitizer-test-stereo: rules: - if: $SANITIZER_SCHEDULE_A when: delayed - start_in: 2 hours 30 minutes + start_in: 2 hour + timeout: 2 hour script: - *update-ltv-repo - python3 ci/run_scheduled_sanitizer_test.py stereo $OUT_FORMATS_CHANNEL_BASED --tests $SANITIZER_TESTS @@ -809,7 +810,8 @@ sanitizer-test-stereodmxevs: rules: - if: $SANITIZER_SCHEDULE_A when: delayed - start_in: 5 hours + start_in: 4 hours + timeout: 2 hour script: - *update-ltv-repo - python3 ci/run_scheduled_sanitizer_test.py StereoDmxEVS mono --tests $SANITIZER_TESTS @@ -819,7 +821,8 @@ sanitizer-test-ism1: rules: - if: $SANITIZER_SCHEDULE_A when: delayed - start_in: 7 hours 30 minutes + start_in: 6 hours + timeout: 2 hours script: - *update-ltv-repo - python3 ci/run_scheduled_sanitizer_test.py ISM1 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS @@ -829,7 +832,8 @@ sanitizer-test-ism2: rules: - if: $SANITIZER_SCHEDULE_A when: delayed - start_in: 10 hours + start_in: 8 hours + timeout: 3 hours script: - *update-ltv-repo - python3 ci/run_scheduled_sanitizer_test.py ISM2 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS @@ -839,7 +843,8 @@ sanitizer-test-ism3: rules: - if: $SANITIZER_SCHEDULE_A when: delayed - start_in: 12 hours 30 minutes + start_in: 11 hours + timeout: 3 hour script: - *update-ltv-repo - python3 ci/run_scheduled_sanitizer_test.py ISM3 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS @@ -849,7 +854,8 @@ sanitizer-test-ism4: rules: - if: $SANITIZER_SCHEDULE_A when: delayed - start_in: 15 hours + start_in: 14 hours + timeout: 4 hours script: - *update-ltv-repo - python3 ci/run_scheduled_sanitizer_test.py ISM4 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS @@ -859,7 +865,8 @@ sanitizer-test-masa: rules: - if: $SANITIZER_SCHEDULE_A when: delayed - start_in: 17 hours 30 minutes + start_in: 18 hours + timeout: 3 hours script: - *update-ltv-repo - python3 ci/run_scheduled_sanitizer_test.py MASA $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS -- GitLab From 6e84dd1c22ac89b7b8adbcb4504a8a1e46b1a199 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 18 Apr 2023 15:49:04 +0200 Subject: [PATCH 375/375] comment --- lib_enc/ivas_masa_enc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index dd025797d2..5e81132ced 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -2315,11 +2315,12 @@ static void copy_masa_metadata( * Compare the similarity of MASA metadata in two sub-frames *-------------------------------------------------------------------*/ +/* r: similarity decision */ static uint8_t are_masa_subframes_similar( const MASA_METADATA_HANDLE frame1, /* i : MASA metadata frame 1 */ const uint8_t sf1_idx, /* i : index of the subframe of frame1 to inspect */ const MASA_METADATA_HANDLE frame2, /* i : MASA metadata frame 2 */ - const uint8_t sf2_idx /* o : index of the subframe of frame2 to inspect */ + const uint8_t sf2_idx /* i : index of the subframe of frame2 to inspect */ ) { uint8_t num_dir; -- GitLab