Changeset 845 in 3DVCSoftware for branches/HTM-10.0rc1-dev0
- Timestamp:
- 11 Feb 2014, 22:15:54 (11 years ago)
- Location:
- branches/HTM-10.0rc1-dev0/source
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-10.0rc1-dev0/source/App/TAppDecoder/TAppDecTop.cpp
r841 r845 288 288 else 289 289 { 290 g_disableHLSTrace = true; // Tra ncing of second parsing of SH is not carried out290 g_disableHLSTrace = true; // Tracing of second parsing of SH is not carried out 291 291 } 292 292 #endif -
branches/HTM-10.0rc1-dev0/source/Lib/TLibCommon/TComRom.cpp
r838 r845 372 372 Bool g_traceTU = true; 373 373 Bool g_disableHLSTrace = false; 374 UInt64 g_stopAtCounter = 48;374 UInt64 g_stopAtCounter = 0; 375 375 Bool g_traceCopyBack = false; 376 376 Bool g_decTraceDispDer = false; 377 377 Bool g_decTraceMvFromMerge = false; 378 Bool g_stopAtPos = false; 379 Bool g_outputPos = false; 378 380 #endif 379 381 #endif … … 562 564 #if H_MV_ENC_DEC_TRAC 563 565 #if ENC_DEC_TRACE 566 Void stopAtPos( Int poc, Int layerId, Int cuPelX, Int cuPelY, Int cuWidth, Int cuHeight ) 567 { 568 569 if ( g_outputPos ) 570 { 571 std::cout << "POC\t" << poc 572 << "\tLayerId\t" << layerId 573 << "\tCuPelX\t" << cuPelX 574 << "\tCuPelY\t" << cuPelY 575 << "\tCuWidth\t" << cuWidth 576 << "\tCuHeight\t" << cuHeight 577 << std::endl; 578 } 579 580 Bool stopFlag = false; 581 if ( g_stopAtPos && poc == 0 && layerId == 4 ) 582 { 583 Bool stopAtCU = true; 584 if ( stopAtCU ) // Stop at CU with specific size 585 { 586 stopFlag = ( cuPelX == 16 ) && ( cuPelY == 112 ) && ( cuWidth == 16 ) && ( cuHeight == 16); 587 } 588 else 589 { // Stop at specific position 590 Int xPos = 18; 591 Int yPos = 112; 592 593 Int cuPelXEnd = cuPelX + cuWidth - 1; 594 Int cuPelYEnd = cuPelY + cuHeight - 1; 595 596 stopFlag = (cuPelX <= xPos ) && (cuPelXEnd >= xPos ) && (cuPelY <= yPos ) && (cuPelYEnd >= yPos ); 597 } 598 } 599 600 if ( stopFlag ) 601 { // Set breakpoint here. 602 std::cout << "Stop position. Break point here." << std::endl; 603 } 604 } 605 564 606 Void writeToTraceFile( const Char* symbolName, Int val, Bool doIt ) 565 607 { -
branches/HTM-10.0rc1-dev0/source/Lib/TLibCommon/TComRom.h
r837 r845 219 219 extern UInt64 g_stopAtCounter; // Counter to set breakpoint. 220 220 extern Bool g_traceCopyBack; // Output samples on copy back 221 extern Bool g_decTraceDispDer; // Trace derived disparity vectors (decoder only)221 extern Bool g_decTraceDispDer; // Trace derived disparity vectors (decoder only) 222 222 extern Bool g_decTraceMvFromMerge; // Trace motion vectors obtained from merge (decoder only) 223 extern Bool g_stopAtPos; // Stop at position 224 extern Bool g_outputPos; // Output position 223 225 224 226 #define DTRACE_CU(x,y) writeToTraceFile( x,y, g_traceCU ); … … 229 231 #define DTRACE_TU_S(x) writeToTraceFile( x, g_traceTU ); 230 232 231 232 233 Void writeToTraceFile( const Char* symbolName, Int val, Bool doIt ); 233 234 Void writeToTraceFile( const Char* symbolName, Bool doIt ); 235 Void stopAtPos ( Int poc, Int layerId, Int cuPelX, Int cuPelY, Int cuWidth, Int cuHeight ); 234 236 #endif 235 237 #else -
branches/HTM-10.0rc1-dev0/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp
r837 r845 41 41 #include <stdio.h> 42 42 #include <math.h> 43 44 43 //! \ingroup TLibCommon 45 44 //! \{ -
branches/HTM-10.0rc1-dev0/source/Lib/TLibCommon/TComSlice.cpp
r837 r845 1942 1942 for ( i = 0; i < iNumViews ; i++ ) 1943 1943 { 1944 m_bCamParInSliceHeader[i] = false; 1944 1945 m_aaaiCodedScale[i] = new Int*[ 2 ]; 1945 1946 m_aaaiCodedOffset[i] = new Int*[ 2 ]; -
branches/HTM-10.0rc1-dev0/source/Lib/TLibCommon/TypeDef.h
r840 r845 327 327 /////////////////////////////////// HTM-10.1 Integrations ////////////////////////////// 328 328 ///////////////////////////////////////////////////////////////////////////////////////// 329 330 329 #define UPDATE_HM13 1 330 #define H_3D_FIX_G0148_BRACE 1 331 331 ///////////////////////////////////////////////////////////////////////////////////////// 332 332 /////////////////////////////////// HM RELATED DEFINES //////////////////////////////// -
branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecCu.cpp
r837 r845 37 37 38 38 #include "TDecCu.h" 39 40 39 //! \ingroup TLibDecoder 41 40 //! \{ … … 639 638 640 639 m_ppcCU[uiDepth]->copySubCU( pcCU, uiAbsPartIdx, uiDepth ); 641 640 641 #if H_MV_ENC_DEC_TRAC 642 #if ENC_DEC_TRACE 643 stopAtPos ( m_ppcCU[uiDepth]->getSlice()->getPOC(), 644 m_ppcCU[uiDepth]->getSlice()->getLayerId(), 645 m_ppcCU[uiDepth]->getCUPelX(), 646 m_ppcCU[uiDepth]->getCUPelY(), 647 m_ppcCU[uiDepth]->getWidth(0), 648 m_ppcCU[uiDepth]->getHeight(0) ); 649 #endif 650 #endif 651 642 652 switch( m_ppcCU[uiDepth]->getPredictionMode(0) ) 643 653 { -
branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecGop.cpp
r837 r845 43 43 #include "libmd5/MD5.h" 44 44 #include "TLibCommon/SEI.h" 45 46 45 #include <time.h> 47 46 -
branches/HTM-10.0rc1-dev0/source/Lib/TLibEncoder/TEncCu.cpp
r842 r845 40 40 #include "TEncCu.h" 41 41 #include "TEncAnalyze.h" 42 43 42 #include <cmath> 44 43 #include <algorithm> … … 422 421 // get Original YUV data from picture 423 422 m_ppcOrigYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvOrg(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU() ); 424 423 425 424 #if H_3D_QTLPC 426 425 Bool bTrySplit = true; … … 449 448 UInt uiTPelY = rpcBestCU->getCUPelY(); 450 449 UInt uiBPelY = uiTPelY + rpcBestCU->getHeight(0) - 1; 450 451 #if H_MV_ENC_DEC_TRAC 452 #if ENC_DEC_TRACE 453 stopAtPos ( rpcBestCU->getSlice()->getPOC(), 454 rpcBestCU->getSlice()->getLayerId(), 455 rpcBestCU->getCUPelX(), 456 rpcBestCU->getCUPelY(), 457 rpcBestCU->getWidth(0), 458 rpcBestCU->getHeight(0) ); 459 #endif 460 #endif 451 461 452 462 Int iBaseQP = xComputeQP( rpcBestCU, uiDepth ); … … 1188 1198 if(bInSlice && ( pcSubBestPartCU->getCUPelX() < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( pcSubBestPartCU->getCUPelY() < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 1189 1199 { 1190 1191 1192 1193 1194 1195 1196 1197 1200 if ( 0 == uiPartUnitIdx) //initialize RD with previous depth buffer 1201 { 1202 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]); 1203 } 1204 else 1205 { 1206 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]); 1207 } 1198 1208 1199 1209 #if AMP_ENC_SPEEDUP … … 1226 1236 1227 1237 rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits 1228 1229 1238 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1239 } 1230 1240 #if H_3D_VSO // M10 1231 1241 if ( m_pcRdCost->getUseVSO() ) … … 1233 1243 else 1234 1244 #endif 1235 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );1245 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1236 1246 1237 1247 if( (g_uiMaxCUWidth>>uiDepth) == rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() && rpcTempCU->getSlice()->getPPS()->getUseDQP()) … … 1241 1251 { 1242 1252 if( ( pcPic->getCU( rpcTempCU->getAddr() )->getSliceSegmentStartCU(uiBlkIdx+rpcTempCU->getZorderIdxInCU()) == rpcTempCU->getSlice()->getSliceSegmentCurStartCUAddr() ) && 1243 1253 ( rpcTempCU->getCbf( uiBlkIdx, TEXT_LUMA ) || rpcTempCU->getCbf( uiBlkIdx, TEXT_CHROMA_U ) || rpcTempCU->getCbf( uiBlkIdx, TEXT_CHROMA_V ) ) ) 1244 1254 { 1245 1255 hasResidual = true; … … 1263 1273 m_pcEntropyCoder->encodeQP( rpcTempCU, uiTargetPartIdx, false ); 1264 1274 rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits 1265 1275 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1266 1276 #if H_3D_VSO // M11 1267 1277 if ( m_pcRdCost->getUseLambdaScaleVSO()) … … 1269 1279 else 1270 1280 #endif 1271 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );1281 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1272 1282 #endif 1273 1283 … … 1282 1292 } 1283 1293 1284 1294 m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 1285 1295 Bool isEndOfSlice = rpcBestCU->getSlice()->getSliceMode()==FIXED_NUMBER_OF_BYTES 1286 1296 && (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceArgument()<<3); 1287 1297 Bool isEndOfSliceSegment = rpcBestCU->getSlice()->getSliceSegmentMode()==FIXED_NUMBER_OF_BYTES 1288 1298 && (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceSegmentArgument()<<3); 1289 1299 if(isEndOfSlice||isEndOfSliceSegment) 1290 1300 { … … 1293 1303 xCheckBestMode( rpcBestCU, rpcTempCU, uiDepth); // RD compare current larger prediction 1294 1304 } // with sub partitioned prediction. 1295 1305 } 1296 1306 1297 1307 #if H_3D_VSO // M12 … … 1776 1786 #endif 1777 1787 #if H_3D_ARP 1778 for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )1779 #else 1780 for( UInt ui = 0; ui < numValidMergeCand; ++ui )1788 for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui ) 1789 #else 1790 for( UInt ui = 0; ui < numValidMergeCand; ++ui ) 1781 1791 #endif 1782 1792 { … … 1851 1861 #endif 1852 1862 1853 for( UInt uiNoResidual = 0; uiNoResidual < iteration; ++uiNoResidual )1854 {1855 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand )1856 {1863 for( UInt uiNoResidual = 0; uiNoResidual < iteration; ++uiNoResidual ) 1864 { 1865 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) 1866 { 1857 1867 #if H_3D_IC 1858 1868 if( rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag() ) … … 1866 1876 if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1)) 1867 1877 { 1868 if( !(bestIsSkip && uiNoResidual == 0) )1869 {1870 // set MC parameters1871 rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); // interprets depth relative to LCU level1872 rpcTempCU->setCUTransquantBypassSubParts( bTransquantBypassFlag, 0, uhDepth );1873 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level1878 if( !(bestIsSkip && uiNoResidual == 0) ) 1879 { 1880 // set MC parameters 1881 rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); // interprets depth relative to LCU level 1882 rpcTempCU->setCUTransquantBypassSubParts( bTransquantBypassFlag, 0, uhDepth ); 1883 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level 1874 1884 #if H_3D_IC 1875 rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth );1885 rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth ); 1876 1886 #endif 1877 1887 #if H_3D_ARP 1878 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );1879 #endif 1880 rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level1881 rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to LCU level1888 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth ); 1889 #endif 1890 rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level 1891 rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to LCU level 1882 1892 #if H_3D_VSP 1883 rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth );1884 rpcTempCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, 0, 0, uhDepth );1893 rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth ); 1894 rpcTempCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, 0, 0, uhDepth ); 1885 1895 #endif 1886 1896 #if MTK_DDD_G0063 1887 if( rpcTempCU->getSlice()->getIsDepth() && rpcTempCU->getSlice()->getViewIndex() != 0 && iDDDCand == uiMergeCand )1888 {1897 if( rpcTempCU->getSlice()->getIsDepth() && rpcTempCU->getSlice()->getViewIndex() != 0 && iDDDCand == uiMergeCand ) 1898 { 1889 1899 rpcTempCU->setUseDDD( true, 0, 0, uhDepth ); 1890 1900 rpcTempCU->setDDDepthSubParts( ucDDDepth, 0, 0, uhDepth ); 1891 }1892 else1893 {1894 rpcTempCU->setUseDDD( false, 0, 0, uhDepth );1895 }1896 #endif1897 #if H_3D_SPIVMP1898 rpcTempCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeCand], 0, 0, uhDepth);1899 if (bSPIVMPFlag[uiMergeCand])1900 {1901 UInt uiSPAddr;1902 Int iWidth = rpcTempCU->getWidth(0);1903 Int iHeight = rpcTempCU->getHeight(0);1904 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;1905 rpcTempCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);1906 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)1907 {1908 rpcTempCU->getSPAbsPartIdx(0, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);1909 rpcTempCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);1910 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);1911 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);1912 }1913 }1914 else1915 #endif1916 #if NTT_STORE_SPDV_VSP_G01481917 if ( vspFlag[uiMergeCand] )1918 {1919 UInt partAddr;1920 Int vspSize;1921 Int width, height;1922 rpcTempCU->getPartIndexAndSize( 0, partAddr, width, height );1923 if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 )1924 {1925 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize );1926 rpcTempCU->setVSPFlag( partAddr, vspSize );1927 1901 } 1928 1902 else 1929 1903 { 1930 rpcTempCU-> getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level1904 rpcTempCU->setUseDDD( false, 0, 0, uhDepth ); 1931 1905 } 1932 if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 ) 1906 #endif 1907 #if H_3D_SPIVMP 1908 rpcTempCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeCand], 0, 0, uhDepth); 1909 if (bSPIVMPFlag[uiMergeCand]) 1933 1910 { 1934 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_1 , cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize ); 1935 rpcTempCU->setVSPFlag( partAddr, vspSize ); 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 } 1936 1923 } 1937 1924 else 1925 #endif 1926 #if NTT_STORE_SPDV_VSP_G0148 1938 1927 { 1939 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 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 else 1940 { 1941 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1942 } 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 else 1949 { 1950 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1951 } 1952 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level 1953 } 1954 else 1955 { 1956 #endif 1957 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level 1958 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1959 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1960 #if NTT_STORE_SPDV_VSP_G0148 1961 } 1940 1962 } 1941 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level 1942 } 1943 else 1944 { 1945 #endif 1946 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level 1947 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1948 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1949 #if NTT_STORE_SPDV_VSP_G0148 1950 } 1951 #endif 1952 // do MC 1953 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1954 // estimate residual and encode everything 1963 #endif 1964 // do MC 1965 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1966 // estimate residual and encode everything 1955 1967 #if H_3D_VSO //M2 1956 if( m_pcRdCost->getUseRenModel() )1957 { //Reset1958 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ();1959 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight ();1960 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr ();1961 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride ();1962 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );1963 }1964 #endif 1965 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU,1966 m_ppcOrigYuv [uhDepth],1967 m_ppcPredYuvTemp[uhDepth],1968 m_ppcResiYuvTemp[uhDepth],1969 m_ppcResiYuvBest[uhDepth],1970 m_ppcRecoYuvTemp[uhDepth],1971 (uiNoResidual? true:false));1972 1973 1974 if ( uiNoResidual == 0 && rpcTempCU->getQtRootCbf(0) == 0 )1975 {1976 // If no residual when allowing for one, then set mark to not try case where residual is forced to 01977 mergeCandBuffer[uiMergeCand] = 1;1978 }1979 1980 rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth );1968 if( m_pcRdCost->getUseRenModel() ) 1969 { //Reset 1970 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 #endif 1977 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 0 1989 mergeCandBuffer[uiMergeCand] = 1; 1990 } 1991 1992 rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth ); 1981 1993 #if NTT_STORE_SPDV_VSP_G0148 // possible bug fix 1982 if( rpcTempCU->getSkipFlag(0) )1983 {1984 rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);1985 }1994 if( rpcTempCU->getSkipFlag(0) ) 1995 { 1996 rpcTempCU->setTrIdxSubParts(0, 0, uhDepth); 1997 } 1986 1998 #endif 1987 1999 #if H_3D_INTER_SDC 1988 TComDataCU *rpcTempCUPre = rpcTempCU;1989 #endif 1990 Int orgQP = rpcTempCU->getQP( 0 );1991 xCheckDQP( rpcTempCU );1992 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);2000 TComDataCU *rpcTempCUPre = rpcTempCU; 2001 #endif 2002 Int orgQP = rpcTempCU->getQP( 0 ); 2003 xCheckDQP( rpcTempCU ); 2004 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth); 1993 2005 #if H_3D_INTER_SDC 1994 if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual )1995 {2006 if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual ) 2007 { 1996 2008 #if SEC_INTER_SDC_G0101 1997 for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ ) 1998 { 2009 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 //M2 2020 if( m_pcRdCost->getUseRenModel() ) 2021 { //Reset 2022 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 #endif 2029 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 #else 1999 2041 if( rpcTempCU != rpcTempCUPre ) 2000 2042 { … … 2019 2061 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth], 2020 2062 m_ppcResiYuvTemp[uhDepth], 2021 m_ppcRecoYuvTemp[uhDepth], 2022 uiOffest, 2063 m_ppcRecoYuvTemp[uhDepth], 2023 2064 uhDepth ); 2024 2065 2025 2066 xCheckDQP( rpcTempCU ); 2026 2067 xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth ); 2068 #endif 2027 2069 } 2028 #else 2029 if( rpcTempCU != rpcTempCUPre ) 2070 #endif 2071 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag ); 2072 2073 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) 2030 2074 { 2031 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag ); 2032 rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth ); 2075 #if H_3D_INTER_SDC 2076 if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) ) 2077 { 2078 bestIsSkip = !rpcBestCU->getSDCFlag( 0 ) && ( rpcBestCU->getQtRootCbf(0) == 0 ); 2079 } 2080 else 2081 { 2082 #endif 2083 bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0; 2084 #if H_3D_INTER_SDC 2085 } 2086 #endif 2033 2087 } 2034 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );2035 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );2036 rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );2037 #if H_3D_VSO //M22038 if( m_pcRdCost->getUseRenModel() )2039 { //Reset2040 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ();2041 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight ();2042 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr ();2043 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride ();2044 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2045 }2046 #endif2047 m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,2048 m_ppcOrigYuv[uhDepth],2049 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],2050 m_ppcResiYuvTemp[uhDepth],2051 m_ppcRecoYuvTemp[uhDepth],2052 uhDepth );2053 2054 xCheckDQP( rpcTempCU );2055 xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );2056 #endif2057 }2058 #endif2059 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag );2060 2061 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip )2062 {2063 #if H_3D_INTER_SDC2064 if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) )2065 {2066 bestIsSkip = !rpcBestCU->getSDCFlag( 0 ) && ( rpcBestCU->getQtRootCbf(0) == 0 );2067 }2068 else2069 {2070 #endif2071 bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0;2072 #if H_3D_INTER_SDC2073 }2074 #endif2075 }2076 }2077 }2078 }2079 2080 if(uiNoResidual == 0 && m_pcEncCfg->getUseEarlySkipDetection())2081 {2082 if(rpcBestCU->getQtRootCbf( 0 ) == 0)2083 {2084 if( rpcBestCU->getMergeFlag( 0 ))2085 {2086 *earlyDetectionSkipMode = true;2087 }2088 else2089 {2090 Int absoulte_MV=0;2091 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )2092 {2093 if ( rpcBestCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )2094 {2095 TComCUMvField* pcCUMvField = rpcBestCU->getCUMvField(RefPicList( uiRefListIdx ));2096 Int iHor = pcCUMvField->getMvd( 0 ).getAbsHor();2097 Int iVer = pcCUMvField->getMvd( 0 ).getAbsVer();2098 absoulte_MV+=iHor+iVer;2099 2088 } 2100 2089 } 2101 2102 if(absoulte_MV == 0) 2090 } 2091 2092 if(uiNoResidual == 0 && m_pcEncCfg->getUseEarlySkipDetection()) 2093 { 2094 if(rpcBestCU->getQtRootCbf( 0 ) == 0) 2103 2095 { 2104 *earlyDetectionSkipMode = true; 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 } 2105 2119 } 2106 2120 } 2107 2121 } 2108 }2109 }2110 2122 #if H_3D_SPIVMP 2111 delete[] pcMvFieldSP;2112 delete[] puhInterDirSP;2123 delete[] pcMvFieldSP; 2124 delete[] puhInterDirSP; 2113 2125 #endif 2114 2126 #if H_3D_ARP 2115 }2127 } 2116 2128 #endif 2117 2129 } -
branches/HTM-10.0rc1-dev0/source/Lib/TLibEncoder/TEncGOP.cpp
r837 r845 49 49 #include <time.h> 50 50 #include <math.h> 51 52 51 using namespace std; 53 52 //! \ingroup TLibEncoder -
branches/HTM-10.0rc1-dev0/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r837 r845 41 41 #include <stdio.h> 42 42 #include <math.h> 43 44 43 //! \ingroup TLibEncoder 45 44 //! \{ -
branches/HTM-10.0rc1-dev0/source/Lib/TLibEncoder/TEncSearch.cpp
r843 r845 3950 3950 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 3951 3951 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 3952 3953 3952 #if NTT_STORE_SPDV_VSP_G0148 3954 3953 } … … 4043 4042 m_cYuvPredTemp.clear(); 4044 4043 rpcPredYuv->clear(); 4045 4044 4046 4045 if ( !bUseRes ) 4047 4046 { 4048 4047 rpcResiYuv->clear(); 4049 4048 } 4050 4049 4051 4050 rpcRecoYuv->clear(); 4052 4051 4053 4052 TComMv cMvSrchRngLT; 4054 4053 TComMv cMvSrchRngRB; 4055 4054 4056 4055 TComMv cMvZero; 4057 4056 TComMv TempMv; //kolya 4058 4057 4059 4058 TComMv cMv[2]; 4060 4059 TComMv cMvBi[2]; 4061 4060 TComMv cMvTemp[2][33]; 4062 4061 4063 4062 Int iNumPart = pcCU->getNumPartInter(); 4064 4063 Int iNumPredDir = pcCU->getSlice()->isInterP() ? 1 : 2; 4065 4064 4066 4065 TComMv cMvPred[2][33]; 4067 4066 4068 4067 TComMv cMvPredBi[2][33]; 4069 4068 Int aaiMvpIdxBi[2][33]; 4070 4069 4071 4070 Int aaiMvpIdx[2][33]; 4072 4071 Int aaiMvpNum[2][33]; 4073 4072 4074 4073 AMVPInfo aacAMVPInfo[2][33]; 4075 4074 4076 4075 Int iRefIdx[2]={0,0}; //If un-initialized, may cause SEGV in bi-directional prediction iterative stage. 4077 4076 Int iRefIdxBi[2]; 4078 4077 4079 4078 UInt uiPartAddr; 4080 4079 Int iRoiWidth, iRoiHeight; 4081 4080 4082 4081 UInt uiMbBits[3] = {1, 1, 0}; 4083 4082 4084 4083 UInt uiLastMode = 0; 4085 4084 Int iRefStart, iRefEnd; 4086 4085 4087 4086 PartSize ePartSize = pcCU->getPartitionSize( 0 ); 4088 4087 … … 4111 4110 UInt uiCostBi = MAX_UINT; 4112 4111 UInt uiCostTemp; 4113 4112 4114 4113 UInt uiBits[3]; 4115 4114 UInt uiBitsTemp; … … 4136 4135 4137 4136 xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits); 4138 4137 4139 4138 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); 4140 4139 … … 4142 4141 pcCU->setVSPFlagSubParts( 0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr) ); 4143 4142 #endif 4144 4143 4145 4144 #if AMP_MRG 4146 4145 Bool bTestNormalMC = true; … … 4153 4152 bTestNormalMC = false; 4154 4153 } 4155 4154 4156 4155 if (bTestNormalMC) 4157 4156 { 4158 4157 #endif 4159 4158 4160 // Uni-directional prediction4161 for ( Int iRefList = 0; iRefList < iNumPredDir; iRefList++ )4162 {4163 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );4164 4165 for ( Int iRefIdxTemp = 0; iRefIdxTemp < pcCU->getSlice()->getNumRefIdx(eRefPicList); iRefIdxTemp++ )4166 {4167 uiBitsTemp = uiMbBits[iRefList];4168 if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 )4169 {4170 uiBitsTemp += iRefIdxTemp+1;4171 if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--;4172 }4159 // Uni-directional prediction 4160 for ( Int iRefList = 0; iRefList < iNumPredDir; iRefList++ ) 4161 { 4162 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 4163 4164 for ( Int iRefIdxTemp = 0; iRefIdxTemp < pcCU->getSlice()->getNumRefIdx(eRefPicList); iRefIdxTemp++ ) 4165 { 4166 uiBitsTemp = uiMbBits[iRefList]; 4167 if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 ) 4168 { 4169 uiBitsTemp += iRefIdxTemp+1; 4170 if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--; 4171 } 4173 4172 #if ZERO_MVD_EST 4174 xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &biPDistTemp, &uiZeroMvdDistTemp);4173 xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &biPDistTemp, &uiZeroMvdDistTemp); 4175 4174 #else 4176 xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &biPDistTemp);4177 #endif 4178 aaiMvpIdx[iRefList][iRefIdxTemp] = pcCU->getMVPIdx(eRefPicList, uiPartAddr);4179 aaiMvpNum[iRefList][iRefIdxTemp] = pcCU->getMVPNum(eRefPicList, uiPartAddr);4180 4181 if(pcCU->getSlice()->getMvdL1ZeroFlag() && iRefList==1 && biPDistTemp < bestBiPDist)4182 {4183 bestBiPDist = biPDistTemp;4184 bestBiPMvpL1 = aaiMvpIdx[iRefList][iRefIdxTemp];4185 bestBiPRefIdxL1 = iRefIdxTemp;4186 }4187 4188 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS];4175 xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &biPDistTemp); 4176 #endif 4177 aaiMvpIdx[iRefList][iRefIdxTemp] = pcCU->getMVPIdx(eRefPicList, uiPartAddr); 4178 aaiMvpNum[iRefList][iRefIdxTemp] = pcCU->getMVPNum(eRefPicList, uiPartAddr); 4179 4180 if(pcCU->getSlice()->getMvdL1ZeroFlag() && iRefList==1 && biPDistTemp < bestBiPDist) 4181 { 4182 bestBiPDist = biPDistTemp; 4183 bestBiPMvpL1 = aaiMvpIdx[iRefList][iRefIdxTemp]; 4184 bestBiPRefIdxL1 = iRefIdxTemp; 4185 } 4186 4187 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 4189 4188 #if ZERO_MVD_EST 4190 if ( iRefList == 0 || pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 4191 { 4192 uiZeroMvdBitsTemp = uiBitsTemp; 4193 uiZeroMvdBitsTemp += 2; //zero mvd bits 4194 4195 m_pcRdCost->getMotionCost( 1, 0 ); 4196 uiZeroMvdCostTemp = uiZeroMvdDistTemp + m_pcRdCost->getCost(uiZeroMvdBitsTemp); 4197 4198 if (uiZeroMvdCostTemp < uiZeroMvdCost) 4189 if ( iRefList == 0 || pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 4199 4190 { 4200 uiZeroMvdCost = uiZeroMvdCostTemp; 4201 iZeroMvdDir = iRefList + 1; 4202 aiZeroMvdRefIdx[iRefList] = iRefIdxTemp; 4203 aiZeroMvdMvpIdx[iRefList] = aaiMvpIdx[iRefList][iRefIdxTemp]; 4204 auiZeroMvdBits[iRefList] = uiZeroMvdBitsTemp; 4205 } 4206 } 4207 #endif 4208 4191 uiZeroMvdBitsTemp = uiBitsTemp; 4192 uiZeroMvdBitsTemp += 2; //zero mvd bits 4193 4194 m_pcRdCost->getMotionCost( 1, 0 ); 4195 uiZeroMvdCostTemp = uiZeroMvdDistTemp + m_pcRdCost->getCost(uiZeroMvdBitsTemp); 4196 4197 if (uiZeroMvdCostTemp < uiZeroMvdCost) 4198 { 4199 uiZeroMvdCost = uiZeroMvdCostTemp; 4200 iZeroMvdDir = iRefList + 1; 4201 aiZeroMvdRefIdx[iRefList] = iRefIdxTemp; 4202 aiZeroMvdMvpIdx[iRefList] = aaiMvpIdx[iRefList][iRefIdxTemp]; 4203 auiZeroMvdBits[iRefList] = uiZeroMvdBitsTemp; 4204 } 4205 } 4206 #endif 4207 4209 4208 #if GPB_SIMPLE_UNI 4210 if ( iRefList == 1 ) // list 1 4211 { 4212 if ( pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) >= 0 ) 4209 if ( iRefList == 1 ) // list 1 4213 4210 { 4214 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )]; 4215 uiCostTemp = uiCostTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )]; 4216 /*first subtract the bit-rate part of the cost of the other list*/ 4217 uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )] ); 4218 /*correct the bit-rate part of the current ref*/ 4219 m_pcRdCost->setPredictor ( cMvPred[iRefList][iRefIdxTemp] ); 4220 uiBitsTemp += m_pcRdCost->getBits( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() ); 4221 /*calculate the correct cost*/ 4222 uiCostTemp += m_pcRdCost->getCost( uiBitsTemp ); 4211 if ( pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) >= 0 ) 4212 { 4213 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )]; 4214 uiCostTemp = uiCostTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )]; 4215 /*first subtract the bit-rate part of the cost of the other list*/ 4216 uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )] ); 4217 /*correct the bit-rate part of the current ref*/ 4218 m_pcRdCost->setPredictor ( cMvPred[iRefList][iRefIdxTemp] ); 4219 uiBitsTemp += m_pcRdCost->getBits( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() ); 4220 /*calculate the correct cost*/ 4221 uiCostTemp += m_pcRdCost->getCost( uiBitsTemp ); 4222 } 4223 else 4224 { 4225 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 4226 } 4223 4227 } 4224 4228 else … … 4226 4230 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 4227 4231 } 4232 #else 4233 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 4234 #endif 4235 xCopyAMVPInfo(pcCU->getCUMvField(eRefPicList)->getAMVPInfo(), &aacAMVPInfo[iRefList][iRefIdxTemp]); // must always be done ( also when AMVP_MODE = AM_NONE ) 4236 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 4237 4238 if ( iRefList == 0 ) 4239 { 4240 uiCostTempL0[iRefIdxTemp] = uiCostTemp; 4241 uiBitsTempL0[iRefIdxTemp] = uiBitsTemp; 4242 } 4243 if ( uiCostTemp < uiCost[iRefList] ) 4244 { 4245 uiCost[iRefList] = uiCostTemp; 4246 uiBits[iRefList] = uiBitsTemp; // storing for bi-prediction 4247 4248 // set motion 4249 cMv[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; 4250 iRefIdx[iRefList] = iRefIdxTemp; 4251 } 4252 4253 if ( iRefList == 1 && uiCostTemp < costValidList1 && pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 4254 { 4255 costValidList1 = uiCostTemp; 4256 bitsValidList1 = uiBitsTemp; 4257 4258 // set motion 4259 mvValidList1 = cMvTemp[iRefList][iRefIdxTemp]; 4260 refIdxValidList1 = iRefIdxTemp; 4261 } 4262 } 4263 } 4264 // Bi-directional prediction 4265 if ( (pcCU->getSlice()->isInterB()) && (pcCU->isBipredRestriction(iPartIdx) == false) ) 4266 { 4267 4268 cMvBi[0] = cMv[0]; cMvBi[1] = cMv[1]; 4269 iRefIdxBi[0] = iRefIdx[0]; iRefIdxBi[1] = iRefIdx[1]; 4270 4271 ::memcpy(cMvPredBi, cMvPred, sizeof(cMvPred)); 4272 ::memcpy(aaiMvpIdxBi, aaiMvpIdx, sizeof(aaiMvpIdx)); 4273 4274 UInt uiMotBits[2]; 4275 4276 if(pcCU->getSlice()->getMvdL1ZeroFlag()) 4277 { 4278 xCopyAMVPInfo(&aacAMVPInfo[1][bestBiPRefIdxL1], pcCU->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo()); 4279 pcCU->setMVPIdxSubParts( bestBiPMvpL1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4280 aaiMvpIdxBi[1][bestBiPRefIdxL1] = bestBiPMvpL1; 4281 cMvPredBi[1][bestBiPRefIdxL1] = pcCU->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo()->m_acMvCand[bestBiPMvpL1]; 4282 4283 cMvBi[1] = cMvPredBi[1][bestBiPRefIdxL1]; 4284 iRefIdxBi[1] = bestBiPRefIdxL1; 4285 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( cMvBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4286 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllRefIdx( iRefIdxBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4287 TComYuv* pcYuvPred = &m_acYuvPred[1]; 4288 motionCompensation( pcCU, pcYuvPred, REF_PIC_LIST_1, iPartIdx ); 4289 4290 uiMotBits[0] = uiBits[0] - uiMbBits[0]; 4291 uiMotBits[1] = uiMbBits[1]; 4292 4293 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1) > 1 ) 4294 { 4295 uiMotBits[1] += bestBiPRefIdxL1+1; 4296 if ( bestBiPRefIdxL1 == pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1)-1 ) uiMotBits[1]--; 4297 } 4298 4299 uiMotBits[1] += m_auiMVPIdxCost[aaiMvpIdxBi[1][bestBiPRefIdxL1]][AMVP_MAX_NUM_CANDS]; 4300 4301 uiBits[2] = uiMbBits[2] + uiMotBits[0] + uiMotBits[1]; 4302 4303 cMvTemp[1][bestBiPRefIdxL1] = cMvBi[1]; 4228 4304 } 4229 4305 else 4230 4306 { 4231 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 4232 } 4233 #else 4234 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 4235 #endif 4236 xCopyAMVPInfo(pcCU->getCUMvField(eRefPicList)->getAMVPInfo(), &aacAMVPInfo[iRefList][iRefIdxTemp]); // must always be done ( also when AMVP_MODE = AM_NONE ) 4237 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 4238 4239 if ( iRefList == 0 ) 4240 { 4241 uiCostTempL0[iRefIdxTemp] = uiCostTemp; 4242 uiBitsTempL0[iRefIdxTemp] = uiBitsTemp; 4243 } 4244 if ( uiCostTemp < uiCost[iRefList] ) 4245 { 4246 uiCost[iRefList] = uiCostTemp; 4247 uiBits[iRefList] = uiBitsTemp; // storing for bi-prediction 4248 4249 // set motion 4250 cMv[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; 4251 iRefIdx[iRefList] = iRefIdxTemp; 4252 } 4253 4254 if ( iRefList == 1 && uiCostTemp < costValidList1 && pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 4255 { 4256 costValidList1 = uiCostTemp; 4257 bitsValidList1 = uiBitsTemp; 4258 4259 // set motion 4260 mvValidList1 = cMvTemp[iRefList][iRefIdxTemp]; 4261 refIdxValidList1 = iRefIdxTemp; 4262 } 4263 } 4264 } 4265 // Bi-directional prediction 4266 if ( (pcCU->getSlice()->isInterB()) && (pcCU->isBipredRestriction(iPartIdx) == false) ) 4267 { 4268 4269 cMvBi[0] = cMv[0]; cMvBi[1] = cMv[1]; 4270 iRefIdxBi[0] = iRefIdx[0]; iRefIdxBi[1] = iRefIdx[1]; 4271 4272 ::memcpy(cMvPredBi, cMvPred, sizeof(cMvPred)); 4273 ::memcpy(aaiMvpIdxBi, aaiMvpIdx, sizeof(aaiMvpIdx)); 4274 4275 UInt uiMotBits[2]; 4276 4277 if(pcCU->getSlice()->getMvdL1ZeroFlag()) 4278 { 4279 xCopyAMVPInfo(&aacAMVPInfo[1][bestBiPRefIdxL1], pcCU->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo()); 4280 pcCU->setMVPIdxSubParts( bestBiPMvpL1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4281 aaiMvpIdxBi[1][bestBiPRefIdxL1] = bestBiPMvpL1; 4282 cMvPredBi[1][bestBiPRefIdxL1] = pcCU->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo()->m_acMvCand[bestBiPMvpL1]; 4283 4284 cMvBi[1] = cMvPredBi[1][bestBiPRefIdxL1]; 4285 iRefIdxBi[1] = bestBiPRefIdxL1; 4286 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( cMvBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4287 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllRefIdx( iRefIdxBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4288 TComYuv* pcYuvPred = &m_acYuvPred[1]; 4289 motionCompensation( pcCU, pcYuvPred, REF_PIC_LIST_1, iPartIdx ); 4290 4291 uiMotBits[0] = uiBits[0] - uiMbBits[0]; 4292 uiMotBits[1] = uiMbBits[1]; 4293 4294 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1) > 1 ) 4295 { 4296 uiMotBits[1] += bestBiPRefIdxL1+1; 4297 if ( bestBiPRefIdxL1 == pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1)-1 ) uiMotBits[1]--; 4298 } 4299 4300 uiMotBits[1] += m_auiMVPIdxCost[aaiMvpIdxBi[1][bestBiPRefIdxL1]][AMVP_MAX_NUM_CANDS]; 4301 4302 uiBits[2] = uiMbBits[2] + uiMotBits[0] + uiMotBits[1]; 4303 4304 cMvTemp[1][bestBiPRefIdxL1] = cMvBi[1]; 4305 } 4306 else 4307 { 4308 uiMotBits[0] = uiBits[0] - uiMbBits[0]; 4309 uiMotBits[1] = uiBits[1] - uiMbBits[1]; 4310 uiBits[2] = uiMbBits[2] + uiMotBits[0] + uiMotBits[1]; 4311 } 4312 4313 // 4-times iteration (default) 4314 Int iNumIter = 4; 4315 4316 // fast encoder setting: only one iteration 4317 if ( m_pcEncCfg->getUseFastEnc() || pcCU->getSlice()->getMvdL1ZeroFlag()) 4318 { 4319 iNumIter = 1; 4320 } 4321 4322 for ( Int iIter = 0; iIter < iNumIter; iIter++ ) 4323 { 4324 4325 Int iRefList = iIter % 2; 4326 if ( m_pcEncCfg->getUseFastEnc() ) 4327 { 4328 if( uiCost[0] <= uiCost[1] ) 4307 uiMotBits[0] = uiBits[0] - uiMbBits[0]; 4308 uiMotBits[1] = uiBits[1] - uiMbBits[1]; 4309 uiBits[2] = uiMbBits[2] + uiMotBits[0] + uiMotBits[1]; 4310 } 4311 4312 // 4-times iteration (default) 4313 Int iNumIter = 4; 4314 4315 // fast encoder setting: only one iteration 4316 if ( m_pcEncCfg->getUseFastEnc() || pcCU->getSlice()->getMvdL1ZeroFlag()) 4317 { 4318 iNumIter = 1; 4319 } 4320 4321 for ( Int iIter = 0; iIter < iNumIter; iIter++ ) 4322 { 4323 4324 Int iRefList = iIter % 2; 4325 if ( m_pcEncCfg->getUseFastEnc() ) 4329 4326 { 4330 iRefList = 1; 4327 if( uiCost[0] <= uiCost[1] ) 4328 { 4329 iRefList = 1; 4330 } 4331 else 4332 { 4333 iRefList = 0; 4334 } 4331 4335 } 4332 else 4336 else if ( iIter == 0 ) 4333 4337 { 4334 4338 iRefList = 0; 4335 4339 } 4336 } 4337 else if ( iIter == 0 ) 4338 { 4339 iRefList = 0; 4340 } 4341 if ( iIter == 0 && !pcCU->getSlice()->getMvdL1ZeroFlag()) 4342 { 4343 pcCU->getCUMvField(RefPicList(1-iRefList))->setAllMv( cMv[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4344 pcCU->getCUMvField(RefPicList(1-iRefList))->setAllRefIdx( iRefIdx[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4345 TComYuv* pcYuvPred = &m_acYuvPred[1-iRefList]; 4346 motionCompensation ( pcCU, pcYuvPred, RefPicList(1-iRefList), iPartIdx ); 4347 } 4348 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 4349 4350 if(pcCU->getSlice()->getMvdL1ZeroFlag()) 4351 { 4352 iRefList = 0; 4353 eRefPicList = REF_PIC_LIST_0; 4354 } 4355 4356 Bool bChanged = false; 4357 4358 iRefStart = 0; 4359 iRefEnd = pcCU->getSlice()->getNumRefIdx(eRefPicList)-1; 4360 4361 for ( Int iRefIdxTemp = iRefStart; iRefIdxTemp <= iRefEnd; iRefIdxTemp++ ) 4362 { 4363 uiBitsTemp = uiMbBits[2] + uiMotBits[1-iRefList]; 4364 if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 ) 4340 if ( iIter == 0 && !pcCU->getSlice()->getMvdL1ZeroFlag()) 4365 4341 { 4366 uiBitsTemp += iRefIdxTemp+1; 4367 if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--; 4342 pcCU->getCUMvField(RefPicList(1-iRefList))->setAllMv( cMv[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4343 pcCU->getCUMvField(RefPicList(1-iRefList))->setAllRefIdx( iRefIdx[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4344 TComYuv* pcYuvPred = &m_acYuvPred[1-iRefList]; 4345 motionCompensation ( pcCU, pcYuvPred, RefPicList(1-iRefList), iPartIdx ); 4368 4346 } 4369 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdxBi[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 4370 // call ME 4371 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPredBi[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, true ); 4372 xCopyAMVPInfo(&aacAMVPInfo[iRefList][iRefIdxTemp], pcCU->getCUMvField(eRefPicList)->getAMVPInfo()); 4373 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPredBi[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 4374 4375 if ( uiCostTemp < uiCostBi ) 4347 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 4348 4349 if(pcCU->getSlice()->getMvdL1ZeroFlag()) 4376 4350 { 4377 bChanged = true; 4378 4379 cMvBi[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; 4380 iRefIdxBi[iRefList] = iRefIdxTemp; 4381 4382 uiCostBi = uiCostTemp; 4383 uiMotBits[iRefList] = uiBitsTemp - uiMbBits[2] - uiMotBits[1-iRefList]; 4384 uiBits[2] = uiBitsTemp; 4385 4386 if(iNumIter!=1) 4351 iRefList = 0; 4352 eRefPicList = REF_PIC_LIST_0; 4353 } 4354 4355 Bool bChanged = false; 4356 4357 iRefStart = 0; 4358 iRefEnd = pcCU->getSlice()->getNumRefIdx(eRefPicList)-1; 4359 4360 for ( Int iRefIdxTemp = iRefStart; iRefIdxTemp <= iRefEnd; iRefIdxTemp++ ) 4361 { 4362 uiBitsTemp = uiMbBits[2] + uiMotBits[1-iRefList]; 4363 if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 ) 4387 4364 { 4388 // Set motion 4389 pcCU->getCUMvField( eRefPicList )->setAllMv( cMvBi[iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4390 pcCU->getCUMvField( eRefPicList )->setAllRefIdx( iRefIdxBi[iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4391 4392 TComYuv* pcYuvPred = &m_acYuvPred[iRefList]; 4393 motionCompensation( pcCU, pcYuvPred, eRefPicList, iPartIdx ); 4365 uiBitsTemp += iRefIdxTemp+1; 4366 if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--; 4367 } 4368 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdxBi[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 4369 // call ME 4370 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPredBi[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, true ); 4371 xCopyAMVPInfo(&aacAMVPInfo[iRefList][iRefIdxTemp], pcCU->getCUMvField(eRefPicList)->getAMVPInfo()); 4372 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPredBi[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 4373 4374 if ( uiCostTemp < uiCostBi ) 4375 { 4376 bChanged = true; 4377 4378 cMvBi[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; 4379 iRefIdxBi[iRefList] = iRefIdxTemp; 4380 4381 uiCostBi = uiCostTemp; 4382 uiMotBits[iRefList] = uiBitsTemp - uiMbBits[2] - uiMotBits[1-iRefList]; 4383 uiBits[2] = uiBitsTemp; 4384 4385 if(iNumIter!=1) 4386 { 4387 // Set motion 4388 pcCU->getCUMvField( eRefPicList )->setAllMv( cMvBi[iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4389 pcCU->getCUMvField( eRefPicList )->setAllRefIdx( iRefIdxBi[iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4390 4391 TComYuv* pcYuvPred = &m_acYuvPred[iRefList]; 4392 motionCompensation( pcCU, pcYuvPred, eRefPicList, iPartIdx ); 4393 } 4394 } 4395 } // for loop-iRefIdxTemp 4396 4397 if ( !bChanged ) 4398 { 4399 if ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1] ) 4400 { 4401 xCopyAMVPInfo(&aacAMVPInfo[0][iRefIdxBi[0]], pcCU->getCUMvField(REF_PIC_LIST_0)->getAMVPInfo()); 4402 xCheckBestMVP(pcCU, REF_PIC_LIST_0, cMvBi[0], cMvPredBi[0][iRefIdxBi[0]], aaiMvpIdxBi[0][iRefIdxBi[0]], uiBits[2], uiCostBi); 4403 if(!pcCU->getSlice()->getMvdL1ZeroFlag()) 4404 { 4405 xCopyAMVPInfo(&aacAMVPInfo[1][iRefIdxBi[1]], pcCU->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo()); 4406 xCheckBestMVP(pcCU, REF_PIC_LIST_1, cMvBi[1], cMvPredBi[1][iRefIdxBi[1]], aaiMvpIdxBi[1][iRefIdxBi[1]], uiBits[2], uiCostBi); 4407 } 4408 } 4409 break; 4410 } 4411 } // for loop-iter 4412 } // if (B_SLICE) 4413 #if ZERO_MVD_EST 4414 if ( (pcCU->getSlice()->isInterB()) && (pcCU->isBipredRestriction(iPartIdx) == false) ) 4415 { 4416 m_pcRdCost->getMotionCost( 1, 0 ); 4417 4418 for ( Int iL0RefIdxTemp = 0; iL0RefIdxTemp <= pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0)-1; iL0RefIdxTemp++ ) 4419 for ( Int iL1RefIdxTemp = 0; iL1RefIdxTemp <= pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1)-1; iL1RefIdxTemp++ ) 4420 { 4421 UInt uiRefIdxBitsTemp = 0; 4422 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 1 ) 4423 { 4424 uiRefIdxBitsTemp += iL0RefIdxTemp+1; 4425 if ( iL0RefIdxTemp == pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0)-1 ) uiRefIdxBitsTemp--; 4426 } 4427 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1) > 1 ) 4428 { 4429 uiRefIdxBitsTemp += iL1RefIdxTemp+1; 4430 if ( iL1RefIdxTemp == pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1)-1 ) uiRefIdxBitsTemp--; 4431 } 4432 4433 Int iL0MVPIdx = 0; 4434 Int iL1MVPIdx = 0; 4435 4436 for (iL0MVPIdx = 0; iL0MVPIdx < aaiMvpNum[0][iL0RefIdxTemp]; iL0MVPIdx++) 4437 { 4438 for (iL1MVPIdx = 0; iL1MVPIdx < aaiMvpNum[1][iL1RefIdxTemp]; iL1MVPIdx++) 4439 { 4440 uiZeroMvdBitsTemp = uiRefIdxBitsTemp; 4441 uiZeroMvdBitsTemp += uiMbBits[2]; 4442 uiZeroMvdBitsTemp += m_auiMVPIdxCost[iL0MVPIdx][aaiMvpNum[0][iL0RefIdxTemp]] + m_auiMVPIdxCost[iL1MVPIdx][aaiMvpNum[1][iL1RefIdxTemp]]; 4443 uiZeroMvdBitsTemp += 4; //zero mvd for both directions 4444 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( aacAMVPInfo[0][iL0RefIdxTemp].m_acMvCand[iL0MVPIdx], iL0RefIdxTemp, ePartSize, uiPartAddr, iPartIdx, 0 ); 4445 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( aacAMVPInfo[1][iL1RefIdxTemp].m_acMvCand[iL1MVPIdx], iL1RefIdxTemp, ePartSize, uiPartAddr, iPartIdx, 0 ); 4446 4447 xGetInterPredictionError( pcCU, pcOrgYuv, iPartIdx, uiZeroMvdDistTemp, m_pcEncCfg->getUseHADME() ); 4448 uiZeroMvdCostTemp = uiZeroMvdDistTemp + m_pcRdCost->getCost( uiZeroMvdBitsTemp ); 4449 if (uiZeroMvdCostTemp < uiZeroMvdCost) 4450 { 4451 uiZeroMvdCost = uiZeroMvdCostTemp; 4452 iZeroMvdDir = 3; 4453 aiZeroMvdMvpIdx[0] = iL0MVPIdx; 4454 aiZeroMvdMvpIdx[1] = iL1MVPIdx; 4455 aiZeroMvdRefIdx[0] = iL0RefIdxTemp; 4456 aiZeroMvdRefIdx[1] = iL1RefIdxTemp; 4457 auiZeroMvdBits[2] = uiZeroMvdBitsTemp; 4458 } 4459 } 4394 4460 } 4395 4461 } 4396 } // for loop-iRefIdxTemp 4397 4398 if ( !bChanged ) 4399 { 4400 if ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1] ) 4401 { 4402 xCopyAMVPInfo(&aacAMVPInfo[0][iRefIdxBi[0]], pcCU->getCUMvField(REF_PIC_LIST_0)->getAMVPInfo()); 4403 xCheckBestMVP(pcCU, REF_PIC_LIST_0, cMvBi[0], cMvPredBi[0][iRefIdxBi[0]], aaiMvpIdxBi[0][iRefIdxBi[0]], uiBits[2], uiCostBi); 4404 if(!pcCU->getSlice()->getMvdL1ZeroFlag()) 4405 { 4406 xCopyAMVPInfo(&aacAMVPInfo[1][iRefIdxBi[1]], pcCU->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo()); 4407 xCheckBestMVP(pcCU, REF_PIC_LIST_1, cMvBi[1], cMvPredBi[1][iRefIdxBi[1]], aaiMvpIdxBi[1][iRefIdxBi[1]], uiBits[2], uiCostBi); 4408 } 4409 } 4410 break; 4411 } 4412 } // for loop-iter 4413 } // if (B_SLICE) 4414 #if ZERO_MVD_EST 4415 if ( (pcCU->getSlice()->isInterB()) && (pcCU->isBipredRestriction(iPartIdx) == false) ) 4416 { 4417 m_pcRdCost->getMotionCost( 1, 0 ); 4418 4419 for ( Int iL0RefIdxTemp = 0; iL0RefIdxTemp <= pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0)-1; iL0RefIdxTemp++ ) 4420 for ( Int iL1RefIdxTemp = 0; iL1RefIdxTemp <= pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1)-1; iL1RefIdxTemp++ ) 4421 { 4422 UInt uiRefIdxBitsTemp = 0; 4423 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 1 ) 4424 { 4425 uiRefIdxBitsTemp += iL0RefIdxTemp+1; 4426 if ( iL0RefIdxTemp == pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0)-1 ) uiRefIdxBitsTemp--; 4427 } 4428 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1) > 1 ) 4429 { 4430 uiRefIdxBitsTemp += iL1RefIdxTemp+1; 4431 if ( iL1RefIdxTemp == pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1)-1 ) uiRefIdxBitsTemp--; 4432 } 4433 4434 Int iL0MVPIdx = 0; 4435 Int iL1MVPIdx = 0; 4436 4437 for (iL0MVPIdx = 0; iL0MVPIdx < aaiMvpNum[0][iL0RefIdxTemp]; iL0MVPIdx++) 4438 { 4439 for (iL1MVPIdx = 0; iL1MVPIdx < aaiMvpNum[1][iL1RefIdxTemp]; iL1MVPIdx++) 4440 { 4441 uiZeroMvdBitsTemp = uiRefIdxBitsTemp; 4442 uiZeroMvdBitsTemp += uiMbBits[2]; 4443 uiZeroMvdBitsTemp += m_auiMVPIdxCost[iL0MVPIdx][aaiMvpNum[0][iL0RefIdxTemp]] + m_auiMVPIdxCost[iL1MVPIdx][aaiMvpNum[1][iL1RefIdxTemp]]; 4444 uiZeroMvdBitsTemp += 4; //zero mvd for both directions 4445 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( aacAMVPInfo[0][iL0RefIdxTemp].m_acMvCand[iL0MVPIdx], iL0RefIdxTemp, ePartSize, uiPartAddr, iPartIdx, 0 ); 4446 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( aacAMVPInfo[1][iL1RefIdxTemp].m_acMvCand[iL1MVPIdx], iL1RefIdxTemp, ePartSize, uiPartAddr, iPartIdx, 0 ); 4447 4448 xGetInterPredictionError( pcCU, pcOrgYuv, iPartIdx, uiZeroMvdDistTemp, m_pcEncCfg->getUseHADME() ); 4449 uiZeroMvdCostTemp = uiZeroMvdDistTemp + m_pcRdCost->getCost( uiZeroMvdBitsTemp ); 4450 if (uiZeroMvdCostTemp < uiZeroMvdCost) 4451 { 4452 uiZeroMvdCost = uiZeroMvdCostTemp; 4453 iZeroMvdDir = 3; 4454 aiZeroMvdMvpIdx[0] = iL0MVPIdx; 4455 aiZeroMvdMvpIdx[1] = iL1MVPIdx; 4456 aiZeroMvdRefIdx[0] = iL0RefIdxTemp; 4457 aiZeroMvdRefIdx[1] = iL1RefIdxTemp; 4458 auiZeroMvdBits[2] = uiZeroMvdBitsTemp; 4459 } 4460 } 4461 } 4462 } 4463 } 4462 } 4464 4463 #endif 4465 4464 … … 4477 4476 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4478 4477 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4479 4478 4480 4479 UInt uiMEBits = 0; 4481 4480 // Set Motion Field_ … … 4489 4488 #endif 4490 4489 #if ZERO_MVD_EST 4491 if (uiZeroMvdCost <= uiCostBi && uiZeroMvdCost <= uiCost[0] && uiZeroMvdCost <= uiCost[1]) 4492 { 4493 if (iZeroMvdDir == 3) 4494 { 4495 uiLastMode = 2; 4496 4497 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( aacAMVPInfo[0][aiZeroMvdRefIdx[0]].m_acMvCand[aiZeroMvdMvpIdx[0]], aiZeroMvdRefIdx[0], ePartSize, uiPartAddr, iPartIdx, 0 ); 4498 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( aacAMVPInfo[1][aiZeroMvdRefIdx[1]].m_acMvCand[aiZeroMvdMvpIdx[1]], aiZeroMvdRefIdx[1], ePartSize, uiPartAddr, iPartIdx, 0 ); 4499 4500 pcCU->setInterDirSubParts( 3, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4501 4502 pcCU->setMVPIdxSubParts( aiZeroMvdMvpIdx[0], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4503 pcCU->setMVPNumSubParts( aaiMvpNum[0][aiZeroMvdRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4504 pcCU->setMVPIdxSubParts( aiZeroMvdMvpIdx[1], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4505 pcCU->setMVPNumSubParts( aaiMvpNum[1][aiZeroMvdRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4506 uiMEBits = auiZeroMvdBits[2]; 4507 } 4508 else if (iZeroMvdDir == 1) 4509 { 4510 uiLastMode = 0; 4511 4512 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( aacAMVPInfo[0][aiZeroMvdRefIdx[0]].m_acMvCand[aiZeroMvdMvpIdx[0]], aiZeroMvdRefIdx[0], ePartSize, uiPartAddr, iPartIdx, 0 ); 4513 4514 pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4515 4516 pcCU->setMVPIdxSubParts( aiZeroMvdMvpIdx[0], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4517 pcCU->setMVPNumSubParts( aaiMvpNum[0][aiZeroMvdRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4518 uiMEBits = auiZeroMvdBits[0]; 4519 } 4520 else if (iZeroMvdDir == 2) 4521 { 4522 uiLastMode = 1; 4523 4524 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( aacAMVPInfo[1][aiZeroMvdRefIdx[1]].m_acMvCand[aiZeroMvdMvpIdx[1]], aiZeroMvdRefIdx[1], ePartSize, uiPartAddr, iPartIdx, 0 ); 4525 4526 pcCU->setInterDirSubParts( 2, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4527 4528 pcCU->setMVPIdxSubParts( aiZeroMvdMvpIdx[1], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4529 pcCU->setMVPNumSubParts( aaiMvpNum[1][aiZeroMvdRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4530 uiMEBits = auiZeroMvdBits[1]; 4490 if (uiZeroMvdCost <= uiCostBi && uiZeroMvdCost <= uiCost[0] && uiZeroMvdCost <= uiCost[1]) 4491 { 4492 if (iZeroMvdDir == 3) 4493 { 4494 uiLastMode = 2; 4495 4496 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( aacAMVPInfo[0][aiZeroMvdRefIdx[0]].m_acMvCand[aiZeroMvdMvpIdx[0]], aiZeroMvdRefIdx[0], ePartSize, uiPartAddr, iPartIdx, 0 ); 4497 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( aacAMVPInfo[1][aiZeroMvdRefIdx[1]].m_acMvCand[aiZeroMvdMvpIdx[1]], aiZeroMvdRefIdx[1], ePartSize, uiPartAddr, iPartIdx, 0 ); 4498 4499 pcCU->setInterDirSubParts( 3, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4500 4501 pcCU->setMVPIdxSubParts( aiZeroMvdMvpIdx[0], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4502 pcCU->setMVPNumSubParts( aaiMvpNum[0][aiZeroMvdRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4503 pcCU->setMVPIdxSubParts( aiZeroMvdMvpIdx[1], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4504 pcCU->setMVPNumSubParts( aaiMvpNum[1][aiZeroMvdRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4505 uiMEBits = auiZeroMvdBits[2]; 4506 } 4507 else if (iZeroMvdDir == 1) 4508 { 4509 uiLastMode = 0; 4510 4511 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( aacAMVPInfo[0][aiZeroMvdRefIdx[0]].m_acMvCand[aiZeroMvdMvpIdx[0]], aiZeroMvdRefIdx[0], ePartSize, uiPartAddr, iPartIdx, 0 ); 4512 4513 pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4514 4515 pcCU->setMVPIdxSubParts( aiZeroMvdMvpIdx[0], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4516 pcCU->setMVPNumSubParts( aaiMvpNum[0][aiZeroMvdRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4517 uiMEBits = auiZeroMvdBits[0]; 4518 } 4519 else if (iZeroMvdDir == 2) 4520 { 4521 uiLastMode = 1; 4522 4523 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( aacAMVPInfo[1][aiZeroMvdRefIdx[1]].m_acMvCand[aiZeroMvdMvpIdx[1]], aiZeroMvdRefIdx[1], ePartSize, uiPartAddr, iPartIdx, 0 ); 4524 4525 pcCU->setInterDirSubParts( 2, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4526 4527 pcCU->setMVPIdxSubParts( aiZeroMvdMvpIdx[1], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4528 pcCU->setMVPNumSubParts( aaiMvpNum[1][aiZeroMvdRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4529 uiMEBits = auiZeroMvdBits[1]; 4530 } 4531 else 4532 { 4533 assert(0); 4534 } 4531 4535 } 4532 4536 else 4533 { 4534 assert(0); 4535 } 4536 } 4537 else 4538 #endif 4539 if ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1]) 4540 { 4541 uiLastMode = 2; 4542 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMv( cMvBi[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4543 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx( iRefIdxBi[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4544 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMv( cMvBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4545 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx( iRefIdxBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4546 4547 TempMv = cMvBi[0] - cMvPredBi[0][iRefIdxBi[0]]; 4548 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 4549 4550 TempMv = cMvBi[1] - cMvPredBi[1][iRefIdxBi[1]]; 4551 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 4552 4553 pcCU->setInterDirSubParts( 3, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4554 4555 pcCU->setMVPIdxSubParts( aaiMvpIdxBi[0][iRefIdxBi[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4556 pcCU->setMVPNumSubParts( aaiMvpNum[0][iRefIdxBi[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4557 pcCU->setMVPIdxSubParts( aaiMvpIdxBi[1][iRefIdxBi[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4558 pcCU->setMVPNumSubParts( aaiMvpNum[1][iRefIdxBi[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4559 4560 uiMEBits = uiBits[2]; 4561 } 4562 else if ( uiCost[0] <= uiCost[1] ) 4563 { 4564 uiLastMode = 0; 4537 #endif 4538 if ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1]) 4539 { 4540 uiLastMode = 2; 4541 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMv( cMvBi[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4542 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx( iRefIdxBi[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4543 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMv( cMvBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4544 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx( iRefIdxBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4545 4546 TempMv = cMvBi[0] - cMvPredBi[0][iRefIdxBi[0]]; 4547 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 4548 4549 TempMv = cMvBi[1] - cMvPredBi[1][iRefIdxBi[1]]; 4550 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 4551 4552 pcCU->setInterDirSubParts( 3, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4553 4554 pcCU->setMVPIdxSubParts( aaiMvpIdxBi[0][iRefIdxBi[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4555 pcCU->setMVPNumSubParts( aaiMvpNum[0][iRefIdxBi[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4556 pcCU->setMVPIdxSubParts( aaiMvpIdxBi[1][iRefIdxBi[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4557 pcCU->setMVPNumSubParts( aaiMvpNum[1][iRefIdxBi[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4558 4559 uiMEBits = uiBits[2]; 4560 } 4561 else if ( uiCost[0] <= uiCost[1] ) 4562 { 4563 uiLastMode = 0; 4565 4564 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMv( cMv[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4566 4565 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx( iRefIdx[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4567 TempMv = cMv[0] - cMvPred[0][iRefIdx[0]];4568 4569 pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth(0) );4570 4571 pcCU->setMVPIdxSubParts( aaiMvpIdx[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));4572 pcCU->setMVPNumSubParts( aaiMvpNum[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));4573 4574 uiMEBits = uiBits[0];4575 }4576 else4577 {4578 uiLastMode = 1;4566 TempMv = cMv[0] - cMvPred[0][iRefIdx[0]]; 4567 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 4568 pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4569 4570 pcCU->setMVPIdxSubParts( aaiMvpIdx[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4571 pcCU->setMVPNumSubParts( aaiMvpNum[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4572 4573 uiMEBits = uiBits[0]; 4574 } 4575 else 4576 { 4577 uiLastMode = 1; 4579 4578 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMv( cMv[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4580 4579 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx( iRefIdx[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4581 TempMv = cMv[1] - cMvPred[1][iRefIdx[1]];4582 4583 pcCU->setInterDirSubParts( 2, uiPartAddr, iPartIdx, pcCU->getDepth(0) );4584 4585 pcCU->setMVPIdxSubParts( aaiMvpIdx[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));4586 pcCU->setMVPNumSubParts( aaiMvpNum[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));4587 4588 uiMEBits = uiBits[1];4589 }4580 TempMv = cMv[1] - cMvPred[1][iRefIdx[1]]; 4581 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 4582 pcCU->setInterDirSubParts( 2, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4583 4584 pcCU->setMVPIdxSubParts( aaiMvpIdx[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4585 pcCU->setMVPNumSubParts( aaiMvpNum[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4586 4587 uiMEBits = uiBits[1]; 4588 } 4590 4589 #if AMP_MRG 4591 4590 } // end if bTestNormalMC … … 4650 4649 xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours 4651 4650 #if H_3D_VSP 4652 4653 4651 , vspFlag 4652 , inheritedVSPDisInfo 4654 4653 #endif 4655 4654 #if H_3D_SPIVMP 4656 4655 , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP 4657 4656 #endif 4658 4659 4657 , numValidMergeCand 4658 ); 4660 4659 if ( uiMRGCost < uiMECost ) 4661 4660 { … … 4670 4669 if( uiMRGIndex == pcCU->getUseDDDCandIdx() ) 4671 4670 { 4672 4673 4674 4675 4671 assert( vspFlag[uiMRGIndex] == 0 ); 4672 assert( bSPIVMPFlag[uiMRGIndex] == 0 ); 4673 pcCU->setUseDDD( true, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4674 pcCU->setDDDepthSubParts( pcCU->getDDTmpDepth(), uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4676 4675 } 4677 4676 else 4678 4677 { 4679 4678 pcCU->setUseDDD( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4680 4679 } 4681 4680 #endif … … 4705 4704 #if NTT_STORE_SPDV_VSP_G0148 4706 4705 #if H_3D_DBBP 4707 if ( vspFlag[uiMRGIndex] && !pcCU->getDBBPFlag(uiPartAddr) )4706 if ( vspFlag[uiMRGIndex] && !pcCU->getDBBPFlag(uiPartAddr) ) 4708 4707 #else 4709 if ( vspFlag[uiMRGIndex] ) 4710 #endif 4711 { 4712 UInt partAddrTemp; 4713 Int vspSize; 4714 Int width, height; 4715 pcCU->getPartIndexAndSize( iPartIdx, partAddrTemp, width, height ); // true or pcCU->getTotalNumPart()==256 4716 if( uiMRGInterDir & 0x01 ) 4708 if ( vspFlag[uiMRGIndex] ) 4709 #endif 4717 4710 { 4718 pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_0, cMRGMvField[0].getRefIdx(), vspSize ); 4719 pcCU->setVSPFlag( partAddrTemp, vspSize ); 4711 UInt partAddrTemp; 4712 Int vspSize; 4713 Int width, height; 4714 pcCU->getPartIndexAndSize( iPartIdx, partAddrTemp, width, height ); // true or pcCU->getTotalNumPart()==256 4715 if( uiMRGInterDir & 0x01 ) 4716 { 4717 pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_0, cMRGMvField[0].getRefIdx(), vspSize ); 4718 pcCU->setVSPFlag( partAddrTemp, vspSize ); 4719 } 4720 else 4721 { 4722 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4723 } 4724 if( uiMRGInterDir & 0x02 ) 4725 { 4726 pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_1, cMRGMvField[1].getRefIdx(), vspSize ); 4727 pcCU->setVSPFlag( partAddrTemp, vspSize ); 4728 } 4729 else 4730 { 4731 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4732 } 4733 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4720 4734 } 4721 4735 else 4736 #if H_3D_FIX_G0148_BRACE 4722 4737 { 4723 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4724 } 4725 if( uiMRGInterDir & 0x02 ) 4726 { 4727 pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_1, cMRGMvField[1].getRefIdx(), vspSize ); 4728 pcCU->setVSPFlag( partAddrTemp, vspSize ); 4729 } 4730 else 4731 { 4732 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4733 } 4734 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4735 } 4736 else 4737 #endif 4738 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4738 #endif 4739 #endif 4740 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4739 4741 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4740 4742 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4741 4742 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( cMvZero, ePartSize, uiPartAddr, 0, iPartIdx ); 4743 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( cMvZero, ePartSize, uiPartAddr, 0, iPartIdx ); 4744 4745 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4746 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4747 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4748 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4743 #if H_3D_FIX_G0148_BRACE 4744 } 4745 #endif 4746 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( cMvZero, ePartSize, uiPartAddr, 0, iPartIdx ); 4747 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( cMvZero, ePartSize, uiPartAddr, 0, iPartIdx ); 4748 4749 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4750 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4751 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4752 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4749 4753 } 4750 4754 else … … 4763 4767 pcCU->setDvInfoSubParts(OriginalDvInfo, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4764 4768 #endif 4765 4766 4767 4769 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMEMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4770 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMEMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4771 } 4768 4772 #if H_3D_SPIVMP 4769 4773 delete[] pcMvFieldSP; … … 4774 4778 // MC 4775 4779 motionCompensation ( pcCU, rpcPredYuv, REF_PIC_LIST_X, iPartIdx ); 4776 4780 4777 4781 } // end of for ( Int iPartIdx = 0; iPartIdx < iNumPart; iPartIdx++ ) 4778 4782
Note: See TracChangeset for help on using the changeset viewer.