| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_FILTERS_VP9_RAW_BITS_READER_ | 5 #ifndef MEDIA_FILTERS_VP9_RAW_BITS_READER_ |
| 6 #define MEDIA_FILTERS_VP9_RAW_BITS_READER_ | 6 #define MEDIA_FILTERS_VP9_RAW_BITS_READER_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // gone beyond the end of available data. | 30 // gone beyond the end of available data. |
| 31 bool IsValid() const { return valid_; } | 31 bool IsValid() const { return valid_; } |
| 32 | 32 |
| 33 // Returns how many bytes were read since the last Initialize() call. | 33 // Returns how many bytes were read since the last Initialize() call. |
| 34 // Partial bytes will be counted as one byte. For example, it will return 1 | 34 // Partial bytes will be counted as one byte. For example, it will return 1 |
| 35 // if 3 bits were read. | 35 // if 3 bits were read. |
| 36 size_t GetBytesRead() const; | 36 size_t GetBytesRead() const; |
| 37 | 37 |
| 38 // Reads one bit. | 38 // Reads one bit. |
| 39 // If the read goes beyond the end of buffer, the return value is undefined. | 39 // If the read goes beyond the end of buffer, the return value is undefined. |
| 40 int ReadBit(); | 40 bool ReadBool(); |
| 41 | 41 |
| 42 // Reads a literal with |bits| bits. | 42 // Reads a literal with |bits| bits. |
| 43 // If the read goes beyond the end of buffer, the return value is undefined. | 43 // If the read goes beyond the end of buffer, the return value is undefined. |
| 44 int ReadLiteral(int bits); | 44 int ReadLiteral(int bits); |
| 45 | 45 |
| 46 // Reads a signed literal with |bits| bits (not including the sign bit). | 46 // Reads a signed literal with |bits| bits (not including the sign bit). |
| 47 // If the read goes beyond the end of buffer, the return value is undefined. | 47 // If the read goes beyond the end of buffer, the return value is undefined. |
| 48 int ReadSignedLiteral(int bits); | 48 int ReadSignedLiteral(int bits); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 scoped_ptr<BitReader> reader_; | 51 scoped_ptr<BitReader> reader_; |
| 52 | 52 |
| 53 // Indicates if none of the reads since the last Initialize() call has gone | 53 // Indicates if none of the reads since the last Initialize() call has gone |
| 54 // beyond the end of available data. | 54 // beyond the end of available data. |
| 55 bool valid_; | 55 bool valid_; |
| 56 | 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(Vp9RawBitsReader); | 57 DISALLOW_COPY_AND_ASSIGN(Vp9RawBitsReader); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 } // namespace media | 60 } // namespace media |
| 61 | 61 |
| 62 #endif // MEDIA_FILTERS_VP9_RAW_BITS_READER_ | 62 #endif // MEDIA_FILTERS_VP9_RAW_BITS_READER_ |
| OLD | NEW |