1 | /* The copyright in this software is being made available under the BSD |
---|
2 | * License, included below. This software may be subject to other third party |
---|
3 | * and contributor rights, including patent rights, and no such rights are |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2014, ITU/ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | /** \file TComPicSym.h |
---|
35 | \brief picture symbol class (header) |
---|
36 | */ |
---|
37 | |
---|
38 | #ifndef __TCOMPICSYM__ |
---|
39 | #define __TCOMPICSYM__ |
---|
40 | |
---|
41 | |
---|
42 | // Include files |
---|
43 | #include "CommonDef.h" |
---|
44 | #include "TComSlice.h" |
---|
45 | #include "TComDataCU.h" |
---|
46 | class TComSampleAdaptiveOffset; |
---|
47 | class TComPPS; |
---|
48 | |
---|
49 | //! \ingroup TLibCommon |
---|
50 | //! \{ |
---|
51 | |
---|
52 | // ==================================================================================================================== |
---|
53 | // Class definition |
---|
54 | // ==================================================================================================================== |
---|
55 | |
---|
56 | class TComTile |
---|
57 | { |
---|
58 | private: |
---|
59 | UInt m_tileWidthInCtus; |
---|
60 | UInt m_tileHeightInCtus; |
---|
61 | UInt m_rightEdgePosInCtus; |
---|
62 | UInt m_bottomEdgePosInCtus; |
---|
63 | UInt m_firstCtuRsAddr; |
---|
64 | |
---|
65 | public: |
---|
66 | TComTile(); |
---|
67 | virtual ~TComTile(); |
---|
68 | |
---|
69 | Void setTileWidthInCtus ( UInt i ) { m_tileWidthInCtus = i; } |
---|
70 | UInt getTileWidthInCtus () const { return m_tileWidthInCtus; } |
---|
71 | Void setTileHeightInCtus ( UInt i ) { m_tileHeightInCtus = i; } |
---|
72 | UInt getTileHeightInCtus () const { return m_tileHeightInCtus; } |
---|
73 | Void setRightEdgePosInCtus ( UInt i ) { m_rightEdgePosInCtus = i; } |
---|
74 | UInt getRightEdgePosInCtus () const { return m_rightEdgePosInCtus; } |
---|
75 | Void setBottomEdgePosInCtus ( UInt i ) { m_bottomEdgePosInCtus = i; } |
---|
76 | UInt getBottomEdgePosInCtus () const { return m_bottomEdgePosInCtus; } |
---|
77 | Void setFirstCtuRsAddr ( UInt i ) { m_firstCtuRsAddr = i; } |
---|
78 | UInt getFirstCtuRsAddr () const { return m_firstCtuRsAddr; } |
---|
79 | }; |
---|
80 | |
---|
81 | /// picture symbol class |
---|
82 | class TComPicSym |
---|
83 | { |
---|
84 | private: |
---|
85 | UInt m_frameWidthInCtus; |
---|
86 | UInt m_frameHeightInCtus; |
---|
87 | |
---|
88 | UInt m_uiMaxCUWidth; |
---|
89 | UInt m_uiMaxCUHeight; |
---|
90 | UInt m_uiMinCUWidth; |
---|
91 | UInt m_uiMinCUHeight; |
---|
92 | |
---|
93 | UChar m_uhTotalDepth; ///< max. depth |
---|
94 | UInt m_numPartitionsInCtu; |
---|
95 | UInt m_numPartInCtuWidth; |
---|
96 | UInt m_numPartInCtuHeight; |
---|
97 | UInt m_numCtusInFrame; |
---|
98 | |
---|
99 | TComSlice** m_apcTComSlice; |
---|
100 | UInt m_uiNumAllocatedSlice; |
---|
101 | TComDataCU** m_pictureCtuArray; ///< array of CU data. |
---|
102 | |
---|
103 | Int m_numTileColumnsMinus1; |
---|
104 | Int m_numTileRowsMinus1; |
---|
105 | std::vector<TComTile> m_tileParameters; |
---|
106 | UInt* m_ctuTsToRsAddrMap; ///< for a given TS (Tile-Scan; coding order) address, returns the RS (Raster-Scan) address. cf CtbAddrTsToRs in specification. |
---|
107 | UInt* m_puiTileIdxMap; ///< the map of the tile index relative to CTU raster scan address |
---|
108 | UInt* m_ctuRsToTsAddrMap; ///< for a given RS (Raster-Scan) address, returns the TS (Tile-Scan; coding order) address. cf CtbAddrRsToTs in specification. |
---|
109 | |
---|
110 | SAOBlkParam *m_saoBlkParams; |
---|
111 | |
---|
112 | #if SVC_EXTENSION |
---|
113 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
114 | Int* m_piTileSetIdxMap; //the map of the tile set index relative to LCU raster scan address |
---|
115 | UChar* m_pucTileSetType; |
---|
116 | Bool* m_pbSkippedTileSetFlag; |
---|
117 | #endif |
---|
118 | #endif |
---|
119 | |
---|
120 | public: |
---|
121 | Void create ( ChromaFormat chromaFormatIDC, Int iPicWidth, Int iPicHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth ); |
---|
122 | Void destroy (); |
---|
123 | |
---|
124 | TComPicSym (); |
---|
125 | TComSlice* getSlice(UInt i) { return m_apcTComSlice[i]; } |
---|
126 | const TComSlice* getSlice(UInt i) const { return m_apcTComSlice[i]; } |
---|
127 | UInt getFrameWidthInCtus() const { return m_frameWidthInCtus; } |
---|
128 | UInt getFrameHeightInCtus() const { return m_frameHeightInCtus; } |
---|
129 | UInt getMinCUWidth() const { return m_uiMinCUWidth; } |
---|
130 | UInt getMinCUHeight() const { return m_uiMinCUHeight; } |
---|
131 | UInt getNumberOfCtusInFrame() const { return m_numCtusInFrame; } |
---|
132 | TComDataCU* getCtu( UInt ctuRsAddr ) { return m_pictureCtuArray[ctuRsAddr]; } |
---|
133 | const TComDataCU* getCtu( UInt ctuRsAddr ) const { return m_pictureCtuArray[ctuRsAddr]; } |
---|
134 | |
---|
135 | Void setSlice(TComSlice* p, UInt i) { m_apcTComSlice[i] = p; } |
---|
136 | UInt getNumAllocatedSlice() const { return m_uiNumAllocatedSlice; } |
---|
137 | Void allocateNewSlice(); |
---|
138 | Void clearSliceBuffer(); |
---|
139 | UInt getNumPartitionsInCtu() const { return m_numPartitionsInCtu; } |
---|
140 | UInt getNumPartInCtuWidth() const { return m_numPartInCtuWidth; } |
---|
141 | UInt getNumPartInCtuHeight() const { return m_numPartInCtuHeight; } |
---|
142 | Void setNumTileColumnsMinus1( Int i ) { m_numTileColumnsMinus1 = i; } |
---|
143 | Int getNumTileColumnsMinus1() const { return m_numTileColumnsMinus1; } |
---|
144 | Void setNumTileRowsMinus1( Int i ) { m_numTileRowsMinus1 = i; } |
---|
145 | Int getNumTileRowsMinus1() const { return m_numTileRowsMinus1; } |
---|
146 | Int getNumTiles() const { return (m_numTileRowsMinus1+1)*(m_numTileColumnsMinus1+1); } |
---|
147 | TComTile* getTComTile ( UInt tileIdx ) { return &(m_tileParameters[tileIdx]); } |
---|
148 | const TComTile* getTComTile ( UInt tileIdx ) const { return &(m_tileParameters[tileIdx]); } |
---|
149 | Void setCtuTsToRsAddrMap( Int ctuTsAddr, Int ctuRsAddr ) { *(m_ctuTsToRsAddrMap + ctuTsAddr) = ctuRsAddr; } |
---|
150 | UInt getCtuTsToRsAddrMap( Int ctuTsAddr ) const { return *(m_ctuTsToRsAddrMap + (ctuTsAddr>=m_numCtusInFrame ? m_numCtusInFrame : ctuTsAddr)); } |
---|
151 | UInt getTileIdxMap( Int ctuRsAddr ) const { return *(m_puiTileIdxMap + ctuRsAddr); } |
---|
152 | Void setCtuRsToTsAddrMap( Int ctuRsAddr, Int ctuTsOrder ) { *(m_ctuRsToTsAddrMap + ctuRsAddr) = ctuTsOrder; } |
---|
153 | UInt getCtuRsToTsAddrMap( Int ctuRsAddr ) const { return *(m_ctuRsToTsAddrMap + (ctuRsAddr>=m_numCtusInFrame ? m_numCtusInFrame : ctuRsAddr)); } |
---|
154 | Void initTiles(TComPPS *pps); |
---|
155 | |
---|
156 | Void initCtuTsRsAddrMaps(); |
---|
157 | SAOBlkParam* getSAOBlkParam() { return m_saoBlkParams;} |
---|
158 | const SAOBlkParam* getSAOBlkParam() const { return m_saoBlkParams;} |
---|
159 | Void deriveLoopFilterBoundaryAvailibility(Int ctuRsAddr, |
---|
160 | Bool& isLeftAvail, Bool& isRightAvail, Bool& isAboveAvail, Bool& isBelowAvail, |
---|
161 | Bool& isAboveLeftAvail, Bool& isAboveRightAvail, Bool& isBelowLeftAvail, Bool& isBelowRightAvail); |
---|
162 | protected: |
---|
163 | UInt xCalculateNextCtuRSAddr( UInt uiCurrCtuRSAddr ); |
---|
164 | |
---|
165 | #if SVC_EXTENSION |
---|
166 | public: |
---|
167 | #if LAYER_CTB |
---|
168 | UInt getMaxCUWidth() { return m_uiMaxCUWidth; } |
---|
169 | UInt getMaxCUHeight() { return m_uiMaxCUHeight; } |
---|
170 | #endif |
---|
171 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
172 | Void setTileSetIdxMap( Int i, Int tileSetIdx, UChar setType, Bool skipFlag ) |
---|
173 | { |
---|
174 | m_piTileSetIdxMap[i] = tileSetIdx; |
---|
175 | m_pucTileSetType[i] = setType; |
---|
176 | m_pbSkippedTileSetFlag[i] = skipFlag; |
---|
177 | } |
---|
178 | Int getTileSetIdxMap( Int i ) { return *(m_piTileSetIdxMap + i); } |
---|
179 | UChar getTileSetType( Int i ) { return *(m_pucTileSetType + i); } |
---|
180 | Bool getSkippedTileSetFlag( Int i ) { return *(m_pbSkippedTileSetFlag + i); } |
---|
181 | #endif |
---|
182 | #endif //SVC_EXTENSION |
---|
183 | |
---|
184 | };// END CLASS DEFINITION TComPicSym |
---|
185 | |
---|
186 | //! \} |
---|
187 | |
---|
188 | #endif // __TCOMPICSYM__ |
---|
189 | |
---|