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

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: rename IsOutOfBuffer to IsValid 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
« no previous file with comments | « media/BUILD.gn ('k') | media/filters/vp9_raw_bits_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 don't go beyond the end of buffer.
Pawel Osciak 2015/08/05 07:08:57 This is not only the last read, but any read since
kcwu 2015/08/05 07:34:44 Done. As your suggestion, just s/any/none/
30 bool IsValid() const { return valid_; }
31
32 // Returns how many bytes were read since the last Initialize() call.
33 // Partial bytes will be counted as one byte. For example, it will return 1
34 // if 3 bits were read.
35 size_t GetBytesRead() const;
36
37 // Reads one bit.
38 // If the read goes beyond the end of buffer, the return value is undefined.
39 int ReadBit();
40
41 // Reads a literal with |bits| bits.
42 // If the read goes beyond the end of buffer, the return value is undefined.
43 int ReadLiteral(int bits);
44
45 // Reads a signed literal with |bits| bits (not including the sign bit).
46 // If the read goes beyond the end of buffer, the return value is undefined.
47 int ReadSignedLiteral(int bits);
48
49 private:
50 scoped_ptr<BitReader> reader_;
51
52 // Indicates error status that the caller reads beyond the end of input
Pawel Osciak 2015/08/05 07:08:57 This comment needs an update.
kcwu 2015/08/05 07:34:44 Done.
53 // buffer.
54 bool valid_;
55
56 DISALLOW_COPY_AND_ASSIGN(Vp9RawBitsReader);
57 };
58
59 } // namespace media
60
61 #endif // MEDIA_FILTERS_VP9_RAW_BITS_READER_
OLDNEW
« no previous file with comments | « media/BUILD.gn ('k') | media/filters/vp9_raw_bits_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698