Changeset 1390 in 3DVCSoftware for branches/HTM-16.0-MV-draft-5/source/Lib/TLibRenderer/TRenSingleModel.h
- Timestamp:
- 13 Nov 2015, 17:00:20 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-16.0-MV-draft-5/source/Lib/TLibRenderer/TRenSingleModel.h
r1313 r1390 51 51 #include <cstring> 52 52 53 #if NH_3D_VSO54 using namespace std;55 56 #if H_3D_VSO_RM_ASSERTIONS57 #define RM_AOT( exp ) AOT ( exp )58 #define RM_AOF( exp ) AOF ( exp )59 #else60 #define RM_AOT( exp ) ((void)0)61 #define RM_AOF( exp ) ((void)0)62 #endif63 64 #define RenModRemoveBitInc( exp ) bBitInc ? ( RemoveBitIncrement( exp ) ) : ( exp )65 66 class TRenSingleModel67 {68 public:69 70 virtual ~TRenSingleModel() { }71 #if H_3D_VSO_EARLY_SKIP72 virtual Void create ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip ) = 0;73 #else74 virtual Void create ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode ) = 0;75 #endif76 77 // Set Frame dependent data78 virtual Void setLRView ( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride ) = 0;79 virtual Void setupPart ( UInt uiHorOffset, Int iUsedHeight ) = 0;80 virtual Void setup ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, Bool bKeepReference ) = 0;81 82 // Set Data83 #if H_3D_VSO_EARLY_SKIP84 virtual Void setDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel* piOrgData, Int iOrgStride ) = 0;85 #else86 virtual Void setDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ) = 0;87 #endif88 virtual Void setVideo ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ) = 0;89 90 // Get Distortion91 #if H_3D_VSO_EARLY_SKIP92 virtual RMDist getDistDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel * piOrgData , Int iOrgStride)=0;93 #else94 virtual RMDist getDistDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ) = 0;95 #endif96 virtual RMDist getDistVideo ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ) = 0;97 98 virtual Void getSynthVideo ( Int iViewPos, TComPicYuv* pcPicYuv ) = 0;99 virtual Void getSynthDepth ( Int iViewPos, TComPicYuv* pcPicYuv ) = 0;100 virtual Void getRefVideo ( Int iViewPos, TComPicYuv* pcPicYuv ) = 0;101 };102 103 template < BlenMod iBM, Bool bBitInc >104 class TRenSingleModelC : public TRenSingleModel105 {106 struct RenModelInPels107 {108 // video109 Pel aiY[5] ; // y-value110 #if H_3D_VSO_COLOR_PLANES111 Pel aiU[5] ; // u-value112 Pel aiV[5] ; // v-value113 #endif114 // depth115 Pel iD ; // depth116 117 // state118 Bool bOccluded; // Occluded119 };120 121 struct RenModelOutPels122 {123 // video124 Pel iYLeft ;125 Pel iYRight ;126 Pel iYBlended ;127 #if H_3D_VSO_COLOR_PLANES128 Pel iULeft ;129 Pel iURight ;130 Pel iUBlended ;131 Pel iVLeft ;132 Pel iVRight ;133 Pel iVBlended ;134 #endif135 // depth136 Pel iDLeft ;137 Pel iDRight ;138 Pel iDBlended ;139 140 // state141 Int iFilledLeft ;142 Int iFilledRight;143 144 // error145 Int iError ;146 147 // reference148 Pel iYRef ;149 #if H_3D_VSO_COLOR_PLANES150 Pel iURef ;151 Pel iVRef ;152 #endif153 };154 155 156 157 public:158 TRenSingleModelC();159 ~TRenSingleModelC();160 161 // Create Model162 #if H_3D_VSO_EARLY_SKIP163 Void create ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip );164 #else165 Void create ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode );166 #endif167 168 // Set Frame dependent data169 Void setLRView ( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride );170 Void setupPart ( UInt uiHorOffset, Int uiUsedHeight );171 Void setup ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, Bool bKeepReference );172 173 #if H_3D_VSO_EARLY_SKIP174 Void setDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel* piOrgData, Int iOrgStride );175 #else176 Void setDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData );177 #endif178 Void setVideo ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData );179 180 // Get Distortion181 #if H_3D_VSO_EARLY_SKIP182 RMDist getDistDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel * piOrgData , Int iOrgStride);183 #else184 RMDist getDistDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData );185 #endif186 RMDist getDistVideo ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData );187 188 Void getSynthVideo ( Int iViewPos, TComPicYuv* pcPicYuv );189 Void getSynthDepth ( Int iViewPos, TComPicYuv* pcPicYuv );190 Void getRefVideo ( Int iViewPos, TComPicYuv* pcPicYuv );191 192 private:193 // Set and inc Current Row194 __inline Void xSetViewRow( Int iPosY );195 __inline Void xIncViewRow();196 197 ///// Rendering /////198 // Left to Right199 #if H_3D_VSO_EARLY_SKIP200 __inline Bool xDetectEarlySkipL ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel* piOrgData, Int iOrgStride );201 __inline Bool xDetectEarlySkipR ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel* piOrgData, Int iOrgStride );202 template<Bool bSet> __inline RMDist xRenderL ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, Bool bFast );203 template<Bool bSet> __inline RMDist xRenderR ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, Bool bFast );204 #else205 template<Bool bSet> __inline RMDist xRenderR ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData );206 template<Bool bSet> __inline RMDist xRenderL ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData );207 #endif208 __inline Void xInitRenderPartL ( Int iEndChangePos, Int iLastSPos );209 template<Bool bSet> __inline Void xRenderRangeL ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );210 template<Bool bSet> __inline Void xRenderShiftedRangeL( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );211 template<Bool bSet> __inline Void xFillHoleL ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );212 template<Bool bSet> __inline Void xExtrapolateMarginL ( Int iCurSPos, Int iCurPos, RMDist& riError );213 __inline Int xRangeLeftL ( Int iPos );214 __inline Int xRangeRightL ( Int iPos );215 __inline Int xRoundL ( Int iPos );216 217 // Right to Left218 __inline Void xInitRenderPartR ( Int iStartChangePos, Int iLastSPos );219 template<Bool bSet> __inline Void xRenderShiftedRangeR( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );220 template<Bool bSet> __inline Void xRenderRangeR ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );221 template<Bool bSet> __inline Void xFillHoleR ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );222 template<Bool bSet> __inline Void xExtrapolateMarginR ( Int iCurSPos, Int iCurPos, RMDist& riError );223 __inline Int xRangeLeftR ( Int iPos );224 __inline Int xRangeRightR ( Int iPos );225 __inline Int xRoundR ( Int iPos );226 227 // Blending228 template<Bool bSet> __inline Void xSetShiftedPelBlend ( Int iSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError );229 230 #if H_3D_VSO_COLOR_PLANES231 __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 );232 __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 );233 __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 );234 #else235 __inline Void xGetBlendedValue ( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY );236 __inline Void xGetBlendedValueBM1 ( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY );237 __inline Void xGetBlendedValueBM2 ( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY );238 #endif239 __inline Pel xBlend ( Pel pVal1, Pel pVal2, Int iWeightVal2 );240 241 // General242 template<Bool bSet> __inline Void xSetShiftedPelL (Int iSourcePos, Int iSubSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError );243 template<Bool bSet> __inline Void xSetShiftedPelBlendL (RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );244 template<Bool bSet> __inline Void xSetShiftedPelNoBlendL(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );245 246 template<Bool bSet> __inline Void xSetShiftedPelR (Int iSourcePos, Int iSubSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError );247 template<Bool bSet> __inline Void xSetShiftedPelBlendR (RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );248 template<Bool bSet> __inline Void xSetShiftedPelNoBlendR(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );249 250 __inline Int xShiftNewData ( Int iPos, Int iPosInNewData );251 __inline Int xShift ( Int iPos );252 __inline Int xShift ( Int iPos, Int iPosInNewData );253 __inline Int xGetDist ( Int iDiffY, Int iDiffU, Int iDiffV );254 __inline Int xGetDist ( Int iDiffY );255 256 // Utilities257 __inline Void xSetPels ( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal );258 __inline Void xSetBools ( Bool* pbSource , Int iSourceStride, Int iWidth, Int iHeight, Bool bVal );259 __inline Void xSetInts ( Int* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Int iVal );260 261 #if H_3D_VSO_COLOR_PLANES262 Void xGetSampleStrTextPtrs ( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY, Pel RenModelOutPels::*& rpiSrcU, Pel RenModelOutPels::*& rpiSrcV );263 #else264 Void xGetSampleStrTextPtrs ( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY );265 #endif266 Void xGetSampleStrDepthPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcD );267 268 Void xSetStructRefView ();269 Void xResetStructError ();270 Void xInitSampleStructs ();271 Void xSetStructSynthViewAsRefView ();272 Void xCopy2PicYuv ( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget );273 274 template< typename S, typename T>275 Void xCopyFromSampleStruct ( S* ptSource , Int iSourceStride, T S::* ptSourceElement, T* ptTarget, Int iTargetStride, Int iWidth, Int iHeight )276 {277 AOT( iWidth != m_iWidth );278 for (Int iPosY = 0; iPosY < iHeight; iPosY++)279 {280 for (Int iPosX = 0; iPosX < m_iWidth; iPosX++)281 {282 ptTarget[iPosX] = ptSource[iPosX].*ptSourceElement;283 }284 ptSource += iSourceStride;285 ptTarget += iTargetStride;286 }287 }288 289 template< typename S, typename T>290 Void xCopyToSampleStruct ( T* ptSource , Int iSourceStride, S* ptTarget, Int iTargetStride, T S::* ptSourceElement, Int iWidth, Int iHeight )291 {292 AOT( iWidth != m_iWidth );293 for (Int iPosY = 0; iPosY < iHeight; iPosY++)294 {295 for (Int iPosX = 0; iPosX < m_iWidth; iPosX++)296 {297 ptTarget[iPosX] = ptSource[iPosX].*ptSourceElement;298 }299 ptSource += iSourceStride;300 ptTarget += iTargetStride;301 }302 }303 304 private:305 306 // Image sizes307 Int m_iWidth;308 Int m_iHeight;309 Int m_iStride;310 Int m_iPad;311 Int m_iUsedHeight;312 Int m_iHorOffset;313 314 Int m_iSampledWidth;315 Int m_iSampledStride;316 317 RenModelInPels* m_pcInputSamples[2];318 Int m_iInputSamplesStride;319 320 // Base321 Pel** m_aapiBaseVideoPel [2]; // Dim1: ViewPosition 0->Left, 1->Right; Dim2: Plane 0-> Y, 1->U, 2->V322 Int* m_aaiBaseVideoStrides [2]; // Dim1: ViewPosition 0->Left, 1->Right; Dim2: Plane 0-> Y, 1->U, 2->V323 324 Pel* m_apiBaseDepthPel [2]; // Dim1: ViewPosition325 Int m_aiBaseDepthStrides [2]; // Dim1: ViewPosition326 327 328 // LUT329 Int** m_appiShiftLut [2];330 Int** m_ppiCurLUT;331 Int** m_aaiSubPelShiftL;332 Int** m_aaiSubPelShiftR;333 334 Int* m_piInvZLUTLeft;335 Int* m_piInvZLUTRight;336 337 338 //// Reference Data ////339 TComPicYuv* m_pcPicYuvRef ; // Reference PIcYuv340 341 //// Output Samples342 RenModelOutPels* m_pcOutputSamples;343 Int m_iOutputSamplesStride;344 345 Pel* m_aapiRefVideoPel [3]; // Dim1: Plane 0-> Y, 1->U, 2->V346 Int m_aiRefVideoStrides [3]; // Dim1: Plane 0-> Y, 1->U, 2->V347 348 // Rendering State349 Bool m_bInOcclusion; // Currently rendering in occluded area350 Int m_iLastOccludedSPos; // Position of last topmost shifted position351 Int m_iLastOccludedSPosFP; // Position of last topmost shifted position in FullPels352 353 Int m_iCurViewPos; // Current View Position 0: Left, 1: Right354 Int m_iOtherViewPos; // Other View Position 0: Left, 1: Right355 const Pel* m_piNewDepthData; // Pointer to new depth data356 Int m_iStartChangePosX; // Start Position of new data357 Int m_iNewDataWidth; // Width of new data358 Pel m_iCurDepth; // Current Depth Value359 Pel m_iLastDepth; // Last Depth Value360 Pel m_iThisDepth; // Depth value to use for setting361 362 //// Settings ////363 // Input364 Int m_iMode; // 0: Left to Right, 1: Right to Left, 2: Merge365 Bool m_bUseOrgRef;366 Int m_iShiftPrec;367 Int m_iHoleMargin;368 #if H_3D_VSO_EARLY_SKIP369 Bool m_bEarlySkip;370 #endif371 372 // Derived settings373 Int m_iGapTolerance;374 Int m_iBlendZThres;375 Int m_iBlendDistWeight;376 377 //// Current Pointers ////378 379 RenModelInPels* m_pcInputSamplesRow [2];380 RenModelOutPels* m_pcOutputSamplesRow;381 382 //// MISC ////383 const Int m_iDistShift; // Shift in Distortion computation384 385 //// Early Skip386 #if H_3D_VSO_EARLY_SKIP387 Bool* m_pbHorSkip;388 #endif389 };390 391 #endif // NH_3D392 53 #endif //__TRENSINGLEMODEL__ 393 54
Note: See TracChangeset for help on using the changeset viewer.