From 867f8445778bc2753db2a037d28156f500282f98 Mon Sep 17 00:00:00 2001 From: benoit Date: Wed, 15 Oct 2008 08:01:54 +0000 Subject: [PATCH] =?utf8?q?Use=20of=20new=20bitstream=20in=20vorbis=5Fenc.c?= =?utf8?q?.=20Patch=20by=20Bart=C5=82omiej=20Wo=C5=82owiec=20b=20wolowiec?= =?utf8?q?=20AT=20students=20mimuw=20edu=20pl?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: file:///var/local/repositories/ffmpeg/trunk@15622 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b --- libavcodec/vorbis_enc.c | 49 +++-------------------------------------- 1 file changed, 3 insertions(+), 46 deletions(-) diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c index 01bc48c32..7f2e876a0 100644 --- a/libavcodec/vorbis_enc.c +++ b/libavcodec/vorbis_enc.c @@ -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 @@ typedef struct { 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); -- 2.39.2