Ignore:
Timestamp:
01/05/08 11:40:24 (16 years ago)
Author:
radscorpion
Message:

SV7 demuxing and decoding works.
However there are strange artifacts when seeking in SV7 files.. - TODO

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dsfilters/demux_mpc/src/bits.h

    r378 r379  
    117117                bitbuf = (tmp[0] << 24) | (tmp[1] << 16) | (tmp[2] << 8) | (tmp[3]);
    118118        }
     119
     120        inline void PutBits(int32 val, int32 num) {
     121                bits += num;
     122                if (num < 32) val &= (1<<num)-1;
     123                if (bits > 32) {
     124                        bits -= 32;
     125                        bitbuf |= val >> (bits);
     126                        *buf++ = ( bitbuf >> 24 ) & 0xff;
     127                        *buf++ = ( bitbuf >> 16 ) & 0xff;
     128                        *buf++ = ( bitbuf >>  8 ) & 0xff;
     129                        *buf++ = ( bitbuf >>  0 ) & 0xff;
     130                        bitbuf = val << (32 - bits);
     131                } else
     132                bitbuf |= val << (32 - bits);
     133        }
     134        inline void WriteBits() {
     135                while (bits >= 8) {
     136                        *buf++ = (bitbuf >> 24) & 0xff;
     137                        bitbuf <<= 8;
     138                        bits -= 8;
     139                }
     140        }
     141        inline void Put_ByteAlign_Zero() { int32 bl=(bits)&0x07; if (bl<8) { PutBits(0,8-bl); } WriteBits(); }
     142        inline void Put_ByteAlign_One() { int32 bl=(bits)&0x07; if (bl<8) {     PutBits(0xffffff,8-bl); } WriteBits(); }
     143
    119144};
Note: See TracChangeset for help on using the changeset viewer.