source: 3DVCSoftware/branches/HTM-4.1-dev1-Intel/source/Lib/TLibRenderer/TRenTop.h @ 170

Last change on this file since 170 was 56, checked in by hschwarz, 13 years ago

updated trunk (move to HM6.1)

  • Property svn:eol-style set to native
File size: 12.4 KB
Line 
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#ifndef __TRENTOP__
35#define __TRENTOP__
36
37#include "TRenImage.h"
38#include "../TLibCommon/CommonDef.h"
39#include "../TLibCommon/TComPicYuv.h"
40#include <list>
41#include <vector>
42
43using namespace std;
44
45class TRenTop
46{
47// ENUM Modes
48
49
50  // Interpolation Modes
51
52  enum { eRenIntFullPel = 0, eRenIntLinInt = 1, eRenIntLinReal = 2, eRenIntFEM = 3, eRenInt8Tap = 4 };
53
54  // HoleFilling
55  enum { eRenHFNone = 0, eRenHFLWBackExt = 1};
56
57  // Pre-Processing
58  enum { eRenPreProNone = 0, eRenPreProBinom = 1};
59
60  // Post-Processing
61  enum { eRenPostProNone = 0, eRenPostProMed = 1};
62
63  // Merging
64  enum { eRenBlendAverg = 0, eRenBlendLeft = 1, eRenBlendRight = 2, eRenBlendDepthFirst = 5 };
65
66public:
67  TRenTop();
68  ~TRenTop();
69
70  // Init
71  Void init              ( UInt uiImageWitdh,
72                           UInt uiImageHeight,
73                           Bool bExtrapolate,
74                           UInt uiLog2SamplingFactor,
75                           Int  iLUTPrec,
76                           Bool bUVUp,
77                           Int  iPreProcMode,
78                           Int  iPreFilterKernelSize,
79                           Int  iBlendMode,
80                           Int  iBlendZThresPerc,
81                           Bool bBlendUseDistWeight,
82                           Int  iBlendHoleMargin,
83                           Int  iInterpolationMode,
84                           Int  iHoleFillingMode,
85                           Int  iPostProcMode,
86                           Int  iUsedPelMapMarExt );
87
88  Void setShiftLUTs      ( Double** ppdShiftLUTLeft,
89                           Int**    ppiShiftLUTLeft,
90                           Int**    ppiBaseShiftLUTLeft,
91                           Double** ppdShiftLUTRight,
92                           Int**    ppiShiftLUTRight,
93                           Int**    ppiBaseShiftLUTRight,
94                           Int      iRelDistLeft );
95
96  // View Synthesis
97  Void extrapolateView   ( TComPicYuv* pcPicYuvVideo,
98                           TComPicYuv* pcPicYuvDepth,
99                           TComPicYuv* pcPicYuvSynthOut,
100                           Bool bRenderFromLeft );
101
102  Void interpolateView   ( TComPicYuv* pcPicYuvVideoLeft,
103                           TComPicYuv* pcPicYuvDepthLeft,
104                           TComPicYuv* pcPicYuvVideoRight,
105                           TComPicYuv* pcPicYuvDepthRight,
106                           TComPicYuv* pcPicYuvSynthOut,
107                           Int         iBlendMode,
108                           Int         iSimEnhBaseView );
109  // Tools
110  Void getUsedSamplesMap ( TComPicYuv* pcPicYuvDepth,
111                           TComPicYuv* pcUsedSampleMap,
112                           Bool bRenderFromLeft );
113
114  // Zhejiang Temporal Improvement
115  Void temporalFilterVSRS( TComPicYuv* pcPicYuvVideoCur,
116                           TComPicYuv* pcPicYuvDepthCur,
117                           TComPicYuv* pcPicYuvVideoLast,
118                           TComPicYuv* pcPicYuvDepthLast,
119                           Bool bFirstFrame );
120
121private:
122  // Depth PreProcessing
123  Void xPreProcessDepth(PelImage* pcInImage, PelImage* pcOutImage);
124
125  // Pixel Shifting
126  Void xShiftPixels              ( PelImage*        pcInImage,     PelImage*      pcDepth     , PelImage*        pcOutImage    , PelImage*      pcFilledImage, Bool bShiftFromLeft  );
127  Void xShiftPlanePixels         ( PelImagePlane** apcInputPlanes, PelImagePlane* pcDepthPlane, PelImagePlane** apcOutputPlanes, PelImagePlane* pcPlaneFilled, UInt uiNumberOfPlanes);
128  Void xShiftPlanePixelsLinReal  ( PelImagePlane** apcInputPlanes, PelImagePlane* pcDepthPlane, PelImagePlane** apcOutputPlanes, PelImagePlane* pcPlaneFilled, UInt uiNumberOfPlanes);
129  Void xShiftPlanePixelsFullPel  ( PelImagePlane** apcInputPlanes, PelImagePlane* pcDepthPlane, PelImagePlane** apcOutputPlanes, PelImagePlane* pcPlaneFilled, UInt uiNumberOfPlanes);
130  Void xShiftPlanePixelsLinInt   ( PelImagePlane** apcInputPlanes, PelImagePlane* pcDepthPlane, PelImagePlane** apcOutputPlanes, PelImagePlane* pcFilledPlane, UInt uiNumberOfPlanes);
131  Void xShiftPlanePixels8Tap     ( PelImagePlane** apcInputPlanes, PelImagePlane* pcDepthPlane, PelImagePlane** apcOutputPlanes, PelImagePlane* pcFilledPlane, UInt uiNumberOfPlanes);
132
133  Void xBackShiftPixels          ( PelImage*            pcInImage, PelImage*      pcDepth     , PelImage*            pcOutImage, PelImage*      pcFilledImage, Bool bShiftFromLeft   );
134  Void xBackShiftPlanePixels     ( PelImagePlane** apcInputPlanes, PelImagePlane* pcDepthPlane, PelImagePlane** apcOutputPlanes, PelImagePlane* pcFilledPlane, UInt uiNumberOfPlanes );
135
136  Int  xCeil                     ( Int iVal ) { return (( iVal + ( (1 << m_iRelShiftLUTPrec) - 1 ) ) >> m_iRelShiftLUTPrec);  }
137
138  // Hole Filling
139  Void xFillHoles                ( PelImage*       pcInImage,      PelImage*      pcFilled,      PelImage*       pcOutImage                            , Bool bRenderFromLeft );
140  Void xFillLWBackExt            ( PelImage*       pcInImage,      PelImage*      pcFilled,      PelImage*       pcOutImage                            , Bool bRenderFromLeft );
141  Void xFillPlaneHoles           ( PelImagePlane** apcInputPlanes, PelImagePlane* pcPlaneFilled, PelImagePlane** apcOutputPlanes, UInt uiNumberOfPlanes, Bool bRenderFromLeft );
142
143  // Alpha Map Creation
144  Void xCreateAlphaMap           (PelImage* pcFilledImage,         PelImage*       pcAlphaMapImage, Bool bRenderFromLeft );
145  Void xCreateAlphaMapPlane      (PelImagePlane** apcFilledPlanes, PelImagePlane** apcAlphaPlanes,  UInt uiNumberOfPlanes, Bool bRenderFromLeft);
146
147  // BoundaryNoiseErosion
148  Void xRemBoundaryNoise            ( PelImage*       pcInImage,      PelImage*      pcFilled,      PelImage*       pcOutImage                            , Bool bRenderFromLeft );
149  Void xRemBoundaryNoisePlane       ( PelImagePlane** apcInputPlanes, PelImagePlane* pcPlaneFilled, PelImagePlane** apcOutputPlanes, UInt uiNumberOfPlanes, Bool bRenderFromLeft );
150
151  // Similarity Enhancement
152  Void xEnhSimilarity            ( PelImage*      pcLeftImage,   PelImage*        pcRightImage, PelImage*      pcFilledLeft,      PelImage*      pcFilledRight      );
153  Void xEnhSimilarityPlane       ( PelImagePlane** apcLeftPlane, PelImagePlane** apcRightPlane, PelImagePlane* pcFilledLeftPlane, PelImagePlane* pcFilledRightPlane, UInt uNumPlanes );
154
155  // View Blending
156  Void xBlend                    ( PelImage*       pcLeftImage,  PelImage*        pcRightImage, PelImage*      pcFilledLeft,      PelImage*      pcFilledRight,      PelImage* pcLeftDepth,           PelImage* pcRightDepth,           PelImage* pcOutputImage);
157  Void xBlendPlanesAvg           ( PelImagePlane** apcLeftPlane, PelImagePlane** apcRightPlane, PelImagePlane* pcFilledLeftPlane, PelImagePlane* pcFilledRightPlane, PelImagePlane* pcLeftDepthPlane, PelImagePlane* pcRightDepthPlane, PelImagePlane** apcOutputImagePlane, UInt uNumPlanes );
158  Void xBlendPlanesOneView       ( PelImagePlane** apcLeftPlane, PelImagePlane** apcRightPlane, PelImagePlane* pcFilledLeftPlane, PelImagePlane* pcFilledRightPlane, PelImagePlane* pcLeftDepthPlane, PelImagePlane* pcRightDepthPlane, PelImagePlane** apcOutputImagePlane, UInt uNumPlanes );
159
160  // PostProcessing
161  Void xCutMargin                ( PelImage* pcInputImage );
162  Void xCutPlaneMargin           ( PelImagePlane* pcImagePlane, Pel cFill, UInt uiScale);
163  Void xPostProcessImage         ( PelImage* pcInImage,       PelImage* pCOutImage);
164
165  // Input Output Data Conversion
166  Void xConvertInputData         ( PelImage* pcOrgInputImage, PelImage* pcOrgInputDepth, PelImage* pcConvInputImage, PelImage* pcConvInputDepth, Bool bMirror);
167  Void xConvertOutputData        ( PelImage* pOrgOutputImage, PelImage* pConvOutputImage, Bool bMirror);
168
169  Void xGetDataPointers          ( PelImage*& rpcInputImage,  PelImage*& rpcOutputImage, PelImage*& rpcInputDepth, PelImage*& rpcOutputDepth, PelImage*& rpcFilled, Bool bRenderDepth );
170  Void xGetDataPointerOutputImage( PelImage*& rpcOutputImage, PelImage*& rpcOutputDepth );
171
172  Void xConvertInputVideo        ( PelImage* pcOrgInputImage, PelImage* pcConvInputImage);
173  Void xConvertInputDepth        ( PelImage* pcOrgInputImage, PelImage* pcConvInputImage);
174
175
176  // Data
177  UInt m_uiSampledWidth;    // Width after UPsampling
178
179  // Resolution of input view
180  UInt  m_auiInputResolution[2];
181
182  // Extrapolation
183  Bool m_bExtrapolate;
184
185  // Input Conversion
186  Int  m_iLog2SamplingFactor;
187  Bool m_bUVUp;
188
189  // PreProcessing
190  Int  m_iPreProcMode;         //0: none, 1: binominal
191  Int  m_iPreFilterSize;       // Half size
192
193  // Similarity Enhancement
194  Int  m_iSimEnhBaseView;      // 0: none, 1: left, 2: right
195
196  // Blending
197  Int  m_iBlendMode;           // 0: average;
198  Int  m_iBlendZThresPerc;     // in percent of total depth
199  Bool m_bBlendUseDistWeight;  // use weighting depending on viewing distance
200  Int  m_iBlendHoleMargin;     // blending margin next to holes
201
202  Int  m_iBlendZThres;         // absoluteInt  m_iBlendWeight;
203  Int  m_iBlendDistWeight;     // Weight for view distance depending blending
204
205  // Interpolation
206  Int  m_iInterpolationMode;   //0: none; 1: Linear (Double), 2: FEM (Double)
207
208  // Hole Filling
209  Int  m_iHoleFillingMode;     //0: none; 1: LW Background extension
210  Int  m_bInstantHoleFilling;  // perform hole filling while pixel shifting ( only supported for interpolation mode 4 )
211
212  // Post Processing
213  Int  m_iPostProcMode;        //0: none; 1: Median
214
215  // Precision in LUT
216  Int  m_iRelShiftLUTPrec;
217
218  // Cut
219  UInt m_auiCut[2];
220
221  // Look up tables Shift
222  Double** m_ppdShiftLUTLeft;
223  Double** m_ppdShiftLUTRight;
224  Double** m_ppdShiftLUTRightMirror; // For rendering the mirrored view
225  Double*  m_adShiftLUTCur;
226
227  Int**    m_ppiShiftLUTLeft;
228  Int**    m_ppiShiftLUTRight;
229  Int**    m_ppiShiftLUTRightMirror; // For rendering the mirrored view
230  Int*     m_aiShiftLUTCur;
231
232  // Look up tables Z
233  Int*     m_piInvZLUTLeft;          // Look up table entry is proportional to Z
234  Int*     m_piInvZLUTRight;
235
236  // Look up tables sub pel shift
237  Int**    m_aaiSubPelShift;
238
239   // Zhejiang Temporal Improvement
240  Int*    m_aiBlkMoving;
241
242  // Used pel map generation
243  Int      m_iUsedPelMapMarExt;
244
245  // Buffers
246
247  // Interpolation
248  PelImage* m_pcLeftInputImage  ;
249  PelImage* m_pcLeftInputDepth  ;
250  PelImage* m_pcLeftOutputImage ;
251  PelImage* m_pcLeftOutputDepth ;
252  PelImage* m_pcLeftFilled      ;
253  PelImage* m_pcRightInputImage ;
254  PelImage* m_pcRightInputDepth ;
255  PelImage* m_pcRightOutputImage;
256  PelImage* m_pcRightOutputDepth;
257  PelImage* m_pcRightFilled     ;
258  PelImage* m_pcOutputImage     ;
259  PelImage* m_pcOutputDepth     ;
260
261  // Extrapolation
262  PelImage* m_pcInputImage      ;
263  PelImage* m_pcInputDepth      ;
264  PelImage* m_pcFilled          ;
265
266  //Temp
267  PelImage* m_pcTempImage       ;
268};
269
270#endif //__TRENTOP__
Note: See TracBrowser for help on using the repository browser.