[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 |
---|
[1200] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[1200] | 6 | * Copyright (c) 2010-2015, ITU/ISO/IEC |
---|
[5] | 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. |
---|
[56] | 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
[5] | 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 | /** \file TDecCu.cpp |
---|
| 35 | \brief CU decoder class |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #include "TDecCu.h" |
---|
[1200] | 39 | #include "TLibCommon/TComTU.h" |
---|
| 40 | #include "TLibCommon/TComPrediction.h" |
---|
[2] | 41 | |
---|
[56] | 42 | //! \ingroup TLibDecoder |
---|
| 43 | //! \{ |
---|
| 44 | |
---|
[2] | 45 | // ==================================================================================================================== |
---|
| 46 | // Constructor / destructor / create / destroy |
---|
| 47 | // ==================================================================================================================== |
---|
| 48 | |
---|
| 49 | TDecCu::TDecCu() |
---|
| 50 | { |
---|
[56] | 51 | m_ppcYuvResi = NULL; |
---|
| 52 | m_ppcYuvReco = NULL; |
---|
| 53 | m_ppcCU = NULL; |
---|
[833] | 54 | #if H_3D_DBBP |
---|
| 55 | m_ppcYuvRecoDBBP = NULL; |
---|
| 56 | #endif |
---|
[2] | 57 | } |
---|
| 58 | |
---|
| 59 | TDecCu::~TDecCu() |
---|
| 60 | { |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | Void TDecCu::init( TDecEntropy* pcEntropyDecoder, TComTrQuant* pcTrQuant, TComPrediction* pcPrediction) |
---|
| 64 | { |
---|
| 65 | m_pcEntropyDecoder = pcEntropyDecoder; |
---|
| 66 | m_pcTrQuant = pcTrQuant; |
---|
| 67 | m_pcPrediction = pcPrediction; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | /** |
---|
[1200] | 71 | \param uiMaxDepth total number of allowable depth |
---|
| 72 | \param uiMaxWidth largest CU width |
---|
| 73 | \param uiMaxHeight largest CU height |
---|
| 74 | \param chromaFormatIDC chroma format |
---|
[2] | 75 | */ |
---|
[1200] | 76 | Void TDecCu::create( UInt uiMaxDepth, UInt uiMaxWidth, UInt uiMaxHeight, ChromaFormat chromaFormatIDC ) |
---|
[2] | 77 | { |
---|
| 78 | m_uiMaxDepth = uiMaxDepth+1; |
---|
[1200] | 79 | |
---|
[56] | 80 | m_ppcYuvResi = new TComYuv*[m_uiMaxDepth-1]; |
---|
| 81 | m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1]; |
---|
| 82 | m_ppcCU = new TComDataCU*[m_uiMaxDepth-1]; |
---|
[833] | 83 | #if H_3D_DBBP |
---|
| 84 | m_ppcYuvRecoDBBP = new TComYuv*[m_uiMaxDepth-1]; |
---|
| 85 | #endif |
---|
[1200] | 86 | |
---|
[2] | 87 | UInt uiNumPartitions; |
---|
| 88 | for ( UInt ui = 0; ui < m_uiMaxDepth-1; ui++ ) |
---|
| 89 | { |
---|
| 90 | uiNumPartitions = 1<<( ( m_uiMaxDepth - ui - 1 )<<1 ); |
---|
| 91 | UInt uiWidth = uiMaxWidth >> ui; |
---|
| 92 | UInt uiHeight = uiMaxHeight >> ui; |
---|
[1200] | 93 | |
---|
| 94 | m_ppcYuvResi[ui] = new TComYuv; m_ppcYuvResi[ui]->create( uiWidth, uiHeight, chromaFormatIDC ); |
---|
| 95 | m_ppcYuvReco[ui] = new TComYuv; m_ppcYuvReco[ui]->create( uiWidth, uiHeight, chromaFormatIDC ); |
---|
| 96 | m_ppcCU [ui] = new TComDataCU; m_ppcCU [ui]->create( chromaFormatIDC, uiNumPartitions, uiWidth, uiHeight, true, uiMaxWidth >> (m_uiMaxDepth - 1) ); |
---|
[833] | 97 | #if H_3D_DBBP |
---|
| 98 | m_ppcYuvRecoDBBP[ui] = new TComYuv; m_ppcYuvRecoDBBP[ui]->create( uiWidth, uiHeight ); |
---|
| 99 | #endif |
---|
[1200] | 100 | } |
---|
| 101 | |
---|
[56] | 102 | m_bDecodeDQP = false; |
---|
[1200] | 103 | m_IsChromaQpAdjCoded = false; |
---|
[56] | 104 | |
---|
[2] | 105 | // initialize partition order. |
---|
| 106 | UInt* piTmp = &g_auiZscanToRaster[0]; |
---|
| 107 | initZscanToRaster(m_uiMaxDepth, 1, 0, piTmp); |
---|
| 108 | initRasterToZscan( uiMaxWidth, uiMaxHeight, m_uiMaxDepth ); |
---|
[1200] | 109 | |
---|
[2] | 110 | // initialize conversion matrix from partition index to pel |
---|
| 111 | initRasterToPelXY( uiMaxWidth, uiMaxHeight, m_uiMaxDepth ); |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | Void TDecCu::destroy() |
---|
| 115 | { |
---|
| 116 | for ( UInt ui = 0; ui < m_uiMaxDepth-1; ui++ ) |
---|
| 117 | { |
---|
[56] | 118 | m_ppcYuvResi[ui]->destroy(); delete m_ppcYuvResi[ui]; m_ppcYuvResi[ui] = NULL; |
---|
| 119 | m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL; |
---|
| 120 | m_ppcCU [ui]->destroy(); delete m_ppcCU [ui]; m_ppcCU [ui] = NULL; |
---|
[833] | 121 | #if H_3D_DBBP |
---|
| 122 | m_ppcYuvRecoDBBP[ui]->destroy(); delete m_ppcYuvRecoDBBP[ui]; m_ppcYuvRecoDBBP[ui] = NULL; |
---|
| 123 | #endif |
---|
[2] | 124 | } |
---|
[1200] | 125 | |
---|
[56] | 126 | delete [] m_ppcYuvResi; m_ppcYuvResi = NULL; |
---|
| 127 | delete [] m_ppcYuvReco; m_ppcYuvReco = NULL; |
---|
| 128 | delete [] m_ppcCU ; m_ppcCU = NULL; |
---|
[833] | 129 | #if H_3D_DBBP |
---|
| 130 | delete [] m_ppcYuvRecoDBBP; m_ppcYuvRecoDBBP = NULL; |
---|
| 131 | #endif |
---|
[2] | 132 | } |
---|
| 133 | |
---|
| 134 | // ==================================================================================================================== |
---|
| 135 | // Public member functions |
---|
| 136 | // ==================================================================================================================== |
---|
| 137 | |
---|
[1200] | 138 | /** |
---|
| 139 | Parse a CTU. |
---|
| 140 | \param pCtu [in/out] pointer to CTU data structure |
---|
| 141 | \param isLastCtuOfSliceSegment [out] true, if last CTU of the slice segment |
---|
[2] | 142 | */ |
---|
[1200] | 143 | Void TDecCu::decodeCtu( TComDataCU* pCtu, Bool& isLastCtuOfSliceSegment ) |
---|
[2] | 144 | { |
---|
[1200] | 145 | if ( pCtu->getSlice()->getPPS()->getUseDQP() ) |
---|
[2] | 146 | { |
---|
[56] | 147 | setdQPFlag(true); |
---|
[2] | 148 | } |
---|
[56] | 149 | |
---|
[1200] | 150 | if ( pCtu->getSlice()->getUseChromaQpAdj() ) |
---|
| 151 | { |
---|
| 152 | setIsChromaQpAdjCoded(true); |
---|
| 153 | } |
---|
| 154 | |
---|
[2] | 155 | // start from the top level CU |
---|
[1200] | 156 | xDecodeCU( pCtu, 0, 0, isLastCtuOfSliceSegment); |
---|
[2] | 157 | } |
---|
| 158 | |
---|
[1200] | 159 | /** |
---|
| 160 | Decoding process for a CTU. |
---|
| 161 | \param pCtu [in/out] pointer to CTU data structure |
---|
[2] | 162 | */ |
---|
[1200] | 163 | Void TDecCu::decompressCtu( TComDataCU* pCtu ) |
---|
[2] | 164 | { |
---|
[773] | 165 | #if !H_3D_IV_MERGE |
---|
[1200] | 166 | xDecompressCU( pCtu, 0, 0 ); |
---|
[724] | 167 | #endif |
---|
[2] | 168 | } |
---|
| 169 | |
---|
| 170 | // ==================================================================================================================== |
---|
| 171 | // Protected member functions |
---|
| 172 | // ==================================================================================================================== |
---|
| 173 | |
---|
[1200] | 174 | //! decode end-of-slice flag |
---|
| 175 | Bool TDecCu::xDecodeSliceEnd( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
---|
[608] | 176 | { |
---|
[1200] | 177 | UInt uiIsLastCtuOfSliceSegment; |
---|
[56] | 178 | |
---|
[1200] | 179 | if (pcCU->isLastSubCUOfCtu(uiAbsPartIdx)) |
---|
[56] | 180 | { |
---|
[1200] | 181 | m_pcEntropyDecoder->decodeTerminatingBit( uiIsLastCtuOfSliceSegment ); |
---|
[56] | 182 | } |
---|
| 183 | else |
---|
| 184 | { |
---|
[1200] | 185 | uiIsLastCtuOfSliceSegment=0; |
---|
[56] | 186 | } |
---|
| 187 | |
---|
[1200] | 188 | return uiIsLastCtuOfSliceSegment>0; |
---|
[56] | 189 | } |
---|
| 190 | |
---|
[1200] | 191 | //! decode CU block recursively |
---|
| 192 | Void TDecCu::xDecodeCU( TComDataCU*const pcCU, const UInt uiAbsPartIdx, const UInt uiDepth, Bool &isLastCtuOfSliceSegment) |
---|
[2] | 193 | { |
---|
[1200] | 194 | TComPic* pcPic = pcCU->getPic(); |
---|
| 195 | const TComSPS &sps = pcPic->getPicSym()->getSPS(); |
---|
| 196 | const TComPPS &pps = pcPic->getPicSym()->getPPS(); |
---|
| 197 | const UInt maxCuWidth = sps.getMaxCUWidth(); |
---|
| 198 | const UInt maxCuHeight= sps.getMaxCUHeight(); |
---|
| 199 | UInt uiCurNumParts = pcPic->getNumPartitionsInCtu() >> (uiDepth<<1); |
---|
[2] | 200 | UInt uiQNumParts = uiCurNumParts>>2; |
---|
[1200] | 201 | |
---|
| 202 | |
---|
[2] | 203 | Bool bBoundary = false; |
---|
| 204 | UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
[1200] | 205 | UInt uiRPelX = uiLPelX + (maxCuWidth>>uiDepth) - 1; |
---|
[2] | 206 | UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
[1200] | 207 | UInt uiBPelY = uiTPelY + (maxCuHeight>>uiDepth) - 1; |
---|
[608] | 208 | #if H_MV_ENC_DEC_TRAC |
---|
| 209 | DTRACE_CU_S("=========== coding_quadtree ===========\n") |
---|
| 210 | DTRACE_CU("x0", uiLPelX) |
---|
| 211 | DTRACE_CU("x1", uiTPelY) |
---|
[1200] | 212 | DTRACE_CU("log2CbSize", maxCuWidth>>uiDepth) |
---|
[608] | 213 | DTRACE_CU("cqtDepth" , uiDepth) |
---|
| 214 | #endif |
---|
[833] | 215 | |
---|
[1200] | 216 | if( ( uiRPelX < sps.getPicWidthInLumaSamples() ) && ( uiBPelY < sps.getPicHeightInLumaSamples() ) ) |
---|
[2] | 217 | { |
---|
[608] | 218 | m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
[2] | 219 | } |
---|
| 220 | else |
---|
| 221 | { |
---|
| 222 | bBoundary = true; |
---|
| 223 | } |
---|
[1200] | 224 | if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() ) ) || bBoundary ) |
---|
[2] | 225 | { |
---|
| 226 | UInt uiIdx = uiAbsPartIdx; |
---|
[1200] | 227 | if( uiDepth == pps.getMaxCuDQPDepth() && pps.getUseDQP()) |
---|
[56] | 228 | { |
---|
| 229 | setdQPFlag(true); |
---|
| 230 | pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
| 231 | } |
---|
| 232 | |
---|
[1200] | 233 | if( uiDepth == pps.getPpsRangeExtension().getDiffCuChromaQpOffsetDepth() && pcCU->getSlice()->getUseChromaQpAdj() ) |
---|
| 234 | { |
---|
| 235 | setIsChromaQpAdjCoded(true); |
---|
| 236 | } |
---|
| 237 | |
---|
[2] | 238 | for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ ) |
---|
| 239 | { |
---|
| 240 | uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 241 | uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; |
---|
[1200] | 242 | |
---|
| 243 | if ( !isLastCtuOfSliceSegment && ( uiLPelX < sps.getPicWidthInLumaSamples() ) && ( uiTPelY < sps.getPicHeightInLumaSamples() ) ) |
---|
[56] | 244 | { |
---|
[1200] | 245 | xDecodeCU( pcCU, uiIdx, uiDepth+1, isLastCtuOfSliceSegment ); |
---|
[56] | 246 | } |
---|
[1200] | 247 | else |
---|
| 248 | { |
---|
| 249 | pcCU->setOutsideCUPart( uiIdx, uiDepth+1 ); |
---|
| 250 | } |
---|
| 251 | |
---|
[2] | 252 | uiIdx += uiQNumParts; |
---|
| 253 | } |
---|
[1200] | 254 | if( uiDepth == pps.getMaxCuDQPDepth() && pps.getUseDQP()) |
---|
[56] | 255 | { |
---|
| 256 | if ( getdQPFlag() ) |
---|
| 257 | { |
---|
[1200] | 258 | UInt uiQPSrcPartIdx = uiAbsPartIdx; |
---|
[56] | 259 | pcCU->setQPSubParts( pcCU->getRefQP( uiQPSrcPartIdx ), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
| 260 | } |
---|
| 261 | } |
---|
[2] | 262 | return; |
---|
| 263 | } |
---|
[1200] | 264 | |
---|
[608] | 265 | #if H_MV_ENC_DEC_TRAC |
---|
| 266 | DTRACE_CU_S("=========== coding_unit ===========\n") |
---|
[1179] | 267 | #if H_MV_ENC_DEC_TRAC |
---|
| 268 | #if ENC_DEC_TRACE |
---|
| 269 | stopAtPos ( pcCU->getSlice()->getPOC(), |
---|
| 270 | pcCU->getSlice()->getLayerId(), |
---|
| 271 | uiLPelX, |
---|
| 272 | uiTPelY, |
---|
| 273 | uiRPelX-uiLPelX+1, |
---|
| 274 | uiBPelY-uiTPelY+1); |
---|
[608] | 275 | #endif |
---|
[1179] | 276 | #endif |
---|
[833] | 277 | |
---|
[1179] | 278 | #endif |
---|
| 279 | |
---|
[1200] | 280 | if( uiDepth <= pps.getMaxCuDQPDepth() && pps.getUseDQP()) |
---|
[56] | 281 | { |
---|
| 282 | setdQPFlag(true); |
---|
| 283 | pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
| 284 | } |
---|
[608] | 285 | #if H_3D_NBDV |
---|
| 286 | DisInfo DvInfo; |
---|
| 287 | DvInfo.m_acNBDV.setZero(); |
---|
| 288 | DvInfo.m_aVIdxCan = 0; |
---|
| 289 | #if H_3D_NBDV_REF |
---|
| 290 | DvInfo.m_acDoNBDV.setZero(); |
---|
| 291 | #endif |
---|
| 292 | |
---|
[1200] | 293 | if(!pcCU->getSlice()->isIntra()) |
---|
[608] | 294 | { |
---|
| 295 | #if H_3D_ARP && H_3D_IV_MERGE |
---|
[1124] | 296 | if( pcCU->getSlice()->getIvResPredFlag() || pcCU->getSlice()->getIvMvPredFlag() ) |
---|
[608] | 297 | #else |
---|
| 298 | #if H_3D_ARP |
---|
| 299 | if( pcCU->getSlice()->getVPS()->getUseAdvRP(pcCU->getSlice()->getLayerId()) ) |
---|
[443] | 300 | #else |
---|
[608] | 301 | #if H_3D_IV_MERGE |
---|
| 302 | if( pcCU->getSlice()->getVPS()->getIvMvPredFlag(pcCU->getSlice()->getLayerId()) ) |
---|
| 303 | #else |
---|
| 304 | if (0) |
---|
[443] | 305 | #endif |
---|
| 306 | #endif |
---|
| 307 | #endif |
---|
[608] | 308 | { |
---|
| 309 | m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true ); |
---|
| 310 | m_ppcCU[uiDepth]->copyDVInfoFrom( pcCU, uiAbsPartIdx); |
---|
| 311 | PartSize ePartTemp = m_ppcCU[uiDepth]->getPartitionSize(0); |
---|
| 312 | UChar cWidTemp = m_ppcCU[uiDepth]->getWidth(0); |
---|
| 313 | UChar cHeightTemp = m_ppcCU[uiDepth]->getHeight(0); |
---|
| 314 | m_ppcCU[uiDepth]->setWidth ( 0, pcCU->getSlice()->getSPS()->getMaxCUWidth ()/(1<<uiDepth) ); |
---|
| 315 | m_ppcCU[uiDepth]->setHeight ( 0, pcCU->getSlice()->getSPS()->getMaxCUHeight()/(1<<uiDepth) ); |
---|
| 316 | m_ppcCU[uiDepth]->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); |
---|
[773] | 317 | #if H_3D_IV_MERGE |
---|
[724] | 318 | if( pcCU->getSlice()->getIsDepth()) |
---|
| 319 | { |
---|
[1179] | 320 | m_ppcCU[uiDepth]->getDispforDepth(0, 0, &DvInfo); |
---|
[724] | 321 | } |
---|
| 322 | else |
---|
| 323 | { |
---|
| 324 | #endif |
---|
[608] | 325 | #if H_3D_NBDV_REF |
---|
[1124] | 326 | if( pcCU->getSlice()->getDepthBasedBlkPartFlag() ) //Notes from QC: please check the condition for DoNBDV. Remove this comment once it is done. |
---|
[622] | 327 | { |
---|
[1179] | 328 | m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo, true); |
---|
[622] | 329 | } |
---|
[608] | 330 | else |
---|
[56] | 331 | #endif |
---|
[622] | 332 | { |
---|
[1179] | 333 | m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo); |
---|
[622] | 334 | } |
---|
[773] | 335 | #if H_3D_IV_MERGE |
---|
[724] | 336 | } |
---|
| 337 | #endif |
---|
[622] | 338 | #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC |
---|
| 339 | if ( g_decTraceDispDer ) |
---|
| 340 | { |
---|
| 341 | DTRACE_CU( "RefViewIdx", DvInfo.m_aVIdxCan ); |
---|
| 342 | DTRACE_CU( "MvDisp[x]", DvInfo.m_acNBDV.getHor() ); |
---|
| 343 | DTRACE_CU( "MvDisp[y]", DvInfo.m_acNBDV.getVer() ); |
---|
| 344 | DTRACE_CU( "MvRefinedDisp[x]", DvInfo.m_acDoNBDV.getHor() ); |
---|
| 345 | DTRACE_CU( "MvRefinedDisp[y]", DvInfo.m_acDoNBDV.getVer() ); |
---|
| 346 | } |
---|
| 347 | #endif |
---|
| 348 | |
---|
[608] | 349 | pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth); |
---|
| 350 | m_ppcCU[uiDepth]->setPartSizeSubParts( ePartTemp, 0, uiDepth ); |
---|
| 351 | m_ppcCU[uiDepth]->setWidth ( 0, cWidTemp ); |
---|
| 352 | m_ppcCU[uiDepth]->setHeight ( 0, cHeightTemp ); |
---|
| 353 | } |
---|
| 354 | } |
---|
| 355 | #endif |
---|
[1200] | 356 | |
---|
| 357 | if( uiDepth <= pps.getPpsRangeExtension().getDiffCuChromaQpOffsetDepth() && pcCU->getSlice()->getUseChromaQpAdj() ) |
---|
[2] | 358 | { |
---|
[1200] | 359 | setIsChromaQpAdjCoded(true); |
---|
| 360 | } |
---|
| 361 | |
---|
| 362 | if (pps.getTransquantBypassEnableFlag()) |
---|
| 363 | { |
---|
[608] | 364 | m_pcEntropyDecoder->decodeCUTransquantBypassFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 365 | } |
---|
[1200] | 366 | |
---|
[608] | 367 | // decode CU mode and the partition size |
---|
| 368 | if( !pcCU->getSlice()->isIntra()) |
---|
| 369 | { |
---|
[2] | 370 | m_pcEntropyDecoder->decodeSkipFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 371 | } |
---|
[1200] | 372 | |
---|
| 373 | |
---|
[2] | 374 | if( pcCU->isSkipped(uiAbsPartIdx) ) |
---|
| 375 | { |
---|
[608] | 376 | #if H_MV_ENC_DEC_TRAC |
---|
| 377 | DTRACE_PU_S("=========== prediction_unit ===========\n") |
---|
| 378 | DTRACE_PU("x0", uiLPelX) |
---|
| 379 | DTRACE_PU("x1", uiTPelY) |
---|
| 380 | #endif |
---|
[2] | 381 | m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); |
---|
| 382 | m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); |
---|
[608] | 383 | #if H_3D_IV_MERGE |
---|
| 384 | m_ppcCU[uiDepth]->copyDVInfoFrom(pcCU, uiAbsPartIdx); |
---|
[56] | 385 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists |
---|
| 386 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; |
---|
| 387 | #else |
---|
[2] | 388 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists |
---|
| 389 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; |
---|
[608] | 390 | #endif |
---|
[56] | 391 | Int numValidMergeCand = 0; |
---|
[608] | 392 | for( UInt ui = 0; ui < m_ppcCU[uiDepth]->getSlice()->getMaxNumMergeCand(); ++ui ) |
---|
[2] | 393 | { |
---|
| 394 | uhInterDirNeighbours[ui] = 0; |
---|
| 395 | } |
---|
[608] | 396 | m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, uiDepth ); |
---|
| 397 | UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx); |
---|
[724] | 398 | #if H_3D_ARP |
---|
| 399 | m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth ); |
---|
| 400 | #endif |
---|
[1225] | 401 | #if NH_3D_IC |
---|
[833] | 402 | m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 403 | #endif |
---|
[724] | 404 | |
---|
[608] | 405 | #if H_3D_VSP |
---|
| 406 | Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; |
---|
| 407 | memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); |
---|
[773] | 408 | #if H_3D_SPIVMP |
---|
[724] | 409 | Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM]; |
---|
| 410 | memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); |
---|
| 411 | TComMvField* pcMvFieldSP; |
---|
| 412 | UChar* puhInterDirSP; |
---|
| 413 | pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2]; |
---|
| 414 | puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()]; |
---|
| 415 | #endif |
---|
| 416 | m_ppcCU[uiDepth]->initAvailableFlags(); |
---|
| 417 | m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
---|
[950] | 418 | m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours |
---|
[773] | 419 | #if H_3D_SPIVMP |
---|
[950] | 420 | , pcMvFieldSP, puhInterDirSP |
---|
| 421 | #endif |
---|
[724] | 422 | , numValidMergeCand, uiMergeIndex ); |
---|
[950] | 423 | |
---|
| 424 | m_ppcCU[uiDepth]->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag |
---|
| 425 | #if H_3D_SPIVMP |
---|
| 426 | , bSPIVMPFlag |
---|
| 427 | #endif |
---|
| 428 | , numValidMergeCand ); |
---|
[608] | 429 | pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); |
---|
[443] | 430 | #else |
---|
[773] | 431 | #if H_3D |
---|
[724] | 432 | m_ppcCU[uiDepth]->initAvailableFlags(); |
---|
[608] | 433 | m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
---|
[724] | 434 | m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
---|
| 435 | #else |
---|
| 436 | m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
---|
[443] | 437 | #endif |
---|
[724] | 438 | #endif |
---|
[56] | 439 | pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); |
---|
[833] | 440 | |
---|
[56] | 441 | TComMv cTmpMv( 0, 0 ); |
---|
| 442 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
[1200] | 443 | { |
---|
[56] | 444 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
---|
| 445 | { |
---|
| 446 | pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiAbsPartIdx, 0, uiDepth); |
---|
| 447 | pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiAbsPartIdx, 0, uiDepth); |
---|
| 448 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
| 449 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
[884] | 450 | #if H_3D_VSP |
---|
[833] | 451 | if( pcCU->getVSPFlag( uiAbsPartIdx ) != 0 ) |
---|
| 452 | { |
---|
| 453 | if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) ) |
---|
| 454 | { |
---|
| 455 | UInt dummy; |
---|
| 456 | Int vspSize; |
---|
| 457 | Int width, height; |
---|
| 458 | m_ppcCU[uiDepth]->getPartIndexAndSize( uiAbsPartIdx, dummy, width, height ); |
---|
| 459 | m_ppcCU[uiDepth]->setMvFieldPUForVSP( pcCU, uiAbsPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize ); |
---|
| 460 | pcCU->setVSPFlag( uiAbsPartIdx, vspSize ); |
---|
| 461 | } |
---|
| 462 | } |
---|
| 463 | #endif |
---|
[622] | 464 | #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC |
---|
| 465 | if ( g_decTraceMvFromMerge ) |
---|
| 466 | { |
---|
| 467 | if ( uiRefListIdx == 0 ) |
---|
| 468 | { |
---|
| 469 | DTRACE_PU( "mvL0[0]", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getHor()); |
---|
| 470 | DTRACE_PU( "mvL0[1]", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getVer()); |
---|
| 471 | DTRACE_PU( "refIdxL0 ", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx()); |
---|
| 472 | } |
---|
| 473 | else |
---|
| 474 | { |
---|
| 475 | DTRACE_PU( "mvL1[0]", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getHor()); |
---|
| 476 | DTRACE_PU( "mvL1[1]", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getVer()); |
---|
| 477 | DTRACE_PU( "refIdxL1", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx()); |
---|
| 478 | } |
---|
| 479 | } |
---|
| 480 | #endif |
---|
[56] | 481 | } |
---|
| 482 | } |
---|
[773] | 483 | #if H_3D_SPIVMP |
---|
[724] | 484 | pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); |
---|
| 485 | if (bSPIVMPFlag[uiMergeIndex]) |
---|
| 486 | { |
---|
| 487 | UInt uiSPAddr; |
---|
| 488 | Int iWidth = pcCU->getWidth(uiAbsPartIdx); |
---|
| 489 | Int iHeight = pcCU->getHeight(uiAbsPartIdx); |
---|
| 490 | |
---|
| 491 | Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; |
---|
| 492 | |
---|
| 493 | pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); |
---|
| 494 | |
---|
| 495 | for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++) |
---|
| 496 | { |
---|
| 497 | pcCU->getSPAbsPartIdx(uiAbsPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr); |
---|
| 498 | pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight); |
---|
| 499 | pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight); |
---|
| 500 | pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight); |
---|
| 501 | } |
---|
| 502 | } |
---|
[735] | 503 | delete[] pcMvFieldSP; |
---|
| 504 | delete[] puhInterDirSP; |
---|
[724] | 505 | #endif |
---|
| 506 | |
---|
[1200] | 507 | xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, isLastCtuOfSliceSegment ); |
---|
[773] | 508 | #if H_3D_IV_MERGE |
---|
[724] | 509 | xDecompressCU(pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 510 | #endif |
---|
[1200] | 511 | |
---|
[2] | 512 | return; |
---|
| 513 | } |
---|
[1196] | 514 | #if H_3D |
---|
[1179] | 515 | m_pcEntropyDecoder->decodeDIS( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 516 | if(!pcCU->getDISFlag(uiAbsPartIdx)) |
---|
| 517 | { |
---|
[1039] | 518 | #endif |
---|
[1200] | 519 | |
---|
[608] | 520 | m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 521 | m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth ); |
---|
[2] | 522 | |
---|
[56] | 523 | if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) |
---|
| 524 | { |
---|
| 525 | m_pcEntropyDecoder->decodeIPCMInfo( pcCU, uiAbsPartIdx, uiDepth ); |
---|
[2] | 526 | |
---|
[56] | 527 | if(pcCU->getIPCMFlag(uiAbsPartIdx)) |
---|
[2] | 528 | { |
---|
[1179] | 529 | #if H_3D_DIM_SDC |
---|
| 530 | m_pcEntropyDecoder->decodeSDCFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 531 | #endif |
---|
[1200] | 532 | xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, isLastCtuOfSliceSegment ); |
---|
[773] | 533 | #if H_3D_IV_MERGE |
---|
[724] | 534 | xDecompressCU(pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 535 | #endif |
---|
[56] | 536 | return; |
---|
| 537 | } |
---|
| 538 | } |
---|
| 539 | |
---|
| 540 | // prediction mode ( Intra : direction mode, Inter : Mv, reference idx ) |
---|
| 541 | m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]); |
---|
[1179] | 542 | |
---|
[2] | 543 | // Coefficient decoding |
---|
[56] | 544 | Bool bCodeDQP = getdQPFlag(); |
---|
[1200] | 545 | Bool isChromaQpAdjCoded = getIsChromaQpAdjCoded(); |
---|
| 546 | m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, bCodeDQP, isChromaQpAdjCoded ); |
---|
| 547 | setIsChromaQpAdjCoded( isChromaQpAdjCoded ); |
---|
[56] | 548 | setdQPFlag( bCodeDQP ); |
---|
[1196] | 549 | #if H_3D |
---|
[1179] | 550 | } |
---|
[1039] | 551 | #endif |
---|
[1200] | 552 | xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, isLastCtuOfSliceSegment ); |
---|
[773] | 553 | #if H_3D_IV_MERGE |
---|
[724] | 554 | xDecompressCU(pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 555 | #endif |
---|
[2] | 556 | } |
---|
| 557 | |
---|
[1200] | 558 | Void TDecCu::xFinishDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool &isLastCtuOfSliceSegment) |
---|
[56] | 559 | { |
---|
[608] | 560 | if( pcCU->getSlice()->getPPS()->getUseDQP()) |
---|
[56] | 561 | { |
---|
[608] | 562 | pcCU->setQPSubParts( getdQPFlag()?pcCU->getRefQP(uiAbsPartIdx):pcCU->getCodedQP(), uiAbsPartIdx, uiDepth ); // set QP |
---|
[56] | 563 | } |
---|
| 564 | |
---|
[1200] | 565 | if (pcCU->getSlice()->getUseChromaQpAdj() && !getIsChromaQpAdjCoded()) |
---|
| 566 | { |
---|
| 567 | pcCU->setChromaQpAdjSubParts( pcCU->getCodedChromaQpAdj(), uiAbsPartIdx, uiDepth ); // set QP |
---|
| 568 | } |
---|
| 569 | |
---|
| 570 | isLastCtuOfSliceSegment = xDecodeSliceEnd( pcCU, uiAbsPartIdx ); |
---|
[56] | 571 | } |
---|
| 572 | |
---|
[1200] | 573 | Void TDecCu::xDecompressCU( TComDataCU* pCtu, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
[2] | 574 | { |
---|
[1200] | 575 | TComPic* pcPic = pCtu->getPic(); |
---|
[773] | 576 | #if !H_3D_IV_MERGE |
---|
[1200] | 577 | TComSlice * pcSlice = pCtu->getSlice(); |
---|
| 578 | const TComSPS &sps=*(pcSlice->getSPS()); |
---|
| 579 | |
---|
[2] | 580 | Bool bBoundary = false; |
---|
[1200] | 581 | UInt uiLPelX = pCtu->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
| 582 | UInt uiRPelX = uiLPelX + (sps.getMaxCUWidth()>>uiDepth) - 1; |
---|
| 583 | UInt uiTPelY = pCtu->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
| 584 | UInt uiBPelY = uiTPelY + (sps.getMaxCUHeight()>>uiDepth) - 1; |
---|
[1196] | 585 | |
---|
[1200] | 586 | if( ( uiRPelX >= sps.getPicWidthInLumaSamples() ) || ( uiBPelY >= sps.getPicHeightInLumaSamples() ) ) |
---|
[2] | 587 | { |
---|
| 588 | bBoundary = true; |
---|
| 589 | } |
---|
[1196] | 590 | |
---|
[1200] | 591 | if( ( ( uiDepth < pCtu->getDepth( uiAbsPartIdx ) ) && ( uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() ) ) || bBoundary ) |
---|
[2] | 592 | { |
---|
| 593 | UInt uiNextDepth = uiDepth + 1; |
---|
[1200] | 594 | UInt uiQNumParts = pCtu->getTotalNumPart() >> (uiNextDepth<<1); |
---|
[2] | 595 | UInt uiIdx = uiAbsPartIdx; |
---|
| 596 | for ( UInt uiPartIdx = 0; uiPartIdx < 4; uiPartIdx++ ) |
---|
| 597 | { |
---|
[1200] | 598 | uiLPelX = pCtu->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 599 | uiTPelY = pCtu->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; |
---|
[1196] | 600 | |
---|
[1200] | 601 | if( ( uiLPelX < sps.getPicWidthInLumaSamples() ) && ( uiTPelY < sps.getPicHeightInLumaSamples() ) ) |
---|
[56] | 602 | { |
---|
[1200] | 603 | xDecompressCU(pCtu, uiIdx, uiNextDepth ); |
---|
[56] | 604 | } |
---|
[1196] | 605 | |
---|
[2] | 606 | uiIdx += uiQNumParts; |
---|
| 607 | } |
---|
| 608 | return; |
---|
| 609 | } |
---|
[1200] | 610 | #endif |
---|
[2] | 611 | // Residual reconstruction |
---|
| 612 | m_ppcYuvResi[uiDepth]->clear(); |
---|
[1196] | 613 | |
---|
[1200] | 614 | m_ppcCU[uiDepth]->copySubCU( pCtu, uiAbsPartIdx ); |
---|
[872] | 615 | |
---|
[2] | 616 | switch( m_ppcCU[uiDepth]->getPredictionMode(0) ) |
---|
| 617 | { |
---|
[1200] | 618 | case MODE_INTER: |
---|
[833] | 619 | #if H_3D_DBBP |
---|
[1196] | 620 | if( m_ppcCU[uiDepth]->getDBBPFlag(0) ) |
---|
| 621 | { |
---|
| 622 | xReconInterDBBP( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth ); |
---|
| 623 | } |
---|
| 624 | else |
---|
| 625 | { |
---|
[833] | 626 | #endif |
---|
[655] | 627 | #if H_3D_INTER_SDC |
---|
[833] | 628 | if( m_ppcCU[uiDepth]->getSDCFlag( 0 ) ) |
---|
[608] | 629 | { |
---|
| 630 | xReconInterSDC( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth ); |
---|
| 631 | } |
---|
| 632 | else |
---|
| 633 | { |
---|
| 634 | #endif |
---|
[1200] | 635 | xReconInter( m_ppcCU[uiDepth], uiDepth ); |
---|
[655] | 636 | #if H_3D_INTER_SDC |
---|
[608] | 637 | } |
---|
| 638 | #endif |
---|
[833] | 639 | #if H_3D_DBBP |
---|
[1196] | 640 | } |
---|
[833] | 641 | #endif |
---|
[1200] | 642 | break; |
---|
| 643 | case MODE_INTRA: |
---|
[1196] | 644 | #if H_3D |
---|
| 645 | if( m_ppcCU[uiDepth]->getDISFlag(0) ) |
---|
| 646 | { |
---|
| 647 | xReconDIS( m_ppcCU[uiDepth], 0, uiDepth ); |
---|
| 648 | } |
---|
[1179] | 649 | #if H_3D_DIM_SDC |
---|
[1196] | 650 | else if( m_ppcCU[uiDepth]->getSDCFlag(0) ) |
---|
| 651 | { |
---|
| 652 | xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth ); |
---|
| 653 | } |
---|
[1179] | 654 | #endif |
---|
[1196] | 655 | else |
---|
[1039] | 656 | #endif |
---|
[608] | 657 | xReconIntraQT( m_ppcCU[uiDepth], uiDepth ); |
---|
[1200] | 658 | break; |
---|
| 659 | default: |
---|
| 660 | assert(0); |
---|
| 661 | break; |
---|
[2] | 662 | } |
---|
[1200] | 663 | |
---|
| 664 | #if DEBUG_STRING |
---|
| 665 | const PredMode predMode=m_ppcCU[uiDepth]->getPredictionMode(0); |
---|
| 666 | if (DebugOptionList::DebugString_Structure.getInt()&DebugStringGetPredModeMask(predMode)) |
---|
| 667 | { |
---|
| 668 | PartSize eSize=m_ppcCU[uiDepth]->getPartitionSize(0); |
---|
| 669 | std::ostream &ss(std::cout); |
---|
| 670 | |
---|
| 671 | ss <<"###: " << (predMode==MODE_INTRA?"Intra ":"Inter ") << partSizeToString[eSize] << " CU at " << m_ppcCU[uiDepth]->getCUPelX() << ", " << m_ppcCU[uiDepth]->getCUPelY() << " width=" << UInt(m_ppcCU[uiDepth]->getWidth(0)) << std::endl; |
---|
| 672 | } |
---|
| 673 | #endif |
---|
| 674 | |
---|
[56] | 675 | if ( m_ppcCU[uiDepth]->isLosslessCoded(0) && (m_ppcCU[uiDepth]->getIPCMFlag(0) == false)) |
---|
| 676 | { |
---|
[608] | 677 | xFillPCMBuffer(m_ppcCU[uiDepth], uiDepth); |
---|
[56] | 678 | } |
---|
[1196] | 679 | |
---|
[2] | 680 | xCopyToPic( m_ppcCU[uiDepth], pcPic, uiAbsPartIdx, uiDepth ); |
---|
| 681 | } |
---|
| 682 | |
---|
[608] | 683 | Void TDecCu::xReconInter( TComDataCU* pcCU, UInt uiDepth ) |
---|
[2] | 684 | { |
---|
[1200] | 685 | |
---|
[2] | 686 | // inter prediction |
---|
| 687 | m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] ); |
---|
[1200] | 688 | |
---|
| 689 | #if DEBUG_STRING |
---|
| 690 | const Int debugPredModeMask=DebugStringGetPredModeMask(MODE_INTER); |
---|
| 691 | if (DebugOptionList::DebugString_Pred.getInt()&debugPredModeMask) |
---|
| 692 | { |
---|
| 693 | printBlockToStream(std::cout, "###inter-pred: ", *(m_ppcYuvReco[uiDepth])); |
---|
| 694 | } |
---|
| 695 | #endif |
---|
| 696 | |
---|
[2] | 697 | // inter recon |
---|
[1200] | 698 | xDecodeInterTexture( pcCU, uiDepth ); |
---|
| 699 | |
---|
| 700 | #if DEBUG_STRING |
---|
| 701 | if (DebugOptionList::DebugString_Resi.getInt()&debugPredModeMask) |
---|
| 702 | { |
---|
| 703 | printBlockToStream(std::cout, "###inter-resi: ", *(m_ppcYuvResi[uiDepth])); |
---|
| 704 | } |
---|
| 705 | #endif |
---|
| 706 | |
---|
[2] | 707 | // clip for only non-zero cbp case |
---|
[1200] | 708 | if ( pcCU->getQtRootCbf( 0) ) |
---|
[2] | 709 | { |
---|
[1200] | 710 | m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ), pcCU->getSlice()->getSPS()->getBitDepths() ); |
---|
[2] | 711 | } |
---|
| 712 | else |
---|
| 713 | { |
---|
[608] | 714 | m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 )); |
---|
| 715 | } |
---|
[1200] | 716 | #if DEBUG_STRING |
---|
| 717 | if (DebugOptionList::DebugString_Reco.getInt()&debugPredModeMask) |
---|
| 718 | { |
---|
| 719 | printBlockToStream(std::cout, "###inter-reco: ", *(m_ppcYuvReco[uiDepth])); |
---|
| 720 | } |
---|
| 721 | #endif |
---|
| 722 | |
---|
[608] | 723 | } |
---|
[1179] | 724 | |
---|
[1196] | 725 | #if H_3D |
---|
[1179] | 726 | Void TDecCu::xReconDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 727 | { |
---|
| 728 | UInt uiWidth = pcCU->getWidth ( 0 ); |
---|
| 729 | UInt uiHeight = pcCU->getHeight ( 0 ); |
---|
| 730 | |
---|
| 731 | TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth]; |
---|
| 732 | |
---|
| 733 | UInt uiStride = pcRecoYuv->getStride (); |
---|
| 734 | Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 735 | |
---|
| 736 | |
---|
| 737 | AOF( uiWidth == uiHeight ); |
---|
| 738 | AOF( uiAbsPartIdx == 0 ); |
---|
| 739 | |
---|
| 740 | Bool bAboveAvail = false; |
---|
| 741 | Bool bLeftAvail = false; |
---|
| 742 | pcCU->getPattern()->initPattern ( pcCU, 0, uiAbsPartIdx ); |
---|
| 743 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, |
---|
| 744 | m_pcPrediction->getPredicBuf (), |
---|
| 745 | m_pcPrediction->getPredicBufWidth (), |
---|
| 746 | m_pcPrediction->getPredicBufHeight (), |
---|
| 747 | bAboveAvail, bLeftAvail |
---|
| 748 | ); |
---|
| 749 | |
---|
| 750 | if ( pcCU->getDISType(uiAbsPartIdx) == 0 ) |
---|
| 751 | { |
---|
| 752 | m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), VER_IDX, piReco, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); |
---|
| 753 | } |
---|
| 754 | else if ( pcCU->getDISType(uiAbsPartIdx) == 1 ) |
---|
| 755 | { |
---|
| 756 | m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), HOR_IDX, piReco, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); |
---|
| 757 | } |
---|
| 758 | else if ( pcCU->getDISType(uiAbsPartIdx) == 2 ) |
---|
| 759 | { |
---|
| 760 | Pel pSingleDepth = 1 << ( g_bitDepthY - 1 ); |
---|
| 761 | pcCU->getNeighDepth ( 0, 0, &pSingleDepth, 0 ); |
---|
| 762 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
| 763 | { |
---|
| 764 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
| 765 | { |
---|
| 766 | piReco[ uiX ] = pSingleDepth; |
---|
| 767 | } |
---|
| 768 | piReco+= uiStride; |
---|
| 769 | } |
---|
| 770 | } |
---|
| 771 | else if ( pcCU->getDISType(uiAbsPartIdx) == 3 ) |
---|
| 772 | { |
---|
| 773 | Pel pSingleDepth = 1 << ( g_bitDepthY - 1 ); |
---|
| 774 | pcCU->getNeighDepth ( 0, 0, &pSingleDepth, 1 ); |
---|
| 775 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
| 776 | { |
---|
| 777 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
| 778 | { |
---|
| 779 | piReco[ uiX ] = pSingleDepth; |
---|
| 780 | } |
---|
| 781 | piReco+= uiStride; |
---|
| 782 | } |
---|
| 783 | } |
---|
| 784 | |
---|
| 785 | // clear UV |
---|
| 786 | UInt uiStrideC = pcRecoYuv->getCStride(); |
---|
| 787 | Pel *pRecCb = pcRecoYuv->getCbAddr(); |
---|
| 788 | Pel *pRecCr = pcRecoYuv->getCrAddr(); |
---|
| 789 | |
---|
| 790 | for (Int y=0; y<uiHeight/2; y++) |
---|
| 791 | { |
---|
| 792 | for (Int x=0; x<uiWidth/2; x++) |
---|
| 793 | { |
---|
| 794 | pRecCb[x] = 1<<(g_bitDepthC-1); |
---|
| 795 | pRecCr[x] = 1<<(g_bitDepthC-1); |
---|
| 796 | } |
---|
| 797 | |
---|
| 798 | pRecCb += uiStrideC; |
---|
| 799 | pRecCr += uiStrideC; |
---|
| 800 | } |
---|
| 801 | } |
---|
[1039] | 802 | #endif |
---|
[655] | 803 | #if H_3D_INTER_SDC |
---|
[608] | 804 | Void TDecCu::xReconInterSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 805 | { |
---|
| 806 | // inter prediction |
---|
| 807 | m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] ); |
---|
| 808 | |
---|
| 809 | UInt uiWidth = pcCU->getWidth ( 0 ); |
---|
| 810 | UInt uiHeight = pcCU->getHeight( 0 ); |
---|
| 811 | |
---|
| 812 | Pel *pResi; |
---|
| 813 | UInt uiPelX, uiPelY; |
---|
| 814 | UInt uiResiStride = m_ppcYuvResi[uiDepth]->getStride(); |
---|
| 815 | |
---|
| 816 | pResi = m_ppcYuvResi[uiDepth]->getLumaAddr( 0 ); |
---|
| 817 | for( uiPelY = 0; uiPelY < uiHeight; uiPelY++ ) |
---|
| 818 | { |
---|
| 819 | for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ ) |
---|
[2] | 820 | { |
---|
[833] | 821 | pResi[ uiPelX ] = pcCU->getSDCSegmentDCOffset( 0, 0 ); |
---|
[2] | 822 | } |
---|
[608] | 823 | pResi += uiResiStride; |
---|
[2] | 824 | } |
---|
[608] | 825 | |
---|
| 826 | m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) ); |
---|
| 827 | |
---|
| 828 | // clear UV |
---|
| 829 | UInt uiStrideC = m_ppcYuvReco[uiDepth]->getCStride(); |
---|
| 830 | Pel *pRecCb = m_ppcYuvReco[uiDepth]->getCbAddr(); |
---|
| 831 | Pel *pRecCr = m_ppcYuvReco[uiDepth]->getCrAddr(); |
---|
| 832 | |
---|
| 833 | for (Int y = 0; y < uiHeight/2; y++) |
---|
| 834 | { |
---|
| 835 | for (Int x = 0; x < uiWidth/2; x++) |
---|
| 836 | { |
---|
| 837 | pRecCb[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) ); |
---|
| 838 | pRecCr[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) ); |
---|
| 839 | } |
---|
| 840 | |
---|
| 841 | pRecCb += uiStrideC; |
---|
| 842 | pRecCr += uiStrideC; |
---|
| 843 | } |
---|
[2] | 844 | } |
---|
[608] | 845 | #endif |
---|
[2] | 846 | |
---|
[833] | 847 | #if H_3D_DBBP |
---|
| 848 | Void TDecCu::xReconInterDBBP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 849 | { |
---|
| 850 | AOF(!pcCU->getSlice()->getIsDepth()); |
---|
| 851 | AOF(!pcCU->getSlice()->isIntra()); |
---|
| 852 | PartSize ePartSize = pcCU->getPartitionSize( 0 ); |
---|
| 853 | |
---|
| 854 | // get collocated depth block |
---|
| 855 | UInt uiDepthStride = 0; |
---|
[1084] | 856 | #if H_3D_FCO |
---|
[1066] | 857 | Pel* pDepthPels = pcCU->getVirtualDepthBlock(pcCU->getZorderIdxInCU(), pcCU->getWidth(0), pcCU->getHeight(0), uiDepthStride); |
---|
| 858 | #else |
---|
[833] | 859 | Pel* pDepthPels = pcCU->getVirtualDepthBlock(0, pcCU->getWidth(0), pcCU->getHeight(0), uiDepthStride); |
---|
[1066] | 860 | #endif |
---|
[833] | 861 | AOF( pDepthPels != NULL ); |
---|
| 862 | AOF( uiDepthStride != 0 ); |
---|
| 863 | |
---|
| 864 | // compute mask by segmenting depth block |
---|
| 865 | Bool pMask[MAX_CU_SIZE*MAX_CU_SIZE]; |
---|
[1179] | 866 | Bool bValidMask = m_pcPrediction->getSegmentMaskFromDepth(pDepthPels, uiDepthStride, pcCU->getWidth(0), pcCU->getHeight(0), pMask, pcCU); |
---|
[833] | 867 | AOF(bValidMask); |
---|
| 868 | |
---|
[1196] | 869 | DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData(); |
---|
[833] | 870 | TComYuv* apSegPredYuv[2] = { m_ppcYuvReco[uiDepth], m_ppcYuvRecoDBBP[uiDepth] }; |
---|
| 871 | |
---|
| 872 | // first, extract the two sets of motion parameters |
---|
| 873 | UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4; |
---|
| 874 | for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) |
---|
| 875 | { |
---|
| 876 | UInt uiPartAddr = uiSegment*uiPUOffset; |
---|
| 877 | |
---|
| 878 | pDBBPTmpData->auhInterDir[uiSegment] = pcCU->getInterDir(uiPartAddr); |
---|
| 879 | |
---|
| 880 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
| 881 | { |
---|
| 882 | RefPicList eRefList = (RefPicList)uiRefListIdx; |
---|
| 883 | pcCU->getMvField(pcCU, uiPartAddr, eRefList, pDBBPTmpData->acMvField[uiSegment][eRefList]); |
---|
| 884 | } |
---|
| 885 | |
---|
[950] | 886 | AOF( pcCU->getARPW(uiPartAddr) == 0 ); |
---|
| 887 | AOF( pcCU->getICFlag(uiPartAddr) == false ); |
---|
| 888 | AOF( pcCU->getSPIVMPFlag(uiPartAddr) == false ); |
---|
| 889 | AOF( pcCU->getVSPFlag(uiPartAddr) == 0 ); |
---|
[833] | 890 | } |
---|
| 891 | |
---|
| 892 | // do motion compensation for each segment as 2Nx2N |
---|
| 893 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); |
---|
| 894 | pcCU->setPredModeSubParts( MODE_INTER, 0, uiDepth ); |
---|
| 895 | for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) |
---|
| 896 | { |
---|
| 897 | pcCU->setInterDirSubParts( pDBBPTmpData->auhInterDir[uiSegment], 0, 0, uiDepth ); |
---|
[976] | 898 | |
---|
[833] | 899 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
| 900 | { |
---|
| 901 | RefPicList eRefList = (RefPicList)uiRefListIdx; |
---|
| 902 | |
---|
| 903 | pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], SIZE_2Nx2N, 0, 0 ); |
---|
| 904 | } |
---|
| 905 | |
---|
| 906 | // inter prediction |
---|
| 907 | m_pcPrediction->motionCompensation( pcCU, apSegPredYuv[uiSegment] ); |
---|
| 908 | } |
---|
| 909 | |
---|
| 910 | // restore motion information in both segments again |
---|
| 911 | pcCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); |
---|
| 912 | pcCU->setPredModeSubParts( MODE_INTER, 0, uiDepth ); |
---|
| 913 | for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) |
---|
| 914 | { |
---|
| 915 | UInt uiPartAddr = uiSegment*uiPUOffset; |
---|
| 916 | |
---|
| 917 | pcCU->setDBBPFlagSubParts(true, uiPartAddr, uiSegment, uiDepth); |
---|
| 918 | pcCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[uiSegment], uiPartAddr, uiSegment, uiDepth); // interprets depth relative to LCU level |
---|
| 919 | |
---|
| 920 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
| 921 | { |
---|
| 922 | RefPicList eRefList = (RefPicList)uiRefListIdx; |
---|
| 923 | |
---|
| 924 | pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], ePartSize, uiPartAddr, 0, uiSegment ); // interprets depth relative to rpcTempCU level |
---|
| 925 | } |
---|
| 926 | } |
---|
| 927 | |
---|
| 928 | // reconstruct final prediction signal by combining both segments |
---|
[1039] | 929 | m_pcPrediction->combineSegmentsWithMask(apSegPredYuv, m_ppcYuvReco[uiDepth], pMask, pcCU->getWidth(0), pcCU->getHeight(0), 0, ePartSize); |
---|
[1084] | 930 | |
---|
[833] | 931 | // inter recon |
---|
| 932 | xDecodeInterTexture( pcCU, 0, uiDepth ); |
---|
| 933 | |
---|
| 934 | // clip for only non-zero cbp case |
---|
| 935 | if ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V ) ) ) |
---|
| 936 | { |
---|
| 937 | m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) ); |
---|
| 938 | } |
---|
| 939 | else |
---|
| 940 | { |
---|
| 941 | m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 )); |
---|
| 942 | } |
---|
| 943 | } |
---|
| 944 | #endif |
---|
| 945 | |
---|
[1200] | 946 | |
---|
[2] | 947 | Void |
---|
[1200] | 948 | TDecCu::xIntraRecBlk( TComYuv* pcRecoYuv, |
---|
| 949 | TComYuv* pcPredYuv, |
---|
| 950 | TComYuv* pcResiYuv, |
---|
| 951 | const ComponentID compID, |
---|
| 952 | TComTU &rTu) |
---|
[2] | 953 | { |
---|
[1200] | 954 | if (!rTu.ProcessComponentSection(compID)) |
---|
| 955 | { |
---|
| 956 | return; |
---|
| 957 | } |
---|
| 958 | const Bool bIsLuma = isLuma(compID); |
---|
| 959 | |
---|
| 960 | |
---|
| 961 | TComDataCU *pcCU = rTu.getCU(); |
---|
| 962 | const TComSPS &sps=*(pcCU->getSlice()->getSPS()); |
---|
| 963 | const UInt uiAbsPartIdx=rTu.GetAbsPartIdxTU(); |
---|
| 964 | |
---|
| 965 | const TComRectangle &tuRect =rTu.getRect(compID); |
---|
| 966 | const UInt uiWidth = tuRect.width; |
---|
| 967 | const UInt uiHeight = tuRect.height; |
---|
| 968 | const UInt uiStride = pcRecoYuv->getStride (compID); |
---|
| 969 | Pel* piPred = pcPredYuv->getAddr( compID, uiAbsPartIdx ); |
---|
| 970 | const ChromaFormat chFmt = rTu.GetChromaFormat(); |
---|
| 971 | |
---|
| 972 | if (uiWidth != uiHeight) |
---|
| 973 | { |
---|
| 974 | //------------------------------------------------ |
---|
| 975 | |
---|
| 976 | //split at current level if dividing into square sub-TUs |
---|
| 977 | |
---|
| 978 | TComTURecurse subTURecurse(rTu, false, TComTU::VERTICAL_SPLIT, true, compID); |
---|
| 979 | |
---|
| 980 | //recurse further |
---|
| 981 | do |
---|
| 982 | { |
---|
| 983 | xIntraRecBlk(pcRecoYuv, pcPredYuv, pcResiYuv, compID, subTURecurse); |
---|
| 984 | } while (subTURecurse.nextSection(rTu)); |
---|
| 985 | |
---|
| 986 | //------------------------------------------------ |
---|
| 987 | |
---|
| 988 | return; |
---|
| 989 | } |
---|
| 990 | |
---|
| 991 | const UInt uiChPredMode = pcCU->getIntraDir( toChannelType(compID), uiAbsPartIdx ); |
---|
| 992 | const UInt partsPerMinCU = 1<<(2*(sps.getMaxTotalCUDepth() - sps.getLog2DiffMaxMinCodingBlockSize())); |
---|
| 993 | const UInt uiChCodedMode = (uiChPredMode==DM_CHROMA_IDX && !bIsLuma) ? pcCU->getIntraDir(CHANNEL_TYPE_LUMA, getChromasCorrespondingPULumaIdx(uiAbsPartIdx, chFmt, partsPerMinCU)) : uiChPredMode; |
---|
| 994 | const UInt uiChFinalMode = ((chFmt == CHROMA_422) && !bIsLuma) ? g_chroma422IntraAngleMappingTable[uiChCodedMode] : uiChCodedMode; |
---|
| 995 | |
---|
[2] | 996 | //===== init availability pattern ===== |
---|
| 997 | Bool bAboveAvail = false; |
---|
| 998 | Bool bLeftAvail = false; |
---|
[1200] | 999 | |
---|
| 1000 | const Bool bUseFilteredPredictions=TComPrediction::filteringIntraReferenceSamples(compID, uiChFinalMode, uiWidth, uiHeight, chFmt, pcCU->getSlice()->getSPS()->getSpsRangeExtension().getIntraSmoothingDisabledFlag()); |
---|
| 1001 | |
---|
| 1002 | #if DEBUG_STRING |
---|
| 1003 | std::ostream &ss(std::cout); |
---|
| 1004 | #endif |
---|
| 1005 | |
---|
| 1006 | DEBUG_STRING_NEW(sTemp) |
---|
| 1007 | m_pcPrediction->initIntraPatternChType( rTu, bAboveAvail, bLeftAvail, compID, bUseFilteredPredictions DEBUG_STRING_PASS_INTO(sTemp) ); |
---|
| 1008 | |
---|
| 1009 | |
---|
[56] | 1010 | //===== get prediction signal ===== |
---|
[608] | 1011 | #if H_3D_DIM |
---|
| 1012 | if( isDimMode( uiLumaPredMode ) ) |
---|
[2] | 1013 | { |
---|
[608] | 1014 | m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight ); |
---|
| 1015 | } |
---|
[2] | 1016 | else |
---|
[56] | 1017 | { |
---|
[2] | 1018 | #endif |
---|
[1200] | 1019 | |
---|
| 1020 | m_pcPrediction->predIntraAng( compID, uiChFinalMode, 0 /* Decoder does not have an original image */, 0, piPred, uiStride, rTu, bAboveAvail, bLeftAvail, bUseFilteredPredictions ); |
---|
[608] | 1021 | #if H_3D_DIM |
---|
[2] | 1022 | } |
---|
[56] | 1023 | #endif |
---|
[1200] | 1024 | |
---|
| 1025 | #if DEBUG_STRING |
---|
| 1026 | ss << sTemp; |
---|
| 1027 | #endif |
---|
| 1028 | |
---|
| 1029 | //===== inverse transform ===== |
---|
| 1030 | Pel* piResi = pcResiYuv->getAddr( compID, uiAbsPartIdx ); |
---|
| 1031 | TCoeff* pcCoeff = pcCU->getCoeff(compID) + rTu.getCoefficientOffset(compID);//( uiNumCoeffInc * uiAbsPartIdx ); |
---|
| 1032 | |
---|
| 1033 | const QpParam cQP(*pcCU, compID); |
---|
| 1034 | |
---|
| 1035 | |
---|
| 1036 | DEBUG_STRING_NEW(sDebug); |
---|
| 1037 | #if DEBUG_STRING |
---|
| 1038 | const Int debugPredModeMask=DebugStringGetPredModeMask(MODE_INTRA); |
---|
| 1039 | std::string *psDebug=(DebugOptionList::DebugString_InvTran.getInt()&debugPredModeMask) ? &sDebug : 0; |
---|
| 1040 | #endif |
---|
[884] | 1041 | #if H_3D |
---|
[872] | 1042 | Bool useDltFlag = (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()); |
---|
| 1043 | |
---|
| 1044 | if ( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth ) || useDltFlag ) |
---|
| 1045 | #else |
---|
[1200] | 1046 | if (pcCU->getCbf(uiAbsPartIdx, compID, rTu.GetTransformDepthRel()) != 0) |
---|
[872] | 1047 | #endif |
---|
| 1048 | { |
---|
[1200] | 1049 | m_pcTrQuant->invTransformNxN( rTu, compID, piResi, uiStride, pcCoeff, cQP DEBUG_STRING_PASS_INTO(psDebug) ); |
---|
[2] | 1050 | } |
---|
[872] | 1051 | else |
---|
| 1052 | { |
---|
[1200] | 1053 | for (UInt y = 0; y < uiHeight; y++) |
---|
[872] | 1054 | { |
---|
[1200] | 1055 | for (UInt x = 0; x < uiWidth; x++) |
---|
[872] | 1056 | { |
---|
[1200] | 1057 | piResi[(y * uiStride) + x] = 0; |
---|
[872] | 1058 | } |
---|
| 1059 | } |
---|
| 1060 | } |
---|
[2] | 1061 | |
---|
[1200] | 1062 | #if DEBUG_STRING |
---|
| 1063 | if (psDebug) |
---|
[2] | 1064 | { |
---|
[1200] | 1065 | ss << (*psDebug); |
---|
[2] | 1066 | } |
---|
[1200] | 1067 | #endif |
---|
[1124] | 1068 | |
---|
[1200] | 1069 | //===== reconstruction ===== |
---|
| 1070 | const UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride(compID); |
---|
[1124] | 1071 | |
---|
[1200] | 1072 | const Bool useCrossComponentPrediction = isChroma(compID) && (pcCU->getCrossComponentPredictionAlpha(uiAbsPartIdx, compID) != 0); |
---|
| 1073 | const Pel* pResiLuma = pcResiYuv->getAddr( COMPONENT_Y, uiAbsPartIdx ); |
---|
| 1074 | const Int strideLuma = pcResiYuv->getStride( COMPONENT_Y ); |
---|
[1124] | 1075 | |
---|
[1200] | 1076 | Pel* pPred = piPred; |
---|
| 1077 | Pel* pResi = piResi; |
---|
| 1078 | Pel* pReco = pcRecoYuv->getAddr( compID, uiAbsPartIdx ); |
---|
| 1079 | Pel* pRecIPred = pcCU->getPic()->getPicYuvRec()->getAddr( compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiAbsPartIdx ); |
---|
[1124] | 1080 | |
---|
[56] | 1081 | |
---|
[1200] | 1082 | #if DEBUG_STRING |
---|
| 1083 | const Bool bDebugPred=((DebugOptionList::DebugString_Pred.getInt()&debugPredModeMask) && DEBUG_STRING_CHANNEL_CONDITION(compID)); |
---|
| 1084 | const Bool bDebugResi=((DebugOptionList::DebugString_Resi.getInt()&debugPredModeMask) && DEBUG_STRING_CHANNEL_CONDITION(compID)); |
---|
| 1085 | const Bool bDebugReco=((DebugOptionList::DebugString_Reco.getInt()&debugPredModeMask) && DEBUG_STRING_CHANNEL_CONDITION(compID)); |
---|
| 1086 | if (bDebugPred || bDebugResi || bDebugReco) |
---|
| 1087 | { |
---|
| 1088 | ss << "###: " << "CompID: " << compID << " pred mode (ch/fin): " << uiChPredMode << "/" << uiChFinalMode << " absPartIdx: " << rTu.GetAbsPartIdxTU() << std::endl; |
---|
| 1089 | } |
---|
| 1090 | #endif |
---|
[1124] | 1091 | |
---|
[1200] | 1092 | const Int clipbd = sps.getBitDepth(toChannelType(compID)); |
---|
| 1093 | #if O0043_BEST_EFFORT_DECODING |
---|
| 1094 | const Int bitDepthDelta = sps.getStreamBitDepth(toChannelType(compID)) - clipbd; |
---|
| 1095 | #endif |
---|
| 1096 | |
---|
| 1097 | if( useCrossComponentPrediction ) |
---|
[2] | 1098 | { |
---|
[1200] | 1099 | TComTrQuant::crossComponentPrediction( rTu, compID, pResiLuma, piResi, piResi, uiWidth, uiHeight, strideLuma, uiStride, uiStride, true ); |
---|
[2] | 1100 | } |
---|
| 1101 | |
---|
[1200] | 1102 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
[872] | 1103 | { |
---|
[1200] | 1104 | #if DEBUG_STRING |
---|
| 1105 | if (bDebugPred || bDebugResi || bDebugReco) |
---|
[1124] | 1106 | { |
---|
[1200] | 1107 | ss << "###: "; |
---|
[1124] | 1108 | } |
---|
[1200] | 1109 | |
---|
| 1110 | if (bDebugPred) |
---|
[1124] | 1111 | { |
---|
[1200] | 1112 | ss << " - pred: "; |
---|
| 1113 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
| 1114 | { |
---|
| 1115 | ss << pPred[ uiX ] << ", "; |
---|
| 1116 | } |
---|
[1124] | 1117 | } |
---|
[1200] | 1118 | if (bDebugResi) |
---|
| 1119 | { |
---|
| 1120 | ss << " - resi: "; |
---|
| 1121 | } |
---|
| 1122 | #endif |
---|
[2] | 1123 | |
---|
[1200] | 1124 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
[2] | 1125 | { |
---|
[1200] | 1126 | #if DEBUG_STRING |
---|
| 1127 | if (bDebugResi) |
---|
[1124] | 1128 | { |
---|
[1200] | 1129 | ss << pResi[ uiX ] << ", "; |
---|
[1124] | 1130 | } |
---|
[1200] | 1131 | #endif |
---|
| 1132 | #if O0043_BEST_EFFORT_DECODING |
---|
| 1133 | pReco [ uiX ] = ClipBD( rightShiftEvenRounding<Pel>(pPred[ uiX ] + pResi[ uiX ], bitDepthDelta), clipbd ); |
---|
| 1134 | #else |
---|
| 1135 | pReco [ uiX ] = ClipBD( pPred[ uiX ] + pResi[ uiX ], clipbd ); |
---|
| 1136 | #endif |
---|
| 1137 | pRecIPred[ uiX ] = pReco[ uiX ]; |
---|
[2] | 1138 | } |
---|
[1200] | 1139 | #if DEBUG_STRING |
---|
| 1140 | if (bDebugReco) |
---|
[872] | 1141 | { |
---|
[1200] | 1142 | ss << " - reco: "; |
---|
| 1143 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
[872] | 1144 | { |
---|
[1200] | 1145 | ss << pReco[ uiX ] << ", "; |
---|
[872] | 1146 | } |
---|
[1200] | 1147 | } |
---|
| 1148 | |
---|
| 1149 | if (bDebugPred || bDebugResi || bDebugReco) |
---|
| 1150 | { |
---|
| 1151 | ss << "\n"; |
---|
| 1152 | } |
---|
| 1153 | #endif |
---|
| 1154 | pPred += uiStride; |
---|
| 1155 | pResi += uiStride; |
---|
| 1156 | pReco += uiStride; |
---|
| 1157 | pRecIPred += uiRecIPredStride; |
---|
[872] | 1158 | } |
---|
| 1159 | } |
---|
[1200] | 1160 | #if H_3D_DIM |
---|
| 1161 | mapDepthModeToIntraDir( uiChromaPredMode ); |
---|
| 1162 | #endif |
---|
[2] | 1163 | |
---|
| 1164 | |
---|
| 1165 | Void |
---|
[608] | 1166 | TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiDepth ) |
---|
[2] | 1167 | { |
---|
[56] | 1168 | if (pcCU->getIPCMFlag(0)) |
---|
| 1169 | { |
---|
[608] | 1170 | xReconPCM( pcCU, uiDepth ); |
---|
[56] | 1171 | return; |
---|
| 1172 | } |
---|
[1200] | 1173 | const UInt numChType = pcCU->getPic()->getChromaFormat()!=CHROMA_400 ? 2 : 1; |
---|
| 1174 | for (UInt chType=CHANNEL_TYPE_LUMA; chType<numChType; chType++) |
---|
[2] | 1175 | { |
---|
[1200] | 1176 | const ChannelType chanType=ChannelType(chType); |
---|
| 1177 | const Bool NxNPUHas4Parts = ::isChroma(chanType) ? enable4ChromaPUsInIntraNxNCU(pcCU->getPic()->getChromaFormat()) : true; |
---|
| 1178 | const UInt uiInitTrDepth = ( pcCU->getPartitionSize(0) != SIZE_2Nx2N && NxNPUHas4Parts ? 1 : 0 ); |
---|
[2] | 1179 | |
---|
[1200] | 1180 | TComTURecurse tuRecurseCU(pcCU, 0); |
---|
| 1181 | TComTURecurse tuRecurseWithPU(tuRecurseCU, false, (uiInitTrDepth==0)?TComTU::DONT_SPLIT : TComTU::QUAD_SPLIT); |
---|
| 1182 | |
---|
| 1183 | do |
---|
| 1184 | { |
---|
| 1185 | xIntraRecQT( m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], chanType, tuRecurseWithPU ); |
---|
| 1186 | } while (tuRecurseWithPU.nextSection(tuRecurseCU)); |
---|
[2] | 1187 | } |
---|
| 1188 | } |
---|
| 1189 | |
---|
[608] | 1190 | #if H_3D_DIM_SDC |
---|
[189] | 1191 | Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 1192 | { |
---|
| 1193 | UInt uiWidth = pcCU->getWidth ( 0 ); |
---|
| 1194 | UInt uiHeight = pcCU->getHeight ( 0 ); |
---|
[833] | 1195 | TComWedgelet* dmm4SegmentationOrg = new TComWedgelet( uiWidth, uiHeight ); |
---|
| 1196 | UInt numParts = 1; |
---|
| 1197 | UInt sdcDepth = 0; |
---|
| 1198 | TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth]; |
---|
| 1199 | TComYuv* pcPredYuv = m_ppcYuvReco[uiDepth]; |
---|
| 1200 | TComYuv* pcResiYuv = m_ppcYuvResi[uiDepth]; |
---|
| 1201 | |
---|
| 1202 | UInt uiStride = 0; |
---|
| 1203 | Pel* piReco; |
---|
| 1204 | Pel* piPred; |
---|
| 1205 | Pel* piResi; |
---|
| 1206 | |
---|
| 1207 | UInt uiZOrder; |
---|
| 1208 | Pel* piRecIPred; |
---|
| 1209 | UInt uiRecIPredStride; |
---|
| 1210 | |
---|
| 1211 | UInt uiLumaPredMode = 0; |
---|
| 1212 | |
---|
| 1213 | if ((uiWidth >> pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize()) > 1) |
---|
| 1214 | { |
---|
| 1215 | numParts = uiWidth * uiWidth >> (2 * pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize()); |
---|
| 1216 | sdcDepth = g_aucConvertToBit[uiWidth] + 2 - pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize(); |
---|
| 1217 | uiWidth = uiHeight = (1 << pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize()); |
---|
| 1218 | } |
---|
| 1219 | |
---|
[884] | 1220 | for ( Int i = 0; i < numParts; i++ ) |
---|
[833] | 1221 | { |
---|
| 1222 | uiStride = pcRecoYuv->getStride (); |
---|
| 1223 | piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 1224 | piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 1225 | piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); |
---|
[884] | 1226 | |
---|
[833] | 1227 | uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
| 1228 | piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); |
---|
| 1229 | uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); |
---|
| 1230 | |
---|
| 1231 | uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); |
---|
| 1232 | |
---|
| 1233 | AOF( uiWidth == uiHeight ); |
---|
[884] | 1234 | |
---|
| 1235 | //===== init availability pattern ===== |
---|
| 1236 | Bool bAboveAvail = false; |
---|
| 1237 | Bool bLeftAvail = false; |
---|
| 1238 | |
---|
| 1239 | pcCU->getPattern()->initPattern ( pcCU, sdcDepth, uiAbsPartIdx ); |
---|
| 1240 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, sdcDepth, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail ); |
---|
| 1241 | |
---|
| 1242 | TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight ); |
---|
| 1243 | //===== get prediction signal ===== |
---|
| 1244 | if( isDimMode( uiLumaPredMode ) ) |
---|
| 1245 | { |
---|
| 1246 | m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, false, dmm4Segmentation ); |
---|
| 1247 | Bool* dmm4PatternSplit = dmm4Segmentation->getPattern(); |
---|
| 1248 | Bool* dmm4PatternOrg = dmm4SegmentationOrg->getPattern(); |
---|
| 1249 | for( UInt k = 0; k < (uiWidth*uiHeight); k++ ) |
---|
| 1250 | { |
---|
| 1251 | dmm4PatternOrg[k+(uiAbsPartIdx<<4)] = dmm4PatternSplit[k]; |
---|
| 1252 | } |
---|
[833] | 1253 | } |
---|
[884] | 1254 | else |
---|
| 1255 | { |
---|
| 1256 | m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); |
---|
| 1257 | } |
---|
| 1258 | |
---|
[833] | 1259 | if ( numParts > 1 ) |
---|
| 1260 | { |
---|
| 1261 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
| 1262 | { |
---|
| 1263 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
| 1264 | { |
---|
| 1265 | piReco [ uiX ] = ClipY( piPred[ uiX ] ); |
---|
| 1266 | piRecIPred [ uiX ] = piReco[ uiX ]; |
---|
| 1267 | } |
---|
| 1268 | piPred += uiStride; |
---|
| 1269 | piReco += uiStride; |
---|
| 1270 | piRecIPred += uiRecIPredStride; |
---|
| 1271 | } |
---|
| 1272 | } |
---|
| 1273 | uiAbsPartIdx += ( (uiWidth * uiWidth) >> 4 ); |
---|
| 1274 | dmm4Segmentation->destroy(); delete dmm4Segmentation; |
---|
| 1275 | } |
---|
| 1276 | uiAbsPartIdx = 0; |
---|
[189] | 1277 | |
---|
[833] | 1278 | if ( numParts > 1 ) |
---|
| 1279 | { |
---|
| 1280 | uiWidth = pcCU->getWidth( 0 ); |
---|
| 1281 | uiHeight = pcCU->getHeight( 0 ); |
---|
| 1282 | } |
---|
| 1283 | piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 1284 | piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 1285 | piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 1286 | uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
| 1287 | piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); |
---|
| 1288 | uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); |
---|
[189] | 1289 | // number of segments depends on prediction mode |
---|
[608] | 1290 | UInt uiNumSegments = 1; |
---|
[189] | 1291 | Bool* pbMask = NULL; |
---|
| 1292 | UInt uiMaskStride = 0; |
---|
| 1293 | |
---|
[608] | 1294 | if( getDimType( uiLumaPredMode ) == DMM1_IDX ) |
---|
[189] | 1295 | { |
---|
[608] | 1296 | Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx); |
---|
[1039] | 1297 | |
---|
| 1298 | WedgeList* pacWedgeList = pcCU->isDMM1UpscaleMode(uiWidth) ? &g_dmmWedgeLists[(g_aucConvertToBit[pcCU->getDMM1BasePatternWidth(uiWidth)])] : &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])]; |
---|
[189] | 1299 | TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx )); |
---|
[1039] | 1300 | |
---|
[189] | 1301 | uiNumSegments = 2; |
---|
[1039] | 1302 | |
---|
| 1303 | pbMask = pcCU->isDMM1UpscaleMode( uiWidth ) ? pcWedgelet->getScaledPattern(uiWidth) : pcWedgelet->getPattern(); |
---|
| 1304 | uiMaskStride = pcCU->isDMM1UpscaleMode( uiWidth ) ? uiWidth : pcWedgelet->getStride(); |
---|
[189] | 1305 | } |
---|
[833] | 1306 | if( getDimType( uiLumaPredMode ) == DMM4_IDX ) |
---|
| 1307 | { |
---|
| 1308 | uiNumSegments = 2; |
---|
| 1309 | pbMask = dmm4SegmentationOrg->getPattern(); |
---|
| 1310 | uiMaskStride = dmm4SegmentationOrg->getStride(); |
---|
| 1311 | } |
---|
[189] | 1312 | // get DC prediction for each segment |
---|
| 1313 | Pel apDCPredValues[2]; |
---|
[950] | 1314 | if ( getDimType( uiLumaPredMode ) == DMM1_IDX || getDimType( uiLumaPredMode ) == DMM4_IDX ) |
---|
| 1315 | { |
---|
| 1316 | apDCPredValues[0] = pcCU->getDmmPredictor( 0 ); |
---|
| 1317 | apDCPredValues[1] = pcCU->getDmmPredictor( 1 ); |
---|
| 1318 | } |
---|
| 1319 | else |
---|
[976] | 1320 | { |
---|
| 1321 | m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode); |
---|
| 1322 | } |
---|
[189] | 1323 | |
---|
| 1324 | // reconstruct residual based on mask + DC residuals |
---|
| 1325 | Pel apDCResiValues[2]; |
---|
[608] | 1326 | for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ ) |
---|
[189] | 1327 | { |
---|
[608] | 1328 | #if H_3D_DIM_DLT |
---|
[758] | 1329 | Pel pPredIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); |
---|
| 1330 | Pel pResiIdx = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); |
---|
| 1331 | Pel pRecoValue = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx ); |
---|
| 1332 | |
---|
[608] | 1333 | apDCResiValues[uiSegment] = pRecoValue - apDCPredValues[uiSegment]; |
---|
| 1334 | #else |
---|
| 1335 | apDCResiValues[uiSegment] = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); |
---|
[443] | 1336 | #endif |
---|
[189] | 1337 | } |
---|
| 1338 | |
---|
| 1339 | //===== reconstruction ===== |
---|
| 1340 | Bool*pMask = pbMask; |
---|
| 1341 | Pel* pPred = piPred; |
---|
| 1342 | Pel* pResi = piResi; |
---|
| 1343 | Pel* pReco = piReco; |
---|
| 1344 | Pel* pRecIPred = piRecIPred; |
---|
| 1345 | |
---|
| 1346 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
| 1347 | { |
---|
| 1348 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
| 1349 | { |
---|
| 1350 | UChar ucSegment = pMask?(UChar)pMask[uiX]:0; |
---|
| 1351 | assert( ucSegment < uiNumSegments ); |
---|
| 1352 | |
---|
| 1353 | Pel pResiDC = apDCResiValues[ucSegment]; |
---|
| 1354 | |
---|
[608] | 1355 | pReco [ uiX ] = ClipY( pPred[ uiX ] + pResiDC ); |
---|
[189] | 1356 | pRecIPred[ uiX ] = pReco[ uiX ]; |
---|
| 1357 | } |
---|
| 1358 | pPred += uiStride; |
---|
| 1359 | pResi += uiStride; |
---|
| 1360 | pReco += uiStride; |
---|
| 1361 | pRecIPred += uiRecIPredStride; |
---|
| 1362 | pMask += uiMaskStride; |
---|
| 1363 | } |
---|
| 1364 | |
---|
| 1365 | // clear UV |
---|
| 1366 | UInt uiStrideC = pcPredYuv->getCStride(); |
---|
| 1367 | Pel *pRecCb = pcPredYuv->getCbAddr(); |
---|
| 1368 | Pel *pRecCr = pcPredYuv->getCrAddr(); |
---|
| 1369 | |
---|
| 1370 | for (Int y=0; y<uiHeight/2; y++) |
---|
| 1371 | { |
---|
| 1372 | for (Int x=0; x<uiWidth/2; x++) |
---|
| 1373 | { |
---|
[608] | 1374 | pRecCb[x] = 128; |
---|
| 1375 | pRecCr[x] = 128; |
---|
[189] | 1376 | } |
---|
| 1377 | |
---|
| 1378 | pRecCb += uiStrideC; |
---|
| 1379 | pRecCr += uiStrideC; |
---|
| 1380 | } |
---|
[833] | 1381 | dmm4SegmentationOrg->destroy(); delete dmm4SegmentationOrg; |
---|
[189] | 1382 | } |
---|
| 1383 | #endif |
---|
| 1384 | |
---|
[1200] | 1385 | |
---|
| 1386 | /** Function for deriving reconstructed PU/CU chroma samples with QTree structure |
---|
[2] | 1387 | * \param pcRecoYuv pointer to reconstructed sample arrays |
---|
| 1388 | * \param pcPredYuv pointer to prediction sample arrays |
---|
| 1389 | * \param pcResiYuv pointer to residue sample arrays |
---|
[1200] | 1390 | * \param chType texture channel type (luma/chroma) |
---|
| 1391 | * \param rTu reference to transform data |
---|
| 1392 | * |
---|
| 1393 | \ This function derives reconstructed PU/CU chroma samples with QTree recursive structure |
---|
[2] | 1394 | */ |
---|
[1200] | 1395 | |
---|
[2] | 1396 | Void |
---|
[1200] | 1397 | TDecCu::xIntraRecQT(TComYuv* pcRecoYuv, |
---|
| 1398 | TComYuv* pcPredYuv, |
---|
| 1399 | TComYuv* pcResiYuv, |
---|
| 1400 | const ChannelType chType, |
---|
| 1401 | TComTU &rTu) |
---|
[2] | 1402 | { |
---|
[1200] | 1403 | UInt uiTrDepth = rTu.GetTransformDepthRel(); |
---|
| 1404 | TComDataCU *pcCU = rTu.getCU(); |
---|
| 1405 | UInt uiAbsPartIdx = rTu.GetAbsPartIdxTU(); |
---|
[2] | 1406 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
---|
| 1407 | if( uiTrMode == uiTrDepth ) |
---|
| 1408 | { |
---|
[1200] | 1409 | if (isLuma(chType)) |
---|
[2] | 1410 | { |
---|
[1200] | 1411 | xIntraRecBlk( pcRecoYuv, pcPredYuv, pcResiYuv, COMPONENT_Y, rTu ); |
---|
[2] | 1412 | } |
---|
[1200] | 1413 | else |
---|
| 1414 | { |
---|
| 1415 | const UInt numValidComp=getNumberValidComponents(rTu.GetChromaFormat()); |
---|
| 1416 | for(UInt compID=COMPONENT_Cb; compID<numValidComp; compID++) |
---|
| 1417 | { |
---|
| 1418 | xIntraRecBlk( pcRecoYuv, pcPredYuv, pcResiYuv, ComponentID(compID), rTu ); |
---|
| 1419 | } |
---|
| 1420 | } |
---|
[2] | 1421 | } |
---|
| 1422 | else |
---|
| 1423 | { |
---|
[1200] | 1424 | TComTURecurse tuRecurseChild(rTu, false); |
---|
| 1425 | do |
---|
[2] | 1426 | { |
---|
[1200] | 1427 | xIntraRecQT( pcRecoYuv, pcPredYuv, pcResiYuv, chType, tuRecurseChild ); |
---|
| 1428 | } while (tuRecurseChild.nextSection(rTu)); |
---|
[2] | 1429 | } |
---|
| 1430 | } |
---|
| 1431 | |
---|
| 1432 | Void TDecCu::xCopyToPic( TComDataCU* pcCU, TComPic* pcPic, UInt uiZorderIdx, UInt uiDepth ) |
---|
| 1433 | { |
---|
[1200] | 1434 | UInt uiCtuRsAddr = pcCU->getCtuRsAddr(); |
---|
| 1435 | |
---|
| 1436 | m_ppcYuvReco[uiDepth]->copyToPicYuv ( pcPic->getPicYuvRec (), uiCtuRsAddr, uiZorderIdx ); |
---|
| 1437 | |
---|
[2] | 1438 | return; |
---|
| 1439 | } |
---|
| 1440 | |
---|
[1200] | 1441 | Void TDecCu::xDecodeInterTexture ( TComDataCU* pcCU, UInt uiDepth ) |
---|
[2] | 1442 | { |
---|
[56] | 1443 | |
---|
[1200] | 1444 | TComTURecurse tuRecur(pcCU, 0, uiDepth); |
---|
[56] | 1445 | |
---|
[1200] | 1446 | for(UInt ch=0; ch<pcCU->getPic()->getNumberValidComponents(); ch++) |
---|
| 1447 | { |
---|
| 1448 | const ComponentID compID=ComponentID(ch); |
---|
| 1449 | DEBUG_STRING_OUTPUT(std::cout, debug_reorder_data_inter_token[compID]) |
---|
[56] | 1450 | |
---|
[1200] | 1451 | m_pcTrQuant->invRecurTransformNxN ( compID, m_ppcYuvResi[uiDepth], tuRecur ); |
---|
| 1452 | } |
---|
[56] | 1453 | |
---|
[1200] | 1454 | DEBUG_STRING_OUTPUT(std::cout, debug_reorder_data_inter_token[MAX_NUM_COMPONENT]) |
---|
[2] | 1455 | } |
---|
| 1456 | |
---|
[56] | 1457 | /** Function for deriving reconstructed luma/chroma samples of a PCM mode CU. |
---|
| 1458 | * \param pcCU pointer to current CU |
---|
| 1459 | * \param uiPartIdx part index |
---|
| 1460 | * \param piPCM pointer to PCM code arrays |
---|
| 1461 | * \param piReco pointer to reconstructed sample arrays |
---|
| 1462 | * \param uiStride stride of reconstructed sample arrays |
---|
| 1463 | * \param uiWidth CU width |
---|
| 1464 | * \param uiHeight CU height |
---|
[1200] | 1465 | * \param compID colour component ID |
---|
[56] | 1466 | * \returns Void |
---|
| 1467 | */ |
---|
[1200] | 1468 | Void TDecCu::xDecodePCMTexture( TComDataCU* pcCU, const UInt uiPartIdx, const Pel *piPCM, Pel* piReco, const UInt uiStride, const UInt uiWidth, const UInt uiHeight, const ComponentID compID) |
---|
[56] | 1469 | { |
---|
[1200] | 1470 | Pel* piPicReco = pcCU->getPic()->getPicYuvRec()->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu()+uiPartIdx); |
---|
| 1471 | const UInt uiPicStride = pcCU->getPic()->getPicYuvRec()->getStride(compID); |
---|
| 1472 | const TComSPS &sps = *(pcCU->getSlice()->getSPS()); |
---|
| 1473 | const UInt uiPcmLeftShiftBit = sps.getBitDepth(toChannelType(compID)) - sps.getPCMBitDepth(toChannelType(compID)); |
---|
[56] | 1474 | |
---|
[1200] | 1475 | for(UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
[56] | 1476 | { |
---|
[1200] | 1477 | for(UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
[56] | 1478 | { |
---|
| 1479 | piReco[uiX] = (piPCM[uiX] << uiPcmLeftShiftBit); |
---|
| 1480 | piPicReco[uiX] = piReco[uiX]; |
---|
| 1481 | } |
---|
| 1482 | piPCM += uiWidth; |
---|
| 1483 | piReco += uiStride; |
---|
| 1484 | piPicReco += uiPicStride; |
---|
| 1485 | } |
---|
| 1486 | } |
---|
| 1487 | |
---|
| 1488 | /** Function for reconstructing a PCM mode CU. |
---|
| 1489 | * \param pcCU pointer to current CU |
---|
| 1490 | * \param uiDepth CU Depth |
---|
| 1491 | * \returns Void |
---|
| 1492 | */ |
---|
[608] | 1493 | Void TDecCu::xReconPCM( TComDataCU* pcCU, UInt uiDepth ) |
---|
[56] | 1494 | { |
---|
[1200] | 1495 | const UInt maxCuWidth = pcCU->getSlice()->getSPS()->getMaxCUWidth(); |
---|
| 1496 | const UInt maxCuHeight = pcCU->getSlice()->getSPS()->getMaxCUHeight(); |
---|
| 1497 | for (UInt ch=0; ch < pcCU->getPic()->getNumberValidComponents(); ch++) |
---|
| 1498 | { |
---|
| 1499 | const ComponentID compID = ComponentID(ch); |
---|
| 1500 | const UInt width = (maxCuWidth >>(uiDepth+m_ppcYuvResi[uiDepth]->getComponentScaleX(compID))); |
---|
| 1501 | const UInt height = (maxCuHeight>>(uiDepth+m_ppcYuvResi[uiDepth]->getComponentScaleY(compID))); |
---|
| 1502 | const UInt stride = m_ppcYuvResi[uiDepth]->getStride(compID); |
---|
| 1503 | Pel * pPCMChannel = pcCU->getPCMSample(compID); |
---|
| 1504 | Pel * pRecChannel = m_ppcYuvReco[uiDepth]->getAddr(compID); |
---|
| 1505 | xDecodePCMTexture( pcCU, 0, pPCMChannel, pRecChannel, stride, width, height, compID ); |
---|
| 1506 | } |
---|
[56] | 1507 | } |
---|
| 1508 | |
---|
[1200] | 1509 | /** Function for filling the PCM buffer of a CU using its reconstructed sample array |
---|
| 1510 | * \param pCU pointer to current CU |
---|
| 1511 | * \param depth CU Depth |
---|
[56] | 1512 | */ |
---|
[608] | 1513 | Void TDecCu::xFillPCMBuffer(TComDataCU* pCU, UInt depth) |
---|
[56] | 1514 | { |
---|
[1200] | 1515 | const ChromaFormat format = pCU->getPic()->getChromaFormat(); |
---|
| 1516 | const UInt numValidComp = getNumberValidComponents(format); |
---|
| 1517 | const UInt maxCuWidth = pCU->getSlice()->getSPS()->getMaxCUWidth(); |
---|
| 1518 | const UInt maxCuHeight = pCU->getSlice()->getSPS()->getMaxCUHeight(); |
---|
[56] | 1519 | |
---|
[1200] | 1520 | for (UInt componentIndex = 0; componentIndex < numValidComp; componentIndex++) |
---|
[56] | 1521 | { |
---|
[1200] | 1522 | const ComponentID component = ComponentID(componentIndex); |
---|
[56] | 1523 | |
---|
[1200] | 1524 | const UInt width = maxCuWidth >> (depth + getComponentScaleX(component, format)); |
---|
| 1525 | const UInt height = maxCuHeight >> (depth + getComponentScaleY(component, format)); |
---|
[56] | 1526 | |
---|
[1200] | 1527 | Pel *source = m_ppcYuvReco[depth]->getAddr(component, 0, width); |
---|
| 1528 | Pel *destination = pCU->getPCMSample(component); |
---|
[56] | 1529 | |
---|
[1200] | 1530 | const UInt sourceStride = m_ppcYuvReco[depth]->getStride(component); |
---|
[56] | 1531 | |
---|
[1200] | 1532 | for (Int line = 0; line < height; line++) |
---|
[56] | 1533 | { |
---|
[1200] | 1534 | for (Int column = 0; column < width; column++) |
---|
| 1535 | { |
---|
| 1536 | destination[column] = source[column]; |
---|
| 1537 | } |
---|
| 1538 | |
---|
| 1539 | source += sourceStride; |
---|
| 1540 | destination += width; |
---|
[56] | 1541 | } |
---|
| 1542 | } |
---|
| 1543 | } |
---|
| 1544 | |
---|
| 1545 | //! \} |
---|