PageRenderTime 45ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/H264Dec/source/h264bsd_storage.h

http://github.com/mbebenita/Broadway
C Header | 174 lines | 77 code | 33 blank | 64 comment | 0 complexity | f75acee8c6f1195087a7388688b61130 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_STORAGE_H
  24. #define H264SWDEC_STORAGE_H
  25. /*------------------------------------------------------------------------------
  26. 1. Include headers
  27. ------------------------------------------------------------------------------*/
  28. #include "basetype.h"
  29. #include "h264bsd_cfg.h"
  30. #include "h264bsd_seq_param_set.h"
  31. #include "h264bsd_pic_param_set.h"
  32. #include "h264bsd_macroblock_layer.h"
  33. #include "h264bsd_nal_unit.h"
  34. #include "h264bsd_slice_header.h"
  35. #include "h264bsd_seq_param_set.h"
  36. #include "h264bsd_dpb.h"
  37. #include "h264bsd_pic_order_cnt.h"
  38. /*------------------------------------------------------------------------------
  39. 2. Module defines
  40. ------------------------------------------------------------------------------*/
  41. /*------------------------------------------------------------------------------
  42. 3. Data types
  43. ------------------------------------------------------------------------------*/
  44. typedef struct
  45. {
  46. u32 sliceId;
  47. u32 numDecodedMbs;
  48. u32 lastMbAddr;
  49. } sliceStorage_t;
  50. /* structure to store parameters needed for access unit boundary checking */
  51. typedef struct
  52. {
  53. nalUnit_t nuPrev[1];
  54. u32 prevFrameNum;
  55. u32 prevIdrPicId;
  56. u32 prevPicOrderCntLsb;
  57. i32 prevDeltaPicOrderCntBottom;
  58. i32 prevDeltaPicOrderCnt[2];
  59. u32 firstCallFlag;
  60. } aubCheck_t;
  61. /* storage data structure, holds all data of a decoder instance */
  62. typedef struct
  63. {
  64. /* active paramet set ids and pointers */
  65. u32 oldSpsId;
  66. u32 activePpsId;
  67. u32 activeSpsId;
  68. picParamSet_t *activePps;
  69. seqParamSet_t *activeSps;
  70. seqParamSet_t *sps[MAX_NUM_SEQ_PARAM_SETS];
  71. picParamSet_t *pps[MAX_NUM_PIC_PARAM_SETS];
  72. /* current slice group map, recomputed for each slice */
  73. u32 *sliceGroupMap;
  74. u32 picSizeInMbs;
  75. /* this flag is set after all macroblocks of a picture successfully
  76. * decoded -> redundant slices not decoded */
  77. u32 skipRedundantSlices;
  78. u32 picStarted;
  79. /* flag to indicate if current access unit contains any valid slices */
  80. u32 validSliceInAccessUnit;
  81. /* store information needed for handling of slice decoding */
  82. sliceStorage_t slice[1];
  83. /* number of concealed macroblocks in the current image */
  84. u32 numConcealedMbs;
  85. /* picId given by application */
  86. u32 currentPicId;
  87. /* macroblock specific storages, size determined by image dimensions */
  88. mbStorage_t *mb;
  89. /* flag to store noOutputReordering flag set by the application */
  90. u32 noReordering;
  91. /* DPB */
  92. dpbStorage_t dpb[1];
  93. /* structure to store picture order count related information */
  94. pocStorage_t poc[1];
  95. /* access unit boundary checking related data */
  96. aubCheck_t aub[1];
  97. /* current processed image */
  98. image_t currImage[1];
  99. /* last valid NAL unit header is stored here */
  100. nalUnit_t prevNalUnit[1];
  101. /* slice header, second structure used as a temporary storage while
  102. * decoding slice header, first one stores last successfully decoded
  103. * slice header */
  104. sliceHeader_t sliceHeader[2];
  105. /* fields to store old stream buffer pointers, needed when only part of
  106. * a stream buffer is processed by h264bsdDecode function */
  107. u32 prevBufNotFinished;
  108. u8 *prevBufPointer;
  109. u32 prevBytesConsumed;
  110. strmData_t strm[1];
  111. /* macroblock layer structure, there is no need to store this but it
  112. * would have increased the stack size excessively and needed to be
  113. * allocated from head -> easiest to put it here */
  114. macroblockLayer_t *mbLayer;
  115. u32 pendingActivation; /* Activate parameter sets after returning
  116. HEADERS_RDY to the user */
  117. u32 intraConcealmentFlag; /* 0 gray picture for corrupted intra
  118. 1 previous frame used if available */
  119. } storage_t;
  120. /*------------------------------------------------------------------------------
  121. 4. Function prototypes
  122. ------------------------------------------------------------------------------*/
  123. void h264bsdInitStorage(storage_t *pStorage);
  124. void h264bsdResetStorage(storage_t *pStorage);
  125. u32 h264bsdIsStartOfPicture(storage_t *pStorage);
  126. u32 h264bsdIsEndOfPicture(storage_t *pStorage);
  127. u32 h264bsdStoreSeqParamSet(storage_t *pStorage, seqParamSet_t *pSeqParamSet);
  128. u32 h264bsdStorePicParamSet(storage_t *pStorage, picParamSet_t *pPicParamSet);
  129. u32 h264bsdActivateParamSets(storage_t *pStorage, u32 ppsId, u32 isIdr);
  130. void h264bsdComputeSliceGroupMap(storage_t *pStorage,
  131. u32 sliceGroupChangeCycle);
  132. u32 h264bsdCheckAccessUnitBoundary(
  133. strmData_t *strm,
  134. nalUnit_t *nuNext,
  135. storage_t *storage,
  136. u32 *accessUnitBoundaryFlag);
  137. u32 h264bsdValidParamSets(storage_t *pStorage);
  138. #endif /* #ifdef H264SWDEC_STORAGE_H */