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-2011, 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 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 | |
---|
35 | |
---|
36 | /** \file TComSlice.h |
---|
37 | \brief slice header and SPS class (header) |
---|
38 | */ |
---|
39 | |
---|
40 | #ifndef __TCOMSLICE__ |
---|
41 | #define __TCOMSLICE__ |
---|
42 | |
---|
43 | |
---|
44 | #include "CommonDef.h" |
---|
45 | #ifdef WEIGHT_PRED |
---|
46 | #include <string.h> // To avoid compilation failure with some g++ linux compilators... |
---|
47 | #endif |
---|
48 | #include "TComList.h" |
---|
49 | #include <math.h> |
---|
50 | |
---|
51 | class TComPic; |
---|
52 | #if DEPTH_MAP_GENERATION |
---|
53 | class TComDepthMapGenerator; |
---|
54 | #endif |
---|
55 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
56 | class TComResidualGenerator; |
---|
57 | #endif |
---|
58 | |
---|
59 | // ==================================================================================================================== |
---|
60 | // Class definition |
---|
61 | // ==================================================================================================================== |
---|
62 | |
---|
63 | /// SPS class |
---|
64 | class TComSPS |
---|
65 | { |
---|
66 | private: |
---|
67 | // Structure |
---|
68 | UInt m_uiSPSId; |
---|
69 | UInt m_uiWidth; |
---|
70 | UInt m_uiHeight; |
---|
71 | Int m_aiPad[2]; |
---|
72 | UInt m_uiMaxCUWidth; |
---|
73 | UInt m_uiMaxCUHeight; |
---|
74 | UInt m_uiMaxCUDepth; |
---|
75 | UInt m_uiMinTrDepth; |
---|
76 | UInt m_uiMaxTrDepth; |
---|
77 | |
---|
78 | UInt m_uiViewId; |
---|
79 | Int m_iViewOrderIdx; |
---|
80 | Bool m_bDepth; |
---|
81 | UInt m_uiCamParPrecision; |
---|
82 | Bool m_bCamParInSliceHeader; |
---|
83 | Int m_aaiCodedScale [2][MAX_NUMBER_VIEWS]; |
---|
84 | Int m_aaiCodedOffset[2][MAX_NUMBER_VIEWS]; |
---|
85 | |
---|
86 | // Tool list |
---|
87 | UInt m_uiQuadtreeTULog2MaxSize; |
---|
88 | UInt m_uiQuadtreeTULog2MinSize; |
---|
89 | UInt m_uiQuadtreeTUMaxDepthInter; |
---|
90 | UInt m_uiQuadtreeTUMaxDepthIntra; |
---|
91 | Bool m_bUseALF; |
---|
92 | Bool m_bUseDQP; |
---|
93 | #if !HHI_NO_LowDelayCoding |
---|
94 | Bool m_bUseLDC; |
---|
95 | #endif |
---|
96 | Bool m_bUsePAD; |
---|
97 | Bool m_bUseMRG; // SOPH: |
---|
98 | |
---|
99 | #if LM_CHROMA |
---|
100 | Bool m_bUseLMChroma; // JL: |
---|
101 | #endif |
---|
102 | |
---|
103 | #if DCM_COMB_LIST |
---|
104 | Bool m_bUseLComb; |
---|
105 | Bool m_bLCMod; |
---|
106 | #endif |
---|
107 | |
---|
108 | #if HHI_RMP_SWITCH |
---|
109 | Bool m_bUseRMP; |
---|
110 | #endif |
---|
111 | // Parameter |
---|
112 | AMVP_MODE m_aeAMVPMode[MAX_CU_DEPTH]; |
---|
113 | UInt m_uiBitDepth; |
---|
114 | UInt m_uiBitIncrement; |
---|
115 | |
---|
116 | // Max physical transform size |
---|
117 | UInt m_uiMaxTrSize; |
---|
118 | |
---|
119 | Int m_iAMPAcc[MAX_CU_DEPTH]; |
---|
120 | |
---|
121 | #if MTK_NONCROSS_INLOOP_FILTER |
---|
122 | Bool m_bLFCrossSliceBoundaryFlag; |
---|
123 | #endif |
---|
124 | #if MTK_SAO |
---|
125 | Bool m_bUseSAO; |
---|
126 | #endif |
---|
127 | #if HHI_MPI |
---|
128 | Bool m_bUseMVI; |
---|
129 | #endif |
---|
130 | |
---|
131 | UInt m_uiCodedPictureBufferSize ; |
---|
132 | |
---|
133 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
134 | Bool m_bUseDMM; |
---|
135 | #endif |
---|
136 | |
---|
137 | #if DEPTH_MAP_GENERATION |
---|
138 | UInt m_uiPredDepthMapGeneration; |
---|
139 | UInt m_uiPdmPrecision; |
---|
140 | Int m_aiPdmScaleNomDelta[MAX_NUMBER_VIEWS]; |
---|
141 | Int m_aiPdmOffset [MAX_NUMBER_VIEWS]; |
---|
142 | #endif |
---|
143 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
144 | UInt m_uiMultiviewMvPredMode; |
---|
145 | #endif |
---|
146 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
147 | UInt m_uiMultiviewResPredMode; |
---|
148 | #endif |
---|
149 | |
---|
150 | #if DEPTH_MAP_GENERATION |
---|
151 | TComDepthMapGenerator* m_pcDepthMapGenerator; |
---|
152 | #endif |
---|
153 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
154 | TComResidualGenerator* m_pcResidualGenerator; |
---|
155 | #endif |
---|
156 | |
---|
157 | public: |
---|
158 | TComSPS(); |
---|
159 | virtual ~TComSPS(); |
---|
160 | |
---|
161 | // structure |
---|
162 | Void setSPSId ( UInt u ) { m_uiSPSId = u; } |
---|
163 | UInt getSPSId () { return m_uiSPSId; } |
---|
164 | Void setWidth ( UInt u ) { m_uiWidth = u; } |
---|
165 | UInt getWidth () { return m_uiWidth; } |
---|
166 | Void setHeight ( UInt u ) { m_uiHeight = u; } |
---|
167 | UInt getHeight () { return m_uiHeight; } |
---|
168 | Void setMaxCUWidth ( UInt u ) { m_uiMaxCUWidth = u; } |
---|
169 | UInt getMaxCUWidth () { return m_uiMaxCUWidth; } |
---|
170 | Void setMaxCUHeight ( UInt u ) { m_uiMaxCUHeight = u; } |
---|
171 | UInt getMaxCUHeight () { return m_uiMaxCUHeight; } |
---|
172 | Void setMaxCUDepth ( UInt u ) { m_uiMaxCUDepth = u; } |
---|
173 | UInt getMaxCUDepth () { return m_uiMaxCUDepth; } |
---|
174 | Void setMinTrDepth ( UInt u ) { m_uiMinTrDepth = u; } |
---|
175 | UInt getMinTrDepth () { return m_uiMinTrDepth; } |
---|
176 | Void setMaxTrDepth ( UInt u ) { m_uiMaxTrDepth = u; } |
---|
177 | UInt getMaxTrDepth () { return m_uiMaxTrDepth; } |
---|
178 | Void setQuadtreeTULog2MaxSize( UInt u ) { m_uiQuadtreeTULog2MaxSize = u; } |
---|
179 | UInt getQuadtreeTULog2MaxSize() { return m_uiQuadtreeTULog2MaxSize; } |
---|
180 | Void setQuadtreeTULog2MinSize( UInt u ) { m_uiQuadtreeTULog2MinSize = u; } |
---|
181 | UInt getQuadtreeTULog2MinSize() { return m_uiQuadtreeTULog2MinSize; } |
---|
182 | Void setQuadtreeTUMaxDepthInter( UInt u ) { m_uiQuadtreeTUMaxDepthInter = u; } |
---|
183 | Void setQuadtreeTUMaxDepthIntra( UInt u ) { m_uiQuadtreeTUMaxDepthIntra = u; } |
---|
184 | UInt getQuadtreeTUMaxDepthInter() { return m_uiQuadtreeTUMaxDepthInter; } |
---|
185 | UInt getQuadtreeTUMaxDepthIntra() { return m_uiQuadtreeTUMaxDepthIntra; } |
---|
186 | Void setPad (Int iPad[2]) { m_aiPad[0] = iPad[0]; m_aiPad[1] = iPad[1]; } |
---|
187 | Void setPadX ( Int u ) { m_aiPad[0] = u; } |
---|
188 | Void setPadY ( Int u ) { m_aiPad[1] = u; } |
---|
189 | Int getPad ( Int u ) { assert(u < 2); return m_aiPad[u];} |
---|
190 | Int* getPad ( ) { return m_aiPad; } |
---|
191 | |
---|
192 | Void initMultiviewSPS ( UInt uiViewId, Int iViewOrderIdx = 0, UInt uiCamParPrecision = 0, Bool bCamParSlice = false, Int** aaiScale = 0, Int** aaiOffset = 0 ); |
---|
193 | Void initMultiviewSPSDepth ( UInt uiViewId, Int iViewOrderIdx ); |
---|
194 | |
---|
195 | UInt getViewId () { return m_uiViewId; } |
---|
196 | Int getViewOrderIdx () { return m_iViewOrderIdx; } |
---|
197 | Bool isDepth () { return m_bDepth; } |
---|
198 | UInt getCamParPrecision () { return m_uiCamParPrecision; } |
---|
199 | Bool hasCamParInSliceHeader() { return m_bCamParInSliceHeader; } |
---|
200 | Int* getCodedScale () { return m_aaiCodedScale [0]; } |
---|
201 | Int* getCodedOffset () { return m_aaiCodedOffset[0]; } |
---|
202 | Int* getInvCodedScale () { return m_aaiCodedScale [1]; } |
---|
203 | Int* getInvCodedOffset () { return m_aaiCodedOffset[1]; } |
---|
204 | |
---|
205 | // physical transform |
---|
206 | Void setMaxTrSize ( UInt u ) { m_uiMaxTrSize = u; } |
---|
207 | UInt getMaxTrSize () { return m_uiMaxTrSize; } |
---|
208 | |
---|
209 | // Tool list |
---|
210 | Bool getUseALF () { return m_bUseALF; } |
---|
211 | Bool getUseDQP () { return m_bUseDQP; } |
---|
212 | |
---|
213 | #if !HHI_NO_LowDelayCoding |
---|
214 | Bool getUseLDC () { return m_bUseLDC; } |
---|
215 | #endif |
---|
216 | Bool getUsePAD () { return m_bUsePAD; } |
---|
217 | Bool getUseMRG () { return m_bUseMRG; } // SOPH: |
---|
218 | |
---|
219 | Void setUseALF ( Bool b ) { m_bUseALF = b; } |
---|
220 | Void setUseDQP ( Bool b ) { m_bUseDQP = b; } |
---|
221 | |
---|
222 | #if !HHI_NO_LowDelayCoding |
---|
223 | Void setUseLDC ( Bool b ) { m_bUseLDC = b; } |
---|
224 | #endif |
---|
225 | Void setUsePAD ( Bool b ) { m_bUsePAD = b; } |
---|
226 | Void setUseMRG ( Bool b ) { m_bUseMRG = b; } // SOPH: |
---|
227 | |
---|
228 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
229 | Bool getUseDMM() { return m_bUseDMM; } |
---|
230 | Void setUseDMM( Bool b ) { m_bUseDMM = b; } |
---|
231 | #endif |
---|
232 | |
---|
233 | |
---|
234 | #if DCM_COMB_LIST |
---|
235 | Void setUseLComb (Bool b) { m_bUseLComb = b; } |
---|
236 | Bool getUseLComb () { return m_bUseLComb; } |
---|
237 | Void setLCMod (Bool b) { m_bLCMod = b; } |
---|
238 | Bool getLCMod () { return m_bLCMod; } |
---|
239 | #endif |
---|
240 | |
---|
241 | #if HHI_RMP_SWITCH |
---|
242 | Bool getUseRMP () { return m_bUseRMP; } |
---|
243 | Void setUseRMP ( Bool b ) { m_bUseRMP = b; } |
---|
244 | #endif |
---|
245 | |
---|
246 | #if LM_CHROMA |
---|
247 | Bool getUseLMChroma () { return m_bUseLMChroma; } |
---|
248 | Void setUseLMChroma ( Bool b ) { m_bUseLMChroma = b; } |
---|
249 | #endif |
---|
250 | |
---|
251 | // AMVP mode (for each depth) |
---|
252 | AMVP_MODE getAMVPMode ( UInt uiDepth ) { assert(uiDepth < g_uiMaxCUDepth); return m_aeAMVPMode[uiDepth]; } |
---|
253 | Void setAMVPMode ( UInt uiDepth, AMVP_MODE eMode) { assert(uiDepth < g_uiMaxCUDepth); m_aeAMVPMode[uiDepth] = eMode; } |
---|
254 | |
---|
255 | // Bit-depth |
---|
256 | UInt getBitDepth () { return m_uiBitDepth; } |
---|
257 | Void setBitDepth ( UInt u ) { m_uiBitDepth = u; } |
---|
258 | UInt getBitIncrement () { return m_uiBitIncrement; } |
---|
259 | Void setBitIncrement ( UInt u ) { m_uiBitIncrement = u; } |
---|
260 | |
---|
261 | #if MTK_NONCROSS_INLOOP_FILTER |
---|
262 | Void setLFCrossSliceBoundaryFlag ( Bool bValue ) { m_bLFCrossSliceBoundaryFlag = bValue; } |
---|
263 | Bool getLFCrossSliceBoundaryFlag () { return m_bLFCrossSliceBoundaryFlag; } |
---|
264 | #endif |
---|
265 | |
---|
266 | #if MTK_SAO |
---|
267 | Void setUseSAO (Bool bVal) {m_bUseSAO = bVal;} |
---|
268 | Bool getUseSAO () {return m_bUseSAO;} |
---|
269 | #endif |
---|
270 | |
---|
271 | #if HHI_MPI |
---|
272 | Void setUseMVI (Bool bVal) {m_bUseMVI = bVal;} |
---|
273 | Bool getUseMVI () {return m_bUseMVI;} |
---|
274 | #endif |
---|
275 | |
---|
276 | Void setCodedPictureBufferSize( UInt u ) { m_uiCodedPictureBufferSize = u ;} |
---|
277 | UInt getCodedPictureBufferSize( ) { return m_uiCodedPictureBufferSize ;} |
---|
278 | |
---|
279 | #if DEPTH_MAP_GENERATION |
---|
280 | Void setPredDepthMapGeneration( UInt uiViewId, Bool bIsDepth, UInt uiPdmGenMode = 0, UInt uiPdmMvPredMode = 0, UInt uiPdmPrec = 0, Int** aaiPdmScaleNomDelta = 0, Int** aaiPdmOffset = 0 ); |
---|
281 | #endif |
---|
282 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
283 | Void setMultiviewResPredMode ( UInt uiResPrdMode ) { m_uiMultiviewResPredMode = uiResPrdMode; } |
---|
284 | #endif |
---|
285 | |
---|
286 | #if DEPTH_MAP_GENERATION |
---|
287 | UInt getPredDepthMapGeneration() { return m_uiPredDepthMapGeneration; } |
---|
288 | UInt getPdmPrecision () { return m_uiPdmPrecision; } |
---|
289 | Int* getPdmScaleNomDelta () { return m_aiPdmScaleNomDelta; } |
---|
290 | Int* getPdmOffset () { return m_aiPdmOffset; } |
---|
291 | #endif |
---|
292 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
293 | UInt getMultiviewMvPredMode () { return m_uiMultiviewMvPredMode; } |
---|
294 | #endif |
---|
295 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
296 | UInt getMultiviewResPredMode () { return m_uiMultiviewResPredMode; } |
---|
297 | #endif |
---|
298 | |
---|
299 | #if DEPTH_MAP_GENERATION |
---|
300 | Void setDepthMapGenerator( TComDepthMapGenerator* pcDepthMapGenerator ) { m_pcDepthMapGenerator = pcDepthMapGenerator; } |
---|
301 | TComDepthMapGenerator* getDepthMapGenerator() { return m_pcDepthMapGenerator; } |
---|
302 | #endif |
---|
303 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
304 | Void setResidualGenerator( TComResidualGenerator* pcResidualGenerator ) { m_pcResidualGenerator = pcResidualGenerator; } |
---|
305 | TComResidualGenerator* getResidualGenerator() { return m_pcResidualGenerator; } |
---|
306 | #endif |
---|
307 | }; |
---|
308 | |
---|
309 | /// PPS class |
---|
310 | class TComPPS |
---|
311 | { |
---|
312 | private: |
---|
313 | #if CONSTRAINED_INTRA_PRED |
---|
314 | Bool m_bConstrainedIntraPred; // constrained_intra_pred_flag |
---|
315 | #endif |
---|
316 | #ifdef WEIGHT_PRED |
---|
317 | Bool m_bUseWeightPred; // Use of Weighting Prediction (P_SLICE) |
---|
318 | UInt m_uiBiPredIdc; // Use of Weighting Bi-Prediction (B_SLICE) |
---|
319 | #endif |
---|
320 | UInt m_uiPPSId; |
---|
321 | UInt m_uiSPSId; |
---|
322 | |
---|
323 | public: |
---|
324 | TComPPS(); |
---|
325 | virtual ~TComPPS(); |
---|
326 | |
---|
327 | Void setPPSId ( UInt u ) { m_uiPPSId = u; } |
---|
328 | UInt getPPSId () { return m_uiPPSId; } |
---|
329 | Void setSPSId ( UInt u ) { m_uiSPSId = u; } |
---|
330 | UInt getSPSId () { return m_uiSPSId; } |
---|
331 | #if CONSTRAINED_INTRA_PRED |
---|
332 | Bool getConstrainedIntraPred () { return m_bConstrainedIntraPred; } |
---|
333 | Void setConstrainedIntraPred ( Bool b ) { m_bConstrainedIntraPred = b; } |
---|
334 | #endif |
---|
335 | |
---|
336 | #ifdef WEIGHT_PRED |
---|
337 | Bool getUseWP () { return m_bUseWeightPred; } |
---|
338 | UInt getWPBiPredIdc () { return m_uiBiPredIdc; } |
---|
339 | |
---|
340 | Void setUseWP ( Bool b ) { m_bUseWeightPred = b; } |
---|
341 | Void setWPBiPredIdc ( UInt u ) { m_uiBiPredIdc = u; } |
---|
342 | #endif |
---|
343 | }; |
---|
344 | |
---|
345 | #ifdef WEIGHT_PRED |
---|
346 | typedef struct { |
---|
347 | // Explicit weighted prediction parameters parsed in slice header, |
---|
348 | // or Implicit weighted prediction parameters (8 bits depth values). |
---|
349 | Bool bPresentFlag; |
---|
350 | UInt uiLog2WeightDenom; |
---|
351 | Int iWeight; |
---|
352 | Int iOffset; |
---|
353 | |
---|
354 | // Weighted prediction scaling values built from above parameters (bitdepth scaled): |
---|
355 | Int w, o, offset, shift, round; |
---|
356 | } wpScalingParam; |
---|
357 | |
---|
358 | typedef struct { |
---|
359 | Int64 iAC; |
---|
360 | Int64 iDC; |
---|
361 | } wpACDCParam; |
---|
362 | #endif |
---|
363 | |
---|
364 | /// slice header class |
---|
365 | class TComSlice |
---|
366 | { |
---|
367 | |
---|
368 | private: |
---|
369 | // Bitstream writing |
---|
370 | UInt m_uiPPSId; |
---|
371 | Int m_iPOC; |
---|
372 | #if SONY_COLPIC_AVAILABILITY |
---|
373 | Int m_iViewOrderIdx; |
---|
374 | #endif |
---|
375 | #if DCM_DECODING_REFRESH |
---|
376 | NalUnitType m_eNalUnitType; ///< Nal unit type for the slice |
---|
377 | #endif |
---|
378 | SliceType m_eSliceType; |
---|
379 | Int m_iSliceQp; |
---|
380 | Int m_iSymbolMode; |
---|
381 | Bool m_bLoopFilterDisable; |
---|
382 | |
---|
383 | #if DCM_COMB_LIST |
---|
384 | Int m_aiNumRefIdx [3]; // for multiple reference of current slice |
---|
385 | |
---|
386 | Int m_iRefIdxOfLC[2][MAX_NUM_REF_LC]; |
---|
387 | Int m_eListIdFromIdxOfLC[MAX_NUM_REF_LC]; |
---|
388 | Int m_iRefIdxFromIdxOfLC[MAX_NUM_REF_LC]; |
---|
389 | Int m_iRefIdxOfL1FromRefIdxOfL0[MAX_NUM_REF_LC]; |
---|
390 | Int m_iRefIdxOfL0FromRefIdxOfL1[MAX_NUM_REF_LC]; |
---|
391 | Bool m_bRefPicListModificationFlagLC; |
---|
392 | Bool m_bRefPicListCombinationFlag; |
---|
393 | #else |
---|
394 | Int m_aiNumRefIdx [2]; // for multiple reference of current slice |
---|
395 | #endif |
---|
396 | |
---|
397 | // Data |
---|
398 | Int m_iSliceQpDelta; |
---|
399 | TComPic* m_apcRefPicList [2][MAX_NUM_REF]; |
---|
400 | Int m_aiRefPOCList [2][MAX_NUM_REF]; |
---|
401 | Int m_iDepth; |
---|
402 | TComPic* m_pcTexturePic; |
---|
403 | |
---|
404 | // referenced slice? |
---|
405 | Bool m_bRefenced; |
---|
406 | #ifdef ROUNDING_CONTROL_BIPRED |
---|
407 | Bool m_bRounding; |
---|
408 | #endif |
---|
409 | |
---|
410 | // access channel |
---|
411 | TComSPS* m_pcSPS; |
---|
412 | TComPPS* m_pcPPS; |
---|
413 | TComPic* m_pcPic; |
---|
414 | |
---|
415 | UInt m_uiColDir; // direction to get colocated CUs |
---|
416 | |
---|
417 | Double m_dLambda; |
---|
418 | |
---|
419 | Bool m_abEqualRef [2][MAX_NUM_REF][MAX_NUM_REF]; |
---|
420 | |
---|
421 | Int m_iViewIdx; |
---|
422 | Int m_aiRefViewList[2][MAX_INPUT_VIEW_NUM]; |
---|
423 | |
---|
424 | Bool m_bNoBackPredFlag; |
---|
425 | #if MS_LCEC_LOOKUP_TABLE_EXCEPTION |
---|
426 | Bool m_bRefIdxCombineCoding; |
---|
427 | #endif |
---|
428 | |
---|
429 | Int m_aaiCodedScale [2][MAX_NUMBER_VIEWS]; |
---|
430 | Int m_aaiCodedOffset[2][MAX_NUMBER_VIEWS]; |
---|
431 | |
---|
432 | UInt m_uiSliceMode; |
---|
433 | UInt m_uiSliceArgument; |
---|
434 | UInt m_uiSliceCurStartCUAddr; |
---|
435 | UInt m_uiSliceCurEndCUAddr; |
---|
436 | UInt m_uiSliceIdx; |
---|
437 | UInt m_uiEntropySliceMode; |
---|
438 | UInt m_uiEntropySliceArgument; |
---|
439 | UInt m_uiEntropySliceCurStartCUAddr; |
---|
440 | UInt m_uiEntropySliceCurEndCUAddr; |
---|
441 | Bool m_bNextSlice; |
---|
442 | Bool m_bNextEntropySlice; |
---|
443 | UInt m_uiSliceBits; |
---|
444 | |
---|
445 | #ifdef WEIGHT_PRED |
---|
446 | wpScalingParam m_weightPredTable[2][MAX_NUM_REF][3]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V] |
---|
447 | wpACDCParam m_weightACDCParam[3]; // [0:Y, 1:U, 2:V] |
---|
448 | #endif |
---|
449 | |
---|
450 | public: |
---|
451 | TComSlice(); |
---|
452 | virtual ~TComSlice(); |
---|
453 | |
---|
454 | Void initSlice (); |
---|
455 | |
---|
456 | Void setSPS ( TComSPS* pcSPS ) { m_pcSPS = pcSPS; } |
---|
457 | TComSPS* getSPS () { return m_pcSPS; } |
---|
458 | |
---|
459 | Void setPPS ( TComPPS* pcPPS ) { m_pcPPS = pcPPS; } |
---|
460 | TComPPS* getPPS () { return m_pcPPS; } |
---|
461 | |
---|
462 | UInt getPPSId () { return m_uiPPSId; } |
---|
463 | SliceType getSliceType () { return m_eSliceType; } |
---|
464 | Int getPOC () { return m_iPOC; } |
---|
465 | #if SONY_COLPIC_AVAILABILITY |
---|
466 | Int getViewOrderIdx () { return m_iViewOrderIdx; } |
---|
467 | #endif |
---|
468 | Int getSliceQp () { return m_iSliceQp; } |
---|
469 | Int getSliceQpDelta () { return m_iSliceQpDelta; } |
---|
470 | Int getSymbolMode () { return m_iSymbolMode; } |
---|
471 | Bool getLoopFilterDisable() { return m_bLoopFilterDisable; } |
---|
472 | Int getNumRefIdx ( RefPicList e ) { return m_aiNumRefIdx[e]; } |
---|
473 | TComPic* getPic () { return m_pcPic; } |
---|
474 | TComPic* getRefPic ( RefPicList e, Int iRefIdx) { return m_apcRefPicList[e][iRefIdx]; } |
---|
475 | Int getRefPOC ( RefPicList e, Int iRefIdx) { return m_aiRefPOCList[e][iRefIdx]; } |
---|
476 | Int getDepth () { return m_iDepth; } |
---|
477 | UInt getColDir () { return m_uiColDir; } |
---|
478 | |
---|
479 | #if DCM_COMB_LIST |
---|
480 | Int getRefIdxOfLC (RefPicList e, Int iRefIdx) { return m_iRefIdxOfLC[e][iRefIdx]; } |
---|
481 | Int getListIdFromIdxOfLC(Int iRefIdx) { return m_eListIdFromIdxOfLC[iRefIdx]; } |
---|
482 | Int getRefIdxFromIdxOfLC(Int iRefIdx) { return m_iRefIdxFromIdxOfLC[iRefIdx]; } |
---|
483 | Int getRefIdxOfL0FromRefIdxOfL1(Int iRefIdx) { return m_iRefIdxOfL0FromRefIdxOfL1[iRefIdx];} |
---|
484 | Int getRefIdxOfL1FromRefIdxOfL0(Int iRefIdx) { return m_iRefIdxOfL1FromRefIdxOfL0[iRefIdx];} |
---|
485 | Bool getRefPicListModificationFlagLC() {return m_bRefPicListModificationFlagLC;} |
---|
486 | Void setRefPicListModificationFlagLC(Bool bflag) {m_bRefPicListModificationFlagLC=bflag;} |
---|
487 | Bool getRefPicListCombinationFlag() {return m_bRefPicListCombinationFlag;} |
---|
488 | Void setRefPicListCombinationFlag(Bool bflag) {m_bRefPicListCombinationFlag=bflag;} |
---|
489 | Void setListIdFromIdxOfLC(Int iRefIdx, UInt uiVal) { m_eListIdFromIdxOfLC[iRefIdx]=uiVal; } |
---|
490 | Void setRefIdxFromIdxOfLC(Int iRefIdx, UInt uiVal) { m_iRefIdxFromIdxOfLC[iRefIdx]=uiVal; } |
---|
491 | Void setRefIdxOfLC (RefPicList e, Int iRefIdx, Int RefIdxLC) { m_iRefIdxOfLC[e][iRefIdx]=RefIdxLC;} |
---|
492 | #endif |
---|
493 | |
---|
494 | Void setReferenced(Bool b) { m_bRefenced = b; } |
---|
495 | Bool isReferenced() { return m_bRefenced; } |
---|
496 | #ifdef ROUNDING_CONTROL_BIPRED |
---|
497 | Void setRounding(Bool bRound) { m_bRounding = bRound; } |
---|
498 | Bool isRounding() { return m_bRounding; } |
---|
499 | #endif |
---|
500 | |
---|
501 | Void setPPSId ( UInt u ) { m_uiPPSId = u; } |
---|
502 | Void setPOC ( Int i ) { m_iPOC = i; } |
---|
503 | #if SONY_COLPIC_AVAILABILITY |
---|
504 | Void setViewOrderIdx ( Int i ) { m_iViewOrderIdx = i; } |
---|
505 | #endif |
---|
506 | #if DCM_DECODING_REFRESH |
---|
507 | Void setNalUnitType ( NalUnitType e ) { m_eNalUnitType = e; } |
---|
508 | NalUnitType getNalUnitType () { return m_eNalUnitType; } |
---|
509 | Void decodingRefreshMarking(UInt& uiPOCCDR, Bool& bRefreshPending, TComList<TComPic*>& rcListPic); |
---|
510 | #endif |
---|
511 | Void setSliceType ( SliceType e ) { m_eSliceType = e; } |
---|
512 | Void setSliceQp ( Int i ) { m_iSliceQp = i; } |
---|
513 | Void setSliceQpDelta ( Int i ) { m_iSliceQpDelta = i; } |
---|
514 | Void setSymbolMode ( Int b ) { m_iSymbolMode = b; } |
---|
515 | Void setLoopFilterDisable( Bool b ) { m_bLoopFilterDisable= b; } |
---|
516 | |
---|
517 | Void setRefPic ( TComPic* p, RefPicList e, Int iRefIdx ) { m_apcRefPicList[e][iRefIdx] = p; } |
---|
518 | Void setRefPOC ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefPOCList[e][iRefIdx] = i; } |
---|
519 | Void setNumRefIdx ( RefPicList e, Int i ) { m_aiNumRefIdx[e] = i; } |
---|
520 | Void setPic ( TComPic* p ) { m_pcPic = p; } |
---|
521 | Void setDepth ( Int iDepth ) { m_iDepth = iDepth; } |
---|
522 | |
---|
523 | Void setRefPicList ( TComList<TComPic*>& rcListPic ); |
---|
524 | Void setRefPOCList (); |
---|
525 | Void setColDir ( UInt uiDir ) { m_uiColDir = uiDir; } |
---|
526 | |
---|
527 | Void setRefPicListFromGOPSTring( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& rapcSpatRefPics ); |
---|
528 | Void setRefPicListExplicitlyDecoderSided( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& rapcSpatRefPics ); |
---|
529 | |
---|
530 | Bool isIntra () { return m_eSliceType == I_SLICE; } |
---|
531 | Bool isInterB () { return m_eSliceType == B_SLICE; } |
---|
532 | Bool isInterP () { return m_eSliceType == P_SLICE; } |
---|
533 | |
---|
534 | Void setLambda( Double d ) { m_dLambda = d; } |
---|
535 | Double getLambda() { return m_dLambda; } |
---|
536 | |
---|
537 | Void setViewIdx(Int i) { m_iViewIdx = i; } |
---|
538 | Int getViewIdx() { return m_iViewIdx; } |
---|
539 | |
---|
540 | Void setRefViewIdx ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefViewList[e][iRefIdx] = i; } |
---|
541 | Int getRefViewIdx ( RefPicList e, Int iRefIdx) { return m_aiRefViewList[e][iRefIdx]; } |
---|
542 | |
---|
543 | Void initEqualRef(); |
---|
544 | Bool isEqualRef ( RefPicList e, Int iRefIdx1, Int iRefIdx2 ) |
---|
545 | { |
---|
546 | if (iRefIdx1 < 0 || iRefIdx2 < 0) return false; |
---|
547 | return m_abEqualRef[e][iRefIdx1][iRefIdx2]; |
---|
548 | } |
---|
549 | |
---|
550 | Void setEqualRef( RefPicList e, Int iRefIdx1, Int iRefIdx2, Bool b) |
---|
551 | { |
---|
552 | m_abEqualRef[e][iRefIdx1][iRefIdx2] = m_abEqualRef[e][iRefIdx2][iRefIdx1] = b; |
---|
553 | } |
---|
554 | |
---|
555 | static Void sortPicList ( TComList<TComPic*>& rcListPic ); |
---|
556 | |
---|
557 | Bool getNoBackPredFlag() { return m_bNoBackPredFlag; } |
---|
558 | Void setNoBackPredFlag( Bool b ) { m_bNoBackPredFlag = b; } |
---|
559 | #if MS_LCEC_LOOKUP_TABLE_EXCEPTION |
---|
560 | Bool getRefIdxCombineCoding() { return m_bRefIdxCombineCoding; } |
---|
561 | Void setRefIdxCombineCoding( Bool b ) { m_bRefIdxCombineCoding = b; } |
---|
562 | #endif |
---|
563 | #if DCM_COMB_LIST |
---|
564 | Void generateCombinedList (); |
---|
565 | #endif |
---|
566 | Void setSliceMode ( UInt uiMode ) { m_uiSliceMode = uiMode; } |
---|
567 | UInt getSliceMode () { return m_uiSliceMode; } |
---|
568 | Void setSliceArgument ( UInt uiArgument ) { m_uiSliceArgument = uiArgument; } |
---|
569 | UInt getSliceArgument () { return m_uiSliceArgument; } |
---|
570 | Void setSliceCurStartCUAddr ( UInt uiAddr ) { m_uiSliceCurStartCUAddr = uiAddr; } |
---|
571 | UInt getSliceCurStartCUAddr () { return m_uiSliceCurStartCUAddr; } |
---|
572 | Void setSliceCurEndCUAddr ( UInt uiAddr ) { m_uiSliceCurEndCUAddr = uiAddr; } |
---|
573 | UInt getSliceCurEndCUAddr () { return m_uiSliceCurEndCUAddr; } |
---|
574 | Void setSliceIdx ( UInt i) { m_uiSliceIdx = i; } |
---|
575 | UInt getSliceIdx () { return m_uiSliceIdx; } |
---|
576 | Void copySliceInfo (TComSlice *pcSliceSrc); |
---|
577 | Void setEntropySliceMode ( UInt uiMode ) { m_uiEntropySliceMode = uiMode; } |
---|
578 | UInt getEntropySliceMode () { return m_uiEntropySliceMode; } |
---|
579 | Void setEntropySliceArgument ( UInt uiArgument ) { m_uiEntropySliceArgument = uiArgument; } |
---|
580 | UInt getEntropySliceArgument () { return m_uiEntropySliceArgument; } |
---|
581 | Void setEntropySliceCurStartCUAddr ( UInt uiAddr ) { m_uiEntropySliceCurStartCUAddr = uiAddr; } |
---|
582 | UInt getEntropySliceCurStartCUAddr () { return m_uiEntropySliceCurStartCUAddr; } |
---|
583 | Void setEntropySliceCurEndCUAddr ( UInt uiAddr ) { m_uiEntropySliceCurEndCUAddr = uiAddr; } |
---|
584 | UInt getEntropySliceCurEndCUAddr () { return m_uiEntropySliceCurEndCUAddr; } |
---|
585 | Void setNextSlice ( Bool b ) { m_bNextSlice = b; } |
---|
586 | Bool isNextSlice () { return m_bNextSlice; } |
---|
587 | Void setNextEntropySlice ( Bool b ) { m_bNextEntropySlice = b; } |
---|
588 | Bool isNextEntropySlice () { return m_bNextEntropySlice; } |
---|
589 | Void setSliceBits ( UInt uiVal ) { m_uiSliceBits = uiVal; } |
---|
590 | UInt getSliceBits () { return m_uiSliceBits; } |
---|
591 | |
---|
592 | Void initMultiviewSlice ( Int** aaiScale = 0, Int** aaiOffset = 0 ); |
---|
593 | |
---|
594 | Int* getCodedScale () { return m_aaiCodedScale [0]; } |
---|
595 | Int* getCodedOffset () { return m_aaiCodedOffset[0]; } |
---|
596 | Int* getInvCodedScale () { return m_aaiCodedScale [1]; } |
---|
597 | Int* getInvCodedOffset () { return m_aaiCodedOffset[1]; } |
---|
598 | |
---|
599 | Void setTexturePic( TComPic *pcTexturePic ) { m_pcTexturePic = pcTexturePic; } |
---|
600 | TComPic *getTexturePic() const { return m_pcTexturePic; } |
---|
601 | |
---|
602 | #ifdef WEIGHT_PRED |
---|
603 | Void setWpScaling( wpScalingParam wp[2][MAX_NUM_REF][3] ) { memcpy(m_weightPredTable, wp, sizeof(wpScalingParam)*2*MAX_NUM_REF*3); } |
---|
604 | Void getWpScaling( RefPicList e, Int iRefIdx, wpScalingParam *&wp); |
---|
605 | Void displayWpScaling(); |
---|
606 | Void resetWpScaling(wpScalingParam wp[2][MAX_NUM_REF][3]); |
---|
607 | Void initWpScaling(wpScalingParam wp[2][MAX_NUM_REF][3]); |
---|
608 | Void initWpScaling(); |
---|
609 | inline Bool applyWP() { return( (m_eSliceType==P_SLICE && m_pcPPS->getUseWP()) || (m_eSliceType==B_SLICE && m_pcPPS->getWPBiPredIdc()) ); } |
---|
610 | |
---|
611 | Void setWpAcDcParam ( wpACDCParam wp[3] ) { memcpy(m_weightACDCParam, wp, sizeof(wpACDCParam)*3); } |
---|
612 | Void getWpAcDcParam ( wpACDCParam *&wp ); |
---|
613 | Void initWpAcDcParam(); |
---|
614 | #endif |
---|
615 | |
---|
616 | protected: |
---|
617 | #if 0 |
---|
618 | TComPic* xGetRefPic (TComList<TComPic*>& rcListPic, |
---|
619 | Bool bDRBFlag, |
---|
620 | ERBIndex eERBIndex, |
---|
621 | UInt uiPOCCurr, |
---|
622 | RefPicList eRefPicList, |
---|
623 | UInt uiNthRefPic ); |
---|
624 | #endif |
---|
625 | |
---|
626 | };// END CLASS DEFINITION TComSlice |
---|
627 | |
---|
628 | |
---|
629 | #endif // __TCOMSLICE__ |
---|
630 | |
---|