source: 3DVCSoftware/trunk/source/Lib/TLibCommon/TComPrediction.h @ 1313

Last change on this file since 1313 was 1313, checked in by tech, 9 years ago

Merged 14.1-update-dev1@1312.

  • Property svn:eol-style set to native
File size: 9.8 KB
RevLine 
[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
[1313]4 * granted under this license.
[5]5 *
[1313]6 * Copyright (c) 2010-2015, ITU/ISO/IEC
[5]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.
[56]17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
[5]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/** \file     TComPrediction.h
35    \brief    prediction class (header)
36*/
37
38#ifndef __TCOMPREDICTION__
39#define __TCOMPREDICTION__
40
41
42// Include files
[1313]43#include "TComYuv.h"
[56]44#include "TComInterpolationFilter.h"
45#include "TComWeightPrediction.h"
46
[1313]47#if NH_3D_ARP
48#include "TComPic.h"
49#endif
50// forward declaration
51class TComMv;
52class TComTU; 
53
[56]54//! \ingroup TLibCommon
55//! \{
56
[2]57// ====================================================================================================================
58// Class definition
59// ====================================================================================================================
60
61/// prediction class
[1313]62typedef enum PRED_BUF_E
63{
64  PRED_BUF_UNFILTERED=0,
65  PRED_BUF_FILTERED=1,
66  NUM_PRED_BUF=2
67} PRED_BUF;
68
69static const UInt MAX_INTRA_FILTER_DEPTHS=5;
70
[56]71class TComPrediction : public TComWeightPrediction
[2]72{
[1313]73private:
74  static const UChar m_aucIntraFilter[MAX_NUM_CHANNEL_TYPE][MAX_INTRA_FILTER_DEPTHS];
75
[2]76protected:
[1313]77  Pel*      m_piYuvExt[MAX_NUM_COMPONENT][NUM_PRED_BUF];
78  Int       m_iYuvExtSize;
79
80  TComYuv   m_acYuvPred[NUM_REF_PIC_LIST_01];
[2]81  TComYuv   m_cYuvPredTemp;
[1313]82#if NH_3D_ARP
[443]83  TComYuv   m_acYuvPredBase[2];
84#endif
[1313]85  TComYuv m_filteredBlock[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS];
86  TComYuv m_filteredBlockTmp[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS];
87
[56]88  TComInterpolationFilter m_if;
[1313]89
90  Pel*   m_pLumaRecBuffer;       ///< array for downsampled reconstructed luma sample
[56]91  Int    m_iLumaRecStride;       ///< stride of #m_pLumaRecBuffer array
[1313]92#if NH_3D_IC
[608]93  UInt   m_uiaShift[ 64 ];       // Table for multiplication to substitue of division operation
94#endif
[2]95
[1313]96#if NH_3D_VSP
[884]97  Int*    m_pDepthBlock;         ///< Store a depth block, local variable, to prevent memory allocation every time
98  TComYuv m_cYuvDepthOnVsp;
[296]99#endif
[1313]100  Void xPredIntraAng            ( Int bitDepth, const Pel* pSrc, Int srcStride, Pel* pDst, Int dstStride, UInt width, UInt height, ChannelType channelType, UInt dirMode, const Bool bEnableEdgeFilters );
101  Void xPredIntraPlanar         ( const Pel* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height );
[296]102
[2]103  // motion compensation functions
[1313]104#if NH_3D_ARP
105  Void xPredInterUniARP         ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi );
106  Void xPredInterUniARPviewRef  ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi );
[1039]107  Bool xCheckBiInterviewARP     ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc );
[443]108#endif
[1313]109
110  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv* pcYuvPred, Bool bi=false          );
111  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv* pcYuvPred          );
112#if NH_3D_VSP
[608]113  Void xPredInterUniVSP         ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false          );
114  Void xPredInterBiVSP          ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred );
[296]115#endif
[56]116
[1313]117  Void xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth
118#if NH_3D_ARP
[608]119    , Bool filterType = false
[296]120#endif
[1313]121#if NH_3D_IC
[608]122    , Bool bICFlag    = false
[296]123#endif
[1313]124 );
[332]125
[1313]126#if NH_3D_VSP
127  Void xPredInterUniSubPU        ( TComDataCU *cu, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU=4, Int heightSubPU=4 );
[296]128#endif
[56]129
[1313]130  Void xWeightedAverage         ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv* pcYuvDst, const BitDepths &clipBitDepths  );
131
132  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) );
133#if NH_3D_IC
134  Void xGetLLSICPrediction( const ComponentID compID, TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, const Int bitDepth);
[189]135#endif
[1313]136  Void xDCPredFiltering( const Pel* pSrc, Int iSrcStride, Pel* pDst, Int iDstStride, Int iWidth, Int iHeight, ChannelType channelType );
[56]137  Bool xCheckIdenticalMotion    ( TComDataCU* pcCU, UInt PartAddr);
[1313]138#if NH_3D_SPIVMP
[724]139  Bool xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 );
140  Void xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr );
141#endif
[2]142
[1313]143  Void destroy();
144
[2]145public:
146  TComPrediction();
147  virtual ~TComPrediction();
[1313]148
149  Void    initTempBuff(ChromaFormat chromaFormatIDC);
150
151  ChromaFormat getChromaFormat() const { return m_cYuvPredTemp.getChromaFormat(); }
152
[2]153  // inter
[608]154  Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 );
[1313]155
[2]156  // motion vector prediction
[608]157  Void getMvPredAMVP              ( TComDataCU* pcCU, UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, TComMv& rcMvPred );
[1313]158
[2]159  // Angular Intra
[1313]160  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 );
161
162  Pel  predIntraGetPredValDC      ( const Pel* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight);
163#if NH_3D_DMM
164  Void predIntraLumaDmm           ( TComDataCU* pcCU, UInt uiAbsPartIdx, DmmID dmmType, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight );
165  Void predContourFromTex         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool* segPattern );
166  Void predBiSegDCs               ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool* biSegPattern, Int patternStride, Pel& predDC1, Pel& predDC2 );
167  Void assignBiSegDCs             ( Pel* ptrDst, UInt dstStride, Bool* biSegPattern, Int patternStride, Pel valDC1, Pel valDC2 );
[608]168#endif
[1313]169#if NH_3D_SDC_INTRA
170  Void predConstantSDC            ( Pel* ptrSrc, UInt srcStride, UInt uiSize, Pel& predDC );
[608]171#endif
[833]172 
[1313]173#if NH_3D_DBBP
[1179]174  PartSize      getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize, TComDataCU*& pcCU);
175  Bool          getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask, TComDataCU*& pcCU);
[1313]176  Void          combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize, Int bitDepthY );
[833]177#endif
[608]178
[1313]179  Pel  predIntraGetPredValDC      ( const Pel* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft );
[56]180
[1313]181  Pel*  getPredictorPtr           ( const ComponentID compID, const Bool bUseFilteredPredictions )
182  {
183    return m_piYuvExt[compID][bUseFilteredPredictions?PRED_BUF_FILTERED:PRED_BUF_UNFILTERED];
184  }
185
186  // This function is actually still in TComPattern.cpp
187  /// set parameters from CU data for accessing intra data
188  Void initIntraPatternChType ( TComTU &rTu,
189                              const ComponentID compID, const Bool bFilterRefSamples
190                              DEBUG_STRING_FN_DECLARE(sDebug)
191                              );
192
193  static Bool filteringIntraReferenceSamples(const ComponentID compID, UInt uiDirMode, UInt uiTuChWidth, UInt uiTuChHeight, const ChromaFormat chFmt, const Bool intraReferenceSmoothingDisabled);
194
195  static Bool UseDPCMForFirstPassIntraEstimation(TComTU &rTu, const UInt uiDirMode);
[2]196};
197
[56]198//! \}
[2]199
200#endif // __TCOMPREDICTION__
Note: See TracBrowser for help on using the repository browser.