h264hwd_storage.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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 : Storage handling functionality
  17. --
  18. --------------------------------------------------------------------------------
  19. --
  20. -- Version control information, please leave untouched.
  21. --
  22. -- $RCSfile: h264hwd_storage.h,v $
  23. -- $Date: 2010/02/15 06:59:52 $
  24. -- $Revision: 1.10 $
  25. --
  26. ------------------------------------------------------------------------------*/
  27. /*------------------------------------------------------------------------------
  28. Table of contents
  29. 1. Include headers
  30. 2. Module defines
  31. 3. Data types
  32. 4. Function prototypes
  33. ------------------------------------------------------------------------------*/
  34. #ifndef H264HWD_STORAGE_H
  35. #define H264HWD_STORAGE_H
  36. /*------------------------------------------------------------------------------
  37. 1. Include headers
  38. ------------------------------------------------------------------------------*/
  39. #include "basetype.h"
  40. #include "h264hwd_cfg.h"
  41. #include "h264hwd_seq_param_set.h"
  42. #include "h264hwd_pic_param_set.h"
  43. #include "h264hwd_macroblock_layer.h"
  44. #include "h264hwd_nal_unit.h"
  45. #include "h264hwd_slice_header.h"
  46. #include "h264hwd_seq_param_set.h"
  47. #include "h264hwd_dpb.h"
  48. #include "h264hwd_pic_order_cnt.h"
  49. /*------------------------------------------------------------------------------
  50. 2. Module defines
  51. ------------------------------------------------------------------------------*/
  52. /*------------------------------------------------------------------------------
  53. 3. Data types
  54. ------------------------------------------------------------------------------*/
  55. typedef struct
  56. {
  57. u32 sliceId;
  58. u32 numDecodedMbs;
  59. u32 lastMbAddr;
  60. } sliceStorage_t;
  61. /* structure to store parameters needed for access unit boundary checking */
  62. typedef struct
  63. {
  64. nalUnit_t nuPrev[1];
  65. u32 prevFrameNum;
  66. u32 prevIdrPicId;
  67. u32 prevPicOrderCntLsb;
  68. i32 prevDeltaPicOrderCntBottom;
  69. i32 prevDeltaPicOrderCnt[2];
  70. u32 prevFieldPicFlag;
  71. u32 prevBottomFieldFlag;
  72. u32 firstCallFlag;
  73. u32 newPicture;
  74. } aubCheck_t;
  75. /* storage data structure, holds all data of a decoder instance */
  76. typedef struct
  77. {
  78. /* active paramet set ids and pointers */
  79. u32 oldSpsId;
  80. u32 activePpsId;
  81. u32 activeSpsId;
  82. picParamSet_t *activePps;
  83. seqParamSet_t *activeSps;
  84. seqParamSet_t *sps[MAX_NUM_SEQ_PARAM_SETS];
  85. picParamSet_t *pps[MAX_NUM_PIC_PARAM_SETS];
  86. /* current slice group map, recomputed for each slice */
  87. u32 *sliceGroupMap;
  88. u32 picSizeInMbs;
  89. /* this flag is set after all macroblocks of a picture successfully
  90. * decoded -> redundant slices not decoded */
  91. u32 skipRedundantSlices;
  92. u32 picStarted;
  93. /* flag to indicate if current access unit contains any valid slices */
  94. u32 validSliceInAccessUnit;
  95. /* store information needed for handling of slice decoding */
  96. sliceStorage_t slice[1];
  97. /* number of concealed macroblocks in the current image */
  98. u32 numConcealedMbs;
  99. /* picId given by application */
  100. u32 currentPicId;
  101. /* macroblock specific storages, size determined by image dimensions */
  102. mbStorage_t *mb;
  103. /* flag to store noOutputReordering flag set by the application */
  104. u32 noReordering;
  105. /* DPB */
  106. dpbStorage_t dpb[2];
  107. /* structure to store picture order count related information */
  108. pocStorage_t poc[2];
  109. /* access unit boundary checking related data */
  110. aubCheck_t aub[1];
  111. /* current processed image */
  112. image_t currImage[1];
  113. /* last valid NAL unit header is stored here */
  114. nalUnit_t prevNalUnit[1];
  115. /* slice header, second structure used as a temporary storage while
  116. * decoding slice header, first one stores last successfully decoded
  117. * slice header */
  118. sliceHeader_t sliceHeader[2];
  119. /* fields to store old stream buffer pointers, needed when only part of
  120. * a stream buffer is processed by h264bsdDecode function */
  121. u32 prevBufNotFinished;
  122. const u8 *prevBufPointer;
  123. u32 prevBytesConsumed;
  124. strmData_t strm[1];
  125. /* macroblock layer structure, there is no need to store this but it
  126. * would have increased the stack size excessively and needed to be
  127. * allocated from heap -> easiest to put it here */
  128. macroblockLayer_t mbLayer[1];
  129. u32 asoDetected;
  130. u32 secondField;
  131. u32 checkedAub; /* signal that AUB was checked already */
  132. u32 prevIdrPicReady; /* for FFWD workaround */
  133. u32 intraFreeze;
  134. u32 pictureBroken;
  135. u32 enable2ndChroma; /* by default set according to ENABLE_2ND_CHROMA
  136. compiler flag, may be overridden by testbench */
  137. /* pointers to 2nd chroma output, only available if extension enabled */
  138. u32 *pCh2;
  139. u32 bCh2;
  140. u32 ppUsed;
  141. u32 useSmoothing;
  142. u32 currentMarked;
  143. } storage_t;
  144. /*------------------------------------------------------------------------------
  145. 4. Function prototypes
  146. ------------------------------------------------------------------------------*/
  147. void h264bsdInitStorage(storage_t * pStorage);
  148. void h264bsdResetStorage(storage_t * pStorage);
  149. u32 h264bsdIsStartOfPicture(storage_t * pStorage);
  150. u32 h264bsdIsEndOfPicture(storage_t * pStorage);
  151. u32 h264bsdStoreSeqParamSet(storage_t * pStorage, seqParamSet_t * pSeqParamSet);
  152. u32 h264bsdStorePicParamSet(storage_t * pStorage, picParamSet_t * pPicParamSet);
  153. u32 h264bsdActivateParamSets(storage_t * pStorage, u32 ppsId, u32 isIdr);
  154. void h264bsdComputeSliceGroupMap(storage_t * pStorage,
  155. u32 sliceGroupChangeCycle);
  156. u32 h264bsdCheckAccessUnitBoundary(strmData_t * strm,
  157. nalUnit_t * nuNext,
  158. storage_t * storage,
  159. u32 * accessUnitBoundaryFlag);
  160. u32 h264bsdValidParamSets(storage_t * pStorage);
  161. u32 h264bsdAllocateSwResources(const void *dwl, storage_t * pStorage,
  162. u32 isHighSupported);
  163. #endif /* #ifdef H264HWD_STORAGE_H */