| 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 | |
|---|
| 35 | |
|---|
| 36 | #include <list> |
|---|
| 37 | #include <stdio.h> |
|---|
| 38 | #include <fcntl.h> |
|---|
| 39 | #include <assert.h> |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | #ifndef __TAppRENDERERCFG__ |
|---|
| 44 | #define __TAppRENDERERCFG__ |
|---|
| 45 | |
|---|
| 46 | #include "../../Lib/TAppCommon/TAppComCamPara.h" |
|---|
| 47 | #include "../../Lib/TLibCommon/CommonDef.h" |
|---|
| 48 | #include "../../Lib/TLibRenderer/TRenModel.h" |
|---|
| 49 | #include "../../Lib/TLibRenderer/TRenModSetupStrParser.h" |
|---|
| 50 | #include <string> |
|---|
| 51 | #include <vector> |
|---|
| 52 | #if !QC_MVHEVC_B0046 |
|---|
| 53 | // ==================================================================================================================== |
|---|
| 54 | // Class definition |
|---|
| 55 | // ==================================================================================================================== |
|---|
| 56 | |
|---|
| 57 | /// encoder configuration class |
|---|
| 58 | class TAppRendererCfg |
|---|
| 59 | { |
|---|
| 60 | protected: |
|---|
| 61 | |
|---|
| 62 | //// file I/O //// |
|---|
| 63 | Char* m_pchVideoInputFileBaseName; ///< input video file base name, placeholder for numbering $$ |
|---|
| 64 | Char* m_pchDepthInputFileBaseName; ///< input depth file base name, placeholder for numbering $$ |
|---|
| 65 | Char* m_pchSynthOutputFileBaseName; ///< output synth file base name, placeholder for numbering $$ |
|---|
| 66 | Bool m_bContOutputFileNumbering; ///< use continous numbering instead of view numbering |
|---|
| 67 | Bool m_bSweep; ///< 1: Store view range in file |
|---|
| 68 | |
|---|
| 69 | // derived |
|---|
| 70 | std::vector<Char*> m_pchVideoInputFileList; ///< source file names |
|---|
| 71 | std::vector<Char*> m_pchDepthInputFileList; ///< source depth file names |
|---|
| 72 | std::vector<Char*> m_pchSynthOutputFileList; ///< output reconstruction file names |
|---|
| 73 | |
|---|
| 74 | //// source specification //// |
|---|
| 75 | Int m_iSourceWidth; ///< source width in pixel |
|---|
| 76 | Int m_iSourceHeight; ///< source height in pixel |
|---|
| 77 | Int m_iFrameSkip; ///< number of skipped frames from the beginning |
|---|
| 78 | Int m_iFramesToBeRendered; ///< number of rendered frames |
|---|
| 79 | |
|---|
| 80 | ////camera specification //// |
|---|
| 81 | Char* m_pchCameraParameterFile; ///< camera parameter file |
|---|
| 82 | Char* m_pchSynthViewCameraNumbers; ///< numbers of views to synthesize |
|---|
| 83 | Char* m_pchViewConfig; ///< String to setup renderer |
|---|
| 84 | Char* m_pchBaseViewCameraNumbers; ///< numbers of base views |
|---|
| 85 | |
|---|
| 86 | // derived |
|---|
| 87 | TAppComCamPara m_cCameraData; ///< class to store camera parameters |
|---|
| 88 | TRenModSetupStrParser m_cRenModStrParser; ///< class to manage View to be rendered |
|---|
| 89 | Bool m_bUseSetupString; ///< true if setup string is used |
|---|
| 90 | |
|---|
| 91 | Int m_iNumberOfInputViews; ///< number of input Views |
|---|
| 92 | Int m_iNumberOfOutputViews; ///< number views to synthesize |
|---|
| 93 | |
|---|
| 94 | //// renderer Modes //// |
|---|
| 95 | Int m_iRenderDirection; ///< 0: interpolate, 1: extrapolate from left, 2: extrapolate from right |
|---|
| 96 | |
|---|
| 97 | Int m_iLog2SamplingFactor; ///< factor for horizontal upsampling before processing |
|---|
| 98 | Bool m_bUVUp; ///< upsampling of chroma planes before processing |
|---|
| 99 | Int m_iPreProcMode; ///< depth pre-processing: 0 = none, 1 = binominal filtering |
|---|
| 100 | Int m_iPreFilterSize; ///< for PreProcMode = 1: size of filter kernel |
|---|
| 101 | Bool m_bSimEnhance; ///< Similarity enhancement before blending |
|---|
| 102 | Int m_iBlendMode; ///< merging of left and right image: 0 = average, 1 = only holes from right, 2 = only holes from left |
|---|
| 103 | Int m_iBlendZThresPerc; ///< z-difference threshold for blending in percent of total z-range |
|---|
| 104 | Bool m_bBlendUseDistWeight; ///< 0: blend using average; 1: blend factor depends on view distance |
|---|
| 105 | Int m_iBlendHoleMargin; ///< Margin around boundaries |
|---|
| 106 | Bool m_bTempDepthFilter; ///< Zheijang temporal enhancement filter |
|---|
| 107 | Int m_iInterpolationMode; ///< 0: NN, 1: linear, 2: cspline |
|---|
| 108 | Int m_iHoleFillingMode; ///< 0: none, 1: line wise background extension |
|---|
| 109 | Int m_iPostProcMode; ///< 0: none, 1: horizontal 3-tap median |
|---|
| 110 | Int m_iRenderMode; ///< 0: use renderer |
|---|
| 111 | Int m_iShiftPrecision; ///< Precision used for Interpolation Mode 4 |
|---|
| 112 | Int m_iUsedPelMapMarExt; ///< Used Pel map extra margin |
|---|
| 113 | |
|---|
| 114 | Void xCheckParameter (); ///< check validity of configuration values |
|---|
| 115 | Void xPrintParameter (); ///< print configuration values |
|---|
| 116 | Void xPrintUsage (); ///< print usage |
|---|
| 117 | Void xSetGlobal(); |
|---|
| 118 | |
|---|
| 119 | Void xCreateFileNames(); |
|---|
| 120 | Void xGetMaxPrecision( std::vector< Int > adIn, Int& iPrecBefore, Int& iPrecAfter ); |
|---|
| 121 | Void xAddNumberToFileName( Char* pchSourceFileName, Char*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter ); |
|---|
| 122 | public: |
|---|
| 123 | TAppRendererCfg(); |
|---|
| 124 | virtual ~TAppRendererCfg(); |
|---|
| 125 | |
|---|
| 126 | public: |
|---|
| 127 | Void create (); ///< create option handling class |
|---|
| 128 | Void destroy (); ///< destroy option handling class |
|---|
| 129 | Bool parseCfg ( Int argc, Char* argv[] ); ///< parse configuration file to fill member variables |
|---|
| 130 | Bool xConfirmParameter(Bool bflag, const Char* message); |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | };// END CLASS DEFINITION TAppRendererCfg |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | #endif |
|---|
| 137 | #endif // __TAppRENDERERCFG__ |
|---|
| 138 | |
|---|