• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*!
2  * \copy
3  *     Copyright (c)  2013, Cisco Systems
4  *     All rights reserved.
5  *
6  *     Redistribution and use in source and binary forms, with or without
7  *     modification, are permitted provided that the following conditions
8  *     are met:
9  *
10  *        * Redistributions of source code must retain the above copyright
11  *          notice, this list of conditions and the following disclaimer.
12  *
13  *        * Redistributions in binary form must reproduce the above copyright
14  *          notice, this list of conditions and the following disclaimer in
15  *          the documentation and/or other materials provided with the
16  *          distribution.
17  *
18  *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22  *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23  *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24  *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26  *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28  *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  *     POSSIBILITY OF SUCH DAMAGE.
30  *
31  */
32 
33 //dec_frame.h
34 #ifndef WELS_DEC_FRAME_H__
35 #define WELS_DEC_FRAME_H__
36 
37 #include "typedefs.h"
38 #include "wels_const.h"
39 #include "wels_common_basis.h"
40 #include "parameter_sets.h"
41 #include "nal_prefix.h"
42 #include "slice.h"
43 #include "picture.h"
44 #include "bit_stream.h"
45 #include "fmo.h"
46 
47 namespace WelsDec {
48 
49 ///////////////////////////////////DQ Layer level///////////////////////////////////
50 typedef struct TagDqLayer       SDqLayer;
51 typedef SDqLayer*               PDqLayer;
52 typedef struct TagLayerInfo {
53   SNalUnitHeaderExt             sNalHeaderExt;
54   SSlice                        sSliceInLayer;  // Here Slice identify to Frame on concept
55   PSubsetSps                    pSubsetSps;     // current pSubsetSps used, memory alloc in external
56   PSps                          pSps;           // current sps based avc used, memory alloc in external
57   PPps                          pPps;           // current pps used
58 } SLayerInfo, *PLayerInfo;
59 /* Layer Representation */
60 
61 struct TagDqLayer {
62   SLayerInfo                    sLayerInfo;
63 
64   PBitStringAux                 pBitStringAux;  // pointer to SBitStringAux
65   PFmo                          pFmo;           // Current fmo context pointer used
66   uint32_t* pMbType;
67   int32_t* pSliceIdc;                           // using int32_t for slice_idc
68   int16_t (*pMv[LIST_A])[MB_BLOCK4x4_NUM][MV_A];
69   int16_t (*pMvd[LIST_A])[MB_BLOCK4x4_NUM][MV_A];
70   int8_t  (*pRefIndex[LIST_A])[MB_BLOCK4x4_NUM];
71 	int8_t	(*pDirect)[MB_BLOCK4x4_NUM];
72   bool*    pNoSubMbPartSizeLessThan8x8Flag;
73   bool*    pTransformSize8x8Flag;
74   int8_t*  pLumaQp;
75   int8_t (*pChromaQp)[2];
76   int8_t*  pCbp;
77   uint16_t *pCbfDc;
78   int8_t (*pNzc)[24];
79   int8_t (*pNzcRs)[24];
80   int8_t*  pResidualPredFlag;
81   int8_t*  pInterPredictionDoneFlag;
82   bool*    pMbCorrectlyDecodedFlag;
83   bool*    pMbRefConcealedFlag;
84   int16_t (*pScaledTCoeff)[MB_COEFF_LIST_SIZE];
85   int8_t (*pIntraPredMode)[8];  //0~3 top4x4 ; 4~6 left 4x4; 7 intra16x16
86   int8_t (*pIntra4x4FinalMode)[MB_BLOCK4x4_NUM];
87   uint8_t  *pIntraNxNAvailFlag;
88   int8_t*  pChromaPredMode;
89   //uint8_t (*motion_pred_flag[LIST_A])[MB_PARTITION_SIZE]; // 8x8
90   uint32_t (*pSubMbType)[MB_SUB_PARTITION_SIZE];
91   int32_t iLumaStride;
92   int32_t iChromaStride;
93   uint8_t* pPred[3];
94   int32_t iMbX;
95   int32_t iMbY;
96   int32_t iMbXyIndex;
97   int32_t iMbWidth;               // MB width of this picture, equal to sSps.iMbWidth
98   int32_t iMbHeight;              // MB height of this picture, equal to sSps.iMbHeight;
99 
100   /* Common syntax elements across all slices of a DQLayer */
101   int32_t                   iSliceIdcBackup;
102   uint32_t                  uiSpsId;
103   uint32_t                  uiPpsId;
104   uint32_t                  uiDisableInterLayerDeblockingFilterIdc;
105   int32_t                   iInterLayerSliceAlphaC0Offset;
106   int32_t                   iInterLayerSliceBetaOffset;
107   //SPosOffset              sScaledRefLayer;
108   int32_t                   iSliceGroupChangeCycle;
109 
110   PRefPicListReorderSyn     pRefPicListReordering;
111   PPredWeightTabSyn         pPredWeightTable;
112   PRefPicMarking            pRefPicMarking; // Decoded reference picture marking syntaxs
113   PRefBasePicMarking        pRefPicBaseMarking;
114 
115   PPicture                  pRef;                   // reference picture pointer
116   PPicture                  pDec;                   // reconstruction picture pointer for layer
117 
118 	int16_t										iColocMv[2][16][2];     //Colocated MV cache
119 	int8_t										iColocRefIndex[2][16];  //Colocated RefIndex cache
120 	int8_t										iColocIntra[16];			  //Colocated Intra cache
121 
122   bool                      bUseWeightPredictionFlag;
123 	bool                      bUseWeightedBiPredIdc;
124 	bool                      bStoreRefBasePicFlag;                           // iCurTid == 0 && iCurQid = 0 && bEncodeKeyPic = 1
125   bool                      bTCoeffLevelPredFlag;
126   bool                      bConstrainedIntraResamplingFlag;
127   uint8_t                   uiRefLayerDqId;
128   uint8_t                   uiRefLayerChromaPhaseXPlus1Flag;
129   uint8_t                   uiRefLayerChromaPhaseYPlus1;
130   uint8_t                   uiLayerDqId;                    // dq_id of current layer
131   bool                      bUseRefBasePicFlag;     // whether reference pic or reference base pic is referred?
132 };
133 
134 typedef struct TagGpuAvcLayer {
135   SLayerInfo                sLayerInfo;
136   PBitStringAux             pBitStringAux;  // pointer to SBitStringAux
137 
138 	uint32_t*                  pMbType;
139   int32_t*                  pSliceIdc;      // using int32_t for slice_idc
140   int8_t*                   pLumaQp;
141   int8_t*                   pCbp;
142   int8_t                    (*pNzc)[24];
143   int8_t                    (*pIntraPredMode)[8];     //0~3 top4x4 ; 4~6 left 4x4; 7 intra16x16
144   int32_t                   iMbX;
145   int32_t                   iMbY;
146   int32_t                   iMbXyIndex;
147   int32_t                   iMbWidth;               // MB width of this picture, equal to sSps.iMbWidth
148   int32_t                   iMbHeight;              // MB height of this picture, equal to sSps.iMbHeight;
149 
150 } SGpuAvcDqLayer, *PGpuAvcDqLayer;
151 
152 ///////////////////////////////////////////////////////////////////////
153 
154 } // namespace WelsDec
155 
156 #endif//WELS_DEC_FRAME_H__
157