Changeset 1384 in 3DVCSoftware for branches/HTM-15.2-dev1/source/App/TAppEncoder
- Timestamp:
- 12 Nov 2015, 18:56:31 (10 years ago)
- Location:
- branches/HTM-15.2-dev1/source/App/TAppEncoder
- Files:
-
- 4 edited
-
TAppEncCfg.cpp (modified) (21 diffs)
-
TAppEncCfg.h (modified) (5 diffs)
-
TAppEncTop.cpp (modified) (35 diffs)
-
TAppEncTop.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-15.2-dev1/source/App/TAppEncoder/TAppEncCfg.cpp
r1380 r1384 73 73 #if NH_MV 74 74 MULTIVIEWMAIN = 6, 75 #if NH_3D76 MAIN3D = 8,77 #endif78 75 #endif 79 76 MONOCHROME_8 = 1008, … … 120 117 m_targetPivotValue = NULL; 121 118 122 #if KWU_RC_MADPRED_E0227123 m_depthMADPred = 0;124 #endif125 119 } 126 120 … … 181 175 { 182 176 free ( m_pchBaseViewCameraNumbers ); 183 }184 #endif185 #if NH_3D_VSO186 if ( m_pchVSOConfig != NULL)187 {188 free ( m_pchVSOConfig );189 }190 191 if ( m_pchCameraParameterFile != NULL )192 {193 free ( m_pchCameraParameterFile );194 177 } 195 178 #endif … … 276 259 } 277 260 #endif 278 #if NH_3D279 in>>entry.m_interCompPredFlag;280 #endif281 261 282 262 return in; … … 312 292 #if NH_MV 313 293 ,{"multiview-main" , Profile::MULTIVIEWMAIN }, 314 #if NH_3D315 {"3d-main" , Profile::MAIN3D }316 #endif317 294 #endif 318 295 … … 341 318 #if NH_MV 342 319 {"multiview-main" , MULTIVIEWMAIN }, 343 #if NH_3D344 {"3d-main" , MAIN3D },345 #endif346 320 #endif 347 321 {"monochrome", MONOCHROME_8 }, … … 726 700 string cfg_levels; 727 701 string cfg_tiers; 728 #if NH_3D729 cfg_dimensionLength.push_back( 2 ); // depth730 cfg_dimensionLength.push_back( 32 ); // texture731 #else732 702 cfg_dimensionLength.push_back( 64 ); 733 #endif734 703 #endif 735 704 … … 807 776 #if NH_MV 808 777 ("NumberOfLayers", m_numberOfLayers , 1, "Number of layers") 809 #if !NH_3D810 778 ("ScalabilityMask", m_scalabilityMask , 2 , "Scalability Mask: 2: Multiview, 8: Auxiliary, 10: Multiview + Auxiliary") 811 #else812 ("ScalabilityMask", m_scalabilityMask , 3 , "Scalability Mask, 1: Texture 3: Texture + Depth ")813 #endif814 779 ("DimensionIdLen", m_dimensionIdLen , cfg_dimensionLength , "Number of bits used to store dimensions Id") 815 780 ("ViewOrderIndex", m_viewOrderIndex , IntAry1d(1,0), "View Order Index per layer") 816 781 ("ViewId", m_viewId , IntAry1d(1,0), "View Id per View Order Index") 817 782 ("AuxId", m_auxId , IntAry1d(1,0), "AuxId per layer") 818 #if NH_3D_VSO819 ("DepthFlag", m_depthFlag , IntAry1d(1,0), "Depth Flag")820 #endif821 783 ("TargetEncLayerIdList", m_targetEncLayerIdList , IntAry1d(0,0), "LayerIds in Nuh to be encoded") 822 784 ("LayerIdInNuh", m_layerIdInNuh , IntAry1d(1,0), "LayerId in Nuh") … … 1095 1057 #endif 1096 1058 1097 #if KWU_RC_VIEWRC_E02271098 ("ViewWiseTargetBits, -vtbr" , m_viewTargetBits, std::vector<Int>(1, 32), "View-wise target bit-rate setting")1099 ("TargetBitAssign, -ta", m_viewWiseRateCtrl, false, "View-wise rate control on/off")1100 #endif1101 #if KWU_RC_MADPRED_E02271102 ("DepthMADPred, -dm", m_depthMADPred, (UInt)0, "Depth based MAD prediction on/off")1103 #endif1104 1059 #if NH_MV 1105 1060 // A lot of this stuff could should actually be derived by the encoder. … … 1282 1237 ("BaseViewCameraNumbers", m_pchBaseViewCameraNumbers, (TChar *) 0 , "Numbers of base views") 1283 1238 #endif 1284 #if NH_3D1285 ("Depth420OutputFlag", m_depth420OutputFlag, true , "Output depth layers in 4:2:0 ")1286 #endif1287 #if NH_3D_VSO1288 ("CameraParameterFile,cpf", m_pchCameraParameterFile, (TChar *) 0 , "Camera Parameter File Name")1289 ("CodedCamParsPrecision", m_iCodedCamParPrecision, STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )1290 1291 /* View Synthesis Optimization */1292 ("VSOConfig", m_pchVSOConfig , (TChar *) 0 ,"VSO configuration")1293 ("VSO", m_bUseVSO , false ,"Use VSO" )1294 ("VSOMode", m_uiVSOMode , (UInt) 4 ,"VSO Mode")1295 ("LambdaScaleVSO", m_dLambdaScaleVSO , (Double) 1 ,"Lambda Scaling for VSO")1296 ("VSOLSTable", m_bVSOLSTable , true ,"Depth QP dependent video/depth rate allocation by Lagrange multiplier" )1297 ("ForceLambdaScaleVSO", m_bForceLambdaScaleVSO , false ,"Force using Lambda Scale VSO also in non-VSO-Mode")1298 ("AllowNegDist", m_bAllowNegDist , true ,"Allow negative Distortion in VSO")1299 1300 ("UseEstimatedVSD", m_bUseEstimatedVSD , true ,"Model based VSD estimation instead of rendering based for some encoder decisions" )1301 ("VSOEarlySkip", m_bVSOEarlySkip , true ,"Early skip of VSO computation if synthesis error assumed to be zero" )1302 1303 ("WVSO", m_bUseWVSO , true ,"Use depth fidelity term for VSO" )1304 ("VSOWeight", m_iVSOWeight , 10 ,"Synthesized View Distortion Change weight" )1305 ("VSDWeight", m_iVSDWeight , 1 ,"View Synthesis Distortion estimate weight" )1306 ("DWeight", m_iDWeight , 1 ,"Depth Distortion weight" )1307 #endif //HHI_VSO1308 1239 /* 3D- HEVC Tools */ 1309 #if NH_3D_QTL1310 ("QTL" , m_bUseQTL , true , "Use depth quad tree limitation (encoder only)" )1311 #endif1312 #if NH_3D1313 1314 ("IvMvPredFlag" , m_ivMvPredFlag , BoolAry1d(2,true) , "Inter-view motion prediction" )1315 ("IvMvScalingFlag" , m_ivMvScalingFlag , BoolAry1d(2,true) , "Inter-view motion vector scaling" )1316 ("Log2SubPbSizeMinus3" , m_log2SubPbSizeMinus3 , 0 , "Log2 minus 3 of sub Pb size" )1317 ("IvResPredFlag" , m_ivResPredFlag , true , "Inter-view residual prediction" )1318 ("DepthRefinementFlag" , m_depthRefinementFlag , true , "Depth to refine disparity" )1319 ("ViewSynthesisPredFlag" , m_viewSynthesisPredFlag , true , "View synthesis prediction" )1320 ("DepthBasedBlkPartFlag" , m_depthBasedBlkPartFlag , true , "Depth base block partitioning" )1321 ("MpiFlag" , m_mpiFlag , true , "Motion inheritance from texture to depth" )1322 ("Log2MpiSubPbSizeMinus3", m_log2MpiSubPbSizeMinus3 , 0 , "Log2 minus 3 of sub Pb size for MPI" )1323 ("IntraContourFlag" , m_intraContourFlag , true , "Intra contour mode" )1324 ("IntraWedgeFlag" , m_intraWedgeFlag , true , "Intra wedge mode and segmental depth DCs" )1325 ("IntraSdcFlag" , m_intraSdcFlag , true , "Intra depth DCs" )1326 ("QtPredFlag" , m_qtPredFlag , true , "Quad tree prediction from texture to depth")1327 ("InterSdcFlag" , m_interSdcFlag , true , "Inter depth DCs" )1328 ("DepthIntraSkip" , m_depthIntraSkipFlag , true , "Depth intra skip mode" )1329 ("DLT" , m_useDLT , true , "Depth lookup table" )1330 ("IlluCompEnable" , m_abUseIC , true , "Enable illumination compensation" )1331 ("IlluCompLowLatencyEnc" , m_bUseLowLatencyICEnc , false , "Enable low-latency illumination compensation encoding")1332 #endif //NH_3D1333 1240 1334 1241 ; … … 1536 1443 if( cfg_profiles.empty() ) 1537 1444 { 1538 #if NH_3D1539 cfg_profiles = string("main main 3d-main");1540 #else1541 1445 cfg_profiles = string("main main multiview-main"); 1542 #endif1543 1446 fprintf(stderr, "\nWarning: No profiles given, using defaults: %s", cfg_profiles.c_str() ); 1544 1447 anyEmpty = true; … … 1807 1710 xResizeVector( m_auxId ); 1808 1711 1809 #if NH_3D_VSO1810 xResizeVector( m_depthFlag );1811 #endif1812 1712 xResizeVector( m_fQP ); 1813 1713 … … 2017 1917 2018 1918 2019 #if NH_3D_VSO2020 // Table base optimization2021 // Q&D2022 Double adLambdaScaleTable[] =2023 { 0.031250, 0.031639, 0.032029, 0.032418, 0.032808, 0.033197, 0.033586, 0.033976, 0.034365, 0.034755,2024 0.035144, 0.035533, 0.035923, 0.036312, 0.036702, 0.037091, 0.037480, 0.037870, 0.038259, 0.038648,2025 0.039038, 0.039427, 0.039817, 0.040206, 0.040595, 0.040985, 0.041374, 0.041764, 0.042153, 0.042542,2026 0.042932, 0.043321, 0.043711, 0.044100, 0.044194, 0.053033, 0.061872, 0.070711, 0.079550, 0.088388,2027 0.117851, 0.147314, 0.176777, 0.235702, 0.294628, 0.353553, 0.471405, 0.589256, 0.707107, 0.707100,2028 0.753550, 0.8000002029 };2030 if ( m_bUseVSO && m_bVSOLSTable )2031 {2032 Int firstDepthLayer = -1;2033 for (Int layer = 0; layer < m_numberOfLayers; layer++ )2034 {2035 if ( m_depthFlag[ layer ] || m_auxId[ layer ] == 2 )2036 {2037 firstDepthLayer = layer;2038 break;2039 }2040 }2041 AOT( firstDepthLayer == -1 );2042 AOT( (m_iQP[firstDepthLayer] < 0) || (m_iQP[firstDepthLayer] > 51));2043 m_dLambdaScaleVSO *= adLambdaScaleTable[m_iQP[firstDepthLayer]];2044 }2045 if ( m_bUseVSO && m_uiVSOMode == 4)2046 {2047 m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig );2048 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),2049 m_internalBitDepth[ CHANNEL_TYPE_LUMA],2050 (UInt)m_iCodedCamParPrecision,2051 m_FrameSkip,2052 (UInt)m_framesToBeEncoded,2053 m_pchCameraParameterFile,2054 m_pchBaseViewCameraNumbers,2055 NULL,2056 m_cRenModStrParser.getSynthViews(),2057 LOG2_DISP_PREC_LUT );2058 }2059 else if ( m_bUseVSO && m_uiVSOMode != 4 )2060 {2061 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),2062 m_internalBitDepth[ CHANNEL_TYPE_LUMA],2063 (UInt)m_iCodedCamParPrecision,2064 m_FrameSkip,2065 (UInt)m_framesToBeEncoded,2066 m_pchCameraParameterFile,2067 m_pchBaseViewCameraNumbers,2068 m_pchVSOConfig,2069 NULL,2070 LOG2_DISP_PREC_LUT );2071 }2072 #if NH_3D2073 else2074 {2075 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),2076 m_internalBitDepth[ CHANNEL_TYPE_LUMA],2077 (UInt) m_iCodedCamParPrecision,2078 m_FrameSkip,2079 (UInt) m_framesToBeEncoded,2080 m_pchCameraParameterFile,2081 m_pchBaseViewCameraNumbers,2082 NULL,2083 NULL,2084 LOG2_DISP_PREC_LUT );2085 }2086 m_cCameraData.check( false, true );2087 #endif2088 #endif2089 1919 2090 1920 // check validity of input parameters … … 2264 2094 xConfirmPara( (m_layerIdInNuh.size()!=1) && (m_layerIdInNuh.size() < m_numberOfLayers) , "LayerIdInNuh must be given for all layers. "); 2265 2095 2266 #if NH_3D2267 xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 3, "Scalability Mask must be equal to 2 or 3. ");2268 #else2269 2096 xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 8 && m_scalabilityMask != 10, "Scalability Mask must be equal to 2, 8 or 10"); 2270 #endif 2271 2272 #if NH_3D_VSO 2273 if ( m_scalabilityMask & ( 1 << DEPTH_ID ) ) 2274 { 2275 m_dimIds.push_back( m_depthFlag ); 2276 } 2277 #endif 2097 2278 2098 2279 2099 m_dimIds.push_back( m_viewOrderIndex ); … … 2342 2162 xConfirmPara( allEqual , "Each layer shall have a different position in scalability space." ); 2343 2163 2344 #if !H_3D_FCO2345 2164 if ( numDiff == 1 ) 2346 2165 { … … 2353 2172 xConfirmPara( shallBeButIsNotIncreasing, "DimensionIds shall be increasing within one dimension. " ); 2354 2173 } 2355 #endif2356 2174 } 2357 2175 } … … 2560 2378 xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater."); 2561 2379 xConfirmPara( m_maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller."); 2562 #if NH_3D2563 xConfirmPara( m_log2SubPbSizeMinus3 < 0, "Log2SubPbSizeMinus3 must be equal to 0 or greater.");2564 xConfirmPara( m_log2SubPbSizeMinus3 > 3, "Log2SubPbSizeMinus3 must be equal to 3 or smaller.");2565 xConfirmPara( (1<< ( m_log2SubPbSizeMinus3 + 3) ) > m_uiMaxCUWidth, "Log2SubPbSizeMinus3 must be equal to log2(maxCUSize)-3 or smaller.");2566 2567 xConfirmPara( m_log2MpiSubPbSizeMinus3 < 0, "Log2MpiSubPbSizeMinus3 must be equal to 0 or greater.");2568 xConfirmPara( m_log2MpiSubPbSizeMinus3 > 3, "Log2MpiSubPbSizeMinus3 must be equal to 3 or smaller.");2569 xConfirmPara( (1<< (m_log2MpiSubPbSizeMinus3 + 3)) > m_uiMaxCUWidth, "Log2MpiSubPbSizeMinus3 must be equal to log2(maxCUSize)-3 or smaller.");2570 #endif2571 2380 #if ADAPTIVE_QP_SELECTION 2572 2381 #if NH_MV … … 2629 2438 } 2630 2439 2631 #if NH_3D_VSO2632 xConfirmPara( m_pchCameraParameterFile == 0 , "CameraParameterFile must be given");2633 xConfirmPara( m_pchBaseViewCameraNumbers == 0 , "BaseViewCameraNumbers must be given" );2634 xConfirmPara( m_iNumberOfViews != m_cCameraData.getBaseViewNumbers().size() , "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );2635 xConfirmPara ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5, "CodedCamParsPrecision must be in range of 0..5" );2636 if( m_bUseVSO )2637 {2638 xConfirmPara( m_pchVSOConfig == 0 , "VSO Setup string must be given");2639 xConfirmPara( m_uiVSOMode > 4 , "VSO Mode must be less than 5");2640 }2641 #endif2642 2440 // max CU width and height should be power of 2 2643 2441 UInt ui = m_uiMaxCUWidth; … … 3393 3191 xPrintParaVector( "AuxId", m_auxId ); 3394 3192 #endif 3395 #if NH_3D_VSO3396 xPrintParaVector( "DepthLayerFlag", m_depthFlag );3397 printf("Coded Camera Param. Precision : %d\n", m_iCodedCamParPrecision);3398 #endif3399 3193 #if NH_MV 3400 3194 xPrintParaVector( "QP" , m_fQP ); … … 3573 3367 #endif 3574 3368 3575 #if KWU_RC_MADPRED_E02273576 printf("Depth based MAD prediction : %d\n", m_depthMADPred);3577 #endif3578 #if KWU_RC_VIEWRC_E02273579 printf("View-wise Rate control : %d\n", m_viewWiseRateCtrl);3580 if(m_viewWiseRateCtrl)3581 {3582 3583 printf("ViewWiseTargetBits : ");3584 for (Int i = 0 ; i < m_iNumberOfViews ; i++)3585 printf("%d ", m_viewTargetBits[i]);3586 printf("\n");3587 }3588 else3589 {3590 printf("TargetBitrate : %d\n", m_RCTargetBitrate );3591 }3592 #endif3593 3369 3594 3370 } 3595 3371 3596 3372 printf("Max Num Merge Candidates : %d\n", m_maxNumMergeCand); 3597 #if NH_3D_VSO3598 printf("BaseViewCameraNumbers : %s\n", m_pchBaseViewCameraNumbers );3599 printf("Coded Camera Param. Precision : %d\n", m_iCodedCamParPrecision);3600 printf("Force use of Lambda Scale : %d\n", m_bForceLambdaScaleVSO );3601 3602 if ( m_bUseVSO )3603 {3604 printf("VSO Lambda Scale : %5.2f\n", m_dLambdaScaleVSO );3605 printf("VSO Mode : %d\n", m_uiVSOMode );3606 printf("VSO Config : %s\n", m_pchVSOConfig );3607 printf("VSO Negative Distortion : %d\n", m_bAllowNegDist ? 1 : 0);3608 printf("VSO LS Table : %d\n", m_bVSOLSTable ? 1 : 0);3609 printf("VSO Estimated VSD : %d\n", m_bUseEstimatedVSD ? 1 : 0);3610 printf("VSO Early Skip : %d\n", m_bVSOEarlySkip ? 1 : 0);3611 if ( m_bUseWVSO )3612 {3613 printf("Dist. Weights (VSO/VSD/SAD) : %d/%d/%d\n ", m_iVSOWeight, m_iVSDWeight, m_iDWeight );3614 }3615 }3616 #endif //HHI_VSO3617 3373 printf("\n"); 3618 3374 #if NH_MV … … 3677 3433 printf(" SignBitHidingFlag:%d ", m_signHideFlag); 3678 3434 printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 ); 3679 #if NH_3D_VSO3680 printf(" VSO:%d ", m_bUseVSO );3681 printf("WVSO:%d ", m_bUseWVSO );3682 #endif3683 #if NH_3D_QTL3684 printf( "QTL:%d " , m_bUseQTL);3685 #endif3686 #if NH_3D3687 printf( "IlluCompEnable:%d " , m_abUseIC);3688 printf( "IlluCompLowLatencyEnc:%d ", m_bUseLowLatencyICEnc);3689 printf( "DLT:%d ", m_useDLT );3690 3691 3692 printf( "IvMvPred:%d %d " , m_ivMvPredFlag[0] ? 1 : 0, m_ivMvPredFlag[1] ? 1 : 0);3693 printf( "IvMvScaling:%d %d " , m_ivMvScalingFlag[0] ? 1 : 0 , m_ivMvScalingFlag[1] ? 1 : 0);3694 3695 printf( "Log2SubPbSizeMinus3:%d " , m_log2SubPbSizeMinus3 );3696 printf( "IvResPred:%d " , m_ivResPredFlag ? 1 : 0 );3697 printf( "DepthRefinement:%d " , m_depthRefinementFlag ? 1 : 0 );3698 printf( "ViewSynthesisPred:%d " , m_viewSynthesisPredFlag ? 1 : 0 );3699 printf( "DepthBasedBlkPart:%d " , m_depthBasedBlkPartFlag ? 1 : 0 );3700 printf( "Mpi:%d " , m_mpiFlag ? 1 : 0 );3701 printf( "Log2MpiSubPbSizeMinus3:%d " , m_log2MpiSubPbSizeMinus3 );3702 printf( "IntraContour:%d " , m_intraContourFlag ? 1 : 0 );3703 printf( "IntraWedge:%d " , m_intraWedgeFlag ? 1 : 0 );3704 printf( "IntraSdc:%d " , m_intraSdcFlag ? 1 : 0 );3705 printf( "QtPred:%d " , m_qtPredFlag ? 1 : 0 );3706 printf( "InterSdc:%d " , m_interSdcFlag ? 1 : 0 );3707 printf( "DepthIntraSkip:%d " , m_depthIntraSkipFlag ? 1 : 0 );3708 #endif3709 3435 3710 3436 printf("\n\n"); -
branches/HTM-15.2-dev1/source/App/TAppEncoder/TAppEncCfg.h
r1380 r1384 44 44 #include <sstream> 45 45 #include <vector> 46 #if NH_3D47 #include "TAppCommon/TAppComCamPara.h"48 #include "TLibRenderer/TRenModel.h"49 #include "TLibRenderer/TRenModSetupStrParser.h"50 #endif51 46 //! \ingroup TAppEncoder 52 47 //! \{ … … 80 75 IntAry1d m_viewOrderIndex; ///< view order index 81 76 IntAry1d m_auxId; ///< auxiliary id 82 #if NH_3D_VSO83 IntAry1d m_depthFlag; ///< depth flag84 #endif85 77 IntAry1d m_targetEncLayerIdList; ///< layer Ids in Nuh to be encoded 86 78 IntAry1d m_layerIdInNuh; ///< layer Id in Nuh for each layer … … 131 123 Bool m_singleLayerForNonIrapFlag; 132 124 Bool m_higherLayerIrapSkipFlag; 133 #if NH_3D134 Bool m_abUseIC;135 Bool m_bUseLowLatencyICEnc;136 #endif137 125 #endif 138 126 // Lambda modifiers … … 464 452 #endif 465 453 466 #if KWU_RC_VIEWRC_E0227467 vector<Int> m_viewTargetBits;468 Bool m_viewWiseRateCtrl; ///< Flag for using view-wise rate control469 #endif470 #if KWU_RC_MADPRED_E0227471 UInt m_depthMADPred;472 #endif473 454 474 455 ScalingListMode m_useScalingListId; ///< using quantization matrix … … 527 508 #endif 528 509 529 #if NH_3D530 // Output Format531 Bool m_depth420OutputFlag; ///< Output depth layers in 4:2:0 format532 #endif533 510 // Camera parameters 534 #if NH_3D_VSO535 TChar* m_pchCameraParameterFile; ///< camera parameter file536 TAppComCamPara m_cCameraData;537 Int m_iCodedCamParPrecision; ///< precision for coding of camera parameters538 TChar* m_pchVSOConfig;539 Bool m_bUseVSO; ///< flag for using View Synthesis Optimization540 Bool m_bVSOLSTable; ///< Depth QP dependent Lagrange parameter optimization (m23714)541 Bool m_bVSOEarlySkip; ///< Early skip of VSO computation (JCT3V-A0093 modification 4)542 543 //// Used for development by GT, might be removed later544 Double m_dLambdaScaleVSO; ///< Scaling factor for Lambda in VSO mode545 Bool m_bForceLambdaScaleVSO; ///< Use Lambda Scale for depth even if VSO is turned off546 Bool m_bAllowNegDist; ///< Allow negative distortion in VSO547 UInt m_uiVSOMode; ///< Number of VSO Mode, 1 = , 2 = simple, org vs. ren, 3 = simple, ren vs. ren, 4 = full548 549 // SAIT_VSO_EST_A0033550 Bool m_bUseEstimatedVSD; ///< Flag for using model based VSD estimation instead of VSO for some encoder decisions (JCT3V-A0033 modification 3)551 552 // LGE_WVSO_A0119553 Bool m_bUseWVSO; ///< flag for using View Synthesis Optimization554 Int m_iVSOWeight;555 Int m_iVSDWeight;556 Int m_iDWeight;557 558 // Ren Model String559 TRenModSetupStrParser m_cRenModStrParser;560 #endif561 #if NH_3D562 Bool m_useDLT; ///< flag for using DLT563 #endif564 #if NH_3D_QTL565 Bool m_bUseQTL; ///< flag for using depth QuadTree Limitation566 #endif567 #if NH_3D568 BoolAry1d m_ivMvPredFlag;569 BoolAry1d m_ivMvScalingFlag;570 Int m_log2SubPbSizeMinus3;571 Bool m_ivResPredFlag;572 Bool m_depthRefinementFlag;573 Bool m_viewSynthesisPredFlag;574 Bool m_depthBasedBlkPartFlag;575 Bool m_mpiFlag;576 Int m_log2MpiSubPbSizeMinus3;577 Bool m_intraContourFlag;578 Bool m_intraWedgeFlag;579 Bool m_intraSdcFlag;580 Bool m_qtPredFlag;581 Bool m_interSdcFlag;582 Bool m_depthIntraSkipFlag;583 #endif584 511 // internal member functions 585 512 Void xCheckParameter (); ///< check validity of configuration values -
branches/HTM-15.2-dev1/source/App/TAppEncoder/TAppEncTop.cpp
r1380 r1384 87 87 #endif 88 88 89 #if NH_3D 90 vps.createCamPars(m_iNumberOfViews); 91 #endif 92 93 #if NH_3D_DLT 94 TComDLT dlt = TComDLT(); 95 #endif 89 96 90 97 91 #if NH_MV … … 145 139 xSetDpbSize ( vps ); 146 140 xSetVPSVUI ( vps ); 147 #if NH_3D148 xSetCamPara ( vps );149 #endif150 #if NH_3D_VSO151 m_ivPicLists.setVPS ( &vps );152 #endif153 #if NH_3D_DLT154 xDeriveDltArray ( vps, &dlt );155 #endif156 141 if ( m_targetEncLayerIdList.size() == 0 ) 157 142 { … … 184 169 } 185 170 186 #if NH_3D187 // Set 3d tool parameters188 for (Int d = 0; d < 2; d++)189 {190 m_sps3dExtension.setIvDiMcEnabledFlag ( d, m_ivMvPredFlag[d] );191 m_sps3dExtension.setIvMvScalEnabledFlag ( d, m_ivMvScalingFlag[d] );192 if (d == 0 )193 {194 m_sps3dExtension.setLog2IvmcSubPbSizeMinus3 ( d, m_log2SubPbSizeMinus3 );195 m_sps3dExtension.setIvResPredEnabledFlag ( d, m_ivResPredFlag );196 m_sps3dExtension.setDepthRefEnabledFlag ( d, m_depthRefinementFlag );197 m_sps3dExtension.setVspMcEnabledFlag ( d, m_viewSynthesisPredFlag );198 m_sps3dExtension.setDbbpEnabledFlag ( d, m_depthBasedBlkPartFlag );199 }200 else201 {202 m_sps3dExtension.setTexMcEnabledFlag ( d, m_mpiFlag );203 m_sps3dExtension.setLog2TexmcSubPbSizeMinus3( d, m_log2MpiSubPbSizeMinus3);204 m_sps3dExtension.setIntraContourEnabledFlag ( d, m_intraContourFlag );205 m_sps3dExtension.setIntraDcOnlyWedgeEnabledFlag ( d, m_intraSdcFlag || m_intraWedgeFlag );206 m_sps3dExtension.setCqtCuPartPredEnabledFlag ( d, m_qtPredFlag );207 m_sps3dExtension.setInterDcOnlyEnabledFlag ( d, m_interSdcFlag );208 m_sps3dExtension.setSkipIntraEnabledFlag ( d, m_depthIntraSkipFlag );209 }210 }211 #endif212 171 213 172 … … 219 178 m_acTVideoIOYuvInputFileList.push_back(new TVideoIOYuv); 220 179 m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv); 221 #if NH_3D222 Int profileIdc = -1;223 for (Int olsIdx = 0; olsIdx < vps.getNumOutputLayerSets(); olsIdx++ )224 {225 Int lsIdx = vps.olsIdxToLsIdx( olsIdx );226 for(Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++ )227 {228 if( vps.getLayerIdInNuh( layerIdInVps) == vps.getLayerSetLayerIdList(lsIdx, i) )229 {230 Int ptlIdx = vps.getProfileTierLevelIdx( olsIdx, i );231 if ( ptlIdx != -1 )232 {233 Int curProfileIdc = vps.getPTL(ptlIdx)->getGeneralPTL()->getProfileIdc();234 if (profileIdc == -1)235 {236 profileIdc = curProfileIdc;237 }238 else239 {240 if ( profileIdc != curProfileIdc )241 {242 fprintf(stderr, "Error: ProfileIdc for layer with index %d in VPS not equal in all OLSs. \n", layerIdInVps );243 exit(EXIT_FAILURE);244 }245 }246 }247 }248 }249 }250 251 if (profileIdc == -1 )252 {253 fprintf(stderr, "Error: No profile given for layer with index %d in VPS not equal in all OLS. \n", layerIdInVps );254 exit(EXIT_FAILURE);255 }256 m_acTEncTopList[ layerIdInVps ]->setProfileIdc( profileIdc );257 #endif258 180 } 259 181 … … 278 200 m_cTEncTop.setViewId ( vps.getViewId ( layerId ) ); 279 201 m_cTEncTop.setViewIndex ( vps.getViewIndex ( layerId ) ); 280 #if NH_3D_VSO281 Bool isDepth = ( vps.getDepthId ( layerId ) != 0 ) ;282 Bool isAuxDepth = ( vps.getAuxId ( layerId ) == 2 ) ; // TBD: define 2 as AUX_DEPTH283 m_cTEncTop.setIsDepth ( isDepth );284 m_cTEncTop.setIsAuxDepth ( isAuxDepth );285 //====== Camera Parameters =========286 m_cTEncTop.setCameraParameters ( &m_cCameraData );287 //====== VSO =========288 m_cTEncTop.setRenderModelParameters ( &m_cRenModStrParser );289 m_cTEncTop.setForceLambdaScaleVSO ( isDepth || isAuxDepth ? m_bForceLambdaScaleVSO : false );290 m_cTEncTop.setLambdaScaleVSO ( isDepth || isAuxDepth ? m_dLambdaScaleVSO : 1 );291 m_cTEncTop.setVSOMode ( isDepth || isAuxDepth ? m_uiVSOMode : 0 );292 293 m_cTEncTop.setAllowNegDist ( isDepth || isAuxDepth ? m_bAllowNegDist : false );294 295 // SAIT_VSO_EST_A0033296 m_cTEncTop.setUseEstimatedVSD ( isDepth || isAuxDepth ? m_bUseEstimatedVSD : false );297 298 // LGE_WVSO_A0119299 m_cTEncTop.setUseWVSO ( isDepth || isAuxDepth ? m_bUseWVSO : false );300 m_cTEncTop.setVSOWeight ( isDepth || isAuxDepth ? m_iVSOWeight : 0 );301 m_cTEncTop.setVSDWeight ( isDepth || isAuxDepth ? m_iVSDWeight : 0 );302 m_cTEncTop.setDWeight ( isDepth || isAuxDepth ? m_iDWeight : 0 );303 #endif // H_3D_VSO304 #if NH_3D305 #if NH_3D_IC306 m_cTEncTop.setUseIC ( vps.getViewIndex( layerId ) == 0 || isDepth ? false : m_abUseIC );307 m_cTEncTop.setUseICLowLatencyEnc ( m_bUseLowLatencyICEnc );308 #endif309 310 311 m_cTEncTop.setUseDMM ( isDepth ? m_intraWedgeFlag : false );312 m_cTEncTop.setUseSDC ( isDepth ? m_intraSdcFlag : false );313 m_cTEncTop.setUseDLT ( isDepth ? m_useDLT : false );314 #endif315 #if NH_3D_QTL316 m_cTEncTop.setUseQTL ( isDepth || isAuxDepth ? m_bUseQTL : false );317 #endif318 #if NH_3D319 m_cTEncTop.setSps3dExtension ( m_sps3dExtension );320 #endif // NH_3D321 202 322 203 m_cTEncTop.setIvPicLists ( &m_ivPicLists ); … … 324 205 m_cTEncTop.setVPS(&vps); 325 206 326 #if NH_3D_DLT327 m_cTEncTop.setDLT(dlt);328 #endif329 207 330 208 #if NH_MV … … 438 316 m_cTEncTop.setChromaCrQpOffset ( m_crQpOffset ); 439 317 440 #if NH_3D441 m_cTEncTop.setChromaFormatIdc ( isDepth ? CHROMA_400 : m_chromaFormatIDC );442 #else443 318 m_cTEncTop.setChromaFormatIdc ( m_chromaFormatIDC ); 444 #endif445 319 446 320 #if ADAPTIVE_QP_SELECTION … … 651 525 m_cTEncTop.setScalingListFileName ( m_scalingListFileName ); 652 526 m_cTEncTop.setSignHideFlag ( m_signHideFlag); 653 #if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227654 if(!m_cTEncTop.getIsDepth()) //only for texture655 {656 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl );657 }658 else659 {660 m_cTEncTop.setUseRateCtrl ( 0 );661 }662 #else663 527 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl ); 664 #endif665 #if !KWU_RC_VIEWRC_E0227666 528 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate ); 667 #endif668 529 m_cTEncTop.setKeepHierBit ( m_RCKeepHierarchicalBit ); 669 530 m_cTEncTop.setLCULevelRC ( m_RCLCULevelRC ); … … 677 538 #endif 678 539 679 #if KWU_RC_MADPRED_E0227680 if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())681 {682 m_cTEncTop.setUseDepthMADPred(layerIdInVps ? m_depthMADPred : 0);683 if(m_cTEncTop.getUseDepthMADPred())684 {685 m_cTEncTop.setCamParam(&m_cCameraData);686 }687 }688 #endif689 #if KWU_RC_VIEWRC_E0227690 if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())691 {692 m_cTEncTop.setUseViewWiseRateCtrl(m_viewWiseRateCtrl);693 if(m_iNumberOfViews == 1)694 {695 if(m_viewWiseRateCtrl)696 {697 m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);698 }699 else700 {701 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate );702 }703 }704 else705 {706 if(m_viewWiseRateCtrl)707 {708 m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);709 }710 else711 {712 if(m_iNumberOfViews == 2)713 {714 if(m_cTEncTop.getViewId() == 0)715 {716 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*80)/100 );717 }718 else if(m_cTEncTop.getViewId() == 1)719 {720 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*20)/100 );721 }722 }723 else if(m_iNumberOfViews == 3)724 {725 if(m_cTEncTop.getViewId() == 0)726 {727 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*66)/100 );728 }729 else if(m_cTEncTop.getViewId() == 1)730 {731 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*17)/100 );732 }733 else if(m_cTEncTop.getViewId() == 2)734 {735 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*17)/100 );736 }737 }738 else739 {740 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate );741 }742 }743 }744 }745 #endif746 540 m_cTEncTop.setTransquantBypassEnableFlag ( m_TransquantBypassEnableFlag ); 747 541 m_cTEncTop.setCUTransquantBypassFlagForceValue ( m_CUTransquantBypassFlagForce ); … … 790 584 } 791 585 #endif 792 #if NH_3D_VSO793 if ( m_bUseVSO )794 {795 if ( m_uiVSOMode == 4 )796 {797 #if H_3D_VSO_EARLY_SKIP798 m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip );799 #else800 m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 );801 #endif802 for ( Int layer = 0; layer < m_numberOfLayers ; layer++ )803 {804 TEncTop* pcEncTop = m_acTEncTopList[ layer ];805 Int iViewNum = pcEncTop->getViewIndex();806 Int iContent = pcEncTop->getIsDepth() || pcEncTop->getIsAuxDepth() ? 1 : 0;807 Int iNumOfModels = m_cRenModStrParser.getNumOfModelsForView(iViewNum, iContent);808 809 Bool bUseVSO = (iNumOfModels != 0);810 811 pcEncTop->setUseVSO( bUseVSO );812 pcEncTop->getRdCost()->setRenModel( bUseVSO ? &m_cRendererModel : NULL );813 814 for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ )815 {816 Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode;817 818 m_cRenModStrParser.getSingleModelData ( iViewNum, iContent, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ;819 m_cRendererModel .createSingleModel ( iViewNum, iContent, iModelNum, iLeftViewNum, iRightViewNum, (iOrgRefNum != -1), iBlendMode );820 }821 }822 }823 else824 {825 AOT(true);826 }827 }828 #endif829 586 } 830 587 … … 834 591 // initialize global variables 835 592 initROM(); 836 #if NH_3D_DMM837 initWedgeLists( true );838 #endif839 593 840 594 for( Int layer=0; layer < m_numberOfLayers; layer++) … … 900 654 for(Int layer=0; layer<m_numberOfLayers; layer++) 901 655 { 902 #if KWU_RC_MADPRED_E0227903 m_acTEncTopList[layer]->init( isFieldCoding, this );904 #else905 656 m_acTEncTopList[layer]->init( isFieldCoding ); 906 #endif907 657 } 908 658 #else … … 932 682 } 933 683 934 #if !NH_3D935 684 TComPicYuv* pcPicYuvOrg = new TComPicYuv; 936 #endif937 685 TComPicYuv* pcPicYuvRec = NULL; 938 686 … … 968 716 list<AccessUnit> outputAccessUnits; ///< list of access units to write out. is populated by the encoding process 969 717 970 #if NH_3D971 TComPicYuv* picYuvOrg[2];972 TComPicYuv picYuvTrueOrg[2];973 for (Int d = 0; d < 2 ; d++)974 {975 picYuvOrg[d] = new TComPicYuv;976 picYuvOrg[d] ->create( m_iSourceWidth, m_isField ? m_iSourceHeightOrg : m_iSourceHeight, ( d > 0 ) ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );977 picYuvTrueOrg[d].create( m_iSourceWidth, m_isField ? m_iSourceHeightOrg : m_iSourceHeight, ( d > 0 ) ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );978 }979 #else980 718 TComPicYuv cPicYuvTrueOrg; 981 719 … … 991 729 cPicYuvTrueOrg.create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true ); 992 730 } 993 #endif994 731 #if NH_MV 995 732 while ( (m_targetEncLayerIdList.size() != 0 ) && !allEos ) … … 997 734 for(Int layer=0; layer < m_numberOfLayers; layer++ ) 998 735 { 999 #if NH_3D1000 TComPicYuv* pcPicYuvOrg = picYuvOrg [ m_depthFlag[layer] ];1001 TComPicYuv& cPicYuvTrueOrg = picYuvTrueOrg[ m_depthFlag[layer] ];1002 #endif1003 736 if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) )) 1004 737 { … … 1036 769 for ( Int gopId=0; gopId < gopSize; gopId++ ) 1037 770 { 1038 #if NH_3D_VSO1039 UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId );1040 if ( iNextPoc < m_framesToBeEncoded )1041 {1042 m_cCameraData.update( iNextPoc );1043 }1044 #endif1045 771 for(Int layer=0; layer < m_numberOfLayers; layer++ ) 1046 772 { 1047 #if NH_3D1048 TComPicYuv* pcPicYuvOrg = picYuvOrg [ m_depthFlag[layer] ];1049 TComPicYuv& cPicYuvTrueOrg = picYuvTrueOrg[ m_depthFlag[layer] ];1050 #endif1051 773 if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) )) 1052 774 { … … 1054 776 } 1055 777 1056 #if NH_3D_VSO1057 if( m_bUseVSO && m_bUseEstimatedVSD && iNextPoc < m_framesToBeEncoded )1058 {1059 m_cCameraData.setDispCoeff( iNextPoc, m_acTEncTopList[layer]->getViewIndex() );1060 m_acTEncTopList[layer] ->setDispCoeff( m_cCameraData.getDispCoeff() );1061 }1062 #endif1063 778 1064 779 Int iNumEncoded = 0; … … 1127 842 #endif 1128 843 1129 #if NH_3D1130 // delete original YUV buffer1131 for (Int d = 0; d < 2; d++)1132 {1133 picYuvOrg[d]->destroy();1134 delete picYuvOrg[d];1135 picYuvOrg[d] = NULL;1136 1137 picYuvTrueOrg[d].destroy();1138 }1139 #else1140 844 // delete original YUV buffer 1141 845 pcPicYuvOrg->destroy(); 1142 846 delete pcPicYuvOrg; 1143 847 pcPicYuvOrg = NULL; 1144 #endif1145 848 1146 849 #if !NH_MV … … 1148 851 m_cTEncTop.deletePicBuffer(); 1149 852 #endif 1150 #if !NH_3D1151 853 cPicYuvTrueOrg.destroy(); 1152 #endif1153 854 1154 855 // delete buffers & classes … … 1158 859 printRateSummary(); 1159 860 1160 #if NH_3D_REN_MAX_DEV_OUT1161 Double dMaxDispDiff = m_cCameraData.getMaxShiftDeviation();1162 1163 if ( !(dMaxDispDiff < 0) )1164 {1165 printf("\n Max. possible shift error: %12.3f samples.\n", dMaxDispDiff );1166 }1167 #endif1168 861 1169 862 return; … … 1202 895 { 1203 896 rpcPicYuvRec = new TComPicYuv; 1204 #if NH_3D1205 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_depthFlag[layer] > 0 ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );1206 #else1207 897 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true ); 1208 #endif1209 898 1210 899 } … … 1284 973 if (m_pchReconFileList[layerIdx]) 1285 974 { 1286 #if NH_3D1287 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_depth420OutputFlag && m_depthFlag[layerIdx ] ? CHROMA_420 : NUM_CHROMA_FORMAT, m_isTopFieldFirst );1288 #else1289 975 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_isTopFieldFirst ); 1290 #endif1291 976 } 1292 977 } … … 1341 1026 if (m_pchReconFileList[layerIdx]) 1342 1027 { 1343 #if NH_3D1344 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_depth420OutputFlag && m_depthFlag[layerIdx ] ? CHROMA_420 : NUM_CHROMA_FORMAT );1345 #else1346 1028 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom ); 1347 #endif1348 1029 1349 1030 } … … 1470 1151 } 1471 1152 1472 #if NH_3D_DLT1473 Void TAppEncTop::xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt)1474 {1475 TComPicYuv* pcDepthPicYuvOrg = new TComPicYuv;1476 TComPicYuv* pcDepthPicYuvTrueOrg = new TComPicYuv;1477 // allocate original YUV buffer1478 pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, false );1479 pcDepthPicYuvTrueOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, false );1480 1481 TVideoIOYuv* depthVideoFile = new TVideoIOYuv;1482 1483 UInt uiMaxDepthValue = ((1 << m_inputBitDepth[CHANNEL_TYPE_LUMA])-1);1484 1485 std::vector<Bool> abValidDepths(256, false);1486 1487 depthVideoFile->open( m_pchInputFileList[layer], false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );1488 1489 Int iHeight = pcDepthPicYuvOrg->getHeight(COMPONENT_Y);1490 Int iWidth = pcDepthPicYuvOrg->getWidth(COMPONENT_Y);1491 Int iStride = pcDepthPicYuvOrg->getStride(COMPONENT_Y);1492 1493 Pel* pInDM = pcDepthPicYuvOrg->getAddr(COMPONENT_Y);1494 1495 for(Int uiFrame=0; uiFrame < uiNumFrames; uiFrame++ )1496 {1497 depthVideoFile->read( pcDepthPicYuvOrg, pcDepthPicYuvTrueOrg, IPCOLOURSPACE_UNCHANGED, m_aiPad, m_InputChromaFormatIDC, m_bClipInputVideoToRec709Range );1498 1499 // check all pixel values1500 for (Int i=0; i<iHeight; i++)1501 {1502 Int rowOffset = i*iStride;1503 1504 for (Int j=0; j<iWidth; j++)1505 {1506 Pel depthValue = pInDM[rowOffset+j];1507 abValidDepths[depthValue] = true;1508 }1509 }1510 }1511 1512 depthVideoFile->close();1513 delete depthVideoFile;1514 1515 pcDepthPicYuvOrg->destroy();1516 delete pcDepthPicYuvOrg;1517 pcDepthPicYuvTrueOrg->destroy();1518 delete pcDepthPicYuvTrueOrg;1519 1520 // convert boolean array to idx2Depth LUT1521 std::vector<Int> aiIdx2DepthValue(256, 0);1522 Int iNumDepthValues = 0;1523 for(Int p=0; p<=uiMaxDepthValue; p++)1524 {1525 if( abValidDepths[p] == true)1526 {1527 aiIdx2DepthValue[iNumDepthValues++] = p;1528 }1529 }1530 1531 if( uiNumFrames == 0 || gCeilLog2(iNumDepthValues) == m_inputBitDepth[CHANNEL_TYPE_LUMA] )1532 {1533 dlt->setUseDLTFlag(layer, false);1534 }1535 1536 // assign LUT1537 if( dlt->getUseDLTFlag(layer) )1538 {1539 dlt->setDepthLUTs(layer, aiIdx2DepthValue, iNumDepthValues);1540 }1541 }1542 #endif1543 1153 1544 1154 #if NH_MV … … 1570 1180 1571 1181 1572 #if NH_3D1573 vps.initViewCompLayer( );1574 #endif1575 1182 } 1576 1183 … … 1649 1256 Int curLayerIdInNuh = vps.getLayerIdInNuh( curLayerIdInVps ); 1650 1257 Int maxTid = -1; 1651 #if NH_3D1652 if ( vps.getDirectDependencyFlag( curLayerIdInVps, refLayerIdInVps ) )1653 {1654 if ( m_depthFlag[ curLayerIdInVps] == m_depthFlag[ refLayerIdInVps ] )1655 {1656 #endif1657 1258 for( Int i = 0; i < ( getGOPSize() + 1); i++ ) 1658 1259 { … … 1661 1262 for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++) 1662 1263 { 1663 #if NH_3D1664 if ( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[ j ] ) == refLayerIdInNuh )1665 #else1666 1264 if ( vps.getIdDirectRefLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[ j ] ) == refLayerIdInNuh ) 1667 #endif1668 1265 { 1669 1266 Bool refLayerZero = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 ); … … 1672 1269 } 1673 1270 } 1674 #if NH_3D1675 }1676 else1677 {1678 if( m_depthFlag[ curLayerIdInVps ] && ( m_mpiFlag|| m_qtPredFlag || m_intraContourFlag ) )1679 {1680 Int nuhLayerIdTex = vps.getLayerIdInNuh( vps.getViewIndex( curLayerIdInNuh ), false, 0 );1681 if ( nuhLayerIdTex == refLayerIdInNuh )1682 {1683 for( Int i = 0; i < ( getGOPSize() + 1); i++ )1684 {1685 GOPEntry geCur = m_GOPListMvc[curLayerIdInVps][( i < getGOPSize() ? i : MAX_GOP )];1686 GOPEntry geRef = m_GOPListMvc[refLayerIdInVps][( i < getGOPSize() ? i : MAX_GOP )];1687 if ( geCur.m_interCompPredFlag )1688 {1689 Bool refLayerZero = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );1690 maxTid = std::max( maxTid, refLayerZero ? 0 : geRef.m_temporalId );1691 }1692 }1693 }1694 }1695 if( !m_depthFlag[ curLayerIdInVps ] && vps.getNumRefListLayers( curLayerIdInNuh) > 0 && ( m_depthRefinementFlag || m_viewSynthesisPredFlag || m_depthBasedBlkPartFlag ) )1696 {1697 for( Int i = 0; i < ( getGOPSize() + 1); i++ )1698 {1699 GOPEntry geCur = m_GOPListMvc[curLayerIdInVps][( i < getGOPSize() ? i : MAX_GOP )];1700 GOPEntry geRef = m_GOPListMvc[refLayerIdInVps][( i < getGOPSize() ? i : MAX_GOP )];1701 1702 if ( geCur.m_interCompPredFlag )1703 {1704 for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++ )1705 {1706 Int nuhLayerIdDep = vps.getLayerIdInNuh( vps.getViewIndex( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[j] ) ), true, 0 );1707 if ( nuhLayerIdDep == refLayerIdInNuh )1708 {1709 Bool refLayerZero = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );1710 maxTid = std::max( maxTid, refLayerZero ? 0 : geRef.m_temporalId );1711 }1712 }1713 }1714 }1715 }1716 }1717 } // if ( vps.getDirectDependencyFlag( curLayerIdInVps, refLayerIdInVps ) )1718 vps.setMaxTidIlRefPicsPlus1( refLayerIdInVps, curLayerIdInVps, maxTid + 1 );1719 #endif1720 1271 } // Loop curLayerIdInVps 1721 1272 } // Loop refLayerIdInVps … … 1766 1317 1767 1318 // check if all reference layers when allRefLayerActiveFlag is equal to 1 are reference layer pictures specified in the gop entry 1768 #if NH_3D1769 for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ) && allRefLayersActiveFlag; k++ )1770 {1771 Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdRefListLayer( layerIdInNuh , k ) );1772 #else1773 1319 for (Int k = 0; k < vps.getNumDirectRefLayers( layerIdInNuh ) && allRefLayersActiveFlag; k++ ) 1774 1320 { 1775 1321 Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdDirectRefLayer( layerIdInNuh , k ) ); 1776 #endif1777 1322 if ( vps.getSubLayersVpsMaxMinus1(refLayerIdInVps) >= tId && ( tId == 0 || vps.getMaxTidIlRefPicsPlus1(refLayerIdInVps,layerIdInVps) > tId ) ) 1778 1323 { … … 1792 1337 { 1793 1338 Bool referenceLayerFoundFlag = false; 1794 #if NH_3D1795 for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ); k++ )1796 {1797 Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdRefListLayer( layerIdInNuh, k) );1798 #else1799 1339 for (Int k = 0; k < vps.getNumDirectRefLayers( layerIdInNuh ); k++ ) 1800 1340 { 1801 1341 Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdDirectRefLayer( layerIdInNuh, k) ); 1802 #endif1803 1342 if ( vps.getSubLayersVpsMaxMinus1(refLayerIdInVps) >= tId && ( tId == 0 || vps.getMaxTidIlRefPicsPlus1(refLayerIdInVps,layerIdInVps) > tId ) ) 1804 1343 { … … 1929 1468 break; 1930 1469 case Profile::MULTIVIEWMAIN: 1931 #if NH_3D1932 case Profile::MAIN3D:1933 #endif1934 1470 ptl->setMax12bitConstraintFlag ( true ); 1935 1471 ptl->setMax12bitConstraintFlag ( true ); … … 1953 1489 1954 1490 Bool anyDepth = false; 1955 #if NH_3D1956 for ( Int i = 0; i < m_numberOfLayers; i++ )1957 {1958 vps.setVpsRepFormatIdx( i, m_depthFlag[ i ] ? 1 : 0 );1959 anyDepth = anyDepth || m_depthFlag[ i ];1960 }1961 #endif1962 1491 1963 1492 vps.setRepFormatIdxPresentFlag( anyDepth ); … … 2364 1893 } 2365 1894 2366 #if NH_3D2367 Void TAppEncTop::xSetCamPara ( TComVPS& vps )2368 {2369 vps.setCpPrecision( m_cCameraData.getCamParsCodedPrecision());2370 2371 for ( Int n = 1; n < vps.getNumViews(); n++ )2372 {2373 Int i = vps.getViewOIdxList( n );2374 Int iInVps = vps.getVoiInVps ( i );2375 vps.setNumCp( iInVps, n);2376 2377 if ( vps.getNumCp( iInVps ) > 0 )2378 {2379 vps.setCpInSliceSegmentHeaderFlag( iInVps, m_cCameraData.getVaryingCameraParameters() );2380 2381 for( Int m = 0; m < vps.getNumCp( iInVps ); m++ )2382 {2383 vps.setCpRefVoi( iInVps, m, vps.getViewOIdxList( m ) );2384 if( !vps.getCpInSliceSegmentHeaderFlag( iInVps ) )2385 {2386 Int j = vps.getCpRefVoi( iInVps, m );2387 Int jInVps = vps.getVoiInVps( j );2388 2389 vps.setVpsCpScale ( iInVps, jInVps, m_cCameraData.getCodedScale() [ jInVps ][ iInVps ] ) ;2390 vps.setVpsCpInvScale( iInVps, jInVps, m_cCameraData.getCodedScale() [ iInVps ][ jInVps ] ) ;2391 vps.setVpsCpOff ( iInVps, jInVps, m_cCameraData.getCodedOffset()[ jInVps ][ iInVps ] ) ;2392 vps.setVpsCpInvOff ( iInVps, jInVps, m_cCameraData.getCodedOffset()[ iInVps ][ jInVps ] ) ;2393 }2394 }2395 }2396 }2397 vps.deriveCpPresentFlag();2398 }2399 #endif2400 1895 2401 1896 … … 2409 1904 2410 1905 2411 #if NH_3D_DLT2412 Void TAppEncTop::xDeriveDltArray( TComVPS& vps, TComDLT* dlt )2413 {2414 Int iNumDepthViews = 0;2415 Bool bDltPresentFlag = false;2416 2417 for ( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ )2418 {2419 Bool isDepth = ( vps.getDepthId( layer ) == 1 );2420 2421 if ( isDepth )2422 {2423 iNumDepthViews++;2424 }2425 2426 dlt->setUseDLTFlag( layer , isDepth && m_useDLT );2427 if( dlt->getUseDLTFlag( layer ) )2428 {2429 xAnalyzeInputBaseDepth(layer, max(m_iIntraPeriod[layer], 24), &vps, dlt);2430 bDltPresentFlag = bDltPresentFlag || dlt->getUseDLTFlag(layer);2431 dlt->setInterViewDltPredEnableFlag(layer, (dlt->getUseDLTFlag(layer) && (layer>1)));2432 2433 // ----------------------------- determine whether to use bit-map -----------------------------2434 Bool bDltBitMapRepFlag = false;2435 UInt uiNumBitsNonBitMap = 0;2436 UInt uiNumBitsBitMap = 0;2437 2438 UInt uiMaxDiff = 0;2439 UInt uiMinDiff = MAX_INT;2440 UInt uiLengthMinDiff = 0;2441 UInt uiLengthDltDiffMinusMin = 0;2442 2443 std::vector<Int> aiIdx2DepthValue_coded(256, 0);2444 UInt uiNumDepthValues_coded = 0;2445 2446 uiNumDepthValues_coded = dlt->getNumDepthValues(layer);2447 for( UInt ui = 0; ui<uiNumDepthValues_coded; ui++ )2448 {2449 aiIdx2DepthValue_coded[ui] = dlt->idx2DepthValue(layer, ui);2450 }2451 2452 if( dlt->getInterViewDltPredEnableFlag( layer ) )2453 {2454 AOF( vps.getDepthId( 1 ) == 1 );2455 AOF( layer > 1 );2456 // assumes ref layer id to be 12457 std::vector<Int> piRefDLT = dlt->idx2DepthValue( 1 );2458 UInt uiRefNum = dlt->getNumDepthValues( 1 );2459 dlt->getDeltaDLT(layer, piRefDLT, uiRefNum, aiIdx2DepthValue_coded, uiNumDepthValues_coded);2460 }2461 2462 std::vector<UInt> puiDltDiffValues(uiNumDepthValues_coded, 0);2463 2464 for (UInt d = 1; d < uiNumDepthValues_coded; d++)2465 {2466 puiDltDiffValues[d] = aiIdx2DepthValue_coded[d] - aiIdx2DepthValue_coded[d-1];2467 2468 if ( uiMaxDiff < puiDltDiffValues[d] )2469 {2470 uiMaxDiff = puiDltDiffValues[d];2471 }2472 2473 if ( uiMinDiff > puiDltDiffValues[d] )2474 {2475 uiMinDiff = puiDltDiffValues[d];2476 }2477 }2478 2479 // counting bits2480 // diff coding branch2481 uiNumBitsNonBitMap += 8; // u(v) bits for num_depth_values_in_dlt[layerId] (i.e. num_entry[ layerId ])2482 2483 if ( uiNumDepthValues_coded > 1 )2484 {2485 uiNumBitsNonBitMap += 8; // u(v) bits for max_diff[ layerId ]2486 }2487 2488 if ( uiNumDepthValues_coded > 2 )2489 {2490 uiLengthMinDiff = (UInt) gCeilLog2(uiMaxDiff + 1);2491 uiNumBitsNonBitMap += uiLengthMinDiff; // u(v) bits for min_diff[ layerId ]2492 }2493 2494 uiNumBitsNonBitMap += 8; // u(v) bits for dlt_depth_value0[ layerId ]2495 2496 if (uiMaxDiff > uiMinDiff)2497 {2498 uiLengthDltDiffMinusMin = (UInt) gCeilLog2(uiMaxDiff - uiMinDiff + 1);2499 uiNumBitsNonBitMap += uiLengthDltDiffMinusMin * (uiNumDepthValues_coded - 1); // u(v) bits for dlt_depth_value_diff_minus_min[ layerId ][ j ]2500 }2501 2502 // bit map branch2503 uiNumBitsBitMap = 1 << m_inputBitDepth[CHANNEL_TYPE_LUMA];2504 2505 // determine bDltBitMapFlag2506 bDltBitMapRepFlag = (uiNumBitsBitMap > uiNumBitsNonBitMap) ? false : true;2507 2508 dlt->setUseBitmapRep(layer, bDltBitMapRepFlag);2509 }2510 }2511 2512 dlt->setDltPresentFlag( bDltPresentFlag );2513 dlt->setNumDepthViews ( iNumDepthViews );2514 dlt->setDepthViewBitDepth( m_inputBitDepth[CHANNEL_TYPE_LUMA] );2515 }2516 #endif2517 1906 //! \} -
branches/HTM-15.2-dev1/source/App/TAppEncoder/TAppEncTop.h
r1373 r1384 46 46 #include "TLibCommon/AccessUnit.h" 47 47 #include "TAppEncCfg.h" 48 #if NH_3D_VSO49 #include "../../Lib/TLibRenderer/TRenTop.h"50 #endif51 48 52 #if KWU_RC_MADPRED_E022753 class TEncTop;54 #endif55 49 //! \ingroup TAppEncoder 56 50 //! \{ … … 90 84 #endif 91 85 92 #if NH_3D93 TComSps3dExtension m_sps3dExtension; ///< Currently all layers share the same sps 3D Extension94 #endif95 86 96 87 UInt m_essentialBytes; 97 88 UInt m_totalBytes; 98 #if NH_3D_VSO99 TRenTop m_cRendererTop;100 TRenModel m_cRendererModel;101 #endif102 89 protected: 103 90 // initialization … … 144 131 Void xSetDpbSize ( TComVPS& vps ); 145 132 Void xSetVPSVUI ( TComVPS& vps ); 146 #if NH_3D147 Void xSetCamPara ( TComVPS& vps );148 #endif149 133 GOPEntry* xGetGopEntry( Int layerIdInVps, Int poc ); 150 134 Int xGetMax( std::vector<Int>& vec); 151 135 Bool xLayerIdInTargetEncLayerIdList( Int nuhLayerId ); 152 #endif153 #if NH_3D_DLT154 Void xDeriveDltArray( TComVPS& vps, TComDLT* dlt );155 Void xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt);156 136 #endif 157 137
Note: See TracChangeset for help on using the changeset viewer.