From f6bdf5e20f57a4797a82ceaa00e4291386edd55d Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 7 May 2024 10:12:25 +0200 Subject: [PATCH 1/3] add dynamic pose offsets via renderer config --- lib_com/common_api_types.h | 10 ++ lib_com/options.h | 1 + lib_isar/isar_cnst.h | 7 + lib_isar/isar_prot.h | 10 ++ lib_isar/isar_rom_post_rend.c | 7 + lib_isar/isar_rom_post_rend.h | 5 + lib_isar/isar_splitRendererPost.c | 37 +++++ lib_isar/isar_splitRendererPre.c | 37 +++++ lib_isar/isar_splitRenderer_utils.c | 212 ++++++++++++++++++++++++++++ lib_isar/lib_isar_post_rend.c | 6 + lib_rend/lib_rend.c | 6 + lib_util/render_config_reader.c | 26 ++++ 12 files changed, 364 insertions(+) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 1d4cde9680..2aef4e5e3c 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 { @@ -275,6 +280,11 @@ typedef struct _ISAR_SPLIT_REND_CONFIG */ int16_t codec_delay_ms; /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/ int16_t codec_frame_size_ms; /*Codec frame size in milliseconds, only relevant with LC3plus */ +#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_POSE_CORRECTION_MODE poseCorrectionMode; ISAR_SPLIT_REND_CODEC codec; ISAR_SPLIT_REND_RENDERER_SELECTION rendererSelection; diff --git a/lib_com/options.h b/lib_com/options.h index 0ccc660258..d3cae2bcdd 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,6 +174,7 @@ #define NONBE_FIX_1028_1DB_TCX_LEVEL_DROP /* VA: Harmonize the logic setting LP weighting factor between TCX encoder and TCX decoder */ #define NONBE_FIX_SBA_SIGNALING_BITS_B /* FhG: issue 1061: option B: signal sba order additionally in OSBA */ +#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_isar/isar_cnst.h b/lib_isar/isar_cnst.h index c9391e37bb..d37dfe39a4 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 3ff35ff73e..164c91827c 100644 --- a/lib_isar/isar_prot.h +++ b/lib_isar/isar_prot.h @@ -264,6 +264,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 f73a2526b8..8541b212f5 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 043ba5b213..e9aea39304 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 495caee233..18e280cfdd 100644 --- a/lib_isar/isar_splitRendererPost.c +++ b/lib_isar/isar_splitRendererPost.c @@ -564,6 +564,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]; @@ -594,7 +597,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; @@ -610,6 +615,38 @@ void isar_splitBinPostRendMdDec( angle -= 180; hBinHrSplitPostRend->QuaternionsPre[sf_idx].z = (float) angle; } +#ifdef NONBE_SPLIT_DYN_OFFSET + + /* read 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) 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) roundf( pMultiBinPoseData->relative_head_poses[pos_idx + num_yaw_poses + 1][1] ); + angle += 180; + ISAR_SPLIT_REND_BITStream_read_int32( pBits, 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_read_int32( pBits, ISAR_SPLIT_REND_HEAD_POSE_BITS ); + } +#endif isar_split_rend_get_quant_params( MAX_SPLIT_REND_MD_BANDS, diff --git a/lib_isar/isar_splitRendererPre.c b/lib_isar/isar_splitRendererPre.c index 56e4b6b1e0..4f1267ff83 100644 --- a/lib_isar/isar_splitRendererPre.c +++ b/lib_isar/isar_splitRendererPre.c @@ -1054,6 +1054,9 @@ static void isar_SplitRenderer_quant_code( const int16_t low_res_pre_rend_rot, const int32_t target_md_bits ) { +#ifdef NONBE_SPLIT_DYN_OFFSET + int16_t angle, num_yaw_poses, num_pitch_poses, num_roll_poses; +#endif int16_t num_complex_bands, q, num_subframes, sf_idx, pos_idx, b, num_quant_strats; int32_t overhead_bits, quant_strat_bits, huff_bits, start_bit; int16_t pred_real_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS], pred_real_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS]; @@ -1083,7 +1086,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 ); @@ -1100,6 +1105,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 isar_split_rend_get_quant_params( MAX_SPLIT_REND_MD_BANDS, pred_real_bands_yaw, pred_imag_bands_yaw, pred_quant_pnts_yaw, pred_quantstep_yaw, pred_1byquantstep_yaw, diff --git a/lib_isar/isar_splitRenderer_utils.c b/lib_isar/isar_splitRenderer_utils.c index 8d03e297d7..c7a09544e6 100644 --- a/lib_isar/isar_splitRenderer_utils.c +++ b/lib_isar/isar_splitRenderer_utils.c @@ -697,6 +697,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 ) { @@ -785,6 +789,34 @@ ivas_error isar_split_rend_validate_config( } } } +#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; } @@ -851,6 +883,101 @@ void isar_split_rend_get_quant_params( return; } +#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 /*------------------------------------------------------------------------- * Function isar_renderSplitGetMultiBinPoseData() @@ -863,10 +990,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++ ) { @@ -875,11 +1011,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; @@ -964,6 +1175,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 7e27e8e159..d62ae91b0a 100644 --- a/lib_isar/lib_isar_post_rend.c +++ b/lib_isar/lib_isar_post_rend.c @@ -1173,6 +1173,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 a0d31fa8a6..a676e50eae 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4382,6 +4382,12 @@ int16_t IVAS_REND_GetRenderConfig( hRCout->split_rend_config.codec = ISAR_SPLIT_REND_CODEC_DEFAULT; hRCout->split_rend_config.poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; hRCout->split_rend_config.rendererSelection = hRCin->split_rend_config.rendererSelection; +#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 981f261420..d2f4c01277 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -2561,6 +2561,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 DEBUGGING else { -- GitLab From 38e560e4a16d2b9575fee119b2a397b6777e64aa Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 7 May 2024 11:29:42 +0200 Subject: [PATCH 2/3] [fix] missing defaults for decoder init --- lib_dec/lib_dec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 71f89ea508..b046811b60 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2118,6 +2118,12 @@ static ivas_error copyRendererConfigStruct( hRCout->split_rend_config.codec = ISAR_SPLIT_REND_CODEC_DEFAULT; hRCout->split_rend_config.poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; hRCout->split_rend_config.rendererSelection = hRCin->split_rend_config.rendererSelection; +#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; hRCout->roomAcoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity; -- GitLab From ee446dee9b36225623436cbe1da88b49b96376a9 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 7 May 2024 12:08:56 +0200 Subject: [PATCH 3/3] [fix] missing default values for postrend, use values from bitstream instead of garbage values --- lib_isar/isar_splitRendererPost.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lib_isar/isar_splitRendererPost.c b/lib_isar/isar_splitRendererPost.c index dc50f98325..f47b41e9f4 100644 --- a/lib_isar/isar_splitRendererPost.c +++ b/lib_isar/isar_splitRendererPost.c @@ -758,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 ); @@ -805,9 +810,9 @@ void isar_splitBinPostRendMdDec( /* read relative poses */ isar_renderSplitGetNumPoses( - pMultiBinPoseData->rot_axis, - pMultiBinPoseData->dof, - pMultiBinPoseData->hq_mode, + rot_axis, + split_rend_config.dof, + split_rend_config.hq_mode, &num_yaw_poses, &num_pitch_poses, &num_roll_poses ); @@ -821,16 +826,16 @@ void isar_splitBinPostRendMdDec( 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_read_int32( pBits, ISAR_SPLIT_REND_HEAD_POSE_BITS ); + 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) roundf( pMultiBinPoseData->relative_head_poses[pos_idx + num_yaw_poses + num_pitch_poses + 1][2] ); - angle += 180; - ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_HEAD_POSE_BITS ); + 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 -- GitLab