Ignore:
Timestamp:
11/24/06 19:18:18 (18 years ago)
Author:
r2d
Message:
  • updated libmpcenc / libmpcdec according to the spec
  • added seek table loading from file in libmpcdec
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libmpc/branches/r2d/libmpcdec/mpc_bits_reader.c

    r104 r150  
    6868}
    6969
     70mpc_int32_t mpc_bits_golomb_dec(mpc_bits_reader * r, const mpc_uint_t k)
     71{
     72        unsigned int l = 0;
     73        unsigned int code = r->buff[0] & ((1 << r->count) - 1);
     74
     75        while( code == 0 ) {
     76                l += r->count;
     77                r->buff++;
     78                code = r->buff[0];
     79                r->count = 8;
     80        }
     81
     82        while( ((1 << (r->count - 1)) & code) == 0 ) {
     83                l++;
     84                r->count--;
     85        }
     86        r->count--;
     87
     88        while( r->count < k ) {
     89                r->buff++;
     90                r->count += 8;
     91                code = (code << 8) | r->buff[0];
     92        }
     93
     94        r->count -= k;
     95
     96        return (l << k) | ((code >> r->count) & ((1 << k) - 1));
     97}
     98
    7099unsigned int mpc_bits_get_size(mpc_bits_reader * r, mpc_uint64_t * p_size)
    71100{
Note: See TracChangeset for help on using the changeset viewer.