Commit e7a10462 authored by norvell's avatar norvell
Browse files

Revert fix on unsigned buffer

parent 7e502eb5
Loading
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -873,7 +873,7 @@ static ivas_error packPositionCompact( const IVAS_PIDATA_GENERIC *piData, uint8_
static ivas_error unpackPositionCompact( const uint8_t *buffer, uint32_t numDataBytes, IVAS_PIDATA_GENERIC *piData )
{
    IVAS_PIDATA_POSITION *position = (IVAS_PIDATA_POSITION *) piData;
    uint32_t compactRead = 0;
    int32_t compactRead = 0;

    /* Compact position data is 4 bytes */
    if ( numDataBytes != 4 )
@@ -883,7 +883,7 @@ static ivas_error unpackPositionCompact( const uint8_t *buffer, uint32_t numData

    position->size = sizeof( IVAS_PIDATA_POSITION );

    compactRead = ( (uint32_t) buffer[0] << 24 ) | ( (uint32_t) buffer[1] << 16 ) | ( (uint32_t) buffer[2] << 8 ) | ( (uint32_t) buffer[3] );
    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; /* 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 */
@@ -999,7 +999,7 @@ static ivas_error packISMPositionCompact( const IVAS_PIDATA_GENERIC *piData, uin
static ivas_error unpackISMPositionCompact( const uint8_t *buffer, uint32_t numDataBytes, IVAS_PIDATA_GENERIC *piData )
{
    uint16_t n;
    uint32_t compactRead = 0;
    int32_t compactRead = 0;
    IVAS_PIDATA_ISM_POSITION *ism_position = (IVAS_PIDATA_ISM_POSITION *) piData;

    /* Compact position data is 4 bytes */
@@ -1014,7 +1014,7 @@ static ivas_error unpackISMPositionCompact( const uint8_t *buffer, uint32_t numD

    for ( n = 0; n < ism_position->numObjects; n++ )
    {
        compactRead = ( (uint32_t) buffer[n * 4] << 24 ) | ( (uint32_t) buffer[n * 4 + 1] << 16 ) | ( (uint32_t) buffer[n * 4 + 2] << 8 ) | ( (uint32_t) buffer[n * 4 + 3] );
        compactRead = ( (int32_t) buffer[n * 4] << 24 ) | ( (int32_t) buffer[n * 4 + 1] << 16 ) | ( (int32_t) buffer[n * 4 + 2] << 8 ) | ( (int32_t) buffer[n * 4 + 3] );
        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 */