| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 | 11 |
| 12 #ifndef VP8_DECODER_DBOOLHUFF_H_ | 12 #ifndef VP8_DECODER_DBOOLHUFF_H_ |
| 13 #define VP8_DECODER_DBOOLHUFF_H_ | 13 #define VP8_DECODER_DBOOLHUFF_H_ |
| 14 | 14 |
| 15 #include <stddef.h> | 15 #include <stddef.h> |
| 16 #include <limits.h> | 16 #include <limits.h> |
| 17 | 17 |
| 18 #include "vpx_config.h" | 18 #include "./vpx_config.h" |
| 19 #include "vpx_ports/mem.h" | 19 #include "vpx_ports/mem.h" |
| 20 #include "vpx/vp8dx.h" | 20 #include "vpx/vp8dx.h" |
| 21 #include "vpx/vpx_integer.h" | 21 #include "vpx/vpx_integer.h" |
| 22 | 22 |
| 23 #ifdef __cplusplus | 23 #ifdef __cplusplus |
| 24 extern "C" { | 24 extern "C" { |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 typedef size_t VP8_BD_VALUE; | 27 typedef size_t VP8_BD_VALUE; |
| 28 | 28 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 value <<= shift; | 88 value <<= shift; |
| 89 count -= shift; | 89 count -= shift; |
| 90 } | 90 } |
| 91 br->value = value; | 91 br->value = value; |
| 92 br->count = count; | 92 br->count = count; |
| 93 br->range = range; | 93 br->range = range; |
| 94 | 94 |
| 95 return bit; | 95 return bit; |
| 96 } | 96 } |
| 97 | 97 |
| 98 static int vp8_decode_value(BOOL_DECODER *br, int bits) | 98 static INLINE int vp8_decode_value(BOOL_DECODER *br, int bits) |
| 99 { | 99 { |
| 100 int z = 0; | 100 int z = 0; |
| 101 int bit; | 101 int bit; |
| 102 | 102 |
| 103 for (bit = bits - 1; bit >= 0; bit--) | 103 for (bit = bits - 1; bit >= 0; bit--) |
| 104 { | 104 { |
| 105 z |= (vp8dx_decode_bool(br, 0x80) << bit); | 105 z |= (vp8dx_decode_bool(br, 0x80) << bit); |
| 106 } | 106 } |
| 107 | 107 |
| 108 return z; | 108 return z; |
| 109 } | 109 } |
| 110 | 110 |
| 111 static int vp8dx_bool_error(BOOL_DECODER *br) | 111 static INLINE int vp8dx_bool_error(BOOL_DECODER *br) |
| 112 { | 112 { |
| 113 /* Check if we have reached the end of the buffer. | 113 /* Check if we have reached the end of the buffer. |
| 114 * | 114 * |
| 115 * Variable 'count' stores the number of bits in the 'value' buffer, minus | 115 * Variable 'count' stores the number of bits in the 'value' buffer, minus |
| 116 * 8. The top byte is part of the algorithm, and the remainder is buffered | 116 * 8. The top byte is part of the algorithm, and the remainder is buffered |
| 117 * to be shifted into it. So if count == 8, the top 16 bits of 'value' are | 117 * to be shifted into it. So if count == 8, the top 16 bits of 'value' are |
| 118 * occupied, 8 for the algorithm and 8 in the buffer. | 118 * occupied, 8 for the algorithm and 8 in the buffer. |
| 119 * | 119 * |
| 120 * When reading a byte from the user's buffer, count is filled with 8 and | 120 * When reading a byte from the user's buffer, count is filled with 8 and |
| 121 * one byte is filled into the value buffer. When we reach the end of the | 121 * one byte is filled into the value buffer. When we reach the end of the |
| (...skipping 10 matching lines...) Expand all Loading... |
| 132 | 132 |
| 133 /* No error. */ | 133 /* No error. */ |
| 134 return 0; | 134 return 0; |
| 135 } | 135 } |
| 136 | 136 |
| 137 #ifdef __cplusplus | 137 #ifdef __cplusplus |
| 138 } // extern "C" | 138 } // extern "C" |
| 139 #endif | 139 #endif |
| 140 | 140 |
| 141 #endif // VP8_DECODER_DBOOLHUFF_H_ | 141 #endif // VP8_DECODER_DBOOLHUFF_H_ |
| OLD | NEW |