Changeset 1191 in 3DVCSoftware for branches/HTM-14.0-MV-draft-3/source/App/TAppRenderer
- Timestamp:
- 15 Apr 2015, 11:36:33 (10 years ago)
- Location:
- branches/HTM-14.0-MV-draft-3/source/App/TAppRenderer
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-14.0-MV-draft-3/source/App/TAppRenderer/RendererMain.cpp
r1179 r1191 35 35 #include <time.h> 36 36 #include "../../Lib/TLibCommon/TypeDef.h" 37 #if H_3D38 #include "TAppRendererTop.h"39 // ====================================================================================================================40 // Main function41 // ====================================================================================================================42 43 int main(int argc, char* argv[])44 {45 46 TAppRendererTop cTAppRendererTop;47 48 // print information49 fprintf( stdout, "\n" );50 fprintf( stdout, "3D-HTM software: Renderer Version [%s]", NV_VERSION);51 fprintf( stdout, NVM_ONOS );52 fprintf( stdout, NVM_COMPILEDBY );53 fprintf( stdout, NVM_BITS );54 fprintf( stdout, "\n" );55 56 // create application renderer class57 cTAppRendererTop.create();58 59 // parse configuration60 if(!cTAppRendererTop.parseCfg( argc, argv ))61 {62 cTAppRendererTop.destroy();63 return 1;64 }65 66 // starting time67 double dResult;68 long lBefore = clock();69 70 // call rendering function71 cTAppRendererTop.go();72 73 // ending time74 dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC;75 printf("\n Total Time: %12.3f sec.\n", dResult);76 77 // destroy application renderer class78 cTAppRendererTop.destroy();79 80 return 0;81 }82 #else83 37 84 38 #include <iostream> … … 89 43 } 90 44 91 #endif // H_3D92 45 -
branches/HTM-14.0-MV-draft-3/source/App/TAppRenderer/TAppRendererCfg.cpp
r1179 r1191 44 44 #include "../../Lib/TAppCommon/program_options_lite.h" 45 45 46 #if H_3D47 48 using namespace std;49 namespace po = df::program_options_lite;50 51 // ====================================================================================================================52 // Local constants53 // ====================================================================================================================54 55 #define MAX_INPUT_VIEW_NUM 1056 #define MAX_OUTPUT_VIEW_NUM 6457 58 // ====================================================================================================================59 // Constructor / destructor / initialization / destroy60 // ====================================================================================================================61 62 63 TAppRendererCfg::TAppRendererCfg()64 {65 66 }67 68 TAppRendererCfg::~TAppRendererCfg()69 {70 for(Int i = 0; i< m_pchVideoInputFileList.size(); i++ )71 {72 if ( m_pchVideoInputFileList[i] != NULL )73 free (m_pchVideoInputFileList[i]);74 }75 76 for(Int i = 0; i< m_pchDepthInputFileList.size(); i++ )77 {78 if ( m_pchDepthInputFileList[i] != NULL )79 free (m_pchDepthInputFileList[i]);80 }81 82 for(Int i = 0; i< m_pchSynthOutputFileList.size(); i++ )83 {84 if ( m_pchSynthOutputFileList[i] != NULL )85 free (m_pchSynthOutputFileList[i]);86 }87 88 if ( m_pchVideoInputFileBaseName ) free( m_pchVideoInputFileBaseName );89 if ( m_pchDepthInputFileBaseName ) free( m_pchDepthInputFileBaseName );90 if ( m_pchSynthOutputFileBaseName ) free( m_pchSynthOutputFileBaseName);91 if ( m_pchCameraParameterFile ) free( m_pchCameraParameterFile );92 if ( m_pchBaseViewCameraNumbers ) free( m_pchBaseViewCameraNumbers );93 if ( m_pchSynthViewCameraNumbers ) free( m_pchSynthViewCameraNumbers );94 if ( m_pchViewConfig ) free( m_pchViewConfig );95 }96 97 Void TAppRendererCfg::create()98 {99 }100 101 Void TAppRendererCfg::destroy()102 {103 }104 105 // ====================================================================================================================106 // Public member functions107 // ====================================================================================================================108 109 /** \param argc number of arguments110 \param argv array of arguments111 \retval true when success112 */113 Bool TAppRendererCfg::parseCfg( Int argc, Char* argv[] )114 {115 bool do_help = false;116 117 po::Options opts;118 opts.addOptions()119 ("help", do_help, false, "this help text")120 ("c", po::parseConfigFile, "configuration file name")121 122 /* File I/O */123 ("VideoInputFileBaseName,v", m_pchVideoInputFileBaseName, (Char*) 0, "Basename to generate video input file names")124 ("DepthInputFileBaseName,d", m_pchDepthInputFileBaseName, (Char*) 0, "Basename to generate depth input file names")125 ("SynthOutputFileBaseName,s", m_pchSynthOutputFileBaseName, (Char*) 0, "Basename to generate synthesized output file names")126 ("ContOutputFileNumbering", m_bContOutputFileNumbering , false , "Continuous Output File Numbering")127 ("Sweep" , m_bSweep , false , "Store all views in first Output File")128 129 ("VideoInputFile_%d,v_%d", m_pchVideoInputFileList , (Char *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv video input file name %d")130 ("DepthInputFile_%d,d_%d", m_pchDepthInputFileList , (Char *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv depth input file name %d")131 ("SynthOutputFile_%d,s_%d", m_pchSynthOutputFileList, (Char *) 0, MAX_OUTPUT_VIEW_NUM, "Synthesized Yuv output file name %d")132 133 ("InputBitDepth", m_inputBitDepthY, 8, "Bit-depth of input file")134 ("OutputBitDepth", m_outputBitDepthY, 0, "Bit-depth of output file (default:InternalBitDepth)")135 ("InternalBitDepth", m_internalBitDepthY, 0, "Bit-depth the renderer operates at. (default:InputBitDepth)" "If different to InputBitDepth, source data will be converted")136 137 ("InputBitDepthC", m_inputBitDepthC, 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")138 ("OutputBitDepthC", m_outputBitDepthC, 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")139 ("InternalBitDepthC", m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")140 141 /* Source Specification */142 ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width")143 ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height")144 ("FrameSkip,-fs", m_iFrameSkip, 0, "Number of frames to skip at start of input YUV")145 ("FramesToBeRendered,f", m_iFramesToBeRendered, 0, "Number of frames to be rendered (default=all)")146 147 /* Camera Specification */148 ("CameraParameterFile,-cpf", m_pchCameraParameterFile, (Char *) 0, "Camera Parameter File Name")149 ("BaseViewCameraNumbers" , m_pchBaseViewCameraNumbers, (Char *) 0, "Numbers of base views")150 ("SynthViewCameraNumbers" , m_pchSynthViewCameraNumbers, (Char *) 0, "Numbers of views to synthesis")151 ("ViewConfig" , m_pchViewConfig, (Char *) 0, "View Configuration" )152 153 /* Renderer Modes */154 ("Log2SamplingFactor", m_iLog2SamplingFactor, 0, "Factor for horizontal up sampling before processing" )155 ("UVup" , m_bUVUp , true, "Up sampling of chroma planes before processing" )156 ("PreProcMode" , m_iPreProcMode , 0, "Depth preprocessing: 0 = None, 1 = Binomial filtering" )157 ("PreFilterSize" , m_iPreFilterSize , 0, "For PreProcMode 1: Half Size of filter kernel" )158 ("SimEnhance" , m_bSimEnhance , true, "Similarity enhancement of video" )159 ("BlendMode" , m_iBlendMode , 0, "Blending of left and right image: 0: average, 1: only holes from right, 2: only holes from left, 3: first view in BaseViewOrder as main view" )160 ("BlendZThresPerc" , m_iBlendZThresPerc , 30, "Z-difference threshold for blending in percent of total Z-range" )161 ("BlendUseDistWeight", m_bBlendUseDistWeight , true, "0: blend using average; 1: blend factor depends on view distance" )162 ("BlendHoleMargin" , m_iBlendHoleMargin , 6, "Margin around holes to fill with other view" )163 ("InterpolationMode" , m_iInterpolationMode , 4, "0: NN, 1:linear (int), 2:linear (double) , 3:cubic Hermite spline (double), 4: 8-tap (int)" )164 ("HoleFillingMode" , m_iHoleFillingMode , 1, "0: None, 1: line wise background extension" )165 ("PostProcMode" , m_iPostProcMode , 0, "0: None, 1: horizontal 3-tap median" )166 ("RenderMode" , m_iRenderMode , 0, "0: Use renderer, 1: use model renderer, 10: create used pels map")167 ("ShiftPrecision" , m_iShiftPrecision , 2, "Shift Precision for Interpolation Mode 4" )168 ("TemporalDepthFilter", m_bTempDepthFilter , false, "Temporal depth filtering" )169 ("RenderDirection" , m_iRenderDirection , 0, "0: Interpolate, 1: Extrapolate from left, 2: Extrapolate from right")170 ("UsedPelMapMarExt" , m_iUsedPelMapMarExt , 0, "Margin Extension in Pels for used pels map generation" );171 172 po::setDefaults(opts);173 po::scanArgv(opts, argc, (const char**) argv);174 175 if (argc == 1 || do_help)176 {177 /* argc == 1: no options have been specified */178 po::doHelp(cout, opts);179 xPrintUsage();180 return false;181 }182 183 /*184 * Set any derived parameters before checking185 */186 187 /* rules for input, output and internal bitdepths as per help text */188 if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; }189 if (!m_internalBitDepthC) { m_internalBitDepthC = m_internalBitDepthY; }190 if (!m_inputBitDepthC) { m_inputBitDepthC = m_inputBitDepthY; }191 if (!m_outputBitDepthY) { m_outputBitDepthY = m_internalBitDepthY; }192 if (!m_outputBitDepthC) { m_outputBitDepthC = m_internalBitDepthC; }193 194 xSetGlobal();195 196 UInt uiInputBitDepth = 8;197 UInt uiCamParPrecision = 5;198 199 m_bUseSetupString = ( m_pchViewConfig != NULL ) && ( m_iRenderMode != 0);200 201 if ( m_iRenderMode == 10 )202 {203 m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,204 m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );205 m_iNumberOfInputViews = (Int) m_cCameraData.getBaseViewNumbers() .size();206 m_iNumberOfOutputViews = m_iNumberOfInputViews - 1;207 m_iRenderDirection = 1;208 }209 else210 {211 if ( m_bUseSetupString )212 {213 std::vector<Int> iaTempViews;214 std::vector<Int>* piaTempViews;215 m_cCameraData .convertNumberString( m_pchBaseViewCameraNumbers, iaTempViews, VIEW_NUM_PREC );216 m_cRenModStrParser.setString( (Int) iaTempViews.size(), m_pchViewConfig );217 piaTempViews = m_cRenModStrParser.getSynthViews();218 m_iNumberOfOutputViews = (Int) m_cRenModStrParser.getNumOfModels();219 m_iNumberOfInputViews = (Int) m_cRenModStrParser.getNumOfBaseViews();220 m_bContOutputFileNumbering = true;221 222 m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,223 m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, piaTempViews, m_iLog2SamplingFactor+m_iShiftPrecision );224 }225 else226 {227 m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,228 m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, m_pchSynthViewCameraNumbers, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );229 m_iNumberOfOutputViews = (Int) m_cCameraData.getSynthViewNumbers().size();230 m_iNumberOfInputViews = (Int) m_cCameraData.getBaseViewNumbers() .size();231 }232 }233 234 if (m_pchSynthOutputFileBaseName != NULL)235 xConfirmParameter( strrchr(m_pchSynthOutputFileBaseName,'$') == 0, "'$' must be a character in SynthOutputFileBaseName");236 237 if (m_pchDepthInputFileBaseName != NULL)238 xConfirmParameter( strrchr(m_pchDepthInputFileBaseName, '$') == 0, "'$' must be a character in DepthInputFileBaseName" );239 240 if (m_pchVideoInputFileBaseName != NULL)241 xConfirmParameter( strrchr(m_pchVideoInputFileBaseName, '$') == 0, "'$' must be a character in VideoInputFileBaseName" );242 243 xCreateFileNames();244 245 /*246 * check validity of input parameters247 */248 xCheckParameter();249 m_cCameraData.check( m_iRenderDirection == 0, m_iFramesToBeRendered != 0 );250 251 // print-out parameters252 xPrintParameter();253 254 return true;255 }256 257 258 // ====================================================================================================================259 // Private member functions260 // ====================================================================================================================261 262 Void TAppRendererCfg::xCheckParameter()263 {264 bool check_failed = false; /* abort if there is a fatal configuration problem */265 #define xConfirmPara(a,b) check_failed |= xConfirmParameter(a,b)266 // check range of parameters267 268 /// File I/O269 270 // source specification271 xConfirmPara( m_iSourceWidth <= 0, "Source width must be greater than 0" );272 xConfirmPara( m_iSourceHeight <= 0, "Source height must be greater than 0" );273 xConfirmPara( m_iFrameSkip < 0, "Frame Skipping must be more than or equal to 0" );274 xConfirmPara( m_iFramesToBeRendered < 0, "Total Number Of Frames rendered must be more than 1" );275 276 // bit depth277 xConfirmPara( m_internalBitDepthC != m_internalBitDepthY, "InternalBitDepth for luma and chroma must be equal. ");278 xConfirmPara( m_inputBitDepthY < 8, "InputBitDepth must be at least 8" );279 xConfirmPara( m_inputBitDepthC < 8, "InputBitDepthC must be at least 8" );280 281 // camera specification282 xConfirmPara( m_iNumberOfInputViews > MAX_INPUT_VIEW_NUM , "NumberOfInputViews must be less than of equal to MAX_INPUT_VIEW_NUM");283 xConfirmPara( m_iNumberOfOutputViews > MAX_OUTPUT_VIEW_NUM, "NumberOfOutputViews must be less than of equal to MAX_OUTPUT_VIEW_NUM");284 285 286 xConfirmPara( m_iRenderDirection < 0 || m_iRenderDirection > 2 , "RenderDirection must be greater than or equal to 0 and less than 3");287 xConfirmPara(m_iNumberOfOutputViews < 1, "Number of OutputViews must be greater or equal to 1");288 if ( m_iRenderDirection == 0 )289 {290 xConfirmPara( m_iNumberOfInputViews < 2, "Number of InputViews must be more than or equal to 2");291 }292 else293 {294 xConfirmPara( m_iNumberOfInputViews < 1, "Number of InputViews must be more than or equal to 1");295 }296 297 xConfirmPara( m_iLog2SamplingFactor < 0 || m_iLog2SamplingFactor > 4, "Log2SamplingFactor must be more than or equal to 0 and less than 5" );298 xConfirmPara( m_iPreProcMode < 0 || m_iPreProcMode > 1, "PreProcMode must be more than or equal to 0 and less than 2" );299 300 301 xConfirmPara( m_iPreFilterSize < 0 || m_iPreFilterSize > 3, "PreFilterSize must be more than or equal to 0 and less than 4" );302 xConfirmPara( m_iBlendMode < 0 || m_iBlendMode > 3, "BlendMode must be more than or equal to 0 and less than 4" );303 xConfirmPara( m_iBlendZThresPerc < 0 || m_iBlendZThresPerc > 100,"BlendZThresPerc must be more than or equal to 0 and less than 101" );304 xConfirmPara( m_iBlendHoleMargin < 0 || m_iBlendHoleMargin > 20,"BlendHoleMargin must be more than or equal to 0 and less than 19" );305 xConfirmPara( m_iInterpolationMode < 0 || m_iInterpolationMode > 4, "InterpolationMode must be more than or equal to 0 and less than 5" );306 xConfirmPara( m_iHoleFillingMode < 0 || m_iHoleFillingMode > 1, "HoleFillingMode must be more than or equal to 0 and less than 2" );307 xConfirmPara( m_iPostProcMode < 0 || m_iPostProcMode > 2, "PostProcMode must be more than or equal to 0 and less than 3" );308 309 Int iNumNonNULL;310 for (iNumNonNULL = 0; (iNumNonNULL < m_iNumberOfInputViews) && m_pchDepthInputFileList[iNumNonNULL]; iNumNonNULL++); xConfirmPara( iNumNonNULL < m_iNumberOfInputViews, "Number of DepthInputFiles must be greater than or equal to number of BaseViewNumbers" );311 for (iNumNonNULL = 0; (iNumNonNULL < m_iNumberOfInputViews) && m_pchVideoInputFileList[iNumNonNULL]; iNumNonNULL++); xConfirmPara( iNumNonNULL < m_iNumberOfInputViews, "Number of DepthInputFiles must be greater than or equal to number of BaseViewNumbers" );312 313 314 if ( !m_bSweep )315 {316 for (iNumNonNULL = 0; (iNumNonNULL < m_iNumberOfOutputViews) && m_pchSynthOutputFileList[iNumNonNULL]; iNumNonNULL++); xConfirmPara( iNumNonNULL < m_iNumberOfOutputViews, "Number of SynthOutputFiles must be greater than or equal to number of SynthViewNumbers" );317 }318 else319 {320 xConfirmPara( iNumNonNULL < 1, "Number of SynthOutputFiles must be equal to or more than 1" );321 }322 323 #undef xConfirmPara324 if ( check_failed )325 {326 exit(EXIT_FAILURE);327 }328 329 }330 331 332 333 Void TAppRendererCfg::xPrintParameter()334 {335 printf("\n");336 for( Int iCounter = 0; iCounter < m_iNumberOfInputViews; iCounter++)337 {338 printf("InputVideoFile_%i : %s\n", iCounter, m_pchVideoInputFileList[iCounter]);339 }340 for( Int iCounter = 0; iCounter < m_iNumberOfInputViews; iCounter++)341 {342 printf("InputDepthFile_%i : %s\n", iCounter, m_pchDepthInputFileList[iCounter]);343 }344 345 for( Int iCounter = 0; iCounter < m_iNumberOfOutputViews; iCounter++)346 {347 printf("SynthOutputFile_%i : %s\n", iCounter, m_pchSynthOutputFileList[iCounter]);348 }349 350 printf("Format : %dx%d \n", m_iSourceWidth, m_iSourceHeight );351 printf("Frame index : %d - %d (%d frames)\n", m_iFrameSkip, m_iFrameSkip+m_iFramesToBeRendered-1, m_iFramesToBeRendered);352 printf("CameraParameterFile : %s\n", m_pchCameraParameterFile );353 printf("BaseViewNumbers : %s (%d views) \n", m_pchBaseViewCameraNumbers , m_iNumberOfInputViews );354 printf("Sweep : %d\n", m_bSweep );355 356 if ( m_bUseSetupString )357 {358 printf("ViewConfig : %s\n", m_pchViewConfig );359 }360 else361 {362 printf("SynthViewNumbers : %s (%d views) \n", m_pchSynthViewCameraNumbers, m_iNumberOfOutputViews );363 }364 365 printf("Log2SamplingFactor : %d\n", m_iLog2SamplingFactor );366 printf("UVUp : %d\n", m_bUVUp );367 printf("PreProcMode : %d\n", m_iPreProcMode );368 printf("PreFilterSize : %d\n", m_iPreFilterSize );369 printf("SimEnhance : %d\n", m_bSimEnhance );370 printf("BlendMode : %d\n", m_iBlendMode );371 printf("BlendZThresPerc : %d\n", m_iBlendZThresPerc );372 printf("BlendUseDistWeight : %d\n", m_bBlendUseDistWeight );373 printf("BlendHoleMargin : %d\n", m_iBlendHoleMargin );374 printf("InterpolationMode : %d\n", m_iInterpolationMode );375 printf("HoleFillingMode : %d\n", m_iHoleFillingMode );376 printf("PostProcMode : %d\n", m_iPostProcMode );377 printf("ShiftPrecision : %d\n", m_iShiftPrecision );378 printf("TemporalDepthFilter : %d\n", m_bTempDepthFilter );379 printf("RenderMode : %d\n", m_iRenderMode );380 printf("RendererDirection : %d\n", m_iRenderDirection );381 382 if (m_iRenderMode == 10 )383 {384 printf("UsedPelMapMarExt : %d\n", m_iUsedPelMapMarExt );385 }386 387 printf("\n");388 389 // printf("TOOL CFG: ");390 // printf("ALF:%d ", m_bUseALF );391 // printf("\n");392 393 fflush(stdout);394 }395 396 Void TAppRendererCfg::xPrintUsage()397 {398 printf( "\n" );399 printf( " Example: TAppRenderer.exe -c test.cfg\n\n");400 }401 402 Bool TAppRendererCfg::xConfirmParameter(Bool bflag, const char* message)403 {404 if (!bflag)405 return false;406 407 printf("Error: %s\n",message);408 return true;409 }410 411 412 Void TAppRendererCfg::xCreateFileNames()413 {414 if ( m_iRenderMode == 10 )415 return;416 417 Int iPrecBefore;418 Int iPrecAfter;419 420 xGetMaxPrecision( m_cCameraData.getSynthViewNumbers(), iPrecBefore, iPrecAfter );421 422 423 if (iPrecBefore > LOG10_VIEW_NUM_PREC )424 {425 std::cerr << "Error: View Numbers with more than " << LOG10_VIEW_NUM_PREC << " digits are not supported" << std::endl;426 exit(EXIT_FAILURE);427 }428 429 AOT( !m_bContOutputFileNumbering && (m_cCameraData.getSynthViewNumbers().size() != m_iNumberOfOutputViews ));430 for(Int iIdx = 0; iIdx < m_iNumberOfOutputViews; iIdx++)431 {432 //GT; Create ReconFileNames433 if (m_pchSynthOutputFileList[iIdx] == NULL )434 {435 if ( m_bContOutputFileNumbering )436 {437 xAddNumberToFileName( m_pchSynthOutputFileBaseName, m_pchSynthOutputFileList[iIdx], (Int) ((iIdx+1) * VIEW_NUM_PREC) , 2, 0 );438 }439 else440 {441 xAddNumberToFileName( m_pchSynthOutputFileBaseName, m_pchSynthOutputFileList[iIdx], m_cCameraData.getSynthViewNumbers()[iIdx], iPrecBefore, iPrecAfter );442 }443 }444 }445 446 xGetMaxPrecision( m_cCameraData.getBaseViewNumbers(), iPrecBefore, iPrecAfter );447 for(Int iIdx = 0; iIdx < m_cCameraData.getBaseViewNumbers().size() ; iIdx++)448 {449 //GT; Create ReconFileNames450 if (m_pchVideoInputFileList[iIdx] == NULL )451 {452 xAddNumberToFileName( m_pchVideoInputFileBaseName, m_pchVideoInputFileList[iIdx], m_cCameraData.getBaseViewNumbers()[iIdx], iPrecBefore, iPrecAfter );453 }454 455 if (m_pchDepthInputFileList[iIdx] == NULL )456 {457 xAddNumberToFileName( m_pchDepthInputFileBaseName, m_pchDepthInputFileList[iIdx], m_cCameraData.getBaseViewNumbers()[iIdx], iPrecBefore, iPrecAfter );458 }459 }460 }461 462 Void TAppRendererCfg::xAddNumberToFileName( Char* pchSourceFileName, Char*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter )463 {464 465 if ( pchSourceFileName == NULL )466 {467 std::cerr << "No BaseName for file name generation given." << std::endl;468 AOT(true);469 exit(EXIT_FAILURE);470 }471 472 Char pchNumberBuffer[2* LOG10_VIEW_NUM_PREC + 2];473 Char pchPrintBuffer[10];474 475 Double dNumberToAdd = ( (Double) iNumberToAdd ) / VIEW_NUM_PREC;476 477 UInt uiWidth = uiPrecBefore;478 479 if (uiPrecAfter != 0)480 {481 uiWidth += uiPrecAfter + 1;482 }483 484 sprintf( pchPrintBuffer, "%%0%d.%df", uiWidth, uiPrecAfter );485 sprintf( pchNumberBuffer, pchPrintBuffer, dNumberToAdd );486 487 if ( uiPrecAfter > 0 ) pchNumberBuffer[ uiPrecBefore ] = '_';488 489 size_t iInLength = strlen(pchSourceFileName);490 size_t iAddLength = strlen(pchNumberBuffer);491 492 rpchTargetFileName = (Char*) malloc(iInLength+iAddLength+1);493 494 Char* pchPlaceHolder = strrchr(pchSourceFileName,'$');495 assert( pchPlaceHolder );496 497 size_t iCharsToPlaceHolder = pchPlaceHolder - pchSourceFileName;498 size_t iCharsToEnd = iInLength - iCharsToPlaceHolder;499 500 strncpy(rpchTargetFileName , pchSourceFileName , iCharsToPlaceHolder);501 strncpy(rpchTargetFileName+iCharsToPlaceHolder , pchNumberBuffer , iAddLength );502 strncpy(rpchTargetFileName+iCharsToPlaceHolder+iAddLength, pchSourceFileName+iCharsToPlaceHolder+1, iCharsToEnd-1 );503 rpchTargetFileName[iInLength+iAddLength-1] = '\0';504 }505 506 Void TAppRendererCfg::xGetMaxPrecision( std::vector< Int > aiIn, Int& iPrecBefore, Int& iPrecAfter )507 {508 iPrecBefore = 0;509 iPrecAfter = 0;510 511 for (UInt uiK = 0; uiK < aiIn.size(); uiK ++ )512 {513 if ( aiIn[uiK] == 0 ) continue;514 515 Int iCurPrec;516 iCurPrec = 0;517 for ( Int iCur = aiIn[uiK]; iCur != 0; iCur /= 10, iCurPrec++ );518 iPrecBefore = max(iPrecBefore, iCurPrec - LOG10_VIEW_NUM_PREC );519 520 iCurPrec = 0;521 for ( Int iCur = 1; aiIn[uiK] % iCur == 0; iCur *= 10, iCurPrec++);522 iCurPrec = LOG10_VIEW_NUM_PREC - std::min((Int) LOG10_VIEW_NUM_PREC, iCurPrec-1 );523 iPrecAfter = max(iPrecAfter, iCurPrec );524 }525 }526 527 Void TAppRendererCfg::xSetGlobal()528 {529 // set max CU width & height530 g_uiMaxCUWidth = 0;531 g_uiMaxCUHeight = 0;532 }533 534 #endif -
branches/HTM-14.0-MV-draft-3/source/App/TAppRenderer/TAppRendererCfg.h
r1179 r1191 47 47 #include <vector> 48 48 49 #if H_3D50 51 // ====================================================================================================================52 // Class definition53 // ====================================================================================================================54 55 /// encoder configuration class56 class TAppRendererCfg57 {58 protected:59 60 //// file I/O ////61 Char* m_pchVideoInputFileBaseName; ///< input video file base name, placeholder for numbering $$62 Char* m_pchDepthInputFileBaseName; ///< input depth file base name, placeholder for numbering $$63 Char* m_pchSynthOutputFileBaseName; ///< output synth file base name, placeholder for numbering $$64 Bool m_bContOutputFileNumbering; ///< use continous numbering instead of view numbering65 Bool m_bSweep; ///< 1: Store view range in file66 67 68 // bit-depth ( Currently interal luma and chroma bit-depth are required to be equal. )69 Int m_inputBitDepthY; ///< bit-depth of input file (luma component)70 Int m_inputBitDepthC; ///< bit-depth of input file (chroma component)71 Int m_outputBitDepthY; ///< bit-depth of output file (luma component)72 Int m_outputBitDepthC; ///< bit-depth of output file (chroma component)73 Int m_internalBitDepthY; ///< bit-depth renderer operates at in luma (input/output files will be converted)74 Int m_internalBitDepthC; ///< bit-depth renderer operates at in chroma (input/output files will be converted)75 76 77 // derived78 std::vector<Char*> m_pchVideoInputFileList; ///< source file names79 std::vector<Char*> m_pchDepthInputFileList; ///< source depth file names80 std::vector<Char*> m_pchSynthOutputFileList; ///< output reconstruction file names81 82 //// source specification ////83 Int m_iSourceWidth; ///< source width in pixel84 Int m_iSourceHeight; ///< source height in pixel85 Int m_iFrameSkip; ///< number of skipped frames from the beginning86 Int m_iFramesToBeRendered; ///< number of rendered frames87 88 ////camera specification ////89 Char* m_pchCameraParameterFile; ///< camera parameter file90 Char* m_pchSynthViewCameraNumbers; ///< numbers of views to synthesize91 Char* m_pchViewConfig; ///< String to setup renderer92 Char* m_pchBaseViewCameraNumbers; ///< numbers of base views93 94 // derived95 TAppComCamPara m_cCameraData; ///< class to store camera parameters96 TRenModSetupStrParser m_cRenModStrParser; ///< class to manage View to be rendered97 Bool m_bUseSetupString; ///< true if setup string is used98 99 Int m_iNumberOfInputViews; ///< number of input Views100 Int m_iNumberOfOutputViews; ///< number views to synthesize101 102 //// renderer Modes ////103 Int m_iRenderDirection; ///< 0: interpolate, 1: extrapolate from left, 2: extrapolate from right104 105 Int m_iLog2SamplingFactor; ///< factor for horizontal upsampling before processing106 Bool m_bUVUp; ///< upsampling of chroma planes before processing107 Int m_iPreProcMode; ///< depth pre-processing: 0 = none, 1 = binominal filtering108 Int m_iPreFilterSize; ///< for PreProcMode = 1: size of filter kernel109 Bool m_bSimEnhance; ///< Similarity enhancement before blending110 Int m_iBlendMode; ///< merging of left and right image: 0 = average, 1 = only holes from right, 2 = only holes from left111 Int m_iBlendZThresPerc; ///< z-difference threshold for blending in percent of total z-range112 Bool m_bBlendUseDistWeight; ///< 0: blend using average; 1: blend factor depends on view distance113 Int m_iBlendHoleMargin; ///< Margin around boundaries114 Bool m_bTempDepthFilter; ///< Zheijang temporal enhancement filter115 Int m_iInterpolationMode; ///< 0: NN, 1: linear, 2: cspline116 Int m_iHoleFillingMode; ///< 0: none, 1: line wise background extension117 Int m_iPostProcMode; ///< 0: none, 1: horizontal 3-tap median118 Int m_iRenderMode; ///< 0: use renderer119 Int m_iShiftPrecision; ///< Precision used for Interpolation Mode 4120 Int m_iUsedPelMapMarExt; ///< Used Pel map extra margin121 122 Void xCheckParameter (); ///< check validity of configuration values123 Void xPrintParameter (); ///< print configuration values124 Void xPrintUsage (); ///< print usage125 Void xSetGlobal();126 127 Void xCreateFileNames();128 Void xGetMaxPrecision( std::vector< Int > adIn, Int& iPrecBefore, Int& iPrecAfter );129 Void xAddNumberToFileName( Char* pchSourceFileName, Char*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter );130 public:131 TAppRendererCfg();132 virtual ~TAppRendererCfg();133 134 public:135 Void create (); ///< create option handling class136 Void destroy (); ///< destroy option handling class137 Bool parseCfg ( Int argc, Char* argv[] ); ///< parse configuration file to fill member variables138 Bool xConfirmParameter(Bool bflag, const Char* message);139 140 141 };// END CLASS DEFINITION TAppRendererCfg142 143 #endif // __TAppRENDERERCFG__144 49 #endif // H_3D -
branches/HTM-14.0-MV-draft-3/source/App/TAppRenderer/TAppRendererTop.cpp
r1179 r1191 41 41 #include "TAppRendererTop.h" 42 42 43 #if H_3D44 45 // ====================================================================================================================46 // Constructor / destructor / initialization / destroy47 // ====================================================================================================================48 49 TAppRendererTop::TAppRendererTop()50 {51 52 }53 54 TAppRendererTop::~TAppRendererTop()55 {56 57 }58 59 60 Void TAppRendererTop::xCreateLib()61 {62 m_pcRenTop = new TRenTop();63 64 for(Int iViewIdx=0; iViewIdx<m_iNumberOfInputViews; iViewIdx++)65 {66 TVideoIOYuv* pcVideoInput = new TVideoIOYuv;67 TVideoIOYuv* pcDepthInput = new TVideoIOYuv;68 69 pcVideoInput->open( m_pchVideoInputFileList[iViewIdx], false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC); // read mode70 pcDepthInput->open( m_pchDepthInputFileList[iViewIdx], false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC ); // read mode71 pcVideoInput->skipFrames(m_iFrameSkip, m_iSourceWidth, m_iSourceHeight );72 pcDepthInput->skipFrames(m_iFrameSkip, m_iSourceWidth, m_iSourceHeight );73 74 m_apcTVideoIOYuvVideoInput.push_back( pcVideoInput );75 m_apcTVideoIOYuvDepthInput.push_back( pcDepthInput );76 }77 78 for(Int iViewIdx=0; iViewIdx<m_iNumberOfOutputViews; iViewIdx++)79 {80 TVideoIOYuv* pcSynthOutput = new TVideoIOYuv;81 pcSynthOutput->open( m_pchSynthOutputFileList[iViewIdx], true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC ); // write mode82 m_apcTVideoIOYuvSynthOutput.push_back( pcSynthOutput );83 }84 }85 86 87 Void TAppRendererTop::xDestroyLib()88 {89 delete m_pcRenTop;90 91 for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfInputViews; iViewIdx++ )92 {93 m_apcTVideoIOYuvVideoInput[iViewIdx]->close();94 m_apcTVideoIOYuvDepthInput[iViewIdx]->close();95 96 delete m_apcTVideoIOYuvDepthInput[iViewIdx];97 delete m_apcTVideoIOYuvVideoInput[iViewIdx];98 };99 100 for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfOutputViews; iViewIdx++ )101 {102 m_apcTVideoIOYuvSynthOutput[iViewIdx]->close();103 delete m_apcTVideoIOYuvSynthOutput[iViewIdx];104 };105 }106 107 Void TAppRendererTop::xInitLib()108 {109 m_pcRenTop->init(110 m_iSourceWidth,111 m_iSourceHeight,112 (m_iRenderDirection != 0),113 m_iLog2SamplingFactor,114 m_iLog2SamplingFactor+m_iShiftPrecision,115 m_bUVUp,116 m_iPreProcMode,117 m_iPreFilterSize,118 m_iBlendMode,119 m_iBlendZThresPerc,120 m_bBlendUseDistWeight,121 m_iBlendHoleMargin,122 m_iInterpolationMode,123 m_iHoleFillingMode,124 m_iPostProcMode,125 m_iUsedPelMapMarExt126 );127 }128 129 // ====================================================================================================================130 // Public member functions131 // ====================================================================================================================132 133 134 135 Void TAppRendererTop::render()136 {137 xCreateLib();138 xInitLib();139 140 // Create Buffers Input Views;141 std::vector<TComPicYuv*> apcPicYuvBaseVideo;142 std::vector<TComPicYuv*> apcPicYuvBaseDepth;143 144 // TemporalImprovement Filter145 std::vector<TComPicYuv*> apcPicYuvLastBaseVideo;146 std::vector<TComPicYuv*> apcPicYuvLastBaseDepth;147 148 Int aiPad[2] = { 0, 0 };149 150 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )151 {152 TComPicYuv* pcNewVideoPic = new TComPicYuv;153 TComPicYuv* pcNewDepthPic = new TComPicYuv;154 155 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );156 apcPicYuvBaseVideo.push_back(pcNewVideoPic);157 158 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );159 apcPicYuvBaseDepth.push_back(pcNewDepthPic);160 161 //Temporal improvement Filter162 if ( m_bTempDepthFilter )163 {164 pcNewVideoPic = new TComPicYuv;165 pcNewDepthPic = new TComPicYuv;166 167 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );168 apcPicYuvLastBaseVideo.push_back(pcNewVideoPic);169 170 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );171 apcPicYuvLastBaseDepth.push_back(pcNewDepthPic);172 }173 }174 175 // Create Buffer for synthesized View176 TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;177 pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );178 179 Bool bAnyEOS = false;180 181 Int iNumOfRenderedFrames = 0;182 Int iFrame = 0;183 184 while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )185 {186 if ( iFrame >= m_iFrameSkip )187 {188 // read in depth and video189 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )190 {191 m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], aiPad ) ;192 193 apcPicYuvBaseVideo[iBaseViewIdx]->extendPicBorder();194 195 bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();196 197 m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], aiPad ) ;198 apcPicYuvBaseDepth[iBaseViewIdx]->extendPicBorder();199 bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();200 201 if ( m_bTempDepthFilter && (iFrame >= m_iFrameSkip) )202 {203 m_pcRenTop->temporalFilterVSRS( apcPicYuvBaseVideo[iBaseViewIdx], apcPicYuvBaseDepth[iBaseViewIdx], apcPicYuvLastBaseVideo[iBaseViewIdx], apcPicYuvLastBaseDepth[iBaseViewIdx], ( iFrame == m_iFrameSkip) );204 }205 }206 }207 else208 {209 std::cout << "Skipping Frame " << iFrame << std::endl;210 211 iFrame++;212 continue;213 }214 215 m_cCameraData.update( (UInt)iFrame - m_iFrameSkip );216 217 for(Int iSynthViewIdx=0; iSynthViewIdx < m_iNumberOfOutputViews; iSynthViewIdx++ )218 {219 Int iLeftBaseViewIdx = -1;220 Int iRightBaseViewIdx = -1;221 222 Bool bIsBaseView = false;223 224 Int iRelDistToLeft;225 Bool bHasLRView = m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftBaseViewIdx, iRightBaseViewIdx, iRelDistToLeft, bIsBaseView );226 Bool bHasLView = ( iLeftBaseViewIdx != -1 );227 Bool bHasRView = ( iRightBaseViewIdx != -1 );228 Bool bRender = true;229 230 Int iBlendMode = m_iBlendMode;231 Int iSimEnhBaseView = 0;232 233 switch( m_iRenderDirection )234 {235 /// INTERPOLATION236 case 0:237 AOF( bHasLRView || bIsBaseView );238 239 if ( !bHasLRView && bIsBaseView && m_iBlendMode == 0 )240 {241 bRender = false;242 }243 else244 {245 if ( bIsBaseView )246 {247 AOF( iLeftBaseViewIdx == iRightBaseViewIdx );248 Int iSortedBaseViewIdx = m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx];249 250 if ( m_iBlendMode == 1 )251 {252 if ( iSortedBaseViewIdx - 1 >= 0 )253 {254 iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx - 1];255 bRender = true;256 }257 else258 {259 bRender = false;260 }261 }262 else if ( m_iBlendMode == 2 )263 {264 if ( iSortedBaseViewIdx + 1 < m_iNumberOfInputViews )265 {266 iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx + 1];267 bRender = true;268 }269 else270 {271 bRender = false;272 }273 }274 }275 276 if ( m_iBlendMode == 3 )277 {278 if ( bIsBaseView && (iLeftBaseViewIdx == 0) )279 {280 bRender = false;281 }282 else283 {284 Int iDistLeft = abs( m_cCameraData.getBaseId2SortedId()[0] - m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx ] );285 Int iDistRight = abs( m_cCameraData.getBaseId2SortedId()[0] - m_cCameraData.getBaseId2SortedId() [iRightBaseViewIdx] );286 287 Int iFillViewIdx = iDistLeft > iDistRight ? iLeftBaseViewIdx : iRightBaseViewIdx;288 289 if( m_cCameraData.getBaseId2SortedId()[0] < m_cCameraData.getBaseId2SortedId() [iFillViewIdx] )290 {291 iBlendMode = 1;292 iLeftBaseViewIdx = 0;293 iRightBaseViewIdx = iFillViewIdx;294 }295 else296 {297 iBlendMode = 2;298 iLeftBaseViewIdx = iFillViewIdx;299 iRightBaseViewIdx = 0;300 }301 302 }303 }304 else305 {306 iBlendMode = m_iBlendMode;307 }308 }309 310 if ( m_bSimEnhance )311 {312 if ( m_iNumberOfInputViews == 3 && m_cCameraData.getRelSynthViewNumbers()[ iSynthViewIdx ] < VIEW_NUM_PREC )313 {314 iSimEnhBaseView = 2; // Take middle view315 }316 else317 {318 iSimEnhBaseView = 1; // Take left view319 }320 }321 322 if ( bRender )323 {324 std::cout << "Rendering Frame " << iFrame325 << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx ] / VIEW_NUM_PREC326 << " Left BaseView: " << (Double) m_cCameraData.getBaseViewNumbers() [iLeftBaseViewIdx ] / VIEW_NUM_PREC327 << " Right BaseView: " << (Double) m_cCameraData.getBaseViewNumbers() [iRightBaseViewIdx] / VIEW_NUM_PREC328 << " BlendMode: " << iBlendMode329 << std::endl;330 331 m_pcRenTop->setShiftLUTs(332 m_cCameraData.getSynthViewShiftLUTD()[iLeftBaseViewIdx ][iSynthViewIdx],333 m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx],334 m_cCameraData.getBaseViewShiftLUTI ()[iLeftBaseViewIdx ][iRightBaseViewIdx],335 m_cCameraData.getSynthViewShiftLUTD()[iRightBaseViewIdx][iSynthViewIdx],336 m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx][iSynthViewIdx],337 m_cCameraData.getBaseViewShiftLUTI ()[iRightBaseViewIdx][iLeftBaseViewIdx ],338 339 iRelDistToLeft340 );341 342 m_pcRenTop->interpolateView(343 apcPicYuvBaseVideo[iLeftBaseViewIdx ],344 apcPicYuvBaseDepth[iLeftBaseViewIdx ],345 apcPicYuvBaseVideo[iRightBaseViewIdx],346 apcPicYuvBaseDepth[iRightBaseViewIdx],347 pcPicYuvSynthOut,348 iBlendMode,349 iSimEnhBaseView350 );351 }352 else353 {354 AOT(iLeftBaseViewIdx != iRightBaseViewIdx );355 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut );356 std::cout << "Copied Frame " << iFrame357 << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC358 << " (BaseView) " << std::endl;359 }360 361 break;362 /// EXTRAPOLATION FROM LEFT363 case 1:364 if ( !bHasLView ) // View to render is BaseView365 {366 bRender = false;367 }368 369 if ( bIsBaseView )370 {371 AOF( iLeftBaseViewIdx == iRightBaseViewIdx );372 Int iSortedBaseViewIdx = m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx];373 if ( iSortedBaseViewIdx - 1 >= 0 )374 {375 iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx - 1];376 }377 else378 {379 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;380 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original381 bRender = false;382 }383 }384 385 386 if (bRender)387 {388 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;389 m_pcRenTop->setShiftLUTs( m_cCameraData.getSynthViewShiftLUTD()[iLeftBaseViewIdx ][iSynthViewIdx],390 m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx], NULL, NULL, NULL, NULL, -1 );391 m_pcRenTop->extrapolateView( apcPicYuvBaseVideo[iLeftBaseViewIdx ], apcPicYuvBaseDepth[iLeftBaseViewIdx ], pcPicYuvSynthOut, true );392 }393 break;394 /// EXTRAPOLATION FROM RIGHT395 case 2: // extrapolation from right396 if ( !bHasRView ) // View to render is BaseView397 {398 bRender = false;399 }400 401 if ( bIsBaseView )402 {403 404 AOF( iLeftBaseViewIdx == iRightBaseViewIdx );405 Int iSortedBaseViewIdx = m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx];406 if ( iSortedBaseViewIdx + 1 < m_iNumberOfInputViews )407 {408 iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx + 1];409 }410 else411 {412 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;413 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original414 bRender = false;415 }416 }417 418 if ( bRender )419 {420 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;421 m_pcRenTop->setShiftLUTs( NULL, NULL,NULL, m_cCameraData.getSynthViewShiftLUTD()[iRightBaseViewIdx ][iSynthViewIdx],422 m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx ][iSynthViewIdx],NULL, iRelDistToLeft);423 m_pcRenTop->extrapolateView( apcPicYuvBaseVideo[iRightBaseViewIdx ], apcPicYuvBaseDepth[iRightBaseViewIdx ], pcPicYuvSynthOut, false);424 }425 break;426 }427 428 // Write Output429 430 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, 0, 0, 0, 0 );431 }432 iFrame++;433 iNumOfRenderedFrames++;434 }435 436 // Delete Buffers437 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )438 {439 apcPicYuvBaseVideo[uiBaseView]->destroy();440 delete apcPicYuvBaseVideo[uiBaseView];441 442 apcPicYuvBaseDepth[uiBaseView]->destroy();443 delete apcPicYuvBaseDepth[uiBaseView];444 445 // Temporal Filter446 if ( m_bTempDepthFilter )447 {448 apcPicYuvLastBaseVideo[uiBaseView]->destroy();449 delete apcPicYuvLastBaseVideo[uiBaseView];450 451 apcPicYuvLastBaseDepth[uiBaseView]->destroy();452 delete apcPicYuvLastBaseDepth[uiBaseView];453 }454 }455 456 pcPicYuvSynthOut->destroy();457 delete pcPicYuvSynthOut;458 459 xDestroyLib();460 461 }462 463 Void TAppRendererTop::go()464 {465 switch ( m_iRenderMode )466 {467 case 0:468 render();469 break;470 #if H_3D_VSO471 case 1:472 renderModel();473 break;474 #endif475 case 10:476 renderUsedPelsMap( );477 break;478 default:479 AOT(true);480 }481 482 #if H_3D_REN_MAX_DEV_OUT483 Double dMaxDispDiff = m_cCameraData.getMaxShiftDeviation();484 485 if ( !(dMaxDispDiff < 0) )486 {487 printf("\n Max. possible shift error: %12.3f samples.\n", dMaxDispDiff );488 }489 #endif490 }491 492 #if H_3D_VSO493 Void TAppRendererTop::renderModel()494 {495 if ( m_bUseSetupString )496 {497 xRenderModelFromString();498 }499 else500 {501 xRenderModelFromNums();502 }503 }504 505 506 507 Void TAppRendererTop::xRenderModelFromString()508 {509 xCreateLib();510 xInitLib();511 512 // Create Buffers Input Views;513 std::vector<TComPicYuv*> apcPicYuvBaseVideo;514 std::vector<TComPicYuv*> apcPicYuvBaseDepth;515 516 517 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )518 {519 TComPicYuv* pcNewVideoPic = new TComPicYuv;520 TComPicYuv* pcNewDepthPic = new TComPicYuv;521 522 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );523 apcPicYuvBaseVideo.push_back(pcNewVideoPic);524 525 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );526 apcPicYuvBaseDepth.push_back(pcNewDepthPic);527 }528 529 Int aiPad[2] = { 0, 0 };530 531 // Init Model532 TRenModel cCurModel;533 534 AOT( m_iLog2SamplingFactor != 0 );535 #if H_3D_VSO_EARLY_SKIP536 cCurModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false );537 #else538 cCurModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin );539 #endif540 541 cCurModel.setupPart( 0, m_iSourceHeight );542 543 for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfInputViews; iViewIdx++ )544 {545 Int iNumOfModels = m_cRenModStrParser.getNumOfModelsForView(iViewIdx, 1);546 547 for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ )548 {549 Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode;550 m_cRenModStrParser.getSingleModelData ( iViewIdx, 1, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ;551 cCurModel .createSingleModel ( iViewIdx, 1, iModelNum, iLeftViewNum, iRightViewNum, false, iBlendMode );552 553 }554 }555 556 // Create Buffer for synthesized View557 TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;558 pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );559 560 Bool bAnyEOS = false;561 562 Int iNumOfRenderedFrames = 0;563 Int iFrame = 0;564 565 while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )566 {567 568 if ( iFrame >= m_iFrameSkip )569 {570 // read in depth and video571 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )572 {573 m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], aiPad ) ;574 bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();575 576 m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], aiPad ) ;577 bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();578 }579 }580 else581 {582 iFrame++;583 continue;584 }585 586 587 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )588 {589 TComPicYuv* pcPicYuvVideo = apcPicYuvBaseVideo[iBaseViewIdx];590 TComPicYuv* pcPicYuvDepth = apcPicYuvBaseDepth[iBaseViewIdx];591 Int iBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iBaseViewIdx ];592 cCurModel.setBaseView( iBaseViewSIdx, pcPicYuvVideo, pcPicYuvDepth, NULL, NULL );593 }594 595 m_cCameraData.update( (UInt) ( iFrame - m_iFrameSkip ));596 597 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )598 {599 // setup virtual views600 Int iBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iBaseViewIdx];601 602 cCurModel.setErrorMode( iBaseViewSIdx, 1, 0 );603 Int iNumOfSV = m_cRenModStrParser.getNumOfModelsForView( iBaseViewSIdx, 1);604 for (Int iCurView = 0; iCurView < iNumOfSV; iCurView++ )605 {606 Int iOrgRefBaseViewSIdx;607 Int iLeftBaseViewSIdx;608 Int iRightBaseViewSIdx;609 Int iSynthViewRelNum;610 Int iModelNum;611 Int iBlendMode;612 613 m_cRenModStrParser.getSingleModelData(iBaseViewSIdx, 1, iCurView, iModelNum, iBlendMode, iLeftBaseViewSIdx, iRightBaseViewSIdx, iOrgRefBaseViewSIdx, iSynthViewRelNum );614 615 Int iLeftBaseViewIdx = -1;616 Int iRightBaseViewIdx = -1;617 618 TComPicYuv* pcPicYuvOrgRef = NULL;619 Int** ppiShiftLUTLeft = NULL;620 Int** ppiShiftLUTRight = NULL;621 Int** ppiBaseShiftLUTLeft = NULL;622 Int** ppiBaseShiftLUTRight = NULL;623 624 625 Int iDistToLeft = -1;626 627 Int iSynthViewIdx = m_cCameraData.synthRelNum2Idx( iSynthViewRelNum );628 629 if ( iLeftBaseViewSIdx != -1 )630 {631 iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [ iLeftBaseViewSIdx ];632 ppiShiftLUTLeft = m_cCameraData.getSynthViewShiftLUTI()[ iLeftBaseViewIdx ][ iSynthViewIdx ];633 }634 635 if ( iRightBaseViewSIdx != -1 )636 {637 iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [iRightBaseViewSIdx ];638 ppiShiftLUTRight = m_cCameraData.getSynthViewShiftLUTI()[ iRightBaseViewIdx ][ iSynthViewIdx ];639 }640 641 if ( iRightBaseViewSIdx != -1 && iLeftBaseViewSIdx != -1 )642 {643 644 ppiBaseShiftLUTLeft = m_cCameraData.getBaseViewShiftLUTI() [ iLeftBaseViewIdx ][ iRightBaseViewIdx ];645 ppiBaseShiftLUTRight = m_cCameraData.getBaseViewShiftLUTI() [ iRightBaseViewIdx ][ iLeftBaseViewIdx ];646 iDistToLeft = m_cCameraData.getRelDistLeft( iSynthViewIdx , iLeftBaseViewIdx, iRightBaseViewIdx);647 }648 649 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;650 651 cCurModel.setSingleModel( iModelNum, ppiShiftLUTLeft, ppiBaseShiftLUTLeft, ppiShiftLUTRight, ppiBaseShiftLUTRight, iDistToLeft, pcPicYuvOrgRef );652 653 Int iViewPos;654 if (iLeftBaseViewSIdx != -1 && iRightBaseViewSIdx != -1)655 {656 iViewPos = VIEWPOS_MERGED;657 }658 else if ( iLeftBaseViewSIdx != -1 )659 {660 iViewPos = VIEWPOS_LEFT;661 }662 else if ( iRightBaseViewSIdx != -1 )663 {664 iViewPos = VIEWPOS_RIGHT;665 }666 else667 {668 AOT(true);669 }670 671 cCurModel.getSynthVideo ( iModelNum, iViewPos, pcPicYuvSynthOut );672 673 // Write Output674 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iModelNum]->write( pcPicYuvSynthOut, 0 ,0 ,0, 0 );675 }676 }677 iFrame++;678 iNumOfRenderedFrames++;679 }680 681 // Delete Buffers682 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )683 {684 apcPicYuvBaseVideo[uiBaseView]->destroy();685 delete apcPicYuvBaseVideo[uiBaseView];686 687 apcPicYuvBaseDepth[uiBaseView]->destroy();688 delete apcPicYuvBaseDepth[uiBaseView];689 }690 pcPicYuvSynthOut->destroy();691 delete pcPicYuvSynthOut;692 693 xDestroyLib();694 }695 696 697 Void TAppRendererTop::xRenderModelFromNums()698 {699 xCreateLib();700 xInitLib();701 702 // Create Buffers Input Views;703 std::vector<TComPicYuv*> apcPicYuvBaseVideo;704 std::vector<TComPicYuv*> apcPicYuvBaseDepth;705 706 707 Int aiPad[2] = { 0, 0 };708 709 // Init Model710 TRenModel cCurModel;711 712 AOT( m_iLog2SamplingFactor != 0 );713 cCurModel.setupPart( 0, m_iSourceHeight );714 #if H_3D_VSO_EARLY_SKIP715 cCurModel.create( m_iNumberOfInputViews, m_iNumberOfOutputViews, m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false );716 #else717 cCurModel.create( m_iNumberOfInputViews, m_iNumberOfOutputViews, m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin );718 #endif719 720 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )721 {722 TComPicYuv* pcNewVideoPic = new TComPicYuv;723 TComPicYuv* pcNewDepthPic = new TComPicYuv;724 725 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );726 apcPicYuvBaseVideo.push_back(pcNewVideoPic);727 728 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );729 apcPicYuvBaseDepth.push_back(pcNewDepthPic);730 }731 732 for(Int iSynthViewIdx=0; iSynthViewIdx < m_iNumberOfOutputViews; iSynthViewIdx++ )733 {734 Int iLeftBaseViewIdx = -1;735 Int iRightBaseViewIdx = -1;736 Bool bIsBaseView = false;737 738 Int iRelDistToLeft;739 m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftBaseViewIdx, iRightBaseViewIdx, iRelDistToLeft, bIsBaseView );740 741 if (m_iRenderDirection == 1 )742 {743 iRightBaseViewIdx = -1;744 AOT( iLeftBaseViewIdx == -1);745 }746 747 if (m_iRenderDirection == 2 )748 {749 iLeftBaseViewIdx = -1;750 AOT( iRightBaseViewIdx == -1);751 }752 753 Int iLeftBaseViewSIdx = -1;754 Int iRightBaseViewSIdx = -1;755 756 if (iLeftBaseViewIdx != -1 )757 {758 iLeftBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iLeftBaseViewIdx];759 }760 761 if (iRightBaseViewIdx != -1 )762 {763 iRightBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iRightBaseViewIdx];764 }765 cCurModel.createSingleModel(-1, -1, iSynthViewIdx, iLeftBaseViewSIdx, iRightBaseViewSIdx, false, m_iBlendMode );766 }767 768 // Create Buffer for synthesized View769 TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;770 pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );771 772 Bool bAnyEOS = false;773 774 Int iNumOfRenderedFrames = 0;775 Int iFrame = 0;776 777 while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )778 {779 780 if ( iFrame >= m_iFrameSkip )781 {782 // read in depth and video783 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )784 {785 m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], aiPad ) ;786 bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();787 788 m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], aiPad ) ;789 bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();790 791 if ( iFrame >= m_iFrameSkip )792 {793 Int iBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iBaseViewIdx];794 cCurModel.setBaseView( iBaseViewSIdx, apcPicYuvBaseVideo[iBaseViewIdx], apcPicYuvBaseDepth[iBaseViewIdx], NULL, NULL );795 }796 }797 }798 else799 {800 iFrame++;801 continue;802 }803 m_cCameraData.update( (UInt) (iFrame - m_iFrameSkip ));804 for(Int iSynthViewIdx=0; iSynthViewIdx < m_iNumberOfOutputViews; iSynthViewIdx++ )805 {806 807 Int iLeftBaseViewIdx = -1;808 Int iRightBaseViewIdx = -1;809 810 Bool bIsBaseView = false;811 812 Int iRelDistToLeft;813 Bool bHasLRView = m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftBaseViewIdx, iRightBaseViewIdx, iRelDistToLeft, bIsBaseView );814 Bool bHasLView = ( iLeftBaseViewIdx != -1 );815 Bool bHasRView = ( iRightBaseViewIdx != -1 );816 817 switch( m_iRenderDirection )818 {819 /// INTERPOLATION820 case 0:821 assert( bHasLRView || bIsBaseView );822 823 if ( !bHasLRView && bIsBaseView ) // View to render is BaseView824 {825 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;826 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original827 }828 else // Render829 {830 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;831 cCurModel.setSingleModel( iSynthViewIdx,832 m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx] ,833 m_cCameraData.getBaseViewShiftLUTI ()[iLeftBaseViewIdx ][iRightBaseViewIdx],834 m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx][iSynthViewIdx] ,835 m_cCameraData.getBaseViewShiftLUTI ()[iRightBaseViewIdx][iLeftBaseViewIdx] ,836 iRelDistToLeft,837 NULL );838 cCurModel.getSynthVideo ( iSynthViewIdx, VIEWPOS_MERGED, pcPicYuvSynthOut );839 }840 break;841 /// EXTRAPOLATION FROM LEFT842 case 1:843 844 if ( !bHasLView ) // View to render is BaseView845 {846 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;847 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original848 }849 else // Render850 {851 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;852 cCurModel.setSingleModel( iSynthViewIdx, m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx], NULL, NULL, NULL, -1, NULL);853 cCurModel.getSynthVideo ( iSynthViewIdx, VIEWPOS_LEFT, pcPicYuvSynthOut );854 }855 break;856 /// EXTRAPOLATION FROM RIGHT857 case 2: // extrapolation from right858 if ( !bHasRView ) // View to render is BaseView859 {860 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;861 apcPicYuvBaseVideo[iRightBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original862 }863 else // Render864 {865 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;866 cCurModel.setSingleModel( iSynthViewIdx, NULL , NULL, m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx ][iSynthViewIdx], NULL, -1, NULL);867 cCurModel.getSynthVideo ( iSynthViewIdx, VIEWPOS_RIGHT, pcPicYuvSynthOut );868 }869 break;870 }871 872 // Write Output873 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, 0, 0, 0, 0 );874 }875 iFrame++;876 iNumOfRenderedFrames++;877 }878 879 // Delete Buffers880 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )881 {882 apcPicYuvBaseVideo[uiBaseView]->destroy();883 delete apcPicYuvBaseVideo[uiBaseView];884 885 apcPicYuvBaseDepth[uiBaseView]->destroy();886 delete apcPicYuvBaseDepth[uiBaseView];887 }888 pcPicYuvSynthOut->destroy();889 delete pcPicYuvSynthOut;890 891 xDestroyLib();892 893 }894 #endif895 896 Void TAppRendererTop::renderUsedPelsMap( )897 {898 xCreateLib();899 xInitLib();900 901 // Create Buffers Input Views;902 std::vector<TComPicYuv*> apcPicYuvBaseVideo;903 std::vector<TComPicYuv*> apcPicYuvBaseDepth;904 905 // TemporalImprovement Filter906 std::vector<TComPicYuv*> apcPicYuvLastBaseVideo;907 std::vector<TComPicYuv*> apcPicYuvLastBaseDepth;908 909 Int aiPad[2] = { 0, 0 };910 911 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )912 {913 TComPicYuv* pcNewVideoPic = new TComPicYuv;914 TComPicYuv* pcNewDepthPic = new TComPicYuv;915 916 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );917 apcPicYuvBaseVideo.push_back(pcNewVideoPic);918 919 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );920 apcPicYuvBaseDepth.push_back(pcNewDepthPic);921 922 //Temporal improvement Filter923 if ( m_bTempDepthFilter )924 {925 pcNewVideoPic = new TComPicYuv;926 pcNewDepthPic = new TComPicYuv;927 928 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );929 apcPicYuvLastBaseVideo.push_back(pcNewVideoPic);930 931 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );932 apcPicYuvLastBaseDepth.push_back(pcNewDepthPic);933 }934 }935 936 // Create Buffer for synthesized View937 TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;938 pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );939 940 Bool bAnyEOS = false;941 942 Int iNumOfRenderedFrames = 0;943 Int iFrame = 0;944 945 while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )946 {947 if ( iFrame >= m_iFrameSkip )948 {949 // read in depth and video950 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )951 {952 m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], aiPad ) ;953 apcPicYuvBaseVideo[iBaseViewIdx]->extendPicBorder();954 bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();955 956 m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], aiPad ) ;957 apcPicYuvBaseDepth[iBaseViewIdx]->extendPicBorder();958 bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();959 960 if ( m_bTempDepthFilter && (iFrame >= m_iFrameSkip) )961 {962 m_pcRenTop->temporalFilterVSRS( apcPicYuvBaseVideo[iBaseViewIdx], apcPicYuvBaseDepth[iBaseViewIdx], apcPicYuvLastBaseVideo[iBaseViewIdx], apcPicYuvLastBaseDepth[iBaseViewIdx], ( iFrame == m_iFrameSkip) );963 }964 }965 }966 else967 {968 std::cout << "Skipping Frame " << iFrame << std::endl;969 970 iFrame++;971 continue;972 }973 m_cCameraData.update( (UInt) ( iFrame - m_iFrameSkip ) );974 975 for(Int iViewIdx=1; iViewIdx < m_iNumberOfInputViews; iViewIdx++ )976 {977 std::cout << "Rendering UsedPelsMap for Frame " << iFrame << " of View " << (Double) m_cCameraData.getBaseViewNumbers()[iViewIdx] << std::endl;978 979 Int iViewSIdx = m_cCameraData.getBaseId2SortedId()[iViewIdx];980 Int iFirstViewSIdx = m_cCameraData.getBaseId2SortedId()[0];981 982 AOT( iViewSIdx == iFirstViewSIdx );983 984 Bool bFirstIsLeft = (iFirstViewSIdx < iViewSIdx);985 986 m_pcRenTop->setShiftLUTs(987 m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx],988 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],989 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],990 m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx],991 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],992 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],993 -1994 );995 996 m_pcRenTop->getUsedSamplesMap( apcPicYuvBaseDepth[0], pcPicYuvSynthOut, bFirstIsLeft );997 998 // Write Output999 m_apcTVideoIOYuvSynthOutput[iViewIdx-1]->write( pcPicYuvSynthOut, 0, 0, 0 );1000 1001 }1002 iFrame++;1003 iNumOfRenderedFrames++;1004 }1005 1006 // Delete Buffers1007 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )1008 {1009 apcPicYuvBaseVideo[uiBaseView]->destroy();1010 delete apcPicYuvBaseVideo[uiBaseView];1011 1012 apcPicYuvBaseDepth[uiBaseView]->destroy();1013 delete apcPicYuvBaseDepth[uiBaseView];1014 1015 // Temporal Filter1016 if ( m_bTempDepthFilter )1017 {1018 apcPicYuvLastBaseVideo[uiBaseView]->destroy();1019 delete apcPicYuvLastBaseVideo[uiBaseView];1020 1021 apcPicYuvLastBaseDepth[uiBaseView]->destroy();1022 delete apcPicYuvLastBaseDepth[uiBaseView];1023 }1024 }1025 pcPicYuvSynthOut->destroy();1026 delete pcPicYuvSynthOut;1027 1028 xDestroyLib();1029 1030 }1031 #endif -
branches/HTM-14.0-MV-draft-3/source/App/TAppRenderer/TAppRendererTop.h
r1179 r1191 40 40 #define __TAppRendererTOP__ 41 41 #include "../../Lib/TLibCommon/TypeDef.h" 42 #if H_3D43 #include "../../Lib/TLibRenderer/TRenTop.h"44 #include "../../Lib/TLibVideoIO/TVideoIOYuv.h"45 #include "TAppRendererCfg.h"46 #include "TAppRendererTop.h"47 #include "../../Lib/TLibRenderer/TRenModel.h"48 49 // ====================================================================================================================50 // Class definition51 // ====================================================================================================================52 53 /// encoder application class54 class TAppRendererTop : public TAppRendererCfg55 {56 private:57 // class interface58 std::vector<TVideoIOYuv*> m_apcTVideoIOYuvVideoInput;59 std::vector<TVideoIOYuv*> m_apcTVideoIOYuvDepthInput;60 std::vector<TVideoIOYuv*> m_apcTVideoIOYuvSynthOutput;61 62 // RendererInterface63 TRenTop* m_pcRenTop;64 65 protected:66 // initialization67 Void xCreateLib (); ///< create renderer class and video io68 Void xInitLib (); ///< initialize renderer class69 Void xDestroyLib (); ///< destroy renderer class and video io70 #if H_3D_VSO71 Void xRenderModelFromString(); ///< render using model using setup string72 Void xRenderModelFromNums(); ///< render using model using synth view numbers73 #endif74 75 public:76 TAppRendererTop();77 virtual ~TAppRendererTop();78 79 Void render (); ///< main encoding function80 #if H_3D_VSO81 Void renderModel ();82 #endif83 Void go ();84 Void renderUsedPelsMap();85 86 };// END CLASS DEFINITION TAppRendererTop87 88 89 #endif // H_3D90 42 #endif // __TAppRendererTOP__
Note: See TracChangeset for help on using the changeset viewer.