Loading apps/renderer.c +3 −0 Original line number Diff line number Diff line Loading @@ -1984,6 +1984,9 @@ int main( IsmPositionProvider_close( positionProvider ); RenderConfigReader_close( &renderConfigReader ); #ifdef DEBUGGING dbgclose(); #endif #ifdef WMOPS print_wmops(); print_mem( NULL ); Loading lib_com/ivas_cnst.h +6 −0 Original line number Diff line number Diff line Loading @@ -1554,8 +1554,14 @@ typedef enum #define IVAS_SPLIT_REND_NUM_QUANT_STRATS (3) #define IVAS_SPLIT_REND_PRED_QUANT_PNTS ( 31 ) #define IVAS_SPLIT_REND_D_QUANT_PNTS ( 15 ) #ifdef SPLIT_REND_QUANT_RANGE_INC #define IVAS_SPLIT_REND_PRED_MIN_VAL ( -1.4f ) #define IVAS_SPLIT_REND_PRED_MAX_VAL ( 1.4f ) #else #define IVAS_SPLIT_REND_PRED_MIN_VAL ( -1.0f ) #define IVAS_SPLIT_REND_PRED_MAX_VAL ( 1.0f ) #endif #ifdef SPLIT_REND_WITH_HEAD_ROT #define IVAS_SPLIT_REND_PITCH_G_MIN_VAL (0.5f) #define IVAS_SPLIT_REND_PITCH_G_MAX_VAL (1.5f) Loading lib_com/options.h +2 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,8 @@ //#define SPLIT_REND_WITH_HEAD_ROT_DEBUG // only for debugging purposes //#define DBG_WAV_WRITER //#define SPLIT_POSE_CORRECTION_DEBUG #define SPLIT_REND_QUANT_RANGE_INC #define SPLIT_REND_CLDFB_ISM Loading lib_rend/ivas_rotation.c +3 −27 Original line number Diff line number Diff line Loading @@ -156,33 +156,9 @@ void QuatToRotMat( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( quat.w == -3.0 ) { float c1, c2, c3, s1, s2, s3; /* 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; IVAS_QUATERNION quat_local; Euler2Quat( deg2rad( quat.x ), deg2rad( quat.y ), deg2rad( quat.z ), &quat_local ); QuatToRotMat( quat_local, Rmat ); } else #endif Loading lib_rend/ivas_splitRendererPre.c +136 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,10 @@ #endif #include "wmc_auto.h" #ifdef DBG_WAV_WRITER #include "string.h" #endif #ifdef SPLIT_REND_WITH_HEAD_ROT #define MAX_BAND_SMOOTH ( 1 ) Loading Loading @@ -1460,6 +1464,107 @@ void ivas_rend_CldfbSplitPreRendProcess( low_res_pre_rend_rot, target_md_bits ); #ifdef SPLIT_POSE_CORRECTION_DEBUG float tmpCrendBuffer[2][L_FRAME48k], quant_val, step, minv, maxv; IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES]; int16_t sf_idx, pos_idx, b, ch1, ch2; int32_t read_off, write_off; for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) { QuaternionsPost[sf_idx].w = -3.0f; QuaternionsPost[sf_idx].x = 0.0f; QuaternionsPost[sf_idx].y = 0.0f; QuaternionsPost[sf_idx].z = 0.0f; } #if 0 read_off = pBits->bits_read; write_off = pBits->bits_written; ivas_splitBinPostRendMdDec( pBits, hBinHrSplitPreRend->hBinHrSplitPostRend, pMultiBinPoseData ); pMultiBinPoseData->poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; pBits->bits_read = read_off; pBits->bits_written = write_off; #else hBinHrSplitPreRend->hBinHrSplitPostRend->low_Res = 1; set_fix_rotation_mat( hBinHrSplitPreRend->hBinHrSplitPostRend->fix_pos_rot_mat, pMultiBinPoseData ); set_pose_types( hBinHrSplitPreRend->hBinHrSplitPostRend->pose_type, pMultiBinPoseData ); for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) { hBinHrSplitPreRend->hBinHrSplitPostRend->QuaternionsPre[sf_idx] = headPositions[sf_idx]; } for ( sf_idx = 0; sf_idx < 1; sf_idx++ ) { for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ ) { for ( b = 0; b < MAX_SPLIT_REND_MD_BANDS; b++ ) { hBinHrSplitPreRend->hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b] = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; #if 0 BIN_HR_SPLIT_REND_MD_HANDLE hMd; hMd = &hBinHrSplitPreRend->hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; minv = -1.4f; maxv = 1.4f; step = ( maxv - minv ) / 30.0f; if ( b >= 20 ) { float sign; for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { sign = ( hMd->pred_mat_re[ch1][ch2] >= 0.0f ) ? 1.0f : -1.0f; IVAS_CALCULATE_ABS( hMd->pred_mat_re[ch1][ch2], hMd->pred_mat_im[ch1][ch2], hMd->pred_mat_re[ch1][ch2] ); hMd->pred_mat_re[ch1][ch2] *= sign; hMd->pred_mat_im[ch1][ch2] = 0.0f; } } } for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { quant_val = hMd->pred_mat_re[ch1][ch2] - hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx][ch1][ch2]; quant_val = min( maxv, max( quant_val, minv ) ); quant_val = (int16_t) roundf( quant_val / step ); hMd->pred_mat_re[ch1][ch2] = quant_val * step; hMd->pred_mat_re[ch1][ch2] += hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx][ch1][ch2]; quant_val = hMd->pred_mat_im[ch1][ch2]; quant_val = min( maxv, max( quant_val, minv ) ); quant_val = (int16_t) roundf( quant_val / step ); hMd->pred_mat_im[ch1][ch2] = quant_val * step; } } #endif } } } #endif ivas_rend_CldfbSplitPostRendProcess( hBinHrSplitPreRend->hBinHrSplitPostRend, pMultiBinPoseData, QuaternionsPost, Cldfb_In_BinReal[0], Cldfb_In_BinImag[0], tmpCrendBuffer, 1 ); { float *pOut[2]; char fname[200] = "ref_act_pos.wav"; pOut[0] = tmpCrendBuffer[0]; pOut[1] = tmpCrendBuffer[1]; dbgwrite_wav( pOut, CLDFB_NO_COL_MAX * hBinHrSplitPreRend->hBinHrSplitPostRend->cldfbSyn[0]->no_channels, fname, 48000, 2 ); } #endif pop_wmops(); return; Loading Loading @@ -1521,6 +1626,14 @@ ivas_error ivas_splitBinPreRendOpen( set_fix_rotation_mat( hBinRend->fix_pos_rot_mat, pMultiBinPoseData ); set_pose_types( hBinRend->pose_type, pMultiBinPoseData ); ivas_split_rend_init_huff_cfg( &hBinRend->huff_cfg ); #ifdef SPLIT_POSE_CORRECTION_DEBUG ivas_splitBinPostRendOpen( &hBinRend->hBinHrSplitPostRend, pMultiBinPoseData, 48000 ); #endif *hBinHrSplitPreRend = hBinRend; return error; } Loading @@ -1545,6 +1658,10 @@ void ivas_splitBinPreRendClose( BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend } } #endif #ifdef SPLIT_POSE_CORRECTION_DEBUG ivas_splitBinPostRendClose( &( *hBinHrSplitPreRend )->hBinHrSplitPostRend ); #endif free( ( *hBinHrSplitPreRend ) ); ( *hBinHrSplitPreRend ) = NULL; } Loading Loading @@ -1945,6 +2062,25 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) #endif { #ifdef SPLIT_POSE_CORRECTION_DEBUG { float *pOut[2]; char fname[200] = "ref_out_pos"; char tag[2]; tag[0] = (char) ( '0' + pos_idx ); tag[1] = '\0'; strcat( fname, tag ); strcat( fname, ".wav" ); pOut[0] = in_delayed[2 * pos_idx]; pOut[1] = in_delayed[2 * pos_idx + 1]; dbgwrite_wav( pOut, CLDFB_NO_COL_MAX * max_bands, fname, 48000, 2 ); } #endif for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) Loading Loading
apps/renderer.c +3 −0 Original line number Diff line number Diff line Loading @@ -1984,6 +1984,9 @@ int main( IsmPositionProvider_close( positionProvider ); RenderConfigReader_close( &renderConfigReader ); #ifdef DEBUGGING dbgclose(); #endif #ifdef WMOPS print_wmops(); print_mem( NULL ); Loading
lib_com/ivas_cnst.h +6 −0 Original line number Diff line number Diff line Loading @@ -1554,8 +1554,14 @@ typedef enum #define IVAS_SPLIT_REND_NUM_QUANT_STRATS (3) #define IVAS_SPLIT_REND_PRED_QUANT_PNTS ( 31 ) #define IVAS_SPLIT_REND_D_QUANT_PNTS ( 15 ) #ifdef SPLIT_REND_QUANT_RANGE_INC #define IVAS_SPLIT_REND_PRED_MIN_VAL ( -1.4f ) #define IVAS_SPLIT_REND_PRED_MAX_VAL ( 1.4f ) #else #define IVAS_SPLIT_REND_PRED_MIN_VAL ( -1.0f ) #define IVAS_SPLIT_REND_PRED_MAX_VAL ( 1.0f ) #endif #ifdef SPLIT_REND_WITH_HEAD_ROT #define IVAS_SPLIT_REND_PITCH_G_MIN_VAL (0.5f) #define IVAS_SPLIT_REND_PITCH_G_MAX_VAL (1.5f) Loading
lib_com/options.h +2 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,8 @@ //#define SPLIT_REND_WITH_HEAD_ROT_DEBUG // only for debugging purposes //#define DBG_WAV_WRITER //#define SPLIT_POSE_CORRECTION_DEBUG #define SPLIT_REND_QUANT_RANGE_INC #define SPLIT_REND_CLDFB_ISM Loading
lib_rend/ivas_rotation.c +3 −27 Original line number Diff line number Diff line Loading @@ -156,33 +156,9 @@ void QuatToRotMat( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( quat.w == -3.0 ) { float c1, c2, c3, s1, s2, s3; /* 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; IVAS_QUATERNION quat_local; Euler2Quat( deg2rad( quat.x ), deg2rad( quat.y ), deg2rad( quat.z ), &quat_local ); QuatToRotMat( quat_local, Rmat ); } else #endif Loading
lib_rend/ivas_splitRendererPre.c +136 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,10 @@ #endif #include "wmc_auto.h" #ifdef DBG_WAV_WRITER #include "string.h" #endif #ifdef SPLIT_REND_WITH_HEAD_ROT #define MAX_BAND_SMOOTH ( 1 ) Loading Loading @@ -1460,6 +1464,107 @@ void ivas_rend_CldfbSplitPreRendProcess( low_res_pre_rend_rot, target_md_bits ); #ifdef SPLIT_POSE_CORRECTION_DEBUG float tmpCrendBuffer[2][L_FRAME48k], quant_val, step, minv, maxv; IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES]; int16_t sf_idx, pos_idx, b, ch1, ch2; int32_t read_off, write_off; for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) { QuaternionsPost[sf_idx].w = -3.0f; QuaternionsPost[sf_idx].x = 0.0f; QuaternionsPost[sf_idx].y = 0.0f; QuaternionsPost[sf_idx].z = 0.0f; } #if 0 read_off = pBits->bits_read; write_off = pBits->bits_written; ivas_splitBinPostRendMdDec( pBits, hBinHrSplitPreRend->hBinHrSplitPostRend, pMultiBinPoseData ); pMultiBinPoseData->poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; pBits->bits_read = read_off; pBits->bits_written = write_off; #else hBinHrSplitPreRend->hBinHrSplitPostRend->low_Res = 1; set_fix_rotation_mat( hBinHrSplitPreRend->hBinHrSplitPostRend->fix_pos_rot_mat, pMultiBinPoseData ); set_pose_types( hBinHrSplitPreRend->hBinHrSplitPostRend->pose_type, pMultiBinPoseData ); for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) { hBinHrSplitPreRend->hBinHrSplitPostRend->QuaternionsPre[sf_idx] = headPositions[sf_idx]; } for ( sf_idx = 0; sf_idx < 1; sf_idx++ ) { for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ ) { for ( b = 0; b < MAX_SPLIT_REND_MD_BANDS; b++ ) { hBinHrSplitPreRend->hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b] = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; #if 0 BIN_HR_SPLIT_REND_MD_HANDLE hMd; hMd = &hBinHrSplitPreRend->hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; minv = -1.4f; maxv = 1.4f; step = ( maxv - minv ) / 30.0f; if ( b >= 20 ) { float sign; for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { sign = ( hMd->pred_mat_re[ch1][ch2] >= 0.0f ) ? 1.0f : -1.0f; IVAS_CALCULATE_ABS( hMd->pred_mat_re[ch1][ch2], hMd->pred_mat_im[ch1][ch2], hMd->pred_mat_re[ch1][ch2] ); hMd->pred_mat_re[ch1][ch2] *= sign; hMd->pred_mat_im[ch1][ch2] = 0.0f; } } } for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { quant_val = hMd->pred_mat_re[ch1][ch2] - hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx][ch1][ch2]; quant_val = min( maxv, max( quant_val, minv ) ); quant_val = (int16_t) roundf( quant_val / step ); hMd->pred_mat_re[ch1][ch2] = quant_val * step; hMd->pred_mat_re[ch1][ch2] += hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx][ch1][ch2]; quant_val = hMd->pred_mat_im[ch1][ch2]; quant_val = min( maxv, max( quant_val, minv ) ); quant_val = (int16_t) roundf( quant_val / step ); hMd->pred_mat_im[ch1][ch2] = quant_val * step; } } #endif } } } #endif ivas_rend_CldfbSplitPostRendProcess( hBinHrSplitPreRend->hBinHrSplitPostRend, pMultiBinPoseData, QuaternionsPost, Cldfb_In_BinReal[0], Cldfb_In_BinImag[0], tmpCrendBuffer, 1 ); { float *pOut[2]; char fname[200] = "ref_act_pos.wav"; pOut[0] = tmpCrendBuffer[0]; pOut[1] = tmpCrendBuffer[1]; dbgwrite_wav( pOut, CLDFB_NO_COL_MAX * hBinHrSplitPreRend->hBinHrSplitPostRend->cldfbSyn[0]->no_channels, fname, 48000, 2 ); } #endif pop_wmops(); return; Loading Loading @@ -1521,6 +1626,14 @@ ivas_error ivas_splitBinPreRendOpen( set_fix_rotation_mat( hBinRend->fix_pos_rot_mat, pMultiBinPoseData ); set_pose_types( hBinRend->pose_type, pMultiBinPoseData ); ivas_split_rend_init_huff_cfg( &hBinRend->huff_cfg ); #ifdef SPLIT_POSE_CORRECTION_DEBUG ivas_splitBinPostRendOpen( &hBinRend->hBinHrSplitPostRend, pMultiBinPoseData, 48000 ); #endif *hBinHrSplitPreRend = hBinRend; return error; } Loading @@ -1545,6 +1658,10 @@ void ivas_splitBinPreRendClose( BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend } } #endif #ifdef SPLIT_POSE_CORRECTION_DEBUG ivas_splitBinPostRendClose( &( *hBinHrSplitPreRend )->hBinHrSplitPostRend ); #endif free( ( *hBinHrSplitPreRend ) ); ( *hBinHrSplitPreRend ) = NULL; } Loading Loading @@ -1945,6 +2062,25 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) #endif { #ifdef SPLIT_POSE_CORRECTION_DEBUG { float *pOut[2]; char fname[200] = "ref_out_pos"; char tag[2]; tag[0] = (char) ( '0' + pos_idx ); tag[1] = '\0'; strcat( fname, tag ); strcat( fname, ".wav" ); pOut[0] = in_delayed[2 * pos_idx]; pOut[1] = in_delayed[2 * pos_idx + 1]; dbgwrite_wav( pOut, CLDFB_NO_COL_MAX * max_bands, fname, 48000, 2 ); } #endif for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) Loading