Ticket #1378: slice_bugfix.diff
File slice_bugfix.diff, 6.2 KB (added by cgisquet, 9 years ago) |
---|
-
../source/Lib/TLibCommon/TypeDef.h
41 41 #include <vector> 42 42 #include <cstdlib> 43 43 44 #define IBC_SLICE_BUGFIX 1 // Don't let IBC use pixels outside of slice: 1=MTK 2=Canon 45 #define IBC_VALIDATE_SLICES 1 // Print at decoder when IBC reaches outside of current slice 46 44 47 //! \ingroup TLibCommon 45 48 //! \{ 46 49 -
../source/Lib/TLibDecoder/TDecSbac.cpp
1241 1241 mvy = MvPred[uiMvpIdx].getVer() + pcCU->getCUMvField(REF_PIC_LIST_INTRABC)->getMvd(uiAbsPartIdx).getVer(); 1242 1242 1243 1243 const TComMv cMv(mvx, mvy ); 1244 #if IBC_VALIDATE_SLICES 1245 UInt raster = g_auiZscanToRaster[uiAbsPartIdx]; 1246 TComPicSym *pcSym = pcCU->getPic()->getPicSym(); 1247 Int ctuX = (pcCU->getCUPelX() + g_auiRasterToPelX[raster] + mvx) / g_uiMaxCUWidth; 1248 Int ctuY = (pcCU->getCUPelY() + g_auiRasterToPelY[raster] + mvy) / g_uiMaxCUHeight; 1249 UInt ctuAddr = ctuX + ctuY*pcSym->getFrameWidthInCtus(); 1250 if (pcSym->getCtu(ctuAddr)->getSlice()->getSliceIdx() != pcCU->getSlice()->getSliceIdx()) 1251 { 1252 printf("BV (%i,%i) for PU%u in CU %u,%u+%u, slice %u points to CTU %u, slice %u\n", 1253 mvx, mvy, uiPartIdx, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu(), uiAbsPartIdx, 1254 pcCU->getSlice()->getSliceIdx(), ctuAddr, pcSym->getCtu(ctuAddr)->getSlice()->getSliceIdx()); 1255 } 1256 #endif 1244 1257 1245 1258 pcCU->getCUMvField( REF_PIC_LIST_INTRABC )->setAllMv( cMv, pcCU->getPartitionSize( uiAbsPartIdx ), uiAbsPartIdx, uiDepth, uiPartIdx ); 1246 1259 if( pcCU->getLastIntraBCMv() != cMv) -
../source/Lib/TLibEncoder/TEncSearch.cpp
6923 6923 const UInt uiNonHashSearchWidth = pcCU->getIntraBCSearchAreaWidth( m_pcEncCfg->getIntraBCNonHashSearchWidthInCTUs() ); 6924 6924 const UInt uiCtuPelX = (cuPelX / uiMaxCuWidth) * uiMaxCuWidth; 6925 6925 const UInt uiCtuPelY = (cuPelY / uiMaxCuHeight) * uiMaxCuHeight; 6926 #if IBC_SLICE_BUGFIX 6927 const ChromaFormat format = pcCU->getPic()->getChromaFormat(); 6928 const Int iRelCUPelX = cuPelX % uiMaxCuWidth; 6929 const Int iRelCUPelY = cuPelY % uiMaxCuHeight; 6930 const Int chromaROIWidthInPixels = (((format == CHROMA_420) || (format == CHROMA_422)) && (iRoiWidth == 4) && ((iRelCUPelX & 0x4) != 0)) ? (iRoiWidth * 2) : iRoiWidth; 6931 const Int chromaROIHeightInPixels = (((format == CHROMA_420)) && (iRoiHeight == 4) && ((iRelCUPelY & 0x4) != 0)) ? (iRoiHeight * 2) : iRoiHeight; 6932 const Int chromaROIStartXInPixels = iRelCUPelX + iRoiWidth - chromaROIWidthInPixels; 6933 const Int chromaROIStartYInPixels = iRelCUPelY + iRoiHeight - chromaROIHeightInPixels; 6934 #endif 6926 6935 6927 6936 Distortion uiSad; 6928 6937 … … 6951 6960 continue; 6952 6961 } 6953 6962 } 6963 #if IBC_SLICE_BUGFIX 6964 if (!isValidIntraBCSearchArea(pcCU, 0, iTempX - cuPelX, chromaROIStartXInPixels, iTempY - cuPelY, chromaROIStartYInPixels, chromaROIWidthInPixels, chromaROIHeightInPixels, 0)) 6965 { 6966 HashLinklist = HashLinklist->next; 6967 continue; 6968 } 6969 #endif 6954 6970 6955 6971 #if SCM_S0220_IBC_PRED_CONSTRAINT 6956 6972 Int uiRefCuX = (iTempX + iRoiWidth - 1)/uiMaxCuWidth; -
../source/Lib/TLibEncoder/TEncSearch.h
380 380 return false; 381 381 } 382 382 383 #if IBC_SLICE_BUGFIX == 1 384 const Int uiPicWidthinCtu = pcCU->getPic()->getFrameWidthInCtus(); 385 Int refPelX = cuPelX + predX; 386 Int refPelY = cuPelY + predY; 387 Int uiRefCtuX = refPelX / uiMaxCuWidth; 388 Int uiRefCtuY = refPelY / uiMaxCuHeight; 389 Int refCtuAddr = uiPicWidthinCtu * uiRefCtuY + uiRefCtuX; 390 391 if (refCtuAddr < 0 || refCtuAddr >= pcCU->getPic()->getFrameWidthInCtus() || pcCU->getPic()->getCtu(refCtuAddr)->getSlice() == NULL || !pcCU->CUIsFromSameSliceAndTile(pcCU->getPic()->getCtu(refCtuAddr))) 392 { 393 return false; 394 } 395 396 Int refPelBRX = cuPelX + predX + roiWidth - 1; 397 Int refPelBRY = cuPelY + predY + roiHeight - 1; 398 Int uiRefCtuBRX = refPelBRX / uiMaxCuWidth; 399 Int uiRefCtuBRY = refPelBRY / uiMaxCuHeight; 400 Int refCtuBRAddr = uiPicWidthinCtu * uiRefCtuBRY + uiRefCtuBRX; 401 402 if( refCtuBRAddr < 0 || refCtuBRAddr >= pcCU->getPic()->getFrameWidthInCtus() || pcCU->getPic()->getCtu( refCtuBRAddr )->getSlice() == NULL || !pcCU->CUIsFromSameSliceAndTile( pcCU->getPic()->getCtu( refCtuBRAddr ) ) ) 403 { 404 return false; 405 } 406 #endif 407 #if IBC_SLICE_BUGFIX == 2 408 TComSlice *pcSlice = pcCU->getSlice(); 409 if (pcSlice->getSliceMode()) 410 { 411 TComPicSym *pcSym = pcCU->getPic()->getPicSym(); 412 Int ctuX = (cuPelX + predX) / uiMaxCuWidth; 413 Int ctuY = (cuPelY + predY) / uiMaxCuHeight; 414 UInt refCtu = ctuX + pcSym->getFrameWidthInCtus()*ctuY; 415 UInt startCtu = pcSym->getCtuTsToRsAddrMap(pcCU->getSlice()->getSliceSegmentCurStartCtuTsAddr()); 416 if (refCtu < startCtu) return false; 417 } 418 #endif 419 383 420 #if SCM_420_IBC_BUGFIX 384 421 // check boundary 385 422 if ( pcCU->getWidth( 0 ) == 8 && pcCU->getPartitionSize( 0 ) != SIZE_2Nx2N && pcCU->getSlice()->getPic()->getPicYuvOrg()->getChromaFormat() != CHROMA_444 ) -
../source/Lib/TLibEncoder/TEncSlice.cpp
794 794 pcPic->getPicYuvResi()->DefaultConvertPix( pcPic->getPicYuvOrg() ); 795 795 } 796 796 797 #if IBC_SLICE_BUGFIX 798 if (m_pcCfg->getUseHashBasedIntraBCSearch()) 799 { 800 m_pcPredSearch->xClearIntraBCHashTable(); 801 } 802 #endif 803 797 804 // for every CTU in slice 798 805 for( UInt ctuTsAddr = startCtuTsAddr; ctuTsAddr < boundingCtuTsAddr; ++ctuTsAddr) 799 806 {