Changeset 282 in SHVCSoftware for branches/SHM-2.1-dev/source
- Timestamp:
- 11 Jun 2013, 02:30:21 (12 years ago)
- Location:
- branches/SHM-2.1-dev/source
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-2.1-dev/source
- Property svn:mergeinfo changed
/branches/SHM-2.1-multilayers-dev/source (added) merged: 253-257,259-275,277-280
- Property svn:mergeinfo changed
-
branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r245 r282 153 153 } 154 154 } 155 156 for(Int layer = 0; layer < MAX_LAYERS; layer++) 157 { 158 if( m_acLayerCfg[layer].m_numActiveRefLayers > 0 ) 159 { 160 delete [] m_acLayerCfg[layer].m_predLayerIds; 161 } 162 } 155 163 #endif 156 164 } … … 329 337 #if VPS_EXTN_DIRECT_REF_LAYERS 330 338 Int* cfg_numDirectRefLayers [MAX_LAYERS]; 331 string cfg_refLayerIds [MAX_LAYERS]; 332 string* cfg_refLayerIdsPtr [MAX_LAYERS]; 339 string cfg_refLayerIds [MAX_LAYERS]; 340 string* cfg_refLayerIdsPtr [MAX_LAYERS]; 341 342 Int* cfg_numActiveRefLayers [MAX_LAYERS]; 343 string cfg_predLayerIds [MAX_LAYERS]; 344 string* cfg_predLayerIdsPtr [MAX_LAYERS]; 333 345 #endif 334 346 #if SCALED_REF_LAYER_OFFSETS … … 360 372 cfg_numDirectRefLayers [layer] = &m_acLayerCfg[layer].m_numDirectRefLayers; 361 373 cfg_refLayerIdsPtr [layer] = &cfg_refLayerIds[layer]; 374 cfg_numActiveRefLayers [layer] = &m_acLayerCfg[layer].m_numActiveRefLayers; 375 cfg_predLayerIdsPtr [layer] = &cfg_predLayerIds[layer]; 362 376 #endif 363 377 #if SCALED_REF_LAYER_OFFSETS … … 422 436 ("NumDirectRefLayers%d", cfg_numDirectRefLayers, -1, MAX_LAYERS, "Number of direct reference layers") 423 437 ("RefLayerIds%d", cfg_refLayerIdsPtr, string(""), MAX_LAYERS, "direct reference layer IDs") 438 ("NumActiveRefLayers%d", cfg_numActiveRefLayers, -1, MAX_LAYERS, "Number of active reference layers") 439 ("PredLayerIds%d", cfg_predLayerIdsPtr, string(""), MAX_LAYERS, "inter-layer prediction layer IDs") 424 440 #endif 425 441 ("NumLayers", m_numLayers, 1, "Number of layers to code") … … 890 906 if( i >= m_acLayerCfg[layer].m_numDirectRefLayers ) 891 907 { 892 printf( " The number of columns whose width are defined is larger than the allowed number of columns.\n" );908 printf( "NumDirectRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" ); 893 909 exit( EXIT_FAILURE ); 894 910 } … … 899 915 if( i < m_acLayerCfg[layer].m_numDirectRefLayers ) 900 916 { 901 printf( " The width of some columns is not defined.\n" );917 printf( "NumDirectRefLayers: The width of some columns is not defined.\n" ); 902 918 exit( EXIT_FAILURE ); 903 919 } … … 906 922 { 907 923 m_acLayerCfg[layer].m_refLayerIds = NULL; 924 } 925 } 926 927 for(Int layer = 0; layer < MAX_LAYERS; layer++) 928 { 929 Char* pPredLayerIds = cfg_predLayerIds[layer].empty() ? NULL: strdup(cfg_predLayerIds[layer].c_str()); 930 if( m_acLayerCfg[layer].m_numActiveRefLayers > 0 ) 931 { 932 char *refLayerId; 933 int i=0; 934 m_acLayerCfg[layer].m_predLayerIds = new Int[m_acLayerCfg[layer].m_numActiveRefLayers]; 935 refLayerId = strtok(pPredLayerIds, " ,-"); 936 while(refLayerId != NULL) 937 { 938 if( i >= m_acLayerCfg[layer].m_numActiveRefLayers ) 939 { 940 printf( "NumActiveRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" ); 941 exit( EXIT_FAILURE ); 942 } 943 *( m_acLayerCfg[layer].m_predLayerIds + i ) = atoi( refLayerId ); 944 refLayerId = strtok(NULL, " ,-"); 945 i++; 946 } 947 if( i < m_acLayerCfg[layer].m_numActiveRefLayers ) 948 { 949 printf( "NumActiveRefLayers: The width of some columns is not defined.\n" ); 950 exit( EXIT_FAILURE ); 951 } 952 } 953 else 954 { 955 m_acLayerCfg[layer].m_predLayerIds = NULL; 908 956 } 909 957 } … … 1840 1888 } 1841 1889 } 1890 1891 xConfirmPara( (m_acLayerCfg[0].m_numActiveRefLayers != 0) && (m_acLayerCfg[0].m_numActiveRefLayers != -1), "Layer 0 cannot have any active reference layers" ); 1892 // NOTE: m_numActiveRefLayers (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference 1893 for(Int layer = 1; layer < MAX_LAYERS; layer++) 1894 { 1895 xConfirmPara(m_acLayerCfg[layer].m_numActiveRefLayers > m_acLayerCfg[layer].m_numDirectRefLayers, "Cannot reference more layers than NumDirectRefLayers"); 1896 for(Int i = 0; i < m_acLayerCfg[layer].m_numActiveRefLayers; i++) 1897 { 1898 xConfirmPara(m_acLayerCfg[layer].m_predLayerIds[i] > m_acLayerCfg[layer].m_numDirectRefLayers, "Cannot reference higher layers"); 1899 } 1900 } 1842 1901 #endif 1843 1902 #undef xConfirmPara -
branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncLayerCfg.h
r211 r282 45 45 Int *m_refLayerIds; 46 46 Int m_numDirectRefLayers; 47 Int *m_predLayerIds; 48 Int m_numActiveRefLayers; 47 49 #endif 48 50 … … 108 110 Int* getRefLayerIds() {return m_refLayerIds; } 109 111 Int getRefLayerId(Int i) {return m_refLayerIds[i]; } 112 113 Int getNumActiveRefLayers() {return m_numActiveRefLayers;} 114 Int* getPredLayerIds() {return m_predLayerIds; } 115 Int getPredLayerId(Int i) {return m_predLayerIds[i]; } 110 116 #endif 111 117 #if RC_SHVC_HARMONIZATION -
branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncTop.cpp
r245 r282 159 159 { 160 160 m_acTEncTop[layer].setRefLayerId ( i, m_acLayerCfg[layer].getRefLayerId(i)); 161 } 161 } 162 } 163 164 if(m_acLayerCfg[layer].getNumActiveRefLayers() == -1) 165 { 166 m_acTEncTop[layer].setNumActiveRefLayers( m_acLayerCfg[layer].getNumDirectRefLayers() ); 167 for( Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++ ) 168 { 169 m_acTEncTop[layer].setPredLayerId(i, i); 170 } 171 } 172 else 173 { 174 m_acTEncTop[layer].setNumActiveRefLayers ( m_acLayerCfg[layer].getNumActiveRefLayers() ); 175 for(Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++) 176 { 177 m_acTEncTop[layer].setPredLayerId ( i, m_acLayerCfg[layer].getPredLayerId(i)); 178 } 162 179 } 163 180 } … … 886 903 vps->setNumProfileTierLevel(vps->getNumLayerSets()); 887 904 vps->setDefaultOneTargetOutputLayerFlag(true); 888 for( Inti = 1; i < vps->getNumLayerSets(); i++)905 for(i = 1; i < vps->getNumLayerSets(); i++) 889 906 { 890 907 vps->setProfileLevelTierIdx(i, i); … … 910 927 #if VPS_EXTN_DIRECT_REF_LAYERS 911 928 // Direct reference layers 929 UInt maxDirectRefLayers = 0; 912 930 for(UInt layerCtr = 1;layerCtr <= vps->getMaxLayers() - 1; layerCtr++) 913 931 { 914 932 vps->setNumDirectRefLayers( layerCtr, m_acTEncTop[layerCtr].getNumDirectRefLayers() ); 933 maxDirectRefLayers = max<UInt>( maxDirectRefLayers, vps->getNumDirectRefLayers( layerCtr ) ); 934 915 935 for(i = 0; i < vps->getNumDirectRefLayers(layerCtr); i++) 916 936 { … … 930 950 #endif 931 951 #if JCTVC_M0458_INTERLAYER_RPS_SIG 932 vps->setMaxOneActiveRefLayerFlag( true);952 vps->setMaxOneActiveRefLayerFlag(maxDirectRefLayers > 1 ? false : true); 933 953 #endif 934 954 #else -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComDataCU.cpp
r212 r282 1750 1750 // check BL mode 1751 1751 UInt uiCUAddrBase, uiAbsPartAddrBase; 1752 TComDataCU* pcTempCU = getBaseColCU( uiAbsPartIdx, uiCUAddrBase, uiAbsPartAddrBase ); 1752 // the right reference layerIdc should be specified, currently it is set to m_layerId-1 1753 TComDataCU* pcTempCU = getBaseColCU(m_layerId - 1, uiAbsPartIdx, uiCUAddrBase, uiAbsPartAddrBase ); 1753 1754 1754 1755 if( pcTempCU->getPredictionMode( uiAbsPartAddrBase ) != MODE_INTRA ) 1756 { 1755 1757 return( NUM_INTRA_MODE-1 ); 1758 } 1756 1759 1757 1760 // compute set of enabled modes g_reducedSetIntraModes[...] … … 4182 4185 4183 4186 #if SVC_COL_BLK 4184 TComDataCU* TComDataCU::getBaseColCU( UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase )4187 TComDataCU* TComDataCU::getBaseColCU( UInt refLayerIdc, UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase ) 4185 4188 { 4186 4189 #if 1 // it should provide identical resutls … … 4188 4191 UInt uiPelY = getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiCuAbsPartIdx] ]; 4189 4192 4190 return getBaseColCU( uiPelX, uiPelY, uiCUAddrBase, uiAbsPartIdxBase );4193 return getBaseColCU( refLayerIdc, uiPelX, uiPelY, uiCUAddrBase, uiAbsPartIdxBase ); 4191 4194 #else 4192 4195 TComPic* cBaseColPic = m_pcSlice->getBaseColPic(); … … 4237 4240 } 4238 4241 4239 TComDataCU* TComDataCU::getBaseColCU( UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase )4240 { 4241 TComPic* cBaseColPic = m_pcSlice->getBaseColPic( );4242 TComDataCU* TComDataCU::getBaseColCU( UInt refLayerIdc, UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase ) 4243 { 4244 TComPic* cBaseColPic = m_pcSlice->getBaseColPic(refLayerIdc); 4242 4245 4243 4246 #if !SIMPLIFIED_MV_POS_SCALING … … 4269 4272 Int leftStartL = this->getSlice()->getSPS()->getScaledRefLayerWindow().getWindowLeftOffset(); 4270 4273 Int topStartL = this->getSlice()->getSPS()->getScaledRefLayerWindow().getWindowTopOffset(); 4271 Int iBX = ((uiPelX - leftStartL)*g_posScalingFactor[ m_layerId][0] + (1<<15)) >> 16;4272 Int iBY = ((uiPelY - topStartL )*g_posScalingFactor[ m_layerId][1] + (1<<15)) >> 16;4274 Int iBX = ((uiPelX - leftStartL)*g_posScalingFactor[refLayerIdc][0] + (1<<15)) >> 16; 4275 Int iBY = ((uiPelY - topStartL )*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16; 4273 4276 #else 4274 Int iBX = (uiPelX*g_posScalingFactor[ m_layerId][0] + (1<<15)) >> 16;4275 Int iBY = (uiPelY*g_posScalingFactor[ m_layerId][1] + (1<<15)) >> 16;4277 Int iBX = (uiPelX*g_posScalingFactor[refLayerIdc][0] + (1<<15)) >> 16; 4278 Int iBY = (uiPelY*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16; 4276 4279 #endif 4277 4280 #else … … 4295 4298 const Window &confEL = m_pcPic->getPicYuvRec()->getConformanceWindow(); 4296 4299 4297 Int widthBL = m_pcSlice->getBaseColPic( )->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();4298 Int heightBL = m_pcSlice->getBaseColPic( )->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();4300 Int widthBL = m_pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 4301 Int heightBL = m_pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); 4299 4302 #endif 4300 4303 if( iBX >= widthBL || iBY >= heightBL ) //outside of the reference layer cropped picture … … 4316 4319 } 4317 4320 4318 Void TComDataCU::scaleBaseMV( TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase )4321 Void TComDataCU::scaleBaseMV( UInt refLayerIdc, TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase ) 4319 4322 { 4320 4323 TComMvField cMvFieldBase; 4321 4324 TComMv cMv; 4322 4325 #if SIMPLIFIED_MV_POS_SCALING 4323 cMv = rcMvFieldBase.getMv().scaleMv( g_mvScalingFactor[ m_layerId][0], g_mvScalingFactor[m_layerId][1] );4326 cMv = rcMvFieldBase.getMv().scaleMv( g_mvScalingFactor[refLayerIdc][0], g_mvScalingFactor[refLayerIdc][1] ); 4324 4327 #else 4325 4328 const Window &confBL = m_pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow(); -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComDataCU.h
r212 r282 554 554 555 555 #if SVC_COL_BLK 556 TComDataCU* getBaseColCU( UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase );557 TComDataCU* getBaseColCU( UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase );558 Void scaleBaseMV( TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase );556 TComDataCU* getBaseColCU( UInt refLayerIdc, UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase ); 557 TComDataCU* getBaseColCU( UInt refLayerIdc, UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase ); 558 Void scaleBaseMV( UInt refLayerIdc, TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase ); 559 559 #endif 560 560 }; -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComPic.cpp
r191 r282 67 67 , m_pNDBFilterYuvTmp (NULL) 68 68 , m_bCheckLTMSB (false) 69 { 69 70 #if SVC_EXTENSION 70 , m_bSpatialEnhLayer( false ) 71 , m_pcFullPelBaseRec( NULL ) 72 #endif 73 { 71 memset( m_pcFullPelBaseRec, 0, sizeof( m_pcFullPelBaseRec ) ); 72 memset( m_bSpatialEnhLayer, false, sizeof( m_bSpatialEnhLayer ) ); 73 #endif 74 74 m_apcPicYuv[0] = NULL; 75 75 m_apcPicYuv[1] = NULL; … … 91 91 m_apcPicYuv[1] = new TComPicYuv; m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps ); 92 92 93 if (m_bSpatialEnhLayer) 94 { 95 m_pcFullPelBaseRec = new TComPicYuv; m_pcFullPelBaseRec->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps ); 93 for( Int i = 0; i < MAX_LAYERS; i++ ) 94 { 95 if( m_bSpatialEnhLayer[i] ) 96 { 97 m_pcFullPelBaseRec[i] = new TComPicYuv; m_pcFullPelBaseRec[i]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps ); 98 } 96 99 } 97 100 … … 173 176 deleteSEIs(m_SEIs); 174 177 #if SVC_EXTENSION && SVC_UPSAMPLING 175 if (m_bSpatialEnhLayer) 176 { 177 m_pcFullPelBaseRec->destroy(); 178 delete m_pcFullPelBaseRec; 179 m_pcFullPelBaseRec = NULL; 178 for( Int i = 0; i < MAX_LAYERS; i++ ) 179 { 180 if( m_bSpatialEnhLayer[i] ) 181 { 182 m_pcFullPelBaseRec[i]->destroy(); 183 delete m_pcFullPelBaseRec[i]; 184 m_pcFullPelBaseRec[i] = NULL; 185 } 180 186 } 181 187 #endif … … 562 568 563 569 #if REF_IDX_MFM 564 Void TComPic::copyUpsampledMvField( TComPic* pcPicBase)570 Void TComPic::copyUpsampledMvField(UInt refLayerIdc, TComPic* pcPicBase) 565 571 { 566 572 #if AVC_SYNTAX && !ILP_DECODED_PICTURE … … 592 598 593 599 TComDataCU *pcColCU = 0; 594 pcColCU = pcCUDes->getBaseColCU( pelX + 8, pelY + 8, baseCUAddr, baseAbsPartIdx);600 pcColCU = pcCUDes->getBaseColCU(refLayerIdc, pelX + 8, pelY + 8, baseCUAddr, baseAbsPartIdx); 595 601 596 602 #if AVC_SYNTAX && !ILP_DECODED_PICTURE … … 607 613 TComMvField sMvFieldBase, sMvField; 608 614 pcColCU->getMvField( pcColCU, baseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase); 609 pcCUDes->scaleBaseMV( sMvField, sMvFieldBase );615 pcCUDes->scaleBaseMV( refLayerIdc, sMvField, sMvFieldBase ); 610 616 611 617 pcCUDes->getCUMvField((RefPicList)refPicList)->setMvField(sMvField, absPartIdx); -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComPic.h
r191 r282 92 92 SEIMessages m_SEIs; ///< Any SEI messages that have been received. If !NULL we own the object. 93 93 #if SVC_EXTENSION 94 Bool m_bSpatialEnhLayer ; // whether current layer is a spatial enhancement layer,95 TComPicYuv* m_pcFullPelBaseRec ; // upsampled base layer recontruction for difference domain inter prediction94 Bool m_bSpatialEnhLayer[MAX_LAYERS]; // whether current layer is a spatial enhancement layer, 95 TComPicYuv* m_pcFullPelBaseRec[MAX_LAYERS]; // upsampled base layer recontruction for difference domain inter prediction 96 96 #endif 97 97 … … 114 114 Void setLayerId (UInt layerId) { m_layerId = layerId; } 115 115 UInt getLayerId () { return m_layerId; } 116 Bool isSpatialEnhLayer( ) { return m_bSpatialEnhLayer; }117 Void setSpatialEnhLayerFlag ( Bool b) { m_bSpatialEnhLayer= b; }118 Void setFullPelBaseRec ( TComPicYuv* p) { m_pcFullPelBaseRec= p; }119 TComPicYuv* getFullPelBaseRec ( ) { return m_pcFullPelBaseRec; }116 Bool isSpatialEnhLayer(UInt refLayerIdc) { return m_bSpatialEnhLayer[refLayerIdc]; } 117 Void setSpatialEnhLayerFlag (UInt refLayerIdc, Bool b) { m_bSpatialEnhLayer[refLayerIdc] = b; } 118 Void setFullPelBaseRec (UInt refLayerIdc, TComPicYuv* p) { m_pcFullPelBaseRec[refLayerIdc] = p; } 119 TComPicYuv* getFullPelBaseRec (UInt refLayerIdc) { return m_pcFullPelBaseRec[refLayerIdc]; } 120 120 #endif 121 121 #if REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE || REF_IDX_MFM … … 124 124 125 125 #if REF_IDX_MFM 126 Void copyUpsampledMvField ( TComPic* pcPicBase );126 Void copyUpsampledMvField ( UInt refLayerIdc, TComPic* pcPicBase ); 127 127 Void initUpsampledMvField (); 128 128 #endif -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComPrediction.cpp
r191 r282 774 774 #if SVC_UPSAMPLING 775 775 #if SCALED_REF_LAYER_OFFSETS 776 Void TComPrediction::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window)777 { 778 m_cUsf.upsampleBasePic( pcUsPic, pcBasePic, pcTempPic, window);776 Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window) 777 { 778 m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window); 779 779 } 780 780 #else 781 Void TComPrediction::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic)782 { 783 m_cUsf.upsampleBasePic( pcUsPic, pcBasePic, pcTempPic);781 Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic) 782 { 783 m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic); 784 784 } 785 785 #endif -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComPrediction.h
r191 r282 123 123 #if SVC_UPSAMPLING 124 124 #if SCALED_REF_LAYER_OFFSETS 125 Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );125 Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ); 126 126 #else 127 Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );127 Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic ); 128 128 #endif 129 129 #endif -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.cpp
r258 r282 92 92 #if SVC_EXTENSION 93 93 , m_layerId ( 0 ) 94 , m_pcBaseColPic ( NULL )95 94 #endif 96 95 , m_bTLayerSwitchingFlag ( false ) … … 122 121 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0; 123 122 #endif 124 123 124 #if SVC_EXTENSION 125 memset( m_pcBaseColPic, 0, sizeof( m_pcBaseColPic ) ); 125 126 #if REF_IDX_FRAMEWORK 126 127 #if JCTVC_M0458_INTERLAYER_RPS_SIG … … 131 132 m_numILRRefIdx = 0; 132 133 #endif 134 #endif 133 135 #endif 134 136 … … 518 520 519 521 #if REF_IDX_FRAMEWORK 520 //inter-layer reference picture 522 for( i = 0; i < m_activeNumILRRefIdx; i++ ) 523 { 524 UInt refLayerIdc = m_interLayerPredLayerIdc[i]; 525 //inter-layer reference picture 521 526 #if REF_IDX_MFM 522 527 523 528 #if ILR_RESTR 524 Int maxSubLayerForILPPlus1 = (getLayerId() > 0 && m_activeNumILRRefIdx > 0)? getVPS()->getMaxSublayerForIlpPlus1(ilpPic[0]->getSlice(0)->getLayerId()) : 0;529 Int maxSubLayerForILPPlus1 = ( m_layerId > 0 && m_activeNumILRRefIdx > 0)? m_pcVPS->getMaxSublayerForIlpPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId()) : 0; 525 530 #if ZERO_NUM_DIRECT_LAYERS 526 if( getLayerId() > 0 && m_activeNumILRRefIdx > 0 && ( ( (Int)(ilpPic[0]->getSlice(0)->getTLayer())<= maxSubLayerForILPPlus1-1) || (maxSubLayerForILPPlus1==0 && ilpPic[0]->getSlice(0)->getRapPicFlag()) ) )527 #else 528 if( getLayerId() && ( ( (Int)(ilpPic[0]->getSlice(0)->getTLayer())<=maxSubLayerForILPPlus1-1) || (maxSubLayerForILPPlus1==0 && ilpPic[0]->getSlice(0)->getRapPicFlag()) ) )531 if( m_layerId > 0 && m_activeNumILRRefIdx > 0 && ( ( (Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<= maxSubLayerForILPPlus1-1) || (maxSubLayerForILPPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) ) ) 532 #else 533 if( m_layerId > 0 && ( ( (Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxSubLayerForILPPlus1-1) || (maxSubLayerForILPPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) ) ) 529 534 #endif 530 535 531 536 #else 532 537 #if ZERO_NUM_DIRECT_LAYERS 533 if( m_layerId > 0 && m_activeNumILRRefIdx > 0 ) 534 #else 535 if (getLayerId()) 536 #endif 537 #endif 538 { 539 if(!(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && getSPS()->getMFMEnabledFlag()) 540 { 541 ilpPic[0]->copyUpsampledMvField(getBaseColPic()); 542 } 543 else 544 { 545 ilpPic[0]->initUpsampledMvField(); 546 } 547 #endif 548 ilpPic[0]->setIsLongTerm(1); 538 if( m_layerId > 0 && m_activeNumILRRefIdx > 0 ) 539 #else 540 if( m_layerId > 0 ) 541 #endif 542 #endif 543 { 544 if(!(m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) && m_pcSPS->getMFMEnabledFlag()) 545 { 546 ilpPic[refLayerIdc]->copyUpsampledMvField( refLayerIdc, m_pcBaseColPic[refLayerIdc] ); 547 } 548 else 549 { 550 ilpPic[refLayerIdc]->initUpsampledMvField(); 551 } 552 #endif 553 ilpPic[refLayerIdc]->setIsLongTerm(1); 554 } 549 555 } 550 556 #endif … … 555 561 #if ILR_RESTR 556 562 Int numInterLayerRPSPics = 0; 557 if (getLayerId()>0)558 { 559 for (i=0; i < getVPS()->getNumDirectRefLayers(getLayerId()); i++)560 { 561 maxSubLayerForILPPlus1 = getVPS()->getMaxSublayerForIlpPlus1(ilpPic[i]->getSlice(0)->getLayerId());563 if( m_layerId > 0 ) 564 { 565 for( i=0; i < m_pcVPS->getNumDirectRefLayers( m_layerId ); i++ ) 566 { 567 Int maxSubLayerForILPPlus1 = getVPS()->getMaxSublayerForIlpPlus1(ilpPic[i]->getSlice(0)->getLayerId()); 562 568 if( ((Int)(ilpPic[i]->getSlice(0)->getTLayer())<= maxSubLayerForILPPlus1-1) || (maxSubLayerForILPPlus1==0 && ilpPic[i]->getSlice(0)->getRapPicFlag() ) ) 563 569 { … … 570 576 m_activeNumILRRefIdx = numInterLayerRPSPics; 571 577 } 572 #if MAX_ONE_RESAMPLING_DIRECT_LAYERS 573 if( getVPS()->getScalabilityMask(1))578 #if MAX_ONE_RESAMPLING_DIRECT_LAYERS && SIMPLIFIED_MV_POS_SCALING 579 if( m_pcVPS->getScalabilityMask(1) ) 574 580 { 575 581 Int numResampler = 0; … … 581 587 ); 582 588 583 Int widthEL = getPic()->getPicYuvRec()->getWidth(); 584 Int heightEL = getPic()->getPicYuvRec()->getHeight(); 585 for (i=0; i < m_activeNumILRRefIdx; i++) 586 { 587 Int widthBL = ilpPic[getInterLayerPredLayerIdc(i)]->getSlice(0)->getBaseColPic()->getPicYuvRec()->getWidth(); 588 Int heightBL = ilpPic[getInterLayerPredLayerIdc(i)]->getSlice(0)->getBaseColPic()->getPicYuvRec()->getHeight(); 589 590 if(!(widthEL == widthBL && heightEL == heightBL && (scalingOffset))) 589 for( i=0; i < m_activeNumILRRefIdx; i++ ) 590 { 591 UInt refLayerIdc = m_interLayerPredLayerIdc[i]; 592 if(!( g_posScalingFactor[refLayerIdc][0] == 65536 && g_posScalingFactor[refLayerIdc][1] == 65536 ) && (scalingOffset)) // ratio 1x 591 593 { 592 594 numResampler++; … … 660 662 } 661 663 #if REF_IDX_FRAMEWORK 662 if( getLayerId())664 if( m_layerId > 0 ) 663 665 { 664 666 #if JCTVC_M0458_INTERLAYER_RPS_SIG … … 668 670 #endif 669 671 { 672 Int refLayerIdc = m_interLayerPredLayerIdc[i]; 670 673 #if ILR_RESTR 671 maxSubLayerForILPPlus1 = getVPS()->getMaxSublayerForIlpPlus1(ilpPic[i]->getSlice(0)->getLayerId());672 if( ((Int)(ilpPic[ i]->getSlice(0)->getTLayer())<=maxSubLayerForILPPlus1-1) || (maxSubLayerForILPPlus1==0 && ilpPic[i]->getSlice(0)->getRapPicFlag()) )673 #endif 674 rpsCurrList0[cIdx] = ilpPic[ i];674 Int maxSubLayerForILPPlus1 = getVPS()->getMaxSublayerForIlpPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId()); 675 if( ((Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxSubLayerForILPPlus1-1) || (maxSubLayerForILPPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) ) 676 #endif 677 rpsCurrList0[cIdx] = ilpPic[refLayerIdc]; 675 678 } 676 679 } … … 692 695 } 693 696 #if REF_IDX_FRAMEWORK 694 if( getLayerId())697 if( m_layerId > 0 ) 695 698 { 696 699 #if JCTVC_M0458_INTERLAYER_RPS_SIG … … 700 703 #endif 701 704 { 705 Int refLayerIdc = m_interLayerPredLayerIdc[i]; 702 706 #if ILR_RESTR 703 maxSubLayerForILPPlus1 = getVPS()->getMaxSublayerForIlpPlus1(ilpPic[i]->getSlice(0)->getLayerId());704 if( ((Int)(ilpPic[ i]->getSlice(0)->getTLayer())<=maxSubLayerForILPPlus1-1) || (maxSubLayerForILPPlus1==0 && ilpPic[i]->getSlice(0)->getRapPicFlag()) )705 #endif 706 rpsCurrList1[cIdx] = ilpPic[ i];707 Int maxSubLayerForILPPlus1 = getVPS()->getMaxSublayerForIlpPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId()); 708 if( ((Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxSubLayerForILPPlus1-1) || (maxSubLayerForILPPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) ) 709 #endif 710 rpsCurrList1[cIdx] = ilpPic[refLayerIdc]; 707 711 } 708 712 } … … 737 741 Void TComSlice::setRefPicListModificationSvc() 738 742 { 739 if( ! this->getPPS()->getListsModificationPresentFlag())743 if( !m_pcPPS->getListsModificationPresentFlag()) 740 744 { 741 745 return; 742 746 } 743 747 744 if( this->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && this->getNalUnitType()<= NAL_UNIT_CODED_SLICE_CRA)748 if(m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) 745 749 { 746 750 return; 747 751 } 748 752 749 TComRefPicListModification* refPicListModification = this->getRefPicListModification();753 TComRefPicListModification* refPicListModification = &m_RefPicListModification; 750 754 Int numberOfRpsCurrTempList = this->getNumRpsCurrTempList(); // total number of ref pics in listTemp0 including inter-layer ref pics 751 755 … … 821 825 822 826 #if REF_IDX_FRAMEWORK 823 if( m_eSliceType == I_SLICE || ( getSPS()->getLayerId() &&824 ( getNalUnitType()>= NAL_UNIT_CODED_SLICE_BLA_W_LP) &&825 ( getNalUnitType()<= NAL_UNIT_CODED_SLICE_CRA) ) )827 if( m_eSliceType == I_SLICE || ( m_pcSPS->getLayerId() && 828 (m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && 829 (m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) ) ) 826 830 #else 827 831 if (m_eSliceType == I_SLICE) … … 846 850 } 847 851 #if REF_IDX_FRAMEWORK 848 if( getLayerId())852 if( m_layerId > 0 ) 849 853 { 850 854 #if JCTVC_M0458_INTERLAYER_RPS_SIG … … 2592 2596 #endif 2593 2597 2594 Void TComSlice::setBaseColPic( TComList<TComPic*>& rcListPic, UInt layerID)2598 Void TComSlice::setBaseColPic( TComList<TComPic*>& rcListPic, UInt refLayerIdc ) 2595 2599 { 2596 if (layerID== 0)2597 { 2598 m _pcBaseColPic = NULL;2600 if(m_layerId == 0) 2601 { 2602 memset( m_pcBaseColPic, 0, sizeof( m_pcBaseColPic ) ); 2599 2603 return; 2600 2604 } 2601 setBaseColPic( xGetRefPic(rcListPic, getPOC()));2605 setBaseColPic(refLayerIdc, xGetRefPic(rcListPic, getPOC())); 2602 2606 } 2603 2607 #endif 2604 2608 2605 2609 #if REF_IDX_MFM 2606 Void TComSlice::setRefPOCListILP( TComPic** ilpPic, TComPic *pcRefPicBL ) 2607 { 2608 //set reference picture POC of each ILP reference 2609 Int thePoc = ilpPic[0]->getPOC(); 2610 assert(thePoc >= 0); 2611 assert(thePoc == pcRefPicBL->getPOC()); 2612 2613 ilpPic[0]->getSlice(0)->setBaseColPic( pcRefPicBL ); 2614 2615 //copy reference pictures marking from the reference layer 2616 ilpPic[0]->getSlice(0)->copySliceInfo(pcRefPicBL->getSlice(0)); 2617 2618 for( Int refList = 0; refList < 2; refList++ ) 2619 { 2620 RefPicList refPicList = RefPicList( refList ); 2621 2622 //set reference POC of ILP 2623 ilpPic[0]->getSlice(0)->setNumRefIdx(refPicList, pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList)); 2624 assert(ilpPic[0]->getSlice(0)->getNumRefIdx(refPicList) >= 0); 2625 assert(ilpPic[0]->getSlice(0)->getNumRefIdx(refPicList) <= MAX_NUM_REF); 2626 2627 //initialize reference POC of ILP 2628 for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx++) 2629 { 2630 ilpPic[0]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(refPicList, refIdx), refPicList, refIdx); 2631 ilpPic[0]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(refPicList, refIdx), refPicList, refIdx); 2632 } 2633 2634 for(Int refIdx = pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx < MAX_NUM_REF; refIdx++) 2635 { 2636 ilpPic[0]->getSlice(0)->setRefPOC(0, refPicList, refIdx); 2637 ilpPic[0]->getSlice(0)->setRefPic(NULL, refPicList, refIdx); 2610 Void TComSlice::setRefPOCListILP( TComPic** ilpPic, TComPic** pcRefPicRL ) 2611 { 2612 for( UInt i = 0; i < m_activeNumILRRefIdx; i++ ) 2613 { 2614 UInt refLayerIdc = m_interLayerPredLayerIdc[i]; 2615 2616 TComPic* pcRefPicBL = pcRefPicRL[refLayerIdc]; 2617 //set reference picture POC of each ILP reference 2618 Int thePoc = ilpPic[refLayerIdc]->getPOC(); 2619 assert(thePoc >= 0); 2620 assert(thePoc == pcRefPicBL->getPOC()); 2621 2622 ilpPic[refLayerIdc]->getSlice(0)->setBaseColPic( refLayerIdc, pcRefPicBL ); 2623 2624 //copy reference pictures marking from the reference layer 2625 ilpPic[refLayerIdc]->getSlice(0)->copySliceInfo(pcRefPicBL->getSlice(0)); 2626 2627 for( Int refList = 0; refList < 2; refList++ ) 2628 { 2629 RefPicList refPicList = RefPicList( refList ); 2630 2631 //set reference POC of ILP 2632 ilpPic[refLayerIdc]->getSlice(0)->setNumRefIdx(refPicList, pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList)); 2633 assert(ilpPic[refLayerIdc]->getSlice(0)->getNumRefIdx(refPicList) >= 0); 2634 assert(ilpPic[refLayerIdc]->getSlice(0)->getNumRefIdx(refPicList) <= MAX_NUM_REF); 2635 2636 //initialize reference POC of ILP 2637 for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx++) 2638 { 2639 ilpPic[refLayerIdc]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(refPicList, refIdx), refPicList, refIdx); 2640 ilpPic[refLayerIdc]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(refPicList, refIdx), refPicList, refIdx); 2641 } 2642 2643 for(Int refIdx = pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx < MAX_NUM_REF; refIdx++) 2644 { 2645 ilpPic[refLayerIdc]->getSlice(0)->setRefPOC(0, refPicList, refIdx); 2646 ilpPic[refLayerIdc]->getSlice(0)->setRefPic(NULL, refPicList, refIdx); 2647 } 2638 2648 } 2639 2649 } -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.h
r258 r282 1494 1494 #if SVC_EXTENSION 1495 1495 UInt m_layerId; 1496 TComPic* m_pcBaseColPic ;1497 TComPicYuv* m_pcFullPelBaseRec ;1496 TComPic* m_pcBaseColPic[MAX_LAYERS]; 1497 TComPicYuv* m_pcFullPelBaseRec[MAX_LAYERS]; 1498 1498 #endif 1499 1499 Bool m_bTLayerSwitchingFlag; … … 1775 1775 1776 1776 #if SVC_EXTENSION 1777 Void setBaseColPic ( TComList<TComPic*>& rcListPic , UInt layerID ); 1778 Void setBaseColPic ( TComPic* p) { m_pcBaseColPic = p; } 1779 TComPic* getBaseColPic () { return m_pcBaseColPic; } 1777 Void setBaseColPic ( TComList<TComPic*>& rcListPic , UInt refLayerIdc ); 1778 Void setBaseColPic (UInt refLayerIdc, TComPic* p) { m_pcBaseColPic[refLayerIdc] = p; } 1779 TComPic* getBaseColPic (UInt refLayerIdc) { return m_pcBaseColPic[refLayerIdc]; } 1780 TComPic** getBaseColPic () { return &m_pcBaseColPic[0]; } 1780 1781 1781 1782 Void setLayerId (UInt layerId) { m_layerId = layerId; } 1782 1783 UInt getLayerId () { return m_layerId; } 1783 1784 1784 Void setFullPelBaseRec ( TComPicYuv* p) { m_pcFullPelBaseRec= p; }1785 TComPicYuv* getFullPelBaseRec ( ) { return m_pcFullPelBaseRec; }1785 Void setFullPelBaseRec (UInt refLayerIdc, TComPicYuv* p) { m_pcFullPelBaseRec[refLayerIdc] = p; } 1786 TComPicYuv* getFullPelBaseRec (UInt refLayerIdc) { return m_pcFullPelBaseRec[refLayerIdc]; } 1786 1787 1787 1788 #if AVC_SYNTAX … … 1794 1795 1795 1796 #if REF_IDX_MFM 1796 Void setRefPOCListILP(TComPic** ilpPic, TComPic *pcRefPicBL);1797 Void setRefPOCListILP(TComPic** ilpPic, TComPic** pcRefPicRL); 1797 1798 #endif 1798 1799 … … 1801 1802 Void setActiveNumILRRefIdx ( Int i ) { m_activeNumILRRefIdx = i; } 1802 1803 1803 Int getInterLayerPredLayerIdc (UInt Idx ) { return m_interLayerPredLayerIdc[Idx];}1804 Void setInterLayerPredLayerIdc (UInt val, UInt Idx) { m_interLayerPredLayerIdc[Idx] = val; }1804 Int getInterLayerPredLayerIdc (UInt layerIdx) { return m_interLayerPredLayerIdc[layerIdx];} 1805 Void setInterLayerPredLayerIdc (UInt refLayerIdc, UInt layerIdx) { m_interLayerPredLayerIdc[layerIdx] = refLayerIdc; } 1805 1806 1806 1807 Void setInterLayerPredEnabledFlag ( Bool val ) { m_interLayerPredEnabledFlag = val; } 1807 1808 Bool getInterLayerPredEnabledFlag () { return m_interLayerPredEnabledFlag;} 1808 1809 1809 #else 1810 1810 Void setNumILRRefIdx ( Int i ) { m_numILRRefIdx = i; } 1811 1811 #endif 1812 1812 #endif 1813 1814 TComPic* getRefPic(TComList<TComPic*>& rcListPic, Int poc) { return xGetRefPic( rcListPic, poc ); } 1813 1815 1814 1816 #endif //SVC_EXTENSION -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp
r237 r282 74 74 75 75 #if SCALED_REF_LAYER_OFFSETS 76 Void TComUpsampleFilter::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window )77 #else 78 Void TComUpsampleFilter::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic )76 Void TComUpsampleFilter::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ) 77 #else 78 Void TComUpsampleFilter::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic ) 79 79 #endif 80 80 { … … 127 127 Pel* piDstV; 128 128 129 if( widthEL == widthBL && heightEL == heightBL ) 129 #if SIMPLIFIED_MV_POS_SCALING 130 Int scaleX = g_posScalingFactor[refLayerIdc][0]; 131 Int scaleY = g_posScalingFactor[refLayerIdc][1]; 132 #else 133 Int scaleX = ( ( widthBL << shiftX ) + ( widthEL >> 1 ) ) / widthEL; 134 Int scaleY = ( ( heightBL << shiftY ) + ( heightEL >> 1 ) ) / heightEL; 135 #endif 136 137 if( scaleX == 65536 && scaleY == 65536 ) // ratio 1x 130 138 { 131 139 piSrcY = piSrcBufY - scalEL.getWindowLeftOffset() - scalEL.getWindowTopOffset() * strideEL; … … 196 204 Int shiftYM4 = shiftY - 4; 197 205 198 Int scaleX = ( ( widthBL << shiftX ) + ( widthEL >> 1 ) ) / widthEL;199 Int scaleY = ( ( heightBL << shiftY ) + ( heightEL >> 1 ) ) / heightEL;200 201 206 #if ILP_DECODED_PICTURE 202 207 widthEL = pcUsPic->getWidth (); … … 334 339 shiftYM4 = shiftY - 4; 335 340 341 #if !SIMPLIFIED_MV_POS_SCALING 336 342 scaleX = ( ( widthBL << shiftX ) + ( widthEL >> 1 ) ) / widthEL; 337 343 scaleY = ( ( heightBL << shiftY ) + ( heightEL >> 1 ) ) / heightEL; 344 #endif 338 345 339 346 #if ILP_DECODED_PICTURE -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComUpsampleFilter.h
r235 r282 44 44 45 45 #if SCALED_REF_LAYER_OFFSETS 46 Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );46 Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ); 47 47 #else 48 Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );48 Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic ); 49 49 #endif 50 50 }; -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TypeDef.h
r242 r282 47 47 #define SCALED_REF_LAYER_OFFSET_FLAG 1 ///< M0309: Signal scaled reference layer offsets in SPS 48 48 #define SCALED_REF_LAYER_OFFSETS 1 ///< M0309: Signal scaled reference layer offsets in SPS 49 #define MAX_LAYERS 2///< max number of layers the codec is supposed to handle49 #define MAX_LAYERS 3 ///< max number of layers the codec is supposed to handle 50 50 51 51 #define VPS_RENAME 1 ///< Rename variables max_layer_id and num_layer_sets_minus1 in VPS -
branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecTop.cpp
r250 r282 160 160 if (m_cIlpPic[0] == NULL) 161 161 { 162 for (Int j=0; j < 1/*MAX_NUM_REF*/; j++) // to beset to NumDirectRefLayers[LayerIdInVps[nuh_layer_id]]162 for (Int j=0; j < MAX_LAYERS /*MAX_NUM_REF*/; j++) // consider to set to NumDirectRefLayers[LayerIdInVps[nuh_layer_id]] 163 163 { 164 164 … … 180 180 Void TDecTop::setILRPic(TComPic *pcPic) 181 181 { 182 if(m_cIlpPic[0]) 183 { 184 m_cIlpPic[0]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(), m_cIlpPic[0]->getPicYuvRec()); 185 m_cIlpPic[0]->getSlice(0)->setPOC(pcPic->getPOC()); 186 m_cIlpPic[0]->setLayerId(pcPic->getSlice(0)->getBaseColPic()->getLayerId()); //set reference layerId 187 m_cIlpPic[0]->getPicYuvRec()->setBorderExtension(false); 188 m_cIlpPic[0]->getPicYuvRec()->extendPicBorder(); 182 for( Int i = 0; i < pcPic->getSlice(0)->getActiveNumILRRefIdx(); i++ ) 183 { 184 Int refLayerIdc = pcPic->getSlice(0)->getInterLayerPredLayerIdc(i); 185 186 if(m_cIlpPic[refLayerIdc]) 187 { 188 m_cIlpPic[refLayerIdc]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(refLayerIdc), m_cIlpPic[refLayerIdc]->getPicYuvRec()); 189 m_cIlpPic[refLayerIdc]->getSlice(0)->setPOC(pcPic->getPOC()); 190 m_cIlpPic[refLayerIdc]->setLayerId(pcPic->getSlice(0)->getBaseColPic(refLayerIdc)->getLayerId()); //set reference layerId 191 m_cIlpPic[refLayerIdc]->getPicYuvRec()->setBorderExtension(false); 192 m_cIlpPic[refLayerIdc]->getPicYuvRec()->extendPicBorder(); 193 } 189 194 } 190 195 } … … 248 253 if(m_layerId > 0) 249 254 { 255 for(UInt i = 0; i < pcSlice->getVPS()->getNumDirectRefLayers( m_layerId ); i++ ) 256 { 257 const Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(); 258 Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 ); 259 250 260 #if VPS_EXTN_DIRECT_REF_LAYERS 251 TDecTop *pcTDecTopBase = (TDecTop *)getRefLayerDec( m_layerId - 1);252 #else 253 TDecTop *pcTDecTopBase = (TDecTop *)getLayerDec( m_layerId-1 );254 #endif 255 //TComPic* pcPic = *(pcTDecTopBase->getListPic()->begin());256 TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec();257 if(pcPicYuvRecBase->getWidth() != pcSlice->getSPS()->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getSPS()->getPicHeightInLumaSamples())258 {259 rpcPic->setSpatialEnhLayerFlag(true );260 261 //only for scalable extension262 assert( pcSlice->getVPS()->getScalabilityMask(1) == true );263 }261 TDecTop *pcTDecTopBase = (TDecTop *)getRefLayerDec( i ); 262 #else 263 TDecTop *pcTDecTopBase = (TDecTop *)getLayerDec( m_layerId-1 ); 264 #endif 265 //TComPic* pcPic = *(pcTDecTopBase->getListPic()->begin()); 266 TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec(); 267 if(pcPicYuvRecBase->getWidth() != pcSlice->getSPS()->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getSPS()->getPicHeightInLumaSamples() || !zeroOffsets ) 268 { 269 rpcPic->setSpatialEnhLayerFlag( i, true ); 270 271 //only for scalable extension 272 assert( pcSlice->getVPS()->getScalabilityMask(1) == true ); 273 } 264 274 #if MAX_ONE_RESAMPLING_DIRECT_LAYERS 265 if(pcSlice->getVPS()->getScalabilityMask(1)) 266 { 267 pcSlice->setPic(rpcPic); 268 } 269 #endif 275 if(pcSlice->getVPS()->getScalabilityMask(1)) 276 { 277 pcSlice->setPic(rpcPic); 278 } 279 #endif 280 } 270 281 } 271 282 #endif … … 812 823 if(m_layerId > 0) 813 824 { 825 for( i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 826 { 827 UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i); 814 828 #if AVC_BASE 815 if(m_parameterSetManagerDecoder[0].getActiveVPS()->getAvcBaseLayerFlag() )816 {817 pcSlice->setBaseColPic (*m_ppcTDecTop[0]->getListPic()->begin() );829 if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder[0].getActiveVPS()->getAvcBaseLayerFlag() ) 830 { 831 pcSlice->setBaseColPic ( refLayerIdc, *m_ppcTDecTop[0]->getListPic()->begin() ); 818 832 #if AVC_SYNTAX 819 TComPic* pBLPic = pcSlice->getBaseColPic();820 if( pcSlice->getPOC() == 0 )821 {822 // initialize partition order.823 UInt* piTmp = &g_auiZscanToRaster[0];824 initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp );825 initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 );826 }827 pBLPic->getSlice( 0 )->initBaseLayerRPL( pcSlice );828 pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES );829 #endif 830 }831 else832 {833 TComPic* pBLPic = pcSlice->getBaseColPic(refLayerIdc); 834 if( pcSlice->getPOC() == 0 ) 835 { 836 // initialize partition order. 837 UInt* piTmp = &g_auiZscanToRaster[0]; 838 initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp ); 839 initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 ); 840 } 841 pBLPic->getSlice( 0 )->initBaseLayerRPL( pcSlice ); 842 pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES ); 843 #endif 844 } 845 else 846 { 833 847 #if VPS_EXTN_DIRECT_REF_LAYERS 834 TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( m_layerId - 1 ); 848 TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( refLayerIdc ); 849 #else 850 TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 ); 851 #endif 852 TComList<TComPic*> *cListPic = pcTDecTop->getListPic(); 853 pcSlice->setBaseColPic ( *cListPic, refLayerIdc ); 854 } 855 #else 856 #if VPS_EXTN_DIRECT_REF_LAYERS 857 TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( refLayerIdc ); 835 858 #else 836 859 TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 ); 837 860 #endif 838 861 TComList<TComPic*> *cListPic = pcTDecTop->getListPic(); 839 pcSlice->setBaseColPic ( *cListPic, m_layerId ); 840 } 841 #else 842 #if VPS_EXTN_DIRECT_REF_LAYERS 843 TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( m_layerId ); 844 #else 845 TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 ); 846 #endif 847 TComList<TComPic*> *cListPic = pcTDecTop->getListPic(); 848 pcSlice->setBaseColPic ( *cListPic, m_layerId ); 862 pcSlice->setBaseColPic ( *cListPic, refLayerIdc ); 849 863 #endif 850 864 851 865 #if SIMPLIFIED_MV_POS_SCALING 852 866 #if SCALED_REF_LAYER_OFFSETS 853 const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow();854 855 Int widthBL = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth();856 Int heightBL = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight();857 858 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();859 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset();860 #else 861 const Window &confBL = pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow();862 const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow();863 864 Int widthBL = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();865 Int heightBL = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();866 867 Int widthEL = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();868 Int heightEL = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();869 #endif 870 g_mvScalingFactor[m_layerId][0] = widthEL == widthBL ? 4096 : Clip3(-4096, 4095, ((widthEL << 8) + (widthBL >> 1)) / widthBL);871 g_mvScalingFactor[m_layerId][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL);872 873 g_posScalingFactor[m_layerId][0] = ((widthBL << 16) + (widthEL >> 1)) / widthEL;874 g_posScalingFactor[m_layerId][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL;867 const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(); 868 869 Int widthBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth(); 870 Int heightBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight(); 871 872 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 873 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 874 #else 875 const Window &confBL = pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow(); 876 const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow(); 877 878 Int widthBL = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 879 Int heightBL = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); 880 881 Int widthEL = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 882 Int heightEL = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 883 #endif 884 g_mvScalingFactor[refLayerIdc][0] = widthEL == widthBL ? 4096 : Clip3(-4096, 4095, ((widthEL << 8) + (widthBL >> 1)) / widthBL); 885 g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL); 886 887 g_posScalingFactor[refLayerIdc][0] = ((widthBL << 16) + (widthEL >> 1)) / widthEL; 888 g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL; 875 889 #endif 876 890 877 891 #if SVC_UPSAMPLING 878 if ( pcPic->isSpatialEnhLayer())879 {892 if( pcPic->isSpatialEnhLayer(refLayerIdc) ) 893 { 880 894 #if SCALED_REF_LAYER_OFFSETS 881 m_cPrediction.upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow() ); 882 #else 883 m_cPrediction.upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec() ); 884 #endif 885 } 886 else 887 { 888 pcPic->setFullPelBaseRec( pcSlice->getBaseColPic()->getPicYuvRec() ); 889 } 890 pcSlice->setFullPelBaseRec ( pcPic->getFullPelBaseRec() ); 891 #endif 895 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow() ); 896 #else 897 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec() ); 898 #endif 899 } 900 else 901 { 902 pcPic->setFullPelBaseRec( refLayerIdc, pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec() ); 903 } 904 pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) ); 905 #endif 906 } 892 907 } 893 908 894 909 #if REF_IDX_FRAMEWORK 910 #if ZERO_NUM_DIRECT_LAYERS 911 if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() ) 912 #else 895 913 if(m_layerId > 0) 914 #endif 896 915 { 897 916 setILRPic(pcPic); … … 1292 1311 #endif 1293 1312 } 1294 1295 // currently only one reference layer is supported1296 assert( vps->getNumDirectRefLayers( m_layerId ) == 1 );1297 #if JCTVC_M0458_INTERLAYER_RPS_SIG1298 assert( vps->getMaxOneActiveRefLayerFlag() == 1 );1299 #endif1300 1313 1301 1314 return (TDecTop *)getLayerDec( vps->getRefLayerId( m_layerId, refLayerIdc ) ); -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r258 r282 1067 1067 if( !pcSlice->getVPS()->getMaxOneActiveRefLayerFlag()) 1068 1068 { 1069 WRITE_CODE(pcSlice->getActiveNumILRRefIdx() - 1, numBits,"num_inter_layer_ref_pics_minus1"); 1069 WRITE_CODE(pcSlice->getActiveNumILRRefIdx() - 1, numBits,"num_inter_layer_ref_pics_minus1"); 1070 1070 } 1071 1071 for(Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCfg.h
r212 r282 145 145 Int m_numDirectRefLayers; 146 146 Int m_refLayerId[MAX_VPS_LAYER_ID_PLUS1]; 147 148 Int m_numActiveRefLayers; 149 Int m_predLayerId[MAX_VPS_LAYER_ID_PLUS1]; 147 150 #endif 148 151 //======= Transform ============= … … 405 408 Int getRefLayerId (Int i) { return m_refLayerId[i]; } 406 409 Void setRefLayerId (Int i, Int refLayerId) { m_refLayerId[i] = refLayerId; } 410 411 Int getNumActiveRefLayers () { return m_numActiveRefLayers; } 412 Void setNumActiveRefLayers (Int num) { m_numActiveRefLayers = num; } 413 414 Int getPredLayerId (Int i) { return m_predLayerId[i]; } 415 Void setPredLayerId (Int i, Int refLayerId) { m_predLayerId[i] = refLayerId; } 407 416 #endif 408 417 //======== Transform ============= -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCu.cpp
r191 r282 108 108 // initialize conversion matrix from partition index to pel 109 109 initRasterToPelXY( uiMaxWidth, uiMaxHeight, m_uhTotalDepth ); 110 110 111 } 111 112 … … 455 456 { 456 457 #if (ENCODER_FAST_MODE) 457 bool testInter = true;458 Bool testInter = true; 458 459 if (rpcBestCU->getLayerId() > 0) 459 460 { 460 if (rpcBestCU->getSlice()->getBaseColPic()->getSlice(0)->getSliceType() == I_SLICE) 461 { 462 testInter = false; 463 } 464 461 if(pcSlice->getSliceType() == P_SLICE && pcSlice->getNumRefIdx(REF_PIC_LIST_0) == pcSlice->getActiveNumILRRefIdx()) 462 testInter = false; 463 if(pcSlice->getSliceType() == B_SLICE && pcSlice->getNumRefIdx(REF_PIC_LIST_0) == pcSlice->getActiveNumILRRefIdx() && pcSlice->getNumRefIdx(REF_PIC_LIST_1) == pcSlice->getActiveNumILRRefIdx()) 464 testInter = false; 465 465 } 466 466 #endif … … 767 767 } 768 768 #endif 769 770 769 #if (ENCODER_FAST_MODE) 771 if(pcPic->getLayerId() > 0) 772 { 773 xCheckRDCostILRUni( rpcBestCU, rpcTempCU); 774 rpcTempCU->initEstData( uiDepth, iQP ); 775 } 770 if(pcPic->getLayerId() > 0) 771 { 772 for(Int refLayer = 0; refLayer < pcSlice->getActiveNumILRRefIdx(); refLayer++) 773 { 774 xCheckRDCostILRUni( rpcBestCU, rpcTempCU, pcSlice->getInterLayerPredLayerIdc(refLayer)); 775 rpcTempCU->initEstData( uiDepth, iQP ); 776 } 777 } 776 778 #endif 777 779 … … 1812 1814 } 1813 1815 #endif 1814 1815 1816 #if (ENCODER_FAST_MODE) 1816 Void TEncCu::xCheckRDCostILRUni(TComDataCU *&rpcBestCU, TComDataCU *&rpcTempCU )1817 Void TEncCu::xCheckRDCostILRUni(TComDataCU *&rpcBestCU, TComDataCU *&rpcTempCU, UInt refLayerId) 1817 1818 { 1818 1819 UChar uhDepth = rpcTempCU->getDepth( 0 ); 1819 1820 1820 rpcTempCU->setDepthSubParts( uhDepth, 0 ); 1821 1822 1821 #if SKIP_FLAG 1823 1822 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth ); 1824 1823 #endif 1825 1826 1824 rpcTempCU->setPartSizeSubParts ( SIZE_2Nx2N, 0, uhDepth ); //2Nx2N 1827 1825 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth ); 1828 1826 rpcTempCU->setCUTransquantBypassSubParts ( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth ); 1829 1830 Bool exitILR = m_pcPredSearch->predInterSearchILRUni( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] ); 1831 1827 Bool exitILR = m_pcPredSearch->predInterSearchILRUni( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], refLayerId ); 1832 1828 if(!exitILR) 1833 1829 { 1834 return; 1835 } 1836 1830 return; 1831 } 1837 1832 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false ); 1838 1839 1833 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1840 1841 1834 xCheckDQP( rpcTempCU ); 1842 1835 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth); 1843 1844 1836 return; 1845 1837 } 1846 1838 #endif 1847 1848 1849 1839 //! \} -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCu.h
r191 r282 158 158 #endif 159 159 #if ENCODER_FAST_MODE 160 Void xCheckRDCostILRUni ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU 160 Void xCheckRDCostILRUni ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt refLayerId); 161 161 #endif 162 162 Void xCheckDQP ( TComDataCU* pcCU ); -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r251 r282 535 535 if (m_layerId > 0) 536 536 { 537 for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 538 { 539 UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i); 537 540 #if VPS_EXTN_DIRECT_REF_LAYERS 538 TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId]->getRefLayerEnc(m_layerId-1)->getListPic();539 #else 540 TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId-1]->getListPic();541 #endif 542 pcSlice->setBaseColPic (*cListPic, m_layerId);543 541 TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId]->getRefLayerEnc(refLayerIdc)->getListPic(); 542 #else 543 TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId-1]->getListPic(); 544 #endif 545 pcSlice->setBaseColPic( *cListPic, refLayerIdc ); 546 544 547 #if SIMPLIFIED_MV_POS_SCALING 545 548 #if SCALED_REF_LAYER_OFFSETS 546 const Window &scalEL = m_pcEncTop->getScaledRefLayerWindow(); 547 548 Int widthBL = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth(); 549 Int heightBL = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight(); 550 551 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 552 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 553 #else 554 const Window &confBL = pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow(); 555 const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow(); 556 557 Int widthBL = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 558 Int heightBL = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); 559 560 Int widthEL = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 561 Int heightEL = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 562 #endif 563 g_mvScalingFactor[m_layerId][0] = widthEL == widthBL ? 4096 : Clip3(-4096, 4095, ((widthEL << 8) + (widthBL >> 1)) / widthBL); 564 g_mvScalingFactor[m_layerId][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL); 565 566 g_posScalingFactor[m_layerId][0] = ((widthBL << 16) + (widthEL >> 1)) / widthEL; 567 g_posScalingFactor[m_layerId][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL; 568 #endif 569 570 #if ZERO_NUM_DIRECT_LAYERS 571 if( pcSlice->getActiveNumILRRefIdx() ) 572 #endif 573 { 549 const Window &scalEL = m_pcEncTop->getScaledRefLayerWindow(); 550 551 Int widthBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth(); 552 Int heightBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight(); 553 554 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 555 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 556 #else 557 const Window &confBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getConformanceWindow(); 558 const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow(); 559 560 Int widthBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 561 Int heightBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); 562 563 Int widthEL = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 564 Int heightEL = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 565 #endif 566 g_mvScalingFactor[refLayerIdc][0] = widthEL == widthBL ? 4096 : Clip3(-4096, 4095, ((widthEL << 8) + (widthBL >> 1)) / widthBL); 567 g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL); 568 569 g_posScalingFactor[refLayerIdc][0] = ((widthBL << 16) + (widthEL >> 1)) / widthEL; 570 g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL; 571 #endif 572 574 573 #if SVC_UPSAMPLING 575 if ( pcPic->isSpatialEnhLayer())574 if( pcPic->isSpatialEnhLayer(refLayerIdc)) 576 575 { 577 576 #if SCALED_REF_LAYER_OFFSETS 578 m_pcPredSearch->upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow() );579 #else 580 m_pcPredSearch->upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec() );577 m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow() ); 578 #else 579 m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec() ); 581 580 #endif 582 581 } 583 582 else 584 583 { 585 pcPic->setFullPelBaseRec( pcSlice->getBaseColPic()->getPicYuvRec() );586 } 587 pcSlice->setFullPelBaseRec ( pcPic->getFullPelBaseRec() );584 pcPic->setFullPelBaseRec( refLayerIdc, pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec() ); 585 } 586 pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) ); 588 587 #endif 589 588 } … … 595 594 { 596 595 #if IDR_ALIGNMENT 597 if( pcSlice->getBaseColPic()->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcSlice->getBaseColPic()->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 598 { 599 pcSlice->setNalUnitType(pcSlice->getBaseColPic()->getSlice(0)->getNalUnitType()); 596 TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId]->getRefLayerEnc(0)->getListPic(); 597 TComPic* picLayer0 = pcSlice->getRefPic(*cListPic, pcSlice->getPOC() ); 598 if( picLayer0->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || picLayer0->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 599 { 600 pcSlice->setNalUnitType(picLayer0->getSlice(0)->getNalUnitType()); 600 601 } 601 602 else … … 935 936 { 936 937 pcSlice->getSPS()->setTMVPFlagsPresent(1); 938 #if SVC_EXTENSION 939 if( pcSlice->getIdrPicFlag() ) 940 { 941 pcSlice->setEnableTMVPFlag(0); 942 } 943 else 944 #endif 937 945 pcSlice->setEnableTMVPFlag(1); 938 946 } -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r212 r282 3287 3287 #endif 3288 3288 3289 #if (ENCODER_FAST_MODE)3290 Bool testILR;3291 #endif3292 3293 3289 xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits); 3294 3290 … … 3312 3308 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 3313 3309 3314 #if (ENCODER_FAST_MODE)3315 if (pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1)3316 {3317 testILR = false;3318 }3319 else3320 {3321 testILR = true;3322 }3323 #endif3324 3325 3310 for ( Int iRefIdxTemp = 0; iRefIdxTemp < pcCU->getSlice()->getNumRefIdx(eRefPicList); iRefIdxTemp++ ) 3326 3311 { 3327 3312 #if (ENCODER_FAST_MODE) 3328 3313 TComPic* pcPic = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp ); 3329 if( !testILR &&pcPic->isILR(pcCU->getLayerId()) && (ePartSize == SIZE_2Nx2N) )3314 if( pcPic->isILR(pcCU->getLayerId()) && (ePartSize == SIZE_2Nx2N) ) 3330 3315 { 3331 3316 continue; … … 6305 6290 6306 6291 #if ENCODER_FAST_MODE 6307 Bool TEncSearch::predInterSearchILRUni( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv )6292 Bool TEncSearch::predInterSearchILRUni( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, UInt refLayerId ) 6308 6293 { 6309 rpcPredYuv->clear(); 6310 rpcRecoYuv->clear(); 6311 6312 Int iNumPredDir = pcCU->getSlice()->isInterP() ? 1 : 2; 6313 6314 TComMv cMv[2]; 6315 TComMv cMvPred[2][33]; 6316 TComMv cMvTemp[2][33]; 6317 TComMv TempMv; 6318 6319 Int iRefIdx[2]={0,0}; 6320 6321 Int aaiMvpIdx[2][33]; 6322 Int aaiMvpNum[2][33]; 6323 6324 UInt uiMbBits[3] = {1, 1, 0}; 6325 UInt uiLastMode = 0; 6326 6327 UInt uiCost[2] = { MAX_UINT, MAX_UINT }; //uni, rdCost 6328 UInt uiCostTemp; 6329 UInt biPDistTemp = MAX_INT; 6330 UInt uiBitsTemp; 6331 6332 PartSize ePartSize = pcCU->getPartitionSize( 0 ); //2Nx2N 6333 Int iPartIdx = 0; //one PU in CU 6334 UInt uiPartAddr; 6335 Int iRoiWidth, iRoiHeight; 6336 6337 xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits); 6338 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); 6339 6340 for( Int iRefList = 0; iRefList < iNumPredDir; iRefList++) //list 6341 { 6342 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 6343 6344 Int iRefIdxTemp = -1; 6345 Bool foundILR = false; 6346 for( Int refIdx = 0; refIdx < pcCU->getSlice()->getNumRefIdx(eRefPicList); refIdx++ ) 6347 { 6348 if( pcCU->getSlice()->getRefPic(eRefPicList, refIdx)->isILR(pcCU->getLayerId()) ) 6349 { 6350 iRefIdxTemp = refIdx; 6351 foundILR = true; 6352 break; 6353 } 6354 } 6355 6356 if(!foundILR) //no ILR in eRefPiclist 6357 { 6358 continue; 6359 } 6360 6361 uiBitsTemp = uiMbBits[iRefList]; 6362 if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 ) 6363 { 6364 uiBitsTemp += iRefIdxTemp+1; 6365 if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--; 6366 } 6367 6368 xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &biPDistTemp); 6369 aaiMvpIdx[iRefList][iRefIdxTemp] = pcCU->getMVPIdx(eRefPicList, uiPartAddr); 6370 aaiMvpNum[iRefList][iRefIdxTemp] = pcCU->getMVPNum(eRefPicList, uiPartAddr); 6371 6372 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 6373 6374 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 6375 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 6376 6377 if( uiCostTemp < uiCost[iRefList] ) 6378 { 6379 uiCost[iRefList] = uiCostTemp; 6380 6381 cMv[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; 6382 iRefIdx[iRefList] = iRefIdxTemp; 6383 6384 pcCU->getCUMvField(eRefPicList)->setAllMv( cMv[iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 6385 pcCU->getCUMvField(eRefPicList)->setAllRefIdx( iRefIdx[iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 6386 } 6387 } 6388 6389 if( uiCost[0] == MAX_UINT && uiCost[1] == MAX_UINT ) //no ILR in both list0 and list1 6390 { 6391 return false; 6392 } 6393 6394 // Clear Motion Field 6395 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( TComMvField(), ePartSize, uiPartAddr, 0, iPartIdx ); 6396 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( TComMvField(), ePartSize, uiPartAddr, 0, iPartIdx ); 6397 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( TComMv(), ePartSize, uiPartAddr, 0, iPartIdx ); 6398 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( TComMv(), ePartSize, uiPartAddr, 0, iPartIdx ); 6399 6400 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6401 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6402 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6403 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6404 6405 if( uiCost[0] <= uiCost[1] ) //list0 ILR 6406 { 6407 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMv ( cMv[0], ePartSize, uiPartAddr, 0, iPartIdx ); 6408 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx( iRefIdx[0], ePartSize, uiPartAddr, 0, iPartIdx ); 6409 6410 TempMv = cMv[0] - cMvPred[0][iRefIdx[0]]; 6411 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 6412 6413 pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 6414 6415 pcCU->setMVPIdxSubParts( aaiMvpIdx[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6416 pcCU->setMVPNumSubParts( aaiMvpNum[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6417 } 6418 else if( uiCost[1] < uiCost[0] ) //list1 ILR 6419 { 6420 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMv ( cMv[1], ePartSize, uiPartAddr, 0, iPartIdx ); 6421 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx( iRefIdx[1], ePartSize, uiPartAddr, 0, iPartIdx ); 6422 6423 TempMv = cMv[1] - cMvPred[1][iRefIdx[1]]; 6424 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 6425 6426 pcCU->setInterDirSubParts( 2, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 6427 6428 pcCU->setMVPIdxSubParts( aaiMvpIdx[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6429 pcCU->setMVPNumSubParts( aaiMvpNum[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6430 } 6431 else 6432 { 6433 assert(0); 6434 } 6435 6436 pcCU->setMergeFlagSubParts( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 6437 6438 motionCompensation ( pcCU, rpcPredYuv, REF_PIC_LIST_X, iPartIdx ); 6439 6440 setWpScalingDistParam( pcCU, -1, REF_PIC_LIST_X ); 6441 6442 return true; 6294 rpcPredYuv->clear(); 6295 rpcRecoYuv->clear(); 6296 6297 Int iNumPredDir = pcCU->getSlice()->isInterP() ? 1 : 2; 6298 6299 TComMv cMv[2]; 6300 TComMv cMvPred[2][33]; 6301 TComMv cMvTemp[2][33]; 6302 TComMv TempMv; 6303 6304 Int iRefIdx[2]={0,0}; 6305 6306 Int aaiMvpIdx[2][33]; 6307 Int aaiMvpNum[2][33]; 6308 6309 UInt uiMbBits[3] = {1, 1, 0}; 6310 UInt uiLastMode = 0; 6311 6312 UInt uiCost[2] = { MAX_UINT, MAX_UINT }; //uni, rdCost 6313 UInt uiCostTemp; 6314 UInt biPDistTemp = MAX_INT; 6315 UInt uiBitsTemp; 6316 6317 PartSize ePartSize = pcCU->getPartitionSize( 0 ); //2Nx2N 6318 Int iPartIdx = 0; //one PU in CU 6319 UInt uiPartAddr; 6320 Int iRoiWidth, iRoiHeight; 6321 Bool bILRSearched = false; 6322 6323 xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits); 6324 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); 6325 6326 for( Int iRefList = 0; iRefList < iNumPredDir; iRefList++) //list 6327 { 6328 if(bILRSearched) 6329 continue; 6330 6331 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 6332 6333 Int iRefIdxTemp = -1; 6334 Bool foundILR = false; 6335 6336 for( Int refIdx = 0; refIdx < pcCU->getSlice()->getNumRefIdx(eRefPicList); refIdx++ ) 6337 { 6338 if( pcCU->getSlice()->getRefPic(eRefPicList, refIdx)->isILR(pcCU->getLayerId()) && pcCU->getSlice()->getRefPic(eRefPicList, refIdx)->getLayerId() == refLayerId ) 6339 { 6340 iRefIdxTemp = refIdx; 6341 foundILR = true; 6342 bILRSearched = true; 6343 break; 6344 } 6345 } 6346 6347 if(!foundILR) //no ILR in eRefPiclist 6348 { 6349 continue; 6350 } 6351 6352 uiBitsTemp = uiMbBits[iRefList]; 6353 if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 ) 6354 { 6355 uiBitsTemp += iRefIdxTemp+1; 6356 if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--; 6357 } 6358 6359 xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &biPDistTemp); 6360 aaiMvpIdx[iRefList][iRefIdxTemp] = pcCU->getMVPIdx(eRefPicList, uiPartAddr); 6361 aaiMvpNum[iRefList][iRefIdxTemp] = pcCU->getMVPNum(eRefPicList, uiPartAddr); 6362 6363 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 6364 6365 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 6366 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 6367 6368 if( uiCostTemp < uiCost[iRefList] ) 6369 { 6370 uiCost[iRefList] = uiCostTemp; 6371 6372 cMv[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; 6373 iRefIdx[iRefList] = iRefIdxTemp; 6374 6375 pcCU->getCUMvField(eRefPicList)->setAllMv( cMv[iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 6376 pcCU->getCUMvField(eRefPicList)->setAllRefIdx( iRefIdx[iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 6377 } 6378 } 6379 6380 if( uiCost[0] == MAX_UINT && uiCost[1] == MAX_UINT ) //no ILR in both list0 and list1 6381 { 6382 return false; 6383 } 6384 6385 // Clear Motion Field 6386 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( TComMvField(), ePartSize, uiPartAddr, 0, iPartIdx ); 6387 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( TComMvField(), ePartSize, uiPartAddr, 0, iPartIdx ); 6388 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( TComMv(), ePartSize, uiPartAddr, 0, iPartIdx ); 6389 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( TComMv(), ePartSize, uiPartAddr, 0, iPartIdx ); 6390 6391 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6392 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6393 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6394 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6395 6396 if( uiCost[0] <= uiCost[1] ) //list0 ILR 6397 { 6398 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMv ( cMv[0], ePartSize, uiPartAddr, 0, iPartIdx ); 6399 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx( iRefIdx[0], ePartSize, uiPartAddr, 0, iPartIdx ); 6400 6401 TempMv = cMv[0] - cMvPred[0][iRefIdx[0]]; 6402 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 6403 6404 pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 6405 6406 pcCU->setMVPIdxSubParts( aaiMvpIdx[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6407 pcCU->setMVPNumSubParts( aaiMvpNum[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6408 } 6409 else if( uiCost[1] < uiCost[0] ) //list1 ILR 6410 { 6411 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMv ( cMv[1], ePartSize, uiPartAddr, 0, iPartIdx ); 6412 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx( iRefIdx[1], ePartSize, uiPartAddr, 0, iPartIdx ); 6413 6414 TempMv = cMv[1] - cMvPred[1][iRefIdx[1]]; 6415 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 6416 6417 pcCU->setInterDirSubParts( 2, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 6418 6419 pcCU->setMVPIdxSubParts( aaiMvpIdx[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6420 pcCU->setMVPNumSubParts( aaiMvpNum[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 6421 } 6422 else 6423 { 6424 assert(0); 6425 } 6426 6427 pcCU->setMergeFlagSubParts( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 6428 6429 motionCompensation ( pcCU, rpcPredYuv, REF_PIC_LIST_X, iPartIdx ); 6430 setWpScalingDistParam( pcCU, -1, REF_PIC_LIST_X ); 6431 6432 return true; 6443 6433 } 6444 6445 6446 6434 #endif 6447 6435 -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncSearch.h
r191 r282 216 216 217 217 #if (ENCODER_FAST_MODE) 218 Bool predInterSearchILRUni ( TComDataCU* pcCU, 219 TComYuv* pcOrgYuv, 220 TComYuv*& rpcPredYuv, 221 TComYuv*& rpcResiYuv, 222 TComYuv*& rpcRecoYuv 223 ); 224 218 Bool predInterSearchILRUni ( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, UInt refLayerId ); 225 219 #endif 226 220 -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r258 r282 493 493 if( rpcSlice->getNumILRRefIdx() > 0 ) 494 494 { 495 rpcSlice->setActiveNumILRRefIdx( rpcSlice->getNumILRRefIdx() );495 rpcSlice->setActiveNumILRRefIdx( m_ppcTEncTop[layerId]->getNumActiveRefLayers() ); 496 496 for( Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 497 497 { 498 rpcSlice->setInterLayerPredLayerIdc( i, i);498 rpcSlice->setInterLayerPredLayerIdc( m_ppcTEncTop[layerId]->getPredLayerId(i), i ); 499 499 } 500 500 rpcSlice->setInterLayerPredEnabledFlag(1); … … 995 995 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 996 996 pcCU->initCU( rpcPic, uiCUAddr ); 997 #if SVC_EXTENSION998 pcCU->setLayerId(m_pcCfg->getLayerId());999 #endif1000 997 1001 998 #if !RATE_CONTROL_LAMBDA_DOMAIN -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncTop.cpp
r250 r282 507 507 if(m_layerId > 0) 508 508 { 509 for(UInt i = 0; i < m_cVPS.getNumDirectRefLayers( m_layerId ); i++ ) 510 { 511 const Window scalEL = getSPS()->getScaledRefLayerWindow(); 512 Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 ); 513 509 514 #if VPS_EXTN_DIRECT_REF_LAYERS 510 TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( m_layerId - 1 ); 511 #else 512 TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 ); 513 #endif 514 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() ) 515 { 516 pcEPic->setSpatialEnhLayerFlag( true ); 517 518 //only for scalable extension 519 assert( m_cVPS.getScalabilityMask(1) == true ); 515 TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( i ); 516 #else 517 TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 ); 518 #endif 519 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets ) 520 { 521 pcEPic->setSpatialEnhLayerFlag( i, true ); 522 523 //only for scalable extension 524 assert( m_cVPS.getScalabilityMask(1) == true ); 525 } 520 526 } 521 527 } … … 538 544 if(m_layerId > 0) 539 545 { 546 for(UInt i = 0; i < m_cVPS.getNumDirectRefLayers( m_layerId ); i++ ) 547 { 548 const Window scalEL = getSPS()->getScaledRefLayerWindow(); 549 Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 ); 550 540 551 #if VPS_EXTN_DIRECT_REF_LAYERS 541 TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( m_layerId - 1 ); 542 #else 543 TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 ); 544 #endif 545 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() ) 546 { 547 rpcPic->setSpatialEnhLayerFlag( true ); 548 549 //only for scalable extension 550 assert( m_cVPS.getScalabilityMask(1) == true ); 552 TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( i ); 553 #else 554 TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 ); 555 #endif 556 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets ) 557 { 558 rpcPic->setSpatialEnhLayerFlag( i, true ); 559 560 //only for scalable extension 561 assert( m_cVPS.getScalabilityMask(1) == true ); 562 } 551 563 } 552 564 } … … 1210 1222 } 1211 1223 1212 // currently only one reference layer is supported 1213 assert( m_ppcTEncTop[m_layerId]->getNumDirectRefLayers() == 1 ); 1214 1215 return (TEncTop *)getLayerEnc( getVPS()->getRefLayerId( m_layerId, refLayerIdc ) ); 1224 return (TEncTop *)getLayerEnc( m_cVPS.getRefLayerId( m_layerId, refLayerIdc ) ); 1216 1225 } 1217 1226 #endif … … 1235 1244 if (m_cIlpPic[0] == NULL) 1236 1245 { 1237 for (Int j=0; j <1/*MAX_NUM_REF*/; j++)1246 for (Int j=0; j < MAX_LAYERS /*MAX_NUM_REF*/; j++) // consider to set to NumDirectRefLayers[LayerIdInVps[nuh_layer_id]] 1238 1247 { 1239 1248 m_cIlpPic[j] = new TComPic; … … 1254 1263 Void TEncTop::setILRPic(TComPic *pcPic) 1255 1264 { 1256 if(m_cIlpPic[0]) 1257 { 1258 m_cIlpPic[0]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(), m_cIlpPic[0]->getPicYuvRec()); 1259 m_cIlpPic[0]->getSlice(0)->setPOC(pcPic->getPOC()); 1260 m_cIlpPic[0]->setLayerId(pcPic->getSlice(0)->getBaseColPic()->getLayerId()); //set reference layerId 1261 m_cIlpPic[0]->getPicYuvRec()->setBorderExtension(false); 1262 m_cIlpPic[0]->getPicYuvRec()->extendPicBorder(); 1265 for( Int i = 0; i < pcPic->getSlice(0)->getActiveNumILRRefIdx(); i++ ) 1266 { 1267 Int refLayerIdc = pcPic->getSlice(0)->getInterLayerPredLayerIdc(i); 1268 1269 if(m_cIlpPic[refLayerIdc]) 1270 { 1271 m_cIlpPic[refLayerIdc]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(refLayerIdc), m_cIlpPic[refLayerIdc]->getPicYuvRec()); 1272 m_cIlpPic[refLayerIdc]->getSlice(0)->setPOC(pcPic->getPOC()); 1273 m_cIlpPic[refLayerIdc]->setLayerId(pcPic->getSlice(0)->getBaseColPic(refLayerIdc)->getLayerId()); //set reference layerId 1274 m_cIlpPic[refLayerIdc]->getPicYuvRec()->setBorderExtension(false); 1275 m_cIlpPic[refLayerIdc]->getPicYuvRec()->extendPicBorder(); 1276 } 1263 1277 } 1264 1278 }
Note: See TracChangeset for help on using the changeset viewer.