Changeset 1072 in 3DVCSoftware
- Timestamp:
- 13 Oct 2014, 16:44:51 (12 years ago)
- Location:
- branches/HTM-12.1-MV-draft-1
- Files:
-
- 3 deleted
- 90 edited
-
cfg/3D-HEVC (deleted)
-
checklist (deleted)
-
codingresults (deleted)
-
source/App/TAppDecoder/TAppDecCfg.cpp (modified) (3 diffs)
-
source/App/TAppDecoder/TAppDecCfg.h (modified) (1 diff)
-
source/App/TAppDecoder/TAppDecTop.cpp (modified) (9 diffs)
-
source/App/TAppDecoder/TAppDecTop.h (modified) (1 diff)
-
source/App/TAppEncoder/TAppEncCfg.cpp (modified) (22 diffs)
-
source/App/TAppEncoder/TAppEncCfg.h (modified) (5 diffs)
-
source/App/TAppEncoder/TAppEncTop.cpp (modified) (15 diffs)
-
source/App/TAppEncoder/TAppEncTop.h (modified) (3 diffs)
-
source/App/TAppRenderer/RendererMain.cpp (modified) (2 diffs)
-
source/App/TAppRenderer/TAppRendererCfg.cpp (modified) (1 diff)
-
source/App/TAppRenderer/TAppRendererCfg.h (modified) (1 diff)
-
source/App/TAppRenderer/TAppRendererTop.cpp (modified) (1 diff)
-
source/App/TAppRenderer/TAppRendererTop.h (modified) (1 diff)
-
source/Lib/TAppCommon/TAppComCamPara.cpp (modified) (1 diff)
-
source/Lib/TAppCommon/TAppComCamPara.h (modified) (4 diffs)
-
source/Lib/TLibCommon/CommonDef.h (modified) (3 diffs)
-
source/Lib/TLibCommon/ContextTables.h (modified) (4 diffs)
-
source/Lib/TLibCommon/TComDataCU.cpp (modified) (79 diffs)
-
source/Lib/TLibCommon/TComDataCU.h (modified) (23 diffs)
-
source/Lib/TLibCommon/TComInterpolationFilter.cpp (modified) (9 diffs)
-
source/Lib/TLibCommon/TComInterpolationFilter.h (modified) (3 diffs)
-
source/Lib/TLibCommon/TComMotionInfo.cpp (modified) (2 diffs)
-
source/Lib/TLibCommon/TComMotionInfo.h (modified) (5 diffs)
-
source/Lib/TLibCommon/TComMv.h (modified) (5 diffs)
-
source/Lib/TLibCommon/TComPattern.h (modified) (2 diffs)
-
source/Lib/TLibCommon/TComPic.cpp (modified) (6 diffs)
-
source/Lib/TLibCommon/TComPic.h (modified) (5 diffs)
-
source/Lib/TLibCommon/TComPicYuv.cpp (modified) (2 diffs)
-
source/Lib/TLibCommon/TComPicYuv.h (modified) (2 diffs)
-
source/Lib/TLibCommon/TComPrediction.cpp (modified) (19 diffs)
-
source/Lib/TLibCommon/TComPrediction.h (modified) (4 diffs)
-
source/Lib/TLibCommon/TComRdCost.cpp (modified) (27 diffs)
-
source/Lib/TLibCommon/TComRdCost.h (modified) (14 diffs)
-
source/Lib/TLibCommon/TComRom.cpp (modified) (4 diffs)
-
source/Lib/TLibCommon/TComRom.h (modified) (3 diffs)
-
source/Lib/TLibCommon/TComSlice.cpp (modified) (24 diffs)
-
source/Lib/TLibCommon/TComSlice.h (modified) (15 diffs)
-
source/Lib/TLibCommon/TComWedgelet.cpp (modified) (1 diff)
-
source/Lib/TLibCommon/TComWedgelet.h (modified) (1 diff)
-
source/Lib/TLibCommon/TComYuv.cpp (modified) (1 diff)
-
source/Lib/TLibCommon/TComYuv.h (modified) (1 diff)
-
source/Lib/TLibCommon/TypeDef.h (modified) (10 diffs)
-
source/Lib/TLibDecoder/TDecCAVLC.cpp (modified) (17 diffs)
-
source/Lib/TLibDecoder/TDecCAVLC.h (modified) (4 diffs)
-
source/Lib/TLibDecoder/TDecCu.cpp (modified) (21 diffs)
-
source/Lib/TLibDecoder/TDecCu.h (modified) (3 diffs)
-
source/Lib/TLibDecoder/TDecEntropy.cpp (modified) (13 diffs)
-
source/Lib/TLibDecoder/TDecEntropy.h (modified) (5 diffs)
-
source/Lib/TLibDecoder/TDecGop.cpp (modified) (2 diffs)
-
source/Lib/TLibDecoder/TDecSbac.cpp (modified) (19 diffs)
-
source/Lib/TLibDecoder/TDecSbac.h (modified) (6 diffs)
-
source/Lib/TLibDecoder/TDecSlice.cpp (modified) (1 diff)
-
source/Lib/TLibDecoder/TDecTop.cpp (modified) (9 diffs)
-
source/Lib/TLibDecoder/TDecTop.h (modified) (3 diffs)
-
source/Lib/TLibEncoder/TEncCavlc.cpp (modified) (17 diffs)
-
source/Lib/TLibEncoder/TEncCavlc.h (modified) (3 diffs)
-
source/Lib/TLibEncoder/TEncCfg.h (modified) (10 diffs)
-
source/Lib/TLibEncoder/TEncCu.cpp (modified) (55 diffs)
-
source/Lib/TLibEncoder/TEncCu.h (modified) (5 diffs)
-
source/Lib/TLibEncoder/TEncEntropy.cpp (modified) (8 diffs)
-
source/Lib/TLibEncoder/TEncEntropy.h (modified) (4 diffs)
-
source/Lib/TLibEncoder/TEncGOP.cpp (modified) (18 diffs)
-
source/Lib/TLibEncoder/TEncGOP.h (modified) (5 diffs)
-
source/Lib/TLibEncoder/TEncRateCtrl.cpp (modified) (11 diffs)
-
source/Lib/TLibEncoder/TEncRateCtrl.h (modified) (10 diffs)
-
source/Lib/TLibEncoder/TEncSbac.cpp (modified) (23 diffs)
-
source/Lib/TLibEncoder/TEncSbac.h (modified) (7 diffs)
-
source/Lib/TLibEncoder/TEncSearch.cpp (modified) (93 diffs)
-
source/Lib/TLibEncoder/TEncSearch.h (modified) (12 diffs)
-
source/Lib/TLibEncoder/TEncSlice.cpp (modified) (15 diffs)
-
source/Lib/TLibEncoder/TEncSlice.h (modified) (3 diffs)
-
source/Lib/TLibEncoder/TEncTop.cpp (modified) (11 diffs)
-
source/Lib/TLibEncoder/TEncTop.h (modified) (7 diffs)
-
source/Lib/TLibExtractor/TExtrTop.cpp (modified) (2 diffs)
-
source/Lib/TLibRenderer/TRenFilter.cpp (modified) (1 diff)
-
source/Lib/TLibRenderer/TRenFilter.h (modified) (1 diff)
-
source/Lib/TLibRenderer/TRenImage.cpp (modified) (1 diff)
-
source/Lib/TLibRenderer/TRenImage.h (modified) (1 diff)
-
source/Lib/TLibRenderer/TRenImagePlane.cpp (modified) (1 diff)
-
source/Lib/TLibRenderer/TRenImagePlane.h (modified) (1 diff)
-
source/Lib/TLibRenderer/TRenInterpFilter.cpp (modified) (1 diff)
-
source/Lib/TLibRenderer/TRenInterpFilter.h (modified) (1 diff)
-
source/Lib/TLibRenderer/TRenModSetupStrParser.cpp (modified) (1 diff)
-
source/Lib/TLibRenderer/TRenModSetupStrParser.h (modified) (1 diff)
-
source/Lib/TLibRenderer/TRenModel.cpp (modified) (1 diff)
-
source/Lib/TLibRenderer/TRenModel.h (modified) (1 diff)
-
source/Lib/TLibRenderer/TRenSingleModel.cpp (modified) (1 diff)
-
source/Lib/TLibRenderer/TRenSingleModel.h (modified) (1 diff)
-
source/Lib/TLibRenderer/TRenTop.cpp (modified) (1 diff)
-
source/Lib/TLibRenderer/TRenTop.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-12.1-MV-draft-1/source/App/TAppDecoder/TAppDecCfg.cpp
r1066 r1072 68 68 string cfg_ReconFile; 69 69 string cfg_TargetDecLayerIdSetFile; 70 #if H_3D71 string cfg_ScaleOffsetFile;72 #endif73 70 74 71 po::Options opts; … … 78 75 ("ReconFile,o", cfg_ReconFile, string(""), "reconstructed YUV output file name\n" 79 76 "YUV writing is skipped if omitted") 80 #if H_3D81 ("ScaleOffsetFile,p", cfg_ScaleOffsetFile, string(""), "file with coded scales and offsets")82 #endif83 77 ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access") 84 78 ("OutputBitDepth,d", m_outputBitDepthY, 0, "bit depth of YUV output luma component (default: use 0 for native depth)") … … 118 112 m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); 119 113 120 #if H_3D121 m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str());122 #endif123 114 if (!m_pchBitstreamFile) 124 115 { -
branches/HTM-12.1-MV-draft-1/source/App/TAppDecoder/TAppDecCfg.h
r1066 r1072 63 63 #endif 64 64 Char* m_pchReconFile; ///< output reconstruction file name 65 #if H_3D66 Char* m_pchScaleOffsetFile; ///< output coded scale and offset parameters67 #endif68 65 Int m_iSkipFrame; ///< counter for frames prior to the random access point to skip 69 66 Int m_outputBitDepthY; ///< bit depth used for writing output (luma) -
branches/HTM-12.1-MV-draft-1/source/App/TAppDecoder/TAppDecTop.cpp
r1066 r1072 67 67 } 68 68 #endif 69 #if H_3D70 m_pScaleOffsetFile = 0;71 #endif72 69 73 70 #if H_MV … … 103 100 m_pchReconFile = NULL; 104 101 } 105 #if H_3D106 if (m_pchScaleOffsetFile)107 {108 free (m_pchScaleOffsetFile);109 m_pchScaleOffsetFile = NULL;110 }111 #endif112 102 } 113 103 … … 139 129 } 140 130 141 #if H_3D142 if( m_pchScaleOffsetFile )143 {144 m_pScaleOffsetFile = ::fopen( m_pchScaleOffsetFile, "wt" );145 AOF( m_pScaleOffsetFile );146 }147 #endif148 131 InputByteStream bytestream(bitstreamFile); 149 132 … … 269 252 #endif 270 253 } 271 #if H_3D272 if (nalu.m_nalUnitType == NAL_UNIT_VPS )273 {274 m_cCamParsCollector.init( m_pScaleOffsetFile, m_tDecTop[decIdx]->getPrefetchedVPS() );275 }276 #endif277 254 bNewPicture = ( newSliceDiffLayer || newSliceDiffPoc ) && !sliceSkippedFlag; 278 255 if ( nalu.isSlice() && firstSlice && !sliceSkippedFlag ) … … 350 327 #endif 351 328 #endif 352 #if H_3D353 if ( allLayersDecoded || !bitstreamFile )354 {355 for( Int dI = 0; dI < m_numDecoders; dI++ )356 {357 TComPic* picLastCoded = m_ivPicLists.getPic( m_tDecTop[dI]->getLayerId(), pocLastPic );358 assert( picLastCoded != NULL );359 picLastCoded->compressMotion(1);360 }361 }362 #endif363 329 364 330 if( pcListPic ) … … 473 439 } 474 440 #if H_MV 475 #if H_3D476 if( m_cCamParsCollector.isInitialized() )477 {478 m_cCamParsCollector.setSlice( 0 );479 }480 #endif481 441 for(UInt decIdx = 0; decIdx < m_numDecoders; decIdx++) 482 442 { … … 502 462 // initialize global variables 503 463 initROM(); 504 #if H_3D_DIM_DMM505 initWedgeLists();506 #endif507 464 #else 508 465 // create decoder class … … 542 499 // destroy decoder class 543 500 m_cTDecTop.destroy(); 544 #endif545 #if H_3D546 m_cCamParsCollector.uninit();547 if( m_pScaleOffsetFile )548 {549 ::fclose( m_pScaleOffsetFile );550 }551 501 #endif 552 502 } … … 1060 1010 m_tDecTop[ decIdx ]->setTargetOptLayerSetIdx( m_targetOptLayerSetIdx ); 1061 1011 1062 #if H_3D1063 m_tDecTop[ decIdx ]->setCamParsCollector( &m_cCamParsCollector );1064 #endif1065 1012 1066 1013 // append pic list of new decoder to PicLists -
branches/HTM-12.1-MV-draft-1/source/App/TAppDecoder/TAppDecTop.h
r976 r1072 82 82 #endif 83 83 84 #if H_3D85 FILE* m_pScaleOffsetFile;86 CamParsCollector m_cCamParsCollector;87 #endif88 84 public: 89 85 TAppDecTop(); -
branches/HTM-12.1-MV-draft-1/source/App/TAppEncoder/TAppEncCfg.cpp
r1066 r1072 83 83 m_targetPivotValue = NULL; 84 84 85 #if KWU_RC_MADPRED_E022786 m_depthMADPred = 0;87 #endif88 85 } 89 86 … … 151 148 } 152 149 } 153 #endif154 #if H_3D155 #if H_3D_VSO156 if ( m_pchVSOConfig != NULL)157 free ( m_pchVSOConfig );158 #endif159 if ( m_pchCameraParameterFile != NULL )160 free ( m_pchCameraParameterFile );161 162 if ( m_pchBaseViewCameraNumbers != NULL )163 free ( m_pchBaseViewCameraNumbers );164 150 #endif 165 151 } … … 243 229 #if H_MV_HLS10_PTL 244 230 {"multiview-main", Profile::MULTIVIEWMAIN}, 245 #if H_3D246 {"3d-main" , Profile::MAIN3D},247 #endif248 231 249 232 #else 250 233 {"main-stereo", Profile::MAINSTEREO}, 251 234 {"main-multiview", Profile::MAINMULTIVIEW}, 252 #if H_3D253 {"main-3d" , Profile::MAIN3D},254 #endif255 235 #endif 256 236 #endif … … 346 326 string cfg_tiers; 347 327 #endif 348 #if H_3D349 cfg_dimensionLength.push_back( 2 ); // depth350 cfg_dimensionLength.push_back( 32 ); // texture351 #else352 328 cfg_dimensionLength.push_back( 64 ); 353 #endif354 329 #endif 355 330 string cfg_dQPFile; … … 379 354 #if H_MV 380 355 ("NumberOfLayers", m_numberOfLayers , 1, "Number of layers") 381 #if !H_3D382 356 #if H_MV_HLS10_AUX 383 357 ("ScalabilityMask", m_scalabilityMask , 2 , "Scalability Mask: 2: Multiview, 8: Auxiliary, 10: Multiview + Auxiliary") … … 385 359 ("ScalabilityMask", m_scalabilityMask , 2 , "Scalability Mask") 386 360 #endif 387 #else388 ("ScalabilityMask", m_scalabilityMask , 3 , "Scalability Mask, 1: Texture 3: Texture + Depth ")389 #endif390 361 ("DimensionIdLen", m_dimensionIdLen , cfg_dimensionLength , "Number of bits used to store dimensions Id") 391 362 ("ViewOrderIndex", m_viewOrderIndex , std::vector<Int>(1,0), "View Order Index per layer") … … 393 364 #if H_MV_HLS10_AUX 394 365 ("AuxId", m_auxId , std::vector<Int>(1,0), "AuxId per layer") 395 #endif396 #if H_3D397 ("DepthFlag", m_depthFlag , std::vector<Int>(1,0), "Depth Flag")398 #if H_3D_DIM399 ("DMM", m_useDMM, true, "Depth intra model modes")400 #if SEPARATE_FLAG_I0085401 ("IVP", m_useIVP, true, "intra-view prediction")402 #endif403 ("SDC", m_useSDC, true, "Simplified depth coding")404 ("DLT", m_useDLT, true, "Depth lookup table")405 #endif406 #if MTK_SINGLE_DEPTH_MODE_I0095407 ("SingleDepthMode", m_useSingleDepthMode, true, "Single depth mode")408 #endif409 366 #endif 410 367 #if H_MV_HLS10_GEN_FIX … … 555 512 ("DeblockingFilterMetric", m_DeblockingFilterMetric, false ) 556 513 557 #if H_3D_ARP558 ("AdvMultiviewResPred", m_uiUseAdvResPred, (UInt)1, "Usage of Advanced Residual Prediction" )559 #endif560 #if H_3D_SPIVMP561 ("SubPULog2Size", m_iSubPULog2Size, (Int)3, "Sub-PU size index: 2^n")562 ("SubPUMPILog2Size", m_iSubPUMPILog2Size, (Int)3, "Sub-PU MPI size index: 2^n")563 #endif564 #if H_3D_IC565 ("IlluCompEnable", m_abUseIC, true, "Enable illumination compensation")566 ("IlluCompLowLatencyEnc", m_bUseLowLatencyICEnc, false, "Enable low-latency illumination compensation encoding")567 #endif568 #if H_3D_INTER_SDC569 ("InterSDC", m_bDepthInterSDCFlag, true, "Enable depth inter SDC")570 #endif571 #if H_3D_DBBP572 ("DBBP", m_bUseDBBP, true, "Enable depth-based block partitioning" )573 #endif574 #if H_3D_IV_MERGE575 ("MPI", m_bMPIFlag, true, "Enable MPI")576 #endif577 514 // Coding tools 578 515 ("AMP", m_enableAMP, true, "Enable asymmetric motion partitions") … … 642 579 ( "RCForceIntraQP", m_RCForceIntraQP, false, "Rate control: force intra QP to be equal to initial QP" ) 643 580 644 #if KWU_RC_VIEWRC_E0227645 ("ViewWiseTargetBits, -vtbr" , m_viewTargetBits, std::vector<Int>(1, 32), "View-wise target bit-rate setting")646 ("TargetBitAssign, -ta", m_viewWiseRateCtrl, false, "View-wise rate control on/off")647 #endif648 #if KWU_RC_MADPRED_E0227649 ("DepthMADPred, -dm", m_depthMADPred, (UInt)0, "Depth based MAD prediction on/off")650 #endif651 581 #if H_MV 652 582 #if H_MV_HLS10_GEN_FIX … … 790 720 #endif 791 721 #endif 792 #if H_3D793 ("CameraParameterFile,cpf", m_pchCameraParameterFile, (Char *) 0, "Camera Parameter File Name")794 ("BaseViewCameraNumbers" , m_pchBaseViewCameraNumbers, (Char *) 0, "Numbers of base views")795 ("CodedCamParsPrecision", m_iCodedCamParPrecision, STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )796 /* View Synthesis Optimization */797 798 #if H_3D_VSO799 ("VSOConfig", m_pchVSOConfig , (Char *) 0 , "VSO configuration")800 ("VSO", m_bUseVSO , false , "Use VSO" )801 ("VSOMode", m_uiVSOMode , (UInt) 4 , "VSO Mode")802 ("LambdaScaleVSO", m_dLambdaScaleVSO , (Double) 1 , "Lambda Scaling for VSO")803 ("VSOLSTable", m_bVSOLSTable , true , "Depth QP dependent video/depth rate allocation by Lagrange multiplier" )804 ("ForceLambdaScaleVSO", m_bForceLambdaScaleVSO , false , "Force using Lambda Scale VSO also in non-VSO-Mode")805 ("AllowNegDist", m_bAllowNegDist , true , "Allow negative Distortion in VSO")806 807 ("UseEstimatedVSD", m_bUseEstimatedVSD , true , "Model based VSD estimation instead of rendering based for some encoder decisions" )808 ("VSOEarlySkip", m_bVSOEarlySkip , true , "Early skip of VSO computation if synthesis error assumed to be zero" )809 810 ("WVSO", m_bUseWVSO , true , "Use depth fidelity term for VSO" )811 ("VSOWeight", m_iVSOWeight , 10 , "Synthesized View Distortion Change weight" )812 ("VSDWeight", m_iVSDWeight , 1 , "View Synthesis Distortion estimate weight" )813 ("DWeight", m_iDWeight , 1 , "Depth Distortion weight" )814 815 #endif //HHI_VSO816 #if MTK_I0099_VPS_EX2817 ("LimQtPredFlag", m_bLimQtPredFlag , true , "Use Predictive Coding with QTL" )818 #endif819 #if !MTK_I0099_VPS_EX2 || MTK_I0099_FIX820 #if H_3D_QTLPC821 ("QTL", m_bUseQTL , true , "Use depth Quadtree Limitation" )822 #if !MTK_I0099_VPS_EX2823 ("PC", m_bUsePC , true , "Use Predictive Coding with QTL" )824 #endif825 #endif826 #endif827 #if H_3D_IV_MERGE828 ("IvMvPred", m_ivMvPredFlag , std::vector<Bool>(2, true) , "inter view motion prediction " )829 #endif830 #if H_3D_NBDV_REF831 ("DepthRefinement", m_depthRefinementFlag, true , "depth refinement by DoNBDV" )832 #endif833 #if H_3D_VSP834 ("ViewSynthesisPred", m_viewSynthesisPredFlag, true , "view synthesis prediction " )835 #endif836 #if H_3D837 ("IvMvScaling", m_ivMvScalingFlag , true , "inter view motion vector scaling" )838 #endif839 #endif //H_3D840 722 ; 841 723 … … 1086 968 #endif 1087 969 1088 #if H_3D1089 xResizeVector( m_depthFlag );1090 #endif1091 970 xResizeVector( m_fQP ); 1092 971 … … 1239 1118 if( cfg_profiles.empty() ) 1240 1119 { 1241 #if H_3D1242 cfg_profiles = string("main main 3d-main");1243 #else1244 1120 cfg_profiles = string("main main multiview-main"); 1245 #endif1246 1121 fprintf(stderr, "\nWarning: No profiles given, using defaults: %s", cfg_profiles.c_str() ); 1247 1122 anyEmpty = true; … … 1283 1158 #endif 1284 1159 #endif 1285 #if H_3D 1160 // check validity of input parameters 1161 xCheckParameter(); 1162 1286 1163 // set global varibles 1287 1164 xSetGlobal(); 1288 #if H_3D_VSO1289 // Table base optimization1290 // Q&D1291 Double adLambdaScaleTable[] =1292 { 0.031250, 0.031639, 0.032029, 0.032418, 0.032808, 0.033197, 0.033586, 0.033976, 0.034365, 0.034755,1293 0.035144, 0.035533, 0.035923, 0.036312, 0.036702, 0.037091, 0.037480, 0.037870, 0.038259, 0.038648,1294 0.039038, 0.039427, 0.039817, 0.040206, 0.040595, 0.040985, 0.041374, 0.041764, 0.042153, 0.042542,1295 0.042932, 0.043321, 0.043711, 0.044100, 0.044194, 0.053033, 0.061872, 0.070711, 0.079550, 0.088388,1296 0.117851, 0.147314, 0.176777, 0.235702, 0.294628, 0.353553, 0.471405, 0.589256, 0.707107, 0.707100,1297 0.753550, 0.8000001298 };1299 if ( m_bUseVSO && m_bVSOLSTable )1300 {1301 Int firstDepthLayer = -1;1302 for (Int layer = 0; layer < m_numberOfLayers; layer++ )1303 {1304 if ( m_depthFlag[ layer ])1305 {1306 firstDepthLayer = layer;1307 break;1308 }1309 }1310 AOT( firstDepthLayer == -1 );1311 AOT( (m_iQP[firstDepthLayer] < 0) || (m_iQP[firstDepthLayer] > 51));1312 m_dLambdaScaleVSO *= adLambdaScaleTable[m_iQP[firstDepthLayer]];1313 }1314 #endif1315 #if H_3D_VSO1316 if ( m_bUseVSO && m_uiVSOMode == 4)1317 {1318 m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig );1319 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),1320 g_bitDepthY,1321 (UInt)m_iCodedCamParPrecision,1322 m_FrameSkip,1323 (UInt)m_framesToBeEncoded,1324 m_pchCameraParameterFile,1325 m_pchBaseViewCameraNumbers,1326 NULL,1327 m_cRenModStrParser.getSynthViews(),1328 LOG2_DISP_PREC_LUT );1329 }1330 else if ( m_bUseVSO && m_uiVSOMode != 4 )1331 {1332 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),1333 g_bitDepthY,1334 (UInt)m_iCodedCamParPrecision,1335 m_FrameSkip,1336 (UInt)m_framesToBeEncoded,1337 m_pchCameraParameterFile,1338 m_pchBaseViewCameraNumbers,1339 m_pchVSOConfig,1340 NULL,1341 LOG2_DISP_PREC_LUT );1342 }1343 else1344 {1345 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),1346 g_bitDepthY,1347 (UInt) m_iCodedCamParPrecision,1348 m_FrameSkip,1349 (UInt) m_framesToBeEncoded,1350 m_pchCameraParameterFile,1351 m_pchBaseViewCameraNumbers,1352 NULL,1353 NULL,1354 LOG2_DISP_PREC_LUT );1355 }1356 #else1357 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),1358 g_bitDepthY,1359 (UInt) m_iCodedCamParPrecision,1360 m_FrameSkip,1361 (UInt) m_framesToBeEncoded,1362 m_pchCameraParameterFile,1363 m_pchBaseViewCameraNumbers,1364 NULL,1365 NULL,1366 LOG2_DISP_PREC_LUT );1367 #endif1368 m_cCameraData.check( false, true );1369 #endif1370 // check validity of input parameters1371 xCheckParameter();1372 1373 #if !H_3D1374 // set global varibles1375 xSetGlobal();1376 #endif1377 1165 1378 1166 // print-out parameters … … 1428 1216 xConfirmPara( (m_layerIdInNuh.size()!=1) && (m_layerIdInNuh.size() < m_numberOfLayers) , "LayerIdInNuh must be given for all layers. "); 1429 1217 1430 #if H_3D1431 xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 3, "Scalability Mask must be equal to 2 or 3. ");1432 #else1433 1218 #if H_MV_HLS10_AUX 1434 1219 xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 8 && m_scalabilityMask != 10, "Scalability Mask must be equal to 2, 8 or 10"); … … 1436 1221 xConfirmPara( m_scalabilityMask != 2 , "Scalability Mask must be equal to 2. "); 1437 1222 #endif 1438 #endif 1439 1440 #if H_3D 1441 if ( m_scalabilityMask & ( 1 << DEPTH_ID ) ) 1442 { 1443 m_dimIds.push_back( m_depthFlag ); 1444 } 1445 #endif 1223 1446 1224 1447 1225 m_dimIds.push_back( m_viewOrderIndex ); … … 1512 1290 xConfirmPara( allEqual , "Each layer shall have a different position in scalability space." ); 1513 1291 1514 #if !H_3D_FCO1515 1292 if ( numDiff == 1 ) 1516 1293 { … … 1523 1300 xConfirmPara( shallBeButIsNotIncreasing, "DimensionIds shall be increasing within one dimension. " ); 1524 1301 } 1525 #endif1526 1302 } 1527 1303 } … … 1725 1501 xConfirmPara( m_maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller."); 1726 1502 1727 #if H_3D_ARP1728 xConfirmPara( ( 0 != m_uiUseAdvResPred ) && ( 1 != m_uiUseAdvResPred ), "UseAdvResPred must be 0 or 1." );1729 #endif1730 #if H_3D_SPIVMP1731 xConfirmPara( m_iSubPULog2Size < 3, "SubPULog2Size must be 3 or greater.");1732 xConfirmPara( m_iSubPULog2Size > 6, "SubPULog2Size must be 6 or smaller.");1733 xConfirmPara( (1<<m_iSubPULog2Size) > m_uiMaxCUWidth, "SubPULog2Size must be log2(maxCUSize) or smaller.");1734 1735 xConfirmPara( m_iSubPUMPILog2Size < 3, "SubPUMPILog2Size must be 3 or greater.");1736 xConfirmPara( m_iSubPUMPILog2Size > 6, "SubPUMPILog2Size must be 6 or smaller.");1737 xConfirmPara( ( 1 << m_iSubPUMPILog2Size ) > m_uiMaxCUWidth, "SubPUMPILog2Size must be log2(maxCUSize) or smaller.");1738 #endif1739 1503 #if ADAPTIVE_QP_SELECTION 1740 1504 #if H_MV … … 1783 1547 xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling"); 1784 1548 1785 #if H_3D1786 xConfirmPara( m_pchCameraParameterFile == 0 , "CameraParameterFile must be given");1787 xConfirmPara( m_pchBaseViewCameraNumbers == 0 , "BaseViewCameraNumbers must be given" );1788 #if BUG_FIX_TK651789 xConfirmPara( ( ((UInt) m_numberOfLayers >> 1 ) != m_cCameraData.getBaseViewNumbers().size() ) && ( m_numberOfLayers != m_cCameraData.getBaseViewNumbers().size() ), "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );1790 #else1791 xConfirmPara( ((UInt) m_numberOfLayers >> 1 ) != m_cCameraData.getBaseViewNumbers().size(), "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );1792 #endif1793 xConfirmPara ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5, "CodedCamParsPrecision must be in range of 0..5" );1794 #if H_3D_VSO1795 if( m_bUseVSO )1796 {1797 xConfirmPara( m_pchVSOConfig == 0 , "VSO Setup string must be given");1798 xConfirmPara( m_uiVSOMode > 4 , "VSO Mode must be less than 5");1799 }1800 #endif1801 #endif1802 1549 // max CU width and height should be power of 2 1803 1550 UInt ui = m_uiMaxCUWidth; … … 2512 2259 #endif 2513 2260 #endif 2514 #if H_3D2515 xPrintParaVector( "DepthFlag", m_depthFlag );2516 printf("Coded Camera Param. Precision: %d\n", m_iCodedCamParPrecision);2517 #endif2518 2261 #if H_MV 2519 2262 xPrintParaVector( "QP" , m_fQP ); … … 2575 2318 printf("ForceIntraQP : %d\n", m_RCForceIntraQP ); 2576 2319 2577 #if KWU_RC_MADPRED_E02272578 printf("Depth based MAD prediction : %d\n", m_depthMADPred);2579 #endif2580 #if KWU_RC_VIEWRC_E02272581 printf("View-wise Rate control : %d\n", m_viewWiseRateCtrl);2582 if(m_viewWiseRateCtrl)2583 {2584 2585 printf("ViewWiseTargetBits : ");2586 for (Int i = 0 ; i < m_iNumberOfViews ; i++)2587 printf("%d ", m_viewTargetBits[i]);2588 printf("\n");2589 }2590 else2591 {2592 printf("TargetBitrate : %d\n", m_RCTargetBitrate );2593 }2594 #endif2595 2320 } 2596 2321 printf("Max Num Merge Candidates : %d\n", m_maxNumMergeCand); 2597 #if H_3D2598 printf("BaseViewCameraNumbers : %s\n", m_pchBaseViewCameraNumbers );2599 printf("Coded Camera Param. Precision: %d\n", m_iCodedCamParPrecision);2600 #if H_3D_VSO2601 printf("Force use of Lambda Scale : %d\n", m_bForceLambdaScaleVSO );2602 2603 if ( m_bUseVSO )2604 {2605 printf("VSO Lambda Scale : %5.2f\n", m_dLambdaScaleVSO );2606 printf("VSO Mode : %d\n", m_uiVSOMode );2607 printf("VSO Config : %s\n", m_pchVSOConfig );2608 printf("VSO Negative Distortion : %d\n", m_bAllowNegDist ? 1 : 0);2609 printf("VSO LS Table : %d\n", m_bVSOLSTable ? 1 : 0);2610 printf("VSO Estimated VSD : %d\n", m_bUseEstimatedVSD ? 1 : 0);2611 printf("VSO Early Skip : %d\n", m_bVSOEarlySkip ? 1 : 0);2612 if ( m_bUseWVSO )2613 printf("Dist. Weights (VSO/VSD/SAD) : %d/%d/%d\n ", m_iVSOWeight, m_iVSDWeight, m_iDWeight );2614 }2615 #endif //HHI_VSO2616 #endif //H_3D2617 2322 printf("\n"); 2618 2323 #if H_MV … … 2672 2377 printf(" SignBitHidingFlag:%d ", m_signHideFlag); 2673 2378 printf("RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 ); 2674 #if H_3D_VSO2675 printf("VSO:%d ", m_bUseVSO );2676 printf("WVSO:%d ", m_bUseWVSO );2677 #endif2678 #if MTK_I0099_VPS_EX22679 printf("LimQtPredFlag:%d ", m_bLimQtPredFlag ? 1 : 0);2680 #endif2681 #if !MTK_I0099_VPS_EX2 || MTK_I0099_FIX2682 #if H_3D_QTLPC2683 printf("QTL:%d ", m_bUseQTL);2684 #if !MTK_I0099_VPS_EX22685 printf("PC:%d " , m_bUsePC );2686 #endif2687 #endif2688 #endif2689 #if H_3D_IV_MERGE2690 printf("IvMvPred:%d %d", m_ivMvPredFlag[0] ? 1 : 0, m_ivMvPredFlag[1] ? 1 : 0);2691 #if H_3D_SPIVMP2692 printf(" SubPULog2Size:%d " , m_iSubPULog2Size );2693 printf(" SubPUMPILog2Size:%d " , m_iSubPUMPILog2Size );2694 #endif2695 #endif2696 #if H_3D_ARP2697 printf(" ARP:%d ", m_uiUseAdvResPred );2698 #endif2699 #if H_3D_IC2700 printf( "IlluCompEnable:%d ", m_abUseIC);2701 printf ("IlluCompLowLatencyEnc:%d ", m_bUseLowLatencyICEnc);2702 #endif2703 #if H_3D_NBDV_REF2704 printf("DepthRefinement:%d ", m_depthRefinementFlag );2705 #endif2706 #if H_3D_VSP2707 printf("ViewSynthesisPred:%d ", m_viewSynthesisPredFlag );2708 #endif2709 #if H_3D2710 printf("IvMvScaling:%d ", m_ivMvScalingFlag ? 1 : 0 );2711 #endif2712 #if H_3D_DIM2713 printf("DMM:%d ", m_useDMM );2714 #if SEPARATE_FLAG_I00852715 printf("IVP:%d ", m_useIVP );2716 #endif2717 printf("SDC:%d ", m_useSDC );2718 printf("DLT:%d ", m_useDLT );2719 #endif2720 #if MTK_SINGLE_DEPTH_MODE_I00952721 printf("SingleDepthMode:%d ", m_useSingleDepthMode);2722 #endif2723 #if H_3D_INTER_SDC2724 printf( "interSDC:%d ", m_bDepthInterSDCFlag ? 1 : 0 );2725 #endif2726 #if H_3D_DBBP2727 printf("DBBP:%d ", m_bUseDBBP ? 1 : 0);2728 #endif2729 #if H_3D_IV_MERGE2730 printf( "MPI:%d ", m_bMPIFlag ? 1 : 0 );2731 #endif2732 2379 printf("\n\n"); 2733 2380 -
branches/HTM-12.1-MV-draft-1/source/App/TAppEncoder/TAppEncCfg.h
r1066 r1072 43 43 #include "TLibEncoder/TEncCfg.h" 44 44 #include <sstream> 45 #if H_3D46 #include "TAppCommon/TAppComCamPara.h"47 #include "TLibRenderer/TRenModel.h"48 #include "TLibRenderer/TRenModSetupStrParser.h"49 #endif50 45 //! \ingroup TAppEncoder 51 46 //! \{ … … 80 75 #if H_MV_HLS10_AUX 81 76 std::vector<Int> m_auxId; ///< auxiliary id 82 #endif83 #if H_3D84 std::vector<Int> m_depthFlag; ///< depth flag85 77 #endif 86 78 #if H_MV_HLS10_GEN_FIX … … 144 136 145 137 146 #if H_3D_IV_MERGE147 vector<Bool> m_ivMvPredFlag; ///< Interview motion vector prediction148 #if H_3D_SPIVMP149 Int m_iSubPULog2Size;150 Int m_iSubPUMPILog2Size;151 #endif152 #endif153 #if MTK_I0099_VPS_EX2154 Bool m_bLimQtPredFlag;155 #endif156 #if H_3D_ARP /// < flag and number of weighting factors in ARP157 UInt m_uiUseAdvResPred;158 UInt m_uiARPStepNum;159 #endif160 #if H_3D_IC161 Bool m_abUseIC;162 Bool m_bUseLowLatencyICEnc;163 #endif164 #if H_3D_NBDV_REF165 Bool m_depthRefinementFlag;166 #endif167 #if H_3D_VSP168 Bool m_viewSynthesisPredFlag;169 #endif170 #if H_3D171 Bool m_ivMvScalingFlag;172 #endif173 138 #endif 174 139 Double m_adLambdaModifier[ MAX_TLAYER ]; ///< Lambda modifier array for each temporal layer … … 409 374 Bool m_RCForceIntraQP; ///< force all intra picture to use initial QP or not 410 375 411 #if KWU_RC_VIEWRC_E0227412 vector<Int> m_viewTargetBits;413 Bool m_viewWiseRateCtrl; ///< Flag for using view-wise rate control414 #endif415 #if KWU_RC_MADPRED_E0227416 UInt m_depthMADPred;417 #endif418 376 Int m_useScalingListId; ///< using quantization matrix 419 377 Char* m_scalingListFile; ///< quantization matrix file name … … 472 430 #endif 473 431 #endif 474 #if H_3D475 // Camera parameters476 Char* m_pchCameraParameterFile; ///< camera parameter file477 Char* m_pchBaseViewCameraNumbers;478 TAppComCamPara m_cCameraData;479 Int m_iCodedCamParPrecision; ///< precision for coding of camera parameters480 #if H_3D_VSO481 Char* m_pchVSOConfig;482 Bool m_bUseVSO; ///< flag for using View Synthesis Optimization483 Bool m_bVSOLSTable; ///< Depth QP dependent Lagrange parameter optimization (m23714)484 Bool m_bVSOEarlySkip; ///< Early skip of VSO computation (JCT3V-A0093 modification 4)485 486 //// Used for development by GT, might be removed later487 Double m_dLambdaScaleVSO; ///< Scaling factor for Lambda in VSO mode488 Bool m_bForceLambdaScaleVSO; ///< Use Lambda Scale for depth even if VSO is turned off489 Bool m_bAllowNegDist; ///< Allow negative distortion in VSO490 UInt m_uiVSOMode; ///< Number of VSO Mode, 1 = , 2 = simple, org vs. ren, 3 = simple, ren vs. ren, 4 = full491 492 // SAIT_VSO_EST_A0033493 Bool m_bUseEstimatedVSD; ///< Flag for using model based VSD estimation instead of VSO for some encoder decisions (JCT3V-A0033 modification 3)494 495 // LGE_WVSO_A0119496 Bool m_bUseWVSO; ///< flag for using View Synthesis Optimization497 Int m_iVSOWeight;498 Int m_iVSDWeight;499 Int m_iDWeight;500 501 // Ren Model String502 TRenModSetupStrParser m_cRenModStrParser;503 #endif504 #if H_3D_DIM505 Bool m_useDMM; ///< flag for using DMM506 #if SEPARATE_FLAG_I0085507 Bool m_useIVP;508 #endif509 Bool m_useSDC; ///< flag for using SDC510 Bool m_useDLT; ///< flag for using DLT511 #endif512 #if MTK_SINGLE_DEPTH_MODE_I0095513 Bool m_useSingleDepthMode; ///< flag for using single depth mode514 #endif515 #if !MTK_I0099_VPS_EX2 || MTK_I0099_FIX516 #if H_3D_QTLPC517 Bool m_bUseQTL; ///< flag for using depth QuadTree Limitation518 #if !MTK_I0099_VPS_EX2519 Bool m_bUsePC; ///< flag for using Predictive Coding with QTL520 #endif521 #endif522 #endif523 #if H_3D_INTER_SDC524 Bool m_bDepthInterSDCFlag; ///< flag for inter SDC of depth map coding525 #endif526 #if H_3D_DBBP527 Bool m_bUseDBBP; ///< flag for depth-based block partitioning528 #endif529 #if H_3D_IV_MERGE530 Bool m_bMPIFlag; ///< flag for MPI of depth map coding531 #endif532 #endif533 432 // internal member functions 534 433 Void xSetGlobal (); ///< set global variables -
branches/HTM-12.1-MV-draft-1/source/App/TAppEncoder/TAppEncTop.cpp
r1066 r1072 86 86 #endif 87 87 88 #if H_3D89 vps.createCamPars(m_iNumberOfViews);90 TComDLT& dlt = m_dlt;91 #endif92 88 93 89 #if H_MV … … 139 135 xSetDpbSize ( vps ); 140 136 xSetVPSVUI ( vps ); 141 #if H_3D142 xSetVPSExtension2 ( vps );143 m_ivPicLists.setVPS ( &vps );144 xDeriveDltArray ( vps, dlt );145 #endif146 137 #if H_MV_HLS10_GEN_FIX 147 138 if ( m_targetEncLayerIdList.size() == 0 ) … … 195 186 m_cTEncTop.setViewId ( vps.getViewId ( layerId ) ); 196 187 m_cTEncTop.setViewIndex ( vps.getViewIndex ( layerId ) ); 197 #if H_3D198 Bool isDepth = ( vps.getDepthId ( layerId ) != 0 ) ;199 m_cTEncTop.setIsDepth ( isDepth );200 //====== Camera Parameters =========201 m_cTEncTop.setCameraParameters ( &m_cCameraData );202 m_cTEncTop.setCamParPrecision ( m_cCameraData.getCamParsCodedPrecision () );203 m_cTEncTop.setCamParInSliceHeader ( m_cCameraData.getVaryingCameraParameters() );204 m_cTEncTop.setCodedScale ( m_cCameraData.getCodedScale () );205 m_cTEncTop.setCodedOffset ( m_cCameraData.getCodedOffset () );206 #if H_3D_VSO207 //====== VSO =========208 m_cTEncTop.setRenderModelParameters ( &m_cRenModStrParser );209 m_cTEncTop.setForceLambdaScaleVSO ( isDepth ? m_bForceLambdaScaleVSO : false );210 m_cTEncTop.setLambdaScaleVSO ( isDepth ? m_dLambdaScaleVSO : 1 );211 m_cTEncTop.setVSOMode ( isDepth ? m_uiVSOMode : 0 );212 213 m_cTEncTop.setAllowNegDist ( isDepth ? m_bAllowNegDist : false );214 215 // SAIT_VSO_EST_A0033216 m_cTEncTop.setUseEstimatedVSD ( isDepth ? m_bUseEstimatedVSD : false );217 218 // LGE_WVSO_A0119219 m_cTEncTop.setUseWVSO ( isDepth ? m_bUseWVSO : false );220 m_cTEncTop.setVSOWeight ( isDepth ? m_iVSOWeight : 0 );221 m_cTEncTop.setVSDWeight ( isDepth ? m_iVSDWeight : 0 );222 m_cTEncTop.setDWeight ( isDepth ? m_iDWeight : 0 );223 #endif // H_3D_VSO224 #if H_3D_SPIVMP225 m_cTEncTop.setSubPULog2Size (( isDepth || 0==layerIdInVps ) ? 0 : m_iSubPULog2Size );226 m_cTEncTop.setSubPUMPILog2Size ( !isDepth ? 0 : m_iSubPUMPILog2Size );227 #endif228 #if H_3D_IC229 m_cTEncTop.setUseIC ( vps.getViewIndex( layerId ) == 0 || isDepth ? false : m_abUseIC );230 m_cTEncTop.setUseICLowLatencyEnc ( m_bUseLowLatencyICEnc );231 #endif232 //========== Depth intra modes ==========233 #if H_3D_DIM234 m_cTEncTop.setUseDMM ( isDepth ? m_useDMM : false );235 #if SEPARATE_FLAG_I0085236 #if LGE_FCO_I0116237 m_cTEncTop.setUseIVP ( vps.getViewIndex( layerId ) == 0 && isDepth ? m_useIVP : false );238 #else239 m_cTEncTop.setUseIVP ( isDepth ? m_useIVP : false );240 #endif241 #endif242 m_cTEncTop.setUseSDC ( isDepth ? m_useSDC : false );243 m_cTEncTop.setUseDLT ( isDepth ? m_useDLT : false );244 #endif245 #if MTK_SINGLE_DEPTH_MODE_I0095246 m_cTEncTop.setUseSingleDepthMode ( isDepth ? m_useSingleDepthMode : false );247 #endif248 #if !MTK_I0099_VPS_EX2 || MTK_I0099_FIX249 #if H_3D_QTLPC250 #if LGE_FCO_I0116251 m_cTEncTop.setUseQTL ( vps.getViewIndex( layerId ) == 0 && isDepth ? m_bUseQTL : false );252 #else253 m_cTEncTop.setUseQTL ( isDepth ? m_bUseQTL : false );254 #endif255 #if !MTK_I0099_VPS_EX2256 m_cTEncTop.setUsePC ( isDepth ? m_bUsePC : false );257 #endif258 #endif259 #endif260 //====== Depth Inter SDC =========261 #if H_3D_INTER_SDC262 m_cTEncTop.setInterSDCEnable ( isDepth ? m_bDepthInterSDCFlag : false );263 #endif264 #if H_3D_DBBP265 m_cTEncTop.setUseDBBP ( vps.getViewIndex( layerId ) == 0 || isDepth ? false : m_bUseDBBP );266 #endif267 #if H_3D_IV_MERGE268 #if LGE_FCO_I0116269 m_cTEncTop.setUseMPI ( vps.getViewIndex( layerId ) == 0 && isDepth ? m_bMPIFlag : false );270 #else271 m_cTEncTop.setUseMPI ( isDepth ? m_bMPIFlag : false );272 #endif273 #endif274 #endif // H_3D275 188 276 189 m_cTEncTop.setIvPicLists ( &m_ivPicLists ); … … 278 191 m_cTEncTop.setVPS(&vps); 279 192 280 #if H_3D281 m_cTEncTop.setDLT(&dlt);282 #endif283 193 284 194 #if H_MV … … 527 437 m_cTEncTop.setScalingListFile ( m_scalingListFile ); 528 438 m_cTEncTop.setSignHideFlag(m_signHideFlag); 529 #if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227530 if(!m_cTEncTop.getIsDepth()) //only for texture531 {532 439 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl ); 533 }534 else535 {536 m_cTEncTop.setUseRateCtrl ( 0 );537 }538 #else539 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl );540 #endif541 #if !KWU_RC_VIEWRC_E0227542 440 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate ); 543 #endif544 441 m_cTEncTop.setKeepHierBit ( m_RCKeepHierarchicalBit ); 545 442 m_cTEncTop.setLCULevelRC ( m_RCLCULevelRC ); … … 547 444 m_cTEncTop.setInitialQP ( m_RCInitialQP ); 548 445 m_cTEncTop.setForceIntraQP ( m_RCForceIntraQP ); 549 #if KWU_RC_MADPRED_E0227550 if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())551 {552 m_cTEncTop.setUseDepthMADPred(layerIdInVps ? m_depthMADPred : 0);553 if(m_cTEncTop.getUseDepthMADPred())554 {555 m_cTEncTop.setCamParam(&m_cCameraData);556 }557 }558 #endif559 #if KWU_RC_VIEWRC_E0227560 if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())561 {562 m_cTEncTop.setUseViewWiseRateCtrl(m_viewWiseRateCtrl);563 if(m_iNumberOfViews == 1)564 {565 if(m_viewWiseRateCtrl)566 {567 m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);568 }569 else570 {571 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate );572 }573 }574 else575 {576 if(m_viewWiseRateCtrl)577 {578 m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);579 }580 else581 {582 if(m_iNumberOfViews == 2)583 {584 if(m_cTEncTop.getViewId() == 0)585 {586 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*80)/100 );587 }588 else if(m_cTEncTop.getViewId() == 1)589 {590 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*20)/100 );591 }592 }593 else if(m_iNumberOfViews == 3)594 {595 if(m_cTEncTop.getViewId() == 0)596 {597 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*66)/100 );598 }599 else if(m_cTEncTop.getViewId() == 1)600 {601 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*17)/100 );602 }603 else if(m_cTEncTop.getViewId() == 2)604 {605 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*17)/100 );606 }607 }608 else609 {610 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate );611 }612 }613 }614 }615 #endif616 446 m_cTEncTop.setTransquantBypassEnableFlag(m_TransquantBypassEnableFlag); 617 447 m_cTEncTop.setCUTransquantBypassFlagForceValue(m_CUTransquantBypassFlagForce); … … 651 481 } 652 482 #endif 653 #if H_3D_VSO654 if ( m_bUseVSO )655 {656 if ( m_uiVSOMode == 4 )657 {658 #if H_3D_VSO_EARLY_SKIP659 m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip );660 #else661 m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 );662 #endif663 for ( Int layer = 0; layer < m_numberOfLayers ; layer++ )664 {665 TEncTop* pcEncTop = m_acTEncTopList[ layer ];666 Int iViewNum = pcEncTop->getViewIndex();667 Int iContent = pcEncTop->getIsDepth() ? 1 : 0;668 Int iNumOfModels = m_cRenModStrParser.getNumOfModelsForView(iViewNum, iContent);669 670 Bool bUseVSO = (iNumOfModels != 0);671 672 pcEncTop->setUseVSO( bUseVSO );673 pcEncTop->getRdCost()->setRenModel( bUseVSO ? &m_cRendererModel : NULL );674 675 for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ )676 {677 Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode;678 679 m_cRenModStrParser.getSingleModelData ( iViewNum, iContent, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ;680 m_cRendererModel .createSingleModel ( iViewNum, iContent, iModelNum, iLeftViewNum, iRightViewNum, (iOrgRefNum != -1), iBlendMode );681 }682 }683 }684 else685 {686 AOT(true);687 }688 }689 #endif690 483 } 691 484 … … 695 488 // initialize global variables 696 489 initROM(); 697 #if H_3D_DIM_DMM698 initWedgeLists( true );699 #endif700 490 701 491 for( Int layer=0; layer < m_numberOfLayers; layer++) … … 756 546 Void TAppEncTop::xInitLib(Bool isFieldCoding) 757 547 { 758 #if H_3D759 for ( Int viewIndex = 0; viewIndex < m_vps->getNumViews(); viewIndex++ )760 {761 m_vps->initCamParaVPS( viewIndex, true, m_cCameraData.getCamParsCodedPrecision(),762 m_cCameraData.getVaryingCameraParameters(), m_cCameraData.getCodedScale(), m_cCameraData.getCodedOffset() );763 }764 #endif765 548 766 549 #if H_MV 767 550 for(Int layer=0; layer<m_numberOfLayers; layer++) 768 551 { 769 #if KWU_RC_MADPRED_E0227770 m_acTEncTopList[layer]->init( isFieldCoding, this );771 #else772 552 m_acTEncTopList[layer]->init( isFieldCoding ); 773 #endif774 553 } 775 554 #else … … 885 664 for ( Int gopId=0; gopId < gopSize; gopId++ ) 886 665 { 887 #if H_3D888 UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId );889 if ( iNextPoc < m_framesToBeEncoded )890 {891 m_cCameraData.update( iNextPoc );892 }893 #endif894 666 for(Int layer=0; layer < m_numberOfLayers; layer++ ) 895 667 { … … 901 673 #endif 902 674 903 #if H_3D_VSO 904 if( m_bUseVSO && m_bUseEstimatedVSD && iNextPoc < m_framesToBeEncoded ) 905 { 906 m_cCameraData.setDispCoeff( iNextPoc, m_acTEncTopList[layer]->getViewIndex() ); 907 m_acTEncTopList[layer] ->setDispCoeff( m_cCameraData.getDispCoeff() ); 908 } 909 #endif 910 911 #if H_3D_DDD 912 m_acTEncTopList[ layer ]->getSliceEncoder()->setDDDPar( m_cCameraData.getCodedScale()[0][ m_acTEncTopList[layer]->getViewIndex() ], 913 m_cCameraData.getCodedOffset()[0][ m_acTEncTopList[layer]->getViewIndex() ], 914 m_cCameraData.getCamParsCodedPrecision() ); 915 #endif 675 916 676 Int iNumEncoded = 0; 917 677 … … 996 756 printRateSummary(); 997 757 998 #if H_3D_REN_MAX_DEV_OUT999 Double dMaxDispDiff = m_cCameraData.getMaxShiftDeviation();1000 1001 if ( !(dMaxDispDiff < 0) )1002 {1003 printf("\n Max. possible shift error: %12.3f samples.\n", dMaxDispDiff );1004 }1005 #endif1006 758 1007 759 return; … … 1249 1001 } 1250 1002 1251 #if H_3D_DIM_DLT1252 Void TAppEncTop::xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt)1253 {1254 TComPicYuv* pcDepthPicYuvOrg = new TComPicYuv;1255 // allocate original YUV buffer1256 pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );1257 1258 TVideoIOYuv* depthVideoFile = new TVideoIOYuv;1259 1260 UInt uiMaxDepthValue = ((1 << g_bitDepthY)-1);1261 1262 Bool abValidDepths[256];1263 1264 depthVideoFile->open( m_pchInputFileList[layer], false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC ); // read mode1265 1266 // initialize boolean array1267 for(Int p=0; p<=uiMaxDepthValue; p++)1268 abValidDepths[p] = false;1269 1270 Int iHeight = pcDepthPicYuvOrg->getHeight();1271 Int iWidth = pcDepthPicYuvOrg->getWidth();1272 Int iStride = pcDepthPicYuvOrg->getStride();1273 1274 Pel* pInDM = pcDepthPicYuvOrg->getLumaAddr();1275 1276 for(Int uiFrame=0; uiFrame < uiNumFrames; uiFrame++ )1277 {1278 depthVideoFile->read( pcDepthPicYuvOrg, m_aiPad );1279 1280 // check all pixel values1281 for (Int i=0; i<iHeight; i++)1282 {1283 Int rowOffset = i*iStride;1284 1285 for (Int j=0; j<iWidth; j++)1286 {1287 Pel depthValue = pInDM[rowOffset+j];1288 abValidDepths[depthValue] = true;1289 }1290 }1291 }1292 1293 depthVideoFile->close();1294 delete depthVideoFile;1295 1296 pcDepthPicYuvOrg->destroy();1297 delete pcDepthPicYuvOrg;1298 1299 // convert boolean array to idx2Depth LUT1300 Int* aiIdx2DepthValue = (Int*) calloc(uiMaxDepthValue, sizeof(Int));1301 Int iNumDepthValues = 0;1302 for(Int p=0; p<=uiMaxDepthValue; p++)1303 {1304 if( abValidDepths[p] == true)1305 {1306 aiIdx2DepthValue[iNumDepthValues++] = p;1307 }1308 }1309 1310 if( uiNumFrames == 0 || numBitsForValue(iNumDepthValues) == g_bitDepthY )1311 {1312 dlt->setUseDLTFlag(layer, false);1313 }1314 1315 // assign LUT1316 if( dlt->getUseDLTFlag(layer) )1317 {1318 dlt->setDepthLUTs(layer, aiIdx2DepthValue, iNumDepthValues);1319 }1320 1321 // free temporary memory1322 free(aiIdx2DepthValue);1323 }1324 #endif1325 1003 1326 1004 #if H_MV … … 1640 1318 break; 1641 1319 case Profile::MULTIVIEWMAIN: 1642 #if H_3D1643 case Profile::MAIN3D:1644 #endif1645 1320 ptl->setMax12bitConstraintFlag ( true ); 1646 1321 ptl->setMax12bitConstraintFlag ( true ); … … 2152 1827 2153 1828 2154 #if H_3D2155 Void TAppEncTop::xSetVPSExtension2( TComVPS& vps )2156 {2157 for ( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ )2158 {2159 Bool isDepth = ( vps.getDepthId( layer ) == 1 ) ;2160 Bool isLayerZero = ( layer == 0 );2161 #if LGE_FCO_I01162162 Bool isDepthFirst = (layer > 1 ? true : false);2163 #endif2164 2165 #if H_3D_ARP2166 vps.setUseAdvRP ( layer, ( isDepth || isLayerZero || !vps.getNumDirectRefLayers(layer) ) ? 0 : m_uiUseAdvResPred );2167 vps.setARPStepNum ( layer, ( isDepth || isLayerZero || !vps.getNumDirectRefLayers(layer) ) ? 1 : H_3D_ARP_WFNR );2168 #endif2169 #if H_3D_SPIVMP2170 if( isDepth )2171 {2172 vps.setSubPULog2Size ( layer, (layer != 1) ? 6: 0 );2173 #if MTK_I0099_VPS_EX22174 vps.setSubPUMPILog2Size ( layer, (!isLayerZero) ? m_iSubPUMPILog2Size: 0 );2175 #endif2176 }2177 else2178 {2179 vps.setSubPULog2Size ( layer, (!isLayerZero) ? m_iSubPULog2Size: 0 );2180 }2181 #endif2182 2183 #if H_3D_DIM2184 vps.setVpsDepthModesFlag( layer, isDepth && !isLayerZero && (m_useDMM || m_useSDC || m_useDLT ) );2185 #if SEPARATE_FLAG_I00852186 #if LGE_FCO_I01162187 vps.setIVPFlag ( layer, isDepth && !isLayerZero && m_useIVP && !isDepthFirst );2188 #else2189 vps.setIVPFlag ( layer, isDepth && !isLayerZero && m_useIVP );2190 #endif2191 #endif2192 #endif2193 2194 #if H_3D_IV_MERGE2195 if( !vps.getNumDirectRefLayers(layer) )2196 {2197 vps.setIvMvPredFlag (layer, false);2198 #if SEC_HLS_CLEANUP_I01002199 vps.setIvMvScalingFlag (layer, false);2200 #endif2201 }2202 else2203 {2204 if( isDepth )2205 {2206 vps.setIvMvPredFlag ( layer, (layer != 1) && m_ivMvPredFlag[1] );2207 }2208 else2209 {2210 vps.setIvMvPredFlag ( layer, !isLayerZero && m_ivMvPredFlag[0] );2211 }2212 #if SEC_HLS_CLEANUP_I01002213 vps.setIvMvScalingFlag (layer, m_ivMvScalingFlag);2214 #endif2215 }2216 #endif2217 #if MTK_I0099_VPS_EX22218 #if LGE_FCO_I01162219 vps.setLimQtPredFlag ( layer, isDepth && m_bLimQtPredFlag && !isDepthFirst );2220 #else2221 vps.setLimQtPredFlag ( layer, isDepth && m_bLimQtPredFlag );2222 #endif2223 #endif2224 #if H_3D_NBDV_REF2225 vps.setDepthRefinementFlag ( layer, !isLayerZero && !isDepth && m_depthRefinementFlag );2226 #endif2227 #if H_3D_VSP2228 vps.setViewSynthesisPredFlag( layer, !isLayerZero && !isDepth && vps.getNumDirectRefLayers(layer) && m_viewSynthesisPredFlag );2229 #endif2230 #if H_3D_DBBP2231 vps.setUseDBBP ( layer, !isLayerZero && !isDepth && m_bUseDBBP );2232 #endif2233 #if H_3D_INTER_SDC2234 vps.setInterSDCFlag( layer, !isLayerZero && isDepth && m_bDepthInterSDCFlag );2235 #endif2236 #if H_3D_IV_MERGE2237 #if LGE_FCO_I01162238 vps.setMPIFlag( layer, !isLayerZero && isDepth && m_bMPIFlag && !isDepthFirst );2239 #else2240 vps.setMPIFlag( layer, !isLayerZero && isDepth && m_bMPIFlag );2241 #endif2242 #endif2243 }2244 #if !MTK_I0099_VPS_EX22245 #if H_3D_SPIVMP2246 vps.setSubPUMPILog2Size( m_iSubPUMPILog2Size );2247 #endif2248 #endif2249 #if H_3D2250 #if !SEC_HLS_CLEANUP_I01002251 vps.setIvMvScalingFlag( m_ivMvScalingFlag );2252 #endif2253 #endif2254 }2255 2256 Void TAppEncTop::xDeriveDltArray( TComVPS& vps, TComDLT& dlt )2257 {2258 Int iNumDepthViews = 0;2259 Bool bDltPresentFlag = false;2260 2261 for ( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ )2262 {2263 Bool isDepth = ( vps.getDepthId( layer ) == 1 );2264 2265 if ( isDepth )2266 {2267 iNumDepthViews++;2268 }2269 2270 dlt.setUseDLTFlag( layer , isDepth && m_useDLT );2271 if( dlt.getUseDLTFlag( layer ) )2272 {2273 xAnalyzeInputBaseDepth(layer, max(m_iIntraPeriod[layer], 24), &vps, &dlt);2274 bDltPresentFlag = bDltPresentFlag || dlt.getUseDLTFlag(layer);2275 #if H_3D_DELTA_DLT2276 dlt.setInterViewDltPredEnableFlag(layer, (dlt.getUseDLTFlag(layer) && (layer>1)));2277 #endif2278 }2279 }2280 2281 dlt.setDltPresentFlag( bDltPresentFlag );2282 dlt.setNumDepthViews ( iNumDepthViews );2283 }2284 #endif2285 1829 //! \} -
branches/HTM-12.1-MV-draft-1/source/App/TAppEncoder/TAppEncTop.h
r1066 r1072 46 46 #include "TLibCommon/AccessUnit.h" 47 47 #include "TAppEncCfg.h" 48 #if H_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 H_3D93 TComDLT m_dlt; ///< dlt94 #endif95 86 96 87 UInt m_essentialBytes; 97 88 UInt m_totalBytes; 98 #if H_3D_VSO99 TRenTop m_cRendererTop;100 TRenModel m_cRendererModel;101 #endif102 89 protected: 103 90 // initialization … … 149 136 #endif 150 137 #endif 151 #if H_3D152 Void xSetVPSExtension2( TComVPS& vps );153 Void xDeriveDltArray( TComVPS& vps, TComDLT& dlt );154 #endif155 #if H_3D_DIM_DLT156 Void xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt);157 #endif158 138 public: 159 139 TAppEncTop(); -
branches/HTM-12.1-MV-draft-1/source/App/TAppRenderer/RendererMain.cpp
r608 r1072 35 35 #include <time.h> 36 36 #include "../../Lib/TLibCommon/TypeDef.h" 37 #if H_3D38 #include "TAppRendererTop.h"39 // ====================================================================================================================40 // Main function41 // ====================================================================================================================42 43 int main(int argc, char* argv[])44 {45 46 TAppRendererTop cTAppRendererTop;47 48 // print information49 fprintf( stdout, "\n" );50 fprintf( stdout, "3D-HTM software: Renderer Version [%s]", NV_VERSION);51 fprintf( stdout, NVM_ONOS );52 fprintf( stdout, NVM_COMPILEDBY );53 fprintf( stdout, NVM_BITS );54 fprintf( stdout, "\n" );55 56 // create application renderer class57 cTAppRendererTop.create();58 59 // parse configuration60 if(!cTAppRendererTop.parseCfg( argc, argv ))61 {62 cTAppRendererTop.destroy();63 return 1;64 }65 66 // starting time67 double dResult;68 long lBefore = clock();69 70 // call rendering function71 cTAppRendererTop.go();72 73 // ending time74 dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC;75 printf("\n Total Time: %12.3f sec.\n", dResult);76 77 // destroy application renderer class78 cTAppRendererTop.destroy();79 80 return 0;81 }82 #else83 37 84 38 #include <iostream> … … 89 43 } 90 44 91 #endif // H_3D92 45 -
branches/HTM-12.1-MV-draft-1/source/App/TAppRenderer/TAppRendererCfg.cpp
r608 r1072 44 44 #include "../../Lib/TAppCommon/program_options_lite.h" 45 45 46 #if H_3D47 48 using namespace std;49 namespace po = df::program_options_lite;50 51 // ====================================================================================================================52 // Local constants53 // ====================================================================================================================54 55 #define MAX_INPUT_VIEW_NUM 1056 #define MAX_OUTPUT_VIEW_NUM 6457 58 // ====================================================================================================================59 // Constructor / destructor / initialization / destroy60 // ====================================================================================================================61 62 63 TAppRendererCfg::TAppRendererCfg()64 {65 66 }67 68 TAppRendererCfg::~TAppRendererCfg()69 {70 for(Int i = 0; i< m_pchVideoInputFileList.size(); i++ )71 {72 if ( m_pchVideoInputFileList[i] != NULL )73 free (m_pchVideoInputFileList[i]);74 }75 76 for(Int i = 0; i< m_pchDepthInputFileList.size(); i++ )77 {78 if ( m_pchDepthInputFileList[i] != NULL )79 free (m_pchDepthInputFileList[i]);80 }81 82 for(Int i = 0; i< m_pchSynthOutputFileList.size(); i++ )83 {84 if ( m_pchSynthOutputFileList[i] != NULL )85 free (m_pchSynthOutputFileList[i]);86 }87 88 if ( m_pchVideoInputFileBaseName ) free( m_pchVideoInputFileBaseName );89 if ( m_pchDepthInputFileBaseName ) free( m_pchDepthInputFileBaseName );90 if ( m_pchSynthOutputFileBaseName ) free( m_pchSynthOutputFileBaseName);91 if ( m_pchCameraParameterFile ) free( m_pchCameraParameterFile );92 if ( m_pchBaseViewCameraNumbers ) free( m_pchBaseViewCameraNumbers );93 if ( m_pchSynthViewCameraNumbers ) free( m_pchSynthViewCameraNumbers );94 if ( m_pchViewConfig ) free( m_pchViewConfig );95 }96 97 Void TAppRendererCfg::create()98 {99 }100 101 Void TAppRendererCfg::destroy()102 {103 }104 105 // ====================================================================================================================106 // Public member functions107 // ====================================================================================================================108 109 /** \param argc number of arguments110 \param argv array of arguments111 \retval true when success112 */113 Bool TAppRendererCfg::parseCfg( Int argc, Char* argv[] )114 {115 bool do_help = false;116 117 po::Options opts;118 opts.addOptions()119 ("help", do_help, false, "this help text")120 ("c", po::parseConfigFile, "configuration file name")121 122 /* File I/O */123 ("VideoInputFileBaseName,v", m_pchVideoInputFileBaseName, (Char*) 0, "Basename to generate video input file names")124 ("DepthInputFileBaseName,d", m_pchDepthInputFileBaseName, (Char*) 0, "Basename to generate depth input file names")125 ("SynthOutputFileBaseName,s", m_pchSynthOutputFileBaseName, (Char*) 0, "Basename to generate synthesized output file names")126 ("ContOutputFileNumbering", m_bContOutputFileNumbering , false , "Continuous Output File Numbering")127 ("Sweep" , m_bSweep , false , "Store all views in first Output File")128 129 ("VideoInputFile_%d,v_%d", m_pchVideoInputFileList , (Char *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv video input file name %d")130 ("DepthInputFile_%d,d_%d", m_pchDepthInputFileList , (Char *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv depth input file name %d")131 ("SynthOutputFile_%d,s_%d", m_pchSynthOutputFileList, (Char *) 0, MAX_OUTPUT_VIEW_NUM, "Synthesized Yuv output file name %d")132 133 ("InputBitDepth", m_inputBitDepthY, 8, "Bit-depth of input file")134 ("OutputBitDepth", m_outputBitDepthY, 0, "Bit-depth of output file (default:InternalBitDepth)")135 ("InternalBitDepth", m_internalBitDepthY, 0, "Bit-depth the renderer operates at. (default:InputBitDepth)" "If different to InputBitDepth, source data will be converted")136 137 ("InputBitDepthC", m_inputBitDepthC, 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")138 ("OutputBitDepthC", m_outputBitDepthC, 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")139 ("InternalBitDepthC", m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")140 141 /* Source Specification */142 ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width")143 ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height")144 ("FrameSkip,-fs", m_iFrameSkip, 0, "Number of frames to skip at start of input YUV")145 ("FramesToBeRendered,f", m_iFramesToBeRendered, 0, "Number of frames to be rendered (default=all)")146 147 /* Camera Specification */148 ("CameraParameterFile,-cpf", m_pchCameraParameterFile, (Char *) 0, "Camera Parameter File Name")149 ("BaseViewCameraNumbers" , m_pchBaseViewCameraNumbers, (Char *) 0, "Numbers of base views")150 ("SynthViewCameraNumbers" , m_pchSynthViewCameraNumbers, (Char *) 0, "Numbers of views to synthesis")151 ("ViewConfig" , m_pchViewConfig, (Char *) 0, "View Configuration" )152 153 /* Renderer Modes */154 ("Log2SamplingFactor", m_iLog2SamplingFactor, 0, "Factor for horizontal up sampling before processing" )155 ("UVup" , m_bUVUp , true, "Up sampling of chroma planes before processing" )156 ("PreProcMode" , m_iPreProcMode , 0, "Depth preprocessing: 0 = None, 1 = Binomial filtering" )157 ("PreFilterSize" , m_iPreFilterSize , 0, "For PreProcMode 1: Half Size of filter kernel" )158 ("SimEnhance" , m_bSimEnhance , true, "Similarity enhancement of video" )159 ("BlendMode" , m_iBlendMode , 0, "Blending of left and right image: 0: average, 1: only holes from right, 2: only holes from left, 3: first view in BaseViewOrder as main view" )160 ("BlendZThresPerc" , m_iBlendZThresPerc , 30, "Z-difference threshold for blending in percent of total Z-range" )161 ("BlendUseDistWeight", m_bBlendUseDistWeight , true, "0: blend using average; 1: blend factor depends on view distance" )162 ("BlendHoleMargin" , m_iBlendHoleMargin , 6, "Margin around holes to fill with other view" )163 ("InterpolationMode" , m_iInterpolationMode , 4, "0: NN, 1:linear (int), 2:linear (double) , 3:cubic Hermite spline (double), 4: 8-tap (int)" )164 ("HoleFillingMode" , m_iHoleFillingMode , 1, "0: None, 1: line wise background extension" )165 ("PostProcMode" , m_iPostProcMode , 0, "0: None, 1: horizontal 3-tap median" )166 ("RenderMode" , m_iRenderMode , 0, "0: Use renderer, 1: use model renderer, 10: create used pels map")167 ("ShiftPrecision" , m_iShiftPrecision , 2, "Shift Precision for Interpolation Mode 4" )168 ("TemporalDepthFilter", m_bTempDepthFilter , false, "Temporal depth filtering" )169 ("RenderDirection" , m_iRenderDirection , 0, "0: Interpolate, 1: Extrapolate from left, 2: Extrapolate from right")170 ("UsedPelMapMarExt" , m_iUsedPelMapMarExt , 0, "Margin Extension in Pels for used pels map generation" );171 172 po::setDefaults(opts);173 po::scanArgv(opts, argc, (const char**) argv);174 175 if (argc == 1 || do_help)176 {177 /* argc == 1: no options have been specified */178 po::doHelp(cout, opts);179 xPrintUsage();180 return false;181 }182 183 /*184 * Set any derived parameters before checking185 */186 187 /* rules for input, output and internal bitdepths as per help text */188 if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; }189 if (!m_internalBitDepthC) { m_internalBitDepthC = m_internalBitDepthY; }190 if (!m_inputBitDepthC) { m_inputBitDepthC = m_inputBitDepthY; }191 if (!m_outputBitDepthY) { m_outputBitDepthY = m_internalBitDepthY; }192 if (!m_outputBitDepthC) { m_outputBitDepthC = m_internalBitDepthC; }193 194 xSetGlobal();195 196 UInt uiInputBitDepth = 8;197 UInt uiCamParPrecision = 5;198 199 m_bUseSetupString = ( m_pchViewConfig != NULL ) && ( m_iRenderMode != 0);200 201 if ( m_iRenderMode == 10 )202 {203 m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,204 m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );205 m_iNumberOfInputViews = (Int) m_cCameraData.getBaseViewNumbers() .size();206 m_iNumberOfOutputViews = m_iNumberOfInputViews - 1;207 m_iRenderDirection = 1;208 }209 else210 {211 if ( m_bUseSetupString )212 {213 std::vector<Int> iaTempViews;214 std::vector<Int>* piaTempViews;215 m_cCameraData .convertNumberString( m_pchBaseViewCameraNumbers, iaTempViews, VIEW_NUM_PREC );216 m_cRenModStrParser.setString( (Int) iaTempViews.size(), m_pchViewConfig );217 piaTempViews = m_cRenModStrParser.getSynthViews();218 m_iNumberOfOutputViews = (Int) m_cRenModStrParser.getNumOfModels();219 m_iNumberOfInputViews = (Int) m_cRenModStrParser.getNumOfBaseViews();220 m_bContOutputFileNumbering = true;221 222 m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,223 m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, piaTempViews, m_iLog2SamplingFactor+m_iShiftPrecision );224 }225 else226 {227 m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,228 m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, m_pchSynthViewCameraNumbers, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );229 m_iNumberOfOutputViews = (Int) m_cCameraData.getSynthViewNumbers().size();230 m_iNumberOfInputViews = (Int) m_cCameraData.getBaseViewNumbers() .size();231 }232 }233 234 if (m_pchSynthOutputFileBaseName != NULL)235 xConfirmParameter( strrchr(m_pchSynthOutputFileBaseName,'$') == 0, "'$' must be a character in SynthOutputFileBaseName");236 237 if (m_pchDepthInputFileBaseName != NULL)238 xConfirmParameter( strrchr(m_pchDepthInputFileBaseName, '$') == 0, "'$' must be a character in DepthInputFileBaseName" );239 240 if (m_pchVideoInputFileBaseName != NULL)241 xConfirmParameter( strrchr(m_pchVideoInputFileBaseName, '$') == 0, "'$' must be a character in VideoInputFileBaseName" );242 243 xCreateFileNames();244 245 /*246 * check validity of input parameters247 */248 xCheckParameter();249 m_cCameraData.check( m_iRenderDirection == 0, m_iFramesToBeRendered != 0 );250 251 // print-out parameters252 xPrintParameter();253 254 return true;255 }256 257 258 // ====================================================================================================================259 // Private member functions260 // ====================================================================================================================261 262 Void TAppRendererCfg::xCheckParameter()263 {264 bool check_failed = false; /* abort if there is a fatal configuration problem */265 #define xConfirmPara(a,b) check_failed |= xConfirmParameter(a,b)266 // check range of parameters267 268 /// File I/O269 270 // source specification271 xConfirmPara( m_iSourceWidth <= 0, "Source width must be greater than 0" );272 xConfirmPara( m_iSourceHeight <= 0, "Source height must be greater than 0" );273 xConfirmPara( m_iFrameSkip < 0, "Frame Skipping must be more than or equal to 0" );274 xConfirmPara( m_iFramesToBeRendered < 0, "Total Number Of Frames rendered must be more than 1" );275 276 // bit depth277 xConfirmPara( m_internalBitDepthC != m_internalBitDepthY, "InternalBitDepth for luma and chroma must be equal. ");278 xConfirmPara( m_inputBitDepthY < 8, "InputBitDepth must be at least 8" );279 xConfirmPara( m_inputBitDepthC < 8, "InputBitDepthC must be at least 8" );280 281 // camera specification282 xConfirmPara( m_iNumberOfInputViews > MAX_INPUT_VIEW_NUM , "NumberOfInputViews must be less than of equal to MAX_INPUT_VIEW_NUM");283 xConfirmPara( m_iNumberOfOutputViews > MAX_OUTPUT_VIEW_NUM, "NumberOfOutputViews must be less than of equal to MAX_OUTPUT_VIEW_NUM");284 285 286 xConfirmPara( m_iRenderDirection < 0 || m_iRenderDirection > 2 , "RenderDirection must be greater than or equal to 0 and less than 3");287 xConfirmPara(m_iNumberOfOutputViews < 1, "Number of OutputViews must be greater or equal to 1");288 if ( m_iRenderDirection == 0 )289 {290 xConfirmPara( m_iNumberOfInputViews < 2, "Number of InputViews must be more than or equal to 2");291 }292 else293 {294 xConfirmPara( m_iNumberOfInputViews < 1, "Number of InputViews must be more than or equal to 1");295 }296 297 xConfirmPara( m_iLog2SamplingFactor < 0 || m_iLog2SamplingFactor > 4, "Log2SamplingFactor must be more than or equal to 0 and less than 5" );298 xConfirmPara( m_iPreProcMode < 0 || m_iPreProcMode > 1, "PreProcMode must be more than or equal to 0 and less than 2" );299 300 301 xConfirmPara( m_iPreFilterSize < 0 || m_iPreFilterSize > 3, "PreFilterSize must be more than or equal to 0 and less than 4" );302 xConfirmPara( m_iBlendMode < 0 || m_iBlendMode > 3, "BlendMode must be more than or equal to 0 and less than 4" );303 xConfirmPara( m_iBlendZThresPerc < 0 || m_iBlendZThresPerc > 100,"BlendZThresPerc must be more than or equal to 0 and less than 101" );304 xConfirmPara( m_iBlendHoleMargin < 0 || m_iBlendHoleMargin > 20,"BlendHoleMargin must be more than or equal to 0 and less than 19" );305 xConfirmPara( m_iInterpolationMode < 0 || m_iInterpolationMode > 4, "InterpolationMode must be more than or equal to 0 and less than 5" );306 xConfirmPara( m_iHoleFillingMode < 0 || m_iHoleFillingMode > 1, "HoleFillingMode must be more than or equal to 0 and less than 2" );307 xConfirmPara( m_iPostProcMode < 0 || m_iPostProcMode > 2, "PostProcMode must be more than or equal to 0 and less than 3" );308 309 Int iNumNonNULL;310 for (iNumNonNULL = 0; (iNumNonNULL < m_iNumberOfInputViews) && m_pchDepthInputFileList[iNumNonNULL]; iNumNonNULL++); xConfirmPara( iNumNonNULL < m_iNumberOfInputViews, "Number of DepthInputFiles must be greater than or equal to number of BaseViewNumbers" );311 for (iNumNonNULL = 0; (iNumNonNULL < m_iNumberOfInputViews) && m_pchVideoInputFileList[iNumNonNULL]; iNumNonNULL++); xConfirmPara( iNumNonNULL < m_iNumberOfInputViews, "Number of DepthInputFiles must be greater than or equal to number of BaseViewNumbers" );312 313 314 if ( !m_bSweep )315 {316 for (iNumNonNULL = 0; (iNumNonNULL < m_iNumberOfOutputViews) && m_pchSynthOutputFileList[iNumNonNULL]; iNumNonNULL++); xConfirmPara( iNumNonNULL < m_iNumberOfOutputViews, "Number of SynthOutputFiles must be greater than or equal to number of SynthViewNumbers" );317 }318 else319 {320 xConfirmPara( iNumNonNULL < 1, "Number of SynthOutputFiles must be equal to or more than 1" );321 }322 323 #undef xConfirmPara324 if ( check_failed )325 {326 exit(EXIT_FAILURE);327 }328 329 }330 331 332 333 Void TAppRendererCfg::xPrintParameter()334 {335 printf("\n");336 for( Int iCounter = 0; iCounter < m_iNumberOfInputViews; iCounter++)337 {338 printf("InputVideoFile_%i : %s\n", iCounter, m_pchVideoInputFileList[iCounter]);339 }340 for( Int iCounter = 0; iCounter < m_iNumberOfInputViews; iCounter++)341 {342 printf("InputDepthFile_%i : %s\n", iCounter, m_pchDepthInputFileList[iCounter]);343 }344 345 for( Int iCounter = 0; iCounter < m_iNumberOfOutputViews; iCounter++)346 {347 printf("SynthOutputFile_%i : %s\n", iCounter, m_pchSynthOutputFileList[iCounter]);348 }349 350 printf("Format : %dx%d \n", m_iSourceWidth, m_iSourceHeight );351 printf("Frame index : %d - %d (%d frames)\n", m_iFrameSkip, m_iFrameSkip+m_iFramesToBeRendered-1, m_iFramesToBeRendered);352 printf("CameraParameterFile : %s\n", m_pchCameraParameterFile );353 printf("BaseViewNumbers : %s (%d views) \n", m_pchBaseViewCameraNumbers , m_iNumberOfInputViews );354 printf("Sweep : %d\n", m_bSweep );355 356 if ( m_bUseSetupString )357 {358 printf("ViewConfig : %s\n", m_pchViewConfig );359 }360 else361 {362 printf("SynthViewNumbers : %s (%d views) \n", m_pchSynthViewCameraNumbers, m_iNumberOfOutputViews );363 }364 365 printf("Log2SamplingFactor : %d\n", m_iLog2SamplingFactor );366 printf("UVUp : %d\n", m_bUVUp );367 printf("PreProcMode : %d\n", m_iPreProcMode );368 printf("PreFilterSize : %d\n", m_iPreFilterSize );369 printf("SimEnhance : %d\n", m_bSimEnhance );370 printf("BlendMode : %d\n", m_iBlendMode );371 printf("BlendZThresPerc : %d\n", m_iBlendZThresPerc );372 printf("BlendUseDistWeight : %d\n", m_bBlendUseDistWeight );373 printf("BlendHoleMargin : %d\n", m_iBlendHoleMargin );374 printf("InterpolationMode : %d\n", m_iInterpolationMode );375 printf("HoleFillingMode : %d\n", m_iHoleFillingMode );376 printf("PostProcMode : %d\n", m_iPostProcMode );377 printf("ShiftPrecision : %d\n", m_iShiftPrecision );378 printf("TemporalDepthFilter : %d\n", m_bTempDepthFilter );379 printf("RenderMode : %d\n", m_iRenderMode );380 printf("RendererDirection : %d\n", m_iRenderDirection );381 382 if (m_iRenderMode == 10 )383 {384 printf("UsedPelMapMarExt : %d\n", m_iUsedPelMapMarExt );385 }386 387 printf("\n");388 389 // printf("TOOL CFG: ");390 // printf("ALF:%d ", m_bUseALF );391 // printf("\n");392 393 fflush(stdout);394 }395 396 Void TAppRendererCfg::xPrintUsage()397 {398 printf( "\n" );399 printf( " Example: TAppRenderer.exe -c test.cfg\n\n");400 }401 402 Bool TAppRendererCfg::xConfirmParameter(Bool bflag, const char* message)403 {404 if (!bflag)405 return false;406 407 printf("Error: %s\n",message);408 return true;409 }410 411 412 Void TAppRendererCfg::xCreateFileNames()413 {414 if ( m_iRenderMode == 10 )415 return;416 417 Int iPrecBefore;418 Int iPrecAfter;419 420 xGetMaxPrecision( m_cCameraData.getSynthViewNumbers(), iPrecBefore, iPrecAfter );421 422 423 if (iPrecBefore > LOG10_VIEW_NUM_PREC )424 {425 std::cerr << "Error: View Numbers with more than " << LOG10_VIEW_NUM_PREC << " digits are not supported" << std::endl;426 exit(EXIT_FAILURE);427 }428 429 AOT( !m_bContOutputFileNumbering && (m_cCameraData.getSynthViewNumbers().size() != m_iNumberOfOutputViews ));430 for(Int iIdx = 0; iIdx < m_iNumberOfOutputViews; iIdx++)431 {432 //GT; Create ReconFileNames433 if (m_pchSynthOutputFileList[iIdx] == NULL )434 {435 if ( m_bContOutputFileNumbering )436 {437 xAddNumberToFileName( m_pchSynthOutputFileBaseName, m_pchSynthOutputFileList[iIdx], (Int) ((iIdx+1) * VIEW_NUM_PREC) , 2, 0 );438 }439 else440 {441 xAddNumberToFileName( m_pchSynthOutputFileBaseName, m_pchSynthOutputFileList[iIdx], m_cCameraData.getSynthViewNumbers()[iIdx], iPrecBefore, iPrecAfter );442 }443 }444 }445 446 xGetMaxPrecision( m_cCameraData.getBaseViewNumbers(), iPrecBefore, iPrecAfter );447 for(Int iIdx = 0; iIdx < m_cCameraData.getBaseViewNumbers().size() ; iIdx++)448 {449 //GT; Create ReconFileNames450 if (m_pchVideoInputFileList[iIdx] == NULL )451 {452 xAddNumberToFileName( m_pchVideoInputFileBaseName, m_pchVideoInputFileList[iIdx], m_cCameraData.getBaseViewNumbers()[iIdx], iPrecBefore, iPrecAfter );453 }454 455 if (m_pchDepthInputFileList[iIdx] == NULL )456 {457 xAddNumberToFileName( m_pchDepthInputFileBaseName, m_pchDepthInputFileList[iIdx], m_cCameraData.getBaseViewNumbers()[iIdx], iPrecBefore, iPrecAfter );458 }459 }460 }461 462 Void TAppRendererCfg::xAddNumberToFileName( Char* pchSourceFileName, Char*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter )463 {464 465 if ( pchSourceFileName == NULL )466 {467 std::cerr << "No BaseName for file name generation given." << std::endl;468 AOT(true);469 exit(EXIT_FAILURE);470 }471 472 Char pchNumberBuffer[2* LOG10_VIEW_NUM_PREC + 2];473 Char pchPrintBuffer[10];474 475 Double dNumberToAdd = ( (Double) iNumberToAdd ) / VIEW_NUM_PREC;476 477 UInt uiWidth = uiPrecBefore;478 479 if (uiPrecAfter != 0)480 {481 uiWidth += uiPrecAfter + 1;482 }483 484 sprintf( pchPrintBuffer, "%%0%d.%df", uiWidth, uiPrecAfter );485 sprintf( pchNumberBuffer, pchPrintBuffer, dNumberToAdd );486 487 if ( uiPrecAfter > 0 ) pchNumberBuffer[ uiPrecBefore ] = '_';488 489 size_t iInLength = strlen(pchSourceFileName);490 size_t iAddLength = strlen(pchNumberBuffer);491 492 rpchTargetFileName = (Char*) malloc(iInLength+iAddLength+1);493 494 Char* pchPlaceHolder = strrchr(pchSourceFileName,'$');495 assert( pchPlaceHolder );496 497 size_t iCharsToPlaceHolder = pchPlaceHolder - pchSourceFileName;498 size_t iCharsToEnd = iInLength - iCharsToPlaceHolder;499 500 strncpy(rpchTargetFileName , pchSourceFileName , iCharsToPlaceHolder);501 strncpy(rpchTargetFileName+iCharsToPlaceHolder , pchNumberBuffer , iAddLength );502 strncpy(rpchTargetFileName+iCharsToPlaceHolder+iAddLength, pchSourceFileName+iCharsToPlaceHolder+1, iCharsToEnd-1 );503 rpchTargetFileName[iInLength+iAddLength-1] = '\0';504 }505 506 Void TAppRendererCfg::xGetMaxPrecision( std::vector< Int > aiIn, Int& iPrecBefore, Int& iPrecAfter )507 {508 iPrecBefore = 0;509 iPrecAfter = 0;510 511 for (UInt uiK = 0; uiK < aiIn.size(); uiK ++ )512 {513 if ( aiIn[uiK] == 0 ) continue;514 515 Int iCurPrec;516 iCurPrec = 0;517 for ( Int iCur = aiIn[uiK]; iCur != 0; iCur /= 10, iCurPrec++ );518 iPrecBefore = max(iPrecBefore, iCurPrec - LOG10_VIEW_NUM_PREC );519 520 iCurPrec = 0;521 for ( Int iCur = 1; aiIn[uiK] % iCur == 0; iCur *= 10, iCurPrec++);522 iCurPrec = LOG10_VIEW_NUM_PREC - std::min((Int) LOG10_VIEW_NUM_PREC, iCurPrec-1 );523 iPrecAfter = max(iPrecAfter, iCurPrec );524 }525 }526 527 Void TAppRendererCfg::xSetGlobal()528 {529 // set max CU width & height530 g_uiMaxCUWidth = 0;531 g_uiMaxCUHeight = 0;532 }533 534 #endif -
branches/HTM-12.1-MV-draft-1/source/App/TAppRenderer/TAppRendererCfg.h
r608 r1072 47 47 #include <vector> 48 48 49 #if H_3D50 51 // ====================================================================================================================52 // Class definition53 // ====================================================================================================================54 55 /// encoder configuration class56 class TAppRendererCfg57 {58 protected:59 60 //// file I/O ////61 Char* m_pchVideoInputFileBaseName; ///< input video file base name, placeholder for numbering $$62 Char* m_pchDepthInputFileBaseName; ///< input depth file base name, placeholder for numbering $$63 Char* m_pchSynthOutputFileBaseName; ///< output synth file base name, placeholder for numbering $$64 Bool m_bContOutputFileNumbering; ///< use continous numbering instead of view numbering65 Bool m_bSweep; ///< 1: Store view range in file66 67 68 // bit-depth ( Currently interal luma and chroma bit-depth are required to be equal. )69 Int m_inputBitDepthY; ///< bit-depth of input file (luma component)70 Int m_inputBitDepthC; ///< bit-depth of input file (chroma component)71 Int m_outputBitDepthY; ///< bit-depth of output file (luma component)72 Int m_outputBitDepthC; ///< bit-depth of output file (chroma component)73 Int m_internalBitDepthY; ///< bit-depth renderer operates at in luma (input/output files will be converted)74 Int m_internalBitDepthC; ///< bit-depth renderer operates at in chroma (input/output files will be converted)75 76 77 // derived78 std::vector<Char*> m_pchVideoInputFileList; ///< source file names79 std::vector<Char*> m_pchDepthInputFileList; ///< source depth file names80 std::vector<Char*> m_pchSynthOutputFileList; ///< output reconstruction file names81 82 //// source specification ////83 Int m_iSourceWidth; ///< source width in pixel84 Int m_iSourceHeight; ///< source height in pixel85 Int m_iFrameSkip; ///< number of skipped frames from the beginning86 Int m_iFramesToBeRendered; ///< number of rendered frames87 88 ////camera specification ////89 Char* m_pchCameraParameterFile; ///< camera parameter file90 Char* m_pchSynthViewCameraNumbers; ///< numbers of views to synthesize91 Char* m_pchViewConfig; ///< String to setup renderer92 Char* m_pchBaseViewCameraNumbers; ///< numbers of base views93 94 // derived95 TAppComCamPara m_cCameraData; ///< class to store camera parameters96 TRenModSetupStrParser m_cRenModStrParser; ///< class to manage View to be rendered97 Bool m_bUseSetupString; ///< true if setup string is used98 99 Int m_iNumberOfInputViews; ///< number of input Views100 Int m_iNumberOfOutputViews; ///< number views to synthesize101 102 //// renderer Modes ////103 Int m_iRenderDirection; ///< 0: interpolate, 1: extrapolate from left, 2: extrapolate from right104 105 Int m_iLog2SamplingFactor; ///< factor for horizontal upsampling before processing106 Bool m_bUVUp; ///< upsampling of chroma planes before processing107 Int m_iPreProcMode; ///< depth pre-processing: 0 = none, 1 = binominal filtering108 Int m_iPreFilterSize; ///< for PreProcMode = 1: size of filter kernel109 Bool m_bSimEnhance; ///< Similarity enhancement before blending110 Int m_iBlendMode; ///< merging of left and right image: 0 = average, 1 = only holes from right, 2 = only holes from left111 Int m_iBlendZThresPerc; ///< z-difference threshold for blending in percent of total z-range112 Bool m_bBlendUseDistWeight; ///< 0: blend using average; 1: blend factor depends on view distance113 Int m_iBlendHoleMargin; ///< Margin around boundaries114 Bool m_bTempDepthFilter; ///< Zheijang temporal enhancement filter115 Int m_iInterpolationMode; ///< 0: NN, 1: linear, 2: cspline116 Int m_iHoleFillingMode; ///< 0: none, 1: line wise background extension117 Int m_iPostProcMode; ///< 0: none, 1: horizontal 3-tap median118 Int m_iRenderMode; ///< 0: use renderer119 Int m_iShiftPrecision; ///< Precision used for Interpolation Mode 4120 Int m_iUsedPelMapMarExt; ///< Used Pel map extra margin121 122 Void xCheckParameter (); ///< check validity of configuration values123 Void xPrintParameter (); ///< print configuration values124 Void xPrintUsage (); ///< print usage125 Void xSetGlobal();126 127 Void xCreateFileNames();128 Void xGetMaxPrecision( std::vector< Int > adIn, Int& iPrecBefore, Int& iPrecAfter );129 Void xAddNumberToFileName( Char* pchSourceFileName, Char*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter );130 public:131 TAppRendererCfg();132 virtual ~TAppRendererCfg();133 134 public:135 Void create (); ///< create option handling class136 Void destroy (); ///< destroy option handling class137 Bool parseCfg ( Int argc, Char* argv[] ); ///< parse configuration file to fill member variables138 Bool xConfirmParameter(Bool bflag, const Char* message);139 140 141 };// END CLASS DEFINITION TAppRendererCfg142 143 #endif // __TAppRENDERERCFG__144 49 #endif // H_3D -
branches/HTM-12.1-MV-draft-1/source/App/TAppRenderer/TAppRendererTop.cpp
r608 r1072 41 41 #include "TAppRendererTop.h" 42 42 43 #if H_3D44 45 // ====================================================================================================================46 // Constructor / destructor / initialization / destroy47 // ====================================================================================================================48 49 TAppRendererTop::TAppRendererTop()50 {51 52 }53 54 TAppRendererTop::~TAppRendererTop()55 {56 57 }58 59 60 Void TAppRendererTop::xCreateLib()61 {62 m_pcRenTop = new TRenTop();63 64 for(Int iViewIdx=0; iViewIdx<m_iNumberOfInputViews; iViewIdx++)65 {66 TVideoIOYuv* pcVideoInput = new TVideoIOYuv;67 TVideoIOYuv* pcDepthInput = new TVideoIOYuv;68 69 pcVideoInput->open( m_pchVideoInputFileList[iViewIdx], false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC); // read mode70 pcDepthInput->open( m_pchDepthInputFileList[iViewIdx], false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC ); // read mode71 pcVideoInput->skipFrames(m_iFrameSkip, m_iSourceWidth, m_iSourceHeight );72 pcDepthInput->skipFrames(m_iFrameSkip, m_iSourceWidth, m_iSourceHeight );73 74 m_apcTVideoIOYuvVideoInput.push_back( pcVideoInput );75 m_apcTVideoIOYuvDepthInput.push_back( pcDepthInput );76 }77 78 for(Int iViewIdx=0; iViewIdx<m_iNumberOfOutputViews; iViewIdx++)79 {80 TVideoIOYuv* pcSynthOutput = new TVideoIOYuv;81 pcSynthOutput->open( m_pchSynthOutputFileList[iViewIdx], true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC ); // write mode82 m_apcTVideoIOYuvSynthOutput.push_back( pcSynthOutput );83 }84 }85 86 87 Void TAppRendererTop::xDestroyLib()88 {89 delete m_pcRenTop;90 91 for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfInputViews; iViewIdx++ )92 {93 m_apcTVideoIOYuvVideoInput[iViewIdx]->close();94 m_apcTVideoIOYuvDepthInput[iViewIdx]->close();95 96 delete m_apcTVideoIOYuvDepthInput[iViewIdx];97 delete m_apcTVideoIOYuvVideoInput[iViewIdx];98 };99 100 for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfOutputViews; iViewIdx++ )101 {102 m_apcTVideoIOYuvSynthOutput[iViewIdx]->close();103 delete m_apcTVideoIOYuvSynthOutput[iViewIdx];104 };105 }106 107 Void TAppRendererTop::xInitLib()108 {109 m_pcRenTop->init(110 m_iSourceWidth,111 m_iSourceHeight,112 (m_iRenderDirection != 0),113 m_iLog2SamplingFactor,114 m_iLog2SamplingFactor+m_iShiftPrecision,115 m_bUVUp,116 m_iPreProcMode,117 m_iPreFilterSize,118 m_iBlendMode,119 m_iBlendZThresPerc,120 m_bBlendUseDistWeight,121 m_iBlendHoleMargin,122 m_iInterpolationMode,123 m_iHoleFillingMode,124 m_iPostProcMode,125 m_iUsedPelMapMarExt126 );127 }128 129 // ====================================================================================================================130 // Public member functions131 // ====================================================================================================================132 133 134 135 Void TAppRendererTop::render()136 {137 xCreateLib();138 xInitLib();139 140 // Create Buffers Input Views;141 std::vector<TComPicYuv*> apcPicYuvBaseVideo;142 std::vector<TComPicYuv*> apcPicYuvBaseDepth;143 144 // TemporalImprovement Filter145 std::vector<TComPicYuv*> apcPicYuvLastBaseVideo;146 std::vector<TComPicYuv*> apcPicYuvLastBaseDepth;147 148 Int aiPad[2] = { 0, 0 };149 150 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )151 {152 TComPicYuv* pcNewVideoPic = new TComPicYuv;153 TComPicYuv* pcNewDepthPic = new TComPicYuv;154 155 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );156 apcPicYuvBaseVideo.push_back(pcNewVideoPic);157 158 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );159 apcPicYuvBaseDepth.push_back(pcNewDepthPic);160 161 //Temporal improvement Filter162 if ( m_bTempDepthFilter )163 {164 pcNewVideoPic = new TComPicYuv;165 pcNewDepthPic = new TComPicYuv;166 167 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );168 apcPicYuvLastBaseVideo.push_back(pcNewVideoPic);169 170 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );171 apcPicYuvLastBaseDepth.push_back(pcNewDepthPic);172 }173 }174 175 // Create Buffer for synthesized View176 TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;177 pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );178 179 Bool bAnyEOS = false;180 181 Int iNumOfRenderedFrames = 0;182 Int iFrame = 0;183 184 while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )185 {186 if ( iFrame >= m_iFrameSkip )187 {188 // read in depth and video189 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )190 {191 m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], aiPad ) ;192 193 apcPicYuvBaseVideo[iBaseViewIdx]->extendPicBorder();194 195 bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();196 197 m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], aiPad ) ;198 apcPicYuvBaseDepth[iBaseViewIdx]->extendPicBorder();199 bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();200 201 if ( m_bTempDepthFilter && (iFrame >= m_iFrameSkip) )202 {203 m_pcRenTop->temporalFilterVSRS( apcPicYuvBaseVideo[iBaseViewIdx], apcPicYuvBaseDepth[iBaseViewIdx], apcPicYuvLastBaseVideo[iBaseViewIdx], apcPicYuvLastBaseDepth[iBaseViewIdx], ( iFrame == m_iFrameSkip) );204 }205 }206 }207 else208 {209 std::cout << "Skipping Frame " << iFrame << std::endl;210 211 iFrame++;212 continue;213 }214 215 m_cCameraData.update( (UInt)iFrame - m_iFrameSkip );216 217 for(Int iSynthViewIdx=0; iSynthViewIdx < m_iNumberOfOutputViews; iSynthViewIdx++ )218 {219 Int iLeftBaseViewIdx = -1;220 Int iRightBaseViewIdx = -1;221 222 Bool bIsBaseView = false;223 224 Int iRelDistToLeft;225 Bool bHasLRView = m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftBaseViewIdx, iRightBaseViewIdx, iRelDistToLeft, bIsBaseView );226 Bool bHasLView = ( iLeftBaseViewIdx != -1 );227 Bool bHasRView = ( iRightBaseViewIdx != -1 );228 Bool bRender = true;229 230 Int iBlendMode = m_iBlendMode;231 Int iSimEnhBaseView = 0;232 233 switch( m_iRenderDirection )234 {235 /// INTERPOLATION236 case 0:237 AOF( bHasLRView || bIsBaseView );238 239 if ( !bHasLRView && bIsBaseView && m_iBlendMode == 0 )240 {241 bRender = false;242 }243 else244 {245 if ( bIsBaseView )246 {247 AOF( iLeftBaseViewIdx == iRightBaseViewIdx );248 Int iSortedBaseViewIdx = m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx];249 250 if ( m_iBlendMode == 1 )251 {252 if ( iSortedBaseViewIdx - 1 >= 0 )253 {254 iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx - 1];255 bRender = true;256 }257 else258 {259 bRender = false;260 }261 }262 else if ( m_iBlendMode == 2 )263 {264 if ( iSortedBaseViewIdx + 1 < m_iNumberOfInputViews )265 {266 iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx + 1];267 bRender = true;268 }269 else270 {271 bRender = false;272 }273 }274 }275 276 if ( m_iBlendMode == 3 )277 {278 if ( bIsBaseView && (iLeftBaseViewIdx == 0) )279 {280 bRender = false;281 }282 else283 {284 Int iDistLeft = abs( m_cCameraData.getBaseId2SortedId()[0] - m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx ] );285 Int iDistRight = abs( m_cCameraData.getBaseId2SortedId()[0] - m_cCameraData.getBaseId2SortedId() [iRightBaseViewIdx] );286 287 Int iFillViewIdx = iDistLeft > iDistRight ? iLeftBaseViewIdx : iRightBaseViewIdx;288 289 if( m_cCameraData.getBaseId2SortedId()[0] < m_cCameraData.getBaseId2SortedId() [iFillViewIdx] )290 {291 iBlendMode = 1;292 iLeftBaseViewIdx = 0;293 iRightBaseViewIdx = iFillViewIdx;294 }295 else296 {297 iBlendMode = 2;298 iLeftBaseViewIdx = iFillViewIdx;299 iRightBaseViewIdx = 0;300 }301 302 }303 }304 else305 {306 iBlendMode = m_iBlendMode;307 }308 }309 310 if ( m_bSimEnhance )311 {312 if ( m_iNumberOfInputViews == 3 && m_cCameraData.getRelSynthViewNumbers()[ iSynthViewIdx ] < VIEW_NUM_PREC )313 {314 iSimEnhBaseView = 2; // Take middle view315 }316 else317 {318 iSimEnhBaseView = 1; // Take left view319 }320 }321 322 if ( bRender )323 {324 std::cout << "Rendering Frame " << iFrame325 << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx ] / VIEW_NUM_PREC326 << " Left BaseView: " << (Double) m_cCameraData.getBaseViewNumbers() [iLeftBaseViewIdx ] / VIEW_NUM_PREC327 << " Right BaseView: " << (Double) m_cCameraData.getBaseViewNumbers() [iRightBaseViewIdx] / VIEW_NUM_PREC328 << " BlendMode: " << iBlendMode329 << std::endl;330 331 m_pcRenTop->setShiftLUTs(332 m_cCameraData.getSynthViewShiftLUTD()[iLeftBaseViewIdx ][iSynthViewIdx],333 m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx],334 m_cCameraData.getBaseViewShiftLUTI ()[iLeftBaseViewIdx ][iRightBaseViewIdx],335 m_cCameraData.getSynthViewShiftLUTD()[iRightBaseViewIdx][iSynthViewIdx],336 m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx][iSynthViewIdx],337 m_cCameraData.getBaseViewShiftLUTI ()[iRightBaseViewIdx][iLeftBaseViewIdx ],338 339 iRelDistToLeft340 );341 342 m_pcRenTop->interpolateView(343 apcPicYuvBaseVideo[iLeftBaseViewIdx ],344 apcPicYuvBaseDepth[iLeftBaseViewIdx ],345 apcPicYuvBaseVideo[iRightBaseViewIdx],346 apcPicYuvBaseDepth[iRightBaseViewIdx],347 pcPicYuvSynthOut,348 iBlendMode,349 iSimEnhBaseView350 );351 }352 else353 {354 AOT(iLeftBaseViewIdx != iRightBaseViewIdx );355 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut );356 std::cout << "Copied Frame " << iFrame357 << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC358 << " (BaseView) " << std::endl;359 }360 361 break;362 /// EXTRAPOLATION FROM LEFT363 case 1:364 if ( !bHasLView ) // View to render is BaseView365 {366 bRender = false;367 }368 369 if ( bIsBaseView )370 {371 AOF( iLeftBaseViewIdx == iRightBaseViewIdx );372 Int iSortedBaseViewIdx = m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx];373 if ( iSortedBaseViewIdx - 1 >= 0 )374 {375 iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx - 1];376 }377 else378 {379 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;380 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original381 bRender = false;382 }383 }384 385 386 if (bRender)387 {388 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;389 m_pcRenTop->setShiftLUTs( m_cCameraData.getSynthViewShiftLUTD()[iLeftBaseViewIdx ][iSynthViewIdx],390 m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx], NULL, NULL, NULL, NULL, -1 );391 m_pcRenTop->extrapolateView( apcPicYuvBaseVideo[iLeftBaseViewIdx ], apcPicYuvBaseDepth[iLeftBaseViewIdx ], pcPicYuvSynthOut, true );392 }393 break;394 /// EXTRAPOLATION FROM RIGHT395 case 2: // extrapolation from right396 if ( !bHasRView ) // View to render is BaseView397 {398 bRender = false;399 }400 401 if ( bIsBaseView )402 {403 404 AOF( iLeftBaseViewIdx == iRightBaseViewIdx );405 Int iSortedBaseViewIdx = m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx];406 if ( iSortedBaseViewIdx + 1 < m_iNumberOfInputViews )407 {408 iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx + 1];409 }410 else411 {412 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;413 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original414 bRender = false;415 }416 }417 418 if ( bRender )419 {420 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;421 m_pcRenTop->setShiftLUTs( NULL, NULL,NULL, m_cCameraData.getSynthViewShiftLUTD()[iRightBaseViewIdx ][iSynthViewIdx],422 m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx ][iSynthViewIdx],NULL, iRelDistToLeft);423 m_pcRenTop->extrapolateView( apcPicYuvBaseVideo[iRightBaseViewIdx ], apcPicYuvBaseDepth[iRightBaseViewIdx ], pcPicYuvSynthOut, false);424 }425 break;426 }427 428 // Write Output429 430 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, 0, 0, 0, 0 );431 }432 iFrame++;433 iNumOfRenderedFrames++;434 }435 436 // Delete Buffers437 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )438 {439 apcPicYuvBaseVideo[uiBaseView]->destroy();440 delete apcPicYuvBaseVideo[uiBaseView];441 442 apcPicYuvBaseDepth[uiBaseView]->destroy();443 delete apcPicYuvBaseDepth[uiBaseView];444 445 // Temporal Filter446 if ( m_bTempDepthFilter )447 {448 apcPicYuvLastBaseVideo[uiBaseView]->destroy();449 delete apcPicYuvLastBaseVideo[uiBaseView];450 451 apcPicYuvLastBaseDepth[uiBaseView]->destroy();452 delete apcPicYuvLastBaseDepth[uiBaseView];453 }454 }455 456 pcPicYuvSynthOut->destroy();457 delete pcPicYuvSynthOut;458 459 xDestroyLib();460 461 }462 463 Void TAppRendererTop::go()464 {465 switch ( m_iRenderMode )466 {467 case 0:468 render();469 break;470 #if H_3D_VSO471 case 1:472 renderModel();473 break;474 #endif475 case 10:476 renderUsedPelsMap( );477 break;478 default:479 AOT(true);480 }481 482 #if H_3D_REN_MAX_DEV_OUT483 Double dMaxDispDiff = m_cCameraData.getMaxShiftDeviation();484 485 if ( !(dMaxDispDiff < 0) )486 {487 printf("\n Max. possible shift error: %12.3f samples.\n", dMaxDispDiff );488 }489 #endif490 }491 492 #if H_3D_VSO493 Void TAppRendererTop::renderModel()494 {495 if ( m_bUseSetupString )496 {497 xRenderModelFromString();498 }499 else500 {501 xRenderModelFromNums();502 }503 }504 505 506 507 Void TAppRendererTop::xRenderModelFromString()508 {509 xCreateLib();510 xInitLib();511 512 // Create Buffers Input Views;513 std::vector<TComPicYuv*> apcPicYuvBaseVideo;514 std::vector<TComPicYuv*> apcPicYuvBaseDepth;515 516 517 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )518 {519 TComPicYuv* pcNewVideoPic = new TComPicYuv;520 TComPicYuv* pcNewDepthPic = new TComPicYuv;521 522 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );523 apcPicYuvBaseVideo.push_back(pcNewVideoPic);524 525 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );526 apcPicYuvBaseDepth.push_back(pcNewDepthPic);527 }528 529 Int aiPad[2] = { 0, 0 };530 531 // Init Model532 TRenModel cCurModel;533 534 AOT( m_iLog2SamplingFactor != 0 );535 #if H_3D_VSO_EARLY_SKIP536 cCurModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false );537 #else538 cCurModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin );539 #endif540 541 cCurModel.setupPart( 0, m_iSourceHeight );542 543 for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfInputViews; iViewIdx++ )544 {545 Int iNumOfModels = m_cRenModStrParser.getNumOfModelsForView(iViewIdx, 1);546 547 for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ )548 {549 Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode;550 m_cRenModStrParser.getSingleModelData ( iViewIdx, 1, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ;551 cCurModel .createSingleModel ( iViewIdx, 1, iModelNum, iLeftViewNum, iRightViewNum, false, iBlendMode );552 553 }554 }555 556 // Create Buffer for synthesized View557 TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;558 pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );559 560 Bool bAnyEOS = false;561 562 Int iNumOfRenderedFrames = 0;563 Int iFrame = 0;564 565 while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )566 {567 568 if ( iFrame >= m_iFrameSkip )569 {570 // read in depth and video571 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )572 {573 m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], aiPad ) ;574 bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();575 576 m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], aiPad ) ;577 bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();578 }579 }580 else581 {582 iFrame++;583 continue;584 }585 586 587 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )588 {589 TComPicYuv* pcPicYuvVideo = apcPicYuvBaseVideo[iBaseViewIdx];590 TComPicYuv* pcPicYuvDepth = apcPicYuvBaseDepth[iBaseViewIdx];591 Int iBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iBaseViewIdx ];592 cCurModel.setBaseView( iBaseViewSIdx, pcPicYuvVideo, pcPicYuvDepth, NULL, NULL );593 }594 595 m_cCameraData.update( (UInt) ( iFrame - m_iFrameSkip ));596 597 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )598 {599 // setup virtual views600 Int iBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iBaseViewIdx];601 602 cCurModel.setErrorMode( iBaseViewSIdx, 1, 0 );603 Int iNumOfSV = m_cRenModStrParser.getNumOfModelsForView( iBaseViewSIdx, 1);604 for (Int iCurView = 0; iCurView < iNumOfSV; iCurView++ )605 {606 Int iOrgRefBaseViewSIdx;607 Int iLeftBaseViewSIdx;608 Int iRightBaseViewSIdx;609 Int iSynthViewRelNum;610 Int iModelNum;611 Int iBlendMode;612 613 m_cRenModStrParser.getSingleModelData(iBaseViewSIdx, 1, iCurView, iModelNum, iBlendMode, iLeftBaseViewSIdx, iRightBaseViewSIdx, iOrgRefBaseViewSIdx, iSynthViewRelNum );614 615 Int iLeftBaseViewIdx = -1;616 Int iRightBaseViewIdx = -1;617 618 TComPicYuv* pcPicYuvOrgRef = NULL;619 Int** ppiShiftLUTLeft = NULL;620 Int** ppiShiftLUTRight = NULL;621 Int** ppiBaseShiftLUTLeft = NULL;622 Int** ppiBaseShiftLUTRight = NULL;623 624 625 Int iDistToLeft = -1;626 627 Int iSynthViewIdx = m_cCameraData.synthRelNum2Idx( iSynthViewRelNum );628 629 if ( iLeftBaseViewSIdx != -1 )630 {631 iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [ iLeftBaseViewSIdx ];632 ppiShiftLUTLeft = m_cCameraData.getSynthViewShiftLUTI()[ iLeftBaseViewIdx ][ iSynthViewIdx ];633 }634 635 if ( iRightBaseViewSIdx != -1 )636 {637 iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [iRightBaseViewSIdx ];638 ppiShiftLUTRight = m_cCameraData.getSynthViewShiftLUTI()[ iRightBaseViewIdx ][ iSynthViewIdx ];639 }640 641 if ( iRightBaseViewSIdx != -1 && iLeftBaseViewSIdx != -1 )642 {643 644 ppiBaseShiftLUTLeft = m_cCameraData.getBaseViewShiftLUTI() [ iLeftBaseViewIdx ][ iRightBaseViewIdx ];645 ppiBaseShiftLUTRight = m_cCameraData.getBaseViewShiftLUTI() [ iRightBaseViewIdx ][ iLeftBaseViewIdx ];646 iDistToLeft = m_cCameraData.getRelDistLeft( iSynthViewIdx , iLeftBaseViewIdx, iRightBaseViewIdx);647 }648 649 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;650 651 cCurModel.setSingleModel( iModelNum, ppiShiftLUTLeft, ppiBaseShiftLUTLeft, ppiShiftLUTRight, ppiBaseShiftLUTRight, iDistToLeft, pcPicYuvOrgRef );652 653 Int iViewPos;654 if (iLeftBaseViewSIdx != -1 && iRightBaseViewSIdx != -1)655 {656 iViewPos = VIEWPOS_MERGED;657 }658 else if ( iLeftBaseViewSIdx != -1 )659 {660 iViewPos = VIEWPOS_LEFT;661 }662 else if ( iRightBaseViewSIdx != -1 )663 {664 iViewPos = VIEWPOS_RIGHT;665 }666 else667 {668 AOT(true);669 }670 671 cCurModel.getSynthVideo ( iModelNum, iViewPos, pcPicYuvSynthOut );672 673 // Write Output674 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iModelNum]->write( pcPicYuvSynthOut, 0 ,0 ,0, 0 );675 }676 }677 iFrame++;678 iNumOfRenderedFrames++;679 }680 681 // Delete Buffers682 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )683 {684 apcPicYuvBaseVideo[uiBaseView]->destroy();685 delete apcPicYuvBaseVideo[uiBaseView];686 687 apcPicYuvBaseDepth[uiBaseView]->destroy();688 delete apcPicYuvBaseDepth[uiBaseView];689 }690 pcPicYuvSynthOut->destroy();691 delete pcPicYuvSynthOut;692 693 xDestroyLib();694 }695 696 697 Void TAppRendererTop::xRenderModelFromNums()698 {699 xCreateLib();700 xInitLib();701 702 // Create Buffers Input Views;703 std::vector<TComPicYuv*> apcPicYuvBaseVideo;704 std::vector<TComPicYuv*> apcPicYuvBaseDepth;705 706 707 Int aiPad[2] = { 0, 0 };708 709 // Init Model710 TRenModel cCurModel;711 712 AOT( m_iLog2SamplingFactor != 0 );713 cCurModel.setupPart( 0, m_iSourceHeight );714 #if H_3D_VSO_EARLY_SKIP715 cCurModel.create( m_iNumberOfInputViews, m_iNumberOfOutputViews, m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false );716 #else717 cCurModel.create( m_iNumberOfInputViews, m_iNumberOfOutputViews, m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin );718 #endif719 720 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )721 {722 TComPicYuv* pcNewVideoPic = new TComPicYuv;723 TComPicYuv* pcNewDepthPic = new TComPicYuv;724 725 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );726 apcPicYuvBaseVideo.push_back(pcNewVideoPic);727 728 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );729 apcPicYuvBaseDepth.push_back(pcNewDepthPic);730 }731 732 for(Int iSynthViewIdx=0; iSynthViewIdx < m_iNumberOfOutputViews; iSynthViewIdx++ )733 {734 Int iLeftBaseViewIdx = -1;735 Int iRightBaseViewIdx = -1;736 Bool bIsBaseView = false;737 738 Int iRelDistToLeft;739 m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftBaseViewIdx, iRightBaseViewIdx, iRelDistToLeft, bIsBaseView );740 741 if (m_iRenderDirection == 1 )742 {743 iRightBaseViewIdx = -1;744 AOT( iLeftBaseViewIdx == -1);745 }746 747 if (m_iRenderDirection == 2 )748 {749 iLeftBaseViewIdx = -1;750 AOT( iRightBaseViewIdx == -1);751 }752 753 Int iLeftBaseViewSIdx = -1;754 Int iRightBaseViewSIdx = -1;755 756 if (iLeftBaseViewIdx != -1 )757 {758 iLeftBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iLeftBaseViewIdx];759 }760 761 if (iRightBaseViewIdx != -1 )762 {763 iRightBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iRightBaseViewIdx];764 }765 cCurModel.createSingleModel(-1, -1, iSynthViewIdx, iLeftBaseViewSIdx, iRightBaseViewSIdx, false, m_iBlendMode );766 }767 768 // Create Buffer for synthesized View769 TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;770 pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );771 772 Bool bAnyEOS = false;773 774 Int iNumOfRenderedFrames = 0;775 Int iFrame = 0;776 777 while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )778 {779 780 if ( iFrame >= m_iFrameSkip )781 {782 // read in depth and video783 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )784 {785 m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], aiPad ) ;786 bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();787 788 m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], aiPad ) ;789 bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();790 791 if ( iFrame >= m_iFrameSkip )792 {793 Int iBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iBaseViewIdx];794 cCurModel.setBaseView( iBaseViewSIdx, apcPicYuvBaseVideo[iBaseViewIdx], apcPicYuvBaseDepth[iBaseViewIdx], NULL, NULL );795 }796 }797 }798 else799 {800 iFrame++;801 continue;802 }803 m_cCameraData.update( (UInt) (iFrame - m_iFrameSkip ));804 for(Int iSynthViewIdx=0; iSynthViewIdx < m_iNumberOfOutputViews; iSynthViewIdx++ )805 {806 807 Int iLeftBaseViewIdx = -1;808 Int iRightBaseViewIdx = -1;809 810 Bool bIsBaseView = false;811 812 Int iRelDistToLeft;813 Bool bHasLRView = m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftBaseViewIdx, iRightBaseViewIdx, iRelDistToLeft, bIsBaseView );814 Bool bHasLView = ( iLeftBaseViewIdx != -1 );815 Bool bHasRView = ( iRightBaseViewIdx != -1 );816 817 switch( m_iRenderDirection )818 {819 /// INTERPOLATION820 case 0:821 assert( bHasLRView || bIsBaseView );822 823 if ( !bHasLRView && bIsBaseView ) // View to render is BaseView824 {825 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;826 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original827 }828 else // Render829 {830 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;831 cCurModel.setSingleModel( iSynthViewIdx,832 m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx] ,833 m_cCameraData.getBaseViewShiftLUTI ()[iLeftBaseViewIdx ][iRightBaseViewIdx],834 m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx][iSynthViewIdx] ,835 m_cCameraData.getBaseViewShiftLUTI ()[iRightBaseViewIdx][iLeftBaseViewIdx] ,836 iRelDistToLeft,837 NULL );838 cCurModel.getSynthVideo ( iSynthViewIdx, VIEWPOS_MERGED, pcPicYuvSynthOut );839 }840 break;841 /// EXTRAPOLATION FROM LEFT842 case 1:843 844 if ( !bHasLView ) // View to render is BaseView845 {846 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;847 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original848 }849 else // Render850 {851 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;852 cCurModel.setSingleModel( iSynthViewIdx, m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx], NULL, NULL, NULL, -1, NULL);853 cCurModel.getSynthVideo ( iSynthViewIdx, VIEWPOS_LEFT, pcPicYuvSynthOut );854 }855 break;856 /// EXTRAPOLATION FROM RIGHT857 case 2: // extrapolation from right858 if ( !bHasRView ) // View to render is BaseView859 {860 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;861 apcPicYuvBaseVideo[iRightBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original862 }863 else // Render864 {865 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;866 cCurModel.setSingleModel( iSynthViewIdx, NULL , NULL, m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx ][iSynthViewIdx], NULL, -1, NULL);867 cCurModel.getSynthVideo ( iSynthViewIdx, VIEWPOS_RIGHT, pcPicYuvSynthOut );868 }869 break;870 }871 872 // Write Output873 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, 0, 0, 0, 0 );874 }875 iFrame++;876 iNumOfRenderedFrames++;877 }878 879 // Delete Buffers880 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )881 {882 apcPicYuvBaseVideo[uiBaseView]->destroy();883 delete apcPicYuvBaseVideo[uiBaseView];884 885 apcPicYuvBaseDepth[uiBaseView]->destroy();886 delete apcPicYuvBaseDepth[uiBaseView];887 }888 pcPicYuvSynthOut->destroy();889 delete pcPicYuvSynthOut;890 891 xDestroyLib();892 893 }894 #endif895 896 Void TAppRendererTop::renderUsedPelsMap( )897 {898 xCreateLib();899 xInitLib();900 901 // Create Buffers Input Views;902 std::vector<TComPicYuv*> apcPicYuvBaseVideo;903 std::vector<TComPicYuv*> apcPicYuvBaseDepth;904 905 // TemporalImprovement Filter906 std::vector<TComPicYuv*> apcPicYuvLastBaseVideo;907 std::vector<TComPicYuv*> apcPicYuvLastBaseDepth;908 909 Int aiPad[2] = { 0, 0 };910 911 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )912 {913 TComPicYuv* pcNewVideoPic = new TComPicYuv;914 TComPicYuv* pcNewDepthPic = new TComPicYuv;915 916 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );917 apcPicYuvBaseVideo.push_back(pcNewVideoPic);918 919 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );920 apcPicYuvBaseDepth.push_back(pcNewDepthPic);921 922 //Temporal improvement Filter923 if ( m_bTempDepthFilter )924 {925 pcNewVideoPic = new TComPicYuv;926 pcNewDepthPic = new TComPicYuv;927 928 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );929 apcPicYuvLastBaseVideo.push_back(pcNewVideoPic);930 931 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );932 apcPicYuvLastBaseDepth.push_back(pcNewDepthPic);933 }934 }935 936 // Create Buffer for synthesized View937 TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;938 pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, 1, 1, 1 );939 940 Bool bAnyEOS = false;941 942 Int iNumOfRenderedFrames = 0;943 Int iFrame = 0;944 945 while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )946 {947 if ( iFrame >= m_iFrameSkip )948 {949 // read in depth and video950 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )951 {952 m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], aiPad ) ;953 apcPicYuvBaseVideo[iBaseViewIdx]->extendPicBorder();954 bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();955 956 m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], aiPad ) ;957 apcPicYuvBaseDepth[iBaseViewIdx]->extendPicBorder();958 bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();959 960 if ( m_bTempDepthFilter && (iFrame >= m_iFrameSkip) )961 {962 m_pcRenTop->temporalFilterVSRS( apcPicYuvBaseVideo[iBaseViewIdx], apcPicYuvBaseDepth[iBaseViewIdx], apcPicYuvLastBaseVideo[iBaseViewIdx], apcPicYuvLastBaseDepth[iBaseViewIdx], ( iFrame == m_iFrameSkip) );963 }964 }965 }966 else967 {968 std::cout << "Skipping Frame " << iFrame << std::endl;969 970 iFrame++;971 continue;972 }973 m_cCameraData.update( (UInt) ( iFrame - m_iFrameSkip ) );974 975 for(Int iViewIdx=1; iViewIdx < m_iNumberOfInputViews; iViewIdx++ )976 {977 std::cout << "Rendering UsedPelsMap for Frame " << iFrame << " of View " << (Double) m_cCameraData.getBaseViewNumbers()[iViewIdx] << std::endl;978 979 Int iViewSIdx = m_cCameraData.getBaseId2SortedId()[iViewIdx];980 Int iFirstViewSIdx = m_cCameraData.getBaseId2SortedId()[0];981 982 AOT( iViewSIdx == iFirstViewSIdx );983 984 Bool bFirstIsLeft = (iFirstViewSIdx < iViewSIdx);985 986 m_pcRenTop->setShiftLUTs(987 m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx],988 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],989 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],990 m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx],991 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],992 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],993 -1994 );995 996 m_pcRenTop->getUsedSamplesMap( apcPicYuvBaseDepth[0], pcPicYuvSynthOut, bFirstIsLeft );997 998 // Write Output999 m_apcTVideoIOYuvSynthOutput[iViewIdx-1]->write( pcPicYuvSynthOut, 0, 0, 0 );1000 1001 }1002 iFrame++;1003 iNumOfRenderedFrames++;1004 }1005 1006 // Delete Buffers1007 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )1008 {1009 apcPicYuvBaseVideo[uiBaseView]->destroy();1010 delete apcPicYuvBaseVideo[uiBaseView];1011 1012 apcPicYuvBaseDepth[uiBaseView]->destroy();1013 delete apcPicYuvBaseDepth[uiBaseView];1014 1015 // Temporal Filter1016 if ( m_bTempDepthFilter )1017 {1018 apcPicYuvLastBaseVideo[uiBaseView]->destroy();1019 delete apcPicYuvLastBaseVideo[uiBaseView];1020 1021 apcPicYuvLastBaseDepth[uiBaseView]->destroy();1022 delete apcPicYuvLastBaseDepth[uiBaseView];1023 }1024 }1025 pcPicYuvSynthOut->destroy();1026 delete pcPicYuvSynthOut;1027 1028 xDestroyLib();1029 1030 }1031 #endif -
branches/HTM-12.1-MV-draft-1/source/App/TAppRenderer/TAppRendererTop.h
r608 r1072 40 40 #define __TAppRendererTOP__ 41 41 #include "../../Lib/TLibCommon/TypeDef.h" 42 #if H_3D43 #include "../../Lib/TLibRenderer/TRenTop.h"44 #include "../../Lib/TLibVideoIO/TVideoIOYuv.h"45 #include "TAppRendererCfg.h"46 #include "TAppRendererTop.h"47 #include "../../Lib/TLibRenderer/TRenModel.h"48 49 // ====================================================================================================================50 // Class definition51 // ====================================================================================================================52 53 /// encoder application class54 class TAppRendererTop : public TAppRendererCfg55 {56 private:57 // class interface58 std::vector<TVideoIOYuv*> m_apcTVideoIOYuvVideoInput;59 std::vector<TVideoIOYuv*> m_apcTVideoIOYuvDepthInput;60 std::vector<TVideoIOYuv*> m_apcTVideoIOYuvSynthOutput;61 62 // RendererInterface63 TRenTop* m_pcRenTop;64 65 protected:66 // initialization67 Void xCreateLib (); ///< create renderer class and video io68 Void xInitLib (); ///< initialize renderer class69 Void xDestroyLib (); ///< destroy renderer class and video io70 #if H_3D_VSO71 Void xRenderModelFromString(); ///< render using model using setup string72 Void xRenderModelFromNums(); ///< render using model using synth view numbers73 #endif74 75 public:76 TAppRendererTop();77 virtual ~TAppRendererTop();78 79 Void render (); ///< main encoding function80 #if H_3D_VSO81 Void renderModel ();82 #endif83 Void go ();84 Void renderUsedPelsMap();85 86 };// END CLASS DEFINITION TAppRendererTop87 88 89 #endif // H_3D90 42 #endif // __TAppRendererTOP__ -
branches/HTM-12.1-MV-draft-1/source/Lib/TAppCommon/TAppComCamPara.cpp
r655 r1072 49 49 #include <functional> 50 50 #include <string> 51 #if H_3D52 53 54 Void55 TAppComCamPara::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT, Double***& radShiftParams, Int64***& raiShiftParams )56 {57 AOF( m_uiBitDepthForLUT == 8 );58 AOF( radShiftParams == NULL && raiShiftParams == NULL && radLUT == NULL && raiLUT == NULL );59 60 uiNumberSourceViews = std::max( (UInt) 1, uiNumberSourceViews );61 uiNumberTargetViews = std::max( (UInt) 1, uiNumberTargetViews );62 63 radShiftParams = new Double** [ uiNumberSourceViews ];64 raiShiftParams = new Int64 ** [ uiNumberSourceViews ];65 radLUT = new Double***[ uiNumberSourceViews ];66 raiLUT = new Int ***[ uiNumberSourceViews ];67 68 for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ )69 {70 radShiftParams[ uiSourceView ] = new Double* [ uiNumberTargetViews ];71 raiShiftParams[ uiSourceView ] = new Int64 * [ uiNumberTargetViews ];72 radLUT [ uiSourceView ] = new Double**[ uiNumberTargetViews ];73 raiLUT [ uiSourceView ] = new Int **[ uiNumberTargetViews ];74 75 for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ )76 {77 radShiftParams[ uiSourceView ][ uiTargetView ] = new Double [ 2 ];78 raiShiftParams[ uiSourceView ][ uiTargetView ] = new Int64 [ 2 ];79 80 radLUT [ uiSourceView ][ uiTargetView ] = new Double*[ 2 ];81 radLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ];82 radLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ];83 84 raiLUT [ uiSourceView ][ uiTargetView ] = new Int* [ 2 ];85 raiLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Int [ 257 ];86 raiLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Int [ 257 ];87 }88 }89 }90 91 Void92 TAppComCamPara::xCreate2dArray( UInt uiNum1Ids, UInt uiNum2Ids, Int**& raaiArray )93 {94 AOT( raaiArray || uiNum1Ids == 0 || uiNum2Ids == 0 );95 raaiArray = new Int* [ uiNum1Ids ];96 for( UInt uiId1 = 0; uiId1 < uiNum1Ids; uiId1++ )97 {98 raaiArray[ uiId1 ] = new Int [ uiNum2Ids ];99 }100 }101 102 103 Void104 TAppComCamPara::xInit2dArray( UInt uiNum1Ids, UInt uiNum2Ids, Int**& raaiArray, Int iValue )105 {106 for( UInt uiId1 = 0; uiId1 < uiNum1Ids; uiId1++ )107 {108 for( UInt uiId2 = 0; uiId2 < uiNum2Ids; uiId2++ )109 {110 raaiArray[ uiId1 ][ uiId2 ] = iValue;111 }112 }113 }114 115 116 Void117 TAppComCamPara::convertNumberString( Char* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec )118 {119 Bool bStringIsRange = false;120 Int iIdx = 0;121 std::vector<Double> adViewNumbers;122 123 while( pchViewNumberString != 0 && pchViewNumberString[ iIdx ] != 0 )124 {125 if( pchViewNumberString[ iIdx ] == ':' )126 {127 bStringIsRange = true;128 pchViewNumberString[ iIdx ] = ' ';129 }130 iIdx++;131 }132 133 Char* pcNextStart = pchViewNumberString;134 Char* pcEnd = pcNextStart + iIdx;135 Char* pcOldStart = 0;136 137 while( pcNextStart < pcEnd )138 {139 errno = 0;140 adViewNumbers.push_back( ( strtod( pcNextStart, &pcNextStart ) ) );141 142 if( errno == ERANGE || pcNextStart == pcOldStart )143 {144 std::cerr << "Error Parsing View Number String: `" << pchViewNumberString << "'" << std::endl;145 AOT(true);146 exit( EXIT_FAILURE );147 };148 149 while( pcNextStart < pcEnd && ( *pcNextStart == ' ' || *pcNextStart == '\t' || *pcNextStart == '\r' ) ) pcNextStart++;150 151 pcOldStart = pcNextStart;152 }153 154 if( bStringIsRange )155 {156 if( adViewNumbers.size() != 3 )157 {158 std::cerr << "Error Parsing SynthViewNumbers: `" << pchViewNumberString << "'" << std::endl;159 AOT(true);160 exit( EXIT_FAILURE );161 }162 163 Double dRangeBegin = adViewNumbers[0];164 Double dRangeStep = adViewNumbers[1];165 Double dRangeEnd = adViewNumbers[2];166 167 if( ( ( dRangeEnd - dRangeBegin > 0 ) != ( dRangeStep > 0 ) ) || dRangeStep == 0 )168 {169 std::cerr << "Error Parsing SynthViewNumbers: `" << pchViewNumberString << "'" << std::endl;170 AOT(true);171 exit( EXIT_FAILURE );172 }173 174 raiViewNumbers.clear();175 176 Double dFac = ( dRangeBegin > dRangeEnd ? -1 : 1 );177 178 for( Double dViewNumber = dRangeBegin; ( dViewNumber - dRangeEnd ) * dFac <= 0; dViewNumber += dRangeStep )179 {180 raiViewNumbers.push_back( (Int)( dViewNumber * dViewNumPrec ) );181 }182 }183 else184 {185 for( UInt uiViewNum = 0; uiViewNum < adViewNumbers.size(); uiViewNum++ )186 {187 raiViewNumbers.push_back( (Int)( adViewNumbers[ uiViewNum ] * dViewNumPrec ) );188 }189 }190 }191 192 193 Void194 TAppComCamPara::xReadCameraParameterFile( Char* pchCfgFileName )195 {196 std::ifstream cCfgStream( pchCfgFileName, std::ifstream::in );197 if( !cCfgStream )198 {199 std::cerr << "Failed to open camera parameter file: `" << pchCfgFileName << "'" << std::endl;200 exit( EXIT_FAILURE );201 }202 203 Int iLineNumber = 0;204 do205 {206 std::string cLine;207 getline( cCfgStream, cLine );208 iLineNumber++;209 210 size_t iStart = cLine.find_first_not_of( " \t\n\r" );211 212 if( iStart == std::string::npos )213 {214 continue;215 }216 217 if( cLine[iStart] == '#' )218 {219 continue;220 }221 222 Char* pcNextStart = (Char*) cLine.data();223 Char* pcEnd = pcNextStart + cLine.length();224 225 std::vector<Double> caNewLine;226 caNewLine.clear();227 228 Char* pcOldStart = 0;229 while( pcNextStart < pcEnd )230 {231 errno = 0;232 caNewLine.push_back( strtod( pcNextStart, &pcNextStart ) ) ;233 234 if( errno == ERANGE || ( pcNextStart == pcOldStart ) )235 {236 std::cerr << "Failed reading config file: `" << pchCfgFileName << "' Error parsing double values in Line: " << iLineNumber << ' ' << std::endl;237 assert( 0 );238 exit( EXIT_FAILURE );239 };240 pcOldStart = pcNextStart;241 242 while( ( pcNextStart < pcEnd ) && ( *pcNextStart == ' ' || *pcNextStart == '\t' || *pcNextStart == '\r' ) ) pcNextStart++;243 }244 245 if ( ( caNewLine.size() != 2 ) && ( caNewLine.size() != 7 ) && ( caNewLine.size() != 6 ) && ( caNewLine.size() != 8 ) )246 {247 std::cerr << "Failed reading config file: `" << pchCfgFileName << "'" << std::endl;248 std::cerr << "Invalid number of entries" << std::endl;249 AOF(false);250 exit( EXIT_FAILURE );251 }252 m_aadCameraParameters.push_back( caNewLine );253 }254 while( cCfgStream );255 }256 257 Void258 TAppComCamPara::xGetCodedCameraData( UInt uiSourceView, UInt uiTargetView, Bool bByIdx, UInt uiFrame, Int& riScale, Int& riOffset, Int& riPrecision )259 {260 if( bByIdx )261 {262 uiSourceView = m_aiBaseViews[ uiSourceView ];263 uiTargetView = m_aiBaseViews[ uiTargetView ];264 }265 266 Int iFoundLine = -1;267 for( UInt uiCurViewLine = 0; uiCurViewLine < m_aadCameraParameters.size(); uiCurViewLine++ )268 {269 if ( m_aadCameraParameters[uiCurViewLine].size() == 2 )270 continue;271 272 if( ( (Int)( m_aadCameraParameters[ uiCurViewLine ][ 3 ] * m_dViewNumPrec ) == uiSourceView )273 && ( (Int)( m_aadCameraParameters[ uiCurViewLine ][ 2 ] * m_dViewNumPrec ) == uiTargetView )274 )275 {276 if( ( (UInt)m_aadCameraParameters[ uiCurViewLine ][ 0 ] <= uiFrame ) && ( (UInt)m_aadCameraParameters[ uiCurViewLine ][ 1 ] >= uiFrame ) )277 {278 if( iFoundLine != -1 )279 {280 std::cerr << "Error CameraParameters for SourceView " << (Double) uiSourceView / m_dViewNumPrec << " and Target View " << (Double) uiTargetView / m_dViewNumPrec << " and Frame " << uiFrame << " given multiple times." << std::endl;281 AOT(true);282 exit( EXIT_FAILURE );283 }284 else285 {286 iFoundLine = uiCurViewLine;287 }288 }289 }290 }291 292 if ( iFoundLine == -1 )293 {294 std::cerr << "Error CameraParameters for SourceView " << (Double) uiSourceView / m_dViewNumPrec << " and Target View " << (Double) uiTargetView / m_dViewNumPrec << " and Frame " << uiFrame << " not found." << std::endl;295 AOT(true);296 exit( EXIT_FAILURE );297 }298 299 riScale = (Int)( m_aadCameraParameters[ iFoundLine ][ 4 ] );300 riOffset = (Int)( m_aadCameraParameters[ iFoundLine ][ 5 ] );301 riPrecision = (Int)( m_aadCameraParameters[ iFoundLine ][ 6 ] );302 }303 304 Bool305 TAppComCamPara::xGetCameraDataRow( Int iView, UInt uiFrame, UInt& ruiFoundLine )306 {307 ruiFoundLine = -1;308 for( UInt uiCurViewLine = 0; uiCurViewLine < m_aadCameraParameters.size(); uiCurViewLine++ )309 {310 if( (Int)( m_aadCameraParameters[ uiCurViewLine ][ 0 ] * m_dViewNumPrec ) == iView )311 {312 if( ( (UInt)m_aadCameraParameters[ uiCurViewLine ][ 1 ] <= uiFrame ) && ( (UInt)m_aadCameraParameters[ uiCurViewLine ][ 2 ] >= uiFrame ) )313 {314 if( ruiFoundLine != -1 )315 {316 std::cerr << "Error CameraParameters for View " << (Double) iView / m_dViewNumPrec << " and Frame " << uiFrame << " given multiple times." << std::endl;317 exit( EXIT_FAILURE );318 }319 else320 {321 ruiFoundLine = uiCurViewLine;322 }323 }324 }325 }326 return ( ruiFoundLine == -1 );327 }328 329 330 Void331 TAppComCamPara::xGetSortedViewList( const std::vector<Int>& raiViews, std::vector<Int>& raiSortedViews, std::vector<Int>& raiId2SortedId, std::vector<Int>& raiSortedId2Id )332 {333 AOF( raiViews.size() > 0 );334 Int iNumViews = (Int)raiViews.size();335 raiId2SortedId = std::vector<Int>( raiViews.size(), -1 );336 raiSortedId2Id.clear();337 raiSortedViews.clear();338 for( Int iSortId = 0; iSortId < iNumViews; iSortId++ )339 {340 Int iLeftMostBaseId = -1;341 for( Int iBaseId = 0; iLeftMostBaseId == -1 && iBaseId < iNumViews; iBaseId++ )342 {343 if( raiId2SortedId[ iBaseId ] == -1 )344 {345 UInt uiFoundLine = -1;346 xGetCameraDataRow( raiViews[ iBaseId ], 0, uiFoundLine );347 AOT( uiFoundLine == -1 ); // something wrong348 Double dXPos = m_aadCameraParameters[ uiFoundLine ][ 4 ];349 Double dZNear = m_aadCameraParameters[ uiFoundLine ][ 6 ];350 Double dZFar = m_aadCameraParameters[ uiFoundLine ][ 7 ];351 Double dSign = ( dZFar > 0 ? 1.0 : -1.0 );352 Bool bLeftMost = true;353 AOF( dZNear * dZFar > 0.0 ); // otherwise, z parameters are not correct354 355 for( Int iTestBaseId = 0; bLeftMost && iTestBaseId < iNumViews; iTestBaseId++ )356 {357 if( iTestBaseId != iBaseId && raiId2SortedId[ iTestBaseId ] == -1 )358 {359 UInt uiFoundLineTest = -1;360 xGetCameraDataRow( raiViews[ iTestBaseId ], 0, uiFoundLineTest );361 AOT( uiFoundLineTest == -1 ); // something wrong362 Double dXPosTest = m_aadCameraParameters[ uiFoundLineTest ][ 4 ];363 Double dZNearTest = m_aadCameraParameters[ uiFoundLineTest ][ 6 ];364 Double dZFarTest = m_aadCameraParameters[ uiFoundLineTest ][ 7 ];365 AOF( dZNearTest * dZFarTest > 0.0 ); // otherwise, z parameters are not correct366 AOF( dZNearTest * dSign > 0.0 ); // otherwise, z parameters are not consistent367 Double dDeltaXPos = dSign * ( dXPosTest - dXPos );368 bLeftMost = ( bLeftMost && dDeltaXPos > 0.0 );369 }370 }371 if( bLeftMost )372 {373 iLeftMostBaseId = iBaseId;374 }375 }376 }377 AOT( iLeftMostBaseId == -1 ); // something wrong378 raiId2SortedId[ iLeftMostBaseId ] = iSortId;379 raiSortedId2Id.push_back( iLeftMostBaseId );380 raiSortedViews.push_back( raiViews[ iLeftMostBaseId ] );381 }382 383 // sanity check384 if( iNumViews > 2 )385 {386 Int iDeltaView = gSign( raiSortedViews[ 1 ] - raiSortedViews[ 0 ] );387 Bool bOutOfOrder = false;388 for( Int iSIdx = 2; iSIdx < iNumViews; iSIdx++ )389 {390 bOutOfOrder = ( bOutOfOrder || iDeltaView * gSign( raiSortedViews[ iSIdx ] - raiSortedViews[ iSIdx - 1 ] ) < 0 );391 }392 if( bOutOfOrder )393 {394 std::cerr << "ERROR: View numbering must be strictly increasing or decreasing from left to right" << std::endl;395 exit(EXIT_FAILURE);396 }397 }398 }399 400 401 Void402 TAppComCamPara::xGetViewOrderIndices( const std::vector<Int>& raiId2SortedId, std::vector<Int>& raiVOIdx )403 {404 AOF( raiId2SortedId.size() );405 raiVOIdx = raiId2SortedId;406 Int iSize = (Int)raiId2SortedId.size();407 Int iOffs = raiId2SortedId[ 0 ];408 for( Int iIdx = 0; iIdx < iSize; iIdx++ )409 {410 raiVOIdx[ iIdx ] -= iOffs;411 }412 }413 414 415 Bool416 TAppComCamPara::xGetCamParsChangeFlag()417 {418 Bool bChangeDetected = false;419 for( Int iBaseViewId = 0; !bChangeDetected && iBaseViewId < m_iNumberOfBaseViews; iBaseViewId++ )420 {421 if ( m_bSetupFromCoded )422 {423 for( Int iTargetViewId = 0; !bChangeDetected && iTargetViewId < m_iNumberOfBaseViews; iTargetViewId++ )424 {425 Int iTargetView = m_aiBaseViews[iTargetViewId];426 Int iSourceView = m_aiBaseViews[iBaseViewId ];427 428 Int iS1 ,iSX;429 Int iO1 ,iOX;430 Int iP1 ,iPX;431 432 if ( iSourceView == iTargetView )433 continue;434 435 xGetCodedCameraData( iSourceView, iTargetView, false, 0, iS1, iO1, iP1 );436 for( UInt uiFrameId = m_uiFirstFrameId + 1; !bChangeDetected && uiFrameId <= m_uiLastFrameId; uiFrameId++ )437 {438 xGetCodedCameraData( iSourceView, iTargetView, false, uiFrameId, iSX, iOX, iPX );439 440 if( iS1 != iSX || iO1 != iOX || iP1 != iPX )441 {442 bChangeDetected = true;443 }444 }445 }446 }447 else448 {449 Int iBaseView = m_aiBaseViews[ iBaseViewId ];450 Double dFL1, dFLX;451 Double dCP1, dCPX;452 Double dCS1, dCSX;453 Double dZN1, dZNX;454 Double dZF1, dZFX;455 Bool bInterpolated;456 xGetGeometryData( iBaseView, m_uiFirstFrameId, dFL1, dCP1, dCS1, bInterpolated ); AOT( bInterpolated );457 xGetZNearZFar ( iBaseView, m_uiFirstFrameId, dZN1, dZF1 );458 459 for( UInt uiFrameId = m_uiFirstFrameId + 1; !bChangeDetected && uiFrameId <= m_uiLastFrameId; uiFrameId++ )460 {461 xGetGeometryData( iBaseView, uiFrameId, dFLX, dCPX, dCSX, bInterpolated ); AOT( bInterpolated );462 xGetZNearZFar ( iBaseView, uiFrameId, dZNX, dZFX );463 464 if( dFL1 != dFLX || dCP1 != dCPX || dCS1 != dCSX || dZN1 != dZNX || dZF1 != dZFX )465 {466 bChangeDetected = true;467 }468 }469 }470 }471 return bChangeDetected;472 }473 474 Int475 TAppComCamPara::xGetViewId( std::vector<Int> aiViewList, Int iBaseView )476 {477 Int iViewId = -1;478 for( Int iId = 0; iId < (Int)aiViewList.size(); iId++ )479 {480 if( aiViewList[ iId ] == iBaseView )481 {482 iViewId = iId;483 break;484 }485 }486 AOT( iViewId == -1 );487 return iViewId;488 }489 490 Int491 TAppComCamPara::xGetBaseViewId( Int iBaseView )492 {493 return xGetViewId( m_aiBaseViews, iBaseView );494 }495 496 497 Bool498 TAppComCamPara::xGetLeftRightView( Int iView, std::vector<Int> aiSortedViews, Int& riLeftView, Int& riRightView, Int& riLeftSortedViewIdx, Int& riRightSortedViewIdx )499 {500 Bool bFoundLRView = false;501 Int iLeftView = -1;502 Int iRightView = -1;503 Int iLeftViewIdx = -1;504 Int iRightViewIdx = -1;505 Bool bDecencdingVN = ( aiSortedViews.size() >= 2 && aiSortedViews[ 0 ] > aiSortedViews[ 1 ] );506 Int iFactor = ( bDecencdingVN ? -1 : 1 );507 508 for( Int iIdx = -1; iIdx < (Int)aiSortedViews.size(); iIdx++ )509 {510 if( iIdx == -1 )511 {512 if( ( aiSortedViews[ iIdx + 1 ] - iView ) * iFactor > 0 )513 {514 bFoundLRView = false;515 iLeftView = -1;516 iRightView = aiSortedViews[ iIdx + 1 ];517 iLeftViewIdx = -1;518 iRightViewIdx = iIdx + 1;519 break;520 }521 }522 else if ( iIdx == (Int)aiSortedViews.size() - 1 )523 {524 if( ( aiSortedViews[ iIdx ] - iView ) * iFactor < 0 )525 {526 bFoundLRView = false;527 iLeftView = aiSortedViews[ iIdx ];528 iRightView = -1;529 iLeftViewIdx = iIdx;530 iRightViewIdx = -1;531 break;532 }533 }534 else535 {536 if( ( ( aiSortedViews[ iIdx ] - iView ) * iFactor <= 0 ) && ( ( aiSortedViews[ iIdx + 1 ] - iView ) * iFactor >= 0 ) )537 {538 bFoundLRView = true;539 iLeftView = aiSortedViews[ iIdx ];540 iRightView = aiSortedViews[ iIdx + 1 ];541 iLeftViewIdx = iIdx;542 iRightViewIdx = iIdx + 1;543 break;544 }545 }546 }547 548 if ( ( iView == iLeftView ) || ( iView == iRightView ) )549 {550 iLeftViewIdx = ( iView == iLeftView ) ? iLeftViewIdx : iRightViewIdx;551 iRightViewIdx = iLeftViewIdx;552 iLeftView = iView;553 iRightView = iView;554 bFoundLRView = false;555 }556 557 riLeftView = iLeftView;558 riRightView = iRightView;559 riLeftSortedViewIdx = iLeftViewIdx;560 riRightSortedViewIdx = iRightViewIdx;561 562 return bFoundLRView;563 }564 565 566 Void567 TAppComCamPara::xGetPrevAndNextBaseView( Int iSourceViewNum, Int iTargetViewNum, Int& riPrevBaseViewNum, Int& riNextBaseViewNum )568 {569 Int iLeftView;570 Int iRightView;571 Int iDummy;572 xGetLeftRightView( iTargetViewNum, m_aiSortedBaseViews, iLeftView, iRightView, iDummy, iDummy );573 574 if( iLeftView == iRightView )575 {576 riPrevBaseViewNum = iLeftView;577 riNextBaseViewNum = iLeftView;578 }579 else580 {581 Bool bDecencdingVN = ( m_aiSortedBaseViews.size() >= 2 && m_aiSortedBaseViews[ 0 ] > m_aiSortedBaseViews[ 1 ] );582 Bool bNextViewIsLeft = ( bDecencdingVN ? ( iSourceViewNum < iTargetViewNum ) : ( iSourceViewNum > iTargetViewNum ) );583 if ( bNextViewIsLeft )584 {585 riPrevBaseViewNum = iRightView;586 riNextBaseViewNum = iLeftView;587 }588 else589 {590 riPrevBaseViewNum = iLeftView;591 riNextBaseViewNum = iRightView;592 }593 }594 }595 596 597 Void598 TAppComCamPara::xGetZNearZFar( Int iView, UInt uiFrame, Double& rdZNear, Double& rdZFar )599 {600 UInt uiFoundLine = -1;601 if( !xGetCameraDataRow( iView, uiFrame, uiFoundLine ) || !( m_aadCameraParameters[ uiFoundLine ].size() < 8 ) )602 {603 rdZNear = m_aadCameraParameters[ uiFoundLine ][ 6 ];604 rdZFar = m_aadCameraParameters[ uiFoundLine ][ 7 ];605 }606 else607 {608 std::cerr << "No ZNear or no ZFar for View " << (Double)iView / m_dViewNumPrec << " and Frame " << uiFrame << " given in CameraParameterFile" << std::endl;609 exit( EXIT_FAILURE );610 }611 }612 613 Void614 TAppComCamPara::xGetGeometryData( Int iView, UInt uiFrame, Double& rdFocalLength, Double& rdPosition, Double& rdCameraShift, Bool& rbInterpolated )615 {616 UInt uiFoundLine = -1;617 if ( !xGetCameraDataRow( iView, uiFrame, uiFoundLine ) && xIsIn( m_aiSortedBaseViews, iView ))618 {619 AOT( m_aadCameraParameters[ uiFoundLine ].size() < 6 );620 rbInterpolated = false;621 rdFocalLength = m_aadCameraParameters[ uiFoundLine ][ 3 ];622 rdPosition = m_aadCameraParameters[ uiFoundLine ][ 4 ];623 rdCameraShift = m_aadCameraParameters[ uiFoundLine ][ 5 ];624 }625 else626 {627 UInt uiLeftViewLine;628 UInt uiRightViewLine;629 Int iLeftView;630 Int iRightView;631 Int iDummy;632 633 if( !xGetLeftRightView( iView, m_aiSortedBaseViews, iLeftView, iRightView, iDummy, iDummy ) ||634 xGetCameraDataRow( iLeftView, uiFrame, uiLeftViewLine ) ||635 xGetCameraDataRow( iRightView, uiFrame, uiRightViewLine )636 )637 {638 std::cerr << "No left or no right base view next to view " << (Double)iView / m_dViewNumPrec << " for Frame " << uiFrame << " given in CameraParameterFile" << std::endl;639 AOT(true);640 exit( EXIT_FAILURE );641 }642 AOT( m_aadCameraParameters[ uiLeftViewLine ].size() < 6 );643 AOT( m_aadCameraParameters[ uiRightViewLine ].size() < 6 );644 645 // Linear Interpolation646 Double dFactor = ( (Double)( iView - iLeftView ) ) / ( (Double)( iRightView - iLeftView ) );647 rdFocalLength = m_aadCameraParameters[ uiLeftViewLine ][ 3 ] + dFactor * ( m_aadCameraParameters[ uiRightViewLine ][ 3 ] - m_aadCameraParameters[ uiLeftViewLine ][ 3 ] );648 rdPosition = m_aadCameraParameters[ uiLeftViewLine ][ 4 ] + dFactor * ( m_aadCameraParameters[ uiRightViewLine ][ 4 ] - m_aadCameraParameters[ uiLeftViewLine ][ 4 ] );649 rdCameraShift = m_aadCameraParameters[ uiLeftViewLine ][ 5 ] + dFactor * ( m_aadCameraParameters[ uiRightViewLine ][ 5 ] - m_aadCameraParameters[ uiLeftViewLine ][ 5 ] );650 rbInterpolated = true;651 }652 }653 654 Bool655 TAppComCamPara::xGetShiftParameterReal( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Bool bExternal, Bool bByIdx, Double& rdScale, Double& rdOffset )656 {657 AOT( m_bSetupFromCoded );658 659 Bool bInterpolatedSource;660 Double dMinDepthSource;661 Double dMaxDepthSource;662 Double dFocalLengthSource;663 Double dPositionSource;664 Double dIntersectionSource;665 666 Bool bInterpolatedTarget;667 Double dPositionTarget;668 Double dIntersectionTarget;669 Double dFocalLengthTarget;670 671 Int iTargetViewNum;672 Int iSourceViewNum;673 674 if( bByIdx )675 {676 iSourceViewNum = m_aiBaseViews[ uiSourceView ];677 iTargetViewNum = ( bExternal ? m_aiSynthViews[ uiTargetView ] : m_aiBaseViews[ uiTargetView ] );678 }679 else680 {681 iSourceViewNum = (Int) uiSourceView;682 iTargetViewNum = (Int) uiTargetView;683 }684 685 xGetGeometryData( iSourceViewNum, uiFrame, dFocalLengthSource, dPositionSource, dIntersectionSource, bInterpolatedSource );686 xGetZNearZFar ( iSourceViewNum, uiFrame, dMinDepthSource, dMaxDepthSource );687 xGetGeometryData( iTargetViewNum, uiFrame, dFocalLengthTarget, dPositionTarget, dIntersectionTarget, bInterpolatedTarget );688 689 Double dFactor = dFocalLengthSource * ( dPositionTarget - dPositionSource );690 rdScale = dFactor * ( 1.0 / dMinDepthSource - 1.0 / dMaxDepthSource ) / (Double)( ( 1 << m_uiInputBitDepth ) - 1 );691 rdOffset = dFactor / dMaxDepthSource - dIntersectionTarget + dIntersectionSource;692 693 return ( bInterpolatedSource || bInterpolatedTarget );694 }695 696 697 Void698 TAppComCamPara::xGetShiftParameterCoded( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Bool bByIdx, Int& riScale, Int& riOffset )699 {700 if ( m_bSetupFromCoded )701 {702 if ( uiSourceView == uiTargetView )703 {704 riScale = 0;705 riOffset = 0;706 return;707 }708 Int iCamParsCodedPrecision;709 xGetCodedCameraData( uiSourceView, uiTargetView, bByIdx, uiFrame, riScale, riOffset, iCamParsCodedPrecision );710 711 if ( m_bCamParsCodedPrecSet )712 {713 AOT( m_uiCamParsCodedPrecision != (UInt) iCamParsCodedPrecision );714 }715 else716 {717 m_uiCamParsCodedPrecision = (UInt) iCamParsCodedPrecision;718 m_bCamParsCodedPrecSet = true;719 }720 }721 else722 {723 Double dScale, dOffset;724 Bool bInterpolated = xGetShiftParameterReal( uiSourceView, uiTargetView, uiFrame, false, bByIdx, dScale, dOffset );725 AOT( bInterpolated ); // must be base view726 727 Double dMultOffset = (Double)( 1 << ( m_uiCamParsCodedPrecision + 1 ) );728 Double dMultScale = (Double)( 1 << ( m_uiCamParsCodedPrecision + 1 + m_uiInputBitDepth ) );729 riOffset = (Int)floor( dMultOffset * dOffset + .5 );730 riScale = (Int)floor( dMultScale * dScale + .5 );731 }732 733 }734 735 736 Void737 TAppComCamPara::xGetShiftParameterInt( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Bool bExternal, Bool bByIdx, Int64& riScale, Int64& riOffset )738 {739 Int iTargetViewNum;740 Int iSourceViewNum;741 Int iPrevBaseViewNum;742 Int iNextBaseViewNum;743 Int iTargetViewRelNum;744 745 if( bByIdx )746 {747 748 iSourceViewNum = m_aiBaseViews[ uiSourceView ];749 750 if ( bExternal )751 {752 iTargetViewNum = m_aiSynthViews [ uiTargetView ];753 iTargetViewRelNum = m_aiRelSynthViewsNum[ uiTargetView ];754 }755 else756 {757 iTargetViewNum = m_aiBaseViews [ uiTargetView ];758 iTargetViewRelNum = m_aiBaseId2SortedId [ uiTargetView ] * ((Int) m_dViewNumPrec );759 }760 }761 else762 {763 iSourceViewNum = (Int) uiSourceView;764 iTargetViewNum = (Int) uiTargetView;765 766 if ( bExternal )767 {768 iTargetViewRelNum = m_aiRelSynthViewsNum[ xGetViewId( m_aiSynthViews, (Int) uiTargetView )];769 }770 else771 {772 iTargetViewRelNum = m_aiBaseId2SortedId[ xGetBaseViewId( uiTargetView) ] * ((Int) m_dViewNumPrec );773 }774 }775 xGetPrevAndNextBaseView( iSourceViewNum, iTargetViewNum, iPrevBaseViewNum, iNextBaseViewNum );776 AOT( iPrevBaseViewNum == -1 ); // should not happen777 AOT( iNextBaseViewNum == -1 ); // should not happen778 779 Int iSrcId = xGetBaseViewId( iSourceViewNum );780 Int iPrevId = xGetBaseViewId( iPrevBaseViewNum );781 Int iNextId = xGetBaseViewId( iNextBaseViewNum );782 AOF( m_aaiScaleAndOffsetSet[ iSrcId ][ iPrevId ] ); // coded scale and offset must be set783 AOF( m_aaiScaleAndOffsetSet[ iSrcId ][ iNextId ] ); // coded scale and offset must be set784 785 Int iNextBaseViewRelNum = m_aiBaseId2SortedId[ iNextId ] * ((Int) m_dViewNumPrec );786 Int iPrevBaseViewRelNum = m_aiBaseId2SortedId[ iPrevId ] * ((Int) m_dViewNumPrec );787 788 Int64 iPrevScale = (Int64)m_aaiCodedScale [ iSrcId ][ iPrevId ];789 Int64 iNextScale = (Int64)m_aaiCodedScale [ iSrcId ][ iNextId ];790 Int64 iPrevOffset = (Int64)m_aaiCodedOffset[ iSrcId ][ iPrevId ] << m_uiBitDepthForLUT;791 Int64 iNextOffset = (Int64)m_aaiCodedOffset[ iSrcId ][ iNextId ] << m_uiBitDepthForLUT;792 793 if( iPrevBaseViewNum == iNextBaseViewNum )794 {795 riScale = iNextScale;796 riOffset = iNextOffset;797 }798 else799 {800 riScale = Int64( iTargetViewRelNum - iPrevBaseViewRelNum ) * iNextScale;801 riScale += Int64( iNextBaseViewRelNum - iTargetViewRelNum ) * iPrevScale;802 riOffset = Int64( iTargetViewRelNum - iPrevBaseViewRelNum ) * iNextOffset;803 riOffset += Int64( iNextBaseViewRelNum - iTargetViewRelNum ) * iPrevOffset;804 Int64 iD = Int64( iNextBaseViewRelNum - iPrevBaseViewRelNum );805 Int64 iSA = ( riScale > 0 ? iD / 2 : -iD / 2 );806 Int64 iOA = ( riOffset > 0 ? iD / 2 : -iD / 2 );807 riScale = ( riScale + iSA ) / iD;808 riOffset = ( riOffset + iOA ) / iD;809 }810 }811 812 813 Void814 TAppComCamPara::xSetCodedScaleOffset( UInt uiFrame )815 {816 for( UInt uiSourceId = 0; uiSourceId < m_iNumberOfBaseViews; uiSourceId++ )817 {818 for( UInt uiTargetId = 0; uiTargetId < m_iNumberOfBaseViews; uiTargetId++ )819 {820 Int iScale, iOffset;821 xGetShiftParameterCoded( uiSourceId, uiTargetId, uiFrame, true, iScale, iOffset );822 m_aaiCodedScale [ uiSourceId ][ uiTargetId ] = iScale;823 m_aaiCodedOffset [ uiSourceId ][ uiTargetId ] = iOffset;824 m_aaiScaleAndOffsetSet [ uiSourceId ][ uiTargetId ] = 1;825 }826 }827 }828 829 830 Void831 TAppComCamPara::xSetShiftParametersAndLUT( UInt uiNumberSourceViews, UInt uiNumberTargetViews, UInt uiFrame, Bool bExternalReference , Double****& radLUT, Int****& raiLUT, Double***& radShiftParams, Int64***& raiShiftParams )832 {833 if( uiNumberSourceViews <= 1 || uiNumberTargetViews == 0 )834 {835 return;836 }837 AOF( radShiftParams != NULL && raiShiftParams != NULL && radLUT != NULL && raiLUT != NULL );838 AOF( m_uiBitDepthForLUT == 8 );839 840 Int iLog2DivLuma = m_uiBitDepthForLUT + m_uiCamParsCodedPrecision + 1 - m_iLog2Precision; AOF( iLog2DivLuma > 0 );841 Int iLog2DivChroma = iLog2DivLuma + 1;842 843 Double dMaxDispDev = 0.0;844 Double dMaxRndDispDvL = 0.0;845 Double dMaxRndDispDvC = 0.0;846 847 for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ )848 {849 for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ )850 {851 852 // integer-valued scale and offset853 Int64 iScale, iOffset;854 xGetShiftParameterInt ( uiSourceView, uiTargetView, uiFrame, bExternalReference, true, iScale, iOffset );855 raiShiftParams[ uiSourceView][ uiTargetView ][ 0 ] = iScale;856 raiShiftParams[ uiSourceView][ uiTargetView ][ 1 ] = iOffset;857 858 // offsets including rounding offsets859 Int64 iOffsetLuma = iOffset + ( ( 1 << iLog2DivLuma ) >> 1 );860 Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 );861 862 // real-valued scale and offset863 Double dScale, dOffset;864 865 if ( m_bSetupFromCoded )866 {867 dScale = (Double) iScale / (( Double ) ( 1 << iLog2DivLuma ));868 dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma ));869 }870 else871 {872 xGetShiftParameterReal( uiSourceView, uiTargetView, uiFrame, bExternalReference, true, dScale, dOffset );873 }874 875 radShiftParams[ uiSourceView][ uiTargetView ][ 0 ] = dScale;876 radShiftParams[ uiSourceView][ uiTargetView ][ 1 ] = dOffset;877 878 for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )879 {880 // real-valued look-up tables881 Double dShiftLuma = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );882 Double dShiftChroma = dShiftLuma / 2;883 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma;884 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma;885 886 // integer-valued look-up tables887 Int64 iTempScale = (Int64)uiDepthValue * iScale;888 Int64 iTestScale = ( iTempScale + iOffset ); // for checking accuracy of camera parameters889 Int64 iShiftLuma = ( iTempScale + iOffsetLuma ) >> iLog2DivLuma;890 Int64 iShiftChroma = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma;891 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma;892 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma;893 894 // maximum deviation895 #if H_3D_REN_MAX_DEV_OUT896 m_dMaxShiftDeviation = std::max( m_dMaxShiftDeviation, fabs( Double( (Int) iShiftLuma ) - dShiftLuma ) / Double( 1 << m_iLog2Precision ) );897 #endif898 dMaxDispDev = std::max( dMaxDispDev, fabs( Double( (Int) iTestScale ) - dShiftLuma * Double( 1 << iLog2DivLuma ) ) / Double( 1 << iLog2DivLuma ) );899 dMaxRndDispDvL = std::max( dMaxRndDispDvL, fabs( Double( (Int) iShiftLuma ) - dShiftLuma ) );900 dMaxRndDispDvC = std::max( dMaxRndDispDvC, fabs( Double( (Int) iShiftChroma ) - dShiftChroma ) );901 }902 903 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];904 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];905 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];906 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];907 }908 }909 910 // check maximum deviation911 Double dMaxAllowedDispDev = Double( 1 << m_iLog2Precision ) / Double( 1 << m_uiCamParsCodedPrecision ); // counting only the impact of camera parameter rounding912 Double dMaxAllowedRndDispDvL = 0.5 + Double( 1 << m_iLog2Precision ) / Double( 1 << m_uiCamParsCodedPrecision ); // final rounding and impact of camera parameter rounding913 Double dMaxAllowedRndDispDvC = 0.5 + Double( 1 << m_iLog2Precision ) / Double( 1 << m_uiCamParsCodedPrecision ) / 2.0; // final rounding and impact of camera parameter rounding914 915 if( ( dMaxDispDev >= dMaxAllowedDispDev || dMaxRndDispDvL >= dMaxAllowedRndDispDvL || dMaxRndDispDvC >= dMaxAllowedRndDispDvC ) && !m_bSetupFromCoded )916 {917 std::cout << "Warning: Something wrong with the accuracy of coded camera parameters:" << std::endl;918 if( dMaxDispDev >= dMaxAllowedDispDev )919 {920 std::cout << " max disparity difference is " << dMaxDispDev << " (allowed: " << dMaxAllowedDispDev << ")" << std::endl;921 }922 if( dMaxRndDispDvL >= dMaxAllowedRndDispDvL )923 {924 std::cout << " max rnd luma disp diff is " << dMaxRndDispDvL << " (allowed: " << dMaxAllowedRndDispDvL << ")" << std::endl;925 }926 if( dMaxRndDispDvC >= dMaxAllowedRndDispDvC )927 {928 std::cout << " max rnd chroma disp diff is " << dMaxRndDispDvC << " (allowed: " << dMaxAllowedRndDispDvC << ")" << std::endl;929 }930 }931 }932 933 Void934 TAppComCamPara::xSetShiftParametersAndLUT( UInt uiFrame )935 {936 xInit2dArray ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiScaleAndOffsetSet, 0 );937 xSetCodedScaleOffset ( uiFrame );938 xSetShiftParametersAndLUT( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, uiFrame, false, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT, m_adBaseViewShiftParameter, m_aiBaseViewShiftParameter );939 xSetShiftParametersAndLUT( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfSynthViews, uiFrame, true, m_adSynthViewShiftLUT, m_aiSynthViewShiftLUT, m_adSynthViewShiftParameter, m_aiSynthViewShiftParameter );940 };941 942 943 Void944 TAppComCamPara::xGetCameraShifts( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Double& rdCamPosShift, Double& rdPicPosShift )945 {946 Double dDummy, dCamPosSource, dCamPosTarget, dPicPosSource, dPicPosTarget;947 Bool bInterpolatedSource, bInterpolatedTarget;948 Int iTargetViewNum = m_aiBaseViews[ uiTargetView ];949 Int iSourceViewNum = m_aiBaseViews[ uiSourceView ];950 951 xGetGeometryData( iSourceViewNum, uiFrame, dDummy, dCamPosSource, dPicPosSource, bInterpolatedSource );952 xGetGeometryData( iTargetViewNum, uiFrame, dDummy, dCamPosTarget, dPicPosTarget, bInterpolatedTarget );953 AOT( bInterpolatedSource || bInterpolatedTarget );954 955 rdCamPosShift = ( dCamPosTarget - dCamPosSource );956 rdPicPosShift = -( dPicPosTarget - dPicPosSource ); // to be consistent957 }958 959 960 Void961 TAppComCamPara::xSetPdmConversionParams()962 {963 AOF( m_aiViewOrderIndex[ 0 ] == 0 );964 if ( m_bSetupFromCoded || m_iNumberOfBaseViews < 2 )965 {966 return;967 }968 969 //--- determine (virtual) camera parameter shift between view order index 1 and base view (view order index 0) ---970 Double dCamPosShift, dPicPosShift;971 Int iMinAbsVOI = (1<<30);972 Int iMinAbsVOIId = 0;973 for( Int iBaseId = 1; iBaseId < m_iNumberOfBaseViews; iBaseId++ )974 {975 Int iAbsVOI = ( m_aiViewOrderIndex[ iBaseId ] < 0 ? -m_aiViewOrderIndex[ iBaseId ] : m_aiViewOrderIndex[ iBaseId ] );976 if( iAbsVOI < iMinAbsVOI )977 {978 iMinAbsVOI = iAbsVOI;979 iMinAbsVOIId = iBaseId;980 }981 }982 AOF( iMinAbsVOIId != 0 && iMinAbsVOI != 0 );983 xGetCameraShifts( 0, iMinAbsVOIId, m_uiFirstFrameId, dCamPosShift, dPicPosShift );984 985 //--- determine maximum absolute camera position shift, precision, and base scale ---986 Double dMaxAbsCamPosShift = 0.0;987 for( Int iTargetId = 1; iTargetId < m_iNumberOfBaseViews; iTargetId++ )988 {989 for( Int iBaseId = 0; iBaseId < iTargetId; iBaseId++ )990 {991 xGetCameraShifts( (UInt)iBaseId, (UInt)iTargetId, m_uiFirstFrameId, dCamPosShift, dPicPosShift );992 dCamPosShift = ( dCamPosShift < 0.0 ? -dCamPosShift : dCamPosShift );993 dMaxAbsCamPosShift = ( dCamPosShift > dMaxAbsCamPosShift ? dCamPosShift : dMaxAbsCamPosShift );994 }995 }996 }997 998 999 1000 TAppComCamPara::TAppComCamPara()1001 {1002 m_dViewNumPrec = VIEW_NUM_PREC; // fixed1003 m_iLog2Precision = -1;1004 m_uiInputBitDepth = 0;1005 m_uiBitDepthForLUT = 8; // fixed1006 m_uiFirstFrameId = 0;1007 m_uiLastFrameId = 0;1008 1009 m_iNumberOfBaseViews = -1;1010 m_iNumberOfSynthViews = -1;1011 1012 m_uiCamParsCodedPrecision = 0;1013 m_bCamParsVaryOverTime = true;1014 1015 m_aaiCodedScale = 0;1016 m_aaiCodedOffset = 0;1017 m_aaiScaleAndOffsetSet = 0;1018 1019 m_adBaseViewShiftParameter = 0;1020 m_aiBaseViewShiftParameter = 0;1021 m_adSynthViewShiftParameter = 0;1022 m_aiSynthViewShiftParameter = 0;1023 1024 m_adBaseViewShiftLUT = 0;1025 m_aiBaseViewShiftLUT = 0;1026 m_adSynthViewShiftLUT = 0;1027 m_aiSynthViewShiftLUT = 0;1028 1029 m_bSetupFromCoded = false;1030 m_bCamParsCodedPrecSet = false;1031 1032 #if H_3D_REN_MAX_DEV_OUT1033 m_dMaxShiftDeviation = -1;1034 #endif1035 1036 }1037 1038 1039 TAppComCamPara::~TAppComCamPara()1040 {1041 xDeleteArray( m_adBaseViewShiftParameter, m_iNumberOfBaseViews, m_iNumberOfBaseViews );1042 xDeleteArray( m_aiBaseViewShiftParameter, m_iNumberOfBaseViews, m_iNumberOfBaseViews );1043 xDeleteArray( m_adBaseViewShiftLUT, m_iNumberOfBaseViews, m_iNumberOfBaseViews, 2 );1044 xDeleteArray( m_aiBaseViewShiftLUT, m_iNumberOfBaseViews, m_iNumberOfBaseViews, 2 );1045 1046 xDeleteArray( m_adSynthViewShiftParameter, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews));1047 xDeleteArray( m_aiSynthViewShiftParameter, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews));1048 xDeleteArray( m_adSynthViewShiftLUT, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews), 2 );1049 xDeleteArray( m_aiSynthViewShiftLUT, m_iNumberOfBaseViews, std::max( (Int)1 ,m_iNumberOfSynthViews), 2 );1050 1051 xDeleteArray( m_aaiCodedScale, m_iNumberOfBaseViews );1052 xDeleteArray( m_aaiCodedOffset, m_iNumberOfBaseViews );1053 xDeleteArray( m_aaiScaleAndOffsetSet, m_iNumberOfBaseViews );1054 1055 }1056 1057 Void1058 TAppComCamPara::xSetupBaseViewsFromCoded()1059 {1060 //===== get and sort views given in camera parameter file and set list of base views and related arrays =====1061 // get left-right order and coding order from cfg-file1062 std::vector<Int> aiViewOrderIdx; // Left Right Order1063 std::vector<Int> aiViewId ; // Coding Order1064 1065 Int iMinViewOrderIdx = MAX_INT;1066 for( UInt uiRow = 0; uiRow < m_aadCameraParameters.size(); uiRow++ )1067 {1068 if (m_aadCameraParameters[uiRow].size() != 2 )1069 break;1070 1071 Int iViewOrderIdx = (Int)( m_aadCameraParameters[ uiRow ][ 1 ] );1072 iMinViewOrderIdx = std::min( iViewOrderIdx, iMinViewOrderIdx );1073 1074 aiViewOrderIdx .push_back( iViewOrderIdx );1075 aiViewId .push_back( (Int) m_aadCameraParameters[ uiRow ][ 0 ] );1076 }1077 1078 // create base view numbers1079 AOT( aiViewId.size() != aiViewOrderIdx.size() );1080 m_iNumberOfBaseViews = (Int) aiViewId.size();1081 for (Int iCurBaseView = 0; iCurBaseView < m_iNumberOfBaseViews; iCurBaseView++ )1082 {1083 aiViewOrderIdx[iCurBaseView] = ( aiViewOrderIdx[iCurBaseView] - iMinViewOrderIdx);1084 m_aiBaseViews .push_back( aiViewOrderIdx[iCurBaseView] * ( (Int) m_dViewNumPrec) );1085 m_aiBaseId2SortedId.push_back( iCurBaseView );1086 m_aiBaseSortedId2Id.push_back( iCurBaseView );1087 }1088 1089 m_iNumberOfBaseViews = (Int) m_aiBaseViews.size();1090 1091 std::vector<Int> aiSortedViewOrderIdx = aiViewOrderIdx;1092 1093 // sort base views according to View Order Idx1094 m_aiSortedBaseViews = m_aiBaseViews;1095 for (Int iCurBaseView = 1; iCurBaseView < m_iNumberOfBaseViews; iCurBaseView++ )1096 {1097 Int iCurViewOrder = aiSortedViewOrderIdx[iCurBaseView];1098 for (Int iCurSearchPos = iCurBaseView; iCurSearchPos >= 0; iCurSearchPos-- )1099 {1100 if ( iCurViewOrder < aiSortedViewOrderIdx[iCurSearchPos] )1101 {1102 Int iTempViewId = m_aiSortedBaseViews[iCurSearchPos];1103 m_aiSortedBaseViews[iCurSearchPos] = m_aiSortedBaseViews[iCurBaseView];1104 m_aiSortedBaseViews[iCurBaseView ] = iTempViewId;1105 1106 Int iTempViewOrderIdx = aiSortedViewOrderIdx[iCurSearchPos];1107 aiSortedViewOrderIdx[iCurSearchPos] = aiSortedViewOrderIdx[iCurBaseView];1108 aiSortedViewOrderIdx[iCurBaseView ] = iTempViewOrderIdx;1109 1110 Int iTempPos = m_aiBaseSortedId2Id[iCurSearchPos];1111 m_aiBaseSortedId2Id[iCurSearchPos] = m_aiBaseSortedId2Id[iCurBaseView];1112 m_aiBaseSortedId2Id[iCurBaseView] = iTempPos;1113 iCurBaseView--;1114 }1115 }1116 }1117 1118 for (Int iCurBaseView = 0; iCurBaseView < m_iNumberOfBaseViews; iCurBaseView++ )1119 {1120 m_aiBaseId2SortedId[m_aiBaseSortedId2Id[iCurBaseView]] = iCurBaseView;1121 }1122 1123 m_aiViewsInCfgFile = m_aiSortedBaseViews;1124 1125 // check1126 if( m_aiViewsInCfgFile.size() < 2 )1127 {1128 std::cerr << "Failed reading camera parameter file" << std::endl;1129 std::cerr << "At least two views must be given" << std::endl;1130 AOT(true);1131 exit( EXIT_FAILURE );1132 }1133 1134 // translate coding order to view order1135 for( UInt uiRow = 0; uiRow < m_aadCameraParameters.size(); uiRow++ )1136 {1137 if (m_aadCameraParameters[uiRow].size() == 2 )1138 continue;1139 1140 m_aadCameraParameters[ uiRow ][ 2 ] = (Double) aiViewOrderIdx[ xGetViewId( aiViewId, (Int) m_aadCameraParameters[ uiRow ][ 2 ] ) ];1141 m_aadCameraParameters[ uiRow ][ 3 ] = (Double) aiViewOrderIdx[ xGetViewId( aiViewId, (Int) m_aadCameraParameters[ uiRow ][ 3 ] ) ];1142 }1143 }1144 1145 Void TAppComCamPara::xSetupBaseViews( Char* pchBaseViewNumbers, UInt uiNumBaseViews )1146 {1147 // init list1148 std::vector<Int> aiViewsInCfg;1149 for( UInt uiRow = 0; uiRow < m_aadCameraParameters.size(); uiRow++ )1150 {1151 aiViewsInCfg.push_back( (Int)( m_aadCameraParameters[ uiRow ][ 0 ] * m_dViewNumPrec ) );1152 }1153 // remove duplicated items1154 std::sort( aiViewsInCfg.begin(), aiViewsInCfg.end() );1155 std::vector<Int>::iterator cIterNewEnd = std::unique( aiViewsInCfg.begin(), aiViewsInCfg.end() );1156 aiViewsInCfg.erase( cIterNewEnd, aiViewsInCfg.end() );1157 // sort (from left to right)1158 std::vector<Int> aiDummyI2SI, aiDummySI2I;1159 xGetSortedViewList( aiViewsInCfg, m_aiViewsInCfgFile, aiDummyI2SI, aiDummySI2I );1160 // check1161 if( m_aiViewsInCfgFile.size() < 2 )1162 {1163 std::cerr << "Failed reading config file" << std::endl;1164 std::cerr << "At least two views must be given" << std::endl;1165 exit( EXIT_FAILURE );1166 }1167 1168 1169 1170 //===== set list of base views and related arrays =====1171 if( pchBaseViewNumbers == 0 )1172 {1173 std::cerr << "BaseViewCameraNumbers must be given" << std::endl;1174 exit( EXIT_FAILURE );1175 };1176 1177 convertNumberString( pchBaseViewNumbers, m_aiBaseViews, m_dViewNumPrec );1178 while( (UInt)m_aiBaseViews.size() > uiNumBaseViews )1179 {1180 m_aiBaseViews.pop_back();1181 }1182 xGetSortedViewList( m_aiBaseViews, m_aiSortedBaseViews, m_aiBaseId2SortedId, m_aiBaseSortedId2Id );1183 m_iNumberOfBaseViews = (Int)m_aiBaseViews.size();1184 }1185 1186 1187 Void1188 TAppComCamPara::init( UInt uiNumBaseViews,1189 UInt uiInputBitDepth,1190 UInt uiCodedCamParsPrecision,1191 UInt uiStartFrameId,1192 UInt uiNumFrames,1193 Char* pchCfgFileName,1194 Char* pchBaseViewNumbers,1195 Char* pchSynthViewNumbers,1196 std::vector<Int>* paiSynthViewNumbers,1197 Int iLog2Precision )1198 {1199 //===== set miscellaneous variables =====1200 m_uiInputBitDepth = uiInputBitDepth;1201 m_uiFirstFrameId = uiStartFrameId;1202 m_uiLastFrameId = uiStartFrameId + uiNumFrames - 1;1203 m_uiCamParsCodedPrecision = uiCodedCamParsPrecision;1204 m_iLog2Precision = iLog2Precision;1205 #if HHI_INTERVIEW_SKIP1206 m_iCurrentFrameId = 0 ;1207 #endif1208 1209 xReadCameraParameterFile( pchCfgFileName );1210 1211 m_bSetupFromCoded = ( m_aadCameraParameters[ 0 ].size() == 2 );1212 1213 if ( m_bSetupFromCoded )1214 {1215 std::cout << "Detected decoded camera parameter file. Overwriting base view settings from cfg file. " << std::endl;1216 xSetupBaseViewsFromCoded();1217 }1218 else1219 {1220 xSetupBaseViews( pchBaseViewNumbers, uiNumBaseViews );1221 }1222 1223 //===== set list of external (virtual) views =====1224 m_aiSynthViews.clear();1225 1226 if( pchSynthViewNumbers != 0 || paiSynthViewNumbers != 0)1227 {1228 std::vector<Int> aiTmpSynthViews;1229 1230 AOT( ( pchSynthViewNumbers != NULL ) && ( paiSynthViewNumbers != NULL ) );1231 1232 if ( pchSynthViewNumbers != NULL )1233 {1234 convertNumberString( pchSynthViewNumbers, aiTmpSynthViews, m_dViewNumPrec );1235 }1236 else1237 {1238 aiTmpSynthViews = (*paiSynthViewNumbers);1239 }1240 1241 for( UInt uiSId = 0; uiSId < (UInt)aiTmpSynthViews.size(); uiSId++ )1242 {1243 1244 Int iViewNumPrec = (Int) m_dViewNumPrec;1245 Int iLeftBaseViewIdx = aiTmpSynthViews[ uiSId ] / iViewNumPrec;1246 Int iRightBaseViewIdx = ( aiTmpSynthViews[ uiSId ] + (iViewNumPrec - 1) ) / iViewNumPrec;1247 1248 if ( iLeftBaseViewIdx < 0 || iRightBaseViewIdx >= m_iNumberOfBaseViews )1249 {1250 std::cerr << "SynthViewCameraNumbers must be greater and equal to 0 and smaller than number of base views" << std::endl;1251 AOT(true);1252 exit( EXIT_FAILURE );1253 }1254 1255 Int64 iLeftBaseViewRelNum = iLeftBaseViewIdx * iViewNumPrec;1256 Int64 iRightBaseViewRelNum = iRightBaseViewIdx * iViewNumPrec;1257 1258 Int64 iDiffBaseViewRelNum = iRightBaseViewRelNum - iLeftBaseViewRelNum;1259 1260 Int64 iSynthViewRelNum = aiTmpSynthViews[ uiSId ];1261 Int64 iLeftBaseNum = m_aiSortedBaseViews[ iLeftBaseViewIdx ];1262 Int64 iRightBaseNum = m_aiSortedBaseViews[ iRightBaseViewIdx ];1263 Int64 iDiffBaseNum = iRightBaseNum - iLeftBaseNum;1264 Int64 iSynthViewNum;1265 1266 if ( iDiffBaseViewRelNum != 0)1267 {1268 AOT( (Int) iDiffBaseViewRelNum != iViewNumPrec );1269 Int iFact = iDiffBaseNum > 0 ? 1 : -1;1270 iSynthViewNum = iLeftBaseNum + ( iDiffBaseNum * ( iSynthViewRelNum - iLeftBaseViewRelNum ) + (iViewNumPrec >> 1) * iFact ) / ( iViewNumPrec );1271 }1272 else1273 {1274 iSynthViewNum = iLeftBaseNum;1275 }1276 1277 m_aiRelSynthViewsNum.push_back( aiTmpSynthViews[ uiSId ] );1278 m_aiSynthViews .push_back( (Int) iSynthViewNum );1279 }1280 }1281 m_iNumberOfSynthViews = (Int)m_aiSynthViews.size();1282 1283 1284 //===== set derived parameters =====1285 xGetViewOrderIndices( m_aiBaseId2SortedId, m_aiViewOrderIndex );1286 m_bCamParsVaryOverTime = xGetCamParsChangeFlag();1287 1288 1289 //===== create arrays =====1290 xCreateLUTs ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT, m_adBaseViewShiftParameter, m_aiBaseViewShiftParameter );1291 xCreateLUTs ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfSynthViews, m_adSynthViewShiftLUT, m_aiSynthViewShiftLUT, m_adSynthViewShiftParameter, m_aiSynthViewShiftParameter );1292 xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiCodedScale );1293 xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiCodedOffset );1294 xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiScaleAndOffsetSet );1295 xInit2dArray ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiScaleAndOffsetSet, 0 );1296 1297 //===== init arrays for first frame =====1298 xSetShiftParametersAndLUT( m_uiFirstFrameId );1299 }1300 1301 1302 Void1303 TAppComCamPara::check( Bool bCheckViewRange, Bool bCheckFrameRange )1304 {1305 if( bCheckFrameRange )1306 {1307 Double dDummy;1308 1309 for( UInt uiBaseView = 0; uiBaseView < m_aiBaseViews.size(); uiBaseView++ )1310 {1311 if ( m_bSetupFromCoded )1312 {1313 for( UInt uiTargetView = 0; uiTargetView < m_aiBaseViews.size(); uiTargetView++ )1314 {1315 if ( uiTargetView == uiBaseView )1316 continue;1317 1318 for( UInt uiFrame = m_uiFirstFrameId; uiFrame <= m_uiLastFrameId; uiFrame++ )1319 {1320 Int iDummy;1321 1322 xGetCodedCameraData( uiBaseView, uiTargetView, true , uiFrame, iDummy, iDummy, iDummy );1323 }1324 }1325 }1326 else1327 {1328 for( UInt uiFrame = m_uiFirstFrameId; uiFrame <= m_uiLastFrameId; uiFrame++ )1329 {1330 Bool bInterpolatedCur;1331 xGetGeometryData( m_aiBaseViews[ uiBaseView ], uiFrame, dDummy, dDummy, dDummy, bInterpolatedCur );1332 xGetZNearZFar ( m_aiBaseViews[ uiBaseView ], uiFrame, dDummy, dDummy );1333 1334 if( bInterpolatedCur )1335 {1336 std::cerr << "Error: CameraParameters for BaseView " << (Double)m_aiBaseViews[ uiBaseView ] / m_dViewNumPrec << " and Frame " << uiFrame << " not defined. " << std::endl;1337 exit( EXIT_FAILURE );1338 }1339 }1340 }1341 }1342 1343 Bool bIgnoreFirst = true;1344 for( UInt uiERView = 0; uiERView < m_aiSynthViews.size() && !m_bSetupFromCoded; uiERView++ )1345 {1346 if ( xIsIn(m_aiViewsInCfgFile, m_aiSynthViews[ uiERView ] ) )1347 {1348 if ( bIgnoreFirst )1349 {1350 std::cout << "Ignoring CameraParameterFile entries for virtual view(s): " ;1351 //GT: Integer precision virtual view camera parameters are always interpolated from coded views camera parameters.1352 bIgnoreFirst = false;1353 }1354 std::cout << (Double)m_aiSynthViews[ uiERView ] / m_dViewNumPrec << " " ;1355 }1356 }1357 if ( !bIgnoreFirst )1358 {1359 std::cout << std::endl;1360 }1361 1362 Bool bInterpolateFirst = true;1363 Bool bAnyInterpolated = false;1364 for( UInt uiERView = 0; uiERView < m_aiSynthViews.size() && !m_bSetupFromCoded; uiERView++ )1365 {1366 Bool bInterpolated = false;1367 for( UInt uiFrame = m_uiFirstFrameId; uiFrame <= m_uiLastFrameId; uiFrame++ )1368 {1369 Bool bInterpolatedCur;1370 xGetGeometryData( m_aiSynthViews[ uiERView ], uiFrame, dDummy, dDummy, dDummy, bInterpolatedCur );1371 bInterpolated |= bInterpolatedCur;1372 }1373 1374 if( bInterpolated )1375 {1376 bAnyInterpolated = true;1377 if ( bInterpolateFirst )1378 {1379 std::cout << "Interpolating camera parameters for virtual view(s): " ;1380 bInterpolateFirst = false;1381 }1382 std::cout << (Double)m_aiSynthViews[ uiERView ] / m_dViewNumPrec << " " ;1383 }1384 }1385 if ( bAnyInterpolated )1386 std::cout << std::endl;1387 }1388 1389 if( bCheckViewRange )1390 {1391 Bool bAllExist = true;1392 for( Int iSynthViewIdx = 0; iSynthViewIdx < m_iNumberOfSynthViews; iSynthViewIdx++ )1393 {1394 Bool bIsBaseView;1395 Int iDummy;1396 Bool bExist = getLeftRightBaseView( iSynthViewIdx, iDummy, iDummy, iDummy, bIsBaseView );1397 bAllExist &= ( bExist || bIsBaseView );1398 }1399 if( !bAllExist )1400 {1401 std::cerr << "SynthViewNumbers must be within the range of BaseViewNumbers" << std::endl;1402 exit( EXIT_FAILURE );1403 }1404 }1405 }1406 1407 1408 Void1409 TAppComCamPara::update( UInt uiFrameId )1410 {1411 1412 m_iCurrentFrameId = uiFrameId;1413 m_bCamParsCodedPrecSet = false;1414 1415 if ( m_bCamParsVaryOverTime )1416 {1417 xSetShiftParametersAndLUT( m_uiFirstFrameId + uiFrameId );1418 }1419 }1420 1421 #if H_3D_VSO1422 Void1423 TAppComCamPara::setDispCoeff( UInt uiFrameId, Int iViewIdx )1424 {1425 UInt uiFrame = m_uiFirstFrameId + uiFrameId;1426 Int iSourceViewNum = m_aiBaseViews[ iViewIdx ];1427 Double dBaseLine = 0.0;1428 Double dFL1, dCS1, dCP1, dZN1, dZF1;1429 Bool bInterpolated;1430 double dPos[3];1431 1432 if( m_iNumberOfBaseViews == 3 )1433 {1434 xGetGeometryData( m_aiBaseViews[0], uiFrame, dFL1, dPos[0], dCS1, bInterpolated );1435 xGetGeometryData( m_aiBaseViews[1], uiFrame, dFL1, dPos[1], dCS1, bInterpolated );1436 xGetGeometryData( m_aiBaseViews[2], uiFrame, dFL1, dPos[2], dCS1, bInterpolated );1437 1438 xGetGeometryData( iSourceViewNum, uiFrame, dFL1, dCP1, dCS1, bInterpolated );1439 xGetZNearZFar ( iSourceViewNum, uiFrame, dZN1, dZF1 );1440 1441 dBaseLine = ( std::max( dPos[0], std::max( dPos[1], dPos[2] ) ) - std::min( dPos[0], std::min( dPos[1], dPos[2] ) ) ) / 2.0;1442 }1443 else if( m_iNumberOfBaseViews == 2 )1444 {1445 xGetGeometryData( m_aiBaseViews[0], uiFrame, dFL1, dPos[0], dCS1, bInterpolated );1446 xGetGeometryData( m_aiBaseViews[1], uiFrame, dFL1, dPos[1], dCS1, bInterpolated );1447 1448 xGetGeometryData( iSourceViewNum, uiFrame, dFL1, dCP1, dCS1, bInterpolated );1449 xGetZNearZFar ( iSourceViewNum, uiFrame, dZN1, dZF1 );1450 1451 dBaseLine = dPos[0] - dPos[1];1452 }1453 1454 m_dDispCoeff = fabs( dFL1 * ( dBaseLine / 2.0 ) / 255.0 * ( 1.0/dZN1 - 1.0/dZF1 ) );1455 }1456 #endif1457 1458 Bool1459 TAppComCamPara::getLeftRightBaseView( Int iSynthViewIdx, Int &riLeftViewIdx, Int &riRightViewIdx, Int &riRelDistToLeft, Bool& rbIsBaseView )1460 {1461 Int iLeftSortedViewIdx, iRightSortedViewIdx, iDummy;1462 Bool bExist = xGetLeftRightView( m_aiSynthViews[ iSynthViewIdx ], m_aiSortedBaseViews, iDummy, iDummy, iLeftSortedViewIdx, iRightSortedViewIdx );1463 rbIsBaseView = ( iLeftSortedViewIdx == iRightSortedViewIdx && iLeftSortedViewIdx != -1 );1464 1465 Int iLeftViewIdx = ( iLeftSortedViewIdx != -1 ? m_aiBaseSortedId2Id[ iLeftSortedViewIdx ] : -1 );1466 Int iRightViewIdx = ( iRightSortedViewIdx != -1 ? m_aiBaseSortedId2Id[ iRightSortedViewIdx ] : -1 );1467 1468 if ( iLeftSortedViewIdx != -1 && iRightSortedViewIdx != -1 )1469 {1470 riRelDistToLeft = getRelDistLeft( iSynthViewIdx, iLeftViewIdx, iRightViewIdx);1471 }1472 else1473 {1474 riRelDistToLeft = -1;1475 }1476 1477 riLeftViewIdx = iLeftViewIdx;1478 riRightViewIdx = iRightViewIdx;1479 1480 return bExist;1481 }1482 1483 Bool1484 TAppComCamPara::xIsIn( std::vector<Int>& rVec, Int iElem)1485 {1486 Bool bFound = false;1487 for (Int idx = 0; idx < rVec.size() && !bFound; idx++)1488 {1489 bFound = bFound || rVec[idx] == iElem;1490 }1491 return bFound;1492 }1493 1494 Int TAppComCamPara::getRelDistLeft( Int iSynthViewIdx, Int iLeftViewIdx, Int iRightViewIdx )1495 {1496 //GT: Get normalized distance1497 Int iLeftViewDist = abs ( m_aiBaseId2SortedId[ iLeftViewIdx ] * ((Int) m_dViewNumPrec) - m_aiRelSynthViewsNum [ iSynthViewIdx ]);1498 Int iRightViewDist = abs ( m_aiBaseId2SortedId[ iRightViewIdx ] * ((Int) m_dViewNumPrec) - m_aiRelSynthViewsNum [ iSynthViewIdx ]);1499 Int64 iDistSum = iLeftViewDist + iRightViewDist;1500 return (iDistSum == 0) ? (1 << (REN_VDWEIGHT_PREC -1) ) : (Int) (( (((Int64) iLeftViewDist ) << REN_VDWEIGHT_PREC ) + (iDistSum >> 1) ) / iDistSum );1501 }1502 1503 Int1504 TAppComCamPara::synthRelNum2Idx( Int iRelNum )1505 {1506 return xGetViewId(m_aiRelSynthViewsNum, iRelNum );1507 }1508 #endif -
branches/HTM-12.1-MV-draft-1/source/Lib/TAppCommon/TAppComCamPara.h
r655 r1072 67 67 Bool m_bCamParsCodedPrecSet; ///< Coded Cam Para precision set for current frame; 68 68 69 #if H_3D_REN_MAX_DEV_OUT70 Double m_dMaxShiftDeviation; ///< Maximum deviation of shifts with integer precision compare to double precision71 #endif72 69 //SAIT_VSO_EST_A0033 73 70 Double m_dDispCoeff; … … 125 122 Bool xGetLeftRightView ( Int iView, std::vector<Int> aiSortedViews, Int& riLeftView, Int& riRightView, Int& riLeftSortedViewIdx, Int& riRightSortedViewIdx ); 126 123 Void xGetPrevAndNextBaseView ( Int iSourceViewNum, Int iTargetViewNum, Int& riPrevBaseViewNum, Int& riNextBaseViewNum ); 127 #if !KWU_RC_MADPRED_E0227128 124 Void xGetZNearZFar ( Int iView, UInt uiFrame, Double& rdZNear, Double& rdZFar ); 129 125 Void xGetGeometryData ( Int dView, UInt uiFrame, Double& rdFocalLength, Double& rdPosition, Double& rdCameraShift, Bool& rbInterpolated ); 130 #endif131 126 Void xSetupBaseViewsFromCoded (); 132 127 Void xSetupBaseViews ( Char* pchBaseViewNumbers, UInt uiNumBaseViews ); … … 186 181 UInt getCurFrameId () { return m_iCurrentFrameId; } 187 182 static Void convertNumberString ( Char* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec ); 188 #if H_3D_REN_MAX_DEV_OUT 189 Double getMaxShiftDeviation () { return m_dMaxShiftDeviation; }; 190 #endif 191 192 #if H_3D_VSO 193 // SAIT_VSO_EST_A033 194 Void setDispCoeff ( UInt uiStartFrameId, Int iViewIdx ); 195 Double getDispCoeff () { return m_dDispCoeff; } 196 #endif 183 197 184 198 185 // function for getting parameters and parameter arrays … … 220 207 Int** getCodedOffset () { return m_aaiCodedOffset; } 221 208 222 #if KWU_RC_MADPRED_E0227223 Void xGetZNearZFar ( Int iView, UInt uiFrame, Double& rdZNear, Double& rdZFar );224 Void xGetGeometryData ( Int dView, UInt uiFrame, Double& rdFocalLength, Double& rdPosition, Double& rdCameraShift, Bool& rbInterpolated );225 #endif226 209 }; 227 210 -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/CommonDef.h
r1067 r1072 60 60 61 61 #if H_MV 62 #define NV_VERSION "12. 1" ///< Current software version62 #define NV_VERSION "12.0" ///< Current software version 63 63 #define HM_VERSION "14.0" ///< 64 64 #else … … 208 208 // MERGE 209 209 #define MRG_MAX_NUM_CANDS 5 210 #if H_3D_IV_MERGE211 #define MRG_MAX_NUM_CANDS_MEM (MRG_MAX_NUM_CANDS+1) // one extra for inter-view motion prediction212 #endif213 210 // Reference memory management 214 211 #define DYN_REF_FREE 0 ///< dynamic free of reference memories … … 318 315 }; 319 316 320 #if H_3D321 //PICYUV322 #define PICYUV_PAD 16323 324 //RENDERER325 #define REN_LUMA_MARGIN ( g_uiMaxCUWidth + PICYUV_PAD )326 #define REN_VDWEIGHT_PREC 8327 #define REN_IS_FILLED ( 1 << REN_VDWEIGHT_PREC )328 #define REN_USED_PEL ( (1 << g_bitDepthY) - 1 )329 #define REN_UNUSED_PEL 0330 #define REN_IS_HOLE 0331 332 333 // CAMERA PARAMETERS334 #define LOG2_DISP_PREC_LUT 2 ///< log2 of disparity precision used in integer disparity LUTs335 #define STD_CAM_PARAMETERS_PRECISION 5 ///< quarter luma sample accuarcy for derived disparities (as default)336 337 #endif // end of H_3D338 317 //! \} 339 318 -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/ContextTables.h
r1039 r1072 51 51 #define NUM_SPLIT_FLAG_CTX 3 ///< number of context models for split flag 52 52 #define NUM_SKIP_FLAG_CTX 3 ///< number of context models for skip flag 53 #if MTK_SINGLE_DEPTH_MODE_I009554 #define NUM_SINGLEDEPTH_FLAG_CTX 155 #define NUM_SINGLE_DEPTH_VALUE_DATA_CTX 156 #endif57 53 #define NUM_MERGE_FLAG_EXT_CTX 1 ///< number of context models for merge flag of merge extended 58 54 #define NUM_MERGE_IDX_EXT_CTX 1 ///< number of context models for merge index of merge extended … … 96 92 #define NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX 1 97 93 98 #if H_3D_ARP 99 #define NUM_ARPW_CTX 3 ///< number of context models for weighting factor index used by advanced residual prediction 100 #endif 101 102 #if H_3D_IC 103 #define NUM_IC_FLAG_CTX 1 ///< number of context models for illumination compensation flag 104 #endif 94 105 95 106 96 #define CNU 154 ///< dummy initialization value for unused context models 'Context model Not Used' 107 97 108 #if H_3D_DIM 109 #define NUM_DEPTH_INTRA_MODE_CTX 1 ///< number of context models for depth intra modes 110 #define NUM_DDC_FLAG_CTX 2 ///< number of context models for deltaDC flag (DMM or RBC) 111 #define NUM_DDC_DATA_CTX 1 ///< number of context models for deltaDC data (DMM or RBC) 112 #if H_3D_DIM_DMM 113 #define NUM_DMM1_DATA_CTX 1 ///< number of context models for DMM1 data 114 #endif 115 #define NUM_ANGLE_FLAG_CTX 1 116 #endif 117 118 #if H_3D_DIM_SDC 119 #define SDC_NUM_RESIDUAL_FLAG_CTX 1 120 #define SDC_NUM_RESIDUAL_CTX 1 121 #define NUM_SDC_FLAG_CTX 1 ///< number of context 122 #endif 123 #if H_3D_DBBP 124 #define DBBP_NUM_FLAG_CTX 1 125 #endif 98 126 99 // ==================================================================================================================== 127 100 // Tables … … 153 126 { CNU, CNU, CNU, }, 154 127 }; 155 #if MTK_SINGLE_DEPTH_MODE_I0095156 static const UChar157 INIT_SINGLEDEPTH_FLAG[3][NUM_SINGLEDEPTH_FLAG_CTX] =158 {159 { 185 },160 { 185 },161 { 185 },162 };163 static const UChar164 INIT_SINGLE_DEPTH_VALUE_DATA[3][NUM_SINGLE_DEPTH_VALUE_DATA_CTX] =165 {166 { 137 },167 { 137 },168 { 137 },169 };170 #endif171 128 static const UChar 172 129 INIT_MERGE_FLAG_EXT[3][NUM_MERGE_FLAG_EXT_CTX] = … … 357 314 }; 358 315 359 #if H_3D_ARP 360 static const UChar 361 INIT_ARPW[3][NUM_ARPW_CTX] = 362 { 363 { 162, 153, 162 }, 364 { 162, 153, 162 }, 365 { 162, 153, 162 }, 366 }; 316 317 318 //! \} 319 367 320 368 321 #endif 369 #if H_3D_IC370 static const UChar371 INIT_IC_FLAG[3][NUM_IC_FLAG_CTX] =372 {373 { 154 },374 { 154 },375 { 154 },376 };377 378 #endif379 #if H_3D_DIM380 static const UChar381 INIT_DEPTH_INTRA_MODE[3][NUM_DEPTH_INTRA_MODE_CTX] =382 {383 { 154, },384 { 154, },385 { 154, }386 };387 388 static const UChar389 INIT_ANGLE_FLAG[3][NUM_ANGLE_FLAG_CTX] =390 {391 { 154 },392 { 141 },393 { 155 },394 };395 396 static const UChar397 INIT_DDC_FLAG[3][NUM_DDC_FLAG_CTX] =398 {399 {0 , CNU},400 {0 , CNU},401 {64, CNU}402 };403 static const UChar404 INIT_DDC_DATA[3][NUM_DDC_DATA_CTX] =405 {406 { 154 },407 { 154 },408 { 154 },409 };410 #if H_3D_DIM_DMM411 static const UChar412 INIT_DMM1_DATA[3][NUM_DMM1_DATA_CTX] =413 {414 { CNU },415 { CNU },416 { CNU },417 };418 #endif419 #if H_3D_DIM_SDC420 static const UChar421 INIT_SDC_RESIDUAL_FLAG[3][SDC_NUM_RESIDUAL_FLAG_CTX] =422 {423 { CNU },424 { CNU },425 { CNU },426 };427 static const UChar428 INIT_SDC_RESIDUAL[3][SDC_NUM_RESIDUAL_CTX] =429 {430 { 155 },431 { 155 },432 { 155 },433 };434 #endif435 #endif436 437 438 //! \}439 #if H_3D_DIM_SDC440 static const UChar441 INIT_SDC_FLAG[3][NUM_SDC_FLAG_CTX] =442 {443 { 154 },444 { 154 },445 { 154 },446 };447 #endif448 449 #if H_3D_DBBP450 static const UChar INIT_DBBP_FLAG[3][DBBP_NUM_FLAG_CTX] =451 {452 #if SEC_DBBP_EXPLICIT_SIG_I0077453 { CNU },454 { CNU },455 { CNU },456 #else457 { 161 },458 { 161 },459 { 161 },460 #endif461 };462 #endif463 464 #endif -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComDataCU.cpp
r1066 r1072 60 60 61 61 m_skipFlag = NULL; 62 #if MTK_SINGLE_DEPTH_MODE_I009563 m_singleDepthFlag = NULL;64 m_apSingleDepthValue = NULL;65 #endif66 62 m_pePartSize = NULL; 67 63 m_pePredMode = NULL; … … 112 108 m_apiMVPNum[1] = NULL; 113 109 114 #if H_3D_DIM115 for( Int i = 0; i < DIM_NUM_TYPE; i++ )116 {117 m_dimDeltaDC[i][0] = NULL;118 m_dimDeltaDC[i][1] = NULL;119 }120 #if H_3D_DIM_DMM121 for( Int i = 0; i < DMM_NUM_TYPE; i++ )122 {123 m_dmmWedgeTabIdx[i] = NULL;124 }125 #endif126 #if H_3D_DIM_SDC127 m_pbSDCFlag = NULL;128 m_apSegmentDCOffset[0] = NULL;129 m_apSegmentDCOffset[1] = NULL;130 #endif131 #endif132 110 m_bDecSubCu = false; 133 111 m_sliceStartCU = 0; 134 112 m_sliceSegmentStartCU = 0; 135 #if H_3D_NBDV 136 m_pDvInfo = NULL; 137 #endif 138 #if H_3D_VSP 139 m_piVSPFlag = NULL; 140 #endif 141 #if H_3D_SPIVMP 142 m_pbSPIVMPFlag = NULL; 143 #endif 144 #if H_3D_ARP 145 m_puhARPW = NULL; 146 #endif 147 #if H_3D_IC 148 m_pbICFlag = NULL; 149 #endif 150 #if H_3D_INTER_SDC 151 #endif 152 #if H_3D_DBBP 153 m_pbDBBPFlag = NULL; 154 #endif 155 156 #if H_3D_DDD 157 m_pucDisparityDerivedDepth = NULL; 158 m_pbUseDDD = NULL; 159 #endif 113 160 114 } 161 115 … … 185 139 186 140 m_skipFlag = new Bool[ uiNumPartition ]; 187 #if MTK_SINGLE_DEPTH_MODE_I0095188 m_singleDepthFlag = new Bool[ uiNumPartition ];189 m_apSingleDepthValue = (Pel*)xMalloc(Pel, uiNumPartition);190 #endif191 141 m_pePartSize = new Char[ uiNumPartition ]; 192 142 memset( m_pePartSize, SIZE_NONE,uiNumPartition * sizeof( *m_pePartSize ) ); … … 195 145 m_pbMergeFlag = (Bool* )xMalloc(Bool, uiNumPartition); 196 146 m_puhMergeIndex = (UChar* )xMalloc(UChar, uiNumPartition); 197 #if H_3D_VSP198 m_piVSPFlag = (Char* )xMalloc(Char, uiNumPartition);199 #endif200 #if H_3D_SPIVMP201 m_pbSPIVMPFlag = (Bool* )xMalloc(Bool, uiNumPartition);202 #endif203 147 m_puhLumaIntraDir = (UChar* )xMalloc(UChar, uiNumPartition); 204 148 m_puhChromaIntraDir = (UChar* )xMalloc(UChar, uiNumPartition); … … 224 168 m_pcTrCoeffCb = (TCoeff*)xMalloc(TCoeff, uiWidth*uiHeight/4); 225 169 m_pcTrCoeffCr = (TCoeff*)xMalloc(TCoeff, uiWidth*uiHeight/4); 226 #if H_3D_NBDV227 m_pDvInfo = (DisInfo* )xMalloc(DisInfo, uiNumPartition);228 #endif229 170 memset( m_pcTrCoeffY, 0,uiWidth*uiHeight * sizeof( TCoeff ) ); 230 171 memset( m_pcTrCoeffCb, 0,uiWidth*uiHeight/4 * sizeof( TCoeff ) ); … … 260 201 m_acCUMvField[1].create( uiNumPartition ); 261 202 262 #if H_3D_ARP263 m_puhARPW = new UChar[ uiNumPartition];264 #endif265 #if H_3D_IC266 m_pbICFlag = (Bool* )xMalloc(Bool, uiNumPartition);267 #endif268 #if H_3D_DIM269 for( Int i = 0; i < DIM_NUM_TYPE; i++ )270 {271 m_dimDeltaDC[i][0] = (Pel* )xMalloc(Pel, uiNumPartition);272 m_dimDeltaDC[i][1] = (Pel* )xMalloc(Pel, uiNumPartition);273 }274 #if H_3D_DIM_DMM275 for( Int i = 0; i < DMM_NUM_TYPE; i++ )276 {277 m_dmmWedgeTabIdx[i] = (UInt*)xMalloc(UInt, uiNumPartition);278 }279 #endif280 #if H_3D_DIM_SDC281 m_pbSDCFlag = (Bool*)xMalloc(Bool, uiNumPartition);282 m_apSegmentDCOffset[0] = (Pel*)xMalloc(Pel, uiNumPartition);283 m_apSegmentDCOffset[1] = (Pel*)xMalloc(Pel, uiNumPartition);284 #endif285 #endif286 #if H_3D_DBBP287 m_pbDBBPFlag = (Bool* )xMalloc(Bool, uiNumPartition);288 #endif289 203 } 290 204 else … … 299 213 m_pcPattern = (TComPattern*)xMalloc(TComPattern, 1); 300 214 301 #if H_3D_DDD302 m_pucDisparityDerivedDepth = (UChar* )xMalloc( UChar, uiNumPartition);303 m_pbUseDDD = (Bool* ) xMalloc( Bool, uiNumPartition);304 #endif305 215 306 216 // create motion vector fields … … 335 245 336 246 if ( m_skipFlag ) { delete[] m_skipFlag; m_skipFlag = NULL; } 337 #if MTK_SINGLE_DEPTH_MODE_I0095338 if ( m_singleDepthFlag ) { delete[] m_singleDepthFlag; m_singleDepthFlag = NULL; }339 if ( m_apSingleDepthValue ) { xFree(m_apSingleDepthValue); m_apSingleDepthValue = NULL; }340 #endif341 247 if ( m_pePartSize ) { delete[] m_pePartSize; m_pePartSize = NULL; } 342 248 if ( m_pePredMode ) { delete[] m_pePredMode; m_pePredMode = NULL; } … … 348 254 if ( m_pbMergeFlag ) { xFree(m_pbMergeFlag); m_pbMergeFlag = NULL; } 349 255 if ( m_puhMergeIndex ) { xFree(m_puhMergeIndex); m_puhMergeIndex = NULL; } 350 #if H_3D_VSP351 if ( m_piVSPFlag ) { xFree(m_piVSPFlag); m_piVSPFlag = NULL; }352 #endif353 #if H_3D_SPIVMP354 if ( m_pbSPIVMPFlag ) { xFree(m_pbSPIVMPFlag); m_pbSPIVMPFlag = NULL; }355 #endif356 256 if ( m_puhLumaIntraDir ) { xFree(m_puhLumaIntraDir); m_puhLumaIntraDir = NULL; } 357 257 if ( m_puhChromaIntraDir ) { xFree(m_puhChromaIntraDir); m_puhChromaIntraDir = NULL; } … … 382 282 if ( m_apiMVPNum[0] ) { delete[] m_apiMVPNum[0]; m_apiMVPNum[0] = NULL; } 383 283 if ( m_apiMVPNum[1] ) { delete[] m_apiMVPNum[1]; m_apiMVPNum[1] = NULL; } 384 #if H_3D_NBDV 385 if ( m_pDvInfo ) { xFree(m_pDvInfo); m_pDvInfo = NULL; } 386 #endif 387 388 #if H_3D_DDD 389 if ( m_pucDisparityDerivedDepth ) { xFree(m_pucDisparityDerivedDepth); m_pucDisparityDerivedDepth = NULL; } 390 if ( m_pbUseDDD ) { xFree(m_pbUseDDD); m_pbUseDDD = NULL; } 391 #endif 392 393 #if H_3D_ARP 394 if ( m_puhARPW ) { delete[] m_puhARPW; m_puhARPW = NULL; } 395 #endif 396 #if H_3D_IC 397 if ( m_pbICFlag ) { xFree(m_pbICFlag); m_pbICFlag = NULL; } 398 #endif 284 285 399 286 m_acCUMvField[0].destroy(); 400 287 m_acCUMvField[1].destroy(); 401 288 402 #if H_3D_DIM403 for( Int i = 0; i < DIM_NUM_TYPE; i++ )404 {405 if ( m_dimDeltaDC[i][0] ) { xFree( m_dimDeltaDC[i][0] ); m_dimDeltaDC[i][0] = NULL; }406 if ( m_dimDeltaDC[i][1] ) { xFree( m_dimDeltaDC[i][1] ); m_dimDeltaDC[i][1] = NULL; }407 }408 #if H_3D_DIM_DMM409 for( Int i = 0; i < DMM_NUM_TYPE; i++ )410 {411 if ( m_dmmWedgeTabIdx[i] ) { xFree( m_dmmWedgeTabIdx[i] ); m_dmmWedgeTabIdx[i] = NULL; }412 }413 #endif414 #if H_3D_DIM_SDC415 if ( m_pbSDCFlag ) { xFree(m_pbSDCFlag); m_pbSDCFlag = NULL; }416 if ( m_apSegmentDCOffset[0] ) { xFree(m_apSegmentDCOffset[0]); m_apSegmentDCOffset[0] = NULL; }417 if ( m_apSegmentDCOffset[1] ) { xFree(m_apSegmentDCOffset[1]); m_apSegmentDCOffset[1] = NULL; }418 #endif419 #endif420 #if H_3D_DBBP421 if ( m_pbDBBPFlag ) { xFree(m_pbDBBPFlag); m_pbDBBPFlag = NULL; }422 #endif423 289 } 424 290 m_pcCUAboveLeft = NULL; … … 503 369 TComDataCU * pcFrom = pcPic->getCU(getAddr()); 504 370 m_skipFlag[ui] = pcFrom->getSkipFlag(ui); 505 #if MTK_SINGLE_DEPTH_MODE_I0095506 m_singleDepthFlag[ui] = pcFrom->getSingleDepthFlag(ui);507 m_apSingleDepthValue[ui] = pcFrom->getSingleDepthValue(ui);508 #endif509 371 m_pePartSize[ui] = pcFrom->getPartitionSize(ui); 510 372 m_pePredMode[ui] = pcFrom->getPredictionMode(ui); 511 373 m_CUTransquantBypass[ui] = pcFrom->getCUTransquantBypass(ui); 512 374 m_puhDepth[ui] = pcFrom->getDepth(ui); 513 #if H_3D_ARP 514 m_puhARPW [ui] = pcFrom->getARPW( ui ); 515 #endif 516 #if H_3D_IC 517 m_pbICFlag[ui] = pcFrom->m_pbICFlag[ui]; 518 #endif 519 520 #if H_3D_DDD 521 m_pucDisparityDerivedDepth[ui] = pcFrom->m_pucDisparityDerivedDepth[ui]; 522 m_pbUseDDD[ui] = pcFrom->m_pbUseDDD[ui]; 523 #endif 375 524 376 525 377 m_puhWidth [ui] = pcFrom->getWidth(ui); … … 536 388 m_pbMergeFlag[ui]=pcFrom->m_pbMergeFlag[ui]; 537 389 m_puhMergeIndex[ui]=pcFrom->m_puhMergeIndex[ui]; 538 #if H_3D_VSP539 m_piVSPFlag[ui] = pcFrom->m_piVSPFlag[ui];540 #endif541 #if H_3D_SPIVMP542 m_pbSPIVMPFlag[ui] = pcFrom->m_pbSPIVMPFlag[ui];543 #endif544 390 m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui]; 545 391 m_puhChromaIntraDir[ui]=pcFrom->m_puhChromaIntraDir[ui]; … … 549 395 m_puhCbf[2][ui]=pcFrom->m_puhCbf[2][ui]; 550 396 m_pbIPCMFlag[ui] = pcFrom->m_pbIPCMFlag[ui]; 551 #if H_3D_DIM_SDC552 m_pbSDCFlag[ui] = pcFrom->m_pbSDCFlag[ui];553 #endif554 #if H_3D_DBBP555 m_pbDBBPFlag[ui] = pcFrom->m_pbDBBPFlag[ui];556 #endif557 397 } 558 398 … … 563 403 { 564 404 memset( m_skipFlag + firstElement, false, numElements * sizeof( *m_skipFlag ) ); 565 #if MTK_SINGLE_DEPTH_MODE_I0095566 memset( m_singleDepthFlag + firstElement, false, numElements * sizeof( *m_singleDepthFlag ) );567 memset( m_apSingleDepthValue + firstElement, 0, numElements * sizeof( *m_apSingleDepthValue ) );568 #endif569 405 memset( m_pePartSize + firstElement, SIZE_NONE, numElements * sizeof( *m_pePartSize ) ); 570 406 memset( m_pePredMode + firstElement, MODE_NONE, numElements * sizeof( *m_pePredMode ) ); … … 584 420 memset( m_pbMergeFlag + firstElement, false, numElements * sizeof( *m_pbMergeFlag ) ); 585 421 memset( m_puhMergeIndex + firstElement, 0, numElements * sizeof( *m_puhMergeIndex ) ); 586 #if H_3D_VSP587 memset( m_piVSPFlag + firstElement, 0, numElements * sizeof( *m_piVSPFlag ) );588 #endif589 #if H_3D_SPIVMP590 memset( m_pbSPIVMPFlag + firstElement, 0, numElements * sizeof( *m_pbSPIVMPFlag ) );591 #endif592 422 memset( m_puhLumaIntraDir + firstElement, DC_IDX, numElements * sizeof( *m_puhLumaIntraDir ) ); 593 423 memset( m_puhChromaIntraDir + firstElement, 0, numElements * sizeof( *m_puhChromaIntraDir ) ); … … 597 427 memset( m_puhCbf[2] + firstElement, 0, numElements * sizeof( *m_puhCbf[2] ) ); 598 428 memset( m_pbIPCMFlag + firstElement, false, numElements * sizeof( *m_pbIPCMFlag ) ); 599 #if H_3D_ARP 600 memset( m_puhARPW + firstElement, 0, numElements * sizeof( UChar ) ); 601 #endif 602 #if H_3D_IC 603 memset( m_pbICFlag + firstElement, false, numElements * sizeof( *m_pbICFlag ) ); 604 #endif 605 606 #if H_3D_DDD 607 memset( m_pucDisparityDerivedDepth + firstElement, 0, numElements * sizeof( *m_pucDisparityDerivedDepth ) ); 608 memset( m_pbUseDDD + firstElement, 0, numElements * sizeof( *m_pbUseDDD ) ); 609 #endif 610 611 #if H_3D_DIM 612 for( Int i = 0; i < DIM_NUM_TYPE; i++ ) 613 { 614 memset( m_dimDeltaDC[i][0] + firstElement, 0, numElements * sizeof( *m_dimDeltaDC[i][0] ) ); 615 memset( m_dimDeltaDC[i][1] + firstElement, 0, numElements * sizeof( *m_dimDeltaDC[i][1] ) ); 616 } 617 #if H_3D_DIM_DMM 618 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 619 { 620 memset( m_dmmWedgeTabIdx[i] + firstElement, 0, numElements * sizeof( *m_dmmWedgeTabIdx[i] ) ); 621 } 622 #endif 623 #if H_3D_DIM_SDC 624 memset( m_pbSDCFlag + firstElement, 0, numElements * sizeof( *m_pbSDCFlag ) ); 625 memset( m_apSegmentDCOffset[0] + firstElement, 0, numElements * sizeof( *m_apSegmentDCOffset[0] ) ); 626 memset( m_apSegmentDCOffset[1] + firstElement, 0, numElements * sizeof( *m_apSegmentDCOffset[1] ) ); 627 #endif 628 m_apDmmPredictor[0] = 0; 629 m_apDmmPredictor[1] = 0; 630 #endif 631 #if H_3D_DBBP 632 memset( m_pbDBBPFlag + firstElement, false, numElements * sizeof( *m_pbDBBPFlag ) ); 633 #endif 429 430 634 431 } 635 432 … … 754 551 m_puhTransformSkip[2][ui] = 0; 755 552 m_skipFlag[ui] = false; 756 #if MTK_SINGLE_DEPTH_MODE_I0095757 m_singleDepthFlag[ui] = false;758 m_apSingleDepthValue[ui] = 0;759 #endif760 553 m_pePartSize[ui] = SIZE_NONE; 761 554 m_pePredMode[ui] = MODE_NONE; … … 765 558 m_pbMergeFlag[ui] = 0; 766 559 m_puhMergeIndex[ui] = 0; 767 #if H_3D_VSP768 m_piVSPFlag[ui] = 0;769 #endif770 #if H_3D_SPIVMP771 m_pbSPIVMPFlag[ui] = 0;772 #endif773 560 m_puhLumaIntraDir[ui] = DC_IDX; 774 561 m_puhChromaIntraDir[ui] = 0; … … 777 564 m_puhCbf[1][ui] = 0; 778 565 m_puhCbf[2][ui] = 0; 779 #if H_3D_ARP 780 m_puhARPW[ui] = 0; 781 #endif 782 #if H_3D_IC 783 m_pbICFlag[ui] = false; 784 #endif 785 786 #if H_3D_DDD 787 m_pucDisparityDerivedDepth[ui] = 0; 788 m_pbUseDDD[ui] = 0; 789 #endif 790 791 #if H_3D_DIM 792 for( Int i = 0; i < DIM_NUM_TYPE; i++ ) 793 { 794 m_dimDeltaDC[i][0] [ui] = 0; 795 m_dimDeltaDC[i][1] [ui] = 0; 796 } 797 #if H_3D_DIM_DMM 798 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 799 { 800 m_dmmWedgeTabIdx[i] [ui] = 0; 801 } 802 #endif 803 #if H_3D_DIM_SDC 804 m_pbSDCFlag [ui] = false; 805 m_apSegmentDCOffset[0][ui] = 0; 806 m_apSegmentDCOffset[1][ui] = 0; 807 #endif 808 m_apDmmPredictor[0] = 0; 809 m_apDmmPredictor[1] = 0; 810 #endif 811 #if H_3D_DBBP 812 m_pbDBBPFlag[ui] = false; 813 #endif 566 567 814 568 } 815 569 } … … 869 623 memset( m_pbMergeFlag, 0, iSizeInBool ); 870 624 memset( m_puhMergeIndex, 0, iSizeInUchar ); 871 #if H_3D_VSP872 memset( m_piVSPFlag, 0, sizeof( Char ) * m_uiNumPartition );873 #endif874 #if H_3D_SPIVMP875 memset( m_pbSPIVMPFlag, 0, sizeof( Bool ) * m_uiNumPartition );876 #endif877 625 memset( m_puhLumaIntraDir, DC_IDX, iSizeInUchar ); 878 626 memset( m_puhChromaIntraDir, 0, iSizeInUchar ); … … 886 634 memset( m_puhCbf[2], 0, iSizeInUchar ); 887 635 memset( m_puhDepth, uiDepth, iSizeInUchar ); 888 #if H_3D_NBDV 889 m_pDvInfo->bDV = false; 890 #endif 891 #if H_3D_ARP 892 memset( m_puhARPW, 0, iSizeInUchar ); 893 #endif 894 895 #if H_3D_DDD 896 memset( m_pucDisparityDerivedDepth, 0, iSizeInUchar ); 897 memset( m_pbUseDDD, 0, iSizeInBool ); 898 #endif 636 899 637 900 638 UChar uhWidth = g_uiMaxCUWidth >> uiDepth; … … 903 641 memset( m_puhHeight, uhHeight, iSizeInUchar ); 904 642 memset( m_pbIPCMFlag, 0, iSizeInBool ); 905 #if H_3D_IC906 memset( m_pbICFlag, 0, iSizeInBool );907 #endif908 #if H_3D_DIM909 for( Int i = 0; i < DIM_NUM_TYPE; i++ )910 {911 memset( m_dimDeltaDC[i][0], 0, sizeof(Pel ) * m_uiNumPartition );912 memset( m_dimDeltaDC[i][1], 0, sizeof(Pel ) * m_uiNumPartition );913 }914 #if H_3D_DIM_DMM915 for( Int i = 0; i < DMM_NUM_TYPE; i++ )916 {917 memset( m_dmmWedgeTabIdx[i], 0, sizeof(UInt) * m_uiNumPartition );918 }919 #endif920 #if H_3D_DIM_SDC921 memset( m_pbSDCFlag, 0, sizeof(Bool) * m_uiNumPartition );922 memset( m_apSegmentDCOffset[0], 0, sizeof(Pel) * m_uiNumPartition );923 memset( m_apSegmentDCOffset[1], 0, sizeof(Pel) * m_uiNumPartition );924 #endif925 m_apDmmPredictor[0] = 0;926 m_apDmmPredictor[1] = 0;927 #endif928 #if H_3D_DBBP929 memset( m_pbDBBPFlag, 0, iSizeInBool );930 #endif931 643 932 644 for (UInt ui = 0; ui < m_uiNumPartition; ui++) 933 645 { 934 646 m_skipFlag[ui] = false; 935 #if MTK_SINGLE_DEPTH_MODE_I0095936 m_singleDepthFlag[ui] = false;937 m_apSingleDepthValue[ui]= 0;938 #endif939 647 m_pePartSize[ui] = SIZE_NONE; 940 648 m_pePredMode[ui] = MODE_NONE; … … 958 666 m_puhTransformSkip[2][ui] = pcCU->getTransformSkip(uiPartOffset+ui,TEXT_CHROMA_V); 959 667 m_skipFlag[ui] = pcCU->getSkipFlag(uiPartOffset+ui); 960 #if MTK_SINGLE_DEPTH_MODE_I0095961 m_singleDepthFlag[ui] = pcCU->getSingleDepthFlag(uiPartOffset+ui);962 m_apSingleDepthValue[ui] = pcCU->getSingleDepthValue(uiPartOffset+ui);963 #endif964 668 m_pePartSize[ui] = pcCU->getPartitionSize(uiPartOffset+ui); 965 669 m_pePredMode[ui] = pcCU->getPredictionMode(uiPartOffset+ui); … … 969 673 m_pbMergeFlag[ui]=pcCU->m_pbMergeFlag[uiPartOffset+ui]; 970 674 m_puhMergeIndex[ui]=pcCU->m_puhMergeIndex[uiPartOffset+ui]; 971 #if H_3D_VSP972 m_piVSPFlag[ui]=pcCU->m_piVSPFlag[uiPartOffset+ui];973 m_pDvInfo[ ui ] = pcCU->m_pDvInfo[uiPartOffset+ui];974 #endif975 #if H_3D_SPIVMP976 m_pbSPIVMPFlag[ui]=pcCU->m_pbSPIVMPFlag[uiPartOffset+ui];977 #endif978 675 m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui]; 979 676 m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui]; … … 983 680 m_puhCbf[2][ui]=pcCU->m_puhCbf[2][uiPartOffset+ui]; 984 681 985 #if H_3D_ARP 986 m_puhARPW [ui] = pcCU->getARPW( uiPartOffset+ui ); 987 #endif 988 #if H_3D_IC 989 m_pbICFlag [ui] = pcCU->m_pbICFlag[uiPartOffset+ui]; 990 #endif 991 992 #if H_3D_DDD 993 m_pucDisparityDerivedDepth[ui] = pcCU->m_pucDisparityDerivedDepth[uiPartOffset+ui]; 994 m_pbUseDDD[ui] = pcCU->m_pbUseDDD[uiPartOffset+ui]; 995 #endif 996 997 #if H_3D_DIM 998 for( Int i = 0; i < DIM_NUM_TYPE; i++ ) 999 { 1000 m_dimDeltaDC[i][0] [ui] = pcCU->m_dimDeltaDC[i][0] [uiPartOffset+ui]; 1001 m_dimDeltaDC[i][1] [ui] = pcCU->m_dimDeltaDC[i][1] [uiPartOffset+ui]; 1002 } 1003 #if H_3D_DIM_DMM 1004 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 1005 { 1006 m_dmmWedgeTabIdx[i] [ui] = pcCU->m_dmmWedgeTabIdx[i] [uiPartOffset+ui]; 1007 } 1008 #endif 1009 #if H_3D_DIM_SDC 1010 m_pbSDCFlag [ui] = pcCU->m_pbSDCFlag [ uiPartOffset + ui ]; 1011 m_apSegmentDCOffset[0][ui] = pcCU->m_apSegmentDCOffset[0] [ uiPartOffset + ui ]; 1012 m_apSegmentDCOffset[1][ui] = pcCU->m_apSegmentDCOffset[1] [ uiPartOffset + ui ]; 1013 #endif 1014 #endif 1015 #if H_3D_DBBP 1016 m_pbDBBPFlag[ui]=pcCU->m_pbDBBPFlag[uiPartOffset+ui]; 1017 #endif 682 683 1018 684 } 1019 685 } … … 1111 777 1112 778 m_skipFlag=pcCU->getSkipFlag() + uiPart; 1113 #if MTK_SINGLE_DEPTH_MODE_I00951114 m_singleDepthFlag = pcCU->getSingleDepthFlag() + uiPart;1115 m_apSingleDepthValue = pcCU->getSingleDepthValue() + uiPart;1116 #endif1117 779 m_phQP=pcCU->getQP() + uiPart; 1118 780 m_pePartSize = pcCU->getPartitionSize() + uiPart; … … 1120 782 m_CUTransquantBypass = pcCU->getCUTransquantBypass()+uiPart; 1121 783 1122 #if H_3D_NBDV1123 m_pDvInfo = pcCU->getDvInfo() + uiPart;1124 #endif1125 784 m_pbMergeFlag = pcCU->getMergeFlag() + uiPart; 1126 785 m_puhMergeIndex = pcCU->getMergeIndex() + uiPart; 1127 #if H_3D_VSP 1128 m_piVSPFlag = pcCU->getVSPFlag() + uiPart; 1129 #endif 1130 #if H_3D_SPIVMP 1131 m_pbSPIVMPFlag = pcCU->getSPIVMPFlag() + uiPart; 1132 #endif 1133 1134 #if H_3D_ARP 1135 m_puhARPW = pcCU->getARPW() + uiPart; 1136 #endif 1137 #if H_3D_IC 1138 m_pbICFlag = pcCU->getICFlag() + uiPart; 1139 #endif 1140 1141 #if H_3D_DDD 1142 m_pucDisparityDerivedDepth = pcCU->getDDDepth() + uiPart; 1143 m_pbUseDDD = pcCU->getUseDDD() + uiPart; 1144 #endif 786 787 1145 788 1146 789 m_puhLumaIntraDir = pcCU->getLumaIntraDir() + uiPart; … … 1155 798 m_puhCbf[1]= pcCU->getCbf(TEXT_CHROMA_U) + uiPart; 1156 799 m_puhCbf[2]= pcCU->getCbf(TEXT_CHROMA_V) + uiPart; 1157 #if H_3D_DIM1158 for( Int i = 0; i < DIM_NUM_TYPE; i++ )1159 {1160 m_dimDeltaDC[i][0] = pcCU->getDimDeltaDC( i, 0 ) + uiPart;1161 m_dimDeltaDC[i][1] = pcCU->getDimDeltaDC( i, 1 ) + uiPart;1162 }1163 #if H_3D_DIM_DMM1164 for( Int i = 0; i < DMM_NUM_TYPE; i++ )1165 {1166 m_dmmWedgeTabIdx[i] = pcCU->getDmmWedgeTabIdx( i ) + uiPart;1167 }1168 #endif1169 #if H_3D_DIM_SDC1170 m_pbSDCFlag = pcCU->getSDCFlag() + uiPart;1171 m_apSegmentDCOffset[0] = pcCU->getSDCSegmentDCOffset(0) + uiPart;1172 m_apSegmentDCOffset[1] = pcCU->getSDCSegmentDCOffset(1) + uiPart;1173 #endif1174 #endif1175 #if H_3D_DBBP1176 m_pbDBBPFlag = pcCU->getDBBPFlag() + uiPart;1177 #endif1178 800 m_puhDepth=pcCU->getDepth() + uiPart; 1179 801 m_puhWidth=pcCU->getWidth() + uiPart; … … 1221 843 memcpy(m_sliceSegmentStartCU,pcCU->m_sliceSegmentStartCU+uiPart,sizeof(UInt)*m_uiNumPartition); 1222 844 } 1223 #if H_3D_NBDV1224 Void TComDataCU::copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx)1225 {1226 m_pDvInfo = pcCU->getDvInfo() + uiAbsPartIdx;1227 }1228 #endif1229 845 // Copy inter prediction info from the biggest CU 1230 846 Void TComDataCU::copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList 1231 #if H_3D_NBDV1232 , Bool bNBDV1233 #endif1234 847 ) 1235 848 { … … 1252 865 1253 866 m_skipFlag = pcCU->getSkipFlag () + uiAbsPartIdx; 1254 #if MTK_SINGLE_DEPTH_MODE_I00951255 m_singleDepthFlag = pcCU->getSingleDepthFlag () + uiAbsPartIdx;1256 m_apSingleDepthValue = pcCU->getSingleDepthValue () + uiAbsPartIdx;1257 #endif1258 867 m_pePartSize = pcCU->getPartitionSize () + uiAbsPartIdx; 1259 #if H_3D_NBDV1260 if(bNBDV == true)1261 {1262 m_puhWidth = pcCU->getWidth () + uiAbsPartIdx;1263 m_puhHeight = pcCU->getHeight() + uiAbsPartIdx;1264 m_puhDepth = pcCU->getDepth () + uiAbsPartIdx;1265 }1266 else1267 {1268 #endif1269 868 m_pePredMode = pcCU->getPredictionMode() + uiAbsPartIdx; 1270 869 m_CUTransquantBypass = pcCU->getCUTransquantBypass() + uiAbsPartIdx; … … 1277 876 m_pbMergeFlag = pcCU->getMergeFlag() + uiAbsPartIdx; 1278 877 m_puhMergeIndex = pcCU->getMergeIndex() + uiAbsPartIdx; 1279 #if H_3D_VSP1280 m_piVSPFlag = pcCU->getVSPFlag() + uiAbsPartIdx;1281 m_pDvInfo = pcCU->getDvInfo() + uiAbsPartIdx;1282 #endif1283 #if H_3D_SPIVMP1284 m_pbSPIVMPFlag = pcCU->getSPIVMPFlag() + uiAbsPartIdx;1285 #endif1286 878 1287 879 m_apiMVPIdx[eRefPicList] = pcCU->getMVPIdx(eRefPicList) + uiAbsPartIdx; 1288 880 m_apiMVPNum[eRefPicList] = pcCU->getMVPNum(eRefPicList) + uiAbsPartIdx; 1289 881 1290 #if H_3D_ARP 1291 m_puhARPW = pcCU->getARPW() + uiAbsPartIdx; 1292 #endif 1293 1294 #if H_3D_DDD 1295 m_pucDisparityDerivedDepth = pcCU->getDDDepth() + uiAbsPartIdx; 1296 m_pbUseDDD = pcCU->getUseDDD() + uiAbsPartIdx; 1297 #endif 882 1298 883 1299 #if H_3D_DBBP1300 m_pbDBBPFlag = pcCU->getDBBPFlag() + uiAbsPartIdx;1301 #endif1302 884 1303 885 m_acCUMvField[ eRefPicList ].linkToWithOffset( pcCU->getCUMvField(eRefPicList), uiAbsPartIdx ); … … 1305 887 memcpy(m_sliceStartCU,pcCU->m_sliceStartCU+uiAbsPartIdx,sizeof(UInt)*m_uiNumPartition); 1306 888 memcpy(m_sliceSegmentStartCU,pcCU->m_sliceSegmentStartCU+uiAbsPartIdx,sizeof(UInt)*m_uiNumPartition); 1307 #if H_3D_NBDV1308 }1309 #endif1310 #if H_3D_IC1311 m_pbICFlag = pcCU->getICFlag() + uiAbsPartIdx;1312 #endif1313 889 } 1314 890 … … 1331 907 Int sizeInChar = sizeof( Char ) * uiNumPartition; 1332 908 memcpy( m_skipFlag + uiOffset, pcCU->getSkipFlag(), sizeof( *m_skipFlag ) * uiNumPartition ); 1333 #if MTK_SINGLE_DEPTH_MODE_I00951334 memcpy( m_singleDepthFlag + uiOffset, pcCU->getSingleDepthFlag(), sizeof( *m_singleDepthFlag ) * uiNumPartition );1335 memcpy( m_apSingleDepthValue + uiOffset, pcCU->getSingleDepthValue(), sizeof( *m_apSingleDepthValue ) * uiNumPartition);1336 #endif1337 909 memcpy( m_phQP + uiOffset, pcCU->getQP(), sizeInChar ); 1338 910 memcpy( m_pePartSize + uiOffset, pcCU->getPartitionSize(), sizeof( *m_pePartSize ) * uiNumPartition ); … … 1341 913 memcpy( m_pbMergeFlag + uiOffset, pcCU->getMergeFlag(), iSizeInBool ); 1342 914 memcpy( m_puhMergeIndex + uiOffset, pcCU->getMergeIndex(), iSizeInUchar ); 1343 #if H_3D_VSP1344 memcpy( m_piVSPFlag + uiOffset, pcCU->getVSPFlag(), sizeof( Char ) * uiNumPartition );1345 memcpy( m_pDvInfo + uiOffset, pcCU->getDvInfo(), sizeof( *m_pDvInfo ) * uiNumPartition );1346 1347 #endif1348 #if H_3D_SPIVMP1349 memcpy( m_pbSPIVMPFlag + uiOffset, pcCU->getSPIVMPFlag(), sizeof( Bool ) * uiNumPartition );1350 #endif1351 915 memcpy( m_puhLumaIntraDir + uiOffset, pcCU->getLumaIntraDir(), iSizeInUchar ); 1352 916 memcpy( m_puhChromaIntraDir + uiOffset, pcCU->getChromaIntraDir(), iSizeInUchar ); … … 1361 925 memcpy( m_puhCbf[2] + uiOffset, pcCU->getCbf(TEXT_CHROMA_V), iSizeInUchar ); 1362 926 1363 #if H_3D_DDD 1364 memcpy( m_pucDisparityDerivedDepth + uiOffset, pcCU->getDDDepth(), iSizeInUchar ); 1365 memcpy( m_pbUseDDD + uiOffset, pcCU->getUseDDD(), iSizeInBool ); 1366 #endif 1367 1368 1369 #if H_3D_DIM 1370 for( Int i = 0; i < DIM_NUM_TYPE; i++ ) 1371 { 1372 memcpy( m_dimDeltaDC[i][0] + uiOffset, pcCU->getDimDeltaDC( i, 0 ), sizeof(Pel ) * uiNumPartition ); 1373 memcpy( m_dimDeltaDC[i][1] + uiOffset, pcCU->getDimDeltaDC( i, 1 ), sizeof(Pel ) * uiNumPartition ); 1374 } 1375 #if H_3D_DIM_DMM 1376 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 1377 { 1378 memcpy( m_dmmWedgeTabIdx[i] + uiOffset, pcCU->getDmmWedgeTabIdx( i ), sizeof(UInt) * uiNumPartition ); 1379 } 1380 #endif 1381 #if H_3D_DIM_SDC 1382 memcpy( m_pbSDCFlag + uiOffset, pcCU->getSDCFlag(), iSizeInBool ); 1383 memcpy( m_apSegmentDCOffset[0] + uiOffset, pcCU->getSDCSegmentDCOffset(0), sizeof( Pel ) * uiNumPartition); 1384 memcpy( m_apSegmentDCOffset[1] + uiOffset, pcCU->getSDCSegmentDCOffset(1), sizeof( Pel ) * uiNumPartition); 1385 #endif 1386 #endif 1387 #if H_3D_DBBP 1388 memcpy( m_pbDBBPFlag + uiOffset, pcCU->getDBBPFlag(), iSizeInBool ); 1389 #endif 927 928 1390 929 1391 930 memcpy( m_puhDepth + uiOffset, pcCU->getDepth(), iSizeInUchar ); … … 1431 970 memcpy( m_sliceStartCU + uiOffset, pcCU->m_sliceStartCU, sizeof( UInt ) * uiNumPartition ); 1432 971 memcpy( m_sliceSegmentStartCU + uiOffset, pcCU->m_sliceSegmentStartCU, sizeof( UInt ) * uiNumPartition ); 1433 #if H_3D_ARP1434 memcpy( m_puhARPW + uiOffset, pcCU->getARPW(), iSizeInUchar );1435 #endif1436 #if H_3D_IC1437 memcpy( m_pbICFlag + uiOffset, pcCU->getICFlag(), iSizeInBool );1438 #endif1439 972 } 1440 973 … … 1455 988 1456 989 memcpy( rpcCU->getSkipFlag() + m_uiAbsIdxInLCU, m_skipFlag, sizeof( *m_skipFlag ) * m_uiNumPartition ); 1457 #if MTK_SINGLE_DEPTH_MODE_I00951458 memcpy( rpcCU->getSingleDepthFlag() + m_uiAbsIdxInLCU, m_singleDepthFlag, sizeof( *m_singleDepthFlag ) * m_uiNumPartition );1459 memcpy( rpcCU->getSingleDepthValue() + m_uiAbsIdxInLCU, m_apSingleDepthValue, sizeof( *m_apSingleDepthValue ) * m_uiNumPartition);1460 #endif1461 990 memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, sizeInChar ); 1462 #if H_3D_NBDV 1463 memcpy( rpcCU->getDvInfo() + m_uiAbsIdxInLCU, m_pDvInfo, sizeof(* m_pDvInfo) * m_uiNumPartition ); 1464 #endif 1465 1466 #if H_3D_DDD 1467 memcpy( rpcCU->getDDDepth() + m_uiAbsIdxInLCU, m_pucDisparityDerivedDepth, iSizeInUchar ); 1468 memcpy( rpcCU->getUseDDD() + m_uiAbsIdxInLCU, m_pbUseDDD, iSizeInBool ); 1469 #endif 991 1470 992 1471 993 memcpy( rpcCU->getPartitionSize() + m_uiAbsIdxInLCU, m_pePartSize, sizeof( *m_pePartSize ) * m_uiNumPartition ); … … 1474 996 memcpy( rpcCU->getMergeFlag() + m_uiAbsIdxInLCU, m_pbMergeFlag, iSizeInBool ); 1475 997 memcpy( rpcCU->getMergeIndex() + m_uiAbsIdxInLCU, m_puhMergeIndex, iSizeInUchar ); 1476 #if H_3D_VSP1477 memcpy( rpcCU->getVSPFlag() + m_uiAbsIdxInLCU, m_piVSPFlag, sizeof( Char ) * m_uiNumPartition );1478 memcpy( rpcCU->getDvInfo() + m_uiAbsIdxInLCU, m_pDvInfo, sizeof( *m_pDvInfo ) * m_uiNumPartition );1479 #endif1480 #if H_3D_SPIVMP1481 memcpy( rpcCU->getSPIVMPFlag() + m_uiAbsIdxInLCU, m_pbSPIVMPFlag, sizeof( Bool ) * m_uiNumPartition );1482 #endif1483 998 memcpy( rpcCU->getLumaIntraDir() + m_uiAbsIdxInLCU, m_puhLumaIntraDir, iSizeInUchar ); 1484 999 memcpy( rpcCU->getChromaIntraDir() + m_uiAbsIdxInLCU, m_puhChromaIntraDir, iSizeInUchar ); … … 1493 1008 memcpy( rpcCU->getCbf(TEXT_CHROMA_V) + m_uiAbsIdxInLCU, m_puhCbf[2], iSizeInUchar ); 1494 1009 1495 #if H_3D_DIM1496 for( Int i = 0; i < DIM_NUM_TYPE; i++ )1497 {1498 memcpy( rpcCU->getDimDeltaDC( i, 0 ) + m_uiAbsIdxInLCU, m_dimDeltaDC[i][0], sizeof(Pel ) * m_uiNumPartition );1499 memcpy( rpcCU->getDimDeltaDC( i, 1 ) + m_uiAbsIdxInLCU, m_dimDeltaDC[i][1], sizeof(Pel ) * m_uiNumPartition );1500 }1501 #if H_3D_DIM_DMM1502 for( Int i = 0; i < DMM_NUM_TYPE; i++ )1503 {1504 memcpy( rpcCU->getDmmWedgeTabIdx( i ) + m_uiAbsIdxInLCU, m_dmmWedgeTabIdx[i], sizeof(UInt) * m_uiNumPartition );1505 }1506 #endif1507 #if H_3D_DIM_SDC1508 memcpy( rpcCU->getSDCFlag() + m_uiAbsIdxInLCU, m_pbSDCFlag, iSizeInBool );1509 memcpy( rpcCU->getSDCSegmentDCOffset(0) + m_uiAbsIdxInLCU, m_apSegmentDCOffset[0], sizeof( Pel ) * m_uiNumPartition);1510 memcpy( rpcCU->getSDCSegmentDCOffset(1) + m_uiAbsIdxInLCU, m_apSegmentDCOffset[1], sizeof( Pel ) * m_uiNumPartition);1511 #endif1512 #endif1513 #if H_3D_DBBP1514 memcpy( rpcCU->getDBBPFlag() + m_uiAbsIdxInLCU, m_pbDBBPFlag, iSizeInBool );1515 #endif1516 1010 1517 1011 memcpy( rpcCU->getDepth() + m_uiAbsIdxInLCU, m_puhDepth, iSizeInUchar ); … … 1549 1043 memcpy( rpcCU->m_sliceStartCU + m_uiAbsIdxInLCU, m_sliceStartCU, sizeof( UInt ) * m_uiNumPartition ); 1550 1044 memcpy( rpcCU->m_sliceSegmentStartCU + m_uiAbsIdxInLCU, m_sliceSegmentStartCU, sizeof( UInt ) * m_uiNumPartition ); 1551 #if H_3D_ARP1552 memcpy( rpcCU->getARPW() + m_uiAbsIdxInLCU, m_puhARPW, iSizeInUchar );1553 #endif1554 #if H_3D_IC1555 memcpy( rpcCU->getICFlag() + m_uiAbsIdxInLCU, m_pbICFlag, iSizeInBool );1556 #endif1557 1045 } 1558 1046 … … 1574 1062 Int sizeInChar = sizeof( Char ) * uiQNumPart; 1575 1063 memcpy( rpcCU->getSkipFlag() + uiPartOffset, m_skipFlag, sizeof( *m_skipFlag ) * uiQNumPart ); 1576 #if MTK_SINGLE_DEPTH_MODE_I00951577 memcpy( rpcCU->getSingleDepthFlag() + uiPartOffset, m_singleDepthFlag, sizeof( *m_singleDepthFlag ) * uiQNumPart );1578 memcpy( rpcCU->getSingleDepthValue() + uiPartOffset, m_apSingleDepthValue, sizeof( *m_apSingleDepthValue ) * uiQNumPart);1579 #endif1580 1064 memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, sizeInChar ); 1581 1065 memcpy( rpcCU->getPartitionSize() + uiPartOffset, m_pePartSize, sizeof( *m_pePartSize ) * uiQNumPart ); … … 1584 1068 memcpy( rpcCU->getMergeFlag() + uiPartOffset, m_pbMergeFlag, iSizeInBool ); 1585 1069 memcpy( rpcCU->getMergeIndex() + uiPartOffset, m_puhMergeIndex, iSizeInUchar ); 1586 #if H_3D_VSP1587 memcpy( rpcCU->getVSPFlag() + uiPartOffset, m_piVSPFlag, sizeof(Char) * uiQNumPart );1588 #endif1589 #if H_3D_SPIVMP1590 memcpy( rpcCU->getSPIVMPFlag() + uiPartOffset, m_pbSPIVMPFlag, sizeof(Bool) * uiQNumPart );1591 #endif1592 1070 memcpy( rpcCU->getLumaIntraDir() + uiPartOffset, m_puhLumaIntraDir, iSizeInUchar ); 1593 1071 memcpy( rpcCU->getChromaIntraDir() + uiPartOffset, m_puhChromaIntraDir, iSizeInUchar ); … … 1601 1079 memcpy( rpcCU->getCbf(TEXT_CHROMA_V) + uiPartOffset, m_puhCbf[2], iSizeInUchar ); 1602 1080 1603 #if H_3D_DDD 1604 memcpy( rpcCU->getDDDepth() + uiPartOffset, m_pucDisparityDerivedDepth, iSizeInUchar ); 1605 memcpy( rpcCU->getUseDDD() + uiPartOffset, m_pbUseDDD, iSizeInBool ); 1606 #endif 1607 1608 #if H_3D_DIM 1609 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 1610 { 1611 memcpy( rpcCU->getDimDeltaDC( i, 0 ) + uiPartOffset, m_dimDeltaDC[i][0], sizeof(Pel ) * uiQNumPart ); 1612 memcpy( rpcCU->getDimDeltaDC( i, 1 ) + uiPartOffset, m_dimDeltaDC[i][1], sizeof(Pel ) * uiQNumPart ); 1613 } 1614 #if H_3D_DIM_DMM 1615 for( Int i = 0; i < DMM_NUM_TYPE; i++ ) 1616 { 1617 memcpy( rpcCU->getDmmWedgeTabIdx( i ) + uiPartOffset, m_dmmWedgeTabIdx[i], sizeof(UInt) * uiQNumPart ); 1618 } 1619 #endif 1620 #if H_3D_DIM_SDC 1621 memcpy( rpcCU->getSDCFlag() + uiPartOffset, m_pbSDCFlag, iSizeInBool ); 1622 memcpy( rpcCU->getSDCSegmentDCOffset(0) + uiPartOffset, m_apSegmentDCOffset[0], sizeof( Pel ) * uiQNumPart); 1623 memcpy( rpcCU->getSDCSegmentDCOffset(1) + uiPartOffset, m_apSegmentDCOffset[1], sizeof( Pel ) * uiQNumPart); 1624 #endif 1625 #endif 1626 #if H_3D_DBBP 1627 memcpy( rpcCU->getDBBPFlag() + uiPartOffset, m_pbDBBPFlag, iSizeInBool ); 1628 #endif 1081 1629 1082 1630 1083 memcpy( rpcCU->getDepth() + uiPartOffset, m_puhDepth, iSizeInUchar ); … … 1663 1116 memcpy( rpcCU->m_sliceStartCU + uiPartOffset, m_sliceStartCU, sizeof( UInt ) * uiQNumPart ); 1664 1117 memcpy( rpcCU->m_sliceSegmentStartCU + uiPartOffset, m_sliceSegmentStartCU, sizeof( UInt ) * uiQNumPart ); 1665 #if H_3D_ARP 1666 memcpy( rpcCU->getARPW() + uiPartOffset, m_puhARPW, iSizeInUchar ); 1667 #endif 1668 #if H_3D_IC 1669 memcpy( rpcCU->getICFlag() + uiPartOffset, m_pbICFlag, iSizeInBool ); 1670 #endif 1671 } 1672 1673 #if H_3D_DDD 1674 Void TComDataCU::setDDDepthSubParts ( UChar ucDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 1675 { 1676 setSubPart<UChar>( ucDDD, m_pucDisparityDerivedDepth, uiAbsPartIdx, uiDepth, uiPartIdx ); 1677 } 1678 1679 Void TComDataCU::setUseDDD ( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 1680 { 1681 setSubPart<Bool>( bUseDDD, m_pbUseDDD, uiAbsPartIdx, uiDepth, uiPartIdx ); 1682 } 1683 1684 Void TComDataCU::setUseDDD( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiDepth ) 1685 { 1686 memset( m_pbUseDDD + uiAbsPartIdx, bUseDDD, (m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ))*sizeof(Bool) ); 1687 } 1688 1689 #endif 1118 } 1119 1690 1120 1691 1121 // -------------------------------------------------------------------------------------------------------------------- … … 2206 1636 2207 1637 iLeftIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX; 2208 #if H_3D_DIM2209 mapDepthModeToIntraDir( iLeftIntraDir );2210 #endif2211 1638 2212 1639 // Get intra direction of above PU … … 2214 1641 2215 1642 iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX; 2216 #if H_3D_DIM2217 mapDepthModeToIntraDir( iAboveIntraDir );2218 #endif2219 1643 2220 1644 uiPredNum = 3; … … 2334 1758 } 2335 1759 2336 #if H_3D_ARP 2337 UInt TComDataCU::getCTXARPWFlag( UInt uiAbsPartIdx ) 2338 { 2339 TComDataCU* pcTempCU; 2340 UInt uiTempPartIdx; 2341 UInt uiCtx = 0; 2342 2343 pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); 2344 uiCtx = ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1) : 0; 2345 return uiCtx; 2346 } 2347 #endif 2348 #if H_3D_DBBP 2349 Pel* TComDataCU::getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride) 2350 { 2351 // get coded and reconstructed depth view 2352 TComPicYuv* depthPicYuv = NULL; 2353 Pel* pDepthPels = NULL; 2354 2355 // DBBP is a texture coding tool 2356 if( getSlice()->getIsDepth() ) 2357 { 2358 return NULL; 2359 } 2360 2361 #if H_3D_FCO 2362 TComPic* depthPic = getSlice()->getIvPic(true, getSlice()->getViewIndex() ); 2363 2364 if( depthPic && depthPic->getPicYuvRec() != NULL && depthPic->getIsDepth() ) // depth first 2365 { 2366 depthPicYuv = depthPic->getPicYuvRec(); 2367 depthPicYuv->extendPicBorder(); 2368 2369 // get collocated depth block for current CU 2370 uiDepthStride = depthPicYuv->getStride(); 2371 pDepthPels = depthPicYuv->getLumaAddr( getAddr(), uiAbsPartIdx ); 2372 } 2373 else // texture first 2374 #else 2375 { 2376 DisInfo DvInfo = getDvInfo(uiAbsPartIdx); 2377 2378 TComPic* baseDepthPic = getSlice()->getIvPic (true, DvInfo.m_aVIdxCan); 2379 2380 if( baseDepthPic == NULL || baseDepthPic->getPicYuvRec() == NULL ) 2381 { 2382 return NULL; 2383 } 2384 2385 depthPicYuv = baseDepthPic->getPicYuvRec(); 2386 depthPicYuv->extendPicBorder(); 2387 uiDepthStride = depthPicYuv->getStride(); 2388 2389 Int iBlkX = ( getAddr() % baseDepthPic->getFrameWidthInCU() ) * g_uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ getZorderIdxInCU()+uiAbsPartIdx ] ]; 2390 Int iBlkY = ( getAddr() / baseDepthPic->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ getZorderIdxInCU()+uiAbsPartIdx ] ]; 2391 2392 Int iPictureWidth = depthPicYuv->getWidth(); 2393 Int iPictureHeight = depthPicYuv->getHeight(); 2394 2395 Int iWidth = uiWidth; 2396 Int iHeight = uiHeight; 2397 2398 Bool depthRefineFlag = false; 2399 #if H_3D_NBDV_REF 2400 depthRefineFlag = m_pcSlice->getVPS()->getDepthRefinementFlag( m_pcSlice->getLayerIdInVps() ); 2401 #endif // H_3D_NBDV_REF 2402 2403 TComMv cDv = depthRefineFlag ? DvInfo.m_acDoNBDV : DvInfo.m_acNBDV; 2404 if( depthRefineFlag ) 2405 { 2406 cDv.setVer(0); 2407 } 2408 2409 Int depthPosX = Clip3(0, iPictureWidth - iWidth, iBlkX + ((cDv.getHor()+2)>>2)); 2410 Int depthPosY = Clip3(0, iPictureHeight- iHeight, iBlkY + ((cDv.getVer()+2)>>2)); 2411 2412 pDepthPels = depthPicYuv->getLumaAddr() + depthPosX + depthPosY * uiDepthStride; 2413 } 2414 #endif 2415 2416 AOF( depthPicYuv != NULL ); 2417 AOF( pDepthPels != NULL ); 2418 AOF( uiDepthStride != 0 ); 2419 2420 return pDepthPels; 2421 } 2422 #endif 2423 2424 #if H_3D_DBBP 2425 Void TComDataCU::setDBBPFlagSubParts ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2426 { 2427 setSubPart( bDBBPFlag, m_pbDBBPFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); 2428 } 2429 #endif 2430 2431 #if H_3D_DIM_SDC 2432 UInt TComDataCU::getCtxSDCFlag( UInt uiAbsPartIdx ) 2433 { 2434 return 0; 2435 } 2436 2437 #endif 1760 1761 2438 1762 2439 1763 UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx ) … … 2497 1821 memset( m_skipFlag + absPartIdx, skip, m_pcPic->getNumPartInCU() >> ( 2 * depth ) ); 2498 1822 } 2499 #if MTK_SINGLE_DEPTH_MODE_I00952500 Void TComDataCU::setSingleDepthFlagSubParts( Bool singleDepth, UInt absPartIdx, UInt depth )2501 {2502 assert( sizeof( *m_singleDepthFlag) == 1 );2503 memset( m_singleDepthFlag + absPartIdx, singleDepth, m_pcPic->getNumPartInCU() >> ( 2 * depth ) );2504 }2505 2506 Void TComDataCU::setSingleDepthValueSubParts(Pel singleDepthValue, UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth )2507 {2508 setSubPartT<Pel>( singleDepthValue, m_apSingleDepthValue, uiAbsPartIdx, uiDepth, uiPUIdx );2509 }2510 #endif2511 1823 Void TComDataCU::setPredModeSubParts( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ) 2512 1824 { … … 2662 1974 } 2663 1975 2664 #if H_3D_DIM_SDC2665 Void TComDataCU::setSDCFlagSubParts ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiDepth )2666 {2667 assert( sizeof( *m_pbSDCFlag) == 1 );2668 memset( m_pbSDCFlag + uiAbsPartIdx, bSDCFlag, m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ) );2669 }2670 2671 Bool TComDataCU::getSDCAvailable( UInt uiAbsPartIdx )2672 {2673 // check general CU information2674 if( !getSlice()->getIsDepth() || !isIntra(uiAbsPartIdx) || getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N )2675 {2676 return false;2677 }2678 2679 #if HS_DMM_SIGNALLING_I01202680 if( isDimMode( getLumaIntraDir( uiAbsPartIdx ) ) )2681 #else2682 if( isDimMode( getLumaIntraDir( uiAbsPartIdx ) ) && !isDimDeltaDC( getLumaIntraDir( uiAbsPartIdx ) ) )2683 #endif2684 {2685 return true;2686 }2687 2688 if( getLumaIntraDir( uiAbsPartIdx ) < NUM_INTRA_MODE )2689 {2690 return true;2691 }2692 2693 return false;2694 // check prediction mode2695 UInt uiLumaPredMode = getLumaIntraDir( uiAbsPartIdx );2696 #if HS_DMM_SIGNALLING_I01202697 if( uiLumaPredMode == PLANAR_IDX || ( getDimType( uiLumaPredMode ) == DMM1_IDX ) )2698 #else2699 if( uiLumaPredMode == PLANAR_IDX || ( getDimType( uiLumaPredMode ) == DMM1_IDX && !isDimDeltaDC( uiLumaPredMode ) ) )2700 #endif2701 return true;2702 2703 // else2704 return false;2705 }2706 #endif2707 1976 Void TComDataCU::setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2708 1977 { … … 2715 1984 } 2716 1985 2717 #if H_3D_SPIVMP 2718 Void TComDataCU::setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2719 { 2720 setSubPart<Bool>( bSPIVMPFlag, m_pbSPIVMPFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); 2721 } 2722 #endif 2723 2724 #if H_3D_VSP 2725 Void TComDataCU::setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2726 { 2727 setSubPart<Char>( iVSPFlag, m_piVSPFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); 2728 } 2729 #if H_3D_VSP 2730 template<typename T> 2731 Void TComDataCU::setSubPartT( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ) 2732 { 2733 UInt uiCurrPartNumQ = (m_pcPic->getNumPartInCU() >> (2 * uiCUDepth)) >> 2; 2734 switch ( m_pePartSize[ uiCUAddr ] ) 2735 { 2736 case SIZE_2Nx2N: 2737 for (UInt ui = 0; ui < 4 * uiCurrPartNumQ; ui++) 2738 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2739 2740 break; 2741 case SIZE_2NxN: 2742 for (UInt ui = 0; ui < 2 * uiCurrPartNumQ; ui++) 2743 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2744 break; 2745 case SIZE_Nx2N: 2746 for (UInt ui = 0; ui < uiCurrPartNumQ; ui++) 2747 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2748 for (UInt ui = 0; ui < uiCurrPartNumQ; ui++) 2749 puhBaseLCU[uiCUAddr + 2 * uiCurrPartNumQ + ui] = uiParameter; 2750 break; 2751 case SIZE_NxN: 2752 for (UInt ui = 0; ui < uiCurrPartNumQ; ui++) 2753 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2754 break; 2755 case SIZE_2NxnU: 2756 if ( uiPUIdx == 0 ) 2757 { 2758 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) 2759 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2760 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) 2761 puhBaseLCU[uiCUAddr + uiCurrPartNumQ + ui] = uiParameter; 2762 2763 } 2764 else if ( uiPUIdx == 1 ) 2765 { 2766 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) 2767 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2768 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1) + (uiCurrPartNumQ << 1); ui++) 2769 puhBaseLCU[uiCUAddr + uiCurrPartNumQ + ui] = uiParameter; 2770 2771 } 2772 else 2773 { 2774 assert(0); 2775 } 2776 break; 2777 case SIZE_2NxnD: 2778 if ( uiPUIdx == 0 ) 2779 { 2780 for (UInt ui = 0; ui < ((uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1)); ui++) 2781 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2782 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) 2783 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + uiCurrPartNumQ + ui] = uiParameter; 2784 2785 } 2786 else if ( uiPUIdx == 1 ) 2787 { 2788 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) 2789 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2790 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) 2791 puhBaseLCU[uiCUAddr + uiCurrPartNumQ + ui] = uiParameter; 2792 2793 } 2794 else 2795 { 2796 assert(0); 2797 } 2798 break; 2799 case SIZE_nLx2N: 2800 if ( uiPUIdx == 0 ) 2801 { 2802 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2803 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2804 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2805 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ >> 1) + ui] = uiParameter; 2806 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2807 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + ui] = uiParameter; 2808 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2809 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1) + ui] = uiParameter; 2810 2811 } 2812 else if ( uiPUIdx == 1 ) 2813 { 2814 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2815 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2816 for (UInt ui = 0; ui < (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)); ui++) 2817 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ >> 1) + ui] = uiParameter; 2818 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2819 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + ui] = uiParameter; 2820 for (UInt ui = 0; ui < (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)); ui++) 2821 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1) + ui] = uiParameter; 2822 2823 } 2824 else 2825 { 2826 assert(0); 2827 } 2828 break; 2829 case SIZE_nRx2N: 2830 if ( uiPUIdx == 0 ) 2831 { 2832 for (UInt ui = 0; ui < (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)); ui++) 2833 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2834 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2835 puhBaseLCU[uiCUAddr + uiCurrPartNumQ + (uiCurrPartNumQ >> 1) + ui] = uiParameter; 2836 for (UInt ui = 0; ui < (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)); ui++) 2837 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + ui] = uiParameter; 2838 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2839 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + uiCurrPartNumQ + (uiCurrPartNumQ >> 1) + ui] = uiParameter; 2840 2841 } 2842 else if ( uiPUIdx == 1 ) 2843 { 2844 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2845 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2846 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2847 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ >> 1) + ui] = uiParameter; 2848 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2849 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + ui] = uiParameter; 2850 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2851 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1) + ui] = uiParameter; 2852 2853 } 2854 else 2855 { 2856 assert(0); 2857 } 2858 break; 2859 default: 2860 assert( 0 ); 2861 } 2862 2863 } 2864 #endif 2865 #endif 1986 2866 1987 Void TComDataCU::setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ) 2867 1988 { … … 2938 2059 } 2939 2060 2940 #if H_3D_IC2941 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx, Bool bLCU)2942 {2943 UInt uiNumPartition = bLCU ? (getWidth(uiAbsPartIdx)*getHeight(uiAbsPartIdx) >> 4) : m_uiNumPartition;2944 UInt uiTmpAbsPartIdx = bLCU ? uiAbsPartIdx : 0;2945 2946 switch ( m_pePartSize[uiTmpAbsPartIdx] )2947 {2948 case SIZE_2NxN:2949 riWidth = getWidth( uiTmpAbsPartIdx ); riHeight = getHeight( uiTmpAbsPartIdx ) >> 1; ruiPartAddr = ( uiPartIdx == 0 )? 0 : uiNumPartition >> 1;2950 break;2951 case SIZE_Nx2N:2952 riWidth = getWidth( uiTmpAbsPartIdx ) >> 1; riHeight = getHeight( uiTmpAbsPartIdx ); ruiPartAddr = ( uiPartIdx == 0 )? 0 : uiNumPartition >> 2;2953 break;2954 case SIZE_NxN:2955 riWidth = getWidth( uiTmpAbsPartIdx ) >> 1; riHeight = getHeight( uiTmpAbsPartIdx ) >> 1; ruiPartAddr = ( uiNumPartition >> 2 ) * uiPartIdx;2956 break;2957 case SIZE_2NxnU:2958 riWidth = getWidth( uiTmpAbsPartIdx );2959 riHeight = ( uiPartIdx == 0 ) ? getHeight( uiTmpAbsPartIdx ) >> 2 : ( getHeight( uiTmpAbsPartIdx ) >> 2 ) + ( getHeight( uiTmpAbsPartIdx ) >> 1 );2960 ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : uiNumPartition >> 3;2961 break;2962 case SIZE_2NxnD:2963 riWidth = getWidth( uiTmpAbsPartIdx );2964 riHeight = ( uiPartIdx == 0 ) ? ( getHeight( uiTmpAbsPartIdx ) >> 2 ) + ( getHeight( uiTmpAbsPartIdx ) >> 1 ) : getHeight( uiTmpAbsPartIdx ) >> 2;2965 ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (uiNumPartition >> 1) + (uiNumPartition >> 3);2966 break;2967 case SIZE_nLx2N:2968 riWidth = ( uiPartIdx == 0 ) ? getWidth( uiTmpAbsPartIdx ) >> 2 : ( getWidth( uiTmpAbsPartIdx ) >> 2 ) + ( getWidth( uiTmpAbsPartIdx ) >> 1 );2969 riHeight = getHeight( uiTmpAbsPartIdx );2970 ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : uiNumPartition >> 4;2971 break;2972 case SIZE_nRx2N:2973 riWidth = ( uiPartIdx == 0 ) ? ( getWidth( uiTmpAbsPartIdx ) >> 2 ) + ( getWidth( uiTmpAbsPartIdx ) >> 1 ) : getWidth( uiTmpAbsPartIdx ) >> 2;2974 riHeight = getHeight( uiTmpAbsPartIdx );2975 ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (uiNumPartition >> 2) + (uiNumPartition >> 4);2976 break;2977 default:2978 assert ( m_pePartSize[uiTmpAbsPartIdx] == SIZE_2Nx2N );2979 riWidth = getWidth( uiTmpAbsPartIdx ); riHeight = getHeight( uiTmpAbsPartIdx ); ruiPartAddr = 0;2980 break;2981 }2982 }2983 #else2984 2061 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) 2985 2062 { … … 3021 2098 } 3022 2099 } 3023 #endif3024 2100 3025 2101 … … 3292 2368 } 3293 2369 3294 #if H_3D_VSP 3295 3296 /** Add a VSP merging candidate 3297 * \Inputs 3298 * \param uiPUIdx: PU index within a CU 3299 * \param ucVspMergePos: Specify the VSP merge candidate position 3300 * \param mrgCandIdx: Target merge candidate index. At encoder, it is set equal to -1, such that the whole merge candidate list will be constructed. 3301 * \param pDinfo: The "disparity information" derived from neighboring blocks. Type 1 MV. 3302 * \param uiCount: The next position to add VSP merge candidate 3303 * 3304 * \Outputs 3305 * \param uiCount: The next position to add merge candidate. Will be updated if VSP is successfully added 3306 * \param abCandIsInter: abCandIsInter[iCount] tells that VSP candidate is an Inter candidate, if VSP is successfully added 3307 * \param pcMvFieldNeighbours: Return combined motion information, then stored to a global buffer 3308 * 1) the "disparity vector". Type 1 MV. To be used to fetch a depth block. 3309 * 2) the ref index /list. Type 2 reference picture pointer, typically for texture 3310 * \param puhInterDirNeighbours: Indicate the VSP prediction direction. 3311 * \param vspFlag: vspFlag[iCount] will be set (equal to 1), if VSP is successfully added. To be used to indicate the actual position of the VSP candidate 3312 * 3313 * \Return 3314 * true: if the VSP candidate is added at the target position 3315 * false: otherwise 3316 */ 3317 inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount) 3318 { 3319 if ( m_pcSlice->getViewIndex() == 0 || !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) || m_pcSlice->getIsDepth() || pDInfo->m_aVIdxCan == -1) 3320 { 3321 return false; 3322 } 3323 3324 Int refViewIdx = pDInfo->m_aVIdxCan; 3325 TComPic* picDepth = getSlice()->getIvPic( true, refViewIdx ); 3326 3327 if( picDepth == NULL ) // No depth reference avail 3328 { 3329 // Is this allowed to happen? When not an assertion should be added here! 3330 return false; 3331 } 3332 3333 TComMvField mvVSP[2]; 3334 UChar dirVSP; 3335 Bool refViewAvailFlag = false; 3336 UChar predFlag[2] = {0, 0}; 3337 3338 for( Int iRefListIdX = 0; iRefListIdX < 2 && !refViewAvailFlag; iRefListIdX++ ) 3339 { 3340 RefPicList eRefPicListX = RefPicList( iRefListIdX ); 3341 for ( Int i = 0; i < m_pcSlice->getNumRefIdx(eRefPicListX) && !refViewAvailFlag; i++ ) 3342 { 3343 Int viewIdxRefInListX = m_pcSlice->getRefPic(eRefPicListX, i)->getViewIndex(); 3344 if ( viewIdxRefInListX == refViewIdx ) 3345 { 3346 refViewAvailFlag = true; 3347 predFlag[iRefListIdX] = 1; 3348 mvVSP[0+iRefListIdX].setMvField( pDInfo->m_acNBDV, i ); 3349 #if H_3D_NBDV 3350 mvVSP[0+iRefListIdX].getMv().setIDVFlag (false); 3351 #endif 3352 } 3353 } 3354 } 3355 3356 dirVSP = (predFlag[0] | (predFlag[1] << 1)); 3357 m_mergCands[MRG_VSP].setCand( mvVSP, dirVSP, true, false); 3358 if ( mrgCandIdx == iCount ) 3359 { 3360 return true; 3361 } 3362 3363 iCount++; 3364 3365 return false; 3366 } 3367 3368 #endif 3369 3370 #if H_3D_IV_MERGE 3371 inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Int* ivCandDir, TComMv* ivCandMv, Int* ivCandRefIdx ) 3372 { 3373 for(Int iLoop = 0; iLoop < 2; iLoop ++ ) 3374 { 3375 #if !SEC_SIMP_SHIFTED_DV_I0086 3376 // IvDcShift (Derived from spatial Iv neighboring blocks) 3377 if( iLoop == 1 ) 3378 { 3379 Int iFirDispCand = -1; 3380 TComMvField mvIvDcShift[2]; 3381 UChar dirIvDcShift; 3382 3383 if (xGetPosFirstAvailDmvCand(MRG_IVSHIFT, iFirDispCand)) 3384 { 3385 TComMv cMv; 3386 cMv = m_mergCands[iFirDispCand].m_cMvField[0].getMv(); 3387 cMv.setHor(cMv.getHor()+4); 3388 if(m_pcSlice->getVPS()->getViewSynthesisPredFlag(m_pcSlice->getLayerIdInVps())) 3389 { 3390 cMv.setVer(0); 3391 } 3392 #if !(NTT_BUG_FIX_TK54) 3393 clipMv( cMv ); 3394 #endif 3395 3396 dirIvDcShift = m_mergCands[iFirDispCand].m_uDir; 3397 mvIvDcShift[0].setMvField(cMv, m_mergCands[iFirDispCand].m_cMvField[0].getRefIdx() ); 3398 mvIvDcShift[1].setMvField(m_mergCands[iFirDispCand].m_cMvField[1].getMv(), m_mergCands[iFirDispCand].m_cMvField[1].getRefIdx() ); 3399 m_mergCands[MRG_IVSHIFT].setCand(mvIvDcShift, dirIvDcShift, false, false); 3400 3401 if( mrgCandIdx == iCount ) 3402 { 3403 return true; 3404 } 3405 iCount++; 3406 break; 3407 } 3408 } 3409 #endif 3410 3411 /// iLoop = 0 --> IvMCShift 3412 /// iLoop = 1 --> IvDCShift (Derived from IvDC) 3413 if(ivCandDir[iLoop + 2]) 3414 { 3415 TComMvField tmpMV[2]; 3416 UChar tmpDir = ivCandDir[iLoop + 2]; 3417 if( ( ivCandDir[iLoop + 2] & 1 ) == 1 ) 3418 { 3419 tmpMV[0].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] ); 3420 } 3421 if( ( ivCandDir[iLoop + 2] & 2 ) == 2 ) 3422 { 3423 tmpMV[1].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] ); 3424 } 3425 3426 // Prune IvMC vs. IvMcShift 3427 Bool bRemove = false; 3428 if( !iLoop && ivCandDir[0] > 0) 3429 { 3430 if(tmpDir == m_mergCands[MRG_IVMC].m_uDir && m_mergCands[MRG_IVMC].m_cMvField[0]==tmpMV[0] && m_mergCands[MRG_IVMC].m_cMvField[1]==tmpMV[1]) 3431 { 3432 bRemove = true; 3433 } 3434 } 3435 if(!bRemove) 3436 { 3437 #if H_3D_NBDV 3438 if(iLoop) // For IvMcShift candidate 3439 { 3440 tmpMV[0].getMv().setIDVFlag (false); 3441 tmpMV[1].getMv().setIDVFlag (false); 3442 } 3443 #endif 3444 m_mergCands[MRG_IVSHIFT].setCand(tmpMV, tmpDir, false, false); 3445 if( mrgCandIdx == iCount ) 3446 { 3447 return true; 3448 } 3449 iCount++; 3450 } 3451 break; 3452 } 3453 } 3454 return false; 3455 } 3456 3457 #if !SEC_SIMP_SHIFTED_DV_I0086 3458 inline Bool TComDataCU::xGetPosFirstAvailDmvCand(Int iCount, Int& posFirstAvailDmvCand ) 3459 { 3460 for ( Int currListPos = 0; currListPos < iCount; currListPos++ ) 3461 { 3462 if ( !m_mergCands[currListPos].m_bAvailable || ( currListPos == MRG_IVMC ) || ( currListPos == MRG_IVDC ) || ( m_mergCands[currListPos].m_iVspFlag != 0 )) 3463 { 3464 continue; 3465 } 3466 else if((m_mergCands[currListPos].m_bAvailable) && (m_mergCands[currListPos].m_cMvField[0].getRefIdx() != -1 ) && (getSlice()->getViewIndex() != getSlice()->getRefPic(RefPicList(0), m_mergCands[currListPos].m_cMvField[0].getRefIdx())->getViewIndex())) 3467 { 3468 posFirstAvailDmvCand = currListPos; 3469 return true; 3470 } 3471 } 3472 return false; 3473 } 3474 #endif 3475 3476 #endif 3477 3478 #if H_3D 3479 Void TComDataCU::buildMCL(TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours 3480 #if H_3D_VSP 3481 , Int* vspFlag 3482 #endif 3483 #if H_3D_SPIVMP 3484 , Bool* pbSPIVMPFlag 3485 #endif 3486 , Int& numValidMergeCand 3487 ) 3488 { 3489 if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0)) // for only dependent texture 3490 { 3491 return; 3492 } 3493 3494 Int iCount = 0; 3495 TComMv cZeroMv; 3496 3497 // init temporal list 3498 TComMvField extMergeCandList[MRG_MAX_NUM_CANDS_MEM << 1]; 3499 UChar uhInterDirNeighboursExt[MRG_MAX_NUM_CANDS_MEM]; 3500 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui ) 3501 { 3502 uhInterDirNeighboursExt[ui] = puhInterDirNeighbours[ui]; 3503 extMergeCandList[ui<<1].setMvField(cZeroMv, NOT_VALID); 3504 extMergeCandList[(ui<<1)+1].setMvField(cZeroMv, NOT_VALID); 3505 vspFlag[ui] = 0; 3506 } 3507 3508 // add candidates to temporal list 3509 // insert MPI ... IvShift candidate 3510 for (Int i=0; i<=MRG_IVSHIFT; i++) 3511 { 3512 if (m_mergCands[i].m_bAvailable) 3513 { 3514 m_mergCands[i].getCand(iCount, extMergeCandList, uhInterDirNeighboursExt, vspFlag, pbSPIVMPFlag); 3515 iCount++; 3516 if (iCount >= getSlice()->getMaxNumMergeCand()) 3517 break; 3518 } 3519 } 3520 3521 // insert remaining base candidates 3522 while (iCount < getSlice()->getMaxNumMergeCand() && m_baseListidc < getSlice()->getMaxNumMergeCand()) 3523 { 3524 uhInterDirNeighboursExt[iCount] = puhInterDirNeighbours[m_baseListidc]; 3525 extMergeCandList[iCount<<1].setMvField(pcMvFieldNeighbours[m_baseListidc<<1].getMv(), pcMvFieldNeighbours[m_baseListidc<<1].getRefIdx()); 3526 if ( getSlice()->isInterB() ) 3527 { 3528 extMergeCandList[(iCount<<1)+1].setMvField(pcMvFieldNeighbours[(m_baseListidc<<1)+1].getMv(), pcMvFieldNeighbours[(m_baseListidc<<1)+1].getRefIdx()); 3529 } 3530 m_baseListidc++; 3531 iCount++; 3532 } 3533 3534 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ui++ ) 3535 { 3536 puhInterDirNeighbours[ui] = 0; 3537 pcMvFieldNeighbours[ui<<1].setMvField(cZeroMv, NOT_VALID); 3538 pcMvFieldNeighbours[(ui<<1)+1].setMvField(cZeroMv, NOT_VALID); 3539 } 3540 // copy extMergeCandList to output 3541 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ui++ ) 3542 { 3543 puhInterDirNeighbours[ui] = uhInterDirNeighboursExt[ui]; 3544 pcMvFieldNeighbours[ui<<1].setMvField(extMergeCandList[ui<<1].getMv(), extMergeCandList[ui<<1].getRefIdx()); 3545 if ( getSlice()->isInterB() ) 3546 pcMvFieldNeighbours[(ui<<1)+1].setMvField(extMergeCandList[(ui<<1)+1].getMv(), extMergeCandList[(ui<<1)+1].getRefIdx()); 3547 } 3548 numValidMergeCand = iCount; 3549 assert(iCount == getSlice()->getMaxNumMergeCand()); 3550 } 2370 2371 3551 2372 3552 2373 /** Constructs a list of merging candidates … … 3558 2379 * \param numValidMergeCand 3559 2380 */ 3560 // HM 12.0 based merge candidate list construction 3561 3562 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) 3563 { 3564 2381 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours 2382 , Int& numValidMergeCand, Int mrgCandIdx 2383 ) 2384 { 3565 2385 UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx; 3566 Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ]; 3567 TComMv cZeroMv; 2386 Bool abCandIsInter[ MRG_MAX_NUM_CANDS ]; 3568 2387 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui ) 3569 2388 { 3570 2389 abCandIsInter[ui] = false; 3571 pcMvFieldNeighbours[ ( ui << 1 ) ].set MvField(cZeroMv,NOT_VALID);3572 pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].set MvField(cZeroMv,NOT_VALID);2390 pcMvFieldNeighbours[ ( ui << 1 ) ].setRefIdx(NOT_VALID); 2391 pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID); 3573 2392 } 3574 2393 numValidMergeCand = getSlice()->getMaxNumMergeCand(); … … 3589 2408 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 3590 2409 Bool isAvailableA1 = pcCULeft && 3591 pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) &&3592 !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) &&3593 !pcCULeft->isIntra( uiLeftPartIdx ) ;2410 pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) && 2411 !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) && 2412 !pcCULeft->isIntra( uiLeftPartIdx ) ; 3594 2413 if ( isAvailableA1 ) 3595 2414 { 3596 m_bAvailableFlagA1 = 1;3597 2415 abCandIsInter[iCount] = true; 3598 2416 // get Inter Dir … … 3604 2422 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3605 2423 } 3606 2424 if ( mrgCandIdx == iCount ) 2425 { 2426 return; 2427 } 3607 2428 iCount ++; 3608 2429 } … … 3613 2434 return; 3614 2435 } 2436 3615 2437 // above 3616 2438 UInt uiAbovePartIdx = 0; … … 3623 2445 if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) ) 3624 2446 { 3625 m_bAvailableFlagB1 = 1;3626 2447 abCandIsInter[iCount] = true; 3627 2448 // get Inter Dir … … 3633 2454 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3634 2455 } 2456 3635 2457 if ( mrgCandIdx == iCount ) 3636 2458 { … … 3644 2466 return; 3645 2467 } 2468 3646 2469 3647 2470 // above right … … 3654 2477 if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) ) 3655 2478 { 3656 m_bAvailableFlagB0 = 1;3657 2479 abCandIsInter[iCount] = true; 3658 2480 // get Inter Dir … … 3685 2507 if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) ) 3686 2508 { 3687 m_bAvailableFlagA0 = 1;3688 2509 abCandIsInter[iCount] = true; 3689 2510 // get Inter Dir … … 3695 2516 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3696 2517 } 2518 3697 2519 if ( mrgCandIdx == iCount ) 3698 2520 { … … 3706 2528 return; 3707 2529 } 2530 3708 2531 // above left 3709 2532 if( iCount < 4 ) … … 3718 2541 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) ) 3719 2542 { 3720 m_bAvailableFlagB2 = 1;3721 2543 abCandIsInter[iCount] = true; 3722 2544 // get Inter Dir … … 3740 2562 return; 3741 2563 } 3742 if ( getSlice()->getEnableTMVPFlag()) 3743 { 3744 //>> MTK colocated-RightBottom 3745 UInt uiPartIdxRB; 3746 3747 deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); 3748 3749 UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB]; 3750 UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); 3751 3752 TComMv cColMv; 3753 Int iRefIdx; 3754 Int uiLCUIdx = -1; 3755 3756 if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check 3757 { 3758 } 3759 else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) 3760 { 3761 } 3762 else 3763 { 3764 if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU 3765 ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU 3766 { 3767 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ]; 3768 uiLCUIdx = getAddr(); 3769 } 3770 else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU 3771 { 3772 uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; 3773 } 3774 else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU 3775 { 3776 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ]; 3777 uiLCUIdx = getAddr() + 1; 3778 } 3779 else //is the right bottom corner of LCU 3780 { 3781 uiAbsPartAddr = 0; 3782 } 3783 } 3784 3785 iRefIdx = 0; 3786 Bool bExistMV = false; 3787 UInt uiPartIdxCenter; 3788 UInt uiCurLCUIdx = getAddr(); 3789 Int dir = 0; 3790 UInt uiArrayAddr = iCount; 3791 xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter ); 3792 bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx ); 3793 if( bExistMV == false ) 3794 { 3795 bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); 3796 } 3797 if( bExistMV ) 3798 { 3799 dir |= 1; 3800 pcMvFieldNeighbours[ 2 * uiArrayAddr ].setMvField( cColMv, iRefIdx ); 3801 } 3802 3803 if ( getSlice()->isInterB() ) 3804 { 3805 #if H_3D_TMVP 3806 iRefIdx = 0; 3807 #endif 3808 bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx); 3809 if( bExistMV == false ) 3810 { 3811 bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); 3812 } 3813 if( bExistMV ) 3814 { 3815 dir |= 2; 3816 pcMvFieldNeighbours[ 2 * uiArrayAddr + 1 ].setMvField( cColMv, iRefIdx ); 3817 } 3818 } 3819 3820 if (dir != 0) 3821 { 3822 puhInterDirNeighbours[uiArrayAddr] = dir; 3823 abCandIsInter[uiArrayAddr] = true; 3824 #if H_3D_NBDV 3825 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 3826 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 3827 #endif 3828 if ( mrgCandIdx == iCount ) 3829 { 3830 return; 3831 } 3832 iCount++; 3833 } 3834 } 3835 // early termination 3836 if (iCount == getSlice()->getMaxNumMergeCand()) 3837 { 3838 return; 3839 } 3840 UInt uiArrayAddr = iCount; 3841 UInt uiCutoff = uiArrayAddr; 3842 3843 if ( getSlice()->isInterB() && iCount<5) // JCT3V-F0129 by Qualcomm 3844 { 3845 UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3}; 3846 UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2}; 3847 3848 for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++) 3849 { 3850 Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx]; 3851 if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)) 3852 { 3853 abCandIsInter[uiArrayAddr] = true; 3854 puhInterDirNeighbours[uiArrayAddr] = 3; 3855 3856 // get Mv from cand[i] and cand[j] 3857 pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx()); 3858 pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx()); 3859 3860 Int iRefPOCL0 = m_pcSlice->getRefPOC( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() ); 3861 Int iRefPOCL1 = m_pcSlice->getRefPOC( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() ); 3862 if (iRefPOCL0 == iRefPOCL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv()) 3863 { 3864 abCandIsInter[uiArrayAddr] = false; 3865 } 3866 else 3867 { 3868 uiArrayAddr++; 3869 } 3870 } 3871 } 3872 } 3873 // early termination 3874 if (uiArrayAddr == getSlice()->getMaxNumMergeCand()) 3875 { 3876 return; 3877 } 3878 3879 Int iNumRefIdx = (getSlice()->isInterB()) ? min(m_pcSlice->getNumRefIdx(REF_PIC_LIST_0), m_pcSlice->getNumRefIdx(REF_PIC_LIST_1)) : m_pcSlice->getNumRefIdx(REF_PIC_LIST_0); 3880 Int r = 0; 3881 Int refcnt = 0; 3882 while (uiArrayAddr < getSlice()->getMaxNumMergeCand()) 3883 { 3884 abCandIsInter[uiArrayAddr] = true; 3885 puhInterDirNeighbours[uiArrayAddr] = 1; 3886 pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r); 3887 3888 if ( getSlice()->isInterB() ) 3889 { 3890 puhInterDirNeighbours[uiArrayAddr] = 3; 3891 pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r); 3892 } 3893 uiArrayAddr++; 3894 if ( refcnt == iNumRefIdx - 1 ) 3895 { 3896 r = 0; 3897 } 3898 else 3899 { 3900 ++r; 3901 ++refcnt; 3902 } 3903 } 3904 3905 numValidMergeCand = uiArrayAddr; 3906 } 3907 3908 3909 3910 /** Constructs a list of merging candidates 3911 * \param uiAbsPartIdx 3912 * \param uiPUIdx 3913 * \param uiDepth 3914 * \param pcMvFieldNeighbours 3915 * \param puhInterDirNeighbours 3916 * \param numValidMergeCand 3917 */ 3918 #if H_3D 3919 Void TComDataCU::xGetInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours 3920 #else 3921 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours 3922 #endif 3923 #if H_3D_VSP && !FIX_TICKET_79 3924 , InheritedVSPDisInfo* inheritedVSPDisInfo 3925 #endif 3926 #if H_3D_SPIVMP 3927 , TComMvField* pcMvFieldSP, UChar* puhInterDirSP 3928 #endif 3929 , Int& numValidMergeCand, Int mrgCandIdx 3930 ) 3931 { 3932 UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx; 3933 #if H_3D_IV_MERGE 3934 //////////////////////////// 3935 //////// INIT LISTS //////// 3936 //////////////////////////// 3937 TComMv cZeroMv; 3938 #else 3939 Bool abCandIsInter[ MRG_MAX_NUM_CANDS ]; 3940 #endif 3941 #if H_3D 3942 TComMvField tmpMV[2]; 3943 UChar tmpDir; 3944 3945 #if H_3D_DDD 3946 m_iUseDDDCandIdx = -1; 3947 #endif 3948 3949 ////////////////////////////////// 3950 //////// GET DISPARITIES //////// 3951 ////////////////////////////////// 3952 DisInfo cDisInfo = getDvInfo(uiAbsPartIdx); 3953 #if !FIX_TICKET_79 3954 for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++) 3955 { 3956 inheritedVSPDisInfo[i].m_acDvInfo = cDisInfo; // To prevent run-time error, this code must be executed always for merging process. 3957 } 3958 #endif 3959 m_cDefaultDisInfo = cDisInfo; 3960 3961 if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0)) // current slice is not both dependent view or depth 3962 { 3963 return; 3964 } 3965 #else 3966 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui ) 3967 { 3968 abCandIsInter[ui] = false; 3969 pcMvFieldNeighbours[ ( ui << 1 ) ].setRefIdx(NOT_VALID); 3970 pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID); 3971 } 3972 #endif 3973 3974 numValidMergeCand = getSlice()->getMaxNumMergeCand(); 3975 #if H_3D 3976 ////////////////////////////////// 3977 //////// DERIVE LOCATIONS //////// 3978 ////////////////////////////////// 3979 #endif 3980 // compute the location of the current PU 3981 Int xP, yP, nPSW, nPSH; 3982 this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH); 3983 3984 Int iCount = 0; 3985 3986 UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 3987 #if !H_3D 3988 PartSize cCurPS = getPartitionSize( uiAbsPartIdx ); 3989 #endif 3990 deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT ); 3991 deriveLeftBottomIdxGeneral ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB ); 3992 #if H_3D 3993 Bool bMPIFlag = getSlice()->getVPS()->getMPIFlag( getSlice()->getLayerIdInVps() ); 3994 Bool bIsDepth = getSlice()->getIsDepth(); 3995 #endif 3996 3997 #if H_3D_IC 3998 Bool bICFlag = getICFlag(uiAbsPartIdx); 3999 #endif 4000 #if H_3D_ARP 4001 Bool bARPFlag = getARPW(uiAbsPartIdx)>0 ? true : false; 4002 #endif 4003 #if H_3D_DBBP 4004 Bool bDBBPFlag = getDBBPFlag(uiAbsPartIdx); 4005 assert(bDBBPFlag == getDBBPFlag(0)); 4006 #endif 4007 4008 #if H_3D 4009 #if H_3D_NBDV 4010 for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++) 4011 { 4012 pcMvFieldNeighbours[i<<1 ].getMv().setIDVFlag (false); 4013 pcMvFieldNeighbours[(i<<1)+1].getMv().setIDVFlag (false); 4014 } 4015 #endif 4016 // Clean version for MCL construction align with WD 4017 // init mergCands list 4018 for (Int i = 0; i<MRG_IVSHIFT+1; i++) 4019 { 4020 m_mergCands[i].init(); 4021 } 4022 4023 m_baseListidc = 0; 4024 4025 //left 4026 UInt uiLeftPartIdx = 0; 4027 TComDataCU* pcCULeft = 0; 4028 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 4029 4030 if (getAvailableFlagA1()) 4031 { 4032 m_mergCands[MRG_A1].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc] 4033 #if H_3D_VSP 4034 , 4035 (pcCULeft->getVSPFlag(uiLeftPartIdx) != 0 4036 #if H_3D_IC 4037 && !bICFlag 4038 #endif 4039 #if H_3D_ARP 4040 && !bARPFlag 4041 #endif 4042 #if H_3D_DBBP 4043 && !bDBBPFlag 4044 #endif 4045 ) 4046 #endif 4047 , false 4048 ); 4049 m_baseListidc++; 4050 } 4051 4052 // above 4053 UInt uiAbovePartIdx = 0; 4054 TComDataCU* pcCUAbove = 0; 4055 pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); 4056 4057 if (getAvailableFlagB1()) 4058 { 4059 m_mergCands[MRG_B1].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc] 4060 #if H_3D_VSP 4061 , 4062 ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) != 0) 4063 #if H_3D_IC 4064 && !bICFlag 4065 #endif 4066 #if H_3D_ARP 4067 && !bARPFlag 4068 #endif 4069 #if H_3D_DBBP 4070 && !bDBBPFlag 4071 #endif 4072 ) 4073 #endif 4074 , false 4075 ); 4076 m_baseListidc++; 4077 } 4078 4079 // above right 4080 UInt uiAboveRightPartIdx = 0; 4081 TComDataCU* pcCUAboveRight = 0; 4082 pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); 4083 4084 if (getAvailableFlagB0()) 4085 { 4086 m_mergCands[MRG_B0].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc] 4087 #if H_3D_VSP 4088 , 4089 ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) != 0) 4090 #if H_3D_IC 4091 && !bICFlag 4092 #endif 4093 #if H_3D_ARP 4094 && !bARPFlag 4095 #endif 4096 #if H_3D_DBBP 4097 && !bDBBPFlag 4098 #endif 4099 ) 4100 #endif 4101 , false 4102 ); 4103 m_baseListidc++; 4104 } 4105 4106 // left bottom 4107 UInt uiLeftBottomPartIdx = 0; 4108 TComDataCU* pcCULeftBottom = getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); 4109 4110 if (getAvailableFlagA0()) 4111 { 4112 m_mergCands[MRG_A0].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc] 4113 #if H_3D_VSP 4114 , 4115 (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) != 0 4116 #if H_3D_IC 4117 && !bICFlag 4118 #endif 4119 #if H_3D_ARP 4120 && !bARPFlag 4121 #endif 4122 #if H_3D_DBBP 4123 && !bDBBPFlag 4124 #endif 4125 ) 4126 #endif 4127 , false 4128 ); 4129 m_baseListidc++; 4130 } 4131 4132 // above left 4133 UInt uiAboveLeftPartIdx = 0; 4134 TComDataCU* pcCUAboveLeft = 0; 4135 pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); 4136 4137 if (getAvailableFlagB2()) 4138 { 4139 m_mergCands[MRG_B2].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc] 4140 #if H_3D_VSP 4141 , 4142 ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) != 0) 4143 #if H_3D_IC 4144 && !bICFlag 4145 #endif 4146 #if H_3D_ARP 4147 && !bARPFlag 4148 #endif 4149 #if H_3D_DBBP 4150 && !bDBBPFlag 4151 #endif 4152 ) 4153 #endif 4154 , false 4155 ); 4156 m_baseListidc++; 4157 } 4158 4159 #endif 4160 4161 4162 #if H_3D_IV_MERGE 4163 4164 ///////////////////////////////////////////// 4165 //////// TEXTURE MERGE CANDIDATE (T) //////// 4166 ///////////////////////////////////////////// 4167 4168 bMPIFlag &= (nPSW + nPSH > 12); 4169 if( bMPIFlag) 4170 { 4171 tmpMV[0].setMvField( cZeroMv, NOT_VALID ); 4172 tmpMV[1].setMvField( cZeroMv, NOT_VALID ); 4173 tmpDir = 0; 4174 4175 Bool bSPIVMPFlag = false; 4176 4177 TComPic * pcTexPic = m_pcSlice->getTexturePic(); 4178 #if H_3D_FCO 4179 #if LGE_FCO_I0116 4180 if (pcTexPic && pcTexPic->getReconMark()) 4181 #else 4182 if (pcTexturePic->getReconMark()) 4183 #endif 4184 { 4185 #endif 4186 TComPicYuv* pcTexRec = pcTexPic->getPicYuvRec (); 4187 UInt uiPartAddr; 4188 Int iWidth, iHeight; 4189 Int iCurrPosX, iCurrPosY; 4190 4191 this->getPartIndexAndSize( uiPUIdx, uiPartAddr, iWidth, iHeight ); 4192 pcTexRec->getTopLeftSamplePos( this->getAddr(), this->getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY ); 4193 4194 Int iPUWidth, iPUHeight, iNumPart, iNumPartLine; 4195 this->getSPPara(iWidth, iHeight, iNumPart, iNumPartLine, iPUWidth, iPUHeight); 4196 4197 for (Int i=0; i<iNumPart; i++) 4198 { 4199 puhInterDirSP[i] = 0; 4200 pcMvFieldSP[2*i].getMv().set(0, 0); 4201 pcMvFieldSP[2*i+1].getMv().set(0, 0); 4202 pcMvFieldSP[2*i].setRefIdx(-1); 4203 pcMvFieldSP[2*i+1].setRefIdx(-1); 4204 } 4205 4206 Int iTexCUAddr; 4207 Int iTexAbsPartIdx; 4208 TComDataCU* pcTexCU; 4209 Int iPartition = 0; 4210 Int iInterDirSaved = 0; 4211 TComMvField cMvFieldSaved[2]; 4212 4213 Int iOffsetX = iPUWidth/2;; 4214 Int iOffsetY = iPUHeight/2; 4215 4216 Int iTexPosX, iTexPosY; 4217 const TComMv cMvRounding( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) ); 4218 4219 Int iCenterPosX = iCurrPosX + ( ( iWidth / iPUWidth ) >> 1 ) * iPUWidth + ( iPUWidth >> 1 ); 4220 Int iCenterPosY = iCurrPosY + ( ( iHeight / iPUHeight ) >> 1 ) * iPUHeight + (iPUHeight >> 1); 4221 Int iTexCenterCUAddr, iTexCenterAbsPartIdx; 4222 4223 if(iWidth == iPUWidth && iHeight == iPUHeight) 4224 { 4225 iCenterPosX = iCurrPosX + (iWidth >> 1); 4226 iCenterPosY = iCurrPosY + (iHeight >> 1); 4227 } 4228 4229 // derivation of center motion parameters from the collocated texture CU 4230 4231 pcTexRec->getCUAddrAndPartIdx( iCenterPosX , iCenterPosY , iTexCenterCUAddr, iTexCenterAbsPartIdx ); 4232 TComDataCU* pcDefaultCU = pcTexPic->getCU( iTexCenterCUAddr ); 4233 4234 if( pcDefaultCU->getPredictionMode( iTexCenterAbsPartIdx ) != MODE_INTRA ) 4235 { 4236 for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ ) 4237 { 4238 RefPicList eCurrRefPicList = RefPicList( uiCurrRefListId ); 4239 4240 TComMvField cDefaultMvField; 4241 pcDefaultCU->getMvField( pcDefaultCU, iTexCenterAbsPartIdx, eCurrRefPicList, cDefaultMvField ); 4242 Int iDefaultRefIdx = cDefaultMvField.getRefIdx(); 4243 if (iDefaultRefIdx >= 0) 4244 { 4245 Int iDefaultRefPOC = pcDefaultCU->getSlice()->getRefPOC(eCurrRefPicList, iDefaultRefIdx); 4246 for (Int iRefPicList = 0; iRefPicList < m_pcSlice->getNumRefIdx( eCurrRefPicList ); iRefPicList++) 4247 { 4248 if (iDefaultRefPOC == m_pcSlice->getRefPOC(eCurrRefPicList, iRefPicList)) 4249 { 4250 bSPIVMPFlag = true; 4251 TComMv cMv = cDefaultMvField.getMv() + cMvRounding; 4252 cMv >>= 2; 4253 #if !FIX_TICKET_68 4254 clipMv( cMv ); 4255 #endif 4256 cMvFieldSaved[eCurrRefPicList].setMvField(cMv, iRefPicList) ; 4257 break; 4258 } 4259 } 4260 } 4261 } 4262 } 4263 if ( bSPIVMPFlag == true ) 4264 { 4265 iInterDirSaved = (cMvFieldSaved[0].getRefIdx()!=-1 ? 1: 0) + (cMvFieldSaved[1].getRefIdx()!=-1 ? 2: 0); 4266 tmpDir = iInterDirSaved; 4267 tmpMV[0] = cMvFieldSaved[0]; 4268 tmpMV[1] = cMvFieldSaved[1]; 4269 } 4270 4271 if ( iInterDirSaved != 0 ) 4272 { 4273 for (Int i=iCurrPosY; i < iCurrPosY + iHeight; i += iPUHeight) 4274 { 4275 for (Int j = iCurrPosX; j < iCurrPosX + iWidth; j += iPUWidth) 4276 { 4277 iTexPosX = j + iOffsetX; 4278 iTexPosY = i + iOffsetY; 4279 pcTexRec->getCUAddrAndPartIdx( iTexPosX, iTexPosY, iTexCUAddr, iTexAbsPartIdx ); 4280 pcTexCU = pcTexPic->getCU( iTexCUAddr ); 4281 4282 if( pcTexCU && !pcTexCU->isIntra(iTexAbsPartIdx) ) 4283 { 4284 for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ ) 4285 { 4286 RefPicList eCurrRefPicList = RefPicList( uiCurrRefListId ); 4287 TComMvField cTexMvField; 4288 pcTexCU->getMvField( pcTexCU, iTexAbsPartIdx, eCurrRefPicList, cTexMvField ); 4289 Int iValidDepRef = getPic()->isTextRefValid( eCurrRefPicList, cTexMvField.getRefIdx() ); 4290 if( (cTexMvField.getRefIdx()>=0) && ( iValidDepRef >= 0 ) ) 4291 { 4292 TComMv cMv = cTexMvField.getMv() + cMvRounding; 4293 cMv >>=2; 4294 #if !(NTT_BUG_FIX_TK54) 4295 this->clipMv( cMv ); 4296 #endif 4297 pcMvFieldSP[2*iPartition + uiCurrRefListId].setMvField(cMv, iValidDepRef); 4298 } 4299 } 4300 } 4301 puhInterDirSP[iPartition] = (pcMvFieldSP[2*iPartition].getRefIdx()!=-1 ? 1: 0) + (pcMvFieldSP[2*iPartition+1].getRefIdx()!=-1 ? 2: 0); 4302 if (puhInterDirSP[iPartition] == 0) 4303 { 4304 if (iInterDirSaved != 0) 4305 { 4306 puhInterDirSP[iPartition] = iInterDirSaved; 4307 pcMvFieldSP[2*iPartition] = cMvFieldSaved[0]; 4308 pcMvFieldSP[2*iPartition + 1] = cMvFieldSaved[1]; 4309 } 4310 } 4311 if (iPUHeight + iPUWidth == 12) 4312 { 4313 if (puhInterDirSP[iPartition] == 3) 4314 { 4315 puhInterDirSP[iPartition] = 1; 4316 pcMvFieldSP[2*iPartition + 1].setMvField(TComMv(0,0), -1); 4317 } 4318 } 4319 4320 iPartition ++; 4321 } 4322 } 4323 #if H_3D 4324 } 4325 #endif 4326 #if H_3D_FCO 4327 } 4328 #endif 4329 if( tmpDir != 0 ) 4330 { 4331 Int iCnloop = 0; 4332 for(iCnloop = 0; iCnloop < 2; iCnloop ++) 4333 { 4334 if ( !m_mergCands[MRG_A1+iCnloop].m_bAvailable ) // prunning to A1, B1 4335 { 4336 continue; 4337 } 4338 if (tmpDir == m_mergCands[MRG_A1+iCnloop].m_uDir && tmpMV[0]==m_mergCands[MRG_A1+iCnloop].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_A1+iCnloop].m_cMvField[1]) 4339 { 4340 m_mergCands[MRG_A1+iCnloop].m_bAvailable = false; 4341 break; 4342 } 4343 } 4344 m_mergCands[MRG_T].setCand( tmpMV, tmpDir, false, bSPIVMPFlag); 4345 4346 if ( mrgCandIdx == iCount ) 4347 { 4348 return; 4349 } 4350 iCount ++; 4351 } 4352 } 4353 #if H_3D_DDD 4354 if( m_pcSlice->getIsDepth() && m_pcSlice->getViewIndex() != 0 && bMPIFlag ) 4355 { 4356 UInt uiPartIdx; 4357 TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() ); 4358 TComSlice *pcTextureSlice = pcTextureCU->getSlice(); 4359 4360 4361 tmpMV[0].setMvField( cZeroMv, NOT_VALID ); 4362 tmpMV[1].setMvField( cZeroMv, NOT_VALID ); 4363 tmpDir = 0; 4364 4365 xDeriveCenterIdx( uiPUIdx, uiPartIdx); 4366 4367 if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdx ) ) 4368 { 4369 4370 TComMvField cMVField; 4371 Int iDV = 0; 4372 Int iViewIdx = 0; 4373 pcTextureCU->getMvField( pcTextureCU, uiPartIdx, REF_PIC_LIST_0, cMVField ); 4374 if( cMVField.getRefIdx() >= 0 ) 4375 { 4376 if( pcTextureSlice->getRefPOC( REF_PIC_LIST_0, cMVField.getRefIdx()) == pcTextureSlice->getPOC() ) 4377 { 4378 iViewIdx = pcTextureSlice->getRefPic( REF_PIC_LIST_0, cMVField.getRefIdx())->getViewIndex(); 4379 iDV = cMVField.getHor(); 4380 4381 4382 Int iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_0, cMVField.getRefIdx() ); 4383 4384 if( iValidDepRef >= 0 ) 4385 { 4386 const TComMv cAdd( 2, 2 ); 4387 cMVField.getMv() += cAdd; 4388 cMVField.getMv() >>= 2; 4389 #if !(NTT_BUG_FIX_TK54) 4390 clipMv( cMVField.getMv() ); 4391 #endif 4392 tmpMV[ 0 ].setMvField( cMVField.getMv(), iValidDepRef ); 4393 tmpDir = 1; 4394 } 4395 } 4396 } 4397 4398 pcTextureCU->getMvField( pcTextureCU, uiPartIdx, REF_PIC_LIST_1, cMVField ); 4399 4400 if( !tmpDir && cMVField.getRefIdx() >= 0 ) 4401 { 4402 if( pcTextureSlice->getRefPOC( REF_PIC_LIST_1, cMVField.getRefIdx()) == pcTextureSlice->getPOC() ) 4403 { 4404 iViewIdx = pcTextureSlice->getRefPic( REF_PIC_LIST_1, cMVField.getRefIdx())->getViewIndex(); 4405 iDV = cMVField.getHor(); 4406 4407 Int iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_1, cMVField.getRefIdx() ); 4408 4409 if( iValidDepRef >= 0 ) 4410 { 4411 const TComMv cAdd( 2, 2 ); 4412 cMVField.getMv() += cAdd; 4413 cMVField.getMv() >>= 2; 4414 #if !(NTT_BUG_FIX_TK54) 4415 clipMv( cMVField.getMv() ); 4416 #endif 4417 tmpMV[ 1 ].setMvField( cMVField.getMv(), iValidDepRef ); 4418 tmpDir = 2; 4419 } 4420 } 4421 } 4422 if( tmpDir != 0 ) 4423 { 4424 m_ucDDTmpDepth = m_pcSlice->getDepthFromDV( iDV, iViewIdx ); 4425 m_iUseDDDCandIdx = iCount; 4426 4427 m_mergCands[MRG_D].setCand( tmpMV, tmpDir, false, false); 4428 if ( mrgCandIdx == iCount ) 4429 { 4430 return; 4431 } 4432 iCount ++; 4433 } 4434 } 4435 } 4436 #endif 4437 ///////////////////////////////////////////////////////////////// 4438 //////// DERIVE IvMC, IvMCShift,IvDCShift, IvDC Candidates ///// 4439 ///////////////////////////////////////////////////////////////// 4440 4441 // { IvMCL0, IvMCL1, IvDCL0, IvDCL1, IvMCL0Shift, IvMCL1Shift, IvDCL0Shift, IvDCL1Shift }; 4442 // An enumerator would be appropriate here! 4443 TComMv ivCandMv [8]; 4444 Int ivCandRefIdx[8] = {-1, -1, -1, -1, -1, -1, -1, -1}; 4445 4446 // { IvMC, IvDC, IvMCShift, IvDCShift }; 4447 Int ivCandDir [4] = {0, 0, 0, 0}; 4448 4449 Bool ivMvPredFlag = getSlice()->getVPS()->getIvMvPredFlag( getSlice()->getLayerIdInVps() ); 4450 4451 ivMvPredFlag &= (nPSW + nPSH > 12); 4452 if ( ivMvPredFlag && cDisInfo.m_aVIdxCan!=-1) 4453 { 4454 getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir , bIsDepth, pcMvFieldSP, puhInterDirSP, bICFlag ); 4455 } 4456 4457 /////////////////////////////////////////////// 4458 //////// INTER VIEW MOTION COMP(IvMC) ///////// 4459 /////////////////////////////////////////////// 4460 if( getSlice()->getIsDepth() ) 4461 { 4462 ivCandDir[1] = ivCandDir[2] = ivCandDir[3] = 0; 4463 } 4464 4465 if( ivCandDir[0] ) 4466 { 4467 tmpMV[0].setMvField( cZeroMv, NOT_VALID ); 4468 tmpMV[1].setMvField( cZeroMv, NOT_VALID ); 4469 4470 if( ( ivCandDir[0] & 1 ) == 1 ) 4471 { 4472 tmpMV[0].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] ); 4473 } 4474 if( ( ivCandDir[0] & 2 ) == 2 ) 4475 { 4476 tmpMV[1].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] ); 4477 } 4478 4479 Bool bRemoveSpa = false; //pruning 4480 4481 if (!bIsDepth) 4482 { 4483 for(Int i = 0; i < 2; i ++) 4484 { 4485 if ( !m_mergCands[MRG_A1 + i].m_bAvailable ) // prunning to A1, B1 4486 { 4487 continue; 4488 } 4489 if (ivCandDir[0] == m_mergCands[MRG_A1+i].m_uDir && tmpMV[0]==m_mergCands[MRG_A1+i].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_A1+i].m_cMvField[1]) 4490 { 4491 m_mergCands[MRG_A1+i].m_bAvailable = false; 4492 break; 4493 } 4494 } 4495 } 4496 if (bIsDepth) 4497 { 4498 if (m_mergCands[MRG_T].m_bAvailable && ivCandDir[0] == m_mergCands[MRG_T].m_uDir && tmpMV[0]==m_mergCands[MRG_T].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_T].m_cMvField[1]) 4499 { 4500 bRemoveSpa = true; 4501 } 4502 } 4503 if (!bRemoveSpa) 4504 { 4505 Bool SPIVMPFlag = false; 4506 if(!m_pcSlice->getIsDepth()) 4507 { 4508 SPIVMPFlag = true; 4509 } 4510 #if H_3D_DBBP 4511 SPIVMPFlag &= !bDBBPFlag; 4512 #endif 4513 4514 m_mergCands[MRG_IVMC].setCand( tmpMV, ivCandDir[0], false, SPIVMPFlag); 4515 4516 if ( mrgCandIdx == iCount ) 4517 { 4518 return; 4519 } 4520 iCount ++; 4521 } 4522 } 4523 4524 // early termination 4525 if (iCount == getSlice()->getMaxNumMergeCand()) 4526 { 4527 return; 4528 } 4529 #endif 4530 4531 #if H_3D 4532 iCount += m_mergCands[MRG_A1].m_bAvailable + m_mergCands[MRG_B1].m_bAvailable + m_mergCands[MRG_B0].m_bAvailable; 4533 #else 4534 //left 4535 UInt uiLeftPartIdx = 0; 4536 TComDataCU* pcCULeft = 0; 4537 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 4538 Bool isAvailableA1 = pcCULeft && 4539 pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) && 4540 !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) && 4541 !pcCULeft->isIntra( uiLeftPartIdx ) ; 4542 if ( isAvailableA1 ) 4543 { 4544 abCandIsInter[iCount] = true; 4545 // get Inter Dir 4546 puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx ); 4547 // get Mv from Left 4548 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 4549 if ( getSlice()->isInterB() ) 4550 { 4551 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 4552 } 4553 4554 if ( mrgCandIdx == iCount ) 4555 { 4556 return; 4557 } 4558 iCount ++; 4559 } 4560 4561 // early termination 4562 if (iCount == getSlice()->getMaxNumMergeCand()) 4563 { 4564 return; 4565 } 4566 4567 // above 4568 UInt uiAbovePartIdx = 0; 4569 TComDataCU* pcCUAbove = 0; 4570 pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); 4571 Bool isAvailableB1 = pcCUAbove && 4572 pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) && 4573 !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) && 4574 !pcCUAbove->isIntra( uiAbovePartIdx ); 4575 if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) ) 4576 { 4577 abCandIsInter[iCount] = true; 4578 // get Inter Dir 4579 puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx ); 4580 // get Mv from Left 4581 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 4582 if ( getSlice()->isInterB() ) 4583 { 4584 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 4585 } 4586 4587 if ( mrgCandIdx == iCount ) 4588 { 4589 return; 4590 } 4591 iCount ++; 4592 } 4593 // early termination 4594 if (iCount == getSlice()->getMaxNumMergeCand()) 4595 { 4596 return; 4597 } 4598 4599 // above right 4600 UInt uiAboveRightPartIdx = 0; 4601 TComDataCU* pcCUAboveRight = 0; 4602 pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); 4603 Bool isAvailableB0 = pcCUAboveRight && 4604 pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) && 4605 !pcCUAboveRight->isIntra( uiAboveRightPartIdx ); 4606 if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) ) 4607 { 4608 abCandIsInter[iCount] = true; 4609 // get Inter Dir 4610 puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx ); 4611 // get Mv from Left 4612 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 4613 if ( getSlice()->isInterB() ) 4614 { 4615 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 4616 } 4617 4618 if ( mrgCandIdx == iCount ) 4619 { 4620 return; 4621 } 4622 iCount ++; 4623 } 4624 // early termination 4625 if (iCount == getSlice()->getMaxNumMergeCand()) 4626 { 4627 return; 4628 } 4629 #endif 4630 4631 #if H_3D_DDD 4632 // early termination 4633 if ( iCount >= getSlice()->getMaxNumMergeCand()) 4634 { 4635 return; 4636 } 4637 #endif 4638 4639 #if H_3D_IV_MERGE 4640 ///////////////////////////////////////////// 4641 //////// INTER VIEW DISP COMP (IvDC) //////// 4642 ///////////////////////////////////////////// 4643 if( ivCandDir[1] && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() ) 4644 { 4645 assert(iCount < getSlice()->getMaxNumMergeCand()); 4646 4647 tmpMV[0].setMvField( cZeroMv, NOT_VALID ); 4648 tmpMV[1].setMvField( cZeroMv, NOT_VALID ); 4649 if( ( ivCandDir[1] & 1 ) == 1 ) 4650 { 4651 tmpMV[0].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] ); 4652 } 4653 if( ( ivCandDir[1] & 2 ) == 2 ) 4654 { 4655 tmpMV[1].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] ); 4656 } 4657 4658 Bool bRemoveSpa = false; //pruning to A1, B1 4659 for(Int i = 0; i < 2; i ++) 4660 { 4661 if ( !m_mergCands[MRG_A1+i].m_bAvailable ) 4662 { 4663 continue; 4664 } 4665 if (ivCandDir[1] == m_mergCands[MRG_A1+i].m_uDir && tmpMV[0]==m_mergCands[MRG_A1+i].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_A1+i].m_cMvField[1]) 4666 { 4667 bRemoveSpa = true; 4668 break; 4669 } 4670 } 4671 if(!bRemoveSpa) 4672 { 4673 #if H_3D_NBDV 4674 tmpMV[0].getMv().setIDVFlag (false); 4675 tmpMV[1].getMv().setIDVFlag (false); 4676 #endif 4677 m_mergCands[MRG_IVDC].setCand( tmpMV, ivCandDir[1], false, false); 4678 4679 if ( mrgCandIdx == iCount ) 4680 return; 4681 iCount ++; 4682 4683 // early termination 4684 if (iCount == getSlice()->getMaxNumMergeCand()) 4685 { 4686 return; 4687 } 4688 } 4689 } 4690 #endif // H_3D_IV_MERGE 4691 4692 #if H_3D_VSP 4693 ///////////////////////////////////////////////// 4694 //////// VIEW SYNTHESIS PREDICTION (VSP) //////// 4695 ///////////////////////////////////////////////// 4696 if (iCount<getSlice()->getMaxNumMergeCand()) 4697 { 4698 4699 if ( 4700 #if H_3D_IC 4701 !bICFlag && 4702 #endif 4703 #if H_3D_ARP 4704 !bARPFlag && 4705 #endif 4706 #if H_3D 4707 (nPSW + nPSH > 12) && 4708 #endif 4709 #if H_3D_DBBP 4710 !bDBBPFlag && 4711 #endif 4712 xAddVspCand( mrgCandIdx, &cDisInfo, iCount ) ) 4713 { 4714 return; 4715 } 4716 4717 // early termination 4718 if (iCount == getSlice()->getMaxNumMergeCand()) 4719 { 4720 return; 4721 } 4722 #endif 4723 #if H_3D 4724 } 4725 #endif 4726 4727 #if H_3D 4728 iCount += m_mergCands[MRG_A0].m_bAvailable + m_mergCands[MRG_B2].m_bAvailable; 4729 #else 4730 //left bottom 4731 UInt uiLeftBottomPartIdx = 0; 4732 TComDataCU* pcCULeftBottom = 0; 4733 pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); 4734 Bool isAvailableA0 = pcCULeftBottom && 4735 pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) && 4736 !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ; 4737 if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) ) 4738 { 4739 abCandIsInter[iCount] = true; 4740 // get Inter Dir 4741 puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx ); 4742 // get Mv from Left 4743 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 4744 if ( getSlice()->isInterB() ) 4745 { 4746 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 4747 } 4748 if ( mrgCandIdx == iCount ) 4749 { 4750 return; 4751 } 4752 iCount ++; 4753 } 4754 // early termination 4755 if (iCount == getSlice()->getMaxNumMergeCand()) 4756 { 4757 return; 4758 } 4759 4760 // above left 4761 if( iCount < 4 ) 4762 { 4763 UInt uiAboveLeftPartIdx = 0; 4764 TComDataCU* pcCUAboveLeft = 0; 4765 pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); 4766 Bool isAvailableB2 = pcCUAboveLeft && 4767 pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) && 4768 !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ); 4769 if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) 4770 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) ) 4771 { 4772 abCandIsInter[iCount] = true; 4773 // get Inter Dir 4774 puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx ); 4775 // get Mv from Left 4776 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 4777 if ( getSlice()->isInterB() ) 4778 { 4779 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 4780 } 4781 if ( mrgCandIdx == iCount ) 4782 { 4783 return; 4784 } 4785 iCount ++; 4786 } 4787 } 4788 // early termination 4789 if (iCount == getSlice()->getMaxNumMergeCand()) 4790 { 4791 return; 4792 } 4793 #endif 4794 4795 4796 #if H_3D_IV_MERGE 4797 //////////////////////////////////////////////////// 4798 //////// SHIFTED IV (IvMCShift + IvDCShift) //////// 4799 //////////////////////////////////////////////////// 4800 if( ivMvPredFlag && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() ) 4801 { 4802 if(xAddIvMRGCand( mrgCandIdx, iCount, ivCandDir, ivCandMv, ivCandRefIdx ) ) 4803 { 4804 return; 4805 } 4806 //early termination 4807 if (iCount == getSlice()->getMaxNumMergeCand()) 4808 { 4809 return; 4810 } 4811 } 4812 #endif 4813 #if !H_3D 2564 4814 2565 if ( getSlice()->getEnableTMVPFlag()) 4815 2566 { … … 4899 2650 } 4900 2651 } 4901 // early termination 2652 // early termination 4902 2653 if (iCount == getSlice()->getMaxNumMergeCand()) 4903 2654 { … … 4969 2720 4970 2721 numValidMergeCand = uiArrayAddr; 4971 #endif 4972 } 4973 #else 4974 4975 /** Constructs a list of merging candidates 4976 * \param uiAbsPartIdx 4977 * \param uiPUIdx 4978 * \param uiDepth 4979 * \param pcMvFieldNeighbours 4980 * \param puhInterDirNeighbours 4981 * \param numValidMergeCand 4982 */ 4983 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours 4984 , Int& numValidMergeCand, Int mrgCandIdx 4985 ) 4986 { 4987 UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx; 4988 Bool abCandIsInter[ MRG_MAX_NUM_CANDS ]; 4989 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui ) 4990 { 4991 abCandIsInter[ui] = false; 4992 pcMvFieldNeighbours[ ( ui << 1 ) ].setRefIdx(NOT_VALID); 4993 pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID); 4994 } 4995 numValidMergeCand = getSlice()->getMaxNumMergeCand(); 4996 // compute the location of the current PU 4997 Int xP, yP, nPSW, nPSH; 4998 this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH); 4999 5000 Int iCount = 0; 5001 5002 UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 5003 PartSize cCurPS = getPartitionSize( uiAbsPartIdx ); 5004 deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT ); 5005 deriveLeftBottomIdxGeneral ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB ); 5006 5007 //left 5008 UInt uiLeftPartIdx = 0; 5009 TComDataCU* pcCULeft = 0; 5010 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 5011 Bool isAvailableA1 = pcCULeft && 5012 pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) && 5013 !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) && 5014 !pcCULeft->isIntra( uiLeftPartIdx ) ; 5015 if ( isAvailableA1 ) 5016 { 5017 abCandIsInter[iCount] = true; 5018 // get Inter Dir 5019 puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx ); 5020 // get Mv from Left 5021 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 5022 if ( getSlice()->isInterB() ) 5023 { 5024 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 5025 } 5026 if ( mrgCandIdx == iCount ) 5027 { 5028 return; 5029 } 5030 iCount ++; 5031 } 5032 5033 // early termination 5034 if (iCount == getSlice()->getMaxNumMergeCand()) 5035 { 5036 return; 5037 } 5038 5039 // above 5040 UInt uiAbovePartIdx = 0; 5041 TComDataCU* pcCUAbove = 0; 5042 pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); 5043 Bool isAvailableB1 = pcCUAbove && 5044 pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) && 5045 !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) && 5046 !pcCUAbove->isIntra( uiAbovePartIdx ); 5047 if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) ) 5048 { 5049 abCandIsInter[iCount] = true; 5050 // get Inter Dir 5051 puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx ); 5052 // get Mv from Left 5053 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 5054 if ( getSlice()->isInterB() ) 5055 { 5056 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 5057 } 5058 5059 if ( mrgCandIdx == iCount ) 5060 { 5061 return; 5062 } 5063 iCount ++; 5064 } 5065 // early termination 5066 if (iCount == getSlice()->getMaxNumMergeCand()) 5067 { 5068 return; 5069 } 5070 5071 5072 // above right 5073 UInt uiAboveRightPartIdx = 0; 5074 TComDataCU* pcCUAboveRight = 0; 5075 pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); 5076 Bool isAvailableB0 = pcCUAboveRight && 5077 pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) && 5078 !pcCUAboveRight->isIntra( uiAboveRightPartIdx ); 5079 if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) ) 5080 { 5081 abCandIsInter[iCount] = true; 5082 // get Inter Dir 5083 puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx ); 5084 // get Mv from Left 5085 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 5086 if ( getSlice()->isInterB() ) 5087 { 5088 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 5089 } 5090 if ( mrgCandIdx == iCount ) 5091 { 5092 return; 5093 } 5094 iCount ++; 5095 } 5096 // early termination 5097 if (iCount == getSlice()->getMaxNumMergeCand()) 5098 { 5099 return; 5100 } 5101 5102 //left bottom 5103 UInt uiLeftBottomPartIdx = 0; 5104 TComDataCU* pcCULeftBottom = 0; 5105 pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); 5106 Bool isAvailableA0 = pcCULeftBottom && 5107 pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) && 5108 !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ; 5109 if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) ) 5110 { 5111 abCandIsInter[iCount] = true; 5112 // get Inter Dir 5113 puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx ); 5114 // get Mv from Left 5115 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 5116 if ( getSlice()->isInterB() ) 5117 { 5118 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 5119 } 5120 5121 if ( mrgCandIdx == iCount ) 5122 { 5123 return; 5124 } 5125 iCount ++; 5126 } 5127 // early termination 5128 if (iCount == getSlice()->getMaxNumMergeCand()) 5129 { 5130 return; 5131 } 5132 5133 // above left 5134 if( iCount < 4 ) 5135 { 5136 UInt uiAboveLeftPartIdx = 0; 5137 TComDataCU* pcCUAboveLeft = 0; 5138 pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); 5139 Bool isAvailableB2 = pcCUAboveLeft && 5140 pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) && 5141 !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ); 5142 if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) 5143 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) ) 5144 { 5145 abCandIsInter[iCount] = true; 5146 // get Inter Dir 5147 puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx ); 5148 // get Mv from Left 5149 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 5150 if ( getSlice()->isInterB() ) 5151 { 5152 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 5153 } 5154 if ( mrgCandIdx == iCount ) 5155 { 5156 return; 5157 } 5158 iCount ++; 5159 } 5160 } 5161 // early termination 5162 if (iCount == getSlice()->getMaxNumMergeCand()) 5163 { 5164 return; 5165 } 5166 5167 if ( getSlice()->getEnableTMVPFlag()) 5168 { 5169 //>> MTK colocated-RightBottom 5170 UInt uiPartIdxRB; 5171 5172 deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); 5173 5174 UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB]; 5175 UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); 5176 5177 TComMv cColMv; 5178 Int iRefIdx; 5179 Int uiLCUIdx = -1; 5180 5181 if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check 5182 { 5183 } 5184 else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) 5185 { 5186 } 5187 else 5188 { 5189 if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU 5190 ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU 5191 { 5192 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ]; 5193 uiLCUIdx = getAddr(); 5194 } 5195 else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU 5196 { 5197 uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; 5198 } 5199 else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU 5200 { 5201 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ]; 5202 uiLCUIdx = getAddr() + 1; 5203 } 5204 else //is the right bottom corner of LCU 5205 { 5206 uiAbsPartAddr = 0; 5207 } 5208 } 5209 5210 5211 iRefIdx = 0; 5212 Bool bExistMV = false; 5213 UInt uiPartIdxCenter; 5214 UInt uiCurLCUIdx = getAddr(); 5215 Int dir = 0; 5216 UInt uiArrayAddr = iCount; 5217 xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter ); 5218 bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx ); 5219 if( bExistMV == false ) 5220 { 5221 bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); 5222 } 5223 if( bExistMV ) 5224 { 5225 dir |= 1; 5226 pcMvFieldNeighbours[ 2 * uiArrayAddr ].setMvField( cColMv, iRefIdx ); 5227 } 5228 5229 if ( getSlice()->isInterB() ) 5230 { 5231 bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx); 5232 if( bExistMV == false ) 5233 { 5234 bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); 5235 } 5236 if( bExistMV ) 5237 { 5238 dir |= 2; 5239 pcMvFieldNeighbours[ 2 * uiArrayAddr + 1 ].setMvField( cColMv, iRefIdx ); 5240 } 5241 } 5242 5243 if (dir != 0) 5244 { 5245 puhInterDirNeighbours[uiArrayAddr] = dir; 5246 abCandIsInter[uiArrayAddr] = true; 5247 if ( mrgCandIdx == iCount ) 5248 { 5249 return; 5250 } 5251 iCount++; 5252 } 5253 } 5254 // early termination 5255 if (iCount == getSlice()->getMaxNumMergeCand()) 5256 { 5257 return; 5258 } 5259 UInt uiArrayAddr = iCount; 5260 UInt uiCutoff = uiArrayAddr; 5261 5262 if ( getSlice()->isInterB()) 5263 { 5264 UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3}; 5265 UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2}; 5266 5267 for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++) 5268 { 5269 Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx]; 5270 if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)) 5271 { 5272 abCandIsInter[uiArrayAddr] = true; 5273 puhInterDirNeighbours[uiArrayAddr] = 3; 5274 5275 // get Mv from cand[i] and cand[j] 5276 pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx()); 5277 pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx()); 5278 5279 Int iRefPOCL0 = m_pcSlice->getRefPOC( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() ); 5280 Int iRefPOCL1 = m_pcSlice->getRefPOC( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() ); 5281 if (iRefPOCL0 == iRefPOCL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv()) 5282 { 5283 abCandIsInter[uiArrayAddr] = false; 5284 } 5285 else 5286 { 5287 uiArrayAddr++; 5288 } 5289 } 5290 } 5291 } 5292 // early termination 5293 if (uiArrayAddr == getSlice()->getMaxNumMergeCand()) 5294 { 5295 return; 5296 } 5297 Int iNumRefIdx = (getSlice()->isInterB()) ? min(m_pcSlice->getNumRefIdx(REF_PIC_LIST_0), m_pcSlice->getNumRefIdx(REF_PIC_LIST_1)) : m_pcSlice->getNumRefIdx(REF_PIC_LIST_0); 5298 Int r = 0; 5299 Int refcnt = 0; 5300 while (uiArrayAddr < getSlice()->getMaxNumMergeCand()) 5301 { 5302 abCandIsInter[uiArrayAddr] = true; 5303 puhInterDirNeighbours[uiArrayAddr] = 1; 5304 pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r); 5305 5306 if ( getSlice()->isInterB() ) 5307 { 5308 puhInterDirNeighbours[uiArrayAddr] = 3; 5309 pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r); 5310 } 5311 uiArrayAddr++; 5312 if ( refcnt == iNumRefIdx - 1 ) 5313 { 5314 r = 0; 5315 } 5316 else 5317 { 5318 ++r; 5319 ++refcnt; 5320 } 5321 } 5322 5323 numValidMergeCand = uiArrayAddr; 5324 } 5325 #endif 2722 } 5326 2723 5327 2724 #if !FIX_TICKET_76 5328 #if H_3D_VSP5329 inline Void TComDataCU::xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount, InheritedVSPDisInfo* inheritedVSPDisInfo)5330 {5331 inheritedVSPDisInfo[iCount].m_acDvInfo.m_acNBDV = pcCURef->getDvInfo(uiAbsPartIdx).m_acNBDV;5332 inheritedVSPDisInfo[iCount].m_acDvInfo.m_aVIdxCan = pcCURef->getDvInfo(uiAbsPartIdx).m_aVIdxCan;5333 }5334 #endif5335 2725 #endif 5336 2726 /** Check whether the current PU and a spatial neighboring PU are in a same ME region. … … 5551 2941 } 5552 2942 if ( uiLCUIdx >= 0 && xGetColMVP( eRefPicList, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx_Col 5553 #if H_3D_TMVP5554 , 05555 #endif5556 2943 ) ) 5557 2944 { … … 5564 2951 xDeriveCenterIdx( uiPartIdx, uiPartIdxCenter ); 5565 2952 if (xGetColMVP( eRefPicList, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx_Col 5566 #if H_3D_TMVP5567 , 05568 #endif5569 2953 )) 5570 2954 { … … 5593 2977 UInt partAddr; 5594 2978 5595 #if H_3D_DBBP5596 if( getDBBPFlag(0) )5597 {5598 return true;5599 }5600 #endif5601 2979 5602 2980 getPartIndexAndSize( puIdx, partAddr, width, height ); … … 5611 2989 { 5612 2990 Int iMvShift = 2; 5613 #if H_3D_IC5614 if( getSlice()->getIsDepth() )5615 iMvShift = 0;5616 #endif5617 2991 Int iOffset = 8; 5618 2992 Int iHorMax = ( m_pcSlice->getSPS()->getPicWidthInLumaSamples() + iOffset - m_uiCUPelX - 1 ) << iMvShift; … … 5668 3042 } 5669 3043 5670 #if H_3D_IC5671 Bool TComDataCU::isIC( UInt uiPartIdx )5672 {5673 if ( m_pcSlice->isIntra () )5674 {5675 return false;5676 }5677 return ( ( getSkipFlag(uiPartIdx) || getPredictionMode(uiPartIdx) == MODE_INTER) && getICFlag( uiPartIdx ) && isICFlagRequired( uiPartIdx ) );5678 }5679 #endif5680 3044 5681 3045 // ==================================================================================================================== … … 5900 3264 */ 5901 3265 Bool TComDataCU::xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx 5902 #if H_3D_TMVP5903 , Bool bMRG5904 #endif5905 3266 ) 5906 3267 { … … 5950 3311 if ( bIsCurrRefLongTerm != bIsColRefLongTerm ) 5951 3312 { 5952 #if H_3D_TMVP5953 Int iAlterRefIdx = m_pcSlice->getAlterRefIdx(eRefPicList);5954 if(bMRG && iAlterRefIdx > 0)5955 {5956 riRefIdx = iAlterRefIdx;5957 bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getIsLongTerm();5958 iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC();5959 assert(bIsCurrRefLongTerm == bIsColRefLongTerm);5960 }5961 else5962 {5963 #endif5964 3313 return false; 5965 #if H_3D_TMVP5966 }5967 #endif5968 3314 } 5969 3315 5970 3316 if ( bIsCurrRefLongTerm || bIsColRefLongTerm ) 5971 3317 { 5972 #if H_3D_TMVP5973 Int iCurrViewId = m_pcSlice->getViewIndex ();5974 Int iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewIndex ();5975 Int iColViewId = pColCU->getSlice()->getViewIndex();5976 Int iColRefViewId = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewIndex();5977 iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId );5978 #if SEC_HLS_CLEANUP_I01005979 if ( iScale != 4096 && m_pcSlice->getVPS()->getIvMvScalingFlag(getSlice()->getLayerIdInVps()) )5980 #else5981 if ( iScale != 4096 && m_pcSlice->getVPS()->getIvMvScalingFlag() )5982 #endif5983 {5984 rcMv = cColMv.scaleMv( iScale );5985 }5986 else5987 {5988 #endif5989 3318 rcMv = cColMv; 5990 #if H_3D_TMVP5991 }5992 #endif5993 3319 } 5994 3320 else … … 6066 3392 + ( iPartWidth/m_pcPic->getMinCUWidth() )/2]; 6067 3393 } 6068 #if H_3D6069 Void TComDataCU::compressMV(Int scale)6070 #else6071 3394 Void TComDataCU::compressMV() 6072 #endif 6073 { 6074 #if H_3D 6075 Int scaleFactor = (4 / scale ) * AMVP_DECIMATION_FACTOR / m_unitSize; 6076 #else 3395 { 6077 3396 Int scaleFactor = 4 * AMVP_DECIMATION_FACTOR / m_unitSize; 6078 #endif6079 3397 if (scaleFactor > 0) 6080 3398 { … … 6110 3428 { 6111 3429 uiDirMode = getLumaIntraDir(uiAbsPartIdx); 6112 #if H_3D_DIM6113 mapDepthModeToIntraDir( uiDirMode );6114 #endif6115 3430 uiScanIdx = SCAN_DIAG; 6116 3431 if (uiCTXIdx >3 && uiCTXIdx < 6) //if multiple scans supported for transform size … … 6130 3445 // get luma mode from upper-left corner of current CU 6131 3446 uiDirMode = getLumaIntraDir((uiAbsPartIdx/numParts)*numParts); 6132 #if H_3D_DIM6133 mapDepthModeToIntraDir( uiDirMode );6134 #endif6135 3447 } 6136 3448 uiScanIdx = SCAN_DIAG; … … 6149 3461 } 6150 3462 6151 #if H_3D 6152 Void TComDataCU::getPosInPic( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ) 6153 { 6154 riPosX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelX(); 6155 riPosY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelY(); 6156 } 6157 #endif 6158 #if H_3D_IV_MERGE 6159 Bool TComDataCU::getDispforDepth (UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDisp) 6160 { 6161 6162 assert(getPartitionSize( uiPartAddr ) == SIZE_2Nx2N); 6163 6164 TComMv cMv; 6165 #if MTK_I0093 6166 #if H_3D_FIX_64BIT_SHIFT 6167 Int iDisp = getSlice()->getDepthToDisparityB( 0 )[ (Int64) (1 << ( getSlice()->getSPS()->getBitDepthY() - 1 )) ]; 6168 #else 6169 Int iDisp = getSlice()->getDepthToDisparityB( 0 )[ 1 << ( getSlice()->getSPS()->getBitDepthY() - 1 ) ]; 6170 #endif 6171 #else 6172 Int iDisp = getSlice()->getDepthToDisparityB( 0 )[ 128 ]; 6173 #endif 6174 cMv.setHor(iDisp); 6175 cMv.setVer(0); 6176 pDisp->m_acNBDV = cMv; 6177 pDisp->m_aVIdxCan = 0; 6178 6179 return true; 6180 } 6181 #endif 6182 6183 #if MTK_SINGLE_DEPTH_MODE_I0095 6184 Bool TComDataCU::getNeighDepth (UInt uiPartIdx, UInt uiPartAddr, Pel* pNeighDepth, Int index) 6185 { 6186 6187 Bool bDepAvail = false; 6188 Pel *pDepth = this->getPic()->getPicYuvRec()->getLumaAddr(); 6189 Int iDepStride = this->getPic()->getPicYuvRec()->getStride(); 6190 6191 Int xP, yP, nPSW, nPSH; 6192 this->getPartPosition(uiPartIdx, xP, yP, nPSW, nPSH); 6193 UInt PicHeight=this->getPic()->getPicYuvRec()->getHeight(); 6194 UInt PicWidth=this->getPic()->getPicYuvRec()->getWidth(); 6195 switch(index) 6196 { 6197 case 0: // Mid Left 6198 if( ( xP != 0 ) && ( ( yP + ( nPSH >> 1 ) ) < PicHeight ) ) 6199 { 6200 *pNeighDepth = pDepth[ (yP+(nPSH>>1)) * iDepStride + (xP-1) ]; 6201 bDepAvail = true; 6202 } 6203 break; 6204 case 1: // Mid Above 6205 if( ( yP != 0 ) && ( ( xP + ( nPSW >> 1 ) ) < PicWidth ) ) 6206 { 6207 *pNeighDepth = pDepth[ (yP-1) * iDepStride + (xP + (nPSW>>1)) ]; 6208 bDepAvail = true; 6209 } 6210 break; 6211 case 2: // Above 6212 if(yP != 0) 6213 { 6214 *pNeighDepth = pDepth[ (yP-1) * iDepStride + (xP) ]; 6215 bDepAvail = true; 6216 } 6217 break; 6218 case 3: // Left 6219 if(xP != 0) 6220 { 6221 *pNeighDepth = pDepth[ (yP) * iDepStride + (xP-1) ]; 6222 bDepAvail = true; 6223 } 6224 break; 6225 case 4: // Above_Left 6226 if(xP != 0 && yP != 0) 6227 { 6228 *pNeighDepth = pDepth[ (yP-1) * iDepStride + (xP-1) ]; 6229 bDepAvail = true; 6230 } 6231 break; 6232 default: 6233 break; 6234 } 6235 return bDepAvail; 6236 } 6237 6238 #endif 6239 #if H_3D_NBDV 6240 //Notes from QC: 6241 //TBD#1: DoNBDV related contributions are just partially integrated under the marco of H_3D_NBDV_REF, remove this comment once DoNBDV and BVSP are done 6242 //TBD#2: set of DvMCP values need to be done as part of inter-view motion prediction process. Remove this comment once merge related integration is done 6243 //To be checked: Parallel Merge features for NBDV, related to DV_DERIVATION_PARALLEL_B0096 and LGE_IVMP_PARALLEL_MERGE_B0136 are not integrated. The need of these features due to the adoption of CU-based NBDV is not clear. We need confirmation on this, especially by proponents 6244 Bool TComDataCU::getDisMvpCandNBDV( DisInfo* pDInfo 6245 #if H_3D_NBDV_REF 6246 , Bool bDepthRefine 6247 #endif 6248 ) 6249 { 6250 //// ******* Init variables ******* ///// 6251 // Init disparity struct for results 6252 pDInfo->bDV = false; 6253 pDInfo->m_aVIdxCan = -1; 6254 6255 // Init struct for disparities from MCP neighboring blocks 6256 IDVInfo cIDVInfo; 6257 cIDVInfo.m_bFound = false; 6258 UInt uiPartIdx = 0; 6259 UInt uiPartAddr = 0; 6260 for (UInt iCurDvMcpCand = 0; iCurDvMcpCand < IDV_CANDS; iCurDvMcpCand++) 6261 { 6262 for (UInt iList = 0; iList < 2; iList++) 6263 { 6264 cIDVInfo.m_acMvCand[iList][iCurDvMcpCand].setZero(); 6265 cIDVInfo.m_aVIdxCan[iList][iCurDvMcpCand] = 0; 6266 cIDVInfo.m_bAvailab[iList][iCurDvMcpCand] = false; 6267 } 6268 } 6269 #if H_3D_NBDV_REF 6270 if( !m_pcSlice->getVPS()->getDepthRefinementFlag( m_pcSlice->getLayerIdInVps() ) ) 6271 { 6272 bDepthRefine = false; 6273 } 6274 #endif 6275 // Get Positions 6276 PartSize eCUMode = getPartitionSize( uiPartAddr ); 6277 assert(eCUMode == SIZE_2Nx2N); 6278 UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 6279 6280 deriveLeftRightTopIdxGeneral(uiPartAddr, uiPartIdx, uiPartIdxLT, uiPartIdxRT ); 6281 deriveLeftBottomIdxGeneral (uiPartAddr, uiPartIdx, uiPartIdxLB ); 6282 6283 //// ******* Get disparity from temporal neighboring blocks ******* ///// 6284 if ( getSlice()->getEnableTMVPFlag() ) 6285 { 6286 TComMv cColMv; 6287 Int iTargetViewIdx = 0; 6288 Int iTStartViewIdx = 0; 6289 6290 ///*** Derive center position *** 6291 UInt uiPartIdxCenter; 6292 Int uiLCUIdx = getAddr(); 6293 xDeriveCenterIdx(uiPartIdx, uiPartIdxCenter ); 6294 6295 ///*** Search temporal candidate pictures for disparity vector *** 6296 const Int iNumCandPics = getPic()->getNumDdvCandPics(); 6297 for(Int curCandPic = 0; curCandPic < iNumCandPics; curCandPic++) 6298 { 6299 RefPicList eCurRefPicList = REF_PIC_LIST_0 ; 6300 Int curCandPicRefIdx = 0; 6301 if( curCandPic == 0 ) 6302 { 6303 eCurRefPicList = RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0); 6304 curCandPicRefIdx = getSlice()->getColRefIdx(); 6305 } 6306 else 6307 { 6308 eCurRefPicList = getPic()->getRapRefList(); 6309 curCandPicRefIdx = getPic()->getRapRefIdx(); 6310 } 6311 6312 Bool bCheck = xGetColDisMV( curCandPic, eCurRefPicList, curCandPicRefIdx, uiLCUIdx, uiPartIdxCenter, cColMv, iTargetViewIdx, iTStartViewIdx ); 6313 6314 if( bCheck ) 6315 { 6316 #if !(NTT_BUG_FIX_TK54) 6317 clipMv(cColMv); 6318 #endif 6319 pDInfo->m_acNBDV = cColMv; 6320 pDInfo->m_aVIdxCan = iTargetViewIdx; 6321 6322 #if H_3D_NBDV_REF 6323 TComPic* picDepth = NULL; 6324 #if H_3D_FCO_VSP_DONBDV_E0163 6325 picDepth = getSlice()->getIvPic(true, getSlice()->getViewIndex() ); 6326 if ( picDepth->getPicYuvRec() != NULL ) 6327 { 6328 cColMv.setZero(); 6329 } 6330 else // Go back with virtual depth 6331 { 6332 picDepth = getSlice()->getIvPic( true, iTargetViewIdx ); 6333 } 6334 6335 assert(picDepth != NULL); 6336 #else 6337 picDepth = getSlice()->getIvPic( true, iTargetViewIdx ); 6338 #if !BUG_FIX_TK65 6339 assert(picDepth != NULL); 6340 #endif 6341 #endif 6342 if (picDepth && bDepthRefine) 6343 estimateDVFromDM(iTargetViewIdx, uiPartIdx, picDepth, uiPartAddr, &cColMv ); 6344 6345 pDInfo->m_acDoNBDV = cColMv; 6346 #endif //H_3D_NBDV_REF 6347 return true; 6348 } 6349 } 6350 } 6351 6352 UInt uiIdx = 0; 6353 Bool bCheckMcpDv = false; 6354 TComDataCU* pcTmpCU = NULL; 6355 6356 //// ******* Get disparity from left block ******* ///// 6357 pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false); 6358 bCheckMcpDv = true; 6359 if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_LEFT 6360 #if H_3D_NBDV_REF 6361 , bDepthRefine 6362 #endif 6363 ) ) 6364 return true; 6365 6366 //// ******* Get disparity from above block ******* ///// 6367 pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true); 6368 if(pcTmpCU != NULL ) 6369 { 6370 bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0); 6371 if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_ABOVE 6372 #if H_3D_NBDV_REF 6373 , bDepthRefine 6374 #endif 6375 ) ) 6376 return true; 6377 } 6378 6379 //// ******* Search MCP blocks ******* ///// 6380 if( cIDVInfo.m_bFound ) 6381 { 6382 for( Int curPos = 0 ; curPos < IDV_CANDS ; curPos++ ) 6383 { 6384 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) 6385 { 6386 if( cIDVInfo.m_bAvailab[iList][curPos] ) 6387 { 6388 TComMv cDispVec = cIDVInfo.m_acMvCand[iList][ curPos ]; 6389 #if !(NTT_BUG_FIX_TK54) 6390 clipMv( cDispVec ); 6391 #endif 6392 pDInfo->m_acNBDV = cDispVec; 6393 pDInfo->m_aVIdxCan = cIDVInfo.m_aVIdxCan[iList][ curPos ]; 6394 #if H_3D_NBDV_REF 6395 #if H_3D_FCO_VSP_DONBDV_E0163 6396 TComPic* picDepth = NULL; 6397 6398 picDepth = getSlice()->getIvPic(true, getSlice()->getViewIndex() ); 6399 if ( picDepth->getPicYuvRec() != NULL ) 6400 { 6401 cDispVec.setZero(); 6402 } 6403 else // Go back with virtual depth 6404 { 6405 picDepth = getSlice()->getIvPic( true, pDInfo->m_aVIdxCan ); 6406 } 6407 6408 assert(picDepth != NULL); 6409 #else 6410 TComPic* picDepth = getSlice()->getIvPic( true, pDInfo->m_aVIdxCan ); 6411 #if !BUG_FIX_TK65 6412 assert(picDepth!=NULL); 6413 #endif 6414 #endif 6415 6416 if (picDepth && bDepthRefine) 6417 { 6418 estimateDVFromDM (pDInfo->m_aVIdxCan, uiPartIdx, picDepth, uiPartAddr, &cDispVec); 6419 } 6420 pDInfo->m_acDoNBDV = cDispVec; 6421 #endif 6422 return true; 6423 } 6424 } 6425 } 6426 } 6427 6428 TComMv defaultDV(0, 0); 6429 pDInfo->m_acNBDV = defaultDV; 6430 6431 Int valid = 0; 6432 Int viewIndex = 0; 6433 for( UInt uiBId = 0; uiBId < getSlice()->getViewIndex() && valid==0; uiBId++ ) 6434 { 6435 UInt uiBaseId = uiBId; 6436 TComPic* pcBasePic = getSlice()->getIvPic( false, uiBaseId ); 6437 for( Int iRefListId = 0; ( iRefListId < (getSlice()->isInterB()? 2:1) ) && !getSlice()->isIntra() && valid==0; iRefListId++ ) 6438 { 6439 RefPicList eRefPicListTest = RefPicList( iRefListId ); 6440 Int iNumRefPics = getSlice()->getNumRefIdx( eRefPicListTest ) ; 6441 for( Int iRefIndex = 0; iRefIndex < iNumRefPics; iRefIndex++ ) 6442 { 6443 if(pcBasePic->getPOC() == getSlice()->getRefPic( eRefPicListTest, iRefIndex )->getPOC() 6444 && pcBasePic->getViewIndex() == getSlice()->getRefPic( eRefPicListTest, iRefIndex )->getViewIndex()) 6445 { 6446 valid=1; 6447 viewIndex = uiBaseId; 6448 break; 6449 } 6450 } 6451 } 6452 } 6453 if(valid) 6454 { 6455 pDInfo->m_aVIdxCan = viewIndex; 6456 #if H_3D_NBDV_REF 6457 TComPic* picDepth = NULL; 6458 #if H_3D_FCO_VSP_DONBDV_E0163 6459 picDepth = getSlice()->getIvPic(true, getSlice()->getViewIndex() ); 6460 if ( picDepth->getPicYuvRec() != NULL ) 6461 { 6462 defaultDV.setZero(); 6463 } 6464 else // Go back with virtual depth 6465 { 6466 picDepth = getSlice()->getIvPic( true, viewIndex ); 6467 } 6468 6469 assert(picDepth != NULL); 6470 #else 6471 picDepth = getSlice()->getIvPic( true, viewIndex ); 6472 #if !BUG_FIX_TK65 6473 assert(picDepth!=NULL); 6474 #endif 6475 #endif 6476 if (picDepth && bDepthRefine) 6477 { 6478 estimateDVFromDM(viewIndex, uiPartIdx, picDepth, uiPartAddr, &defaultDV ); // from base view 6479 } 6480 pDInfo->m_acDoNBDV = defaultDV; 6481 #endif 6482 } 6483 return false; 6484 } 6485 6486 #if H_3D_NBDV_REF 6487 Pel TComDataCU::getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iBlkWidth, Int iBlkHeight, Int* aiShiftLUT ) 6488 { 6489 Int iPictureWidth = pcBaseViewDepthPicYuv->getWidth(); 6490 Int iPictureHeight = pcBaseViewDepthPicYuv->getHeight(); 6491 6492 Int depthStartPosX = Clip3(0, iPictureWidth - 1, iBlkX + ((mv->getHor()+2)>>2)); 6493 Int depthStartPosY = Clip3(0, iPictureHeight - 1, iBlkY + ((mv->getVer()+2)>>2)); 6494 Int depthEndPosX = Clip3(0, iPictureWidth - 1, iBlkX + iBlkWidth - 1 + ((mv->getHor()+2)>>2)); 6495 Int depthEndPosY = Clip3(0, iPictureHeight - 1, iBlkY + iBlkHeight - 1 + ((mv->getVer()+2)>>2)); 6496 6497 Pel* depthTL = pcBaseViewDepthPicYuv->getLumaAddr(); 6498 Int depStride = pcBaseViewDepthPicYuv->getStride(); 6499 6500 Pel maxDepthVal = 0; 6501 maxDepthVal = std::max( maxDepthVal, depthTL[ (depthStartPosY) * depStride + depthStartPosX ]); // Left Top 6502 maxDepthVal = std::max( maxDepthVal, depthTL[ (depthEndPosY) * depStride + depthStartPosX ]); // Left Bottom 6503 maxDepthVal = std::max( maxDepthVal, depthTL[ (depthStartPosY) * depStride + depthEndPosX ]); // Right Top 6504 maxDepthVal = std::max( maxDepthVal, depthTL[ (depthEndPosY) * depStride + depthEndPosX ]); // Right Bottom 6505 6506 return aiShiftLUT[ maxDepthVal ]; 6507 } 6508 6509 Void TComDataCU::estimateDVFromDM(Int refViewIdx, UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred ) 6510 { 6511 if (picDepth) 6512 { 6513 UInt uiAbsPartAddrCurrCU = m_uiAbsIdxInLCU + uiPartAddr; 6514 Int iWidth, iHeight; 6515 getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight ); // The modified value of uiPartAddr won't be used any more 6516 6517 TComPicYuv* pcBaseViewDepthPicYuv = picDepth->getPicYuvRec(); 6518 Int iBlkX = ( getAddr() % picDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartAddrCurrCU ] ]; 6519 Int iBlkY = ( getAddr() / picDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartAddrCurrCU ] ]; 6520 6521 Int* aiShiftLUT = getSlice()->getDepthToDisparityB(refViewIdx ); 6522 6523 Pel iDisp = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT ); 6524 cMvPred->setHor( iDisp ); 6525 #if !(NTT_BUG_FIX_TK54) 6526 clipMv(*cMvPred); 6527 #endif 6528 } 6529 } 6530 #endif //H_3D_NBDV_REF 6531 6532 6533 Bool TComDataCU::xCheckSpatialNBDV( TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paIDVInfo, UInt uiMvpDvPos 6534 #if H_3D_NBDV_REF 6535 , Bool bDepthRefine 6536 #endif 6537 ) 6538 { 6539 if( pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) ) 6540 { 6541 Bool bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx ); 6542 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) 6543 { 6544 RefPicList eRefPicList = RefPicList(iList); 6545 Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; 6546 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 6547 6548 if( refId >= 0) 6549 { 6550 Int refViewIdx = pcTmpCU->getSlice()->getRefPic(eRefPicList, refId)->getViewIndex(); 6551 if (refViewIdx != m_pcSlice->getViewIndex()) 6552 { 6553 #if !(NTT_BUG_FIX_TK54) 6554 clipMv(cMvPred); 6555 #endif 6556 pNbDvInfo->m_acNBDV = cMvPred; 6557 pNbDvInfo->m_aVIdxCan = refViewIdx; 6558 #if H_3D_NBDV_REF 6559 TComPic* picDepth = NULL; 6560 assert(getSlice()->getRefPic(eRefPicList, refId)->getPOC() == getSlice()->getPOC()); 6561 #if H_3D_FCO_VSP_DONBDV_E0163 6562 picDepth = getSlice()->getIvPic(true, getSlice()->getViewIndex() ); 6563 if ( picDepth->getPicYuvRec() != NULL ) 6564 { 6565 cMvPred.setZero(); 6566 } 6567 else// Go back with virtual depth 6568 { 6569 picDepth = getSlice()->getIvPic (true, refViewIdx ); 6570 } 6571 assert(picDepth != NULL); 6572 #else 6573 picDepth = getSlice()->getIvPic (true, refViewIdx ); 6574 #if !BUG_FIX_TK65 6575 assert(picDepth != NULL); 6576 #endif 6577 #endif 6578 UInt uiPartIdx = 0; //Notes from MTK: Please confirm that using 0 as partition index and partition address is correct for CU-level DoNBDV 6579 UInt uiPartAddr = 0; //QC: confirmed 6580 6581 if (picDepth && bDepthRefine) 6582 estimateDVFromDM(refViewIdx, uiPartIdx, picDepth, uiPartAddr, &cMvPred ); 6583 6584 pNbDvInfo->m_acDoNBDV = cMvPred; 6585 #endif 6586 return true; 6587 } 6588 else if ( bSearchForMvpDv && cMvPred.getIDVFlag() && bTmpIsSkipped ) 6589 { 6590 assert( uiMvpDvPos < IDV_CANDS ); 6591 paIDVInfo->m_acMvCand[iList][ uiMvpDvPos ] = TComMv( cMvPred.getIDVHor(), cMvPred.getIDVVer() ); 6592 //Notes from QC: DvMCP is implemented in a way that doesnot carry the reference view identifier as NBDV. It only works for CTC and needs to be fixed to be aligned with other part of the NBDV design. 6593 paIDVInfo->m_aVIdxCan[iList][ uiMvpDvPos ] = cMvPred.getIDVVId(); 6594 paIDVInfo->m_bAvailab[iList][ uiMvpDvPos ] = true; 6595 paIDVInfo->m_bFound = true; 6596 } 6597 } 6598 } 6599 } 6600 return false; 6601 } 6602 6603 Void TComDataCU::xDeriveRightBottomNbIdx(Int &riLCUIdxRBNb, Int &riPartIdxRBNb ) 6604 { 6605 UInt uiPartIdx = 0; 6606 UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); 6607 Int uiLCUIdx = getAddr(); 6608 6609 UInt uiPartIdxRB; 6610 deriveRightBottomIdx(uiPartIdx, uiPartIdxRB ); 6611 UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB]; 6612 6613 if (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) 6614 { 6615 riLCUIdxRBNb = -1; 6616 riPartIdxRBNb = -1; 6617 } 6618 else if(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) 6619 { 6620 riLCUIdxRBNb = -1; 6621 riPartIdxRBNb = -1; 6622 } 6623 else 6624 { 6625 if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU 6626 ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU 6627 { 6628 riPartIdxRBNb = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ]; 6629 riLCUIdxRBNb = uiLCUIdx; 6630 } 6631 else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU 6632 { 6633 riPartIdxRBNb = -1; 6634 riLCUIdxRBNb = -1; 6635 } 6636 else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU 6637 { 6638 riPartIdxRBNb = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ]; 6639 riLCUIdxRBNb = uiLCUIdx + 1; 6640 } 6641 else //is the right bottom corner of LCU 6642 { 6643 riPartIdxRBNb = -1; 6644 riLCUIdxRBNb = -1; 6645 } 6646 } 6647 } 6648 6649 6650 Void TComDataCU::setDvInfoSubParts( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth ) 6651 { 6652 UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); 6653 for (UInt ui = 0; ui < uiCurrPartNumb; ui++ ) 6654 { 6655 m_pDvInfo[uiAbsPartIdx + ui] = cDvInfo; 6656 } 6657 } 6658 #if H_3D_VSP 6659 Void TComDataCU::setDvInfoSubParts( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth ) 6660 { 6661 setSubPartT<DisInfo>( cDvInfo, m_pDvInfo, uiAbsPartIdx, uiDepth, uiPUIdx ); 6662 } 6663 #endif 6664 6665 Bool TComDataCU::xGetColDisMV( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv , Int & iTargetViewIdx, Int & iStartViewIdx ) 6666 { 6667 6668 RefPicList eColRefPicList = REF_PIC_LIST_0; 6669 Int iColViewIdx, iColRefViewIdx; 6670 TComPic *pColPic = getSlice()->getRefPic( eRefPicList, refidx); 6671 TComDataCU *pColCU = pColPic->getCU( uiCUAddr ); 6672 iColViewIdx = pColCU->getSlice()->getViewIndex(); 6673 if (pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE||pColCU->isIntra(uiPartUnitIdx)) 6674 { 6675 return false; 6676 } 6677 for (Int ilist = 0; ilist < (pColCU->getSlice()->isInterB()? 2:1); ilist++) 6678 { 6679 if(pColCU->getSlice()->isInterB()) 6680 { 6681 eColRefPicList = RefPicList(ilist); 6682 } 6683 6684 Int iColRefIdx = pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiPartUnitIdx); 6685 6686 if (iColRefIdx < 0) 6687 { 6688 continue; 6689 } 6690 6691 iColRefViewIdx = pColCU->getSlice()->getRefPic(eColRefPicList, iColRefIdx)->getViewIndex(); 6692 6693 if ( iColViewIdx == iColRefViewIdx ) // temporal vector 6694 { 6695 continue; 6696 } 6697 else 6698 { 6699 if(getPic()->isTempIVRefValid(currCandPic, ilist, iColRefIdx)) 6700 { 6701 rcMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiPartUnitIdx); 6702 rcMv.setIDVFlag(0); 6703 iTargetViewIdx = iColRefViewIdx ; 6704 iStartViewIdx = iColViewIdx ; 6705 return true; 6706 } 6707 } 6708 } 6709 6710 return false; 6711 } 6712 #endif 6713 #if H_3D_FAST_TEXTURE_ENCODING 6714 Void 6715 TComDataCU::getIVNStatus ( UInt uiPartIdx, DisInfo* pDInfo, Bool& bIVFMerge, Int& iIVFMaxD) 6716 { 6717 TComSlice* pcSlice = getSlice (); 6718 Int iViewIndex = pDInfo->m_aVIdxCan; 6719 //--- get base CU/PU and check prediction mode --- 6720 TComPic* pcBasePic = pcSlice->getIvPic( false, iViewIndex ); 6721 TComPicYuv* pcBaseRec = pcBasePic->getPicYuvRec (); 6722 6723 UInt uiPartAddr; 6724 Int iWidth; 6725 Int iHeight; 6726 getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight ); 6727 6728 Int iCurrPosX, iCurrPosY; 6729 pcBaseRec->getTopLeftSamplePos( getAddr(), getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY ); 6730 6731 iCurrPosX += ( ( iWidth - 1 ) >> 1 ); 6732 iCurrPosY += ( ( iHeight - 1 ) >> 1 ); 6733 6734 Bool depthRefineFlag = false; 6735 #if H_3D_NBDV_REF 6736 depthRefineFlag = m_pcSlice->getVPS()->getDepthRefinementFlag( m_pcSlice->getLayerIdInVps() ); 6737 #endif // H_3D_NBDV_REF 6738 6739 TComMv cDv = depthRefineFlag ? pDInfo->m_acDoNBDV : pDInfo->m_acNBDV; 6740 if( depthRefineFlag ) 6741 { 6742 cDv.setVer(0); 6743 } 6744 6745 Int iBasePosX = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (cDv.getHor() + 2 ) >> 2 ) ); 6746 Int iBasePosY = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (cDv.getVer() + 2 ) >> 2 )); 6747 Int iBaseLPosX = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX - (iWidth >> 1) + ( (cDv.getHor() + 2 ) >> 2 ) ); 6748 Int iBaseLPosY = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (cDv.getVer() + 2 ) >> 2 )); 6749 Int iBaseRPosX = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + (iWidth >> 1) + 1 + ( (cDv.getHor() + 2 ) >> 2 ) ); 6750 Int iBaseRPosY = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (cDv.getVer() + 2 ) >> 2 )); 6751 Int iBaseUPosX = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (cDv.getHor() + 2 ) >> 2 ) ); 6752 Int iBaseUPosY = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY - (iHeight >> 1) + ( (cDv.getVer() + 2 ) >> 2 )); 6753 Int iBaseDPosX = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (cDv.getHor() + 2 ) >> 2 ) ); 6754 Int iBaseDPosY = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + (iHeight >> 1) + 1 + ( (cDv.getVer() + 2 ) >> 2 )); 6755 6756 Int iBaseCUAddr; 6757 Int iBaseAbsPartIdx; 6758 Int iBaseLCUAddr; 6759 Int iBaseLAbsPartIdx; 6760 Int iBaseRCUAddr; 6761 Int iBaseRAbsPartIdx; 6762 Int iBaseUCUAddr; 6763 Int iBaseUAbsPartIdx; 6764 Int iBaseDCUAddr; 6765 Int iBaseDAbsPartIdx; 6766 pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx ); 6767 pcBaseRec->getCUAddrAndPartIdx( iBaseLPosX , iBaseLPosY , iBaseLCUAddr, iBaseLAbsPartIdx ); 6768 pcBaseRec->getCUAddrAndPartIdx( iBaseRPosX , iBaseRPosY , iBaseRCUAddr, iBaseRAbsPartIdx ); 6769 pcBaseRec->getCUAddrAndPartIdx( iBaseUPosX , iBaseUPosY , iBaseUCUAddr, iBaseUAbsPartIdx ); 6770 pcBaseRec->getCUAddrAndPartIdx( iBaseDPosX , iBaseDPosY , iBaseDCUAddr, iBaseDAbsPartIdx ); 6771 TComDataCU* pcBaseCU = pcBasePic->getCU( iBaseCUAddr ); 6772 TComDataCU* pcBaseLCU = pcBasePic->getCU( iBaseLCUAddr ); 6773 TComDataCU* pcBaseRCU = pcBasePic->getCU( iBaseRCUAddr ); 6774 TComDataCU* pcBaseUCU = pcBasePic->getCU( iBaseUCUAddr ); 6775 TComDataCU* pcBaseDCU = pcBasePic->getCU( iBaseDCUAddr ); 6776 bIVFMerge = pcBaseLCU->getMergeFlag( iBaseLAbsPartIdx ) && pcBaseCU->getMergeFlag( iBaseAbsPartIdx ) && pcBaseRCU->getMergeFlag( iBaseRAbsPartIdx ) && pcBaseUCU->getMergeFlag( iBaseUAbsPartIdx ) && pcBaseDCU->getMergeFlag( iBaseDAbsPartIdx ); 6777 Int aiDepthL[5]; //depth level 6778 aiDepthL[0] = pcBaseCU->getDepth(iBaseAbsPartIdx); 6779 aiDepthL[1] = pcBaseLCU->getDepth(iBaseLAbsPartIdx); 6780 aiDepthL[2] = pcBaseRCU->getDepth(iBaseRAbsPartIdx); 6781 aiDepthL[3] = pcBaseUCU->getDepth(iBaseUAbsPartIdx); 6782 aiDepthL[4] = pcBaseDCU->getDepth(iBaseDAbsPartIdx); 6783 for (Int i = 0; i < 5; i++) 6784 { 6785 if (iIVFMaxD < aiDepthL[i]) 6786 iIVFMaxD = aiDepthL[i]; 6787 } 6788 } 6789 #endif 6790 6791 #if H_3D_SPIVMP 6792 Void TComDataCU::getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight) 6793 { 6794 Int iSubPUSize = 1<<getSlice()->getVPS()->getSubPULog2Size(getSlice()->getLayerId()); 6795 if( getSlice()->getIsDepth() ) 6796 { 6797 #if MTK_I0099_VPS_EX2 6798 iSubPUSize = 1<<getSlice()->getVPS()->getSubPUMPILog2Size(getSlice()->getLayerId()); 6799 #else 6800 iSubPUSize = 1 << getSlice()->getVPS()->getSubPUMPILog2Size(); 6801 #endif 6802 } 6803 6804 iNumSPInOneLine = iPUWidth/iSubPUSize; 6805 iNumSPInOneLine = iNumSPInOneLine < 1 ? 1: iNumSPInOneLine; 6806 Int iNumSPInOneColumn = iPUHeight/iSubPUSize; 6807 iNumSPInOneColumn = iNumSPInOneColumn < 1 ? 1: iNumSPInOneColumn; 6808 iNumSP = iNumSPInOneLine * iNumSPInOneColumn; 6809 6810 iSPWidth = iNumSPInOneLine == 1 ? iPUWidth: iSubPUSize; 6811 iSPHeight = iNumSPInOneColumn == 1 ? iPUHeight: iSubPUSize; 6812 } 6813 6814 Void TComDataCU::getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr ) 6815 { 6816 uiBaseAbsPartIdx += m_uiAbsIdxInLCU; 6817 Int iBasePelX = g_auiRasterToPelX[g_auiZscanToRaster[uiBaseAbsPartIdx]]; 6818 Int iBasePelY = g_auiRasterToPelY[g_auiZscanToRaster[uiBaseAbsPartIdx]]; 6819 Int iCurrPelX = iBasePelX + iPartIdx%iNumPartLine * iWidth; 6820 Int iCurrPelY = iBasePelY + iPartIdx/iNumPartLine * iHeight; 6821 Int iCurrRaster = iCurrPelY / getPic()->getMinCUHeight() * getPic()->getNumPartInWidth() + iCurrPelX/getPic()->getMinCUWidth(); 6822 ruiPartAddr = g_auiRasterToZscan[iCurrRaster]; 6823 ruiPartAddr -= m_uiAbsIdxInLCU; 6824 } 6825 6826 Void TComDataCU::setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight ) 6827 { 6828 uiAbsPartIdx += getZorderIdxInCU(); 6829 Int iStartPelX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIdx]]; 6830 Int iStartPelY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIdx]]; 6831 Int iEndPelX = iStartPelX + iWidth; 6832 Int iEndPelY = iStartPelY + iHeight; 6833 6834 Int iCurrRaster, uiPartAddr; 6835 6836 for (Int i=iStartPelY; i<iEndPelY; i+=getPic()->getMinCUHeight()) 6837 { 6838 for (Int j=iStartPelX; j < iEndPelX; j += getPic()->getMinCUWidth()) 6839 { 6840 iCurrRaster = i / getPic()->getMinCUHeight() * getPic()->getNumPartInWidth() + j/getPic()->getMinCUWidth(); 6841 uiPartAddr = g_auiRasterToZscan[iCurrRaster]; 6842 uiPartAddr -= getZorderIdxInCU(); 6843 6844 m_puhInterDir[uiPartAddr] = uiDir; 6845 } 6846 } 6847 } 6848 #endif 6849 6850 #if H_3D_IV_MERGE 6851 Bool 6852 TComDataCU::getInterViewMergeCands(UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc , Bool bIsDepth 6853 #if H_3D_SPIVMP 6854 , TComMvField* pcMvFieldSP, UChar* puhInterDirSP 6855 #endif 6856 , Bool bICFlag 6857 ) 6858 { 6859 TComSlice* pcSlice = getSlice (); 6860 Int iViewIndex = pDInfo->m_aVIdxCan; 6861 6862 //--- get base CU/PU and check prediction mode --- 6863 TComPic* pcBasePic = pcSlice->getIvPic( bIsDepth, iViewIndex ); 6864 TComPicYuv* pcBaseRec = pcBasePic->getPicYuvRec (); 6865 6866 UInt uiPartAddr; 6867 Int iWidth; 6868 Int iHeight; 6869 getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight ); 6870 6871 Int iCurrPosX, iCurrPosY; 6872 pcBaseRec->getTopLeftSamplePos( getAddr(), getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY ); 6873 6874 #if !H_3D_SPIVMP 6875 iCurrPosX += ( iWidth >> 1 ); 6876 iCurrPosY += ( iHeight >> 1 ); 6877 #endif 6878 6879 Bool depthRefineFlag = false; 6880 #if H_3D_NBDV_REF 6881 depthRefineFlag = m_pcSlice->getVPS()->getDepthRefinementFlag( m_pcSlice->getLayerIdInVps() ); 6882 #endif // H_3D_NBDV_REF 6883 6884 TComMv cDv = depthRefineFlag ? pDInfo->m_acDoNBDV : pDInfo->m_acNBDV; 6885 if( depthRefineFlag ) 6886 { 6887 cDv.setVer(0); 6888 } 6889 6890 Bool abPdmAvailable[8] = {false, false, false, false, false, false, false, false}; 6891 #if H_3D_NBDV 6892 for( Int i = 0; i < 8; i++) 6893 { 6894 pacPdmMv[i].setIDVFlag (false); 6895 } 6896 #endif 6897 6898 if(!bICFlag) 6899 { 6900 6901 #if H_3D_SPIVMP 6902 //////////////////////////////// 6903 //////////sub-PU IvMC/////////// 6904 //////////////////////////////// 6905 if(!m_pcSlice->getIsDepth()) 6906 { 6907 if (!getDBBPFlag(0)) 6908 { 6909 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; 6910 getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); 6911 6912 for (Int i=0; i<iNumSP; i++) 6913 { 6914 puhInterDirSP[i] = 0; 6915 pcMvFieldSP[2*i].getMv().set(0, 0); 6916 pcMvFieldSP[2*i+1].getMv().set(0,0); 6917 pcMvFieldSP[2*i].setRefIdx(-1); 6918 pcMvFieldSP[2*i+1].setRefIdx(-1); 6919 } 6920 6921 Int iBaseCUAddr; 6922 Int iBaseAbsPartIdx; 6923 TComDataCU* pcBaseCU; 6924 Int iPartition = 0; 6925 6926 Int iDelX = iSPWidth/2; 6927 Int iDelY = iSPHeight/2; 6928 6929 Int iCenterPosX = iCurrPosX + ( ( iWidth / iSPWidth ) >> 1 ) * iSPWidth + ( iSPWidth >> 1 ); 6930 Int iCenterPosY = iCurrPosY + ( ( iHeight / iSPHeight ) >> 1 ) * iSPHeight + (iSPHeight >> 1); 6931 Int iRefCenterCUAddr, iRefCenterAbsPartIdx; 6932 6933 if(iWidth == iSPWidth && iHeight == iSPHeight) 6934 { 6935 iCenterPosX = iCurrPosX + (iWidth >> 1); 6936 iCenterPosY = iCurrPosY + (iHeight >> 1); 6937 } 6938 6939 Int iRefCenterPosX = Clip3( 0, pcBaseRec->getWidth () - 1, iCenterPosX + ( (cDv.getHor() + 2 ) >> 2 ) ); 6940 Int iRefCenterPosY = Clip3( 0, pcBaseRec->getHeight() - 1, iCenterPosY + ( (cDv.getVer() + 2 ) >> 2 ) ); 6941 6942 pcBaseRec->getCUAddrAndPartIdx( iRefCenterPosX , iRefCenterPosY , iRefCenterCUAddr, iRefCenterAbsPartIdx ); 6943 TComDataCU* pcDefaultCU = pcBasePic->getCU( iRefCenterCUAddr ); 6944 if(!( pcDefaultCU->getPredictionMode( iRefCenterAbsPartIdx ) == MODE_INTRA )) 6945 { 6946 for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ ) 6947 { 6948 RefPicList eCurrRefPicList = RefPicList( uiCurrRefListId ); 6949 Bool stopLoop = false; 6950 for(Int iLoop = 0; iLoop < 2 && !stopLoop; ++iLoop) 6951 { 6952 RefPicList eDefaultRefPicList = (iLoop ==1)? RefPicList( 1 - uiCurrRefListId ) : RefPicList( uiCurrRefListId ); 6953 TComMvField cDefaultMvField; 6954 pcDefaultCU->getMvField( pcDefaultCU, iRefCenterAbsPartIdx, eDefaultRefPicList, cDefaultMvField ); 6955 Int iDefaultRefIdx = cDefaultMvField.getRefIdx(); 6956 if (iDefaultRefIdx >= 0) 6957 { 6958 Int iDefaultRefPOC = pcDefaultCU->getSlice()->getRefPOC(eDefaultRefPicList, iDefaultRefIdx); 6959 if (iDefaultRefPOC != pcSlice->getPOC()) 6960 { 6961 for (Int iPdmRefIdx = 0; iPdmRefIdx < pcSlice->getNumRefIdx( eCurrRefPicList ); iPdmRefIdx++) 6962 { 6963 if (iDefaultRefPOC == pcSlice->getRefPOC(eCurrRefPicList, iPdmRefIdx)) 6964 { 6965 abPdmAvailable[ uiCurrRefListId ] = true; 6966 TComMv cMv(cDefaultMvField.getHor(), cDefaultMvField.getVer()); 6967 #if H_3D_NBDV 6968 #if H_3D_IV_MERGE 6969 if( !bIsDepth ) 6970 { 6971 #endif 6972 cMv.setIDVFlag (true); 6973 cMv.setIDVHor (cDv.getHor()); 6974 cMv.setIDVVer (cDv.getVer()); 6975 cMv.setIDVVId (iViewIndex); 6976 #if H_3D_IV_MERGE 6977 } 6978 #endif 6979 #endif 6980 #if !(NTT_BUG_FIX_TK54) 6981 clipMv( cMv ); 6982 #endif 6983 paiPdmRefIdx [ uiCurrRefListId ] = iPdmRefIdx; 6984 pacPdmMv [ uiCurrRefListId ] = cMv; 6985 stopLoop = true; 6986 break; 6987 } 6988 } 6989 } 6990 } 6991 } 6992 } 6993 } 6994 availableMcDc[0] = ( abPdmAvailable[0]? 1 : 0) + (abPdmAvailable[1]? 2 : 0); 6995 6996 if(availableMcDc[0]) 6997 { 6998 6999 Int iBasePosX, iBasePosY; 7000 for (Int i=iCurrPosY; i < iCurrPosY + iHeight; i += iSPHeight) 7001 { 7002 for (Int j = iCurrPosX; j < iCurrPosX + iWidth; j += iSPWidth) 7003 { 7004 iBasePosX = Clip3( 0, pcBaseRec->getWidth () - 1, j + iDelX + ( (cDv.getHor() + 2 ) >> 2 )); 7005 iBasePosY = Clip3( 0, pcBaseRec->getHeight() - 1, i + iDelY + ( (cDv.getVer() + 2 ) >> 2 )); 7006 7007 pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY, iBaseCUAddr, iBaseAbsPartIdx ); 7008 pcBaseCU = pcBasePic->getCU( iBaseCUAddr ); 7009 if(!( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTRA )) 7010 { 7011 for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ ) 7012 { 7013 RefPicList eCurrRefPicList = RefPicList( uiCurrRefListId ); 7014 Bool bLoop_stop = false; 7015 for(Int iLoop = 0; iLoop < 2 && !bLoop_stop; ++iLoop) 7016 { 7017 RefPicList eBaseRefPicList = (iLoop ==1)? RefPicList( 1 - uiCurrRefListId ) : RefPicList( uiCurrRefListId ); 7018 TComMvField cBaseMvField; 7019 pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField ); 7020 Int iBaseRefIdx = cBaseMvField.getRefIdx(); 7021 if (iBaseRefIdx >= 0) 7022 { 7023 Int iBaseRefPOC = pcBaseCU->getSlice()->getRefPOC(eBaseRefPicList, iBaseRefIdx); 7024 if (iBaseRefPOC != pcSlice->getPOC()) 7025 { 7026 for (Int iPdmRefIdx = 0; iPdmRefIdx < pcSlice->getNumRefIdx( eCurrRefPicList ); iPdmRefIdx++) 7027 { 7028 if (iBaseRefPOC == pcSlice->getRefPOC(eCurrRefPicList, iPdmRefIdx)) 7029 { 7030 abPdmAvailable[ uiCurrRefListId ] = true; 7031 TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer()); 7032 7033 if( !bIsDepth ) 7034 { 7035 cMv.setIDVFlag (true); 7036 cMv.setIDVHor (cDv.getHor()); 7037 cMv.setIDVVer (cDv.getVer()); 7038 cMv.setIDVVId (iViewIndex); 7039 } 7040 7041 #if !(NTT_BUG_FIX_TK54) 7042 clipMv( cMv ); 7043 #endif 7044 bLoop_stop = true; 7045 7046 pcMvFieldSP[2*iPartition + uiCurrRefListId].setMvField(cMv, iPdmRefIdx); 7047 break; 7048 } 7049 } 7050 } 7051 } 7052 } 7053 } 7054 } 7055 7056 puhInterDirSP[iPartition] = (pcMvFieldSP[2*iPartition].getRefIdx()!=-1 ? 1: 0) + (pcMvFieldSP[2*iPartition+1].getRefIdx()!=-1 ? 2: 0); 7057 if (puhInterDirSP[iPartition] == 0) 7058 { 7059 puhInterDirSP[iPartition] = availableMcDc[0]; 7060 pcMvFieldSP[2*iPartition].setMvField(pacPdmMv[0], paiPdmRefIdx[0]); 7061 pcMvFieldSP[2*iPartition + 1].setMvField(pacPdmMv[1], paiPdmRefIdx[1]); 7062 7063 } 7064 if (iSPHeight + iSPWidth == 12) 7065 { 7066 if (puhInterDirSP[iPartition] == 3) 7067 { 7068 puhInterDirSP[iPartition] = 1; 7069 pcMvFieldSP[2*iPartition + 1].setMvField(TComMv(0,0), -1); 7070 } 7071 } 7072 iPartition ++; 7073 } 7074 } 7075 } 7076 } 7077 7078 iCurrPosX += ( iWidth >> 1 ); 7079 iCurrPosY += ( iHeight >> 1 ); 7080 } 7081 #endif 7082 7083 //////////////////////////////// 7084 /////// IvMC + IvMCShift /////// 7085 //////////////////////////////// 7086 7087 #if H_3D_SPIVMP 7088 if(m_pcSlice->getIsDepth()) 7089 { 7090 iCurrPosX += ( iWidth >> 1 ); 7091 iCurrPosY += ( iHeight >> 1 ); 7092 } 7093 for(Int iLoopCan = ( (m_pcSlice->getIsDepth() || getDBBPFlag(0)) ? 0 : 1 ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++) 7094 #else 7095 for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++) 7096 #endif 7097 { 7098 // iLoopCan == 0 --> IvMC 7099 // iLoopCan == 1 --> IvMCShift 7100 7101 Int iBaseCUAddr; 7102 Int iBaseAbsPartIdx; 7103 7104 Int offsetW = (iLoopCan == 0) ? 0 : ( ((iWidth /2)*4) + 4 ); 7105 Int offsetH = (iLoopCan == 0) ? 0 : ( ((iHeight/2)*4) + 4 ); 7106 7107 Int iBasePosX = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (cDv.getHor() + offsetW + 2 ) >> 2 ) ); 7108 Int iBasePosY = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (cDv.getVer() + offsetH + 2 ) >> 2 ) ); 7109 pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx ); 7110 7111 TComDataCU* pcBaseCU = pcBasePic->getCU( iBaseCUAddr ); 7112 if(!( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTRA )) 7113 { 7114 // Loop reference picture list of current slice (X in spec). 7115 for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ ) 7116 { 7117 RefPicList eCurrRefPicList = RefPicList( uiCurrRefListId ); 7118 7119 Bool stopLoop = false; 7120 // Loop reference picture list of candidate slice (Y in spec) 7121 for(Int iLoop = 0; iLoop < 2 && !stopLoop; ++iLoop) 7122 { 7123 RefPicList eBaseRefPicList = (iLoop ==1)? RefPicList( 1 - uiCurrRefListId ) : RefPicList( uiCurrRefListId ); 7124 TComMvField cBaseMvField; 7125 pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField ); 7126 Int iBaseRefIdx = cBaseMvField.getRefIdx(); 7127 if (iBaseRefIdx >= 0) 7128 { 7129 Int iBaseRefPOC = pcBaseCU->getSlice()->getRefPOC(eBaseRefPicList, iBaseRefIdx); 7130 if (iBaseRefPOC != pcSlice->getPOC()) 7131 { 7132 for (Int iPdmRefIdx = 0; iPdmRefIdx < pcSlice->getNumRefIdx( eCurrRefPicList ); iPdmRefIdx++) 7133 { 7134 if (iBaseRefPOC == pcSlice->getRefPOC(eCurrRefPicList, iPdmRefIdx)) 7135 { 7136 abPdmAvailable[ (uiCurrRefListId + (iLoopCan<<2)) ] = true; 7137 TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer()); 7138 #if H_3D_NBDV 7139 #if H_3D_IV_MERGE 7140 if( !bIsDepth ) 7141 { 7142 #endif 7143 cMv.setIDVFlag (true); 7144 cMv.setIDVHor (cDv.getHor()); 7145 cMv.setIDVVer (cDv.getVer()); 7146 cMv.setIDVVId (iViewIndex); 7147 #if H_3D_IV_MERGE 7148 } 7149 #endif 7150 #endif 7151 #if !(NTT_BUG_FIX_TK54) 7152 clipMv( cMv ); 7153 #endif 7154 paiPdmRefIdx [ (uiCurrRefListId + (iLoopCan<<2)) ] = iPdmRefIdx; 7155 pacPdmMv [ (uiCurrRefListId + (iLoopCan<<2)) ] = cMv; 7156 stopLoop = true; 7157 break; 7158 } 7159 } 7160 } 7161 } 7162 } 7163 } 7164 } 7165 } 7166 #if H_3D_SPIVMP 7167 for(Int iLoopCan = ( (m_pcSlice->getIsDepth() || getDBBPFlag(0)) ? 0 : 1 ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++) 7168 #else 7169 for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++) 7170 #endif 7171 { 7172 availableMcDc[(iLoopCan << 1)] = ( abPdmAvailable[(iLoopCan<<2)] ? 1 : 0 ) + ( abPdmAvailable[1 + (iLoopCan<<2)] ? 2 : 0); 7173 } 7174 7175 } 7176 7177 //////////////////////////////// 7178 /////// IvDC + IvDCShift /////// 7179 //////////////////////////////// 7180 7181 if( !getSlice()->getIsDepth() ) 7182 { 7183 for( Int iRefListId = 0; iRefListId < 2 ; iRefListId++ ) 7184 { 7185 RefPicList eRefPicListDMV = RefPicList( iRefListId ); 7186 Int iNumRefPics = pcSlice->getNumRefIdx( eRefPicListDMV ); 7187 for( Int iPdmRefIdx = 0; iPdmRefIdx < iNumRefPics; iPdmRefIdx++ ) 7188 { 7189 if(( pcSlice->getRefPOC( eRefPicListDMV, iPdmRefIdx ) == pcSlice->getPOC()) && (pcSlice->getRefPic( eRefPicListDMV, iPdmRefIdx )->getViewIndex() == pDInfo->m_aVIdxCan)) 7190 { 7191 for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++) 7192 { 7193 Int ioffsetDV = (iLoopCan == 0) ? 0 : 4; 7194 abPdmAvailable[ iRefListId + 2 + (iLoopCan<<2) ] = true; 7195 paiPdmRefIdx [ iRefListId + 2 + (iLoopCan<<2) ] = iPdmRefIdx; 7196 #if H_3D_NBDV_REF 7197 TComMv cMv = depthRefineFlag ? pDInfo->m_acDoNBDV : pDInfo->m_acNBDV; 7198 #endif 7199 cMv.setHor( cMv.getHor() + ioffsetDV ); 7200 #if H_3D_IV_MERGE 7201 if( bIsDepth ) 7202 { 7203 cMv.setHor((cMv.getHor()+2)>>2); 7204 } 7205 #endif 7206 cMv.setVer( 0 ); 7207 #if !(NTT_BUG_FIX_TK54) 7208 clipMv( cMv ); 7209 #endif 7210 pacPdmMv [iRefListId + 2 + (iLoopCan<<2)] = cMv; 7211 } 7212 break; 7213 } 7214 } 7215 } 7216 for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++) 7217 { 7218 availableMcDc[1 + (iLoopCan << 1)] = ( abPdmAvailable[2 + (iLoopCan<<2)] ? 1 : 0 ) + ( abPdmAvailable[3 + (iLoopCan<<2)] ? 2 : 0 ); 7219 } 7220 } 7221 return false; 7222 } 7223 #endif 7224 #if H_3D_ARP 7225 Void TComDataCU::setARPWSubParts ( UChar w, UInt uiAbsPartIdx, UInt uiDepth ) 7226 { 7227 assert( sizeof( *m_puhARPW) == 1 ); 7228 memset( m_puhARPW + uiAbsPartIdx, w, m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ) ); 7229 } 7230 #endif 7231 7232 #if H_3D_IC 7233 Void TComDataCU::setICFlagSubParts( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 7234 { 7235 memset( m_pbICFlag + uiAbsPartIdx, bICFlag, (m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ))*sizeof(Bool) ); 7236 } 7237 7238 Bool TComDataCU::isICFlagRequired( UInt uiAbsPartIdx ) 7239 { 7240 UInt uiPartAddr; 7241 UInt iNumbPart; 7242 7243 if( !( getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) ) 7244 { 7245 return false; 7246 } 7247 7248 if( getSlice()->getIcSkipParseFlag() ) 7249 { 7250 if( getMergeFlag( uiAbsPartIdx ) && getMergeIndex( uiAbsPartIdx ) == 0 ) 7251 { 7252 return false; 7253 } 7254 } 7255 7256 if( getMergeFlag( uiAbsPartIdx ) ) 7257 { 7258 return true; 7259 } 7260 7261 7262 Int iWidth, iHeight; 7263 7264 iNumbPart = ( getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ? 1 : ( getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ? 4 : 2 ) ); 7265 7266 for(UInt i = 0; i < iNumbPart; i++) 7267 { 7268 getPartIndexAndSize( i, uiPartAddr, iWidth, iHeight, uiAbsPartIdx, true ); 7269 uiPartAddr += uiAbsPartIdx; 7270 7271 for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++) 7272 { 7273 RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 7274 Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr); 7275 7276 if( ( getInterDir( uiPartAddr ) & ( uiRefIdx+1 ) ) && iBestRefIdx >= 0 && getSlice()->getViewIndex() != getSlice()->getRefPic( eRefList, iBestRefIdx )->getViewIndex() ) 7277 { 7278 return true; 7279 } 7280 } 7281 } 7282 7283 return false; 7284 } 7285 #endif 7286 #if H_3D_DIM_DMM 7287 Void TComDataCU::setDmmWedgeTabIdxSubParts( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth ) 7288 { 7289 UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); 7290 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmmWedgeTabIdx[dmmType][uiAbsPartIdx+ui] = tabIdx; } 7291 } 7292 #endif 7293 7294 #if H_3D_VSP 7295 Void TComDataCU::setMvFieldPUForVSP( TComDataCU* pcCU, UInt partAddr, Int width, Int height, RefPicList eRefPicList, Int iRefIdx, Int &vspSize ) 7296 { 7297 // Get depth reference 7298 Int depthRefViewIdx = pcCU->getDvInfo(partAddr).m_aVIdxCan; 7299 7300 #if H_3D_FCO_VSP_DONBDV_E0163 7301 TComPic* pRefPicBaseDepth = 0; 7302 Bool bIsCurrDepthCoded = false; 7303 pRefPicBaseDepth = pcCU->getSlice()->getIvPic( true, pcCU->getSlice()->getViewIndex() ); 7304 if ( pRefPicBaseDepth->getPicYuvRec() != NULL ) 7305 { 7306 bIsCurrDepthCoded = true; 7307 } 7308 else 7309 { 7310 pRefPicBaseDepth = pcCU->getSlice()->getIvPic (true, depthRefViewIdx ); 7311 } 7312 #else 7313 TComPic* pRefPicBaseDepth = pcCU->getSlice()->getIvPic (true, depthRefViewIdx ); 7314 #endif 7315 assert(pRefPicBaseDepth != NULL); 7316 TComPicYuv* pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec(); 7317 assert(pcBaseViewDepthPicYuv != NULL); 7318 pcBaseViewDepthPicYuv->extendPicBorder(); 7319 7320 // Get texture reference 7321 assert(iRefIdx >= 0); 7322 TComPic* pRefPicBaseTxt = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx ); 7323 TComPicYuv* pcBaseViewTxtPicYuv = pRefPicBaseTxt->getPicYuvRec(); 7324 assert(pcBaseViewTxtPicYuv != NULL); 7325 7326 // Initialize LUT according to the reference viewIdx 7327 Int txtRefViewIdx = pRefPicBaseTxt->getViewIndex(); 7328 Int* pShiftLUT = pcCU->getSlice()->getDepthToDisparityB( txtRefViewIdx ); 7329 assert( txtRefViewIdx < pcCU->getSlice()->getViewIndex() ); 7330 7331 // prepare Dv to access depth map or reference view 7332 TComMv cDv = pcCU->getDvInfo(partAddr).m_acNBDV; 7333 pcCU->clipMv(cDv); 7334 7335 #if H_3D_FCO_VSP_DONBDV_E0163 7336 if ( bIsCurrDepthCoded ) 7337 { 7338 cDv.setZero(); 7339 } 7340 #endif 7341 7342 // fetch virtual depth map & convert depth to motion vector, which are stored in the motion memory 7343 xSetMvFieldForVSP( pcCU, pcBaseViewDepthPicYuv, &cDv, partAddr, width, height, pShiftLUT, eRefPicList, iRefIdx, pcCU->getSlice()->getIsDepth(), vspSize ); 7344 } 7345 7346 Void TComDataCU::xSetMvFieldForVSP( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, Int *shiftLUT, RefPicList refPicList, Int refIdx, Bool isDepth, Int &vspSize ) 7347 { 7348 TComCUMvField *cuMvField = cu->getCUMvField( refPicList ); 7349 Int partAddrRasterSubPULine = g_auiZscanToRaster[ partAddr ]; 7350 Int numPartsLine = cu->getPic()->getNumPartInWidth(); 7351 7352 Int nTxtPerMvInfoX = 4; // cu->getPic()->getMinCUWidth(); 7353 Int nTxtPerMvInfoY = 4; // cu->getPic()->getMinCUHeight(); 7354 7355 Int refDepStride = picRefDepth->getStride(); 7356 7357 TComMv tmpMv(0, 0); 7358 tmpMv.setIDVFlag(false); 7359 7360 Int refDepOffset = ( (dv->getHor()+2) >> 2 ) + ( (dv->getVer()+2) >> 2 ) * refDepStride; 7361 Pel *refDepth = picRefDepth->getLumaAddr( cu->getAddr(), cu->getZorderIdxInCU() + partAddr ) + refDepOffset; 7362 7363 if ((height % 8)) 7364 { 7365 vspSize = 1; // 8x4 7366 } 7367 else if ((width % 8)) 7368 { 7369 vspSize = 0; // 4x8 7370 } 7371 else 7372 { 7373 Bool ULvsBR, URvsBL; 7374 ULvsBR = refDepth[0] < refDepth[refDepStride * (height-1) + width-1]; 7375 URvsBL = refDepth[width-1] < refDepth[refDepStride * (height-1)]; 7376 vspSize = ( ULvsBR ^ URvsBL ) ? 0 : 1; 7377 } 7378 7379 Int subBlockW, subBlockH; 7380 if (vspSize) 7381 { 7382 subBlockW = 8; 7383 subBlockH = 4; 7384 } 7385 else 7386 { 7387 subBlockW = 4; 7388 subBlockH = 8; 7389 } 7390 7391 Int numPartsInSubPUW = subBlockW / nTxtPerMvInfoX; 7392 Int numPartsInSubPUH = subBlockH / nTxtPerMvInfoY * numPartsLine; 7393 7394 for( Int y=0; y<height; y+=subBlockH, partAddrRasterSubPULine+=numPartsInSubPUH ) 7395 { 7396 Pel *refDepthTmp[4]; 7397 refDepthTmp[0] = refDepth + refDepStride * y; 7398 refDepthTmp[1] = refDepthTmp[0] + subBlockW - 1; 7399 refDepthTmp[2] = refDepthTmp[0] + refDepStride * (subBlockH - 1); 7400 refDepthTmp[3] = refDepthTmp[2] + subBlockW - 1; 7401 7402 Int partAddrRasterSubPU = partAddrRasterSubPULine; 7403 for( Int x=0; x<width; x+=subBlockW, partAddrRasterSubPU+=numPartsInSubPUW ) 7404 { 7405 Pel maxDepthVal; 7406 maxDepthVal = refDepthTmp[0][x]; 7407 maxDepthVal = std::max( maxDepthVal, refDepthTmp[1][x]); 7408 maxDepthVal = std::max( maxDepthVal, refDepthTmp[2][x]); 7409 maxDepthVal = std::max( maxDepthVal, refDepthTmp[3][x]); 7410 tmpMv.setHor( (Short) shiftLUT[ maxDepthVal ] ); 7411 7412 Int partAddrRasterPartLine = partAddrRasterSubPU; 7413 for( Int sY=0; sY<numPartsInSubPUH; sY+=numPartsLine, partAddrRasterPartLine += numPartsLine ) 7414 { 7415 Int partAddrRasterPart = partAddrRasterPartLine; 7416 for( Int sX=0; sX<numPartsInSubPUW; sX+=1, partAddrRasterPart++ ) 7417 { 7418 cuMvField->setMv ( g_auiRasterToZscan[ partAddrRasterPart ], tmpMv ); 7419 cuMvField->setRefIdx( g_auiRasterToZscan[ partAddrRasterPart ], refIdx ); 7420 } 7421 } 7422 } 7423 } 7424 7425 vspSize = (vspSize<<2)+1; 7426 7427 } 7428 #endif 3463 3464 3465 3466 3467 7429 3468 7430 3469 //! \} -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComDataCU.h
r1039 r1072 49 49 #include "TComPattern.h" 50 50 51 #if H_3D_ARP52 #include "TComYuv.h"53 #endif54 51 55 52 #include <algorithm> … … 60 57 61 58 62 #if H_3D_DBBP63 typedef struct _DBBPTmpData64 {65 TComMv acMvd[2][2]; // for two segments and two lists66 TComMvField acMvField[2][2]; // for two segments and two lists67 Int aiMvpNum[2][2]; // for two segments and two lists68 Int aiMvpIdx[2][2]; // for two segments and two lists69 UChar auhInterDir[2]; // for two segments70 Bool abMergeFlag[2]; // for two segments71 UChar auhMergeIndex[2]; // for two segments72 PartSize eVirtualPartSize;73 UInt uiVirtualPartIndex;74 } DBBPTmpData;75 #endif76 59 77 60 // ==================================================================================================================== … … 110 93 // ------------------------------------------------------------------------------------------------------------------- 111 94 Bool* m_skipFlag; ///< array of skip flags 112 #if MTK_SINGLE_DEPTH_MODE_I0095113 Bool* m_singleDepthFlag; ///< array of single depth flags114 Pel* m_apSingleDepthValue;115 #endif116 95 Char* m_pePartSize; ///< array of partition sizes 117 96 Char* m_pePredMode; ///< array of prediction modes … … 169 148 Char* m_apiMVPNum[2]; ///< array of number of possible motion vectors predictors 170 149 Bool* m_pbIPCMFlag; ///< array of intra_pcm flags 171 #if H_3D_NBDV172 DisInfo* m_pDvInfo;173 #endif174 #if H_3D_VSP175 Char* m_piVSPFlag; ///< array of VSP flags to indicate whehter a block uses VSP or not176 ///< 0: non-VSP; 1: VSP177 #endif178 #if H_3D_SPIVMP179 Bool* m_pbSPIVMPFlag; ///< array of sub-PU IVMP flags to indicate whehter a block uses sub-PU IVMP180 ///< 0: non-SPIVMP; 1: SPIVMP181 #endif182 #if H_3D_ARP183 UChar* m_puhARPW;184 #endif185 #if H_3D_IC186 Bool* m_pbICFlag; ///< array of IC flags187 #endif188 #if H_3D_DIM189 Pel* m_dimDeltaDC[DIM_NUM_TYPE][2];190 #if H_3D_DIM_DMM191 UInt* m_dmmWedgeTabIdx[DMM_NUM_TYPE];192 #endif193 #if H_3D_DIM_SDC194 Bool* m_pbSDCFlag;195 Pel* m_apSegmentDCOffset[2];196 Pel m_apDmmPredictor[2];197 #endif198 #endif199 #if H_3D_DBBP200 Bool* m_pbDBBPFlag; ///< array of DBBP flags201 DBBPTmpData m_sDBBPTmpData;202 #endif203 #if H_3D204 Bool m_bAvailableFlagA1; ///< A1 available flag205 Bool m_bAvailableFlagB1; ///< B1 available flag206 Bool m_bAvailableFlagB0; ///< B0 available flag207 Bool m_bAvailableFlagA0; ///< A0 available flag208 Bool m_bAvailableFlagB2; ///< B2 available flag209 #endif210 150 // ------------------------------------------------------------------------------------------------------------------- 211 151 // misc. variables … … 214 154 Bool m_bDecSubCu; ///< indicates decoder-mode 215 155 Double m_dTotalCost; ///< sum of partition RD costs 216 #if H_3D_VSO217 Dist m_uiTotalDistortion; ///< sum of partition distortion218 #else219 156 UInt m_uiTotalDistortion; ///< sum of partition distortion 220 #endif221 157 UInt m_uiTotalBits; ///< sum of partition bits 222 158 UInt m_uiTotalBins; ///< sum of partition bins … … 224 160 UInt* m_sliceSegmentStartCU; ///< Start CU address of current slice 225 161 Char m_codedQP; 226 #if H_3D 227 DisInfo m_cDefaultDisInfo; ///< Default disparity information for initializing 228 #endif 229 230 #if H_3D_DDD 231 UChar* m_pucDisparityDerivedDepth; 232 Bool* m_pbUseDDD; 233 Int m_iUseDDDCandIdx; 234 UChar m_ucDDTmpDepth; 235 #endif 236 237 #if H_3D_IV_MERGE 238 TComMotionCand m_mergCands[MRG_IVSHIFT+1]; 239 Int m_baseListidc; 240 #endif 162 163 241 164 242 165 protected: … … 245 168 Bool xAddMVPCand ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); 246 169 Bool xAddMVPCandOrder ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); 247 #if H_3D_VSP248 Bool xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount);249 #endif250 #if H_3D_IV_MERGE251 Bool xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Int* ivCandDir, TComMv* ivCandMv, Int* ivCandRefIdx );252 #if! SEC_SIMP_SHIFTED_DV_I0086253 Bool xGetPosFirstAvailDmvCand( Int iCount, Int& iFirDispCand );254 #endif255 #endif256 170 257 171 Void deriveRightBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxRB ); 258 172 Bool xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx 259 #if H_3D_TMVP260 ,261 Bool bMRG = true262 #endif263 173 ); 264 174 … … 268 178 269 179 /// compute scaling factor from POC difference 270 #if !H_3D_ARP271 180 Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); 272 #endif273 181 274 182 Void xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter ); 275 183 276 #if H_3D_VSP277 Void xSetMvFieldForVSP ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, Int *shiftLUT, RefPicList refPicList, Int refIdx, Bool isDepth, Int &vspSize );278 #endif279 184 280 185 public: … … 285 190 // create / destroy / initialize / copy 286 191 // ------------------------------------------------------------------------------------------------------------------- 287 #if H_3D_ARP288 Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );289 #endif290 192 Void create ( UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize 291 193 #if ADAPTIVE_QP_SELECTION … … 299 201 Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ); 300 202 Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth ); 301 #if H_3D_NBDV302 Void copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx);303 #endif304 203 Void copySubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); 305 204 Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList 306 #if H_3D_NBDV307 , Bool bNBDV = false308 #endif309 205 ); 310 206 Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); … … 331 227 332 228 Void setDepthSubParts ( UInt uiDepth, UInt uiAbsPartIdx ); 333 #if H_3D334 Void getPosInPic ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY );335 #endif336 229 337 230 // ------------------------------------------------------------------------------------------------------------------- … … 345 238 Void setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth ); 346 239 347 #if H_3D_DBBP348 Pel* getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride);349 #endif350 240 351 241 Bool* getSkipFlag () { return m_skipFlag; } … … 353 243 Void setSkipFlag ( UInt idx, Bool skip) { m_skipFlag[idx] = skip; } 354 244 Void setSkipFlagSubParts ( Bool skip, UInt absPartIdx, UInt depth ); 355 #if MTK_SINGLE_DEPTH_MODE_I0095356 Bool* getSingleDepthFlag () { return m_singleDepthFlag; }357 Bool getSingleDepthFlag (UInt idx) { return m_singleDepthFlag[idx]; }358 Void setSingleDepthFlag ( UInt idx, Bool singleDepth) { m_singleDepthFlag[idx] = singleDepth; }359 Void setSingleDepthFlagSubParts ( Bool singleDepth, UInt absPartIdx, UInt depth );360 361 Pel* getSingleDepthValue( ) { return m_apSingleDepthValue; }362 Pel getSingleDepthValue (UInt idx) { return m_apSingleDepthValue[idx]; }363 Void setSingleDepthValue ( UInt idx, Pel pDepthValue) { m_apSingleDepthValue[idx] = pDepthValue; }364 Void setSingleDepthValueSubParts (Pel singleDepthValue, UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth );365 #endif366 245 Char* getPredictionMode () { return m_pePredMode; } 367 246 PredMode getPredictionMode ( UInt uiIdx ) { return static_cast<PredMode>( m_pePredMode[uiIdx] ); } … … 371 250 Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ); 372 251 373 #if H_3D_DBBP374 Bool* getDBBPFlag () { return m_pbDBBPFlag; }375 Bool getDBBPFlag ( UInt uiIdx ) { return m_pbDBBPFlag[uiIdx]; }376 Void setDBBPFlag ( UInt uiIdx, Bool b ) { m_pbDBBPFlag[uiIdx] = b; }377 Void setDBBPFlagSubParts ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );378 DBBPTmpData* getDBBPTmpData () { return &m_sDBBPTmpData; }379 #endif380 252 381 253 UChar* getWidth () { return m_puhWidth; } … … 453 325 template <typename T> 454 326 Void setSubPart ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); 455 #if H_3D_VSP456 template<typename T>457 Void setSubPartT ( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );458 #endif459 327 #if AMP_MRG 460 328 Void setMergeAMP( Bool b ) { m_bIsMergeAMP = b; } … … 480 348 Void setIPCMFlag (UInt uiIdx, Bool b ) { m_pbIPCMFlag[uiIdx] = b; } 481 349 Void setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth); 482 #if H_3D_NBDV483 Void setDvInfoSubParts ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth );484 Void setDvInfoSubParts ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth);485 DisInfo* getDvInfo () { return m_pDvInfo; }486 DisInfo getDvInfo (UInt uiIdx) { return m_pDvInfo[uiIdx]; }487 #endif488 #if H_3D_NBDV489 Void xDeriveRightBottomNbIdx(Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb );490 Bool xCheckSpatialNBDV (TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo,491 UInt uiMvpDvPos492 #if H_3D_NBDV_REF493 , Bool bDepthRefine = false494 #endif495 );496 Bool xGetColDisMV ( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );497 Bool getDisMvpCandNBDV ( DisInfo* pDInfo498 #if H_3D_NBDV_REF499 , Bool bDepthRefine = false500 #endif501 );502 503 #if H_3D504 Bool getDispforDepth ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp);505 Bool getDispMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDis, Int* iPdm );506 #endif507 #if MTK_SINGLE_DEPTH_MODE_I0095508 Bool getNeighDepth (UInt uiPartIdx, UInt uiPartAddr, Pel* pNeighDepth, Int index);509 #endif510 #if H_3D_NBDV_REF511 Pel getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT );512 Void estimateDVFromDM(Int refViewIdx, UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred );513 #endif //H_3D_NBDV_REF514 #endif515 #if H_3D_FAST_TEXTURE_ENCODING516 Void getIVNStatus ( UInt uiPartIdx, DisInfo* pDInfo, Bool& bIVFMerge, Int& iIVFMaxD);517 #endif518 #if H_3D_SPIVMP519 Void getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight);520 Void getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr );521 Void setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight );522 #endif523 #if H_3D_IV_MERGE524 Bool getInterViewMergeCands ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc, Bool bIsDepth525 526 #if H_3D_SPIVMP527 , TComMvField* pcMFieldSP, UChar* puhInterDirSP528 #endif529 , Bool bICFlag530 );531 #endif532 #if H_3D_ARP533 UChar* getARPW () { return m_puhARPW; }534 UChar getARPW ( UInt uiIdx ) { return m_puhARPW[uiIdx]; }535 Void setARPW ( UInt uiIdx, UChar w ) { m_puhARPW[uiIdx] = w; }536 Void setARPWSubParts ( UChar w, UInt uiAbsPartIdx, UInt uiDepth );537 Double getARPWFactor ( UInt uiIdx );538 #endif539 #if H_3D_IC540 Bool* getICFlag () { return m_pbICFlag; }541 Bool getICFlag ( UInt uiIdx ) { return m_pbICFlag[uiIdx]; }542 Void setICFlag ( UInt uiIdx, Bool uh ) { m_pbICFlag[uiIdx] = uh; }543 Void setICFlagSubParts ( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );544 Bool isICFlagRequired ( UInt uiAbsPartIdx );545 Void getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false);546 #else547 350 // ------------------------------------------------------------------------------------------------------------------- 548 351 // member functions for accessing partition information … … 550 353 551 354 Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ); 552 #endif553 355 UChar getNumPartitions (); 554 356 Bool isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth); 555 357 556 #if H_3D_DIM557 Pel* getDimDeltaDC ( UInt dimType, UInt segId ) { return m_dimDeltaDC[dimType][segId]; }558 Pel getDimDeltaDC ( UInt dimType, UInt segId, UInt uiIdx ) { return m_dimDeltaDC[dimType][segId][uiIdx]; }559 Void setDimDeltaDC ( UInt dimType, UInt segId, UInt uiIdx, Pel val ) { m_dimDeltaDC[dimType][segId][uiIdx] = val; }560 #if H_3D_DIM_DMM561 UInt* getDmmWedgeTabIdx ( UInt dmmType ) { return m_dmmWedgeTabIdx[dmmType]; }562 UInt getDmmWedgeTabIdx ( UInt dmmType, UInt uiIdx ) { return m_dmmWedgeTabIdx[dmmType][uiIdx]; }563 Void setDmmWedgeTabIdx ( UInt dmmType, UInt uiIdx, UInt tabIdx ) { m_dmmWedgeTabIdx[dmmType][uiIdx] = tabIdx; }564 Void setDmmWedgeTabIdxSubParts ( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth );565 566 #endif567 #if H_3D_DIM_SDC568 Bool* getSDCFlag () { return m_pbSDCFlag; }569 Bool getSDCFlag ( UInt uiIdx ) { return m_pbSDCFlag[uiIdx]; }570 Void setSDCFlagSubParts ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiDepth );571 572 Bool getSDCAvailable ( UInt uiAbsPartIdx );573 574 Pel* getSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentDCOffset[uiSeg]; }575 Pel getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; }576 Void setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; }577 Void setDmmPredictor ( Pel pOffset, UInt uiSeg) { m_apDmmPredictor[uiSeg] = pOffset; }578 Pel getDmmPredictor ( UInt uiSeg) { return m_apDmmPredictor[uiSeg]; }579 UInt getCtxSDCFlag ( UInt uiAbsPartIdx );580 #endif581 #endif582 358 583 359 // ------------------------------------------------------------------------------------------------------------------- … … 605 381 Void getMvPredAbove ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldB.getMv(); } 606 382 Void getMvPredAboveRight ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldC.getMv(); } 607 #if H_3D608 Void compressMV ( Int scale );609 #else610 383 Void compressMV (); 611 #endif612 384 // ------------------------------------------------------------------------------------------------------------------- 613 385 // utility functions for neighbouring information … … 649 421 Bool hasEqualMotion ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); 650 422 651 #if H_3D652 Bool getAvailableFlagA1() { return m_bAvailableFlagA1;}653 Bool getAvailableFlagB1() { return m_bAvailableFlagB1;}654 Bool getAvailableFlagB0() { return m_bAvailableFlagB0;}655 Bool getAvailableFlagA0() { return m_bAvailableFlagA0;}656 Bool getAvailableFlagB2() { return m_bAvailableFlagB2;}657 Void initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0; }658 Void buildMCL(TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours659 #if H_3D_VSP660 , Int* vspFlag661 #endif662 #if H_3D_SPIVMP663 , Bool* pbSPIVMPFlag664 #endif665 , Int& numValidMergeCand666 );667 Void getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1);668 Void xGetInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours669 #else670 423 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours 671 #endif672 #if H_3D_VSP && !FIX_TICKET_79673 , InheritedVSPDisInfo* inheritedVSPDisInfo674 #endif675 #if H_3D_SPIVMP676 , TComMvField* pcMvFieldSP, UChar* puhInterDirSP677 #endif678 424 , Int& numValidMergeCand, Int mrgCandIdx = -1 679 425 ); 680 426 681 #if H_3D_VSP682 #if !FIX_TICKET_76683 inline Void xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount, InheritedVSPDisInfo* inheritedVSPDisInfo);684 #endif685 686 #if H_3D_SPIVMP687 Bool* getSPIVMPFlag () { return m_pbSPIVMPFlag; }688 Bool getSPIVMPFlag ( UInt uiIdx ) { return m_pbSPIVMPFlag[uiIdx]; }689 Void setSPIVMPFlag ( UInt uiIdx, Bool n ) { m_pbSPIVMPFlag[uiIdx] = n; }690 Void setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );691 #endif692 693 Char* getVSPFlag () { return m_piVSPFlag; }694 Char getVSPFlag ( UInt uiIdx ) { return m_piVSPFlag[uiIdx]; }695 Void setVSPFlag ( UInt uiIdx, Int n ) { m_piVSPFlag[uiIdx] = n; }696 Void setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );697 Void setMvFieldPUForVSP ( TComDataCU* cu, UInt partAddr, Int width, Int height, RefPicList refPicList, Int refIdx, Int &vspSize );698 #endif699 427 Void deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); 700 428 Void deriveLeftBottomIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ); … … 709 437 Bool isBipredRestriction( UInt puIdx ); 710 438 711 #if H_3D_IC712 Bool isIC ( UInt uiPartIdx );713 #endif714 439 715 440 // ------------------------------------------------------------------------------------------------------------------- … … 732 457 UInt getCtxInterDir ( UInt uiAbsPartIdx ); 733 458 734 #if H_3D_ARP735 UInt getCTXARPWFlag ( UInt uiAbsPartIdx );736 #endif737 459 UInt getSliceStartCU ( UInt pos ) { return m_sliceStartCU[pos-m_uiAbsIdxInLCU]; } 738 460 UInt getSliceSegmentStartCU ( UInt pos ) { return m_sliceSegmentStartCU[pos-m_uiAbsIdxInLCU]; } … … 743 465 744 466 Double& getTotalCost() { return m_dTotalCost; } 745 #if H_3D_VSO746 Dist& getTotalDistortion() { return m_uiTotalDistortion; }747 #else748 467 UInt& getTotalDistortion() { return m_uiTotalDistortion; } 749 #endif750 468 UInt& getTotalBits() { return m_uiTotalBits; } 751 469 UInt& getTotalNumPart() { return m_uiNumPartition; } … … 753 471 UInt getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra); 754 472 755 #if H_3D_DDD 756 UChar* getDDDepth () { return m_pucDisparityDerivedDepth; } 757 UChar getDDDepth ( UInt uiIdx ) { return m_pucDisparityDerivedDepth[uiIdx]; } 758 Void setDDDepth ( UInt uiIdx, UChar n ) { m_pucDisparityDerivedDepth[uiIdx] = n; } 759 Void setDDDepthSubParts( UChar ucDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 760 761 Bool* getUseDDD () { return m_pbUseDDD; } 762 Bool getUseDDD ( UInt uiIdx ) { return m_pbUseDDD[uiIdx]; } 763 Void setUseDDD ( UInt uiIdx, Bool n ) { m_pbUseDDD[uiIdx] = n; } 764 Void setUseDDD( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiDepth ); 765 766 Void setUseDDD ( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 767 768 UChar getDDTmpDepth(){ return m_ucDDTmpDepth; } 769 Int getUseDDDCandIdx(){ return m_iUseDDDCandIdx;} 770 771 #endif 772 773 #if SHARP_DMM1_I0110 774 Bool isDMM1UpscaleMode ( UInt uiWidth ){ Bool bDMM1UpsampleModeFlag = true; UInt uiBaseWidth = 16; if( uiBaseWidth >= uiWidth ){ bDMM1UpsampleModeFlag = false; } return bDMM1UpsampleModeFlag; }; 775 UInt getDMM1BasePatternWidth ( UInt uiWidth ){ UInt uiBaseWidth = 16; if( uiBaseWidth >= uiWidth ){ uiBaseWidth = uiWidth; } return uiBaseWidth; } 776 #endif 473 777 474 778 475 }; -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComInterpolationFilter.cpp
r872 r1072 73 73 }; 74 74 75 #if H_3D_ARP76 const Short TComInterpolationFilter::m_lumaFilterARP[4][NTAPS_LUMA_ARP] =77 {78 {64, 0},79 {48, 16},80 {32, 32},81 {16, 48}82 };83 const Short TComInterpolationFilter::m_chromaFilterARP[8][NTAPS_CHROMA_ARP] =84 {85 {64, 0},86 {56, 8},87 {48, 16},88 {40, 24},89 {32, 32},90 {24, 40},91 {16, 48},92 {8, 56}93 };94 #endif95 75 96 76 // ==================================================================================================================== … … 347 327 */ 348 328 Void TComInterpolationFilter::filterHorLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast 349 #if H_3D_ARP350 , Bool filterType351 #endif352 329 ) 353 330 { … … 360 337 else 361 338 { 362 #if H_3D_ARP363 if(filterType)364 {365 filterHor<NTAPS_LUMA_ARP>(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilterARP[frac]);366 }367 else368 {369 #endif370 339 filterHor<NTAPS_LUMA>(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]); 371 #if H_3D_ARP372 }373 #endif374 340 } 375 341 } … … 389 355 */ 390 356 Void TComInterpolationFilter::filterVerLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast 391 #if H_3D_ARP392 , Bool filterType393 #endif394 357 ) 395 358 { … … 402 365 else 403 366 { 404 #if H_3D_ARP405 if(filterType)406 {407 filterVer<NTAPS_LUMA_ARP>(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilterARP[frac]);408 }409 else410 {411 #endif412 367 filterVer<NTAPS_LUMA>(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]); 413 #if H_3D_ARP414 }415 #endif416 368 } 417 369 } … … 430 382 */ 431 383 Void TComInterpolationFilter::filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast 432 #if H_3D_ARP433 , Bool filterType434 #endif435 384 ) 436 385 { … … 443 392 else 444 393 { 445 #if H_3D_ARP446 if(filterType)447 {448 filterHor<NTAPS_CHROMA_ARP>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilterARP[frac]);449 }450 else451 {452 #endif453 394 filterHor<NTAPS_CHROMA>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac]); 454 #if H_3D_ARP455 }456 #endif457 395 } 458 396 } … … 472 410 */ 473 411 Void TComInterpolationFilter::filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast 474 #if H_3D_ARP475 , Bool filterType476 #endif477 412 ) 478 413 { … … 485 420 else 486 421 { 487 #if H_3D_ARP488 if(filterType)489 {490 filterVer<NTAPS_CHROMA_ARP>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilterARP[frac]);491 }492 else493 {494 #endif495 422 filterVer<NTAPS_CHROMA>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac]); 496 #if H_3D_ARP497 }498 #endif499 423 } 500 424 } -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComInterpolationFilter.h
r872 r1072 45 45 //! \{ 46 46 47 #if H_3D_ARP48 #define NTAPS_LUMA_ARP 2 ///< Number of taps for luma49 #define NTAPS_CHROMA_ARP 2 ///< Number of taps for chroma50 #endif51 47 52 48 #define NTAPS_LUMA 8 ///< Number of taps for luma … … 63 59 static const Short m_lumaFilter[4][NTAPS_LUMA]; ///< Luma filter taps 64 60 static const Short m_chromaFilter[8][NTAPS_CHROMA]; ///< Chroma filter taps 65 #if H_3D_ARP66 static const Short m_lumaFilterARP [4][NTAPS_LUMA_ARP]; ///< Luma filter taps for ARP67 static const Short m_chromaFilterARP[8][NTAPS_CHROMA_ARP]; ///< Chroma filter taps for ARP68 #endif69 61 static Void filterCopy(Int bitDepth, const Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast); 70 62 … … 82 74 83 75 Void filterHorLuma (Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast 84 #if H_3D_ARP85 , Bool filterType = false86 #endif87 76 ); 88 77 Void filterVerLuma (Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast 89 #if H_3D_ARP90 , Bool filterType = false91 #endif92 78 ); 93 79 Void filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast 94 #if H_3D_ARP95 , Bool filterType = false96 #endif97 80 ); 98 81 Void filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast 99 #if H_3D_ARP100 , Bool filterType = false101 #endif102 82 ); 103 83 }; -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComMotionInfo.cpp
r872 r1072 40 40 #include "assert.h" 41 41 #include <stdlib.h> 42 #if H_3D_SPIVMP43 #include "TComDataCU.h"44 #include "TComPic.h"45 #endif46 42 47 43 //! \ingroup TLibCommon … … 328 324 } 329 325 330 #if H_3D_SPIVMP331 Void TComCUMvField::setMvFieldSP( TComDataCU* pcCU, UInt uiAbsPartIdx, TComMvField cMvField, Int iWidth, Int iHeight )332 {333 uiAbsPartIdx += pcCU->getZorderIdxInCU();334 Int iStartPelX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIdx]];335 Int iStartPelY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIdx]];336 Int iEndPelX = iStartPelX + iWidth;337 Int iEndPelY = iStartPelY + iHeight;338 339 Int iCurrRaster, uiPartAddr;340 341 for (Int i=iStartPelY; i<iEndPelY; i+=pcCU->getPic()->getMinCUHeight())342 {343 for (Int j=iStartPelX; j < iEndPelX; j += pcCU->getPic()->getMinCUWidth())344 {345 iCurrRaster = i / pcCU->getPic()->getMinCUHeight() * pcCU->getPic()->getNumPartInWidth() + j/pcCU->getPic()->getMinCUWidth();346 uiPartAddr = g_auiRasterToZscan[iCurrRaster];347 uiPartAddr -= pcCU->getZorderIdxInCU();348 349 m_pcMv[uiPartAddr] = cMvField.getMv();350 m_piRefIdx[uiPartAddr] = cMvField.getRefIdx();351 }352 }353 }354 #endif355 326 356 327 /**Subsampling of the stored prediction mode, reference index and motion vector -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComMotionInfo.h
r1039 r1072 50 50 // ==================================================================================================================== 51 51 52 #if H_3D_SPIVMP53 class TComDataCU;54 #endif55 52 /// parameters for AMVP 56 53 typedef struct _AMVPInfo … … 60 57 } AMVPInfo; 61 58 62 #if H_3D_NBDV63 typedef struct _DisCand64 {65 Bool bDV;66 TComMv m_acNBDV; // DV from NBDV67 #if H_3D_NBDV_REF68 TComMv m_acDoNBDV; // DV from DoNBDV69 #endif70 Int m_aVIdxCan; // View order index (the same with the NBDV and the DoNBDV)71 } DisInfo;72 73 typedef struct _IDVCand // IDV74 {75 TComMv m_acMvCand[2][ IDV_CANDS ];76 Int m_aVIdxCan[2][ IDV_CANDS ];77 Bool m_bAvailab[2][ IDV_CANDS ];78 Bool m_bFound;79 } IDVInfo;80 #endif81 #if H_3D_VSP && !FIX_TICKET_7982 typedef struct _InheritedVSPDisCand83 {84 DisInfo m_acDvInfo;85 } InheritedVSPDisInfo;86 #endif87 59 // ==================================================================================================================== 88 60 // Class definition … … 113 85 Int getHor () const { return m_acMv.getHor(); } 114 86 Int getVer () const { return m_acMv.getVer(); } 115 #if H_3D_IV_MERGE116 Bool operator== ( const TComMvField& rcMv ) const117 {118 return (m_acMv.getHor()==rcMv.getHor() && m_acMv.getVer()==rcMv.getVer() && m_iRefIdx == rcMv.getRefIdx());119 }120 #endif121 87 }; 122 88 … … 173 139 Void setAllRefIdx ( Int iRefIdx, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 ); 174 140 Void setAllMvField( TComMvField const & mvField, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 ); 175 #if H_3D_SPIVMP176 Void setMvFieldSP ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComMvField cMvField, Int iWidth, Int iHeight );177 #endif178 #if H_3D_VSP179 Void setMv ( Int iIdx, TComMv const & rcMv ) { m_pcMv[iIdx] = rcMv; }180 Void setRefIdx ( Int iIdx, Int iRefIdx ) { m_piRefIdx[iIdx] = iRefIdx; }181 #endif182 141 183 142 Void setNumPartition( Int iNumPart ) … … 198 157 //! \} 199 158 200 #if H_3D_IV_MERGE201 class TComMotionCand202 {203 public:204 Bool m_bAvailable;205 TComMvField m_cMvField[2];206 UChar m_uDir;207 #if H_3D_VSP208 Int m_iVspFlag;209 #endif210 Bool m_bSPIVMPFlag;211 212 public:213 TComMotionCand()214 {215 m_bAvailable = false;216 m_uDir = 0;217 #if H_3D_VSP218 m_iVspFlag = 0;219 #endif220 m_bSPIVMPFlag = false;221 }222 223 ~TComMotionCand()224 {225 226 }227 228 Void init()229 {230 TComMv cZeroMv;231 232 m_bAvailable = false;233 m_uDir = 0;234 #if H_3D_VSP235 m_iVspFlag = 0;236 #endif237 m_bSPIVMPFlag = false;238 m_cMvField[0].setMvField(cZeroMv, NOT_VALID);239 m_cMvField[1].setMvField(cZeroMv, NOT_VALID);240 }241 242 Void setCand(TComMvField* pcMvFieldNeighbours, UChar uhInterDirNeighbours243 #if H_3D_VSP244 , Int vspFlag245 #endif246 , Bool bSPIVMPFlag247 )248 {249 m_bAvailable = true;250 m_cMvField[0] = pcMvFieldNeighbours[0];251 m_cMvField[1] = pcMvFieldNeighbours[1];252 m_uDir = uhInterDirNeighbours;253 #if H_3D_VSP254 m_iVspFlag = vspFlag;255 #endif256 m_bSPIVMPFlag = bSPIVMPFlag;257 }258 259 260 Void getCand(Int iCount, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours261 #if H_3D_VSP262 , Int* vspFlag263 #endif264 , Bool* pbSPIVMPFlag265 )266 {267 pcMvFieldNeighbours[iCount<<1] = m_cMvField[0];268 pcMvFieldNeighbours[(iCount<<1) + 1] = m_cMvField[1];269 puhInterDirNeighbours[iCount] = m_uDir;270 #if H_3D_VSP271 vspFlag[iCount] = m_iVspFlag;272 #endif273 pbSPIVMPFlag[iCount] = m_bSPIVMPFlag;274 }275 };276 #endif277 159 278 160 -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComMv.h
r872 r1072 55 55 Short m_iHor; ///< horizontal component of motion vector 56 56 Short m_iVer; ///< vertical component of motion vector 57 #if H_3D_NBDV58 Bool m_bIDV;59 Short m_iIDVHor;60 Short m_iIDVVer;61 Short m_iIDVVId; //view index of the IDV62 #endif63 57 public: 64 58 … … 70 64 m_iHor(0), 71 65 m_iVer(0) 72 #if H_3D_NBDV73 , m_bIDV(false)74 , m_iIDVHor(0)75 , m_iIDVVer(0)76 , m_iIDVVId(0)77 #endif78 66 { 79 67 } … … 82 70 m_iHor(iHor), 83 71 m_iVer(iVer) 84 #if H_3D_NBDV85 , m_bIDV(false)86 , m_iIDVHor(0)87 , m_iIDVVer(0)88 , m_iIDVVId(0)89 #endif90 72 { 91 73 } … … 99 81 Void setVer ( Short i ) { m_iVer = i; } 100 82 Void setZero () { m_iHor = m_iVer = 0; 101 #if H_3D_NBDV102 m_bIDV = false; m_iIDVHor = m_iIDVVer = 0;103 m_iIDVVId = 0;104 #endif105 83 } 106 #if H_3D_NBDV107 Void setIDVHor (Short i) {m_iIDVHor = i;}108 Void setIDVVer (Short i) {m_iIDVVer = i;}109 Void setIDVFlag (Bool b ) {m_bIDV = b;}110 Void setIDVVId (Short i) {m_iIDVVId = i;}111 #endif112 84 // ------------------------------------------------------------------------------------------------------------------ 113 85 // get … … 118 90 Int getAbsHor () const { return abs( m_iHor ); } 119 91 Int getAbsVer () const { return abs( m_iVer ); } 120 #if H_3D_NBDV121 Short getIDVHor () const { return m_iIDVHor; }122 Short getIDVVer () const { return m_iIDVVer; }123 Bool getIDVFlag() const { return m_bIDV; }124 Short getIDVVId () const { return m_iIDVVId; }125 126 #endif127 92 // ------------------------------------------------------------------------------------------------------------------ 128 93 // operations -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComPattern.h
r872 r1072 99 99 TComPatternParam m_cPatternCb; 100 100 TComPatternParam m_cPatternCr; 101 #if H_3D_IC102 Bool m_bICFlag;103 #endif104 #if H_3D_INTER_SDC105 Bool m_bSDCMRSADFlag;106 #endif107 101 static const UChar m_aucIntraFilter[5]; 108 102 … … 115 109 Int getPatternLStride() { return m_cPatternY.m_iPatternStride; } 116 110 117 #if H_3D_IC118 Bool getICFlag() { return m_bICFlag; }119 Void setICFlag( Bool bICFlag ) { m_bICFlag = bICFlag; }120 #endif121 #if H_3D_INTER_SDC122 Bool getSDCMRSADFlag() { return m_bSDCMRSADFlag; }123 Void setSDCMRSADFlag( Bool bSDCMRSADFlag ) { m_bSDCMRSADFlag = bSDCMRSADFlag; }124 #endif125 111 126 112 // access functions of ADI buffers -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComPic.cpp
r976 r1072 63 63 , m_layerId (0) 64 64 , m_viewId (0) 65 #if H_3D66 , m_viewIndex (0)67 , m_isDepth (false)68 , m_aaiCodedScale (0)69 , m_aaiCodedOffset (0)70 #endif71 65 #endif 72 66 { 73 67 m_apcPicYuv[0] = NULL; 74 68 m_apcPicYuv[1] = NULL; 75 #if H_3D_QTLPC76 m_bReduceBitsQTL = 0;77 #endif78 #if H_3D_NBDV79 m_iNumDdvCandPics = 0;80 m_eRapRefList = REF_PIC_LIST_0;81 m_uiRapRefIdx = 0;82 #endif83 69 } 84 70 … … 114 100 memcpy(m_numReorderPics, numReorderPics, MAX_TLAYER*sizeof(Int)); 115 101 116 #if H_3D_FCO117 /* initialize the texture to depth reference status */118 for (int j=0; j<2; j++)119 {120 for (int i=0; i<MAX_NUM_REF; i++)121 {122 m_aiTexToDepRef[j][i] = -1;123 }124 }125 #endif126 102 127 103 return; … … 153 129 deleteSEIs(m_SEIs); 154 130 } 155 #if H_3D156 Void TComPic::compressMotion(Int scale)157 #else158 131 Void TComPic::compressMotion() 159 #endif160 132 { 161 133 TComPicSym* pPicSym = getPicSym(); … … 163 135 { 164 136 TComDataCU* pcCU = pPicSym->getCU(uiCUAddr); 165 #if H_3D166 pcCU->compressMV(scale);167 #else168 137 pcCU->compressMV(); 169 #endif170 138 } 171 139 } … … 204 172 } 205 173 206 #if H_3D207 TComPic* TComPicLists::getPic( Int viewIndex, Bool depthFlag, Int poc )208 {209 return getPic ( m_vps->getLayerIdInNuh( viewIndex, depthFlag ), poc );210 }211 #endif212 174 Void TComPicLists::print() 213 175 { … … 250 212 } 251 213 252 #if H_3D253 TComPicYuv* TComPicLists::getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon )254 {255 Int layerIdInNuh = m_vps->getLayerIdInNuh( viewIndex, depthFlag );256 return getPicYuv( layerIdInNuh, poc, recon );257 }258 #if H_3D_ARP259 TComList<TComPic*>* TComPicLists::getPicList( Int layerIdInNuh )260 {261 TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin();262 Int iLayer = 0;263 264 assert( layerIdInNuh < m_lists.size() );265 266 while( iLayer != layerIdInNuh )267 {268 itL++;269 iLayer++;270 }271 272 return *itL;273 }274 #endif275 #endif276 214 #endif // H_MV 277 215 278 #if H_3D_NBDV279 Int TComPic::getDisCandRefPictures( Int iColPOC )280 {281 UInt uiTempLayerCurr = 7;282 TComSlice* currSlice = getSlice(getCurrSliceIdx());283 UInt numDdvCandPics = 0;284 285 if ( !currSlice->getEnableTMVPFlag() )286 return numDdvCandPics;287 288 numDdvCandPics += 1;289 290 UInt pocCurr = currSlice->getPOC();291 UInt pocDiff = 255;292 293 for(UInt lpNr = 0; lpNr < (currSlice->isInterB() ? 2: 1); lpNr ++)294 {295 UInt x = lpNr ? currSlice->getColFromL0Flag() : 1 - currSlice->getColFromL0Flag();296 297 for (UInt i = 0; i < currSlice->getNumRefIdx(RefPicList(x)); i++)298 {299 if(currSlice->getViewIndex() == currSlice->getRefPic((RefPicList)x, i)->getViewIndex()300 && (x == currSlice->getColFromL0Flag()||currSlice->getRefPOC((RefPicList)x, i)!= iColPOC) && numDdvCandPics!=2)301 {302 TComSlice* refSlice = currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx());303 Bool bRAP = (refSlice->getViewIndex() && refSlice->isIRAP())? 1: 0;304 UInt uiTempLayer = currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx())->getTLayer();305 306 if( bRAP )307 {308 this->setRapRefIdx(i);309 this->setRapRefList((RefPicList)x);310 numDdvCandPics = 2;311 312 return numDdvCandPics;313 }314 else if (uiTempLayerCurr > uiTempLayer)315 {316 uiTempLayerCurr = uiTempLayer;317 }318 }319 }320 }321 322 UInt z = -1; // GT: Added to make code compile needs to be checked!323 UInt idx = 0;324 325 for(UInt lpNr = 0; lpNr < (currSlice->isInterB() ? 2: 1); lpNr ++)326 {327 UInt x = lpNr? currSlice->getColFromL0Flag() : 1-currSlice->getColFromL0Flag();328 329 for (UInt i = 0; i < currSlice->getNumRefIdx(RefPicList(x)); i++)330 {331 Int iTempPoc = currSlice->getRefPic((RefPicList)x, i)->getPOC();332 Int iTempDiff = (iTempPoc > pocCurr) ? (iTempPoc - pocCurr): (pocCurr - iTempPoc);333 334 if(currSlice->getViewIndex() == currSlice->getRefPic((RefPicList)x, i)->getViewIndex() && (x == currSlice->getColFromL0Flag()||currSlice->getRefPOC((RefPicList)x, i)!= iColPOC)335 && currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx())->getTLayer() == uiTempLayerCurr && pocDiff > iTempDiff)336 {337 pocDiff = iTempDiff;338 z = x;339 idx = i;340 }341 }342 }343 344 if( pocDiff < 255 )345 {346 this->setRapRefIdx(idx);347 this->setRapRefList((RefPicList) z );348 numDdvCandPics = 2;349 }350 351 return numDdvCandPics;352 }353 354 Void TComPic::checkTemporalIVRef()355 {356 TComSlice* currSlice = getSlice(getCurrSliceIdx());357 const Int numCandPics = this->getNumDdvCandPics();358 for(Int curCandPic = 0; curCandPic < numCandPics; curCandPic++)359 {360 RefPicList eCurRefPicList = REF_PIC_LIST_0 ;361 Int curCandPicRefIdx = 0;362 if( curCandPic == 0 )363 {364 eCurRefPicList = RefPicList(currSlice->isInterB() ? 1-currSlice->getColFromL0Flag() : 0);365 curCandPicRefIdx = currSlice->getColRefIdx();366 }367 else368 {369 eCurRefPicList = this->getRapRefList();370 curCandPicRefIdx = this->getRapRefIdx();371 }372 TComPic* pcCandColPic = currSlice->getRefPic( eCurRefPicList, curCandPicRefIdx);373 TComSlice* pcCandColSlice = pcCandColPic->getSlice(0);// currently only support single slice374 375 if(!pcCandColSlice->isIntra())376 {377 for( Int iColRefDir = 0; iColRefDir < (pcCandColSlice->isInterB() ? 2: 1); iColRefDir ++ )378 {379 for( Int iColRefIdx =0; iColRefIdx < pcCandColSlice->getNumRefIdx(( RefPicList )iColRefDir ); iColRefIdx++)380 {381 m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] = false;382 Int iColViewIdx = pcCandColSlice->getViewIndex();383 Int iColRefViewIdx = pcCandColSlice->getRefPic( ( RefPicList )iColRefDir, iColRefIdx)->getViewIndex();384 if(iColViewIdx == iColRefViewIdx)385 continue;386 387 for(Int iCurrRefDir = 0;(iCurrRefDir < (currSlice->isInterB() ? 2: 1)) && (m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] == false ); iCurrRefDir++)388 {389 for( Int iCurrRefIdx =0; iCurrRefIdx < currSlice->getNumRefIdx(( RefPicList )iCurrRefDir ); iCurrRefIdx++)390 {391 if( currSlice->getRefPic( ( RefPicList )iCurrRefDir, iCurrRefIdx )->getViewIndex() == iColRefViewIdx )392 {393 m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] = true;394 break;395 }396 }397 }398 }399 }400 }401 }402 }403 Bool TComPic::isTempIVRefValid(Int currCandPic, Int iColRefDir, Int iColRefIdx)404 {405 return m_abTIVRINCurrRL[currCandPic][iColRefDir][iColRefIdx];406 }407 408 Void TComPic::checkTextureRef( )409 {410 TComSlice* pcCurrSlice = getSlice(getCurrSliceIdx());411 TComPic* pcTextPic = pcCurrSlice->getTexturePic();412 #if H_3D_FCO413 if ( pcTextPic )414 {415 #endif416 417 TComSlice* pcTextSlice = pcTextPic->getSlice(0); // currently only support single slice418 419 for( Int iTextRefDir = 0; (iTextRefDir < (pcTextSlice->isInterB()? 2:1) ) && !pcTextSlice->isIntra(); iTextRefDir ++ )420 {421 for( Int iTextRefIdx =0; iTextRefIdx<pcTextSlice->getNumRefIdx(( RefPicList )iTextRefDir ); iTextRefIdx++)422 {423 Int iTextRefPOC = pcTextSlice->getRefPOC( ( RefPicList )iTextRefDir, iTextRefIdx);424 Int iTextRefViewId = pcTextSlice->getRefPic( ( RefPicList )iTextRefDir, iTextRefIdx)->getViewIndex();425 m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = -1;426 Int iCurrRefDir = iTextRefDir;427 for( Int iCurrRefIdx =0; ( iCurrRefIdx<pcCurrSlice->getNumRefIdx(( RefPicList )iCurrRefDir ) ) && ( m_aiTexToDepRef[iTextRefDir][iTextRefIdx] < 0 ) ; iCurrRefIdx++)428 {429 if( pcCurrSlice->getRefPOC( ( RefPicList )iCurrRefDir, iCurrRefIdx ) == iTextRefPOC &&430 pcCurrSlice->getRefPic( ( RefPicList )iCurrRefDir, iCurrRefIdx)->getViewIndex() == iTextRefViewId )431 {432 m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = iCurrRefIdx;433 }434 }435 }436 437 }438 #if H_3D_FCO439 }440 #endif441 442 }443 444 Int TComPic::isTextRefValid(Int iTextRefDir, Int iTextRefIdx)445 {446 return m_aiTexToDepRef[iTextRefDir][iTextRefIdx];447 }448 #endif449 216 //! \} -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComPic.h
r976 r1072 89 89 Int m_layerId; 90 90 Int m_viewId; 91 #if H_3D92 Int m_viewIndex;93 Bool m_isDepth;94 Int** m_aaiCodedScale;95 Int** m_aaiCodedOffset;96 #endif97 #endif98 #if H_3D_QTLPC99 Bool m_bReduceBitsQTL;100 #endif101 #if H_3D_NBDV102 UInt m_uiRapRefIdx;103 RefPicList m_eRapRefList;104 Int m_iNumDdvCandPics;105 Bool m_abTIVRINCurrRL [2][2][MAX_NUM_REF]; //whether an inter-view reference picture with the same view index of the inter-view reference picture of temporal reference picture of current picture exists in current reference picture lists106 Int m_aiTexToDepRef [2][MAX_NUM_REF];107 91 #endif 108 92 public: … … 123 107 Void setViewId ( Int viewId ) { m_viewId = viewId; } 124 108 Int getViewId () { return m_viewId; } 125 #if H_3D126 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; }127 Int getViewIndex () { return m_viewIndex; }128 129 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; }130 Bool getIsDepth () { return m_isDepth; }131 132 Void setScaleOffset( Int** pS, Int** pO ) { m_aaiCodedScale = pS; m_aaiCodedOffset = pO; }133 Int** getCodedScale () { return m_aaiCodedScale; }134 Int** getCodedOffset() { return m_aaiCodedOffset; }135 #endif136 #endif137 #if H_3D_QTLPC138 Bool getReduceBitsFlag () { return m_bReduceBitsQTL; }139 Void setReduceBitsFlag ( Bool bFlag ) { m_bReduceBitsQTL = bFlag; }140 109 #endif 141 110 Bool getUsedByCurr() { return m_bUsedByCurr; } … … 185 154 Void setNumReorderPics(Int i, UInt tlayer) { m_numReorderPics[tlayer] = i; } 186 155 Int getNumReorderPics(UInt tlayer) { return m_numReorderPics[tlayer]; } 187 #if H_3D188 Void compressMotion(Int scale);189 #else190 156 Void compressMotion(); 191 #endif192 157 UInt getCurrSliceIdx() { return m_uiCurrSliceIdx; } 193 158 Void setCurrSliceIdx(UInt i) { m_uiCurrSliceIdx = i; } … … 211 176 Void print( Bool legend ); 212 177 #endif 213 #if H_3D_NBDV214 Int getNumDdvCandPics() {return m_iNumDdvCandPics; }215 Int getDisCandRefPictures(Int iColPOC);216 Void setRapRefIdx(UInt uiRapRefIdx) {m_uiRapRefIdx = uiRapRefIdx;}217 Void setRapRefList(RefPicList eRefPicList) {m_eRapRefList = eRefPicList;}218 Void setNumDdvCandPics (Int i) {m_iNumDdvCandPics = i; }219 UInt getRapRefIdx() {return m_uiRapRefIdx; }220 RefPicList getRapRefList() {return m_eRapRefList; }221 Void checkTemporalIVRef();222 Bool isTempIVRefValid(Int currCandPic, Int iTempRefDir, Int iTempRefIdx);223 Void checkTextureRef( );224 Int isTextRefValid(Int iTextRefDir, Int iTextRefIdx);225 #endif226 178 /** transfer ownership of seis to this picture */ 227 179 void setSEIs(SEIMessages& seis) { m_SEIs = seis; } … … 244 196 private: 245 197 TComList<TComList<TComPic*>*> m_lists; 246 #if H_3D247 TComVPS* m_vps;248 #endif249 198 public: 250 199 Void push_back( TComList<TComPic*>* list ) { m_lists.push_back( list ); } 251 200 Int size () { return (Int) m_lists.size(); } 252 #if H_3D_ARP253 TComList<TComPic*>* getPicList ( Int layerIdInNuh );254 #endif255 201 TComPic* getPic ( Int layerIdInNuh, Int poc ); 256 202 TComPicYuv* getPicYuv( Int layerIdInNuh, Int poc, Bool recon ); 257 #if H_3D258 Void setVPS ( TComVPS* vps ) { m_vps = vps; };259 TComPic* getPic ( Int viewIndex, Bool depthFlag, Int poc );260 TComPicYuv* getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon );261 #endif262 203 263 204 Void print( ); -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComPicYuv.cpp
r872 r1072 77 77 m_iCuHeight = uiMaxCUHeight; 78 78 79 #if H_3D_IV_MERGE80 m_iNumCuInWidth = m_iPicWidth / m_iCuWidth;81 m_iNumCuInWidth += ( m_iPicWidth % m_iCuWidth ) ? 1 : 0;82 83 m_iBaseUnitWidth = uiMaxCUWidth >> uiMaxCUDepth;84 m_iBaseUnitHeight = uiMaxCUHeight >> uiMaxCUDepth;85 #endif86 79 Int numCuInWidth = m_iPicWidth / m_iCuWidth + (m_iPicWidth % m_iCuWidth != 0); 87 80 Int numCuInHeight = m_iPicHeight / m_iCuHeight + (m_iPicHeight % m_iCuHeight != 0); … … 331 324 } 332 325 333 #if H_3D334 #if H_3D_IV_MERGE335 Void336 TComPicYuv::getTopLeftSamplePos( Int iCuAddr, Int iAbsZorderIdx, Int& riX, Int& riY )337 {338 Int iRastPartIdx = g_auiZscanToRaster[iAbsZorderIdx];339 Int iCuSizeInBases = m_iCuWidth / m_iBaseUnitWidth;340 Int iCuX = iCuAddr % m_iNumCuInWidth;341 Int iCuY = iCuAddr / m_iNumCuInWidth;342 Int iBaseX = iRastPartIdx % iCuSizeInBases;343 Int iBaseY = iRastPartIdx / iCuSizeInBases;344 riX = iCuX * m_iCuWidth + iBaseX * m_iBaseUnitWidth;345 riY = iCuY * m_iCuHeight + iBaseY * m_iBaseUnitHeight;346 }347 348 Void349 TComPicYuv::getCUAddrAndPartIdx( Int iX, Int iY, Int& riCuAddr, Int& riAbsZorderIdx )350 {351 Int iCuX = iX / m_iCuWidth;352 Int iCuY = iY / m_iCuHeight;353 Int iBaseX = ( iX - iCuX * m_iCuWidth ) / m_iBaseUnitWidth;354 Int iBaseY = ( iY - iCuY * m_iCuHeight ) / m_iBaseUnitHeight;355 Int iCuSizeInBases = m_iCuWidth / m_iBaseUnitWidth;356 riCuAddr = iCuY * m_iNumCuInWidth + iCuX;357 Int iRastPartIdx = iBaseY * iCuSizeInBases + iBaseX;358 riAbsZorderIdx = g_auiRasterToZscan[ iRastPartIdx ];359 }360 #endif361 Void TComPicYuv::setLumaTo( Pel pVal )362 {363 xSetPels( getLumaAddr(), getStride(), getWidth(), getHeight(), pVal );364 }365 366 Void TComPicYuv::setChromaTo( Pel pVal )367 {368 xSetPels( getCbAddr(), getCStride(), getWidth() >> 1, getHeight() >> 1, pVal );369 xSetPels( getCrAddr(), getCStride(), getWidth() >> 1, getHeight() >> 1, pVal );370 }371 372 Void TComPicYuv::xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal )373 {374 for (Int iYPos = 0; iYPos < iHeight; iYPos++)375 {376 for (Int iXPos = 0; iXPos < iWidth; iXPos++)377 {378 piPelSource[iXPos] = iVal;379 }380 piPelSource += iSourceStride;381 }382 }383 #endif384 326 385 327 //! \} -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComPicYuv.h
r872 r1072 88 88 Bool m_bIsBorderExtended; 89 89 90 #if H_3D_IV_MERGE91 Int m_iBaseUnitWidth; ///< Width of Base Unit (with maximum depth or minimum size, m_iCuWidth >> Max. Depth)92 Int m_iBaseUnitHeight; ///< Height of Base Unit (with maximum depth or minimum size, m_iCuHeight >> Max. Depth)93 Int m_iNumCuInWidth;94 #endif95 90 protected: 96 91 Void xExtendPicCompBorder (Pel* piTxt, Int iStride, Int iWidth, Int iHeight, Int iMarginX, Int iMarginY); 97 #if H_3D98 Void xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal );99 #endif100 92 101 93 public: … … 166 158 // Set border extension flag 167 159 Void setBorderExtension(Bool b) { m_bIsBorderExtended = b; } 168 #if H_3D169 // Set Function170 Void setLumaTo ( Pel pVal );171 Void setChromaTo ( Pel pVal );172 #if H_3D_IV_MERGE173 // sample to block and block to sample conversion174 Void getTopLeftSamplePos( Int iCuAddr, Int iAbsZorderIdx, Int& riX, Int& riY );175 Void getCUAddrAndPartIdx( Int iX, Int iY, Int& riCuAddr, Int& riAbsZorderIdx );176 #endif177 #endif178 160 };// END CLASS DEFINITION TComPicYuv 179 161 -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComPrediction.cpp
r1039 r1072 51 51 { 52 52 m_piYuvExt = NULL; 53 #if H_3D_VSP54 m_pDepthBlock = (Int*) malloc(MAX_NUM_SPU_W*MAX_NUM_SPU_W*sizeof(Int));55 if (m_pDepthBlock == NULL)56 printf("ERROR: UKTGHU, No memory allocated.\n");57 #endif58 53 } 59 54 60 55 TComPrediction::~TComPrediction() 61 56 { 62 #if H_3D_VSP63 if (m_pDepthBlock != NULL)64 free(m_pDepthBlock);65 m_cYuvDepthOnVsp.destroy();66 #endif67 57 68 58 delete[] m_piYuvExt; … … 73 63 m_cYuvPredTemp.destroy(); 74 64 75 #if H_3D_ARP76 m_acYuvPredBase[0].destroy();77 m_acYuvPredBase[1].destroy();78 #endif79 65 if( m_pLumaRecBuffer ) 80 66 { … … 117 103 118 104 m_cYuvPredTemp.create( MAX_CU_SIZE, MAX_CU_SIZE ); 119 #if H_3D_ARP120 m_acYuvPredBase[0] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );121 m_acYuvPredBase[1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );122 #endif123 #if H_3D_VSP124 m_cYuvDepthOnVsp.create( g_uiMaxCUWidth, g_uiMaxCUHeight );125 #endif126 105 } 127 106 … … 134 113 } 135 114 } 136 #if H_3D_IC137 m_uiaShift[0] = 0;138 for( Int i = 1; i < 64; i++ )139 {140 m_uiaShift[i] = ( (1 << 15) + i/2 ) / i;141 }142 #endif143 115 } 144 116 … … 415 387 } 416 388 417 #if H_3D_DIM418 Void TComPrediction::predIntraLumaDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc, TComWedgelet* dmm4Segmentation )419 {420 assert( iWidth == iHeight );421 assert( iWidth >= DIM_MIN_SIZE && iWidth <= DIM_MAX_SIZE );422 assert( isDimMode( uiIntraMode ) );423 424 UInt dimType = getDimType ( uiIntraMode );425 #if !HS_DMM_SIGNALLING_I0120426 Bool dimDeltaDC = isDimDeltaDC( uiIntraMode );427 #endif428 Bool isDmmMode = (dimType < DMM_NUM_TYPE);429 430 Bool* biSegPattern = NULL;431 UInt patternStride = 0;432 433 // get partiton434 #if H_3D_DIM_DMM435 TComWedgelet* dmmSegmentation = NULL;436 if( isDmmMode )437 {438 switch( dimType )439 {440 case( DMM1_IDX ):441 {442 #if SHARP_DMM1_I0110443 dmmSegmentation = pcCU->isDMM1UpscaleMode((UInt)iWidth) ?444 &(g_dmmWedgeLists[ g_aucConvertToBit[pcCU->getDMM1BasePatternWidth((UInt)iWidth)] ][ pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ) ]) :445 &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ) ]);446 #else447 dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ) ]);448 #endif449 } break;450 case( DMM4_IDX ):451 {452 if( dmm4Segmentation == NULL )453 {454 dmmSegmentation = new TComWedgelet( iWidth, iHeight );455 xPredContourFromTex( pcCU, uiAbsPartIdx, iWidth, iHeight, dmmSegmentation );456 }457 else458 {459 xPredContourFromTex( pcCU, uiAbsPartIdx, iWidth, iHeight, dmm4Segmentation );460 dmmSegmentation = dmm4Segmentation;461 }462 } break;463 default: assert(0);464 }465 assert( dmmSegmentation );466 #if SHARP_DMM1_I0110467 if( dimType == DMM1_IDX && pcCU->isDMM1UpscaleMode((UInt)iWidth) )468 {469 biSegPattern = dmmSegmentation->getScaledPattern((UInt)iWidth);470 patternStride = iWidth;471 }472 else473 {474 biSegPattern = dmmSegmentation->getPattern();475 patternStride = dmmSegmentation->getStride ();476 }477 #else478 biSegPattern = dmmSegmentation->getPattern();479 patternStride = dmmSegmentation->getStride ();480 #endif481 }482 #endif483 484 // get predicted partition values485 assert( biSegPattern );486 Int* piMask = NULL;487 piMask = pcCU->getPattern()->getAdiOrgBuf( iWidth, iHeight, m_piYuvExt ); // no filtering488 assert( piMask );489 Int maskStride = 2*iWidth + 1;490 Int* ptrSrc = piMask+maskStride+1;491 Pel predDC1 = 0; Pel predDC2 = 0;492 xPredBiSegDCs( ptrSrc, maskStride, biSegPattern, patternStride, predDC1, predDC2 );493 494 // set segment values with deltaDC offsets495 Pel segDC1 = 0;496 Pel segDC2 = 0;497 #if HS_DMM_SIGNALLING_I0120498 if( !pcCU->getSDCFlag( uiAbsPartIdx ) )499 #else500 if( dimDeltaDC )501 #endif502 {503 Pel deltaDC1 = pcCU->getDimDeltaDC( dimType, 0, uiAbsPartIdx );504 Pel deltaDC2 = pcCU->getDimDeltaDC( dimType, 1, uiAbsPartIdx );505 #if H_3D_DIM_DMM506 if( isDmmMode )507 {508 #if H_3D_DIM_DLT509 segDC1 = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 ) + deltaDC1 );510 segDC2 = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 ) + deltaDC2 );511 #else512 segDC1 = ClipY( predDC1 + deltaDC1 );513 segDC2 = ClipY( predDC2 + deltaDC2 );514 #endif515 }516 #endif517 }518 else519 {520 segDC1 = predDC1;521 segDC2 = predDC2;522 }523 524 // set prediction signal525 Pel* pDst = piPred;526 xAssignBiSegDCs( pDst, uiStride, biSegPattern, patternStride, segDC1, segDC2 );527 pcCU->setDmmPredictor(segDC1, 0);528 pcCU->setDmmPredictor(segDC2, 1);529 530 #if H_3D_DIM_DMM531 if( dimType == DMM4_IDX && dmm4Segmentation == NULL ) { dmmSegmentation->destroy(); delete dmmSegmentation; }532 #endif533 }534 #endif535 389 536 390 /** Function for checking identical motion. … … 546 400 Int RefPOCL0 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr))->getPOC(); 547 401 Int RefPOCL1 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_1, pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr))->getPOC(); 548 #if H_3D_ARP549 if(!pcCU->getARPW(PartAddr) && RefPOCL0 == RefPOCL1 && pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr) == pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr))550 #else551 402 if(RefPOCL0 == RefPOCL1 && pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr) == pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr)) 552 #endif553 403 { 554 404 return true; … … 559 409 } 560 410 561 #if H_3D_SPIVMP 562 Void TComPrediction::xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr ) 563 { 564 for (Int i = 0; i < iNumSP; i++) 565 { 566 uiMergedSPW[i] = iSPWidth; 567 uiMergedSPH[i] = iSPHeight; 568 pcCU->getSPAbsPartIdx(uiPartAddr, iSPWidth, iSPHeight, i, iNumSPInOneLine, uiSPAddr[i]); 569 } 570 #if SHARP_ARP_CHROMA_I0104 571 if( pcCU->getARPW( uiPartAddr ) != 0 ) 572 { 573 return; 574 } 575 #endif 576 // horizontal sub-PU merge 577 for (Int i=0; i<iNumSP; i++) 578 { 579 if (i % iNumSPInOneLine == iNumSPInOneLine - 1 || uiMergedSPW[i]==0 || uiMergedSPH[i]==0) 580 { 581 continue; 582 } 583 for (Int j=i+1; j<i+iNumSPInOneLine-i%iNumSPInOneLine; j++) 584 { 585 if (xCheckTwoSPMotion(pcCU, uiSPAddr[i], uiSPAddr[j])) 586 { 587 uiMergedSPW[i] += iSPWidth; 588 uiMergedSPW[j] = uiMergedSPH[j] = 0; 589 } 590 else 591 { 592 break; 593 } 594 } 595 } 596 //vertical sub-PU merge 597 for (Int i=0; i<iNumSP-iNumSPInOneLine; i++) 598 { 599 if (uiMergedSPW[i]==0 || uiMergedSPH[i]==0) 600 { 601 continue; 602 } 603 for (Int j=i+iNumSPInOneLine; j<iNumSP; j+=iNumSPInOneLine) 604 { 605 if (xCheckTwoSPMotion(pcCU, uiSPAddr[i], uiSPAddr[j]) && uiMergedSPW[i]==uiMergedSPW[j]) 606 { 607 uiMergedSPH[i] += iSPHeight; 608 uiMergedSPH[j] = uiMergedSPW[j] = 0; 609 } 610 else 611 { 612 break; 613 } 614 } 615 } 616 } 617 618 Bool TComPrediction::xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 ) 619 { 620 if( pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr1)) 621 { 622 return false; 623 } 624 if( pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr1)) 625 { 626 return false; 627 } 628 629 if (pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr0) >= 0) 630 { 631 if (pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr1)) 632 { 633 return false; 634 } 635 } 636 637 if (pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr0) >= 0) 638 { 639 if (pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr1)) 640 { 641 return false; 642 } 643 } 644 return true; 645 } 646 #endif 647 648 #if H_3D_DBBP 649 PartSize TComPrediction::getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize) 650 { 651 // find virtual partitioning for this CU based on depth block 652 // segmentation of texture block --> mask IDs 653 Pel* pDepthBlockStart = pDepthPels; 654 655 // first compute average of depth block for thresholding 656 Int iSumDepth = 0; 657 Int iSubSample = 4; 658 for (Int y=0; y<uiSize; y+=iSubSample) 659 { 660 for (Int x=0; x<uiSize; x+=iSubSample) 661 { 662 Int depthPel = pDepthPels[x]; 663 664 iSumDepth += depthPel; 665 } 666 667 // next row 668 pDepthPels += uiDepthStride*iSubSample; 669 } 670 671 Int iSizeInBits = g_aucConvertToBit[uiSize] - g_aucConvertToBit[iSubSample]; // respect sub-sampling factor 672 Int iMean = iSumDepth >> iSizeInBits*2; // iMean /= (uiSize*uiSize); 673 674 // start again for segmentation 675 pDepthPels = pDepthBlockStart; 676 677 // start mapping process 678 Int matchedPartSum[2][2] = {{0,0},{0,0}}; // counter for each part size and boolean option 679 PartSize virtualPartSizes[2] = { SIZE_Nx2N, SIZE_2NxN}; 680 681 UInt uiHalfSize = uiSize>>1; 682 for (Int y=0; y<uiSize; y+=iSubSample) 683 { 684 for (Int x=0; x<uiSize; x+=iSubSample) 685 { 686 Int depthPel = pDepthPels[x]; 687 688 // decide which segment this pixel belongs to 689 Int ucSegment = (Int)(depthPel>iMean); 690 691 // Matched Filter to find optimal (conventional) partitioning 692 693 // SIZE_Nx2N 694 if(x<uiHalfSize) // left 695 { 696 matchedPartSum[0][ucSegment]++; 697 } 698 else // right 699 { 700 matchedPartSum[0][1-ucSegment]++; 701 } 702 703 // SIZE_2NxN 704 if(y<uiHalfSize) // top 705 { 706 matchedPartSum[1][ucSegment]++; 707 } 708 else // bottom 709 { 710 matchedPartSum[1][1-ucSegment]++; 711 } 712 } 713 714 // next row 715 pDepthPels += uiDepthStride*iSubSample; 716 } 717 718 PartSize matchedPartSize = SIZE_NONE; 719 720 Int iMaxMatchSum = 0; 721 for(Int p=0; p<2; p++) // loop over partition 722 { 723 for( Int b=0; b<=1; b++ ) // loop over boolean options 724 { 725 if(matchedPartSum[p][b] > iMaxMatchSum) 726 { 727 iMaxMatchSum = matchedPartSum[p][b]; 728 matchedPartSize = virtualPartSizes[p]; 729 } 730 } 731 } 732 733 AOF( matchedPartSize != SIZE_NONE ); 734 735 return matchedPartSize; 736 } 737 738 Bool TComPrediction::getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask ) 739 { 740 // segmentation of texture block --> mask IDs 741 Pel* pDepthBlockStart = pDepthPels; 742 743 // first compute average of depth block for thresholding 744 Int iSumDepth = 0; 745 Int uiMinDepth = MAX_INT; 746 Int uiMaxDepth = 0; 747 #if SEC_DBBP_DMM4_THRESHOLD_I0076 748 iSumDepth = pDepthPels[ 0 ]; 749 iSumDepth += pDepthPels[ uiWidth - 1 ]; 750 iSumDepth += pDepthPels[ uiDepthStride * (uiHeight - 1) ]; 751 iSumDepth += pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ]; 752 753 uiMinDepth = pDepthPels[ 0 ]; 754 uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiWidth - 1 ]); 755 uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) ]); 756 uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ]); 757 758 uiMaxDepth = pDepthPels[ 0 ]; 759 uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiWidth - 1 ]); 760 uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) ]); 761 uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ]); 762 #else 763 for (Int y=0; y<uiHeight; y++) 764 { 765 for (Int x=0; x<uiWidth; x++) 766 { 767 Int depthPel = pDepthPels[x]; 768 iSumDepth += depthPel; 769 770 if( depthPel > uiMaxDepth ) 771 { 772 uiMaxDepth = depthPel; 773 } 774 if( depthPel < uiMinDepth ) 775 { 776 uiMinDepth = depthPel; 777 } 778 } 779 780 // next row 781 pDepthPels += uiDepthStride; 782 } 783 #endif 784 785 // don't generate mask for blocks with small depth range (encoder decision) 786 if( uiMaxDepth - uiMinDepth < 10 ) 787 { 788 return false; 789 } 790 791 AOF(uiWidth==uiHeight); 792 #if SEC_DBBP_DMM4_THRESHOLD_I0076 793 Int iMean = iSumDepth >> 2; 794 #else 795 Int iSizeInBits = g_aucConvertToBit[uiWidth]+2; 796 Int iMean = iSumDepth >> iSizeInBits*2; // iMean /= (uiWidth*uiHeight); 797 #endif 798 799 // start again for segmentation 800 pDepthPels = pDepthBlockStart; 801 802 Bool bInvertMask = pDepthPels[0]>iMean; // top-left segment needs to be mapped to partIdx 0 803 804 // generate mask 805 UInt uiSumPix[2] = {0,0}; 806 for (Int y=0; y<uiHeight; y++) 807 { 808 for (Int x=0; x<uiHeight; x++) 809 { 810 Int depthPel = pDepthPels[x]; 811 812 // decide which segment this pixel belongs to 813 Int ucSegment = (Int)(depthPel>iMean); 814 815 if( bInvertMask ) 816 { 817 ucSegment = 1-ucSegment; 818 } 819 820 // count pixels for each segment 821 uiSumPix[ucSegment]++; 822 823 // set mask value 824 pMask[x] = (Bool)ucSegment; 825 } 826 827 // next row 828 pDepthPels += uiDepthStride; 829 pMask += MAX_CU_SIZE; 830 } 831 832 // don't generate valid mask for tiny segments (encoder decision) 833 // each segment needs to cover at least 1/8th of block 834 UInt uiMinPixPerSegment = (uiWidth*uiHeight) >> 3; 835 if( !( uiSumPix[0] > uiMinPixPerSegment && uiSumPix[1] > uiMinPixPerSegment ) ) 836 { 837 return false; 838 } 839 840 // all good 841 return true; 842 } 843 844 #if SHARP_DBBP_SIMPLE_FLTER_I0109 845 Void TComPrediction::combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize ) 846 #else 847 Void TComPrediction::combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr ) 848 #endif 849 { 850 Pel* piSrc[2] = {pInYuv[0]->getLumaAddr(uiPartAddr), pInYuv[1]->getLumaAddr(uiPartAddr)}; 851 UInt uiSrcStride = pInYuv[0]->getStride(); 852 Pel* piDst = pOutYuv->getLumaAddr(uiPartAddr); 853 UInt uiDstStride = pOutYuv->getStride(); 854 855 UInt uiMaskStride= MAX_CU_SIZE; 856 #if !SHARP_DBBP_SIMPLE_FLTER_I0109 857 Pel filSrc = 0; 858 #endif 859 Pel* tmpTar = 0; 860 tmpTar = (Pel *)xMalloc(Pel, uiWidth*uiHeight); 861 862 // backup pointer 863 Bool* pMaskStart = pMask; 864 865 // combine luma first 866 for (Int y=0; y<uiHeight; y++) 867 { 868 for (Int x=0; x<uiWidth; x++) 869 { 870 UChar ucSegment = (UChar)pMask[x]; 871 AOF( ucSegment < 2 ); 872 873 // filtering 874 tmpTar[y*uiWidth+x] = piSrc[ucSegment][x]; 875 } 876 877 piSrc[0] += uiSrcStride; 878 piSrc[1] += uiSrcStride; 879 pMask += uiMaskStride; 880 } 881 882 #if SHARP_DBBP_SIMPLE_FLTER_I0109 883 if (partSize == SIZE_Nx2N) 884 { 885 for (Int y=0; y<uiHeight; y++) 886 { 887 for (Int x=0; x<uiWidth; x++) 888 { 889 Bool l = (x==0)?pMaskStart[y*uiMaskStride+x]:pMaskStart[y*uiMaskStride+x-1]; 890 Bool r = (x==uiWidth-1)?pMaskStart[y*uiMaskStride+x]:pMaskStart[y*uiMaskStride+x+1]; 891 892 Pel left, right; 893 left = (x==0) ? tmpTar[y*uiWidth+x] : tmpTar[y*uiWidth+x-1]; 894 right = (x==uiWidth-1) ? tmpTar[y*uiWidth+x] : tmpTar[y*uiWidth+x+1]; 895 896 piDst[x] = (l!=r) ? ClipY( Pel(( left + (tmpTar[y*uiWidth+x] << 1) + right ) >> 2 )) : tmpTar[y*uiWidth+x]; 897 } 898 piDst += uiDstStride; 899 } 900 } 901 else // SIZE_2NxN 902 { 903 for (Int y=0; y<uiHeight; y++) 904 { 905 for (Int x=0; x<uiWidth; x++) 906 { 907 Bool t = (y==0)?pMaskStart[y*uiMaskStride+x]:pMaskStart[(y-1)*uiMaskStride+x]; 908 Bool b = (y==uiHeight-1)?pMaskStart[y*uiMaskStride+x]:pMaskStart[(y+1)*uiMaskStride+x]; 909 910 Pel top, bottom; 911 top = (y==0) ? tmpTar[y*uiWidth+x] : tmpTar[(y-1)*uiWidth+x]; 912 bottom = (y==uiHeight-1) ? tmpTar[y*uiWidth+x] : tmpTar[(y+1)*uiWidth+x]; 913 914 piDst[x] = (t!=b) ? ClipY( Pel(( top + (tmpTar[y*uiWidth+x] << 1) + bottom ) >> 2 )) : tmpTar[y*uiWidth+x]; 915 } 916 piDst += uiDstStride; 917 } 918 } 919 #else 920 for (Int y=0; y<uiHeight; y++) 921 { 922 for (Int x=0; x<uiWidth; x++) 923 { 924 Bool t = (y==0)?pMaskStart[y*uiMaskStride+x]:pMaskStart[(y-1)*uiMaskStride+x]; 925 Bool l = (x==0)?pMaskStart[y*uiMaskStride+x]:pMaskStart[y*uiMaskStride+x-1]; 926 Bool b = (y==uiHeight-1)?pMaskStart[y*uiMaskStride+x]:pMaskStart[(y+1)*uiMaskStride+x]; 927 Bool r = (x==uiWidth-1)?pMaskStart[y*uiMaskStride+x]:pMaskStart[y*uiMaskStride+x+1]; 928 Bool c =pMaskStart[y*uiMaskStride+x]; 929 930 Pel left, right, top, bottom; 931 left = (x==0) ? tmpTar[y*uiWidth+x] : tmpTar[y*uiWidth+x-1]; 932 right = (x==uiWidth-1) ? tmpTar[y*uiWidth+x] : tmpTar[y*uiWidth+x+1]; 933 top = (y==0) ? tmpTar[y*uiWidth+x] : tmpTar[(y-1)*uiWidth+x]; 934 bottom = (y==uiHeight-1) ? tmpTar[y*uiWidth+x] : tmpTar[(y+1)*uiWidth+x]; 935 936 if(!((l&&r&&c) || (!l&&!r&&!c))) 937 { 938 filSrc = Clip3( Pel( 0 ), Pel( 255 ), Pel(( left + (tmpTar[y*uiWidth+x] << 1) + right ) >> 2 )); 939 } 940 else 941 { 942 filSrc = tmpTar[y*uiWidth+x]; 943 } 944 945 if(!((t&&b&&c) || (!t&&!b&&!c))) 946 { 947 filSrc = Clip3( Pel( 0 ), Pel( 255 ), Pel(( top + (filSrc << 1) + bottom ) >> 2 )); 948 } 949 piDst[x] = filSrc; 950 } 951 piDst += uiDstStride; 952 } 953 #endif 954 955 if ( tmpTar ) { xFree(tmpTar); tmpTar = NULL; } 956 957 // now combine chroma 958 Pel* piSrcU[2] = { pInYuv[0]->getCbAddr(uiPartAddr), pInYuv[1]->getCbAddr(uiPartAddr) }; 959 Pel* piSrcV[2] = { pInYuv[0]->getCrAddr(uiPartAddr), pInYuv[1]->getCrAddr(uiPartAddr) }; 960 UInt uiSrcStrideC = pInYuv[0]->getCStride(); 961 Pel* piDstU = pOutYuv->getCbAddr(uiPartAddr); 962 Pel* piDstV = pOutYuv->getCrAddr(uiPartAddr); 963 UInt uiDstStrideC = pOutYuv->getCStride(); 964 UInt uiWidthC = uiWidth >> 1; 965 UInt uiHeightC = uiHeight >> 1; 966 Pel filSrcU = 0, filSrcV = 0; 967 Pel* tmpTarU = 0, *tmpTarV = 0; 968 tmpTarU = (Pel *)xMalloc(Pel, uiWidthC*uiHeightC); 969 tmpTarV = (Pel *)xMalloc(Pel, uiWidthC*uiHeightC); 970 pMask = pMaskStart; 971 972 for (Int y=0; y<uiHeightC; y++) 973 { 974 for (Int x=0; x<uiWidthC; x++) 975 { 976 UChar ucSegment = (UChar)pMask[x*2]; 977 AOF( ucSegment < 2 ); 978 979 // filtering 980 tmpTarU[y*uiWidthC+x] = piSrcU[ucSegment][x]; 981 tmpTarV[y*uiWidthC+x] = piSrcV[ucSegment][x]; 982 } 983 984 piSrcU[0] += uiSrcStrideC; 985 piSrcU[1] += uiSrcStrideC; 986 piSrcV[0] += uiSrcStrideC; 987 piSrcV[1] += uiSrcStrideC; 988 pMask += 2*uiMaskStride; 989 } 990 991 #if SHARP_DBBP_SIMPLE_FLTER_I0109 992 if (partSize == SIZE_Nx2N) 993 { 994 for (Int y=0; y<uiHeightC; y++) 995 { 996 for (Int x=0; x<uiWidthC; x++) 997 { 998 Bool l = (x==0)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[y*2*uiMaskStride+(x-1)*2]; 999 Bool r = (x==uiWidthC-1)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[y*2*uiMaskStride+(x+1)*2]; 1000 1001 Pel leftU, rightU; 1002 leftU = (x==0) ? tmpTarU[y*uiWidthC+x] : tmpTarU[y*uiWidthC+x-1]; 1003 rightU = (x==uiWidthC-1) ? tmpTarU[y*uiWidthC+x] : tmpTarU[y*uiWidthC+x+1]; 1004 Pel leftV, rightV; 1005 leftV = (x==0) ? tmpTarV[y*uiWidthC+x] : tmpTarV[y*uiWidthC+x-1]; 1006 rightV = (x==uiWidthC-1) ? tmpTarV[y*uiWidthC+x] : tmpTarV[y*uiWidthC+x+1]; 1007 1008 if (l!=r) 1009 { 1010 filSrcU = ClipC( Pel(( leftU + (tmpTarU[y*uiWidthC+x] << 1) + rightU ) >> 2 )); 1011 filSrcV = ClipC( Pel(( leftV + (tmpTarV[y*uiWidthC+x] << 1) + rightV ) >> 2 )); 1012 } 1013 else 1014 { 1015 filSrcU = tmpTarU[y*uiWidthC+x]; 1016 filSrcV = tmpTarV[y*uiWidthC+x]; 1017 } 1018 piDstU[x] = filSrcU; 1019 piDstV[x] = filSrcV; 1020 } 1021 piDstU += uiDstStrideC; 1022 piDstV += uiDstStrideC; 1023 } 1024 } 1025 else 1026 { 1027 for (Int y=0; y<uiHeightC; y++) 1028 { 1029 for (Int x=0; x<uiWidthC; x++) 1030 { 1031 Bool t = (y==0)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[(y-1)*2*uiMaskStride+x*2]; 1032 Bool b = (y==uiHeightC-1)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[(y+1)*2*uiMaskStride+x*2]; 1033 1034 Pel topU, bottomU; 1035 topU = (y==0) ? tmpTarU[y*uiWidthC+x] : tmpTarU[(y-1)*uiWidthC+x]; 1036 bottomU = (y==uiHeightC-1) ? tmpTarU[y*uiWidthC+x] : tmpTarU[(y+1)*uiWidthC+x]; 1037 Pel topV, bottomV; 1038 topV = (y==0) ? tmpTarV[y*uiWidthC+x] : tmpTarV[(y-1)*uiWidthC+x]; 1039 bottomV = (y==uiHeightC-1) ? tmpTarV[y*uiWidthC+x] : tmpTarV[(y+1)*uiWidthC+x]; 1040 1041 if (t!=b) 1042 { 1043 filSrcU = ClipC( Pel(( topU + (tmpTarU[y*uiWidthC+x] << 1) + bottomU ) >> 2 )); 1044 filSrcV = ClipC( Pel(( topV + (tmpTarV[y*uiWidthC+x] << 1) + bottomV ) >> 2 )); 1045 } 1046 else 1047 { 1048 filSrcU = tmpTarU[y*uiWidthC+x]; 1049 filSrcV = tmpTarV[y*uiWidthC+x]; 1050 } 1051 piDstU[x] = filSrcU; 1052 piDstV[x] = filSrcV; 1053 } 1054 piDstU += uiDstStrideC; 1055 piDstV += uiDstStrideC; 1056 } 1057 } 1058 #else 1059 for (Int y=0; y<uiHeightC; y++) 1060 { 1061 for (Int x=0; x<uiWidthC; x++) 1062 { 1063 Bool t = (y==0)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[(y-1)*2*uiMaskStride+x*2]; 1064 Bool l = (x==0)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[y*2*uiMaskStride+(x-1)*2]; 1065 Bool b = (y==uiHeightC-1)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[(y+1)*2*uiMaskStride+x*2]; 1066 Bool r = (x==uiWidthC-1)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[y*2*uiMaskStride+(x+1)*2]; 1067 Bool c =pMaskStart[y*2*uiMaskStride+x*2]; 1068 1069 Pel leftU, rightU, topU, bottomU; 1070 leftU = (x==0) ? tmpTarU[y*uiWidthC+x] : tmpTarU[y*uiWidthC+x-1]; 1071 rightU = (x==uiWidthC-1) ? tmpTarU[y*uiWidthC+x] : tmpTarU[y*uiWidthC+x+1]; 1072 topU = (y==0) ? tmpTarU[y*uiWidthC+x] : tmpTarU[(y-1)*uiWidthC+x]; 1073 bottomU = (y==uiHeightC-1) ? tmpTarU[y*uiWidthC+x] : tmpTarU[(y+1)*uiWidthC+x]; 1074 1075 Pel leftV, rightV, topV, bottomV; 1076 leftV = (x==0) ? tmpTarV[y*uiWidthC+x] : tmpTarV[y*uiWidthC+x-1]; 1077 rightV = (x==uiWidthC-1) ? tmpTarV[y*uiWidthC+x] : tmpTarV[y*uiWidthC+x+1]; 1078 topV = (y==0) ? tmpTarV[y*uiWidthC+x] : tmpTarV[(y-1)*uiWidthC+x]; 1079 bottomV = (y==uiHeightC-1) ? tmpTarV[y*uiWidthC+x] : tmpTarV[(y+1)*uiWidthC+x]; 1080 1081 if(!((l&&r&&c) || (!l&&!r&&!c))) 1082 { 1083 filSrcU = Clip3( Pel( 0 ), Pel( 255 ), Pel(( leftU + (tmpTarU[y*uiWidthC+x] << 1) + rightU ) >> 2 )); 1084 filSrcV = Clip3( Pel( 0 ), Pel( 255 ), Pel(( leftV + (tmpTarV[y*uiWidthC+x] << 1) + rightV ) >> 2 )); 1085 } 1086 else 1087 { 1088 filSrcU = tmpTarU[y*uiWidthC+x]; 1089 filSrcV = tmpTarV[y*uiWidthC+x]; 1090 } 1091 1092 if(!((t&&b&&c) || (!t&&!b&&!c))) 1093 { 1094 filSrcU = Clip3( Pel( 0 ), Pel( 255 ), Pel(( topU + (filSrcU << 1) + bottomU ) >> 2 )); 1095 filSrcV = Clip3( Pel( 0 ), Pel( 255 ), Pel(( topV + (filSrcV << 1) + bottomV ) >> 2 )); 1096 } 1097 1098 piDstU[x] = filSrcU; 1099 piDstV[x] = filSrcV; 1100 } 1101 piDstU += uiDstStrideC; 1102 piDstV += uiDstStrideC; 1103 } 1104 #endif 1105 if ( tmpTarU ) { xFree(tmpTarU); tmpTarU = NULL; } 1106 if ( tmpTarV ) { xFree(tmpTarV); tmpTarV = NULL; } 1107 } 1108 #endif 411 1109 412 1110 413 Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx ) … … 1117 420 { 1118 421 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight ); 1119 #if H_3D_VSP1120 if ( pcCU->getVSPFlag(uiPartAddr) == 0)1121 {1122 #endif1123 422 if ( eRefPicList != REF_PIC_LIST_X ) 1124 423 { … … 1138 437 else 1139 438 { 1140 #if H_3D_SPIVMP1141 if ( pcCU->getSPIVMPFlag(uiPartAddr)!=0)1142 {1143 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;1144 1145 pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);1146 1147 UInt uiW[256], uiH[256];1148 UInt uiSPAddr[256];1149 1150 xGetSubPUAddrAndMerge(pcCU, uiPartAddr, iSPWidth, iSPHeight, iNumSPInOneLine, iNumSP, uiW, uiH, uiSPAddr);1151 1152 //MC1153 for (Int i = 0; i < iNumSP; i++)1154 {1155 if (uiW[i]==0 || uiH[i]==0)1156 {1157 continue;1158 }1159 if( xCheckIdenticalMotion( pcCU, uiSPAddr[i] ))1160 {1161 xPredInterUni (pcCU, uiSPAddr[i], uiW[i], uiH[i], REF_PIC_LIST_0, pcYuvPred );1162 }1163 else1164 {1165 xPredInterBi (pcCU, uiSPAddr[i], uiW[i], uiH[i], pcYuvPred);1166 }1167 }1168 }1169 else1170 {1171 #endif1172 439 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) 1173 440 { … … 1178 445 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); 1179 446 } 1180 #if H_3D_SPIVMP 1181 } 1182 #endif 1183 } 1184 #if H_3D_VSP 1185 } 1186 else 1187 { 1188 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) 1189 { 1190 xPredInterUniVSP( pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred ); 447 } 448 return; 449 } 450 451 for ( iPartIdx = 0; iPartIdx < pcCU->getNumPartitions(); iPartIdx++ ) 452 { 453 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight ); 454 455 if ( eRefPicList != REF_PIC_LIST_X ) 456 { 457 if( pcCU->getSlice()->getPPS()->getUseWP()) 458 { 459 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true ); 460 } 461 else 462 { 463 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); 464 } 465 if ( pcCU->getSlice()->getPPS()->getUseWP() ) 466 { 467 xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); 468 } 1191 469 } 1192 470 else 1193 471 { 1194 xPredInterBiVSP ( pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); 1195 } 1196 } 1197 #endif 1198 return; 1199 } 1200 1201 for ( iPartIdx = 0; iPartIdx < pcCU->getNumPartitions(); iPartIdx++ ) 1202 { 1203 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight ); 1204 1205 #if H_3D_VSP 1206 if ( pcCU->getVSPFlag(uiPartAddr) == 0 ) 1207 { 1208 #endif 1209 if ( eRefPicList != REF_PIC_LIST_X ) 1210 { 1211 if( pcCU->getSlice()->getPPS()->getUseWP()) 1212 { 1213 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true ); 472 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) 473 { 474 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred ); 1214 475 } 1215 476 else 1216 477 { 1217 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );1218 }1219 if ( pcCU->getSlice()->getPPS()->getUseWP() )1220 {1221 xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );1222 }1223 }1224 else1225 {1226 #if H_3D_SPIVMP1227 if (pcCU->getSPIVMPFlag(uiPartAddr)!=0)1228 {1229 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;1230 1231 pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);1232 1233 UInt uiW[256], uiH[256];1234 UInt uiSPAddr[256];1235 1236 xGetSubPUAddrAndMerge(pcCU, uiPartAddr, iSPWidth, iSPHeight, iNumSPInOneLine, iNumSP, uiW, uiH, uiSPAddr);1237 //MC1238 for (Int i = 0; i < iNumSP; i++)1239 {1240 if (uiW[i]==0 || uiH[i]==0)1241 {1242 continue;1243 }1244 if( xCheckIdenticalMotion( pcCU, uiSPAddr[i] ))1245 {1246 xPredInterUni (pcCU, uiSPAddr[i], uiW[i], uiH[i], REF_PIC_LIST_0, pcYuvPred );1247 }1248 else1249 {1250 xPredInterBi (pcCU, uiSPAddr[i], uiW[i], uiH[i], pcYuvPred);1251 }1252 }1253 }1254 else1255 {1256 #endif1257 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )1258 {1259 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );1260 }1261 else1262 {1263 478 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); 1264 479 } 1265 #if H_3D_SPIVMP 1266 } 1267 #endif 1268 } 1269 #if H_3D_VSP 1270 } 1271 else 1272 { 1273 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) 1274 { 1275 xPredInterUniVSP( pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred ); 1276 } 1277 else 1278 { 1279 xPredInterBiVSP ( pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); 1280 } 1281 } 1282 #endif 480 } 1283 481 } 1284 482 return; … … 1291 489 pcCU->clipMv(cMv); 1292 490 1293 #if H_3D_DDD1294 if( pcCU->getUseDDD( uiPartAddr ) )1295 {1296 assert( pcCU->getSPIVMPFlag( uiPartAddr ) == 0 );1297 assert( pcCU->getSlice()->getViewIndex() != 0 );1298 1299 Int dstStride = rpcYuvPred->getStride();1300 Int dstStrideC = rpcYuvPred->getCStride();1301 Pel *dst = rpcYuvPred->getLumaAddr( uiPartAddr );1302 Pel *dstU = rpcYuvPred->getCbAddr( uiPartAddr );1303 Pel *dstV = rpcYuvPred->getCrAddr( uiPartAddr );1304 1305 Int iWidthC = iWidth >> 1;1306 Int iHeightC = iHeight >> 1;1307 Int DefaultC = 1 << ( g_bitDepthY - 1);1308 for ( Int i = 0; i < iHeight; i++)1309 {1310 for ( Int j = 0; j < iWidth ; j++)1311 {1312 dst[j] = pcCU->getDDDepth( uiPartAddr );1313 }1314 dst += dstStride;1315 }1316 for ( Int i = 0; i < iHeightC; i++)1317 {1318 for ( Int j = 0; j < iWidthC; j++)1319 {1320 dstU[j] = dstV[j] = DefaultC;1321 }1322 dstU += dstStrideC;1323 dstV += dstStrideC;1324 }1325 1326 //return;1327 } else1328 #endif1329 #if H_3D_ARP1330 if(pcCU->getARPW( uiPartAddr ) > 0 && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()== pcCU->getSlice()->getPOC())1331 {1332 xPredInterUniARPviewRef( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , rpcYuvPred , bi );1333 }1334 else1335 {1336 if( pcCU->getARPW( uiPartAddr ) > 01337 && pcCU->getPartitionSize(uiPartAddr)==SIZE_2Nx2N1338 && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()!= pcCU->getSlice()->getPOC()1339 )1340 {1341 xPredInterUniARP( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, rpcYuvPred, bi );1342 }1343 else1344 {1345 #endif1346 #if H_3D_IC1347 Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() != pcCU->getSlice()->getViewIndex() );1348 xPredInterLumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi1349 #if H_3D_ARP1350 , false1351 #endif1352 , bICFlag );1353 bICFlag = bICFlag && (iWidth > 8);1354 xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi1355 #if H_3D_ARP1356 , false1357 #endif1358 , bICFlag );1359 #else1360 491 xPredInterLumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi ); 1361 492 xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi ); 1362 #endif 1363 #if H_3D_ARP 1364 } 1365 } 1366 #endif 1367 } 1368 1369 #if H_3D_VSP 1370 Void TComPrediction::xPredInterUniVSP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi ) 1371 { 1372 Int vspSize = pcCU->getVSPFlag( uiPartAddr ) >> 1; 1373 1374 Int widthSubPU, heightSubPU; 1375 if (vspSize) 1376 { 1377 widthSubPU = 8; 1378 heightSubPU = 4; 1379 } 1380 else 1381 { 1382 widthSubPU = 4; 1383 heightSubPU = 8; 1384 } 1385 xPredInterUniSubPU( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, rpcYuvPred, bi, widthSubPU, heightSubPU ); 1386 } 1387 1388 Void TComPrediction::xPredInterUniSubPU( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU, Int heightSubPU ) 1389 { 1390 UInt numPartsInLine = pcCU->getPic()->getNumPartInWidth(); 1391 UInt horiNumPartsInSubPU = widthSubPU >> 2; 1392 UInt vertNumPartsInSubPU = (heightSubPU >> 2) * numPartsInLine; 1393 1394 UInt partAddrRasterLine = g_auiZscanToRaster[ uiPartAddr ]; 1395 1396 for( Int posY=0; posY<iHeight; posY+=heightSubPU, partAddrRasterLine+=vertNumPartsInSubPU ) 1397 { 1398 UInt partAddrRasterSubPU = partAddrRasterLine; 1399 for( Int posX=0; posX<iWidth; posX+=widthSubPU, partAddrRasterSubPU+=horiNumPartsInSubPU ) 1400 { 1401 UInt partAddrSubPU = g_auiRasterToZscan[ partAddrRasterSubPU ]; 1402 Int refIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( partAddrSubPU ); assert (refIdx >= 0); 1403 TComMv cMv = pcCU->getCUMvField( eRefPicList )->getMv( partAddrSubPU ); 1404 pcCU->clipMv(cMv); 1405 1406 xPredInterLumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi ); 1407 xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi ); 1408 1409 } 1410 } 1411 } 1412 1413 #endif 1414 1415 #if H_3D_ARP 1416 Void TComPrediction::xPredInterUniARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled ) 1417 { 1418 Int iRefIdx = pNewMvFiled ? pNewMvFiled->getRefIdx() : pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); 1419 TComMv cMv = pNewMvFiled ? pNewMvFiled->getMv() : pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr ); 1420 Bool bTobeScaled = false; 1421 TComPic* pcPicYuvBaseCol = NULL; 1422 TComPic* pcPicYuvBaseRef = NULL; 1423 1424 #if H_3D_NBDV 1425 DisInfo cDistparity; 1426 cDistparity.bDV = pcCU->getDvInfo(uiPartAddr).bDV; 1427 if( cDistparity.bDV ) 1428 { 1429 cDistparity.m_acNBDV = pcCU->getDvInfo(0).m_acNBDV; 1430 assert(pcCU->getDvInfo(uiPartAddr).bDV == pcCU->getDvInfo(0).bDV); 1431 cDistparity.m_aVIdxCan = pcCU->getDvInfo(uiPartAddr).m_aVIdxCan; 1432 } 1433 #else 1434 assert(0); // ARP can be applied only when a DV is available 1435 #endif 1436 1437 UChar dW = cDistparity.bDV ? pcCU->getARPW ( uiPartAddr ) : 0; 1438 1439 if( cDistparity.bDV ) 1440 { 1441 Int arpRefIdx = pcCU->getSlice()->getFirstTRefIdx(eRefPicList); 1442 if( dW > 0 && pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC()!= pcCU->getSlice()->getPOC() ) 1443 { 1444 bTobeScaled = true; 1445 } 1446 1447 pcPicYuvBaseCol = pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getPOC(), cDistparity.m_aVIdxCan ); 1448 1449 pcPicYuvBaseRef = pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC(), cDistparity.m_aVIdxCan ); 1450 1451 if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, cDistparity.m_aVIdxCan)) 1452 { 1453 dW = 0; 1454 bTobeScaled = false; 1455 } 1456 else 1457 { 1458 assert( pcPicYuvBaseCol->getPOC() == pcCU->getSlice()->getPOC() && pcPicYuvBaseRef->getPOC() == pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC() ); 1459 } 1460 1461 if(bTobeScaled) 1462 { 1463 Int iCurrPOC = pcCU->getSlice()->getPOC(); 1464 Int iColRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList, iRefIdx ); 1465 Int iCurrRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList, 0); 1466 Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iCurrPOC, iColRefPOC); 1467 if ( iScale != 4096 ) 1468 { 1469 cMv = cMv.scaleMv( iScale ); 1470 } 1471 iRefIdx = 0; 1472 } 1473 } 1474 1475 pcCU->clipMv(cMv); 1476 TComPicYuv* pcPicYuvRef = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(); 1477 #if QC_I0129_ARP_FIX 1478 xPredInterLumaBlk ( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 ), true ); 1479 xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 ), true ); 1480 #else 1481 xPredInterLumaBlk ( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi, true ); 1482 xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi, true ); 1483 #endif 1484 if( dW > 0 ) 1485 { 1486 TComYuv * pYuvB0 = &m_acYuvPredBase[0]; 1487 TComYuv * pYuvB1 = &m_acYuvPredBase[1]; 1488 1489 TComMv cMVwithDisparity = cMv + cDistparity.m_acNBDV; 1490 pcCU->clipMv(cMVwithDisparity); 1491 #if SHARP_ARP_CHROMA_I0104 1492 if (iWidth <= 8) 1493 { 1494 pYuvB0->clear(); pYuvB1->clear(); 1495 } 1496 #endif 1497 1498 assert ( cDistparity.bDV ); 1499 1500 #if NTT_BUG_FIX_TK54 1501 TComMv cNBDV = cDistparity.m_acNBDV; 1502 pcCU->clipMv( cNBDV ); 1503 1504 pcPicYuvRef = pcPicYuvBaseCol->getPicYuvRec(); 1505 #if QC_I0129_ARP_FIX 1506 xPredInterLumaBlk ( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, true, true ); 1507 #if SHARP_ARP_CHROMA_I0104 1508 if (iWidth > 8) 1509 #endif 1510 xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, true, true ); 1511 #else 1512 xPredInterLumaBlk ( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, bi, true ); 1513 xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, bi, true ); 1514 #endif 1515 #else 1516 pcPicYuvRef = pcPicYuvBaseCol->getPicYuvRec(); 1517 xPredInterLumaBlk ( pcCU, pcPicYuvRef, uiPartAddr, &cDistparity.m_acNBDV, iWidth, iHeight, pYuvB0, bi, true ); 1518 xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cDistparity.m_acNBDV, iWidth, iHeight, pYuvB0, bi, true ); 1519 #endif 1520 1521 pcPicYuvRef = pcPicYuvBaseRef->getPicYuvRec(); 1522 #if QC_I0129_ARP_FIX 1523 xPredInterLumaBlk ( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, true, true ); 1524 #if SHARP_ARP_CHROMA_I0104 1525 if (iWidth > 8) 1526 #endif 1527 xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, true, true ); 1528 #else 1529 xPredInterLumaBlk ( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, bi, true ); 1530 xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, bi, true ); 1531 #endif 1532 pYuvB0->subtractARP( pYuvB0 , pYuvB1 , uiPartAddr , iWidth , iHeight ); 1533 1534 if( 2 == dW ) 1535 { 1536 pYuvB0->multiplyARP( uiPartAddr , iWidth , iHeight , dW ); 1537 } 1538 rpcYuvPred->addARP( rpcYuvPred , pYuvB0 , uiPartAddr , iWidth , iHeight , !bi ); 1539 } 1540 } 1541 1542 #if QC_I0051_ARP_SIMP 1543 Bool TComPrediction::xCheckBiInterviewARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc ) 1544 { 1545 Int iRefIdx = pcCU->getCUMvField( eBaseRefPicList )->getRefIdx( uiPartAddr ); 1546 TComMv cDMv = pcCU->getCUMvField( eBaseRefPicList )->getMv( uiPartAddr ); 1547 TComPic* pcPicYuvBaseCol = pcCU->getSlice()->getRefPic( eBaseRefPicList, iRefIdx ); 1548 TComPicYuv* pcYuvBaseCol = pcPicYuvBaseCol->getPicYuvRec(); 1549 Int uiLCUAddr,uiAbsPartAddr; 1550 Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2 + ((cDMv.getHor() + 2)>>2); 1551 Int irefPUY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiPartAddr]] + iHeight/2 + ((cDMv.getVer() + 2)>>2); 1552 1553 irefPUX = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()-> getPicWidthInLumaSamples()-1, irefPUX); 1554 irefPUY = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()-1, irefPUY); 1555 pcYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr); 1556 TComDataCU *pColCU = pcPicYuvBaseCol->getCU( uiLCUAddr ); 1557 1558 TComPic* pcPicYuvBaseTRef = NULL; 1559 pcPicYuvCurrTRef = NULL; 1560 1561 //If there is available motion in base reference list, use it 1562 if(!pColCU->isIntra(uiAbsPartAddr)) 1563 { 1564 for(Int iList = 0; iList < (pColCU->getSlice()->isInterB() ? 2: 1); iList ++) 1565 { 1566 RefPicList eRefPicListCurr = RefPicList(iList); 1567 Int iRef = pColCU->getCUMvField(eRefPicListCurr)->getRefIdx(uiAbsPartAddr); 1568 if( iRef != -1) 1569 { 1570 pcPicYuvBaseTRef = pColCU->getSlice()->getRefPic(eRefPicListCurr, iRef); 1571 Int iCurrPOC = pColCU->getSlice()->getPOC(); 1572 Int iCurrRefPOC = pcPicYuvBaseTRef->getPOC(); 1573 Int iCurrRef = pcCU->getSlice()->getFirstTRefIdx(eRefPicListCurr); 1574 #if MTK_I0072_IVARP_SCALING_FIX 1575 if( iCurrRef >= 0 && iCurrPOC != iCurrRefPOC) 1576 #else 1577 if( iCurrRef >= 0) 1578 #endif 1579 { 1580 pcPicYuvCurrTRef = pcCU->getSlice()->getRefPic(eRefPicListCurr,iCurrRef); 1581 Int iTargetPOC = pcPicYuvCurrTRef->getPOC(); 1582 pcPicYuvBaseTRef = pcCU->getSlice()->getBaseViewRefPic(iTargetPOC, pcPicYuvBaseCol->getViewIndex() ); 1583 if(pcPicYuvBaseTRef) 1584 { 1585 cBaseTMV = pColCU->getCUMvField(eRefPicListCurr)->getMv(uiAbsPartAddr); 1586 Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iTargetPOC, iCurrPOC, iCurrRefPOC); 1587 if ( iScale != 4096 ) 1588 { 1589 cBaseTMV = cBaseTMV.scaleMv( iScale ); 1590 } 1591 iCurrTRefPoc = iTargetPOC; 1592 return true; 1593 } 1594 } 1595 } 1596 } 1597 } 1598 1599 //If there is no available motion in base reference list, use ( 0, 0 ) 1600 if( pcCU->getSlice()->getFirstTRefIdx( eBaseRefPicList ) >= 0 ) 1601 { 1602 cBaseTMV.set( 0, 0 ); 1603 pcPicYuvCurrTRef = pcCU->getSlice()->getRefPic( eBaseRefPicList, pcCU->getSlice()->getFirstTRefIdx( eBaseRefPicList ) ); 1604 iCurrTRefPoc = pcPicYuvCurrTRef->getPOC(); 1605 return true; 1606 } 1607 1608 return false; 1609 } 1610 #endif 1611 1612 Void TComPrediction::xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled ) 1613 { 1614 Int iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); 1615 TComMv cDMv = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr ); 1616 TComMv cTempDMv = cDMv; 1617 UChar dW = pcCU->getARPW ( uiPartAddr ); 1618 1619 TComPic* pcPicYuvBaseTRef = NULL; 1620 TComPic* pcPicYuvCurrTRef = NULL; 1621 TComPic* pcPicYuvBaseCol = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx ); 1622 TComPicYuv* pcYuvBaseCol = pcPicYuvBaseCol->getPicYuvRec(); 1623 Bool bTMVAvai = false; 1624 TComMv cBaseTMV; 1625 if( pNewMvFiled ) 1626 { 1627 iRefIdx = pNewMvFiled->getRefIdx(); 1628 cDMv = pNewMvFiled->getMv(); 1629 } 1630 pcCU->clipMv(cTempDMv); 1631 1632 assert(dW > 0); 1633 if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, pcPicYuvBaseCol->getViewIndex())) 1634 { 1635 dW = 0; 1636 } 1637 Int uiLCUAddr,uiAbsPartAddr; 1638 Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2 + ((cDMv.getHor() + 2)>>2); 1639 Int irefPUY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiPartAddr]] + iHeight/2 + ((cDMv.getVer() + 2)>>2); 1640 1641 irefPUX = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()-> getPicWidthInLumaSamples()-1, irefPUX); 1642 irefPUY = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()-1, irefPUY); 1643 pcYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr); 1644 TComDataCU *pColCU = pcPicYuvBaseCol->getCU( uiLCUAddr ); 1645 #if QC_I0051_ARP_SIMP 1646 if( pcCU->getSlice()->isInterB() && !pcCU->getSlice()->getIsDepth() ) 1647 { 1648 RefPicList eOtherRefList = ( eRefPicList == REF_PIC_LIST_0 ) ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 1649 Int iOtherRefIdx = pcCU->getCUMvField( eOtherRefList )->getRefIdx( uiPartAddr ); 1650 //The other prediction direction is temporal ARP 1651 if( iOtherRefIdx >= 0 && pcCU->getSlice()->getViewIndex() == pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx )->getViewIndex() ) 1652 { 1653 bTMVAvai = true; 1654 pcPicYuvBaseTRef = pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx ); 1655 Int iCurrPOC = pcCU->getSlice()->getPOC(); 1656 Int iCurrRefPOC = pcPicYuvBaseTRef->getPOC(); 1657 Int iCurrRef = pcCU->getSlice()->getFirstTRefIdx( eOtherRefList ); 1658 1659 if( iCurrRef >= 0 ) 1660 { 1661 pcPicYuvCurrTRef = pcCU->getSlice()->getRefPic( eOtherRefList,iCurrRef ); 1662 Int iTargetPOC = pcPicYuvCurrTRef->getPOC(); 1663 pcPicYuvBaseTRef = pcCU->getSlice()->getBaseViewRefPic( iTargetPOC, pcPicYuvBaseCol->getViewIndex() ); 1664 if( pcPicYuvBaseTRef ) 1665 { 1666 cBaseTMV = pcCU->getCUMvField( eOtherRefList )->getMv( uiPartAddr ); 1667 Int iScale = pcCU-> xGetDistScaleFactor( iCurrPOC, iTargetPOC, iCurrPOC, iCurrRefPOC ); 1668 if ( iScale != 4096 ) 1669 { 1670 cBaseTMV = cBaseTMV.scaleMv( iScale ); 1671 } 1672 } 1673 else 1674 { 1675 dW = 0; 1676 } 1677 } 1678 else 1679 { 1680 dW = 0; 1681 } 1682 } 1683 1684 //Both prediction directions are inter-view ARP 1685 if ( iOtherRefIdx >= 0 && !bTMVAvai ) 1686 { 1687 RefPicList eBaseList = REF_PIC_LIST_0; 1688 Int iCurrTRefPoc; 1689 bTMVAvai = ( eBaseList != eRefPicList ) && ( pcCU->getSlice()->getViewIndex() != pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx )->getViewIndex() ); 1690 1691 if ( bTMVAvai ) 1692 { 1693 if( xCheckBiInterviewARP( pcCU, uiPartAddr, iWidth, iHeight, eBaseList, pcPicYuvCurrTRef, cBaseTMV, iCurrTRefPoc ) ) 1694 { 1695 pcPicYuvBaseTRef = pcCU->getSlice()->getBaseViewRefPic( iCurrTRefPoc, pcPicYuvBaseCol->getViewIndex() ); 1696 if ( pcPicYuvBaseTRef == NULL ) 1697 { 1698 dW = 0; 1699 } 1700 } 1701 else 1702 { 1703 dW = 0; 1704 } 1705 } 1706 } 1707 } 1708 1709 if( !pColCU->isIntra( uiAbsPartAddr ) && !bTMVAvai ) 1710 #else 1711 if(!pColCU->isIntra(uiAbsPartAddr)) 1712 #endif 1713 { 1714 TComMvField puMVField; 1715 for(Int iList = 0; iList < (pColCU->getSlice()->isInterB() ? 2: 1) && !bTMVAvai; iList ++) 1716 { 1717 RefPicList eRefPicListCurr = RefPicList(iList); 1718 Int iRef = pColCU->getCUMvField(eRefPicListCurr)->getRefIdx(uiAbsPartAddr); 1719 if( iRef != -1) 1720 { 1721 pcPicYuvBaseTRef = pColCU->getSlice()->getRefPic(eRefPicListCurr, iRef); 1722 Int iCurrPOC = pColCU->getSlice()->getPOC(); 1723 Int iCurrRefPOC = pcPicYuvBaseTRef->getPOC(); 1724 Int iCurrRef = pcCU->getSlice()->getFirstTRefIdx(eRefPicListCurr); 1725 #if MTK_I0072_IVARP_SCALING_FIX 1726 if (iCurrRef >= 0 && iCurrRefPOC != iCurrPOC) 1727 #else 1728 if( iCurrRef >= 0) 1729 #endif 1730 { 1731 pcPicYuvCurrTRef = pcCU->getSlice()->getRefPic(eRefPicListCurr,iCurrRef); 1732 Int iTargetPOC = pcPicYuvCurrTRef->getPOC(); 1733 { 1734 pcPicYuvBaseTRef = pcCU->getSlice()->getBaseViewRefPic(iTargetPOC, pcPicYuvBaseCol->getViewIndex() ); 1735 if(pcPicYuvBaseTRef) 1736 { 1737 cBaseTMV = pColCU->getCUMvField(eRefPicListCurr)->getMv(uiAbsPartAddr); 1738 Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iTargetPOC, iCurrPOC, iCurrRefPOC); 1739 if ( iScale != 4096 ) 1740 cBaseTMV = cBaseTMV.scaleMv( iScale ); 1741 bTMVAvai = true; 1742 break; 1743 } 1744 } 1745 } 1746 } 1747 } 1748 } 1749 if (bTMVAvai == false) 1750 { 1751 bTMVAvai = true; 1752 cBaseTMV.set(0, 0); 1753 pcPicYuvBaseTRef = pColCU->getSlice()->getRefPic(eRefPicList, pcCU->getSlice()->getFirstTRefIdx(eRefPicList)); 1754 pcPicYuvCurrTRef = pcCU->getSlice()->getRefPic (eRefPicList, pcCU->getSlice()->getFirstTRefIdx(eRefPicList)); 1755 } 1756 #if QC_I0129_ARP_FIX 1757 xPredInterLumaBlk ( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 && bTMVAvai ), bTMVAvai); 1758 xPredInterChromaBlk( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 && bTMVAvai ), bTMVAvai); 1759 #else 1760 xPredInterLumaBlk ( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi, bTMVAvai); 1761 xPredInterChromaBlk( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi, bTMVAvai); 1762 #endif 1763 if( dW > 0 && bTMVAvai ) 1764 { 1765 TComYuv* pYuvCurrTRef = &m_acYuvPredBase[0]; 1766 TComYuv* pYuvBaseTRef = &m_acYuvPredBase[1]; 1767 TComPicYuv* pcYuvCurrTref = pcPicYuvCurrTRef->getPicYuvRec(); 1768 TComPicYuv* pcYuvBaseTref = pcPicYuvBaseTRef->getPicYuvRec(); 1769 TComMv cTempMv = cDMv + cBaseTMV; 1770 1771 pcCU->clipMv(cBaseTMV); 1772 pcCU->clipMv(cTempMv); 1773 #if SHARP_ARP_CHROMA_I0104 1774 if (iWidth <= 8) 1775 { 1776 pYuvCurrTRef->clear(); pYuvBaseTRef->clear(); 1777 } 1778 #endif 1779 #if QC_I0129_ARP_FIX 1780 xPredInterLumaBlk ( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, true, true); 1781 #if SHARP_ARP_CHROMA_I0104 1782 if (iWidth > 8) 1783 #endif 1784 xPredInterChromaBlk( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, true, true); 1785 xPredInterLumaBlk ( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv, iWidth, iHeight, pYuvBaseTRef, true, true); 1786 #if SHARP_ARP_CHROMA_I0104 1787 if (iWidth > 8) 1788 #endif 1789 xPredInterChromaBlk( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv, iWidth, iHeight, pYuvBaseTRef, true, true); 1790 #else 1791 xPredInterLumaBlk ( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, bi, true); 1792 xPredInterChromaBlk( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, bi, true); 1793 xPredInterLumaBlk ( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv, iWidth, iHeight, pYuvBaseTRef, bi, true); 1794 xPredInterChromaBlk( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv, iWidth, iHeight, pYuvBaseTRef, bi, true); 1795 1796 #endif 1797 pYuvCurrTRef->subtractARP( pYuvCurrTRef , pYuvBaseTRef , uiPartAddr , iWidth , iHeight ); 1798 if(dW == 2) 1799 { 1800 pYuvCurrTRef->multiplyARP( uiPartAddr , iWidth , iHeight , dW ); 1801 } 1802 rpcYuvPred->addARP( rpcYuvPred , pYuvCurrTRef , uiPartAddr , iWidth , iHeight , !bi ); 1803 } 1804 } 1805 1806 #endif 493 } 494 495 1807 496 1808 497 Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred ) … … 1856 545 } 1857 546 1858 #if H_3D_VSP1859 1860 Void TComPrediction::xPredInterBiVSP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred )1861 {1862 TComYuv* pcMbYuv;1863 Int iRefIdx[2] = {-1, -1};1864 Bool bi = (pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ) >= 0 && pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ) >= 0);1865 1866 for ( Int iRefList = 0; iRefList < 2; iRefList++ )1867 {1868 RefPicList eRefPicList = RefPicList(iRefList);1869 iRefIdx[iRefList] = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );1870 1871 if ( iRefIdx[iRefList] < 0 )1872 {1873 continue;1874 }1875 assert( iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList) );1876 1877 pcMbYuv = &m_acYuvPred[iRefList];1878 xPredInterUniVSP ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, bi );1879 }1880 1881 xWeightedAverage( &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );1882 }1883 1884 #endif1885 547 1886 548 /** … … 1897 559 */ 1898 560 Void TComPrediction::xPredInterLumaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi 1899 #if H_3D_ARP1900 , Bool filterType1901 #endif1902 #if H_3D_IC1903 , Bool bICFlag1904 #endif1905 561 ) 1906 562 { … … 1915 571 Int yFrac = mv->getVer() & 0x3; 1916 572 1917 #if H_3D_IC1918 if( cu->getSlice()->getIsDepth() )1919 {1920 refOffset = mv->getHor() + mv->getVer() * refStride;1921 ref = refPic->getLumaAddr( cu->getAddr(), cu->getZorderIdxInCU() + partAddr ) + refOffset;1922 xFrac = 0;1923 yFrac = 0;1924 }1925 #endif1926 573 if ( yFrac == 0 ) 1927 574 { 1928 #if H_3D_IC1929 m_if.filterHorLuma( ref, refStride, dst, dstStride, width, height, xFrac, !bi || bICFlag1930 #else1931 575 m_if.filterHorLuma( ref, refStride, dst, dstStride, width, height, xFrac, !bi 1932 #endif1933 #if H_3D_ARP1934 , filterType1935 #endif1936 576 ); 1937 577 } 1938 578 else if ( xFrac == 0 ) 1939 579 { 1940 #if H_3D_IC1941 m_if.filterVerLuma( ref, refStride, dst, dstStride, width, height, yFrac, true, !bi || bICFlag1942 #else1943 580 m_if.filterVerLuma( ref, refStride, dst, dstStride, width, height, yFrac, true, !bi 1944 #endif1945 #if H_3D_ARP1946 , filterType1947 #endif1948 581 ); 1949 582 } … … 1957 590 1958 591 m_if.filterHorLuma(ref - (halfFilterSize-1)*refStride, refStride, tmp, tmpStride, width, height+filterSize-1, xFrac, false 1959 #if H_3D_ARP1960 , filterType1961 #endif1962 592 ); 1963 #if H_3D_IC1964 m_if.filterVerLuma(tmp + (halfFilterSize-1)*tmpStride, tmpStride, dst, dstStride, width, height, yFrac, false, !bi || bICFlag1965 #else1966 593 m_if.filterVerLuma(tmp + (halfFilterSize-1)*tmpStride, tmpStride, dst, dstStride, width, height, yFrac, false, !bi 1967 #endif1968 #if H_3D_ARP1969 , filterType1970 #endif1971 594 ); 1972 595 } 1973 596 1974 #if H_3D_IC1975 if( bICFlag )1976 {1977 Int a, b, i, j;1978 const Int iShift = IC_CONST_SHIFT;1979 1980 xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_LUMA );1981 1982 1983 for ( i = 0; i < height; i++ )1984 {1985 for ( j = 0; j < width; j++ )1986 {1987 dst[j] = Clip3( 0, ( 1 << g_bitDepthY ) - 1, ( ( a*dst[j] ) >> iShift ) + b );1988 }1989 dst += dstStride;1990 }1991 1992 if(bi)1993 {1994 Pel *dst2 = dstPic->getLumaAddr( partAddr );1995 Int shift = IF_INTERNAL_PREC - g_bitDepthY;1996 for (i = 0; i < height; i++)1997 {1998 for (j = 0; j < width; j++)1999 {2000 Short val = dst2[j] << shift;2001 dst2[j] = val - (Short)IF_INTERNAL_OFFS;2002 }2003 dst2 += dstStride;2004 }2005 }2006 }2007 #endif2008 597 } 2009 598 … … 2021 610 */ 2022 611 Void TComPrediction::xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi 2023 #if H_3D_ARP2024 , Bool filterType2025 #endif2026 #if H_3D_IC2027 , Bool bICFlag2028 #endif2029 612 ) 2030 613 { … … 2054 637 if ( yFrac == 0 ) 2055 638 { 2056 #if H_3D_IC2057 m_if.filterHorChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, xFrac, !bi || bICFlag2058 #else2059 639 m_if.filterHorChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, xFrac, !bi 2060 #endif2061 #if H_3D_ARP2062 , filterType2063 #endif2064 640 ); 2065 #if H_3D_IC2066 m_if.filterHorChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, xFrac, !bi || bICFlag2067 #else2068 641 m_if.filterHorChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, xFrac, !bi 2069 #endif2070 #if H_3D_ARP2071 , filterType2072 #endif2073 642 ); 2074 643 } 2075 644 else if ( xFrac == 0 ) 2076 645 { 2077 #if H_3D_IC2078 m_if.filterVerChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, true, !bi || bICFlag2079 #else2080 646 m_if.filterVerChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, true, !bi 2081 #endif2082 #if H_3D_ARP2083 , filterType2084 #endif2085 647 ); 2086 #if H_3D_IC2087 m_if.filterVerChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, true, !bi || bICFlag2088 #else2089 648 m_if.filterVerChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, true, !bi 2090 #endif2091 #if H_3D_ARP2092 , filterType2093 #endif2094 649 ); 2095 650 } … … 2097 652 { 2098 653 m_if.filterHorChroma(refCb - (halfFilterSize-1)*refStride, refStride, extY, extStride, cxWidth, cxHeight+filterSize-1, xFrac, false 2099 #if H_3D_ARP2100 , filterType2101 #endif2102 654 ); 2103 #if H_3D_IC2104 m_if.filterVerChroma(extY + (halfFilterSize-1)*extStride, extStride, dstCb, dstStride, cxWidth, cxHeight , yFrac, false, !bi || bICFlag2105 #else2106 655 m_if.filterVerChroma(extY + (halfFilterSize-1)*extStride, extStride, dstCb, dstStride, cxWidth, cxHeight , yFrac, false, !bi 2107 #endif2108 #if H_3D_ARP2109 , filterType2110 #endif2111 656 ); 2112 657 2113 658 m_if.filterHorChroma(refCr - (halfFilterSize-1)*refStride, refStride, extY, extStride, cxWidth, cxHeight+filterSize-1, xFrac, false 2114 #if H_3D_ARP2115 , filterType2116 #endif2117 659 ); 2118 #if H_3D_IC2119 m_if.filterVerChroma(extY + (halfFilterSize-1)*extStride, extStride, dstCr, dstStride, cxWidth, cxHeight , yFrac, false, !bi || bICFlag2120 #else2121 660 m_if.filterVerChroma(extY + (halfFilterSize-1)*extStride, extStride, dstCr, dstStride, cxWidth, cxHeight , yFrac, false, !bi 2122 #endif2123 #if H_3D_ARP2124 , filterType2125 #endif2126 661 ); 2127 662 } 2128 663 2129 #if H_3D_IC2130 if( bICFlag )2131 {2132 Int a, b, i, j;2133 const Int iShift = IC_CONST_SHIFT;2134 xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_CHROMA_U ); // Cb2135 for ( i = 0; i < cxHeight; i++ )2136 {2137 for ( j = 0; j < cxWidth; j++ )2138 {2139 dstCb[j] = Clip3( 0, ( 1 << g_bitDepthC ) - 1, ( ( a*dstCb[j] ) >> iShift ) + b );2140 }2141 dstCb += dstStride;2142 }2143 xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_CHROMA_V ); // Cr2144 for ( i = 0; i < cxHeight; i++ )2145 {2146 for ( j = 0; j < cxWidth; j++ )2147 {2148 dstCr[j] = Clip3( 0, ( 1 << g_bitDepthC ) - 1, ( ( a*dstCr[j] ) >> iShift ) + b );2149 }2150 dstCr += dstStride;2151 }2152 2153 if(bi)2154 {2155 Pel* dstCb2 = dstPic->getCbAddr( partAddr );2156 Pel* dstCr2 = dstPic->getCrAddr( partAddr );2157 Int shift = IF_INTERNAL_PREC - g_bitDepthC;2158 for (i = 0; i < cxHeight; i++)2159 {2160 for (j = 0; j < cxWidth; j++)2161 {2162 Short val = dstCb2[j] << shift;2163 dstCb2[j] = val - (Short)IF_INTERNAL_OFFS;2164 2165 val = dstCr2[j] << shift;2166 dstCr2[j] = val - (Short)IF_INTERNAL_OFFS;2167 }2168 dstCb2 += dstStride;2169 dstCr2 += dstStride;2170 }2171 }2172 }2173 #endif2174 664 } 2175 665 … … 2291 781 return; 2292 782 } 2293 #if H_3D_IC 2294 /** Function for deriving the position of first non-zero binary bit of a value 2295 * \param x input value 2296 * 2297 * This function derives the position of first non-zero binary bit of a value 2298 */ 2299 Int GetMSB( UInt x ) 2300 { 2301 Int iMSB = 0, bits = ( sizeof( Int ) << 3 ), y = 1; 2302 2303 while( x > 1 ) 2304 { 2305 bits >>= 1; 2306 y = x >> bits; 2307 2308 if( y ) 2309 { 2310 x = y; 2311 iMSB += bits; 2312 } 2313 } 2314 2315 iMSB+=y; 2316 2317 return iMSB; 2318 } 2319 2320 2321 /** Function for deriving LM illumination compensation. 2322 */ 2323 Void TComPrediction::xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, TextType eType ) 2324 { 2325 TComPicYuv *pRecPic = pcCU->getPic()->getPicYuvRec(); 2326 Pel *pRec = NULL, *pRef = NULL; 2327 UInt uiWidth, uiHeight, uiTmpPartIdx; 2328 Int iRecStride = ( eType == TEXT_LUMA ) ? pRecPic->getStride() : pRecPic->getCStride(); 2329 Int iRefStride = ( eType == TEXT_LUMA ) ? pRefPic->getStride() : pRefPic->getCStride(); 2330 #if SEC_IC_NEIGHBOR_CLIP_I0080 2331 Int iRefOffset, iHor, iVer; 2332 #else 2333 Int iCUPelX, iCUPelY, iRefX, iRefY, iRefOffset, iHor, iVer; 2334 2335 iCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]]; 2336 iCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]]; 2337 #endif 2338 iHor = pcCU->getSlice()->getIsDepth() ? pMv->getHor() : ( ( pMv->getHor() + 2 ) >> 2 ); 2339 iVer = pcCU->getSlice()->getIsDepth() ? pMv->getVer() : ( ( pMv->getVer() + 2 ) >> 2 ); 2340 #if !SEC_IC_NEIGHBOR_CLIP_I0080 2341 iRefX = iCUPelX + iHor; 2342 iRefY = iCUPelY + iVer; 2343 #endif 2344 if( eType != TEXT_LUMA ) 2345 { 2346 iHor = pcCU->getSlice()->getIsDepth() ? ( ( pMv->getHor() + 1 ) >> 1 ) : ( ( pMv->getHor() + 4 ) >> 3 ); 2347 iVer = pcCU->getSlice()->getIsDepth() ? ( ( pMv->getVer() + 1 ) >> 1 ) : ( ( pMv->getVer() + 4 ) >> 3 ); 2348 } 2349 uiWidth = ( eType == TEXT_LUMA ) ? pcCU->getWidth( 0 ) : ( pcCU->getWidth( 0 ) >> 1 ); 2350 uiHeight = ( eType == TEXT_LUMA ) ? pcCU->getHeight( 0 ) : ( pcCU->getHeight( 0 ) >> 1 ); 2351 2352 Int i, j, iCountShift = 0; 2353 2354 // LLS parameters estimation --> 2355 2356 Int x = 0, y = 0, xx = 0, xy = 0; 2357 Int precShift = std::max(0, (( eType == TEXT_LUMA ) ? g_bitDepthY : g_bitDepthC) - 12); 2358 2359 #if SEC_IC_NEIGHBOR_CLIP_I0080 2360 if( pcCU->getPUAbove( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) ) 2361 #else 2362 if( pcCU->getPUAbove( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) && iCUPelY > 0 && iRefY > 0 ) 2363 #endif 2364 { 2365 iRefOffset = iHor + iVer * iRefStride - iRefStride; 2366 if( eType == TEXT_LUMA ) 2367 { 2368 pRef = pRefPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 2369 pRec = pRecPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride; 2370 } 2371 else if( eType == TEXT_CHROMA_U ) 2372 { 2373 pRef = pRefPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 2374 pRec = pRecPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride; 2375 } 2376 else 2377 { 2378 assert( eType == TEXT_CHROMA_V ); 2379 pRef = pRefPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 2380 pRec = pRecPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride; 2381 } 2382 2383 for( j = 0; j < uiWidth; j+=2 ) 2384 { 2385 x += pRef[j]; 2386 y += pRec[j]; 2387 xx += (pRef[j] * pRef[j])>>precShift; 2388 xy += (pRef[j] * pRec[j])>>precShift; 2389 } 2390 iCountShift += g_aucConvertToBit[ uiWidth ] + 1; 2391 } 2392 2393 #if SEC_IC_NEIGHBOR_CLIP_I0080 2394 if( pcCU->getPULeft( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) ) 2395 #else 2396 if( pcCU->getPULeft( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) && iCUPelX > 0 && iRefX > 0 ) 2397 #endif 2398 { 2399 iRefOffset = iHor + iVer * iRefStride - 1; 2400 if( eType == TEXT_LUMA ) 2401 { 2402 pRef = pRefPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 2403 pRec = pRecPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1; 2404 } 2405 else if( eType == TEXT_CHROMA_U ) 2406 { 2407 pRef = pRefPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 2408 pRec = pRecPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1; 2409 } 2410 else 2411 { 2412 assert( eType == TEXT_CHROMA_V ); 2413 pRef = pRefPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 2414 pRec = pRecPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1; 2415 } 2416 2417 for( i = 0; i < uiHeight; i+=2 ) 2418 { 2419 x += pRef[0]; 2420 y += pRec[0]; 2421 2422 xx += (pRef[0] * pRef[0])>>precShift; 2423 xy += (pRef[0] * pRec[0])>>precShift; 2424 2425 pRef += iRefStride*2; 2426 pRec += iRecStride*2; 2427 } 2428 iCountShift += iCountShift > 0 ? 1 : ( g_aucConvertToBit[ uiWidth ] + 1 ); 2429 } 2430 2431 #if FIX_TICKET_71 2432 if( iCountShift == 0 ) 2433 { 2434 a = ( 1 << IC_CONST_SHIFT ); 2435 b = 0; 2436 return; 2437 } 2438 #endif 2439 2440 xy += xx >> IC_REG_COST_SHIFT; 2441 xx += xx >> IC_REG_COST_SHIFT; 2442 Int a1 = ( xy << iCountShift ) - ((y * x) >> precShift); 2443 Int a2 = ( xx << iCountShift ) - ((x * x) >> precShift); 2444 const Int iShift = IC_CONST_SHIFT; 2445 { 2446 { 2447 const Int iShiftA2 = 6; 2448 const Int iAccuracyShift = 15; 2449 2450 Int iScaleShiftA2 = 0; 2451 Int iScaleShiftA1 = 0; 2452 Int a1s = a1; 2453 Int a2s = a2; 2454 2455 a1 = Clip3(0, 2*a2, a1); 2456 iScaleShiftA2 = GetMSB( abs( a2 ) ) - iShiftA2; 2457 iScaleShiftA1 = iScaleShiftA2 - IC_SHIFT_DIFF; 2458 2459 if( iScaleShiftA1 < 0 ) 2460 { 2461 iScaleShiftA1 = 0; 2462 } 2463 2464 if( iScaleShiftA2 < 0 ) 2465 { 2466 iScaleShiftA2 = 0; 2467 } 2468 2469 Int iScaleShiftA = iScaleShiftA2 + iAccuracyShift - iShift - iScaleShiftA1; 2470 2471 2472 a2s = a2 >> iScaleShiftA2; 2473 2474 a1s = a1 >> iScaleShiftA1; 2475 2476 a = a1s * m_uiaShift[ a2s ]; 2477 a = a >> iScaleShiftA; 2478 b = ( y - ( ( a * x ) >> iShift ) + ( 1 << ( iCountShift - 1 ) ) ) >> iCountShift; 2479 } 2480 } 2481 } 2482 #endif 2483 2484 #if H_3D_DIM 2485 Void TComPrediction::xPredBiSegDCs( Int* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& predDC1, Pel& predDC2 ) 2486 { 2487 Int refDC1, refDC2; 2488 const Int iTR = ( patternStride - 1 ) - srcStride; 2489 const Int iTM = ( ( patternStride - 1 ) >> 1 ) - srcStride; 2490 const Int iLB = ( patternStride - 1 ) * srcStride - 1; 2491 const Int iLM = ( ( patternStride - 1 ) >> 1 ) * srcStride - 1; 2492 2493 Bool bL = ( biSegPattern[0] != biSegPattern[(patternStride-1)*patternStride] ); 2494 Bool bT = ( biSegPattern[0] != biSegPattern[(patternStride-1)] ); 2495 2496 if( bL == bT ) 2497 { 2498 const Int iTRR = ( patternStride * 2 - 1 ) - srcStride; 2499 const Int iLBB = ( patternStride * 2 - 1 ) * srcStride - 1; 2500 refDC1 = bL ? ( ptrSrc[iTR] + ptrSrc[iLB] )>>1 : (abs(ptrSrc[iTRR] - ptrSrc[-(Int)srcStride]) > abs(ptrSrc[iLBB] - ptrSrc[ -1]) ? ptrSrc[iTRR] : ptrSrc[iLBB]); 2501 refDC2 = ( ptrSrc[ -1] + ptrSrc[-(Int)srcStride] )>>1; 2502 } 2503 else 2504 { 2505 refDC1 = bL ? ptrSrc[iLB] : ptrSrc[iTR]; 2506 refDC2 = bL ? ptrSrc[iTM] : ptrSrc[iLM]; 2507 } 2508 2509 predDC1 = biSegPattern[0] ? refDC1 : refDC2; 2510 predDC2 = biSegPattern[0] ? refDC2 : refDC1; 2511 } 2512 2513 Void TComPrediction::xAssignBiSegDCs( Pel* ptrDst, UInt dstStride, Bool* biSegPattern, Int patternStride, Pel valDC1, Pel valDC2 ) 2514 { 2515 if( dstStride == patternStride ) 2516 { 2517 for( UInt k = 0; k < (patternStride * patternStride); k++ ) 2518 { 2519 if( true == biSegPattern[k] ) { ptrDst[k] = valDC2; } 2520 else { ptrDst[k] = valDC1; } 2521 } 2522 } 2523 else 2524 { 2525 Pel* piTemp = ptrDst; 2526 for( UInt uiY = 0; uiY < patternStride; uiY++ ) 2527 { 2528 for( UInt uiX = 0; uiX < patternStride; uiX++ ) 2529 { 2530 if( true == biSegPattern[uiX] ) { piTemp[uiX] = valDC2; } 2531 else { piTemp[uiX] = valDC1; } 2532 } 2533 piTemp += dstStride; 2534 biSegPattern += patternStride; 2535 } 2536 } 2537 } 2538 2539 #if H_3D_DIM_DMM 2540 2541 Void TComPrediction::xPredContourFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge ) 2542 { 2543 pcContourWedge->clear(); 2544 2545 // get copy of co-located texture luma block 2546 TComYuv cTempYuv; 2547 cTempYuv.create( uiWidth, uiHeight ); 2548 cTempYuv.clear(); 2549 Pel* piRefBlkY = cTempYuv.getLumaAddr(); 2550 xCopyTextureLumaBlock( pcCU, uiAbsPartIdx, piRefBlkY, uiWidth, uiHeight ); 2551 piRefBlkY = cTempYuv.getLumaAddr(); 2552 2553 // find contour for texture luma block 2554 UInt iDC = 0; 2555 #if SEC_DBBP_DMM4_THRESHOLD_I0076 2556 iDC = piRefBlkY[ 0 ]; 2557 iDC += piRefBlkY[ uiWidth - 1 ]; 2558 iDC += piRefBlkY[ uiWidth * (uiHeight - 1) ]; 2559 iDC += piRefBlkY[ uiWidth * (uiHeight - 1) + uiWidth - 1 ]; 2560 iDC = iDC >> 2; 2561 #else 2562 for( UInt k = 0; k < (uiWidth*uiHeight); k++ ) 2563 { 2564 iDC += piRefBlkY[k]; 2565 } 2566 2567 Int cuMaxLog2Size = g_aucConvertToBit[g_uiMaxCUWidth]+2; // 2568 iDC = iDC >> (cuMaxLog2Size - pcCU->getDepth(0))*2; // iDC /= (uiWidth*uiHeight); 2569 #endif 2570 2571 piRefBlkY = cTempYuv.getLumaAddr(); 2572 2573 Bool* pabContourPattern = pcContourWedge->getPattern(); 2574 for( UInt k = 0; k < (uiWidth*uiHeight); k++ ) 2575 { 2576 pabContourPattern[k] = (piRefBlkY[k] > iDC) ? true : false; 2577 } 2578 2579 cTempYuv.destroy(); 2580 } 2581 2582 2583 Void TComPrediction::xCopyTextureLumaBlock( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piDestBlockY, UInt uiWidth, UInt uiHeight ) 2584 { 2585 TComPicYuv* pcPicYuvRef = pcCU->getSlice()->getTexturePic()->getPicYuvRec(); 2586 assert( pcPicYuvRef != NULL ); 2587 Int iRefStride = pcPicYuvRef->getStride(); 2588 Pel* piRefY = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiAbsPartIdx ); 2589 2590 for ( Int y = 0; y < uiHeight; y++ ) 2591 { 2592 ::memcpy(piDestBlockY, piRefY, sizeof(Pel)*uiWidth); 2593 piDestBlockY += uiWidth; 2594 piRefY += iRefStride; 2595 } 2596 } 2597 #endif 2598 2599 2600 #if H_3D_DIM_SDC 2601 Void TComPrediction::analyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride 2602 ,UInt uiIntraMode 2603 ,Bool orgDC 2604 ) 2605 { 2606 Int iSumDepth[2]; 2607 memset(iSumDepth, 0, sizeof(Int)*2); 2608 Int iSumPix[2]; 2609 memset(iSumPix, 0, sizeof(Int)*2); 2610 for( Int i = 0; i < uiNumSegments; i++ ) 2611 { 2612 rpSegMeans[i] = 0; 2613 } 2614 if (orgDC == false) 2615 { 2616 Pel* pLeftTop = pOrig; 2617 Pel* pRightTop = pOrig + (uiSize-1); 2618 Pel* pLeftBottom = (pOrig+ (uiStride*(uiSize-1))); 2619 Pel* pRightBottom = (pOrig+ (uiStride*(uiSize-1)) + (uiSize-1)); 2620 2621 rpSegMeans[0] = (*pLeftTop + *pRightTop + *pLeftBottom + *pRightBottom + 2)>>2; 2622 return; 2623 } 2624 2625 Int subSamplePix; 2626 if ( uiSize == 64 || uiSize == 32 ) 2627 { 2628 subSamplePix = 2; 2629 } 2630 else 2631 { 2632 subSamplePix = 1; 2633 } 2634 for (Int y=0; y<uiSize; y+=subSamplePix) 2635 { 2636 for (Int x=0; x<uiSize; x+=subSamplePix) 2637 { 2638 UChar ucSegment = pMask?(UChar)pMask[x]:0; 2639 assert( ucSegment < uiNumSegments ); 2640 2641 iSumDepth[ucSegment] += pOrig[x]; 2642 iSumPix[ucSegment] += 1; 2643 } 2644 2645 pOrig += uiStride*subSamplePix; 2646 pMask += uiMaskStride*subSamplePix; 2647 } 2648 2649 // compute mean for each segment 2650 for( UChar ucSeg = 0; ucSeg < uiNumSegments; ucSeg++ ) 2651 { 2652 if( iSumPix[ucSeg] > 0 ) 2653 rpSegMeans[ucSeg] = iSumDepth[ucSeg] / iSumPix[ucSeg]; 2654 else 2655 rpSegMeans[ucSeg] = 0; // this happens for zero-segments 2656 } 2657 } 2658 #endif // H_3D_DIM_SDC 2659 #endif 783 2660 784 //! \} -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComPrediction.h
r1039 r1072 65 65 TComYuv m_acYuvPred[2]; 66 66 TComYuv m_cYuvPredTemp; 67 #if H_3D_ARP68 TComYuv m_acYuvPredBase[2];69 #endif70 67 TComYuv m_filteredBlock[4][4]; 71 68 TComYuv m_filteredBlockTmp[4]; … … 75 72 Pel* m_pLumaRecBuffer; ///< array for downsampled reconstructed luma sample 76 73 Int m_iLumaRecStride; ///< stride of #m_pLumaRecBuffer array 77 #if H_3D_IC78 UInt m_uiaShift[ 64 ]; // Table for multiplication to substitue of division operation79 #endif80 74 81 #if H_3D_VSP82 Int* m_pDepthBlock; ///< Store a depth block, local variable, to prevent memory allocation every time83 TComYuv m_cYuvDepthOnVsp;84 #endif85 75 86 76 Void xPredIntraAng (Int bitDepth, Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height, UInt dirMode, Bool blkAboveAvailable, Bool blkLeftAvailable, Bool bFilter ); … … 88 78 89 79 // motion compensation functions 90 #if H_3D_ARP91 Void xPredInterUniARP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false, TComMvField * pNewMvFiled = NULL );92 #if QC_I0051_ARP_SIMP93 Bool xCheckBiInterviewARP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc );94 #endif95 Void xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled = NULL );96 #endif97 80 Void xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false ); 98 81 Void xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred ); 99 #if H_3D_VSP100 Void xPredInterUniVSP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false );101 Void xPredInterBiVSP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred );102 #endif103 82 104 83 Void xPredInterLumaBlk ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi 105 #if H_3D_ARP106 , Bool filterType = false107 #endif108 #if H_3D_IC109 , Bool bICFlag = false110 #endif111 84 ); 112 85 Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi 113 86 114 #if H_3D_ARP115 , Bool filterType = false116 #endif117 #if H_3D_IC118 , Bool bICFlag = false119 #endif120 87 ); 121 88 122 #if H_3D_VSP123 Void xPredInterUniSubPU ( TComDataCU *cu, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU=4, Int heightSubPU=4 );124 #endif125 89 126 90 Void xWeightedAverage ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst ); 127 91 128 92 Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 ); 129 #if H_3D_IC130 Void xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, TextType eType );131 #endif132 93 Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight ); 133 94 Bool xCheckIdenticalMotion ( TComDataCU* pcCU, UInt PartAddr); 134 #if H_3D_SPIVMP135 Bool xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 );136 Void xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr );137 #endif138 #if H_3D_DIM139 // depth intra functions140 Void xPredBiSegDCs ( Int* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& predDC1, Pel& predDC2 );141 Void xAssignBiSegDCs ( Pel* ptrDst, UInt dstStride, Bool* biSegPattern, Int patternStride, Pel valDC1, Pel valDC2 );142 #if H_3D_DIM_DMM143 UInt xPredWedgeFromTex ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx );144 Void xPredContourFromTex ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge );145 Void xCopyTextureLumaBlock ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piDestBlockY, UInt uiWidth, UInt uiHeight );146 #endif147 #endif148 95 149 96 public: … … 163 110 Void predIntraChromaAng ( Int* piSrc, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft ); 164 111 165 #if H_3D_DIM166 // Depth intra167 Void predIntraLumaDepth ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc = false168 , TComWedgelet* dmm4Segmentation = NULL169 );170 #if H_3D_DIM_SDC171 Void analyzeSegmentsSDC ( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride172 ,UInt uiIntraMode173 ,Bool orgDC=false174 );175 #endif176 #endif177 112 178 #if H_3D_DBBP179 PartSize getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize);180 Bool getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask );181 #if SHARP_DBBP_SIMPLE_FLTER_I0109182 Void combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize );183 #else184 Void combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr = 0 );185 #endif186 #endif187 113 188 114 Pel predIntraGetPredValDC ( Int* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft ); -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComRdCost.cpp
r884 r1072 40 40 #include "TComRom.h" 41 41 #include "TComRdCost.h" 42 #if H_3D43 #include "TComDataCU.h"44 #endif45 42 46 43 //! \ingroup TLibCommon 47 44 //! \{ 48 45 49 #if H_3D_VSO50 // SAIT_VSO_EST_A003351 Double TComRdCost::m_dDisparityCoeff = 1.0;52 #endif53 46 TComRdCost::TComRdCost() 54 47 { … … 64 57 65 58 // Calculate RD functions 66 #if H_3D_VSO67 Double TComRdCost::calcRdCost( UInt uiBits, Dist uiDistortion, Bool bFlag, DFunc eDFunc )68 #else69 59 Double TComRdCost::calcRdCost( UInt uiBits, UInt uiDistortion, Bool bFlag, DFunc eDFunc ) 70 #endif71 60 { 72 61 Double dRdCost = 0.0; … … 122 111 } 123 112 124 #if H_3D_VSO125 Double TComRdCost::calcRdCost64( UInt64 uiBits, Dist64 uiDistortion, Bool bFlag, DFunc eDFunc )126 #else127 113 Double TComRdCost::calcRdCost64( UInt64 uiBits, UInt64 uiDistortion, Bool bFlag, DFunc eDFunc ) 128 #endif129 114 { 130 115 Double dRdCost = 0.0; … … 235 220 m_afpDistortFunc[28] = TComRdCost::xGetHADs; 236 221 237 #if H_3D_VSO238 // SAIT_VSO_EST_A0033239 m_afpDistortFunc[29] = TComRdCost::xGetVSD;240 m_afpDistortFunc[30] = TComRdCost::xGetVSD4;241 m_afpDistortFunc[31] = TComRdCost::xGetVSD8;242 m_afpDistortFunc[32] = TComRdCost::xGetVSD16;243 m_afpDistortFunc[33] = TComRdCost::xGetVSD32;244 m_afpDistortFunc[34] = TComRdCost::xGetVSD64;245 m_afpDistortFunc[35] = TComRdCost::xGetVSD16N;246 #endif247 222 #if !FIX203 248 223 m_puiComponentCostOriginP = NULL; … … 256 231 m_iSearchLimit = 0xdeaddead; 257 232 #endif 258 #if H_3D_VSO259 m_bUseVSO = false;260 m_uiVSOMode = 0;261 m_fpDistortFuncVSO = NULL;262 m_pcRenModel = NULL;263 264 // SAIT_VSO_EST_A0033265 m_bUseEstimatedVSD = false;266 #endif267 #if H_3D_DBBP268 m_bUseMask = false;269 #endif270 233 } 271 234 … … 328 291 rcDistParam.DistFunc = m_afpDistortFunc[eDFunc + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ]; 329 292 330 #if H_3D_DBBP331 if( m_bUseMask )332 {333 if( eDFunc >= DF_SSE && eDFunc <= DF_SSE16N )334 {335 rcDistParam.DistFunc = TComRdCost::xGetMaskedSSE;336 }337 else if( eDFunc >= DF_SAD && eDFunc <= DF_SADS16N )338 {339 rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;340 }341 else if( eDFunc >= DF_HADS && eDFunc <= DF_HADS16N )342 {343 rcDistParam.DistFunc = TComRdCost::xGetMaskedHADs;344 }345 else if( eDFunc >= DF_VSD && eDFunc <= DF_VSD16N )346 {347 rcDistParam.DistFunc = TComRdCost::xGetMaskedVSD;348 }349 else if( eDFunc >= DF_SAD12 && eDFunc <= DF_SADS48 )350 {351 rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;352 }353 }354 #endif355 293 // initialize 356 294 rcDistParam.iSubShift = 0; … … 387 325 #endif 388 326 389 #if H_3D_DBBP390 if( m_bUseMask )391 {392 rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;393 }394 #endif395 327 // initialize 396 328 rcDistParam.iSubShift = 0; … … 438 370 } 439 371 440 #if H_3D_DBBP441 if( m_bUseMask )442 {443 rcDistParam.DistFunc = (bHADME)?TComRdCost::xGetMaskedHADs:TComRdCost::xGetMaskedSAD;444 }445 #endif446 372 // initialize 447 373 rcDistParam.iSubShift = 0; … … 461 387 rcDP.bitDepth = bitDepth; 462 388 rcDP.DistFunc = m_afpDistortFunc[ ( bHadamard ? DF_HADS : DF_SADS ) + g_aucConvertToBit[ iWidth ] + 1 ]; 463 #if H_3D_DBBP464 if( m_bUseMask )465 {466 rcDP.DistFunc = (bHadamard)?TComRdCost::xGetMaskedHADs:TComRdCost::xGetMaskedSAD;467 }468 #endif469 389 } 470 390 … … 505 425 } 506 426 507 #if H_3D_FAST_DEPTH_INTRA508 509 UInt TComRdCost::calcVAR (Pel* pi0, Int stride, Int width, Int height, Int cuDepth)510 {511 Int temp = 0;512 513 for (Int y = 0; y < height; y++)514 {515 for (Int x = 0; x < width; x++)516 {517 temp += pi0[ y * stride + x ];518 }519 }520 521 Int cuMaxLog2Size = g_aucConvertToBit[g_uiMaxCUWidth]+2;522 523 if ( width == 4 )524 {525 cuDepth = cuMaxLog2Size - 2;526 }527 528 temp = temp >> (cuMaxLog2Size-cuDepth) * 2;529 530 UInt sum = 0;531 for (Int y = 0; y < height; y++)532 {533 for (Int x = 0; x < width; x++)534 {535 sum += (pi0[ y * stride + x ] - temp ) * (pi0[ y * stride + x ] - temp );536 }537 }538 return (sum >> (cuMaxLog2Size-cuDepth)*2);539 540 }541 #endif542 427 543 428 … … 556 441 cDtParam.bitDepth = bitDepth; 557 442 558 #if H_3D_IC559 cDtParam.bUseIC = false;560 #endif561 #if H_3D_INTER_SDC562 cDtParam.bUseSDCMRSAD = false;563 #endif564 443 if (eText == TEXT_CHROMA_U) 565 444 { … … 575 454 } 576 455 } 577 #if H_3D_VSO 578 // SAIT_VSO_EST_A0033 579 UInt TComRdCost::getDistPartVSD( TComDataCU* pcCU, UInt uiPartOffset, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bHAD, DFunc eDFunc ) 580 { 581 AOT( ( m_dDisparityCoeff <= 0 ) || ( m_dDisparityCoeff > 10 ) ); 582 583 Pel* piVirRec = m_pcVideoRecPicYuv->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()+uiPartOffset); 584 Pel* piVirOrg = m_pcDepthPicYuv ->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()+uiPartOffset); 585 Int iVirStride = m_pcVideoRecPicYuv->getStride(); 586 587 DistParam cDtParam; 588 setDistParam( uiBlkWidth, uiBlkHeight, eDFunc, cDtParam ); 589 cDtParam.pOrg = piOrg; 590 cDtParam.pCur = piCur; 591 cDtParam.pVirRec = piVirRec; 592 cDtParam.pVirOrg = piVirOrg; 593 cDtParam.iStrideVir = iVirStride; 594 cDtParam.iStrideOrg = iOrgStride; 595 cDtParam.iStrideCur = iCurStride; 596 cDtParam.iStep = 1; 597 598 cDtParam.bApplyWeight = false; 599 cDtParam.uiComp = 255; // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed. 600 601 cDtParam.bitDepth = g_bitDepthY; 602 603 Dist dist = cDtParam.DistFunc( &cDtParam ); 604 605 if ( m_bUseWVSO ) 606 { 607 Int iDWeight = m_iDWeight * m_iDWeight; 608 Int iVSOWeight = m_iVSDWeight * m_iVSDWeight; 609 Dist distDepth; 610 611 if ( !bHAD ) 612 { 613 distDepth = (Dist) getDistPart( g_bitDepthY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight); 614 } 615 else 616 { 617 distDepth = (Dist) calcHAD( g_bitDepthY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight); 618 } 619 620 dist = (Dist) (iDWeight * distDepth + iVSOWeight * dist ) / ( iDWeight + iVSOWeight); 621 } 622 623 return (UInt) dist; 624 } 625 #endif 626 627 #if KWU_RC_MADPRED_E0227 628 UInt TComRdCost::getSADPart ( Int bitDepth, Pel* pelCur, Int curStride, Pel* pelOrg, Int orgStride, UInt width, UInt height ) 629 { 630 UInt SAD = 0; 631 Int shift = DISTORTION_PRECISION_ADJUSTMENT(bitDepth-8); 632 for ( Int i=0; i<height; i++ ) 633 { 634 for( Int j=0; j<width; j++ ) 635 { 636 SAD += abs((pelCur[j] - pelOrg[j])) >> shift; 637 } 638 pelCur = pelCur + curStride; 639 pelOrg = pelOrg + orgStride; 640 } 641 return SAD; 642 } 643 #endif 456 644 457 645 458 // ==================================================================================================================== … … 647 460 // ==================================================================================================================== 648 461 649 #if H_3D_DBBP650 462 // -------------------------------------------------------------------------------------------------------------------- 651 // Masked distortion functions463 // SAD 652 464 // -------------------------------------------------------------------------------------------------------------------- 653 465 654 UInt TComRdCost::xGetMaskedSSE( DistParam* pcDtParam ) 655 { 656 Pel* piOrg = pcDtParam->pOrg; 657 Pel* piCur = pcDtParam->pCur; 658 Int iRows = pcDtParam->iRows; 659 Int iCols = pcDtParam->iCols; 660 Int iStrideOrg = pcDtParam->iStrideOrg; 661 Int iStrideCur = pcDtParam->iStrideCur; 662 663 UInt uiSum = 0; 664 665 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 666 667 Int iTemp; 668 669 for( ; iRows != 0; iRows-- ) 670 { 671 for (Int n = 0; n < iCols; n++ ) 672 { 673 if( piOrg[n] != DBBP_INVALID_SHORT ) 674 { 675 iTemp = piOrg[n ] - piCur[n ]; 676 uiSum += ( iTemp * iTemp ) >> uiShift; 677 } 678 } 679 piOrg += iStrideOrg; 680 piCur += iStrideCur; 681 } 682 683 return ( uiSum ); 684 } 685 686 UInt TComRdCost::xGetMaskedSAD( DistParam* pcDtParam ) 687 { 688 689 AOF(!pcDtParam->bApplyWeight); 690 #if H_3D_IC 691 AOF(!pcDtParam->bUseIC); 692 #endif 693 466 UInt TComRdCost::xGetSAD( DistParam* pcDtParam ) 467 { 468 if ( pcDtParam->bApplyWeight ) 469 { 470 return xGetSADw( pcDtParam ); 471 } 694 472 Pel* piOrg = pcDtParam->pOrg; 695 473 Pel* piCur = pcDtParam->pCur; … … 705 483 for (Int n = 0; n < iCols; n++ ) 706 484 { 707 if( piOrg[n] != DBBP_INVALID_SHORT ) 708 { 709 uiSum += abs( piOrg[n] - piCur[n] ); 710 } 485 uiSum += abs( piOrg[n] - piCur[n] ); 711 486 } 712 487 piOrg += iStrideOrg; … … 717 492 } 718 493 719 UInt TComRdCost::xGetMaskedHADs( DistParam* pcDtParam ) 720 { 721 AOF(!pcDtParam->bApplyWeight); 722 #if H_3D_IC 723 AOF(!pcDtParam->bUseIC); 724 #endif 725 Pel* piOrg = pcDtParam->pOrg; 726 Pel* piCur = pcDtParam->pCur; 727 Int iRows = pcDtParam->iRows; 728 Int iCols = pcDtParam->iCols; 729 Int iStrideCur = pcDtParam->iStrideCur; 730 Int iStrideOrg = pcDtParam->iStrideOrg; 731 Int iStep = pcDtParam->iStep; 732 733 Int x, y; 734 735 UInt uiSum = 0; 736 737 #if NS_HAD 738 if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) ) 739 #else 740 if( ( iRows % 8 == 0) && (iCols % 8 == 0) ) 741 #endif 742 { 743 Int iOffsetOrg = iStrideOrg<<3; 744 Int iOffsetCur = iStrideCur<<3; 745 for ( y=0; y<iRows; y+= 8 ) 746 { 747 for ( x=0; x<iCols; x+= 8 ) 748 { 749 if( piOrg[x] != DBBP_INVALID_SHORT ) 750 { 751 uiSum += xCalcHADs8x8( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 752 } 753 } 754 piOrg += iOffsetOrg; 755 piCur += iOffsetCur; 756 } 757 } 758 #if NS_HAD 759 else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD ) 760 { 761 Int iOffsetOrg = iStrideOrg<<2; 762 Int iOffsetCur = iStrideCur<<2; 763 for ( y=0; y<iRows; y+= 4 ) 764 { 765 for ( x=0; x<iCols; x+= 16 ) 766 { 767 if( piOrg[x] != DBBP_INVALID_SHORT ) 768 { 769 uiSum += xCalcHADs16x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 770 } 771 } 772 piOrg += iOffsetOrg; 773 piCur += iOffsetCur; 774 } 775 } 776 else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD ) 777 { 778 Int iOffsetOrg = iStrideOrg<<4; 779 Int iOffsetCur = iStrideCur<<4; 780 for ( y=0; y<iRows; y+= 16 ) 781 { 782 for ( x=0; x<iCols; x+= 4 ) 783 { 784 if( piOrg[x] != DBBP_INVALID_SHORT ) 785 { 786 uiSum += xCalcHADs4x16( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 787 } 788 } 789 piOrg += iOffsetOrg; 790 piCur += iOffsetCur; 791 } 792 } 793 #endif 794 else if( ( iRows % 4 == 0) && (iCols % 4 == 0) ) 795 { 796 Int iOffsetOrg = iStrideOrg<<2; 797 Int iOffsetCur = iStrideCur<<2; 798 799 for ( y=0; y<iRows; y+= 4 ) 800 { 801 for ( x=0; x<iCols; x+= 4 ) 802 { 803 if( piOrg[x] != DBBP_INVALID_SHORT ) 804 { 805 uiSum += xCalcHADs4x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 806 } 807 } 808 piOrg += iOffsetOrg; 809 piCur += iOffsetCur; 810 } 811 } 812 else if( ( iRows % 2 == 0) && (iCols % 2 == 0) ) 813 { 814 Int iOffsetOrg = iStrideOrg<<1; 815 Int iOffsetCur = iStrideCur<<1; 816 for ( y=0; y<iRows; y+=2 ) 817 { 818 for ( x=0; x<iCols; x+=2 ) 819 { 820 if( piOrg[x] != DBBP_INVALID_SHORT ) 821 { 822 uiSum += xCalcHADs2x2( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 823 } 824 } 825 piOrg += iOffsetOrg; 826 piCur += iOffsetCur; 827 } 828 } 829 else 830 { 831 assert(false); 832 } 833 834 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 835 } 836 837 UInt TComRdCost::xGetMaskedVSD( DistParam* pcDtParam ) 838 { 839 Pel* piOrg = pcDtParam->pOrg; 840 Pel* piCur = pcDtParam->pCur; 841 Pel* piVirRec = pcDtParam->pVirRec; 842 Pel* piVirOrg = pcDtParam->pVirOrg; 843 Int iRows = pcDtParam->iRows; 844 Int iCols = pcDtParam->iCols; 845 Int iStrideOrg = pcDtParam->iStrideOrg; 846 Int iStrideCur = pcDtParam->iStrideCur; 847 Int iStrideVir = pcDtParam->iStrideVir; 848 849 UInt uiSum = 0; 850 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1; 851 852 Int dDM; 853 854 for ( Int y = 0 ; y < iRows ; y++ ) 855 { 856 for (Int x = 0; x < iCols; x++ ) 857 { 858 if( piOrg[x] != DBBP_INVALID_SHORT ) 859 { 860 dDM = (Int) ( piOrg[x ] - piCur[x ] ); 861 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; 862 } 863 } 864 piOrg += iStrideOrg; 865 piCur += iStrideCur; 866 } 867 868 return ( uiSum ); 869 } 870 #endif 871 // -------------------------------------------------------------------------------------------------------------------- 872 // SAD 873 // -------------------------------------------------------------------------------------------------------------------- 874 875 UInt TComRdCost::xGetSAD( DistParam* pcDtParam ) 876 { 877 if ( pcDtParam->bApplyWeight ) 494 UInt TComRdCost::xGetSAD4( DistParam* pcDtParam ) 495 { 496 if ( pcDtParam->bApplyWeight ) 878 497 { 879 498 return xGetSADw( pcDtParam ); 880 499 } 881 #if H_3D_IC882 if( pcDtParam->bUseIC )883 {884 return xGetSADic( pcDtParam );885 }886 #endif887 #if H_3D_INTER_SDC888 if( pcDtParam->bUseSDCMRSAD )889 {890 return xGetSADic( pcDtParam );891 }892 #endif893 Pel* piOrg = pcDtParam->pOrg;894 Pel* piCur = pcDtParam->pCur;895 Int iRows = pcDtParam->iRows;896 Int iCols = pcDtParam->iCols;897 Int iStrideCur = pcDtParam->iStrideCur;898 Int iStrideOrg = pcDtParam->iStrideOrg;899 900 UInt uiSum = 0;901 902 for( ; iRows != 0; iRows-- )903 {904 for (Int n = 0; n < iCols; n++ )905 {906 uiSum += abs( piOrg[n] - piCur[n] );907 }908 piOrg += iStrideOrg;909 piCur += iStrideCur;910 }911 912 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);913 }914 915 UInt TComRdCost::xGetSAD4( DistParam* pcDtParam )916 {917 if ( pcDtParam->bApplyWeight )918 {919 return xGetSADw( pcDtParam );920 }921 #if H_3D_IC922 if( pcDtParam->bUseIC )923 {924 return xGetSAD4ic( pcDtParam );925 }926 #endif927 #if H_3D_INTER_SDC928 if( pcDtParam->bUseSDCMRSAD )929 {930 return xGetSAD4ic( pcDtParam );931 }932 #endif933 500 Pel* piOrg = pcDtParam->pOrg; 934 501 Pel* piCur = pcDtParam->pCur; … … 962 529 return xGetSADw( pcDtParam ); 963 530 } 964 #if H_3D_IC965 if( pcDtParam->bUseIC )966 {967 return xGetSAD8ic( pcDtParam );968 }969 #endif970 #if H_3D_INTER_SDC971 if( pcDtParam->bUseSDCMRSAD )972 {973 return xGetSAD8ic( pcDtParam );974 }975 #endif976 531 Pel* piOrg = pcDtParam->pOrg; 977 532 Pel* piCur = pcDtParam->pCur; … … 1009 564 return xGetSADw( pcDtParam ); 1010 565 } 1011 #if H_3D_IC1012 if( pcDtParam->bUseIC )1013 {1014 return xGetSAD16ic( pcDtParam );1015 }1016 #endif1017 #if H_3D_INTER_SDC1018 if( pcDtParam->bUseSDCMRSAD )1019 {1020 return xGetSAD16ic( pcDtParam );1021 }1022 #endif1023 566 Pel* piOrg = pcDtParam->pOrg; 1024 567 Pel* piCur = pcDtParam->pCur; … … 1065 608 return xGetSADw( pcDtParam ); 1066 609 } 1067 #if H_3D_IC1068 if( pcDtParam->bUseIC )1069 {1070 return xGetSAD12ic( pcDtParam );1071 }1072 #endif1073 #if H_3D_INTER_SDC1074 if( pcDtParam->bUseSDCMRSAD )1075 {1076 return xGetSAD12ic( pcDtParam );1077 }1078 #endif1079 610 Pel* piOrg = pcDtParam->pOrg; 1080 611 Pel* piCur = pcDtParam->pCur; … … 1113 644 UInt TComRdCost::xGetSAD16N( DistParam* pcDtParam ) 1114 645 { 1115 #if H_3D_IC1116 if( pcDtParam->bUseIC )1117 {1118 return xGetSAD16Nic( pcDtParam );1119 }1120 #endif1121 #if H_3D_INTER_SDC1122 if( pcDtParam->bUseSDCMRSAD )1123 {1124 return xGetSAD16Nic( pcDtParam );1125 }1126 #endif1127 646 Pel* piOrg = pcDtParam->pOrg; 1128 647 Pel* piCur = pcDtParam->pCur; … … 1171 690 return xGetSADw( pcDtParam ); 1172 691 } 1173 #if H_3D_IC1174 if( pcDtParam->bUseIC )1175 {1176 return xGetSAD32ic( pcDtParam );1177 }1178 #endif1179 #if H_3D_INTER_SDC1180 if( pcDtParam->bUseSDCMRSAD )1181 {1182 return xGetSAD32ic( pcDtParam );1183 }1184 #endif1185 692 Pel* piOrg = pcDtParam->pOrg; 1186 693 Pel* piCur = pcDtParam->pCur; … … 1243 750 return xGetSADw( pcDtParam ); 1244 751 } 1245 #if H_3D_IC1246 if( pcDtParam->bUseIC )1247 {1248 return xGetSAD24ic( pcDtParam );1249 }1250 #endif1251 #if H_3D_INTER_SDC1252 if( pcDtParam->bUseSDCMRSAD )1253 {1254 return xGetSAD24ic( pcDtParam );1255 }1256 #endif1257 752 Pel* piOrg = pcDtParam->pOrg; 1258 753 Pel* piCur = pcDtParam->pCur; … … 1308 803 return xGetSADw( pcDtParam ); 1309 804 } 1310 #if H_3D_IC1311 if( pcDtParam->bUseIC )1312 {1313 return xGetSAD64ic( pcDtParam );1314 }1315 #endif1316 #if H_3D_INTER_SDC1317 if( pcDtParam->bUseSDCMRSAD )1318 {1319 return xGetSAD64ic( pcDtParam );1320 }1321 #endif1322 805 Pel* piOrg = pcDtParam->pOrg; 1323 806 Pel* piCur = pcDtParam->pCur; … … 1412 895 return xGetSADw( pcDtParam ); 1413 896 } 1414 #if H_3D_IC1415 if( pcDtParam->bUseIC )1416 {1417 return xGetSAD48ic( pcDtParam );1418 }1419 #endif1420 #if H_3D_INTER_SDC1421 if( pcDtParam->bUseSDCMRSAD )1422 {1423 return xGetSAD48ic( pcDtParam );1424 }1425 #endif1426 897 Pel* piOrg = pcDtParam->pOrg; 1427 898 Pel* piCur = pcDtParam->pCur; … … 1494 965 #endif 1495 966 1496 #if H_3D_IC || H_3D_INTER_SDC1497 UInt TComRdCost::xGetSADic( DistParam* pcDtParam )1498 {1499 if ( pcDtParam->bApplyWeight )1500 {1501 return xGetSADw( pcDtParam );1502 }1503 Pel* piOrg = pcDtParam->pOrg;1504 Pel* piCur = pcDtParam->pCur;1505 Int iRows = pcDtParam->iRows;1506 Int iCols = pcDtParam->iCols;1507 Int iStrideCur = pcDtParam->iStrideCur;1508 Int iStrideOrg = pcDtParam->iStrideOrg;1509 1510 UInt uiSum = 0;1511 1512 Int iOrigAvg = 0, iCurAvg = 0;1513 Int iDeltaC;1514 1515 for( ; iRows != 0; iRows-- )1516 {1517 for (Int n = 0; n < iCols; n++ )1518 {1519 iOrigAvg += piOrg[n];1520 iCurAvg += piCur[n];1521 }1522 piOrg += iStrideOrg;1523 piCur += iStrideCur;1524 }1525 1526 piOrg = pcDtParam->pOrg;1527 piCur = pcDtParam->pCur;1528 iRows = pcDtParam->iRows;1529 1530 iDeltaC = (iOrigAvg - iCurAvg)/iCols/iRows;1531 1532 for( ; iRows != 0; iRows-- )1533 {1534 for (Int n = 0; n < iCols; n++ )1535 {1536 uiSum += abs( piOrg[n] - piCur[n] - iDeltaC );1537 }1538 piOrg += iStrideOrg;1539 piCur += iStrideCur;1540 }1541 1542 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );1543 }1544 1545 UInt TComRdCost::xGetSAD4ic( DistParam* pcDtParam )1546 {1547 if ( pcDtParam->bApplyWeight )1548 {1549 return xGetSADw( pcDtParam );1550 }1551 Pel* piOrg = pcDtParam->pOrg;1552 Pel* piCur = pcDtParam->pCur;1553 Int iRows = pcDtParam->iRows;1554 Int iSubShift = pcDtParam->iSubShift;1555 Int iSubStep = ( 1 << iSubShift );1556 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;1557 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;1558 1559 UInt uiSum = 0;1560 1561 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0;1562 Int iDeltaC;1563 1564 for( ; iRows != 0; iRows-=iSubStep )1565 {1566 iOrigAvg += piOrg[0];1567 iOrigAvg += piOrg[1];1568 iOrigAvg += piOrg[2];1569 iOrigAvg += piOrg[3];1570 1571 iCurAvg += piCur[0];1572 iCurAvg += piCur[1];1573 iCurAvg += piCur[2];1574 iCurAvg += piCur[3];1575 1576 piOrg += iStrideOrg;1577 piCur += iStrideCur;1578 uiRowCnt++;1579 }1580 1581 piOrg = pcDtParam->pOrg;1582 piCur = pcDtParam->pCur;1583 iRows = pcDtParam->iRows;1584 1585 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/4) : 0;1586 1587 for( ; iRows != 0; iRows-=iSubStep )1588 {1589 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC );1590 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC );1591 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC );1592 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC );1593 1594 piOrg += iStrideOrg;1595 piCur += iStrideCur;1596 }1597 1598 uiSum <<= iSubShift;1599 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );1600 }1601 1602 UInt TComRdCost::xGetSAD8ic( DistParam* pcDtParam )1603 {1604 if ( pcDtParam->bApplyWeight )1605 {1606 return xGetSADw( pcDtParam );1607 }1608 Pel* piOrg = pcDtParam->pOrg;1609 Pel* piCur = pcDtParam->pCur;1610 Int iRows = pcDtParam->iRows;1611 Int iSubShift = pcDtParam->iSubShift;1612 Int iSubStep = ( 1 << iSubShift );1613 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;1614 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;1615 1616 UInt uiSum = 0;1617 1618 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0;1619 Int iDeltaC;1620 1621 for( ; iRows != 0; iRows-=iSubStep )1622 {1623 iOrigAvg += piOrg[0];1624 iOrigAvg += piOrg[1];1625 iOrigAvg += piOrg[2];1626 iOrigAvg += piOrg[3];1627 iOrigAvg += piOrg[4];1628 iOrigAvg += piOrg[5];1629 iOrigAvg += piOrg[6];1630 iOrigAvg += piOrg[7];1631 1632 iCurAvg += piCur[0];1633 iCurAvg += piCur[1];1634 iCurAvg += piCur[2];1635 iCurAvg += piCur[3];1636 iCurAvg += piCur[4];1637 iCurAvg += piCur[5];1638 iCurAvg += piCur[6];1639 iCurAvg += piCur[7];1640 1641 piOrg += iStrideOrg;1642 piCur += iStrideCur;1643 uiRowCnt++;1644 }1645 1646 piOrg = pcDtParam->pOrg;1647 piCur = pcDtParam->pCur;1648 iRows = pcDtParam->iRows;1649 1650 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/8) : 0;1651 1652 for( ; iRows != 0; iRows-=iSubStep )1653 {1654 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC );1655 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC );1656 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC );1657 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC );1658 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC );1659 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC );1660 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC );1661 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC );1662 1663 piOrg += iStrideOrg;1664 piCur += iStrideCur;1665 }1666 1667 uiSum <<= iSubShift;1668 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );1669 }1670 1671 UInt TComRdCost::xGetSAD16ic( DistParam* pcDtParam )1672 {1673 if ( pcDtParam->bApplyWeight )1674 {1675 return xGetSADw( pcDtParam );1676 }1677 Pel* piOrg = pcDtParam->pOrg;1678 Pel* piCur = pcDtParam->pCur;1679 Int iRows = pcDtParam->iRows;1680 Int iSubShift = pcDtParam->iSubShift;1681 Int iSubStep = ( 1 << iSubShift );1682 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;1683 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;1684 1685 UInt uiSum = 0;1686 1687 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0;1688 Int iDeltaC;1689 1690 for( ; iRows != 0; iRows-=iSubStep )1691 {1692 iOrigAvg += piOrg[0];1693 iOrigAvg += piOrg[1];1694 iOrigAvg += piOrg[2];1695 iOrigAvg += piOrg[3];1696 iOrigAvg += piOrg[4];1697 iOrigAvg += piOrg[5];1698 iOrigAvg += piOrg[6];1699 iOrigAvg += piOrg[7];1700 iOrigAvg += piOrg[8];1701 iOrigAvg += piOrg[9];1702 iOrigAvg += piOrg[10];1703 iOrigAvg += piOrg[11];1704 iOrigAvg += piOrg[12];1705 iOrigAvg += piOrg[13];1706 iOrigAvg += piOrg[14];1707 iOrigAvg += piOrg[15];1708 1709 iCurAvg += piCur[0];1710 iCurAvg += piCur[1];1711 iCurAvg += piCur[2];1712 iCurAvg += piCur[3];1713 iCurAvg += piCur[4];1714 iCurAvg += piCur[5];1715 iCurAvg += piCur[6];1716 iCurAvg += piCur[7];1717 iCurAvg += piCur[8];1718 iCurAvg += piCur[9];1719 iCurAvg += piCur[10];1720 iCurAvg += piCur[11];1721 iCurAvg += piCur[12];1722 iCurAvg += piCur[13];1723 iCurAvg += piCur[14];1724 iCurAvg += piCur[15];1725 1726 piOrg += iStrideOrg;1727 piCur += iStrideCur;1728 uiRowCnt++;1729 }1730 1731 piOrg = pcDtParam->pOrg;1732 piCur = pcDtParam->pCur;1733 iRows = pcDtParam->iRows;1734 1735 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/16) : 0;1736 1737 for( ; iRows != 0; iRows-=iSubStep )1738 {1739 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC );1740 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC );1741 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC );1742 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC );1743 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC );1744 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC );1745 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC );1746 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC );1747 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC );1748 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC );1749 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC );1750 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC );1751 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC );1752 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC );1753 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC );1754 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC );1755 1756 piOrg += iStrideOrg;1757 piCur += iStrideCur;1758 }1759 1760 uiSum <<= iSubShift;1761 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );1762 }1763 1764 #if AMP_SAD1765 UInt TComRdCost::xGetSAD12ic( DistParam* pcDtParam )1766 {1767 if ( pcDtParam->bApplyWeight )1768 {1769 return xGetSADw( pcDtParam );1770 }1771 Pel* piOrg = pcDtParam->pOrg;1772 Pel* piCur = pcDtParam->pCur;1773 Int iRows = pcDtParam->iRows;1774 Int iSubShift = pcDtParam->iSubShift;1775 Int iSubStep = ( 1 << iSubShift );1776 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;1777 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;1778 1779 UInt uiSum = 0;1780 1781 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0;1782 Int iDeltaC;1783 1784 for( ; iRows != 0; iRows-=iSubStep )1785 {1786 iOrigAvg += piOrg[0];1787 iOrigAvg += piOrg[1];1788 iOrigAvg += piOrg[2];1789 iOrigAvg += piOrg[3];1790 iOrigAvg += piOrg[4];1791 iOrigAvg += piOrg[5];1792 iOrigAvg += piOrg[6];1793 iOrigAvg += piOrg[7];1794 iOrigAvg += piOrg[8];1795 iOrigAvg += piOrg[9];1796 iOrigAvg += piOrg[10];1797 iOrigAvg += piOrg[11];1798 1799 iCurAvg += piCur[0];1800 iCurAvg += piCur[1];1801 iCurAvg += piCur[2];1802 iCurAvg += piCur[3];1803 iCurAvg += piCur[4];1804 iCurAvg += piCur[5];1805 iCurAvg += piCur[6];1806 iCurAvg += piCur[7];1807 iCurAvg += piCur[8];1808 iCurAvg += piCur[9];1809 iCurAvg += piCur[10];1810 iCurAvg += piCur[11];1811 1812 piOrg += iStrideOrg;1813 piCur += iStrideCur;1814 uiRowCnt++;1815 }1816 1817 piOrg = pcDtParam->pOrg;1818 piCur = pcDtParam->pCur;1819 iRows = pcDtParam->iRows;1820 1821 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/12) : 0;1822 1823 for( ; iRows != 0; iRows-=iSubStep )1824 {1825 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC );1826 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC );1827 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC );1828 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC );1829 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC );1830 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC );1831 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC );1832 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC );1833 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC );1834 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC );1835 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC );1836 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC );1837 1838 piOrg += iStrideOrg;1839 piCur += iStrideCur;1840 }1841 1842 uiSum <<= iSubShift;1843 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );1844 }1845 #endif1846 1847 UInt TComRdCost::xGetSAD16Nic( DistParam* pcDtParam )1848 {1849 Pel* piOrg = pcDtParam->pOrg;1850 Pel* piCur = pcDtParam->pCur;1851 Int iRows = pcDtParam->iRows;1852 Int iCols = pcDtParam->iCols;1853 Int iSubShift = pcDtParam->iSubShift;1854 Int iSubStep = ( 1 << iSubShift );1855 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;1856 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;1857 1858 UInt uiSum = 0;1859 1860 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0, uiColCnt = (iCols-1)/16 + 1;1861 Int iDeltaC;1862 1863 for( ; iRows != 0; iRows-=iSubStep )1864 {1865 for (Int n = 0; n < iCols; n+=16 )1866 {1867 iOrigAvg += piOrg[n + 0];1868 iOrigAvg += piOrg[n + 1];1869 iOrigAvg += piOrg[n + 2];1870 iOrigAvg += piOrg[n + 3];1871 iOrigAvg += piOrg[n + 4];1872 iOrigAvg += piOrg[n + 5];1873 iOrigAvg += piOrg[n + 6];1874 iOrigAvg += piOrg[n + 7];1875 iOrigAvg += piOrg[n + 8];1876 iOrigAvg += piOrg[n + 9];1877 iOrigAvg += piOrg[n + 10];1878 iOrigAvg += piOrg[n + 11];1879 iOrigAvg += piOrg[n + 12];1880 iOrigAvg += piOrg[n + 13];1881 iOrigAvg += piOrg[n + 14];1882 iOrigAvg += piOrg[n + 15];1883 1884 iCurAvg += piCur[n + 0];1885 iCurAvg += piCur[n + 1];1886 iCurAvg += piCur[n + 2];1887 iCurAvg += piCur[n + 3];1888 iCurAvg += piCur[n + 4];1889 iCurAvg += piCur[n + 5];1890 iCurAvg += piCur[n + 6];1891 iCurAvg += piCur[n + 7];1892 iCurAvg += piCur[n + 8];1893 iCurAvg += piCur[n + 9];1894 iCurAvg += piCur[n + 10];1895 iCurAvg += piCur[n + 11];1896 iCurAvg += piCur[n + 12];1897 iCurAvg += piCur[n + 13];1898 iCurAvg += piCur[n + 14];1899 iCurAvg += piCur[n + 15];1900 }1901 piOrg += iStrideOrg;1902 piCur += iStrideCur;1903 uiRowCnt++;1904 }1905 piOrg = pcDtParam->pOrg;1906 piCur = pcDtParam->pCur;1907 iRows = pcDtParam->iRows;1908 1909 iDeltaC = (uiRowCnt && uiColCnt) ? ((iOrigAvg - iCurAvg)/uiRowCnt/uiColCnt/16) : 0;1910 1911 for( ; iRows != 0; iRows-=iSubStep )1912 {1913 for (Int n = 0; n < iCols; n+=16 )1914 {1915 uiSum += abs( piOrg[n+ 0] - piCur[n+ 0] - iDeltaC );1916 uiSum += abs( piOrg[n+ 1] - piCur[n+ 1] - iDeltaC );1917 uiSum += abs( piOrg[n+ 2] - piCur[n+ 2] - iDeltaC );1918 uiSum += abs( piOrg[n+ 3] - piCur[n+ 3] - iDeltaC );1919 uiSum += abs( piOrg[n+ 4] - piCur[n+ 4] - iDeltaC );1920 uiSum += abs( piOrg[n+ 5] - piCur[n+ 5] - iDeltaC );1921 uiSum += abs( piOrg[n+ 6] - piCur[n+ 6] - iDeltaC );1922 uiSum += abs( piOrg[n+ 7] - piCur[n+ 7] - iDeltaC );1923 uiSum += abs( piOrg[n+ 8] - piCur[n+ 8] - iDeltaC );1924 uiSum += abs( piOrg[n+ 9] - piCur[n+ 9] - iDeltaC );1925 uiSum += abs( piOrg[n+10] - piCur[n+10] - iDeltaC );1926 uiSum += abs( piOrg[n+11] - piCur[n+11] - iDeltaC );1927 uiSum += abs( piOrg[n+12] - piCur[n+12] - iDeltaC );1928 uiSum += abs( piOrg[n+13] - piCur[n+13] - iDeltaC );1929 uiSum += abs( piOrg[n+14] - piCur[n+14] - iDeltaC );1930 uiSum += abs( piOrg[n+15] - piCur[n+15] - iDeltaC );1931 }1932 piOrg += iStrideOrg;1933 piCur += iStrideCur;1934 }1935 1936 uiSum <<= iSubShift;1937 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );1938 }1939 1940 UInt TComRdCost::xGetSAD32ic( DistParam* pcDtParam )1941 {1942 if ( pcDtParam->bApplyWeight )1943 {1944 return xGetSADw( pcDtParam );1945 }1946 Pel* piOrg = pcDtParam->pOrg;1947 Pel* piCur = pcDtParam->pCur;1948 Int iRows = pcDtParam->iRows;1949 Int iSubShift = pcDtParam->iSubShift;1950 Int iSubStep = ( 1 << iSubShift );1951 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;1952 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;1953 1954 UInt uiSum = 0;1955 1956 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0;1957 Int iDeltaC;1958 1959 for( ; iRows != 0; iRows-=iSubStep )1960 {1961 iOrigAvg += piOrg[0];1962 iOrigAvg += piOrg[1];1963 iOrigAvg += piOrg[2];1964 iOrigAvg += piOrg[3];1965 iOrigAvg += piOrg[4];1966 iOrigAvg += piOrg[5];1967 iOrigAvg += piOrg[6];1968 iOrigAvg += piOrg[7];1969 iOrigAvg += piOrg[8];1970 iOrigAvg += piOrg[9];1971 iOrigAvg += piOrg[10];1972 iOrigAvg += piOrg[11];1973 iOrigAvg += piOrg[12];1974 iOrigAvg += piOrg[13];1975 iOrigAvg += piOrg[14];1976 iOrigAvg += piOrg[15];1977 iOrigAvg += piOrg[16];1978 iOrigAvg += piOrg[17];1979 iOrigAvg += piOrg[18];1980 iOrigAvg += piOrg[19];1981 iOrigAvg += piOrg[20];1982 iOrigAvg += piOrg[21];1983 iOrigAvg += piOrg[22];1984 iOrigAvg += piOrg[23];1985 iOrigAvg += piOrg[24];1986 iOrigAvg += piOrg[25];1987 iOrigAvg += piOrg[26];1988 iOrigAvg += piOrg[27];1989 iOrigAvg += piOrg[28];1990 iOrigAvg += piOrg[29];1991 iOrigAvg += piOrg[30];1992 iOrigAvg += piOrg[31];1993 1994 iCurAvg += piCur[0];1995 iCurAvg += piCur[1];1996 iCurAvg += piCur[2];1997 iCurAvg += piCur[3];1998 iCurAvg += piCur[4];1999 iCurAvg += piCur[5];2000 iCurAvg += piCur[6];2001 iCurAvg += piCur[7];2002 iCurAvg += piCur[8];2003 iCurAvg += piCur[9];2004 iCurAvg += piCur[10];2005 iCurAvg += piCur[11];2006 iCurAvg += piCur[12];2007 iCurAvg += piCur[13];2008 iCurAvg += piCur[14];2009 iCurAvg += piCur[15];2010 iCurAvg += piCur[16];2011 iCurAvg += piCur[17];2012 iCurAvg += piCur[18];2013 iCurAvg += piCur[19];2014 iCurAvg += piCur[20];2015 iCurAvg += piCur[21];2016 iCurAvg += piCur[22];2017 iCurAvg += piCur[23];2018 iCurAvg += piCur[24];2019 iCurAvg += piCur[25];2020 iCurAvg += piCur[26];2021 iCurAvg += piCur[27];2022 iCurAvg += piCur[28];2023 iCurAvg += piCur[29];2024 iCurAvg += piCur[30];2025 iCurAvg += piCur[31];2026 2027 piOrg += iStrideOrg;2028 piCur += iStrideCur;2029 uiRowCnt++;2030 }2031 2032 piOrg = pcDtParam->pOrg;2033 piCur = pcDtParam->pCur;2034 iRows = pcDtParam->iRows;2035 2036 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/32) : 0;2037 2038 for( ; iRows != 0; iRows-=iSubStep )2039 {2040 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC );2041 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC );2042 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC );2043 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC );2044 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC );2045 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC );2046 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC );2047 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC );2048 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC );2049 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC );2050 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC );2051 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC );2052 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC );2053 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC );2054 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC );2055 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC );2056 uiSum += abs( piOrg[16] - piCur[16] - iDeltaC );2057 uiSum += abs( piOrg[17] - piCur[17] - iDeltaC );2058 uiSum += abs( piOrg[18] - piCur[18] - iDeltaC );2059 uiSum += abs( piOrg[19] - piCur[19] - iDeltaC );2060 uiSum += abs( piOrg[20] - piCur[20] - iDeltaC );2061 uiSum += abs( piOrg[21] - piCur[21] - iDeltaC );2062 uiSum += abs( piOrg[22] - piCur[22] - iDeltaC );2063 uiSum += abs( piOrg[23] - piCur[23] - iDeltaC );2064 uiSum += abs( piOrg[24] - piCur[24] - iDeltaC );2065 uiSum += abs( piOrg[25] - piCur[25] - iDeltaC );2066 uiSum += abs( piOrg[26] - piCur[26] - iDeltaC );2067 uiSum += abs( piOrg[27] - piCur[27] - iDeltaC );2068 uiSum += abs( piOrg[28] - piCur[28] - iDeltaC );2069 uiSum += abs( piOrg[29] - piCur[29] - iDeltaC );2070 uiSum += abs( piOrg[30] - piCur[30] - iDeltaC );2071 uiSum += abs( piOrg[31] - piCur[31] - iDeltaC );2072 2073 piOrg += iStrideOrg;2074 piCur += iStrideCur;2075 }2076 2077 uiSum <<= iSubShift;2078 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );2079 }2080 2081 #if AMP_SAD2082 UInt TComRdCost::xGetSAD24ic( DistParam* pcDtParam )2083 {2084 if ( pcDtParam->bApplyWeight )2085 {2086 return xGetSADw( pcDtParam );2087 }2088 Pel* piOrg = pcDtParam->pOrg;2089 Pel* piCur = pcDtParam->pCur;2090 Int iRows = pcDtParam->iRows;2091 Int iSubShift = pcDtParam->iSubShift;2092 Int iSubStep = ( 1 << iSubShift );2093 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;2094 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;2095 2096 UInt uiSum = 0;2097 2098 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0;2099 Int iDeltaC;2100 2101 for( ; iRows != 0; iRows-=iSubStep )2102 {2103 iOrigAvg += piOrg[0];2104 iOrigAvg += piOrg[1];2105 iOrigAvg += piOrg[2];2106 iOrigAvg += piOrg[3];2107 iOrigAvg += piOrg[4];2108 iOrigAvg += piOrg[5];2109 iOrigAvg += piOrg[6];2110 iOrigAvg += piOrg[7];2111 iOrigAvg += piOrg[8];2112 iOrigAvg += piOrg[9];2113 iOrigAvg += piOrg[10];2114 iOrigAvg += piOrg[11];2115 iOrigAvg += piOrg[12];2116 iOrigAvg += piOrg[13];2117 iOrigAvg += piOrg[14];2118 iOrigAvg += piOrg[15];2119 iOrigAvg += piOrg[16];2120 iOrigAvg += piOrg[17];2121 iOrigAvg += piOrg[18];2122 iOrigAvg += piOrg[19];2123 iOrigAvg += piOrg[20];2124 iOrigAvg += piOrg[21];2125 iOrigAvg += piOrg[22];2126 iOrigAvg += piOrg[23];2127 2128 iCurAvg += piCur[0];2129 iCurAvg += piCur[1];2130 iCurAvg += piCur[2];2131 iCurAvg += piCur[3];2132 iCurAvg += piCur[4];2133 iCurAvg += piCur[5];2134 iCurAvg += piCur[6];2135 iCurAvg += piCur[7];2136 iCurAvg += piCur[8];2137 iCurAvg += piCur[9];2138 iCurAvg += piCur[10];2139 iCurAvg += piCur[11];2140 iCurAvg += piCur[12];2141 iCurAvg += piCur[13];2142 iCurAvg += piCur[14];2143 iCurAvg += piCur[15];2144 iCurAvg += piCur[16];2145 iCurAvg += piCur[17];2146 iCurAvg += piCur[18];2147 iCurAvg += piCur[19];2148 iCurAvg += piCur[20];2149 iCurAvg += piCur[21];2150 iCurAvg += piCur[22];2151 iCurAvg += piCur[23];2152 2153 piOrg += iStrideOrg;2154 piCur += iStrideCur;2155 uiRowCnt++;2156 }2157 2158 piOrg = pcDtParam->pOrg;2159 piCur = pcDtParam->pCur;2160 iRows = pcDtParam->iRows;2161 2162 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/24) : 0;2163 2164 for( ; iRows != 0; iRows-=iSubStep )2165 {2166 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC );2167 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC );2168 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC );2169 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC );2170 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC );2171 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC );2172 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC );2173 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC );2174 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC );2175 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC );2176 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC );2177 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC );2178 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC );2179 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC );2180 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC );2181 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC );2182 uiSum += abs( piOrg[16] - piCur[16] - iDeltaC );2183 uiSum += abs( piOrg[17] - piCur[17] - iDeltaC );2184 uiSum += abs( piOrg[18] - piCur[18] - iDeltaC );2185 uiSum += abs( piOrg[19] - piCur[19] - iDeltaC );2186 uiSum += abs( piOrg[20] - piCur[20] - iDeltaC );2187 uiSum += abs( piOrg[21] - piCur[21] - iDeltaC );2188 uiSum += abs( piOrg[22] - piCur[22] - iDeltaC );2189 uiSum += abs( piOrg[23] - piCur[23] - iDeltaC );2190 2191 piOrg += iStrideOrg;2192 piCur += iStrideCur;2193 }2194 2195 uiSum <<= iSubShift;2196 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );2197 }2198 #endif2199 2200 UInt TComRdCost::xGetSAD64ic( DistParam* pcDtParam )2201 {2202 if ( pcDtParam->bApplyWeight )2203 {2204 return xGetSADw( pcDtParam );2205 }2206 Pel* piOrg = pcDtParam->pOrg;2207 Pel* piCur = pcDtParam->pCur;2208 Int iRows = pcDtParam->iRows;2209 Int iSubShift = pcDtParam->iSubShift;2210 Int iSubStep = ( 1 << iSubShift );2211 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;2212 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;2213 2214 UInt uiSum = 0;2215 2216 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0;2217 Int iDeltaC;2218 2219 for( ; iRows != 0; iRows-=iSubStep )2220 {2221 iOrigAvg += piOrg[0] ;2222 iOrigAvg += piOrg[1] ;2223 iOrigAvg += piOrg[2] ;2224 iOrigAvg += piOrg[3] ;2225 iOrigAvg += piOrg[4] ;2226 iOrigAvg += piOrg[5] ;2227 iOrigAvg += piOrg[6] ;2228 iOrigAvg += piOrg[7] ;2229 iOrigAvg += piOrg[8] ;2230 iOrigAvg += piOrg[9] ;2231 iOrigAvg += piOrg[10] ;2232 iOrigAvg += piOrg[11] ;2233 iOrigAvg += piOrg[12] ;2234 iOrigAvg += piOrg[13] ;2235 iOrigAvg += piOrg[14] ;2236 iOrigAvg += piOrg[15] ;2237 iOrigAvg += piOrg[16] ;2238 iOrigAvg += piOrg[17] ;2239 iOrigAvg += piOrg[18] ;2240 iOrigAvg += piOrg[19] ;2241 iOrigAvg += piOrg[20] ;2242 iOrigAvg += piOrg[21] ;2243 iOrigAvg += piOrg[22] ;2244 iOrigAvg += piOrg[23] ;2245 iOrigAvg += piOrg[24] ;2246 iOrigAvg += piOrg[25] ;2247 iOrigAvg += piOrg[26] ;2248 iOrigAvg += piOrg[27] ;2249 iOrigAvg += piOrg[28] ;2250 iOrigAvg += piOrg[29] ;2251 iOrigAvg += piOrg[30] ;2252 iOrigAvg += piOrg[31] ;2253 iOrigAvg += piOrg[32] ;2254 iOrigAvg += piOrg[33] ;2255 iOrigAvg += piOrg[34] ;2256 iOrigAvg += piOrg[35] ;2257 iOrigAvg += piOrg[36] ;2258 iOrigAvg += piOrg[37] ;2259 iOrigAvg += piOrg[38] ;2260 iOrigAvg += piOrg[39] ;2261 iOrigAvg += piOrg[40] ;2262 iOrigAvg += piOrg[41] ;2263 iOrigAvg += piOrg[42] ;2264 iOrigAvg += piOrg[43] ;2265 iOrigAvg += piOrg[44] ;2266 iOrigAvg += piOrg[45] ;2267 iOrigAvg += piOrg[46] ;2268 iOrigAvg += piOrg[47] ;2269 iOrigAvg += piOrg[48] ;2270 iOrigAvg += piOrg[49] ;2271 iOrigAvg += piOrg[50] ;2272 iOrigAvg += piOrg[51] ;2273 iOrigAvg += piOrg[52] ;2274 iOrigAvg += piOrg[53] ;2275 iOrigAvg += piOrg[54] ;2276 iOrigAvg += piOrg[55] ;2277 iOrigAvg += piOrg[56] ;2278 iOrigAvg += piOrg[57] ;2279 iOrigAvg += piOrg[58] ;2280 iOrigAvg += piOrg[59] ;2281 iOrigAvg += piOrg[60] ;2282 iOrigAvg += piOrg[61] ;2283 iOrigAvg += piOrg[62] ;2284 iOrigAvg += piOrg[63] ;2285 2286 iCurAvg += piCur[0] ;2287 iCurAvg += piCur[1] ;2288 iCurAvg += piCur[2] ;2289 iCurAvg += piCur[3] ;2290 iCurAvg += piCur[4] ;2291 iCurAvg += piCur[5] ;2292 iCurAvg += piCur[6] ;2293 iCurAvg += piCur[7] ;2294 iCurAvg += piCur[8] ;2295 iCurAvg += piCur[9] ;2296 iCurAvg += piCur[10] ;2297 iCurAvg += piCur[11] ;2298 iCurAvg += piCur[12] ;2299 iCurAvg += piCur[13] ;2300 iCurAvg += piCur[14] ;2301 iCurAvg += piCur[15] ;2302 iCurAvg += piCur[16] ;2303 iCurAvg += piCur[17] ;2304 iCurAvg += piCur[18] ;2305 iCurAvg += piCur[19] ;2306 iCurAvg += piCur[20] ;2307 iCurAvg += piCur[21] ;2308 iCurAvg += piCur[22] ;2309 iCurAvg += piCur[23] ;2310 iCurAvg += piCur[24] ;2311 iCurAvg += piCur[25] ;2312 iCurAvg += piCur[26] ;2313 iCurAvg += piCur[27] ;2314 iCurAvg += piCur[28] ;2315 iCurAvg += piCur[29] ;2316 iCurAvg += piCur[30] ;2317 iCurAvg += piCur[31] ;2318 iCurAvg += piCur[32] ;2319 iCurAvg += piCur[33] ;2320 iCurAvg += piCur[34] ;2321 iCurAvg += piCur[35] ;2322 iCurAvg += piCur[36] ;2323 iCurAvg += piCur[37] ;2324 iCurAvg += piCur[38] ;2325 iCurAvg += piCur[39] ;2326 iCurAvg += piCur[40] ;2327 iCurAvg += piCur[41] ;2328 iCurAvg += piCur[42] ;2329 iCurAvg += piCur[43] ;2330 iCurAvg += piCur[44] ;2331 iCurAvg += piCur[45] ;2332 iCurAvg += piCur[46] ;2333 iCurAvg += piCur[47] ;2334 iCurAvg += piCur[48] ;2335 iCurAvg += piCur[49] ;2336 iCurAvg += piCur[50] ;2337 iCurAvg += piCur[51] ;2338 iCurAvg += piCur[52] ;2339 iCurAvg += piCur[53] ;2340 iCurAvg += piCur[54] ;2341 iCurAvg += piCur[55] ;2342 iCurAvg += piCur[56] ;2343 iCurAvg += piCur[57] ;2344 iCurAvg += piCur[58] ;2345 iCurAvg += piCur[59] ;2346 iCurAvg += piCur[60] ;2347 iCurAvg += piCur[61] ;2348 iCurAvg += piCur[62] ;2349 iCurAvg += piCur[63] ;2350 2351 piOrg += iStrideOrg;2352 piCur += iStrideCur;2353 uiRowCnt++;2354 }2355 2356 piOrg = pcDtParam->pOrg;2357 piCur = pcDtParam->pCur;2358 iRows = pcDtParam->iRows;2359 2360 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/64) : 0;2361 2362 for( ; iRows != 0; iRows-=iSubStep )2363 {2364 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC );2365 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC );2366 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC );2367 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC );2368 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC );2369 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC );2370 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC );2371 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC );2372 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC );2373 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC );2374 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC );2375 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC );2376 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC );2377 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC );2378 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC );2379 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC );2380 uiSum += abs( piOrg[16] - piCur[16] - iDeltaC );2381 uiSum += abs( piOrg[17] - piCur[17] - iDeltaC );2382 uiSum += abs( piOrg[18] - piCur[18] - iDeltaC );2383 uiSum += abs( piOrg[19] - piCur[19] - iDeltaC );2384 uiSum += abs( piOrg[20] - piCur[20] - iDeltaC );2385 uiSum += abs( piOrg[21] - piCur[21] - iDeltaC );2386 uiSum += abs( piOrg[22] - piCur[22] - iDeltaC );2387 uiSum += abs( piOrg[23] - piCur[23] - iDeltaC );2388 uiSum += abs( piOrg[24] - piCur[24] - iDeltaC );2389 uiSum += abs( piOrg[25] - piCur[25] - iDeltaC );2390 uiSum += abs( piOrg[26] - piCur[26] - iDeltaC );2391 uiSum += abs( piOrg[27] - piCur[27] - iDeltaC );2392 uiSum += abs( piOrg[28] - piCur[28] - iDeltaC );2393 uiSum += abs( piOrg[29] - piCur[29] - iDeltaC );2394 uiSum += abs( piOrg[30] - piCur[30] - iDeltaC );2395 uiSum += abs( piOrg[31] - piCur[31] - iDeltaC );2396 uiSum += abs( piOrg[32] - piCur[32] - iDeltaC );2397 uiSum += abs( piOrg[33] - piCur[33] - iDeltaC );2398 uiSum += abs( piOrg[34] - piCur[34] - iDeltaC );2399 uiSum += abs( piOrg[35] - piCur[35] - iDeltaC );2400 uiSum += abs( piOrg[36] - piCur[36] - iDeltaC );2401 uiSum += abs( piOrg[37] - piCur[37] - iDeltaC );2402 uiSum += abs( piOrg[38] - piCur[38] - iDeltaC );2403 uiSum += abs( piOrg[39] - piCur[39] - iDeltaC );2404 uiSum += abs( piOrg[40] - piCur[40] - iDeltaC );2405 uiSum += abs( piOrg[41] - piCur[41] - iDeltaC );2406 uiSum += abs( piOrg[42] - piCur[42] - iDeltaC );2407 uiSum += abs( piOrg[43] - piCur[43] - iDeltaC );2408 uiSum += abs( piOrg[44] - piCur[44] - iDeltaC );2409 uiSum += abs( piOrg[45] - piCur[45] - iDeltaC );2410 uiSum += abs( piOrg[46] - piCur[46] - iDeltaC );2411 uiSum += abs( piOrg[47] - piCur[47] - iDeltaC );2412 uiSum += abs( piOrg[48] - piCur[48] - iDeltaC );2413 uiSum += abs( piOrg[49] - piCur[49] - iDeltaC );2414 uiSum += abs( piOrg[50] - piCur[50] - iDeltaC );2415 uiSum += abs( piOrg[51] - piCur[51] - iDeltaC );2416 uiSum += abs( piOrg[52] - piCur[52] - iDeltaC );2417 uiSum += abs( piOrg[53] - piCur[53] - iDeltaC );2418 uiSum += abs( piOrg[54] - piCur[54] - iDeltaC );2419 uiSum += abs( piOrg[55] - piCur[55] - iDeltaC );2420 uiSum += abs( piOrg[56] - piCur[56] - iDeltaC );2421 uiSum += abs( piOrg[57] - piCur[57] - iDeltaC );2422 uiSum += abs( piOrg[58] - piCur[58] - iDeltaC );2423 uiSum += abs( piOrg[59] - piCur[59] - iDeltaC );2424 uiSum += abs( piOrg[60] - piCur[60] - iDeltaC );2425 uiSum += abs( piOrg[61] - piCur[61] - iDeltaC );2426 uiSum += abs( piOrg[62] - piCur[62] - iDeltaC );2427 uiSum += abs( piOrg[63] - piCur[63] - iDeltaC );2428 2429 piOrg += iStrideOrg;2430 piCur += iStrideCur;2431 }2432 2433 uiSum <<= iSubShift;2434 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );2435 }2436 2437 #if AMP_SAD2438 UInt TComRdCost::xGetSAD48ic( DistParam* pcDtParam )2439 {2440 if ( pcDtParam->bApplyWeight )2441 {2442 return xGetSADw( pcDtParam );2443 }2444 2445 Pel* piOrg = pcDtParam->pOrg;2446 Pel* piCur = pcDtParam->pCur;2447 Int iRows = pcDtParam->iRows;2448 Int iSubShift = pcDtParam->iSubShift;2449 Int iSubStep = ( 1 << iSubShift );2450 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;2451 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;2452 2453 UInt uiSum = 0;2454 2455 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0;2456 Int iDeltaC;2457 2458 for( ; iRows != 0; iRows-=iSubStep )2459 {2460 iOrigAvg += piOrg[0] ;2461 iOrigAvg += piOrg[1] ;2462 iOrigAvg += piOrg[2] ;2463 iOrigAvg += piOrg[3] ;2464 iOrigAvg += piOrg[4] ;2465 iOrigAvg += piOrg[5] ;2466 iOrigAvg += piOrg[6] ;2467 iOrigAvg += piOrg[7] ;2468 iOrigAvg += piOrg[8] ;2469 iOrigAvg += piOrg[9] ;2470 iOrigAvg += piOrg[10] ;2471 iOrigAvg += piOrg[11] ;2472 iOrigAvg += piOrg[12] ;2473 iOrigAvg += piOrg[13] ;2474 iOrigAvg += piOrg[14] ;2475 iOrigAvg += piOrg[15] ;2476 iOrigAvg += piOrg[16] ;2477 iOrigAvg += piOrg[17] ;2478 iOrigAvg += piOrg[18] ;2479 iOrigAvg += piOrg[19] ;2480 iOrigAvg += piOrg[20] ;2481 iOrigAvg += piOrg[21] ;2482 iOrigAvg += piOrg[22] ;2483 iOrigAvg += piOrg[23] ;2484 iOrigAvg += piOrg[24] ;2485 iOrigAvg += piOrg[25] ;2486 iOrigAvg += piOrg[26] ;2487 iOrigAvg += piOrg[27] ;2488 iOrigAvg += piOrg[28] ;2489 iOrigAvg += piOrg[29] ;2490 iOrigAvg += piOrg[30] ;2491 iOrigAvg += piOrg[31] ;2492 iOrigAvg += piOrg[32] ;2493 iOrigAvg += piOrg[33] ;2494 iOrigAvg += piOrg[34] ;2495 iOrigAvg += piOrg[35] ;2496 iOrigAvg += piOrg[36] ;2497 iOrigAvg += piOrg[37] ;2498 iOrigAvg += piOrg[38] ;2499 iOrigAvg += piOrg[39] ;2500 iOrigAvg += piOrg[40] ;2501 iOrigAvg += piOrg[41] ;2502 iOrigAvg += piOrg[42] ;2503 iOrigAvg += piOrg[43] ;2504 iOrigAvg += piOrg[44] ;2505 iOrigAvg += piOrg[45] ;2506 iOrigAvg += piOrg[46] ;2507 iOrigAvg += piOrg[47] ;2508 2509 iCurAvg += piCur[0] ;2510 iCurAvg += piCur[1] ;2511 iCurAvg += piCur[2] ;2512 iCurAvg += piCur[3] ;2513 iCurAvg += piCur[4] ;2514 iCurAvg += piCur[5] ;2515 iCurAvg += piCur[6] ;2516 iCurAvg += piCur[7] ;2517 iCurAvg += piCur[8] ;2518 iCurAvg += piCur[9] ;2519 iCurAvg += piCur[10] ;2520 iCurAvg += piCur[11] ;2521 iCurAvg += piCur[12] ;2522 iCurAvg += piCur[13] ;2523 iCurAvg += piCur[14] ;2524 iCurAvg += piCur[15] ;2525 iCurAvg += piCur[16] ;2526 iCurAvg += piCur[17] ;2527 iCurAvg += piCur[18] ;2528 iCurAvg += piCur[19] ;2529 iCurAvg += piCur[20] ;2530 iCurAvg += piCur[21] ;2531 iCurAvg += piCur[22] ;2532 iCurAvg += piCur[23] ;2533 iCurAvg += piCur[24] ;2534 iCurAvg += piCur[25] ;2535 iCurAvg += piCur[26] ;2536 iCurAvg += piCur[27] ;2537 iCurAvg += piCur[28] ;2538 iCurAvg += piCur[29] ;2539 iCurAvg += piCur[30] ;2540 iCurAvg += piCur[31] ;2541 iCurAvg += piCur[32] ;2542 iCurAvg += piCur[33] ;2543 iCurAvg += piCur[34] ;2544 iCurAvg += piCur[35] ;2545 iCurAvg += piCur[36] ;2546 iCurAvg += piCur[37] ;2547 iCurAvg += piCur[38] ;2548 iCurAvg += piCur[39] ;2549 iCurAvg += piCur[40] ;2550 iCurAvg += piCur[41] ;2551 iCurAvg += piCur[42] ;2552 iCurAvg += piCur[43] ;2553 iCurAvg += piCur[44] ;2554 iCurAvg += piCur[45] ;2555 iCurAvg += piCur[46] ;2556 iCurAvg += piCur[47] ;2557 2558 piOrg += iStrideOrg;2559 piCur += iStrideCur;2560 uiRowCnt++;2561 }2562 2563 piOrg = pcDtParam->pOrg;2564 piCur = pcDtParam->pCur;2565 iRows = pcDtParam->iRows;2566 2567 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/48) : 0;2568 2569 for( ; iRows != 0; iRows-=iSubStep )2570 {2571 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC );2572 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC );2573 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC );2574 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC );2575 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC );2576 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC );2577 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC );2578 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC );2579 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC );2580 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC );2581 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC );2582 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC );2583 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC );2584 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC );2585 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC );2586 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC );2587 uiSum += abs( piOrg[16] - piCur[16] - iDeltaC );2588 uiSum += abs( piOrg[17] - piCur[17] - iDeltaC );2589 uiSum += abs( piOrg[18] - piCur[18] - iDeltaC );2590 uiSum += abs( piOrg[19] - piCur[19] - iDeltaC );2591 uiSum += abs( piOrg[20] - piCur[20] - iDeltaC );2592 uiSum += abs( piOrg[21] - piCur[21] - iDeltaC );2593 uiSum += abs( piOrg[22] - piCur[22] - iDeltaC );2594 uiSum += abs( piOrg[23] - piCur[23] - iDeltaC );2595 uiSum += abs( piOrg[24] - piCur[24] - iDeltaC );2596 uiSum += abs( piOrg[25] - piCur[25] - iDeltaC );2597 uiSum += abs( piOrg[26] - piCur[26] - iDeltaC );2598 uiSum += abs( piOrg[27] - piCur[27] - iDeltaC );2599 uiSum += abs( piOrg[28] - piCur[28] - iDeltaC );2600 uiSum += abs( piOrg[29] - piCur[29] - iDeltaC );2601 uiSum += abs( piOrg[30] - piCur[30] - iDeltaC );2602 uiSum += abs( piOrg[31] - piCur[31] - iDeltaC );2603 uiSum += abs( piOrg[32] - piCur[32] - iDeltaC );2604 uiSum += abs( piOrg[33] - piCur[33] - iDeltaC );2605 uiSum += abs( piOrg[34] - piCur[34] - iDeltaC );2606 uiSum += abs( piOrg[35] - piCur[35] - iDeltaC );2607 uiSum += abs( piOrg[36] - piCur[36] - iDeltaC );2608 uiSum += abs( piOrg[37] - piCur[37] - iDeltaC );2609 uiSum += abs( piOrg[38] - piCur[38] - iDeltaC );2610 uiSum += abs( piOrg[39] - piCur[39] - iDeltaC );2611 uiSum += abs( piOrg[40] - piCur[40] - iDeltaC );2612 uiSum += abs( piOrg[41] - piCur[41] - iDeltaC );2613 uiSum += abs( piOrg[42] - piCur[42] - iDeltaC );2614 uiSum += abs( piOrg[43] - piCur[43] - iDeltaC );2615 uiSum += abs( piOrg[44] - piCur[44] - iDeltaC );2616 uiSum += abs( piOrg[45] - piCur[45] - iDeltaC );2617 uiSum += abs( piOrg[46] - piCur[46] - iDeltaC );2618 uiSum += abs( piOrg[47] - piCur[47] - iDeltaC );2619 2620 piOrg += iStrideOrg;2621 piCur += iStrideCur;2622 }2623 2624 uiSum <<= iSubShift;2625 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );2626 }2627 #endif2628 2629 #endif2630 967 // -------------------------------------------------------------------------------------------------------------------- 2631 968 // SSE … … 2975 1312 return ( uiSum ); 2976 1313 } 2977 #if H_3D_VSO2978 //SAIT_VSO_EST_A00332979 UInt TComRdCost::getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride, Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y )2980 {2981 Double dD;2982 Int iTemp;2983 2984 dD = ( (Double) ( dDM >> DISTORTION_PRECISION_ADJUSTMENT( g_bitDepthY - 8 ) ) ) * m_dDisparityCoeff;2985 2986 Double dDepthWeight = ( pOrg[x] >= ( (1<<(g_bitDepthY - 3)) + (1<<(g_bitDepthY - 2)) ) ? 4 : pOrg[x] > ((1<<g_bitDepthY) >> 4) ? (Float)(pOrg[x] - ((1<<g_bitDepthY) >> 4))/(Float)((1<<g_bitDepthY) >> 3) + 1 : 1.0 );2987 Double dTemp = ( 0.5 * fabs(dD) * dDepthWeight * ( abs( (Int) pVirRec[ x+y*iVirStride ] - (Int) pVirRec[ x-1+y*iVirStride ] ) + abs( (Int) pVirRec[ x+y*iVirStride ] - (Int) pVirRec[ x+1+y*iVirStride ] ) ) );2988 iTemp = (Int) (((dTemp) < 0)? (Int)((dTemp) - 0.5) : (Int)((dTemp) + 0.5));2989 2990 return (UInt) ( (iTemp*iTemp)>>1 );2991 }2992 2993 UInt TComRdCost::xGetVSD( DistParam* pcDtParam )2994 {2995 Pel* piOrg = pcDtParam->pOrg;2996 Pel* piCur = pcDtParam->pCur;2997 Pel* piVirRec = pcDtParam->pVirRec;2998 Pel* piVirOrg = pcDtParam->pVirOrg;2999 Int iRows = pcDtParam->iRows;3000 Int iCols = pcDtParam->iCols;3001 Int iStrideOrg = pcDtParam->iStrideOrg;3002 Int iStrideCur = pcDtParam->iStrideCur;3003 Int iStrideVir = pcDtParam->iStrideVir;3004 3005 UInt uiSum = 0;3006 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;3007 3008 Int dDM;3009 3010 for ( Int y = 0 ; y < iRows ; y++ )3011 {3012 for (Int x = 0; x < iCols; x++ )3013 {3014 dDM = (Int) ( piOrg[x ] - piCur[x ] );3015 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;3016 }3017 piOrg += iStrideOrg;3018 piCur += iStrideCur;3019 }3020 3021 return ( uiSum );3022 }3023 3024 UInt TComRdCost::xGetVSD4( DistParam* pcDtParam )3025 {3026 Pel* piOrg = pcDtParam->pOrg;3027 Pel* piCur = pcDtParam->pCur;3028 Pel* piVirRec = pcDtParam->pVirRec;3029 Pel* piVirOrg = pcDtParam->pVirOrg;3030 Int iRows = pcDtParam->iRows;3031 Int iStrideOrg = pcDtParam->iStrideOrg;3032 Int iStrideCur = pcDtParam->iStrideCur;3033 Int iStrideVir = pcDtParam->iStrideVir;3034 3035 UInt uiSum = 0;3036 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;3037 3038 Int dDM;3039 3040 for ( Int y = 0 ; y < iRows ; y++ )3041 {3042 dDM = (Int) ( piOrg[0] - piCur[0] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 0, y ) ) >> uiShift;3043 dDM = (Int) ( piOrg[1] - piCur[1] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 1, y ) ) >> uiShift;3044 dDM = (Int) ( piOrg[2] - piCur[2] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 2, y ) ) >> uiShift;3045 dDM = (Int) ( piOrg[3] - piCur[3] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 3, y ) ) >> uiShift;3046 3047 piOrg += iStrideOrg;3048 piCur += iStrideCur;3049 }3050 3051 return ( uiSum );3052 }3053 3054 UInt TComRdCost::xGetVSD8( DistParam* pcDtParam )3055 {3056 Pel* piOrg = pcDtParam->pOrg;3057 Pel* piCur = pcDtParam->pCur;3058 Pel* piVirRec = pcDtParam->pVirRec;3059 Pel* piVirOrg = pcDtParam->pVirOrg;3060 Int iRows = pcDtParam->iRows;3061 Int iStrideOrg = pcDtParam->iStrideOrg;3062 Int iStrideCur = pcDtParam->iStrideCur;3063 Int iStrideVir = pcDtParam->iStrideVir;3064 3065 UInt uiSum = 0;3066 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;3067 3068 Int dDM;3069 3070 for ( Int y = 0 ; y < iRows ; y++ )3071 {3072 for (Int x = 0; x < 8; x++ )3073 {3074 dDM = (Int) ( piOrg[x] - piCur[x] );3075 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;3076 }3077 piOrg += iStrideOrg;3078 piCur += iStrideCur;3079 }3080 3081 return ( uiSum );3082 }3083 3084 UInt TComRdCost::xGetVSD16( DistParam* pcDtParam )3085 {3086 Pel* piOrg = pcDtParam->pOrg;3087 Pel* piCur = pcDtParam->pCur;3088 Pel* piVirRec = pcDtParam->pVirRec;3089 Pel* piVirOrg = pcDtParam->pVirOrg;3090 Int iRows = pcDtParam->iRows;3091 Int iStrideOrg = pcDtParam->iStrideOrg;3092 Int iStrideCur = pcDtParam->iStrideCur;3093 Int iStrideVir = pcDtParam->iStrideVir;3094 3095 UInt uiSum = 0;3096 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;3097 3098 Int dDM;3099 3100 for ( Int y = 0 ; y < iRows ; y++ )3101 {3102 for (Int x = 0; x < 16; x++ )3103 {3104 dDM = (Int) ( piOrg[x] - piCur[x] );3105 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;3106 }3107 piOrg += iStrideOrg;3108 piCur += iStrideCur;3109 }3110 3111 return ( uiSum );3112 }3113 3114 UInt TComRdCost::xGetVSD16N( DistParam* pcDtParam )3115 {3116 Pel* piOrg = pcDtParam->pOrg;3117 Pel* piCur = pcDtParam->pCur;3118 Pel* piVirRec = pcDtParam->pVirRec;3119 Pel* piVirOrg = pcDtParam->pVirOrg;3120 Int iRows = pcDtParam->iRows;3121 Int iCols = pcDtParam->iCols;3122 Int iStrideOrg = pcDtParam->iStrideOrg;3123 Int iStrideCur = pcDtParam->iStrideCur;3124 Int iStrideVir = pcDtParam->iStrideVir;3125 3126 UInt uiSum = 0;3127 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;3128 3129 Int dDM;3130 3131 for ( Int y = 0 ; y < iRows ; y++ )3132 {3133 for (Int x = 0; x < iCols; x+=16 )3134 {3135 for ( Int k = 0 ; k < 16 ; k++ )3136 {3137 dDM = (Int) ( piOrg[x+k] - piCur[x+k] );3138 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x+k, y ) >> uiShift;3139 }3140 }3141 piOrg += iStrideOrg;3142 piCur += iStrideCur;3143 }3144 3145 return ( uiSum );3146 }3147 3148 UInt TComRdCost::xGetVSD32( DistParam* pcDtParam )3149 {3150 Pel* piOrg = pcDtParam->pOrg;3151 Pel* piCur = pcDtParam->pCur;3152 Pel* piVirRec = pcDtParam->pVirRec;3153 Pel* piVirOrg = pcDtParam->pVirOrg;3154 Int iRows = pcDtParam->iRows;3155 Int iStrideOrg = pcDtParam->iStrideOrg;3156 Int iStrideCur = pcDtParam->iStrideCur;3157 Int iStrideVir = pcDtParam->iStrideVir;3158 3159 UInt uiSum = 0;3160 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;3161 3162 Int dDM;3163 3164 for ( Int y = 0 ; y < iRows ; y++ )3165 {3166 for (Int x = 0; x < 32 ; x++ )3167 {3168 dDM = (Int) ( piOrg[x] - piCur[x] );3169 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;3170 }3171 piOrg += iStrideOrg;3172 piCur += iStrideCur;3173 }3174 3175 return ( uiSum );3176 }3177 3178 UInt TComRdCost::xGetVSD64( DistParam* pcDtParam )3179 {3180 Pel* piOrg = pcDtParam->pOrg;3181 Pel* piCur = pcDtParam->pCur;3182 Pel* piVirRec = pcDtParam->pVirRec;3183 Pel* piVirOrg = pcDtParam->pVirOrg;3184 Int iRows = pcDtParam->iRows;3185 Int iStrideOrg = pcDtParam->iStrideOrg;3186 Int iStrideCur = pcDtParam->iStrideCur;3187 Int iStrideVir = pcDtParam->iStrideVir;3188 3189 UInt uiSum = 0;3190 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;3191 3192 Int dDM;3193 3194 for ( Int y = 0 ; y < iRows ; y++ )3195 {3196 for (Int x = 0; x < 64; x++ )3197 {3198 dDM = (Int) ( piOrg[x] - piCur[x] );3199 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;3200 }3201 piOrg += iStrideOrg;3202 piCur += iStrideCur;3203 }3204 3205 return ( uiSum );3206 }3207 3208 #endif3209 1314 3210 1315 // -------------------------------------------------------------------------------------------------------------------- … … 3493 1598 return xGetHADsw( pcDtParam ); 3494 1599 } 3495 #if H_3D_IC3496 if( pcDtParam->bUseIC )3497 {3498 return xGetHADsic( pcDtParam );3499 }3500 #endif3501 #if H_3D_INTER_SDC3502 if( pcDtParam->bUseSDCMRSAD )3503 {3504 return xGetHADsic( pcDtParam );3505 }3506 #endif3507 1600 Pel* piOrg = pcDtParam->pOrg; 3508 1601 Pel* piCur = pcDtParam->pCur; … … 3568 1661 } 3569 1662 3570 #if H_3D_IC || H_3D_INTER_SDC 3571 UInt TComRdCost::xGetHADsic( DistParam* pcDtParam ) 3572 { 3573 if ( pcDtParam->bApplyWeight ) 3574 { 3575 return xGetHADsw( pcDtParam ); 3576 } 3577 Pel* piOrg = pcDtParam->pOrg; 3578 Pel* piCur = pcDtParam->pCur; 3579 Int iRows = pcDtParam->iRows; 3580 Int iCols = pcDtParam->iCols; 3581 Int iStrideCur = pcDtParam->iStrideCur; 3582 Int iStrideOrg = pcDtParam->iStrideOrg; 3583 Int iStep = pcDtParam->iStep; 3584 3585 Int x, y; 3586 3587 UInt uiSum = 0; 3588 3589 Int iOrigAvg = 0, iCurAvg = 0; 3590 Int iDeltaC; 3591 3592 for ( y=0; y<iRows; y++ ) 3593 { 3594 for ( x=0; x<iCols; x++ ) 3595 { 3596 iOrigAvg += piOrg[x]; 3597 iCurAvg += piCur[x]; 3598 } 3599 piOrg += iStrideOrg; 3600 piCur += iStrideCur; 3601 } 3602 3603 piOrg = pcDtParam->pOrg; 3604 piCur = pcDtParam->pCur; 3605 3606 iDeltaC = (iOrigAvg - iCurAvg)/iRows/iCols; 3607 3608 for ( y=0; y<iRows; y++ ) 3609 { 3610 for ( x=0; x<iCols; x++ ) 3611 { 3612 piOrg[x] -= iDeltaC; 3613 } 3614 piOrg += iStrideOrg; 3615 } 3616 3617 piOrg = pcDtParam->pOrg; 3618 3619 #if NS_HAD 3620 if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) ) 3621 #else 3622 if( ( iRows % 8 == 0) && (iCols % 8 == 0) ) 3623 #endif 3624 { 3625 Int iOffsetOrg = iStrideOrg<<3; 3626 Int iOffsetCur = iStrideCur<<3; 3627 for ( y=0; y<iRows; y+= 8 ) 3628 { 3629 for ( x=0; x<iCols; x+= 8 ) 3630 { 3631 uiSum += xCalcHADs8x8( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 3632 } 3633 piOrg += iOffsetOrg; 3634 piCur += iOffsetCur; 3635 } 3636 } 3637 #if NS_HAD 3638 else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD ) 3639 { 3640 Int iOffsetOrg = iStrideOrg<<2; 3641 Int iOffsetCur = iStrideCur<<2; 3642 for ( y=0; y<iRows; y+= 4 ) 3643 { 3644 for ( x=0; x<iCols; x+= 16 ) 3645 { 3646 uiSum += xCalcHADs16x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 3647 } 3648 piOrg += iOffsetOrg; 3649 piCur += iOffsetCur; 3650 } 3651 } 3652 else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD ) 3653 { 3654 Int iOffsetOrg = iStrideOrg<<4; 3655 Int iOffsetCur = iStrideCur<<4; 3656 for ( y=0; y<iRows; y+= 16 ) 3657 { 3658 for ( x=0; x<iCols; x+= 4 ) 3659 { 3660 uiSum += xCalcHADs4x16( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 3661 } 3662 piOrg += iOffsetOrg; 3663 piCur += iOffsetCur; 3664 } 3665 } 3666 #endif 3667 else if( ( iRows % 4 == 0) && (iCols % 4 == 0) ) 3668 { 3669 Int iOffsetOrg = iStrideOrg<<2; 3670 Int iOffsetCur = iStrideCur<<2; 3671 3672 for ( y=0; y<iRows; y+= 4 ) 3673 { 3674 for ( x=0; x<iCols; x+= 4 ) 3675 { 3676 uiSum += xCalcHADs4x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 3677 } 3678 piOrg += iOffsetOrg; 3679 piCur += iOffsetCur; 3680 } 3681 } 3682 else if( ( iRows % 2 == 0) && (iCols % 2 == 0) ) 3683 { 3684 Int iOffsetOrg = iStrideOrg<<1; 3685 Int iOffsetCur = iStrideCur<<1; 3686 for ( y=0; y<iRows; y+=2 ) 3687 { 3688 for ( x=0; x<iCols; x+=2 ) 3689 { 3690 uiSum += xCalcHADs2x2( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 3691 } 3692 piOrg += iOffsetOrg; 3693 piCur += iOffsetCur; 3694 } 3695 } 3696 else 3697 { 3698 assert(false); 3699 } 3700 3701 piOrg = pcDtParam->pOrg; 3702 3703 for ( y=0; y<iRows; y++ ) 3704 { 3705 for ( x=0; x<iCols; x++ ) 3706 { 3707 piOrg[x] += iDeltaC; 3708 } 3709 piOrg += iStrideOrg; 3710 } 3711 3712 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) ); 3713 } 3714 #endif 3715 3716 #if H_3D_VSO 3717 Void TComRdCost::setLambdaVSO( Double dLambdaVSO ) 3718 { 3719 m_dLambdaVSO = dLambdaVSO; 3720 m_dSqrtLambdaVSO = sqrt(m_dLambdaVSO); 3721 m_uiLambdaMotionSADVSO = (UInt)floor(65536.0 * m_dSqrtLambdaVSO); 3722 m_uiLambdaMotionSSEVSO = (UInt)floor(65536.0 * m_dLambdaVSO ); 3723 } 3724 3725 Dist TComRdCost::xGetDistVSOMode4( Int iStartPosX, Int iStartPosY, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD ) 3726 { 3727 AOT(bSAD); 3728 #if H_3D_VSO_EARLY_SKIP 3729 RMDist iDist = m_pcRenModel->getDist( iStartPosX, iStartPosY, (Int) uiBlkWidth, (Int) uiBlkHeight, iCurStride, piCur, piOrg, iOrgStride); 3730 #else 3731 RMDist iDist = m_pcRenModel->getDist( iStartPosX, iStartPosY, (Int) uiBlkWidth, (Int) uiBlkHeight, iCurStride, piCur ); 3732 #endif 3733 3734 RMDist iDistMin = (RMDist) RDO_DIST_MIN; 3735 iDistMin = m_bAllowNegDist ? RDO_DIST_MIN : 0; 3736 3737 iDist = std::min( iDist, (RMDist) RDO_DIST_MAX); 3738 iDist = std::max( iDist, iDistMin); 3739 return (Dist) iDist; 3740 } 3741 3742 3743 Dist TComRdCost::getDistPartVSO( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bHAD ) 3744 { 3745 assert( m_bUseVSO ); 3746 assert( this->m_fpDistortFuncVSO != 0 ); 3747 3748 Int iPosX; 3749 Int iPosY; 3750 3751 pcCU->getPosInPic( uiAbsPartIndex, iPosX, iPosY ); 3752 3753 Dist dist = (this->*m_fpDistortFuncVSO) ( iPosX, iPosY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight, bHAD ); 3754 3755 if ( m_bUseWVSO ) 3756 { 3757 Int iDWeight = m_iDWeight * m_iDWeight; 3758 Int iVSOWeight = m_iVSOWeight * m_iVSOWeight; 3759 Dist distDepth; 3760 3761 if ( !bHAD ) 3762 { 3763 distDepth = (Dist) getDistPart( g_bitDepthY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight); 3764 } 3765 else 3766 { 3767 distDepth = (Dist) calcHAD( g_bitDepthY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight); 3768 } 3769 3770 dist = (Dist) (iDWeight * distDepth + iVSOWeight * dist ) / ( iDWeight + iVSOWeight); 3771 } 3772 return dist; 3773 }; 3774 3775 3776 Void TComRdCost::setVSOMode( UInt uiIn ) 3777 { 3778 m_uiVSOMode = uiIn; 3779 switch (m_uiVSOMode ) 3780 { 3781 case 4: 3782 m_fpDistortFuncVSO = &TComRdCost::xGetDistVSOMode4; 3783 break; 3784 default: 3785 assert(0); 3786 break; 3787 } 3788 } 3789 3790 3791 Double TComRdCost::calcRdCostVSO( UInt uiBits, Dist uiDistortion, Bool bFlag, DFunc eDFunc ) 3792 { 3793 assert( m_bUseLambdaScaleVSO ); 3794 3795 Double dRdCost = 0.0; 3796 Double dLambda = 0.0; 3797 3798 switch ( eDFunc ) 3799 { 3800 case DF_SSE: 3801 assert(0); 3802 break; 3803 case DF_SAD: 3804 dLambda = (Double)m_uiLambdaMotionSADVSO; 3805 break; 3806 case DF_DEFAULT: 3807 dLambda = m_dLambdaVSO; 3808 break; 3809 case DF_SSE_FRAME: 3810 dLambda = m_dFrameLambdaVSO; 3811 break; 3812 default: 3813 assert (0); 3814 break; 3815 } 3816 3817 if (bFlag) 3818 { 3819 // Intra8x8, Intra4x4 Block only... 3820 #if SEQUENCE_LEVEL_LOSSLESS 3821 dRdCost = (Double)(uiBits); 3822 #else 3823 dRdCost = (((Double)uiDistortion) + ((Double)uiBits * dLambda)); 3824 #endif 3825 } 3826 else 3827 { 3828 if (eDFunc == DF_SAD) 3829 { 3830 dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5)>>16)); 3831 dRdCost = (Double)(Dist)floor(dRdCost); 3832 } 3833 else 3834 { 3835 #if SEQUENCE_LEVEL_LOSSLESS 3836 dRdCost = (Double)(uiBits); 3837 #else 3838 dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5))); 3839 dRdCost = (Double)(Dist)floor(dRdCost); 3840 #endif 3841 } 3842 } 3843 3844 return dRdCost; 3845 } 3846 3847 Void TComRdCost::setRenModelData( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piData, Int iStride, Int iBlkWidth, Int iBlkHeight ) 3848 { 3849 UInt iBlkX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIndex]]; 3850 UInt iBlkY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]]; 3851 3852 Int iStartPosX = iBlkX + pcCU->getCUPelX(); 3853 Int iStartPosY = iBlkY + pcCU->getCUPelY(); 3854 3855 m_pcRenModel->setData( iStartPosX, iStartPosY, iBlkWidth, iBlkHeight, iStride, piData ); 3856 } 3857 3858 Void TComRdCost::setAllowNegDist( Bool bAllowNegDist ) 3859 { 3860 m_bAllowNegDist = bAllowNegDist; 3861 } 3862 #endif 1663 3863 1664 3864 1665 //! \} -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComRdCost.h
r872 r1072 46 46 #include "TComSlice.h" 47 47 #include "TComRdCostWeightPrediction.h" 48 #if H_3D49 #include "../TLibRenderer/TRenModel.h"50 #endif51 48 52 49 //! \ingroup TLibCommon … … 57 54 class DistParam; 58 55 class TComPattern; 59 #if H_3D60 class TComRdCost;61 #endif62 56 63 57 // ==================================================================================================================== … … 68 62 typedef UInt (*FpDistFunc) (DistParam*); 69 63 70 #if H_3D71 #if H_3D_VSO72 typedef Dist (TComRdCost::*FpDistFuncVSO) ( Int, Int, Pel*, Int, Pel*, Int, UInt, UInt, Bool );73 #endif74 #endif75 64 // ==================================================================================================================== 76 65 // Class definition … … 85 74 Int iStrideOrg; 86 75 Int iStrideCur; 87 #if H_3D_VSO88 // SAIT_VSO_EST_A003389 Pel* pVirRec;90 Pel* pVirOrg;91 Int iStrideVir;92 #endif93 #if H_3D_IC94 Bool bUseIC;95 #endif96 #if H_3D_INTER_SDC97 Bool bUseSDCMRSAD;98 #endif99 76 Int iRows; 100 77 Int iCols; … … 123 100 iSubShift = 0; 124 101 bitDepth = 0; 125 #if H_3D_VSO126 // SAIT_VSO_EST_A0033127 pVirRec = NULL;128 pVirOrg = NULL;129 iStrideVir = 0;130 #endif131 #if H_3D_INTER_SDC132 bUseSDCMRSAD = false;133 #endif134 102 } 135 103 }; … … 155 123 UInt m_uiLambdaMotionSSE; 156 124 Double m_dFrameLambda; 157 #if H_3D_VSO158 // SAIT_VSO_EST_A0033159 static Double m_dDisparityCoeff;160 #endif161 125 162 126 // for motion cost … … 175 139 #endif 176 140 177 #if H_3D_DBBP178 Bool m_bUseMask;179 #endif180 141 181 142 public: … … 183 144 virtual ~TComRdCost(); 184 145 185 #if H_3D_VSO186 Double calcRdCost ( UInt uiBits, Dist uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT );187 Double calcRdCost64( UInt64 uiBits, Dist64 uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT );188 #else189 146 Double calcRdCost ( UInt uiBits, UInt uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); 190 147 Double calcRdCost64( UInt64 uiBits, UInt64 uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); 191 #endif192 148 193 149 … … 198 154 199 155 Double getSqrtLambda () { return m_sqrtLambda; } 200 #if H_3D_VSO201 // SAIT_VSO_EST_A0033202 Void setDisparityCoeff( Double dDisparityCoeff ) { m_dDisparityCoeff = dDisparityCoeff; }203 Double getDisparityCoeff() { return m_dDisparityCoeff; }204 #endif205 156 206 157 Double getLambda() { return m_dLambda; } … … 215 166 Void setDistParam( DistParam& rcDP, Int bitDepth, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard = false ); 216 167 217 #if H_3D_DBBP218 Void setUseMask(Bool b) { m_bUseMask = b; }219 #endif220 168 221 169 UInt calcHAD(Int bitDepth, Pel* pi0, Int iStride0, Pel* pi1, Int iStride1, Int iWidth, Int iHeight ); 222 170 223 #if H_3D_FAST_DEPTH_INTRA224 UInt calcVAR(Pel* pi0, Int stride, Int width, Int height, Int cuDepth);225 #endif226 171 // for motion cost 227 172 #if !FIX203 … … 269 214 static UInt xGetSSE64 ( DistParam* pcDtParam ); 270 215 static UInt xGetSSE16N ( DistParam* pcDtParam ); 271 #if H_3D_IC || H_3D_INTER_SDC272 static UInt xGetSADic ( DistParam* pcDtParam );273 static UInt xGetSAD4ic ( DistParam* pcDtParam );274 static UInt xGetSAD8ic ( DistParam* pcDtParam );275 static UInt xGetSAD16ic ( DistParam* pcDtParam );276 static UInt xGetSAD32ic ( DistParam* pcDtParam );277 static UInt xGetSAD64ic ( DistParam* pcDtParam );278 static UInt xGetSAD16Nic ( DistParam* pcDtParam );279 #endif280 216 static UInt xGetSAD ( DistParam* pcDtParam ); 281 217 static UInt xGetSAD4 ( DistParam* pcDtParam ); … … 286 222 static UInt xGetSAD16N ( DistParam* pcDtParam ); 287 223 288 #if H_3D_VSO289 static UInt xGetVSD ( DistParam* pcDtParam );290 static UInt xGetVSD4 ( DistParam* pcDtParam );291 static UInt xGetVSD8 ( DistParam* pcDtParam );292 static UInt xGetVSD16 ( DistParam* pcDtParam );293 static UInt xGetVSD32 ( DistParam* pcDtParam );294 static UInt xGetVSD64 ( DistParam* pcDtParam );295 static UInt xGetVSD16N ( DistParam* pcDtParam );296 #endif297 224 298 225 #if AMP_SAD 299 #if H_3D_IC || H_3D_INTER_SDC300 static UInt xGetSAD12ic ( DistParam* pcDtParam );301 static UInt xGetSAD24ic ( DistParam* pcDtParam );302 static UInt xGetSAD48ic ( DistParam* pcDtParam );303 #endif304 226 static UInt xGetSAD12 ( DistParam* pcDtParam ); 305 227 static UInt xGetSAD24 ( DistParam* pcDtParam ); … … 308 230 #endif 309 231 310 #if H_3D_IC || H_3D_INTER_SDC311 static UInt xGetHADsic ( DistParam* pcDtParam );312 #endif313 232 static UInt xGetHADs4 ( DistParam* pcDtParam ); 314 233 static UInt xGetHADs8 ( DistParam* pcDtParam ); … … 317 236 static UInt xCalcHADs4x4 ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); 318 237 static UInt xCalcHADs8x8 ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); 319 #if H_3D_DBBP320 static UInt xGetMaskedSSE ( DistParam* pcDtParam );321 static UInt xGetMaskedSAD ( DistParam* pcDtParam );322 static UInt xGetMaskedHADs ( DistParam* pcDtParam );323 static UInt xGetMaskedVSD ( DistParam* pcDtParam );324 #endif325 238 326 239 public: 327 240 UInt getDistPart(Int bitDepth, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, TextType eText = TEXT_LUMA, DFunc eDFunc = DF_SSE ); 328 241 329 #if KWU_RC_MADPRED_E0227 330 UInt getSADPart ( Int bitDepth, Pel* pelCur, Int curStride, Pel* pelOrg, Int orgStride, UInt width, UInt height ); 331 #endif 332 333 #if H_3D_VSO 334 // SAIT_VSO_EST_A0033 335 UInt getDistPartVSD( TComDataCU* pcCu, UInt uiPartOffset, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bHad, DFunc eDFunc = DF_VSD); 336 static UInt getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride, Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y ); 337 338 private: 339 Double m_dLambdaVSO; 340 Double m_dSqrtLambdaVSO; 341 UInt m_uiLambdaMotionSADVSO; 342 UInt m_uiLambdaMotionSSEVSO; 343 Double m_dFrameLambdaVSO; 344 Bool m_bAllowNegDist; 345 Bool m_bUseVSO; 346 Bool m_bUseLambdaScaleVSO; 347 UInt m_uiVSOMode; 348 349 FpDistFuncVSO m_fpDistortFuncVSO; 350 TRenModel* m_pcRenModel; 351 352 353 // SAIT_VSO_EST_A0033 354 TComPicYuv * m_pcVideoRecPicYuv; 355 TComPicYuv * m_pcDepthPicYuv; 356 Bool m_bUseEstimatedVSD; 357 358 // LGE_WVSO_A0119 359 Int m_iDWeight; 360 Int m_iVSOWeight; 361 Int m_iVSDWeight; 362 Bool m_bUseWVSO; 363 364 public: 365 366 Void setRenModel ( TRenModel* pcRenModel ) { m_pcRenModel = pcRenModel; } 367 TRenModel* getRenModel ( ) { return m_pcRenModel; } 368 Void setRenModelData ( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piData, Int iStride, Int iBlkWidth, Int iBlkHeight ); 369 Void setLambdaVSO ( Double dLambda ); 370 Void setFrameLambdaVSO ( Double dLambda ) { m_dFrameLambdaVSO = dLambda; }; 371 372 373 Void setUseVSO ( Bool bIn ) { m_bUseVSO = bIn; }; 374 Bool getUseVSO ( ) { return m_bUseVSO;}; 375 376 Bool getUseRenModel ( ) { return (m_bUseVSO && m_uiVSOMode == 4); }; 377 Void setUseLambdaScaleVSO(Bool bIn) { m_bUseLambdaScaleVSO = bIn; }; 378 Bool getUseLambdaScaleVSO( ) { return m_bUseLambdaScaleVSO; }; 379 380 Void setVSOMode( UInt uiIn); 381 UInt getVSOMode( ) { return m_uiVSOMode; } 382 Void setAllowNegDist ( Bool bAllowNegDist ); 383 384 Double getSqrtLambdaVSO () { return m_dSqrtLambdaVSO; } 385 Double getLambdaVSO () { return m_dLambdaVSO; } 386 387 Dist getDistPartVSO( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD ); 388 Double calcRdCostVSO ( UInt uiBits, Dist uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); 389 390 // SAIT_VSO_EST_A0033 391 Bool getUseEstimatedVSD( ) { return m_bUseEstimatedVSD; }; 392 Void setUseEstimatedVSD( Bool bIn ) { m_bUseEstimatedVSD = bIn; }; 393 394 TComPicYuv* getVideoRecPicYuv () { return m_pcVideoRecPicYuv; }; 395 Void setVideoRecPicYuv ( TComPicYuv* pcVideoRecPicYuv ) { m_pcVideoRecPicYuv = pcVideoRecPicYuv; }; 396 TComPicYuv* getDepthPicYuv () { return m_pcDepthPicYuv; }; 397 Void setDepthPicYuv ( TComPicYuv* pcDepthPicYuv ) { m_pcDepthPicYuv = pcDepthPicYuv; }; 398 399 // LGE_WVSO_A0119 400 Void setUseWVSO ( Bool bIn ) { m_bUseWVSO = bIn; }; 401 Bool getUseWVSO ( ) { return m_bUseWVSO;}; 402 Void setDWeight ( Int iDWeight ) { m_iDWeight = iDWeight; }; 403 Int getDWeight () { return m_iDWeight; }; 404 Void setVSOWeight ( Int iVSOWeight ) { m_iVSOWeight = iVSOWeight; }; 405 Int getVSOWeight () { return m_iVSOWeight; }; 406 Void setVSDWeight ( Int iVSDWeight ) { m_iVSDWeight = iVSDWeight; }; 407 Int getVSDWeight () { return m_iVSDWeight; }; 408 409 private: 410 Dist xGetDistVSOMode4( Int iStartPosX, Int iStartPosY, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD ); 411 412 #endif // H_3D_VSO 242 413 243 414 244 };// END CLASS DEFINITION TComRdCost -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComRom.cpp
r1066 r1072 101 101 } 102 102 103 #if H_3D_DIM_DMM104 if( !g_dmmWedgeLists.empty() )105 {106 for( UInt ui = 0; ui < g_dmmWedgeLists.size(); ui++ ) { g_dmmWedgeLists[ui].clear(); }107 g_dmmWedgeLists.clear();108 }109 if( !g_dmmWedgeRefLists.empty() )110 {111 for( UInt ui = 0; ui < g_dmmWedgeRefLists.size(); ui++ ) { g_dmmWedgeRefLists[ui].clear(); }112 g_dmmWedgeRefLists.clear();113 }114 115 if( !g_dmmWedgeNodeLists.empty() )116 {117 for( UInt ui = 0; ui < g_dmmWedgeNodeLists.size(); ui++ ) { g_dmmWedgeNodeLists[ui].clear(); }118 g_dmmWedgeNodeLists.clear();119 }120 #endif121 103 } 122 104 … … 346 328 UInt g_uiPCMBitDepthChroma = 8; // PCM bit-depth 347 329 348 #if H_3D_DIM_DMM349 // ====================================================================================================================350 // Depth coding modes351 // ====================================================================================================================352 const WedgeResolution g_dmmWedgeResolution[6] =353 {354 HALF_PEL, // 4x4355 HALF_PEL, // 8x8356 FULL_PEL, // 16x16357 #if SHARP_DMM1_I0110358 FULL_PEL, // 32x32359 FULL_PEL, // 64x64360 FULL_PEL // 128x128361 #else362 DOUBLE_PEL, // 32x32363 DOUBLE_PEL, // 64x64364 DOUBLE_PEL // 128x128365 #endif366 };367 368 const UChar g_dmm1TabIdxBits[6] =369 { //2x2 4x4 8x8 16x16 32x32 64x64370 0, 7, 10, 11, 11, 13 };371 372 const UChar g_dmm3IntraTabIdxBits[6] =373 { //2x2 4x4 8x8 16x16 32x32 64x64374 0, 4, 7, 8, 8, 0 };375 376 #if SHARP_DMM1_I0110377 Bool g_wedgePattern[32*32];378 #endif379 380 extern std::vector< std::vector<TComWedgelet> > g_dmmWedgeLists;381 extern std::vector< std::vector<TComWedgeRef> > g_dmmWedgeRefLists;382 extern std::vector< std::vector<TComWedgeNode> > g_dmmWedgeNodeLists;383 #endif384 330 385 331 // ==================================================================================================================== … … 388 334 389 335 Char g_aucConvertToBit [ MAX_CU_SIZE+1 ]; 390 #if !MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX391 #if H_3D_IC392 UInt g_aICEnableCANDIDATE[10] = { 0, };393 UInt g_aICEnableNUM[ 10 ] = { 0, };394 Int g_lastlayer=0;395 #endif396 #endif397 336 #if ENC_DEC_TRACE 398 337 FILE* g_hTrace = NULL; … … 667 606 #endif 668 607 #endif 669 #if H_3D_DIM_DMM670 std::vector< std::vector<TComWedgelet> > g_dmmWedgeLists;671 std::vector< std::vector<TComWedgeRef> > g_dmmWedgeRefLists;672 std::vector< std::vector<TComWedgeNode> > g_dmmWedgeNodeLists;673 674 Void initWedgeLists( Bool initNodeList )675 {676 if( !g_dmmWedgeLists.empty() ) return;677 678 #if SHARP_DMM1_I0110679 for( UInt ui = g_aucConvertToBit[DIM_MIN_SIZE]; ui < (g_aucConvertToBit[DIM_MAX_SIZE]); ui++ )680 #else681 for( UInt ui = g_aucConvertToBit[DIM_MIN_SIZE]; ui < (g_aucConvertToBit[DIM_MAX_SIZE]+1); ui++ )682 #endif683 {684 UInt uiWedgeBlockSize = ((UInt)DIM_MIN_SIZE)<<ui;685 std::vector<TComWedgelet> acWedgeList;686 std::vector<TComWedgeRef> acWedgeRefList;687 createWedgeList( uiWedgeBlockSize, uiWedgeBlockSize, acWedgeList, acWedgeRefList, g_dmmWedgeResolution[ui] );688 g_dmmWedgeLists.push_back( acWedgeList );689 g_dmmWedgeRefLists.push_back( acWedgeRefList );690 691 if( initNodeList )692 {693 // create WedgeNodeList694 std::vector<TComWedgeNode> acWedgeNodeList;695 for( UInt uiPos = 0; uiPos < acWedgeList.size(); uiPos++ )696 {697 if( acWedgeList[uiPos].getIsCoarse() )698 {699 TComWedgeNode cWedgeNode;700 cWedgeNode.setPatternIdx( uiPos );701 702 UInt uiRefPos = 0;703 for( Int iOffS = -1; iOffS <= 1; iOffS++ )704 {705 for( Int iOffE = -1; iOffE <= 1; iOffE++ )706 {707 if( iOffS == 0 && iOffE == 0 ) { continue; }708 709 Int iSx = (Int)acWedgeList[uiPos].getStartX();710 Int iSy = (Int)acWedgeList[uiPos].getStartY();711 Int iEx = (Int)acWedgeList[uiPos].getEndX();712 Int iEy = (Int)acWedgeList[uiPos].getEndY();713 714 switch( acWedgeList[uiPos].getOri() )715 {716 case( 0 ): { iSx += iOffS; iEy += iOffE; } break;717 case( 1 ): { iSy += iOffS; iEx -= iOffE; } break;718 case( 2 ): { iSx -= iOffS; iEy -= iOffE; } break;719 case( 3 ): { iSy -= iOffS; iEx += iOffE; } break;720 case( 4 ): { iSx += iOffS; iEx += iOffE; } break;721 case( 5 ): { iSy += iOffS; iEy += iOffE; } break;722 default: assert( 0 );723 }724 725 for( UInt k = 0; k < acWedgeRefList.size(); k++ )726 {727 if( iSx == (Int)acWedgeRefList[k].getStartX() &&728 iSy == (Int)acWedgeRefList[k].getStartY() &&729 iEx == (Int)acWedgeRefList[k].getEndX() &&730 iEy == (Int)acWedgeRefList[k].getEndY() )731 {732 if( acWedgeRefList[k].getRefIdx() != cWedgeNode.getPatternIdx() )733 {734 Bool bNew = true;735 for( UInt m = 0; m < uiRefPos; m++ ) { if( acWedgeRefList[k].getRefIdx() == cWedgeNode.getRefineIdx( m ) ) { bNew = false; break; } }736 737 if( bNew )738 {739 cWedgeNode.setRefineIdx( acWedgeRefList[k].getRefIdx(), uiRefPos );740 uiRefPos++;741 break;742 }743 }744 }745 }746 }747 }748 acWedgeNodeList.push_back( cWedgeNode );749 }750 }751 g_dmmWedgeNodeLists.push_back( acWedgeNodeList );752 }753 }754 }755 756 Void createWedgeList( UInt uiWidth, UInt uiHeight, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList, WedgeResolution eWedgeRes )757 {758 assert( uiWidth == uiHeight );759 760 UChar uhStartX = 0, uhStartY = 0, uhEndX = 0, uhEndY = 0;761 Int iStepStartX = 0, iStepStartY = 0, iStepEndX = 0, iStepEndY = 0;762 763 UInt uiBlockSize = 0;764 switch( eWedgeRes )765 {766 #if !SHARP_DMM1_I0110767 case( DOUBLE_PEL ): { uiBlockSize = (uiWidth>>1); break; }768 #endif769 case( FULL_PEL ): { uiBlockSize = uiWidth; break; }770 case( HALF_PEL ): { uiBlockSize = (uiWidth<<1); break; }771 }772 773 TComWedgelet cTempWedgelet( uiWidth, uiHeight );774 for( UInt uiOri = 0; uiOri < 6; uiOri++ )775 {776 // init the edge line parameters for each of the 6 wedgelet types777 switch( uiOri )778 {779 case( 0 ): { uhStartX = 0; uhStartY = 0; uhEndX = 0; uhEndY = 0; iStepStartX = +1; iStepStartY = 0; iStepEndX = 0; iStepEndY = +1; break; }780 case( 1 ): { uhStartX = (uiBlockSize-1); uhStartY = 0; uhEndX = (uiBlockSize-1); uhEndY = 0; iStepStartX = 0; iStepStartY = +1; iStepEndX = -1; iStepEndY = 0; break; }781 case( 2 ): { uhStartX = (uiBlockSize-1); uhStartY = (uiBlockSize-1); uhEndX = (uiBlockSize-1); uhEndY = (uiBlockSize-1); iStepStartX = -1; iStepStartY = 0; iStepEndX = 0; iStepEndY = -1; break; }782 case( 3 ): { uhStartX = 0; uhStartY = (uiBlockSize-1); uhEndX = 0; uhEndY = (uiBlockSize-1); iStepStartX = 0; iStepStartY = -1; iStepEndX = +1; iStepEndY = 0; break; }783 case( 4 ): { uhStartX = 0; uhStartY = 0; uhEndX = 0; uhEndY = (uiBlockSize-1); iStepStartX = +1; iStepStartY = 0; iStepEndX = +1; iStepEndY = 0; break; }784 case( 5 ): { uhStartX = (uiBlockSize-1); uhStartY = 0; uhEndX = 0; uhEndY = 0; iStepStartX = 0; iStepStartY = +1; iStepEndX = 0; iStepEndY = +1; break; }785 }786 787 for( Int iK = 0; iK < uiBlockSize; iK++ )788 {789 for( Int iL = 0; iL < uiBlockSize; iL++ )790 {791 cTempWedgelet.setWedgelet( uhStartX + (iK*iStepStartX) , uhStartY + (iK*iStepStartY), uhEndX + (iL*iStepEndX), uhEndY + (iL*iStepEndY), (UChar)uiOri, eWedgeRes, ((iL%2)==0 && (iK%2)==0) );792 addWedgeletToList( cTempWedgelet, racWedgeList, racWedgeRefList );793 }794 }795 }796 797 798 }799 800 Void addWedgeletToList( TComWedgelet cWedgelet, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList )801 {802 Bool bValid = cWedgelet.checkNotPlain();803 if( bValid )804 {805 for( UInt uiPos = 0; uiPos < racWedgeList.size(); uiPos++ )806 {807 if( cWedgelet.checkIdentical( racWedgeList[uiPos].getPattern() ) )808 {809 TComWedgeRef cWedgeRef;810 cWedgeRef.setWedgeRef( cWedgelet.getStartX(), cWedgelet.getStartY(), cWedgelet.getEndX(), cWedgelet.getEndY(), uiPos );811 racWedgeRefList.push_back( cWedgeRef );812 bValid = false;813 return;814 }815 }816 }817 if( bValid )818 {819 for( UInt uiPos = 0; uiPos < racWedgeList.size(); uiPos++ )820 {821 if( cWedgelet.checkInvIdentical( racWedgeList[uiPos].getPattern() ) )822 {823 TComWedgeRef cWedgeRef;824 cWedgeRef.setWedgeRef( cWedgelet.getStartX(), cWedgelet.getStartY(), cWedgelet.getEndX(), cWedgelet.getEndY(), uiPos );825 racWedgeRefList.push_back( cWedgeRef );826 bValid = false;827 return;828 }829 }830 }831 if( bValid )832 {833 cWedgelet.findClosestAngle();834 racWedgeList.push_back( cWedgelet );835 TComWedgeRef cWedgeRef;836 cWedgeRef.setWedgeRef( cWedgelet.getStartX(), cWedgelet.getStartY(), cWedgelet.getEndX(), cWedgelet.getEndY(), (UInt)(racWedgeList.size()-1) );837 racWedgeRefList.push_back( cWedgeRef );838 }839 }840 #endif //H_3D_DIM_DMM841 608 842 609 //! \} -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComRom.h
r1066 r1072 45 45 #include<iostream> 46 46 47 #if H_3D_DIM48 #include "TComWedgelet.h"49 #endif50 47 51 48 //! \ingroup TLibCommon … … 150 147 extern const UChar g_aucConvertTxtTypeToIdx[4]; 151 148 152 #if H_3D_DIM153 // ====================================================================================================================154 // Depth coding modes155 // ====================================================================================================================156 __inline Void mapDepthModeToIntraDir( UInt& intraMode ) { if( isDimMode( intraMode ) ) intraMode = DC_IDX; }157 __inline Void mapDepthModeToIntraDir( Int& intraMode ) { if( isDimMode( intraMode ) ) intraMode = DC_IDX; }158 159 #if H_3D_DIM_SDC || H_3D_DIM_DLT160 __inline UInt numBitsForValue( UInt value ) { UInt bits = 0; while (value != 0) { value >>= 1; bits++; } return bits; };161 #endif162 163 #if H_3D_DIM_DMM164 extern const WedgeResolution g_dmmWedgeResolution [6];165 extern const UChar g_dmm1TabIdxBits [6];166 extern const UChar g_dmm3IntraTabIdxBits[6];167 168 #if SHARP_DMM1_I0110169 extern Bool g_wedgePattern[32*32];170 #endif171 172 extern std::vector< std::vector<TComWedgelet> > g_dmmWedgeLists;173 extern std::vector< std::vector<TComWedgeRef> > g_dmmWedgeRefLists;174 extern std::vector< std::vector<TComWedgeNode> > g_dmmWedgeNodeLists;175 176 Void initWedgeLists( Bool initNodeList = false );177 Void createWedgeList( UInt uiWidth, UInt uiHeight, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList, WedgeResolution eWedgeRes );178 Void addWedgeletToList( TComWedgelet cWedgelet, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList );179 #endif180 #endif181 149 182 150 // ========================================== … … 230 198 231 199 extern Char g_aucConvertToBit [ MAX_CU_SIZE+1 ]; // from width to log2(width)-2 232 #if !MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX233 #if H_3D_IC234 extern UInt g_aICEnableCANDIDATE[10];235 extern UInt g_aICEnableNUM[ 10 ]; //10 layers236 extern Int g_lastlayer;237 #endif238 #endif239 200 240 201 #ifndef ENC_DEC_TRACE -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComSlice.cpp
r1066 r1072 112 112 , m_viewId (0) 113 113 , m_viewIndex (0) 114 #if H_3D115 , m_isDepth (false)116 #endif117 114 #if !H_MV_HLS7_GEN 118 115 , m_pocResetFlag (false) … … 134 131 , m_pocMsbValRequiredFlag ( false ) 135 132 #endif 136 #if H_3D_IC137 , m_bApplyIC ( false )138 , m_icSkipParseFlag ( false )139 #endif140 #if H_3D141 , m_depthToDisparityB ( NULL )142 , m_depthToDisparityF ( NULL )143 #endif144 #if MTK_SINGLE_DEPTH_MODE_I0095145 , m_bApplySingleDepthMode (false)146 #endif147 133 #endif 148 134 { … … 187 173 delete[] m_puiSubstreamSizes; 188 174 m_puiSubstreamSizes = NULL; 189 #if H_3D190 for( UInt i = 0; i < getViewIndex(); i++ )191 {192 if ( m_depthToDisparityB && m_depthToDisparityB[ i ] )193 {194 delete[] m_depthToDisparityB [ i ];195 }196 197 if ( m_depthToDisparityF && m_depthToDisparityF[ i ] )198 {199 delete[] m_depthToDisparityF [ i ];200 }201 }202 203 if ( m_depthToDisparityF )204 {205 delete[] m_depthToDisparityF;206 }207 208 m_depthToDisparityF = NULL;209 210 if ( m_depthToDisparityB )211 delete[] m_depthToDisparityB;212 213 m_depthToDisparityB = NULL;214 #endif215 175 } 216 176 … … 229 189 m_iSliceQpDeltaCr = 0; 230 190 231 #if H_3D_IV_MERGE232 m_maxNumMergeCand = MRG_MAX_NUM_CANDS_MEM;233 #else234 191 m_maxNumMergeCand = MRG_MAX_NUM_CANDS; 235 #endif236 192 237 193 m_bFinalized=false; … … 241 197 m_numEntryPointOffsets = 0; 242 198 m_enableTMVPFlag = true; 243 #if H_3D_TMVP244 m_aiAlterRefIdx[0] = -1;245 m_aiAlterRefIdx[1] = -1;246 #endif247 199 } 248 200 … … 650 602 651 603 TComPic** refPicSetStCurr [2] = { RefPicSetStCurr0, RefPicSetStCurr1 }; 652 #if FIX_WARNING653 Int numPocStCurr[2] = { (Int)NumPocStCurr0, (Int)NumPocStCurr1 };654 #else655 604 Int numPocStCurr[2] = { NumPocStCurr0, NumPocStCurr1 }; 656 #endif657 605 658 606 for (Int li = 0; li < ((m_eSliceType==B_SLICE) ? 2 : 1); li++) … … 772 720 } 773 721 } 774 #if H_3D775 #if H_3D_TMVP776 Void TComSlice::generateAlterRefforTMVP()777 {778 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )779 {780 if ( this->getNumRefIdx( RefPicList( uiRefListIdx ) ) == 0)781 {782 continue;783 }784 Bool bZeroIdxLtFlag = this->getRefPic(RefPicList(uiRefListIdx), 0)->getIsLongTerm();785 for(Int i = 1; i < this->getNumRefIdx(RefPicList(uiRefListIdx)); i++ )786 {787 if ( ( bZeroIdxLtFlag && !this->getRefPic(RefPicList(uiRefListIdx), i)->getIsLongTerm() ) ||788 (!bZeroIdxLtFlag && this->getRefPic(RefPicList(uiRefListIdx), i)->getIsLongTerm() ) )789 {790 this->setAlterRefIdx(RefPicList(uiRefListIdx),i);791 break;792 }793 }794 }795 }796 #endif797 Void TComSlice::setCamparaSlice( Int** aaiScale, Int** aaiOffset )798 {799 if( m_pcVPS->hasCamParInSliceHeader( m_viewIndex ) )800 {801 for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < m_viewIndex; uiBaseViewIndex++ )802 {803 m_aaiCodedScale [ 0 ][ uiBaseViewIndex ] = aaiScale [ uiBaseViewIndex ][ m_viewIndex ];804 m_aaiCodedScale [ 1 ][ uiBaseViewIndex ] = aaiScale [ m_viewIndex ][ uiBaseViewIndex ];805 m_aaiCodedOffset[ 0 ][ uiBaseViewIndex ] = aaiOffset[ uiBaseViewIndex ][ m_viewIndex ];806 m_aaiCodedOffset[ 1 ][ uiBaseViewIndex ] = aaiOffset[ m_viewIndex ][ uiBaseViewIndex ];807 }808 }809 }810 #endif811 722 812 723 Void TComSlice::checkColRefIdx(UInt curSliceIdx, TComPic* pic) … … 1104 1015 m_interLayerPredLayerIdc[ layer ] = pSrc->m_interLayerPredLayerIdc[ layer ]; 1105 1016 } 1106 #endif1107 #if MTK_SINGLE_DEPTH_MODE_I00951108 m_bApplySingleDepthMode = pSrc->m_bApplySingleDepthMode;1109 #endif1110 #if H_3D_IC1111 m_bApplyIC = pSrc->m_bApplyIC;1112 m_icSkipParseFlag = pSrc->m_icSkipParseFlag;1113 1017 #endif 1114 1018 } … … 1967 1871 m_viewIdVal [i] = 0; 1968 1872 1969 #if H_3D1970 m_viewIndex [i] = -1;1971 m_vpsDepthModesFlag [i] = false;1972 #if SEC_HLS_CLEANUP_I01001973 m_ivMvScalingFlag[i] = true;1974 #else1975 m_ivMvScalingFlag = true;1976 #endif1977 #if SEPARATE_FLAG_I00851978 m_bIVPFlag [i] = false;1979 #endif1980 #endif1981 1873 1982 1874 for( Int j = 0; j < MAX_NUM_LAYERS; j++ ) … … 1999 1891 m_dimensionId[i][j] = 0; 2000 1892 } 2001 #if H_3D_ARP2002 m_uiUseAdvResPred[i] = 0;2003 m_uiARPStepNum[i] = 1;2004 #endif2005 1893 } 2006 1894 m_vpsVUI = new TComVPSVUI; 2007 1895 m_dpbSize = new TComDpbSize; 2008 1896 2009 #if H_3D2010 for( Int i = 0; i < MAX_NUM_LAYERS; i++ )2011 {2012 #if H_3D_IV_MERGE2013 m_ivMvPredFlag [ i ] = false;2014 #if H_3D_SPIVMP2015 m_iSubPULog2Size [ i ] = 0;2016 #endif2017 #endif2018 #if MTK_I0099_VPS_EX22019 m_bLimQtPredFlag [ i ] = false;2020 #endif2021 #if H_3D_VSP2022 m_viewSynthesisPredFlag[ i ] = false;2023 #endif2024 #if H_3D_NBDV_REF2025 m_depthRefinementFlag [ i ] = false;2026 #endif2027 #if H_3D_INTER_SDC2028 m_bInterSDCFlag [ i ] = false;2029 #endif2030 #if SEPARATE_FLAG_I00852031 m_bIVPFlag [ i ] = false;2032 #endif2033 #if H_3D_DBBP2034 m_dbbpFlag [ i ] = false;2035 #endif2036 #if H_3D_IV_MERGE2037 m_bMPIFlag [ i ] = false;2038 #endif2039 }2040 #endif2041 1897 #endif 2042 1898 } … … 2056 1912 } 2057 1913 #endif 2058 #if H_3D2059 deleteCamPars();2060 #endif2061 1914 } 2062 1915 … … 2278 2131 } 2279 2132 2280 #if H_3D2281 Int TComVPS::getLayerIdInNuh( Int viewIndex, Bool depthFlag )2282 {2283 Int foundLayerIdinNuh = -1;2284 2285 for (Int layerIdInVps = 0 ; layerIdInVps <= getMaxLayersMinus1(); layerIdInVps++ )2286 {2287 Int layerIdInNuh = getLayerIdInNuh( layerIdInVps );2288 if( ( getViewIndex( layerIdInNuh ) == viewIndex ) && ( getDepthId( layerIdInNuh ) == ( depthFlag ? 1 : 0 ) ) )2289 {2290 foundLayerIdinNuh = layerIdInNuh;2291 break;2292 }2293 }2294 #if !BUG_FIX_TK652295 assert( foundLayerIdinNuh != -1 );2296 #endif2297 return foundLayerIdinNuh;2298 }2299 2300 Void TComVPS::createCamPars(Int iNumViews)2301 {2302 Int i = 0, j = 0;2303 2304 m_bCamParPresent = new Bool[ iNumViews ];2305 m_bCamParInSliceHeader = new Bool[ iNumViews ];2306 2307 m_aaaiCodedScale = new Int**[ iNumViews ];2308 m_aaaiCodedOffset = new Int**[ iNumViews ];2309 for ( i = 0; i < iNumViews ; i++ )2310 {2311 #if H_3D_FIX_UNINIT2312 m_bCamParPresent[i] = false;2313 #endif2314 m_bCamParInSliceHeader[i] = false;2315 m_aaaiCodedScale[i] = new Int*[ 2 ];2316 m_aaaiCodedOffset[i] = new Int*[ 2 ];2317 for ( j = 0; j < 2; j++ )2318 {2319 m_aaaiCodedScale[i][j] = new Int[ MAX_NUM_LAYERS ];2320 m_aaaiCodedOffset[i][j] = new Int[ MAX_NUM_LAYERS ];2321 for ( Int k = 0; k < MAX_NUM_LAYERS; k++ )2322 {2323 m_aaaiCodedScale[i][j][k] = 0;2324 m_aaaiCodedOffset[i][j][k] = 0;2325 }2326 }2327 }2328 }2329 2330 Void TComVPS::deleteCamPars()2331 {2332 Int iNumViews = getNumViews();2333 Int i = 0, j = 0;2334 2335 if ( m_bCamParPresent != NULL )2336 {2337 delete [] m_bCamParPresent;2338 }2339 if ( m_bCamParInSliceHeader != NULL )2340 {2341 delete [] m_bCamParInSliceHeader;2342 }2343 2344 if ( m_aaaiCodedScale != NULL )2345 {2346 for ( i = 0; i < iNumViews ; i++ )2347 {2348 for ( j = 0; j < 2; j++ )2349 {2350 delete [] m_aaaiCodedScale[i][j];2351 }2352 delete [] m_aaaiCodedScale[i];2353 }2354 delete [] m_aaaiCodedScale;2355 }2356 2357 if ( m_aaaiCodedOffset != NULL )2358 {2359 for ( i = 0; i < iNumViews ; i++ )2360 {2361 for ( j = 0; j < 2; j++ )2362 {2363 delete [] m_aaaiCodedOffset[i][j];2364 }2365 delete [] m_aaaiCodedOffset[i];2366 }2367 delete [] m_aaaiCodedOffset;2368 }2369 }2370 2371 2372 Void2373 TComVPS::initCamParaVPS( UInt uiViewIndex, Bool bCamParPresent, UInt uiCamParPrecision, Bool bCamParSlice, Int** aaiScale, Int** aaiOffset )2374 {2375 AOT( uiViewIndex != 0 && !bCamParSlice && ( aaiScale == 0 || aaiOffset == 0 ) );2376 2377 m_uiCamParPrecision = ( ( uiViewIndex != 0 )? uiCamParPrecision : 0 );2378 m_bCamParPresent[ uiViewIndex ] = (( uiViewIndex != 0 )? bCamParPresent : false );2379 m_bCamParInSliceHeader[ uiViewIndex ] = ( (uiViewIndex != 0)? bCamParSlice : false );2380 2381 if( !m_bCamParInSliceHeader[ uiViewIndex ] )2382 {2383 for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < uiViewIndex; uiBaseViewIndex++ )2384 {2385 m_aaaiCodedScale [ uiViewIndex ][ 0 ][ uiBaseViewIndex ] = aaiScale [ uiBaseViewIndex ][ uiViewIndex ];2386 m_aaaiCodedScale [ uiViewIndex ][ 1 ][ uiBaseViewIndex ] = aaiScale [ uiViewIndex ][ uiBaseViewIndex ];2387 m_aaaiCodedOffset[ uiViewIndex ][ 0 ][ uiBaseViewIndex ] = aaiOffset[ uiBaseViewIndex ][ uiViewIndex ];2388 m_aaaiCodedOffset[ uiViewIndex ][ 1 ][ uiBaseViewIndex ] = aaiOffset[ uiViewIndex ][ uiBaseViewIndex ];2389 }2390 }2391 }2392 2393 #endif // H_3D2394 2133 2395 2134 … … 2753 2492 vector<Int> range; 2754 2493 2755 #if H_3D2756 vector<Int> depthId;2757 #endif2758 2494 2759 2495 #if H_MV_HLS10_AUX … … 2772 2508 auxId .push_back( getAuxId ( i ) ); 2773 2509 viewId .push_back( getViewId ( getLayerIdInNuh( i ) ) ); 2774 #if H_3D2775 depthId.push_back( getDepthId( i ) );2776 #endif2777 2510 #endif 2778 2511 } … … 2792 2525 vector<Int> layerIdxInVps; 2793 2526 2794 #if H_3D2795 vector<Int> depthId;2796 #endif2797 2527 2798 2528 vector<Int> viewOrderIndex; … … 2809 2539 auxId .push_back( getAuxId ( layerIdInNuh ) ); 2810 2540 viewId .push_back( getViewId ( layerIdInNuh ) ); 2811 #if H_3D2812 depthId .push_back( getDepthId ( layerIdInNuh ) );2813 #endif2814 2541 } 2815 2542 … … 2910 2637 , m_pcmLog2MaxSize ( 5) 2911 2638 , m_uiPCMLog2MinSize ( 7) 2912 #if !MTK_I0099_VPS_EX22913 #if H_3D_QTLPC2914 , m_bUseQTL (false)2915 , m_bUsePC (false)2916 #endif2917 #endif2918 2639 , m_bitDepthY ( 8) 2919 2640 , m_bitDepthC ( 8) … … 2941 2662 , m_interViewMvVertConstraintFlag (false) 2942 2663 #endif 2943 #if H_3D2944 , m_bCamParInSliceHeader (false)2945 #endif2946 2664 { 2947 2665 for ( Int i = 0; i < MAX_TLAYER; i++ ) … … 2957 2675 m_spsRangeExtensionsFlag = false; 2958 2676 m_spsMultilayerExtensionFlag = false; 2959 #if H_3D2960 m_spsExtension5bits = 0;2961 m_sps3dExtensionFlag = false;2962 #else2963 2677 m_spsExtension6bits = 0; 2964 #endif2965 2678 2966 2679 #if !H_MV_HLS10_PPS … … 3137 2850 , m_ppsScalingListRefLayerId(0) 3138 2851 , m_pocResetInfoPresentFlag(false) 3139 #if H_3D3140 , m_pcDLT(NULL)3141 #endif3142 2852 #endif 3143 2853 { … … 3147 2857 m_ppsRangeExtensionsFlag = false; 3148 2858 m_ppsMultilayerExtensionFlag = false; 3149 #if !H_3D3150 2859 m_ppsExtension6bits = 0; 3151 #else3152 m_pps3dExtensionFlag = false;3153 m_ppsExtension5bits = 0;3154 #endif3155 2860 #endif 3156 2861 } … … 3171 2876 } 3172 2877 3173 #if H_3D3174 TComDLT::TComDLT()3175 : m_bDltPresentFlag(false)3176 , m_iNumDepthViews(0)3177 , m_uiDepthViewBitDepth(8)3178 {3179 m_uiDepthViewBitDepth = g_bitDepthY;3180 3181 for( Int i = 0; i < MAX_NUM_LAYERS; i++ )3182 {3183 m_bUseDLTFlag [i] = false;3184 m_bInterViewDltPredEnableFlag [i] = false;3185 3186 // allocate some memory and initialize with default mapping3187 m_iNumDepthmapValues[i] = ((1 << m_uiDepthViewBitDepth)-1)+1;3188 #if !FIX_TICKET_773189 m_iBitsPerDepthValue[i] = numBitsForValue(m_iNumDepthmapValues[i]);3190 #endif3191 m_iDepthValue2Idx[i] = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]);3192 m_iIdx2DepthValue[i] = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]);3193 3194 //default mapping3195 for (Int d=0; d<m_iNumDepthmapValues[i]; d++)3196 {3197 m_iDepthValue2Idx[i][d] = d;3198 m_iIdx2DepthValue[i][d] = d;3199 }3200 }3201 }3202 3203 TComDLT::~TComDLT()3204 {3205 for( Int i = 0; i < MAX_NUM_LAYERS; i++ )3206 {3207 if ( m_iDepthValue2Idx[i] != NULL )3208 {3209 xFree( m_iDepthValue2Idx[i] );3210 m_iDepthValue2Idx[i] = NULL;3211 }3212 3213 if ( m_iIdx2DepthValue[i] != NULL )3214 {3215 xFree( m_iIdx2DepthValue[i] );3216 m_iIdx2DepthValue[i] = NULL;3217 }3218 }3219 }3220 3221 Void TComDLT::setDepthLUTs(Int layerIdInVps, Int* idxToDepthValueTable, Int iNumDepthValues)3222 {3223 if( idxToDepthValueTable == NULL || iNumDepthValues == 0 ) // default mapping only3224 return;3225 3226 // copy idx2DepthValue to internal array3227 memcpy(m_iIdx2DepthValue[layerIdInVps], idxToDepthValueTable, iNumDepthValues*sizeof(UInt));3228 3229 UInt uiMaxDepthValue = ((1 << g_bitDepthY)-1);3230 for(Int p=0; p<=uiMaxDepthValue; p++)3231 {3232 Int iIdxDown = 0;3233 Int iIdxUp = iNumDepthValues-1;3234 Bool bFound = false;3235 3236 // iterate over indices to find lower closest depth3237 Int i = 1;3238 while(!bFound && i<iNumDepthValues)3239 {3240 if( m_iIdx2DepthValue[layerIdInVps][i] > p )3241 {3242 iIdxDown = i-1;3243 bFound = true;3244 }3245 3246 i++;3247 }3248 // iterate over indices to find upper closest depth3249 i = iNumDepthValues-2;3250 bFound = false;3251 while(!bFound && i>=0)3252 {3253 if( m_iIdx2DepthValue[layerIdInVps][i] < p )3254 {3255 iIdxUp = i+1;3256 bFound = true;3257 }3258 3259 i--;3260 }3261 3262 // assert monotony3263 assert(iIdxDown<=iIdxUp);3264 3265 // assign closer depth value/idx3266 if( abs(p-m_iIdx2DepthValue[layerIdInVps][iIdxDown]) < abs(p-m_iIdx2DepthValue[layerIdInVps][iIdxUp]) )3267 {3268 m_iDepthValue2Idx[layerIdInVps][p] = iIdxDown;3269 }3270 else3271 {3272 m_iDepthValue2Idx[layerIdInVps][p] = iIdxUp;3273 }3274 3275 }3276 3277 // update DLT variables3278 m_iNumDepthmapValues[layerIdInVps] = iNumDepthValues;3279 #if !FIX_TICKET_773280 m_iBitsPerDepthValue[layerIdInVps] = numBitsForValue(m_iNumDepthmapValues[layerIdInVps]);3281 #endif3282 }3283 3284 #if H_3D_DELTA_DLT3285 Void TComDLT::getDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTOut, UInt *puiDeltaDLTOutNum )3286 {3287 Bool abBM0[ 256 ];3288 Bool abBM1[ 256 ];3289 3290 memset( abBM0, 0, sizeof( abBM0 ));3291 memset( abBM1, 0, sizeof( abBM1 ));3292 3293 // convert reference DLT to bit string3294 for( Int i = 0; i < uiDLTInRefNum; i++ )3295 {3296 abBM0[ piDLTInRef[ i ] ] = true;3297 }3298 // convert internal DLT to bit string3299 for( Int i = 0; i < m_iNumDepthmapValues[ layerIdInVps ]; i++ )3300 {3301 abBM1[ m_iIdx2DepthValue[ layerIdInVps ][ i ] ] = true;3302 }3303 3304 *puiDeltaDLTOutNum = 0;3305 for( Int i = 0; i < 256; i++ )3306 {3307 if( abBM0[ i ] ^ abBM1[ i ] )3308 {3309 piDeltaDLTOut[ *puiDeltaDLTOutNum ] = i;3310 *puiDeltaDLTOutNum = *puiDeltaDLTOutNum + 1;3311 }3312 }3313 }3314 3315 Void TComDLT::setDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTIn, UInt uiDeltaDLTInNum )3316 {3317 Bool abBM0[ 256 ];3318 Bool abBM1[ 256 ];3319 3320 memset( abBM0, 0, sizeof( abBM0 ));3321 memset( abBM1, 0, sizeof( abBM1 ));3322 3323 // convert reference DLT to bit string3324 for( Int i = 0; i < uiDLTInRefNum; i++ )3325 {3326 abBM0[ piDLTInRef[ i ] ] = true;3327 }3328 // convert delta DLT to bit string3329 for( Int i = 0; i < uiDeltaDLTInNum; i++ )3330 {3331 abBM1[ piDeltaDLTIn[ i ] ] = true;3332 }3333 3334 Int aiIdx2DepthValue[256];3335 UInt uiNumDepthValues = 0;3336 memset( aiIdx2DepthValue, 0, sizeof( aiIdx2DepthValue ));3337 3338 for( Int i = 0; i < 256; i++ )3339 {3340 if( abBM0[ i ] ^ abBM1[ i ] )3341 {3342 aiIdx2DepthValue[ uiNumDepthValues++ ] = i;3343 }3344 }3345 3346 // update internal tables3347 setDepthLUTs(layerIdInVps, aiIdx2DepthValue, uiNumDepthValues);3348 }3349 #endif3350 3351 #endif3352 2878 3353 2879 #if H_MV … … 3962 3488 } 3963 3489 3964 #if H_3D_ARP 3965 Void TComSlice::setARPStepNum( TComPicLists*ivPicLists ) 3966 { 3967 Bool tempRefPicInListsFlag = false; 3968 if(!getVPS()->getUseAdvRP(getLayerId()) || this->isIRAP()) 3969 { 3970 m_nARPStepNum = 0; 3971 } 3972 else 3973 { 3974 setFirstTRefIdx (REF_PIC_LIST_0, -1); 3975 setFirstTRefIdx (REF_PIC_LIST_1, -1); 3976 for ( Int refListIdx = 0; refListIdx < ((m_eSliceType==B_SLICE) ? 2 : 1); refListIdx++ ) 3977 { 3978 Int diffPOC=MAX_INT; 3979 Int idx=-1; 3980 for(Int i = 0; i < getNumRefIdx(RefPicList(refListIdx)); i++ ) 3981 { 3982 if ( getRefPic(RefPicList(refListIdx), i)->getPOC() != getPOC() ) 3983 { 3984 if( abs(getRefPic(RefPicList(refListIdx), i)->getPOC() - getPOC()) < diffPOC) 3985 { 3986 diffPOC=abs(getRefPic(RefPicList(refListIdx), i)->getPOC() - getPOC()); 3987 idx=i; 3988 } 3989 } 3990 if(idx>=0) 3991 { 3992 setFirstTRefIdx (RefPicList(refListIdx), idx); 3993 } 3994 } 3995 } 3996 tempRefPicInListsFlag = getFirstTRefIdx(REF_PIC_LIST_0) >= 0 || getFirstTRefIdx(REF_PIC_LIST_1) >= 0; 3997 m_nARPStepNum = tempRefPicInListsFlag ? getVPS()->getARPStepNum(getLayerId()) : 0; 3998 } 3999 4000 if (tempRefPicInListsFlag) 4001 { 4002 for ( Int refListIdx = 0; refListIdx < ((m_eSliceType==B_SLICE) ? 2 : 1); refListIdx++ ) 4003 { 4004 RefPicList eRefPicList = RefPicList( refListIdx ); 4005 Int prevPOC = getRefPic(eRefPicList, getFirstTRefIdx(eRefPicList) )->getPOC(); 4006 for( Int i = 0; i < getNumActiveRefLayerPics(); i++ ) 4007 { 4008 Int layerIdInNuh = getRefPicLayerId( i ); 4009 Int viewIdx = getVPS()->getViewId( layerIdInNuh ); 4010 TComPic*pcPicPrev = ivPicLists->getPic(viewIdx, 0, prevPOC); 4011 if (getFirstTRefIdx(eRefPicList) >= 0 && pcPicPrev && pcPicPrev->getSlice( 0 )->isReferenced()) 4012 { 4013 m_arpRefPicAvailable[eRefPicList][layerIdInNuh] = true; 4014 } 4015 else 4016 { 4017 m_arpRefPicAvailable[eRefPicList][layerIdInNuh] = false; 4018 } 4019 } 4020 } 4021 } 4022 } 4023 #endif 4024 #if H_3D_IC 4025 Void TComSlice::xSetApplyIC(Bool bUseLowLatencyICEnc) 4026 { 4027 if(bUseLowLatencyICEnc) 4028 { 4029 Bool existInterViewRef=false; 4030 TComPic* pcCurrPic = getPic(); 4031 TComPic* pcRefPic = NULL; 4032 for ( Int i = 0; (i < getNumRefIdx( REF_PIC_LIST_0 )) && !existInterViewRef; i++ ) 4033 { 4034 pcRefPic = getRefPic( REF_PIC_LIST_0, i ); 4035 if ( pcRefPic != NULL ) 4036 { 4037 if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() ) 4038 { 4039 existInterViewRef = true; 4040 } 4041 } 4042 } 4043 4044 for ( Int i = 0; (i < getNumRefIdx( REF_PIC_LIST_1 )) && !existInterViewRef; i++ ) 4045 { 4046 pcRefPic = getRefPic( REF_PIC_LIST_1, i ); 4047 if ( pcRefPic != NULL ) 4048 { 4049 if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() ) 4050 { 4051 existInterViewRef = true; 4052 } 4053 } 4054 } 4055 4056 if(!existInterViewRef) 4057 { 4058 m_bApplyIC = false; 4059 } 4060 else 4061 { 4062 Int curLayer=getDepth(); 4063 if( curLayer>9) curLayer=9; // Max layer is 10 4064 4065 m_bApplyIC = true; 4066 Int refLayer = curLayer-1; 4067 #if MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX 4068 Int ICEnableCandidate = getICEnableCandidate(refLayer); 4069 Int ICEnableNum = getICEnableNum(refLayer); 4070 if( (refLayer>=0) && (ICEnableCandidate>0) ) 4071 { 4072 Double ratio=Double(ICEnableNum/Double(ICEnableCandidate)); 4073 4074 if( ratio > IC_LOW_LATENCY_ENCODING_THRESHOLD) 4075 { 4076 m_bApplyIC=true; 4077 } 4078 else 4079 { 4080 m_bApplyIC=false; 4081 } 4082 } 4083 setICEnableCandidate(curLayer, 0); 4084 setICEnableNum(curLayer, 0); 4085 #else 4086 if( (refLayer>=0) && (g_aICEnableCANDIDATE[refLayer]>0) ) 4087 { 4088 Double ratio=Double(g_aICEnableNUM[refLayer])/Double(g_aICEnableCANDIDATE[refLayer]); 4089 4090 if( ratio > IC_LOW_LATENCY_ENCODING_THRESHOLD) 4091 { 4092 m_bApplyIC=true; 4093 } 4094 else 4095 { 4096 m_bApplyIC=false; 4097 } 4098 } 4099 g_aICEnableNUM[curLayer]=0; 4100 g_aICEnableCANDIDATE[curLayer]=0; 4101 g_lastlayer=getDepth(); 4102 #endif 4103 } 4104 } 4105 else 4106 { 4107 Int iMaxPelValue = ( 1 << g_bitDepthY ); 4108 Int *aiRefOrgHist; 4109 Int *aiCurrHist; 4110 aiRefOrgHist = (Int *) xMalloc( Int,iMaxPelValue ); 4111 aiCurrHist = (Int *) xMalloc( Int,iMaxPelValue ); 4112 memset( aiRefOrgHist, 0, iMaxPelValue*sizeof(Int) ); 4113 memset( aiCurrHist, 0, iMaxPelValue*sizeof(Int) ); 4114 // Reference Idx Number 4115 Int iNumRefIdx = getNumRefIdx( REF_PIC_LIST_0 ); 4116 TComPic* pcCurrPic = NULL; 4117 TComPic* pcRefPic = NULL; 4118 TComPicYuv* pcCurrPicYuv = NULL; 4119 TComPicYuv* pcRefPicYuvOrg = NULL; 4120 pcCurrPic = getPic(); 4121 pcCurrPicYuv = pcCurrPic->getPicYuvOrg(); 4122 Int iWidth = pcCurrPicYuv->getWidth(); 4123 Int iHeight = pcCurrPicYuv->getHeight(); 4124 4125 4126 // Get InterView Reference picture 4127 // !!!!! Assume only one Interview Reference Picture in L0 4128 for ( Int i = 0; i < iNumRefIdx; i++ ) 4129 { 4130 pcRefPic = getRefPic( REF_PIC_LIST_0, i ); 4131 if ( pcRefPic != NULL ) 4132 { 4133 if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() ) 4134 { 4135 pcRefPicYuvOrg = pcRefPic->getPicYuvOrg(); 4136 } 4137 } 4138 } 4139 4140 if ( pcRefPicYuvOrg != NULL ) 4141 { 4142 Pel* pCurrY = pcCurrPicYuv ->getLumaAddr(); 4143 Pel* pRefOrgY = pcRefPicYuvOrg ->getLumaAddr(); 4144 Int iCurrStride = pcCurrPicYuv->getStride(); 4145 Int iRefStride = pcRefPicYuvOrg->getStride(); 4146 Int iSumOrgSAD = 0; 4147 Double dThresholdOrgSAD = getIsDepth() ? 0.1 : 0.05; 4148 4149 // Histogram building - luminance 4150 for ( Int y = 0; y < iHeight; y++ ) 4151 { 4152 for ( Int x = 0; x < iWidth; x++ ) 4153 { 4154 aiCurrHist[pCurrY[x]]++; 4155 aiRefOrgHist[pRefOrgY[x]]++; 4156 } 4157 pCurrY += iCurrStride; 4158 pRefOrgY += iRefStride; 4159 } 4160 // Histogram SAD 4161 for ( Int i = 0; i < iMaxPelValue; i++ ) 4162 { 4163 iSumOrgSAD += abs( aiCurrHist[i] - aiRefOrgHist[i] ); 4164 } 4165 // Setting 4166 if ( iSumOrgSAD > Int( dThresholdOrgSAD * iWidth * iHeight ) ) 4167 { 4168 m_bApplyIC = true; 4169 } 4170 else 4171 { 4172 m_bApplyIC = false; 4173 } 4174 } 4175 4176 xFree( aiCurrHist ); 4177 xFree( aiRefOrgHist ); 4178 aiCurrHist = NULL; 4179 aiRefOrgHist = NULL; 4180 }//if(bUseLowLatencyICEnc) 4181 } 4182 #endif 4183 #if H_3D 4184 Void TComSlice::setIvPicLists( TComPicLists* m_ivPicLists ) 4185 { 4186 for (Int i = 0; i < MAX_NUM_LAYERS; i++ ) 4187 { 4188 for ( Int depthId = 0; depthId < 2; depthId++ ) 4189 { 4190 m_ivPicsCurrPoc[ depthId ][ i ] = ( i <= m_viewIndex ) ? m_ivPicLists->getPic( i, ( depthId == 1) , getPOC() ) : NULL; 4191 } 4192 } 4193 } 4194 Void TComSlice::setDepthToDisparityLUTs() 4195 { 4196 Bool setupLUT = false; 4197 Int layerIdInVPS = getVPS()->getLayerIdInNuh( m_layerId ); 4198 4199 #if H_3D_VSP 4200 setupLUT = setupLUT || getVPS()->getViewSynthesisPredFlag( layerIdInVPS); 4201 #endif 4202 4203 #if H_3D_NBDV_REF 4204 setupLUT = setupLUT || getVPS()->getDepthRefinementFlag( layerIdInVPS ); 4205 #endif 4206 4207 #if H_3D_IV_MERGE 4208 setupLUT = setupLUT || ( getVPS()->getIvMvPredFlag(layerIdInVPS ) && getIsDepth() ); 4209 #endif 4210 4211 #if H_3D_DDD 4212 #if LGE_FCO_I0116 4213 if( getIsDepth() && getViewIndex() > 0 && getVPS()->getMPIFlag(layerIdInVPS)) 4214 #else 4215 if( getIsDepth() && getViewIndex() > 0 ) 4216 #endif 4217 { 4218 TComSlice *pcTextSlice = getTexturePic()->getSlice( 0 ); 4219 memcpy( m_aiDDDInvScale, pcTextSlice->m_aiDDDInvScale, sizeof( Int ) * getViewIndex() ); 4220 memcpy( m_aiDDDInvOffset, pcTextSlice->m_aiDDDInvOffset, sizeof( Int ) * getViewIndex() ); 4221 memcpy( m_aiDDDShift, pcTextSlice->m_aiDDDShift, sizeof( Int ) * getViewIndex() ); 4222 } 4223 #endif 4224 4225 if( !setupLUT ) 4226 return; 4227 4228 /// GT: Allocation should be moved to a better place later; 4229 if ( m_depthToDisparityB == NULL ) 4230 { 4231 m_depthToDisparityB = new Int*[ getViewIndex() ]; 4232 for ( Int i = 0; i < getViewIndex(); i++ ) 4233 { 4234 m_depthToDisparityB[ i ] = new Int[ Int(1 << g_bitDepthY) ]; 4235 } 4236 } 4237 4238 if ( m_depthToDisparityF == NULL ) 4239 { 4240 m_depthToDisparityF= new Int*[ getViewIndex() ]; 4241 for ( Int i = 0; i < getViewIndex(); i++ ) 4242 { 4243 m_depthToDisparityF[ i ] = new Int[ Int(1 << g_bitDepthY) ]; 4244 } 4245 } 4246 4247 assert( m_depthToDisparityB != NULL ); 4248 assert( m_depthToDisparityF != NULL ); 4249 4250 TComVPS* vps = getVPS(); 4251 4252 Int log2Div = g_bitDepthY - 1 + vps->getCamParPrecision(); 4253 Int viewIndex = getViewIndex(); 4254 4255 Bool camParaSH = vps->hasCamParInSliceHeader( viewIndex ); 4256 4257 Int* codScale = camParaSH ? m_aaiCodedScale [ 0 ] : vps->getCodedScale ( viewIndex ); 4258 Int* codOffset = camParaSH ? m_aaiCodedOffset[ 0 ] : vps->getCodedOffset ( viewIndex ); 4259 Int* invCodScale = camParaSH ? m_aaiCodedScale [ 1 ] : vps->getInvCodedScale ( viewIndex ); 4260 Int* invCodOffset = camParaSH ? m_aaiCodedOffset[ 1 ] : vps->getInvCodedOffset( viewIndex ); 4261 4262 for (Int i = 0; i <= ( getViewIndex() - 1); i++) 4263 { 4264 for ( Int d = 0; d <= ( ( 1 << g_bitDepthY ) - 1 ); d++ ) 4265 { 4266 Int offset = ( codOffset [ i ] << g_bitDepthY ) + ( ( 1 << log2Div ) >> 1 ); 4267 m_depthToDisparityB[ i ][ d ] = ( codScale [ i ] * d + offset ) >> log2Div; 4268 4269 Int invOffset = ( invCodOffset[ i ] << g_bitDepthY ) + ( ( 1 << log2Div ) >> 1 ); 4270 m_depthToDisparityF[ i ][ d ] = ( invCodScale[ i ] * d + invOffset ) >> log2Div; 4271 } 4272 4273 #if H_3D_DDD 4274 initializeDDDPara( vps->getCamParPrecision(), codScale[ i ], codOffset[ i ], i ); 4275 #endif 4276 } 4277 } 4278 #endif 4279 #endif 4280 4281 #if H_3D_DDD 4282 Void TComSlice::initializeDDDPara( UInt uiCamParsCodedPrecision, Int iCodedScale,Int iCodedOffset, Int iBaseViewIdx ) 4283 { 4284 UInt uiViewId = getViewIndex(); 4285 4286 if( uiViewId == 0 ) 4287 { 4288 m_aiDDDInvScale[ iBaseViewIdx ] = m_aiDDDInvOffset[ iBaseViewIdx ] = m_aiDDDShift[ iBaseViewIdx ] = 0; 4289 return; 4290 } 4291 4292 4293 Int iSign = iCodedScale >= 0 ? 1 : -1; 4294 iCodedScale = abs( iCodedScale ); 4295 4296 Int iBitWidth = 0; 4297 4298 const Int iInvPres = 9; 4299 4300 while( ((( 1 << iBitWidth ) << 1 ) <= iCodedScale ) ) 4301 { 4302 iBitWidth ++; 4303 } 4304 iBitWidth += iInvPres; 4305 Int iTargetValue = 1 << iBitWidth; 4306 4307 Int iMinError = MAX_INT; 4308 Int iBestD = 1 << ( iInvPres - 1 ); 4309 for( Int d = 1 << ( iInvPres - 1 ); d < ( 1 << iInvPres ); d++ ) 4310 { 4311 Int iError = abs( iCodedScale * d - iTargetValue ); 4312 if( iError < iMinError ) 4313 { 4314 iMinError = iError; 4315 iBestD = d; 4316 } 4317 if( iMinError == 0 ) 4318 { 4319 break; 4320 } 4321 } 4322 Int iRoundingDir = 0; 4323 if( iCodedScale * iBestD > iTargetValue ) 4324 { 4325 iRoundingDir = -1; 4326 } 4327 else if( iCodedScale * iBestD < iTargetValue ) 4328 { 4329 iRoundingDir = 1; 4330 } 4331 Int iCamPres = uiCamParsCodedPrecision - 1; 4332 m_aiDDDInvScale [ iBaseViewIdx ] = ( iBestD << ( iCamPres + g_bitDepthY )) * iSign; 4333 m_aiDDDInvOffset[ iBaseViewIdx ] = -iSign * iBestD * ( iCodedOffset << g_bitDepthY ); 4334 m_aiDDDShift [ iBaseViewIdx ] = iBitWidth; 4335 m_aiDDDInvOffset[ iBaseViewIdx ] += 1 << ( m_aiDDDShift[ iBaseViewIdx ] - 1 ); 4336 m_aiDDDInvOffset[ iBaseViewIdx ] += ( 1 << ( m_aiDDDShift[ iBaseViewIdx ] - 4 ) ) * iRoundingDir; 4337 4338 return; 4339 } 4340 4341 4342 #endif 3490 #endif 3491 4343 3492 4344 3493 #if H_MV … … 4374 3523 #endif 4375 3524 4376 #if H_3D_DBBP4377 Int TComSlice::getDepthFromDV( Int iDV, Int iBaseViewIdx )4378 {4379 return ClipY(( iDV * m_aiDDDInvScale[ iBaseViewIdx ] + m_aiDDDInvOffset[ iBaseViewIdx ] ) >> m_aiDDDShift[ iBaseViewIdx ]);4380 }4381 #endif4382 3525 4383 3526 /** get scaling matrix from RefMatrixID -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComSlice.h
r1066 r1072 1003 1003 #endif 1004 1004 // VPS EXTENSION 2 SYNTAX ELEMENTS 1005 #if H_3D_ARP1006 UInt m_uiUseAdvResPred [MAX_NUM_LAYERS ];1007 UInt m_uiARPStepNum [MAX_NUM_LAYERS ];1008 #endif1009 #if H_3D_IV_MERGE1010 Bool m_ivMvPredFlag [ MAX_NUM_LAYERS ];1011 #if SEC_HLS_CLEANUP_I01001012 Bool m_ivMvScalingFlag [ MAX_NUM_LAYERS ];1013 #endif1014 #if H_3D_SPIVMP1015 Int m_iSubPULog2Size [MAX_NUM_LAYERS ];1016 #if MTK_I0099_VPS_EX21017 Int m_iSubPUMPILog2Size [MAX_NUM_LAYERS ];1018 #else1019 Int m_iSubPUMPILog2Size;1020 #endif1021 #endif1022 #endif1023 #if MTK_I0099_VPS_EX21024 Bool m_bLimQtPredFlag [ MAX_NUM_LAYERS ];1025 #endif1026 #if H_3D_VSP1027 Bool m_viewSynthesisPredFlag [ MAX_NUM_LAYERS ];1028 #endif1029 #if H_3D_NBDV_REF1030 Bool m_depthRefinementFlag [ MAX_NUM_LAYERS ];1031 #endif1032 1005 Bool m_vpsDepthModesFlag [MAX_NUM_LAYERS ]; 1033 #if SEPARATE_FLAG_I0085 1034 Bool m_bIVPFlag [MAX_NUM_LAYERS ]; 1035 #endif 1036 1037 #if H_3D 1038 UInt m_uiCamParPrecision; 1039 Bool* m_bCamParInSliceHeader; 1040 Bool* m_bCamParPresent; 1041 Int ***m_aaaiCodedScale ; 1042 Int ***m_aaaiCodedOffset; 1043 1044 #if !SEC_HLS_CLEANUP_I0100 1045 Bool m_ivMvScalingFlag; 1046 #endif 1047 1048 #endif 1049 #if H_3D_INTER_SDC 1050 Bool m_bInterSDCFlag[MAX_NUM_LAYERS ]; 1051 #endif 1052 #if H_3D_DBBP 1053 Bool m_dbbpFlag[MAX_NUM_LAYERS]; 1054 #endif 1055 #if H_3D_IV_MERGE 1056 Bool m_bMPIFlag[MAX_NUM_LAYERS ]; 1057 #endif 1006 1058 1007 1059 1008 #endif … … 1440 1389 1441 1390 /// VPS EXTENSION 2 SYNTAX ELEMENTS 1442 #if H_3D1443 Int getDepthId ( Int layerIdInNuh) { return getScalabilityId( getLayerIdInVps(layerIdInNuh), DEPTH_ID ); }1444 Int getLayerIdInNuh( Int viewIndex, Bool depthFlag );1445 1446 #if H_3D_ARP1447 UInt getUseAdvRP ( Int layerIdInVps ) { return m_uiUseAdvResPred[layerIdInVps]; }1448 UInt getARPStepNum( Int layerIdInVps ) { return m_uiARPStepNum[layerIdInVps]; }1449 Void setUseAdvRP ( Int layerIdInVps, UInt val ) { m_uiUseAdvResPred[layerIdInVps] = val; }1450 Void setARPStepNum( Int layerIdInVps, UInt val ) { m_uiARPStepNum[layerIdInVps] = val; }1451 #endif1452 1453 Void createCamPars(Int iNumViews);1454 Void deleteCamPars();1455 Void initCamParaVPS ( UInt uiViewIndex, Bool bCamParPresent = false, UInt uiCamParPrecision = 0, Bool bCamParSlice = false, Int** aaiScale = 0, Int** aaiOffset = 0 );1456 UInt getCamParPrecision () { return m_uiCamParPrecision; }1457 Bool getCamParPresent ( Int viewIndex ) { return m_bCamParPresent[viewIndex]; }1458 Void setCamParPresent ( Int viewIndex, Bool val ) { m_bCamParPresent[viewIndex] = val; }1459 Bool hasCamParInSliceHeader( Int viewIndex ) { return m_bCamParInSliceHeader[viewIndex]; }1460 Void setHasCamParInSliceHeader( Int viewIndex, Bool b ) { m_bCamParInSliceHeader[viewIndex] = b; }1461 Int* getCodedScale ( Int viewIndex ) { return m_aaaiCodedScale [viewIndex][0]; }1462 Int* getCodedOffset ( Int viewIndex ) { return m_aaaiCodedOffset[viewIndex][0]; }1463 Int* getInvCodedScale ( Int viewIndex ) { return m_aaaiCodedScale [viewIndex][1]; }1464 Int* getInvCodedOffset ( Int viewIndex ) { return m_aaaiCodedOffset[viewIndex][1]; }1465 1466 #if H_3D_IV_MERGE1467 Void setIvMvPredFlag ( Int layerIdInVps, Bool val ) { m_ivMvPredFlag[ layerIdInVps ] = val; }1468 Bool getIvMvPredFlag ( Int layerIdInVps ) { return m_ivMvPredFlag[ layerIdInVps ]; };1469 #if H_3D_SPIVMP1470 Int getSubPULog2Size(Int layerIdInVps) { return m_iSubPULog2Size[layerIdInVps]; }1471 Void setSubPULog2Size(Int layerIdInVps, Int u) { m_iSubPULog2Size[layerIdInVps] = u;}1472 #if MTK_I0099_VPS_EX21473 Int getSubPUMPILog2Size(Int layerIdInVps) { return m_iSubPUMPILog2Size[layerIdInVps]; }1474 Void setSubPUMPILog2Size(Int layerIdInVps, Int u) { m_iSubPUMPILog2Size[layerIdInVps] = u;}1475 #else1476 Int getSubPUMPILog2Size( ) { return m_iSubPUMPILog2Size; }1477 Void setSubPUMPILog2Size( Int u ) { m_iSubPUMPILog2Size = u; }1478 #endif1479 #endif1480 #endif1481 #if MTK_I0099_VPS_EX21482 Void setLimQtPredFlag ( Int layerIdInVps, Bool val ) { m_bLimQtPredFlag[ layerIdInVps ] = val; }1483 Bool getLimQtPredFlag ( Int layerIdInVps ) { return m_bLimQtPredFlag[layerIdInVps];}1484 #endif1485 #if H_3D_VSP1486 Void setViewSynthesisPredFlag ( Int layerIdInVps, Bool val ) { m_viewSynthesisPredFlag[ layerIdInVps ] = val; }1487 Bool getViewSynthesisPredFlag ( Int layerIdInVps ) { return m_viewSynthesisPredFlag[ layerIdInVps ]; };1488 #endif1489 #if H_3D_NBDV_REF1490 Void setDepthRefinementFlag ( Int layerIdInVps, Bool val ) { m_depthRefinementFlag[ layerIdInVps ] = val; }1491 Bool getDepthRefinementFlag ( Int layerIdInVps ) { return m_depthRefinementFlag[ layerIdInVps ]; };1492 #endif1493 Void setVpsDepthModesFlag( Int layerIdInVps, Bool val ) { m_vpsDepthModesFlag[ layerIdInVps ] = val; }1494 Bool getVpsDepthModesFlag( Int layerIdInVps ) { return m_vpsDepthModesFlag[ layerIdInVps ]; }1495 #if SEPARATE_FLAG_I00851496 Void setIVPFlag( Int layerIdInVps, Bool val ) { m_bIVPFlag[ layerIdInVps ] = val; }1497 Bool getIVPFlag( Int layerIdInVps ) { return m_bIVPFlag[ layerIdInVps ]; }1498 #endif1499 1500 #if SEC_HLS_CLEANUP_I01001501 Bool getIvMvScalingFlag ( Int layerIdInVps ) { return m_ivMvScalingFlag[ layerIdInVps ]; }1502 Void setIvMvScalingFlag (Int layerIdInVps, Bool b ) { m_ivMvScalingFlag[ layerIdInVps ] = b; }1503 #else1504 Bool getIvMvScalingFlag ( ) { return m_ivMvScalingFlag; }1505 Void setIvMvScalingFlag ( Bool b ) { m_ivMvScalingFlag = b; }1506 #endif1507 1508 #if H_3D_INTER_SDC1509 Bool getInterSDCFlag ( Int layerIdInVps ) { return m_bInterSDCFlag[layerIdInVps]; }1510 Void setInterSDCFlag ( Int layerIdInVps, Bool bval ){ m_bInterSDCFlag[layerIdInVps] = bval; }1511 #endif1512 #if H_3D_DBBP1513 Bool getUseDBBP ( Int layerIdInVps ) { return m_dbbpFlag[layerIdInVps]; }1514 Void setUseDBBP ( Int layerIdInVps, Bool bval ){ m_dbbpFlag[layerIdInVps] = bval; }1515 #endif1516 #if H_3D_IV_MERGE1517 Bool getMPIFlag ( Int layerIdInVps ) { return m_bMPIFlag[layerIdInVps]; }1518 Void setMPIFlag ( Int layerIdInVps, Bool bval ){ m_bMPIFlag[layerIdInVps] = bval; }1519 #endif1520 #endif1521 1391 #endif 1522 1392 }; 1523 1393 1524 #if H_3D1525 class TComDLT1526 {1527 private:1528 Bool m_bDltPresentFlag;1529 Bool m_bUseDLTFlag [ MAX_NUM_LAYERS ];1530 Bool m_bInterViewDltPredEnableFlag[ MAX_NUM_LAYERS ];1531 1532 #if !FIX_TICKET_771533 Int m_iBitsPerDepthValue [ MAX_NUM_LAYERS ];1534 #endif1535 Int m_iNumDepthmapValues [ MAX_NUM_LAYERS ];1536 Int* m_iDepthValue2Idx [ MAX_NUM_LAYERS ];1537 Int* m_iIdx2DepthValue [ MAX_NUM_LAYERS ];1538 1539 Int m_iNumDepthViews;1540 UInt m_uiDepthViewBitDepth;1541 1542 public:1543 TComDLT();1544 ~TComDLT();1545 1546 Bool getDltPresentFlag () { return m_bDltPresentFlag; }1547 Void setDltPresentFlag ( Bool b ) { m_bDltPresentFlag = b; }1548 1549 Bool getUseDLTFlag ( Int layerIdInVps ) { return m_bUseDLTFlag[ layerIdInVps ]; }1550 Void setUseDLTFlag ( Int layerIdInVps, Bool b ) { m_bUseDLTFlag[ layerIdInVps ] = b; }1551 1552 Bool getInterViewDltPredEnableFlag( Int layerIdInVps ) { return m_bInterViewDltPredEnableFlag[ layerIdInVps ]; }1553 Void setInterViewDltPredEnableFlag( Int layerIdInVps, Bool b ) { m_bInterViewDltPredEnableFlag[ layerIdInVps ] = b; }1554 1555 Void setNumDepthViews ( Int n ) { m_iNumDepthViews = n; }1556 Int getNumDepthViews () { return m_iNumDepthViews; }1557 1558 Void setDepthViewBitDepth( UInt n ) { m_uiDepthViewBitDepth = n; }1559 UInt getDepthViewBitDepth() { return m_uiDepthViewBitDepth; }1560 1561 #if !FIX_TICKET_771562 Int getBitsPerDepthValue( Int layerIdInVps ) { return getUseDLTFlag(layerIdInVps)?m_iBitsPerDepthValue[layerIdInVps]:g_bitDepthY; }1563 #endif1564 Int getNumDepthValues( Int layerIdInVps ) { return getUseDLTFlag(layerIdInVps)?m_iNumDepthmapValues[layerIdInVps]:((1 << g_bitDepthY)-1); }1565 Int depthValue2idx( Int layerIdInVps, Pel value ) { return getUseDLTFlag(layerIdInVps)?m_iDepthValue2Idx[layerIdInVps][value]:value; }1566 #if RWTH_DLT_CLIP_I00571567 Pel idx2DepthValue( Int layerIdInVps, UInt uiIdx ) { return getUseDLTFlag(layerIdInVps)?m_iIdx2DepthValue[layerIdInVps][ClipY(uiIdx)]:uiIdx; }1568 #else1569 Pel idx2DepthValue( Int layerIdInVps, UInt uiIdx ) { return getUseDLTFlag(layerIdInVps)?m_iIdx2DepthValue[layerIdInVps][uiIdx]:uiIdx; }1570 #endif1571 Void setDepthLUTs( Int layerIdInVps, Int* idx2DepthValue = NULL, Int iNumDepthValues = 0 );1572 #if H_3D_DELTA_DLT1573 Int* idx2DepthValue( Int layerIdInVps ) { return m_iIdx2DepthValue[layerIdInVps]; }1574 Void getDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTOut, UInt *puiDeltaDLTOutNum );1575 Void setDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTIn, UInt uiDeltaDLTInNum );1576 #endif1577 };1578 #endif1579 1394 1580 1395 class Window … … 1833 1648 Bool m_useAMP; 1834 1649 1835 #if !MTK_I0099_VPS_EX21836 #if H_3D_QTLPC1837 Bool m_bUseQTL;1838 Bool m_bUsePC;1839 #endif1840 #endif1841 1650 // Parameter 1842 1651 Int m_bitDepthY; … … 1888 1697 Bool m_spsRangeExtensionsFlag; 1889 1698 Bool m_spsMultilayerExtensionFlag; 1890 #if H_3D1891 Bool m_sps3dExtensionFlag;1892 Int m_spsExtension5bits;1893 #else1894 1699 Int m_spsExtension6bits; 1895 #endif1896 1700 1897 1701 Bool m_spsInferScalingListFlag; … … 1909 1713 Int m_scaledRefLayerBottomOffset[MAX_NUM_LAYERS]; 1910 1714 #endif 1911 #endif1912 #if H_3D1913 UInt m_uiCamParPrecision;1914 Bool m_bCamParInSliceHeader;1915 Int m_aaiCodedScale [2][MAX_NUM_LAYERS];1916 Int m_aaiCodedOffset[2][MAX_NUM_LAYERS];1917 1715 #endif 1918 1716 #if H_MV … … 2064 1862 Void setSpsMultilayerExtensionFlag( Bool flag ) { m_spsMultilayerExtensionFlag = flag; } 2065 1863 Bool getSpsMultilayerExtensionFlag( ) { return m_spsMultilayerExtensionFlag; } 2066 #if H_3D2067 Void setSps3dExtensionFlag( Bool flag ) { m_sps3dExtensionFlag = flag; }2068 Bool getSps3dExtensionFlag( ) { return m_sps3dExtensionFlag; }2069 2070 Void setSpsExtension5bits( Int val ) { m_spsExtension5bits = val; }2071 Int getSpsExtension5bits( ) { return m_spsExtension5bits; }2072 #else2073 1864 Void setSpsExtension6bits( Int val ) { m_spsExtension6bits = val; } 2074 1865 Int getSpsExtension6bits( ) { return m_spsExtension6bits; } 2075 #endif2076 1866 2077 1867 Void setVPS ( TComVPS* pcVPS ) { m_pcVPS = pcVPS; } … … 2119 1909 Void checkRpsMaxNumPics( TComVPS* vps, Int currLayerId ); 2120 1910 2121 #endif2122 #if !MTK_I0099_VPS_EX22123 #if H_3D_QTLPC2124 Void setUseQTL( Bool b ) { m_bUseQTL = b; }2125 Bool getUseQTL() { return m_bUseQTL; }2126 Void setUsePC ( Bool b ) { m_bUsePC = b; }2127 Bool getUsePC () { return m_bUsePC; }2128 #endif2129 1911 #endif 2130 1912 #if H_MV … … 2234 2016 Bool m_ppsRangeExtensionsFlag; 2235 2017 Bool m_ppsMultilayerExtensionFlag; 2236 #if !H_3D2237 2018 Int m_ppsExtension6bits; 2238 #else2239 Bool m_pps3dExtensionFlag;2240 Int m_ppsExtension5bits;2241 #endif2242 2019 2243 2020 Bool m_pocResetInfoPresentFlag; 2244 2021 #endif 2245 2022 2246 #if H_3D2247 TComDLT* m_pcDLT;2248 #endif2249 2023 2250 2024 public: … … 2273 2047 UInt getMinCuDQPSize () { return m_uiMinCuDQPSize; } 2274 2048 2275 #if H_3D2276 Void setDLT ( TComDLT* pcDLT ) { m_pcDLT = pcDLT; }2277 TComDLT* getDLT () { return m_pcDLT; }2278 #endif2279 2049 2280 2050 Void setChromaCbQpOffset( Int i ) { m_chromaCbQpOffset = i; } … … 2390 2160 Bool getPpsMultilayerExtensionFlag( ) { return m_ppsMultilayerExtensionFlag; } 2391 2161 2392 #if !H_3D2393 2162 Void setPpsExtension6bits( Int val ) { m_ppsExtension6bits = val; } 2394 2163 Int getPpsExtension6bits( ) { return m_ppsExtension6bits; } 2395 #else2396 Void setPps3dExtensionFlag( Bool flag ) { m_pps3dExtensionFlag = flag; }2397 Bool getPps3dExtensionFlag( ) { return m_pps3dExtensionFlag; }2398 2399 Void setPpsExtension5bits( Int val ) { m_ppsExtension5bits = val; }2400 Int getPpsExtension5bits( ) { return m_ppsExtension5bits; }2401 #endif2402 2164 2403 2165 Void setPocResetInfoPresentFlag( Bool flag ) { m_pocResetInfoPresentFlag = flag; } … … 2547 2309 Int m_viewId; 2548 2310 Int m_viewIndex; 2549 #if H_3D2550 Bool m_isDepth;2551 #endif2552 2311 2553 2312 // Additional slice header syntax elements … … 2570 2329 Bool m_pocMsbValRequiredFlag; 2571 2330 2572 #if H_3D 2573 Int m_aaiCodedScale [2][MAX_NUM_LAYERS]; 2574 Int m_aaiCodedOffset[2][MAX_NUM_LAYERS]; 2575 #endif 2576 #if H_3D_TMVP 2577 Int m_aiAlterRefIdx [2]; 2578 #endif 2579 #if H_3D_ARP 2580 Bool m_arpRefPicAvailable[2][MAX_NUM_LAYERS]; 2581 TComList<TComPic*> * m_pBaseViewRefPicList[MAX_NUM_LAYERS]; 2582 UInt m_nARPStepNum; 2583 Int m_aiFirstTRefIdx [2]; 2584 #endif 2585 #if H_3D_IC 2586 Bool m_bApplyIC; 2587 Bool m_icSkipParseFlag; 2588 #endif 2589 #if H_3D 2590 TComPic* m_ivPicsCurrPoc [2][MAX_NUM_LAYERS]; 2591 Int** m_depthToDisparityB; 2592 Int** m_depthToDisparityF; 2593 #endif 2594 #endif 2595 2596 #if H_3D_DDD 2597 Int m_aiDDDInvScale [MAX_NUM_LAYERS]; 2598 Int m_aiDDDInvOffset[MAX_NUM_LAYERS]; 2599 UInt m_aiDDDShift [MAX_NUM_LAYERS]; 2600 #endif 2601 #if MTK_SINGLE_DEPTH_MODE_I0095 2602 Bool m_bApplySingleDepthMode; 2603 #endif 2604 #if MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX 2605 Int *m_aICEnableCandidate; 2606 Int *m_aICEnableNum; 2607 #endif 2331 #endif 2332 2608 2333 public: 2609 2334 TComSlice(); … … 2670 2395 TComPic* getRefPic ( RefPicList e, Int iRefIdx) { return m_apcRefPicList[e][iRefIdx]; } 2671 2396 Int getRefPOC ( RefPicList e, Int iRefIdx) { return m_aiRefPOCList[e][iRefIdx]; } 2672 #if H_3D2673 TComPic* getIvPic ( Bool depthFlag, Int viewIndex){ return m_ivPicsCurrPoc[ depthFlag ? 1 : 0 ][ viewIndex ]; }2674 #endif2675 #if H_3D2676 TComPic* getTexturePic () { return m_ivPicsCurrPoc[0][ m_viewIndex ]; }2677 #endif2678 #if MTK_SINGLE_DEPTH_MODE_I00952679 Void setApplySingleDepthMode( Bool b ) { m_bApplySingleDepthMode = b; }2680 Bool getApplySingleDepthMode() { return m_bApplySingleDepthMode; }2681 #endif2682 #if H_3D_IC2683 Void setApplyIC( Bool b ) { m_bApplyIC = b; }2684 Bool getApplyIC() { return m_bApplyIC; }2685 Void xSetApplyIC();2686 Void xSetApplyIC(Bool bUseLowLatencyICEnc);2687 Void setIcSkipParseFlag( Bool b ) { m_icSkipParseFlag = b; }2688 Bool getIcSkipParseFlag() { return m_icSkipParseFlag; }2689 #endif2690 #if H_3D_ARP2691 Void setBaseViewRefPicList( TComList<TComPic*> *pListPic, Int iViewIdx ) { m_pBaseViewRefPicList[iViewIdx] = pListPic; }2692 Void setARPStepNum( TComPicLists*ivPicLists );2693 TComPic* getBaseViewRefPic ( UInt uiPOC , Int iViewIdx ) { return xGetRefPic( *m_pBaseViewRefPicList[iViewIdx], uiPOC ); }2694 UInt getARPStepNum( ) { return m_nARPStepNum; }2695 #endif2696 2397 Int getDepth () { return m_iDepth; } 2697 2398 UInt getColFromL0Flag () { return m_colFromL0Flag; } … … 2890 2591 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; } 2891 2592 Int getViewIndex () { return m_viewIndex; } 2892 #if H_3D2893 #if H_3D_TMVP2894 Void generateAlterRefforTMVP ();2895 Void setAlterRefIdx ( RefPicList e, Int i ) { m_aiAlterRefIdx[e] = i; }2896 Int getAlterRefIdx ( RefPicList e ) { return m_aiAlterRefIdx[e]; }2897 #endif2898 #if H_3D_ARP2899 Int getFirstTRefIdx ( RefPicList e ) { return m_aiFirstTRefIdx[e]; }2900 Void setFirstTRefIdx ( RefPicList e, Int i ) { m_aiFirstTRefIdx[e] = i; }2901 Bool getArpRefPicAvailable( RefPicList e, Int viewIdx) {return m_arpRefPicAvailable[e][getVPS()->getLayerIdInNuh(viewIdx, 0)]; }2902 #endif2903 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; }2904 Bool getIsDepth () { return m_isDepth; }2905 Void setCamparaSlice ( Int** aaiScale = 0, Int** aaiOffset = 0 );2906 Int* getCodedScale () { return m_aaiCodedScale [0]; }2907 Int* getCodedOffset () { return m_aaiCodedOffset[0]; }2908 Int* getInvCodedScale () { return m_aaiCodedScale [1]; }2909 Int* getInvCodedOffset () { return m_aaiCodedOffset[1]; }2910 #endif2911 #endif2912 #if H_3D2913 Void setIvPicLists( TComPicLists* m_ivPicLists );2914 Void setDepthToDisparityLUTs();2915 2916 Int* getDepthToDisparityB( Int refViewIdx ) { return m_depthToDisparityB[ refViewIdx ]; };2917 Int* getDepthToDisparityF( Int refViewIdx ) { return m_depthToDisparityF[ refViewIdx ]; };2918 Bool getVpsDepthModesFlag () { return getVPS()->getVpsDepthModesFlag( getVPS()->getLayerIdInVps( m_layerId ) ); }2919 #if SEPARATE_FLAG_I00852920 Bool getIVPFlag () { return getVPS()->getIVPFlag( getVPS()->getLayerIdInVps( m_layerId ) ); }2921 #endif2922 #endif2923 #if MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX2924 Void setICEnableCandidate( Int* ICEnableCandidate) { m_aICEnableCandidate = ICEnableCandidate; };2925 Void setICEnableNum( Int* ICEnableNum) { m_aICEnableNum = ICEnableNum; };2926 Void setICEnableCandidate( UInt layer, Int value) { m_aICEnableCandidate[ layer ] = value; };2927 Void setICEnableNum( UInt layer, Int value) { m_aICEnableNum[ layer ] = value; };2928 2929 Int getICEnableCandidate( Int layer){ return m_aICEnableCandidate[ layer ]; };2930 Int getICEnableNum( Int layer){ return m_aICEnableNum[ layer ]; };2931 2593 #endif 2932 2594 #if H_MV … … 3015 2677 Bool inferPocMsbValPresentFlag(); 3016 2678 #endif 3017 #if H_3D_DDD3018 Void initializeDDDPara( UInt uiCamParsCodedPrecision, Int iCodedScale,Int iCodedOffset, Int iBaseViewIdx );3019 Int getDepthFromDV( Int iDV, Int iBaseViewIdx );3020 #endif3021 2679 3022 2680 protected: -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComWedgelet.cpp
r1039 r1072 45 45 using namespace std; 46 46 47 #if H_3D_DIM_DMM48 TComWedgelet::TComWedgelet( UInt uiWidth, UInt uiHeight ) : m_uhXs ( 0 ),49 m_uhYs ( 0 ),50 m_uhXe ( 0 ),51 m_uhYe ( 0 ),52 m_uhOri ( 0 ),53 m_eWedgeRes( FULL_PEL ),54 m_bIsCoarse( false )55 {56 create( uiWidth, uiHeight );57 }58 59 TComWedgelet::TComWedgelet( const TComWedgelet &rcWedge ) : m_uhXs ( rcWedge.m_uhXs ),60 m_uhYs ( rcWedge.m_uhYs ),61 m_uhXe ( rcWedge.m_uhXe ),62 m_uhYe ( rcWedge.m_uhYe ),63 m_uhOri ( rcWedge.m_uhOri ),64 m_eWedgeRes( rcWedge.m_eWedgeRes ),65 m_bIsCoarse( rcWedge.m_bIsCoarse ),66 m_uiAng ( rcWedge.m_uiAng ),67 m_uiWidth ( rcWedge.m_uiWidth ),68 m_uiHeight ( rcWedge.m_uiHeight ),69 m_pbPattern( (Bool*)xMalloc( Bool, (m_uiWidth * m_uiHeight) ) )70 #if SHARP_DMM1_I011071 ,m_pbScaledPattern( g_wedgePattern )72 #endif73 {74 ::memcpy( m_pbPattern, rcWedge.m_pbPattern, sizeof(Bool) * (m_uiWidth * m_uiHeight));75 }76 77 TComWedgelet::~TComWedgelet(void)78 {79 destroy();80 }81 82 Void TComWedgelet::create( UInt uiWidth, UInt uiHeight )83 {84 assert( uiWidth > 0 && uiHeight > 0 );85 86 m_uiWidth = uiWidth;87 m_uiHeight = uiHeight;88 89 m_pbPattern = (Bool*)xMalloc( Bool, (m_uiWidth * m_uiHeight) );90 #if SHARP_DMM1_I011091 m_pbScaledPattern = g_wedgePattern;92 #endif93 }94 95 Void TComWedgelet::destroy()96 {97 if( m_pbPattern ) { xFree( m_pbPattern ); m_pbPattern = NULL; }98 }99 100 Void TComWedgelet::clear()101 {102 ::memset( m_pbPattern, 0, (m_uiWidth * m_uiHeight) * sizeof(Bool) );103 }104 105 Void TComWedgelet::findClosestAngle()106 {107 UInt uiAng=0,uiOptAng=0;108 UInt uiMinD=MAX_UINT;109 UInt uiTmpD=0;110 Int angTable[9] = {0, 2, 5, 9, 13, 17, 21, 26, 32};111 112 UChar uhXs = m_uhXs;113 UChar uhYs = m_uhYs;114 UChar uhXe = m_uhXe;115 UChar uhYe = m_uhYe;116 117 for(uiAng=2; uiAng<=34; uiAng++)118 {119 Int iSign = (uiAng<VER_IDX && uiAng>HOR_IDX ) ? -1 : 1;120 Int iVer = uiAng>17 ? 32 : angTable[(uiAng>10) ? (uiAng-10) : (10-uiAng)];121 Int iHor = uiAng<19 ? 32 : angTable[(uiAng>26) ? (uiAng-26) : (26-uiAng)];122 123 uiTmpD = abs(iVer*iSign*(uhXs-uhXe) - iHor*(uhYe-uhYs));124 125 if( uiTmpD < uiMinD )126 {127 uiMinD = uiTmpD;128 uiOptAng = uiAng;129 }130 }131 m_uiAng = uiOptAng;132 }133 134 Void TComWedgelet::setWedgelet( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, UChar uhOri, WedgeResolution eWedgeRes, Bool bIsCoarse )135 {136 m_uhXs = uhXs;137 m_uhYs = uhYs;138 m_uhXe = uhXe;139 m_uhYe = uhYe;140 m_uhOri = uhOri;141 m_eWedgeRes = eWedgeRes;142 m_bIsCoarse = bIsCoarse;143 144 xGenerateWedgePattern();145 }146 147 Bool TComWedgelet::checkNotPlain()148 {149 for( UInt k = 1; k < (m_uiWidth * m_uiHeight); k++ )150 {151 if( m_pbPattern[0] != m_pbPattern[k] )152 {153 return true;154 }155 }156 return false;157 }158 159 Bool TComWedgelet::checkIdentical( Bool* pbRefPattern )160 {161 for( UInt k = 0; k < (m_uiWidth * m_uiHeight); k++ )162 {163 if( m_pbPattern[k] != pbRefPattern[k] )164 {165 return false;166 }167 }168 return true;169 }170 171 Bool TComWedgelet::checkInvIdentical( Bool* pbRefPattern )172 {173 for( UInt k = 0; k < (m_uiWidth * m_uiHeight); k++ )174 {175 if( m_pbPattern[k] == pbRefPattern[k] )176 {177 return false;178 }179 }180 return true;181 }182 183 Void TComWedgelet::xGenerateWedgePattern()184 {185 UInt uiTempBlockSize = 0;186 UChar uhXs = 0, uhYs = 0, uhXe = 0, uhYe = 0;187 switch( m_eWedgeRes )188 {189 #if !SHARP_DMM1_I0110190 case( DOUBLE_PEL ): { uiTempBlockSize = m_uiWidth; uhXs = (m_uhXs<<1); uhYs = (m_uhYs<<1); uhXe = (m_uhXe<<1); uhYe = (m_uhYe<<1); } break;191 #endif192 case( FULL_PEL ): { uiTempBlockSize = m_uiWidth; uhXs = m_uhXs; uhYs = m_uhYs; uhXe = m_uhXe; uhYe = m_uhYe; } break;193 case( HALF_PEL ): { uiTempBlockSize = (m_uiWidth<<1); uhXs = m_uhXs; uhYs = m_uhYs; uhXe = m_uhXe; uhYe = m_uhYe; } break;194 }195 196 #if !SHARP_DMM1_I0110197 if( m_eWedgeRes == DOUBLE_PEL) // adjust line-end for DOUBLE_PEL resolution198 {199 if( m_uhOri == 1 ) { uhXs = uiTempBlockSize-1; }200 if( m_uhOri == 2 ) { uhXe = uiTempBlockSize-1; uhYs = uiTempBlockSize-1; }201 if( m_uhOri == 3 ) { uhYe = uiTempBlockSize-1; }202 if( m_uhOri == 4 ) { uhYe = uiTempBlockSize-1; }203 if( m_uhOri == 5 ) { uhXs = uiTempBlockSize-1; }204 }205 #endif206 207 Bool* pbTempPattern = new Bool[ (uiTempBlockSize * uiTempBlockSize) ];208 ::memset( pbTempPattern, 0, (uiTempBlockSize * uiTempBlockSize) * sizeof(Bool) );209 Int iTempStride = uiTempBlockSize;210 211 xDrawEdgeLine( uhXs, uhYs, uhXe, uhYe, pbTempPattern, iTempStride );212 213 switch( m_uhOri )214 {215 case( 0 ): { for( UInt iX = 0; iX < uhXs; iX++ ) { UInt iY = 0; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iY++; } } } break;216 case( 1 ): { for( UInt iY = 0; iY < uhYs; iY++ ) { UInt iX = uiTempBlockSize-1; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iX--; } } } break;217 case( 2 ): { for( UInt iX = uiTempBlockSize-1; iX > uhXs; iX-- ) { UInt iY = uiTempBlockSize-1; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iY--; } } } break;218 case( 3 ): { for( UInt iY = uiTempBlockSize-1; iY > uhYs; iY-- ) { UInt iX = 0; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iX++; } } } break;219 case( 4 ):220 {221 if( (uhXs+uhXe) < uiTempBlockSize ) { for( UInt iY = 0; iY < uiTempBlockSize; iY++ ) { UInt iX = 0; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iX++; } } }222 else { for( UInt iY = 0; iY < uiTempBlockSize; iY++ ) { UInt iX = uiTempBlockSize-1; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iX--; } } }223 }224 break;225 case( 5 ):226 {227 if( (uhYs+uhYe) < uiTempBlockSize ) { for( UInt iX = 0; iX < uiTempBlockSize; iX++ ) { UInt iY = 0; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iY++; } } }228 else { for( UInt iX = 0; iX < uiTempBlockSize; iX++ ) { UInt iY = uiTempBlockSize-1; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iY--; } } }229 }230 }231 232 clear();233 switch( m_eWedgeRes )234 {235 #if !SHARP_DMM1_I0110236 case( DOUBLE_PEL ): { for( UInt k = 0; k < (m_uiWidth * m_uiHeight); k++ ) { m_pbPattern[k] = pbTempPattern[k]; }; } break;237 #endif238 case( FULL_PEL ): { for( UInt k = 0; k < (m_uiWidth * m_uiHeight); k++ ) { m_pbPattern[k] = pbTempPattern[k]; }; } break;239 case( HALF_PEL ): // sub-sampling by factor 2240 {241 Int iStride = getStride();242 243 UInt uiOffX, uiOffY;244 switch( m_uhOri )245 {246 case( 0 ): { uiOffX = 0; uiOffY = 0; } break;247 case( 1 ): { uiOffX = 1; uiOffY = 0; } break;248 case( 2 ): { uiOffX = 1; uiOffY = 1; } break;249 case( 3 ): { uiOffX = 0; uiOffY = 1; } break;250 case( 4 ):251 {252 if( (uhXs+uhXe) < uiTempBlockSize ) { uiOffX = 0; uiOffY = 0; }253 else { uiOffX = 1; uiOffY = 0; }254 }255 break;256 case( 5 ):257 {258 if( (uhYs+uhYe) < uiTempBlockSize ) { uiOffX = 0; uiOffY = 0; }259 else { uiOffX = 0; uiOffY = 1; }260 }261 break;262 default: { uiOffX = 0; uiOffY = 0; } break;263 }264 265 for(Int iY = 0; iY < m_uiHeight; iY++)266 {267 for(Int iX = 0; iX < m_uiWidth; iX++)268 {269 m_pbPattern[(iY * iStride) + iX] = pbTempPattern[(((iY<<1)+uiOffY) * iTempStride) + ((iX<<1)+uiOffX)];270 }271 }272 }273 break;274 }275 276 if( pbTempPattern )277 {278 delete [] pbTempPattern;279 pbTempPattern = NULL;280 }281 }282 283 Void TComWedgelet::xDrawEdgeLine( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, Bool* pbPattern, Int iPatternStride )284 {285 Int x0 = (Int)uhXs;286 Int y0 = (Int)uhYs;287 Int x1 = (Int)uhXe;288 Int y1 = (Int)uhYe;289 290 // direction independent Bresenham line291 bool steep = (abs(y1 - y0) > abs(x1 - x0));292 if( steep )293 {294 std::swap( x0, y0 );295 std::swap( x1, y1 );296 }297 298 bool backward = ( x0 > x1 );299 if( backward )300 {301 std::swap( x0, x1 );302 std::swap( y0, y1 );303 }304 305 Int deltax = x1 - x0;306 Int deltay = abs(y1 - y0);307 Int error = 0;308 Int deltaerr = (deltay<<1);309 310 Int ystep;311 Int y = y0;312 if( y0 < y1 ) ystep = 1;313 else ystep = -1;314 315 for( Int x = x0; x <= x1; x++ )316 {317 if( steep ) { pbPattern[(x * iPatternStride) + y] = true; }318 else { pbPattern[(y * iPatternStride) + x] = true; }319 320 error += deltaerr;321 if( error >= deltax )322 {323 y += ystep;324 error = error - (deltax<<1);325 }326 }327 }328 329 #if SHARP_DMM1_I0110330 Bool* TComWedgelet::getScaledPattern(UInt uiDstSize)331 {332 Bool *pbSrcPat = this->getPattern();333 UInt uiSrcSize = this->getStride();334 335 Int scale = (g_aucConvertToBit[uiDstSize] - g_aucConvertToBit[uiSrcSize]);336 assert(scale>=0);337 for (Int y=0; y<uiDstSize; y++)338 {339 for (Int x=0; x<uiDstSize; x++)340 {341 Int srcX = x>>scale;342 Int srcY = y>>scale;343 m_pbScaledPattern[y*uiDstSize + x] = pbSrcPat[ srcY*uiSrcSize + srcX ];344 }345 }346 return m_pbScaledPattern;347 }348 #endif349 350 TComWedgeNode::TComWedgeNode()351 {352 m_uiPatternIdx = DMM_NO_WEDGEINDEX;353 for( UInt uiPos = 0; uiPos < DMM_NUM_WEDGE_REFINES; uiPos++ )354 {355 m_uiRefineIdx[uiPos] = DMM_NO_WEDGEINDEX;356 }357 }358 359 UInt TComWedgeNode::getPatternIdx()360 {361 return m_uiPatternIdx;362 }363 UInt TComWedgeNode::getRefineIdx( UInt uiPos )364 {365 assert( uiPos < DMM_NUM_WEDGE_REFINES );366 return m_uiRefineIdx[uiPos];367 }368 Void TComWedgeNode::setPatternIdx( UInt uiIdx )369 {370 m_uiPatternIdx = uiIdx;371 }372 Void TComWedgeNode::setRefineIdx( UInt uiIdx, UInt uiPos )373 {374 assert( uiPos < DMM_NUM_WEDGE_REFINES );375 m_uiRefineIdx[uiPos] = uiIdx;376 }377 #endif //H_3D_DIM_DMM -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComWedgelet.h
r1039 r1072 43 43 #include <vector> 44 44 45 #if H_3D_DIM46 #define DIM_OFFSET (NUM_INTRA_MODE+1) // offset for DMM and RBC mode numbers (PM: not consistent with spec, but non-overlapping with chroma, see DM_CHROMA_IDX)47 #define DIM_MIN_SIZE 4 // min. block size for DMM and RBC modes48 #define DIM_MAX_SIZE 32 // max. block size for DMM and RBC modes49 45 50 enum DIM_IDX51 {52 DMM1_IDX = 0,53 DMM4_IDX = 1,54 };55 56 #define DMM_NUM_TYPE 257 #define DIM_NUM_TYPE (DMM_NUM_TYPE)58 #define DIM_NO_IDX MAX_UINT59 60 #if HS_DMM_SIGNALLING_I012061 __inline UInt getDimType ( Int intraMode )62 {63 Int dimType = intraMode-DIM_OFFSET;64 return (dimType >= 0 && dimType < DIM_NUM_TYPE) ? (UInt)dimType : DIM_NO_IDX;65 }66 #else67 __inline UInt getDimType ( Int intraMode ) { Int dimType = (intraMode-DIM_OFFSET)/2; return (dimType >= 0 && dimType < DIM_NUM_TYPE) ? (UInt)dimType : DIM_NO_IDX; }68 #endif69 __inline Bool isDimMode ( Int intraMode ) { return (getDimType( intraMode ) < DIM_NUM_TYPE); }70 #if !HS_DMM_SIGNALLING_I012071 __inline Bool isDimDeltaDC( Int intraMode ) { return (isDimMode( intraMode ) && ((intraMode-DIM_OFFSET)%2) == 1); }72 #endif73 #endif74 75 #if H_3D_DIM_DMM76 #define DMM_NO_WEDGEINDEX MAX_UINT77 #define DMM_NUM_WEDGE_REFINES 878 79 enum WedgeResolution80 {81 #if !SHARP_DMM1_I011082 DOUBLE_PEL,83 #endif84 FULL_PEL,85 HALF_PEL86 };87 88 89 // ====================================================================================================================90 // Class definition TComWedgelet91 // ====================================================================================================================92 class TComWedgelet93 {94 private:95 UChar m_uhXs; // line start X pos96 UChar m_uhYs; // line start Y pos97 UChar m_uhXe; // line end X pos98 UChar m_uhYe; // line end Y pos99 UChar m_uhOri; // orientation index100 WedgeResolution m_eWedgeRes; // start/end pos resolution101 Bool m_bIsCoarse;102 UInt m_uiAng;103 104 UInt m_uiWidth;105 UInt m_uiHeight;106 107 Bool* m_pbPattern;108 #if SHARP_DMM1_I0110109 Bool* m_pbScaledPattern;110 #endif111 112 Void xGenerateWedgePattern();113 Void xDrawEdgeLine( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, Bool* pbPattern, Int iPatternStride );114 115 public:116 TComWedgelet( UInt uiWidth, UInt uiHeight );117 TComWedgelet( const TComWedgelet &rcWedge );118 virtual ~TComWedgelet();119 120 Void create ( UInt iWidth, UInt iHeight ); ///< create wedgelet pattern121 Void destroy(); ///< destroy wedgelet pattern122 Void clear (); ///< clear wedgelet pattern123 124 UInt getWidth () { return m_uiWidth; }125 UInt getStride () { return m_uiWidth; }126 UInt getHeight () { return m_uiHeight; }127 WedgeResolution getWedgeRes() { return m_eWedgeRes; }128 Bool* getPattern () { return m_pbPattern; }129 UChar getStartX () { return m_uhXs; }130 UChar getStartY () { return m_uhYs; }131 UChar getEndX () { return m_uhXe; }132 UChar getEndY () { return m_uhYe; }133 UChar getOri () { return m_uhOri; }134 Bool getIsCoarse() { return m_bIsCoarse; }135 UInt getAng () { return m_uiAng; }136 #if SHARP_DMM1_I0110137 Bool* getScaledPattern(UInt uiWidth);138 #endif139 140 Void setWedgelet( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, UChar uhOri, WedgeResolution eWedgeRes, Bool bIsCoarse = false );141 Void findClosestAngle();142 143 Bool checkNotPlain();144 Bool checkIdentical( Bool* pbRefPattern );145 Bool checkInvIdentical( Bool* pbRefPattern );146 147 }; // END CLASS DEFINITION TComWedgelet148 149 // type definition wedgelet pattern list150 typedef std::vector<TComWedgelet> WedgeList;151 152 // ====================================================================================================================153 // Class definition TComWedgeRef154 // ====================================================================================================================155 class TComWedgeRef156 {157 private:158 UChar m_uhXs; // line start X pos159 UChar m_uhYs; // line start Y pos160 UChar m_uhXe; // line end X pos161 UChar m_uhYe; // line end Y pos162 UInt m_uiRefIdx; // index of corresponding pattern of TComWedgelet object in wedge list163 164 public:165 TComWedgeRef() {}166 virtual ~TComWedgeRef() {}167 168 UChar getStartX () { return m_uhXs; }169 UChar getStartY () { return m_uhYs; }170 UChar getEndX () { return m_uhXe; }171 UChar getEndY () { return m_uhYe; }172 UInt getRefIdx () { return m_uiRefIdx; }173 174 Void setWedgeRef( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, UInt uiRefIdx ) { m_uhXs = uhXs; m_uhYs = uhYs; m_uhXe = uhXe; m_uhYe = uhYe; m_uiRefIdx = uiRefIdx; }175 }; // END CLASS DEFINITION TComWedgeRef176 177 // type definition wedgelet reference list178 typedef std::vector<TComWedgeRef> WedgeRefList;179 180 // ====================================================================================================================181 // Class definition TComWedgeNode182 // ====================================================================================================================183 class TComWedgeNode184 {185 private:186 UInt m_uiPatternIdx;187 UInt m_uiRefineIdx[DMM_NUM_WEDGE_REFINES];188 189 public:190 TComWedgeNode();191 virtual ~TComWedgeNode() {}192 193 UInt getPatternIdx();194 UInt getRefineIdx ( UInt uiPos );195 196 Void setPatternIdx( UInt uiIdx );197 Void setRefineIdx ( UInt uiIdx, UInt uiPos );198 }; // END CLASS DEFINITION TComWedgeNode199 200 // type definition wedgelet node list201 typedef std::vector<TComWedgeNode> WedgeNodeList;202 #endif //H_3D_DIM_DMM203 46 204 47 -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComYuv.cpp
r1039 r1072 647 647 } 648 648 } 649 #if H_3D650 Void TComYuv::addClipPartLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )651 {652 Int x, y;653 654 Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiTrUnitIdx);655 Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiTrUnitIdx);656 Pel* pDst = getLumaAddr( uiTrUnitIdx);657 658 UInt iSrc0Stride = pcYuvSrc0->getStride();659 UInt iSrc1Stride = pcYuvSrc1->getStride();660 UInt iDstStride = getStride();661 for ( y = uiPartSize-1; y >= 0; y-- )662 {663 for ( x = uiPartSize-1; x >= 0; x-- )664 {665 pDst[x] = ClipY( pSrc0[x] + pSrc1[x] );666 }667 pSrc0 += iSrc0Stride;668 pSrc1 += iSrc1Stride;669 pDst += iDstStride;670 }671 }672 673 #if H_3D_ARP674 Void TComYuv::addARP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip )675 {676 addARPLuma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth , uiHeight , bClip );677 addARPChroma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1, uiHeight>>1 , bClip );678 }679 680 Void TComYuv::addARPLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip )681 {682 Int x, y;683 684 Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiAbsPartIdx );685 Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiAbsPartIdx );686 Pel* pDst = getLumaAddr( uiAbsPartIdx );687 688 UInt iSrc0Stride = pcYuvSrc0->getStride();689 UInt iSrc1Stride = pcYuvSrc1->getStride();690 UInt iDstStride = getStride();691 #if QC_I0129_ARP_FIX692 Int iIFshift = IF_INTERNAL_PREC - g_bitDepthY;693 Int iOffSet = ( 1 << ( iIFshift - 1 ) ) + IF_INTERNAL_OFFS;694 #endif695 for ( y = uiHeight-1; y >= 0; y-- )696 {697 for ( x = uiWidth-1; x >= 0; x-- )698 {699 pDst[x] = pSrc0[x] + pSrc1[x];700 if( bClip )701 {702 #if QC_I0129_ARP_FIX703 pDst[x] = ClipY( ( pDst[x] + iOffSet ) >> iIFshift );704 #else705 pDst[x] = ClipY( pDst[x] );706 #endif707 }708 }709 pSrc0 += iSrc0Stride;710 pSrc1 += iSrc1Stride;711 pDst += iDstStride;712 }713 }714 715 Void TComYuv::addARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip )716 {717 Int x, y;718 719 Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiAbsPartIdx );720 Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiAbsPartIdx );721 Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiAbsPartIdx );722 Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiAbsPartIdx );723 Pel* pDstU = getCbAddr( uiAbsPartIdx );724 Pel* pDstV = getCrAddr( uiAbsPartIdx );725 726 UInt iSrc0Stride = pcYuvSrc0->getCStride();727 UInt iSrc1Stride = pcYuvSrc1->getCStride();728 UInt iDstStride = getCStride();729 #if QC_I0129_ARP_FIX730 Int iIFshift = IF_INTERNAL_PREC - g_bitDepthC;731 Int iOffSet = ( 1 << ( iIFshift - 1 ) ) + IF_INTERNAL_OFFS;732 #endif733 for ( y = uiHeight-1; y >= 0; y-- )734 {735 for ( x = uiWidth-1; x >= 0; x-- )736 {737 pDstU[x] = pSrcU0[x] + pSrcU1[x];738 pDstV[x] = pSrcV0[x] + pSrcV1[x];739 if( bClip )740 {741 #if QC_I0129_ARP_FIX742 pDstU[x] = ClipC( ( pDstU[x] + iOffSet ) >> iIFshift );743 pDstV[x] = ClipC( ( pDstV[x] + iOffSet ) >> iIFshift );744 #else745 pDstU[x] = ClipC( pDstU[x] );746 pDstV[x] = ClipC( pDstV[x] );747 #endif748 }749 }750 751 pSrcU0 += iSrc0Stride;752 pSrcU1 += iSrc1Stride;753 pSrcV0 += iSrc0Stride;754 pSrcV1 += iSrc1Stride;755 pDstU += iDstStride;756 pDstV += iDstStride;757 }758 }759 760 Void TComYuv::subtractARP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )761 {762 subtractARPLuma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth , uiHeight );763 #if SHARP_ARP_CHROMA_I0104764 if (uiWidth > 8)765 #endif766 subtractARPChroma( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1 , uiHeight>>1 );767 }768 769 Void TComYuv::subtractARPLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )770 {771 Int x, y;772 773 Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiAbsPartIdx );774 Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiAbsPartIdx );775 Pel* pDst = getLumaAddr( uiAbsPartIdx );776 777 Int iSrc0Stride = pcYuvSrc0->getStride();778 Int iSrc1Stride = pcYuvSrc1->getStride();779 Int iDstStride = getStride();780 for ( y = uiHeight-1; y >= 0; y-- )781 {782 for ( x = uiWidth-1; x >= 0; x-- )783 {784 pDst[x] = pSrc0[x] - pSrc1[x];785 }786 pSrc0 += iSrc0Stride;787 pSrc1 += iSrc1Stride;788 pDst += iDstStride;789 }790 }791 792 Void TComYuv::subtractARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )793 {794 Int x, y;795 796 Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiAbsPartIdx );797 Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiAbsPartIdx );798 Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiAbsPartIdx );799 Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiAbsPartIdx );800 Pel* pDstU = getCbAddr( uiAbsPartIdx );801 Pel* pDstV = getCrAddr( uiAbsPartIdx );802 803 Int iSrc0Stride = pcYuvSrc0->getCStride();804 Int iSrc1Stride = pcYuvSrc1->getCStride();805 Int iDstStride = getCStride();806 for ( y = uiHeight-1; y >= 0; y-- )807 {808 for ( x = uiWidth-1; x >= 0; x-- )809 {810 pDstU[x] = pSrcU0[x] - pSrcU1[x];811 pDstV[x] = pSrcV0[x] - pSrcV1[x];812 }813 pSrcU0 += iSrc0Stride;814 pSrcU1 += iSrc1Stride;815 pSrcV0 += iSrc0Stride;816 pSrcV1 += iSrc1Stride;817 pDstU += iDstStride;818 pDstV += iDstStride;819 }820 }821 822 Void TComYuv::multiplyARP( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )823 {824 multiplyARPLuma( uiAbsPartIdx , uiWidth , uiHeight , dW );825 #if SHARP_ARP_CHROMA_I0104826 if (uiWidth > 8)827 #endif828 multiplyARPChroma( uiAbsPartIdx , uiWidth >> 1 , uiHeight >> 1 , dW );829 }830 831 Void TComYuv::xxMultiplyLine( Pel* pSrcDst , UInt uiWidth , UChar dW )832 {833 assert( dW == 2 );834 for( UInt x = 0 ; x < uiWidth ; x++ )835 pSrcDst[x] = pSrcDst[x] >> 1;836 }837 838 Void TComYuv::multiplyARPLuma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )839 {840 Pel* pDst = getLumaAddr( uiAbsPartIdx );841 Int iDstStride = getStride();842 for ( Int y = uiHeight-1; y >= 0; y-- )843 {844 xxMultiplyLine( pDst , uiWidth , dW );845 pDst += iDstStride;846 }847 }848 849 Void TComYuv::multiplyARPChroma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )850 {851 Pel* pDstU = getCbAddr( uiAbsPartIdx );852 Pel* pDstV = getCrAddr( uiAbsPartIdx );853 854 Int iDstStride = getCStride();855 for ( Int y = uiHeight-1; y >= 0; y-- )856 {857 xxMultiplyLine( pDstU , uiWidth , dW );858 xxMultiplyLine( pDstV , uiWidth , dW );859 pDstU += iDstStride;860 pDstV += iDstStride;861 }862 }863 #endif864 #endif865 649 866 650 //! \} -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TComYuv.h
r872 r1072 180 180 UInt getCHeight () { return m_iCHeight; } 181 181 UInt getCWidth () { return m_iCWidth; } 182 #if H_3D183 Void addClipPartLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize );184 185 #if H_3D_ARP186 Void addARP ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip );187 Void addARPLuma ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip );188 Void addARPChroma ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip );189 Void subtractARP ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight );190 Void subtractARPLuma ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight );191 Void subtractARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight );192 Void multiplyARP ( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW );193 Void multiplyARPLuma ( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW );194 Void multiplyARPChroma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW );195 private:196 Void xxMultiplyLine( Pel * pSrcDst , UInt uiWidth , UChar dW );197 #endif198 #endif199 182 200 183 };// END CLASS DEFINITION TComYuv -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibCommon/TypeDef.h
r1066 r1072 49 49 Linux makefiles support the following settings: 50 50 make -> HEVC_EXT not defined 51 make HEVC_EXT=0 -> H_MV=0 H_3D=0 --> plain HM 52 make HEVC_EXT=1 -> H_MV=1 H_3D=0 --> MV only 53 make HEVC_EXT=2 -> H_MV=1 H_3D=1 --> full 3D 51 make HEVC_EXT=0 -> H_MV=0 --> plain HM 52 make HEVC_EXT=1 -> H_MV=1 --> MV only 54 53 */ 55 54 56 55 #ifndef HEVC_EXT 57 #define HEVC_EXT 258 #endif 59 60 #if ( HEVC_EXT < 0 )||( HEVC_EXT > 2)61 #error HEVC_EXT must be in the range of 0 to 2, inclusive.56 #define HEVC_EXT 1 57 #endif 58 59 #if ( HEVC_EXT < 0 )||( HEVC_EXT > 1 ) 60 #error HEVC_EXT must be in the range of 0 to 1, inclusive. 62 61 #endif 63 62 64 63 #define H_MV ( HEVC_EXT != 0) 65 #define H_3D ( HEVC_EXT == 2) 66 67 #define NTT_BUG_FIX_TK54 1 68 #define BUG_FIX_TK65 1 69 70 #define MTK_I0093 1 64 71 65 ///////////////////////////////////////////////////////////////////////////////////////// 72 66 /////////////////////////////////// MAJOR DEFINES /////////////////////////////////// … … 76 70 #define H_MV_ENC_DEC_TRAC 1 //< CU/PU level tracking 77 71 #endif 78 79 #if H_3D80 #define H_3D_QTLPC 1 // OL_QTLIMIT_PREDCODING_B0068 //JCT3V-B006881 // HHI_QTLPC_RAU_OFF_C0160 JCT3V-C0160 change 2: quadtree limitation and predictive coding switched off in random access units82 // MTK_TEX_DEP_PAR_G0055 Texture-partition-dependent depth partition. JCT3V-G005583 84 #define H_3D_VSO 1 // VSO, View synthesis optimization, includes:85 // HHI_VSO86 // HHI_VSO_LS_TABLE_M23714 enable table base Lagrange multiplier optimization87 // SAIT_VSO_EST_A0033, JCT3V-A0033 modification 388 // LGE_WVSO_A011989 // SCU_HS_VSD_BUGFIX_IMPROV_G016390 #define H_3D_NBDV 1 // Neighboring block disparity derivation91 // QC_JCT3V-A009792 // LGE_DVMCP_A012693 // LGE_DVMCP_MEM_REDUCTION_B013594 // QC_SIMPLE_NBDV_B004795 // FIX_LGE_DVMCP_B013396 // QC_NBDV_LDB_FIX_C005597 // MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C009798 // MTK_SIMPLIFY_DVTC_C013599 // QC_CU_NBDV_D0181100 // SEC_DEFAULT_DV_D0112101 // MTK_DVMCP_FIX_E0172 fix the mismatch between software and WD for DV derivation from DVMCP blocks, issue 2 in JCT3V-E0172102 // SEC_SIMPLIFIED_NBDV_E0142 Simplified NBDV, JCT3V-E0142 and JCT3V-E0190103 // MTK_NBDV_TN_FIX_E0172 fix the issue of DV derivation from the temporal neighboring blocks, issue 7 in JCT3V-E0172104 // MTK_TEXTURE_MRGCAND_BUGFIX_E0182 Bug fix for TEXTURE MERGING CANDIDATE , JCT3V-E0182105 106 #define H_3D_ARP 1 // Advanced residual prediction (ARP), JCT3V-D0177107 // QC_MTK_INTERVIEW_ARP_F0123_F0108 JCT3V-F0123; JCT3V-F0108108 // SHARP_ARP_REF_CHECK_F0105 ARP reference picture selection and DPB check109 // LGE_ARP_CTX_F0161 JCT3V-F0161110 // MTK_ARP_FLAG_CABAC_SIMP_G0061 Use 2 context for ARP flag referring to only left neighbor block in JCT3V-G0061111 // MTK_ARP_REF_SELECTION_G0053 ARP Reference picture selection in JCT3V-G0053112 // MTK_ALIGN_SW_WD_BI_PRED_ARP_H0085 Align the SW and WD for the bi-prediction ARP PUs by disallowing non-normative fast bi-prediction for ARP PUs, JCT3V-H0085113 114 115 #define H_3D_IC 1 // Illumination Compensation, JCT3V-B0045, JCT3V-C0046, JCT3V-D0060116 // Unifying rounding offset, for IC part, JCT3V-D0135117 // Full Pel Interpolation for Depth, HHI_FULL_PEL_DEPTH_MAP_MV_ACC118 // SHARP_ILLUCOMP_REFINE_E0046119 // MTK_CLIPPING_ALIGN_IC_E0168 // To support simplify bi-prediction PU with identical motion checking, JCT3V-E0168120 // LGE_IC_CTX_F0160 //JCT3V-F0160121 // SEC_ONLY_TEXTURE_IC_F0151122 // MTK_IC_FLAG_CABAC_SIMP_G0061123 // SEC_IC_ARP_SIG_G0072, Disabling IC when ARP is enabled, option 1 in JCT3V-G0072, part 2 in JCT3V-G0121124 // MTK_LOW_LATENCY_IC_ENCODING_H0086 Low-latency IC encoding in JCT3V-H0086125 126 #define MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX 1 // Remove the global variables used in JCT3V-H0086127 128 129 #define SEC_IC_NEIGHBOR_CLIP_I0080 1 // Clipping of neighboring sample position, JCT3V-I0080130 131 132 #if H_3D_NBDV133 #define H_3D_NBDV_REF 1 // Depth oriented neighboring block disparity derivation134 // MTK_D0156135 // MERL_D0166: Reference view selection in NBDV & Bi-VSP136 // MERL_C0152: Basic VSP137 // NBDV_DEFAULT_VIEWIDX_BUGFIX Bug fix for invalid default view index for NBDV138 // NTT_DoNBDV_VECTOR_CLIP_E0141 disparity vector clipping in DoNBDV, JCT3V-E0141 and JCT3V-E0209139 // SEC_VER_DONBDV_H0103 Vertical DV Restriction for DoNBDV140 #endif141 142 #define H_3D_VSP 1 // View synthesis prediction143 // MERL_C0152: Basic VSP144 // MERL_D0166: Reference view selection in NBDV & Bi-VSP145 // MTK_D0105, LG_D0139: No VSP for depth146 // QC_D0191: Clean up147 // LG_D0092: Multiple VSP candidate allowed148 // MTK_VSP_FIX_ALIGN_WD_E0172149 // NTT_VSP_ADAPTIVE_SPLIT_E0207 adaptive sub-PU partitioning in VSP, JCT3V-E0207150 // NTT_VSP_DC_BUGFIX_E0208 bugfix for sub-PU based DC in VSP, JCT3V-E0208151 // NTT_VSP_COMMON_E0207_E0208 common part of JCT3V-E0207 and JCT3V-E0208152 // MTK_F0109_LG_F0120_VSP_BLOCK MTK_LG_SIMPLIFY_VSP_BLOCK_PARTITION_F0109_F0120153 // SHARP_VSP_BLOCK_IN_AMP_F0102 VSP partitioning for AMP154 // MTK_VSP_SIMPLIFICATION_F0111 1. Inherited VSP also use NBDV of current CU, 2. VSP cannot be inherited from above LCU rowss155 // LGE_SHARP_VSP_INHERIT_F0104156 // NTT_STORE_SPDV_VSP_G0148 Storing Sub-PU based DV for VSP157 // Restricted bi-prediction for VSP158 159 #define H_3D_IV_MERGE 1 // Inter-view motion merge candidate160 // HHI_INTER_VIEW_MOTION_PRED161 // SAIT_IMPROV_MOTION_PRED_M24829, improved inter-view motion vector prediction162 // QC_MRG_CANS_B0048 , JCT3V-B0048, B0086, B0069163 // OL_DISMV_POS_B0069 , different pos for disparity MV candidate, B0069164 // MTK_INTERVIEW_MERGE_A0049 , second part165 // QC_AMVP_MRG_UNIFY_IVCAN_C0051166 // TEXTURE MERGING CANDIDATE , JCT3V-C0137167 // QC_INRIA_MTK_MRG_E0126168 // ETRIKHU_MERGE_REUSE_F0093 QC_DEPTH_IV_MRG_F0125, JCT3V-F0125: Depth oriented Inter-view MV candidate169 // EC_MPI_ENABLING_MERGE_F0150, MPI flag in VPS and enabling in Merge mode170 // MTK_NBDV_IVREF_FIX_G0067 , Disable IvMC, VSP when IVREF is not available, JCT3V-G0067171 // SEC_DEPTH_DV_DERIVAITON_G0074, Simplification of DV derivation for depth, JCT3V-G0074172 // QC_DEPTH_MERGE_SIMP_G0127 Remove DV candidate and shifting candidate for depth coding173 // QC_IV_PRED_CONSTRAINT_H0137 Constraint on inter-view (motion) prediction tools174 // ETRIKHU_BUGFIX_H0083 bug-fix for DV candidate pruning175 // ETRIKHU_CLEANUP_H0083 cleaned-up source code for constructing merging candidate list176 // ETRIKHU_CLEANUP_H0083_MISSING missing guard macros added by GT177 // SHARP_SIMPLE_MERGE_H0062 Restrict 3D-HEVC merge cand in small PUs178 // MTK_DIS_SPBIP8X4_H0205 Disable bi-prediction for 8x4 and 4x8 sub PU and remove the SPIVMP 2Nx2N restriction179 // SEC_ADAPT_DISABLE_IVMP Disalbing IVMP merge candidates when IC is enabled, JCT3V-H0070180 181 #define SEC_SIMP_SHIFTED_DV_I0086 1 // Simplification of Shifted DV candidate, JCT3V-I0086182 183 #define H_3D_TMVP 1 // QC_TMVP_C0047184 // Sony_M23639185 186 #define H_3D_DIM 1 // DIM, Depth intra modes, includes:187 // HHI_DMM_WEDGE_INTRA188 // HHI_DMM_PRED_TEX189 // FIX_WEDGE_NOFLOAT_D0036190 // LGE_EDGE_INTRA_A0070191 // LGE_DMM3_SIMP_C0044192 // QC_DC_PREDICTOR_D0183193 // HHI_DELTADC_DLT_D0035194 // PKU_QC_DEPTH_INTRA_UNI_D0195195 // RWTH_SDC_DLT_B0036196 // INTEL_SDC64_D0193197 // RWTH_SDC_CTX_SIMPL_D0032198 // LGE_CONCATENATE_D0141199 // FIX_SDC_ENC_RD_WVSO_D0163200 // MTK_SAMPLE_BASED_SDC_D0110201 // SEC_DMM2_E0146_HHIFIX Removal of DMM2 from DMMs202 // ZJU_DEPTH_INTRA_MODE_E0204 Simplified Binarization for depth_intra_mode203 // KWU_SDC_SIMPLE_DC_E0117 Simplified DC calculation for SDC204 // SCU_HS_DMM4_REMOVE_DIV_E0242 DMM4 Division Removal205 // LGE_SDC_REMOVE_DC_E0158 Removal of DC mode from SDC206 // LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX 1 Removal of overlap between DMM3 and DMM1207 // LGE_PRED_RES_CODING_DLT_DOMAIN_F0159 JCT3V-F0159208 // HHI_DIM_PREDSAMP_FIX_F0171209 // SEC_DMM3_RBC_F0147 Removal of DMM3 and RBC from DMMs210 // QC_DIM_DELTADC_UNIFY_F0132 Unify delta DC coding in depth intra modes211 // Unify intra SDC and inter SDC212 // QC_GENERIC_SDC_G0122 Generalize SDC to all depth intra modes213 // SCU_HS_DEPTH_DC_PRED_G0143214 // HS_TSINGHUA_SDC_SPLIT_G0111215 // QC_PKU_SDC_SPLIT_G0123 Intra SDC Split216 // HS_DMM_SDC_PREDICTOR_UNIFY_H0108 Unification of DMM and SDC predictor derivation217 // LGE_SIMP_DIM_NOT_PRESENT_FLAG_CODING_H0119_H0135 Use only one context for CABAC of dim_not_present_flag218 // QC_SIMP_DELTADC_CODING_H0131 Simplify detaDC entropy coding219 // MTK_DMM_SIMP_CODE_H0092 Remove CABAC context for DMM1 mode coding220 // MTK_DELTA_DC_FLAG_ONE_CONTEXT_H0084_H0100_H0113 Use only one context for CABAC of delta_dc_flag as in JCTVC-H0084, JCTVC-H0100 and JCTVC-H0113221 // MTK_SDC_FLAG_FIX_H0095 Remove conditional check of PCM flag based on SDC flag, JCTVC-H0095222 // SEC_NO_RESI_DLT_H0105223 // MTK_DLT_CODING_FIX_H0091224 225 #define MTK_SINGLE_DEPTH_MODE_I0095 1 // Single depth mode proposed in JCT3V-I0095226 #if MTK_SINGLE_DEPTH_MODE_I0095227 #define MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE 2 // size of the sample candidate list228 #endif229 230 #define H_3D_FIX_UNINIT 1 // Fix uninitialized flag231 #define H_3D_INTER_SDC 1 // INTER SDC, Inter simplified depth coding232 // LGE_INTER_SDC_E0156 Enable inter SDC for depth coding233 // SEC_INTER_SDC_G0101 Improved inter SDC with multiple DC candidates234 235 #define H_3D_SPIVMP 1 // H_3D_SPIVMP // JCT3V-F0110: Sub-PU level inter-view motion prediction236 // SEC_SPIVMP_MCP_SIZE_G0077, Apply SPIVMP only to 2Nx2N partition, JCT3V-G0077237 // QC_SPIVMP_MPI_G0119 Sub-PU level MPI merge candidate238 // Simplification on Sub-PU level temporal interview motion prediction239 // MPI_SUBPU_DEFAULT_MV_H0077_H0099_H0111_H0133240 241 #define H_3D_DBBP 1 // DBBP: Depth-based Block Partitioning and Merging242 // MTK_DBBP_AMP_REM_H0072243 // RWTH_DBBP_NO_SPU_H0057244 // SEC_DBBP_FILTERING_H0104245 // MTK_DBBP_SIGNALING_H0094246 // H_3D_FIX_DBBP_IVMP Fix . Enable IVMP is always disabled, when DBBP is enabled. The original intention is to disable Sub-PU IVMP when DBBP is enabled, not to disable IVMP itself.247 248 #define SEC_DBBP_EXPLICIT_SIG_I0077 1 // Remove the partition derivation and signal dbbp_flag only when the partion mode is 2NxN/Nx2N, JCT3V-I0077249 #define SEC_DBBP_DISALLOW_8x8_I0078 1 // Disallow DBBP in 8x8 CU, JCT3V-I0078250 #define SHARP_DBBP_SIMPLE_FLTER_I0109 1 // Simple condition and one dimensional dilter for DBBP251 #define SEC_DBBP_DMM4_THRESHOLD_I0076 1 // Simplification of threshold derivation for DBBP and DMM4, JCT3V-I0076252 253 254 #define H_3D_DDD 1 // Disparity derived depth coding255 256 #define H_3D_FCO 0 // Flexible coding order for 3D257 #if H_3D_FCO258 #define LGE_FCO_I0116 1259 #endif260 261 #define SCU_HS_FAST_INTRA_SDC_I0123 1262 263 // OTHERS264 // MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170 // Progressive MV Compression, JCT3V-E0170265 #define H_3D_REN_MAX_DEV_OUT 0 // Output maximal possible shift deviation266 #define H_3D_FAST_TEXTURE_ENCODING 1 // Fast merge mode decision and early CU determination for texture component of dependent view, JCT3V-E0173267 // MTK_FAST_TEXTURE_ENCODING_E0173268 #if H_3D_DIM269 #define H_3D_FAST_DEPTH_INTRA 1 // Fast DMM and RBC Mode Selection270 // SCU_HS_FAST_DEPTH_INTRA_E0238_HHIFIX271 #endif272 273 #define MTK_I0099_VPS_EX2 1 ///< JCT3V-I0099, sub-PU size signaling and lim_qt_pred_flag in VPS extension 2274 #define MTK_I0099_FIX 1 ///< Fix the problem of removing encoder only QTL275 276 // Rate Control277 #define KWU_FIX_URQ 1278 #define KWU_RC_VIEWRC_E0227 0 ///< JCT3V-E0227, view-wise target bitrate allocation279 #define KWU_RC_MADPRED_E0227 0 ///< JCT3V-E0227, inter-view MAD prediction280 281 #define SEC_VPS_CLEANUP_I0090 1282 #define SEC_HLS_CLEANUP_I0100 1283 284 #define H_3D_FIX_64BIT_SHIFT 1285 #endif // H_3D286 287 288 72 289 73 ///////////////////////////////////////////////////////////////////////////////////////// … … 300 84 #define FIX_TICKET_62 1 // buffer overflow for print 301 85 #define FIX_TICKET_61 1 // layerIdsInSets size check 302 303 ///// ***** VIEW SYNTHESIS OPTIMIZAION *********304 #if H_3D_VSO305 #define H_3D_VSO_DIST_INT 1 // Allow negative synthesized view distortion change306 #define H_3D_VSO_COLOR_PLANES 1 // Compute VSO distortion on color planes307 #define H_3D_VSO_EARLY_SKIP 1 // LGE_VSO_EARLY_SKIP_A0093, A0093 modification 4308 #define H_3D_VSO_RM_ASSERTIONS 0 // Output VSO assertions309 #define H_3D_VSO_SYNTH_DIST_OUT 0 // Output of synthesized view distortion instead of depth distortion in encoder output310 #define H_3D_VSO_FIX 1 // This fix should be enabled after verification311 #endif312 313 //// ****** NEIGHBOURING BLOCK-BASED DISPARITY VECTOR *********314 #if H_3D_NBDV315 #define DVFROM_LEFT 0316 #define DVFROM_ABOVE 1317 #define IDV_CANDS 2318 #endif319 320 ///// ***** ADVANCED INTERVIEW RESIDUAL PREDICTION *********321 #if H_3D_ARP322 #define H_3D_ARP_WFNR 3323 #define QC_I0129_ARP_FIX 1324 #define QC_I0051_ARP_SIMP 1325 #define SHARP_ARP_CHROMA_I0104 1326 #define MTK_I0072_IVARP_SCALING_FIX 1327 #endif328 329 ///// ***** DEPTH INTRA MODES *********330 #if H_3D_DIM331 #define H_3D_DIM_DMM 1 // Depth Modeling Modes332 #define H_3D_DIM_SDC 1 // Simplified Depth Coding method333 #define H_3D_DIM_DLT 1 // Depth Lookup Table334 #define HS_DMM_SIGNALLING_I0120 1335 #define SHARP_DMM1_I0110 1 // LUT size reduction for DMM1 proposed in JCT3V-I0110336 #define FIX_WARNING 1 // fix narrowing conversion of NumPocStCurr0,NumPocStCurr1 at TComSlice.cpp337 #define FAST_SDC_OFFSET_DECISION_I0084 1338 #define SEPARATE_FLAG_I0085 1339 340 #if H_3D_DIM_DLT341 #define H_3D_DELTA_DLT 1342 #define RWTH_DLT_CLIP_I0057 1343 #endif344 #define H_3D_DIM_ENC 1 // Depth Intra encoder optimizations, includes:345 // HHI_DEPTH_INTRA_SEARCH_RAU_C0160346 // LG_ZEROINTRADEPTHRESI_A0087347 #define HHI_DMM4_ENC_I0066 1348 #endif349 ///// ***** VIEW SYNTHESIS PREDICTION *********350 #if H_3D_VSP351 #define H_3D_VSP_BLOCKSIZE 4 // Supported values: 1, 2, and 4352 #if H_3D_VSP_BLOCKSIZE == 1353 #define H_3D_VSP_CONSTRAINED 1 // Constrained VSP @ 1x1354 #else355 #define H_3D_VSP_CONSTRAINED 0356 #endif357 #endif358 359 360 ///// ***** ILLUMATION COMPENSATION *********361 #if H_3D_IC362 #define IC_REG_COST_SHIFT 7363 #define IC_CONST_SHIFT 5364 #define IC_SHIFT_DIFF 12365 #define IC_LOW_LATENCY_ENCODING_THRESHOLD 0.1 // Threshold for low-latency IC encoding in JCT3V-H0086366 #endif367 368 369 ///// ***** DEPTH BASED BLOCK PARTITIONING *********370 #if H_3D_DBBP371 #define DBBP_INVALID_SHORT (-4)372 #define RWTH_DBBP_PACK_MODE SIZE_2NxN373 #endif374 375 376 ///// ***** FCO *********377 #if H_3D_FCO378 #define H_3D_FCO_VSP_DONBDV_E0163 1 // Adaptive depth reference for flexible coding order379 #else380 #define H_3D_FCO_VSP_DONBDV_E0163 0 // Adaptive depth reference for flexible coding order381 #endif382 383 #if H_3D384 #define PPS_FIX_DEPTH 1385 #endif386 86 387 87 ///////////////////////////////////////////////////////////////////////////////// … … 432 132 433 133 434 // POC435 // #define H_MV_HLS_7_POC_P0041_3 0 // (POC/P0041/POC reset) #3 It was remarked that we should require each non-IRAP picture that has discardable_flag equal to 1 to have NUT value indicating that it is a sub-layer non-reference picture. This was agreed. Decision: Adopt (with constraint for discardable_flag as described above)436 // #define H_MV_HLS_7_POC_P0041_FIXES 0 // (POC/P0041/Fixes) For each non-IRAP picture that has discardable_flag equal to 1 to have NUT value indicating that it is a sub-layer non-reference picture.437 // #define H_MV_HLS_7_POC_P0056_4 0 // (POC/P0056/layer tree poc) #4 Proposal 1: If the POC reset approach is adopted as the basis for multi-layer POC derivation, it is proposed to derive the POC anchor picture from the previous TID0 picture (that is not a RASL picture, a RADL picture or a sub-layer non-reference picture and not with discardable_flag equal to 1) of the current layer or any of its reference layer. This is asserted to improve loss resilience and reduce bit rate overhead. Decision: Adopt Proposal 1 (with the suggested modifications Ewith text provided as P0297).438 439 // SEI related440 //#define H_MV_HLS_8_SEI_NODOC_53 0 // #53 (SEI /NODOC/Added Multiview view position SEI message) Plain copy from AVC.441 //#define H_MV_HLS_8_SEI_NODOC_52 0 // #52 (SEI /NODOC/Added Multiview acquisition information SEI) Plain copy from AVC.442 //#define H_MV_HLS_8_SEI_NODOC_51 0 // #51 (SEI /NODOC/Added Multiview scene information SEI message)443 //#define H_MV_HLS_8_SEI_Q0189_35 0 // #35 (SEI /Q0189/SEI message for indicating constraints on TMVP) Proposal 2.3, SEI message for indicating constraints on TMVP444 //#define H_MV_HLS_8_EDF_Q0116_29 0 // #29 (ED.FIX /Q0116/Recovery point SEI) , consider adding a note regarding how random accessibility is affected by the recovery point SEI message445 //#define H_MV_HLS_8_GEN_Q0183_23 0 // #23 (GEN /Q0183/SEI clean-ups) numerous small clean-ups on SEI messages.446 //#define H_MV_HLS_8_MIS_Q0247_49 0 // #49 (MISC /Q0247/frame-field information SEI message)447 //#define H_MV_HLS_8_MIS_Q0189_34 0 // #34 (MISC /Q0189/slice temporal mvp enabled flag) Proposal 2.2, clarification of semantics of slice temporal mvp enabled flag448 //#define H_MV_HLS_8_EDF_Q0081_01 0 // #1 (ED.FIX /Q0081/alpha channel persist) On reuse of alpha planes in auxiliary pictures. It was asked why there would not be a presumption that the alpha channel content would simply persist, without needing the flag to indicate it. Decision (Ed.): Delegated to editors to clarify, as necessary, that the alpha channel content persists until cancelled or updated in output order.449 //#define H_MV_HLS_8_SEI_Q0253_37 0 // #37 (SEI /Q0253/layer not present), modified semantics of layers not present SEI message to correct bug introduced during editing450 //#define H_MV_HLS_8_SEI_Q0045_11 0 // #11 (SEI /Q0045/Overlay) Proposal for an SEI message on selectable overlays. Decision: Adopt (modified for variable-length strings).451 //#define H_MV_HLS_7_SEI_P0133_28 0 // (SEI/P0133/Recovery point SEI) #28 Decision: Adopt change to recover point semantics only (-v3)452 //#define H_MV_HLS_7_SEI_P0123_25 0 // (SEI/P0123/Alpha channel info) #25 Add alpha channel information SEI message Decision: Adopt. Constrain the bit depth indicated to be equal to the coded bit depth of the aux picture.453 454 // Auxiliary picture related455 //#define H_MV_HLS_8_AUX_NODOC_40 0 // #40 (AUX /NODOC/primary pic) Clarify that an auxiliary picture can be associated with more than one primary picture. Consider if the language associating an alpha auxiliary picture with a primary picture in the semantics of dimension_id[ ][ ] near the AuxId derivation could be moved to the alpha SEI message.456 //#define H_MV_HLS_8_AUX_Q0081_2 0 // #2 (AUX /Q0081/primary) Decision: Remove the constraint that an alpha picture must be accompanied by a primary picture.457 //#define H_MV_HLS_8_AUX_Q0078_44 0 // #44 (AUX /Q0078/concepts Auxiliary picture concepts:458 //#define H_MV_HLS_8_AUX_Q0078_39 0 // #39 (AUX /Q0078/conformance): mechanism for signaling a profile/tier/level conformance point for auxiliary pictures459 460 // Profiles461 //#define H_MV_HLS_8_PRO_NODOC_50 0 // #50 (PROF /NODOC/Monochrome) Add Monochrome 8-bit profile462 //#define H_MV_HLS_8_PRO_NODOC_31 0 // #31 (PROF /NODOC/Profile constraint) Add a profile constraint to the Scalable Main, Scalable Main 10, and Stereo Main profiles against allowing layers with duplicate values of DependencyId (or ViewOrderIdx) when AuxId equal to 0.463 //#define H_MV_HLS_8_PRO_H0126_45 0 // #45 (PROF /H0126/Stereo main) Phrasing used in specifying the Stereo Main profile.464 //#define H_MV_HLS_8_PRO_Q0160_33 0 // #33 (PROF /Q0160/alt_output_flag) v2: Add constraint to stereo main profile that it must contain exactly two texture views, and add a note to state that the constraint implies a restriction that alt_output_flag equal to 0.465 466 // DPB467 //#define H_MV_HLS_8_HRD_Q0102_09 0 // #9 (HRD /Q0102/NoOutputOfPriorPicsFlag) It was suggested that also the separate_colour_plane_flag should affect inference of NoOutputOfPriorPicsFlag. Decision (Ed.): Agreed (affects RExt text).468 //#define H_MV_HLS_8_DBP_Q0154_38 0 // #38 (DBP /Q0154/VPS DPB) Proposal in C.5.2.1: Add in the decoding process that when a new VPS is activated, all pictures in the DPB are marked as unused for reference469 //#define H_MV_HLS_8_HRD_Q0154_10 0 // #10 (HRD /Q0154/DPB Flushing and parameters) On picture flushing and DPB parameters Decision: Adopted (some details to be discussed further in BoG).470 //#define H_MV_HLS_7_OTHER_P0187_1 0 // (OTHER/P0187/NoOutputOfPriorPicsFlag) #1 Inference of NoOutputOfPriorPicsFlag and proposes to take into account colour format and bit depth for the inference in addition to spatial resolution471 472 // OTHERS473 //#define H_MV_HLS_8_HSB_Q0041_03 0 // #3 (HS /Q0041/hybrid scalability) The proposed text was endorsed, with non-editorial open issues considered as follows ?// #define H_MV_HLS_7_OTHER_P0187_1 0 // (OTHER/P0187/NoOutputOfPriorPicsFlag) #1 Inference of NoOutputOfPriorPicsFlag and proposes to take into account colour format and bit depth for the inference in addition to spatial resolution474 //#define H_MV_HLS_8_MIS_Q0078_24 0 // #24 (MISC /Q0078/scan and pic type) , Items 3 b,c and 4, clarifying which pictures in an output layer sets are applied the values of general_progressive_source_flag, general_interlaced_source_flag, general_non_packed_constraint_flag and general_frame_only_constraint_flag.475 //#define H_MV_HLS_7_HRD_P0138_6 0 // (HRD/P0138/HRD parameters for bitstreams excluding) #6 Decision: Adopt (as revised in updated contribution, with the specification of a flag in the BP SEI (HRD/P0192/sub-DPB) #12 Establish sub-DPBs based on the representation format indicated at the VPS level. It was suggested that the expressed shared capacity limit would need to be less than or equal to the sum of the individual capacity limits. Decision: Adopt as modified. Further study is encouraged on profile/level constraint selections.476 477 134 ///////////////////////////////////////////////////////////////////////////////////////// 478 135 /////////////////////////////////// HM RELATED DEFINES //////////////////////////////// … … 708 365 typedef Int TCoeff; ///< transform coefficient 709 366 710 #if H_3D_VSO711 // ====================================================================================================================712 // Define Distortion Types713 // ====================================================================================================================714 typedef Int64 RMDist; ///< renderer model distortion715 716 #if H_3D_VSO_DIST_INT717 typedef Int64 Dist; ///< RDO distortion718 typedef Int64 Dist64;719 #define RDO_DIST_MIN MIN_INT720 #define RDO_DIST_MAX MAX_INT721 #else722 typedef UInt Dist; ///< RDO distortion723 typedef UInt64 Dist;724 #define RDO_DIST_MIN 0725 #define RDO_DIST_MAX MAX_UINT726 #endif727 #endif728 367 /// parameters for adaptive loop filter 729 368 class TComPicSym; … … 933 572 DF_HADS64 = 27, ///< 64xM HAD with step 934 573 DF_HADS16N = 28, ///< 16NxM HAD with step 935 #if H_3D_VSO936 DF_VSD = 29, ///< general size VSD937 DF_VSD4 = 30, ///< 4xM VSD938 DF_VSD8 = 31, ///< 8xM VSD939 DF_VSD16 = 32, ///< 16xM VSD940 DF_VSD32 = 33, ///< 32xM VSD941 DF_VSD64 = 34, ///< 64xM VSD942 DF_VSD16N = 35, ///< 16NxM VSD943 #endif944 574 945 575 #if AMP_SAD … … 981 611 982 612 /// merging candidates 983 #if H_3D984 enum DefaultMergCandOrder985 {986 MRG_T = 0, ///< MPI987 MRG_D, ///< DDD988 MRG_IVMC, ///< Temporal inter-view989 MRG_A1, ///< Left990 MRG_B1, ///< Above991 MRG_B0, ///< Above right992 MRG_IVDC, ///< Disparity inter-view993 MRG_VSP, ///< VSP994 MRG_A0, ///< Left bottom995 MRG_B2, ///< Above left996 MRG_IVSHIFT, ///< Shifted IVMC of Shifted IVDC. (These are mutually exclusive)997 MRG_COL ///< Temporal co-located998 };999 #endif1000 613 1001 614 /// coefficient scanning type used in ACS … … 1018 631 #if H_MV_HLS10_PTL 1019 632 MULTIVIEWMAIN = 6, 1020 #if H_3D1021 MAIN3D = 8,1022 #endif1023 633 #else 1024 634 MAINSTEREO = 4, 1025 635 MAINMULTIVIEW = 5, 1026 #if H_3D1027 MAIN3D = 6,1028 #endif1029 636 #endif 1030 637 #endif … … 1065 672 enum ScalabilityType 1066 673 { 1067 #if H_3D1068 DEPTH_ID = 0,1069 #endif1070 674 VIEW_ORDER_INDEX = 1, 1071 675 #if H_MV_HLS10_AUX … … 1075 679 }; 1076 680 #endif 1077 #if H_3D 1078 // Renderer 1079 enum BlenMod 1080 { 1081 BLEND_NONE = -1, 1082 BLEND_AVRG = 0, 1083 BLEND_LEFT = 1, 1084 BLEND_RIGHT = 2, 1085 BLEND_GEN = 3 1086 }; 1087 1088 1089 enum 1090 { 1091 VIEWPOS_INVALID = -1, 1092 VIEWPOS_LEFT = 0, 1093 VIEWPOS_RIGHT = 1, 1094 VIEWPOS_MERGED = 2 1095 }; 1096 1097 #define Log2( n ) ( log((double)n) / log(2.0) ) // Ed.(GT): This is very very bad and should be fixed to used integer arithmetics ( see gCeilLog2 ) moreover it should not be defined in the tool macro section! 1098 #endif 1099 #endif 681 #endif -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibDecoder/TDecCAVLC.cpp
r1066 r1072 99 99 TDecCavlc::TDecCavlc() 100 100 { 101 #if H_3D102 m_aaiTempScale = new Int* [ MAX_NUM_LAYERS ];103 m_aaiTempOffset = new Int* [ MAX_NUM_LAYERS ];104 for( UInt uiVId = 0; uiVId < MAX_NUM_LAYERS; uiVId++ )105 {106 m_aaiTempScale [ uiVId ] = new Int [ MAX_NUM_LAYERS ];107 m_aaiTempOffset [ uiVId ] = new Int [ MAX_NUM_LAYERS ];108 }109 #endif110 101 } 111 102 112 103 TDecCavlc::~TDecCavlc() 113 104 { 114 #if H_3D115 for( UInt uiVId = 0; uiVId < MAX_NUM_LAYERS; uiVId++ )116 {117 delete [] m_aaiTempScale [ uiVId ];118 delete [] m_aaiTempOffset [ uiVId ];119 }120 delete [] m_aaiTempScale;121 delete [] m_aaiTempOffset;122 #endif123 105 } 124 106 … … 223 205 } 224 206 225 #if H_3D226 Void TDecCavlc::parsePPS(TComPPS* pcPPS, TComVPS* pcVPS )227 #else228 207 Void TDecCavlc::parsePPS(TComPPS* pcPPS) 229 #endif230 208 { 231 209 #if ENC_DEC_TRACE … … 387 365 READ_FLAG( uiCode, "pps_range_extensions_flag" ); pcPPS->setPpsRangeExtensionsFlag( uiCode == 1 ); 388 366 READ_FLAG( uiCode, "pps_multilayer_extension_flag" ); pcPPS->setPpsMultilayerExtensionFlag( uiCode == 1 ); 389 #if !H_3D390 367 READ_CODE( 6, uiCode, "pps_extension_6bits" ); pcPPS->setPpsExtension6bits( uiCode ); 391 #else392 READ_FLAG( uiCode, "pps_3d_extension_flag" ); pcPPS->setPps3dExtensionFlag( uiCode == 1 );393 READ_CODE( 5, uiCode, "pps_extension_5bits" ); pcPPS->setPpsExtension5bits( uiCode );394 #endif395 368 if ( pcPPS->getPpsRangeExtensionsFlag() ) 396 369 { … … 407 380 #endif 408 381 } 409 #if !H_3D410 382 if ( pcPPS->getPpsExtension6bits() ) 411 383 { 412 #else413 if ( pcPPS->getPps3dExtensionFlag() )414 {415 parsePPSExtension( pcPPS, pcVPS );416 }417 if ( pcPPS->getPpsExtension5bits() )418 {419 #endif420 384 421 385 #endif … … 432 396 433 397 434 #if H_3D435 Void TDecCavlc::parsePPSExtension( TComPPS* pcPPS, TComVPS* pcVPS )436 {437 //Ed.(GT): pcVPS should not be used here. Needs to be fixed.438 UInt uiCode = 0;439 TComDLT* pcDLT = new TComDLT;440 441 READ_FLAG(uiCode, "dlt_present_flag");442 pcDLT->setDltPresentFlag( (uiCode == 1) ? true : false );443 444 if ( pcDLT->getDltPresentFlag() )445 {446 READ_CODE(6, uiCode, "pps_depth_layers_minus1");447 pcDLT->setNumDepthViews( uiCode );448 449 READ_CODE(4, uiCode, "pps_bit_depth_for_depth_views_minus8");450 pcDLT->setDepthViewBitDepth( (uiCode+8) );451 452 for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ )453 {454 if ( i != 0 )455 {456 if( pcVPS->getDepthId( i ) == 1 )457 {458 READ_FLAG(uiCode, "dlt_flag[i]");459 pcDLT->setUseDLTFlag(i, (uiCode == 1) ? true : false);460 461 if ( pcDLT->getUseDLTFlag( i ) )462 {463 Bool bDltBitMapRepFlag = false;464 UInt uiMaxDiff = 0xffffffff;465 UInt uiMinDiff = 0;466 UInt uiCodeLength = 0;467 468 READ_FLAG(uiCode, "inter_view_dlt_pred_enable_flag[ i ]");469 470 if( uiCode )471 {472 assert( pcDLT->getUseDLTFlag( 1 ));473 }474 pcDLT->setInterViewDltPredEnableFlag( i, (uiCode == 1) ? true : false );475 476 if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false )477 {478 READ_FLAG(uiCode, "dlt_bit_map_rep_flag[ layerId ]");479 bDltBitMapRepFlag = (uiCode == 1) ? true : false;480 }481 else482 {483 bDltBitMapRepFlag = false;484 }485 486 UInt uiNumDepthValues = 0;487 Int aiIdx2DepthValue[256];488 489 // Bit map490 if ( bDltBitMapRepFlag )491 {492 for (UInt d=0; d<256; d++)493 {494 READ_FLAG(uiCode, "dlt_bit_map_flag[ layerId ][ j ]");495 if (uiCode == 1)496 {497 aiIdx2DepthValue[uiNumDepthValues] = d;498 uiNumDepthValues++;499 }500 }501 }502 // Diff Coding503 else504 {505 READ_CODE(8, uiNumDepthValues, "num_depth_values_in_dlt[i]"); // num_entry506 507 #if !H_3D_DELTA_DLT508 if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false ) // Single-view DLT Diff Coding509 #endif510 {511 // The condition if( pcVPS->getNumDepthValues(i) > 0 ) is always true since for Single-view Diff Coding, there is at least one depth value in depth component.512 513 if (uiNumDepthValues > 1)514 {515 READ_CODE(8, uiCode, "max_diff[ layerId ]");516 uiMaxDiff = uiCode;517 }518 else519 {520 uiMaxDiff = 0; // when there is only one value in DLT521 }522 523 if (uiNumDepthValues > 2)524 {525 uiCodeLength = (UInt) ceil(Log2(uiMaxDiff + 1));526 READ_CODE(uiCodeLength, uiCode, "min_diff_minus1[ layerId ]");527 uiMinDiff = uiCode + 1;528 }529 else530 {531 uiMinDiff = uiMaxDiff; // when there are only one or two values in DLT532 }533 534 READ_CODE(8, uiCode, "dlt_depth_value0[layerId]"); // entry0535 aiIdx2DepthValue[0] = uiCode;536 537 if (uiMaxDiff == uiMinDiff)538 {539 for (UInt d=1; d<uiNumDepthValues; d++)540 {541 aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + 0;542 }543 }544 else545 {546 uiCodeLength = (UInt) ceil(Log2(uiMaxDiff - uiMinDiff + 1));547 for (UInt d=1; d<uiNumDepthValues; d++)548 {549 READ_CODE(uiCodeLength, uiCode, "dlt_depth_value_diff_minus_min[ layerId ][ j ]");550 aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + uiCode;551 }552 }553 554 }555 }556 557 #if H_3D_DELTA_DLT558 if( pcDLT->getInterViewDltPredEnableFlag( i ) )559 {560 // interpret decoded values as delta DLT561 AOF( pcVPS->getDepthId( 1 ) == 1 );562 AOF( i > 1 );563 // assumes ref layer id to be 1564 Int* piRefDLT = pcDLT->idx2DepthValue( 1 );565 UInt uiRefNum = pcDLT->getNumDepthValues( 1 );566 pcDLT->setDeltaDLT(i, piRefDLT, uiRefNum, aiIdx2DepthValue, uiNumDepthValues);567 }568 else569 {570 // store final DLT571 pcDLT->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues);572 }573 #else574 // store final DLT575 pcDLT->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues);576 #endif577 }578 }579 }580 }581 }582 583 pcPPS->setDLT( pcDLT );584 }585 #endif586 398 587 399 Void TDecCavlc::parseVUI(TComVUI* pcVUI, TComSPS *pcSPS) … … 763 575 } 764 576 765 #if H_3D766 Void TDecCavlc::parseSPS(TComSPS* pcSPS, Int viewIndex, Bool depthFlag )767 #else768 577 Void TDecCavlc::parseSPS(TComSPS* pcSPS) 769 #endif770 578 { 771 579 #if ENC_DEC_TRACE … … 1041 849 READ_FLAG( uiCode, "sps_range_extensions_flag" ); pcSPS->setSpsRangeExtensionsFlag( uiCode == 1 ); 1042 850 READ_FLAG( uiCode, "sps_multilayer_extension_flag" ); pcSPS->setSpsMultilayerExtensionFlag( uiCode == 1 ); 1043 #if !H_3D1044 851 READ_CODE( 6, uiCode, "sps_extension_6bits" ); pcSPS->setSpsExtension6bits( uiCode ); 1045 #else1046 READ_FLAG( uiCode, "sps_3d_extension_flag" ); pcSPS->setSps3dExtensionFlag( uiCode == 1 );1047 READ_CODE( 5, uiCode, "sps_extension_5bits" ); pcSPS->setSpsExtension5bits( uiCode );1048 #endif1049 852 } 1050 853 … … 1059 862 } 1060 863 1061 #if H_3D1062 if ( pcSPS->getSps3dExtensionFlag() )1063 {1064 parseSPSExtension2( pcSPS, viewIndex, depthFlag );1065 }1066 1067 if ( pcSPS->getSpsExtension5bits() )1068 {1069 #else1070 864 if ( pcSPS->getSpsExtension6bits() ) 1071 865 { 1072 #endif1073 866 1074 867 #endif … … 1104 897 } 1105 898 1106 #if H_3D1107 Void TDecCavlc::parseSPSExtension2( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )1108 {1109 #if !MTK_I0099_VPS_EX21110 UInt uiCode;1111 #if H_3D_QTLPC1112 //GT: This has to go to VPS1113 if( depthFlag )1114 {1115 READ_FLAG( uiCode, "use_qtl_flag" );1116 pcSPS->setUseQTL( uiCode );1117 READ_FLAG( uiCode, "use_pc_flag" );1118 pcSPS->setUsePC( uiCode );1119 }1120 #endif1121 #endif1122 }1123 #endif1124 899 1125 900 #if H_MV_HLS10_PPS … … 1258 1033 if (uiCode) 1259 1034 { 1260 #if H_3D1261 m_pcBitstream->readOutTrailingBits();1262 pcVPS->createCamPars(pcVPS->getNumViews());1263 parseVPSExtension2( pcVPS );1264 READ_FLAG( uiCode, "vps_extension3_flag" );1265 if (uiCode)1266 {1267 #endif1268 1035 #endif 1269 1036 while ( xMoreRbspData() ) … … 1272 1039 } 1273 1040 #if H_MV 1274 #if H_3D1275 }1276 #endif1277 1041 } 1278 1042 #endif … … 2102 1866 } 2103 1867 2104 #if H_3D2105 Void TDecCavlc::parseVPSExtension2( TComVPS* pcVPS )2106 {2107 UInt uiCode;2108 #if SEC_VPS_CLEANUP_I00902109 for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )2110 #else2111 for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ )2112 #endif2113 {2114 #if H_3D_ARP2115 pcVPS->setUseAdvRP ( i, 0 );2116 pcVPS->setARPStepNum( i, 1 );2117 #endif2118 #if H_3D_SPIVMP2119 pcVPS->setSubPULog2Size(i, 0);2120 #endif2121 #if !SEC_VPS_CLEANUP_I00902122 if ( i != 0 )2123 #endif2124 {2125 #if MTK_I0099_VPS_EX22126 READ_FLAG( uiCode, "iv_mv_pred_flag[i]"); pcVPS->setIvMvPredFlag ( i, uiCode == 1 ? true : false );2127 #if SEC_HLS_CLEANUP_I01002128 READ_FLAG( uiCode, "iv_mv_scaling_flag[i]"); pcVPS->setIvMvScalingFlag ( i, uiCode == 1 ? true : false );2129 #endif2130 #endif2131 if( !( pcVPS->getDepthId( i ) == 1 ) )2132 {2133 #if H_3D_IV_MERGE2134 #if !MTK_I0099_VPS_EX22135 READ_FLAG( uiCode, "iv_mv_pred_flag[i]"); pcVPS->setIvMvPredFlag ( i, uiCode == 1 ? true : false );2136 #endif2137 if( !pcVPS->getNumDirectRefLayers(i) )2138 {2139 assert( !uiCode );2140 }2141 #if H_3D_SPIVMP2142 READ_UVLC (uiCode, "log2_sub_PU_size_minus3[i]"); pcVPS->setSubPULog2Size(i, uiCode+3);2143 #endif2144 #endif2145 #if H_3D_ARP2146 READ_FLAG( uiCode, "iv_res_pred_flag[i]" ); pcVPS->setUseAdvRP ( i, uiCode ); pcVPS->setARPStepNum( i, uiCode ? H_3D_ARP_WFNR : 1 );2147 if( !pcVPS->getNumDirectRefLayers(i) )2148 {2149 assert( !uiCode );2150 }2151 #endif2152 #if H_3D_NBDV_REF2153 READ_FLAG( uiCode, "depth_refinement_flag[i]"); pcVPS->setDepthRefinementFlag ( i, uiCode == 1 ? true : false );2154 #endif2155 #if H_3D_VSP2156 READ_FLAG( uiCode, "view_synthesis_pred_flag[i]"); pcVPS->setViewSynthesisPredFlag( i, uiCode == 1 ? true : false );2157 if( !pcVPS->getNumDirectRefLayers(i) )2158 {2159 assert( !uiCode );2160 }2161 #endif2162 #if H_3D_DBBP2163 READ_FLAG( uiCode, "use_dbbp_flag[i]" ); pcVPS->setUseDBBP( i, uiCode == 1 ? true : false );2164 #endif2165 }2166 else2167 {2168 #if !MTK_I0099_VPS_EX22169 #if H_3D_IV_MERGE2170 if(i!=1)2171 {2172 READ_FLAG( uiCode, "iv_mv_pred_flag[i]"); pcVPS->setIvMvPredFlag ( i, uiCode == 1 ? true : false );2173 if( !pcVPS->getNumDirectRefLayers(i) )2174 {2175 assert( !uiCode );2176 }2177 }2178 #endif2179 #if H_3D_SPIVMP2180 if (i!=1)2181 {2182 READ_UVLC (uiCode, "log2_sub_PU_size_minus3[i]"); pcVPS->setSubPULog2Size(i, uiCode+3);2183 }2184 #endif2185 #endif2186 #if H_3D_IV_MERGE2187 READ_FLAG( uiCode, "mpi_flag[i]" ); pcVPS->setMPIFlag( i, uiCode == 1 ? true : false );2188 #endif2189 #if MTK_I0099_VPS_EX22190 READ_UVLC (uiCode, "log2_mpi_sub_PU_size_minus3[i]"); pcVPS->setSubPUMPILog2Size(i, uiCode+3);2191 #endif2192 READ_FLAG( uiCode, "vps_depth_modes_flag[i]" ); pcVPS->setVpsDepthModesFlag( i, uiCode == 1 ? true : false );2193 #if SEPARATE_FLAG_I00852194 READ_FLAG( uiCode, "ivp_flag[i]" ); pcVPS->setIVPFlag( i, uiCode == 1 ? true : false );2195 #endif2196 #if MTK_I0099_VPS_EX22197 READ_FLAG( uiCode, "lim_qt_pred_flag[i]"); pcVPS->setLimQtPredFlag ( i, uiCode == 1 ? true : false );2198 #endif2199 #if H_3D_INTER_SDC2200 READ_FLAG( uiCode, "depth_inter_SDC_flag" ); pcVPS->setInterSDCFlag( i, uiCode ? true : false );2201 #endif2202 }2203 }2204 }2205 2206 UInt uiCamParPrecision = 0;2207 Bool bCamParSlice = false;2208 Bool bCamParPresentFlag = false;2209 2210 READ_UVLC( uiCamParPrecision, "cp_precision" );2211 #if SEC_VPS_CLEANUP_I00902212 for (UInt viewIndex=1; viewIndex<pcVPS->getNumViews(); viewIndex++)2213 #else2214 for (UInt viewIndex=0; viewIndex<pcVPS->getNumViews(); viewIndex++)2215 #endif2216 {2217 pcVPS->setCamParPresent ( viewIndex, false );2218 pcVPS->setHasCamParInSliceHeader( viewIndex, false );2219 READ_FLAG( uiCode, "cp_present_flag[i]" ); bCamParPresentFlag = ( uiCode == 1);2220 if ( bCamParPresentFlag )2221 {2222 READ_FLAG( uiCode, "cp_in_slice_segment_header_flag[i]" ); bCamParSlice = ( uiCode == 1);2223 if ( !bCamParSlice )2224 {2225 for( UInt uiBaseIndex = 0; uiBaseIndex < viewIndex; uiBaseIndex++ )2226 {2227 Int iCode;2228 READ_SVLC( iCode, "vps_cp_scale" ); m_aaiTempScale [ uiBaseIndex ][ viewIndex ] = iCode;2229 READ_SVLC( iCode, "vps_cp_off" ); m_aaiTempOffset [ uiBaseIndex ][ viewIndex ] = iCode;2230 READ_SVLC( iCode, "vps_cp_inv_scale_plus_scale" ); m_aaiTempScale [ viewIndex ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ viewIndex ];2231 READ_SVLC( iCode, "vps_cp_inv_off_plus_off" ); m_aaiTempOffset [ viewIndex ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ viewIndex ];2232 }2233 }2234 pcVPS->initCamParaVPS( viewIndex, bCamParPresentFlag, uiCamParPrecision, bCamParSlice, m_aaiTempScale, m_aaiTempOffset );2235 }2236 }2237 #if !MTK_I0099_VPS_EX22238 READ_UVLC (uiCode, "log2_sub_PU_MPI_size_minus3"); pcVPS->setSubPUMPILog2Size( uiCode + 3 );2239 #endif2240 #if !SEC_HLS_CLEANUP_I01002241 READ_FLAG( uiCode, "iv_mv_scaling_flag"); pcVPS->setIvMvScalingFlag( uiCode == 1 ? true : false );2242 #endif2243 }2244 #endif2245 1868 #endif 2246 1869 #if H_MV … … 2299 1922 rpcSlice->setViewId ( vps->getViewId ( rpcSlice->getLayerId() ) ); 2300 1923 rpcSlice->setViewIndex( vps->getViewIndex( rpcSlice->getLayerId() ) ); 2301 #if H_3D2302 rpcSlice->setIsDepth ( vps->getDepthId ( rpcSlice->getLayerId() ) == 1 );2303 #endif2304 1924 #endif 2305 1925 rpcSlice->setSPS(sps); … … 2864 2484 rpcSlice->initWpScaling(); 2865 2485 } 2866 #if H_3D_IC2867 #if SEC_HLS_CLEANUP_I01002868 else if( rpcSlice->getViewIndex() && ( rpcSlice->getSliceType() == P_SLICE || rpcSlice->getSliceType() == B_SLICE ) && !rpcSlice->getIsDepth() && vps->getNumDirectRefLayers( layerId ) > 0 )2869 #else2870 else if( rpcSlice->getViewIndex() && ( rpcSlice->getSliceType() == P_SLICE || rpcSlice->getSliceType() == B_SLICE ) && !rpcSlice->getIsDepth())2871 #endif2872 {2873 UInt uiCodeTmp = 0;2874 2875 READ_FLAG ( uiCodeTmp, "slice_ic_enable_flag" );2876 rpcSlice->setApplyIC( uiCodeTmp );2877 2878 if ( uiCodeTmp )2879 {2880 READ_FLAG ( uiCodeTmp, "ic_skip_mergeidx0" );2881 rpcSlice->setIcSkipParseFlag( uiCodeTmp );2882 }2883 }2884 #endif2885 #if MTK_SINGLE_DEPTH_MODE_I00952886 if(rpcSlice->getIsDepth())2887 {2888 UInt uiCodeTmp = 0;2889 READ_FLAG( uiCodeTmp, "slice_enable_single_depth_mode" );2890 rpcSlice->setApplySingleDepthMode(uiCodeTmp);2891 }2892 #endif2893 2486 if (!rpcSlice->isIntra()) 2894 2487 { 2895 2488 READ_UVLC( uiCode, "five_minus_max_num_merge_cand"); 2896 #if H_3D_IV_MERGE2897 if(rpcSlice->getIsDepth())2898 {2899 Bool bMPIFlag = rpcSlice->getVPS()->getMPIFlag( rpcSlice->getLayerIdInVps() ) ;2900 Bool ivMvPredFlag = rpcSlice->getVPS()->getIvMvPredFlag( rpcSlice->getLayerIdInVps() ) ;2901 rpcSlice->setMaxNumMergeCand(( ( bMPIFlag || ivMvPredFlag ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode);2902 }2903 else2904 {2905 Bool ivMvPredFlag = rpcSlice->getVPS()->getIvMvPredFlag( rpcSlice->getLayerIdInVps() ) ;2906 rpcSlice->setMaxNumMergeCand(( ivMvPredFlag ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode);2907 }2908 2909 #else2910 2489 rpcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); 2911 #endif2912 2490 } 2913 2491 … … 3008 2586 } 3009 2587 3010 #if H_3D3011 #if LGE_FCO_I01163012 if( rpcSlice->getVPS()->hasCamParInSliceHeader( rpcSlice->getViewIndex() ) && rpcSlice->getIsDepth() )3013 #else3014 if( rpcSlice->getVPS()->hasCamParInSliceHeader( rpcSlice->getViewIndex() ) && !rpcSlice->getIsDepth() )3015 #endif3016 {3017 UInt uiViewIndex = rpcSlice->getViewIndex();3018 for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ )3019 {3020 READ_SVLC( iCode, "cp_scale" ); m_aaiTempScale [ uiBaseIndex ][ uiViewIndex ] = iCode;3021 READ_SVLC( iCode, "cp_off" ); m_aaiTempOffset[ uiBaseIndex ][ uiViewIndex ] = iCode;3022 READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); m_aaiTempScale [ uiViewIndex ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ uiViewIndex ];3023 READ_SVLC( iCode, "cp_inv_off_plus_off" ); m_aaiTempOffset[ uiViewIndex ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ uiViewIndex ];3024 }3025 rpcSlice->setCamparaSlice( m_aaiTempScale, m_aaiTempOffset );3026 }3027 #endif3028 2588 3029 2589 if(pps->getSliceHeaderExtensionPresentFlag()) … … 3331 2891 assert(0); 3332 2892 } 3333 #if MTK_SINGLE_DEPTH_MODE_I00953334 Void TDecCavlc::parseSingleDepthMode( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )3335 {3336 assert(0);3337 }3338 #endif3339 2893 Void TDecCavlc::parseCUTransquantBypassFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 3340 2894 { … … 3451 3005 } 3452 3006 3453 #if H_3D_ARP3454 Void TDecCavlc::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )3455 {3456 assert(0);3457 }3458 #endif3459 #if H_3D_IC3460 Void TDecCavlc::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )3461 {3462 assert(0);3463 }3464 #endif3465 #if H_3D_INTER_SDC3466 Void TDecCavlc::parseDeltaDC( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )3467 {3468 assert(0);3469 }3470 3471 Void TDecCavlc::parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )3472 {3473 assert(0);3474 }3475 3476 #endif3477 #if H_3D_DBBP3478 Void TDecCavlc::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )3479 {3480 assert(0);3481 }3482 #endif3483 3007 // ==================================================================================================================== 3484 3008 // Protected member functions -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibDecoder/TDecCAVLC.h
r1066 r1072 63 63 void parseShortTermRefPicSet (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx); 64 64 65 #if H_3D66 Int** m_aaiTempScale;67 Int** m_aaiTempOffset;68 #endif69 65 70 66 public: … … 89 85 Void parseSPSExtension ( TComSPS* pcSPS ); 90 86 #endif 91 #if H_3D92 Void parseVPSExtension2 ( TComVPS* pcVPS );93 Void parseSPSExtension2 ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );94 Void parseSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );95 #else96 87 Void parseSPS ( TComSPS* pcSPS ); 97 #endif98 88 99 89 #if H_MV_HLS10_PPS … … 104 94 105 95 106 #if H_3D107 Void parsePPS ( TComPPS* pcPPS, TComVPS* pcVPS );108 Void parsePPSExtension ( TComPPS* pcPPS, TComVPS* pcVPS );109 #else110 96 Void parsePPS ( TComPPS* pcPPS); 111 #endif112 97 113 98 Void parseVUI ( TComVUI* pcVUI, TComSPS* pcSPS ); … … 126 111 127 112 Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 128 #if MTK_SINGLE_DEPTH_MODE_I0095129 Void parseSingleDepthMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );130 #endif131 113 Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 132 114 Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); 133 115 Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex ); 134 #if H_3D_ARP135 Void parseARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );136 #endif137 #if H_3D_IC138 Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );139 #endif140 #if H_3D_INTER_SDC141 Void parseDeltaDC ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );142 Void parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );143 #endif144 #if H_3D_DBBP145 Void parseDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );146 #endif147 116 Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 148 117 Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibDecoder/TDecCu.cpp
r1066 r1072 50 50 m_ppcYuvReco = NULL; 51 51 m_ppcCU = NULL; 52 #if H_3D_DBBP53 m_ppcYuvRecoDBBP = NULL;54 #endif55 52 } 56 53 … … 78 75 m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1]; 79 76 m_ppcCU = new TComDataCU*[m_uiMaxDepth-1]; 80 #if H_3D_DBBP81 m_ppcYuvRecoDBBP = new TComYuv*[m_uiMaxDepth-1];82 #endif83 77 84 78 UInt uiNumPartitions; … … 92 86 m_ppcYuvReco[ui] = new TComYuv; m_ppcYuvReco[ui]->create( uiWidth, uiHeight ); 93 87 m_ppcCU [ui] = new TComDataCU; m_ppcCU [ui]->create( uiNumPartitions, uiWidth, uiHeight, true, uiMaxWidth >> (m_uiMaxDepth - 1) ); 94 #if H_3D_DBBP95 m_ppcYuvRecoDBBP[ui] = new TComYuv; m_ppcYuvRecoDBBP[ui]->create( uiWidth, uiHeight );96 #endif97 88 } 98 89 … … 115 106 m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL; 116 107 m_ppcCU [ui]->destroy(); delete m_ppcCU [ui]; m_ppcCU [ui] = NULL; 117 #if H_3D_DBBP118 m_ppcYuvRecoDBBP[ui]->destroy(); delete m_ppcYuvRecoDBBP[ui]; m_ppcYuvRecoDBBP[ui] = NULL;119 #endif120 108 } 121 109 … … 123 111 delete [] m_ppcYuvReco; m_ppcYuvReco = NULL; 124 112 delete [] m_ppcCU ; m_ppcCU = NULL; 125 #if H_3D_DBBP126 delete [] m_ppcYuvRecoDBBP; m_ppcYuvRecoDBBP = NULL;127 #endif128 113 } 129 114 … … 150 135 Void TDecCu::decompressCU( TComDataCU* pcCU ) 151 136 { 152 #if !H_3D_IV_MERGE153 137 xDecompressCU( pcCU, 0, 0 ); 154 #endif155 138 } 156 139 … … 293 276 294 277 295 #if H_3D_DDD296 pcCU->setUseDDD( false, uiAbsPartIdx, uiDepth );297 #endif298 278 299 279 if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) … … 302 282 pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP 303 283 } 304 #if H_3D_NBDV305 DisInfo DvInfo;306 DvInfo.bDV = false;307 DvInfo.m_acNBDV.setZero();308 DvInfo.m_aVIdxCan = 0;309 #if H_3D_NBDV_REF310 DvInfo.m_acDoNBDV.setZero();311 #endif312 313 314 if(!pcCU->getSlice()->isIntra())315 {316 #if H_3D_ARP && H_3D_IV_MERGE317 if( pcCU->getSlice()->getVPS()->getUseAdvRP( pcCU->getSlice()->getLayerId() ) || pcCU->getSlice()->getVPS()->getIvMvPredFlag( pcCU->getSlice()->getLayerId() ))318 #else319 #if H_3D_ARP320 if( pcCU->getSlice()->getVPS()->getUseAdvRP(pcCU->getSlice()->getLayerId()) )321 #else322 #if H_3D_IV_MERGE323 if( pcCU->getSlice()->getVPS()->getIvMvPredFlag(pcCU->getSlice()->getLayerId()) )324 #else325 if (0)326 #endif327 #endif328 #endif329 {330 m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true );331 m_ppcCU[uiDepth]->copyDVInfoFrom( pcCU, uiAbsPartIdx);332 PartSize ePartTemp = m_ppcCU[uiDepth]->getPartitionSize(0);333 UChar cWidTemp = m_ppcCU[uiDepth]->getWidth(0);334 UChar cHeightTemp = m_ppcCU[uiDepth]->getHeight(0);335 m_ppcCU[uiDepth]->setWidth ( 0, pcCU->getSlice()->getSPS()->getMaxCUWidth ()/(1<<uiDepth) );336 m_ppcCU[uiDepth]->setHeight ( 0, pcCU->getSlice()->getSPS()->getMaxCUHeight()/(1<<uiDepth) );337 m_ppcCU[uiDepth]->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );338 #if H_3D_IV_MERGE339 if( pcCU->getSlice()->getIsDepth())340 {341 DvInfo.bDV = m_ppcCU[uiDepth]->getDispforDepth(0, 0, &DvInfo);342 }343 else344 {345 #endif346 #if H_3D_NBDV_REF347 if(pcCU->getSlice()->getVPS()->getDepthRefinementFlag( pcCU->getSlice()->getLayerIdInVps() )) //Notes from QC: please check the condition for DoNBDV. Remove this comment once it is done.348 {349 DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo, true);350 }351 else352 #endif353 {354 DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo);355 }356 #if H_3D_IV_MERGE357 }358 #endif359 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC360 if ( g_decTraceDispDer )361 {362 DTRACE_CU( "RefViewIdx", DvInfo.m_aVIdxCan );363 DTRACE_CU( "MvDisp[x]", DvInfo.m_acNBDV.getHor() );364 DTRACE_CU( "MvDisp[y]", DvInfo.m_acNBDV.getVer() );365 DTRACE_CU( "MvRefinedDisp[x]", DvInfo.m_acDoNBDV.getHor() );366 DTRACE_CU( "MvRefinedDisp[y]", DvInfo.m_acDoNBDV.getVer() );367 }368 #endif369 370 pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth);371 m_ppcCU[uiDepth]->setPartSizeSubParts( ePartTemp, 0, uiDepth );372 m_ppcCU[uiDepth]->setWidth ( 0, cWidTemp );373 m_ppcCU[uiDepth]->setHeight ( 0, cHeightTemp );374 }375 }376 #endif377 284 if (pcCU->getSlice()->getPPS()->getTransquantBypassEnableFlag()) 378 285 { … … 395 302 m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); 396 303 m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); 397 #if H_3D_IV_MERGE398 m_ppcCU[uiDepth]->copyDVInfoFrom(pcCU, uiAbsPartIdx);399 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists400 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];401 #else402 304 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists 403 305 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 404 #endif405 306 Int numValidMergeCand = 0; 406 307 for( UInt ui = 0; ui < m_ppcCU[uiDepth]->getSlice()->getMaxNumMergeCand(); ++ui ) … … 410 311 m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, uiDepth ); 411 312 UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx); 412 #if H_3D_ARP 413 m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth ); 414 #endif 415 #if H_3D_IC 416 m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 417 #endif 418 419 #if H_3D_VSP 420 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 421 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 422 #if !FIX_TICKET_79 423 InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM]; 424 #endif 425 #if H_3D_SPIVMP 426 Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM]; 427 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); 428 TComMvField* pcMvFieldSP; 429 UChar* puhInterDirSP; 430 pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2]; 431 puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()]; 432 #endif 433 m_ppcCU[uiDepth]->initAvailableFlags(); 313 434 314 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 435 m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours436 #if !FIX_TICKET_79437 , inheritedVSPDisInfo438 #endif439 #if H_3D_SPIVMP440 , pcMvFieldSP, puhInterDirSP441 #endif442 , numValidMergeCand, uiMergeIndex );443 444 m_ppcCU[uiDepth]->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag445 #if H_3D_SPIVMP446 , bSPIVMPFlag447 #endif448 , numValidMergeCand );449 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );450 #else451 #if H_3D452 m_ppcCU[uiDepth]->initAvailableFlags();453 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );454 m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );455 #else456 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );457 #endif458 #endif459 #if H_3D_VSP && !FIX_TICKET_79460 if(vspFlag[uiMergeIndex])461 {462 pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiAbsPartIdx, 0, uiDepth);463 }464 #endif465 315 pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); 466 316 467 #if H_3D_DDD468 if( uiMergeIndex == m_ppcCU[uiDepth]->getUseDDDCandIdx() )469 {470 assert( pcCU->getSlice()->getViewIndex() != 0 );471 pcCU->setUseDDD( true, uiAbsPartIdx, 0, uiDepth );472 pcCU->setDDDepthSubParts( m_ppcCU[uiDepth]->getDDTmpDepth(),uiAbsPartIdx, 0, uiDepth );473 }474 #endif475 317 476 318 TComMv cTmpMv( 0, 0 ); … … 483 325 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); 484 326 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); 485 #if H_3D_VSP486 if( pcCU->getVSPFlag( uiAbsPartIdx ) != 0 )487 {488 if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) )489 {490 UInt dummy;491 Int vspSize;492 Int width, height;493 m_ppcCU[uiDepth]->getPartIndexAndSize( uiAbsPartIdx, dummy, width, height );494 m_ppcCU[uiDepth]->setMvFieldPUForVSP( pcCU, uiAbsPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize );495 pcCU->setVSPFlag( uiAbsPartIdx, vspSize );496 }497 }498 #endif499 327 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC 500 328 if ( g_decTraceMvFromMerge ) … … 516 344 } 517 345 } 518 #if H_3D_SPIVMP519 pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );520 if (bSPIVMPFlag[uiMergeIndex])521 {522 UInt uiSPAddr;523 Int iWidth = pcCU->getWidth(uiAbsPartIdx);524 Int iHeight = pcCU->getHeight(uiAbsPartIdx);525 526 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;527 528 pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);529 530 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)531 {532 pcCU->getSPAbsPartIdx(uiAbsPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);533 pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);534 pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);535 pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);536 }537 }538 delete[] pcMvFieldSP;539 delete[] puhInterDirSP;540 #endif541 346 542 347 xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); 543 #if H_3D_IV_MERGE544 xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );545 #endif546 348 return; 547 349 } 548 #if MTK_SINGLE_DEPTH_MODE_I0095549 m_pcEntropyDecoder->decodeSingleDepthMode( pcCU, uiAbsPartIdx, uiDepth );550 if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))551 {552 #endif553 350 m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth ); 554 351 m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth ); 555 352 556 #if H_3D_DIM_SDC557 m_pcEntropyDecoder->decodeSDCFlag( pcCU, uiAbsPartIdx, uiDepth );558 #endif559 353 if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) 560 354 { … … 564 358 { 565 359 xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); 566 #if H_3D_IV_MERGE567 xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );568 #endif569 360 return; 570 361 } … … 580 371 m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, uiCurrWidth, uiCurrHeight, bCodeDQP ); 581 372 setdQPFlag( bCodeDQP ); 582 #if MTK_SINGLE_DEPTH_MODE_I0095583 }584 #endif585 373 xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); 586 #if H_3D_IV_MERGE587 xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );588 #endif589 374 } 590 375 … … 602 387 { 603 388 TComPic* pcPic = pcCU->getPic(); 604 #if !H_3D_IV_MERGE605 389 Bool bBoundary = false; 606 390 UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; … … 637 421 return; 638 422 } 639 #endif640 423 // Residual reconstruction 641 424 m_ppcYuvResi[uiDepth]->clear(); … … 657 440 { 658 441 case MODE_INTER: 659 #if H_3D_DBBP660 if( m_ppcCU[uiDepth]->getDBBPFlag(0) )661 {662 xReconInterDBBP( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );663 }664 else665 {666 #endif667 #if H_3D_INTER_SDC668 if( m_ppcCU[uiDepth]->getSDCFlag( 0 ) )669 {670 xReconInterSDC( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );671 }672 else673 {674 #endif675 442 xReconInter( m_ppcCU[uiDepth], uiDepth ); 676 #if H_3D_INTER_SDC677 }678 #endif679 #if H_3D_DBBP680 }681 #endif682 443 break; 683 444 case MODE_INTRA: 684 #if MTK_SINGLE_DEPTH_MODE_I0095685 if( m_ppcCU[uiDepth]->getSingleDepthFlag(0) )686 xReconIntraSingleDepth( m_ppcCU[uiDepth], 0, uiDepth );687 #if H_3D_DIM_SDC688 else if( m_ppcCU[uiDepth]->getSDCFlag(0) )689 xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth );690 #endif691 else692 #else693 #if H_3D_DIM_SDC694 if( m_ppcCU[uiDepth]->getSDCFlag(0) )695 xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth );696 else697 #endif698 #endif699 445 xReconIntraQT( m_ppcCU[uiDepth], uiDepth ); 700 446 break; … … 730 476 } 731 477 } 732 #if MTK_SINGLE_DEPTH_MODE_I0095 733 Void TDecCu::xReconIntraSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 734 { 735 UInt uiWidth = pcCU->getWidth ( 0 ); 736 UInt uiHeight = pcCU->getHeight ( 0 ); 737 738 TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth]; 739 740 UInt uiStride = pcRecoYuv->getStride (); 741 Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); 742 743 744 AOF( uiWidth == uiHeight ); 745 AOF( uiAbsPartIdx == 0 ); 746 747 //construction of depth candidates 748 Pel testDepth; 749 Pel DepthNeighbours[5]; 750 Int index =0; 751 for( Int i = 0; (i < 5) && (index<MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE) ; i++ ) 752 { 753 if(!pcCU->getNeighDepth (0, uiAbsPartIdx, &testDepth, i)) 754 { 755 continue; 756 } 757 DepthNeighbours[index]=testDepth; 758 index++; 759 for(Int j=0;j<index-1;j++) 760 { 761 if( (DepthNeighbours[index-1]==DepthNeighbours[j]) ) 762 { 763 index--; 764 break; 765 } 766 } 767 } 768 769 if(index==0) 770 { 771 DepthNeighbours[index]=1<<(g_bitDepthY-1); 772 index++; 773 } 774 775 if(index==1) 776 { 777 DepthNeighbours[index]=ClipY(DepthNeighbours[0] + 1 ); 778 index++; 779 } 780 781 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 782 { 783 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 784 { 785 piReco[ uiX ] =DepthNeighbours[(Int)pcCU->getSingleDepthValue(uiAbsPartIdx)]; 786 } 787 piReco += uiStride; 788 } 789 790 // clear UV 791 UInt uiStrideC = pcRecoYuv->getCStride(); 792 Pel *pRecCb = pcRecoYuv->getCbAddr(); 793 Pel *pRecCr = pcRecoYuv->getCrAddr(); 794 795 for (Int y=0; y<uiHeight/2; y++) 796 { 797 for (Int x=0; x<uiWidth/2; x++) 798 { 799 pRecCb[x] = 1<<(g_bitDepthC-1); 800 pRecCr[x] = 1<<(g_bitDepthC-1); 801 } 802 803 pRecCb += uiStrideC; 804 pRecCr += uiStrideC; 805 } 806 } 807 #endif 808 #if H_3D_INTER_SDC 809 Void TDecCu::xReconInterSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 810 { 811 // inter prediction 812 m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] ); 813 814 UInt uiWidth = pcCU->getWidth ( 0 ); 815 UInt uiHeight = pcCU->getHeight( 0 ); 816 817 Pel *pResi; 818 UInt uiPelX, uiPelY; 819 UInt uiResiStride = m_ppcYuvResi[uiDepth]->getStride(); 820 821 pResi = m_ppcYuvResi[uiDepth]->getLumaAddr( 0 ); 822 for( uiPelY = 0; uiPelY < uiHeight; uiPelY++ ) 823 { 824 for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ ) 825 { 826 pResi[ uiPelX ] = pcCU->getSDCSegmentDCOffset( 0, 0 ); 827 } 828 pResi += uiResiStride; 829 } 830 831 m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) ); 832 833 // clear UV 834 UInt uiStrideC = m_ppcYuvReco[uiDepth]->getCStride(); 835 Pel *pRecCb = m_ppcYuvReco[uiDepth]->getCbAddr(); 836 Pel *pRecCr = m_ppcYuvReco[uiDepth]->getCrAddr(); 837 838 for (Int y = 0; y < uiHeight/2; y++) 839 { 840 for (Int x = 0; x < uiWidth/2; x++) 841 { 842 pRecCb[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) ); 843 pRecCr[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) ); 844 } 845 846 pRecCb += uiStrideC; 847 pRecCr += uiStrideC; 848 } 849 } 850 #endif 851 852 #if H_3D_DBBP 853 Void TDecCu::xReconInterDBBP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 854 { 855 AOF(!pcCU->getSlice()->getIsDepth()); 856 AOF(!pcCU->getSlice()->isIntra()); 857 PartSize ePartSize = pcCU->getPartitionSize( 0 ); 858 859 // get collocated depth block 860 UInt uiDepthStride = 0; 861 #if LGE_FCO_I0116 862 Pel* pDepthPels = pcCU->getVirtualDepthBlock(pcCU->getZorderIdxInCU(), pcCU->getWidth(0), pcCU->getHeight(0), uiDepthStride); 863 #else 864 Pel* pDepthPels = pcCU->getVirtualDepthBlock(0, pcCU->getWidth(0), pcCU->getHeight(0), uiDepthStride); 865 #endif 866 AOF( pDepthPels != NULL ); 867 AOF( uiDepthStride != 0 ); 868 869 // compute mask by segmenting depth block 870 Bool pMask[MAX_CU_SIZE*MAX_CU_SIZE]; 871 Bool bValidMask = m_pcPrediction->getSegmentMaskFromDepth(pDepthPels, uiDepthStride, pcCU->getWidth(0), pcCU->getHeight(0), pMask); 872 AOF(bValidMask); 873 874 DBBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData(); 875 TComYuv* apSegPredYuv[2] = { m_ppcYuvReco[uiDepth], m_ppcYuvRecoDBBP[uiDepth] }; 876 877 // first, extract the two sets of motion parameters 878 UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4; 879 for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) 880 { 881 UInt uiPartAddr = uiSegment*uiPUOffset; 882 883 pDBBPTmpData->auhInterDir[uiSegment] = pcCU->getInterDir(uiPartAddr); 884 885 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 886 { 887 RefPicList eRefList = (RefPicList)uiRefListIdx; 888 pcCU->getMvField(pcCU, uiPartAddr, eRefList, pDBBPTmpData->acMvField[uiSegment][eRefList]); 889 } 890 891 AOF( pcCU->getARPW(uiPartAddr) == 0 ); 892 AOF( pcCU->getICFlag(uiPartAddr) == false ); 893 AOF( pcCU->getSPIVMPFlag(uiPartAddr) == false ); 894 AOF( pcCU->getVSPFlag(uiPartAddr) == 0 ); 895 } 896 897 // do motion compensation for each segment as 2Nx2N 898 pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 899 pcCU->setPredModeSubParts( MODE_INTER, 0, uiDepth ); 900 for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) 901 { 902 pcCU->setInterDirSubParts( pDBBPTmpData->auhInterDir[uiSegment], 0, 0, uiDepth ); 903 904 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 905 { 906 RefPicList eRefList = (RefPicList)uiRefListIdx; 907 908 pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], SIZE_2Nx2N, 0, 0 ); 909 } 910 911 // inter prediction 912 m_pcPrediction->motionCompensation( pcCU, apSegPredYuv[uiSegment] ); 913 } 914 915 // restore motion information in both segments again 916 pcCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); 917 pcCU->setPredModeSubParts( MODE_INTER, 0, uiDepth ); 918 for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) 919 { 920 UInt uiPartAddr = uiSegment*uiPUOffset; 921 922 pcCU->setDBBPFlagSubParts(true, uiPartAddr, uiSegment, uiDepth); 923 pcCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[uiSegment], uiPartAddr, uiSegment, uiDepth); // interprets depth relative to LCU level 924 925 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 926 { 927 RefPicList eRefList = (RefPicList)uiRefListIdx; 928 929 pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], ePartSize, uiPartAddr, 0, uiSegment ); // interprets depth relative to rpcTempCU level 930 } 931 } 932 933 // reconstruct final prediction signal by combining both segments 934 #if SHARP_DBBP_SIMPLE_FLTER_I0109 935 m_pcPrediction->combineSegmentsWithMask(apSegPredYuv, m_ppcYuvReco[uiDepth], pMask, pcCU->getWidth(0), pcCU->getHeight(0), 0, ePartSize); 936 #else 937 m_pcPrediction->combineSegmentsWithMask(apSegPredYuv, m_ppcYuvReco[uiDepth], pMask, pcCU->getWidth(0), pcCU->getHeight(0)); 938 #endif 939 940 // inter recon 941 xDecodeInterTexture( pcCU, 0, uiDepth ); 942 943 // clip for only non-zero cbp case 944 if ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V ) ) ) 945 { 946 m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) ); 947 } 948 else 949 { 950 m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 )); 951 } 952 } 953 #endif 478 954 479 955 480 Void … … 988 513 989 514 //===== get prediction signal ===== 990 #if H_3D_DIM991 if( isDimMode( uiLumaPredMode ) )992 {993 m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight );994 }995 else996 {997 #endif998 515 m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 999 #if H_3D_DIM 1000 } 1001 #endif 1002 1003 #if H_3D 1004 Bool useDltFlag = (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()); 1005 1006 if ( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth ) || useDltFlag ) 1007 #else 516 1008 517 if ( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth ) ) 1009 #endif1010 518 { 1011 519 //===== inverse transform ===== … … 1114 622 { 1115 623 uiChromaPredMode = pcCU->getLumaIntraDir( 0 ); 1116 #if H_3D_DIM1117 mapDepthModeToIntraDir( uiChromaPredMode );1118 #endif1119 624 } 1120 625 m_pcPrediction->predIntraChromaAng( pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); … … 1203 708 } 1204 709 1205 #if H_3D_DIM_SDC1206 Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )1207 {1208 UInt uiWidth = pcCU->getWidth ( 0 );1209 UInt uiHeight = pcCU->getHeight ( 0 );1210 TComWedgelet* dmm4SegmentationOrg = new TComWedgelet( uiWidth, uiHeight );1211 UInt numParts = 1;1212 UInt sdcDepth = 0;1213 TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth];1214 TComYuv* pcPredYuv = m_ppcYuvReco[uiDepth];1215 TComYuv* pcResiYuv = m_ppcYuvResi[uiDepth];1216 1217 UInt uiStride = 0;1218 Pel* piReco;1219 Pel* piPred;1220 Pel* piResi;1221 1222 UInt uiZOrder;1223 Pel* piRecIPred;1224 UInt uiRecIPredStride;1225 1226 UInt uiLumaPredMode = 0;1227 1228 if ((uiWidth >> pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize()) > 1)1229 {1230 numParts = uiWidth * uiWidth >> (2 * pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize());1231 sdcDepth = g_aucConvertToBit[uiWidth] + 2 - pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize();1232 uiWidth = uiHeight = (1 << pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize());1233 }1234 1235 for ( Int i = 0; i < numParts; i++ )1236 {1237 uiStride = pcRecoYuv->getStride ();1238 piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx );1239 piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx );1240 piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx );1241 1242 uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx;1243 piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );1244 uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride ();1245 1246 uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx );1247 1248 AOF( uiWidth == uiHeight );1249 1250 //===== init availability pattern =====1251 Bool bAboveAvail = false;1252 Bool bLeftAvail = false;1253 1254 pcCU->getPattern()->initPattern ( pcCU, sdcDepth, uiAbsPartIdx );1255 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, sdcDepth, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail );1256 1257 TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight );1258 //===== get prediction signal =====1259 if( isDimMode( uiLumaPredMode ) )1260 {1261 m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, false, dmm4Segmentation );1262 Bool* dmm4PatternSplit = dmm4Segmentation->getPattern();1263 Bool* dmm4PatternOrg = dmm4SegmentationOrg->getPattern();1264 for( UInt k = 0; k < (uiWidth*uiHeight); k++ )1265 {1266 dmm4PatternOrg[k+(uiAbsPartIdx<<4)] = dmm4PatternSplit[k];1267 }1268 }1269 else1270 {1271 m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );1272 }1273 1274 if ( numParts > 1 )1275 {1276 for( UInt uiY = 0; uiY < uiHeight; uiY++ )1277 {1278 for( UInt uiX = 0; uiX < uiWidth; uiX++ )1279 {1280 piReco [ uiX ] = ClipY( piPred[ uiX ] );1281 piRecIPred [ uiX ] = piReco[ uiX ];1282 }1283 piPred += uiStride;1284 piReco += uiStride;1285 piRecIPred += uiRecIPredStride;1286 }1287 }1288 uiAbsPartIdx += ( (uiWidth * uiWidth) >> 4 );1289 dmm4Segmentation->destroy(); delete dmm4Segmentation;1290 }1291 uiAbsPartIdx = 0;1292 1293 if ( numParts > 1 )1294 {1295 uiWidth = pcCU->getWidth( 0 );1296 uiHeight = pcCU->getHeight( 0 );1297 }1298 piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx );1299 piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx );1300 piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx );1301 uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx;1302 piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );1303 uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride ();1304 // number of segments depends on prediction mode1305 UInt uiNumSegments = 1;1306 Bool* pbMask = NULL;1307 UInt uiMaskStride = 0;1308 1309 if( getDimType( uiLumaPredMode ) == DMM1_IDX )1310 {1311 Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx);1312 1313 #if SHARP_DMM1_I01101314 WedgeList* pacWedgeList = pcCU->isDMM1UpscaleMode(uiWidth) ? &g_dmmWedgeLists[(g_aucConvertToBit[pcCU->getDMM1BasePatternWidth(uiWidth)])] : &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])];1315 #else1316 WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])];1317 #endif1318 TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx ));1319 1320 uiNumSegments = 2;1321 1322 #if SHARP_DMM1_I01101323 pbMask = pcCU->isDMM1UpscaleMode( uiWidth ) ? pcWedgelet->getScaledPattern(uiWidth) : pcWedgelet->getPattern();1324 uiMaskStride = pcCU->isDMM1UpscaleMode( uiWidth ) ? uiWidth : pcWedgelet->getStride();1325 #else1326 pbMask = pcWedgelet->getPattern();1327 uiMaskStride = pcWedgelet->getStride();1328 #endif1329 }1330 if( getDimType( uiLumaPredMode ) == DMM4_IDX )1331 {1332 uiNumSegments = 2;1333 pbMask = dmm4SegmentationOrg->getPattern();1334 uiMaskStride = dmm4SegmentationOrg->getStride();1335 }1336 // get DC prediction for each segment1337 Pel apDCPredValues[2];1338 if ( getDimType( uiLumaPredMode ) == DMM1_IDX || getDimType( uiLumaPredMode ) == DMM4_IDX )1339 {1340 apDCPredValues[0] = pcCU->getDmmPredictor( 0 );1341 apDCPredValues[1] = pcCU->getDmmPredictor( 1 );1342 }1343 else1344 {1345 m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode);1346 }1347 1348 // reconstruct residual based on mask + DC residuals1349 Pel apDCResiValues[2];1350 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )1351 {1352 #if H_3D_DIM_DLT1353 Pel pPredIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );1354 Pel pResiIdx = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);1355 Pel pRecoValue = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );1356 1357 apDCResiValues[uiSegment] = pRecoValue - apDCPredValues[uiSegment];1358 #else1359 apDCResiValues[uiSegment] = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);1360 #endif1361 }1362 1363 //===== reconstruction =====1364 Bool*pMask = pbMask;1365 Pel* pPred = piPred;1366 Pel* pResi = piResi;1367 Pel* pReco = piReco;1368 Pel* pRecIPred = piRecIPred;1369 1370 for( UInt uiY = 0; uiY < uiHeight; uiY++ )1371 {1372 for( UInt uiX = 0; uiX < uiWidth; uiX++ )1373 {1374 UChar ucSegment = pMask?(UChar)pMask[uiX]:0;1375 assert( ucSegment < uiNumSegments );1376 1377 Pel pResiDC = apDCResiValues[ucSegment];1378 1379 pReco [ uiX ] = ClipY( pPred[ uiX ] + pResiDC );1380 pRecIPred[ uiX ] = pReco[ uiX ];1381 }1382 pPred += uiStride;1383 pResi += uiStride;1384 pReco += uiStride;1385 pRecIPred += uiRecIPredStride;1386 pMask += uiMaskStride;1387 }1388 1389 // clear UV1390 UInt uiStrideC = pcPredYuv->getCStride();1391 Pel *pRecCb = pcPredYuv->getCbAddr();1392 Pel *pRecCr = pcPredYuv->getCrAddr();1393 1394 for (Int y=0; y<uiHeight/2; y++)1395 {1396 for (Int x=0; x<uiWidth/2; x++)1397 {1398 pRecCb[x] = 128;1399 pRecCr[x] = 128;1400 }1401 1402 pRecCb += uiStrideC;1403 pRecCr += uiStrideC;1404 }1405 dmm4SegmentationOrg->destroy(); delete dmm4SegmentationOrg;1406 }1407 #endif1408 710 1409 711 /** Function for deriving recontructed PU/CU Luma sample with QTree structure -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibDecoder/TDecCu.h
r1039 r1072 63 63 TComDataCU** m_ppcCU; ///< CU data array 64 64 65 #if H_3D_DBBP66 TComYuv** m_ppcYuvRecoDBBP;67 #endif68 65 69 66 // access channel … … 102 99 Void xReconInter ( TComDataCU* pcCU, UInt uiDepth ); 103 100 104 #if H_3D_DBBP105 Void xReconInterDBBP ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );106 #endif107 101 108 102 Void xReconIntraQT ( TComDataCU* pcCU, UInt uiDepth ); … … 123 117 Void setdQPFlag ( Bool b ) { m_bDecodeDQP = b; } 124 118 Void xFillPCMBuffer (TComDataCU* pCU, UInt depth); 125 #if MTK_SINGLE_DEPTH_MODE_I0095126 Void xReconIntraSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );127 #endif128 #if H_3D_DIM_SDC129 Void xReconIntraSDC ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );130 #endif131 #if H_3D_INTER_SDC132 Void xReconInterSDC ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );133 #endif134 119 }; 135 120 -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibDecoder/TDecEntropy.cpp
r1039 r1072 52 52 m_pcEntropyDecoderIf->parseSkipFlag( pcCU, uiAbsPartIdx, uiDepth ); 53 53 } 54 #if MTK_SINGLE_DEPTH_MODE_I009555 Void TDecEntropy::decodeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )56 {57 if ( !pcCU->getSlice()->getIsDepth() )58 {59 return;60 }61 if(!pcCU->getSlice()->getApplySingleDepthMode())62 {63 return;64 }65 m_pcEntropyDecoderIf->parseSingleDepthMode( pcCU, uiAbsPartIdx, uiDepth );66 }67 #endif68 54 Void TDecEntropy::decodeCUTransquantBypassFlag(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 69 55 { … … 100 86 } 101 87 102 #if H_3D_ARP 103 Void TDecEntropy::decodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 104 { 105 if( !pcCU->getSlice()->getARPStepNum() || pcCU->isIntra( uiAbsPartIdx ) ) 106 { 107 return; 108 } 109 110 if( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) 111 { 112 pcCU->setARPWSubParts( 0 , uiAbsPartIdx, uiDepth ); 113 } 114 else 115 { 116 m_pcEntropyDecoderIf->parseARPW( pcCU , uiAbsPartIdx , uiDepth ); 117 } 118 } 119 #endif 120 121 #if H_3D_IC 122 Void TDecEntropy::decodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 123 { 124 pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth ); 125 126 if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() || pcCU->getARPW( uiAbsPartIdx ) > 0 ) 127 { 128 return; 129 } 130 131 if( !pcCU->getSlice()->getApplyIC() ) 132 return; 133 134 if( pcCU->isICFlagRequired( uiAbsPartIdx ) ) 135 m_pcEntropyDecoderIf->parseICFlag( pcCU, uiAbsPartIdx, uiDepth ); 136 } 137 #endif 88 138 89 139 90 Void TDecEntropy::decodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) … … 151 102 m_pcEntropyDecoderIf->parsePartSize( pcCU, uiAbsPartIdx, uiDepth ); 152 103 153 #if H_3D_DBBP154 155 #if SEC_DBBP_EXPLICIT_SIG_I0077156 #if SEC_DBBP_DISALLOW_8x8_I0078157 if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && pcCU->getWidth(uiAbsPartIdx) > 8 )158 #else159 if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) )160 #endif161 #else162 #if SEC_DBBP_DISALLOW_8x8_I0078163 if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && pcCU->getWidth(uiAbsPartIdx) > 8 )164 #else165 if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) )166 #endif167 #endif168 {169 decodeDBBPFlag(pcCU, uiAbsPartIdx, uiDepth);170 #if !SEC_DBBP_EXPLICIT_SIG_I0077171 if( pcCU->getDBBPFlag(uiAbsPartIdx) )172 {173 174 // get collocated depth block175 UInt uiDepthStride = 0;176 Pel* pDepthPels = NULL;177 pDepthPels = pcCU->getVirtualDepthBlock(uiAbsPartIdx, pcCU->getWidth(uiAbsPartIdx), pcCU->getHeight(uiAbsPartIdx), uiDepthStride);178 179 AOF( pDepthPels != NULL );180 AOF( uiDepthStride != 0 );181 182 // derive true partitioning for this CU based on depth183 // (needs to be done in parsing process as motion vector predictors are also derived during parsing)184 PartSize eVirtualPartSize = m_pcPrediction->getPartitionSizeFromDepth(pDepthPels, uiDepthStride, pcCU->getWidth(uiAbsPartIdx));185 AOF( eVirtualPartSize != SIZE_NONE );186 187 pcCU->setPartSizeSubParts(eVirtualPartSize, uiAbsPartIdx, uiDepth);188 189 // make sure that DBBP flag is set for both segments190 UInt uiPUOffset = ( g_auiPUOffset[UInt( eVirtualPartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4;191 pcCU->setDBBPFlagSubParts(true, uiAbsPartIdx, 0, uiDepth);192 pcCU->setDBBPFlagSubParts(true, uiAbsPartIdx+uiPUOffset, 1, uiDepth);193 }194 #endif195 }196 #endif197 104 } 198 105 … … 202 109 { 203 110 decodeIntraDirModeLuma ( pcCU, uiAbsPartIdx, uiDepth ); 204 #if H_3D_DIM_SDC205 if(!pcCU->getSDCFlag(uiAbsPartIdx))206 #endif207 111 decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); 208 112 } … … 254 158 UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4; 255 159 256 #if H_3D_IV_MERGE257 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists258 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];259 #else260 160 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists 261 161 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 262 #endif263 #if H_3D_SPIVMP264 Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];265 TComMvField* pcMvFieldSP;266 UChar* puhInterDirSP;267 pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2];268 puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()];269 #endif270 162 for ( UInt ui = 0; ui < pcCU->getSlice()->getMaxNumMergeCand(); ui++ ) 271 163 { … … 277 169 pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); 278 170 pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); 279 #if H_3D_IV_MERGE280 pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx);281 #endif282 171 for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset ) 283 172 { … … 293 182 decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth ); 294 183 UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 295 #if H_3D_ARP296 decodeARPW ( pcCU, uiAbsPartIdx, uiDepth );297 #endif298 #if H_3D_IC299 decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );300 #endif301 #if H_3D_DBBP302 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(uiAbsPartIdx) == false )303 #else304 184 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) 305 #endif306 185 { 307 186 pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 308 187 if ( !isMerged ) 309 188 { 310 #if H_3D_VSP311 Int vspFlag[MRG_MAX_NUM_CANDS_MEM];312 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);313 #if !FIX_TICKET_79314 InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];315 #endif316 #if H_3D_SPIVMP317 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);318 #endif319 pcSubCU->initAvailableFlags();320 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);321 pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours322 #if !FIX_TICKET_79323 , inheritedVSPDisInfo324 #endif325 #if H_3D_SPIVMP326 , pcMvFieldSP, puhInterDirSP327 #endif328 , numValidMergeCand );329 pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag330 #if H_3D_SPIVMP331 , bSPIVMPFlag332 #endif333 , numValidMergeCand );334 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );335 336 #if !FIX_TICKET_79337 if(vspFlag[uiMergeIndex])338 {339 pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiSubPartIdx, uiPartIdx, uiDepth);340 }341 #endif342 #else343 #if H_3D344 pcSubCU->initAvailableFlags();345 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);346 pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );347 348 #else349 189 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 350 #endif351 #endif352 190 isMerged = true; 353 191 } … … 357 195 { 358 196 uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 359 #if H_3D_VSP360 Int vspFlag[MRG_MAX_NUM_CANDS_MEM];361 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);362 #if !FIX_TICKET_79363 InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];364 #endif365 #if H_3D_SPIVMP366 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);367 #endif368 pcSubCU->initAvailableFlags();369 197 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 370 pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours371 #if !FIX_TICKET_79372 , inheritedVSPDisInfo373 #endif374 #if H_3D_SPIVMP375 , pcMvFieldSP, puhInterDirSP376 #endif377 ,numValidMergeCand, uiMergeIndex );378 pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag379 #if H_3D_SPIVMP380 , bSPIVMPFlag381 #endif382 ,numValidMergeCand );383 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );384 #if !FIX_TICKET_79385 if(vspFlag[uiMergeIndex])386 {387 pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiSubPartIdx, uiPartIdx, uiDepth);388 }389 #endif390 #else391 #if H_3D392 pcSubCU->initAvailableFlags();393 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );394 pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );395 #else396 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );397 #endif398 #endif399 198 } 400 199 pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 401 200 402 #if H_3D_DDD403 if( uiMergeIndex == pcSubCU->getUseDDDCandIdx() )404 {405 assert( pcCU->getSlice()->getViewIndex() != 0 );406 pcCU->setUseDDD( true, uiSubPartIdx, uiPartIdx, uiDepth );407 pcCU->setDDDepthSubParts( pcSubCU->getDDTmpDepth(),uiSubPartIdx, uiPartIdx, uiDepth );408 }409 else410 {411 pcCU->setUseDDD( false, uiSubPartIdx, uiPartIdx, uiDepth );412 }413 #endif414 201 415 202 TComMv cTmpMv( 0, 0 ); … … 422 209 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); 423 210 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); 424 #if H_3D_VSP425 #if H_3D_DBBP426 if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 && !pcCU->getDBBPFlag( uiAbsPartIdx ) )427 #else428 if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 )429 #endif430 {431 if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) )432 {433 UInt dummy;434 Int vspSize;435 Int width, height;436 pcCU->getPartIndexAndSize( uiPartIdx, dummy, width, height, uiSubPartIdx, pcCU->getTotalNumPart()==256 );437 pcCU->setMvFieldPUForVSP( pcCU, uiSubPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize );438 pcCU->setVSPFlag( uiSubPartIdx, vspSize );439 }440 }441 #endif442 211 } 443 212 } 444 #if H_3D_SPIVMP445 pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );446 if (bSPIVMPFlag[uiMergeIndex] != 0)447 {448 Int iWidth, iHeight;449 UInt uiIdx;450 pcCU->getPartIndexAndSize( uiPartIdx, uiIdx, iWidth, iHeight, uiSubPartIdx, true );451 452 UInt uiSPAddr;453 454 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;455 456 pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);457 458 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)459 {460 pcCU->getSPAbsPartIdx(uiSubPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);461 pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);462 pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);463 pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);464 }465 }466 #endif467 213 } 468 214 else … … 478 224 } 479 225 } 480 #if H_3D_ARP 481 decodeARPW ( pcCU, uiAbsPartIdx, uiDepth ); 482 #endif 483 #if H_3D_IC 484 decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 485 #endif 486 } 487 #if H_3D_VSP && !FIX_TICKET_75 488 if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) && (pcCU->getVSPFlag(uiSubPartIdx) == 0)) 489 #else 226 } 490 227 if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) ) 491 #endif492 228 { 493 229 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( TComMv(0,0), ePartSize, uiSubPartIdx, uiDepth, uiPartIdx); … … 496 232 } 497 233 } 498 #if H_3D_SPIVMP499 delete[] pcMvFieldSP;500 delete[] puhInterDirSP;501 #endif502 234 return; 503 235 } … … 824 556 UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx; 825 557 UInt uiChromaOffset = uiLumaOffset>>2; 826 #if H_3D_DIM_SDC827 if( pcCU->getSDCFlag( uiAbsPartIdx ) && pcCU->isIntra( uiAbsPartIdx) )828 {829 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );830 assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 );831 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 );832 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 );833 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 );834 }835 836 #if H_3D_INTER_SDC837 if( pcCU->getSDCFlag( uiAbsPartIdx ) && !pcCU->isIntra( uiAbsPartIdx) )838 {839 assert( !pcCU->isSkipped( uiAbsPartIdx ) );840 assert( !pcCU->isIntra( uiAbsPartIdx) );841 assert( pcCU->getSlice()->getIsDepth() );842 }843 #endif844 if( pcCU->getSlice()->getIsDepth() && ( pcCU->getSDCFlag( uiAbsPartIdx ) || pcCU->isIntra( uiAbsPartIdx ) ) )845 {846 Int iPartNum = ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ? 4 : 1;847 UInt uiPartOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth( uiAbsPartIdx ) << 1 ) ) >> 2;848 849 if( !pcCU->getSDCFlag( uiAbsPartIdx ) )850 {851 for( Int iPart = 0; iPart < iPartNum; iPart++ )852 {853 if( getDimType( pcCU->getLumaIntraDir( uiAbsPartIdx + uiPartOffset*iPart ) ) < DIM_NUM_TYPE )854 {855 m_pcEntropyDecoderIf->parseDeltaDC( pcCU, uiAbsPartIdx + uiPartOffset*iPart, uiDepth + ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) );856 }857 }858 }859 else860 {861 m_pcEntropyDecoderIf->parseDeltaDC( pcCU, uiAbsPartIdx, uiDepth );862 return;863 }864 }865 #endif866 558 867 559 if( pcCU->isIntra(uiAbsPartIdx) ) … … 889 581 } 890 582 891 #if H_3D_INTER_SDC892 Void TDecEntropy::decodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )893 {894 pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth );895 896 if( ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) ) ||897 ( pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getVpsDepthModesFlag( pcCU->getSlice()->getLayerIdInVps() ) ) )898 {899 return;900 }901 902 if( !pcCU->getSlice()->getIsDepth() || pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_2Nx2N || pcCU->isSkipped( uiAbsPartIdx ) )903 {904 return;905 }906 907 assert( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N || ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->isSkipped( uiAbsPartIdx ) ) );908 m_pcEntropyDecoderIf->parseSDCFlag( pcCU, uiAbsPartIdx, uiDepth );909 }910 #endif911 #if H_3D_DBBP912 Void TDecEntropy::decodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )913 {914 m_pcEntropyDecoderIf->parseDBBPFlag( pcCU, uiAbsPartIdx, uiDepth );915 }916 #endif917 583 918 584 //! \} -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibDecoder/TDecEntropy.h
r1039 r1072 66 66 67 67 virtual Void parseVPS ( TComVPS* pcVPS ) = 0; 68 #if H_3D69 virtual Void parseSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) = 0;70 #else71 68 virtual Void parseSPS ( TComSPS* pcSPS ) = 0; 72 #endif73 #if H_3D74 virtual Void parsePPS ( TComPPS* pcPPS, TComVPS* pcVPS ) = 0;75 #else76 69 virtual Void parsePPS ( TComPPS* pcPPS ) = 0; 77 #endif78 70 79 71 #if H_MV … … 89 81 public: 90 82 virtual Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 91 #if MTK_SINGLE_DEPTH_MODE_I009592 virtual Void parseSingleDepthMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;93 #endif94 83 virtual Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 95 84 virtual Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 96 85 virtual Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) = 0; 97 86 virtual Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex ) = 0; 98 #if H_3D_ARP99 virtual Void parseARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;100 #endif101 #if H_3D_IC102 virtual Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;103 #endif104 #if H_3D_INTER_SDC105 virtual Void parseDeltaDC ( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) = 0;106 virtual Void parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;107 #endif108 #if H_3D_DBBP109 virtual Void parseDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;110 #endif111 87 virtual Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 112 88 virtual Void parsePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; … … 157 133 Void resetEntropy ( TComSlice* p) { m_pcEntropyDecoderIf->resetEntropy(p); } 158 134 Void decodeVPS ( TComVPS* pcVPS ) { m_pcEntropyDecoderIf->parseVPS(pcVPS); } 159 #if H_3D160 Void decodeSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) { m_pcEntropyDecoderIf->parseSPS(pcSPS, viewIndex, depthFlag ); }161 #else162 135 Void decodeSPS ( TComSPS* pcSPS ) { m_pcEntropyDecoderIf->parseSPS(pcSPS); } 163 #endif164 #if H_3D165 Void decodePPS ( TComPPS* pcPPS, TComVPS* pcVPS ) { m_pcEntropyDecoderIf->parsePPS(pcPPS, pcVPS); }166 #else167 136 Void decodePPS ( TComPPS* pcPPS ) { m_pcEntropyDecoderIf->parsePPS(pcPPS); } 168 #endif169 137 #if H_MV 170 138 Void decodeSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, Int targetOlsIdx) { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager, targetOlsIdx ); } … … 179 147 Void decodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 180 148 Void decodeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 181 #if MTK_SINGLE_DEPTH_MODE_I0095182 Void decodeSingleDepthMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) ;183 #endif184 149 Void decodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 185 150 Void decodeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); … … 188 153 Void decodePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 189 154 190 #if H_3D_ARP191 Void decodeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );192 #endif193 #if H_3D_IC194 Void decodeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );195 #endif196 #if H_3D_INTER_SDC197 Void decodeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );198 #endif199 #if H_3D_DBBP200 Void decodeDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );201 #endif202 155 Void decodeIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 203 156 -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibDecoder/TDecGop.cpp
r976 r1072 138 138 m_pcEntropyDecoder->setBitstream ( ppcSubstreams[0] ); 139 139 m_pcEntropyDecoder->resetEntropy (pcSlice); 140 #if H_3D_NBDV141 if(pcSlice->getViewIndex() && !pcSlice->getIsDepth()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done.142 {143 Int iColPoc = pcSlice->getRefPOC(RefPicList(1-pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx());144 rpcPic->setNumDdvCandPics(rpcPic->getDisCandRefPictures(iColPoc));145 }146 147 if(pcSlice->getViewIndex() && !pcSlice->getIsDepth() && !pcSlice->isIntra()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done.148 {149 rpcPic->checkTemporalIVRef();150 }151 152 if(pcSlice->getIsDepth())153 {154 rpcPic->checkTextureRef();155 }156 #endif157 #if H_3D158 pcSlice->setDepthToDisparityLUTs();159 #endif160 140 m_pcSbacDecoders[0].load(m_pcSbacDecoder); 161 141 m_pcSliceDecoder->decompressSlice( ppcSubstreams, rpcPic, m_pcSbacDecoder, m_pcSbacDecoders); … … 191 171 m_pcSAO->PCMLFDisableProcess(rpcPic); 192 172 } 193 #if H_3D194 rpcPic->compressMotion(2);195 #endif196 #if !H_3D197 173 rpcPic->compressMotion(); 198 #endif199 174 Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B'); 200 175 if (!pcSlice->isReferenced()) c += 32; -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibDecoder/TDecSbac.cpp
r1066 r1072 52 52 , m_cCUSplitFlagSCModel ( 1, 1, NUM_SPLIT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels ) 53 53 , m_cCUSkipFlagSCModel ( 1, 1, NUM_SKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 54 #if MTK_SINGLE_DEPTH_MODE_I009555 , m_cCUSingleDepthFlagSCModel ( 1, 1, NUM_SINGLEDEPTH_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)56 , m_cSingleDepthValueSCModel ( 1, 1, NUM_SINGLE_DEPTH_VALUE_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels)57 #endif58 54 , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 59 55 , m_cCUMergeIdxExtSCModel ( 1, 1, NUM_MERGE_IDX_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 60 #if H_3D_ARP61 , m_cCUPUARPWSCModel ( 1, 1, NUM_ARPW_CTX , m_contextModels + m_numContextModels, m_numContextModels)62 #endif63 #if H_3D_IC64 , m_cCUICFlagSCModel ( 1, 1, NUM_IC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)65 #endif66 56 , m_cCUPartSizeSCModel ( 1, 1, NUM_PART_SIZE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 67 57 , m_cCUPredModeSCModel ( 1, 1, NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 86 76 , m_cTransformSkipSCModel ( 1, 2, NUM_TRANSFORMSKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 87 77 , m_CUTransquantBypassFlagSCModel( 1, 1, NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX, m_contextModels + m_numContextModels, m_numContextModels) 88 #if H_3D_DIM89 , m_cDepthIntraModeSCModel ( 1, 1, NUM_DEPTH_INTRA_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels)90 , m_cDdcFlagSCModel ( 1, 1, NUM_DDC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)91 , m_cDdcDataSCModel ( 1, 1, NUM_DDC_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels)92 , m_cAngleFlagSCModel ( 1, 1, NUM_ANGLE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)93 #if H_3D_DIM_SDC94 , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)95 , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels)96 #endif97 #endif98 #if H_3D_DIM_SDC99 , m_cSDCFlagSCModel ( 1, 1, NUM_SDC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)100 #endif101 #if H_3D_DBBP102 , m_cDBBPFlagSCModel ( 1, 1, DBBP_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)103 #endif104 78 { 105 79 assert( m_numContextModels <= MAX_NUM_CTX_MOD ); … … 136 110 m_cCUSplitFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SPLIT_FLAG ); 137 111 m_cCUSkipFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SKIP_FLAG ); 138 #if MTK_SINGLE_DEPTH_MODE_I0095139 m_cCUSingleDepthFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SINGLEDEPTH_FLAG );140 m_cSingleDepthValueSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );141 #endif142 112 m_cCUMergeFlagExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT ); 143 113 m_cCUMergeIdxExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_IDX_EXT ); 144 #if H_3D_ARP145 m_cCUPUARPWSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ARPW );146 #endif147 #if H_3D_IC148 m_cCUICFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_IC_FLAG );149 #endif150 114 m_cCUPartSizeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_PART_SIZE ); 151 115 m_cCUPredModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_PRED_MODE ); … … 171 135 m_cTransformSkipSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANSFORMSKIP_FLAG ); 172 136 m_CUTransquantBypassFlagSCModel.initBuffer( sliceType, qp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); 173 #if H_3D_DIM174 m_cDepthIntraModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DEPTH_INTRA_MODE );175 m_cDdcFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DDC_FLAG );176 m_cDdcDataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DDC_DATA );177 m_cAngleFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ANGLE_FLAG );178 #if H_3D_DIM_SDC179 m_cSDCResidualFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL_FLAG );180 m_cSDCResidualSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL );181 #endif182 #endif183 #if H_3D_DIM_SDC184 m_cSDCFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_FLAG );185 #endif186 #if H_3D_DBBP187 m_cDBBPFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DBBP_FLAG );188 #endif189 137 m_uiLastDQpNonZero = 0; 190 138 … … 207 155 m_cCUSplitFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SPLIT_FLAG ); 208 156 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); 209 #if MTK_SINGLE_DEPTH_MODE_I0095210 m_cCUSingleDepthFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLEDEPTH_FLAG );211 m_cSingleDepthValueSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );212 #endif213 157 m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT ); 214 158 m_cCUMergeIdxExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT ); 215 #if H_3D_ARP216 m_cCUPUARPWSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW );217 #endif218 #if H_3D_IC219 m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG );220 #endif221 159 m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); 222 160 m_cCUPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PRED_MODE ); … … 242 180 m_CUTransquantBypassFlagSCModel.initBuffer( eSliceType, iQp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); 243 181 244 #if H_3D_DIM245 m_cDepthIntraModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DEPTH_INTRA_MODE );246 m_cDdcFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );247 m_cDdcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_DATA );248 m_cAngleFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ANGLE_FLAG );249 #if H_3D_DIM_SDC250 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG );251 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL );252 #endif253 #endif254 #if H_3D_DIM_SDC255 m_cSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );256 #endif257 #if H_3D_DBBP258 m_cDBBPFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );259 #endif260 182 m_pcTDecBinIf->start(); 261 183 } … … 379 301 } 380 302 381 #if H_3D_DIM382 Void TDecSbac::xReadExGolombLevel( UInt& ruiSymbol, ContextModel& rcSCModel )383 {384 UInt uiSymbol;385 UInt uiCount = 0;386 do387 {388 m_pcTDecBinIf->decodeBin( uiSymbol, rcSCModel );389 uiCount++;390 }391 while( uiSymbol && ( uiCount != 3 ) );392 ruiSymbol = uiCount - 1;393 394 if( uiSymbol )395 {396 xReadEpExGolomb( uiSymbol, 0 );397 ruiSymbol += uiSymbol + 1;398 }399 400 return;401 }402 403 Void TDecSbac::xParseDimDeltaDC( Pel& rValDeltaDC, UInt uiNumSeg )404 {405 UInt absValDeltaDC = 0;406 xReadExGolombLevel( absValDeltaDC, m_cDdcDataSCModel.get(0, 0, 0) );407 rValDeltaDC = (Pel)absValDeltaDC + ( uiNumSeg > 1 ? 0 : 1 );408 409 if( rValDeltaDC != 0 )410 {411 UInt uiSign;412 m_pcTDecBinIf->decodeBinEP( uiSign );413 if ( uiSign )414 {415 rValDeltaDC = -rValDeltaDC;416 }417 }418 }419 420 421 #if H_3D_DIM_DMM422 Void TDecSbac::xParseDmm1WedgeIdx( UInt& ruiTabIdx, Int iNumBit )423 {424 UInt uiSymbol, uiIdx = 0;425 for( Int i = 0; i < iNumBit; i++ )426 {427 m_pcTDecBinIf->decodeBinEP( uiSymbol );428 uiIdx += uiSymbol << i;429 }430 ruiTabIdx = uiIdx;431 }432 #endif433 434 #if !FIX_TICKET_76435 #if H_3D_DIM_SDC436 Void TDecSbac::xParseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment )437 {438 assert( pcCU->getSlice()->getIsDepth() );439 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );440 assert( pcCU->getSDCFlag(uiAbsPartIdx) );441 assert( uiSegment < 2 );442 443 UInt uiResidual = 0;444 UInt uiBit = 0;445 UInt uiAbsIdx = 0;446 UInt uiSign = 0;447 Int iIdx = 0;448 449 #if H_3D_DIM_DLT450 UInt uiMaxResidualBits = pcCU->getSlice()->getPPS()->getDLT()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() );451 #else452 UInt uiMaxResidualBits = g_bitDepthY;453 #endif454 assert( uiMaxResidualBits <= g_bitDepthY );455 456 m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) );457 458 #if H_MV_ENC_DEC_TRAC459 DTRACE_CU("sdc_residual_flag[i]", uiResidual)460 #endif461 462 if (uiResidual)463 {464 // decode residual sign bit465 m_pcTDecBinIf->decodeBinEP(uiSign);466 #if H_MV_ENC_DEC_TRAC467 DTRACE_CU("sdc_residual_sign_flag[i]", uiSign)468 #endif469 470 // decode residual magnitude471 // prefix part472 UInt uiCount = 0;473 #if H_3D_DIM_DLT474 UInt uiNumDepthValues = pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );475 #else476 UInt uiNumDepthValues = ((1 << g_bitDepthY)-1);477 #endif478 UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2);479 for ( UInt ui = 0; ui < uiPrefixThreshold; ui++)480 {481 m_pcTDecBinIf->decodeBin( uiBit, m_cSDCResidualSCModel.get(0, 0, 0) );482 if ( uiBit == 0 )483 break;484 else485 uiCount++;486 }487 // suffix part488 if ( uiCount == uiPrefixThreshold )489 {490 for ( UInt ui = 0; ui < numBitsForValue(uiNumDepthValues - uiPrefixThreshold); ui++ )491 {492 m_pcTDecBinIf->decodeBinEP( uiBit );493 uiAbsIdx |= uiBit << ui;494 }495 uiAbsIdx += uiCount;496 }497 else498 {499 uiAbsIdx = uiCount;500 }501 502 #if H_MV_ENC_DEC_TRAC503 DTRACE_CU("sdc_residual_abs_minus1[i]", uiAbsIdx)504 #endif505 506 uiAbsIdx += 1;507 iIdx =(Int)(uiSign ? -1 : 1)*uiAbsIdx;508 }509 510 pcCU->setSDCSegmentDCOffset(iIdx, uiSegment, uiAbsPartIdx);511 }512 #endif513 #endif514 #endif515 303 /** Parse I_PCM information. 516 304 * \param pcCU … … 649 437 #endif 650 438 } 651 #if MTK_SINGLE_DEPTH_MODE_I0095652 Void TDecSbac::parseSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )653 {654 pcCU->setSingleDepthFlagSubParts( false, uiAbsPartIdx, uiDepth );655 UInt uiSymbol = 0;656 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSingleDepthFlagSCModel.get( 0, 0, 0 ) );657 if( uiSymbol )658 {659 pcCU->setSingleDepthFlagSubParts( true, uiAbsPartIdx, uiDepth );660 pcCU->setSkipFlagSubParts( false, uiAbsPartIdx, uiDepth );661 pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth );662 pcCU->setPredModeSubParts( MODE_INTRA, uiAbsPartIdx, uiDepth );663 pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth );664 pcCU->setLumaIntraDirSubParts (DC_IDX, uiAbsPartIdx, uiDepth );665 pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth );666 pcCU->setMergeFlagSubParts( false , uiAbsPartIdx, 0, uiDepth );667 pcCU->setTrIdxSubParts(0, uiAbsPartIdx, uiDepth);668 pcCU->setCbfSubParts(0, 1, 1, uiAbsPartIdx, uiDepth);669 670 UInt absValDeltaDC = 0;671 672 UInt uiUnaryIdx = 0;673 UInt uiNumCand = MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE;674 if ( uiNumCand > 1 )675 {676 for( ; uiUnaryIdx < uiNumCand - 1; ++uiUnaryIdx )677 {678 UInt uiSymbol2 = 0;679 if ( uiUnaryIdx==0 )680 {681 m_pcTDecBinIf->decodeBin( uiSymbol2, m_cSingleDepthValueSCModel.get( 0, 0, 0 ) );682 }683 else684 {685 m_pcTDecBinIf->decodeBinEP( uiSymbol2);686 }687 if( uiSymbol2 == 0 )688 {689 break;690 }691 }692 }693 absValDeltaDC = uiUnaryIdx;694 pcCU->setSingleDepthValueSubParts((Pel)absValDeltaDC,uiAbsPartIdx, 0, uiDepth);695 }696 }697 698 #endif699 439 /** parse merge flag 700 440 * \param pcCU … … 778 518 779 519 UInt uiSymbol; 780 #if H_3D_QTLPC781 Bool bParseSplitFlag = true;782 783 #if MTK_I0099_VPS_EX2784 TComVPS *vps = pcCU->getPic()->getSlice(0)->getVPS();785 Bool bLimQtPredFlag = vps->getLimQtPredFlag(pcCU->getPic()->getSlice(0)->getLayerId());786 #else787 TComSPS *sps = pcCU->getPic()->getSlice(0)->getSPS();788 #endif789 TComPic *pcTexture = pcCU->getSlice()->getTexturePic();790 Bool bDepthMapDetect = (pcTexture != NULL);791 Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE);792 793 Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);794 795 #if MTK_I0099_VPS_EX2796 #if LGE_FCO_I0116797 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag && pcTexture->getReconMark())798 #else799 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag)800 #endif801 #else802 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTL() && sps->getUsePC())803 #endif804 {805 TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());806 assert(pcTextureCU->getDepth(uiAbsPartIdx) >= uiDepth);807 bParseSplitFlag = (pcTextureCU->getDepth(uiAbsPartIdx) > uiDepth);808 }809 810 if(bParseSplitFlag)811 {812 #endif813 520 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSplitFlagSCModel.get( 0, 0, pcCU->getCtxSplitFlag( uiAbsPartIdx, uiDepth ) ) ); 814 521 #if H_MV_ENC_DEC_TRAC … … 817 524 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 818 525 DTRACE_CABAC_T( "\tSplitFlag\n" ) 819 #endif820 #if H_3D_QTLPC821 }822 else823 {824 uiSymbol = 0;825 }826 526 #endif 827 527 pcCU->setDepthSubParts( uiDepth + uiSymbol, uiAbsPartIdx ); … … 841 541 PartSize eMode; 842 542 843 #if H_3D_QTLPC844 Bool bParsePartSize = true;845 #if MTK_I0099_VPS_EX2846 TComVPS *vps = pcCU->getPic()->getSlice(0)->getVPS();847 Bool bLimQtPredFlag = vps->getLimQtPredFlag(pcCU->getPic()->getSlice(0)->getLayerId());848 #else849 TComSPS *sps = pcCU->getPic()->getSlice(0)->getSPS();850 #endif851 TComPic *pcTexture = pcCU->getSlice()->getTexturePic();852 Bool bDepthMapDetect = (pcTexture != NULL);853 Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE);854 855 Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);856 857 Bool depthDependent = false;858 UInt uiTexturePart = uiMode;859 #if MTK_I0099_VPS_EX2860 #if LGE_FCO_I0116861 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag && pcTexture->getReconMark())862 #else863 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag )864 #endif865 #else866 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTL() && sps->getUsePC())867 #endif868 {869 TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());870 assert(pcTextureCU->getDepth(uiAbsPartIdx) >= uiDepth);871 if(pcTextureCU->getDepth(uiAbsPartIdx) == uiDepth )872 {873 depthDependent = true;874 uiTexturePart = pcTextureCU->getPartitionSize( uiAbsPartIdx );875 }876 if (pcTextureCU->getDepth(uiAbsPartIdx) == uiDepth && pcTextureCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N)877 {878 bParsePartSize = false;879 eMode = SIZE_2Nx2N;880 }881 }882 #endif883 543 884 544 885 545 if ( pcCU->isIntra( uiAbsPartIdx ) ) 886 546 { 887 #if H_3D_QTLPC888 if(bParsePartSize)889 {890 #endif891 547 uiSymbol = 1; 892 548 if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth ) … … 898 554 } 899 555 eMode = uiSymbol ? SIZE_2Nx2N : SIZE_NxN; 900 #if H_3D_QTLPC901 }902 #endif903 556 UInt uiTrLevel = 0; 904 557 UInt uiWidthInBit = g_aucConvertToBit[pcCU->getWidth(uiAbsPartIdx)]+2; … … 916 569 else 917 570 { 918 #if H_3D_QTLPC919 if(bParsePartSize)920 {921 if (depthDependent==false || uiTexturePart == SIZE_NxN|| uiTexturePart == SIZE_2Nx2N)922 {923 #endif924 571 UInt uiMaxNumBits = 2; 925 572 if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( (g_uiMaxCUWidth>>uiDepth) == 8 && (g_uiMaxCUHeight>>uiDepth) == 8 ) ) … … 958 605 } 959 606 } 960 #if H_3D_QTLPC961 }962 else if(uiTexturePart == SIZE_2NxN || uiTexturePart == SIZE_2NxnU || uiTexturePart == SIZE_2NxnD)963 {964 UInt uiMaxNumBits = 1;965 if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )966 {967 uiMaxNumBits ++;968 }969 for ( UInt ui = 0; ui < uiMaxNumBits; ui++ )970 {971 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) );972 if ( uiSymbol )973 {974 break;975 }976 uiMode++;977 }978 eMode = (PartSize) uiMode;979 if(uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) && uiSymbol==1 )980 {981 eMode = SIZE_2NxN;982 }983 else if (uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth )==0 && uiSymbol==0)984 {985 eMode = SIZE_2NxN;986 }987 else if (uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) && uiSymbol==0)988 {989 m_pcTDecBinIf->decodeBinEP(uiSymbol);990 eMode = (uiSymbol == 0? SIZE_2NxnU : SIZE_2NxnD);991 }992 }993 else if(uiTexturePart == SIZE_Nx2N|| uiTexturePart==SIZE_nLx2N || uiTexturePart==SIZE_nRx2N)994 {995 UInt uiMaxNumBits = 1;996 if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )997 {998 uiMaxNumBits ++;999 }1000 for ( UInt ui = 0; ui < uiMaxNumBits; ui++ )1001 {1002 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) );1003 if ( uiSymbol )1004 {1005 break;1006 }1007 uiMode++;1008 }1009 eMode = (PartSize) uiMode;1010 if(uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) && uiSymbol==1 )1011 {1012 eMode = SIZE_Nx2N;1013 }1014 else if (uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth )==0 && uiSymbol==0)1015 {1016 eMode = SIZE_Nx2N;1017 }1018 else if (uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) && uiSymbol==0)1019 {1020 m_pcTDecBinIf->decodeBinEP(uiSymbol);1021 eMode = (uiSymbol == 0? SIZE_nLx2N : SIZE_nRx2N);1022 }1023 }1024 else1025 {1026 assert(0);1027 }1028 #endif1029 607 #if H_MV_ENC_DEC_TRAC 1030 608 DTRACE_CU("part_mode", eMode ) 1031 #endif1032 #if H_3D_QTLPC1033 }1034 609 #endif 1035 610 } … … 1075 650 for (j=0;j<partNum;j++) 1076 651 { 1077 #if H_3D_DIM1078 #if SEPARATE_FLAG_I00851079 if( pcCU->getSlice()->getVpsDepthModesFlag() || pcCU->getSlice()->getIVPFlag() )1080 #else1081 if( pcCU->getSlice()->getVpsDepthModesFlag() )1082 #endif1083 {1084 parseIntraDepth( pcCU, absPartIdx+partOffset*j, depth );1085 }1086 if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )1087 {1088 #endif1089 652 m_pcTDecBinIf->decodeBin( symbol, m_cCUIntraPredSCModel.get( 0, 0, 0) ); 1090 653 mpmPred[j] = symbol; … … 1092 655 DTRACE_CU("prev_intra_luma_pred_flag", symbol) 1093 656 #endif 1094 #if H_3D_DIM1095 }1096 #endif1097 657 } 1098 658 for (j=0;j<partNum;j++) 1099 659 { 1100 #if H_3D_DIM1101 if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )1102 {1103 #endif1104 660 Int preds[3] = {-1, -1, -1}; 1105 661 Int predNum = pcCU->getIntraDirLumaPredictor(absPartIdx+partOffset*j, preds); … … 1143 699 } 1144 700 pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, absPartIdx+partOffset*j, depth ); 1145 #if H_3D_DIM1146 }1147 #endif1148 701 } 1149 702 } … … 1179 732 } 1180 733 1181 #if H_3D_DIM1182 Void TDecSbac::parseIntraDepth( TComDataCU* pcCU, UInt absPartIdx, UInt depth )1183 {1184 parseIntraDepthMode( pcCU, absPartIdx, depth );1185 1186 UInt dir = pcCU->getLumaIntraDir( absPartIdx );1187 UInt dimType = getDimType( dir );1188 1189 switch( dimType )1190 {1191 #if H_3D_DIM_DMM1192 case( DMM1_IDX ):1193 {1194 UInt uiTabIdx = 0;1195 xParseDmm1WedgeIdx( uiTabIdx, g_dmm1TabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] );1196 pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, absPartIdx, depth );1197 } break;1198 case( DMM4_IDX ): break;1199 #endif1200 default: break;1201 }1202 1203 pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth );1204 }1205 1206 Void TDecSbac::parseIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx, UInt depth )1207 {1208 UInt uiSymbol, uiIsDimMode;1209 1210 if( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() >> pcCU->getDepth( absPartIdx ) ) < 64 ) //DMM and HEVC intra modes are both allowed1211 {1212 m_pcTDecBinIf->decodeBin( uiSymbol, m_cAngleFlagSCModel.get( 0, 0, 0 ) );1213 }1214 else1215 {1216 uiSymbol = 1;1217 }1218 uiIsDimMode = uiSymbol ? 0 : 1;1219 pcCU->setLumaIntraDirSubParts( 0, absPartIdx, depth );1220 1221 //decode DMM index1222 if( uiIsDimMode )1223 {1224 #if SEPARATE_FLAG_I00851225 if( pcCU->getSlice()->getVpsDepthModesFlag() && pcCU->getSlice()->getIVPFlag() )1226 {1227 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );1228 if( !uiSymbol )1229 {1230 #if HS_DMM_SIGNALLING_I01201231 pcCU->setLumaIntraDirSubParts( DIM_OFFSET, absPartIdx, depth );1232 #else1233 pcCU->setLumaIntraDirSubParts( ( 2 * DMM1_IDX + DIM_OFFSET ), absPartIdx, depth );1234 #endif1235 }1236 else1237 {1238 #if HS_DMM_SIGNALLING_I01201239 pcCU->setLumaIntraDirSubParts( ( 1+ DIM_OFFSET ), absPartIdx, depth );1240 #else1241 pcCU->setLumaIntraDirSubParts( ( 2 * DMM4_IDX + DIM_OFFSET ), absPartIdx, depth );1242 #endif1243 }1244 }1245 else if ( pcCU->getSlice()->getVpsDepthModesFlag() )1246 {1247 #if HS_DMM_SIGNALLING_I01201248 pcCU->setLumaIntraDirSubParts( DIM_OFFSET, absPartIdx, depth );1249 #else1250 pcCU->setLumaIntraDirSubParts( ( 2 * DMM1_IDX + DIM_OFFSET ), absPartIdx, depth );1251 #endif1252 }1253 else if( pcCU->getSlice()->getIVPFlag() )1254 {1255 #if HS_DMM_SIGNALLING_I01201256 pcCU->setLumaIntraDirSubParts( ( 1+ DIM_OFFSET ), absPartIdx, depth );1257 #else1258 pcCU->setLumaIntraDirSubParts( ( 2 * DMM4_IDX + DIM_OFFSET ), absPartIdx, depth );1259 #endif1260 }1261 #else1262 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );1263 if( !uiSymbol )1264 {1265 #if HS_DMM_SIGNALLING_I01201266 pcCU->setLumaIntraDirSubParts( DIM_OFFSET, absPartIdx, depth );1267 #else1268 pcCU->setLumaIntraDirSubParts( ( 2 * DMM1_IDX + DIM_OFFSET ), absPartIdx, depth );1269 #endif1270 }1271 else1272 {1273 #if HS_DMM_SIGNALLING_I01201274 pcCU->setLumaIntraDirSubParts( ( 1+ DIM_OFFSET ), absPartIdx, depth );1275 #else1276 pcCU->setLumaIntraDirSubParts( ( 2 * DMM4_IDX + DIM_OFFSET ), absPartIdx, depth );1277 #endif1278 }1279 #endif1280 }1281 }1282 #endif1283 734 1284 735 Void TDecSbac::parseInterDir( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx ) … … 2130 1581 } 2131 1582 2132 #if H_3D_ARP 2133 Void TDecSbac::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2134 { 2135 UInt uiMaxW = pcCU->getSlice()->getARPStepNum() - 1; 2136 UInt uiW = 0; 2137 UInt uiOffset = pcCU->getCTXARPWFlag(uiAbsPartIdx); 2138 UInt uiCode = 0; 2139 2140 assert ( uiMaxW > 0 ); 2141 2142 m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 0 + uiOffset ) ); 2143 2144 uiW = uiCode; 2145 if( 1 == uiW ) 2146 { 2147 m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 2 ) ); 2148 uiW += ( 1 == uiCode ? 1 : 0 ); 2149 } 2150 #if H_MV_ENC_DEC_TRAC 2151 DTRACE_CU("iv_res_pred_weight_idx", uiW ) 2152 #endif 2153 pcCU->setARPWSubParts( ( UChar )( uiW ) , uiAbsPartIdx, uiDepth ); 2154 } 2155 #endif 2156 2157 #if H_3D_IC 2158 /** parse illumination compensation flag 2159 * \param pcCU 2160 * \param uiAbsPartIdx 2161 * \param uiDepth 2162 * \returns Void 2163 */ 2164 Void TDecSbac::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2165 { 2166 UInt uiSymbol = 0; 2167 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, 0 ) ); 2168 #if !H_MV_ENC_DEC_TRAC 2169 DTRACE_CABAC_VL( g_nSymbolCounter++ ); 2170 DTRACE_CABAC_T( "\tICFlag" ); 2171 DTRACE_CABAC_T( "\tuiCtxIC: "); 2172 DTRACE_CABAC_V( uiCtxIC ); 2173 DTRACE_CABAC_T( "\tuiSymbol: "); 2174 DTRACE_CABAC_V( uiSymbol ); 2175 DTRACE_CABAC_T( "\n"); 2176 #else 2177 DTRACE_CU("ic_flag", uiSymbol) 2178 #endif 2179 2180 pcCU->setICFlagSubParts( uiSymbol ? true : false , uiAbsPartIdx, 0, uiDepth ); 2181 } 2182 #endif 2183 2184 #if H_3D_INTER_SDC 2185 Void TDecSbac::parseDeltaDC( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) 2186 { 2187 if( ! ( pcCU->getSDCFlag( absPartIdx ) || ( pcCU->isIntra( absPartIdx ) && getDimType( pcCU->getLumaIntraDir( absPartIdx ) ) < DIM_NUM_TYPE ) ) ) 2188 { 2189 assert( 0 ); 2190 } 2191 2192 #if HS_DMM_SIGNALLING_I0120 2193 UInt symbol = 1; 2194 UInt uiNumSegments = isDimMode( pcCU->getLumaIntraDir( absPartIdx ) ) ? 2 : 1; 2195 #else 2196 UInt symbol = 0; 2197 UInt uiNumSegments = 0; 2198 #endif 2199 2200 #if HS_DMM_SIGNALLING_I0120 2201 if( pcCU->isIntra( absPartIdx ) && pcCU->getSDCFlag( absPartIdx )) 2202 { 2203 #else 2204 if( pcCU->isIntra( absPartIdx ) ) 2205 { 2206 UInt dir = pcCU->getLumaIntraDir( absPartIdx ); 2207 uiNumSegments = isDimMode( dir ) ? 2 : 1; 2208 #endif 2209 m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get( 0, 0, 0 ) ); 2210 #if !HS_DMM_SIGNALLING_I0120 2211 if( pcCU->getSDCFlag( absPartIdx ) ) 2212 { 2213 #endif 2214 assert( pcCU->getPartitionSize( absPartIdx ) == SIZE_2Nx2N ); 2215 pcCU->setTrIdxSubParts( 0, absPartIdx, depth ); 2216 pcCU->setCbfSubParts( 1, 1, 1, absPartIdx, depth ); 2217 } 2218 #if !HS_DMM_SIGNALLING_I0120 2219 else 2220 { 2221 pcCU->setLumaIntraDirSubParts( dir + symbol, absPartIdx, depth ); 2222 } 2223 } 2224 else 2225 { 2226 uiNumSegments = 1; 2227 symbol = 1; 2228 } 2229 #endif 2230 2231 2232 for( UInt segment = 0; segment < uiNumSegments; segment++ ) 2233 { 2234 Pel valDeltaDC = 0; 2235 if( symbol ) 2236 { 2237 xParseDimDeltaDC( valDeltaDC, uiNumSegments ); 2238 } 2239 2240 if( pcCU->isIntra( absPartIdx ) ) 2241 { 2242 UInt dir = pcCU->getLumaIntraDir( absPartIdx ); 2243 2244 if( pcCU->getSDCFlag( absPartIdx ) ) 2245 { 2246 pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx ); 2247 } 2248 else 2249 { 2250 pcCU->setDimDeltaDC( getDimType( dir ), segment, absPartIdx, valDeltaDC ); 2251 } 2252 } 2253 else 2254 { 2255 pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx ); 2256 } 2257 } 2258 } 2259 2260 Void TDecSbac::parseSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2261 { 2262 UInt uiSymbol = 0; 2263 UInt uiCtxSDCFlag = pcCU->getCtxSDCFlag( uiAbsPartIdx ); 2264 2265 m_pcTDecBinIf->decodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, uiCtxSDCFlag ) ); 2266 2267 if( uiSymbol ) 2268 { 2269 pcCU->setSDCFlagSubParts( true, uiAbsPartIdx, uiDepth ); 2270 pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth ); 2271 pcCU->setCbfSubParts( 1, 1, 1, uiAbsPartIdx, uiDepth ); 2272 } 2273 else 2274 { 2275 pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth ); 2276 } 2277 } 2278 2279 #endif 2280 2281 #if H_3D_DBBP 2282 Void TDecSbac::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2283 { 2284 AOF( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) ); 2285 AOF( !pcCU->getSlice()->getIsDepth() ); 2286 2287 UInt uiSymbol = 0; 2288 2289 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDBBPFlagSCModel.get( 0, 0, 0 ) ); 2290 2291 #if SEC_DBBP_EXPLICIT_SIG_I0077 2292 PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); 2293 AOF( ePartSize == SIZE_2NxN || ePartSize == SIZE_Nx2N ); 2294 UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4; 2295 pcCU->setDBBPFlagSubParts(uiSymbol, uiAbsPartIdx, 0, uiDepth); 2296 pcCU->setDBBPFlagSubParts(uiSymbol, uiAbsPartIdx+uiPUOffset, 1, uiDepth); 2297 #else 2298 if( uiSymbol ) 2299 { 2300 pcCU->setDBBPFlagSubParts(true, uiAbsPartIdx, 0, uiDepth); 2301 UInt uiCurrPartNumQ = (pcCU->getPic()->getNumPartInCU() >> (2 * uiDepth)) >> 2; 2302 pcCU->setDBBPFlagSubParts(true, uiAbsPartIdx + 2*uiCurrPartNumQ, 1, uiDepth); 2303 } 2304 #endif 2305 } 2306 #endif 1583 1584 1585 2307 1586 2308 1587 -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibDecoder/TDecSbac.h
r1039 r1072 76 76 Void setBitstream ( TComInputBitstream* p ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); } 77 77 Void parseVPS ( TComVPS* /*pcVPS*/ ) {} 78 #if H_3D79 Void parseSPS ( TComSPS* /*pcSPS*/ , Int /*viewIndex*/, Bool /*depthFlag*/ ) {}80 #else81 78 Void parseSPS ( TComSPS* /*pcSPS*/ ) {} 82 #endif83 #if H_3D84 Void parsePPS ( TComPPS* /*pcPPS*/, TComVPS* /*pcVPS*/ ) {}85 #else86 79 Void parsePPS ( TComPPS* /*pcPPS*/ ) {} 87 #endif88 80 89 81 #if H_MV … … 105 97 Void xReadEpExGolomb ( UInt& ruiSymbol, UInt uiCount ); 106 98 Void xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam ); 107 #if H_3D_DIM108 Void xReadExGolombLevel ( UInt& ruiSymbol, ContextModel& rcSCModel );109 Void xParseDimDeltaDC ( Pel& rValDeltaDC, UInt uiNumSeg );110 #if H_3D_DIM_DMM111 Void xParseDmm1WedgeIdx ( UInt& ruiTabIdx, Int iNumBit );112 #endif113 #if H_3D_DIM_SDC114 Void xParseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );115 #endif116 #endif117 #if H_3D_INTER_SDC118 Void parseDeltaDC ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );119 Void parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );120 #endif121 #if H_3D_DBBP122 Void parseDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );123 #endif124 99 private: 125 100 TComInputBitstream* m_pcBitstream; … … 129 104 130 105 Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 131 #if MTK_SINGLE_DEPTH_MODE_I0095132 Void parseSingleDepthMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );133 #endif134 106 Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 135 107 Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 136 108 Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); 137 109 Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex ); 138 #if H_3D_ARP139 Void parseARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );140 #endif141 #if H_3D_IC142 Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );143 #endif144 110 Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 145 111 Void parsePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); … … 149 115 Void parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 150 116 151 #if H_3D_DIM152 Void parseIntraDepth ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );153 Void parseIntraDepthMode ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );154 #endif155 117 156 118 Void parseInterDir ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx ); … … 182 144 ContextModel3DBuffer m_cCUSplitFlagSCModel; 183 145 ContextModel3DBuffer m_cCUSkipFlagSCModel; 184 #if MTK_SINGLE_DEPTH_MODE_I0095185 ContextModel3DBuffer m_cCUSingleDepthFlagSCModel;186 ContextModel3DBuffer m_cSingleDepthValueSCModel;187 #endif188 146 ContextModel3DBuffer m_cCUMergeFlagExtSCModel; 189 147 ContextModel3DBuffer m_cCUMergeIdxExtSCModel; 190 #if H_3D_ARP191 ContextModel3DBuffer m_cCUPUARPWSCModel;192 #endif193 #if H_3D_IC194 ContextModel3DBuffer m_cCUICFlagSCModel;195 #endif196 148 ContextModel3DBuffer m_cCUPartSizeSCModel; 197 149 ContextModel3DBuffer m_cCUPredModeSCModel; … … 220 172 ContextModel3DBuffer m_CUTransquantBypassFlagSCModel; 221 173 222 #if H_3D_DIM223 ContextModel3DBuffer m_cDepthIntraModeSCModel;224 ContextModel3DBuffer m_cDdcFlagSCModel;225 ContextModel3DBuffer m_cDdcDataSCModel;226 ContextModel3DBuffer m_cAngleFlagSCModel;227 #if H_3D_DIM_SDC228 ContextModel3DBuffer m_cSDCResidualFlagSCModel;229 ContextModel3DBuffer m_cSDCResidualSCModel;230 #endif231 #endif232 #if H_3D_DIM_SDC233 ContextModel3DBuffer m_cSDCFlagSCModel;234 #endif235 #if H_3D_DBBP236 ContextModel3DBuffer m_cDBBPFlagSCModel;237 #endif238 174 }; 239 175 -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibDecoder/TDecSlice.cpp
r976 r1072 221 221 } 222 222 } 223 #if H_3D224 if( pcSlice->getPPS()->getDLT() != NULL )225 {226 assert( pcSlice->getSPS()->getBitDepthY() == pcSlice->getPPS()->getDLT()->getDepthViewBitDepth() );227 }228 #endif229 223 for( Int iCUAddr = iStartCUAddr; !uiIsLast && iCUAddr < rpcPic->getNumCUsInFrame(); iCUAddr = rpcPic->getPicSym()->xCalculateNxtCUAddr(iCUAddr) ) 230 224 { -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibDecoder/TDecTop.cpp
r1066 r1072 45 45 //! \{ 46 46 47 #if H_3D48 CamParsCollector::CamParsCollector()49 : m_bInitialized( false )50 {51 m_aaiCodedOffset = new Int* [ MAX_NUM_LAYERS ];52 m_aaiCodedScale = new Int* [ MAX_NUM_LAYERS ];53 for( UInt uiId = 0; uiId < MAX_NUM_LAYERS; uiId++ )54 {55 m_aaiCodedOffset [ uiId ] = new Int [ MAX_NUM_LAYERS ];56 m_aaiCodedScale [ uiId ] = new Int [ MAX_NUM_LAYERS ];57 }58 59 xCreateLUTs( (UInt)MAX_NUM_LAYERS, (UInt)MAX_NUM_LAYERS, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );60 m_iLog2Precision = LOG2_DISP_PREC_LUT;61 m_uiBitDepthForLUT = 8; // fixed62 m_receivedIdc = NULL;63 m_vps = NULL;64 }65 66 CamParsCollector::~CamParsCollector()67 {68 for( UInt uiId = 0; uiId < MAX_NUM_LAYERS; uiId++ )69 {70 delete [] m_aaiCodedOffset [ uiId ];71 delete [] m_aaiCodedScale [ uiId ];72 }73 delete [] m_aaiCodedOffset;74 delete [] m_aaiCodedScale;75 76 xDeleteArray( m_adBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 );77 xDeleteArray( m_aiBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 );78 xDeleteArray( m_receivedIdc, m_uiMaxViewIndex + 1 );79 }80 81 82 Void83 CamParsCollector::init( FILE* pCodedScaleOffsetFile, TComVPS* vps)84 {85 assert( !isInitialized() ); // Only one initialization currently supported86 m_bInitialized = true;87 m_vps = vps;88 m_bCamParsVaryOverTime = false;89 m_pCodedScaleOffsetFile = pCodedScaleOffsetFile;90 m_lastPoc = -1;91 m_firstReceivedPoc = -2;92 93 m_uiMaxViewIndex = -1;94 for (Int i = 0; i <= vps->getMaxLayersMinus1(); i++)95 {96 Int curViewIdx = m_vps->getViewIndex( m_vps->getLayerIdInNuh( i ));97 m_bCamParsVaryOverTime = m_bCamParsVaryOverTime || vps->hasCamParInSliceHeader( curViewIdx );98 m_uiMaxViewIndex = std::max( m_uiMaxViewIndex, curViewIdx ) ;99 }100 101 assert( m_receivedIdc == NULL );102 m_receivedIdc = new Int*[ m_uiMaxViewIndex + 1];103 for (Int i = 0; i <= m_uiMaxViewIndex; i++)104 {105 m_receivedIdc[i] = new Int[ m_uiMaxViewIndex + 1 ];106 }107 108 xResetReceivedIdc( true );109 110 for (Int viewIndex = 0; viewIndex <= m_uiMaxViewIndex ; viewIndex++ )111 {112 if (m_vps->getCamParPresent( viewIndex ) )113 {114 if( !m_vps->hasCamParInSliceHeader( viewIndex ) )115 {116 for (Int baseViewIndex = 0; baseViewIndex < viewIndex ; baseViewIndex++ )117 {118 m_receivedIdc [ baseViewIndex ][ viewIndex ] = -1;119 m_aaiCodedScale [ baseViewIndex ][ viewIndex ] = m_vps->getCodedScale (viewIndex) [ baseViewIndex ];120 m_aaiCodedOffset[ baseViewIndex ][ viewIndex ] = m_vps->getCodedOffset (viewIndex) [ baseViewIndex ];121 122 m_receivedIdc [ viewIndex ][ baseViewIndex ] = -1;123 m_aaiCodedScale [ viewIndex ][ baseViewIndex ] = m_vps->getInvCodedScale (viewIndex) [ baseViewIndex ];124 m_aaiCodedOffset[ viewIndex ][ baseViewIndex ] = m_vps->getInvCodedOffset(viewIndex) [ baseViewIndex ];125 xInitLUTs( baseViewIndex, viewIndex, m_aaiCodedScale[ baseViewIndex ][ viewIndex ], m_aaiCodedOffset[ baseViewIndex ][ viewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );126 xInitLUTs( viewIndex, baseViewIndex, m_aaiCodedScale[ viewIndex ][ baseViewIndex ], m_aaiCodedOffset[ viewIndex ][ baseViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );127 }128 }129 }130 }131 }132 133 Void134 CamParsCollector::xResetReceivedIdc( Bool overWriteFlag )135 {136 for (Int i = 0; i <= m_uiMaxViewIndex; i++)137 {138 for (Int j = 0; j <= m_uiMaxViewIndex; j++)139 {140 if ( overWriteFlag || ( m_receivedIdc[i][j] != -1 ) )141 {142 m_receivedIdc[i][j] = 0;143 }144 }145 }146 }147 148 149 Void150 CamParsCollector::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT)151 {152 153 uiNumberSourceViews = std::max( (UInt) 1, uiNumberSourceViews );154 uiNumberTargetViews = std::max( (UInt) 1, uiNumberTargetViews );155 156 radLUT = new Double***[ uiNumberSourceViews ];157 raiLUT = new Int ***[ uiNumberSourceViews ];158 159 for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ )160 {161 radLUT [ uiSourceView ] = new Double**[ uiNumberTargetViews ];162 raiLUT [ uiSourceView ] = new Int **[ uiNumberTargetViews ];163 164 for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ )165 {166 radLUT [ uiSourceView ][ uiTargetView ] = new Double*[ 2 ];167 radLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ];168 radLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ];169 170 raiLUT [ uiSourceView ][ uiTargetView ] = new Int* [ 2 ];171 raiLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Int [ 257 ];172 raiLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Int [ 257 ];173 }174 }175 }176 177 Void178 CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT)179 {180 Int iLog2DivLuma = m_uiBitDepthForLUT + m_vps->getCamParPrecision() + 1 - m_iLog2Precision; AOF( iLog2DivLuma > 0 );181 Int iLog2DivChroma = iLog2DivLuma + 1;182 183 iOffset <<= m_uiBitDepthForLUT;184 185 Double dScale = (Double) iScale / (( Double ) ( 1 << iLog2DivLuma ));186 Double dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma ));187 188 // offsets including rounding offsets189 Int64 iOffsetLuma = iOffset + ( ( 1 << iLog2DivLuma ) >> 1 );190 Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 );191 192 193 for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )194 {195 196 // real-valued look-up tables197 Double dShiftLuma = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );198 Double dShiftChroma = dShiftLuma / 2;199 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma;200 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma;201 202 // integer-valued look-up tables203 Int64 iTempScale = (Int64)uiDepthValue * iScale;204 Int64 iShiftLuma = ( iTempScale + iOffsetLuma ) >> iLog2DivLuma;205 Int64 iShiftChroma = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma;206 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma;207 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma;208 }209 210 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];211 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];212 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];213 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];214 }215 216 Void217 CamParsCollector::uninit()218 {219 m_bInitialized = false;220 }221 222 Void223 CamParsCollector::setSlice( TComSlice* pcSlice )224 {225 if( pcSlice == 0 )226 {227 xOutput( m_lastPoc );228 return;229 }230 231 #if !LGE_FCO_I0116232 if ( pcSlice->getIsDepth())233 {234 return;235 }236 #endif237 238 Int curPoc = pcSlice->getPOC();239 if( m_firstReceivedPoc == -2 )240 {241 m_firstReceivedPoc = curPoc;242 }243 244 Bool newPocFlag = ( m_lastPoc != curPoc );245 246 if ( newPocFlag )247 {248 if( m_lastPoc != -1 )249 {250 xOutput( m_lastPoc );251 }252 253 xResetReceivedIdc( false );254 m_lastPoc = pcSlice->getPOC();255 }256 257 UInt uiViewIndex = pcSlice->getViewIndex();258 if( m_vps->getCamParPresent( uiViewIndex ) )259 {260 if( m_vps->hasCamParInSliceHeader( uiViewIndex ) ) // check consistency of slice parameters here261 {262 for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < uiViewIndex; uiBaseViewIndex++ )263 {264 if ( m_receivedIdc[ uiViewIndex ][ uiBaseViewIndex ] != 0 )265 {266 AOF( m_aaiCodedScale [ uiViewIndex ][ uiBaseViewIndex ] == pcSlice->getInvCodedScale () [ uiBaseViewIndex ] );267 AOF( m_aaiCodedOffset[ uiViewIndex ][ uiBaseViewIndex ] == pcSlice->getInvCodedOffset() [ uiBaseViewIndex ] );268 }269 else270 {271 m_receivedIdc [ uiViewIndex ][ uiBaseViewIndex ] = 1;272 m_aaiCodedScale [ uiViewIndex ][ uiBaseViewIndex ] = pcSlice->getInvCodedScale () [ uiBaseViewIndex ];273 m_aaiCodedOffset[ uiViewIndex ][ uiBaseViewIndex ] = pcSlice->getInvCodedOffset() [ uiBaseViewIndex ];274 xInitLUTs( uiViewIndex, uiBaseViewIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseViewIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT);275 }276 if ( m_receivedIdc[ uiBaseViewIndex ][ uiViewIndex ] != 0 )277 {278 AOF( m_aaiCodedScale [ uiBaseViewIndex ][ uiViewIndex ] == pcSlice->getCodedScale () [ uiBaseViewIndex ] );279 AOF( m_aaiCodedOffset[ uiBaseViewIndex ][ uiViewIndex ] == pcSlice->getCodedOffset () [ uiBaseViewIndex ] );280 }281 else282 {283 m_receivedIdc [ uiBaseViewIndex ][ uiViewIndex ] = 1;284 m_aaiCodedScale [ uiBaseViewIndex ][ uiViewIndex ] = pcSlice->getCodedScale () [ uiBaseViewIndex ];285 m_aaiCodedOffset[ uiBaseViewIndex ][ uiViewIndex ] = pcSlice->getCodedOffset () [ uiBaseViewIndex ];286 xInitLUTs( uiBaseViewIndex, uiViewIndex, m_aaiCodedScale[ uiBaseViewIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseViewIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT);287 }288 }289 }290 }291 }292 293 294 #if H_3D_IV_MERGE295 Void296 CamParsCollector::copyCamParamForSlice( TComSlice* pcSlice )297 {298 if( m_bCamParsVaryOverTime )299 {300 pcSlice->setCamparaSlice( m_aaiCodedScale, m_aaiCodedOffset );301 }302 }303 #endif304 305 306 Void307 CamParsCollector::xOutput( Int iPOC )308 {309 if( m_pCodedScaleOffsetFile )310 {311 if( iPOC == m_firstReceivedPoc )312 {313 fprintf( m_pCodedScaleOffsetFile, "# ViewIndex ViewId\n" );314 fprintf( m_pCodedScaleOffsetFile, "#----------- ------------\n" );315 for( UInt uiViewIndex = 0; uiViewIndex <= m_uiMaxViewIndex; uiViewIndex++ )316 {317 fprintf( m_pCodedScaleOffsetFile, "%12d %12d\n", uiViewIndex, m_vps->getViewIdVal( uiViewIndex ) );318 }319 fprintf( m_pCodedScaleOffsetFile, "\n\n");320 fprintf( m_pCodedScaleOffsetFile, "# StartFrame EndFrame TargetView BaseView CodedScale CodedOffset Precision\n" );321 fprintf( m_pCodedScaleOffsetFile, "#----------- ------------ ------------ ------------ ------------ ------------ ------------\n" );322 }323 if( iPOC == m_firstReceivedPoc || m_bCamParsVaryOverTime )324 {325 Int iS = iPOC;326 Int iE = ( m_bCamParsVaryOverTime ? iPOC : ~( 1 << 31 ) );327 for( UInt uiViewIndex = 0; uiViewIndex <= m_uiMaxViewIndex; uiViewIndex++ )328 {329 for( UInt uiBaseIndex = 0; uiBaseIndex <= m_uiMaxViewIndex; uiBaseIndex++ )330 {331 if( uiViewIndex != uiBaseIndex )332 {333 if ( m_receivedIdc[uiBaseIndex][uiViewIndex] != 0 )334 {335 fprintf( m_pCodedScaleOffsetFile, "%12d %12d %12d %12d %12d %12d %12d\n",336 iS, iE, uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_vps->getCamParPrecision() );337 }338 }339 }340 }341 }342 }343 }344 #endif345 47 TDecTop::TDecTop() 346 48 { … … 377 79 m_layerId = 0; 378 80 m_viewId = 0; 379 #if H_3D380 m_viewIndex = 0;381 m_isDepth = false;382 m_pcCamParsCollector = 0;383 #endif384 81 #if H_MV 385 82 m_targetOptLayerSetIdx = -1; … … 821 518 Int layerId = nalu.m_layerId; 822 519 setViewId ( vps->getViewId ( layerId ) ); 823 #if H_3D824 setViewIndex( vps->getViewIndex( layerId ) );825 setIsDepth ( vps->getDepthId ( layerId ) == 1 );826 m_ivPicLists->setVPS( vps );827 #endif828 520 #endif 829 521 … … 1146 838 pcPic->setLayerId( nalu.m_layerId ); 1147 839 pcPic->setViewId ( getViewId() ); 1148 #if H_3D1149 pcPic->setViewIndex( getViewIndex() );1150 pcPic->setIsDepth ( getIsDepth () );1151 #endif1152 840 #endif 1153 841 if (bNextSlice) … … 1162 850 pcSlice->getTempRefPicLists( m_cListPic, m_refPicSetInterLayer0, m_refPicSetInterLayer1, tempRefPicLists, usedAsLongTerm, numPocTotalCurr); 1163 851 pcSlice->setRefPicList ( tempRefPicLists, usedAsLongTerm, numPocTotalCurr, true ); 1164 #if H_3D_ARP1165 pcSlice->setARPStepNum(m_ivPicLists);1166 if( pcSlice->getARPStepNum() > 1 )1167 {1168 // GT: This seems to be broken, not all nuh_layer_ids are necessarily present1169 for(Int iLayerId = 0; iLayerId < nalu.m_layerId; iLayerId ++ )1170 {1171 Int iViewIdx = pcSlice->getVPS()->getViewIndex(iLayerId);1172 Bool bIsDepth = ( pcSlice->getVPS()->getDepthId ( iLayerId ) == 1 );1173 if( iViewIdx<getViewIndex() && !bIsDepth )1174 {1175 pcSlice->setBaseViewRefPicList( m_ivPicLists->getPicList( iLayerId ), iViewIdx );1176 }1177 }1178 }1179 #endif1180 852 #else 1181 853 pcSlice->setRefPicList( m_cListPic, true ); 1182 854 #endif 1183 855 1184 #if H_3D1185 pcSlice->setIvPicLists( m_ivPicLists );1186 #if H_3D_IV_MERGE1187 #if H_3D_FCO1188 //assert( !getIsDepth() );1189 #else1190 assert( !getIsDepth() || ( pcSlice->getTexturePic() != 0 ) );1191 #endif1192 #endif1193 #endif1194 856 // For generalized B 1195 857 #if I0044_SLICE_TMVP … … 1244 906 //--------------- 1245 907 pcSlice->setRefPOCList(); 1246 #if H_3D_TMVP1247 if(pcSlice->getLayerId())1248 pcSlice->generateAlterRefforTMVP();1249 #endif1250 908 } 1251 909 … … 1271 929 } 1272 930 1273 #if H_3D_IV_MERGE1274 #if LGE_FCO_I01161275 if( !pcSlice->getIsDepth() && m_pcCamParsCollector )1276 #else1277 if( pcSlice->getIsDepth() && m_pcCamParsCollector )1278 #endif1279 {1280 m_pcCamParsCollector->copyCamParamForSlice( pcSlice );1281 }1282 #endif1283 931 1284 932 // Decode a picture 1285 933 m_cGopDecoder.decompressSlice(nalu.m_Bitstream, pcPic); 1286 #if H_3D1287 if( m_pcCamParsCollector )1288 {1289 m_pcCamParsCollector->setSlice( pcSlice );1290 }1291 #endif1292 934 m_bFirstSliceInPicture = false; 1293 935 m_uiSliceIdx++; … … 1310 952 sps->setLayerId( getLayerId() ); 1311 953 #endif 1312 #if H_3D1313 // Preliminary fix. assuming that all sps refer to the same VPS.1314 // Parsing dependency should be resolved!1315 TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 );1316 assert( vps != 0 );1317 m_cEntropyDecoder.decodeSPS( sps, vps->getViewIndex( m_layerId ), ( vps->getDepthId( m_layerId ) == 1 ) );1318 #else1319 954 m_cEntropyDecoder.decodeSPS( sps ); 1320 #endif1321 955 m_parameterSetManagerDecoder.storePrefetchedSPS(sps); 1322 956 } … … 1328 962 pps->setLayerId( getLayerId() ); 1329 963 #endif 1330 #if H_3D1331 // Assuming that all PPS indirectly refer to the same VPS via different SPS1332 // There is no parsing dependency in decoding DLT in PPS.1333 // The VPS information passed to decodePPS() is used to arrange the decoded DLT tables to their corresponding layers.1334 // This is equivalent to the process of1335 // Step 1) decoding DLT tables based on the number of depth layers, and1336 // Step 2) mapping DLT tables to the depth layers1337 // as described in the 3D-HEVC WD.1338 TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 );1339 m_cEntropyDecoder.decodePPS( pps, vps );1340 #else1341 964 m_cEntropyDecoder.decodePPS( pps ); 1342 #endif1343 965 m_parameterSetManagerDecoder.storePrefetchedPPS( pps ); 1344 966 } -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibDecoder/TDecTop.h
r976 r1072 64 64 class TAppDecTop; 65 65 #endif 66 #if H_3D67 class CamParsCollector68 {69 public:70 CamParsCollector ();71 ~CamParsCollector ();72 73 Void init ( FILE* pCodedScaleOffsetFile, TComVPS* vps );74 75 Void uninit ();76 Void setSlice ( TComSlice* pcSlice );77 78 Bool isInitialized() const { return m_bInitialized; }79 Int**** getBaseViewShiftLUTI() { return m_aiBaseViewShiftLUT; }80 81 #if H_3D_IV_MERGE82 Void copyCamParamForSlice( TComSlice* pcSlice );83 #endif84 85 #if H_3D_DDD86 Int getCodedScale( Int iBaseView, Int iCureView){ return m_aaiCodedScale[ iBaseView ][ iCureView ];}87 Int getCodedOffset( Int iBaseView, Int iCureView){ return m_aaiCodedOffset[ iBaseView ][ iCureView ];}88 UInt getCamParsCodedPrecision(){ return m_vps->getCamParPrecision(); }89 #endif90 91 private:92 Void xResetReceivedIdc( Bool overWriteFlag );93 Void xOutput ( Int iPOC );94 95 private:96 Bool m_bInitialized;97 FILE* m_pCodedScaleOffsetFile;98 99 Int** m_aaiCodedOffset;100 Int** m_aaiCodedScale;101 102 TComVPS* m_vps;103 Int** m_receivedIdc;104 Int m_uiMaxViewIndex;105 Int m_lastPoc;106 Int m_firstReceivedPoc;107 108 109 Bool m_bCamParsVaryOverTime;110 111 UInt m_uiBitDepthForLUT;112 UInt m_iLog2Precision;113 UInt m_uiInputBitDepth;114 115 // look-up tables116 Double**** m_adBaseViewShiftLUT; ///< Disparity LUT117 Int**** m_aiBaseViewShiftLUT; ///< Disparity LUT118 Void xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT);119 Void xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT);120 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 );121 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize1, UInt uiSize2 );122 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize );123 124 };125 126 template <class T>127 Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 )128 {129 if( rpt )130 {131 for( UInt uiK = 0; uiK < uiSize1; uiK++ )132 {133 for( UInt uiL = 0; uiL < uiSize2; uiL++ )134 {135 for( UInt uiM = 0; uiM < uiSize3; uiM++ )136 {137 delete[] rpt[ uiK ][ uiL ][ uiM ];138 }139 delete[] rpt[ uiK ][ uiL ];140 }141 delete[] rpt[ uiK ];142 }143 delete[] rpt;144 }145 rpt = NULL;146 };147 148 149 template <class T>150 Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2 )151 {152 if( rpt )153 {154 for( UInt uiK = 0; uiK < uiSize1; uiK++ )155 {156 for( UInt uiL = 0; uiL < uiSize2; uiL++ )157 {158 delete[] rpt[ uiK ][ uiL ];159 }160 delete[] rpt[ uiK ];161 }162 delete[] rpt;163 }164 rpt = NULL;165 };166 167 168 template <class T>169 Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize )170 {171 if( rpt )172 {173 for( UInt uiK = 0; uiK < uiSize; uiK++ )174 {175 delete[] rpt[ uiK ];176 }177 delete[] rpt;178 }179 rpt = NULL;180 };181 182 #endif //H_3D183 66 /// decoder class 184 67 class TDecTop … … 243 126 std::vector<TComPic*> m_refPicSetInterLayer0; 244 127 std::vector<TComPic*> m_refPicSetInterLayer1; 245 #if H_3D246 Int m_viewIndex;247 Bool m_isDepth;248 CamParsCollector* m_pcCamParsCollector;249 #endif250 128 #endif 251 129 … … 299 177 Void setViewId ( Int viewId ) { m_viewId = viewId; } 300 178 Int getViewId () { return m_viewId; } 301 #if H_3D302 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; }303 Int getViewIndex () { return m_viewIndex; }304 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; }305 Bool getIsDepth () { return m_isDepth; }306 Void setCamParsCollector( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; }307 #endif308 179 #endif 309 180 protected: -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncCavlc.cpp
r1066 r1072 185 185 WRITE_FLAG( pcPPS->getSignHideFlag(), "sign_data_hiding_flag" ); 186 186 WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0, "cabac_init_present_flag" ); 187 #if PPS_FIX_DEPTH188 if( pcPPS->getSPS()->getVPS()->getDepthId(pcPPS->getSPS()->getLayerId()) )189 {190 WRITE_UVLC( pcPPS->getNumRefIdxL0DefaultActive(), "num_ref_idx_l0_default_active_minus1");191 WRITE_UVLC( pcPPS->getNumRefIdxL1DefaultActive(), "num_ref_idx_l1_default_active_minus1");192 }193 else194 {195 #endif196 187 WRITE_UVLC( pcPPS->getNumRefIdxL0DefaultActive()-1, "num_ref_idx_l0_default_active_minus1"); 197 188 WRITE_UVLC( pcPPS->getNumRefIdxL1DefaultActive()-1, "num_ref_idx_l1_default_active_minus1"); 198 #if PPS_FIX_DEPTH199 }200 #endif201 189 WRITE_SVLC( pcPPS->getPicInitQPMinus26(), "init_qp_minus26"); 202 190 WRITE_FLAG( pcPPS->getConstrainedIntraPred() ? 1 : 0, "constrained_intra_pred_flag" ); … … 274 262 #endif 275 263 #endif 276 #if PPS_FIX_DEPTH277 if( pcPPS->getSPS()->getVPS()->getDepthId(pcPPS->getSPS()->getLayerId()) )278 {279 WRITE_FLAG( 1, "lists_modification_present_flag" );280 }281 else282 #endif283 264 WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag"); 284 265 WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2"); 285 266 WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag"); 286 267 287 #if H_3D288 if(( !pcPPS->getSPS()->getVPS()->getDepthId( pcPPS->getSPS()->getLayerId() ) )||289 pcPPS->getLayerId() != 1 )290 {291 pcPPS->setPps3dExtensionFlag( false );292 }293 #endif294 268 295 269 #if !H_MV … … 300 274 WRITE_FLAG( pcPPS->getPpsRangeExtensionsFlag( ) ? 1 : 0 , "pps_range_extensions_flag" ); 301 275 WRITE_FLAG( pcPPS->getPpsMultilayerExtensionFlag( ) ? 1 : 0 , "pps_multilayer_extension_flag" ); 302 #if !H_3D303 276 WRITE_CODE( pcPPS->getPpsExtension6bits( ), 6, "pps_extension_6bits" ); 304 #else305 WRITE_FLAG( pcPPS->getPps3dExtensionFlag( ) ? 1 : 0 , "pps_3d_extension_flag" );306 WRITE_CODE( pcPPS->getPpsExtension5bits( ), 5, "pps_extension_5bits" );307 #endif308 277 if ( pcPPS->getPpsRangeExtensionsFlag() ) 309 278 { … … 321 290 } 322 291 323 #if H_3D 324 if( pcPPS->getPps3dExtensionFlag( ) ) // This probably needs to be aligned with Rext and SHVC 325 { 326 codePPSExtension( pcPPS ); 327 } 328 #endif 329 #endif 330 331 } 332 333 #if H_3D 334 Void TEncCavlc::codePPSExtension ( TComPPS* pcPPS ) 335 { 336 // Assuming that all PPS indirectly refer to the same VPS via different SPS 337 // There is no parsing dependency in decoding DLT in PPS. 338 // The VPS information passed to decodePPS() is used to arrange the decoded DLT tables to their corresponding layers. 339 // This is equivalent to the process of 340 // Step 1) decoding DLT tables based on the number of depth layers, and 341 // Step 2) mapping DLT tables to the depth layers 342 // as described in the 3D-HEVC WD. 343 TComVPS* pcVPS = pcPPS->getSPS()->getVPS(); 344 345 TComDLT* pcDLT = pcPPS->getDLT(); 346 347 WRITE_FLAG( pcDLT->getDltPresentFlag() ? 1 : 0, "dlt_present_flag" ); 348 349 if ( pcDLT->getDltPresentFlag() ) 350 { 351 WRITE_CODE(pcDLT->getNumDepthViews(), 6, "pps_depth_layers_minus1"); 352 WRITE_CODE((pcDLT->getDepthViewBitDepth() - 8), 4, "pps_bit_depth_for_depth_views_minus8"); 353 354 for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) 355 { 356 if ( i != 0 ) 357 { 358 if ( pcVPS->getDepthId( i ) == 1 ) 359 { 360 WRITE_FLAG( pcDLT->getUseDLTFlag( i ) ? 1 : 0, "dlt_flag[i]" ); 361 362 if ( pcDLT->getUseDLTFlag( i ) ) 363 { 364 WRITE_FLAG( pcDLT->getInterViewDltPredEnableFlag( i ) ? 1 : 0, "inter_view_dlt_pred_enable_flag[ i ]"); 365 366 // ----------------------------- determine whether to use bit-map ----------------------------- 367 Bool bDltBitMapRepFlag = false; 368 UInt uiNumBitsNonBitMap = 0; 369 UInt uiNumBitsBitMap = 0; 370 371 UInt uiMaxDiff = 0; 372 UInt uiMinDiff = 0xffffffff; 373 UInt uiLengthMinDiff = 0; 374 UInt uiLengthDltDiffMinusMin = 0; 375 376 UInt* puiDltDiffValues = NULL; 377 378 Int aiIdx2DepthValue_coded[256]; 379 UInt uiNumDepthValues_coded = 0; 380 381 uiNumDepthValues_coded = pcDLT->getNumDepthValues(i); 382 for( UInt ui = 0; ui<uiNumDepthValues_coded; ui++ ) 383 { 384 aiIdx2DepthValue_coded[ui] = pcDLT->idx2DepthValue(i, ui); 385 } 386 387 #if H_3D_DELTA_DLT 388 if( pcDLT->getInterViewDltPredEnableFlag( i ) ) 389 { 390 AOF( pcVPS->getDepthId( 1 ) == 1 ); 391 AOF( i > 1 ); 392 // assumes ref layer id to be 1 393 Int* piRefDLT = pcDLT->idx2DepthValue( 1 ); 394 UInt uiRefNum = pcDLT->getNumDepthValues( 1 ); 395 pcDLT->getDeltaDLT(i, piRefDLT, uiRefNum, aiIdx2DepthValue_coded, &uiNumDepthValues_coded); 396 } 397 #endif 398 399 if ( NULL == (puiDltDiffValues = (UInt *)calloc(uiNumDepthValues_coded, sizeof(UInt))) ) 400 { 401 exit(-1); 402 } 403 404 for (UInt d = 1; d < uiNumDepthValues_coded; d++) 405 { 406 puiDltDiffValues[d] = aiIdx2DepthValue_coded[d] - aiIdx2DepthValue_coded[d-1]; 407 408 if ( uiMaxDiff < puiDltDiffValues[d] ) 409 { 410 uiMaxDiff = puiDltDiffValues[d]; 411 } 412 413 if ( uiMinDiff > puiDltDiffValues[d] ) 414 { 415 uiMinDiff = puiDltDiffValues[d]; 416 } 417 } 418 419 // counting bits 420 // diff coding branch 421 uiNumBitsNonBitMap += 8; // u(v) bits for num_depth_values_in_dlt[layerId] (i.e. num_entry[ layerId ]) 422 423 if ( uiNumDepthValues_coded > 1 ) 424 { 425 uiNumBitsNonBitMap += 8; // u(v) bits for max_diff[ layerId ] 426 } 427 428 if ( uiNumDepthValues_coded > 2 ) 429 { 430 uiLengthMinDiff = (UInt) ceil(Log2(uiMaxDiff + 1)); 431 uiNumBitsNonBitMap += uiLengthMinDiff; // u(v) bits for min_diff[ layerId ] 432 } 433 434 uiNumBitsNonBitMap += 8; // u(v) bits for dlt_depth_value0[ layerId ] 435 436 if (uiMaxDiff > uiMinDiff) 437 { 438 uiLengthDltDiffMinusMin = (UInt) ceil(Log2(uiMaxDiff - uiMinDiff + 1)); 439 uiNumBitsNonBitMap += uiLengthDltDiffMinusMin * (uiNumDepthValues_coded - 1); // u(v) bits for dlt_depth_value_diff_minus_min[ layerId ][ j ] 440 } 441 442 // bit map branch 443 uiNumBitsBitMap = 256; // uiNumBitsBitMap = 1 << pcDLT->getDepthViewBitDepth(); 444 445 // determine bDltBitMapFlag 446 bDltBitMapRepFlag = (uiNumBitsBitMap > uiNumBitsNonBitMap) ? false : true; 447 448 // ----------------------------- Actual coding ----------------------------- 449 if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false ) 450 { 451 WRITE_FLAG( bDltBitMapRepFlag ? 1 : 0, "dlt_bit_map_rep_flag[ layerId ]" ); 452 } 453 else 454 { 455 bDltBitMapRepFlag = false; 456 } 457 458 // bit map coding 459 if ( bDltBitMapRepFlag ) 460 { 461 UInt uiDltArrayIndex = 0; 462 for (UInt d=0; d < 256; d++) 463 { 464 if ( d == aiIdx2DepthValue_coded[uiDltArrayIndex] ) 465 { 466 WRITE_FLAG(1, "dlt_bit_map_flag[ layerId ][ j ]"); 467 uiDltArrayIndex++; 468 } 469 else 470 { 471 WRITE_FLAG(0, "dlt_bit_map_flag[ layerId ][ j ]"); 472 } 473 } 474 } 475 // Diff Coding 476 else 477 { 478 WRITE_CODE(uiNumDepthValues_coded, 8, "num_depth_values_in_dlt[i]"); // num_entry 479 480 #if !H_3D_DELTA_DLT 481 if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false ) // Single-view DLT Diff Coding 482 #endif 483 { 484 // The condition if( uiNumDepthValues_coded > 0 ) is always true since for Single-view Diff Coding, there is at least one depth value in depth component. 485 if ( uiNumDepthValues_coded > 1 ) 486 { 487 WRITE_CODE(uiMaxDiff, 8, "max_diff[ layerId ]"); // max_diff 488 } 489 490 if ( uiNumDepthValues_coded > 2 ) 491 { 492 WRITE_CODE((uiMinDiff - 1), uiLengthMinDiff, "min_diff_minus1[ layerId ]"); // min_diff_minus1 493 } 494 495 WRITE_CODE(aiIdx2DepthValue_coded[0], 8, "dlt_depth_value0[layerId]"); // entry0 496 497 if (uiMaxDiff > uiMinDiff) 498 { 499 for (UInt d=1; d < uiNumDepthValues_coded; d++) 500 { 501 WRITE_CODE( (puiDltDiffValues[d] - uiMinDiff), uiLengthDltDiffMinusMin, "dlt_depth_value_diff_minus_min[ layerId ][ j ]"); // entry_value_diff_minus_min[ k ] 502 } 503 } 504 } 505 } 506 507 free(puiDltDiffValues); 508 } 509 } 510 } 511 } 512 } 513 } 514 #endif 292 #endif 293 294 } 295 515 296 516 297 Void TEncCavlc::codeVUI( TComVUI *pcVUI, TComSPS* pcSPS ) … … 676 457 } 677 458 678 #if H_3D679 Void TEncCavlc::codeSPS( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )680 #else681 459 Void TEncCavlc::codeSPS( TComSPS* pcSPS ) 682 #endif683 460 { 684 461 #if ENC_DEC_TRACE … … 884 661 WRITE_FLAG( pcSPS->getSpsRangeExtensionsFlag( ) ? 1 : 0 , "sps_range_extensions_flag" ); 885 662 WRITE_FLAG( pcSPS->getSpsMultilayerExtensionFlag( ) ? 1 : 0 , "sps_multilayer_extension_flag" ); 886 #if !H_3D887 663 WRITE_CODE( pcSPS->getSpsExtension6bits( ), 6, "sps_extension_6bits" ); 888 #else889 WRITE_FLAG( pcSPS->getSps3dExtensionFlag( ) ? 1 : 0 , "sps_3d_extension_flag" );890 WRITE_CODE( pcSPS->getSpsExtension5bits( ), 5, "sps_extension_5bits" );891 #endif892 664 } 893 665 … … 902 674 } 903 675 904 #if H_3D905 if ( pcSPS->getSps3dExtensionFlag() )906 {907 codeSPSExtension2( pcSPS, viewIndex, depthFlag );908 }909 910 #endif911 676 #endif 912 677 … … 948 713 #endif 949 714 950 #if H_3D951 Void TEncCavlc::codeSPSExtension2( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )952 {953 #if H_3D_QTLPC954 #if !MTK_I0099_VPS_EX2955 //GT: This has to go to VPS956 if( depthFlag )957 {958 WRITE_FLAG( pcSPS->getUseQTL() ? 1 : 0, "use_qtl_flag");959 WRITE_FLAG( pcSPS->getUsePC() ? 1 : 0, "use_pc_flag");960 }961 #endif962 #endif963 }964 965 966 #endif967 715 968 716 … … 1068 816 m_pcBitIf->writeAlignOne(); 1069 817 codeVPSExtension( pcVPS ); 1070 #if H_3D1071 WRITE_FLAG( 1, "vps_extension2_flag" );1072 m_pcBitIf->writeAlignOne();1073 codeVPSExtension2( pcVPS );1074 WRITE_FLAG( 0, "vps_extension3_flag" );1075 #else1076 818 WRITE_FLAG( 0, "vps_extension2_flag" ); 1077 #endif1078 819 #else 1079 820 WRITE_FLAG( 0, "vps_extension_flag" ); … … 1802 1543 #endif 1803 1544 1804 #if H_3D1805 Void TEncCavlc::codeVPSExtension2( TComVPS* pcVPS )1806 {1807 #if SEC_VPS_CLEANUP_I00901808 for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )1809 #else1810 for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ )1811 #endif1812 {1813 #if !SEC_VPS_CLEANUP_I00901814 if (i!= 0)1815 #endif1816 {1817 #if MTK_I0099_VPS_EX21818 WRITE_FLAG( pcVPS->getIvMvPredFlag ( i ) ? 1 : 0 , "iv_mv_pred_flag[i]");1819 #if SEC_HLS_CLEANUP_I01001820 WRITE_FLAG( pcVPS->getIvMvScalingFlag( i ) ? 1 : 0 , "iv_mv_scaling_flag[i]" );1821 #endif1822 1823 #endif1824 if ( !( pcVPS->getDepthId( i ) == 1 ) )1825 {1826 #if H_3D_IV_MERGE1827 #if !MTK_I0099_VPS_EX21828 WRITE_FLAG( pcVPS->getIvMvPredFlag ( i ) ? 1 : 0 , "iv_mv_pred_flag[i]");1829 #endif1830 #if H_3D_SPIVMP1831 WRITE_UVLC( pcVPS->getSubPULog2Size(i)-3, "log2_sub_PU_size_minus3[i]");1832 #endif1833 #endif1834 #if H_3D_ARP1835 WRITE_FLAG( pcVPS->getUseAdvRP ( i ) ? 1 : 0, "iv_res_pred_flag[i]" );1836 #endif1837 #if H_3D_NBDV_REF1838 WRITE_FLAG( pcVPS->getDepthRefinementFlag ( i ) ? 1 : 0 , "depth_refinement_flag[i]");1839 #endif1840 #if H_3D_VSP1841 WRITE_FLAG( pcVPS->getViewSynthesisPredFlag( i ) ? 1 : 0 , "view_synthesis_pred_flag[i]");1842 #endif1843 #if H_3D_DBBP1844 WRITE_FLAG( pcVPS->getUseDBBP( i ) ? 1 : 0, "use_dbbp_flag[i]" );1845 #endif1846 }1847 else1848 {1849 #if !MTK_I0099_VPS_EX21850 if(i!=1)1851 {1852 WRITE_FLAG( pcVPS->getIvMvPredFlag ( i ) ? 1 : 0 , "iv_mv_pred_flag[i]");1853 }1854 #if H_3D_SPIVMP1855 if (i!=1)1856 {1857 WRITE_UVLC( pcVPS->getSubPULog2Size(i)-3, "log2_sub_PU_size_minus3[i]");1858 }1859 #endif1860 #endif1861 #if H_3D_IV_MERGE1862 WRITE_FLAG( pcVPS->getMPIFlag( i ) ? 1 : 0 , "mpi_flag[i]" );1863 #endif1864 #if MTK_I0099_VPS_EX21865 WRITE_UVLC( pcVPS->getSubPUMPILog2Size(i)-3, "log2_mpi_sub_PU_size_minus3[i]");1866 #endif1867 WRITE_FLAG( pcVPS->getVpsDepthModesFlag( i ) ? 1 : 0 , "vps_depth_modes_flag[i]" );1868 #if SEPARATE_FLAG_I00851869 WRITE_FLAG( pcVPS->getIVPFlag( i ) ? 1 : 0 , "IVP_flag[i]" );1870 #endif1871 #if MTK_I0099_VPS_EX21872 WRITE_FLAG( pcVPS->getLimQtPredFlag ( i ) ? 1 : 0 , "lim_qt_pred_flag[i]" );1873 #endif1874 1875 #if H_3D_INTER_SDC1876 WRITE_FLAG( pcVPS->getInterSDCFlag( i ) ? 1 : 0, "depth_inter_SDC_flag" );1877 #endif1878 }1879 }1880 }1881 WRITE_UVLC( pcVPS->getCamParPrecision(), "cp_precision" );1882 #if SEC_VPS_CLEANUP_I00901883 for (UInt viewIndex=1; viewIndex<pcVPS->getNumViews(); viewIndex++)1884 #else1885 for (UInt viewIndex=0; viewIndex<pcVPS->getNumViews(); viewIndex++)1886 #endif1887 {1888 WRITE_FLAG( pcVPS->getCamParPresent(viewIndex) ? 1 : 0, "cp_present_flag[i]" );1889 if ( pcVPS->getCamParPresent(viewIndex) )1890 {1891 WRITE_FLAG( pcVPS->hasCamParInSliceHeader(viewIndex) ? 1 : 0, "cp_in_slice_segment_header_flag[i]" );1892 if ( !pcVPS->hasCamParInSliceHeader(viewIndex) )1893 {1894 for( UInt uiIndex = 0; uiIndex < viewIndex; uiIndex++ )1895 {1896 WRITE_SVLC( pcVPS->getCodedScale (viewIndex)[ uiIndex ], "vps_cp_scale" );1897 WRITE_SVLC( pcVPS->getCodedOffset (viewIndex)[ uiIndex ], "vps_cp_off" );1898 WRITE_SVLC( pcVPS->getInvCodedScale (viewIndex)[ uiIndex ] + pcVPS->getCodedScale (viewIndex)[ uiIndex ], "vps_cp_inv_scale_plus_scale" );1899 WRITE_SVLC( pcVPS->getInvCodedOffset(viewIndex)[ uiIndex ] + pcVPS->getCodedOffset(viewIndex)[ uiIndex ], "vps_cp_inv_off_plus_off" );1900 }1901 }1902 }1903 }1904 #if !MTK_I0099_VPS_EX21905 WRITE_UVLC( pcVPS->getSubPUMPILog2Size( ) - 3, "log2_sub_PU_MPI_size_minus3");1906 #endif1907 #if H_3D_TMVP1908 #if !SEC_HLS_CLEANUP_I01001909 WRITE_FLAG( pcVPS->getIvMvScalingFlag( ) ? 1 : 0 , "iv_mv_scaling_flag" );1910 #endif1911 #endif1912 }1913 #endif1914 1545 1915 1546 Void TEncCavlc::codeSliceHeader ( TComSlice* pcSlice ) … … 1952 1583 #endif 1953 1584 } 1954 #if PPS_FIX_DEPTH1955 if( pcSlice->getIsDepth() )1956 {1957 WRITE_UVLC( 1, "slice_pic_parameter_set_id" );1958 }1959 else1960 #endif1961 1585 WRITE_UVLC( pcSlice->getPPS()->getPPSId(), "slice_pic_parameter_set_id" ); 1962 1586 pcSlice->setDependentSliceSegmentFlag(!pcSlice->isNextSlice()); … … 2199 1823 { 2200 1824 Bool overrideFlag = (pcSlice->getNumRefIdx( REF_PIC_LIST_0 )!=pcSlice->getPPS()->getNumRefIdxL0DefaultActive()||(pcSlice->isInterB()&&pcSlice->getNumRefIdx( REF_PIC_LIST_1 )!=pcSlice->getPPS()->getNumRefIdxL1DefaultActive())); 2201 #if PPS_FIX_DEPTH2202 overrideFlag |= (pcSlice->getIsDepth() && !pcSlice->getViewIndex());2203 #endif2204 1825 WRITE_FLAG( overrideFlag ? 1 : 0, "num_ref_idx_active_override_flag"); 2205 1826 if (overrideFlag) … … 2221 1842 pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); 2222 1843 } 2223 #if PPS_FIX_DEPTH2224 if( (pcSlice->getPPS()->getListsModificationPresentFlag() || (pcSlice->getIsDepth() && !pcSlice->getViewIndex())) && pcSlice->getNumRpsCurrTempList() > 1)2225 #else2226 1844 if( pcSlice->getPPS()->getListsModificationPresentFlag() && pcSlice->getNumRpsCurrTempList() > 1) 2227 #endif2228 1845 { 2229 1846 TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); … … 2307 1924 xCodePredWeightTable( pcSlice ); 2308 1925 } 2309 #if H_3D_IC2310 #if SEC_HLS_CLEANUP_I01002311 else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) && !pcSlice->getIsDepth() && vps->getNumDirectRefLayers( layerId ) > 0 )2312 #else2313 else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) && !pcSlice->getIsDepth())2314 #endif2315 {2316 WRITE_FLAG( pcSlice->getApplyIC() ? 1 : 0, "slice_ic_enable_flag" );2317 if( pcSlice->getApplyIC() )2318 {2319 WRITE_FLAG( pcSlice->getIcSkipParseFlag() ? 1 : 0, "ic_skip_mergeidx0" );2320 }2321 }2322 #endif2323 #if MTK_SINGLE_DEPTH_MODE_I00952324 if(pcSlice->getIsDepth())2325 {2326 WRITE_FLAG( pcSlice->getApplySingleDepthMode() ? 1 : 0, "slice_enable_single_depth_mode" );2327 }2328 #endif2329 #if H_3D_IV_MERGE2330 assert(pcSlice->getMaxNumMergeCand()<=MRG_MAX_NUM_CANDS_MEM);2331 #else2332 1926 assert(pcSlice->getMaxNumMergeCand()<=MRG_MAX_NUM_CANDS); 2333 #endif2334 1927 if (!pcSlice->isIntra()) 2335 1928 { 2336 #if H_3D_IV_MERGE2337 if(pcSlice->getIsDepth())2338 {2339 Bool bMPIFlag = pcSlice->getVPS()->getMPIFlag( pcSlice->getLayerIdInVps() ) ;2340 Bool ivMvPredFlag = pcSlice->getVPS()->getIvMvPredFlag( pcSlice->getLayerIdInVps() ) ;2341 WRITE_UVLC( ( ( bMPIFlag || ivMvPredFlag ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS ) - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");2342 }2343 else2344 {2345 Bool ivMvPredFlag = pcSlice->getVPS()->getIvMvPredFlag( pcSlice->getLayerIdInVps() ) ;2346 WRITE_UVLC( ( ivMvPredFlag ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS ) - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");2347 }2348 #else2349 1929 WRITE_UVLC(MRG_MAX_NUM_CANDS - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand"); 2350 #endif2351 1930 } 2352 1931 Int iCode = pcSlice->getSliceQp() - ( pcSlice->getPPS()->getPicInitQPMinus26() + 26 ); … … 2384 1963 } 2385 1964 } 2386 #if H_3D2387 #if LGE_FCO_I01162388 if( pcSlice->getVPS()->hasCamParInSliceHeader( pcSlice->getViewIndex() ) && pcSlice->getIsDepth() )2389 #else2390 if( pcSlice->getVPS()->hasCamParInSliceHeader( pcSlice->getViewIndex() ) && !pcSlice->getIsDepth() )2391 #endif2392 {2393 for( UInt uiId = 0; uiId < pcSlice->getViewIndex(); uiId++ )2394 {2395 WRITE_SVLC( pcSlice->getCodedScale ()[ uiId ], "cp_scale" );2396 WRITE_SVLC( pcSlice->getCodedOffset ()[ uiId ], "cp_off" );2397 WRITE_SVLC( pcSlice->getInvCodedScale ()[ uiId ] + pcSlice->getCodedScale ()[ uiId ], "cp_inv_scale_plus_scale" );2398 WRITE_SVLC( pcSlice->getInvCodedOffset()[ uiId ] + pcSlice->getCodedOffset()[ uiId ], "cp_inv_off_plus_off" );2399 }2400 }2401 #endif2402 1965 2403 1966 … … 2734 2297 } 2735 2298 2736 #if H_3D_ARP 2737 Void TEncCavlc::codeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2299 2300 2301 Void TEncCavlc::codeInterModeFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiEncMode ) 2738 2302 { 2739 2303 assert(0); 2740 2304 } 2741 #endif 2742 2743 #if H_3D_IC 2744 Void TEncCavlc::codeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2305 2306 Void TEncCavlc::codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2745 2307 { 2746 2308 assert(0); 2747 2309 } 2748 #endif 2749 2750 Void TEncCavlc::codeInterModeFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiEncMode ) 2310 2311 Void TEncCavlc::codeSkipFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2751 2312 { 2752 2313 assert(0); 2753 2314 } 2754 2755 Void TEncCavlc::codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )2756 {2757 assert(0);2758 }2759 2760 Void TEncCavlc::codeSkipFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )2761 {2762 assert(0);2763 }2764 #if MTK_SINGLE_DEPTH_MODE_I00952765 Void TEncCavlc::codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx )2766 {2767 assert(0);2768 }2769 #endif2770 2315 Void TEncCavlc::codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2771 2316 { … … 3035 2580 } 3036 2581 3037 #if H_3D_INTER_SDC3038 Void TEncCavlc::codeDeltaDC( TComDataCU* pcCU, UInt uiAbsPartIdx )3039 {3040 assert(0);3041 }3042 3043 Void TEncCavlc::codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx )3044 {3045 assert(0);3046 }3047 3048 #endif3049 2582 3050 #if H_3D_DBBP3051 Void TEncCavlc::codeDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx )3052 {3053 assert(0);3054 }3055 #endif3056 2583 //! \} -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncCavlc.h
r1066 r1072 98 98 Void codeSPSExtension ( TComSPS* pcSPS ); 99 99 #endif 100 #if H_3D101 Void codeVPSExtension2 ( TComVPS* pcVPS );102 Void codeSPSExtension2 ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );103 Void codeSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );104 #else105 100 Void codeSPS ( TComSPS* pcSPS ); 106 #endif107 101 Void codePPS ( TComPPS* pcPPS ); 108 102 … … 113 107 #endif 114 108 115 #if H_3D116 Void codePPSExtension ( TComPPS* pcPPS );117 #endif118 109 119 110 Void codeSliceHeader ( TComSlice* pcSlice ); … … 129 120 Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ); 130 121 Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 131 #if MTK_SINGLE_DEPTH_MODE_I0095132 Void codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx );133 #endif134 122 Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 135 123 Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 136 124 137 #if H_3D_ARP138 Void codeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx );139 #endif140 #if H_3D_IC141 Void codeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx );142 #endif143 #if H_3D_INTER_SDC144 Void codeDeltaDC ( TComDataCU* pcCU, UInt uiAbsPartIdx );145 Void codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx );146 #endif147 #if H_3D_DBBP148 Void codeDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx );149 #endif150 125 151 126 Void codeInterModeFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiEncMode ); -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncCfg.h
r1039 r1072 46 46 #include "TLibCommon/TComSlice.h" 47 47 #include <assert.h> 48 #if H_3D49 #include "TAppCommon/TAppComCamPara.h"50 #include "TLibRenderer/TRenModSetupStrParser.h"51 #endif52 48 53 49 struct GOPEntry … … 297 293 Bool m_RCForceIntraQP; 298 294 299 #if KWU_RC_MADPRED_E0227300 UInt m_depthMADPred;301 #endif302 #if KWU_RC_VIEWRC_E0227303 Bool m_bViewWiseRateCtrl;304 #endif305 295 Bool m_TransquantBypassEnableFlag; ///< transquant_bypass_enable_flag setting in PPS. 306 296 Bool m_CUTransquantBypassFlagForce; ///< if transquant_bypass_enable_flag, then, if true, all CU transquant bypass flags will be set to true. … … 311 301 #endif 312 302 313 #if H_3D314 TComDLT* m_cDLT;315 #endif316 303 317 304 Bool m_recalculateQPAccordingToLambda; ///< recalculate QP value according to the lambda value … … 366 353 #endif 367 354 368 #if H_3D369 Bool m_isDepth;370 371 //====== Camera Parameters ======372 UInt m_uiCamParPrecision;373 Bool m_bCamParInSliceHeader;374 Int** m_aaiCodedScale;375 Int** m_aaiCodedOffset;376 TAppComCamPara* m_cameraParameters;377 378 #if H_3D_VSO379 //====== View Synthesis Optimization ======380 TRenModSetupStrParser* m_renderModelParameters;381 Bool m_bUseVSO;382 Bool m_bForceLambdaScale;383 Bool m_bAllowNegDist;384 Double m_dLambdaScaleVSO;385 UInt m_uiVSOMode;386 // LGE_WVSO_A0119387 Bool m_bUseWVSO;388 Int m_iVSOWeight;389 Int m_iVSDWeight;390 Int m_iDWeight;391 // SAIT_VSO_EST_A0033392 Bool m_bUseEstimatedVSD;393 Double m_dDispCoeff;394 #endif395 #if H_3D_ARP396 UInt m_uiUseAdvResPred;397 UInt m_uiARPStepNum;398 #endif399 #if H_3D_SPIVMP400 Int m_iSubPULog2Size;401 Int m_iSubPUMPILog2Size;402 #endif403 #if H_3D_IC404 Bool m_bUseIC;405 Bool m_bUseICLowLatencyEnc;406 #endif407 #if H_3D_INTER_SDC408 bool m_bInterSDC;409 #endif410 #if H_3D_DBBP411 Bool m_bUseDBBP;412 #endif413 //====== Depth Intra Modes ======414 #if H_3D_DIM415 Bool m_useDMM;416 #if SEPARATE_FLAG_I0085417 Bool m_useIVP;418 #endif419 Bool m_useSDC;420 Bool m_useDLT;421 #endif422 #if MTK_SINGLE_DEPTH_MODE_I0095423 Bool m_useSingleDepthMode;424 #endif425 #if H_3D_IV_MERGE426 Bool m_useMPI;427 #endif428 #if !MTK_I0099_VPS_EX2 || MTK_I0099_FIX429 #if H_3D_QTLPC430 Bool m_bUseQTL;431 #if !MTK_I0099_VPS_EX2432 Bool m_bUsePC;433 #endif434 #endif435 #endif436 #endif437 355 public: 438 356 TEncCfg() … … 444 362 , m_viewId(-1) 445 363 , m_viewIndex(-1) 446 #if H_3D447 , m_isDepth(false)448 , m_bUseVSO(false)449 #endif450 364 #endif 451 365 {} … … 479 393 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; } 480 394 Int getViewIndex () { return m_viewIndex; } 481 #if H_3D482 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; }483 Bool getIsDepth () { return m_isDepth; }484 #endif485 395 #endif 486 396 //====== Coding Structure ======== … … 508 418 Void setMaxTempLayer ( Int maxTempLayer ) { m_maxTempLayer = maxTempLayer; } 509 419 510 #if H_3D_ARP511 UInt getUseAdvRP ( ) { return m_uiUseAdvResPred; }512 Void setUseAdvRP ( UInt u ) { m_uiUseAdvResPred = u; }513 514 UInt getARPStepNum () { return m_uiARPStepNum; }515 Void setARPStepNum ( UInt u ) { m_uiARPStepNum = u; }516 #endif517 #if H_3D_SPIVMP518 Int getSubPULog2Size () { return m_iSubPULog2Size;}519 Void setSubPULog2Size (Int u) { m_iSubPULog2Size = u; }520 Int getSubPUMPILog2Size () { return m_iSubPUMPILog2Size;}521 Void setSubPUMPILog2Size (Int u) { m_iSubPUMPILog2Size = u; }522 #endif523 #if H_3D_IC524 Void setUseIC ( Bool bVal ) { m_bUseIC = bVal; }525 Bool getUseIC () { return m_bUseIC; }526 Void setUseICLowLatencyEnc ( Bool bVal ) { m_bUseICLowLatencyEnc = bVal; }527 Bool getUseICLowLatencyEnc () { return m_bUseICLowLatencyEnc; }528 #endif529 #if H_3D_INTER_SDC530 Void setInterSDCEnable ( Bool bVal ) { m_bInterSDC = bVal; }531 Bool getInterSDCEnable () { return m_bInterSDC; }532 #endif533 #if H_3D_DBBP534 Void setUseDBBP ( Bool b ) { m_bUseDBBP = b; }535 Bool getUseDBBP() { return m_bUseDBBP; }536 #endif537 420 //======== Transform ============= 538 421 Void setQuadtreeTULog2MaxSize ( UInt u ) { m_uiQuadtreeTULog2MaxSize = u; } … … 863 746 Void setForceIntraQP ( Bool b ) { m_RCForceIntraQP = b; } 864 747 865 #if KWU_RC_MADPRED_E0227866 UInt getUseDepthMADPred () { return m_depthMADPred; }867 Void setUseDepthMADPred (UInt b) { m_depthMADPred = b; }868 #endif869 #if KWU_RC_VIEWRC_E0227870 Bool getUseViewWiseRateCtrl () { return m_bViewWiseRateCtrl; }871 Void setUseViewWiseRateCtrl (Bool b) { m_bViewWiseRateCtrl = b; }872 #endif873 748 Bool getTransquantBypassEnableFlag() { return m_TransquantBypassEnableFlag; } 874 749 Void setTransquantBypassEnableFlag(Bool flag) { m_TransquantBypassEnableFlag = flag; } … … 883 758 #endif 884 759 885 #if H_3D886 Void setDLT ( TComDLT *p ) { m_cDLT = p; }887 TComDLT* getDLT () { return m_cDLT; }888 #endif889 760 890 761 Void setUseRecalculateQPAccordingToLambda ( Bool b ) { m_recalculateQPAccordingToLambda = b; } … … 968 839 Bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag; } 969 840 Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; } 970 #if H_3D971 /// 3D Tools972 973 //==== CAMERA PARAMETERS ==========974 Void setCamParPrecision ( UInt u ) { m_uiCamParPrecision = u; }975 Void setCamParInSliceHeader ( Bool b ) { m_bCamParInSliceHeader = b; }976 Void setCodedScale ( Int** p ) { m_aaiCodedScale = p; }977 Void setCodedOffset ( Int** p ) { m_aaiCodedOffset = p; }978 Void setCameraParameters ( TAppComCamPara* c) { m_cameraParameters = c; }979 980 #if H_3D_VSO981 //==== VSO ==========982 Void setRenderModelParameters ( TRenModSetupStrParser* c ) { m_renderModelParameters = c; }983 Bool getUseVSO () { return m_bUseVSO; }984 Void setUseVSO ( Bool b ) { m_bUseVSO = b; }985 UInt getVSOMode () { return m_uiVSOMode; }986 Void setVSOMode ( UInt ui ) { m_uiVSOMode = ui; }987 Bool getForceLambdaScaleVSO () { return m_bForceLambdaScale; }988 Void setForceLambdaScaleVSO ( Bool b ) { m_bForceLambdaScale = b; };989 Double getLambdaScaleVSO () { return m_dLambdaScaleVSO; }990 Void setLambdaScaleVSO ( Double d ) { m_dLambdaScaleVSO = d; };991 Bool getAllowNegDist () { return m_bAllowNegDist; }992 Void setAllowNegDist ( Bool b ) { m_bAllowNegDist = b; };993 994 // LGE_WVSO_A0119995 Bool getUseWVSO () { return m_bUseWVSO; }996 Void setUseWVSO ( Bool b ) { m_bUseWVSO = b; }997 Int getVSOWeight () { return m_iVSOWeight; }998 Void setVSOWeight ( Int i ) { m_iVSOWeight = i; }999 Int getVSDWeight () { return m_iVSDWeight; }1000 Void setVSDWeight ( Int i ) { m_iVSDWeight = i; }1001 Int getDWeight () { return m_iDWeight; }1002 Void setDWeight ( Int i ) { m_iDWeight = i; }1003 1004 // SAIT_VSO_EST_A00331005 Bool getUseEstimatedVSD () { return m_bUseEstimatedVSD; }1006 Void setUseEstimatedVSD ( Bool b ) { m_bUseEstimatedVSD = b; }1007 Double getDispCoeff () { return m_dDispCoeff; }1008 Void setDispCoeff ( Double d ) { m_dDispCoeff = d; }1009 #endif // H_3D_VSO1010 1011 //==== DIM ==========1012 #if H_3D_DIM1013 Bool getUseDMM () { return m_useDMM; }1014 Void setUseDMM ( Bool b) { m_useDMM = b; }1015 #if SEPARATE_FLAG_I00851016 Bool getUseIVP () { return m_useIVP; }1017 Void setUseIVP ( Bool b) { m_useIVP = b; }1018 #endif1019 Bool getUseSDC () { return m_useSDC; }1020 Void setUseSDC ( Bool b) { m_useSDC = b; }1021 Bool getUseDLT () { return m_useDLT; }1022 Void setUseDLT ( Bool b) { m_useDLT = b; }1023 #endif1024 #if MTK_SINGLE_DEPTH_MODE_I00951025 Void setUseSingleDepthMode ( Bool bVal ) { m_useSingleDepthMode = bVal; }1026 Bool getUseSingleDepthMode () { return m_useSingleDepthMode; }1027 #endif1028 #if !MTK_I0099_VPS_EX2 || MTK_I0099_FIX1029 #if H_3D_QTLPC1030 Void setUseQTL ( Bool b ) { m_bUseQTL = b; }1031 Bool getUseQTL () { return m_bUseQTL; }1032 #if !MTK_I0099_VPS_EX21033 Void setUsePC ( Bool b ) { m_bUsePC = b; }1034 Bool getUsePC () { return m_bUsePC; }1035 #endif1036 #endif1037 #endif1038 #if H_3D_IV_MERGE1039 Void setUseMPI ( Bool b ) { m_useMPI = b; }1040 Bool getUseMPI () { return m_useMPI; }1041 #endif1042 #endif // H_3D1043 841 }; 1044 842 -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncCu.cpp
r1066 r1072 65 65 m_ppcTempCU = new TComDataCU*[m_uhTotalDepth-1]; 66 66 67 #if H_3D_ARP68 m_ppcWeightedTempCU = new TComDataCU*[m_uhTotalDepth-1];69 #endif70 67 71 68 m_ppcPredYuvBest = new TComYuv*[m_uhTotalDepth-1]; … … 76 73 m_ppcRecoYuvTemp = new TComYuv*[m_uhTotalDepth-1]; 77 74 m_ppcOrigYuv = new TComYuv*[m_uhTotalDepth-1]; 78 #if H_3D_DBBP79 m_ppcOrigYuvDBBP = new TComYuv*[m_uhTotalDepth-1];80 #endif81 75 82 76 UInt uiNumPartitions; … … 90 84 m_ppcTempCU[i] = new TComDataCU; m_ppcTempCU[i]->create( uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) ); 91 85 92 #if H_3D_ARP93 m_ppcWeightedTempCU[i] = new TComDataCU; m_ppcWeightedTempCU[i]->create( uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) );94 #endif95 86 96 87 m_ppcPredYuvBest[i] = new TComYuv; m_ppcPredYuvBest[i]->create(uiWidth, uiHeight); … … 103 94 104 95 m_ppcOrigYuv [i] = new TComYuv; m_ppcOrigYuv [i]->create(uiWidth, uiHeight); 105 #if H_3D_DBBP106 m_ppcOrigYuvDBBP[i] = new TComYuv; m_ppcOrigYuvDBBP[i]->create(uiWidth, uiHeight);107 #endif108 96 } 109 97 110 98 m_bEncodeDQP = false; 111 #if KWU_RC_MADPRED_E0227112 m_LCUPredictionSAD = 0;113 m_addSADDepth = 0;114 m_temporalSAD = 0;115 m_spatialSAD = 0;116 #endif117 99 118 100 // initialize partition order. … … 139 121 m_ppcTempCU[i]->destroy(); delete m_ppcTempCU[i]; m_ppcTempCU[i] = NULL; 140 122 } 141 #if H_3D_ARP142 if(m_ppcWeightedTempCU[i])143 {144 m_ppcWeightedTempCU[i]->destroy(); delete m_ppcWeightedTempCU[i]; m_ppcWeightedTempCU[i] = NULL;145 }146 #endif147 123 if(m_ppcPredYuvBest[i]) 148 124 { … … 173 149 m_ppcOrigYuv[i]->destroy(); delete m_ppcOrigYuv[i]; m_ppcOrigYuv[i] = NULL; 174 150 } 175 #if H_3D_DBBP176 if(m_ppcOrigYuvDBBP[i])177 {178 m_ppcOrigYuvDBBP[i]->destroy(); delete m_ppcOrigYuvDBBP[i]; m_ppcOrigYuvDBBP[i] = NULL;179 }180 #endif181 151 } 182 152 if(m_ppcBestCU) … … 191 161 } 192 162 193 #if H_3D_ARP194 if(m_ppcWeightedTempCU)195 {196 delete [] m_ppcWeightedTempCU;197 m_ppcWeightedTempCU = NULL;198 }199 #endif200 163 if(m_ppcPredYuvBest) 201 164 { … … 233 196 m_ppcOrigYuv = NULL; 234 197 } 235 #if H_3D_DBBP236 if(m_ppcOrigYuvDBBP)237 {238 delete [] m_ppcOrigYuvDBBP;239 m_ppcOrigYuvDBBP = NULL;240 }241 #endif242 198 } 243 199 … … 275 231 m_ppcTempCU[0]->initCU( rpcCU->getPic(), rpcCU->getAddr() ); 276 232 277 #if KWU_RC_MADPRED_E0227278 m_LCUPredictionSAD = 0;279 m_addSADDepth = 0;280 m_temporalSAD = 0;281 m_spatialSAD = 0;282 #endif283 233 284 234 // analysis of CU … … 408 358 TComPic* pcPic = rpcBestCU->getPic(); 409 359 410 #if H_3D_QTLPC411 #if MTK_I0099_VPS_EX2412 TComVPS *vps = pcPic->getSlice(0)->getVPS();413 Bool bLimQtPredFalg = vps->getLimQtPredFlag(pcPic->getSlice(0)->getLayerId());414 #else415 TComSPS *sps = pcPic->getSlice(0)->getSPS();416 #endif417 TComPic *pcTexture = rpcBestCU->getSlice()->getTexturePic();418 419 Bool depthMapDetect = (pcTexture != NULL);420 Bool bIntraSliceDetect = (rpcBestCU->getSlice()->getSliceType() == I_SLICE);421 422 Bool rapPic = (rpcBestCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || rpcBestCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || rpcBestCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);423 424 Bool bTry2NxN = true;425 Bool bTryNx2N = true;426 #endif427 360 // get Original YUV data from picture 428 361 m_ppcOrigYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvOrg(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU() ); 429 362 430 #if H_3D_QTLPC431 Bool bTrySplit = true;432 Bool bTrySplitDQP = true;433 #endif434 363 435 364 // variable for Early CU determination … … 440 369 Bool earlyDetectionSkipMode = false; 441 370 442 #if H_3D_VSP443 DisInfo DvInfo;444 DvInfo.bDV = false;445 DvInfo.m_acNBDV.setZero();446 DvInfo.m_aVIdxCan = 0;447 #if H_3D_NBDV_REF448 DvInfo.m_acDoNBDV.setZero();449 #endif450 #endif451 371 Bool bBoundary = false; 452 372 UInt uiLPelX = rpcBestCU->getCUPelX(); … … 502 422 } 503 423 504 #if H_3D_IC505 Bool bICEnabled = rpcTempCU->getSlice()->getViewIndex() && ( rpcTempCU->getSlice()->getSliceType() == P_SLICE || rpcTempCU->getSlice()->getSliceType() == B_SLICE ) && !rpcTempCU->getSlice()->getIsDepth();506 bICEnabled = bICEnabled && rpcTempCU->getSlice()->getApplyIC();507 #endif508 424 // If slice start or slice end is within this cu... 509 425 TComSlice * pcSlice = rpcTempCU->getPic()->getSlice(rpcTempCU->getPic()->getCurrSliceIdx()); … … 514 430 if(!bSliceEnd && !bSliceStart && bInsidePicture ) 515 431 { 516 #if H_3D_FAST_TEXTURE_ENCODING517 Bool bIVFMerge = false;518 Int iIVFMaxD = 0;519 Bool bFMD = false;520 #endif521 432 for (Int iQP=iMinQP; iQP<=iMaxQP; iQP++) 522 433 { … … 528 439 } 529 440 530 #if H_3D_QTLPC531 bTrySplit = true;532 #endif533 441 534 442 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 535 #if H_3D_QTLPC 536 //logic for setting bTrySplit using the partition information that is stored of the texture colocated CU 537 538 #if MTK_I0099_VPS_EX2 539 #if MTK_I0099_FIX 540 #if LGE_FCO_I0116 541 if(depthMapDetect && !bIntraSliceDetect && !rapPic && ( m_pcEncCfg->getUseQTL() || bLimQtPredFalg ) && pcTexture->getReconMark()) 542 #else 543 if(depthMapDetect && !bIntraSliceDetect && !rapPic && ( m_pcEncCfg->getUseQTL() || bLimQtPredFalg )) 544 #endif 545 #else 546 if(depthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFalg) 547 #endif 548 #else 549 if(depthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTL()) 550 #endif 551 { 552 TComDataCU* pcTextureCU = pcTexture->getCU( rpcBestCU->getAddr() ); //Corresponding texture LCU 553 UInt uiCUIdx = rpcBestCU->getZorderIdxInCU(); 554 assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth); //Depth cannot be more partitionned than the texture. 555 if (pcTextureCU->getDepth(uiCUIdx) > uiDepth || pcTextureCU->getPartitionSize(uiCUIdx) == SIZE_NxN) //Texture was split. 556 { 557 bTrySplit = true; 558 bTryNx2N = true; 559 bTry2NxN = true; 560 } 561 else 562 { 563 bTrySplit = false; 564 bTryNx2N = false; 565 bTry2NxN = false; 566 if( pcTextureCU->getDepth(uiCUIdx) == uiDepth && pcTextureCU->getPartitionSize(uiCUIdx) != SIZE_2Nx2N) 567 { 568 if(pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxN || pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxnU|| pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxnD) 569 bTry2NxN = true; 570 else 571 bTryNx2N = true; 572 } 573 } 574 } 575 #endif 576 577 #if H_3D_NBDV 578 if( rpcTempCU->getSlice()->getSliceType() != I_SLICE ) 579 { 580 #if H_3D_ARP && H_3D_IV_MERGE 581 if( rpcTempCU->getSlice()->getVPS()->getUseAdvRP(rpcTempCU->getSlice()->getLayerId()) || rpcTempCU->getSlice()->getVPS()->getIvMvPredFlag(rpcTempCU->getSlice()->getLayerId()) ) 582 #else 583 #if H_3D_ARP 584 if( rpcTempCU->getSlice()->getVPS()->getUseAdvRP(rpcTempCU->getSlice()->getLayerId()) ) 585 #else 586 #if H_3D_IV_MERGE 587 if( rpcTempCU->getSlice()->getVPS()->getIvMvPredFlag(rpcTempCU->getSlice()->getLayerId()) ) 588 #else 589 if (0) 590 #endif 591 #endif 592 #endif 593 { 594 PartSize ePartTemp = rpcTempCU->getPartitionSize(0); 595 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 596 #if H_3D_IV_MERGE 597 if (rpcTempCU->getSlice()->getIsDepth() ) 598 { 599 DvInfo.bDV = rpcTempCU->getDispforDepth(0, 0, &DvInfo); 600 } 601 else 602 { 603 #endif 604 #if H_3D_NBDV_REF 605 if(rpcTempCU->getSlice()->getVPS()->getDepthRefinementFlag( rpcTempCU->getSlice()->getLayerIdInVps())) 606 DvInfo.bDV = rpcTempCU->getDisMvpCandNBDV(&DvInfo, true); 607 else 608 #endif 609 DvInfo.bDV = rpcTempCU->getDisMvpCandNBDV(&DvInfo); 610 611 #if H_3D_IV_MERGE 612 } 613 #endif 614 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 615 rpcBestCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 616 rpcTempCU->setPartSizeSubParts( ePartTemp, 0, uiDepth ); 617 } 618 } 619 #if H_3D_FAST_TEXTURE_ENCODING 620 if(rpcTempCU->getSlice()->getViewIndex() && !rpcTempCU->getSlice()->getIsDepth()) 621 { 622 PartSize ePartTemp = rpcTempCU->getPartitionSize(0); 623 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 624 rpcTempCU->getIVNStatus( 0, &DvInfo, bIVFMerge, iIVFMaxD); 625 rpcTempCU->setPartSizeSubParts( ePartTemp, 0, uiDepth ); 626 } 627 #endif 628 #endif 443 629 444 // do inter modes, SKIP and 2Nx2N 630 445 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE ) 631 446 { 632 #if H_3D_IC633 for( UInt uiICId = 0; uiICId < ( bICEnabled ? 2 : 1 ); uiICId++ )634 {635 Bool bICFlag = uiICId ? true : false;636 #endif637 447 // 2Nx2N 638 448 if(m_pcEncCfg->getUseEarlySkipDetection()) 639 449 { 640 #if H_3D_IC641 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);642 #endif643 #if H_3D_FAST_TEXTURE_ENCODING644 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFMD ); rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N645 #else646 450 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); 647 451 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N 648 #endif649 #if H_3D_VSP650 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);651 #endif652 452 } 653 453 // SKIP 654 #if H_3D_IC655 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);656 #endif657 454 xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, &earlyDetectionSkipMode );//by Merge for inter_2Nx2N 658 #if H_3D_FAST_TEXTURE_ENCODING659 bFMD = bIVFMerge && rpcBestCU->isSkipped(0);660 #endif661 455 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 662 #if H_3D_VSP663 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);664 #endif665 456 666 457 if(!m_pcEncCfg->getUseEarlySkipDetection()) 667 458 { 668 459 // 2Nx2N, NxN 669 #if H_3D_IC670 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);671 #endif672 #if H_3D_FAST_TEXTURE_ENCODING673 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFMD ); rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );674 #else675 460 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); 676 461 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 677 #endif678 #if H_3D_VSP679 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);680 #endif681 462 682 #if H_3D_DBBP683 if( m_pcEncCfg->getUseDBBP() )684 {685 xCheckRDCostInterDBBP( rpcBestCU, rpcTempCU, false );686 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );687 #if H_3D_VSP688 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);689 #endif690 }691 #endif692 463 693 464 if(m_pcEncCfg->getUseCbfFastMode()) … … 696 467 } 697 468 } 698 #if H_3D_IC699 }700 #endif701 469 } 702 470 703 #if H_3D_QTLPC704 #if MTK_I0099_VPS_EX2705 #if MTK_I0099_FIX706 if(depthMapDetect && !bIntraSliceDetect && !rapPic && ( m_pcEncCfg->getUseQTL() || bLimQtPredFalg ))707 #else708 if(depthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFalg)709 #endif710 #else711 if(depthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTL())712 #endif713 {714 bTrySplitDQP = bTrySplit;715 }716 #endif717 471 if ( bIsLosslessMode ) 718 472 { … … 721 475 } 722 476 723 #if KWU_RC_MADPRED_E0227724 if ( uiDepth <= m_addSADDepth )725 {726 m_LCUPredictionSAD += m_temporalSAD;727 m_addSADDepth = uiDepth;728 }729 #endif730 #if H_3D_DIM_ENC731 if( rpcBestCU->getSlice()->getIsDepth() && rpcBestCU->getSlice()->isIRAP() )732 {733 earlyDetectionSkipMode = false;734 }735 #endif736 #if MTK_SINGLE_DEPTH_MODE_I0095737 rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP );738 if(rpcBestCU->getSlice()->getApplySingleDepthMode())739 {740 xCheckRDCostSingleDepth( rpcBestCU, rpcTempCU, SIZE_2Nx2N );741 rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP );742 }743 #endif744 477 if(!earlyDetectionSkipMode) 745 478 { … … 761 494 { 762 495 if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && doNotBlockPu 763 #if H_3D_QTLPC764 && bTrySplit765 #endif766 496 ) 767 497 { 768 #if H_3D_FAST_TEXTURE_ENCODING769 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN, bFMD );770 #else771 498 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN ); 772 #endif773 499 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 774 #if H_3D_VSP775 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);776 #endif777 500 } 778 501 } … … 780 503 // 2NxN, Nx2N 781 504 if(doNotBlockPu 782 #if H_3D_QTLPC783 && bTryNx2N784 #endif785 505 ) 786 506 { 787 #if H_3D_FAST_TEXTURE_ENCODING788 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N, bFMD );789 #else790 507 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N ); 791 #endif792 508 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 793 #if H_3D_VSP794 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);795 #endif796 509 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_Nx2N ) 797 510 { … … 800 513 } 801 514 if(doNotBlockPu 802 #if H_3D_QTLPC803 && bTry2NxN804 #endif805 515 ) 806 516 { 807 #if H_3D_FAST_TEXTURE_ENCODING808 xCheckRDCostInter ( rpcBestCU, rpcTempCU, SIZE_2NxN, bFMD );809 #else810 517 xCheckRDCostInter ( rpcBestCU, rpcTempCU, SIZE_2NxN ); 811 #endif812 518 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 813 #if H_3D_VSP814 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);815 #endif816 519 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxN) 817 520 { … … 839 542 { 840 543 if(doNotBlockPu 841 #if H_3D_QTLPC842 && bTry2NxN843 #endif844 544 ) 845 545 { 846 #if H_3D_FAST_TEXTURE_ENCODING847 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, bFMD );848 #else849 546 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU ); 850 #endif851 547 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 852 #if H_3D_VSP853 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);854 #endif855 548 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU ) 856 549 { … … 859 552 } 860 553 if(doNotBlockPu 861 #if H_3D_QTLPC862 && bTry2NxN863 #endif864 554 ) 865 555 { 866 #if H_3D_FAST_TEXTURE_ENCODING867 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, bFMD );868 #else869 556 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD ); 870 #endif871 557 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 872 #if H_3D_VSP873 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);874 #endif875 558 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD ) 876 559 { … … 883 566 { 884 567 if(doNotBlockPu 885 #if H_3D_QTLPC886 && bTry2NxN887 #endif888 568 ) 889 569 { 890 #if H_3D_FAST_TEXTURE_ENCODING891 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, bFMD, true );892 #else893 570 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, true ); 894 #endif895 571 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 896 #if H_3D_VSP897 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);898 #endif899 572 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU ) 900 573 { … … 903 576 } 904 577 if(doNotBlockPu 905 #if H_3D_QTLPC906 && bTry2NxN907 #endif908 578 ) 909 579 { 910 #if H_3D_FAST_TEXTURE_ENCODING911 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, bFMD, true );912 #else913 580 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, true ); 914 #endif915 581 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 916 #if H_3D_VSP917 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);918 #endif919 582 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD ) 920 583 { … … 929 592 { 930 593 if(doNotBlockPu 931 #if H_3D_QTLPC932 && bTryNx2N933 #endif934 594 ) 935 595 { 936 #if H_3D_FAST_TEXTURE_ENCODING937 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, bFMD );938 #else939 596 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N ); 940 #endif941 597 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 942 #if H_3D_VSP943 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);944 #endif945 598 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N ) 946 599 { … … 949 602 } 950 603 if(doNotBlockPu 951 #if H_3D_QTLPC952 && bTryNx2N953 #endif954 604 ) 955 605 { 956 #if H_3D_FAST_TEXTURE_ENCODING957 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, bFMD );958 #else959 606 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N ); 960 #endif961 607 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 962 #if H_3D_VSP963 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);964 #endif965 608 } 966 609 } … … 969 612 { 970 613 if(doNotBlockPu 971 #if H_3D_QTLPC972 && bTryNx2N973 #endif974 614 ) 975 615 { 976 #if H_3D_FAST_TEXTURE_ENCODING977 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, bFMD, true );978 #else979 616 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, true ); 980 #endif981 617 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 982 #if H_3D_VSP983 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);984 #endif985 618 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N ) 986 619 { … … 989 622 } 990 623 if(doNotBlockPu 991 #if H_3D_QTLPC992 && bTryNx2N993 #endif994 624 ) 995 625 { 996 #if H_3D_FAST_TEXTURE_ENCODING997 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, bFMD, true );998 #else999 626 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, true ); 1000 #endif1001 627 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1002 #if H_3D_VSP1003 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1004 #endif1005 628 } 1006 629 } … … 1008 631 1009 632 #else 1010 #if H_3D_QTLPC1011 if (bTry2NxN)1012 {1013 #endif1014 633 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU ); 1015 634 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1016 #if H_3D_VSP1017 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1018 #endif1019 635 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD ); 1020 636 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1021 #if H_3D_VSP1022 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1023 #endif1024 #if H_3D_QTLPC1025 }1026 if (bTryNx2N)1027 {1028 #endif1029 637 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N ); 1030 638 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1031 #if H_3D_VSP1032 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1033 #endif1034 639 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N ); 1035 640 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1036 #if H_3D_VSP1037 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1038 #endif1039 #if H_3D_QTLPC1040 }1041 #endif1042 641 1043 642 #endif … … 1045 644 #endif 1046 645 } 1047 #if H_3D_FAST_TEXTURE_ENCODING1048 if(!bFMD)1049 {1050 #endif1051 646 // do normal intra modes 1052 647 … … 1056 651 rpcBestCU->getCbf( 0, TEXT_CHROMA_U ) != 0 || 1057 652 rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) != 0 1058 #if H_3D_DIM_ENC1059 #if HHI_DMM4_ENC_I00661060 || rpcBestCU->getSlice()->getIsDepth()1061 #else1062 || ( rpcBestCU->getSlice()->getIsDepth() && rpcBestCU->getSlice()->isIRAP() )1063 #endif1064 #endif1065 653 ) // avoid very complex intra if it is unlikely 1066 654 { 1067 #if HHI_DMM4_ENC_I00661068 Bool bOnlyIVP = false;1069 if( rpcBestCU->getSlice()->getIsDepth() && !(rpcBestCU->getSlice()->isIRAP()) &&1070 rpcBestCU->getSlice()->getSliceType() != I_SLICE &&1071 rpcBestCU->getCbf( 0, TEXT_LUMA ) == 0 &&1072 rpcBestCU->getCbf( 0, TEXT_CHROMA_U ) == 0 &&1073 rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) == 01074 )1075 {1076 bOnlyIVP = true;1077 }1078 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bOnlyIVP );1079 #else1080 655 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); 1081 #endif 1082 1083 #if KWU_RC_MADPRED_E0227 1084 if ( uiDepth <= m_addSADDepth ) 1085 { 1086 m_LCUPredictionSAD += m_spatialSAD; 1087 m_addSADDepth = uiDepth; 1088 } 1089 #endif 656 1090 657 1091 658 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1092 659 if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth ) 1093 660 { 1094 #if H_3D_QTLPC //Try IntraNxN1095 if(bTrySplit)1096 {1097 #endif1098 661 if( rpcTempCU->getWidth(0) > ( 1 << rpcTempCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) ) 1099 662 { 1100 #if HHI_DMM4_ENC_I00661101 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN, bOnlyIVP );1102 #else1103 663 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN ); 1104 #endif1105 664 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1106 665 } 1107 #if H_3D_QTLPC1108 }1109 #endif1110 666 } 1111 667 } … … 1117 673 UInt uiRawBits = (2 * g_bitDepthY + g_bitDepthC) * rpcBestCU->getWidth(0) * rpcBestCU->getHeight(0) / 2; 1118 674 UInt uiBestBits = rpcBestCU->getTotalBits(); 1119 #if H_3D_VSO // M71120 Double dRDCostTemp = m_pcRdCost->getUseVSO() ? m_pcRdCost->calcRdCostVSO(uiRawBits, 0) : m_pcRdCost->calcRdCost(uiRawBits, 0);1121 if((uiBestBits > uiRawBits) || (rpcBestCU->getTotalCost() > dRDCostTemp ))1122 #else1123 675 if((uiBestBits > uiRawBits) || (rpcBestCU->getTotalCost() > m_pcRdCost->calcRdCost(uiRawBits, 0))) 1124 #endif1125 676 { 1126 677 xCheckIntraPCM (rpcBestCU, rpcTempCU); … … 1128 679 } 1129 680 } 1130 #if H_3D_FAST_TEXTURE_ENCODING1131 }1132 #endif1133 681 if (bIsLosslessMode) 1134 682 { … … 1142 690 rpcBestCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits 1143 691 rpcBestCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1144 #if H_3D_VSO // M81145 if ( m_pcRdCost->getUseVSO() )1146 rpcBestCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() );1147 else1148 #endif1149 692 rpcBestCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() ); 1150 693 … … 1158 701 bSubBranch = true; 1159 702 } 1160 #if H_3D_FAST_TEXTURE_ENCODING1161 if(rpcBestCU->getSlice()->getViewIndex() && !rpcBestCU->getSlice()->getIsDepth() && (uiDepth >=iIVFMaxD) && rpcBestCU->isSkipped(0))1162 {1163 bSubBranch = false;1164 }1165 #endif1166 703 } 1167 704 else if(!(bSliceEnd && bInsidePicture)) … … 1217 754 1218 755 // further split 1219 #if H_3D_QTLPC1220 if( bSubBranch && bTrySplitDQP && uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth )1221 #else1222 756 if( bSubBranch && uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) 1223 #endif 1224 { 1225 #if H_3D_VSO // M9 1226 // reset Model 1227 if( m_pcRdCost->getUseRenModel() ) 1228 { 1229 UInt uiWidth = m_ppcOrigYuv[uiDepth]->getWidth ( ); 1230 UInt uiHeight = m_ppcOrigYuv[uiDepth]->getHeight( ); 1231 Pel* piSrc = m_ppcOrigYuv[uiDepth]->getLumaAddr( 0 ); 1232 UInt uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride(); 1233 m_pcRdCost->setRenModelData( m_ppcBestCU[uiDepth], 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 1234 } 1235 #endif 757 { 1236 758 1237 759 UChar uhNextDepth = uiDepth+1; … … 1287 809 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1288 810 } 1289 #if H_3D_VSO // M101290 if ( m_pcRdCost->getUseVSO() )1291 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );1292 else1293 #endif1294 811 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1295 812 … … 1323 840 rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits 1324 841 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1325 #if H_3D_VSO // M111326 if ( m_pcRdCost->getUseLambdaScaleVSO())1327 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );1328 else1329 #endif1330 842 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1331 843 #endif … … 1354 866 } 1355 867 1356 #if H_3D_VSO // M121357 if( m_pcRdCost->getUseRenModel() )1358 {1359 UInt uiWidth = m_ppcRecoYuvBest[uiDepth]->getWidth ( );1360 UInt uiHeight = m_ppcRecoYuvBest[uiDepth]->getHeight ( );1361 Pel* piSrc = m_ppcRecoYuvBest[uiDepth]->getLumaAddr( 0 );1362 UInt uiSrcStride = m_ppcRecoYuvBest[uiDepth]->getStride ( );1363 m_pcRdCost->setRenModelData( rpcBestCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );1364 }1365 #endif1366 868 rpcBestCU->copyToPic(uiDepth); // Copy Best data to Picture for next partition prediction. 1367 869 … … 1581 1083 #endif 1582 1084 m_pcEntropyCoder->encodeMergeIndex( pcCU, uiAbsPartIdx ); 1583 #if H_3D_ARP1584 m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx );1585 #endif1586 #if H_3D_IC1587 m_pcEntropyCoder->encodeICFlag ( pcCU, uiAbsPartIdx );1588 #endif1589 1085 finishCU(pcCU,uiAbsPartIdx,uiDepth); 1590 1086 return; 1591 1087 } 1592 #if MTK_SINGLE_DEPTH_MODE_I00951593 m_pcEntropyCoder->encodeSingleDepthMode( pcCU, uiAbsPartIdx );1594 if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))1595 {1596 #endif1597 1088 m_pcEntropyCoder->encodePredMode( pcCU, uiAbsPartIdx ); 1598 1089 1599 1090 m_pcEntropyCoder->encodePartSize( pcCU, uiAbsPartIdx, uiDepth ); 1600 1091 1601 #if H_3D_DIM_SDC1602 m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx, false );1603 #endif1604 1092 if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) 1605 1093 { … … 1617 1105 m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx ); 1618 1106 1619 #if H_3D_ARP1620 m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx );1621 #endif1622 #if H_3D_IC1623 m_pcEntropyCoder->encodeICFlag ( pcCU, uiAbsPartIdx );1624 #endif1625 1107 // Encode Coefficients 1626 1108 Bool bCodeDQP = getdQPFlag(); 1627 1109 m_pcEntropyCoder->encodeCoeff( pcCU, uiAbsPartIdx, uiDepth, pcCU->getWidth (uiAbsPartIdx), pcCU->getHeight(uiAbsPartIdx), bCodeDQP ); 1628 1110 setdQPFlag( bCodeDQP ); 1629 #if MTK_SINGLE_DEPTH_MODE_I00951630 }1631 #endif1632 1111 // --- write terminating bit --- 1633 1112 finishCU(pcCU,uiAbsPartIdx,uiDepth); … … 1757 1236 { 1758 1237 assert( rpcTempCU->getSlice()->getSliceType() != I_SLICE ); 1759 #if H_3D_IV_MERGE1760 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists1761 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];1762 #else1763 1238 TComMvField cMvFieldNeighbours[2 * MRG_MAX_NUM_CANDS]; // double length for mv of both lists 1764 1239 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 1765 #endif1766 1240 Int numValidMergeCand = 0; 1767 1241 const Bool bTransquantBypassFlag = rpcTempCU->getCUTransquantBypass(0); … … 1772 1246 } 1773 1247 UChar uhDepth = rpcTempCU->getDepth( 0 ); 1774 #if H_3D_IC 1775 Bool bICFlag = rpcTempCU->getICFlag( 0 ); 1776 #endif 1777 #if H_3D_VSO // M1 //nececcary here? 1778 if( m_pcRdCost->getUseRenModel() ) 1779 { 1780 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( ); 1781 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight( ); 1782 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr( ); 1783 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride(); 1784 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 1785 } 1786 #endif 1787 1788 #if H_3D_ARP 1789 DisInfo cOrigDisInfo = rpcTempCU->getDvInfo(0); 1790 #else 1248 1791 1249 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level 1792 #endif 1793 1794 #if H_3D_VSP 1795 #if !H_3D_ARP 1796 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 1797 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 1798 InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM]; 1799 rpcTempCU->m_bAvailableFlagA1 = 0; 1800 rpcTempCU->m_bAvailableFlagB1 = 0; 1801 rpcTempCU->m_bAvailableFlagB0 = 0; 1802 rpcTempCU->m_bAvailableFlagA0 = 0; 1803 rpcTempCU->m_bAvailableFlagB2 = 0; 1804 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 1805 rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag,inheritedVSPDisInfo, numValidMergeCand ); 1806 #endif 1807 #else 1808 #if H_3D 1809 rpcTempCU->m_bAvailableFlagA1 = 0; 1810 rpcTempCU->m_bAvailableFlagB1 = 0; 1811 rpcTempCU->m_bAvailableFlagB0 = 0; 1812 rpcTempCU->m_bAvailableFlagA0 = 0; 1813 rpcTempCU->m_bAvailableFlagB2 = 0; 1814 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 1815 rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand ); 1816 #else 1250 1817 1251 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand ); 1818 #endif 1819 #endif 1820 1821 #if H_3D_IV_MERGE 1822 Int mergeCandBuffer[MRG_MAX_NUM_CANDS_MEM]; 1823 #else 1252 1824 1253 Int mergeCandBuffer[MRG_MAX_NUM_CANDS]; 1825 #endif1826 #if H_3D_ARP1827 for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )1828 #else1829 1254 for( UInt ui = 0; ui < numValidMergeCand; ++ui ) 1830 #endif1831 1255 { 1832 1256 mergeCandBuffer[ui] = 0; … … 1845 1269 } 1846 1270 1847 #if H_3D_ARP 1848 Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1; 1849 if( nARPWMax < 0 || !rpcTempCU->getDvInfo(0).bDV || bICFlag ) 1850 { 1851 nARPWMax = 0; 1852 } 1853 for( Int nARPW=nARPWMax; nARPW >= 0 ; nARPW-- ) 1854 { 1855 memset( mergeCandBuffer, 0, MRG_MAX_NUM_CANDS_MEM*sizeof(Int) ); 1856 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level 1857 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth ); 1858 #if H_3D_IC 1859 rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth ); 1860 #endif 1861 rpcTempCU->getDvInfo(0) = cOrigDisInfo; 1862 rpcTempCU->setDvInfoSubParts(cOrigDisInfo, 0, 0, uhDepth ); 1863 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 1864 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 1865 #if !FIX_TICKET_79 1866 InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM]; 1867 #endif 1868 #if H_3D_SPIVMP 1869 Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM]; 1870 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); 1871 TComMvField* pcMvFieldSP; 1872 UChar* puhInterDirSP; 1873 pcMvFieldSP = new TComMvField[rpcTempCU->getPic()->getPicSym()->getNumPartition()*2]; 1874 puhInterDirSP = new UChar[rpcTempCU->getPic()->getPicSym()->getNumPartition()]; 1875 #endif 1876 #if H_3D 1877 rpcTempCU->initAvailableFlags(); 1878 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 1879 rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours 1880 #if !FIX_TICKET_79 1881 , inheritedVSPDisInfo 1882 #endif 1883 #if H_3D_SPIVMP 1884 , pcMvFieldSP, puhInterDirSP 1885 #endif 1886 , numValidMergeCand 1887 ); 1888 1889 rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours, vspFlag 1890 #if H_3D_SPIVMP 1891 , bSPIVMPFlag 1892 #endif 1893 , numValidMergeCand 1894 ); 1895 1896 #else 1897 #if FIX_TICKET_79 1898 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag, numValidMergeCand ); 1899 #else 1900 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand ); 1901 #endif 1902 #endif 1903 1904 1905 #endif 1906 1907 #if H_3D_DDD 1908 Int iDDDCand = rpcTempCU->getUseDDDCandIdx(); 1909 UChar ucDDDepth = rpcTempCU->getDDTmpDepth(); 1910 rpcTempCU->setUseDDD( false, 0, uhDepth ); 1911 #endif 1271 1912 1272 1913 1273 for( UInt uiNoResidual = 0; uiNoResidual < iteration; ++uiNoResidual ) … … 1915 1275 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) 1916 1276 { 1917 #if H_3D_IC1918 if( rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag() )1919 {1920 if( bICFlag && uiMergeCand == 0 )1921 {1922 continue;1923 }1924 }1925 #endif1926 1277 if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1)) 1927 1278 { … … 1932 1283 rpcTempCU->setCUTransquantBypassSubParts( bTransquantBypassFlag, 0, uhDepth ); 1933 1284 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level 1934 #if H_3D_IC1935 rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth );1936 #endif1937 #if H_3D_ARP1938 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );1939 #endif1940 1285 rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level 1941 1286 rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to LCU level 1942 #if H_3D_VSP1943 rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth );1944 #if !FIX_TICKET_791945 rpcTempCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, 0, 0, uhDepth );1946 #endif1947 #endif1948 #if H_3D_DDD1949 if( rpcTempCU->getSlice()->getIsDepth() && rpcTempCU->getSlice()->getViewIndex() != 0 && iDDDCand == uiMergeCand )1950 {1951 rpcTempCU->setUseDDD( true, 0, 0, uhDepth );1952 rpcTempCU->setDDDepthSubParts( ucDDDepth, 0, 0, uhDepth );1953 }1954 else1955 {1956 rpcTempCU->setUseDDD( false, 0, 0, uhDepth );1957 }1958 #endif1959 #if H_3D_SPIVMP1960 rpcTempCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeCand], 0, 0, uhDepth);1961 if (bSPIVMPFlag[uiMergeCand])1962 {1963 UInt uiSPAddr;1964 Int iWidth = rpcTempCU->getWidth(0);1965 Int iHeight = rpcTempCU->getHeight(0);1966 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;1967 rpcTempCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);1968 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)1969 {1970 rpcTempCU->getSPAbsPartIdx(0, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);1971 rpcTempCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);1972 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);1973 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);1974 }1975 }1976 else1977 #endif1978 #if H_3D_VSP1979 {1980 if ( vspFlag[uiMergeCand] )1981 {1982 UInt partAddr;1983 Int vspSize;1984 Int width, height;1985 rpcTempCU->getPartIndexAndSize( 0, partAddr, width, height );1986 if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 )1987 {1988 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize );1989 rpcTempCU->setVSPFlag( partAddr, vspSize );1990 }1991 else1992 {1993 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level1994 }1995 if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 )1996 {1997 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_1 , cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize );1998 rpcTempCU->setVSPFlag( partAddr, vspSize );1999 }2000 else2001 {2002 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level2003 }2004 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level2005 }2006 else2007 {2008 #endif2009 1287 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level 2010 1288 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 2011 1289 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 2012 #if H_3D_VSP2013 }2014 }2015 #endif2016 1290 // do MC 2017 1291 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 2018 1292 // estimate residual and encode everything 2019 #if H_3D_VSO //M22020 if( m_pcRdCost->getUseRenModel() )2021 { //Reset2022 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ();2023 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight ();2024 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr ();2025 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride ();2026 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2027 }2028 #endif2029 1293 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, 2030 1294 m_ppcOrigYuv [uhDepth], … … 2043 1307 2044 1308 rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth ); 2045 #if MTK_SINGLE_DEPTH_MODE_I00952046 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );2047 #endif2048 #if H_3D_VSP // possible bug fix2049 if( rpcTempCU->getSkipFlag(0) )2050 {2051 rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);2052 }2053 #endif2054 #if H_3D_INTER_SDC2055 TComDataCU *rpcTempCUPre = rpcTempCU;2056 #endif2057 1309 Int orgQP = rpcTempCU->getQP( 0 ); 2058 1310 xCheckDQP( rpcTempCU ); 2059 1311 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth); 2060 #if H_3D_INTER_SDC2061 if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual )2062 {2063 #if FAST_SDC_OFFSET_DECISION_I00842064 Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};2065 for( Int uiOffest = 1 ; uiOffest <= 5 ; uiOffest++ )2066 #else2067 for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ )2068 #endif2069 {2070 #if FAST_SDC_OFFSET_DECISION_I00842071 if( uiOffest > 3)2072 {2073 if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) )2074 {2075 continue;2076 }2077 if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] && uiOffest == 5)2078 {2079 continue;2080 }2081 if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] && uiOffest == 4)2082 {2083 continue;2084 }2085 }2086 #endif2087 if( rpcTempCU != rpcTempCUPre )2088 {2089 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag );2090 rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );2091 }2092 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );2093 #if MTK_SINGLE_DEPTH_MODE_I00952094 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );2095 #endif2096 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );2097 rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );2098 #if H_3D_VSO //M22099 if( m_pcRdCost->getUseRenModel() )2100 { //Reset2101 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ();2102 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight ();2103 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr ();2104 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride ();2105 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2106 }2107 #endif2108 #if FAST_SDC_OFFSET_DECISION_I00842109 Int iSdcOffset = 0;2110 if(uiOffest % 2 == 0)2111 {2112 iSdcOffset = uiOffest >> 1;2113 }2114 else2115 {2116 iSdcOffset = -1 * (uiOffest >> 1);2117 }2118 m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,2119 m_ppcOrigYuv[uhDepth],2120 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],2121 m_ppcResiYuvTemp[uhDepth],2122 m_ppcRecoYuvTemp[uhDepth],2123 iSdcOffset,2124 uhDepth );2125 if (uiOffest <= 3 )2126 {2127 dOffsetCost [uiOffest -1] = rpcTempCU->getTotalCost();2128 }2129 #else2130 m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,2131 m_ppcOrigYuv[uhDepth],2132 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],2133 m_ppcResiYuvTemp[uhDepth],2134 m_ppcRecoYuvTemp[uhDepth],2135 uiOffest,2136 uhDepth );2137 #endif2138 2139 xCheckDQP( rpcTempCU );2140 xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );2141 }2142 }2143 #endif2144 1312 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag ); 2145 1313 2146 1314 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) 2147 1315 { 2148 #if H_3D_INTER_SDC2149 if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) )2150 {2151 bestIsSkip = !rpcBestCU->getSDCFlag( 0 ) && ( rpcBestCU->getQtRootCbf(0) == 0 );2152 }2153 else2154 {2155 #endif2156 1316 bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0; 2157 #if H_3D_INTER_SDC2158 }2159 #endif2160 1317 } 2161 1318 } … … 2193 1350 } 2194 1351 } 2195 #if H_3D_SPIVMP2196 delete[] pcMvFieldSP;2197 delete[] puhInterDirSP;2198 #endif2199 #if H_3D_ARP2200 }2201 #endif2202 1352 } 2203 1353 2204 1354 2205 1355 #if AMP_MRG 2206 #if H_3D_FAST_TEXTURE_ENCODING2207 Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bFMD, Bool bUseMRG)2208 #else2209 1356 Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bUseMRG) 2210 #endif2211 1357 #else 2212 1358 Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize ) … … 2214 1360 { 2215 1361 2216 #if H_3D2217 const Bool bTransquantBypassFlag = rpcTempCU->getCUTransquantBypass(0);2218 #endif2219 #if H_3D_FAST_TEXTURE_ENCODING2220 if(!(bFMD && (ePartSize == SIZE_2Nx2N))) //have motion estimation or merge check2221 {2222 #endif2223 1362 UChar uhDepth = rpcTempCU->getDepth( 0 ); 2224 #if H_3D_ARP2225 Int iLayerId = rpcTempCU->getSlice()->getLayerId();2226 Bool bFirstTime = true;2227 Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1;2228 2229 if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N || !rpcTempCU->getDvInfo(0).bDV || rpcTempCU->getICFlag(0) )2230 {2231 nARPWMax = 0;2232 }2233 2234 for( Int nARPW = 0; nARPW <= nARPWMax; nARPW++ )2235 {2236 if( bFirstTime == false && rpcTempCU->getSlice()->getVPS()->getUseAdvRP( iLayerId ) )2237 {2238 rpcTempCU->initEstData( rpcTempCU->getDepth(0), rpcTempCU->getQP(0),bTransquantBypassFlag );2239 }2240 #endif2241 #if H_3D_VSO // M32242 if( m_pcRdCost->getUseRenModel() )2243 {2244 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( );2245 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight( );2246 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr( );2247 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride();2248 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2249 }2250 #endif2251 1363 2252 1364 rpcTempCU->setDepthSubParts( uhDepth, 0 ); 2253 1365 2254 1366 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth ); 2255 #if MTK_SINGLE_DEPTH_MODE_I00952256 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );2257 #endif2258 1367 rpcTempCU->setPartSizeSubParts ( ePartSize, 0, uhDepth ); 2259 1368 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth ); 2260 #if H_3D_DDD 2261 rpcTempCU->setUseDDD( false, 0, uhDepth ); 2262 #endif 2263 2264 #if H_3D_ARP 2265 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth ); 2266 #endif 2267 2268 #if H_3D_ARP 2269 if( bFirstTime == false && nARPWMax ) 2270 { 2271 rpcTempCU->copyPartFrom( m_ppcWeightedTempCU[uhDepth] , 0 , uhDepth ); 2272 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth ); 2273 2274 m_pcPredSearch->motionCompensation( rpcTempCU , m_ppcPredYuvTemp[uhDepth] ); 2275 } 2276 else 2277 { 2278 bFirstTime = false; 2279 #endif 1369 1370 2280 1371 #if AMP_MRG 2281 1372 rpcTempCU->setMergeAMP (true); 2282 #if H_3D_FAST_TEXTURE_ENCODING2283 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bFMD, false, bUseMRG );2284 #else2285 1373 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], false, bUseMRG ); 2286 #endif2287 1374 #else 2288 1375 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] ); 2289 1376 #endif 2290 #if H_3D_ARP2291 if( nARPWMax )2292 {2293 m_ppcWeightedTempCU[uhDepth]->copyPartFrom( rpcTempCU , 0 , uhDepth );2294 }2295 }2296 #endif2297 1377 2298 1378 #if AMP_MRG 2299 1379 if ( !rpcTempCU->getMergeAMP() ) 2300 1380 { 2301 #if H_3D_ARP2302 if( nARPWMax )2303 {2304 continue;2305 }2306 else2307 #endif2308 1381 return; 2309 1382 } 2310 1383 #endif 2311 1384 2312 #if KWU_RC_MADPRED_E02272313 if ( m_pcEncCfg->getUseRateCtrl() && m_pcEncCfg->getLCULevelRC() && ePartSize == SIZE_2Nx2N && uhDepth <= m_addSADDepth )2314 {2315 UInt SAD = m_pcRdCost->getSADPart( g_bitDepthY, m_ppcPredYuvTemp[uhDepth]->getLumaAddr(), m_ppcPredYuvTemp[uhDepth]->getStride(),2316 m_ppcOrigYuv[uhDepth]->getLumaAddr(), m_ppcOrigYuv[uhDepth]->getStride(),2317 rpcTempCU->getWidth(0), rpcTempCU->getHeight(0) );2318 m_temporalSAD = (Int)SAD;2319 }2320 #endif2321 1385 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false ); 2322 #if H_3D_VSP // possible bug fix 2323 if( rpcTempCU->getQtRootCbf(0)==0 ) 2324 { 2325 rpcTempCU->setTrIdxSubParts(0, 0, uhDepth); 2326 } 2327 #endif 2328 2329 #if H_3D_VSO // M4 2330 if( m_pcRdCost->getUseLambdaScaleVSO() ) 2331 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2332 else 2333 #endif 1386 2334 1387 2335 1388 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2336 #if H_3D_INTER_SDC2337 TComDataCU *rpcTempCUPre = rpcTempCU;2338 #endif2339 1389 xCheckDQP( rpcTempCU ); 2340 1390 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth); 2341 #if H_3D_INTER_SDC 2342 if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && ePartSize == SIZE_2Nx2N) 2343 { 2344 #if FAST_SDC_OFFSET_DECISION_I0084 2345 Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE}; 2346 for( Int uiOffest = 1 ; uiOffest <= 5 ; uiOffest++ ) 2347 #else 2348 for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ ) 2349 #endif 2350 { 2351 #if FAST_SDC_OFFSET_DECISION_I0084 2352 if( uiOffest > 3) 2353 { 2354 if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) ) 2355 { 2356 continue; 2357 } 2358 if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] && uiOffest == 5) 2359 { 2360 continue; 2361 } 2362 if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] && uiOffest == 4) 2363 { 2364 continue; 2365 } 2366 } 2367 #endif 2368 if( rpcTempCU != rpcTempCUPre ) 2369 { 2370 Int orgQP = rpcBestCU->getQP( 0 ); 2371 rpcTempCU->initEstData( uhDepth, orgQP ,bTransquantBypassFlag ); 2372 rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth ); 2373 } 2374 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth ); 2375 #if MTK_SINGLE_DEPTH_MODE_I0095 2376 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth ); 2377 #endif 2378 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth ); 2379 rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth ); 2380 #if H_3D_VSO // M3 2381 if( m_pcRdCost->getUseRenModel() ) 2382 { 2383 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( ); 2384 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight( ); 2385 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr( ); 2386 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride(); 2387 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 2388 } 2389 #endif 2390 2391 #if FAST_SDC_OFFSET_DECISION_I0084 2392 Int iSdcOffset = 0; 2393 if(uiOffest % 2 == 0) 2394 { 2395 iSdcOffset = uiOffest >> 1; 2396 } 2397 else 2398 { 2399 iSdcOffset = -1 * (uiOffest >> 1); 2400 } 2401 m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU, 2402 m_ppcOrigYuv[uhDepth], 2403 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth], 2404 m_ppcResiYuvTemp[uhDepth], 2405 m_ppcRecoYuvTemp[uhDepth], 2406 iSdcOffset, 2407 uhDepth ); 2408 if (uiOffest <= 3 ) 2409 { 2410 dOffsetCost [uiOffest -1] = rpcTempCU->getTotalCost(); 2411 } 2412 #else 2413 m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU, 2414 m_ppcOrigYuv[uhDepth], 2415 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth], 2416 m_ppcResiYuvTemp[uhDepth], 2417 m_ppcRecoYuvTemp[uhDepth], 2418 uiOffest, 2419 uhDepth ); 2420 #endif 2421 2422 xCheckDQP( rpcTempCU ); 2423 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth); 2424 } 2425 2426 } 2427 #endif 2428 #if H_3D_ARP 2429 } 2430 #endif 2431 #if H_3D_FAST_TEXTURE_ENCODING 2432 } 2433 #endif 2434 } 2435 2436 #if H_3D_DBBP 2437 Void TEncCu::xInvalidateOriginalSegments( TComYuv* pOrigYuv, TComYuv* pOrigYuvTemp, Bool* pMask, UInt uiValidSegment ) 2438 { 2439 UInt uiWidth = pOrigYuv->getWidth ( ); 2440 UInt uiHeight = pOrigYuv->getHeight( ); 2441 Pel* piSrc = pOrigYuv->getLumaAddr( ); 2442 UInt uiSrcStride = pOrigYuv->getStride(); 2443 Pel* piDst = pOrigYuvTemp->getLumaAddr( ); 2444 UInt uiDstStride = pOrigYuvTemp->getStride(); 2445 2446 UInt uiMaskStride= MAX_CU_SIZE; 2447 2448 AOF( uiWidth == uiHeight ); 2449 2450 // backup pointer 2451 Bool* pMaskStart = pMask; 2452 2453 for (Int y=0; y<uiHeight; y++) 2454 { 2455 for (Int x=0; x<uiWidth; x++) 2456 { 2457 UChar ucSegment = (UChar)pMask[x]; 2458 AOF( ucSegment < 2 ); 2459 2460 piDst[x] = (ucSegment==uiValidSegment)?piSrc[x]:DBBP_INVALID_SHORT; 2461 } 2462 2463 piSrc += uiSrcStride; 2464 piDst += uiDstStride; 2465 pMask += uiMaskStride; 2466 } 2467 2468 // now invalidate chroma 2469 Pel* piSrcU = pOrigYuv->getCbAddr(); 2470 Pel* piSrcV = pOrigYuv->getCrAddr(); 2471 UInt uiSrcStrideC = pOrigYuv->getCStride(); 2472 Pel* piDstU = pOrigYuvTemp->getCbAddr( ); 2473 Pel* piDstV = pOrigYuvTemp->getCrAddr( ); 2474 UInt uiDstStrideC = pOrigYuvTemp->getCStride(); 2475 pMask = pMaskStart; 2476 2477 for (Int y=0; y<uiHeight/2; y++) 2478 { 2479 for (Int x=0; x<uiWidth/2; x++) 2480 { 2481 UChar ucSegment = (UChar)pMask[x*2]; 2482 AOF( ucSegment < 2 ); 2483 2484 piDstU[x] = (ucSegment==uiValidSegment)?piSrcU[x]:DBBP_INVALID_SHORT; 2485 piDstV[x] = (ucSegment==uiValidSegment)?piSrcV[x]:DBBP_INVALID_SHORT; 2486 } 2487 2488 piSrcU += uiSrcStrideC; 2489 piSrcV += uiSrcStrideC; 2490 piDstU += uiDstStrideC; 2491 piDstV += uiDstStrideC; 2492 pMask += 2*uiMaskStride; 2493 } 2494 } 2495 #if MTK_SINGLE_DEPTH_MODE_I0095 2496 Void TEncCu::xCheckRDCostSingleDepth( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize ) 1391 } 1392 1393 1394 Void TEncCu::xCheckRDCostIntra( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize ) 2497 1395 { 2498 1396 UInt uiDepth = rpcTempCU->getDepth( 0 ); 2499 if( !rpcBestCU->getSlice()->getIsDepth() || (eSize != SIZE_2Nx2N)) 2500 { 2501 return; 2502 } 2503 2504 #if H_3D_VSO // M5 2505 if( m_pcRdCost->getUseRenModel() ) 2506 { 2507 UInt uiWidth = m_ppcOrigYuv[uiDepth]->getWidth (); 2508 UInt uiHeight = m_ppcOrigYuv[uiDepth]->getHeight (); 2509 Pel* piSrc = m_ppcOrigYuv[uiDepth]->getLumaAddr(); 2510 UInt uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride (); 2511 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 2512 } 2513 #endif 1397 2514 1398 2515 1399 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 2516 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );2517 rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth );2518 rpcTempCU->setCUTransquantBypassSubParts( rpcTempCU->getCUTransquantBypass(0), 0, uiDepth );2519 2520 rpcTempCU->setTrIdxSubParts(0, 0, uiDepth);2521 rpcTempCU->setCbfSubParts(0, 1, 1, 0, uiDepth);2522 rpcTempCU->setSingleDepthFlagSubParts(true, 0, uiDepth);2523 rpcTempCU->setLumaIntraDirSubParts (DC_IDX, 0, uiDepth);2524 #if H_3D_DIM_SDC2525 rpcTempCU->setSDCFlagSubParts( false, 0, uiDepth);2526 #endif2527 2528 UInt uiPreCalcDistC;2529 m_pcPredSearch ->estIntraPredSingleDepth ( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC, false );2530 2531 2532 m_ppcRecoYuvTemp[uiDepth]->copyToPicLuma(rpcTempCU->getPic()->getPicYuvRec(), rpcTempCU->getAddr(), rpcTempCU->getZorderIdxInCU() );2533 2534 2535 m_pcEntropyCoder->resetBits();2536 if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())2537 {2538 m_pcEntropyCoder->encodeCUTransquantBypassFlag( rpcTempCU, 0, true );2539 }2540 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true );2541 m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0, true );2542 2543 2544 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);2545 2546 rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits();2547 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();2548 2549 2550 #if H_3D_VSO // M62551 if( m_pcRdCost->getUseLambdaScaleVSO())2552 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );2553 else2554 #endif2555 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );2556 2557 2558 xCheckDQP( rpcTempCU );2559 xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth);2560 }2561 #endif2562 Void TEncCu::xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG )2563 {2564 AOF( !rpcTempCU->getSlice()->getIsDepth() );2565 2566 UChar uhDepth = rpcTempCU->getDepth( 0 );2567 2568 #if H_3D_VSO2569 if( m_pcRdCost->getUseRenModel() )2570 {2571 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( );2572 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight( );2573 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr( );2574 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride();2575 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2576 }2577 #endif2578 2579 UInt uiWidth = rpcTempCU->getWidth(0);2580 UInt uiHeight = rpcTempCU->getHeight(0);2581 AOF( uiWidth == uiHeight );2582 2583 #if SEC_DBBP_DISALLOW_8x8_I00782584 if(uiWidth <= 8)2585 {2586 return;2587 }2588 #endif2589 2590 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth );2591 2592 // fetch virtual depth block2593 UInt uiDepthStride = 0;2594 #if LGE_FCO_I01162595 Pel* pDepthPels = rpcTempCU->getVirtualDepthBlock(rpcTempCU->getZorderIdxInCU(), uiWidth, uiHeight, uiDepthStride);2596 #else2597 Pel* pDepthPels = rpcTempCU->getVirtualDepthBlock(0, uiWidth, uiHeight, uiDepthStride);2598 #endif2599 AOF( pDepthPels != NULL );2600 AOF( uiDepthStride != 0 );2601 2602 // derive partitioning from depth2603 PartSize eVirtualPartSize = m_pcPredSearch->getPartitionSizeFromDepth(pDepthPels, uiDepthStride, uiWidth);2604 2605 // derive segmentation mask from depth2606 Bool pMask[MAX_CU_SIZE*MAX_CU_SIZE];2607 Bool bValidMask = m_pcPredSearch->getSegmentMaskFromDepth(pDepthPels, uiDepthStride, uiWidth, uiHeight, pMask);2608 2609 if( !bValidMask )2610 {2611 return;2612 }2613 2614 // find optimal motion/disparity vector for each segment2615 DisInfo originalDvInfo = rpcTempCU->getDvInfo(0);2616 DBBPTmpData* pDBBPTmpData = rpcTempCU->getDBBPTmpData();2617 TComYuv* apPredYuv[2] = { m_ppcRecoYuvTemp[uhDepth], m_ppcPredYuvTemp[uhDepth] };2618 2619 // find optimal motion vector fields for both segments (as 2Nx2N)2620 rpcTempCU->setDepthSubParts( uhDepth, 0 );2621 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth );2622 rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth );2623 for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ )2624 {2625 rpcTempCU->setDBBPFlagSubParts(true, 0, 0, uhDepth);2626 rpcTempCU->setDvInfoSubParts(originalDvInfo, 0, uhDepth);2627 2628 // invalidate all other segments in original YUV2629 xInvalidateOriginalSegments(m_ppcOrigYuv[uhDepth], m_ppcOrigYuvDBBP[uhDepth], pMask, uiSegment);2630 2631 // do motion estimation for this segment2632 m_pcRdCost->setUseMask(true);2633 rpcTempCU->getDBBPTmpData()->eVirtualPartSize = eVirtualPartSize;2634 rpcTempCU->getDBBPTmpData()->uiVirtualPartIndex = uiSegment;2635 m_pcPredSearch->predInterSearch( rpcTempCU, m_ppcOrigYuvDBBP[uhDepth], apPredYuv[uiSegment], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], false, false, bUseMRG );2636 m_pcRdCost->setUseMask(false);2637 2638 // extract motion parameters of full block for this segment2639 pDBBPTmpData->auhInterDir[uiSegment] = rpcTempCU->getInterDir(0);2640 2641 pDBBPTmpData->abMergeFlag[uiSegment] = rpcTempCU->getMergeFlag(0);2642 pDBBPTmpData->auhMergeIndex[uiSegment] = rpcTempCU->getMergeIndex(0);2643 2644 AOF( rpcTempCU->getSPIVMPFlag(0) == false );2645 AOF( rpcTempCU->getVSPFlag(0) == 0 );2646 2647 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )2648 {2649 RefPicList eRefList = (RefPicList)uiRefListIdx;2650 2651 pDBBPTmpData->acMvd[uiSegment][eRefList] = rpcTempCU->getCUMvField(eRefList)->getMvd(0);2652 pDBBPTmpData->aiMvpNum[uiSegment][eRefList] = rpcTempCU->getMVPNum(eRefList, 0);2653 pDBBPTmpData->aiMvpIdx[uiSegment][eRefList] = rpcTempCU->getMVPIdx(eRefList, 0);2654 2655 rpcTempCU->getMvField(rpcTempCU, 0, eRefList, pDBBPTmpData->acMvField[uiSegment][eRefList]);2656 }2657 }2658 2659 // store final motion/disparity information in each PU using derived partitioning2660 rpcTempCU->setDepthSubParts( uhDepth, 0 );2661 rpcTempCU->setPartSizeSubParts ( eVirtualPartSize, 0, uhDepth );2662 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth );2663 2664 UInt uiPUOffset = ( g_auiPUOffset[UInt( eVirtualPartSize )] << ( ( rpcTempCU->getSlice()->getSPS()->getMaxCUDepth() - uhDepth ) << 1 ) ) >> 4;2665 for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ )2666 {2667 UInt uiPartAddr = uiSegment*uiPUOffset;2668 2669 rpcTempCU->setDBBPFlagSubParts(true, uiPartAddr, uiSegment, uhDepth);2670 2671 // now set stored information from 2Nx2N motion search to each partition2672 rpcTempCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[uiSegment], uiPartAddr, uiSegment, uhDepth); // interprets depth relative to LCU level2673 2674 rpcTempCU->setMergeFlagSubParts(pDBBPTmpData->abMergeFlag[uiSegment], uiPartAddr, uiSegment, uhDepth);2675 rpcTempCU->setMergeIndexSubParts(pDBBPTmpData->auhMergeIndex[uiSegment], uiPartAddr, uiSegment, uhDepth);2676 2677 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )2678 {2679 RefPicList eRefList = (RefPicList)uiRefListIdx;2680 2681 rpcTempCU->getCUMvField( eRefList )->setAllMvd(pDBBPTmpData->acMvd[uiSegment][eRefList], eVirtualPartSize, uiPartAddr, 0, uiSegment);2682 rpcTempCU->setMVPNum(eRefList, uiPartAddr, pDBBPTmpData->aiMvpNum[uiSegment][eRefList]);2683 rpcTempCU->setMVPIdx(eRefList, uiPartAddr, pDBBPTmpData->aiMvpIdx[uiSegment][eRefList]);2684 2685 rpcTempCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], eVirtualPartSize, uiPartAddr, 0, uiSegment ); // interprets depth relative to rpcTempCU level2686 }2687 }2688 2689 // reconstruct final prediction signal by combining both segments2690 #if SHARP_DBBP_SIMPLE_FLTER_I01092691 m_pcPredSearch->combineSegmentsWithMask(apPredYuv, m_ppcPredYuvTemp[uhDepth], pMask, uiWidth, uiHeight, 0, eVirtualPartSize);2692 #else2693 m_pcPredSearch->combineSegmentsWithMask(apPredYuv, m_ppcPredYuvTemp[uhDepth], pMask, uiWidth, uiHeight);2694 #endif2695 2696 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false );2697 2698 xCheckDQP( rpcTempCU );2699 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);2700 }2701 #endif2702 2703 #if HHI_DMM4_ENC_I00662704 Void TEncCu::xCheckRDCostIntra( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize, Bool bOnlyIVP )2705 #else2706 Void TEncCu::xCheckRDCostIntra( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize )2707 #endif2708 {2709 UInt uiDepth = rpcTempCU->getDepth( 0 );2710 2711 #if H_3D_VSO // M52712 if( m_pcRdCost->getUseRenModel() )2713 {2714 UInt uiWidth = m_ppcOrigYuv[uiDepth]->getWidth ();2715 UInt uiHeight = m_ppcOrigYuv[uiDepth]->getHeight ();2716 Pel* piSrc = m_ppcOrigYuv[uiDepth]->getLumaAddr();2717 UInt uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride ();2718 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2719 }2720 #endif2721 2722 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth );2723 #if MTK_SINGLE_DEPTH_MODE_I00952724 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uiDepth );2725 #endif2726 1400 rpcTempCU->setPartSizeSubParts( eSize, 0, uiDepth ); 2727 1401 rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth ); … … 2733 1407 m_pcPredSearch->preestChromaPredMode( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth] ); 2734 1408 } 2735 #if HHI_DMM4_ENC_I00662736 m_pcPredSearch ->estIntraPredQT ( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC, bSeparateLumaChroma, bOnlyIVP );2737 #else2738 1409 m_pcPredSearch ->estIntraPredQT ( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC, bSeparateLumaChroma ); 2739 #endif2740 1410 m_ppcRecoYuvTemp[uiDepth]->copyToPicLuma(rpcTempCU->getPic()->getPicYuvRec(), rpcTempCU->getAddr(), rpcTempCU->getZorderIdxInCU() ); 2741 1411 2742 #if H_3D_DIM_SDC2743 if( !rpcTempCU->getSDCFlag( 0 ) )2744 #endif2745 1412 m_pcPredSearch ->estIntraPredChromaQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC ); 2746 1413 … … 2751 1418 } 2752 1419 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2753 #if MTK_SINGLE_DEPTH_MODE_I00952754 m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0, true );2755 if(!rpcTempCU->getSingleDepthFlag(0))2756 {2757 #endif2758 1420 m_pcEntropyCoder->encodePredMode( rpcTempCU, 0, true ); 2759 1421 m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true ); 2760 #if H_3D_DIM_SDC2761 m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );2762 #endif2763 1422 m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0, true ); 2764 1423 m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true ); … … 2768 1427 m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP ); 2769 1428 setdQPFlag( bCodeDQP ); 2770 #if MTK_SINGLE_DEPTH_MODE_I00952771 }2772 #endif2773 1429 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 2774 1430 2775 1431 rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits(); 2776 1432 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 2777 #if H_3D_VSO // M62778 if( m_pcRdCost->getUseLambdaScaleVSO())2779 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );2780 else2781 #endif2782 1433 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2783 1434 … … 2798 1449 2799 1450 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 2800 #if MTK_SINGLE_DEPTH_MODE_I00952801 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uiDepth );2802 #endif2803 1451 rpcTempCU->setIPCMFlag(0, true); 2804 1452 rpcTempCU->setIPCMFlagSubParts (true, 0, rpcTempCU->getDepth(0)); … … 2817 1465 } 2818 1466 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2819 #if MTK_SINGLE_DEPTH_MODE_I00952820 m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0, true );2821 #endif2822 1467 m_pcEntropyCoder->encodePredMode ( rpcTempCU, 0, true ); 2823 1468 m_pcEntropyCoder->encodePartSize ( rpcTempCU, 0, uiDepth, true ); 2824 #if H_3D_DIM_SDC2825 m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );2826 #endif2827 1469 m_pcEntropyCoder->encodeIPCMInfo ( rpcTempCU, 0, true ); 2828 1470 … … 2831 1473 rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits(); 2832 1474 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 2833 #if H_3D_VSO // M442834 if ( m_pcRdCost->getUseVSO() )2835 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );2836 else2837 #endif2838 1475 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2839 1476 … … 2888 1525 pcCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits 2889 1526 pcCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 2890 #if H_3D_VSO // M452891 if ( m_pcRdCost->getUseVSO() )2892 pcCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( pcCU->getTotalBits(), pcCU->getTotalDistortion() );2893 else2894 #endif2895 1527 pcCU->getTotalCost() = m_pcRdCost->calcRdCost( pcCU->getTotalBits(), pcCU->getTotalDistortion() ); 2896 1528 #endif -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncCu.h
r1039 r1072 69 69 TComDataCU** m_ppcBestCU; ///< Best CUs in each depth 70 70 TComDataCU** m_ppcTempCU; ///< Temporary CUs in each depth 71 #if H_3D_ARP72 TComDataCU** m_ppcWeightedTempCU;73 #endif74 71 UChar m_uhTotalDepth; 75 72 … … 82 79 TComYuv** m_ppcOrigYuv; ///< Original Yuv for each depth 83 80 84 #if H_3D_DBBP85 TComYuv** m_ppcOrigYuvDBBP;86 #endif87 81 88 82 // Data : encoder control … … 105 99 TEncSbac* m_pcRDGoOnSbacCoder; 106 100 TEncRateCtrl* m_pcRateCtrl; 107 #if KWU_RC_MADPRED_E0227108 UInt m_LCUPredictionSAD;109 Int m_addSADDepth;110 Int m_temporalSAD;111 Int m_spatialSAD;112 #endif113 101 public: 114 102 /// copy parameters from encoder class … … 128 116 129 117 Void setBitCounter ( TComBitCounter* pcBitCounter ) { m_pcBitCounter = pcBitCounter; } 130 #if KWU_RC_MADPRED_E0227131 UInt getLCUPredictionSAD() { return m_LCUPredictionSAD; }132 #endif133 118 Int updateLCUDataISlice ( TComDataCU* pcCU, Int LCUIdx, Int width, Int height ); 134 119 protected: … … 147 132 148 133 #if AMP_MRG 149 #if H_3D_FAST_TEXTURE_ENCODING150 Void xCheckRDCostInter ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bFMD, Bool bUseMRG = false ) ;151 #else152 134 Void xCheckRDCostInter ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bUseMRG = false ); 153 #endif154 135 #else 155 136 Void xCheckRDCostInter ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize ); 156 137 #endif 157 #if H_3D_DBBP158 Void xInvalidateOriginalSegments( TComYuv* pOrigYuv, TComYuv* pOrigYuvTemp, Bool* pMask, UInt uiValidSegment );159 Void xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG = false );160 #endif161 #if MTK_SINGLE_DEPTH_MODE_I0095162 Void xCheckRDCostSingleDepth ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize );163 #endif164 #if HHI_DMM4_ENC_I0066165 Void xCheckRDCostIntra ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bOnlyIVP );166 #else167 138 Void xCheckRDCostIntra ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize ); 168 #endif169 139 Void xCheckDQP ( TComDataCU* pcCU ); 170 140 -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncEntropy.cpp
r1066 r1072 78 78 } 79 79 80 #if H_3D81 Void TEncEntropy::encodeSPS( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )82 {83 m_pcEntropyCoderIf->codeSPS( pcSPS, viewIndex, depthFlag );84 return;85 }86 #else87 80 Void TEncEntropy::encodeSPS( TComSPS* pcSPS ) 88 81 { … … 90 83 return; 91 84 } 92 #endif93 85 94 86 Void TEncEntropy::encodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) … … 119 111 m_pcEntropyCoderIf->codeSkipFlag( pcCU, uiAbsPartIdx ); 120 112 } 121 #if MTK_SINGLE_DEPTH_MODE_I0095122 Void TEncEntropy::encodeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )123 {124 if ( !pcCU->getSlice()->getIsDepth() )125 {126 return;127 }128 if(!pcCU->getSlice()->getApplySingleDepthMode())129 {130 return;131 }132 133 if( bRD )134 {135 uiAbsPartIdx = 0;136 }137 m_pcEntropyCoderIf->codeSingleDepthMode( pcCU, uiAbsPartIdx );138 }139 #endif140 113 /** encode merge flag 141 114 * \param pcCU … … 166 139 } 167 140 168 #if H_3D_IC 169 Void TEncEntropy::encodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 170 { 171 if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() || pcCU->getARPW( uiAbsPartIdx ) > 0 ) 172 { 173 return; 174 } 175 176 if( !pcCU->getSlice()->getApplyIC() ) 177 { 178 return; 179 } 180 181 if( bRD ) 182 { 183 uiAbsPartIdx = 0; 184 } 185 else 186 { 187 #if MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX 188 Int ICEnableCandidate = pcCU->getSlice()->getICEnableCandidate(pcCU->getSlice()->getDepth()); 189 Int ICEnableNum = pcCU->getSlice()->getICEnableNum(pcCU->getSlice()->getDepth()); 190 ICEnableCandidate++; 191 if(pcCU->getICFlag(uiAbsPartIdx)) 192 { 193 ICEnableNum++; 194 } 195 pcCU->getSlice()->setICEnableCandidate(pcCU->getSlice()->getDepth(), ICEnableCandidate); 196 pcCU->getSlice()->setICEnableNum(pcCU->getSlice()->getDepth(), ICEnableNum); 197 #else 198 g_aICEnableCANDIDATE[pcCU->getSlice()->getDepth()]++; 199 if(pcCU->getICFlag(uiAbsPartIdx)) 200 { 201 g_aICEnableNUM[pcCU->getSlice()->getDepth()]++; 202 } 203 #endif 204 } 205 if( pcCU->isICFlagRequired( uiAbsPartIdx ) ) 206 { 207 m_pcEntropyCoderIf->codeICFlag( pcCU, uiAbsPartIdx ); 208 } 209 } 210 #endif 211 212 #if H_3D_ARP 213 Void TEncEntropy::encodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx ) 214 { 215 if( !pcCU->getSlice()->getARPStepNum() || pcCU->isIntra( uiAbsPartIdx ) ) 216 { 217 return; 218 } 219 220 if ( pcCU->getPartitionSize(uiAbsPartIdx)!=SIZE_2Nx2N ) 221 { 222 assert(pcCU->getARPW (uiAbsPartIdx) == 0); 223 } 224 else 225 { 226 m_pcEntropyCoderIf->codeARPW( pcCU, uiAbsPartIdx ); 227 } 228 } 229 #endif 141 230 142 231 143 /** encode prediction mode … … 273 185 } 274 186 275 #if H_3D_DBBP276 #if! SEC_DBBP_EXPLICIT_SIG_I0077277 PartSize eVirtualPartSize = pcCU->getPartitionSize(uiAbsPartIdx);278 if( pcCU->getDBBPFlag(uiAbsPartIdx) )279 {280 AOF( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) );281 282 // temporarily change partition size for DBBP blocks283 pcCU->setPartSizeSubParts(RWTH_DBBP_PACK_MODE, uiAbsPartIdx, uiDepth);284 }285 #endif286 #endif287 187 288 188 m_pcEntropyCoderIf->codePartSize( pcCU, uiAbsPartIdx, uiDepth ); 289 189 290 #if H_3D_DBBP291 #if SEC_DBBP_EXPLICIT_SIG_I0077292 #if SEC_DBBP_DISALLOW_8x8_I0078293 if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && pcCU->getWidth(uiAbsPartIdx) > 8 )294 #else295 if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) )296 #endif297 #else298 #if SEC_DBBP_DISALLOW_8x8_I0078299 if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && pcCU->getWidth(uiAbsPartIdx) > 8 )300 #else301 if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) )302 #endif303 #endif304 {305 encodeDBBPFlag(pcCU, uiAbsPartIdx, bRD);306 #if !SEC_DBBP_EXPLICIT_SIG_I0077307 if( pcCU->getDBBPFlag(uiAbsPartIdx) )308 {309 // restore virtual partition size for DBBP blocks310 pcCU->setPartSizeSubParts(eVirtualPartSize, uiAbsPartIdx, uiDepth);311 }312 #endif313 }314 #endif315 190 } 316 191 … … 541 416 { 542 417 encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx,true ); 543 #if H_3D_DIM_SDC544 if(!pcCU->getSDCFlag(uiAbsPartIdx))545 #endif546 418 encodeIntraDirModeChroma( pcCU, uiAbsPartIdx, bRD ); 547 419 } … … 715 587 UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx; 716 588 UInt uiChromaOffset = uiLumaOffset>>2; 717 #if H_3D_DIM_SDC718 if( pcCU->getSDCFlag( uiAbsPartIdx ) && pcCU->isIntra( uiAbsPartIdx ) )719 {720 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );721 assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 );722 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 );723 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 );724 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 );725 }726 727 if( pcCU->getSDCFlag( uiAbsPartIdx ) && !pcCU->isIntra( uiAbsPartIdx ) )728 {729 assert( !pcCU->isSkipped( uiAbsPartIdx ) );730 assert( !pcCU->isIntra( uiAbsPartIdx) );731 assert( pcCU->getSlice()->getIsDepth() );732 }733 734 if( pcCU->getSlice()->getIsDepth() && ( pcCU->getSDCFlag( uiAbsPartIdx ) || pcCU->isIntra( uiAbsPartIdx ) ) )735 {736 Int iPartNum = ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ? 4 : 1;737 UInt uiPartOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth( uiAbsPartIdx ) << 1 ) ) >> 2;738 739 if( !pcCU->getSDCFlag( uiAbsPartIdx ) )740 {741 for( Int iPart = 0; iPart < iPartNum; iPart++ )742 {743 if( getDimType( pcCU->getLumaIntraDir( uiAbsPartIdx + uiPartOffset*iPart ) ) < DIM_NUM_TYPE )744 {745 m_pcEntropyCoderIf->codeDeltaDC( pcCU, uiAbsPartIdx + uiPartOffset*iPart );746 }747 }748 }749 else750 {751 m_pcEntropyCoderIf->codeDeltaDC( pcCU, uiAbsPartIdx );752 return;753 }754 }755 #endif756 589 757 590 if( pcCU->isIntra(uiAbsPartIdx) ) … … 812 645 } 813 646 814 #if H_3D_INTER_SDC815 Void TEncEntropy::encodeDeltaDC ( TComDataCU* pcCU, UInt absPartIdx )816 {817 m_pcEntropyCoderIf->codeDeltaDC( pcCU, absPartIdx );818 }819 820 Void TEncEntropy::encodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )821 {822 if( ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) ) ||823 ( pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getVpsDepthModesFlag( pcCU->getSlice()->getLayerIdInVps() ) ) )824 {825 return;826 }827 828 if( !pcCU->getSlice()->getIsDepth() || pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_2Nx2N || pcCU->isSkipped( uiAbsPartIdx ) )829 {830 return;831 }832 833 assert( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N || ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->isSkipped( uiAbsPartIdx ) ) );834 835 if( bRD )836 {837 uiAbsPartIdx = 0;838 }839 840 m_pcEntropyCoderIf->codeSDCFlag( pcCU, uiAbsPartIdx );841 }842 843 #endif844 #if H_3D_DBBP845 Void TEncEntropy::encodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )846 {847 if( bRD )848 {849 uiAbsPartIdx = 0;850 }851 m_pcEntropyCoderIf->codeDBBPFlag( pcCU, uiAbsPartIdx );852 }853 #endif854 647 //! \} -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncEntropy.h
r1039 r1072 69 69 70 70 virtual Void codeVPS ( TComVPS* pcVPS ) = 0; 71 #if !H_3D72 71 virtual Void codeSPS ( TComSPS* pcSPS ) = 0; 73 #else74 virtual Void codeSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) = 0;75 #endif76 72 virtual Void codePPS ( TComPPS* pcPPS ) = 0; 77 73 virtual Void codeSliceHeader ( TComSlice* pcSlice ) = 0; … … 86 82 virtual Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 87 83 virtual Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 88 #if MTK_SINGLE_DEPTH_MODE_I009589 virtual Void codeSingleDepthMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;90 #endif91 84 virtual Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 92 85 virtual Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 93 #if H_3D_ARP94 virtual Void codeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;95 #endif96 #if H_3D_IC97 virtual Void codeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;98 #endif99 #if H_3D_INTER_SDC100 virtual Void codeDeltaDC ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;101 virtual Void codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;102 #endif103 #if H_3D_DBBP104 virtual Void codeDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;105 #endif106 86 virtual Void codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 107 87 … … 165 145 Void encodeVPS ( TComVPS* pcVPS); 166 146 // SPS 167 #if H_3D168 Void encodeSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );169 #else170 147 Void encodeSPS ( TComSPS* pcSPS ); 171 #endif172 148 Void encodePPS ( TComPPS* pcPPS ); 173 149 Void encodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false ); 174 150 Void encodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 175 151 Void encodeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 176 #if MTK_SINGLE_DEPTH_MODE_I0095177 Void encodeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD=false );178 #endif179 152 Void encodePUWise ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 180 153 Void encodeInterDirPU ( TComDataCU* pcSubCU, UInt uiAbsPartIdx ); … … 184 157 Void encodeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 185 158 Void encodeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 186 #if H_3D_ARP187 Void encodeARPW ( TComDataCU* pcCU, UInt uiAbspartIdx );188 #endif189 #if H_3D_IC190 Void encodeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );191 #endif192 #if H_3D_INTER_SDC193 Void encodeDeltaDC ( TComDataCU* pcCU, UInt absPartIdx );194 Void encodeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );195 #endif196 #if H_3D_DBBP197 Void encodeDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );198 #endif199 159 Void encodePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 200 160 Void encodePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false ); -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncGOP.cpp
r1066 r1072 103 103 m_viewId = 0; 104 104 m_pocLastCoded = -1; 105 #if H_3D106 m_viewIndex = 0;107 m_isDepth = false;108 #endif109 105 #endif 110 106 #if FIX1172 … … 155 151 m_layerId = pcTEncTop->getLayerId(); 156 152 m_viewId = pcTEncTop->getViewId(); 157 #if H_3D158 m_viewIndex = pcTEncTop->getViewIndex();159 m_isDepth = pcTEncTop->getIsDepth();160 #endif161 #endif162 #if MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX163 m_aICEnableCandidate = pcTEncTop->getICEnableCandidate();164 m_aICEnableNum = pcTEncTop->getICEnableNum();165 #endif166 #if KWU_FIX_URQ167 m_pcRateCtrl = pcTEncTop->getRateCtrl();168 153 #endif 169 154 } … … 652 637 pcPic ->setLayerId ( getLayerId() ); 653 638 pcPic ->setViewId ( getViewId() ); 654 #if !H_3D655 639 pcSlice->setLayerId ( getLayerId() ); 656 640 pcSlice->setViewId ( getViewId() ); 657 641 pcSlice->setVPS ( m_pcEncTop->getVPS() ); 658 #else659 pcPic ->setViewIndex ( getViewIndex() );660 pcPic ->setIsDepth( getIsDepth() );661 pcSlice->setCamparaSlice( pcPic->getCodedScale(), pcPic->getCodedOffset() );662 #endif663 642 #endif 664 643 //set default slice level flag to the same as SPS level flag … … 937 916 pcSlice->setRefPicList ( rcListPic ); 938 917 #endif 939 #if MTK_SINGLE_DEPTH_MODE_I0095940 TEncTop* pcEncTop = (TEncTop*) m_pcCfg;941 bool enableSingleDepthMode=false;942 if(pcEncTop->getUseSingleDepthMode())943 {944 if(pcSlice->getIsDepth())945 {946 enableSingleDepthMode=true;947 }948 }949 pcSlice->setApplySingleDepthMode(enableSingleDepthMode);950 #endif951 #if H_3D_ARP952 //GT: This seems to be broken when layerId in vps is not equal to layerId in nuh953 pcSlice->setARPStepNum(m_ivPicLists);954 if(pcSlice->getARPStepNum() > 1)955 {956 for(Int iLayerId = 0; iLayerId < getLayerId(); iLayerId ++ )957 {958 Int iViewIdx = pcSlice->getVPS()->getViewIndex(iLayerId);959 Bool bIsDepth = ( pcSlice->getVPS()->getDepthId ( iLayerId ) == 1 );960 if( iViewIdx<getViewIndex() && !bIsDepth )961 {962 pcSlice->setBaseViewRefPicList( m_ivPicLists->getPicList( iLayerId ), iViewIdx );963 }964 }965 }966 #endif967 #if H_3D968 pcSlice->setIvPicLists( m_ivPicLists );969 #if H_3D_IV_MERGE970 assert( !m_pcEncTop->getIsDepth() || ( pcSlice->getTexturePic() != 0 ) );971 #endif972 #endif973 #if MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX974 pcSlice->setICEnableCandidate( m_aICEnableCandidate );975 pcSlice->setICEnableNum( m_aICEnableNum );976 #endif977 918 // Slice info. refinement 978 919 #if H_MV … … 1025 966 1026 967 pcSlice->setList1IdxToList0Idx(); 1027 #if H_3D_TMVP1028 if(pcSlice->getLayerId())1029 pcSlice->generateAlterRefforTMVP();1030 #endif1031 968 if (m_pcEncTop->getTMVPModeId() == 2) 1032 969 { … … 1059 996 #endif 1060 997 1061 #if H_3D_VSO1062 // Should be moved to TEncTop !!!1063 Bool bUseVSO = m_pcEncTop->getUseVSO();1064 1065 TComRdCost* pcRdCost = m_pcEncTop->getRdCost();1066 1067 pcRdCost->setUseVSO( bUseVSO );1068 1069 // SAIT_VSO_EST_A00331070 pcRdCost->setUseEstimatedVSD( m_pcEncTop->getUseEstimatedVSD() );1071 1072 if ( bUseVSO )1073 {1074 Int iVSOMode = m_pcEncTop->getVSOMode();1075 pcRdCost->setVSOMode( iVSOMode );1076 pcRdCost->setAllowNegDist( m_pcEncTop->getAllowNegDist() );1077 1078 // SAIT_VSO_EST_A00331079 #if H_3D_FCO1080 Bool flagRec;1081 flagRec = ((m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), false, pcSlice->getPOC(), true) == NULL) ? false: true);1082 pcRdCost->setVideoRecPicYuv( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), false, pcSlice->getPOC(), flagRec ) );1083 pcRdCost->setDepthPicYuv ( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), true, pcSlice->getPOC(), false ) );1084 #else1085 pcRdCost->setVideoRecPicYuv( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), false , pcSlice->getPOC(), true ) );1086 pcRdCost->setDepthPicYuv ( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), true , pcSlice->getPOC(), false ) );1087 #endif1088 1089 // LGE_WVSO_A01191090 Bool bUseWVSO = m_pcEncTop->getUseWVSO();1091 pcRdCost->setUseWVSO( bUseWVSO );1092 1093 }1094 #endif1095 998 /////////////////////////////////////////////////////////////////////////////////////////////////// Compress a slice 1096 999 // Slice compression … … 1141 1044 m_pcRateCtrl->initRCPic( frameLevel ); 1142 1045 1143 #if KWU_RC_MADPRED_E02271144 if(m_pcCfg->getLayerId() != 0)1145 {1146 m_pcRateCtrl->getRCPic()->setIVPic( m_pcEncTop->getEncTop()->getTEncTop(0)->getRateCtrl()->getRCPic() );1147 }1148 #endif1149 1046 1150 1047 estimatedBits = m_pcRateCtrl->getRCPic()->getTargetBits(); … … 1182 1079 else // normal case 1183 1080 { 1184 #if KWU_RC_MADPRED_E02271185 if(m_pcRateCtrl->getLayerID() != 0)1186 {1187 list<TEncRCPic*> listPreviousPicture = m_pcRateCtrl->getPicList();1188 lambda = m_pcRateCtrl->getRCPic()->estimatePicLambdaIV( listPreviousPicture, pcSlice->getPOC() );1189 sliceQP = m_pcRateCtrl->getRCPic()->estimatePicQP( lambda, listPreviousPicture );1190 }1191 else1192 {1193 #endif1194 1081 list<TEncRCPic*> listPreviousPicture = m_pcRateCtrl->getPicList(); 1195 1082 lambda = m_pcRateCtrl->getRCPic()->estimatePicLambda( listPreviousPicture, pcSlice->getSliceType()); 1196 1083 sliceQP = m_pcRateCtrl->getRCPic()->estimatePicQP( lambda, listPreviousPicture ); 1197 #if KWU_RC_MADPRED_E02271198 }1199 #endif1200 1084 } 1201 1085 … … 1325 1209 m_storedStartCUAddrForEncodingSliceSegment.push_back(nextCUAddr); 1326 1210 startCUAddrSliceSegmentIdx++; 1327 #if H_3D_NBDV 1328 if(pcSlice->getViewIndex() && !pcSlice->getIsDepth()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done. 1329 { 1330 Int iColPoc = pcSlice->getRefPOC(RefPicList(1-pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx()); 1331 pcPic->setNumDdvCandPics(pcPic->getDisCandRefPictures(iColPoc)); 1332 } 1333 #endif 1334 #if H_3D 1335 pcSlice->setDepthToDisparityLUTs(); 1336 1337 #endif 1338 1339 #if H_3D_NBDV 1340 if(pcSlice->getViewIndex() && !pcSlice->getIsDepth() && !pcSlice->isIntra()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done. 1341 { 1342 pcPic->checkTemporalIVRef(); 1343 } 1344 1345 if(pcSlice->getIsDepth()) 1346 { 1347 pcPic->checkTextureRef(); 1348 } 1349 #endif 1211 1350 1212 while(nextCUAddr<uiRealEndAddress) // determine slice boundaries 1351 1213 { … … 1470 1332 pcSlice->getSPS()->getVuiParameters()->setHrdParametersPresentFlag( true ); 1471 1333 } 1472 #if !H_3D1473 1334 m_pcEntropyCoder->encodeSPS(pcSlice->getSPS()); 1474 #else1475 m_pcEntropyCoder->encodeSPS(pcSlice->getSPS(), pcSlice->getViewIndex(), pcSlice->getIsDepth() );1476 #endif1477 1335 writeRBSPTrailingBits(nalu.m_Bitstream); 1478 1336 accessUnit.push_back(new NALUnitEBSP(nalu)); … … 1483 1341 #else 1484 1342 nalu = NALUnit(NAL_UNIT_PPS); 1485 #endif1486 #if PPS_FIX_DEPTH1487 if(!pcSlice->getIsDepth() || !pcSlice->getViewIndex() )1488 {1489 1343 #endif 1490 1344 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 1494 1348 actualTotalBits += UInt(accessUnit.back()->m_nalUnitData.str().size()) * 8; 1495 1349 1496 #if PPS_FIX_DEPTH1497 }1498 #endif1499 1350 xCreateLeadingSEIMessages(accessUnit, pcSlice->getSPS()); 1500 1351 … … 2028 1879 } 2029 1880 } // end iteration over slices 2030 #if H_3D2031 pcPic->compressMotion(2);2032 #endif2033 #if !H_3D2034 1881 pcPic->compressMotion(); 2035 #endif2036 1882 #if H_MV 2037 1883 m_pocLastCoded = pcPic->getPOC(); … … 2452 2298 } 2453 2299 #endif 2454 #if H_3D_VSO2455 Void TEncGOP::preLoopFilterPicAll( TComPic* pcPic, Dist64& ruiDist, UInt64& ruiBits )2456 #else2457 2300 Void TEncGOP::preLoopFilterPicAll( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits ) 2458 #endif2459 2301 { 2460 2302 TComSlice* pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx()); … … 2570 2412 } 2571 2413 2572 #if H_3D_VSO2573 Dist64 TEncGOP::xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1)2574 #else2575 2414 UInt64 TEncGOP::xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1) 2576 #endif2577 2415 { 2578 2416 Int x, y; … … 2586 2424 Int iHeight = pcPic0->getHeight(); 2587 2425 2588 #if H_3D_VSO2589 Dist64 uiTotalDiff = 0;2590 #else2591 2426 UInt64 uiTotalDiff = 0; 2592 #endif2593 2427 2594 2428 for( y = 0; y < iHeight; y++ ) … … 2706 2540 } 2707 2541 2708 #if H_3D_VSO2709 #if H_3D_VSO_SYNTH_DIST_OUT2710 if ( m_pcRdCost->getUseRenModel() )2711 {2712 unsigned int maxval = 255 * (1<<(g_uiBitDepth + g_uiBitIncrement -8));2713 Double fRefValueY = (double) maxval * maxval * iSize;2714 Double fRefValueC = fRefValueY / 4.0;2715 TRenModel* pcRenModel = m_pcEncTop->getEncTop()->getRenModel();2716 Int64 iDistVSOY, iDistVSOU, iDistVSOV;2717 pcRenModel->getTotalSSE( iDistVSOY, iDistVSOU, iDistVSOV );2718 dYPSNR = ( iDistVSOY ? 10.0 * log10( fRefValueY / (Double) iDistVSOY ) : 99.99 );2719 dUPSNR = ( iDistVSOU ? 10.0 * log10( fRefValueC / (Double) iDistVSOU ) : 99.99 );2720 dVPSNR = ( iDistVSOV ? 10.0 * log10( fRefValueC / (Double) iDistVSOV ) : 99.99 );2721 }2722 else2723 {2724 #endif2725 #endif2726 2542 iHeight >>= 1; 2727 2543 iWidth >>= 1; … … 2762 2578 dUPSNR = ( uiSSDU ? 10.0 * log10( fRefValueC / (Double)uiSSDU ) : 99.99 ); 2763 2579 dVPSNR = ( uiSSDV ? 10.0 * log10( fRefValueC / (Double)uiSSDV ) : 99.99 ); 2764 #if H_3D_VSO2765 #if H_3D_VSO_SYNTH_DIST_OUT2766 }2767 #endif2768 #endif2769 2580 /* calculate the size of the access unit, excluding: 2770 2581 * - any AnnexB contributions (start_code_prefix, zero_byte, etc.,) -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncGOP.h
r1066 r1072 57 57 #include "TEncAnalyze.h" 58 58 #include "TEncRateCtrl.h" 59 #if KWU_RC_MADPRED_E022760 #include "../App/TAppEncoder/TAppEncTop.h"61 #endif62 59 #include <vector> 63 60 … … 111 108 Int m_layerId; 112 109 Int m_viewId; 113 #if H_3D114 Int m_viewIndex;115 Bool m_isDepth;116 #endif117 #endif118 #if MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX119 Int *m_aICEnableCandidate;120 Int *m_aICEnableNum;121 110 #endif 122 111 //--Adaptive Loop filter … … 168 157 Int getLayerId () { return m_layerId; } 169 158 Int getViewId () { return m_viewId; } 170 #if H_3D171 Int getViewIndex () { return m_viewIndex; }172 Bool getIsDepth () { return m_isDepth; }173 #endif174 159 #endif 175 160 … … 181 166 Void printOutSummary ( UInt uiNumAllPicCoded , bool isField); 182 167 #endif 183 #if H_3D_VSO184 Void preLoopFilterPicAll ( TComPic* pcPic, Dist64& ruiDist, UInt64& ruiBits );185 #else186 168 Void preLoopFilterPicAll ( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits ); 187 #endif 188 189 #if KWU_RC_MADPRED_E0227 190 TEncTop* getEncTop() { return m_pcEncTop; } 191 #endif 169 192 170 193 171 TEncSlice* getSliceEncoder() { return m_pcSliceEncoder; } … … 206 184 Void xCalculateInterlacedAddPSNR( TComPic* pcPicOrgTop, TComPic* pcPicOrgBottom, TComPicYuv* pcPicRecTop, TComPicYuv* pcPicRecBottom, const AccessUnit& accessUnit, Double dEncTime ); 207 185 208 #if H_3D_VSO209 Dist64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1);210 #else211 186 UInt64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1); 212 #endif213 187 214 188 Double xCalculateRVM(); -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncRateCtrl.cpp
r872 r1072 480 480 481 481 m_LCUs = NULL; 482 #if KWU_RC_MADPRED_E0227483 m_lastIVPicture = NULL;484 #endif485 482 486 483 m_picActualHeaderBits = 0; … … 489 486 m_picLambda = 0.0; 490 487 491 #if KWU_RC_MADPRED_E0227492 m_IVtotalMAD = 0.0;493 #endif494 488 } 495 489 … … 565 559 } 566 560 567 #if KWU_RC_MADPRED_E0227 568 Void TEncRCPic::addToPictureLsitIV( list<TEncRCPic*>& listPreviousPictures ) 569 { 570 m_lastIVPicture = NULL; 571 m_lastIVPicture = this; 572 } 573 574 Void TEncRCPic::setIVPic( TEncRCPic* BaseRCPic ) 575 { 576 m_lastIVPicture = BaseRCPic; 577 } 578 #endif 579 580 #if KWU_RC_MADPRED_E0227 581 Void TEncRCPic::create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures, Int layerID ) 582 #else 561 583 562 Void TEncRCPic::create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures ) 584 #endif585 563 { 586 564 destroy(); … … 631 609 m_LCUs[LCUIdx].m_numberOfPixel = currWidth * currHeight; 632 610 633 #if KWU_RC_MADPRED_E0227634 m_LCUs[LCUIdx].m_CUWidth = currWidth;635 m_LCUs[LCUIdx].m_CUHeight = currHeight;636 m_LCUs[LCUIdx].m_IVMAD = -1.0;637 #endif638 611 } 639 612 } … … 644 617 645 618 646 #if KWU_RC_MADPRED_E0227 647 m_LayerID = layerID; 648 m_lastIVPicture = NULL; 649 m_IVtotalMAD = 0.0; 650 #endif 651 652 653 #if KWU_RC_MADPRED_E0227 654 list<TEncRCPic*>::reverse_iterator it; 655 if( m_LayerID != 0) 656 { 657 m_lastIVPicture = NULL; 658 for ( it = listPreviousPictures.rbegin(); it != listPreviousPictures.rend(); it++ ) 659 { 660 if ( (*it)->getLayerID() == 0 ) 661 { 662 m_lastIVPicture = (*it); 663 break; 664 } 665 } 666 } 667 668 m_lastPicture = NULL; 669 for ( it = listPreviousPictures.rbegin(); it != listPreviousPictures.rend(); it++ ) 670 { 671 if ( (*it)->getFrameLevel() == m_frameLevel ) 672 { 673 m_lastPicture = (*it); 674 break; 675 } 676 } 677 #endif 619 620 678 621 } 679 622 … … 823 766 824 767 825 #if KWU_RC_MADPRED_E0227826 Double TEncRCPic::estimatePicLambdaIV( list<TEncRCPic*>& listPreviousPictures, Int CurPOC )827 {828 Double alpha = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha;829 Double beta = m_encRCSeq->getPicPara( m_frameLevel ).m_beta;830 Double bpp = (Double)m_targetBits/(Double)m_numberOfPixel;831 Double estLambda = alpha * pow( bpp, beta );832 Double lastLevelLambda = -1.0;833 Double lastPicLambda = -1.0;834 Double lastValidLambda = -1.0;835 list<TEncRCPic*>::iterator it;836 837 if(listPreviousPictures.size() == 0 || CurPOC%8 == 0)838 {839 lastLevelLambda = m_lastIVPicture->getPicActualLambda();840 lastPicLambda = m_lastIVPicture->getPicActualLambda();841 }842 else843 {844 for ( it = listPreviousPictures.begin(); it != listPreviousPictures.end(); it++ )845 {846 if ( (*it)->getFrameLevel() == m_frameLevel )847 {848 lastLevelLambda = (*it)->getPicActualLambda();849 }850 lastPicLambda = (*it)->getPicActualLambda();851 852 if ( lastPicLambda > 0.0 )853 {854 lastValidLambda = lastPicLambda;855 }856 }857 }858 859 if ( lastLevelLambda > 0.0 )860 {861 lastLevelLambda = Clip3( 0.1, 10000.0, lastLevelLambda );862 estLambda = Clip3( lastLevelLambda * pow( 2.0, -3.0/3.0 ), lastLevelLambda * pow( 2.0, 3.0/3.0 ), estLambda );863 }864 865 if ( lastPicLambda > 0.0 )866 {867 lastPicLambda = Clip3( 0.1, 2000.0, lastPicLambda );868 estLambda = Clip3( lastPicLambda * pow( 2.0, -10.0/3.0 ), lastPicLambda * pow( 2.0, 10.0/3.0 ), estLambda );869 }870 else if ( lastValidLambda > 0.0 )871 {872 lastValidLambda = Clip3( 0.1, 2000.0, lastValidLambda );873 estLambda = Clip3( lastValidLambda * pow(2.0, -10.0/3.0), lastValidLambda * pow(2.0, 10.0/3.0), estLambda );874 }875 else876 {877 estLambda = Clip3( 0.1, 10000.0, estLambda );878 }879 880 if ( estLambda < 0.1 )881 {882 estLambda = 0.1;883 }884 885 m_estPicLambda = estLambda;886 return estLambda;887 }888 #endif889 768 890 769 … … 935 814 936 815 937 #if KWU_RC_MADPRED_E0227938 Double TEncRCPic::getLCUTargetBppforInterView( list<TEncRCPic*>& listPreviousPictures, TComDataCU* pcCU, Double basePos, Double curPos, Double focalLen, Double znear, Double zfar, Int direction, Int* disparity )939 {940 Int LCUIdx = getLCUCoded();941 Double bpp = -1.0;942 Int avgBits = 0;943 #if !M0036_RC_IMPROVEMENT944 Double totalMAD = -1.0;945 Double MAD = -1.0;946 #endif947 948 Double totalMAD = -1.0;949 Double MAD = -1.0;950 951 Double IVMAD = -1.0;952 Double SAD = 0.0;953 Int x, y;954 Int Sum = 0;955 956 {957 Pel* pOrg = pcCU->getSlice()->getIvPic(false, 0)->getPicYuvOrg()->getLumaAddr(pcCU->getAddr(), 0);958 Pel* pRec = pcCU->getSlice()->getIvPic(false, 0)->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), 0);959 Pel* pDep = pcCU->getSlice()->getIvPic(true, pcCU->getSlice()->getViewIndex())->getPicYuvOrg()->getLumaAddr(pcCU->getAddr(), 0);960 Int iStride = pcCU->getSlice()->getIvPic(true, pcCU->getSlice()->getViewIndex())->getPicYuvOrg()->getStride();961 962 Int width = m_LCUs[ LCUIdx ].m_CUWidth;963 Int height = m_LCUs[ LCUIdx ].m_CUHeight;964 965 for( y = 0 ; y < pcCU->getSlice()->getSPS()->getMaxCUHeight() ; y+=8)966 {967 for( x = 0 ; x < pcCU->getSlice()->getSPS()->getMaxCUWidth() ; x+=8)968 {969 Sum += pDep[x];970 }971 pDep += iStride;972 }973 974 Double AvgDepth = (Double)Sum/((pcCU->getSlice()->getSPS()->getMaxCUHeight()/8)*(pcCU->getSlice()->getSPS()->getMaxCUWidth()/8));975 976 Double fL = focalLen * abs( basePos - curPos );977 Double z = abs( 1.0 / znear - 1.0 / zfar ) * ((Double)(AvgDepth) / (( 1 << g_bitDepthY ) - 1) ) + abs(1.0 / zfar);978 *disparity = (Int)(direction*fL * z);979 Int shift = DISTORTION_PRECISION_ADJUSTMENT(g_bitDepthY-8);980 981 Int disp = *disparity;982 Int posX, posY;983 pcCU->getPosInPic(0, posX, posY);984 if((posX + *disparity) < 0 || (posX + *disparity + width) >= pcCU->getSlice()->getSPS()->getMaxCUWidth())985 {986 disp = 0;987 }988 989 for( y = 0; y < height; y++ )990 {991 for( x = 0; x < width; x++ )992 {993 SAD += abs( pOrg[Clip3(0, (Int)(pcCU->getPic()->getPicYuvOrg()->getWidth() - pcCU->getSlice()->getSPS()->getMaxCUWidth()), x + disp)]994 - pRec[Clip3(0, (Int)(pcCU->getPic()->getPicYuvOrg()->getWidth() - pcCU->getSlice()->getSPS()->getMaxCUWidth()), x + disp)] )>>shift;995 }996 pOrg += iStride;997 pRec += iStride;998 }999 IVMAD = SAD / (Double)(height * width);1000 IVMAD = IVMAD * IVMAD;1001 1002 m_LCUs[ LCUIdx ].m_IVMAD = IVMAD;1003 if(m_lastPicture)1004 {1005 m_LCUs[ LCUIdx ].m_MAD = m_lastPicture->getLCU(LCUIdx).m_MAD;1006 }1007 1008 MAD = m_LCUs[ LCUIdx ].m_IVMAD;1009 1010 if(m_lastPicture)1011 {1012 totalMAD = m_lastPicture->getTotalMAD(); // get total MAD of temporal frame1013 for ( Int i=0; i<LCUIdx; i++ )1014 {1015 totalMAD -= m_lastPicture->getLCU(i).m_MAD;1016 }1017 }1018 else1019 {1020 totalMAD = m_lastIVPicture->getTotalMAD(); // get total MAD of inter-view frame1021 for ( Int i=0; i<LCUIdx; i++ )1022 {1023 totalMAD -= m_lastIVPicture->getLCU(i).m_MAD;1024 }1025 }1026 1027 1028 if ( totalMAD > 0.1 )1029 {1030 avgBits = Int( (m_bitsLeft * MAD) / totalMAD );1031 }1032 else1033 {1034 avgBits = Int( (m_bitsLeft) / m_LCULeft );1035 }1036 }1037 1038 if ( avgBits < 5 )1039 {1040 avgBits = 5;1041 }1042 1043 bpp = ( Double )avgBits/( Double )m_LCUs[ LCUIdx ].m_numberOfPixel;1044 m_LCUs[ LCUIdx ].m_targetBits = avgBits;1045 1046 return bpp;1047 }1048 #endif1049 816 1050 817 … … 1257 1024 } 1258 1025 m_picLambda = averageLambda; 1259 #if KWU_RC_MADPRED_E02271260 m_totalMAD = 0;1261 for ( Int i=0; i<m_numberOfLCU; i++ )1262 {1263 m_totalMAD += m_LCUs[i].m_MAD;1264 }1265 #endif1266 1026 1267 1027 Double alpha = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha; … … 1439 1199 } 1440 1200 1441 #if KWU_RC_MADPRED_E02271442 Void TEncRateCtrl::init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP], Int layerID )1443 #else1444 1201 Void TEncRateCtrl::init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] ) 1445 #endif1446 1202 { 1447 1203 destroy(); … … 1630 1386 } 1631 1387 1632 #if KWU_RC_MADPRED_E02271633 setLayerID(layerID);1634 #endif1635 1388 1636 1389 delete[] bitsRatio; … … 1641 1394 { 1642 1395 m_encRCPic = new TEncRCPic; 1643 #if KWU_RC_MADPRED_E02271644 m_encRCPic->create( m_encRCSeq, m_encRCGOP, frameLevel, m_listRCPictures, m_LayerID );1645 #else1646 1396 m_encRCPic->create( m_encRCSeq, m_encRCGOP, frameLevel, m_listRCPictures ); 1647 #endif1648 1397 } 1649 1398 -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncRateCtrl.h
r872 r1072 87 87 Double m_costIntra; 88 88 Int m_targetBitsLeft; 89 #if KWU_RC_MADPRED_E022790 Double m_MAD;91 Int m_CUWidth;92 Int m_CUHeight;93 Double m_IVMAD;94 #endif95 89 }; 96 90 … … 228 222 229 223 public: 230 #if KWU_RC_MADPRED_E0227231 Void create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures, Int layerID );232 #else233 224 Void create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures ); 234 #endif235 225 Void destroy(); 236 226 237 #if KWU_RC_MADPRED_E0227238 Double estimatePicLambdaIV( list<TEncRCPic*>& listPreviousPictures, Int curPOC );239 #endif240 227 Int estimatePicQP ( Double lambda, list<TEncRCPic*>& listPreviousPictures ); 241 228 Int getRefineBitsForIntra(Int orgBits); … … 247 234 Double getLCUTargetBpp(SliceType eSliceType); 248 235 Double getLCUEstLambdaAndQP(Double bpp, Int clipPicQP, Int *estQP); 249 #if KWU_RC_MADPRED_E0227250 Double getLCUTargetBppforInterView( list<TEncRCPic*>& listPreviousPictures, TComDataCU* pcCU, Double basePos, Double curPos, Double focalLen, Double znear, Double zfar, Int direction, Int* disparity );251 #endif252 236 Double getLCUEstLambda( Double bpp ); 253 237 Int getLCUEstQP( Double lambda, Int clipPicQP ); … … 257 241 258 242 Void addToPictureLsit( list<TEncRCPic*>& listPreviousPictures ); 259 #if KWU_RC_MADPRED_E0227260 Void addToPictureLsitIV( list<TEncRCPic*>& listPreviousPictures );261 Void setIVPic( TEncRCPic* baseRCPic );262 #endif263 243 Double calAverageQP(); 264 244 Double calAverageLambda(); … … 288 268 Void setTotalIntraCost(Double cost) { m_totalCostIntra = cost; } 289 269 Void getLCUInitTargetBits(); 290 #if KWU_RC_MADPRED_E0227291 Double getTotalMAD() { return m_totalMAD; }292 Void setTotalMAD( Double MAD ) { m_totalMAD = MAD; }293 294 Double getIVTotalMAD() { return m_IVtotalMAD; }295 Void setIVTotalMAD( Double MAD ) { m_IVtotalMAD = MAD; }296 #endif297 270 298 271 Int getPicActualBits() { return m_picActualBits; } … … 304 277 Void setPicEstLambda( Double lambda ) { m_picLambda = lambda; } 305 278 306 #if KWU_RC_MADPRED_E0227307 Int getLayerID() { return m_LayerID; }308 Void setLayerID(Int layerid) { m_LayerID = layerid; }309 #endif310 279 private: 311 280 TEncRCSeq* m_encRCSeq; … … 331 300 Int m_picQP; // in integer form 332 301 Double m_picLambda; 333 #if KWU_RC_MADPRED_E0227334 Double m_totalMAD;335 TEncRCPic* m_lastPicture;336 Int m_LayerID;337 TEncRCPic* m_lastIVPicture;338 Double m_IVtotalMAD;339 #endif340 302 }; 341 303 … … 347 309 348 310 public: 349 #if KWU_RC_MADPRED_E0227350 Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP], Int layerID );351 #else352 311 Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] ); 353 #endif354 312 Void destroy(); 355 313 Void initRCPic( Int frameLevel ); … … 365 323 list<TEncRCPic*>& getPicList() { return m_listRCPictures; } 366 324 367 #if KWU_RC_MADPRED_E0227368 Int getLayerID() { return m_LayerID; }369 Void setLayerID(Int layerid) { m_LayerID = layerid; }370 #endif371 325 private: 372 326 TEncRCSeq* m_encRCSeq; … … 375 329 list<TEncRCPic*> m_listRCPictures; 376 330 Int m_RCQP; 377 #if KWU_RC_MADPRED_E0227 378 Int m_LayerID; 331 }; 332 379 333 #endif 380 }; 381 382 #endif 383 384 334 335 -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncSbac.cpp
r1066 r1072 58 58 , m_cCUSplitFlagSCModel ( 1, 1, NUM_SPLIT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels ) 59 59 , m_cCUSkipFlagSCModel ( 1, 1, NUM_SKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 60 #if MTK_SINGLE_DEPTH_MODE_I009561 , m_cCUSingleDepthFlagSCModel ( 1, 1, NUM_SINGLEDEPTH_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)62 , m_cSingleDepthValueSCModel ( 1, 1, NUM_SINGLE_DEPTH_VALUE_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels)63 #endif64 60 , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 65 61 , m_cCUMergeIdxExtSCModel ( 1, 1, NUM_MERGE_IDX_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 66 #if H_3D_ARP67 , m_cCUPUARPWSCModel ( 1, 1, NUM_ARPW_CTX , m_contextModels + m_numContextModels, m_numContextModels)68 #endif69 #if H_3D_IC70 , m_cCUICFlagSCModel ( 1, 1, NUM_IC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)71 #endif72 62 , m_cCUPartSizeSCModel ( 1, 1, NUM_PART_SIZE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 73 63 , m_cCUPredModeSCModel ( 1, 1, NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 92 82 , m_cTransformSkipSCModel ( 1, 2, NUM_TRANSFORMSKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 93 83 , m_CUTransquantBypassFlagSCModel( 1, 1, NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX, m_contextModels + m_numContextModels, m_numContextModels) 94 #if H_3D_DIM95 , m_cDepthIntraModeSCModel ( 1, 1, NUM_DEPTH_INTRA_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels)96 , m_cDdcFlagSCModel ( 1, 1, NUM_DDC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)97 , m_cDdcDataSCModel ( 1, 1, NUM_DDC_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels)98 , m_cAngleFlagSCModel ( 1, 1, NUM_ANGLE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)99 #if H_3D_DIM_SDC100 , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)101 , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels)102 #endif103 #endif104 #if H_3D_DIM_SDC105 , m_cSDCFlagSCModel ( 1, 1, NUM_SDC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)106 #endif107 #if H_3D_DBBP108 , m_cDBBPFlagSCModel ( 1, 1, DBBP_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)109 #endif110 84 { 111 85 assert( m_numContextModels <= MAX_NUM_CTX_MOD ); … … 134 108 135 109 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); 136 #if MTK_SINGLE_DEPTH_MODE_I0095137 m_cCUSingleDepthFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLEDEPTH_FLAG );138 m_cSingleDepthValueSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );139 #endif140 110 m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT); 141 111 m_cCUMergeIdxExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT); 142 #if H_3D_ARP143 m_cCUPUARPWSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW );144 #endif145 #if H_3D_IC146 m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG );147 #endif148 112 m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); 149 113 m_cCUPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PRED_MODE ); … … 169 133 m_CUTransquantBypassFlagSCModel.initBuffer( eSliceType, iQp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); 170 134 171 #if H_3D_DIM172 m_cDepthIntraModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DEPTH_INTRA_MODE );173 m_cDdcFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );174 m_cDdcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_DATA );175 m_cAngleFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ANGLE_FLAG );176 #if H_3D_DIM_SDC177 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG );178 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL );179 #endif180 #endif181 #if H_3D_DIM_SDC182 m_cSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );183 #endif184 #if H_3D_DBBP185 m_cDBBPFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );186 #endif187 135 // new structure 188 136 m_uiLastQp = iQp; … … 214 162 curCost = m_cCUSplitFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SPLIT_FLAG ); 215 163 curCost += m_cCUSkipFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SKIP_FLAG ); 216 #if MTK_SINGLE_DEPTH_MODE_I0095217 curCost += m_cCUSingleDepthFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SINGLEDEPTH_FLAG );218 curCost += m_cSingleDepthValueSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );219 #endif220 164 curCost += m_cCUMergeFlagExtSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT); 221 165 curCost += m_cCUMergeIdxExtSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_MERGE_IDX_EXT); 222 #if H_3D_ARP223 curCost += m_cCUPUARPWSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_ARPW );224 #endif225 #if H_3D_IC226 curCost += m_cCUICFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_IC_FLAG );227 #endif228 #if H_3D_DIM_SDC229 curCost += m_cSDCFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SDC_FLAG );230 #endif231 #if H_3D_DBBP232 curCost += m_cDBBPFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DBBP_FLAG );233 #endif234 166 curCost += m_cCUPartSizeSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_PART_SIZE ); 235 167 curCost += m_cCUPredModeSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_PRED_MODE ); … … 254 186 curCost += m_cTransformSkipSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_TRANSFORMSKIP_FLAG ); 255 187 curCost += m_CUTransquantBypassFlagSCModel.calcCost( curSliceType, qp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); 256 #if H_3D_DIM257 #if SEPARATE_FLAG_I0085258 if( m_pcSlice->getVpsDepthModesFlag() || m_pcSlice->getIVPFlag() )259 #else260 if( m_pcSlice->getVpsDepthModesFlag() )261 #endif262 {263 curCost += m_cDepthIntraModeSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DEPTH_INTRA_MODE );264 curCost += m_cDdcFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DDC_FLAG );265 curCost += m_cDdcDataSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DDC_DATA );266 curCost += m_cAngleFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_ANGLE_FLAG );267 }268 #endif269 188 if (curCost < bestCost) 270 189 { … … 291 210 292 211 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); 293 #if MTK_SINGLE_DEPTH_MODE_I0095294 m_cCUSingleDepthFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLEDEPTH_FLAG );295 m_cSingleDepthValueSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );296 #endif297 212 m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT); 298 213 m_cCUMergeIdxExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT); 299 #if H_3D_ARP300 m_cCUPUARPWSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW );301 #endif302 #if H_3D_IC303 m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG );304 #endif305 214 m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); 306 215 m_cCUPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PRED_MODE ); … … 325 234 m_cTransformSkipSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANSFORMSKIP_FLAG ); 326 235 m_CUTransquantBypassFlagSCModel.initBuffer( eSliceType, iQp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); 327 #if H_3D_DIM328 m_cDepthIntraModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DEPTH_INTRA_MODE );329 m_cDdcFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );330 m_cDdcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_DATA );331 m_cAngleFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ANGLE_FLAG );332 #if H_3D_DIM_SDC333 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG );334 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL );335 #endif336 #endif337 #if H_3D_DIM_SDC338 m_cSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );339 #endif340 #if H_3D_DBBP341 m_cDBBPFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );342 #endif343 236 m_pcBinIf->start(); 344 237 } … … 350 243 } 351 244 352 #if H_3D353 Void TEncSbac::codeSPS( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )354 #else355 245 Void TEncSbac::codeSPS( TComSPS* pcSPS ) 356 #endif357 246 { 358 247 assert (0); … … 454 343 m_pcBinIf->encodeBinsEP( bins, numBins ); 455 344 } 456 #if MTK_SINGLE_DEPTH_MODE_I0095457 Void TEncSbac::codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx )458 {459 UInt uiSymbol = pcCU->getSingleDepthFlag(uiAbsPartIdx ) ? 1 : 0;460 m_pcBinIf->encodeBin( uiSymbol, m_cCUSingleDepthFlagSCModel.get( 0, 0, 0 ) );461 if(uiSymbol)462 {463 UInt uiUnaryIdx = (UInt) pcCU->getSingleDepthValue(uiAbsPartIdx);464 UInt uiNumCand = MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE;465 if ( uiNumCand > 1 )466 {467 for( UInt ui = 0; ui < uiNumCand - 1; ++ui )468 {469 const UInt uiSymbol2 = ui == uiUnaryIdx ? 0 : 1;470 if ( ui==0 )471 {472 m_pcBinIf->encodeBin( uiSymbol2, m_cSingleDepthValueSCModel.get( 0, 0, 0 ) );473 }474 else475 {476 m_pcBinIf->encodeBinEP( uiSymbol2 );477 }478 if( uiSymbol2 == 0 )479 {480 break;481 }482 }483 }484 }485 }486 #endif487 345 /** Coding of coeff_abs_level_minus3 488 346 * \param uiSymbol value of coeff_abs_level_minus3 … … 513 371 } 514 372 515 #if H_3D_DIM516 Void TEncSbac::xWriteExGolombLevel( UInt uiSymbol, ContextModel& rcSCModel )517 {518 if( uiSymbol )519 {520 m_pcBinIf->encodeBin( 1, rcSCModel );521 UInt uiCount = 0;522 Bool bNoExGo = ( uiSymbol < 3 );523 524 while( --uiSymbol && ++uiCount < 3 )525 {526 m_pcBinIf->encodeBin( 1, rcSCModel );527 }528 if( bNoExGo )529 {530 m_pcBinIf->encodeBin( 0, rcSCModel );531 }532 else533 {534 xWriteEpExGolomb( uiSymbol, 0 );535 }536 }537 else538 {539 m_pcBinIf->encodeBin( 0, rcSCModel );540 }541 542 return;543 }544 545 Void TEncSbac::xCodeDimDeltaDC( Pel valDeltaDC, UInt uiNumSeg )546 {547 xWriteExGolombLevel( UInt( abs( valDeltaDC ) - ( uiNumSeg > 1 ? 0 : 1 ) ), m_cDdcDataSCModel.get(0, 0, 0) );548 if( valDeltaDC != 0 )549 {550 UInt uiSign = valDeltaDC > 0 ? 0 : 1;551 m_pcBinIf->encodeBinEP( uiSign );552 }553 }554 555 #if H_3D_DIM_DMM556 Void TEncSbac::xCodeDmm1WedgeIdx( UInt uiTabIdx, Int iNumBit )557 {558 for ( Int i = 0; i < iNumBit; i++ )559 {560 m_pcBinIf->encodeBinEP( ( uiTabIdx >> i ) & 1 );561 }562 }563 564 #endif565 566 #if !FIX_TICKET_76567 #if H_3D_DIM_SDC568 Void TEncSbac::xCodeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment )569 {570 assert( pcCU->getSlice()->getIsDepth() );571 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );572 assert( pcCU->getSDCFlag(uiAbsPartIdx) );573 assert( uiSegment < 2 );574 575 Pel segmentDCOffset = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);576 577 UInt uiResidual = segmentDCOffset == 0 ? 0 : 1;578 UInt uiSign = segmentDCOffset < 0 ? 1 : 0;579 UInt uiAbsIdx = abs(segmentDCOffset);580 581 #if H_3D_DIM_DLT582 UInt uiMaxResidualBits = pcCU->getSlice()->getPPS()->getDLT()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() );583 #else584 UInt uiMaxResidualBits = g_bitDepthY;585 #endif586 assert( uiMaxResidualBits <= g_bitDepthY );587 588 // residual flag589 m_pcBinIf->encodeBin( uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) );590 #if H_MV_ENC_DEC_TRAC591 DTRACE_CU("sdc_residual_flag[i]", uiResidual)592 #endif593 594 if (uiResidual)595 {596 // encode sign bit of residual597 m_pcBinIf->encodeBinEP( uiSign );598 #if H_MV_ENC_DEC_TRAC599 DTRACE_CU("sdc_residual_sign_flag[i]", uiSign)600 #endif601 #if H_3D_DIM_DLT602 UInt uiNumDepthValues = pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );603 #else604 UInt uiNumDepthValues = ((1 << g_bitDepthY)-1);605 #endif606 607 assert(uiAbsIdx <= uiNumDepthValues);608 609 // encode residual magnitude610 uiAbsIdx -= 1;611 612 #if H_MV_ENC_DEC_TRAC613 DTRACE_CU("sdc_residual_abs_minus1[i]", uiAbsIdx)614 #endif615 616 // prefix part617 if ( uiAbsIdx == 0 )618 {619 m_pcBinIf->encodeBin( 0, m_cSDCResidualSCModel.get(0, 0, 0) );620 }621 else622 {623 UInt l = uiAbsIdx;624 UInt k = 0;625 UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2);626 while ( l > 0 && k < uiPrefixThreshold )627 {628 m_pcBinIf->encodeBin( 1, m_cSDCResidualSCModel.get(0, 0, 0) );629 l--;630 k++;631 }632 if ( uiAbsIdx < uiPrefixThreshold )633 {634 m_pcBinIf->encodeBin( 0, m_cSDCResidualSCModel.get(0, 0, 0) );635 }636 else637 { // suffix part638 uiAbsIdx -= uiPrefixThreshold;639 UInt uiSuffixLength = numBitsForValue(uiNumDepthValues - uiPrefixThreshold);640 UInt uiBitInfo = 0;641 for ( Int i = 0; i < uiSuffixLength; i++)642 {643 uiBitInfo = ( uiAbsIdx & ( 1 << i ) ) >> i;644 m_pcBinIf->encodeBinEP( uiBitInfo);645 }646 }647 }648 649 }650 }651 #endif652 #endif653 #endif654 373 655 374 … … 666 385 this->m_cCUIntraPredSCModel .copyFrom( &pSrc->m_cCUIntraPredSCModel ); 667 386 } 668 #if H_3D_DIM669 Void TEncSbac::loadIntraDepthMode( TEncSbac* pSrc)670 {671 m_pcBinIf->copyState( pSrc->m_pcBinIf );672 673 this->m_cDepthIntraModeSCModel .copyFrom( &pSrc->m_cDepthIntraModeSCModel );674 this->m_cDdcFlagSCModel .copyFrom( &pSrc->m_cDdcFlagSCModel );675 this->m_cAngleFlagSCModel .copyFrom( &pSrc->m_cAngleFlagSCModel );676 }677 #endif678 387 679 388 Void TEncSbac::store( TEncSbac* pDest) … … 716 425 { 717 426 PartSize eSize = pcCU->getPartitionSize( uiAbsPartIdx ); 718 #if H_3D_QTLPC719 #if MTK_I0099_VPS_EX2720 TComVPS *vps = pcCU->getPic()->getSlice(0)->getVPS();721 Bool bLimQtPredFlag = vps->getLimQtPredFlag(pcCU->getPic()->getSlice(0)->getLayerId());722 #else723 TComSPS *sps = pcCU->getPic()->getSlice(0)->getSPS();724 #endif725 TComPic *pcTexture = pcCU->getSlice()->getTexturePic();726 Bool bDepthMapDetect = (pcTexture != NULL);727 Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE);728 729 Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);730 731 Bool depthDependent = false;732 UInt uiTexturePart = eSize;733 #if MTK_I0099_VPS_EX2734 #if LGE_FCO_I0116735 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag && pcTexture->getReconMark())736 #else737 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag )738 #endif739 #else740 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && sps->getUseQTL() && sps->getUsePC() )741 #endif742 {743 TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());744 UInt uiCUIdx = (pcCU->getZorderIdxInCU() == 0) ? uiAbsPartIdx : pcCU->getZorderIdxInCU();745 assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth);746 if(pcTextureCU->getDepth(uiCUIdx) == uiDepth )747 {748 depthDependent = true;749 uiTexturePart = pcTextureCU->getPartitionSize( uiCUIdx );750 }751 if (pcTextureCU->getDepth(uiCUIdx) == uiDepth && pcTextureCU->getPartitionSize( uiCUIdx ) == SIZE_2Nx2N)752 {753 assert( eSize == SIZE_2Nx2N );754 return;755 }756 }757 #endif758 427 if ( pcCU->isIntra( uiAbsPartIdx ) ) 759 428 { … … 771 440 DTRACE_CU("part_mode", eSize ) 772 441 #endif 773 #if H_3D_QTLPC774 if (depthDependent==false || uiTexturePart == SIZE_NxN|| uiTexturePart == SIZE_2Nx2N)775 {776 #endif777 442 switch(eSize) 778 443 { … … 841 506 } 842 507 } 843 #if H_3D_QTLPC844 }845 else if(uiTexturePart == SIZE_2NxN || uiTexturePart == SIZE_2NxnU || uiTexturePart == SIZE_2NxnD)846 {847 //assert(eSize!=SIZE_NxN);848 //assert(eSize!=SIZE_Nx2N);849 //assert(eSize==SIZE_2Nx2N || eSize==SIZE_2NxN || eSize==SIZE_2NxnU || eSize==SIZE_2NxnD);850 switch(eSize)851 {852 case SIZE_2Nx2N:853 {854 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 0) );855 break;856 }857 case SIZE_2NxN:858 {859 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );860 if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )861 {862 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 1) );863 }864 break;865 }866 case SIZE_2NxnU:867 case SIZE_2NxnD:868 {869 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );870 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) );871 m_pcBinIf->encodeBinEP((eSize == SIZE_2NxnU? 0: 1));872 break;873 }874 default:875 {876 assert(0);877 }878 }879 }880 else if(uiTexturePart == SIZE_Nx2N|| uiTexturePart==SIZE_nLx2N || uiTexturePart==SIZE_nRx2N)881 {882 //assert(eSize!=SIZE_NxN);883 //assert(eSize!=SIZE_2NxN);884 //assert(eSize==SIZE_2Nx2N ||eSize==SIZE_Nx2N || eSize==SIZE_nLx2N || eSize==SIZE_nRx2N);885 switch(eSize)886 {887 case SIZE_2Nx2N:888 {889 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 0) );890 break;891 }892 case SIZE_Nx2N:893 {894 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );895 if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )896 {897 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 1) );898 }899 break;900 }901 case SIZE_nLx2N:902 case SIZE_nRx2N:903 {904 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );905 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) );906 m_pcBinIf->encodeBinEP((eSize == SIZE_nLx2N? 0: 1));907 break;908 }909 default:910 {911 assert(0);912 }913 }914 }915 else916 {917 printf("uiTexturePart=%d",uiTexturePart);918 assert(0);919 }920 #endif921 508 } 922 509 … … 928 515 Void TEncSbac::codePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx ) 929 516 { 930 #if H_3D_DIM_SDC931 if ( pcCU->getSlice()->isIntra() )932 {933 assert( pcCU->isIntra(uiAbsPartIdx) );934 return;935 }936 #endif937 517 938 518 // get context function is here … … 1041 621 } 1042 622 1043 #if H_3D_ARP 1044 Void TEncSbac::codeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1045 { 1046 Int iW = (Int)pcCU->getARPW( uiAbsPartIdx ); 1047 Int iMaxW = pcCU->getSlice()->getARPStepNum() - 1; 1048 assert( iMaxW > 0); 1049 1050 Int nOffset = pcCU->getCTXARPWFlag(uiAbsPartIdx); 1051 Int nBinNum = iW + ( iW != iMaxW ); 1052 m_pcBinIf->encodeBin( iW ? 1 : 0 , m_cCUPUARPWSCModel.get( 0, 0, 0 + nOffset ) ); 1053 if( nBinNum > 1 ) 1054 { 1055 m_pcBinIf->encodeBin( ( iW == iMaxW ) ? 1 : 0, m_cCUPUARPWSCModel.get( 0, 0, 2 ) ); 1056 } 1057 #if H_MV_ENC_DEC_TRAC 1058 DTRACE_CU("iv_res_pred_weight_idx", iW); 1059 #endif 1060 } 1061 #endif 1062 1063 #if H_3D_IC 1064 /** code Illumination Compensation flag 1065 * \param pcCU 1066 * \param uiAbsPartIdx 1067 * \returns Void 1068 */ 1069 Void TEncSbac::codeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1070 { 1071 // get context function is here 1072 UInt uiSymbol = pcCU->getICFlag( uiAbsPartIdx ) ? 1 : 0; 1073 m_pcBinIf->encodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, 0 ) ); 1074 #if !H_MV_ENC_DEC_TRAC 1075 DTRACE_CABAC_VL( g_nSymbolCounter++ ); 1076 DTRACE_CABAC_T( "\tICFlag" ); 1077 DTRACE_CABAC_T( "\tuiSymbol: "); 1078 DTRACE_CABAC_V( uiSymbol ); 1079 DTRACE_CABAC_T( "\n"); 1080 #else 1081 DTRACE_CU("ic_flag", uiSymbol ); 1082 #endif 1083 } 1084 #endif 623 1085 624 1086 625 … … 1094 633 1095 634 assert( uiCtx < 3 ); 1096 #if H_3D_QTLPC1097 Bool bCodeSplitFlag = true;1098 1099 #if MTK_I0099_VPS_EX21100 TComVPS *vps = pcCU->getPic()->getSlice(0)->getVPS();1101 Bool bLimQtPredFlag = vps->getLimQtPredFlag(pcCU->getPic()->getSlice(0)->getLayerId());1102 #else1103 TComSPS *sps = pcCU->getPic()->getSlice(0)->getSPS();1104 #endif1105 TComPic *pcTexture = pcCU->getSlice()->getTexturePic();1106 Bool bDepthMapDetect = (pcTexture != NULL);1107 Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE);1108 1109 Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);1110 1111 #if MTK_I0099_VPS_EX21112 #if LGE_FCO_I01161113 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag && pcTexture->getReconMark() )1114 #else1115 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag )1116 #endif1117 #else1118 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && sps->getUseQTL() && sps->getUsePC())1119 #endif1120 {1121 TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());1122 UInt uiCUIdx = (pcCU->getZorderIdxInCU() == 0) ? uiAbsPartIdx : pcCU->getZorderIdxInCU();1123 assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth);1124 bCodeSplitFlag = (pcTextureCU->getDepth(uiCUIdx) > uiDepth);1125 }1126 1127 if(!bCodeSplitFlag)1128 {1129 assert(uiCurrSplitFlag == 0);1130 return;1131 }1132 #endif1133 635 m_pcBinIf->encodeBin( uiCurrSplitFlag, m_cCUSplitFlagSCModel.get( 0, 0, uiCtx ) ); 1134 636 #if !H_MV_ENC_DEC_TRAC … … 1166 668 { 1167 669 dir[j] = pcCU->getLumaIntraDir( absPartIdx+partOffset*j ); 1168 #if H_3D_DIM1169 #if SEPARATE_FLAG_I00851170 if( pcCU->getSlice()->getVpsDepthModesFlag() || pcCU->getSlice()->getIVPFlag() )1171 #else1172 if( pcCU->getSlice()->getVpsDepthModesFlag() )1173 #endif1174 {1175 codeIntraDepth( pcCU, absPartIdx+partOffset*j );1176 }1177 if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )1178 {1179 #endif1180 670 predNum[j] = pcCU->getIntraDirLumaPredictor(absPartIdx+partOffset*j, preds[j]); 1181 671 for(UInt i = 0; i < predNum[j]; i++) … … 1190 680 DTRACE_CU("prev_intra_luma_pred_flag", (predIdx[j] != -1)? 1 : 0); 1191 681 #endif 1192 #if H_3D_DIM1193 }1194 #endif1195 682 1196 683 } 1197 684 for (j=0;j<partNum;j++) 1198 685 { 1199 #if H_3D_DIM1200 if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )1201 {1202 #endif1203 686 if(predIdx[j] != -1) 1204 687 { … … 1235 718 #endif 1236 719 } 1237 #if H_3D_DIM1238 }1239 #endif1240 720 } 1241 721 return; … … 1277 757 } 1278 758 1279 #if H_3D_DIM1280 Void TEncSbac::codeIntraDepth( TComDataCU* pcCU, UInt absPartIdx )1281 {1282 codeIntraDepthMode( pcCU, absPartIdx );1283 1284 UInt dir = pcCU->getLumaIntraDir( absPartIdx );1285 UInt dimType = getDimType( dir );1286 1287 switch( dimType )1288 {1289 #if H_3D_DIM_DMM1290 case( DMM1_IDX ):1291 {1292 xCodeDmm1WedgeIdx( pcCU->getDmmWedgeTabIdx( dimType, absPartIdx ), g_dmm1TabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] );1293 } break;1294 case( DMM4_IDX ): break;1295 #endif1296 default: break;1297 }1298 }1299 1300 Void TEncSbac::codeIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx )1301 {1302 UInt dir = pcCU->getLumaIntraDir( absPartIdx );1303 1304 if( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() >> pcCU->getDepth( absPartIdx ) ) < 64 ) //DMM and HEVC intra modes are both allowed1305 {1306 m_pcBinIf->encodeBin( isDimMode( dir ) ? 0 : 1, m_cAngleFlagSCModel.get( 0, 0, 0 ) );1307 }1308 if( isDimMode( dir ) )1309 {1310 UInt uiCodeIdx = 0;1311 1312 switch( getDimType( dir ) )1313 {1314 case DMM1_IDX: uiCodeIdx = 0; break;1315 case DMM4_IDX: uiCodeIdx = 1; break;1316 default: break;1317 }1318 //mode coding1319 #if SEPARATE_FLAG_I00851320 if( pcCU->getSlice()->getVpsDepthModesFlag() && pcCU->getSlice()->getIVPFlag())1321 {1322 m_pcBinIf->encodeBin( uiCodeIdx == 0 ? 0 : 1, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );1323 }1324 #else1325 m_pcBinIf->encodeBin( uiCodeIdx == 0 ? 0 : 1, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );1326 #endif1327 }1328 }1329 #endif1330 759 1331 760 … … 2360 1789 } 2361 1790 2362 #if H_3D_INTER_SDC 2363 Void TEncSbac::codeDeltaDC( TComDataCU* pcCU, UInt absPartIdx ) 2364 { 2365 if( !( pcCU->getSDCFlag( absPartIdx ) || ( pcCU->isIntra( absPartIdx ) && getDimType( pcCU->getLumaIntraDir( absPartIdx ) ) < DIM_NUM_TYPE ) ) ) 2366 { 2367 assert( 0 ); 2368 } 2369 2370 #if HS_DMM_SIGNALLING_I0120 2371 UInt uiNumSegments = isDimMode( pcCU->getLumaIntraDir( absPartIdx ) ) ? 2 : 1; 2372 UInt dimDeltaDC = 1; 2373 #else 2374 UInt uiNumSegments = 0; 2375 UInt dimDeltaDC = 0; 2376 #endif 2377 2378 #if HS_DMM_SIGNALLING_I0120 2379 if( pcCU->isIntra( absPartIdx ) && pcCU->getSDCFlag( absPartIdx )) 2380 { 2381 #else 2382 if( pcCU->isIntra( absPartIdx ) ) 2383 { 2384 UInt dir = pcCU->getLumaIntraDir( absPartIdx ); 2385 uiNumSegments = isDimMode( dir ) ? 2 : 1; 2386 2387 if( pcCU->getSDCFlag( absPartIdx ) ) 2388 { 2389 #endif 2390 if( uiNumSegments == 1 ) 2391 { 2392 dimDeltaDC = pcCU->getSDCSegmentDCOffset( 0, absPartIdx ) ? 1 : 0; 2393 } 2394 else 2395 { 2396 dimDeltaDC = ( pcCU->getSDCSegmentDCOffset( 0, absPartIdx ) || pcCU->getSDCSegmentDCOffset( 1, absPartIdx ) ) ? 1 : 0; 2397 } 2398 #if !HS_DMM_SIGNALLING_I0120 2399 } 2400 else 2401 { 2402 dimDeltaDC = isDimDeltaDC( dir ); 2403 } 2404 #endif 2405 m_pcBinIf->encodeBin( dimDeltaDC, m_cDdcFlagSCModel.get( 0, 0, 0 ) ); 2406 } 2407 #if !HS_DMM_SIGNALLING_I0120 2408 else //all-zero inter SDC is not allowed 2409 { 2410 uiNumSegments = 1; 2411 dimDeltaDC = 1; 2412 } 2413 #endif 2414 2415 if( dimDeltaDC ) 2416 { 2417 for( UInt segment = 0; segment < uiNumSegments; segment++ ) 2418 { 2419 Pel deltaDC = 0; 2420 2421 if( pcCU->isIntra( absPartIdx ) ) 2422 { 2423 UInt dir = pcCU->getLumaIntraDir( absPartIdx ); 2424 deltaDC = pcCU->getSDCFlag( absPartIdx ) ? pcCU->getSDCSegmentDCOffset( segment, absPartIdx ) : pcCU->getDimDeltaDC( getDimType( dir ), segment, absPartIdx ); 2425 } 2426 else 2427 { 2428 deltaDC = pcCU->getSDCSegmentDCOffset( segment, absPartIdx ); 2429 } 2430 2431 xCodeDimDeltaDC( deltaDC, uiNumSegments ); 2432 } 2433 } 2434 } 2435 2436 Void TEncSbac::codeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2437 { 2438 UInt uiSymbol = pcCU->getSDCFlag( uiAbsPartIdx ) ? 1 : 0; 2439 UInt uiCtxSDCFlag = pcCU->getCtxSDCFlag( uiAbsPartIdx ); 2440 2441 m_pcBinIf->encodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, uiCtxSDCFlag ) ); 2442 } 2443 2444 #endif 2445 2446 #if H_3D_DBBP 2447 Void TEncSbac::codeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2448 { 2449 #if SEC_DBBP_EXPLICIT_SIG_I0077 2450 PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); 2451 AOF( ePartSize == SIZE_2NxN || ePartSize == SIZE_Nx2N ); 2452 #endif 2453 AOF( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) ); 2454 AOF( !pcCU->getSlice()->getIsDepth() ); 2455 2456 UInt uiSymbol = pcCU->getDBBPFlag( uiAbsPartIdx ) ? 1 : 0; 2457 m_pcBinIf->encodeBin( uiSymbol, m_cDBBPFlagSCModel.get( 0, 0, 0 ) ); 2458 } 2459 #endif 1791 2460 1792 2461 1793 //! \} -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncSbac.h
r1039 r1072 84 84 Void load ( TEncSbac* pScr ); 85 85 Void loadIntraDirModeLuma ( TEncSbac* pScr ); 86 #if H_3D_DIM87 Void loadIntraDepthMode ( TEncSbac* pScr );88 #endif89 86 Void store ( TEncSbac* pDest ); 90 87 Void loadContexts ( TEncSbac* pScr ); … … 94 91 95 92 Void codeVPS ( TComVPS* pcVPS ); 96 #if !H_3D97 93 Void codeSPS ( TComSPS* pcSPS ); 98 #else99 Void codeSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );100 #endif101 94 Void codePPS ( TComPPS* pcPPS ); 102 95 Void codeSliceHeader ( TComSlice* pcSlice ); … … 124 117 Void xWriteEpExGolomb ( UInt uiSymbol, UInt uiCount ); 125 118 Void xWriteCoefRemainExGolomb ( UInt symbol, UInt &rParam ); 126 #if H_3D_DIM127 Void xWriteExGolombLevel ( UInt uiSymbol, ContextModel& rcSCModel );128 Void xCodeDimDeltaDC ( Pel valDeltaDC, UInt uiNumSeg );129 #if H_3D_DIM_DMM130 Void xCodeDmm1WedgeIdx ( UInt uiTabIdx, Int iNumBit );131 #endif132 #if !FIX_TICKET_76133 #if H_3D_DIM_SDC134 Void xCodeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment );135 #endif136 #endif137 #endif138 119 139 120 Void xCopyFrom ( TEncSbac* pSrc ); … … 155 136 Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ); 156 137 Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 157 #if MTK_SINGLE_DEPTH_MODE_I0095158 Void codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx );159 #endif160 138 Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 161 139 Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 162 #if H_3D_ARP163 Void codeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx );164 #endif165 #if H_3D_IC166 Void codeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx );167 #endif168 #if H_3D_INTER_SDC169 Void codeDeltaDC ( TComDataCU* pcCU, UInt absPartIdx );170 Void codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx );171 #endif172 #if H_3D_DBBP173 Void codeDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx );174 #endif175 140 Void codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 176 141 Void codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList ); … … 188 153 Void codeIntraDirChroma ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 189 154 190 #if H_3D_DIM191 Void codeIntraDepth ( TComDataCU* pcCU, UInt absPartIdx );192 Void codeIntraDepthMode ( TComDataCU* pcCU, UInt absPartIdx );193 #endif194 155 195 156 Void codeInterDir ( TComDataCU* pcCU, UInt uiAbsPartIdx ); … … 224 185 ContextModel3DBuffer m_cCUSplitFlagSCModel; 225 186 ContextModel3DBuffer m_cCUSkipFlagSCModel; 226 #if MTK_SINGLE_DEPTH_MODE_I0095227 ContextModel3DBuffer m_cCUSingleDepthFlagSCModel;228 ContextModel3DBuffer m_cSingleDepthValueSCModel;229 #endif230 187 ContextModel3DBuffer m_cCUMergeFlagExtSCModel; 231 188 ContextModel3DBuffer m_cCUMergeIdxExtSCModel; 232 #if H_3D_ARP233 ContextModel3DBuffer m_cCUPUARPWSCModel;234 #endif235 #if H_3D_IC236 ContextModel3DBuffer m_cCUICFlagSCModel;237 #endif238 189 ContextModel3DBuffer m_cCUPartSizeSCModel; 239 190 ContextModel3DBuffer m_cCUPredModeSCModel; … … 262 213 ContextModel3DBuffer m_CUTransquantBypassFlagSCModel; 263 214 264 #if H_3D_DIM265 ContextModel3DBuffer m_cDepthIntraModeSCModel;266 ContextModel3DBuffer m_cDdcFlagSCModel;267 ContextModel3DBuffer m_cDdcDataSCModel;268 ContextModel3DBuffer m_cAngleFlagSCModel;269 #if H_3D_DIM_SDC270 ContextModel3DBuffer m_cSDCResidualFlagSCModel;271 ContextModel3DBuffer m_cSDCResidualSCModel;272 #endif273 #endif274 #if H_3D_DIM_SDC275 ContextModel3DBuffer m_cSDCFlagSCModel;276 #endif277 #if H_3D_DBBP278 ContextModel3DBuffer m_cDBBPFlagSCModel;279 #endif280 215 }; 281 216 -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncSearch.cpp
r1066 r1072 41 41 #include "TEncSearch.h" 42 42 #include <math.h> 43 #if H_3D_INTER_SDC44 #include <memory.h>45 #endif46 43 47 44 //! \ingroup TLibEncoder … … 318 315 319 316 piRefSrch = rcStruct.piRefY + iSearchY * rcStruct.iYStride + iSearchX; 320 #if H_3D_IC321 m_cDistParam.bUseIC = pcPatternKey->getICFlag();322 #endif323 #if H_3D_INTER_SDC324 m_cDistParam.bUseSDCMRSAD = pcPatternKey->getSDCMRSADFlag();325 #endif326 317 //-- jclee for using the SAD function pointer 327 318 m_pcRdCost->setDistParam( pcPatternKey, piRefSrch, rcStruct.iYStride, m_cDistParam ); … … 750 741 751 742 setDistParamComp(0); // Y component 752 #if H_3D_IC753 m_cDistParam.bUseIC = pcPatternKey->getICFlag();754 #endif755 #if H_3D_INTER_SDC756 m_cDistParam.bUseSDCMRSAD = pcPatternKey->getSDCMRSADFlag();757 #endif758 743 m_cDistParam.pCur = piRefPos; 759 744 m_cDistParam.bitDepth = g_bitDepthY; … … 915 900 } 916 901 m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true ); 917 #if MTK_SINGLE_DEPTH_MODE_I0095918 m_pcEntropyCoder->encodeSingleDepthMode(pcCU, 0, true );919 if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))920 #endif921 902 m_pcEntropyCoder->encodePredMode( pcCU, 0, true ); 922 903 } 923 #if MTK_SINGLE_DEPTH_MODE_I0095924 else925 {926 m_pcEntropyCoder->encodeSingleDepthMode(pcCU, 0, true );927 }928 #endif929 #if MTK_SINGLE_DEPTH_MODE_I0095930 if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))931 {932 #endif933 904 m_pcEntropyCoder ->encodePartSize( pcCU, 0, pcCU->getDepth(0), true ); 934 905 935 #if H_3D_DIM_SDC936 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );937 #endif938 906 if (pcCU->isIntra(0) && pcCU->getPartitionSize(0) == SIZE_2Nx2N ) 939 907 { … … 945 913 } 946 914 } 947 #if MTK_SINGLE_DEPTH_MODE_I0095 948 } 949 #endif 950 } 951 #if MTK_SINGLE_DEPTH_MODE_I0095 952 if(!pcCU->getSingleDepthFlag(uiAbsPartIdx)) 953 { 954 #endif 915 } 955 916 // luma prediction mode 956 917 if( pcCU->getPartitionSize(0) == SIZE_2Nx2N ) … … 959 920 { 960 921 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, 0 ); 961 #if H_3D_DIM_SDC962 if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( 0 ) ) && getDimType( pcCU->getLumaIntraDir( 0 ) ) < DIM_NUM_TYPE )963 {964 m_pcEntropyCoder->encodeDeltaDC( pcCU, 0 );965 }966 #endif967 922 } 968 923 } … … 976 931 { 977 932 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiPart * uiQNumParts ); 978 #if H_3D_DIM_SDC979 if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( uiPart * uiQNumParts ) ) && getDimType( pcCU->getLumaIntraDir( uiPart * uiQNumParts ) ) < DIM_NUM_TYPE )980 {981 m_pcEntropyCoder->encodeDeltaDC( pcCU, uiPart * uiQNumParts );982 }983 #endif984 933 } 985 934 } … … 987 936 { 988 937 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx ); 989 #if H_3D_DIM_SDC 990 if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( uiAbsPartIdx ) ) && getDimType( pcCU->getLumaIntraDir( uiAbsPartIdx ) ) < DIM_NUM_TYPE ) 991 { 992 m_pcEntropyCoder->encodeDeltaDC( pcCU, uiAbsPartIdx ); 993 } 994 #endif 995 } 996 } 997 #if MTK_SINGLE_DEPTH_MODE_I0095 998 } 999 #endif 938 } 939 } 1000 940 } 1001 941 if( bChroma ) … … 1063 1003 TComYuv* pcPredYuv, 1064 1004 TComYuv* pcResiYuv, 1065 #if H_3D_VSO1066 Dist& ruiDist,1067 #else1068 1005 UInt& ruiDist, 1069 #endif1070 1006 Int default0Save1Load2 1071 #if H_3D_DIM_ENC1072 , Bool zeroResi1073 #endif1074 1007 ) 1075 1008 { … … 1106 1039 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail ); 1107 1040 //===== get prediction signal ===== 1108 #if H_3D_DIM1109 if( isDimMode( uiLumaPredMode ) )1110 {1111 predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, true );1112 }1113 else1114 {1115 #endif1116 1041 predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 1117 #if H_3D_DIM1118 }1119 #endif1120 1042 // save prediction 1121 1043 if(default0Save1Load2 == 1) … … 1157 1079 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 1158 1080 { 1159 #if H_3D_DIM_ENC1160 if( zeroResi )1161 {1162 memset( pResi, 0, sizeof( Pel ) * uiWidth );1163 pResi += uiStride;1164 }1165 else1166 {1167 #endif1168 1081 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 1169 1082 { … … 1173 1086 pResi += uiStride; 1174 1087 pPred += uiStride; 1175 #if H_3D_DIM_ENC1176 }1177 #endif1178 1088 } 1179 1089 } … … 1245 1155 1246 1156 //===== update distortion ===== 1247 #if H_3D_VSO // M391248 if ( m_pcRdCost->getUseVSO() )1249 ruiDist += m_pcRdCost->getDistPartVSO ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false );1250 else1251 #endif1252 1157 ruiDist += m_pcRdCost->getDistPart(g_bitDepthY, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight ); 1253 1158 } … … 1306 1211 { 1307 1212 uiChromaPredMode = pcCU->getLumaIntraDir( 0 ); 1308 #if H_3D_DIM1309 mapDepthModeToIntraDir( uiChromaPredMode );1310 #endif1311 1213 } 1312 1214 … … 1461 1363 TComYuv* pcPredYuv, 1462 1364 TComYuv* pcResiYuv, 1463 #if H_3D_VSO1464 Dist& ruiDistY,1465 #else1466 1365 UInt& ruiDistY, 1467 #endif1468 1366 UInt& ruiDistC, 1469 1367 #if HHI_RQT_INTRA_SPEEDUP … … 1471 1369 #endif 1472 1370 Double& dRDCost 1473 #if H_3D_DIM_ENC1474 , Bool zeroResi1475 #endif1476 1371 ) 1477 1372 { … … 1510 1405 } 1511 1406 #endif 1512 #if H_3D_DIM1513 if( isDimMode( pcCU->getLumaIntraDir( uiAbsPartIdx ) ) )1514 {1515 bCheckSplit = false;1516 }1517 #endif1518 1407 Double dSingleCost = MAX_DOUBLE; 1519 #if H_3D_VSO1520 Dist uiSingleDistY = 0;1521 #else1522 1408 UInt uiSingleDistY = 0; 1523 #endif1524 1409 UInt uiSingleDistC = 0; 1525 1410 UInt uiSingleCbfY = 0; … … 1543 1428 //----- store original entropy coding status ----- 1544 1429 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ uiFullDepth ][ CI_QT_TRAFO_ROOT ] ); 1545 #if H_3D_VSO1546 Dist singleDistYTmp = 0;1547 #else1548 1430 UInt singleDistYTmp = 0; 1549 #endif1550 1431 UInt singleDistCTmp = 0; 1551 1432 UInt singleCbfYTmp = 0; … … 1597 1478 { 1598 1479 UInt uiSingleBits = xGetIntraBitsQT( pcCU, uiTrDepth, uiAbsPartIdx, true, !bLumaOnly, false ); 1599 #if H_3D_VSO // M NEW1600 if ( m_pcRdCost->getUseRenModel() )1601 singleCostTmp = m_pcRdCost->calcRdCostVSO( uiSingleBits, singleDistYTmp + singleDistCTmp );1602 else1603 #endif1604 1480 singleCostTmp = m_pcRdCost->calcRdCost( uiSingleBits, singleDistYTmp + singleDistCTmp ); 1605 1481 } … … 1672 1548 //----- code luma block with given intra prediction mode and store Cbf----- 1673 1549 dSingleCost = 0.0; 1674 #if H_3D_DIM_ENC1675 xIntraCodingLumaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcOrgYuv, pcPredYuv, pcResiYuv, uiSingleDistY, 0, zeroResi );1676 #else1677 1550 xIntraCodingLumaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcOrgYuv, pcPredYuv, pcResiYuv, uiSingleDistY ); 1678 #endif1679 1551 if( bCheckSplit ) 1680 1552 { … … 1700 1572 uiSingleBits=uiSingleBits*4; 1701 1573 } 1702 #if H_3D_VSO // M401703 if ( m_pcRdCost->getUseLambdaScaleVSO())1704 dSingleCost = m_pcRdCost->calcRdCostVSO( uiSingleBits, uiSingleDistY + uiSingleDistC );1705 else1706 #endif1707 1574 dSingleCost = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDistY + uiSingleDistC ); 1708 1575 } … … 1724 1591 //----- code splitted block ----- 1725 1592 Double dSplitCost = 0.0; 1726 #if H_3D_VSO1727 Dist uiSplitDistY = 0;1728 #else1729 1593 UInt uiSplitDistY = 0; 1730 #endif1731 1594 UInt uiSplitDistC = 0; 1732 1595 UInt uiQPartsDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); … … 1770 1633 //----- determine rate and r-d cost ----- 1771 1634 UInt uiSplitBits = xGetIntraBitsQT( pcCU, uiTrDepth, uiAbsPartIdx, true, !bLumaOnly, false ); 1772 #if H_3D_VSO // M411773 if( m_pcRdCost->getUseLambdaScaleVSO() )1774 dSplitCost = m_pcRdCost->calcRdCostVSO( uiSplitBits, uiSplitDistY + uiSplitDistC );1775 else1776 #endif1777 1635 dSplitCost = m_pcRdCost->calcRdCost( uiSplitBits, uiSplitDistY + uiSplitDistC ); 1778 1636 … … 1843 1701 } 1844 1702 } 1845 #if H_3D_VSO // M421846 if ( m_pcRdCost->getUseRenModel() && bCheckFull )1847 {1848 UInt uiWidth = pcCU->getWidth ( 0 ) >> uiTrDepth;1849 UInt uiHeight = pcCU->getHeight( 0 ) >> uiTrDepth;1850 UInt uiQTLayer = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - uiLog2TrSize;1851 Pel* piSrc = m_pcQTTempTComYuv[ uiQTLayer ].getLumaAddr( uiAbsPartIdx );1852 UInt uiSrcStride = m_pcQTTempTComYuv[ uiQTLayer ].getStride ();1853 1854 m_pcRdCost->setRenModelData( pcCU, uiAbsPartIdx, piSrc, (Int) uiSrcStride, (Int) uiWidth, (Int) uiHeight );1855 }1856 #endif1857 1703 ruiDistY += uiSingleDistY; 1858 1704 ruiDistC += uiSingleDistC; 1859 1705 dRDCost += dSingleCost; 1860 1706 } 1861 #if MTK_SINGLE_DEPTH_MODE_I00951862 Void TEncSearch::xIntraCodingSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Int iTestDepthIdx, Pel *DepthNeighbor )1863 {1864 UInt uiWidth = pcCU ->getWidth ( 0 );1865 UInt uiHeight = pcCU ->getHeight ( 0 );1866 UInt uiStride = pcOrgYuv ->getStride ();1867 Pel* piOrg = pcOrgYuv ->getLumaAddr( uiAbsPartIdx );1868 Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx );1869 1870 AOF( uiWidth == uiHeight );1871 AOF( uiAbsPartIdx == 0 );1872 pcCU->setSingleDepthValueSubParts((Pel)iTestDepthIdx,uiAbsPartIdx, 0, pcCU->getDepth(0));1873 //===== reconstruction =====1874 1875 for( UInt uiY = 0; uiY < uiHeight; uiY++ )1876 {1877 for( UInt uiX = 0; uiX < uiWidth; uiX++ )1878 {1879 piPred[ uiX ] = DepthNeighbor[iTestDepthIdx];1880 }1881 piPred += uiStride;1882 }1883 1884 // clear UV1885 UInt uiStrideC = pcPredYuv->getCStride();1886 Pel *pRecCb = pcPredYuv->getCbAddr();1887 Pel *pRecCr = pcPredYuv->getCrAddr();1888 1889 for (Int y=0; y<uiHeight/2; y++)1890 {1891 for (Int x=0; x<uiWidth/2; x++)1892 {1893 pRecCb[x] = 1<<(g_bitDepthC-1);1894 pRecCr[x] = 1<<(g_bitDepthC-1);1895 }1896 1897 pRecCb += uiStrideC;1898 pRecCr += uiStrideC;1899 }1900 1901 piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx );1902 //===== determine distortion =====1903 #if H_3D_VSO1904 if ( m_pcRdCost->getUseVSO() )1905 ruiDist = m_pcRdCost->getDistPartVSO ( pcCU, uiAbsPartIdx, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, false );1906 else1907 #endif1908 ruiDist = m_pcRdCost->getDistPart(g_bitDepthY, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight );1909 1910 //===== determine rate and r-d cost =====1911 m_pcEntropyCoder->resetBits();1912 m_pcEntropyCoder->encodeSingleDepthMode( pcCU, 0, true );1913 UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits();1914 1915 #if H_3D_VSO1916 if ( m_pcRdCost->getUseLambdaScaleVSO())1917 dRDCost = m_pcRdCost->calcRdCostVSO( uiBits, ruiDist );1918 else1919 #endif1920 dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist );1921 }1922 #endif1923 #if H_3D_DIM_SDC1924 Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi )1925 {1926 UInt uiLumaPredMode = pcCU ->getLumaIntraDir( uiAbsPartIdx );1927 UInt uiWidth = pcCU ->getWidth ( 0 );1928 UInt uiHeight = pcCU ->getHeight ( 0 );1929 TComWedgelet* dmm4SegmentationOrg = new TComWedgelet( uiWidth, uiHeight );1930 UInt numParts = 1;1931 UInt sdcDepth = 0;1932 UInt uiStride;1933 Pel* piOrg;1934 Pel* piPred;1935 Pel* piReco;1936 1937 UInt uiZOrder;1938 Pel* piRecIPred;1939 UInt uiRecIPredStride;1940 1941 if ( ( uiWidth >> pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) > 1 )1942 {1943 numParts = uiWidth * uiWidth >> ( 2 * pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() );1944 sdcDepth = g_aucConvertToBit[uiWidth] + 2 - pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize();1945 uiWidth = uiHeight = ( 1 << pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() );1946 }1947 1948 for ( Int i = 0; i < numParts; i++ )1949 {1950 uiStride = pcOrgYuv ->getStride ();1951 piOrg = pcOrgYuv ->getLumaAddr( uiAbsPartIdx );1952 piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx );1953 piReco = pcPredYuv->getLumaAddr( uiAbsPartIdx );1954 1955 uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx;1956 piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );1957 uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride ();1958 1959 AOF( uiWidth == uiHeight );1960 1961 //===== init availability pattern =====1962 Bool bAboveAvail = false;1963 Bool bLeftAvail = false;1964 pcCU->getPattern()->initPattern ( pcCU, sdcDepth, uiAbsPartIdx );1965 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, sdcDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail );1966 TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight );1967 //===== get prediction signal =====1968 if( isDimMode( uiLumaPredMode ) )1969 {1970 UInt dimType = getDimType ( uiLumaPredMode );1971 UInt patternID = pcCU->getDmmWedgeTabIdx(dimType, uiAbsPartIdx);1972 #if SHARP_DMM1_I01101973 UInt uiBaseWidth = pcCU->isDMM1UpscaleMode(uiWidth) ? pcCU->getDMM1BasePatternWidth(uiWidth) : uiWidth;1974 if ( patternID >= g_dmmWedgeLists[g_aucConvertToBit[uiBaseWidth]].size() && dimType == DMM1_IDX )1975 #else1976 if ( patternID >= g_dmmWedgeLists[g_aucConvertToBit[uiWidth]].size() && dimType == DMM1_IDX )1977 #endif1978 {1979 #if SHARP_DMM1_I01101980 if (g_aucConvertToBit[uiBaseWidth] == 2) // Encoder method. Avoid DMM1 pattern list index exceeds the maximum DMM1 pattern number when SDC split is used.1981 #else1982 if (g_aucConvertToBit[uiWidth] == 2) // Encoder method. Avoid DMM1 pattern list index exceeds the maximum DMM1 pattern number when SDC split is used.1983 #endif1984 {1985 patternID = 1349; // Split 32x32 to 16x16. 1349: Maximum DMM1 pattern number when block size is 16x161986 }1987 else1988 {1989 patternID = patternID >> 1; // Other cases1990 }1991 pcCU->setDmmWedgeTabIdx(dimType, uiAbsPartIdx, patternID);1992 }1993 predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, true , dmm4Segmentation );1994 Bool* dmm4PatternSplit = dmm4Segmentation->getPattern();1995 Bool* dmm4PatternOrg = dmm4SegmentationOrg->getPattern();1996 for( UInt k = 0; k < (uiWidth*uiHeight); k++ )1997 {1998 dmm4PatternOrg[k+(uiAbsPartIdx<<4)] = dmm4PatternSplit[k];1999 }2000 }2001 else2002 {2003 predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );2004 }2005 if ( numParts > 1 )2006 {2007 for( UInt uiY = 0; uiY < uiHeight; uiY++ )2008 {2009 for( UInt uiX = 0; uiX < uiWidth; uiX++ )2010 {2011 piPred [ uiX ] = ClipY( piPred[ uiX ] );2012 piRecIPred [ uiX ] = piPred[ uiX ];2013 }2014 piPred += uiStride;2015 piRecIPred += uiRecIPredStride;2016 }2017 }2018 uiAbsPartIdx += ( ( uiWidth * uiWidth ) >> 4 );2019 dmm4Segmentation->destroy(); delete dmm4Segmentation;2020 }2021 uiAbsPartIdx = 0;2022 uiStride = pcOrgYuv ->getStride ();2023 piOrg = pcOrgYuv ->getLumaAddr( uiAbsPartIdx );2024 piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx );2025 piReco = pcPredYuv->getLumaAddr( uiAbsPartIdx );2026 2027 uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx;2028 piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );2029 uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride ();2030 2031 if (numParts > 1)2032 {2033 uiWidth = pcCU->getWidth( 0 );2034 uiHeight = pcCU->getHeight( 0 );2035 }2036 // number of segments depends on prediction mode2037 UInt uiNumSegments = 1;2038 Bool* pbMask = NULL;2039 UInt uiMaskStride = 0;2040 2041 if( getDimType( uiLumaPredMode ) == DMM1_IDX )2042 {2043 Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx);2044 2045 #if SHARP_DMM1_I01102046 WedgeList* pacWedgeList = pcCU->isDMM1UpscaleMode( uiWidth ) ? &g_dmmWedgeLists[(g_aucConvertToBit[pcCU->getDMM1BasePatternWidth(uiWidth)])] : &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])];2047 #else2048 WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])];2049 #endif2050 TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx ));2051 2052 uiNumSegments = 2;2053 #if SHARP_DMM1_I01102054 pbMask = pcCU->isDMM1UpscaleMode( uiWidth ) ? pcWedgelet->getScaledPattern( uiWidth ) : pcWedgelet->getPattern();2055 uiMaskStride = pcCU->isDMM1UpscaleMode( uiWidth ) ? uiWidth : pcWedgelet->getStride();2056 #else2057 pbMask = pcWedgelet->getPattern();2058 uiMaskStride = pcWedgelet->getStride();2059 #endif2060 }2061 if( getDimType( uiLumaPredMode ) == DMM4_IDX )2062 {2063 uiNumSegments = 2;2064 pbMask = dmm4SegmentationOrg->getPattern();2065 uiMaskStride = dmm4SegmentationOrg->getStride();2066 }2067 2068 // get DC prediction for each segment2069 Pel apDCPredValues[2];2070 if ( getDimType( uiLumaPredMode ) == DMM1_IDX || getDimType( uiLumaPredMode ) == DMM4_IDX )2071 {2072 apDCPredValues[0] = pcCU->getDmmPredictor( 0 );2073 apDCPredValues[1] = pcCU->getDmmPredictor( 1 );2074 }2075 else2076 {2077 analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode );2078 }2079 2080 2081 // get original DC for each segment2082 Pel apDCOrigValues[2];2083 analyzeSegmentsSDC(piOrg, uiStride, uiWidth, apDCOrigValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode, true );2084 2085 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )2086 {2087 // remap reconstructed value to valid depth values2088 Pel pDCRec = ( !bZeroResidual ) ? apDCOrigValues[uiSegment] : apDCPredValues[uiSegment];2089 // get residual (idx)2090 #if H_3D_DIM_DLT2091 Pel pResidualIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pDCRec ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );2092 #else2093 Pel pResidualIdx = pDCRec - apDCPredValues[uiSegment];2094 #endif2095 if( !bZeroResidual )2096 {2097 Pel pPredIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );2098 Int pTestIdx = pPredIdx + pResidualIdx + iSDCDeltaResi;2099 if( pTestIdx >= 0 && pTestIdx < pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) )2100 {2101 pResidualIdx += iSDCDeltaResi;2102 }2103 }2104 // save SDC DC offset2105 pcCU->setSDCSegmentDCOffset(pResidualIdx, uiSegment, uiAbsPartIdx);2106 }2107 2108 // reconstruct residual based on mask + DC residuals2109 Pel apDCResiValues[2];2110 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )2111 {2112 #if H_3D_DIM_DLT2113 Pel pPredIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );2114 Pel pResiIdx = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);2115 Pel pRecoValue = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );2116 2117 apDCResiValues[uiSegment] = pRecoValue - apDCPredValues[uiSegment];2118 #else2119 apDCResiValues[uiSegment] = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);2120 #endif2121 }2122 2123 //===== reconstruction =====2124 Bool* pMask = pbMask;2125 Pel* pPred = piPred;2126 Pel* pReco = piReco;2127 Pel* pRecIPred = piRecIPred;2128 2129 for( UInt uiY = 0; uiY < uiHeight; uiY++ )2130 {2131 for( UInt uiX = 0; uiX < uiWidth; uiX++ )2132 {2133 UChar ucSegment = pMask?(UChar)pMask[uiX]:0;2134 assert( ucSegment < uiNumSegments );2135 2136 Pel pResiDC = apDCResiValues[ucSegment];2137 2138 pReco [ uiX ] = ClipY( pPred[ uiX ] + pResiDC );2139 pRecIPred[ uiX ] = pReco[ uiX ];2140 }2141 pPred += uiStride;2142 pReco += uiStride;2143 pRecIPred += uiRecIPredStride;2144 pMask += uiMaskStride;2145 }2146 2147 // clear UV2148 UInt uiStrideC = pcPredYuv->getCStride();2149 Pel *pRecCb = pcPredYuv->getCbAddr();2150 Pel *pRecCr = pcPredYuv->getCrAddr();2151 2152 for (Int y=0; y<uiHeight/2; y++)2153 {2154 for (Int x=0; x<uiWidth/2; x++)2155 {2156 pRecCb[x] = 128;2157 pRecCr[x] = 128;2158 }2159 2160 pRecCb += uiStrideC;2161 pRecCr += uiStrideC;2162 }2163 2164 //===== determine distortion =====2165 #if H_3D_VSO2166 if ( m_pcRdCost->getUseVSO() )2167 ruiDist = m_pcRdCost->getDistPartVSO ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false );2168 else2169 #endif2170 ruiDist = m_pcRdCost->getDistPart(g_bitDepthY, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight );2171 2172 //===== determine rate and r-d cost =====2173 m_pcEntropyCoder->resetBits();2174 2175 // encode reduced intra header2176 if( !pcCU->getSlice()->isIntra() )2177 {2178 if (pcCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())2179 {2180 m_pcEntropyCoder->encodeCUTransquantBypassFlag( pcCU, 0, true );2181 }2182 m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true );2183 m_pcEntropyCoder->encodePredMode( pcCU, 0, true );2184 }2185 2186 m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth( 0 ), true );2187 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );2188 2189 // encode pred direction + DC residual data2190 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );2191 Bool bDummy = false;2192 m_pcEntropyCoder->encodeCoeff( pcCU, 0, pcCU->getDepth( 0 ), uiWidth, uiHeight, bDummy );2193 UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits();2194 2195 #if H_3D_VSO2196 if ( m_pcRdCost->getUseLambdaScaleVSO())2197 dRDCost = m_pcRdCost->calcRdCostVSO( uiBits, ruiDist );2198 else2199 #endif2200 dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist );2201 dmm4SegmentationOrg->destroy(); delete dmm4SegmentationOrg;2202 }2203 #endif2204 1707 2205 1708 Void … … 2878 2381 pcCU->setChromIntraDirSubParts( uiBestMode, 0, pcCU->getDepth( 0 ) ); 2879 2382 } 2880 #if MTK_SINGLE_DEPTH_MODE_I00952881 Void2882 TEncSearch::estIntraPredSingleDepth( TComDataCU* pcCU,2883 TComYuv* pcOrgYuv,2884 TComYuv* pcPredYuv,2885 TComYuv* pcResiYuv,2886 TComYuv* pcRecoYuv,2887 UInt& ruiDistC,2888 Bool bLumaOnly )2889 {2890 UInt uiDepth = pcCU->getDepth(0);2891 UInt uiWidth = pcCU->getWidth (0);2892 UInt uiHeight = pcCU->getHeight(0);2893 2894 2895 Pel* piOrg = pcOrgYuv ->getLumaAddr( 0, uiWidth );2896 UInt uiStride = pcPredYuv->getStride();2897 2898 Int index=0;2899 Pel testDepth;2900 Pel DepthNeighbours[5];2901 //construction of depth candidates2902 for( Int i = 0; (i < 5) && (index<MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE) ; i++ )2903 {2904 if(!pcCU->getNeighDepth (0, 0, &testDepth, i))2905 {2906 continue;2907 }2908 DepthNeighbours[index]=testDepth;2909 index++;2910 for(Int j=0;j<index-1;j++)2911 {2912 if( (DepthNeighbours[index-1]==DepthNeighbours[j]))2913 {2914 index--;2915 break;2916 }2917 }2918 }2919 2920 if(index==0)2921 {2922 DepthNeighbours[index]=1<<(g_bitDepthY-1);2923 index++;2924 }2925 2926 if(index==1)2927 {2928 DepthNeighbours[index]=ClipY(DepthNeighbours[0] + 1 );2929 index++;2930 }2931 2932 2933 Dist uiDist = 0;2934 Double dCost = 0.0;2935 Dist uiBestDist = 0;2936 Double dBestCost = MAX_DOUBLE;2937 Pel pBestSingleDepthValue = 0;2938 2939 for( Int testdepthidx = 0; testdepthidx < index ; testdepthidx++ )2940 {2941 // set context models2942 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );2943 2944 // determine residual for partition2945 uiDist = 0;2946 dCost = 0.0;2947 #if H_3D_VSO // M362948 if( m_pcRdCost->getUseRenModel() )2949 {2950 m_pcRdCost->setRenModelData( pcCU, 0, piOrg, uiStride, uiWidth, uiHeight );2951 }2952 #endif2953 xIntraCodingSingleDepth(pcCU, 0, pcOrgYuv, pcPredYuv, uiDist, dCost, testdepthidx, DepthNeighbours);2954 // check r-d cost2955 if( dCost < dBestCost )2956 {2957 uiBestDist = uiDist;2958 dBestCost = dCost;2959 pBestSingleDepthValue = pcCU->getSingleDepthValue(0);2960 // copy reconstruction2961 pcPredYuv->copyPartToPartYuv(pcRecoYuv, 0, uiWidth, uiHeight);2962 }2963 } // depth index loop2964 2965 2966 pcCU->setSingleDepthValueSubParts((Pel)pBestSingleDepthValue,0, 0, uiDepth);2967 assert(pBestSingleDepthValue>=0);2968 2969 //===== reset context models =====2970 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);2971 2972 //===== set distortion (rate and r-d costs are determined later) =====2973 pcCU->getTotalDistortion() = uiBestDist;2974 }2975 2976 #endif2977 2383 Void 2978 2384 TEncSearch::estIntraPredQT( TComDataCU* pcCU, … … 2983 2389 UInt& ruiDistC, 2984 2390 Bool bLumaOnly 2985 #if HHI_DMM4_ENC_I00662986 , Bool bOnlyIVP2987 #endif2988 2391 ) 2989 2392 { … … 2995 2398 UInt uiQNumParts = pcCU->getTotalNumPart() >> 2; 2996 2399 UInt uiWidthBit = pcCU->getIntraSizeIdx(0); 2997 #if H_3D_VSO2998 Dist uiOverallDistY = 0;2999 #else3000 2400 UInt uiOverallDistY = 0; 3001 #endif3002 2401 UInt uiOverallDistC = 0; 3003 2402 UInt CandNum; … … 3032 2431 Int numModesForFullRD = g_aucIntraModeNumFast[ uiWidthBit ]; 3033 2432 3034 #if HHI_DMM4_ENC_I00663035 if( bOnlyIVP )3036 {3037 numModesForFullRD = 0;3038 }3039 else3040 {3041 #endif3042 2433 Bool doFastSearch = (numModesForFullRD != numModesAvailable); 3043 2434 if (doFastSearch) … … 3056 2447 3057 2448 predIntraLumaAng( pcCU->getPattern(), uiMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 3058 #if H_3D_VSO // M343059 Dist uiSad;3060 if ( m_pcRdCost->getUseVSO() )3061 {3062 if ( m_pcRdCost->getUseEstimatedVSD() )3063 {3064 uiSad = (Dist) ( m_pcRdCost->getDistPartVSD( pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true ) );3065 }3066 else3067 {3068 uiSad = m_pcRdCost->getDistPartVSO(pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true );3069 }3070 }3071 else3072 {3073 uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );3074 }3075 #else3076 2449 // use hadamard transform here 3077 2450 UInt uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight ); 3078 #endif3079 2451 3080 2452 UInt iModeBits = xModeBitsIntra( pcCU, uiMode, uiPU, uiPartOffset, uiDepth, uiInitTrDepth ); 3081 #if H_3D_VSO // M353082 #if H_3D_VSO_FIX // This fix should be enabled after verification3083 Double dLambda;3084 if ( m_pcRdCost->getUseLambdaScaleVSO() )3085 {3086 dLambda = m_pcRdCost->getUseRenModel() ? m_pcRdCost->getLambdaVSO() : m_pcRdCost->getSqrtLambdaVSO();3087 }3088 else3089 {3090 dLambda = m_pcRdCost->getSqrtLambda();3091 }3092 3093 Double cost = (Double)uiSad + (Double)iModeBits * dLambda;3094 #else3095 2453 Double cost = (Double)uiSad + (Double)iModeBits * m_pcRdCost->getSqrtLambda(); 3096 #endif3097 #else3098 Double cost = (Double)uiSad + (Double)iModeBits * m_pcRdCost->getSqrtLambda();3099 #endif3100 2454 3101 2455 CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList ); … … 3135 2489 } 3136 2490 } 3137 #if HHI_DMM4_ENC_I0066 3138 } 3139 #endif 3140 3141 #if H_3D_DIM 3142 //===== determine set of depth intra modes to be tested ===== 3143 if( m_pcEncCfg->getIsDepth() && uiWidth >= DIM_MIN_SIZE && uiWidth <= DIM_MAX_SIZE && uiWidth == uiHeight ) 3144 { 3145 #if HHI_DMM4_ENC_I0066 3146 #if SEPARATE_FLAG_I0085 3147 if( bOnlyIVP && m_pcEncCfg->getUseIVP() ) 3148 #else 3149 if( bOnlyIVP ) 3150 #endif 3151 { 3152 TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight ); 3153 xPredContourFromTex( pcCU, uiPartOffset, uiWidth, uiHeight, dmm4Segmentation ); 3154 3155 Pel deltaDC1 = 0; Pel deltaDC2 = 0; 3156 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, dmm4Segmentation->getPattern(), dmm4Segmentation->getStride(), uiWidth, uiHeight, deltaDC1, deltaDC2 ); 3157 pcCU->setDimDeltaDC( DMM4_IDX, 0, uiPartOffset, deltaDC1 ); 3158 pcCU->setDimDeltaDC( DMM4_IDX, 1, uiPartOffset, deltaDC2 ); 3159 3160 #if HS_DMM_SIGNALLING_I0120 3161 uiRdModeList[ numModesForFullRD++ ] = (DMM4_IDX+DIM_OFFSET); 3162 #else 3163 uiRdModeList[ numModesForFullRD++ ] = (2*DMM4_IDX +DIM_OFFSET); 3164 if( deltaDC1 != 0 || deltaDC2 != 0 ) 3165 uiRdModeList[ numModesForFullRD++ ] = (2*DMM4_IDX+1+DIM_OFFSET); 3166 #endif 3167 dmm4Segmentation->destroy(); delete dmm4Segmentation; 3168 } 3169 else 3170 { 3171 #endif 3172 #if H_3D_FAST_DEPTH_INTRA 3173 Int threshold = max(((pcCU->getQP(0))>>3)-1,3); 3174 Int varThreshold = (Int)( threshold * threshold - 8 ); 3175 UInt varCU = m_pcRdCost->calcVAR(piOrg, uiStride, uiWidth,uiHeight,pcCU->getDepth(0)); 3176 #endif 3177 3178 #if H_3D_DIM_DMM 3179 #if SEPARATE_FLAG_I0085 3180 if( ( m_pcEncCfg->getUseDMM() || m_pcEncCfg->getUseIVP() ) 3181 #else 3182 if( m_pcEncCfg->getUseDMM() 3183 #endif 3184 #if H_3D_FAST_DEPTH_INTRA 3185 && (uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold) 3186 #endif 3187 ) 3188 { 3189 #if SEPARATE_FLAG_I0085 3190 UInt uiStart, uiEnd; 3191 if( m_pcEncCfg->getUseDMM() && m_pcEncCfg->getUseIVP() ) 3192 { 3193 uiStart = 0; 3194 uiEnd = 2; 3195 } 3196 else if( m_pcEncCfg->getUseDMM() ) 3197 { 3198 uiStart = 0; 3199 uiEnd = 1; 3200 } 3201 else if( m_pcEncCfg->getUseIVP() ) 3202 { 3203 uiStart = 1; 3204 uiEnd = 2; 3205 } 3206 else 3207 { 3208 uiStart = 0; 3209 uiEnd = 0; 3210 } 3211 for( UInt dmmType = uiStart; dmmType < uiEnd; dmmType++ ) 3212 #else 3213 for( UInt dmmType = 0; dmmType < DMM_NUM_TYPE; dmmType++ ) 3214 #endif 3215 { 3216 #if H_3D_FCO 3217 TComPic* picTexture = pcCU->getSlice()->getIvPic(false, pcCU->getSlice()->getViewIndex() ); 3218 #if LGE_FCO_I0116 3219 if ( !picTexture->getReconMark() && (DMM4_IDX == dmmType ) ) 3220 #else 3221 if ( !picTexture->getReconMark() && (DMM3_IDX == dmmType || DMM4_IDX == dmmType ) ) 3222 #endif 3223 { 3224 continue; 3225 } 3226 #endif 3227 UInt uiTabIdx = 0; 3228 TComWedgelet* biSegmentation = NULL; 3229 Pel deltaDC1 = 0; Pel deltaDC2 = 0; 3230 switch( dmmType ) 3231 { 3232 case( DMM1_IDX ): 3233 { 3234 xSearchDmm1Wedge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight, uiTabIdx ); 3235 pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dmmType, uiPartOffset, uiDepth + uiInitTrDepth ); 3236 #if SHARP_DMM1_I0110 3237 biSegmentation = pcCU->isDMM1UpscaleMode( uiWidth ) ? 3238 &(g_dmmWedgeLists[(g_aucConvertToBit[pcCU->getDMM1BasePatternWidth(uiWidth)])][uiTabIdx]) : &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]); 3239 #else 3240 biSegmentation = &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]); 3241 #endif 3242 } break; 3243 3244 case( DMM4_IDX ): 3245 { 3246 { 3247 biSegmentation = new TComWedgelet( uiWidth, uiHeight ); 3248 xPredContourFromTex( pcCU, uiPartOffset, uiWidth, uiHeight, biSegmentation ); 3249 } 3250 } break; 3251 default: assert(0); 3252 } 3253 3254 if( biSegmentation ) 3255 { 3256 #if SHARP_DMM1_I0110 3257 if( dmmType == DMM1_IDX && pcCU->isDMM1UpscaleMode( uiWidth ) ){ 3258 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getScaledPattern(uiWidth), uiWidth, uiWidth, uiHeight, deltaDC1, deltaDC2 ); 3259 } 3260 else 3261 { 3262 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getPattern(), biSegmentation->getStride(), uiWidth, uiHeight, deltaDC1, deltaDC2 ); 3263 } 3264 #else 3265 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getPattern(), biSegmentation->getStride(), uiWidth, uiHeight, deltaDC1, deltaDC2 ); 3266 #endif 3267 pcCU->setDimDeltaDC( dmmType, 0, uiPartOffset, deltaDC1 ); 3268 pcCU->setDimDeltaDC( dmmType, 1, uiPartOffset, deltaDC2 ); 3269 3270 #if HS_DMM_SIGNALLING_I0120 3271 uiRdModeList[ numModesForFullRD++ ] = (dmmType +DIM_OFFSET); 3272 #else 3273 uiRdModeList[ numModesForFullRD++ ] = (2*dmmType +DIM_OFFSET); 3274 #if HHI_DMM4_ENC_I0066 3275 if( deltaDC1 != 0 || deltaDC2 != 0 ) 3276 #endif 3277 uiRdModeList[ numModesForFullRD++ ] = (2*dmmType+1+DIM_OFFSET); 3278 #endif 3279 3280 if( DMM4_IDX == dmmType ) { biSegmentation->destroy(); delete biSegmentation; } 3281 } 3282 } 3283 } 3284 #if HHI_DMM4_ENC_I0066 3285 } 3286 #endif 3287 #endif 3288 } 3289 #endif 2491 3290 2492 //===== check modes (using r-d costs) ===== 3291 2493 #if HHI_RQT_INTRA_SPEEDUP_MOD … … 3295 2497 3296 2498 UInt uiBestPUMode = 0; 3297 #if SCU_HS_FAST_INTRA_SDC_I0123 3298 UInt uiBestPUModeConv = 0; 3299 UInt uiSecondBestPUModeConv = 0; 3300 UInt uiThirdBestPUModeConv = 0; 3301 #endif 3302 3303 #if H_3D_VSO 3304 Dist uiBestPUDistY = 0; 3305 #else 2499 3306 2500 UInt uiBestPUDistY = 0; 3307 #endif3308 2501 UInt uiBestPUDistC = 0; 3309 2502 Double dBestPUCost = MAX_DOUBLE; 3310 2503 3311 #if SCU_HS_FAST_INTRA_SDC_I0123 3312 Double dBestPUCostConv = MAX_DOUBLE; 3313 UInt varCU = m_pcRdCost->calcVAR(piOrg, uiStride, uiWidth,uiHeight,pcCU->getDepth(0)); 3314 UInt rdSDC = m_pcEncCfg->getIsDepth() ? numModesForFullRD : 0; 3315 #endif 3316 3317 #if H_3D_DIM_SDC 3318 Bool bBestUseSDC = false; 3319 Pel apBestDCOffsets[2] = {0,0}; 3320 #endif 3321 #if SCU_HS_FAST_INTRA_SDC_I0123 3322 for( UInt uiMode = 0; uiMode < numModesForFullRD + rdSDC; uiMode++ ) 3323 #else 2504 3324 2505 for( UInt uiMode = 0; uiMode < numModesForFullRD; uiMode++ ) 3325 #endif3326 2506 { 3327 2507 // set luma prediction mode 3328 #if !SCU_HS_FAST_INTRA_SDC_I01233329 2508 UInt uiOrgMode = uiRdModeList[uiMode]; 3330 #endif3331 2509 3332 #if SCU_HS_FAST_INTRA_SDC_I01233333 UInt uiOrgMode;3334 if (uiMode < numModesForFullRD)3335 {3336 uiOrgMode = uiRdModeList[uiMode];3337 }3338 else3339 {3340 uiOrgMode = uiRdModeList[uiMode - numModesForFullRD];3341 3342 if (uiBestPUModeConv <= 1 )3343 {3344 if (uiOrgMode > 1 && varCU < 1) continue;3345 }3346 else3347 {3348 if (uiOrgMode != uiBestPUModeConv && uiOrgMode != uiSecondBestPUModeConv && uiOrgMode != uiThirdBestPUModeConv3349 && uiOrgMode > 1 && uiOrgMode < NUM_INTRA_MODE && varCU < 4)3350 continue;3351 }3352 }3353 #endif3354 2510 3355 2511 pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3356 2512 3357 #if H_3D_DIM_SDC3358 #if SCU_HS_FAST_INTRA_SDC_I01233359 Bool bTestSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getSDCAvailable(uiPartOffset) && uiMode >= numModesForFullRD);3360 #else3361 Bool bTestSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getSDCAvailable(uiPartOffset) );3362 #endif3363 2513 3364 for( UInt uiSDC=0; uiSDC<=(bTestSDC?1:0); uiSDC++ )3365 {3366 #if SCU_HS_FAST_INTRA_SDC_I01233367 if (!uiSDC && uiMode >= numModesForFullRD) continue;3368 #endif3369 pcCU->setSDCFlagSubParts( (uiSDC != 0), uiPartOffset, uiDepth + uiInitTrDepth );3370 #if FAST_SDC_OFFSET_DECISION_I00843371 Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};3372 for( Int iOffset = 1; iOffset <= 5; iOffset++ )3373 #else3374 for( Int iSDCDeltaResi = -2; iSDCDeltaResi <= 2; iSDCDeltaResi++ )3375 #endif3376 {3377 #if FAST_SDC_OFFSET_DECISION_I00843378 Int iSDCDeltaResi = 0;3379 if(iOffset % 2 == 0)3380 {3381 iSDCDeltaResi = iOffset >> 1;3382 }3383 else3384 {3385 iSDCDeltaResi = -1 * (iOffset >> 1);3386 }3387 #endif3388 if( ( uiSDC == 0 ) && iSDCDeltaResi != 0 )3389 {3390 continue;3391 }3392 #if FAST_SDC_OFFSET_DECISION_I00843393 if( iOffset > 3)3394 {3395 if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) )3396 {3397 continue;3398 }3399 if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] && iOffset == 5)3400 {3401 continue;3402 }3403 if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] && iOffset == 4)3404 {3405 continue;3406 }3407 }3408 #endif3409 #endif3410 2514 3411 #if H_3D_DIM_ENC || H_3D_DIM_SDC3412 Bool bTestZeroResi = false;3413 #if H_3D_DIM_ENC3414 bTestZeroResi |= pcCU->getSlice()->getIsDepth() && !pcCU->getSlice()->isIRAP();3415 #endif3416 #if H_3D_DIM_SDC3417 bTestZeroResi |= pcCU->getSDCFlag(uiPartOffset);3418 #endif3419 if( uiSDC != 0 && iSDCDeltaResi != 0 )3420 {3421 bTestZeroResi = false;3422 }3423 #endif3424 3425 #if H_3D_DIM_ENC || H_3D_DIM_SDC3426 for( UInt testZeroResi = 0; testZeroResi <= (bTestZeroResi ? 1 : 0) ; testZeroResi++ )3427 {3428 #endif3429 2515 // set context models 3430 2516 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] ); 3431 2517 3432 2518 // determine residual for partition 3433 #if H_3D_VSO3434 Dist uiPUDistY = 0;3435 #else3436 2519 UInt uiPUDistY = 0; 3437 #endif3438 2520 UInt uiPUDistC = 0; 3439 2521 Double dPUCost = 0.0; 3440 #if H_3D_VSO // M363441 if( m_pcRdCost->getUseRenModel() )3442 {3443 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );3444 }3445 #endif3446 #if H_3D_DIM_SDC3447 if( pcCU->getSDCFlag(uiPartOffset) )3448 {3449 pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth);3450 pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth);3451 3452 // start encoding with SDC3453 xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, ( testZeroResi != 0 ), iSDCDeltaResi );3454 #if FAST_SDC_OFFSET_DECISION_I00843455 if ( testZeroResi == 0 && iOffset <= 3 )3456 {3457 dOffsetCost [iOffset -1] = dPUCost;3458 }3459 #endif3460 }3461 else3462 {3463 #endif3464 2522 #if HHI_RQT_INTRA_SPEEDUP 3465 #if H_3D_DIM_ENC3466 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost, (testZeroResi != 0) );3467 #if SCU_HS_FAST_INTRA_SDC_I01233468 if( dPUCost < dBestPUCostConv )3469 {3470 uiThirdBestPUModeConv = uiSecondBestPUModeConv;3471 uiSecondBestPUModeConv = uiBestPUModeConv;3472 uiBestPUModeConv = uiOrgMode;3473 dBestPUCostConv = dPUCost;3474 }3475 #endif3476 #else3477 2523 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost ); 3478 #endif3479 #else3480 #if H_3D_DIM_ENC3481 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost, (testZeroResi != 0) );3482 2524 #else 3483 2525 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost ); 3484 #endif3485 #endif3486 #if H_3D_DIM_SDC3487 }3488 2526 #endif 3489 2527 … … 3500 2538 dBestPUCost = dPUCost; 3501 2539 3502 #if H_3D_DIM_SDC3503 if( pcCU->getSDCFlag(uiPartOffset) )3504 {3505 bBestUseSDC = true;3506 3507 // copy reconstruction3508 pcPredYuv->copyPartToPartYuv(pcRecoYuv, uiPartOffset, uiWidth, uiHeight);3509 3510 // copy DC values3511 apBestDCOffsets[0] = pcCU->getSDCSegmentDCOffset(0, uiPartOffset);3512 apBestDCOffsets[1] = pcCU->getSDCSegmentDCOffset(1, uiPartOffset);3513 }3514 else3515 {3516 bBestUseSDC = false;3517 #endif3518 2540 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv ); 3519 2541 … … 3526 2548 ::memcpy( m_puhQTTempTransformSkipFlag[1], pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3527 2549 ::memcpy( m_puhQTTempTransformSkipFlag[2], pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3528 #if H_3D_DIM_SDC3529 }3530 #endif3531 2550 } 3532 2551 #if HHI_RQT_INTRA_SPEEDUP_MOD … … 3536 2555 dSecondBestPUCost = dPUCost; 3537 2556 } 3538 #endif3539 #if H_3D_DIM_ENC || H_3D_DIM_SDC3540 }3541 } // SDC residual loop3542 #endif3543 #if H_3D_DIM_SDC3544 } // SDC loop3545 2557 #endif 3546 2558 } // Mode loop … … 3562 2574 3563 2575 pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3564 #if H_3D_DIM_SDC3565 pcCU->setSDCFlagSubParts(false, uiPartOffset, uiDepth + uiInitTrDepth);3566 #endif3567 2576 3568 2577 // set context models … … 3570 2579 3571 2580 // determine residual for partition 3572 #if H_3D_VSO3573 Dist uiPUDistY = 0;3574 #else3575 2581 UInt uiPUDistY = 0; 3576 #endif3577 2582 UInt uiPUDistC = 0; 3578 2583 Double dPUCost = 0.0; 3579 #if H_3D_VSO // M373580 // reset Model3581 if( m_pcRdCost->getUseRenModel() )3582 {3583 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );3584 }3585 #endif3586 2584 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost ); 3587 2585 … … 3593 2591 uiBestPUDistC = uiPUDistC; 3594 2592 dBestPUCost = dPUCost; 3595 #if H_3D_DIM_SDC3596 bBestUseSDC = false;3597 #endif3598 2593 3599 2594 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv ); … … 3615 2610 uiOverallDistC += uiBestPUDistC; 3616 2611 3617 #if H_3D_DIM_SDC3618 if( bBestUseSDC )3619 {3620 pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth);3621 pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth);3622 3623 //=== copy best DC segment values back to CU ====3624 pcCU->setSDCSegmentDCOffset(apBestDCOffsets[0], 0, uiPartOffset);3625 pcCU->setSDCSegmentDCOffset(apBestDCOffsets[1], 1, uiPartOffset);3626 }3627 else3628 {3629 #endif3630 2612 //--- update transform index and cbf --- 3631 2613 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 ); … … 3637 2619 ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, m_puhQTTempTransformSkipFlag[1], uiQPartNum * sizeof( UChar ) ); 3638 2620 ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, m_puhQTTempTransformSkipFlag[2], uiQPartNum * sizeof( UChar ) ); 3639 #if H_3D_DIM_SDC3640 }3641 #endif3642 2621 //--- set reconstruction for next intra prediction blocks --- 3643 2622 if( uiPU != uiNumPU - 1 ) … … 3667 2646 } 3668 2647 } 3669 #if H_3D_VSO // M383670 // set model3671 if( m_pcRdCost->getUseRenModel() )3672 {3673 piSrc = pcRecoYuv->getLumaAddr( uiPartOffset );3674 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piSrc, uiSrcStride, uiCompWidth, uiCompHeight);3675 }3676 #endif3677 2648 if( !bLumaOnly && !bSkipChroma ) 3678 2649 { … … 3707 2678 //=== update PU data ==== 3708 2679 pcCU->setLumaIntraDirSubParts ( uiBestPUMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3709 #if H_3D_DIM_SDC3710 pcCU->setSDCFlagSubParts ( bBestUseSDC, uiPartOffset, uiDepth + uiInitTrDepth );3711 #endif3712 2680 pcCU->copyToPic ( uiDepth, uiPU, uiInitTrDepth ); 3713 2681 } // PU loop … … 3959 2927 uiBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 3960 2928 3961 #if H_3D_VSO // M433962 if( m_pcRdCost->getUseLambdaScaleVSO() )3963 dCost = m_pcRdCost->calcRdCostVSO( uiBits, uiDistortion );3964 else3965 #endif3966 2929 dCost = m_pcRdCost->calcRdCost( uiBits, uiDistortion ); 3967 2930 … … 3992 2955 m_tmpYuvPred .getLumaAddr( uiAbsPartIdx ), m_tmpYuvPred .getStride(), 3993 2956 iWidth, iHeight, m_pcEncCfg->getUseHADME() ); 3994 #if H_3D_IC3995 cDistParam.bUseIC = false;3996 #endif3997 #if H_3D_INTER_SDC3998 cDistParam.bUseSDCMRSAD = false;3999 #endif4000 2957 ruiErr = cDistParam.DistFunc( &cDistParam ); 4001 2958 } … … 4015 2972 */ 4016 2973 Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost, TComMvField* cMvFieldNeighbours, UChar* uhInterDirNeighbours 4017 #if H_3D_VSP4018 , Int* vspFlag4019 #if !FIX_TICKET_794020 , InheritedVSPDisInfo* inheritedVSPDisInfo4021 #endif4022 #endif4023 #if H_3D_SPIVMP4024 , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP4025 #endif4026 2974 , Int& numValidMergeCand 4027 2975 ) … … 4034 2982 UInt uiDepth = pcCU->getDepth( uiAbsPartIdx ); 4035 2983 4036 #if H_3D_DBBP4037 DBBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();4038 if( pcCU->getDBBPFlag(0) )4039 {4040 AOF( uiAbsPartIdx == 0 );4041 AOF( iPUIdx == 0 );4042 AOF( pcCU->getPartitionSize(0) == SIZE_2Nx2N );4043 AOF( pDBBPTmpData->eVirtualPartSize != SIZE_NONE );4044 4045 // temporary change of partition size for candidate derivation4046 pcCU->setPartSizeSubParts( pDBBPTmpData->eVirtualPartSize, 0, pcCU->getDepth(0));4047 iPUIdx = pcCU->getDBBPTmpData()->uiVirtualPartIndex;4048 4049 // if this is handling the second segment, make sure that motion info of first segment is available4050 if( iPUIdx == 1 )4051 {4052 pcCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[0], 0, 0, pcCU->getDepth(0)); // interprets depth relative to LCU level4053 4054 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )4055 {4056 RefPicList eRefList = (RefPicList)uiRefListIdx;4057 4058 pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[0][eRefList], pDBBPTmpData->eVirtualPartSize, 0, 0, 0 ); // interprets depth relative to rpcTempCU level4059 }4060 }4061 4062 // update these values to virtual partition size4063 pcCU->getPartIndexAndSize( iPUIdx, uiAbsPartIdx, iWidth, iHeight );4064 }4065 #endif4066 2984 4067 2985 PartSize partSize = pcCU->getPartitionSize( 0 ); 4068 #if H_3D_DBBP4069 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && partSize != SIZE_2Nx2N && pcCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(0) == false )4070 #else4071 2986 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && partSize != SIZE_2Nx2N && pcCU->getWidth( 0 ) <= 8 ) 4072 #endif4073 2987 { 4074 2988 pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 4075 2989 if ( iPUIdx == 0 ) 4076 2990 { 4077 #if H_3D4078 pcCU->initAvailableFlags();4079 pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand);4080 pcCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours4081 #if H_3D_VSP && !FIX_TICKET_794082 , inheritedVSPDisInfo4083 #endif4084 #if H_3D_SPIVMP4085 , pcMvFieldSP, puhInterDirSP4086 #endif4087 , numValidMergeCand4088 );4089 4090 pcCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours4091 #if H_3D_VSP4092 , vspFlag4093 #endif4094 #if H_3D_SPIVMP4095 , pbSPIVMPFlag4096 #endif4097 , numValidMergeCand4098 );4099 #else4100 2991 pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand ); 4101 #endif4102 2992 } 4103 2993 pcCU->setPartSizeSubParts( partSize, 0, uiDepth ); … … 4105 2995 else 4106 2996 { 4107 #if H_3D4108 pcCU->initAvailableFlags();4109 pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand);4110 pcCU->xGetInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours4111 #if H_3D_VSP && !FIX_TICKET_794112 , inheritedVSPDisInfo4113 #endif4114 #if H_3D_SPIVMP4115 , pcMvFieldSP, puhInterDirSP4116 #endif4117 , numValidMergeCand4118 );4119 4120 pcCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours4121 #if H_3D_VSP4122 , vspFlag4123 #endif4124 #if H_3D_SPIVMP4125 , pbSPIVMPFlag4126 #endif4127 , numValidMergeCand4128 );4129 #else4130 2997 pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand 4131 2998 ); 4132 #endif 4133 } 4134 #if H_3D_VSP && !FIX_TICKET_75 4135 xRestrictBipredMergeCand( pcCU, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours,vspFlag, numValidMergeCand ); 4136 #else 2999 } 4137 3000 xRestrictBipredMergeCand( pcCU, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 4138 #endif 4139 4140 #if H_3D_DBBP 4141 if( pcCU->getDBBPFlag(0) ) 4142 { 4143 // reset to 2Nx2N for actual motion search 4144 iPUIdx = 0; 4145 AOF( pcCU->getPartitionSize(0) == pDBBPTmpData->eVirtualPartSize ); 4146 pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, pcCU->getDepth(0)); 4147 4148 // restore values for 2Nx2N partition size 4149 pcCU->getPartIndexAndSize( iPUIdx, uiAbsPartIdx, iWidth, iHeight ); 4150 4151 AOF( uiAbsPartIdx == 0 ); 4152 AOF( iWidth == iHeight ); 4153 } 4154 #endif 3001 4155 3002 4156 3003 ruiCost = MAX_UINT; … … 4162 3009 PartSize ePartSize = pcCU->getPartitionSize( 0 ); 4163 3010 4164 #if H_3D_VSP 4165 pcCU->setVSPFlagSubParts( vspFlag[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) ); 4166 #if !FIX_TICKET_79 4167 pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) ); 4168 #endif 4169 #endif 4170 4171 #if H_3D_SPIVMP 4172 pcCU->setSPIVMPFlagSubParts( pbSPIVMPFlag[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx )); 4173 if (pbSPIVMPFlag[uiMergeCand]) 4174 { 4175 UInt uiSPAddr; 4176 4177 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; 4178 4179 pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); 4180 4181 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++) 4182 { 4183 pcCU->getSPAbsPartIdx(uiAbsPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr); 4184 pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight); 4185 pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight); 4186 } 4187 } 4188 else 4189 #endif 4190 #if H_3D_VSP 4191 #if H_3D_DBBP 4192 if ( vspFlag[uiMergeCand] && !pcCU->getDBBPFlag(0) ) 4193 #else 4194 if ( vspFlag[uiMergeCand] ) 4195 #endif 4196 { 4197 UInt partAddr; 4198 Int vspSize; 4199 Int width, height; 4200 pcCU->getPartIndexAndSize( iPUIdx, partAddr, width, height ); 4201 4202 if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 ) 4203 { 4204 pcCU->setMvFieldPUForVSP( pcCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize ); 4205 pcCU->setVSPFlag( partAddr, vspSize ); 4206 } 4207 else 4208 { 4209 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 4210 } 4211 if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 ) 4212 { 4213 pcCU->setMvFieldPUForVSP( pcCU, partAddr, width, height, REF_PIC_LIST_1, cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize ); 4214 pcCU->setVSPFlag( partAddr, vspSize ); 4215 } 4216 else 4217 { 4218 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 4219 } 4220 } 4221 else 4222 { 4223 #endif 3011 4224 3012 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 4225 3013 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 4226 #if H_3D_VSP 4227 } 4228 #endif 4229 4230 #if H_3D_DDD 4231 if( uiMergeCand == pcCU->getUseDDDCandIdx() ) 4232 { 4233 pcCU->setUseDDD( true, uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) ); 4234 pcCU->setDDDepthSubParts( pcCU->getDDTmpDepth(), uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) ); 4235 } 4236 else 4237 { 4238 pcCU->setUseDDD( false, uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) ); 4239 } 4240 #endif 3014 4241 3015 4242 3016 xGetInterPredictionError( pcCU, pcYuvOrg, iPUIdx, uiCostCand, m_pcEncCfg->getUseHADME() ); … … 4266 3040 * \returns Void 4267 3041 */ 4268 #if H_3D_VSP && !FIX_TICKET_754269 Void TEncSearch::xRestrictBipredMergeCand( TComDataCU* pcCU, UInt puIdx, TComMvField* mvFieldNeighbours, UChar* interDirNeighbours, Int* vspFlag, Int numValidMergeCand )4270 #else4271 3042 Void TEncSearch::xRestrictBipredMergeCand( TComDataCU* pcCU, UInt puIdx, TComMvField* mvFieldNeighbours, UChar* interDirNeighbours, Int numValidMergeCand ) 4272 #endif4273 3043 { 4274 3044 if ( pcCU->isBipredRestriction(puIdx) ) … … 4276 3046 for( UInt mergeCand = 0; mergeCand < numValidMergeCand; ++mergeCand ) 4277 3047 { 4278 #if H_3D_VSP && !FIX_TICKET_754279 if ( (interDirNeighbours[mergeCand] == 3) && (vspFlag[mergeCand] == false) )4280 #else4281 3048 if ( interDirNeighbours[mergeCand] == 3 ) 4282 #endif4283 3049 { 4284 3050 interDirNeighbours[mergeCand] = 1; … … 4299 3065 */ 4300 3066 #if AMP_MRG 4301 #if H_3D_FAST_TEXTURE_ENCODING4302 Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bFMD, Bool bUseRes, Bool bUseMRG )4303 #else4304 3067 Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes, Bool bUseMRG ) 4305 #endif4306 3068 #else 4307 3069 Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes ) … … 4366 3128 #endif 4367 3129 4368 #if H_3D_IV_MERGE4369 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists4370 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];4371 #else4372 3130 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists 4373 3131 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 4374 #endif4375 3132 Int numValidMergeCand = 0 ; 4376 3133 … … 4408 3165 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); 4409 3166 4410 #if H_3D_VSP4411 pcCU->setVSPFlagSubParts( 0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr) );4412 #endif4413 3167 4414 3168 #if AMP_MRG 4415 3169 Bool bTestNormalMC = true; 4416 #if H_3D_FAST_TEXTURE_ENCODING4417 if (bFMD||( bUseMRG && pcCU->getWidth( 0 ) > 8 && iNumPart == 2 ))4418 #else4419 3170 if ( bUseMRG && pcCU->getWidth( 0 ) > 8 && iNumPart == 2 ) 4420 #endif4421 3171 { 4422 3172 bTestNormalMC = false; … … 4861 3611 #endif 4862 3612 4863 #if H_3D_DBBP4864 // test merge mode for DBBP (2Nx2N)4865 if ( pcCU->getPartitionSize( uiPartAddr ) != SIZE_2Nx2N || pcCU->getDBBPFlag(0) )4866 #else4867 3613 if ( pcCU->getPartitionSize( uiPartAddr ) != SIZE_2Nx2N ) 4868 #endif4869 3614 { 4870 3615 UInt uiMRGInterDir = 0; … … 4899 3644 // find Merge result 4900 3645 UInt uiMRGCost = MAX_UINT; 4901 #if H_3D_VSP4902 Int vspFlag[MRG_MAX_NUM_CANDS_MEM];4903 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);4904 #if !FIX_TICKET_794905 InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];4906 #endif4907 UInt uiAbsPartIdx = 0;4908 Int iWidth = 0;4909 Int iHeight = 0;4910 pcCU->getPartIndexAndSize( iPartIdx, uiAbsPartIdx, iWidth, iHeight );4911 DisInfo OriginalDvInfo = pcCU->getDvInfo(uiAbsPartIdx);4912 #endif4913 #if H_3D_SPIVMP4914 Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];4915 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);4916 TComMvField* pcMvFieldSP;4917 UChar* puhInterDirSP;4918 pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2];4919 puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()];4920 #endif4921 3646 xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours 4922 #if H_3D_VSP4923 , vspFlag4924 #if !FIX_TICKET_794925 , inheritedVSPDisInfo4926 #endif4927 #endif4928 #if H_3D_SPIVMP4929 , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP4930 #endif4931 3647 , numValidMergeCand 4932 3648 ); … … 4936 3652 pcCU->setMergeFlagSubParts ( true, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4937 3653 pcCU->setMergeIndexSubParts( uiMRGIndex, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4938 #if H_3D_VSP4939 pcCU->setVSPFlagSubParts( vspFlag[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );4940 #if !FIX_TICKET_794941 pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMRGIndex].m_acDvInfo, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );4942 #endif4943 #endif4944 #if H_3D_DDD4945 if( uiMRGIndex == pcCU->getUseDDDCandIdx() )4946 {4947 assert( vspFlag[uiMRGIndex] == 0 );4948 assert( bSPIVMPFlag[uiMRGIndex] == 0 );4949 pcCU->setUseDDD( true, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );4950 pcCU->setDDDepthSubParts( pcCU->getDDTmpDepth(), uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );4951 }4952 else4953 {4954 pcCU->setUseDDD( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );4955 }4956 #endif4957 #if H_3D_SPIVMP4958 pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );4959 if (bSPIVMPFlag[uiMRGIndex]!=0)4960 {4961 UInt uiSPAddr;4962 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;4963 pcCU->getSPPara(iRoiWidth, iRoiHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);4964 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)4965 {4966 pcCU->getSPAbsPartIdx(uiPartAddr, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);4967 pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);4968 pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);4969 pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);4970 }4971 if ( pcCU->getInterDir(uiPartAddr) == 3 && pcCU->isBipredRestriction(iPartIdx) )4972 {4973 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( TComMv(0,0), ePartSize, uiPartAddr, 0, iPartIdx);4974 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllRefIdx( -1, ePartSize, uiPartAddr, 0, iPartIdx);4975 pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ));4976 }4977 }4978 else4979 #endif4980 #if H_3D_VSP4981 #if H_3D_DBBP4982 if ( vspFlag[uiMRGIndex] && !pcCU->getDBBPFlag(uiPartAddr) )4983 #else4984 if ( vspFlag[uiMRGIndex] )4985 #endif4986 {4987 UInt partAddrTemp;4988 Int vspSize;4989 Int width, height;4990 pcCU->getPartIndexAndSize( iPartIdx, partAddrTemp, width, height ); // true or pcCU->getTotalNumPart()==2564991 if( uiMRGInterDir & 0x01 )4992 {4993 pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_0, cMRGMvField[0].getRefIdx(), vspSize );4994 pcCU->setVSPFlag( partAddrTemp, vspSize );4995 }4996 else4997 {4998 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx );4999 }5000 if( uiMRGInterDir & 0x02 )5001 {5002 pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_1, cMRGMvField[1].getRefIdx(), vspSize );5003 pcCU->setVSPFlag( partAddrTemp, vspSize );5004 }5005 else5006 {5007 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx );5008 }5009 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );5010 }5011 else5012 {5013 #endif5014 3654 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 5015 3655 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 5016 3656 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 5017 #if H_3D5018 }5019 #endif5020 3657 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( cMvZero, ePartSize, uiPartAddr, 0, iPartIdx ); 5021 3658 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( cMvZero, ePartSize, uiPartAddr, 0, iPartIdx ); … … 5028 3665 else 5029 3666 { 5030 #if H_3D_SPIVMP5031 pcCU->setSPIVMPFlagSubParts(0, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );5032 #endif5033 #if H_3D_DDD5034 pcCU->setUseDDD( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );5035 #endif5036 3667 // set ME result 5037 3668 pcCU->setMergeFlagSubParts( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 5038 3669 pcCU->setInterDirSubParts ( uiMEInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 5039 #if H_3D_VSP5040 pcCU->setVSPFlagSubParts ( 0, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );5041 pcCU->setDvInfoSubParts(OriginalDvInfo, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );5042 #endif5043 3670 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMEMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 5044 3671 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMEMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 5045 3672 } 5046 #if H_3D_SPIVMP5047 delete[] pcMvFieldSP;5048 delete[] puhInterDirSP;5049 #endif5050 3673 } 5051 3674 … … 5082 3705 if (!bFilled) 5083 3706 { 5084 #if H_3D_DBBP5085 DBBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();5086 if( pcCU->getDBBPFlag(0) )5087 {5088 AOF( uiPartAddr == 0 );5089 AOF( uiPartIdx == 0 );5090 AOF( pcCU->getPartitionSize(0) == SIZE_2Nx2N );5091 AOF( pDBBPTmpData->eVirtualPartSize != SIZE_NONE );5092 AOF( iRoiWidth == iRoiHeight );5093 5094 // temporary change of partition size for candidate derivation5095 pcCU->setPartSizeSubParts( pDBBPTmpData->eVirtualPartSize, 0, pcCU->getDepth(0));5096 uiPartIdx = pcCU->getDBBPTmpData()->uiVirtualPartIndex;5097 5098 // if this is handling the second segment, make sure that motion info of first segment is set to first segment5099 if( uiPartIdx == 1 )5100 {5101 pcCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[0], 0, 0, pcCU->getDepth(0)); // interprets depth relative to LCU level5102 5103 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )5104 {5105 RefPicList eRefList = (RefPicList)uiRefListIdx;5106 pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[0][eRefList], pDBBPTmpData->eVirtualPartSize, 0, 0, 0 ); // interprets depth relative to rpcTempCU level5107 }5108 }5109 5110 // update values to virtual partition size5111 pcCU->getPartIndexAndSize( uiPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );5112 }5113 #endif5114 3707 5115 3708 pcCU->fillMvpCand( uiPartIdx, uiPartAddr, eRefPicList, iRefIdx, pcAMVPInfo ); 5116 3709 5117 #if H_3D_DBBP5118 if( pcCU->getDBBPFlag(0) )5119 {5120 // restore 2Nx2N partitioning for motion estimation5121 uiPartIdx = 0;5122 AOF( pcCU->getPartitionSize(0) == pDBBPTmpData->eVirtualPartSize );5123 pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, pcCU->getDepth(0));5124 5125 // restore values for 2Nx2N partition size5126 pcCU->getPartIndexAndSize( uiPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );5127 AOF(uiPartAddr==0);5128 }5129 #endif5130 3710 } 5131 3711 … … 5347 3927 pcCU->clipMv( cMvCand ); 5348 3928 5349 #if H_3D_IC5350 Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getViewIndex() != pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() );5351 #endif5352 3929 5353 3930 // prediction pattern … … 5359 3936 { 5360 3937 xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false 5361 #if H_3D_ARP5362 , false5363 #endif5364 #if H_3D_IC5365 , bICFlag5366 #endif5367 3938 ); 5368 3939 } … … 5410 3981 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); 5411 3982 5412 #if H_3D_IC5413 Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getViewIndex() != pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getViewIndex() );5414 pcPatternKey->setICFlag( bICFlag );5415 #endif5416 #if H_3D_INTER_SDC5417 if ( pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) )5418 {5419 pcPatternKey->setSDCMRSADFlag( true );5420 }5421 else5422 {5423 pcPatternKey->setSDCMRSADFlag( false );5424 }5425 #endif5426 3983 5427 3984 if ( bBi ) … … 5457 4014 5458 4015 m_pcRdCost->setPredictor ( *pcMvPred ); 5459 #if H_3D_IC5460 if( pcCU->getSlice()->getIsDepth() )5461 m_pcRdCost->setCostScale ( 0 );5462 else5463 #endif5464 4016 m_pcRdCost->setCostScale ( 2 ); 5465 4017 … … 5477 4029 5478 4030 m_pcRdCost->getMotionCost( 1, 0 ); 5479 #if H_3D_IC5480 if( ! pcCU->getSlice()->getIsDepth() )5481 {5482 #endif5483 4031 m_pcRdCost->setCostScale ( 1 ); 5484 4032 … … 5491 4039 rcMv += (cMvHalf <<= 1); 5492 4040 rcMv += cMvQter; 5493 #if H_3D_IC5494 }5495 #endif5496 4041 5497 4042 UInt uiMvBits = m_pcRdCost->getBits( rcMv.getHor(), rcMv.getVer() ); 5498 #if H_3D_IC5499 if( pcCU->getSlice()->getIsDepth() )5500 ruiCost += m_pcRdCost->getCost( uiMvBits );5501 #endif5502 4043 ruiBits += uiMvBits; 5503 4044 ruiCost = (UInt)( floor( fWeight * ( (Double)ruiCost - (Double)m_pcRdCost->getCost( uiMvBits ) ) ) + (Double)m_pcRdCost->getCost( ruiBits ) ); … … 5508 4049 { 5509 4050 Int iMvShift = 2; 5510 #if H_3D_IC5511 if( pcCU->getSlice()->getIsDepth() )5512 iMvShift = 0;5513 #endif5514 4051 TComMv cTmpMvPred = cMvPred; 5515 4052 pcCU->clipMv( cTmpMvPred ); … … 5563 4100 5564 4101 setDistParamComp(0); 5565 #if H_3D_IC5566 m_cDistParam.bUseIC = pcPatternKey->getICFlag();5567 #endif5568 #if H_3D_INTER_SDC5569 m_cDistParam.bUseSDCMRSAD = pcPatternKey->getSDCMRSADFlag();5570 #endif5571 4102 m_cDistParam.bitDepth = g_bitDepthY; 5572 4103 uiSad = m_cDistParam.DistFunc( &m_cDistParam ); … … 5619 4150 UInt uiSearchRange = m_iSearchRange; 5620 4151 pcCU->clipMv( rcMv ); 5621 #if H_3D_IC5622 if( ! pcCU->getSlice()->getIsDepth() )5623 #endif5624 4152 rcMv >>= 2; 5625 4153 // init TZSearchStruct … … 5639 4167 TComMv cMv = m_acMvPredictors[index]; 5640 4168 pcCU->clipMv( cMv ); 5641 #if H_3D_IC5642 if( ! pcCU->getSlice()->getIsDepth() )5643 #endif5644 4169 cMv >>= 2; 5645 4170 xTZSearchHelp( pcPatternKey, cStruct, cMv.getHor(), cMv.getVer(), 0, 0 ); … … 5847 4372 Bool bHighPass = pcCU->getSlice()->getDepth() ? true : false; 5848 4373 UInt uiBits = 0, uiBitsBest = 0; 5849 #if H_3D_VSO5850 Dist uiDistortion = 0, uiDistortionBest = 0;5851 #else5852 4374 UInt uiDistortion = 0, uiDistortionBest = 0; 5853 #endif5854 4375 5855 4376 UInt uiWidth = pcCU->getWidth ( 0 ); … … 5865 4386 pcYuvPred->copyToPartYuv( rpcYuvRec, 0 ); 5866 4387 5867 #if H_3D_VSO // M135868 if ( m_pcRdCost->getUseVSO() )5869 {5870 uiDistortion = m_pcRdCost->getDistPartVSO( pcCU, 0, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight , false );5871 }5872 else5873 {5874 #endif5875 4388 uiDistortion = m_pcRdCost->getDistPart(g_bitDepthY, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight ) 5876 4389 + m_pcRdCost->getDistPart(g_bitDepthC, rpcYuvRec->getCbAddr(), rpcYuvRec->getCStride(), pcYuvOrg->getCbAddr(), pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1, TEXT_CHROMA_U ) 5877 4390 + m_pcRdCost->getDistPart(g_bitDepthC, rpcYuvRec->getCrAddr(), rpcYuvRec->getCStride(), pcYuvOrg->getCrAddr(), pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1, TEXT_CHROMA_V ); 5878 #if H_3D_VSO // MIgnore5879 }5880 #endif5881 4391 5882 4392 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST]); … … 5889 4399 m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true); 5890 4400 m_pcEntropyCoder->encodeMergeIndex( pcCU, 0, true ); 5891 #if H_3D_ARP5892 m_pcEntropyCoder->encodeARPW( pcCU, 0 );5893 #endif5894 #if H_3D_IC5895 m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );5896 #endif5897 4401 uiBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 5898 4402 pcCU->getTotalBits() = uiBits; 5899 4403 pcCU->getTotalDistortion() = uiDistortion; 5900 #if H_3D_VSO //M 145901 if ( m_pcRdCost->getUseLambdaScaleVSO() )5902 pcCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( uiBits, uiDistortion );5903 else5904 #endif5905 4404 pcCU->getTotalCost() = m_pcRdCost->calcRdCost( uiBits, uiDistortion ); 5906 4405 … … 5910 4409 pcCU->setTrIdxSubParts( 0, 0, pcCU->getDepth(0) ); 5911 4410 5912 #if H_3D_VSO // necessary? // M155913 // set Model5914 if( !m_pcRdCost->getUseEstimatedVSD()&& m_pcRdCost->getUseRenModel() )5915 {5916 Pel* piSrc = rpcYuvRec->getLumaAddr();5917 UInt uiSrcStride = rpcYuvRec->getStride();5918 m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );5919 }5920 #endif5921 4411 5922 4412 return; … … 5948 4438 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ pcCU->getDepth( 0 ) ][ CI_CURR_BEST ] ); 5949 4439 5950 #if H_3D_VSO // M16 // M185951 Dist uiZeroDistortion = 0;5952 if ( m_pcRdCost->getUseVSO() ) // This creating and destroying need to be fixed.5953 {5954 m_cYuvRecTemp.create( pcYuvPred->getWidth(), pcYuvPred->getHeight() );5955 }5956 5957 xEstimateResidualQT( pcCU, 0, 0, 0, pcYuvOrg, pcYuvPred, rpcYuvResi, pcCU->getDepth(0), dCost, uiBits, uiDistortion, &uiZeroDistortion );5958 5959 if ( m_pcRdCost->getUseVSO() )5960 {5961 m_cYuvRecTemp.destroy();5962 }5963 #else5964 4440 UInt uiZeroDistortion = 0; 5965 4441 xEstimateResidualQT( pcCU, 0, 0, 0, rpcYuvResi, pcCU->getDepth(0), dCost, uiBits, uiDistortion, &uiZeroDistortion ); 5966 #endif5967 4442 5968 4443 m_pcEntropyCoder->resetBits(); … … 5970 4445 UInt zeroResiBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 5971 4446 5972 #if H_3D_VSO // M195973 Double dZeroCost;5974 if( m_pcRdCost->getUseLambdaScaleVSO() )5975 dZeroCost = m_pcRdCost->calcRdCostVSO( 0, uiZeroDistortion );5976 else5977 dZeroCost = m_pcRdCost->calcRdCost( zeroResiBits, uiZeroDistortion );5978 #else5979 4447 Double dZeroCost = m_pcRdCost->calcRdCost( zeroResiBits, uiZeroDistortion ); 5980 #endif5981 4448 if(pcCU->isLosslessCoded( 0 )) 5982 4449 { 5983 4450 dZeroCost = dCost + 1; 5984 4451 } 5985 #if H_3D_SPIVMP5986 if ( dZeroCost < dCost || pcCU->getQtRootCbf(0)==0)5987 #else5988 4452 if ( dZeroCost < dCost ) 5989 #endif5990 4453 { 5991 4454 dCost = dZeroCost; … … 6016 4479 } 6017 4480 6018 #if H_3D_VSO // M206019 Double dExactCost;6020 if( m_pcRdCost->getUseLambdaScaleVSO() )6021 dExactCost = m_pcRdCost->calcRdCostVSO( uiBits, uiDistortion );6022 else6023 dExactCost = m_pcRdCost->calcRdCost ( uiBits, uiDistortion );6024 #else6025 4481 Double dExactCost = m_pcRdCost->calcRdCost( uiBits, uiDistortion ); 6026 #endif6027 4482 dCost = dExactCost; 6028 4483 … … 6063 4518 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ pcCU->getDepth( 0 ) ][ CI_TEMP_BEST ] ); 6064 4519 } 6065 #if H_3D_VSO // M216066 if( m_pcRdCost->getUseRenModel() && !m_pcRdCost->getUseEstimatedVSD() )6067 {6068 Pel* piSrc = pcYuvOrg->getLumaAddr();6069 UInt uiSrcStride = pcYuvOrg->getStride();6070 m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );6071 }6072 #endif6073 4520 } 6074 4521 assert ( dCostBest != MAX_DOUBLE ); … … 6098 4545 rpcYuvRec->addClip ( pcYuvPred, rpcYuvResiBest, 0, uiWidth ); 6099 4546 6100 #if H_3D_VSO // M22 // GT: might be removed since VSO already provided clipped distortion6101 if ( m_pcRdCost->getUseVSO() )6102 {6103 uiDistortionBest = m_pcRdCost->getDistPartVSO ( pcCU, 0, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight, false );6104 }6105 else6106 {6107 #endif6108 4547 // update with clipped distortion and cost (qp estimation loop uses unclipped values) 6109 4548 uiDistortionBest = m_pcRdCost->getDistPart(g_bitDepthY, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight ) 6110 4549 + m_pcRdCost->getDistPart(g_bitDepthC, rpcYuvRec->getCbAddr(), rpcYuvRec->getCStride(), pcYuvOrg->getCbAddr(), pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1, TEXT_CHROMA_U ) 6111 4550 + m_pcRdCost->getDistPart(g_bitDepthC, rpcYuvRec->getCrAddr(), rpcYuvRec->getCStride(), pcYuvOrg->getCrAddr(), pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1, TEXT_CHROMA_V ); 6112 #if H_3D_VSO // M236113 }6114 if ( m_pcRdCost->getUseLambdaScaleVSO() )6115 dCostBest = m_pcRdCost->calcRdCostVSO( uiBitsBest, uiDistortionBest );6116 else6117 #endif6118 4551 dCostBest = m_pcRdCost->calcRdCost( uiBitsBest, uiDistortionBest ); 6119 4552 … … 6128 4561 6129 4562 pcCU->setQPSubParts( qpBest, 0, pcCU->getDepth(0) ); 6130 #if H_3D_VSO // M24 // necessary??6131 if( m_pcRdCost->getUseRenModel() && !m_pcRdCost->getUseEstimatedVSD() )6132 {6133 Pel* piSrc = rpcYuvRec->getLumaAddr();6134 UInt uiSrcStride = rpcYuvRec->getStride();6135 m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );6136 }6137 #endif6138 4563 } 6139 4564 6140 #if H_3D_INTER_SDC 6141 Void TEncSearch::encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU, TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, TComYuv* pcRec, Int uiOffest, const UInt uiDepth ) 6142 { 6143 if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( 0 ) ) 6144 { 6145 return; 6146 } 6147 pcCU->setSDCFlagSubParts( true, 0, uiDepth ); 6148 6149 UInt uiWidth = pcCU->getWidth ( 0 ); 6150 UInt uiHeight = pcCU->getHeight( 0 ); 6151 UInt uiSegSize = 0; 6152 6153 Pel *pPred, *pOrg; 6154 UInt uiPredStride = pcPred->getStride(); 6155 UInt uiOrgStride = pcOrg->getStride(); 6156 UInt uiPelX, uiPelY; 6157 6158 pPred = pcPred->getLumaAddr( 0 ); 6159 pOrg = pcOrg->getLumaAddr( 0 ); 6160 Int pResDC = 0; 6161 6162 //calculate dc value for prediction and original signal, and calculate residual and reconstruction 6163 for( uiPelY = 0; uiPelY < uiHeight; uiPelY++ ) 6164 { 6165 for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ ) 6166 { 6167 pResDC += (Int)( pOrg [uiPelX] - pPred[uiPelX] ); 6168 uiSegSize++; 6169 } 6170 pOrg += uiOrgStride; 6171 pPred += uiPredStride; 6172 } 6173 6174 Int iResiOffset = ( pResDC > 0 ? ( uiSegSize >> 1 ) : -1*( uiSegSize >> 1 ) ); 6175 pResDC = ( pResDC + iResiOffset ) / (Int) uiSegSize; 6176 6177 pcCU->setSDCSegmentDCOffset( pResDC + uiOffest, 0, 0 ); 6178 6179 6180 Pel *pRec; 6181 UInt uiRecStride = pcRec->getStride(); 6182 pPred = pcPred->getLumaAddr( 0 ); 6183 pRec = pcRec->getLumaAddr( 0 ); 6184 6185 for( uiPelY = 0; uiPelY < uiHeight; uiPelY++ ) 6186 { 6187 for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ ) 6188 { 6189 pRec[ uiPelX ] = Clip3( 0, ( 1 << g_bitDepthY ) - 1, pPred[uiPelX] + pcCU->getSDCSegmentDCOffset(0, 0) ); 6190 } 6191 pPred += uiPredStride; 6192 pRec += uiRecStride; 6193 } 6194 6195 // clear UV 6196 UInt uiStrideC = pcRec->getCStride(); 6197 Pel *pRecCb = pcRec->getCbAddr(); 6198 Pel *pRecCr = pcRec->getCrAddr(); 6199 6200 for (Int y=0; y < uiHeight/2; y++) 6201 { 6202 for (Int x=0; x < uiWidth/2; x++) 6203 { 6204 pRecCb[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) ); 6205 pRecCr[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) ); 6206 } 6207 6208 pRecCb += uiStrideC; 6209 pRecCr += uiStrideC; 6210 } 6211 6212 Dist ruiDist; 6213 Double rdCost; 6214 #if H_3D_VSO // M13 6215 if ( m_pcRdCost->getUseVSO() ) 6216 { 6217 ruiDist = m_pcRdCost->getDistPartVSO( pcCU, 0, pcRec->getLumaAddr(), pcRec->getStride(), pcOrg->getLumaAddr(), pcOrg->getStride(), uiWidth, uiHeight , false ); 6218 } 6219 else 6220 { 6221 #endif 6222 { 6223 ruiDist = m_pcRdCost->getDistPart( g_bitDepthY, pcRec->getLumaAddr( 0 ), uiRecStride, pcOrg->getLumaAddr( 0 ), uiOrgStride, uiWidth, uiHeight ); 6224 } 6225 #if H_3D_VSO 6226 } 6227 #endif 6228 6229 #if H_3D_DIM_SDC 6230 Bool bNonSkip = false; 6231 #else 6232 Bool bNonSkip = true; 6233 #endif 6234 bNonSkip |= ( pcCU->getSDCSegmentDCOffset( 0, 0 ) != 0 ) ? 1 : 0; 6235 if( !bNonSkip ) 6236 { 6237 pcCU->getTotalBits() = MAX_INT; 6238 pcCU->getTotalDistortion() = MAX_INT; 6239 pcCU->getTotalCost() = MAX_DOUBLE; 6240 } 6241 else 6242 { 6243 //----- determine rate and r-d cost ----- 6244 UInt uiBits = 0; 6245 TComYuv *pDummy = NULL; 6246 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST] ); 6247 6248 xAddSymbolBitsInter( pcCU, 0, 0, uiBits, pDummy, NULL, pDummy ); 6249 6250 #if H_3D_VSO //M 14 6251 if ( m_pcRdCost->getUseLambdaScaleVSO() ) 6252 { 6253 rdCost = m_pcRdCost->calcRdCostVSO( uiBits, ruiDist ); 6254 } 6255 else 6256 #endif 6257 { 6258 rdCost = m_pcRdCost->calcRdCost( uiBits, ruiDist ); 6259 } 6260 6261 pcCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits(); 6262 pcCU->getTotalDistortion() = ruiDist; 6263 pcCU->getTotalCost() = rdCost; 6264 6265 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ pcCU->getDepth( 0 ) ][ CI_TEMP_BEST ] ); 6266 } 6267 6268 #if H_3D_VSO // necessary? // M15 6269 // set Model 6270 if( !m_pcRdCost->getUseEstimatedVSD() && m_pcRdCost->getUseRenModel() ) 6271 { 6272 Pel* piSrc = pcRec->getLumaAddr(); 6273 UInt uiSrcStride = pcRec->getStride(); 6274 m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 6275 } 6276 #endif 6277 } 6278 #endif 6279 6280 #if H_3D_VSO // M25 6281 Void TEncSearch::xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx, TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, Dist &ruiDist, Dist *puiZeroDist ) 6282 #else 4565 6283 4566 Void TEncSearch::xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx, TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, UInt &ruiDist, UInt *puiZeroDist ) 6284 #endif6285 4567 { 6286 4568 const UInt uiTrMode = uiDepth - pcCU->getDepth( 0 ); … … 6319 4601 Double dSingleCost = MAX_DOUBLE; 6320 4602 UInt uiSingleBits = 0; 6321 #if H_3D_VSO6322 Dist uiSingleDist = 0;6323 #else6324 4603 UInt uiSingleDist = 0; 6325 #endif6326 4604 UInt uiAbsSumY = 0, uiAbsSumU = 0, uiAbsSumV = 0; 6327 4605 UInt uiBestTransformMode[3] = {0}; … … 6444 4722 ::memset( m_pTempPel, 0, sizeof( Pel ) * uiNumSamplesLuma ); // not necessary needed for inside of recursion (only at the beginning) 6445 4723 6446 #if H_3D_VSO // M276447 Dist uiDistY;6448 if ( m_pcRdCost->getUseVSO() )6449 {6450 if( m_pcRdCost->getUseEstimatedVSD() )6451 {6452 uiDistY = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPartIdx, m_pTempPel, 1<< uiLog2TrSize, pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false );6453 }6454 else6455 {6456 uiDistY = m_pcRdCost->getDistPartVSO ( pcCU, uiAbsPartIdx, pcPred->getLumaAddr( uiAbsPartIdx ), pcPred->getStride(), pcOrg->getLumaAddr( uiAbsPartIdx), pcOrg->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false ); // initialized with zero residual distortion6457 }6458 }6459 else6460 {6461 uiDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pTempPel, trWidth, pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth, trHeight ); // initialized with zero residual destortion6462 }6463 #else6464 4724 UInt uiDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pTempPel, trWidth, pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth, trHeight ); // initialized with zero residual destortion 6465 #endif6466 4725 6467 4726 if ( puiZeroDist ) … … 6479 4738 m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA,REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcCoeffCurrY, trWidth, trHeight, scalingListType );//this is for inter mode only 6480 4739 6481 #if H_3D_VSO // M286482 Dist uiNonzeroDistY;6483 if ( m_pcRdCost->getUseVSO() )6484 {6485 if ( m_pcRdCost->getUseEstimatedVSD() )6486 {6487 uiNonzeroDistY = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPartIdx, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( uiAbsPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false );6488 }6489 else6490 {6491 m_cYuvRecTemp.addClipPartLuma( &m_pcQTTempTComYuv[uiQTTempAccessLayer], pcPred, uiAbsPartIdx, 1<< uiLog2TrSize );6492 uiNonzeroDistY = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPartIdx, m_cYuvRecTemp.getLumaAddr(uiAbsPartIdx), m_cYuvRecTemp.getStride(),6493 pcOrg->getLumaAddr( uiAbsPartIdx ), pcOrg->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false );6494 }6495 }6496 else6497 {6498 uiNonzeroDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth,trHeight );6499 }6500 #else6501 4740 const UInt uiNonzeroDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), 6502 4741 pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth,trHeight ); 6503 #endif6504 4742 if (pcCU->isLosslessCoded(0)) 6505 4743 { … … 6508 4746 else 6509 4747 { 6510 #if H_3D_VSO // M296511 Double singleCostY;6512 if ( m_pcRdCost->getUseLambdaScaleVSO())6513 singleCostY = m_pcRdCost->calcRdCostVSO( uiSingleBitsY, uiNonzeroDistY );6514 else6515 singleCostY = m_pcRdCost->calcRdCost( uiSingleBitsY, uiNonzeroDistY );6516 #else6517 4748 const Double singleCostY = m_pcRdCost->calcRdCost( uiSingleBitsY, uiNonzeroDistY ); 6518 #endif6519 4749 m_pcEntropyCoder->resetBits(); 6520 4750 m_pcEntropyCoder->encodeQtCbfZero( pcCU, TEXT_LUMA, uiTrMode ); 6521 4751 const UInt uiNullBitsY = m_pcEntropyCoder->getNumberOfWrittenBits(); 6522 #if H_3D_VSO // M296523 Double nullCostY;6524 if ( m_pcRdCost->getUseLambdaScaleVSO())6525 nullCostY = m_pcRdCost->calcRdCostVSO( uiNullBitsY, uiDistY );6526 else6527 nullCostY = m_pcRdCost->calcRdCost ( uiNullBitsY, uiDistY );6528 #else6529 4752 const Double nullCostY = m_pcRdCost->calcRdCost( uiNullBitsY, uiDistY ); 6530 #endif6531 4753 if( nullCostY < singleCostY ) 6532 4754 { … … 6553 4775 m_pcEntropyCoder->encodeQtCbfZero( pcCU, TEXT_LUMA, uiTrMode ); 6554 4776 const UInt uiNullBitsY = m_pcEntropyCoder->getNumberOfWrittenBits(); 6555 #if H_3D_VSO // M NEW016556 if ( m_pcRdCost->getUseRenModel() )6557 minCostY = m_pcRdCost->calcRdCostVSO( uiNullBitsY, uiDistY );6558 else6559 #endif6560 4777 minCostY = m_pcRdCost->calcRdCost( uiNullBitsY, uiDistY ); 6561 4778 } … … 6725 4942 if( checkTransformSkipY ) 6726 4943 { 6727 #if H_3D_VSO6728 Dist uiNonzeroDistY;6729 UInt uiAbsSumTransformSkipY;6730 #else6731 4944 UInt uiNonzeroDistY, uiAbsSumTransformSkipY; 6732 #endif6733 4945 Double dSingleCostY; 6734 4946 … … 6785 4997 m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA,REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcCoeffCurrY, trWidth, trHeight, scalingListType, true ); 6786 4998 6787 #if H_3D_VSO // M NEW6788 if ( m_pcRdCost->getUseVSO() )6789 {6790 if ( m_pcRdCost->getUseEstimatedVSD() )6791 {6792 uiNonzeroDistY = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPartIdx, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( uiAbsPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false );6793 }6794 else6795 {6796 m_cYuvRecTemp.addClipPartLuma( &m_pcQTTempTComYuv[uiQTTempAccessLayer], pcPred, uiAbsPartIdx, 1<< uiLog2TrSize );6797 uiNonzeroDistY = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPartIdx, m_cYuvRecTemp.getLumaAddr(uiAbsPartIdx), m_cYuvRecTemp.getStride(),6798 pcOrg->getLumaAddr( uiAbsPartIdx ), pcOrg->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false );6799 }6800 }6801 else6802 #endif6803 4999 uiNonzeroDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), 6804 5000 pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth, trHeight ); 6805 5001 6806 #if H_3D_VSO6807 if ( m_pcRdCost->getUseRenModel() )6808 dSingleCostY = m_pcRdCost->calcRdCostVSO( uiTsSingleBitsY, uiNonzeroDistY );6809 else6810 #endif6811 5002 dSingleCostY = m_pcRdCost->calcRdCost( uiTsSingleBitsY, uiNonzeroDistY ); 6812 5003 } … … 7015 5206 7016 5207 uiSingleDist = uiDistY + uiDistU + uiDistV; 7017 #if H_3D_VSO // M307018 if ( m_pcRdCost->getUseLambdaScaleVSO())7019 dSingleCost = m_pcRdCost->calcRdCostVSO( uiSingleBits, uiSingleDist );7020 else7021 #endif7022 5208 dSingleCost = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDist ); 7023 5209 } … … 7031 5217 m_pcRDGoOnSbacCoder->load ( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] ); 7032 5218 } 7033 #if H_3D_VSO7034 Dist uiSubdivDist = 0;7035 #else7036 5219 UInt uiSubdivDist = 0; 7037 #endif7038 5220 UInt uiSubdivBits = 0; 7039 5221 Double dSubdivCost = 0.0; … … 7043 5225 { 7044 5226 UInt nsAddr = uiAbsPartIdx + ui * uiQPartNumSubdiv; 7045 #if H_3D_VSO // M317046 xEstimateResidualQT( pcCU, ui, uiAbsPartIdx + ui * uiQPartNumSubdiv, nsAddr, pcOrg, pcPred, pcResi, uiDepth + 1, dSubdivCost, uiSubdivBits, uiSubdivDist, bCheckFull ? NULL : puiZeroDist );7047 #else7048 5227 xEstimateResidualQT( pcCU, ui, uiAbsPartIdx + ui * uiQPartNumSubdiv, nsAddr, pcResi, uiDepth + 1, dSubdivCost, uiSubdivBits, uiSubdivDist, bCheckFull ? NULL : puiZeroDist ); 7049 #endif7050 5228 } 7051 5229 … … 7075 5253 7076 5254 uiSubdivBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 7077 #if H_3D_VSO // M327078 if ( m_pcRdCost->getUseLambdaScaleVSO())7079 dSubdivCost = m_pcRdCost->calcRdCostVSO( uiSubdivBits, uiSubdivDist );7080 else7081 #endif7082 5255 dSubdivCost = m_pcRdCost->calcRdCost( uiSubdivBits, uiSubdivDist ); 7083 5256 … … 7102 5275 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_TEST ] ); 7103 5276 } 7104 #if H_3D_VSO // M337105 if( m_pcRdCost->getUseRenModel() && !m_pcRdCost->getUseEstimatedVSD() )7106 {7107 UInt uiWidth = 1<< uiLog2TrSize;7108 UInt uiHeight = 1<< uiLog2TrSize;7109 Pel* piSrc;7110 UInt uiSrcStride;7111 if ( uiAbsSumY )7112 {7113 UInt uiQTLayer = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - uiLog2TrSize;7114 m_cYuvRecTemp.addClipPartLuma( &m_pcQTTempTComYuv[uiQTLayer], pcPred, uiAbsPartIdx, 1<< uiLog2TrSize );7115 piSrc = m_cYuvRecTemp.getLumaAddr( uiAbsPartIdx );7116 uiSrcStride = m_cYuvRecTemp.getStride ();7117 }7118 else7119 {7120 piSrc = pcPred->getLumaAddr( uiAbsPartIdx );7121 uiSrcStride = pcPred->getStride ();7122 }7123 m_pcRdCost->setRenModelData( pcCU, uiAbsPartIdx, piSrc, (Int) uiSrcStride, (Int) uiWidth, (Int) uiHeight );7124 }7125 #endif7126 5277 rdCost += dSingleCost; 7127 5278 ruiBits += uiSingleBits; … … 7315 5466 // Reload only contexts required for coding intra mode information 7316 5467 m_pcRDGoOnSbacCoder->loadIntraDirModeLuma( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] ); 7317 #if H_3D_DIM7318 m_pcRDGoOnSbacCoder->loadIntraDepthMode( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );7319 #endif7320 5468 7321 5469 pcCU->setLumaIntraDirSubParts ( uiMode, uiPartOffset, uiDepth + uiInitTrDepth ); … … 7372 5520 m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true); 7373 5521 m_pcEntropyCoder->encodeMergeIndex(pcCU, 0, true); 7374 #if H_3D_ARP7375 m_pcEntropyCoder->encodeARPW( pcCU, 0 );7376 #endif7377 #if H_3D_IC7378 m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );7379 #endif7380 5522 ruiBits += m_pcEntropyCoder->getNumberOfWrittenBits(); 7381 5523 } … … 7388 5530 } 7389 5531 m_pcEntropyCoder->encodeSkipFlag ( pcCU, 0, true ); 7390 #if MTK_SINGLE_DEPTH_MODE_I00957391 m_pcEntropyCoder->encodeSingleDepthMode ( pcCU, 0, true );7392 #endif7393 5532 m_pcEntropyCoder->encodePredMode( pcCU, 0, true ); 7394 5533 m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true ); 7395 #if H_3D_DIM_SDC7396 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );7397 #endif7398 5534 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true ); 7399 #if H_3D_ARP7400 m_pcEntropyCoder->encodeARPW( pcCU , 0 );7401 #endif7402 #if H_3D_IC7403 m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );7404 #endif7405 5535 Bool bDummy = false; 7406 5536 m_pcEntropyCoder->encodeCoeff ( pcCU, 0, pcCU->getDepth(0), pcCU->getWidth(0), pcCU->getHeight(0), bDummy ); … … 7651 5781 } 7652 5782 7653 #if H_3D_DIM7654 // -------------------------------------------------------------------------------------------------------------------7655 // Depth intra search7656 // -------------------------------------------------------------------------------------------------------------------7657 Void TEncSearch::xCalcBiSegDCs( Pel* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& valDC1, Pel& valDC2 )7658 {7659 valDC1 = ( 1<<( g_bitDepthY - 1) );7660 valDC2 = ( 1<<( g_bitDepthY - 1) );7661 7662 UInt uiDC1 = 0;7663 UInt uiDC2 = 0;7664 UInt uiNumPixDC1 = 0, uiNumPixDC2 = 0;7665 if( srcStride == patternStride )7666 {7667 for( UInt k = 0; k < (patternStride * patternStride); k++ )7668 {7669 if( true == biSegPattern[k] )7670 {7671 uiDC2 += ptrSrc[k];7672 uiNumPixDC2++;7673 }7674 else7675 {7676 uiDC1 += ptrSrc[k];7677 uiNumPixDC1++;7678 }7679 }7680 }7681 else7682 {7683 Pel* piTemp = ptrSrc;7684 for( UInt uiY = 0; uiY < patternStride; uiY++ )7685 {7686 for( UInt uiX = 0; uiX < patternStride; uiX++ )7687 {7688 if( true == biSegPattern[uiX] )7689 {7690 uiDC2 += piTemp[uiX];7691 uiNumPixDC2++;7692 }7693 else7694 {7695 uiDC1 += piTemp[uiX];7696 uiNumPixDC1++;7697 }7698 }7699 piTemp += srcStride;7700 biSegPattern += patternStride;7701 }7702 }7703 7704 if( uiNumPixDC1 > 0 ) { valDC1 = uiDC1 / uiNumPixDC1; }7705 if( uiNumPixDC2 > 0 ) { valDC2 = uiDC2 / uiNumPixDC2; }7706 }7707 7708 #if H_3D_DIM_DMM7709 Void TEncSearch::xSearchDmmDeltaDCs( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piOrig, Pel* piPredic, UInt uiStride, Bool* biSegPattern, Int patternStride, UInt uiWidth, UInt uiHeight, Pel& rDeltaDC1, Pel& rDeltaDC2 )7710 {7711 assert( biSegPattern );7712 Pel origDC1 = 0; Pel origDC2 = 0;7713 xCalcBiSegDCs ( piOrig, uiStride, biSegPattern, patternStride, origDC1, origDC2 );7714 xAssignBiSegDCs( piPredic, uiStride, biSegPattern, patternStride, origDC1, origDC2 );7715 7716 Int* piMask = pcCU->getPattern()->getAdiOrgBuf( uiWidth, uiHeight, m_piYuvExt ); // no filtering for DMM7717 Int maskStride = 2*uiWidth + 1;7718 Int* ptrSrc = piMask+maskStride+1;7719 Pel predDC1 = 0; Pel predDC2 = 0;7720 xPredBiSegDCs( ptrSrc, maskStride, biSegPattern, patternStride, predDC1, predDC2 );7721 7722 rDeltaDC1 = origDC1 - predDC1;7723 rDeltaDC2 = origDC2 - predDC2;7724 7725 #if H_3D_VSO7726 if( m_pcRdCost->getUseVSO() )7727 {7728 Pel fullDeltaDC1 = rDeltaDC1;7729 Pel fullDeltaDC2 = rDeltaDC2;7730 7731 Dist uiBestDist = RDO_DIST_MAX;7732 UInt uiBestQStepDC1 = 0;7733 UInt uiBestQStepDC2 = 0;7734 7735 UInt uiDeltaDC1Max = abs(fullDeltaDC1);7736 UInt uiDeltaDC2Max = abs(fullDeltaDC2);7737 7738 //VSO Level delta DC check range extension7739 uiDeltaDC1Max += (uiDeltaDC1Max>>1);7740 uiDeltaDC2Max += (uiDeltaDC2Max>>1);7741 7742 // limit search range to [0, IBDI_MAX]7743 if( fullDeltaDC1 < 0 && uiDeltaDC1Max > abs(predDC1) ) { uiDeltaDC1Max = abs(predDC1); }7744 if( fullDeltaDC1 >= 0 && uiDeltaDC1Max > ((1 << g_bitDepthY)-1) - abs(predDC1) ) { uiDeltaDC1Max = ((1 << g_bitDepthY)-1) - abs(predDC1); }7745 7746 if( fullDeltaDC2 < 0 && uiDeltaDC2Max > abs(predDC2) ) { uiDeltaDC2Max = abs(predDC2); }7747 if( fullDeltaDC2 >= 0 && uiDeltaDC2Max > ((1 << g_bitDepthY)-1) - abs(predDC2) ) { uiDeltaDC2Max = ((1 << g_bitDepthY)-1) - abs(predDC2); }7748 7749 // init dist with original segment DCs7750 xAssignBiSegDCs( piPredic, uiStride, biSegPattern, patternStride, origDC1, origDC2 );7751 7752 Dist uiOrgDist = RDO_DIST_MAX;7753 if( m_pcRdCost->getUseEstimatedVSD() )7754 {7755 uiOrgDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPtIdx, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false );7756 }7757 else7758 {7759 uiOrgDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPtIdx, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false );7760 }7761 7762 uiBestDist = uiOrgDist;7763 uiBestQStepDC1 = abs(fullDeltaDC1);7764 uiBestQStepDC2 = abs(fullDeltaDC2);7765 7766 // coarse search with step size 47767 for( UInt uiQStepDC1 = 0; uiQStepDC1 < uiDeltaDC1Max; uiQStepDC1 += 4 )7768 {7769 Pel testDC1 = ClipY( predDC1 + ((Int)(uiQStepDC1) * (( fullDeltaDC1 < 0 ) ? -1 : 1)) );7770 for( UInt uiQStepDC2 = 0; uiQStepDC2 < uiDeltaDC2Max; uiQStepDC2 += 4 )7771 {7772 Pel testDC2 = ClipY( predDC2 + ((Int)(uiQStepDC2) * (( fullDeltaDC2 < 0 ) ? -1 : 1)) );7773 7774 xAssignBiSegDCs( piPredic, uiStride, biSegPattern, patternStride, testDC1, testDC2 );7775 7776 Dist uiAct4Dist = RDO_DIST_MAX;7777 if( m_pcRdCost->getUseEstimatedVSD() )7778 {7779 uiAct4Dist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPtIdx, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false );7780 }7781 else7782 {7783 uiAct4Dist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPtIdx, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false );7784 }7785 7786 if( uiAct4Dist < uiBestDist || uiBestDist == RDO_DIST_MAX )7787 {7788 uiBestDist = uiAct4Dist;7789 uiBestQStepDC1 = uiQStepDC1;7790 uiBestQStepDC2 = uiQStepDC2;7791 }7792 }7793 }7794 7795 // refinement +-37796 for( UInt uiQStepDC1 = (UInt)max(0, ((Int)uiBestQStepDC1-3)); uiQStepDC1 <= (uiBestQStepDC1+3); uiQStepDC1++ )7797 {7798 Pel testDC1 = ClipY( predDC1 + ((Int)(uiQStepDC1) * (( fullDeltaDC1 < 0 ) ? -1 : 1)) );7799 for( UInt uiQStepDC2 = (UInt)max(0, ((Int)uiBestQStepDC2-3)); uiQStepDC2 <= (uiBestQStepDC2+3); uiQStepDC2++ )7800 {7801 Pel testDC2 = ClipY( predDC2 + ((Int)(uiQStepDC2) * (( fullDeltaDC2 < 0 ) ? -1 : 1)) );7802 7803 xAssignBiSegDCs( piPredic, uiStride, biSegPattern, patternStride, testDC1, testDC2 );7804 7805 Dist uiActDist = RDO_DIST_MAX;7806 if( m_pcRdCost->getUseEstimatedVSD() )7807 {7808 uiActDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPtIdx, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false );7809 }7810 else7811 {7812 uiActDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPtIdx, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false );7813 }7814 7815 if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )7816 {7817 uiBestDist = uiActDist;7818 uiBestQStepDC1 = uiQStepDC1;7819 uiBestQStepDC2 = uiQStepDC2;7820 }7821 }7822 }7823 rDeltaDC1 = (Int)(uiBestQStepDC1) * (Int)(( fullDeltaDC1 < 0 ) ? -1 : 1);7824 rDeltaDC2 = (Int)(uiBestQStepDC2) * (Int)(( fullDeltaDC2 < 0 ) ? -1 : 1);7825 }7826 #endif7827 7828 #if H_3D_DIM_DLT7829 rDeltaDC1 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC1 + rDeltaDC1) ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 );7830 rDeltaDC2 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC2 + rDeltaDC2) ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 );7831 #endif7832 }7833 7834 Void TEncSearch::xSearchDmm1Wedge( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx )7835 {7836 ruiTabIdx = 0;7837 7838 // local pred buffer7839 TComYuv cPredYuv;7840 cPredYuv.create( uiWidth, uiHeight );7841 cPredYuv.clear();7842 7843 UInt uiPredStride = cPredYuv.getStride();7844 Pel* piPred = cPredYuv.getLumaAddr();7845 7846 Pel refDC1 = 0; Pel refDC2 = 0;7847 #if SHARP_DMM1_I01107848 WedgeList* pacWedgeList = pcCU->isDMM1UpscaleMode( uiWidth ) ? &g_dmmWedgeLists[(g_aucConvertToBit[pcCU->getDMM1BasePatternWidth(uiWidth)])] : &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])];7849 WedgeNodeList* pacWedgeNodeList = pcCU->isDMM1UpscaleMode( uiWidth ) ? &g_dmmWedgeNodeLists[(g_aucConvertToBit[pcCU->getDMM1BasePatternWidth(uiWidth)])] : &g_dmmWedgeNodeLists[(g_aucConvertToBit[uiWidth])];7850 #else7851 WedgeList* pacWedgeList = &g_dmmWedgeLists [(g_aucConvertToBit[uiWidth])];7852 WedgeNodeList* pacWedgeNodeList = &g_dmmWedgeNodeLists[(g_aucConvertToBit[uiWidth])];7853 #endif7854 7855 // coarse wedge search7856 Dist uiBestDist = RDO_DIST_MAX;7857 UInt uiBestNodeId = 0;7858 for( UInt uiNodeId = 0; uiNodeId < pacWedgeNodeList->size(); uiNodeId++ )7859 {7860 TComWedgelet* pcWedgelet = &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx()));7861 #if SHARP_DMM1_I01107862 Bool *pbPattern = pcCU->isDMM1UpscaleMode(uiWidth) ? pcWedgelet->getScaledPattern(uiWidth) : pcWedgelet->getPattern();7863 UInt uiStride = pcCU->isDMM1UpscaleMode(uiWidth) ? uiWidth : pcWedgelet->getStride();7864 xCalcBiSegDCs ( piRef, uiRefStride, pbPattern, uiStride, refDC1, refDC2 );7865 xAssignBiSegDCs( piPred, uiPredStride, pbPattern, uiStride, refDC1, refDC2 );7866 #else7867 xCalcBiSegDCs ( piRef, uiRefStride, pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );7868 xAssignBiSegDCs( piPred, uiPredStride, pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );7869 #endif7870 7871 Dist uiActDist = RDO_DIST_MAX;7872 #if H_3D_VSO7873 if( m_pcRdCost->getUseVSO() )7874 {7875 if( m_pcRdCost->getUseEstimatedVSD() )7876 {7877 uiActDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPtIdx, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false );7878 }7879 else7880 {7881 uiActDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPtIdx, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false );7882 }7883 }7884 else7885 #endif7886 {7887 uiActDist = m_pcRdCost->getDistPart( g_bitDepthY, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, TEXT_LUMA, DF_SAD );7888 }7889 7890 if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )7891 {7892 uiBestDist = uiActDist;7893 uiBestNodeId = uiNodeId;7894 }7895 }7896 7897 // refinement7898 Dist uiBestDistRef = uiBestDist;7899 UInt uiBestTabIdxRef = pacWedgeNodeList->at(uiBestNodeId).getPatternIdx();7900 for( UInt uiRefId = 0; uiRefId < DMM_NUM_WEDGE_REFINES; uiRefId++ )7901 {7902 if( pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId ) != DMM_NO_WEDGEINDEX )7903 {7904 TComWedgelet* pcWedgelet = &(pacWedgeList->at(pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId )));7905 #if SHARP_DMM1_I01107906 Bool *pbPattern = pcCU->isDMM1UpscaleMode(uiWidth) ? pcWedgelet->getScaledPattern(uiWidth) : pcWedgelet->getPattern();7907 UInt uiStride = pcCU->isDMM1UpscaleMode(uiWidth) ? uiWidth : pcWedgelet->getStride();7908 xCalcBiSegDCs ( piRef, uiRefStride, pbPattern, uiStride, refDC1, refDC2 );7909 xAssignBiSegDCs( piPred, uiPredStride, pbPattern, uiStride, refDC1, refDC2 );7910 #else7911 xCalcBiSegDCs ( piRef, uiRefStride, pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );7912 xAssignBiSegDCs( piPred, uiPredStride, pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );7913 #endif7914 Dist uiActDist = RDO_DIST_MAX;7915 #if H_3D_VSO7916 if( m_pcRdCost->getUseVSO() )7917 {7918 if( m_pcRdCost->getUseEstimatedVSD() ) //PM: use VSO instead of VSD here?7919 {7920 uiActDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPtIdx, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false );7921 }7922 else7923 {7924 uiActDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPtIdx, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false );7925 }7926 }7927 else7928 #endif7929 {7930 uiActDist = m_pcRdCost->getDistPart( g_bitDepthY, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, TEXT_LUMA, DF_SAD );7931 }7932 7933 if( uiActDist < uiBestDistRef || uiBestDistRef == RDO_DIST_MAX )7934 {7935 uiBestDistRef = uiActDist;7936 uiBestTabIdxRef = pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId );7937 }7938 }7939 }7940 7941 ruiTabIdx = uiBestTabIdxRef;7942 7943 cPredYuv.destroy();7944 return;7945 }7946 7947 7948 #endif7949 7950 #endif7951 5783 //! \} -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncSearch.h
r1039 r1072 121 121 Int m_iMaxDeltaQP; 122 122 123 #if H_3D_VSO // M17124 TComYuv m_cYuvRecTemp;125 #endif126 123 // AMVP cost computation 127 124 // UInt m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS]; … … 181 178 UInt& ruiDistC, 182 179 Bool bLumaOnly 183 #if HHI_DMM4_ENC_I0066184 , Bool bOnlyIVP185 #endif186 180 ); 187 181 Void estIntraPredChromaQT ( TComDataCU* pcCU, … … 191 185 TComYuv* pcRecoYuv, 192 186 UInt uiPreCalcDistC ); 193 #if MTK_SINGLE_DEPTH_MODE_I0095194 Void estIntraPredSingleDepth ( TComDataCU* pcCU,195 TComYuv* pcOrgYuv,196 TComYuv* pcPredYuv,197 TComYuv* pcResiYuv,198 TComYuv* pcRecoYuv,199 UInt& ruiDistC,200 Bool bLumaOnly );201 #endif202 187 203 188 /// encoder estimation - inter prediction (non-skip) … … 207 192 TComYuv*& rpcResiYuv, 208 193 TComYuv*& rpcRecoYuv, 209 #if H_3D_FAST_TEXTURE_ENCODING210 Bool bFMD,211 #endif212 194 Bool bUseRes = false 213 195 #if AMP_MRG … … 224 206 TComYuv*& rpcYuvRec, 225 207 Bool bSkipRes ); 226 #if H_3D_INTER_SDC227 Void encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU,228 TComYuv* pcOrg,229 TComYuv* pcPred,230 TComYuv* pcResi,231 TComYuv* pcRec,232 Int uiOffset,233 const UInt uiDepth );234 #endif235 208 /// set ME search range 236 209 Void setAdaptiveSearchRange ( Int iDir, Int iRefIdx, Int iSearchRange) { m_aaiAdaptSR[iDir][iRefIdx] = iSearchRange; } … … 278 251 TComYuv* pcPredYuv, 279 252 TComYuv* pcResiYuv, 280 #if H_3D_VSO281 Dist& ruiDist,282 #else283 253 UInt& ruiDist, 284 #endif285 254 Int default0Save1Load2 = 0 286 #if H_3D_DIM_ENC287 , Bool zeroResi = false288 #endif289 255 ); 290 256 Void xIntraCodingChromaBlk ( TComDataCU* pcCU, … … 305 271 TComYuv* pcPredYuv, 306 272 TComYuv* pcResiYuv, 307 #if H_3D_VSO308 Dist& ruiDistY,309 #else310 273 UInt& ruiDistY, 311 #endif312 274 UInt& ruiDistC, 313 275 #if HHI_RQT_INTRA_SPEEDUP … … 315 277 #endif 316 278 Double& dRDCost 317 #if H_3D_DIM_ENC318 , Bool zeroResi = false319 #endif320 279 ); 321 280 … … 354 313 UInt uiAbsPartIdx, 355 314 UInt stateU0V1Both2 ); 356 #if MTK_SINGLE_DEPTH_MODE_I0095357 Void xIntraCodingSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Int iTestDepthIdx, Pel * DepthNeighbor );358 #endif359 #if H_3D_DIM360 // -------------------------------------------------------------------------------------------------------------------361 // Depth intra search362 // -------------------------------------------------------------------------------------------------------------------363 Void xCalcBiSegDCs ( Pel* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& valDC1, Pel& valDC2 );364 #if H_3D_DIM_DMM365 Void xSearchDmmDeltaDCs ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piOrig, Pel* piPredic, UInt uiStride, Bool* biSegPattern, Int patternStride, UInt uiWidth, UInt uiHeight, Pel& rDeltaDC1, Pel& rDeltaDC2 );366 Void xSearchDmm1Wedge ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx );367 #endif368 #if H_3D_DIM_SDC369 Void xIntraCodingSDC ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi );370 #endif371 #endif372 315 373 316 // ------------------------------------------------------------------------------------------------------------------- … … 427 370 , TComMvField* cMvFieldNeighbours, 428 371 UChar* uhInterDirNeighbours 429 #if H_3D_VSP430 , Int* vspFlag431 #if !FIX_TICKET_79432 , InheritedVSPDisInfo* inheritedVSPDisInfo433 #endif434 #endif435 #if H_3D_SPIVMP436 , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP437 #endif438 372 , Int& numValidMergeCand 439 373 ); … … 443 377 TComMvField* mvFieldNeighbours, 444 378 UChar* interDirNeighbours, 445 #if H_3D_VSP && !FIX_TICKET_75446 Int* vspFlag,447 #endif448 379 Int numValidMergeCand ); 449 380 … … 514 445 515 446 Void xEncodeResidualQT( TComDataCU* pcCU, UInt uiAbsPartIdx, const UInt uiDepth, Bool bSubdivAndCbf, TextType eType ); 516 #if H_3D_VSO // M26517 Void xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx,TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, Dist &ruiDist, Dist *puiZeroDist );518 #else519 447 Void xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx,TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, UInt &ruiDist, UInt *puiZeroDist ); 520 #endif521 448 Void xSetResidualQTData( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx,UInt absTUPartIdx, TComYuv* pcResi, UInt uiDepth, Bool bSpatial ); 522 449 -
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncSlice.cpp
r976 r1072 157 157 m_pdRdPicQp = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 ); 158 158 m_piRdPicQp = (Int* )xMalloc( Int, m_pcCfg->getDeltaQpRD() * 2 + 1 ); 159 #if KWU_RC_MADPRED_E0227160 if(m_pcCfg->getUseRateCtrl())161 {162 m_pcRateCtrl = pcEncTop->getRateCtrl();163 }164 else165 {166 m_pcRateCtrl = NULL;167 }168 #else169 159 m_pcRateCtrl = pcEncTop->getRateCtrl(); 170 #endif171 160 } 172 161 … … 204 193 rpcSlice->setViewId ( pVPS->getViewId ( layerId ) ); 205 194 rpcSlice->setViewIndex ( pVPS->getViewIndex ( layerId ) ); 206 #if H_3D207 rpcSlice->setIsDepth ( pVPS->getDepthId ( layerId ) != 0 );208 #endif209 195 #endif 210 196 rpcSlice->setSPS( pSPS ); … … 215 201 rpcSlice->setPicOutputFlag( true ); 216 202 rpcSlice->setPOC( pocCurr ); 217 #if H_3D_IC218 rpcSlice->setApplyIC( false );219 #endif220 203 // depth computation based on GOP size 221 204 Int depth; … … 437 420 m_pcRdCost ->setLambda( dLambda ); 438 421 439 #if H_3D_VSO440 m_pcRdCost->setUseLambdaScaleVSO ( (m_pcCfg->getUseVSO() || m_pcCfg->getForceLambdaScaleVSO()) && m_pcCfg->getIsDepth() );441 m_pcRdCost->setLambdaVSO ( dLambda * m_pcCfg->getLambdaScaleVSO() );442 443 // Should be moved to TEncTop444 445 // SAIT_VSO_EST_A0033446 m_pcRdCost->setDisparityCoeff( m_pcCfg->getDispCoeff() );447 448 // LGE_WVSO_A0119449 if( m_pcCfg->getUseWVSO() && m_pcCfg->getIsDepth() )450 {451 m_pcRdCost->setDWeight ( m_pcCfg->getDWeight() );452 m_pcRdCost->setVSOWeight( m_pcCfg->getVSOWeight() );453 m_pcRdCost->setVSDWeight( m_pcCfg->getVSDWeight() );454 }455 456 #endif457 422 458 423 // for RDO … … 607 572 rpcSlice->setSliceSegmentMode ( m_pcCfg->getSliceSegmentMode() ); 608 573 rpcSlice->setSliceSegmentArgument ( m_pcCfg->getSliceSegmentArgument() ); 609 #if H_3D_IV_MERGE610 if(rpcSlice->getIsDepth())611 {612 rpcSlice->setMaxNumMergeCand ( m_pcCfg->getMaxNumMergeCand() + ( ( rpcSlice->getVPS()->getMPIFlag( rpcSlice->getLayerIdInVps() ) || rpcSlice->getVPS()->getIvMvPredFlag( rpcSlice->getLayerIdInVps() ) ) ? 1 : 0 ) );613 }614 else615 {616 rpcSlice->setMaxNumMergeCand ( m_pcCfg->getMaxNumMergeCand() + ( rpcSlice->getVPS()->getIvMvPredFlag( rpcSlice->getLayerIdInVps() ) ? 1 : 0 ) );617 }618 #else619 574 rpcSlice->setMaxNumMergeCand ( m_pcCfg->getMaxNumMergeCand() ); 620 #endif621 575 xStoreWPparam( pPPS->getUseWP(), pPPS->getWPBiPred() ); 622 576 } … … 766 720 767 721 Double dPicRdCost; 768 #if H_3D_VSO769 Dist64 uiPicDist = m_uiPicDist;770 #else771 722 UInt64 uiPicDist = m_uiPicDist; 772 #endif773 723 UInt64 uiALFBits = 0; 774 724 … … 777 727 // compute RD cost and choose the best 778 728 dPicRdCost = m_pcRdCost->calcRdCost64( m_uiPicTotalBits + uiALFBits, uiPicDist, true, DF_SSE_FRAME); 779 #if H_3D780 // Above calculation need to be fixed for VSO, including frameLambda value.781 #endif782 729 783 730 if ( dPicRdCost < dPicRdCostBest ) … … 925 872 Int iNumSubstreams = 1; 926 873 UInt uiTilesAcross = 0; 927 #if H_3D_IC928 if ( pcEncTop->getViewIndex() && pcEncTop->getUseIC() &&929 !( ( pcSlice->getSliceType() == P_SLICE && pcSlice->getPPS()->getUseWP() ) || ( pcSlice->getSliceType() == B_SLICE && pcSlice->getPPS()->getWPBiPred() ) )930 )931 {932 pcSlice ->xSetApplyIC(pcEncTop->getUseICLowLatencyEnc());933 if ( pcSlice->getApplyIC() )934 {935 pcSlice->setIcSkipParseFlag( pcSlice->getPOC() % m_pcCfg->getIntraPeriod() != 0 );<