Mercurial > libavcodec.hg
comparison common.c @ 144:cb5dabd00ba2 libavcodec
- Bug fix on inter MCBPC table for inter+q.
- H.263/H.263+ decoder now knows GOB start codes.
- H.263/H.263+ decoder now returns the size of the stream on the first call.
- Added show_bits() functions to see the buffer without loosing the bits.
- TODO: H.263v1 UMV parsing is buggy.
author | pulento |
---|---|
date | Sat, 03 Nov 2001 00:49:53 +0000 |
parents | 5aa6292a1660 |
children | 1e5f64be86fc |
comparison
equal
deleted
inserted
replaced
143:35e3ced6cfd9 | 144:cb5dabd00ba2 |
---|---|
248 n = s->bit_cnt & 7; | 248 n = s->bit_cnt & 7; |
249 if (n > 0) { | 249 if (n > 0) { |
250 get_bits(s, n); | 250 get_bits(s, n); |
251 } | 251 } |
252 } | 252 } |
253 /* This function is identical to get_bits_long(), the */ | |
254 /* only diference is that it doesn't touch the buffer */ | |
255 /* it is usefull to see the buffer. */ | |
256 | |
257 unsigned int show_bits_long(GetBitContext *s, int n) | |
258 { | |
259 unsigned int val; | |
260 int bit_cnt; | |
261 unsigned int bit_buf; | |
262 UINT8 *buf_ptr; | |
263 | |
264 bit_buf = s->bit_buf; | |
265 bit_cnt = s->bit_cnt - n; | |
266 | |
267 val = bit_buf >> (32 - n); | |
268 buf_ptr = s->buf_ptr; | |
269 buf_ptr += 4; | |
270 | |
271 /* handle common case: we can read everything */ | |
272 if (buf_ptr <= s->buf_end) { | |
273 #ifdef ARCH_X86 | |
274 bit_buf = bswap_32(*((unsigned long*)(&buf_ptr[-4]))); | |
275 #else | |
276 bit_buf = (buf_ptr[-4] << 24) | | |
277 (buf_ptr[-3] << 16) | | |
278 (buf_ptr[-2] << 8) | | |
279 (buf_ptr[-1]); | |
280 #endif | |
281 } else { | |
282 buf_ptr -= 4; | |
283 bit_buf = 0; | |
284 if (buf_ptr < s->buf_end) | |
285 bit_buf |= *buf_ptr++ << 24; | |
286 if (buf_ptr < s->buf_end) | |
287 bit_buf |= *buf_ptr++ << 16; | |
288 if (buf_ptr < s->buf_end) | |
289 bit_buf |= *buf_ptr++ << 8; | |
290 if (buf_ptr < s->buf_end) | |
291 bit_buf |= *buf_ptr++; | |
292 } | |
293 val |= bit_buf >> (32 + bit_cnt); | |
294 bit_buf <<= - bit_cnt; | |
295 bit_cnt += 32; | |
296 | |
297 return val; | |
298 } | |
253 | 299 |
254 /* VLC decoding */ | 300 /* VLC decoding */ |
255 | 301 |
256 //#define DEBUG_VLC | 302 //#define DEBUG_VLC |
257 | 303 |