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 |
(...skipping 26 matching lines...) Expand all Loading... |
37 void vp9_start_encode(vp9_writer *bc, uint8_t *buffer); | 37 void vp9_start_encode(vp9_writer *bc, uint8_t *buffer); |
38 void vp9_stop_encode(vp9_writer *bc); | 38 void vp9_stop_encode(vp9_writer *bc); |
39 | 39 |
40 static void vp9_write(vp9_writer *br, int bit, int probability) { | 40 static void vp9_write(vp9_writer *br, int bit, int probability) { |
41 unsigned int split; | 41 unsigned int split; |
42 int count = br->count; | 42 int count = br->count; |
43 unsigned int range = br->range; | 43 unsigned int range = br->range; |
44 unsigned int lowvalue = br->lowvalue; | 44 unsigned int lowvalue = br->lowvalue; |
45 register unsigned int shift; | 45 register unsigned int shift; |
46 | 46 |
47 #ifdef ENTROPY_STATS | |
48 #if defined(SECTIONBITS_OUTPUT) | |
49 | |
50 if (bit) | |
51 Sectionbits[active_section] += vp9_prob_cost[255 - probability]; | |
52 else | |
53 Sectionbits[active_section] += vp9_prob_cost[probability]; | |
54 | |
55 #endif | |
56 #endif | |
57 | |
58 split = 1 + (((range - 1) * probability) >> 8); | 47 split = 1 + (((range - 1) * probability) >> 8); |
59 | 48 |
60 range = split; | 49 range = split; |
61 | 50 |
62 if (bit) { | 51 if (bit) { |
63 lowvalue += split; | 52 lowvalue += split; |
64 range = br->range - split; | 53 range = br->range - split; |
65 } | 54 } |
66 | 55 |
67 shift = vp9_norm[range]; | 56 shift = vp9_norm[range]; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 vp9_write_bit(w, 1 & (data >> bit)); | 96 vp9_write_bit(w, 1 & (data >> bit)); |
108 } | 97 } |
109 | 98 |
110 #define vp9_write_prob(w, v) vp9_write_literal((w), (v), 8) | 99 #define vp9_write_prob(w, v) vp9_write_literal((w), (v), 8) |
111 | 100 |
112 #ifdef __cplusplus | 101 #ifdef __cplusplus |
113 } // extern "C" | 102 } // extern "C" |
114 #endif | 103 #endif |
115 | 104 |
116 #endif // VP9_ENCODER_VP9_WRITER_H_ | 105 #endif // VP9_ENCODER_VP9_WRITER_H_ |
OLD | NEW |