Commit de32410c authored by vaillancour's avatar vaillancour
Browse files

convert to fixed point convertSerialToBytestream_fx, debug code included

parent 909ef98a
Loading
Loading
Loading
Loading
Loading
+26 −6
Original line number Diff line number Diff line
@@ -3854,9 +3854,12 @@ void convertSerialToBytestream_fx(
    UWord8 *const bytestream     /* o  : output compact bitstream (bytestream)       */
)
{
    UWord32 i;
    Word16 i, ia7, isr3;
    UWord8 bit, bitinbyte;

#ifdef DEBUGGING
    UWord8 bitinbyte2, bytestream_tmp;
    assert( num_bits <= MAX_16 ); /* 512 kbps = 10240 bits, num_bits should always fits Word16 */
#endif
    FOR( i = 0; i < num_bits; ++i )
    {
        IF( EQ_32( serial[i], 0x0001 ) )
@@ -3869,12 +3872,29 @@ void convertSerialToBytestream_fx(
            bit = 0;
            move16();
        }
        bitinbyte = bit << ( 7 - ( i & 0x7 ) );
        IF( !( i & 0x7 ) )
        /*bitinbyte = bit << ( 7 - ( i & 0x7 ) );*/
        ia7 = s_and( i, 0x7 );
        isr3 = shr( i, 3 );
        bitinbyte = (UWord8) shl( (Word16) bit, sub( 7, ia7 ) );
#ifdef DEBUGGING
        bitinbyte2 = bit << ( 7 - ( i & 0x7 ) );
        assert( bitinbyte2 == bitinbyte );
#endif
        IF( !( ia7 ) )
        {
            bytestream[i >> 3] = 0;
            bytestream[isr3] = 0;
            move16();
        }
        bytestream[i >> 3] |= bitinbyte;
        /*bytestream[i >> 3] |= bitinbyte;*/
#ifdef DEBUGGING
        bytestream_tmp = bytestream[isr3];
        bytestream_tmp |= bitinbyte2;
#endif
        bytestream[isr3] = (Word8) s_or( bytestream[isr3], bitinbyte );
#ifdef DEBUGGING
        assert( bytestream_tmp == bytestream[isr3] );
#endif
        move16();
    }

    return;