DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
vp9_parser.cc
1 // Copyright 2015 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/media/codecs/vp9_parser.h"
8 
9 #include "packager/base/logging.h"
10 #include "packager/media/base/bit_reader.h"
11 #include "packager/media/base/rcheck.h"
12 
13 namespace shaka {
14 namespace media {
15 namespace {
16 
17 const uint32_t VP9_FRAME_MARKER = 2;
18 const uint32_t VP9_SYNC_CODE = 0x498342;
19 const uint32_t REFS_PER_FRAME = 3;
20 const uint32_t REF_FRAMES_LOG2 = 3;
21 const uint32_t REF_FRAMES = (1 << REF_FRAMES_LOG2);
22 const uint32_t FRAME_CONTEXTS_LOG2 = 2;
23 const uint32_t MAX_REF_LF_DELTAS = 4;
24 const uint32_t MAX_MODE_LF_DELTAS = 2;
25 const uint32_t QINDEX_BITS = 8;
26 const uint32_t MAX_SEGMENTS = 8;
27 const uint32_t SEG_TREE_PROBS = (MAX_SEGMENTS - 1);
28 const uint32_t PREDICTION_PROBS = 3;
29 const uint32_t SEG_LVL_MAX = 4;
30 const uint32_t MI_SIZE_LOG2 = 3;
31 const uint32_t MI_BLOCK_SIZE_LOG2 = (6 - MI_SIZE_LOG2); // 64 = 2^6
32 const uint32_t MIN_TILE_WIDTH_B64 = 4;
33 const uint32_t MAX_TILE_WIDTH_B64 = 64;
34 
35 const bool SEG_FEATURE_DATA_SIGNED[SEG_LVL_MAX] = {true, true, false, false};
36 const uint32_t SEG_FEATURE_DATA_MAX_BITS[SEG_LVL_MAX] = {8, 6, 2, 0};
37 
38 enum VpxColorSpace {
39  VPX_COLOR_SPACE_UNKNOWN = 0,
40  VPX_COLOR_SPACE_BT_601 = 1,
41  VPX_COLOR_SPACE_BT_709 = 2,
42  VPX_COLOR_SPACE_SMPTE_170 = 3,
43  VPX_COLOR_SPACE_SMPTE_240 = 4,
44  VPX_COLOR_SPACE_BT_2020 = 5,
45  VPX_COLOR_SPACE_RESERVED = 6,
46  VPX_COLOR_SPACE_SRGB = 7,
47 };
48 
49 uint32_t RoundupShift(uint32_t value, uint32_t n) {
50  return (value + (1 << n) - 1) >> n;
51 }
52 
53 // Number of MI-units (8*8).
54 uint32_t GetNumMiUnits(uint32_t pixels) {
55  return RoundupShift(pixels, MI_SIZE_LOG2);
56 }
57 
58 // Number of sb64 (64x64) blocks per mi_units.
59 uint32_t GetNumBlocks(uint32_t mi_units) {
60  return RoundupShift(mi_units, MI_BLOCK_SIZE_LOG2);
61 }
62 
63 uint32_t GetMinLog2TileCols(uint32_t sb64_cols) {
64  uint32_t min_log2 = 0;
65  while ((MAX_TILE_WIDTH_B64 << min_log2) < sb64_cols)
66  ++min_log2;
67  return min_log2;
68 }
69 
70 uint32_t GetMaxLog2TileCols(uint32_t sb64_cols) {
71  uint32_t max_log2 = 1;
72  while ((sb64_cols >> max_log2) >= MIN_TILE_WIDTH_B64)
73  ++max_log2;
74  return max_log2 - 1;
75 }
76 
77 void GetTileNBits(uint32_t mi_cols,
78  uint32_t* min_log2_tile_cols,
79  uint32_t* max_log2_tile_cols) {
80  const uint32_t sb64_cols = GetNumBlocks(mi_cols);
81  *min_log2_tile_cols = GetMinLog2TileCols(sb64_cols);
82  *max_log2_tile_cols = GetMaxLog2TileCols(sb64_cols);
83  CHECK_LE(*min_log2_tile_cols, *max_log2_tile_cols);
84 }
85 
86 // Parse superframe index if it is a superframe. Fill |vpx_frames| with the
87 // frames information, which contains the sizes of the frames indicated in
88 // superframe index if it is a superframe; otherwise it should contain one
89 // single frame with |data_size| as frame size.
90 bool ParseIfSuperframeIndex(const uint8_t* data,
91  size_t data_size,
92  std::vector<VPxFrameInfo>* vpx_frames) {
93  vpx_frames->clear();
94  uint8_t superframe_marker = data[data_size - 1];
95  VPxFrameInfo vpx_frame;
96  if ((superframe_marker & 0xe0) != 0xc0) {
97  // This is not a super frame. There should be only one frame.
98  vpx_frame.frame_size = data_size;
99  vpx_frames->push_back(vpx_frame);
100  return true;
101  }
102 
103  const size_t num_frames = (superframe_marker & 0x07) + 1;
104  const size_t frame_size_length = ((superframe_marker >> 3) & 0x03) + 1;
105  // Two maker bytes + frame sizes.
106  const size_t index_size = 2 + num_frames * frame_size_length;
107 
108  if (data_size < index_size) {
109  LOG(ERROR) << "This chunk is marked as having a superframe index but "
110  "doesn't have enough data for it.";
111  return false;
112  }
113  const uint8_t superframe_marker2 = data[data_size - index_size];
114  if (superframe_marker2 != superframe_marker) {
115  LOG(ERROR) << "This chunk is marked as having a superframe index but "
116  "doesn't have the matching marker byte at the front of the "
117  "index.";
118  return false;
119  }
120  VLOG(3) << "Superframe num_frames=" << num_frames
121  << " frame_size_length=" << frame_size_length;
122 
123  data += data_size - index_size + 1;
124  size_t total_frame_sizes = 0;
125  for (size_t i = 0; i < num_frames; ++i) {
126  vpx_frame.frame_size = 0;
127  for (size_t i = 0; i < frame_size_length; ++i) {
128  vpx_frame.frame_size |= *data << (i * 8);
129  ++data;
130  }
131  total_frame_sizes += vpx_frame.frame_size;
132  vpx_frames->push_back(vpx_frame);
133  }
134  if (total_frame_sizes + index_size != data_size) {
135  LOG(ERROR) << "Data size (" << data_size
136  << ") does not match with sum of frame sizes ("
137  << total_frame_sizes << ") + index_size (" << index_size << ")";
138  return false;
139  }
140  return true;
141 }
142 
143 bool ReadProfile(BitReader* reader, VPCodecConfigurationRecord* codec_config) {
144  uint8_t bit[2];
145  RCHECK(reader->ReadBits(1, &bit[0]));
146  RCHECK(reader->ReadBits(1, &bit[1]));
147  uint8_t profile = bit[0] | (bit[1] << 1);
148  if (profile == 3) {
149  bool reserved;
150  RCHECK(reader->ReadBits(1, &reserved));
151  RCHECK(!reserved);
152  }
153  codec_config->set_profile(profile);
154  return true;
155 }
156 
157 bool ReadSyncCode(BitReader* reader) {
158  uint32_t sync_code;
159  RCHECK(reader->ReadBits(24, &sync_code));
160  return sync_code == VP9_SYNC_CODE;
161 }
162 
163 VPCodecConfigurationRecord::ColorSpace GetColorSpace(uint8_t color_space) {
164  switch (color_space) {
165  case VPX_COLOR_SPACE_UNKNOWN:
166  return VPCodecConfigurationRecord::COLOR_SPACE_UNSPECIFIED;
167  case VPX_COLOR_SPACE_BT_601:
168  return VPCodecConfigurationRecord::COLOR_SPACE_BT_601;
169  case VPX_COLOR_SPACE_BT_709:
170  return VPCodecConfigurationRecord::COLOR_SPACE_BT_709;
171  case VPX_COLOR_SPACE_SMPTE_170:
172  return VPCodecConfigurationRecord::COLOR_SPACE_SMPTE_170;
173  case VPX_COLOR_SPACE_SMPTE_240:
174  return VPCodecConfigurationRecord::COLOR_SPACE_SMPTE_240;
175  case VPX_COLOR_SPACE_BT_2020:
176  // VP9 does not specify if it is in the form of “constant luminance” or
177  // “non-constant luminance”. As such, application should rely on the
178  // signaling outside of VP9 bitstream. If there is no such signaling,
179  // application may assume non-constant luminance for BT.2020.
180  return VPCodecConfigurationRecord::
181  COLOR_SPACE_BT_2020_NON_CONSTANT_LUMINANCE;
182  case VPX_COLOR_SPACE_SRGB:
183  return VPCodecConfigurationRecord::COLOR_SPACE_SRGB;
184  default:
185  LOG(WARNING) << "Unknown color space: " << static_cast<int>(color_space);
186  return VPCodecConfigurationRecord::COLOR_SPACE_UNSPECIFIED;
187  }
188 }
189 
190 VPCodecConfigurationRecord::ChromaSubsampling GetChromaSubsampling(
191  uint8_t subsampling) {
192  switch (subsampling) {
193  case 0:
194  return VPCodecConfigurationRecord::CHROMA_444;
195  case 1:
196  return VPCodecConfigurationRecord::CHROMA_440;
197  case 2:
198  return VPCodecConfigurationRecord::CHROMA_422;
199  case 3:
200  // VP9 assumes that chrome samples are collocated with luma samples if
201  // there is no explicit signaling outside of VP9 bitstream.
202  return VPCodecConfigurationRecord::CHROMA_420_COLLOCATED_WITH_LUMA;
203  default:
204  LOG(WARNING) << "Unexpected chroma subsampling value: "
205  << static_cast<int>(subsampling);
206  return VPCodecConfigurationRecord::CHROMA_420_COLLOCATED_WITH_LUMA;
207  }
208 }
209 
210 bool ReadBitDepthAndColorSpace(BitReader* reader,
211  VPCodecConfigurationRecord* codec_config) {
212  uint8_t bit_depth = 8;
213  if (codec_config->profile() >= 2) {
214  bool use_vpx_bits_12;
215  RCHECK(reader->ReadBits(1, &use_vpx_bits_12));
216  bit_depth = use_vpx_bits_12 ? 12 : 10;
217  }
218  codec_config->set_bit_depth(bit_depth);
219 
220  uint8_t color_space;
221  RCHECK(reader->ReadBits(3, &color_space));
222  codec_config->set_color_space(GetColorSpace(color_space));
223 
224  bool yuv_full_range = false;
225  auto chroma_subsampling = VPCodecConfigurationRecord::CHROMA_444;
226  if (color_space != VPX_COLOR_SPACE_SRGB) {
227  RCHECK(reader->ReadBits(1, &yuv_full_range));
228 
229  if (codec_config->profile() & 1) {
230  uint8_t subsampling;
231  RCHECK(reader->ReadBits(2, &subsampling));
232  chroma_subsampling = GetChromaSubsampling(subsampling);
233  if (chroma_subsampling ==
234  VPCodecConfigurationRecord::CHROMA_420_COLLOCATED_WITH_LUMA) {
235  LOG(ERROR) << "4:2:0 color not supported in profile "
236  << codec_config->profile();
237  return false;
238  }
239 
240  bool reserved;
241  RCHECK(reader->ReadBits(1, &reserved));
242  RCHECK(!reserved);
243  } else {
244  chroma_subsampling =
245  VPCodecConfigurationRecord::CHROMA_420_COLLOCATED_WITH_LUMA;
246  }
247  } else {
248  // Assume 4:4:4 for colorspace SRGB.
249  chroma_subsampling = VPCodecConfigurationRecord::CHROMA_444;
250  if (codec_config->profile() & 1) {
251  bool reserved;
252  RCHECK(reader->ReadBits(1, &reserved));
253  RCHECK(!reserved);
254  } else {
255  LOG(ERROR) << "4:4:4 color not supported in profile 0 or 2.";
256  return false;
257  }
258  }
259  codec_config->set_video_full_range_flag(yuv_full_range);
260  codec_config->set_chroma_subsampling(chroma_subsampling);
261 
262  VLOG(3) << "\n profile " << static_cast<int>(codec_config->profile())
263  << "\n bit depth " << static_cast<int>(codec_config->bit_depth())
264  << "\n color space " << static_cast<int>(codec_config->color_space())
265  << "\n full_range "
266  << static_cast<int>(codec_config->video_full_range_flag())
267  << "\n chroma subsampling "
268  << static_cast<int>(codec_config->chroma_subsampling());
269  return true;
270 }
271 
272 bool ReadFrameSize(BitReader* reader, uint32_t* width, uint32_t* height) {
273  RCHECK(reader->ReadBits(16, width));
274  *width += 1; // Off by 1.
275  RCHECK(reader->ReadBits(16, height));
276  *height += 1; // Off by 1.
277  return true;
278 }
279 
280 bool ReadDisplayFrameSize(BitReader* reader,
281  uint32_t* display_width,
282  uint32_t* display_height) {
283  bool has_display_size;
284  RCHECK(reader->ReadBits(1, &has_display_size));
285  if (has_display_size)
286  RCHECK(ReadFrameSize(reader, display_width, display_height));
287  return true;
288 }
289 
290 bool ReadFrameSizes(BitReader* reader, uint32_t* width, uint32_t* height) {
291  uint32_t new_width;
292  uint32_t new_height;
293  RCHECK(ReadFrameSize(reader, &new_width, &new_height));
294  if (new_width != *width) {
295  VLOG(1) << "Width updates from " << *width << " to " << new_width;
296  *width = new_width;
297  }
298  if (new_height != *height) {
299  VLOG(1) << "Height updates from " << *height << " to " << new_height;
300  *height = new_height;
301  }
302 
303  uint32_t display_width = *width;
304  uint32_t display_height = *height;
305  RCHECK(ReadDisplayFrameSize(reader, &display_width, &display_height));
306  return true;
307 }
308 
309 bool ReadFrameSizesWithRefs(BitReader* reader,
310  uint32_t* width,
311  uint32_t* height) {
312  bool found = false;
313  for (uint32_t i = 0; i < REFS_PER_FRAME; ++i) {
314  RCHECK(reader->ReadBits(1, &found));
315  if (found)
316  break;
317  }
318  if (!found) {
319  RCHECK(ReadFrameSizes(reader, width, height));
320  } else {
321  uint32_t display_width;
322  uint32_t display_height;
323  RCHECK(ReadDisplayFrameSize(reader, &display_width, &display_height));
324  }
325  return true;
326 }
327 
328 bool ReadLoopFilter(BitReader* reader) {
329  RCHECK(reader->SkipBits(9)); // filter_evel, sharness_level
330  bool mode_ref_delta_enabled;
331  RCHECK(reader->ReadBits(1, &mode_ref_delta_enabled));
332  if (!mode_ref_delta_enabled)
333  return true;
334  bool mode_ref_delta_update;
335  RCHECK(reader->ReadBits(1, &mode_ref_delta_update));
336  if (!mode_ref_delta_update)
337  return true;
338 
339  for (uint32_t i = 0; i < MAX_REF_LF_DELTAS + MAX_MODE_LF_DELTAS; ++i)
340  RCHECK(reader->SkipBitsConditional(true, 6 + 1));
341  return true;
342 }
343 
344 bool ReadQuantization(BitReader* reader) {
345  RCHECK(reader->SkipBits(QINDEX_BITS));
346  // Skip delta_q bits.
347  for (uint32_t i = 0; i < 3; ++i)
348  RCHECK(reader->SkipBitsConditional(true, 4 + 1));
349  return true;
350 }
351 
352 bool ReadSegmentation(BitReader* reader) {
353  bool enabled;
354  RCHECK(reader->ReadBits(1, &enabled));
355  if (!enabled)
356  return true;
357 
358  bool update_map;
359  RCHECK(reader->ReadBits(1, &update_map));
360  if (update_map) {
361  for (uint32_t i = 0; i < SEG_TREE_PROBS; ++i)
362  RCHECK(reader->SkipBitsConditional(true, 8));
363 
364  bool temporal_update;
365  RCHECK(reader->ReadBits(1, &temporal_update));
366  if (temporal_update) {
367  for (uint32_t j = 0; j < PREDICTION_PROBS; ++j)
368  RCHECK(reader->SkipBitsConditional(true, 8));
369  }
370  }
371 
372  bool update_data;
373  RCHECK(reader->ReadBits(1, &update_data));
374  if (update_data) {
375  RCHECK(reader->SkipBits(1)); // abs_delta
376  for (uint32_t i = 0; i < MAX_SEGMENTS; ++i) {
377  for (uint32_t j = 0; j < SEG_LVL_MAX; ++j) {
378  bool feature_enabled;
379  RCHECK(reader->ReadBits(1, &feature_enabled));
380  if (feature_enabled) {
381  RCHECK(reader->SkipBits(SEG_FEATURE_DATA_MAX_BITS[j]));
382  if (SEG_FEATURE_DATA_SIGNED[j])
383  RCHECK(reader->SkipBits(1)); // signness
384  }
385  }
386  }
387  }
388  return true;
389 }
390 
391 bool ReadTileInfo(uint32_t width, BitReader* reader) {
392  uint32_t mi_cols = GetNumMiUnits(width);
393 
394  uint32_t min_log2_tile_cols;
395  uint32_t max_log2_tile_cols;
396  GetTileNBits(mi_cols, &min_log2_tile_cols, &max_log2_tile_cols);
397  uint32_t max_ones = max_log2_tile_cols - min_log2_tile_cols;
398 
399  uint32_t log2_tile_cols = min_log2_tile_cols;
400  while (max_ones--) {
401  bool has_more;
402  RCHECK(reader->ReadBits(1, &has_more));
403  if (!has_more)
404  break;
405  ++log2_tile_cols;
406  }
407  RCHECK(log2_tile_cols <= 6);
408 
409  RCHECK(reader->SkipBitsConditional(true, 1)); // log2_tile_rows
410  return true;
411 }
412 
413 } // namespace
414 
415 VP9Parser::VP9Parser() : width_(0), height_(0) {}
416 VP9Parser::~VP9Parser() {}
417 
418 bool VP9Parser::Parse(const uint8_t* data,
419  size_t data_size,
420  std::vector<VPxFrameInfo>* vpx_frames) {
421  DCHECK(data);
422  DCHECK(vpx_frames);
423  RCHECK(ParseIfSuperframeIndex(data, data_size, vpx_frames));
424 
425  for (auto& vpx_frame : *vpx_frames) {
426  VLOG(4) << "process frame with size " << vpx_frame.frame_size;
427  BitReader reader(data, vpx_frame.frame_size);
428  uint8_t frame_marker;
429  RCHECK(reader.ReadBits(2, &frame_marker));
430  RCHECK(frame_marker == VP9_FRAME_MARKER);
431 
432  RCHECK(ReadProfile(&reader, writable_codec_config()));
433 
434  bool show_existing_frame;
435  RCHECK(reader.ReadBits(1, &show_existing_frame));
436  if (show_existing_frame) {
437  RCHECK(reader.SkipBits(3)); // ref_frame_index
438  // End of current frame data. There should be no more bytes available.
439  RCHECK(reader.bits_available() < 8);
440 
441  vpx_frame.is_keyframe = false;
442  vpx_frame.uncompressed_header_size = vpx_frame.frame_size;
443  vpx_frame.width = width_;
444  vpx_frame.height = height_;
445  continue;
446  }
447 
448  bool is_interframe;
449  RCHECK(reader.ReadBits(1, &is_interframe));
450  vpx_frame.is_keyframe = !is_interframe;
451 
452  bool show_frame;
453  RCHECK(reader.ReadBits(1, &show_frame));
454  bool error_resilient_mode;
455  RCHECK(reader.ReadBits(1, &error_resilient_mode));
456 
457  if (vpx_frame.is_keyframe) {
458  RCHECK(ReadSyncCode(&reader));
459  RCHECK(ReadBitDepthAndColorSpace(&reader, writable_codec_config()));
460  RCHECK(ReadFrameSizes(&reader, &width_, &height_));
461  } else {
462  bool intra_only = false;
463  if (!show_frame)
464  RCHECK(reader.ReadBits(1, &intra_only));
465  if (!error_resilient_mode)
466  RCHECK(reader.SkipBits(2)); // reset_frame_context
467 
468  if (intra_only) {
469  RCHECK(ReadSyncCode(&reader));
470  if (codec_config().profile() > 0) {
471  RCHECK(ReadBitDepthAndColorSpace(&reader, writable_codec_config()));
472  } else {
473  // NOTE: The intra-only frame header does not include the
474  // specification of either the color format or color sub-sampling in
475  // profile 0. VP9 specifies that the default color format should be
476  // YUV 4:2:0 in this case (normative).
477  writable_codec_config()->set_chroma_subsampling(
478  VPCodecConfigurationRecord::CHROMA_420_COLLOCATED_WITH_LUMA);
479  writable_codec_config()->set_bit_depth(8);
480  }
481 
482  RCHECK(reader.SkipBits(REF_FRAMES)); // refresh_frame_flags
483  RCHECK(ReadFrameSizes(&reader, &width_, &height_));
484  } else {
485  RCHECK(reader.SkipBits(REF_FRAMES)); // refresh_frame_flags
486  RCHECK(reader.SkipBits(REFS_PER_FRAME * (REF_FRAMES_LOG2 + 1)));
487 
488  // TODO(kqyang): We may need to actually build the refs to extract the
489  // correct width and height for the current frame. The width will be
490  // used later in ReadTileInfo.
491  RCHECK(ReadFrameSizesWithRefs(&reader, &width_, &height_));
492 
493  RCHECK(reader.SkipBits(1)); // allow_high_precision_mv
494 
495  bool interp_filter;
496  RCHECK(reader.ReadBits(1, &interp_filter));
497  if (!interp_filter)
498  RCHECK(reader.SkipBits(2)); // more interp_filter
499  }
500  }
501 
502  if (!error_resilient_mode) {
503  RCHECK(reader.SkipBits(1)); // refresh_frame_context
504  RCHECK(reader.SkipBits(1)); // frame_parallel_decoding_mode
505  }
506  RCHECK(reader.SkipBits(FRAME_CONTEXTS_LOG2)); // frame_context_idx
507 
508  VLOG(4) << "bits read before ReadLoopFilter: " << reader.bit_position();
509  RCHECK(ReadLoopFilter(&reader));
510  RCHECK(ReadQuantization(&reader));
511  RCHECK(ReadSegmentation(&reader));
512  RCHECK(ReadTileInfo(width_, &reader));
513 
514  uint16_t header_size;
515  RCHECK(reader.ReadBits(16, &header_size));
516  vpx_frame.uncompressed_header_size =
517  vpx_frame.frame_size - reader.bits_available() / 8;
518  vpx_frame.width = width_;
519  vpx_frame.height = height_;
520 
521  VLOG(3) << "\n frame_size: " << vpx_frame.frame_size
522  << "\n uncompressed_header_size: "
523  << vpx_frame.uncompressed_header_size
524  << "\n bits read: " << reader.bit_position()
525  << "\n header_size: " << header_size;
526 
527  RCHECK(header_size > 0);
528  RCHECK(header_size * 8 <= reader.bits_available());
529 
530  data += vpx_frame.frame_size;
531  }
532  return true;
533 }
534 
535 bool VP9Parser::IsKeyframe(const uint8_t* data, size_t data_size) {
536  BitReader reader(data, data_size);
537  uint8_t frame_marker;
538  RCHECK(reader.ReadBits(2, &frame_marker));
539  RCHECK(frame_marker == VP9_FRAME_MARKER);
540 
542  RCHECK(ReadProfile(&reader, &codec_config));
543 
544  bool show_existing_frame;
545  RCHECK(reader.ReadBits(1, &show_existing_frame));
546  if (show_existing_frame)
547  return false;
548 
549  bool is_interframe;
550  RCHECK(reader.ReadBits(1, &is_interframe));
551  if (is_interframe)
552  return false;
553 
554  RCHECK(reader.SkipBits(2)); // show_frame, error_resilient_mode.
555 
556  RCHECK(ReadSyncCode(&reader));
557  return true;
558 }
559 
560 } // namespace media
561 } // namespace shaka
Class for parsing or writing VP codec configuration record.
static bool IsKeyframe(const uint8_t *data, size_t data_size)
Definition: vp9_parser.cc:535
A class to read bit streams.
Definition: bit_reader.h:17
bool Parse(const uint8_t *data, size_t data_size, std::vector< VPxFrameInfo > *vpx_frames) override
Definition: vp9_parser.cc:418
const VPCodecConfigurationRecord & codec_config() const
Definition: vpx_parser.h:44
bool ReadBits(int num_bits, T *out)
Definition: bit_reader.h:35
int bits_available() const
Definition: bit_reader.h:76
bool SkipBits(int num_bits)
Definition: bit_reader.cc:24
int bit_position() const
Definition: bit_reader.h:81