source: 3DVCSoftware/branches/HTM-14.1-update-dev4-Qualcomm/source/Lib/TLibCommon/TComPrediction.h @ 1262

Last change on this file since 1262 was 1262, checked in by qualcomm, 9 years ago
  1. enable ARP by NH_3D_ARP with simulation results included; 2. address Gerhard's comments on setBaseViewRefPicList; 3. align the software with the specification of checking the correct reference picture list proposed in JCT3V-F105
  • Property svn:eol-style set to native
File size: 10.4 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
[1200]4 * granted under this license.
[5]5 *
[1200]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
[1200]43#include "TComYuv.h"
[56]44#include "TComInterpolationFilter.h"
45#include "TComWeightPrediction.h"
[1262]46#if NH_3D_ARP
47#include "TComPic.h"
48#endif
[1200]49// forward declaration
50class TComMv;
51class TComTU; 
52
[56]53//! \ingroup TLibCommon
54//! \{
55
[2]56// ====================================================================================================================
57// Class definition
58// ====================================================================================================================
59
60/// prediction class
[1200]61typedef enum PRED_BUF_E
62{
63  PRED_BUF_UNFILTERED=0,
64  PRED_BUF_FILTERED=1,
65  NUM_PRED_BUF=2
66} PRED_BUF;
67
68static const UInt MAX_INTRA_FILTER_DEPTHS=5;
69
[56]70class TComPrediction : public TComWeightPrediction
[2]71{
[1200]72private:
73  static const UChar m_aucIntraFilter[MAX_NUM_CHANNEL_TYPE][MAX_INTRA_FILTER_DEPTHS];
74
[2]75protected:
[1200]76  Pel*      m_piYuvExt[MAX_NUM_COMPONENT][NUM_PRED_BUF];
77  Int       m_iYuvExtSize;
78
79  TComYuv   m_acYuvPred[NUM_REF_PIC_LIST_01];
[2]80  TComYuv   m_cYuvPredTemp;
[1262]81#if NH_3D_ARP
[443]82  TComYuv   m_acYuvPredBase[2];
83#endif
[1200]84  TComYuv m_filteredBlock[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS];
85  TComYuv m_filteredBlockTmp[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS];
86
[56]87  TComInterpolationFilter m_if;
[1200]88
89  Pel*   m_pLumaRecBuffer;       ///< array for downsampled reconstructed luma sample
[56]90  Int    m_iLumaRecStride;       ///< stride of #m_pLumaRecBuffer array
[608]91#if H_3D_IC
92  UInt   m_uiaShift[ 64 ];       // Table for multiplication to substitue of division operation
93#endif
[2]94
[608]95#if H_3D_VSP
[884]96  Int*    m_pDepthBlock;         ///< Store a depth block, local variable, to prevent memory allocation every time
97  TComYuv m_cYuvDepthOnVsp;
[296]98#endif
99
[1200]100  Void xPredIntraAng            ( Int bitDepth, const Pel* pSrc, Int srcStride, Pel* pDst, Int dstStride, UInt width, UInt height, ChannelType channelType, UInt dirMode, Bool blkAboveAvailable, Bool blkLeftAvailable, const Bool bEnableEdgeFilters );
101  Void xPredIntraPlanar         ( const Pel* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height );
102
[2]103  // motion compensation functions
[1262]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 );
107  Bool xCheckBiInterviewARP     ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc ); 
[443]108#endif
[1200]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          );
[608]112#if H_3D_VSP
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
[1200]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
[1262]118#if NH_3D_ARP
[608]119    , Bool filterType = false
[296]120#endif
[608]121#if H_3D_IC
122    , Bool bICFlag    = false
[296]123#endif
[1200]124 );
[332]125
[1262]126
[608]127#if H_3D_IC
128    , Bool bICFlag    = false
[443]129#endif
[608]130#if H_3D_VSP
[833]131  Void xPredInterUniSubPU        ( TComDataCU *cu, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU=4, Int heightSubPU=4 );
[189]132#endif
[1200]133
134  Void xWeightedAverage         ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv* pcYuvDst, const BitDepths &clipBitDepths  );
135
136  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) );
[608]137#if H_3D_IC
138  Void xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, TextType eType );
[443]139#endif
[1200]140  Void xDCPredFiltering( const Pel* pSrc, Int iSrcStride, Pel* pDst, Int iDstStride, Int iWidth, Int iHeight, ChannelType channelType );
[56]141  Bool xCheckIdenticalMotion    ( TComDataCU* pcCU, UInt PartAddr);
[773]142#if H_3D_SPIVMP
[724]143  Bool xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 );
144  Void xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr );
145#endif
[608]146#if H_3D_DIM
147  // depth intra functions
148  Void xPredBiSegDCs            ( Int* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& predDC1, Pel& predDC2 );
149  Void xAssignBiSegDCs          ( Pel* ptrDst, UInt dstStride, Bool* biSegPattern, Int patternStride, Pel   valDC1, Pel   valDC2 );
150#if H_3D_DIM_DMM
151  UInt xPredWedgeFromTex        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx );
152  Void xPredContourFromTex      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge );
153  Void xCopyTextureLumaBlock    ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piDestBlockY, UInt uiWidth, UInt uiHeight );
[5]154#endif
155#endif
[2]156
[1200]157  Void destroy();
158
[2]159public:
160  TComPrediction();
161  virtual ~TComPrediction();
[1200]162
163  Void    initTempBuff(ChromaFormat chromaFormatIDC);
164
165  ChromaFormat getChromaFormat() const { return m_cYuvPredTemp.getChromaFormat(); }
166
[2]167  // inter
[608]168  Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 );
[1200]169
[2]170  // motion vector prediction
[608]171  Void getMvPredAMVP              ( TComDataCU* pcCU, UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, TComMv& rcMvPred );
[1200]172
[2]173  // Angular Intra
[1200]174  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 );
175
[608]176#if H_3D_DIM
177  // Depth intra
[833]178  Void predIntraLumaDepth         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc = false 
179    , TComWedgelet* dmm4Segmentation = NULL
180    );
[608]181#if H_3D_DIM_SDC
182  Void analyzeSegmentsSDC         ( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride
183                                    ,UInt uiIntraMode
184                                    ,Bool orgDC=false
185    );
186#endif
187#endif
[833]188 
[1222]189#if NH_3D_DBBP
[1179]190  PartSize      getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize, TComDataCU*& pcCU);
191  Bool          getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask, TComDataCU*& pcCU);
[1222]192  Void          combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize, Int bitDepthY );
[833]193#endif
[608]194
[1200]195  Pel  predIntraGetPredValDC      ( const Pel* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft );
[56]196
[1200]197  Pel*  getPredictorPtr           ( const ComponentID compID, const Bool bUseFilteredPredictions )
198  {
199    return m_piYuvExt[compID][bUseFilteredPredictions?PRED_BUF_FILTERED:PRED_BUF_UNFILTERED];
200  }
201
202  // This function is actually still in TComPattern.cpp
203  /// set parameters from CU data for accessing intra data
204  Void initIntraPatternChType ( TComTU &rTu,
205                              Bool&       bAbove,
206                              Bool&       bLeft,
207                              const ComponentID compID, const Bool bFilterRefSamples
208                              DEBUG_STRING_FN_DECLARE(sDebug)
209                              );
210
211  static Bool filteringIntraReferenceSamples(const ComponentID compID, UInt uiDirMode, UInt uiTuChWidth, UInt uiTuChHeight, const ChromaFormat chFmt, const Bool intraReferenceSmoothingDisabled);
212
213  static Bool UseDPCMForFirstPassIntraEstimation(TComTU &rTu, const UInt uiDirMode);
[2]214};
215
[56]216//! \}
[2]217
218#endif // __TCOMPREDICTION__
Note: See TracBrowser for help on using the repository browser.