HEVC Test Model (HM)  HM-16.18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TComPrediction.h
Go to the documentation of this file.
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-2017, 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 
38 #ifndef __TCOMPREDICTION__
39 #define __TCOMPREDICTION__
40 
41 
42 // Include files
43 #include "TComYuv.h"
45 #include "TComWeightPrediction.h"
46 
47 // forward declaration
48 class TComMv;
49 class TComTU;
50 
53 
54 // ====================================================================================================================
55 // Class definition
56 // ====================================================================================================================
57 
59 typedef enum PRED_BUF_E
60 {
64 } PRED_BUF;
65 
67 
69 {
70 private:
72 
73 protected:
76 
81 
83 
86 
87  Void xPredIntraAng ( Int bitDepth, const Pel* pSrc, Int srcStride, Pel* pDst, Int dstStride, UInt width, UInt height, ChannelType channelType, UInt dirMode, const Bool bEnableEdgeFilters );
88  Void xPredIntraPlanar ( const Pel* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height );
89 
90  // motion compensation functions
91  Void xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv* pcYuvPred, Bool bi=false );
92  Void xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv* pcYuvPred );
93  Void xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth );
94  Void xWeightedAverage ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv* pcYuvDst, const BitDepths &clipBitDepths );
95 
96  Void xGetLLSPrediction ( const Pel* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0, const ChromaFormat chFmt DEBUG_STRING_FN_DECLARE(sDebug) );
97 
98  Void xDCPredFiltering( const Pel* pSrc, Int iSrcStride, Pel* pDst, Int iDstStride, Int iWidth, Int iHeight, ChannelType channelType );
99  Bool xCheckIdenticalMotion ( TComDataCU* pcCU, UInt PartAddr);
100  Void destroy();
101 
102 public:
103  TComPrediction();
104  virtual ~TComPrediction();
105 
106  Void initTempBuff(ChromaFormat chromaFormatIDC);
107 
109 
110  // inter
111  Void motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 );
112 
113  // motion vector prediction
114  Void getMvPredAMVP ( TComDataCU* pcCU, UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, TComMv& rcMvPred );
115 
116  // Angular Intra
117  Void predIntraAng ( const ComponentID compID, UInt uiDirMode, Pel *piOrg /* Will be null for decoding */, UInt uiOrgStride, Pel* piPred, UInt uiStride, TComTU &rTu, const Bool bUseFilteredPredSamples, const Bool bUseLosslessDPCM = false );
118 
119  Pel predIntraGetPredValDC ( const Pel* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight);
120 
121  Pel* getPredictorPtr ( const ComponentID compID, const Bool bUseFilteredPredictions )
122  {
123  return m_piYuvExt[compID][bUseFilteredPredictions?PRED_BUF_FILTERED:PRED_BUF_UNFILTERED];
124  }
125 
126  // This function is actually still in TComPattern.cpp
129  const ComponentID compID, const Bool bFilterRefSamples
131  );
132 
133  static Bool filteringIntraReferenceSamples(const ComponentID compID, UInt uiDirMode, UInt uiTuChWidth, UInt uiTuChHeight, const ChromaFormat chFmt, const Bool intraReferenceSmoothingDisabled);
134 
135  static Bool UseDPCMForFirstPassIntraEstimation(TComTU &rTu, const UInt uiDirMode);
136 
137 #if MCTS_ENC_CHECK
138  Bool checkTMctsMvp(TComDataCU* pcCU, Int partIdx = -1);
139 #endif
140 };
141 
143 
144 #endif // __TCOMPREDICTION__
picture YUV buffer class
Definition: TComPicYuv.h:55
CU data structure class.
Definition: TComDataCU.h:64
ChannelType
Definition: TypeDef.h:301
weighting prediction class
static const Int LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS
Definition: CommonDef.h:200
void Void
Definition: TypeDef.h:203
Void getMvPredAMVP(TComDataCU *pcCU, UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, TComMv &rcMvPred)
static const UInt MAX_INTRA_FILTER_DEPTHS
Pel predIntraGetPredValDC(const Pel *pSrc, Int iSrcStride, UInt iWidth, UInt iHeight)
Declaration of TComInterpolationFilter class.
general YUV buffer class (header)
Interpolation filter class.
Void motionCompensation(TComDataCU *pcCU, TComYuv *pcYuvPred, RefPicList eRefPicList=REF_PIC_LIST_X, Int iPartIdx=-1)
unsigned int UInt
Definition: TypeDef.h:212
Void xGetLLSPrediction(const Pel *pSrc0, Int iSrcStride, Pel *pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0, const ChromaFormat chFmt)
Void xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth)
Generate motion-compensated block.
TComYuv m_acYuvPred[NUM_REF_PIC_LIST_01]
Short Pel
pixel type
Definition: TypeDef.h:249
Void initTempBuff(ChromaFormat chromaFormatIDC)
static Bool filteringIntraReferenceSamples(const ComponentID compID, UInt uiDirMode, UInt uiTuChWidth, UInt uiTuChHeight, const ChromaFormat chFmt, const Bool intraReferenceSmoothingDisabled)
static const UChar m_aucIntraFilter[MAX_NUM_CHANNEL_TYPE][MAX_INTRA_FILTER_DEPTHS]
TComYuv m_cYuvPredTemp
Bool checkTMctsMvp(TComDataCU *pcCU, Int partIdx=-1)
ChromaFormat getChromaFormat() const
general YUV buffer class
Definition: TComYuv.h:54
Void predIntraAng(const ComponentID compID, UInt uiDirMode, Pel *piOrg, UInt uiOrgStride, Pel *piPred, UInt uiStride, TComTU &rTu, const Bool bUseFilteredPredSamples, const Bool bUseLosslessDPCM=false)
Void xWeightedAverage(TComYuv *pcYuvSrc0, TComYuv *pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv *pcYuvDst, const BitDepths &clipBitDepths)
bool Bool
Definition: TypeDef.h:204
PRED_BUF_E
prediction class
Int m_iLumaRecStride
stride of m_pLumaRecBuffer array
RefPicList
reference list index
Definition: TypeDef.h:370
ChromaFormat
chroma formats (according to semantics of chroma_format_idc)
Definition: TypeDef.h:292
unsigned char UChar
Definition: TypeDef.h:208
Void xPredIntraPlanar(const Pel *pSrc, Int srcStride, Pel *rpDst, Int dstStride, UInt width, UInt height)
Void xDCPredFiltering(const Pel *pSrc, Int iSrcStride, Pel *pDst, Int iDstStride, Int iWidth, Int iHeight, ChannelType channelType)
#define DEBUG_STRING_FN_DECLARE(name)
Definition: TypeDef.h:182
Definition: TComTU.h:48
ChromaFormat getChromaFormat() const
Definition: TComYuv.h:202
Pel * m_pLumaRecBuffer
array for downsampled reconstructed luma sample
TComInterpolationFilter m_if
enum PRED_BUF_E PRED_BUF
prediction class
Pel * getPredictorPtr(const ComponentID compID, const Bool bUseFilteredPredictions)
int Int
Definition: TypeDef.h:211
basic motion vector class
Definition: TComMv.h:51
Bool xCheckIdenticalMotion(TComDataCU *pcCU, UInt PartAddr)
Void initIntraPatternChType(TComTU &rTu, const ComponentID compID, const Bool bFilterRefSamples)
set parameters from CU data for accessing intra data
virtual ~TComPrediction()
ComponentID
Definition: TypeDef.h:308
Void xPredInterBi(TComDataCU *pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv *pcYuvPred)
TComYuv m_filteredBlockTmp[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS]
weighting prediction class (header)
special mark
Definition: TypeDef.h:375
TComYuv m_filteredBlock[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS]
Void xPredInterUni(TComDataCU *pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv *pcYuvPred, Bool bi=false)
Pel * m_piYuvExt[MAX_NUM_COMPONENT][NUM_PRED_BUF]
Void xPredIntraAng(Int bitDepth, const Pel *pSrc, Int srcStride, Pel *pDst, Int dstStride, UInt width, UInt height, ChannelType channelType, UInt dirMode, const Bool bEnableEdgeFilters)
static Bool UseDPCMForFirstPassIntraEstimation(TComTU &rTu, const UInt uiDirMode)