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