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