| 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 #ifndef VP9_DECODER_VP9_DBOOLHUFF_H_ | 11 #ifndef VP9_DECODER_VP9_DBOOLHUFF_H_ |
| 12 #define VP9_DECODER_VP9_DBOOLHUFF_H_ | 12 #define VP9_DECODER_VP9_DBOOLHUFF_H_ |
| 13 | 13 |
| 14 #include <stddef.h> | 14 #include <stddef.h> |
| 15 #include <limits.h> | 15 #include <limits.h> |
| 16 | 16 |
| 17 #include "./vpx_config.h" | 17 #include "./vpx_config.h" |
| 18 #include "vpx_ports/mem.h" | 18 #include "vpx_ports/mem.h" |
| 19 #include "vpx/vpx_integer.h" | 19 #include "vpx/vpx_integer.h" |
| 20 | 20 |
| 21 typedef size_t VP9_BD_VALUE; | 21 typedef size_t VP9_BD_VALUE; |
| 22 | 22 |
| 23 #define VP9_BD_VALUE_SIZE ((int)sizeof(VP9_BD_VALUE)*CHAR_BIT) | 23 #define BD_VALUE_SIZE ((int)sizeof(VP9_BD_VALUE)*CHAR_BIT) |
| 24 | 24 |
| 25 typedef struct { | 25 typedef struct { |
| 26 const uint8_t *buffer_end; | 26 const uint8_t *buffer_end; |
| 27 const uint8_t *buffer; | 27 const uint8_t *buffer; |
| 28 VP9_BD_VALUE value; | 28 VP9_BD_VALUE value; |
| 29 int count; | 29 int count; |
| 30 unsigned int range; | 30 unsigned int range; |
| 31 } vp9_reader; | 31 } vp9_reader; |
| 32 | 32 |
| 33 DECLARE_ALIGNED(16, extern const uint8_t, vp9_norm[256]); | 33 DECLARE_ALIGNED(16, extern const uint8_t, vp9_norm[256]); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 45 int count; | 45 int count; |
| 46 unsigned int range; | 46 unsigned int range; |
| 47 unsigned int split = 1 + (((br->range - 1) * probability) >> 8); | 47 unsigned int split = 1 + (((br->range - 1) * probability) >> 8); |
| 48 | 48 |
| 49 if (br->count < 0) | 49 if (br->count < 0) |
| 50 vp9_reader_fill(br); | 50 vp9_reader_fill(br); |
| 51 | 51 |
| 52 value = br->value; | 52 value = br->value; |
| 53 count = br->count; | 53 count = br->count; |
| 54 | 54 |
| 55 bigsplit = (VP9_BD_VALUE)split << (VP9_BD_VALUE_SIZE - 8); | 55 bigsplit = (VP9_BD_VALUE)split << (BD_VALUE_SIZE - 8); |
| 56 | 56 |
| 57 range = split; | 57 range = split; |
| 58 | 58 |
| 59 if (value >= bigsplit) { | 59 if (value >= bigsplit) { |
| 60 range = br->range - split; | 60 range = br->range - split; |
| 61 value = value - bigsplit; | 61 value = value - bigsplit; |
| 62 bit = 1; | 62 bit = 1; |
| 63 } | 63 } |
| 64 | 64 |
| 65 { | 65 { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 84 | 84 |
| 85 for (bit = bits - 1; bit >= 0; bit--) | 85 for (bit = bits - 1; bit >= 0; bit--) |
| 86 z |= vp9_read_bit(br) << bit; | 86 z |= vp9_read_bit(br) << bit; |
| 87 | 87 |
| 88 return z; | 88 return z; |
| 89 } | 89 } |
| 90 | 90 |
| 91 int vp9_reader_has_error(vp9_reader *r); | 91 int vp9_reader_has_error(vp9_reader *r); |
| 92 | 92 |
| 93 #endif // VP9_DECODER_VP9_DBOOLHUFF_H_ | 93 #endif // VP9_DECODER_VP9_DBOOLHUFF_H_ |
| OLD | NEW |