Loading lib_com/ivas_tools.c +90 −0 Original line number Diff line number Diff line Loading @@ -1016,7 +1016,96 @@ void lls_interp_n( * elevation = [-90, 90] * Considers direction changes from large elevation values *-------------------------------------------------------------------*/ #ifdef FIX_ANGLE_WRAPPING void panning_wrap_angles( const float azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ const float ele_deg, /* i : elevation in degrees for panning direction (positive up) */ float *azi_wrapped, /* o : wrapped azimuth component */ float *ele_wrapped /* o : wrapped elevation component */ ) { float azi, ele; azi = azi_deg; ele = ele_deg; if ( ele <= 90 && ele >= -90 ) { *ele_wrapped = ele; if ( azi > 180.0f || azi <= -180.0f ) { /* Wrap azimuth value */ if ( fabsf( azi ) > 180 ) { azi = fmodf( azi + 180, 360 ); azi -= 180; } /* Set -180 to 180 for deduplication purposes; angles are otherwise identical */ if ( azi == -180 ) { azi = 180; } } *azi_wrapped = azi; return; } else { /* Special case when elevation is a multiple of 90; azimuth is irrelevant */ if ( ( ele != 0 ) && ( fmodf( ele, 90 ) == 0 ) && ( fmodf( ele, 180 ) != 0 ) ) { azi = 0; while ( ele > 90 ) { ele -= 360; } while ( ele < 90 ) { ele += 360; } } else { /* Wrap elevation and adjust azimuth accordingly */ while ( fabsf( ele ) > 90 ) { /* Flip to other hemisphere */ azi += 180; /* Compensate elevation accordingly */ if ( ele > 90 ) { ele = 180 - ele; } else if ( ele < -90 ) { ele = -180 - ele; } } /* Wrap azimuth value */ if ( fabsf( azi ) > 180 ) { azi = fmodf( azi + 180, 360 ); azi -= 180; } } /* Set -180 to 180 for deduplication purposes; angles are otherwise identical */ if ( azi == -180 ) { azi = 180; } } *azi_wrapped = azi; *ele_wrapped = ele; return; } #else void panning_wrap_angles( const float azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ const float ele_deg, /* i : elevation in degrees for panning direction (positive up) */ Loading Loading @@ -1080,6 +1169,7 @@ void panning_wrap_angles( return; } #endif /*-------------------------------------------------------------------------* * v_sort_ind() Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,7 @@ #define IMPROVE_CMDLINE_ROBUSTNESS /* Issue 233: Improve robustness of command-line parameters */ #define FIX_ITD_CNG /* Eri: Fix for CNG ITD */ #define FIX_ANGLE_WRAPPING /* Issue 244: Problems with angle wrapping*/ /* ################## End DEVELOPMENT switches ######################### */ Loading Loading
lib_com/ivas_tools.c +90 −0 Original line number Diff line number Diff line Loading @@ -1016,7 +1016,96 @@ void lls_interp_n( * elevation = [-90, 90] * Considers direction changes from large elevation values *-------------------------------------------------------------------*/ #ifdef FIX_ANGLE_WRAPPING void panning_wrap_angles( const float azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ const float ele_deg, /* i : elevation in degrees for panning direction (positive up) */ float *azi_wrapped, /* o : wrapped azimuth component */ float *ele_wrapped /* o : wrapped elevation component */ ) { float azi, ele; azi = azi_deg; ele = ele_deg; if ( ele <= 90 && ele >= -90 ) { *ele_wrapped = ele; if ( azi > 180.0f || azi <= -180.0f ) { /* Wrap azimuth value */ if ( fabsf( azi ) > 180 ) { azi = fmodf( azi + 180, 360 ); azi -= 180; } /* Set -180 to 180 for deduplication purposes; angles are otherwise identical */ if ( azi == -180 ) { azi = 180; } } *azi_wrapped = azi; return; } else { /* Special case when elevation is a multiple of 90; azimuth is irrelevant */ if ( ( ele != 0 ) && ( fmodf( ele, 90 ) == 0 ) && ( fmodf( ele, 180 ) != 0 ) ) { azi = 0; while ( ele > 90 ) { ele -= 360; } while ( ele < 90 ) { ele += 360; } } else { /* Wrap elevation and adjust azimuth accordingly */ while ( fabsf( ele ) > 90 ) { /* Flip to other hemisphere */ azi += 180; /* Compensate elevation accordingly */ if ( ele > 90 ) { ele = 180 - ele; } else if ( ele < -90 ) { ele = -180 - ele; } } /* Wrap azimuth value */ if ( fabsf( azi ) > 180 ) { azi = fmodf( azi + 180, 360 ); azi -= 180; } } /* Set -180 to 180 for deduplication purposes; angles are otherwise identical */ if ( azi == -180 ) { azi = 180; } } *azi_wrapped = azi; *ele_wrapped = ele; return; } #else void panning_wrap_angles( const float azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ const float ele_deg, /* i : elevation in degrees for panning direction (positive up) */ Loading Loading @@ -1080,6 +1169,7 @@ void panning_wrap_angles( return; } #endif /*-------------------------------------------------------------------------* * v_sort_ind() Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,7 @@ #define IMPROVE_CMDLINE_ROBUSTNESS /* Issue 233: Improve robustness of command-line parameters */ #define FIX_ITD_CNG /* Eri: Fix for CNG ITD */ #define FIX_ANGLE_WRAPPING /* Issue 244: Problems with angle wrapping*/ /* ################## End DEVELOPMENT switches ######################### */ Loading