[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 | * |
---|
[56] | 6 | * Copyright (c) 2010-2012, 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 TComPattern.h |
---|
| 35 | \brief neighbouring pixel access classes (header) |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #ifndef __TCOMPATTERN__ |
---|
| 39 | #define __TCOMPATTERN__ |
---|
| 40 | |
---|
| 41 | // Include files |
---|
| 42 | #include <stdio.h> |
---|
| 43 | #include "CommonDef.h" |
---|
| 44 | |
---|
[56] | 45 | //! \ingroup TLibCommon |
---|
| 46 | //! \{ |
---|
| 47 | |
---|
[2] | 48 | // ==================================================================================================================== |
---|
| 49 | // Class definition |
---|
| 50 | // ==================================================================================================================== |
---|
| 51 | |
---|
| 52 | class TComDataCU; |
---|
| 53 | |
---|
| 54 | /// neighbouring pixel access class for one component |
---|
| 55 | class TComPatternParam |
---|
| 56 | { |
---|
| 57 | private: |
---|
| 58 | Int m_iOffsetLeft; |
---|
| 59 | Int m_iOffsetRight; |
---|
| 60 | Int m_iOffsetAbove; |
---|
| 61 | Int m_iOffsetBottom; |
---|
| 62 | Pel* m_piPatternOrigin; |
---|
| 63 | |
---|
| 64 | public: |
---|
| 65 | Int m_iROIWidth; |
---|
| 66 | Int m_iROIHeight; |
---|
| 67 | Int m_iPatternStride; |
---|
| 68 | |
---|
| 69 | /// return starting position of buffer |
---|
| 70 | Pel* getPatternOrigin() { return m_piPatternOrigin; } |
---|
| 71 | |
---|
| 72 | /// return starting position of ROI (ROI = &pattern[AboveOffset][LeftOffset]) |
---|
| 73 | __inline Pel* getROIOrigin() |
---|
| 74 | { |
---|
| 75 | return m_piPatternOrigin + m_iPatternStride * m_iOffsetAbove + m_iOffsetLeft; |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | /// set parameters from Pel buffer for accessing neighbouring pixels |
---|
| 79 | Void setPatternParamPel ( Pel* piTexture, |
---|
| 80 | Int iRoiWidth, |
---|
| 81 | Int iRoiHeight, |
---|
| 82 | Int iStride, |
---|
| 83 | Int iOffsetLeft, |
---|
| 84 | Int iOffsetRight, |
---|
| 85 | Int iOffsetAbove, |
---|
| 86 | Int iOffsetBottom ); |
---|
| 87 | |
---|
| 88 | /// set parameters of one color component from CU data for accessing neighbouring pixels |
---|
| 89 | Void setPatternParamCU ( TComDataCU* pcCU, |
---|
| 90 | UChar iComp, |
---|
| 91 | UChar iRoiWidth, |
---|
| 92 | UChar iRoiHeight, |
---|
| 93 | Int iOffsetLeft, |
---|
| 94 | Int iOffsetRight, |
---|
| 95 | Int iOffsetAbove, |
---|
| 96 | Int iOffsetBottom, |
---|
| 97 | UInt uiPartDepth, |
---|
[56] | 98 | UInt uiAbsZorderIdx |
---|
[5] | 99 | #if DEPTH_MAP_GENERATION |
---|
[56] | 100 | ,Bool bPrdDepthMap = false |
---|
| 101 | #endif |
---|
| 102 | ); |
---|
[2] | 103 | }; |
---|
| 104 | |
---|
| 105 | /// neighbouring pixel access class for all components |
---|
| 106 | class TComPattern |
---|
| 107 | { |
---|
| 108 | private: |
---|
| 109 | TComPatternParam m_cPatternY; |
---|
| 110 | TComPatternParam m_cPatternCb; |
---|
| 111 | TComPatternParam m_cPatternCr; |
---|
[56] | 112 | |
---|
[152] | 113 | #if LGE_ILLUCOMP_B0045 |
---|
| 114 | Bool m_bICFlag; |
---|
| 115 | #endif |
---|
| 116 | |
---|
[56] | 117 | #if LOGI_INTRA_NAME_3MPM |
---|
| 118 | static const UChar m_aucIntraFilter[5]; |
---|
| 119 | #else |
---|
| 120 | static const UChar m_aucIntraFilter[5][NUM_INTRA_MODE]; |
---|
[2] | 121 | #endif |
---|
[56] | 122 | |
---|
[2] | 123 | public: |
---|
| 124 | |
---|
| 125 | // ROI & pattern information, (ROI = &pattern[AboveOffset][LeftOffset]) |
---|
| 126 | Pel* getROIY() { return m_cPatternY.getROIOrigin(); } |
---|
| 127 | Int getROIYWidth() { return m_cPatternY.m_iROIWidth; } |
---|
| 128 | Int getROIYHeight() { return m_cPatternY.m_iROIHeight; } |
---|
| 129 | Int getPatternLStride() { return m_cPatternY.m_iPatternStride; } |
---|
| 130 | |
---|
[152] | 131 | #if LGE_ILLUCOMP_B0045 |
---|
| 132 | Bool getICFlag() { return m_bICFlag; } |
---|
| 133 | Void setICFlag(Bool bICFlag) { m_bICFlag = bICFlag; } |
---|
| 134 | #endif |
---|
| 135 | |
---|
[2] | 136 | // access functions of ADI buffers |
---|
| 137 | Int* getAdiOrgBuf ( Int iCuWidth, Int iCuHeight, Int* piAdiBuf ); |
---|
| 138 | Int* getAdiCbBuf ( Int iCuWidth, Int iCuHeight, Int* piAdiBuf ); |
---|
| 139 | Int* getAdiCrBuf ( Int iCuWidth, Int iCuHeight, Int* piAdiBuf ); |
---|
| 140 | |
---|
[56] | 141 | Int* getPredictorPtr ( UInt uiDirMode, UInt uiWidthBits, Int* piAdiBuf ); |
---|
[2] | 142 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 143 | // initialization functions |
---|
| 144 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 145 | |
---|
| 146 | /// set parameters from Pel buffers for accessing neighbouring pixels |
---|
| 147 | Void initPattern ( Pel* piY, |
---|
[56] | 148 | Pel* piCb, |
---|
| 149 | Pel* piCr, |
---|
| 150 | Int iRoiWidth, |
---|
| 151 | Int iRoiHeight, |
---|
| 152 | Int iStride, |
---|
| 153 | Int iOffsetLeft, |
---|
| 154 | Int iOffsetRight, |
---|
| 155 | Int iOffsetAbove, |
---|
| 156 | Int iOffsetBottom ); |
---|
[2] | 157 | |
---|
| 158 | /// set parameters from CU data for accessing neighbouring pixels |
---|
| 159 | Void initPattern ( TComDataCU* pcCU, |
---|
[56] | 160 | UInt uiPartDepth, |
---|
| 161 | UInt uiAbsPartIdx |
---|
[5] | 162 | #if DEPTH_MAP_GENERATION |
---|
| 163 | ,Bool bPrdDepthMap = false |
---|
| 164 | #endif |
---|
| 165 | ); |
---|
[2] | 166 | |
---|
| 167 | /// set luma parameters from CU data for accessing ADI data |
---|
| 168 | Void initAdiPattern ( TComDataCU* pcCU, |
---|
[56] | 169 | UInt uiZorderIdxInPart, |
---|
| 170 | UInt uiPartDepth, |
---|
| 171 | Int* piAdiBuf, |
---|
| 172 | Int iOrgBufStride, |
---|
| 173 | Int iOrgBufHeight, |
---|
| 174 | Bool& bAbove, |
---|
| 175 | Bool& bLeft |
---|
| 176 | ,Bool bLMmode = false // using for LM chroma or not |
---|
[5] | 177 | #if DEPTH_MAP_GENERATION |
---|
[56] | 178 | , |
---|
| 179 | Bool bPrdDepthMap = false, |
---|
| 180 | UInt uiSubSampExpX = 0, |
---|
| 181 | UInt uiSubSampExpY = 0 |
---|
[5] | 182 | #endif |
---|
| 183 | ); |
---|
[2] | 184 | |
---|
| 185 | /// set chroma parameters from CU data for accessing ADI data |
---|
| 186 | Void initAdiPatternChroma ( TComDataCU* pcCU, |
---|
| 187 | UInt uiZorderIdxInPart, |
---|
| 188 | UInt uiPartDepth, |
---|
| 189 | Int* piAdiBuf, |
---|
| 190 | Int iOrgBufStride, |
---|
| 191 | Int iOrgBufHeight, |
---|
| 192 | Bool& bAbove, |
---|
| 193 | Bool& bLeft ); |
---|
| 194 | |
---|
| 195 | private: |
---|
| 196 | |
---|
| 197 | /// padding of unavailable reference samples for intra prediction |
---|
[56] | 198 | Void fillReferenceSamples ( TComDataCU* pcCU, Pel* piRoiOrigin, Int* piAdiTemp, Bool* bNeighborFlags, Int iNumIntraNeighbor, Int iUnitSize, Int iNumUnitsInCu, Int iTotalUnits, UInt uiCuWidth, UInt uiCuHeight, UInt uiWidth, UInt uiHeight, Int iPicStride, Bool bLMmode = false |
---|
[5] | 199 | #if DEPTH_MAP_GENERATION |
---|
[56] | 200 | , Bool bPrdDepthMap = false |
---|
[2] | 201 | #endif |
---|
[5] | 202 | ); |
---|
[56] | 203 | |
---|
| 204 | |
---|
[2] | 205 | /// constrained intra prediction |
---|
[56] | 206 | Bool isAboveLeftAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT ); |
---|
| 207 | Int isAboveAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags ); |
---|
| 208 | Int isLeftAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags ); |
---|
| 209 | Int isAboveRightAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags ); |
---|
| 210 | Int isBelowLeftAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags ); |
---|
| 211 | |
---|
[2] | 212 | }; |
---|
| 213 | |
---|
[56] | 214 | //! \} |
---|
| 215 | |
---|
[2] | 216 | #endif // __TCOMPATTERN__ |
---|