Commit 5572ee2c authored by Lauros Pajunen's avatar Lauros Pajunen
Browse files

Fix pi size parsing, add threshold for orientation parsing

parent c1dc8a1c
Loading
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1568,6 +1568,7 @@ static ivas_error parsePIData( IVAS_RTP_UNPACK_HANDLE hUnpack, uint32_t rtpTimes
{
    bool PF = true;
    uint32_t nBytes = *numBytes;
    bool isFirstPiSize = true;

    while ( PF )
    {
@@ -1589,12 +1590,13 @@ static ivas_error parsePIData( IVAS_RTP_UNPACK_HANDLE hUnpack, uint32_t rtpTimes
        do
        {
            byte = payload->buffer[nBytes++];
            piSize += ( byte & MASK_5BIT );
            piSize += isFirstPiSize ? ( byte & MASK_5BIT ) : byte;
            if ( nBytes >= payload->length )
            {
                return IVAS_ERROR( IVAS_ERR_RTP_UNDERFLOW, "Underflow during reading piSize" );
            }
        } while ( byte == 32 );
            isFirstPiSize = false;
        } while ( byte == 255 || piSize == 32 );
#else
        do
        {
+6 −6
Original line number Diff line number Diff line
@@ -111,12 +111,12 @@ static int16_t ivasPayload_convertToQ10( float value )
 *
 * Convert a float value into a Q7 encoded value.
 *-----------------------------------------------------------------------*/
static int16_t ivasPayload_convertToQ7( float value )
static int8_t ivasPayload_convertToQ7( float value )
{
    value = ( value * 128.0f );
    value = value > +128.0f ? +128.0f : value;
    value = value < -128.0f ? -128.0f : value;
    return (int16_t) ( value );
    return (int8_t) ( value );
}
#endif

@@ -210,10 +210,10 @@ static ivas_error packOrientation( const IVAS_PIDATA_GENERIC *piData, uint8_t *b
    buffer[nBytes++] = ( orientation->piDataType & MASK_5BIT ); /* PF/PM populated during final packing */
#ifdef RTP_UPDATES_SA4_134
    buffer[nBytes++] = 4;
    buffer[nBytes++] = (uint8_t) ivasPayload_convertToQ7( orientation->orientation.w );
    buffer[nBytes++] = (uint8_t) ivasPayload_convertToQ7( orientation->orientation.x );
    buffer[nBytes++] = (uint8_t) ivasPayload_convertToQ7( orientation->orientation.y );
    buffer[nBytes++] = (uint8_t) ivasPayload_convertToQ7( orientation->orientation.z );
    buffer[nBytes++] = ivasPayload_convertToQ7( orientation->orientation.w );
    buffer[nBytes++] = ivasPayload_convertToQ7( orientation->orientation.x );
    buffer[nBytes++] = ivasPayload_convertToQ7( orientation->orientation.y );
    buffer[nBytes++] = ivasPayload_convertToQ7( orientation->orientation.z );
#else
    buffer[nBytes++] = 8;
    nBytes = writeInt16( buffer, nBytes, ivasPayload_convertToQ15( orientation->orientation.w ) );
+4 −4
Original line number Diff line number Diff line
@@ -322,10 +322,10 @@ def isEqualFrame(refFrame: bytes, dutFrame: bytes):


def isEqualOrientation(ref: ORIENTATION, dut: ORIENTATION):
    assert abs(ref.w - dut.w) < 0.0001, "Scene Orientation PI Data mismatch in w"
    assert abs(ref.x - dut.x) < 0.0001, "Scene Orientation PI Data mismatch in x"
    assert abs(ref.y - dut.y) < 0.0001, "Scene Orientation PI Data mismatch in y"
    assert abs(ref.z - dut.z) < 0.0001, "Scene Orientation PI Data mismatch in z"
    assert abs(ref.w - dut.w) < 0.0079, "Scene Orientation PI Data mismatch in w"
    assert abs(ref.x - dut.x) < 0.0079, "Scene Orientation PI Data mismatch in x"
    assert abs(ref.y - dut.y) < 0.0079, "Scene Orientation PI Data mismatch in y"
    assert abs(ref.z - dut.z) < 0.0079, "Scene Orientation PI Data mismatch in z"


def isEqualPosition(ref: POSITION, dut: POSITION):