source: SHVCSoftware/branches/SHM-dev/source/Lib/TLibCommon/TComPrediction.h @ 1263

Last change on this file since 1263 was 1262, checked in by seregin, 9 years ago

port rev 4259

  • Property svn:eol-style set to native
File size: 7.0 KB
RevLine 
[313]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
[1029]4 * granted under this license.
[313]5 *
[1259]6 * Copyright (c) 2010-2015, ITU/ISO/IEC
[313]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     TComPrediction.h
35    \brief    prediction class (header)
36*/
37
38#ifndef __TCOMPREDICTION__
39#define __TCOMPREDICTION__
40
41
42// Include files
[1262]43#include "TComYuv.h"
[313]44#include "TComInterpolationFilter.h"
45#include "TComWeightPrediction.h"
46
[1262]47// forward declaration
48class TComMv;
49class TComTU; 
[1029]50
[815]51#if SVC_EXTENSION
[313]52#include "TComUpsampleFilter.h"
53#endif
54//! \ingroup TLibCommon
55//! \{
56
57// ====================================================================================================================
58// Class definition
59// ====================================================================================================================
60
61/// prediction class
[1029]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
[313]71class TComPrediction : public TComWeightPrediction
72{
[1029]73private:
74  static const UChar m_aucIntraFilter[MAX_NUM_CHANNEL_TYPE][MAX_INTRA_FILTER_DEPTHS];
75
[313]76protected:
[1029]77  Pel*      m_piYuvExt[MAX_NUM_COMPONENT][NUM_PRED_BUF];
78  Int       m_iYuvExtSize;
79
80  TComYuv   m_acYuvPred[NUM_REF_PIC_LIST_01];
[313]81  TComYuv   m_cYuvPredTemp;
[1029]82  TComYuv m_filteredBlock[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS];
83  TComYuv m_filteredBlockTmp[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS];
84
[313]85  TComInterpolationFilter m_if;
86
[1029]87  Pel*   m_pLumaRecBuffer;       ///< array for downsampled reconstructed luma sample
[313]88  Int    m_iLumaRecStride;       ///< stride of #m_pLumaRecBuffer array
89
[1029]90  Void xPredIntraAng            ( Int bitDepth, const Pel* pSrc, Int srcStride, Pel* pDst, Int dstStride, UInt width, UInt height, ChannelType channelType, ChromaFormat format, UInt dirMode, Bool blkAboveAvailable, Bool blkLeftAvailable, const Bool bEnableEdgeFilters );
91  Void xPredIntraPlanar         ( const Pel* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height, ChannelType channelType, ChromaFormat format );
92
[313]93  // motion compensation functions
[1029]94  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv* pcYuvPred, Bool bi=false          );
95  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv* pcYuvPred          );
96  Void xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi );
97  Void xWeightedAverage         ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv* pcYuvDst );
[313]98
[1029]99  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) );
100
101  Void xDCPredFiltering( const Pel* pSrc, Int iSrcStride, Pel* pDst, Int iDstStride, Int iWidth, Int iHeight, ChannelType channelType );
[313]102  Bool xCheckIdenticalMotion    ( TComDataCU* pcCU, UInt PartAddr);
[1029]103  Void destroy();
104
[815]105#if SVC_EXTENSION
106  TComUpsampleFilter      m_cUsf;
107#endif
[313]108
109public:
110  TComPrediction();
111  virtual ~TComPrediction();
[345]112
[1029]113  Void    initTempBuff(ChromaFormat chromaFormatIDC);
114
115  ChromaFormat getChromaFormat() const { return m_cYuvPredTemp.getChromaFormat(); }
116
[313]117  // inter
118  Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 );
[1029]119
[313]120  // motion vector prediction
121  Void getMvPredAMVP              ( TComDataCU* pcCU, UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, TComMv& rcMvPred );
[1029]122
[313]123  // Angular Intra
[1029]124  Void predIntraAng               ( const ComponentID compID, UInt uiDirMode, Pel *piOrg /* Will be null for decoding */, UInt uiOrgStride, Pel* piPred, UInt uiStride, TComTU &rTu, Bool bAbove, Bool bLeft, const Bool bUseFilteredPredSamples, const Bool bUseLosslessDPCM = false );
[313]125
[1029]126  Pel  predIntraGetPredValDC      ( const Pel* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, ChannelType channelType, ChromaFormat format, Bool bAbove, Bool bLeft );
127
128  Pel*  getPredictorPtr           ( const ComponentID compID, const Bool bUseFilteredPredictions )
129  {
130    return m_piYuvExt[compID][bUseFilteredPredictions?PRED_BUF_FILTERED:PRED_BUF_UNFILTERED];
131  }
132
133  // This function is actually still in TComPattern.cpp
134  /// set parameters from CU data for accessing ADI data
135  Void initAdiPatternChType ( TComTU &rTu,
136                              Bool&       bAbove,
137                              Bool&       bLeft,
138                              const ComponentID compID, const Bool bFilterRefSamples
139                              DEBUG_STRING_FN_DECLARE(sDebug)
140                              );
141
142  static Bool filteringIntraReferenceSamples(const ComponentID compID, UInt uiDirMode, UInt uiTuChWidth, UInt uiTuChHeight, const ChromaFormat chFmt, const Bool intraReferenceSmoothingDisabled);
143
144  static Bool UseDPCMForFirstPassIntraEstimation(TComTU &rTu, const UInt uiDirMode);
145
[442]146#if SVC_EXTENSION
[944]147Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );
[494]148#endif //SVC_EXTENSION
[313]149};
150
151//! \}
152
153#endif // __TCOMPREDICTION__
Note: See TracBrowser for help on using the repository browser.