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