Changeset 854 in 3DVCSoftware for branches/HTM-10.0-dev0/source/Lib/TLibEncoder/TEncCu.cpp
- Timestamp:
- 13 Feb 2014, 22:58:51 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-10.0-dev0/source/Lib/TLibEncoder/TEncCu.cpp
r852 r854 40 40 #include "TEncCu.h" 41 41 #include "TEncAnalyze.h" 42 42 43 #include <cmath> 43 44 #include <algorithm> … … 421 422 // get Original YUV data from picture 422 423 m_ppcOrigYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvOrg(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU() ); 423 424 424 425 #if H_3D_QTLPC 425 426 Bool bTrySplit = true; … … 1198 1199 if(bInSlice && ( pcSubBestPartCU->getCUPelX() < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( pcSubBestPartCU->getCUPelY() < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 1199 1200 { 1200 if ( 0 == uiPartUnitIdx) //initialize RD with previous depth buffer1201 {1202 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);1203 }1204 else1205 {1206 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]);1207 }1201 if ( 0 == uiPartUnitIdx) //initialize RD with previous depth buffer 1202 { 1203 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]); 1204 } 1205 else 1206 { 1207 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]); 1208 } 1208 1209 1209 1210 #if AMP_ENC_SPEEDUP … … 1236 1237 1237 1238 rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits 1238 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();1239 }1239 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1240 } 1240 1241 #if H_3D_VSO // M10 1241 1242 if ( m_pcRdCost->getUseVSO() ) … … 1243 1244 else 1244 1245 #endif 1245 1246 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1246 1247 1247 1248 if( (g_uiMaxCUWidth>>uiDepth) == rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() && rpcTempCU->getSlice()->getPPS()->getUseDQP()) … … 1251 1252 { 1252 1253 if( ( pcPic->getCU( rpcTempCU->getAddr() )->getSliceSegmentStartCU(uiBlkIdx+rpcTempCU->getZorderIdxInCU()) == rpcTempCU->getSlice()->getSliceSegmentCurStartCUAddr() ) && 1253 ( rpcTempCU->getCbf( uiBlkIdx, TEXT_LUMA ) || rpcTempCU->getCbf( uiBlkIdx, TEXT_CHROMA_U ) || rpcTempCU->getCbf( uiBlkIdx, TEXT_CHROMA_V ) ) )1254 ( rpcTempCU->getCbf( uiBlkIdx, TEXT_LUMA ) || rpcTempCU->getCbf( uiBlkIdx, TEXT_CHROMA_U ) || rpcTempCU->getCbf( uiBlkIdx, TEXT_CHROMA_V ) ) ) 1254 1255 { 1255 1256 hasResidual = true; … … 1273 1274 m_pcEntropyCoder->encodeQP( rpcTempCU, uiTargetPartIdx, false ); 1274 1275 rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits 1275 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();1276 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1276 1277 #if H_3D_VSO // M11 1277 1278 if ( m_pcRdCost->getUseLambdaScaleVSO()) … … 1279 1280 else 1280 1281 #endif 1281 1282 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1282 1283 #endif 1283 1284 … … 1292 1293 } 1293 1294 1294 m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);1295 m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 1295 1296 Bool isEndOfSlice = rpcBestCU->getSlice()->getSliceMode()==FIXED_NUMBER_OF_BYTES 1296 && (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceArgument()<<3);1297 && (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceArgument()<<3); 1297 1298 Bool isEndOfSliceSegment = rpcBestCU->getSlice()->getSliceSegmentMode()==FIXED_NUMBER_OF_BYTES 1298 && (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceSegmentArgument()<<3);1299 && (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceSegmentArgument()<<3); 1299 1300 if(isEndOfSlice||isEndOfSliceSegment) 1300 1301 { … … 1303 1304 xCheckBestMode( rpcBestCU, rpcTempCU, uiDepth); // RD compare current larger prediction 1304 1305 } // with sub partitioned prediction. 1305 }1306 } 1306 1307 1307 1308 #if H_3D_VSO // M12 … … 1786 1787 #endif 1787 1788 #if H_3D_ARP 1788 1789 #else 1790 1789 for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui ) 1790 #else 1791 for( UInt ui = 0; ui < numValidMergeCand; ++ui ) 1791 1792 #endif 1792 1793 { … … 1861 1862 #endif 1862 1863 1863 1864 1865 1866 1864 for( UInt uiNoResidual = 0; uiNoResidual < iteration; ++uiNoResidual ) 1865 { 1866 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) 1867 { 1867 1868 #if H_3D_IC 1868 1869 if( rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag() ) … … 1876 1877 if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1)) 1877 1878 { 1878 if( !(bestIsSkip && uiNoResidual == 0) ) 1879 if( !(bestIsSkip && uiNoResidual == 0) ) 1880 { 1881 // set MC parameters 1882 rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); // interprets depth relative to LCU level 1883 rpcTempCU->setCUTransquantBypassSubParts( bTransquantBypassFlag, 0, uhDepth ); 1884 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level 1885 #if H_3D_IC 1886 rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth ); 1887 #endif 1888 #if H_3D_ARP 1889 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth ); 1890 #endif 1891 rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level 1892 rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to LCU level 1893 #if H_3D_VSP 1894 rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth ); 1895 rpcTempCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, 0, 0, uhDepth ); 1896 #endif 1897 #if MTK_DDD_G0063 1898 if( rpcTempCU->getSlice()->getIsDepth() && rpcTempCU->getSlice()->getViewIndex() != 0 && iDDDCand == uiMergeCand ) 1879 1899 { 1880 // set MC parameters1881 rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); // interprets depth relative to LCU level1882 rpcTempCU->setCUTransquantBypassSubParts( bTransquantBypassFlag, 0, uhDepth );1883 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level1884 #if H_3D_IC1885 rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth );1886 #endif1887 #if H_3D_ARP1888 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );1889 #endif1890 rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level1891 rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to LCU level1892 #if H_3D_VSP1893 rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth );1894 rpcTempCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, 0, 0, uhDepth );1895 #endif1896 #if MTK_DDD_G00631897 if( rpcTempCU->getSlice()->getIsDepth() && rpcTempCU->getSlice()->getViewIndex() != 0 && iDDDCand == uiMergeCand )1898 {1899 1900 rpcTempCU->setUseDDD( true, 0, 0, uhDepth ); 1900 1901 rpcTempCU->setDDDepthSubParts( ucDDDepth, 0, 0, uhDepth ); 1902 } 1903 else 1904 { 1905 rpcTempCU->setUseDDD( false, 0, 0, uhDepth ); 1906 } 1907 #endif 1908 #if H_3D_SPIVMP 1909 rpcTempCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeCand], 0, 0, uhDepth); 1910 if (bSPIVMPFlag[uiMergeCand]) 1911 { 1912 UInt uiSPAddr; 1913 Int iWidth = rpcTempCU->getWidth(0); 1914 Int iHeight = rpcTempCU->getHeight(0); 1915 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; 1916 rpcTempCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); 1917 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++) 1918 { 1919 rpcTempCU->getSPAbsPartIdx(0, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr); 1920 rpcTempCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight); 1921 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight); 1922 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight); 1923 } 1924 } 1925 else 1926 #endif 1927 #if NTT_STORE_SPDV_VSP_G0148 1928 { 1929 if ( vspFlag[uiMergeCand] ) 1930 { 1931 UInt partAddr; 1932 Int vspSize; 1933 Int width, height; 1934 rpcTempCU->getPartIndexAndSize( 0, partAddr, width, height ); 1935 if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 ) 1936 { 1937 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize ); 1938 rpcTempCU->setVSPFlag( partAddr, vspSize ); 1901 1939 } 1902 1940 else 1903 1941 { 1904 rpcTempCU-> setUseDDD( false, 0, 0, uhDepth );1942 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1905 1943 } 1906 #endif 1907 #if H_3D_SPIVMP 1908 rpcTempCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeCand], 0, 0, uhDepth); 1909 if (bSPIVMPFlag[uiMergeCand]) 1944 if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 ) 1910 1945 { 1911 UInt uiSPAddr; 1912 Int iWidth = rpcTempCU->getWidth(0); 1913 Int iHeight = rpcTempCU->getHeight(0); 1914 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; 1915 rpcTempCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); 1916 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++) 1917 { 1918 rpcTempCU->getSPAbsPartIdx(0, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr); 1919 rpcTempCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight); 1920 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight); 1921 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight); 1922 } 1946 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_1 , cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize ); 1947 rpcTempCU->setVSPFlag( partAddr, vspSize ); 1923 1948 } 1924 1949 else 1925 #endif 1950 { 1951 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1952 } 1953 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level 1954 } 1955 else 1956 { 1957 #endif 1958 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level 1959 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1960 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1926 1961 #if NTT_STORE_SPDV_VSP_G0148 1962 } 1963 } 1964 #endif 1965 // do MC 1966 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1967 // estimate residual and encode everything 1968 #if H_3D_VSO //M2 1969 if( m_pcRdCost->getUseRenModel() ) 1970 { //Reset 1971 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth (); 1972 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight (); 1973 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr (); 1974 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride (); 1975 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 1976 } 1977 #endif 1978 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, 1979 m_ppcOrigYuv [uhDepth], 1980 m_ppcPredYuvTemp[uhDepth], 1981 m_ppcResiYuvTemp[uhDepth], 1982 m_ppcResiYuvBest[uhDepth], 1983 m_ppcRecoYuvTemp[uhDepth], 1984 (uiNoResidual? true:false)); 1985 1986 1987 if ( uiNoResidual == 0 && rpcTempCU->getQtRootCbf(0) == 0 ) 1988 { 1989 // If no residual when allowing for one, then set mark to not try case where residual is forced to 0 1990 mergeCandBuffer[uiMergeCand] = 1; 1991 } 1992 1993 rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth ); 1994 #if NTT_STORE_SPDV_VSP_G0148 // possible bug fix 1995 if( rpcTempCU->getSkipFlag(0) ) 1996 { 1997 rpcTempCU->setTrIdxSubParts(0, 0, uhDepth); 1998 } 1999 #endif 2000 #if H_3D_INTER_SDC 2001 TComDataCU *rpcTempCUPre = rpcTempCU; 2002 #endif 2003 Int orgQP = rpcTempCU->getQP( 0 ); 2004 xCheckDQP( rpcTempCU ); 2005 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth); 2006 #if H_3D_INTER_SDC 2007 if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual ) 2008 { 2009 #if SEC_INTER_SDC_G0101 2010 for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ ) 1927 2011 { 1928 if ( vspFlag[uiMergeCand] )1929 {1930 UInt partAddr;1931 Int vspSize;1932 Int width, height;1933 rpcTempCU->getPartIndexAndSize( 0, partAddr, width, height );1934 if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 )1935 {1936 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize );1937 rpcTempCU->setVSPFlag( partAddr, vspSize );1938 }1939 else1940 {1941 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level1942 }1943 if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 )1944 {1945 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_1 , cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize );1946 rpcTempCU->setVSPFlag( partAddr, vspSize );1947 }1948 else1949 {1950 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level1951 }1952 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level1953 }1954 else1955 {1956 #endif1957 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level1958 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level1959 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level1960 #if NTT_STORE_SPDV_VSP_G01481961 }1962 }1963 #endif1964 // do MC1965 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );1966 // estimate residual and encode everything1967 #if H_3D_VSO //M21968 if( m_pcRdCost->getUseRenModel() )1969 { //Reset1970 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ();1971 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight ();1972 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr ();1973 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride ();1974 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );1975 }1976 #endif1977 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU,1978 m_ppcOrigYuv [uhDepth],1979 m_ppcPredYuvTemp[uhDepth],1980 m_ppcResiYuvTemp[uhDepth],1981 m_ppcResiYuvBest[uhDepth],1982 m_ppcRecoYuvTemp[uhDepth],1983 (uiNoResidual? true:false));1984 1985 1986 if ( uiNoResidual == 0 && rpcTempCU->getQtRootCbf(0) == 0 )1987 {1988 // If no residual when allowing for one, then set mark to not try case where residual is forced to 01989 mergeCandBuffer[uiMergeCand] = 1;1990 }1991 1992 rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth );1993 #if NTT_STORE_SPDV_VSP_G0148 // possible bug fix1994 if( rpcTempCU->getSkipFlag(0) )1995 {1996 rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);1997 }1998 #endif1999 #if H_3D_INTER_SDC2000 TComDataCU *rpcTempCUPre = rpcTempCU;2001 #endif2002 Int orgQP = rpcTempCU->getQP( 0 );2003 xCheckDQP( rpcTempCU );2004 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);2005 #if H_3D_INTER_SDC2006 if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual )2007 {2008 #if SEC_INTER_SDC_G01012009 for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ )2010 {2011 if( rpcTempCU != rpcTempCUPre )2012 {2013 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag );2014 rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );2015 }2016 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );2017 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );2018 rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );2019 #if H_3D_VSO //M22020 if( m_pcRdCost->getUseRenModel() )2021 { //Reset2022 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ();2023 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight ();2024 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr ();2025 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride ();2026 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2027 }2028 #endif2029 m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,2030 m_ppcOrigYuv[uhDepth],2031 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],2032 m_ppcResiYuvTemp[uhDepth],2033 m_ppcRecoYuvTemp[uhDepth],2034 uiOffest,2035 uhDepth );2036 2037 xCheckDQP( rpcTempCU );2038 xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );2039 }2040 #else2041 2012 if( rpcTempCU != rpcTempCUPre ) 2042 2013 { … … 2061 2032 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth], 2062 2033 m_ppcResiYuvTemp[uhDepth], 2063 m_ppcRecoYuvTemp[uhDepth], 2034 m_ppcRecoYuvTemp[uhDepth], 2035 uiOffest, 2064 2036 uhDepth ); 2065 2037 2066 2038 xCheckDQP( rpcTempCU ); 2067 2039 xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth ); 2068 #endif2069 2040 } 2070 #endif 2071 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag ); 2072 2073 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) 2041 #else 2042 if( rpcTempCU != rpcTempCUPre ) 2074 2043 { 2044 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag ); 2045 rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth ); 2046 } 2047 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth ); 2048 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth ); 2049 rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth ); 2050 #if H_3D_VSO //M2 2051 if( m_pcRdCost->getUseRenModel() ) 2052 { //Reset 2053 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth (); 2054 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight (); 2055 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr (); 2056 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride (); 2057 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 2058 } 2059 #endif 2060 m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU, 2061 m_ppcOrigYuv[uhDepth], 2062 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth], 2063 m_ppcResiYuvTemp[uhDepth], 2064 m_ppcRecoYuvTemp[uhDepth], 2065 uhDepth ); 2066 2067 xCheckDQP( rpcTempCU ); 2068 xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth ); 2069 #endif 2070 } 2071 #endif 2072 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag ); 2073 2074 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) 2075 { 2075 2076 #if H_3D_INTER_SDC 2076 2077 2078 2079 2080 2081 2082 #endif 2083 2077 if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) ) 2078 { 2079 bestIsSkip = !rpcBestCU->getSDCFlag( 0 ) && ( rpcBestCU->getQtRootCbf(0) == 0 ); 2080 } 2081 else 2082 { 2083 #endif 2084 bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0; 2084 2085 #if H_3D_INTER_SDC 2085 } 2086 #endif 2087 } 2086 } 2087 #endif 2088 } 2089 } 2090 } 2091 } 2092 2093 if(uiNoResidual == 0 && m_pcEncCfg->getUseEarlySkipDetection()) 2094 { 2095 if(rpcBestCU->getQtRootCbf( 0 ) == 0) 2096 { 2097 if( rpcBestCU->getMergeFlag( 0 )) 2098 { 2099 *earlyDetectionSkipMode = true; 2100 } 2101 else 2102 { 2103 Int absoulte_MV=0; 2104 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 2105 { 2106 if ( rpcBestCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) 2107 { 2108 TComCUMvField* pcCUMvField = rpcBestCU->getCUMvField(RefPicList( uiRefListIdx )); 2109 Int iHor = pcCUMvField->getMvd( 0 ).getAbsHor(); 2110 Int iVer = pcCUMvField->getMvd( 0 ).getAbsVer(); 2111 absoulte_MV+=iHor+iVer; 2088 2112 } 2089 2113 } 2090 } 2091 2092 if(uiNoResidual == 0 && m_pcEncCfg->getUseEarlySkipDetection()) 2093 { 2094 if(rpcBestCU->getQtRootCbf( 0 ) == 0) 2114 2115 if(absoulte_MV == 0) 2095 2116 { 2096 if( rpcBestCU->getMergeFlag( 0 )) 2097 { 2098 *earlyDetectionSkipMode = true; 2099 } 2100 else 2101 { 2102 Int absoulte_MV=0; 2103 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 2104 { 2105 if ( rpcBestCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) 2106 { 2107 TComCUMvField* pcCUMvField = rpcBestCU->getCUMvField(RefPicList( uiRefListIdx )); 2108 Int iHor = pcCUMvField->getMvd( 0 ).getAbsHor(); 2109 Int iVer = pcCUMvField->getMvd( 0 ).getAbsVer(); 2110 absoulte_MV+=iHor+iVer; 2111 } 2112 } 2113 2114 if(absoulte_MV == 0) 2115 { 2116 *earlyDetectionSkipMode = true; 2117 } 2118 } 2117 *earlyDetectionSkipMode = true; 2119 2118 } 2120 2119 } 2121 2120 } 2121 } 2122 } 2122 2123 #if H_3D_SPIVMP 2123 2124 2124 delete[] pcMvFieldSP; 2125 delete[] puhInterDirSP; 2125 2126 #endif 2126 2127 #if H_3D_ARP 2127 2128 } 2128 2129 #endif 2129 2130 }
Note: See TracChangeset for help on using the changeset viewer.