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-2015, 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 | |
---|
34 | /** \file TComPrediction.h |
---|
35 | \brief prediction class (header) |
---|
36 | */ |
---|
37 | |
---|
38 | #ifndef __TCOMPREDICTION__ |
---|
39 | #define __TCOMPREDICTION__ |
---|
40 | |
---|
41 | |
---|
42 | // Include files |
---|
43 | #include "TComPic.h" |
---|
44 | #include "TComMotionInfo.h" |
---|
45 | #include "TComPattern.h" |
---|
46 | #include "TComTrQuant.h" |
---|
47 | #include "TComInterpolationFilter.h" |
---|
48 | #include "TComWeightPrediction.h" |
---|
49 | |
---|
50 | //! \ingroup TLibCommon |
---|
51 | //! \{ |
---|
52 | |
---|
53 | // ==================================================================================================================== |
---|
54 | // Class definition |
---|
55 | // ==================================================================================================================== |
---|
56 | |
---|
57 | /// prediction class |
---|
58 | class TComPrediction : public TComWeightPrediction |
---|
59 | { |
---|
60 | protected: |
---|
61 | Int* m_piYuvExt; |
---|
62 | Int m_iYuvExtStride; |
---|
63 | Int m_iYuvExtHeight; |
---|
64 | |
---|
65 | TComYuv m_acYuvPred[2]; |
---|
66 | TComYuv m_cYuvPredTemp; |
---|
67 | #if H_3D_ARP |
---|
68 | TComYuv m_acYuvPredBase[2]; |
---|
69 | #endif |
---|
70 | TComYuv m_filteredBlock[4][4]; |
---|
71 | TComYuv m_filteredBlockTmp[4]; |
---|
72 | |
---|
73 | TComInterpolationFilter m_if; |
---|
74 | |
---|
75 | Pel* m_pLumaRecBuffer; ///< array for downsampled reconstructed luma sample |
---|
76 | Int m_iLumaRecStride; ///< stride of #m_pLumaRecBuffer array |
---|
77 | #if H_3D_IC |
---|
78 | UInt m_uiaShift[ 64 ]; // Table for multiplication to substitue of division operation |
---|
79 | #endif |
---|
80 | |
---|
81 | #if H_3D_VSP |
---|
82 | Int* m_pDepthBlock; ///< Store a depth block, local variable, to prevent memory allocation every time |
---|
83 | TComYuv m_cYuvDepthOnVsp; |
---|
84 | #endif |
---|
85 | |
---|
86 | Void xPredIntraAng (Int bitDepth, Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height, UInt dirMode, Bool blkAboveAvailable, Bool blkLeftAvailable, Bool bFilter ); |
---|
87 | Void xPredIntraPlanar ( Int* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height ); |
---|
88 | |
---|
89 | // motion compensation functions |
---|
90 | #if H_3D_ARP |
---|
91 | Void xPredInterUniARP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false, TComMvField * pNewMvFiled = NULL ); |
---|
92 | Bool xCheckBiInterviewARP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc ); |
---|
93 | Void xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled = NULL ); |
---|
94 | #endif |
---|
95 | Void xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false ); |
---|
96 | Void xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred ); |
---|
97 | #if H_3D_VSP |
---|
98 | Void xPredInterUniVSP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false ); |
---|
99 | Void xPredInterBiVSP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred ); |
---|
100 | #endif |
---|
101 | |
---|
102 | Void xPredInterLumaBlk ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi |
---|
103 | #if H_3D_ARP |
---|
104 | , Bool filterType = false |
---|
105 | #endif |
---|
106 | #if H_3D_IC |
---|
107 | , Bool bICFlag = false |
---|
108 | #endif |
---|
109 | ); |
---|
110 | Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi |
---|
111 | |
---|
112 | #if H_3D_ARP |
---|
113 | , Bool filterType = false |
---|
114 | #endif |
---|
115 | #if H_3D_IC |
---|
116 | , Bool bICFlag = false |
---|
117 | #endif |
---|
118 | ); |
---|
119 | |
---|
120 | #if H_3D_VSP |
---|
121 | Void xPredInterUniSubPU ( TComDataCU *cu, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU=4, Int heightSubPU=4 ); |
---|
122 | #endif |
---|
123 | Void xWeightedAverage ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst ); |
---|
124 | Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 ); |
---|
125 | #if H_3D_IC |
---|
126 | Void xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, TextType eType ); |
---|
127 | #endif |
---|
128 | Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight ); |
---|
129 | Bool xCheckIdenticalMotion ( TComDataCU* pcCU, UInt PartAddr); |
---|
130 | #if H_3D_SPIVMP |
---|
131 | Bool xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 ); |
---|
132 | Void xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr ); |
---|
133 | #endif |
---|
134 | #if H_3D_DIM |
---|
135 | // depth intra functions |
---|
136 | Void xPredBiSegDCs ( Int* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& predDC1, Pel& predDC2 ); |
---|
137 | Void xAssignBiSegDCs ( Pel* ptrDst, UInt dstStride, Bool* biSegPattern, Int patternStride, Pel valDC1, Pel valDC2 ); |
---|
138 | #if H_3D_DIM_DMM |
---|
139 | UInt xPredWedgeFromTex ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx ); |
---|
140 | Void xPredContourFromTex ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge ); |
---|
141 | Void xCopyTextureLumaBlock ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piDestBlockY, UInt uiWidth, UInt uiHeight ); |
---|
142 | #endif |
---|
143 | #endif |
---|
144 | |
---|
145 | public: |
---|
146 | TComPrediction(); |
---|
147 | virtual ~TComPrediction(); |
---|
148 | |
---|
149 | Void initTempBuff(); |
---|
150 | |
---|
151 | // inter |
---|
152 | Void motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 ); |
---|
153 | |
---|
154 | // motion vector prediction |
---|
155 | Void getMvPredAMVP ( TComDataCU* pcCU, UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, TComMv& rcMvPred ); |
---|
156 | |
---|
157 | // Angular Intra |
---|
158 | Void predIntraLumaAng ( TComPattern* pcTComPattern, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft ); |
---|
159 | Void predIntraChromaAng ( Int* piSrc, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft ); |
---|
160 | |
---|
161 | #if H_3D_DIM |
---|
162 | // Depth intra |
---|
163 | Void predIntraLumaDepth ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc = false |
---|
164 | , TComWedgelet* dmm4Segmentation = NULL |
---|
165 | ); |
---|
166 | #if H_3D_DIM_SDC |
---|
167 | Void analyzeSegmentsSDC ( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride |
---|
168 | ,UInt uiIntraMode |
---|
169 | ,Bool orgDC=false |
---|
170 | ); |
---|
171 | #endif |
---|
172 | #endif |
---|
173 | |
---|
174 | #if H_3D_DBBP |
---|
175 | PartSize getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize, TComDataCU*& pcCU); |
---|
176 | Bool getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask, TComDataCU*& pcCU); |
---|
177 | Void combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize ); |
---|
178 | #endif |
---|
179 | |
---|
180 | Pel predIntraGetPredValDC ( Int* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft ); |
---|
181 | |
---|
182 | Int* getPredicBuf() { return m_piYuvExt; } |
---|
183 | Int getPredicBufWidth() { return m_iYuvExtStride; } |
---|
184 | Int getPredicBufHeight() { return m_iYuvExtHeight; } |
---|
185 | |
---|
186 | }; |
---|
187 | |
---|
188 | //! \} |
---|
189 | |
---|
190 | #endif // __TCOMPREDICTION__ |
---|