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