Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibDecoder/TDecCu.cpp
- Timestamp:
- 13 Aug 2015, 17:38:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibDecoder/TDecCu.cpp
r1196 r1313 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 37 37 38 38 #include "TDecCu.h" 39 #include "TLibCommon/TComTU.h" 40 #include "TLibCommon/TComPrediction.h" 39 41 40 42 //! \ingroup TLibDecoder … … 50 52 m_ppcYuvReco = NULL; 51 53 m_ppcCU = NULL; 52 #if H_3D_DBBP54 #if NH_3D_DBBP 53 55 m_ppcYuvRecoDBBP = NULL; 54 56 #endif … … 67 69 68 70 /** 69 \param uiMaxDepth total number of allowable depth 70 \param uiMaxWidth largest CU width 71 \param uiMaxHeight largest CU height 71 \param uiMaxDepth total number of allowable depth 72 \param uiMaxWidth largest CU width 73 \param uiMaxHeight largest CU height 74 \param chromaFormatIDC chroma format 72 75 */ 73 Void TDecCu::create( UInt uiMaxDepth, UInt uiMaxWidth, UInt uiMaxHeight )76 Void TDecCu::create( UInt uiMaxDepth, UInt uiMaxWidth, UInt uiMaxHeight, ChromaFormat chromaFormatIDC ) 74 77 { 75 78 m_uiMaxDepth = uiMaxDepth+1; 76 79 77 80 m_ppcYuvResi = new TComYuv*[m_uiMaxDepth-1]; 78 81 m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1]; 79 82 m_ppcCU = new TComDataCU*[m_uiMaxDepth-1]; 80 #if H_3D_DBBP83 #if NH_3D_DBBP 81 84 m_ppcYuvRecoDBBP = new TComYuv*[m_uiMaxDepth-1]; 82 85 #endif 83 84 UInt uiNumPartitions; 86 85 87 for ( UInt ui = 0; ui < m_uiMaxDepth-1; ui++ ) 86 88 { 87 uiNumPartitions = 1<<( ( m_uiMaxDepth - ui - 1 )<<1 );89 UInt uiNumPartitions = 1<<( ( m_uiMaxDepth - ui - 1 )<<1 ); 88 90 UInt uiWidth = uiMaxWidth >> ui; 89 91 UInt uiHeight = uiMaxHeight >> ui; 90 91 m_ppcYuvResi[ui] = new TComYuv; m_ppcYuvResi[ui]->create( uiWidth, uiHeight ); 92 m_ppcYuvReco[ui] = new TComYuv; m_ppcYuvReco[ui]->create( uiWidth, uiHeight ); 93 m_ppcCU [ui] = new TComDataCU; m_ppcCU [ui]->create( uiNumPartitions, uiWidth, uiHeight, true, uiMaxWidth >> (m_uiMaxDepth - 1) ); 94 #if H_3D_DBBP 95 m_ppcYuvRecoDBBP[ui] = new TComYuv; m_ppcYuvRecoDBBP[ui]->create( uiWidth, uiHeight ); 96 #endif 97 } 98 92 93 // The following arrays (m_ppcYuvResi, m_ppcYuvReco and m_ppcCU) are only required for CU depths 94 // although data is allocated for all possible depths of the CU/TU tree except the last. 95 // Since the TU tree will always include at least one additional depth greater than the CU tree, 96 // there will be enough entries for these arrays. 97 // (Section 7.4.3.2: "The CVS shall not contain data that result in (Log2MinTrafoSize) MinTbLog2SizeY 98 // greater than or equal to MinCbLog2SizeY") 99 // TODO: tidy the array allocation given the above comment. 100 101 m_ppcYuvResi[ui] = new TComYuv; m_ppcYuvResi[ui]->create( uiWidth, uiHeight, chromaFormatIDC ); 102 m_ppcYuvReco[ui] = new TComYuv; m_ppcYuvReco[ui]->create( uiWidth, uiHeight, chromaFormatIDC ); 103 m_ppcCU [ui] = new TComDataCU; m_ppcCU [ui]->create( chromaFormatIDC, uiNumPartitions, uiWidth, uiHeight, true, uiMaxWidth >> (m_uiMaxDepth - 1) ); 104 #if NH_3D_DBBP 105 m_ppcYuvRecoDBBP[ui] = new TComYuv; m_ppcYuvRecoDBBP[ui]->create( uiWidth, uiHeight, chromaFormatIDC ); 106 #endif 107 } 108 99 109 m_bDecodeDQP = false; 110 m_IsChromaQpAdjCoded = false; 100 111 101 112 // initialize partition order. … … 103 114 initZscanToRaster(m_uiMaxDepth, 1, 0, piTmp); 104 115 initRasterToZscan( uiMaxWidth, uiMaxHeight, m_uiMaxDepth ); 105 116 106 117 // initialize conversion matrix from partition index to pel 107 118 initRasterToPelXY( uiMaxWidth, uiMaxHeight, m_uiMaxDepth ); … … 115 126 m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL; 116 127 m_ppcCU [ui]->destroy(); delete m_ppcCU [ui]; m_ppcCU [ui] = NULL; 117 #if H_3D_DBBP128 #if NH_3D_DBBP 118 129 m_ppcYuvRecoDBBP[ui]->destroy(); delete m_ppcYuvRecoDBBP[ui]; m_ppcYuvRecoDBBP[ui] = NULL; 119 130 #endif 120 131 } 121 132 122 133 delete [] m_ppcYuvResi; m_ppcYuvResi = NULL; 123 134 delete [] m_ppcYuvReco; m_ppcYuvReco = NULL; 124 135 delete [] m_ppcCU ; m_ppcCU = NULL; 125 #if H_3D_DBBP136 #if NH_3D_DBBP 126 137 delete [] m_ppcYuvRecoDBBP; m_ppcYuvRecoDBBP = NULL; 127 138 #endif … … 132 143 // ==================================================================================================================== 133 144 134 /** \param pcCU pointer of CU data 135 \param ruiIsLast last data? 145 /** 146 Parse a CTU. 147 \param pCtu [in/out] pointer to CTU data structure 148 \param isLastCtuOfSliceSegment [out] true, if last CTU of the slice segment 136 149 */ 137 Void TDecCu::decodeC U( TComDataCU* pcCU, UInt& ruiIsLast )138 { 139 if ( p cCU->getSlice()->getPPS()->getUseDQP() )150 Void TDecCu::decodeCtu( TComDataCU* pCtu, Bool& isLastCtuOfSliceSegment ) 151 { 152 if ( pCtu->getSlice()->getPPS()->getUseDQP() ) 140 153 { 141 154 setdQPFlag(true); 142 155 } 143 156 157 if ( pCtu->getSlice()->getUseChromaQpAdj() ) 158 { 159 setIsChromaQpAdjCoded(true); 160 } 161 144 162 // start from the top level CU 145 xDecodeCU( pcCU, 0, 0, ruiIsLast); 146 } 147 148 /** \param pcCU pointer of CU data 163 xDecodeCU( pCtu, 0, 0, isLastCtuOfSliceSegment); 164 } 165 166 /** 167 Decoding process for a CTU. 168 \param pCtu [in/out] pointer to CTU data structure 149 169 */ 150 Void TDecCu::decompressC U( TComDataCU* pcCU)151 { 152 #if ! H_3D_IV_MERGE153 xDecompressCU( p cCU, 0, 0 );170 Void TDecCu::decompressCtu( TComDataCU* pCtu ) 171 { 172 #if !NH_3D_IV_MERGE 173 xDecompressCU( pCtu, 0, 0 ); 154 174 #endif 155 175 } … … 159 179 // ==================================================================================================================== 160 180 161 /**decode end-of-slice flag 162 * \param pcCU 163 * \param uiAbsPartIdx 164 * \param uiDepth 165 * \returns Bool 166 */ 167 Bool TDecCu::xDecodeSliceEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth) 168 { 169 UInt uiIsLast; 170 TComPic* pcPic = pcCU->getPic(); 171 TComSlice * pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx()); 172 UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1); 173 UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples(); 174 UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples(); 175 UInt uiGranularityWidth = g_uiMaxCUWidth; 176 UInt uiPosX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; 177 UInt uiPosY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; 178 179 if(((uiPosX+pcCU->getWidth(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosX+pcCU->getWidth(uiAbsPartIdx)==uiWidth)) 180 &&((uiPosY+pcCU->getHeight(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosY+pcCU->getHeight(uiAbsPartIdx)==uiHeight))) 181 { 182 m_pcEntropyDecoder->decodeTerminatingBit( uiIsLast ); 181 //! decode end-of-slice flag 182 Bool TDecCu::xDecodeSliceEnd( TComDataCU* pcCU, UInt uiAbsPartIdx ) 183 { 184 UInt uiIsLastCtuOfSliceSegment; 185 186 if (pcCU->isLastSubCUOfCtu(uiAbsPartIdx)) 187 { 188 m_pcEntropyDecoder->decodeTerminatingBit( uiIsLastCtuOfSliceSegment ); 183 189 } 184 190 else 185 191 { 186 uiIsLast=0; 187 } 188 189 if(uiIsLast) 190 { 191 if(pcSlice->isNextSliceSegment()&&!pcSlice->isNextSlice()) 192 { 193 pcSlice->setSliceSegmentCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts); 194 } 195 else 196 { 197 pcSlice->setSliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts); 198 pcSlice->setSliceSegmentCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts); 199 } 200 } 201 202 return uiIsLast>0; 203 } 204 205 /** decode CU block recursively 206 * \param pcCU 207 * \param uiAbsPartIdx 208 * \param uiDepth 209 * \returns Void 210 */ 211 212 Void TDecCu::xDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast) 213 { 214 TComPic* pcPic = pcCU->getPic(); 215 UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1); 192 uiIsLastCtuOfSliceSegment=0; 193 } 194 195 return uiIsLastCtuOfSliceSegment>0; 196 } 197 198 //! decode CU block recursively 199 Void TDecCu::xDecodeCU( TComDataCU*const pcCU, const UInt uiAbsPartIdx, const UInt uiDepth, Bool &isLastCtuOfSliceSegment) 200 { 201 TComPic* pcPic = pcCU->getPic(); 202 const TComSPS &sps = pcPic->getPicSym()->getSPS(); 203 const TComPPS &pps = pcPic->getPicSym()->getPPS(); 204 const UInt maxCuWidth = sps.getMaxCUWidth(); 205 const UInt maxCuHeight= sps.getMaxCUHeight(); 206 UInt uiCurNumParts = pcPic->getNumPartitionsInCtu() >> (uiDepth<<1); 216 207 UInt uiQNumParts = uiCurNumParts>>2; 217 208 209 218 210 Bool bBoundary = false; 219 211 UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; 220 UInt uiRPelX = uiLPelX + ( g_uiMaxCUWidth>>uiDepth) - 1;212 UInt uiRPelX = uiLPelX + (maxCuWidth>>uiDepth) - 1; 221 213 UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; 222 UInt uiBPelY = uiTPelY + ( g_uiMaxCUHeight>>uiDepth) - 1;214 UInt uiBPelY = uiTPelY + (maxCuHeight>>uiDepth) - 1; 223 215 #if H_MV_ENC_DEC_TRAC 224 216 DTRACE_CU_S("=========== coding_quadtree ===========\n") 225 217 DTRACE_CU("x0", uiLPelX) 226 218 DTRACE_CU("x1", uiTPelY) 227 DTRACE_CU("log2CbSize", g_uiMaxCUWidth>>uiDepth)219 DTRACE_CU("log2CbSize", maxCuWidth>>uiDepth) 228 220 DTRACE_CU("cqtDepth" , uiDepth) 229 221 #endif 230 222 231 TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx()); 232 Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr(); 233 if((!bStartInCU) && ( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 223 if( ( uiRPelX < sps.getPicWidthInLumaSamples() ) && ( uiBPelY < sps.getPicHeightInLumaSamples() ) ) 234 224 { 235 225 m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); … … 239 229 bBoundary = true; 240 230 } 241 242 if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ) 231 if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() ) ) || bBoundary ) 243 232 { 244 233 UInt uiIdx = uiAbsPartIdx; 245 if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())234 if( uiDepth == pps.getMaxCuDQPDepth() && pps.getUseDQP()) 246 235 { 247 236 setdQPFlag(true); … … 249 238 } 250 239 240 if( uiDepth == pps.getPpsRangeExtension().getDiffCuChromaQpOffsetDepth() && pcCU->getSlice()->getUseChromaQpAdj() ) 241 { 242 setIsChromaQpAdjCoded(true); 243 } 244 251 245 for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ ) 252 246 { 253 247 uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; 254 248 uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; 255 256 Bool bSubInSlice = pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr(); 257 if ( bSubInSlice ) 258 { 259 if ( !ruiIsLast && ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) ) 260 { 261 xDecodeCU( pcCU, uiIdx, uiDepth+1, ruiIsLast ); 262 } 263 else 264 { 265 pcCU->setOutsideCUPart( uiIdx, uiDepth+1 ); 266 } 267 } 268 249 250 if ( !isLastCtuOfSliceSegment && ( uiLPelX < sps.getPicWidthInLumaSamples() ) && ( uiTPelY < sps.getPicHeightInLumaSamples() ) ) 251 { 252 xDecodeCU( pcCU, uiIdx, uiDepth+1, isLastCtuOfSliceSegment ); 253 } 254 else 255 { 256 pcCU->setOutsideCUPart( uiIdx, uiDepth+1 ); 257 } 258 269 259 uiIdx += uiQNumParts; 270 260 } 271 if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())261 if( uiDepth == pps.getMaxCuDQPDepth() && pps.getUseDQP()) 272 262 { 273 263 if ( getdQPFlag() ) 274 264 { 275 UInt uiQPSrcPartIdx; 276 if ( pcPic->getCU( pcCU->getAddr() )->getSliceSegmentStartCU(uiAbsPartIdx) != pcSlice->getSliceSegmentCurStartCUAddr() ) 277 { 278 uiQPSrcPartIdx = pcSlice->getSliceSegmentCurStartCUAddr() % pcPic->getNumPartInCU(); 279 } 280 else 281 { 282 uiQPSrcPartIdx = uiAbsPartIdx; 283 } 265 UInt uiQPSrcPartIdx = uiAbsPartIdx; 284 266 pcCU->setQPSubParts( pcCU->getRefQP( uiQPSrcPartIdx ), uiAbsPartIdx, uiDepth ); // set QP to default QP 285 267 } … … 287 269 return; 288 270 } 289 271 290 272 #if H_MV_ENC_DEC_TRAC 291 273 DTRACE_CU_S("=========== coding_unit ===========\n") … … 303 285 #endif 304 286 305 if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())287 if( uiDepth <= pps.getMaxCuDQPDepth() && pps.getUseDQP()) 306 288 { 307 289 setdQPFlag(true); 308 290 pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP 309 291 } 310 #if H_3D_NBDV292 #if NH_3D_NBDV 311 293 DisInfo DvInfo; 312 294 DvInfo.m_acNBDV.setZero(); 313 295 DvInfo.m_aVIdxCan = 0; 314 #if H_3D_NBDV_REF296 #if NH_3D_NBDV_REF 315 297 DvInfo.m_acDoNBDV.setZero(); 316 298 #endif 317 299 318 319 if(!pcCU->getSlice()->isIntra()) 320 { 321 #if H_3D_ARP && H_3D_IV_MERGE 322 if( pcCU->getSlice()->getIvResPredFlag() || pcCU->getSlice()->getIvMvPredFlag() ) 300 if(!pcCU->getSlice()->isIntra()) 301 { 302 #if NH_3D_ARP && NH_3D_IV_MERGE && NH_3D_VSP 303 if( pcCU->getSlice()->getIvResPredFlag() || pcCU->getSlice()->getIvMvPredFlag() || pcCU->getSlice()->getViewSynthesisPredFlag() ) 323 304 #else 305 #if NH_3D_IV_MERGE && NH_3D_VSP 306 if( pcCU->getSlice()->getIvMvPredFlag() || pcCU->getSlice()->getViewSynthesisPredFlag() ) 307 #else 308 #if NH_3D_ARP && NH_3D_VSP 309 if( pcCU->getSlice()->getIvResPredFlag() || pcCU->getSlice()->getViewSynthesisPredFlag() ) 310 #else 311 #if NH_3D_VSP 312 if( pcCU->getSlice()->getViewSynthesisPredFlag() ) 313 #else 324 314 #if H_3D_ARP 325 if( pcCU->getSlice()->get VPS()->getUseAdvRP(pcCU->getSlice()->getLayerId()) )315 if( pcCU->getSlice()->getIvResPredFlag( ) ) 326 316 #else 327 317 #if H_3D_IV_MERGE 328 318 if( pcCU->getSlice()->getVPS()->getIvMvPredFlag(pcCU->getSlice()->getLayerId()) ) 329 319 #else 320 #if NH_3D_DBBP 321 if( pcCU->getSlice()->getDepthBasedBlkPartFlag() ) 322 #else 330 323 if (0) 331 324 #endif 332 325 #endif 333 326 #endif 334 { 335 m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true ); 336 m_ppcCU[uiDepth]->copyDVInfoFrom( pcCU, uiAbsPartIdx); 327 #endif 328 #endif 329 #endif 330 #endif 331 { 332 m_ppcCU[uiDepth]->copyInterPredInfoFrom(pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true); 333 m_ppcCU[uiDepth]->copyDVInfoFrom(pcCU, uiAbsPartIdx); 337 334 PartSize ePartTemp = m_ppcCU[uiDepth]->getPartitionSize(0); 338 335 UChar cWidTemp = m_ppcCU[uiDepth]->getWidth(0); 339 336 UChar cHeightTemp = m_ppcCU[uiDepth]->getHeight(0); 340 m_ppcCU[uiDepth]->setWidth ( 0, pcCU->getSlice()->getSPS()->getMaxCUWidth ()/(1<<uiDepth));341 m_ppcCU[uiDepth]->setHeight ( 0, pcCU->getSlice()->getSPS()->getMaxCUHeight()/(1<<uiDepth));342 m_ppcCU[uiDepth]->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth);343 #if H_3D_IV_MERGE337 m_ppcCU[uiDepth]->setWidth (0, pcCU->getSlice()->getSPS()->getMaxCUWidth () / (1 << uiDepth)); 338 m_ppcCU[uiDepth]->setHeight(0, pcCU->getSlice()->getSPS()->getMaxCUHeight() / (1 << uiDepth)); 339 m_ppcCU[uiDepth]->setPartSizeSubParts(SIZE_2Nx2N, 0, uiDepth); 340 #if NH_3D_IV_MERGE 344 341 if( pcCU->getSlice()->getIsDepth()) 345 342 { … … 349 346 { 350 347 #endif 351 #if H_3D_NBDV_REF348 #if NH_3D_NBDV_REF 352 349 if( pcCU->getSlice()->getDepthBasedBlkPartFlag() ) //Notes from QC: please check the condition for DoNBDV. Remove this comment once it is done. 353 350 { … … 359 356 m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo); 360 357 } 361 #if H_3D_IV_MERGE358 #if NH_3D_IV_MERGE 362 359 } 363 360 #endif … … 372 369 } 373 370 #endif 374 375 371 pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth); 376 m_ppcCU[uiDepth]->setPartSizeSubParts( ePartTemp, 0, uiDepth);377 m_ppcCU[uiDepth]->setWidth ( 0, cWidTemp);378 m_ppcCU[uiDepth]->setHeight ( 0, cHeightTemp);372 m_ppcCU[uiDepth]->setPartSizeSubParts(ePartTemp, 0, uiDepth); 373 m_ppcCU[uiDepth]->setWidth(0, cWidTemp); 374 m_ppcCU[uiDepth]->setHeight(0, cHeightTemp); 379 375 } 380 376 } 381 377 #endif 382 if (pcCU->getSlice()->getPPS()->getTransquantBypassEnableFlag()) 378 379 if( uiDepth <= pps.getPpsRangeExtension().getDiffCuChromaQpOffsetDepth() && pcCU->getSlice()->getUseChromaQpAdj() ) 380 { 381 setIsChromaQpAdjCoded(true); 382 } 383 384 if (pps.getTransquantBypassEnableFlag()) 383 385 { 384 386 m_pcEntropyDecoder->decodeCUTransquantBypassFlag( pcCU, uiAbsPartIdx, uiDepth ); 385 387 } 386 388 387 389 // decode CU mode and the partition size 388 390 if( !pcCU->getSlice()->isIntra()) … … 390 392 m_pcEntropyDecoder->decodeSkipFlag( pcCU, uiAbsPartIdx, uiDepth ); 391 393 } 392 394 395 393 396 if( pcCU->isSkipped(uiAbsPartIdx) ) 394 397 { … … 400 403 m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); 401 404 m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); 402 #if H_3D_IV_MERGE405 #if NH_3D_IV_MERGE 403 406 m_ppcCU[uiDepth]->copyDVInfoFrom(pcCU, uiAbsPartIdx); 407 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists 408 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; 409 #else 410 #if NH_3D_MLC 404 411 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists 405 412 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; … … 408 415 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 409 416 #endif 417 #endif 410 418 Int numValidMergeCand = 0; 411 419 for( UInt ui = 0; ui < m_ppcCU[uiDepth]->getSlice()->getMaxNumMergeCand(); ++ui ) … … 415 423 m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, uiDepth ); 416 424 UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx); 417 #if H_3D_ARP425 #if NH_3D_ARP 418 426 m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth ); 419 427 #endif 420 #if H_3D_IC428 #if NH_3D_IC 421 429 m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 422 430 #endif 423 431 424 #if H_3D_VSP 432 433 #if NH_3D_VSP 425 434 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 426 435 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 427 #if H_3D_SPIVMP 436 #endif 437 #if NH_3D_SPIVMP 428 438 Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM]; 429 439 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); 430 440 TComMvField* pcMvFieldSP; 431 441 UChar* puhInterDirSP; 432 pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2]; 433 puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()]; 434 #endif 442 pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()*2]; 443 puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()]; 444 #endif 445 446 #if NH_3D_MLC 435 447 m_ppcCU[uiDepth]->initAvailableFlags(); 448 #endif 436 449 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 450 #if NH_3D_MLC 437 451 m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours 438 #if H_3D_SPIVMP452 #if NH_3D_SPIVMP 439 453 , pcMvFieldSP, puhInterDirSP 440 454 #endif 441 455 , numValidMergeCand, uiMergeIndex ); 442 456 443 m_ppcCU[uiDepth]->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag 444 #if H_3D_SPIVMP 457 m_ppcCU[uiDepth]->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours 458 #if NH_3D_VSP 459 , vspFlag 460 #endif 461 #if NH_3D_SPIVMP 445 462 , bSPIVMPFlag 446 463 #endif 447 464 , numValidMergeCand ); 465 #endif 466 #if NH_3D_VSP 448 467 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); 449 #else 450 #if H_3D 451 m_ppcCU[uiDepth]->initAvailableFlags(); 452 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 453 m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 454 #else 455 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 456 #endif 457 #endif 468 #endif 469 458 470 pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); 459 471 460 472 TComMv cTmpMv( 0, 0 ); 461 473 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 462 { 474 { 463 475 if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) 464 476 { … … 467 479 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); 468 480 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); 469 #if H_3D_VSP481 #if NH_3D_VSP 470 482 if( pcCU->getVSPFlag( uiAbsPartIdx ) != 0 ) 471 483 { … … 500 512 } 501 513 } 502 #if H_3D_SPIVMP514 #if NH_3D_SPIVMP 503 515 pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); 504 516 if (bSPIVMPFlag[uiMergeIndex]) … … 524 536 #endif 525 537 526 xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );527 #if H_3D_IV_MERGE538 xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, isLastCtuOfSliceSegment ); 539 #if NH_3D_IV_MERGE 528 540 xDecompressCU(pcCU, uiAbsPartIdx, uiDepth ); 529 541 #endif 542 530 543 return; 531 544 } 532 #if H_3D545 #if NH_3D_DIS 533 546 m_pcEntropyDecoder->decodeDIS( pcCU, uiAbsPartIdx, uiDepth ); 534 547 if(!pcCU->getDISFlag(uiAbsPartIdx)) 535 548 { 536 549 #endif 550 537 551 m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth ); 538 552 m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth ); … … 544 558 if(pcCU->getIPCMFlag(uiAbsPartIdx)) 545 559 { 546 #if H_3D_DIM_SDC560 #if NH_3D_SDC_INTRA 547 561 m_pcEntropyDecoder->decodeSDCFlag( pcCU, uiAbsPartIdx, uiDepth ); 548 562 #endif 549 xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );550 #if H_3D_IV_MERGE563 xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, isLastCtuOfSliceSegment ); 564 #if NH_3D_IV_MERGE 551 565 xDecompressCU(pcCU, uiAbsPartIdx, uiDepth ); 552 566 #endif … … 555 569 } 556 570 557 UInt uiCurrWidth = pcCU->getWidth ( uiAbsPartIdx );558 UInt uiCurrHeight = pcCU->getHeight( uiAbsPartIdx );559 560 571 // prediction mode ( Intra : direction mode, Inter : Mv, reference idx ) 561 572 m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]); … … 563 574 // Coefficient decoding 564 575 Bool bCodeDQP = getdQPFlag(); 565 m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, uiCurrWidth, uiCurrHeight, bCodeDQP ); 576 Bool isChromaQpAdjCoded = getIsChromaQpAdjCoded(); 577 m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, bCodeDQP, isChromaQpAdjCoded ); 578 setIsChromaQpAdjCoded( isChromaQpAdjCoded ); 566 579 setdQPFlag( bCodeDQP ); 567 #if H_3D568 } 569 #endif 570 xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );571 #if H_3D_IV_MERGE580 #if NH_3D_DIS 581 } 582 #endif 583 xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, isLastCtuOfSliceSegment ); 584 #if NH_3D_IV_MERGE 572 585 xDecompressCU(pcCU, uiAbsPartIdx, uiDepth ); 573 586 #endif 574 587 } 575 588 576 Void TDecCu::xFinishDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast)589 Void TDecCu::xFinishDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool &isLastCtuOfSliceSegment) 577 590 { 578 591 if( pcCU->getSlice()->getPPS()->getUseDQP()) … … 581 594 } 582 595 583 ruiIsLast = xDecodeSliceEnd( pcCU, uiAbsPartIdx, uiDepth); 584 } 585 586 Void TDecCu::xDecompressCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 587 { 588 TComPic* pcPic = pcCU->getPic(); 589 #if !H_3D_IV_MERGE 596 if (pcCU->getSlice()->getUseChromaQpAdj() && !getIsChromaQpAdjCoded()) 597 { 598 pcCU->setChromaQpAdjSubParts( pcCU->getCodedChromaQpAdj(), uiAbsPartIdx, uiDepth ); // set QP 599 } 600 601 isLastCtuOfSliceSegment = xDecodeSliceEnd( pcCU, uiAbsPartIdx ); 602 } 603 604 Void TDecCu::xDecompressCU( TComDataCU* pCtu, UInt uiAbsPartIdx, UInt uiDepth ) 605 { 606 TComPic* pcPic = pCtu->getPic(); 607 #if !NH_3D_IV_MERGE 608 TComSlice * pcSlice = pCtu->getSlice(); 609 const TComSPS &sps=*(pcSlice->getSPS()); 610 590 611 Bool bBoundary = false; 591 UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; 592 UInt uiRPelX = uiLPelX + (g_uiMaxCUWidth>>uiDepth) - 1; 593 UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; 594 UInt uiBPelY = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1; 595 596 UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1); 597 TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx()); 598 Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr(); 599 if(bStartInCU||( uiRPelX >= pcSlice->getSPS()->getPicWidthInLumaSamples() ) || ( uiBPelY >= pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 612 UInt uiLPelX = pCtu->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; 613 UInt uiRPelX = uiLPelX + (sps.getMaxCUWidth()>>uiDepth) - 1; 614 UInt uiTPelY = pCtu->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; 615 UInt uiBPelY = uiTPelY + (sps.getMaxCUHeight()>>uiDepth) - 1; 616 617 if( ( uiRPelX >= sps.getPicWidthInLumaSamples() ) || ( uiBPelY >= sps.getPicHeightInLumaSamples() ) ) 600 618 { 601 619 bBoundary = true; 602 620 } 603 621 604 if( ( ( uiDepth < p cCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth) ) || bBoundary )622 if( ( ( uiDepth < pCtu->getDepth( uiAbsPartIdx ) ) && ( uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() ) ) || bBoundary ) 605 623 { 606 624 UInt uiNextDepth = uiDepth + 1; 607 UInt uiQNumParts = p cCU->getTotalNumPart() >> (uiNextDepth<<1);625 UInt uiQNumParts = pCtu->getTotalNumPart() >> (uiNextDepth<<1); 608 626 UInt uiIdx = uiAbsPartIdx; 609 627 for ( UInt uiPartIdx = 0; uiPartIdx < 4; uiPartIdx++ ) 610 628 { 611 uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; 612 uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; 613 614 Bool binSlice = (pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr())&&(pcCU->getSCUAddr()+uiIdx<pcSlice->getSliceSegmentCurEndCUAddr()); 615 if(binSlice&&( uiLPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 616 { 617 xDecompressCU(pcCU, uiIdx, uiNextDepth ); 629 uiLPelX = pCtu->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; 630 uiTPelY = pCtu->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; 631 632 if( ( uiLPelX < sps.getPicWidthInLumaSamples() ) && ( uiTPelY < sps.getPicHeightInLumaSamples() ) ) 633 { 634 xDecompressCU(pCtu, uiIdx, uiNextDepth ); 618 635 } 619 636 … … 622 639 return; 623 640 } 624 #endif 641 #endif 625 642 // Residual reconstruction 626 643 m_ppcYuvResi[uiDepth]->clear(); 627 644 628 m_ppcCU[uiDepth]->copySubCU( p cCU, uiAbsPartIdx, uiDepth);645 m_ppcCU[uiDepth]->copySubCU( pCtu, uiAbsPartIdx ); 629 646 630 647 switch( m_ppcCU[uiDepth]->getPredictionMode(0) ) 631 648 { 632 case MODE_INTER:633 #if H_3D_DBBP649 case MODE_INTER: 650 #if NH_3D_DBBP 634 651 if( m_ppcCU[uiDepth]->getDBBPFlag(0) ) 635 652 { … … 639 656 { 640 657 #endif 641 #if H_3D_INTER_SDC658 #if NH_3D_SDC_INTER 642 659 if( m_ppcCU[uiDepth]->getSDCFlag( 0 ) ) 643 660 { … … 647 664 { 648 665 #endif 649 xReconInter( m_ppcCU[uiDepth], uiDepth ); 650 #if H_3D_INTER_SDC 651 } 652 #endif 653 #if H_3D_DBBP 654 } 655 #endif 656 break; 657 case MODE_INTRA: 658 #if H_3D 666 xReconInter( m_ppcCU[uiDepth], uiDepth ); 667 #if NH_3D_SDC_INTER 668 } 669 #endif 670 #if NH_3D_DBBP 671 } 672 #endif 673 break; 674 case MODE_INTRA: 675 #if NH_3D 676 #if NH_3D_DIS 659 677 if( m_ppcCU[uiDepth]->getDISFlag(0) ) 660 678 { 661 679 xReconDIS( m_ppcCU[uiDepth], 0, uiDepth ); 662 680 } 663 #if H_3D_DIM_SDC 681 #else 682 if(false ) 683 { 684 // xReconDIS( m_ppcCU[uiDepth], 0, uiDepth ); 685 } 686 #endif 687 #if NH_3D_SDC_INTRA 664 688 else if( m_ppcCU[uiDepth]->getSDCFlag(0) ) 665 689 { … … 670 694 #endif 671 695 xReconIntraQT( m_ppcCU[uiDepth], uiDepth ); 672 break; 673 default: 674 assert(0); 675 break; 676 } 696 break; 697 default: 698 assert(0); 699 break; 700 } 701 702 #if DEBUG_STRING 703 const PredMode predMode=m_ppcCU[uiDepth]->getPredictionMode(0); 704 if (DebugOptionList::DebugString_Structure.getInt()&DebugStringGetPredModeMask(predMode)) 705 { 706 PartSize eSize=m_ppcCU[uiDepth]->getPartitionSize(0); 707 std::ostream &ss(std::cout); 708 709 ss <<"###: " << (predMode==MODE_INTRA?"Intra ":"Inter ") << partSizeToString[eSize] << " CU at " << m_ppcCU[uiDepth]->getCUPelX() << ", " << m_ppcCU[uiDepth]->getCUPelY() << " width=" << UInt(m_ppcCU[uiDepth]->getWidth(0)) << std::endl; 710 } 711 #endif 712 677 713 if ( m_ppcCU[uiDepth]->isLosslessCoded(0) && (m_ppcCU[uiDepth]->getIPCMFlag(0) == false)) 678 714 { … … 685 721 Void TDecCu::xReconInter( TComDataCU* pcCU, UInt uiDepth ) 686 722 { 687 723 688 724 // inter prediction 689 725 m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] ); 690 726 727 #if DEBUG_STRING 728 const Int debugPredModeMask=DebugStringGetPredModeMask(MODE_INTER); 729 if (DebugOptionList::DebugString_Pred.getInt()&debugPredModeMask) 730 { 731 printBlockToStream(std::cout, "###inter-pred: ", *(m_ppcYuvReco[uiDepth])); 732 } 733 #endif 734 691 735 // inter recon 692 xDecodeInterTexture( pcCU, 0, uiDepth ); 693 736 xDecodeInterTexture( pcCU, uiDepth ); 737 738 #if DEBUG_STRING 739 if (DebugOptionList::DebugString_Resi.getInt()&debugPredModeMask) 740 { 741 printBlockToStream(std::cout, "###inter-resi: ", *(m_ppcYuvResi[uiDepth])); 742 } 743 #endif 744 694 745 // clip for only non-zero cbp case 695 if ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V )) )696 { 697 m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) );746 if ( pcCU->getQtRootCbf( 0) ) 747 { 748 m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ), pcCU->getSlice()->getSPS()->getBitDepths() ); 698 749 } 699 750 else … … 701 752 m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 )); 702 753 } 703 } 704 705 #if H_3D 754 #if DEBUG_STRING 755 if (DebugOptionList::DebugString_Reco.getInt()&debugPredModeMask) 756 { 757 printBlockToStream(std::cout, "###inter-reco: ", *(m_ppcYuvReco[uiDepth])); 758 } 759 #endif 760 761 } 762 763 #if NH_3D_DIS 706 764 Void TDecCu::xReconDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 707 765 { … … 711 769 TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth]; 712 770 713 UInt uiStride = pcRecoYuv->getStride ( );714 Pel* piReco = pcRecoYuv->get LumaAddr(uiAbsPartIdx );771 UInt uiStride = pcRecoYuv->getStride (COMPONENT_Y); 772 Pel* piReco = pcRecoYuv->getAddr( COMPONENT_Y, uiAbsPartIdx ); 715 773 716 774 717 775 AOF( uiWidth == uiHeight ); 718 776 AOF( uiAbsPartIdx == 0 ); 719 720 Bool bAboveAvail = false; 721 Bool bLeftAvail = false; 722 pcCU->getPattern()->initPattern ( pcCU, 0, uiAbsPartIdx ); 723 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, 724 m_pcPrediction->getPredicBuf (), 725 m_pcPrediction->getPredicBufWidth (), 726 m_pcPrediction->getPredicBufHeight (), 727 bAboveAvail, bLeftAvail 728 ); 777 778 TComTURecurse rTu(pcCU, 0); 779 const ChromaFormat chFmt = rTu.GetChromaFormat(); 729 780 730 781 if ( pcCU->getDISType(uiAbsPartIdx) == 0 ) 731 782 { 732 m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), VER_IDX, piReco, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 783 const Bool bUseFilteredPredictions=TComPrediction::filteringIntraReferenceSamples(COMPONENT_Y, VER_IDX, uiWidth, uiHeight, chFmt, pcCU->getSlice()->getSPS()->getSpsRangeExtension().getIntraSmoothingDisabledFlag()); 784 m_pcPrediction->initIntraPatternChType( rTu, COMPONENT_Y, bUseFilteredPredictions DEBUG_STRING_PASS_INTO(sTemp) ); 785 m_pcPrediction->predIntraAng( COMPONENT_Y, VER_IDX, 0 /* Decoder does not have an original image */, 0, piReco, uiStride, rTu, bUseFilteredPredictions ); 733 786 } 734 787 else if ( pcCU->getDISType(uiAbsPartIdx) == 1 ) 735 788 { 736 m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), HOR_IDX, piReco, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 789 const Bool bUseFilteredPredictions=TComPrediction::filteringIntraReferenceSamples(COMPONENT_Y, HOR_IDX, uiWidth, uiHeight, chFmt, pcCU->getSlice()->getSPS()->getSpsRangeExtension().getIntraSmoothingDisabledFlag()); 790 m_pcPrediction->initIntraPatternChType( rTu, COMPONENT_Y, bUseFilteredPredictions DEBUG_STRING_PASS_INTO(sTemp) ); 791 m_pcPrediction->predIntraAng( COMPONENT_Y, HOR_IDX, 0 /* Decoder does not have an original image */, 0, piReco, uiStride, rTu, bUseFilteredPredictions ); 737 792 } 738 793 else if ( pcCU->getDISType(uiAbsPartIdx) == 2 ) 739 794 { 740 Pel pSingleDepth = 1 << ( g_bitDepthY- 1 );795 Pel pSingleDepth = 1 << ( pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 1 ); 741 796 pcCU->getNeighDepth ( 0, 0, &pSingleDepth, 0 ); 742 797 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) … … 751 806 else if ( pcCU->getDISType(uiAbsPartIdx) == 3 ) 752 807 { 753 Pel pSingleDepth = 1 << ( g_bitDepthY- 1 );808 Pel pSingleDepth = 1 << ( pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 1 ); 754 809 pcCU->getNeighDepth ( 0, 0, &pSingleDepth, 1 ); 755 810 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) … … 764 819 765 820 // clear UV 766 UInt uiStrideC = pcRecoYuv->get CStride();767 Pel *pRecCb = pcRecoYuv->get CbAddr();768 Pel *pRecCr = pcRecoYuv->get CrAddr();821 UInt uiStrideC = pcRecoYuv->getStride(COMPONENT_Cb); 822 Pel *pRecCb = pcRecoYuv->getAddr(COMPONENT_Cb); 823 Pel *pRecCr = pcRecoYuv->getAddr(COMPONENT_Cr); 769 824 770 825 for (Int y=0; y<uiHeight/2; y++) … … 772 827 for (Int x=0; x<uiWidth/2; x++) 773 828 { 774 pRecCb[x] = 1<<( g_bitDepthC-1);775 pRecCr[x] = 1<<( g_bitDepthC-1);829 pRecCb[x] = 1<<(pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA)-1); 830 pRecCr[x] = 1<<(pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA)-1); 776 831 } 777 832 … … 781 836 } 782 837 #endif 783 #if H_3D_INTER_SDC838 #if NH_3D_SDC_INTER 784 839 Void TDecCu::xReconInterSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 785 840 { … … 792 847 Pel *pResi; 793 848 UInt uiPelX, uiPelY; 794 UInt uiResiStride = m_ppcYuvResi[uiDepth]->getStride(); 795 796 pResi = m_ppcYuvResi[uiDepth]->getLumaAddr( 0 ); 849 UInt uiResiStride = m_ppcYuvResi[uiDepth]->getStride( COMPONENT_Y ); 850 Int bitDepthC = pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA); 851 852 pResi = m_ppcYuvResi[uiDepth]->getAddr( COMPONENT_Y ); 797 853 for( uiPelY = 0; uiPelY < uiHeight; uiPelY++ ) 798 854 { … … 804 860 } 805 861 806 m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) );862 m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ), pcCU->getSlice()->getSPS()->getBitDepths() ); 807 863 808 864 // clear UV 809 UInt uiStrideC = m_ppcYuvReco[uiDepth]->get CStride();810 Pel *pRecCb = m_ppcYuvReco[uiDepth]->get CbAddr();811 Pel *pRecCr = m_ppcYuvReco[uiDepth]->get CrAddr();865 UInt uiStrideC = m_ppcYuvReco[uiDepth]->getStride( COMPONENT_Cb ); 866 Pel *pRecCb = m_ppcYuvReco[uiDepth]->getAddr( COMPONENT_Cb ); 867 Pel *pRecCr = m_ppcYuvReco[uiDepth]->getAddr( COMPONENT_Cr ); 812 868 813 869 for (Int y = 0; y < uiHeight/2; y++) … … 815 871 for (Int x = 0; x < uiWidth/2; x++) 816 872 { 817 pRecCb[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) );818 pRecCr[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) );873 pRecCb[x] = (Pel)( 1 << ( bitDepthC - 1 ) ); 874 pRecCr[x] = (Pel)( 1 << ( bitDepthC - 1 ) ); 819 875 } 820 876 … … 825 881 #endif 826 882 827 #if H_3D_DBBP883 #if NH_3D_DBBP 828 884 Void TDecCu::xReconInterDBBP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 829 885 { … … 831 887 AOF(!pcCU->getSlice()->isIntra()); 832 888 PartSize ePartSize = pcCU->getPartitionSize( 0 ); 889 890 Int bitDepthY = pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA); 833 891 834 892 // get collocated depth block … … 851 909 852 910 // first, extract the two sets of motion parameters 853 UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMax CUDepth() - uiDepth ) << 1 ) ) >> 4;911 UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uiDepth ) << 1 ) ) >> 4; 854 912 for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) 855 913 { … … 857 915 858 916 pDBBPTmpData->auhInterDir[uiSegment] = pcCU->getInterDir(uiPartAddr); 917 assert( pDBBPTmpData->auhInterDir[uiSegment] == 1 || pDBBPTmpData->auhInterDir[uiSegment] == 2 ); // only uni-prediction allowed 859 918 860 919 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) … … 864 923 } 865 924 925 #if NH_3D 866 926 AOF( pcCU->getARPW(uiPartAddr) == 0 ); 867 927 AOF( pcCU->getICFlag(uiPartAddr) == false ); 868 928 AOF( pcCU->getSPIVMPFlag(uiPartAddr) == false ); 869 929 AOF( pcCU->getVSPFlag(uiPartAddr) == 0 ); 930 #endif 870 931 } 871 932 … … 907 968 908 969 // reconstruct final prediction signal by combining both segments 909 m_pcPrediction->combineSegmentsWithMask(apSegPredYuv, m_ppcYuvReco[uiDepth], pMask, pcCU->getWidth(0), pcCU->getHeight(0), 0, ePartSize );970 m_pcPrediction->combineSegmentsWithMask(apSegPredYuv, m_ppcYuvReco[uiDepth], pMask, pcCU->getWidth(0), pcCU->getHeight(0), 0, ePartSize, bitDepthY); 910 971 911 972 // inter recon 912 xDecodeInterTexture( pcCU, 0,uiDepth );973 xDecodeInterTexture( pcCU, uiDepth ); 913 974 914 975 // clip for only non-zero cbp case 915 if ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V) ) )916 { 917 m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) );976 if ( ( pcCU->getCbf( 0, COMPONENT_Y ) ) || ( pcCU->getCbf( 0, COMPONENT_Cb ) ) || ( pcCU->getCbf(0, COMPONENT_Cr ) ) ) 977 { 978 m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ), pcCU->getSlice()->getSPS()->getBitDepths() ); 918 979 } 919 980 else … … 924 985 #endif 925 986 987 926 988 Void 927 TDecCu::xIntraRecLumaBlk( TComDataCU* pcCU, 928 UInt uiTrDepth, 929 UInt uiAbsPartIdx, 930 TComYuv* pcRecoYuv, 931 TComYuv* pcPredYuv, 932 TComYuv* pcResiYuv ) 933 { 934 UInt uiWidth = pcCU ->getWidth ( 0 ) >> uiTrDepth; 935 UInt uiHeight = pcCU ->getHeight ( 0 ) >> uiTrDepth; 936 UInt uiStride = pcRecoYuv->getStride (); 937 Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); 938 Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 939 Pel* piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); 940 941 UInt uiNumCoeffInc = ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ); 942 TCoeff* pcCoeff = pcCU->getCoeffY() + ( uiNumCoeffInc * uiAbsPartIdx ); 943 944 UInt uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); 945 946 UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 947 Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); 948 UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); 949 Bool useTransformSkip = pcCU->getTransformSkip(uiAbsPartIdx, TEXT_LUMA); 989 TDecCu::xIntraRecBlk( TComYuv* pcRecoYuv, 990 TComYuv* pcPredYuv, 991 TComYuv* pcResiYuv, 992 const ComponentID compID, 993 TComTU &rTu) 994 { 995 if (!rTu.ProcessComponentSection(compID)) 996 { 997 return; 998 } 999 const Bool bIsLuma = isLuma(compID); 1000 1001 1002 TComDataCU *pcCU = rTu.getCU(); 1003 const TComSPS &sps=*(pcCU->getSlice()->getSPS()); 1004 const UInt uiAbsPartIdx=rTu.GetAbsPartIdxTU(); 1005 1006 const TComRectangle &tuRect =rTu.getRect(compID); 1007 const UInt uiWidth = tuRect.width; 1008 const UInt uiHeight = tuRect.height; 1009 const UInt uiStride = pcRecoYuv->getStride (compID); 1010 Pel* piPred = pcPredYuv->getAddr( compID, uiAbsPartIdx ); 1011 const ChromaFormat chFmt = rTu.GetChromaFormat(); 1012 1013 if (uiWidth != uiHeight) 1014 { 1015 //------------------------------------------------ 1016 1017 //split at current level if dividing into square sub-TUs 1018 1019 TComTURecurse subTURecurse(rTu, false, TComTU::VERTICAL_SPLIT, true, compID); 1020 1021 //recurse further 1022 do 1023 { 1024 xIntraRecBlk(pcRecoYuv, pcPredYuv, pcResiYuv, compID, subTURecurse); 1025 } while (subTURecurse.nextSection(rTu)); 1026 1027 //------------------------------------------------ 1028 1029 return; 1030 } 1031 1032 const UInt uiChPredMode = pcCU->getIntraDir( toChannelType(compID), uiAbsPartIdx ); 1033 const UInt partsPerMinCU = 1<<(2*(sps.getMaxTotalCUDepth() - sps.getLog2DiffMaxMinCodingBlockSize())); 1034 const UInt uiChCodedMode = (uiChPredMode==DM_CHROMA_IDX && !bIsLuma) ? pcCU->getIntraDir(CHANNEL_TYPE_LUMA, getChromasCorrespondingPULumaIdx(uiAbsPartIdx, chFmt, partsPerMinCU)) : uiChPredMode; 1035 const UInt uiChFinalMode = ((chFmt == CHROMA_422) && !bIsLuma) ? g_chroma422IntraAngleMappingTable[uiChCodedMode] : uiChCodedMode; 1036 950 1037 //===== init availability pattern ===== 951 Bool bAboveAvail = false; 952 Bool bLeftAvail = false; 953 pcCU->getPattern()->initPattern ( pcCU, uiTrDepth, uiAbsPartIdx ); 954 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, 955 m_pcPrediction->getPredicBuf (), 956 m_pcPrediction->getPredicBufWidth (), 957 m_pcPrediction->getPredicBufHeight (), 958 bAboveAvail, bLeftAvail ); 959 1038 const Bool bUseFilteredPredictions=TComPrediction::filteringIntraReferenceSamples(compID, uiChFinalMode, uiWidth, uiHeight, chFmt, pcCU->getSlice()->getSPS()->getSpsRangeExtension().getIntraSmoothingDisabledFlag()); 1039 1040 #if DEBUG_STRING 1041 std::ostream &ss(std::cout); 1042 #endif 1043 1044 DEBUG_STRING_NEW(sTemp) 1045 m_pcPrediction->initIntraPatternChType( rTu, compID, bUseFilteredPredictions DEBUG_STRING_PASS_INTO(sTemp) ); 1046 1047 960 1048 //===== get prediction signal ===== 961 #if H_3D_DIM962 if( isDimMode( uiLumaPredMode ) )963 { 964 m_pcPrediction->predIntraLumaD epth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight );1049 #if NH_3D_DMM 1050 if( bIsLuma && isDmmMode( uiChFinalMode ) ) 1051 { 1052 m_pcPrediction->predIntraLumaDmm( pcCU, uiAbsPartIdx, getDmmType( uiChFinalMode ), piPred, uiStride, uiWidth, uiHeight ); 965 1053 } 966 1054 else 967 1055 { 968 1056 #endif 969 m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 970 #if H_3D_DIM 971 } 972 #endif 973 1057 m_pcPrediction->predIntraAng( compID, uiChFinalMode, 0 /* Decoder does not have an original image */, 0, piPred, uiStride, rTu, bUseFilteredPredictions ); 1058 #if NH_3D_DMM 1059 } 1060 #endif 1061 1062 #if DEBUG_STRING 1063 ss << sTemp; 1064 #endif 1065 1066 //===== inverse transform ===== 1067 Pel* piResi = pcResiYuv->getAddr( compID, uiAbsPartIdx ); 1068 TCoeff* pcCoeff = pcCU->getCoeff(compID) + rTu.getCoefficientOffset(compID);//( uiNumCoeffInc * uiAbsPartIdx ); 1069 1070 const QpParam cQP(*pcCU, compID); 1071 1072 1073 DEBUG_STRING_NEW(sDebug); 1074 #if DEBUG_STRING 1075 const Int debugPredModeMask=DebugStringGetPredModeMask(MODE_INTRA); 1076 std::string *psDebug=(DebugOptionList::DebugString_InvTran.getInt()&debugPredModeMask) ? &sDebug : 0; 1077 #endif 974 1078 #if H_3D 975 Bool useDltFlag = (isD imMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps());1079 Bool useDltFlag = (isDmmMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()); 976 1080 977 1081 if ( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth ) || useDltFlag ) 978 1082 #else 979 if ( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth ) ) 980 #endif 981 { 982 //===== inverse transform ===== 983 m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); 984 985 Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA]; 986 assert(scalingListType < SCALING_LIST_NUM); 987 m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkip ); 988 989 1083 if (pcCU->getCbf(uiAbsPartIdx, compID, rTu.GetTransformDepthRel()) != 0) 1084 #endif 1085 { 1086 m_pcTrQuant->invTransformNxN( rTu, compID, piResi, uiStride, pcCoeff, cQP DEBUG_STRING_PASS_INTO(psDebug) ); 1087 } 1088 else 1089 { 1090 for (UInt y = 0; y < uiHeight; y++) 1091 { 1092 for (UInt x = 0; x < uiWidth; x++) 1093 { 1094 piResi[(y * uiStride) + x] = 0; 1095 } 1096 } 1097 } 1098 1099 #if DEBUG_STRING 1100 if (psDebug) 1101 { 1102 ss << (*psDebug); 1103 } 1104 #endif 1105 990 1106 //===== reconstruction ===== 991 Pel* pPred = piPred; 992 Pel* pResi = piResi; 993 Pel* pReco = piReco; 994 Pel* pRecIPred = piRecIPred; 1107 const UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride(compID); 1108 1109 const Bool useCrossComponentPrediction = isChroma(compID) && (pcCU->getCrossComponentPredictionAlpha(uiAbsPartIdx, compID) != 0); 1110 const Pel* pResiLuma = pcResiYuv->getAddr( COMPONENT_Y, uiAbsPartIdx ); 1111 const Int strideLuma = pcResiYuv->getStride( COMPONENT_Y ); 1112 1113 Pel* pPred = piPred; 1114 Pel* pResi = piResi; 1115 Pel* pReco = pcRecoYuv->getAddr( compID, uiAbsPartIdx ); 1116 Pel* pRecIPred = pcCU->getPic()->getPicYuvRec()->getAddr( compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiAbsPartIdx ); 1117 1118 1119 #if DEBUG_STRING 1120 const Bool bDebugPred=((DebugOptionList::DebugString_Pred.getInt()&debugPredModeMask) && DEBUG_STRING_CHANNEL_CONDITION(compID)); 1121 const Bool bDebugResi=((DebugOptionList::DebugString_Resi.getInt()&debugPredModeMask) && DEBUG_STRING_CHANNEL_CONDITION(compID)); 1122 const Bool bDebugReco=((DebugOptionList::DebugString_Reco.getInt()&debugPredModeMask) && DEBUG_STRING_CHANNEL_CONDITION(compID)); 1123 if (bDebugPred || bDebugResi || bDebugReco) 1124 { 1125 ss << "###: " << "CompID: " << compID << " pred mode (ch/fin): " << uiChPredMode << "/" << uiChFinalMode << " absPartIdx: " << rTu.GetAbsPartIdxTU() << std::endl; 1126 } 1127 #endif 1128 1129 const Int clipbd = sps.getBitDepth(toChannelType(compID)); 1130 #if O0043_BEST_EFFORT_DECODING 1131 const Int bitDepthDelta = sps.getStreamBitDepth(toChannelType(compID)) - clipbd; 1132 #endif 1133 1134 if( useCrossComponentPrediction ) 1135 { 1136 TComTrQuant::crossComponentPrediction( rTu, compID, pResiLuma, piResi, piResi, uiWidth, uiHeight, strideLuma, uiStride, uiStride, true ); 1137 } 1138 995 1139 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 996 1140 { 1141 #if DEBUG_STRING 1142 if (bDebugPred || bDebugResi || bDebugReco) 1143 { 1144 ss << "###: "; 1145 } 1146 1147 if (bDebugPred) 1148 { 1149 ss << " - pred: "; 1150 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 1151 { 1152 ss << pPred[ uiX ] << ", "; 1153 } 1154 } 1155 if (bDebugResi) 1156 { 1157 ss << " - resi: "; 1158 } 1159 #endif 1160 997 1161 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 998 1162 { 999 pReco [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] ); 1163 #if DEBUG_STRING 1164 if (bDebugResi) 1165 { 1166 ss << pResi[ uiX ] << ", "; 1167 } 1168 #endif 1169 #if O0043_BEST_EFFORT_DECODING 1170 pReco [ uiX ] = ClipBD( rightShiftEvenRounding<Pel>(pPred[ uiX ] + pResi[ uiX ], bitDepthDelta), clipbd ); 1171 #else 1172 pReco [ uiX ] = ClipBD( pPred[ uiX ] + pResi[ uiX ], clipbd ); 1173 #endif 1000 1174 pRecIPred[ uiX ] = pReco[ uiX ]; 1001 1175 } 1176 #if DEBUG_STRING 1177 if (bDebugReco) 1178 { 1179 ss << " - reco: "; 1180 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 1181 { 1182 ss << pReco[ uiX ] << ", "; 1183 } 1184 } 1185 1186 if (bDebugPred || bDebugResi || bDebugReco) 1187 { 1188 ss << "\n"; 1189 } 1190 #endif 1002 1191 pPred += uiStride; 1003 1192 pResi += uiStride; … … 1006 1195 } 1007 1196 } 1008 else1009 {1010 //===== reconstruction =====1011 Pel* pPred = piPred;1012 Pel* pReco = piReco;1013 Pel* pRecIPred = piRecIPred;1014 for ( Int y = 0; y < uiHeight; y++ )1015 {1016 for ( Int x = 0; x < uiWidth; x++ )1017 {1018 pReco [ x ] = pPred[ x ];1019 pRecIPred[ x ] = pReco[ x ];1020 }1021 pPred += uiStride;1022 pReco += uiStride;1023 pRecIPred += uiRecIPredStride;1024 }1025 }1026 }1027 1028 1029 Void1030 TDecCu::xIntraRecChromaBlk( TComDataCU* pcCU,1031 UInt uiTrDepth,1032 UInt uiAbsPartIdx,1033 TComYuv* pcRecoYuv,1034 TComYuv* pcPredYuv,1035 TComYuv* pcResiYuv,1036 UInt uiChromaId )1037 {1038 UInt uiFullDepth = pcCU->getDepth( 0 ) + uiTrDepth;1039 UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiFullDepth ] + 2;1040 1041 if( uiLog2TrSize == 2 )1042 {1043 assert( uiTrDepth > 0 );1044 uiTrDepth--;1045 UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth( 0 ) + uiTrDepth ) << 1 );1046 Bool bFirstQ = ( ( uiAbsPartIdx % uiQPDiv ) == 0 );1047 if( !bFirstQ )1048 {1049 return;1050 }1051 }1052 1053 TextType eText = ( uiChromaId > 0 ? TEXT_CHROMA_V : TEXT_CHROMA_U );1054 UInt uiWidth = pcCU ->getWidth ( 0 ) >> ( uiTrDepth + 1 );1055 UInt uiHeight = pcCU ->getHeight ( 0 ) >> ( uiTrDepth + 1 );1056 UInt uiStride = pcRecoYuv->getCStride ();1057 Pel* piReco = ( uiChromaId > 0 ? pcRecoYuv->getCrAddr( uiAbsPartIdx ) : pcRecoYuv->getCbAddr( uiAbsPartIdx ) );1058 Pel* piPred = ( uiChromaId > 0 ? pcPredYuv->getCrAddr( uiAbsPartIdx ) : pcPredYuv->getCbAddr( uiAbsPartIdx ) );1059 Pel* piResi = ( uiChromaId > 0 ? pcResiYuv->getCrAddr( uiAbsPartIdx ) : pcResiYuv->getCbAddr( uiAbsPartIdx ) );1060 1061 UInt uiNumCoeffInc = ( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ) ) >> 2;1062 TCoeff* pcCoeff = ( uiChromaId > 0 ? pcCU->getCoeffCr() : pcCU->getCoeffCb() ) + ( uiNumCoeffInc * uiAbsPartIdx );1063 1064 UInt uiChromaPredMode = pcCU->getChromaIntraDir( 0 );1065 1066 UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx;1067 Pel* piRecIPred = ( uiChromaId > 0 ? pcCU->getPic()->getPicYuvRec()->getCrAddr( pcCU->getAddr(), uiZOrder ) : pcCU->getPic()->getPicYuvRec()->getCbAddr( pcCU->getAddr(), uiZOrder ) );1068 UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getCStride();1069 Bool useTransformSkipChroma = pcCU->getTransformSkip(uiAbsPartIdx,eText);1070 //===== init availability pattern =====1071 Bool bAboveAvail = false;1072 Bool bLeftAvail = false;1073 pcCU->getPattern()->initPattern ( pcCU, uiTrDepth, uiAbsPartIdx );1074 1075 pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth,1076 m_pcPrediction->getPredicBuf (),1077 m_pcPrediction->getPredicBufWidth (),1078 m_pcPrediction->getPredicBufHeight (),1079 bAboveAvail, bLeftAvail );1080 Int* pPatChroma = ( uiChromaId > 0 ? pcCU->getPattern()->getAdiCrBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) : pcCU->getPattern()->getAdiCbBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) );1081 1082 //===== get prediction signal =====1083 {1084 if( uiChromaPredMode == DM_CHROMA_IDX )1085 {1086 uiChromaPredMode = pcCU->getLumaIntraDir( 0 );1087 #if H_3D_DIM1088 mapDepthModeToIntraDir( uiChromaPredMode );1089 #endif1090 }1091 m_pcPrediction->predIntraChromaAng( pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );1092 }1093 1094 if ( pcCU->getCbf( uiAbsPartIdx, eText, uiTrDepth ) )1095 {1096 //===== inverse transform =====1097 Int curChromaQpOffset;1098 if(eText == TEXT_CHROMA_U)1099 {1100 curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();1101 }1102 else1103 {1104 curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();1105 }1106 m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );1107 1108 Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText];1109 assert(scalingListType < SCALING_LIST_NUM);1110 m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkipChroma );1111 1112 //===== reconstruction =====1113 Pel* pPred = piPred;1114 Pel* pResi = piResi;1115 Pel* pReco = piReco;1116 Pel* pRecIPred = piRecIPred;1117 for( UInt uiY = 0; uiY < uiHeight; uiY++ )1118 {1119 for( UInt uiX = 0; uiX < uiWidth; uiX++ )1120 {1121 pReco [ uiX ] = ClipC( pPred[ uiX ] + pResi[ uiX ] );1122 pRecIPred[ uiX ] = pReco[ uiX ];1123 }1124 pPred += uiStride;1125 pResi += uiStride;1126 pReco += uiStride;1127 pRecIPred += uiRecIPredStride;1128 }1129 }1130 else1131 {1132 //===== reconstruction =====1133 Pel* pPred = piPred;1134 Pel* pReco = piReco;1135 Pel* pRecIPred = piRecIPred;1136 for ( Int y = 0; y < uiHeight; y++ )1137 {1138 for ( Int x = 0; x < uiWidth; x++ )1139 {1140 pReco [ x ] = pPred[ x ];1141 pRecIPred[ x ] = pReco[ x ];1142 }1143 pPred += uiStride;1144 pReco += uiStride;1145 pRecIPred += uiRecIPredStride;1146 }1147 }1148 }1149 1150 1197 1151 1198 Void 1152 1199 TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiDepth ) 1153 1200 { 1154 UInt uiInitTrDepth = ( pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1 );1155 UInt uiNumPart = pcCU->getNumPartitions();1156 UInt uiNumQParts = pcCU->getTotalNumPart() >> 2;1157 1158 1201 if (pcCU->getIPCMFlag(0)) 1159 1202 { … … 1161 1204 return; 1162 1205 } 1163 1164 for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ ) 1165 { 1166 xIntraLumaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] ); 1167 } 1168 1169 for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ ) 1170 { 1171 xIntraChromaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] ); 1172 } 1173 1174 } 1175 1176 #if H_3D_DIM_SDC 1206 const UInt numChType = pcCU->getPic()->getChromaFormat()!=CHROMA_400 ? 2 : 1; 1207 for (UInt chType=CHANNEL_TYPE_LUMA; chType<numChType; chType++) 1208 { 1209 const ChannelType chanType=ChannelType(chType); 1210 const Bool NxNPUHas4Parts = ::isChroma(chanType) ? enable4ChromaPUsInIntraNxNCU(pcCU->getPic()->getChromaFormat()) : true; 1211 const UInt uiInitTrDepth = ( pcCU->getPartitionSize(0) != SIZE_2Nx2N && NxNPUHas4Parts ? 1 : 0 ); 1212 1213 TComTURecurse tuRecurseCU(pcCU, 0); 1214 TComTURecurse tuRecurseWithPU(tuRecurseCU, false, (uiInitTrDepth==0)?TComTU::DONT_SPLIT : TComTU::QUAD_SPLIT); 1215 1216 do 1217 { 1218 xIntraRecQT( m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], chanType, tuRecurseWithPU ); 1219 } while (tuRecurseWithPU.nextSection(tuRecurseCU)); 1220 } 1221 } 1222 1223 #if NH_3D_SDC_INTRA 1177 1224 Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 1178 1225 { 1179 UInt uiWidth = pcCU->getWidth ( 0 );1180 UInt uiHeight = pcCU->getHeight ( 0 );1181 TComWedgelet* dmm4SegmentationOrg = new TComWedgelet( uiWidth, uiHeight );1182 UInt numParts = 1;1183 UInt sdcDepth = 0;1184 1226 TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth]; 1185 1227 TComYuv* pcPredYuv = m_ppcYuvReco[uiDepth]; 1186 1228 TComYuv* pcResiYuv = m_ppcYuvResi[uiDepth]; 1187 1229 1188 UInt uiStride = 0; 1189 Pel* piReco; 1190 Pel* piPred; 1191 Pel* piResi; 1192 1193 UInt uiZOrder; 1194 Pel* piRecIPred; 1195 UInt uiRecIPredStride; 1196 1197 UInt uiLumaPredMode = 0; 1198 1199 if ((uiWidth >> pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize()) > 1) 1200 { 1201 numParts = uiWidth * uiWidth >> (2 * pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize()); 1202 sdcDepth = g_aucConvertToBit[uiWidth] + 2 - pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize(); 1203 uiWidth = uiHeight = (1 << pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize()); 1204 } 1205 1206 for ( Int i = 0; i < numParts; i++ ) 1207 { 1208 uiStride = pcRecoYuv->getStride (); 1209 piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); 1210 piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 1211 piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); 1212 1213 uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 1214 piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); 1215 uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); 1216 1217 uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); 1218 1219 AOF( uiWidth == uiHeight ); 1220 1221 //===== init availability pattern ===== 1222 Bool bAboveAvail = false; 1223 Bool bLeftAvail = false; 1224 1225 pcCU->getPattern()->initPattern ( pcCU, sdcDepth, uiAbsPartIdx ); 1226 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, sdcDepth, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail ); 1227 1228 TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight ); 1229 //===== get prediction signal ===== 1230 if( isDimMode( uiLumaPredMode ) ) 1231 { 1232 m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, false, dmm4Segmentation ); 1233 Bool* dmm4PatternSplit = dmm4Segmentation->getPattern(); 1234 Bool* dmm4PatternOrg = dmm4SegmentationOrg->getPattern(); 1235 for( UInt k = 0; k < (uiWidth*uiHeight); k++ ) 1236 { 1237 dmm4PatternOrg[k+(uiAbsPartIdx<<4)] = dmm4PatternSplit[k]; 1238 } 1239 } 1240 else 1241 { 1242 m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 1243 } 1244 1245 if ( numParts > 1 ) 1246 { 1247 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 1248 { 1249 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 1250 { 1251 piReco [ uiX ] = ClipY( piPred[ uiX ] ); 1252 piRecIPred [ uiX ] = piReco[ uiX ]; 1253 } 1254 piPred += uiStride; 1255 piReco += uiStride; 1256 piRecIPred += uiRecIPredStride; 1257 } 1258 } 1259 uiAbsPartIdx += ( (uiWidth * uiWidth) >> 4 ); 1260 dmm4Segmentation->destroy(); delete dmm4Segmentation; 1261 } 1262 uiAbsPartIdx = 0; 1263 1264 if ( numParts > 1 ) 1265 { 1266 uiWidth = pcCU->getWidth( 0 ); 1267 uiHeight = pcCU->getHeight( 0 ); 1268 } 1269 piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); 1270 piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 1271 piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); 1272 uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 1273 piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); 1274 uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); 1275 // number of segments depends on prediction mode 1276 UInt uiNumSegments = 1; 1230 UInt uiWidth = pcCU->getWidth ( 0 ); 1231 UInt uiHeight = pcCU->getHeight( 0 ); 1232 UInt uiLumaPredMode = pcCU->getIntraDir( CHANNEL_TYPE_LUMA, uiAbsPartIdx ); 1233 const Int bitDepthY = pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA); 1234 const TComSPS &sps = *(pcCU->getSlice()->getSPS()); 1235 const ChromaFormat chFmt = pcCU->getPic()->getChromaFormat(); 1236 1237 UInt sdcDepth = 0; 1238 UInt uiStride; 1239 Pel* piReco; 1240 Pel* piPred; 1241 Pel* piResi; 1242 1243 Pel* piRecIPred; 1244 UInt uiRecIPredStride; 1245 1246 Pel apDCPredValues[2]; 1247 UInt uiNumSegments; 1248 1277 1249 Bool* pbMask = NULL; 1278 1250 UInt uiMaskStride = 0; 1279 1280 if( getDimType( uiLumaPredMode ) == DMM1_IDX ) 1281 { 1282 Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx); 1283 1284 WedgeList* pacWedgeList = pcCU->isDMM1UpscaleMode(uiWidth) ? &g_dmmWedgeLists[(g_aucConvertToBit[pcCU->getDMM1BasePatternWidth(uiWidth)])] : &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])]; 1285 TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx )); 1286 1287 uiNumSegments = 2; 1288 1289 pbMask = pcCU->isDMM1UpscaleMode( uiWidth ) ? pcWedgelet->getScaledPattern(uiWidth) : pcWedgelet->getPattern(); 1290 uiMaskStride = pcCU->isDMM1UpscaleMode( uiWidth ) ? uiWidth : pcWedgelet->getStride(); 1291 } 1292 if( getDimType( uiLumaPredMode ) == DMM4_IDX ) 1293 { 1294 uiNumSegments = 2; 1295 pbMask = dmm4SegmentationOrg->getPattern(); 1296 uiMaskStride = dmm4SegmentationOrg->getStride(); 1297 } 1298 // get DC prediction for each segment 1299 Pel apDCPredValues[2]; 1300 if ( getDimType( uiLumaPredMode ) == DMM1_IDX || getDimType( uiLumaPredMode ) == DMM4_IDX ) 1301 { 1302 apDCPredValues[0] = pcCU->getDmmPredictor( 0 ); 1303 apDCPredValues[1] = pcCU->getDmmPredictor( 1 ); 1304 } 1305 else 1306 { 1307 m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode); 1308 } 1251 1252 #if NH_3D_DMM 1253 if( isDmmMode( uiLumaPredMode ) ) 1254 { 1255 assert( uiWidth == uiHeight ); 1256 assert( uiWidth >= DMM_MIN_SIZE && uiWidth <= DMM_MAX_SIZE ); 1257 assert( !((uiWidth >> pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize()) > 1) ); 1258 1259 uiNumSegments = 2; 1260 1261 uiStride = pcRecoYuv->getStride( COMPONENT_Y ); 1262 piReco = pcRecoYuv->getAddr ( COMPONENT_Y, uiAbsPartIdx ); 1263 piPred = pcPredYuv->getAddr ( COMPONENT_Y, uiAbsPartIdx ); 1264 piResi = pcResiYuv->getAddr ( COMPONENT_Y, uiAbsPartIdx ); 1265 1266 piRecIPred = pcCU->getPic()->getPicYuvRec()->getAddr ( COMPONENT_Y, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiAbsPartIdx ); 1267 uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride( COMPONENT_Y ); 1268 1269 //===== init availability pattern ===== 1270 TComTURecurse tuRecurseCU(pcCU, 0); 1271 TComTURecurse tuRecurseWithPU(tuRecurseCU, false, TComTU::DONT_SPLIT); 1272 1273 m_pcPrediction->initIntraPatternChType( tuRecurseWithPU, COMPONENT_Y, false DEBUG_STRING_PASS_INTO(sTemp) ); 1274 1275 // get partition 1276 pbMask = new Bool[ uiWidth*uiHeight ]; 1277 uiMaskStride = uiWidth; 1278 switch( getDmmType( uiLumaPredMode ) ) 1279 { 1280 case( DMM1_IDX ): { (getWedgeListScaled( uiWidth )->at( pcCU->getDmm1WedgeTabIdx( uiAbsPartIdx ) )).getPatternScaledCopy( uiWidth, pbMask ); } break; 1281 case( DMM4_IDX ): { m_pcPrediction->predContourFromTex( pcCU, uiAbsPartIdx, uiWidth, uiHeight, pbMask ); } break; 1282 default: assert(0); 1283 } 1284 1285 // get predicted partition values 1286 Pel predDC1 = 0, predDC2 = 0; 1287 m_pcPrediction->predBiSegDCs( pcCU, uiAbsPartIdx, uiWidth, uiHeight, pbMask, uiMaskStride, predDC1, predDC2 ); 1288 1289 // set prediction signal 1290 Pel* pDst = piPred; 1291 m_pcPrediction->assignBiSegDCs( pDst, uiStride, pbMask, uiMaskStride, predDC1, predDC2 ); 1292 apDCPredValues[0] = predDC1; 1293 apDCPredValues[1] = predDC2; 1294 } 1295 else // regular HEVC intra modes 1296 { 1297 #endif 1298 uiNumSegments = 1; 1299 1300 if( ( uiWidth >> pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) > 1 ) 1301 { 1302 sdcDepth = g_aucConvertToBit[uiWidth] + 2 - pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize(); 1303 } 1304 1305 //===== loop over partitions ===== 1306 TComTURecurse tuRecurseCU(pcCU, 0); 1307 TComTURecurse tuRecurseWithPU(tuRecurseCU, false, (sdcDepth==0)?TComTU::DONT_SPLIT:TComTU::QUAD_SPLIT); 1308 1309 do 1310 { 1311 const TComRectangle &puRect = tuRecurseWithPU.getRect(COMPONENT_Y); 1312 const UInt uiAbsPartIdxTU = tuRecurseWithPU.GetAbsPartIdxTU(); 1313 1314 Pel* piPredTU = pcPredYuv->getAddr ( COMPONENT_Y, uiAbsPartIdxTU ); 1315 UInt uiStrideTU = pcPredYuv->getStride( COMPONENT_Y ); 1316 1317 Pel* piRecIPredTU = pcCU->getPic()->getPicYuvRec()->getAddr( COMPONENT_Y, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiAbsPartIdxTU ); 1318 UInt uiRecIPredStrideTU = pcCU->getPic()->getPicYuvRec()->getStride(COMPONENT_Y); 1319 1320 const Bool bUseFilter = TComPrediction::filteringIntraReferenceSamples(COMPONENT_Y, uiLumaPredMode, puRect.width, puRect.height, chFmt, sps.getSpsRangeExtension().getIntraSmoothingDisabledFlag()); 1321 1322 //===== init pattern for luma prediction ===== 1323 1324 m_pcPrediction->initIntraPatternChType( tuRecurseWithPU, COMPONENT_Y, bUseFilter DEBUG_STRING_PASS_INTO(sTemp) ); 1325 1326 m_pcPrediction->predIntraAng( COMPONENT_Y, uiLumaPredMode, NULL, uiStrideTU, piPredTU, uiStrideTU, tuRecurseWithPU, bUseFilter ); 1327 1328 // copy for prediction of next part 1329 for( UInt uiY = 0; uiY < puRect.height; uiY++ ) 1330 { 1331 for( UInt uiX = 0; uiX < puRect.width; uiX++ ) 1332 { 1333 piPredTU [ uiX ] = ClipBD( piPredTU[ uiX ], bitDepthY ); 1334 piRecIPredTU [ uiX ] = piPredTU[ uiX ]; 1335 } 1336 piPredTU += uiStrideTU; 1337 piRecIPredTU += uiRecIPredStrideTU; 1338 } 1339 1340 1341 } while (tuRecurseWithPU.nextSection(tuRecurseCU)); 1342 1343 // reset to full block 1344 uiWidth = pcCU->getWidth( 0 ); 1345 uiHeight = pcCU->getHeight( 0 ); 1346 1347 uiStride = pcRecoYuv->getStride( COMPONENT_Y ); 1348 piReco = pcRecoYuv->getAddr ( COMPONENT_Y, uiAbsPartIdx ); 1349 piPred = pcPredYuv->getAddr ( COMPONENT_Y, uiAbsPartIdx ); 1350 piResi = pcResiYuv->getAddr ( COMPONENT_Y, uiAbsPartIdx ); 1351 1352 piRecIPred = pcCU->getPic()->getPicYuvRec()->getAddr ( COMPONENT_Y, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiAbsPartIdx ); 1353 uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride( COMPONENT_Y ); 1354 1355 m_pcPrediction->predConstantSDC( piPred, uiStride, uiWidth, apDCPredValues[0] ); apDCPredValues[1] = 0; 1356 #if NH_3D_DMM 1357 } 1358 #endif 1309 1359 1310 1360 // reconstruct residual based on mask + DC residuals … … 1312 1362 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ ) 1313 1363 { 1314 #if H_3D_DIM_DLT1364 #if NH_3D_DLT 1315 1365 Pel pPredIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); 1316 1366 Pel pResiIdx = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); … … 1339 1389 Pel pResiDC = apDCResiValues[ucSegment]; 1340 1390 1341 pReco [ uiX ] = Clip Y( pPred[ uiX ] + pResiDC);1391 pReco [ uiX ] = ClipBD( pPred[ uiX ] + pResiDC, bitDepthY ); 1342 1392 pRecIPred[ uiX ] = pReco[ uiX ]; 1343 1393 } … … 1349 1399 } 1350 1400 1351 // clear UV1352 UInt uiStrideC = pcPredYuv->get CStride();1353 Pel *pRecCb = pcPredYuv->get CbAddr();1354 Pel *pRecCr = pcPredYuv->get CrAddr();1401 // clear chroma 1402 UInt uiStrideC = pcPredYuv->getStride( COMPONENT_Cb ); 1403 Pel *pRecCb = pcPredYuv->getAddr ( COMPONENT_Cb, uiAbsPartIdx ); 1404 Pel *pRecCr = pcPredYuv->getAddr ( COMPONENT_Cr, uiAbsPartIdx ); 1355 1405 1356 1406 for (Int y=0; y<uiHeight/2; y++) … … 1365 1415 pRecCr += uiStrideC; 1366 1416 } 1367 dmm4SegmentationOrg->destroy(); delete dmm4SegmentationOrg; 1368 }1369 #endif 1370 1371 /** Function for deriving recontructed PU/CU Luma sample with QTree structure 1372 * \param pcCU pointer of current CU 1373 * \param uiTrDepth current tranform split depth 1374 * \param uiAbsPartIdx part index 1417 #if NH_3D_DMM 1418 if( pbMask ) { delete[] pbMask; } 1419 #endif 1420 } 1421 #endif 1422 1423 1424 /** Function for deriving reconstructed PU/CU chroma samples with QTree structure 1375 1425 * \param pcRecoYuv pointer to reconstructed sample arrays 1376 1426 * \param pcPredYuv pointer to prediction sample arrays 1377 1427 * \param pcResiYuv pointer to residue sample arrays 1378 * 1379 \ This function dervies recontructed PU/CU Luma sample with recursive QTree structure 1428 * \param chType texture channel type (luma/chroma) 1429 * \param rTu reference to transform data 1430 * 1431 \ This function derives reconstructed PU/CU chroma samples with QTree recursive structure 1380 1432 */ 1433 1381 1434 Void 1382 TDecCu::xIntraLumaRecQT( TComDataCU* pcCU, 1383 UInt uiTrDepth, 1384 UInt uiAbsPartIdx, 1385 TComYuv* pcRecoYuv, 1386 TComYuv* pcPredYuv, 1387 TComYuv* pcResiYuv ) 1388 { 1389 UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; 1435 TDecCu::xIntraRecQT(TComYuv* pcRecoYuv, 1436 TComYuv* pcPredYuv, 1437 TComYuv* pcResiYuv, 1438 const ChannelType chType, 1439 TComTU &rTu) 1440 { 1441 UInt uiTrDepth = rTu.GetTransformDepthRel(); 1442 TComDataCU *pcCU = rTu.getCU(); 1443 UInt uiAbsPartIdx = rTu.GetAbsPartIdxTU(); 1390 1444 UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); 1391 1445 if( uiTrMode == uiTrDepth ) 1392 1446 { 1393 xIntraRecLumaBlk ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv ); 1447 if (isLuma(chType)) 1448 { 1449 xIntraRecBlk( pcRecoYuv, pcPredYuv, pcResiYuv, COMPONENT_Y, rTu ); 1450 } 1451 else 1452 { 1453 const UInt numValidComp=getNumberValidComponents(rTu.GetChromaFormat()); 1454 for(UInt compID=COMPONENT_Cb; compID<numValidComp; compID++) 1455 { 1456 xIntraRecBlk( pcRecoYuv, pcPredYuv, pcResiYuv, ComponentID(compID), rTu ); 1457 } 1458 } 1394 1459 } 1395 1460 else 1396 1461 { 1397 UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); 1398 for( UInt uiPart = 0; uiPart < 4; uiPart++ ) 1399 { 1400 xIntraLumaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); 1401 } 1402 } 1403 } 1404 1405 /** Function for deriving recontructed PU/CU chroma samples with QTree structure 1406 * \param pcCU pointer of current CU 1407 * \param uiTrDepth current tranform split depth 1408 * \param uiAbsPartIdx part index 1409 * \param pcRecoYuv pointer to reconstructed sample arrays 1410 * \param pcPredYuv pointer to prediction sample arrays 1411 * \param pcResiYuv pointer to residue sample arrays 1412 * 1413 \ This function dervies recontructed PU/CU chroma samples with QTree recursive structure 1414 */ 1415 Void 1416 TDecCu::xIntraChromaRecQT( TComDataCU* pcCU, 1417 UInt uiTrDepth, 1418 UInt uiAbsPartIdx, 1419 TComYuv* pcRecoYuv, 1420 TComYuv* pcPredYuv, 1421 TComYuv* pcResiYuv ) 1422 { 1423 UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; 1424 UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); 1425 if( uiTrMode == uiTrDepth ) 1426 { 1427 xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 ); 1428 xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 ); 1429 } 1430 else 1431 { 1432 UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); 1433 for( UInt uiPart = 0; uiPart < 4; uiPart++ ) 1434 { 1435 xIntraChromaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); 1436 } 1462 TComTURecurse tuRecurseChild(rTu, false); 1463 do 1464 { 1465 xIntraRecQT( pcRecoYuv, pcPredYuv, pcResiYuv, chType, tuRecurseChild ); 1466 } while (tuRecurseChild.nextSection(rTu)); 1437 1467 } 1438 1468 } … … 1440 1470 Void TDecCu::xCopyToPic( TComDataCU* pcCU, TComPic* pcPic, UInt uiZorderIdx, UInt uiDepth ) 1441 1471 { 1442 UInt uiC UAddr = pcCU->getAddr();1443 1444 m_ppcYuvReco[uiDepth]->copyToPicYuv ( pcPic->getPicYuvRec (), uiC UAddr, uiZorderIdx );1445 1472 UInt uiCtuRsAddr = pcCU->getCtuRsAddr(); 1473 1474 m_ppcYuvReco[uiDepth]->copyToPicYuv ( pcPic->getPicYuvRec (), uiCtuRsAddr, uiZorderIdx ); 1475 1446 1476 return; 1447 1477 } 1448 1478 1449 Void TDecCu::xDecodeInterTexture ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 1450 { 1451 UInt uiWidth = pcCU->getWidth ( uiAbsPartIdx ); 1452 UInt uiHeight = pcCU->getHeight( uiAbsPartIdx ); 1453 TCoeff* piCoeff; 1454 1455 Pel* pResi; 1456 UInt trMode = pcCU->getTransformIdx( uiAbsPartIdx ); 1457 1458 // Y 1459 piCoeff = pcCU->getCoeffY(); 1460 pResi = m_ppcYuvResi[uiDepth]->getLumaAddr(); 1461 1462 m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); 1463 1464 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, trMode, 0, piCoeff ); 1465 1466 // Cb and Cr 1467 Int curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb(); 1468 m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset ); 1469 1470 uiWidth >>= 1; 1471 uiHeight >>= 1; 1472 piCoeff = pcCU->getCoeffCb(); pResi = m_ppcYuvResi[uiDepth]->getCbAddr(); 1473 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff ); 1474 1475 curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr(); 1476 m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset ); 1477 1478 piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr(); 1479 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff ); 1479 Void TDecCu::xDecodeInterTexture ( TComDataCU* pcCU, UInt uiDepth ) 1480 { 1481 1482 TComTURecurse tuRecur(pcCU, 0, uiDepth); 1483 1484 for(UInt ch=0; ch<pcCU->getPic()->getNumberValidComponents(); ch++) 1485 { 1486 const ComponentID compID=ComponentID(ch); 1487 DEBUG_STRING_OUTPUT(std::cout, debug_reorder_data_inter_token[compID]) 1488 1489 m_pcTrQuant->invRecurTransformNxN ( compID, m_ppcYuvResi[uiDepth], tuRecur ); 1490 } 1491 1492 DEBUG_STRING_OUTPUT(std::cout, debug_reorder_data_inter_token[MAX_NUM_COMPONENT]) 1480 1493 } 1481 1494 … … 1488 1501 * \param uiWidth CU width 1489 1502 * \param uiHeight CU height 1490 * \param ttText texture component type1503 * \param compID colour component ID 1491 1504 * \returns Void 1492 1505 */ 1493 Void TDecCu::xDecodePCMTexture( TComDataCU* pcCU, UInt uiPartIdx, Pel *piPCM, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType ttText) 1494 { 1495 UInt uiX, uiY; 1496 Pel* piPicReco; 1497 UInt uiPicStride; 1498 UInt uiPcmLeftShiftBit; 1499 1500 if( ttText == TEXT_LUMA ) 1501 { 1502 uiPicStride = pcCU->getPic()->getPicYuvRec()->getStride(); 1503 piPicReco = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); 1504 uiPcmLeftShiftBit = g_bitDepthY - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma(); 1505 } 1506 else 1507 { 1508 uiPicStride = pcCU->getPic()->getPicYuvRec()->getCStride(); 1509 1510 if( ttText == TEXT_CHROMA_U ) 1511 { 1512 piPicReco = pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); 1513 } 1514 else 1515 { 1516 piPicReco = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); 1517 } 1518 uiPcmLeftShiftBit = g_bitDepthC - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); 1519 } 1520 1521 for( uiY = 0; uiY < uiHeight; uiY++ ) 1522 { 1523 for( uiX = 0; uiX < uiWidth; uiX++ ) 1506 Void TDecCu::xDecodePCMTexture( TComDataCU* pcCU, const UInt uiPartIdx, const Pel *piPCM, Pel* piReco, const UInt uiStride, const UInt uiWidth, const UInt uiHeight, const ComponentID compID) 1507 { 1508 Pel* piPicReco = pcCU->getPic()->getPicYuvRec()->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu()+uiPartIdx); 1509 const UInt uiPicStride = pcCU->getPic()->getPicYuvRec()->getStride(compID); 1510 const TComSPS &sps = *(pcCU->getSlice()->getSPS()); 1511 const UInt uiPcmLeftShiftBit = sps.getBitDepth(toChannelType(compID)) - sps.getPCMBitDepth(toChannelType(compID)); 1512 1513 for(UInt uiY = 0; uiY < uiHeight; uiY++ ) 1514 { 1515 for(UInt uiX = 0; uiX < uiWidth; uiX++ ) 1524 1516 { 1525 1517 piReco[uiX] = (piPCM[uiX] << uiPcmLeftShiftBit); … … 1539 1531 Void TDecCu::xReconPCM( TComDataCU* pcCU, UInt uiDepth ) 1540 1532 { 1541 // Luma 1542 UInt uiWidth = (g_uiMaxCUWidth >> uiDepth); 1543 UInt uiHeight = (g_uiMaxCUHeight >> uiDepth); 1544 1545 Pel* piPcmY = pcCU->getPCMSampleY(); 1546 Pel* piRecoY = m_ppcYuvReco[uiDepth]->getLumaAddr(0, uiWidth); 1547 1548 UInt uiStride = m_ppcYuvResi[uiDepth]->getStride(); 1549 1550 xDecodePCMTexture( pcCU, 0, piPcmY, piRecoY, uiStride, uiWidth, uiHeight, TEXT_LUMA); 1551 1552 // Cb and Cr 1553 UInt uiCWidth = (uiWidth>>1); 1554 UInt uiCHeight = (uiHeight>>1); 1555 1556 Pel* piPcmCb = pcCU->getPCMSampleCb(); 1557 Pel* piPcmCr = pcCU->getPCMSampleCr(); 1558 Pel* pRecoCb = m_ppcYuvReco[uiDepth]->getCbAddr(); 1559 Pel* pRecoCr = m_ppcYuvReco[uiDepth]->getCrAddr(); 1560 1561 UInt uiCStride = m_ppcYuvReco[uiDepth]->getCStride(); 1562 1563 xDecodePCMTexture( pcCU, 0, piPcmCb, pRecoCb, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_U); 1564 xDecodePCMTexture( pcCU, 0, piPcmCr, pRecoCr, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_V); 1565 } 1566 1567 /** Function for filling the PCM buffer of a CU using its reconstructed sample array 1568 * \param pcCU pointer to current CU 1569 * \param uiDepth CU Depth 1570 * \returns Void 1533 const UInt maxCuWidth = pcCU->getSlice()->getSPS()->getMaxCUWidth(); 1534 const UInt maxCuHeight = pcCU->getSlice()->getSPS()->getMaxCUHeight(); 1535 for (UInt ch=0; ch < pcCU->getPic()->getNumberValidComponents(); ch++) 1536 { 1537 const ComponentID compID = ComponentID(ch); 1538 const UInt width = (maxCuWidth >>(uiDepth+m_ppcYuvResi[uiDepth]->getComponentScaleX(compID))); 1539 const UInt height = (maxCuHeight>>(uiDepth+m_ppcYuvResi[uiDepth]->getComponentScaleY(compID))); 1540 const UInt stride = m_ppcYuvResi[uiDepth]->getStride(compID); 1541 Pel * pPCMChannel = pcCU->getPCMSample(compID); 1542 Pel * pRecChannel = m_ppcYuvReco[uiDepth]->getAddr(compID); 1543 xDecodePCMTexture( pcCU, 0, pPCMChannel, pRecChannel, stride, width, height, compID ); 1544 } 1545 } 1546 1547 /** Function for filling the PCM buffer of a CU using its reconstructed sample array 1548 * \param pCU pointer to current CU 1549 * \param depth CU Depth 1571 1550 */ 1572 1551 Void TDecCu::xFillPCMBuffer(TComDataCU* pCU, UInt depth) 1573 1552 { 1574 // Luma 1575 UInt width = (g_uiMaxCUWidth >> depth); 1576 UInt height = (g_uiMaxCUHeight >> depth); 1577 1578 Pel* pPcmY = pCU->getPCMSampleY(); 1579 Pel* pRecoY = m_ppcYuvReco[depth]->getLumaAddr(0, width); 1580 1581 UInt stride = m_ppcYuvReco[depth]->getStride(); 1582 1583 for(Int y = 0; y < height; y++ ) 1584 { 1585 for(Int x = 0; x < width; x++ ) 1586 { 1587 pPcmY[x] = pRecoY[x]; 1588 } 1589 pPcmY += width; 1590 pRecoY += stride; 1591 } 1592 1593 // Cb and Cr 1594 UInt widthC = (width>>1); 1595 UInt heightC = (height>>1); 1596 1597 Pel* pPcmCb = pCU->getPCMSampleCb(); 1598 Pel* pPcmCr = pCU->getPCMSampleCr(); 1599 Pel* pRecoCb = m_ppcYuvReco[depth]->getCbAddr(); 1600 Pel* pRecoCr = m_ppcYuvReco[depth]->getCrAddr(); 1601 1602 UInt strideC = m_ppcYuvReco[depth]->getCStride(); 1603 1604 for(Int y = 0; y < heightC; y++ ) 1605 { 1606 for(Int x = 0; x < widthC; x++ ) 1607 { 1608 pPcmCb[x] = pRecoCb[x]; 1609 pPcmCr[x] = pRecoCr[x]; 1610 } 1611 pPcmCr += widthC; 1612 pPcmCb += widthC; 1613 pRecoCb += strideC; 1614 pRecoCr += strideC; 1615 } 1616 1553 const ChromaFormat format = pCU->getPic()->getChromaFormat(); 1554 const UInt numValidComp = getNumberValidComponents(format); 1555 const UInt maxCuWidth = pCU->getSlice()->getSPS()->getMaxCUWidth(); 1556 const UInt maxCuHeight = pCU->getSlice()->getSPS()->getMaxCUHeight(); 1557 1558 for (UInt componentIndex = 0; componentIndex < numValidComp; componentIndex++) 1559 { 1560 const ComponentID component = ComponentID(componentIndex); 1561 1562 const UInt width = maxCuWidth >> (depth + getComponentScaleX(component, format)); 1563 const UInt height = maxCuHeight >> (depth + getComponentScaleY(component, format)); 1564 1565 Pel *source = m_ppcYuvReco[depth]->getAddr(component, 0, width); 1566 Pel *destination = pCU->getPCMSample(component); 1567 1568 const UInt sourceStride = m_ppcYuvReco[depth]->getStride(component); 1569 1570 for (Int line = 0; line < height; line++) 1571 { 1572 for (Int column = 0; column < width; column++) 1573 { 1574 destination[column] = source[column]; 1575 } 1576 1577 source += sourceStride; 1578 destination += width; 1579 } 1580 } 1617 1581 } 1618 1582
Note: See TracChangeset for help on using the changeset viewer.