[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 |
---|
| 4 | * granted under this license. |
---|
| 5 | * |
---|
[595] | 6 | * Copyright (c) 2010-2014, 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 |
---|
| 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 | #if SVC_UPSAMPLING |
---|
| 51 | #include "TComUpsampleFilter.h" |
---|
| 52 | #endif |
---|
| 53 | //! \ingroup TLibCommon |
---|
| 54 | //! \{ |
---|
| 55 | |
---|
| 56 | // ==================================================================================================================== |
---|
| 57 | // Class definition |
---|
| 58 | // ==================================================================================================================== |
---|
| 59 | |
---|
| 60 | /// prediction class |
---|
| 61 | class TComPrediction : public TComWeightPrediction |
---|
| 62 | { |
---|
| 63 | protected: |
---|
| 64 | Int* m_piYuvExt; |
---|
| 65 | Int m_iYuvExtStride; |
---|
| 66 | Int m_iYuvExtHeight; |
---|
| 67 | |
---|
| 68 | TComYuv m_acYuvPred[2]; |
---|
| 69 | TComYuv m_cYuvPredTemp; |
---|
| 70 | TComYuv m_filteredBlock[4][4]; |
---|
| 71 | TComYuv m_filteredBlockTmp[4]; |
---|
| 72 | |
---|
| 73 | TComInterpolationFilter m_if; |
---|
| 74 | |
---|
| 75 | #if SVC_UPSAMPLING |
---|
| 76 | TComUpsampleFilter m_cUsf; |
---|
| 77 | #endif |
---|
| 78 | |
---|
| 79 | Pel* m_pLumaRecBuffer; ///< array for downsampled reconstructed luma sample |
---|
| 80 | Int m_iLumaRecStride; ///< stride of #m_pLumaRecBuffer array |
---|
| 81 | |
---|
| 82 | Void xPredIntraAng (Int bitDepth, Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height, UInt dirMode, Bool blkAboveAvailable, Bool blkLeftAvailable, Bool bFilter ); |
---|
| 83 | Void xPredIntraPlanar ( Int* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height ); |
---|
| 84 | |
---|
| 85 | // motion compensation functions |
---|
| 86 | Void xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false ); |
---|
| 87 | Void xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred ); |
---|
| 88 | Void xPredInterLumaBlk ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi ); |
---|
| 89 | Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi ); |
---|
| 90 | Void xWeightedAverage ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst ); |
---|
| 91 | |
---|
| 92 | Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 ); |
---|
| 93 | |
---|
| 94 | Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight ); |
---|
| 95 | Bool xCheckIdenticalMotion ( TComDataCU* pcCU, UInt PartAddr); |
---|
| 96 | |
---|
| 97 | public: |
---|
| 98 | TComPrediction(); |
---|
| 99 | virtual ~TComPrediction(); |
---|
| 100 | |
---|
| 101 | Void initTempBuff(); |
---|
[345] | 102 | |
---|
[313] | 103 | // inter |
---|
| 104 | Void motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 ); |
---|
| 105 | |
---|
| 106 | // motion vector prediction |
---|
| 107 | Void getMvPredAMVP ( TComDataCU* pcCU, UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, TComMv& rcMvPred ); |
---|
| 108 | |
---|
| 109 | // Angular Intra |
---|
| 110 | Void predIntraLumaAng ( TComPattern* pcTComPattern, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft ); |
---|
| 111 | Void predIntraChromaAng ( Int* piSrc, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft ); |
---|
| 112 | |
---|
| 113 | Pel predIntraGetPredValDC ( Int* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft ); |
---|
| 114 | |
---|
| 115 | Int* getPredicBuf() { return m_piYuvExt; } |
---|
| 116 | Int getPredicBufWidth() { return m_iYuvExtStride; } |
---|
| 117 | Int getPredicBufHeight() { return m_iYuvExtHeight; } |
---|
| 118 | |
---|
[442] | 119 | #if SVC_EXTENSION |
---|
[313] | 120 | #if SVC_UPSAMPLING |
---|
[494] | 121 | #if O0215_PHASE_ALIGNMENT |
---|
| 122 | #if O0194_JOINT_US_BITSHIFT |
---|
[644] | 123 | Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, Bool phaseAlignFlag ); |
---|
[313] | 124 | #else |
---|
[644] | 125 | Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, Bool phaseAlignFlag ); |
---|
[313] | 126 | #endif |
---|
[494] | 127 | #else |
---|
| 128 | #if O0194_JOINT_US_BITSHIFT |
---|
| 129 | Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ); |
---|
| 130 | #else |
---|
| 131 | Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ); |
---|
[313] | 132 | #endif |
---|
[345] | 133 | #endif |
---|
[494] | 134 | #endif |
---|
| 135 | #endif //SVC_EXTENSION |
---|
[313] | 136 | }; |
---|
| 137 | |
---|
| 138 | //! \} |
---|
| 139 | |
---|
| 140 | #endif // __TCOMPREDICTION__ |
---|