Changeset 1332 in SHVCSoftware
- Timestamp:
- 22 Jul 2015, 01:36:46 (9 years ago)
- Location:
- branches/SHM-dev/source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r1331 r1332 1364 1364 ("SAO", m_bUseSAO, true, "Enable Sample Adaptive Offset") 1365 1365 ("TestSAODisableAtPictureLevel", m_bTestSAODisableAtPictureLevel, false, "Enables the testing of disabling SAO at the picture level after having analysed all blocks") 1366 ("SaoEncodingRate", m_saoEncodingRate, 0.75, "When >0 SAO early picture termination is enabled for luma and chroma") 1367 ("SaoEncodingRateChroma", m_saoEncodingRateChroma, 0.5, "The SAO early picture termination rate to use for chroma (when m_SaoEncodingRate is >0). If <=0, use results for luma") 1366 1368 ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "Max number of SAO offset per picture (Default: 2048)") 1367 1369 ("SAOLcuBoundary", m_saoCtuBoundary, false, "0: right/bottom CTU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas") -
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h
r1331 r1332 249 249 Bool m_bUseSAO; 250 250 Bool m_bTestSAODisableAtPictureLevel; 251 Double m_saoEncodingRate; ///< When >0 SAO early picture termination is enabled for luma and chroma 252 Double m_saoEncodingRateChroma; ///< The SAO early picture termination rate to use for chroma (when m_SaoEncodingRate is >0). If <=0, use results for luma. 251 253 Int m_maxNumOffsetsPerPic; ///< SAO maximun number of offset per picture 252 254 Bool m_saoCtuBoundary; ///< SAO parameter estimation using non-deblocked pixels for CTU bottom and right boundary areas -
branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
r1331 r1332 520 520 m_acTEncTop[layer].setUseSAO ( m_bUseSAO ); 521 521 m_acTEncTop[layer].setTestSAODisableAtPictureLevel ( m_bTestSAODisableAtPictureLevel ); 522 m_acTEncTop[layer].setSaoEncodingRate ( m_saoEncodingRate ); 523 m_acTEncTop[layer].setSaoEncodingRateChroma ( m_saoEncodingRateChroma ); 522 524 m_acTEncTop[layer].setMaxNumOffsetsPerPic ( m_maxNumOffsetsPerPic ); 523 525 … … 954 956 m_cTEncTop.setUseSAO ( m_bUseSAO ); 955 957 m_cTEncTop.setTestSAODisableAtPictureLevel ( m_bTestSAODisableAtPictureLevel ); 958 m_cTEncTop.setSaoEncodingRate ( m_saoEncodingRate ); 959 m_cTEncTop.setSaoEncodingRateChroma ( m_saoEncodingRateChroma ); 956 960 m_cTEncTop.setMaxNumOffsetsPerPic ( m_maxNumOffsetsPerPic); 957 961 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h
r1331 r1332 165 165 Bool m_bUseSAO; 166 166 Bool m_bTestSAODisableAtPictureLevel; 167 Double m_saoEncodingRate; // When non-0 SAO early picture termination is enabled for luma and chroma 168 Double m_saoEncodingRateChroma; // The SAO early picture termination rate to use for chroma (when m_SaoEncodingRate is >0). If <=0, use results for luma. 167 169 Int m_maxNumOffsetsPerPic; 168 170 Bool m_saoCtuBoundary; … … 724 726 Void setTestSAODisableAtPictureLevel (Bool bVal) { m_bTestSAODisableAtPictureLevel = bVal; } 725 727 Bool getTestSAODisableAtPictureLevel ( ) const { return m_bTestSAODisableAtPictureLevel; } 728 729 Void setSaoEncodingRate(Double v) { m_saoEncodingRate = v; } 730 Double getSaoEncodingRate() const { return m_saoEncodingRate; } 731 Void setSaoEncodingRateChroma(Double v) { m_saoEncodingRateChroma = v; } 732 Double getSaoEncodingRateChroma() const { return m_saoEncodingRateChroma; } 726 733 Void setMaxNumOffsetsPerPic (Int iVal) { m_maxNumOffsetsPerPic = iVal; } 727 734 Int getMaxNumOffsetsPerPic () { return m_maxNumOffsetsPerPic; } -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r1331 r1332 2615 2615 m_pcEncTop->getRDGoOnSbacCoder()->setBitstream(&tempBitCounter); 2616 2616 m_pcSAO->initRDOCabacCoder(m_pcEncTop->getRDGoOnSbacCoder(), pcSlice); 2617 m_pcSAO->SAOProcess(pcPic, sliceEnabled, pcPic->getSlice(0)->getLambdas(), m_pcCfg->getTestSAODisableAtPictureLevel() 2617 m_pcSAO->SAOProcess(pcPic, sliceEnabled, pcPic->getSlice(0)->getLambdas(), m_pcCfg->getTestSAODisableAtPictureLevel(), m_pcCfg->getSaoEncodingRate(), m_pcCfg->getSaoEncodingRateChroma() 2618 2618 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK 2619 2619 , m_pcCfg->getSaoCtuBoundary() -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r1331 r1332 127 127 #endif 128 128 129 #if SAO_ENCODING_CHOICE130 129 ::memset(m_saoDisabledRate, 0, sizeof(m_saoDisabledRate)); 131 #endif132 130 133 131 for(Int typeIdc=0; typeIdc < NUM_SAO_NEW_TYPES; typeIdc++) … … 254 252 255 253 256 Void TEncSampleAdaptiveOffset::SAOProcess(TComPic* pPic, Bool* sliceEnabled, const Double *lambdas, const Bool bTestSAODisableAtPictureLevel 254 Void TEncSampleAdaptiveOffset::SAOProcess(TComPic* pPic, Bool* sliceEnabled, const Double *lambdas, const Bool bTestSAODisableAtPictureLevel, const Double saoEncodingRate, const Double saoEncodingRateChroma 257 255 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK 258 256 , Bool isPreDBFSamplesUsed … … 277 275 #endif 278 276 //slice on/off 279 decidePicParams(sliceEnabled, pPic->getSlice(0)->getDepth() );277 decidePicParams(sliceEnabled, pPic->getSlice(0)->getDepth(), saoEncodingRate, saoEncodingRateChroma); 280 278 281 279 //block on/off 282 280 SAOBlkParam* reconParams = new SAOBlkParam[m_numCTUsPic]; //temporary parameter buffer for storing reconstructed SAO parameters 283 decideBlkParams(pPic, sliceEnabled, m_statData, srcYuv, resYuv, reconParams, pPic->getPicSym()->getSAOBlkParam(), bTestSAODisableAtPictureLevel );281 decideBlkParams(pPic, sliceEnabled, m_statData, srcYuv, resYuv, reconParams, pPic->getPicSym()->getSAOBlkParam(), bTestSAODisableAtPictureLevel, saoEncodingRate, saoEncodingRateChroma); 284 282 delete[] reconParams; 285 283 } … … 364 362 } 365 363 366 Void TEncSampleAdaptiveOffset::decidePicParams(Bool* sliceEnabled, Int picTempLayer )364 Void TEncSampleAdaptiveOffset::decidePicParams(Bool* sliceEnabled, Int picTempLayer, const Double saoEncodingRate, const Double saoEncodingRateChroma) 367 365 { 368 366 //decide sliceEnabled[compIdx] … … 378 376 sliceEnabled[compIdx] = true; 379 377 380 #if SAO_ENCODING_CHOICE 381 #if SAO_ENCODING_CHOICE_CHROMA 382 // decide slice-level on/off based on previous results 383 if( (picTempLayer > 0) 384 && (m_saoDisabledRate[compIdx][picTempLayer-1] > ((compIdx==COMPONENT_Y) ? SAO_ENCODING_RATE : SAO_ENCODING_RATE_CHROMA)) ) 385 { 386 sliceEnabled[compIdx] = false; 387 } 388 #else 389 // decide slice-level on/off based on previous results 390 if( (picTempLayer > 0) 391 && (m_saoDisabledRate[COMPONENT_Y][0] > SAO_ENCODING_RATE) ) 392 { 393 sliceEnabled[compIdx] = false; 394 } 395 #endif 396 #endif 378 if (saoEncodingRate>0.0) 379 { 380 if (saoEncodingRateChroma>0.0) 381 { 382 // decide slice-level on/off based on previous results 383 if( (picTempLayer > 0) 384 && (m_saoDisabledRate[compIdx][picTempLayer-1] > ((compIdx==COMPONENT_Y) ? saoEncodingRate : saoEncodingRateChroma)) ) 385 { 386 sliceEnabled[compIdx] = false; 387 } 388 } 389 else 390 { 391 // decide slice-level on/off based on previous results 392 if( (picTempLayer > 0) 393 && (m_saoDisabledRate[COMPONENT_Y][0] > saoEncodingRate) ) 394 { 395 sliceEnabled[compIdx] = false; 396 } 397 } 398 } 397 399 } 398 400 } … … 791 793 } 792 794 793 Void TEncSampleAdaptiveOffset::decideBlkParams(TComPic* pic, Bool* sliceEnabled, SAOStatData*** blkStats, TComPicYuv* srcYuv, TComPicYuv* resYuv, SAOBlkParam* reconParams, SAOBlkParam* codedParams, const Bool bTestSAODisableAtPictureLevel) 795 Void TEncSampleAdaptiveOffset::decideBlkParams(TComPic* pic, Bool* sliceEnabled, SAOStatData*** blkStats, TComPicYuv* srcYuv, TComPicYuv* resYuv, 796 SAOBlkParam* reconParams, SAOBlkParam* codedParams, const Bool bTestSAODisableAtPictureLevel, 797 const Double saoEncodingRate, const Double saoEncodingRateChroma) 794 798 { 795 799 Bool allBlksDisabled = true; … … 895 899 } 896 900 897 #if SAO_ENCODING_CHOICE 898 Int picTempLayer = pic->getSlice(0)->getDepth(); 899 Int numCtusForSAOOff[MAX_NUM_COMPONENT]; 900 901 for (Int compIdx = 0; compIdx < numberOfComponents; compIdx++) 902 { 903 numCtusForSAOOff[compIdx] = 0; 904 for(Int ctuRsAddr=0; ctuRsAddr< m_numCTUsPic; ctuRsAddr++) 905 { 906 if( reconParams[ctuRsAddr][compIdx].modeIdc == SAO_MODE_OFF) 907 { 908 numCtusForSAOOff[compIdx]++; 909 } 910 } 911 } 912 #if SAO_ENCODING_CHOICE_CHROMA 913 for (Int compIdx = 0; compIdx < numberOfComponents; compIdx++) 914 { 915 m_saoDisabledRate[compIdx][picTempLayer] = (Double)numCtusForSAOOff[compIdx]/(Double)m_numCTUsPic; 916 } 917 #else 918 if (picTempLayer == 0) 919 { 920 m_saoDisabledRate[COMPONENT_Y][0] = (Double)(numCtusForSAOOff[COMPONENT_Y]+numCtusForSAOOff[COMPONENT_Cb]+numCtusForSAOOff[COMPONENT_Cr])/(Double)(m_numCTUsPic*3); 921 } 922 #endif 923 #endif 901 if (saoEncodingRate > 0.0) 902 { 903 Int picTempLayer = pic->getSlice(0)->getDepth(); 904 Int numCtusForSAOOff[MAX_NUM_COMPONENT]; 905 906 for (Int compIdx = 0; compIdx < numberOfComponents; compIdx++) 907 { 908 numCtusForSAOOff[compIdx] = 0; 909 for(Int ctuRsAddr=0; ctuRsAddr< m_numCTUsPic; ctuRsAddr++) 910 { 911 if( reconParams[ctuRsAddr][compIdx].modeIdc == SAO_MODE_OFF) 912 { 913 numCtusForSAOOff[compIdx]++; 914 } 915 } 916 } 917 if (saoEncodingRateChroma > 0.0) 918 { 919 for (Int compIdx = 0; compIdx < numberOfComponents; compIdx++) 920 { 921 m_saoDisabledRate[compIdx][picTempLayer] = (Double)numCtusForSAOOff[compIdx]/(Double)m_numCTUsPic; 922 } 923 } 924 else if (picTempLayer == 0) 925 { 926 m_saoDisabledRate[COMPONENT_Y][0] = (Double)(numCtusForSAOOff[COMPONENT_Y]+numCtusForSAOOff[COMPONENT_Cb]+numCtusForSAOOff[COMPONENT_Cr])/(Double)(m_numCTUsPic*3); 927 } 928 } 924 929 } 925 930 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h
r1331 r1332 109 109 Void destroyEncData(); 110 110 Void initRDOCabacCoder(TEncSbac* pcRDGoOnSbacCoder, TComSlice* pcSlice) ; 111 Void SAOProcess(TComPic* pPic, Bool* sliceEnabled, const Double *lambdas, const Bool bTestSAODisableAtPictureLevel 111 Void SAOProcess(TComPic* pPic, Bool* sliceEnabled, const Double *lambdas, const Bool bTestSAODisableAtPictureLevel, const Double saoEncodingRate, const Double saoEncodingRateChroma 112 112 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK 113 113 , Bool isPreDBFSamplesUsed … … 124 124 #endif 125 125 ); 126 Void decidePicParams(Bool* sliceEnabled, Int picTempLayer );127 Void decideBlkParams(TComPic* pic, Bool* sliceEnabled, SAOStatData*** blkStats, TComPicYuv* srcYuv, TComPicYuv* resYuv, SAOBlkParam* reconParams, SAOBlkParam* codedParams, const Bool bTestSAODisableAtPictureLevel );126 Void decidePicParams(Bool* sliceEnabled, Int picTempLayer, const Double saoEncodingRate, const Double saoEncodingRateChroma); 127 Void decideBlkParams(TComPic* pic, Bool* sliceEnabled, SAOStatData*** blkStats, TComPicYuv* srcYuv, TComPicYuv* resYuv, SAOBlkParam* reconParams, SAOBlkParam* codedParams, const Bool bTestSAODisableAtPictureLevel, const Double saoEncodingRate, const Double saoEncodingRateChroma); 128 128 Void getBlkStats(const ComponentID compIdx, const Int channelBitDepth, SAOStatData* statsDataTypes, Pel* srcBlk, Pel* orgBlk, Int srcStride, Int orgStride, Int width, Int height, Bool isLeftAvail, Bool isRightAvail, Bool isAboveAvail, Bool isBelowAvail, Bool isAboveLeftAvail, Bool isAboveRightAvail 129 129 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK … … 156 156 SAOStatData*** m_preDBFstatData; 157 157 #endif 158 #if SAO_ENCODING_CHOICE159 158 Double m_saoDisabledRate[MAX_NUM_COMPONENT][MAX_TLAYER]; 160 #endif161 159 Int m_skipLinesR[MAX_NUM_COMPONENT][NUM_SAO_NEW_TYPES]; 162 160 Int m_skipLinesB[MAX_NUM_COMPONENT][NUM_SAO_NEW_TYPES];
Note: See TracChangeset for help on using the changeset viewer.