Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: webrtc/modules/video_coding/utility/vp9_uncompressed_header_parser.h

Issue 2891803003: Add vp9 QP parser. (Closed)
Patch Set: Refactor. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 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
11 #ifndef WEBRTC_MODULES_VIDEO_CODING_UTILITY_VP9_UNCOMPRESSED_HEADER_PARSER_H_
12 #define WEBRTC_MODULES_VIDEO_CODING_UTILITY_VP9_UNCOMPRESSED_HEADER_PARSER_H_
13
14 #include <stddef.h>
15 #include <stdint.h>
16
17 #include "webrtc/base/bitbuffer.h"
18 #include "webrtc/base/logging.h"
19
20 namespace webrtc {
21
22 namespace vp9 {
23
24 class VP9BitReader : public ::rtc::BitBuffer {
25 public:
26 VP9BitReader(const uint8_t* buffer, size_t length_)
27 : BitBuffer(buffer, length_) {}
28
29 uint32_t GetBit() {
30 uint32_t bit = 0;
31 if (ReadBits(&bit, 1))
32 return bit;
33
34 LOG(LS_WARNING) << "Failed to get bit. Reached EOF.";
35 return 0;
36 }
37
38 uint32_t GetValue(int bits) {
39 uint32_t value = 0;
40 if (ReadBits(&value, bits))
41 return value;
42
43 LOG(LS_WARNING) << "Failed to get bit. Reached EOF.";
44 return 0;
45 }
46
47 int32_t GetSignedValue(int bits) {
48 const int32_t value = static_cast<int>(GetValue(bits));
49 return GetBit() ? -value : value;
50 }
51 };
52
53 // Gets the QP, QP range: [0, 255].
54 // Returns true on success, false otherwise.
55 bool GetQp(const uint8_t* buf, size_t length, int* qp);
56
57 } // namespace vp9
58
59 } // namespace webrtc
60
61 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_VP9_UNCOMPRESSED_HEADER_PARSER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/qp_parser.cc ('k') | webrtc/modules/video_coding/utility/vp9_uncompressed_header_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698