Changeset 1369 in SHVCSoftware
- Timestamp:
- 22 Jul 2015, 04:53:13 (9 years ago)
- Location:
- branches/SHM-dev/source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r1366 r1369 1328 1328 #endif 1329 1329 ("MaxCUChromaQpAdjustmentDepth", m_diffCuChromaQpOffsetDepth, -1, "Maximum depth for CU chroma Qp adjustment - set less than 0 to disable") 1330 ("FastDeltaQP", m_bFastDeltaQP, false, "Fast Delta QP Algorithm") 1330 1331 1331 1332 ("CbQpOffset,-cbqpofs", m_cbQpOffset, 0, "Chroma Cb QP Offset") -
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h
r1366 r1369 205 205 #endif 206 206 Int m_diffCuChromaQpOffsetDepth; ///< If negative, then do not apply chroma qp offsets. 207 Bool m_bFastDeltaQP; ///< Fast Delta QP (false:default) 207 208 208 209 Int m_cbQpOffset; ///< Chroma Cb QP Offset (0:default) -
branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
r1366 r1369 433 433 //====== Tool list ======== 434 434 m_acTEncTop[layer].setDeltaQpRD ( m_uiDeltaQpRD ); 435 m_acTEncTop[layer].setFastDeltaQp ( m_bFastDeltaQP ); 435 436 m_acTEncTop[layer].setUseASR ( m_bUseASR ); 436 437 m_acTEncTop[layer].setUseHADME ( m_bUseHADME ); … … 883 884 //====== Tool list ======== 884 885 m_cTEncTop.setDeltaQpRD ( m_uiDeltaQpRD ); 886 m_cTEncTop.setFastDeltaQp ( m_bFastDeltaQP ); 885 887 m_cTEncTop.setUseASR ( m_bUseASR ); 886 888 m_cTEncTop.setUseHADME ( m_bUseHADME ); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h
r1356 r1369 224 224 Int* m_aidQP; 225 225 UInt m_uiDeltaQpRD; 226 Bool m_bFastDeltaQP; 226 227 227 228 Bool m_bUseConstrainedIntraPred; … … 663 664 Void setdQPs ( Int* p ) { m_aidQP = p; } 664 665 Void setDeltaQpRD ( UInt u ) {m_uiDeltaQpRD = u; } 666 Void setFastDeltaQp ( Bool b ) {m_bFastDeltaQP = b; } 665 667 Bool getUseASR () { return m_bUseASR; } 666 668 Bool getUseHADME () { return m_bUseHADME; } … … 711 713 Void setIntraSmoothingDisabledFlag (Bool bValue) { m_intraSmoothingDisabledFlag=bValue; } 712 714 713 Int* getdQPs () { return m_aidQP; } 714 UInt getDeltaQpRD () { return m_uiDeltaQpRD; } 715 Int* getdQPs () { return m_aidQP; } 716 UInt getDeltaQpRD () const { return m_uiDeltaQpRD; } 717 Bool getFastDeltaQp () const { return m_bFastDeltaQP; } 715 718 716 719 //====== Slice ======== -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCu.cpp
r1346 r1369 100 100 m_stillToCodeChromaQpOffsetFlag = false; 101 101 m_cuChromaQpOffsetIdxPlus1 = 0; 102 m_bFastDeltaQP = false; 102 103 103 104 // initialize partition order. … … 365 366 */ 366 367 #if AMP_ENC_SPEEDUP 367 Void TEncCu::xCompressCU( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth DEBUG_STRING_FN_DECLARE(sDebug_), PartSize eParentPartSize )368 #else 369 Void TEncCu::xCompressCU( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth )368 Void TEncCu::xCompressCU( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, const UInt uiDepth DEBUG_STRING_FN_DECLARE(sDebug_), PartSize eParentPartSize ) 369 #else 370 Void TEncCu::xCompressCU( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, const UInt uiDepth ) 370 371 #endif 371 372 { … … 374 375 const TComPPS &pps=*(rpcTempCU->getSlice()->getPPS()); 375 376 const TComSPS &sps=*(rpcTempCU->getSlice()->getSPS()); 377 378 // These are only used if getFastDeltaQp() is true 379 const UInt fastDeltaQPCuMaxSize = Clip3(sps.getMaxCUHeight()>>sps.getLog2DiffMaxMinCodingBlockSize(), sps.getMaxCUHeight(), 32u); 376 380 377 381 // get Original YUV data from picture 378 382 m_ppcOrigYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvOrg(), rpcBestCU->getCtuRsAddr(), rpcBestCU->getZorderIdxInCtu() ); 379 380 // variable for Early CU determination381 Bool bSubBranch = true;382 383 383 384 // variable for Cbf fast mode PU decision … … 385 386 Bool earlyDetectionSkipMode = false; 386 387 387 Bool bBoundary = false;388 UInt uiLPelX = rpcBestCU->getCUPelX();389 UInt uiRPelX = uiLPelX + rpcBestCU->getWidth(0) - 1;390 UInt uiTPelY = rpcBestCU->getCUPelY();391 UInt uiBPelY = uiTPelY + rpcBestCU->getHeight(0) - 1;388 const UInt uiLPelX = rpcBestCU->getCUPelX(); 389 const UInt uiRPelX = uiLPelX + rpcBestCU->getWidth(0) - 1; 390 const UInt uiTPelY = rpcBestCU->getCUPelY(); 391 const UInt uiBPelY = uiTPelY + rpcBestCU->getHeight(0) - 1; 392 const UInt uiWidth = rpcBestCU->getWidth(0); 392 393 393 394 Int iBaseQP = xComputeQP( rpcBestCU, uiDepth ); … … 436 437 437 438 TComSlice * pcSlice = rpcTempCU->getPic()->getSlice(rpcTempCU->getPic()->getCurrSliceIdx()); 438 // We need to split, so don't try these modes.439 439 #if SVC_EXTENSION 440 if ( ( uiRPelX < rpcBestCU->getSlice()->getPicWidthInLumaSamples() ) &&441 ( uiBPelY < rpcBestCU->getSlice()->getPicHeightInLumaSamples() ) ) 442 #else 443 if ( ( uiRPelX < sps.getPicWidthInLumaSamples() ) && 444 ( uiBPelY < sps.getPicHeightInLumaSamples() ) ) 445 #endif 440 const Bool bBoundary = !( uiRPelX < rpcBestCU->getSlice()->getPicWidthInLumaSamples() && uiBPelY < rpcBestCU->getSlice()->getPicHeightInLumaSamples() ); 441 #else 442 const Bool bBoundary = !( uiRPelX < sps.getPicWidthInLumaSamples() && uiBPelY < sps.getPicHeightInLumaSamples() ); 443 #endif 444 445 if ( !bBoundary ) 446 446 { 447 447 #if HIGHER_LAYER_IRAP_SKIP_FLAG … … 774 774 } 775 775 776 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_NEXT_BEST]); 777 m_pcEntropyCoder->resetBits(); 778 m_pcEntropyCoder->encodeSplitFlag( rpcBestCU, 0, uiDepth, true ); 779 rpcBestCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits 780 rpcBestCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 781 rpcBestCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() ); 782 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_NEXT_BEST]); 783 784 // Early CU determination 785 if( m_pcEncCfg->getUseEarlyCU() && rpcBestCU->isSkipped(0) ) 786 { 787 bSubBranch = false; 788 } 789 else 790 { 791 bSubBranch = true; 792 } 776 if( rpcBestCU->getTotalCost()!=MAX_DOUBLE ) 777 { 778 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_NEXT_BEST]); 779 m_pcEntropyCoder->resetBits(); 780 m_pcEntropyCoder->encodeSplitFlag( rpcBestCU, 0, uiDepth, true ); 781 rpcBestCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits 782 rpcBestCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 783 rpcBestCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() ); 784 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_NEXT_BEST]); 785 } 786 793 787 #if HIGHER_LAYER_IRAP_SKIP_FLAG 794 788 } 795 789 #endif 796 790 } 797 else 798 { 799 bBoundary = true; 800 } 801 802 // copy orginal YUV samples to PCM buffer 803 if( rpcBestCU->isLosslessCoded(0) && (rpcBestCU->getIPCMFlag(0) == false)) 791 792 // copy original YUV samples to PCM buffer 793 if( rpcBestCU->getTotalCost()!=MAX_DOUBLE && rpcBestCU->isLosslessCoded(0) && (rpcBestCU->getIPCMFlag(0) == false)) 804 794 { 805 795 xFillPCMBuffer(rpcBestCU, m_ppcOrigYuv[uiDepth]); … … 840 830 } 841 831 842 for (Int iQP=iMinQP; iQP<=iMaxQP; iQP++) 843 { 844 const Bool bIsLosslessMode = false; // False at this level. Next level down may set it to true. 845 846 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 847 832 const Bool bSubBranch = bBoundary || !( m_pcEncCfg->getUseEarlyCU() && rpcBestCU->getTotalCost()!=MAX_DOUBLE && rpcBestCU->isSkipped(0) ); 833 834 if( bSubBranch && uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() && (!getFastDeltaQp() || uiWidth > fastDeltaQPCuMaxSize || bBoundary)) 835 { 848 836 // further split 849 if( bSubBranch && uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() ) 850 { 837 for (Int iQP=iMinQP; iQP<=iMaxQP; iQP++) 838 { 839 const Bool bIsLosslessMode = false; // False at this level. Next level down may set it to true. 840 841 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 842 851 843 UChar uhNextDepth = uiDepth+1; 852 844 TComDataCU* pcSubBestPartCU = m_ppcBestCU[uhNextDepth]; … … 876 868 #if AMP_ENC_SPEEDUP 877 869 DEBUG_STRING_NEW(sChild) 878 if ( ! rpcBestCU->isInter(0) )870 if ( !(rpcBestCU->getTotalCost()!=MAX_DOUBLE && rpcBestCU->isInter(0)) ) 879 871 { 880 872 xCompressCU( pcSubBestPartCU, pcSubTempPartCU, uhNextDepth DEBUG_STRING_PASS_INTO(sChild), NUMBER_OF_PART_SIZES ); … … 951 943 // This can be achieved by forcing the decision to be that of the rpcTempCU. 952 944 // The exception is each slice / slice-segment must have at least one CTU. 953 const Bool isEndOfSlice = pcSlice->getSliceMode()==FIXED_NUMBER_OF_BYTES 954 && ((pcSlice->getSliceBits()+rpcBestCU->getTotalBits())>pcSlice->getSliceArgument()<<3) 955 && rpcBestCU->getCtuRsAddr() != pcPic->getPicSym()->getCtuTsToRsAddrMap(pcSlice->getSliceCurStartCtuTsAddr()) 956 && rpcBestCU->getCtuRsAddr() != pcPic->getPicSym()->getCtuTsToRsAddrMap(pcSlice->getSliceSegmentCurStartCtuTsAddr()); 957 const Bool isEndOfSliceSegment = pcSlice->getSliceSegmentMode()==FIXED_NUMBER_OF_BYTES 958 && ((pcSlice->getSliceSegmentBits()+rpcBestCU->getTotalBits()) > pcSlice->getSliceSegmentArgument()<<3) 959 && rpcBestCU->getCtuRsAddr() != pcPic->getPicSym()->getCtuTsToRsAddrMap(pcSlice->getSliceSegmentCurStartCtuTsAddr()); 960 // Do not need to check slice condition for slice-segment since a slice-segment is a subset of a slice. 961 if(isEndOfSlice||isEndOfSliceSegment) 962 { 963 rpcBestCU->getTotalCost()=MAX_DOUBLE; 945 if (rpcBestCU->getTotalCost()!=MAX_DOUBLE) 946 { 947 const Bool isEndOfSlice = pcSlice->getSliceMode()==FIXED_NUMBER_OF_BYTES 948 && ((pcSlice->getSliceBits()+rpcBestCU->getTotalBits())>pcSlice->getSliceArgument()<<3) 949 && rpcBestCU->getCtuRsAddr() != pcPic->getPicSym()->getCtuTsToRsAddrMap(pcSlice->getSliceCurStartCtuTsAddr()) 950 && rpcBestCU->getCtuRsAddr() != pcPic->getPicSym()->getCtuTsToRsAddrMap(pcSlice->getSliceSegmentCurStartCtuTsAddr()); 951 const Bool isEndOfSliceSegment = pcSlice->getSliceSegmentMode()==FIXED_NUMBER_OF_BYTES 952 && ((pcSlice->getSliceSegmentBits()+rpcBestCU->getTotalBits()) > pcSlice->getSliceSegmentArgument()<<3) 953 && rpcBestCU->getCtuRsAddr() != pcPic->getPicSym()->getCtuTsToRsAddrMap(pcSlice->getSliceSegmentCurStartCtuTsAddr()); 954 // Do not need to check slice condition for slice-segment since a slice-segment is a subset of a slice. 955 if(isEndOfSlice||isEndOfSliceSegment) 956 { 957 rpcBestCU->getTotalCost()=MAX_DOUBLE; 958 } 964 959 } 965 960 966 961 xCheckBestMode( rpcBestCU, rpcTempCU, uiDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTempDebug) DEBUG_STRING_PASS_INTO(false) ); // RD compare current larger prediction 967 // with sub partitioned prediction.962 // with sub partitioned prediction. 968 963 } 969 964 } … … 1299 1294 { 1300 1295 assert( rpcTempCU->getSlice()->getSliceType() != I_SLICE ); 1296 if(getFastDeltaQp()) 1297 { 1298 return; // never check merge in fast deltaqp mode 1299 } 1301 1300 TComMvField cMvFieldNeighbours[2 * MRG_MAX_NUM_CANDS]; // double length for mv of both lists 1302 1301 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; … … 1447 1446 DEBUG_STRING_NEW(sTest) 1448 1447 1448 if(getFastDeltaQp()) 1449 { 1450 const TComSPS &sps=*(rpcTempCU->getSlice()->getSPS()); 1451 const UInt fastDeltaQPCuMaxSize = Clip3(sps.getMaxCUHeight()>>(sps.getLog2DiffMaxMinCodingBlockSize()), sps.getMaxCUHeight(), 32u); 1452 if(ePartSize != SIZE_2Nx2N || rpcTempCU->getWidth( 0 ) > fastDeltaQPCuMaxSize) 1453 { 1454 return; // only check necessary 2Nx2N Inter in fast deltaqp mode 1455 } 1456 } 1457 1449 1458 // prior to this, rpcTempCU will have just been reset using rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1450 1459 UChar uhDepth = rpcTempCU->getDepth( 0 ); … … 1501 1510 DEBUG_STRING_NEW(sTest) 1502 1511 1512 if(getFastDeltaQp()) 1513 { 1514 const TComSPS &sps=*(rpcTempCU->getSlice()->getSPS()); 1515 const UInt fastDeltaQPCuMaxSize = Clip3(sps.getMaxCUHeight()>>(sps.getLog2DiffMaxMinCodingBlockSize()), sps.getMaxCUHeight(), 32u); 1516 if(rpcTempCU->getWidth( 0 ) > fastDeltaQPCuMaxSize) 1517 { 1518 return; // only check necessary 2Nx2N Intra in fast deltaqp mode 1519 } 1520 } 1521 1503 1522 UInt uiDepth = rpcTempCU->getDepth( 0 ); 1504 1523 … … 1563 1582 Void TEncCu::xCheckIntraPCM( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU ) 1564 1583 { 1584 if(getFastDeltaQp()) 1585 { 1586 const TComSPS &sps=*(rpcTempCU->getSlice()->getSPS()); 1587 const UInt fastDeltaQPCuMaxPCMSize = Clip3((UInt)1<<sps.getPCMLog2MinSize(), (UInt)1<<sps.getPCMLog2MaxSize(), 32u); 1588 if (rpcTempCU->getWidth( 0 ) > fastDeltaQPCuMaxPCMSize) 1589 { 1590 return; // only check necessary PCM in fast deltaqp mode 1591 } 1592 } 1593 1565 1594 UInt uiDepth = rpcTempCU->getDepth( 0 ); 1566 1595 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCu.h
r1316 r1369 81 81 // Data : encoder control 82 82 Bool m_bEncodeDQP; 83 Bool m_bFastDeltaQP; 83 84 Bool m_stillToCodeChromaQpOffsetFlag; //indicates whether chroma QP offset flag needs to coded at this particular CU granularity. 84 85 Int m_cuChromaQpOffsetIdxPlus1; // if 0, then cu_chroma_qp_offset_flag will be 0, otherwise cu_chroma_qp_offset_flag will be 1. … … 122 123 Int updateCtuDataISlice ( TComDataCU* pCtu, Int width, Int height ); 123 124 125 Void setFastDeltaQp ( Bool b) { m_bFastDeltaQP = b; } 126 124 127 protected: 125 128 Void finishCU ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 126 129 #if AMP_ENC_SPEEDUP 127 Void xCompressCU ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth DEBUG_STRING_FN_DECLARE(sDebug), PartSize eParentPartSize = NUMBER_OF_PART_SIZES );130 Void xCompressCU ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, const UInt uiDepth DEBUG_STRING_FN_DECLARE(sDebug), PartSize eParentPartSize = NUMBER_OF_PART_SIZES ); 128 131 #else 129 Void xCompressCU ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth );132 Void xCompressCU ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, const UInt uiDepth ); 130 133 #endif 131 134 Void xEncodeCU ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); … … 162 165 Void setdQPFlag ( Bool b ) { m_bEncodeDQP = b; } 163 166 167 Bool getFastDeltaQp () const { return m_bFastDeltaQP; } 168 164 169 Bool getCodeChromaQpAdjFlag() { return m_stillToCodeChromaQpOffsetFlag; } 165 170 Void setCodeChromaQpAdjFlag( Bool b ) { m_stillToCodeChromaQpOffsetFlag = b; } -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r1367 r1369 2492 2492 { 2493 2493 m_pcSliceEncoder->precompressSlice( pcPic ); 2494 m_pcSliceEncoder->compressSlice ( pcPic, false );2494 m_pcSliceEncoder->compressSlice ( pcPic, false, false ); 2495 2495 2496 2496 const UInt curSliceSegmentEnd = pcSlice->getSliceSegmentCurEndCtuTsAddr(); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r1336 r1369 677 677 678 678 // try compress 679 compressSlice ( pcPic, true 679 compressSlice ( pcPic, true, m_pcCfg->getFastDeltaQp()); 680 680 681 681 UInt64 uiPicDist = m_uiPicDist; // Distortion, as calculated by compressSlice. … … 749 749 /** \param pcPic picture class 750 750 */ 751 Void TEncSlice::compressSlice( TComPic* pcPic, const Bool bCompressEntireSlice )751 Void TEncSlice::compressSlice( TComPic* pcPic, const Bool bCompressEntireSlice, const Bool bFastDeltaQP ) 752 752 { 753 753 // if bCompressEntireSlice is true, then the entire slice (not slice segment) is compressed, … … 779 779 TComBitCounter tempBitCounter; 780 780 const UInt frameWidthInCtus = pcPic->getPicSym()->getFrameWidthInCtus(); 781 782 m_pcCuEncoder->setFastDeltaQp(bFastDeltaQP); 781 783 782 784 //------------------------------------------------------------------------------ -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.h
r1318 r1369 125 125 // compress and encode slice 126 126 Void precompressSlice ( TComPic* pcPic ); ///< precompress slice for multi-loop slice-level QP opt. 127 Void compressSlice ( TComPic* pcPic, const Bool bCompressEntireSlice 127 Void compressSlice ( TComPic* pcPic, const Bool bCompressEntireSlice, const Bool bFastDeltaQP ); ///< analysis stage of slice 128 128 Void calCostSliceI ( TComPic* pcPic ); 129 129 Void encodeSlice ( TComPic* pcPic, TComOutputBitstream* pcSubstreams, UInt &numBinsCoded );
Note: See TracChangeset for help on using the changeset viewer.