[5] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
[56] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[56] | 6 | * Copyright (c) 2010-2012, ITU/ISO/IEC |
---|
[5] | 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
[56] | 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
[5] | 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
| 33 | |
---|
[2] | 34 | /** \file TComRdCost.h |
---|
| 35 | \brief RD cost computation classes (header) |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #ifndef __TCOMRDCOST__ |
---|
| 39 | #define __TCOMRDCOST__ |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | #include "CommonDef.h" |
---|
| 43 | #include "TComPattern.h" |
---|
| 44 | #include "TComMv.h" |
---|
[56] | 45 | |
---|
| 46 | #include "TComRdCost.h" |
---|
| 47 | #include "TComSlice.h" |
---|
| 48 | #include "TComRdCostWeightPrediction.h" |
---|
[2] | 49 | #include "../TLibRenderer/TRenModel.h" |
---|
| 50 | |
---|
[56] | 51 | //! \ingroup TLibCommon |
---|
| 52 | //! \{ |
---|
| 53 | |
---|
| 54 | #define FIX203 1 |
---|
| 55 | |
---|
[2] | 56 | class DistParam; |
---|
| 57 | class TComPattern; |
---|
[56] | 58 | class TComRdCost; |
---|
[2] | 59 | |
---|
| 60 | // ==================================================================================================================== |
---|
| 61 | // Type definition |
---|
| 62 | // ==================================================================================================================== |
---|
| 63 | |
---|
| 64 | // for function pointer |
---|
| 65 | typedef UInt (*FpDistFunc) (DistParam*); |
---|
| 66 | |
---|
[56] | 67 | #if HHI_VSO |
---|
[2] | 68 | typedef Dist (TComRdCost::*FpDistFuncVSO) ( Int, Int, Pel*, Int, Pel*, Int, UInt, UInt, Bool ); |
---|
| 69 | #endif |
---|
| 70 | // ==================================================================================================================== |
---|
| 71 | // Class definition |
---|
| 72 | // ==================================================================================================================== |
---|
| 73 | |
---|
| 74 | /// distortion parameter class |
---|
| 75 | class DistParam |
---|
| 76 | { |
---|
| 77 | public: |
---|
| 78 | Pel* pOrg; |
---|
| 79 | Pel* pCur; |
---|
| 80 | Int iStrideOrg; |
---|
| 81 | Int iStrideCur; |
---|
[100] | 82 | #if SAIT_VSO_EST_A0033 |
---|
| 83 | Pel* pVirRec; |
---|
| 84 | Pel* pVirOrg; |
---|
| 85 | Int iStrideVir; |
---|
| 86 | #endif |
---|
[2] | 87 | Int iRows; |
---|
| 88 | Int iCols; |
---|
| 89 | Int iStep; |
---|
[189] | 90 | #if LGE_ILLUCOMP_B0045 |
---|
| 91 | Bool bUseIC; |
---|
| 92 | #endif |
---|
[2] | 93 | FpDistFunc DistFunc; |
---|
[56] | 94 | |
---|
[5] | 95 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 96 | Pel* pUsed; |
---|
| 97 | Int iStrideUsed; |
---|
| 98 | #endif |
---|
[56] | 99 | Bool bApplyWeight; // whether weithed prediction is used or not |
---|
| 100 | wpScalingParam *wpCur; // weithed prediction scaling parameters for current ref |
---|
| 101 | UInt uiComp; // uiComp = 0 (luma Y), 1 (chroma U), 2 (chroma V) |
---|
[2] | 102 | |
---|
[56] | 103 | #if NS_HAD |
---|
| 104 | Bool bUseNSHAD; |
---|
[2] | 105 | #endif |
---|
| 106 | |
---|
| 107 | // (vertical) subsampling shift (for reducing complexity) |
---|
| 108 | // - 0 = no subsampling, 1 = even rows, 2 = every 4th, etc. |
---|
| 109 | Int iSubShift; |
---|
[56] | 110 | |
---|
[2] | 111 | DistParam() |
---|
| 112 | { |
---|
| 113 | pOrg = NULL; |
---|
| 114 | pCur = NULL; |
---|
[100] | 115 | #if SAIT_VSO_EST_A0033 |
---|
| 116 | pVirRec = NULL; |
---|
| 117 | pVirOrg = NULL;; |
---|
| 118 | iStrideVir = 0; |
---|
| 119 | #endif |
---|
[2] | 120 | iStrideOrg = 0; |
---|
| 121 | iStrideCur = 0; |
---|
| 122 | iRows = 0; |
---|
| 123 | iCols = 0; |
---|
| 124 | iStep = 1; |
---|
| 125 | DistFunc = NULL; |
---|
| 126 | iSubShift = 0; |
---|
[5] | 127 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 128 | pUsed = 0; |
---|
| 129 | iStrideUsed = 0; |
---|
| 130 | #endif |
---|
[56] | 131 | #if NS_HAD |
---|
| 132 | bUseNSHAD = false; |
---|
| 133 | #endif |
---|
[2] | 134 | } |
---|
| 135 | }; |
---|
| 136 | |
---|
| 137 | /// RD cost computation class |
---|
| 138 | class TComRdCost |
---|
| 139 | : public TComRdCostWeightPrediction |
---|
| 140 | { |
---|
| 141 | private: |
---|
| 142 | // for distortion |
---|
| 143 | Int m_iBlkWidth; |
---|
| 144 | Int m_iBlkHeight; |
---|
[56] | 145 | |
---|
| 146 | #if AMP_SAD |
---|
| 147 | FpDistFunc m_afpDistortFunc[64]; // [eDFunc] |
---|
| 148 | #else |
---|
[2] | 149 | FpDistFunc m_afpDistortFunc[33]; // [eDFunc] |
---|
[56] | 150 | #endif |
---|
| 151 | |
---|
| 152 | #if WEIGHTED_CHROMA_DISTORTION |
---|
| 153 | Double m_chromaDistortionWeight; |
---|
[2] | 154 | #endif |
---|
| 155 | Double m_dLambda; |
---|
| 156 | Double m_sqrtLambda; |
---|
| 157 | UInt m_uiLambdaMotionSAD; |
---|
| 158 | UInt m_uiLambdaMotionSSE; |
---|
| 159 | Double m_dFrameLambda; |
---|
[100] | 160 | #if SAIT_VSO_EST_A0033 |
---|
| 161 | static Double m_dDisparityCoeff; |
---|
| 162 | #endif |
---|
[56] | 163 | |
---|
[5] | 164 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
[2] | 165 | Double m_dLambdaScale ; |
---|
| 166 | #endif |
---|
| 167 | // for motion cost |
---|
[56] | 168 | #if FIX203 |
---|
| 169 | TComMv m_mvPredictor; |
---|
| 170 | #else |
---|
[2] | 171 | UInt* m_puiComponentCostOriginP; |
---|
| 172 | UInt* m_puiComponentCost; |
---|
| 173 | UInt* m_puiVerCost; |
---|
| 174 | UInt* m_puiHorCost; |
---|
[56] | 175 | #endif |
---|
[2] | 176 | UInt m_uiCost; |
---|
| 177 | Int m_iCostScale; |
---|
[56] | 178 | #if !FIX203 |
---|
[2] | 179 | Int m_iSearchLimit; |
---|
[56] | 180 | #endif |
---|
| 181 | |
---|
[2] | 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; |
---|
[56] | 193 | |
---|
[2] | 194 | public: |
---|
| 195 | TComRdCost(); |
---|
| 196 | virtual ~TComRdCost(); |
---|
[56] | 197 | |
---|
| 198 | Double calcRdCost ( UInt uiBits, UInt uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); |
---|
[2] | 199 | Double calcRdCost64( UInt64 uiBits, UInt64 uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); |
---|
[56] | 200 | |
---|
| 201 | #if WEIGHTED_CHROMA_DISTORTION |
---|
| 202 | Void setChromaDistortionWeight ( Double chromaDistortionWeight) { m_chromaDistortionWeight = chromaDistortionWeight; }; |
---|
| 203 | #endif |
---|
[2] | 204 | Void setLambda ( Double dLambda ); |
---|
[5] | 205 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 206 | Void setLambdaMVReg ( Double dLambda ); |
---|
[5] | 207 | #endif |
---|
[2] | 208 | Void setFrameLambda ( Double dLambda ) { m_dFrameLambda = dLambda; } |
---|
[56] | 209 | |
---|
[100] | 210 | #if SAIT_VSO_EST_A0033 |
---|
| 211 | Void setDisparityCoeff( Double dDisparityCoeff ) { m_dDisparityCoeff = dDisparityCoeff; } |
---|
| 212 | Double getDisparityCoeff() { return m_dDisparityCoeff; } |
---|
| 213 | #endif |
---|
| 214 | |
---|
[5] | 215 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
[2] | 216 | Void setLambdaScale ( Double dLambdaScale) { m_dLambdaScale = dLambdaScale; } |
---|
| 217 | Double getLambdaScale ( ) { return m_dLambdaScale ; } |
---|
| 218 | #endif |
---|
| 219 | Double getSqrtLambda () { return m_sqrtLambda; } |
---|
[56] | 220 | |
---|
[2] | 221 | // Distortion Functions |
---|
| 222 | Void init(); |
---|
[56] | 223 | |
---|
[2] | 224 | Void setDistParam( UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc, DistParam& rcDistParam ); |
---|
| 225 | Void setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, DistParam& rcDistParam ); |
---|
[56] | 226 | #if NS_HAD |
---|
| 227 | 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 | #else |
---|
[2] | 230 | 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 |
---|
[56] | 233 | |
---|
[2] | 234 | UInt calcHAD ( Pel* pi0, Int iStride0, Pel* pi1, Int iStride1, Int iWidth, Int iHeight ); |
---|
[56] | 235 | |
---|
[2] | 236 | // for motion cost |
---|
[56] | 237 | #if !FIX203 |
---|
[2] | 238 | Void initRateDistortionModel( Int iSubPelSearchLimit ); |
---|
| 239 | Void xUninit(); |
---|
[56] | 240 | #endif |
---|
[2] | 241 | UInt xGetComponentBits( Int iVal ); |
---|
[81] | 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 ); |
---|
[100] | 246 | |
---|
[81] | 247 | } |
---|
[2] | 248 | Void setPredictor( TComMv& rcMv ) |
---|
| 249 | { |
---|
[56] | 250 | #if FIX203 |
---|
| 251 | m_mvPredictor = rcMv; |
---|
| 252 | #else |
---|
[2] | 253 | m_puiHorCost = m_puiComponentCost - rcMv.getHor(); |
---|
| 254 | m_puiVerCost = m_puiComponentCost - rcMv.getVer(); |
---|
[56] | 255 | #endif |
---|
[2] | 256 | } |
---|
| 257 | Void setCostScale( Int iCostScale ) { m_iCostScale = iCostScale; } |
---|
| 258 | __inline UInt getCost( Int x, Int y ) |
---|
| 259 | { |
---|
[56] | 260 | #if FIX203 |
---|
| 261 | return m_uiCost * getBits(x, y) >> 16; |
---|
| 262 | #else |
---|
[2] | 263 | return (( m_uiCost * (m_puiHorCost[ x * (1<<m_iCostScale) ] + m_puiVerCost[ y * (1<<m_iCostScale) ]) ) >> 16); |
---|
[56] | 264 | #endif |
---|
[2] | 265 | } |
---|
| 266 | UInt getCost( UInt b ) { return ( m_uiCost * b ) >> 16; } |
---|
[56] | 267 | UInt getBits( Int x, Int y ) |
---|
| 268 | { |
---|
| 269 | #if FIX203 |
---|
| 270 | return xGetComponentBits((x << m_iCostScale) - m_mvPredictor.getHor()) |
---|
| 271 | + xGetComponentBits((y << m_iCostScale) - m_mvPredictor.getVer()); |
---|
| 272 | #else |
---|
| 273 | return m_puiHorCost[ x * (1<<m_iCostScale)] + m_puiVerCost[ y * (1<<m_iCostScale) ]; |
---|
| 274 | #endif |
---|
| 275 | } |
---|
[2] | 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 | else |
---|
| 287 | { |
---|
| 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 | { |
---|
[81] | 298 | #if FIX203 |
---|
| 299 | return m_uiLambdaMVReg * getBits(x, y) >> 16; |
---|
| 300 | #else |
---|
[2] | 301 | return ( ( m_uiLambdaMVReg * ( m_puiHorRegCost[ x * ( 1 << m_iCostScale ) ] + m_puiVerRegCost[ y * ( 1 << m_iCostScale ) ] ) ) >> 16 ); |
---|
[81] | 302 | #endif |
---|
[2] | 303 | } |
---|
[56] | 304 | |
---|
[2] | 305 | private: |
---|
[56] | 306 | |
---|
[189] | 307 | #if LGE_ILLUCOMP_B0045 |
---|
| 308 | static UInt xGetSADic ( DistParam* pcDtParam ); |
---|
| 309 | static UInt xGetSAD4ic ( DistParam* pcDtParam ); |
---|
| 310 | static UInt xGetSAD8ic ( DistParam* pcDtParam ); |
---|
| 311 | static UInt xGetSAD16ic ( DistParam* pcDtParam ); |
---|
| 312 | static UInt xGetSAD32ic ( DistParam* pcDtParam ); |
---|
| 313 | static UInt xGetSAD64ic ( DistParam* pcDtParam ); |
---|
| 314 | static UInt xGetSAD16Nic ( DistParam* pcDtParam ); |
---|
| 315 | #endif |
---|
[2] | 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 ); |
---|
[56] | 323 | |
---|
[2] | 324 | static UInt xGetSAD ( DistParam* pcDtParam ); |
---|
| 325 | static UInt xGetSAD4 ( DistParam* pcDtParam ); |
---|
| 326 | static UInt xGetSAD8 ( DistParam* pcDtParam ); |
---|
| 327 | static UInt xGetSAD16 ( DistParam* pcDtParam ); |
---|
| 328 | static UInt xGetSAD32 ( DistParam* pcDtParam ); |
---|
| 329 | static UInt xGetSAD64 ( DistParam* pcDtParam ); |
---|
| 330 | static UInt xGetSAD16N ( DistParam* pcDtParam ); |
---|
[56] | 331 | |
---|
[100] | 332 | #if SAIT_VSO_EST_A0033 |
---|
| 333 | static UInt xGetVSD ( DistParam* pcDtParam ); |
---|
| 334 | static UInt xGetVSD4 ( DistParam* pcDtParam ); |
---|
| 335 | static UInt xGetVSD8 ( DistParam* pcDtParam ); |
---|
| 336 | static UInt xGetVSD16 ( DistParam* pcDtParam ); |
---|
| 337 | static UInt xGetVSD32 ( DistParam* pcDtParam ); |
---|
| 338 | static UInt xGetVSD64 ( DistParam* pcDtParam ); |
---|
| 339 | static UInt xGetVSD16N ( DistParam* pcDtParam ); |
---|
| 340 | #endif |
---|
| 341 | |
---|
[56] | 342 | #if AMP_SAD |
---|
[189] | 343 | #if LGE_ILLUCOMP_B0045 |
---|
| 344 | static UInt xGetSAD12ic ( DistParam* pcDtParam ); |
---|
| 345 | static UInt xGetSAD24ic ( DistParam* pcDtParam ); |
---|
| 346 | static UInt xGetSAD48ic ( DistParam* pcDtParam ); |
---|
| 347 | #endif |
---|
[56] | 348 | static UInt xGetSAD12 ( DistParam* pcDtParam ); |
---|
| 349 | static UInt xGetSAD24 ( DistParam* pcDtParam ); |
---|
| 350 | static UInt xGetSAD48 ( DistParam* pcDtParam ); |
---|
[189] | 351 | #endif |
---|
[2] | 352 | |
---|
[189] | 353 | #if LGE_ILLUCOMP_B0045 |
---|
| 354 | static UInt xGetHADsic ( DistParam* pcDtParam ); |
---|
[56] | 355 | #endif |
---|
[2] | 356 | static UInt xGetHADs4 ( DistParam* pcDtParam ); |
---|
| 357 | static UInt xGetHADs8 ( DistParam* pcDtParam ); |
---|
| 358 | static UInt xGetHADs ( DistParam* pcDtParam ); |
---|
[189] | 359 | |
---|
[2] | 360 | static UInt xCalcHADs2x2 ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); |
---|
| 361 | static UInt xCalcHADs4x4 ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); |
---|
| 362 | static UInt xCalcHADs8x8 ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); |
---|
[56] | 363 | #if NS_HAD |
---|
| 364 | static UInt xCalcHADs16x4 ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); |
---|
| 365 | static UInt xCalcHADs4x16 ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); |
---|
[2] | 366 | #endif |
---|
[56] | 367 | |
---|
[2] | 368 | public: |
---|
[5] | 369 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 370 | UInt getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, Pel* piUsed, Int iUsedStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc = DF_SSE ); |
---|
| 371 | #endif |
---|
[56] | 372 | #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 |
---|
[2] | 375 | UInt getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc = DF_SSE ); |
---|
[56] | 376 | #endif |
---|
| 377 | |
---|
[100] | 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 ); |
---|
| 380 | static UInt getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride, Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y ); |
---|
| 381 | #endif |
---|
| 382 | |
---|
[5] | 383 | #if HHI_VSO |
---|
[2] | 384 | private: |
---|
| 385 | Double m_dLambdaVSO; |
---|
| 386 | Double m_dSqrtLambdaVSO; |
---|
| 387 | UInt m_uiLambdaMotionSADVSO; |
---|
| 388 | UInt m_uiLambdaMotionSSEVSO; |
---|
| 389 | Double m_dFrameLambdaVSO; |
---|
| 390 | |
---|
[5] | 391 | #if HHI_VSO_DIST_INT |
---|
[2] | 392 | Bool m_bAllowNegDist; |
---|
| 393 | #endif |
---|
[100] | 394 | #if SAIT_VSO_EST_A0033 |
---|
| 395 | TComPicYuv * m_pcVideoRecPicYuv; |
---|
| 396 | TComPicYuv * m_pcDepthPicYuv; |
---|
| 397 | Bool m_bUseEstimatedVSD; |
---|
| 398 | #endif |
---|
[115] | 399 | #if LGE_WVSO_A0119 |
---|
[116] | 400 | Int m_iDWeight; |
---|
| 401 | Int m_iVSOWeight; |
---|
[115] | 402 | Int m_iVSDWeight; |
---|
[120] | 403 | Bool m_bUseWVSO; |
---|
[115] | 404 | #endif |
---|
[2] | 405 | |
---|
| 406 | Bool m_bUseVSO; |
---|
| 407 | Bool m_bUseLambdaScaleVSO; |
---|
| 408 | UInt m_uiVSOMode; |
---|
| 409 | |
---|
[56] | 410 | FpDistFuncVSO m_fpDistortFuncVSO; |
---|
[2] | 411 | TRenModel* m_pcRenModel; |
---|
| 412 | public: |
---|
| 413 | |
---|
| 414 | Void setRenModel ( TRenModel* pcRenModel ) { m_pcRenModel = pcRenModel; } |
---|
| 415 | Void setRenModelData ( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piData, Int iStride, Int iBlkWidth, Int iBlkHeight ); |
---|
| 416 | Void setLambdaVSO ( Double dLambda ); |
---|
| 417 | Void setFrameLambdaVSO ( Double dLambda ) { m_dFrameLambdaVSO = dLambda; }; |
---|
| 418 | |
---|
| 419 | |
---|
| 420 | Void setUseVSO ( Bool bIn ) { m_bUseVSO = bIn; }; |
---|
| 421 | Bool getUseVSO ( ) { return m_bUseVSO;}; |
---|
[100] | 422 | #if SAIT_VSO_EST_A0033 |
---|
| 423 | Bool getUseEstimatedVSD( ) { return m_bUseEstimatedVSD; }; |
---|
| 424 | Void setUseEstimatedVSD( Bool bIn ) { m_bUseEstimatedVSD = bIn; }; |
---|
[2] | 425 | |
---|
[100] | 426 | TComPicYuv* getVideoRecPicYuv () { return m_pcVideoRecPicYuv; }; |
---|
| 427 | Void setVideoRecPicYuv ( TComPicYuv* pcVideoRecPicYuv ) { m_pcVideoRecPicYuv = pcVideoRecPicYuv; }; |
---|
| 428 | TComPicYuv* getDepthPicYuv () { return m_pcDepthPicYuv; }; |
---|
| 429 | Void setDepthPicYuv ( TComPicYuv* pcDepthPicYuv ) { m_pcDepthPicYuv = pcDepthPicYuv; }; |
---|
| 430 | #endif |
---|
| 431 | |
---|
[2] | 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; } |
---|
[115] | 438 | #if LGE_WVSO_A0119 |
---|
[120] | 439 | Void setUseWVSO ( Bool bIn ) { m_bUseWVSO = bIn; }; |
---|
| 440 | Bool getUseWVSO ( ) { return m_bUseWVSO;}; |
---|
[116] | 441 | Void setDWeight ( Int iDWeight ) { m_iDWeight = iDWeight; }; |
---|
| 442 | Int getDWeight () { return m_iDWeight; }; |
---|
| 443 | Void setVSOWeight ( Int iVSOWeight ) { m_iVSOWeight = iVSOWeight; }; |
---|
| 444 | Int getVSOWeight () { return m_iVSOWeight; }; |
---|
| 445 | Void setVSDWeight ( Int iVSDWeight ) { m_iVSDWeight = iVSDWeight; }; |
---|
| 446 | Int getVSDWeight () { return m_iVSDWeight; }; |
---|
[115] | 447 | #endif |
---|
[5] | 448 | #if HHI_VSO_DIST_INT |
---|
[2] | 449 | Void setAllowNegDist ( Bool bAllowNegDist ); |
---|
| 450 | #endif |
---|
| 451 | |
---|
| 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 | |
---|
| 459 | private: |
---|
| 460 | Dist xGetDistVSOMode4( Int iStartPosX, Int iStartPosY, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD ); |
---|
| 461 | |
---|
[5] | 462 | #endif // HHI_VSO |
---|
[2] | 463 | |
---|
| 464 | };// END CLASS DEFINITION TComRdCost |
---|
| 465 | |
---|
[56] | 466 | //! \} |
---|
[2] | 467 | |
---|
| 468 | #endif // __TCOMRDCOST__ |
---|