diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 07715a9ef4f78d1208634252d6911616b86c6ed4..67c03e7ecd6105b5f675565e8ac6c3d326ab8ca3 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -211,6 +211,11 @@ typedef struct _IVAS_JBM_TRACE_DATA #define ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) ISAR_MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) #define ISAR_SPLIT_REND_ADDITIONAL_BYTES_TO_READ 1 #define SPLIT_REND_BITS_BUFF_SIZE ( ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES + ISAR_SPLIT_REND_ADDITIONAL_BYTES_TO_READ ) +#ifdef NONBE_SPLIT_DYN_OFFSET +#define SPLIT_REND_MAX_YAW_ONLY_POSES 2 +#define SPLIT_REND_MAX_PITCH_ONLY_POSES 2 +#define SPLIT_REND_MAX_ROLL_ONLY_POSES 2 +#endif typedef enum { @@ -288,6 +293,11 @@ typedef struct _ISAR_SPLIT_REND_CONFIG #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int16_t lc3plus_highres; #endif +#ifdef NONBE_SPLIT_DYN_OFFSET + float pose_offsets_yaw[SPLIT_REND_MAX_YAW_ONLY_POSES]; /* Prerendering pose offsets for yaw, should be set dynamically via backlink */ + float pose_offsets_pitch[SPLIT_REND_MAX_PITCH_ONLY_POSES]; /* Prerendering pose offsets for pitch, should be set dynamically via backlink */ + float pose_offsets_roll[SPLIT_REND_MAX_ROLL_ONLY_POSES]; /* Prerendering pose offsets for roll, should be set dynamically via backlink */ +#endif } ISAR_SPLIT_REND_CONFIG_DATA, *ISAR_SPLIT_REND_CONFIG_HANDLE; #endif diff --git a/lib_com/options.h b/lib_com/options.h index cc4e5d249b9188fd56609891bbb43f8a8520d552..f09418bc3823ee0f0e025fff5de91c320d1e3573 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,6 +174,7 @@ #define NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT /* fix 1070 USAN: nullptr-with-offset and Segfaults in 7_1_4 to BINAURAL and BINAURAL_ROOM_REVERB decoding with bitrate switching and head rotation*/ #define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */ #define NONBE_FIX_1052_SBA_EXT /* Dlb: SBA external output support */ +#define NONBE_SPLIT_DYN_OFFSET /* FhG: Enable dynamic pose offsets for Split pre-rendering, configurable via renderer config */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 9f59528a0c12306f1137782b232e6f9ce55042ea..7640b5d173246787532bed0b3ef6def3c867b2dd 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2149,6 +2149,12 @@ static ivas_error copyRendererConfigStruct( #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS hRCout->split_rend_config.lc3plus_highres = hRCin->split_rend_config.lc3plus_highres; #endif +#endif +#ifdef NONBE_SPLIT_DYN_OFFSET + /* values will be set later either from config or from defaults */ + set_f( hRCout->split_rend_config.pose_offsets_yaw, SPLIT_REND_POSE_OFFSET_DEFAULT, SPLIT_REND_MAX_YAW_ONLY_POSES ); + set_f( hRCout->split_rend_config.pose_offsets_pitch, SPLIT_REND_POSE_OFFSET_DEFAULT, SPLIT_REND_MAX_PITCH_ONLY_POSES ); + set_f( hRCout->split_rend_config.pose_offsets_roll, SPLIT_REND_POSE_OFFSET_DEFAULT, SPLIT_REND_MAX_ROLL_ONLY_POSES ); #endif hRCout->roomAcoustics.use_er = hRCin->roomAcoustics.use_er; hRCout->roomAcoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity; diff --git a/lib_isar/isar_cnst.h b/lib_isar/isar_cnst.h index d93f9ae39f7b0f2fac02a21309086c42eb6273d6..1fe110068a068df91279e6df97d981fb25ff52de 100644 --- a/lib_isar/isar_cnst.h +++ b/lib_isar/isar_cnst.h @@ -65,9 +65,16 @@ typedef enum #define CLDFB_PLC_XF 2 /* Length of cross-fade into first good frame after frame loss in CLDFB cols. */ +#ifdef NONBE_SPLIT_DYN_OFFSET +#define SPLIT_REND_POSE_OFFSET_DEFAULT -360.f +#define SPLIT_REND_POSE_OFFSET_THRES_ABS_YAW 180.f +#define SPLIT_REND_POSE_OFFSET_THRES_ABS_PITCH 90.f +#define SPLIT_REND_POSE_OFFSET_THRES_ABS_ROLL 180.f +#else #define SPLIT_REND_MAX_YAW_ONLY_POSES 2 #define SPLIT_REND_MAX_PITCH_ONLY_POSES 2 #define SPLIT_REND_MAX_ROLL_ONLY_POSES 2 +#endif #define SPLIT_REND_MAX_ONE_AXIS_MD_POSES 2 #define MAX_EXTRAPOLATION_ANGLE 15.0f /* this means additional 15 degrees can be extrapolated on top of MD probing poses*/ diff --git a/lib_isar/isar_prot.h b/lib_isar/isar_prot.h index ffc42b2283fbfb342e21a89da0524b475d1a7c87..c32868d40d8879ee76b6588c20f6db4906b0be4a 100644 --- a/lib_isar/isar_prot.h +++ b/lib_isar/isar_prot.h @@ -283,6 +283,16 @@ ivas_error isar_renderMultiTDBinToSplitBinaural( void isar_init_multi_bin_pose_data( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData ); +#ifdef NONBE_SPLIT_DYN_OFFSET +void isar_renderSplitGetNumPoses( + const ISAR_SPLIT_REND_ROT_AXIS rot_axis, + const int16_t dof, + const int16_t hq_mode, + int16_t *num_yaw_poses, + int16_t *num_pitch_poses, + int16_t *num_roll_poses ); + +#endif void isar_renderSplitGetMultiBinPoseData( const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, diff --git a/lib_isar/isar_rom_post_rend.c b/lib_isar/isar_rom_post_rend.c index f73a2526b8e4bab4ed39989245df003253fe7e7c..8541b212f5c1a65918d44116e916193338b5e8fa 100644 --- a/lib_isar/isar_rom_post_rend.c +++ b/lib_isar/isar_rom_post_rend.c @@ -35,6 +35,9 @@ #ifdef DEBUGGING #include "debug.h" #endif +#ifdef NONBE_SPLIT_DYN_OFFSET +#include "common_api_types.h" +#endif #include "isar_cnst.h" #include "wmc_auto.h" @@ -50,12 +53,16 @@ const float isar_split_rend_relative_yaw_pos_angles[SPLIT_REND_MAX_YAW_ONLY_POSES] = {-15.0f, 15.0f}; const float isar_split_rend_relative_pitch_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {10.0f, 10.0f}; const float isar_split_rend_relative_roll_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {10.0f, 10.0f}; +#ifndef NONBE_SPLIT_DYN_OFFSET const float isar_split_rend_relative_one_axis_pos_angles[SPLIT_REND_MAX_ONE_AXIS_MD_POSES] = {-15.0f, 15.0f}; +#endif const float isar_split_rend_relative_yaw_pos_angles_hq[SPLIT_REND_MAX_YAW_ONLY_POSES] = {-15.0f, 15.0f}; const float isar_split_rend_relative_pitch_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {-15.0f, 15.0f}; const float isar_split_rend_relative_roll_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {-15.0f, 15.0f}; +#ifndef NONBE_SPLIT_DYN_OFFSET const float isar_split_rend_relative_one_axis_pos_angles_hq[SPLIT_REND_MAX_ONE_AXIS_MD_POSES] = {-15.0f, 15.0f}; +#endif const int16_t isar_split_rend_band_grouping[MAX_SPLIT_REND_MD_BANDS + 1] = { diff --git a/lib_isar/isar_rom_post_rend.h b/lib_isar/isar_rom_post_rend.h index 043ba5b2138a9b24af9ade5e5572a11dae30a946..e9aea3930476abb1b2e8800663a8e93ca39c26e3 100644 --- a/lib_isar/isar_rom_post_rend.h +++ b/lib_isar/isar_rom_post_rend.h @@ -38,6 +38,9 @@ #ifdef DEBUGGING #include "debug.h" #endif +#ifdef NONBE_SPLIT_DYN_OFFSET +#include "common_api_types.h" +#endif #include "isar_cnst.h" @@ -49,8 +52,10 @@ extern const float isar_split_rend_relative_yaw_pos_angles[SPLIT_REND_MAX_YAW_ONLY_POSES]; extern const float isar_split_rend_relative_pitch_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES]; extern const float isar_split_rend_relative_roll_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES]; +#ifndef NONBE_SPLIT_DYN_OFFSET /* never used? @tyagiri could confirm? */ extern const float isar_split_rend_relative_one_axis_pos_angles[SPLIT_REND_MAX_ONE_AXIS_MD_POSES]; extern const float isar_split_rend_relative_one_axis_pos_angles_hq[SPLIT_REND_MAX_ONE_AXIS_MD_POSES]; +#endif extern const float isar_split_rend_relative_yaw_pos_angles_hq[SPLIT_REND_MAX_YAW_ONLY_POSES]; extern const float isar_split_rend_relative_pitch_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES]; diff --git a/lib_isar/isar_splitRendererPost.c b/lib_isar/isar_splitRendererPost.c index 6ea2d2539f450e4fefa0aef920ecc18c29abbf43..f47b41e9f4bbe3f36b2af8192ed6b6d6880c045c 100644 --- a/lib_isar/isar_splitRendererPost.c +++ b/lib_isar/isar_splitRendererPost.c @@ -728,6 +728,9 @@ void isar_splitBinPostRendMdDec( #endif ) { +#ifdef NONBE_SPLIT_DYN_OFFSET + int16_t angle, num_yaw_poses, num_pitch_poses, num_roll_poses; +#endif int16_t pos_idx, b, sf_idx, num_subframes, ch1; int16_t pred_real_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS], pred_real_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS]; int16_t pred_imag_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS], pred_imag_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS]; @@ -755,6 +758,11 @@ void isar_splitBinPostRendMdDec( split_rend_config.dof = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_DOF_BITS ); split_rend_config.hq_mode = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_HQ_MODE_BITS ); +#ifdef NONBE_SPLIT_DYN_OFFSET + set_f( split_rend_config.pose_offsets_yaw, SPLIT_REND_POSE_OFFSET_DEFAULT, 2 ); + set_f( split_rend_config.pose_offsets_pitch, SPLIT_REND_POSE_OFFSET_DEFAULT, 2 ); + set_f( split_rend_config.pose_offsets_roll, SPLIT_REND_POSE_OFFSET_DEFAULT, 2 ); +#endif #ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS num_bits = isar_renderSplitGetRot_axisNumBits( split_rend_config.dof ); @@ -780,7 +788,9 @@ void isar_splitBinPostRendMdDec( num_subframes = ( hBinHrSplitPostRend->low_Res == 0 ) ? MAX_PARAM_SPATIAL_SUBFRAMES : 1; for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) { +#ifndef NONBE_SPLIT_DYN_OFFSET int16_t angle; +#endif hBinHrSplitPostRend->QuaternionsPre[sf_idx].w = -3.0f; @@ -796,6 +806,38 @@ void isar_splitBinPostRendMdDec( angle -= 180; hBinHrSplitPostRend->QuaternionsPre[sf_idx].z = (float) angle; } +#ifdef NONBE_SPLIT_DYN_OFFSET + + /* read relative poses */ + isar_renderSplitGetNumPoses( + rot_axis, + split_rend_config.dof, + split_rend_config.hq_mode, + &num_yaw_poses, + &num_pitch_poses, + &num_roll_poses ); + + for ( pos_idx = 0; pos_idx < num_yaw_poses; pos_idx++ ) + { + angle = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_HEAD_POSE_BITS ); + angle -= 180; + pMultiBinPoseData->relative_head_poses[pos_idx + 1][0] = angle; + } + + for ( pos_idx = 0; pos_idx < num_pitch_poses; pos_idx++ ) + { + angle = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_HEAD_POSE_BITS ); + angle -= 180; + pMultiBinPoseData->relative_head_poses[pos_idx + num_yaw_poses + 1][1] = angle; + } + + for ( pos_idx = 0; pos_idx < num_roll_poses; pos_idx++ ) + { + angle = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_HEAD_POSE_BITS ); + angle -= 180; + pMultiBinPoseData->relative_head_poses[pos_idx + num_yaw_poses + num_pitch_poses + 1][2] = angle; + } +#endif #ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS isar_split_rend_get_quant_params( diff --git a/lib_isar/isar_splitRendererPre.c b/lib_isar/isar_splitRendererPre.c index ef1072f5c9e3a736c8f70eb973fce9396b47e63b..59f835b5b0319e1a5d13bc264aa82220c304b82b 100644 --- a/lib_isar/isar_splitRendererPre.c +++ b/lib_isar/isar_splitRendererPre.c @@ -1277,6 +1277,9 @@ static void isar_SplitRenderer_quant_code( #endif const int32_t target_md_bits ) { +#ifdef NONBE_SPLIT_DYN_OFFSET + int16_t angle, num_yaw_poses, num_pitch_poses, num_roll_poses; +#endif #ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS int16_t q, num_subframes, sf_idx, pos_idx, b, num_quant_strats; #else @@ -1322,7 +1325,9 @@ static void isar_SplitRenderer_quant_code( /* code ref pose*/ for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) { +#ifndef NONBE_SPLIT_DYN_OFFSET int16_t angle; +#endif IVAS_QUATERNION head_pos_euler; Quat2EulerDegree( headPosition, &head_pos_euler.z, &head_pos_euler.y, &head_pos_euler.x ); @@ -1339,6 +1344,38 @@ static void isar_SplitRenderer_quant_code( ISAR_SPLIT_REND_BITStream_write_int32( pBits, angle, ISAR_SPLIT_REND_HEAD_POSE_BITS ); } +#ifdef NONBE_SPLIT_DYN_OFFSET + + /* write relative poses */ + isar_renderSplitGetNumPoses( + pMultiBinPoseData->rot_axis, + pMultiBinPoseData->dof, + pMultiBinPoseData->hq_mode, + &num_yaw_poses, + &num_pitch_poses, + &num_roll_poses ); + + for ( pos_idx = 0; pos_idx < num_yaw_poses; pos_idx++ ) + { + angle = (int16_t) roundf( pMultiBinPoseData->relative_head_poses[pos_idx + 1][0] ); + angle += 180; + ISAR_SPLIT_REND_BITStream_write_int32( pBits, angle, ISAR_SPLIT_REND_HEAD_POSE_BITS ); + } + + for ( pos_idx = 0; pos_idx < num_pitch_poses; pos_idx++ ) + { + angle = (int16_t) roundf( pMultiBinPoseData->relative_head_poses[pos_idx + num_yaw_poses + 1][1] ); + angle += 180; + ISAR_SPLIT_REND_BITStream_write_int32( pBits, angle, ISAR_SPLIT_REND_HEAD_POSE_BITS ); + } + + for ( pos_idx = 0; pos_idx < num_roll_poses; pos_idx++ ) + { + angle = (int16_t) roundf( pMultiBinPoseData->relative_head_poses[pos_idx + num_yaw_poses + num_pitch_poses + 1][2] ); + angle += 180; + ISAR_SPLIT_REND_BITStream_write_int32( pBits, angle, ISAR_SPLIT_REND_HEAD_POSE_BITS ); + } +#endif #ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS isar_split_rend_get_quant_params( MAX_SPLIT_REND_MD_BANDS, pred_real_bands_yaw, pred_imag_bands_yaw, diff --git a/lib_isar/isar_splitRenderer_utils.c b/lib_isar/isar_splitRenderer_utils.c index f6933796dfcfb1d0a657ec819dbe0193912dff35..e4b0e41accadf376920b813ba5982affff2ff4ec 100644 --- a/lib_isar/isar_splitRenderer_utils.c +++ b/lib_isar/isar_splitRenderer_utils.c @@ -699,6 +699,10 @@ ivas_error isar_split_rend_validate_config( const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int16_t is_pcm_out ) { +#ifdef NONBE_SPLIT_DYN_OFFSET + int16_t i; + +#endif /* Valid DOF range is 0-3 */ if ( pSplitRendConfig->dof < 0 || pSplitRendConfig->dof > 3 ) { @@ -813,6 +817,34 @@ ivas_error isar_split_rend_validate_config( #endif } } +#ifdef NONBE_SPLIT_DYN_OFFSET + + /* Pose offsets */ + for ( i = 0; i < SPLIT_REND_MAX_YAW_ONLY_POSES; i++ ) + { + if ( ( pSplitRendConfig->pose_offsets_yaw[i] != SPLIT_REND_POSE_OFFSET_DEFAULT ) && + ( fabsf( pSplitRendConfig->pose_offsets_yaw[i] ) > SPLIT_REND_POSE_OFFSET_THRES_ABS_YAW ) ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Valid pose offset range for yaw exceeded" ); + } + } + for ( i = 0; i < SPLIT_REND_MAX_PITCH_ONLY_POSES; i++ ) + { + if ( ( pSplitRendConfig->pose_offsets_pitch[i] != SPLIT_REND_POSE_OFFSET_DEFAULT ) && + ( fabsf( pSplitRendConfig->pose_offsets_pitch[i] ) > SPLIT_REND_POSE_OFFSET_THRES_ABS_PITCH ) ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Valid pose offset range for pitch exceeded" ); + } + } + for ( i = 0; i < SPLIT_REND_MAX_ROLL_ONLY_POSES; i++ ) + { + if ( ( pSplitRendConfig->pose_offsets_roll[i] != SPLIT_REND_POSE_OFFSET_DEFAULT ) && + ( fabsf( pSplitRendConfig->pose_offsets_roll[i] ) > SPLIT_REND_POSE_OFFSET_THRES_ABS_ROLL ) ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Valid pose offset range for roll exceeded" ); + } + } +#endif return IVAS_ERR_OK; } @@ -919,7 +951,8 @@ void isar_split_rend_get_quant_params( * *------------------------------------------------------------------------*/ -int16_t isar_renderSplitGetRot_axisNumBits( +int16_t +isar_renderSplitGetRot_axisNumBits( const int16_t dof ) { int16_t num_bits; @@ -1004,6 +1037,103 @@ int16_t isar_renderSplitGetCodeFromRot_axis( return code; } +#endif +#ifdef NONBE_SPLIT_DYN_OFFSET + +/*------------------------------------------------------------------------- + * Function isar_renderSplitGetNumPoses() + * + * + *------------------------------------------------------------------------*/ + +void isar_renderSplitGetNumPoses( + const ISAR_SPLIT_REND_ROT_AXIS rot_axis, + const int16_t dof, + const int16_t hq_mode, + int16_t *num_yaw_poses, + int16_t *num_pitch_poses, + int16_t *num_roll_poses ) +{ + /* 0 DOF defaults */ + *num_yaw_poses = 0; + *num_pitch_poses = 0; + *num_roll_poses = 0; + + if ( dof == 1 ) + { + switch ( rot_axis ) + { + case DEFAULT_AXIS: + case YAW: + { + *num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES; + break; + } + case PITCH: + { + *num_pitch_poses = SPLIT_REND_MAX_PITCH_ONLY_POSES; + break; + } + case ROLL: + { + *num_roll_poses = SPLIT_REND_MAX_ROLL_ONLY_POSES; + break; + } + default: + { + assert( 0 && "unsupported rotation axis value" ); + } + } + } + else if ( dof == 2 ) + { + switch ( rot_axis ) + { + case DEFAULT_AXIS: + case YAW: + case PITCH: + case YAW_PITCH: + { + *num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES; + *num_pitch_poses = SPLIT_REND_MAX_PITCH_ONLY_POSES; + break; + } + case ROLL: + case YAW_ROLL: + { + *num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES; + *num_roll_poses = SPLIT_REND_MAX_ROLL_ONLY_POSES; + break; + } + case PITCH_ROLL: + { + *num_pitch_poses = SPLIT_REND_MAX_PITCH_ONLY_POSES; + *num_roll_poses = SPLIT_REND_MAX_ROLL_ONLY_POSES; + break; + } + default: + { + assert( 0 && "unsupported rotation axis value" ); + } + } + } + else if ( dof == 3 ) + { + if ( hq_mode == 1 ) + { + *num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES; + *num_pitch_poses = SPLIT_REND_MAX_PITCH_ONLY_POSES; + *num_roll_poses = SPLIT_REND_MAX_ROLL_ONLY_POSES; + } + else + { + *num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES; + *num_pitch_poses = 1; + *num_roll_poses = 1; + } + } +} + #endif /*------------------------------------------------------------------------- @@ -1017,10 +1147,19 @@ void isar_renderSplitGetMultiBinPoseData( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const ISAR_SPLIT_REND_ROT_AXIS rot_axis ) { +#ifdef NONBE_SPLIT_DYN_OFFSET + int16_t i; +#endif int16_t pos_idx, num_yaw_poses, num_pitch_poses, num_roll_poses; +#ifdef NONBE_SPLIT_DYN_OFFSET + float relative_yaw_angles[2]; + float relative_pitch_angles[2]; + float relative_roll_angles[2]; +#else const float *relative_yaw_angles; const float *relative_pitch_angles; const float *relative_roll_angles; +#endif for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) { @@ -1029,11 +1168,86 @@ void isar_renderSplitGetMultiBinPoseData( pMultiBinPoseData->relative_head_poses[pos_idx][2] = 0.0f; } +#ifndef NONBE_SPLIT_DYN_OFFSET /* 0 DOF defaults */ num_yaw_poses = 0; num_pitch_poses = 0; num_roll_poses = 0; +#endif + +#ifdef NONBE_SPLIT_DYN_OFFSET + /* set values from configuration, or fallback to default (HQ values except for 3DOF non HQmode) */ + /* yaw */ + for ( i = 0; i < SPLIT_REND_MAX_YAW_ONLY_POSES; i++ ) + { + if ( pSplit_rend_config->pose_offsets_yaw[i] == SPLIT_REND_POSE_OFFSET_DEFAULT ) + { + if ( pSplit_rend_config->dof == 3 && pSplit_rend_config->hq_mode != 1 ) + { + relative_yaw_angles[i] = isar_split_rend_relative_yaw_pos_angles[i]; + } + else + { + relative_yaw_angles[i] = isar_split_rend_relative_yaw_pos_angles_hq[i]; + } + } + else + { + relative_yaw_angles[i] = pSplit_rend_config->pose_offsets_yaw[i]; + } + } + + /* pitch */ + for ( i = 0; i < SPLIT_REND_MAX_PITCH_ONLY_POSES; i++ ) + { + if ( pSplit_rend_config->pose_offsets_pitch[i] == SPLIT_REND_POSE_OFFSET_DEFAULT ) + { + if ( pSplit_rend_config->dof == 3 && pSplit_rend_config->hq_mode != 1 ) + { + relative_pitch_angles[i] = isar_split_rend_relative_pitch_pos_angles[i]; + } + else + { + relative_pitch_angles[i] = isar_split_rend_relative_pitch_pos_angles_hq[i]; + } + } + else + { + relative_pitch_angles[i] = pSplit_rend_config->pose_offsets_pitch[i]; + } + } + + /* roll */ + for ( i = 0; i < SPLIT_REND_MAX_ROLL_ONLY_POSES; i++ ) + { + if ( pSplit_rend_config->pose_offsets_roll[i] == SPLIT_REND_POSE_OFFSET_DEFAULT ) + { + if ( pSplit_rend_config->dof == 3 && pSplit_rend_config->hq_mode != 1 ) + { + relative_roll_angles[i] = isar_split_rend_relative_roll_pos_angles[i]; + } + else + { + relative_roll_angles[i] = isar_split_rend_relative_roll_pos_angles_hq[i]; + } + } + else + { + relative_roll_angles[i] = pSplit_rend_config->pose_offsets_roll[i]; + } + } + + /* get num poses for all axes */ + isar_renderSplitGetNumPoses( + rot_axis, + pSplit_rend_config->dof, + pSplit_rend_config->hq_mode, + &num_yaw_poses, + &num_pitch_poses, + &num_roll_poses ); + +#else /* defaults for all DOF except 3DOF HQ */ relative_yaw_angles = isar_split_rend_relative_yaw_pos_angles_hq; relative_pitch_angles = isar_split_rend_relative_pitch_pos_angles_hq; @@ -1122,6 +1336,7 @@ void isar_renderSplitGetMultiBinPoseData( num_roll_poses = 1; } } +#endif pMultiBinPoseData->num_poses = num_yaw_poses + num_pitch_poses + num_roll_poses + 1; assert( pMultiBinPoseData->num_poses <= MAX_HEAD_ROT_POSES ); diff --git a/lib_isar/lib_isar_post_rend.c b/lib_isar/lib_isar_post_rend.c index 12fc8e6e43991f911abf3582958b5e24fa9c78f5..c821bbc85b14aacffd94c295807d146c9f8df56a 100644 --- a/lib_isar/lib_isar_post_rend.c +++ b/lib_isar/lib_isar_post_rend.c @@ -1227,6 +1227,12 @@ int16_t ISAR_POST_REND_GetRenderConfig( splitRenderConfig->codec = ISAR_SPLIT_REND_CODEC_DEFAULT; splitRenderConfig->poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; splitRenderConfig->rendererSelection = hRCin.rendererSelection; +#ifdef NONBE_SPLIT_DYN_OFFSET + /* values will be set later either from config or from defaults */ + set_f( splitRenderConfig->pose_offsets_yaw, SPLIT_REND_POSE_OFFSET_DEFAULT, SPLIT_REND_MAX_YAW_ONLY_POSES ); + set_f( splitRenderConfig->pose_offsets_pitch, SPLIT_REND_POSE_OFFSET_DEFAULT, SPLIT_REND_MAX_PITCH_ONLY_POSES ); + set_f( splitRenderConfig->pose_offsets_roll, SPLIT_REND_POSE_OFFSET_DEFAULT, SPLIT_REND_MAX_ROLL_ONLY_POSES ); +#endif return IVAS_ERR_OK; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 1ade3c85f43d471ce4a6d5820a588983a94bc7b5..ad19b929257406460a55b7860ee0dc2038db4af9 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4388,6 +4388,12 @@ int16_t IVAS_REND_GetRenderConfig( #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS hRCout->split_rend_config.lc3plus_highres = 0; #endif +#ifdef NONBE_SPLIT_DYN_OFFSET + /* values will be set later either from config or from defaults */ + set_f( hRCout->split_rend_config.pose_offsets_yaw, SPLIT_REND_POSE_OFFSET_DEFAULT, SPLIT_REND_MAX_YAW_ONLY_POSES ); + set_f( hRCout->split_rend_config.pose_offsets_pitch, SPLIT_REND_POSE_OFFSET_DEFAULT, SPLIT_REND_MAX_PITCH_ONLY_POSES ); + set_f( hRCout->split_rend_config.pose_offsets_roll, SPLIT_REND_POSE_OFFSET_DEFAULT, SPLIT_REND_MAX_ROLL_ONLY_POSES ); +#endif #endif hRCout->roomAcoustics.use_er = hRCin->roomAcoustics.use_er; diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index ef398017ff1ec818c86d7d68875af78f2ec61aeb..5a963e32f3e7aef5849a82387c24c9af48af7540 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -2687,6 +2687,32 @@ ivas_error RenderConfigReader_read( errorHandler( pValue, ERROR_VALUE_INVALID ); } } +#ifdef NONBE_SPLIT_DYN_OFFSET + else if ( strcmp( item, "POSE_OFFSETS_YAW" ) == 0 ) + { + if ( read_txt_vector( pValue, SPLIT_REND_MAX_YAW_ONLY_POSES, hRenderConfig->split_rend_config.pose_offsets_yaw ) ) + { + errorHandler( item, ERROR_VALUE_INVALID ); + return IVAS_ERR_INVALID_RENDER_CONFIG; + } + } + else if ( strcmp( item, "POSE_OFFSETS_PITCH" ) == 0 ) + { + if ( read_txt_vector( pValue, SPLIT_REND_MAX_PITCH_ONLY_POSES, hRenderConfig->split_rend_config.pose_offsets_pitch ) ) + { + errorHandler( item, ERROR_VALUE_INVALID ); + return IVAS_ERR_INVALID_RENDER_CONFIG; + } + } + else if ( strcmp( item, "POSE_OFFSETS_ROLL" ) == 0 ) + { + if ( read_txt_vector( pValue, SPLIT_REND_MAX_ROLL_ONLY_POSES, hRenderConfig->split_rend_config.pose_offsets_roll ) ) + { + errorHandler( item, ERROR_VALUE_INVALID ); + return IVAS_ERR_INVALID_RENDER_CONFIG; + } + } +#endif #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS else if ( strcmp( item, "LC3PLUS_HIGHRES" ) == 0 ) {