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