# HG changeset patch # User benoit # Date 1224057714 0 # Node ID a512ac8fa54002c5564fe0879e6b329cc619c9af # Parent e50d7ac76945d6ccf0e7565944dc5c7e289feb8a Use of new bitstream in vorbis_enc.c. Patch by BartŠČomiej WoŠČowiec b wolowiec AT students mimuw edu pl diff -r e50d7ac76945 -r a512ac8fa540 vorbis_enc.c --- a/vorbis_enc.c Wed Oct 15 07:31:06 2008 +0000 +++ b/vorbis_enc.c Wed Oct 15 08:01:54 2008 +0000 @@ -30,6 +30,9 @@ #include "vorbis.h" #include "vorbis_enc_data.h" +#define BITSTREAM_WRITER_LE +#include "bitstream.h" + #undef NDEBUG #include @@ -122,52 +125,6 @@ int64_t sample_count; } venc_context_t; -typedef struct { - int total; - int total_pos; - int pos; - uint8_t * buf_ptr; -} PutBitContext; - -static inline void init_put_bits(PutBitContext * pb, uint8_t * buf, int buffer_len) { - pb->total = buffer_len * 8; - pb->total_pos = 0; - pb->pos = 0; - pb->buf_ptr = buf; -} - -static void put_bits(PutBitContext * pb, int bits, uint64_t val) { - if ((pb->total_pos += bits) >= pb->total) return; - if (!bits) return; - if (pb->pos) { - if (pb->pos > bits) { - *pb->buf_ptr |= val << (8 - pb->pos); - pb->pos -= bits; - bits = 0; - } else { - *pb->buf_ptr++ |= (val << (8 - pb->pos)) & 0xFF; - val >>= pb->pos; - bits -= pb->pos; - pb->pos = 0; - } - } - for (; bits >= 8; bits -= 8) { - *pb->buf_ptr++ = val & 0xFF; - val >>= 8; - } - if (bits) { - *pb->buf_ptr = val; - pb->pos = 8 - bits; - } -} - -static inline void flush_put_bits(PutBitContext * pb) { -} - -static inline int put_bits_count(PutBitContext * pb) { - return pb->total_pos; -} - static inline void put_codeword(PutBitContext * pb, codebook_t * cb, int entry) { assert(entry >= 0); assert(entry < cb->nentries);