Changeset 1325 in 3DVCSoftware for branches/HTM-15.1-MV-draft-4/source/App
- Timestamp:
- 7 Sep 2015, 18:40:35 (10 years ago)
- Location:
- branches/HTM-15.1-MV-draft-4/source/App
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-15.1-MV-draft-4/source/App/TAppDecoder/TAppDecCfg.cpp
r1321 r1325 68 68 string cfg_ReconFile; 69 69 string cfg_TargetDecLayerIdSetFile; 70 #if NH_3D71 string cfg_ScaleOffsetFile;72 #endif73 70 string outputColourSpaceConvert; 74 71 Int warnUnknowParameter = 0; … … 82 79 ("ReconFile,o", cfg_ReconFile, string(""), "reconstructed YUV output file name\n" 83 80 "YUV writing is skipped if omitted") 84 #if NH_3D85 ("ScaleOffsetFile,p", cfg_ScaleOffsetFile, string(""), "file with coded scales and offsets")86 ("Depth420OutputFlag", m_depth420OutputFlag, true , "Output depth layers in 4:2:0 ")87 #endif88 81 ("WarnUnknowParameter,w", warnUnknowParameter, 0, "warn for unknown configuration parameters instead of failing") 89 82 ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access") … … 148 141 m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); 149 142 150 #if NH_3D151 m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str());152 #endif153 143 154 144 if (!m_pchBitstreamFile) -
branches/HTM-15.1-MV-draft-4/source/App/TAppDecoder/TAppDecCfg.h
r1321 r1325 93 93 Bool m_printPicOutput; ///< Print information on picture output 94 94 Bool m_printReceivedNalus; ///< Print information on received NAL units 95 #if NH_3D96 Char* m_pchScaleOffsetFile; ///< output coded scale and offset parameters97 Bool m_depth420OutputFlag; ///< output depth layers in 4:2:098 #endif99 95 100 96 Void xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName); ///< create filenames -
branches/HTM-15.1-MV-draft-4/source/App/TAppDecoder/TAppDecTop.cpp
r1321 r1325 93 93 m_cvsStartFound = false; 94 94 #endif 95 #if NH_3D96 m_pScaleOffsetFile = 0;97 #endif98 95 } 99 96 … … 139 136 m_pchReconFile = NULL; 140 137 } 141 #if NH_3D142 if (m_pchScaleOffsetFile)143 {144 free (m_pchScaleOffsetFile);145 m_pchScaleOffsetFile = NULL;146 }147 #endif148 138 } 149 139 … … 401 391 // initialize global variables 402 392 initROM(); 403 #if NH_3D_DMM404 initWedgeLists();405 #endif406 393 #else 407 394 // create decoder class … … 444 431 m_cTDecTop.destroy(); 445 432 #endif 446 #if NH_3D447 m_cCamParsCollector.uninit();448 if( m_pScaleOffsetFile )449 {450 ::fclose( m_pScaleOffsetFile );451 }452 #endif453 433 } 454 434 … … 456 436 { 457 437 458 #if NH_3D459 m_cCamParsCollector.setCodeScaleOffsetFile( m_pScaleOffsetFile );460 #endif461 438 #if NH_MV 462 439 m_dpb.setPrintPicOutput(m_printPicOutput); … … 1035 1012 xFinalizeAU ( ); 1036 1013 1037 #if NH_3D1038 if( m_cCamParsCollector.isInitialized() )1039 {1040 m_cCamParsCollector.setSlice( 0 );1041 }1042 #endif1043 1014 xFlushOutput(); 1044 1015 m_dpb.emptyAllSubDpbs(); … … 1068 1039 m_newVpsActivatedbyCurAu = true; //TBD 1069 1040 m_newVpsActivatedbyCurPic = true; 1070 #if NH_3D1071 m_dpb.setVPS( m_vps );1072 #endif1073 1041 } 1074 1042 … … 1192 1160 Void TAppDecTop::xFinalizeAU() 1193 1161 { 1194 #if NH_3D1195 if ( !m_curAu.empty())1196 {1197 for (TComList<TComPic*>::iterator it = m_curAu.begin(); it != m_curAu.end(); it++)1198 {1199 TComPic* pic = (*it);1200 if ( !pic->getHasGeneratedRefPics() )1201 {1202 pic->compressMotion(1);1203 }1204 }1205 }1206 #endif1207 1162 } 1208 1163 … … 2664 2619 m_tDecTop[ decIdx ]->setDecodedSEIMessageOutputStream(&os); 2665 2620 } 2666 #if NH_3D2667 m_tDecTop[ decIdx ]->setCamParsCollector( &m_cCamParsCollector );2668 #endif2669 2621 2670 2622 // append pic list of new decoder to PicLists … … 2888 2840 } 2889 2841 2890 #if NH_3D2891 if( m_pchScaleOffsetFile )2892 {2893 m_pScaleOffsetFile = ::fopen( m_pchScaleOffsetFile, "wt" );2894 if (!m_pScaleOffsetFile)2895 {2896 fprintf(stderr, "\nUnable to open file `%s' for writing decoded Camera Parameters messages\n", m_pchScaleOffsetFile);2897 exit(EXIT_FAILURE);2898 }2899 }2900 #endif2901 2842 } 2902 2843 … … 2987 2928 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 2988 2929 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), 2989 #if NH_3D2990 m_depth420OutputFlag && curPic->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT2991 #else2992 2930 NUM_CHROMA_FORMAT 2993 #endif2994 2931 , m_bClipOutputVideoToRec709Range); 2995 2932 } -
branches/HTM-15.1-MV-draft-4/source/App/TAppDecoder/TAppDecTop.h
r1321 r1325 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-15.1-MV-draft-4/source/App/TAppEncoder/TAppEncCfg.cpp
r1313 r1325 73 73 #if NH_MV 74 74 MULTIVIEWMAIN = 6, 75 #if NH_3D76 MAIN3D = 8,77 #endif78 75 #endif 79 76 MONOCHROME_8 = 1008, … … 129 126 m_targetPivotValue = NULL; 130 127 131 #if KWU_RC_MADPRED_E0227132 m_depthMADPred = 0;133 #endif134 128 } 135 129 … … 194 188 m_GOPListMvc[i] = NULL; 195 189 } 196 }197 #endif198 #if NH_3D199 #if NH_3D_VSO200 if ( m_pchVSOConfig != NULL)201 {202 free ( m_pchVSOConfig );203 }204 #endif205 if ( m_pchCameraParameterFile != NULL )206 {207 free ( m_pchCameraParameterFile );208 }209 210 if ( m_pchBaseViewCameraNumbers != NULL )211 {212 free ( m_pchBaseViewCameraNumbers );213 190 } 214 191 #endif … … 267 244 } 268 245 #endif 269 #if NH_3D270 in>>entry.m_interCompPredFlag;271 #endif272 246 273 247 return in; … … 303 277 #if NH_MV 304 278 ,{"multiview-main" , Profile::MULTIVIEWMAIN }, 305 #if NH_3D306 {"3d-main" , Profile::MAIN3D }307 #endif308 279 #endif 309 280 … … 332 303 #if NH_MV 333 304 {"multiview-main" , MULTIVIEWMAIN }, 334 #if NH_3D335 {"3d-main" , MAIN3D },336 #endif337 305 #endif 338 306 {"monochrome", MONOCHROME_8 }, … … 774 742 string cfg_levels; 775 743 string cfg_tiers; 776 #if NH_3D777 cfg_dimensionLength.push_back( 2 ); // depth778 cfg_dimensionLength.push_back( 32 ); // texture779 #else780 744 cfg_dimensionLength.push_back( 64 ); 781 #endif782 745 #endif 783 746 string cfg_dQPFile; … … 848 811 #if NH_MV 849 812 ("NumberOfLayers", m_numberOfLayers , 1, "Number of layers") 850 #if !NH_3D851 813 ("ScalabilityMask", m_scalabilityMask , 2 , "Scalability Mask: 2: Multiview, 8: Auxiliary, 10: Multiview + Auxiliary") 852 #else853 ("ScalabilityMask", m_scalabilityMask , 3 , "Scalability Mask, 1: Texture 3: Texture + Depth ")854 #endif855 814 ("DimensionIdLen", m_dimensionIdLen , cfg_dimensionLength , "Number of bits used to store dimensions Id") 856 815 ("ViewOrderIndex", m_viewOrderIndex , std::vector<Int>(1,0), "View Order Index per layer") 857 816 ("ViewId", m_viewId , std::vector<Int>(1,0), "View Id per View Order Index") 858 817 ("AuxId", m_auxId , std::vector<Int>(1,0), "AuxId per layer") 859 #if NH_3D860 ("DepthFlag", m_depthFlag , std::vector<Int>(1,0), "Depth Flag")861 #endif862 818 ("TargetEncLayerIdList", m_targetEncLayerIdList, std::vector<Int>(0,0), "LayerIds in Nuh to be encoded") 863 819 ("LayerIdInNuh", m_layerIdInNuh , std::vector<Int>(1,0), "LayerId in Nuh") … … 1125 1081 ( "RCForceIntraQP", m_RCForceIntraQP, false, "Rate control: force intra QP to be equal to initial QP" ) 1126 1082 1127 #if KWU_RC_VIEWRC_E02271128 ("ViewWiseTargetBits, -vtbr" , m_viewTargetBits, std::vector<Int>(1, 32), "View-wise target bit-rate setting")1129 ("TargetBitAssign, -ta", m_viewWiseRateCtrl, false, "View-wise rate control on/off")1130 #endif1131 #if KWU_RC_MADPRED_E02271132 ("DepthMADPred, -dm", m_depthMADPred, (UInt)0, "Depth based MAD prediction on/off")1133 #endif1134 1083 #if NH_MV 1135 1084 // A lot of this stuff could should actually be derived by the encoder. … … 1315 1264 ("OutputVpsInfo", m_outputVpsInfo, false ,"Output information about the layer dependencies and layer sets") 1316 1265 #endif 1317 #if NH_3D1318 /* Camera parameters */1319 ("Depth420OutputFlag", m_depth420OutputFlag, true , "Output depth layers in 4:2:0 ")1320 ("CameraParameterFile,cpf", m_pchCameraParameterFile, (Char *) 0, "Camera Parameter File Name")1321 ("BaseViewCameraNumbers", m_pchBaseViewCameraNumbers, (Char *) 0, "Numbers of base views")1322 ("CodedCamParsPrecision", m_iCodedCamParPrecision, STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )1323 1324 #if NH_3D_VSO1325 /* View Synthesis Optimization */1326 ("VSOConfig", m_pchVSOConfig , (Char *) 0 ,"VSO configuration")1327 ("VSO", m_bUseVSO , false ,"Use VSO" )1328 ("VSOMode", m_uiVSOMode , (UInt) 4 ,"VSO Mode")1329 ("LambdaScaleVSO", m_dLambdaScaleVSO , (Double) 1 ,"Lambda Scaling for VSO")1330 ("VSOLSTable", m_bVSOLSTable , true ,"Depth QP dependent video/depth rate allocation by Lagrange multiplier" )1331 ("ForceLambdaScaleVSO", m_bForceLambdaScaleVSO , false ,"Force using Lambda Scale VSO also in non-VSO-Mode")1332 ("AllowNegDist", m_bAllowNegDist , true ,"Allow negative Distortion in VSO")1333 1334 ("UseEstimatedVSD", m_bUseEstimatedVSD , true ,"Model based VSD estimation instead of rendering based for some encoder decisions" )1335 ("VSOEarlySkip", m_bVSOEarlySkip , true ,"Early skip of VSO computation if synthesis error assumed to be zero" )1336 1337 ("WVSO", m_bUseWVSO , true ,"Use depth fidelity term for VSO" )1338 ("VSOWeight", m_iVSOWeight , 10 ,"Synthesized View Distortion Change weight" )1339 ("VSDWeight", m_iVSDWeight , 1 ,"View Synthesis Distortion estimate weight" )1340 ("DWeight", m_iDWeight , 1 ,"Depth Distortion weight" )1341 #endif //HHI_VSO1342 /* 3D- HEVC Tools */1343 ("QTL" , m_bUseQTL , true , "Use depth quad tree limitation (encoder only)" )1344 ("IvMvPredFlag" , m_ivMvPredFlag , BoolAry1d(2,true) , "Inter-view motion prediction" )1345 ("IvMvScalingFlag" , m_ivMvScalingFlag , BoolAry1d(2,true) , "Inter-view motion vector scaling" )1346 ("Log2SubPbSizeMinus3" , m_log2SubPbSizeMinus3 , 0 , "Log2 minus 3 of sub Pb size" )1347 ("IvResPredFlag" , m_ivResPredFlag , true , "Inter-view residual prediction" )1348 ("DepthRefinementFlag" , m_depthRefinementFlag , true , "Depth to refine disparity" )1349 ("ViewSynthesisPredFlag" , m_viewSynthesisPredFlag , true , "View synthesis prediction" )1350 ("DepthBasedBlkPartFlag" , m_depthBasedBlkPartFlag , true , "Depth base block partitioning" )1351 ("MpiFlag" , m_mpiFlag , true , "Motion inheritance from texture to depth" )1352 ("Log2MpiSubPbSizeMinus3", m_log2MpiSubPbSizeMinus3 , 0 , "Log2 minus 3 of sub Pb size for MPI" )1353 ("IntraContourFlag" , m_intraContourFlag , true , "Intra contour mode" )1354 ("IntraWedgeFlag" , m_intraWedgeFlag , true , "Intra wedge mode and segmental depth DCs" )1355 ("IntraSdcFlag" , m_intraSdcFlag , true , "Intra depth DCs" )1356 ("QtPredFlag" , m_qtPredFlag , true , "Quad tree prediction from texture to depth")1357 ("InterSdcFlag" , m_interSdcFlag , true , "Inter depth DCs" )1358 ("DepthIntraSkip" , m_depthIntraSkipFlag , true , "Depth intra skip mode" )1359 ("DLT" , m_useDLT , true , "Depth lookup table" )1360 ("IlluCompEnable" , m_abUseIC , true , "Enable illumination compensation" )1361 ("IlluCompLowLatencyEnc" , m_bUseLowLatencyICEnc , false , "Enable low-latency illumination compensation encoding")1362 #endif //NH_3D1363 1266 1364 1267 ; … … 1555 1458 if( cfg_profiles.empty() ) 1556 1459 { 1557 #if NH_3D1558 cfg_profiles = string("main main 3d-main");1559 #else1560 1460 cfg_profiles = string("main main multiview-main"); 1561 #endif1562 1461 fprintf(stderr, "\nWarning: No profiles given, using defaults: %s", cfg_profiles.c_str() ); 1563 1462 anyEmpty = true; … … 1798 1697 xResizeVector( m_auxId ); 1799 1698 1800 #if NH_3D1801 xResizeVector( m_depthFlag );1802 #endif1803 1699 xResizeVector( m_fQP ); 1804 1700 … … 2004 1900 } 2005 1901 2006 #if NH_3D2007 #if NH_3D_VSO2008 // Table base optimization2009 // Q&D2010 Double adLambdaScaleTable[] =2011 { 0.031250, 0.031639, 0.032029, 0.032418, 0.032808, 0.033197, 0.033586, 0.033976, 0.034365, 0.034755,2012 0.035144, 0.035533, 0.035923, 0.036312, 0.036702, 0.037091, 0.037480, 0.037870, 0.038259, 0.038648,2013 0.039038, 0.039427, 0.039817, 0.040206, 0.040595, 0.040985, 0.041374, 0.041764, 0.042153, 0.042542,2014 0.042932, 0.043321, 0.043711, 0.044100, 0.044194, 0.053033, 0.061872, 0.070711, 0.079550, 0.088388,2015 0.117851, 0.147314, 0.176777, 0.235702, 0.294628, 0.353553, 0.471405, 0.589256, 0.707107, 0.707100,2016 0.753550, 0.8000002017 };2018 if ( m_bUseVSO && m_bVSOLSTable )2019 {2020 Int firstDepthLayer = -1;2021 for (Int layer = 0; layer < m_numberOfLayers; layer++ )2022 {2023 if ( m_depthFlag[ layer ])2024 {2025 firstDepthLayer = layer;2026 break;2027 }2028 }2029 AOT( firstDepthLayer == -1 );2030 AOT( (m_iQP[firstDepthLayer] < 0) || (m_iQP[firstDepthLayer] > 51));2031 m_dLambdaScaleVSO *= adLambdaScaleTable[m_iQP[firstDepthLayer]];2032 }2033 if ( m_bUseVSO && m_uiVSOMode == 4)2034 {2035 m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig );2036 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),2037 m_internalBitDepth[ CHANNEL_TYPE_LUMA],2038 (UInt)m_iCodedCamParPrecision,2039 m_FrameSkip,2040 (UInt)m_framesToBeEncoded,2041 m_pchCameraParameterFile,2042 m_pchBaseViewCameraNumbers,2043 NULL,2044 m_cRenModStrParser.getSynthViews(),2045 LOG2_DISP_PREC_LUT );2046 }2047 else if ( m_bUseVSO && m_uiVSOMode != 4 )2048 {2049 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),2050 m_internalBitDepth[ CHANNEL_TYPE_LUMA],2051 (UInt)m_iCodedCamParPrecision,2052 m_FrameSkip,2053 (UInt)m_framesToBeEncoded,2054 m_pchCameraParameterFile,2055 m_pchBaseViewCameraNumbers,2056 m_pchVSOConfig,2057 NULL,2058 LOG2_DISP_PREC_LUT );2059 }2060 else2061 {2062 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),2063 m_internalBitDepth[ CHANNEL_TYPE_LUMA],2064 (UInt) m_iCodedCamParPrecision,2065 m_FrameSkip,2066 (UInt) m_framesToBeEncoded,2067 m_pchCameraParameterFile,2068 m_pchBaseViewCameraNumbers,2069 NULL,2070 NULL,2071 LOG2_DISP_PREC_LUT );2072 }2073 #else2074 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),2075 m_internalBitDepth[ CHANNEL_TYPE_LUMA],2076 (UInt) m_iCodedCamParPrecision,2077 m_FrameSkip,2078 (UInt) m_framesToBeEncoded,2079 m_pchCameraParameterFile,2080 m_pchBaseViewCameraNumbers,2081 NULL,2082 NULL,2083 LOG2_DISP_PREC_LUT );2084 #endif2085 m_cCameraData.check( false, true );2086 #endif2087 1902 2088 1903 // check validity of input parameters … … 2262 2077 xConfirmPara( (m_layerIdInNuh.size()!=1) && (m_layerIdInNuh.size() < m_numberOfLayers) , "LayerIdInNuh must be given for all layers. "); 2263 2078 2264 #if NH_3D2265 xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 3, "Scalability Mask must be equal to 2 or 3. ");2266 #else2267 2079 xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 8 && m_scalabilityMask != 10, "Scalability Mask must be equal to 2, 8 or 10"); 2268 #endif 2269 2270 #if NH_3D 2271 if ( m_scalabilityMask & ( 1 << DEPTH_ID ) ) 2272 { 2273 m_dimIds.push_back( m_depthFlag ); 2274 } 2275 #endif 2080 2276 2081 2277 2082 m_dimIds.push_back( m_viewOrderIndex ); … … 2340 2145 xConfirmPara( allEqual , "Each layer shall have a different position in scalability space." ); 2341 2146 2342 #if !H_3D_FCO2343 2147 if ( numDiff == 1 ) 2344 2148 { … … 2351 2155 xConfirmPara( shallBeButIsNotIncreasing, "DimensionIds shall be increasing within one dimension. " ); 2352 2156 } 2353 #endif2354 2157 } 2355 2158 } … … 2558 2361 xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater."); 2559 2362 xConfirmPara( m_maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller."); 2560 #if NH_3D2561 xConfirmPara( m_log2SubPbSizeMinus3 < 0, "Log2SubPbSizeMinus3 must be equal to 0 or greater.");2562 xConfirmPara( m_log2SubPbSizeMinus3 > 3, "Log2SubPbSizeMinus3 must be equal to 3 or smaller.");2563 xConfirmPara( (1<< ( m_log2SubPbSizeMinus3 + 3) ) > m_uiMaxCUWidth, "Log2SubPbSizeMinus3 must be equal to log2(maxCUSize)-3 or smaller.");2564 2565 xConfirmPara( m_log2MpiSubPbSizeMinus3 < 0, "Log2MpiSubPbSizeMinus3 must be equal to 0 or greater.");2566 xConfirmPara( m_log2MpiSubPbSizeMinus3 > 3, "Log2MpiSubPbSizeMinus3 must be equal to 3 or smaller.");2567 xConfirmPara( (1<< (m_log2MpiSubPbSizeMinus3 + 3)) > m_uiMaxCUWidth, "Log2MpiSubPbSizeMinus3 must be equal to log2(maxCUSize)-3 or smaller.");2568 #endif2569 2363 #if ADAPTIVE_QP_SELECTION 2570 2364 #if NH_MV … … 2629 2423 } 2630 2424 2631 #if NH_3D2632 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 NH_3D_VSO2637 if( m_bUseVSO )2638 {2639 xConfirmPara( m_pchVSOConfig == 0 , "VSO Setup string must be given");2640 xConfirmPara( m_uiVSOMode > 4 , "VSO Mode must be less than 5");2641 }2642 #endif2643 #endif2644 2425 // max CU width and height should be power of 2 2645 2426 UInt ui = m_uiMaxCUWidth; … … 3386 3167 xPrintParaVector( "AuxId", m_auxId ); 3387 3168 #endif 3388 #if NH_3D3389 xPrintParaVector( "DepthLayerFlag", m_depthFlag );3390 printf("Coded Camera Param. Precision : %d\n", m_iCodedCamParPrecision);3391 #endif3392 3169 #if NH_MV 3393 3170 xPrintParaVector( "QP" , m_fQP ); … … 3556 3333 printf("ForceIntraQP : %d\n", m_RCForceIntraQP ); 3557 3334 3558 #if KWU_RC_MADPRED_E02273559 printf("Depth based MAD prediction : %d\n", m_depthMADPred);3560 #endif3561 #if KWU_RC_VIEWRC_E02273562 printf("View-wise Rate control : %d\n", m_viewWiseRateCtrl);3563 if(m_viewWiseRateCtrl)3564 {3565 3566 printf("ViewWiseTargetBits : ");3567 for (Int i = 0 ; i < m_iNumberOfViews ; i++)3568 printf("%d ", m_viewTargetBits[i]);3569 printf("\n");3570 }3571 else3572 {3573 printf("TargetBitrate : %d\n", m_RCTargetBitrate );3574 }3575 #endif3576 3335 3577 3336 } 3578 3337 3579 3338 printf("Max Num Merge Candidates : %d\n", m_maxNumMergeCand); 3580 #if NH_3D3581 printf("BaseViewCameraNumbers : %s\n", m_pchBaseViewCameraNumbers );3582 printf("Coded Camera Param. Precision : %d\n", m_iCodedCamParPrecision);3583 #if NH_3D_VSO3584 printf("Force use of Lambda Scale : %d\n", m_bForceLambdaScaleVSO );3585 3586 if ( m_bUseVSO )3587 {3588 printf("VSO Lambda Scale : %5.2f\n", m_dLambdaScaleVSO );3589 printf("VSO Mode : %d\n", m_uiVSOMode );3590 printf("VSO Config : %s\n", m_pchVSOConfig );3591 printf("VSO Negative Distortion : %d\n", m_bAllowNegDist ? 1 : 0);3592 printf("VSO LS Table : %d\n", m_bVSOLSTable ? 1 : 0);3593 printf("VSO Estimated VSD : %d\n", m_bUseEstimatedVSD ? 1 : 0);3594 printf("VSO Early Skip : %d\n", m_bVSOEarlySkip ? 1 : 0);3595 if ( m_bUseWVSO )3596 {3597 printf("Dist. Weights (VSO/VSD/SAD) : %d/%d/%d\n ", m_iVSOWeight, m_iVSDWeight, m_iDWeight );3598 }3599 }3600 #endif //HHI_VSO3601 #endif //NH_3D3602 3339 printf("\n"); 3603 3340 #if NH_MV … … 3661 3398 printf(" SignBitHidingFlag:%d ", m_signHideFlag); 3662 3399 printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 ); 3663 #if NH_3D_VSO3664 printf(" VSO:%d ", m_bUseVSO );3665 printf("WVSO:%d ", m_bUseWVSO );3666 #endif3667 #if NH_3D3668 printf( "QTL:%d " , m_bUseQTL);3669 printf( "IlluCompEnable:%d " , m_abUseIC);3670 printf( "IlluCompLowLatencyEnc:%d ", m_bUseLowLatencyICEnc);3671 printf( "DLT:%d ", m_useDLT );3672 3673 3674 printf( "IvMvPred:%d %d " , m_ivMvPredFlag[0] ? 1 : 0, m_ivMvPredFlag[1] ? 1 : 0);3675 printf( "IvMvScaling:%d %d " , m_ivMvScalingFlag[0] ? 1 : 0 , m_ivMvScalingFlag[1] ? 1 : 0);3676 3677 printf( "Log2SubPbSizeMinus3:%d " , m_log2SubPbSizeMinus3 );3678 printf( "IvResPred:%d " , m_ivResPredFlag ? 1 : 0 );3679 printf( "DepthRefinement:%d " , m_depthRefinementFlag ? 1 : 0 );3680 printf( "ViewSynthesisPred:%d " , m_viewSynthesisPredFlag ? 1 : 0 );3681 printf( "DepthBasedBlkPart:%d " , m_depthBasedBlkPartFlag ? 1 : 0 );3682 printf( "Mpi:%d " , m_mpiFlag ? 1 : 0 );3683 printf( "Log2MpiSubPbSizeMinus3:%d " , m_log2MpiSubPbSizeMinus3 );3684 printf( "IntraContour:%d " , m_intraContourFlag ? 1 : 0 );3685 printf( "IntraWedge:%d " , m_intraWedgeFlag ? 1 : 0 );3686 printf( "IntraSdc:%d " , m_intraSdcFlag ? 1 : 0 );3687 printf( "QtPred:%d " , m_qtPredFlag ? 1 : 0 );3688 printf( "InterSdc:%d " , m_interSdcFlag ? 1 : 0 );3689 printf( "DepthIntraSkip:%d " , m_depthIntraSkipFlag ? 1 : 0 );3690 #endif3691 3400 3692 3401 printf("\n\n"); -
branches/HTM-15.1-MV-draft-4/source/App/TAppEncoder/TAppEncCfg.h
r1313 r1325 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 std::vector<Int> m_viewOrderIndex; ///< view order index 81 76 std::vector<Int> m_auxId; ///< auxiliary id 82 #if NH_3D83 std::vector<Int> m_depthFlag; ///< depth flag84 #endif85 77 std::vector<Int> m_targetEncLayerIdList; ///< layer Ids in Nuh to be encoded 86 78 std::vector<Int> m_layerIdInNuh; ///< layer Id in Nuh for each layer … … 133 125 134 126 135 #if NH_3D136 Bool m_abUseIC;137 Bool m_bUseLowLatencyICEnc;138 #endif139 127 140 128 #endif … … 452 440 Bool m_RCForceIntraQP; ///< force all intra picture to use initial QP or not 453 441 454 #if KWU_RC_VIEWRC_E0227455 vector<Int> m_viewTargetBits;456 Bool m_viewWiseRateCtrl; ///< Flag for using view-wise rate control457 #endif458 #if KWU_RC_MADPRED_E0227459 UInt m_depthMADPred;460 #endif461 442 462 443 ScalingListMode m_useScalingListId; ///< using quantization matrix … … 518 499 Bool m_outputVpsInfo; 519 500 #endif 520 #if NH_3D521 // Output Format522 Bool m_depth420OutputFlag; ///< Output depth layers in 4:2:0 format523 // Camera parameters524 Char* m_pchCameraParameterFile; ///< camera parameter file525 Char* m_pchBaseViewCameraNumbers;526 TAppComCamPara m_cCameraData;527 Int m_iCodedCamParPrecision; ///< precision for coding of camera parameters528 #if NH_3D_VSO529 Char* m_pchVSOConfig;530 Bool m_bUseVSO; ///< flag for using View Synthesis Optimization531 Bool m_bVSOLSTable; ///< Depth QP dependent Lagrange parameter optimization (m23714)532 Bool m_bVSOEarlySkip; ///< Early skip of VSO computation (JCT3V-A0093 modification 4)533 534 //// Used for development by GT, might be removed later535 Double m_dLambdaScaleVSO; ///< Scaling factor for Lambda in VSO mode536 Bool m_bForceLambdaScaleVSO; ///< Use Lambda Scale for depth even if VSO is turned off537 Bool m_bAllowNegDist; ///< Allow negative distortion in VSO538 UInt m_uiVSOMode; ///< Number of VSO Mode, 1 = , 2 = simple, org vs. ren, 3 = simple, ren vs. ren, 4 = full539 540 // SAIT_VSO_EST_A0033541 Bool m_bUseEstimatedVSD; ///< Flag for using model based VSD estimation instead of VSO for some encoder decisions (JCT3V-A0033 modification 3)542 543 // LGE_WVSO_A0119544 Bool m_bUseWVSO; ///< flag for using View Synthesis Optimization545 Int m_iVSOWeight;546 Int m_iVSDWeight;547 Int m_iDWeight;548 549 // Ren Model String550 TRenModSetupStrParser m_cRenModStrParser;551 #endif552 553 Bool m_useDLT; ///< flag for using DLT554 Bool m_bUseQTL; ///< flag for using depth QuadTree Limitation555 BoolAry1d m_ivMvPredFlag;556 BoolAry1d m_ivMvScalingFlag;557 Int m_log2SubPbSizeMinus3;558 Bool m_ivResPredFlag;559 Bool m_depthRefinementFlag;560 Bool m_viewSynthesisPredFlag;561 Bool m_depthBasedBlkPartFlag;562 Bool m_mpiFlag;563 Int m_log2MpiSubPbSizeMinus3;564 Bool m_intraContourFlag;565 Bool m_intraWedgeFlag;566 Bool m_intraSdcFlag;567 Bool m_qtPredFlag;568 Bool m_interSdcFlag;569 Bool m_depthIntraSkipFlag;570 #endif571 501 // internal member functions 572 502 Void xCheckParameter (); ///< check validity of configuration values -
branches/HTM-15.1-MV-draft-4/source/App/TAppEncoder/TAppEncTop.cpp
r1321 r1325 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 m_ivPicLists.setVPS ( &vps );150 #endif151 #if NH_3D_DLT152 xDeriveDltArray ( vps, &dlt );153 #endif154 141 if ( m_targetEncLayerIdList.size() == 0 ) 155 142 { … … 182 169 } 183 170 184 #if NH_3D185 // Set 3d tool parameters186 for (Int d = 0; d < 2; d++)187 {188 m_sps3dExtension.setIvMvPredFlag ( d, m_ivMvPredFlag[d] );189 m_sps3dExtension.setIvMvScalingFlag ( d, m_ivMvScalingFlag[d] );190 if (d == 0 )191 {192 m_sps3dExtension.setLog2SubPbSizeMinus3 ( d, m_log2SubPbSizeMinus3 );193 m_sps3dExtension.setIvResPredFlag ( d, m_ivResPredFlag );194 m_sps3dExtension.setDepthRefinementFlag ( d, m_depthRefinementFlag );195 m_sps3dExtension.setViewSynthesisPredFlag ( d, m_viewSynthesisPredFlag );196 m_sps3dExtension.setDepthBasedBlkPartFlag ( d, m_depthBasedBlkPartFlag );197 }198 else199 {200 m_sps3dExtension.setMpiFlag ( d, m_mpiFlag );201 m_sps3dExtension.setLog2MpiSubPbSizeMinus3( d, m_log2MpiSubPbSizeMinus3);202 m_sps3dExtension.setIntraContourFlag ( d, m_intraContourFlag );203 m_sps3dExtension.setIntraSdcWedgeFlag ( d, m_intraSdcFlag || m_intraWedgeFlag );204 m_sps3dExtension.setQtPredFlag ( d, m_qtPredFlag );205 m_sps3dExtension.setInterSdcFlag ( d, m_interSdcFlag );206 m_sps3dExtension.setDepthIntraSkipFlag ( d, m_depthIntraSkipFlag );207 }208 }209 #endif210 171 211 172 … … 217 178 m_acTVideoIOYuvInputFileList.push_back(new TVideoIOYuv); 218 179 m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv); 219 #if NH_3D220 Int profileIdc = -1;221 for (Int olsIdx = 0; olsIdx < vps.getNumOutputLayerSets(); olsIdx++ )222 {223 Int lsIdx = vps.olsIdxToLsIdx( olsIdx );224 for(Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++ )225 {226 if( vps.getLayerIdInNuh( layerIdInVps) == vps.getLayerSetLayerIdList(lsIdx, i) )227 {228 Int ptlIdx = vps.getProfileTierLevelIdx( olsIdx, i );229 if ( ptlIdx != -1 )230 {231 Int curProfileIdc = vps.getPTL(ptlIdx)->getGeneralPTL()->getProfileIdc();232 if (profileIdc == -1)233 {234 profileIdc = curProfileIdc;235 }236 else237 {238 if ( profileIdc != curProfileIdc )239 {240 fprintf(stderr, "Error: ProfileIdc for layer with index %d in VPS not equal in all OLSs. \n", layerIdInVps );241 exit(EXIT_FAILURE);242 }243 }244 }245 }246 }247 }248 249 if (profileIdc == -1 )250 {251 fprintf(stderr, "Error: No profile given for layer with index %d in VPS not equal in all OLS. \n", layerIdInVps );252 exit(EXIT_FAILURE);253 }254 m_acTEncTopList[ layerIdInVps ]->setProfileIdc( profileIdc );255 #endif256 180 } 257 181 … … 276 200 m_cTEncTop.setViewId ( vps.getViewId ( layerId ) ); 277 201 m_cTEncTop.setViewIndex ( vps.getViewIndex ( layerId ) ); 278 #if NH_3D279 Bool isDepth = ( vps.getDepthId ( layerId ) != 0 ) ;280 m_cTEncTop.setIsDepth ( isDepth );281 //====== Camera Parameters =========282 m_cTEncTop.setCameraParameters ( &m_cCameraData );283 #if NH_3D_VSO284 //====== VSO =========285 m_cTEncTop.setRenderModelParameters ( &m_cRenModStrParser );286 m_cTEncTop.setForceLambdaScaleVSO ( isDepth ? m_bForceLambdaScaleVSO : false );287 m_cTEncTop.setLambdaScaleVSO ( isDepth ? m_dLambdaScaleVSO : 1 );288 m_cTEncTop.setVSOMode ( isDepth ? m_uiVSOMode : 0 );289 290 m_cTEncTop.setAllowNegDist ( isDepth ? m_bAllowNegDist : false );291 292 // SAIT_VSO_EST_A0033293 m_cTEncTop.setUseEstimatedVSD ( isDepth ? m_bUseEstimatedVSD : false );294 295 // LGE_WVSO_A0119296 m_cTEncTop.setUseWVSO ( isDepth ? m_bUseWVSO : false );297 m_cTEncTop.setVSOWeight ( isDepth ? m_iVSOWeight : 0 );298 m_cTEncTop.setVSDWeight ( isDepth ? m_iVSDWeight : 0 );299 m_cTEncTop.setDWeight ( isDepth ? m_iDWeight : 0 );300 #endif // H_3D_VSO301 #if NH_3D_IC302 m_cTEncTop.setUseIC ( vps.getViewIndex( layerId ) == 0 || isDepth ? false : m_abUseIC );303 m_cTEncTop.setUseICLowLatencyEnc ( m_bUseLowLatencyICEnc );304 #endif305 306 307 m_cTEncTop.setUseDMM ( isDepth ? m_intraWedgeFlag : false );308 m_cTEncTop.setUseSDC ( isDepth ? m_intraSdcFlag : false );309 m_cTEncTop.setUseDLT ( isDepth ? m_useDLT : false );310 m_cTEncTop.setUseQTL ( isDepth ? m_bUseQTL : false );311 m_cTEncTop.setSps3dExtension ( m_sps3dExtension );312 #endif // NH_3D313 202 314 203 m_cTEncTop.setIvPicLists ( &m_ivPicLists ); … … 316 205 m_cTEncTop.setVPS(&vps); 317 206 318 #if NH_3D_DLT319 m_cTEncTop.setDLT(dlt);320 #endif321 207 322 208 #if NH_MV … … 425 311 m_cTEncTop.setChromaCrQpOffset ( m_crQpOffset ); 426 312 427 #if NH_3D428 m_cTEncTop.setChromaFormatIdc ( isDepth ? CHROMA_400 : m_chromaFormatIDC );429 #else430 313 m_cTEncTop.setChromaFormatIdc ( m_chromaFormatIDC ); 431 #endif432 314 433 315 #if ADAPTIVE_QP_SELECTION … … 643 525 m_cTEncTop.setScalingListFile ( m_scalingListFile ); 644 526 m_cTEncTop.setSignHideFlag ( m_signHideFlag); 645 #if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227646 if(!m_cTEncTop.getIsDepth()) //only for texture647 {648 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl );649 }650 else651 {652 m_cTEncTop.setUseRateCtrl ( 0 );653 }654 #else655 527 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl ); 656 #endif657 #if !KWU_RC_VIEWRC_E0227658 528 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate ); 659 #endif660 529 m_cTEncTop.setKeepHierBit ( m_RCKeepHierarchicalBit ); 661 530 m_cTEncTop.setLCULevelRC ( m_RCLCULevelRC ); … … 663 532 m_cTEncTop.setInitialQP ( m_RCInitialQP ); 664 533 m_cTEncTop.setForceIntraQP ( m_RCForceIntraQP ); 665 #if KWU_RC_MADPRED_E0227666 if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())667 {668 m_cTEncTop.setUseDepthMADPred(layerIdInVps ? m_depthMADPred : 0);669 if(m_cTEncTop.getUseDepthMADPred())670 {671 m_cTEncTop.setCamParam(&m_cCameraData);672 }673 }674 #endif675 #if KWU_RC_VIEWRC_E0227676 if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())677 {678 m_cTEncTop.setUseViewWiseRateCtrl(m_viewWiseRateCtrl);679 if(m_iNumberOfViews == 1)680 {681 if(m_viewWiseRateCtrl)682 {683 m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);684 }685 else686 {687 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate );688 }689 }690 else691 {692 if(m_viewWiseRateCtrl)693 {694 m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);695 }696 else697 {698 if(m_iNumberOfViews == 2)699 {700 if(m_cTEncTop.getViewId() == 0)701 {702 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*80)/100 );703 }704 else if(m_cTEncTop.getViewId() == 1)705 {706 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*20)/100 );707 }708 }709 else if(m_iNumberOfViews == 3)710 {711 if(m_cTEncTop.getViewId() == 0)712 {713 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*66)/100 );714 }715 else if(m_cTEncTop.getViewId() == 1)716 {717 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*17)/100 );718 }719 else if(m_cTEncTop.getViewId() == 2)720 {721 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*17)/100 );722 }723 }724 else725 {726 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate );727 }728 }729 }730 }731 #endif732 534 m_cTEncTop.setTransquantBypassEnableFlag ( m_TransquantBypassEnableFlag ); 733 535 m_cTEncTop.setCUTransquantBypassFlagForceValue ( m_CUTransquantBypassFlagForce ); … … 776 578 } 777 579 #endif 778 #if NH_3D_VSO779 if ( m_bUseVSO )780 {781 if ( m_uiVSOMode == 4 )782 {783 #if H_3D_VSO_EARLY_SKIP784 m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip );785 #else786 m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 );787 #endif788 for ( Int layer = 0; layer < m_numberOfLayers ; layer++ )789 {790 TEncTop* pcEncTop = m_acTEncTopList[ layer ];791 Int iViewNum = pcEncTop->getViewIndex();792 Int iContent = pcEncTop->getIsDepth() ? 1 : 0;793 Int iNumOfModels = m_cRenModStrParser.getNumOfModelsForView(iViewNum, iContent);794 795 Bool bUseVSO = (iNumOfModels != 0);796 797 pcEncTop->setUseVSO( bUseVSO );798 pcEncTop->getRdCost()->setRenModel( bUseVSO ? &m_cRendererModel : NULL );799 800 for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ )801 {802 Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode;803 804 m_cRenModStrParser.getSingleModelData ( iViewNum, iContent, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ;805 m_cRendererModel .createSingleModel ( iViewNum, iContent, iModelNum, iLeftViewNum, iRightViewNum, (iOrgRefNum != -1), iBlendMode );806 }807 }808 }809 else810 {811 AOT(true);812 }813 }814 #endif815 580 } 816 581 … … 820 585 // initialize global variables 821 586 initROM(); 822 #if NH_3D_DMM823 initWedgeLists( true );824 #endif825 587 826 588 for( Int layer=0; layer < m_numberOfLayers; layer++) … … 886 648 for(Int layer=0; layer<m_numberOfLayers; layer++) 887 649 { 888 #if KWU_RC_MADPRED_E0227889 m_acTEncTopList[layer]->init( isFieldCoding, this );890 #else891 650 m_acTEncTopList[layer]->init( isFieldCoding ); 892 #endif893 651 } 894 652 #else … … 918 676 } 919 677 920 #if !NH_3D921 678 TComPicYuv* pcPicYuvOrg = new TComPicYuv; 922 #endif923 679 TComPicYuv* pcPicYuvRec = NULL; 924 680 … … 954 710 list<AccessUnit> outputAccessUnits; ///< list of access units to write out. is populated by the encoding process 955 711 956 #if NH_3D957 TComPicYuv* picYuvOrg[2];958 TComPicYuv picYuvTrueOrg[2];959 for (Int d = 0; d < 2 ; d++)960 {961 picYuvOrg[d] = new TComPicYuv;962 picYuvOrg[d] ->create( m_iSourceWidth, m_isField ? m_iSourceHeightOrg : m_iSourceHeight, ( d > 0 ) ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );963 picYuvTrueOrg[d].create( m_iSourceWidth, m_isField ? m_iSourceHeightOrg : m_iSourceHeight, ( d > 0 ) ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );964 }965 #else966 712 TComPicYuv cPicYuvTrueOrg; 967 713 … … 977 723 cPicYuvTrueOrg.create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true ); 978 724 } 979 #endif980 725 #if NH_MV 981 726 while ( (m_targetEncLayerIdList.size() != 0 ) && !allEos ) … … 983 728 for(Int layer=0; layer < m_numberOfLayers; layer++ ) 984 729 { 985 #if NH_3D986 TComPicYuv* pcPicYuvOrg = picYuvOrg [ m_depthFlag[layer] ];987 TComPicYuv& cPicYuvTrueOrg = picYuvTrueOrg[ m_depthFlag[layer] ];988 #endif989 730 if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) )) 990 731 { … … 1022 763 for ( Int gopId=0; gopId < gopSize; gopId++ ) 1023 764 { 1024 #if NH_3D1025 UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId );1026 if ( iNextPoc < m_framesToBeEncoded )1027 {1028 m_cCameraData.update( iNextPoc );1029 }1030 #endif1031 765 for(Int layer=0; layer < m_numberOfLayers; layer++ ) 1032 766 { 1033 #if NH_3D1034 TComPicYuv* pcPicYuvOrg = picYuvOrg [ m_depthFlag[layer] ];1035 TComPicYuv& cPicYuvTrueOrg = picYuvTrueOrg[ m_depthFlag[layer] ];1036 #endif1037 767 if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) )) 1038 768 { … … 1040 770 } 1041 771 1042 #if NH_3D_VSO1043 if( m_bUseVSO && m_bUseEstimatedVSD && iNextPoc < m_framesToBeEncoded )1044 {1045 m_cCameraData.setDispCoeff( iNextPoc, m_acTEncTopList[layer]->getViewIndex() );1046 m_acTEncTopList[layer] ->setDispCoeff( m_cCameraData.getDispCoeff() );1047 }1048 #endif1049 772 1050 773 Int iNumEncoded = 0; … … 1113 836 #endif 1114 837 1115 #if NH_3D1116 // delete original YUV buffer1117 for (Int d = 0; d < 2; d++)1118 {1119 picYuvOrg[d]->destroy();1120 delete picYuvOrg[d];1121 picYuvOrg[d] = NULL;1122 1123 picYuvTrueOrg[d].destroy();1124 }1125 #else1126 838 // delete original YUV buffer 1127 839 pcPicYuvOrg->destroy(); 1128 840 delete pcPicYuvOrg; 1129 841 pcPicYuvOrg = NULL; 1130 #endif1131 842 1132 843 #if !NH_MV … … 1134 845 m_cTEncTop.deletePicBuffer(); 1135 846 #endif 1136 #if !NH_3D1137 847 cPicYuvTrueOrg.destroy(); 1138 #endif1139 848 1140 849 // delete buffers & classes … … 1144 853 printRateSummary(); 1145 854 1146 #if H_3D_REN_MAX_DEV_OUT1147 Double dMaxDispDiff = m_cCameraData.getMaxShiftDeviation();1148 1149 if ( !(dMaxDispDiff < 0) )1150 {1151 printf("\n Max. possible shift error: %12.3f samples.\n", dMaxDispDiff );1152 }1153 #endif1154 855 1155 856 return; … … 1188 889 { 1189 890 rpcPicYuvRec = new TComPicYuv; 1190 #if NH_3D1191 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_depthFlag[layer] > 0 ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );1192 #else1193 891 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true ); 1194 #endif1195 892 1196 893 } … … 1270 967 if (m_pchReconFileList[layerIdx]) 1271 968 { 1272 #if NH_3D1273 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 );1274 #else1275 969 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_isTopFieldFirst ); 1276 #endif1277 970 } 1278 971 } … … 1327 1020 if (m_pchReconFileList[layerIdx]) 1328 1021 { 1329 #if NH_3D1330 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_depth420OutputFlag && m_depthFlag[layerIdx ] ? CHROMA_420 : NUM_CHROMA_FORMAT );1331 #else1332 1022 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom ); 1333 #endif1334 1023 1335 1024 } … … 1456 1145 } 1457 1146 1458 #if NH_3D_DLT1459 Void TAppEncTop::xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt)1460 {1461 TComPicYuv* pcDepthPicYuvOrg = new TComPicYuv;1462 TComPicYuv* pcDepthPicYuvTrueOrg = new TComPicYuv;1463 // allocate original YUV buffer1464 pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, false );1465 pcDepthPicYuvTrueOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, false );1466 1467 TVideoIOYuv* depthVideoFile = new TVideoIOYuv;1468 1469 UInt uiMaxDepthValue = ((1 << m_inputBitDepth[CHANNEL_TYPE_LUMA])-1);1470 1471 std::vector<Bool> abValidDepths(256, false);1472 1473 depthVideoFile->open( m_pchInputFileList[layer], false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );1474 1475 Int iHeight = pcDepthPicYuvOrg->getHeight(COMPONENT_Y);1476 Int iWidth = pcDepthPicYuvOrg->getWidth(COMPONENT_Y);1477 Int iStride = pcDepthPicYuvOrg->getStride(COMPONENT_Y);1478 1479 Pel* pInDM = pcDepthPicYuvOrg->getAddr(COMPONENT_Y);1480 1481 for(Int uiFrame=0; uiFrame < uiNumFrames; uiFrame++ )1482 {1483 depthVideoFile->read( pcDepthPicYuvOrg, pcDepthPicYuvTrueOrg, IPCOLOURSPACE_UNCHANGED, m_aiPad, m_InputChromaFormatIDC, m_bClipInputVideoToRec709Range );1484 1485 // check all pixel values1486 for (Int i=0; i<iHeight; i++)1487 {1488 Int rowOffset = i*iStride;1489 1490 for (Int j=0; j<iWidth; j++)1491 {1492 Pel depthValue = pInDM[rowOffset+j];1493 abValidDepths[depthValue] = true;1494 }1495 }1496 }1497 1498 depthVideoFile->close();1499 delete depthVideoFile;1500 1501 pcDepthPicYuvOrg->destroy();1502 delete pcDepthPicYuvOrg;1503 pcDepthPicYuvTrueOrg->destroy();1504 delete pcDepthPicYuvTrueOrg;1505 1506 // convert boolean array to idx2Depth LUT1507 std::vector<Int> aiIdx2DepthValue(256, 0);1508 Int iNumDepthValues = 0;1509 for(Int p=0; p<=uiMaxDepthValue; p++)1510 {1511 if( abValidDepths[p] == true)1512 {1513 aiIdx2DepthValue[iNumDepthValues++] = p;1514 }1515 }1516 1517 if( uiNumFrames == 0 || gCeilLog2(iNumDepthValues) == m_inputBitDepth[CHANNEL_TYPE_LUMA] )1518 {1519 dlt->setUseDLTFlag(layer, false);1520 }1521 1522 // assign LUT1523 if( dlt->getUseDLTFlag(layer) )1524 {1525 dlt->setDepthLUTs(layer, aiIdx2DepthValue, iNumDepthValues);1526 }1527 }1528 #endif1529 1147 1530 1148 #if NH_MV … … 1556 1174 1557 1175 1558 #if NH_3D1559 vps.initViewCompLayer( );1560 #endif1561 1176 } 1562 1177 … … 1635 1250 Int curLayerIdInNuh = vps.getLayerIdInNuh( curLayerIdInVps ); 1636 1251 Int maxTid = -1; 1637 #if NH_3D1638 if ( vps.getDirectDependencyFlag( curLayerIdInVps, refLayerIdInVps ) )1639 {1640 if ( m_depthFlag[ curLayerIdInVps] == m_depthFlag[ refLayerIdInVps ] )1641 {1642 #endif1643 1252 for( Int i = 0; i < ( getGOPSize() + 1); i++ ) 1644 1253 { … … 1647 1256 for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++) 1648 1257 { 1649 #if NH_3D1650 if ( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[ j ] ) == refLayerIdInNuh )1651 #else1652 1258 if ( vps.getIdDirectRefLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[ j ] ) == refLayerIdInNuh ) 1653 #endif1654 1259 { 1655 1260 Bool refLayerZero = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 ); … … 1658 1263 } 1659 1264 } 1660 #if NH_3D1661 }1662 else1663 {1664 if( m_depthFlag[ curLayerIdInVps ] && ( m_mpiFlag|| m_qtPredFlag || m_intraContourFlag ) )1665 {1666 Int nuhLayerIdTex = vps.getLayerIdInNuh( vps.getViewIndex( curLayerIdInNuh ), false );1667 if ( nuhLayerIdTex == refLayerIdInNuh )1668 {1669 for( Int i = 0; i < ( getGOPSize() + 1); i++ )1670 {1671 GOPEntry geCur = m_GOPListMvc[curLayerIdInVps][( i < getGOPSize() ? i : MAX_GOP )];1672 GOPEntry geRef = m_GOPListMvc[refLayerIdInVps][( i < getGOPSize() ? i : MAX_GOP )];1673 if ( geCur.m_interCompPredFlag )1674 {1675 Bool refLayerZero = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );1676 maxTid = std::max( maxTid, refLayerZero ? 0 : geRef.m_temporalId );1677 }1678 }1679 }1680 }1681 if( !m_depthFlag[ curLayerIdInVps ] && vps.getNumRefListLayers( curLayerIdInNuh) > 0 && ( m_depthRefinementFlag || m_viewSynthesisPredFlag || m_depthBasedBlkPartFlag ) )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 1688 if ( geCur.m_interCompPredFlag )1689 {1690 for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++ )1691 {1692 Int nuhLayerIdDep = vps.getLayerIdInNuh( vps.getViewIndex( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[j] ) ), true );1693 if ( nuhLayerIdDep == refLayerIdInNuh )1694 {1695 Bool refLayerZero = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );1696 maxTid = std::max( maxTid, refLayerZero ? 0 : geRef.m_temporalId );1697 }1698 }1699 }1700 }1701 }1702 }1703 } // if ( vps.getDirectDependencyFlag( curLayerIdInVps, refLayerIdInVps ) )1704 vps.setMaxTidIlRefPicsPlus1( refLayerIdInVps, curLayerIdInVps, maxTid + 1 );1705 #endif1706 1265 } // Loop curLayerIdInVps 1707 1266 } // Loop refLayerIdInVps … … 1752 1311 1753 1312 // check if all reference layers when allRefLayerActiveFlag is equal to 1 are reference layer pictures specified in the gop entry 1754 #if NH_3D1755 for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ) && allRefLayersActiveFlag; k++ )1756 {1757 Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdRefListLayer( layerIdInNuh , k ) );1758 #else1759 1313 for (Int k = 0; k < vps.getNumDirectRefLayers( layerIdInNuh ) && allRefLayersActiveFlag; k++ ) 1760 1314 { 1761 1315 Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdDirectRefLayer( layerIdInNuh , k ) ); 1762 #endif1763 1316 if ( vps.getSubLayersVpsMaxMinus1(refLayerIdInVps) >= tId && ( tId == 0 || vps.getMaxTidIlRefPicsPlus1(refLayerIdInVps,layerIdInVps) > tId ) ) 1764 1317 { … … 1778 1331 { 1779 1332 Bool referenceLayerFoundFlag = false; 1780 #if NH_3D1781 for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ); k++ )1782 {1783 Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdRefListLayer( layerIdInNuh, k) );1784 #else1785 1333 for (Int k = 0; k < vps.getNumDirectRefLayers( layerIdInNuh ); k++ ) 1786 1334 { 1787 1335 Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdDirectRefLayer( layerIdInNuh, k) ); 1788 #endif1789 1336 if ( vps.getSubLayersVpsMaxMinus1(refLayerIdInVps) >= tId && ( tId == 0 || vps.getMaxTidIlRefPicsPlus1(refLayerIdInVps,layerIdInVps) > tId ) ) 1790 1337 { … … 1915 1462 break; 1916 1463 case Profile::MULTIVIEWMAIN: 1917 #if NH_3D1918 case Profile::MAIN3D:1919 #endif1920 1464 ptl->setMax12bitConstraintFlag ( true ); 1921 1465 ptl->setMax12bitConstraintFlag ( true ); … … 1939 1483 1940 1484 Bool anyDepth = false; 1941 #if NH_3D1942 for ( Int i = 0; i < m_numberOfLayers; i++ )1943 {1944 vps.setVpsRepFormatIdx( i, m_depthFlag[ i ] ? 1 : 0 );1945 anyDepth = anyDepth || m_depthFlag[ i ];1946 }1947 #endif1948 1485 1949 1486 vps.setRepFormatIdxPresentFlag( anyDepth ); … … 2350 1887 } 2351 1888 2352 #if NH_3D2353 Void TAppEncTop::xSetCamPara ( TComVPS& vps )2354 {2355 vps.setCpPrecision( m_cCameraData.getCamParsCodedPrecision());2356 2357 for ( Int n = 1; n < vps.getNumViews(); n++ )2358 {2359 Int i = vps.getViewOIdxList( n );2360 Int iInVps = vps.getVoiInVps ( i );2361 vps.setNumCp( iInVps, n);2362 2363 if ( vps.getNumCp( iInVps ) > 0 )2364 {2365 vps.setCpInSliceSegmentHeaderFlag( iInVps, m_cCameraData.getVaryingCameraParameters() );2366 2367 for( Int m = 0; m < vps.getNumCp( iInVps ); m++ )2368 {2369 vps.setCpRefVoi( iInVps, m, vps.getViewOIdxList( m ) );2370 if( !vps.getCpInSliceSegmentHeaderFlag( iInVps ) )2371 {2372 Int j = vps.getCpRefVoi( iInVps, m );2373 Int jInVps = vps.getVoiInVps( j );2374 2375 vps.setVpsCpScale ( iInVps, jInVps, m_cCameraData.getCodedScale() [ jInVps ][ iInVps ] ) ;2376 vps.setVpsCpInvScale( iInVps, jInVps, m_cCameraData.getCodedScale() [ iInVps ][ jInVps ] ) ;2377 vps.setVpsCpOff ( iInVps, jInVps, m_cCameraData.getCodedOffset()[ jInVps ][ iInVps ] ) ;2378 vps.setVpsCpInvOff ( iInVps, jInVps, m_cCameraData.getCodedOffset()[ iInVps ][ jInVps ] ) ;2379 }2380 }2381 }2382 }2383 vps.deriveCpPresentFlag();2384 }2385 #endif2386 1889 2387 1890 … … 2395 1898 2396 1899 2397 #if NH_3D_DLT2398 Void TAppEncTop::xDeriveDltArray( TComVPS& vps, TComDLT* dlt )2399 {2400 Int iNumDepthViews = 0;2401 Bool bDltPresentFlag = false;2402 2403 for ( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ )2404 {2405 Bool isDepth = ( vps.getDepthId( layer ) == 1 );2406 2407 if ( isDepth )2408 {2409 iNumDepthViews++;2410 }2411 2412 dlt->setUseDLTFlag( layer , isDepth && m_useDLT );2413 if( dlt->getUseDLTFlag( layer ) )2414 {2415 xAnalyzeInputBaseDepth(layer, max(m_iIntraPeriod[layer], 24), &vps, dlt);2416 bDltPresentFlag = bDltPresentFlag || dlt->getUseDLTFlag(layer);2417 dlt->setInterViewDltPredEnableFlag(layer, (dlt->getUseDLTFlag(layer) && (layer>1)));2418 2419 // ----------------------------- determine whether to use bit-map -----------------------------2420 Bool bDltBitMapRepFlag = false;2421 UInt uiNumBitsNonBitMap = 0;2422 UInt uiNumBitsBitMap = 0;2423 2424 UInt uiMaxDiff = 0;2425 UInt uiMinDiff = MAX_INT;2426 UInt uiLengthMinDiff = 0;2427 UInt uiLengthDltDiffMinusMin = 0;2428 2429 std::vector<Int> aiIdx2DepthValue_coded(256, 0);2430 UInt uiNumDepthValues_coded = 0;2431 2432 uiNumDepthValues_coded = dlt->getNumDepthValues(layer);2433 for( UInt ui = 0; ui<uiNumDepthValues_coded; ui++ )2434 {2435 aiIdx2DepthValue_coded[ui] = dlt->idx2DepthValue(layer, ui);2436 }2437 2438 if( dlt->getInterViewDltPredEnableFlag( layer ) )2439 {2440 AOF( vps.getDepthId( 1 ) == 1 );2441 AOF( layer > 1 );2442 // assumes ref layer id to be 12443 std::vector<Int> piRefDLT = dlt->idx2DepthValue( 1 );2444 UInt uiRefNum = dlt->getNumDepthValues( 1 );2445 dlt->getDeltaDLT(layer, piRefDLT, uiRefNum, aiIdx2DepthValue_coded, uiNumDepthValues_coded);2446 }2447 2448 std::vector<UInt> puiDltDiffValues(uiNumDepthValues_coded, 0);2449 2450 for (UInt d = 1; d < uiNumDepthValues_coded; d++)2451 {2452 puiDltDiffValues[d] = aiIdx2DepthValue_coded[d] - aiIdx2DepthValue_coded[d-1];2453 2454 if ( uiMaxDiff < puiDltDiffValues[d] )2455 {2456 uiMaxDiff = puiDltDiffValues[d];2457 }2458 2459 if ( uiMinDiff > puiDltDiffValues[d] )2460 {2461 uiMinDiff = puiDltDiffValues[d];2462 }2463 }2464 2465 // counting bits2466 // diff coding branch2467 uiNumBitsNonBitMap += 8; // u(v) bits for num_depth_values_in_dlt[layerId] (i.e. num_entry[ layerId ])2468 2469 if ( uiNumDepthValues_coded > 1 )2470 {2471 uiNumBitsNonBitMap += 8; // u(v) bits for max_diff[ layerId ]2472 }2473 2474 if ( uiNumDepthValues_coded > 2 )2475 {2476 uiLengthMinDiff = (UInt) gCeilLog2(uiMaxDiff + 1);2477 uiNumBitsNonBitMap += uiLengthMinDiff; // u(v) bits for min_diff[ layerId ]2478 }2479 2480 uiNumBitsNonBitMap += 8; // u(v) bits for dlt_depth_value0[ layerId ]2481 2482 if (uiMaxDiff > uiMinDiff)2483 {2484 uiLengthDltDiffMinusMin = (UInt) gCeilLog2(uiMaxDiff - uiMinDiff + 1);2485 uiNumBitsNonBitMap += uiLengthDltDiffMinusMin * (uiNumDepthValues_coded - 1); // u(v) bits for dlt_depth_value_diff_minus_min[ layerId ][ j ]2486 }2487 2488 // bit map branch2489 uiNumBitsBitMap = 1 << m_inputBitDepth[CHANNEL_TYPE_LUMA];2490 2491 // determine bDltBitMapFlag2492 bDltBitMapRepFlag = (uiNumBitsBitMap > uiNumBitsNonBitMap) ? false : true;2493 2494 dlt->setUseBitmapRep(layer, bDltBitMapRepFlag);2495 }2496 }2497 2498 dlt->setDltPresentFlag( bDltPresentFlag );2499 dlt->setNumDepthViews ( iNumDepthViews );2500 dlt->setDepthViewBitDepth( m_inputBitDepth[CHANNEL_TYPE_LUMA] );2501 }2502 #endif2503 1900 //! \} -
branches/HTM-15.1-MV-draft-4/source/App/TAppEncoder/TAppEncTop.h
r1313 r1325 46 46 #include "TLibCommon/AccessUnit.h" 47 47 #include "TAppEncCfg.h" 48 #if NH_3D49 #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-15.1-MV-draft-4/source/App/TAppRenderer/RendererMain.cpp
r1313 r1325 35 35 #include <time.h> 36 36 #include "../../Lib/TLibCommon/CommonDef.h" 37 #if NH_3D38 #include "TAppRendererTop.h"39 // ====================================================================================================================40 // Main function41 // ====================================================================================================================42 43 int main(int argc, char* argv[])44 {45 46 TAppRendererTop cTAppRendererTop;47 48 // print information49 fprintf( stdout, "\n" );50 fprintf( stdout, "3D-HTM software: Renderer Version [%s]", NV_VERSION);51 fprintf( stdout, NVM_ONOS );52 fprintf( stdout, NVM_COMPILEDBY );53 fprintf( stdout, NVM_BITS );54 fprintf( stdout, "\n" );55 56 // create application renderer class57 cTAppRendererTop.create();58 59 // parse configuration60 if(!cTAppRendererTop.parseCfg( argc, argv ))61 {62 cTAppRendererTop.destroy();63 return 1;64 }65 66 // starting time67 double dResult;68 long lBefore = clock();69 70 // call rendering function71 cTAppRendererTop.go();72 73 // ending time74 dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC;75 printf("\n Total Time: %12.3f sec.\n", dResult);76 77 // destroy application renderer class78 cTAppRendererTop.destroy();79 80 return 0;81 }82 #else83 37 84 38 #include <iostream> … … 89 43 } 90 44 91 #endif // NH_3D92 45 -
branches/HTM-15.1-MV-draft-4/source/App/TAppRenderer/TAppRendererCfg.cpp
r1313 r1325 44 44 #include "../../Lib/TAppCommon/program_options_lite.h" 45 45 46 #if NH_3D47 48 using namespace std;49 namespace po = df::program_options_lite;50 51 // ====================================================================================================================52 // Local constants53 // ====================================================================================================================54 55 #define MAX_INPUT_VIEW_NUM 1056 #define MAX_OUTPUT_VIEW_NUM 6457 58 // ====================================================================================================================59 // Constructor / destructor / initialization / destroy60 // ====================================================================================================================61 62 63 TAppRendererCfg::TAppRendererCfg()64 {65 66 }67 68 TAppRendererCfg::~TAppRendererCfg()69 {70 for(Int i = 0; i< m_pchVideoInputFileList.size(); i++ )71 {72 if ( m_pchVideoInputFileList[i] != NULL )73 free (m_pchVideoInputFileList[i]);74 }75 76 for(Int i = 0; i< m_pchDepthInputFileList.size(); i++ )77 {78 if ( m_pchDepthInputFileList[i] != NULL )79 free (m_pchDepthInputFileList[i]);80 }81 82 for(Int i = 0; i< m_pchSynthOutputFileList.size(); i++ )83 {84 if ( m_pchSynthOutputFileList[i] != NULL )85 free (m_pchSynthOutputFileList[i]);86 }87 88 if ( m_pchVideoInputFileBaseName ) free( m_pchVideoInputFileBaseName );89 if ( m_pchDepthInputFileBaseName ) free( m_pchDepthInputFileBaseName );90 if ( m_pchSynthOutputFileBaseName ) free( m_pchSynthOutputFileBaseName);91 if ( m_pchCameraParameterFile ) free( m_pchCameraParameterFile );92 if ( m_pchBaseViewCameraNumbers ) free( m_pchBaseViewCameraNumbers );93 if ( m_pchSynthViewCameraNumbers ) free( m_pchSynthViewCameraNumbers );94 if ( m_pchViewConfig ) free( m_pchViewConfig );95 }96 97 Void TAppRendererCfg::create()98 {99 }100 101 Void TAppRendererCfg::destroy()102 {103 }104 105 // ====================================================================================================================106 // Public member functions107 // ====================================================================================================================108 109 /** \param argc number of arguments110 \param argv array of arguments111 \retval true when success112 */113 Bool TAppRendererCfg::parseCfg( Int argc, Char* argv[] )114 {115 bool do_help = false;116 117 po::Options opts;118 opts.addOptions()119 ("help", do_help, false, "this help text")120 ("c", po::parseConfigFile, "configuration file name")121 122 /* File I/O */123 ("VideoInputFileBaseName,v", m_pchVideoInputFileBaseName, (Char*) 0, "Basename to generate video input file names")124 ("DepthInputFileBaseName,d", m_pchDepthInputFileBaseName, (Char*) 0, "Basename to generate depth input file names")125 ("SynthOutputFileBaseName,s", m_pchSynthOutputFileBaseName, (Char*) 0, "Basename to generate synthesized output file names")126 ("ContOutputFileNumbering", m_bContOutputFileNumbering , false , "Continuous Output File Numbering")127 ("Sweep" , m_bSweep , false , "Store all views in first Output File")128 129 ("VideoInputFile_%d,v_%d", m_pchVideoInputFileList , (Char *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv video input file name %d")130 ("DepthInputFile_%d,d_%d", m_pchDepthInputFileList , (Char *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv depth input file name %d")131 ("SynthOutputFile_%d,s_%d", m_pchSynthOutputFileList, (Char *) 0, MAX_OUTPUT_VIEW_NUM, "Synthesized Yuv output file name %d")132 133 ("InputBitDepth", m_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, (Char *) 0, "Camera Parameter File Name")149 ("BaseViewCameraNumbers" , m_pchBaseViewCameraNumbers, (Char *) 0, "Numbers of base views")150 ("SynthViewCameraNumbers" , m_pchSynthViewCameraNumbers, (Char *) 0, "Numbers of views to synthesis")151 ("ViewConfig" , m_pchViewConfig, (Char *) 0, "View Configuration" )152 153 /* Renderer Modes */154 ("Log2SamplingFactor", m_iLog2SamplingFactor, 0, "Factor for horizontal up sampling before processing" )155 ("UVup" , m_bUVUp , true, "Up sampling of chroma planes before processing" )156 ("PreProcMode" , m_iPreProcMode , 0, "Depth preprocessing: 0 = None, 1 = Binomial filtering" )157 ("PreFilterSize" , m_iPreFilterSize , 0, "For PreProcMode 1: Half Size of filter kernel" )158 ("SimEnhance" , m_bSimEnhance , true, "Similarity enhancement of video" )159 ("BlendMode" , m_iBlendMode , 0, "Blending of left and right image: 0: average, 1: only holes from right, 2: only holes from left, 3: first view in BaseViewOrder as main view" )160 ("BlendZThresPerc" , m_iBlendZThresPerc , 30, "Z-difference threshold for blending in percent of total Z-range" )161 ("BlendUseDistWeight", m_bBlendUseDistWeight , true, "0: blend using average; 1: blend factor depends on view distance" )162 ("BlendHoleMargin" , m_iBlendHoleMargin , 6, "Margin around holes to fill with other view" )163 ("InterpolationMode" , m_iInterpolationMode , 4, "0: NN, 1:linear (int), 2:linear (double) , 3:cubic Hermite spline (double), 4: 8-tap (int)" )164 ("HoleFillingMode" , m_iHoleFillingMode , 1, "0: None, 1: line wise background extension" )165 ("PostProcMode" , m_iPostProcMode , 0, "0: None, 1: horizontal 3-tap median" )166 ("RenderMode" , m_iRenderMode , 0, "0: Use renderer, 1: use model renderer, 10: create used pels map")167 ("ShiftPrecision" , m_iShiftPrecision , 2, "Shift Precision for Interpolation Mode 4" )168 ("TemporalDepthFilter", m_bTempDepthFilter , false, "Temporal depth filtering" )169 ("RenderDirection" , m_iRenderDirection , 0, "0: Interpolate, 1: Extrapolate from left, 2: Extrapolate from right")170 ("UsedPelMapMarExt" , m_iUsedPelMapMarExt , 0, "Margin Extension in Pels for used pels map generation" );171 172 po::setDefaults(opts);173 po::scanArgv(opts, argc, (const char**) argv);174 175 if (argc == 1 || do_help)176 {177 /* argc == 1: no options have been specified */178 po::doHelp(cout, opts);179 xPrintUsage();180 return false;181 }182 183 /*184 * Set any derived parameters before checking185 */186 187 /* rules for input, output and internal bitdepths as per help text */188 if (!m_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( Char* pchSourceFileName, Char*& 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 Char pchNumberBuffer[2* LOG10_VIEW_NUM_PREC + 2];471 Char 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 = (Char*) malloc(iInLength+iAddLength+1);491 492 Char* 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-15.1-MV-draft-4/source/App/TAppRenderer/TAppRendererCfg.h
r1313 r1325 47 47 #include <vector> 48 48 49 #if NH_3D50 51 // ====================================================================================================================52 // Class definition53 // ====================================================================================================================54 55 /// encoder configuration class56 class TAppRendererCfg57 {58 protected:59 60 //// file I/O ////61 Char* m_pchVideoInputFileBaseName; ///< input video file base name, placeholder for numbering $$62 Char* m_pchDepthInputFileBaseName; ///< input depth file base name, placeholder for numbering $$63 Char* m_pchSynthOutputFileBaseName; ///< output synth file base name, placeholder for numbering $$64 Bool m_bContOutputFileNumbering; ///< use continous numbering instead of view numbering65 Bool m_bSweep; ///< 1: Store view range in file66 67 68 // bit-depth ( Currently 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<Char*> m_pchVideoInputFileList; ///< source file names76 std::vector<Char*> m_pchDepthInputFileList; ///< source depth file names77 std::vector<Char*> 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 Char* m_pchCameraParameterFile; ///< camera parameter file87 Char* m_pchSynthViewCameraNumbers; ///< numbers of views to synthesize88 Char* m_pchViewConfig; ///< String to setup renderer89 Char* 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( Char* pchSourceFileName, Char*& 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, Char* argv[] ); ///< parse configuration file to fill member variables134 Bool xConfirmParameter(Bool bflag, const Char* message);135 136 137 };// END CLASS DEFINITION TAppRendererCfg138 139 #endif // __TAppRENDERERCFG__140 49 #endif // NH_3D -
branches/HTM-15.1-MV-draft-4/source/App/TAppRenderer/TAppRendererTop.cpp
r1313 r1325 41 41 #include "TAppRendererTop.h" 42 42 43 #if NH_3D44 45 // ====================================================================================================================46 // Constructor / destructor / initialization / destroy47 // ====================================================================================================================48 49 TAppRendererTop::TAppRendererTop()50 {51 52 }53 54 TAppRendererTop::~TAppRendererTop()55 {56 57 }58 59 60 Void TAppRendererTop::xCreateLib()61 {62 m_pcRenTop = new TRenTop();63 64 for(Int iViewIdx=0; iViewIdx<m_iNumberOfInputViews; iViewIdx++)65 {66 TVideoIOYuv* pcVideoInput = new TVideoIOYuv;67 TVideoIOYuv* pcDepthInput = new TVideoIOYuv;68 69 // ( 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 H_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-15.1-MV-draft-4/source/App/TAppRenderer/TAppRendererTop.h
r1313 r1325 40 40 #define __TAppRendererTOP__ 41 41 #include "../../Lib/TLibCommon/CommonDef.h" 42 #if NH_3D43 #include "../../Lib/TLibRenderer/TRenTop.h"44 #include "../../Lib/TLibVideoIO/TVideoIOYuv.h"45 #include "TAppRendererCfg.h"46 #include "TAppRendererTop.h"47 #include "../../Lib/TLibRenderer/TRenModel.h"48 49 // ====================================================================================================================50 // Class definition51 // ====================================================================================================================52 53 /// encoder application class54 class TAppRendererTop : public TAppRendererCfg55 {56 private:57 // class interface58 std::vector<TVideoIOYuv*> m_apcTVideoIOYuvVideoInput;59 std::vector<TVideoIOYuv*> m_apcTVideoIOYuvDepthInput;60 std::vector<TVideoIOYuv*> m_apcTVideoIOYuvSynthOutput;61 62 // RendererInterface63 TRenTop* m_pcRenTop;64 65 protected:66 // initialization67 Void xCreateLib (); ///< create renderer class and video io68 Void xInitLib (); ///< initialize renderer class69 Void xDestroyLib (); ///< destroy renderer class and video io70 #if 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.