MythTV  master
AVCParser.cpp
Go to the documentation of this file.
1 // MythTV headers
2 #include "AVCParser.h"
3 #include <iostream>
4 
5 #include "mythlogging.h"
6 #include "recorders/dtvrecorder.h" // for FrameRate
7 
8 
9 extern "C" {
10 #include "libavcodec/avcodec.h"
11 #include "libavutil/internal.h"
12 #include "libavcodec/golomb.h"
13 }
14 
15 #include <cmath>
16 #include <strings.h>
17 
18 /*
19  Most of the comments below were cut&paste from ITU-T Rec. H.264
20  as found here: http://www.itu.int/rec/T-REC-H.264/e
21  */
22 
23 /*
24  Useful definitions:
25 
26  * access unit: A set of NAL units always containing exactly one
27  primary coded picture. In addition to the primary coded picture, an
28  access unit may also contain one or more redundant coded pictures
29  or other NAL units not containing slices or slice data partitions
30  of a coded picture. The decoding of an access unit always results
31  in a decoded picture.
32 
33  * instantaneous decoding refresh (IDR) access unit: An access unit in
34  which the primary coded picture is an IDR picture.
35 
36  * instantaneous decoding refresh (IDR) picture: A coded picture
37  containing only slices with I or SI slice types that causes the
38  decoding process to mark all reference pictures as "unused for
39  reference" immediately after decoding the IDR picture. After the
40  decoding of an IDR picture all following coded pictures in decoding
41  order can be decoded without inter prediction from any picture
42  decoded prior to the IDR picture. The first picture of each coded
43  video sequence is an IDR picture.
44 
45  * NAL unit: A syntax structure containing an indication of the type
46  of data to follow and bytes containing that data in the form of an
47  RBSP interspersed as necessary with emulation prevention bytes.
48 
49  * raw byte sequence payload (RBSP): A syntax structure containing an
50  integer number of bytes that is encapsulated in a NAL unit. An RBSP
51  is either empty or has the form of a string of data bits containing
52  syntax elements followed by an RBSP stop bit and followed by zero
53  or more subsequent bits equal to 0.
54 
55  * raw byte sequence payload (RBSP) stop bit: A bit equal to 1 present
56  within a raw byte sequence payload (RBSP) after a string of data
57  bits. The location of the end of the string of data bits within an
58  RBSP can be identified by searching from the end of the RBSP for
59  the RBSP stop bit, which is the last non-zero bit in the RBSP.
60 
61  * parity: The parity of a field can be top or bottom.
62 
63  * picture: A collective term for a field or a frame.
64 
65  * picture parameter set: A syntax structure containing syntax
66  elements that apply to zero or more entire coded pictures as
67  determined by the m_picParameterSetId syntax element found in each
68  slice header.
69 
70  * primary coded picture: The coded representation of a picture to be
71  used by the decoding process for a bitstream conforming to this
72  Recommendation | International Standard. The primary coded picture
73  contains all macroblocks of the picture. The only pictures that
74  have a normative effect on the decoding process are primary coded
75  pictures. See also redundant coded picture.
76 
77  * VCL: Video Coding Layer
78 
79  - The VCL is specified to efficiently represent the content of the
80  video data. The NAL is specified to format that data and provide
81  header information in a manner appropriate for conveyance on a
82  variety of communication channels or storage media. All data are
83  contained in NAL units, each of which contains an integer number of
84  bytes. A NAL unit specifies a generic format for use in both
85  packet-oriented and bitstream systems. The format of NAL units for
86  both packet-oriented transport and byte stream is identical except
87  that each NAL unit can be preceded by a start code prefix and extra
88  padding bytes in the byte stream format.
89 
90 */
91 
92 void AVCParser::Reset(void)
93 {
95 
96  m_bottomFieldFlag = -1;
99  m_deltaPicOrderCnt.fill(0);
100  m_fieldPicFlag = -1;
101  m_frameMbsOnlyFlag = -1;
102  m_frameNum = -1;
103  // The value of m_idrPicId shall be in the range of 0 to 65535, inclusive.
104  m_idrPicId = 65536;
105  m_log2MaxFrameNum = 0;
107  m_nalRefIdc = 111; // != [0|1|2|3]
109  m_numRefFrames = 0;
110  m_picOrderCntLsb = 0;
111  m_picOrderCntType = 0;
113  m_picParameterSetId = -1;
116  m_prevDeltaPicOrderCnt.fill(0);
117  m_prevFieldPicFlag = -1;
118  m_prevFrameNum = -1;
119  m_prevIdrPicId = 65536;
120  m_prevNALRefIdc = 111; // != [0|1|2|3]
125  m_redundantPicCnt = 0;
129 
130  resetRBSP();
131 }
132 
133 
135 {
136  switch (type)
137  {
138  case UNKNOWN:
139  return "UNKNOWN";
140  case SLICE:
141  return "SLICE";
142  case SLICE_DPA:
143  return "SLICE_DPA";
144  case SLICE_DPB:
145  return "SLICE_DPB";
146  case SLICE_DPC:
147  return "SLICE_DPC";
148  case SLICE_IDR:
149  return "SLICE_IDR";
150  case SEI:
151  return "SEI";
152  case SPS:
153  return "SPS";
154  case PPS:
155  return "PPS";
156  case AU_DELIMITER:
157  return "AU_DELIMITER";
158  case END_SEQUENCE:
159  return "END_SEQUENCE";
160  case END_STREAM:
161  return "END_STREAM";
162  case FILLER_DATA:
163  return "FILLER_DATA";
164  case SPS_EXT:
165  return "SPS_EXT";
166  }
167  return "OTHER";
168 }
169 
171 {
172  /*
173  An access unit consists of one primary coded picture, zero or more
174  corresponding redundant coded pictures, and zero or more non-VCL NAL
175  units. The association of VCL NAL units to primary or redundant coded
176  pictures is described in subclause 7.4.1.2.5.
177 
178  The first access unit in the bitstream starts with the first NAL unit
179  of the bitstream.
180 
181  The first of any of the following NAL units after the last VCL NAL
182  unit of a primary coded picture specifies the start of a new access
183  unit.
184 
185  – access unit delimiter NAL unit (when present)
186  – sequence parameter set NAL unit (when present)
187  – picture parameter set NAL unit (when present)
188  – SEI NAL unit (when present)
189  – NAL units with m_nalUnitType in the range of 14 to 18, inclusive
190  – first VCL NAL unit of a primary coded picture (always present)
191  */
192 
193  /*
194  7.4.1.2.4 Detection of the first VCL NAL unit of a primary coded
195  picture This subclause specifies constraints on VCL NAL unit syntax
196  that are sufficient to enable the detection of the first VCL NAL unit
197  of each primary coded picture.
198 
199  Any coded slice NAL unit or coded slice data partition A NAL unit of
200  the primary coded picture of the current access unit shall be
201  different from any coded slice NAL unit or coded slice data partition
202  A NAL unit of the primary coded picture of the previous access unit in
203  one or more of the following ways.
204 
205  - frame_num differs in value. The value of frame_num used to
206  test this condition is the value of frame_num that appears in
207  the syntax of the slice header, regardless of whether that value
208  is inferred to have been equal to 0 for subsequent use in the
209  decoding process due to the presence of
210  memory_management_control_operation equal to 5.
211  Note: If the current picture is an IDR picture FrameNum and
212  PrevRefFrameNum are set equal to 0.
213  - m_picParameterSetId differs in value.
214  - m_fieldPicFlag differs in value.
215  - bottom_field_flag is present in both and differs in value.
216  - nal_ref_idc differs in value with one of the nal_ref_idc
217  values being equal to 0.
218  - m_picOrderCntType is equal to 0 for both and either
219  m_picOrderCntLsb differs in value, or m_deltaPicOrderCntBottom
220  differs in value.
221  - m_picOrderCntType is equal to 1 for both and either
222  m_deltaPicOrderCnt[0] differs in value, or
223  m_deltaPicOrderCnt[1] differs in value.
224  - m_nalUnitType differs in value with one of the m_nalUnitType values
225  being equal to 5.
226  - m_nalUnitType is equal to 5 for both and m_idrPicId differs in
227  value.
228 
229  NOTE – Some of the VCL NAL units in redundant coded pictures or some
230  non-VCL NAL units (e.g. an access unit delimiter NAL unit) may also
231  be used for the detection of the boundary between access units, and
232  may therefore aid in the detection of the start of a new primary
233  coded picture.
234 
235  */
236 
237  bool result = false;
238 
239  if (m_prevFrameNum != -1)
240  {
241  // Need previous slice information for comparison
242 
244  result = true; // NOLINT(bugprone-branch-clone)
245  else if (m_prevPicParameterSetId != -1 &&
247  result = true;
249  result = true;
250  else if ((m_bottomFieldFlag != -1 && m_prevBottomFieldFlag != -1) &&
252  result = true;
253  else if ((m_nalRefIdc == 0 || m_prevNALRefIdc == 0) &&
255  result = true;
256  else if ((m_picOrderCntType == 0 && m_prevPicOrderCntType == 0) &&
259  result = true;
260  else if ((m_picOrderCntType == 1 && m_prevPicOrderCntType == 1) &&
263  result = true;
264  else if ((m_nalUnitType == SLICE_IDR ||
267  result = true;
268  else if ((m_nalUnitType == SLICE_IDR &&
271  result = true;
272  }
273 
285 
286  return result;
287 }
288 
289 uint32_t AVCParser::addBytes(const uint8_t *bytes,
290  const uint32_t byte_count,
291  const uint64_t stream_offset)
292 {
293  const uint8_t *startP = bytes;
294 
295  m_stateChanged = false;
296  m_onFrame = false;
297  m_onKeyFrame = false;
298 
299  while (startP < bytes + byte_count && !m_onFrame)
300  {
301  const uint8_t *endP = avpriv_find_start_code(startP,
302  bytes + byte_count,
304 
305  bool found_start_code = ((m_syncAccumulator & 0xffffff00) == 0x00000100);
306 
307  /* Between startP and endP we potentially have some more
308  * bytes of a NAL that we've been parsing (plus some bytes of
309  * start code)
310  */
312  {
313  if (!fillRBSP(startP, endP - startP, found_start_code))
314  {
315  resetRBSP();
316  return endP - bytes;
317  }
318  processRBSP(found_start_code); /* Call may set have_uinfinished_NAL
319  * to false */
320  }
321 
322  /* Dealt with everything up to endP */
323  startP = endP;
324 
325  if (found_start_code)
326  {
328  {
329  /* We've found a new start code, without completely
330  * parsing the previous NAL. Either there's a
331  * problem with the stream or with this parser.
332  */
333  LOG(VB_GENERAL, LOG_ERR,
334  "AVCParser::addBytes: Found new start "
335  "code, but previous NAL is incomplete!");
336  }
337 
338  /* Prepare for accepting the new NAL */
339  resetRBSP();
340 
341  /* If we find the start of an AU somewhere from here
342  * to the next start code, the offset to associate with
343  * it is the one passed in to this call, not any of the
344  * subsequent calls.
345  */
346  m_pktOffset = stream_offset; // + (startP - bytes);
347 
348 /*
349  m_nalUnitType specifies the type of RBSP data structure contained in
350  the NAL unit as specified in Table 7-1. VCL NAL units
351  are specified as those NAL units having m_nalUnitType
352  equal to 1 to 5, inclusive. All remaining NAL units
353  are called non-VCL NAL units:
354 
355  0 Unspecified
356  1 Coded slice of a non-IDR picture slice_layer_without_partitioning_rbsp( )
357  2 Coded slice data partition A slice_data_partition_a_layer_rbsp( )
358  3 Coded slice data partition B slice_data_partition_b_layer_rbsp( )
359  4 Coded slice data partition C slice_data_partition_c_layer_rbsp( )
360  5 Coded slice of an IDR picture slice_layer_without_partitioning_rbsp( )
361  6 Supplemental enhancement information (SEI) 5 sei_rbsp( )
362  7 Sequence parameter set (SPS) seq_parameter_set_rbsp( )
363  8 Picture parameter set pic_parameter_set_rbsp( )
364  9 Access unit delimiter access_unit_delimiter_rbsp( )
365  10 End of sequence end_of_seq_rbsp( )
366  11 End of stream end_of_stream_rbsp( )
367 */
369  m_nalRefIdc = (m_syncAccumulator >> 5) & 0x3;
370 
371  bool good_nal_unit = true;
372  if (m_nalRefIdc)
373  {
374  /* nal_ref_idc shall be equal to 0 for all NAL units having
375  * m_nalUnitType equal to 6, 9, 10, 11, or 12.
376  */
377  if (m_nalUnitType == SEI ||
380  good_nal_unit = false;
381  }
382  else
383  {
384  /* nal_ref_idc shall not be equal to 0 for NAL units with
385  * m_nalUnitType equal to 5
386  */
387  if (m_nalUnitType == SLICE_IDR)
388  good_nal_unit = false;
389  }
390 
391  if (good_nal_unit)
392  {
393  if (m_nalUnitType == SPS || m_nalUnitType == PPS ||
395  {
396  /* This is a NAL we need to parse. We may have the body
397  * of it in the part of the stream past to us this call,
398  * or we may get the rest in subsequent calls to addBytes.
399  * Either way, we set m_haveUnfinishedNAL, so that we
400  * start filling the rbsp buffer
401  */
402  m_haveUnfinishedNAL = true;
403  }
404  else if (m_nalUnitType == AU_DELIMITER)
405  {
406  set_AU_pending();
407  }
408  }
409  else
410  LOG(VB_GENERAL, LOG_ERR,
411  "AVCParser::addbytes: malformed NAL units");
412  } //found start code
413  }
414 
415  return startP - bytes;
416 }
417 
418 
419 void AVCParser::processRBSP(bool rbsp_complete)
420 {
421  GetBitContext gb;
422 
423  init_get_bits(&gb, m_rbspBuffer, 8 * m_rbspIndex);
424 
425  if (m_nalUnitType == SEI)
426  {
427  /* SEI cannot be parsed without knowing its size. If
428  * we haven't got the whole rbsp, return and wait for
429  * the rest
430  */
431  if (!rbsp_complete)
432  return;
433 
434  set_AU_pending();
435 
436  decode_SEI(&gb);
437  }
438  else if (m_nalUnitType == SPS)
439  {
440  /* Best wait until we have the whole thing */
441  if (!rbsp_complete)
442  return;
443 
444  set_AU_pending();
445 
446  if (!m_seenSPS)
448 
449  decode_SPS(&gb);
450  }
451  else if (m_nalUnitType == PPS)
452  {
453  /* Best wait until we have the whole thing */
454  if (!rbsp_complete)
455  return;
456 
457  set_AU_pending();
458 
459  decode_PPS(&gb);
460  }
461  else
462  {
463  /* Need only parse the header. So return only
464  * if we have insufficient bytes */
465  if (!rbsp_complete && m_rbspIndex < MAX_SLICE_HEADER_SIZE)
466  return;
467 
468  decode_Header(&gb);
469 
470  if (new_AU())
471  set_AU_pending();
472  }
473 
474  /* If we got this far, we managed to parse a sufficient
475  * prefix of the current NAL. We can go onto the next. */
476  m_haveUnfinishedNAL = false;
477 
479  {
480  /* Once we know the slice type of a new AU, we can
481  * determine if it is a keyframe or just a frame
482  */
483  m_auPending = false;
485 
486  m_onFrame = true;
488 
490  {
491  m_onKeyFrame = true;
493  }
494  }
495 }
496 
497 /*
498  7.4.3 Slice header semantics
499 */
500 bool AVCParser::decode_Header(GetBitContext *gb)
501 {
502  m_isKeyframe = false;
503 
504  if (m_log2MaxFrameNum == 0)
505  {
506  /* SPS has not been parsed yet */
507  return false;
508  }
509 
510  /*
511  m_firstMbInSlice specifies the address of the first macroblock
512  in the slice. When arbitrary slice order is not allowed as
513  specified in Annex A, the value of first_mb_in_slice is
514  constrained as follows.
515 
516  – If m_separateColourPlaneFlag is equal to 0, the value of
517  first_mb_in_slice shall not be less than the value of
518  first_mb_in_slice for any other slice of the current picture
519  that precedes the current slice in decoding order.
520 
521  – Otherwise (m_separateColourPlaneFlag is equal to 1), the value of
522  first_mb_in_slice shall not be less than the value of
523  first_mb_in_slice for any other slice of the current picture
524  that precedes the current slice in decoding order and has the
525  same value of colour_plane_id.
526  */
527  /* uint first_mb_in_slice = */ get_ue_golomb(gb);
528 
529  /*
530  slice_type specifies the coding type of the slice according to
531  Table 7-6. e.g. P, B, I, SP, SI
532 
533  When m_nalUnitType is equal to 5 (IDR picture), slice_type shall
534  be equal to 2, 4, 7, or 9 (I or SI)
535  */
536  m_sliceType = get_ue_golomb_31(gb);
537 
538  /* s->pict_type = golomb_to_pict_type[slice_type % 5];
539  */
540 
541  /*
542  m_picParameterSetId specifies the picture parameter set in
543  use. The value of m_picParameterSetId shall be in the range of
544  0 to 255, inclusive.
545  */
546  m_picParameterSetId = get_ue_golomb(gb);
547 
548  /*
549  m_separateColourPlaneFlag equal to 1 specifies that the three
550  colour components of the 4:4:4 chroma format are coded
551  separately. m_separateColourPlaneFlag equal to 0 specifies that
552  the colour components are not coded separately. When
553  m_separateColourPlaneFlag is not present, it shall be inferred
554  to be equal to 0. When m_separateColourPlaneFlag is equal to 1,
555  the primary coded picture consists of three separate components,
556  each of which consists of coded samples of one colour plane (Y,
557  Cb or Cr) that each use the monochrome coding syntax. In this
558  case, each colour plane is associated with a specific
559  colour_plane_id value.
560  */
562  get_bits(gb, 2); // colour_plane_id
563 
564  /*
565  frame_num is used as an identifier for pictures and shall be
566  represented by m_log2MaxFrameNum_minus4 + 4 bits in the
567  bitstream....
568 
569  If the current picture is an IDR picture, frame_num shall be equal to 0.
570 
571  When m_maxNumRefFrames is equal to 0, slice_type shall be equal
572  to 2, 4, 7, or 9.
573  */
574  m_frameNum = get_bits(gb, m_log2MaxFrameNum);
575 
576  /*
577  m_fieldPicFlag equal to 1 specifies that the slice is a slice of a
578  coded field. m_fieldPicFlag equal to 0 specifies that the slice is a
579  slice of a coded frame. When m_fieldPicFlag is not present it shall be
580  inferred to be equal to 0.
581 
582  bottom_field_flag equal to 1 specifies that the slice is part of a
583  coded bottom field. bottom_field_flag equal to 0 specifies that the
584  picture is a coded top field. When this syntax element is not present
585  for the current slice, it shall be inferred to be equal to 0.
586  */
587  if (!m_frameMbsOnlyFlag)
588  {
589  m_fieldPicFlag = get_bits1(gb);
590  m_bottomFieldFlag = m_fieldPicFlag ? get_bits1(gb) : 0;
591  }
592  else
593  {
594  m_fieldPicFlag = 0;
595  m_bottomFieldFlag = -1;
596  }
597 
598  /*
599  m_idrPicId identifies an IDR picture. The values of m_idrPicId
600  in all the slices of an IDR picture shall remain unchanged. When
601  two consecutive access units in decoding order are both IDR
602  access units, the value of m_idrPicId in the slices of the first
603  such IDR access unit shall differ from the m_idrPicId in the
604  second such IDR access unit. The value of m_idrPicId shall be in
605  the range of 0 to 65535, inclusive.
606  */
607  if (m_nalUnitType == SLICE_IDR)
608  {
609  m_idrPicId = get_ue_golomb(gb);
610  m_isKeyframe = true;
611  }
612  else
614 
615  /*
616  m_picOrderCntLsb specifies the picture order count modulo
617  MaxPicOrderCntLsb for the top field of a coded frame or for a coded
618  field. The size of the m_picOrderCntLsb syntax element is
619  m_log2MaxPicOrderCntLsbMinus4 + 4 bits. The value of the
620  pic_order_cnt_lsb shall be in the range of 0 to MaxPicOrderCntLsb – 1,
621  inclusive.
622 
623  m_deltaPicOrderCntBottom specifies the picture order count
624  difference between the bottom field and the top field of a coded
625  frame.
626  */
627  if (m_picOrderCntType == 0)
628  {
630 
631  if ((m_picOrderPresentFlag == 1) && !m_fieldPicFlag)
632  m_deltaPicOrderCntBottom = get_se_golomb(gb);
633  else
635  }
636  else
638 
639  /*
640  m_deltaPicOrderAlwaysZeroFlag equal to 1 specifies that
641  m_deltaPicOrderCnt[ 0 ] and m_deltaPicOrderCnt[ 1 ] are not
642  present in the slice headers of the sequence and shall be
643  inferred to be equal to 0. m_deltaPicOrderAlwaysZeroFlag
644  equal to 0 specifies that m_deltaPicOrderCnt[ 0 ] is present in
645  the slice headers of the sequence and m_deltaPicOrderCnt[ 1 ]
646  may be present in the slice headers of the sequence.
647  */
649  {
651  }
652  else if (m_picOrderCntType == 1)
653  {
654  /*
655  m_deltaPicOrderCnt[ 0 ] specifies the picture order count
656  difference from the expected picture order count for the top
657  field of a coded frame or for a coded field as specified in
658  subclause 8.2.1. The value of m_deltaPicOrderCnt[ 0 ] shall
659  be in the range of -2^31 to 2^31 - 1, inclusive. When this
660  syntax element is not present in the bitstream for the
661  current slice, it shall be inferred to be equal to 0.
662 
663  m_deltaPicOrderCnt[ 1 ] specifies the picture order count
664  difference from the expected picture order count for the
665  bottom field of a coded frame specified in subclause
666  8.2.1. The value of m_deltaPicOrderCnt[ 1 ] shall be in the
667  range of -2^31 to 2^31 - 1, inclusive. When this syntax
668  element is not present in the bitstream for the current
669  slice, it shall be inferred to be equal to 0.
670  */
671  m_deltaPicOrderCnt[0] = get_se_golomb(gb);
672 
673  if ((m_picOrderPresentFlag == 1) && !m_fieldPicFlag)
674  m_deltaPicOrderCnt[1] = get_se_golomb(gb);
675  else
676  m_deltaPicOrderCnt[1] = 0;
677  }
678 
679  /*
680  m_redundantPicCnt shall be equal to 0 for slices and slice data
681  partitions belonging to the primary coded picture. The
682  m_redundantPicCnt shall be greater than 0 for coded slices and
683  coded slice data partitions in redundant coded pictures. When
684  m_redundantPicCnt is not present, its value shall be inferred to
685  be equal to 0. The value of m_redundantPicCnt shall be in the
686  range of 0 to 127, inclusive.
687  */
688  m_redundantPicCnt = m_redundantPicCntPresentFlag ? get_ue_golomb(gb) : 0;
689 
690  return true;
691 }
692 
693 /*
694  * libavcodec used for example
695  */
696 void AVCParser::decode_SPS(GetBitContext * gb)
697 {
698  m_seenSPS = true;
699 
700  int profile_idc = get_bits(gb, 8);
701  get_bits1(gb); // constraint_set0_flag
702  get_bits1(gb); // constraint_set1_flag
703  get_bits1(gb); // constraint_set2_flag
704  get_bits1(gb); // constraint_set3_flag
705  get_bits(gb, 4); // reserved
706  get_bits(gb, 8); // level_idc
707  get_ue_golomb(gb); // sps_id
708 
709  if (profile_idc == 100 || profile_idc == 110 || profile_idc == 122 ||
710  profile_idc == 244 || profile_idc == 44 || profile_idc == 83 ||
711  profile_idc == 86 || profile_idc == 118 || profile_idc == 128 )
712  { // high profile
713  if ((m_chromaFormatIdc = get_ue_golomb(gb)) == 3)
714  m_separateColourPlaneFlag = (get_bits1(gb) == 1);
715 
716  get_ue_golomb(gb); // bit_depth_luma_minus8
717  get_ue_golomb(gb); // bit_depth_chroma_minus8
718  get_bits1(gb); // qpprime_y_zero_transform_bypass_flag
719 
720  if (get_bits1(gb)) // seq_scaling_matrix_present_flag
721  {
722  for (int idx = 0; idx < ((m_chromaFormatIdc != 3) ? 8 : 12); ++idx)
723  {
724  if (get_bits1(gb)) // Scaling list present
725  {
726  int lastScale = 8;
727  int nextScale = 8;
728  int sl_n = ((idx < 6) ? 16 : 64);
729  for(int sl_i = 0; sl_i < sl_n; ++sl_i)
730  {
731  if (nextScale != 0)
732  {
733  int deltaScale = get_se_golomb(gb);
734  nextScale = (lastScale + deltaScale + 256) % 256;
735  }
736  lastScale = (nextScale == 0) ? lastScale : nextScale;
737  }
738  }
739  }
740  }
741  }
742 
743  /*
744  m_log2MaxFrameNum_minus4 specifies the value of the variable
745  MaxFrameNum that is used in frame_num related derivations as
746  follows:
747 
748  MaxFrameNum = 2( m_log2MaxFrameNum_minus4 + 4 )
749  */
750  m_log2MaxFrameNum = get_ue_golomb(gb) + 4;
751 
752  /*
753  m_picOrderCntType specifies the method to decode picture order
754  count (as specified in subclause 8.2.1). The value of
755  m_picOrderCntType shall be in the range of 0 to 2, inclusive.
756  */
757  m_picOrderCntType = get_ue_golomb(gb);
758  if (m_picOrderCntType == 0)
759  {
760  /*
761  m_log2MaxPicOrderCntLsbMinus4 specifies the value of the
762  variable MaxPicOrderCntLsb that is used in the decoding
763  process for picture order count as specified in subclause
764  8.2.1 as follows:
765 
766  MaxPicOrderCntLsb = 2( m_log2MaxPicOrderCntLsbMinus4 + 4 )
767 
768  The value of m_log2MaxPicOrderCntLsbMinus4 shall be in
769  the range of 0 to 12, inclusive.
770  */
771  m_log2MaxPicOrderCntLsb = get_ue_golomb(gb) + 4;
772  }
773  else if (m_picOrderCntType == 1)
774  {
775  /*
776  m_deltaPicOrderAlwaysZeroFlag equal to 1 specifies that
777  m_deltaPicOrderCnt[ 0 ] and m_deltaPicOrderCnt[ 1 ] are
778  not present in the slice headers of the sequence and shall
779  be inferred to be equal to
780  0. m_deltaPicOrderAlwaysZeroFlag
781  */
782  m_deltaPicOrderAlwaysZeroFlag = get_bits1(gb);
783 
784  /*
785  offset_for_non_ref_pic is used to calculate the picture
786  order count of a non-reference picture as specified in
787  8.2.1. The value of offset_for_non_ref_pic shall be in the
788  range of -231 to 231 - 1, inclusive.
789  */
790  int offset_for_non_ref_pic = get_se_golomb(gb);
791  (void) offset_for_non_ref_pic; // suppress unused var warning
792 
793  /*
794  offset_for_top_to_bottom_field is used to calculate the
795  picture order count of a bottom field as specified in
796  subclause 8.2.1. The value of offset_for_top_to_bottom_field
797  shall be in the range of -231 to 231 - 1, inclusive.
798  */
799  int offset_for_top_to_bottom_field = get_se_golomb(gb);
800  (void) offset_for_top_to_bottom_field; // suppress unused var warning
801 
802  /*
803  offset_for_ref_frame[ i ] is an element of a list of
804  m_numRefFrames_in_pic_order_cnt_cycle values used in the
805  decoding process for picture order count as specified in
806  subclause 8.2.1. The value of offset_for_ref_frame[ i ]
807  shall be in the range of -231 to 231 - 1, inclusive.
808  */
809  uint tmp = get_ue_golomb(gb);
810  for (uint idx = 0; idx < tmp; ++idx)
811  get_se_golomb(gb); // offset_for_ref_frame[i]
812  }
813 
814  /*
815  m_numRefFrames specifies the maximum number of short-term and
816  long-term reference frames, complementary reference field pairs,
817  and non-paired reference fields that may be used by the decoding
818  process for inter prediction of any picture in the
819  sequence. m_numRefFrames also determines the size of the sliding
820  window operation as specified in subclause 8.2.5.3. The value of
821  m_numRefFrames shall be in the range of 0 to MaxDpbSize (as
822  specified in subclause A.3.1 or A.3.2), inclusive.
823  */
824  m_numRefFrames = get_ue_golomb(gb);
825  /*
826  gaps_in_frame_num_value_allowed_flag specifies the allowed
827  values of frame_num as specified in subclause 7.4.3 and the
828  decoding process in case of an inferred gap between values of
829  frame_num as specified in subclause 8.2.5.2.
830  */
831  /* bool gaps_in_frame_num_allowed_flag = */ get_bits1(gb);
832 
833  /*
834  pic_width_in_mbs_minus1 plus 1 specifies the width of each
835  decoded picture in units of macroblocks. 16 macroblocks in a row
836  */
837  m_picWidth = (get_ue_golomb(gb) + 1) * 16;
838  /*
839  pic_height_in_map_units_minus1 plus 1 specifies the height in
840  slice group map units of a decoded frame or field. 16
841  macroblocks in each column.
842  */
843  m_picHeight = (get_ue_golomb(gb) + 1) * 16;
844 
845  /*
846  m_frameMbsOnlyFlag equal to 0 specifies that coded pictures of
847  the coded video sequence may either be coded fields or coded
848  frames. m_frameMbsOnlyFlag equal to 1 specifies that every
849  coded picture of the coded video sequence is a coded frame
850  containing only frame macroblocks.
851  */
852  m_frameMbsOnlyFlag = get_bits1(gb);
853  if (!m_frameMbsOnlyFlag)
854  {
855  m_picHeight *= 2;
856 
857  /*
858  mb_adaptive_frame_field_flag equal to 0 specifies no
859  switching between frame and field macroblocks within a
860  picture. mb_adaptive_frame_field_flag equal to 1 specifies
861  the possible use of switching between frame and field
862  macroblocks within frames. When mb_adaptive_frame_field_flag
863  is not present, it shall be inferred to be equal to 0.
864  */
865  get_bits1(gb); // mb_adaptive_frame_field_flag
866  }
867 
868  get_bits1(gb); // direct_8x8_inference_flag
869 
870  /*
871  frame_cropping_flag equal to 1 specifies that the frame cropping
872  offset parameters follow next in the sequence parameter
873  set. frame_cropping_flag equal to 0 specifies that the frame
874  cropping offset parameters are not present.
875  */
876  if (get_bits1(gb)) // frame_cropping_flag
877  {
878  m_frameCropLeftOffset = get_ue_golomb(gb);
879  m_frameCropRightOffset = get_ue_golomb(gb);
880  m_frameCropTopOffset = get_ue_golomb(gb);
881  m_frameCropBottomOffset = get_ue_golomb(gb);
882  }
883 
884  /*
885  vui_parameters_present_flag equal to 1 specifies that the
886  vui_parameters( ) syntax structure as specified in Annex E is
887  present. vui_parameters_present_flag equal to 0 specifies that
888  the vui_parameters( ) syntax structure as specified in Annex E
889  is not present.
890  */
891  if (get_bits1(gb)) // vui_parameters_present_flag
892  vui_parameters(gb, false);
893 }
894 
895 void AVCParser::parse_SPS(uint8_t *sps, uint32_t sps_size,
896  bool& interlaced, int32_t& max_ref_frames)
897 {
898  GetBitContext gb;
899  init_get_bits(&gb, sps, sps_size << 3);
900  decode_SPS(&gb);
901  interlaced = (m_frameMbsOnlyFlag == 0);
902  max_ref_frames = m_numRefFrames;
903 }
904 
905 void AVCParser::decode_PPS(GetBitContext * gb)
906 {
907  /*
908  m_picParameterSetId identifies the picture parameter set that
909  is referred to in the slice header. The value of
910  m_picParameterSetId shall be in the range of 0 to 255,
911  inclusive.
912  */
913  m_picParameterSetId = get_ue_golomb(gb);
914 
915  /*
916  m_seqParameterSetId refers to the active sequence parameter
917  set. The value of m_seqParameterSetId shall be in the range of
918  0 to 31, inclusive.
919  */
920  m_seqParameterSetId = get_ue_golomb(gb);
921  get_bits1(gb); // entropy_coding_mode_flag;
922 
923  /*
924  m_picOrderPresentFlag equal to 1 specifies that the picture
925  order count related syntax elements are present in the slice
926  headers as specified in subclause 7.3.3. m_picOrderPresentFlag
927  equal to 0 specifies that the picture order count related syntax
928  elements are not present in the slice headers.
929  */
930  m_picOrderPresentFlag = get_bits1(gb);
931 
932 #if 0 // Rest not currently needed, and requires <math.h>
933  uint num_slice_groups = get_ue_golomb(gb) + 1;
934  if (num_slice_groups > 1) // num_slice_groups (minus 1)
935  {
936  uint idx;
937 
938  switch (get_ue_golomb(gb)) // slice_group_map_type
939  {
940  case 0:
941  for (idx = 0; idx < num_slice_groups; ++idx)
942  get_ue_golomb(gb); // run_length_minus1[idx]
943  break;
944  case 1:
945  for (idx = 0; idx < num_slice_groups; ++idx)
946  {
947  get_ue_golomb(gb); // top_left[idx]
948  get_ue_golomb(gb); // bottom_right[idx]
949  }
950  break;
951  case 3:
952  case 4:
953  case 5:
954  get_bits1(gb); // slice_group_change_direction_flag
955  get_ue_golomb(gb); // slice_group_change_rate_minus1
956  break;
957  case 6:
958  uint pic_size_in_map_units = get_ue_golomb(gb) + 1;
959  uint num_bits = (int)ceil(log2(num_slice_groups));
960  for (idx = 0; idx < pic_size_in_map_units; ++idx)
961  {
962  get_bits(gb, num_bits); //slice_group_id[idx]
963  }
964  }
965  }
966 
967  get_ue_golomb(gb); // num_ref_idx_10_active_minus1
968  get_ue_golomb(gb); // num_ref_idx_11_active_minus1
969  get_bits1(gb); // weighted_pred_flag;
970  get_bits(gb, 2); // weighted_bipred_idc
971  get_se_golomb(gb); // pic_init_qp_minus26
972  get_se_golomb(gb); // pic_init_qs_minus26
973  get_se_golomb(gb); // chroma_qp_index_offset
974  get_bits1(gb); // deblocking_filter_control_present_flag
975  get_bits1(gb); // constrained_intra_pref_flag
976  m_redundantPicCntPresentFlag = get_bits1(gb);
977 #endif
978 }
979 
980 void AVCParser::decode_SEI(GetBitContext *gb)
981 {
982  int recovery_frame_cnt = -1;
983 #if 0
984  bool exact_match_flag = false;
985  bool broken_link_flag = false;
986  int changing_group_slice_idc = -1;
987 #endif
988 
989  int type = 0;
990  int size = 0;
991 
992  /* A message requires at least 2 bytes, and then
993  * there's the stop bit plus alignment, so there
994  * can be no message in less than 24 bits */
995  while (get_bits_left(gb) >= 24)
996  {
997  do {
998  type += show_bits(gb, 8);
999  } while (get_bits(gb, 8) == 0xFF);
1000 
1001  do {
1002  size += show_bits(gb, 8);
1003  } while (get_bits(gb, 8) == 0xFF);
1004 
1005  switch (type)
1006  {
1008  recovery_frame_cnt = get_ue_golomb(gb);
1009 #if 0
1010  exact_match_flag = (get_bits1(gb) != 0U);
1011  broken_link_flag = (get_bits1(gb) != 0U);
1012  changing_group_slice_idc = get_bits(gb, 2);
1013 #endif
1014  m_auContainsKeyframeMessage = (recovery_frame_cnt == 0);
1015  if ((size - 12) > 0)
1016  skip_bits(gb, (size - 12) * 8);
1017  return;
1018 
1019  default:
1020  skip_bits(gb, size * 8);
1021  break;
1022  }
1023  }
1024 }
1025 
1026 // Following the lead of libavcodec, ignore the left cropping.
1028 {
1029  uint ChromaArrayType = m_separateColourPlaneFlag ? 0 : m_chromaFormatIdc;
1030  uint CropUnitX = 1;
1031  uint SubWidthC = m_chromaFormatIdc == 3 ? 1 : 2;
1032  if (ChromaArrayType != 0)
1033  CropUnitX = SubWidthC;
1034  uint crop = CropUnitX * m_frameCropRightOffset;
1035  return m_picWidth - crop;
1036 }
1037 
1038 // Following the lead of libavcodec, ignore the top cropping.
1040 {
1041  uint ChromaArrayType = m_separateColourPlaneFlag ? 0 : m_chromaFormatIdc;
1042  uint CropUnitY = 2 - m_frameMbsOnlyFlag;
1043  uint SubHeightC = m_chromaFormatIdc <= 1 ? 2 : 1;
1044  if (ChromaArrayType != 0)
1045  CropUnitY *= SubHeightC;
1046  uint crop = CropUnitY * m_frameCropBottomOffset;
1047  return m_picHeight - crop;
1048 }
1049 
1051 {
1052  if (m_bottomFieldFlag == -1)
1053  return FRAME;
1055 }
1056 
1057 /* H.264
1058 
1059  num_units_in_tick is the number of time units of a clock operating
1060  at the frequency time_scale Hz that corresponds to one increment
1061  (called a clock tick) of a clock tick counter. num_units_in_tick
1062  shall be greater than 0. A clock tick is the minimum interval of
1063  time that can be represented in the coded data. For example, when
1064  the frame rate of a video signal is 30 000 ÷ 1001 Hz, time_scale
1065  may be equal to 60 000 and num_units_in_tick may be equal to
1066  1001. See Equation C-1.
1067 */
1068 
1069 double AVCParser::frameRate(void) const
1070 {
1071  uint64_t num = 500 * (uint64_t)m_timeScale; /* 1000 * 0.5 */
1072  double fps = ( m_unitsInTick != 0 ? num / (double)m_unitsInTick : 0 ) / 1000;
1073 
1074  return fps;
1075 }
1076 
1078 {
1079  if (m_unitsInTick == 0)
1080  result = FrameRate(0);
1081  else if (m_timeScale & 0x1)
1082  result = FrameRate(m_timeScale, m_unitsInTick * 2);
1083  else
1084  result = FrameRate(m_timeScale / 2, m_unitsInTick);
1085 }
AVCParser::getFrameRate
void getFrameRate(FrameRate &result) const override
Definition: AVCParser.cpp:1077
H2645Parser::FRAME
@ FRAME
Definition: H2645Parser.h:81
H2645Parser::m_seenSPS
bool m_seenSPS
Definition: H2645Parser.h:188
H2645Parser::m_frameCropRightOffset
uint m_frameCropRightOffset
Definition: H2645Parser.h:169
H2645Parser::m_frameStartOffset
uint64_t m_frameStartOffset
Definition: H2645Parser.h:153
AVCParser::PPS
@ PPS
Definition: AVCParser.h:43
H2645Parser::fillRBSP
bool fillRBSP(const uint8_t *byteP, uint32_t byte_count, bool found_start_code)
Definition: H2645Parser.cpp:141
H2645Parser::m_separateColourPlaneFlag
bool m_separateColourPlaneFlag
Definition: H2645Parser.h:189
AVCParser::m_sliceType
uint m_sliceType
Definition: AVCParser.h:158
AVCParser::END_SEQUENCE
@ END_SEQUENCE
Definition: AVCParser.h:45
AVCParser::decode_SPS
void decode_SPS(GetBitContext *gb)
Definition: AVCParser.cpp:696
AVCParser::m_prevPicOrderCntType
uint8_t m_prevPicOrderCntType
Definition: AVCParser.h:174
dtvrecorder.h
H2645Parser::vui_parameters
void vui_parameters(GetBitContext *gb, bool hevc)
Definition: H2645Parser.cpp:229
H2645Parser::m_keyframeStartOffset
uint64_t m_keyframeStartOffset
Definition: H2645Parser.h:154
AVCParser::m_prevIdrPicId
uint m_prevIdrPicId
Definition: AVCParser.h:155
AVCParser::m_prevNALRefIdc
uint8_t m_prevNALRefIdc
Definition: AVCParser.h:173
AVCParser::m_deltaPicOrderCnt
std::array< int, 2 > m_deltaPicOrderCnt
Definition: AVCParser.h:141
AVCParser::parse_SPS
void parse_SPS(uint8_t *sps, uint32_t sps_size, bool &interlaced, int32_t &max_ref_frames)
Definition: AVCParser.cpp:895
AVCParser::NAL_type_str
QString NAL_type_str(int8_t type) override
Definition: AVCParser.cpp:134
AVCParser::AU_DELIMITER
@ AU_DELIMITER
Definition: AVCParser.h:44
H2645Parser::m_unitsInTick
uint32_t m_unitsInTick
Definition: H2645Parser.h:163
H2645Parser::field_type
field_type
Definition: H2645Parser.h:80
H2645Parser::m_picWidth
uint m_picWidth
Definition: H2645Parser.h:172
H2645Parser::m_pktOffset
uint64_t m_pktOffset
Definition: H2645Parser.h:155
H2645Parser::FIELD_BOTTOM
@ FIELD_BOTTOM
Definition: H2645Parser.h:83
AVCParser::m_deltaPicOrderAlwaysZeroFlag
uint8_t m_deltaPicOrderAlwaysZeroFlag
Definition: AVCParser.h:170
H2645Parser::m_frameCropLeftOffset
uint m_frameCropLeftOffset
Definition: H2645Parser.h:168
H2645Parser::Reset
virtual void Reset(void)
Definition: H2645Parser.cpp:100
H2645Parser::FIELD_TOP
@ FIELD_TOP
Definition: H2645Parser.h:82
AVCParser::m_prevPicOrderCntLsb
int m_prevPicOrderCntLsb
Definition: AVCParser.h:148
AVCParser::m_frameNum
int m_frameNum
Definition: AVCParser.h:142
AVCParser::m_iIsKeyframe
bool m_iIsKeyframe
Definition: AVCParser.h:177
AVCParser::SLICE_DPB
@ SLICE_DPB
Definition: AVCParser.h:38
x3
static int x3
Definition: mythsocket.cpp:62
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
AVCParser::m_nalRefIdc
uint8_t m_nalRefIdc
Definition: AVCParser.h:171
AVCParser::m_redundantPicCnt
uint m_redundantPicCnt
Definition: AVCParser.h:156
AVCParser::m_prevPicParameterSetId
int m_prevPicParameterSetId
Definition: AVCParser.h:149
AVCParser::m_prevBottomFieldFlag
int8_t m_prevBottomFieldFlag
Definition: AVCParser.h:165
AVCParser::SLICE_DPA
@ SLICE_DPA
Definition: AVCParser.h:37
AVCParser::SEI
@ SEI
Definition: AVCParser.h:41
AVCParser::SLICE_DPC
@ SLICE_DPC
Definition: AVCParser.h:39
AVCParser::m_prevDeltaPicOrderCnt
std::array< int, 2 > m_prevDeltaPicOrderCnt
Definition: AVCParser.h:146
tmp
static guint32 * tmp
Definition: goom_core.cpp:31
AVCParser::decode_SEI
void decode_SEI(GetBitContext *gb)
Definition: AVCParser.cpp:980
AVCParser::m_prevDeltaPicOrderCntBottom
int m_prevDeltaPicOrderCntBottom
Definition: AVCParser.h:145
AVCParser::m_log2MaxFrameNum
uint m_log2MaxFrameNum
Definition: AVCParser.h:152
mythlogging.h
AVCParser::m_picOrderCntLsb
int m_picOrderCntLsb
Definition: AVCParser.h:143
AVCParser::pictureHeightCropped
uint pictureHeightCropped(void) const override
Definition: AVCParser.cpp:1039
H2645Parser::m_rbspIndex
uint32_t m_rbspIndex
Definition: H2645Parser.h:160
AVCParser::processRBSP
void processRBSP(bool rbsp_complete)
Definition: AVCParser.cpp:419
AVCParser::m_fieldPicFlag
int8_t m_fieldPicFlag
Definition: AVCParser.h:161
H2645Parser::m_frameCropBottomOffset
uint m_frameCropBottomOffset
Definition: H2645Parser.h:167
AVCParser::new_AU
bool new_AU(void)
Definition: AVCParser.cpp:170
AVCParser::SLICE_IDR
@ SLICE_IDR
Definition: AVCParser.h:40
x1
static int x1
Definition: mythsocket.cpp:60
AVCParser::m_picOrderPresentFlag
int8_t m_picOrderPresentFlag
Definition: AVCParser.h:164
AVCParser::getFieldType
field_type getFieldType(void) const override
Definition: AVCParser.cpp:1050
AVCParser::m_auContainsKeyframeMessage
bool m_auContainsKeyframeMessage
Definition: AVCParser.h:176
FrameRate
Definition: recorderbase.h:37
AVCParser::m_deltaPicOrderCntBottom
int m_deltaPicOrderCntBottom
Definition: AVCParser.h:140
H2645Parser::m_rbspBuffer
uint8_t * m_rbspBuffer
Definition: H2645Parser.h:176
H2645Parser::m_auOffset
uint64_t m_auOffset
Definition: H2645Parser.h:152
H2645Parser::m_auPending
bool m_auPending
Definition: H2645Parser.h:181
H2645Parser::m_onKeyFrame
bool m_onKeyFrame
Definition: H2645Parser.h:187
AVCParser::SLICE
@ SLICE
Definition: AVCParser.h:36
H2645Parser::MAX_SLICE_HEADER_SIZE
@ MAX_SLICE_HEADER_SIZE
Definition: H2645Parser.h:77
uint
unsigned int uint
Definition: compat.h:141
H2645Parser::m_spsOffset
uint64_t m_spsOffset
Definition: H2645Parser.h:156
AVCParser::m_redundantPicCntPresentFlag
int8_t m_redundantPicCntPresentFlag
Definition: AVCParser.h:168
AVCParser::m_seqParameterSetId
uint m_seqParameterSetId
Definition: AVCParser.h:157
AVCParser::m_nalUnitType
int8_t m_nalUnitType
Definition: AVCParser.h:163
strings.h
AVCParser::frameRate
double frameRate(void) const
Definition: AVCParser.cpp:1069
H2645Parser::m_stateChanged
bool m_stateChanged
Definition: H2645Parser.h:190
AVCParser.h
H2645Parser::m_timeScale
uint32_t m_timeScale
Definition: H2645Parser.h:162
H2645Parser::m_onFrame
bool m_onFrame
Definition: H2645Parser.h:186
H2645Parser::m_isKeyframe
bool m_isKeyframe
Definition: H2645Parser.h:184
H2645Parser::m_haveUnfinishedNAL
bool m_haveUnfinishedNAL
Definition: H2645Parser.h:183
H2645Parser::m_frameCropTopOffset
uint m_frameCropTopOffset
Definition: H2645Parser.h:170
AVCParser::set_AU_pending
void set_AU_pending(void)
Definition: AVCParser.h:119
H2645Parser::m_syncAccumulator
uint32_t m_syncAccumulator
Definition: H2645Parser.h:161
musicbrainzngs.compat.bytes
bytes
Definition: compat.py:49
AVCParser::m_bottomFieldFlag
int8_t m_bottomFieldFlag
Definition: AVCParser.h:160
AVCParser::decode_Header
bool decode_Header(GetBitContext *gb)
Definition: AVCParser.cpp:500
AVCParser::SEI_TYPE_RECOVERY_POINT
@ SEI_TYPE_RECOVERY_POINT
Definition: AVCParser.h:59
AVCParser::FILLER_DATA
@ FILLER_DATA
Definition: AVCParser.h:47
H2645Parser::m_chromaFormatIdc
int8_t m_chromaFormatIdc
Definition: H2645Parser.h:179
AVCParser::m_prevNalUnitType
int8_t m_prevNalUnitType
Definition: AVCParser.h:167
H2645Parser::SLICE_UNDEF
@ SLICE_UNDEF
Definition: H2645Parser.h:136
AVCParser::m_picParameterSetId
int m_picParameterSetId
Definition: AVCParser.h:144
H2645Parser::m_picHeight
uint m_picHeight
Definition: H2645Parser.h:171
AVCParser::decode_PPS
void decode_PPS(GetBitContext *gb)
Definition: AVCParser.cpp:905
AVCParser::NALisSlice
static bool NALisSlice(int8_t nal_type)
Definition: AVCParser.h:91
AVCParser::pictureWidthCropped
uint pictureWidthCropped(void) const override
Definition: AVCParser.cpp:1027
H2645Parser::UNKNOWN
@ UNKNOWN
Definition: H2645Parser.h:122
AVCParser::SPS
@ SPS
Definition: AVCParser.h:42
AVCParser::SPS_EXT
@ SPS_EXT
Definition: AVCParser.h:48
AVCParser::m_prevFrameNum
int m_prevFrameNum
Definition: AVCParser.h:147
AVCParser::m_picOrderCntType
uint8_t m_picOrderCntType
Definition: AVCParser.h:172
AVCParser::m_idrPicId
uint m_idrPicId
Definition: AVCParser.h:151
H2645Parser::resetRBSP
void resetRBSP(void)
Definition: H2645Parser.cpp:134
AVCParser::m_prevFieldPicFlag
int8_t m_prevFieldPicFlag
Definition: AVCParser.h:166
AVCParser::m_log2MaxPicOrderCntLsb
uint m_log2MaxPicOrderCntLsb
Definition: AVCParser.h:153
AVCParser::Reset
void Reset(void) override
Definition: AVCParser.cpp:92
AVCParser::addBytes
uint32_t addBytes(const uint8_t *bytes, uint32_t byte_count, uint64_t stream_offset) override
Definition: AVCParser.cpp:289
AVCParser::m_numRefFrames
uint m_numRefFrames
Definition: AVCParser.h:154
AVCParser::m_frameMbsOnlyFlag
int8_t m_frameMbsOnlyFlag
Definition: AVCParser.h:162
AVCParser::END_STREAM
@ END_STREAM
Definition: AVCParser.h:46
AVCParser::isKeySlice
static bool isKeySlice(uint slice_type)
Definition: AVCParser.h:83