jackychen | 98d8cf5 | 2015-05-21 11:12:02 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef MODULES_VIDEO_CODING_UTILITY_VP8_HEADER_PARSER_H_ |
| 12 | #define MODULES_VIDEO_CODING_UTILITY_VP8_HEADER_PARSER_H_ |
jackychen | 98d8cf5 | 2015-05-21 11:12:02 -0700 | [diff] [blame] | 13 | |
pbos | 854e84c | 2015-11-16 16:39:06 -0800 | [diff] [blame] | 14 | #include <stdint.h> |
| 15 | #include <stdio.h> |
| 16 | |
jackychen | 98d8cf5 | 2015-05-21 11:12:02 -0700 | [diff] [blame] | 17 | namespace webrtc { |
| 18 | |
| 19 | namespace vp8 { |
| 20 | |
jackychen | 98d8cf5 | 2015-05-21 11:12:02 -0700 | [diff] [blame] | 21 | typedef struct VP8BitReader VP8BitReader; |
| 22 | struct VP8BitReader { |
| 23 | // Boolean decoder. |
Ilya Nikolaevskiy | ae92244 | 2020-03-02 15:04:55 +0100 | [diff] [blame] | 24 | uint32_t value_; // Current value (2 bytes). |
| 25 | uint32_t range_; // Current range (always in [128..255] interval). |
| 26 | int bits_; // Number of bits shifted out of value, at most 7. |
jackychen | 98d8cf5 | 2015-05-21 11:12:02 -0700 | [diff] [blame] | 27 | // Read buffer. |
philipel | 5908c71 | 2015-12-21 08:23:20 -0800 | [diff] [blame] | 28 | const uint8_t* buf_; // Next byte to be read. |
| 29 | const uint8_t* buf_end_; // End of read buffer. |
jackychen | 98d8cf5 | 2015-05-21 11:12:02 -0700 | [diff] [blame] | 30 | }; |
| 31 | |
asapersson | 86b0160 | 2015-10-20 23:55:26 -0700 | [diff] [blame] | 32 | // Gets the QP, QP range: [0, 127]. |
| 33 | // Returns true on success, false otherwise. |
| 34 | bool GetQp(const uint8_t* buf, size_t length, int* qp); |
jackychen | 98d8cf5 | 2015-05-21 11:12:02 -0700 | [diff] [blame] | 35 | |
| 36 | } // namespace vp8 |
| 37 | |
| 38 | } // namespace webrtc |
| 39 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 40 | #endif // MODULES_VIDEO_CODING_UTILITY_VP8_HEADER_PARSER_H_ |