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

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..8d83c944663d29f9677ef00e6e9d6e3765e395a7
--- /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 QP. Reached EOF.";
brandtr 2017/05/23 08:59:02 Since this is a general bit reader, maybe make the
jianj1 2017/05/23 17:37:30 Done.
+ return 0;
+ }
+
+ uint32_t GetValue(int bits) {
+ uint32_t value = 0;
+ if (ReadBits(&value, bits))
+ return value;
+
+ LOG(LS_WARNING) << "Failed to get QP. Reached EOF.";
brandtr 2017/05/23 08:59:02 And here.
jianj1 2017/05/23 17:37:30 Done.
+ 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);
brandtr 2017/05/23 08:59:02 int* qp
jianj1 2017/05/23 17:37:30 Done.
+
+} // namespace vp9
+
+} // namespace webrtc
+
+#endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_VP9_UNCOMPRESSED_HEADER_PARSER_H_

Powered by Google App Engine
This is Rietveld 408576698