Loading lib_util/ivas_rtp_pi_data.c +10 −14 Original line number Diff line number Diff line Loading @@ -775,20 +775,14 @@ static ivas_error unpackPositionCompact( const uint8_t *buffer, uint32_t numData return IVAS_ERROR( IVAS_ERR_RTP_UNPACK_PI_DATA, "Incorrect size to unpack compact position PI data" ); } int16_t value1 = -100; int16_t value2 = 100; uint16_t value1_uint16 = (uint16_t) value1; uint16_t value2_uint16 = (uint16_t) value2; position->size = sizeof( IVAS_PIDATA_POSITION ); compactRead = ( (int32_t) buffer[0] << 24 ) | ( (int32_t) buffer[1] << 16 ) | ( (int32_t) buffer[2] << 8 ) | ( (int32_t) buffer[3] ); position->position.x = FLOAT_FROM_Q10( (int16_t) ( compactRead >> 21 ) ) * MAX_PI_COMPACT_POSITION_XY_METERS; position->position.y = FLOAT_FROM_Q10( ( (int16_t) ( compactRead >> 10 ) ) & MASK_11BIT ) * MAX_PI_COMPACT_POSITION_XY_METERS; position->position.z = FLOAT_FROM_Q9( (int16_t) ( compactRead & MASK_10BIT ) ) * MAX_PI_COMPACT_POSITION_Z_METERS; position->position.x = FLOAT_FROM_Q10( (int16_t) ( compactRead >> 21 ) ) * MAX_PI_COMPACT_POSITION_XY_METERS; /* Shift preserves sign bit */ compactRead = compactRead << 11; /* Discard read bits */ position->position.y = FLOAT_FROM_Q10( (int16_t) ( compactRead >> 21 ) ) * MAX_PI_COMPACT_POSITION_XY_METERS; /* Shift preserves sign bit */ compactRead = compactRead << 11; /* Discard read bits */ position->position.z = FLOAT_FROM_Q9( (int16_t) ( compactRead >> 22 ) ) * MAX_PI_COMPACT_POSITION_Z_METERS; /* Shift preserves sign bit */ return IVAS_ERR_OK; } Loading Loading @@ -915,9 +909,11 @@ static ivas_error unpackISMPositionCompact( const uint8_t *buffer, uint32_t numD for ( n = 0; n < ism_position->numObjects; n++ ) { compactRead = ( (int32_t) buffer[0] << 24 ) | ( (int32_t) buffer[1] << 16 ) | ( (int32_t) buffer[2] << 8 ) | ( (int32_t) buffer[3] ); ism_position->position[n].x = FLOAT_FROM_Q10( (int16_t) ( compactRead >> 21 ) ) * MAX_PI_COMPACT_POSITION_XY_METERS; ism_position->position[n].y = FLOAT_FROM_Q10( ( (int16_t) ( compactRead >> 10 ) ) & MASK_11BIT ) * MAX_PI_COMPACT_POSITION_XY_METERS; ism_position->position[n].z = FLOAT_FROM_Q9( (int16_t) ( compactRead & MASK_10BIT ) ) * MAX_PI_COMPACT_POSITION_Z_METERS; ism_position->position[n].x = FLOAT_FROM_Q10( (int16_t) ( compactRead >> 21 ) ) * MAX_PI_COMPACT_POSITION_XY_METERS; /* Shift preserves sign bit */ compactRead = compactRead << 11; /* Discard read bits */ ism_position->position[n].y = FLOAT_FROM_Q10( (int16_t) ( compactRead >> 21 ) ) * MAX_PI_COMPACT_POSITION_XY_METERS; /* Shift preserves sign bit */ compactRead = compactRead << 11; /* Discard read bits */ ism_position->position[n].z = FLOAT_FROM_Q9( (int16_t) ( compactRead >> 22 ) ) * MAX_PI_COMPACT_POSITION_Z_METERS; /* Shift preserves sign bit */ } return IVAS_ERR_OK; } Loading Loading
lib_util/ivas_rtp_pi_data.c +10 −14 Original line number Diff line number Diff line Loading @@ -775,20 +775,14 @@ static ivas_error unpackPositionCompact( const uint8_t *buffer, uint32_t numData return IVAS_ERROR( IVAS_ERR_RTP_UNPACK_PI_DATA, "Incorrect size to unpack compact position PI data" ); } int16_t value1 = -100; int16_t value2 = 100; uint16_t value1_uint16 = (uint16_t) value1; uint16_t value2_uint16 = (uint16_t) value2; position->size = sizeof( IVAS_PIDATA_POSITION ); compactRead = ( (int32_t) buffer[0] << 24 ) | ( (int32_t) buffer[1] << 16 ) | ( (int32_t) buffer[2] << 8 ) | ( (int32_t) buffer[3] ); position->position.x = FLOAT_FROM_Q10( (int16_t) ( compactRead >> 21 ) ) * MAX_PI_COMPACT_POSITION_XY_METERS; position->position.y = FLOAT_FROM_Q10( ( (int16_t) ( compactRead >> 10 ) ) & MASK_11BIT ) * MAX_PI_COMPACT_POSITION_XY_METERS; position->position.z = FLOAT_FROM_Q9( (int16_t) ( compactRead & MASK_10BIT ) ) * MAX_PI_COMPACT_POSITION_Z_METERS; position->position.x = FLOAT_FROM_Q10( (int16_t) ( compactRead >> 21 ) ) * MAX_PI_COMPACT_POSITION_XY_METERS; /* Shift preserves sign bit */ compactRead = compactRead << 11; /* Discard read bits */ position->position.y = FLOAT_FROM_Q10( (int16_t) ( compactRead >> 21 ) ) * MAX_PI_COMPACT_POSITION_XY_METERS; /* Shift preserves sign bit */ compactRead = compactRead << 11; /* Discard read bits */ position->position.z = FLOAT_FROM_Q9( (int16_t) ( compactRead >> 22 ) ) * MAX_PI_COMPACT_POSITION_Z_METERS; /* Shift preserves sign bit */ return IVAS_ERR_OK; } Loading Loading @@ -915,9 +909,11 @@ static ivas_error unpackISMPositionCompact( const uint8_t *buffer, uint32_t numD for ( n = 0; n < ism_position->numObjects; n++ ) { compactRead = ( (int32_t) buffer[0] << 24 ) | ( (int32_t) buffer[1] << 16 ) | ( (int32_t) buffer[2] << 8 ) | ( (int32_t) buffer[3] ); ism_position->position[n].x = FLOAT_FROM_Q10( (int16_t) ( compactRead >> 21 ) ) * MAX_PI_COMPACT_POSITION_XY_METERS; ism_position->position[n].y = FLOAT_FROM_Q10( ( (int16_t) ( compactRead >> 10 ) ) & MASK_11BIT ) * MAX_PI_COMPACT_POSITION_XY_METERS; ism_position->position[n].z = FLOAT_FROM_Q9( (int16_t) ( compactRead & MASK_10BIT ) ) * MAX_PI_COMPACT_POSITION_Z_METERS; ism_position->position[n].x = FLOAT_FROM_Q10( (int16_t) ( compactRead >> 21 ) ) * MAX_PI_COMPACT_POSITION_XY_METERS; /* Shift preserves sign bit */ compactRead = compactRead << 11; /* Discard read bits */ ism_position->position[n].y = FLOAT_FROM_Q10( (int16_t) ( compactRead >> 21 ) ) * MAX_PI_COMPACT_POSITION_XY_METERS; /* Shift preserves sign bit */ compactRead = compactRead << 11; /* Discard read bits */ ism_position->position[n].z = FLOAT_FROM_Q9( (int16_t) ( compactRead >> 22 ) ) * MAX_PI_COMPACT_POSITION_Z_METERS; /* Shift preserves sign bit */ } return IVAS_ERR_OK; } Loading