vp8_header_parser.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #ifndef MODULES_VIDEO_CODING_UTILITY_VP8_HEADER_PARSER_H_
  11. #define MODULES_VIDEO_CODING_UTILITY_VP8_HEADER_PARSER_H_
  12. #include <stdint.h>
  13. #include <stdio.h>
  14. namespace webrtc {
  15. namespace vp8 {
  16. typedef struct VP8BitReader VP8BitReader;
  17. struct VP8BitReader {
  18. // Boolean decoder.
  19. uint32_t value_; // Current value (2 bytes).
  20. uint32_t range_; // Current range (always in [128..255] interval).
  21. int bits_; // Number of bits shifted out of value, at most 7.
  22. // Read buffer.
  23. const uint8_t* buf_; // Next byte to be read.
  24. const uint8_t* buf_end_; // End of read buffer.
  25. };
  26. // Gets the QP, QP range: [0, 127].
  27. // Returns true on success, false otherwise.
  28. bool GetQp(const uint8_t* buf, size_t length, int* qp);
  29. } // namespace vp8
  30. } // namespace webrtc
  31. #endif // MODULES_VIDEO_CODING_UTILITY_VP8_HEADER_PARSER_H_