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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_coding/utility/vp9_uncompressed_header_parser.h
diff --git a/webrtc/modules/video_coding/utility/vp9_uncompressed_header_parser.h b/webrtc/modules/video_coding/utility/vp9_uncompressed_header_parser.h
new file mode 100644
index 0000000000000000000000000000000000000000..ef6f268e51c487db28511cee277349ecb9b5d9e5
--- /dev/null
+++ b/webrtc/modules/video_coding/utility/vp9_uncompressed_header_parser.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_MODULES_VIDEO_CODING_UTILITY_VP9_UNCOMPRESSED_HEADER_PARSER_H_
+#define WEBRTC_MODULES_VIDEO_CODING_UTILITY_VP9_UNCOMPRESSED_HEADER_PARSER_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "webrtc/base/bitbuffer.h"
+#include "webrtc/base/logging.h"
+
+namespace webrtc {
+
+namespace vp9 {
+
+class VP9BitReader : public ::rtc::BitBuffer {
+ public:
+ VP9BitReader(const uint8_t* buffer, size_t length_)
+ : BitBuffer(buffer, length_) {}
+
+ uint32_t GetBit() {
+ uint32_t bit = 0;
+ if (ReadBits(&bit, 1))
+ return bit;
+
+ LOG(LS_WARNING) << "Failed to get bit. Reached EOF.";
+ return 0;
+ }
+
+ uint32_t GetValue(int bits) {
+ uint32_t value = 0;
+ if (ReadBits(&value, bits))
+ return value;
+
+ LOG(LS_WARNING) << "Failed to get bit. Reached EOF.";
+ return 0;
+ }
+
+ int32_t GetSignedValue(int bits) {
+ const int32_t value = static_cast<int>(GetValue(bits));
+ return GetBit() ? -value : value;
+ }
+};
+
+// Gets the QP, QP range: [0, 255].
+// Returns true on success, false otherwise.
+bool GetQp(const uint8_t* buf, size_t length, int* qp);
+
+} // namespace vp9
+
+} // namespace webrtc
+
+#endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_VP9_UNCOMPRESSED_HEADER_PARSER_H_
« 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