diff options
author | Mans Rullgard | 2011-07-01 16:35:37 +0100 |
---|---|---|
committer | Mans Rullgard | 2011-07-02 16:25:27 +0100 |
commit | 30b05520c8b1d1574d7b62dee59776b50d231590 (patch) | |
tree | 944bf16e87ff91a23ea887ab048dc63d2af961f6 /libavcodec/put_bits.h | |
parent | 12489443dec228d60fa3dc56695f6ddae08beb37 (diff) |
put_bits: always use intreadwrite.h macros
This fixes invalid unaligned stores in some ARM configurations.
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavcodec/put_bits.h')
-rw-r--r-- | libavcodec/put_bits.h | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h index 3849e6d339..b91e0f8f5a 100644 --- a/libavcodec/put_bits.h +++ b/libavcodec/put_bits.h @@ -70,8 +70,7 @@ static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_s s->buf_end = s->buf + buffer_size; #ifdef ALT_BITSTREAM_WRITER s->index=0; - ((uint32_t*)(s->buf))[0]=0; -// memset(buffer, 0, buffer_size); + AV_ZERO32(s->buf); #else s->buf_ptr = s->buf; s->bit_left=32; @@ -164,12 +163,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) #ifdef BITSTREAM_WRITER_LE bit_buf |= value << (32 - bit_left); if (n >= bit_left) { -#if !HAVE_FAST_UNALIGNED - if (3 & (intptr_t) s->buf_ptr) { - AV_WL32(s->buf_ptr, bit_buf); - } else -#endif - *(uint32_t *)s->buf_ptr = av_le2ne32(bit_buf); + AV_WL32(s->buf_ptr, bit_buf); s->buf_ptr+=4; bit_buf = (bit_left==32)?0:value >> bit_left; bit_left+=32; @@ -182,12 +176,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) } else { bit_buf<<=bit_left; bit_buf |= value >> (n - bit_left); -#if !HAVE_FAST_UNALIGNED - if (3 & (intptr_t) s->buf_ptr) { - AV_WB32(s->buf_ptr, bit_buf); - } else -#endif - *(uint32_t *)s->buf_ptr = av_be2ne32(bit_buf); + AV_WB32(s->buf_ptr, bit_buf); //printf("bitbuf = %08x\n", bit_buf); s->buf_ptr+=4; bit_left+=32 - n; |