[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 |
---|
[5] | 402 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[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 | |
---|
[5] | 454 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[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 | |
---|
[5] | 662 | #if HHI_MPI |
---|
[2] | 663 | if( pcCU->getTextureModeDepth( 0 ) != -1 ) |
---|
| 664 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); |
---|
| 665 | #endif |
---|
[56] | 666 | |
---|
[5] | 667 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 668 | if( pcCU->getResPredFlag( 0 ) ) |
---|
| 669 | { |
---|
| 670 | AOF( pcCU->getResPredAvail( 0 ) ); |
---|
[77] | 671 | Bool bOK = pcCU->getResidualSamples( 0, |
---|
| 672 | #if QC_SIMPLIFIEDIVRP_M24938 |
---|
| 673 | true, |
---|
| 674 | #endif |
---|
| 675 | m_ppcYuvResPred[uiDepth] ); |
---|
[2] | 676 | AOF( bOK ); |
---|
[77] | 677 | #if LG_RESTRICTEDRESPRED_M24766 |
---|
[100] | 678 | Int iPUResiPredShift[4]; |
---|
| 679 | pcCU->getPUResiPredShift(iPUResiPredShift, 0); |
---|
| 680 | m_ppcYuvReco[uiDepth]->add(iPUResiPredShift, pcCU->getPartitionSize(0), m_ppcYuvResPred[uiDepth], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) ); |
---|
[77] | 681 | #else |
---|
[2] | 682 | m_ppcYuvReco[uiDepth]->add( m_ppcYuvResPred[uiDepth], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) ); |
---|
[77] | 683 | #endif |
---|
[2] | 684 | } |
---|
[5] | 685 | #endif |
---|
| 686 | |
---|
[2] | 687 | // inter recon |
---|
| 688 | xDecodeInterTexture( pcCU, 0, uiDepth ); |
---|
| 689 | |
---|
| 690 | // clip for only non-zero cbp case |
---|
| 691 | if ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V ) ) ) |
---|
| 692 | { |
---|
| 693 | m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) ); |
---|
| 694 | } |
---|
| 695 | else |
---|
| 696 | { |
---|
[5] | 697 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 698 | if( pcCU->getResPredFlag( 0 ) ) |
---|
| 699 | { |
---|
| 700 | m_ppcYuvReco[uiDepth]->clip( pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) ); |
---|
| 701 | } |
---|
[5] | 702 | #endif |
---|
[2] | 703 | m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 )); |
---|
| 704 | } |
---|
| 705 | } |
---|
| 706 | |
---|
| 707 | Void |
---|
| 708 | TDecCu::xIntraRecLumaBlk( TComDataCU* pcCU, |
---|
| 709 | UInt uiTrDepth, |
---|
| 710 | UInt uiAbsPartIdx, |
---|
| 711 | TComYuv* pcRecoYuv, |
---|
| 712 | TComYuv* pcPredYuv, |
---|
| 713 | TComYuv* pcResiYuv ) |
---|
| 714 | { |
---|
| 715 | UInt uiWidth = pcCU ->getWidth ( 0 ) >> uiTrDepth; |
---|
| 716 | UInt uiHeight = pcCU ->getHeight ( 0 ) >> uiTrDepth; |
---|
| 717 | UInt uiStride = pcRecoYuv->getStride (); |
---|
| 718 | Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 719 | Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 720 | Pel* piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 721 | |
---|
| 722 | UInt uiNumCoeffInc = ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ); |
---|
| 723 | TCoeff* pcCoeff = pcCU->getCoeffY() + ( uiNumCoeffInc * uiAbsPartIdx ); |
---|
| 724 | |
---|
| 725 | UInt uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); |
---|
| 726 | |
---|
| 727 | UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
| 728 | Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); |
---|
| 729 | UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); |
---|
| 730 | |
---|
| 731 | //===== init availability pattern ===== |
---|
| 732 | Bool bAboveAvail = false; |
---|
| 733 | Bool bLeftAvail = false; |
---|
| 734 | pcCU->getPattern()->initPattern ( pcCU, uiTrDepth, uiAbsPartIdx ); |
---|
| 735 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, |
---|
| 736 | m_pcPrediction->getPredicBuf (), |
---|
| 737 | m_pcPrediction->getPredicBufWidth (), |
---|
| 738 | m_pcPrediction->getPredicBufHeight (), |
---|
| 739 | bAboveAvail, bLeftAvail ); |
---|
[189] | 740 | #if LGE_EDGE_INTRA_A0070 |
---|
[100] | 741 | if( uiLumaPredMode >= EDGE_INTRA_IDX ) |
---|
| 742 | { |
---|
| 743 | m_pcPrediction->predIntraLumaEdge( pcCU, pcCU->getPattern(), uiAbsPartIdx, uiWidth, uiHeight, piPred, uiStride |
---|
| 744 | #if LGE_EDGE_INTRA_DELTA_DC |
---|
| 745 | , uiLumaPredMode == EDGE_INTRA_DELTA_IDX |
---|
| 746 | #endif |
---|
| 747 | ); |
---|
| 748 | } |
---|
| 749 | else |
---|
| 750 | #endif |
---|
[2] | 751 | |
---|
[56] | 752 | //===== get prediction signal ===== |
---|
[5] | 753 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[56] | 754 | if( uiLumaPredMode >= NUM_INTRA_MODE ) |
---|
[2] | 755 | { |
---|
| 756 | m_pcPrediction->predIntraLumaDMM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, false ); |
---|
| 757 | } |
---|
| 758 | else |
---|
[56] | 759 | { |
---|
[2] | 760 | #endif |
---|
| 761 | m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
[56] | 762 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[2] | 763 | } |
---|
[56] | 764 | #endif |
---|
| 765 | |
---|
[2] | 766 | //===== inverse transform ===== |
---|
[56] | 767 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 768 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); |
---|
[2] | 769 | #else |
---|
[56] | 770 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 ); |
---|
| 771 | #endif |
---|
[2] | 772 | |
---|
[56] | 773 | Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA]; |
---|
| 774 | assert(scalingListType < 6); |
---|
| 775 | #if LOSSLESS_CODING |
---|
| 776 | m_pcTrQuant->invtransformNxN( pcCU, TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); |
---|
| 777 | #else |
---|
| 778 | m_pcTrQuant->invtransformNxN( TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); |
---|
| 779 | #endif |
---|
| 780 | |
---|
[2] | 781 | |
---|
| 782 | //===== reconstruction ===== |
---|
[56] | 783 | Pel* pPred = piPred; |
---|
| 784 | Pel* pResi = piResi; |
---|
| 785 | Pel* pReco = piReco; |
---|
| 786 | Pel* pRecIPred = piRecIPred; |
---|
| 787 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
[2] | 788 | { |
---|
[56] | 789 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
[2] | 790 | { |
---|
[56] | 791 | pReco [ uiX ] = Clip( pPred[ uiX ] + pResi[ uiX ] ); |
---|
| 792 | pRecIPred[ uiX ] = pReco[ uiX ]; |
---|
[2] | 793 | } |
---|
[56] | 794 | pPred += uiStride; |
---|
| 795 | pResi += uiStride; |
---|
| 796 | pReco += uiStride; |
---|
| 797 | pRecIPred += uiRecIPredStride; |
---|
[2] | 798 | } |
---|
| 799 | } |
---|
| 800 | |
---|
| 801 | |
---|
| 802 | Void |
---|
| 803 | TDecCu::xIntraRecChromaBlk( TComDataCU* pcCU, |
---|
| 804 | UInt uiTrDepth, |
---|
| 805 | UInt uiAbsPartIdx, |
---|
| 806 | TComYuv* pcRecoYuv, |
---|
| 807 | TComYuv* pcPredYuv, |
---|
| 808 | TComYuv* pcResiYuv, |
---|
| 809 | UInt uiChromaId ) |
---|
| 810 | { |
---|
| 811 | UInt uiFullDepth = pcCU->getDepth( 0 ) + uiTrDepth; |
---|
| 812 | UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiFullDepth ] + 2; |
---|
[56] | 813 | |
---|
| 814 | if( uiLog2TrSize == 2 ) |
---|
[2] | 815 | { |
---|
| 816 | assert( uiTrDepth > 0 ); |
---|
| 817 | uiTrDepth--; |
---|
| 818 | UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth( 0 ) + uiTrDepth ) << 1 ); |
---|
| 819 | Bool bFirstQ = ( ( uiAbsPartIdx % uiQPDiv ) == 0 ); |
---|
| 820 | if( !bFirstQ ) |
---|
| 821 | { |
---|
| 822 | return; |
---|
| 823 | } |
---|
| 824 | } |
---|
| 825 | |
---|
| 826 | TextType eText = ( uiChromaId > 0 ? TEXT_CHROMA_V : TEXT_CHROMA_U ); |
---|
| 827 | UInt uiWidth = pcCU ->getWidth ( 0 ) >> ( uiTrDepth + 1 ); |
---|
| 828 | UInt uiHeight = pcCU ->getHeight ( 0 ) >> ( uiTrDepth + 1 ); |
---|
| 829 | UInt uiStride = pcRecoYuv->getCStride (); |
---|
| 830 | Pel* piReco = ( uiChromaId > 0 ? pcRecoYuv->getCrAddr( uiAbsPartIdx ) : pcRecoYuv->getCbAddr( uiAbsPartIdx ) ); |
---|
| 831 | Pel* piPred = ( uiChromaId > 0 ? pcPredYuv->getCrAddr( uiAbsPartIdx ) : pcPredYuv->getCbAddr( uiAbsPartIdx ) ); |
---|
| 832 | Pel* piResi = ( uiChromaId > 0 ? pcResiYuv->getCrAddr( uiAbsPartIdx ) : pcResiYuv->getCbAddr( uiAbsPartIdx ) ); |
---|
| 833 | |
---|
| 834 | UInt uiNumCoeffInc = ( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ) ) >> 2; |
---|
| 835 | TCoeff* pcCoeff = ( uiChromaId > 0 ? pcCU->getCoeffCr() : pcCU->getCoeffCb() ) + ( uiNumCoeffInc * uiAbsPartIdx ); |
---|
| 836 | |
---|
| 837 | UInt uiChromaPredMode = pcCU->getChromaIntraDir( 0 ); |
---|
| 838 | |
---|
| 839 | UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
| 840 | Pel* piRecIPred = ( uiChromaId > 0 ? pcCU->getPic()->getPicYuvRec()->getCrAddr( pcCU->getAddr(), uiZOrder ) : pcCU->getPic()->getPicYuvRec()->getCbAddr( pcCU->getAddr(), uiZOrder ) ); |
---|
| 841 | UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getCStride(); |
---|
| 842 | |
---|
| 843 | //===== init availability pattern ===== |
---|
| 844 | Bool bAboveAvail = false; |
---|
| 845 | Bool bLeftAvail = false; |
---|
| 846 | pcCU->getPattern()->initPattern ( pcCU, uiTrDepth, uiAbsPartIdx ); |
---|
[56] | 847 | |
---|
| 848 | if( uiChromaPredMode == LM_CHROMA_IDX && uiChromaId == 0 ) |
---|
| 849 | { |
---|
| 850 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, |
---|
| 851 | m_pcPrediction->getPredicBuf (), |
---|
| 852 | m_pcPrediction->getPredicBufWidth (), |
---|
| 853 | m_pcPrediction->getPredicBufHeight (), |
---|
| 854 | bAboveAvail, bLeftAvail, |
---|
| 855 | true ); |
---|
| 856 | |
---|
| 857 | m_pcPrediction->getLumaRecPixels( pcCU->getPattern(), uiWidth, uiHeight ); |
---|
| 858 | } |
---|
| 859 | |
---|
[2] | 860 | pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth, |
---|
| 861 | m_pcPrediction->getPredicBuf (), |
---|
| 862 | m_pcPrediction->getPredicBufWidth (), |
---|
| 863 | m_pcPrediction->getPredicBufHeight (), |
---|
| 864 | bAboveAvail, bLeftAvail ); |
---|
| 865 | Int* pPatChroma = ( uiChromaId > 0 ? pcCU->getPattern()->getAdiCrBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) : pcCU->getPattern()->getAdiCbBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) ); |
---|
| 866 | |
---|
| 867 | //===== get prediction signal ===== |
---|
[56] | 868 | if( uiChromaPredMode == LM_CHROMA_IDX ) |
---|
[2] | 869 | { |
---|
[56] | 870 | m_pcPrediction->predLMIntraChroma( pcCU->getPattern(), pPatChroma, piPred, uiStride, uiWidth, uiHeight, uiChromaId ); |
---|
[2] | 871 | } |
---|
| 872 | else |
---|
| 873 | { |
---|
[56] | 874 | if( uiChromaPredMode == DM_CHROMA_IDX ) |
---|
[2] | 875 | { |
---|
[56] | 876 | uiChromaPredMode = pcCU->getLumaIntraDir( 0 ); |
---|
| 877 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 878 | mapDMMtoIntraMode( uiChromaPredMode ); |
---|
| 879 | #endif |
---|
[2] | 880 | } |
---|
[56] | 881 | m_pcPrediction->predIntraChromaAng( pcCU->getPattern(), pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
[2] | 882 | } |
---|
| 883 | |
---|
| 884 | //===== inverse transform ===== |
---|
[56] | 885 | if(eText == TEXT_CHROMA_U) |
---|
| 886 | { |
---|
| 887 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 888 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() ); |
---|
[2] | 889 | #else |
---|
[56] | 890 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getPPS()->getChromaQpOffset() ); |
---|
[2] | 891 | #endif |
---|
[56] | 892 | } |
---|
| 893 | else |
---|
| 894 | { |
---|
| 895 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 896 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); |
---|
| 897 | #else |
---|
| 898 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); |
---|
| 899 | #endif |
---|
| 900 | } |
---|
[2] | 901 | |
---|
[56] | 902 | Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText]; |
---|
| 903 | assert(scalingListType < 6); |
---|
| 904 | #if LOSSLESS_CODING |
---|
| 905 | m_pcTrQuant->invtransformNxN( pcCU, eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); |
---|
| 906 | #else |
---|
| 907 | m_pcTrQuant->invtransformNxN( eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); |
---|
| 908 | #endif |
---|
| 909 | |
---|
[2] | 910 | //===== reconstruction ===== |
---|
[56] | 911 | Pel* pPred = piPred; |
---|
| 912 | Pel* pResi = piResi; |
---|
| 913 | Pel* pReco = piReco; |
---|
| 914 | Pel* pRecIPred = piRecIPred; |
---|
| 915 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
[2] | 916 | { |
---|
[56] | 917 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
[2] | 918 | { |
---|
[56] | 919 | pReco [ uiX ] = Clip( pPred[ uiX ] + pResi[ uiX ] ); |
---|
| 920 | pRecIPred[ uiX ] = pReco[ uiX ]; |
---|
[2] | 921 | } |
---|
[56] | 922 | pPred += uiStride; |
---|
| 923 | pResi += uiStride; |
---|
| 924 | pReco += uiStride; |
---|
| 925 | pRecIPred += uiRecIPredStride; |
---|
[2] | 926 | } |
---|
| 927 | } |
---|
| 928 | |
---|
| 929 | Void |
---|
| 930 | TDecCu::xIntraRecQT( TComDataCU* pcCU, |
---|
| 931 | UInt uiTrDepth, |
---|
| 932 | UInt uiAbsPartIdx, |
---|
| 933 | TComYuv* pcRecoYuv, |
---|
| 934 | TComYuv* pcPredYuv, |
---|
| 935 | TComYuv* pcResiYuv ) |
---|
| 936 | { |
---|
| 937 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
---|
| 938 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
---|
| 939 | if( uiTrMode == uiTrDepth ) |
---|
| 940 | { |
---|
| 941 | xIntraRecLumaBlk ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 942 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 ); |
---|
| 943 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 ); |
---|
| 944 | } |
---|
| 945 | else |
---|
| 946 | { |
---|
| 947 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
---|
| 948 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
---|
| 949 | { |
---|
| 950 | xIntraRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 951 | } |
---|
| 952 | } |
---|
| 953 | } |
---|
| 954 | |
---|
| 955 | Void |
---|
| 956 | TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 957 | { |
---|
| 958 | UInt uiInitTrDepth = ( pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1 ); |
---|
| 959 | UInt uiNumPart = pcCU->getNumPartInter(); |
---|
| 960 | UInt uiNumQParts = pcCU->getTotalNumPart() >> 2; |
---|
| 961 | |
---|
[56] | 962 | if (pcCU->getIPCMFlag(0)) |
---|
| 963 | { |
---|
| 964 | xReconPCM( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 965 | return; |
---|
| 966 | } |
---|
| 967 | |
---|
[2] | 968 | for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ ) |
---|
| 969 | { |
---|
| 970 | xIntraLumaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] ); |
---|
| 971 | } |
---|
| 972 | |
---|
| 973 | for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ ) |
---|
| 974 | { |
---|
| 975 | xIntraChromaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] ); |
---|
| 976 | } |
---|
| 977 | |
---|
| 978 | } |
---|
| 979 | |
---|
[189] | 980 | #if RWTH_SDC_DLT_B0036 |
---|
| 981 | Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 982 | { |
---|
| 983 | UInt uiWidth = pcCU->getWidth ( 0 ); |
---|
| 984 | UInt uiHeight = pcCU->getHeight ( 0 ); |
---|
| 985 | |
---|
| 986 | TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth]; |
---|
| 987 | TComYuv* pcPredYuv = m_ppcYuvReco[uiDepth]; |
---|
| 988 | TComYuv* pcResiYuv = m_ppcYuvResi[uiDepth]; |
---|
| 989 | |
---|
| 990 | UInt uiStride = pcRecoYuv->getStride (); |
---|
| 991 | Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 992 | Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 993 | Pel* piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 994 | |
---|
| 995 | UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
| 996 | Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); |
---|
| 997 | UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); |
---|
| 998 | |
---|
| 999 | UInt uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); |
---|
| 1000 | |
---|
| 1001 | AOF( uiWidth == uiHeight ); |
---|
| 1002 | AOF( uiAbsPartIdx == 0 ); |
---|
| 1003 | AOF( pcCU->getSDCAvailable(uiAbsPartIdx) ); |
---|
| 1004 | AOF( pcCU->getSDCFlag(uiAbsPartIdx) ); |
---|
| 1005 | |
---|
| 1006 | //===== init availability pattern ===== |
---|
| 1007 | Bool bAboveAvail = false; |
---|
| 1008 | Bool bLeftAvail = false; |
---|
| 1009 | pcCU->getPattern()->initPattern ( pcCU, 0, uiAbsPartIdx ); |
---|
| 1010 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail ); |
---|
| 1011 | |
---|
| 1012 | //===== get prediction signal ===== |
---|
| 1013 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 1014 | if( uiLumaPredMode >= NUM_INTRA_MODE ) |
---|
| 1015 | { |
---|
| 1016 | m_pcPrediction->predIntraLumaDMM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, false ); |
---|
| 1017 | } |
---|
| 1018 | else |
---|
| 1019 | { |
---|
| 1020 | #endif |
---|
| 1021 | m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
| 1022 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 1023 | } |
---|
| 1024 | #endif |
---|
| 1025 | |
---|
| 1026 | // number of segments depends on prediction mode |
---|
| 1027 | UInt uiNumSegments = 1; |
---|
| 1028 | Bool* pbMask = NULL; |
---|
| 1029 | UInt uiMaskStride = 0; |
---|
| 1030 | |
---|
| 1031 | if( uiLumaPredMode == DMM_WEDGE_FULL_IDX || uiLumaPredMode == DMM_WEDGE_PREDDIR_IDX ) |
---|
| 1032 | { |
---|
| 1033 | Int uiTabIdx = (uiLumaPredMode == DMM_WEDGE_FULL_IDX)?pcCU->getWedgeFullTabIdx(uiAbsPartIdx):pcCU->getWedgePredDirTabIdx(uiAbsPartIdx); |
---|
| 1034 | |
---|
| 1035 | WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])]; |
---|
| 1036 | TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx )); |
---|
| 1037 | |
---|
| 1038 | uiNumSegments = 2; |
---|
| 1039 | pbMask = pcWedgelet->getPattern(); |
---|
| 1040 | uiMaskStride = pcWedgelet->getStride(); |
---|
| 1041 | } |
---|
| 1042 | |
---|
| 1043 | // get DC prediction for each segment |
---|
| 1044 | Pel apDCPredValues[2]; |
---|
| 1045 | xAnalyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride); |
---|
| 1046 | |
---|
| 1047 | // reconstruct residual based on mask + DC residuals |
---|
| 1048 | Pel apDCResiValues[2]; |
---|
| 1049 | Pel apDCRecoValues[2]; |
---|
| 1050 | for( UInt ui = 0; ui < uiNumSegments; ui++ ) |
---|
| 1051 | { |
---|
| 1052 | Pel pPredIdx = GetDepthValue2Idx( apDCPredValues[ui] ); |
---|
| 1053 | Pel pResiIdx = pcCU->getSDCSegmentDCOffset(ui, uiAbsPartIdx); |
---|
| 1054 | Pel pRecoValue = GetIdx2DepthValue( pPredIdx + pResiIdx ); |
---|
| 1055 | |
---|
| 1056 | apDCRecoValues[ui] = pRecoValue; |
---|
| 1057 | apDCResiValues[ui] = pRecoValue - apDCPredValues[ui]; |
---|
| 1058 | } |
---|
| 1059 | |
---|
| 1060 | //===== reconstruction ===== |
---|
| 1061 | Bool*pMask = pbMask; |
---|
| 1062 | Pel* pPred = piPred; |
---|
| 1063 | Pel* pResi = piResi; |
---|
| 1064 | Pel* pReco = piReco; |
---|
| 1065 | Pel* pRecIPred = piRecIPred; |
---|
| 1066 | |
---|
| 1067 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
| 1068 | { |
---|
| 1069 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
| 1070 | { |
---|
| 1071 | UChar ucSegment = pMask?(UChar)pMask[uiX]:0; |
---|
| 1072 | assert( ucSegment < uiNumSegments ); |
---|
| 1073 | |
---|
| 1074 | Pel pPredVal= apDCPredValues[ucSegment]; |
---|
| 1075 | Pel pResiDC = apDCResiValues[ucSegment]; |
---|
| 1076 | |
---|
| 1077 | pReco [ uiX ] = Clip( pPredVal + pResiDC ); |
---|
| 1078 | pRecIPred[ uiX ] = pReco[ uiX ]; |
---|
| 1079 | } |
---|
| 1080 | pPred += uiStride; |
---|
| 1081 | pResi += uiStride; |
---|
| 1082 | pReco += uiStride; |
---|
| 1083 | pRecIPred += uiRecIPredStride; |
---|
| 1084 | pMask += uiMaskStride; |
---|
| 1085 | } |
---|
| 1086 | |
---|
| 1087 | // clear UV |
---|
| 1088 | UInt uiStrideC = pcPredYuv->getCStride(); |
---|
| 1089 | Pel *pRecCb = pcPredYuv->getCbAddr(); |
---|
| 1090 | Pel *pRecCr = pcPredYuv->getCrAddr(); |
---|
| 1091 | |
---|
| 1092 | for (Int y=0; y<uiHeight/2; y++) |
---|
| 1093 | { |
---|
| 1094 | for (Int x=0; x<uiWidth/2; x++) |
---|
| 1095 | { |
---|
| 1096 | pRecCb[x] = (Pel)(128<<g_uiBitIncrement); |
---|
| 1097 | pRecCr[x] = (Pel)(128<<g_uiBitIncrement); |
---|
| 1098 | } |
---|
| 1099 | |
---|
| 1100 | pRecCb += uiStrideC; |
---|
| 1101 | pRecCr += uiStrideC; |
---|
| 1102 | } |
---|
| 1103 | } |
---|
| 1104 | #endif |
---|
| 1105 | |
---|
[56] | 1106 | /** Function for deriving recontructed PU/CU Luma sample with QTree structure |
---|
[2] | 1107 | * \param pcCU pointer of current CU |
---|
| 1108 | * \param uiTrDepth current tranform split depth |
---|
| 1109 | * \param uiAbsPartIdx part index |
---|
| 1110 | * \param pcRecoYuv pointer to reconstructed sample arrays |
---|
| 1111 | * \param pcPredYuv pointer to prediction sample arrays |
---|
| 1112 | * \param pcResiYuv pointer to residue sample arrays |
---|
| 1113 | * |
---|
| 1114 | \ This function dervies recontructed PU/CU Luma sample with recursive QTree structure |
---|
| 1115 | */ |
---|
| 1116 | Void |
---|
| 1117 | TDecCu::xIntraLumaRecQT( TComDataCU* pcCU, |
---|
| 1118 | UInt uiTrDepth, |
---|
| 1119 | UInt uiAbsPartIdx, |
---|
| 1120 | TComYuv* pcRecoYuv, |
---|
| 1121 | TComYuv* pcPredYuv, |
---|
| 1122 | TComYuv* pcResiYuv ) |
---|
| 1123 | { |
---|
| 1124 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
---|
| 1125 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
---|
| 1126 | if( uiTrMode == uiTrDepth ) |
---|
| 1127 | { |
---|
| 1128 | xIntraRecLumaBlk ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 1129 | } |
---|
| 1130 | else |
---|
| 1131 | { |
---|
| 1132 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
---|
| 1133 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
---|
| 1134 | { |
---|
| 1135 | xIntraLumaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 1136 | } |
---|
| 1137 | } |
---|
| 1138 | } |
---|
| 1139 | |
---|
[56] | 1140 | /** Function for deriving recontructed PU/CU chroma samples with QTree structure |
---|
[2] | 1141 | * \param pcCU pointer of current CU |
---|
| 1142 | * \param uiTrDepth current tranform split depth |
---|
| 1143 | * \param uiAbsPartIdx part index |
---|
| 1144 | * \param pcRecoYuv pointer to reconstructed sample arrays |
---|
| 1145 | * \param pcPredYuv pointer to prediction sample arrays |
---|
| 1146 | * \param pcResiYuv pointer to residue sample arrays |
---|
| 1147 | * |
---|
| 1148 | \ This function dervies recontructed PU/CU chroma samples with QTree recursive structure |
---|
| 1149 | */ |
---|
| 1150 | Void |
---|
| 1151 | TDecCu::xIntraChromaRecQT( TComDataCU* pcCU, |
---|
| 1152 | UInt uiTrDepth, |
---|
| 1153 | UInt uiAbsPartIdx, |
---|
| 1154 | TComYuv* pcRecoYuv, |
---|
| 1155 | TComYuv* pcPredYuv, |
---|
| 1156 | TComYuv* pcResiYuv ) |
---|
| 1157 | { |
---|
| 1158 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
---|
| 1159 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
---|
| 1160 | if( uiTrMode == uiTrDepth ) |
---|
| 1161 | { |
---|
| 1162 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 ); |
---|
| 1163 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 ); |
---|
| 1164 | } |
---|
| 1165 | else |
---|
| 1166 | { |
---|
| 1167 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
---|
| 1168 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
---|
| 1169 | { |
---|
| 1170 | xIntraChromaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 1171 | } |
---|
| 1172 | } |
---|
| 1173 | } |
---|
| 1174 | |
---|
| 1175 | Void TDecCu::xCopyToPic( TComDataCU* pcCU, TComPic* pcPic, UInt uiZorderIdx, UInt uiDepth ) |
---|
| 1176 | { |
---|
| 1177 | UInt uiCUAddr = pcCU->getAddr(); |
---|
| 1178 | |
---|
| 1179 | m_ppcYuvReco[uiDepth]->copyToPicYuv ( pcPic->getPicYuvRec (), uiCUAddr, uiZorderIdx ); |
---|
| 1180 | |
---|
| 1181 | return; |
---|
| 1182 | } |
---|
| 1183 | |
---|
| 1184 | Void TDecCu::xDecodeInterTexture ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 1185 | { |
---|
| 1186 | UInt uiWidth = pcCU->getWidth ( uiAbsPartIdx ); |
---|
| 1187 | UInt uiHeight = pcCU->getHeight( uiAbsPartIdx ); |
---|
| 1188 | TCoeff* piCoeff; |
---|
| 1189 | |
---|
| 1190 | Pel* pResi; |
---|
| 1191 | UInt uiLumaTrMode, uiChromaTrMode; |
---|
| 1192 | |
---|
| 1193 | pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx( uiAbsPartIdx ), uiLumaTrMode, uiChromaTrMode ); |
---|
| 1194 | |
---|
| 1195 | // Y |
---|
| 1196 | piCoeff = pcCU->getCoeffY(); |
---|
| 1197 | pResi = m_ppcYuvResi[uiDepth]->getLumaAddr(); |
---|
[56] | 1198 | |
---|
| 1199 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 1200 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); |
---|
| 1201 | #else |
---|
| 1202 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 ); |
---|
| 1203 | #endif |
---|
| 1204 | |
---|
[2] | 1205 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff ); |
---|
| 1206 | |
---|
| 1207 | // Cb and Cr |
---|
[56] | 1208 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 1209 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() ); |
---|
| 1210 | #else |
---|
| 1211 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset() ); |
---|
| 1212 | #endif |
---|
| 1213 | |
---|
[2] | 1214 | uiWidth >>= 1; |
---|
| 1215 | uiHeight >>= 1; |
---|
| 1216 | piCoeff = pcCU->getCoeffCb(); pResi = m_ppcYuvResi[uiDepth]->getCbAddr(); |
---|
| 1217 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); |
---|
[56] | 1218 | |
---|
| 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()->getChromaQpOffset2nd() ); |
---|
| 1221 | #else |
---|
| 1222 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); |
---|
| 1223 | #endif |
---|
| 1224 | |
---|
[2] | 1225 | piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr(); |
---|
| 1226 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); |
---|
| 1227 | } |
---|
| 1228 | |
---|
[56] | 1229 | /** Function for deriving reconstructed luma/chroma samples of a PCM mode CU. |
---|
| 1230 | * \param pcCU pointer to current CU |
---|
| 1231 | * \param uiPartIdx part index |
---|
| 1232 | * \param piPCM pointer to PCM code arrays |
---|
| 1233 | * \param piReco pointer to reconstructed sample arrays |
---|
| 1234 | * \param uiStride stride of reconstructed sample arrays |
---|
| 1235 | * \param uiWidth CU width |
---|
| 1236 | * \param uiHeight CU height |
---|
| 1237 | * \param ttText texture component type |
---|
| 1238 | * \returns Void |
---|
| 1239 | */ |
---|
| 1240 | Void TDecCu::xDecodePCMTexture( TComDataCU* pcCU, UInt uiPartIdx, Pel *piPCM, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType ttText) |
---|
| 1241 | { |
---|
| 1242 | UInt uiX, uiY; |
---|
| 1243 | Pel* piPicReco; |
---|
| 1244 | UInt uiPicStride; |
---|
| 1245 | UInt uiPcmLeftShiftBit; |
---|
| 1246 | |
---|
| 1247 | if( ttText == TEXT_LUMA ) |
---|
| 1248 | { |
---|
| 1249 | uiPicStride = pcCU->getPic()->getPicYuvRec()->getStride(); |
---|
| 1250 | piPicReco = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); |
---|
| 1251 | uiPcmLeftShiftBit = g_uiBitDepth + g_uiBitIncrement - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma(); |
---|
| 1252 | } |
---|
| 1253 | else |
---|
| 1254 | { |
---|
| 1255 | uiPicStride = pcCU->getPic()->getPicYuvRec()->getCStride(); |
---|
| 1256 | |
---|
| 1257 | if( ttText == TEXT_CHROMA_U ) |
---|
| 1258 | { |
---|
| 1259 | piPicReco = pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); |
---|
| 1260 | } |
---|
| 1261 | else |
---|
| 1262 | { |
---|
| 1263 | piPicReco = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); |
---|
| 1264 | } |
---|
| 1265 | uiPcmLeftShiftBit = g_uiBitDepth + g_uiBitIncrement - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); |
---|
| 1266 | } |
---|
| 1267 | |
---|
| 1268 | for( uiY = 0; uiY < uiHeight; uiY++ ) |
---|
| 1269 | { |
---|
| 1270 | for( uiX = 0; uiX < uiWidth; uiX++ ) |
---|
| 1271 | { |
---|
| 1272 | piReco[uiX] = (piPCM[uiX] << uiPcmLeftShiftBit); |
---|
| 1273 | piPicReco[uiX] = piReco[uiX]; |
---|
| 1274 | } |
---|
| 1275 | piPCM += uiWidth; |
---|
| 1276 | piReco += uiStride; |
---|
| 1277 | piPicReco += uiPicStride; |
---|
| 1278 | } |
---|
| 1279 | } |
---|
| 1280 | |
---|
| 1281 | /** Function for reconstructing a PCM mode CU. |
---|
| 1282 | * \param pcCU pointer to current CU |
---|
| 1283 | * \param uiAbsPartIdx CU index |
---|
| 1284 | * \param uiDepth CU Depth |
---|
| 1285 | * \returns Void |
---|
| 1286 | */ |
---|
| 1287 | Void TDecCu::xReconPCM( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 1288 | { |
---|
| 1289 | // Luma |
---|
| 1290 | UInt uiWidth = (g_uiMaxCUWidth >> uiDepth); |
---|
| 1291 | UInt uiHeight = (g_uiMaxCUHeight >> uiDepth); |
---|
| 1292 | |
---|
| 1293 | Pel* piPcmY = pcCU->getPCMSampleY(); |
---|
| 1294 | Pel* piRecoY = m_ppcYuvReco[uiDepth]->getLumaAddr(0, uiWidth); |
---|
| 1295 | |
---|
| 1296 | UInt uiStride = m_ppcYuvResi[uiDepth]->getStride(); |
---|
| 1297 | |
---|
| 1298 | xDecodePCMTexture( pcCU, 0, piPcmY, piRecoY, uiStride, uiWidth, uiHeight, TEXT_LUMA); |
---|
| 1299 | |
---|
| 1300 | // Cb and Cr |
---|
| 1301 | UInt uiCWidth = (uiWidth>>1); |
---|
| 1302 | UInt uiCHeight = (uiHeight>>1); |
---|
| 1303 | |
---|
| 1304 | Pel* piPcmCb = pcCU->getPCMSampleCb(); |
---|
| 1305 | Pel* piPcmCr = pcCU->getPCMSampleCr(); |
---|
| 1306 | Pel* pRecoCb = m_ppcYuvReco[uiDepth]->getCbAddr(); |
---|
| 1307 | Pel* pRecoCr = m_ppcYuvReco[uiDepth]->getCrAddr(); |
---|
| 1308 | |
---|
| 1309 | UInt uiCStride = m_ppcYuvReco[uiDepth]->getCStride(); |
---|
| 1310 | |
---|
| 1311 | xDecodePCMTexture( pcCU, 0, piPcmCb, pRecoCb, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_U); |
---|
| 1312 | xDecodePCMTexture( pcCU, 0, piPcmCr, pRecoCr, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_V); |
---|
| 1313 | } |
---|
| 1314 | |
---|
| 1315 | #if LOSSLESS_CODING |
---|
| 1316 | /** Function for filling the PCM buffer of a CU using its reconstructed sample array |
---|
| 1317 | * \param pcCU pointer to current CU |
---|
| 1318 | * \param uiAbsPartIdx CU index |
---|
| 1319 | * \param uiDepth CU Depth |
---|
| 1320 | * \returns Void |
---|
| 1321 | */ |
---|
| 1322 | Void TDecCu::xFillPCMBuffer(TComDataCU* pCU, UInt absPartIdx, UInt depth) |
---|
| 1323 | { |
---|
| 1324 | // Luma |
---|
| 1325 | UInt width = (g_uiMaxCUWidth >> depth); |
---|
| 1326 | UInt height = (g_uiMaxCUHeight >> depth); |
---|
| 1327 | |
---|
| 1328 | Pel* pPcmY = pCU->getPCMSampleY(); |
---|
| 1329 | Pel* pRecoY = m_ppcYuvReco[depth]->getLumaAddr(0, width); |
---|
| 1330 | |
---|
| 1331 | UInt stride = m_ppcYuvReco[depth]->getStride(); |
---|
| 1332 | |
---|
| 1333 | for(Int y = 0; y < height; y++ ) |
---|
| 1334 | { |
---|
| 1335 | for(Int x = 0; x < width; x++ ) |
---|
| 1336 | { |
---|
| 1337 | pPcmY[x] = pRecoY[x]; |
---|
| 1338 | } |
---|
| 1339 | pPcmY += width; |
---|
| 1340 | pRecoY += stride; |
---|
| 1341 | } |
---|
| 1342 | |
---|
| 1343 | // Cb and Cr |
---|
| 1344 | UInt widthC = (width>>1); |
---|
| 1345 | UInt heightC = (height>>1); |
---|
| 1346 | |
---|
| 1347 | Pel* pPcmCb = pCU->getPCMSampleCb(); |
---|
| 1348 | Pel* pPcmCr = pCU->getPCMSampleCr(); |
---|
| 1349 | Pel* pRecoCb = m_ppcYuvReco[depth]->getCbAddr(); |
---|
| 1350 | Pel* pRecoCr = m_ppcYuvReco[depth]->getCrAddr(); |
---|
| 1351 | |
---|
| 1352 | UInt strideC = m_ppcYuvReco[depth]->getCStride(); |
---|
| 1353 | |
---|
| 1354 | for(Int y = 0; y < heightC; y++ ) |
---|
| 1355 | { |
---|
| 1356 | for(Int x = 0; x < widthC; x++ ) |
---|
| 1357 | { |
---|
| 1358 | pPcmCb[x] = pRecoCb[x]; |
---|
| 1359 | pPcmCr[x] = pRecoCr[x]; |
---|
| 1360 | } |
---|
| 1361 | pPcmCr += widthC; |
---|
| 1362 | pPcmCb += widthC; |
---|
| 1363 | pRecoCb += strideC; |
---|
| 1364 | pRecoCr += strideC; |
---|
| 1365 | } |
---|
| 1366 | |
---|
| 1367 | } |
---|
| 1368 | #endif |
---|
| 1369 | |
---|
[189] | 1370 | #if RWTH_SDC_DLT_B0036 |
---|
| 1371 | Void TDecCu::xAnalyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride ) |
---|
| 1372 | { |
---|
| 1373 | Int iSumDepth[2]; |
---|
| 1374 | memset(iSumDepth, 0, sizeof(Int)*2); |
---|
| 1375 | Int iSumPix[2]; |
---|
| 1376 | memset(iSumPix, 0, sizeof(Int)*2); |
---|
| 1377 | |
---|
| 1378 | for (Int y=0; y<uiSize; y++) |
---|
| 1379 | { |
---|
| 1380 | for (Int x=0; x<uiSize; x++) |
---|
| 1381 | { |
---|
| 1382 | UChar ucSegment = pMask?(UChar)pMask[x]:0; |
---|
| 1383 | assert( ucSegment < uiNumSegments ); |
---|
| 1384 | |
---|
| 1385 | iSumDepth[ucSegment] += pOrig[x]; |
---|
| 1386 | iSumPix[ucSegment] += 1; |
---|
| 1387 | } |
---|
| 1388 | |
---|
| 1389 | pOrig += uiStride; |
---|
| 1390 | pMask += uiMaskStride; |
---|
| 1391 | } |
---|
| 1392 | |
---|
| 1393 | // compute mean for each segment |
---|
| 1394 | for( UChar ucSeg = 0; ucSeg < uiNumSegments; ucSeg++ ) |
---|
| 1395 | { |
---|
| 1396 | if( iSumPix[ucSeg] > 0 ) |
---|
| 1397 | rpSegMeans[ucSeg] = iSumDepth[ucSeg] / iSumPix[ucSeg]; |
---|
| 1398 | else |
---|
| 1399 | rpSegMeans[ucSeg] = 0; // this happens for zero-segments |
---|
| 1400 | } |
---|
| 1401 | } |
---|
| 1402 | #endif |
---|
| 1403 | |
---|
[56] | 1404 | //! \} |
---|