source: 3DVCSoftware/branches/0.3-poznan-univ/source/Lib/TLibRenderer/TRenTop.h @ 34

Last change on this file since 34 was 28, checked in by poznan-univ, 13 years ago

Poznan Tools

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