H264SequenceParameterSet.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*------------------------------------------------------------------------------
  2. -- --
  3. -- This software is confidential and proprietary and may be used --
  4. -- only as expressly authorized by a licensing agreement from --
  5. -- --
  6. -- Hantro Products Oy. --
  7. -- --
  8. -- (C) COPYRIGHT 2006 HANTRO PRODUCTS OY --
  9. -- ALL RIGHTS RESERVED --
  10. -- --
  11. -- The entire notice above must be reproduced --
  12. -- on all copies and should not be removed. --
  13. -- --
  14. --------------------------------------------------------------------------------
  15. --
  16. -- Abstract : H264 Sequence Parameter Set
  17. --
  18. ------------------------------------------------------------------------------*/
  19. #ifndef __H264_SEQUENCE_PARAMETER_SET_h__
  20. #define __H264_SEQUENCE_PARAMETER_SET_h__
  21. /*------------------------------------------------------------------------------
  22. 1. Include headers
  23. ------------------------------------------------------------------------------*/
  24. #include "basetype.h"
  25. #include "enccommon.h"
  26. #include "H264PutBits.h"
  27. #include "H264Slice.h"
  28. /*------------------------------------------------------------------------------
  29. 2. External compiler flags
  30. --------------------------------------------------------------------------------
  31. --------------------------------------------------------------------------------
  32. 3. Module defines
  33. ------------------------------------------------------------------------------*/
  34. typedef struct
  35. {
  36. u32 timeScale;
  37. u32 numUnitsInTick;
  38. u32 bitStreamRestrictionFlag;
  39. u32 videoFullRange;
  40. u32 sarWidth;
  41. u32 sarHeight;
  42. u32 nalHrdParametersPresentFlag;
  43. u32 vclHrdParametersPresentFlag;
  44. u32 pictStructPresentFlag;
  45. u32 initialCpbRemovalDelayLength;
  46. u32 cpbRemovalDelayLength;
  47. u32 dpbOutputDelayLength;
  48. u32 timeOffsetLength;
  49. u32 bitRate;
  50. u32 cpbSize;
  51. } vui_t;
  52. typedef struct
  53. {
  54. true_e byteStream;
  55. u32 profileIdc;
  56. true_e constraintSet0;
  57. true_e constraintSet1;
  58. true_e constraintSet2;
  59. true_e constraintSet3;
  60. u32 levelIdc;
  61. u32 levelIdx;
  62. u32 seqParameterSetId;
  63. i32 log2MaxFrameNumMinus4;
  64. u32 picOrderCntType;
  65. u32 numRefFrames;
  66. true_e gapsInFrameNumValueAllowed;
  67. i32 picWidthInMbsMinus1;
  68. i32 picHeightInMapUnitsMinus1;
  69. true_e frameMbsOnly;
  70. true_e direct8x8Inference;
  71. true_e frameCropping;
  72. true_e vuiParametersPresent;
  73. vui_t vui;
  74. u32 frameCropLeftOffset;
  75. u32 frameCropRightOffset;
  76. u32 frameCropTopOffset;
  77. u32 frameCropBottomOffset;
  78. } sps_s;
  79. extern const u32 H264LevelIdc[];
  80. extern const u32 H264MaxCPBS[];
  81. extern const u32 H264MaxFS[];
  82. extern const u32 H264SqrtMaxFS8[];
  83. extern const u32 H264MaxMBPS[];
  84. extern const u32 H264MaxBR[];
  85. #define INVALID_LEVEL 0xFFFF
  86. /*------------------------------------------------------------------------------
  87. 4. Function prototypes
  88. ------------------------------------------------------------------------------*/
  89. void H264SeqParameterSetInit(sps_s * sps);
  90. void H264SeqParameterSet(stream_s * stream, sps_s * sps, true_e nalHeader);
  91. void H264SubsetSeqParameterSet(stream_s * stream, sps_s * sps);
  92. void H264EndOfSequence(stream_s * stream, sps_s * sps);
  93. void H264EndOfStream(stream_s * stream, sps_s * sps);
  94. u32 H264GetLevelIndex(u32 levelIdc);
  95. bool_e H264CheckLevel(sps_s * sps, i32 bitRate, i32 frameRateNum,
  96. i32 frameRateDenom);
  97. void H264SpsSetVuiTimigInfo(sps_s * sps, u32 timeScale, u32 numUnitsInTick);
  98. void H264SpsSetVuiVideoInfo(sps_s * sps, u32 videoFullRange);
  99. void H264SpsSetVuiAspectRatio(sps_s * sps, u32 sampleAspectRatioWidth,
  100. u32 sampleAspectRatioHeight);
  101. void H264SpsSetVuiPictStructPresentFlag(sps_s * sps, u32 flag);
  102. void H264SpsSetVuiHrd(sps_s * sps, u32 present);
  103. void H264SpsSetVuiHrdBitRate(sps_s * sps, u32 bitRate);
  104. void H264SpsSetVuiHrdCpbSize(sps_s * sps, u32 cpbSize);
  105. u32 H264SpsGetVuiHrdBitRate(sps_s * sps);
  106. u32 H264SpsGetVuiHrdCpbSize(sps_s * sps);
  107. #endif