| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC 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 10 matching lines...) Expand all Loading... |
| 21 enum { | 21 enum { |
| 22 MB_FEATURE_TREE_PROBS = 3, | 22 MB_FEATURE_TREE_PROBS = 3, |
| 23 NUM_MB_SEGMENTS = 4, | 23 NUM_MB_SEGMENTS = 4, |
| 24 NUM_REF_LF_DELTAS = 4, | 24 NUM_REF_LF_DELTAS = 4, |
| 25 NUM_MODE_LF_DELTAS = 4, | 25 NUM_MODE_LF_DELTAS = 4, |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 typedef struct VP8BitReader VP8BitReader; | 28 typedef struct VP8BitReader VP8BitReader; |
| 29 struct VP8BitReader { | 29 struct VP8BitReader { |
| 30 // Boolean decoder. | 30 // Boolean decoder. |
| 31 uint32_t value_; // Current value. | 31 uint32_t value_; // Current value. |
| 32 uint32_t range_; // Current range minus 1. In [127, 254] interval. | 32 uint32_t range_; // Current range minus 1. In [127, 254] interval. |
| 33 int bits_; // Number of valid bits left. | 33 int bits_; // Number of valid bits left. |
| 34 // Read buffer. | 34 // Read buffer. |
| 35 const uint8_t* buf_; // Next byte to be read. | 35 const uint8_t* buf_; // Next byte to be read. |
| 36 const uint8_t* buf_end_; // End of read buffer. | 36 const uint8_t* buf_end_; // End of read buffer. |
| 37 int eof_; // True if input is exhausted. | 37 int eof_; // True if input is exhausted. |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 const uint8_t kVP8Log2Range[128] = { | 40 const uint8_t kVP8Log2Range[128] = { |
| 41 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, | 41 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, |
| 42 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | 42 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 43 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 43 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, |
| 44 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 44 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 45 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 45 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 46 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 46 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}; |
| 47 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
| 48 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
| 49 0 | |
| 50 }; | |
| 51 | 47 |
| 52 // range = ((range - 1) << kVP8Log2Range[range]) + 1 | 48 // range = ((range - 1) << kVP8Log2Range[range]) + 1 |
| 53 const uint8_t kVP8NewRange[128] = { | 49 const uint8_t kVP8NewRange[128] = { |
| 54 127, 127, 191, 127, 159, 191, 223, 127, | 50 127, 127, 191, 127, 159, 191, 223, 127, 143, 159, 175, 191, 207, 223, 239, |
| 55 143, 159, 175, 191, 207, 223, 239, 127, | 51 127, 135, 143, 151, 159, 167, 175, 183, 191, 199, 207, 215, 223, 231, 239, |
| 56 135, 143, 151, 159, 167, 175, 183, 191, | 52 247, 127, 131, 135, 139, 143, 147, 151, 155, 159, 163, 167, 171, 175, 179, |
| 57 199, 207, 215, 223, 231, 239, 247, 127, | 53 183, 187, 191, 195, 199, 203, 207, 211, 215, 219, 223, 227, 231, 235, 239, |
| 58 131, 135, 139, 143, 147, 151, 155, 159, | 54 243, 247, 251, 127, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, |
| 59 163, 167, 171, 175, 179, 183, 187, 191, | 55 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, |
| 60 195, 199, 203, 207, 211, 215, 219, 223, | 56 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209, |
| 61 227, 231, 235, 239, 243, 247, 251, 127, | 57 211, 213, 215, 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, |
| 62 129, 131, 133, 135, 137, 139, 141, 143, | 58 241, 243, 245, 247, 249, 251, 253, 127}; |
| 63 145, 147, 149, 151, 153, 155, 157, 159, | |
| 64 161, 163, 165, 167, 169, 171, 173, 175, | |
| 65 177, 179, 181, 183, 185, 187, 189, 191, | |
| 66 193, 195, 197, 199, 201, 203, 205, 207, | |
| 67 209, 211, 213, 215, 217, 219, 221, 223, | |
| 68 225, 227, 229, 231, 233, 235, 237, 239, | |
| 69 241, 243, 245, 247, 249, 251, 253, 127 | |
| 70 }; | |
| 71 | 59 |
| 72 // Gets the QP, QP range: [0, 127]. | 60 // Gets the QP, QP range: [0, 127]. |
| 73 // Returns true on success, false otherwise. | 61 // Returns true on success, false otherwise. |
| 74 bool GetQp(const uint8_t* buf, size_t length, int* qp); | 62 bool GetQp(const uint8_t* buf, size_t length, int* qp); |
| 75 | 63 |
| 76 } // namespace vp8 | 64 } // namespace vp8 |
| 77 | 65 |
| 78 } // namespace webrtc | 66 } // namespace webrtc |
| 79 | 67 |
| 80 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_VP8_HEADER_PARSER_H_ | 68 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_VP8_HEADER_PARSER_H_ |
| OLD | NEW |