| 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-2011, 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 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 | #if !QC_MVHEVC_B0046 |
|---|
| 35 | #ifndef __TRENSINGLEMODEL__ |
|---|
| 36 | #define __TRENSINGLEMODEL__ |
|---|
| 37 | |
|---|
| 38 | #include "TRenImage.h" |
|---|
| 39 | #include "../TLibCommon/CommonDef.h" |
|---|
| 40 | #include "../TLibCommon/TComPicYuv.h" |
|---|
| 41 | #include "../TLibCommon/TypeDef.h" |
|---|
| 42 | #include "../TAppCommon/TAppComCamPara.h" |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | #include <math.h> |
|---|
| 46 | #include <errno.h> |
|---|
| 47 | #include <iostream> |
|---|
| 48 | |
|---|
| 49 | #include <string> |
|---|
| 50 | #include <cstdio> |
|---|
| 51 | #include <cstring> |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | using namespace std; |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | #if HHI_VSO_RM_ASSERTIONS |
|---|
| 58 | #define RM_AOT( exp ) AOT ( exp ) |
|---|
| 59 | #define RM_AOF( exp ) AOF ( exp ) |
|---|
| 60 | #else |
|---|
| 61 | #define RM_AOT( exp ) ((void)0) |
|---|
| 62 | #define RM_AOF( exp ) ((void)0) |
|---|
| 63 | #endif |
|---|
| 64 | |
|---|
| 65 | #define RenModRemoveBitInc( exp ) bBitInc ? ( RemoveBitIncrement( exp ) ) : ( exp ) |
|---|
| 66 | |
|---|
| 67 | class TRenSingleModel |
|---|
| 68 | { |
|---|
| 69 | public: |
|---|
| 70 | |
|---|
| 71 | virtual ~TRenSingleModel() { } |
|---|
| 72 | #if LGE_VSO_EARLY_SKIP_A0093 |
|---|
| 73 | virtual Void create ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip ) = 0; |
|---|
| 74 | #else |
|---|
| 75 | virtual Void create ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode ) = 0; |
|---|
| 76 | #endif |
|---|
| 77 | |
|---|
| 78 | // Set Frame dependent data |
|---|
| 79 | virtual Void setLRView ( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride ) = 0; |
|---|
| 80 | virtual Void setupPart ( UInt uiHorOffset, Int iUsedHeight ) = 0; |
|---|
| 81 | virtual Void setup ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, Bool bKeepReference ) = 0; |
|---|
| 82 | |
|---|
| 83 | // Set Data |
|---|
| 84 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
|---|
| 85 | virtual Void setDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel* piOrgData, Int iOrgStride ) = 0; |
|---|
| 86 | #else |
|---|
| 87 | virtual Void setDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) = 0; |
|---|
| 88 | #endif |
|---|
| 89 | virtual Void setVideo ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) = 0; |
|---|
| 90 | |
|---|
| 91 | // Get Distortion |
|---|
| 92 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
|---|
| 93 | virtual RMDist getDistDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData , Int iOrgStride)=0; |
|---|
| 94 | #else |
|---|
| 95 | virtual RMDist getDistDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) = 0; |
|---|
| 96 | #endif |
|---|
| 97 | virtual RMDist getDistVideo ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) = 0; |
|---|
| 98 | |
|---|
| 99 | virtual Void getSynthVideo ( Int iViewPos, TComPicYuv* pcPicYuv ) = 0; |
|---|
| 100 | virtual Void getSynthDepth ( Int iViewPos, TComPicYuv* pcPicYuv ) = 0; |
|---|
| 101 | virtual Void getRefVideo ( Int iViewPos, TComPicYuv* pcPicYuv ) = 0; |
|---|
| 102 | }; |
|---|
| 103 | |
|---|
| 104 | template < BlenMod iBM, Bool bBitInc > |
|---|
| 105 | class TRenSingleModelC : public TRenSingleModel |
|---|
| 106 | { |
|---|
| 107 | struct RenModelInPels |
|---|
| 108 | { |
|---|
| 109 | // video |
|---|
| 110 | Pel aiY[5] ; // y-value |
|---|
| 111 | #if HHI_VSO_COLOR_PLANES |
|---|
| 112 | Pel aiU[5] ; // u-value |
|---|
| 113 | Pel aiV[5] ; // v-value |
|---|
| 114 | #endif |
|---|
| 115 | // depth |
|---|
| 116 | Pel iD ; // depth |
|---|
| 117 | |
|---|
| 118 | // state |
|---|
| 119 | Bool bOccluded; // Occluded |
|---|
| 120 | }; |
|---|
| 121 | |
|---|
| 122 | struct RenModelOutPels |
|---|
| 123 | { |
|---|
| 124 | // video |
|---|
| 125 | Pel iYLeft ; |
|---|
| 126 | Pel iYRight ; |
|---|
| 127 | Pel iYBlended ; |
|---|
| 128 | #if HHI_VSO_COLOR_PLANES |
|---|
| 129 | Pel iULeft ; |
|---|
| 130 | Pel iURight ; |
|---|
| 131 | Pel iUBlended ; |
|---|
| 132 | Pel iVLeft ; |
|---|
| 133 | Pel iVRight ; |
|---|
| 134 | Pel iVBlended ; |
|---|
| 135 | #endif |
|---|
| 136 | // depth |
|---|
| 137 | Pel iDLeft ; |
|---|
| 138 | Pel iDRight ; |
|---|
| 139 | Pel iDBlended ; |
|---|
| 140 | |
|---|
| 141 | // state |
|---|
| 142 | Int iFilledLeft ; |
|---|
| 143 | Int iFilledRight; |
|---|
| 144 | |
|---|
| 145 | // error |
|---|
| 146 | Int iError ; |
|---|
| 147 | |
|---|
| 148 | // reference |
|---|
| 149 | Pel iYRef ; |
|---|
| 150 | #if HHI_VSO_COLOR_PLANES |
|---|
| 151 | Pel iURef ; |
|---|
| 152 | Pel iVRef ; |
|---|
| 153 | #endif |
|---|
| 154 | }; |
|---|
| 155 | |
|---|
| 156 | |
|---|
| 157 | |
|---|
| 158 | public: |
|---|
| 159 | TRenSingleModelC(); |
|---|
| 160 | ~TRenSingleModelC(); |
|---|
| 161 | |
|---|
| 162 | // Create Model |
|---|
| 163 | #if LGE_VSO_EARLY_SKIP_A0093 |
|---|
| 164 | Void create ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip ); |
|---|
| 165 | #else |
|---|
| 166 | Void create ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode ); |
|---|
| 167 | #endif |
|---|
| 168 | |
|---|
| 169 | // Set Frame dependent data |
|---|
| 170 | Void setLRView ( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride ); |
|---|
| 171 | Void setupPart ( UInt uiHorOffset, Int uiUsedHeight ); |
|---|
| 172 | Void setup ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, Bool bKeepReference ); |
|---|
| 173 | |
|---|
| 174 | #if LGE_VSO_EARLY_SKIP_A0093 |
|---|
| 175 | Void setDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel* piOrgData, Int iOrgStride ); |
|---|
| 176 | #else |
|---|
| 177 | Void setDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ); |
|---|
| 178 | #endif |
|---|
| 179 | Void setVideo ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ); |
|---|
| 180 | |
|---|
| 181 | // Get Distortion |
|---|
| 182 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
|---|
| 183 | RMDist getDistDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData , Int iOrgStride); |
|---|
| 184 | #else |
|---|
| 185 | RMDist getDistDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ); |
|---|
| 186 | #endif |
|---|
| 187 | RMDist getDistVideo ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ); |
|---|
| 188 | |
|---|
| 189 | Void getSynthVideo ( Int iViewPos, TComPicYuv* pcPicYuv ); |
|---|
| 190 | Void getSynthDepth ( Int iViewPos, TComPicYuv* pcPicYuv ); |
|---|
| 191 | Void getRefVideo ( Int iViewPos, TComPicYuv* pcPicYuv ); |
|---|
| 192 | |
|---|
| 193 | private: |
|---|
| 194 | // Set and inc Current Row |
|---|
| 195 | __inline Void xSetViewRow( Int iPosY ); |
|---|
| 196 | __inline Void xIncViewRow(); |
|---|
| 197 | |
|---|
| 198 | ///// Rendering ///// |
|---|
| 199 | // Left to Right |
|---|
| 200 | #if LGE_VSO_EARLY_SKIP_A0093 |
|---|
| 201 | __inline Bool xDetectEarlySkipL ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride ); |
|---|
| 202 | __inline Bool xDetectEarlySkipR ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride ); |
|---|
| 203 | template<Bool bSet> __inline RMDist xRenderL ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bFast ); |
|---|
| 204 | template<Bool bSet> __inline RMDist xRenderR ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bFast ); |
|---|
| 205 | #else |
|---|
| 206 | template<Bool bSet> __inline RMDist xRenderR ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ); |
|---|
| 207 | template<Bool bSet> __inline RMDist xRenderL ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ); |
|---|
| 208 | #endif |
|---|
| 209 | __inline Void xInitRenderPartL ( Int iEndChangePos, Int iLastSPos ); |
|---|
| 210 | template<Bool bSet> __inline Void xRenderRangeL ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ); |
|---|
| 211 | template<Bool bSet> __inline Void xRenderShiftedRangeL( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ); |
|---|
| 212 | template<Bool bSet> __inline Void xFillHoleL ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ); |
|---|
| 213 | template<Bool bSet> __inline Void xExtrapolateMarginL ( Int iCurSPos, Int iCurPos, RMDist& riError ); |
|---|
| 214 | __inline Int xRangeLeftL ( Int iPos ); |
|---|
| 215 | __inline Int xRangeRightL ( Int iPos ); |
|---|
| 216 | __inline Int xRoundL ( Int iPos ); |
|---|
| 217 | |
|---|
| 218 | // Right to Left |
|---|
| 219 | __inline Void xInitRenderPartR ( Int iStartChangePos, Int iLastSPos ); |
|---|
| 220 | template<Bool bSet> __inline Void xRenderShiftedRangeR( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ); |
|---|
| 221 | template<Bool bSet> __inline Void xRenderRangeR ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ); |
|---|
| 222 | template<Bool bSet> __inline Void xFillHoleR ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ); |
|---|
| 223 | template<Bool bSet> __inline Void xExtrapolateMarginR ( Int iCurSPos, Int iCurPos, RMDist& riError ); |
|---|
| 224 | __inline Int xRangeLeftR ( Int iPos ); |
|---|
| 225 | __inline Int xRangeRightR ( Int iPos ); |
|---|
| 226 | __inline Int xRoundR ( Int iPos ); |
|---|
| 227 | |
|---|
| 228 | // Blending |
|---|
| 229 | template<Bool bSet> __inline Void xSetShiftedPelBlend ( Int iSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError ); |
|---|
| 230 | |
|---|
| 231 | #if HHI_VSO_COLOR_PLANES |
|---|
| 232 | __inline Void xGetBlendedValue ( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV ); |
|---|
| 233 | __inline Void xGetBlendedValueBM1 ( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV ); |
|---|
| 234 | __inline Void xGetBlendedValueBM2 ( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV ); |
|---|
| 235 | #else |
|---|
| 236 | __inline Void xGetBlendedValue ( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY ); |
|---|
| 237 | __inline Void xGetBlendedValueBM1 ( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY ); |
|---|
| 238 | __inline Void xGetBlendedValueBM2 ( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY ); |
|---|
| 239 | #endif |
|---|
| 240 | __inline Pel xBlend ( Pel pVal1, Pel pVal2, Int iWeightVal2 ); |
|---|
| 241 | |
|---|
| 242 | // General |
|---|
| 243 | template<Bool bSet> __inline Void xSetShiftedPelL (Int iSourcePos, Int iSubSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError ); |
|---|
| 244 | template<Bool bSet> __inline Void xSetShiftedPelBlendL (RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError ); |
|---|
| 245 | template<Bool bSet> __inline Void xSetShiftedPelNoBlendL(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError ); |
|---|
| 246 | |
|---|
| 247 | template<Bool bSet> __inline Void xSetShiftedPelR (Int iSourcePos, Int iSubSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError ); |
|---|
| 248 | template<Bool bSet> __inline Void xSetShiftedPelBlendR (RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError ); |
|---|
| 249 | template<Bool bSet> __inline Void xSetShiftedPelNoBlendR(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError ); |
|---|
| 250 | |
|---|
| 251 | __inline Int xShiftNewData ( Int iPos, Int iPosInNewData ); |
|---|
| 252 | __inline Int xShift ( Int iPos ); |
|---|
| 253 | __inline Int xShift ( Int iPos, Int iPosInNewData ); |
|---|
| 254 | __inline Int xGetDist ( Int iDiffY, Int iDiffU, Int iDiffV ); |
|---|
| 255 | __inline Int xGetDist ( Int iDiffY ); |
|---|
| 256 | |
|---|
| 257 | // Utilities |
|---|
| 258 | __inline Void xSetPels ( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal ); |
|---|
| 259 | __inline Void xSetBools ( Bool* pbSource , Int iSourceStride, Int iWidth, Int iHeight, Bool bVal ); |
|---|
| 260 | __inline Void xSetInts ( Int* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Int iVal ); |
|---|
| 261 | |
|---|
| 262 | #if HHI_VSO_COLOR_PLANES |
|---|
| 263 | Void xGetSampleStrTextPtrs ( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY, Pel RenModelOutPels::*& rpiSrcU, Pel RenModelOutPels::*& rpiSrcV ); |
|---|
| 264 | #else |
|---|
| 265 | Void xGetSampleStrTextPtrs ( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY ); |
|---|
| 266 | #endif |
|---|
| 267 | Void xGetSampleStrDepthPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcD ); |
|---|
| 268 | |
|---|
| 269 | Void xSetStructRefView (); |
|---|
| 270 | Void xResetStructError (); |
|---|
| 271 | Void xInitSampleStructs (); |
|---|
| 272 | Void xSetStructSynthViewAsRefView (); |
|---|
| 273 | Void xCopy2PicYuv ( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget ); |
|---|
| 274 | |
|---|
| 275 | template< typename S, typename T> |
|---|
| 276 | Void xCopyFromSampleStruct ( S* ptSource , Int iSourceStride, T S::* ptSourceElement, T* ptTarget, Int iTargetStride, Int iWidth, Int iHeight ) |
|---|
| 277 | { |
|---|
| 278 | AOT( iWidth != m_iWidth ); |
|---|
| 279 | for (Int iPosY = 0; iPosY < iHeight; iPosY++) |
|---|
| 280 | { |
|---|
| 281 | for (Int iPosX = 0; iPosX < m_iWidth; iPosX++) |
|---|
| 282 | { |
|---|
| 283 | ptTarget[iPosX] = ptSource[iPosX].*ptSourceElement; |
|---|
| 284 | } |
|---|
| 285 | ptSource += iSourceStride; |
|---|
| 286 | ptTarget += iTargetStride; |
|---|
| 287 | } |
|---|
| 288 | } |
|---|
| 289 | |
|---|
| 290 | template< typename S, typename T> |
|---|
| 291 | Void xCopyToSampleStruct ( T* ptSource , Int iSourceStride, S* ptTarget, Int iTargetStride, T S::* ptSourceElement, Int iWidth, Int iHeight ) |
|---|
| 292 | { |
|---|
| 293 | AOT( iWidth != m_iWidth ); |
|---|
| 294 | for (Int iPosY = 0; iPosY < iHeight; iPosY++) |
|---|
| 295 | { |
|---|
| 296 | for (Int iPosX = 0; iPosX < m_iWidth; iPosX++) |
|---|
| 297 | { |
|---|
| 298 | ptTarget[iPosX] = ptSource[iPosX].*ptSourceElement; |
|---|
| 299 | } |
|---|
| 300 | ptSource += iSourceStride; |
|---|
| 301 | ptTarget += iTargetStride; |
|---|
| 302 | } |
|---|
| 303 | } |
|---|
| 304 | |
|---|
| 305 | private: |
|---|
| 306 | |
|---|
| 307 | // Image sizes |
|---|
| 308 | Int m_iWidth; |
|---|
| 309 | Int m_iHeight; |
|---|
| 310 | Int m_iStride; |
|---|
| 311 | Int m_iPad; |
|---|
| 312 | Int m_iUsedHeight; |
|---|
| 313 | Int m_iHorOffset; |
|---|
| 314 | |
|---|
| 315 | Int m_iSampledWidth; |
|---|
| 316 | Int m_iSampledStride; |
|---|
| 317 | |
|---|
| 318 | RenModelInPels* m_pcInputSamples[2]; |
|---|
| 319 | Int m_iInputSamplesStride; |
|---|
| 320 | |
|---|
| 321 | // Base |
|---|
| 322 | Pel** m_aapiBaseVideoPel [2]; // Dim1: ViewPosition 0->Left, 1->Right; Dim2: Plane 0-> Y, 1->U, 2->V |
|---|
| 323 | Int* m_aaiBaseVideoStrides [2]; // Dim1: ViewPosition 0->Left, 1->Right; Dim2: Plane 0-> Y, 1->U, 2->V |
|---|
| 324 | |
|---|
| 325 | Pel* m_apiBaseDepthPel [2]; // Dim1: ViewPosition |
|---|
| 326 | Int m_aiBaseDepthStrides [2]; // Dim1: ViewPosition |
|---|
| 327 | |
|---|
| 328 | |
|---|
| 329 | // LUT |
|---|
| 330 | Int** m_appiShiftLut [2]; |
|---|
| 331 | Int** m_ppiCurLUT; |
|---|
| 332 | Int** m_aaiSubPelShiftL; |
|---|
| 333 | Int** m_aaiSubPelShiftR; |
|---|
| 334 | |
|---|
| 335 | Int* m_piInvZLUTLeft; |
|---|
| 336 | Int* m_piInvZLUTRight; |
|---|
| 337 | |
|---|
| 338 | |
|---|
| 339 | //// Reference Data //// |
|---|
| 340 | TComPicYuv* m_pcPicYuvRef ; // Reference PIcYuv |
|---|
| 341 | |
|---|
| 342 | //// Output Samples |
|---|
| 343 | RenModelOutPels* m_pcOutputSamples; |
|---|
| 344 | Int m_iOutputSamplesStride; |
|---|
| 345 | |
|---|
| 346 | Pel* m_aapiRefVideoPel [3]; // Dim1: Plane 0-> Y, 1->U, 2->V |
|---|
| 347 | Int m_aiRefVideoStrides [3]; // Dim1: Plane 0-> Y, 1->U, 2->V |
|---|
| 348 | |
|---|
| 349 | // Rendering State |
|---|
| 350 | Bool m_bInOcclusion; // Currently rendering in occluded area |
|---|
| 351 | Int m_iLastOccludedSPos; // Position of last topmost shifted position |
|---|
| 352 | Int m_iLastOccludedSPosFP; // Position of last topmost shifted position in FullPels |
|---|
| 353 | |
|---|
| 354 | Int m_iCurViewPos; // Current View Position 0: Left, 1: Right |
|---|
| 355 | Int m_iOtherViewPos; // Other View Position 0: Left, 1: Right |
|---|
| 356 | Pel* m_piNewDepthData; // Pointer to new depth data |
|---|
| 357 | Int m_iStartChangePosX; // Start Position of new data |
|---|
| 358 | Int m_iNewDataWidth; // Width of new data |
|---|
| 359 | Pel m_iCurDepth; // Current Depth Value |
|---|
| 360 | Pel m_iLastDepth; // Last Depth Value |
|---|
| 361 | Pel m_iThisDepth; // Depth value to use for setting |
|---|
| 362 | |
|---|
| 363 | //// Settings //// |
|---|
| 364 | // Input |
|---|
| 365 | Int m_iMode; // 0: Left to Right, 1: Right to Left, 2: Merge |
|---|
| 366 | Bool m_bUseOrgRef; |
|---|
| 367 | Int m_iShiftPrec; |
|---|
| 368 | Int m_iHoleMargin; |
|---|
| 369 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
|---|
| 370 | Bool m_bEarlySkip; |
|---|
| 371 | #endif |
|---|
| 372 | |
|---|
| 373 | // Derived settings |
|---|
| 374 | Int m_iGapTolerance; |
|---|
| 375 | Int m_iBlendZThres; |
|---|
| 376 | Int m_iBlendDistWeight; |
|---|
| 377 | |
|---|
| 378 | //// Current Pointers //// |
|---|
| 379 | |
|---|
| 380 | RenModelInPels* m_pcInputSamplesRow [2]; |
|---|
| 381 | RenModelOutPels* m_pcOutputSamplesRow; |
|---|
| 382 | |
|---|
| 383 | //// MISC //// |
|---|
| 384 | const Int m_iDistShift; // Shift in Distortion computation |
|---|
| 385 | |
|---|
| 386 | //// Early Skip |
|---|
| 387 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
|---|
| 388 | Bool* m_pbHorSkip; |
|---|
| 389 | #endif |
|---|
| 390 | }; |
|---|
| 391 | |
|---|
| 392 | #endif //__TRENSINGLEMODEL__ |
|---|
| 393 | #endif |
|---|
| 394 | |
|---|