Guest User

Untitled

a guest
Aug 30th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 6.54 KB | None | 0 0
  1. diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
  2. index 58ebb64656..92daf4362e 100644
  3. --- a/libavcodec/get_bits.h
  4. +++ b/libavcodec/get_bits.h
  5. @@ -54,9 +54,13 @@
  6.  #define UNCHECKED_BITSTREAM_READER !CONFIG_SAFE_BITSTREAM_READER
  7.  #endif
  8.  
  9. +#ifndef CACHED_BITSTREAM_READER
  10. +#define CACHED_BITSTREAM_READER 0
  11. +#endif
  12. +
  13.  typedef struct GetBitContext {
  14.      const uint8_t *buffer, *buffer_end;
  15. -#ifdef CACHED_BITSTREAM_READER
  16. +#if CACHED_BITSTREAM_READER
  17.      uint64_t cache;
  18.      unsigned bits_left;
  19.  #endif
  20. @@ -116,7 +120,7 @@ static inline unsigned int show_bits(GetBitContext *s, int n);
  21.   * For examples see get_bits, show_bits, skip_bits, get_vlc.
  22.   */
  23.  
  24. -#ifdef CACHED_BITSTREAM_READER
  25. +#if CACHED_BITSTREAM_READER
  26.  #   define MIN_CACHE_BITS 64
  27.  #elif defined LONG_BITSTREAM_READER
  28.  #   define MIN_CACHE_BITS 32
  29. @@ -214,14 +218,14 @@ static inline unsigned int show_bits(GetBitContext *s, int n);
  30.  
  31.  static inline int get_bits_count(const GetBitContext *s)
  32.  {
  33. -#ifdef CACHED_BITSTREAM_READER
  34. +#if CACHED_BITSTREAM_READER
  35.      return s->index - s->bits_left;
  36.  #else
  37.      return s->index;
  38.  #endif
  39.  }
  40.  
  41. -#ifdef CACHED_BITSTREAM_READER
  42. +#if CACHED_BITSTREAM_READER
  43.  static inline void refill_32(GetBitContext *s)
  44.  {
  45.  #if !UNCHECKED_BITSTREAM_READER
  46. @@ -288,7 +292,7 @@ static inline unsigned show_val(const GetBitContext *s, unsigned n)
  47.   */
  48.  static inline void skip_bits_long(GetBitContext *s, int n)
  49.  {
  50. -#ifdef CACHED_BITSTREAM_READER
  51. +#if CACHED_BITSTREAM_READER
  52.      skip_bits(s, n);
  53.  #else
  54.  #if UNCHECKED_BITSTREAM_READER
  55. @@ -299,7 +303,7 @@ static inline void skip_bits_long(GetBitContext *s, int n)
  56.  #endif
  57.  }
  58.  
  59. -#ifdef CACHED_BITSTREAM_READER
  60. +#if CACHED_BITSTREAM_READER
  61.  static inline void skip_remaining(GetBitContext *s, unsigned n)
  62.  {
  63.  #ifdef BITSTREAM_READER_LE
  64. @@ -318,7 +322,7 @@ static inline void skip_remaining(GetBitContext *s, unsigned n)
  65.   */
  66.  static inline int get_xbits(GetBitContext *s, int n)
  67.  {
  68. -#ifdef CACHED_BITSTREAM_READER
  69. +#if CACHED_BITSTREAM_READER
  70.      int32_t cache = show_bits(s, 32);
  71.      int sign = ~cache >> 31;
  72.      skip_remaining(s, n);
  73. @@ -357,7 +361,7 @@ static inline int get_xbits_le(GetBitContext *s, int n)
  74.  static inline int get_sbits(GetBitContext *s, int n)
  75.  {
  76.      register int tmp;
  77. -#ifdef CACHED_BITSTREAM_READER
  78. +#if CACHED_BITSTREAM_READER
  79.      av_assert2(n>0 && n<=25);
  80.      tmp = sign_extend(get_bits(s, n), n);
  81.  #else
  82. @@ -377,7 +381,7 @@ static inline int get_sbits(GetBitContext *s, int n)
  83.  static inline unsigned int get_bits(GetBitContext *s, int n)
  84.  {
  85.      register int tmp;
  86. -#ifdef CACHED_BITSTREAM_READER
  87. +#if CACHED_BITSTREAM_READER
  88.  
  89.      av_assert2(n>0 && n<=32);
  90.      if (n > s->bits_left) {
  91. @@ -412,7 +416,7 @@ static av_always_inline int get_bitsz(GetBitContext *s, int n)
  92.  
  93.  static inline unsigned int get_bits_le(GetBitContext *s, int n)
  94.  {
  95. -#ifdef CACHED_BITSTREAM_READER
  96. +#if CACHED_BITSTREAM_READER
  97.      av_assert2(n>0 && n<=32);
  98.      if (n > s->bits_left) {
  99.          refill_32(s);
  100. @@ -439,7 +443,7 @@ static inline unsigned int get_bits_le(GetBitContext *s, int n)
  101.  static inline unsigned int show_bits(GetBitContext *s, int n)
  102.  {
  103.      register int tmp;
  104. -#ifdef CACHED_BITSTREAM_READER
  105. +#if CACHED_BITSTREAM_READER
  106.      if (n > s->bits_left)
  107.          refill_32(s);
  108.  
  109. @@ -455,7 +459,7 @@ static inline unsigned int show_bits(GetBitContext *s, int n)
  110.  
  111.  static inline void skip_bits(GetBitContext *s, int n)
  112.  {
  113. -#ifdef CACHED_BITSTREAM_READER
  114. +#if CACHED_BITSTREAM_READER
  115.      if (n < s->bits_left)
  116.          skip_remaining(s, n);
  117.      else {
  118. @@ -482,7 +486,7 @@ static inline void skip_bits(GetBitContext *s, int n)
  119.  
  120.  static inline unsigned int get_bits1(GetBitContext *s)
  121.  {
  122. -#ifdef CACHED_BITSTREAM_READER
  123. +#if CACHED_BITSTREAM_READER
  124.      if (!s->bits_left)
  125.          refill_64(s);
  126.  
  127. @@ -529,7 +533,7 @@ static inline unsigned int get_bits_long(GetBitContext *s, int n)
  128.      av_assert2(n>=0 && n<=32);
  129.      if (!n) {
  130.          return 0;
  131. -#ifdef CACHED_BITSTREAM_READER
  132. +#if CACHED_BITSTREAM_READER
  133.      }
  134.      return get_bits(s, n);
  135.  #else
  136. @@ -628,7 +632,7 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
  137.      s->buffer_end         = buffer + buffer_size;
  138.      s->index              = 0;
  139.  
  140. -#ifdef CACHED_BITSTREAM_READER
  141. +#if CACHED_BITSTREAM_READER
  142.      refill_64(s);
  143.  #endif
  144.  
  145. @@ -758,7 +762,7 @@ static inline int set_idx(GetBitContext *s, int code, int *n, int *nb_bits,
  146.  static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2],
  147.                                       int bits, int max_depth)
  148.  {
  149. -#ifdef CACHED_BITSTREAM_READER
  150. +#if CACHED_BITSTREAM_READER
  151.      int nb_bits;
  152.      unsigned idx = show_bits(s, bits);
  153.      int code = table[idx][0];
  154. diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
  155. index e66675b292..5c25883626 100644
  156. --- a/libavcodec/golomb.h
  157. +++ b/libavcodec/golomb.h
  158. @@ -54,7 +54,7 @@ static inline int get_ue_golomb(GetBitContext *gb)
  159.  {
  160.      unsigned int buf;
  161.  
  162. -#ifdef CACHED_BITSTREAM_READER
  163. +#if CACHED_BITSTREAM_READER
  164.      buf = show_bits_long(gb, 32);
  165.  
  166.      if (buf >= (1 << 27)) {
  167. @@ -119,7 +119,7 @@ static inline int get_ue_golomb_31(GetBitContext *gb)
  168.  {
  169.      unsigned int buf;
  170.  
  171. -#ifdef CACHED_BITSTREAM_READER
  172. +#if CACHED_BITSTREAM_READER
  173.      buf = show_bits_long(gb, 32);
  174.  
  175.      buf >>= 32 - 9;
  176. @@ -142,7 +142,7 @@ static inline unsigned get_interleaved_ue_golomb(GetBitContext *gb)
  177.  {
  178.      uint32_t buf;
  179.  
  180. -#ifdef CACHED_BITSTREAM_READER
  181. +#if CACHED_BITSTREAM_READER
  182.      buf = show_bits_long(gb, 32);
  183.  
  184.      if (buf & 0xAA800000) {
  185. @@ -238,7 +238,7 @@ static inline int get_se_golomb(GetBitContext *gb)
  186.  {
  187.      unsigned int buf;
  188.  
  189. -#ifdef CACHED_BITSTREAM_READER
  190. +#if CACHED_BITSTREAM_READER
  191.      buf = show_bits_long(gb, 32);
  192.  
  193.      if (buf >= (1 << 27)) {
  194. @@ -300,7 +300,7 @@ static inline int get_interleaved_se_golomb(GetBitContext *gb)
  195.  {
  196.      unsigned int buf;
  197.  
  198. -#ifdef CACHED_BITSTREAM_READER
  199. +#if CACHED_BITSTREAM_READER
  200.      buf = show_bits_long(gb, 32);
  201.  
  202.      if (buf & 0xAA800000) {
  203. @@ -375,7 +375,7 @@ static inline int get_ur_golomb(GetBitContext *gb, int k, int limit,
  204.      unsigned int buf;
  205.      int log;
  206.  
  207. -#ifdef CACHED_BITSTREAM_READER
  208. +#if CACHED_BITSTREAM_READER
  209.      buf = show_bits_long(gb, 32);
  210.  
  211.      log = av_log2(buf);
  212. @@ -429,7 +429,7 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit,
  213.      unsigned int buf;
  214.      int log;
  215.  
  216. -#ifdef CACHED_BITSTREAM_READER
  217. +#if CACHED_BITSTREAM_READER
  218.      buf = show_bits_long(gb, 32);
  219.  
  220.      log = av_log2(buf);
Advertisement
Add Comment
Please, Sign In to add comment