[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 |
---|
[56] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[608] | 6 | * Copyright (c) 2010-2013, 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 |
---|
| 43 | #include "TComPic.h" |
---|
| 44 | #include "TComMotionInfo.h" |
---|
| 45 | #include "TComPattern.h" |
---|
| 46 | #include "TComTrQuant.h" |
---|
[56] | 47 | #include "TComInterpolationFilter.h" |
---|
| 48 | #include "TComWeightPrediction.h" |
---|
| 49 | |
---|
| 50 | //! \ingroup TLibCommon |
---|
| 51 | //! \{ |
---|
| 52 | |
---|
[2] | 53 | // ==================================================================================================================== |
---|
| 54 | // Class definition |
---|
| 55 | // ==================================================================================================================== |
---|
| 56 | |
---|
| 57 | /// prediction class |
---|
[56] | 58 | class TComPrediction : public TComWeightPrediction |
---|
[2] | 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; |
---|
[608] | 67 | #if H_3D_ARP |
---|
[443] | 68 | TComYuv m_acYuvPredBase[2]; |
---|
| 69 | #endif |
---|
[56] | 70 | TComYuv m_filteredBlock[4][4]; |
---|
| 71 | TComYuv m_filteredBlockTmp[4]; |
---|
[2] | 72 | |
---|
[56] | 73 | TComInterpolationFilter m_if; |
---|
| 74 | |
---|
| 75 | Pel* m_pLumaRecBuffer; ///< array for downsampled reconstructed luma sample |
---|
| 76 | Int m_iLumaRecStride; ///< stride of #m_pLumaRecBuffer array |
---|
[608] | 77 | #if H_3D_IC |
---|
| 78 | #if SHARP_ILLUCOMP_REFINE_E0046 |
---|
| 79 | UInt m_uiaShift[ 64 ]; // Table for multiplication to substitue of division operation |
---|
| 80 | #else |
---|
[56] | 81 | UInt m_uiaShift[ 63 ]; // Table for multiplication to substitue of division operation |
---|
[608] | 82 | #endif |
---|
| 83 | #endif |
---|
[2] | 84 | |
---|
[608] | 85 | #if H_3D_VSP |
---|
| 86 | Int* m_pDepthBlock; ///< Store a depth block, local variable, to prevent memory allocation every time |
---|
| 87 | #if H_3D_VSP_CONSTRAINED |
---|
| 88 | Int xGetConstrainedSize(Int nPbW, Int nPbH, Bool bLuma = true); |
---|
[296] | 89 | #endif |
---|
[608] | 90 | #if NTT_VSP_COMMON_E0207_E0208 |
---|
| 91 | TComYuv m_cYuvDepthOnVsp; |
---|
[443] | 92 | #endif |
---|
[608] | 93 | #endif |
---|
[296] | 94 | |
---|
[608] | 95 | Void xPredIntraAng (Int bitDepth, Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height, UInt dirMode, Bool blkAboveAvailable, Bool blkLeftAvailable, Bool bFilter ); |
---|
[56] | 96 | Void xPredIntraPlanar ( Int* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height ); |
---|
[2] | 97 | |
---|
| 98 | // motion compensation functions |
---|
[608] | 99 | #if H_3D_ARP |
---|
| 100 | Void xPredInterUniARP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false, TComMvField * pNewMvFiled = NULL ); |
---|
[443] | 101 | #endif |
---|
[608] | 102 | Void xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false ); |
---|
| 103 | Void xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred ); |
---|
| 104 | #if H_3D_VSP |
---|
| 105 | Void xPredInterUniVSP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false ); |
---|
| 106 | Void xPredInterBiVSP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred ); |
---|
[296] | 107 | #endif |
---|
[56] | 108 | |
---|
[608] | 109 | Void xPredInterLumaBlk ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi |
---|
| 110 | #if H_3D_ARP |
---|
| 111 | , Bool filterType = false |
---|
[296] | 112 | #endif |
---|
[608] | 113 | #if H_3D_IC |
---|
| 114 | , Bool bICFlag = false |
---|
[296] | 115 | #endif |
---|
[608] | 116 | ); |
---|
| 117 | Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi |
---|
[332] | 118 | |
---|
[608] | 119 | #if H_3D_ARP |
---|
| 120 | , Bool filterType = false |
---|
[296] | 121 | #endif |
---|
[608] | 122 | #if H_3D_IC |
---|
| 123 | , Bool bICFlag = false |
---|
[443] | 124 | #endif |
---|
[608] | 125 | ); |
---|
[56] | 126 | |
---|
[608] | 127 | #if H_3D_VSP |
---|
| 128 | #if NTT_VSP_COMMON_E0207_E0208 |
---|
| 129 | Void xGetVirtualDepth ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int txtPerDepthX=1, Int txtPerDepthY=1 ); |
---|
| 130 | Void xPredInterLumaBlkFromDM ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi ); |
---|
| 131 | Void xPredInterChromaBlkFromDM ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi ); |
---|
[189] | 132 | #else |
---|
[608] | 133 | Void xPredInterLumaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv* dv, UInt partAddr, Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth, TComYuv *&dstPic, Bool bi ); |
---|
| 134 | Void xPredInterChromaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv* dv, UInt partAddr, Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth, TComYuv *&dstPic, Bool bi ); |
---|
[189] | 135 | #endif |
---|
[443] | 136 | #endif |
---|
| 137 | |
---|
[608] | 138 | Void xWeightedAverage ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst ); |
---|
| 139 | |
---|
| 140 | Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 ); |
---|
| 141 | #if H_3D_IC |
---|
| 142 | #if SHARP_ILLUCOMP_REFINE_E0046 |
---|
| 143 | Void xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, TextType eType ); |
---|
[443] | 144 | #else |
---|
[608] | 145 | Void xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, Int &iShift, TextType eType ); |
---|
[443] | 146 | #endif |
---|
[296] | 147 | #endif |
---|
[56] | 148 | Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight ); |
---|
| 149 | Bool xCheckIdenticalMotion ( TComDataCU* pcCU, UInt PartAddr); |
---|
[21] | 150 | |
---|
[608] | 151 | #if H_3D_DIM |
---|
| 152 | // depth intra functions |
---|
| 153 | Void xPredBiSegDCs ( Int* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& predDC1, Pel& predDC2 ); |
---|
| 154 | Void xAssignBiSegDCs ( Pel* ptrDst, UInt dstStride, Bool* biSegPattern, Int patternStride, Pel valDC1, Pel valDC2 ); |
---|
| 155 | #if H_3D_DIM_DMM |
---|
[622] | 156 | #if !SEC_DMM2_E0146_HHIFIX |
---|
[608] | 157 | UInt xPredWedgeFromIntra ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Int iDeltaEnd = 0 ); |
---|
[622] | 158 | #endif |
---|
[608] | 159 | UInt xPredWedgeFromTex ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx ); |
---|
| 160 | Void xPredContourFromTex ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge ); |
---|
[443] | 161 | |
---|
[608] | 162 | Void xCopyTextureLumaBlock ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piDestBlockY, UInt uiWidth, UInt uiHeight ); |
---|
| 163 | |
---|
[622] | 164 | #if !SEC_DMM2_E0146_HHIFIX |
---|
[608] | 165 | Void xGetBlockOffset ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComDataCU* pcRefCU, UInt uiRefAbsPartIdx, UInt& ruiOffsetX, UInt& ruiOffsetY ); |
---|
| 166 | Bool xGetWedgeIntraDirPredData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiBlockSize, Int& riSlopeX, Int& riSlopeY, UInt& ruiStartPosX, UInt& ruiStartPosY ); |
---|
| 167 | Void xGetWedgeIntraDirStartEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiBlockSize, Int iDeltaX, Int iDeltaY, UInt uiPMSPosX, UInt uiPMSPosY, UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, Int iDeltaEnd = 0 ); |
---|
| 168 | UInt xGetWedgePatternIdx ( UInt uiBlockSize, UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe ); |
---|
[5] | 169 | #endif |
---|
[622] | 170 | #endif |
---|
[608] | 171 | #if H_3D_DIM_RBC |
---|
| 172 | Void xDeltaDCQuantScaleUp ( TComDataCU* pcCU, Pel& rDeltaDC ); |
---|
| 173 | Void xDeltaDCQuantScaleDown ( TComDataCU* pcCU, Pel& rDeltaDC ); |
---|
[5] | 174 | #endif |
---|
[2] | 175 | #endif |
---|
| 176 | |
---|
| 177 | public: |
---|
| 178 | TComPrediction(); |
---|
| 179 | virtual ~TComPrediction(); |
---|
| 180 | |
---|
| 181 | Void initTempBuff(); |
---|
| 182 | |
---|
| 183 | // inter |
---|
[608] | 184 | Void motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 ); |
---|
| 185 | |
---|
[2] | 186 | // motion vector prediction |
---|
[608] | 187 | Void getMvPredAMVP ( TComDataCU* pcCU, UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, TComMv& rcMvPred ); |
---|
[2] | 188 | |
---|
| 189 | // Angular Intra |
---|
[608] | 190 | Void predIntraLumaAng ( TComPattern* pcTComPattern, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft ); |
---|
| 191 | Void predIntraChromaAng ( Int* piSrc, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft ); |
---|
[2] | 192 | |
---|
[608] | 193 | #if H_3D_DIM |
---|
| 194 | // Depth intra |
---|
| 195 | Void predIntraLumaDepth ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc = false ); |
---|
| 196 | #if H_3D_DIM_SDC |
---|
| 197 | Void analyzeSegmentsSDC ( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride |
---|
| 198 | #if KWU_SDC_SIMPLE_DC_E0117 |
---|
| 199 | ,UInt uiIntraMode |
---|
| 200 | ,Bool orgDC=false |
---|
| 201 | #endif |
---|
| 202 | ); |
---|
| 203 | #endif |
---|
| 204 | #endif |
---|
| 205 | |
---|
[56] | 206 | Pel predIntraGetPredValDC ( Int* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft ); |
---|
| 207 | |
---|
| 208 | Int* getPredicBuf() { return m_piYuvExt; } |
---|
| 209 | Int getPredicBufWidth() { return m_iYuvExtStride; } |
---|
| 210 | Int getPredicBufHeight() { return m_iYuvExtHeight; } |
---|
| 211 | |
---|
[2] | 212 | }; |
---|
| 213 | |
---|
[56] | 214 | //! \} |
---|
[2] | 215 | |
---|
| 216 | #endif // __TCOMPREDICTION__ |
---|