[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); |
---|
[231] | 363 | |
---|
[2] | 364 | for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 365 | { |
---|
[56] | 366 | const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) ); |
---|
[231] | 367 | #if MERL_VSP_C0152 |
---|
| 368 | Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui); |
---|
| 369 | pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx); |
---|
| 370 | #endif |
---|
[2] | 371 | pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_SKIP ); |
---|
| 372 | pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N ); |
---|
| 373 | pcCU->setDepth( uiAbsPartIdx + ui, uhNewDepth ); |
---|
| 374 | pcCU->setWidth( uiAbsPartIdx + ui, g_uiMaxCUWidth>>uhNewDepth ); |
---|
| 375 | pcCU->setHeight( uiAbsPartIdx + ui, g_uiMaxCUHeight>>uhNewDepth ); |
---|
| 376 | } |
---|
| 377 | } |
---|
[56] | 378 | else |
---|
| 379 | { |
---|
[2] | 380 | #endif |
---|
[56] | 381 | #if SIMP_MRG_PRUN |
---|
| 382 | UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx); |
---|
[231] | 383 | #if MERL_VSP_C0152 |
---|
| 384 | Int iVSPIndexTrue[3] = {-1, -1, -1}; |
---|
| 385 | m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, uiMergeIndex ); |
---|
| 386 | { |
---|
| 387 | Int iVSPIdx = 0; |
---|
| 388 | Int numVspIdx; |
---|
| 389 | numVspIdx = 3; |
---|
| 390 | for (Int i = 0; i < numVspIdx; i++) |
---|
| 391 | { |
---|
| 392 | if (iVSPIndexTrue[i] == uiMergeIndex) |
---|
| 393 | { |
---|
| 394 | iVSPIdx = i+1; |
---|
| 395 | break; |
---|
| 396 | } |
---|
| 397 | } |
---|
| 398 | pcCU->setVSPIndexSubParts( iVSPIdx, uiAbsPartIdx, 0, uiDepth ); //Initialize the VSP, may change later in get InterMergeCandidates() |
---|
| 399 | } |
---|
| 400 | #else |
---|
[56] | 401 | m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
---|
[231] | 402 | #endif |
---|
[56] | 403 | #else |
---|
| 404 | m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); |
---|
| 405 | UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx); |
---|
| 406 | #endif |
---|
| 407 | pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); |
---|
| 408 | |
---|
| 409 | TComMv cTmpMv( 0, 0 ); |
---|
| 410 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
| 411 | { |
---|
| 412 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
---|
| 413 | { |
---|
| 414 | pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiAbsPartIdx, 0, uiDepth); |
---|
| 415 | pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiAbsPartIdx, 0, uiDepth); |
---|
| 416 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
| 417 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
| 418 | } |
---|
| 419 | } |
---|
[189] | 420 | #if LGE_ILLUCOMP_B0045 |
---|
| 421 | m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 422 | #endif |
---|
[56] | 423 | #if HHI_MPI |
---|
| 424 | } |
---|
| 425 | #endif |
---|
[5] | 426 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 427 | m_pcEntropyDecoder->decodeResPredFlag( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth], 0 ); |
---|
[5] | 428 | #endif |
---|
[56] | 429 | xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); |
---|
[2] | 430 | return; |
---|
| 431 | } |
---|
| 432 | |
---|
[5] | 433 | #if HHI_MPI |
---|
[2] | 434 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 ) |
---|
| 435 | { |
---|
[5] | 436 | #endif |
---|
[56] | 437 | #if BURST_IPCM |
---|
| 438 | if( pcCU->getNumSucIPCM() == 0 ) |
---|
| 439 | { |
---|
[2] | 440 | m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 441 | m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth ); |
---|
[56] | 442 | } |
---|
| 443 | else |
---|
| 444 | { |
---|
| 445 | pcCU->setPredModeSubParts( MODE_INTRA, uiAbsPartIdx, uiDepth ); |
---|
| 446 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
| 447 | pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
| 448 | pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth ); |
---|
| 449 | } |
---|
| 450 | #else |
---|
| 451 | m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 452 | m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 453 | #endif |
---|
[2] | 454 | |
---|
[56] | 455 | if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) |
---|
| 456 | { |
---|
| 457 | m_pcEntropyDecoder->decodeIPCMInfo( pcCU, uiAbsPartIdx, uiDepth ); |
---|
[2] | 458 | |
---|
[56] | 459 | if(pcCU->getIPCMFlag(uiAbsPartIdx)) |
---|
[2] | 460 | { |
---|
[56] | 461 | xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); |
---|
| 462 | return; |
---|
| 463 | } |
---|
| 464 | } |
---|
| 465 | |
---|
| 466 | #if ! HHI_MPI |
---|
| 467 | UInt uiCurrWidth = pcCU->getWidth ( uiAbsPartIdx ); |
---|
| 468 | UInt uiCurrHeight = pcCU->getHeight( uiAbsPartIdx ); |
---|
| 469 | #endif |
---|
| 470 | |
---|
| 471 | // prediction mode ( Intra : direction mode, Inter : Mv, reference idx ) |
---|
| 472 | m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]); |
---|
| 473 | |
---|
[189] | 474 | #if LGE_ILLUCOMP_B0045 |
---|
| 475 | m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 476 | #endif |
---|
| 477 | |
---|
[5] | 478 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[56] | 479 | if( !pcCU->isIntra( uiAbsPartIdx ) ) |
---|
| 480 | { |
---|
| 481 | m_pcEntropyDecoder->decodeResPredFlag ( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth], 0 ); |
---|
| 482 | } |
---|
[5] | 483 | #endif |
---|
[2] | 484 | |
---|
[56] | 485 | #if HHI_MPI |
---|
[2] | 486 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == uiDepth ) |
---|
| 487 | { |
---|
| 488 | assert( pcCU->getZorderIdxInCU() == 0 ); |
---|
| 489 | TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); |
---|
| 490 | pcCU->copyTextureMotionDataFrom( pcTextureCU, uiDepth, pcCU->getZorderIdxInCU() + uiAbsPartIdx, uiAbsPartIdx ); |
---|
| 491 | |
---|
| 492 | UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); |
---|
[231] | 493 | |
---|
[2] | 494 | for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 495 | { |
---|
[56] | 496 | const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) ); |
---|
[231] | 497 | #if MERL_VSP_C0152 |
---|
| 498 | Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui); |
---|
| 499 | pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx); |
---|
| 500 | #endif |
---|
[2] | 501 | pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_INTER ); |
---|
| 502 | pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N ); |
---|
| 503 | pcCU->setDepth( uiAbsPartIdx + ui, uhNewDepth ); |
---|
| 504 | pcCU->setWidth( uiAbsPartIdx + ui, g_uiMaxCUWidth>>uhNewDepth ); |
---|
| 505 | pcCU->setHeight( uiAbsPartIdx + ui, g_uiMaxCUHeight>>uhNewDepth ); |
---|
| 506 | } |
---|
| 507 | |
---|
| 508 | if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ) |
---|
| 509 | { |
---|
| 510 | UInt uiIdx = uiAbsPartIdx; |
---|
[56] | 511 | if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
---|
| 512 | { |
---|
| 513 | setdQPFlag(true); |
---|
| 514 | pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
| 515 | } |
---|
| 516 | |
---|
[2] | 517 | for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ ) |
---|
| 518 | { |
---|
| 519 | uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 520 | uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 521 | |
---|
[56] | 522 | Bool bSubInSlice = pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getEntropySliceCurStartCUAddr(); |
---|
| 523 | if ( bSubInSlice ) |
---|
| 524 | { |
---|
| 525 | if ( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) ) |
---|
| 526 | { |
---|
| 527 | xDecodeCU( pcCU, uiIdx, uiDepth+1, ruiIsLast ); |
---|
| 528 | } |
---|
| 529 | else |
---|
| 530 | { |
---|
| 531 | pcCU->setOutsideCUPart( uiIdx, uiDepth+1 ); |
---|
| 532 | } |
---|
| 533 | } |
---|
| 534 | if(ruiIsLast) |
---|
| 535 | { |
---|
| 536 | break; |
---|
| 537 | } |
---|
[2] | 538 | uiIdx += uiQNumParts; |
---|
| 539 | } |
---|
[56] | 540 | if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
---|
| 541 | { |
---|
| 542 | if ( getdQPFlag() ) |
---|
| 543 | { |
---|
| 544 | UInt uiQPSrcPartIdx; |
---|
| 545 | if ( pcPic->getCU( pcCU->getAddr() )->getEntropySliceStartCU(uiAbsPartIdx) != pcSlice->getEntropySliceCurStartCUAddr() ) |
---|
| 546 | { |
---|
| 547 | uiQPSrcPartIdx = pcSlice->getEntropySliceCurStartCUAddr() % pcPic->getNumPartInCU(); |
---|
| 548 | } |
---|
| 549 | else |
---|
| 550 | { |
---|
| 551 | uiQPSrcPartIdx = uiAbsPartIdx; |
---|
| 552 | } |
---|
| 553 | pcCU->setQPSubParts( pcCU->getRefQP( uiQPSrcPartIdx ), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
| 554 | } |
---|
| 555 | } |
---|
[2] | 556 | return; |
---|
| 557 | } |
---|
| 558 | } |
---|
[5] | 559 | } |
---|
| 560 | |
---|
[2] | 561 | UInt uiCurrWidth = pcCU->getWidth ( uiAbsPartIdx ); |
---|
| 562 | UInt uiCurrHeight = pcCU->getHeight( uiAbsPartIdx ); |
---|
[56] | 563 | #endif |
---|
| 564 | |
---|
[2] | 565 | // Coefficient decoding |
---|
[56] | 566 | Bool bCodeDQP = getdQPFlag(); |
---|
| 567 | m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, uiCurrWidth, uiCurrHeight, bCodeDQP ); |
---|
| 568 | setdQPFlag( bCodeDQP ); |
---|
| 569 | xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); |
---|
[2] | 570 | } |
---|
| 571 | |
---|
[56] | 572 | Void TDecCu::xFinishDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast) |
---|
| 573 | { |
---|
| 574 | if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) |
---|
| 575 | { |
---|
| 576 | if( getdQPFlag() ) |
---|
| 577 | { |
---|
| 578 | pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP |
---|
| 579 | } |
---|
| 580 | } |
---|
| 581 | |
---|
| 582 | #if BURST_IPCM |
---|
| 583 | if( pcCU->getNumSucIPCM() > 0 ) |
---|
| 584 | { |
---|
| 585 | ruiIsLast = 0; |
---|
| 586 | return; |
---|
| 587 | } |
---|
| 588 | #endif |
---|
| 589 | |
---|
| 590 | ruiIsLast = xDecodeSliceEnd( pcCU, uiAbsPartIdx, uiDepth); |
---|
| 591 | } |
---|
| 592 | |
---|
[2] | 593 | Void TDecCu::xDecompressCU( TComDataCU* pcCU, TComDataCU* pcCUCur, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 594 | { |
---|
| 595 | TComPic* pcPic = pcCU->getPic(); |
---|
| 596 | |
---|
| 597 | Bool bBoundary = false; |
---|
| 598 | UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
| 599 | UInt uiRPelX = uiLPelX + (g_uiMaxCUWidth>>uiDepth) - 1; |
---|
| 600 | UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
| 601 | UInt uiBPelY = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1; |
---|
| 602 | |
---|
[56] | 603 | UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1); |
---|
| 604 | TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx()); |
---|
| 605 | Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getEntropySliceCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getEntropySliceCurStartCUAddr(); |
---|
| 606 | if(bStartInCU||( uiRPelX >= pcSlice->getSPS()->getPicWidthInLumaSamples() ) || ( uiBPelY >= pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) |
---|
[2] | 607 | { |
---|
| 608 | bBoundary = true; |
---|
| 609 | } |
---|
| 610 | |
---|
| 611 | if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ) |
---|
| 612 | { |
---|
| 613 | UInt uiNextDepth = uiDepth + 1; |
---|
| 614 | UInt uiQNumParts = pcCU->getTotalNumPart() >> (uiNextDepth<<1); |
---|
| 615 | UInt uiIdx = uiAbsPartIdx; |
---|
| 616 | for ( UInt uiPartIdx = 0; uiPartIdx < 4; uiPartIdx++ ) |
---|
| 617 | { |
---|
| 618 | uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 619 | uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 620 | |
---|
[56] | 621 | Bool binSlice = (pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getEntropySliceCurStartCUAddr())&&(pcCU->getSCUAddr()+uiIdx<pcSlice->getEntropySliceCurEndCUAddr()); |
---|
| 622 | if(binSlice&&( uiLPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) |
---|
| 623 | { |
---|
[2] | 624 | xDecompressCU(pcCU, m_ppcCU[uiNextDepth], uiIdx, uiNextDepth ); |
---|
[56] | 625 | } |
---|
[2] | 626 | |
---|
| 627 | uiIdx += uiQNumParts; |
---|
| 628 | } |
---|
| 629 | return; |
---|
| 630 | } |
---|
| 631 | |
---|
| 632 | // Residual reconstruction |
---|
| 633 | m_ppcYuvResi[uiDepth]->clear(); |
---|
| 634 | |
---|
| 635 | m_ppcCU[uiDepth]->copySubCU( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 636 | |
---|
| 637 | switch( m_ppcCU[uiDepth]->getPredictionMode(0) ) |
---|
| 638 | { |
---|
| 639 | case MODE_SKIP: |
---|
| 640 | case MODE_INTER: |
---|
| 641 | xReconInter( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth ); |
---|
| 642 | break; |
---|
| 643 | case MODE_INTRA: |
---|
[189] | 644 | #if RWTH_SDC_DLT_B0036 |
---|
| 645 | if( m_ppcCU[uiDepth]->getSDCFlag(0) ) |
---|
| 646 | xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth ); |
---|
| 647 | else |
---|
| 648 | #endif |
---|
[2] | 649 | xReconIntraQT( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth ); |
---|
| 650 | break; |
---|
| 651 | default: |
---|
| 652 | assert(0); |
---|
| 653 | break; |
---|
| 654 | } |
---|
[56] | 655 | #if LOSSLESS_CODING |
---|
| 656 | if ( m_ppcCU[uiDepth]->isLosslessCoded(0) && (m_ppcCU[uiDepth]->getIPCMFlag(0) == false)) |
---|
| 657 | { |
---|
| 658 | xFillPCMBuffer(m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth); |
---|
| 659 | } |
---|
| 660 | #endif |
---|
[2] | 661 | |
---|
| 662 | xCopyToPic( m_ppcCU[uiDepth], pcPic, uiAbsPartIdx, uiDepth ); |
---|
| 663 | } |
---|
| 664 | |
---|
| 665 | Void TDecCu::xReconInter( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 666 | { |
---|
[5] | 667 | #if HHI_MPI |
---|
[189] | 668 | #if FIX_MPI_B0065 |
---|
[2] | 669 | if( pcCU->getTextureModeDepth( 0 ) != -1 ) |
---|
[189] | 670 | { |
---|
| 671 | TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); |
---|
| 672 | if( uiDepth == pcTextureCU->getDepth(uiAbsPartIdx)) |
---|
| 673 | { |
---|
| 674 | PartSize partSize = pcTextureCU->getPartitionSize(uiAbsPartIdx); |
---|
| 675 | pcCU->setPartSizeSubParts( partSize, 0, uiDepth ); |
---|
| 676 | } |
---|
| 677 | else |
---|
| 678 | { |
---|
| 679 | pcCU->setPartSizeSubParts( SIZE_NxN, 0, uiDepth ); |
---|
| 680 | } |
---|
| 681 | } |
---|
| 682 | #else |
---|
| 683 | if( pcCU->getTextureModeDepth( 0 ) != -1 ) |
---|
[2] | 684 | pcCU->setPartSizeSubParts( SIZE_NxN, 0, uiDepth ); |
---|
| 685 | #endif |
---|
[189] | 686 | #endif |
---|
[2] | 687 | |
---|
| 688 | // inter prediction |
---|
[231] | 689 | #if MERL_VSP_C0152 |
---|
[257] | 690 | m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth], uiAbsPartIdx ); |
---|
[231] | 691 | #else |
---|
[2] | 692 | m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] ); |
---|
[231] | 693 | #endif |
---|
[5] | 694 | #if HHI_MPI |
---|
[2] | 695 | if( pcCU->getTextureModeDepth( 0 ) != -1 ) |
---|
| 696 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); |
---|
| 697 | #endif |
---|
[56] | 698 | |
---|
[5] | 699 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 700 | if( pcCU->getResPredFlag( 0 ) ) |
---|
| 701 | { |
---|
| 702 | AOF( pcCU->getResPredAvail( 0 ) ); |
---|
[77] | 703 | Bool bOK = pcCU->getResidualSamples( 0, |
---|
| 704 | #if QC_SIMPLIFIEDIVRP_M24938 |
---|
| 705 | true, |
---|
| 706 | #endif |
---|
| 707 | m_ppcYuvResPred[uiDepth] ); |
---|
[2] | 708 | AOF( bOK ); |
---|
[77] | 709 | #if LG_RESTRICTEDRESPRED_M24766 |
---|
[100] | 710 | Int iPUResiPredShift[4]; |
---|
| 711 | pcCU->getPUResiPredShift(iPUResiPredShift, 0); |
---|
| 712 | m_ppcYuvReco[uiDepth]->add(iPUResiPredShift, pcCU->getPartitionSize(0), m_ppcYuvResPred[uiDepth], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) ); |
---|
[77] | 713 | #else |
---|
[2] | 714 | m_ppcYuvReco[uiDepth]->add( m_ppcYuvResPred[uiDepth], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) ); |
---|
[77] | 715 | #endif |
---|
[2] | 716 | } |
---|
[5] | 717 | #endif |
---|
| 718 | |
---|
[2] | 719 | // inter recon |
---|
| 720 | xDecodeInterTexture( pcCU, 0, uiDepth ); |
---|
| 721 | |
---|
| 722 | // clip for only non-zero cbp case |
---|
| 723 | if ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V ) ) ) |
---|
| 724 | { |
---|
| 725 | m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) ); |
---|
| 726 | } |
---|
| 727 | else |
---|
| 728 | { |
---|
[5] | 729 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 730 | if( pcCU->getResPredFlag( 0 ) ) |
---|
| 731 | { |
---|
| 732 | m_ppcYuvReco[uiDepth]->clip( pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) ); |
---|
| 733 | } |
---|
[5] | 734 | #endif |
---|
[2] | 735 | m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 )); |
---|
| 736 | } |
---|
| 737 | } |
---|
| 738 | |
---|
| 739 | Void |
---|
| 740 | TDecCu::xIntraRecLumaBlk( TComDataCU* pcCU, |
---|
| 741 | UInt uiTrDepth, |
---|
| 742 | UInt uiAbsPartIdx, |
---|
| 743 | TComYuv* pcRecoYuv, |
---|
| 744 | TComYuv* pcPredYuv, |
---|
| 745 | TComYuv* pcResiYuv ) |
---|
| 746 | { |
---|
| 747 | UInt uiWidth = pcCU ->getWidth ( 0 ) >> uiTrDepth; |
---|
| 748 | UInt uiHeight = pcCU ->getHeight ( 0 ) >> uiTrDepth; |
---|
| 749 | UInt uiStride = pcRecoYuv->getStride (); |
---|
| 750 | Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 751 | Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 752 | Pel* piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 753 | |
---|
| 754 | UInt uiNumCoeffInc = ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ); |
---|
| 755 | TCoeff* pcCoeff = pcCU->getCoeffY() + ( uiNumCoeffInc * uiAbsPartIdx ); |
---|
| 756 | |
---|
| 757 | UInt uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); |
---|
| 758 | |
---|
| 759 | UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
| 760 | Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); |
---|
| 761 | UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); |
---|
| 762 | |
---|
| 763 | //===== init availability pattern ===== |
---|
| 764 | Bool bAboveAvail = false; |
---|
| 765 | Bool bLeftAvail = false; |
---|
| 766 | pcCU->getPattern()->initPattern ( pcCU, uiTrDepth, uiAbsPartIdx ); |
---|
| 767 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, |
---|
| 768 | m_pcPrediction->getPredicBuf (), |
---|
| 769 | m_pcPrediction->getPredicBufWidth (), |
---|
| 770 | m_pcPrediction->getPredicBufHeight (), |
---|
| 771 | bAboveAvail, bLeftAvail ); |
---|
[189] | 772 | #if LGE_EDGE_INTRA_A0070 |
---|
[100] | 773 | if( uiLumaPredMode >= EDGE_INTRA_IDX ) |
---|
| 774 | { |
---|
| 775 | m_pcPrediction->predIntraLumaEdge( pcCU, pcCU->getPattern(), uiAbsPartIdx, uiWidth, uiHeight, piPred, uiStride |
---|
| 776 | #if LGE_EDGE_INTRA_DELTA_DC |
---|
| 777 | , uiLumaPredMode == EDGE_INTRA_DELTA_IDX |
---|
| 778 | #endif |
---|
| 779 | ); |
---|
| 780 | } |
---|
| 781 | else |
---|
| 782 | #endif |
---|
[2] | 783 | |
---|
[56] | 784 | //===== get prediction signal ===== |
---|
[5] | 785 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[56] | 786 | if( uiLumaPredMode >= NUM_INTRA_MODE ) |
---|
[2] | 787 | { |
---|
| 788 | m_pcPrediction->predIntraLumaDMM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, false ); |
---|
| 789 | } |
---|
| 790 | else |
---|
[56] | 791 | { |
---|
[2] | 792 | #endif |
---|
| 793 | m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
[56] | 794 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[2] | 795 | } |
---|
[56] | 796 | #endif |
---|
| 797 | |
---|
[2] | 798 | //===== inverse transform ===== |
---|
[56] | 799 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 800 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); |
---|
[2] | 801 | #else |
---|
[56] | 802 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 ); |
---|
| 803 | #endif |
---|
[2] | 804 | |
---|
[56] | 805 | Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA]; |
---|
| 806 | assert(scalingListType < 6); |
---|
| 807 | #if LOSSLESS_CODING |
---|
| 808 | m_pcTrQuant->invtransformNxN( pcCU, TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); |
---|
| 809 | #else |
---|
| 810 | m_pcTrQuant->invtransformNxN( TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); |
---|
| 811 | #endif |
---|
| 812 | |
---|
[2] | 813 | |
---|
| 814 | //===== reconstruction ===== |
---|
[56] | 815 | Pel* pPred = piPred; |
---|
| 816 | Pel* pResi = piResi; |
---|
| 817 | Pel* pReco = piReco; |
---|
| 818 | Pel* pRecIPred = piRecIPred; |
---|
| 819 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
[2] | 820 | { |
---|
[56] | 821 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
[2] | 822 | { |
---|
[56] | 823 | pReco [ uiX ] = Clip( pPred[ uiX ] + pResi[ uiX ] ); |
---|
| 824 | pRecIPred[ uiX ] = pReco[ uiX ]; |
---|
[2] | 825 | } |
---|
[56] | 826 | pPred += uiStride; |
---|
| 827 | pResi += uiStride; |
---|
| 828 | pReco += uiStride; |
---|
| 829 | pRecIPred += uiRecIPredStride; |
---|
[2] | 830 | } |
---|
| 831 | } |
---|
| 832 | |
---|
| 833 | |
---|
| 834 | Void |
---|
| 835 | TDecCu::xIntraRecChromaBlk( TComDataCU* pcCU, |
---|
| 836 | UInt uiTrDepth, |
---|
| 837 | UInt uiAbsPartIdx, |
---|
| 838 | TComYuv* pcRecoYuv, |
---|
| 839 | TComYuv* pcPredYuv, |
---|
| 840 | TComYuv* pcResiYuv, |
---|
| 841 | UInt uiChromaId ) |
---|
| 842 | { |
---|
| 843 | UInt uiFullDepth = pcCU->getDepth( 0 ) + uiTrDepth; |
---|
| 844 | UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiFullDepth ] + 2; |
---|
[56] | 845 | |
---|
| 846 | if( uiLog2TrSize == 2 ) |
---|
[2] | 847 | { |
---|
| 848 | assert( uiTrDepth > 0 ); |
---|
| 849 | uiTrDepth--; |
---|
| 850 | UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth( 0 ) + uiTrDepth ) << 1 ); |
---|
| 851 | Bool bFirstQ = ( ( uiAbsPartIdx % uiQPDiv ) == 0 ); |
---|
| 852 | if( !bFirstQ ) |
---|
| 853 | { |
---|
| 854 | return; |
---|
| 855 | } |
---|
| 856 | } |
---|
| 857 | |
---|
| 858 | TextType eText = ( uiChromaId > 0 ? TEXT_CHROMA_V : TEXT_CHROMA_U ); |
---|
| 859 | UInt uiWidth = pcCU ->getWidth ( 0 ) >> ( uiTrDepth + 1 ); |
---|
| 860 | UInt uiHeight = pcCU ->getHeight ( 0 ) >> ( uiTrDepth + 1 ); |
---|
| 861 | UInt uiStride = pcRecoYuv->getCStride (); |
---|
| 862 | Pel* piReco = ( uiChromaId > 0 ? pcRecoYuv->getCrAddr( uiAbsPartIdx ) : pcRecoYuv->getCbAddr( uiAbsPartIdx ) ); |
---|
| 863 | Pel* piPred = ( uiChromaId > 0 ? pcPredYuv->getCrAddr( uiAbsPartIdx ) : pcPredYuv->getCbAddr( uiAbsPartIdx ) ); |
---|
| 864 | Pel* piResi = ( uiChromaId > 0 ? pcResiYuv->getCrAddr( uiAbsPartIdx ) : pcResiYuv->getCbAddr( uiAbsPartIdx ) ); |
---|
| 865 | |
---|
| 866 | UInt uiNumCoeffInc = ( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ) ) >> 2; |
---|
| 867 | TCoeff* pcCoeff = ( uiChromaId > 0 ? pcCU->getCoeffCr() : pcCU->getCoeffCb() ) + ( uiNumCoeffInc * uiAbsPartIdx ); |
---|
| 868 | |
---|
| 869 | UInt uiChromaPredMode = pcCU->getChromaIntraDir( 0 ); |
---|
| 870 | |
---|
| 871 | UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
| 872 | Pel* piRecIPred = ( uiChromaId > 0 ? pcCU->getPic()->getPicYuvRec()->getCrAddr( pcCU->getAddr(), uiZOrder ) : pcCU->getPic()->getPicYuvRec()->getCbAddr( pcCU->getAddr(), uiZOrder ) ); |
---|
| 873 | UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getCStride(); |
---|
| 874 | |
---|
| 875 | //===== init availability pattern ===== |
---|
| 876 | Bool bAboveAvail = false; |
---|
| 877 | Bool bLeftAvail = false; |
---|
| 878 | pcCU->getPattern()->initPattern ( pcCU, uiTrDepth, uiAbsPartIdx ); |
---|
[56] | 879 | |
---|
| 880 | if( uiChromaPredMode == LM_CHROMA_IDX && uiChromaId == 0 ) |
---|
| 881 | { |
---|
| 882 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, |
---|
| 883 | m_pcPrediction->getPredicBuf (), |
---|
| 884 | m_pcPrediction->getPredicBufWidth (), |
---|
| 885 | m_pcPrediction->getPredicBufHeight (), |
---|
| 886 | bAboveAvail, bLeftAvail, |
---|
| 887 | true ); |
---|
| 888 | |
---|
| 889 | m_pcPrediction->getLumaRecPixels( pcCU->getPattern(), uiWidth, uiHeight ); |
---|
| 890 | } |
---|
| 891 | |
---|
[2] | 892 | pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth, |
---|
| 893 | m_pcPrediction->getPredicBuf (), |
---|
| 894 | m_pcPrediction->getPredicBufWidth (), |
---|
| 895 | m_pcPrediction->getPredicBufHeight (), |
---|
| 896 | bAboveAvail, bLeftAvail ); |
---|
| 897 | Int* pPatChroma = ( uiChromaId > 0 ? pcCU->getPattern()->getAdiCrBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) : pcCU->getPattern()->getAdiCbBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) ); |
---|
| 898 | |
---|
| 899 | //===== get prediction signal ===== |
---|
[56] | 900 | if( uiChromaPredMode == LM_CHROMA_IDX ) |
---|
[2] | 901 | { |
---|
[56] | 902 | m_pcPrediction->predLMIntraChroma( pcCU->getPattern(), pPatChroma, piPred, uiStride, uiWidth, uiHeight, uiChromaId ); |
---|
[2] | 903 | } |
---|
| 904 | else |
---|
| 905 | { |
---|
[56] | 906 | if( uiChromaPredMode == DM_CHROMA_IDX ) |
---|
[2] | 907 | { |
---|
[56] | 908 | uiChromaPredMode = pcCU->getLumaIntraDir( 0 ); |
---|
| 909 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 910 | mapDMMtoIntraMode( uiChromaPredMode ); |
---|
| 911 | #endif |
---|
[2] | 912 | } |
---|
[56] | 913 | m_pcPrediction->predIntraChromaAng( pcCU->getPattern(), pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
[2] | 914 | } |
---|
| 915 | |
---|
| 916 | //===== inverse transform ===== |
---|
[56] | 917 | if(eText == TEXT_CHROMA_U) |
---|
| 918 | { |
---|
| 919 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 920 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() ); |
---|
[2] | 921 | #else |
---|
[56] | 922 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getPPS()->getChromaQpOffset() ); |
---|
[2] | 923 | #endif |
---|
[56] | 924 | } |
---|
| 925 | else |
---|
| 926 | { |
---|
| 927 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 928 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); |
---|
| 929 | #else |
---|
| 930 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); |
---|
| 931 | #endif |
---|
| 932 | } |
---|
[2] | 933 | |
---|
[56] | 934 | Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText]; |
---|
| 935 | assert(scalingListType < 6); |
---|
| 936 | #if LOSSLESS_CODING |
---|
| 937 | m_pcTrQuant->invtransformNxN( pcCU, eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); |
---|
| 938 | #else |
---|
| 939 | m_pcTrQuant->invtransformNxN( eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); |
---|
| 940 | #endif |
---|
| 941 | |
---|
[2] | 942 | //===== reconstruction ===== |
---|
[56] | 943 | Pel* pPred = piPred; |
---|
| 944 | Pel* pResi = piResi; |
---|
| 945 | Pel* pReco = piReco; |
---|
| 946 | Pel* pRecIPred = piRecIPred; |
---|
| 947 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
[2] | 948 | { |
---|
[56] | 949 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
[2] | 950 | { |
---|
[56] | 951 | pReco [ uiX ] = Clip( pPred[ uiX ] + pResi[ uiX ] ); |
---|
| 952 | pRecIPred[ uiX ] = pReco[ uiX ]; |
---|
[2] | 953 | } |
---|
[56] | 954 | pPred += uiStride; |
---|
| 955 | pResi += uiStride; |
---|
| 956 | pReco += uiStride; |
---|
| 957 | pRecIPred += uiRecIPredStride; |
---|
[2] | 958 | } |
---|
| 959 | } |
---|
| 960 | |
---|
| 961 | Void |
---|
| 962 | TDecCu::xIntraRecQT( TComDataCU* pcCU, |
---|
| 963 | UInt uiTrDepth, |
---|
| 964 | UInt uiAbsPartIdx, |
---|
| 965 | TComYuv* pcRecoYuv, |
---|
| 966 | TComYuv* pcPredYuv, |
---|
| 967 | TComYuv* pcResiYuv ) |
---|
| 968 | { |
---|
| 969 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
---|
| 970 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
---|
| 971 | if( uiTrMode == uiTrDepth ) |
---|
| 972 | { |
---|
| 973 | xIntraRecLumaBlk ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 974 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 ); |
---|
| 975 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 ); |
---|
| 976 | } |
---|
| 977 | else |
---|
| 978 | { |
---|
| 979 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
---|
| 980 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
---|
| 981 | { |
---|
| 982 | xIntraRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 983 | } |
---|
| 984 | } |
---|
| 985 | } |
---|
| 986 | |
---|
| 987 | Void |
---|
| 988 | TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 989 | { |
---|
| 990 | UInt uiInitTrDepth = ( pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1 ); |
---|
| 991 | UInt uiNumPart = pcCU->getNumPartInter(); |
---|
| 992 | UInt uiNumQParts = pcCU->getTotalNumPart() >> 2; |
---|
| 993 | |
---|
[56] | 994 | if (pcCU->getIPCMFlag(0)) |
---|
| 995 | { |
---|
| 996 | xReconPCM( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 997 | return; |
---|
| 998 | } |
---|
| 999 | |
---|
[2] | 1000 | for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ ) |
---|
| 1001 | { |
---|
| 1002 | xIntraLumaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] ); |
---|
| 1003 | } |
---|
| 1004 | |
---|
| 1005 | for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ ) |
---|
| 1006 | { |
---|
| 1007 | xIntraChromaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] ); |
---|
| 1008 | } |
---|
| 1009 | |
---|
| 1010 | } |
---|
| 1011 | |
---|
[189] | 1012 | #if RWTH_SDC_DLT_B0036 |
---|
| 1013 | Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 1014 | { |
---|
| 1015 | UInt uiWidth = pcCU->getWidth ( 0 ); |
---|
| 1016 | UInt uiHeight = pcCU->getHeight ( 0 ); |
---|
| 1017 | |
---|
| 1018 | TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth]; |
---|
| 1019 | TComYuv* pcPredYuv = m_ppcYuvReco[uiDepth]; |
---|
| 1020 | TComYuv* pcResiYuv = m_ppcYuvResi[uiDepth]; |
---|
| 1021 | |
---|
| 1022 | UInt uiStride = pcRecoYuv->getStride (); |
---|
| 1023 | Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 1024 | Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 1025 | Pel* piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 1026 | |
---|
| 1027 | UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
| 1028 | Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); |
---|
| 1029 | UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); |
---|
| 1030 | |
---|
| 1031 | UInt uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); |
---|
| 1032 | |
---|
| 1033 | AOF( uiWidth == uiHeight ); |
---|
| 1034 | AOF( uiAbsPartIdx == 0 ); |
---|
| 1035 | AOF( pcCU->getSDCAvailable(uiAbsPartIdx) ); |
---|
| 1036 | AOF( pcCU->getSDCFlag(uiAbsPartIdx) ); |
---|
| 1037 | |
---|
| 1038 | //===== init availability pattern ===== |
---|
| 1039 | Bool bAboveAvail = false; |
---|
| 1040 | Bool bLeftAvail = false; |
---|
| 1041 | pcCU->getPattern()->initPattern ( pcCU, 0, uiAbsPartIdx ); |
---|
| 1042 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail ); |
---|
| 1043 | |
---|
| 1044 | //===== get prediction signal ===== |
---|
| 1045 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 1046 | if( uiLumaPredMode >= NUM_INTRA_MODE ) |
---|
| 1047 | { |
---|
| 1048 | m_pcPrediction->predIntraLumaDMM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, false ); |
---|
| 1049 | } |
---|
| 1050 | else |
---|
| 1051 | { |
---|
| 1052 | #endif |
---|
| 1053 | m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
| 1054 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 1055 | } |
---|
| 1056 | #endif |
---|
| 1057 | |
---|
| 1058 | // number of segments depends on prediction mode |
---|
| 1059 | UInt uiNumSegments = 1; |
---|
| 1060 | Bool* pbMask = NULL; |
---|
| 1061 | UInt uiMaskStride = 0; |
---|
| 1062 | |
---|
| 1063 | if( uiLumaPredMode == DMM_WEDGE_FULL_IDX || uiLumaPredMode == DMM_WEDGE_PREDDIR_IDX ) |
---|
| 1064 | { |
---|
| 1065 | Int uiTabIdx = (uiLumaPredMode == DMM_WEDGE_FULL_IDX)?pcCU->getWedgeFullTabIdx(uiAbsPartIdx):pcCU->getWedgePredDirTabIdx(uiAbsPartIdx); |
---|
| 1066 | |
---|
| 1067 | WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])]; |
---|
| 1068 | TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx )); |
---|
| 1069 | |
---|
| 1070 | uiNumSegments = 2; |
---|
| 1071 | pbMask = pcWedgelet->getPattern(); |
---|
| 1072 | uiMaskStride = pcWedgelet->getStride(); |
---|
| 1073 | } |
---|
| 1074 | |
---|
| 1075 | // get DC prediction for each segment |
---|
| 1076 | Pel apDCPredValues[2]; |
---|
| 1077 | xAnalyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride); |
---|
| 1078 | |
---|
| 1079 | // reconstruct residual based on mask + DC residuals |
---|
| 1080 | Pel apDCResiValues[2]; |
---|
[231] | 1081 | //Pel apDCRecoValues[2]; |
---|
[189] | 1082 | for( UInt ui = 0; ui < uiNumSegments; ui++ ) |
---|
| 1083 | { |
---|
| 1084 | Pel pPredIdx = GetDepthValue2Idx( apDCPredValues[ui] ); |
---|
| 1085 | Pel pResiIdx = pcCU->getSDCSegmentDCOffset(ui, uiAbsPartIdx); |
---|
| 1086 | Pel pRecoValue = GetIdx2DepthValue( pPredIdx + pResiIdx ); |
---|
| 1087 | |
---|
[231] | 1088 | //apDCRecoValues[ui] = pRecoValue; |
---|
[189] | 1089 | apDCResiValues[ui] = pRecoValue - apDCPredValues[ui]; |
---|
| 1090 | } |
---|
| 1091 | |
---|
| 1092 | //===== reconstruction ===== |
---|
| 1093 | Bool*pMask = pbMask; |
---|
| 1094 | Pel* pPred = piPred; |
---|
| 1095 | Pel* pResi = piResi; |
---|
| 1096 | Pel* pReco = piReco; |
---|
| 1097 | Pel* pRecIPred = piRecIPred; |
---|
| 1098 | |
---|
| 1099 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
| 1100 | { |
---|
| 1101 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
| 1102 | { |
---|
| 1103 | UChar ucSegment = pMask?(UChar)pMask[uiX]:0; |
---|
| 1104 | assert( ucSegment < uiNumSegments ); |
---|
| 1105 | |
---|
| 1106 | Pel pPredVal= apDCPredValues[ucSegment]; |
---|
| 1107 | Pel pResiDC = apDCResiValues[ucSegment]; |
---|
| 1108 | |
---|
| 1109 | pReco [ uiX ] = Clip( pPredVal + pResiDC ); |
---|
| 1110 | pRecIPred[ uiX ] = pReco[ uiX ]; |
---|
| 1111 | } |
---|
| 1112 | pPred += uiStride; |
---|
| 1113 | pResi += uiStride; |
---|
| 1114 | pReco += uiStride; |
---|
| 1115 | pRecIPred += uiRecIPredStride; |
---|
| 1116 | pMask += uiMaskStride; |
---|
| 1117 | } |
---|
| 1118 | |
---|
| 1119 | // clear UV |
---|
| 1120 | UInt uiStrideC = pcPredYuv->getCStride(); |
---|
| 1121 | Pel *pRecCb = pcPredYuv->getCbAddr(); |
---|
| 1122 | Pel *pRecCr = pcPredYuv->getCrAddr(); |
---|
| 1123 | |
---|
| 1124 | for (Int y=0; y<uiHeight/2; y++) |
---|
| 1125 | { |
---|
| 1126 | for (Int x=0; x<uiWidth/2; x++) |
---|
| 1127 | { |
---|
| 1128 | pRecCb[x] = (Pel)(128<<g_uiBitIncrement); |
---|
| 1129 | pRecCr[x] = (Pel)(128<<g_uiBitIncrement); |
---|
| 1130 | } |
---|
| 1131 | |
---|
| 1132 | pRecCb += uiStrideC; |
---|
| 1133 | pRecCr += uiStrideC; |
---|
| 1134 | } |
---|
| 1135 | } |
---|
| 1136 | #endif |
---|
| 1137 | |
---|
[56] | 1138 | /** Function for deriving recontructed PU/CU Luma sample with QTree structure |
---|
[2] | 1139 | * \param pcCU pointer of current CU |
---|
| 1140 | * \param uiTrDepth current tranform split depth |
---|
| 1141 | * \param uiAbsPartIdx part index |
---|
| 1142 | * \param pcRecoYuv pointer to reconstructed sample arrays |
---|
| 1143 | * \param pcPredYuv pointer to prediction sample arrays |
---|
| 1144 | * \param pcResiYuv pointer to residue sample arrays |
---|
| 1145 | * |
---|
| 1146 | \ This function dervies recontructed PU/CU Luma sample with recursive QTree structure |
---|
| 1147 | */ |
---|
| 1148 | Void |
---|
| 1149 | TDecCu::xIntraLumaRecQT( TComDataCU* pcCU, |
---|
| 1150 | UInt uiTrDepth, |
---|
| 1151 | UInt uiAbsPartIdx, |
---|
| 1152 | TComYuv* pcRecoYuv, |
---|
| 1153 | TComYuv* pcPredYuv, |
---|
| 1154 | TComYuv* pcResiYuv ) |
---|
| 1155 | { |
---|
| 1156 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
---|
| 1157 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
---|
| 1158 | if( uiTrMode == uiTrDepth ) |
---|
| 1159 | { |
---|
| 1160 | xIntraRecLumaBlk ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 1161 | } |
---|
| 1162 | else |
---|
| 1163 | { |
---|
| 1164 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
---|
| 1165 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
---|
| 1166 | { |
---|
| 1167 | xIntraLumaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 1168 | } |
---|
| 1169 | } |
---|
| 1170 | } |
---|
| 1171 | |
---|
[56] | 1172 | /** Function for deriving recontructed PU/CU chroma samples with QTree structure |
---|
[2] | 1173 | * \param pcCU pointer of current CU |
---|
| 1174 | * \param uiTrDepth current tranform split depth |
---|
| 1175 | * \param uiAbsPartIdx part index |
---|
| 1176 | * \param pcRecoYuv pointer to reconstructed sample arrays |
---|
| 1177 | * \param pcPredYuv pointer to prediction sample arrays |
---|
| 1178 | * \param pcResiYuv pointer to residue sample arrays |
---|
| 1179 | * |
---|
| 1180 | \ This function dervies recontructed PU/CU chroma samples with QTree recursive structure |
---|
| 1181 | */ |
---|
| 1182 | Void |
---|
| 1183 | TDecCu::xIntraChromaRecQT( TComDataCU* pcCU, |
---|
| 1184 | UInt uiTrDepth, |
---|
| 1185 | UInt uiAbsPartIdx, |
---|
| 1186 | TComYuv* pcRecoYuv, |
---|
| 1187 | TComYuv* pcPredYuv, |
---|
| 1188 | TComYuv* pcResiYuv ) |
---|
| 1189 | { |
---|
| 1190 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
---|
| 1191 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
---|
| 1192 | if( uiTrMode == uiTrDepth ) |
---|
| 1193 | { |
---|
| 1194 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 ); |
---|
| 1195 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 ); |
---|
| 1196 | } |
---|
| 1197 | else |
---|
| 1198 | { |
---|
| 1199 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
---|
| 1200 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
---|
| 1201 | { |
---|
| 1202 | xIntraChromaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 1203 | } |
---|
| 1204 | } |
---|
| 1205 | } |
---|
| 1206 | |
---|
| 1207 | Void TDecCu::xCopyToPic( TComDataCU* pcCU, TComPic* pcPic, UInt uiZorderIdx, UInt uiDepth ) |
---|
| 1208 | { |
---|
| 1209 | UInt uiCUAddr = pcCU->getAddr(); |
---|
| 1210 | |
---|
| 1211 | m_ppcYuvReco[uiDepth]->copyToPicYuv ( pcPic->getPicYuvRec (), uiCUAddr, uiZorderIdx ); |
---|
| 1212 | |
---|
| 1213 | return; |
---|
| 1214 | } |
---|
| 1215 | |
---|
| 1216 | Void TDecCu::xDecodeInterTexture ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 1217 | { |
---|
| 1218 | UInt uiWidth = pcCU->getWidth ( uiAbsPartIdx ); |
---|
| 1219 | UInt uiHeight = pcCU->getHeight( uiAbsPartIdx ); |
---|
| 1220 | TCoeff* piCoeff; |
---|
| 1221 | |
---|
| 1222 | Pel* pResi; |
---|
| 1223 | UInt uiLumaTrMode, uiChromaTrMode; |
---|
| 1224 | |
---|
| 1225 | pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx( uiAbsPartIdx ), uiLumaTrMode, uiChromaTrMode ); |
---|
| 1226 | |
---|
| 1227 | // Y |
---|
| 1228 | piCoeff = pcCU->getCoeffY(); |
---|
| 1229 | pResi = m_ppcYuvResi[uiDepth]->getLumaAddr(); |
---|
[56] | 1230 | |
---|
| 1231 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 1232 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); |
---|
| 1233 | #else |
---|
| 1234 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 ); |
---|
| 1235 | #endif |
---|
| 1236 | |
---|
[2] | 1237 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff ); |
---|
| 1238 | |
---|
| 1239 | // Cb and Cr |
---|
[56] | 1240 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 1241 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() ); |
---|
| 1242 | #else |
---|
| 1243 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset() ); |
---|
| 1244 | #endif |
---|
| 1245 | |
---|
[2] | 1246 | uiWidth >>= 1; |
---|
| 1247 | uiHeight >>= 1; |
---|
| 1248 | piCoeff = pcCU->getCoeffCb(); pResi = m_ppcYuvResi[uiDepth]->getCbAddr(); |
---|
| 1249 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); |
---|
[56] | 1250 | |
---|
| 1251 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 1252 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); |
---|
| 1253 | #else |
---|
| 1254 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); |
---|
| 1255 | #endif |
---|
| 1256 | |
---|
[2] | 1257 | piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr(); |
---|
| 1258 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); |
---|
| 1259 | } |
---|
| 1260 | |
---|
[56] | 1261 | /** Function for deriving reconstructed luma/chroma samples of a PCM mode CU. |
---|
| 1262 | * \param pcCU pointer to current CU |
---|
| 1263 | * \param uiPartIdx part index |
---|
| 1264 | * \param piPCM pointer to PCM code arrays |
---|
| 1265 | * \param piReco pointer to reconstructed sample arrays |
---|
| 1266 | * \param uiStride stride of reconstructed sample arrays |
---|
| 1267 | * \param uiWidth CU width |
---|
| 1268 | * \param uiHeight CU height |
---|
| 1269 | * \param ttText texture component type |
---|
| 1270 | * \returns Void |
---|
| 1271 | */ |
---|
| 1272 | Void TDecCu::xDecodePCMTexture( TComDataCU* pcCU, UInt uiPartIdx, Pel *piPCM, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType ttText) |
---|
| 1273 | { |
---|
| 1274 | UInt uiX, uiY; |
---|
| 1275 | Pel* piPicReco; |
---|
| 1276 | UInt uiPicStride; |
---|
| 1277 | UInt uiPcmLeftShiftBit; |
---|
| 1278 | |
---|
| 1279 | if( ttText == TEXT_LUMA ) |
---|
| 1280 | { |
---|
| 1281 | uiPicStride = pcCU->getPic()->getPicYuvRec()->getStride(); |
---|
| 1282 | piPicReco = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); |
---|
| 1283 | uiPcmLeftShiftBit = g_uiBitDepth + g_uiBitIncrement - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma(); |
---|
| 1284 | } |
---|
| 1285 | else |
---|
| 1286 | { |
---|
| 1287 | uiPicStride = pcCU->getPic()->getPicYuvRec()->getCStride(); |
---|
| 1288 | |
---|
| 1289 | if( ttText == TEXT_CHROMA_U ) |
---|
| 1290 | { |
---|
| 1291 | piPicReco = pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); |
---|
| 1292 | } |
---|
| 1293 | else |
---|
| 1294 | { |
---|
| 1295 | piPicReco = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); |
---|
| 1296 | } |
---|
| 1297 | uiPcmLeftShiftBit = g_uiBitDepth + g_uiBitIncrement - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); |
---|
| 1298 | } |
---|
| 1299 | |
---|
| 1300 | for( uiY = 0; uiY < uiHeight; uiY++ ) |
---|
| 1301 | { |
---|
| 1302 | for( uiX = 0; uiX < uiWidth; uiX++ ) |
---|
| 1303 | { |
---|
| 1304 | piReco[uiX] = (piPCM[uiX] << uiPcmLeftShiftBit); |
---|
| 1305 | piPicReco[uiX] = piReco[uiX]; |
---|
| 1306 | } |
---|
| 1307 | piPCM += uiWidth; |
---|
| 1308 | piReco += uiStride; |
---|
| 1309 | piPicReco += uiPicStride; |
---|
| 1310 | } |
---|
| 1311 | } |
---|
| 1312 | |
---|
| 1313 | /** Function for reconstructing a PCM mode CU. |
---|
| 1314 | * \param pcCU pointer to current CU |
---|
| 1315 | * \param uiAbsPartIdx CU index |
---|
| 1316 | * \param uiDepth CU Depth |
---|
| 1317 | * \returns Void |
---|
| 1318 | */ |
---|
| 1319 | Void TDecCu::xReconPCM( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 1320 | { |
---|
| 1321 | // Luma |
---|
| 1322 | UInt uiWidth = (g_uiMaxCUWidth >> uiDepth); |
---|
| 1323 | UInt uiHeight = (g_uiMaxCUHeight >> uiDepth); |
---|
| 1324 | |
---|
| 1325 | Pel* piPcmY = pcCU->getPCMSampleY(); |
---|
| 1326 | Pel* piRecoY = m_ppcYuvReco[uiDepth]->getLumaAddr(0, uiWidth); |
---|
| 1327 | |
---|
| 1328 | UInt uiStride = m_ppcYuvResi[uiDepth]->getStride(); |
---|
| 1329 | |
---|
| 1330 | xDecodePCMTexture( pcCU, 0, piPcmY, piRecoY, uiStride, uiWidth, uiHeight, TEXT_LUMA); |
---|
| 1331 | |
---|
| 1332 | // Cb and Cr |
---|
| 1333 | UInt uiCWidth = (uiWidth>>1); |
---|
| 1334 | UInt uiCHeight = (uiHeight>>1); |
---|
| 1335 | |
---|
| 1336 | Pel* piPcmCb = pcCU->getPCMSampleCb(); |
---|
| 1337 | Pel* piPcmCr = pcCU->getPCMSampleCr(); |
---|
| 1338 | Pel* pRecoCb = m_ppcYuvReco[uiDepth]->getCbAddr(); |
---|
| 1339 | Pel* pRecoCr = m_ppcYuvReco[uiDepth]->getCrAddr(); |
---|
| 1340 | |
---|
| 1341 | UInt uiCStride = m_ppcYuvReco[uiDepth]->getCStride(); |
---|
| 1342 | |
---|
| 1343 | xDecodePCMTexture( pcCU, 0, piPcmCb, pRecoCb, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_U); |
---|
| 1344 | xDecodePCMTexture( pcCU, 0, piPcmCr, pRecoCr, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_V); |
---|
| 1345 | } |
---|
| 1346 | |
---|
| 1347 | #if LOSSLESS_CODING |
---|
| 1348 | /** Function for filling the PCM buffer of a CU using its reconstructed sample array |
---|
| 1349 | * \param pcCU pointer to current CU |
---|
| 1350 | * \param uiAbsPartIdx CU index |
---|
| 1351 | * \param uiDepth CU Depth |
---|
| 1352 | * \returns Void |
---|
| 1353 | */ |
---|
| 1354 | Void TDecCu::xFillPCMBuffer(TComDataCU* pCU, UInt absPartIdx, UInt depth) |
---|
| 1355 | { |
---|
| 1356 | // Luma |
---|
| 1357 | UInt width = (g_uiMaxCUWidth >> depth); |
---|
| 1358 | UInt height = (g_uiMaxCUHeight >> depth); |
---|
| 1359 | |
---|
| 1360 | Pel* pPcmY = pCU->getPCMSampleY(); |
---|
| 1361 | Pel* pRecoY = m_ppcYuvReco[depth]->getLumaAddr(0, width); |
---|
| 1362 | |
---|
| 1363 | UInt stride = m_ppcYuvReco[depth]->getStride(); |
---|
| 1364 | |
---|
| 1365 | for(Int y = 0; y < height; y++ ) |
---|
| 1366 | { |
---|
| 1367 | for(Int x = 0; x < width; x++ ) |
---|
| 1368 | { |
---|
| 1369 | pPcmY[x] = pRecoY[x]; |
---|
| 1370 | } |
---|
| 1371 | pPcmY += width; |
---|
| 1372 | pRecoY += stride; |
---|
| 1373 | } |
---|
| 1374 | |
---|
| 1375 | // Cb and Cr |
---|
| 1376 | UInt widthC = (width>>1); |
---|
| 1377 | UInt heightC = (height>>1); |
---|
| 1378 | |
---|
| 1379 | Pel* pPcmCb = pCU->getPCMSampleCb(); |
---|
| 1380 | Pel* pPcmCr = pCU->getPCMSampleCr(); |
---|
| 1381 | Pel* pRecoCb = m_ppcYuvReco[depth]->getCbAddr(); |
---|
| 1382 | Pel* pRecoCr = m_ppcYuvReco[depth]->getCrAddr(); |
---|
| 1383 | |
---|
| 1384 | UInt strideC = m_ppcYuvReco[depth]->getCStride(); |
---|
| 1385 | |
---|
| 1386 | for(Int y = 0; y < heightC; y++ ) |
---|
| 1387 | { |
---|
| 1388 | for(Int x = 0; x < widthC; x++ ) |
---|
| 1389 | { |
---|
| 1390 | pPcmCb[x] = pRecoCb[x]; |
---|
| 1391 | pPcmCr[x] = pRecoCr[x]; |
---|
| 1392 | } |
---|
| 1393 | pPcmCr += widthC; |
---|
| 1394 | pPcmCb += widthC; |
---|
| 1395 | pRecoCb += strideC; |
---|
| 1396 | pRecoCr += strideC; |
---|
| 1397 | } |
---|
| 1398 | |
---|
| 1399 | } |
---|
| 1400 | #endif |
---|
| 1401 | |
---|
[189] | 1402 | #if RWTH_SDC_DLT_B0036 |
---|
| 1403 | Void TDecCu::xAnalyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride ) |
---|
| 1404 | { |
---|
| 1405 | Int iSumDepth[2]; |
---|
| 1406 | memset(iSumDepth, 0, sizeof(Int)*2); |
---|
| 1407 | Int iSumPix[2]; |
---|
| 1408 | memset(iSumPix, 0, sizeof(Int)*2); |
---|
| 1409 | |
---|
| 1410 | for (Int y=0; y<uiSize; y++) |
---|
| 1411 | { |
---|
| 1412 | for (Int x=0; x<uiSize; x++) |
---|
| 1413 | { |
---|
| 1414 | UChar ucSegment = pMask?(UChar)pMask[x]:0; |
---|
| 1415 | assert( ucSegment < uiNumSegments ); |
---|
| 1416 | |
---|
| 1417 | iSumDepth[ucSegment] += pOrig[x]; |
---|
| 1418 | iSumPix[ucSegment] += 1; |
---|
| 1419 | } |
---|
| 1420 | |
---|
| 1421 | pOrig += uiStride; |
---|
| 1422 | pMask += uiMaskStride; |
---|
| 1423 | } |
---|
| 1424 | |
---|
| 1425 | // compute mean for each segment |
---|
| 1426 | for( UChar ucSeg = 0; ucSeg < uiNumSegments; ucSeg++ ) |
---|
| 1427 | { |
---|
| 1428 | if( iSumPix[ucSeg] > 0 ) |
---|
| 1429 | rpSegMeans[ucSeg] = iSumDepth[ucSeg] / iSumPix[ucSeg]; |
---|
| 1430 | else |
---|
| 1431 | rpSegMeans[ucSeg] = 0; // this happens for zero-segments |
---|
| 1432 | } |
---|
| 1433 | } |
---|
| 1434 | #endif |
---|
| 1435 | |
---|
[56] | 1436 | //! \} |
---|