/*
* copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
*
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern const uint8_t ff_reverse[256];
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if defined(ARCH_X86)
// avoid +32 for shift optimization (gcc should do that ...)
static inline int32_t NEG_SSR32( int32_t a, int8_t s){
asm ("sarl %1, %0\n\t"
#endif
/* used to avoid missaligned exceptions on some archs (alpha, ...) */
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if defined(ARCH_X86)
# define unaligned16(a) (*(const uint16_t*)(a))
# define unaligned32(a) (*(const uint32_t*)(a))
# define unaligned64(a) (*(const uint64_t*)(a))
unaligned(32)
unaligned(64)
#undef unaligned
-#endif //!ARCH_X86
+#endif /* defined(ARCH_X86) */
#ifndef ALT_BITSTREAM_WRITER
static inline void put_bits(PutBitContext *s, int n, unsigned int value)
static inline void put_bits(PutBitContext *s, int n, unsigned int value)
{
# ifdef ALIGNED_BITSTREAM_WRITER
-# if defined(ARCH_X86) || defined(ARCH_X86_64)
+# if defined(ARCH_X86)
asm volatile(
"movl %0, %%ecx \n\t"
"xorl %%eax, %%eax \n\t"
s->index= index;
# endif
# else //ALIGNED_BITSTREAM_WRITER
-# if defined(ARCH_X86) || defined(ARCH_X86_64)
+# if defined(ARCH_X86)
asm volatile(
"movl $7, %%ecx \n\t"
"andl %0, %%ecx \n\t"
# ifdef ALT_BITSTREAM_READER_LE
# define SHOW_UBITS(name, gb, num)\
((name##_cache) & (NEG_USR32(0xffffffff,num)))
+
+# define SHOW_SBITS(name, gb, num)\
+ NEG_SSR32((name##_cache)<<(32-(num)), num)
# else
# define SHOW_UBITS(name, gb, num)\
NEG_USR32(name##_cache, num)
-# endif
# define SHOW_SBITS(name, gb, num)\
NEG_SSR32(name##_cache, num)
+# endif
# define GET_CACHE(name, gb)\
((uint32_t)name##_cache)
name##_bit_count-= 32;\
}\
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if defined(ARCH_X86)
# define SKIP_CACHE(name, gb, num)\
asm(\
"shldl %2, %1, %0 \n\t"\
static inline unsigned int get_bits_long(GetBitContext *s, int n){
if(n<=17) return get_bits(s, n);
else{
+#ifdef ALT_BITSTREAM_READER_LE
+ int ret= get_bits(s, 16);
+ return ret | (get_bits(s, n-16) << 16);
+#else
int ret= get_bits(s, 16) << (n-16);
return ret | get_bits(s, n-16);
+#endif
}
}