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 #include "media/filters/vp9_raw_bits_reader.h" | 5 #include "media/filters/vp9_raw_bits_reader.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "media/base/bit_reader.h" | 10 #include "media/base/bit_reader.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 int Vp9RawBitsReader::ReadSignedLiteral(int bits) { | 45 int Vp9RawBitsReader::ReadSignedLiteral(int bits) { |
46 int value = ReadLiteral(bits); | 46 int value = ReadLiteral(bits); |
47 return ReadBool() ? -value : value; | 47 return ReadBool() ? -value : value; |
48 } | 48 } |
49 | 49 |
50 size_t Vp9RawBitsReader::GetBytesRead() const { | 50 size_t Vp9RawBitsReader::GetBytesRead() const { |
51 DCHECK(reader_); | 51 DCHECK(reader_); |
52 return (reader_->bits_read() + 7) / 8; | 52 return (reader_->bits_read() + 7) / 8; |
53 } | 53 } |
54 | 54 |
| 55 bool Vp9RawBitsReader::ConsumeTrailingBits() { |
| 56 DCHECK(reader_); |
| 57 int bits_left = GetBytesRead() * 8 - reader_->bits_read(); |
| 58 return ReadLiteral(bits_left) == 0; |
| 59 } |
| 60 |
55 } // namespace media | 61 } // namespace media |
OLD | NEW |