| 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-2015, ITU/ISO/IEC |
|---|
| 7 | * All rights reserved. |
|---|
| 8 | * |
|---|
| 9 | * Redistribution and use in source and binary forms, with or without |
|---|
| 10 | * modification, are permitted provided that the following conditions are met: |
|---|
| 11 | * |
|---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
|---|
| 13 | * this list of conditions and the following disclaimer. |
|---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
|---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
|---|
| 16 | * and/or other materials provided with the distribution. |
|---|
| 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
|---|
| 18 | * be used to endorse or promote products derived from this software without |
|---|
| 19 | * specific prior written permission. |
|---|
| 20 | * |
|---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
|---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
|---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
|---|
| 32 | */ |
|---|
| 33 | |
|---|
| 34 | /** \file TDecCu.cpp |
|---|
| 35 | \brief CU decoder class |
|---|
| 36 | */ |
|---|
| 37 | |
|---|
| 38 | #include "TDecCu.h" |
|---|
| 39 | |
|---|
| 40 | //! \ingroup TLibDecoder |
|---|
| 41 | //! \{ |
|---|
| 42 | |
|---|
| 43 | // ==================================================================================================================== |
|---|
| 44 | // Constructor / destructor / create / destroy |
|---|
| 45 | // ==================================================================================================================== |
|---|
| 46 | |
|---|
| 47 | TDecCu::TDecCu() |
|---|
| 48 | { |
|---|
| 49 | m_ppcYuvResi = NULL; |
|---|
| 50 | m_ppcYuvReco = NULL; |
|---|
| 51 | m_ppcCU = NULL; |
|---|
| 52 | #if H_3D_DBBP |
|---|
| 53 | m_ppcYuvRecoDBBP = NULL; |
|---|
| 54 | #endif |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | TDecCu::~TDecCu() |
|---|
| 58 | { |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | Void TDecCu::init( TDecEntropy* pcEntropyDecoder, TComTrQuant* pcTrQuant, TComPrediction* pcPrediction) |
|---|
| 62 | { |
|---|
| 63 | m_pcEntropyDecoder = pcEntropyDecoder; |
|---|
| 64 | m_pcTrQuant = pcTrQuant; |
|---|
| 65 | m_pcPrediction = pcPrediction; |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | /** |
|---|
| 69 | \param uiMaxDepth total number of allowable depth |
|---|
| 70 | \param uiMaxWidth largest CU width |
|---|
| 71 | \param uiMaxHeight largest CU height |
|---|
| 72 | */ |
|---|
| 73 | Void TDecCu::create( UInt uiMaxDepth, UInt uiMaxWidth, UInt uiMaxHeight ) |
|---|
| 74 | { |
|---|
| 75 | m_uiMaxDepth = uiMaxDepth+1; |
|---|
| 76 | |
|---|
| 77 | m_ppcYuvResi = new TComYuv*[m_uiMaxDepth-1]; |
|---|
| 78 | m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1]; |
|---|
| 79 | m_ppcCU = new TComDataCU*[m_uiMaxDepth-1]; |
|---|
| 80 | #if H_3D_DBBP |
|---|
| 81 | m_ppcYuvRecoDBBP = new TComYuv*[m_uiMaxDepth-1]; |
|---|
| 82 | #endif |
|---|
| 83 | |
|---|
| 84 | UInt uiNumPartitions; |
|---|
| 85 | for ( UInt ui = 0; ui < m_uiMaxDepth-1; ui++ ) |
|---|
| 86 | { |
|---|
| 87 | uiNumPartitions = 1<<( ( m_uiMaxDepth - ui - 1 )<<1 ); |
|---|
| 88 | UInt uiWidth = uiMaxWidth >> ui; |
|---|
| 89 | UInt uiHeight = uiMaxHeight >> ui; |
|---|
| 90 | |
|---|
| 91 | m_ppcYuvResi[ui] = new TComYuv; m_ppcYuvResi[ui]->create( uiWidth, uiHeight ); |
|---|
| 92 | m_ppcYuvReco[ui] = new TComYuv; m_ppcYuvReco[ui]->create( uiWidth, uiHeight ); |
|---|
| 93 | m_ppcCU [ui] = new TComDataCU; m_ppcCU [ui]->create( uiNumPartitions, uiWidth, uiHeight, true, uiMaxWidth >> (m_uiMaxDepth - 1) ); |
|---|
| 94 | #if H_3D_DBBP |
|---|
| 95 | m_ppcYuvRecoDBBP[ui] = new TComYuv; m_ppcYuvRecoDBBP[ui]->create( uiWidth, uiHeight ); |
|---|
| 96 | #endif |
|---|
| 97 | } |
|---|
| 98 | |
|---|
| 99 | m_bDecodeDQP = false; |
|---|
| 100 | |
|---|
| 101 | // initialize partition order. |
|---|
| 102 | UInt* piTmp = &g_auiZscanToRaster[0]; |
|---|
| 103 | initZscanToRaster(m_uiMaxDepth, 1, 0, piTmp); |
|---|
| 104 | initRasterToZscan( uiMaxWidth, uiMaxHeight, m_uiMaxDepth ); |
|---|
| 105 | |
|---|
| 106 | // initialize conversion matrix from partition index to pel |
|---|
| 107 | initRasterToPelXY( uiMaxWidth, uiMaxHeight, m_uiMaxDepth ); |
|---|
| 108 | } |
|---|
| 109 | |
|---|
| 110 | Void TDecCu::destroy() |
|---|
| 111 | { |
|---|
| 112 | for ( UInt ui = 0; ui < m_uiMaxDepth-1; ui++ ) |
|---|
| 113 | { |
|---|
| 114 | m_ppcYuvResi[ui]->destroy(); delete m_ppcYuvResi[ui]; m_ppcYuvResi[ui] = NULL; |
|---|
| 115 | m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL; |
|---|
| 116 | m_ppcCU [ui]->destroy(); delete m_ppcCU [ui]; m_ppcCU [ui] = NULL; |
|---|
| 117 | #if H_3D_DBBP |
|---|
| 118 | m_ppcYuvRecoDBBP[ui]->destroy(); delete m_ppcYuvRecoDBBP[ui]; m_ppcYuvRecoDBBP[ui] = NULL; |
|---|
| 119 | #endif |
|---|
| 120 | } |
|---|
| 121 | |
|---|
| 122 | delete [] m_ppcYuvResi; m_ppcYuvResi = NULL; |
|---|
| 123 | delete [] m_ppcYuvReco; m_ppcYuvReco = NULL; |
|---|
| 124 | delete [] m_ppcCU ; m_ppcCU = NULL; |
|---|
| 125 | #if H_3D_DBBP |
|---|
| 126 | delete [] m_ppcYuvRecoDBBP; m_ppcYuvRecoDBBP = NULL; |
|---|
| 127 | #endif |
|---|
| 128 | } |
|---|
| 129 | |
|---|
| 130 | // ==================================================================================================================== |
|---|
| 131 | // Public member functions |
|---|
| 132 | // ==================================================================================================================== |
|---|
| 133 | |
|---|
| 134 | /** \param pcCU pointer of CU data |
|---|
| 135 | \param ruiIsLast last data? |
|---|
| 136 | */ |
|---|
| 137 | Void TDecCu::decodeCU( TComDataCU* pcCU, UInt& ruiIsLast ) |
|---|
| 138 | { |
|---|
| 139 | if ( pcCU->getSlice()->getPPS()->getUseDQP() ) |
|---|
| 140 | { |
|---|
| 141 | setdQPFlag(true); |
|---|
| 142 | } |
|---|
| 143 | |
|---|
| 144 | // start from the top level CU |
|---|
| 145 | xDecodeCU( pcCU, 0, 0, ruiIsLast); |
|---|
| 146 | } |
|---|
| 147 | |
|---|
| 148 | /** \param pcCU pointer of CU data |
|---|
| 149 | */ |
|---|
| 150 | Void TDecCu::decompressCU( TComDataCU* pcCU ) |
|---|
| 151 | { |
|---|
| 152 | #if !H_3D_IV_MERGE |
|---|
| 153 | xDecompressCU( pcCU, 0, 0 ); |
|---|
| 154 | #endif |
|---|
| 155 | } |
|---|
| 156 | |
|---|
| 157 | // ==================================================================================================================== |
|---|
| 158 | // Protected member functions |
|---|
| 159 | // ==================================================================================================================== |
|---|
| 160 | |
|---|
| 161 | /**decode end-of-slice flag |
|---|
| 162 | * \param pcCU |
|---|
| 163 | * \param uiAbsPartIdx |
|---|
| 164 | * \param uiDepth |
|---|
| 165 | * \returns Bool |
|---|
| 166 | */ |
|---|
| 167 | Bool TDecCu::xDecodeSliceEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth) |
|---|
| 168 | { |
|---|
| 169 | UInt uiIsLast; |
|---|
| 170 | TComPic* pcPic = pcCU->getPic(); |
|---|
| 171 | TComSlice * pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx()); |
|---|
| 172 | UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1); |
|---|
| 173 | UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples(); |
|---|
| 174 | UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples(); |
|---|
| 175 | UInt uiGranularityWidth = g_uiMaxCUWidth; |
|---|
| 176 | UInt uiPosX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
|---|
| 177 | UInt uiPosY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
|---|
| 178 | |
|---|
| 179 | if(((uiPosX+pcCU->getWidth(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosX+pcCU->getWidth(uiAbsPartIdx)==uiWidth)) |
|---|
| 180 | &&((uiPosY+pcCU->getHeight(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosY+pcCU->getHeight(uiAbsPartIdx)==uiHeight))) |
|---|
| 181 | { |
|---|
| 182 | m_pcEntropyDecoder->decodeTerminatingBit( uiIsLast ); |
|---|
| 183 | } |
|---|
| 184 | else |
|---|
| 185 | { |
|---|
| 186 | uiIsLast=0; |
|---|
| 187 | } |
|---|
| 188 | |
|---|
| 189 | if(uiIsLast) |
|---|
| 190 | { |
|---|
| 191 | if(pcSlice->isNextSliceSegment()&&!pcSlice->isNextSlice()) |
|---|
| 192 | { |
|---|
| 193 | pcSlice->setSliceSegmentCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts); |
|---|
| 194 | } |
|---|
| 195 | else |
|---|
| 196 | { |
|---|
| 197 | pcSlice->setSliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts); |
|---|
| 198 | pcSlice->setSliceSegmentCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts); |
|---|
| 199 | } |
|---|
| 200 | } |
|---|
| 201 | |
|---|
| 202 | return uiIsLast>0; |
|---|
| 203 | } |
|---|
| 204 | |
|---|
| 205 | /** decode CU block recursively |
|---|
| 206 | * \param pcCU |
|---|
| 207 | * \param uiAbsPartIdx |
|---|
| 208 | * \param uiDepth |
|---|
| 209 | * \returns Void |
|---|
| 210 | */ |
|---|
| 211 | |
|---|
| 212 | Void TDecCu::xDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast) |
|---|
| 213 | { |
|---|
| 214 | TComPic* pcPic = pcCU->getPic(); |
|---|
| 215 | UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1); |
|---|
| 216 | UInt uiQNumParts = uiCurNumParts>>2; |
|---|
| 217 | |
|---|
| 218 | Bool bBoundary = false; |
|---|
| 219 | UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
|---|
| 220 | UInt uiRPelX = uiLPelX + (g_uiMaxCUWidth>>uiDepth) - 1; |
|---|
| 221 | UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
|---|
| 222 | UInt uiBPelY = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1; |
|---|
| 223 | #if H_MV_ENC_DEC_TRAC |
|---|
| 224 | DTRACE_CU_S("=========== coding_quadtree ===========\n") |
|---|
| 225 | DTRACE_CU("x0", uiLPelX) |
|---|
| 226 | DTRACE_CU("x1", uiTPelY) |
|---|
| 227 | DTRACE_CU("log2CbSize", g_uiMaxCUWidth>>uiDepth) |
|---|
| 228 | DTRACE_CU("cqtDepth" , uiDepth) |
|---|
| 229 | #endif |
|---|
| 230 | |
|---|
| 231 | TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx()); |
|---|
| 232 | Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr(); |
|---|
| 233 | if((!bStartInCU) && ( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) |
|---|
| 234 | { |
|---|
| 235 | m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 236 | } |
|---|
| 237 | else |
|---|
| 238 | { |
|---|
| 239 | bBoundary = true; |
|---|
| 240 | } |
|---|
| 241 | |
|---|
| 242 | if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ) |
|---|
| 243 | { |
|---|
| 244 | UInt uiIdx = uiAbsPartIdx; |
|---|
| 245 | if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
|---|
| 246 | { |
|---|
| 247 | setdQPFlag(true); |
|---|
| 248 | pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP |
|---|
| 249 | } |
|---|
| 250 | |
|---|
| 251 | for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ ) |
|---|
| 252 | { |
|---|
| 253 | uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; |
|---|
| 254 | uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; |
|---|
| 255 | |
|---|
| 256 | Bool bSubInSlice = pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr(); |
|---|
| 257 | if ( bSubInSlice ) |
|---|
| 258 | { |
|---|
| 259 | if ( !ruiIsLast && ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) ) |
|---|
| 260 | { |
|---|
| 261 | xDecodeCU( pcCU, uiIdx, uiDepth+1, ruiIsLast ); |
|---|
| 262 | } |
|---|
| 263 | else |
|---|
| 264 | { |
|---|
| 265 | pcCU->setOutsideCUPart( uiIdx, uiDepth+1 ); |
|---|
| 266 | } |
|---|
| 267 | } |
|---|
| 268 | |
|---|
| 269 | uiIdx += uiQNumParts; |
|---|
| 270 | } |
|---|
| 271 | if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
|---|
| 272 | { |
|---|
| 273 | if ( getdQPFlag() ) |
|---|
| 274 | { |
|---|
| 275 | UInt uiQPSrcPartIdx; |
|---|
| 276 | if ( pcPic->getCU( pcCU->getAddr() )->getSliceSegmentStartCU(uiAbsPartIdx) != pcSlice->getSliceSegmentCurStartCUAddr() ) |
|---|
| 277 | { |
|---|
| 278 | uiQPSrcPartIdx = pcSlice->getSliceSegmentCurStartCUAddr() % pcPic->getNumPartInCU(); |
|---|
| 279 | } |
|---|
| 280 | else |
|---|
| 281 | { |
|---|
| 282 | uiQPSrcPartIdx = uiAbsPartIdx; |
|---|
| 283 | } |
|---|
| 284 | pcCU->setQPSubParts( pcCU->getRefQP( uiQPSrcPartIdx ), uiAbsPartIdx, uiDepth ); // set QP to default QP |
|---|
| 285 | } |
|---|
| 286 | } |
|---|
| 287 | return; |
|---|
| 288 | } |
|---|
| 289 | |
|---|
| 290 | #if H_MV_ENC_DEC_TRAC |
|---|
| 291 | DTRACE_CU_S("=========== coding_unit ===========\n") |
|---|
| 292 | #if H_MV_ENC_DEC_TRAC |
|---|
| 293 | #if ENC_DEC_TRACE |
|---|
| 294 | stopAtPos ( pcCU->getSlice()->getPOC(), |
|---|
| 295 | pcCU->getSlice()->getLayerId(), |
|---|
| 296 | uiLPelX, |
|---|
| 297 | uiTPelY, |
|---|
| 298 | uiRPelX-uiLPelX+1, |
|---|
| 299 | uiBPelY-uiTPelY+1); |
|---|
| 300 | #endif |
|---|
| 301 | #endif |
|---|
| 302 | |
|---|
| 303 | #endif |
|---|
| 304 | |
|---|
| 305 | if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
|---|
| 306 | { |
|---|
| 307 | setdQPFlag(true); |
|---|
| 308 | pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP |
|---|
| 309 | } |
|---|
| 310 | #if H_3D_NBDV |
|---|
| 311 | DisInfo DvInfo; |
|---|
| 312 | #if !SEC_ARP_REM_ENC_RESTRICT_K0035 |
|---|
| 313 | DvInfo.bDV = false; |
|---|
| 314 | #endif |
|---|
| 315 | DvInfo.m_acNBDV.setZero(); |
|---|
| 316 | DvInfo.m_aVIdxCan = 0; |
|---|
| 317 | #if H_3D_NBDV_REF |
|---|
| 318 | DvInfo.m_acDoNBDV.setZero(); |
|---|
| 319 | #endif |
|---|
| 320 | |
|---|
| 321 | |
|---|
| 322 | if(!pcCU->getSlice()->isIntra()) |
|---|
| 323 | { |
|---|
| 324 | #if H_3D_ARP && H_3D_IV_MERGE |
|---|
| 325 | if( pcCU->getSlice()->getIvResPredFlag() || pcCU->getSlice()->getIvMvPredFlag() ) |
|---|
| 326 | #else |
|---|
| 327 | #if H_3D_ARP |
|---|
| 328 | if( pcCU->getSlice()->getVPS()->getUseAdvRP(pcCU->getSlice()->getLayerId()) ) |
|---|
| 329 | #else |
|---|
| 330 | #if H_3D_IV_MERGE |
|---|
| 331 | if( pcCU->getSlice()->getVPS()->getIvMvPredFlag(pcCU->getSlice()->getLayerId()) ) |
|---|
| 332 | #else |
|---|
| 333 | if (0) |
|---|
| 334 | #endif |
|---|
| 335 | #endif |
|---|
| 336 | #endif |
|---|
| 337 | { |
|---|
| 338 | m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true ); |
|---|
| 339 | m_ppcCU[uiDepth]->copyDVInfoFrom( pcCU, uiAbsPartIdx); |
|---|
| 340 | PartSize ePartTemp = m_ppcCU[uiDepth]->getPartitionSize(0); |
|---|
| 341 | UChar cWidTemp = m_ppcCU[uiDepth]->getWidth(0); |
|---|
| 342 | UChar cHeightTemp = m_ppcCU[uiDepth]->getHeight(0); |
|---|
| 343 | m_ppcCU[uiDepth]->setWidth ( 0, pcCU->getSlice()->getSPS()->getMaxCUWidth ()/(1<<uiDepth) ); |
|---|
| 344 | m_ppcCU[uiDepth]->setHeight ( 0, pcCU->getSlice()->getSPS()->getMaxCUHeight()/(1<<uiDepth) ); |
|---|
| 345 | m_ppcCU[uiDepth]->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); |
|---|
| 346 | #if H_3D_IV_MERGE |
|---|
| 347 | if( pcCU->getSlice()->getIsDepth()) |
|---|
| 348 | { |
|---|
| 349 | #if SEC_ARP_REM_ENC_RESTRICT_K0035 |
|---|
| 350 | m_ppcCU[uiDepth]->getDispforDepth(0, 0, &DvInfo); |
|---|
| 351 | #else |
|---|
| 352 | DvInfo.bDV = m_ppcCU[uiDepth]->getDispforDepth(0, 0, &DvInfo); |
|---|
| 353 | #endif |
|---|
| 354 | } |
|---|
| 355 | else |
|---|
| 356 | { |
|---|
| 357 | #endif |
|---|
| 358 | #if H_3D_NBDV_REF |
|---|
| 359 | if( pcCU->getSlice()->getDepthBasedBlkPartFlag() ) //Notes from QC: please check the condition for DoNBDV. Remove this comment once it is done. |
|---|
| 360 | { |
|---|
| 361 | #if SEC_ARP_REM_ENC_RESTRICT_K0035 |
|---|
| 362 | m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo, true); |
|---|
| 363 | #else |
|---|
| 364 | DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo, true); |
|---|
| 365 | #endif |
|---|
| 366 | } |
|---|
| 367 | else |
|---|
| 368 | #endif |
|---|
| 369 | { |
|---|
| 370 | #if SEC_ARP_REM_ENC_RESTRICT_K0035 |
|---|
| 371 | m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo); |
|---|
| 372 | #else |
|---|
| 373 | DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo); |
|---|
| 374 | #endif |
|---|
| 375 | } |
|---|
| 376 | #if H_3D_IV_MERGE |
|---|
| 377 | } |
|---|
| 378 | #endif |
|---|
| 379 | #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC |
|---|
| 380 | if ( g_decTraceDispDer ) |
|---|
| 381 | { |
|---|
| 382 | DTRACE_CU( "RefViewIdx", DvInfo.m_aVIdxCan ); |
|---|
| 383 | DTRACE_CU( "MvDisp[x]", DvInfo.m_acNBDV.getHor() ); |
|---|
| 384 | DTRACE_CU( "MvDisp[y]", DvInfo.m_acNBDV.getVer() ); |
|---|
| 385 | DTRACE_CU( "MvRefinedDisp[x]", DvInfo.m_acDoNBDV.getHor() ); |
|---|
| 386 | DTRACE_CU( "MvRefinedDisp[y]", DvInfo.m_acDoNBDV.getVer() ); |
|---|
| 387 | } |
|---|
| 388 | #endif |
|---|
| 389 | |
|---|
| 390 | pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth); |
|---|
| 391 | m_ppcCU[uiDepth]->setPartSizeSubParts( ePartTemp, 0, uiDepth ); |
|---|
| 392 | m_ppcCU[uiDepth]->setWidth ( 0, cWidTemp ); |
|---|
| 393 | m_ppcCU[uiDepth]->setHeight ( 0, cHeightTemp ); |
|---|
| 394 | } |
|---|
| 395 | } |
|---|
| 396 | #endif |
|---|
| 397 | if (pcCU->getSlice()->getPPS()->getTransquantBypassEnableFlag()) |
|---|
| 398 | { |
|---|
| 399 | m_pcEntropyDecoder->decodeCUTransquantBypassFlag( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 400 | } |
|---|
| 401 | |
|---|
| 402 | // decode CU mode and the partition size |
|---|
| 403 | if( !pcCU->getSlice()->isIntra()) |
|---|
| 404 | { |
|---|
| 405 | m_pcEntropyDecoder->decodeSkipFlag( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 406 | } |
|---|
| 407 | |
|---|
| 408 | if( pcCU->isSkipped(uiAbsPartIdx) ) |
|---|
| 409 | { |
|---|
| 410 | #if H_MV_ENC_DEC_TRAC |
|---|
| 411 | DTRACE_PU_S("=========== prediction_unit ===========\n") |
|---|
| 412 | DTRACE_PU("x0", uiLPelX) |
|---|
| 413 | DTRACE_PU("x1", uiTPelY) |
|---|
| 414 | #endif |
|---|
| 415 | m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); |
|---|
| 416 | m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); |
|---|
| 417 | #if H_3D_IV_MERGE |
|---|
| 418 | m_ppcCU[uiDepth]->copyDVInfoFrom(pcCU, uiAbsPartIdx); |
|---|
| 419 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists |
|---|
| 420 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; |
|---|
| 421 | #else |
|---|
| 422 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists |
|---|
| 423 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; |
|---|
| 424 | #endif |
|---|
| 425 | Int numValidMergeCand = 0; |
|---|
| 426 | for( UInt ui = 0; ui < m_ppcCU[uiDepth]->getSlice()->getMaxNumMergeCand(); ++ui ) |
|---|
| 427 | { |
|---|
| 428 | uhInterDirNeighbours[ui] = 0; |
|---|
| 429 | } |
|---|
| 430 | m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, uiDepth ); |
|---|
| 431 | UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx); |
|---|
| 432 | #if H_3D_ARP |
|---|
| 433 | m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth ); |
|---|
| 434 | #endif |
|---|
| 435 | #if H_3D_IC |
|---|
| 436 | m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 437 | #endif |
|---|
| 438 | |
|---|
| 439 | #if H_3D_VSP |
|---|
| 440 | Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; |
|---|
| 441 | memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); |
|---|
| 442 | #if H_3D_SPIVMP |
|---|
| 443 | Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM]; |
|---|
| 444 | memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); |
|---|
| 445 | TComMvField* pcMvFieldSP; |
|---|
| 446 | UChar* puhInterDirSP; |
|---|
| 447 | pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2]; |
|---|
| 448 | puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()]; |
|---|
| 449 | #endif |
|---|
| 450 | m_ppcCU[uiDepth]->initAvailableFlags(); |
|---|
| 451 | m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
|---|
| 452 | m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours |
|---|
| 453 | #if H_3D_SPIVMP |
|---|
| 454 | , pcMvFieldSP, puhInterDirSP |
|---|
| 455 | #endif |
|---|
| 456 | , numValidMergeCand, uiMergeIndex ); |
|---|
| 457 | |
|---|
| 458 | m_ppcCU[uiDepth]->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag |
|---|
| 459 | #if H_3D_SPIVMP |
|---|
| 460 | , bSPIVMPFlag |
|---|
| 461 | #endif |
|---|
| 462 | , numValidMergeCand ); |
|---|
| 463 | pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); |
|---|
| 464 | #else |
|---|
| 465 | #if H_3D |
|---|
| 466 | m_ppcCU[uiDepth]->initAvailableFlags(); |
|---|
| 467 | m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
|---|
| 468 | m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
|---|
| 469 | #else |
|---|
| 470 | m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
|---|
| 471 | #endif |
|---|
| 472 | #endif |
|---|
| 473 | pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); |
|---|
| 474 | |
|---|
| 475 | TComMv cTmpMv( 0, 0 ); |
|---|
| 476 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
|---|
| 477 | { |
|---|
| 478 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
|---|
| 479 | { |
|---|
| 480 | pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiAbsPartIdx, 0, uiDepth); |
|---|
| 481 | pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiAbsPartIdx, 0, uiDepth); |
|---|
| 482 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
|---|
| 483 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
|---|
| 484 | #if H_3D_VSP |
|---|
| 485 | if( pcCU->getVSPFlag( uiAbsPartIdx ) != 0 ) |
|---|
| 486 | { |
|---|
| 487 | if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) ) |
|---|
| 488 | { |
|---|
| 489 | UInt dummy; |
|---|
| 490 | Int vspSize; |
|---|
| 491 | Int width, height; |
|---|
| 492 | m_ppcCU[uiDepth]->getPartIndexAndSize( uiAbsPartIdx, dummy, width, height ); |
|---|
| 493 | m_ppcCU[uiDepth]->setMvFieldPUForVSP( pcCU, uiAbsPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize ); |
|---|
| 494 | pcCU->setVSPFlag( uiAbsPartIdx, vspSize ); |
|---|
| 495 | } |
|---|
| 496 | } |
|---|
| 497 | #endif |
|---|
| 498 | #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC |
|---|
| 499 | if ( g_decTraceMvFromMerge ) |
|---|
| 500 | { |
|---|
| 501 | if ( uiRefListIdx == 0 ) |
|---|
| 502 | { |
|---|
| 503 | DTRACE_PU( "mvL0[0]", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getHor()); |
|---|
| 504 | DTRACE_PU( "mvL0[1]", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getVer()); |
|---|
| 505 | DTRACE_PU( "refIdxL0 ", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx()); |
|---|
| 506 | } |
|---|
| 507 | else |
|---|
| 508 | { |
|---|
| 509 | DTRACE_PU( "mvL1[0]", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getHor()); |
|---|
| 510 | DTRACE_PU( "mvL1[1]", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getVer()); |
|---|
| 511 | DTRACE_PU( "refIdxL1", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx()); |
|---|
| 512 | } |
|---|
| 513 | } |
|---|
| 514 | #endif |
|---|
| 515 | } |
|---|
| 516 | } |
|---|
| 517 | #if H_3D_SPIVMP |
|---|
| 518 | pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); |
|---|
| 519 | if (bSPIVMPFlag[uiMergeIndex]) |
|---|
| 520 | { |
|---|
| 521 | UInt uiSPAddr; |
|---|
| 522 | Int iWidth = pcCU->getWidth(uiAbsPartIdx); |
|---|
| 523 | Int iHeight = pcCU->getHeight(uiAbsPartIdx); |
|---|
| 524 | |
|---|
| 525 | Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; |
|---|
| 526 | |
|---|
| 527 | pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); |
|---|
| 528 | |
|---|
| 529 | for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++) |
|---|
| 530 | { |
|---|
| 531 | pcCU->getSPAbsPartIdx(uiAbsPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr); |
|---|
| 532 | pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight); |
|---|
| 533 | pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight); |
|---|
| 534 | pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight); |
|---|
| 535 | } |
|---|
| 536 | } |
|---|
| 537 | delete[] pcMvFieldSP; |
|---|
| 538 | delete[] puhInterDirSP; |
|---|
| 539 | #endif |
|---|
| 540 | |
|---|
| 541 | xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); |
|---|
| 542 | #if H_3D_IV_MERGE |
|---|
| 543 | xDecompressCU(pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 544 | #endif |
|---|
| 545 | return; |
|---|
| 546 | } |
|---|
| 547 | #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 |
|---|
| 548 | m_pcEntropyDecoder->decodeDIS( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 549 | if(!pcCU->getDISFlag(uiAbsPartIdx)) |
|---|
| 550 | { |
|---|
| 551 | #else |
|---|
| 552 | #if H_3D_SINGLE_DEPTH |
|---|
| 553 | m_pcEntropyDecoder->decodeSingleDepthMode( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 554 | if(!pcCU->getSingleDepthFlag(uiAbsPartIdx)) |
|---|
| 555 | { |
|---|
| 556 | #endif |
|---|
| 557 | #endif |
|---|
| 558 | m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 559 | m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 560 | |
|---|
| 561 | #if !HHI_MOVE_SYN_K0052 |
|---|
| 562 | #if H_3D_DIM_SDC |
|---|
| 563 | m_pcEntropyDecoder->decodeSDCFlag( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 564 | #endif |
|---|
| 565 | #endif |
|---|
| 566 | if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) |
|---|
| 567 | { |
|---|
| 568 | m_pcEntropyDecoder->decodeIPCMInfo( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 569 | |
|---|
| 570 | if(pcCU->getIPCMFlag(uiAbsPartIdx)) |
|---|
| 571 | { |
|---|
| 572 | #if HHI_MOVE_SYN_K0052 |
|---|
| 573 | #if H_3D_DIM_SDC |
|---|
| 574 | m_pcEntropyDecoder->decodeSDCFlag( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 575 | #endif |
|---|
| 576 | #endif |
|---|
| 577 | xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); |
|---|
| 578 | #if H_3D_IV_MERGE |
|---|
| 579 | xDecompressCU(pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 580 | #endif |
|---|
| 581 | return; |
|---|
| 582 | } |
|---|
| 583 | } |
|---|
| 584 | |
|---|
| 585 | UInt uiCurrWidth = pcCU->getWidth ( uiAbsPartIdx ); |
|---|
| 586 | UInt uiCurrHeight = pcCU->getHeight( uiAbsPartIdx ); |
|---|
| 587 | |
|---|
| 588 | // prediction mode ( Intra : direction mode, Inter : Mv, reference idx ) |
|---|
| 589 | m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]); |
|---|
| 590 | |
|---|
| 591 | // Coefficient decoding |
|---|
| 592 | Bool bCodeDQP = getdQPFlag(); |
|---|
| 593 | m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, uiCurrWidth, uiCurrHeight, bCodeDQP ); |
|---|
| 594 | setdQPFlag( bCodeDQP ); |
|---|
| 595 | #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 |
|---|
| 596 | } |
|---|
| 597 | #else |
|---|
| 598 | #if H_3D_SINGLE_DEPTH |
|---|
| 599 | } |
|---|
| 600 | #endif |
|---|
| 601 | #endif |
|---|
| 602 | xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); |
|---|
| 603 | #if H_3D_IV_MERGE |
|---|
| 604 | xDecompressCU(pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 605 | #endif |
|---|
| 606 | } |
|---|
| 607 | |
|---|
| 608 | Void TDecCu::xFinishDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast) |
|---|
| 609 | { |
|---|
| 610 | if( pcCU->getSlice()->getPPS()->getUseDQP()) |
|---|
| 611 | { |
|---|
| 612 | pcCU->setQPSubParts( getdQPFlag()?pcCU->getRefQP(uiAbsPartIdx):pcCU->getCodedQP(), uiAbsPartIdx, uiDepth ); // set QP |
|---|
| 613 | } |
|---|
| 614 | |
|---|
| 615 | ruiIsLast = xDecodeSliceEnd( pcCU, uiAbsPartIdx, uiDepth); |
|---|
| 616 | } |
|---|
| 617 | |
|---|
| 618 | Void TDecCu::xDecompressCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 619 | { |
|---|
| 620 | TComPic* pcPic = pcCU->getPic(); |
|---|
| 621 | #if !H_3D_IV_MERGE |
|---|
| 622 | Bool bBoundary = false; |
|---|
| 623 | UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
|---|
| 624 | UInt uiRPelX = uiLPelX + (g_uiMaxCUWidth>>uiDepth) - 1; |
|---|
| 625 | UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
|---|
| 626 | UInt uiBPelY = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1; |
|---|
| 627 | |
|---|
| 628 | UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1); |
|---|
| 629 | TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx()); |
|---|
| 630 | Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr(); |
|---|
| 631 | if(bStartInCU||( uiRPelX >= pcSlice->getSPS()->getPicWidthInLumaSamples() ) || ( uiBPelY >= pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) |
|---|
| 632 | { |
|---|
| 633 | bBoundary = true; |
|---|
| 634 | } |
|---|
| 635 | |
|---|
| 636 | if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ) |
|---|
| 637 | { |
|---|
| 638 | UInt uiNextDepth = uiDepth + 1; |
|---|
| 639 | UInt uiQNumParts = pcCU->getTotalNumPart() >> (uiNextDepth<<1); |
|---|
| 640 | UInt uiIdx = uiAbsPartIdx; |
|---|
| 641 | for ( UInt uiPartIdx = 0; uiPartIdx < 4; uiPartIdx++ ) |
|---|
| 642 | { |
|---|
| 643 | uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; |
|---|
| 644 | uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; |
|---|
| 645 | |
|---|
| 646 | Bool binSlice = (pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr())&&(pcCU->getSCUAddr()+uiIdx<pcSlice->getSliceSegmentCurEndCUAddr()); |
|---|
| 647 | if(binSlice&&( uiLPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) |
|---|
| 648 | { |
|---|
| 649 | xDecompressCU(pcCU, uiIdx, uiNextDepth ); |
|---|
| 650 | } |
|---|
| 651 | |
|---|
| 652 | uiIdx += uiQNumParts; |
|---|
| 653 | } |
|---|
| 654 | return; |
|---|
| 655 | } |
|---|
| 656 | #endif |
|---|
| 657 | // Residual reconstruction |
|---|
| 658 | m_ppcYuvResi[uiDepth]->clear(); |
|---|
| 659 | |
|---|
| 660 | m_ppcCU[uiDepth]->copySubCU( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 661 | |
|---|
| 662 | switch( m_ppcCU[uiDepth]->getPredictionMode(0) ) |
|---|
| 663 | { |
|---|
| 664 | case MODE_INTER: |
|---|
| 665 | #if H_3D_DBBP |
|---|
| 666 | if( m_ppcCU[uiDepth]->getDBBPFlag(0) ) |
|---|
| 667 | { |
|---|
| 668 | xReconInterDBBP( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth ); |
|---|
| 669 | } |
|---|
| 670 | else |
|---|
| 671 | { |
|---|
| 672 | #endif |
|---|
| 673 | #if H_3D_INTER_SDC |
|---|
| 674 | if( m_ppcCU[uiDepth]->getSDCFlag( 0 ) ) |
|---|
| 675 | { |
|---|
| 676 | xReconInterSDC( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth ); |
|---|
| 677 | } |
|---|
| 678 | else |
|---|
| 679 | { |
|---|
| 680 | #endif |
|---|
| 681 | xReconInter( m_ppcCU[uiDepth], uiDepth ); |
|---|
| 682 | #if H_3D_INTER_SDC |
|---|
| 683 | } |
|---|
| 684 | #endif |
|---|
| 685 | #if H_3D_DBBP |
|---|
| 686 | } |
|---|
| 687 | #endif |
|---|
| 688 | break; |
|---|
| 689 | case MODE_INTRA: |
|---|
| 690 | #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 |
|---|
| 691 | if( m_ppcCU[uiDepth]->getDISFlag(0) ) |
|---|
| 692 | { |
|---|
| 693 | xReconDIS( m_ppcCU[uiDepth], 0, uiDepth ); |
|---|
| 694 | } |
|---|
| 695 | #if H_3D_DIM_SDC |
|---|
| 696 | else if( m_ppcCU[uiDepth]->getSDCFlag(0) ) |
|---|
| 697 | { |
|---|
| 698 | xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth ); |
|---|
| 699 | } |
|---|
| 700 | #endif |
|---|
| 701 | else |
|---|
| 702 | #else |
|---|
| 703 | #if H_3D_SINGLE_DEPTH |
|---|
| 704 | if( m_ppcCU[uiDepth]->getSingleDepthFlag(0) ) |
|---|
| 705 | xReconIntraSingleDepth( m_ppcCU[uiDepth], 0, uiDepth ); |
|---|
| 706 | #if H_3D_DIM_SDC |
|---|
| 707 | else if( m_ppcCU[uiDepth]->getSDCFlag(0) ) |
|---|
| 708 | xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth ); |
|---|
| 709 | #endif |
|---|
| 710 | else |
|---|
| 711 | #else |
|---|
| 712 | #if H_3D_DIM_SDC |
|---|
| 713 | if( m_ppcCU[uiDepth]->getSDCFlag(0) ) |
|---|
| 714 | xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth ); |
|---|
| 715 | else |
|---|
| 716 | #endif |
|---|
| 717 | #endif |
|---|
| 718 | #endif |
|---|
| 719 | xReconIntraQT( m_ppcCU[uiDepth], uiDepth ); |
|---|
| 720 | break; |
|---|
| 721 | default: |
|---|
| 722 | assert(0); |
|---|
| 723 | break; |
|---|
| 724 | } |
|---|
| 725 | if ( m_ppcCU[uiDepth]->isLosslessCoded(0) && (m_ppcCU[uiDepth]->getIPCMFlag(0) == false)) |
|---|
| 726 | { |
|---|
| 727 | xFillPCMBuffer(m_ppcCU[uiDepth], uiDepth); |
|---|
| 728 | } |
|---|
| 729 | |
|---|
| 730 | xCopyToPic( m_ppcCU[uiDepth], pcPic, uiAbsPartIdx, uiDepth ); |
|---|
| 731 | } |
|---|
| 732 | |
|---|
| 733 | Void TDecCu::xReconInter( TComDataCU* pcCU, UInt uiDepth ) |
|---|
| 734 | { |
|---|
| 735 | |
|---|
| 736 | // inter prediction |
|---|
| 737 | m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] ); |
|---|
| 738 | |
|---|
| 739 | // inter recon |
|---|
| 740 | xDecodeInterTexture( pcCU, 0, uiDepth ); |
|---|
| 741 | |
|---|
| 742 | // clip for only non-zero cbp case |
|---|
| 743 | if ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V ) ) ) |
|---|
| 744 | { |
|---|
| 745 | m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) ); |
|---|
| 746 | } |
|---|
| 747 | else |
|---|
| 748 | { |
|---|
| 749 | m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 )); |
|---|
| 750 | } |
|---|
| 751 | } |
|---|
| 752 | |
|---|
| 753 | #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 |
|---|
| 754 | Void TDecCu::xReconDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 755 | { |
|---|
| 756 | UInt uiWidth = pcCU->getWidth ( 0 ); |
|---|
| 757 | UInt uiHeight = pcCU->getHeight ( 0 ); |
|---|
| 758 | |
|---|
| 759 | TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth]; |
|---|
| 760 | |
|---|
| 761 | UInt uiStride = pcRecoYuv->getStride (); |
|---|
| 762 | Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
|---|
| 763 | |
|---|
| 764 | |
|---|
| 765 | AOF( uiWidth == uiHeight ); |
|---|
| 766 | AOF( uiAbsPartIdx == 0 ); |
|---|
| 767 | |
|---|
| 768 | Bool bAboveAvail = false; |
|---|
| 769 | Bool bLeftAvail = false; |
|---|
| 770 | pcCU->getPattern()->initPattern ( pcCU, 0, uiAbsPartIdx ); |
|---|
| 771 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, |
|---|
| 772 | m_pcPrediction->getPredicBuf (), |
|---|
| 773 | m_pcPrediction->getPredicBufWidth (), |
|---|
| 774 | m_pcPrediction->getPredicBufHeight (), |
|---|
| 775 | bAboveAvail, bLeftAvail |
|---|
| 776 | ); |
|---|
| 777 | |
|---|
| 778 | if ( pcCU->getDISType(uiAbsPartIdx) == 0 ) |
|---|
| 779 | { |
|---|
| 780 | m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), VER_IDX, piReco, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); |
|---|
| 781 | } |
|---|
| 782 | else if ( pcCU->getDISType(uiAbsPartIdx) == 1 ) |
|---|
| 783 | { |
|---|
| 784 | m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), HOR_IDX, piReco, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); |
|---|
| 785 | } |
|---|
| 786 | else if ( pcCU->getDISType(uiAbsPartIdx) == 2 ) |
|---|
| 787 | { |
|---|
| 788 | Pel pSingleDepth = 1 << ( g_bitDepthY - 1 ); |
|---|
| 789 | pcCU->getNeighDepth ( 0, 0, &pSingleDepth, 0 ); |
|---|
| 790 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
|---|
| 791 | { |
|---|
| 792 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
|---|
| 793 | { |
|---|
| 794 | piReco[ uiX ] = pSingleDepth; |
|---|
| 795 | } |
|---|
| 796 | piReco+= uiStride; |
|---|
| 797 | } |
|---|
| 798 | } |
|---|
| 799 | else if ( pcCU->getDISType(uiAbsPartIdx) == 3 ) |
|---|
| 800 | { |
|---|
| 801 | Pel pSingleDepth = 1 << ( g_bitDepthY - 1 ); |
|---|
| 802 | pcCU->getNeighDepth ( 0, 0, &pSingleDepth, 1 ); |
|---|
| 803 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
|---|
| 804 | { |
|---|
| 805 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
|---|
| 806 | { |
|---|
| 807 | piReco[ uiX ] = pSingleDepth; |
|---|
| 808 | } |
|---|
| 809 | piReco+= uiStride; |
|---|
| 810 | } |
|---|
| 811 | } |
|---|
| 812 | |
|---|
| 813 | // clear UV |
|---|
| 814 | UInt uiStrideC = pcRecoYuv->getCStride(); |
|---|
| 815 | Pel *pRecCb = pcRecoYuv->getCbAddr(); |
|---|
| 816 | Pel *pRecCr = pcRecoYuv->getCrAddr(); |
|---|
| 817 | |
|---|
| 818 | for (Int y=0; y<uiHeight/2; y++) |
|---|
| 819 | { |
|---|
| 820 | for (Int x=0; x<uiWidth/2; x++) |
|---|
| 821 | { |
|---|
| 822 | pRecCb[x] = 1<<(g_bitDepthC-1); |
|---|
| 823 | pRecCr[x] = 1<<(g_bitDepthC-1); |
|---|
| 824 | } |
|---|
| 825 | |
|---|
| 826 | pRecCb += uiStrideC; |
|---|
| 827 | pRecCr += uiStrideC; |
|---|
| 828 | } |
|---|
| 829 | } |
|---|
| 830 | #else |
|---|
| 831 | #if H_3D_SINGLE_DEPTH |
|---|
| 832 | Void TDecCu::xReconIntraSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 833 | { |
|---|
| 834 | UInt uiWidth = pcCU->getWidth ( 0 ); |
|---|
| 835 | UInt uiHeight = pcCU->getHeight ( 0 ); |
|---|
| 836 | |
|---|
| 837 | TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth]; |
|---|
| 838 | |
|---|
| 839 | UInt uiStride = pcRecoYuv->getStride (); |
|---|
| 840 | Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
|---|
| 841 | |
|---|
| 842 | |
|---|
| 843 | AOF( uiWidth == uiHeight ); |
|---|
| 844 | AOF( uiAbsPartIdx == 0 ); |
|---|
| 845 | |
|---|
| 846 | //construction of depth candidates |
|---|
| 847 | Pel testDepth; |
|---|
| 848 | Pel DepthNeighbours[2]; |
|---|
| 849 | Int index =0; |
|---|
| 850 | for( Int i = 0; (i < 2) && (index<SINGLE_DEPTH_MODE_CAND_LIST_SIZE) ; i++ ) |
|---|
| 851 | { |
|---|
| 852 | if(!pcCU->getNeighDepth (0, uiAbsPartIdx, &testDepth, i)) |
|---|
| 853 | { |
|---|
| 854 | continue; |
|---|
| 855 | } |
|---|
| 856 | DepthNeighbours[index]=testDepth; |
|---|
| 857 | index++; |
|---|
| 858 | } |
|---|
| 859 | |
|---|
| 860 | if(index==0) |
|---|
| 861 | { |
|---|
| 862 | DepthNeighbours[index]=1<<(g_bitDepthY-1); |
|---|
| 863 | index++; |
|---|
| 864 | } |
|---|
| 865 | |
|---|
| 866 | if(index==1) |
|---|
| 867 | { |
|---|
| 868 | DepthNeighbours[index]=ClipY(DepthNeighbours[0] + 1 ); |
|---|
| 869 | index++; |
|---|
| 870 | } |
|---|
| 871 | |
|---|
| 872 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
|---|
| 873 | { |
|---|
| 874 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
|---|
| 875 | { |
|---|
| 876 | piReco[ uiX ] =DepthNeighbours[(Int)pcCU->getSingleDepthValue(uiAbsPartIdx)]; |
|---|
| 877 | } |
|---|
| 878 | piReco += uiStride; |
|---|
| 879 | } |
|---|
| 880 | |
|---|
| 881 | // clear UV |
|---|
| 882 | UInt uiStrideC = pcRecoYuv->getCStride(); |
|---|
| 883 | Pel *pRecCb = pcRecoYuv->getCbAddr(); |
|---|
| 884 | Pel *pRecCr = pcRecoYuv->getCrAddr(); |
|---|
| 885 | |
|---|
| 886 | for (Int y=0; y<uiHeight/2; y++) |
|---|
| 887 | { |
|---|
| 888 | for (Int x=0; x<uiWidth/2; x++) |
|---|
| 889 | { |
|---|
| 890 | pRecCb[x] = 1<<(g_bitDepthC-1); |
|---|
| 891 | pRecCr[x] = 1<<(g_bitDepthC-1); |
|---|
| 892 | } |
|---|
| 893 | |
|---|
| 894 | pRecCb += uiStrideC; |
|---|
| 895 | pRecCr += uiStrideC; |
|---|
| 896 | } |
|---|
| 897 | } |
|---|
| 898 | #endif |
|---|
| 899 | #endif |
|---|
| 900 | |
|---|
| 901 | #if H_3D_INTER_SDC |
|---|
| 902 | Void TDecCu::xReconInterSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 903 | { |
|---|
| 904 | // inter prediction |
|---|
| 905 | m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] ); |
|---|
| 906 | |
|---|
| 907 | UInt uiWidth = pcCU->getWidth ( 0 ); |
|---|
| 908 | UInt uiHeight = pcCU->getHeight( 0 ); |
|---|
| 909 | |
|---|
| 910 | Pel *pResi; |
|---|
| 911 | UInt uiPelX, uiPelY; |
|---|
| 912 | UInt uiResiStride = m_ppcYuvResi[uiDepth]->getStride(); |
|---|
| 913 | |
|---|
| 914 | pResi = m_ppcYuvResi[uiDepth]->getLumaAddr( 0 ); |
|---|
| 915 | for( uiPelY = 0; uiPelY < uiHeight; uiPelY++ ) |
|---|
| 916 | { |
|---|
| 917 | for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ ) |
|---|
| 918 | { |
|---|
| 919 | pResi[ uiPelX ] = pcCU->getSDCSegmentDCOffset( 0, 0 ); |
|---|
| 920 | } |
|---|
| 921 | pResi += uiResiStride; |
|---|
| 922 | } |
|---|
| 923 | |
|---|
| 924 | m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) ); |
|---|
| 925 | |
|---|
| 926 | // clear UV |
|---|
| 927 | UInt uiStrideC = m_ppcYuvReco[uiDepth]->getCStride(); |
|---|
| 928 | Pel *pRecCb = m_ppcYuvReco[uiDepth]->getCbAddr(); |
|---|
| 929 | Pel *pRecCr = m_ppcYuvReco[uiDepth]->getCrAddr(); |
|---|
| 930 | |
|---|
| 931 | for (Int y = 0; y < uiHeight/2; y++) |
|---|
| 932 | { |
|---|
| 933 | for (Int x = 0; x < uiWidth/2; x++) |
|---|
| 934 | { |
|---|
| 935 | pRecCb[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) ); |
|---|
| 936 | pRecCr[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) ); |
|---|
| 937 | } |
|---|
| 938 | |
|---|
| 939 | pRecCb += uiStrideC; |
|---|
| 940 | pRecCr += uiStrideC; |
|---|
| 941 | } |
|---|
| 942 | } |
|---|
| 943 | #endif |
|---|
| 944 | |
|---|
| 945 | #if H_3D_DBBP |
|---|
| 946 | Void TDecCu::xReconInterDBBP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 947 | { |
|---|
| 948 | AOF(!pcCU->getSlice()->getIsDepth()); |
|---|
| 949 | AOF(!pcCU->getSlice()->isIntra()); |
|---|
| 950 | PartSize ePartSize = pcCU->getPartitionSize( 0 ); |
|---|
| 951 | |
|---|
| 952 | // get collocated depth block |
|---|
| 953 | UInt uiDepthStride = 0; |
|---|
| 954 | #if H_3D_FCO |
|---|
| 955 | Pel* pDepthPels = pcCU->getVirtualDepthBlock(pcCU->getZorderIdxInCU(), pcCU->getWidth(0), pcCU->getHeight(0), uiDepthStride); |
|---|
| 956 | #else |
|---|
| 957 | Pel* pDepthPels = pcCU->getVirtualDepthBlock(0, pcCU->getWidth(0), pcCU->getHeight(0), uiDepthStride); |
|---|
| 958 | #endif |
|---|
| 959 | AOF( pDepthPels != NULL ); |
|---|
| 960 | AOF( uiDepthStride != 0 ); |
|---|
| 961 | |
|---|
| 962 | // compute mask by segmenting depth block |
|---|
| 963 | Bool pMask[MAX_CU_SIZE*MAX_CU_SIZE]; |
|---|
| 964 | #if HS_DBBP_CLEAN_K0048 |
|---|
| 965 | Bool bValidMask = m_pcPrediction->getSegmentMaskFromDepth(pDepthPels, uiDepthStride, pcCU->getWidth(0), pcCU->getHeight(0), pMask, pcCU); |
|---|
| 966 | #else |
|---|
| 967 | Bool bValidMask = m_pcPrediction->getSegmentMaskFromDepth(pDepthPels, uiDepthStride, pcCU->getWidth(0), pcCU->getHeight(0), pMask); |
|---|
| 968 | #endif |
|---|
| 969 | AOF(bValidMask); |
|---|
| 970 | |
|---|
| 971 | DBBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData(); |
|---|
| 972 | TComYuv* apSegPredYuv[2] = { m_ppcYuvReco[uiDepth], m_ppcYuvRecoDBBP[uiDepth] }; |
|---|
| 973 | |
|---|
| 974 | // first, extract the two sets of motion parameters |
|---|
| 975 | UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4; |
|---|
| 976 | for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) |
|---|
| 977 | { |
|---|
| 978 | UInt uiPartAddr = uiSegment*uiPUOffset; |
|---|
| 979 | |
|---|
| 980 | pDBBPTmpData->auhInterDir[uiSegment] = pcCU->getInterDir(uiPartAddr); |
|---|
| 981 | |
|---|
| 982 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
|---|
| 983 | { |
|---|
| 984 | RefPicList eRefList = (RefPicList)uiRefListIdx; |
|---|
| 985 | pcCU->getMvField(pcCU, uiPartAddr, eRefList, pDBBPTmpData->acMvField[uiSegment][eRefList]); |
|---|
| 986 | } |
|---|
| 987 | |
|---|
| 988 | AOF( pcCU->getARPW(uiPartAddr) == 0 ); |
|---|
| 989 | AOF( pcCU->getICFlag(uiPartAddr) == false ); |
|---|
| 990 | AOF( pcCU->getSPIVMPFlag(uiPartAddr) == false ); |
|---|
| 991 | AOF( pcCU->getVSPFlag(uiPartAddr) == 0 ); |
|---|
| 992 | } |
|---|
| 993 | |
|---|
| 994 | // do motion compensation for each segment as 2Nx2N |
|---|
| 995 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); |
|---|
| 996 | pcCU->setPredModeSubParts( MODE_INTER, 0, uiDepth ); |
|---|
| 997 | for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) |
|---|
| 998 | { |
|---|
| 999 | pcCU->setInterDirSubParts( pDBBPTmpData->auhInterDir[uiSegment], 0, 0, uiDepth ); |
|---|
| 1000 | |
|---|
| 1001 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
|---|
| 1002 | { |
|---|
| 1003 | RefPicList eRefList = (RefPicList)uiRefListIdx; |
|---|
| 1004 | |
|---|
| 1005 | pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], SIZE_2Nx2N, 0, 0 ); |
|---|
| 1006 | } |
|---|
| 1007 | |
|---|
| 1008 | // inter prediction |
|---|
| 1009 | m_pcPrediction->motionCompensation( pcCU, apSegPredYuv[uiSegment] ); |
|---|
| 1010 | } |
|---|
| 1011 | |
|---|
| 1012 | // restore motion information in both segments again |
|---|
| 1013 | pcCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); |
|---|
| 1014 | pcCU->setPredModeSubParts( MODE_INTER, 0, uiDepth ); |
|---|
| 1015 | for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) |
|---|
| 1016 | { |
|---|
| 1017 | UInt uiPartAddr = uiSegment*uiPUOffset; |
|---|
| 1018 | |
|---|
| 1019 | pcCU->setDBBPFlagSubParts(true, uiPartAddr, uiSegment, uiDepth); |
|---|
| 1020 | pcCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[uiSegment], uiPartAddr, uiSegment, uiDepth); // interprets depth relative to LCU level |
|---|
| 1021 | |
|---|
| 1022 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
|---|
| 1023 | { |
|---|
| 1024 | RefPicList eRefList = (RefPicList)uiRefListIdx; |
|---|
| 1025 | |
|---|
| 1026 | pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], ePartSize, uiPartAddr, 0, uiSegment ); // interprets depth relative to rpcTempCU level |
|---|
| 1027 | } |
|---|
| 1028 | } |
|---|
| 1029 | |
|---|
| 1030 | // reconstruct final prediction signal by combining both segments |
|---|
| 1031 | m_pcPrediction->combineSegmentsWithMask(apSegPredYuv, m_ppcYuvReco[uiDepth], pMask, pcCU->getWidth(0), pcCU->getHeight(0), 0, ePartSize); |
|---|
| 1032 | |
|---|
| 1033 | // inter recon |
|---|
| 1034 | xDecodeInterTexture( pcCU, 0, uiDepth ); |
|---|
| 1035 | |
|---|
| 1036 | // clip for only non-zero cbp case |
|---|
| 1037 | if ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V ) ) ) |
|---|
| 1038 | { |
|---|
| 1039 | m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) ); |
|---|
| 1040 | } |
|---|
| 1041 | else |
|---|
| 1042 | { |
|---|
| 1043 | m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 )); |
|---|
| 1044 | } |
|---|
| 1045 | } |
|---|
| 1046 | #endif |
|---|
| 1047 | |
|---|
| 1048 | Void |
|---|
| 1049 | TDecCu::xIntraRecLumaBlk( TComDataCU* pcCU, |
|---|
| 1050 | UInt uiTrDepth, |
|---|
| 1051 | UInt uiAbsPartIdx, |
|---|
| 1052 | TComYuv* pcRecoYuv, |
|---|
| 1053 | TComYuv* pcPredYuv, |
|---|
| 1054 | TComYuv* pcResiYuv ) |
|---|
| 1055 | { |
|---|
| 1056 | UInt uiWidth = pcCU ->getWidth ( 0 ) >> uiTrDepth; |
|---|
| 1057 | UInt uiHeight = pcCU ->getHeight ( 0 ) >> uiTrDepth; |
|---|
| 1058 | UInt uiStride = pcRecoYuv->getStride (); |
|---|
| 1059 | Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
|---|
| 1060 | Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); |
|---|
| 1061 | Pel* piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); |
|---|
| 1062 | |
|---|
| 1063 | UInt uiNumCoeffInc = ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ); |
|---|
| 1064 | TCoeff* pcCoeff = pcCU->getCoeffY() + ( uiNumCoeffInc * uiAbsPartIdx ); |
|---|
| 1065 | |
|---|
| 1066 | UInt uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); |
|---|
| 1067 | |
|---|
| 1068 | UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
|---|
| 1069 | Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); |
|---|
| 1070 | UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); |
|---|
| 1071 | Bool useTransformSkip = pcCU->getTransformSkip(uiAbsPartIdx, TEXT_LUMA); |
|---|
| 1072 | //===== init availability pattern ===== |
|---|
| 1073 | Bool bAboveAvail = false; |
|---|
| 1074 | Bool bLeftAvail = false; |
|---|
| 1075 | pcCU->getPattern()->initPattern ( pcCU, uiTrDepth, uiAbsPartIdx ); |
|---|
| 1076 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, |
|---|
| 1077 | m_pcPrediction->getPredicBuf (), |
|---|
| 1078 | m_pcPrediction->getPredicBufWidth (), |
|---|
| 1079 | m_pcPrediction->getPredicBufHeight (), |
|---|
| 1080 | bAboveAvail, bLeftAvail ); |
|---|
| 1081 | |
|---|
| 1082 | //===== get prediction signal ===== |
|---|
| 1083 | #if H_3D_DIM |
|---|
| 1084 | if( isDimMode( uiLumaPredMode ) ) |
|---|
| 1085 | { |
|---|
| 1086 | m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight ); |
|---|
| 1087 | } |
|---|
| 1088 | else |
|---|
| 1089 | { |
|---|
| 1090 | #endif |
|---|
| 1091 | m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); |
|---|
| 1092 | #if H_3D_DIM |
|---|
| 1093 | } |
|---|
| 1094 | #endif |
|---|
| 1095 | |
|---|
| 1096 | #if H_3D |
|---|
| 1097 | Bool useDltFlag = (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()); |
|---|
| 1098 | |
|---|
| 1099 | if ( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth ) || useDltFlag ) |
|---|
| 1100 | #else |
|---|
| 1101 | if ( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth ) ) |
|---|
| 1102 | #endif |
|---|
| 1103 | { |
|---|
| 1104 | //===== inverse transform ===== |
|---|
| 1105 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); |
|---|
| 1106 | |
|---|
| 1107 | Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA]; |
|---|
| 1108 | assert(scalingListType < SCALING_LIST_NUM); |
|---|
| 1109 | m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkip ); |
|---|
| 1110 | |
|---|
| 1111 | |
|---|
| 1112 | //===== reconstruction ===== |
|---|
| 1113 | Pel* pPred = piPred; |
|---|
| 1114 | Pel* pResi = piResi; |
|---|
| 1115 | Pel* pReco = piReco; |
|---|
| 1116 | Pel* pRecIPred = piRecIPred; |
|---|
| 1117 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
|---|
| 1118 | { |
|---|
| 1119 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
|---|
| 1120 | { |
|---|
| 1121 | pReco [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] ); |
|---|
| 1122 | pRecIPred[ uiX ] = pReco[ uiX ]; |
|---|
| 1123 | } |
|---|
| 1124 | pPred += uiStride; |
|---|
| 1125 | pResi += uiStride; |
|---|
| 1126 | pReco += uiStride; |
|---|
| 1127 | pRecIPred += uiRecIPredStride; |
|---|
| 1128 | } |
|---|
| 1129 | } |
|---|
| 1130 | else |
|---|
| 1131 | { |
|---|
| 1132 | //===== reconstruction ===== |
|---|
| 1133 | Pel* pPred = piPred; |
|---|
| 1134 | Pel* pReco = piReco; |
|---|
| 1135 | Pel* pRecIPred = piRecIPred; |
|---|
| 1136 | for ( Int y = 0; y < uiHeight; y++ ) |
|---|
| 1137 | { |
|---|
| 1138 | for ( Int x = 0; x < uiWidth; x++ ) |
|---|
| 1139 | { |
|---|
| 1140 | pReco [ x ] = pPred[ x ]; |
|---|
| 1141 | pRecIPred[ x ] = pReco[ x ]; |
|---|
| 1142 | } |
|---|
| 1143 | pPred += uiStride; |
|---|
| 1144 | pReco += uiStride; |
|---|
| 1145 | pRecIPred += uiRecIPredStride; |
|---|
| 1146 | } |
|---|
| 1147 | } |
|---|
| 1148 | } |
|---|
| 1149 | |
|---|
| 1150 | |
|---|
| 1151 | Void |
|---|
| 1152 | TDecCu::xIntraRecChromaBlk( TComDataCU* pcCU, |
|---|
| 1153 | UInt uiTrDepth, |
|---|
| 1154 | UInt uiAbsPartIdx, |
|---|
| 1155 | TComYuv* pcRecoYuv, |
|---|
| 1156 | TComYuv* pcPredYuv, |
|---|
| 1157 | TComYuv* pcResiYuv, |
|---|
| 1158 | UInt uiChromaId ) |
|---|
| 1159 | { |
|---|
| 1160 | UInt uiFullDepth = pcCU->getDepth( 0 ) + uiTrDepth; |
|---|
| 1161 | UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiFullDepth ] + 2; |
|---|
| 1162 | |
|---|
| 1163 | if( uiLog2TrSize == 2 ) |
|---|
| 1164 | { |
|---|
| 1165 | assert( uiTrDepth > 0 ); |
|---|
| 1166 | uiTrDepth--; |
|---|
| 1167 | UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth( 0 ) + uiTrDepth ) << 1 ); |
|---|
| 1168 | Bool bFirstQ = ( ( uiAbsPartIdx % uiQPDiv ) == 0 ); |
|---|
| 1169 | if( !bFirstQ ) |
|---|
| 1170 | { |
|---|
| 1171 | return; |
|---|
| 1172 | } |
|---|
| 1173 | } |
|---|
| 1174 | |
|---|
| 1175 | TextType eText = ( uiChromaId > 0 ? TEXT_CHROMA_V : TEXT_CHROMA_U ); |
|---|
| 1176 | UInt uiWidth = pcCU ->getWidth ( 0 ) >> ( uiTrDepth + 1 ); |
|---|
| 1177 | UInt uiHeight = pcCU ->getHeight ( 0 ) >> ( uiTrDepth + 1 ); |
|---|
| 1178 | UInt uiStride = pcRecoYuv->getCStride (); |
|---|
| 1179 | Pel* piReco = ( uiChromaId > 0 ? pcRecoYuv->getCrAddr( uiAbsPartIdx ) : pcRecoYuv->getCbAddr( uiAbsPartIdx ) ); |
|---|
| 1180 | Pel* piPred = ( uiChromaId > 0 ? pcPredYuv->getCrAddr( uiAbsPartIdx ) : pcPredYuv->getCbAddr( uiAbsPartIdx ) ); |
|---|
| 1181 | Pel* piResi = ( uiChromaId > 0 ? pcResiYuv->getCrAddr( uiAbsPartIdx ) : pcResiYuv->getCbAddr( uiAbsPartIdx ) ); |
|---|
| 1182 | |
|---|
| 1183 | UInt uiNumCoeffInc = ( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ) ) >> 2; |
|---|
| 1184 | TCoeff* pcCoeff = ( uiChromaId > 0 ? pcCU->getCoeffCr() : pcCU->getCoeffCb() ) + ( uiNumCoeffInc * uiAbsPartIdx ); |
|---|
| 1185 | |
|---|
| 1186 | UInt uiChromaPredMode = pcCU->getChromaIntraDir( 0 ); |
|---|
| 1187 | |
|---|
| 1188 | UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
|---|
| 1189 | Pel* piRecIPred = ( uiChromaId > 0 ? pcCU->getPic()->getPicYuvRec()->getCrAddr( pcCU->getAddr(), uiZOrder ) : pcCU->getPic()->getPicYuvRec()->getCbAddr( pcCU->getAddr(), uiZOrder ) ); |
|---|
| 1190 | UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getCStride(); |
|---|
| 1191 | Bool useTransformSkipChroma = pcCU->getTransformSkip(uiAbsPartIdx,eText); |
|---|
| 1192 | //===== init availability pattern ===== |
|---|
| 1193 | Bool bAboveAvail = false; |
|---|
| 1194 | Bool bLeftAvail = false; |
|---|
| 1195 | pcCU->getPattern()->initPattern ( pcCU, uiTrDepth, uiAbsPartIdx ); |
|---|
| 1196 | |
|---|
| 1197 | pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth, |
|---|
| 1198 | m_pcPrediction->getPredicBuf (), |
|---|
| 1199 | m_pcPrediction->getPredicBufWidth (), |
|---|
| 1200 | m_pcPrediction->getPredicBufHeight (), |
|---|
| 1201 | bAboveAvail, bLeftAvail ); |
|---|
| 1202 | Int* pPatChroma = ( uiChromaId > 0 ? pcCU->getPattern()->getAdiCrBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) : pcCU->getPattern()->getAdiCbBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) ); |
|---|
| 1203 | |
|---|
| 1204 | //===== get prediction signal ===== |
|---|
| 1205 | { |
|---|
| 1206 | if( uiChromaPredMode == DM_CHROMA_IDX ) |
|---|
| 1207 | { |
|---|
| 1208 | uiChromaPredMode = pcCU->getLumaIntraDir( 0 ); |
|---|
| 1209 | #if H_3D_DIM |
|---|
| 1210 | mapDepthModeToIntraDir( uiChromaPredMode ); |
|---|
| 1211 | #endif |
|---|
| 1212 | } |
|---|
| 1213 | m_pcPrediction->predIntraChromaAng( pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); |
|---|
| 1214 | } |
|---|
| 1215 | |
|---|
| 1216 | if ( pcCU->getCbf( uiAbsPartIdx, eText, uiTrDepth ) ) |
|---|
| 1217 | { |
|---|
| 1218 | //===== inverse transform ===== |
|---|
| 1219 | Int curChromaQpOffset; |
|---|
| 1220 | if(eText == TEXT_CHROMA_U) |
|---|
| 1221 | { |
|---|
| 1222 | curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb(); |
|---|
| 1223 | } |
|---|
| 1224 | else |
|---|
| 1225 | { |
|---|
| 1226 | curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr(); |
|---|
| 1227 | } |
|---|
| 1228 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset ); |
|---|
| 1229 | |
|---|
| 1230 | Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText]; |
|---|
| 1231 | assert(scalingListType < SCALING_LIST_NUM); |
|---|
| 1232 | m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkipChroma ); |
|---|
| 1233 | |
|---|
| 1234 | //===== reconstruction ===== |
|---|
| 1235 | Pel* pPred = piPred; |
|---|
| 1236 | Pel* pResi = piResi; |
|---|
| 1237 | Pel* pReco = piReco; |
|---|
| 1238 | Pel* pRecIPred = piRecIPred; |
|---|
| 1239 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
|---|
| 1240 | { |
|---|
| 1241 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
|---|
| 1242 | { |
|---|
| 1243 | pReco [ uiX ] = ClipC( pPred[ uiX ] + pResi[ uiX ] ); |
|---|
| 1244 | pRecIPred[ uiX ] = pReco[ uiX ]; |
|---|
| 1245 | } |
|---|
| 1246 | pPred += uiStride; |
|---|
| 1247 | pResi += uiStride; |
|---|
| 1248 | pReco += uiStride; |
|---|
| 1249 | pRecIPred += uiRecIPredStride; |
|---|
| 1250 | } |
|---|
| 1251 | } |
|---|
| 1252 | else |
|---|
| 1253 | { |
|---|
| 1254 | //===== reconstruction ===== |
|---|
| 1255 | Pel* pPred = piPred; |
|---|
| 1256 | Pel* pReco = piReco; |
|---|
| 1257 | Pel* pRecIPred = piRecIPred; |
|---|
| 1258 | for ( Int y = 0; y < uiHeight; y++ ) |
|---|
| 1259 | { |
|---|
| 1260 | for ( Int x = 0; x < uiWidth; x++ ) |
|---|
| 1261 | { |
|---|
| 1262 | pReco [ x ] = pPred[ x ]; |
|---|
| 1263 | pRecIPred[ x ] = pReco[ x ]; |
|---|
| 1264 | } |
|---|
| 1265 | pPred += uiStride; |
|---|
| 1266 | pReco += uiStride; |
|---|
| 1267 | pRecIPred += uiRecIPredStride; |
|---|
| 1268 | } |
|---|
| 1269 | } |
|---|
| 1270 | } |
|---|
| 1271 | |
|---|
| 1272 | |
|---|
| 1273 | Void |
|---|
| 1274 | TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiDepth ) |
|---|
| 1275 | { |
|---|
| 1276 | UInt uiInitTrDepth = ( pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1 ); |
|---|
| 1277 | UInt uiNumPart = pcCU->getNumPartitions(); |
|---|
| 1278 | UInt uiNumQParts = pcCU->getTotalNumPart() >> 2; |
|---|
| 1279 | |
|---|
| 1280 | if (pcCU->getIPCMFlag(0)) |
|---|
| 1281 | { |
|---|
| 1282 | xReconPCM( pcCU, uiDepth ); |
|---|
| 1283 | return; |
|---|
| 1284 | } |
|---|
| 1285 | |
|---|
| 1286 | for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ ) |
|---|
| 1287 | { |
|---|
| 1288 | xIntraLumaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] ); |
|---|
| 1289 | } |
|---|
| 1290 | |
|---|
| 1291 | for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ ) |
|---|
| 1292 | { |
|---|
| 1293 | xIntraChromaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] ); |
|---|
| 1294 | } |
|---|
| 1295 | |
|---|
| 1296 | } |
|---|
| 1297 | |
|---|
| 1298 | #if H_3D_DIM_SDC |
|---|
| 1299 | Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 1300 | { |
|---|
| 1301 | UInt uiWidth = pcCU->getWidth ( 0 ); |
|---|
| 1302 | UInt uiHeight = pcCU->getHeight ( 0 ); |
|---|
| 1303 | TComWedgelet* dmm4SegmentationOrg = new TComWedgelet( uiWidth, uiHeight ); |
|---|
| 1304 | UInt numParts = 1; |
|---|
| 1305 | UInt sdcDepth = 0; |
|---|
| 1306 | TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth]; |
|---|
| 1307 | TComYuv* pcPredYuv = m_ppcYuvReco[uiDepth]; |
|---|
| 1308 | TComYuv* pcResiYuv = m_ppcYuvResi[uiDepth]; |
|---|
| 1309 | |
|---|
| 1310 | UInt uiStride = 0; |
|---|
| 1311 | Pel* piReco; |
|---|
| 1312 | Pel* piPred; |
|---|
| 1313 | Pel* piResi; |
|---|
| 1314 | |
|---|
| 1315 | UInt uiZOrder; |
|---|
| 1316 | Pel* piRecIPred; |
|---|
| 1317 | UInt uiRecIPredStride; |
|---|
| 1318 | |
|---|
| 1319 | UInt uiLumaPredMode = 0; |
|---|
| 1320 | |
|---|
| 1321 | if ((uiWidth >> pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize()) > 1) |
|---|
| 1322 | { |
|---|
| 1323 | numParts = uiWidth * uiWidth >> (2 * pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize()); |
|---|
| 1324 | sdcDepth = g_aucConvertToBit[uiWidth] + 2 - pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize(); |
|---|
| 1325 | uiWidth = uiHeight = (1 << pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize()); |
|---|
| 1326 | } |
|---|
| 1327 | |
|---|
| 1328 | for ( Int i = 0; i < numParts; i++ ) |
|---|
| 1329 | { |
|---|
| 1330 | uiStride = pcRecoYuv->getStride (); |
|---|
| 1331 | piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
|---|
| 1332 | piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); |
|---|
| 1333 | piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); |
|---|
| 1334 | |
|---|
| 1335 | uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
|---|
| 1336 | piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); |
|---|
| 1337 | uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); |
|---|
| 1338 | |
|---|
| 1339 | uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); |
|---|
| 1340 | |
|---|
| 1341 | AOF( uiWidth == uiHeight ); |
|---|
| 1342 | |
|---|
| 1343 | //===== init availability pattern ===== |
|---|
| 1344 | Bool bAboveAvail = false; |
|---|
| 1345 | Bool bLeftAvail = false; |
|---|
| 1346 | |
|---|
| 1347 | pcCU->getPattern()->initPattern ( pcCU, sdcDepth, uiAbsPartIdx ); |
|---|
| 1348 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, sdcDepth, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail ); |
|---|
| 1349 | |
|---|
| 1350 | TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight ); |
|---|
| 1351 | //===== get prediction signal ===== |
|---|
| 1352 | if( isDimMode( uiLumaPredMode ) ) |
|---|
| 1353 | { |
|---|
| 1354 | m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, false, dmm4Segmentation ); |
|---|
| 1355 | Bool* dmm4PatternSplit = dmm4Segmentation->getPattern(); |
|---|
| 1356 | Bool* dmm4PatternOrg = dmm4SegmentationOrg->getPattern(); |
|---|
| 1357 | for( UInt k = 0; k < (uiWidth*uiHeight); k++ ) |
|---|
| 1358 | { |
|---|
| 1359 | dmm4PatternOrg[k+(uiAbsPartIdx<<4)] = dmm4PatternSplit[k]; |
|---|
| 1360 | } |
|---|
| 1361 | } |
|---|
| 1362 | else |
|---|
| 1363 | { |
|---|
| 1364 | m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); |
|---|
| 1365 | } |
|---|
| 1366 | |
|---|
| 1367 | if ( numParts > 1 ) |
|---|
| 1368 | { |
|---|
| 1369 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
|---|
| 1370 | { |
|---|
| 1371 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
|---|
| 1372 | { |
|---|
| 1373 | piReco [ uiX ] = ClipY( piPred[ uiX ] ); |
|---|
| 1374 | piRecIPred [ uiX ] = piReco[ uiX ]; |
|---|
| 1375 | } |
|---|
| 1376 | piPred += uiStride; |
|---|
| 1377 | piReco += uiStride; |
|---|
| 1378 | piRecIPred += uiRecIPredStride; |
|---|
| 1379 | } |
|---|
| 1380 | } |
|---|
| 1381 | uiAbsPartIdx += ( (uiWidth * uiWidth) >> 4 ); |
|---|
| 1382 | dmm4Segmentation->destroy(); delete dmm4Segmentation; |
|---|
| 1383 | } |
|---|
| 1384 | uiAbsPartIdx = 0; |
|---|
| 1385 | |
|---|
| 1386 | if ( numParts > 1 ) |
|---|
| 1387 | { |
|---|
| 1388 | uiWidth = pcCU->getWidth( 0 ); |
|---|
| 1389 | uiHeight = pcCU->getHeight( 0 ); |
|---|
| 1390 | } |
|---|
| 1391 | piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
|---|
| 1392 | piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); |
|---|
| 1393 | piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); |
|---|
| 1394 | uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
|---|
| 1395 | piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); |
|---|
| 1396 | uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); |
|---|
| 1397 | // number of segments depends on prediction mode |
|---|
| 1398 | UInt uiNumSegments = 1; |
|---|
| 1399 | Bool* pbMask = NULL; |
|---|
| 1400 | UInt uiMaskStride = 0; |
|---|
| 1401 | |
|---|
| 1402 | if( getDimType( uiLumaPredMode ) == DMM1_IDX ) |
|---|
| 1403 | { |
|---|
| 1404 | Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx); |
|---|
| 1405 | |
|---|
| 1406 | WedgeList* pacWedgeList = pcCU->isDMM1UpscaleMode(uiWidth) ? &g_dmmWedgeLists[(g_aucConvertToBit[pcCU->getDMM1BasePatternWidth(uiWidth)])] : &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])]; |
|---|
| 1407 | TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx )); |
|---|
| 1408 | |
|---|
| 1409 | uiNumSegments = 2; |
|---|
| 1410 | |
|---|
| 1411 | pbMask = pcCU->isDMM1UpscaleMode( uiWidth ) ? pcWedgelet->getScaledPattern(uiWidth) : pcWedgelet->getPattern(); |
|---|
| 1412 | uiMaskStride = pcCU->isDMM1UpscaleMode( uiWidth ) ? uiWidth : pcWedgelet->getStride(); |
|---|
| 1413 | } |
|---|
| 1414 | if( getDimType( uiLumaPredMode ) == DMM4_IDX ) |
|---|
| 1415 | { |
|---|
| 1416 | uiNumSegments = 2; |
|---|
| 1417 | pbMask = dmm4SegmentationOrg->getPattern(); |
|---|
| 1418 | uiMaskStride = dmm4SegmentationOrg->getStride(); |
|---|
| 1419 | } |
|---|
| 1420 | // get DC prediction for each segment |
|---|
| 1421 | Pel apDCPredValues[2]; |
|---|
| 1422 | if ( getDimType( uiLumaPredMode ) == DMM1_IDX || getDimType( uiLumaPredMode ) == DMM4_IDX ) |
|---|
| 1423 | { |
|---|
| 1424 | apDCPredValues[0] = pcCU->getDmmPredictor( 0 ); |
|---|
| 1425 | apDCPredValues[1] = pcCU->getDmmPredictor( 1 ); |
|---|
| 1426 | } |
|---|
| 1427 | else |
|---|
| 1428 | { |
|---|
| 1429 | m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode); |
|---|
| 1430 | } |
|---|
| 1431 | |
|---|
| 1432 | // reconstruct residual based on mask + DC residuals |
|---|
| 1433 | Pel apDCResiValues[2]; |
|---|
| 1434 | for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ ) |
|---|
| 1435 | { |
|---|
| 1436 | #if H_3D_DIM_DLT |
|---|
| 1437 | Pel pPredIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); |
|---|
| 1438 | Pel pResiIdx = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); |
|---|
| 1439 | Pel pRecoValue = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx ); |
|---|
| 1440 | |
|---|
| 1441 | apDCResiValues[uiSegment] = pRecoValue - apDCPredValues[uiSegment]; |
|---|
| 1442 | #else |
|---|
| 1443 | apDCResiValues[uiSegment] = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); |
|---|
| 1444 | #endif |
|---|
| 1445 | } |
|---|
| 1446 | |
|---|
| 1447 | //===== reconstruction ===== |
|---|
| 1448 | Bool*pMask = pbMask; |
|---|
| 1449 | Pel* pPred = piPred; |
|---|
| 1450 | Pel* pResi = piResi; |
|---|
| 1451 | Pel* pReco = piReco; |
|---|
| 1452 | Pel* pRecIPred = piRecIPred; |
|---|
| 1453 | |
|---|
| 1454 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
|---|
| 1455 | { |
|---|
| 1456 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
|---|
| 1457 | { |
|---|
| 1458 | UChar ucSegment = pMask?(UChar)pMask[uiX]:0; |
|---|
| 1459 | assert( ucSegment < uiNumSegments ); |
|---|
| 1460 | |
|---|
| 1461 | Pel pResiDC = apDCResiValues[ucSegment]; |
|---|
| 1462 | |
|---|
| 1463 | pReco [ uiX ] = ClipY( pPred[ uiX ] + pResiDC ); |
|---|
| 1464 | pRecIPred[ uiX ] = pReco[ uiX ]; |
|---|
| 1465 | } |
|---|
| 1466 | pPred += uiStride; |
|---|
| 1467 | pResi += uiStride; |
|---|
| 1468 | pReco += uiStride; |
|---|
| 1469 | pRecIPred += uiRecIPredStride; |
|---|
| 1470 | pMask += uiMaskStride; |
|---|
| 1471 | } |
|---|
| 1472 | |
|---|
| 1473 | // clear UV |
|---|
| 1474 | UInt uiStrideC = pcPredYuv->getCStride(); |
|---|
| 1475 | Pel *pRecCb = pcPredYuv->getCbAddr(); |
|---|
| 1476 | Pel *pRecCr = pcPredYuv->getCrAddr(); |
|---|
| 1477 | |
|---|
| 1478 | for (Int y=0; y<uiHeight/2; y++) |
|---|
| 1479 | { |
|---|
| 1480 | for (Int x=0; x<uiWidth/2; x++) |
|---|
| 1481 | { |
|---|
| 1482 | pRecCb[x] = 128; |
|---|
| 1483 | pRecCr[x] = 128; |
|---|
| 1484 | } |
|---|
| 1485 | |
|---|
| 1486 | pRecCb += uiStrideC; |
|---|
| 1487 | pRecCr += uiStrideC; |
|---|
| 1488 | } |
|---|
| 1489 | dmm4SegmentationOrg->destroy(); delete dmm4SegmentationOrg; |
|---|
| 1490 | } |
|---|
| 1491 | #endif |
|---|
| 1492 | |
|---|
| 1493 | /** Function for deriving recontructed PU/CU Luma sample with QTree structure |
|---|
| 1494 | * \param pcCU pointer of current CU |
|---|
| 1495 | * \param uiTrDepth current tranform split depth |
|---|
| 1496 | * \param uiAbsPartIdx part index |
|---|
| 1497 | * \param pcRecoYuv pointer to reconstructed sample arrays |
|---|
| 1498 | * \param pcPredYuv pointer to prediction sample arrays |
|---|
| 1499 | * \param pcResiYuv pointer to residue sample arrays |
|---|
| 1500 | * |
|---|
| 1501 | \ This function dervies recontructed PU/CU Luma sample with recursive QTree structure |
|---|
| 1502 | */ |
|---|
| 1503 | Void |
|---|
| 1504 | TDecCu::xIntraLumaRecQT( TComDataCU* pcCU, |
|---|
| 1505 | UInt uiTrDepth, |
|---|
| 1506 | UInt uiAbsPartIdx, |
|---|
| 1507 | TComYuv* pcRecoYuv, |
|---|
| 1508 | TComYuv* pcPredYuv, |
|---|
| 1509 | TComYuv* pcResiYuv ) |
|---|
| 1510 | { |
|---|
| 1511 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
|---|
| 1512 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
|---|
| 1513 | if( uiTrMode == uiTrDepth ) |
|---|
| 1514 | { |
|---|
| 1515 | xIntraRecLumaBlk ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv ); |
|---|
| 1516 | } |
|---|
| 1517 | else |
|---|
| 1518 | { |
|---|
| 1519 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
|---|
| 1520 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
|---|
| 1521 | { |
|---|
| 1522 | xIntraLumaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
|---|
| 1523 | } |
|---|
| 1524 | } |
|---|
| 1525 | } |
|---|
| 1526 | |
|---|
| 1527 | /** Function for deriving recontructed PU/CU chroma samples with QTree structure |
|---|
| 1528 | * \param pcCU pointer of current CU |
|---|
| 1529 | * \param uiTrDepth current tranform split depth |
|---|
| 1530 | * \param uiAbsPartIdx part index |
|---|
| 1531 | * \param pcRecoYuv pointer to reconstructed sample arrays |
|---|
| 1532 | * \param pcPredYuv pointer to prediction sample arrays |
|---|
| 1533 | * \param pcResiYuv pointer to residue sample arrays |
|---|
| 1534 | * |
|---|
| 1535 | \ This function dervies recontructed PU/CU chroma samples with QTree recursive structure |
|---|
| 1536 | */ |
|---|
| 1537 | Void |
|---|
| 1538 | TDecCu::xIntraChromaRecQT( TComDataCU* pcCU, |
|---|
| 1539 | UInt uiTrDepth, |
|---|
| 1540 | UInt uiAbsPartIdx, |
|---|
| 1541 | TComYuv* pcRecoYuv, |
|---|
| 1542 | TComYuv* pcPredYuv, |
|---|
| 1543 | TComYuv* pcResiYuv ) |
|---|
| 1544 | { |
|---|
| 1545 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
|---|
| 1546 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
|---|
| 1547 | if( uiTrMode == uiTrDepth ) |
|---|
| 1548 | { |
|---|
| 1549 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 ); |
|---|
| 1550 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 ); |
|---|
| 1551 | } |
|---|
| 1552 | else |
|---|
| 1553 | { |
|---|
| 1554 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
|---|
| 1555 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
|---|
| 1556 | { |
|---|
| 1557 | xIntraChromaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
|---|
| 1558 | } |
|---|
| 1559 | } |
|---|
| 1560 | } |
|---|
| 1561 | |
|---|
| 1562 | Void TDecCu::xCopyToPic( TComDataCU* pcCU, TComPic* pcPic, UInt uiZorderIdx, UInt uiDepth ) |
|---|
| 1563 | { |
|---|
| 1564 | UInt uiCUAddr = pcCU->getAddr(); |
|---|
| 1565 | |
|---|
| 1566 | m_ppcYuvReco[uiDepth]->copyToPicYuv ( pcPic->getPicYuvRec (), uiCUAddr, uiZorderIdx ); |
|---|
| 1567 | |
|---|
| 1568 | return; |
|---|
| 1569 | } |
|---|
| 1570 | |
|---|
| 1571 | Void TDecCu::xDecodeInterTexture ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 1572 | { |
|---|
| 1573 | UInt uiWidth = pcCU->getWidth ( uiAbsPartIdx ); |
|---|
| 1574 | UInt uiHeight = pcCU->getHeight( uiAbsPartIdx ); |
|---|
| 1575 | TCoeff* piCoeff; |
|---|
| 1576 | |
|---|
| 1577 | Pel* pResi; |
|---|
| 1578 | UInt trMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
|---|
| 1579 | |
|---|
| 1580 | // Y |
|---|
| 1581 | piCoeff = pcCU->getCoeffY(); |
|---|
| 1582 | pResi = m_ppcYuvResi[uiDepth]->getLumaAddr(); |
|---|
| 1583 | |
|---|
| 1584 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); |
|---|
| 1585 | |
|---|
| 1586 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, trMode, 0, piCoeff ); |
|---|
| 1587 | |
|---|
| 1588 | // Cb and Cr |
|---|
| 1589 | Int curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb(); |
|---|
| 1590 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset ); |
|---|
| 1591 | |
|---|
| 1592 | uiWidth >>= 1; |
|---|
| 1593 | uiHeight >>= 1; |
|---|
| 1594 | piCoeff = pcCU->getCoeffCb(); pResi = m_ppcYuvResi[uiDepth]->getCbAddr(); |
|---|
| 1595 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff ); |
|---|
| 1596 | |
|---|
| 1597 | curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr(); |
|---|
| 1598 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset ); |
|---|
| 1599 | |
|---|
| 1600 | piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr(); |
|---|
| 1601 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff ); |
|---|
| 1602 | } |
|---|
| 1603 | |
|---|
| 1604 | /** Function for deriving reconstructed luma/chroma samples of a PCM mode CU. |
|---|
| 1605 | * \param pcCU pointer to current CU |
|---|
| 1606 | * \param uiPartIdx part index |
|---|
| 1607 | * \param piPCM pointer to PCM code arrays |
|---|
| 1608 | * \param piReco pointer to reconstructed sample arrays |
|---|
| 1609 | * \param uiStride stride of reconstructed sample arrays |
|---|
| 1610 | * \param uiWidth CU width |
|---|
| 1611 | * \param uiHeight CU height |
|---|
| 1612 | * \param ttText texture component type |
|---|
| 1613 | * \returns Void |
|---|
| 1614 | */ |
|---|
| 1615 | Void TDecCu::xDecodePCMTexture( TComDataCU* pcCU, UInt uiPartIdx, Pel *piPCM, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType ttText) |
|---|
| 1616 | { |
|---|
| 1617 | UInt uiX, uiY; |
|---|
| 1618 | Pel* piPicReco; |
|---|
| 1619 | UInt uiPicStride; |
|---|
| 1620 | UInt uiPcmLeftShiftBit; |
|---|
| 1621 | |
|---|
| 1622 | if( ttText == TEXT_LUMA ) |
|---|
| 1623 | { |
|---|
| 1624 | uiPicStride = pcCU->getPic()->getPicYuvRec()->getStride(); |
|---|
| 1625 | piPicReco = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); |
|---|
| 1626 | uiPcmLeftShiftBit = g_bitDepthY - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma(); |
|---|
| 1627 | } |
|---|
| 1628 | else |
|---|
| 1629 | { |
|---|
| 1630 | uiPicStride = pcCU->getPic()->getPicYuvRec()->getCStride(); |
|---|
| 1631 | |
|---|
| 1632 | if( ttText == TEXT_CHROMA_U ) |
|---|
| 1633 | { |
|---|
| 1634 | piPicReco = pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); |
|---|
| 1635 | } |
|---|
| 1636 | else |
|---|
| 1637 | { |
|---|
| 1638 | piPicReco = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); |
|---|
| 1639 | } |
|---|
| 1640 | uiPcmLeftShiftBit = g_bitDepthC - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); |
|---|
| 1641 | } |
|---|
| 1642 | |
|---|
| 1643 | for( uiY = 0; uiY < uiHeight; uiY++ ) |
|---|
| 1644 | { |
|---|
| 1645 | for( uiX = 0; uiX < uiWidth; uiX++ ) |
|---|
| 1646 | { |
|---|
| 1647 | piReco[uiX] = (piPCM[uiX] << uiPcmLeftShiftBit); |
|---|
| 1648 | piPicReco[uiX] = piReco[uiX]; |
|---|
| 1649 | } |
|---|
| 1650 | piPCM += uiWidth; |
|---|
| 1651 | piReco += uiStride; |
|---|
| 1652 | piPicReco += uiPicStride; |
|---|
| 1653 | } |
|---|
| 1654 | } |
|---|
| 1655 | |
|---|
| 1656 | /** Function for reconstructing a PCM mode CU. |
|---|
| 1657 | * \param pcCU pointer to current CU |
|---|
| 1658 | * \param uiDepth CU Depth |
|---|
| 1659 | * \returns Void |
|---|
| 1660 | */ |
|---|
| 1661 | Void TDecCu::xReconPCM( TComDataCU* pcCU, UInt uiDepth ) |
|---|
| 1662 | { |
|---|
| 1663 | // Luma |
|---|
| 1664 | UInt uiWidth = (g_uiMaxCUWidth >> uiDepth); |
|---|
| 1665 | UInt uiHeight = (g_uiMaxCUHeight >> uiDepth); |
|---|
| 1666 | |
|---|
| 1667 | Pel* piPcmY = pcCU->getPCMSampleY(); |
|---|
| 1668 | Pel* piRecoY = m_ppcYuvReco[uiDepth]->getLumaAddr(0, uiWidth); |
|---|
| 1669 | |
|---|
| 1670 | UInt uiStride = m_ppcYuvResi[uiDepth]->getStride(); |
|---|
| 1671 | |
|---|
| 1672 | xDecodePCMTexture( pcCU, 0, piPcmY, piRecoY, uiStride, uiWidth, uiHeight, TEXT_LUMA); |
|---|
| 1673 | |
|---|
| 1674 | // Cb and Cr |
|---|
| 1675 | UInt uiCWidth = (uiWidth>>1); |
|---|
| 1676 | UInt uiCHeight = (uiHeight>>1); |
|---|
| 1677 | |
|---|
| 1678 | Pel* piPcmCb = pcCU->getPCMSampleCb(); |
|---|
| 1679 | Pel* piPcmCr = pcCU->getPCMSampleCr(); |
|---|
| 1680 | Pel* pRecoCb = m_ppcYuvReco[uiDepth]->getCbAddr(); |
|---|
| 1681 | Pel* pRecoCr = m_ppcYuvReco[uiDepth]->getCrAddr(); |
|---|
| 1682 | |
|---|
| 1683 | UInt uiCStride = m_ppcYuvReco[uiDepth]->getCStride(); |
|---|
| 1684 | |
|---|
| 1685 | xDecodePCMTexture( pcCU, 0, piPcmCb, pRecoCb, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_U); |
|---|
| 1686 | xDecodePCMTexture( pcCU, 0, piPcmCr, pRecoCr, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_V); |
|---|
| 1687 | } |
|---|
| 1688 | |
|---|
| 1689 | /** Function for filling the PCM buffer of a CU using its reconstructed sample array |
|---|
| 1690 | * \param pcCU pointer to current CU |
|---|
| 1691 | * \param uiDepth CU Depth |
|---|
| 1692 | * \returns Void |
|---|
| 1693 | */ |
|---|
| 1694 | Void TDecCu::xFillPCMBuffer(TComDataCU* pCU, UInt depth) |
|---|
| 1695 | { |
|---|
| 1696 | // Luma |
|---|
| 1697 | UInt width = (g_uiMaxCUWidth >> depth); |
|---|
| 1698 | UInt height = (g_uiMaxCUHeight >> depth); |
|---|
| 1699 | |
|---|
| 1700 | Pel* pPcmY = pCU->getPCMSampleY(); |
|---|
| 1701 | Pel* pRecoY = m_ppcYuvReco[depth]->getLumaAddr(0, width); |
|---|
| 1702 | |
|---|
| 1703 | UInt stride = m_ppcYuvReco[depth]->getStride(); |
|---|
| 1704 | |
|---|
| 1705 | for(Int y = 0; y < height; y++ ) |
|---|
| 1706 | { |
|---|
| 1707 | for(Int x = 0; x < width; x++ ) |
|---|
| 1708 | { |
|---|
| 1709 | pPcmY[x] = pRecoY[x]; |
|---|
| 1710 | } |
|---|
| 1711 | pPcmY += width; |
|---|
| 1712 | pRecoY += stride; |
|---|
| 1713 | } |
|---|
| 1714 | |
|---|
| 1715 | // Cb and Cr |
|---|
| 1716 | UInt widthC = (width>>1); |
|---|
| 1717 | UInt heightC = (height>>1); |
|---|
| 1718 | |
|---|
| 1719 | Pel* pPcmCb = pCU->getPCMSampleCb(); |
|---|
| 1720 | Pel* pPcmCr = pCU->getPCMSampleCr(); |
|---|
| 1721 | Pel* pRecoCb = m_ppcYuvReco[depth]->getCbAddr(); |
|---|
| 1722 | Pel* pRecoCr = m_ppcYuvReco[depth]->getCrAddr(); |
|---|
| 1723 | |
|---|
| 1724 | UInt strideC = m_ppcYuvReco[depth]->getCStride(); |
|---|
| 1725 | |
|---|
| 1726 | for(Int y = 0; y < heightC; y++ ) |
|---|
| 1727 | { |
|---|
| 1728 | for(Int x = 0; x < widthC; x++ ) |
|---|
| 1729 | { |
|---|
| 1730 | pPcmCb[x] = pRecoCb[x]; |
|---|
| 1731 | pPcmCr[x] = pRecoCr[x]; |
|---|
| 1732 | } |
|---|
| 1733 | pPcmCr += widthC; |
|---|
| 1734 | pPcmCb += widthC; |
|---|
| 1735 | pRecoCb += strideC; |
|---|
| 1736 | pRecoCr += strideC; |
|---|
| 1737 | } |
|---|
| 1738 | |
|---|
| 1739 | } |
|---|
| 1740 | |
|---|
| 1741 | //! \} |
|---|