Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncSearch.h
- Timestamp:
- 13 Aug 2015, 17:38:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibEncoder/TEncSearch.h
r1196 r1313 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 35 35 \brief encoder search class (header) 36 36 */ 37 38 37 #ifndef __TENCSEARCH__ 39 38 #define __TENCSEARCH__ … … 46 45 #include "TLibCommon/TComTrQuant.h" 47 46 #include "TLibCommon/TComPic.h" 47 #include "TLibCommon/TComRectangle.h" 48 48 #include "TEncEntropy.h" 49 49 #include "TEncSbac.h" … … 58 58 // Class definition 59 59 // ==================================================================================================================== 60 61 static const UInt MAX_NUM_REF_LIST_ADAPT_SR=2; 62 static const UInt MAX_IDX_ADAPT_SR=33; 63 static const UInt NUM_MV_PREDICTORS=3; 60 64 61 65 /// encoder search class … … 63 67 { 64 68 private: 65 TCoeff** m_ppcQTTempCoeffY; 66 TCoeff** m_ppcQTTempCoeffCb; 67 TCoeff** m_ppcQTTempCoeffCr; 68 TCoeff* m_pcQTTempCoeffY; 69 TCoeff* m_pcQTTempCoeffCb; 70 TCoeff* m_pcQTTempCoeffCr; 69 TCoeff** m_ppcQTTempCoeff[MAX_NUM_COMPONENT /* 0->Y, 1->Cb, 2->Cr*/]; 70 TCoeff* m_pcQTTempCoeff[MAX_NUM_COMPONENT]; 71 71 #if ADAPTIVE_QP_SELECTION 72 Int** m_ppcQTTempArlCoeffY; 73 Int** m_ppcQTTempArlCoeffCb; 74 Int** m_ppcQTTempArlCoeffCr; 75 Int* m_pcQTTempArlCoeffY; 76 Int* m_pcQTTempArlCoeffCb; 77 Int* m_pcQTTempArlCoeffCr; 72 TCoeff** m_ppcQTTempArlCoeff[MAX_NUM_COMPONENT]; 73 TCoeff* m_pcQTTempArlCoeff[MAX_NUM_COMPONENT]; 78 74 #endif 79 75 UChar* m_puhQTTempTrIdx; 80 UChar* m_puhQTTempCbf[ 3];81 76 UChar* m_puhQTTempCbf[MAX_NUM_COMPONENT]; 77 82 78 TComYuv* m_pcQTTempTComYuv; 83 79 TComYuv m_tmpYuvPred; // To be used in xGetInterPredictionError() to avoid constant memory allocation/deallocation 84 Pel* m_pSharedPredTransformSkip[3]; 85 TCoeff* m_pcQTTempTUCoeffY;86 TCoeff* m_pcQTTempTUCoeffCb;87 TCoeff* m_pcQTTempTUCoeff Cr;88 UChar* m_puhQTTempTransformSkipFlag[ 3];80 81 Char* m_phQTTempCrossComponentPredictionAlpha[MAX_NUM_COMPONENT]; 82 Pel* m_pSharedPredTransformSkip[MAX_NUM_COMPONENT]; 83 TCoeff* m_pcQTTempTUCoeff[MAX_NUM_COMPONENT]; 84 UChar* m_puhQTTempTransformSkipFlag[MAX_NUM_COMPONENT]; 89 85 TComYuv m_pcQTTempTransformSkipTComYuv; 90 86 #if ADAPTIVE_QP_SELECTION 91 Int* m_ppcQTTempTUArlCoeffY; 92 Int* m_ppcQTTempTUArlCoeffCb; 93 Int* m_ppcQTTempTUArlCoeffCr; 94 #endif 87 TCoeff* m_ppcQTTempTUArlCoeff[MAX_NUM_COMPONENT]; 88 #endif 89 95 90 protected: 96 91 // interface to option 97 92 TEncCfg* m_pcEncCfg; 98 93 99 94 // interface to classes 100 95 TComTrQuant* m_pcTrQuant; 101 96 TComRdCost* m_pcRdCost; 102 97 TEncEntropy* m_pcEntropyCoder; 103 98 104 99 // ME parameters 105 100 Int m_iSearchRange; 106 101 Int m_bipredSearchRange; // Search range for bi-prediction 107 102 Int m_iFastSearch; 108 Int m_aaiAdaptSR[2][33]; 103 #if NH_MV 104 Bool m_vertRestriction; 105 #endif 106 Int m_aaiAdaptSR[MAX_NUM_REF_LIST_ADAPT_SR][MAX_IDX_ADAPT_SR]; 109 107 TComMv m_cSrchRngLT; 110 108 TComMv m_cSrchRngRB; 111 TComMv m_acMvPredictors[ 3];112 109 TComMv m_acMvPredictors[NUM_MV_PREDICTORS]; // Left, Above, AboveRight. enum MVP_DIR first NUM_MV_PREDICTORS entries are suitable for accessing. 110 113 111 // RD computation 114 112 TEncSbac*** m_pppcRDSbacCoder; 115 113 TEncSbac* m_pcRDGoOnSbacCoder; 116 114 DistParam m_cDistParam; 117 115 118 116 // Misc. 119 117 Pel* m_pTempPel; 120 118 const UInt* m_puiDFilter; 121 Int m_iMaxDeltaQP; 122 123 #if H_3D_VSO // M17 119 120 #if NH_3D_VSO // M17 124 121 TComYuv m_cYuvRecTemp; 125 122 #endif … … 127 124 // UInt m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS]; 128 125 UInt m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS+1]; //th array bounds 129 126 127 TComMv m_integerMv2Nx2N[NUM_REF_PIC_LIST_01][MAX_NUM_REF]; 128 129 Bool m_isInitialized; 130 130 public: 131 131 TEncSearch(); 132 132 virtual ~TEncSearch(); 133 134 Void init( 133 134 Void init(TEncCfg* pcEncCfg, 135 135 TComTrQuant* pcTrQuant, 136 136 Int iSearchRange, 137 137 Int bipredSearchRange, 138 138 Int iFastSearch, 139 Int iMaxDeltaQP, 139 const UInt maxCUWidth, 140 const UInt maxCUHeight, 141 const UInt maxTotalCUDepth, 140 142 TEncEntropy* pcEntropyCoder, 141 143 TComRdCost* pcRdCost, 142 144 TEncSbac*** pppcRDSbacCoder, 143 145 TEncSbac* pcRDGoOnSbacCoder ); 144 146 147 Void destroy(); 148 145 149 protected: 146 150 147 151 /// sub-function for motion vector refinement used in fractional-pel accuracy 148 UInt xPatternRefinement( TComPattern* pcPatternKey, 149 TComMv baseRefMv, 150 Int iFrac, TComMv& rcMvFrac ); 151 152 Distortion xPatternRefinement( TComPattern* pcPatternKey, 153 TComMv baseRefMv, 154 Int iFrac, TComMv& rcMvFrac, Bool bAllowUseOfHadamard 155 ); 156 152 157 typedef struct 153 158 { 154 Pel* piRefY;155 Int iYStride;156 Int iBestX;157 Int iBestY;158 UInt uiBestRound;159 UInt uiBestDistance;160 UIntuiBestSad;161 UChar ucPointNr;159 Pel* piRefY; 160 Int iYStride; 161 Int iBestX; 162 Int iBestY; 163 UInt uiBestRound; 164 UInt uiBestDistance; 165 Distortion uiBestSad; 166 UChar ucPointNr; 162 167 } IntTZSearchStruct; 163 168 164 169 // sub-functions for ME 165 170 __inline Void xTZSearchHelp ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance ); … … 167 172 __inline Void xTZ8PointSquareSearch ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist ); 168 173 __inline Void xTZ8PointDiamondSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist ); 169 170 Void xGetInterPredictionError( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, UInt& ruiSAD, Bool Hadamard );174 175 Void xGetInterPredictionError( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, Distortion& ruiSAD, Bool Hadamard ); 171 176 172 177 public: 173 Void preestChromaPredMode ( TComDataCU* pcCU, 174 TComYuv* pcOrgYuv, 175 TComYuv* pcPredYuv ); 176 Void estIntraPredQT ( TComDataCU* pcCU, 177 TComYuv* pcOrgYuv, 178 TComYuv* pcPredYuv, 179 TComYuv* pcResiYuv, 178 Void estIntraPredLumaQT ( TComDataCU* pcCU, 179 TComYuv* pcOrgYuv, 180 TComYuv* pcPredYuv, 181 TComYuv* pcResiYuv, 180 182 TComYuv* pcRecoYuv, 181 UInt& ruiDistC,182 Bool bLumaOnly183 #if H_3D_DIM183 Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE] 184 DEBUG_STRING_FN_DECLARE(sDebug) 185 #if NH_3D_ENC_DEPTH 184 186 , Bool bOnlyIVP 185 187 #endif 186 188 ); 187 Void estIntraPredChromaQT ( TComDataCU* pcCU, 188 TComYuv* pcOrgYuv, 189 TComYuv* pcPredYuv, 190 TComYuv* pcResiYuv, 189 190 Void estIntraPredChromaQT ( TComDataCU* pcCU, 191 TComYuv* pcOrgYuv, 192 TComYuv* pcPredYuv, 193 TComYuv* pcResiYuv, 191 194 TComYuv* pcRecoYuv, 192 UInt uiPreCalcDistC ); 193 #if H_3D 195 Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE] 196 DEBUG_STRING_FN_DECLARE(sDebug)); 197 #if NH_3D_DIS 194 198 Void estIntraPredDIS ( TComDataCU* pcCU, 195 199 TComYuv* pcOrgYuv, … … 200 204 Bool bLumaOnly ); 201 205 #endif 206 202 207 /// encoder estimation - inter prediction (non-skip) 203 208 Void predInterSearch ( TComDataCU* pcCU, 204 209 TComYuv* pcOrgYuv, 205 TComYuv*& rpcPredYuv, 206 TComYuv*& rpcResiYuv, 207 TComYuv*& rpcRecoYuv, 208 #if H_3D_FAST_TEXTURE_ENCODING 210 TComYuv* pcPredYuv, 211 TComYuv* pcResiYuv, 212 TComYuv* pcRecoYuv 213 DEBUG_STRING_FN_DECLARE(sDebug), 214 #if NH_3D_FAST_TEXTURE_ENCODING 209 215 Bool bFMD, 210 216 #endif … … 214 220 #endif 215 221 ); 216 222 217 223 /// encode residual and compute rd-cost for inter mode 218 224 Void encodeResAndCalcRdInterCU( TComDataCU* pcCU, 219 225 TComYuv* pcYuvOrg, 220 226 TComYuv* pcYuvPred, 221 TComYuv*& rpcYuvResi, 222 TComYuv*& rpcYuvResiBest, 223 TComYuv*& rpcYuvRec, 224 Bool bSkipRes ); 225 #if H_3D_INTER_SDC 227 TComYuv* pcYuvResi, 228 TComYuv* pcYuvResiBest, 229 TComYuv* pcYuvRec, 230 Bool bSkipResidual 231 DEBUG_STRING_FN_DECLARE(sDebug) ); 232 #if NH_3D_SDC_INTER 226 233 Void encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU, 227 TComYuv* pcOrg, 228 TComYuv* pcPred, 229 TComYuv* pcResi, 230 TComYuv* pcRec, 231 Int uiOffset, 232 const UInt uiDepth ); 233 #endif 234 TComYuv* pcOrg, 235 TComYuv* pcPred, 236 TComYuv* pcResi, 237 TComYuv* pcRec, 238 Int uiOffset, 239 const UInt uiDepth ); 240 #endif 241 234 242 /// set ME search range 235 Void setAdaptiveSearchRange ( Int iDir, Int iRefIdx, Int iSearchRange) { m_aaiAdaptSR[iDir][iRefIdx] = iSearchRange; }236 237 Void xEncPCM (TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piOrg, Pel* piPCM, Pel* piPred, Pel* piResi, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType eText);238 Void IPCMSearch (TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv* & rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*&rpcRecoYuv );243 Void setAdaptiveSearchRange ( Int iDir, Int iRefIdx, Int iSearchRange) { assert(iDir < MAX_NUM_REF_LIST_ADAPT_SR && iRefIdx<Int(MAX_IDX_ADAPT_SR)); m_aaiAdaptSR[iDir][iRefIdx] = iSearchRange; } 244 245 Void xEncPCM (TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piOrg, Pel* piPCM, Pel* piPred, Pel* piResi, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, const ComponentID compID ); 246 Void IPCMSearch (TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv* rpcPredYuv, TComYuv* rpcResiYuv, TComYuv* rpcRecoYuv ); 239 247 protected: 240 248 241 249 // ------------------------------------------------------------------------------------------------------------------- 242 250 // Intra search 243 251 // ------------------------------------------------------------------------------------------------------------------- 244 245 Void xEncSubdivCbfQT ( TComDataCU* pcCU, 246 UInt uiTrDepth, 247 UInt uiAbsPartIdx, 252 253 Void xEncSubdivCbfQT ( TComTU &rTu, 248 254 Bool bLuma, 249 255 Bool bChroma ); 250 256 251 Void xEncCoeffQT ( TComDataCU* pcCU, 252 UInt uiTrDepth, 253 UInt uiAbsPartIdx, 254 TextType eTextType, 257 Void xEncCoeffQT ( TComTU &rTu, 258 ComponentID component, 255 259 Bool bRealCoeff ); 256 260 Void xEncIntraHeader ( TComDataCU* pcCU, … … 259 263 Bool bLuma, 260 264 Bool bChroma ); 261 UInt xGetIntraBitsQT ( TComDataCU* pcCU, 262 UInt uiTrDepth, 263 UInt uiAbsPartIdx, 265 UInt xGetIntraBitsQT ( TComTU &rTu, 264 266 Bool bLuma, 265 267 Bool bChroma, 266 268 Bool bRealCoeff ); 267 UInt xGetIntraBitsQTChroma ( TComDataCU* pcCU, 268 UInt uiTrDepth, 269 UInt uiAbsPartIdx, 270 UInt uiChromaId, 269 270 UInt xGetIntraBitsQTChroma ( TComTU &rTu, 271 ComponentID compID, 271 272 Bool bRealCoeff ); 272 273 Void xIntraCodingLumaBlk ( TComDataCU* pcCU, 274 UInt uiTrDepth, 275 UInt uiAbsPartIdx, 276 TComYuv* pcOrgYuv, 277 TComYuv* pcPredYuv, 278 TComYuv* pcResiYuv, 279 #if H_3D_VSO 273 274 Void xIntraCodingTUBlock ( TComYuv* pcOrgYuv, 275 TComYuv* pcPredYuv, 276 TComYuv* pcResiYuv, 277 Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE], 278 const Bool checkCrossCPrediction, 279 #if NH_3D_VSO 280 280 Dist& ruiDist, 281 281 #else 282 UInt& ruiDist, 283 #endif 284 Int default0Save1Load2 = 0 285 #if H_3D_DIM_ENC 286 , Bool zeroResi = false 287 #endif 288 ); 289 Void xIntraCodingChromaBlk ( TComDataCU* pcCU, 290 UInt uiTrDepth, 291 UInt uiAbsPartIdx, 292 TComYuv* pcOrgYuv, 293 TComYuv* pcPredYuv, 294 TComYuv* pcResiYuv, 295 UInt& ruiDist, 296 UInt uiChromaId, 297 Int default0Save1Load2 = 0 ); 298 299 Void xRecurIntraCodingQT ( TComDataCU* pcCU, 300 UInt uiTrDepth, 301 UInt uiAbsPartIdx, 302 Bool bLumaOnly, 303 TComYuv* pcOrgYuv, 304 TComYuv* pcPredYuv, 305 TComYuv* pcResiYuv, 306 #if H_3D_VSO 282 Distortion& ruiDist, 283 #endif 284 const ComponentID compID, 285 TComTU &rTu 286 DEBUG_STRING_FN_DECLARE(sTest) 287 ,Int default0Save1Load2 = 0 288 #if NH_3D_ENC_DEPTH 289 , Bool zeroResiFlag = false 290 #endif 291 ); 292 293 Void xRecurIntraCodingLumaQT ( TComYuv* pcOrgYuv, 294 TComYuv* pcPredYuv, 295 TComYuv* pcResiYuv, 296 Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE], 297 #if NH_3D_VSO 307 298 Dist& ruiDistY, 308 299 #else 309 UInt& ruiDistY, 310 #endif 311 UInt& ruiDistC, 300 Distortion& ruiDistY, 301 #endif 312 302 #if HHI_RQT_INTRA_SPEEDUP 313 Bool bCheckFirst, 314 #endif 315 Double& dRDCost 316 #if H_3D_DIM_ENC 317 , Bool zeroResi = false 318 #endif 319 ); 320 321 Void xSetIntraResultQT ( TComDataCU* pcCU, 322 UInt uiTrDepth, 323 UInt uiAbsPartIdx, 324 Bool bLumaOnly, 325 TComYuv* pcRecoYuv ); 326 327 Void xRecurIntraChromaCodingQT ( TComDataCU* pcCU, 328 UInt uiTrDepth, 329 UInt uiAbsPartIdx, 330 TComYuv* pcOrgYuv, 331 TComYuv* pcPredYuv, 332 TComYuv* pcResiYuv, 333 UInt& ruiDist ); 334 Void xSetIntraResultChromaQT ( TComDataCU* pcCU, 335 UInt uiTrDepth, 336 UInt uiAbsPartIdx, 337 TComYuv* pcRecoYuv ); 338 339 Void xStoreIntraResultQT ( TComDataCU* pcCU, 340 UInt uiTrDepth, 341 UInt uiAbsPartIdx, 342 Bool bLumaOnly ); 343 Void xLoadIntraResultQT ( TComDataCU* pcCU, 344 UInt uiTrDepth, 345 UInt uiAbsPartIdx, 346 Bool bLumaOnly ); 347 Void xStoreIntraResultChromaQT ( TComDataCU* pcCU, 348 UInt uiTrDepth, 349 UInt uiAbsPartIdx, 350 UInt stateU0V1Both2 ); 351 Void xLoadIntraResultChromaQT ( TComDataCU* pcCU, 352 UInt uiTrDepth, 353 UInt uiAbsPartIdx, 354 UInt stateU0V1Both2 ); 355 356 #if H_3D 303 Bool bCheckFirst, 304 #endif 305 Double& dRDCost, 306 TComTU &rTu 307 DEBUG_STRING_FN_DECLARE(sDebug) 308 #if NH_3D_ENC_DEPTH 309 , Bool zeroResiFlag = false 310 #endif 311 ); 312 313 Void xSetIntraResultLumaQT ( TComYuv* pcRecoYuv, 314 TComTU &rTu); 315 316 Void xStoreCrossComponentPredictionResult ( Pel *pResiLuma, 317 const Pel *pBestLuma, 318 TComTU &rTu, 319 const Int xOffset, 320 const Int yOffset, 321 const Int strideResi, 322 const Int strideBest ); 323 324 Char xCalcCrossComponentPredictionAlpha ( TComTU &rTu, 325 const ComponentID compID, 326 const Pel* piResiL, 327 const Pel* piResiC, 328 const Int width, 329 const Int height, 330 const Int strideL, 331 const Int strideC ); 332 333 Void xRecurIntraChromaCodingQT ( TComYuv* pcOrgYuv, 334 TComYuv* pcPredYuv, 335 TComYuv* pcResiYuv, 336 Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE], 337 #if NH_3D_VSO 338 Dist& ruiDist, 339 #else 340 Distortion& ruiDist, 341 #endif 342 TComTU &rTu 343 DEBUG_STRING_FN_DECLARE(sDebug)); 344 345 Void xSetIntraResultChromaQT ( TComYuv* pcRecoYuv, TComTU &rTu); 346 347 Void xStoreIntraResultQT ( const ComponentID compID, TComTU &rTu); 348 Void xLoadIntraResultQT ( const ComponentID compID, TComTU &rTu); 349 #if NH_3D_DIS 357 350 Void xIntraCodingDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, UInt uiPredMode ); 358 351 #endif 359 #if H_3D_DIM 352 360 353 // ------------------------------------------------------------------------------------------------------------------- 361 354 // Depth intra search 362 355 // ------------------------------------------------------------------------------------------------------------------- 363 Void xCalcBiSegDCs ( Pel* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& valDC1, Pel& valDC2 ); 364 #if H_3D_DIM_DMM 356 #if NH_3D_DMM 357 Void xCalcBiSegDCs ( Pel* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& valDC1, Pel& valDC2, Pel defaultVal, Bool subSamp = false ); 365 358 Void xSearchDmmDeltaDCs ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piOrig, Pel* piPredic, UInt uiStride, Bool* biSegPattern, Int patternStride, UInt uiWidth, UInt uiHeight, Pel& rDeltaDC1, Pel& rDeltaDC2 ); 366 359 Void xSearchDmm1Wedge ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx ); 367 360 #endif 368 #if H_3D_DIM_SDC361 #if NH_3D_SDC_INTRA 369 362 Void xIntraCodingSDC ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi ); 370 #endif 371 #endif 363 Void xCalcConstantSDC ( Pel* ptrSrc, UInt srcStride, UInt uiSize, Pel& valDC ); 364 #endif 365 372 366 373 367 // ------------------------------------------------------------------------------------------------------------------- 374 368 // Inter search (AMP) 375 369 // ------------------------------------------------------------------------------------------------------------------- 376 370 377 371 Void xEstimateMvPredAMVP ( TComDataCU* pcCU, 378 372 TComYuv* pcOrgYuv, … … 382 376 TComMv& rcMvPred, 383 377 Bool bFilled = false 384 , UInt* puiDistBiP = NULL 385 #if ZERO_MVD_EST 386 , UInt* puiDist = NULL 387 #endif 378 , Distortion* puiDistBiP = NULL 388 379 ); 389 380 390 381 Void xCheckBestMVP ( TComDataCU* pcCU, 391 382 RefPicList eRefPicList, … … 394 385 Int& riMVPIdx, 395 386 UInt& ruiBits, 396 UInt& ruiCost ); 397 398 UInt xGetTemplateCost ( TComDataCU* pcCU, 399 UInt uiPartIdx, 387 Distortion& ruiCost ); 388 389 Distortion xGetTemplateCost ( TComDataCU* pcCU, 400 390 UInt uiPartAddr, 401 391 TComYuv* pcOrgYuv, … … 408 398 Int iSizeX, 409 399 Int iSizeY 410 #if ZERO_MVD_EST411 , UInt& ruiDist412 #endif413 400 ); 414 415 401 402 416 403 Void xCopyAMVPInfo ( AMVPInfo* pSrc, AMVPInfo* pDst ); 417 404 UInt xGetMvpIdxBits ( Int iIdx, Int iNum ); 418 405 Void xGetBlkBits ( PartSize eCUMode, Bool bPSlice, Int iPartIdx, UInt uiLastMode, UInt uiBlkBit[3]); 419 420 Void xMergeEstimation ( TComDataCU* pcCU, 421 TComYuv* pcYuvOrg, 422 Int iPartIdx, 423 UInt& uiInterDir, 424 TComMvField* pacMvField, 425 UInt& uiMergeIndex, 426 UInt& ruiCost 427 , TComMvField* cMvFieldNeighbours, 428 UChar* uhInterDirNeighbours 429 #if H_3D_VSP 406 407 Void xMergeEstimation ( TComDataCU* pcCU, 408 TComYuv* pcYuvOrg, 409 Int iPartIdx, 410 UInt& uiInterDir, 411 TComMvField* pacMvField, 412 UInt& uiMergeIndex, 413 Distortion& ruiCost, 414 TComMvField* cMvFieldNeighbours, 415 UChar* uhInterDirNeighbours, 416 Int& numValidMergeCand 417 #if NH_3D_VSP 430 418 , Int* vspFlag 431 419 #endif 432 #if H_3D_SPIVMP420 #if NH_3D_SPIVMP 433 421 , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP 434 422 #endif 435 , Int& numValidMergeCand436 423 ); 437 424 438 425 Void xRestrictBipredMergeCand ( TComDataCU* pcCU, 439 426 UInt puIdx, 440 TComMvField* mvFieldNeighbours, 441 UChar* interDirNeighbours, 427 TComMvField* mvFieldNeighbours, 428 UChar* interDirNeighbours, 442 429 Int numValidMergeCand ); 443 430 431 444 432 // ------------------------------------------------------------------------------------------------------------------- 445 433 // motion estimation 446 434 // ------------------------------------------------------------------------------------------------------------------- 447 448 Void xMotionEstimation ( TComDataCU* pcCU, 449 TComYuv* pcYuvOrg, 450 Int iPartIdx, 451 RefPicList eRefPicList, 452 TComMv* pcMvPred, 453 Int iRefIdxPred, 454 TComMv& rcMv, 455 UInt& ruiBits, 456 UInt& ruiCost, 457 Bool bBi = false ); 458 459 Void xTZSearch ( TComDataCU* pcCU, 460 TComPattern* pcPatternKey, 461 Pel* piRefY, 462 Int iRefStride, 463 TComMv* pcMvSrchRngLT, 464 TComMv* pcMvSrchRngRB, 465 TComMv& rcMv, 466 UInt& ruiSAD ); 467 468 #if H_MV 469 Void xSetSearchRange ( TComDataCU* pcCU, 470 TComMv& cMvPred, 471 Int iSrchRng, 472 TComMv& rcMvSrchRngLT, 473 TComMv& rcMvSrchRngRB, 474 Bool bMv_VRng_Restricted, 475 Int iVerDispSrchRng ); 435 436 Void xMotionEstimation ( TComDataCU* pcCU, 437 TComYuv* pcYuvOrg, 438 Int iPartIdx, 439 RefPicList eRefPicList, 440 TComMv* pcMvPred, 441 Int iRefIdxPred, 442 TComMv& rcMv, 443 UInt& ruiBits, 444 Distortion& ruiCost, 445 Bool bBi = false ); 446 447 Void xTZSearch ( TComDataCU* pcCU, 448 TComPattern* pcPatternKey, 449 Pel* piRefY, 450 Int iRefStride, 451 TComMv* pcMvSrchRngLT, 452 TComMv* pcMvSrchRngRB, 453 TComMv& rcMv, 454 Distortion& ruiSAD, 455 const TComMv *pIntegerMv2Nx2NPred 456 ); 457 458 Void xTZSearchSelective ( TComDataCU* pcCU, 459 TComPattern* pcPatternKey, 460 Pel* piRefY, 461 Int iRefStride, 462 TComMv* pcMvSrchRngLT, 463 TComMv* pcMvSrchRngRB, 464 TComMv& rcMv, 465 Distortion& ruiSAD, 466 const TComMv *pIntegerMv2Nx2NPred 467 ); 468 469 Void xSetSearchRange ( TComDataCU* pcCU, 470 TComMv& cMvPred, 471 Int iSrchRng, 472 TComMv& rcMvSrchRngLT, 473 TComMv& rcMvSrchRngRB ); 474 475 Void xPatternSearchFast ( TComDataCU* pcCU, 476 TComPattern* pcPatternKey, 477 Pel* piRefY, 478 Int iRefStride, 479 TComMv* pcMvSrchRngLT, 480 TComMv* pcMvSrchRngRB, 481 TComMv& rcMv, 482 Distortion& ruiSAD, 483 const TComMv* pIntegerMv2Nx2NPred 484 ); 485 486 Void xPatternSearch ( TComPattern* pcPatternKey, 487 Pel* piRefY, 488 Int iRefStride, 489 TComMv* pcMvSrchRngLT, 490 TComMv* pcMvSrchRngRB, 491 TComMv& rcMv, 492 Distortion& ruiSAD ); 493 494 Void xPatternSearchFracDIF ( 495 Bool bIsLosslessCoded, 496 TComPattern* pcPatternKey, 497 Pel* piRefY, 498 Int iRefStride, 499 TComMv* pcMvInt, 500 TComMv& rcMvHalf, 501 TComMv& rcMvQter, 502 Distortion& ruiCost 503 ); 504 505 Void xExtDIFUpSamplingH( TComPattern* pcPattern ); 506 Void xExtDIFUpSamplingQ( TComPattern* pcPatternKey, TComMv halfPelRef ); 507 508 // ------------------------------------------------------------------------------------------------------------------- 509 // T & Q & Q-1 & T-1 510 // ------------------------------------------------------------------------------------------------------------------- 511 512 Void xEncodeInterResidualQT( const ComponentID compID, TComTU &rTu ); 513 #if NH_3D_VSO // M26 514 Void xEstimateInterResidualQT( TComYuv* pcResi, TComYuv* pcOrg, TComYuv* pcPred, Double &rdCost, UInt &ruiBits, Dist &ruiDist, Dist *puiZeroDist, TComTU &rTu DEBUG_STRING_FN_DECLARE(sDebug) ); 476 515 #else 477 Void xSetSearchRange ( TComDataCU* pcCU, 478 TComMv& cMvPred, 479 Int iSrchRng, 480 TComMv& rcMvSrchRngLT, 481 TComMv& rcMvSrchRngRB ); 482 #endif 483 484 Void xPatternSearchFast ( TComDataCU* pcCU, 485 TComPattern* pcPatternKey, 486 Pel* piRefY, 487 Int iRefStride, 488 TComMv* pcMvSrchRngLT, 489 TComMv* pcMvSrchRngRB, 490 TComMv& rcMv, 491 UInt& ruiSAD ); 492 493 Void xPatternSearch ( TComPattern* pcPatternKey, 494 Pel* piRefY, 495 Int iRefStride, 496 TComMv* pcMvSrchRngLT, 497 TComMv* pcMvSrchRngRB, 498 TComMv& rcMv, 499 UInt& ruiSAD ); 500 501 Void xPatternSearchFracDIF ( TComDataCU* pcCU, 502 TComPattern* pcPatternKey, 503 Pel* piRefY, 504 Int iRefStride, 505 TComMv* pcMvInt, 506 TComMv& rcMvHalf, 507 TComMv& rcMvQter, 508 UInt& ruiCost 509 ,Bool biPred 510 ); 511 512 Void xExtDIFUpSamplingH( TComPattern* pcPattern, Bool biPred ); 513 Void xExtDIFUpSamplingQ( TComPattern* pcPatternKey, TComMv halfPelRef, Bool biPred ); 514 515 // ------------------------------------------------------------------------------------------------------------------- 516 // T & Q & Q-1 & T-1 517 // ------------------------------------------------------------------------------------------------------------------- 518 519 Void xEncodeResidualQT( TComDataCU* pcCU, UInt uiAbsPartIdx, const UInt uiDepth, Bool bSubdivAndCbf, TextType eType ); 520 #if H_3D_VSO // M26 521 Void xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx,TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, Dist &ruiDist, Dist *puiZeroDist ); 522 #else 523 Void xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx,TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, UInt &ruiDist, UInt *puiZeroDist ); 524 #endif 525 Void xSetResidualQTData( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx,UInt absTUPartIdx, TComYuv* pcResi, UInt uiDepth, Bool bSpatial ); 526 527 UInt xModeBitsIntra ( TComDataCU* pcCU, UInt uiMode, UInt uiPU, UInt uiPartOffset, UInt uiDepth, UInt uiInitTrDepth ); 516 Void xEstimateInterResidualQT( TComYuv* pcResi , Double &rdCost, UInt &ruiBits, Distortion &ruiDist, Distortion *puiZeroDist, TComTU &rTu DEBUG_STRING_FN_DECLARE(sDebug) ); 517 #endif 518 Void xSetInterResidualQTData( TComYuv* pcResi, Bool bSpatial, TComTU &rTu ); 519 520 UInt xModeBitsIntra ( TComDataCU* pcCU, UInt uiMode, UInt uiPartOffset, UInt uiDepth, const ChannelType compID ); 528 521 UInt xUpdateCandList( UInt uiMode, Double uiCost, UInt uiFastCandNum, UInt * CandModeList, Double * CandCostList ); 529 522 530 523 // ------------------------------------------------------------------------------------------------------------------- 531 524 // compute symbol bits 532 525 // ------------------------------------------------------------------------------------------------------------------- 533 534 Void xAddSymbolBitsInter ( TComDataCU* pcCU, 535 UInt uiQp, 536 UInt uiTrMode, 537 UInt& ruiBits, 538 TComYuv*& rpcYuvRec, 539 TComYuv* pcYuvPred, 540 TComYuv*& rpcYuvResi ); 541 526 527 Void xAddSymbolBitsInter ( TComDataCU* pcCU, 528 UInt& ruiBits); 529 542 530 Void setWpScalingDistParam( TComDataCU* pcCU, Int iRefIdx, RefPicList eRefPicListCur ); 543 inline Void setDistParamComp( UInt uiComp ) { m_cDistParam.uiComp = uiComp; }544 531 inline Void setDistParamComp( ComponentID compIdx ) { m_cDistParam.compIdx = compIdx; } 532 545 533 };// END CLASS DEFINITION TEncSearch 546 534
Note: See TracChangeset for help on using the changeset viewer.