| 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "media/cast/sender/vp8_quantizer_parser.h" | 7 #include "media/cast/sender/vp8_quantizer_parser.h" |
| 8 | 8 |
| 9 namespace media { | 9 namespace media { |
| 10 namespace cast { | 10 namespace cast { |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 // Vp8BitReader is a re-implementation of a subset of the VP8 entropy decoder. | 13 // Vp8BitReader is a re-implementation of a subset of the VP8 entropy decoder. |
| 14 // It is used to decompress the VP8 bitstream for the purposes of quickly | 14 // It is used to decompress the VP8 bitstream for the purposes of quickly |
| 15 // parsing the VP8 frame headers. It is mostly the exact same implementation | 15 // parsing the VP8 frame headers. It is mostly the exact same implementation |
| 16 // found in third_party/libvpx_new/.../vp8/decoder/dboolhuff.h except that only | 16 // found in third_party/libvpx/.../vp8/decoder/dboolhuff.h except that only |
| 17 // the portion of the implementation needed to parse the frame headers is | 17 // the portion of the implementation needed to parse the frame headers is |
| 18 // present. As of this writing, the implementation in libvpx could not be | 18 // present. As of this writing, the implementation in libvpx could not be |
| 19 // re-used because of the way that the code is structured, and lack of the | 19 // re-used because of the way that the code is structured, and lack of the |
| 20 // necessary parts being exported. | 20 // necessary parts being exported. |
| 21 class Vp8BitReader { | 21 class Vp8BitReader { |
| 22 public: | 22 public: |
| 23 Vp8BitReader(const uint8_t* data, size_t size) | 23 Vp8BitReader(const uint8_t* data, size_t size) |
| 24 : encoded_data_(data), encoded_data_end_(data + size) { | 24 : encoded_data_(data), encoded_data_end_(data + size) { |
| 25 Vp8DecoderReadBytes(); | 25 Vp8DecoderReadBytes(); |
| 26 } | 26 } |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // Parse the base q_index. | 201 // Parse the base q_index. |
| 202 uint8_t q_index = static_cast<uint8_t>(bit_reader.DecodeValue(7)); | 202 uint8_t q_index = static_cast<uint8_t>(bit_reader.DecodeValue(7)); |
| 203 if (q_index > 127) { | 203 if (q_index > 127) { |
| 204 return 63; | 204 return 63; |
| 205 } | 205 } |
| 206 return vp8_quantizer_lookup[q_index]; | 206 return vp8_quantizer_lookup[q_index]; |
| 207 } | 207 } |
| 208 | 208 |
| 209 } // namespace cast | 209 } // namespace cast |
| 210 } // namespace media | 210 } // namespace media |
| OLD | NEW |