Mercurial > libavcodec.hg
comparison bitstream.h @ 8498:2c7e8fe5fc6a libavcodec
Replace UNALIGNED_STORES_ARE_BAD with !HAVE_FAST_UNALIGNED
author | mru |
---|---|
date | Sat, 27 Dec 2008 23:12:00 +0000 |
parents | 9281a8a9387a |
children | 7a463923ecd1 |
comparison
equal
deleted
inserted
replaced
8497:927f0ee6e4ad | 8498:2c7e8fe5fc6a |
---|---|
177 int16_t level; | 177 int16_t level; |
178 int8_t len; | 178 int8_t len; |
179 uint8_t run; | 179 uint8_t run; |
180 } RL_VLC_ELEM; | 180 } RL_VLC_ELEM; |
181 | 181 |
182 #if defined(ARCH_SPARC) || defined(ARCH_ARM) || defined(ARCH_MIPS) || defined(ARCH_BFIN) | |
183 #define UNALIGNED_STORES_ARE_BAD | |
184 #endif | |
185 | |
186 #ifndef ALT_BITSTREAM_WRITER | 182 #ifndef ALT_BITSTREAM_WRITER |
187 static inline void put_bits(PutBitContext *s, int n, unsigned int value) | 183 static inline void put_bits(PutBitContext *s, int n, unsigned int value) |
188 { | 184 { |
189 unsigned int bit_buf; | 185 unsigned int bit_buf; |
190 int bit_left; | 186 int bit_left; |
198 // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); | 194 // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); |
199 /* XXX: optimize */ | 195 /* XXX: optimize */ |
200 #ifdef BITSTREAM_WRITER_LE | 196 #ifdef BITSTREAM_WRITER_LE |
201 bit_buf |= value << (32 - bit_left); | 197 bit_buf |= value << (32 - bit_left); |
202 if (n >= bit_left) { | 198 if (n >= bit_left) { |
203 #ifdef UNALIGNED_STORES_ARE_BAD | 199 #ifndef HAVE_FAST_UNALIGNED |
204 if (3 & (intptr_t) s->buf_ptr) { | 200 if (3 & (intptr_t) s->buf_ptr) { |
205 s->buf_ptr[0] = bit_buf ; | 201 s->buf_ptr[0] = bit_buf ; |
206 s->buf_ptr[1] = bit_buf >> 8; | 202 s->buf_ptr[1] = bit_buf >> 8; |
207 s->buf_ptr[2] = bit_buf >> 16; | 203 s->buf_ptr[2] = bit_buf >> 16; |
208 s->buf_ptr[3] = bit_buf >> 24; | 204 s->buf_ptr[3] = bit_buf >> 24; |
219 bit_buf = (bit_buf<<n) | value; | 215 bit_buf = (bit_buf<<n) | value; |
220 bit_left-=n; | 216 bit_left-=n; |
221 } else { | 217 } else { |
222 bit_buf<<=bit_left; | 218 bit_buf<<=bit_left; |
223 bit_buf |= value >> (n - bit_left); | 219 bit_buf |= value >> (n - bit_left); |
224 #ifdef UNALIGNED_STORES_ARE_BAD | 220 #ifndef HAVE_FAST_UNALIGNED |
225 if (3 & (intptr_t) s->buf_ptr) { | 221 if (3 & (intptr_t) s->buf_ptr) { |
226 s->buf_ptr[0] = bit_buf >> 24; | 222 s->buf_ptr[0] = bit_buf >> 24; |
227 s->buf_ptr[1] = bit_buf >> 16; | 223 s->buf_ptr[1] = bit_buf >> 16; |
228 s->buf_ptr[2] = bit_buf >> 8; | 224 s->buf_ptr[2] = bit_buf >> 8; |
229 s->buf_ptr[3] = bit_buf ; | 225 s->buf_ptr[3] = bit_buf ; |