Changeset 1390 in 3DVCSoftware for branches/HTM-16.0-MV-draft-5/source/App
- Timestamp:
- 13 Nov 2015, 17:00:20 (9 years ago)
- Location:
- branches/HTM-16.0-MV-draft-5/source/App
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-16.0-MV-draft-5/source/App/TAppDecoder/TAppDecCfg.cpp
r1386 r1390 66 66 Bool do_help = false; 67 67 string cfg_TargetDecLayerIdSetFile; 68 #if NH_3D69 string cfg_ScaleOffsetFile;70 #endif71 68 string outputColourSpaceConvert; 72 69 Int warnUnknowParameter = 0; … … 80 77 ("ReconFile,o", m_reconFileName, string(""), "reconstructed YUV output file name\n" 81 78 "YUV writing is skipped if omitted") 82 #if NH_3D83 ("ScaleOffsetFile,p", cfg_ScaleOffsetFile, string(""), "file with coded scales and offsets")84 ("Depth420OutputFlag", m_depth420OutputFlag, true , "Output depth layers in 4:2:0 ")85 #endif86 79 ("WarnUnknowParameter,w", warnUnknowParameter, 0, "warn for unknown configuration parameters instead of failing") 87 80 ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access") … … 148 141 } 149 142 150 #if NH_3D151 m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str());152 #endif153 143 154 144 if (m_bitstreamFileName.empty()) -
branches/HTM-16.0-MV-draft-5/source/App/TAppDecoder/TAppDecCfg.h
r1386 r1390 96 96 Bool m_printPicOutput; ///< Print information on picture output 97 97 Bool m_printReceivedNalus; ///< Print information on received NAL units 98 #if NH_3D99 TChar* m_pchScaleOffsetFile; ///< output coded scale and offset parameters100 Bool m_depth420OutputFlag; ///< output depth layers in 4:2:0101 #endif102 98 103 99 Void xAppendToFileNameEnd( const TChar* pchInputFileName, const TChar* pchStringToAppend, TChar*& rpchOutputFileName); ///< create filenames … … 132 128 m_outputBitDepth[channelTypeIndex] = 0; 133 129 } 134 #if NH_3D135 m_pchScaleOffsetFile = NULL;136 #endif137 130 } 138 131 -
branches/HTM-16.0-MV-draft-5/source/App/TAppDecoder/TAppDecTop.cpp
r1386 r1390 94 94 m_cvsStartFound = false; 95 95 #endif 96 #if NH_3D97 m_pScaleOffsetFile = 0;98 #endif99 96 } 100 97 … … 131 128 #endif 132 129 m_reconFileName.clear(); 133 #if NH_3D134 if (m_pchScaleOffsetFile)135 {136 free (m_pchScaleOffsetFile);137 m_pchScaleOffsetFile = NULL;138 }139 #endif140 130 } 141 131 … … 405 395 // initialize global variables 406 396 initROM(); 407 #if NH_3D_DMM408 initWedgeLists();409 #endif410 397 #else 411 398 // create decoder class … … 453 440 m_pcSeiColourRemappingInfoPrevious = NULL; 454 441 } 455 #if NH_3D456 m_cCamParsCollector.uninit();457 if( m_pScaleOffsetFile )458 {459 ::fclose( m_pScaleOffsetFile );460 }461 #endif462 442 } 463 443 … … 465 445 { 466 446 467 #if NH_3D468 m_cCamParsCollector.setCodeScaleOffsetFile( m_pScaleOffsetFile );469 #endif470 447 #if NH_MV 471 448 m_dpb.setPrintPicOutput(m_printPicOutput); … … 1059 1036 xFinalizeAU ( ); 1060 1037 1061 #if NH_3D1062 if( m_cCamParsCollector.isInitialized() )1063 {1064 m_cCamParsCollector.setSlice( 0 );1065 }1066 #endif1067 1038 xFlushOutput(); 1068 1039 m_dpb.emptyAllSubDpbs(); … … 1092 1063 m_newVpsActivatedbyCurAu = true; //TBD 1093 1064 m_newVpsActivatedbyCurPic = true; 1094 #if NH_3D_VSO1095 m_dpb.setVPS( m_vps );1096 #endif1097 1065 } 1098 1066 … … 1216 1184 Void TAppDecTop::xFinalizeAU() 1217 1185 { 1218 #if NH_3D1219 if ( !m_curAu.empty())1220 {1221 for (TComList<TComPic*>::iterator it = m_curAu.begin(); it != m_curAu.end(); it++)1222 {1223 TComPic* pic = (*it);1224 if ( !pic->getHasGeneratedRefPics() )1225 {1226 pic->compressMotion(1);1227 }1228 }1229 }1230 #endif1231 1186 } 1232 1187 … … 2688 2643 m_tDecTop[ decIdx ]->setDecodedSEIMessageOutputStream(&os); 2689 2644 } 2690 #if NH_3D2691 m_tDecTop[ decIdx ]->setCamParsCollector( &m_cCamParsCollector );2692 #endif2693 2645 2694 2646 // append pic list of new decoder to PicLists … … 2912 2864 } 2913 2865 2914 #if NH_3D2915 if( m_pchScaleOffsetFile )2916 {2917 m_pScaleOffsetFile = ::fopen( m_pchScaleOffsetFile, "wt" );2918 if (!m_pScaleOffsetFile)2919 {2920 fprintf(stderr, "\nUnable to open file `%s' for writing decoded Camera Parameters messages\n", m_pchScaleOffsetFile);2921 exit(EXIT_FAILURE);2922 }2923 }2924 #endif2925 2866 } 2926 2867 … … 3011 2952 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 3012 2953 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), 3013 #if NH_3D3014 m_depth420OutputFlag && curPic->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT3015 #else3016 2954 NUM_CHROMA_FORMAT 3017 #endif3018 2955 , m_bClipOutputVideoToRec709Range); 3019 2956 } -
branches/HTM-16.0-MV-draft-5/source/App/TAppDecoder/TAppDecTop.h
r1386 r1390 117 117 118 118 Bool m_reconOpen [ MAX_NUM_LAYERS ]; ///< reconstruction file opened 119 #if NH_3D120 FILE* m_pScaleOffsetFile;121 CamParsCollector m_cCamParsCollector;122 #endif123 119 #else 124 120 TDecTop m_cTDecTop; ///< decoder class -
branches/HTM-16.0-MV-draft-5/source/App/TAppEncoder/TAppEncCfg.cpp
r1386 r1390 73 73 #if NH_MV 74 74 MULTIVIEWMAIN = 6, 75 #if NH_3D76 MAIN3D = 8,77 #endif78 75 #endif 79 76 MONOCHROME_8 = 1008, … … 120 117 m_targetPivotValue = NULL; 121 118 122 #if KWU_RC_MADPRED_E0227123 m_depthMADPred = 0;124 #endif125 119 } 126 120 … … 181 175 { 182 176 free ( m_pchBaseViewCameraNumbers ); 183 }184 #endif185 #if NH_3D_VSO186 if ( m_pchVSOConfig != NULL)187 {188 free ( m_pchVSOConfig );189 }190 191 if ( m_pchCameraParameterFile != NULL )192 {193 free ( m_pchCameraParameterFile );194 177 } 195 178 #endif … … 276 259 } 277 260 #endif 278 #if NH_3D279 in>>entry.m_interCompPredFlag;280 #endif281 261 282 262 return in; … … 312 292 #if NH_MV 313 293 ,{"multiview-main" , Profile::MULTIVIEWMAIN }, 314 #if NH_3D315 {"3d-main" , Profile::MAIN3D }316 #endif317 294 #endif 318 295 … … 341 318 #if NH_MV 342 319 {"multiview-main" , MULTIVIEWMAIN }, 343 #if NH_3D344 {"3d-main" , MAIN3D },345 #endif346 320 #endif 347 321 {"monochrome", MONOCHROME_8 }, … … 726 700 string cfg_levels; 727 701 string cfg_tiers; 728 #if NH_3D729 cfg_dimensionLength.push_back( 2 ); // depth730 cfg_dimensionLength.push_back( 32 ); // texture731 #else732 702 cfg_dimensionLength.push_back( 64 ); 733 #endif734 703 #endif 735 704 … … 807 776 #if NH_MV 808 777 ("NumberOfLayers", m_numberOfLayers , 1, "Number of layers") 809 #if !NH_3D810 778 ("ScalabilityMask", m_scalabilityMask , 2 , "Scalability Mask: 2: Multiview, 8: Auxiliary, 10: Multiview + Auxiliary") 811 #else812 ("ScalabilityMask", m_scalabilityMask , 3 , "Scalability Mask, 1: Texture 3: Texture + Depth ")813 #endif814 779 ("DimensionIdLen", m_dimensionIdLen , cfg_dimensionLength , "Number of bits used to store dimensions Id") 815 780 ("ViewOrderIndex", m_viewOrderIndex , IntAry1d(1,0), "View Order Index per layer") 816 781 ("ViewId", m_viewId , IntAry1d(1,0), "View Id per View Order Index") 817 782 ("AuxId", m_auxId , IntAry1d(1,0), "AuxId per layer") 818 #if NH_3D_VSO819 ("DepthFlag", m_depthFlag , IntAry1d(1,0), "Depth Flag")820 #endif821 783 ("TargetEncLayerIdList", m_targetEncLayerIdList , IntAry1d(0,0), "LayerIds in Nuh to be encoded") 822 784 ("LayerIdInNuh", m_layerIdInNuh , IntAry1d(1,0), "LayerId in Nuh") … … 1095 1057 #endif 1096 1058 1097 #if KWU_RC_VIEWRC_E02271098 ("ViewWiseTargetBits, -vtbr" , m_viewTargetBits, std::vector<Int>(1, 32), "View-wise target bit-rate setting")1099 ("TargetBitAssign, -ta", m_viewWiseRateCtrl, false, "View-wise rate control on/off")1100 #endif1101 #if KWU_RC_MADPRED_E02271102 ("DepthMADPred, -dm", m_depthMADPred, (UInt)0, "Depth based MAD prediction on/off")1103 #endif1104 1059 #if NH_MV 1105 1060 // A lot of this stuff could should actually be derived by the encoder. … … 1282 1237 ("BaseViewCameraNumbers", m_pchBaseViewCameraNumbers, (TChar *) 0 , "Numbers of base views") 1283 1238 #endif 1284 #if NH_3D1285 ("Depth420OutputFlag", m_depth420OutputFlag, true , "Output depth layers in 4:2:0 ")1286 #endif1287 #if NH_3D_VSO1288 ("CameraParameterFile,cpf", m_pchCameraParameterFile, (TChar *) 0 , "Camera Parameter File Name")1289 ("CodedCamParsPrecision", m_iCodedCamParPrecision, STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )1290 1291 /* View Synthesis Optimization */1292 ("VSOConfig", m_pchVSOConfig , (TChar *) 0 ,"VSO configuration")1293 ("VSO", m_bUseVSO , false ,"Use VSO" )1294 ("VSOMode", m_uiVSOMode , (UInt) 4 ,"VSO Mode")1295 ("LambdaScaleVSO", m_dLambdaScaleVSO , (Double) 1 ,"Lambda Scaling for VSO")1296 ("VSOLSTable", m_bVSOLSTable , true ,"Depth QP dependent video/depth rate allocation by Lagrange multiplier" )1297 ("ForceLambdaScaleVSO", m_bForceLambdaScaleVSO , false ,"Force using Lambda Scale VSO also in non-VSO-Mode")1298 ("AllowNegDist", m_bAllowNegDist , true ,"Allow negative Distortion in VSO")1299 1300 ("UseEstimatedVSD", m_bUseEstimatedVSD , true ,"Model based VSD estimation instead of rendering based for some encoder decisions" )1301 ("VSOEarlySkip", m_bVSOEarlySkip , true ,"Early skip of VSO computation if synthesis error assumed to be zero" )1302 1303 ("WVSO", m_bUseWVSO , true ,"Use depth fidelity term for VSO" )1304 ("VSOWeight", m_iVSOWeight , 10 ,"Synthesized View Distortion Change weight" )1305 ("VSDWeight", m_iVSDWeight , 1 ,"View Synthesis Distortion estimate weight" )1306 ("DWeight", m_iDWeight , 1 ,"Depth Distortion weight" )1307 #endif //HHI_VSO1308 1239 /* 3D- HEVC Tools */ 1309 #if NH_3D_QTL1310 ("QTL" , m_bUseQTL , true , "Use depth quad tree limitation (encoder only)" )1311 #endif1312 #if NH_3D1313 1314 ("IvMvPredFlag" , m_ivMvPredFlag , BoolAry1d(2,true) , "Inter-view motion prediction" )1315 ("IvMvScalingFlag" , m_ivMvScalingFlag , BoolAry1d(2,true) , "Inter-view motion vector scaling" )1316 ("Log2SubPbSizeMinus3" , m_log2SubPbSizeMinus3 , 0 , "Log2 minus 3 of sub Pb size" )1317 ("IvResPredFlag" , m_ivResPredFlag , true , "Inter-view residual prediction" )1318 ("DepthRefinementFlag" , m_depthRefinementFlag , true , "Depth to refine disparity" )1319 ("ViewSynthesisPredFlag" , m_viewSynthesisPredFlag , true , "View synthesis prediction" )1320 ("DepthBasedBlkPartFlag" , m_depthBasedBlkPartFlag , true , "Depth base block partitioning" )1321 ("MpiFlag" , m_mpiFlag , true , "Motion inheritance from texture to depth" )1322 ("Log2MpiSubPbSizeMinus3", m_log2MpiSubPbSizeMinus3 , 0 , "Log2 minus 3 of sub Pb size for MPI" )1323 ("IntraContourFlag" , m_intraContourFlag , true , "Intra contour mode" )1324 ("IntraWedgeFlag" , m_intraWedgeFlag , true , "Intra wedge mode and segmental depth DCs" )1325 ("IntraSdcFlag" , m_intraSdcFlag , true , "Intra depth DCs" )1326 ("QtPredFlag" , m_qtPredFlag , true , "Quad tree prediction from texture to depth")1327 ("InterSdcFlag" , m_interSdcFlag , true , "Inter depth DCs" )1328 ("DepthIntraSkip" , m_depthIntraSkipFlag , true , "Depth intra skip mode" )1329 ("DLT" , m_useDLT , true , "Depth lookup table" )1330 ("IlluCompEnable" , m_abUseIC , true , "Enable illumination compensation" )1331 ("IlluCompLowLatencyEnc" , m_bUseLowLatencyICEnc , false , "Enable low-latency illumination compensation encoding")1332 #endif //NH_3D1333 1240 1334 1241 ; … … 1536 1443 if( cfg_profiles.empty() ) 1537 1444 { 1538 #if NH_3D1539 cfg_profiles = string("main main 3d-main");1540 #else1541 1445 cfg_profiles = string("main main multiview-main"); 1542 #endif1543 1446 fprintf(stderr, "\nWarning: No profiles given, using defaults: %s", cfg_profiles.c_str() ); 1544 1447 anyEmpty = true; … … 1807 1710 xResizeVector( m_auxId ); 1808 1711 1809 #if NH_3D_VSO1810 xResizeVector( m_depthFlag );1811 #endif1812 1712 xResizeVector( m_fQP ); 1813 1713 … … 2017 1917 2018 1918 2019 #if NH_3D_VSO2020 // Table base optimization2021 // Q&D2022 Double adLambdaScaleTable[] =2023 { 0.031250, 0.031639, 0.032029, 0.032418, 0.032808, 0.033197, 0.033586, 0.033976, 0.034365, 0.034755,2024 0.035144, 0.035533, 0.035923, 0.036312, 0.036702, 0.037091, 0.037480, 0.037870, 0.038259, 0.038648,2025 0.039038, 0.039427, 0.039817, 0.040206, 0.040595, 0.040985, 0.041374, 0.041764, 0.042153, 0.042542,2026 0.042932, 0.043321, 0.043711, 0.044100, 0.044194, 0.053033, 0.061872, 0.070711, 0.079550, 0.088388,2027 0.117851, 0.147314, 0.176777, 0.235702, 0.294628, 0.353553, 0.471405, 0.589256, 0.707107, 0.707100,2028 0.753550, 0.8000002029 };2030 if ( m_bUseVSO && m_bVSOLSTable )2031 {2032 Int firstDepthLayer = -1;2033 for (Int layer = 0; layer < m_numberOfLayers; layer++ )2034 {2035 if ( m_depthFlag[ layer ] || m_auxId[ layer ] == 2 )2036 {2037 firstDepthLayer = layer;2038 break;2039 }2040 }2041 AOT( firstDepthLayer == -1 );2042 AOT( (m_iQP[firstDepthLayer] < 0) || (m_iQP[firstDepthLayer] > 51));2043 m_dLambdaScaleVSO *= adLambdaScaleTable[m_iQP[firstDepthLayer]];2044 }2045 if ( m_bUseVSO && m_uiVSOMode == 4)2046 {2047 m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig );2048 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),2049 m_internalBitDepth[ CHANNEL_TYPE_LUMA],2050 (UInt)m_iCodedCamParPrecision,2051 m_FrameSkip,2052 (UInt)m_framesToBeEncoded,2053 m_pchCameraParameterFile,2054 m_pchBaseViewCameraNumbers,2055 NULL,2056 m_cRenModStrParser.getSynthViews(),2057 LOG2_DISP_PREC_LUT );2058 }2059 else if ( m_bUseVSO && m_uiVSOMode != 4 )2060 {2061 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),2062 m_internalBitDepth[ CHANNEL_TYPE_LUMA],2063 (UInt)m_iCodedCamParPrecision,2064 m_FrameSkip,2065 (UInt)m_framesToBeEncoded,2066 m_pchCameraParameterFile,2067 m_pchBaseViewCameraNumbers,2068 m_pchVSOConfig,2069 NULL,2070 LOG2_DISP_PREC_LUT );2071 }2072 #if NH_3D2073 else2074 {2075 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),2076 m_internalBitDepth[ CHANNEL_TYPE_LUMA],2077 (UInt) m_iCodedCamParPrecision,2078 m_FrameSkip,2079 (UInt) m_framesToBeEncoded,2080 m_pchCameraParameterFile,2081 m_pchBaseViewCameraNumbers,2082 NULL,2083 NULL,2084 LOG2_DISP_PREC_LUT );2085 }2086 m_cCameraData.check( false, true );2087 #endif2088 #endif2089 1919 2090 1920 // check validity of input parameters … … 2264 2094 xConfirmPara( (m_layerIdInNuh.size()!=1) && (m_layerIdInNuh.size() < m_numberOfLayers) , "LayerIdInNuh must be given for all layers. "); 2265 2095 2266 #if NH_3D2267 xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 3, "Scalability Mask must be equal to 2 or 3. ");2268 #else2269 2096 xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 8 && m_scalabilityMask != 10, "Scalability Mask must be equal to 2, 8 or 10"); 2270 #endif 2271 2272 #if NH_3D_VSO 2273 if ( m_scalabilityMask & ( 1 << DEPTH_ID ) ) 2274 { 2275 m_dimIds.push_back( m_depthFlag ); 2276 } 2277 #endif 2097 2278 2098 2279 2099 m_dimIds.push_back( m_viewOrderIndex ); … … 2342 2162 xConfirmPara( allEqual , "Each layer shall have a different position in scalability space." ); 2343 2163 2344 #if !H_3D_FCO2345 2164 if ( numDiff == 1 ) 2346 2165 { … … 2353 2172 xConfirmPara( shallBeButIsNotIncreasing, "DimensionIds shall be increasing within one dimension. " ); 2354 2173 } 2355 #endif2356 2174 } 2357 2175 } … … 2560 2378 xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater."); 2561 2379 xConfirmPara( m_maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller."); 2562 #if NH_3D2563 xConfirmPara( m_log2SubPbSizeMinus3 < 0, "Log2SubPbSizeMinus3 must be equal to 0 or greater.");2564 xConfirmPara( m_log2SubPbSizeMinus3 > 3, "Log2SubPbSizeMinus3 must be equal to 3 or smaller.");2565 xConfirmPara( (1<< ( m_log2SubPbSizeMinus3 + 3) ) > m_uiMaxCUWidth, "Log2SubPbSizeMinus3 must be equal to log2(maxCUSize)-3 or smaller.");2566 2567 xConfirmPara( m_log2MpiSubPbSizeMinus3 < 0, "Log2MpiSubPbSizeMinus3 must be equal to 0 or greater.");2568 xConfirmPara( m_log2MpiSubPbSizeMinus3 > 3, "Log2MpiSubPbSizeMinus3 must be equal to 3 or smaller.");2569 xConfirmPara( (1<< (m_log2MpiSubPbSizeMinus3 + 3)) > m_uiMaxCUWidth, "Log2MpiSubPbSizeMinus3 must be equal to log2(maxCUSize)-3 or smaller.");2570 #endif2571 2380 #if ADAPTIVE_QP_SELECTION 2572 2381 #if NH_MV … … 2629 2438 } 2630 2439 2631 #if NH_3D_VSO2632 xConfirmPara( m_pchCameraParameterFile == 0 , "CameraParameterFile must be given");2633 xConfirmPara( m_pchBaseViewCameraNumbers == 0 , "BaseViewCameraNumbers must be given" );2634 xConfirmPara( m_iNumberOfViews != m_cCameraData.getBaseViewNumbers().size() , "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );2635 xConfirmPara ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5, "CodedCamParsPrecision must be in range of 0..5" );2636 if( m_bUseVSO )2637 {2638 xConfirmPara( m_pchVSOConfig == 0 , "VSO Setup string must be given");2639 xConfirmPara( m_uiVSOMode > 4 , "VSO Mode must be less than 5");2640 }2641 #endif2642 2440 // max CU width and height should be power of 2 2643 2441 UInt ui = m_uiMaxCUWidth; … … 3393 3191 xPrintParaVector( "AuxId", m_auxId ); 3394 3192 #endif 3395 #if NH_3D_VSO3396 xPrintParaVector( "DepthLayerFlag", m_depthFlag );3397 printf("Coded Camera Param. Precision : %d\n", m_iCodedCamParPrecision);3398 #endif3399 3193 #if NH_MV 3400 3194 xPrintParaVector( "QP" , m_fQP ); … … 3573 3367 #endif 3574 3368 3575 #if KWU_RC_MADPRED_E02273576 printf("Depth based MAD prediction : %d\n", m_depthMADPred);3577 #endif3578 #if KWU_RC_VIEWRC_E02273579 printf("View-wise Rate control : %d\n", m_viewWiseRateCtrl);3580 if(m_viewWiseRateCtrl)3581 {3582 3583 printf("ViewWiseTargetBits : ");3584 for (Int i = 0 ; i < m_iNumberOfViews ; i++)3585 printf("%d ", m_viewTargetBits[i]);3586 printf("\n");3587 }3588 else3589 {3590 printf("TargetBitrate : %d\n", m_RCTargetBitrate );3591 }3592 #endif3593 3369 3594 3370 } 3595 3371 3596 3372 printf("Max Num Merge Candidates : %d\n", m_maxNumMergeCand); 3597 #if NH_3D_VSO3598 printf("BaseViewCameraNumbers : %s\n", m_pchBaseViewCameraNumbers );3599 printf("Coded Camera Param. Precision : %d\n", m_iCodedCamParPrecision);3600 printf("Force use of Lambda Scale : %d\n", m_bForceLambdaScaleVSO );3601 3602 if ( m_bUseVSO )3603 {3604 printf("VSO Lambda Scale : %5.2f\n", m_dLambdaScaleVSO );3605 printf("VSO Mode : %d\n", m_uiVSOMode );3606 printf("VSO Config : %s\n", m_pchVSOConfig );3607 printf("VSO Negative Distortion : %d\n", m_bAllowNegDist ? 1 : 0);3608 printf("VSO LS Table : %d\n", m_bVSOLSTable ? 1 : 0);3609 printf("VSO Estimated VSD : %d\n", m_bUseEstimatedVSD ? 1 : 0);3610 printf("VSO Early Skip : %d\n", m_bVSOEarlySkip ? 1 : 0);3611 if ( m_bUseWVSO )3612 {3613 printf("Dist. Weights (VSO/VSD/SAD) : %d/%d/%d\n ", m_iVSOWeight, m_iVSDWeight, m_iDWeight );3614 }3615 }3616 #endif //HHI_VSO3617 3373 printf("\n"); 3618 3374 #if NH_MV … … 3677 3433 printf(" SignBitHidingFlag:%d ", m_signHideFlag); 3678 3434 printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 ); 3679 #if NH_3D_VSO3680 printf(" VSO:%d ", m_bUseVSO );3681 printf("WVSO:%d ", m_bUseWVSO );3682 #endif3683 #if NH_3D_QTL3684 printf( "QTL:%d " , m_bUseQTL);3685 #endif3686 #if NH_3D3687 printf( "IlluCompEnable:%d " , m_abUseIC);3688 printf( "IlluCompLowLatencyEnc:%d ", m_bUseLowLatencyICEnc);3689 printf( "DLT:%d ", m_useDLT );3690 3691 3692 printf( "IvMvPred:%d %d " , m_ivMvPredFlag[0] ? 1 : 0, m_ivMvPredFlag[1] ? 1 : 0);3693 printf( "IvMvScaling:%d %d " , m_ivMvScalingFlag[0] ? 1 : 0 , m_ivMvScalingFlag[1] ? 1 : 0);3694 3695 printf( "Log2SubPbSizeMinus3:%d " , m_log2SubPbSizeMinus3 );3696 printf( "IvResPred:%d " , m_ivResPredFlag ? 1 : 0 );3697 printf( "DepthRefinement:%d " , m_depthRefinementFlag ? 1 : 0 );3698 printf( "ViewSynthesisPred:%d " , m_viewSynthesisPredFlag ? 1 : 0 );3699 printf( "DepthBasedBlkPart:%d " , m_depthBasedBlkPartFlag ? 1 : 0 );3700 printf( "Mpi:%d " , m_mpiFlag ? 1 : 0 );3701 printf( "Log2MpiSubPbSizeMinus3:%d " , m_log2MpiSubPbSizeMinus3 );3702 printf( "IntraContour:%d " , m_intraContourFlag ? 1 : 0 );3703 printf( "IntraWedge:%d " , m_intraWedgeFlag ? 1 : 0 );3704 printf( "IntraSdc:%d " , m_intraSdcFlag ? 1 : 0 );3705 printf( "QtPred:%d " , m_qtPredFlag ? 1 : 0 );3706 printf( "InterSdc:%d " , m_interSdcFlag ? 1 : 0 );3707 printf( "DepthIntraSkip:%d " , m_depthIntraSkipFlag ? 1 : 0 );3708 #endif3709 3435 3710 3436 printf("\n\n"); -
branches/HTM-16.0-MV-draft-5/source/App/TAppEncoder/TAppEncCfg.h
r1386 r1390 44 44 #include <sstream> 45 45 #include <vector> 46 #if NH_3D47 #include "TAppCommon/TAppComCamPara.h"48 #include "TLibRenderer/TRenModel.h"49 #include "TLibRenderer/TRenModSetupStrParser.h"50 #endif51 46 //! \ingroup TAppEncoder 52 47 //! \{ … … 80 75 IntAry1d m_viewOrderIndex; ///< view order index 81 76 IntAry1d m_auxId; ///< auxiliary id 82 #if NH_3D_VSO83 IntAry1d m_depthFlag; ///< depth flag84 #endif85 77 IntAry1d m_targetEncLayerIdList; ///< layer Ids in Nuh to be encoded 86 78 IntAry1d m_layerIdInNuh; ///< layer Id in Nuh for each layer … … 131 123 Bool m_singleLayerForNonIrapFlag; 132 124 Bool m_higherLayerIrapSkipFlag; 133 #if NH_3D134 Bool m_abUseIC;135 Bool m_bUseLowLatencyICEnc;136 #endif137 125 #endif 138 126 // Lambda modifiers … … 464 452 #endif 465 453 466 #if KWU_RC_VIEWRC_E0227467 vector<Int> m_viewTargetBits;468 Bool m_viewWiseRateCtrl; ///< Flag for using view-wise rate control469 #endif470 #if KWU_RC_MADPRED_E0227471 UInt m_depthMADPred;472 #endif473 454 474 455 ScalingListMode m_useScalingListId; ///< using quantization matrix … … 527 508 #endif 528 509 529 #if NH_3D530 // Output Format531 Bool m_depth420OutputFlag; ///< Output depth layers in 4:2:0 format532 #endif533 510 // Camera parameters 534 #if NH_3D_VSO535 TChar* m_pchCameraParameterFile; ///< camera parameter file536 TAppComCamPara m_cCameraData;537 Int m_iCodedCamParPrecision; ///< precision for coding of camera parameters538 TChar* m_pchVSOConfig;539 Bool m_bUseVSO; ///< flag for using View Synthesis Optimization540 Bool m_bVSOLSTable; ///< Depth QP dependent Lagrange parameter optimization (m23714)541 Bool m_bVSOEarlySkip; ///< Early skip of VSO computation (JCT3V-A0093 modification 4)542 543 //// Used for development by GT, might be removed later544 Double m_dLambdaScaleVSO; ///< Scaling factor for Lambda in VSO mode545 Bool m_bForceLambdaScaleVSO; ///< Use Lambda Scale for depth even if VSO is turned off546 Bool m_bAllowNegDist; ///< Allow negative distortion in VSO547 UInt m_uiVSOMode; ///< Number of VSO Mode, 1 = , 2 = simple, org vs. ren, 3 = simple, ren vs. ren, 4 = full548 549 // SAIT_VSO_EST_A0033550 Bool m_bUseEstimatedVSD; ///< Flag for using model based VSD estimation instead of VSO for some encoder decisions (JCT3V-A0033 modification 3)551 552 // LGE_WVSO_A0119553 Bool m_bUseWVSO; ///< flag for using View Synthesis Optimization554 Int m_iVSOWeight;555 Int m_iVSDWeight;556 Int m_iDWeight;557 558 // Ren Model String559 TRenModSetupStrParser m_cRenModStrParser;560 #endif561 #if NH_3D562 Bool m_useDLT; ///< flag for using DLT563 #endif564 #if NH_3D_QTL565 Bool m_bUseQTL; ///< flag for using depth QuadTree Limitation566 #endif567 #if NH_3D568 BoolAry1d m_ivMvPredFlag;569 BoolAry1d m_ivMvScalingFlag;570 Int m_log2SubPbSizeMinus3;571 Bool m_ivResPredFlag;572 Bool m_depthRefinementFlag;573 Bool m_viewSynthesisPredFlag;574 Bool m_depthBasedBlkPartFlag;575 Bool m_mpiFlag;576 Int m_log2MpiSubPbSizeMinus3;577 Bool m_intraContourFlag;578 Bool m_intraWedgeFlag;579 Bool m_intraSdcFlag;580 Bool m_qtPredFlag;581 Bool m_interSdcFlag;582 Bool m_depthIntraSkipFlag;583 #endif584 511 // internal member functions 585 512 Void xCheckParameter (); ///< check validity of configuration values -
branches/HTM-16.0-MV-draft-5/source/App/TAppEncoder/TAppEncTop.cpp
r1386 r1390 87 87 #endif 88 88 89 #if NH_3D 90 vps.createCamPars(m_iNumberOfViews); 91 #endif 92 93 #if NH_3D_DLT 94 TComDLT dlt = TComDLT(); 95 #endif 89 96 90 97 91 #if NH_MV … … 145 139 xSetDpbSize ( vps ); 146 140 xSetVPSVUI ( vps ); 147 #if NH_3D148 xSetCamPara ( vps );149 #endif150 #if NH_3D_VSO151 m_ivPicLists.setVPS ( &vps );152 #endif153 #if NH_3D_DLT154 xDeriveDltArray ( vps, &dlt );155 #endif156 141 if ( m_targetEncLayerIdList.size() == 0 ) 157 142 { … … 184 169 } 185 170 186 #if NH_3D187 // Set 3d tool parameters188 for (Int d = 0; d < 2; d++)189 {190 m_sps3dExtension.setIvDiMcEnabledFlag ( d, m_ivMvPredFlag[d] );191 m_sps3dExtension.setIvMvScalEnabledFlag ( d, m_ivMvScalingFlag[d] );192 if (d == 0 )193 {194 m_sps3dExtension.setLog2IvmcSubPbSizeMinus3 ( d, m_log2SubPbSizeMinus3 );195 m_sps3dExtension.setIvResPredEnabledFlag ( d, m_ivResPredFlag );196 m_sps3dExtension.setDepthRefEnabledFlag ( d, m_depthRefinementFlag );197 m_sps3dExtension.setVspMcEnabledFlag ( d, m_viewSynthesisPredFlag );198 m_sps3dExtension.setDbbpEnabledFlag ( d, m_depthBasedBlkPartFlag );199 }200 else201 {202 m_sps3dExtension.setTexMcEnabledFlag ( d, m_mpiFlag );203 m_sps3dExtension.setLog2TexmcSubPbSizeMinus3( d, m_log2MpiSubPbSizeMinus3);204 m_sps3dExtension.setIntraContourEnabledFlag ( d, m_intraContourFlag );205 m_sps3dExtension.setIntraDcOnlyWedgeEnabledFlag ( d, m_intraSdcFlag || m_intraWedgeFlag );206 m_sps3dExtension.setCqtCuPartPredEnabledFlag ( d, m_qtPredFlag );207 m_sps3dExtension.setInterDcOnlyEnabledFlag ( d, m_interSdcFlag );208 m_sps3dExtension.setSkipIntraEnabledFlag ( d, m_depthIntraSkipFlag );209 }210 }211 #endif212 171 213 172 … … 219 178 m_acTVideoIOYuvInputFileList.push_back(new TVideoIOYuv); 220 179 m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv); 221 #if NH_3D222 Int profileIdc = -1;223 for (Int olsIdx = 0; olsIdx < vps.getNumOutputLayerSets(); olsIdx++ )224 {225 Int lsIdx = vps.olsIdxToLsIdx( olsIdx );226 for(Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++ )227 {228 if( vps.getLayerIdInNuh( layerIdInVps) == vps.getLayerSetLayerIdList(lsIdx, i) )229 {230 Int ptlIdx = vps.getProfileTierLevelIdx( olsIdx, i );231 if ( ptlIdx != -1 )232 {233 Int curProfileIdc = vps.getPTL(ptlIdx)->getGeneralPTL()->getProfileIdc();234 if (profileIdc == -1)235 {236 profileIdc = curProfileIdc;237 }238 else239 {240 if ( profileIdc != curProfileIdc )241 {242 fprintf(stderr, "Error: ProfileIdc for layer with index %d in VPS not equal in all OLSs. \n", layerIdInVps );243 exit(EXIT_FAILURE);244 }245 }246 }247 }248 }249 }250 251 if (profileIdc == -1 )252 {253 fprintf(stderr, "Error: No profile given for layer with index %d in VPS not equal in all OLS. \n", layerIdInVps );254 exit(EXIT_FAILURE);255 }256 m_acTEncTopList[ layerIdInVps ]->setProfileIdc( profileIdc );257 #endif258 180 } 259 181 … … 278 200 m_cTEncTop.setViewId ( vps.getViewId ( layerId ) ); 279 201 m_cTEncTop.setViewIndex ( vps.getViewIndex ( layerId ) ); 280 #if NH_3D_VSO281 Bool isDepth = ( vps.getDepthId ( layerId ) != 0 ) ;282 Bool isAuxDepth = ( vps.getAuxId ( layerId ) == 2 ) ; // TBD: define 2 as AUX_DEPTH283 m_cTEncTop.setIsDepth ( isDepth );284 m_cTEncTop.setIsAuxDepth ( isAuxDepth );285 //====== Camera Parameters =========286 m_cTEncTop.setCameraParameters ( &m_cCameraData );287 //====== VSO =========288 m_cTEncTop.setRenderModelParameters ( &m_cRenModStrParser );289 m_cTEncTop.setForceLambdaScaleVSO ( isDepth || isAuxDepth ? m_bForceLambdaScaleVSO : false );290 m_cTEncTop.setLambdaScaleVSO ( isDepth || isAuxDepth ? m_dLambdaScaleVSO : 1 );291 m_cTEncTop.setVSOMode ( isDepth || isAuxDepth ? m_uiVSOMode : 0 );292 293 m_cTEncTop.setAllowNegDist ( isDepth || isAuxDepth ? m_bAllowNegDist : false );294 295 // SAIT_VSO_EST_A0033296 m_cTEncTop.setUseEstimatedVSD ( isDepth || isAuxDepth ? m_bUseEstimatedVSD : false );297 298 // LGE_WVSO_A0119299 m_cTEncTop.setUseWVSO ( isDepth || isAuxDepth ? m_bUseWVSO : false );300 m_cTEncTop.setVSOWeight ( isDepth || isAuxDepth ? m_iVSOWeight : 0 );301 m_cTEncTop.setVSDWeight ( isDepth || isAuxDepth ? m_iVSDWeight : 0 );302 m_cTEncTop.setDWeight ( isDepth || isAuxDepth ? m_iDWeight : 0 );303 #endif // H_3D_VSO304 #if NH_3D305 #if NH_3D_IC306 m_cTEncTop.setUseIC ( vps.getViewIndex( layerId ) == 0 || isDepth ? false : m_abUseIC );307 m_cTEncTop.setUseICLowLatencyEnc ( m_bUseLowLatencyICEnc );308 #endif309 310 311 m_cTEncTop.setUseDMM ( isDepth ? m_intraWedgeFlag : false );312 m_cTEncTop.setUseSDC ( isDepth ? m_intraSdcFlag : false );313 m_cTEncTop.setUseDLT ( isDepth ? m_useDLT : false );314 #endif315 #if NH_3D_QTL316 m_cTEncTop.setUseQTL ( isDepth || isAuxDepth ? m_bUseQTL : false );317 #endif318 #if NH_3D319 m_cTEncTop.setSps3dExtension ( m_sps3dExtension );320 #endif // NH_3D321 202 322 203 m_cTEncTop.setIvPicLists ( &m_ivPicLists ); … … 324 205 m_cTEncTop.setVPS(&vps); 325 206 326 #if NH_3D_DLT327 m_cTEncTop.setDLT(dlt);328 #endif329 207 330 208 #if NH_MV … … 438 316 m_cTEncTop.setChromaCrQpOffset ( m_crQpOffset ); 439 317 440 #if NH_3D441 m_cTEncTop.setChromaFormatIdc ( isDepth ? CHROMA_400 : m_chromaFormatIDC );442 #else443 318 m_cTEncTop.setChromaFormatIdc ( m_chromaFormatIDC ); 444 #endif445 319 446 320 #if ADAPTIVE_QP_SELECTION … … 651 525 m_cTEncTop.setScalingListFileName ( m_scalingListFileName ); 652 526 m_cTEncTop.setSignHideFlag ( m_signHideFlag); 653 #if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227654 if(!m_cTEncTop.getIsDepth()) //only for texture655 {656 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl );657 }658 else659 {660 m_cTEncTop.setUseRateCtrl ( 0 );661 }662 #else663 527 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl ); 664 #endif665 #if !KWU_RC_VIEWRC_E0227666 528 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate ); 667 #endif668 529 m_cTEncTop.setKeepHierBit ( m_RCKeepHierarchicalBit ); 669 530 m_cTEncTop.setLCULevelRC ( m_RCLCULevelRC ); … … 677 538 #endif 678 539 679 #if KWU_RC_MADPRED_E0227680 if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())681 {682 m_cTEncTop.setUseDepthMADPred(layerIdInVps ? m_depthMADPred : 0);683 if(m_cTEncTop.getUseDepthMADPred())684 {685 m_cTEncTop.setCamParam(&m_cCameraData);686 }687 }688 #endif689 #if KWU_RC_VIEWRC_E0227690 if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())691 {692 m_cTEncTop.setUseViewWiseRateCtrl(m_viewWiseRateCtrl);693 if(m_iNumberOfViews == 1)694 {695 if(m_viewWiseRateCtrl)696 {697 m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);698 }699 else700 {701 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate );702 }703 }704 else705 {706 if(m_viewWiseRateCtrl)707 {708 m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);709 }710 else711 {712 if(m_iNumberOfViews == 2)713 {714 if(m_cTEncTop.getViewId() == 0)715 {716 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*80)/100 );717 }718 else if(m_cTEncTop.getViewId() == 1)719 {720 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*20)/100 );721 }722 }723 else if(m_iNumberOfViews == 3)724 {725 if(m_cTEncTop.getViewId() == 0)726 {727 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*66)/100 );728 }729 else if(m_cTEncTop.getViewId() == 1)730 {731 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*17)/100 );732 }733 else if(m_cTEncTop.getViewId() == 2)734 {735 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*17)/100 );736 }737 }738 else739 {740 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate );741 }742 }743 }744 }745 #endif746 540 m_cTEncTop.setTransquantBypassEnableFlag ( m_TransquantBypassEnableFlag ); 747 541 m_cTEncTop.setCUTransquantBypassFlagForceValue ( m_CUTransquantBypassFlagForce ); … … 790 584 } 791 585 #endif 792 #if NH_3D_VSO793 if ( m_bUseVSO )794 {795 if ( m_uiVSOMode == 4 )796 {797 #if H_3D_VSO_EARLY_SKIP798 m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip );799 #else800 m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 );801 #endif802 for ( Int layer = 0; layer < m_numberOfLayers ; layer++ )803 {804 TEncTop* pcEncTop = m_acTEncTopList[ layer ];805 Int iViewNum = pcEncTop->getViewIndex();806 Int iContent = pcEncTop->getIsDepth() || pcEncTop->getIsAuxDepth() ? 1 : 0;807 Int iNumOfModels = m_cRenModStrParser.getNumOfModelsForView(iViewNum, iContent);808 809 Bool bUseVSO = (iNumOfModels != 0);810 811 pcEncTop->setUseVSO( bUseVSO );812 pcEncTop->getRdCost()->setRenModel( bUseVSO ? &m_cRendererModel : NULL );813 814 for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ )815 {816 Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode;817 818 m_cRenModStrParser.getSingleModelData ( iViewNum, iContent, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ;819 m_cRendererModel .createSingleModel ( iViewNum, iContent, iModelNum, iLeftViewNum, iRightViewNum, (iOrgRefNum != -1), iBlendMode );820 }821 }822 }823 else824 {825 AOT(true);826 }827 }828 #endif829 586 } 830 587 … … 834 591 // initialize global variables 835 592 initROM(); 836 #if NH_3D_DMM837 initWedgeLists( true );838 #endif839 593 840 594 for( Int layer=0; layer < m_numberOfLayers; layer++) … … 900 654 for(Int layer=0; layer<m_numberOfLayers; layer++) 901 655 { 902 #if KWU_RC_MADPRED_E0227903 m_acTEncTopList[layer]->init( isFieldCoding, this );904 #else905 656 m_acTEncTopList[layer]->init( isFieldCoding ); 906 #endif907 657 } 908 658 #else … … 932 682 } 933 683 934 #if !NH_3D935 684 TComPicYuv* pcPicYuvOrg = new TComPicYuv; 936 #endif937 685 TComPicYuv* pcPicYuvRec = NULL; 938 686 … … 968 716 list<AccessUnit> outputAccessUnits; ///< list of access units to write out. is populated by the encoding process 969 717 970 #if NH_3D971 TComPicYuv* picYuvOrg[2];972 TComPicYuv picYuvTrueOrg[2];973 for (Int d = 0; d < 2 ; d++)974 {975 picYuvOrg[d] = new TComPicYuv;976 picYuvOrg[d] ->create( m_iSourceWidth, m_isField ? m_iSourceHeightOrg : m_iSourceHeight, ( d > 0 ) ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );977 picYuvTrueOrg[d].create( m_iSourceWidth, m_isField ? m_iSourceHeightOrg : m_iSourceHeight, ( d > 0 ) ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );978 }979 #else980 718 TComPicYuv cPicYuvTrueOrg; 981 719 … … 991 729 cPicYuvTrueOrg.create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true ); 992 730 } 993 #endif994 731 #if NH_MV 995 732 while ( (m_targetEncLayerIdList.size() != 0 ) && !allEos ) … … 997 734 for(Int layer=0; layer < m_numberOfLayers; layer++ ) 998 735 { 999 #if NH_3D1000 TComPicYuv* pcPicYuvOrg = picYuvOrg [ m_depthFlag[layer] ];1001 TComPicYuv& cPicYuvTrueOrg = picYuvTrueOrg[ m_depthFlag[layer] ];1002 #endif1003 736 if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) )) 1004 737 { … … 1036 769 for ( Int gopId=0; gopId < gopSize; gopId++ ) 1037 770 { 1038 #if NH_3D_VSO1039 UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId );1040 if ( iNextPoc < m_framesToBeEncoded )1041 {1042 m_cCameraData.update( iNextPoc );1043 }1044 #endif1045 771 for(Int layer=0; layer < m_numberOfLayers; layer++ ) 1046 772 { 1047 #if NH_3D1048 TComPicYuv* pcPicYuvOrg = picYuvOrg [ m_depthFlag[layer] ];1049 TComPicYuv& cPicYuvTrueOrg = picYuvTrueOrg[ m_depthFlag[layer] ];1050 #endif1051 773 if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) )) 1052 774 { … … 1054 776 } 1055 777 1056 #if NH_3D_VSO1057 if( m_bUseVSO && m_bUseEstimatedVSD && iNextPoc < m_framesToBeEncoded )1058 {1059 m_cCameraData.setDispCoeff( iNextPoc, m_acTEncTopList[layer]->getViewIndex() );1060 m_acTEncTopList[layer] ->setDispCoeff( m_cCameraData.getDispCoeff() );1061 }1062 #endif1063 778 1064 779 Int iNumEncoded = 0; … … 1127 842 #endif 1128 843 1129 #if NH_3D1130 // delete original YUV buffer1131 for (Int d = 0; d < 2; d++)1132 {1133 picYuvOrg[d]->destroy();1134 delete picYuvOrg[d];1135 picYuvOrg[d] = NULL;1136 1137 picYuvTrueOrg[d].destroy();1138 }1139 #else1140 844 // delete original YUV buffer 1141 845 pcPicYuvOrg->destroy(); 1142 846 delete pcPicYuvOrg; 1143 847 pcPicYuvOrg = NULL; 1144 #endif1145 848 1146 849 #if !NH_MV … … 1148 851 m_cTEncTop.deletePicBuffer(); 1149 852 #endif 1150 #if !NH_3D1151 853 cPicYuvTrueOrg.destroy(); 1152 #endif1153 854 1154 855 // delete buffers & classes … … 1158 859 printRateSummary(); 1159 860 1160 #if NH_3D_REN_MAX_DEV_OUT1161 Double dMaxDispDiff = m_cCameraData.getMaxShiftDeviation();1162 1163 if ( !(dMaxDispDiff < 0) )1164 {1165 printf("\n Max. possible shift error: %12.3f samples.\n", dMaxDispDiff );1166 }1167 #endif1168 861 1169 862 return; … … 1202 895 { 1203 896 rpcPicYuvRec = new TComPicYuv; 1204 #if NH_3D1205 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_depthFlag[layer] > 0 ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );1206 #else1207 897 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true ); 1208 #endif1209 898 1210 899 } … … 1284 973 if (m_pchReconFileList[layerIdx]) 1285 974 { 1286 #if NH_3D1287 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_depth420OutputFlag && m_depthFlag[layerIdx ] ? CHROMA_420 : NUM_CHROMA_FORMAT, m_isTopFieldFirst );1288 #else1289 975 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_isTopFieldFirst ); 1290 #endif1291 976 } 1292 977 } … … 1341 1026 if (m_pchReconFileList[layerIdx]) 1342 1027 { 1343 #if NH_3D1344 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_depth420OutputFlag && m_depthFlag[layerIdx ] ? CHROMA_420 : NUM_CHROMA_FORMAT );1345 #else1346 1028 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom ); 1347 #endif1348 1029 1349 1030 } … … 1470 1151 } 1471 1152 1472 #if NH_3D_DLT1473 Void TAppEncTop::xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt)1474 {1475 TComPicYuv* pcDepthPicYuvOrg = new TComPicYuv;1476 TComPicYuv* pcDepthPicYuvTrueOrg = new TComPicYuv;1477 // allocate original YUV buffer1478 pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, false );1479 pcDepthPicYuvTrueOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, false );1480 1481 TVideoIOYuv* depthVideoFile = new TVideoIOYuv;1482 1483 UInt uiMaxDepthValue = ((1 << m_inputBitDepth[CHANNEL_TYPE_LUMA])-1);1484 1485 std::vector<Bool> abValidDepths(256, false);1486 1487 depthVideoFile->open( m_pchInputFileList[layer], false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );1488 1489 Int iHeight = pcDepthPicYuvOrg->getHeight(COMPONENT_Y);1490 Int iWidth = pcDepthPicYuvOrg->getWidth(COMPONENT_Y);1491 Int iStride = pcDepthPicYuvOrg->getStride(COMPONENT_Y);1492 1493 Pel* pInDM = pcDepthPicYuvOrg->getAddr(COMPONENT_Y);1494 1495 for(Int uiFrame=0; uiFrame < uiNumFrames; uiFrame++ )1496 {1497 depthVideoFile->read( pcDepthPicYuvOrg, pcDepthPicYuvTrueOrg, IPCOLOURSPACE_UNCHANGED, m_aiPad, m_InputChromaFormatIDC, m_bClipInputVideoToRec709Range );1498 1499 // check all pixel values1500 for (Int i=0; i<iHeight; i++)1501 {1502 Int rowOffset = i*iStride;1503 1504 for (Int j=0; j<iWidth; j++)1505 {1506 Pel depthValue = pInDM[rowOffset+j];1507 abValidDepths[depthValue] = true;1508 }1509 }1510 }1511 1512 depthVideoFile->close();1513 delete depthVideoFile;1514 1515 pcDepthPicYuvOrg->destroy();1516 delete pcDepthPicYuvOrg;1517 pcDepthPicYuvTrueOrg->destroy();1518 delete pcDepthPicYuvTrueOrg;1519 1520 // convert boolean array to idx2Depth LUT1521 std::vector<Int> aiIdx2DepthValue(256, 0);1522 Int iNumDepthValues = 0;1523 for(Int p=0; p<=uiMaxDepthValue; p++)1524 {1525 if( abValidDepths[p] == true)1526 {1527 aiIdx2DepthValue[iNumDepthValues++] = p;1528 }1529 }1530 1531 if( uiNumFrames == 0 || gCeilLog2(iNumDepthValues) == m_inputBitDepth[CHANNEL_TYPE_LUMA] )1532 {1533 dlt->setUseDLTFlag(layer, false);1534 }1535 1536 // assign LUT1537 if( dlt->getUseDLTFlag(layer) )1538 {1539 dlt->setDepthLUTs(layer, aiIdx2DepthValue, iNumDepthValues);1540 }1541 }1542 #endif1543 1153 1544 1154 #if NH_MV … … 1570 1180 1571 1181 1572 #if NH_3D1573 vps.initViewCompLayer( );1574 #endif1575 1182 } 1576 1183 … … 1649 1256 Int curLayerIdInNuh = vps.getLayerIdInNuh( curLayerIdInVps ); 1650 1257 Int maxTid = -1; 1651 #if NH_3D1652 if ( vps.getDirectDependencyFlag( curLayerIdInVps, refLayerIdInVps ) )1653 {1654 if ( m_depthFlag[ curLayerIdInVps] == m_depthFlag[ refLayerIdInVps ] )1655 {1656 #endif1657 1258 for( Int i = 0; i < ( getGOPSize() + 1); i++ ) 1658 1259 { … … 1661 1262 for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++) 1662 1263 { 1663 #if NH_3D1664 if ( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[ j ] ) == refLayerIdInNuh )1665 #else1666 1264 if ( vps.getIdDirectRefLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[ j ] ) == refLayerIdInNuh ) 1667 #endif1668 1265 { 1669 1266 Bool refLayerZero = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 ); … … 1672 1269 } 1673 1270 } 1674 #if NH_3D1675 }1676 else1677 {1678 if( m_depthFlag[ curLayerIdInVps ] && ( m_mpiFlag|| m_qtPredFlag || m_intraContourFlag ) )1679 {1680 Int nuhLayerIdTex = vps.getLayerIdInNuh( vps.getViewIndex( curLayerIdInNuh ), false, 0 );1681 if ( nuhLayerIdTex == refLayerIdInNuh )1682 {1683 for( Int i = 0; i < ( getGOPSize() + 1); i++ )1684 {1685 GOPEntry geCur = m_GOPListMvc[curLayerIdInVps][( i < getGOPSize() ? i : MAX_GOP )];1686 GOPEntry geRef = m_GOPListMvc[refLayerIdInVps][( i < getGOPSize() ? i : MAX_GOP )];1687 if ( geCur.m_interCompPredFlag )1688 {1689 Bool refLayerZero = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );1690 maxTid = std::max( maxTid, refLayerZero ? 0 : geRef.m_temporalId );1691 }1692 }1693 }1694 }1695 if( !m_depthFlag[ curLayerIdInVps ] && vps.getNumRefListLayers( curLayerIdInNuh) > 0 && ( m_depthRefinementFlag || m_viewSynthesisPredFlag || m_depthBasedBlkPartFlag ) )1696 {1697 for( Int i = 0; i < ( getGOPSize() + 1); i++ )1698 {1699 GOPEntry geCur = m_GOPListMvc[curLayerIdInVps][( i < getGOPSize() ? i : MAX_GOP )];1700 GOPEntry geRef = m_GOPListMvc[refLayerIdInVps][( i < getGOPSize() ? i : MAX_GOP )];1701 1702 if ( geCur.m_interCompPredFlag )1703 {1704 for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++ )1705 {1706 Int nuhLayerIdDep = vps.getLayerIdInNuh( vps.getViewIndex( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[j] ) ), true, 0 );1707 if ( nuhLayerIdDep == refLayerIdInNuh )1708 {1709 Bool refLayerZero = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );1710 maxTid = std::max( maxTid, refLayerZero ? 0 : geRef.m_temporalId );1711 }1712 }1713 }1714 }1715 }1716 }1717 } // if ( vps.getDirectDependencyFlag( curLayerIdInVps, refLayerIdInVps ) )1718 vps.setMaxTidIlRefPicsPlus1( refLayerIdInVps, curLayerIdInVps, maxTid + 1 );1719 #endif1720 1271 } // Loop curLayerIdInVps 1721 1272 } // Loop refLayerIdInVps … … 1766 1317 1767 1318 // check if all reference layers when allRefLayerActiveFlag is equal to 1 are reference layer pictures specified in the gop entry 1768 #if NH_3D1769 for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ) && allRefLayersActiveFlag; k++ )1770 {1771 Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdRefListLayer( layerIdInNuh , k ) );1772 #else1773 1319 for (Int k = 0; k < vps.getNumDirectRefLayers( layerIdInNuh ) && allRefLayersActiveFlag; k++ ) 1774 1320 { 1775 1321 Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdDirectRefLayer( layerIdInNuh , k ) ); 1776 #endif1777 1322 if ( vps.getSubLayersVpsMaxMinus1(refLayerIdInVps) >= tId && ( tId == 0 || vps.getMaxTidIlRefPicsPlus1(refLayerIdInVps,layerIdInVps) > tId ) ) 1778 1323 { … … 1792 1337 { 1793 1338 Bool referenceLayerFoundFlag = false; 1794 #if NH_3D1795 for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ); k++ )1796 {1797 Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdRefListLayer( layerIdInNuh, k) );1798 #else1799 1339 for (Int k = 0; k < vps.getNumDirectRefLayers( layerIdInNuh ); k++ ) 1800 1340 { 1801 1341 Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdDirectRefLayer( layerIdInNuh, k) ); 1802 #endif1803 1342 if ( vps.getSubLayersVpsMaxMinus1(refLayerIdInVps) >= tId && ( tId == 0 || vps.getMaxTidIlRefPicsPlus1(refLayerIdInVps,layerIdInVps) > tId ) ) 1804 1343 { … … 1929 1468 break; 1930 1469 case Profile::MULTIVIEWMAIN: 1931 #if NH_3D1932 case Profile::MAIN3D:1933 #endif1934 1470 ptl->setMax12bitConstraintFlag ( true ); 1935 1471 ptl->setMax12bitConstraintFlag ( true ); … … 1953 1489 1954 1490 Bool anyDepth = false; 1955 #if NH_3D1956 for ( Int i = 0; i < m_numberOfLayers; i++ )1957 {1958 vps.setVpsRepFormatIdx( i, m_depthFlag[ i ] ? 1 : 0 );1959 anyDepth = anyDepth || m_depthFlag[ i ];1960 }1961 #endif1962 1491 1963 1492 vps.setRepFormatIdxPresentFlag( anyDepth ); … … 2364 1893 } 2365 1894 2366 #if NH_3D2367 Void TAppEncTop::xSetCamPara ( TComVPS& vps )2368 {2369 vps.setCpPrecision( m_cCameraData.getCamParsCodedPrecision());2370 2371 for ( Int n = 1; n < vps.getNumViews(); n++ )2372 {2373 Int i = vps.getViewOIdxList( n );2374 Int iInVps = vps.getVoiInVps ( i );2375 vps.setNumCp( iInVps, n);2376 2377 if ( vps.getNumCp( iInVps ) > 0 )2378 {2379 vps.setCpInSliceSegmentHeaderFlag( iInVps, m_cCameraData.getVaryingCameraParameters() );2380 2381 for( Int m = 0; m < vps.getNumCp( iInVps ); m++ )2382 {2383 vps.setCpRefVoi( iInVps, m, vps.getViewOIdxList( m ) );2384 if( !vps.getCpInSliceSegmentHeaderFlag( iInVps ) )2385 {2386 Int j = vps.getCpRefVoi( iInVps, m );2387 Int jInVps = vps.getVoiInVps( j );2388 2389 vps.setVpsCpScale ( iInVps, jInVps, m_cCameraData.getCodedScale() [ jInVps ][ iInVps ] ) ;2390 vps.setVpsCpInvScale( iInVps, jInVps, m_cCameraData.getCodedScale() [ iInVps ][ jInVps ] ) ;2391 vps.setVpsCpOff ( iInVps, jInVps, m_cCameraData.getCodedOffset()[ jInVps ][ iInVps ] ) ;2392 vps.setVpsCpInvOff ( iInVps, jInVps, m_cCameraData.getCodedOffset()[ iInVps ][ jInVps ] ) ;2393 }2394 }2395 }2396 }2397 vps.deriveCpPresentFlag();2398 }2399 #endif2400 1895 2401 1896 … … 2409 1904 2410 1905 2411 #if NH_3D_DLT2412 Void TAppEncTop::xDeriveDltArray( TComVPS& vps, TComDLT* dlt )2413 {2414 Int iNumDepthViews = 0;2415 Bool bDltPresentFlag = false;2416 2417 for ( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ )2418 {2419 Bool isDepth = ( vps.getDepthId( layer ) == 1 );2420 2421 if ( isDepth )2422 {2423 iNumDepthViews++;2424 }2425 2426 dlt->setUseDLTFlag( layer , isDepth && m_useDLT );2427 if( dlt->getUseDLTFlag( layer ) )2428 {2429 xAnalyzeInputBaseDepth(layer, max(m_iIntraPeriod[layer], 24), &vps, dlt);2430 bDltPresentFlag = bDltPresentFlag || dlt->getUseDLTFlag(layer);2431 dlt->setInterViewDltPredEnableFlag(layer, (dlt->getUseDLTFlag(layer) && (layer>1)));2432 2433 // ----------------------------- determine whether to use bit-map -----------------------------2434 Bool bDltBitMapRepFlag = false;2435 UInt uiNumBitsNonBitMap = 0;2436 UInt uiNumBitsBitMap = 0;2437 2438 UInt uiMaxDiff = 0;2439 UInt uiMinDiff = MAX_INT;2440 UInt uiLengthMinDiff = 0;2441 UInt uiLengthDltDiffMinusMin = 0;2442 2443 std::vector<Int> aiIdx2DepthValue_coded(256, 0);2444 UInt uiNumDepthValues_coded = 0;2445 2446 uiNumDepthValues_coded = dlt->getNumDepthValues(layer);2447 for( UInt ui = 0; ui<uiNumDepthValues_coded; ui++ )2448 {2449 aiIdx2DepthValue_coded[ui] = dlt->idx2DepthValue(layer, ui);2450 }2451 2452 if( dlt->getInterViewDltPredEnableFlag( layer ) )2453 {2454 AOF( vps.getDepthId( 1 ) == 1 );2455 AOF( layer > 1 );2456 // assumes ref layer id to be 12457 std::vector<Int> piRefDLT = dlt->idx2DepthValue( 1 );2458 UInt uiRefNum = dlt->getNumDepthValues( 1 );2459 dlt->getDeltaDLT(layer, piRefDLT, uiRefNum, aiIdx2DepthValue_coded, uiNumDepthValues_coded);2460 }2461 2462 std::vector<UInt> puiDltDiffValues(uiNumDepthValues_coded, 0);2463 2464 for (UInt d = 1; d < uiNumDepthValues_coded; d++)2465 {2466 puiDltDiffValues[d] = aiIdx2DepthValue_coded[d] - aiIdx2DepthValue_coded[d-1];2467 2468 if ( uiMaxDiff < puiDltDiffValues[d] )2469 {2470 uiMaxDiff = puiDltDiffValues[d];2471 }2472 2473 if ( uiMinDiff > puiDltDiffValues[d] )2474 {2475 uiMinDiff = puiDltDiffValues[d];2476 }2477 }2478 2479 // counting bits2480 // diff coding branch2481 uiNumBitsNonBitMap += 8; // u(v) bits for num_depth_values_in_dlt[layerId] (i.e. num_entry[ layerId ])2482 2483 if ( uiNumDepthValues_coded > 1 )2484 {2485 uiNumBitsNonBitMap += 8; // u(v) bits for max_diff[ layerId ]2486 }2487 2488 if ( uiNumDepthValues_coded > 2 )2489 {2490 uiLengthMinDiff = (UInt) gCeilLog2(uiMaxDiff + 1);2491 uiNumBitsNonBitMap += uiLengthMinDiff; // u(v) bits for min_diff[ layerId ]2492 }2493 2494 uiNumBitsNonBitMap += 8; // u(v) bits for dlt_depth_value0[ layerId ]2495 2496 if (uiMaxDiff > uiMinDiff)2497 {2498 uiLengthDltDiffMinusMin = (UInt) gCeilLog2(uiMaxDiff - uiMinDiff + 1);2499 uiNumBitsNonBitMap += uiLengthDltDiffMinusMin * (uiNumDepthValues_coded - 1); // u(v) bits for dlt_depth_value_diff_minus_min[ layerId ][ j ]2500 }2501 2502 // bit map branch2503 uiNumBitsBitMap = 1 << m_inputBitDepth[CHANNEL_TYPE_LUMA];2504 2505 // determine bDltBitMapFlag2506 bDltBitMapRepFlag = (uiNumBitsBitMap > uiNumBitsNonBitMap) ? false : true;2507 2508 dlt->setUseBitmapRep(layer, bDltBitMapRepFlag);2509 }2510 }2511 2512 dlt->setDltPresentFlag( bDltPresentFlag );2513 dlt->setNumDepthViews ( iNumDepthViews );2514 dlt->setDepthViewBitDepth( m_inputBitDepth[CHANNEL_TYPE_LUMA] );2515 }2516 #endif2517 1906 //! \} -
branches/HTM-16.0-MV-draft-5/source/App/TAppEncoder/TAppEncTop.h
r1386 r1390 46 46 #include "TLibCommon/AccessUnit.h" 47 47 #include "TAppEncCfg.h" 48 #if NH_3D_VSO49 #include "../../Lib/TLibRenderer/TRenTop.h"50 #endif51 48 52 #if KWU_RC_MADPRED_E022753 class TEncTop;54 #endif55 49 //! \ingroup TAppEncoder 56 50 //! \{ … … 90 84 #endif 91 85 92 #if NH_3D93 TComSps3dExtension m_sps3dExtension; ///< Currently all layers share the same sps 3D Extension94 #endif95 86 96 87 UInt m_essentialBytes; 97 88 UInt m_totalBytes; 98 #if NH_3D_VSO99 TRenTop m_cRendererTop;100 TRenModel m_cRendererModel;101 #endif102 89 protected: 103 90 // initialization … … 144 131 Void xSetDpbSize ( TComVPS& vps ); 145 132 Void xSetVPSVUI ( TComVPS& vps ); 146 #if NH_3D147 Void xSetCamPara ( TComVPS& vps );148 #endif149 133 GOPEntry* xGetGopEntry( Int layerIdInVps, Int poc ); 150 134 Int xGetMax( std::vector<Int>& vec); 151 135 Bool xLayerIdInTargetEncLayerIdList( Int nuhLayerId ); 152 #endif153 #if NH_3D_DLT154 Void xDeriveDltArray( TComVPS& vps, TComDLT* dlt );155 Void xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt);156 136 #endif 157 137 -
branches/HTM-16.0-MV-draft-5/source/App/TAppRenderer/RendererMain.cpp
r1386 r1390 35 35 #include <time.h> 36 36 #include "../../Lib/TLibCommon/CommonDef.h" 37 #if NH_3D_VSO38 #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 // NH_3D92 45 -
branches/HTM-16.0-MV-draft-5/source/App/TAppRenderer/TAppRendererCfg.cpp
r1386 r1390 44 44 #include "../../Lib/TAppCommon/program_options_lite.h" 45 45 46 #if NH_3D_VSO47 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, TChar* 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, (TChar*) 0, "Basename to generate video input file names")124 ("DepthInputFileBaseName,d", m_pchDepthInputFileBaseName, (TChar*) 0, "Basename to generate depth input file names")125 ("SynthOutputFileBaseName,s", m_pchSynthOutputFileBaseName, (TChar*) 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 , (TChar *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv video input file name %d")130 ("DepthInputFile_%d,d_%d", m_pchDepthInputFileList , (TChar *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv depth input file name %d")131 ("SynthOutputFile_%d,s_%d", m_pchSynthOutputFileList, (TChar *) 0, MAX_OUTPUT_VIEW_NUM, "Synthesized Yuv output file name %d")132 133 ("InputBitDepth", m_inputBitDepth[0], 8, "Bit-depth of input file")134 ("OutputBitDepth", m_outputBitDepth[0], 0, "Bit-depth of output file (default:InternalBitDepth)")135 ("InternalBitDepth", m_internalBitDepth[0], 0, "Bit-depth the renderer operates at. (default:InputBitDepth)" "If different to InputBitDepth, source data will be converted")136 137 ("InputBitDepthC", m_inputBitDepth[1], 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")138 ("OutputBitDepthC", m_outputBitDepth[1], 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")139 ("InternalBitDepthC", m_internalBitDepth[1], 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, (TChar *) 0, "Camera Parameter File Name")149 ("BaseViewCameraNumbers" , m_pchBaseViewCameraNumbers, (TChar *) 0, "Numbers of base views")150 ("SynthViewCameraNumbers" , m_pchSynthViewCameraNumbers, (TChar *) 0, "Numbers of views to synthesis")151 ("ViewConfig" , m_pchViewConfig, (TChar *) 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_internalBitDepth[0]) { m_internalBitDepth[0] = m_inputBitDepth[0]; }189 if (!m_internalBitDepth[1]) { m_internalBitDepth[1] = m_internalBitDepth[0]; }190 if (!m_inputBitDepth[1]) { m_inputBitDepth[1] = m_inputBitDepth[0]; }191 if (!m_outputBitDepth[0]) { m_outputBitDepth[0] = m_internalBitDepth[0]; }192 if (!m_outputBitDepth[1]) { m_outputBitDepth[1] = m_internalBitDepth[1]; }193 194 UInt uiInputBitDepth = 8;195 UInt uiCamParPrecision = 5;196 197 m_bUseSetupString = ( m_pchViewConfig != NULL ) && ( m_iRenderMode != 0);198 199 if ( m_iRenderMode == 10 )200 {201 m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,202 m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );203 m_iNumberOfInputViews = (Int) m_cCameraData.getBaseViewNumbers() .size();204 m_iNumberOfOutputViews = m_iNumberOfInputViews - 1;205 m_iRenderDirection = 1;206 }207 else208 {209 if ( m_bUseSetupString )210 {211 std::vector<Int> iaTempViews;212 std::vector<Int>* piaTempViews;213 m_cCameraData .convertNumberString( m_pchBaseViewCameraNumbers, iaTempViews, VIEW_NUM_PREC );214 m_cRenModStrParser.setString( (Int) iaTempViews.size(), m_pchViewConfig );215 piaTempViews = m_cRenModStrParser.getSynthViews();216 m_iNumberOfOutputViews = (Int) m_cRenModStrParser.getNumOfModels();217 m_iNumberOfInputViews = (Int) m_cRenModStrParser.getNumOfBaseViews();218 m_bContOutputFileNumbering = true;219 220 m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,221 m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, piaTempViews, m_iLog2SamplingFactor+m_iShiftPrecision );222 }223 else224 {225 m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,226 m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, m_pchSynthViewCameraNumbers, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );227 m_iNumberOfOutputViews = (Int) m_cCameraData.getSynthViewNumbers().size();228 m_iNumberOfInputViews = (Int) m_cCameraData.getBaseViewNumbers() .size();229 }230 }231 232 if (m_pchSynthOutputFileBaseName != NULL)233 xConfirmParameter( strrchr(m_pchSynthOutputFileBaseName,'$') == 0, "'$' must be a character in SynthOutputFileBaseName");234 235 if (m_pchDepthInputFileBaseName != NULL)236 xConfirmParameter( strrchr(m_pchDepthInputFileBaseName, '$') == 0, "'$' must be a character in DepthInputFileBaseName" );237 238 if (m_pchVideoInputFileBaseName != NULL)239 xConfirmParameter( strrchr(m_pchVideoInputFileBaseName, '$') == 0, "'$' must be a character in VideoInputFileBaseName" );240 241 xCreateFileNames();242 243 /*244 * check validity of input parameters245 */246 xCheckParameter();247 m_cCameraData.check( m_iRenderDirection == 0, m_iFramesToBeRendered != 0 );248 249 // print-out parameters250 xPrintParameter();251 252 return true;253 }254 255 256 // ====================================================================================================================257 // Private member functions258 // ====================================================================================================================259 260 Void TAppRendererCfg::xCheckParameter()261 {262 bool check_failed = false; /* abort if there is a fatal configuration problem */263 #define xConfirmPara(a,b) check_failed |= xConfirmParameter(a,b)264 // check range of parameters265 266 /// File I/O267 268 // source specification269 xConfirmPara( m_iSourceWidth <= 0, "Source width must be greater than 0" );270 xConfirmPara( m_iSourceHeight <= 0, "Source height must be greater than 0" );271 xConfirmPara( m_iFrameSkip < 0, "Frame Skipping must be more than or equal to 0" );272 xConfirmPara( m_iFramesToBeRendered < 0, "Total Number Of Frames rendered must be more than 1" );273 274 // bit depth275 xConfirmPara( m_internalBitDepth[0] != m_internalBitDepth[1], "InternalBitDepth for luma and chroma must be equal. ");276 xConfirmPara( m_inputBitDepth[0] < 8, "InputBitDepth must be at least 8" );277 xConfirmPara( m_inputBitDepth[1] < 8, "InputBitDepthC must be at least 8" );278 279 // camera specification280 xConfirmPara( m_iNumberOfInputViews > MAX_INPUT_VIEW_NUM , "NumberOfInputViews must be less than of equal to MAX_INPUT_VIEW_NUM");281 xConfirmPara( m_iNumberOfOutputViews > MAX_OUTPUT_VIEW_NUM, "NumberOfOutputViews must be less than of equal to MAX_OUTPUT_VIEW_NUM");282 283 284 xConfirmPara( m_iRenderDirection < 0 || m_iRenderDirection > 2 , "RenderDirection must be greater than or equal to 0 and less than 3");285 xConfirmPara(m_iNumberOfOutputViews < 1, "Number of OutputViews must be greater or equal to 1");286 if ( m_iRenderDirection == 0 )287 {288 xConfirmPara( m_iNumberOfInputViews < 2, "Number of InputViews must be more than or equal to 2");289 }290 else291 {292 xConfirmPara( m_iNumberOfInputViews < 1, "Number of InputViews must be more than or equal to 1");293 }294 295 xConfirmPara( m_iLog2SamplingFactor < 0 || m_iLog2SamplingFactor > 4, "Log2SamplingFactor must be more than or equal to 0 and less than 5" );296 xConfirmPara( m_iPreProcMode < 0 || m_iPreProcMode > 1, "PreProcMode must be more than or equal to 0 and less than 2" );297 298 299 xConfirmPara( m_iPreFilterSize < 0 || m_iPreFilterSize > 3, "PreFilterSize must be more than or equal to 0 and less than 4" );300 xConfirmPara( m_iBlendMode < 0 || m_iBlendMode > 3, "BlendMode must be more than or equal to 0 and less than 4" );301 xConfirmPara( m_iBlendZThresPerc < 0 || m_iBlendZThresPerc > 100,"BlendZThresPerc must be more than or equal to 0 and less than 101" );302 xConfirmPara( m_iBlendHoleMargin < 0 || m_iBlendHoleMargin > 20,"BlendHoleMargin must be more than or equal to 0 and less than 19" );303 xConfirmPara( m_iInterpolationMode < 0 || m_iInterpolationMode > 4, "InterpolationMode must be more than or equal to 0 and less than 5" );304 xConfirmPara( m_iHoleFillingMode < 0 || m_iHoleFillingMode > 1, "HoleFillingMode must be more than or equal to 0 and less than 2" );305 xConfirmPara( m_iPostProcMode < 0 || m_iPostProcMode > 2, "PostProcMode must be more than or equal to 0 and less than 3" );306 307 Int iNumNonNULL;308 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" );309 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" );310 311 312 if ( !m_bSweep )313 {314 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" );315 }316 else317 {318 xConfirmPara( iNumNonNULL < 1, "Number of SynthOutputFiles must be equal to or more than 1" );319 }320 321 #undef xConfirmPara322 if ( check_failed )323 {324 exit(EXIT_FAILURE);325 }326 327 }328 329 330 331 Void TAppRendererCfg::xPrintParameter()332 {333 printf("\n");334 for( Int iCounter = 0; iCounter < m_iNumberOfInputViews; iCounter++)335 {336 printf("InputVideoFile_%i : %s\n", iCounter, m_pchVideoInputFileList[iCounter]);337 }338 for( Int iCounter = 0; iCounter < m_iNumberOfInputViews; iCounter++)339 {340 printf("InputDepthFile_%i : %s\n", iCounter, m_pchDepthInputFileList[iCounter]);341 }342 343 for( Int iCounter = 0; iCounter < m_iNumberOfOutputViews; iCounter++)344 {345 printf("SynthOutputFile_%i : %s\n", iCounter, m_pchSynthOutputFileList[iCounter]);346 }347 348 printf("Format : %dx%d \n", m_iSourceWidth, m_iSourceHeight );349 printf("Frame index : %d - %d (%d frames)\n", m_iFrameSkip, m_iFrameSkip+m_iFramesToBeRendered-1, m_iFramesToBeRendered);350 printf("CameraParameterFile : %s\n", m_pchCameraParameterFile );351 printf("BaseViewNumbers : %s (%d views) \n", m_pchBaseViewCameraNumbers , m_iNumberOfInputViews );352 printf("Sweep : %d\n", m_bSweep );353 354 if ( m_bUseSetupString )355 {356 printf("ViewConfig : %s\n", m_pchViewConfig );357 }358 else359 {360 printf("SynthViewNumbers : %s (%d views) \n", m_pchSynthViewCameraNumbers, m_iNumberOfOutputViews );361 }362 363 printf("Log2SamplingFactor : %d\n", m_iLog2SamplingFactor );364 printf("UVUp : %d\n", m_bUVUp );365 printf("PreProcMode : %d\n", m_iPreProcMode );366 printf("PreFilterSize : %d\n", m_iPreFilterSize );367 printf("SimEnhance : %d\n", m_bSimEnhance );368 printf("BlendMode : %d\n", m_iBlendMode );369 printf("BlendZThresPerc : %d\n", m_iBlendZThresPerc );370 printf("BlendUseDistWeight : %d\n", m_bBlendUseDistWeight );371 printf("BlendHoleMargin : %d\n", m_iBlendHoleMargin );372 printf("InterpolationMode : %d\n", m_iInterpolationMode );373 printf("HoleFillingMode : %d\n", m_iHoleFillingMode );374 printf("PostProcMode : %d\n", m_iPostProcMode );375 printf("ShiftPrecision : %d\n", m_iShiftPrecision );376 printf("TemporalDepthFilter : %d\n", m_bTempDepthFilter );377 printf("RenderMode : %d\n", m_iRenderMode );378 printf("RendererDirection : %d\n", m_iRenderDirection );379 380 if (m_iRenderMode == 10 )381 {382 printf("UsedPelMapMarExt : %d\n", m_iUsedPelMapMarExt );383 }384 385 printf("\n");386 387 // printf("TOOL CFG: ");388 // printf("ALF:%d ", m_bUseALF );389 // printf("\n");390 391 fflush(stdout);392 }393 394 Void TAppRendererCfg::xPrintUsage()395 {396 printf( "\n" );397 printf( " Example: TAppRenderer.exe -c test.cfg\n\n");398 }399 400 Bool TAppRendererCfg::xConfirmParameter(Bool bflag, const char* message)401 {402 if (!bflag)403 return false;404 405 printf("Error: %s\n",message);406 return true;407 }408 409 410 Void TAppRendererCfg::xCreateFileNames()411 {412 if ( m_iRenderMode == 10 )413 return;414 415 Int iPrecBefore;416 Int iPrecAfter;417 418 xGetMaxPrecision( m_cCameraData.getSynthViewNumbers(), iPrecBefore, iPrecAfter );419 420 421 if (iPrecBefore > LOG10_VIEW_NUM_PREC )422 {423 std::cerr << "Error: View Numbers with more than " << LOG10_VIEW_NUM_PREC << " digits are not supported" << std::endl;424 exit(EXIT_FAILURE);425 }426 427 AOT( !m_bContOutputFileNumbering && (m_cCameraData.getSynthViewNumbers().size() != m_iNumberOfOutputViews ));428 for(Int iIdx = 0; iIdx < m_iNumberOfOutputViews; iIdx++)429 {430 //GT; Create ReconFileNames431 if (m_pchSynthOutputFileList[iIdx] == NULL )432 {433 if ( m_bContOutputFileNumbering )434 {435 xAddNumberToFileName( m_pchSynthOutputFileBaseName, m_pchSynthOutputFileList[iIdx], (Int) ((iIdx+1) * VIEW_NUM_PREC) , 2, 0 );436 }437 else438 {439 xAddNumberToFileName( m_pchSynthOutputFileBaseName, m_pchSynthOutputFileList[iIdx], m_cCameraData.getSynthViewNumbers()[iIdx], iPrecBefore, iPrecAfter );440 }441 }442 }443 444 xGetMaxPrecision( m_cCameraData.getBaseViewNumbers(), iPrecBefore, iPrecAfter );445 for(Int iIdx = 0; iIdx < m_cCameraData.getBaseViewNumbers().size() ; iIdx++)446 {447 //GT; Create ReconFileNames448 if (m_pchVideoInputFileList[iIdx] == NULL )449 {450 xAddNumberToFileName( m_pchVideoInputFileBaseName, m_pchVideoInputFileList[iIdx], m_cCameraData.getBaseViewNumbers()[iIdx], iPrecBefore, iPrecAfter );451 }452 453 if (m_pchDepthInputFileList[iIdx] == NULL )454 {455 xAddNumberToFileName( m_pchDepthInputFileBaseName, m_pchDepthInputFileList[iIdx], m_cCameraData.getBaseViewNumbers()[iIdx], iPrecBefore, iPrecAfter );456 }457 }458 }459 460 Void TAppRendererCfg::xAddNumberToFileName( TChar* pchSourceFileName, TChar*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter )461 {462 463 if ( pchSourceFileName == NULL )464 {465 std::cerr << "No BaseName for file name generation given." << std::endl;466 AOT(true);467 exit(EXIT_FAILURE);468 }469 470 TChar pchNumberBuffer[2* LOG10_VIEW_NUM_PREC + 2];471 TChar pchPrintBuffer[10];472 473 Double dNumberToAdd = ( (Double) iNumberToAdd ) / VIEW_NUM_PREC;474 475 UInt uiWidth = uiPrecBefore;476 477 if (uiPrecAfter != 0)478 {479 uiWidth += uiPrecAfter + 1;480 }481 482 sprintf( pchPrintBuffer, "%%0%d.%df", uiWidth, uiPrecAfter );483 sprintf( pchNumberBuffer, pchPrintBuffer, dNumberToAdd );484 485 if ( uiPrecAfter > 0 ) pchNumberBuffer[ uiPrecBefore ] = '_';486 487 size_t iInLength = strlen(pchSourceFileName);488 size_t iAddLength = strlen(pchNumberBuffer);489 490 rpchTargetFileName = (TChar*) malloc(iInLength+iAddLength+1);491 492 TChar* pchPlaceHolder = strrchr(pchSourceFileName,'$');493 assert( pchPlaceHolder );494 495 size_t iCharsToPlaceHolder = pchPlaceHolder - pchSourceFileName;496 size_t iCharsToEnd = iInLength - iCharsToPlaceHolder;497 498 strncpy(rpchTargetFileName , pchSourceFileName , iCharsToPlaceHolder);499 strncpy(rpchTargetFileName+iCharsToPlaceHolder , pchNumberBuffer , iAddLength );500 strncpy(rpchTargetFileName+iCharsToPlaceHolder+iAddLength, pchSourceFileName+iCharsToPlaceHolder+1, iCharsToEnd-1 );501 rpchTargetFileName[iInLength+iAddLength-1] = '\0';502 }503 504 Void TAppRendererCfg::xGetMaxPrecision( IntAry1d aiIn, Int& iPrecBefore, Int& iPrecAfter )505 {506 iPrecBefore = 0;507 iPrecAfter = 0;508 509 for (UInt uiK = 0; uiK < aiIn.size(); uiK ++ )510 {511 if ( aiIn[uiK] == 0 ) continue;512 513 Int iCurPrec;514 iCurPrec = 0;515 for ( Int iCur = aiIn[uiK]; iCur != 0; iCur /= 10, iCurPrec++ );516 iPrecBefore = max(iPrecBefore, iCurPrec - LOG10_VIEW_NUM_PREC );517 518 iCurPrec = 0;519 for ( Int iCur = 1; aiIn[uiK] % iCur == 0; iCur *= 10, iCurPrec++);520 iCurPrec = LOG10_VIEW_NUM_PREC - std::min((Int) LOG10_VIEW_NUM_PREC, iCurPrec-1 );521 iPrecAfter = max(iPrecAfter, iCurPrec );522 }523 }524 525 #endif -
branches/HTM-16.0-MV-draft-5/source/App/TAppRenderer/TAppRendererCfg.h
r1386 r1390 47 47 #include <vector> 48 48 49 #if NH_3D_VSO50 51 // ====================================================================================================================52 // Class definition53 // ====================================================================================================================54 55 /// encoder configuration class56 class TAppRendererCfg57 {58 protected:59 60 //// file I/O ////61 TChar* m_pchVideoInputFileBaseName; ///< input video file base name, placeholder for numbering $$62 TChar* m_pchDepthInputFileBaseName; ///< input depth file base name, placeholder for numbering $$63 TChar* 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 internal, output and input luma and chroma bit-depth are required to be equal to 8 )69 Int m_inputBitDepth[2]; ///< bit-depth of input file (luma/chroma component)70 Int m_outputBitDepth[2]; ///< bit-depth of output file (luma/chroma component)71 Int m_internalBitDepth[2]; ///< bit-depth renderer operates at in luma/chroma (input/output files will be converted)72 73 74 // derived75 std::vector<TChar*> m_pchVideoInputFileList; ///< source file names76 std::vector<TChar*> m_pchDepthInputFileList; ///< source depth file names77 std::vector<TChar*> m_pchSynthOutputFileList; ///< output reconstruction file names78 79 //// source specification ////80 Int m_iSourceWidth; ///< source width in pixel81 Int m_iSourceHeight; ///< source height in pixel82 Int m_iFrameSkip; ///< number of skipped frames from the beginning83 Int m_iFramesToBeRendered; ///< number of rendered frames84 85 ////camera specification ////86 TChar* m_pchCameraParameterFile; ///< camera parameter file87 TChar* m_pchSynthViewCameraNumbers; ///< numbers of views to synthesize88 TChar* m_pchViewConfig; ///< String to setup renderer89 TChar* m_pchBaseViewCameraNumbers; ///< numbers of base views90 91 // derived92 TAppComCamPara m_cCameraData; ///< class to store camera parameters93 TRenModSetupStrParser m_cRenModStrParser; ///< class to manage View to be rendered94 Bool m_bUseSetupString; ///< true if setup string is used95 96 Int m_iNumberOfInputViews; ///< number of input Views97 Int m_iNumberOfOutputViews; ///< number views to synthesize98 99 //// renderer Modes ////100 Int m_iRenderDirection; ///< 0: interpolate, 1: extrapolate from left, 2: extrapolate from right101 102 Int m_iLog2SamplingFactor; ///< factor for horizontal upsampling before processing103 Bool m_bUVUp; ///< upsampling of chroma planes before processing104 Int m_iPreProcMode; ///< depth pre-processing: 0 = none, 1 = binominal filtering105 Int m_iPreFilterSize; ///< for PreProcMode = 1: size of filter kernel106 Bool m_bSimEnhance; ///< Similarity enhancement before blending107 Int m_iBlendMode; ///< merging of left and right image: 0 = average, 1 = only holes from right, 2 = only holes from left108 Int m_iBlendZThresPerc; ///< z-difference threshold for blending in percent of total z-range109 Bool m_bBlendUseDistWeight; ///< 0: blend using average; 1: blend factor depends on view distance110 Int m_iBlendHoleMargin; ///< Margin around boundaries111 Bool m_bTempDepthFilter; ///< Zheijang temporal enhancement filter112 Int m_iInterpolationMode; ///< 0: NN, 1: linear, 2: cspline113 Int m_iHoleFillingMode; ///< 0: none, 1: line wise background extension114 Int m_iPostProcMode; ///< 0: none, 1: horizontal 3-tap median115 Int m_iRenderMode; ///< 0: use renderer116 Int m_iShiftPrecision; ///< Precision used for Interpolation Mode 4117 Int m_iUsedPelMapMarExt; ///< Used Pel map extra margin118 119 Void xCheckParameter (); ///< check validity of configuration values120 Void xPrintParameter (); ///< print configuration values121 Void xPrintUsage (); ///< print usage122 123 Void xCreateFileNames();124 Void xGetMaxPrecision( IntAry1d adIn, Int& iPrecBefore, Int& iPrecAfter );125 Void xAddNumberToFileName( TChar* pchSourceFileName, TChar*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter );126 public:127 TAppRendererCfg();128 virtual ~TAppRendererCfg();129 130 public:131 Void create (); ///< create option handling class132 Void destroy (); ///< destroy option handling class133 Bool parseCfg ( Int argc, TChar* argv[] ); ///< parse configuration file to fill member variables134 Bool xConfirmParameter(Bool bflag, const TChar* message);135 136 137 };// END CLASS DEFINITION TAppRendererCfg138 139 #endif // __TAppRENDERERCFG__140 49 #endif // NH_3D -
branches/HTM-16.0-MV-draft-5/source/App/TAppRenderer/TAppRendererTop.cpp
r1386 r1390 41 41 #include "TAppRendererTop.h" 42 42 43 #if NH_3D_VSO44 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 // ( Char* pchFile, Bool bWriteMode, const Int fileBitDepth[MAX_NUM_CHANNEL_TYPE], const Int MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE], const Int internalBitDepth[MAX_NUM_CHANNEL_TYPE] )70 71 pcVideoInput->open( m_pchVideoInputFileList[iViewIdx], false, m_inputBitDepth, m_internalBitDepth, m_internalBitDepth ); // read mode72 pcDepthInput->open( m_pchDepthInputFileList[iViewIdx], false, m_inputBitDepth, m_internalBitDepth, m_internalBitDepth ); // read mode73 pcVideoInput->skipFrames(m_iFrameSkip, m_iSourceWidth, m_iSourceHeight, CHROMA_420 );74 pcDepthInput->skipFrames(m_iFrameSkip, m_iSourceWidth, m_iSourceHeight, CHROMA_420 );75 76 m_apcTVideoIOYuvVideoInput.push_back( pcVideoInput );77 m_apcTVideoIOYuvDepthInput.push_back( pcDepthInput );78 }79 80 for(Int iViewIdx=0; iViewIdx<m_iNumberOfOutputViews; iViewIdx++)81 {82 TVideoIOYuv* pcSynthOutput = new TVideoIOYuv;83 pcSynthOutput->open( m_pchSynthOutputFileList[iViewIdx], true, m_outputBitDepth, m_internalBitDepth, m_internalBitDepth ); // write mode84 m_apcTVideoIOYuvSynthOutput.push_back( pcSynthOutput );85 }86 }87 88 89 Void TAppRendererTop::xDestroyLib()90 {91 delete m_pcRenTop;92 93 for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfInputViews; iViewIdx++ )94 {95 m_apcTVideoIOYuvVideoInput[iViewIdx]->close();96 m_apcTVideoIOYuvDepthInput[iViewIdx]->close();97 98 delete m_apcTVideoIOYuvDepthInput[iViewIdx];99 delete m_apcTVideoIOYuvVideoInput[iViewIdx];100 };101 102 for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfOutputViews; iViewIdx++ )103 {104 m_apcTVideoIOYuvSynthOutput[iViewIdx]->close();105 delete m_apcTVideoIOYuvSynthOutput[iViewIdx];106 };107 }108 109 Void TAppRendererTop::xInitLib()110 {111 m_pcRenTop->init(112 m_iSourceWidth,113 m_iSourceHeight,114 (m_iRenderDirection != 0),115 m_iLog2SamplingFactor,116 m_iLog2SamplingFactor+m_iShiftPrecision,117 m_bUVUp,118 m_iPreProcMode,119 m_iPreFilterSize,120 m_iBlendMode,121 m_iBlendZThresPerc,122 m_bBlendUseDistWeight,123 m_iBlendHoleMargin,124 m_iInterpolationMode,125 m_iHoleFillingMode,126 m_iPostProcMode,127 m_iUsedPelMapMarExt128 );129 }130 131 // ====================================================================================================================132 // Public member functions133 // ====================================================================================================================134 135 136 137 Void TAppRendererTop::render()138 {139 xCreateLib();140 xInitLib();141 142 // Create Buffers Input Views;143 std::vector<TComPicYuv*> apcPicYuvBaseVideo;144 std::vector<TComPicYuv*> apcPicYuvBaseDepth;145 146 // TemporalImprovement Filter147 std::vector<TComPicYuv*> apcPicYuvLastBaseVideo;148 std::vector<TComPicYuv*> apcPicYuvLastBaseDepth;149 150 Int aiPad[2] = { 0, 0 };151 152 TComPicYuv* pcNewOrg = new TComPicYuv;153 pcNewOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );154 155 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )156 {157 TComPicYuv* pcNewVideoPic = new TComPicYuv;158 TComPicYuv* pcNewDepthPic = new TComPicYuv;159 160 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );161 apcPicYuvBaseVideo.push_back(pcNewVideoPic);162 163 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true);164 apcPicYuvBaseDepth.push_back(pcNewDepthPic);165 166 //Temporal improvement Filter167 if ( m_bTempDepthFilter )168 {169 pcNewVideoPic = new TComPicYuv;170 pcNewDepthPic = new TComPicYuv;171 172 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );173 apcPicYuvLastBaseVideo.push_back(pcNewVideoPic);174 175 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );176 apcPicYuvLastBaseDepth.push_back(pcNewDepthPic);177 }178 }179 180 // Create Buffer for synthesized View181 TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;182 pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );183 184 Bool bAnyEOS = false;185 186 Int iNumOfRenderedFrames = 0;187 Int iFrame = 0;188 189 while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )190 {191 if ( iFrame >= m_iFrameSkip )192 {193 // read in depth and video194 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )195 {196 m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx],pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420 ) ;197 198 apcPicYuvBaseVideo[iBaseViewIdx]->extendPicBorder();199 200 bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();201 202 m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx],pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420 ) ;203 apcPicYuvBaseDepth[iBaseViewIdx]->extendPicBorder();204 bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();205 206 if ( m_bTempDepthFilter && (iFrame >= m_iFrameSkip) )207 {208 m_pcRenTop->temporalFilterVSRS( apcPicYuvBaseVideo[iBaseViewIdx], apcPicYuvBaseDepth[iBaseViewIdx], apcPicYuvLastBaseVideo[iBaseViewIdx], apcPicYuvLastBaseDepth[iBaseViewIdx], ( iFrame == m_iFrameSkip) );209 }210 }211 }212 else213 {214 std::cout << "Skipping Frame " << iFrame << std::endl;215 216 iFrame++;217 continue;218 }219 220 m_cCameraData.update( (UInt)iFrame - m_iFrameSkip );221 222 for(Int iSynthViewIdx=0; iSynthViewIdx < m_iNumberOfOutputViews; iSynthViewIdx++ )223 {224 Int iLeftBaseViewIdx = -1;225 Int iRightBaseViewIdx = -1;226 227 Bool bIsBaseView = false;228 229 Int iRelDistToLeft;230 Bool bHasLRView = m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftBaseViewIdx, iRightBaseViewIdx, iRelDistToLeft, bIsBaseView );231 Bool bHasLView = ( iLeftBaseViewIdx != -1 );232 Bool bHasRView = ( iRightBaseViewIdx != -1 );233 Bool bRender = true;234 235 Int iBlendMode = m_iBlendMode;236 Int iSimEnhBaseView = 0;237 238 switch( m_iRenderDirection )239 {240 /// INTERPOLATION241 case 0:242 AOF( bHasLRView || bIsBaseView );243 244 if ( !bHasLRView && bIsBaseView && m_iBlendMode == 0 )245 {246 bRender = false;247 }248 else249 {250 if ( bIsBaseView )251 {252 AOF( iLeftBaseViewIdx == iRightBaseViewIdx );253 Int iSortedBaseViewIdx = m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx];254 255 if ( m_iBlendMode == 1 )256 {257 if ( iSortedBaseViewIdx - 1 >= 0 )258 {259 iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx - 1];260 bRender = true;261 }262 else263 {264 bRender = false;265 }266 }267 else if ( m_iBlendMode == 2 )268 {269 if ( iSortedBaseViewIdx + 1 < m_iNumberOfInputViews )270 {271 iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx + 1];272 bRender = true;273 }274 else275 {276 bRender = false;277 }278 }279 }280 281 if ( m_iBlendMode == 3 )282 {283 if ( bIsBaseView && (iLeftBaseViewIdx == 0) )284 {285 bRender = false;286 }287 else288 {289 Int iDistLeft = abs( m_cCameraData.getBaseId2SortedId()[0] - m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx ] );290 Int iDistRight = abs( m_cCameraData.getBaseId2SortedId()[0] - m_cCameraData.getBaseId2SortedId() [iRightBaseViewIdx] );291 292 Int iFillViewIdx = iDistLeft > iDistRight ? iLeftBaseViewIdx : iRightBaseViewIdx;293 294 if( m_cCameraData.getBaseId2SortedId()[0] < m_cCameraData.getBaseId2SortedId() [iFillViewIdx] )295 {296 iBlendMode = 1;297 iLeftBaseViewIdx = 0;298 iRightBaseViewIdx = iFillViewIdx;299 }300 else301 {302 iBlendMode = 2;303 iLeftBaseViewIdx = iFillViewIdx;304 iRightBaseViewIdx = 0;305 }306 307 }308 }309 else310 {311 iBlendMode = m_iBlendMode;312 }313 }314 315 if ( m_bSimEnhance )316 {317 if ( m_iNumberOfInputViews == 3 && m_cCameraData.getRelSynthViewNumbers()[ iSynthViewIdx ] < VIEW_NUM_PREC )318 {319 iSimEnhBaseView = 2; // Take middle view320 }321 else322 {323 iSimEnhBaseView = 1; // Take left view324 }325 }326 327 if ( bRender )328 {329 std::cout << "Rendering Frame " << iFrame330 << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx ] / VIEW_NUM_PREC331 << " Left BaseView: " << (Double) m_cCameraData.getBaseViewNumbers() [iLeftBaseViewIdx ] / VIEW_NUM_PREC332 << " Right BaseView: " << (Double) m_cCameraData.getBaseViewNumbers() [iRightBaseViewIdx] / VIEW_NUM_PREC333 << " BlendMode: " << iBlendMode334 << std::endl;335 336 m_pcRenTop->setShiftLUTs(337 m_cCameraData.getSynthViewShiftLUTD()[iLeftBaseViewIdx ][iSynthViewIdx],338 m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx],339 m_cCameraData.getBaseViewShiftLUTI ()[iLeftBaseViewIdx ][iRightBaseViewIdx],340 m_cCameraData.getSynthViewShiftLUTD()[iRightBaseViewIdx][iSynthViewIdx],341 m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx][iSynthViewIdx],342 m_cCameraData.getBaseViewShiftLUTI ()[iRightBaseViewIdx][iLeftBaseViewIdx ],343 344 iRelDistToLeft345 );346 347 m_pcRenTop->interpolateView(348 apcPicYuvBaseVideo[iLeftBaseViewIdx ],349 apcPicYuvBaseDepth[iLeftBaseViewIdx ],350 apcPicYuvBaseVideo[iRightBaseViewIdx],351 apcPicYuvBaseDepth[iRightBaseViewIdx],352 pcPicYuvSynthOut,353 iBlendMode,354 iSimEnhBaseView355 );356 }357 else358 {359 AOT(iLeftBaseViewIdx != iRightBaseViewIdx );360 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut );361 std::cout << "Copied Frame " << iFrame362 << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC363 << " (BaseView) " << std::endl;364 }365 366 break;367 /// EXTRAPOLATION FROM LEFT368 case 1:369 if ( !bHasLView ) // View to render is BaseView370 {371 bRender = false;372 }373 374 if ( bIsBaseView )375 {376 AOF( iLeftBaseViewIdx == iRightBaseViewIdx );377 Int iSortedBaseViewIdx = m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx];378 if ( iSortedBaseViewIdx - 1 >= 0 )379 {380 iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx - 1];381 }382 else383 {384 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;385 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original386 bRender = false;387 }388 }389 390 391 if (bRender)392 {393 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;394 m_pcRenTop->setShiftLUTs( m_cCameraData.getSynthViewShiftLUTD()[iLeftBaseViewIdx ][iSynthViewIdx],395 m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx], NULL, NULL, NULL, NULL, -1 );396 m_pcRenTop->extrapolateView( apcPicYuvBaseVideo[iLeftBaseViewIdx ], apcPicYuvBaseDepth[iLeftBaseViewIdx ], pcPicYuvSynthOut, true );397 }398 break;399 /// EXTRAPOLATION FROM RIGHT400 case 2: // extrapolation from right401 if ( !bHasRView ) // View to render is BaseView402 {403 bRender = false;404 }405 406 if ( bIsBaseView )407 {408 409 AOF( iLeftBaseViewIdx == iRightBaseViewIdx );410 Int iSortedBaseViewIdx = m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx];411 if ( iSortedBaseViewIdx + 1 < m_iNumberOfInputViews )412 {413 iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx + 1];414 }415 else416 {417 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;418 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original419 bRender = false;420 }421 }422 423 if ( bRender )424 {425 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;426 m_pcRenTop->setShiftLUTs( NULL, NULL,NULL, m_cCameraData.getSynthViewShiftLUTD()[iRightBaseViewIdx ][iSynthViewIdx],427 m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx ][iSynthViewIdx],NULL, iRelDistToLeft);428 m_pcRenTop->extrapolateView( apcPicYuvBaseVideo[iRightBaseViewIdx ], apcPicYuvBaseDepth[iRightBaseViewIdx ], pcPicYuvSynthOut, false);429 }430 break;431 }432 433 // Write Output434 435 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, IPCOLOURSPACE_UNCHANGED, 0, 0, 0, 0, CHROMA_420 );436 }437 iFrame++;438 iNumOfRenderedFrames++;439 }440 441 // Delete Buffers442 pcNewOrg->destroy();443 delete pcNewOrg;444 445 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )446 {447 apcPicYuvBaseVideo[uiBaseView]->destroy();448 delete apcPicYuvBaseVideo[uiBaseView];449 450 apcPicYuvBaseDepth[uiBaseView]->destroy();451 delete apcPicYuvBaseDepth[uiBaseView];452 453 // Temporal Filter454 if ( m_bTempDepthFilter )455 {456 apcPicYuvLastBaseVideo[uiBaseView]->destroy();457 delete apcPicYuvLastBaseVideo[uiBaseView];458 459 apcPicYuvLastBaseDepth[uiBaseView]->destroy();460 delete apcPicYuvLastBaseDepth[uiBaseView];461 }462 }463 464 pcPicYuvSynthOut->destroy();465 delete pcPicYuvSynthOut;466 467 xDestroyLib();468 469 }470 471 Void TAppRendererTop::go()472 {473 switch ( m_iRenderMode )474 {475 case 0:476 render();477 break;478 #if NH_3D_VSO479 case 1:480 renderModel();481 break;482 #endif483 case 10:484 renderUsedPelsMap( );485 break;486 default:487 AOT(true);488 }489 490 #if NH_3D_REN_MAX_DEV_OUT491 Double dMaxDispDiff = m_cCameraData.getMaxShiftDeviation();492 493 if ( !(dMaxDispDiff < 0) )494 {495 printf("\n Max. possible shift error: %12.3f samples.\n", dMaxDispDiff );496 }497 #endif498 }499 500 #if NH_3D_VSO501 Void TAppRendererTop::renderModel()502 {503 if ( m_bUseSetupString )504 {505 xRenderModelFromString();506 }507 else508 {509 xRenderModelFromNums();510 }511 }512 513 514 515 Void TAppRendererTop::xRenderModelFromString()516 {517 xCreateLib();518 xInitLib();519 520 // Create Buffers Input Views;521 std::vector<TComPicYuv*> apcPicYuvBaseVideo;522 std::vector<TComPicYuv*> apcPicYuvBaseDepth;523 524 525 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )526 {527 TComPicYuv* pcNewVideoPic = new TComPicYuv;528 TComPicYuv* pcNewDepthPic = new TComPicYuv;529 530 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );531 apcPicYuvBaseVideo.push_back(pcNewVideoPic);532 533 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );534 apcPicYuvBaseDepth.push_back(pcNewDepthPic);535 }536 537 Int aiPad[2] = { 0, 0 };538 TComPicYuv* pcNewOrg = new TComPicYuv;539 pcNewOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );540 541 // Init Model542 TRenModel cCurModel;543 544 AOT( m_iLog2SamplingFactor != 0 );545 #if H_3D_VSO_EARLY_SKIP546 cCurModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false );547 #else548 cCurModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin );549 #endif550 551 cCurModel.setupPart( 0, m_iSourceHeight );552 553 for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfInputViews; iViewIdx++ )554 {555 Int iNumOfModels = m_cRenModStrParser.getNumOfModelsForView(iViewIdx, 1);556 557 for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ )558 {559 Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode;560 m_cRenModStrParser.getSingleModelData ( iViewIdx, 1, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ;561 cCurModel .createSingleModel ( iViewIdx, 1, iModelNum, iLeftViewNum, iRightViewNum, false, iBlendMode );562 }563 }564 565 // Create Buffer for synthesized View566 TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;567 pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );568 569 Bool bAnyEOS = false;570 571 Int iNumOfRenderedFrames = 0;572 Int iFrame = 0;573 574 while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )575 {576 577 if ( iFrame >= m_iFrameSkip )578 {579 // read in depth and video580 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )581 {582 m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420 ) ;583 bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();584 585 m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420 ) ;586 bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();587 }588 }589 else590 {591 iFrame++;592 continue;593 }594 595 596 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )597 {598 TComPicYuv* pcPicYuvVideo = apcPicYuvBaseVideo[iBaseViewIdx];599 TComPicYuv* pcPicYuvDepth = apcPicYuvBaseDepth[iBaseViewIdx];600 Int iBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iBaseViewIdx ];601 cCurModel.setBaseView( iBaseViewSIdx, pcPicYuvVideo, pcPicYuvDepth, NULL, NULL );602 }603 604 m_cCameraData.update( (UInt) ( iFrame - m_iFrameSkip ));605 606 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )607 {608 // setup virtual views609 Int iBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iBaseViewIdx];610 611 cCurModel.setErrorMode( iBaseViewSIdx, 1, 0 );612 Int iNumOfSV = m_cRenModStrParser.getNumOfModelsForView( iBaseViewSIdx, 1);613 for (Int iCurView = 0; iCurView < iNumOfSV; iCurView++ )614 {615 Int iOrgRefBaseViewSIdx;616 Int iLeftBaseViewSIdx;617 Int iRightBaseViewSIdx;618 Int iSynthViewRelNum;619 Int iModelNum;620 Int iBlendMode;621 622 m_cRenModStrParser.getSingleModelData(iBaseViewSIdx, 1, iCurView, iModelNum, iBlendMode, iLeftBaseViewSIdx, iRightBaseViewSIdx, iOrgRefBaseViewSIdx, iSynthViewRelNum );623 624 Int iLeftBaseViewIdx = -1;625 Int iRightBaseViewIdx = -1;626 627 TComPicYuv* pcPicYuvOrgRef = NULL;628 Int** ppiShiftLUTLeft = NULL;629 Int** ppiShiftLUTRight = NULL;630 Int** ppiBaseShiftLUTLeft = NULL;631 Int** ppiBaseShiftLUTRight = NULL;632 633 634 Int iDistToLeft = -1;635 636 Int iSynthViewIdx = m_cCameraData.synthRelNum2Idx( iSynthViewRelNum );637 638 if ( iLeftBaseViewSIdx != -1 )639 {640 iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [ iLeftBaseViewSIdx ];641 ppiShiftLUTLeft = m_cCameraData.getSynthViewShiftLUTI()[ iLeftBaseViewIdx ][ iSynthViewIdx ];642 }643 644 if ( iRightBaseViewSIdx != -1 )645 {646 iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [iRightBaseViewSIdx ];647 ppiShiftLUTRight = m_cCameraData.getSynthViewShiftLUTI()[ iRightBaseViewIdx ][ iSynthViewIdx ];648 }649 650 if ( iRightBaseViewSIdx != -1 && iLeftBaseViewSIdx != -1 )651 {652 653 ppiBaseShiftLUTLeft = m_cCameraData.getBaseViewShiftLUTI() [ iLeftBaseViewIdx ][ iRightBaseViewIdx ];654 ppiBaseShiftLUTRight = m_cCameraData.getBaseViewShiftLUTI() [ iRightBaseViewIdx ][ iLeftBaseViewIdx ];655 iDistToLeft = m_cCameraData.getRelDistLeft( iSynthViewIdx , iLeftBaseViewIdx, iRightBaseViewIdx);656 }657 658 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;659 660 cCurModel.setSingleModel( iModelNum, ppiShiftLUTLeft, ppiBaseShiftLUTLeft, ppiShiftLUTRight, ppiBaseShiftLUTRight, iDistToLeft, pcPicYuvOrgRef );661 662 Int iViewPos;663 if (iLeftBaseViewSIdx != -1 && iRightBaseViewSIdx != -1)664 {665 iViewPos = VIEWPOS_MERGED;666 }667 else if ( iLeftBaseViewSIdx != -1 )668 {669 iViewPos = VIEWPOS_LEFT;670 }671 else if ( iRightBaseViewSIdx != -1 )672 {673 iViewPos = VIEWPOS_RIGHT;674 }675 else676 {677 AOT(true);678 }679 680 cCurModel.getSynthVideo ( iModelNum, iViewPos, pcPicYuvSynthOut );681 682 // Write Output683 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iModelNum]->write( pcPicYuvSynthOut, IPCOLOURSPACE_UNCHANGED, 0 ,0 ,0, 0, CHROMA_420 );684 }685 }686 iFrame++;687 iNumOfRenderedFrames++;688 }689 690 // Delete Buffers691 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )692 {693 apcPicYuvBaseVideo[uiBaseView]->destroy();694 delete apcPicYuvBaseVideo[uiBaseView];695 696 apcPicYuvBaseDepth[uiBaseView]->destroy();697 delete apcPicYuvBaseDepth[uiBaseView];698 }699 pcPicYuvSynthOut->destroy();700 delete pcPicYuvSynthOut;701 702 xDestroyLib();703 }704 705 706 Void TAppRendererTop::xRenderModelFromNums()707 {708 xCreateLib();709 xInitLib();710 711 // Create Buffers Input Views;712 std::vector<TComPicYuv*> apcPicYuvBaseVideo;713 std::vector<TComPicYuv*> apcPicYuvBaseDepth;714 715 716 Int aiPad[2] = { 0, 0 };717 TComPicYuv* pcNewOrg = new TComPicYuv;718 pcNewOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );719 720 721 // Init Model722 TRenModel cCurModel;723 724 AOT( m_iLog2SamplingFactor != 0 );725 726 #if H_3D_VSO_EARLY_SKIP727 cCurModel.create( m_iNumberOfInputViews, m_iNumberOfOutputViews, m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false );728 #else729 cCurModel.create( m_iNumberOfInputViews, m_iNumberOfOutputViews, m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin );730 #endif731 cCurModel.setupPart( 0, m_iSourceHeight );732 733 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )734 {735 TComPicYuv* pcNewVideoPic = new TComPicYuv;736 TComPicYuv* pcNewDepthPic = new TComPicYuv;737 738 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );739 apcPicYuvBaseVideo.push_back(pcNewVideoPic);740 741 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );742 apcPicYuvBaseDepth.push_back(pcNewDepthPic);743 }744 745 for(Int iSynthViewIdx=0; iSynthViewIdx < m_iNumberOfOutputViews; iSynthViewIdx++ )746 {747 Int iLeftBaseViewIdx = -1;748 Int iRightBaseViewIdx = -1;749 Bool bIsBaseView = false;750 751 Int iRelDistToLeft;752 m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftBaseViewIdx, iRightBaseViewIdx, iRelDistToLeft, bIsBaseView );753 754 if (m_iRenderDirection == 1 )755 {756 iRightBaseViewIdx = -1;757 AOT( iLeftBaseViewIdx == -1);758 }759 760 if (m_iRenderDirection == 2 )761 {762 iLeftBaseViewIdx = -1;763 AOT( iRightBaseViewIdx == -1);764 }765 766 Int iLeftBaseViewSIdx = -1;767 Int iRightBaseViewSIdx = -1;768 769 if (iLeftBaseViewIdx != -1 )770 {771 iLeftBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iLeftBaseViewIdx];772 }773 774 if (iRightBaseViewIdx != -1 )775 {776 iRightBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iRightBaseViewIdx];777 }778 cCurModel.createSingleModel(-1, -1, iSynthViewIdx, iLeftBaseViewSIdx, iRightBaseViewSIdx, false, m_iBlendMode );779 }780 781 // Create Buffer for synthesized View782 TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;783 pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );784 785 Bool bAnyEOS = false;786 787 Int iNumOfRenderedFrames = 0;788 Int iFrame = 0;789 790 while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )791 {792 793 if ( iFrame >= m_iFrameSkip )794 {795 // read in depth and video796 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )797 {798 m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420 ) ;799 bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();800 801 m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420 ) ;802 bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();803 804 if ( iFrame >= m_iFrameSkip )805 {806 Int iBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iBaseViewIdx];807 cCurModel.setBaseView( iBaseViewSIdx, apcPicYuvBaseVideo[iBaseViewIdx], apcPicYuvBaseDepth[iBaseViewIdx], NULL, NULL );808 }809 }810 }811 else812 {813 iFrame++;814 continue;815 }816 m_cCameraData.update( (UInt) (iFrame - m_iFrameSkip ));817 for(Int iSynthViewIdx=0; iSynthViewIdx < m_iNumberOfOutputViews; iSynthViewIdx++ )818 {819 820 Int iLeftBaseViewIdx = -1;821 Int iRightBaseViewIdx = -1;822 823 Bool bIsBaseView = false;824 825 Int iRelDistToLeft;826 Bool bHasLRView = m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftBaseViewIdx, iRightBaseViewIdx, iRelDistToLeft, bIsBaseView );827 Bool bHasLView = ( iLeftBaseViewIdx != -1 );828 Bool bHasRView = ( iRightBaseViewIdx != -1 );829 830 switch( m_iRenderDirection )831 {832 /// INTERPOLATION833 case 0:834 assert( bHasLRView || bIsBaseView );835 836 if ( !bHasLRView && bIsBaseView ) // View to render is BaseView837 {838 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;839 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original840 }841 else // Render842 {843 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;844 cCurModel.setSingleModel( iSynthViewIdx,845 m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx] ,846 m_cCameraData.getBaseViewShiftLUTI ()[iLeftBaseViewIdx ][iRightBaseViewIdx],847 m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx][iSynthViewIdx] ,848 m_cCameraData.getBaseViewShiftLUTI ()[iRightBaseViewIdx][iLeftBaseViewIdx] ,849 iRelDistToLeft,850 NULL );851 cCurModel.getSynthVideo ( iSynthViewIdx, VIEWPOS_MERGED, pcPicYuvSynthOut );852 }853 break;854 /// EXTRAPOLATION FROM LEFT855 case 1:856 857 if ( !bHasLView ) // View to render is BaseView858 {859 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;860 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original861 }862 else // Render863 {864 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;865 cCurModel.setSingleModel( iSynthViewIdx, m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx], NULL, NULL, NULL, -1, NULL);866 cCurModel.getSynthVideo ( iSynthViewIdx, VIEWPOS_LEFT, pcPicYuvSynthOut );867 }868 break;869 /// EXTRAPOLATION FROM RIGHT870 case 2: // extrapolation from right871 if ( !bHasRView ) // View to render is BaseView872 {873 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;874 apcPicYuvBaseVideo[iRightBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original875 }876 else // Render877 {878 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;879 cCurModel.setSingleModel( iSynthViewIdx, NULL , NULL, m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx ][iSynthViewIdx], NULL, -1, NULL);880 cCurModel.getSynthVideo ( iSynthViewIdx, VIEWPOS_RIGHT, pcPicYuvSynthOut );881 }882 break;883 }884 885 // Write Output886 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, IPCOLOURSPACE_UNCHANGED, 0 ,0 ,0, 0, CHROMA_420 );887 }888 iFrame++;889 iNumOfRenderedFrames++;890 }891 892 // Delete Buffers893 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )894 {895 apcPicYuvBaseVideo[uiBaseView]->destroy();896 delete apcPicYuvBaseVideo[uiBaseView];897 898 apcPicYuvBaseDepth[uiBaseView]->destroy();899 delete apcPicYuvBaseDepth[uiBaseView];900 }901 pcPicYuvSynthOut->destroy();902 delete pcPicYuvSynthOut;903 904 xDestroyLib();905 906 }907 #endif908 909 Void TAppRendererTop::renderUsedPelsMap( )910 {911 xCreateLib();912 xInitLib();913 914 // Create Buffers Input Views;915 std::vector<TComPicYuv*> apcPicYuvBaseVideo;916 std::vector<TComPicYuv*> apcPicYuvBaseDepth;917 918 // TemporalImprovement Filter919 std::vector<TComPicYuv*> apcPicYuvLastBaseVideo;920 std::vector<TComPicYuv*> apcPicYuvLastBaseDepth;921 922 Int aiPad[2] = { 0, 0 };923 924 TComPicYuv* pcNewOrg = new TComPicYuv;925 pcNewOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );926 927 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )928 {929 TComPicYuv* pcNewVideoPic = new TComPicYuv;930 TComPicYuv* pcNewDepthPic = new TComPicYuv;931 932 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight,CHROMA_420, 1, 1, 1, true );933 apcPicYuvBaseVideo.push_back(pcNewVideoPic);934 935 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );936 apcPicYuvBaseDepth.push_back(pcNewDepthPic);937 938 939 //Temporal improvement Filter940 if ( m_bTempDepthFilter )941 {942 pcNewVideoPic = new TComPicYuv;943 pcNewDepthPic = new TComPicYuv;944 945 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1 , true);946 apcPicYuvLastBaseVideo.push_back(pcNewVideoPic);947 948 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight,CHROMA_420, 1, 1, 1 , true);949 apcPicYuvLastBaseDepth.push_back(pcNewDepthPic);950 }951 }952 953 // Create Buffer for synthesized View954 TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;955 pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1 ,1, true);956 957 Bool bAnyEOS = false;958 959 Int iNumOfRenderedFrames = 0;960 Int iFrame = 0;961 962 while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )963 {964 if ( iFrame >= m_iFrameSkip )965 {966 // read in depth and video967 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )968 {969 m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420 ) ;970 apcPicYuvBaseVideo[iBaseViewIdx]->extendPicBorder();971 bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();972 973 m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420 ) ;974 apcPicYuvBaseDepth[iBaseViewIdx]->extendPicBorder();975 bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();976 977 if ( m_bTempDepthFilter && (iFrame >= m_iFrameSkip) )978 {979 m_pcRenTop->temporalFilterVSRS( apcPicYuvBaseVideo[iBaseViewIdx], apcPicYuvBaseDepth[iBaseViewIdx], apcPicYuvLastBaseVideo[iBaseViewIdx], apcPicYuvLastBaseDepth[iBaseViewIdx], ( iFrame == m_iFrameSkip) );980 }981 }982 }983 else984 {985 std::cout << "Skipping Frame " << iFrame << std::endl;986 987 iFrame++;988 continue;989 }990 m_cCameraData.update( (UInt) ( iFrame - m_iFrameSkip ) );991 992 for(Int iViewIdx=1; iViewIdx < m_iNumberOfInputViews; iViewIdx++ )993 {994 std::cout << "Rendering UsedPelsMap for Frame " << iFrame << " of View " << (Double) m_cCameraData.getBaseViewNumbers()[iViewIdx] << std::endl;995 996 Int iViewSIdx = m_cCameraData.getBaseId2SortedId()[iViewIdx];997 Int iFirstViewSIdx = m_cCameraData.getBaseId2SortedId()[0];998 999 AOT( iViewSIdx == iFirstViewSIdx );1000 1001 Bool bFirstIsLeft = (iFirstViewSIdx < iViewSIdx);1002 1003 m_pcRenTop->setShiftLUTs(1004 m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx],1005 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],1006 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],1007 m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx],1008 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],1009 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],1010 -11011 );1012 1013 m_pcRenTop->getUsedSamplesMap( apcPicYuvBaseDepth[0], pcPicYuvSynthOut, bFirstIsLeft );1014 1015 // Write Output1016 m_apcTVideoIOYuvSynthOutput[iViewIdx-1]->write( pcPicYuvSynthOut, IPCOLOURSPACE_UNCHANGED, 0, 0, 0, 0, CHROMA_420 );1017 1018 }1019 iFrame++;1020 iNumOfRenderedFrames++;1021 }1022 1023 // Delete Buffers1024 1025 pcNewOrg->destroy();1026 delete pcNewOrg;1027 1028 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )1029 {1030 apcPicYuvBaseVideo[uiBaseView]->destroy();1031 delete apcPicYuvBaseVideo[uiBaseView];1032 1033 apcPicYuvBaseDepth[uiBaseView]->destroy();1034 delete apcPicYuvBaseDepth[uiBaseView];1035 1036 // Temporal Filter1037 if ( m_bTempDepthFilter )1038 {1039 apcPicYuvLastBaseVideo[uiBaseView]->destroy();1040 delete apcPicYuvLastBaseVideo[uiBaseView];1041 1042 apcPicYuvLastBaseDepth[uiBaseView]->destroy();1043 delete apcPicYuvLastBaseDepth[uiBaseView];1044 }1045 }1046 pcPicYuvSynthOut->destroy();1047 delete pcPicYuvSynthOut;1048 1049 xDestroyLib();1050 1051 }1052 #endif -
branches/HTM-16.0-MV-draft-5/source/App/TAppRenderer/TAppRendererTop.h
r1386 r1390 40 40 #define __TAppRendererTOP__ 41 41 #include "../../Lib/TLibCommon/CommonDef.h" 42 #if NH_3D_VSO43 #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 NH_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 NH_3D_VSO81 Void renderModel ();82 #endif83 Void go ();84 Void renderUsedPelsMap();85 86 };// END CLASS DEFINITION TAppRendererTop87 88 89 #endif // NH_3D90 42 #endif // __TAppRendererTOP__
Note: See TracChangeset for help on using the changeset viewer.