[5] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
| 4 | * granted under this license. |
---|
| 5 | * |
---|
| 6 | * Copyright (c) 2010-2011, 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 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 | */ |
---|
[2] | 33 | |
---|
| 34 | |
---|
[5] | 35 | |
---|
[2] | 36 | /** \file TEncSearch.h |
---|
| 37 | \brief encoder search class (header) |
---|
| 38 | */ |
---|
| 39 | |
---|
| 40 | #ifndef __TENCSEARCH__ |
---|
| 41 | #define __TENCSEARCH__ |
---|
| 42 | |
---|
| 43 | // Include files |
---|
| 44 | #include "../TLibCommon/TComYuv.h" |
---|
| 45 | #include "../TLibCommon/TComMotionInfo.h" |
---|
| 46 | #include "../TLibCommon/TComPattern.h" |
---|
| 47 | #include "../TLibCommon/TComPredFilter.h" |
---|
| 48 | #include "../TLibCommon/TComPrediction.h" |
---|
| 49 | #include "../TLibCommon/TComTrQuant.h" |
---|
| 50 | #include "../TLibCommon/TComPic.h" |
---|
| 51 | #include "../TLibCommon/TComWedgelet.h" |
---|
| 52 | #include "TEncEntropy.h" |
---|
| 53 | #include "TEncSbac.h" |
---|
| 54 | #include "TEncCfg.h" |
---|
| 55 | |
---|
| 56 | class TEncCu; |
---|
| 57 | |
---|
| 58 | // ==================================================================================================================== |
---|
| 59 | // Class definition |
---|
| 60 | // ==================================================================================================================== |
---|
| 61 | |
---|
| 62 | /// encoder search class |
---|
| 63 | class TEncSearch : public TComPrediction |
---|
| 64 | { |
---|
| 65 | private: |
---|
| 66 | TCoeff** m_ppcQTTempCoeffY; |
---|
| 67 | TCoeff** m_ppcQTTempCoeffCb; |
---|
| 68 | TCoeff** m_ppcQTTempCoeffCr; |
---|
| 69 | TCoeff* m_pcQTTempCoeffY; |
---|
| 70 | TCoeff* m_pcQTTempCoeffCb; |
---|
| 71 | TCoeff* m_pcQTTempCoeffCr; |
---|
| 72 | UChar* m_puhQTTempTrIdx; |
---|
| 73 | UChar* m_puhQTTempCbf[3]; |
---|
| 74 | |
---|
| 75 | TComYuv* m_pcQTTempTComYuv; |
---|
| 76 | protected: |
---|
| 77 | // interface to option |
---|
| 78 | TEncCfg* m_pcEncCfg; |
---|
| 79 | |
---|
| 80 | // interface to classes |
---|
| 81 | TComTrQuant* m_pcTrQuant; |
---|
| 82 | TComRdCost* m_pcRdCost; |
---|
| 83 | TEncEntropy* m_pcEntropyCoder; |
---|
| 84 | |
---|
| 85 | // ME parameters |
---|
| 86 | Int m_iSearchRange; |
---|
| 87 | Int m_bipredSearchRange; // Search range for bi-prediction |
---|
| 88 | Int m_iFastSearch; |
---|
| 89 | Int m_aaiAdaptSR[2][33]; |
---|
| 90 | TComMv m_cSrchRngLT; |
---|
| 91 | TComMv m_cSrchRngRB; |
---|
| 92 | TComMv m_acMvPredictors[3]; |
---|
| 93 | |
---|
| 94 | // RD computation |
---|
| 95 | TEncSbac*** m_pppcRDSbacCoder; |
---|
| 96 | TEncSbac* m_pcRDGoOnSbacCoder; |
---|
| 97 | Bool m_bUseSBACRD; |
---|
| 98 | DistParam m_cDistParam; |
---|
| 99 | |
---|
| 100 | // Misc. |
---|
| 101 | Pel* m_pTempPel; |
---|
| 102 | UInt* m_puiDFilter; |
---|
| 103 | Int m_iMaxDeltaQP; |
---|
| 104 | |
---|
| 105 | |
---|
[5] | 106 | #if HHI_VSO |
---|
[2] | 107 | TComYuv m_cYuvRecTemp; |
---|
[5] | 108 | #endif |
---|
[2] | 109 | |
---|
| 110 | // AMVP cost computation |
---|
| 111 | // UInt m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS]; |
---|
| 112 | UInt m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS+1]; //th array bounds |
---|
| 113 | |
---|
| 114 | public: |
---|
| 115 | TEncSearch(); |
---|
| 116 | virtual ~TEncSearch(); |
---|
| 117 | |
---|
| 118 | Void init( TEncCfg* pcEncCfg, |
---|
| 119 | TComTrQuant* pcTrQuant, |
---|
| 120 | Int iSearchRange, |
---|
| 121 | Int bipredSearchRange, |
---|
| 122 | Int iFastSearch, |
---|
| 123 | Int iMaxDeltaQP, |
---|
| 124 | TEncEntropy* pcEntropyCoder, |
---|
| 125 | TComRdCost* pcRdCost, |
---|
| 126 | TEncSbac*** pppcRDSbacCoder, |
---|
| 127 | TEncSbac* pcRDGoOnSbacCoder ); |
---|
| 128 | |
---|
| 129 | protected: |
---|
| 130 | |
---|
| 131 | /// sub-function for motion vector refinement used in fractional-pel accuracy |
---|
| 132 | #ifdef ROUNDING_CONTROL_BIPRED |
---|
| 133 | UInt xPatternRefinement_Bi( TComPattern* pcPatternKey, Pel* piRef, Int iRefStride, Int iIntStep, Int iFrac, TComMv& rcMvFrac, Pel* pRefY2, Bool bRound ); |
---|
| 134 | #endif |
---|
| 135 | |
---|
| 136 | UInt xPatternRefinement( TComPattern* pcPatternKey, Pel* piRef, Int iRefStride, Int iIntStep, Int iFrac, TComMv& rcMvFrac ); |
---|
| 137 | |
---|
| 138 | #if (!REFERENCE_SAMPLE_PADDING) |
---|
[5] | 139 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[2] | 140 | Bool predIntraLumaDirAvailable( UInt uiMode, UInt uiWidthBit, Bool bAboveAvail, Bool bLeftAvail, UInt uiWidth, UInt uiHeight, TComDataCU* pcCU, UInt uiAbsPartIdx ); |
---|
| 141 | #else |
---|
| 142 | Bool predIntraLumaDirAvailable( UInt uiMode, UInt uiWidthBit, Bool bAboveAvail, Bool bLeftAvail); |
---|
| 143 | #endif |
---|
| 144 | #endif |
---|
| 145 | |
---|
[5] | 146 | #if HHI_DMM_WEDGE_INTRA |
---|
[2] | 147 | Void xSearchWedgeFullMinDist ( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx ); |
---|
| 148 | Void xSearchWedgePredDirMinDist( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, Int& riWedgeDeltaEnd ); |
---|
[5] | 149 | #endif |
---|
| 150 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[2] | 151 | Void xGetWedgeDeltaDCsMinDist ( TComWedgelet* pcWedgelet, |
---|
| 152 | TComDataCU* pcCU, |
---|
| 153 | UInt uiAbsPtIdx, |
---|
| 154 | Pel* piOrig, |
---|
| 155 | Pel* piPredic, |
---|
| 156 | UInt uiStride, |
---|
| 157 | UInt uiWidth, |
---|
| 158 | UInt uiHeight, |
---|
| 159 | Int& riDeltaDC1, |
---|
| 160 | Int& riDeltaDC2, |
---|
| 161 | Bool bAbove, |
---|
| 162 | Bool bLeft ); |
---|
| 163 | |
---|
| 164 | Void xDeltaDCQuantScaleDown( TComDataCU* pcCU, Int& riDeltaDC ); |
---|
| 165 | #endif |
---|
| 166 | |
---|
| 167 | |
---|
| 168 | typedef struct |
---|
| 169 | { |
---|
| 170 | Pel* piRefY; |
---|
| 171 | Int iYStride; |
---|
| 172 | Int iBestX; |
---|
| 173 | Int iBestY; |
---|
| 174 | UInt uiBestRound; |
---|
| 175 | UInt uiBestDistance; |
---|
| 176 | UInt uiBestSad; |
---|
| 177 | UChar ucPointNr; |
---|
| 178 | } IntTZSearchStruct; |
---|
| 179 | |
---|
| 180 | // sub-functions for ME |
---|
| 181 | __inline Void xTZSearchHelp ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance ); |
---|
| 182 | __inline Void xTZ2PointSearch ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB ); |
---|
| 183 | __inline Void xTZ8PointSquareSearch ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist ); |
---|
| 184 | __inline Void xTZ8PointDiamondSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist ); |
---|
| 185 | |
---|
| 186 | Void xGetInterPredictionError( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, UInt& ruiSAD, Bool Hadamard ); |
---|
| 187 | |
---|
| 188 | public: |
---|
| 189 | Void preestChromaPredMode ( TComDataCU* pcCU, |
---|
| 190 | TComYuv* pcOrgYuv, |
---|
| 191 | TComYuv* pcPredYuv ); |
---|
| 192 | Void estIntraPredQT ( TComDataCU* pcCU, |
---|
| 193 | TComYuv* pcOrgYuv, |
---|
| 194 | TComYuv* pcPredYuv, |
---|
| 195 | TComYuv* pcResiYuv, |
---|
| 196 | TComYuv* pcRecoYuv, |
---|
| 197 | Dist& ruiDistC, |
---|
| 198 | Bool bLumaOnly ); |
---|
| 199 | Void estIntraPredChromaQT ( TComDataCU* pcCU, |
---|
| 200 | TComYuv* pcOrgYuv, |
---|
| 201 | TComYuv* pcPredYuv, |
---|
| 202 | TComYuv* pcResiYuv, |
---|
| 203 | TComYuv* pcRecoYuv, |
---|
| 204 | Dist uiPreCalcDistC ); |
---|
| 205 | |
---|
[5] | 206 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[2] | 207 | Bool predIntraLumaDMMAvailable( UInt uiMode, |
---|
| 208 | UInt uiWidth, |
---|
[5] | 209 | UInt uiHeight ); |
---|
| 210 | #endif |
---|
| 211 | #if HHI_DMM_WEDGE_INTRA |
---|
[2] | 212 | Void findWedgeFullMinDist ( TComDataCU* pcCU, |
---|
| 213 | UInt uiAbsPtIdx, |
---|
| 214 | Pel* piOrig, |
---|
| 215 | Pel* piPredic, |
---|
| 216 | UInt uiStride, |
---|
| 217 | UInt uiWidth, |
---|
| 218 | UInt uiHeight, |
---|
| 219 | UInt& ruiTabIdx, |
---|
| 220 | Int& riDeltaDC1, |
---|
| 221 | Int& riDeltaDC2, |
---|
| 222 | Bool bAbove, |
---|
| 223 | Bool bLeft, |
---|
| 224 | WedgeDist eWedgeDist ); |
---|
| 225 | Void findWedgePredDirMinDist ( TComDataCU* pcCU, |
---|
| 226 | UInt uiAbsPtIdx, |
---|
| 227 | Pel* piOrig, |
---|
| 228 | Pel* piPredic, |
---|
| 229 | UInt uiStride, |
---|
| 230 | UInt uiWidth, |
---|
| 231 | UInt uiHeight, |
---|
| 232 | UInt& ruiTabIdx, |
---|
| 233 | Int& riWedgeDeltaEnd, |
---|
| 234 | Int& riDeltaDC1, |
---|
| 235 | Int& riDeltaDC2, |
---|
| 236 | Bool bAbove, |
---|
| 237 | Bool bLeft, |
---|
| 238 | WedgeDist eWedgeDist ); |
---|
[5] | 239 | #endif |
---|
| 240 | #if HHI_DMM_PRED_TEX |
---|
[2] | 241 | Void findWedgeTexMinDist ( TComDataCU* pcCU, |
---|
| 242 | UInt uiAbsPtIdx, |
---|
| 243 | Pel* piOrig, |
---|
| 244 | Pel* piPredic, |
---|
| 245 | UInt uiStride, |
---|
| 246 | UInt uiWidth, |
---|
| 247 | UInt uiHeight, |
---|
| 248 | UInt& ruiTabIdx, |
---|
| 249 | Int& riDeltaDC1, |
---|
| 250 | Int& riDeltaDC2, |
---|
| 251 | Bool bAbove, |
---|
| 252 | Bool bLeft, |
---|
[5] | 253 | WedgeDist eWedgeDist, |
---|
| 254 | Pel* piTextureRef = NULL ); |
---|
| 255 | |
---|
[2] | 256 | Void findContourPredTex ( TComDataCU* pcCU, |
---|
| 257 | UInt uiAbsPtIdx, |
---|
| 258 | Pel* piOrig, |
---|
| 259 | Pel* piPredic, |
---|
| 260 | UInt uiStride, |
---|
| 261 | UInt uiWidth, |
---|
| 262 | UInt uiHeight, |
---|
| 263 | Int& riDeltaDC1, |
---|
| 264 | Int& riDeltaDC2, |
---|
| 265 | Bool bAbove, |
---|
[5] | 266 | Bool bLeft, |
---|
| 267 | Pel* piTextureRef = NULL ); |
---|
[2] | 268 | #endif |
---|
| 269 | |
---|
| 270 | /// encoder estimation - inter prediction (non-skip) |
---|
| 271 | Void predInterSearch ( TComDataCU* pcCU, |
---|
| 272 | TComYuv* pcOrgYuv, |
---|
| 273 | TComYuv*& rpcPredYuv, |
---|
| 274 | TComYuv*& rpcResiYuv, |
---|
| 275 | TComYuv*& rpcRecoYuv, |
---|
| 276 | Bool bUseRes = false ); |
---|
| 277 | |
---|
| 278 | /// encoder estimation - intra prediction (skip) |
---|
| 279 | Void predInterSkipSearch ( TComDataCU* pcCU, |
---|
| 280 | TComYuv* pcOrgYuv, |
---|
| 281 | TComYuv*& rpcPredYuv, |
---|
| 282 | TComYuv*& rpcResiYuv, |
---|
| 283 | TComYuv*& rpcRecoYuv ); |
---|
| 284 | |
---|
| 285 | /// encode residual and compute rd-cost for inter mode |
---|
| 286 | Void encodeResAndCalcRdInterCU( TComDataCU* pcCU, |
---|
| 287 | TComYuv* pcYuvOrg, |
---|
| 288 | TComYuv* pcYuvPred, |
---|
| 289 | TComYuv*& rpcYuvResi, |
---|
| 290 | TComYuv*& rpcYuvResiBest, |
---|
| 291 | TComYuv*& rpcYuvRec, |
---|
| 292 | TComYuv*& rpcYuvResPrd, |
---|
| 293 | Bool bSkipRes ); |
---|
| 294 | |
---|
| 295 | /// set ME search range |
---|
| 296 | Void setAdaptiveSearchRange ( Int iDir, Int iRefIdx, Int iSearchRange) { m_aaiAdaptSR[iDir][iRefIdx] = iSearchRange; } |
---|
| 297 | |
---|
| 298 | protected: |
---|
| 299 | |
---|
| 300 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 301 | // Intra search |
---|
| 302 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 303 | |
---|
| 304 | Void xEncSubdivCbfQT ( TComDataCU* pcCU, |
---|
| 305 | UInt uiTrDepth, |
---|
| 306 | UInt uiAbsPartIdx, |
---|
| 307 | Bool bLuma, |
---|
| 308 | Bool bChroma ); |
---|
| 309 | Void xEncCoeffQT ( TComDataCU* pcCU, |
---|
| 310 | UInt uiTrDepth, |
---|
| 311 | UInt uiAbsPartIdx, |
---|
| 312 | TextType eTextType, |
---|
| 313 | Bool bRealCoeff ); |
---|
| 314 | Void xEncIntraHeader ( TComDataCU* pcCU, |
---|
| 315 | UInt uiTrDepth, |
---|
| 316 | UInt uiAbsPartIdx, |
---|
| 317 | Bool bLuma, |
---|
| 318 | Bool bChroma ); |
---|
| 319 | UInt xGetIntraBitsQT ( TComDataCU* pcCU, |
---|
| 320 | UInt uiTrDepth, |
---|
| 321 | UInt uiAbsPartIdx, |
---|
| 322 | Bool bLuma, |
---|
| 323 | Bool bChroma, |
---|
[5] | 324 | Bool bRealCoeff |
---|
| 325 | ); |
---|
[2] | 326 | |
---|
| 327 | Void xIntraCodingLumaBlk ( TComDataCU* pcCU, |
---|
| 328 | UInt uiTrDepth, |
---|
| 329 | UInt uiAbsPartIdx, |
---|
| 330 | TComYuv* pcOrgYuv, |
---|
| 331 | TComYuv* pcPredYuv, |
---|
| 332 | TComYuv* pcResiYuv, |
---|
| 333 | Dist& ruiDist |
---|
| 334 | ); |
---|
| 335 | |
---|
| 336 | Void xIntraCodingChromaBlk ( TComDataCU* pcCU, |
---|
| 337 | UInt uiTrDepth, |
---|
| 338 | UInt uiAbsPartIdx, |
---|
| 339 | TComYuv* pcOrgYuv, |
---|
| 340 | TComYuv* pcPredYuv, |
---|
| 341 | TComYuv* pcResiYuv, |
---|
| 342 | Dist& ruiDist, |
---|
| 343 | UInt uiChromaId ); |
---|
| 344 | Void xRecurIntraCodingQT ( TComDataCU* pcCU, |
---|
| 345 | UInt uiTrDepth, |
---|
| 346 | UInt uiAbsPartIdx, |
---|
| 347 | Bool bLumaOnly, |
---|
| 348 | TComYuv* pcOrgYuv, |
---|
| 349 | TComYuv* pcPredYuv, |
---|
| 350 | TComYuv* pcResiYuv, |
---|
| 351 | Dist& ruiDistY, |
---|
| 352 | Dist& ruiDistC, |
---|
| 353 | #if HHI_RQT_INTRA_SPEEDUP |
---|
| 354 | Bool bCheckFirst, |
---|
| 355 | #endif |
---|
| 356 | Double& dRDCost ); |
---|
| 357 | |
---|
| 358 | Void xSetIntraResultQT ( TComDataCU* pcCU, |
---|
| 359 | UInt uiTrDepth, |
---|
| 360 | UInt uiAbsPartIdx, |
---|
| 361 | Bool bLumaOnly, |
---|
| 362 | TComYuv* pcRecoYuv ); |
---|
| 363 | |
---|
| 364 | Void xRecurIntraChromaCodingQT ( TComDataCU* pcCU, |
---|
| 365 | UInt uiTrDepth, |
---|
| 366 | UInt uiAbsPartIdx, |
---|
| 367 | TComYuv* pcOrgYuv, |
---|
| 368 | TComYuv* pcPredYuv, |
---|
| 369 | TComYuv* pcResiYuv, |
---|
| 370 | Dist& ruiDist ); |
---|
| 371 | Void xSetIntraResultChromaQT ( TComDataCU* pcCU, |
---|
| 372 | UInt uiTrDepth, |
---|
| 373 | UInt uiAbsPartIdx, |
---|
| 374 | TComYuv* pcRecoYuv ); |
---|
| 375 | |
---|
| 376 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 377 | // Inter search (AMP) |
---|
| 378 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 379 | |
---|
| 380 | Void xEstimateMvPredAMVP ( TComDataCU* pcCU, |
---|
| 381 | TComYuv* pcOrgYuv, |
---|
| 382 | UInt uiPartIdx, |
---|
| 383 | RefPicList eRefPicList, |
---|
| 384 | Int iRefIdx, |
---|
| 385 | TComMv& rcMvPred, |
---|
| 386 | Bool bFilled = false |
---|
| 387 | #if ZERO_MVD_EST |
---|
| 388 | , UInt* puiDist = NULL |
---|
| 389 | #endif |
---|
| 390 | ); |
---|
| 391 | |
---|
| 392 | Void xCheckBestMVP ( TComDataCU* pcCU, |
---|
| 393 | RefPicList eRefPicList, |
---|
| 394 | TComMv cMv, |
---|
| 395 | TComMv& rcMvPred, |
---|
| 396 | Int& riMVPIdx, |
---|
| 397 | UInt& ruiBits, |
---|
| 398 | UInt& ruiCost ); |
---|
| 399 | |
---|
| 400 | UInt xGetTemplateCost ( TComDataCU* pcCU, |
---|
| 401 | UInt uiPartIdx, |
---|
| 402 | UInt uiPartAddr, |
---|
| 403 | TComYuv* pcOrgYuv, |
---|
| 404 | TComYuv* pcTemplateCand, |
---|
| 405 | TComMv cMvCand, |
---|
| 406 | Int iMVPIdx, |
---|
| 407 | Int iMVPNum, |
---|
| 408 | RefPicList eRefPicList, |
---|
| 409 | Int iRefIdx, |
---|
| 410 | Int iSizeX, |
---|
| 411 | Int iSizeY |
---|
| 412 | #if ZERO_MVD_EST |
---|
| 413 | , UInt& ruiDist |
---|
| 414 | #endif |
---|
| 415 | ); |
---|
| 416 | |
---|
| 417 | |
---|
| 418 | Void xCopyAMVPInfo ( AMVPInfo* pSrc, AMVPInfo* pDst ); |
---|
| 419 | UInt xGetMvpIdxBits ( Int iIdx, Int iNum ); |
---|
| 420 | Void xGetBlkBits ( PartSize eCUMode, Bool bPSlice, Int iPartIdx, UInt uiLastMode, UInt uiBlkBit[3]); |
---|
| 421 | |
---|
| 422 | Void xMergeEstimation ( TComDataCU* pcCU, |
---|
| 423 | TComYuv* pcYuvOrg, |
---|
| 424 | Int iPartIdx, |
---|
| 425 | UInt& uiInterDir, |
---|
| 426 | TComMvField* pacMvField, |
---|
| 427 | UInt& uiMergeIndex, |
---|
| 428 | UInt& ruiCost, |
---|
| 429 | UInt& ruiBits, |
---|
| 430 | UChar* puhNeighCands, |
---|
| 431 | Bool& bValid ); |
---|
| 432 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 433 | // motion estimation |
---|
| 434 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 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 | UInt& 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 | UInt& ruiSAD ); |
---|
| 455 | |
---|
| 456 | Void xSetSearchRange ( TComDataCU* pcCU, |
---|
| 457 | TComMv& cMvPred, |
---|
| 458 | Int iSrchRng, |
---|
| 459 | TComMv& rcMvSrchRngLT, |
---|
| 460 | TComMv& rcMvSrchRngRB ); |
---|
| 461 | |
---|
| 462 | Void xPatternSearchFast ( TComDataCU* pcCU, |
---|
| 463 | TComPattern* pcPatternKey, |
---|
| 464 | Pel* piRefY, |
---|
| 465 | Int iRefStride, |
---|
| 466 | TComMv* pcMvSrchRngLT, |
---|
| 467 | TComMv* pcMvSrchRngRB, |
---|
| 468 | TComMv& rcMv, |
---|
| 469 | UInt& ruiSAD ); |
---|
| 470 | |
---|
| 471 | #ifdef ROUNDING_CONTROL_BIPRED |
---|
| 472 | Void xPatternSearch_Bi ( TComPattern* pcPatternKey, |
---|
| 473 | Pel* piRefY, |
---|
| 474 | Int iRefStride, |
---|
| 475 | TComMv* pcMvSrchRngLT, |
---|
| 476 | TComMv* pcMvSrchRngRB, |
---|
| 477 | TComMv& rcMv, |
---|
| 478 | UInt& ruiSAD, |
---|
| 479 | Pel* pcRefY2, |
---|
| 480 | Bool bRound); |
---|
| 481 | |
---|
| 482 | Void xPatternSearchFracDIF_Bi ( TComDataCU* pcCU, |
---|
| 483 | TComPattern* pcPatternKey, |
---|
| 484 | Pel* piRefY, |
---|
| 485 | Int iRefStride, |
---|
| 486 | TComMv* pcMvInt, |
---|
| 487 | TComMv& rcMvHalf, |
---|
| 488 | TComMv& rcMvQter, |
---|
| 489 | UInt& ruiCost, |
---|
| 490 | Pel* pcRefY2, |
---|
| 491 | Bool bRound); |
---|
| 492 | #endif |
---|
| 493 | |
---|
| 494 | Void xPatternSearch ( TComPattern* pcPatternKey, |
---|
| 495 | Pel* piRefY, |
---|
| 496 | Int iRefStride, |
---|
| 497 | TComMv* pcMvSrchRngLT, |
---|
| 498 | TComMv* pcMvSrchRngRB, |
---|
| 499 | TComMv& rcMv, |
---|
| 500 | UInt& ruiSAD ); |
---|
| 501 | |
---|
| 502 | Void xPatternSearchFracDIF ( TComDataCU* pcCU, |
---|
| 503 | TComPattern* pcPatternKey, |
---|
| 504 | Pel* piRefY, |
---|
| 505 | Int iRefStride, |
---|
| 506 | TComMv* pcMvInt, |
---|
| 507 | TComMv& rcMvHalf, |
---|
| 508 | TComMv& rcMvQter, |
---|
| 509 | UInt& ruiCost |
---|
| 510 | ); |
---|
| 511 | |
---|
| 512 | Void xExtDIFUpSamplingH ( TComPattern* pcPattern, TComYuv* pcYuvExt ); |
---|
| 513 | |
---|
| 514 | Void xExtDIFUpSamplingQ ( TComPattern* pcPatternKey, |
---|
| 515 | Pel* piDst, |
---|
| 516 | Int iDstStride, |
---|
| 517 | Pel* piSrcPel, |
---|
| 518 | Int iSrcPelStride, |
---|
| 519 | Int* piSrc, |
---|
| 520 | Int iSrcStride, |
---|
| 521 | UInt uiFilter ); |
---|
| 522 | |
---|
| 523 | |
---|
| 524 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 525 | // T & Q & Q-1 & T-1 |
---|
| 526 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 527 | |
---|
| 528 | Void xEncodeResidualQT( TComDataCU* pcCU, UInt uiAbsPartIdx, const UInt uiDepth, Bool bSubdivAndCbf, TextType eType ); |
---|
| 529 | Void xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, Dist &ruiDist, Dist *puiZeroDist ); |
---|
| 530 | Void xSetResidualQTData( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcResi, UInt uiDepth, Bool bSpatial ); |
---|
| 531 | |
---|
| 532 | UInt xModeBitsIntra ( TComDataCU* pcCU, UInt uiMode, UInt uiPU, UInt uiPartOffset, UInt uiDepth, UInt uiInitTrDepth ); |
---|
| 533 | UInt xUpdateCandList( UInt uiMode, Double uiCost, UInt uiFastCandNum, UInt * CandModeList, Double * CandCostList ); |
---|
| 534 | |
---|
| 535 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 536 | // compute symbol bits |
---|
| 537 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 538 | |
---|
| 539 | Void xAddSymbolBitsInter ( TComDataCU* pcCU, |
---|
| 540 | UInt uiQp, |
---|
| 541 | UInt uiTrMode, |
---|
| 542 | UInt& ruiBits, |
---|
| 543 | TComYuv*& rpcYuvRec, |
---|
| 544 | TComYuv* pcYuvPred, |
---|
| 545 | TComYuv*& rpcYuvResi ); |
---|
| 546 | |
---|
| 547 | #ifdef WEIGHT_PRED |
---|
| 548 | Void setWpScalingDistParam( TComDataCU* pcCU, Int iRefIdx0, Int iRefIdx1 , RefPicList eRefPicList ); |
---|
| 549 | inline Void setDistParamComp( UInt uiComp ) { m_cDistParam.uiComp = uiComp; } |
---|
| 550 | #endif |
---|
| 551 | };// END CLASS DEFINITION TEncSearch |
---|
| 552 | |
---|
| 553 | |
---|
| 554 | #endif // __TENCSEARCH__ |
---|
| 555 | |
---|