Changeset 1187 in 3DVCSoftware for branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComSlice.cpp
- Timestamp:
- 8 Apr 2015, 15:26:52 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComSlice.cpp
r1185 r1187 2721 2721 } 2722 2722 2723 #if H_3D 2724 Void TComVPS::initViewCompLayer() 2725 { 2726 assert( m_viewCompLayerId.size() == 0 && m_viewCompLayerPresentFlag.size() == 0 ); 2727 for( Int i = 0; i < getNumViews(); i++ ) 2728 { 2729 m_viewCompLayerId .push_back( std::vector<Int>(0) ); 2730 m_viewCompLayerPresentFlag.push_back( std::vector<Bool>(0) ); 2731 2732 for( Int depFlag = 0; depFlag <= 1; depFlag++ ) 2733 { 2734 Int iViewOIdx = getViewOIdxList( i ); 2735 Int layerId = -1; 2736 for( Int j = 0; j <= getMaxLayersMinus1(); j++ ) 2737 { 2738 Int jNuhLId = getLayerIdInNuh( j ); 2739 if( getVpsDepthFlag( jNuhLId ) == ( (Bool) depFlag ) && getViewOrderIdx( jNuhLId ) == iViewOIdx 2740 && getDependencyId( jNuhLId ) == 0 && getAuxId( jNuhLId ) == 0 ) 2741 { 2742 layerId = jNuhLId; 2743 } 2744 } 2745 m_viewCompLayerPresentFlag[ i ].push_back( layerId != -1 ); 2746 m_viewCompLayerId [ i ].push_back( layerId ); 2747 } 2748 } 2749 } 2750 2751 Int TComVPS::getVoiInVps(Int viewOIdx) 2752 { 2753 for ( Int i = 0; i < m_viewOIdxList.size(); i++ ) 2754 { 2755 if ( m_viewOIdxList[ i ] == viewOIdx ) 2756 { 2757 return i; 2758 } 2759 } 2760 assert( 0 ); 2761 return -1; 2762 } 2763 2764 Void TComVPS::deriveCpPresentFlag() 2765 { 2766 for( Int nInVps = 0; nInVps < getNumViews(); nInVps++ ) 2767 { 2768 for( Int mInVps = 0; mInVps < getNumViews(); mInVps++ ) 2769 { 2770 m_cpPresentFlag[nInVps][mInVps] = 0; 2771 } 2772 } 2773 2774 for( Int n = 1; n < getNumViews(); n++ ) 2775 { 2776 Int iInVps = getVoiInVps( getViewOIdxList( n ) ); 2777 for( Int m = 0; m < getNumCp( iInVps ); m++ ) 2778 { 2779 m_cpPresentFlag[ iInVps ][ getVoiInVps( getCpRefVoi( iInVps, m ) ) ] = 1; 2780 } 2781 } 2782 } 2783 #endif 2723 2784 2724 2785 #endif // H_MV … … 3824 3885 } 3825 3886 #endif 3887 3826 3888 #if H_3D_IC 3889 // This is an encoder only function and should be moved to TEncSlice or TEncSearch!! 3827 3890 Void TComSlice::xSetApplyIC(Bool bUseLowLatencyICEnc) 3828 3891 { … … 3888 3951 } 3889 3952 else 3890 { 3891 Int iMaxPelValue = ( 1 << g_bitDepthY ); 3892 Int *aiRefOrgHist; 3893 Int *aiCurrHist; 3894 aiRefOrgHist = (Int *) xMalloc( Int,iMaxPelValue ); 3895 aiCurrHist = (Int *) xMalloc( Int,iMaxPelValue ); 3896 memset( aiRefOrgHist, 0, iMaxPelValue*sizeof(Int) ); 3897 memset( aiCurrHist, 0, iMaxPelValue*sizeof(Int) ); 3898 // Reference Idx Number 3899 Int iNumRefIdx = getNumRefIdx( REF_PIC_LIST_0 ); 3900 TComPic* pcCurrPic = NULL; 3901 TComPic* pcRefPic = NULL; 3902 TComPicYuv* pcCurrPicYuv = NULL; 3903 TComPicYuv* pcRefPicYuvOrg = NULL; 3904 pcCurrPic = getPic(); 3905 pcCurrPicYuv = pcCurrPic->getPicYuvOrg(); 3906 Int iWidth = pcCurrPicYuv->getWidth(); 3907 Int iHeight = pcCurrPicYuv->getHeight(); 3908 3909 3910 // Get InterView Reference picture 3911 // !!!!! Assume only one Interview Reference Picture in L0 3912 for ( Int i = 0; i < iNumRefIdx; i++ ) 3913 { 3914 pcRefPic = getRefPic( REF_PIC_LIST_0, i ); 3915 if ( pcRefPic != NULL ) 3916 { 3917 if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() ) 3918 { 3919 pcRefPicYuvOrg = pcRefPic->getPicYuvOrg(); 3920 } 3921 } 3922 } 3923 3924 if ( pcRefPicYuvOrg != NULL ) 3925 { 3926 Pel* pCurrY = pcCurrPicYuv ->getLumaAddr(); 3927 Pel* pRefOrgY = pcRefPicYuvOrg ->getLumaAddr(); 3928 Int iCurrStride = pcCurrPicYuv->getStride(); 3929 Int iRefStride = pcRefPicYuvOrg->getStride(); 3930 Int iSumOrgSAD = 0; 3931 Double dThresholdOrgSAD = getIsDepth() ? 0.1 : 0.05; 3932 3933 // Histogram building - luminance 3934 for ( Int y = 0; y < iHeight; y++ ) 3935 { 3936 for ( Int x = 0; x < iWidth; x++ ) 3937 { 3938 aiCurrHist[pCurrY[x]]++; 3939 aiRefOrgHist[pRefOrgY[x]]++; 3940 } 3941 pCurrY += iCurrStride; 3942 pRefOrgY += iRefStride; 3943 } 3944 // Histogram SAD 3945 for ( Int i = 0; i < iMaxPelValue; i++ ) 3946 { 3947 iSumOrgSAD += abs( aiCurrHist[i] - aiRefOrgHist[i] ); 3948 } 3949 // Setting 3950 if ( iSumOrgSAD > Int( dThresholdOrgSAD * iWidth * iHeight ) ) 3951 { 3952 m_bApplyIC = true; 3953 } 3954 else 3955 { 3956 m_bApplyIC = false; 3957 } 3958 } 3959 3960 xFree( aiCurrHist ); 3961 xFree( aiRefOrgHist ); 3962 aiCurrHist = NULL; 3963 aiRefOrgHist = NULL; 3953 { 3954 TComPic* pcCurrPic = getPic(); 3955 TComPicYuv* pcCurrPicYuv = pcCurrPic->getPicYuvOrg(); 3956 3957 // Get InterView Reference picture 3958 // !!!!! Assume only one Interview Reference Picture in L0 3959 // GT: Is this assumption correct? 3960 3961 TComPicYuv* pcRefPicYuvOrg = NULL; 3962 for ( Int i = 0; i < getNumRefIdx( REF_PIC_LIST_0 ); i++ ) 3963 { 3964 TComPic* pcRefPic = getRefPic( REF_PIC_LIST_0, i ); 3965 if ( pcRefPic != NULL ) 3966 { 3967 if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() ) 3968 { 3969 pcRefPicYuvOrg = pcRefPic->getPicYuvOrg(); 3970 } 3971 } 3972 } 3973 3974 if ( pcRefPicYuvOrg != NULL ) 3975 { 3976 // Histogram building - luminance 3977 Int iMaxPelValue = ( 1 << g_bitDepthY ); 3978 Int *aiRefOrgHist = (Int *) xMalloc( Int,iMaxPelValue ); 3979 Int *aiCurrHist = (Int *) xMalloc( Int,iMaxPelValue ); 3980 memset( aiRefOrgHist, 0, iMaxPelValue*sizeof(Int) ); 3981 memset( aiCurrHist, 0, iMaxPelValue*sizeof(Int) ); 3982 3983 Int iWidth = pcCurrPicYuv->getWidth(); 3984 Int iHeight = pcCurrPicYuv->getHeight(); 3985 3986 Pel* pCurrY = pcCurrPicYuv ->getLumaAddr(); 3987 Pel* pRefOrgY = pcRefPicYuvOrg ->getLumaAddr(); 3988 Int iCurrStride = pcCurrPicYuv->getStride(); 3989 Int iRefStride = pcRefPicYuvOrg->getStride(); 3990 3991 for ( Int y = 0; y < iHeight; y++ ) 3992 { 3993 for ( Int x = 0; x < iWidth; x++ ) 3994 { 3995 aiCurrHist[pCurrY[x]]++; 3996 aiRefOrgHist[pRefOrgY[x]]++; 3997 } 3998 pCurrY += iCurrStride; 3999 pRefOrgY += iRefStride; 4000 } 4001 4002 // Histogram SAD 4003 Int iSumOrgSAD = 0; 4004 for ( Int i = 0; i < iMaxPelValue; i++ ) 4005 { 4006 iSumOrgSAD += abs( aiCurrHist[i] - aiRefOrgHist[i] ); 4007 } 4008 4009 // Setting 4010 Double dThresholdOrgSAD = getIsDepth() ? 0.1 : 0.05; 4011 4012 if ( iSumOrgSAD > Int( dThresholdOrgSAD * iWidth * iHeight ) ) 4013 { 4014 m_bApplyIC = true; 4015 } 4016 else 4017 { 4018 m_bApplyIC = false; 4019 } 4020 4021 xFree( aiCurrHist ); 4022 xFree( aiRefOrgHist ); 4023 } 3964 4024 }//if(bUseLowLatencyICEnc) 3965 4025 } … … 4136 4196 #endif 4137 4197 } 4198 4199 Void TComSlice::deriveInCmpPredAndCpAvailFlag() 4200 { 4201 Int numCurCmpLIds = getIsDepth() ? 1 : getNumActiveRefLayerPics(); 4202 std::vector<Int> curCmpLIds; 4203 if ( getIsDepth() ) 4204 { 4205 curCmpLIds.push_back( getLayerId() ); 4206 } 4207 else 4208 { 4209 for (Int i = 0; i < numCurCmpLIds; i++) 4210 { 4211 curCmpLIds.push_back( getRefPicLayerId( i ) ); 4212 } 4213 } 4214 4215 m_cpAvailableFlag = true; 4216 m_inCmpRefViewIdcs.clear(); 4217 Bool allRefCmpLayersAvailFlag = true; 4218 4219 for( Int i = 0; i <= numCurCmpLIds - 1; i++ ) 4220 { 4221 m_inCmpRefViewIdcs.push_back( getVPS()->getViewOrderIdx( curCmpLIds[ i ] )); 4222 if( !getVPS()->getCpPresentFlag( getVPS()->getVoiInVps( getViewIndex() ), getVPS()->getVoiInVps( m_inCmpRefViewIdcs[ i ] ) ) ) 4223 { 4224 m_cpAvailableFlag = false; 4225 } 4226 Bool refCmpCurLIdAvailFlag = false; 4227 if( getVPS()->getViewCompLayerPresentFlag( m_inCmpRefViewIdcs[ i ], !getIsDepth() ) ) 4228 { 4229 Int j = getVPS()->getLayerIdInVps( getVPS()->getViewCompLayerId( m_inCmpRefViewIdcs[ i ], !getIsDepth() ) ); 4230 if ( getVPS()->getDirectDependencyFlag( getVPS()->getLayerIdInVps( getLayerId() ) , j ) && 4231 getVPS()->getSubLayersVpsMaxMinus1( j ) >= getTemporalId() && 4232 ( getTemporalId() == 0 || getVPS()->getMaxTidIlRefPicsPlus1( j , getVPS()->getLayerIdInVps( getLayerId() ) ) > getTemporalId() ) 4233 ) 4234 { 4235 refCmpCurLIdAvailFlag = true; 4236 } 4237 } 4238 if( !refCmpCurLIdAvailFlag ) 4239 { 4240 allRefCmpLayersAvailFlag = false; 4241 } 4242 } 4243 4244 if( !allRefCmpLayersAvailFlag ) 4245 { 4246 m_inCmpPredAvailFlag = false; 4247 } 4248 else 4249 { 4250 TComSps3dExtension* sps3dExt = getSPS()->getSps3dExtension(); 4251 if( !getIsDepth() ) 4252 { 4253 m_inCmpPredAvailFlag = sps3dExt->getViewSynthesisPredFlag( getIsDepth() ) || 4254 sps3dExt->getDepthBasedBlkPartFlag( getIsDepth() ) || 4255 sps3dExt->getDepthRefinementFlag ( getIsDepth() ); 4256 } 4257 else 4258 { 4259 m_inCmpPredAvailFlag = sps3dExt->getIntraContourFlag( getIsDepth() ) || 4260 sps3dExt->getQtPredFlag( getIsDepth() ) || 4261 sps3dExt->getMpiFlag( getIsDepth() ); 4262 } 4263 } 4264 } 4265 4266 Void TComSlice::checkInCompPredRefLayers() 4267 { 4268 if ( getInCompPredFlag() ) 4269 { 4270 for (Int i = 0; i < getNumCurCmpLIds(); i++ ) 4271 { 4272 assert( getIvPic(!getIsDepth(), getInCmpRefViewIdcs( i ) ) != NULL ); 4273 // It is a requirement of bitstream conformance that there 4274 // is a picture in the DPB with PicOrderCntVal equal to the PicOrderCntVal of the current picture, 4275 // and a nuh_layer_id value equal to ViewCompLayerId[ inCmpRefViewIdcs[ i ] ][ !DepthFlag ]. 4276 } 4277 } 4278 } 4279 4138 4280 #endif 4139 4281
Note: See TracChangeset for help on using the changeset viewer.