blob: dbad999dc89fb10f8733b4a7ba5b4e13d192ce10 [file] [log] [blame]
jackychen98d8cf52015-05-21 11:12:02 -07001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_VIDEO_CODING_UTILITY_VP8_HEADER_PARSER_H_
12#define MODULES_VIDEO_CODING_UTILITY_VP8_HEADER_PARSER_H_
jackychen98d8cf52015-05-21 11:12:02 -070013
pbos854e84c2015-11-16 16:39:06 -080014#include <stdint.h>
15#include <stdio.h>
16
jackychen98d8cf52015-05-21 11:12:02 -070017namespace webrtc {
18
19namespace vp8 {
20
jackychen98d8cf52015-05-21 11:12:02 -070021typedef struct VP8BitReader VP8BitReader;
22struct VP8BitReader {
23 // Boolean decoder.
Ilya Nikolaevskiyae922442020-03-02 15:04:55 +010024 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.
jackychen98d8cf52015-05-21 11:12:02 -070027 // Read buffer.
philipel5908c712015-12-21 08:23:20 -080028 const uint8_t* buf_; // Next byte to be read.
29 const uint8_t* buf_end_; // End of read buffer.
jackychen98d8cf52015-05-21 11:12:02 -070030};
31
asapersson86b01602015-10-20 23:55:26 -070032// Gets the QP, QP range: [0, 127].
33// Returns true on success, false otherwise.
34bool GetQp(const uint8_t* buf, size_t length, int* qp);
jackychen98d8cf52015-05-21 11:12:02 -070035
36} // namespace vp8
37
38} // namespace webrtc
39
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020040#endif // MODULES_VIDEO_CODING_UTILITY_VP8_HEADER_PARSER_H_