| 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 |
|---|
| 4 | * granted under this license. |
|---|
| 5 | * |
|---|
| 6 | * Copyright (c) 2010-2012, ITU/ISO/IEC |
|---|
| 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" |
|---|
| 48 | #include "TEncEntropy.h" |
|---|
| 49 | #include "TEncSbac.h" |
|---|
| 50 | #include "TEncCfg.h" |
|---|
| 51 | |
|---|
| 52 | //! \ingroup TLibEncoder |
|---|
| 53 | //! \{ |
|---|
| 54 | |
|---|
| 55 | class TEncCu; |
|---|
| 56 | |
|---|
| 57 | // ==================================================================================================================== |
|---|
| 58 | // Class definition |
|---|
| 59 | // ==================================================================================================================== |
|---|
| 60 | |
|---|
| 61 | /// encoder search class |
|---|
| 62 | class TEncSearch : public TComPrediction |
|---|
| 63 | { |
|---|
| 64 | 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; |
|---|
| 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; |
|---|
| 78 | #endif |
|---|
| 79 | UChar* m_puhQTTempTrIdx; |
|---|
| 80 | UChar* m_puhQTTempCbf[3]; |
|---|
| 81 | |
|---|
| 82 | TComYuv* m_pcQTTempTComYuv; |
|---|
| 83 | 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_pcQTTempTUCoeffCr; |
|---|
| 88 | UChar* m_puhQTTempTransformSkipFlag[3]; |
|---|
| 89 | TComYuv m_pcQTTempTransformSkipTComYuv; |
|---|
| 90 | #if ADAPTIVE_QP_SELECTION |
|---|
| 91 | Int* m_ppcQTTempTUArlCoeffY; |
|---|
| 92 | Int* m_ppcQTTempTUArlCoeffCb; |
|---|
| 93 | Int* m_ppcQTTempTUArlCoeffCr; |
|---|
| 94 | #endif |
|---|
| 95 | protected: |
|---|
| 96 | // interface to option |
|---|
| 97 | TEncCfg* m_pcEncCfg; |
|---|
| 98 | |
|---|
| 99 | #if SVC_EXTENSION |
|---|
| 100 | TEncTop** m_ppcTEncTop; |
|---|
| 101 | #endif |
|---|
| 102 | #if INTRA_BL |
|---|
| 103 | TComPicYuv* m_pcPicYuvRecBase; ///< reconstructed base layer |
|---|
| 104 | #endif |
|---|
| 105 | |
|---|
| 106 | // interface to classes |
|---|
| 107 | TComTrQuant* m_pcTrQuant; |
|---|
| 108 | TComRdCost* m_pcRdCost; |
|---|
| 109 | TEncEntropy* m_pcEntropyCoder; |
|---|
| 110 | |
|---|
| 111 | // ME parameters |
|---|
| 112 | Int m_iSearchRange; |
|---|
| 113 | Int m_bipredSearchRange; // Search range for bi-prediction |
|---|
| 114 | Int m_iFastSearch; |
|---|
| 115 | Int m_aaiAdaptSR[2][33]; |
|---|
| 116 | TComMv m_cSrchRngLT; |
|---|
| 117 | TComMv m_cSrchRngRB; |
|---|
| 118 | TComMv m_acMvPredictors[3]; |
|---|
| 119 | |
|---|
| 120 | // RD computation |
|---|
| 121 | TEncSbac*** m_pppcRDSbacCoder; |
|---|
| 122 | TEncSbac* m_pcRDGoOnSbacCoder; |
|---|
| 123 | Bool m_bUseSBACRD; |
|---|
| 124 | DistParam m_cDistParam; |
|---|
| 125 | |
|---|
| 126 | // Misc. |
|---|
| 127 | Pel* m_pTempPel; |
|---|
| 128 | const UInt* m_puiDFilter; |
|---|
| 129 | Int m_iMaxDeltaQP; |
|---|
| 130 | |
|---|
| 131 | // AMVP cost computation |
|---|
| 132 | // UInt m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS]; |
|---|
| 133 | UInt m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS+1]; //th array bounds |
|---|
| 134 | |
|---|
| 135 | public: |
|---|
| 136 | TEncSearch(); |
|---|
| 137 | virtual ~TEncSearch(); |
|---|
| 138 | |
|---|
| 139 | Void init( TEncCfg* pcEncCfg, |
|---|
| 140 | TComTrQuant* pcTrQuant, |
|---|
| 141 | Int iSearchRange, |
|---|
| 142 | Int bipredSearchRange, |
|---|
| 143 | Int iFastSearch, |
|---|
| 144 | Int iMaxDeltaQP, |
|---|
| 145 | TEncEntropy* pcEntropyCoder, |
|---|
| 146 | TComRdCost* pcRdCost, |
|---|
| 147 | TEncSbac*** pppcRDSbacCoder, |
|---|
| 148 | TEncSbac* pcRDGoOnSbacCoder ); |
|---|
| 149 | |
|---|
| 150 | protected: |
|---|
| 151 | |
|---|
| 152 | /// sub-function for motion vector refinement used in fractional-pel accuracy |
|---|
| 153 | UInt xPatternRefinement( TComPattern* pcPatternKey, |
|---|
| 154 | TComMv baseRefMv, |
|---|
| 155 | Int iFrac, TComMv& rcMvFrac ); |
|---|
| 156 | |
|---|
| 157 | typedef struct |
|---|
| 158 | { |
|---|
| 159 | Pel* piRefY; |
|---|
| 160 | Int iYStride; |
|---|
| 161 | Int iBestX; |
|---|
| 162 | Int iBestY; |
|---|
| 163 | UInt uiBestRound; |
|---|
| 164 | UInt uiBestDistance; |
|---|
| 165 | UInt uiBestSad; |
|---|
| 166 | UChar ucPointNr; |
|---|
| 167 | } IntTZSearchStruct; |
|---|
| 168 | |
|---|
| 169 | // sub-functions for ME |
|---|
| 170 | __inline Void xTZSearchHelp ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance ); |
|---|
| 171 | __inline Void xTZ2PointSearch ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB ); |
|---|
| 172 | __inline Void xTZ8PointSquareSearch ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist ); |
|---|
| 173 | __inline Void xTZ8PointDiamondSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist ); |
|---|
| 174 | |
|---|
| 175 | Void xGetInterPredictionError( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, UInt& ruiSAD, Bool Hadamard ); |
|---|
| 176 | |
|---|
| 177 | public: |
|---|
| 178 | Void preestChromaPredMode ( TComDataCU* pcCU, |
|---|
| 179 | TComYuv* pcOrgYuv, |
|---|
| 180 | TComYuv* pcPredYuv ); |
|---|
| 181 | Void estIntraPredQT ( TComDataCU* pcCU, |
|---|
| 182 | TComYuv* pcOrgYuv, |
|---|
| 183 | TComYuv* pcPredYuv, |
|---|
| 184 | TComYuv* pcResiYuv, |
|---|
| 185 | TComYuv* pcRecoYuv, |
|---|
| 186 | UInt& ruiDistC, |
|---|
| 187 | Bool bLumaOnly ); |
|---|
| 188 | Void estIntraPredChromaQT ( TComDataCU* pcCU, |
|---|
| 189 | TComYuv* pcOrgYuv, |
|---|
| 190 | TComYuv* pcPredYuv, |
|---|
| 191 | TComYuv* pcResiYuv, |
|---|
| 192 | TComYuv* pcRecoYuv, |
|---|
| 193 | UInt uiPreCalcDistC ); |
|---|
| 194 | |
|---|
| 195 | #if INTRA_BL |
|---|
| 196 | Void setBaseRecPic ( TComPicYuv* pcPicYuvRecBase ) { m_pcPicYuvRecBase = pcPicYuvRecBase; } |
|---|
| 197 | TComPicYuv* getBaseRecPic () { return m_pcPicYuvRecBase; } |
|---|
| 198 | Void estIntraBLPredQT ( TComDataCU* pcCU, |
|---|
| 199 | TComYuv* pcOrgYuv, |
|---|
| 200 | TComYuv* pcPredYuv, |
|---|
| 201 | TComYuv* pcResiYuv, |
|---|
| 202 | TComYuv* pcRecoYuv ); |
|---|
| 203 | #endif |
|---|
| 204 | |
|---|
| 205 | /// encoder estimation - inter prediction (non-skip) |
|---|
| 206 | Void predInterSearch ( TComDataCU* pcCU, |
|---|
| 207 | TComYuv* pcOrgYuv, |
|---|
| 208 | TComYuv*& rpcPredYuv, |
|---|
| 209 | TComYuv*& rpcResiYuv, |
|---|
| 210 | TComYuv*& rpcRecoYuv, |
|---|
| 211 | Bool bUseRes = false |
|---|
| 212 | #if AMP_MRG |
|---|
| 213 | ,Bool bUseMRG = false |
|---|
| 214 | #endif |
|---|
| 215 | ); |
|---|
| 216 | |
|---|
| 217 | /// encode residual and compute rd-cost for inter mode |
|---|
| 218 | Void encodeResAndCalcRdInterCU( TComDataCU* pcCU, |
|---|
| 219 | TComYuv* pcYuvOrg, |
|---|
| 220 | TComYuv* pcYuvPred, |
|---|
| 221 | TComYuv*& rpcYuvResi, |
|---|
| 222 | TComYuv*& rpcYuvResiBest, |
|---|
| 223 | TComYuv*& rpcYuvRec, |
|---|
| 224 | Bool bSkipRes ); |
|---|
| 225 | |
|---|
| 226 | /// set ME search range |
|---|
| 227 | Void setAdaptiveSearchRange ( Int iDir, Int iRefIdx, Int iSearchRange) { m_aaiAdaptSR[iDir][iRefIdx] = iSearchRange; } |
|---|
| 228 | |
|---|
| 229 | Void xEncPCM (TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piOrg, Pel* piPCM, Pel* piPred, Pel* piResi, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType eText); |
|---|
| 230 | Void IPCMSearch (TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv ); |
|---|
| 231 | protected: |
|---|
| 232 | |
|---|
| 233 | // ------------------------------------------------------------------------------------------------------------------- |
|---|
| 234 | // Intra search |
|---|
| 235 | // ------------------------------------------------------------------------------------------------------------------- |
|---|
| 236 | |
|---|
| 237 | Void xEncSubdivCbfQT ( TComDataCU* pcCU, |
|---|
| 238 | UInt uiTrDepth, |
|---|
| 239 | UInt uiAbsPartIdx, |
|---|
| 240 | Bool bLuma, |
|---|
| 241 | Bool bChroma ); |
|---|
| 242 | |
|---|
| 243 | Void xEncCoeffQT ( TComDataCU* pcCU, |
|---|
| 244 | UInt uiTrDepth, |
|---|
| 245 | UInt uiAbsPartIdx, |
|---|
| 246 | TextType eTextType, |
|---|
| 247 | Bool bRealCoeff ); |
|---|
| 248 | Void xEncIntraHeader ( TComDataCU* pcCU, |
|---|
| 249 | UInt uiTrDepth, |
|---|
| 250 | UInt uiAbsPartIdx, |
|---|
| 251 | Bool bLuma, |
|---|
| 252 | Bool bChroma ); |
|---|
| 253 | UInt xGetIntraBitsQT ( TComDataCU* pcCU, |
|---|
| 254 | UInt uiTrDepth, |
|---|
| 255 | UInt uiAbsPartIdx, |
|---|
| 256 | Bool bLuma, |
|---|
| 257 | Bool bChroma, |
|---|
| 258 | Bool bRealCoeff ); |
|---|
| 259 | UInt xGetIntraBitsQTChroma ( TComDataCU* pcCU, |
|---|
| 260 | UInt uiTrDepth, |
|---|
| 261 | UInt uiAbsPartIdx, |
|---|
| 262 | UInt uiChromaId, |
|---|
| 263 | Bool bRealCoeff ); |
|---|
| 264 | |
|---|
| 265 | Void xIntraCodingLumaBlk ( TComDataCU* pcCU, |
|---|
| 266 | UInt uiTrDepth, |
|---|
| 267 | UInt uiAbsPartIdx, |
|---|
| 268 | TComYuv* pcOrgYuv, |
|---|
| 269 | TComYuv* pcPredYuv, |
|---|
| 270 | TComYuv* pcResiYuv, |
|---|
| 271 | UInt& ruiDist, |
|---|
| 272 | Int default0Save1Load2 = 0); |
|---|
| 273 | Void xIntraCodingChromaBlk ( TComDataCU* pcCU, |
|---|
| 274 | UInt uiTrDepth, |
|---|
| 275 | UInt uiAbsPartIdx, |
|---|
| 276 | TComYuv* pcOrgYuv, |
|---|
| 277 | TComYuv* pcPredYuv, |
|---|
| 278 | TComYuv* pcResiYuv, |
|---|
| 279 | UInt& ruiDist, |
|---|
| 280 | UInt uiChromaId, |
|---|
| 281 | Int default0Save1Load2 = 0 ); |
|---|
| 282 | |
|---|
| 283 | Void xRecurIntraCodingQT ( TComDataCU* pcCU, |
|---|
| 284 | UInt uiTrDepth, |
|---|
| 285 | UInt uiAbsPartIdx, |
|---|
| 286 | Bool bLumaOnly, |
|---|
| 287 | TComYuv* pcOrgYuv, |
|---|
| 288 | TComYuv* pcPredYuv, |
|---|
| 289 | TComYuv* pcResiYuv, |
|---|
| 290 | UInt& ruiDistY, |
|---|
| 291 | UInt& ruiDistC, |
|---|
| 292 | #if HHI_RQT_INTRA_SPEEDUP |
|---|
| 293 | Bool bCheckFirst, |
|---|
| 294 | #endif |
|---|
| 295 | Double& dRDCost ); |
|---|
| 296 | |
|---|
| 297 | Void xSetIntraResultQT ( TComDataCU* pcCU, |
|---|
| 298 | UInt uiTrDepth, |
|---|
| 299 | UInt uiAbsPartIdx, |
|---|
| 300 | Bool bLumaOnly, |
|---|
| 301 | TComYuv* pcRecoYuv ); |
|---|
| 302 | |
|---|
| 303 | Void xRecurIntraChromaCodingQT ( TComDataCU* pcCU, |
|---|
| 304 | UInt uiTrDepth, |
|---|
| 305 | UInt uiAbsPartIdx, |
|---|
| 306 | TComYuv* pcOrgYuv, |
|---|
| 307 | TComYuv* pcPredYuv, |
|---|
| 308 | TComYuv* pcResiYuv, |
|---|
| 309 | UInt& ruiDist ); |
|---|
| 310 | Void xSetIntraResultChromaQT ( TComDataCU* pcCU, |
|---|
| 311 | UInt uiTrDepth, |
|---|
| 312 | UInt uiAbsPartIdx, |
|---|
| 313 | TComYuv* pcRecoYuv ); |
|---|
| 314 | |
|---|
| 315 | Void xStoreIntraResultQT ( TComDataCU* pcCU, |
|---|
| 316 | UInt uiTrDepth, |
|---|
| 317 | UInt uiAbsPartIdx, |
|---|
| 318 | Bool bLumaOnly ); |
|---|
| 319 | Void xLoadIntraResultQT ( TComDataCU* pcCU, |
|---|
| 320 | UInt uiTrDepth, |
|---|
| 321 | UInt uiAbsPartIdx, |
|---|
| 322 | Bool bLumaOnly ); |
|---|
| 323 | Void xStoreIntraResultChromaQT ( TComDataCU* pcCU, |
|---|
| 324 | UInt uiTrDepth, |
|---|
| 325 | UInt uiAbsPartIdx, |
|---|
| 326 | UInt stateU0V1Both2 ); |
|---|
| 327 | Void xLoadIntraResultChromaQT ( TComDataCU* pcCU, |
|---|
| 328 | UInt uiTrDepth, |
|---|
| 329 | UInt uiAbsPartIdx, |
|---|
| 330 | UInt stateU0V1Both2 ); |
|---|
| 331 | |
|---|
| 332 | // ------------------------------------------------------------------------------------------------------------------- |
|---|
| 333 | // Inter search (AMP) |
|---|
| 334 | // ------------------------------------------------------------------------------------------------------------------- |
|---|
| 335 | |
|---|
| 336 | Void xEstimateMvPredAMVP ( TComDataCU* pcCU, |
|---|
| 337 | TComYuv* pcOrgYuv, |
|---|
| 338 | UInt uiPartIdx, |
|---|
| 339 | RefPicList eRefPicList, |
|---|
| 340 | Int iRefIdx, |
|---|
| 341 | TComMv& rcMvPred, |
|---|
| 342 | Bool bFilled = false |
|---|
| 343 | , UInt* puiDistBiP = NULL |
|---|
| 344 | #if ZERO_MVD_EST |
|---|
| 345 | , UInt* puiDist = NULL |
|---|
| 346 | #endif |
|---|
| 347 | ); |
|---|
| 348 | |
|---|
| 349 | Void xCheckBestMVP ( TComDataCU* pcCU, |
|---|
| 350 | RefPicList eRefPicList, |
|---|
| 351 | TComMv cMv, |
|---|
| 352 | TComMv& rcMvPred, |
|---|
| 353 | Int& riMVPIdx, |
|---|
| 354 | UInt& ruiBits, |
|---|
| 355 | UInt& ruiCost ); |
|---|
| 356 | |
|---|
| 357 | UInt xGetTemplateCost ( TComDataCU* pcCU, |
|---|
| 358 | UInt uiPartIdx, |
|---|
| 359 | UInt uiPartAddr, |
|---|
| 360 | TComYuv* pcOrgYuv, |
|---|
| 361 | TComYuv* pcTemplateCand, |
|---|
| 362 | TComMv cMvCand, |
|---|
| 363 | Int iMVPIdx, |
|---|
| 364 | Int iMVPNum, |
|---|
| 365 | RefPicList eRefPicList, |
|---|
| 366 | Int iRefIdx, |
|---|
| 367 | Int iSizeX, |
|---|
| 368 | Int iSizeY |
|---|
| 369 | #if ZERO_MVD_EST |
|---|
| 370 | , UInt& ruiDist |
|---|
| 371 | #endif |
|---|
| 372 | ); |
|---|
| 373 | |
|---|
| 374 | |
|---|
| 375 | Void xCopyAMVPInfo ( AMVPInfo* pSrc, AMVPInfo* pDst ); |
|---|
| 376 | UInt xGetMvpIdxBits ( Int iIdx, Int iNum ); |
|---|
| 377 | Void xGetBlkBits ( PartSize eCUMode, Bool bPSlice, Int iPartIdx, UInt uiLastMode, UInt uiBlkBit[3]); |
|---|
| 378 | |
|---|
| 379 | Void xMergeEstimation ( TComDataCU* pcCU, |
|---|
| 380 | TComYuv* pcYuvOrg, |
|---|
| 381 | Int iPartIdx, |
|---|
| 382 | UInt& uiInterDir, |
|---|
| 383 | TComMvField* pacMvField, |
|---|
| 384 | UInt& uiMergeIndex, |
|---|
| 385 | UInt& ruiCost |
|---|
| 386 | , TComMvField* cMvFieldNeighbours, |
|---|
| 387 | UChar* uhInterDirNeighbours, |
|---|
| 388 | Int& numValidMergeCand |
|---|
| 389 | ); |
|---|
| 390 | |
|---|
| 391 | Void xRestrictBipredMergeCand ( TComDataCU* pcCU, |
|---|
| 392 | UInt puIdx, |
|---|
| 393 | TComMvField* mvFieldNeighbours, |
|---|
| 394 | UChar* interDirNeighbours, |
|---|
| 395 | Int numValidMergeCand ); |
|---|
| 396 | |
|---|
| 397 | // ------------------------------------------------------------------------------------------------------------------- |
|---|
| 398 | // motion estimation |
|---|
| 399 | // ------------------------------------------------------------------------------------------------------------------- |
|---|
| 400 | |
|---|
| 401 | Void xMotionEstimation ( TComDataCU* pcCU, |
|---|
| 402 | TComYuv* pcYuvOrg, |
|---|
| 403 | Int iPartIdx, |
|---|
| 404 | RefPicList eRefPicList, |
|---|
| 405 | TComMv* pcMvPred, |
|---|
| 406 | Int iRefIdxPred, |
|---|
| 407 | TComMv& rcMv, |
|---|
| 408 | UInt& ruiBits, |
|---|
| 409 | UInt& ruiCost, |
|---|
| 410 | Bool bBi = false ); |
|---|
| 411 | |
|---|
| 412 | Void xTZSearch ( TComDataCU* pcCU, |
|---|
| 413 | TComPattern* pcPatternKey, |
|---|
| 414 | Pel* piRefY, |
|---|
| 415 | Int iRefStride, |
|---|
| 416 | TComMv* pcMvSrchRngLT, |
|---|
| 417 | TComMv* pcMvSrchRngRB, |
|---|
| 418 | TComMv& rcMv, |
|---|
| 419 | UInt& ruiSAD ); |
|---|
| 420 | |
|---|
| 421 | Void xSetSearchRange ( TComDataCU* pcCU, |
|---|
| 422 | TComMv& cMvPred, |
|---|
| 423 | Int iSrchRng, |
|---|
| 424 | TComMv& rcMvSrchRngLT, |
|---|
| 425 | TComMv& rcMvSrchRngRB ); |
|---|
| 426 | |
|---|
| 427 | Void xPatternSearchFast ( TComDataCU* pcCU, |
|---|
| 428 | TComPattern* pcPatternKey, |
|---|
| 429 | Pel* piRefY, |
|---|
| 430 | Int iRefStride, |
|---|
| 431 | TComMv* pcMvSrchRngLT, |
|---|
| 432 | TComMv* pcMvSrchRngRB, |
|---|
| 433 | TComMv& rcMv, |
|---|
| 434 | UInt& ruiSAD ); |
|---|
| 435 | |
|---|
| 436 | Void xPatternSearch ( TComPattern* pcPatternKey, |
|---|
| 437 | Pel* piRefY, |
|---|
| 438 | Int iRefStride, |
|---|
| 439 | TComMv* pcMvSrchRngLT, |
|---|
| 440 | TComMv* pcMvSrchRngRB, |
|---|
| 441 | TComMv& rcMv, |
|---|
| 442 | UInt& ruiSAD ); |
|---|
| 443 | |
|---|
| 444 | Void xPatternSearchFracDIF ( TComDataCU* pcCU, |
|---|
| 445 | TComPattern* pcPatternKey, |
|---|
| 446 | Pel* piRefY, |
|---|
| 447 | Int iRefStride, |
|---|
| 448 | TComMv* pcMvInt, |
|---|
| 449 | TComMv& rcMvHalf, |
|---|
| 450 | TComMv& rcMvQter, |
|---|
| 451 | UInt& ruiCost |
|---|
| 452 | ,Bool biPred |
|---|
| 453 | ); |
|---|
| 454 | #if REF_IDX_ME_AROUND_ZEROMV |
|---|
| 455 | Void xPatternSearchILR ( TComDataCU* pcCU, |
|---|
| 456 | TComPattern* pcPatternKey, |
|---|
| 457 | Pel* piRefY, |
|---|
| 458 | Int iRefStride, |
|---|
| 459 | TComMv& rcMv, |
|---|
| 460 | UInt& ruiSAD ); |
|---|
| 461 | #endif |
|---|
| 462 | |
|---|
| 463 | Void xExtDIFUpSamplingH( TComPattern* pcPattern, Bool biPred ); |
|---|
| 464 | Void xExtDIFUpSamplingQ( TComPattern* pcPatternKey, TComMv halfPelRef, Bool biPred ); |
|---|
| 465 | |
|---|
| 466 | // ------------------------------------------------------------------------------------------------------------------- |
|---|
| 467 | // T & Q & Q-1 & T-1 |
|---|
| 468 | // ------------------------------------------------------------------------------------------------------------------- |
|---|
| 469 | |
|---|
| 470 | Void xEncodeResidualQT( TComDataCU* pcCU, UInt uiAbsPartIdx, const UInt uiDepth, Bool bSubdivAndCbf, TextType eType ); |
|---|
| 471 | #if IBDI_DISTORTION |
|---|
| 472 | Void xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx,TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, UInt &ruiDist, UInt *puiZeroDist ); |
|---|
| 473 | #else |
|---|
| 474 | Void xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx,TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, UInt &ruiDist, UInt *puiZeroDist ); |
|---|
| 475 | #endif |
|---|
| 476 | Void xSetResidualQTData( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx,UInt absTUPartIdx, TComYuv* pcResi, UInt uiDepth, Bool bSpatial ); |
|---|
| 477 | |
|---|
| 478 | UInt xModeBitsIntra ( TComDataCU* pcCU, UInt uiMode, UInt uiPU, UInt uiPartOffset, UInt uiDepth, UInt uiInitTrDepth ); |
|---|
| 479 | UInt xUpdateCandList( UInt uiMode, Double uiCost, UInt uiFastCandNum, UInt * CandModeList, Double * CandCostList ); |
|---|
| 480 | |
|---|
| 481 | // ------------------------------------------------------------------------------------------------------------------- |
|---|
| 482 | // compute symbol bits |
|---|
| 483 | // ------------------------------------------------------------------------------------------------------------------- |
|---|
| 484 | |
|---|
| 485 | Void xAddSymbolBitsInter ( TComDataCU* pcCU, |
|---|
| 486 | UInt uiQp, |
|---|
| 487 | UInt uiTrMode, |
|---|
| 488 | UInt& ruiBits, |
|---|
| 489 | TComYuv*& rpcYuvRec, |
|---|
| 490 | TComYuv* pcYuvPred, |
|---|
| 491 | TComYuv*& rpcYuvResi ); |
|---|
| 492 | |
|---|
| 493 | Void setWpScalingDistParam( TComDataCU* pcCU, Int iRefIdx, RefPicList eRefPicListCur ); |
|---|
| 494 | inline Void setDistParamComp( UInt uiComp ) { m_cDistParam.uiComp = uiComp; } |
|---|
| 495 | |
|---|
| 496 | };// END CLASS DEFINITION TEncSearch |
|---|
| 497 | |
|---|
| 498 | //! \} |
|---|
| 499 | |
|---|
| 500 | #endif // __TENCSEARCH__ |
|---|