diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2002-03-24 21:25:04 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2002-03-24 21:25:04 +0000 |
commit | 490922441b42f391b8fad0aee516f5274bde6864 (patch) | |
tree | 7f574cf45102ad730c7ff2a437acf726472910db /libavcodec/common.h | |
parent | 122546a6d151d3af88cc2330b9d9bb6e4fcaef68 (diff) | |
download | ffmpeg-490922441b42f391b8fad0aee516f5274bde6864.tar.gz |
resync marker support, needed for some mp4 files
Originally committed as revision 358 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/common.h')
-rw-r--r-- | libavcodec/common.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/libavcodec/common.h b/libavcodec/common.h index b8e457ae74..8e5265c565 100644 --- a/libavcodec/common.h +++ b/libavcodec/common.h @@ -200,6 +200,8 @@ typedef struct GetBitContext { int size; } GetBitContext; +static inline int get_bits_count(GetBitContext *s); + typedef struct VLC { int bits; INT16 *table_codes; @@ -551,6 +553,43 @@ static inline unsigned int show_bits(GetBitContext *s, int n) #endif //!ALT_BITSTREAM_READER } +static inline int show_aligned_bits(GetBitContext *s, int offset, int n) +{ +#ifdef ALT_BITSTREAM_READER +#ifdef ALIGNED_BITSTREAM + int index= (s->index + offset + 7)&(~7); + uint32_t result1= be2me_32( ((uint32_t *)s->buffer)[index>>5] ); + uint32_t result2= be2me_32( ((uint32_t *)s->buffer)[(index>>5) + 1] ); +#ifdef ARCH_X86 + asm ("shldl %%cl, %2, %0\n\t" + : "=r" (result1) + : "0" (result1), "r" (result2), "c" (index)); +#else + result1<<= (index&0x1F); + result2= (result2>>1) >> (31-(index&0x1F)); + result1|= result2; +#endif + result1>>= 32 - n; + + return result1; +#else //ALIGNED_BITSTREAM + int index= (s->index + offset + 7)>>3; + uint32_t result= be2me_32( unaligned32( ((uint8_t *)s->buffer)+index ) ); + + result>>= 32 - n; + + return result; +#endif //!ALIGNED_BITSTREAM +#else //ALT_BITSTREAM_READER + int index= (get_bits_count(s) + offset + 7)>>3; + uint32_t result= be2me_32( unaligned32( ((uint8_t *)s->buf)+index ) ); + + result>>= 32 - n; +//printf(" %X %X %d \n", (int)(((uint8_t *)s->buf)+index ), (int)s->buf_ptr, s->bit_cnt); + return result; +#endif //!ALT_BITSTREAM_READER +} + static inline void skip_bits(GetBitContext *s, int n){ #ifdef ALT_BITSTREAM_READER s->index+= n; |