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

Side by Side Diff: media/filters/vp9_raw_bits_reader.h

Issue 1258083003: Add VP9 raw bits reader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: copyright; nits Created 5 years, 4 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 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_FILTERS_VP9_RAW_BITS_READER_
6 #define MEDIA_FILTERS_VP9_RAW_BITS_READER_
7
8 #include <stddef.h>
9 #include <stdint.h>
10
11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "media/base/media_export.h"
14
15 namespace media {
16
17 class BitReader;
18
19 // A class to read raw bits stream. See VP9 spec, "RAW-BITS DECODING" section
20 // for detail.
21 class MEDIA_EXPORT Vp9RawBitsReader {
22 public:
23 Vp9RawBitsReader();
24 ~Vp9RawBitsReader();
25
26 // |data| is the input buffer with |size| bytes.
27 void Initialize(const uint8_t* data, size_t size);
28
29 // Returns true if last reads go beyond the end of buffer.
30 bool IsOutOfBuffer() const { return out_of_buffer_; }
31
32 // Returns how many bytes read. Partial bytes will be counted as one byte.
Pawel Osciak 2015/08/02 10:46:11 s/how many bytes read/how many bytes were read sin
kcwu 2015/08/03 07:10:13 Done.
33 // For example, it will return 1 if 3 bits read.
Pawel Osciak 2015/08/02 10:46:11 s/read/were read/
kcwu 2015/08/03 07:10:13 Done.
34 size_t GetBytesRead() const;
35
36 // Reads one bit.
37 // If the read goes beyond the end of buffer, the return value is undefined.
38 int ReadBit();
39
40 // Reads a literal with |bits| bits.
41 // If the read goes beyond the end of buffer, the return value is undefined.
42 int ReadLiteral(int bits);
43
44 // Reads a signed literal with |bits| bits (not including the sign bit).
45 // If the read goes beyond the end of buffer, the return value is undefined.
46 int ReadSignedLiteral(int bits);
47
48 private:
49 scoped_ptr<BitReader> reader_;
50
51 // Indicates error status that the caller reads beyond the end of input
52 // buffer.
53 bool out_of_buffer_;
54
55 DISALLOW_COPY_AND_ASSIGN(Vp9RawBitsReader);
56 };
57
58 } // namespace media
59
60 #endif // MEDIA_FILTERS_VP9_RAW_BITS_READER_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698