Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComPattern.cpp
- Timestamp:
- 13 Aug 2015, 17:38:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/TComPattern.cpp
r1179 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 * … … 39 39 #include "TComPattern.h" 40 40 #include "TComDataCU.h" 41 #include "TComTU.h" 42 #include "Debug.h" 43 #include "TComPrediction.h" 41 44 42 45 //! \ingroup TLibCommon 43 46 //! \{ 44 47 45 // ==================================================================================================================== 46 // Tables 47 // ==================================================================================================================== 48 49 const UChar TComPattern::m_aucIntraFilter[5] = 50 { 51 10, //4x4 52 7, //8x8 53 1, //16x16 54 0, //32x32 55 10, //64x64 56 }; 48 // Forward declarations 49 50 /// padding of unavailable reference samples for intra prediction 51 Void fillReferenceSamples( const Int bitDepth, 52 #if O0043_BEST_EFFORT_DECODING 53 const Int bitDepthDelta, 54 #endif 55 const Pel* piRoiOrigin, 56 Pel* piIntraTemp, 57 const Bool* bNeighborFlags, 58 const Int iNumIntraNeighbor, 59 const Int unitWidth, 60 const Int unitHeight, 61 const Int iAboveUnits, 62 const Int iLeftUnits, 63 const UInt uiWidth, 64 const UInt uiHeight, 65 const Int iPicStride ); 66 67 /// constrained intra prediction 68 Bool isAboveLeftAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT ); 69 Int isAboveAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags ); 70 Int isLeftAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags ); 71 Int isAboveRightAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags ); 72 Int isBelowLeftAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags ); 73 57 74 58 75 // ==================================================================================================================== … … 60 77 // ==================================================================================================================== 61 78 62 /** \param piTexture pixel data 79 /** 80 \param piTexture pixel data 63 81 \param iRoiWidth pattern width 64 82 \param iRoiHeight pattern height 65 83 \param iStride buffer stride 66 \param iOffsetLeft neighbour offset (left) 67 \param iOffsetAbove neighbour offset (above) 84 \param bitDepth bit depth 68 85 */ 69 86 Void TComPatternParam::setPatternParamPel ( Pel* piTexture, … … 71 88 Int iRoiHeight, 72 89 Int iStride, 73 Int iOffsetLeft, 74 Int iOffsetAbove ) 75 { 76 m_piPatternOrigin = piTexture; 77 m_iROIWidth = iRoiWidth; 78 m_iROIHeight = iRoiHeight; 79 m_iPatternStride = iStride; 80 m_iOffsetLeft = iOffsetLeft; 81 m_iOffsetAbove = iOffsetAbove; 82 } 83 84 /** 85 \param pcCU CU data structure 86 \param iComp component index (0=Y, 1=Cb, 2=Cr) 87 \param iRoiWidth pattern width 88 \param iRoiHeight pattern height 89 \param iStride buffer stride 90 \param iOffsetLeft neighbour offset (left) 91 \param iOffsetAbove neighbour offset (above) 92 \param uiAbsPartIdx part index 93 */ 94 Void TComPatternParam::setPatternParamCU( TComDataCU* pcCU, 95 UChar iComp, 96 UChar iRoiWidth, 97 UChar iRoiHeight, 98 Int iOffsetLeft, 99 Int iOffsetAbove, 100 UInt uiAbsPartIdx ) 101 { 102 m_iOffsetLeft = iOffsetLeft; 103 m_iOffsetAbove = iOffsetAbove; 104 105 m_iROIWidth = iRoiWidth; 106 m_iROIHeight = iRoiHeight; 107 108 UInt uiAbsZorderIdx = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 109 110 if ( iComp == 0 ) 111 { 112 m_iPatternStride = pcCU->getPic()->getStride(); 113 m_piPatternOrigin = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), uiAbsZorderIdx) - m_iOffsetAbove * m_iPatternStride - m_iOffsetLeft; 114 } 115 else 116 { 117 m_iPatternStride = pcCU->getPic()->getCStride(); 118 if ( iComp == 1 ) 119 { 120 m_piPatternOrigin = pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), uiAbsZorderIdx) - m_iOffsetAbove * m_iPatternStride - m_iOffsetLeft; 121 } 122 else 123 { 124 m_piPatternOrigin = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), uiAbsZorderIdx) - m_iOffsetAbove * m_iPatternStride - m_iOffsetLeft; 125 } 126 } 90 Int bitDepth 91 ) 92 { 93 m_piROIOrigin = piTexture; 94 m_iROIWidth = iRoiWidth; 95 m_iROIHeight = iRoiHeight; 96 m_iPatternStride = iStride; 97 m_bitDepth = bitDepth; 127 98 } 128 99 … … 131 102 // ==================================================================================================================== 132 103 133 Void TComPattern::initPattern ( Pel* piY, 134 Pel* piCb, 135 Pel* piCr, 104 Void TComPattern::initPattern (Pel* piY, 136 105 Int iRoiWidth, 137 106 Int iRoiHeight, 138 107 Int iStride, 139 Int iOffsetLeft, 140 Int iOffsetAbove ) 141 { 142 m_cPatternY. setPatternParamPel( piY, iRoiWidth, iRoiHeight, iStride, iOffsetLeft, iOffsetAbove ); 143 m_cPatternCb.setPatternParamPel( piCb, iRoiWidth >> 1, iRoiHeight >> 1, iStride >> 1, iOffsetLeft >> 1, iOffsetAbove >> 1 ); 144 m_cPatternCr.setPatternParamPel( piCr, iRoiWidth >> 1, iRoiHeight >> 1, iStride >> 1, iOffsetLeft >> 1, iOffsetAbove >> 1 ); 145 146 return; 147 } 148 149 Void TComPattern::initPattern( TComDataCU* pcCU, UInt uiPartDepth, UInt uiAbsPartIdx ) 150 { 151 Int uiOffsetLeft = 0; 152 Int uiOffsetAbove = 0; 153 154 UChar uiWidth = pcCU->getWidth (0)>>uiPartDepth; 155 UChar uiHeight = pcCU->getHeight(0)>>uiPartDepth; 156 157 UInt uiAbsZorderIdx = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 158 UInt uiCurrPicPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsZorderIdx] ]; 159 UInt uiCurrPicPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsZorderIdx] ]; 160 161 if( uiCurrPicPelX != 0 ) 162 { 163 uiOffsetLeft = 1; 164 } 165 166 if( uiCurrPicPelY != 0 ) 167 { 168 uiOffsetAbove = 1; 169 } 170 171 m_cPatternY .setPatternParamCU( pcCU, 0, uiWidth, uiHeight, uiOffsetLeft, uiOffsetAbove, uiAbsPartIdx ); 172 m_cPatternCb.setPatternParamCU( pcCU, 1, uiWidth >> 1, uiHeight >> 1, uiOffsetLeft, uiOffsetAbove, uiAbsPartIdx ); 173 m_cPatternCr.setPatternParamCU( pcCU, 2, uiWidth >> 1, uiHeight >> 1, uiOffsetLeft, uiOffsetAbove, uiAbsPartIdx ); 174 } 175 176 Void TComPattern::initAdiPattern( TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt uiPartDepth, Int* piAdiBuf, Int iOrgBufStride, Int iOrgBufHeight, Bool& bAbove, Bool& bLeft, Bool bLMmode ) 177 { 178 Pel* piRoiOrigin; 179 Int* piAdiTemp; 180 UInt uiCuWidth = pcCU->getWidth(0) >> uiPartDepth; 181 UInt uiCuHeight = pcCU->getHeight(0)>> uiPartDepth; 182 UInt uiCuWidth2 = uiCuWidth<<1; 183 UInt uiCuHeight2 = uiCuHeight<<1; 184 UInt uiWidth; 185 UInt uiHeight; 186 Int iPicStride = pcCU->getPic()->getStride(); 187 Int iUnitSize = 0; 188 Int iNumUnitsInCu = 0; 189 Int iTotalUnits = 0; 190 Bool bNeighborFlags[4 * MAX_NUM_SPU_W + 1]; 108 Int bitDepthLuma) 109 { 110 m_cPatternY. setPatternParamPel( piY, iRoiWidth, iRoiHeight, iStride, bitDepthLuma); 111 } 112 113 114 // TODO: move this function to TComPrediction.cpp. 115 Void TComPrediction::initIntraPatternChType( TComTU &rTu, const ComponentID compID, const Bool bFilterRefSamples DEBUG_STRING_FN_DECLARE(sDebug)) 116 { 117 const ChannelType chType = toChannelType(compID); 118 119 TComDataCU *pcCU=rTu.getCU(); 120 const TComSPS &sps = *(pcCU->getSlice()->getSPS()); 121 const UInt uiZorderIdxInPart=rTu.GetAbsPartIdxTU(); 122 const UInt uiTuWidth = rTu.getRect(compID).width; 123 const UInt uiTuHeight = rTu.getRect(compID).height; 124 const UInt uiTuWidth2 = uiTuWidth << 1; 125 const UInt uiTuHeight2 = uiTuHeight << 1; 126 127 const Int iBaseUnitSize = sps.getMaxCUWidth() >> sps.getMaxTotalCUDepth(); 128 const Int iUnitWidth = iBaseUnitSize >> pcCU->getPic()->getPicYuvRec()->getComponentScaleX(compID); 129 const Int iUnitHeight = iBaseUnitSize >> pcCU->getPic()->getPicYuvRec()->getComponentScaleY(compID); 130 const Int iTUWidthInUnits = uiTuWidth / iUnitWidth; 131 const Int iTUHeightInUnits = uiTuHeight / iUnitHeight; 132 const Int iAboveUnits = iTUWidthInUnits << 1; 133 const Int iLeftUnits = iTUHeightInUnits << 1; 134 const Int bitDepthForChannel = sps.getBitDepth(chType); 135 136 assert(iTUHeightInUnits > 0 && iTUWidthInUnits > 0); 137 138 const Int iPartIdxStride = pcCU->getPic()->getNumPartInCtuWidth(); 139 const UInt uiPartIdxLT = pcCU->getZorderIdxInCtu() + uiZorderIdxInPart; 140 const UInt uiPartIdxRT = g_auiRasterToZscan[ g_auiZscanToRaster[ uiPartIdxLT ] + iTUWidthInUnits - 1 ]; 141 const UInt uiPartIdxLB = g_auiRasterToZscan[ g_auiZscanToRaster[ uiPartIdxLT ] + ((iTUHeightInUnits - 1) * iPartIdxStride)]; 142 143 Int iPicStride = pcCU->getPic()->getStride(compID); 144 Bool bNeighborFlags[4 * MAX_NUM_PART_IDXS_IN_CTU_WIDTH + 1]; 191 145 Int iNumIntraNeighbor = 0; 192 193 UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 194 195 196 pcCU->deriveLeftRightTopIdxAdi( uiPartIdxLT, uiPartIdxRT, uiZorderIdxInPart, uiPartDepth ); 197 pcCU->deriveLeftBottomIdxAdi ( uiPartIdxLB, uiZorderIdxInPart, uiPartDepth ); 198 199 iUnitSize = g_uiMaxCUWidth >> g_uiMaxCUDepth; 200 iNumUnitsInCu = uiCuWidth / iUnitSize; 201 iTotalUnits = (iNumUnitsInCu << 2) + 1; 202 203 bNeighborFlags[iNumUnitsInCu*2] = isAboveLeftAvailable( pcCU, uiPartIdxLT ); 204 iNumIntraNeighbor += (Int)(bNeighborFlags[iNumUnitsInCu*2]); 205 iNumIntraNeighbor += isAboveAvailable ( pcCU, uiPartIdxLT, uiPartIdxRT, bNeighborFlags+(iNumUnitsInCu*2)+1 ); 206 iNumIntraNeighbor += isAboveRightAvailable( pcCU, uiPartIdxLT, uiPartIdxRT, bNeighborFlags+(iNumUnitsInCu*3)+1 ); 207 iNumIntraNeighbor += isLeftAvailable ( pcCU, uiPartIdxLT, uiPartIdxLB, bNeighborFlags+(iNumUnitsInCu*2)-1 ); 208 iNumIntraNeighbor += isBelowLeftAvailable ( pcCU, uiPartIdxLT, uiPartIdxLB, bNeighborFlags+ iNumUnitsInCu -1 ); 209 210 bAbove = true; 211 bLeft = true; 212 213 uiWidth=uiCuWidth2+1; 214 uiHeight=uiCuHeight2+1; 215 216 if (((uiWidth<<2)>iOrgBufStride)||((uiHeight<<2)>iOrgBufHeight)) 217 { 218 return; 219 } 220 221 piRoiOrigin = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiZorderIdxInPart); 222 piAdiTemp = piAdiBuf; 223 224 fillReferenceSamples (g_bitDepthY, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitSize, iNumUnitsInCu, iTotalUnits, uiCuWidth, uiCuHeight, uiWidth, uiHeight, iPicStride, bLMmode); 225 226 Int i; 227 // generate filtered intra prediction samples 228 Int iBufSize = uiCuHeight2 + uiCuWidth2 + 1; // left and left above border + above and above right border + top left corner = length of 3. filter buffer 229 230 UInt uiWH = uiWidth * uiHeight; // number of elements in one buffer 231 232 Int* piFilteredBuf1 = piAdiBuf + uiWH; // 1. filter buffer 233 Int* piFilteredBuf2 = piFilteredBuf1 + uiWH; // 2. filter buffer 234 Int* piFilterBuf = piFilteredBuf2 + uiWH; // buffer for 2. filtering (sequential) 235 Int* piFilterBufN = piFilterBuf + iBufSize; // buffer for 1. filtering (sequential) 236 237 Int l = 0; 238 // left border from bottom to top 239 for (i = 0; i < uiCuHeight2; i++) 240 { 241 piFilterBuf[l++] = piAdiTemp[uiWidth * (uiCuHeight2 - i)]; 242 } 243 // top left corner 244 piFilterBuf[l++] = piAdiTemp[0]; 245 // above border from left to right 246 for (i=0; i < uiCuWidth2; i++) 247 { 248 piFilterBuf[l++] = piAdiTemp[1 + i]; 249 } 250 251 if (pcCU->getSlice()->getSPS()->getUseStrongIntraSmoothing()) 252 { 253 Int blkSize = 32; 254 Int bottomLeft = piFilterBuf[0]; 255 Int topLeft = piFilterBuf[uiCuHeight2]; 256 Int topRight = piFilterBuf[iBufSize-1]; 257 Int threshold = 1 << (g_bitDepthY - 5); 258 Bool bilinearLeft = abs(bottomLeft+topLeft-2*piFilterBuf[uiCuHeight]) < threshold; 259 Bool bilinearAbove = abs(topLeft+topRight-2*piFilterBuf[uiCuHeight2+uiCuHeight]) < threshold; 260 261 if (uiCuWidth>=blkSize && (bilinearLeft && bilinearAbove)) 262 { 263 Int shift = g_aucConvertToBit[uiCuWidth] + 3; // log2(uiCuHeight2) 264 piFilterBufN[0] = piFilterBuf[0]; 265 piFilterBufN[uiCuHeight2] = piFilterBuf[uiCuHeight2]; 266 piFilterBufN[iBufSize - 1] = piFilterBuf[iBufSize - 1]; 267 for (i = 1; i < uiCuHeight2; i++) 268 { 269 piFilterBufN[i] = ((uiCuHeight2-i)*bottomLeft + i*topLeft + uiCuHeight) >> shift; 270 } 271 272 for (i = 1; i < uiCuWidth2; i++) 273 { 274 piFilterBufN[uiCuHeight2 + i] = ((uiCuWidth2-i)*topLeft + i*topRight + uiCuWidth) >> shift; 275 } 276 } 277 else 278 { 279 // 1. filtering with [1 2 1] 280 piFilterBufN[0] = piFilterBuf[0]; 281 piFilterBufN[iBufSize - 1] = piFilterBuf[iBufSize - 1]; 282 for (i = 1; i < iBufSize - 1; i++) 283 { 284 piFilterBufN[i] = (piFilterBuf[i - 1] + 2 * piFilterBuf[i]+piFilterBuf[i + 1] + 2) >> 2; 285 } 286 } 287 } 288 else 289 { 290 // 1. filtering with [1 2 1] 291 piFilterBufN[0] = piFilterBuf[0]; 292 piFilterBufN[iBufSize - 1] = piFilterBuf[iBufSize - 1]; 293 for (i = 1; i < iBufSize - 1; i++) 294 { 295 piFilterBufN[i] = (piFilterBuf[i - 1] + 2 * piFilterBuf[i]+piFilterBuf[i + 1] + 2) >> 2; 296 } 297 } 298 299 // fill 1. filter buffer with filtered values 300 l=0; 301 for (i = 0; i < uiCuHeight2; i++) 302 { 303 piFilteredBuf1[uiWidth * (uiCuHeight2 - i)] = piFilterBufN[l++]; 304 } 305 piFilteredBuf1[0] = piFilterBufN[l++]; 306 for (i = 0; i < uiCuWidth2; i++) 307 { 308 piFilteredBuf1[1 + i] = piFilterBufN[l++]; 309 } 310 } 311 312 Void TComPattern::initAdiPatternChroma( TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt uiPartDepth, Int* piAdiBuf, Int iOrgBufStride, Int iOrgBufHeight, Bool& bAbove, Bool& bLeft ) 313 { 314 Pel* piRoiOrigin; 315 Int* piAdiTemp; 316 UInt uiCuWidth = pcCU->getWidth (0) >> uiPartDepth; 317 UInt uiCuHeight = pcCU->getHeight(0) >> uiPartDepth; 318 UInt uiWidth; 319 UInt uiHeight; 320 Int iPicStride = pcCU->getPic()->getCStride(); 321 322 Int iUnitSize = 0; 323 Int iNumUnitsInCu = 0; 324 Int iTotalUnits = 0; 325 Bool bNeighborFlags[4 * MAX_NUM_SPU_W + 1]; 326 Int iNumIntraNeighbor = 0; 327 328 UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 329 330 pcCU->deriveLeftRightTopIdxAdi( uiPartIdxLT, uiPartIdxRT, uiZorderIdxInPart, uiPartDepth ); 331 pcCU->deriveLeftBottomIdxAdi ( uiPartIdxLB, uiZorderIdxInPart, uiPartDepth ); 332 333 iUnitSize = (g_uiMaxCUWidth >> g_uiMaxCUDepth) >> 1; // for chroma 334 iNumUnitsInCu = (uiCuWidth / iUnitSize) >> 1; // for chroma 335 iTotalUnits = (iNumUnitsInCu << 2) + 1; 336 337 bNeighborFlags[iNumUnitsInCu*2] = isAboveLeftAvailable( pcCU, uiPartIdxLT ); 338 iNumIntraNeighbor += (Int)(bNeighborFlags[iNumUnitsInCu*2]); 339 iNumIntraNeighbor += isAboveAvailable ( pcCU, uiPartIdxLT, uiPartIdxRT, bNeighborFlags+(iNumUnitsInCu*2)+1 ); 340 iNumIntraNeighbor += isAboveRightAvailable( pcCU, uiPartIdxLT, uiPartIdxRT, bNeighborFlags+(iNumUnitsInCu*3)+1 ); 341 iNumIntraNeighbor += isLeftAvailable ( pcCU, uiPartIdxLT, uiPartIdxLB, bNeighborFlags+(iNumUnitsInCu*2)-1 ); 342 iNumIntraNeighbor += isBelowLeftAvailable ( pcCU, uiPartIdxLT, uiPartIdxLB, bNeighborFlags+ iNumUnitsInCu -1 ); 343 344 bAbove = true; 345 bLeft = true; 346 347 uiCuWidth=uiCuWidth>>1; // for chroma 348 uiCuHeight=uiCuHeight>>1; // for chroma 349 350 uiWidth=uiCuWidth*2+1; 351 uiHeight=uiCuHeight*2+1; 352 353 if ((4*uiWidth>iOrgBufStride)||(4*uiHeight>iOrgBufHeight)) 354 { 355 return; 356 } 357 358 // get Cb pattern 359 piRoiOrigin = pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiZorderIdxInPart); 360 piAdiTemp = piAdiBuf; 361 362 fillReferenceSamples (g_bitDepthC, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitSize, iNumUnitsInCu, iTotalUnits, uiCuWidth, uiCuHeight, uiWidth, uiHeight, iPicStride); 363 364 // get Cr pattern 365 piRoiOrigin = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiZorderIdxInPart); 366 piAdiTemp = piAdiBuf+uiWidth*uiHeight; 367 368 fillReferenceSamples (g_bitDepthC, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitSize, iNumUnitsInCu, iTotalUnits, uiCuWidth, uiCuHeight, uiWidth, uiHeight, iPicStride); 369 } 370 371 Void TComPattern::fillReferenceSamples(Int bitDepth, Pel* piRoiOrigin, Int* piAdiTemp, Bool* bNeighborFlags, Int iNumIntraNeighbor, Int iUnitSize, Int iNumUnitsInCu, Int iTotalUnits, UInt uiCuWidth, UInt uiCuHeight, UInt uiWidth, UInt uiHeight, Int iPicStride, Bool bLMmode ) 372 { 373 Pel* piRoiTemp; 146 147 bNeighborFlags[iLeftUnits] = isAboveLeftAvailable( pcCU, uiPartIdxLT ); 148 iNumIntraNeighbor += bNeighborFlags[iLeftUnits] ? 1 : 0; 149 iNumIntraNeighbor += isAboveAvailable ( pcCU, uiPartIdxLT, uiPartIdxRT, (bNeighborFlags + iLeftUnits + 1) ); 150 iNumIntraNeighbor += isAboveRightAvailable( pcCU, uiPartIdxLT, uiPartIdxRT, (bNeighborFlags + iLeftUnits + 1 + iTUWidthInUnits ) ); 151 iNumIntraNeighbor += isLeftAvailable ( pcCU, uiPartIdxLT, uiPartIdxLB, (bNeighborFlags + iLeftUnits - 1) ); 152 iNumIntraNeighbor += isBelowLeftAvailable ( pcCU, uiPartIdxLT, uiPartIdxLB, (bNeighborFlags + iLeftUnits - 1 - iTUHeightInUnits) ); 153 154 const UInt uiROIWidth = uiTuWidth2+1; 155 const UInt uiROIHeight = uiTuHeight2+1; 156 157 assert(uiROIWidth*uiROIHeight <= m_iYuvExtSize); 158 159 #if DEBUG_STRING 160 std::stringstream ss(stringstream::out); 161 #endif 162 163 { 164 Pel *piIntraTemp = m_piYuvExt[compID][PRED_BUF_UNFILTERED]; 165 Pel *piRoiOrigin = pcCU->getPic()->getPicYuvRec()->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu()+uiZorderIdxInPart); 166 #if O0043_BEST_EFFORT_DECODING 167 const Int bitDepthForChannelInStream = sps.getStreamBitDepth(chType); 168 fillReferenceSamples (bitDepthForChannelInStream, bitDepthForChannelInStream - bitDepthForChannel, 169 #else 170 fillReferenceSamples (bitDepthForChannel, 171 #endif 172 piRoiOrigin, piIntraTemp, bNeighborFlags, iNumIntraNeighbor, iUnitWidth, iUnitHeight, iAboveUnits, iLeftUnits, 173 uiROIWidth, uiROIHeight, iPicStride); 174 175 176 #if DEBUG_STRING 177 if (DebugOptionList::DebugString_Pred.getInt()&DebugStringGetPredModeMask(MODE_INTRA)) 178 { 179 ss << "###: generating Ref Samples for channel " << compID << " and " << rTu.getRect(compID).width << " x " << rTu.getRect(compID).height << "\n"; 180 for (UInt y=0; y<uiROIHeight; y++) 181 { 182 ss << "###: - "; 183 for (UInt x=0; x<uiROIWidth; x++) 184 { 185 if (x==0 || y==0) 186 { 187 ss << piIntraTemp[y*uiROIWidth + x] << ", "; 188 // if (x%16==15) ss << "\nPart size: ~ "; 189 } 190 } 191 ss << "\n"; 192 } 193 } 194 #endif 195 196 if (bFilterRefSamples) 197 { 198 // generate filtered intra prediction samples 199 200 Int stride = uiROIWidth; 201 const Pel *piSrcPtr = piIntraTemp + (stride * uiTuHeight2); // bottom left 202 Pel *piDestPtr = m_piYuvExt[compID][PRED_BUF_FILTERED] + (stride * uiTuHeight2); // bottom left 203 204 //------------------------------------------------ 205 206 Bool useStrongIntraSmoothing = isLuma(chType) && sps.getUseStrongIntraSmoothing(); 207 208 const Pel bottomLeft = piIntraTemp[stride * uiTuHeight2]; 209 const Pel topLeft = piIntraTemp[0]; 210 const Pel topRight = piIntraTemp[uiTuWidth2]; 211 212 if (useStrongIntraSmoothing) 213 { 214 #if O0043_BEST_EFFORT_DECODING 215 const Int threshold = 1 << (bitDepthForChannelInStream - 5); 216 #else 217 const Int threshold = 1 << (bitDepthForChannel - 5); 218 #endif 219 const Bool bilinearLeft = abs((bottomLeft + topLeft ) - (2 * piIntraTemp[stride * uiTuHeight])) < threshold; //difference between the 220 const Bool bilinearAbove = abs((topLeft + topRight) - (2 * piIntraTemp[ uiTuWidth ])) < threshold; //ends and the middle 221 if ((uiTuWidth < 32) || (!bilinearLeft) || (!bilinearAbove)) 222 { 223 useStrongIntraSmoothing = false; 224 } 225 } 226 227 *piDestPtr = *piSrcPtr; // bottom left is not filtered 228 piDestPtr -= stride; 229 piSrcPtr -= stride; 230 231 //------------------------------------------------ 232 233 //left column (bottom to top) 234 235 if (useStrongIntraSmoothing) 236 { 237 const Int shift = g_aucConvertToBit[uiTuHeight] + 3; //log2(uiTuHeight2) 238 239 for(UInt i=1; i<uiTuHeight2; i++, piDestPtr-=stride) 240 { 241 *piDestPtr = (((uiTuHeight2 - i) * bottomLeft) + (i * topLeft) + uiTuHeight) >> shift; 242 } 243 244 piSrcPtr -= stride * (uiTuHeight2 - 1); 245 } 246 else 247 { 248 for(UInt i=1; i<uiTuHeight2; i++, piDestPtr-=stride, piSrcPtr-=stride) 249 { 250 *piDestPtr = ( piSrcPtr[stride] + 2*piSrcPtr[0] + piSrcPtr[-stride] + 2 ) >> 2; 251 } 252 } 253 254 //------------------------------------------------ 255 256 //top-left 257 258 if (useStrongIntraSmoothing) 259 { 260 *piDestPtr = piSrcPtr[0]; 261 } 262 else 263 { 264 *piDestPtr = ( piSrcPtr[stride] + 2*piSrcPtr[0] + piSrcPtr[1] + 2 ) >> 2; 265 } 266 piDestPtr += 1; 267 piSrcPtr += 1; 268 269 //------------------------------------------------ 270 271 //top row (left-to-right) 272 273 if (useStrongIntraSmoothing) 274 { 275 const Int shift = g_aucConvertToBit[uiTuWidth] + 3; //log2(uiTuWidth2) 276 277 for(UInt i=1; i<uiTuWidth2; i++, piDestPtr++) 278 { 279 *piDestPtr = (((uiTuWidth2 - i) * topLeft) + (i * topRight) + uiTuWidth) >> shift; 280 } 281 282 piSrcPtr += uiTuWidth2 - 1; 283 } 284 else 285 { 286 for(UInt i=1; i<uiTuWidth2; i++, piDestPtr++, piSrcPtr++) 287 { 288 *piDestPtr = ( piSrcPtr[1] + 2*piSrcPtr[0] + piSrcPtr[-1] + 2 ) >> 2; 289 } 290 } 291 292 //------------------------------------------------ 293 294 *piDestPtr=*piSrcPtr; // far right is not filtered 295 296 #if DEBUG_STRING 297 if (DebugOptionList::DebugString_Pred.getInt()&DebugStringGetPredModeMask(MODE_INTRA)) 298 { 299 ss << "###: filtered result for channel " << compID <<"\n"; 300 for (UInt y=0; y<uiROIHeight; y++) 301 { 302 ss << "###: - "; 303 for (UInt x=0; x<uiROIWidth; x++) 304 { 305 if (x==0 || y==0) 306 { 307 ss << m_piYuvExt[compID][PRED_BUF_FILTERED][y*uiROIWidth + x] << ", "; 308 // if (x%16==15) ss << "\nPart size: ~ "; 309 } 310 } 311 ss << "\n"; 312 } 313 } 314 #endif 315 316 317 } 318 } 319 DEBUG_STRING_APPEND(sDebug, ss.str()) 320 } 321 322 Void fillReferenceSamples( const Int bitDepth, 323 #if O0043_BEST_EFFORT_DECODING 324 const Int bitDepthDelta, 325 #endif 326 const Pel* piRoiOrigin, 327 Pel* piIntraTemp, 328 const Bool* bNeighborFlags, 329 const Int iNumIntraNeighbor, 330 const Int unitWidth, 331 const Int unitHeight, 332 const Int iAboveUnits, 333 const Int iLeftUnits, 334 const UInt uiWidth, 335 const UInt uiHeight, 336 const Int iPicStride ) 337 { 338 const Pel* piRoiTemp; 374 339 Int i, j; 375 340 Int iDCValue = 1 << (bitDepth - 1); 341 const Int iTotalUnits = iAboveUnits + iLeftUnits + 1; //+1 for top-left 376 342 377 343 if (iNumIntraNeighbor == 0) … … 380 346 for (i=0; i<uiWidth; i++) 381 347 { 382 pi AdiTemp[i] = iDCValue;348 piIntraTemp[i] = iDCValue; 383 349 } 384 350 for (i=1; i<uiHeight; i++) 385 351 { 386 pi AdiTemp[i*uiWidth] = iDCValue;352 piIntraTemp[i*uiWidth] = iDCValue; 387 353 } 388 354 } 389 355 else if (iNumIntraNeighbor == iTotalUnits) 390 356 { 391 // Fill top-left border with rec. samples357 // Fill top-left border and top and top right with rec. samples 392 358 piRoiTemp = piRoiOrigin - iPicStride - 1; 393 piAdiTemp[0] = piRoiTemp[0]; 394 395 // Fill left border with rec. samples 359 360 for (i=0; i<uiWidth; i++) 361 { 362 #if O0043_BEST_EFFORT_DECODING 363 piIntraTemp[i] = piRoiTemp[i] << bitDepthDelta; 364 #else 365 piIntraTemp[i] = piRoiTemp[i]; 366 #endif 367 } 368 369 // Fill left and below left border with rec. samples 396 370 piRoiTemp = piRoiOrigin - 1; 397 371 398 if (bLMmode) 399 { 400 piRoiTemp --; // move to the second left column 401 } 402 403 for (i=0; i<uiCuHeight; i++) 404 { 405 piAdiTemp[(1+i)*uiWidth] = piRoiTemp[0]; 372 for (i=1; i<uiHeight; i++) 373 { 374 #if O0043_BEST_EFFORT_DECODING 375 piIntraTemp[i*uiWidth] = (*(piRoiTemp)) << bitDepthDelta; 376 #else 377 piIntraTemp[i*uiWidth] = *(piRoiTemp); 378 #endif 406 379 piRoiTemp += iPicStride; 407 380 } 408 409 // Fill below left border with rec. samples410 for (i=0; i<uiCuHeight; i++)411 {412 piAdiTemp[(1+uiCuHeight+i)*uiWidth] = piRoiTemp[0];413 piRoiTemp += iPicStride;414 }415 416 // Fill top border with rec. samples417 piRoiTemp = piRoiOrigin - iPicStride;418 for (i=0; i<uiCuWidth; i++)419 {420 piAdiTemp[1+i] = piRoiTemp[i];421 }422 423 // Fill top right border with rec. samples424 piRoiTemp = piRoiOrigin - iPicStride + uiCuWidth;425 for (i=0; i<uiCuWidth; i++)426 {427 piAdiTemp[1+uiCuWidth+i] = piRoiTemp[i];428 }429 381 } 430 382 else // reference samples are partially available 431 383 { 432 Int iNumUnits2 = iNumUnitsInCu<<1; 433 Int iTotalSamples = iTotalUnits*iUnitSize; 434 Pel piAdiLine[5 * MAX_CU_SIZE]; 435 Pel *piAdiLineTemp; 436 Bool *pbNeighborFlags; 437 Int iNext, iCurr; 438 Pel piRef = 0; 384 // all above units have "unitWidth" samples each, all left/below-left units have "unitHeight" samples each 385 const Int iTotalSamples = (iLeftUnits * unitHeight) + ((iAboveUnits + 1) * unitWidth); 386 Pel piIntraLine[5 * MAX_CU_SIZE]; 387 Pel *piIntraLineTemp; 388 const Bool *pbNeighborFlags; 389 439 390 440 391 // Initialize 441 392 for (i=0; i<iTotalSamples; i++) 442 393 { 443 pi AdiLine[i] = iDCValue;444 } 445 394 piIntraLine[i] = iDCValue; 395 } 396 446 397 // Fill top-left sample 447 398 piRoiTemp = piRoiOrigin - iPicStride - 1; 448 pi AdiLineTemp = piAdiLine + (iNumUnits2*iUnitSize);449 pbNeighborFlags = bNeighborFlags + i NumUnits2;399 piIntraLineTemp = piIntraLine + (iLeftUnits * unitHeight); 400 pbNeighborFlags = bNeighborFlags + iLeftUnits; 450 401 if (*pbNeighborFlags) 451 402 { 452 piAdiLineTemp[0] = piRoiTemp[0]; 453 for (i=1; i<iUnitSize; i++) 454 { 455 piAdiLineTemp[i] = piAdiLineTemp[0]; 456 } 457 } 458 459 // Fill left & below-left samples 403 #if O0043_BEST_EFFORT_DECODING 404 Pel topLeftVal=piRoiTemp[0] << bitDepthDelta; 405 #else 406 Pel topLeftVal=piRoiTemp[0]; 407 #endif 408 for (i=0; i<unitWidth; i++) 409 { 410 piIntraLineTemp[i] = topLeftVal; 411 } 412 } 413 414 // Fill left & below-left samples (downwards) 460 415 piRoiTemp += iPicStride; 461 if (bLMmode) 462 { 463 piRoiTemp --; // move the second left column 464 } 465 piAdiLineTemp--; 416 piIntraLineTemp--; 466 417 pbNeighborFlags--; 467 for (j=0; j<iNumUnits2; j++) 418 419 for (j=0; j<iLeftUnits; j++) 468 420 { 469 421 if (*pbNeighborFlags) 470 422 { 471 for (i=0; i<iUnitSize; i++) 472 { 473 piAdiLineTemp[-i] = piRoiTemp[i*iPicStride]; 474 } 475 } 476 piRoiTemp += iUnitSize*iPicStride; 477 piAdiLineTemp -= iUnitSize; 423 for (i=0; i<unitHeight; i++) 424 { 425 #if O0043_BEST_EFFORT_DECODING 426 piIntraLineTemp[-i] = piRoiTemp[i*iPicStride] << bitDepthDelta; 427 #else 428 piIntraLineTemp[-i] = piRoiTemp[i*iPicStride]; 429 #endif 430 } 431 } 432 piRoiTemp += unitHeight*iPicStride; 433 piIntraLineTemp -= unitHeight; 478 434 pbNeighborFlags--; 479 435 } 480 436 481 // Fill above & above-right samples 437 // Fill above & above-right samples (left-to-right) (each unit has "unitWidth" samples) 482 438 piRoiTemp = piRoiOrigin - iPicStride; 483 piAdiLineTemp = piAdiLine + ((iNumUnits2+1)*iUnitSize); 484 pbNeighborFlags = bNeighborFlags + iNumUnits2 + 1; 485 for (j=0; j<iNumUnits2; j++) 439 // offset line buffer by iNumUints2*unitHeight (for left/below-left) + unitWidth (for above-left) 440 piIntraLineTemp = piIntraLine + (iLeftUnits * unitHeight) + unitWidth; 441 pbNeighborFlags = bNeighborFlags + iLeftUnits + 1; 442 for (j=0; j<iAboveUnits; j++) 486 443 { 487 444 if (*pbNeighborFlags) 488 445 { 489 for (i=0; i<iUnitSize; i++) 490 { 491 piAdiLineTemp[i] = piRoiTemp[i]; 492 } 493 } 494 piRoiTemp += iUnitSize; 495 piAdiLineTemp += iUnitSize; 446 for (i=0; i<unitWidth; i++) 447 { 448 #if O0043_BEST_EFFORT_DECODING 449 piIntraLineTemp[i] = piRoiTemp[i] << bitDepthDelta; 450 #else 451 piIntraLineTemp[i] = piRoiTemp[i]; 452 #endif 453 } 454 } 455 piRoiTemp += unitWidth; 456 piIntraLineTemp += unitWidth; 496 457 pbNeighborFlags++; 497 458 } 498 459 499 460 // Pad reference samples when necessary 500 iCurr = 0; 501 iNext = 1; 502 piAdiLineTemp = piAdiLine; 503 while (iCurr < iTotalUnits) 504 { 505 if (!bNeighborFlags[iCurr]) 506 { 507 if(iCurr == 0) 508 { 509 while (iNext < iTotalUnits && !bNeighborFlags[iNext]) 461 Int iCurrJnit = 0; 462 Pel *piIntraLineCur = piIntraLine; 463 const UInt piIntraLineTopRowOffset = iLeftUnits * (unitHeight - unitWidth); 464 465 if (!bNeighborFlags[0]) 466 { 467 // very bottom unit of bottom-left; at least one unit will be valid. 468 { 469 Int iNext = 1; 470 while (iNext < iTotalUnits && !bNeighborFlags[iNext]) 471 { 472 iNext++; 473 } 474 Pel *piIntraLineNext = piIntraLine + ((iNext < iLeftUnits) ? (iNext * unitHeight) : (piIntraLineTopRowOffset + (iNext * unitWidth))); 475 const Pel refSample = *piIntraLineNext; 476 // Pad unavailable samples with new value 477 Int iNextOrTop = std::min<Int>(iNext, iLeftUnits); 478 // fill left column 479 while (iCurrJnit < iNextOrTop) 480 { 481 for (i=0; i<unitHeight; i++) 510 482 { 511 iNext++;483 piIntraLineCur[i] = refSample; 512 484 } 513 piRef = piAdiLine[iNext*iUnitSize]; 514 // Pad unavailable samples with new value 515 while (iCurr < iNext) 485 piIntraLineCur += unitHeight; 486 iCurrJnit++; 487 } 488 // fill top row 489 while (iCurrJnit < iNext) 490 { 491 for (i=0; i<unitWidth; i++) 516 492 { 517 for (i=0; i<iUnitSize; i++) 518 { 519 piAdiLineTemp[i] = piRef; 520 } 521 piAdiLineTemp += iUnitSize; 522 iCurr++; 493 piIntraLineCur[i] = refSample; 523 494 } 524 } 525 else 526 { 527 piRef = piAdiLine[iCurr*iUnitSize-1]; 528 for (i=0; i<iUnitSize; i++) 495 piIntraLineCur += unitWidth; 496 iCurrJnit++; 497 } 498 } 499 } 500 501 // pad all other reference samples. 502 while (iCurrJnit < iTotalUnits) 503 { 504 if (!bNeighborFlags[iCurrJnit]) // samples not available 505 { 506 { 507 const Int numSamplesInCurrUnit = (iCurrJnit >= iLeftUnits) ? unitWidth : unitHeight; 508 const Pel refSample = *(piIntraLineCur-1); 509 for (i=0; i<numSamplesInCurrUnit; i++) 529 510 { 530 pi AdiLineTemp[i] = piRef;511 piIntraLineCur[i] = refSample; 531 512 } 532 pi AdiLineTemp += iUnitSize;533 iCurr ++;534 } 535 } 536 else 537 { 538 pi AdiLineTemp += iUnitSize;539 iCurr ++;513 piIntraLineCur += numSamplesInCurrUnit; 514 iCurrJnit++; 515 } 516 } 517 else 518 { 519 piIntraLineCur += (iCurrJnit >= iLeftUnits) ? unitWidth : unitHeight; 520 iCurrJnit++; 540 521 } 541 522 } 542 523 543 524 // Copy processed samples 544 piAdiLineTemp = piAdiLine + uiHeight + iUnitSize - 2; 525 526 piIntraLineTemp = piIntraLine + uiHeight + unitWidth - 2; 527 // top left, top and top right samples 545 528 for (i=0; i<uiWidth; i++) 546 529 { 547 piAdiTemp[i] = piAdiLineTemp[i]; 548 } 549 piAdiLineTemp = piAdiLine + uiHeight - 1; 530 piIntraTemp[i] = piIntraLineTemp[i]; 531 } 532 533 piIntraLineTemp = piIntraLine + uiHeight - 1; 550 534 for (i=1; i<uiHeight; i++) 551 535 { 552 piAdiTemp[i*uiWidth] = piAdiLineTemp[-i]; 553 } 554 } 555 } 556 557 Int* TComPattern::getAdiOrgBuf( Int /*iCuWidth*/, Int /*iCuHeight*/, Int* piAdiBuf) 558 { 559 return piAdiBuf; 560 } 561 562 Int* TComPattern::getAdiCbBuf( Int /*iCuWidth*/, Int /*iCuHeight*/, Int* piAdiBuf) 563 { 564 return piAdiBuf; 565 } 566 567 Int* TComPattern::getAdiCrBuf(Int iCuWidth,Int iCuHeight, Int* piAdiBuf) 568 { 569 return piAdiBuf+(iCuWidth*2+1)*(iCuHeight*2+1); 570 } 571 572 /** Get pointer to reference samples for intra prediction 573 * \param uiDirMode prediction mode index 574 * \param log2BlkSize size of block (2 = 4x4, 3 = 8x8, 4 = 16x16, 5 = 32x32, 6 = 64x64) 575 * \param piAdiBuf pointer to unfiltered reference samples 576 * \return pointer to (possibly filtered) reference samples 577 * 578 * The prediction mode index is used to determine whether a smoothed reference sample buffer is returned. 579 */ 580 Int* TComPattern::getPredictorPtr( UInt uiDirMode, UInt log2BlkSize, Int* piAdiBuf ) 581 { 582 Int* piSrc; 583 assert(log2BlkSize >= 2 && log2BlkSize < 7); 584 Int diff = min<Int>(abs((Int) uiDirMode - HOR_IDX), abs((Int)uiDirMode - VER_IDX)); 585 UChar ucFiltIdx = diff > m_aucIntraFilter[log2BlkSize - 2] ? 1 : 0; 586 if (uiDirMode == DC_IDX) 587 { 588 ucFiltIdx = 0; //no smoothing for DC or LM chroma 589 } 590 591 assert( ucFiltIdx <= 1 ); 592 593 Int width = 1 << log2BlkSize; 594 Int height = 1 << log2BlkSize; 595 596 piSrc = getAdiOrgBuf( width, height, piAdiBuf ); 597 598 if ( ucFiltIdx ) 599 { 600 piSrc += (2 * width + 1) * (2 * height + 1); 601 } 602 603 return piSrc; 604 } 605 606 Bool TComPattern::isAboveLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT ) 536 piIntraTemp[i*uiWidth] = piIntraLineTemp[-i]; 537 } 538 } 539 } 540 541 Bool TComPrediction::filteringIntraReferenceSamples(const ComponentID compID, UInt uiDirMode, UInt uiTuChWidth, UInt uiTuChHeight, const ChromaFormat chFmt, const Bool intraReferenceSmoothingDisabled) 542 { 543 Bool bFilter; 544 545 if (!filterIntraReferenceSamples(toChannelType(compID), chFmt, intraReferenceSmoothingDisabled)) 546 { 547 bFilter=false; 548 } 549 else 550 { 551 assert(uiTuChWidth>=4 && uiTuChHeight>=4 && uiTuChWidth<128 && uiTuChHeight<128); 552 553 if (uiDirMode == DC_IDX) 554 { 555 bFilter=false; //no smoothing for DC or LM chroma 556 } 557 else 558 { 559 Int diff = min<Int>(abs((Int) uiDirMode - HOR_IDX), abs((Int)uiDirMode - VER_IDX)); 560 UInt sizeIndex=g_aucConvertToBit[uiTuChWidth]; 561 assert(sizeIndex < MAX_INTRA_FILTER_DEPTHS); 562 bFilter = diff > m_aucIntraFilter[toChannelType(compID)][sizeIndex]; 563 } 564 } 565 return bFilter; 566 } 567 568 Bool isAboveLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT ) 607 569 { 608 570 Bool bAboveLeftFlag; … … 611 573 if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) 612 574 { 613 bAboveLeftFlag = ( pcCUAboveLeft && pcCUAboveLeft-> getPredictionMode( uiPartAboveLeft ) == MODE_INTRA);575 bAboveLeftFlag = ( pcCUAboveLeft && pcCUAboveLeft->isIntra( uiPartAboveLeft ) ); 614 576 } 615 577 else … … 620 582 } 621 583 622 Int TComPattern::isAboveAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags )584 Int isAboveAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags ) 623 585 { 624 586 const UInt uiRasterPartBegin = g_auiZscanToRaster[uiPartIdxLT]; … … 634 596 if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) 635 597 { 636 if ( pcCUAbove && pcCUAbove-> getPredictionMode( uiPartAbove ) == MODE_INTRA)598 if ( pcCUAbove && pcCUAbove->isIntra( uiPartAbove ) ) 637 599 { 638 600 iNumIntra++; … … 661 623 } 662 624 663 Int TComPattern::isLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags )625 Int isLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags ) 664 626 { 665 627 const UInt uiRasterPartBegin = g_auiZscanToRaster[uiPartIdxLT]; 666 628 const UInt uiRasterPartEnd = g_auiZscanToRaster[uiPartIdxLB]+1; 667 const UInt uiIdxStep = pcCU->getPic()->getNumPartIn Width();629 const UInt uiIdxStep = pcCU->getPic()->getNumPartInCtuWidth(); 668 630 Bool *pbValidFlags = bValidFlags; 669 631 Int iNumIntra = 0; … … 675 637 if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) 676 638 { 677 if ( pcCULeft && pcCULeft-> getPredictionMode( uiPartLeft ) == MODE_INTRA)639 if ( pcCULeft && pcCULeft->isIntra( uiPartLeft ) ) 678 640 { 679 641 iNumIntra++; … … 703 665 } 704 666 705 Int TComPattern::isAboveRightAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags )667 Int isAboveRightAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags ) 706 668 { 707 669 const UInt uiNumUnitsInPU = g_auiZscanToRaster[uiPartIdxRT] - g_auiZscanToRaster[uiPartIdxLT] + 1; … … 712 674 { 713 675 UInt uiPartAboveRight; 714 TComDataCU* pcCUAboveRight = pcCU->getPUAboveRight Adi( uiPartAboveRight, uiPartIdxRT, uiOffset );676 TComDataCU* pcCUAboveRight = pcCU->getPUAboveRight( uiPartAboveRight, uiPartIdxRT, uiOffset ); 715 677 if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) 716 678 { 717 if ( pcCUAboveRight && pcCUAboveRight-> getPredictionMode( uiPartAboveRight ) == MODE_INTRA)679 if ( pcCUAboveRight && pcCUAboveRight->isIntra( uiPartAboveRight ) ) 718 680 { 719 681 iNumIntra++; … … 743 705 } 744 706 745 Int TComPattern::isBelowLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags )746 { 747 const UInt uiNumUnitsInPU = (g_auiZscanToRaster[uiPartIdxLB] - g_auiZscanToRaster[uiPartIdxLT]) / pcCU->getPic()->getNumPartIn Width() + 1;707 Int isBelowLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags ) 708 { 709 const UInt uiNumUnitsInPU = (g_auiZscanToRaster[uiPartIdxLB] - g_auiZscanToRaster[uiPartIdxLT]) / pcCU->getPic()->getNumPartInCtuWidth() + 1; 748 710 Bool *pbValidFlags = bValidFlags; 749 711 Int iNumIntra = 0; … … 752 714 { 753 715 UInt uiPartBelowLeft; 754 TComDataCU* pcCUBelowLeft = pcCU->getPUBelowLeft Adi( uiPartBelowLeft, uiPartIdxLB, uiOffset );716 TComDataCU* pcCUBelowLeft = pcCU->getPUBelowLeft( uiPartBelowLeft, uiPartIdxLB, uiOffset ); 755 717 if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) 756 718 { 757 if ( pcCUBelowLeft && pcCUBelowLeft-> getPredictionMode( uiPartBelowLeft ) == MODE_INTRA)719 if ( pcCUBelowLeft && pcCUBelowLeft->isIntra( uiPartBelowLeft ) ) 758 720 { 759 721 iNumIntra++;
Note: See TracChangeset for help on using the changeset viewer.