[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 |
---|
[56] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[56] | 6 | * Copyright (c) 2010-2012, 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" |
---|
| 39 | |
---|
[189] | 40 | #if RWTH_SDC_DLT_B0036 |
---|
| 41 | #define GetDepthValue2Idx(val) (pcCU->getSlice()->getSPS()->depthValue2idx(val)) |
---|
| 42 | #define GetIdx2DepthValue(val) (pcCU->getSlice()->getSPS()->idx2DepthValue(val)) |
---|
| 43 | #endif |
---|
| 44 | |
---|
[56] | 45 | //! \ingroup TLibDecoder |
---|
| 46 | //! \{ |
---|
| 47 | |
---|
[2] | 48 | // ==================================================================================================================== |
---|
| 49 | // Constructor / destructor / create / destroy |
---|
| 50 | // ==================================================================================================================== |
---|
| 51 | |
---|
| 52 | TDecCu::TDecCu() |
---|
| 53 | { |
---|
[56] | 54 | m_ppcYuvResi = NULL; |
---|
| 55 | m_ppcYuvReco = NULL; |
---|
| 56 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 57 | m_ppcYuvResPred = NULL; |
---|
[56] | 58 | #endif |
---|
| 59 | m_ppcCU = NULL; |
---|
[2] | 60 | } |
---|
| 61 | |
---|
| 62 | TDecCu::~TDecCu() |
---|
| 63 | { |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | Void TDecCu::init( TDecEntropy* pcEntropyDecoder, TComTrQuant* pcTrQuant, TComPrediction* pcPrediction) |
---|
| 67 | { |
---|
| 68 | m_pcEntropyDecoder = pcEntropyDecoder; |
---|
| 69 | m_pcTrQuant = pcTrQuant; |
---|
| 70 | m_pcPrediction = pcPrediction; |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | /** |
---|
| 74 | \param uiMaxDepth total number of allowable depth |
---|
| 75 | \param uiMaxWidth largest CU width |
---|
| 76 | \param uiMaxHeight largest CU height |
---|
| 77 | */ |
---|
| 78 | Void TDecCu::create( UInt uiMaxDepth, UInt uiMaxWidth, UInt uiMaxHeight ) |
---|
| 79 | { |
---|
| 80 | m_uiMaxDepth = uiMaxDepth+1; |
---|
| 81 | |
---|
[56] | 82 | m_ppcYuvResi = new TComYuv*[m_uiMaxDepth-1]; |
---|
| 83 | m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1]; |
---|
| 84 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
| 85 | m_ppcYuvResPred = new TComYuv* [m_uiMaxDepth-1]; |
---|
| 86 | #endif |
---|
| 87 | m_ppcCU = new TComDataCU*[m_uiMaxDepth-1]; |
---|
[2] | 88 | |
---|
| 89 | UInt uiNumPartitions; |
---|
| 90 | for ( UInt ui = 0; ui < m_uiMaxDepth-1; ui++ ) |
---|
| 91 | { |
---|
| 92 | uiNumPartitions = 1<<( ( m_uiMaxDepth - ui - 1 )<<1 ); |
---|
| 93 | UInt uiWidth = uiMaxWidth >> ui; |
---|
| 94 | UInt uiHeight = uiMaxHeight >> ui; |
---|
| 95 | |
---|
[56] | 96 | m_ppcYuvResi[ui] = new TComYuv; m_ppcYuvResi[ui]->create( uiWidth, uiHeight ); |
---|
| 97 | m_ppcYuvReco[ui] = new TComYuv; m_ppcYuvReco[ui]->create( uiWidth, uiHeight ); |
---|
| 98 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 99 | m_ppcYuvResPred[ui] = new TComYuv; m_ppcYuvResPred[ui]->create( uiWidth, uiHeight ); |
---|
[56] | 100 | #endif |
---|
| 101 | m_ppcCU [ui] = new TComDataCU; m_ppcCU [ui]->create( uiNumPartitions, uiWidth, uiHeight, true, uiMaxWidth >> (m_uiMaxDepth - 1) ); |
---|
[2] | 102 | } |
---|
| 103 | |
---|
[56] | 104 | m_bDecodeDQP = false; |
---|
| 105 | |
---|
[2] | 106 | // initialize partition order. |
---|
| 107 | UInt* piTmp = &g_auiZscanToRaster[0]; |
---|
| 108 | initZscanToRaster(m_uiMaxDepth, 1, 0, piTmp); |
---|
| 109 | initRasterToZscan( uiMaxWidth, uiMaxHeight, m_uiMaxDepth ); |
---|
| 110 | |
---|
| 111 | // initialize conversion matrix from partition index to pel |
---|
| 112 | initRasterToPelXY( uiMaxWidth, uiMaxHeight, m_uiMaxDepth ); |
---|
[56] | 113 | initMotionReferIdx ( uiMaxWidth, uiMaxHeight, m_uiMaxDepth ); |
---|
[2] | 114 | } |
---|
| 115 | |
---|
| 116 | Void TDecCu::destroy() |
---|
| 117 | { |
---|
| 118 | for ( UInt ui = 0; ui < m_uiMaxDepth-1; ui++ ) |
---|
| 119 | { |
---|
[56] | 120 | m_ppcYuvResi[ui]->destroy(); delete m_ppcYuvResi[ui]; m_ppcYuvResi[ui] = NULL; |
---|
| 121 | m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL; |
---|
| 122 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 123 | m_ppcYuvResPred[ui]->destroy(); delete m_ppcYuvResPred[ui]; m_ppcYuvResPred[ui] = NULL; |
---|
[56] | 124 | #endif |
---|
| 125 | m_ppcCU [ui]->destroy(); delete m_ppcCU [ui]; m_ppcCU [ui] = NULL; |
---|
[2] | 126 | } |
---|
| 127 | |
---|
[56] | 128 | delete [] m_ppcYuvResi; m_ppcYuvResi = NULL; |
---|
| 129 | delete [] m_ppcYuvReco; m_ppcYuvReco = NULL; |
---|
| 130 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 131 | delete [] m_ppcYuvResPred; m_ppcYuvResPred = NULL; |
---|
[56] | 132 | #endif |
---|
| 133 | delete [] m_ppcCU ; m_ppcCU = NULL; |
---|
[2] | 134 | } |
---|
| 135 | |
---|
| 136 | // ==================================================================================================================== |
---|
| 137 | // Public member functions |
---|
| 138 | // ==================================================================================================================== |
---|
| 139 | |
---|
| 140 | /** \param pcCU pointer of CU data |
---|
| 141 | \param ruiIsLast last data? |
---|
| 142 | */ |
---|
| 143 | Void TDecCu::decodeCU( TComDataCU* pcCU, UInt& ruiIsLast ) |
---|
| 144 | { |
---|
[56] | 145 | if ( pcCU->getSlice()->getPPS()->getUseDQP() ) |
---|
[2] | 146 | { |
---|
[56] | 147 | setdQPFlag(true); |
---|
[2] | 148 | } |
---|
[56] | 149 | |
---|
| 150 | #if BURST_IPCM |
---|
| 151 | pcCU->setNumSucIPCM(0); |
---|
| 152 | #endif |
---|
| 153 | |
---|
[2] | 154 | // start from the top level CU |
---|
[56] | 155 | xDecodeCU( pcCU, 0, 0, ruiIsLast); |
---|
[2] | 156 | } |
---|
| 157 | |
---|
| 158 | /** \param pcCU pointer of CU data |
---|
| 159 | */ |
---|
| 160 | Void TDecCu::decompressCU( TComDataCU* pcCU ) |
---|
| 161 | { |
---|
| 162 | xDecompressCU( pcCU, pcCU, 0, 0 ); |
---|
| 163 | } |
---|
| 164 | |
---|
| 165 | // ==================================================================================================================== |
---|
| 166 | // Protected member functions |
---|
| 167 | // ==================================================================================================================== |
---|
| 168 | |
---|
[56] | 169 | /**decode end-of-slice flag |
---|
| 170 | * \param pcCU |
---|
| 171 | * \param uiAbsPartIdx |
---|
| 172 | * \param uiDepth |
---|
| 173 | * \returns Bool |
---|
| 174 | */ |
---|
| 175 | Bool TDecCu::xDecodeSliceEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth) { |
---|
| 176 | UInt uiIsLast; |
---|
| 177 | TComPic* pcPic = pcCU->getPic(); |
---|
| 178 | TComSlice * pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx()); |
---|
| 179 | UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1); |
---|
| 180 | UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples(); |
---|
| 181 | UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples(); |
---|
| 182 | UInt uiGranularityWidth = g_uiMaxCUWidth>>(pcSlice->getPPS()->getSliceGranularity()); |
---|
| 183 | UInt uiPosX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
| 184 | UInt uiPosY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
| 185 | |
---|
| 186 | #if HHI_MPI |
---|
| 187 | const UInt uiCUWidth = pcCU->getTextureModeDepth( uiAbsPartIdx ) != -1 ? g_uiMaxCUWidth>>uiDepth : pcCU->getWidth (uiAbsPartIdx); |
---|
| 188 | const UInt uiCUHeight = pcCU->getTextureModeDepth( uiAbsPartIdx ) != -1 ? g_uiMaxCUHeight>>uiDepth : pcCU->getHeight(uiAbsPartIdx); |
---|
| 189 | if(((uiPosX+uiCUWidth)%uiGranularityWidth==0||(uiPosX+uiCUWidth==uiWidth)) |
---|
| 190 | &&((uiPosY+uiCUHeight)%uiGranularityWidth==0||(uiPosY+uiCUHeight==uiHeight))) |
---|
| 191 | #else |
---|
| 192 | if(((uiPosX+pcCU->getWidth(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosX+pcCU->getWidth(uiAbsPartIdx)==uiWidth)) |
---|
| 193 | &&((uiPosY+pcCU->getHeight(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosY+pcCU->getHeight(uiAbsPartIdx)==uiHeight))) |
---|
| 194 | #endif |
---|
| 195 | { |
---|
| 196 | m_pcEntropyDecoder->decodeTerminatingBit( uiIsLast ); |
---|
| 197 | } |
---|
| 198 | else |
---|
| 199 | { |
---|
| 200 | uiIsLast=0; |
---|
| 201 | } |
---|
| 202 | |
---|
| 203 | if(uiIsLast) |
---|
| 204 | { |
---|
| 205 | if(pcSlice->isNextEntropySlice()&&!pcSlice->isNextSlice()) |
---|
| 206 | { |
---|
| 207 | pcSlice->setEntropySliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts); |
---|
| 208 | } |
---|
| 209 | else |
---|
| 210 | { |
---|
| 211 | pcSlice->setSliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts); |
---|
| 212 | pcSlice->setEntropySliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts); |
---|
| 213 | } |
---|
| 214 | } |
---|
| 215 | |
---|
| 216 | return uiIsLast>0; |
---|
| 217 | } |
---|
| 218 | |
---|
[2] | 219 | /** decode CU block recursively |
---|
| 220 | * \param pcCU |
---|
| 221 | * \param uiAbsPartIdx |
---|
| 222 | * \param uiDepth |
---|
| 223 | * \returns Void |
---|
| 224 | */ |
---|
[56] | 225 | |
---|
| 226 | Void TDecCu::xDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast) |
---|
[2] | 227 | { |
---|
| 228 | TComPic* pcPic = pcCU->getPic(); |
---|
| 229 | UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1); |
---|
| 230 | UInt uiQNumParts = uiCurNumParts>>2; |
---|
| 231 | |
---|
| 232 | Bool bBoundary = false; |
---|
| 233 | UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
| 234 | UInt uiRPelX = uiLPelX + (g_uiMaxCUWidth>>uiDepth) - 1; |
---|
| 235 | UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
| 236 | UInt uiBPelY = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1; |
---|
[56] | 237 | |
---|
| 238 | TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx()); |
---|
| 239 | Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getEntropySliceCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getEntropySliceCurStartCUAddr(); |
---|
| 240 | if((!bStartInCU) && ( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) |
---|
[2] | 241 | { |
---|
[56] | 242 | #if BURST_IPCM |
---|
| 243 | if(pcCU->getNumSucIPCM() == 0) |
---|
| 244 | { |
---|
[5] | 245 | #if HHI_MPI |
---|
[56] | 246 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth < pcCU->getTextureModeDepth( uiAbsPartIdx ) ) |
---|
| 247 | #endif |
---|
| 248 | m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 249 | } |
---|
| 250 | else |
---|
| 251 | { |
---|
| 252 | pcCU->setDepthSubParts( uiDepth, uiAbsPartIdx ); |
---|
| 253 | } |
---|
| 254 | #else |
---|
| 255 | #if HHI_MPI |
---|
[2] | 256 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth < pcCU->getTextureModeDepth( uiAbsPartIdx ) ) |
---|
[5] | 257 | #endif |
---|
[56] | 258 | m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 259 | #endif |
---|
[2] | 260 | } |
---|
| 261 | else |
---|
| 262 | { |
---|
| 263 | bBoundary = true; |
---|
| 264 | } |
---|
| 265 | |
---|
| 266 | if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ) |
---|
| 267 | { |
---|
| 268 | UInt uiIdx = uiAbsPartIdx; |
---|
[56] | 269 | if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
---|
| 270 | { |
---|
| 271 | setdQPFlag(true); |
---|
| 272 | pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
| 273 | } |
---|
| 274 | |
---|
[2] | 275 | for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ ) |
---|
| 276 | { |
---|
| 277 | uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 278 | uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 279 | |
---|
[56] | 280 | Bool bSubInSlice = pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getEntropySliceCurStartCUAddr(); |
---|
| 281 | if ( bSubInSlice ) |
---|
| 282 | { |
---|
| 283 | if ( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) ) |
---|
| 284 | { |
---|
| 285 | xDecodeCU( pcCU, uiIdx, uiDepth+1, ruiIsLast ); |
---|
| 286 | } |
---|
| 287 | else |
---|
| 288 | { |
---|
| 289 | pcCU->setOutsideCUPart( uiIdx, uiDepth+1 ); |
---|
| 290 | } |
---|
| 291 | } |
---|
| 292 | if(ruiIsLast) |
---|
| 293 | { |
---|
| 294 | break; |
---|
| 295 | } |
---|
[2] | 296 | |
---|
| 297 | uiIdx += uiQNumParts; |
---|
| 298 | } |
---|
[56] | 299 | if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
---|
| 300 | { |
---|
| 301 | if ( getdQPFlag() ) |
---|
| 302 | { |
---|
| 303 | UInt uiQPSrcPartIdx; |
---|
| 304 | if ( pcPic->getCU( pcCU->getAddr() )->getEntropySliceStartCU(uiAbsPartIdx) != pcSlice->getEntropySliceCurStartCUAddr() ) |
---|
| 305 | { |
---|
| 306 | uiQPSrcPartIdx = pcSlice->getEntropySliceCurStartCUAddr() % pcPic->getNumPartInCU(); |
---|
| 307 | } |
---|
| 308 | else |
---|
| 309 | { |
---|
| 310 | uiQPSrcPartIdx = uiAbsPartIdx; |
---|
| 311 | } |
---|
| 312 | pcCU->setQPSubParts( pcCU->getRefQP( uiQPSrcPartIdx ), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
| 313 | } |
---|
| 314 | } |
---|
[2] | 315 | return; |
---|
| 316 | } |
---|
| 317 | |
---|
[56] | 318 | if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
---|
| 319 | { |
---|
| 320 | setdQPFlag(true); |
---|
| 321 | pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
| 322 | } |
---|
| 323 | |
---|
[2] | 324 | // decode CU mode and the partition size |
---|
[56] | 325 | #if BURST_IPCM |
---|
| 326 | if( !pcCU->getSlice()->isIntra() && pcCU->getNumSucIPCM() == 0 ) |
---|
[5] | 327 | #else |
---|
| 328 | if( !pcCU->getSlice()->isIntra() ) |
---|
| 329 | #endif |
---|
[56] | 330 | #if HHI_MPI |
---|
| 331 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 ) |
---|
| 332 | #endif |
---|
[2] | 333 | { |
---|
| 334 | m_pcEntropyDecoder->decodeSkipFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 335 | } |
---|
[56] | 336 | |
---|
[2] | 337 | if( pcCU->isSkipped(uiAbsPartIdx) ) |
---|
| 338 | { |
---|
| 339 | m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); |
---|
| 340 | m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); |
---|
[56] | 341 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 342 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists |
---|
| 343 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; |
---|
| 344 | Int numValidMergeCand = 0; |
---|
| 345 | for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS_MEM; ++ui ) |
---|
| 346 | #else |
---|
[2] | 347 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists |
---|
| 348 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; |
---|
[56] | 349 | Int numValidMergeCand = 0; |
---|
[2] | 350 | for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui ) |
---|
[56] | 351 | #endif |
---|
[2] | 352 | { |
---|
| 353 | uhInterDirNeighbours[ui] = 0; |
---|
| 354 | } |
---|
| 355 | m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, SIZE_2Nx2N, uhInterDirNeighbours, cMvFieldNeighbours, uiDepth ); |
---|
[5] | 356 | #if HHI_MPI |
---|
[2] | 357 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == uiDepth ) |
---|
| 358 | { |
---|
| 359 | TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); |
---|
| 360 | pcCU->copyTextureMotionDataFrom( pcTextureCU, uiDepth, pcCU->getZorderIdxInCU() + uiAbsPartIdx, uiAbsPartIdx ); |
---|
| 361 | |
---|
| 362 | UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); |
---|
| 363 | for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 364 | { |
---|
[56] | 365 | const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) ); |
---|
[2] | 366 | pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_SKIP ); |
---|
| 367 | pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N ); |
---|
| 368 | pcCU->setDepth( uiAbsPartIdx + ui, uhNewDepth ); |
---|
| 369 | pcCU->setWidth( uiAbsPartIdx + ui, g_uiMaxCUWidth>>uhNewDepth ); |
---|
| 370 | pcCU->setHeight( uiAbsPartIdx + ui, g_uiMaxCUHeight>>uhNewDepth ); |
---|
| 371 | } |
---|
| 372 | } |
---|
[56] | 373 | else |
---|
| 374 | { |
---|
[2] | 375 | #endif |
---|
[56] | 376 | #if SIMP_MRG_PRUN |
---|
| 377 | UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx); |
---|
| 378 | m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
---|
| 379 | #else |
---|
| 380 | m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); |
---|
| 381 | UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx); |
---|
| 382 | #endif |
---|
| 383 | pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); |
---|
| 384 | |
---|
| 385 | TComMv cTmpMv( 0, 0 ); |
---|
| 386 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
| 387 | { |
---|
| 388 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
---|
| 389 | { |
---|
| 390 | pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiAbsPartIdx, 0, uiDepth); |
---|
| 391 | pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiAbsPartIdx, 0, uiDepth); |
---|
| 392 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
| 393 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
| 394 | } |
---|
| 395 | } |
---|
[189] | 396 | #if LGE_ILLUCOMP_B0045 |
---|
| 397 | m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 398 | #endif |
---|
[56] | 399 | #if HHI_MPI |
---|
| 400 | } |
---|
| 401 | #endif |
---|
[244] | 402 | #if HHI_INTER_VIEW_RESIDUAL_PRED && !MTK_MDIVRP_C0138 |
---|
[2] | 403 | m_pcEntropyDecoder->decodeResPredFlag( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth], 0 ); |
---|
[5] | 404 | #endif |
---|
[56] | 405 | xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); |
---|
[2] | 406 | return; |
---|
| 407 | } |
---|
| 408 | |
---|
[5] | 409 | #if HHI_MPI |
---|
[2] | 410 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 ) |
---|
| 411 | { |
---|
[5] | 412 | #endif |
---|
[56] | 413 | #if BURST_IPCM |
---|
| 414 | if( pcCU->getNumSucIPCM() == 0 ) |
---|
| 415 | { |
---|
[2] | 416 | m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 417 | m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth ); |
---|
[56] | 418 | } |
---|
| 419 | else |
---|
| 420 | { |
---|
| 421 | pcCU->setPredModeSubParts( MODE_INTRA, uiAbsPartIdx, uiDepth ); |
---|
| 422 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
| 423 | pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
| 424 | pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth ); |
---|
| 425 | } |
---|
| 426 | #else |
---|
| 427 | m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 428 | m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 429 | #endif |
---|
[2] | 430 | |
---|
[56] | 431 | if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) |
---|
| 432 | { |
---|
| 433 | m_pcEntropyDecoder->decodeIPCMInfo( pcCU, uiAbsPartIdx, uiDepth ); |
---|
[2] | 434 | |
---|
[56] | 435 | if(pcCU->getIPCMFlag(uiAbsPartIdx)) |
---|
[2] | 436 | { |
---|
[56] | 437 | xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); |
---|
| 438 | return; |
---|
| 439 | } |
---|
| 440 | } |
---|
| 441 | |
---|
| 442 | #if ! HHI_MPI |
---|
| 443 | UInt uiCurrWidth = pcCU->getWidth ( uiAbsPartIdx ); |
---|
| 444 | UInt uiCurrHeight = pcCU->getHeight( uiAbsPartIdx ); |
---|
| 445 | #endif |
---|
| 446 | |
---|
| 447 | // prediction mode ( Intra : direction mode, Inter : Mv, reference idx ) |
---|
| 448 | m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]); |
---|
| 449 | |
---|
[189] | 450 | #if LGE_ILLUCOMP_B0045 |
---|
| 451 | m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 452 | #endif |
---|
| 453 | |
---|
[244] | 454 | #if HHI_INTER_VIEW_RESIDUAL_PRED && !MTK_MDIVRP_C0138 |
---|
[56] | 455 | if( !pcCU->isIntra( uiAbsPartIdx ) ) |
---|
| 456 | { |
---|
| 457 | m_pcEntropyDecoder->decodeResPredFlag ( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth], 0 ); |
---|
| 458 | } |
---|
[5] | 459 | #endif |
---|
[2] | 460 | |
---|
[56] | 461 | #if HHI_MPI |
---|
[2] | 462 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == uiDepth ) |
---|
| 463 | { |
---|
| 464 | assert( pcCU->getZorderIdxInCU() == 0 ); |
---|
| 465 | TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); |
---|
| 466 | pcCU->copyTextureMotionDataFrom( pcTextureCU, uiDepth, pcCU->getZorderIdxInCU() + uiAbsPartIdx, uiAbsPartIdx ); |
---|
| 467 | |
---|
| 468 | UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); |
---|
| 469 | for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 470 | { |
---|
[56] | 471 | const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) ); |
---|
[2] | 472 | pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_INTER ); |
---|
| 473 | pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N ); |
---|
| 474 | pcCU->setDepth( uiAbsPartIdx + ui, uhNewDepth ); |
---|
| 475 | pcCU->setWidth( uiAbsPartIdx + ui, g_uiMaxCUWidth>>uhNewDepth ); |
---|
| 476 | pcCU->setHeight( uiAbsPartIdx + ui, g_uiMaxCUHeight>>uhNewDepth ); |
---|
| 477 | } |
---|
| 478 | |
---|
| 479 | if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ) |
---|
| 480 | { |
---|
| 481 | UInt uiIdx = uiAbsPartIdx; |
---|
[56] | 482 | if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
---|
| 483 | { |
---|
| 484 | setdQPFlag(true); |
---|
| 485 | pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
| 486 | } |
---|
| 487 | |
---|
[2] | 488 | for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ ) |
---|
| 489 | { |
---|
| 490 | uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 491 | uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 492 | |
---|
[56] | 493 | Bool bSubInSlice = pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getEntropySliceCurStartCUAddr(); |
---|
| 494 | if ( bSubInSlice ) |
---|
| 495 | { |
---|
| 496 | if ( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) ) |
---|
| 497 | { |
---|
| 498 | xDecodeCU( pcCU, uiIdx, uiDepth+1, ruiIsLast ); |
---|
| 499 | } |
---|
| 500 | else |
---|
| 501 | { |
---|
| 502 | pcCU->setOutsideCUPart( uiIdx, uiDepth+1 ); |
---|
| 503 | } |
---|
| 504 | } |
---|
| 505 | if(ruiIsLast) |
---|
| 506 | { |
---|
| 507 | break; |
---|
| 508 | } |
---|
[2] | 509 | uiIdx += uiQNumParts; |
---|
| 510 | } |
---|
[56] | 511 | if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
---|
| 512 | { |
---|
| 513 | if ( getdQPFlag() ) |
---|
| 514 | { |
---|
| 515 | UInt uiQPSrcPartIdx; |
---|
| 516 | if ( pcPic->getCU( pcCU->getAddr() )->getEntropySliceStartCU(uiAbsPartIdx) != pcSlice->getEntropySliceCurStartCUAddr() ) |
---|
| 517 | { |
---|
| 518 | uiQPSrcPartIdx = pcSlice->getEntropySliceCurStartCUAddr() % pcPic->getNumPartInCU(); |
---|
| 519 | } |
---|
| 520 | else |
---|
| 521 | { |
---|
| 522 | uiQPSrcPartIdx = uiAbsPartIdx; |
---|
| 523 | } |
---|
| 524 | pcCU->setQPSubParts( pcCU->getRefQP( uiQPSrcPartIdx ), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
| 525 | } |
---|
| 526 | } |
---|
[2] | 527 | return; |
---|
| 528 | } |
---|
| 529 | } |
---|
[5] | 530 | } |
---|
| 531 | |
---|
[2] | 532 | UInt uiCurrWidth = pcCU->getWidth ( uiAbsPartIdx ); |
---|
| 533 | UInt uiCurrHeight = pcCU->getHeight( uiAbsPartIdx ); |
---|
[56] | 534 | #endif |
---|
| 535 | |
---|
[2] | 536 | // Coefficient decoding |
---|
[56] | 537 | Bool bCodeDQP = getdQPFlag(); |
---|
| 538 | m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, uiCurrWidth, uiCurrHeight, bCodeDQP ); |
---|
| 539 | setdQPFlag( bCodeDQP ); |
---|
| 540 | xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); |
---|
[2] | 541 | } |
---|
| 542 | |
---|
[56] | 543 | Void TDecCu::xFinishDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast) |
---|
| 544 | { |
---|
| 545 | if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
---|
| 546 | { |
---|
| 547 | if( getdQPFlag() ) |
---|
| 548 | { |
---|
| 549 | pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
| 550 | } |
---|
| 551 | } |
---|
| 552 | |
---|
| 553 | #if BURST_IPCM |
---|
| 554 | if( pcCU->getNumSucIPCM() > 0 ) |
---|
| 555 | { |
---|
| 556 | ruiIsLast = 0; |
---|
| 557 | return; |
---|
| 558 | } |
---|
| 559 | #endif |
---|
| 560 | |
---|
| 561 | ruiIsLast = xDecodeSliceEnd( pcCU, uiAbsPartIdx, uiDepth); |
---|
| 562 | } |
---|
| 563 | |
---|
[2] | 564 | Void TDecCu::xDecompressCU( TComDataCU* pcCU, TComDataCU* pcCUCur, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 565 | { |
---|
| 566 | TComPic* pcPic = pcCU->getPic(); |
---|
| 567 | |
---|
| 568 | Bool bBoundary = false; |
---|
| 569 | UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
| 570 | UInt uiRPelX = uiLPelX + (g_uiMaxCUWidth>>uiDepth) - 1; |
---|
| 571 | UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
| 572 | UInt uiBPelY = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1; |
---|
| 573 | |
---|
[56] | 574 | UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1); |
---|
| 575 | TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx()); |
---|
| 576 | Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getEntropySliceCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getEntropySliceCurStartCUAddr(); |
---|
| 577 | if(bStartInCU||( uiRPelX >= pcSlice->getSPS()->getPicWidthInLumaSamples() ) || ( uiBPelY >= pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) |
---|
[2] | 578 | { |
---|
| 579 | bBoundary = true; |
---|
| 580 | } |
---|
| 581 | |
---|
| 582 | if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ) |
---|
| 583 | { |
---|
| 584 | UInt uiNextDepth = uiDepth + 1; |
---|
| 585 | UInt uiQNumParts = pcCU->getTotalNumPart() >> (uiNextDepth<<1); |
---|
| 586 | UInt uiIdx = uiAbsPartIdx; |
---|
| 587 | for ( UInt uiPartIdx = 0; uiPartIdx < 4; uiPartIdx++ ) |
---|
| 588 | { |
---|
| 589 | uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 590 | uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 591 | |
---|
[56] | 592 | Bool binSlice = (pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getEntropySliceCurStartCUAddr())&&(pcCU->getSCUAddr()+uiIdx<pcSlice->getEntropySliceCurEndCUAddr()); |
---|
| 593 | if(binSlice&&( uiLPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) |
---|
| 594 | { |
---|
[2] | 595 | xDecompressCU(pcCU, m_ppcCU[uiNextDepth], uiIdx, uiNextDepth ); |
---|
[56] | 596 | } |
---|
[2] | 597 | |
---|
| 598 | uiIdx += uiQNumParts; |
---|
| 599 | } |
---|
| 600 | return; |
---|
| 601 | } |
---|
| 602 | |
---|
| 603 | // Residual reconstruction |
---|
| 604 | m_ppcYuvResi[uiDepth]->clear(); |
---|
| 605 | |
---|
| 606 | m_ppcCU[uiDepth]->copySubCU( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 607 | |
---|
| 608 | switch( m_ppcCU[uiDepth]->getPredictionMode(0) ) |
---|
| 609 | { |
---|
| 610 | case MODE_SKIP: |
---|
| 611 | case MODE_INTER: |
---|
| 612 | xReconInter( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth ); |
---|
| 613 | break; |
---|
| 614 | case MODE_INTRA: |
---|
[189] | 615 | #if RWTH_SDC_DLT_B0036 |
---|
| 616 | if( m_ppcCU[uiDepth]->getSDCFlag(0) ) |
---|
| 617 | xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth ); |
---|
| 618 | else |
---|
| 619 | #endif |
---|
[2] | 620 | xReconIntraQT( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth ); |
---|
| 621 | break; |
---|
| 622 | default: |
---|
| 623 | assert(0); |
---|
| 624 | break; |
---|
| 625 | } |
---|
[56] | 626 | #if LOSSLESS_CODING |
---|
| 627 | if ( m_ppcCU[uiDepth]->isLosslessCoded(0) && (m_ppcCU[uiDepth]->getIPCMFlag(0) == false)) |
---|
| 628 | { |
---|
| 629 | xFillPCMBuffer(m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth); |
---|
| 630 | } |
---|
| 631 | #endif |
---|
[2] | 632 | |
---|
| 633 | xCopyToPic( m_ppcCU[uiDepth], pcPic, uiAbsPartIdx, uiDepth ); |
---|
| 634 | } |
---|
| 635 | |
---|
| 636 | Void TDecCu::xReconInter( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 637 | { |
---|
[5] | 638 | #if HHI_MPI |
---|
[189] | 639 | #if FIX_MPI_B0065 |
---|
[2] | 640 | if( pcCU->getTextureModeDepth( 0 ) != -1 ) |
---|
[189] | 641 | { |
---|
| 642 | TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); |
---|
| 643 | if( uiDepth == pcTextureCU->getDepth(uiAbsPartIdx)) |
---|
| 644 | { |
---|
| 645 | PartSize partSize = pcTextureCU->getPartitionSize(uiAbsPartIdx); |
---|
| 646 | pcCU->setPartSizeSubParts( partSize, 0, uiDepth ); |
---|
| 647 | } |
---|
| 648 | else |
---|
| 649 | { |
---|
| 650 | pcCU->setPartSizeSubParts( SIZE_NxN, 0, uiDepth ); |
---|
| 651 | } |
---|
| 652 | } |
---|
| 653 | #else |
---|
| 654 | if( pcCU->getTextureModeDepth( 0 ) != -1 ) |
---|
[2] | 655 | pcCU->setPartSizeSubParts( SIZE_NxN, 0, uiDepth ); |
---|
| 656 | #endif |
---|
[189] | 657 | #endif |
---|
[2] | 658 | |
---|
| 659 | // inter prediction |
---|
| 660 | m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] ); |
---|
| 661 | |
---|
[244] | 662 | #if MTK_MDIVRP_C0138 |
---|
| 663 | if (pcCU->getMergeFlag(0) && pcCU->getMergeIndex(0)==0 && pcCU->getResPredAvail(0)) |
---|
| 664 | { |
---|
| 665 | m_pcPrediction->residualPrediction(pcCU, m_ppcYuvReco[uiDepth], m_ppcYuvResPred[uiDepth]); |
---|
| 666 | } |
---|
| 667 | #endif |
---|
| 668 | |
---|
[5] | 669 | #if HHI_MPI |
---|
[2] | 670 | if( pcCU->getTextureModeDepth( 0 ) != -1 ) |
---|
| 671 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); |
---|
| 672 | #endif |
---|
[56] | 673 | |
---|
[244] | 674 | #if HHI_INTER_VIEW_RESIDUAL_PRED && !MTK_MDIVRP_C0138 |
---|
[2] | 675 | if( pcCU->getResPredFlag( 0 ) ) |
---|
| 676 | { |
---|
| 677 | AOF( pcCU->getResPredAvail( 0 ) ); |
---|
[77] | 678 | Bool bOK = pcCU->getResidualSamples( 0, |
---|
| 679 | #if QC_SIMPLIFIEDIVRP_M24938 |
---|
| 680 | true, |
---|
| 681 | #endif |
---|
| 682 | m_ppcYuvResPred[uiDepth] ); |
---|
[2] | 683 | AOF( bOK ); |
---|
[77] | 684 | #if LG_RESTRICTEDRESPRED_M24766 |
---|
[100] | 685 | Int iPUResiPredShift[4]; |
---|
| 686 | pcCU->getPUResiPredShift(iPUResiPredShift, 0); |
---|
| 687 | m_ppcYuvReco[uiDepth]->add(iPUResiPredShift, pcCU->getPartitionSize(0), m_ppcYuvResPred[uiDepth], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) ); |
---|
[77] | 688 | #else |
---|
[2] | 689 | m_ppcYuvReco[uiDepth]->add( m_ppcYuvResPred[uiDepth], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) ); |
---|
[77] | 690 | #endif |
---|
[2] | 691 | } |
---|
[5] | 692 | #endif |
---|
| 693 | |
---|
[2] | 694 | // inter recon |
---|
| 695 | xDecodeInterTexture( pcCU, 0, uiDepth ); |
---|
| 696 | |
---|
| 697 | // clip for only non-zero cbp case |
---|
| 698 | if ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V ) ) ) |
---|
| 699 | { |
---|
| 700 | m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) ); |
---|
| 701 | } |
---|
| 702 | else |
---|
| 703 | { |
---|
[5] | 704 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[244] | 705 | #if MTK_MDIVRP_C0138 |
---|
| 706 | if (pcCU->getMergeFlag(0) && pcCU->getMergeIndex(0)==0 && pcCU->getResPredAvail(0)) |
---|
| 707 | #else |
---|
[2] | 708 | if( pcCU->getResPredFlag( 0 ) ) |
---|
[244] | 709 | #endif |
---|
[2] | 710 | { |
---|
| 711 | m_ppcYuvReco[uiDepth]->clip( pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) ); |
---|
| 712 | } |
---|
[5] | 713 | #endif |
---|
[2] | 714 | m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 )); |
---|
| 715 | } |
---|
| 716 | } |
---|
| 717 | |
---|
| 718 | Void |
---|
| 719 | TDecCu::xIntraRecLumaBlk( TComDataCU* pcCU, |
---|
| 720 | UInt uiTrDepth, |
---|
| 721 | UInt uiAbsPartIdx, |
---|
| 722 | TComYuv* pcRecoYuv, |
---|
| 723 | TComYuv* pcPredYuv, |
---|
| 724 | TComYuv* pcResiYuv ) |
---|
| 725 | { |
---|
| 726 | UInt uiWidth = pcCU ->getWidth ( 0 ) >> uiTrDepth; |
---|
| 727 | UInt uiHeight = pcCU ->getHeight ( 0 ) >> uiTrDepth; |
---|
| 728 | UInt uiStride = pcRecoYuv->getStride (); |
---|
| 729 | Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 730 | Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 731 | Pel* piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 732 | |
---|
| 733 | UInt uiNumCoeffInc = ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ); |
---|
| 734 | TCoeff* pcCoeff = pcCU->getCoeffY() + ( uiNumCoeffInc * uiAbsPartIdx ); |
---|
| 735 | |
---|
| 736 | UInt uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); |
---|
| 737 | |
---|
| 738 | UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
| 739 | Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); |
---|
| 740 | UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); |
---|
| 741 | |
---|
| 742 | //===== init availability pattern ===== |
---|
| 743 | Bool bAboveAvail = false; |
---|
| 744 | Bool bLeftAvail = false; |
---|
| 745 | pcCU->getPattern()->initPattern ( pcCU, uiTrDepth, uiAbsPartIdx ); |
---|
| 746 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, |
---|
| 747 | m_pcPrediction->getPredicBuf (), |
---|
| 748 | m_pcPrediction->getPredicBufWidth (), |
---|
| 749 | m_pcPrediction->getPredicBufHeight (), |
---|
| 750 | bAboveAvail, bLeftAvail ); |
---|
[189] | 751 | #if LGE_EDGE_INTRA_A0070 |
---|
[100] | 752 | if( uiLumaPredMode >= EDGE_INTRA_IDX ) |
---|
| 753 | { |
---|
| 754 | m_pcPrediction->predIntraLumaEdge( pcCU, pcCU->getPattern(), uiAbsPartIdx, uiWidth, uiHeight, piPred, uiStride |
---|
| 755 | #if LGE_EDGE_INTRA_DELTA_DC |
---|
| 756 | , uiLumaPredMode == EDGE_INTRA_DELTA_IDX |
---|
| 757 | #endif |
---|
| 758 | ); |
---|
| 759 | } |
---|
| 760 | else |
---|
| 761 | #endif |
---|
[2] | 762 | |
---|
[56] | 763 | //===== get prediction signal ===== |
---|
[5] | 764 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[56] | 765 | if( uiLumaPredMode >= NUM_INTRA_MODE ) |
---|
[2] | 766 | { |
---|
| 767 | m_pcPrediction->predIntraLumaDMM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, false ); |
---|
| 768 | } |
---|
| 769 | else |
---|
[56] | 770 | { |
---|
[2] | 771 | #endif |
---|
| 772 | m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
[56] | 773 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[2] | 774 | } |
---|
[56] | 775 | #endif |
---|
| 776 | |
---|
[2] | 777 | //===== inverse transform ===== |
---|
[56] | 778 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 779 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); |
---|
[2] | 780 | #else |
---|
[56] | 781 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 ); |
---|
| 782 | #endif |
---|
[2] | 783 | |
---|
[56] | 784 | Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA]; |
---|
| 785 | assert(scalingListType < 6); |
---|
| 786 | #if LOSSLESS_CODING |
---|
| 787 | m_pcTrQuant->invtransformNxN( pcCU, TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); |
---|
| 788 | #else |
---|
| 789 | m_pcTrQuant->invtransformNxN( TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); |
---|
| 790 | #endif |
---|
| 791 | |
---|
[2] | 792 | |
---|
| 793 | //===== reconstruction ===== |
---|
[56] | 794 | Pel* pPred = piPred; |
---|
| 795 | Pel* pResi = piResi; |
---|
| 796 | Pel* pReco = piReco; |
---|
| 797 | Pel* pRecIPred = piRecIPred; |
---|
| 798 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
[2] | 799 | { |
---|
[56] | 800 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
[2] | 801 | { |
---|
[56] | 802 | pReco [ uiX ] = Clip( pPred[ uiX ] + pResi[ uiX ] ); |
---|
| 803 | pRecIPred[ uiX ] = pReco[ uiX ]; |
---|
[2] | 804 | } |
---|
[56] | 805 | pPred += uiStride; |
---|
| 806 | pResi += uiStride; |
---|
| 807 | pReco += uiStride; |
---|
| 808 | pRecIPred += uiRecIPredStride; |
---|
[2] | 809 | } |
---|
| 810 | } |
---|
| 811 | |
---|
| 812 | |
---|
| 813 | Void |
---|
| 814 | TDecCu::xIntraRecChromaBlk( TComDataCU* pcCU, |
---|
| 815 | UInt uiTrDepth, |
---|
| 816 | UInt uiAbsPartIdx, |
---|
| 817 | TComYuv* pcRecoYuv, |
---|
| 818 | TComYuv* pcPredYuv, |
---|
| 819 | TComYuv* pcResiYuv, |
---|
| 820 | UInt uiChromaId ) |
---|
| 821 | { |
---|
| 822 | UInt uiFullDepth = pcCU->getDepth( 0 ) + uiTrDepth; |
---|
| 823 | UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiFullDepth ] + 2; |
---|
[56] | 824 | |
---|
| 825 | if( uiLog2TrSize == 2 ) |
---|
[2] | 826 | { |
---|
| 827 | assert( uiTrDepth > 0 ); |
---|
| 828 | uiTrDepth--; |
---|
| 829 | UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth( 0 ) + uiTrDepth ) << 1 ); |
---|
| 830 | Bool bFirstQ = ( ( uiAbsPartIdx % uiQPDiv ) == 0 ); |
---|
| 831 | if( !bFirstQ ) |
---|
| 832 | { |
---|
| 833 | return; |
---|
| 834 | } |
---|
| 835 | } |
---|
| 836 | |
---|
| 837 | TextType eText = ( uiChromaId > 0 ? TEXT_CHROMA_V : TEXT_CHROMA_U ); |
---|
| 838 | UInt uiWidth = pcCU ->getWidth ( 0 ) >> ( uiTrDepth + 1 ); |
---|
| 839 | UInt uiHeight = pcCU ->getHeight ( 0 ) >> ( uiTrDepth + 1 ); |
---|
| 840 | UInt uiStride = pcRecoYuv->getCStride (); |
---|
| 841 | Pel* piReco = ( uiChromaId > 0 ? pcRecoYuv->getCrAddr( uiAbsPartIdx ) : pcRecoYuv->getCbAddr( uiAbsPartIdx ) ); |
---|
| 842 | Pel* piPred = ( uiChromaId > 0 ? pcPredYuv->getCrAddr( uiAbsPartIdx ) : pcPredYuv->getCbAddr( uiAbsPartIdx ) ); |
---|
| 843 | Pel* piResi = ( uiChromaId > 0 ? pcResiYuv->getCrAddr( uiAbsPartIdx ) : pcResiYuv->getCbAddr( uiAbsPartIdx ) ); |
---|
| 844 | |
---|
| 845 | UInt uiNumCoeffInc = ( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ) ) >> 2; |
---|
| 846 | TCoeff* pcCoeff = ( uiChromaId > 0 ? pcCU->getCoeffCr() : pcCU->getCoeffCb() ) + ( uiNumCoeffInc * uiAbsPartIdx ); |
---|
| 847 | |
---|
| 848 | UInt uiChromaPredMode = pcCU->getChromaIntraDir( 0 ); |
---|
| 849 | |
---|
| 850 | UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
| 851 | Pel* piRecIPred = ( uiChromaId > 0 ? pcCU->getPic()->getPicYuvRec()->getCrAddr( pcCU->getAddr(), uiZOrder ) : pcCU->getPic()->getPicYuvRec()->getCbAddr( pcCU->getAddr(), uiZOrder ) ); |
---|
| 852 | UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getCStride(); |
---|
| 853 | |
---|
| 854 | //===== init availability pattern ===== |
---|
| 855 | Bool bAboveAvail = false; |
---|
| 856 | Bool bLeftAvail = false; |
---|
| 857 | pcCU->getPattern()->initPattern ( pcCU, uiTrDepth, uiAbsPartIdx ); |
---|
[56] | 858 | |
---|
| 859 | if( uiChromaPredMode == LM_CHROMA_IDX && uiChromaId == 0 ) |
---|
| 860 | { |
---|
| 861 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, |
---|
| 862 | m_pcPrediction->getPredicBuf (), |
---|
| 863 | m_pcPrediction->getPredicBufWidth (), |
---|
| 864 | m_pcPrediction->getPredicBufHeight (), |
---|
| 865 | bAboveAvail, bLeftAvail, |
---|
| 866 | true ); |
---|
| 867 | |
---|
| 868 | m_pcPrediction->getLumaRecPixels( pcCU->getPattern(), uiWidth, uiHeight ); |
---|
| 869 | } |
---|
| 870 | |
---|
[2] | 871 | pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth, |
---|
| 872 | m_pcPrediction->getPredicBuf (), |
---|
| 873 | m_pcPrediction->getPredicBufWidth (), |
---|
| 874 | m_pcPrediction->getPredicBufHeight (), |
---|
| 875 | bAboveAvail, bLeftAvail ); |
---|
| 876 | Int* pPatChroma = ( uiChromaId > 0 ? pcCU->getPattern()->getAdiCrBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) : pcCU->getPattern()->getAdiCbBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) ); |
---|
| 877 | |
---|
| 878 | //===== get prediction signal ===== |
---|
[56] | 879 | if( uiChromaPredMode == LM_CHROMA_IDX ) |
---|
[2] | 880 | { |
---|
[56] | 881 | m_pcPrediction->predLMIntraChroma( pcCU->getPattern(), pPatChroma, piPred, uiStride, uiWidth, uiHeight, uiChromaId ); |
---|
[2] | 882 | } |
---|
| 883 | else |
---|
| 884 | { |
---|
[56] | 885 | if( uiChromaPredMode == DM_CHROMA_IDX ) |
---|
[2] | 886 | { |
---|
[56] | 887 | uiChromaPredMode = pcCU->getLumaIntraDir( 0 ); |
---|
| 888 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 889 | mapDMMtoIntraMode( uiChromaPredMode ); |
---|
| 890 | #endif |
---|
[2] | 891 | } |
---|
[56] | 892 | m_pcPrediction->predIntraChromaAng( pcCU->getPattern(), pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
[2] | 893 | } |
---|
| 894 | |
---|
| 895 | //===== inverse transform ===== |
---|
[56] | 896 | if(eText == TEXT_CHROMA_U) |
---|
| 897 | { |
---|
| 898 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 899 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() ); |
---|
[2] | 900 | #else |
---|
[56] | 901 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getPPS()->getChromaQpOffset() ); |
---|
[2] | 902 | #endif |
---|
[56] | 903 | } |
---|
| 904 | else |
---|
| 905 | { |
---|
| 906 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 907 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); |
---|
| 908 | #else |
---|
| 909 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); |
---|
| 910 | #endif |
---|
| 911 | } |
---|
[2] | 912 | |
---|
[56] | 913 | Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText]; |
---|
| 914 | assert(scalingListType < 6); |
---|
| 915 | #if LOSSLESS_CODING |
---|
| 916 | m_pcTrQuant->invtransformNxN( pcCU, eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); |
---|
| 917 | #else |
---|
| 918 | m_pcTrQuant->invtransformNxN( eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); |
---|
| 919 | #endif |
---|
| 920 | |
---|
[2] | 921 | //===== reconstruction ===== |
---|
[56] | 922 | Pel* pPred = piPred; |
---|
| 923 | Pel* pResi = piResi; |
---|
| 924 | Pel* pReco = piReco; |
---|
| 925 | Pel* pRecIPred = piRecIPred; |
---|
| 926 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
[2] | 927 | { |
---|
[56] | 928 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
[2] | 929 | { |
---|
[56] | 930 | pReco [ uiX ] = Clip( pPred[ uiX ] + pResi[ uiX ] ); |
---|
| 931 | pRecIPred[ uiX ] = pReco[ uiX ]; |
---|
[2] | 932 | } |
---|
[56] | 933 | pPred += uiStride; |
---|
| 934 | pResi += uiStride; |
---|
| 935 | pReco += uiStride; |
---|
| 936 | pRecIPred += uiRecIPredStride; |
---|
[2] | 937 | } |
---|
| 938 | } |
---|
| 939 | |
---|
| 940 | Void |
---|
| 941 | TDecCu::xIntraRecQT( TComDataCU* pcCU, |
---|
| 942 | UInt uiTrDepth, |
---|
| 943 | UInt uiAbsPartIdx, |
---|
| 944 | TComYuv* pcRecoYuv, |
---|
| 945 | TComYuv* pcPredYuv, |
---|
| 946 | TComYuv* pcResiYuv ) |
---|
| 947 | { |
---|
| 948 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
---|
| 949 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
---|
| 950 | if( uiTrMode == uiTrDepth ) |
---|
| 951 | { |
---|
| 952 | xIntraRecLumaBlk ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 953 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 ); |
---|
| 954 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 ); |
---|
| 955 | } |
---|
| 956 | else |
---|
| 957 | { |
---|
| 958 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
---|
| 959 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
---|
| 960 | { |
---|
| 961 | xIntraRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 962 | } |
---|
| 963 | } |
---|
| 964 | } |
---|
| 965 | |
---|
| 966 | Void |
---|
| 967 | TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 968 | { |
---|
| 969 | UInt uiInitTrDepth = ( pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1 ); |
---|
| 970 | UInt uiNumPart = pcCU->getNumPartInter(); |
---|
| 971 | UInt uiNumQParts = pcCU->getTotalNumPart() >> 2; |
---|
| 972 | |
---|
[56] | 973 | if (pcCU->getIPCMFlag(0)) |
---|
| 974 | { |
---|
| 975 | xReconPCM( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 976 | return; |
---|
| 977 | } |
---|
| 978 | |
---|
[2] | 979 | for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ ) |
---|
| 980 | { |
---|
| 981 | xIntraLumaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] ); |
---|
| 982 | } |
---|
| 983 | |
---|
| 984 | for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ ) |
---|
| 985 | { |
---|
| 986 | xIntraChromaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] ); |
---|
| 987 | } |
---|
| 988 | |
---|
| 989 | } |
---|
| 990 | |
---|
[189] | 991 | #if RWTH_SDC_DLT_B0036 |
---|
| 992 | Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 993 | { |
---|
| 994 | UInt uiWidth = pcCU->getWidth ( 0 ); |
---|
| 995 | UInt uiHeight = pcCU->getHeight ( 0 ); |
---|
| 996 | |
---|
| 997 | TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth]; |
---|
| 998 | TComYuv* pcPredYuv = m_ppcYuvReco[uiDepth]; |
---|
| 999 | TComYuv* pcResiYuv = m_ppcYuvResi[uiDepth]; |
---|
| 1000 | |
---|
| 1001 | UInt uiStride = pcRecoYuv->getStride (); |
---|
| 1002 | Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 1003 | Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 1004 | Pel* piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 1005 | |
---|
| 1006 | UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
| 1007 | Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); |
---|
| 1008 | UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); |
---|
| 1009 | |
---|
| 1010 | UInt uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); |
---|
| 1011 | |
---|
| 1012 | AOF( uiWidth == uiHeight ); |
---|
| 1013 | AOF( uiAbsPartIdx == 0 ); |
---|
| 1014 | AOF( pcCU->getSDCAvailable(uiAbsPartIdx) ); |
---|
| 1015 | AOF( pcCU->getSDCFlag(uiAbsPartIdx) ); |
---|
| 1016 | |
---|
| 1017 | //===== init availability pattern ===== |
---|
| 1018 | Bool bAboveAvail = false; |
---|
| 1019 | Bool bLeftAvail = false; |
---|
| 1020 | pcCU->getPattern()->initPattern ( pcCU, 0, uiAbsPartIdx ); |
---|
| 1021 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail ); |
---|
| 1022 | |
---|
| 1023 | //===== get prediction signal ===== |
---|
| 1024 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 1025 | if( uiLumaPredMode >= NUM_INTRA_MODE ) |
---|
| 1026 | { |
---|
| 1027 | m_pcPrediction->predIntraLumaDMM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, false ); |
---|
| 1028 | } |
---|
| 1029 | else |
---|
| 1030 | { |
---|
| 1031 | #endif |
---|
| 1032 | m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
| 1033 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 1034 | } |
---|
| 1035 | #endif |
---|
| 1036 | |
---|
| 1037 | // number of segments depends on prediction mode |
---|
| 1038 | UInt uiNumSegments = 1; |
---|
| 1039 | Bool* pbMask = NULL; |
---|
| 1040 | UInt uiMaskStride = 0; |
---|
| 1041 | |
---|
| 1042 | if( uiLumaPredMode == DMM_WEDGE_FULL_IDX || uiLumaPredMode == DMM_WEDGE_PREDDIR_IDX ) |
---|
| 1043 | { |
---|
| 1044 | Int uiTabIdx = (uiLumaPredMode == DMM_WEDGE_FULL_IDX)?pcCU->getWedgeFullTabIdx(uiAbsPartIdx):pcCU->getWedgePredDirTabIdx(uiAbsPartIdx); |
---|
| 1045 | |
---|
| 1046 | WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])]; |
---|
| 1047 | TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx )); |
---|
| 1048 | |
---|
| 1049 | uiNumSegments = 2; |
---|
| 1050 | pbMask = pcWedgelet->getPattern(); |
---|
| 1051 | uiMaskStride = pcWedgelet->getStride(); |
---|
| 1052 | } |
---|
| 1053 | |
---|
| 1054 | // get DC prediction for each segment |
---|
| 1055 | Pel apDCPredValues[2]; |
---|
| 1056 | xAnalyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride); |
---|
| 1057 | |
---|
| 1058 | // reconstruct residual based on mask + DC residuals |
---|
| 1059 | Pel apDCResiValues[2]; |
---|
| 1060 | Pel apDCRecoValues[2]; |
---|
| 1061 | for( UInt ui = 0; ui < uiNumSegments; ui++ ) |
---|
| 1062 | { |
---|
| 1063 | Pel pPredIdx = GetDepthValue2Idx( apDCPredValues[ui] ); |
---|
| 1064 | Pel pResiIdx = pcCU->getSDCSegmentDCOffset(ui, uiAbsPartIdx); |
---|
| 1065 | Pel pRecoValue = GetIdx2DepthValue( pPredIdx + pResiIdx ); |
---|
| 1066 | |
---|
| 1067 | apDCRecoValues[ui] = pRecoValue; |
---|
| 1068 | apDCResiValues[ui] = pRecoValue - apDCPredValues[ui]; |
---|
| 1069 | } |
---|
| 1070 | |
---|
| 1071 | //===== reconstruction ===== |
---|
| 1072 | Bool*pMask = pbMask; |
---|
| 1073 | Pel* pPred = piPred; |
---|
| 1074 | Pel* pResi = piResi; |
---|
| 1075 | Pel* pReco = piReco; |
---|
| 1076 | Pel* pRecIPred = piRecIPred; |
---|
| 1077 | |
---|
| 1078 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
| 1079 | { |
---|
| 1080 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
| 1081 | { |
---|
| 1082 | UChar ucSegment = pMask?(UChar)pMask[uiX]:0; |
---|
| 1083 | assert( ucSegment < uiNumSegments ); |
---|
| 1084 | |
---|
| 1085 | Pel pPredVal= apDCPredValues[ucSegment]; |
---|
| 1086 | Pel pResiDC = apDCResiValues[ucSegment]; |
---|
| 1087 | |
---|
| 1088 | pReco [ uiX ] = Clip( pPredVal + pResiDC ); |
---|
| 1089 | pRecIPred[ uiX ] = pReco[ uiX ]; |
---|
| 1090 | } |
---|
| 1091 | pPred += uiStride; |
---|
| 1092 | pResi += uiStride; |
---|
| 1093 | pReco += uiStride; |
---|
| 1094 | pRecIPred += uiRecIPredStride; |
---|
| 1095 | pMask += uiMaskStride; |
---|
| 1096 | } |
---|
| 1097 | |
---|
| 1098 | // clear UV |
---|
| 1099 | UInt uiStrideC = pcPredYuv->getCStride(); |
---|
| 1100 | Pel *pRecCb = pcPredYuv->getCbAddr(); |
---|
| 1101 | Pel *pRecCr = pcPredYuv->getCrAddr(); |
---|
| 1102 | |
---|
| 1103 | for (Int y=0; y<uiHeight/2; y++) |
---|
| 1104 | { |
---|
| 1105 | for (Int x=0; x<uiWidth/2; x++) |
---|
| 1106 | { |
---|
| 1107 | pRecCb[x] = (Pel)(128<<g_uiBitIncrement); |
---|
| 1108 | pRecCr[x] = (Pel)(128<<g_uiBitIncrement); |
---|
| 1109 | } |
---|
| 1110 | |
---|
| 1111 | pRecCb += uiStrideC; |
---|
| 1112 | pRecCr += uiStrideC; |
---|
| 1113 | } |
---|
| 1114 | } |
---|
| 1115 | #endif |
---|
| 1116 | |
---|
[56] | 1117 | /** Function for deriving recontructed PU/CU Luma sample with QTree structure |
---|
[2] | 1118 | * \param pcCU pointer of current CU |
---|
| 1119 | * \param uiTrDepth current tranform split depth |
---|
| 1120 | * \param uiAbsPartIdx part index |
---|
| 1121 | * \param pcRecoYuv pointer to reconstructed sample arrays |
---|
| 1122 | * \param pcPredYuv pointer to prediction sample arrays |
---|
| 1123 | * \param pcResiYuv pointer to residue sample arrays |
---|
| 1124 | * |
---|
| 1125 | \ This function dervies recontructed PU/CU Luma sample with recursive QTree structure |
---|
| 1126 | */ |
---|
| 1127 | Void |
---|
| 1128 | TDecCu::xIntraLumaRecQT( TComDataCU* pcCU, |
---|
| 1129 | UInt uiTrDepth, |
---|
| 1130 | UInt uiAbsPartIdx, |
---|
| 1131 | TComYuv* pcRecoYuv, |
---|
| 1132 | TComYuv* pcPredYuv, |
---|
| 1133 | TComYuv* pcResiYuv ) |
---|
| 1134 | { |
---|
| 1135 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
---|
| 1136 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
---|
| 1137 | if( uiTrMode == uiTrDepth ) |
---|
| 1138 | { |
---|
| 1139 | xIntraRecLumaBlk ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 1140 | } |
---|
| 1141 | else |
---|
| 1142 | { |
---|
| 1143 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
---|
| 1144 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
---|
| 1145 | { |
---|
| 1146 | xIntraLumaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 1147 | } |
---|
| 1148 | } |
---|
| 1149 | } |
---|
| 1150 | |
---|
[56] | 1151 | /** Function for deriving recontructed PU/CU chroma samples with QTree structure |
---|
[2] | 1152 | * \param pcCU pointer of current CU |
---|
| 1153 | * \param uiTrDepth current tranform split depth |
---|
| 1154 | * \param uiAbsPartIdx part index |
---|
| 1155 | * \param pcRecoYuv pointer to reconstructed sample arrays |
---|
| 1156 | * \param pcPredYuv pointer to prediction sample arrays |
---|
| 1157 | * \param pcResiYuv pointer to residue sample arrays |
---|
| 1158 | * |
---|
| 1159 | \ This function dervies recontructed PU/CU chroma samples with QTree recursive structure |
---|
| 1160 | */ |
---|
| 1161 | Void |
---|
| 1162 | TDecCu::xIntraChromaRecQT( TComDataCU* pcCU, |
---|
| 1163 | UInt uiTrDepth, |
---|
| 1164 | UInt uiAbsPartIdx, |
---|
| 1165 | TComYuv* pcRecoYuv, |
---|
| 1166 | TComYuv* pcPredYuv, |
---|
| 1167 | TComYuv* pcResiYuv ) |
---|
| 1168 | { |
---|
| 1169 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
---|
| 1170 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
---|
| 1171 | if( uiTrMode == uiTrDepth ) |
---|
| 1172 | { |
---|
| 1173 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 ); |
---|
| 1174 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 ); |
---|
| 1175 | } |
---|
| 1176 | else |
---|
| 1177 | { |
---|
| 1178 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
---|
| 1179 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
---|
| 1180 | { |
---|
| 1181 | xIntraChromaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 1182 | } |
---|
| 1183 | } |
---|
| 1184 | } |
---|
| 1185 | |
---|
| 1186 | Void TDecCu::xCopyToPic( TComDataCU* pcCU, TComPic* pcPic, UInt uiZorderIdx, UInt uiDepth ) |
---|
| 1187 | { |
---|
| 1188 | UInt uiCUAddr = pcCU->getAddr(); |
---|
| 1189 | |
---|
| 1190 | m_ppcYuvReco[uiDepth]->copyToPicYuv ( pcPic->getPicYuvRec (), uiCUAddr, uiZorderIdx ); |
---|
| 1191 | |
---|
| 1192 | return; |
---|
| 1193 | } |
---|
| 1194 | |
---|
| 1195 | Void TDecCu::xDecodeInterTexture ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 1196 | { |
---|
| 1197 | UInt uiWidth = pcCU->getWidth ( uiAbsPartIdx ); |
---|
| 1198 | UInt uiHeight = pcCU->getHeight( uiAbsPartIdx ); |
---|
| 1199 | TCoeff* piCoeff; |
---|
| 1200 | |
---|
| 1201 | Pel* pResi; |
---|
| 1202 | UInt uiLumaTrMode, uiChromaTrMode; |
---|
| 1203 | |
---|
| 1204 | pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx( uiAbsPartIdx ), uiLumaTrMode, uiChromaTrMode ); |
---|
| 1205 | |
---|
| 1206 | // Y |
---|
| 1207 | piCoeff = pcCU->getCoeffY(); |
---|
| 1208 | pResi = m_ppcYuvResi[uiDepth]->getLumaAddr(); |
---|
[56] | 1209 | |
---|
| 1210 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 1211 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); |
---|
| 1212 | #else |
---|
| 1213 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 ); |
---|
| 1214 | #endif |
---|
| 1215 | |
---|
[2] | 1216 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff ); |
---|
| 1217 | |
---|
| 1218 | // Cb and Cr |
---|
[56] | 1219 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 1220 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() ); |
---|
| 1221 | #else |
---|
| 1222 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset() ); |
---|
| 1223 | #endif |
---|
| 1224 | |
---|
[2] | 1225 | uiWidth >>= 1; |
---|
| 1226 | uiHeight >>= 1; |
---|
| 1227 | piCoeff = pcCU->getCoeffCb(); pResi = m_ppcYuvResi[uiDepth]->getCbAddr(); |
---|
| 1228 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); |
---|
[56] | 1229 | |
---|
| 1230 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 1231 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); |
---|
| 1232 | #else |
---|
| 1233 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); |
---|
| 1234 | #endif |
---|
| 1235 | |
---|
[2] | 1236 | piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr(); |
---|
| 1237 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); |
---|
| 1238 | } |
---|
| 1239 | |
---|
[56] | 1240 | /** Function for deriving reconstructed luma/chroma samples of a PCM mode CU. |
---|
| 1241 | * \param pcCU pointer to current CU |
---|
| 1242 | * \param uiPartIdx part index |
---|
| 1243 | * \param piPCM pointer to PCM code arrays |
---|
| 1244 | * \param piReco pointer to reconstructed sample arrays |
---|
| 1245 | * \param uiStride stride of reconstructed sample arrays |
---|
| 1246 | * \param uiWidth CU width |
---|
| 1247 | * \param uiHeight CU height |
---|
| 1248 | * \param ttText texture component type |
---|
| 1249 | * \returns Void |
---|
| 1250 | */ |
---|
| 1251 | Void TDecCu::xDecodePCMTexture( TComDataCU* pcCU, UInt uiPartIdx, Pel *piPCM, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType ttText) |
---|
| 1252 | { |
---|
| 1253 | UInt uiX, uiY; |
---|
| 1254 | Pel* piPicReco; |
---|
| 1255 | UInt uiPicStride; |
---|
| 1256 | UInt uiPcmLeftShiftBit; |
---|
| 1257 | |
---|
| 1258 | if( ttText == TEXT_LUMA ) |
---|
| 1259 | { |
---|
| 1260 | uiPicStride = pcCU->getPic()->getPicYuvRec()->getStride(); |
---|
| 1261 | piPicReco = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); |
---|
| 1262 | uiPcmLeftShiftBit = g_uiBitDepth + g_uiBitIncrement - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma(); |
---|
| 1263 | } |
---|
| 1264 | else |
---|
| 1265 | { |
---|
| 1266 | uiPicStride = pcCU->getPic()->getPicYuvRec()->getCStride(); |
---|
| 1267 | |
---|
| 1268 | if( ttText == TEXT_CHROMA_U ) |
---|
| 1269 | { |
---|
| 1270 | piPicReco = pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); |
---|
| 1271 | } |
---|
| 1272 | else |
---|
| 1273 | { |
---|
| 1274 | piPicReco = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); |
---|
| 1275 | } |
---|
| 1276 | uiPcmLeftShiftBit = g_uiBitDepth + g_uiBitIncrement - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); |
---|
| 1277 | } |
---|
| 1278 | |
---|
| 1279 | for( uiY = 0; uiY < uiHeight; uiY++ ) |
---|
| 1280 | { |
---|
| 1281 | for( uiX = 0; uiX < uiWidth; uiX++ ) |
---|
| 1282 | { |
---|
| 1283 | piReco[uiX] = (piPCM[uiX] << uiPcmLeftShiftBit); |
---|
| 1284 | piPicReco[uiX] = piReco[uiX]; |
---|
| 1285 | } |
---|
| 1286 | piPCM += uiWidth; |
---|
| 1287 | piReco += uiStride; |
---|
| 1288 | piPicReco += uiPicStride; |
---|
| 1289 | } |
---|
| 1290 | } |
---|
| 1291 | |
---|
| 1292 | /** Function for reconstructing a PCM mode CU. |
---|
| 1293 | * \param pcCU pointer to current CU |
---|
| 1294 | * \param uiAbsPartIdx CU index |
---|
| 1295 | * \param uiDepth CU Depth |
---|
| 1296 | * \returns Void |
---|
| 1297 | */ |
---|
| 1298 | Void TDecCu::xReconPCM( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 1299 | { |
---|
| 1300 | // Luma |
---|
| 1301 | UInt uiWidth = (g_uiMaxCUWidth >> uiDepth); |
---|
| 1302 | UInt uiHeight = (g_uiMaxCUHeight >> uiDepth); |
---|
| 1303 | |
---|
| 1304 | Pel* piPcmY = pcCU->getPCMSampleY(); |
---|
| 1305 | Pel* piRecoY = m_ppcYuvReco[uiDepth]->getLumaAddr(0, uiWidth); |
---|
| 1306 | |
---|
| 1307 | UInt uiStride = m_ppcYuvResi[uiDepth]->getStride(); |
---|
| 1308 | |
---|
| 1309 | xDecodePCMTexture( pcCU, 0, piPcmY, piRecoY, uiStride, uiWidth, uiHeight, TEXT_LUMA); |
---|
| 1310 | |
---|
| 1311 | // Cb and Cr |
---|
| 1312 | UInt uiCWidth = (uiWidth>>1); |
---|
| 1313 | UInt uiCHeight = (uiHeight>>1); |
---|
| 1314 | |
---|
| 1315 | Pel* piPcmCb = pcCU->getPCMSampleCb(); |
---|
| 1316 | Pel* piPcmCr = pcCU->getPCMSampleCr(); |
---|
| 1317 | Pel* pRecoCb = m_ppcYuvReco[uiDepth]->getCbAddr(); |
---|
| 1318 | Pel* pRecoCr = m_ppcYuvReco[uiDepth]->getCrAddr(); |
---|
| 1319 | |
---|
| 1320 | UInt uiCStride = m_ppcYuvReco[uiDepth]->getCStride(); |
---|
| 1321 | |
---|
| 1322 | xDecodePCMTexture( pcCU, 0, piPcmCb, pRecoCb, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_U); |
---|
| 1323 | xDecodePCMTexture( pcCU, 0, piPcmCr, pRecoCr, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_V); |
---|
| 1324 | } |
---|
| 1325 | |
---|
| 1326 | #if LOSSLESS_CODING |
---|
| 1327 | /** Function for filling the PCM buffer of a CU using its reconstructed sample array |
---|
| 1328 | * \param pcCU pointer to current CU |
---|
| 1329 | * \param uiAbsPartIdx CU index |
---|
| 1330 | * \param uiDepth CU Depth |
---|
| 1331 | * \returns Void |
---|
| 1332 | */ |
---|
| 1333 | Void TDecCu::xFillPCMBuffer(TComDataCU* pCU, UInt absPartIdx, UInt depth) |
---|
| 1334 | { |
---|
| 1335 | // Luma |
---|
| 1336 | UInt width = (g_uiMaxCUWidth >> depth); |
---|
| 1337 | UInt height = (g_uiMaxCUHeight >> depth); |
---|
| 1338 | |
---|
| 1339 | Pel* pPcmY = pCU->getPCMSampleY(); |
---|
| 1340 | Pel* pRecoY = m_ppcYuvReco[depth]->getLumaAddr(0, width); |
---|
| 1341 | |
---|
| 1342 | UInt stride = m_ppcYuvReco[depth]->getStride(); |
---|
| 1343 | |
---|
| 1344 | for(Int y = 0; y < height; y++ ) |
---|
| 1345 | { |
---|
| 1346 | for(Int x = 0; x < width; x++ ) |
---|
| 1347 | { |
---|
| 1348 | pPcmY[x] = pRecoY[x]; |
---|
| 1349 | } |
---|
| 1350 | pPcmY += width; |
---|
| 1351 | pRecoY += stride; |
---|
| 1352 | } |
---|
| 1353 | |
---|
| 1354 | // Cb and Cr |
---|
| 1355 | UInt widthC = (width>>1); |
---|
| 1356 | UInt heightC = (height>>1); |
---|
| 1357 | |
---|
| 1358 | Pel* pPcmCb = pCU->getPCMSampleCb(); |
---|
| 1359 | Pel* pPcmCr = pCU->getPCMSampleCr(); |
---|
| 1360 | Pel* pRecoCb = m_ppcYuvReco[depth]->getCbAddr(); |
---|
| 1361 | Pel* pRecoCr = m_ppcYuvReco[depth]->getCrAddr(); |
---|
| 1362 | |
---|
| 1363 | UInt strideC = m_ppcYuvReco[depth]->getCStride(); |
---|
| 1364 | |
---|
| 1365 | for(Int y = 0; y < heightC; y++ ) |
---|
| 1366 | { |
---|
| 1367 | for(Int x = 0; x < widthC; x++ ) |
---|
| 1368 | { |
---|
| 1369 | pPcmCb[x] = pRecoCb[x]; |
---|
| 1370 | pPcmCr[x] = pRecoCr[x]; |
---|
| 1371 | } |
---|
| 1372 | pPcmCr += widthC; |
---|
| 1373 | pPcmCb += widthC; |
---|
| 1374 | pRecoCb += strideC; |
---|
| 1375 | pRecoCr += strideC; |
---|
| 1376 | } |
---|
| 1377 | |
---|
| 1378 | } |
---|
| 1379 | #endif |
---|
| 1380 | |
---|
[189] | 1381 | #if RWTH_SDC_DLT_B0036 |
---|
| 1382 | Void TDecCu::xAnalyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride ) |
---|
| 1383 | { |
---|
| 1384 | Int iSumDepth[2]; |
---|
| 1385 | memset(iSumDepth, 0, sizeof(Int)*2); |
---|
| 1386 | Int iSumPix[2]; |
---|
| 1387 | memset(iSumPix, 0, sizeof(Int)*2); |
---|
| 1388 | |
---|
| 1389 | for (Int y=0; y<uiSize; y++) |
---|
| 1390 | { |
---|
| 1391 | for (Int x=0; x<uiSize; x++) |
---|
| 1392 | { |
---|
| 1393 | UChar ucSegment = pMask?(UChar)pMask[x]:0; |
---|
| 1394 | assert( ucSegment < uiNumSegments ); |
---|
| 1395 | |
---|
| 1396 | iSumDepth[ucSegment] += pOrig[x]; |
---|
| 1397 | iSumPix[ucSegment] += 1; |
---|
| 1398 | } |
---|
| 1399 | |
---|
| 1400 | pOrig += uiStride; |
---|
| 1401 | pMask += uiMaskStride; |
---|
| 1402 | } |
---|
| 1403 | |
---|
| 1404 | // compute mean for each segment |
---|
| 1405 | for( UChar ucSeg = 0; ucSeg < uiNumSegments; ucSeg++ ) |
---|
| 1406 | { |
---|
| 1407 | if( iSumPix[ucSeg] > 0 ) |
---|
| 1408 | rpSegMeans[ucSeg] = iSumDepth[ucSeg] / iSumPix[ucSeg]; |
---|
| 1409 | else |
---|
| 1410 | rpSegMeans[ucSeg] = 0; // this happens for zero-segments |
---|
| 1411 | } |
---|
| 1412 | } |
---|
| 1413 | #endif |
---|
| 1414 | |
---|
[56] | 1415 | //! \} |
---|