[313] | 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 |
---|
[1029] | 4 | * granted under this license. |
---|
[313] | 5 | * |
---|
[595] | 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC |
---|
[313] | 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. |
---|
| 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
| 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 | |
---|
| 34 | /** \file TEncSearch.h |
---|
| 35 | \brief encoder search class (header) |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #ifndef __TENCSEARCH__ |
---|
| 39 | #define __TENCSEARCH__ |
---|
| 40 | |
---|
| 41 | // Include files |
---|
| 42 | #include "TLibCommon/TComYuv.h" |
---|
| 43 | #include "TLibCommon/TComMotionInfo.h" |
---|
| 44 | #include "TLibCommon/TComPattern.h" |
---|
| 45 | #include "TLibCommon/TComPrediction.h" |
---|
| 46 | #include "TLibCommon/TComTrQuant.h" |
---|
| 47 | #include "TLibCommon/TComPic.h" |
---|
[1029] | 48 | #include "TLibCommon/TComRectangle.h" |
---|
[313] | 49 | #include "TEncEntropy.h" |
---|
| 50 | #include "TEncSbac.h" |
---|
| 51 | #include "TEncCfg.h" |
---|
| 52 | |
---|
[1029] | 53 | |
---|
[313] | 54 | //! \ingroup TLibEncoder |
---|
| 55 | //! \{ |
---|
| 56 | |
---|
| 57 | class TEncCu; |
---|
| 58 | |
---|
| 59 | // ==================================================================================================================== |
---|
| 60 | // Class definition |
---|
| 61 | // ==================================================================================================================== |
---|
| 62 | |
---|
[1029] | 63 | static const UInt MAX_NUM_REF_LIST_ADAPT_SR=2; |
---|
| 64 | static const UInt MAX_IDX_ADAPT_SR=33; |
---|
| 65 | static const UInt NUM_MV_PREDICTORS=3; |
---|
| 66 | |
---|
[313] | 67 | /// encoder search class |
---|
| 68 | class TEncSearch : public TComPrediction |
---|
| 69 | { |
---|
| 70 | private: |
---|
[1029] | 71 | TCoeff** m_ppcQTTempCoeff[MAX_NUM_COMPONENT /* 0->Y, 1->Cb, 2->Cr*/]; |
---|
| 72 | TCoeff* m_pcQTTempCoeff[MAX_NUM_COMPONENT]; |
---|
[313] | 73 | #if ADAPTIVE_QP_SELECTION |
---|
[1029] | 74 | TCoeff** m_ppcQTTempArlCoeff[MAX_NUM_COMPONENT]; |
---|
| 75 | TCoeff* m_pcQTTempArlCoeff[MAX_NUM_COMPONENT]; |
---|
[313] | 76 | #endif |
---|
| 77 | UChar* m_puhQTTempTrIdx; |
---|
[1029] | 78 | UChar* m_puhQTTempCbf[MAX_NUM_COMPONENT]; |
---|
| 79 | |
---|
[313] | 80 | TComYuv* m_pcQTTempTComYuv; |
---|
| 81 | TComYuv m_tmpYuvPred; // To be used in xGetInterPredictionError() to avoid constant memory allocation/deallocation |
---|
[1029] | 82 | |
---|
| 83 | Char* m_phQTTempCrossComponentPredictionAlpha[MAX_NUM_COMPONENT]; |
---|
| 84 | Pel* m_pSharedPredTransformSkip[MAX_NUM_COMPONENT]; |
---|
| 85 | TCoeff* m_pcQTTempTUCoeff[MAX_NUM_COMPONENT]; |
---|
| 86 | UChar* m_puhQTTempTransformSkipFlag[MAX_NUM_COMPONENT]; |
---|
[313] | 87 | TComYuv m_pcQTTempTransformSkipTComYuv; |
---|
| 88 | #if ADAPTIVE_QP_SELECTION |
---|
[1029] | 89 | TCoeff* m_ppcQTTempTUArlCoeff[MAX_NUM_COMPONENT]; |
---|
[313] | 90 | #endif |
---|
[1029] | 91 | |
---|
[313] | 92 | protected: |
---|
| 93 | // interface to option |
---|
| 94 | TEncCfg* m_pcEncCfg; |
---|
[1029] | 95 | |
---|
[313] | 96 | // interface to classes |
---|
| 97 | TComTrQuant* m_pcTrQuant; |
---|
| 98 | TComRdCost* m_pcRdCost; |
---|
| 99 | TEncEntropy* m_pcEntropyCoder; |
---|
[1029] | 100 | |
---|
[313] | 101 | // ME parameters |
---|
| 102 | Int m_iSearchRange; |
---|
| 103 | Int m_bipredSearchRange; // Search range for bi-prediction |
---|
| 104 | Int m_iFastSearch; |
---|
[1029] | 105 | Int m_aaiAdaptSR[MAX_NUM_REF_LIST_ADAPT_SR][MAX_IDX_ADAPT_SR]; |
---|
[313] | 106 | TComMv m_cSrchRngLT; |
---|
| 107 | TComMv m_cSrchRngRB; |
---|
[1029] | 108 | TComMv m_acMvPredictors[NUM_MV_PREDICTORS]; // Left, Above, AboveRight. enum MVP_DIR first NUM_MV_PREDICTORS entries are suitable for accessing. |
---|
| 109 | |
---|
[313] | 110 | // RD computation |
---|
| 111 | TEncSbac*** m_pppcRDSbacCoder; |
---|
| 112 | TEncSbac* m_pcRDGoOnSbacCoder; |
---|
| 113 | DistParam m_cDistParam; |
---|
[1029] | 114 | |
---|
[313] | 115 | // Misc. |
---|
| 116 | Pel* m_pTempPel; |
---|
| 117 | const UInt* m_puiDFilter; |
---|
| 118 | Int m_iMaxDeltaQP; |
---|
[1029] | 119 | |
---|
[313] | 120 | // AMVP cost computation |
---|
| 121 | // UInt m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS]; |
---|
| 122 | UInt m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS+1]; //th array bounds |
---|
[494] | 123 | |
---|
[1029] | 124 | TComMv m_integerMv2Nx2N[NUM_REF_PIC_LIST_01][MAX_NUM_REF]; |
---|
| 125 | |
---|
[595] | 126 | #if SVC_EXTENSION |
---|
[494] | 127 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
| 128 | Bool m_disableILP; |
---|
| 129 | #endif |
---|
[815] | 130 | #endif //SVC_EXTENSION |
---|
[494] | 131 | |
---|
[313] | 132 | public: |
---|
| 133 | TEncSearch(); |
---|
| 134 | virtual ~TEncSearch(); |
---|
[1029] | 135 | |
---|
[313] | 136 | Void init( TEncCfg* pcEncCfg, |
---|
| 137 | TComTrQuant* pcTrQuant, |
---|
| 138 | Int iSearchRange, |
---|
| 139 | Int bipredSearchRange, |
---|
| 140 | Int iFastSearch, |
---|
| 141 | Int iMaxDeltaQP, |
---|
| 142 | TEncEntropy* pcEntropyCoder, |
---|
| 143 | TComRdCost* pcRdCost, |
---|
| 144 | TEncSbac*** pppcRDSbacCoder, |
---|
| 145 | TEncSbac* pcRDGoOnSbacCoder ); |
---|
[1029] | 146 | |
---|
[313] | 147 | protected: |
---|
[1029] | 148 | |
---|
[313] | 149 | /// sub-function for motion vector refinement used in fractional-pel accuracy |
---|
[1029] | 150 | Distortion xPatternRefinement( TComPattern* pcPatternKey, |
---|
| 151 | TComMv baseRefMv, |
---|
| 152 | Int iFrac, TComMv& rcMvFrac, Bool bAllowUseOfHadamard |
---|
| 153 | ); |
---|
| 154 | |
---|
[313] | 155 | typedef struct |
---|
| 156 | { |
---|
[1029] | 157 | Pel* piRefY; |
---|
| 158 | Int iYStride; |
---|
| 159 | Int iBestX; |
---|
| 160 | Int iBestY; |
---|
| 161 | UInt uiBestRound; |
---|
| 162 | UInt uiBestDistance; |
---|
| 163 | Distortion uiBestSad; |
---|
| 164 | UChar ucPointNr; |
---|
[313] | 165 | } IntTZSearchStruct; |
---|
[1029] | 166 | |
---|
[313] | 167 | // sub-functions for ME |
---|
| 168 | __inline Void xTZSearchHelp ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance ); |
---|
| 169 | __inline Void xTZ2PointSearch ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB ); |
---|
| 170 | __inline Void xTZ8PointSquareSearch ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist ); |
---|
| 171 | __inline Void xTZ8PointDiamondSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist ); |
---|
| 172 | |
---|
[1029] | 173 | Void xGetInterPredictionError( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, Distortion& ruiSAD, Bool Hadamard ); |
---|
| 174 | |
---|
[313] | 175 | public: |
---|
[1029] | 176 | Void preestChromaPredMode ( TComDataCU* pcCU, |
---|
| 177 | TComYuv* pcOrgYuv, |
---|
[313] | 178 | TComYuv* pcPredYuv ); |
---|
[1029] | 179 | |
---|
| 180 | Void estIntraPredQT ( TComDataCU* pcCU, |
---|
| 181 | TComYuv* pcOrgYuv, |
---|
| 182 | TComYuv* pcPredYuv, |
---|
| 183 | TComYuv* pcResiYuv, |
---|
[313] | 184 | TComYuv* pcRecoYuv, |
---|
[1029] | 185 | Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE], |
---|
| 186 | Distortion& ruiDistC, |
---|
| 187 | Bool bLumaOnly |
---|
| 188 | DEBUG_STRING_FN_DECLARE(sDebug)); |
---|
| 189 | |
---|
| 190 | Void estIntraPredChromaQT ( TComDataCU* pcCU, |
---|
| 191 | TComYuv* pcOrgYuv, |
---|
| 192 | TComYuv* pcPredYuv, |
---|
| 193 | TComYuv* pcResiYuv, |
---|
[313] | 194 | TComYuv* pcRecoYuv, |
---|
[1029] | 195 | Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE], |
---|
| 196 | Distortion uiPreCalcDistC |
---|
| 197 | DEBUG_STRING_FN_DECLARE(sDebug)); |
---|
| 198 | |
---|
[313] | 199 | /// encoder estimation - inter prediction (non-skip) |
---|
[815] | 200 | #if SVC_EXTENSION |
---|
| 201 | Bool predInterSearch ( TComDataCU* pcCU, |
---|
| 202 | #else |
---|
[313] | 203 | Void predInterSearch ( TComDataCU* pcCU, |
---|
[815] | 204 | #endif |
---|
[313] | 205 | TComYuv* pcOrgYuv, |
---|
[1029] | 206 | TComYuv* pcPredYuv, |
---|
| 207 | TComYuv* pcResiYuv, |
---|
| 208 | TComYuv* pcRecoYuv |
---|
| 209 | DEBUG_STRING_FN_DECLARE(sDebug), |
---|
[313] | 210 | Bool bUseRes = false |
---|
| 211 | #if AMP_MRG |
---|
| 212 | ,Bool bUseMRG = false |
---|
| 213 | #endif |
---|
| 214 | ); |
---|
[1029] | 215 | |
---|
[313] | 216 | /// encode residual and compute rd-cost for inter mode |
---|
| 217 | Void encodeResAndCalcRdInterCU( TComDataCU* pcCU, |
---|
| 218 | TComYuv* pcYuvOrg, |
---|
| 219 | TComYuv* pcYuvPred, |
---|
[1029] | 220 | TComYuv* pcYuvResi, |
---|
| 221 | TComYuv* pcYuvResiBest, |
---|
| 222 | TComYuv* pcYuvRec, |
---|
| 223 | Bool bSkipRes |
---|
| 224 | DEBUG_STRING_FN_DECLARE(sDebug) ); |
---|
| 225 | |
---|
[313] | 226 | /// set ME search range |
---|
[1029] | 227 | 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; } |
---|
[494] | 228 | |
---|
[1029] | 229 | 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 ); |
---|
| 230 | Void IPCMSearch (TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv* rpcPredYuv, TComYuv* rpcResiYuv, TComYuv* rpcRecoYuv ); |
---|
| 231 | |
---|
[595] | 232 | #if SVC_EXTENSION |
---|
[1029] | 233 | #if ENCODER_FAST_MODE |
---|
[595] | 234 | Bool predInterSearchILRUni ( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, UInt refLayerId ); |
---|
| 235 | #endif |
---|
[494] | 236 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
| 237 | Void setDisableILP(Bool a) {m_disableILP = a;} |
---|
| 238 | #endif |
---|
[595] | 239 | #endif //SVC_EXTENSION |
---|
[494] | 240 | |
---|
[313] | 241 | protected: |
---|
[1029] | 242 | |
---|
[313] | 243 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 244 | // Intra search |
---|
| 245 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 246 | |
---|
| 247 | Void xEncSubdivCbfQT ( TComTU &rTu, |
---|
[313] | 248 | Bool bLuma, |
---|
| 249 | Bool bChroma ); |
---|
| 250 | |
---|
[1029] | 251 | Void xEncCoeffQT ( TComTU &rTu, |
---|
| 252 | ComponentID component, |
---|
[313] | 253 | Bool bRealCoeff ); |
---|
| 254 | Void xEncIntraHeader ( TComDataCU* pcCU, |
---|
| 255 | UInt uiTrDepth, |
---|
| 256 | UInt uiAbsPartIdx, |
---|
| 257 | Bool bLuma, |
---|
| 258 | Bool bChroma ); |
---|
[1029] | 259 | UInt xGetIntraBitsQT ( TComTU &rTu, |
---|
[313] | 260 | Bool bLuma, |
---|
| 261 | Bool bChroma, |
---|
| 262 | Bool bRealCoeff ); |
---|
[1029] | 263 | |
---|
| 264 | UInt xGetIntraBitsQTChroma ( TComTU &rTu, |
---|
| 265 | ComponentID compID, |
---|
[313] | 266 | Bool bRealCoeff ); |
---|
| 267 | |
---|
[1029] | 268 | Void xIntraCodingTUBlock ( TComYuv* pcOrgYuv, |
---|
| 269 | TComYuv* pcPredYuv, |
---|
| 270 | TComYuv* pcResiYuv, |
---|
| 271 | Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE], |
---|
| 272 | const Bool checkCrossCPrediction, |
---|
| 273 | Distortion& ruiDist, |
---|
| 274 | const ComponentID compID, |
---|
| 275 | TComTU &rTu |
---|
| 276 | DEBUG_STRING_FN_DECLARE(sTest) |
---|
| 277 | ,Int default0Save1Load2 = 0 |
---|
| 278 | ); |
---|
| 279 | |
---|
| 280 | Void xRecurIntraCodingQT ( Bool bLumaOnly, |
---|
| 281 | TComYuv* pcOrgYuv, |
---|
| 282 | TComYuv* pcPredYuv, |
---|
| 283 | TComYuv* pcResiYuv, |
---|
| 284 | Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE], |
---|
| 285 | Distortion& ruiDistY, |
---|
| 286 | Distortion& ruiDistC, |
---|
[313] | 287 | #if HHI_RQT_INTRA_SPEEDUP |
---|
| 288 | Bool bCheckFirst, |
---|
| 289 | #endif |
---|
[1029] | 290 | Double& dRDCost, |
---|
| 291 | TComTU &rTu |
---|
| 292 | DEBUG_STRING_FN_DECLARE(sDebug)); |
---|
[313] | 293 | |
---|
[1029] | 294 | Void xSetIntraResultQT ( Bool bLumaOnly, |
---|
| 295 | TComYuv* pcRecoYuv, |
---|
| 296 | TComTU &rTu); |
---|
| 297 | |
---|
| 298 | Void xStoreCrossComponentPredictionResult ( Pel *pResiLuma, |
---|
| 299 | const Pel *pBestLuma, |
---|
| 300 | TComTU &rTu, |
---|
| 301 | const Int xOffset, |
---|
| 302 | const Int yOffset, |
---|
| 303 | const Int strideResi, |
---|
| 304 | const Int strideBest ); |
---|
| 305 | |
---|
| 306 | Char xCalcCrossComponentPredictionAlpha ( TComTU &rTu, |
---|
| 307 | const ComponentID compID, |
---|
| 308 | const Pel* piResiL, |
---|
| 309 | const Pel* piResiC, |
---|
| 310 | const Int width, |
---|
| 311 | const Int height, |
---|
| 312 | const Int strideL, |
---|
| 313 | const Int strideC ); |
---|
| 314 | |
---|
| 315 | Void xRecurIntraChromaCodingQT ( TComYuv* pcOrgYuv, |
---|
| 316 | TComYuv* pcPredYuv, |
---|
| 317 | TComYuv* pcResiYuv, |
---|
| 318 | Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE], |
---|
| 319 | Distortion& ruiDist, |
---|
| 320 | TComTU &rTu |
---|
| 321 | DEBUG_STRING_FN_DECLARE(sDebug)); |
---|
| 322 | |
---|
| 323 | Void xSetIntraResultChromaQT ( TComYuv* pcRecoYuv, TComTU &rTu); |
---|
| 324 | |
---|
| 325 | Void xStoreIntraResultQT ( const ComponentID first, const ComponentID lastIncl, TComTU &rTu); |
---|
| 326 | Void xLoadIntraResultQT ( const ComponentID first, const ComponentID lastIncl, TComTU &rTu); |
---|
| 327 | |
---|
| 328 | |
---|
[313] | 329 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 330 | // Inter search (AMP) |
---|
| 331 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 332 | |
---|
[313] | 333 | Void xEstimateMvPredAMVP ( TComDataCU* pcCU, |
---|
| 334 | TComYuv* pcOrgYuv, |
---|
| 335 | UInt uiPartIdx, |
---|
| 336 | RefPicList eRefPicList, |
---|
| 337 | Int iRefIdx, |
---|
| 338 | TComMv& rcMvPred, |
---|
| 339 | Bool bFilled = false |
---|
[1029] | 340 | , Distortion* puiDistBiP = NULL |
---|
[313] | 341 | ); |
---|
[1029] | 342 | |
---|
[313] | 343 | Void xCheckBestMVP ( TComDataCU* pcCU, |
---|
| 344 | RefPicList eRefPicList, |
---|
| 345 | TComMv cMv, |
---|
| 346 | TComMv& rcMvPred, |
---|
| 347 | Int& riMVPIdx, |
---|
| 348 | UInt& ruiBits, |
---|
[1029] | 349 | Distortion& ruiCost ); |
---|
| 350 | |
---|
| 351 | Distortion xGetTemplateCost ( TComDataCU* pcCU, |
---|
[313] | 352 | UInt uiPartIdx, |
---|
| 353 | UInt uiPartAddr, |
---|
| 354 | TComYuv* pcOrgYuv, |
---|
| 355 | TComYuv* pcTemplateCand, |
---|
| 356 | TComMv cMvCand, |
---|
| 357 | Int iMVPIdx, |
---|
| 358 | Int iMVPNum, |
---|
| 359 | RefPicList eRefPicList, |
---|
| 360 | Int iRefIdx, |
---|
| 361 | Int iSizeX, |
---|
| 362 | Int iSizeY |
---|
| 363 | ); |
---|
[1029] | 364 | |
---|
| 365 | |
---|
[313] | 366 | Void xCopyAMVPInfo ( AMVPInfo* pSrc, AMVPInfo* pDst ); |
---|
| 367 | UInt xGetMvpIdxBits ( Int iIdx, Int iNum ); |
---|
| 368 | Void xGetBlkBits ( PartSize eCUMode, Bool bPSlice, Int iPartIdx, UInt uiLastMode, UInt uiBlkBit[3]); |
---|
[1029] | 369 | |
---|
| 370 | Void xMergeEstimation ( TComDataCU* pcCU, |
---|
| 371 | TComYuv* pcYuvOrg, |
---|
| 372 | Int iPartIdx, |
---|
| 373 | UInt& uiInterDir, |
---|
| 374 | TComMvField* pacMvField, |
---|
| 375 | UInt& uiMergeIndex, |
---|
| 376 | Distortion& ruiCost, |
---|
| 377 | TComMvField* cMvFieldNeighbours, |
---|
| 378 | UChar* uhInterDirNeighbours, |
---|
| 379 | Int& numValidMergeCand |
---|
[313] | 380 | ); |
---|
| 381 | |
---|
| 382 | Void xRestrictBipredMergeCand ( TComDataCU* pcCU, |
---|
| 383 | UInt puIdx, |
---|
[1029] | 384 | TComMvField* mvFieldNeighbours, |
---|
| 385 | UChar* interDirNeighbours, |
---|
[313] | 386 | Int numValidMergeCand ); |
---|
| 387 | |
---|
[1029] | 388 | |
---|
[313] | 389 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 390 | // motion estimation |
---|
| 391 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 392 | |
---|
| 393 | Void xMotionEstimation ( TComDataCU* pcCU, |
---|
| 394 | TComYuv* pcYuvOrg, |
---|
| 395 | Int iPartIdx, |
---|
| 396 | RefPicList eRefPicList, |
---|
| 397 | TComMv* pcMvPred, |
---|
| 398 | Int iRefIdxPred, |
---|
| 399 | TComMv& rcMv, |
---|
| 400 | UInt& ruiBits, |
---|
| 401 | Distortion& ruiCost, |
---|
| 402 | Bool bBi = false ); |
---|
| 403 | |
---|
| 404 | Void xTZSearch ( TComDataCU* pcCU, |
---|
| 405 | TComPattern* pcPatternKey, |
---|
| 406 | Pel* piRefY, |
---|
| 407 | Int iRefStride, |
---|
| 408 | TComMv* pcMvSrchRngLT, |
---|
| 409 | TComMv* pcMvSrchRngRB, |
---|
| 410 | TComMv& rcMv, |
---|
| 411 | Distortion& ruiSAD, |
---|
| 412 | const TComMv *pIntegerMv2Nx2NPred |
---|
| 413 | ); |
---|
| 414 | |
---|
| 415 | Void xTZSearchSelective ( TComDataCU* pcCU, |
---|
| 416 | TComPattern* pcPatternKey, |
---|
| 417 | Pel* piRefY, |
---|
| 418 | Int iRefStride, |
---|
| 419 | TComMv* pcMvSrchRngLT, |
---|
| 420 | TComMv* pcMvSrchRngRB, |
---|
| 421 | TComMv& rcMv, |
---|
| 422 | Distortion& ruiSAD, |
---|
| 423 | const TComMv *pIntegerMv2Nx2NPred |
---|
| 424 | ); |
---|
| 425 | |
---|
| 426 | Void xSetSearchRange ( TComDataCU* pcCU, |
---|
| 427 | TComMv& cMvPred, |
---|
| 428 | Int iSrchRng, |
---|
| 429 | TComMv& rcMvSrchRngLT, |
---|
| 430 | TComMv& rcMvSrchRngRB ); |
---|
| 431 | |
---|
| 432 | Void xPatternSearchFast ( TComDataCU* pcCU, |
---|
| 433 | TComPattern* pcPatternKey, |
---|
| 434 | Pel* piRefY, |
---|
| 435 | Int iRefStride, |
---|
| 436 | TComMv* pcMvSrchRngLT, |
---|
| 437 | TComMv* pcMvSrchRngRB, |
---|
| 438 | TComMv& rcMv, |
---|
| 439 | Distortion& ruiSAD, |
---|
| 440 | const TComMv* pIntegerMv2Nx2NPred |
---|
| 441 | ); |
---|
| 442 | |
---|
| 443 | Void xPatternSearch ( TComPattern* pcPatternKey, |
---|
| 444 | Pel* piRefY, |
---|
| 445 | Int iRefStride, |
---|
| 446 | TComMv* pcMvSrchRngLT, |
---|
| 447 | TComMv* pcMvSrchRngRB, |
---|
| 448 | TComMv& rcMv, |
---|
| 449 | Distortion& ruiSAD ); |
---|
| 450 | |
---|
| 451 | Void xPatternSearchFracDIF ( |
---|
| 452 | Bool bIsLosslessCoded, |
---|
| 453 | TComPattern* pcPatternKey, |
---|
| 454 | Pel* piRefY, |
---|
| 455 | Int iRefStride, |
---|
| 456 | TComMv* pcMvInt, |
---|
| 457 | TComMv& rcMvHalf, |
---|
| 458 | TComMv& rcMvQter, |
---|
| 459 | Distortion& ruiCost, |
---|
| 460 | Bool biPred |
---|
[313] | 461 | ); |
---|
[1029] | 462 | |
---|
[313] | 463 | Void xExtDIFUpSamplingH( TComPattern* pcPattern, Bool biPred ); |
---|
| 464 | Void xExtDIFUpSamplingQ( TComPattern* pcPatternKey, TComMv halfPelRef, Bool biPred ); |
---|
[1029] | 465 | |
---|
[313] | 466 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 467 | // T & Q & Q-1 & T-1 |
---|
| 468 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 469 | |
---|
| 470 | |
---|
| 471 | Void xEncodeResidualQT( const ComponentID compID, TComTU &rTu ); |
---|
| 472 | Void xEstimateResidualQT( TComYuv* pcResi, Double &rdCost, UInt &ruiBits, Distortion &ruiDist, Distortion *puiZeroDist, TComTU &rTu DEBUG_STRING_FN_DECLARE(sDebug) ); |
---|
| 473 | Void xSetResidualQTData( TComYuv* pcResi, Bool bSpatial, TComTU &rTu ); |
---|
| 474 | |
---|
| 475 | UInt xModeBitsIntra ( TComDataCU* pcCU, UInt uiMode, UInt uiPartOffset, UInt uiDepth, UInt uiInitTrDepth, const ChannelType compID ); |
---|
[313] | 476 | UInt xUpdateCandList( UInt uiMode, Double uiCost, UInt uiFastCandNum, UInt * CandModeList, Double * CandCostList ); |
---|
[1029] | 477 | |
---|
[313] | 478 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 479 | // compute symbol bits |
---|
| 480 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 481 | |
---|
| 482 | Void xAddSymbolBitsInter ( TComDataCU* pcCU, |
---|
[313] | 483 | UInt uiQp, |
---|
| 484 | UInt uiTrMode, |
---|
[1029] | 485 | UInt& ruiBits); |
---|
| 486 | |
---|
[313] | 487 | Void setWpScalingDistParam( TComDataCU* pcCU, Int iRefIdx, RefPicList eRefPicListCur ); |
---|
[1029] | 488 | inline Void setDistParamComp( ComponentID compIdx ) { m_cDistParam.compIdx = compIdx; } |
---|
[595] | 489 | |
---|
[1029] | 490 | #if SVC_EXTENSION && REF_IDX_ME_ZEROMV |
---|
| 491 | Void xPatternSearchFracDIFMv0 ( TComPattern* pcPatternKey, |
---|
[595] | 492 | Pel* piRefY, |
---|
| 493 | Int iRefStride, |
---|
| 494 | TComMv* pcMvInt, |
---|
| 495 | TComMv& rcMvHalf, |
---|
| 496 | TComMv& rcMvQter, |
---|
[1029] | 497 | UInt& ruiCost ); |
---|
[595] | 498 | #endif //SVC_EXTENSION |
---|
| 499 | |
---|
[313] | 500 | };// END CLASS DEFINITION TEncSearch |
---|
| 501 | |
---|
| 502 | //! \} |
---|
| 503 | |
---|
| 504 | #endif // __TENCSEARCH__ |
---|