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