Changeset 608 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComRdCost.h
- Timestamp:
- 1 Sep 2013, 22:47:26 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/TComRdCost.h
r296 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 44 44 #include "TComMv.h" 45 45 46 #include "TComRdCost.h"47 46 #include "TComSlice.h" 48 47 #include "TComRdCostWeightPrediction.h" 48 #if H_3D 49 49 #include "../TLibRenderer/TRenModel.h" 50 #endif 50 51 51 52 //! \ingroup TLibCommon … … 56 57 class DistParam; 57 58 class TComPattern; 59 #if H_3D 58 60 class TComRdCost; 61 #endif 59 62 60 63 // ==================================================================================================================== … … 65 68 typedef UInt (*FpDistFunc) (DistParam*); 66 69 67 #if HHI_VSO 70 #if H_3D 71 #if H_3D_VSO 68 72 typedef Dist (TComRdCost::*FpDistFuncVSO) ( Int, Int, Pel*, Int, Pel*, Int, UInt, UInt, Bool ); 73 #endif 69 74 #endif 70 75 // ==================================================================================================================== … … 80 85 Int iStrideOrg; 81 86 Int iStrideCur; 82 #if SAIT_VSO_EST_A0033 87 #if H_3D_VSO 88 // SAIT_VSO_EST_A0033 83 89 Pel* pVirRec; 84 90 Pel* pVirOrg; 85 91 Int iStrideVir; 86 92 #endif 93 #if H_3D_IC 94 Bool bUseIC; 95 #endif 96 #if LGE_INTER_SDC_E0156 97 Bool bUseSDCMRSAD; 98 #endif 87 99 Int iRows; 88 100 Int iCols; 89 101 Int iStep; 90 #if LGE_ILLUCOMP_B004591 Bool bUseIC;92 #endif93 102 FpDistFunc DistFunc; 94 95 #if HHI_INTERVIEW_SKIP 96 Pel* pUsed; 97 Int iStrideUsed; 98 #endif 103 Int bitDepth; 104 99 105 Bool bApplyWeight; // whether weithed prediction is used or not 100 106 wpScalingParam *wpCur; // weithed prediction scaling parameters for current ref … … 113 119 pOrg = NULL; 114 120 pCur = NULL; 115 #if SAIT_VSO_EST_A0033116 pVirRec = NULL;117 pVirOrg = NULL;;118 iStrideVir = 0;119 #endif120 121 iStrideOrg = 0; 121 122 iStrideCur = 0; … … 125 126 DistFunc = NULL; 126 127 iSubShift = 0; 127 #if HHI_INTERVIEW_SKIP 128 pUsed = 0; 129 iStrideUsed = 0; 130 #endif 128 bitDepth = 0; 131 129 #if NS_HAD 132 130 bUseNSHAD = false; 131 #endif 132 #if H_3D_VSO 133 // SAIT_VSO_EST_A0033 134 pVirRec = NULL; 135 pVirOrg = NULL; 136 iStrideVir = 0; 137 #endif 138 #if LGE_INTER_SDC_E0156 139 bUseSDCMRSAD = false; 133 140 #endif 134 141 } … … 151 158 152 159 #if WEIGHTED_CHROMA_DISTORTION 153 Double m_chromaDistortionWeight; 160 Double m_cbDistortionWeight; 161 Double m_crDistortionWeight; 154 162 #endif 155 163 Double m_dLambda; … … 158 166 UInt m_uiLambdaMotionSSE; 159 167 Double m_dFrameLambda; 160 #if SAIT_VSO_EST_A0033 168 #if H_3D_VSO 169 // SAIT_VSO_EST_A0033 161 170 static Double m_dDisparityCoeff; 162 171 #endif 163 172 164 #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE165 Double m_dLambdaScale ;166 #endif167 173 // for motion cost 168 174 #if FIX203 … … 180 186 #endif 181 187 182 Bool m_bUseMultiviewReg;183 UInt m_uiLambdaMVReg;184 UInt m_uiLambdaMVRegSAD;185 UInt m_uiLambdaMVRegSSE;186 UInt* m_puiMultiviewRegCostHorOrgP;187 UInt* m_puiMultiviewRegCostVerOrgP;188 UInt* m_puiMultiviewRegCostHor;189 UInt* m_puiMultiviewRegCostVer;190 UInt* m_puiHorRegCost;191 UInt* m_puiVerRegCost;192 TComMv m_cMultiviewOrgMvPred;193 194 188 public: 195 189 TComRdCost(); 196 190 virtual ~TComRdCost(); 197 191 192 #if H_3D_VSO 193 Double calcRdCost ( UInt uiBits, Dist uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); 194 Double calcRdCost64( UInt64 uiBits, Dist64 uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); 195 #else 198 196 Double calcRdCost ( UInt uiBits, UInt uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); 199 197 Double calcRdCost64( UInt64 uiBits, UInt64 uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); 198 #endif 199 200 200 201 201 #if WEIGHTED_CHROMA_DISTORTION 202 Void setChromaDistortionWeight ( Double chromaDistortionWeight) { m_chromaDistortionWeight = chromaDistortionWeight; }; 202 Void setCbDistortionWeight ( Double cbDistortionWeight) { m_cbDistortionWeight = cbDistortionWeight; }; 203 Void setCrDistortionWeight ( Double crDistortionWeight) { m_crDistortionWeight = crDistortionWeight; }; 203 204 #endif 204 205 Void setLambda ( Double dLambda ); 205 #if H3D_IVMP206 Void setLambdaMVReg ( Double dLambda );207 #endif208 206 Void setFrameLambda ( Double dLambda ) { m_dFrameLambda = dLambda; } 209 207 210 #if SAIT_VSO_EST_A0033 208 Double getSqrtLambda () { return m_sqrtLambda; } 209 #if H_3D_VSO 210 // SAIT_VSO_EST_A0033 211 211 Void setDisparityCoeff( Double dDisparityCoeff ) { m_dDisparityCoeff = dDisparityCoeff; } 212 212 Double getDisparityCoeff() { return m_dDisparityCoeff; } 213 213 #endif 214 214 215 #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE 216 Void setLambdaScale ( Double dLambdaScale) { m_dLambdaScale = dLambdaScale; } 217 Double getLambdaScale ( ) { return m_dLambdaScale ; } 218 #endif 219 Double getSqrtLambda () { return m_sqrtLambda; } 215 #if RATE_CONTROL_LAMBDA_DOMAIN 216 Double getLambda() { return m_dLambda; } 217 #if M0036_RC_IMPROVEMENT 218 Double getChromaWeight () {return((m_cbDistortionWeight+m_crDistortionWeight)/2.0);} 219 #endif 220 #endif 220 221 221 222 // Distortion Functions … … 226 227 #if NS_HAD 227 228 Void setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME=false, Bool bUseNSHAD=false ); 228 Void setDistParam( DistParam& rcDP, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard = false, Bool bUseNSHAD=false );229 Void setDistParam( DistParam& rcDP, Int bitDepth, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard = false, Bool bUseNSHAD=false ); 229 230 #else 230 231 Void setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME=false ); 231 Void setDistParam( DistParam& rcDP, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard = false ); 232 #endif 233 234 UInt calcHAD ( Pel* pi0, Int iStride0, Pel* pi1, Int iStride1, Int iWidth, Int iHeight ); 235 232 Void setDistParam( DistParam& rcDP, Int bitDepth, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard = false ); 233 #endif 234 235 UInt calcHAD(Int bitDepth, Pel* pi0, Int iStride0, Pel* pi1, Int iStride1, Int iWidth, Int iHeight ); 236 237 #if SCU_HS_FAST_DEPTH_INTRA_E0238 238 UInt calcVAR(Pel* pi0, Int stride, Int width, Int height, Int cuDepth); 239 #endif 236 240 // for motion cost 237 241 #if !FIX203 … … 240 244 #endif 241 245 UInt xGetComponentBits( Int iVal ); 242 Void getMotionCost( Bool bSad, Int iAdd ) 243 { 244 m_uiCost = (bSad ? m_uiLambdaMotionSAD + iAdd : m_uiLambdaMotionSSE + iAdd); 245 m_uiLambdaMVReg = ( bSad ? m_uiLambdaMVRegSAD : m_uiLambdaMVRegSSE ); 246 247 } 246 Void getMotionCost( Bool bSad, Int iAdd ) { m_uiCost = (bSad ? m_uiLambdaMotionSAD + iAdd : m_uiLambdaMotionSSE + iAdd); } 248 247 Void setPredictor( TComMv& rcMv ) 249 248 { … … 274 273 #endif 275 274 } 276 277 Void setMultiviewReg( TComMv* pcMv )278 {279 if( pcMv )280 {281 m_bUseMultiviewReg = true;282 m_puiHorRegCost = m_puiMultiviewRegCostHor - pcMv->getHor();283 m_puiVerRegCost = m_puiMultiviewRegCostVer - pcMv->getVer();284 m_cMultiviewOrgMvPred = *pcMv;285 }286 else287 {288 m_bUseMultiviewReg = false;289 m_puiHorRegCost = 0;290 m_puiVerRegCost = 0;291 m_cMultiviewOrgMvPred.set( 0, 0 );292 }293 }294 __inline Bool useMultiviewReg () { return m_bUseMultiviewReg; }295 __inline TComMv& getMultiviewOrgMvPred() { return m_cMultiviewOrgMvPred; }296 __inline UInt getMultiviewRegCost ( Int x, Int y )297 {298 #if FIX203299 return m_uiLambdaMVReg * getBits(x, y) >> 16;300 #else301 return ( ( m_uiLambdaMVReg * ( m_puiHorRegCost[ x * ( 1 << m_iCostScale ) ] + m_puiVerRegCost[ y * ( 1 << m_iCostScale ) ] ) ) >> 16 );302 #endif303 }304 275 305 276 private: 306 277 307 #if LGE_ILLUCOMP_B0045 278 static UInt xGetSSE ( DistParam* pcDtParam ); 279 static UInt xGetSSE4 ( DistParam* pcDtParam ); 280 static UInt xGetSSE8 ( DistParam* pcDtParam ); 281 static UInt xGetSSE16 ( DistParam* pcDtParam ); 282 static UInt xGetSSE32 ( DistParam* pcDtParam ); 283 static UInt xGetSSE64 ( DistParam* pcDtParam ); 284 static UInt xGetSSE16N ( DistParam* pcDtParam ); 285 #if H_3D_IC || LGE_INTER_SDC_E0156 308 286 static UInt xGetSADic ( DistParam* pcDtParam ); 309 287 static UInt xGetSAD4ic ( DistParam* pcDtParam ); … … 314 292 static UInt xGetSAD16Nic ( DistParam* pcDtParam ); 315 293 #endif 316 static UInt xGetSSE ( DistParam* pcDtParam );317 static UInt xGetSSE4 ( DistParam* pcDtParam );318 static UInt xGetSSE8 ( DistParam* pcDtParam );319 static UInt xGetSSE16 ( DistParam* pcDtParam );320 static UInt xGetSSE32 ( DistParam* pcDtParam );321 static UInt xGetSSE64 ( DistParam* pcDtParam );322 static UInt xGetSSE16N ( DistParam* pcDtParam );323 324 294 static UInt xGetSAD ( DistParam* pcDtParam ); 325 295 static UInt xGetSAD4 ( DistParam* pcDtParam ); … … 330 300 static UInt xGetSAD16N ( DistParam* pcDtParam ); 331 301 332 #if SAIT_VSO_EST_A0033302 #if H_3D_VSO 333 303 static UInt xGetVSD ( DistParam* pcDtParam ); 334 304 static UInt xGetVSD4 ( DistParam* pcDtParam ); … … 341 311 342 312 #if AMP_SAD 343 #if LGE_ILLUCOMP_B0045313 #if H_3D_IC || LGE_INTER_SDC_E0156 344 314 static UInt xGetSAD12ic ( DistParam* pcDtParam ); 345 315 static UInt xGetSAD24ic ( DistParam* pcDtParam ); … … 349 319 static UInt xGetSAD24 ( DistParam* pcDtParam ); 350 320 static UInt xGetSAD48 ( DistParam* pcDtParam ); 351 #endif 352 353 #if LGE_ILLUCOMP_B0045 321 322 #endif 323 324 #if H_3D_IC || LGE_INTER_SDC_E0156 354 325 static UInt xGetHADsic ( DistParam* pcDtParam ); 355 326 #endif … … 357 328 static UInt xGetHADs8 ( DistParam* pcDtParam ); 358 329 static UInt xGetHADs ( DistParam* pcDtParam ); 359 360 330 static UInt xCalcHADs2x2 ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); 361 331 static UInt xCalcHADs4x4 ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); … … 367 337 368 338 public: 369 #if HHI_INTERVIEW_SKIP370 UInt getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, Pel* piUsed, Int iUsedStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc = DF_SSE );371 #endif372 339 #if WEIGHTED_CHROMA_DISTORTION 373 UInt getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bWeighted = false, DFunc eDFunc = DF_SSE ); 374 #else 375 UInt getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc = DF_SSE ); 376 #endif 377 378 #if SAIT_VSO_EST_A0033 379 UInt getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, Pel* piVirRec, Pel* piVirOrg, Int iVirStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc = DF_VSD ); 340 UInt getDistPart(Int bitDepth, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, TextType eText = TEXT_LUMA, DFunc eDFunc = DF_SSE ); 341 #else 342 UInt getDistPart(Int bitDepth, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc = DF_SSE ); 343 #endif 344 345 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 346 UInt getSADPart ( Int bitDepth, Pel* pelCur, Int curStride, Pel* pelOrg, Int orgStride, UInt width, UInt height ); 347 #endif 348 349 #if H_3D_VSO 350 // SAIT_VSO_EST_A0033 351 UInt getDistPartVSD( TComDataCU* pcCu, UInt uiPartOffset, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bHad, DFunc eDFunc = DF_VSD); 380 352 static UInt getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride, Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y ); 381 #endif 382 383 #if HHI_VSO 353 384 354 private: 385 355 Double m_dLambdaVSO; … … 388 358 UInt m_uiLambdaMotionSSEVSO; 389 359 Double m_dFrameLambdaVSO; 390 391 #if HHI_VSO_DIST_INT392 360 Bool m_bAllowNegDist; 393 #endif 394 #if SAIT_VSO_EST_A0033 361 Bool m_bUseVSO; 362 Bool m_bUseLambdaScaleVSO; 363 UInt m_uiVSOMode; 364 365 FpDistFuncVSO m_fpDistortFuncVSO; 366 TRenModel* m_pcRenModel; 367 368 369 // SAIT_VSO_EST_A0033 395 370 TComPicYuv * m_pcVideoRecPicYuv; 396 371 TComPicYuv * m_pcDepthPicYuv; 397 372 Bool m_bUseEstimatedVSD; 398 #endif 399 #ifLGE_WVSO_A0119373 374 // LGE_WVSO_A0119 400 375 Int m_iDWeight; 401 376 Int m_iVSOWeight; 402 377 Int m_iVSDWeight; 403 378 Bool m_bUseWVSO; 404 #endif 405 406 Bool m_bUseVSO; 407 Bool m_bUseLambdaScaleVSO; 408 UInt m_uiVSOMode; 409 410 FpDistFuncVSO m_fpDistortFuncVSO; 411 TRenModel* m_pcRenModel; 379 412 380 public: 413 381 414 382 Void setRenModel ( TRenModel* pcRenModel ) { m_pcRenModel = pcRenModel; } 383 TRenModel* getRenModel ( ) { return m_pcRenModel; } 415 384 Void setRenModelData ( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piData, Int iStride, Int iBlkWidth, Int iBlkHeight ); 416 385 Void setLambdaVSO ( Double dLambda ); … … 420 389 Void setUseVSO ( Bool bIn ) { m_bUseVSO = bIn; }; 421 390 Bool getUseVSO ( ) { return m_bUseVSO;}; 422 #if SAIT_VSO_EST_A0033 391 392 Bool getUseRenModel ( ) { return (m_bUseVSO && m_uiVSOMode == 4); }; 393 Void setUseLambdaScaleVSO(Bool bIn) { m_bUseLambdaScaleVSO = bIn; }; 394 Bool getUseLambdaScaleVSO( ) { return m_bUseLambdaScaleVSO; }; 395 396 Void setVSOMode( UInt uiIn); 397 UInt getVSOMode( ) { return m_uiVSOMode; } 398 Void setAllowNegDist ( Bool bAllowNegDist ); 399 400 Double getSqrtLambdaVSO () { return m_dSqrtLambdaVSO; } 401 Double getLambdaVSO () { return m_dLambdaVSO; } 402 403 Dist getDistPartVSO( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD ); 404 Double calcRdCostVSO ( UInt uiBits, Dist uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); 405 406 // SAIT_VSO_EST_A0033 423 407 Bool getUseEstimatedVSD( ) { return m_bUseEstimatedVSD; }; 424 408 Void setUseEstimatedVSD( Bool bIn ) { m_bUseEstimatedVSD = bIn; }; … … 428 412 TComPicYuv* getDepthPicYuv () { return m_pcDepthPicYuv; }; 429 413 Void setDepthPicYuv ( TComPicYuv* pcDepthPicYuv ) { m_pcDepthPicYuv = pcDepthPicYuv; }; 430 #endif 431 432 Bool getUseRenModel ( ) { return (m_bUseVSO && m_uiVSOMode == 4); }; 433 Void setUseLambdaScaleVSO(bool bIn) { m_bUseLambdaScaleVSO = bIn; }; 434 Bool getUseLambdaScaleVSO( ) { return m_bUseLambdaScaleVSO; }; 435 436 Void setVSOMode( UInt uiIn); 437 UInt getVSOMode( ) { return m_uiVSOMode; } 438 #if LGE_WVSO_A0119 414 415 // LGE_WVSO_A0119 439 416 Void setUseWVSO ( Bool bIn ) { m_bUseWVSO = bIn; }; 440 417 Bool getUseWVSO ( ) { return m_bUseWVSO;}; … … 445 422 Void setVSDWeight ( Int iVSDWeight ) { m_iVSDWeight = iVSDWeight; }; 446 423 Int getVSDWeight () { return m_iVSDWeight; }; 447 #endif448 #if HHI_VSO_DIST_INT449 Void setAllowNegDist ( Bool bAllowNegDist );450 #endif451 452 453 Double getSqrtLambdaVSO () { return m_dSqrtLambdaVSO; }454 Double getLambdaVSO () { return m_dLambdaVSO; }455 456 Dist getDistVS( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD, UInt uiPlane );457 Double calcRdCostVSO( UInt uiBits, Dist uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT );458 424 459 425 private: 460 426 Dist xGetDistVSOMode4( Int iStartPosX, Int iStartPosY, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD ); 461 427 462 #endif // H HI_VSO428 #endif // H_3D_VSO 463 429 464 430 };// END CLASS DEFINITION TComRdCost
Note: See TracChangeset for help on using the changeset viewer.