Changeset 54 in SHVCSoftware for branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder
- Timestamp:
- 2 Mar 2013, 09:25:00 (12 years ago)
- Location:
- branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/NALwrite.cpp
r51 r54 53 53 bsNALUHeader.write(0,1); // forbidden_zero_bit 54 54 bsNALUHeader.write(nalu.m_nalUnitType, 6); // nal_unit_type 55 #if SVC_EXTENSION 56 bsNALUHeader.write(nalu.m_layerId, 6); // reserved_one_5bits 57 #else 55 58 bsNALUHeader.write(nalu.m_reservedZero6Bits, 6); // nuh_reserved_zero_6bits 59 #endif 56 60 bsNALUHeader.write(nalu.m_temporalId+1, 3); // nuh_temporal_id_plus1 57 61 … … 145 149 naluDest.m_temporalId = naluSrc.m_temporalId; 146 150 naluDest.m_Bitstream = naluSrc.m_Bitstream; 151 #if SVC_EXTENSION 152 naluDest.m_layerId = naluSrc.m_layerId; 153 #endif 147 154 } 148 155 -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/NALwrite.h
r51 r54 57 57 NalUnitType nalUnitType, 58 58 UInt temporalID = 0, 59 #if SVC_EXTENSION 60 UInt layerId = 0, 61 #endif 59 62 UInt reserved_zero_6bits = 0) 63 #if SVC_EXTENSION 64 : NALUnit(nalUnitType, temporalID, layerId, reserved_zero_6bits) 65 #else 60 66 : NALUnit(nalUnitType, temporalID, reserved_zero_6bits) 67 #endif 61 68 , m_Bitstream() 62 69 {} -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncAnalyze.cpp
r51 r54 45 45 ////////////////////////////////////////////////////////////////////// 46 46 47 #if SVC_EXTENSION 48 TEncAnalyze m_gcAnalyzeAll [MAX_LAYERS]; 49 TEncAnalyze m_gcAnalyzeI [MAX_LAYERS]; 50 TEncAnalyze m_gcAnalyzeP [MAX_LAYERS]; 51 TEncAnalyze m_gcAnalyzeB [MAX_LAYERS]; 52 #else 47 53 TEncAnalyze m_gcAnalyzeAll; 48 54 TEncAnalyze m_gcAnalyzeI; 49 55 TEncAnalyze m_gcAnalyzeP; 50 56 TEncAnalyze m_gcAnalyzeB; 57 #endif 51 58 52 59 //! \} -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncAnalyze.h
r51 r54 88 88 Void setFrmRate (Double dFrameRate) { m_dFrmRate = dFrameRate; } //--CFG_KDY 89 89 Void clear() { m_dPSNRSumY = m_dPSNRSumU = m_dPSNRSumV = m_dAddBits = m_uiNumPic = 0; } 90 #if SVC_EXTENSION 91 Void printOut ( Char cDelim, UInt layer ) 92 { 93 Double dFps = m_dFrmRate; //--CFG_KDY 94 Double dScale = dFps / 1000 / (Double)m_uiNumPic; 95 96 printf( " L%d\t %8d %c" "%12.4lf " "%8.4lf " "%8.4lf " "%8.4lf\n", 97 layer, 98 getNumPic(), cDelim, 99 getBits() * dScale, 100 getPsnrY() / (Double)getNumPic(), 101 getPsnrU() / (Double)getNumPic(), 102 getPsnrV() / (Double)getNumPic() ); 103 } 104 #else 90 105 Void printOut ( Char cDelim ) 91 106 { … … 102 117 getPsnrV() / (Double)getNumPic() ); 103 118 } 119 #endif 104 120 105 121 Void printSummaryOut () … … 150 166 }; 151 167 168 #if SVC_EXTENSION 169 extern TEncAnalyze m_gcAnalyzeAll [MAX_LAYERS]; 170 extern TEncAnalyze m_gcAnalyzeI [MAX_LAYERS]; 171 extern TEncAnalyze m_gcAnalyzeP [MAX_LAYERS]; 172 extern TEncAnalyze m_gcAnalyzeB [MAX_LAYERS]; 173 #else 152 174 extern TEncAnalyze m_gcAnalyzeAll; 153 175 extern TEncAnalyze m_gcAnalyzeI; 154 176 extern TEncAnalyze m_gcAnalyzeP; 155 177 extern TEncAnalyze m_gcAnalyzeB; 178 #endif 156 179 157 180 //! \} -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncCavlc.cpp
r51 r54 545 545 } 546 546 WRITE_FLAG( pcSPS->getTMVPFlagsPresent() ? 1 : 0, "sps_temporal_mvp_enable_flag" ); 547 547 #if REF_IDX_MFM 548 if( pcSPS->getLayerId() > 0 ) 549 { 550 assert(pcSPS->getMFMEnabledFlag()); 551 WRITE_FLAG( pcSPS->getMFMEnabledFlag() ? 1 : 0, "sps_enh_mfm_enable_flag" ); 552 } 553 #endif 548 554 WRITE_FLAG( pcSPS->getUseStrongIntraSmoothing(), "sps_strong_intra_smoothing_enable_flag" ); 549 555 … … 1549 1555 return true; 1550 1556 } 1557 1558 #if INTRA_BL 1559 Void TEncCavlc::codeIntraBLFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1560 { 1561 assert(0); 1562 } 1563 1564 #endif 1551 1565 //! \} -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncCavlc.h
r51 r54 114 114 Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 115 115 Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 116 #if INTRA_BL 117 Void codeIntraBLFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 118 #endif 116 119 117 120 Void codeInterModeFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiEncMode ); -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncCfg.h
r51 r54 298 298 299 299 Bool m_useStrongIntraSmoothing; ///< enable the use of strong intra smoothing (bi_linear interpolation) for 32x32 blocks when reference samples are flat. 300 #if SVC_EXTENSION 301 UInt m_layerId; 302 UInt m_numLayer; 303 #endif 304 #if REF_IDX_FRAMEWORK 305 Int m_elRapSliceBEnabled; 306 #endif 300 307 301 308 public: … … 692 699 Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; } 693 700 #endif 701 702 #if SVC_EXTENSION 703 UInt getLayerId () { return m_layerId; } 704 Void setLayerId (UInt layer) { m_layerId = layer; } 705 UInt getNumLayer () { return m_numLayer; } 706 Void setNumLayer (UInt uiNum) { m_numLayer = uiNum; } 707 Void setConformanceMode (Int mode) { m_conformanceMode = mode; } 708 Void setConformanceWindow(Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; } 709 #endif 710 #if REF_IDX_FRAMEWORK 711 Void setElRapSliceTypeB(Int bEnabled) {m_elRapSliceBEnabled = bEnabled;} 712 Int getElRapSliceTypeB() {return m_elRapSliceBEnabled;} 713 #endif 694 714 }; 695 715 -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncCu.cpp
r51 r54 211 211 m_pcRdCost = pcEncTop->getRdCost(); 212 212 213 #if SVC_EXTENSION 214 m_ppcTEncTop = pcEncTop->getLayerEnc(); 215 for(UInt i=0 ; i< m_uhTotalDepth-1 ; i++) 216 { 217 m_ppcBestCU[i]->setLayerId(pcEncTop->getLayerId()); 218 m_ppcTempCU[i]->setLayerId(pcEncTop->getLayerId()); 219 } 220 #endif 221 213 222 m_pcEntropyCoder = pcEncTop->getEntropyCoder(); 214 223 m_pcCavlcCoder = pcEncTop->getCavlcCoder(); … … 445 454 if(!bSliceEnd && !bSliceStart && bInsidePicture ) 446 455 { 456 #if (ENCODER_FAST_MODE) 457 bool testInter = true; 458 if (rpcBestCU->getLayerId() > 0) 459 { 460 if (rpcBestCU->getSlice()->getBaseColPic()->getSlice(0)->getSliceType() == I_SLICE) 461 { 462 testInter = false; 463 } 464 465 } 466 #endif 447 467 for (Int iQP=iMinQP; iQP<=iMaxQP; iQP++) 448 468 { … … 459 479 460 480 // do inter modes, SKIP and 2Nx2N 481 #if (ENCODER_FAST_MODE == 1) 482 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE && testInter ) 483 #else 461 484 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE ) 485 #endif 462 486 { 463 487 // 2Nx2N … … 480 504 } 481 505 } 506 #if (ENCODER_FAST_MODE == 2) 507 if (testInter) 508 { 509 #endif 482 510 483 511 if(!m_pcEncCfg->getUseEarlySkipDetection()) … … 493 521 } 494 522 } 523 #if (ENCODER_FAST_MODE == 2) 524 } 525 #endif 526 495 527 } 496 528 … … 531 563 532 564 // do inter modes, NxN, 2NxN, and Nx2N 565 #if (ENCODER_FAST_MODE) 566 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE && testInter ) 567 #else 533 568 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE ) 569 #endif 534 570 { 535 571 // 2Nx2N, NxN … … 685 721 { 686 722 // speedup for inter frames 723 #if (ENCODER_FAST_MODE) 724 if( rpcBestCU->getSlice()->getSliceType() == I_SLICE || 725 !testInter || 726 rpcBestCU->getCbf( 0, TEXT_LUMA ) != 0 || 727 rpcBestCU->getCbf( 0, TEXT_CHROMA_U ) != 0 || 728 rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) != 0 ) // avoid very complex intra if it is unlikely 729 #else 687 730 if( rpcBestCU->getSlice()->getSliceType() == I_SLICE || 688 731 rpcBestCU->getCbf( 0, TEXT_LUMA ) != 0 || 689 732 rpcBestCU->getCbf( 0, TEXT_CHROMA_U ) != 0 || 690 733 rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) != 0 ) // avoid very complex intra if it is unlikely 734 #endif 691 735 { 692 736 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); … … 716 760 } 717 761 } 762 #if INTRA_BL 763 if(m_pcPicYuvRecBase) 764 { 765 xCheckRDCostIntraBL( rpcBestCU, rpcTempCU ); 766 rpcTempCU->initEstData( uiDepth, iQP ); 767 } 768 #endif 769 770 #if (ENCODER_FAST_MODE) 771 if(pcPic->getLayerId() > 0) 772 { 773 xCheckRDCostILRUni( rpcBestCU, rpcTempCU); 774 rpcTempCU->initEstData( uiDepth, iQP ); 775 } 776 #endif 777 718 778 if (isAddLowestQP && (iQP == lowestQP)) 719 779 { … … 1150 1210 return; 1151 1211 } 1212 #if INTRA_BL 1213 m_pcEntropyCoder->encodeIntraBLFlag( pcCU, uiAbsPartIdx ); 1214 if ( !pcCU->isIntraBL( uiAbsPartIdx ) ) 1215 { 1216 #endif 1152 1217 m_pcEntropyCoder->encodePredMode( pcCU, uiAbsPartIdx ); 1153 1218 … … 1168 1233 // prediction Info ( Intra : direction mode, Inter : Mv, reference idx ) 1169 1234 m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx ); 1235 #if INTRA_BL 1236 } 1237 #endif 1170 1238 1171 1239 // Encode Coefficients … … 1221 1289 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) 1222 1290 { 1223 { 1291 #if REF_IDX_ME_ZEROMV 1292 Bool bZeroMVILR = rpcTempCU->xCheckZeroMVILRMerge(uhInterDirNeighbours[uiMergeCand], cMvFieldNeighbours[0 + 2*uiMergeCand], cMvFieldNeighbours[1 + 2*uiMergeCand]); 1293 if(bZeroMVILR) 1294 { 1295 #endif 1224 1296 if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1)) 1225 1297 { … … 1271 1343 } 1272 1344 } 1345 #if REF_IDX_ME_ZEROMV 1273 1346 } 1347 #endif 1274 1348 } 1275 1349 … … 1377 1451 1378 1452 m_pcEntropyCoder->resetBits(); 1453 #if INTRA_BL 1454 m_pcEntropyCoder->encodeIntraBLFlag ( rpcTempCU, 0, true ); 1455 #endif 1379 1456 if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag()) 1380 1457 { … … 1430 1507 1431 1508 m_pcEntropyCoder->resetBits(); 1509 #if INTRA_BL 1510 m_pcEntropyCoder->encodeIntraBLFlag ( rpcTempCU, 0, true ); 1511 #endif 1432 1512 if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag()) 1433 1513 { … … 1681 1761 } 1682 1762 #endif 1763 1764 #if INTRA_BL 1765 Void TEncCu::xCheckRDCostIntraBL( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU ) 1766 { 1767 UInt uiDepth = rpcTempCU->getDepth( 0 ); 1768 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 1769 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 1770 rpcTempCU->setPredModeSubParts( MODE_INTRA_BL, 0, uiDepth ); 1771 rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uiDepth ); 1772 1773 m_pcPredSearch->setBaseRecPic( m_pcPicYuvRecBase ); 1774 #if NO_RESIDUAL_FLAG_FOR_BLPRED 1775 rpcTempCU->setDepthSubParts( uiDepth, 0 ); 1776 // rpcTempCU->setLumaIntraDirSubParts( DC_IDX, 0, uiDepth ); 1777 // rpcTempCU->setChromIntraDirSubParts( DC_IDX, 0, uiDepth ); 1778 m_ppcPredYuvTemp[uiDepth]->copyFromPicLuma ( rpcTempCU->getSlice()->getFullPelBaseRec(), rpcTempCU->getAddr(), rpcTempCU->getZorderIdxInCU(), 0, rpcTempCU->getWidth(0), rpcTempCU->getHeight(0)); 1779 m_ppcPredYuvTemp[uiDepth]->copyFromPicChroma( rpcTempCU->getSlice()->getFullPelBaseRec(), rpcTempCU->getAddr(), rpcTempCU->getZorderIdxInCU(), 0, (rpcTempCU->getWidth(0)>>1), (rpcTempCU->getHeight(0)>>1), 0); 1780 m_ppcPredYuvTemp[uiDepth]->copyFromPicChroma( rpcTempCU->getSlice()->getFullPelBaseRec(), rpcTempCU->getAddr(), rpcTempCU->getZorderIdxInCU(), 0, (rpcTempCU->getWidth(0)>>1), (rpcTempCU->getHeight(0)>>1), 1); 1781 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcResiYuvBest[uiDepth], m_ppcRecoYuvTemp[uiDepth], false ); 1782 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1783 #else 1784 1785 m_pcPredSearch->estIntraBLPredQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth] ); 1786 1787 m_pcEntropyCoder->resetBits(); 1788 m_pcEntropyCoder->encodeIntraBLFlag ( rpcTempCU, 0, true ); 1789 m_pcEntropyCoder->encodeSkipFlag( rpcTempCU, 0, true ); 1790 if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag()) 1791 { 1792 m_pcEntropyCoder->encodeCUTransquantBypassFlag( rpcTempCU, 0, true ); 1793 } 1794 1795 // Encode Coefficients 1796 Bool bCodeDQP = getdQPFlag(); 1797 m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP ); 1798 setdQPFlag( bCodeDQP ); 1799 1800 if( m_bUseSBACRD ) m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 1801 1802 rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits(); 1803 if(m_pcEncCfg->getUseSBACRD()) 1804 { 1805 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1806 } 1807 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1808 #endif 1809 1810 xCheckDQP( rpcTempCU ); 1811 xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth); 1812 } 1813 #endif 1814 1815 1816 1817 1683 1818 //! \} -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncCu.h
r51 r54 84 84 // Access channel 85 85 TEncCfg* m_pcEncCfg; 86 #if INTRA_BL 87 TComPicYuv* m_pcPicYuvRecBase; ///< reconstructed base layer 88 #endif 86 89 TEncSearch* m_pcPredSearch; 87 90 TComTrQuant* m_pcTrQuant; 88 91 TComBitCounter* m_pcBitCounter; 89 92 TComRdCost* m_pcRdCost; 93 94 #if SVC_EXTENSION 95 TEncTop** m_ppcTEncTop; 96 #endif 90 97 91 98 TEncEntropy* m_pcEntropyCoder; … … 124 131 UInt getLCUPredictionSAD() { return m_LCUPredictionSAD; } 125 132 #endif 133 #if INTRA_BL 134 Void setBaseRecPic ( TComPicYuv* p ) { m_pcPicYuvRecBase = p; } 135 #endif 126 136 protected: 127 137 Void finishCU ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); … … 144 154 #endif 145 155 Void xCheckRDCostIntra ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize ); 156 #if INTRA_BL 157 Void xCheckRDCostIntraBL ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU ); 158 #endif 159 #if ENCODER_FAST_MODE 160 Void xCheckRDCostILRUni ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU ); 161 #endif 146 162 Void xCheckDQP ( TComDataCU* pcCU ); 147 163 … … 168 184 #endif 169 185 186 #if SVC_EXTENSION 187 TEncTop* getLayerEnc(UInt LayerId) {return m_ppcTEncTop[LayerId]; } 188 #endif 189 170 190 Void xFillPCMBuffer ( TComDataCU*& pCU, TComYuv* pOrgYuv ); 171 191 }; -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncEntropy.cpp
r51 r54 166 166 } 167 167 168 #if INTRA_BL 169 if( pcCU->isIntraBL( uiAbsPartIdx ) ) 170 { 171 return; 172 } 173 #endif 174 168 175 m_pcEntropyCoderIf->codePredMode( pcCU, uiAbsPartIdx ); 169 176 } … … 244 251 } 245 252 } 253 #if INTRA_BL 254 if( pcCU->isIntra(uiAbsPartIdx) && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) ) 255 #else 246 256 247 257 if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) ) 258 #endif 248 259 { 249 260 assert( uiSubdiv ); … … 331 342 } 332 343 344 #if INTRA_BL 345 #if NO_RESIDUAL_FLAG_FOR_BLPRED 346 if( ( !pcCU->isIntra( uiAbsPartIdx ) || pcCU->isIntraBL(uiAbsPartIdx)) && uiDepth == pcCU->getDepth( uiAbsPartIdx ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, 0 ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, 0 ) ) 347 #else 348 if( ( !pcCU->isIntra( uiAbsPartIdx ) ) && uiDepth == pcCU->getDepth( uiAbsPartIdx ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, 0 ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, 0 ) ) 349 #endif 350 #else 333 351 if( pcCU->getPredictionMode(uiAbsPartIdx) != MODE_INTRA && uiDepth == pcCU->getDepth( uiAbsPartIdx ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, 0 ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, 0 ) ) 352 #endif 334 353 { 335 354 assert( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, 0 ) ); … … 412 431 Void TEncEntropy::encodePredInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 413 432 { 433 #if INTRA_BL 434 assert ( !pcCU->isIntraBL( uiAbsPartIdx ) ); 435 #endif 414 436 if( bRD ) 415 437 { … … 585 607 UInt uiChromaOffset = uiLumaOffset>>2; 586 608 609 #if NO_RESIDUAL_FLAG_FOR_BLPRED 610 if( pcCU->isIntra(uiAbsPartIdx) && !pcCU->isIntraBL(uiAbsPartIdx) ) 611 #else 587 612 if( pcCU->isIntra(uiAbsPartIdx) ) 613 #endif 588 614 { 589 615 DTRACE_CABAC_VL( g_nSymbolCounter++ ) … … 733 759 } 734 760 761 #if INTRA_BL 762 Void TEncEntropy::encodeIntraBLFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 763 { 764 if( pcCU->getLayerId() == 0 ) 765 { 766 return; 767 } 768 769 if( bRD ) 770 { 771 uiAbsPartIdx = 0; 772 } 773 m_pcEntropyCoderIf->codeIntraBLFlag( pcCU, uiAbsPartIdx ); 774 } 775 #endif 735 776 //! \} -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncEntropy.h
r51 r54 86 86 virtual Void codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 87 87 88 #if INTRA_BL 89 virtual Void codeIntraBLFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 90 #endif 88 91 virtual Void codePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 89 92 virtual Void codePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; … … 161 164 Void encodeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 162 165 Void encodeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 166 #if INTRA_BL 167 Void encodeIntraBLFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 168 #endif 163 169 Void encodePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 164 170 Void encodePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false ); -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncGOP.cpp
r51 r54 97 97 xResetNonNestedSEIPresentFlags(); 98 98 #endif 99 #if SVC_UPSAMPLING 100 m_pcPredSearch = NULL; 101 #endif 99 102 return; 100 103 } … … 106 109 /** Create list to contain pointers to LCU start addresses of slice. 107 110 */ 111 #if SVC_EXTENSION 112 Void TEncGOP::create( UInt layerId ) 113 { 114 m_bLongtermTestPictureHasBeenCoded = 0; 115 m_bLongtermTestPictureHasBeenCoded2 = 0; 116 m_layerId = layerId; 117 } 118 #else 108 119 Void TEncGOP::create() 109 120 { … … 111 122 m_bLongtermTestPictureHasBeenCoded2 = 0; 112 123 } 124 #endif 113 125 114 126 Void TEncGOP::destroy() … … 121 133 m_pcCfg = pcTEncTop; 122 134 m_pcSliceEncoder = pcTEncTop->getSliceEncoder(); 123 m_pcListPic = pcTEncTop->getListPic(); 124 135 m_pcListPic = pcTEncTop->getListPic(); 125 136 m_pcEntropyCoder = pcTEncTop->getEntropyCoder(); 126 137 m_pcCavlcCoder = pcTEncTop->getCavlcCoder(); … … 136 147 m_totalCoded = 0; 137 148 149 #if SVC_EXTENSION 150 m_ppcTEncTop = pcTEncTop->getLayerEnc(); 151 #endif 152 #if SVC_UPSAMPLING 153 m_pcPredSearch = pcTEncTop->getPredSearch(); ///< encoder search class 154 #endif 138 155 } 139 156 … … 239 256 // Public member functions 240 257 // ==================================================================================================================== 258 #if SVC_EXTENSION 259 Void TEncGOP::compressGOP( Int iPicIdInGOP, Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP) 260 #else 241 261 Void TEncGOP::compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP) 262 #endif 242 263 { 243 264 TComPic* pcPic; … … 261 282 UInt *accumNalsDU = NULL; 262 283 SEIDecodingUnitInfo decodingUnitInfoSEI; 284 #if SVC_EXTENSION 285 for ( Int iGOPid=iPicIdInGOP; iGOPid < iPicIdInGOP+1; iGOPid++ ) 286 #else 263 287 for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ ) 288 #endif 264 289 { 265 290 UInt uiColDir = 1; … … 337 362 m_pcSliceEncoder->setSliceIdx(0); 338 363 pcPic->setCurrSliceIdx(0); 364 #if SVC_EXTENSION 365 pcPic->setLayerId( m_layerId ); 366 #endif 339 367 340 368 m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS() ); … … 384 412 // Set the nal unit type 385 413 pcSlice->setNalUnitType(getNalUnitType(pocCurr)); 414 #if REF_IDX_FRAMEWORK 415 if( m_layerId > 0 && (uiPOCCurr % m_pcCfg->getIntraPeriod() == 0) ) 416 { 417 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_CRA); 418 } 419 if( m_layerId > 0 && !m_pcEncTop->getElRapSliceTypeB() ) 420 { 421 if( (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA) && 422 (pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && 423 pcSlice->getSliceType() == B_SLICE ) 424 { 425 pcSlice->setSliceType(P_SLICE); 426 } 427 } 428 #endif 386 429 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R) 387 430 { … … 470 513 #endif 471 514 515 #if SVC_EXTENSION 516 if(m_layerId > 0) 517 { 518 TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId-1]->getListPic(); 519 pcSlice->setBaseColPic (*cListPic, m_layerId ); 520 #if SVC_UPSAMPLING 521 if ( pcPic->isSpatialEnhLayer()) 522 { 523 m_pcPredSearch->upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec() ); 524 } 525 else 526 { 527 pcPic->setFullPelBaseRec( pcSlice->getBaseColPic()->getPicYuvRec() ); 528 } 529 pcSlice->setFullPelBaseRec ( pcPic->getFullPelBaseRec() ); 530 #endif 531 } 532 #endif 533 534 #if REF_IDX_FRAMEWORK 535 if( pcSlice->getSliceType() == B_SLICE ) 536 { 537 pcSlice->setColFromL0Flag(1-uiColDir); 538 } 539 #endif 540 472 541 // Set reference list 473 542 pcSlice->setRefPicList ( rcListPic ); 543 #if REF_IDX_FRAMEWORK 544 if(m_layerId > 0) 545 { 546 m_pcEncTop->setILRPic(pcPic); 547 548 #if REF_IDX_MFM 549 pcSlice->setRefPOCListILP(m_pcEncTop->getIlpList(), pcSlice->getBaseColPic()); 550 #endif 551 pcSlice->addRefPicList ( m_pcEncTop->getIlpList(), 1); 552 553 #if REF_IDX_MFM 554 Bool found = false; 555 UInt ColFromL0Flag = pcSlice->getColFromL0Flag(); 556 UInt ColRefIdx = pcSlice->getColRefIdx(); 557 for(Int colIdx = 0; colIdx < pcSlice->getNumRefIdx( RefPicList(1 - ColFromL0Flag) ); colIdx++) 558 { 559 if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->getIsILR() ) 560 { 561 ColRefIdx = colIdx; 562 found = true; 563 break; 564 } 565 } 566 567 if( found == false ) 568 { 569 ColFromL0Flag = 1 - ColFromL0Flag; 570 for(Int colIdx = 0; colIdx < pcSlice->getNumRefIdx( RefPicList(1 - ColFromL0Flag) ); colIdx++) 571 { 572 if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->getIsILR() ) 573 { 574 ColRefIdx = colIdx; 575 found = true; 576 break; 577 } 578 } 579 } 580 581 if(found == true) 582 { 583 pcSlice->setColFromL0Flag(ColFromL0Flag); 584 pcSlice->setColRefIdx(ColRefIdx); 585 } 586 #endif 587 } 588 #endif 474 589 475 590 // Slice info. refinement … … 493 608 if (pcSlice->getSliceType() == B_SLICE) 494 609 { 610 #if !REF_IDX_FRAMEWORK 495 611 pcSlice->setColFromL0Flag(1-uiColDir); 612 #endif 496 613 Bool bLowDelay = true; 497 614 Int iCurrPOC = pcSlice->getPOC(); … … 780 897 m_storedStartCUAddrForEncodingSliceSegment.push_back(nextCUAddr); 781 898 startCUAddrSliceSegmentIdx++; 899 #if AVC_BASE 900 if( m_layerId == 0 ) 901 { 902 pcPic->getPicYuvOrg()->copyToPic( pcPic->getPicYuvRec() ); 903 #if AVC_SYNTAX 904 pcPic->readBLSyntax( m_ppcTEncTop[0]->getBLSyntaxFile(), SYNTAX_BYTES ); 905 #endif 906 return; 907 } 908 #endif 782 909 783 910 while(nextCUAddr<uiRealEndAddress) // determine slice boundaries … … 878 1005 if ( m_bSeqFirst ) 879 1006 { 1007 #if SVC_EXTENSION 1008 OutputNALUnit nalu(NAL_UNIT_VPS, 0, m_layerId); 1009 #else 880 1010 OutputNALUnit nalu(NAL_UNIT_VPS); 1011 #endif 881 1012 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 882 1013 m_pcEntropyCoder->encodeVPS(m_pcEncTop->getVPS()); … … 887 1018 #endif 888 1019 1020 #if SVC_EXTENSION 1021 nalu = NALUnit(NAL_UNIT_SPS, 0, m_layerId); 1022 #else 889 1023 nalu = NALUnit(NAL_UNIT_SPS); 1024 #endif 890 1025 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 891 1026 if (m_bSeqFirst) … … 920 1055 #endif 921 1056 1057 #if SVC_EXTENSION 1058 nalu = NALUnit(NAL_UNIT_PPS, 0, m_layerId); 1059 #else 922 1060 nalu = NALUnit(NAL_UNIT_PPS); 1061 #endif 923 1062 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 924 1063 m_pcEntropyCoder->encodePPS(pcSlice->getPPS()); … … 1174 1313 m_pcEntropyCoder->resetEntropy (); 1175 1314 /* start slice NALunit */ 1315 #if SVC_EXTENSION 1316 OutputNALUnit nalu( pcSlice->getNalUnitType(), pcSlice->getTLayer(), m_layerId ); 1317 #else 1176 1318 OutputNALUnit nalu( pcSlice->getNalUnitType(), pcSlice->getTLayer() ); 1319 #endif 1177 1320 Bool sliceSegment = (!pcSlice->isNextSlice()); 1178 1321 if (!sliceSegment) … … 1436 1579 digestStr = digestToString(sei_recon_picture_digest.digest, 4); 1437 1580 } 1581 #if SVC_EXTENSION 1582 OutputNALUnit nalu(NAL_UNIT_SEI_SUFFIX, pcSlice->getTLayer(), m_layerId); 1583 #else 1438 1584 OutputNALUnit nalu(NAL_UNIT_SEI_SUFFIX, pcSlice->getTLayer()); 1585 #endif 1439 1586 1440 1587 /* write the SEI messages */ … … 1708 1855 if( accumNalsDU != NULL) delete accumNalsDU; 1709 1856 1857 #if SVC_EXTENSION 1858 assert ( m_iNumPicCoded <= 1 ); 1859 #else 1710 1860 assert ( m_iNumPicCoded == iNumPicRcvd ); 1861 #endif 1711 1862 } 1712 1863 1864 #if !SVC_EXTENSION 1713 1865 Void TEncGOP::printOutSummary(UInt uiNumAllPicCoded) 1714 1866 { … … 1746 1898 printf("\nRVM: %.3lf\n" , xCalculateRVM()); 1747 1899 } 1900 #endif 1748 1901 1749 1902 Void TEncGOP::preLoopFilterPicAll( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits ) … … 2020 2173 2021 2174 //===== add PSNR ===== 2175 #if SVC_EXTENSION 2176 m_gcAnalyzeAll[m_layerId].addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2177 TComSlice* pcSlice = pcPic->getSlice(0); 2178 if (pcSlice->isIntra()) 2179 { 2180 m_gcAnalyzeI[m_layerId].addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2181 } 2182 if (pcSlice->isInterP()) 2183 { 2184 m_gcAnalyzeP[m_layerId].addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2185 } 2186 if (pcSlice->isInterB()) 2187 { 2188 m_gcAnalyzeB[m_layerId].addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2189 } 2190 #else 2022 2191 m_gcAnalyzeAll.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2023 2192 TComSlice* pcSlice = pcPic->getSlice(0); … … 2034 2203 m_gcAnalyzeB.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2035 2204 } 2205 #endif 2036 2206 2037 2207 Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B'); 2038 2208 if (!pcSlice->isReferenced()) c += 32; 2039 2209 2210 #if SVC_EXTENSION 2211 #if ADAPTIVE_QP_SELECTION 2212 printf("POC %4d LId: %1d TId: %1d ( %c-SLICE, nQP %d QP %d ) %10d bits", 2213 pcSlice->getPOC(), 2214 pcSlice->getLayerId(), 2215 pcSlice->getTLayer(), 2216 c, 2217 pcSlice->getSliceQpBase(), 2218 pcSlice->getSliceQp(), 2219 uibits ); 2220 #else 2221 printf("POC %4d LId: %1d TId: %1d ( %c-SLICE, QP %d ) %10d bits", 2222 pcSlice->getPOC()-pcSlice->getLastIDR(), 2223 pcSlice->getLayerId(), 2224 pcSlice->getTLayer(), 2225 c, 2226 pcSlice->getSliceQp(), 2227 uibits ); 2228 #endif 2229 #else 2040 2230 #if ADAPTIVE_QP_SELECTION 2041 2231 printf("POC %4d TId: %1d ( %c-SLICE, nQP %d QP %d ) %10d bits", … … 2054 2244 uibits ); 2055 2245 #endif 2246 #endif 2056 2247 2057 2248 printf(" [Y %6.4lf dB U %6.4lf dB V %6.4lf dB]", dYPSNR, dUPSNR, dVPSNR ); -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncGOP.h
r51 r54 83 83 Bool m_bFirst; 84 84 85 #if SVC_EXTENSION 86 UInt m_layerId; 87 #endif 88 85 89 // Access channel 86 90 TEncTop* m_pcEncTop; … … 88 92 TEncSlice* m_pcSliceEncoder; 89 93 TComList<TComPic*>* m_pcListPic; 94 95 #if SVC_EXTENSION 96 TEncTop** m_ppcTEncTop; 97 #if SVC_UPSAMPLING 98 TEncSearch* m_pcPredSearch; ///< encoder search class 99 #endif 100 #endif 90 101 91 102 TEncEntropy* m_pcEntropyCoder; … … 125 136 virtual ~TEncGOP(); 126 137 138 #if SVC_EXTENSION 139 Void create ( UInt layerId ); 140 #else 127 141 Void create (); 142 #endif 128 143 Void destroy (); 129 144 130 145 Void init ( TEncTop* pcTEncTop ); 146 #if SVC_EXTENSION 147 Void compressGOP ( Int iPicIdInGOP, Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP ); 148 #else 131 149 Void compressGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP ); 150 #endif 132 151 Void xWriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice); 133 152 -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncPic.cpp
r51 r54 126 126 * \return Void 127 127 */ 128 #if SVC_UPSAMPLING 129 Void TEncPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 130 Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual ) 131 132 #else 128 133 Void TEncPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 129 134 Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, Bool bIsVirtual ) 135 #endif 130 136 { 137 #if SVC_UPSAMPLING 138 TComPic::create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, 139 conformanceWindow, defaultDisplayWindow, numReorderPics, pcSps, bIsVirtual ); 140 #else 131 141 TComPic::create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, 132 142 conformanceWindow, defaultDisplayWindow, numReorderPics, bIsVirtual ); 143 #endif 133 144 m_uiMaxAQDepth = uiMaxAQDepth; 134 145 if ( uiMaxAQDepth > 0 ) -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncPic.h
r51 r54 41 41 #include "TLibCommon/CommonDef.h" 42 42 #include "TLibCommon/TComPic.h" 43 43 #if SVC_UPSAMPLING 44 #include "TLibCommon/TComSlice.h" 45 #endif 44 46 //! \ingroup TLibEncoder 45 47 //! \{ … … 103 105 virtual ~TEncPic(); 104 106 107 #if SVC_UPSAMPLING 108 Void create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 109 Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual = false ); 110 #else 105 111 Void create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 106 112 Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, Bool bIsVirtual = false ); 113 #endif 107 114 virtual Void destroy(); 108 115 -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncSbac.cpp
r51 r54 83 83 , m_cTransformSkipSCModel ( 1, 2, NUM_TRANSFORMSKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 84 84 , m_CUTransquantBypassFlagSCModel( 1, 1, NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX, m_contextModels + m_numContextModels, m_numContextModels) 85 #if INTRA_BL 86 , m_cIntraBLPredFlagSCModel (1, 1, NUM_INTRA_BL_PRED_CTX , m_contextModels + m_numContextModels, m_numContextModels) 87 #endif 85 88 { 86 89 assert( m_numContextModels <= MAX_NUM_CTX_MOD ); … … 131 134 m_cCUTransSubdivFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); 132 135 m_cSaoMergeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_FLAG ); 136 #if INTRA_BL 137 m_cIntraBLPredFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTRA_BL_PRED_FLAG ); 138 #endif 133 139 m_cSaoTypeIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX ); 134 140 m_cTransformSkipSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANSFORMSKIP_FLAG ); … … 163 169 curCost = m_cCUSplitFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SPLIT_FLAG ); 164 170 curCost += m_cCUSkipFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SKIP_FLAG ); 171 #if INTRA_BL 172 curCost += m_cIntraBLPredFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_INTRA_BL_PRED_FLAG ); 173 #endif 165 174 curCost += m_cCUMergeFlagExtSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT); 166 175 curCost += m_cCUMergeIdxExtSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_MERGE_IDX_EXT); … … 234 243 m_cCUTransSubdivFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); 235 244 m_cSaoMergeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_FLAG ); 245 #if INTRA_BL 246 m_cIntraBLPredFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTRA_BL_PRED_FLAG ); 247 #endif 236 248 m_cSaoTypeIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX ); 237 249 m_cTransformSkipSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANSFORMSKIP_FLAG ); … … 416 428 { 417 429 PartSize eSize = pcCU->getPartitionSize( uiAbsPartIdx ); 430 #if INTRA_BL 431 assert( !pcCU->isIntraBL( uiAbsPartIdx ) ); 432 #endif 418 433 if ( pcCU->isIntra( uiAbsPartIdx ) ) 419 434 { … … 1584 1599 this->xCopyContextsFrom(pScr); 1585 1600 } 1601 1602 #if INTRA_BL 1603 /** code intra_bl flag 1604 * \param pcCU 1605 * \param uiAbsPartIdx 1606 * \returns Void 1607 */ 1608 Void TEncSbac::codeIntraBLFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1609 { 1610 // get context function is here 1611 UInt uiSymbol = pcCU->isIntraBL( uiAbsPartIdx ) ? 1 : 0; 1612 1613 UInt uiCtxIntraBL = pcCU->getCtxIntraBLFlag( uiAbsPartIdx ) ; 1614 m_pcBinIf->encodeBin(uiSymbol, m_cIntraBLPredFlagSCModel.get( 0, 0, uiCtxIntraBL )); 1615 1616 DTRACE_CABAC_VL( g_nSymbolCounter++ ); 1617 DTRACE_CABAC_T( "\tuiSymbol: "); 1618 DTRACE_CABAC_V( uiSymbol ); 1619 DTRACE_CABAC_T( "\n"); 1620 } 1621 #endif 1586 1622 //! \} -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncSbac.h
r51 r54 134 134 Void codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList ); 135 135 136 #if INTRA_BL 137 Void codeIntraBLFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 138 #endif 136 139 Void codePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 137 140 Void codePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ); … … 204 207 ContextModel3DBuffer m_cTransformSkipSCModel; 205 208 ContextModel3DBuffer m_CUTransquantBypassFlagSCModel; 209 #if INTRA_BL 210 ContextModel3DBuffer m_cIntraBLPredFlagSCModel; 211 #endif 206 212 }; 207 213 -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncSearch.cpp
r51 r54 906 906 m_pcEntropyCoder->encodePredMode( pcCU, 0, true ); 907 907 } 908 908 #if INTRA_BL 909 m_pcEntropyCoder->encodeIntraBLFlag ( pcCU, 0, true ); 910 if( pcCU->isIntraBL( 0 ) ) 911 { 912 return; 913 } 914 #endif 909 915 m_pcEntropyCoder ->encodePartSize( pcCU, 0, pcCU->getDepth(0), true ); 910 916 … … 944 950 } 945 951 } 952 #if INTRA_BL 953 if( pcCU->isIntraBL( 0 ) ) 954 { 955 return; 956 } 957 #endif 946 958 if( bChroma ) 947 959 { … … 1043 1055 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail ); 1044 1056 //===== get prediction signal ===== 1057 #if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED 1058 if(pcCU->isIntraBL ( uiAbsPartIdx ) ) 1059 { 1060 pcCU->getBaseLumaBlk( uiWidth, uiHeight, uiAbsPartIdx, piPred, uiStride ); 1061 } 1062 else 1063 #endif 1045 1064 predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 1046 1065 // save prediction … … 1228 1247 1229 1248 //===== get prediction signal ===== 1249 #if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED 1250 if(pcCU->isIntraBL ( uiAbsPartIdx ) ) 1251 { 1252 pcCU->getBaseChromaBlk( uiWidth, uiHeight, uiAbsPartIdx, piPred, uiStride, uiChromaId ); 1253 } 1254 else 1255 #endif 1230 1256 { 1231 1257 predIntraChromaAng( pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); … … 3039 3065 Int iHeight = 0; 3040 3066 3067 #if REF_IDX_FRAMEWORK // HM bug fix 3068 for( UInt uiMergeCand = 0; uiMergeCand < pcCU->getSlice()->getMaxNumMergeCand(); ++uiMergeCand ) 3069 { 3070 uhInterDirNeighbours[uiMergeCand] = 0; 3071 cMvFieldNeighbours[0 + 2*uiMergeCand].setMvField(TComMv(), NOT_VALID); 3072 cMvFieldNeighbours[1 + 2*uiMergeCand].setMvField(TComMv(), NOT_VALID); 3073 } 3074 #endif 3041 3075 pcCU->getPartIndexAndSize( iPUIdx, uiAbsPartIdx, iWidth, iHeight ); 3042 3076 UInt uiDepth = pcCU->getDepth( uiAbsPartIdx ); … … 3060 3094 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) 3061 3095 { 3062 { 3096 #if REF_IDX_ME_ZEROMV 3097 Bool bZeroMVILR = pcCU->xCheckZeroMVILRMerge(uhInterDirNeighbours[uiMergeCand], cMvFieldNeighbours[0 + 2*uiMergeCand], cMvFieldNeighbours[1 + 2*uiMergeCand]); 3098 if(bZeroMVILR) 3099 { 3100 #endif 3063 3101 UInt uiCostCand = MAX_UINT; 3064 3102 UInt uiBitsCand = 0; … … 3084 3122 uiMergeIndex = uiMergeCand; 3085 3123 } 3086 } 3124 #if REF_IDX_ME_ZEROMV 3125 } 3126 #endif 3087 3127 } 3088 3128 } … … 3209 3249 UInt uiBitsTempL0[MAX_NUM_REF]; 3210 3250 3251 #if (ENCODER_FAST_MODE) 3252 Bool testILR; 3253 #endif 3254 3211 3255 xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits); 3212 3256 … … 3230 3274 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 3231 3275 3276 #if (ENCODER_FAST_MODE) 3277 if (pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1) 3278 { 3279 testILR = false; 3280 } 3281 else 3282 { 3283 testILR = true; 3284 } 3285 #endif 3286 3232 3287 for ( Int iRefIdxTemp = 0; iRefIdxTemp < pcCU->getSlice()->getNumRefIdx(eRefPicList); iRefIdxTemp++ ) 3233 3288 { 3289 #if (ENCODER_FAST_MODE) 3290 TComPic* pcPic = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp ); 3291 if( !testILR && pcPic->getIsILR() && (ePartSize == SIZE_2Nx2N) ) 3292 { 3293 continue; 3294 } 3295 #endif 3296 3234 3297 uiBitsTemp = uiMbBits[iRefList]; 3235 3298 if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 ) … … 3248 3311 if(pcCU->getSlice()->getMvdL1ZeroFlag() && iRefList==1 && biPDistTemp < bestBiPDist) 3249 3312 { 3313 #if REF_IDX_ME_ZEROMV 3314 Bool bZeroMVILR = pcCU->xCheckZeroMVILRMvdL1Zero(iRefList, iRefIdxTemp, aaiMvpIdx[iRefList][iRefIdxTemp]); 3315 if(bZeroMVILR) 3316 { 3317 #endif 3250 3318 bestBiPDist = biPDistTemp; 3251 3319 bestBiPMvpL1 = aaiMvpIdx[iRefList][iRefIdxTemp]; 3252 3320 bestBiPRefIdxL1 = iRefIdxTemp; 3321 #if REF_IDX_ME_ZEROMV 3322 } 3323 #endif 3253 3324 } 3254 3325 … … 3343 3414 } 3344 3415 3416 #if ENCODER_BUGFIX 3417 if ( ( iRefList == 0 && uiCostTemp < uiCost[iRefList] ) || 3418 ( iRefList == 1 && pcCU->getSlice()->getNoBackPredFlag() && iRefIdxTemp == iRefIdx[0] ) || 3419 ( iRefList == 1 && !pcCU->getSlice()->getNoBackPredFlag() && uiCostTemp < uiCost[iRefList] ) ) 3420 #else 3345 3421 if ( ( iRefList == 0 && uiCostTemp < uiCost[iRefList] ) || 3346 3422 ( iRefList == 1 && pcCU->getSlice()->getNoBackPredFlag() && iRefIdxTemp == iRefIdx[0] ) || 3347 3423 ( iRefList == 1 && (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0) && (iRefIdxTemp==0 || iRefIdxTemp == iRefIdx[0]) && !pcCU->getSlice()->getNoBackPredFlag() && (iRefIdxTemp == pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)) ) || 3348 3424 ( iRefList == 1 && !pcCU->getSlice()->getNoBackPredFlag() && uiCostTemp < uiCost[iRefList] ) ) 3425 #endif 3349 3426 { 3350 3427 uiCost[iRefList] = uiCostTemp; … … 3375 3452 } 3376 3453 // Bi-directional prediction 3454 #if REF_IDX_ME_ZEROMV 3455 if ( (pcCU->getSlice()->isInterB()) && (pcCU->isBipredRestriction(iPartIdx) == false) && !(pcCU->getSlice()->getMvdL1ZeroFlag() && bestBiPDist == MAX_INT) ) 3456 #else 3377 3457 if ( (pcCU->getSlice()->isInterB()) && (pcCU->isBipredRestriction(iPartIdx) == false) ) 3458 #endif 3378 3459 { 3379 3460 … … 3449 3530 Bool bChanged = false; 3450 3531 3532 #if (ENCODER_FAST_MODE) 3533 Bool testIter = true; 3534 TComPic* pcPic = pcCU->getSlice()->getRefPic( RefPicList(1 - iRefList), iRefIdxBi[1 - iRefList] ); 3535 if(pcPic->getIsILR() && (ePartSize == SIZE_2Nx2N)) 3536 testIter = false; //the fixed part is ILR, skip this iteration 3537 if(testIter) 3538 { 3539 #endif 3451 3540 iRefStart = 0; 3452 3541 iRefEnd = pcCU->getSlice()->getNumRefIdx(eRefPicList)-1; … … 3454 3543 for ( Int iRefIdxTemp = iRefStart; iRefIdxTemp <= iRefEnd; iRefIdxTemp++ ) 3455 3544 { 3545 #if (ENCODER_FAST_MODE) 3546 Bool testRefIdx = true; 3547 pcPic = pcCU->getSlice()->getRefPic( RefPicList(iRefList) , iRefIdxTemp ); 3548 if(pcPic->getIsILR() && (ePartSize == SIZE_2Nx2N)) 3549 testRefIdx = false; //the refined part is ILR, skip this reference pic 3550 if(testRefIdx) 3551 { 3552 #endif 3456 3553 uiBitsTemp = uiMbBits[2] + uiMotBits[1-iRefList]; 3457 3554 if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 ) … … 3487 3584 } 3488 3585 } 3586 #if (ENCODER_FAST_MODE) 3587 } 3588 #endif 3589 } 3590 #if (ENCODER_FAST_MODE) 3489 3591 } // for loop-iRefIdxTemp 3592 #endif 3490 3593 3491 3594 if ( !bChanged ) … … 4104 4207 setWpScalingDistParam( pcCU, iRefIdxPred, eRefPicList ); 4105 4208 // Do integer search 4209 #if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV 4210 #if REF_IDX_ME_AROUND_ZEROMV 4211 if( pcCU->getSlice()->getRefPic(eRefPicList, iRefIdxPred )->getIsILR()) //ILR reference pic 4212 { 4213 xPatternSearchILR ( pcCU, pcPatternKey, piRefY, iRefStride, rcMv, ruiCost ); 4214 } 4215 else //non ILR reference pic 4216 { 4106 4217 if ( !m_iFastSearch || bBi ) 4107 4218 { … … 4112 4223 rcMv = *pcMvPred; 4113 4224 xPatternSearchFast ( pcCU, pcPatternKey, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost ); 4114 } 4225 } 4226 } 4227 #endif 4228 #if REF_IDX_ME_ZEROMV 4229 if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getIsILR()) //ILR reference pic 4230 { 4231 rcMv.setZero(); //use Mv(0, 0) for integer ME 4232 } 4233 else //non ILR reference pic 4234 { 4235 if ( !m_iFastSearch || bBi ) 4236 { 4237 xPatternSearch ( pcPatternKey, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost ); 4238 } 4239 else 4240 { 4241 rcMv = *pcMvPred; 4242 xPatternSearchFast ( pcCU, pcPatternKey, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost ); 4243 } 4244 } 4245 #endif 4246 #else 4247 if ( !m_iFastSearch || bBi ) 4248 { 4249 xPatternSearch ( pcPatternKey, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost ); 4250 } 4251 else 4252 { 4253 rcMv = *pcMvPred; 4254 xPatternSearchFast ( pcCU, pcPatternKey, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost ); 4255 } 4256 #endif 4115 4257 4116 4258 m_pcRdCost->getMotionCost( 1, 0 ); … … 4118 4260 4119 4261 { 4262 #if REF_IDX_ME_ZEROMV 4263 if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getIsILR()) //ILR reference pic 4264 { 4265 xPatternSearchFracDIFMv0( pcCU, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost, bBi ); 4266 } 4267 else //non ILR reference pic 4268 { 4269 xPatternSearchFracDIF( pcCU, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost, bBi ); 4270 } 4271 #else 4120 4272 xPatternSearchFracDIF( pcCU, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost 4121 4273 ,bBi 4122 4274 ); 4275 #endif 4123 4276 } 4124 4277 … … 4457 4610 Void TEncSearch::encodeResAndCalcRdInterCU( TComDataCU* pcCU, TComYuv* pcYuvOrg, TComYuv* pcYuvPred, TComYuv*& rpcYuvResi, TComYuv*& rpcYuvResiBest, TComYuv*& rpcYuvRec, Bool bSkipRes ) 4458 4611 { 4612 #if NO_RESIDUAL_FLAG_FOR_BLPRED 4613 if ( pcCU->isIntra(0) && !pcCU->isIntraBL(0)) 4614 #else 4459 4615 if ( pcCU->isIntra(0) ) 4616 #endif 4460 4617 { 4461 4618 return; … … 4568 4725 pcCU->setTransformSkipSubParts ( 0, 0, 0, 0, pcCU->getDepth(0) ); 4569 4726 } 4727 #if NO_RESIDUAL_FLAG_FOR_BLPRED 4728 else if(pcCU->getLayerId() > 0 && pcCU->isIntraBL(0) && uiZeroDistortion == uiDistortion) // all zeros 4729 { 4730 const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (pcCU->getDepth(0) << 1); 4731 ::memset( pcCU->getTransformIdx() , 0, uiQPartNum * sizeof(UChar) ); 4732 ::memset( pcCU->getCbf( TEXT_LUMA ) , 0, uiQPartNum * sizeof(UChar) ); 4733 ::memset( pcCU->getCbf( TEXT_CHROMA_U ), 0, uiQPartNum * sizeof(UChar) ); 4734 ::memset( pcCU->getCbf( TEXT_CHROMA_V ), 0, uiQPartNum * sizeof(UChar) ); 4735 ::memset( pcCU->getCoeffY() , 0, uiWidth * uiHeight * sizeof( TCoeff ) ); 4736 ::memset( pcCU->getCoeffCb() , 0, uiWidth * uiHeight * sizeof( TCoeff ) >> 2 ); 4737 ::memset( pcCU->getCoeffCr() , 0, uiWidth * uiHeight * sizeof( TCoeff ) >> 2 ); 4738 pcCU->setTransformSkipSubParts ( 0, 0, 0, 0, pcCU->getDepth(0) ); 4739 } 4740 #endif 4570 4741 else 4571 4742 { … … 4866 5037 Int scalingListType = 3 + g_eTTable[(Int)TEXT_LUMA]; 4867 5038 assert(scalingListType < 6); 5039 #if NO_RESIDUAL_FLAG_FOR_BLPRED 5040 if(pcCU->isIntraBL(uiAbsPartIdx) ) 5041 { 5042 m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA,DC_IDX, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcCoeffCurrY, trWidth, trHeight, scalingListType );//this is for inter mode only 5043 } 5044 else 5045 { 5046 m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA,REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcCoeffCurrY, trWidth, trHeight, scalingListType );//this is for inter mode only 5047 } 5048 #else 4868 5049 m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA,REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcCoeffCurrY, trWidth, trHeight, scalingListType );//this is for inter mode only 5050 #endif 4869 5051 4870 5052 const UInt uiNonzeroDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), … … 5136 5318 assert(scalingListType < 6); 5137 5319 5320 #if NO_RESIDUAL_FLAG_FOR_BLPRED 5321 if(pcCU->isIntraBL(uiAbsPartIdx) ) 5322 { 5323 m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA,DC_IDX, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcCoeffCurrY, trWidth, trHeight, scalingListType, true ); 5324 } 5325 else 5326 { 5327 m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA,REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcCoeffCurrY, trWidth, trHeight, scalingListType, true ); 5328 } 5329 #else 5138 5330 m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA,REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcCoeffCurrY, trWidth, trHeight, scalingListType, true ); 5331 #endif 5139 5332 5140 5333 uiNonzeroDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), … … 5467 5660 5468 5661 { 5662 #if INTRA_BL 5663 #if NO_RESIDUAL_FLAG_FOR_BLPRED 5664 assert( !pcCU->isIntra(uiAbsPartIdx) || pcCU->isIntraBL(uiAbsPartIdx)); 5665 #else 5666 assert( !pcCU->isIntra(uiAbsPartIdx) ); 5667 #endif 5668 #else 5469 5669 assert( pcCU->getPredictionMode(uiAbsPartIdx) != MODE_INTRA ); 5670 #endif 5470 5671 if( bSubdivAndCbf ) 5471 5672 { … … 5701 5902 } 5702 5903 m_pcEntropyCoder->encodeSkipFlag ( pcCU, 0, true ); 5904 #if INTRA_BL 5905 if(m_pcEncCfg->getLayerId()) 5906 { 5907 m_pcEntropyCoder->encodeIntraBLFlag(pcCU, 0, true); 5908 #if !NO_RESIDUAL_FLAG_FOR_BLPRED 5909 assert( pcCU->isIntraBL( 0 ) == false ); 5910 #endif 5911 } 5912 #endif 5913 #if NO_RESIDUAL_FLAG_FOR_BLPRED 5914 if( !pcCU->isIntraBL(0)) 5915 { 5916 #endif 5703 5917 m_pcEntropyCoder->encodePredMode( pcCU, 0, true ); 5704 5918 m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true ); 5705 5919 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true ); 5920 #if NO_RESIDUAL_FLAG_FOR_BLPRED 5921 } 5922 #endif 5706 5923 Bool bDummy = false; 5707 5924 m_pcEntropyCoder->encodeCoeff ( pcCU, 0, pcCU->getDepth(0), pcCU->getWidth(0), pcCU->getHeight(0), bDummy ); … … 5952 6169 } 5953 6170 6171 #if REF_IDX_ME_ZEROMV 6172 Void TEncSearch::xPatternSearchFracDIFMv0(TComDataCU* pcCU, 6173 TComPattern* pcPatternKey, 6174 Pel* piRefY, 6175 Int iRefStride, 6176 TComMv* pcMvInt, 6177 TComMv& rcMvHalf, 6178 TComMv& rcMvQter, 6179 UInt& ruiCost, 6180 Bool biPred 6181 ) 6182 { 6183 assert(pcMvInt->getHor() == 0 && pcMvInt->getVer() == 0); 6184 Int iOffset = pcMvInt->getHor() + pcMvInt->getVer() * iRefStride; 6185 m_pcRdCost->setDistParam( pcPatternKey, piRefY + iOffset, iRefStride, 1, m_cDistParam, m_pcEncCfg->getUseHADME() ); 6186 m_pcRdCost->setCostScale ( 2 ); 6187 setDistParamComp(0); 6188 ruiCost = m_cDistParam.DistFunc( &m_cDistParam ); //SATD 6189 ruiCost += m_pcRdCost->getCost( pcMvInt->getHor(), pcMvInt->getVer() ); //SATD rdCost 6190 rcMvHalf.setZero(); 6191 rcMvQter.setZero(); 6192 } 6193 #endif 6194 6195 #if REF_IDX_ME_AROUND_ZEROMV 6196 //ILR integer pixel motion estimation search 6197 //pcCU is CU pointer 6198 //pcPatterney contains target PU infor 6199 //piRefY is the PU at the same position as the source PU, but in the reference pic 6200 //iRefStride is the reference stride 6201 //rcMv output best integer MV 6202 //ruiSAD outputs the SAD of best integer MV 6203 Void TEncSearch::xPatternSearchILR( TComDataCU* pcCU, TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, TComMv& rcMv, UInt& ruiSAD ) 6204 { 6205 Int candMvX[5] = {0, -1, 1, 0, 0}; 6206 Int candMvY[5] = {0, 0, 0, -1, 1}; 6207 Int numCand = 1; 6208 Int iBestX = 0; 6209 Int iBestY = 0; 6210 Int uiSadBest = MAX_UINT; 6211 UInt uiSad; 6212 6213 Pel* piRefSrch; 6214 6215 //-- jclee for using the SAD function pointer 6216 m_pcRdCost->setDistParam( pcPatternKey, piRefY, iRefStride, m_cDistParam ); 6217 6218 // fast encoder decision: use subsampled SAD for integer ME 6219 if ( m_pcEncCfg->getUseFastEnc() ) 6220 { 6221 if ( m_cDistParam.iRows > 8 ) 6222 { 6223 m_cDistParam.iSubShift = 1; 6224 } 6225 } 6226 6227 for(Int candId = 0; candId < numCand; candId++) 6228 { 6229 piRefSrch = piRefY + (candMvY[candId] * iRefStride) + candMvX[candId]; 6230 m_cDistParam.pCur = piRefSrch; 6231 6232 setDistParamComp(0); 6233 6234 uiSad = m_cDistParam.DistFunc( &m_cDistParam ); //SAD 6235 6236 //motion cost 6237 uiSad += m_pcRdCost->getCost( candMvX[candId], candMvY[candId] ); //SAD rdCost 6238 6239 if(uiSad < uiSadBest) 6240 { 6241 uiSadBest = uiSad; 6242 iBestX = candMvX[candId]; 6243 iBestY = candMvY[candId]; 6244 } 6245 } 6246 6247 rcMv.set( iBestX, iBestY ); 6248 6249 ruiSAD = uiSadBest - m_pcRdCost->getCost( iBestX, iBestY ); 6250 return; 6251 } 6252 #endif 6253 6254 #if ENCODER_FAST_MODE 6255 Bool TEncSearch::predInterSearchILRUni( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv ) 6256 { 6257 rpcPredYuv->clear(); 6258 rpcRecoYuv->clear(); 6259 6260 Int iNumPredDir = pcCU->getSlice()->isInterP() ? 1 : 2; 6261 6262 TComMv cMv[2]; 6263 TComMv cMvPred[2][33]; 6264 TComMv cMvTemp[2][33]; 6265 TComMv TempMv; 6266 6267 Int iRefIdx[2]={0,0}; 6268 6269 Int aaiMvpIdx[2][33]; 6270 Int aaiMvpNum[2][33]; 6271 6272 UInt uiMbBits[3] = {1, 1, 0}; 6273 UInt uiLastMode = 0; 6274 6275 UInt uiCost[2] = { MAX_UINT, MAX_UINT }; //uni, rdCost 6276 UInt uiCostTemp; 6277 UInt biPDistTemp = MAX_INT; 6278 UInt uiBitsTemp; 6279 6280 PartSize ePartSize = pcCU->getPartitionSize( 0 ); //2Nx2N 6281 Int iPartIdx = 0; //one PU in CU 6282 UInt uiPartAddr; 6283 Int iRoiWidth, iRoiHeight; 6284 6285 xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits); 6286 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); 6287 6288 for( Int iRefList = 0; iRefList < iNumPredDir; iRefList++) //list 6289 { 6290 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 6291 6292 Int iRefIdxTemp = -1; 6293 Bool foundILR = false; 6294 for( Int refIdx = 0; refIdx < pcCU->getSlice()->getNumRefIdx(eRefPicList); refIdx++ ) 6295 if( pcCU->getSlice()->getRefPic(eRefPicList, refIdx)->getIsILR() ) 6296 { 6297 iRefIdxTemp = refIdx; 6298 foundILR = true; 6299 break; 6300 } 6301 6302 if(!foundILR) //no ILR in eRefPiclist 6303 continue; 6304 6305 uiBitsTemp = uiMbBits[iRefList]; 6306 if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 ) 6307 { 6308 uiBitsTemp += iRefIdxTemp+1; 6309 if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--; 6310 } 6311 6312 xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &biPDistTemp); 6313 aaiMvpIdx[iRefList][iRefIdxTemp] = pcCU->getMVPIdx(eRefPicList, uiPartAddr); 6314 aaiMvpNum[iRefList][iRefIdxTemp] = pcCU->getMVPNum(eRefPicList, uiPartAddr); 6315 6316 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 6317 6318 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 6319 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 6320 6321 if( uiCostTemp < uiCost[iRefList] ) 6322 { 6323 uiCost[iRefList] = uiCostTemp; 6324 6325 cMv[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; 6326 iRefIdx[iRefList] = iRefIdxTemp; 6327 6328 pcCU->getCUMvField(eRefPicList)->setAllMv( cMv[iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 6329 pcCU->getCUMvField(eRefPicList)->setAllRefIdx( iRefIdx[iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 6330 } 6331 } 6332 6333 if( uiCost[0] == MAX_UINT && uiCost[1] == MAX_UINT ) //no ILR in both list0 and list1 6334 return false; 6335 6336 // Clear Motion Field 6337 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( TComMvField(), ePartSize, uiPartAddr, 0, iPartIdx ); 6338 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( TComMvField(), ePartSize, uiPartAddr, 0, iPartIdx ); 6339 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( TComMv(), ePartSize, uiPartAddr, 0, iPartIdx ); 6340 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( TComMv(), ePartSize, uiPartAddr, 0, iPartIdx ); 6341 6342 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6343 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6344 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6345 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6346 6347 if( uiCost[0] <= uiCost[1] ) //list0 ILR 6348 { 6349 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMv ( cMv[0], ePartSize, uiPartAddr, 0, iPartIdx ); 6350 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx( iRefIdx[0], ePartSize, uiPartAddr, 0, iPartIdx ); 6351 6352 TempMv = cMv[0] - cMvPred[0][iRefIdx[0]]; 6353 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 6354 6355 pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 6356 6357 pcCU->setMVPIdxSubParts( aaiMvpIdx[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6358 pcCU->setMVPNumSubParts( aaiMvpNum[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6359 } 6360 else if( uiCost[1] < uiCost[0] ) //list1 ILR 6361 { 6362 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMv ( cMv[1], ePartSize, uiPartAddr, 0, iPartIdx ); 6363 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx( iRefIdx[1], ePartSize, uiPartAddr, 0, iPartIdx ); 6364 6365 TempMv = cMv[1] - cMvPred[1][iRefIdx[1]]; 6366 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 6367 6368 pcCU->setInterDirSubParts( 2, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 6369 6370 pcCU->setMVPIdxSubParts( aaiMvpIdx[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6371 pcCU->setMVPNumSubParts( aaiMvpNum[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6372 } 6373 else 6374 assert(0); 6375 6376 pcCU->setMergeFlagSubParts( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 6377 6378 motionCompensation ( pcCU, rpcPredYuv, REF_PIC_LIST_X, iPartIdx ); 6379 6380 setWpScalingDistParam( pcCU, -1, REF_PIC_LIST_X ); 6381 6382 return true; 6383 } 6384 6385 6386 #endif 6387 6388 #if INTRA_BL 6389 Void 6390 TEncSearch::estIntraBLPredQT( TComDataCU* pcCU, 6391 TComYuv* pcOrgYuv, 6392 TComYuv* pcPredYuv, 6393 TComYuv* pcResiYuv, 6394 TComYuv* pcRecoYuv ) 6395 { 6396 UInt uiDepth = pcCU->getDepth(0); 6397 UInt uiOverallDistY = 0; 6398 UInt uiOverallDistC = 0; 6399 6400 //===== set QP and clear Cbf ===== 6401 if ( pcCU->getSlice()->getPPS()->getUseDQP() == true) 6402 { 6403 pcCU->setQPSubParts( pcCU->getQP(0), 0, uiDepth ); 6404 } 6405 else 6406 { 6407 pcCU->setQPSubParts( pcCU->getSlice()->getSliceQp(), 0, uiDepth ); 6408 } 6409 6410 //===== init pattern for luma prediction ===== 6411 Bool bAboveAvail = false; 6412 Bool bLeftAvail = false; 6413 pcCU->getPattern()->initPattern ( pcCU, 0, 0 ); 6414 pcCU->getPattern()->initAdiPattern( pcCU, 0, 0, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail ); 6415 6416 pcCU->setLumaIntraDirSubParts ( DC_IDX, 0, uiDepth ); 6417 6418 // set context models 6419 if( m_bUseSBACRD ) 6420 { 6421 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] ); 6422 } 6423 6424 // determine residual for partition 6425 Double dPUCost = 0.0; 6426 xRecurIntraCodingQT( pcCU, 0, 0, false, pcOrgYuv, pcPredYuv, pcResiYuv, uiOverallDistY, uiOverallDistC, false, dPUCost ); 6427 xSetIntraResultQT( pcCU, 0, 0, false, pcRecoYuv ); 6428 6429 //=== update PU data ==== 6430 pcCU->copyToPic( uiDepth, 0, 0 ); 6431 6432 //===== reset context models ===== 6433 if(m_bUseSBACRD) 6434 { 6435 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]); 6436 } 6437 6438 //===== set distortion (rate and r-d costs are determined later) ===== 6439 pcCU->getTotalDistortion() = uiOverallDistY + uiOverallDistC; 6440 } 6441 6442 #endif 5954 6443 //! \} -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncSearch.h
r51 r54 97 97 TEncCfg* m_pcEncCfg; 98 98 99 #if SVC_EXTENSION 100 TEncTop** m_ppcTEncTop; 101 #if INTRA_BL 102 TComPicYuv* m_pcPicYuvRecBase; ///< reconstructed base layer 103 #endif 104 #endif 105 99 106 // interface to classes 100 107 TComTrQuant* m_pcTrQuant; … … 186 193 UInt uiPreCalcDistC ); 187 194 195 #if INTRA_BL 196 Void setBaseRecPic ( TComPicYuv* pcPicYuvRecBase ) { m_pcPicYuvRecBase = pcPicYuvRecBase; } 197 TComPicYuv* getBaseRecPic () { return m_pcPicYuvRecBase; } 198 Void estIntraBLPredQT ( TComDataCU* pcCU, 199 TComYuv* pcOrgYuv, 200 TComYuv* pcPredYuv, 201 TComYuv* pcResiYuv, 202 TComYuv* pcRecoYuv ); 203 #endif 188 204 189 205 /// encoder estimation - inter prediction (non-skip) … … 198 214 #endif 199 215 ); 216 217 #if (ENCODER_FAST_MODE) 218 Bool predInterSearchILRUni ( TComDataCU* pcCU, 219 TComYuv* pcOrgYuv, 220 TComYuv*& rpcPredYuv, 221 TComYuv*& rpcResiYuv, 222 TComYuv*& rpcRecoYuv 223 ); 224 225 #endif 200 226 201 227 /// encode residual and compute rd-cost for inter mode … … 436 462 ,Bool biPred 437 463 ); 438 464 #if REF_IDX_ME_AROUND_ZEROMV 465 Void xPatternSearchILR ( TComDataCU* pcCU, 466 TComPattern* pcPatternKey, 467 Pel* piRefY, 468 Int iRefStride, 469 TComMv& rcMv, 470 UInt& ruiSAD ); 471 #endif 472 473 #if REF_IDX_ME_ZEROMV 474 Void xPatternSearchFracDIFMv0 ( TComDataCU* pcCU, 475 TComPattern* pcPatternKey, 476 Pel* piRefY, 477 Int iRefStride, 478 TComMv* pcMvInt, 479 TComMv& rcMvHalf, 480 TComMv& rcMvQter, 481 UInt& ruiCost, 482 Bool biPred ); 483 #endif 439 484 Void xExtDIFUpSamplingH( TComPattern* pcPattern, Bool biPred ); 440 485 Void xExtDIFUpSamplingQ( TComPattern* pcPatternKey, TComMv halfPelRef, Bool biPred ); -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncSlice.cpp
r51 r54 137 137 m_pcCfg = pcEncTop; 138 138 m_pcListPic = pcEncTop->getListPic(); 139 139 #if SVC_EXTENSION 140 m_ppcTEncTop = pcEncTop->getLayerEnc(); 141 #endif 140 142 m_pcGOPEncoder = pcEncTop->getGOPEncoder(); 141 143 m_pcCuEncoder = pcEncTop->getCuEncoder(); … … 186 188 rpcSlice->setSliceBits(0); 187 189 rpcSlice->setPic( pcPic ); 190 #if SET_SLICE_LAYER_ID 191 rpcSlice->initSlice( pcPic->getLayerId() ); 192 #else 188 193 rpcSlice->initSlice(); 194 #endif 189 195 rpcSlice->setPicOutputFlag( true ); 190 196 rpcSlice->setPOC( pocCurr ); 197 #if SVC_EXTENSION && !SET_SLICE_LAYER_ID 198 rpcSlice->setLayerId( pcPic->getLayerId()); 199 #endif 191 200 192 201 // depth computation based on GOP size … … 369 378 eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 370 379 380 #if REF_IDX_FRAMEWORK 381 if(m_pcCfg->getLayerId() > 0) 382 { 383 eSliceType=B_SLICE; 384 } 385 #endif 371 386 rpcSlice->setSliceType ( eSliceType ); 372 387 #endif … … 877 892 UInt uiTileStartLCU = 0; 878 893 UInt uiTileLCUX = 0; 894 895 #if INTRA_BL 896 m_pcCuEncoder->setBaseRecPic( rpcPic->getLayerId() > 0 ? rpcPic->getFullPelBaseRec() : NULL); 897 #endif 898 879 899 Bool depSliceSegmentsEnabled = pcSlice->getPPS()->getDependentSliceSegmentsEnabledFlag(); 880 900 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); … … 924 944 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 925 945 pcCU->initCU( rpcPic, uiCUAddr ); 946 #if SVC_EXTENSION 947 pcCU->setLayerId(m_pcCfg->getLayerId()); 948 #endif 926 949 927 950 #if !RATE_CONTROL_LAMBDA_DOMAIN -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncSlice.h
r51 r54 66 66 TEncCfg* m_pcCfg; ///< encoder configuration class 67 67 68 #if SVC_EXTENSION 69 TEncTop** m_ppcTEncTop; 70 #endif 71 68 72 // pictures 69 73 TComList<TComPic*>* m_pcListPic; ///< list of pictures -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncTop.cpp
r51 r54 45 45 //! \ingroup TLibEncoder 46 46 //! \{ 47 #if SVC_EXTENSION 48 Int TEncTop::m_iSPSIdCnt = 0; 49 Int TEncTop::m_iPPSIdCnt = 0; 50 #endif 47 51 48 52 // ==================================================================================================================== … … 78 82 m_pcBitCounters = NULL; 79 83 m_pcRdCosts = NULL; 84 #if REF_IDX_FRAMEWORK 85 memset(m_cIlpPic, 0, sizeof(m_cIlpPic)); 86 #endif 87 #if REF_IDX_MFM 88 m_bMFMEnabledFlag = false; 89 #endif 80 90 } 81 91 … … 89 99 Void TEncTop::create () 90 100 { 101 #if !SVC_EXTENSION 91 102 // initialize global variables 92 103 initROM(); 104 #endif 93 105 94 106 // create processing unit classes 107 #if SVC_EXTENSION 108 m_cGOPEncoder. create( m_layerId ); 109 #else 95 110 m_cGOPEncoder. create(); 111 #endif 96 112 m_cSliceEncoder. create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 97 113 m_cCuEncoder. create( g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight ); … … 268 284 delete[] m_pcRdCosts; 269 285 286 #if !SVC_EXTENSION 270 287 // destroy ROM 271 288 destroyROM(); 272 289 #endif 290 #if REF_IDX_FRAMEWORK 291 for(Int i=0; i<MAX_NUM_REF; i++) 292 { 293 if(m_cIlpPic[i]) 294 { 295 //m_cIlpPic[i]->setPicYuvRec(NULL); 296 m_cIlpPic[i]->destroy(); 297 delete m_cIlpPic[i]; 298 m_cIlpPic[i] = NULL; 299 } 300 } 301 #endif 273 302 return; 274 303 } … … 313 342 314 343 m_iMaxRefPicNum = 0; 344 #if SVC_EXTENSION 345 m_iSPSIdCnt ++; 346 m_iPPSIdCnt ++; 347 #endif 348 #if REF_IDX_FRAMEWORK 349 xInitILRP(); 350 #endif 315 351 } 316 352 … … 345 381 \retval iNumEncoded number of encoded pictures 346 382 */ 347 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ) 383 #if SVC_EXTENSION 384 Void TEncTop::encode( TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int iPicIdInGOP ) 385 { 386 // compress GOP 387 #if RATE_CONTROL_LAMBDA_DOMAIN 388 if ( m_RCEnableRateControl ) 389 { 390 m_cRateCtrl.initRCGOP( m_iNumPicRcvd ); 391 } 392 #endif 393 394 // compress GOP 395 m_cGOPEncoder.compressGOP(iPicIdInGOP, m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut); 396 397 #if RATE_CONTROL_LAMBDA_DOMAIN 398 if ( m_RCEnableRateControl ) 399 { 400 m_cRateCtrl.destroyRCGOP(); 401 } 402 #endif 403 404 m_uiNumAllPicCoded ++; 405 } 406 407 Void TEncTop::encodePrep( TComPicYuv* pcPicYuvOrg ) 348 408 { 349 409 if (pcPicYuvOrg) { … … 359 419 } 360 420 } 421 } 422 #else 423 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ) 424 { 425 if (pcPicYuvOrg) { 426 // get original YUV 427 TComPic* pcPicCurr = NULL; 428 xGetNewPicBuffer( pcPicCurr ); 429 pcPicYuvOrg->copyToPic( pcPicCurr->getPicYuvOrg() ); 430 431 // compute image characteristics 432 if ( getUseAdaptiveQP() ) 433 { 434 m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcPicCurr ) ); 435 } 436 } 361 437 362 438 if (!m_iNumPicRcvd || (!flush && m_iPOCLast != 0 && m_iNumPicRcvd != m_iGOPSize && m_iGOPSize)) … … 387 463 m_uiNumAllPicCoded += iNumEncoded; 388 464 } 465 #endif 389 466 390 467 // ==================================================================================================================== … … 421 498 { 422 499 TEncPic* pcEPic = new TEncPic; 500 #if SVC_EXTENSION //Temporal solution, should be modified 501 if(m_layerId > 0) 502 { 503 TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 ); 504 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() ) 505 { 506 pcEPic->setSpatialEnhLayerFlag( true ); 507 } 508 } 509 #endif 510 511 #if SVC_UPSAMPLING 512 pcEPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 , 513 m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics, &m_cSPS); 514 #else 423 515 pcEPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 , 424 516 m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics); 517 #endif 425 518 rpcPic = pcEPic; 426 519 } … … 429 522 rpcPic = new TComPic; 430 523 524 #if SVC_EXTENSION //Temporal solution, should be modified 525 if(m_layerId > 0) 526 { 527 TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 ); 528 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() ) 529 { 530 rpcPic->setSpatialEnhLayerFlag( true ); 531 } 532 } 533 #endif 534 535 #if SVC_UPSAMPLING 536 rpcPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 537 m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics, &m_cSPS); 538 #else 431 539 rpcPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 432 540 m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics); 541 #endif 433 542 } 434 543 if (getUseSAO()) … … 450 559 Void TEncTop::xInitSPS() 451 560 { 561 #if SVC_EXTENSION 562 m_cSPS.setLayerId(m_layerId); 563 #endif 564 #if REF_IDX_MFM 565 m_cSPS.setMFMEnabledFlag(m_bMFMEnabledFlag); 566 #endif 452 567 ProfileTierLevel& profileTierLevel = *m_cSPS.getPTL()->getGeneralPTL(); 453 568 profileTierLevel.setLevelIdc(m_level); … … 484 599 m_cSPS.setMinTrDepth ( 0 ); 485 600 m_cSPS.setMaxTrDepth ( 1 ); 601 #if SVC_EXTENSION 602 m_cSPS.setSPSId ( m_iSPSIdCnt ); 603 #endif 486 604 487 605 m_cSPS.setPCMLog2MinSize (m_uiPCMLog2MinSize); … … 690 808 } 691 809 } 810 #if SVC_EXTENSION 811 m_cPPS.setPPSId ( m_iPPSIdCnt ); 812 m_cPPS.setSPSId ( m_iSPSIdCnt ); 813 #endif 692 814 } 693 815 … … 981 1103 } 982 1104 } 1105 1106 #if REF_IDX_FRAMEWORK 1107 Void TEncTop::xInitILRP() 1108 { 1109 if(m_layerId>0) 1110 { 1111 if (m_cIlpPic[0] == NULL) 1112 { 1113 for (Int j=0; j<1/*MAX_NUM_REF*/; j++) 1114 { 1115 m_cIlpPic[j] = new TComPic; 1116 //m_cIlpPic[j]->createWithOutYuv(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, &m_cSPS, true); 1117 #if SVC_UPSAMPLING 1118 m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, &m_cSPS, true); 1119 #else 1120 m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true); 1121 #endif 1122 #if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE || REF_IDX_MFM 1123 m_cIlpPic[j]->setIsILR(true); 1124 #endif 1125 for (Int i=0; i<m_cIlpPic[j]->getPicSym()->getNumberOfCUsInFrame(); i++) 1126 { 1127 m_cIlpPic[j]->getPicSym()->getCU(i)->initCU(m_cIlpPic[j], i); 1128 } 1129 } 1130 } 1131 } 1132 } 1133 1134 Void TEncTop::setILRPic(TComPic *pcPic) 1135 { 1136 if(m_cIlpPic[0]) 1137 { 1138 //m_cIlpPic[0]->setPicYuvRec(pcPic->getFullPelBaseRec()); 1139 m_cIlpPic[0]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(), m_cIlpPic[0]->getPicYuvRec()); 1140 m_cIlpPic[0]->getSlice(0)->setPOC(pcPic->getPOC()); 1141 m_cIlpPic[0]->getPicYuvRec()->setBorderExtension(false); 1142 m_cIlpPic[0]->getPicYuvRec()->extendPicBorder(); 1143 } 1144 } 1145 #endif 983 1146 //! \} -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncTop.h
r51 r54 73 73 UInt m_uiNumAllPicCoded; ///< number of coded pictures 74 74 TComList<TComPic*> m_cListPic; ///< dynamic list of pictures 75 #if SVC_EXTENSION 76 static Int m_iSPSIdCnt; ///< next Id number for SPS 77 static Int m_iPPSIdCnt; ///< next Id number for PPS 78 #if AVC_SYNTAX 79 fstream* m_pBLSyntaxFile; 80 #endif 81 #endif 75 82 76 83 // encoder search … … 122 129 TEncRateCtrl m_cRateCtrl; ///< Rate control class 123 130 131 #if SVC_EXTENSION 132 TEncTop** m_ppcTEncTop; 133 TEncTop* getLayerEnc(UInt layer) { return m_ppcTEncTop[layer]; } 134 #endif 135 #if REF_IDX_FRAMEWORK 136 TComPic* m_cIlpPic[MAX_NUM_REF]; ///< Inter layer Prediction picture = upsampled picture 137 #endif 138 #if REF_IDX_MFM 139 Bool m_bMFMEnabledFlag; 140 #endif 124 141 protected: 125 142 Void xGetNewPicBuffer ( TComPic*& rpcPic ); ///< get picture buffer which will be processed … … 129 146 Void xInitPPSforTiles (); 130 147 Void xInitRPS (); ///< initialize PPS from encoder options 131 148 #if REF_IDX_FRAMEWORK 149 Void xInitILRP(); 150 #endif 132 151 public: 133 152 TEncTop(); … … 174 193 Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid ); 175 194 TComScalingList* getScalingList () { return &m_scalingList; } 195 #if SVC_EXTENSION 196 Void setLayerEnc(TEncTop** p) {m_ppcTEncTop = p;} 197 TEncTop** getLayerEnc() {return m_ppcTEncTop;} 198 Int getPOCLast () { return m_iPOCLast; } 199 Int getNumPicRcvd () { return m_iNumPicRcvd; } 200 Void setNumPicRcvd ( Int num ) { m_iNumPicRcvd = num; } 201 #endif 202 176 203 // ------------------------------------------------------------------------------------------------------------------- 177 204 // encoder function … … 179 206 180 207 /// encode several number of pictures until end-of-sequence 208 #if SVC_EXTENSION 209 #if REF_IDX_FRAMEWORK 210 TComPic** getIlpList() { return m_cIlpPic; } 211 Void setILRPic(TComPic *pcPic); 212 #endif 213 #if REF_IDX_MFM 214 Void setMFMEnabledFlag (Bool flag) {m_bMFMEnabledFlag = flag;} 215 Bool getMFMEnabledFlag() {return m_bMFMEnabledFlag;} 216 #endif 217 #if AVC_SYNTAX 218 Void setBLSyntaxFile( fstream* pFile ) { m_pBLSyntaxFile = pFile; } 219 fstream* getBLSyntaxFile() { return m_pBLSyntaxFile; } 220 #endif 221 Void encode( TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, 222 std::list<AccessUnit>& accessUnitsOut, Int iPicIdInGOP ); 223 Void encodePrep( TComPicYuv* pcPicYuvOrg ); 224 #else 181 225 Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, 182 226 std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ); 227 #endif 183 228 184 229 void printSummary() { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded); }
Note: See TracChangeset for help on using the changeset viewer.