Commit 8fbc6aae authored by Aurelien Jacobs's avatar Aurelien Jacobs

move some functions to bitstream.h to avoid conflicts

between different  bitstream readers in different codecs

Originally committed as revision 6117 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 1b4f17fa
...@@ -47,41 +47,6 @@ void ff_put_string(PutBitContext * pbc, char *s, int put_zero) ...@@ -47,41 +47,6 @@ void ff_put_string(PutBitContext * pbc, char *s, int put_zero)
put_bits(pbc, 8, 0); put_bits(pbc, 8, 0);
} }
/* bit input functions */
/**
* reads 0-32 bits.
*/
unsigned int get_bits_long(GetBitContext *s, int n){
if(n<=17) return get_bits(s, n);
else{
int ret= get_bits(s, 16) << (n-16);
return ret | get_bits(s, n-16);
}
}
/**
* shows 0-32 bits.
*/
unsigned int show_bits_long(GetBitContext *s, int n){
if(n<=17) return show_bits(s, n);
else{
GetBitContext gb= *s;
int ret= get_bits_long(s, n);
*s= gb;
return ret;
}
}
int check_marker(GetBitContext *s, const char *msg)
{
int bit= get_bits1(s);
if(!bit)
av_log(NULL, AV_LOG_INFO, "Marker bit missing %s\n", msg);
return bit;
}
/* VLC decoding */ /* VLC decoding */
//#define DEBUG_VLC //#define DEBUG_VLC
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#ifndef BITSTREAM_H #ifndef BITSTREAM_H
#define BITSTREAM_H #define BITSTREAM_H
#include "log.h"
//#define ALT_BITSTREAM_WRITER //#define ALT_BITSTREAM_WRITER
//#define ALIGNED_BITSTREAM_WRITER //#define ALIGNED_BITSTREAM_WRITER
#if !defined(LIBMPEG2_BITSTREAM_READER) && !defined(A32_BITSTREAM_READER) && !defined(ALT_BITSTREAM_READER) #if !defined(LIBMPEG2_BITSTREAM_READER) && !defined(A32_BITSTREAM_READER) && !defined(ALT_BITSTREAM_READER)
...@@ -642,8 +644,6 @@ static inline unsigned int get_bits(GetBitContext *s, int n){ ...@@ -642,8 +644,6 @@ static inline unsigned int get_bits(GetBitContext *s, int n){
return tmp; return tmp;
} }
unsigned int get_bits_long(GetBitContext *s, int n);
/** /**
* shows 0-17 bits. * shows 0-17 bits.
* Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
...@@ -657,8 +657,6 @@ static inline unsigned int show_bits(GetBitContext *s, int n){ ...@@ -657,8 +657,6 @@ static inline unsigned int show_bits(GetBitContext *s, int n){
return tmp; return tmp;
} }
unsigned int show_bits_long(GetBitContext *s, int n);
static inline void skip_bits(GetBitContext *s, int n){ static inline void skip_bits(GetBitContext *s, int n){
//Note gcc seems to optimize this to s->index+=n for the ALT_READER :)) //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
OPEN_READER(re, s) OPEN_READER(re, s)
...@@ -695,6 +693,39 @@ static inline void skip_bits1(GetBitContext *s){ ...@@ -695,6 +693,39 @@ static inline void skip_bits1(GetBitContext *s){
skip_bits(s, 1); skip_bits(s, 1);
} }
/**
* reads 0-32 bits.
*/
static inline unsigned int get_bits_long(GetBitContext *s, int n){
if(n<=17) return get_bits(s, n);
else{
int ret= get_bits(s, 16) << (n-16);
return ret | get_bits(s, n-16);
}
}
/**
* shows 0-32 bits.
*/
static inline unsigned int show_bits_long(GetBitContext *s, int n){
if(n<=17) return show_bits(s, n);
else{
GetBitContext gb= *s;
int ret= get_bits_long(s, n);
*s= gb;
return ret;
}
}
static inline int check_marker(GetBitContext *s, const char *msg)
{
int bit= get_bits1(s);
if(!bit)
av_log(NULL, AV_LOG_INFO, "Marker bit missing %s\n", msg);
return bit;
}
/** /**
* init GetBitContext. * init GetBitContext.
* @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes larger then the actual read bits * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes larger then the actual read bits
...@@ -828,7 +859,6 @@ static always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], ...@@ -828,7 +859,6 @@ static always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2],
//#define TRACE //#define TRACE
#ifdef TRACE #ifdef TRACE
#include "avcodec.h"
static inline void print_bin(int bits, int n){ static inline void print_bin(int bits, int n){
int i; int i;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment