PageRenderTime 33ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/H264Dec/source/h264bsd_slice_header.h

http://github.com/mbebenita/Broadway
C Header | 186 lines | 108 code | 28 blank | 50 comment | 6 complexity | e87f45db186d0275e6ede534bcdcd1f2 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. /*
  2. * Copyright (C) 2009 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /*------------------------------------------------------------------------------
  17. Table of contents
  18. 1. Include headers
  19. 2. Module defines
  20. 3. Data types
  21. 4. Function prototypes
  22. ------------------------------------------------------------------------------*/
  23. #ifndef H264SWDEC_SLICE_HEADER_H
  24. #define H264SWDEC_SLICE_HEADER_H
  25. /*------------------------------------------------------------------------------
  26. 1. Include headers
  27. ------------------------------------------------------------------------------*/
  28. #include "basetype.h"
  29. #include "h264bsd_stream.h"
  30. #include "h264bsd_cfg.h"
  31. #include "h264bsd_seq_param_set.h"
  32. #include "h264bsd_pic_param_set.h"
  33. #include "h264bsd_nal_unit.h"
  34. /*------------------------------------------------------------------------------
  35. 2. Module defines
  36. ------------------------------------------------------------------------------*/
  37. enum {
  38. P_SLICE = 0,
  39. I_SLICE = 2
  40. };
  41. enum {NO_LONG_TERM_FRAME_INDICES = 0xFFFF};
  42. /* macro to determine if slice is an inter slice, sliceTypes 0 and 5 */
  43. #define IS_P_SLICE(sliceType) (((sliceType) == P_SLICE) || \
  44. ((sliceType) == P_SLICE + 5))
  45. /* macro to determine if slice is an intra slice, sliceTypes 2 and 7 */
  46. #define IS_I_SLICE(sliceType) (((sliceType) == I_SLICE) || \
  47. ((sliceType) == I_SLICE + 5))
  48. /*------------------------------------------------------------------------------
  49. 3. Data types
  50. ------------------------------------------------------------------------------*/
  51. /* structure to store data of one reference picture list reordering operation */
  52. typedef struct
  53. {
  54. u32 reorderingOfPicNumsIdc;
  55. u32 absDiffPicNum;
  56. u32 longTermPicNum;
  57. } refPicListReorderingOperation_t;
  58. /* structure to store reference picture list reordering operations */
  59. typedef struct
  60. {
  61. u32 refPicListReorderingFlagL0;
  62. refPicListReorderingOperation_t command[MAX_NUM_REF_PICS+1];
  63. } refPicListReordering_t;
  64. /* structure to store data of one DPB memory management control operation */
  65. typedef struct
  66. {
  67. u32 memoryManagementControlOperation;
  68. u32 differenceOfPicNums;
  69. u32 longTermPicNum;
  70. u32 longTermFrameIdx;
  71. u32 maxLongTermFrameIdx;
  72. } memoryManagementOperation_t;
  73. /* worst case scenario: all MAX_NUM_REF_PICS pictures in the buffer are
  74. * short term pictures, each one of them is first marked as long term
  75. * reference picture which is then marked as unused for reference.
  76. * Additionally, max long-term frame index is set and current picture is
  77. * marked as long term reference picture. Last position reserved for
  78. * end memory_management_control_operation command */
  79. #define MAX_NUM_MMC_OPERATIONS (2*MAX_NUM_REF_PICS+2+1)
  80. /* structure to store decoded reference picture marking data */
  81. typedef struct
  82. {
  83. u32 noOutputOfPriorPicsFlag;
  84. u32 longTermReferenceFlag;
  85. u32 adaptiveRefPicMarkingModeFlag;
  86. memoryManagementOperation_t operation[MAX_NUM_MMC_OPERATIONS];
  87. } decRefPicMarking_t;
  88. /* structure to store slice header data decoded from the stream */
  89. typedef struct
  90. {
  91. u32 firstMbInSlice;
  92. u32 sliceType;
  93. u32 picParameterSetId;
  94. u32 frameNum;
  95. u32 idrPicId;
  96. u32 picOrderCntLsb;
  97. i32 deltaPicOrderCntBottom;
  98. i32 deltaPicOrderCnt[2];
  99. u32 redundantPicCnt;
  100. u32 numRefIdxActiveOverrideFlag;
  101. u32 numRefIdxL0Active;
  102. i32 sliceQpDelta;
  103. u32 disableDeblockingFilterIdc;
  104. i32 sliceAlphaC0Offset;
  105. i32 sliceBetaOffset;
  106. u32 sliceGroupChangeCycle;
  107. refPicListReordering_t refPicListReordering;
  108. decRefPicMarking_t decRefPicMarking;
  109. } sliceHeader_t;
  110. /*------------------------------------------------------------------------------
  111. 4. Function prototypes
  112. ------------------------------------------------------------------------------*/
  113. u32 h264bsdDecodeSliceHeader(strmData_t *pStrmData,
  114. sliceHeader_t *pSliceHeader,
  115. seqParamSet_t *pSeqParamSet,
  116. picParamSet_t *pPicParamSet,
  117. nalUnit_t *pNalUnit);
  118. u32 h264bsdCheckPpsId(strmData_t *pStrmData, u32 *ppsId);
  119. u32 h264bsdCheckFrameNum(
  120. strmData_t *pStrmData,
  121. u32 maxFrameNum,
  122. u32 *frameNum);
  123. u32 h264bsdCheckIdrPicId(
  124. strmData_t *pStrmData,
  125. u32 maxFrameNum,
  126. nalUnitType_e nalUnitType,
  127. u32 *idrPicId);
  128. u32 h264bsdCheckPicOrderCntLsb(
  129. strmData_t *pStrmData,
  130. seqParamSet_t *pSeqParamSet,
  131. nalUnitType_e nalUnitType,
  132. u32 *picOrderCntLsb);
  133. u32 h264bsdCheckDeltaPicOrderCntBottom(
  134. strmData_t *pStrmData,
  135. seqParamSet_t *pSeqParamSet,
  136. nalUnitType_e nalUnitType,
  137. i32 *deltaPicOrderCntBottom);
  138. u32 h264bsdCheckDeltaPicOrderCnt(
  139. strmData_t *pStrmData,
  140. seqParamSet_t *pSeqParamSet,
  141. nalUnitType_e nalUnitType,
  142. u32 picOrderPresentFlag,
  143. i32 *deltaPicOrderCnt);
  144. u32 h264bsdCheckRedundantPicCnt(
  145. strmData_t *pStrmData,
  146. seqParamSet_t *pSeqParamSet,
  147. picParamSet_t *pPicParamSet,
  148. nalUnitType_e nalUnitType,
  149. u32 *redundantPicCnt);
  150. u32 h264bsdCheckPriorPicsFlag(u32 * noOutputOfPriorPicsFlag,
  151. const strmData_t * pStrmData,
  152. const seqParamSet_t * pSeqParamSet,
  153. const picParamSet_t * pPicParamSet,
  154. nalUnitType_e nalUnitType);
  155. #endif /* #ifdef H264SWDEC_SLICE_HEADER_H */