[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 |
---|
| 4 | * granted under this license. |
---|
| 5 | * |
---|
| 6 | * Copyright (c) 2010-2011, ISO/IEC |
---|
| 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
| 17 | * * Neither the name of the ISO/IEC nor the names of its contributors may |
---|
| 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
[2] | 33 | |
---|
| 34 | |
---|
[5] | 35 | |
---|
[2] | 36 | /** \file TDecCu.cpp |
---|
| 37 | \brief CU decoder class |
---|
| 38 | */ |
---|
| 39 | |
---|
| 40 | #include "TDecCu.h" |
---|
| 41 | |
---|
| 42 | // ==================================================================================================================== |
---|
| 43 | // Constructor / destructor / create / destroy |
---|
| 44 | // ==================================================================================================================== |
---|
| 45 | |
---|
| 46 | TDecCu::TDecCu() |
---|
| 47 | { |
---|
| 48 | m_ppcYuvResi = NULL; |
---|
| 49 | m_ppcYuvReco = NULL; |
---|
| 50 | m_ppcYuvResPred = NULL; |
---|
[12] | 51 | #if POZNAN_CU_SKIP |
---|
[11] | 52 | m_ppcYuvAvail = NULL; |
---|
| 53 | #endif |
---|
[12] | 54 | #if POZNAN_CU_SYNTH |
---|
[11] | 55 | m_ppcYuvSynth = NULL; |
---|
| 56 | #endif |
---|
[2] | 57 | m_ppcCU = NULL; |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | TDecCu::~TDecCu() |
---|
| 61 | { |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | Void TDecCu::init( TDecEntropy* pcEntropyDecoder, TComTrQuant* pcTrQuant, TComPrediction* pcPrediction) |
---|
| 65 | { |
---|
| 66 | m_pcEntropyDecoder = pcEntropyDecoder; |
---|
| 67 | m_pcTrQuant = pcTrQuant; |
---|
| 68 | m_pcPrediction = pcPrediction; |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | /** |
---|
| 72 | \param uiMaxDepth total number of allowable depth |
---|
| 73 | \param uiMaxWidth largest CU width |
---|
| 74 | \param uiMaxHeight largest CU height |
---|
| 75 | */ |
---|
| 76 | Void TDecCu::create( UInt uiMaxDepth, UInt uiMaxWidth, UInt uiMaxHeight ) |
---|
| 77 | { |
---|
| 78 | m_uiMaxDepth = uiMaxDepth+1; |
---|
| 79 | |
---|
| 80 | m_ppcYuvResi = new TComYuv* [m_uiMaxDepth-1]; |
---|
| 81 | m_ppcYuvReco = new TComYuv* [m_uiMaxDepth-1]; |
---|
| 82 | m_ppcYuvResPred = new TComYuv* [m_uiMaxDepth-1]; |
---|
[12] | 83 | #if POZNAN_CU_SKIP |
---|
[11] | 84 | m_ppcYuvAvail = new TComYuv* [m_uiMaxDepth-1]; |
---|
| 85 | #endif |
---|
[12] | 86 | #if POZNAN_CU_SYNTH |
---|
[11] | 87 | m_ppcYuvSynth = new TComYuv* [m_uiMaxDepth-1]; |
---|
| 88 | #endif |
---|
[2] | 89 | m_ppcCU = new TComDataCU* [m_uiMaxDepth-1]; |
---|
| 90 | |
---|
| 91 | UInt uiNumPartitions; |
---|
| 92 | for ( UInt ui = 0; ui < m_uiMaxDepth-1; ui++ ) |
---|
| 93 | { |
---|
| 94 | uiNumPartitions = 1<<( ( m_uiMaxDepth - ui - 1 )<<1 ); |
---|
| 95 | UInt uiWidth = uiMaxWidth >> ui; |
---|
| 96 | UInt uiHeight = uiMaxHeight >> ui; |
---|
| 97 | |
---|
| 98 | m_ppcYuvResi [ui] = new TComYuv; m_ppcYuvResi [ui]->create( uiWidth, uiHeight ); |
---|
| 99 | m_ppcYuvReco [ui] = new TComYuv; m_ppcYuvReco [ui]->create( uiWidth, uiHeight ); |
---|
| 100 | m_ppcYuvResPred[ui] = new TComYuv; m_ppcYuvResPred[ui]->create( uiWidth, uiHeight ); |
---|
[12] | 101 | #if POZNAN_CU_SKIP |
---|
[11] | 102 | m_ppcYuvAvail [ui] = new TComYuv; m_ppcYuvAvail [ui]->create( uiWidth, uiHeight ); |
---|
| 103 | #endif |
---|
[12] | 104 | #if POZNAN_CU_SYNTH |
---|
[11] | 105 | m_ppcYuvSynth [ui] = new TComYuv; m_ppcYuvSynth [ui]->create( uiWidth, uiHeight ); |
---|
| 106 | #endif |
---|
| 107 | |
---|
[2] | 108 | m_ppcCU [ui] = new TComDataCU; m_ppcCU [ui]->create( uiNumPartitions, uiWidth, uiHeight, true ); |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | // initialize partition order. |
---|
| 112 | UInt* piTmp = &g_auiZscanToRaster[0]; |
---|
| 113 | initZscanToRaster(m_uiMaxDepth, 1, 0, piTmp); |
---|
| 114 | initRasterToZscan( uiMaxWidth, uiMaxHeight, m_uiMaxDepth ); |
---|
| 115 | |
---|
| 116 | // initialize conversion matrix from partition index to pel |
---|
| 117 | initRasterToPelXY( uiMaxWidth, uiMaxHeight, m_uiMaxDepth ); |
---|
| 118 | } |
---|
| 119 | |
---|
| 120 | Void TDecCu::destroy() |
---|
| 121 | { |
---|
| 122 | for ( UInt ui = 0; ui < m_uiMaxDepth-1; ui++ ) |
---|
| 123 | { |
---|
| 124 | m_ppcYuvResi [ui]->destroy(); delete m_ppcYuvResi [ui]; m_ppcYuvResi [ui] = NULL; |
---|
| 125 | m_ppcYuvReco [ui]->destroy(); delete m_ppcYuvReco [ui]; m_ppcYuvReco [ui] = NULL; |
---|
| 126 | m_ppcYuvResPred[ui]->destroy(); delete m_ppcYuvResPred[ui]; m_ppcYuvResPred[ui] = NULL; |
---|
[12] | 127 | #if POZNAN_CU_SKIP |
---|
[11] | 128 | m_ppcYuvAvail [ui]->destroy(); delete m_ppcYuvAvail [ui]; m_ppcYuvAvail [ui] = NULL; |
---|
| 129 | #endif |
---|
[12] | 130 | #if POZNAN_CU_SYNTH |
---|
[11] | 131 | m_ppcYuvSynth [ui]->destroy(); delete m_ppcYuvSynth [ui]; m_ppcYuvSynth [ui] = NULL; |
---|
| 132 | #endif |
---|
[2] | 133 | m_ppcCU [ui]->destroy(); delete m_ppcCU [ui]; m_ppcCU [ui] = NULL; |
---|
| 134 | } |
---|
| 135 | |
---|
| 136 | delete [] m_ppcYuvResi; m_ppcYuvResi = NULL; |
---|
| 137 | delete [] m_ppcYuvReco; m_ppcYuvReco = NULL; |
---|
| 138 | delete [] m_ppcYuvResPred; m_ppcYuvResPred = NULL; |
---|
[12] | 139 | #if POZNAN_CU_SKIP |
---|
[11] | 140 | delete [] m_ppcYuvAvail; m_ppcYuvAvail = NULL; |
---|
| 141 | #endif |
---|
[12] | 142 | #if POZNAN_CU_SYNTH |
---|
[11] | 143 | delete [] m_ppcYuvSynth; m_ppcYuvSynth = NULL; |
---|
| 144 | #endif |
---|
| 145 | |
---|
[2] | 146 | delete [] m_ppcCU; m_ppcCU = NULL; |
---|
| 147 | } |
---|
| 148 | |
---|
| 149 | // ==================================================================================================================== |
---|
| 150 | // Public member functions |
---|
| 151 | // ==================================================================================================================== |
---|
| 152 | |
---|
| 153 | /** \param pcCU pointer of CU data |
---|
| 154 | \param ruiIsLast last data? |
---|
| 155 | */ |
---|
| 156 | Void TDecCu::decodeCU( TComDataCU* pcCU, UInt& ruiIsLast ) |
---|
| 157 | { |
---|
| 158 | #if SNY_DQP |
---|
| 159 | if ( pcCU->getSlice()->getSPS()->getUseDQP() ) |
---|
| 160 | { |
---|
| 161 | pcCU->setdQPFlag(true); |
---|
| 162 | } |
---|
| 163 | #endif//SNY_DQP |
---|
| 164 | // start from the top level CU |
---|
| 165 | xDecodeCU( pcCU, 0, 0 ); |
---|
| 166 | |
---|
| 167 | #if SNY_DQP |
---|
| 168 | // dQP: only for LCU |
---|
| 169 | if ( pcCU->getSlice()->getSPS()->getUseDQP() ) |
---|
| 170 | { |
---|
| 171 | if ( pcCU->isSkipped( 0 ) && pcCU->getDepth( 0 ) == 0 ) |
---|
| 172 | { |
---|
| 173 | } |
---|
| 174 | else if ( pcCU->getdQPFlag())// non-skip |
---|
| 175 | { |
---|
| 176 | m_pcEntropyDecoder->decodeQP( pcCU, 0, 0 ); |
---|
| 177 | pcCU->setdQPFlag(false); |
---|
| 178 | } |
---|
| 179 | } |
---|
| 180 | #else |
---|
| 181 | // dQP: only for LCU |
---|
| 182 | if ( pcCU->getSlice()->getSPS()->getUseDQP() ) |
---|
| 183 | { |
---|
| 184 | if ( pcCU->isSkipped( 0 ) && pcCU->getDepth( 0 ) == 0 ) |
---|
| 185 | { |
---|
| 186 | } |
---|
| 187 | else |
---|
| 188 | { |
---|
| 189 | m_pcEntropyDecoder->decodeQP( pcCU, 0, 0 ); |
---|
| 190 | } |
---|
| 191 | } |
---|
| 192 | #endif//SNY_DQP |
---|
| 193 | |
---|
| 194 | //--- Read terminating bit --- |
---|
| 195 | m_pcEntropyDecoder->decodeTerminatingBit( ruiIsLast ); |
---|
| 196 | } |
---|
| 197 | |
---|
| 198 | /** \param pcCU pointer of CU data |
---|
| 199 | */ |
---|
| 200 | Void TDecCu::decompressCU( TComDataCU* pcCU ) |
---|
| 201 | { |
---|
| 202 | xDecompressCU( pcCU, pcCU, 0, 0 ); |
---|
| 203 | } |
---|
| 204 | |
---|
| 205 | // ==================================================================================================================== |
---|
| 206 | // Protected member functions |
---|
| 207 | // ==================================================================================================================== |
---|
| 208 | |
---|
| 209 | /** decode CU block recursively |
---|
| 210 | * \param pcCU |
---|
| 211 | * \param uiAbsPartIdx |
---|
| 212 | * \param uiDepth |
---|
| 213 | * \returns Void |
---|
| 214 | */ |
---|
| 215 | Void TDecCu::xDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 216 | { |
---|
| 217 | TComPic* pcPic = pcCU->getPic(); |
---|
[11] | 218 | |
---|
[12] | 219 | #if POZNAN_CU_SKIP |
---|
[11] | 220 | Bool bWholeCUCanBeSynthesized = false; |
---|
| 221 | Bool bOneSubCUCanNotBeSynthesied = false; |
---|
| 222 | Bool bSubCUCanBeSynthesized[4]; |
---|
| 223 | Bool * pbSubCUCanBeSynthesized = bSubCUCanBeSynthesized; |
---|
| 224 | pcPic->checkSynthesisAvailability(pcCU, pcCU->getAddr(), uiAbsPartIdx, uiDepth, pbSubCUCanBeSynthesized); //KUBA SYNTH |
---|
| 225 | Int iSubCUCanNotBeSynthesized = 0; |
---|
| 226 | Int iSubCUCanBeSynthesizedCnt = 0; |
---|
| 227 | for(Int i = 0; i < 4; i++) |
---|
| 228 | { |
---|
| 229 | if (!bSubCUCanBeSynthesized[i]) |
---|
| 230 | { |
---|
| 231 | iSubCUCanNotBeSynthesized = i; |
---|
| 232 | } |
---|
| 233 | else |
---|
| 234 | { |
---|
| 235 | iSubCUCanBeSynthesizedCnt ++; |
---|
| 236 | } |
---|
| 237 | } |
---|
| 238 | if(iSubCUCanBeSynthesizedCnt == 4) |
---|
| 239 | { |
---|
| 240 | bWholeCUCanBeSynthesized = true; |
---|
| 241 | } |
---|
| 242 | else if(iSubCUCanBeSynthesizedCnt == 3) |
---|
| 243 | { |
---|
| 244 | bOneSubCUCanNotBeSynthesied = true; |
---|
| 245 | } |
---|
| 246 | |
---|
| 247 | if(bWholeCUCanBeSynthesized) |
---|
| 248 | { |
---|
| 249 | pcCU->setPredModeSubParts( MODE_SYNTH, uiAbsPartIdx, uiDepth ); |
---|
| 250 | pcCU->setDepthSubParts( uiDepth, uiAbsPartIdx ); |
---|
| 251 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
| 252 | pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
| 253 | //pcCU->setSizeSubParts( pcCU->getSlice()->getSPS()->getMaxCUWidth()>>uiDepth, pcCU->getSlice()->getSPS()->getMaxCUHeight()>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
| 254 | return; |
---|
| 255 | } |
---|
| 256 | #endif |
---|
| 257 | |
---|
[2] | 258 | UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1); |
---|
| 259 | UInt uiQNumParts = uiCurNumParts>>2; |
---|
| 260 | |
---|
| 261 | Bool bBoundary = false; |
---|
| 262 | UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
| 263 | UInt uiRPelX = uiLPelX + (g_uiMaxCUWidth>>uiDepth) - 1; |
---|
| 264 | UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
| 265 | UInt uiBPelY = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1; |
---|
| 266 | |
---|
| 267 | if( ( uiRPelX < pcCU->getSlice()->getSPS()->getWidth() ) && ( uiBPelY < pcCU->getSlice()->getSPS()->getHeight() ) ) |
---|
| 268 | { |
---|
[12] | 269 | #if POZNAN_CU_SKIP |
---|
[11] | 270 | if(bOneSubCUCanNotBeSynthesied && (uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth )) // KUBA SYNTH check if CU has 3 synthesied subCU - no split flag is send in that case and CU split is assumed |
---|
| 271 | { |
---|
| 272 | pcCU->setDepthSubParts( uiDepth + 1, uiAbsPartIdx ); |
---|
| 273 | } |
---|
| 274 | else |
---|
| 275 | #endif |
---|
[5] | 276 | #if HHI_MPI |
---|
[2] | 277 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth < pcCU->getTextureModeDepth( uiAbsPartIdx ) ) |
---|
[5] | 278 | #endif |
---|
[2] | 279 | m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 280 | } |
---|
| 281 | else |
---|
| 282 | { |
---|
| 283 | bBoundary = true; |
---|
| 284 | } |
---|
| 285 | |
---|
| 286 | if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ) |
---|
| 287 | { |
---|
| 288 | UInt uiIdx = uiAbsPartIdx; |
---|
| 289 | for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ ) |
---|
| 290 | { |
---|
| 291 | uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 292 | uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 293 | |
---|
| 294 | if( ( uiLPelX < pcCU->getSlice()->getSPS()->getWidth() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getHeight() ) ) |
---|
| 295 | xDecodeCU( pcCU, uiIdx, uiDepth+1 ); |
---|
| 296 | |
---|
| 297 | uiIdx += uiQNumParts; |
---|
| 298 | } |
---|
| 299 | |
---|
| 300 | return; |
---|
| 301 | } |
---|
| 302 | |
---|
| 303 | #if TSB_ALF_HEADER |
---|
| 304 | #else |
---|
| 305 | m_pcEntropyDecoder->decodeAlfCtrlFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 306 | #endif |
---|
| 307 | |
---|
| 308 | // decode CU mode and the partition size |
---|
[5] | 309 | #if HHI_MPI |
---|
[2] | 310 | if( !pcCU->getSlice()->isIntra() && pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 ) |
---|
[5] | 311 | #else |
---|
| 312 | if( !pcCU->getSlice()->isIntra() ) |
---|
| 313 | #endif |
---|
[2] | 314 | { |
---|
| 315 | m_pcEntropyDecoder->decodeSkipFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 316 | } |
---|
| 317 | |
---|
| 318 | |
---|
| 319 | if( pcCU->isSkipped(uiAbsPartIdx) ) |
---|
| 320 | { |
---|
| 321 | #if HHI_MRG_SKIP |
---|
| 322 | m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); |
---|
| 323 | m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); |
---|
| 324 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists |
---|
| 325 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; |
---|
| 326 | UInt uiNeighbourCandIdx[MRG_MAX_NUM_CANDS]; //MVs with same idx => same cand |
---|
| 327 | for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui ) |
---|
| 328 | { |
---|
| 329 | uhInterDirNeighbours[ui] = 0; |
---|
| 330 | uiNeighbourCandIdx[ui] = 0; |
---|
| 331 | } |
---|
| 332 | m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, uiNeighbourCandIdx ); |
---|
| 333 | for(UInt uiIter = 0; uiIter < MRG_MAX_NUM_CANDS; uiIter++ ) |
---|
| 334 | { |
---|
| 335 | pcCU->setNeighbourCandIdxSubParts( uiIter, uiNeighbourCandIdx[uiIter], uiAbsPartIdx, 0, uiDepth ); |
---|
| 336 | } |
---|
| 337 | m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, SIZE_2Nx2N, uhInterDirNeighbours, cMvFieldNeighbours, uiDepth ); |
---|
| 338 | #else |
---|
| 339 | pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_0, uiAbsPartIdx, 0, uiDepth); |
---|
| 340 | pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_0, uiAbsPartIdx, 0, uiDepth); |
---|
| 341 | |
---|
| 342 | pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_1, uiAbsPartIdx, 0, uiDepth); |
---|
| 343 | pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_1, uiAbsPartIdx, 0, uiDepth); |
---|
| 344 | |
---|
| 345 | if ( pcCU->getSlice()->getNumRefIdx( REF_PIC_LIST_0 ) > 0 ) //if ( ref. frame list0 has at least 1 entry ) |
---|
| 346 | { |
---|
| 347 | m_pcEntropyDecoder->decodeMVPIdx( pcCU, uiAbsPartIdx, uiDepth, REF_PIC_LIST_0, m_ppcCU[uiDepth]); |
---|
| 348 | } |
---|
| 349 | |
---|
| 350 | if ( pcCU->getSlice()->getNumRefIdx( REF_PIC_LIST_1 ) > 0 ) //if ( ref. frame list1 has at least 1 entry ) |
---|
| 351 | { |
---|
| 352 | m_pcEntropyDecoder->decodeMVPIdx( pcCU, uiAbsPartIdx, uiDepth, REF_PIC_LIST_1, m_ppcCU[uiDepth]); |
---|
| 353 | } |
---|
| 354 | #endif |
---|
[5] | 355 | #if HHI_MPI |
---|
[2] | 356 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == uiDepth ) |
---|
| 357 | { |
---|
| 358 | TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); |
---|
| 359 | pcCU->copyTextureMotionDataFrom( pcTextureCU, uiDepth, pcCU->getZorderIdxInCU() + uiAbsPartIdx, uiAbsPartIdx ); |
---|
| 360 | |
---|
| 361 | UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); |
---|
| 362 | for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 363 | { |
---|
| 364 | const UChar uhNewDepth = max( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) ); |
---|
| 365 | pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_SKIP ); |
---|
| 366 | pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N ); |
---|
| 367 | pcCU->setDepth( uiAbsPartIdx + ui, uhNewDepth ); |
---|
| 368 | pcCU->setWidth( uiAbsPartIdx + ui, g_uiMaxCUWidth>>uhNewDepth ); |
---|
| 369 | pcCU->setHeight( uiAbsPartIdx + ui, g_uiMaxCUHeight>>uhNewDepth ); |
---|
| 370 | } |
---|
| 371 | } |
---|
| 372 | #endif |
---|
| 373 | |
---|
[5] | 374 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 375 | m_pcEntropyDecoder->decodeResPredFlag( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth], 0 ); |
---|
[5] | 376 | #endif |
---|
[2] | 377 | return; |
---|
| 378 | } |
---|
| 379 | |
---|
[5] | 380 | #if HHI_MPI |
---|
[2] | 381 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 ) |
---|
| 382 | { |
---|
[5] | 383 | #endif |
---|
[2] | 384 | m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 385 | |
---|
| 386 | m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 387 | |
---|
| 388 | // prediction mode ( Intra : direction mode, Inter : Mv, reference idx ) |
---|
| 389 | m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]); |
---|
| 390 | |
---|
[5] | 391 | #if HHI_MPI |
---|
[2] | 392 | if( !pcCU->isIntra( uiAbsPartIdx ) ) |
---|
| 393 | { |
---|
| 394 | m_ppcCU[uiDepth] ->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); |
---|
| 395 | m_ppcCU[uiDepth] ->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); |
---|
[5] | 396 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 397 | m_pcEntropyDecoder->decodeResPredFlag ( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth], 0 ); |
---|
[5] | 398 | #endif |
---|
[2] | 399 | } |
---|
| 400 | |
---|
| 401 | if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == uiDepth ) |
---|
| 402 | { |
---|
| 403 | assert( pcCU->getZorderIdxInCU() == 0 ); |
---|
| 404 | TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); |
---|
| 405 | pcCU->copyTextureMotionDataFrom( pcTextureCU, uiDepth, pcCU->getZorderIdxInCU() + uiAbsPartIdx, uiAbsPartIdx ); |
---|
| 406 | |
---|
| 407 | UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); |
---|
| 408 | for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 409 | { |
---|
| 410 | const UChar uhNewDepth = max( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) ); |
---|
| 411 | pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_INTER ); |
---|
| 412 | pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N ); |
---|
| 413 | pcCU->setDepth( uiAbsPartIdx + ui, uhNewDepth ); |
---|
| 414 | pcCU->setWidth( uiAbsPartIdx + ui, g_uiMaxCUWidth>>uhNewDepth ); |
---|
| 415 | pcCU->setHeight( uiAbsPartIdx + ui, g_uiMaxCUHeight>>uhNewDepth ); |
---|
| 416 | } |
---|
| 417 | |
---|
| 418 | if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ) |
---|
| 419 | { |
---|
| 420 | UInt uiIdx = uiAbsPartIdx; |
---|
| 421 | for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ ) |
---|
| 422 | { |
---|
| 423 | uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 424 | uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 425 | |
---|
| 426 | if( ( uiLPelX < pcCU->getSlice()->getSPS()->getWidth() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getHeight() ) ) |
---|
| 427 | xDecodeCU( pcCU, uiIdx, uiDepth+1 ); |
---|
| 428 | |
---|
| 429 | uiIdx += uiQNumParts; |
---|
| 430 | } |
---|
| 431 | return; |
---|
| 432 | } |
---|
| 433 | } |
---|
[5] | 434 | } |
---|
[2] | 435 | #endif |
---|
[5] | 436 | |
---|
[2] | 437 | UInt uiCurrWidth = pcCU->getWidth ( uiAbsPartIdx ); |
---|
| 438 | UInt uiCurrHeight = pcCU->getHeight( uiAbsPartIdx ); |
---|
| 439 | |
---|
| 440 | // Coefficient decoding |
---|
| 441 | m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, uiCurrWidth, uiCurrHeight ); |
---|
| 442 | |
---|
| 443 | } |
---|
| 444 | |
---|
| 445 | Void TDecCu::xDecompressCU( TComDataCU* pcCU, TComDataCU* pcCUCur, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 446 | { |
---|
| 447 | TComPic* pcPic = pcCU->getPic(); |
---|
[12] | 448 | #if POZNAN_CU_SYNTH |
---|
[11] | 449 | if(pcPic->getPicYuvSynth()) m_ppcYuvSynth[uiDepth]->copyFromPicYuv( pcPic->getPicYuvSynth(), pcCU->getAddr(), uiAbsPartIdx ); |
---|
| 450 | #endif |
---|
[12] | 451 | #if POZNAN_CU_SKIP |
---|
[11] | 452 | if(pcPic->getPicYuvAvail()) m_ppcYuvAvail[uiDepth]->copyFromPicYuv( pcPic->getPicYuvAvail(), pcCU->getAddr(), uiAbsPartIdx ); |
---|
| 453 | #endif |
---|
[2] | 454 | |
---|
| 455 | Bool bBoundary = false; |
---|
| 456 | UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
| 457 | UInt uiRPelX = uiLPelX + (g_uiMaxCUWidth>>uiDepth) - 1; |
---|
| 458 | UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
| 459 | UInt uiBPelY = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1; |
---|
| 460 | |
---|
| 461 | if( ( uiRPelX >= pcCU->getSlice()->getSPS()->getWidth() ) || ( uiBPelY >= pcCU->getSlice()->getSPS()->getHeight() ) ) |
---|
| 462 | { |
---|
| 463 | bBoundary = true; |
---|
| 464 | } |
---|
| 465 | |
---|
| 466 | if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ) |
---|
| 467 | { |
---|
| 468 | UInt uiNextDepth = uiDepth + 1; |
---|
| 469 | UInt uiQNumParts = pcCU->getTotalNumPart() >> (uiNextDepth<<1); |
---|
| 470 | UInt uiIdx = uiAbsPartIdx; |
---|
| 471 | for ( UInt uiPartIdx = 0; uiPartIdx < 4; uiPartIdx++ ) |
---|
| 472 | { |
---|
| 473 | uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 474 | uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; |
---|
| 475 | |
---|
| 476 | if( ( uiLPelX < pcCU->getSlice()->getSPS()->getWidth() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getHeight() ) ) |
---|
| 477 | xDecompressCU(pcCU, m_ppcCU[uiNextDepth], uiIdx, uiNextDepth ); |
---|
| 478 | |
---|
| 479 | uiIdx += uiQNumParts; |
---|
| 480 | } |
---|
| 481 | return; |
---|
| 482 | } |
---|
| 483 | |
---|
| 484 | // Residual reconstruction |
---|
| 485 | m_ppcYuvResi[uiDepth]->clear(); |
---|
| 486 | |
---|
| 487 | m_ppcCU[uiDepth]->copySubCU( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 488 | |
---|
| 489 | switch( m_ppcCU[uiDepth]->getPredictionMode(0) ) |
---|
| 490 | { |
---|
| 491 | case MODE_SKIP: |
---|
| 492 | case MODE_INTER: |
---|
| 493 | xReconInter( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth ); |
---|
| 494 | break; |
---|
| 495 | case MODE_INTRA: |
---|
| 496 | xReconIntraQT( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth ); |
---|
| 497 | break; |
---|
[12] | 498 | #if POZNAN_CU_SKIP |
---|
[11] | 499 | case MODE_SYNTH: |
---|
| 500 | // break; |
---|
| 501 | m_ppcYuvReco[uiDepth]->copyFromPicYuv(pcPic->getPicYuvSynth(), pcCU->getAddr(), uiAbsPartIdx); |
---|
[12] | 502 | //m_ppcYuvReco[uiDepth]->copyFromPicYuv(pcPic->getPicYuvAvail(), pcCU->getAddr(), uiAbsPartIdx); //Poprawiæ |
---|
[11] | 503 | //m_ppcYuvReco[uiDepth]->clear(); |
---|
| 504 | break; |
---|
| 505 | #endif |
---|
[2] | 506 | default: |
---|
| 507 | assert(0); |
---|
| 508 | break; |
---|
| 509 | } |
---|
| 510 | |
---|
| 511 | xCopyToPic( m_ppcCU[uiDepth], pcPic, uiAbsPartIdx, uiDepth ); |
---|
| 512 | } |
---|
| 513 | |
---|
| 514 | Void TDecCu::xReconInter( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 515 | { |
---|
[5] | 516 | #if HHI_MPI |
---|
[2] | 517 | if( pcCU->getTextureModeDepth( 0 ) != -1 ) |
---|
| 518 | pcCU->setPartSizeSubParts( SIZE_NxN, 0, uiDepth ); |
---|
| 519 | #endif |
---|
| 520 | |
---|
| 521 | // inter prediction |
---|
| 522 | m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] ); |
---|
| 523 | |
---|
[5] | 524 | #if HHI_MPI |
---|
[2] | 525 | if( pcCU->getTextureModeDepth( 0 ) != -1 ) |
---|
| 526 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); |
---|
| 527 | #endif |
---|
| 528 | |
---|
[5] | 529 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 530 | if( pcCU->getResPredFlag( 0 ) ) |
---|
| 531 | { |
---|
| 532 | AOF( pcCU->getResPredAvail( 0 ) ); |
---|
| 533 | Bool bOK = pcCU->getResidualSamples( 0, m_ppcYuvResPred[uiDepth] ); |
---|
| 534 | AOF( bOK ); |
---|
| 535 | m_ppcYuvReco[uiDepth]->add( m_ppcYuvResPred[uiDepth], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) ); |
---|
| 536 | } |
---|
[5] | 537 | #endif |
---|
| 538 | |
---|
[2] | 539 | // inter recon |
---|
| 540 | xDecodeInterTexture( pcCU, 0, uiDepth ); |
---|
| 541 | |
---|
| 542 | // clip for only non-zero cbp case |
---|
| 543 | if ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V ) ) ) |
---|
| 544 | { |
---|
| 545 | m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) ); |
---|
| 546 | } |
---|
| 547 | else |
---|
| 548 | { |
---|
[5] | 549 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 550 | if( pcCU->getResPredFlag( 0 ) ) |
---|
| 551 | { |
---|
| 552 | m_ppcYuvReco[uiDepth]->clip( pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) ); |
---|
| 553 | } |
---|
[5] | 554 | #endif |
---|
[2] | 555 | m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 )); |
---|
| 556 | } |
---|
| 557 | } |
---|
| 558 | |
---|
| 559 | Void TDecCu::xDecodeIntraTexture( TComDataCU* pcCU, UInt uiPartIdx, Pel* piReco, Pel* piPred, Pel* piResi, UInt uiStride, TCoeff* pCoeff, UInt uiWidth, UInt uiHeight, UInt uiCurrDepth ) |
---|
| 560 | { |
---|
| 561 | if( pcCU->getTransformIdx(0) == uiCurrDepth ) |
---|
| 562 | { |
---|
| 563 | UInt uiX, uiY; |
---|
| 564 | TComPattern* pcPattern = pcCU->getPattern(); |
---|
| 565 | UInt uiZorder = pcCU->getZorderIdxInCU()+uiPartIdx; |
---|
| 566 | Pel* pPred = piPred; |
---|
| 567 | Pel* pResi = piResi; |
---|
| 568 | Pel* piPicReco = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), uiZorder); |
---|
| 569 | UInt uiPicStride = pcCU->getPic()->getPicYuvRec()->getStride(); |
---|
| 570 | |
---|
| 571 | pcPattern->initPattern( pcCU, uiCurrDepth, uiPartIdx ); |
---|
| 572 | |
---|
| 573 | Bool bAboveAvail = false; |
---|
| 574 | Bool bLeftAvail = false; |
---|
| 575 | |
---|
| 576 | pcPattern->initAdiPattern(pcCU, uiPartIdx, uiCurrDepth, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail); |
---|
| 577 | |
---|
| 578 | m_pcPrediction->predIntraLumaAng( pcPattern, pcCU->getLumaIntraDir(uiPartIdx), pPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
| 579 | |
---|
[12] | 580 | #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH |
---|
| 581 | m_pcTrQuant->setQPforQuant( pcCU->getQP(uiPartIdx) + pcCU->getQpOffsetForTextCU(uiPartIdx, true), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA ); |
---|
| 582 | #else |
---|
[2] | 583 | m_pcTrQuant->setQPforQuant( pcCU->getQP(uiPartIdx), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA ); |
---|
[12] | 584 | #endif |
---|
[2] | 585 | #if INTRA_DST_TYPE_7 |
---|
| 586 | m_pcTrQuant->invtransformNxN(TEXT_LUMA, pcCU->getLumaIntraDir(uiPartIdx), pResi, uiStride, pCoeff, uiWidth, uiHeight ); |
---|
| 587 | #else |
---|
| 588 | m_pcTrQuant->invtransformNxN( pResi, uiStride, pCoeff, uiWidth, uiHeight ); |
---|
| 589 | #endif |
---|
| 590 | // Reconstruction |
---|
| 591 | { |
---|
| 592 | pResi = piResi; |
---|
| 593 | pPred = piPred; |
---|
| 594 | for( uiY = 0; uiY < uiHeight; uiY++ ) |
---|
| 595 | { |
---|
| 596 | for( uiX = 0; uiX < uiWidth; uiX++ ) |
---|
| 597 | { |
---|
| 598 | piReco [uiX] = Clip(pPred[uiX] + pResi[uiX]); |
---|
| 599 | piPicReco[uiX] = piReco[uiX]; |
---|
| 600 | } |
---|
| 601 | piReco += uiStride; |
---|
| 602 | pPred += uiStride; |
---|
| 603 | pResi += uiStride; |
---|
| 604 | piPicReco += uiPicStride; |
---|
| 605 | } |
---|
| 606 | } |
---|
| 607 | } |
---|
| 608 | else |
---|
| 609 | { |
---|
| 610 | uiCurrDepth++; |
---|
| 611 | uiWidth >>= 1; |
---|
| 612 | uiHeight >>= 1; |
---|
| 613 | UInt uiPartOffset = pcCU->getTotalNumPart()>>(uiCurrDepth<<1); |
---|
| 614 | UInt uiCoeffOffset = uiWidth * uiHeight; |
---|
| 615 | UInt uiPelOffset = uiHeight * uiStride; |
---|
| 616 | Pel* pResi = piResi; |
---|
| 617 | Pel* pReco = piReco; |
---|
| 618 | Pel* pPred = piPred; |
---|
| 619 | xDecodeIntraTexture( pcCU, uiPartIdx, pReco, pPred, pResi, uiStride, pCoeff, uiWidth, uiHeight, uiCurrDepth ); |
---|
| 620 | uiPartIdx += uiPartOffset; |
---|
| 621 | pCoeff += uiCoeffOffset; |
---|
| 622 | pResi = piResi + uiWidth; |
---|
| 623 | pReco = piReco + uiWidth; |
---|
| 624 | pPred = piPred + uiWidth; |
---|
| 625 | xDecodeIntraTexture( pcCU, uiPartIdx, pReco, pPred, pResi, uiStride, pCoeff, uiWidth, uiHeight, uiCurrDepth ); |
---|
| 626 | uiPartIdx += uiPartOffset; |
---|
| 627 | pCoeff += uiCoeffOffset; |
---|
| 628 | pResi = piResi + uiPelOffset; |
---|
| 629 | pReco = piReco + uiPelOffset; |
---|
| 630 | pPred = piPred + uiPelOffset; |
---|
| 631 | xDecodeIntraTexture( pcCU, uiPartIdx, pReco, pPred, pResi, uiStride, pCoeff, uiWidth, uiHeight, uiCurrDepth ); |
---|
| 632 | uiPartIdx += uiPartOffset; |
---|
| 633 | pCoeff += uiCoeffOffset; |
---|
| 634 | pResi = piResi + uiPelOffset + uiWidth; |
---|
| 635 | pReco = piReco + uiPelOffset + uiWidth; |
---|
| 636 | pPred = piPred + uiPelOffset + uiWidth; |
---|
| 637 | xDecodeIntraTexture( pcCU, uiPartIdx, pReco, pPred, pResi, uiStride, pCoeff, uiWidth, uiHeight, uiCurrDepth ); |
---|
| 638 | } |
---|
| 639 | } |
---|
| 640 | |
---|
| 641 | // ADI chroma |
---|
| 642 | Void TDecCu::xRecurIntraInvTransChroma(TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piResi, Pel* piPred, Pel* piReco, UInt uiStride, TCoeff* piCoeff, UInt uiWidth, UInt uiHeight, UInt uiTrMode, UInt uiCurrTrMode, TextType eText ) |
---|
| 643 | { |
---|
| 644 | if( uiTrMode == uiCurrTrMode ) |
---|
| 645 | { |
---|
| 646 | UInt uiX, uiY; |
---|
| 647 | UInt uiZorder = pcCU->getZorderIdxInCU()+uiAbsPartIdx; |
---|
| 648 | Pel* pResi = piResi; |
---|
| 649 | Pel* pPred = piPred; |
---|
| 650 | Pel* piPicReco; |
---|
| 651 | if( eText == TEXT_CHROMA_U ) |
---|
| 652 | piPicReco= pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), uiZorder); |
---|
| 653 | else |
---|
| 654 | piPicReco= pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), uiZorder); |
---|
| 655 | |
---|
| 656 | UInt uiPicStride = pcCU->getPic()->getPicYuvRec()->getCStride(); |
---|
| 657 | |
---|
| 658 | pcCU->getPattern()->initPattern( pcCU, uiCurrTrMode, uiAbsPartIdx ); |
---|
| 659 | |
---|
| 660 | Bool bAboveAvail = false; |
---|
| 661 | Bool bLeftAvail = false; |
---|
| 662 | |
---|
| 663 | pcCU->getPattern()->initAdiPatternChroma(pcCU,uiAbsPartIdx, uiCurrTrMode, m_pcPrediction->getPredicBuf(),m_pcPrediction->getPredicBufWidth(),m_pcPrediction->getPredicBufHeight(),bAboveAvail,bLeftAvail); |
---|
| 664 | |
---|
| 665 | UInt uiModeL = pcCU->getLumaIntraDir(0); |
---|
| 666 | UInt uiMode = pcCU->getChromaIntraDir(0); |
---|
| 667 | |
---|
| 668 | if (uiMode==4) uiMode = uiModeL; |
---|
| 669 | |
---|
| 670 | Int* pPatChr; |
---|
| 671 | |
---|
| 672 | if (eText==TEXT_CHROMA_U) |
---|
| 673 | { |
---|
| 674 | pPatChr= pcCU->getPattern()->getAdiCbBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ); |
---|
| 675 | } |
---|
| 676 | else // (eText==TEXT_CHROMA_V) |
---|
| 677 | { |
---|
| 678 | pPatChr= pcCU->getPattern()->getAdiCrBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ); |
---|
| 679 | } |
---|
| 680 | |
---|
| 681 | m_pcPrediction-> predIntraChromaAng( pcCU->getPattern(), pPatChr, uiMode, pPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
| 682 | |
---|
| 683 | // Inverse Transform |
---|
| 684 | if( pcCU->getCbf(0, eText, uiCurrTrMode) ) |
---|
| 685 | { |
---|
| 686 | #if INTRA_DST_TYPE_7 |
---|
| 687 | m_pcTrQuant->invtransformNxN( eText, REG_DCT, pResi, uiStride, piCoeff, uiWidth, uiHeight); |
---|
| 688 | #else |
---|
| 689 | m_pcTrQuant->invtransformNxN( pResi, uiStride, piCoeff, uiWidth, uiHeight ); |
---|
| 690 | #endif |
---|
| 691 | } |
---|
| 692 | pResi = piResi; |
---|
| 693 | |
---|
| 694 | for( uiY = 0; uiY < uiHeight; uiY++ ) |
---|
| 695 | { |
---|
| 696 | for( uiX = 0; uiX < uiWidth; uiX++ ) |
---|
| 697 | { |
---|
| 698 | piReco [uiX] = Clip( pPred[uiX] + pResi[uiX] ); |
---|
| 699 | piPicReco[uiX] = piReco[uiX]; |
---|
| 700 | } |
---|
| 701 | |
---|
| 702 | pPred += uiStride; |
---|
| 703 | pResi += uiStride; |
---|
| 704 | piReco += uiStride; |
---|
| 705 | piPicReco += uiPicStride; |
---|
| 706 | } |
---|
| 707 | } |
---|
| 708 | else |
---|
| 709 | { |
---|
| 710 | uiCurrTrMode++; |
---|
| 711 | uiWidth >>= 1; |
---|
| 712 | uiHeight >>= 1; |
---|
| 713 | UInt uiCoeffOffset = uiWidth*uiHeight; |
---|
| 714 | UInt uiPelOffset = uiHeight*uiStride; |
---|
| 715 | UInt uiPartOffst = pcCU->getTotalNumPart()>>(uiCurrTrMode<<1); |
---|
| 716 | Pel* pResi = piResi; |
---|
| 717 | Pel* pPred = piPred; |
---|
| 718 | Pel* pReco = piReco; |
---|
| 719 | xRecurIntraInvTransChroma( pcCU, uiAbsPartIdx, pResi, pPred, pReco, uiStride, piCoeff, uiWidth, uiHeight, uiTrMode, uiCurrTrMode, eText ); |
---|
| 720 | uiAbsPartIdx += uiPartOffst; |
---|
| 721 | piCoeff += uiCoeffOffset; |
---|
| 722 | pResi = piResi + uiWidth; pPred = piPred + uiWidth; pReco = piReco + uiWidth; |
---|
| 723 | xRecurIntraInvTransChroma( pcCU, uiAbsPartIdx, pResi, pPred, pReco, uiStride, piCoeff, uiWidth, uiHeight, uiTrMode, uiCurrTrMode, eText ); |
---|
| 724 | uiAbsPartIdx += uiPartOffst; |
---|
| 725 | piCoeff += uiCoeffOffset; |
---|
| 726 | pResi = piResi + uiPelOffset; pPred = piPred + uiPelOffset; pReco = piReco + uiPelOffset; |
---|
| 727 | xRecurIntraInvTransChroma( pcCU, uiAbsPartIdx, pResi, pPred, pReco, uiStride, piCoeff, uiWidth, uiHeight, uiTrMode, uiCurrTrMode, eText ); |
---|
| 728 | uiAbsPartIdx += uiPartOffst; |
---|
| 729 | piCoeff += uiCoeffOffset; |
---|
| 730 | pResi = piResi + uiPelOffset + uiWidth; pPred = piPred + uiPelOffset + uiWidth; pReco = piReco + uiPelOffset + uiWidth; |
---|
| 731 | xRecurIntraInvTransChroma( pcCU, uiAbsPartIdx, pResi, pPred, pReco, uiStride, piCoeff, uiWidth, uiHeight, uiTrMode, uiCurrTrMode, eText ); |
---|
| 732 | } |
---|
| 733 | } |
---|
| 734 | |
---|
| 735 | Void |
---|
| 736 | TDecCu::xIntraRecLumaBlk( TComDataCU* pcCU, |
---|
| 737 | UInt uiTrDepth, |
---|
| 738 | UInt uiAbsPartIdx, |
---|
| 739 | TComYuv* pcRecoYuv, |
---|
| 740 | TComYuv* pcPredYuv, |
---|
| 741 | TComYuv* pcResiYuv ) |
---|
| 742 | { |
---|
| 743 | UInt uiWidth = pcCU ->getWidth ( 0 ) >> uiTrDepth; |
---|
| 744 | UInt uiHeight = pcCU ->getHeight ( 0 ) >> uiTrDepth; |
---|
| 745 | UInt uiStride = pcRecoYuv->getStride (); |
---|
| 746 | Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 747 | Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 748 | Pel* piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); |
---|
| 749 | |
---|
| 750 | UInt uiNumCoeffInc = ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ); |
---|
| 751 | TCoeff* pcCoeff = pcCU->getCoeffY() + ( uiNumCoeffInc * uiAbsPartIdx ); |
---|
| 752 | |
---|
| 753 | UInt uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); |
---|
| 754 | |
---|
| 755 | UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
| 756 | Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); |
---|
| 757 | UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); |
---|
| 758 | |
---|
| 759 | //===== init availability pattern ===== |
---|
| 760 | Bool bAboveAvail = false; |
---|
| 761 | Bool bLeftAvail = false; |
---|
| 762 | pcCU->getPattern()->initPattern ( pcCU, uiTrDepth, uiAbsPartIdx ); |
---|
| 763 | pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, |
---|
| 764 | m_pcPrediction->getPredicBuf (), |
---|
| 765 | m_pcPrediction->getPredicBufWidth (), |
---|
| 766 | m_pcPrediction->getPredicBufHeight (), |
---|
| 767 | bAboveAvail, bLeftAvail ); |
---|
| 768 | |
---|
[5] | 769 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[2] | 770 | if( uiLumaPredMode > MAX_MODE_ID_INTRA_DIR ) |
---|
| 771 | { |
---|
| 772 | m_pcPrediction->predIntraLumaDMM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, false ); |
---|
| 773 | } |
---|
| 774 | else |
---|
| 775 | #endif |
---|
| 776 | { |
---|
| 777 | //===== get prediction signal ===== |
---|
| 778 | m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
| 779 | } |
---|
| 780 | //===== inverse transform ===== |
---|
[12] | 781 | #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH |
---|
| 782 | m_pcTrQuant->setQPforQuant( pcCU->getQP(0) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, true), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA ); |
---|
| 783 | #else |
---|
[2] | 784 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA ); |
---|
[12] | 785 | #endif |
---|
[2] | 786 | #if INTRA_DST_TYPE_7 |
---|
| 787 | m_pcTrQuant->invtransformNxN( TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight ); |
---|
| 788 | #else |
---|
| 789 | m_pcTrQuant->invtransformNxN( piResi, uiStride, pcCoeff, uiWidth, uiHeight ); |
---|
| 790 | #endif |
---|
| 791 | |
---|
| 792 | |
---|
| 793 | //===== reconstruction ===== |
---|
| 794 | { |
---|
| 795 | Pel* pPred = piPred; |
---|
| 796 | Pel* pResi = piResi; |
---|
| 797 | Pel* pReco = piReco; |
---|
| 798 | Pel* pRecIPred = piRecIPred; |
---|
| 799 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
| 800 | { |
---|
| 801 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
| 802 | { |
---|
| 803 | pReco [ uiX ] = Clip( pPred[ uiX ] + pResi[ uiX ] ); |
---|
| 804 | pRecIPred[ uiX ] = pReco[ uiX ]; |
---|
| 805 | } |
---|
| 806 | pPred += uiStride; |
---|
| 807 | pResi += uiStride; |
---|
| 808 | pReco += uiStride; |
---|
| 809 | pRecIPred += uiRecIPredStride; |
---|
| 810 | } |
---|
| 811 | } |
---|
| 812 | } |
---|
| 813 | |
---|
| 814 | |
---|
| 815 | Void |
---|
| 816 | TDecCu::xIntraRecChromaBlk( TComDataCU* pcCU, |
---|
| 817 | UInt uiTrDepth, |
---|
| 818 | UInt uiAbsPartIdx, |
---|
| 819 | TComYuv* pcRecoYuv, |
---|
| 820 | TComYuv* pcPredYuv, |
---|
| 821 | TComYuv* pcResiYuv, |
---|
| 822 | UInt uiChromaId ) |
---|
| 823 | { |
---|
| 824 | UInt uiFullDepth = pcCU->getDepth( 0 ) + uiTrDepth; |
---|
| 825 | UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiFullDepth ] + 2; |
---|
| 826 | if( uiLog2TrSize == pcCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) |
---|
| 827 | { |
---|
| 828 | assert( uiTrDepth > 0 ); |
---|
| 829 | uiTrDepth--; |
---|
| 830 | UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth( 0 ) + uiTrDepth ) << 1 ); |
---|
| 831 | Bool bFirstQ = ( ( uiAbsPartIdx % uiQPDiv ) == 0 ); |
---|
| 832 | if( !bFirstQ ) |
---|
| 833 | { |
---|
| 834 | return; |
---|
| 835 | } |
---|
| 836 | } |
---|
| 837 | |
---|
| 838 | TextType eText = ( uiChromaId > 0 ? TEXT_CHROMA_V : TEXT_CHROMA_U ); |
---|
| 839 | UInt uiWidth = pcCU ->getWidth ( 0 ) >> ( uiTrDepth + 1 ); |
---|
| 840 | UInt uiHeight = pcCU ->getHeight ( 0 ) >> ( uiTrDepth + 1 ); |
---|
| 841 | UInt uiStride = pcRecoYuv->getCStride (); |
---|
| 842 | Pel* piReco = ( uiChromaId > 0 ? pcRecoYuv->getCrAddr( uiAbsPartIdx ) : pcRecoYuv->getCbAddr( uiAbsPartIdx ) ); |
---|
| 843 | Pel* piPred = ( uiChromaId > 0 ? pcPredYuv->getCrAddr( uiAbsPartIdx ) : pcPredYuv->getCbAddr( uiAbsPartIdx ) ); |
---|
| 844 | Pel* piResi = ( uiChromaId > 0 ? pcResiYuv->getCrAddr( uiAbsPartIdx ) : pcResiYuv->getCbAddr( uiAbsPartIdx ) ); |
---|
| 845 | |
---|
| 846 | UInt uiNumCoeffInc = ( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ) ) >> 2; |
---|
| 847 | TCoeff* pcCoeff = ( uiChromaId > 0 ? pcCU->getCoeffCr() : pcCU->getCoeffCb() ) + ( uiNumCoeffInc * uiAbsPartIdx ); |
---|
| 848 | |
---|
| 849 | UInt uiChromaPredMode = pcCU->getChromaIntraDir( 0 ); |
---|
| 850 | |
---|
| 851 | #if !LM_CHROMA |
---|
| 852 | if( uiChromaPredMode == 4 ) |
---|
| 853 | { |
---|
| 854 | uiChromaPredMode = pcCU->getLumaIntraDir( 0 ); |
---|
| 855 | } |
---|
| 856 | #endif |
---|
| 857 | |
---|
| 858 | UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
| 859 | Pel* piRecIPred = ( uiChromaId > 0 ? pcCU->getPic()->getPicYuvRec()->getCrAddr( pcCU->getAddr(), uiZOrder ) : pcCU->getPic()->getPicYuvRec()->getCbAddr( pcCU->getAddr(), uiZOrder ) ); |
---|
| 860 | UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getCStride(); |
---|
| 861 | |
---|
| 862 | //===== init availability pattern ===== |
---|
| 863 | Bool bAboveAvail = false; |
---|
| 864 | Bool bLeftAvail = false; |
---|
| 865 | pcCU->getPattern()->initPattern ( pcCU, uiTrDepth, uiAbsPartIdx ); |
---|
| 866 | pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth, |
---|
| 867 | m_pcPrediction->getPredicBuf (), |
---|
| 868 | m_pcPrediction->getPredicBufWidth (), |
---|
| 869 | m_pcPrediction->getPredicBufHeight (), |
---|
| 870 | bAboveAvail, bLeftAvail ); |
---|
| 871 | Int* pPatChroma = ( uiChromaId > 0 ? pcCU->getPattern()->getAdiCrBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) : pcCU->getPattern()->getAdiCbBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) ); |
---|
| 872 | |
---|
| 873 | //===== get prediction signal ===== |
---|
| 874 | #if LM_CHROMA |
---|
| 875 | if(pcCU->getSlice()->getSPS()->getUseLMChroma() && uiChromaPredMode == 3) |
---|
| 876 | { |
---|
| 877 | m_pcPrediction->predLMIntraChroma( pcCU->getPattern(), pPatChroma, piPred, uiStride, uiWidth, uiHeight, uiChromaId ); |
---|
| 878 | } |
---|
| 879 | else |
---|
| 880 | { |
---|
| 881 | if( uiChromaPredMode == 4 ) |
---|
| 882 | { |
---|
| 883 | uiChromaPredMode = pcCU->getLumaIntraDir( 0 ); |
---|
| 884 | } |
---|
| 885 | m_pcPrediction->predIntraChromaAng( pcCU->getPattern(), pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
| 886 | } |
---|
| 887 | #else // LM_CHROMA |
---|
| 888 | m_pcPrediction->predIntraChromaAng( pcCU->getPattern(), pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); |
---|
| 889 | #endif |
---|
| 890 | |
---|
| 891 | //===== inverse transform ===== |
---|
[12] | 892 | #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH |
---|
| 893 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, true), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText ); |
---|
| 894 | #else |
---|
[2] | 895 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText ); |
---|
[12] | 896 | #endif |
---|
[2] | 897 | #if INTRA_DST_TYPE_7 |
---|
| 898 | m_pcTrQuant->invtransformNxN( eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight ); |
---|
| 899 | #else |
---|
| 900 | m_pcTrQuant->invtransformNxN( piResi, uiStride, pcCoeff, uiWidth, uiHeight ); |
---|
| 901 | #endif |
---|
| 902 | |
---|
| 903 | //===== reconstruction ===== |
---|
| 904 | { |
---|
| 905 | Pel* pPred = piPred; |
---|
| 906 | Pel* pResi = piResi; |
---|
| 907 | Pel* pReco = piReco; |
---|
| 908 | Pel* pRecIPred = piRecIPred; |
---|
| 909 | for( UInt uiY = 0; uiY < uiHeight; uiY++ ) |
---|
| 910 | { |
---|
| 911 | for( UInt uiX = 0; uiX < uiWidth; uiX++ ) |
---|
| 912 | { |
---|
| 913 | pReco [ uiX ] = Clip( pPred[ uiX ] + pResi[ uiX ] ); |
---|
| 914 | pRecIPred[ uiX ] = pReco[ uiX ]; |
---|
| 915 | } |
---|
| 916 | pPred += uiStride; |
---|
| 917 | pResi += uiStride; |
---|
| 918 | pReco += uiStride; |
---|
| 919 | pRecIPred += uiRecIPredStride; |
---|
| 920 | } |
---|
| 921 | } |
---|
| 922 | } |
---|
| 923 | |
---|
| 924 | Void |
---|
| 925 | TDecCu::xIntraRecQT( TComDataCU* pcCU, |
---|
| 926 | UInt uiTrDepth, |
---|
| 927 | UInt uiAbsPartIdx, |
---|
| 928 | TComYuv* pcRecoYuv, |
---|
| 929 | TComYuv* pcPredYuv, |
---|
| 930 | TComYuv* pcResiYuv ) |
---|
| 931 | { |
---|
| 932 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
---|
| 933 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
---|
| 934 | if( uiTrMode == uiTrDepth ) |
---|
| 935 | { |
---|
| 936 | xIntraRecLumaBlk ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 937 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 ); |
---|
| 938 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 ); |
---|
| 939 | } |
---|
| 940 | else |
---|
| 941 | { |
---|
| 942 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
---|
| 943 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
---|
| 944 | { |
---|
| 945 | xIntraRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 946 | } |
---|
| 947 | } |
---|
| 948 | } |
---|
| 949 | |
---|
| 950 | Void |
---|
| 951 | TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 952 | { |
---|
| 953 | UInt uiInitTrDepth = ( pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1 ); |
---|
| 954 | UInt uiNumPart = pcCU->getNumPartInter(); |
---|
| 955 | UInt uiNumQParts = pcCU->getTotalNumPart() >> 2; |
---|
| 956 | |
---|
| 957 | #if LM_CHROMA |
---|
| 958 | for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ ) |
---|
| 959 | { |
---|
| 960 | xIntraLumaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] ); |
---|
| 961 | } |
---|
| 962 | |
---|
| 963 | for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ ) |
---|
| 964 | { |
---|
| 965 | xIntraChromaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] ); |
---|
| 966 | } |
---|
| 967 | #else |
---|
| 968 | |
---|
| 969 | for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ ) |
---|
| 970 | { |
---|
| 971 | xIntraRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] ); |
---|
| 972 | } |
---|
| 973 | #endif |
---|
| 974 | |
---|
| 975 | } |
---|
| 976 | |
---|
| 977 | #if LM_CHROMA |
---|
| 978 | |
---|
| 979 | /** Funtion for deriving recontructed PU/CU Luma sample with QTree structure |
---|
| 980 | * \param pcCU pointer of current CU |
---|
| 981 | * \param uiTrDepth current tranform split depth |
---|
| 982 | * \param uiAbsPartIdx part index |
---|
| 983 | * \param pcRecoYuv pointer to reconstructed sample arrays |
---|
| 984 | * \param pcPredYuv pointer to prediction sample arrays |
---|
| 985 | * \param pcResiYuv pointer to residue sample arrays |
---|
| 986 | * |
---|
| 987 | \ This function dervies recontructed PU/CU Luma sample with recursive QTree structure |
---|
| 988 | */ |
---|
| 989 | Void |
---|
| 990 | TDecCu::xIntraLumaRecQT( TComDataCU* pcCU, |
---|
| 991 | UInt uiTrDepth, |
---|
| 992 | UInt uiAbsPartIdx, |
---|
| 993 | TComYuv* pcRecoYuv, |
---|
| 994 | TComYuv* pcPredYuv, |
---|
| 995 | TComYuv* pcResiYuv ) |
---|
| 996 | { |
---|
| 997 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
---|
| 998 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
---|
| 999 | if( uiTrMode == uiTrDepth ) |
---|
| 1000 | { |
---|
| 1001 | xIntraRecLumaBlk ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 1002 | } |
---|
| 1003 | else |
---|
| 1004 | { |
---|
| 1005 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
---|
| 1006 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
---|
| 1007 | { |
---|
| 1008 | xIntraLumaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 1009 | } |
---|
| 1010 | } |
---|
| 1011 | } |
---|
| 1012 | |
---|
| 1013 | /** Funtion for deriving recontructed PU/CU chroma samples with QTree structure |
---|
| 1014 | * \param pcCU pointer of current CU |
---|
| 1015 | * \param uiTrDepth current tranform split depth |
---|
| 1016 | * \param uiAbsPartIdx part index |
---|
| 1017 | * \param pcRecoYuv pointer to reconstructed sample arrays |
---|
| 1018 | * \param pcPredYuv pointer to prediction sample arrays |
---|
| 1019 | * \param pcResiYuv pointer to residue sample arrays |
---|
| 1020 | * |
---|
| 1021 | \ This function dervies recontructed PU/CU chroma samples with QTree recursive structure |
---|
| 1022 | */ |
---|
| 1023 | Void |
---|
| 1024 | TDecCu::xIntraChromaRecQT( TComDataCU* pcCU, |
---|
| 1025 | UInt uiTrDepth, |
---|
| 1026 | UInt uiAbsPartIdx, |
---|
| 1027 | TComYuv* pcRecoYuv, |
---|
| 1028 | TComYuv* pcPredYuv, |
---|
| 1029 | TComYuv* pcResiYuv ) |
---|
| 1030 | { |
---|
| 1031 | UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; |
---|
| 1032 | UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); |
---|
| 1033 | if( uiTrMode == uiTrDepth ) |
---|
| 1034 | { |
---|
| 1035 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 ); |
---|
| 1036 | xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 ); |
---|
| 1037 | } |
---|
| 1038 | else |
---|
| 1039 | { |
---|
| 1040 | UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); |
---|
| 1041 | for( UInt uiPart = 0; uiPart < 4; uiPart++ ) |
---|
| 1042 | { |
---|
| 1043 | xIntraChromaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); |
---|
| 1044 | } |
---|
| 1045 | } |
---|
| 1046 | } |
---|
| 1047 | #endif |
---|
| 1048 | |
---|
| 1049 | Void TDecCu::xCopyToPic( TComDataCU* pcCU, TComPic* pcPic, UInt uiZorderIdx, UInt uiDepth ) |
---|
| 1050 | { |
---|
| 1051 | UInt uiCUAddr = pcCU->getAddr(); |
---|
| 1052 | |
---|
| 1053 | m_ppcYuvReco[uiDepth]->copyToPicYuv ( pcPic->getPicYuvRec (), uiCUAddr, uiZorderIdx ); |
---|
| 1054 | |
---|
| 1055 | return; |
---|
| 1056 | } |
---|
| 1057 | |
---|
| 1058 | Void TDecCu::xDecodeInterTexture ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 1059 | { |
---|
| 1060 | UInt uiWidth = pcCU->getWidth ( uiAbsPartIdx ); |
---|
| 1061 | UInt uiHeight = pcCU->getHeight( uiAbsPartIdx ); |
---|
| 1062 | TCoeff* piCoeff; |
---|
| 1063 | |
---|
| 1064 | Pel* pResi; |
---|
| 1065 | UInt uiLumaTrMode, uiChromaTrMode; |
---|
| 1066 | |
---|
| 1067 | pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx( uiAbsPartIdx ), uiLumaTrMode, uiChromaTrMode ); |
---|
| 1068 | |
---|
| 1069 | // Y |
---|
| 1070 | piCoeff = pcCU->getCoeffY(); |
---|
| 1071 | pResi = m_ppcYuvResi[uiDepth]->getLumaAddr(); |
---|
[12] | 1072 | #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH |
---|
| 1073 | Int QPoffset = pcCU->getQpOffsetForTextCU(uiAbsPartIdx, false); |
---|
| 1074 | m_pcTrQuant->setQPforQuant ( pcCU->getQP(uiAbsPartIdx) + QPoffset, !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA ); |
---|
| 1075 | #else |
---|
[2] | 1076 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA ); |
---|
[12] | 1077 | #endif |
---|
[2] | 1078 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff ); |
---|
| 1079 | |
---|
| 1080 | // Cb and Cr |
---|
[12] | 1081 | #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH |
---|
| 1082 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ) + QPoffset, !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); |
---|
| 1083 | #else |
---|
[2] | 1084 | m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); |
---|
[12] | 1085 | #endif |
---|
[2] | 1086 | |
---|
| 1087 | uiWidth >>= 1; |
---|
| 1088 | uiHeight >>= 1; |
---|
| 1089 | piCoeff = pcCU->getCoeffCb(); pResi = m_ppcYuvResi[uiDepth]->getCbAddr(); |
---|
| 1090 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); |
---|
| 1091 | piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr(); |
---|
| 1092 | m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); |
---|
| 1093 | } |
---|
| 1094 | |
---|