Revision 67c1b32f

View differences:

libavcodec/bitstream.h
31 31
#include <assert.h>
32 32
#include "common.h"
33 33
#include "bswap.h"
34
#include "intreadwrite.h"
34 35
#include "log.h"
35 36

  
36 37
#if defined(ALT_BITSTREAM_READER_LE) && !defined(ALT_BITSTREAM_READER)
......
406 407
for examples see get_bits, show_bits, skip_bits, get_vlc
407 408
*/
408 409

  
409
static inline int unaligned32_be(const void *v)
410
{
411
#ifdef CONFIG_ALIGN
412
        const uint8_t *p=v;
413
        return (((p[0]<<8) | p[1])<<16) | (p[2]<<8) | (p[3]);
414
#else
415
        return be2me_32( unaligned32(v)); //original
416
#endif
417
}
418

  
419
static inline int unaligned32_le(const void *v)
420
{
421
#ifdef CONFIG_ALIGN
422
       const uint8_t *p=v;
423
       return (((p[3]<<8) | p[2])<<16) | (p[1]<<8) | (p[0]);
424
#else
425
       return le2me_32( unaligned32(v)); //original
426
#endif
427
}
428

  
429 410
#ifdef ALT_BITSTREAM_READER
430 411
#   define MIN_CACHE_BITS 25
431 412

  
......
438 419

  
439 420
# ifdef ALT_BITSTREAM_READER_LE
440 421
#   define UPDATE_CACHE(name, gb)\
441
        name##_cache= unaligned32_le( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) >> (name##_index&0x07);\
422
        name##_cache= AV_RL32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) >> (name##_index&0x07);\
442 423

  
443 424
#   define SKIP_CACHE(name, gb, num)\
444 425
        name##_cache >>= (num);
445 426
# else
446 427
#   define UPDATE_CACHE(name, gb)\
447
        name##_cache= unaligned32_be( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) << (name##_index&0x07);\
428
        name##_cache= AV_RB32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) << (name##_index&0x07);\
448 429

  
449 430
#   define SKIP_CACHE(name, gb, num)\
450 431
        name##_cache <<= (num);

Also available in: Unified diff