Changeset 1325 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibEncoder
- Timestamp:
- 22 Jul 2015, 00:35:39 (10 years ago)
- Location:
- branches/SHM-dev/source/Lib/TLibEncoder
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h
r1324 r1325 370 370 371 371 Bool m_useStrongIntraSmoothing; ///< enable the use of strong intra smoothing (bi_linear interpolation) for 32x32 blocks when reference samples are flat. 372 Bool m_bEfficientFieldIRAPEnabled; ///< enable to code fields in a specific, potentially more efficient, order. 373 372 374 #if SVC_EXTENSION 373 375 UInt m_layerId; … … 896 898 Bool getUseStrongIntraSmoothing () { return m_useStrongIntraSmoothing; } 897 899 900 Void setEfficientFieldIRAPEnabled( Bool b ) { m_bEfficientFieldIRAPEnabled = b; } 901 Bool getEfficientFieldIRAPEnabled( ) const { return m_bEfficientFieldIRAPEnabled; } 902 898 903 Void setActiveParameterSetsSEIEnabled ( Int b ) { m_activeParameterSetsSEIEnabled = b; } 899 904 Int getActiveParameterSetsSEIEnabled () { return m_activeParameterSetsSEIEnabled; } -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r1321 r1325 997 997 pictureTimingSEI->m_auCpbRemovalDelay = std::min<Int>(std::max<Int>(1, m_totalCoded - m_lastBPSEI), static_cast<Int>(pow(2, static_cast<Double>(hrd->getCpbRemovalDelayLengthMinus1()+1)))); // Syntax element signalled as minus, hence the . 998 998 pictureTimingSEI->m_picDpbOutputDelay = slice->getSPS()->getNumReorderPics(slice->getSPS()->getMaxTLayers()-1) + slice->getPOC() - m_totalCoded; 999 #if EFFICIENT_FIELD_IRAP 1000 if(IRAPGOPid > 0 && IRAPGOPid < m_iGopSize) 999 if(m_pcCfg->getEfficientFieldIRAPEnabled() && IRAPGOPid > 0 && IRAPGOPid < m_iGopSize) 1001 1000 { 1002 1001 // if pictures have been swapped there is likely one more picture delay on their tid. Very rough approximation 1003 1002 pictureTimingSEI->m_picDpbOutputDelay ++; 1004 1003 } 1005 #endif1006 1004 Int factor = hrd->getTickDivisorMinus2() + 2; 1007 1005 pictureTimingSEI->m_picDpbOutputDuDelay = factor * pictureTimingSEI->m_picDpbOutputDelay; … … 1285 1283 } 1286 1284 1287 #if EFFICIENT_FIELD_IRAP1288 1285 class EfficientFieldIRAPMapping 1289 1286 { … … 1300 1297 { } 1301 1298 1299 #if SVC_EXTENSION 1302 1300 Void initialize(const Bool isField, const Int picIdInGOP, const Int gopSize, const Int POCLast, const Int numPicRcvd, const Int lastIDR, TEncGOP *pEncGop, TEncCfg *pCfg); 1301 #else 1302 Void initialize(const Bool isField, const Int gopSize, const Int POCLast, const Int numPicRcvd, const Int lastIDR, TEncGOP *pEncGop, TEncCfg *pCfg); 1303 #endif 1303 1304 1304 1305 Int adjustGOPid(const Int gopID); … … 1422 1423 } 1423 1424 1424 #endif1425 1425 1426 1426 static UInt calculateCollocatedFromL1Flag(TEncCfg *pCfg, const Int GOPid, const Int gopSize) … … 1504 1504 SEIDecodingUnitInfo decodingUnitInfoSEI; 1505 1505 1506 #if EFFICIENT_FIELD_IRAP1507 1506 EfficientFieldIRAPMapping effFieldIRAPMap; 1507 if (m_pcCfg->getEfficientFieldIRAPEnabled()) 1508 { 1508 1509 #if SVC_EXTENSION 1509 effFieldIRAPMap.initialize(isField, iPicIdInGOP, m_iGopSize, iPOCLast, iNumPicRcvd, m_iLastIDR, this, m_pcCfg);1510 #else 1511 effFieldIRAPMap.initialize(isField, m_iGopSize, iPOCLast, iNumPicRcvd, m_iLastIDR, this, m_pcCfg);1512 #endif 1513 #endif 1510 effFieldIRAPMap.initialize(isField, iPicIdInGOP, m_iGopSize, iPOCLast, iNumPicRcvd, m_iLastIDR, this, m_pcCfg); 1511 #else 1512 effFieldIRAPMap.initialize(isField, m_iGopSize, iPOCLast, iNumPicRcvd, m_iLastIDR, this, m_pcCfg); 1513 #endif 1514 } 1514 1515 1515 1516 // reset flag indicating whether pictures have been encoded … … 1524 1525 #endif 1525 1526 { 1526 #if EFFICIENT_FIELD_IRAP 1527 iGOPid=effFieldIRAPMap.adjustGOPid(iGOPid); 1528 #endif 1527 if (m_pcCfg->getEfficientFieldIRAPEnabled()) 1528 { 1529 iGOPid=effFieldIRAPMap.adjustGOPid(iGOPid); 1530 } 1529 1531 1530 1532 //-- For time output for each slice … … 1555 1557 if(pocCurr>=m_pcCfg->getFramesToBeEncoded()) 1556 1558 { 1557 #if EFFICIENT_FIELD_IRAP 1558 iGOPid=effFieldIRAPMap.restoreGOPid(iGOPid); 1559 #endif 1559 if (m_pcCfg->getEfficientFieldIRAPEnabled()) 1560 { 1561 iGOPid=effFieldIRAPMap.restoreGOPid(iGOPid); 1562 } 1560 1563 continue; 1561 1564 } … … 1898 1901 } 1899 1902 } 1900 1901 #if EFFICIENT_FIELD_IRAP 1902 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP1903 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL1904 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP1905 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL1906 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP1907 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // IRAP picture1908 {1909 m_associatedIRAPType = pcSlice->getNalUnitType();1903 if (m_pcCfg->getEfficientFieldIRAPEnabled()) 1904 { 1905 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1906 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1907 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 1908 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL 1909 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP 1910 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // IRAP picture 1911 { 1912 m_associatedIRAPType = pcSlice->getNalUnitType(); 1910 1913 #if SVC_POC 1911 m_associatedIRAPPOC = pcSlice->getPOC();1912 m_associatedIrapPocBeforeReset = pocCurr;1913 #else 1914 m_associatedIRAPPOC = pocCurr;1915 #endif 1916 }1917 pcSlice->setAssociatedIRAPType(m_associatedIRAPType);1918 pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC);1914 m_associatedIRAPPOC = pcSlice->getPOC(); 1915 m_associatedIrapPocBeforeReset = pocCurr; 1916 #else 1917 m_associatedIRAPPOC = pocCurr; 1918 #endif 1919 } 1920 pcSlice->setAssociatedIRAPType(m_associatedIRAPType); 1921 pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC); 1919 1922 #if SVC_POC 1920 pcSlice->setAssociatedIrapPocBeforeReset(m_associatedIrapPocBeforeReset);1921 #endif 1922 #endif 1923 pcSlice->setAssociatedIrapPocBeforeReset(m_associatedIrapPocBeforeReset); 1924 #endif 1925 } 1923 1926 // Do decoding refresh marking if any 1924 1927 #if NO_CLRAS_OUTPUT_FLAG 1925 pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic, m_pc EncTop->getNoClrasOutputFlag());1926 #else 1927 pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic );1928 pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic, m_pcCfg->getEfficientFieldIRAPEnabled(), m_pcEncTop->getNoClrasOutputFlag()); 1929 #else 1930 pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic, m_pcCfg->getEfficientFieldIRAPEnabled()); 1928 1931 #endif 1929 1932 #if SVC_POC … … 1933 1936 m_pcEncTop->selectReferencePictureSet(pcSlice, pocCurr, iGOPid); 1934 1937 pcSlice->getRPS()->setNumberOfLongtermPictures(0); 1935 #if !EFFICIENT_FIELD_IRAP 1936 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1937 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1938 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 1939 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL 1940 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP 1941 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // IRAP picture 1942 { 1943 m_associatedIRAPType = pcSlice->getNalUnitType(); 1944 m_associatedIRAPPOC = pocCurr; 1945 } 1946 pcSlice->setAssociatedIRAPType(m_associatedIRAPType); 1947 pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC); 1948 #endif 1938 if (!m_pcCfg->getEfficientFieldIRAPEnabled()) 1939 { 1940 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1941 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1942 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 1943 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL 1944 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP 1945 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // IRAP picture 1946 { 1947 m_associatedIRAPType = pcSlice->getNalUnitType(); 1948 m_associatedIRAPPOC = pocCurr; 1949 } 1950 pcSlice->setAssociatedIRAPType(m_associatedIRAPType); 1951 pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC); 1952 } 1949 1953 1950 1954 #if ALLOW_RECOVERY_POINT_AS_RAP 1951 1955 if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false, m_iLastRecoveryPicPOC, m_pcCfg->getDecodingRefreshType() == 3) != 0) || (pcSlice->isIRAP()) 1952 #if EFFICIENT_FIELD_IRAP 1953 || (isField && pcSlice->getAssociatedIRAPType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getAssociatedIRAPType() <= NAL_UNIT_CODED_SLICE_CRA && pcSlice->getAssociatedIRAPPOC() == pcSlice->getPOC()+1) 1954 #endif 1956 || (m_pcCfg->getEfficientFieldIRAPEnabled() && isField && pcSlice->getAssociatedIRAPType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getAssociatedIRAPType() <= NAL_UNIT_CODED_SLICE_CRA && pcSlice->getAssociatedIRAPPOC() == pcSlice->getPOC()+1) 1955 1957 ) 1956 1958 { 1957 pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP(), m_iLastRecoveryPicPOC, m_pcCfg->getDecodingRefreshType() == 3 );1959 pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP(), m_iLastRecoveryPicPOC, m_pcCfg->getDecodingRefreshType() == 3, m_pcCfg->getEfficientFieldIRAPEnabled()); 1958 1960 } 1959 1961 #else 1960 1962 if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false) != 0) || (pcSlice->isIRAP())) 1961 1963 { 1962 pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP() );1964 pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP(), m_pcCfg->getEfficientFieldIRAPEnabled()); 1963 1965 } 1964 1966 #endif … … 2838 2840 } 2839 2841 2840 #if EFFICIENT_FIELD_IRAP 2841 xCreatePictureTimingSEI(effFieldIRAPMap.GetIRAPGOPid(), leadingSeiMessages, nestedSeiMessages, duInfoSeiMessages, pcSlice, isField, duData); 2842 #else 2843 xCreatePictureTimingSEI(0, leadingSeiMessages, nestedSeiMessages, duInfoSeiMessages, pcSlice, isField, duData); 2844 #endif 2842 xCreatePictureTimingSEI(m_pcCfg->getEfficientFieldIRAPEnabled()?effFieldIRAPMap.GetIRAPGOPid():0, leadingSeiMessages, nestedSeiMessages, duInfoSeiMessages, pcSlice, isField, duData); 2845 2843 if (m_pcCfg->getScalableNestingSEIEnabled()) 2846 2844 { … … 2894 2892 fflush(stdout); 2895 2893 2896 #if EFFICIENT_FIELD_IRAP 2897 iGOPid=effFieldIRAPMap.restoreGOPid(iGOPid); 2898 #endif 2894 if (m_pcCfg->getEfficientFieldIRAPEnabled()) 2895 { 2896 iGOPid=effFieldIRAPMap.restoreGOPid(iGOPid); 2897 } 2899 2898 } // iGOPid-loop 2900 2899 … … 3477 3476 } 3478 3477 3479 #if EFFICIENT_FIELD_IRAP 3480 if(isField && pocCurr == 1) 3478 if(m_pcCfg->getEfficientFieldIRAPEnabled() && isField && pocCurr == 1) 3481 3479 { 3482 3480 // to avoid the picture becoming an IRAP 3483 3481 return NAL_UNIT_CODED_SLICE_TRAIL_R; 3484 3482 } 3485 #endif3486 3483 3487 3484 #if ALLOW_RECOVERY_POINT_AS_RAP -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r1318 r1325 306 306 307 307 eSliceType=B_SLICE; 308 #if EFFICIENT_FIELD_IRAP 309 if(!(isField && pocLast == 1)) 310 { 311 #endif // EFFICIENT_FIELD_IRAP 308 if(!(isField && pocLast == 1) || !m_pcCfg->getEfficientFieldIRAPEnabled()) 309 { 312 310 #if ALLOW_RECOVERY_POINT_AS_RAP 313 311 if(m_pcCfg->getDecodingRefreshType() == 3) … … 322 320 } 323 321 #endif 324 #if EFFICIENT_FIELD_IRAP 325 } 326 #endif 322 } 327 323 328 324 rpcSlice->setSliceType ( eSliceType ); … … 456 452 // restore original slice type 457 453 458 #if EFFICIENT_FIELD_IRAP 459 if(!(isField && pocLast == 1)) 460 { 461 #endif // EFFICIENT_FIELD_IRAP 454 if(!(isField && pocLast == 1) || !m_pcCfg->getEfficientFieldIRAPEnabled()) 455 { 462 456 #if ALLOW_RECOVERY_POINT_AS_RAP 463 457 if(m_pcCfg->getDecodingRefreshType() == 3) … … 472 466 } 473 467 #endif 474 #if EFFICIENT_FIELD_IRAP 475 } 476 #endif // EFFICIENT_FIELD_IRAP 468 } 477 469 478 470 #if SVC_EXTENSION
Note: See TracChangeset for help on using the changeset viewer.